@faithfulalabi/agent-lens 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faithfulalabi/agent-lens",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Local-first agentic tracing platform: inspect everything your agent did in a session.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -223,7 +223,7 @@ Error generating stack: `+l.message+`
223
223
 
224
224
  `);e=i.pop()??"";const l=[];for(const o of i){const s=sw(o);s!==void 0&&l.push(s)}return l}}}function sw(e){const t=[];let n,r,i,l=!1;for(const s of e.split(`
225
225
  `)){if(s===""||s.startsWith(":"))continue;const a=s.indexOf(":"),u=a===-1?s:s.slice(0,a),d=a===-1?"":s.slice(a+1),c=d.startsWith(" ")?d.slice(1):d;switch(u){case"event":n=c,l=!0;break;case"data":t.push(c),l=!0;break;case"id":r=c,l=!0;break;case"retry":/^\d+$/.test(c)&&(i=Number(c)),l=!0;break}}if(!l)return;const o={event:n??"message",data:t.join(`
226
- `)};return r!==void 0&&(o.id=r),i!==void 0&&(o.retry=i),o}function aw(e={}){const t=e.path??Z0,n=e.fetchImpl??globalThis.fetch,r=e.sleepImpl??pw,i=e.now??(()=>Date.now()),l=e.random??(()=>Math.random()),o=e.watchdogMs??nw,s=e.bootstrap??Wm(),a=new AbortController;let u=!1,d,c={kind:"connecting"},f,p=0,x=0;function v(I){var _;c.kind==="closed"||c.kind==="auth_error"||(c=I,(_=e.onState)==null||_.call(e,I))}function E(I){var _;(_=e.onError)==null||_.call(e,I)}function h(I){if(!Number.isFinite(o))return;const _=++p;x=i()+o,(async()=>{for(;_===p&&!I.signal.aborted;){const z=x-i();if(z<=0){I.abort(new DOMException("agent-lens: stream went silent","AbortError"));return}await r(z,I.signal)}})()}function g(){Number.isFinite(o)&&(x=i()+o)}function k(){p+=1}function C(I){var z;if(g(),I.event==="heartbeat")return;if(I.event==="error"){E(new Error(`agent-lens: the stream reported an error (${I.data})`));return}if(!lw.has(I.event))return;let _;try{_=JSON.parse(I.data)}catch(S){E(new Error(`agent-lens: could not decode a "${I.event}" payload (${S instanceof Error?S.message:String(S)})`));return}(z=e.onEvent)==null||z.call(e,{event:I.event,data:_,...I.id===void 0?{}:{id:I.id}})}async function N(){const I=new AbortController;d=I;let _=!1,z,S;try{const j=await n(t,{method:"GET",headers:{[s.tokenHeader]:s.token},signal:I.signal});if(j.status===401||j.status===403)z=new qm(j.status,await cw(j));else if(!j.ok)S=new Error(`agent-lens: the stream returned HTTP ${j.status}`);else if(j.body===null)S=new Error("agent-lens: the stream response carried no body");else{_=!0,v({kind:"open"}),h(I);const O=j.body.getReader(),U=new TextDecoder,G=ow();for(;;){const{done:W,value:X}=await O.read();if(W)break;for(const re of G.push(U.decode(X,{stream:!0})))C(re)}}}catch(j){S=j}finally{k(),d=void 0}return u?{kind:"closed"}:z!==void 0?{kind:"auth",error:z}:(S!==void 0&&!dw(S)&&E(fw(S)),{kind:"retry",reachedOpen:_})}async function b(){let I=0;for(;!u;){v({kind:"connecting"});const _=await N();if(_.kind==="closed")break;if(_.kind==="auth"){v({kind:"auth_error",error:_.error});return}_.reachedOpen&&(I=0);const z=uw(I,l);I+=1,v({kind:"reconnecting",attempt:I,nextRetryAt:i()+z}),await r(z,a.signal)}v({kind:"closed"})}return{start(){return f??(f=b()),f},close(){u||(u=!0,v({kind:"closed"}),k(),a.abort(),d==null||d.abort(new DOMException("agent-lens: stream closed","AbortError")))},get state(){return c}}}function uw(e,t){return t()*Math.min(iw,rw*2**e)}async function cw(e){try{const t=(await e.text()).trim();return t===""?`HTTP ${e.status}`:t}catch{return`HTTP ${e.status}`}}function dw(e){return typeof e=="object"&&e!==null&&e.name==="AbortError"}function fw(e){return e instanceof Error?e:new Error(String(e))}function pw(e,t){return new Promise(n=>{if((t==null?void 0:t.aborted)===!0){n();return}const r=()=>{clearTimeout(i),t==null||t.removeEventListener("abort",r),n()},i=setTimeout(r,e);t==null||t.addEventListener("abort",r,{once:!0})})}function hw(e,t={}){const n=M.useRef(e);n.current=e;const r=M.useRef(t);r.current=t,M.useEffect(()=>{const l=(r.current.create??aw)({onEvent:({event:o,data:s})=>{o==="session_changed"?n.current.publish({event:o,data:s}):o==="session_indexed"?n.current.publish({event:o,data:s}):o==="warm_progress"&&n.current.publish({event:o,data:s})},onState:o=>{var s,a;return(a=(s=r.current).onState)==null?void 0:a.call(s,o)}});return l.start(),()=>l.close()},[])}const mw=/^\d+$/;function Dd(e){const t=gw(e);if(t==="/")return{name:"sessions"};if(t==="/showcase")return{name:"showcase"};if(t==="/search")return{name:"search"};const n=t.slice(1).split("/");if(n[0]==="search"&&n.length===3&&n[1]==="session"){const r=Fd(n[2]);if(r!==void 0&&r!=="")return{name:"search",sessionId:r}}if(n[0]==="session"){const r=Fd(n[1]);if(r!==void 0&&r!==""){if(n.length===2)return{name:"session",sessionId:r};if(n.length===4&&mw.test(n[3]??"")){if(n[2]==="trace")return{name:"trace",sessionId:r,turnSeq:Number(n[3])};if(n[2]==="event")return{name:"event",sessionId:r,seq:Number(n[3])}}}}return{name:"not_found",path:e}}function Bn(e){switch(e.name){case"sessions":return"/";case"showcase":return"/showcase";case"session":return`/session/${encodeURIComponent(e.sessionId)}`;case"trace":return`/session/${encodeURIComponent(e.sessionId)}/trace/${e.turnSeq}`;case"search":return e.sessionId===void 0?"/search":`/search/session/${encodeURIComponent(e.sessionId)}`;case"event":return`/session/${encodeURIComponent(e.sessionId)}/event/${e.seq}`;case"not_found":return e.path}}function gw(e){var r;const t=((r=e.split("?")[0])==null?void 0:r.split("#")[0])??"",n=t.startsWith("/")?t:`/${t}`;return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function Fd(e){if(e!==void 0)try{return decodeURIComponent(e)}catch{return e}}function xw(){return{path:()=>window.location.pathname,push:e=>{window.history.pushState(null,"",e)},replace:e=>{window.history.replaceState(null,"",e)},onPopState:e=>(window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)})}}function yw(e=xw()){const t=new Set;let n=e.path(),r=Dd(n);function i(){const l=e.path();if(l!==n){n=l,r=Dd(l);for(const o of[...t])o()}}return e.onPopState(i),{getRoute:()=>r,navigate(l,o={}){const s=Bn(l);o.replace===!0?e.replace(s):e.push(s),i()},subscribe(l){return t.add(l),()=>{t.delete(l)}}}}let $d;function Gm(){return $d??($d=yw()),$d}function kw(e=Gm()){return M.useSyncExternalStore(e.subscribe,e.getRoute,e.getRoute)}const Ym={kind:"loading"};function vw(){return{requestId:0,state:Ym}}function ww(e,t){return t.type==="start"?{requestId:t.requestId,state:Ym}:t.requestId!==e.requestId?e:{requestId:e.requestId,state:t.type==="resolve"?{kind:"ok",value:t.value}:{kind:"error",error:t.error}}}function $u(e,t,n=0){const[r,i]=M.useReducer(ww,vw()),l=M.useRef(0),o=M.useRef(t);return o.current=t,M.useEffect(()=>{const s=++l.current,a=new AbortController;return i({type:"start",requestId:s}),o.current(a.signal).then(u=>i({type:"resolve",requestId:s,value:u}),u=>i({type:"reject",requestId:s,error:u})),()=>a.abort()},[e,n]),r.state}const ds="<mark>",Vd="</mark>";function Sw(e){if(e==null||e==="")return[];const t=[];let n=e;for(;n!=="";){const r=n.indexOf(ds);if(r===-1)break;const i=n.indexOf(Vd,r+ds.length);if(i===-1)break;r>0&&t.push({text:n.slice(0,r),matched:!1});const l=n.slice(r+ds.length,i);l!==""&&t.push({text:l,matched:!0}),n=n.slice(i+Vd.length)}return n!==""&&t.push({text:n,matched:!1}),t}function bw(e){const t=e.trim();return t===""?{kind:"idle"}:{kind:"search",q:t}}function Cw(e){return e==="session"?"Searching this session.":"Searching all projected transcripts, including sub-agent transcripts the session list does not show."}function Ew(e,t,n){if(e.kind==="idle"||t>0)return null;const r=`No matches for ${JSON.stringify(e.q)}.`;return n>0?`${r} ${n} transcripts are not indexed yet, so this answer covers part of the corpus.`:r}function _w(e){const t=new Map;for(const n of e){const r=t.get(n.session_id);if(r===void 0){t.set(n.session_id,{sessionId:n.session_id,title:n.session_title,projectPath:n.project_path,hits:[n]});continue}r.hits.push(n)}return[...t.values()]}function Iw(e,t){return t===null?`Warm the remaining ${e}`:t.done>=t.total?`Warmed ${t.total} transcripts`:`Warming ${t.done} of ${t.total}`}function Nw(e,t){if(e===null)return{latch:null,revealIndex:void 0};const n=t.findIndex(r=>r.id===e.eventId);return n===-1?{latch:e,revealIndex:void 0}:{latch:null,revealIndex:n,selectedId:e.eventId,focusedIndex:n}}function Tw({hit:e}){const t=Sw(e.snippet);return m.jsxs("a",{href:Bn({name:"event",sessionId:e.session_id,seq:e.seq}),"data-slot":"search-hit","data-event-id":e.event_id,className:"flex flex-col gap-0.5 rounded-md px-2 py-1.5 text-xs text-foreground transition-colors hover:bg-surface",children:[m.jsxs("span",{className:"flex items-center gap-2 text-2xs uppercase tracking-widest text-muted",children:[m.jsx("span",{children:e.kind}),e.name===null?null:m.jsx("span",{className:"truncate",children:e.name}),m.jsxs("span",{className:"ml-auto font-mono",children:["#",e.seq]})]}),m.jsx("span",{className:"min-w-0 font-mono text-2xs leading-relaxed text-muted",children:t.map((n,r)=>n.matched?m.jsx("mark",{className:"bg-surface-raised text-foreground",children:n.text},r):m.jsx("span",{children:n.text},r))})]})}function zw({scope:e,unprojectedCount:t,warm:n=null,onWarm:r}){return e==null?null:m.jsxs("div",{"data-slot":"search-scope",role:"status",className:"flex items-center gap-2 border-b border-border px-3 py-1.5 text-2xs text-muted",children:[m.jsx("span",{className:"min-w-0",children:Cw(e)}),t>0?m.jsx("button",{type:"button","data-slot":"search-warm",onClick:r,className:"ml-auto shrink-0 rounded-md bg-surface px-2 py-0.5 uppercase tracking-widest transition-colors hover:text-foreground",children:Iw(t,n)}):null]})}function jw({sessionId:e,api:t}={}){const n=M.useMemo(()=>t??Fu(),[t]),[r,i]=M.useState(""),l=bw(r),o=$u(`${l.kind==="idle"?"":l.q}|${e??""}`,p=>l.kind==="idle"?Promise.resolve(null):n.search(l.q,e===void 0?{}:{session:e},{signal:p})),s=o.kind==="ok"?o.value:null,[a,u]=M.useState(null),d=(s==null?void 0:s.unprojected_count)??0,c=_w((s==null?void 0:s.items)??[]),f=o.kind==="ok"?Ew(l,(s==null?void 0:s.items.length)??0,d):null;return m.jsxs("main",{"data-slot":"search-view",className:"flex h-full min-h-0 flex-col",children:[m.jsx("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-3",children:m.jsx("input",{"data-slot":"search-input",type:"search",value:r,onChange:p=>{i(p.target.value)},placeholder:"Search transcripts","aria-label":"Search transcripts",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted"})}),m.jsx(zw,{scope:(s==null?void 0:s.scope)??null,unprojectedCount:d,warm:a,onWarm:()=>{n.warm().then(({queued:p})=>{u({done:0,total:p})}).catch(()=>{})}}),m.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-2",children:o.kind==="error"?m.jsx("p",{className:"text-sm text-error",children:o.error.message}):f!==null?m.jsx("p",{"data-slot":"search-empty",className:"text-xs text-muted",children:f}):c.map(p=>m.jsxs("section",{className:"mb-3 flex flex-col gap-0.5",children:[m.jsx("h2",{className:"truncate px-2 text-2xs uppercase tracking-widest text-muted",children:p.title??p.projectPath}),p.hits.map(x=>m.jsx(Tw,{hit:x},x.event_id))]},p.sessionId))})]})}function Bd(e=new Set){return{selectedId:void 0,expandedIds:e,focusedIndex:0}}function Vu(e,t){return t<=0?0:Math.min(Math.max(e,0),t-1)}function Pw(e,t){const n=new Set(e);return n.add(t),n}function Aw(e,t){const n=new Set(e);return n.delete(t),n}function Ud(e,t){const n=e[t];if(n===void 0)return t;for(let r=t-1;r>=0;r-=1){const i=e[r];if(i!==void 0&&i.depth<n.depth)return r}return t}function At(e,t,n){const r=Vu(t,n.length);return r===e.focusedIndex?e:{...e,focusedIndex:r}}function Lw(e,t,n){const r=Vu(e.focusedIndex,t.length),i=e.selectedId!==void 0&&n.has(e.selectedId)?e.selectedId:void 0;return r===e.focusedIndex&&i===e.selectedId?e:{...e,focusedIndex:r,selectedId:i}}function Hd(e,t){const n=new Set(e.expandedIds);for(const r of t)n.add(r);return n.size===e.expandedIds.size?e:{...e,expandedIds:n}}function Mw(e,t,n){const r=Vu(e.focusedIndex,n.length),i=n[r];switch(t){case"j":case"ArrowDown":return At(e,r+1,n);case"k":case"ArrowUp":return At(e,r-1,n);case"Home":return At(e,0,n);case"End":return At(e,n.length-1,n);case"Enter":return i===void 0||i.id===e.selectedId?At(e,r,n):{...e,focusedIndex:r,selectedId:i.id};case"Escape":return At(e,Ud(n,r),n);case"ArrowRight":return i===void 0||!i.hasChildren?At(e,r,n):i.expanded?At(e,r+1,n):{...e,focusedIndex:r,expandedIds:Pw(e.expandedIds,i.id)};case"ArrowLeft":return i!==void 0&&i.hasChildren&&i.expanded?{...e,focusedIndex:r,expandedIds:Aw(e.expandedIds,i.id)}:At(e,Ud(n,r),n);default:return At(e,r,n)}}function Rw(e,t){return t.type==="rows-changed"?Lw(e,t.rows,t.modelIds):Mw(e,t.key,t.rows)}const Ow=["thread","tree"],Wd="reasoning not recorded (signature only)",qd=Am*5;function Dw(e){return[...e].sort((t,n)=>t.seq-n.seq).map(Fw)}function Fw(e){const t=Dm(e.kind);switch(t){case"tool_call":return{kind:"tool",event:e,name:e.name??e.kind,status:Ou(e.status),input:Mi(e.input,qd),output:Mi(e.text,qd)};case"thinking":return $w(e);case"unknown":return{kind:"unknown",event:e,label:`unrecognized record (type=${Vw(e)})`,record:JSON.stringify(Bw(e),null,2)};default:return{kind:"message",event:e,eventKind:t,text:Uw(e.text)}}}function $w(e){const t=Mi(e.text);return t===null||t===Wd?{kind:"thinking",event:e,text:Wd,recorded:!1}:{kind:"thinking",event:e,text:t,recorded:!0}}function Vw(e){const t=e.raw_subtype;return t===null||t===""?e.raw_type:`${e.raw_type}/${t}`}function Bw(e){return{id:e.id,seq:e.seq,ts:e.ts,turn_id:e.turn_id,kind:e.kind,raw_type:e.raw_type,raw_subtype:e.raw_subtype}}function Uw(e){return e===null||e.trim()===""?null:e}function Hw(e){const t=[];for(const n of e)if(n.kind==="message")t.push({kind:"message",id:n.event.id,row:n});else{const r=t.at(-1);(r==null?void 0:r.kind)==="activity"?r.rows.push(n):t.push({kind:"activity",id:n.event.id,rows:[n]})}return t}function Ww(e){const t=e.filter(l=>l.kind==="tool"),n=t.filter(l=>l.event.child_session_id!==null).length,r=e.filter(l=>l.kind==="thinking").length,i=e.filter(l=>l.kind==="unknown").length;return[t.length>0?`${t.length} tool ${t.length===1?"call":"calls"}`:"",n>0?`${n} ${n===1?"subagent":"subagents"}`:"",r>0?"reasoning":"",i>0?`${i} ${i===1?"record":"records"}`:""].filter(Boolean).join(" · ")}function qw(){const e=new Set,t=new Set;return{isDismissed:n=>e.has(n),dismiss(n){if(!e.has(n)){e.add(n);for(const r of t)r()}},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}const fs=qw();function Xm(e){return{dismissed:M.useSyncExternalStore(fs.subscribe,()=>fs.isDismissed(e),()=>!1),dismiss:()=>fs.dismiss(e)}}function Kw(e){const t=I0(e),{dismissed:n,dismiss:r}=Xm(`drift:${e.sessionId}`);return t===null||n?null:m.jsxs("div",{"data-slot":"drift-banner",role:"alert",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-error",children:[m.jsx(Fk,{size:12,"aria-hidden":"true",className:"shrink-0"}),m.jsx("span",{className:"min-w-0",children:t}),m.jsx("a",{href:"/api/drift",className:"ml-auto shrink-0 uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:"Drift report"}),m.jsx("button",{type:"button","aria-label":"Dismiss unrecognized records notice",title:"Dismiss until reload",onClick:r,className:"flex size-6 shrink-0 items-center justify-center rounded-md text-muted hover:bg-surface-raised hover:text-foreground",children:m.jsx(hm,{size:14,"aria-hidden":"true"})})]})}const Qw=["inline","line_ref","spill","missing"];function Gw(e){return Qw.find(t=>t===e)??"unclassified"}const Yw="Nothing was recorded for this half.",Xw="Full output no longer on disk.",Jw="Showing the stored head of a larger body.",Zw="The body was written to a file beside the transcript.";function Jm(e,t,n){const r=eS(e,t,n),i=r===null?tS(e,t):r.content,l=Gw(r===null?nS(e,t):r.storage),o=i!==null&&i!=="";switch(l){case"missing":return Gr("missing",Xw,o?i:null,!1,!1);case"spill":return Gr("spill",o?null:Zw,o?i:null,!1,!o);case"line_ref":{const s=r===null||r.truncated;return Gr("line_ref",s?Jw:null,i,s,s)}default:return o?Gr(l,null,i,!1,!1):Gr("empty",Yw,null,!1,!1)}}function Gr(e,t,n,r,i){return{kind:e,note:t,body:n,truncated:r,canRefetch:i}}function eS(e,t,n){return n===null?null:n.id===e.id&&n.field===t?n:null}function tS(e,t){return t==="input"?e.input:e.text}function nS(e,t){return t==="input"?e.input_storage:e.output_storage}const rS="No event is selected.";function iS({event:e,fetched:t,onShowFull:n}){return m.jsx("aside",{"data-slot":"span-detail",...e===null?{}:{"data-event-id":e.id},className:"w-96 shrink-0 overflow-y-auto p-3 text-xs text-foreground",children:e===null?m.jsx("p",{className:"text-faint",children:rS}):m.jsxs(m.Fragment,{children:[m.jsx(lS,{event:e}),m.jsx(Kd,{event:e,field:"input",title:"INPUT",fetched:t,onShowFull:n}),m.jsx(Kd,{event:e,field:"text",title:"OUTPUT",fetched:t,onShowFull:n}),m.jsx(aS,{event:e})]})})}function lS({event:e}){return m.jsxs("header",{"data-slot":"detail-heading",className:"border-b border-border pb-2",children:[m.jsx("p",{className:"truncate font-mono text-sm",children:e.name??e.kind}),m.jsx("p",{className:"truncate font-mono text-2xs text-faint",children:e.ts})]})}function Kd({event:e,field:t,title:n,fetched:r,onShowFull:i}){const l=Jm(e,t,r);return m.jsxs("section",{"data-slot":`detail-${t}`,"data-content-state":l.kind,className:"pt-3",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsx("h2",{className:"text-2xs tracking-widest text-muted",children:n}),m.jsx(oS,{content:l})]}),m.jsx(sS,{content:l}),l.canRefetch&&i!==void 0?m.jsx("button",{type:"button","data-slot":"detail-show-full",onClick:()=>i(e.id,t),className:"mt-1 font-mono text-2xs text-accent",children:"Show full"}):null]})}function oS({content:e}){return m.jsx("span",{"data-slot":"detail-storage",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:e.kind})}function sS({content:e}){return m.jsxs(m.Fragment,{children:[e.note===null?null:m.jsx("p",{"data-slot":"detail-note",className:"pt-1 text-2xs text-faint",children:e.note}),e.body===null?null:m.jsx("pre",{"data-slot":"detail-body",className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:e.body})]})}function aS({event:e}){return m.jsxs("details",{"data-slot":"detail-raw",className:"mt-3 border-t border-border pt-2",children:[m.jsx("summary",{className:"cursor-pointer text-2xs text-muted",children:"Raw record"}),m.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-muted",children:JSON.stringify(e,null,2)})]})}function uS({label:e,onResume:t}){return e===null?null:m.jsxs("button",{type:"button","data-slot":"follow-pill",onClick:t,className:"flex items-center gap-1.5 rounded-full border border-border bg-surface px-3 py-1 text-2xs text-fg shadow-sm",children:[m.jsxs("span",{children:["Following paused — ",e]}),m.jsx(Eo,{size:12,"aria-hidden":"true",className:"shrink-0"})]})}function Bu({duration:e,tokens:t,cost:n,costUnknown:r,className:i}){return m.jsxs("span",{"data-slot":"metric-chips",className:he("inline-flex items-center gap-1",i),children:[m.jsx(ps,{slot:"metric-duration",children:e}),m.jsx(ps,{slot:"metric-tokens",children:t}),m.jsx(ps,{slot:"metric-cost",unknown:r,children:n})]})}function ps({slot:e,unknown:t,children:n}){return n===void 0?null:m.jsx("span",{"data-slot":e,title:t,"aria-label":t,className:he("rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs",t===void 0?"text-muted":"text-faint"),children:n})}const Zm={live:{badge:"text-running",dot:"bg-running animate-live-pulse",label:"live"},complete:{badge:"text-muted",dot:"bg-success",label:"complete"},interrupted:{badge:"text-warning",dot:"bg-warning",label:"interrupted"}},je={type:{llm_call:{tint:"text-span-llm",Icon:Mk,label:"model call"},tool_call:{tint:"text-span-tool",Icon:Uk,label:"tool call"},thinking:{tint:"text-span-thinking",Icon:ok,label:"thinking"},subagent:{tint:"text-span-subagent",Icon:Lu,label:"sub-agent"},generic:{tint:"text-span-generic",Icon:ik,label:"activity"}},status:{running:{row:"",tint:"text-running animate-live-pulse",Icon:Ik,label:"running"},ok:{row:"",tint:"text-success",Icon:hk,label:"ok"},error:{row:"bg-error/8",tint:"text-error",Icon:gk,label:"error"},denied:{row:"bg-error/8",tint:"text-error",Icon:tk,label:"denied"},unknown:{row:"",tint:"text-faint",Icon:zk,label:"unknown"}},trace:{tint:"text-span-turn",Icon:fm,label:"turn"},triggerBadge:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",payloadChip:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",errorChip:"font-mono text-2xs text-error"},cS={tool_call:je.type.tool_call,thinking:je.type.thinking,text:je.type.llm_call,prompt:je.type.generic,error:je.type.generic,compaction:je.type.generic,unknown:je.type.generic};function dS({session:e,now:t,view:n,onViewChange:r,parentSessionId:i}){var d;const l=((d=e.agent_description)==null?void 0:d.trim())||Om(e),o=Zm[e.live?"live":"complete"],s=e.tokens_in+e.tokens_out,a=e.live?void 0:e.last_activity_at,u=e.est_cost;return m.jsxs("header",{"data-slot":"session-header",className:"flex shrink-0 flex-wrap items-center gap-x-5 gap-y-3 border-b border-border bg-surface/50 px-5 py-4 text-sm text-foreground",children:[m.jsxs("a",{href:Bn(i?{name:"session",sessionId:i}:{name:"sessions"}),"data-slot":"back-to-sessions","aria-label":i?"Back to parent session":"Back to sessions",className:"flex shrink-0 items-center gap-1 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[m.jsx(uk,{size:12,"aria-hidden":"true"}),i?"Parent session":"Sessions"]}),m.jsxs("div",{className:"min-w-0 flex-1 basis-60",children:[m.jsx("h1",{className:"truncate text-lg font-semibold",title:l,children:l}),m.jsx("p",{"data-slot":"session-project",className:"mt-1 truncate font-mono text-2xs text-muted",title:e.project_path,children:e.project_path})]}),m.jsxs("a",{href:Bn({name:"search",sessionId:e.id}),"data-slot":"in-session-search",className:"shrink-0 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[m.jsx(pm,{size:14,className:"mr-1 inline-block","aria-hidden":"true"})," Search"]}),n===void 0||r===void 0?null:m.jsx(fS,{view:n,onViewChange:r}),m.jsxs("span",{className:he("flex shrink-0 items-center gap-1 text-xs",o.badge),children:[m.jsx("span",{"aria-hidden":"true",className:he("size-1.5 rounded-md",o.dot)}),o.label]}),m.jsxs("span",{"data-slot":"session-turns",className:"shrink-0 font-mono text-2xs text-muted",children:[Wt(e.turn_count)," turns"]}),e.error_count>0?m.jsxs("span",{"data-slot":"session-errors",className:je.errorChip,children:[e.error_count," err"]}):null,m.jsx(Bu,{className:"shrink-0",duration:Pm(e.started_at,a,t),tokens:`${Wt(s)} tok`,cost:Li(u),costUnknown:Lr(u,e.model)})]})}function fS({view:e,onViewChange:t}){return m.jsx("div",{role:"group","aria-label":"Session view",className:"inline-flex shrink-0 items-center gap-0.5 rounded-md bg-surface p-0.5",children:Ow.map(n=>m.jsxs("button",{type:"button",...n==="thread"?{"data-slot":"thread-toggle"}:{},"aria-pressed":n===e,onClick:()=>{t(n)},className:he("flex items-center gap-1.5 rounded-md px-3 py-2 text-xs transition-colors",n===e?"bg-surface-raised text-foreground":"text-muted"),children:[n==="thread"?m.jsx(fm,{size:13,"aria-hidden":"true"}):m.jsx(vk,{size:13,"aria-hidden":"true"}),n==="thread"?"Thread":"Tree"]},n))})}function pS(e,t,n){const r=new Array(e);return new Proxy(r,{get(i,l,o){if(typeof l=="string"){const s=l.charCodeAt(0);if(s>=48&&s<=57){const a=+l;if(Number.isInteger(a)&&a>=0&&a<e){let u=i[a];if(!u){const d=t[a*2];u=i[a]={index:a,key:n(a),start:d,size:t[a*2+1],end:d+t[a*2+1],lane:0}}return u}}if(l==="length")return e}return Reflect.get(i,l,o)}})}function rr(e,t,n){let r=n.initialDeps??[],i,l=!0;function o(){const s=e();return(s.length!==r.length||s.some((u,d)=>r[d]!==u))&&(r=s,i=t(...s),n!=null&&n.onChange&&!(l&&n.skipInitialOnChange)&&n.onChange(i),l=!1),i}return o.updateDeps=s=>{r=s},o}function Qd(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const hS=(e,t)=>Math.abs(e-t)<1.01,mS=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}};let Yr;const hs=()=>{if(Yr!==void 0)return Yr;if(typeof navigator>"u")return Yr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Yr=!0;const e=navigator.maxTouchPoints;return Yr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Gd=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},gS=e=>e,xS=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,i=new Array(r);for(let l=0;l<r;l++)i[l]=t+l;return i},yS=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=o=>{const{width:s,height:a}=o;t({width:Math.round(s),height:Math.round(a)})};if(i(Gd(n)),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver(o=>{const s=()=>{const a=o[0];if(a!=null&&a.borderBoxSize){const u=a.borderBoxSize[0];if(u){i({width:u.inlineSize,height:u.blockSize});return}}i(Gd(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},ro={passive:!0},kS=typeof window>"u"?!0:"onscrollend"in window,vS=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const l=e.options.useScrollendEvent&&kS;let o=0;const s=l?null:mS(i,()=>t(o,!1),e.options.isScrollingResetDelay),a=c=>()=>{o=n(r),s==null||s(),t(o,c)},u=a(!0),d=a(!1);return r.addEventListener("scroll",u,ro),l&&r.addEventListener("scrollend",d,ro),()=>{r.removeEventListener("scroll",u),l&&r.removeEventListener("scrollend",d)}},wS=(e,t)=>vS(e,t,n=>{const{horizontal:r,isRtl:i}=e.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),SS=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),i=n.options.getItemKey(r),l=n.itemSizeCache.get(i);if(l!==void 0)return l}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},bS=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;(l=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||l.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},CS=bS;class ES{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(l=>{const o=()=>{const s=l.target,a=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(const[u,d]of this.elementsCache)if(d===s){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(s,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var l;return(l=r())==null?void 0:l.observe(i,{box:"border-box"})},unobserve:i=>{var l;return(l=r())==null?void 0:l.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:gS,rangeExtractor:xS,onChange:()=>{},measureElement:SS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const p=n[f];p!==void 0&&(l[f]=p)}const o=this.options;let s=null,a=null,u=!1;if(o!==void 0&&o.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=l.count,x=this.getMeasurements(),v=f>0?((r=x[0])==null?void 0:r.key)??o.getItemKey(0):null,E=f>0?((i=x[f-1])==null?void 0:i.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(l.getItemKey(0)!==v||l.getItemKey(p-1)!==E)){u=!0;const k=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??x[0]:null;k&&(s=[k.key,this.getScrollOffset()-k.start]);const C=l.followOnAppend===!0?"auto":l.followOnAppend||null;C&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||l.getItemKey(p-1)!==E)&&(a=C)}}this.options=l,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,c=0;if(s&&this.scrollOffset!==null){const[f,p]=s,x=this.getMeasurements(),{count:v,getItemKey:E}=this.options;let h=0;for(;h<v&&E(h)!==f;)h++;if(h<v){const g=x[h];if(g){const k=Math.max(0,g.start+p);k!==this.scrollOffset&&(c=k-this.scrollOffset,this.scrollOffset=k,d=!0)}}}(d||a)&&(this.pendingScrollAnchor=[d?s[0]:null,d?s[1]:0,a,c])},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=rr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{if(o&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=o?s===l?this.scrollDirection:s<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const l=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!hs()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",o,ro),l.addEventListener("touchend",s,ro),this.unsubs.push(()=>{l.removeEventListener("touchstart",o),l.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[l,o,s,a]=i;l!==null&&!s&&(hs()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?a!==0&&(this._iosDeferredAdjustment+=a):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;return}const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=rr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,i,l,o,s,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u}),{key:!1}),this.getMeasurements=rr(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u},d)=>{const c=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const h of this.laneAssignments.keys())h>=n&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){const h=n*2;let g=this._flatMeasurements;if(!g||g.length<h){const N=new Float64Array(h);g&&f>0&&N.set(g.subarray(0,f*2)),g=N,this._flatMeasurements=g}let k;if(f===0)k=r+i;else{const N=f-1;k=g[N*2]+g[N*2+1]+u}for(let N=f;N<n;N++){const b=l(N),I=c.get(b),_=typeof I=="number"?I:this.options.estimateSize(N);g[N*2]=k,g[N*2+1]=_,k+=_+u}const C=pS(n,g,l);return this.measurementsCache=C,C}const p=this.measurementsCache.slice(0,f),x=new Array(s).fill(void 0),v=new Float64Array(s);let E=0;for(let h=0;h<f;h++){const g=p[h];g&&(x[g.lane]===void 0&&E++,x[g.lane]=h,v[g.lane]=g.end)}for(let h=f;h<n;h++){const g=l(h),k=this.laneAssignments.get(h);let C,N;const b=a==="estimate"||c.has(g);if(k!==void 0&&this.options.lanes>1){C=k;const S=x[C],j=S!==void 0?p[S]:void 0;N=j?j.end+u:r+i}else if(E===s){let S=0,j=v[0],O=x[0];for(let U=1;U<s;U++){const G=v[U];(G<j||G===j&&x[U]<O)&&(S=U,j=G,O=x[U])}C=S,N=j+u,b&&this.laneAssignments.set(h,C)}else C=h%this.options.lanes,N=r+i,b&&this.laneAssignments.set(h,C);const I=c.get(g),_=typeof I=="number"?I:this.options.estimateSize(h),z=N+_;p[h]={index:h,start:N,size:_,end:z,key:g,lane:C},x[C]===void 0&&E++,x[C]=h,v[C]=z}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=rr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,l)=>n.length===0||r===0?(this.range=null,null):(this.range=IS(n,r,i,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=rr(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,l,o)=>l===null||o===null?[]:n({startIndex:l,endIndex:o,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-l),s=Math.min(this.options.count-1,i+l);return n>=o&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),l=this.elementsCache.get(i);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,l;if(n<0||n>=this.options.count)return;let o,s,a;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)a=this.options.getItemKey(n),s=u[n*2],o=u[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;a=f.key,s=f.start,o=f.size}const d=this.itemSizeCache.get(a)??o,c=r-d;if(c!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,E=!this.itemSizeCache.has(a)?s<x:s+d<=x&&this.scrollDirection!=="backward",h=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:a,start:s,size:o,end:s+o,lane:0},c,this):E);(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(a,r),this.itemSizeCacheVersion++;let g=!1;f?g=this.applyScrollAdjustment(this.getTotalSize()-p):h&&(g=this.applyScrollAdjustment(c)),this.notify(g)}},this.getVirtualItems=rr(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let l=0,o=n.length;l<o;l++){const s=n[l],a=r[s];i.push(a)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,l=this.options.lanes===1&&i!=null,o=eg(0,r.length-1,l?s=>i[s*2]:s=>Qd(r[s]).start,n);return Qd(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+l?"end":"start"),r==="center"?n+=(i-l)/2:r==="end"&&(n-=l);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),l=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=l+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=l+this.options.scrollPaddingStart)r="start";else return[l,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const s=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0;const l=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0,n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getOffsetForIndex(n,r);if(!l)return;const[o,s]=l,a=this.now();this.scrollState={index:n,align:s,behavior:i,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,l=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const l=r.length-1,o=this._flatMeasurements;o!=null?i=o[l*2]+o[l*2+1]:i=((n=r[l])==null?void 0:n.end)??0}else{const l=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&l.some(s=>s===null);){const s=r[o];l[s.lane]===null&&(l[s.lane]=s.end),o--}i=Math.max(...l.filter(s=>s!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){return t===0?!1:hs()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=t,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,l=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&hS(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const s=this.getSize()||600,a=Math.abs(i-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&a>s;this.scrollState.lastTargetOffset=i,u||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const eg=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else if(l>r)t=i-1;else return i}return e>0?e-1:0};function _S(e,t,n){let r=0;for(;r<=t;){const i=(r+t)/2|0,l=e[i*2];if(l<n)r=i+1;else if(l>n)t=i-1;else return i}return r>0?r-1:0}function IS(e,t,n,r,i){const l=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:l};if(r===1&&i!==null){const u=_S(i,l,n);let d=u;const c=n+t;for(;d<l&&i[d*2]+i[d*2+1]<c;)d++;return{startIndex:u,endIndex:d}}let s=eg(0,l,u=>e[u].start,n),a=s;if(r===1)for(;a<l&&e[a].end<n+t;)a++;else if(r>1){const u=Array(r).fill(0);for(;a<l&&u.some(c=>c<n+t);){const c=e[a];u[c.lane]=c.end,a++}const d=Array(r).fill(n+t);for(;s>=0&&d.some(c=>c>=n);){const c=e[s];d[c.lane]=c.start,s--}s=Math.max(0,s-s%r),a=Math.min(l,a+(r-1-a%r))}return{startIndex:s,endIndex:a}}const ms=typeof document<"u"?M.useLayoutEffect:M.useEffect;function NS({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const i=M.useReducer(d=>d+1,0)[1],l=M.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=t,l.current.mode=n;const o=d=>{const c=l.current;if(!c.enabled||!c.container)return;const f=d.getTotalSize();if(f!==c.lastSize){c.lastSize=f;const p=d.options.horizontal?"width":"height";c.container.style[p]=`${f}px`}},s=d=>{const c=l.current;if(!c.enabled||!c.container)return;o(d);const f=!!d.options.horizontal,p=c.mode==="transform",x=f?"left":"top",v=d.options.scrollMargin,E=d.getVirtualItems();for(const h of E){const g=h.start-v,k=d.elementsCache.get(h.key);k&&c.lastPositions.get(k)!==g&&(c.lastPositions.set(k,g),p?k.style.transform=f?`translate3d(${g}px, 0, 0)`:`translate3d(0, ${g}px, 0)`:k.style[x]=`${g}px`)}},a={...r,onChange:(d,c)=>{var f;const p=l.current;let x=!0;if(p.enabled){s(d);const v=d.range,E=p.prevRange;x=!E||E.isScrolling!==d.isScrolling||E.startIndex!==(v==null?void 0:v.startIndex)||E.endIndex!==(v==null?void 0:v.endIndex),x&&(p.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:d.isScrolling}:null)}x&&(e&&c?am.flushSync(i):i()),(f=r.onChange)==null||f.call(r,d,c)}},[u]=M.useState(()=>{const d=new ES(a);return Object.assign(d,{containerRef:c=>{const f=l.current;if(f.container=c,f.lastSize=null,c&&f.enabled){const p=d.getTotalSize();f.lastSize=p;const x=d.options.horizontal?"width":"height";c.style[x]=`${p}px`}}})});return u.setOptions(a),ms(()=>u._didMount(),[]),ms(()=>(o(u),u._willUpdate())),ms(()=>{s(u)}),u}function TS(e){return NS({observeElementRect:yS,observeElementOffset:wS,scrollToFn:CS,...e})}const tg=14,Yd=je.type.subagent,zS={elapsed:"elapsed, approval wait included",sidecar_span:"measured by the sub-agent span",reported:"reported by the harness",none:"not measured"};function jS({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{event:l,kind:o,status:s}=e.node,a=cS[o],u=je.status[s],d=l.name??l.kind,c=p0(l.duration_source),f=zS[c],p=Mi(l.input),x=Mi(l.text),v=l.child_session_id,E=v===null?null:{type:l.agent_type??je.type.subagent.label,status:v0(l.agent_status)};return m.jsxs("div",{role:"treeitem","data-slot":"span-row","data-span-status":s,"data-event-kind":o,"data-event-id":l.id,"data-session-id":e.sessionId,...v===null?{}:{"data-child-session-id":v},"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":[`${a.label} ${d}`,...E===null?[]:[`sub-agent ${E.type}, ${E.status}`],u.label,f].join(", "),tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:he("border-l-2 text-xs text-foreground",u.row,t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*tg},children:[m.jsxs("div",{className:"flex h-7 items-center gap-2 pr-2",children:[m.jsx(PS,{row:e,name:d,onToggle:i}),m.jsx("span",{"data-slot":"span-type",className:he("shrink-0",a.tint),children:m.jsx(a.Icon,{size:12,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"span-name",className:"min-w-0 flex-1 truncate",children:d}),E===null?null:m.jsxs("span",{"data-slot":"span-subagent",className:he("flex shrink-0 items-center gap-1",Yd.tint),children:[m.jsx(Yd.Icon,{size:12,"aria-hidden":"true"}),m.jsx("span",{className:"font-mono text-2xs",children:E.type}),m.jsx("span",{className:je.triggerBadge,children:E.status})]}),m.jsx("span",{"data-slot":"span-status",role:"img",title:u.label,"aria-label":u.label,className:he("shrink-0",u.tint),children:m.jsx(u.Icon,{size:12,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"span-metrics","data-duration-source":c,title:f,className:"shrink-0",children:m.jsx(Uu,{values:$m(l),showErrors:!1})})]}),p===null&&x===null?null:m.jsxs("div",{"data-slot":"span-payload",className:"flex items-center gap-2 pb-1 pl-6 pr-2",children:[p===null?null:m.jsx("span",{"data-slot":"span-input",className:he("min-w-0 truncate",je.payloadChip),children:p}),x===null?null:m.jsx("span",{"data-slot":"span-output",className:he("min-w-0 truncate",je.payloadChip),children:x})]})]})}function PS({row:e,name:t,onToggle:n}){if(!e.hasChildren)return m.jsx("span",{"data-slot":"span-expand-space","aria-hidden":"true",className:"w-3.5 shrink-0"});const r=e.expanded?Eo:Ai;return m.jsx("button",{type:"button","data-slot":"span-expand",tabIndex:-1,"aria-label":e.expanded?`collapse ${t}`:`expand ${t}`,onClick:i=>{i.stopPropagation(),n==null||n(e.id)},className:"shrink-0 text-faint",children:m.jsx(r,{size:14,"aria-hidden":"true"})})}function Uu({values:e,showErrors:t}){return m.jsxs(m.Fragment,{children:[t&&e.errorCount>0?m.jsxs("span",{"data-slot":"row-errors",className:je.errorChip,children:[e.errorCount," err"]}):null,m.jsx(Bu,{className:"shrink-0",duration:qv(e.durationMs),...e.tokens>0?{tokens:`${Wt(e.tokens)} tok`}:{},...e.costUnknown!==void 0?{cost:Li(e.cost),costUnknown:e.costUnknown}:e.cost!==null&&e.cost>0?{cost:Li(e.cost)}:{}})]})}function AS({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{turn:l}=e,{Icon:o,tint:s,label:a}=je.trace,u=e.expanded?Eo:Ai,d=y0(l);return m.jsxs("div",{role:"treeitem","data-slot":"trace-group","data-turn-kind":l.kind,"data-session-id":e.sessionId,"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":`${a} ${l.seq}: ${d}`,tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:he("flex h-9 items-center gap-2 border-l-2 border-b border-b-border bg-surface pr-2 text-xs text-foreground",t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*tg},children:[m.jsx("button",{type:"button","data-slot":"trace-expand",tabIndex:-1,"aria-label":e.expanded?`collapse turn ${l.seq}`:`expand turn ${l.seq}`,onClick:c=>{c.stopPropagation(),i==null||i(e.id)},className:"shrink-0 pl-1 text-faint",children:m.jsx(u,{size:14,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"trace-icon",className:he("shrink-0",s),children:m.jsx(o,{size:12,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"trace-preview",className:"min-w-0 flex-1 truncate font-medium",children:d}),e.subagent===void 0?null:m.jsxs("span",{"data-slot":"trace-subagent",className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{"data-slot":"trace-agent-description",className:"min-w-0 truncate font-mono text-2xs text-muted",children:e.subagent.header.agent_description??""}),m.jsx(Bu,{className:"shrink-0",tokens:`${Wt(e.subagent.header.tokens_in+e.subagent.header.tokens_out)} tok`,cost:Li(e.subagent.header.est_cost),costUnknown:Lr(e.subagent.header.est_cost,e.subagent.header.model)})]}),l.kind==="human"?null:m.jsx("span",{"data-slot":"trace-trigger",title:`started by ${l.kind}`,"aria-label":`started by ${l.kind}`,className:je.triggerBadge,children:l.kind}),m.jsx(Uu,{values:g0(l),showErrors:!0})]})}const LS=28,MS=8;function RS({rows:e,selectedId:t,focusedIndex:n,initialRect:r,estimateSize:i=LS,overscan:l=MS,followIndex:o,revealIndex:s,onScrollMetrics:a,onKeyDown:u,onSelect:d,onToggle:c}){const f=M.useRef(null),p=M.useRef(!1),x=TS({count:e.length,getScrollElement:()=>f.current,estimateSize:()=>i,overscan:l,getItemKey:E=>{var h;return((h=e[E])==null?void 0:h.id)??E},...r===void 0?{}:{initialRect:r}});M.useEffect(()=>{o!==void 0&&(p.current=!0,x.scrollToIndex(o,{align:"end"}))},[o,x]),M.useEffect(()=>{s!==void 0&&(p.current=!0,x.scrollToIndex(s,{align:"center"}))},[s,x]);const v=E=>{if(p.current){p.current=!1;return}const h=E.currentTarget;a==null||a({scrollTop:h.scrollTop,scrollHeight:h.scrollHeight,clientHeight:h.clientHeight})};return m.jsx("div",{ref:f,"data-slot":"span-tree-scroller",className:"h-full overflow-y-auto",onKeyDown:u,onScroll:v,children:m.jsx("div",{role:"tree","aria-label":"span tree","data-slot":"span-tree",className:"relative w-full",style:{height:x.getTotalSize()},children:x.getVirtualItems().map(E=>{const h=e[E.index];return h===void 0?null:m.jsx("div",{role:"presentation","data-index":E.index,ref:x.measureElement,className:"absolute left-0 w-full",style:{top:E.start},children:h.kind==="turn"?m.jsx(AS,{row:h,selected:h.id===t,focused:E.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}}):m.jsx(jS,{row:h,selected:h.id===t,focused:E.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}})},E.key)})})})}function OS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const DS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$S={};function Xd(e,t){return($S.jsx?FS:DS).test(e)}const VS=/[ \t\n\f\r]/g;function BS(e){return typeof e=="object"?e.type==="text"?Jd(e.value):!1:Jd(e)}function Jd(e){return e.replace(VS,"")===""}class Ui{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ui.prototype.normal={};Ui.prototype.property={};Ui.prototype.space=void 0;function ng(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ui(n,r,t)}function Ia(e){return e.toLowerCase()}class tt{constructor(t,n){this.attribute=n,this.property=t}}tt.prototype.attribute="";tt.prototype.booleanish=!1;tt.prototype.boolean=!1;tt.prototype.commaOrSpaceSeparated=!1;tt.prototype.commaSeparated=!1;tt.prototype.defined=!1;tt.prototype.mustUseProperty=!1;tt.prototype.number=!1;tt.prototype.overloadedBoolean=!1;tt.prototype.property="";tt.prototype.spaceSeparated=!1;tt.prototype.space=void 0;let US=0;const q=er(),Ee=er(),Na=er(),A=er(),de=er(),Un=er(),it=er();function er(){return 2**++US}const Ta=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:Ee,commaOrSpaceSeparated:it,commaSeparated:Un,number:A,overloadedBoolean:Na,spaceSeparated:de},Symbol.toStringTag,{value:"Module"})),gs=Object.keys(Ta);class Hu extends tt{constructor(t,n,r,i){let l=-1;if(super(t,n),Zd(this,"space",i),typeof r=="number")for(;++l<gs.length;){const o=gs[l];Zd(this,gs[l],(r&Ta[o])===Ta[o])}}}Hu.prototype.defined=!0;function Zd(e,t,n){n&&(e[t]=n)}function Mr(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Hu(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[Ia(r)]=r,n[Ia(l.attribute)]=r}return new Ui(t,n,e.space)}const rg=Mr({properties:{ariaActiveDescendant:null,ariaAtomic:Ee,ariaAutoComplete:null,ariaBusy:Ee,ariaChecked:Ee,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:de,ariaCurrent:null,ariaDescribedBy:de,ariaDetails:null,ariaDisabled:Ee,ariaDropEffect:de,ariaErrorMessage:null,ariaExpanded:Ee,ariaFlowTo:de,ariaGrabbed:Ee,ariaHasPopup:null,ariaHidden:Ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:de,ariaLevel:A,ariaLive:null,ariaModal:Ee,ariaMultiLine:Ee,ariaMultiSelectable:Ee,ariaOrientation:null,ariaOwns:de,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:Ee,ariaReadOnly:Ee,ariaRelevant:null,ariaRequired:Ee,ariaRoleDescription:de,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:Ee,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ig(e,t){return t in e?e[t]:t}function lg(e,t){return ig(e,t.toLowerCase())}const HS=Mr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Un,acceptCharset:de,accessKey:de,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alpha:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:de,autoFocus:q,autoPlay:q,blocking:de,capture:null,charSet:null,checked:q,cite:null,className:de,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:Ee,controls:q,controlsList:de,coords:A|Un,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Na,draggable:Ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:de,height:A,hidden:Na,high:A,href:null,hrefLang:null,htmlFor:de,httpEquiv:de,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:de,itemRef:de,itemScope:q,itemType:de,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,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:A,pattern:null,ping:de,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:de,required:q,reversed:q,rows:A,rowSpan:A,sandbox:de,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootCustomElementRegistry:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shadowRootSerializable:q,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:Ee,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:Ee,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:de,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,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:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:Ee,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:q,disablePictureInPicture:q,disableRemotePlayback:q,exportParts:Un,part:de,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:lg}),WS=Mr({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",maskType:"mask-type",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:it,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:de,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:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,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:Un,g2:Un,glyphName:Un,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:it,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,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:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:de,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:it,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:it,rev:it,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:it,requiredFeatures:it,requiredFonts:it,requiredFormats:it,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:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:it,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:it,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:it,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ig}),og=Mr({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()}}),sg=Mr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lg}),ag=Mr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),qS={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"},KS=/[A-Z]/g,ef=/-[a-z]/g,QS=/^data[-\w.:]+$/i;function GS(e,t){const n=Ia(t);let r=t,i=tt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&QS.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(ef,XS);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!ef.test(l)){let o=l.replace(KS,YS);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Hu}return new i(r,t)}function YS(e){return"-"+e.toLowerCase()}function XS(e){return e.charAt(1).toUpperCase()}const JS=ng([rg,HS,og,sg,ag],"html"),Wu=ng([rg,WS,og,sg,ag],"svg");function ZS(e){return e.join(" ").trim()}var qu={},tf=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,eb=/\n/g,tb=/^\s*/,nb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,rb=/^:\s*/,ib=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,lb=/^[;\s]*/,ob=/^\s+|\s+$/g,sb=`
226
+ `)};return r!==void 0&&(o.id=r),i!==void 0&&(o.retry=i),o}function aw(e={}){const t=e.path??Z0,n=e.fetchImpl??globalThis.fetch,r=e.sleepImpl??pw,i=e.now??(()=>Date.now()),l=e.random??(()=>Math.random()),o=e.watchdogMs??nw,s=e.bootstrap??Wm(),a=new AbortController;let u=!1,d,c={kind:"connecting"},f,p=0,x=0;function v(I){var _;c.kind==="closed"||c.kind==="auth_error"||(c=I,(_=e.onState)==null||_.call(e,I))}function E(I){var _;(_=e.onError)==null||_.call(e,I)}function h(I){if(!Number.isFinite(o))return;const _=++p;x=i()+o,(async()=>{for(;_===p&&!I.signal.aborted;){const z=x-i();if(z<=0){I.abort(new DOMException("agent-lens: stream went silent","AbortError"));return}await r(z,I.signal)}})()}function g(){Number.isFinite(o)&&(x=i()+o)}function k(){p+=1}function C(I){var z;if(g(),I.event==="heartbeat")return;if(I.event==="error"){E(new Error(`agent-lens: the stream reported an error (${I.data})`));return}if(!lw.has(I.event))return;let _;try{_=JSON.parse(I.data)}catch(S){E(new Error(`agent-lens: could not decode a "${I.event}" payload (${S instanceof Error?S.message:String(S)})`));return}(z=e.onEvent)==null||z.call(e,{event:I.event,data:_,...I.id===void 0?{}:{id:I.id}})}async function N(){const I=new AbortController;d=I;let _=!1,z,S;try{const j=await n(t,{method:"GET",headers:{[s.tokenHeader]:s.token},signal:I.signal});if(j.status===401||j.status===403)z=new qm(j.status,await cw(j));else if(!j.ok)S=new Error(`agent-lens: the stream returned HTTP ${j.status}`);else if(j.body===null)S=new Error("agent-lens: the stream response carried no body");else{_=!0,v({kind:"open"}),h(I);const O=j.body.getReader(),U=new TextDecoder,G=ow();for(;;){const{done:W,value:X}=await O.read();if(W)break;for(const re of G.push(U.decode(X,{stream:!0})))C(re)}}}catch(j){S=j}finally{k(),d=void 0}return u?{kind:"closed"}:z!==void 0?{kind:"auth",error:z}:(S!==void 0&&!dw(S)&&E(fw(S)),{kind:"retry",reachedOpen:_})}async function b(){let I=0;for(;!u;){v({kind:"connecting"});const _=await N();if(_.kind==="closed")break;if(_.kind==="auth"){v({kind:"auth_error",error:_.error});return}_.reachedOpen&&(I=0);const z=uw(I,l);I+=1,v({kind:"reconnecting",attempt:I,nextRetryAt:i()+z}),await r(z,a.signal)}v({kind:"closed"})}return{start(){return f??(f=b()),f},close(){u||(u=!0,v({kind:"closed"}),k(),a.abort(),d==null||d.abort(new DOMException("agent-lens: stream closed","AbortError")))},get state(){return c}}}function uw(e,t){return t()*Math.min(iw,rw*2**e)}async function cw(e){try{const t=(await e.text()).trim();return t===""?`HTTP ${e.status}`:t}catch{return`HTTP ${e.status}`}}function dw(e){return typeof e=="object"&&e!==null&&e.name==="AbortError"}function fw(e){return e instanceof Error?e:new Error(String(e))}function pw(e,t){return new Promise(n=>{if((t==null?void 0:t.aborted)===!0){n();return}const r=()=>{clearTimeout(i),t==null||t.removeEventListener("abort",r),n()},i=setTimeout(r,e);t==null||t.addEventListener("abort",r,{once:!0})})}function hw(e,t={}){const n=M.useRef(e);n.current=e;const r=M.useRef(t);r.current=t,M.useEffect(()=>{const l=(r.current.create??aw)({onEvent:({event:o,data:s})=>{o==="session_changed"?n.current.publish({event:o,data:s}):o==="session_indexed"?n.current.publish({event:o,data:s}):o==="warm_progress"&&n.current.publish({event:o,data:s})},onState:o=>{var s,a;return(a=(s=r.current).onState)==null?void 0:a.call(s,o)}});return l.start(),()=>l.close()},[])}const mw=/^\d+$/;function Dd(e){const t=gw(e);if(t==="/")return{name:"sessions"};if(t==="/showcase")return{name:"showcase"};if(t==="/search")return{name:"search"};const n=t.slice(1).split("/");if(n[0]==="search"&&n.length===3&&n[1]==="session"){const r=Fd(n[2]);if(r!==void 0&&r!=="")return{name:"search",sessionId:r}}if(n[0]==="session"){const r=Fd(n[1]);if(r!==void 0&&r!==""){if(n.length===2)return{name:"session",sessionId:r};if(n.length===4&&mw.test(n[3]??"")){if(n[2]==="trace")return{name:"trace",sessionId:r,turnSeq:Number(n[3])};if(n[2]==="event")return{name:"event",sessionId:r,seq:Number(n[3])}}}}return{name:"not_found",path:e}}function Bn(e){switch(e.name){case"sessions":return"/";case"showcase":return"/showcase";case"session":return`/session/${encodeURIComponent(e.sessionId)}`;case"trace":return`/session/${encodeURIComponent(e.sessionId)}/trace/${e.turnSeq}`;case"search":return e.sessionId===void 0?"/search":`/search/session/${encodeURIComponent(e.sessionId)}`;case"event":return`/session/${encodeURIComponent(e.sessionId)}/event/${e.seq}`;case"not_found":return e.path}}function gw(e){var r;const t=((r=e.split("?")[0])==null?void 0:r.split("#")[0])??"",n=t.startsWith("/")?t:`/${t}`;return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function Fd(e){if(e!==void 0)try{return decodeURIComponent(e)}catch{return e}}function xw(){return{path:()=>window.location.pathname,push:e=>{window.history.pushState(null,"",e)},replace:e=>{window.history.replaceState(null,"",e)},onPopState:e=>(window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)})}}function yw(e=xw()){const t=new Set;let n=e.path(),r=Dd(n);function i(){const l=e.path();if(l!==n){n=l,r=Dd(l);for(const o of[...t])o()}}return e.onPopState(i),{getRoute:()=>r,navigate(l,o={}){const s=Bn(l);o.replace===!0?e.replace(s):e.push(s),i()},subscribe(l){return t.add(l),()=>{t.delete(l)}}}}let $d;function Gm(){return $d??($d=yw()),$d}function kw(e=Gm()){return M.useSyncExternalStore(e.subscribe,e.getRoute,e.getRoute)}const Ym={kind:"loading"};function vw(){return{requestId:0,state:Ym}}function ww(e,t){return t.type==="start"?{requestId:t.requestId,state:Ym}:t.requestId!==e.requestId?e:{requestId:e.requestId,state:t.type==="resolve"?{kind:"ok",value:t.value}:{kind:"error",error:t.error}}}function $u(e,t,n=0){const[r,i]=M.useReducer(ww,vw()),l=M.useRef(0),o=M.useRef(t);return o.current=t,M.useEffect(()=>{const s=++l.current,a=new AbortController;return i({type:"start",requestId:s}),o.current(a.signal).then(u=>i({type:"resolve",requestId:s,value:u}),u=>i({type:"reject",requestId:s,error:u})),()=>a.abort()},[e,n]),r.state}const ds="<mark>",Vd="</mark>";function Sw(e){if(e==null||e==="")return[];const t=[];let n=e;for(;n!=="";){const r=n.indexOf(ds);if(r===-1)break;const i=n.indexOf(Vd,r+ds.length);if(i===-1)break;r>0&&t.push({text:n.slice(0,r),matched:!1});const l=n.slice(r+ds.length,i);l!==""&&t.push({text:l,matched:!0}),n=n.slice(i+Vd.length)}return n!==""&&t.push({text:n,matched:!1}),t}function bw(e){const t=e.trim();return t===""?{kind:"idle"}:{kind:"search",q:t}}function Cw(e){return e==="session"?"Searching this session.":"Searching all projected transcripts, including sub-agent transcripts the session list does not show."}function Ew(e,t,n){if(e.kind==="idle"||t>0)return null;const r=`No matches for ${JSON.stringify(e.q)}.`;return n>0?`${r} ${n} transcripts are not indexed yet, so this answer covers part of the corpus.`:r}function _w(e){const t=new Map;for(const n of e){const r=t.get(n.session_id);if(r===void 0){t.set(n.session_id,{sessionId:n.session_id,title:n.session_title,projectPath:n.project_path,hits:[n]});continue}r.hits.push(n)}return[...t.values()]}function Iw(e,t){return t===null?`Warm the remaining ${e}`:t.done>=t.total?`Warmed ${t.total} transcripts`:`Warming ${t.done} of ${t.total}`}function Nw(e,t){if(e===null)return{latch:null,revealIndex:void 0};const n=t.findIndex(r=>r.id===e.eventId);return n===-1?{latch:e,revealIndex:void 0}:{latch:null,revealIndex:n,selectedId:e.eventId,focusedIndex:n}}function Tw({hit:e}){const t=Sw(e.snippet);return m.jsxs("a",{href:Bn({name:"event",sessionId:e.session_id,seq:e.seq}),"data-slot":"search-hit","data-event-id":e.event_id,className:"flex flex-col gap-0.5 rounded-md px-2 py-1.5 text-xs text-foreground transition-colors hover:bg-surface",children:[m.jsxs("span",{className:"flex items-center gap-2 text-2xs uppercase tracking-widest text-muted",children:[m.jsx("span",{children:e.kind}),e.name===null?null:m.jsx("span",{className:"truncate",children:e.name}),m.jsxs("span",{className:"ml-auto font-mono",children:["#",e.seq]})]}),m.jsx("span",{className:"min-w-0 font-mono text-2xs leading-relaxed text-muted",children:t.map((n,r)=>n.matched?m.jsx("mark",{className:"bg-surface-raised text-foreground",children:n.text},r):m.jsx("span",{children:n.text},r))})]})}function zw({scope:e,unprojectedCount:t,warm:n=null,onWarm:r}){return e==null?null:m.jsxs("div",{"data-slot":"search-scope",role:"status",className:"flex items-center gap-2 border-b border-border px-3 py-1.5 text-2xs text-muted",children:[m.jsx("span",{className:"min-w-0",children:Cw(e)}),t>0?m.jsx("button",{type:"button","data-slot":"search-warm",onClick:r,className:"ml-auto shrink-0 rounded-md bg-surface px-2 py-0.5 uppercase tracking-widest transition-colors hover:text-foreground",children:Iw(t,n)}):null]})}function jw({sessionId:e,api:t}={}){const n=M.useMemo(()=>t??Fu(),[t]),[r,i]=M.useState(""),l=bw(r),o=$u(`${l.kind==="idle"?"":l.q}|${e??""}`,p=>l.kind==="idle"?Promise.resolve(null):n.search(l.q,e===void 0?{}:{session:e},{signal:p})),s=o.kind==="ok"?o.value:null,[a,u]=M.useState(null),d=(s==null?void 0:s.unprojected_count)??0,c=_w((s==null?void 0:s.items)??[]),f=o.kind==="ok"?Ew(l,(s==null?void 0:s.items.length)??0,d):null;return m.jsxs("main",{"data-slot":"search-view",className:"flex h-full min-h-0 flex-col",children:[m.jsx("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-3",children:m.jsx("input",{"data-slot":"search-input",type:"search",value:r,onChange:p=>{i(p.target.value)},placeholder:"Search transcripts","aria-label":"Search transcripts",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted"})}),m.jsx(zw,{scope:(s==null?void 0:s.scope)??null,unprojectedCount:d,warm:a,onWarm:()=>{n.warm().then(({queued:p})=>{u({done:0,total:p})}).catch(()=>{})}}),m.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-2",children:o.kind==="error"?m.jsx("p",{className:"text-sm text-error",children:o.error.message}):f!==null?m.jsx("p",{"data-slot":"search-empty",className:"text-xs text-muted",children:f}):c.map(p=>m.jsxs("section",{className:"mb-3 flex flex-col gap-0.5",children:[m.jsx("h2",{className:"truncate px-2 text-2xs uppercase tracking-widest text-muted",children:p.title??p.projectPath}),p.hits.map(x=>m.jsx(Tw,{hit:x},x.event_id))]},p.sessionId))})]})}function Bd(e=new Set){return{selectedId:void 0,expandedIds:e,focusedIndex:0}}function Vu(e,t){return t<=0?0:Math.min(Math.max(e,0),t-1)}function Pw(e,t){const n=new Set(e);return n.add(t),n}function Aw(e,t){const n=new Set(e);return n.delete(t),n}function Ud(e,t){const n=e[t];if(n===void 0)return t;for(let r=t-1;r>=0;r-=1){const i=e[r];if(i!==void 0&&i.depth<n.depth)return r}return t}function At(e,t,n){const r=Vu(t,n.length);return r===e.focusedIndex?e:{...e,focusedIndex:r}}function Lw(e,t,n){const r=Vu(e.focusedIndex,t.length),i=e.selectedId!==void 0&&n.has(e.selectedId)?e.selectedId:void 0;return r===e.focusedIndex&&i===e.selectedId?e:{...e,focusedIndex:r,selectedId:i}}function Hd(e,t){const n=new Set(e.expandedIds);for(const r of t)n.add(r);return n.size===e.expandedIds.size?e:{...e,expandedIds:n}}function Mw(e,t,n){const r=Vu(e.focusedIndex,n.length),i=n[r];switch(t){case"j":case"ArrowDown":return At(e,r+1,n);case"k":case"ArrowUp":return At(e,r-1,n);case"Home":return At(e,0,n);case"End":return At(e,n.length-1,n);case"Enter":return i===void 0||i.id===e.selectedId?At(e,r,n):{...e,focusedIndex:r,selectedId:i.id};case"Escape":return At(e,Ud(n,r),n);case"ArrowRight":return i===void 0||!i.hasChildren?At(e,r,n):i.expanded?At(e,r+1,n):{...e,focusedIndex:r,expandedIds:Pw(e.expandedIds,i.id)};case"ArrowLeft":return i!==void 0&&i.hasChildren&&i.expanded?{...e,focusedIndex:r,expandedIds:Aw(e.expandedIds,i.id)}:At(e,Ud(n,r),n);default:return At(e,r,n)}}function Rw(e,t){return t.type==="rows-changed"?Lw(e,t.rows,t.modelIds):Mw(e,t.key,t.rows)}const Ow=["thread","tree"],Wd="reasoning not recorded (signature only)",qd=Am*5;function Dw(e){return[...e].sort((t,n)=>t.seq-n.seq).map(Fw)}function Fw(e){const t=Dm(e.kind);switch(t){case"tool_call":return{kind:"tool",event:e,name:e.name??e.kind,status:Ou(e.status),input:Mi(e.input,qd),output:Mi(e.text,qd)};case"thinking":return $w(e);case"unknown":return{kind:"unknown",event:e,label:`unrecognized record (type=${Vw(e)})`,record:JSON.stringify(Bw(e),null,2)};default:return{kind:"message",event:e,eventKind:t,text:Uw(e.text)}}}function $w(e){const t=Mi(e.text);return t===null||t===Wd?{kind:"thinking",event:e,text:Wd,recorded:!1}:{kind:"thinking",event:e,text:t,recorded:!0}}function Vw(e){const t=e.raw_subtype;return t===null||t===""?e.raw_type:`${e.raw_type}/${t}`}function Bw(e){return{id:e.id,seq:e.seq,ts:e.ts,turn_id:e.turn_id,kind:e.kind,raw_type:e.raw_type,raw_subtype:e.raw_subtype}}function Uw(e){return e===null||e.trim()===""?null:e}function Hw(e){const t=[];for(const n of e)if(n.kind==="message")t.push({kind:"message",id:n.event.id,row:n});else{const r=t.at(-1);(r==null?void 0:r.kind)==="activity"?r.rows.push(n):t.push({kind:"activity",id:n.event.id,rows:[n]})}return t}function Ww(e){const t=e.filter(l=>l.kind==="tool"),n=t.filter(l=>l.event.child_session_id!==null).length,r=e.filter(l=>l.kind==="thinking").length,i=e.filter(l=>l.kind==="unknown").length;return[t.length>0?`${t.length} tool ${t.length===1?"call":"calls"}`:"",n>0?`${n} ${n===1?"subagent":"subagents"}`:"",r>0?"reasoning":"",i>0?`${i} ${i===1?"record":"records"}`:""].filter(Boolean).join(" · ")}function qw(){const e=new Set,t=new Set;return{isDismissed:n=>e.has(n),dismiss(n){if(!e.has(n)){e.add(n);for(const r of t)r()}},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}const fs=qw();function Xm(e){return{dismissed:M.useSyncExternalStore(fs.subscribe,()=>fs.isDismissed(e),()=>!1),dismiss:()=>fs.dismiss(e)}}function Kw(e){const t=I0(e),{dismissed:n,dismiss:r}=Xm(`drift:${e.sessionId}`);return t===null||n?null:m.jsxs("div",{"data-slot":"drift-banner",role:"alert",className:"flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5 text-2xs text-error",children:[m.jsx(Fk,{size:12,"aria-hidden":"true",className:"shrink-0"}),m.jsx("span",{className:"min-w-0",children:t}),m.jsx("button",{type:"button","aria-label":"Dismiss unrecognized records notice",title:"Dismiss until reload",onClick:r,className:"ml-auto flex size-6 shrink-0 items-center justify-center rounded-md text-muted hover:bg-surface-raised hover:text-foreground",children:m.jsx(hm,{size:14,"aria-hidden":"true"})})]})}const Qw=["inline","line_ref","spill","missing"];function Gw(e){return Qw.find(t=>t===e)??"unclassified"}const Yw="Nothing was recorded for this half.",Xw="Full output no longer on disk.",Jw="Showing the stored head of a larger body.",Zw="The body was written to a file beside the transcript.";function Jm(e,t,n){const r=eS(e,t,n),i=r===null?tS(e,t):r.content,l=Gw(r===null?nS(e,t):r.storage),o=i!==null&&i!=="";switch(l){case"missing":return Gr("missing",Xw,o?i:null,!1,!1);case"spill":return Gr("spill",o?null:Zw,o?i:null,!1,!o);case"line_ref":{const s=r===null||r.truncated;return Gr("line_ref",s?Jw:null,i,s,s)}default:return o?Gr(l,null,i,!1,!1):Gr("empty",Yw,null,!1,!1)}}function Gr(e,t,n,r,i){return{kind:e,note:t,body:n,truncated:r,canRefetch:i}}function eS(e,t,n){return n===null?null:n.id===e.id&&n.field===t?n:null}function tS(e,t){return t==="input"?e.input:e.text}function nS(e,t){return t==="input"?e.input_storage:e.output_storage}const rS="No event is selected.";function iS({event:e,fetched:t,onShowFull:n}){return m.jsx("aside",{"data-slot":"span-detail",...e===null?{}:{"data-event-id":e.id},className:"w-96 shrink-0 overflow-y-auto p-3 text-xs text-foreground",children:e===null?m.jsx("p",{className:"text-faint",children:rS}):m.jsxs(m.Fragment,{children:[m.jsx(lS,{event:e}),m.jsx(Kd,{event:e,field:"input",title:"INPUT",fetched:t,onShowFull:n}),m.jsx(Kd,{event:e,field:"text",title:"OUTPUT",fetched:t,onShowFull:n}),m.jsx(aS,{event:e})]})})}function lS({event:e}){return m.jsxs("header",{"data-slot":"detail-heading",className:"border-b border-border pb-2",children:[m.jsx("p",{className:"truncate font-mono text-sm",children:e.name??e.kind}),m.jsx("p",{className:"truncate font-mono text-2xs text-faint",children:e.ts})]})}function Kd({event:e,field:t,title:n,fetched:r,onShowFull:i}){const l=Jm(e,t,r);return m.jsxs("section",{"data-slot":`detail-${t}`,"data-content-state":l.kind,className:"pt-3",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsx("h2",{className:"text-2xs tracking-widest text-muted",children:n}),m.jsx(oS,{content:l})]}),m.jsx(sS,{content:l}),l.canRefetch&&i!==void 0?m.jsx("button",{type:"button","data-slot":"detail-show-full",onClick:()=>i(e.id,t),className:"mt-1 font-mono text-2xs text-accent",children:"Show full"}):null]})}function oS({content:e}){return m.jsx("span",{"data-slot":"detail-storage",className:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",children:e.kind})}function sS({content:e}){return m.jsxs(m.Fragment,{children:[e.note===null?null:m.jsx("p",{"data-slot":"detail-note",className:"pt-1 text-2xs text-faint",children:e.note}),e.body===null?null:m.jsx("pre",{"data-slot":"detail-body",className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-foreground",children:e.body})]})}function aS({event:e}){return m.jsxs("details",{"data-slot":"detail-raw",className:"mt-3 border-t border-border pt-2",children:[m.jsx("summary",{className:"cursor-pointer text-2xs text-muted",children:"Raw record"}),m.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-2xs text-muted",children:JSON.stringify(e,null,2)})]})}function uS({label:e,onResume:t}){return e===null?null:m.jsxs("button",{type:"button","data-slot":"follow-pill",onClick:t,className:"flex items-center gap-1.5 rounded-full border border-border bg-surface px-3 py-1 text-2xs text-fg shadow-sm",children:[m.jsxs("span",{children:["Following paused — ",e]}),m.jsx(Eo,{size:12,"aria-hidden":"true",className:"shrink-0"})]})}function Bu({duration:e,tokens:t,cost:n,costUnknown:r,className:i}){return m.jsxs("span",{"data-slot":"metric-chips",className:he("inline-flex items-center gap-1",i),children:[m.jsx(ps,{slot:"metric-duration",children:e}),m.jsx(ps,{slot:"metric-tokens",children:t}),m.jsx(ps,{slot:"metric-cost",unknown:r,children:n})]})}function ps({slot:e,unknown:t,children:n}){return n===void 0?null:m.jsx("span",{"data-slot":e,title:t,"aria-label":t,className:he("rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs",t===void 0?"text-muted":"text-faint"),children:n})}const Zm={live:{badge:"text-running",dot:"bg-running animate-live-pulse",label:"live"},complete:{badge:"text-muted",dot:"bg-success",label:"complete"},interrupted:{badge:"text-warning",dot:"bg-warning",label:"interrupted"}},je={type:{llm_call:{tint:"text-span-llm",Icon:Mk,label:"model call"},tool_call:{tint:"text-span-tool",Icon:Uk,label:"tool call"},thinking:{tint:"text-span-thinking",Icon:ok,label:"thinking"},subagent:{tint:"text-span-subagent",Icon:Lu,label:"sub-agent"},generic:{tint:"text-span-generic",Icon:ik,label:"activity"}},status:{running:{row:"",tint:"text-running animate-live-pulse",Icon:Ik,label:"running"},ok:{row:"",tint:"text-success",Icon:hk,label:"ok"},error:{row:"bg-error/8",tint:"text-error",Icon:gk,label:"error"},denied:{row:"bg-error/8",tint:"text-error",Icon:tk,label:"denied"},unknown:{row:"",tint:"text-faint",Icon:zk,label:"unknown"}},trace:{tint:"text-span-turn",Icon:fm,label:"turn"},triggerBadge:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",payloadChip:"rounded-md bg-surface-raised px-1.5 py-0.5 font-mono text-2xs text-muted",errorChip:"font-mono text-2xs text-error"},cS={tool_call:je.type.tool_call,thinking:je.type.thinking,text:je.type.llm_call,prompt:je.type.generic,error:je.type.generic,compaction:je.type.generic,unknown:je.type.generic};function dS({session:e,now:t,view:n,onViewChange:r,parentSessionId:i}){var d;const l=((d=e.agent_description)==null?void 0:d.trim())||Om(e),o=Zm[e.live?"live":"complete"],s=e.tokens_in+e.tokens_out,a=e.live?void 0:e.last_activity_at,u=e.est_cost;return m.jsxs("header",{"data-slot":"session-header",className:"flex shrink-0 flex-wrap items-center gap-x-5 gap-y-3 border-b border-border bg-surface/50 px-5 py-4 text-sm text-foreground",children:[m.jsxs("a",{href:Bn(i?{name:"session",sessionId:i}:{name:"sessions"}),"data-slot":"back-to-sessions","aria-label":i?"Back to parent session":"Back to sessions",className:"flex shrink-0 items-center gap-1 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[m.jsx(uk,{size:12,"aria-hidden":"true"}),i?"Parent session":"Sessions"]}),m.jsxs("div",{className:"min-w-0 flex-1 basis-60",children:[m.jsx("h1",{className:"truncate text-lg font-semibold",title:l,children:l}),m.jsx("p",{"data-slot":"session-project",className:"mt-1 truncate font-mono text-2xs text-muted",title:e.project_path,children:e.project_path})]}),m.jsxs("a",{href:Bn({name:"search",sessionId:e.id}),"data-slot":"in-session-search",className:"shrink-0 text-2xs uppercase tracking-widest text-muted transition-colors hover:text-foreground",children:[m.jsx(pm,{size:14,className:"mr-1 inline-block","aria-hidden":"true"})," Search"]}),n===void 0||r===void 0?null:m.jsx(fS,{view:n,onViewChange:r}),m.jsxs("span",{className:he("flex shrink-0 items-center gap-1 text-xs",o.badge),children:[m.jsx("span",{"aria-hidden":"true",className:he("size-1.5 rounded-md",o.dot)}),o.label]}),m.jsxs("span",{"data-slot":"session-turns",className:"shrink-0 font-mono text-2xs text-muted",children:[Wt(e.turn_count)," turns"]}),e.error_count>0?m.jsxs("span",{"data-slot":"session-errors",className:je.errorChip,children:[e.error_count," err"]}):null,m.jsx(Bu,{className:"shrink-0",duration:Pm(e.started_at,a,t),tokens:`${Wt(s)} tok`,cost:Li(u),costUnknown:Lr(u,e.model)})]})}function fS({view:e,onViewChange:t}){return m.jsx("div",{role:"group","aria-label":"Session view",className:"inline-flex shrink-0 items-center gap-0.5 rounded-md bg-surface p-0.5",children:Ow.map(n=>m.jsxs("button",{type:"button",...n==="thread"?{"data-slot":"thread-toggle"}:{},"aria-pressed":n===e,onClick:()=>{t(n)},className:he("flex items-center gap-1.5 rounded-md px-3 py-2 text-xs transition-colors",n===e?"bg-surface-raised text-foreground":"text-muted"),children:[n==="thread"?m.jsx(fm,{size:13,"aria-hidden":"true"}):m.jsx(vk,{size:13,"aria-hidden":"true"}),n==="thread"?"Thread":"Tree"]},n))})}function pS(e,t,n){const r=new Array(e);return new Proxy(r,{get(i,l,o){if(typeof l=="string"){const s=l.charCodeAt(0);if(s>=48&&s<=57){const a=+l;if(Number.isInteger(a)&&a>=0&&a<e){let u=i[a];if(!u){const d=t[a*2];u=i[a]={index:a,key:n(a),start:d,size:t[a*2+1],end:d+t[a*2+1],lane:0}}return u}}if(l==="length")return e}return Reflect.get(i,l,o)}})}function rr(e,t,n){let r=n.initialDeps??[],i,l=!0;function o(){const s=e();return(s.length!==r.length||s.some((u,d)=>r[d]!==u))&&(r=s,i=t(...s),n!=null&&n.onChange&&!(l&&n.skipInitialOnChange)&&n.onChange(i),l=!1),i}return o.updateDeps=s=>{r=s},o}function Qd(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const hS=(e,t)=>Math.abs(e-t)<1.01,mS=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}};let Yr;const hs=()=>{if(Yr!==void 0)return Yr;if(typeof navigator>"u")return Yr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Yr=!0;const e=navigator.maxTouchPoints;return Yr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Gd=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},gS=e=>e,xS=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,i=new Array(r);for(let l=0;l<r;l++)i[l]=t+l;return i},yS=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=o=>{const{width:s,height:a}=o;t({width:Math.round(s),height:Math.round(a)})};if(i(Gd(n)),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver(o=>{const s=()=>{const a=o[0];if(a!=null&&a.borderBoxSize){const u=a.borderBoxSize[0];if(u){i({width:u.inlineSize,height:u.blockSize});return}}i(Gd(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},ro={passive:!0},kS=typeof window>"u"?!0:"onscrollend"in window,vS=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const l=e.options.useScrollendEvent&&kS;let o=0;const s=l?null:mS(i,()=>t(o,!1),e.options.isScrollingResetDelay),a=c=>()=>{o=n(r),s==null||s(),t(o,c)},u=a(!0),d=a(!1);return r.addEventListener("scroll",u,ro),l&&r.addEventListener("scrollend",d,ro),()=>{r.removeEventListener("scroll",u),l&&r.removeEventListener("scrollend",d)}},wS=(e,t)=>vS(e,t,n=>{const{horizontal:r,isRtl:i}=e.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),SS=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),i=n.options.getItemKey(r),l=n.itemSizeCache.get(i);if(l!==void 0)return l}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},bS=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;(l=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||l.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},CS=bS;class ES{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(l=>{const o=()=>{const s=l.target,a=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(const[u,d]of this.elementsCache)if(d===s){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(s,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var l;return(l=r())==null?void 0:l.observe(i,{box:"border-box"})},unobserve:i=>{var l;return(l=r())==null?void 0:l.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:gS,rangeExtractor:xS,onChange:()=>{},measureElement:SS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const p=n[f];p!==void 0&&(l[f]=p)}const o=this.options;let s=null,a=null,u=!1;if(o!==void 0&&o.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=l.count,x=this.getMeasurements(),v=f>0?((r=x[0])==null?void 0:r.key)??o.getItemKey(0):null,E=f>0?((i=x[f-1])==null?void 0:i.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(l.getItemKey(0)!==v||l.getItemKey(p-1)!==E)){u=!0;const k=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??x[0]:null;k&&(s=[k.key,this.getScrollOffset()-k.start]);const C=l.followOnAppend===!0?"auto":l.followOnAppend||null;C&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||l.getItemKey(p-1)!==E)&&(a=C)}}this.options=l,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,c=0;if(s&&this.scrollOffset!==null){const[f,p]=s,x=this.getMeasurements(),{count:v,getItemKey:E}=this.options;let h=0;for(;h<v&&E(h)!==f;)h++;if(h<v){const g=x[h];if(g){const k=Math.max(0,g.start+p);k!==this.scrollOffset&&(c=k-this.scrollOffset,this.scrollOffset=k,d=!0)}}}(d||a)&&(this.pendingScrollAnchor=[d?s[0]:null,d?s[1]:0,a,c])},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=rr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,o)=>{if(o&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const s=this.getScrollOffset();this.scrollDirection=o?s===l?this.scrollDirection:s<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const l=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!hs()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",o,ro),l.addEventListener("touchend",s,ro),this.unsubs.push(()=>{l.removeEventListener("touchstart",o),l.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[l,o,s,a]=i;l!==null&&!s&&(hs()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?a!==0&&(this._iosDeferredAdjustment+=a):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;return}const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=rr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,i,l,o,s,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u}),{key:!1}),this.getMeasurements=rr(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:l,enabled:o,lanes:s,laneAssignmentMode:a,gap:u},d)=>{const c=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const h of this.laneAssignments.keys())h>=n&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){const h=n*2;let g=this._flatMeasurements;if(!g||g.length<h){const N=new Float64Array(h);g&&f>0&&N.set(g.subarray(0,f*2)),g=N,this._flatMeasurements=g}let k;if(f===0)k=r+i;else{const N=f-1;k=g[N*2]+g[N*2+1]+u}for(let N=f;N<n;N++){const b=l(N),I=c.get(b),_=typeof I=="number"?I:this.options.estimateSize(N);g[N*2]=k,g[N*2+1]=_,k+=_+u}const C=pS(n,g,l);return this.measurementsCache=C,C}const p=this.measurementsCache.slice(0,f),x=new Array(s).fill(void 0),v=new Float64Array(s);let E=0;for(let h=0;h<f;h++){const g=p[h];g&&(x[g.lane]===void 0&&E++,x[g.lane]=h,v[g.lane]=g.end)}for(let h=f;h<n;h++){const g=l(h),k=this.laneAssignments.get(h);let C,N;const b=a==="estimate"||c.has(g);if(k!==void 0&&this.options.lanes>1){C=k;const S=x[C],j=S!==void 0?p[S]:void 0;N=j?j.end+u:r+i}else if(E===s){let S=0,j=v[0],O=x[0];for(let U=1;U<s;U++){const G=v[U];(G<j||G===j&&x[U]<O)&&(S=U,j=G,O=x[U])}C=S,N=j+u,b&&this.laneAssignments.set(h,C)}else C=h%this.options.lanes,N=r+i,b&&this.laneAssignments.set(h,C);const I=c.get(g),_=typeof I=="number"?I:this.options.estimateSize(h),z=N+_;p[h]={index:h,start:N,size:_,end:z,key:g,lane:C},x[C]===void 0&&E++,x[C]=h,v[C]=z}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=rr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,l)=>n.length===0||r===0?(this.range=null,null):(this.range=IS(n,r,i,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=rr(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,l,o)=>l===null||o===null?[]:n({startIndex:l,endIndex:o,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-l),s=Math.min(this.options.count-1,i+l);return n>=o&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),l=this.elementsCache.get(i);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,l;if(n<0||n>=this.options.count)return;let o,s,a;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)a=this.options.getItemKey(n),s=u[n*2],o=u[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;a=f.key,s=f.start,o=f.size}const d=this.itemSizeCache.get(a)??o,c=r-d;if(c!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,E=!this.itemSizeCache.has(a)?s<x:s+d<=x&&this.scrollDirection!=="backward",h=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:a,start:s,size:o,end:s+o,lane:0},c,this):E);(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(a,r),this.itemSizeCacheVersion++;let g=!1;f?g=this.applyScrollAdjustment(this.getTotalSize()-p):h&&(g=this.applyScrollAdjustment(c)),this.notify(g)}},this.getVirtualItems=rr(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let l=0,o=n.length;l<o;l++){const s=n[l],a=r[s];i.push(a)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,l=this.options.lanes===1&&i!=null,o=eg(0,r.length-1,l?s=>i[s*2]:s=>Qd(r[s]).start,n);return Qd(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+l?"end":"start"),r==="center"?n+=(i-l)/2:r==="end"&&(n-=l);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),l=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=l+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=l+this.options.scrollPaddingStart)r="start";else return[l,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const s=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0;const l=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{this._iosDeferredAdjustment=0,n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getOffsetForIndex(n,r);if(!l)return;const[o,s]=l,a=this.now();this.scrollState={index:n,align:s,behavior:i,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,l=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const l=r.length-1,o=this._flatMeasurements;o!=null?i=o[l*2]+o[l*2+1]:i=((n=r[l])==null?void 0:n.end)??0}else{const l=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&l.some(s=>s===null);){const s=r[o];l[s.lane]===null&&(l[s.lane]=s.end),o--}i=Math.max(...l.filter(s=>s!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){return t===0?!1:hs()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=t,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,l=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&hS(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const s=this.getSize()||600,a=Math.abs(i-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&a>s;this.scrollState.lastTargetOffset=i,u||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const eg=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else if(l>r)t=i-1;else return i}return e>0?e-1:0};function _S(e,t,n){let r=0;for(;r<=t;){const i=(r+t)/2|0,l=e[i*2];if(l<n)r=i+1;else if(l>n)t=i-1;else return i}return r>0?r-1:0}function IS(e,t,n,r,i){const l=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:l};if(r===1&&i!==null){const u=_S(i,l,n);let d=u;const c=n+t;for(;d<l&&i[d*2]+i[d*2+1]<c;)d++;return{startIndex:u,endIndex:d}}let s=eg(0,l,u=>e[u].start,n),a=s;if(r===1)for(;a<l&&e[a].end<n+t;)a++;else if(r>1){const u=Array(r).fill(0);for(;a<l&&u.some(c=>c<n+t);){const c=e[a];u[c.lane]=c.end,a++}const d=Array(r).fill(n+t);for(;s>=0&&d.some(c=>c>=n);){const c=e[s];d[c.lane]=c.start,s--}s=Math.max(0,s-s%r),a=Math.min(l,a+(r-1-a%r))}return{startIndex:s,endIndex:a}}const ms=typeof document<"u"?M.useLayoutEffect:M.useEffect;function NS({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const i=M.useReducer(d=>d+1,0)[1],l=M.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=t,l.current.mode=n;const o=d=>{const c=l.current;if(!c.enabled||!c.container)return;const f=d.getTotalSize();if(f!==c.lastSize){c.lastSize=f;const p=d.options.horizontal?"width":"height";c.container.style[p]=`${f}px`}},s=d=>{const c=l.current;if(!c.enabled||!c.container)return;o(d);const f=!!d.options.horizontal,p=c.mode==="transform",x=f?"left":"top",v=d.options.scrollMargin,E=d.getVirtualItems();for(const h of E){const g=h.start-v,k=d.elementsCache.get(h.key);k&&c.lastPositions.get(k)!==g&&(c.lastPositions.set(k,g),p?k.style.transform=f?`translate3d(${g}px, 0, 0)`:`translate3d(0, ${g}px, 0)`:k.style[x]=`${g}px`)}},a={...r,onChange:(d,c)=>{var f;const p=l.current;let x=!0;if(p.enabled){s(d);const v=d.range,E=p.prevRange;x=!E||E.isScrolling!==d.isScrolling||E.startIndex!==(v==null?void 0:v.startIndex)||E.endIndex!==(v==null?void 0:v.endIndex),x&&(p.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:d.isScrolling}:null)}x&&(e&&c?am.flushSync(i):i()),(f=r.onChange)==null||f.call(r,d,c)}},[u]=M.useState(()=>{const d=new ES(a);return Object.assign(d,{containerRef:c=>{const f=l.current;if(f.container=c,f.lastSize=null,c&&f.enabled){const p=d.getTotalSize();f.lastSize=p;const x=d.options.horizontal?"width":"height";c.style[x]=`${p}px`}}})});return u.setOptions(a),ms(()=>u._didMount(),[]),ms(()=>(o(u),u._willUpdate())),ms(()=>{s(u)}),u}function TS(e){return NS({observeElementRect:yS,observeElementOffset:wS,scrollToFn:CS,...e})}const tg=14,Yd=je.type.subagent,zS={elapsed:"elapsed, approval wait included",sidecar_span:"measured by the sub-agent span",reported:"reported by the harness",none:"not measured"};function jS({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{event:l,kind:o,status:s}=e.node,a=cS[o],u=je.status[s],d=l.name??l.kind,c=p0(l.duration_source),f=zS[c],p=Mi(l.input),x=Mi(l.text),v=l.child_session_id,E=v===null?null:{type:l.agent_type??je.type.subagent.label,status:v0(l.agent_status)};return m.jsxs("div",{role:"treeitem","data-slot":"span-row","data-span-status":s,"data-event-kind":o,"data-event-id":l.id,"data-session-id":e.sessionId,...v===null?{}:{"data-child-session-id":v},"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":[`${a.label} ${d}`,...E===null?[]:[`sub-agent ${E.type}, ${E.status}`],u.label,f].join(", "),tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:he("border-l-2 text-xs text-foreground",u.row,t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*tg},children:[m.jsxs("div",{className:"flex h-7 items-center gap-2 pr-2",children:[m.jsx(PS,{row:e,name:d,onToggle:i}),m.jsx("span",{"data-slot":"span-type",className:he("shrink-0",a.tint),children:m.jsx(a.Icon,{size:12,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"span-name",className:"min-w-0 flex-1 truncate",children:d}),E===null?null:m.jsxs("span",{"data-slot":"span-subagent",className:he("flex shrink-0 items-center gap-1",Yd.tint),children:[m.jsx(Yd.Icon,{size:12,"aria-hidden":"true"}),m.jsx("span",{className:"font-mono text-2xs",children:E.type}),m.jsx("span",{className:je.triggerBadge,children:E.status})]}),m.jsx("span",{"data-slot":"span-status",role:"img",title:u.label,"aria-label":u.label,className:he("shrink-0",u.tint),children:m.jsx(u.Icon,{size:12,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"span-metrics","data-duration-source":c,title:f,className:"shrink-0",children:m.jsx(Uu,{values:$m(l),showErrors:!1})})]}),p===null&&x===null?null:m.jsxs("div",{"data-slot":"span-payload",className:"flex items-center gap-2 pb-1 pl-6 pr-2",children:[p===null?null:m.jsx("span",{"data-slot":"span-input",className:he("min-w-0 truncate",je.payloadChip),children:p}),x===null?null:m.jsx("span",{"data-slot":"span-output",className:he("min-w-0 truncate",je.payloadChip),children:x})]})]})}function PS({row:e,name:t,onToggle:n}){if(!e.hasChildren)return m.jsx("span",{"data-slot":"span-expand-space","aria-hidden":"true",className:"w-3.5 shrink-0"});const r=e.expanded?Eo:Ai;return m.jsx("button",{type:"button","data-slot":"span-expand",tabIndex:-1,"aria-label":e.expanded?`collapse ${t}`:`expand ${t}`,onClick:i=>{i.stopPropagation(),n==null||n(e.id)},className:"shrink-0 text-faint",children:m.jsx(r,{size:14,"aria-hidden":"true"})})}function Uu({values:e,showErrors:t}){return m.jsxs(m.Fragment,{children:[t&&e.errorCount>0?m.jsxs("span",{"data-slot":"row-errors",className:je.errorChip,children:[e.errorCount," err"]}):null,m.jsx(Bu,{className:"shrink-0",duration:qv(e.durationMs),...e.tokens>0?{tokens:`${Wt(e.tokens)} tok`}:{},...e.costUnknown!==void 0?{cost:Li(e.cost),costUnknown:e.costUnknown}:e.cost!==null&&e.cost>0?{cost:Li(e.cost)}:{}})]})}function AS({row:e,selected:t,focused:n,onSelect:r,onToggle:i}){const{turn:l}=e,{Icon:o,tint:s,label:a}=je.trace,u=e.expanded?Eo:Ai,d=y0(l);return m.jsxs("div",{role:"treeitem","data-slot":"trace-group","data-turn-kind":l.kind,"data-session-id":e.sessionId,"aria-level":e.depth+1,"aria-setsize":e.setSize,"aria-posinset":e.posInSet,"aria-selected":t,...e.hasChildren?{"aria-expanded":e.expanded}:{},"aria-label":`${a} ${l.seq}: ${d}`,tabIndex:n?0:-1,onClick:()=>r==null?void 0:r(e.id),className:he("flex h-9 items-center gap-2 border-l-2 border-b border-b-border bg-surface pr-2 text-xs text-foreground",t?"border-l-accent bg-accent-muted":"border-l-background"),style:{paddingLeft:e.depth*tg},children:[m.jsx("button",{type:"button","data-slot":"trace-expand",tabIndex:-1,"aria-label":e.expanded?`collapse turn ${l.seq}`:`expand turn ${l.seq}`,onClick:c=>{c.stopPropagation(),i==null||i(e.id)},className:"shrink-0 pl-1 text-faint",children:m.jsx(u,{size:14,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"trace-icon",className:he("shrink-0",s),children:m.jsx(o,{size:12,"aria-hidden":"true"})}),m.jsx("span",{"data-slot":"trace-preview",className:"min-w-0 flex-1 truncate font-medium",children:d}),e.subagent===void 0?null:m.jsxs("span",{"data-slot":"trace-subagent",className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{"data-slot":"trace-agent-description",className:"min-w-0 truncate font-mono text-2xs text-muted",children:e.subagent.header.agent_description??""}),m.jsx(Bu,{className:"shrink-0",tokens:`${Wt(e.subagent.header.tokens_in+e.subagent.header.tokens_out)} tok`,cost:Li(e.subagent.header.est_cost),costUnknown:Lr(e.subagent.header.est_cost,e.subagent.header.model)})]}),l.kind==="human"?null:m.jsx("span",{"data-slot":"trace-trigger",title:`started by ${l.kind}`,"aria-label":`started by ${l.kind}`,className:je.triggerBadge,children:l.kind}),m.jsx(Uu,{values:g0(l),showErrors:!0})]})}const LS=28,MS=8;function RS({rows:e,selectedId:t,focusedIndex:n,initialRect:r,estimateSize:i=LS,overscan:l=MS,followIndex:o,revealIndex:s,onScrollMetrics:a,onKeyDown:u,onSelect:d,onToggle:c}){const f=M.useRef(null),p=M.useRef(!1),x=TS({count:e.length,getScrollElement:()=>f.current,estimateSize:()=>i,overscan:l,getItemKey:E=>{var h;return((h=e[E])==null?void 0:h.id)??E},...r===void 0?{}:{initialRect:r}});M.useEffect(()=>{o!==void 0&&(p.current=!0,x.scrollToIndex(o,{align:"end"}))},[o,x]),M.useEffect(()=>{s!==void 0&&(p.current=!0,x.scrollToIndex(s,{align:"center"}))},[s,x]);const v=E=>{if(p.current){p.current=!1;return}const h=E.currentTarget;a==null||a({scrollTop:h.scrollTop,scrollHeight:h.scrollHeight,clientHeight:h.clientHeight})};return m.jsx("div",{ref:f,"data-slot":"span-tree-scroller",className:"h-full overflow-y-auto",onKeyDown:u,onScroll:v,children:m.jsx("div",{role:"tree","aria-label":"span tree","data-slot":"span-tree",className:"relative w-full",style:{height:x.getTotalSize()},children:x.getVirtualItems().map(E=>{const h=e[E.index];return h===void 0?null:m.jsx("div",{role:"presentation","data-index":E.index,ref:x.measureElement,className:"absolute left-0 w-full",style:{top:E.start},children:h.kind==="turn"?m.jsx(AS,{row:h,selected:h.id===t,focused:E.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}}):m.jsx(jS,{row:h,selected:h.id===t,focused:E.index===n,...d===void 0?{}:{onSelect:d},...c===void 0?{}:{onToggle:c}})},E.key)})})})}function OS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const DS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$S={};function Xd(e,t){return($S.jsx?FS:DS).test(e)}const VS=/[ \t\n\f\r]/g;function BS(e){return typeof e=="object"?e.type==="text"?Jd(e.value):!1:Jd(e)}function Jd(e){return e.replace(VS,"")===""}class Ui{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ui.prototype.normal={};Ui.prototype.property={};Ui.prototype.space=void 0;function ng(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ui(n,r,t)}function Ia(e){return e.toLowerCase()}class tt{constructor(t,n){this.attribute=n,this.property=t}}tt.prototype.attribute="";tt.prototype.booleanish=!1;tt.prototype.boolean=!1;tt.prototype.commaOrSpaceSeparated=!1;tt.prototype.commaSeparated=!1;tt.prototype.defined=!1;tt.prototype.mustUseProperty=!1;tt.prototype.number=!1;tt.prototype.overloadedBoolean=!1;tt.prototype.property="";tt.prototype.spaceSeparated=!1;tt.prototype.space=void 0;let US=0;const q=er(),Ee=er(),Na=er(),A=er(),de=er(),Un=er(),it=er();function er(){return 2**++US}const Ta=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:Ee,commaOrSpaceSeparated:it,commaSeparated:Un,number:A,overloadedBoolean:Na,spaceSeparated:de},Symbol.toStringTag,{value:"Module"})),gs=Object.keys(Ta);class Hu extends tt{constructor(t,n,r,i){let l=-1;if(super(t,n),Zd(this,"space",i),typeof r=="number")for(;++l<gs.length;){const o=gs[l];Zd(this,gs[l],(r&Ta[o])===Ta[o])}}}Hu.prototype.defined=!0;function Zd(e,t,n){n&&(e[t]=n)}function Mr(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const l=new Hu(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[Ia(r)]=r,n[Ia(l.attribute)]=r}return new Ui(t,n,e.space)}const rg=Mr({properties:{ariaActiveDescendant:null,ariaAtomic:Ee,ariaAutoComplete:null,ariaBusy:Ee,ariaChecked:Ee,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:de,ariaCurrent:null,ariaDescribedBy:de,ariaDetails:null,ariaDisabled:Ee,ariaDropEffect:de,ariaErrorMessage:null,ariaExpanded:Ee,ariaFlowTo:de,ariaGrabbed:Ee,ariaHasPopup:null,ariaHidden:Ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:de,ariaLevel:A,ariaLive:null,ariaModal:Ee,ariaMultiLine:Ee,ariaMultiSelectable:Ee,ariaOrientation:null,ariaOwns:de,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:Ee,ariaReadOnly:Ee,ariaRelevant:null,ariaRequired:Ee,ariaRoleDescription:de,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:Ee,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ig(e,t){return t in e?e[t]:t}function lg(e,t){return ig(e,t.toLowerCase())}const HS=Mr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Un,acceptCharset:de,accessKey:de,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alpha:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:de,autoFocus:q,autoPlay:q,blocking:de,capture:null,charSet:null,checked:q,cite:null,className:de,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:Ee,controls:q,controlsList:de,coords:A|Un,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Na,draggable:Ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:de,height:A,hidden:Na,high:A,href:null,hrefLang:null,htmlFor:de,httpEquiv:de,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:de,itemRef:de,itemScope:q,itemType:de,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,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:A,pattern:null,ping:de,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:de,required:q,reversed:q,rows:A,rowSpan:A,sandbox:de,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootCustomElementRegistry:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shadowRootSerializable:q,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:Ee,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:Ee,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:de,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,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:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:Ee,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:q,disablePictureInPicture:q,disableRemotePlayback:q,exportParts:Un,part:de,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:lg}),WS=Mr({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",maskType:"mask-type",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:it,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:de,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:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,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:Un,g2:Un,glyphName:Un,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:it,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,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:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:de,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:it,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:it,rev:it,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:it,requiredFeatures:it,requiredFonts:it,requiredFormats:it,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:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:it,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:it,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:it,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ig}),og=Mr({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()}}),sg=Mr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lg}),ag=Mr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),qS={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"},KS=/[A-Z]/g,ef=/-[a-z]/g,QS=/^data[-\w.:]+$/i;function GS(e,t){const n=Ia(t);let r=t,i=tt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&QS.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(ef,XS);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!ef.test(l)){let o=l.replace(KS,YS);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Hu}return new i(r,t)}function YS(e){return"-"+e.toLowerCase()}function XS(e){return e.charAt(1).toUpperCase()}const JS=ng([rg,HS,og,sg,ag],"html"),Wu=ng([rg,WS,og,sg,ag],"svg");function ZS(e){return e.join(" ").trim()}var qu={},tf=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,eb=/\n/g,tb=/^\s*/,nb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,rb=/^:\s*/,ib=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,lb=/^[;\s]*/,ob=/^\s+|\s+$/g,sb=`
227
227
  `,nf="/",rf="*",Rn="",ab="comment",ub="declaration";function cb(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(x){var v=x.match(eb);v&&(n+=v.length);var E=x.lastIndexOf(sb);r=~E?x.length-E:r+x.length}function l(){var x={line:n,column:r};return function(v){return v.position=new o(x),u(),v}}function o(x){this.start=x,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(x){var v=new Error(t.source+":"+n+":"+r+": "+x);if(v.reason=x,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function a(x){var v=x.exec(e);if(v){var E=v[0];return i(E),e=e.slice(E.length),v}}function u(){a(tb)}function d(x){var v;for(x=x||[];v=c();)v!==!1&&x.push(v);return x}function c(){var x=l();if(!(nf!=e.charAt(0)||rf!=e.charAt(1))){for(var v=2;Rn!=e.charAt(v)&&(rf!=e.charAt(v)||nf!=e.charAt(v+1));)++v;if(v+=2,Rn===e.charAt(v-1))return s("End of comment missing");var E=e.slice(2,v-2);return r+=2,i(E),e=e.slice(v),r+=2,x({type:ab,comment:E})}}function f(){var x=l(),v=a(nb);if(v){if(c(),!a(rb))return s("property missing ':'");var E=a(ib),h=x({type:ub,property:lf(v[0].replace(tf,Rn)),value:E?lf(E[0].replace(tf,Rn)):Rn});return a(lb),h}}function p(){var x=[];d(x);for(var v;v=f();)v!==!1&&(x.push(v),d(x));return x}return u(),p()}function lf(e){return e?e.replace(ob,Rn):Rn}var db=cb,fb=jl&&jl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qu,"__esModule",{value:!0});qu.default=hb;const pb=fb(db);function hb(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,pb.default)(e),i=typeof t=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:o,value:s}=l;i?t(o,s,l):s&&(n=n||{},n[o]=s)}),n}var Io={};Object.defineProperty(Io,"__esModule",{value:!0});Io.camelCase=void 0;var mb=/^--[a-zA-Z0-9_-]+$/,gb=/-([a-z])/g,xb=/^[^-]+$/,yb=/^-(webkit|moz|ms|o|khtml)-/,kb=/^-(ms)-/,vb=function(e){return!e||xb.test(e)||mb.test(e)},wb=function(e,t){return t.toUpperCase()},of=function(e,t){return"".concat(t,"-")},Sb=function(e,t){return t===void 0&&(t={}),vb(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(kb,of):e=e.replace(yb,of),e.replace(gb,wb))};Io.camelCase=Sb;var bb=jl&&jl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Cb=bb(qu),Eb=Io;function za(e,t){var n={};return!e||typeof e!="string"||(0,Cb.default)(e,function(r,i){r&&i&&(n[(0,Eb.camelCase)(r,t)]=i)}),n}za.default=za;var _b=za;const Ib=Gf(_b),ug=cg("end"),Ku=cg("start");function cg(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 Nb(e){const t=Ku(e),n=ug(e);if(t&&n)return{start:t,end:n}}function pi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?sf(e.position):"start"in e||"end"in e?sf(e):"line"in e||"column"in e?ja(e):""}function ja(e){return af(e&&e.line)+":"+af(e&&e.column)}function sf(e){return ja(e&&e.start)+"-"+ja(e&&e.end)}function af(e){return e&&typeof e=="number"?e:1}class Ue extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},o=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(o=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?l.ruleId=r:(l.source=r.slice(0,a),l.ruleId=r.slice(a+1))}if(!l.place&&l.ancestors&&l.ancestors){const a=l.ancestors[l.ancestors.length-1];a&&(l.place=a.position)}const s=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=pi(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ue.prototype.file="";Ue.prototype.name="";Ue.prototype.reason="";Ue.prototype.message="";Ue.prototype.stack="";Ue.prototype.column=void 0;Ue.prototype.line=void 0;Ue.prototype.ancestors=void 0;Ue.prototype.cause=void 0;Ue.prototype.fatal=void 0;Ue.prototype.place=void 0;Ue.prototype.ruleId=void 0;Ue.prototype.source=void 0;const Qu={}.hasOwnProperty,Tb=new Map,zb=/[A-Z]/g,jb=new Set(["table","tbody","thead","tfoot","tr"]),Pb=new Set(["td","th"]),dg="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Ab(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=Vb(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=$b(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"?Wu:JS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=fg(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function fg(e,t,n){if(t.type==="element")return Lb(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Mb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ob(e,t,n);if(t.type==="mdxjsEsm")return Rb(e,t);if(t.type==="root")return Db(e,t,n);if(t.type==="text")return Fb(e,t)}function Lb(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Wu,e.schema=i),e.ancestors.push(t);const l=hg(e,t.tagName,!1),o=Bb(e,t);let s=Yu(e,t);return jb.has(t.tagName)&&(s=s.filter(function(a){return typeof a=="string"?!BS(a):!0})),pg(e,o,l,t),Gu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,l,o,n)}function Mb(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)}Ri(e,t.position)}function Rb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ri(e,t.position)}function Ob(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Wu,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:hg(e,t.name,!0),o=Ub(e,t),s=Yu(e,t);return pg(e,o,l,t),Gu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,l,o,n)}function Db(e,t,n){const r={};return Gu(r,Yu(e,t)),e.create(t,e.Fragment,r,n)}function Fb(e,t){return t.value}function pg(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gu(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function $b(e,t,n){return r;function r(i,l,o,s){const u=Array.isArray(o.children)?n:t;return s?u(l,o,s):u(l,o)}}function Vb(e,t){return n;function n(r,i,l,o){const s=Array.isArray(l.children),a=Ku(r);return t(i,l,o,s,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function Bb(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Qu.call(t.properties,i)){const l=Hb(e,i,t.properties[i]);if(l){const[o,s]=l;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&Pb.has(t.tagName)?r=s:n[o]=s}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Ub(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Ri(e,t.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,l=e.evaluater.evaluateExpression(s.expression)}else Ri(e,t.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function Yu(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Tb;for(;++r<t.children.length;){const l=t.children[r];let o;if(e.passKeys){const a=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(a){const u=i.get(a)||0;o=a+"-"+u,i.set(a,u+1)}}const s=fg(e,l,o);s!==void 0&&n.push(s)}return n}function Hb(e,t,n){const r=GS(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?OS(n):ZS(n)),r.property==="style"){let i=typeof n=="object"?n:Wb(e,String(n));return e.stylePropertyNameCase==="css"&&(i=qb(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?qS[r.property]||r.property:r.attribute,n]}}function Wb(e,t){try{return Ib(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ue("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=dg+"#cannot-parse-style-attribute",i}}function hg(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,o;for(;++l<i.length;){const s=Xd(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(l&&s.type==="Literal"),optional:!1}:s}r=o}else r=Xd(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Qu.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ri(e)}function Ri(e,t){const n=new Ue("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=dg+"#cannot-handle-mdx-estrees-without-createevaluater",n}function qb(e){const t={};let n;for(n in e)Qu.call(e,n)&&(t[Kb(n)]=e[n]);return t}function Kb(e){let t=e.replace(zb,Qb);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Qb(e){return"-"+e.toLowerCase()}const xs={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"]},Gb={};function Xu(e,t){const n=Gb,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return mg(e,r,i)}function mg(e,t,n){if(Yb(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 uf(e.children,t,n)}return Array.isArray(e)?uf(e,t,n):""}function uf(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=mg(e[i],t,n);return r.join("")}function Yb(e){return!!(e&&typeof e=="object")}const cf=document.createElement("i");function Ju(e){const t="&"+e+";";cf.innerHTML=t;const n=cf.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function at(e,t,n,r){const i=e.length;let l=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);l<r.length;)o=r.slice(l,l+1e4),o.unshift(t,0),e.splice(...o),l+=1e4,t+=1e4}function ht(e,t){return e.length>0?(at(e,e.length,0,t),e):t}const df={}.hasOwnProperty;function gg(e){const t={};let n=-1;for(;++n<e.length;)Xb(t,e[n]);return t}function Xb(e,t){let n;for(n in t){const i=(df.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let o;if(l)for(o in l){df.call(i,o)||(i[o]=[]);const s=l[o];Jb(i[o],Array.isArray(s)?s:s?[s]:[])}}}function Jb(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);at(e,0,0,r)}function xg(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 Tt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const We=In(/[A-Za-z]/),Ve=In(/[\dA-Za-z]/),Zb=In(/[#-'*+\--9=?A-Z^-~]/);function io(e){return e!==null&&(e<32||e===127)}const Pa=In(/\d/),eC=In(/[\dA-Fa-f]/),tC=In(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function fe(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}const No=In(new RegExp("\\p{P}|\\p{S}","u")),Yn=In(/\s/);function In(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Rr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let o="";if(l===37&&Ve(e.charCodeAt(n+1))&&Ve(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const s=e.charCodeAt(n+1);l<56320&&s>56319&&s<57344?(o=String.fromCharCode(l,s),i=1):o="�"}else o=String.fromCharCode(l);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ne(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(a){return Z(a)?(e.enter(n),s(a)):t(a)}function s(a){return Z(a)&&l++<i?(e.consume(a),s):(e.exit(n),t(a))}}const nC={tokenize:rC};function rC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ne(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),l(s)}function l(s){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return B(s)?(e.consume(s),e.exit("chunkText"),l):(e.consume(s),o)}}const iC={tokenize:lC},ff={tokenize:oC};function lC(e){const t=this,n=[];let r=0,i,l,o;return s;function s(k){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,a,u)(k)}return u(k)}function a(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&g();const C=t.events.length;let N=C,b;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){b=t.events[N][1].end;break}h(r);let I=C;for(;I<t.events.length;)t.events[I][1].end={...b},I++;return at(t.events,N+1,0,t.events.slice(C)),t.events.length=I,u(k)}return s(k)}function u(k){if(r===n.length){if(!i)return f(k);if(i.currentConstruct&&i.currentConstruct.concrete)return x(k);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ff,d,c)(k)}function d(k){return i&&g(),h(r),f(k)}function c(k){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,x(k)}function f(k){return t.containerState={},e.attempt(ff,p,x)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),f(k)}function x(k){if(k===null){i&&g(),h(0),e.consume(k);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),v(k)}function v(k){if(k===null){E(e.exit("chunkFlow"),!0),h(0),e.consume(k);return}return B(k)?(e.consume(k),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(k),v)}function E(k,C){const N=t.sliceStream(k);if(C&&N.push(null),k.previous=l,l&&(l.next=k),l=k,i.defineSkip(k.start),i.write(N),t.parser.lazy[k.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<o&&(!i.events[b][1].end||i.events[b][1].end.offset>o))return;const I=t.events.length;let _=I,z,S;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(z){S=t.events[_][1].end;break}z=!0}for(h(r),b=I;b<t.events.length;)t.events[b][1].end={...S},b++;at(t.events,_+1,0,t.events.slice(I)),t.events.length=b}}function h(k){let C=n.length;for(;C-- >k;){const N=n[C];t.containerState=N[1],N[0].exit.call(t,e)}n.length=k}function g(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function oC(e,t,n){return ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zr(e){if(e===null||fe(e)||Yn(e))return 1;if(No(e))return 2}function To(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Aa={name:"attention",resolveAll:sC,tokenize:aC};function sC(e,t){let n=-1,r,i,l,o,s,a,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;a=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 c={...e[r][1].end},f={...e[n][1].start};pf(c,-a),pf(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},l={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ht(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ht(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",l,t]]),u=ht(u,To(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ht(u,[["exit",l,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ht(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,at(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 aC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=zr(r);let l;return o;function o(a){return l=a,e.enter("attentionSequence"),s(a)}function s(a){if(a===l)return e.consume(a),s;const u=e.exit("attentionSequence"),d=zr(a),c=!d||d===2&&i||n.includes(a),f=!i||i===2&&d||n.includes(r);return u._open=!!(l===42?c:c&&(i||!f)),u._close=!!(l===42?f:f&&(d||!c)),t(a)}}function pf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const uC={name:"autolink",tokenize:cC};function cC(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(p){return We(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Ve(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,a):(p===43||p===45||p===46||Ve(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function a(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||io(p)?n(p):(e.consume(p),a)}function u(p){return p===64?(e.consume(p),d):Zb(p)?(e.consume(p),u):n(p)}function d(p){return Ve(p)?c(p):n(p)}function c(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Ve(p))&&r++<63){const x=p===45?f:c;return e.consume(p),x}return n(p)}}const Hi={partial:!0,tokenize:dC};function dC(e,t,n){return r;function r(l){return Z(l)?ne(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||B(l)?t(l):n(l)}}const yg={continuation:{tokenize:pC},exit:hC,name:"blockQuote",tokenize:fC};function fC(e,t,n){const r=this;return i;function i(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return n(o)}function l(o){return Z(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function pC(e,t,n){const r=this;return i;function i(o){return Z(o)?ne(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(yg,t,n)(o)}}function hC(e){e.exit("blockQuote")}const kg={name:"characterEscape",tokenize:mC};function mC(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return tC(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const vg={name:"characterReference",tokenize:gC};function gC(e,t,n){const r=this;let i=0,l,o;return s;function s(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),a}function a(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),l=31,o=Ve,d(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=eC,d):(e.enter("characterReferenceValue"),l=7,o=Pa,d(c))}function d(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return o===Ve&&!Ju(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<l?(e.consume(c),d):n(c)}}const hf={partial:!0,tokenize:yC},mf={concrete:!0,name:"codeFenced",tokenize:xC};function xC(e,t,n){const r=this,i={partial:!0,tokenize:N};let l=0,o=0,s;return a;function a(b){return u(b)}function u(b){const I=r.events[r.events.length-1];return l=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,s=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(b)}function d(b){return b===s?(o++,e.consume(b),d):o<3?n(b):(e.exit("codeFencedFenceSequence"),Z(b)?ne(e,c,"whitespace")(b):c(b))}function c(b){return b===null||B(b)?(e.exit("codeFencedFence"),r.interrupt?t(b):e.check(hf,v,C)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||B(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(b)):Z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ne(e,p,"whitespace")(b)):b===96&&b===s?n(b):(e.consume(b),f)}function p(b){return b===null||B(b)?c(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||B(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(b)):b===96&&b===s?n(b):(e.consume(b),x)}function v(b){return e.attempt(i,C,E)(b)}function E(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h}function h(b){return l>0&&Z(b)?ne(e,g,"linePrefix",l+1)(b):g(b)}function g(b){return b===null||B(b)?e.check(hf,v,C)(b):(e.enter("codeFlowValue"),k(b))}function k(b){return b===null||B(b)?(e.exit("codeFlowValue"),g(b)):(e.consume(b),k)}function C(b){return e.exit("codeFenced"),t(b)}function N(b,I,_){let z=0;return S;function S(W){return b.enter("lineEnding"),b.consume(W),b.exit("lineEnding"),j}function j(W){return b.enter("codeFencedFence"),Z(W)?ne(b,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):O(W)}function O(W){return W===s?(b.enter("codeFencedFenceSequence"),U(W)):_(W)}function U(W){return W===s?(z++,b.consume(W),U):z>=o?(b.exit("codeFencedFenceSequence"),Z(W)?ne(b,G,"whitespace")(W):G(W)):_(W)}function G(W){return W===null||B(W)?(b.exit("codeFencedFence"),I(W)):_(W)}}}function yC(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const ys={name:"codeIndented",tokenize:vC},kC={partial:!0,tokenize:wC};function vC(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ne(e,l,"linePrefix",5)(u)}function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?a(u):B(u)?e.attempt(kC,o,a)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||B(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function a(u){return e.exit("codeIndented"),t(u)}}function wC(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ne(e,l,"linePrefix",5)(o)}function l(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):B(o)?i(o):n(o)}}const SC={name:"codeText",previous:CC,resolve:bC,tokenize:EC};function bC(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 CC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function EC(e,t,n){let r=0,i,l;return o;function o(c){return e.enter("codeText"),e.enter("codeTextSequence"),s(c)}function s(c){return c===96?(e.consume(c),r++,s):(e.exit("codeTextSequence"),a(c))}function a(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),a):c===96?(l=e.enter("codeTextSequence"),i=0,d(c)):B(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||B(c)?(e.exit("codeTextData"),a(c)):(e.consume(c),u)}function d(c){return c===96?(e.consume(c),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(l.type="codeTextData",u(c))}}class _C{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 l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Xr(this.left,r),l.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),Xr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Xr(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);Xr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Xr(this.left,n.reverse())}}}function Xr(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 wg(e){const t={};let n=-1,r,i,l,o,s,a,u;const d=new _C(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"&&(a=r[1]._tokenizer.events,l=0,l<a.length&&a[l][1].type==="lineEndingBlank"&&(l+=2),l<a.length&&a[l][1].type==="content"))for(;++l<a.length&&a[l][1].type!=="content";)a[l][1].type==="chunkText"&&(a[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,IC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(o=d.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},s=d.slice(i,n),s.unshift(r),d.splice(i,n-i+1,s))}}return at(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function IC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const l=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,a=[],u={};let d,c,f=-1,p=n,x=0,v=0;const E=[v];for(;p;){for(;e.get(++i)[1]!==p;);l.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),c&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(v=f+1,E.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):E.pop(),f=E.length;f--;){const h=s.slice(E[f],E[f+1]),g=l.pop();a.push([g,g+h.length-1]),e.splice(g,2,h)}for(a.reverse(),f=-1;++f<a.length;)u[x+a[f][0]]=x+a[f][1],x+=a[f][1]-a[f][0]-1;return u}const NC={resolve:zC,tokenize:jC},TC={partial:!0,tokenize:PC};function zC(e){return wg(e),e}function jC(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?l(s):B(s)?e.check(TC,o,l)(s):(e.consume(s),i)}function l(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function PC(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ne(e,l,"linePrefix")}function l(o){if(o===null||B(o))return n(o);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Sg(e,t,n,r,i,l,o,s,a){const u=a||Number.POSITIVE_INFINITY;let d=0;return c;function c(h){return h===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(h),e.exit(l),f):h===null||h===32||h===41||io(h)?n(h):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),v(h))}function f(h){return h===62?(e.enter(l),e.consume(h),e.exit(l),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===62?(e.exit("chunkString"),e.exit(s),f(h)):h===null||h===60||B(h)?n(h):(e.consume(h),h===92?x:p)}function x(h){return h===60||h===62||h===92?(e.consume(h),p):p(h)}function v(h){return!d&&(h===null||h===41||fe(h))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(h)):d<u&&h===40?(e.consume(h),d++,v):h===41?(e.consume(h),d--,v):h===null||h===32||h===40||io(h)?n(h):(e.consume(h),h===92?E:v)}function E(h){return h===40||h===41||h===92?(e.consume(h),v):v(h)}}function bg(e,t,n,r,i,l){const o=this;let s=0,a;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(l),d}function d(p){return s>999||p===null||p===91||p===93&&!a||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(l),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):B(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===null||p===91||p===93||B(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!Z(p)),p===92?f:c)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Cg(e,t,n,r,i,l){let o;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,a):n(f)}function a(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(l),u(f))}function u(f){return f===o?(e.exit(l),a(o)):f===null?n(f):B(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||B(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:d)}function c(f){return f===o||f===92?(e.consume(f),d):d(f)}}function hi(e,t){let n;return r;function r(i){return B(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Z(i)?ne(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const AC={name:"definition",tokenize:MC},LC={partial:!0,tokenize:RC};function MC(e,t,n){const r=this;let i;return l;function l(p){return e.enter("definition"),o(p)}function o(p){return bg.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=Tt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):n(p)}function a(p){return fe(p)?hi(e,u)(p):u(p)}function u(p){return Sg(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(LC,c,c)(p)}function c(p){return Z(p)?ne(e,f,"whitespace")(p):f(p)}function f(p){return p===null||B(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function RC(e,t,n){return r;function r(s){return fe(s)?hi(e,i)(s):n(s)}function i(s){return Cg(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function l(s){return Z(s)?ne(e,o,"whitespace")(s):o(s)}function o(s){return s===null||B(s)?t(s):n(s)}}const OC={name:"hardBreakEscape",tokenize:DC};function DC(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return B(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const FC={name:"headingAtx",resolve:$C,tokenize:VC};function $C(e,t){let n=e.length-2,r=3,i,l;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},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},at(e,r,n-r+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function VC(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),l(d)}function l(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||fe(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||B(d)?(e.exit("atxHeading"),t(d)):Z(d)?ne(e,s,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function a(d){return d===35?(e.consume(d),a):(e.exit("atxHeadingSequence"),s(d))}function u(d){return d===null||d===35||fe(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),u)}}const BC=["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"],gf=["pre","script","style","textarea"],UC={concrete:!0,name:"htmlFlow",resolveTo:qC,tokenize:KC},HC={partial:!0,tokenize:GC},WC={partial:!0,tokenize:QC};function qC(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 KC(e,t,n){const r=this;let i,l,o,s,a;return u;function u(w){return d(w)}function d(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),c}function c(w){return w===33?(e.consume(w),f):w===47?(e.consume(w),l=!0,v):w===63?(e.consume(w),i=3,r.interrupt?t:y):We(w)?(e.consume(w),o=String.fromCharCode(w),E):n(w)}function f(w){return w===45?(e.consume(w),i=2,p):w===91?(e.consume(w),i=5,s=0,x):We(w)?(e.consume(w),i=4,r.interrupt?t:y):n(w)}function p(w){return w===45?(e.consume(w),r.interrupt?t:y):n(w)}function x(w){const pe="CDATA[";return w===pe.charCodeAt(s++)?(e.consume(w),s===pe.length?r.interrupt?t:O:x):n(w)}function v(w){return We(w)?(e.consume(w),o=String.fromCharCode(w),E):n(w)}function E(w){if(w===null||w===47||w===62||fe(w)){const pe=w===47,oe=o.toLowerCase();return!pe&&!l&&gf.includes(oe)?(i=1,r.interrupt?t(w):O(w)):BC.includes(o.toLowerCase())?(i=6,pe?(e.consume(w),h):r.interrupt?t(w):O(w)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(w):l?g(w):k(w))}return w===45||Ve(w)?(e.consume(w),o+=String.fromCharCode(w),E):n(w)}function h(w){return w===62?(e.consume(w),r.interrupt?t:O):n(w)}function g(w){return Z(w)?(e.consume(w),g):S(w)}function k(w){return w===47?(e.consume(w),S):w===58||w===95||We(w)?(e.consume(w),C):Z(w)?(e.consume(w),k):S(w)}function C(w){return w===45||w===46||w===58||w===95||Ve(w)?(e.consume(w),C):N(w)}function N(w){return w===61?(e.consume(w),b):Z(w)?(e.consume(w),N):k(w)}function b(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,I):Z(w)?(e.consume(w),b):_(w)}function I(w){return w===a?(e.consume(w),a=null,z):w===null||B(w)?n(w):(e.consume(w),I)}function _(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||fe(w)?N(w):(e.consume(w),_)}function z(w){return w===47||w===62||Z(w)?k(w):n(w)}function S(w){return w===62?(e.consume(w),j):n(w)}function j(w){return w===null||B(w)?O(w):Z(w)?(e.consume(w),j):n(w)}function O(w){return w===45&&i===2?(e.consume(w),X):w===60&&i===1?(e.consume(w),re):w===62&&i===4?(e.consume(w),J):w===63&&i===3?(e.consume(w),y):w===93&&i===5?(e.consume(w),V):B(w)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(HC,ie,U)(w)):w===null||B(w)?(e.exit("htmlFlowData"),U(w)):(e.consume(w),O)}function U(w){return e.check(WC,G,ie)(w)}function G(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),W}function W(w){return w===null||B(w)?U(w):(e.enter("htmlFlowData"),O(w))}function X(w){return w===45?(e.consume(w),y):O(w)}function re(w){return w===47?(e.consume(w),o="",L):O(w)}function L(w){if(w===62){const pe=o.toLowerCase();return gf.includes(pe)?(e.consume(w),J):O(w)}return We(w)&&o.length<8?(e.consume(w),o+=String.fromCharCode(w),L):O(w)}function V(w){return w===93?(e.consume(w),y):O(w)}function y(w){return w===62?(e.consume(w),J):w===45&&i===2?(e.consume(w),y):O(w)}function J(w){return w===null||B(w)?(e.exit("htmlFlowData"),ie(w)):(e.consume(w),J)}function ie(w){return e.exit("htmlFlow"),t(w)}}function QC(e,t,n){const r=this;return i;function i(o){return B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):n(o)}function l(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function GC(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Hi,t,n)}}const YC={name:"htmlText",tokenize:XC};function XC(e,t,n){const r=this;let i,l,o;return s;function s(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),a}function a(y){return y===33?(e.consume(y),u):y===47?(e.consume(y),N):y===63?(e.consume(y),k):We(y)?(e.consume(y),_):n(y)}function u(y){return y===45?(e.consume(y),d):y===91?(e.consume(y),l=0,x):We(y)?(e.consume(y),g):n(y)}function d(y){return y===45?(e.consume(y),p):n(y)}function c(y){return y===null?n(y):y===45?(e.consume(y),f):B(y)?(o=c,re(y)):(e.consume(y),c)}function f(y){return y===45?(e.consume(y),p):c(y)}function p(y){return y===62?X(y):y===45?f(y):c(y)}function x(y){const J="CDATA[";return y===J.charCodeAt(l++)?(e.consume(y),l===J.length?v:x):n(y)}function v(y){return y===null?n(y):y===93?(e.consume(y),E):B(y)?(o=v,re(y)):(e.consume(y),v)}function E(y){return y===93?(e.consume(y),h):v(y)}function h(y){return y===62?X(y):y===93?(e.consume(y),h):v(y)}function g(y){return y===null||y===62?X(y):B(y)?(o=g,re(y)):(e.consume(y),g)}function k(y){return y===null?n(y):y===63?(e.consume(y),C):B(y)?(o=k,re(y)):(e.consume(y),k)}function C(y){return y===62?X(y):k(y)}function N(y){return We(y)?(e.consume(y),b):n(y)}function b(y){return y===45||Ve(y)?(e.consume(y),b):I(y)}function I(y){return B(y)?(o=I,re(y)):Z(y)?(e.consume(y),I):X(y)}function _(y){return y===45||Ve(y)?(e.consume(y),_):y===47||y===62||fe(y)?z(y):n(y)}function z(y){return y===47?(e.consume(y),X):y===58||y===95||We(y)?(e.consume(y),S):B(y)?(o=z,re(y)):Z(y)?(e.consume(y),z):X(y)}function S(y){return y===45||y===46||y===58||y===95||Ve(y)?(e.consume(y),S):j(y)}function j(y){return y===61?(e.consume(y),O):B(y)?(o=j,re(y)):Z(y)?(e.consume(y),j):z(y)}function O(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),i=y,U):B(y)?(o=O,re(y)):Z(y)?(e.consume(y),O):(e.consume(y),G)}function U(y){return y===i?(e.consume(y),i=void 0,W):y===null?n(y):B(y)?(o=U,re(y)):(e.consume(y),U)}function G(y){return y===null||y===34||y===39||y===60||y===61||y===96?n(y):y===47||y===62||fe(y)?z(y):(e.consume(y),G)}function W(y){return y===47||y===62||fe(y)?z(y):n(y)}function X(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):n(y)}function re(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),L}function L(y){return Z(y)?ne(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):V(y)}function V(y){return e.enter("htmlTextData"),o(y)}}const Zu={name:"labelEnd",resolveAll:tE,resolveTo:nE,tokenize:rE},JC={tokenize:iE},ZC={tokenize:lE},eE={tokenize:oE};function tE(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&&at(e,0,e.length,n),e}function nE(e,t){let n=e.length,r=0,i,l,o,s;for(;n--;)if(i=e[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const a={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",a,t],["enter",u,t]],s=ht(s,e.slice(l+1,l+r+3)),s=ht(s,[["enter",d,t]]),s=ht(s,To(t.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),t)),s=ht(s,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),s=ht(s,e.slice(o+1)),s=ht(s,[["exit",a,t]]),at(e,l,e.length,s),e}function rE(e,t,n){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return s;function s(f){return l?l._inactive?c(f):(o=r.parser.defined.includes(Tt(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),a):n(f)}function a(f){return f===40?e.attempt(JC,d,o?d:c)(f):f===91?e.attempt(ZC,d,o?u:c)(f):o?d(f):c(f)}function u(f){return e.attempt(eE,d,c)(f)}function d(f){return t(f)}function c(f){return l._balanced=!0,n(f)}}function iE(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return fe(c)?hi(e,l)(c):l(c)}function l(c){return c===41?d(c):Sg(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return fe(c)?hi(e,a)(c):d(c)}function s(c){return n(c)}function a(c){return c===34||c===39||c===40?Cg(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):d(c)}function u(c){return fe(c)?hi(e,d)(c):d(c)}function d(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function lE(e,t,n){const r=this;return i;function i(s){return bg.call(r,e,l,o,"reference","referenceMarker","referenceString")(s)}function l(s){return r.parser.defined.includes(Tt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function oE(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const sE={name:"labelStartImage",resolveAll:Zu.resolveAll,tokenize:aE};function aE(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),l}function l(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const uE={name:"labelStartLink",resolveAll:Zu.resolveAll,tokenize:cE};function cE(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ks={name:"lineEnding",tokenize:dE};function dE(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ne(e,t,"linePrefix")}}const Tl={name:"thematicBreak",tokenize:fE};function fE(e,t,n){let r=0,i;return l;function l(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),a(u)):r>=3&&(u===null||B(u))?(e.exit("thematicBreak"),t(u)):n(u)}function a(u){return u===i?(e.consume(u),r++,a):(e.exit("thematicBreakSequence"),Z(u)?ne(e,s,"whitespace")(u):s(u))}}const Ge={continuation:{tokenize:gE},exit:yE,name:"list",tokenize:mE},pE={partial:!0,tokenize:kE},hE={partial:!0,tokenize:xE};function mE(e,t,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Pa(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Tl,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return n(p)}function a(p){return Pa(p)&&++o<10?(e.consume(p),a):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Hi,r.interrupt?n:d,e.attempt(pE,f,c))}function d(p){return r.containerState.initialBlankLine=!0,l++,f(p)}function c(p){return Z(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function gE(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Hi,i,l);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ne(e,t,"listItemIndent",r.containerState.size+1)(s)}function l(s){return r.containerState.furtherBlankLines||!Z(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hE,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ne(e,e.attempt(Ge,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function xE(e,t,n){const r=this;return ne(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(l):n(l)}}function yE(e){e.exit(this.containerState.type)}function kE(e,t,n){const r=this;return ne(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!Z(l)&&o&&o[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const xf={name:"setextUnderline",resolveTo:vE,tokenize:wE};function vE(e,t){let n=e.length,r,i,l;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),!l&&e[n][1].type==="definition"&&(l=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function wE(e,t,n){const r=this;let i;return l;function l(u){let d=r.events.length,c;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){c=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),Z(u)?ne(e,a,"lineSuffix")(u):a(u))}function a(u){return u===null||B(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const SE={tokenize:bE};function bE(e){const t=this,n=e.attempt(Hi,r,e.attempt(this.parser.constructs.flowInitial,i,ne(e,e.attempt(this.parser.constructs.flow,i,e.attempt(NC,i)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const CE={resolveAll:_g()},EE=Eg("string"),_E=Eg("text");function Eg(e){return{resolveAll:_g(e==="text"?IE:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],l=n.attempt(i,o,s);return o;function o(d){return u(d)?l(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),a}function a(d){return u(d)?(n.exit("data"),l(d)):(n.consume(d),a)}function u(d){if(d===null)return!0;const c=i[d];let f=-1;if(c)for(;++f<c.length;){const p=c[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function _g(e){return t;function t(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,r):n}}function IE(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 l=i.length,o=-1,s=0,a;for(;l--;){const u=i[l];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)a=!0,s++;else if(u!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||a||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},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 NE={42:Ge,43:Ge,45:Ge,48:Ge,49:Ge,50:Ge,51:Ge,52:Ge,53:Ge,54:Ge,55:Ge,56:Ge,57:Ge,62:yg},TE={91:AC},zE={[-2]:ys,[-1]:ys,32:ys},jE={35:FC,42:Tl,45:[xf,Tl],60:UC,61:xf,95:Tl,96:mf,126:mf},PE={38:vg,92:kg},AE={[-5]:ks,[-4]:ks,[-3]:ks,33:sE,38:vg,42:Aa,60:[uC,YC],91:uE,92:[OC,kg],93:Zu,95:Aa,96:SC},LE={null:[Aa,CE]},ME={null:[42,95]},RE={null:[]},OE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ME,contentInitial:TE,disable:RE,document:NE,flow:jE,flowInitial:zE,insideSpan:LE,string:PE,text:AE},Symbol.toStringTag,{value:"Module"}));function DE(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={},l=[];let o=[],s=[];const a={attempt:I(N),check:I(b),consume:g,enter:k,exit:C,interrupt:I(b,{interrupt:!0})},u={code:null,containerState:{},defineSkip:v,events:[],now:x,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:c};let d=t.tokenize.call(u,a);return t.resolveAll&&l.push(t),u;function c(j){return o=ht(o,j),E(),o[o.length-1]!==null?[]:(_(t,0),u.events=To(l,u.events,u),u.events)}function f(j,O){return $E(p(j),O)}function p(j){return FE(o,j)}function x(){const{_bufferIndex:j,_index:O,line:U,column:G,offset:W}=r;return{_bufferIndex:j,_index:O,line:U,column:G,offset:W}}function v(j){i[j.line]=j.column,S()}function E(){let j;for(;r._index<o.length;){const O=o[r._index];if(typeof O=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<O.length;)h(O.charCodeAt(r._bufferIndex));else h(O)}}function h(j){d=d(j)}function g(j){B(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,S()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function k(j,O){const U=O||{};return U.type=j,U.start=x(),u.events.push(["enter",U,u]),s.push(U),U}function C(j){const O=s.pop();return O.end=x(),u.events.push(["exit",O,u]),O}function N(j,O){_(j,O.from)}function b(j,O){O.restore()}function I(j,O){return U;function U(G,W,X){let re,L,V,y;return Array.isArray(G)?ie(G):"tokenize"in G?ie([G]):J(G);function J(K){return Ae;function Ae(nt){const ue=nt!==null&&K[nt],kt=nt!==null&&K.null,vt=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(kt)?kt:kt?[kt]:[]];return ie(vt)(nt)}}function ie(K){return re=K,L=0,K.length===0?X:w(K[L])}function w(K){return Ae;function Ae(nt){return y=z(),V=K,K.partial||(u.currentConstruct=K),K.name&&u.parser.constructs.disable.null.includes(K.name)?oe():K.tokenize.call(O?Object.assign(Object.create(u),O):u,a,pe,oe)(nt)}}function pe(K){return j(V,y),W}function oe(K){return y.restore(),++L<re.length?w(re[L]):X}}}function _(j,O){j.resolveAll&&!l.includes(j)&&l.push(j),j.resolve&&at(u.events,O,u.events.length-O,j.resolve(u.events.slice(O),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function z(){const j=x(),O=u.previous,U=u.currentConstruct,G=u.events.length,W=Array.from(s);return{from:G,restore:X};function X(){r=j,u.previous=O,u.currentConstruct=U,u.events.length=G,s=W,S()}}function S(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function FE(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,l)];else{if(o=e.slice(n,i),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function $E(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const l=e[n];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
228
228
  `;break}case-3:{o=`\r
229
229
  `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}function VE(e){const r={constructs:gg([OE,...(e||{}).extensions||[]]),content:i(nC),defined:[],document:i(iC),flow:i(SE),lazy:{},string:i(EE),text:i(_E)};return r;function i(l){return o;function o(s){return DE(r,l,s)}}}function BE(e){for(;!wg(e););return e}const yf=/[\0\t\n\r]/g;function UE(){let e=1,t="",n=!0,r;return i;function i(l,o,s){const a=[];let u,d,c,f,p;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),c=0,t="",n&&(l.charCodeAt(0)===65279&&c++,n=void 0);c<l.length;){if(yf.lastIndex=c,u=yf.exec(l),f=u&&u.index!==void 0?u.index:l.length,p=l.charCodeAt(f),!u){t=l.slice(c);break}if(p===10&&c===f&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),c<f&&(a.push(l.slice(c,f)),e+=f-c),p){case 0:{a.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,a.push(-2);e++<d;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return s&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const HE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WE(e){return e.replace(HE,qE)}function qE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return xg(n.slice(l?2:1),l?16:10)}return Ju(n)||e}const Ig={}.hasOwnProperty;function KE(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),QE(n)(BE(VE(n).document().write(UE()(e,t,!0))))}function QE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Or),autolinkProtocol:z,autolinkEmail:z,atxHeading:l(Se),blockQuote:l(kt),characterEscape:z,characterReference:z,codeFenced:l(vt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(vt,o),codeText:l(tn,o),codeTextData:z,data:z,codeFlowValue:z,definition:l(Nn),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(H),hardBreakEscape:l(Le),hardBreakTrailing:l(Le),htmlFlow:l(wt,o),htmlFlowData:z,htmlText:l(wt,o),htmlTextData:z,image:l(Tn),label:o,link:l(Or),listItem:l(cx),listItemValue:f,listOrdered:l(uc,c),listUnordered:l(uc),paragraph:l(dx),reference:w,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(Se),strong:l(fx),thematicBreak:l(hx)},exit:{atxHeading:a(),atxHeadingSequence:N,autolink:a(),autolinkEmail:ue,autolinkProtocol:nt,blockQuote:a(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:K,characterReference:Ae,codeFenced:a(E),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:S,codeIndented:a(h),codeText:a(W),codeTextData:S,data:S,definition:a(),definitionDestinationString:C,definitionLabelString:g,definitionTitleString:k,emphasis:a(),hardBreakEscape:a(O),hardBreakTrailing:a(O),htmlFlow:a(U),htmlFlowData:S,htmlText:a(G),htmlTextData:S,image:a(re),label:V,labelText:L,lineEnding:j,link:a(X),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:pe,resourceDestinationString:y,resourceTitleString:J,resource:ie,setextHeading:a(_),setextHeadingLineSequence:I,setextHeadingText:b,strong:a(),thematicBreak:a()}};Ng(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(T){let R={type:"root",children:[]};const Q={stack:[R],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:d,data:n},te=[];let ce=-1;for(;++ce<T.length;)if(T[ce][1].type==="listOrdered"||T[ce][1].type==="listUnordered")if(T[ce][0]==="enter")te.push(ce);else{const St=te.pop();ce=i(T,St,ce)}for(ce=-1;++ce<T.length;){const St=t[T[ce][0]];Ig.call(St,T[ce][1].type)&&St[T[ce][1].type].call(Object.assign({sliceSerialize:T[ce][2].sliceSerialize},Q),T[ce][1])}if(Q.tokenStack.length>0){const St=Q.tokenStack[Q.tokenStack.length-1];(St[1]||kf).call(Q,void 0,St[0])}for(R.position={start:ln(T.length>0?T[0][1].start:{line:1,column:1,offset:0}),end:ln(T.length>0?T[T.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)R=t.transforms[ce](R)||R;return R}function i(T,R,Q){let te=R-1,ce=-1,St=!1,zn,$t,Dr,Fr;for(;++te<=Q;){const rt=T[te];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?ce++:ce--,Fr=void 0;break}case"lineEndingBlank":{rt[0]==="enter"&&(zn&&!Fr&&!ce&&!Dr&&(Dr=te),Fr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Fr=void 0}if(!ce&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||ce===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[1].type==="listOrdered")){if(zn){let tr=te;for($t=void 0;tr--;){const Vt=T[tr];if(Vt[1].type==="lineEnding"||Vt[1].type==="lineEndingBlank"){if(Vt[0]==="exit")continue;$t&&(T[$t][1].type="lineEndingBlank",St=!0),Vt[1].type="lineEnding",$t=tr}else if(!(Vt[1].type==="linePrefix"||Vt[1].type==="blockQuotePrefix"||Vt[1].type==="blockQuotePrefixWhitespace"||Vt[1].type==="blockQuoteMarker"||Vt[1].type==="listItemIndent"))break}Dr&&(!$t||Dr<$t)&&(zn._spread=!0),zn.end=Object.assign({},$t?T[$t][1].start:rt[1].end),T.splice($t||te,0,["exit",zn,rt[2]]),te++,Q++}if(rt[1].type==="listItemPrefix"){const tr={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};zn=tr,T.splice(te,0,["enter",tr,rt[2]]),te++,Q++,Dr=void 0,Fr=!0}}}return T[R][1]._spread=St,Q}function l(T,R){return Q;function Q(te){s.call(this,T(te),te),R&&R.call(this,te)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(T,R,Q){this.stack[this.stack.length-1].children.push(T),this.stack.push(T),this.tokenStack.push([R,Q||void 0]),T.position={start:ln(R.start),end:void 0}}function a(T){return R;function R(Q){T&&T.call(this,Q),u.call(this,Q)}}function u(T,R){const Q=this.stack.pop(),te=this.tokenStack.pop();if(te)te[0].type!==T.type&&(R?R.call(this,T,te[0]):(te[1]||kf).call(this,T,te[0]));else throw new Error("Cannot close `"+T.type+"` ("+pi({start:T.start,end:T.end})+"): it’s not open");Q.position.end=ln(T.end)}function d(){return Xu(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(T){if(this.data.expectingFirstListItemValue){const R=this.stack[this.stack.length-2];R.start=Number.parseInt(this.sliceSerialize(T),10),this.data.expectingFirstListItemValue=void 0}}function p(){const T=this.resume(),R=this.stack[this.stack.length-1];R.lang=T}function x(){const T=this.resume(),R=this.stack[this.stack.length-1];R.meta=T}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function h(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T.replace(/(\r?\n|\r)$/g,"")}function g(T){const R=this.resume(),Q=this.stack[this.stack.length-1];Q.label=R,Q.identifier=Tt(this.sliceSerialize(T)).toLowerCase()}function k(){const T=this.resume(),R=this.stack[this.stack.length-1];R.title=T}function C(){const T=this.resume(),R=this.stack[this.stack.length-1];R.url=T}function N(T){const R=this.stack[this.stack.length-1];if(!R.depth){const Q=this.sliceSerialize(T).length;R.depth=Q}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function I(T){const R=this.stack[this.stack.length-1];R.depth=this.sliceSerialize(T).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function z(T){const Q=this.stack[this.stack.length-1].children;let te=Q[Q.length-1];(!te||te.type!=="text")&&(te=px(),te.position={start:ln(T.start),end:void 0},Q.push(te)),this.stack.push(te)}function S(T){const R=this.stack.pop();R.value+=this.sliceSerialize(T),R.position.end=ln(T.end)}function j(T){const R=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=R.children[R.children.length-1];Q.position.end=ln(T.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(R.type)&&(z.call(this,T),S.call(this,T))}function O(){this.data.atHardBreak=!0}function U(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T}function G(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T}function W(){const T=this.resume(),R=this.stack[this.stack.length-1];R.value=T}function X(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=R,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function re(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=R,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function L(T){const R=this.sliceSerialize(T),Q=this.stack[this.stack.length-2];Q.label=WE(R),Q.identifier=Tt(R).toLowerCase()}function V(){const T=this.stack[this.stack.length-1],R=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const te=T.children;Q.children=te}else Q.alt=R}function y(){const T=this.resume(),R=this.stack[this.stack.length-1];R.url=T}function J(){const T=this.resume(),R=this.stack[this.stack.length-1];R.title=T}function ie(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function pe(T){const R=this.resume(),Q=this.stack[this.stack.length-1];Q.label=R,Q.identifier=Tt(this.sliceSerialize(T)).toLowerCase(),this.data.referenceType="full"}function oe(T){this.data.characterReferenceType=T.type}function K(T){const R=this.sliceSerialize(T),Q=this.data.characterReferenceType;let te;Q?(te=xg(R,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):te=Ju(R);const ce=this.stack[this.stack.length-1];ce.value+=te}function Ae(T){const R=this.stack.pop();R.position.end=ln(T.end)}function nt(T){S.call(this,T);const R=this.stack[this.stack.length-1];R.url=this.sliceSerialize(T)}function ue(T){S.call(this,T);const R=this.stack[this.stack.length-1];R.url="mailto:"+this.sliceSerialize(T)}function kt(){return{type:"blockquote",children:[]}}function vt(){return{type:"code",lang:null,meta:null,value:""}}function tn(){return{type:"inlineCode",value:""}}function Nn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function H(){return{type:"emphasis",children:[]}}function Se(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function wt(){return{type:"html",value:""}}function Tn(){return{type:"image",title:null,url:"",alt:null}}function Or(){return{type:"link",title:null,url:"",children:[]}}function uc(T){return{type:"list",ordered:T.type==="listOrdered",start:null,spread:T._spread,children:[]}}function cx(T){return{type:"listItem",spread:T._spread,checked:null,children:[]}}function dx(){return{type:"paragraph",children:[]}}function fx(){return{type:"strong",children:[]}}function px(){return{type:"text",value:""}}function hx(){return{type:"thematicBreak"}}}function ln(e){return{line:e.line,column:e.column,offset:e.offset}}function Ng(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ng(e,r):GE(e,r)}}function GE(e,t){let n;for(n in t)if(Ig.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 kf(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+pi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pi({start:t.start,end:t.end})+") is still open")}function YE(e){const t=this;t.parser=n;function n(r){return KE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function XE(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 JE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -12,7 +12,7 @@
12
12
  comments verbatim, so it survives the build. Do not remove or rename:
13
13
  `injectToken` throws without it, and the UI would 401 on every call. -->
14
14
  <!--agent-lens-bootstrap-->
15
- <script type="module" crossorigin src="/assets/index-CKKoKUCq.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-BTDb_lwM.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/assets/index-Chza4fL6.css">
17
17
  </head>
18
18
  <body style="background-color: #0b0b0e">