@cotal-ai/web 0.147.2 → 0.147.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,70 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FailedTip-DfF85PmB.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-BB9Crw5c.js","assets/dist-DktEa9vr.js","assets/core-Bfff_dYO.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,a as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m}from"./dist-BB9Crw5c.js";var h=e(t(),1),g=e=>e.kind===`msg`?`msg\u0001${e.channel}`:`dm\u0001${e.to}`;function _(e,t){if(e.view===`channel`)return{kind:`msg`,channel:e.channel};if(e.view!==`dm`)return;let n=t??void 0;if(e.with===void 0)return e.peer===n?void 0:{kind:`dm`,to:e.peer};if(e.peer===n)return{kind:`dm`,to:e.with};if(e.with===n)return{kind:`dm`,to:e.peer}}var v=`You'll show on the roster as operator when you post. Replies come to your DMs.`;function y(e){return e.mode===`participant`?v:e.reason===`This dashboard was started with --creds, which can only read.`?"Restart `cotal web` without `--creds` to post here.":``}function b(e){return/^[A-Za-z0-9_@%+=:,./-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}function x(e){return e.kind===`msg`?`cotal send msg ${b(e.channel)} "<text>"`:`cotal send dm ${b(e.to)} "<text>"`}function S(e,t){return t?{view:`dm`,peer:e,with:t}:{view:`dm`,peer:e}}function ee(e,t){if(e!==null)return e.mode===`off`?{text:`Read only`,title:e.reason}:t?{text:`On the roster`,title:`You show on the roster as operator once you post, so agents can reply to you.`}:{text:`Not on the roster`,title:v}}var te=class extends Error{status;error;constructor(e,t){super(t),this.status=e,this.error=t,this.name=`SendRefused`}};async function ne(e){let t=``;try{let n=await e.json();n&&typeof n.error==`string`&&(t=n.error)}catch{}return new te(e.status,t)}function re(e,t){let n=t instanceof te?t.status:void 0,r=(t instanceof te?t.error:t instanceof Error?t.message:String(t)).trim()||(n===void 0?`the request failed`:`HTTP ${n}`),i=/[.?!]$/.test(r)?r:`${r}.`;return`Couldn't post to ${e}. ${n===502?`The broker refused it: ${i}`:i} Your message is still here.`}var C=e(i(),1);async function ie(e,t){if(!e.ok){let n=``;try{let t=await e.json();t&&typeof t.error==`string`&&(n=`: ${t.error}`)}catch{}throw Error(`${t} refused with HTTP ${e.status}${n}`)}return e.json()}async function ae(e){let t=await Promise.all(e.map(async e=>{try{return{value:await e.read()}}catch(e){return{error:e}}})),n=[];for(let r=0;r<t.length;r++){let i=t[r];if(`error`in i){let t=i.error;n.push({kind:`refused`,name:e[r].name,reason:t&&t.message?t.message:String(i.error)})}else e[r].apply(i.value)}return n}function oe(e){if(!e.length)return``;let t=e.filter(e=>e.kind!==`partial`).map(e=>e.name),n=e.filter(e=>e.kind===`partial`).map(e=>e.name),r=[];return t.length&&r.push(`stale: ${t.join(`, `)}`),n.length&&r.push(`partial: ${n.join(`, `)}`),r.join(` · `)}var se=new Map;function ce(e,t){se.set(e,t)}function le(e){if(e.kind===`text`)return e.text;if(e.kind===`artifact`)return`[artifact ${e.name} (${e.mediaType}, ${e.size} bytes) ${e.digest}]`;if(e.kind===`data`){let t=JSON.stringify(e.data);return t===void 0?`[empty data part]`:t}let t=e.kind,n=se.has(t)?se.get(t):void 0;if(typeof n==`function`){let r;try{r=n(e)}catch(e){let n=e;return`[renderer for part kind ${JSON.stringify(t)} failed: ${n&&n.message?n.message:String(e)}]`}return typeof r==`string`?r:`[renderer for part kind ${JSON.stringify(t)} returned ${typeof r}, expected a string]`}let r=JSON.stringify(e.data);return r===void 0?`[unrenderable part kind ${JSON.stringify(t)} \u2014 no renderer for it on this surface]`:`[${t}] ${r}`}function w(e){return(e||[]).map(e=>le(e)).join(` `)}function T(e){if(typeof e!=`object`||!e)return;let t=e;if(t.type!==`CUSTOM`||t.name!==`cotal.toolResult`)return;let n=t.value;if(typeof n!=`object`||!n||Array.isArray(n))return;let r=Object.keys(n);if(r.length!==2||!r.includes(`toolCallId`)||!r.includes(`isError`))return;let i=n;if(typeof i.toolCallId==`string`&&typeof i.isError==`boolean`)return{toolCallId:i.toolCallId,isError:i.isError}}function E(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=new Date(e);return Number.isNaN(t.getTime())?void 0:t}var ue=e=>`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`,D=e=>{let t=E(e);return t&&ue(t)},de=2e3,fe=`ag-ui.frame`,O=e=>typeof e==`string`?e:void 0,pe=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,me=class{label;constructor(e){this.label=e}};function he(e,t){if(typeof e.id!=`string`)return[];let n=Array.isArray(e.parts)?e.parts:[],r=[];for(let i of n){if(typeof i!=`object`||!i||i.kind!==fe)continue;let n=i.events,a=r.length===0?e.id:`${e.id}#${r.length}`;r.push({id:a,ts:e.ts,events:Array.isArray(n)&&n.length>0?n:[new me(`A frame with no events`)],live:t})}return r.length>0?r:[{id:e.id,ts:e.ts,events:[new me(w(n))],live:t}]}function ge(e){let t=e.lastIndexOf(`__`);return t<0?e:e.slice(t+2)}var k=new Map([[`Bash`,`command`],[`Edit`,`edit`],[`MultiEdit`,`edit`],[`NotebookEdit`,`edit`],[`Write`,`write`],[`Read`,`read`],[`cotal_send`,`send`],[`cotal_dm`,`dm`],[`cotal_inbox`,`inbox`]]);function _e(e){return k.get(e)??`other`}function A(e){let t=/^events\.([A-Za-z0-9_]+)\.([A-Za-z0-9_]+)$/.exec(e);return t?`${t[1]}.${t[2]}`:void 0}function ve(e){let t=0;for(let n of e)t+=n.events.length;return t}var j=new Map([[`human`,`prompt`],[`sdk`,`prompt`],[`channel`,`mesh`],[`auto-continuation`,`continuation`],[`notification`,`notification`]]);function ye(e){let t=e.cotal,n=typeof t==`object`&&t?O(t.turnSource):void 0;return n===void 0?void 0:j.get(n)}function be(e){let t=[],n=new Map,r=new Map,i=new Map,a=!1,o=(e,t,n,r,i)=>{let a=e.get(t);if(a!==void 0)return a.at=r,a.live=a.live&&i,a;let o={text:``,user:!1,key:n,at:r,live:i};return e.set(t,o),o},s=(e,t,n,r,i)=>{let a=o(e,t,n,r,i);return a.text=``,a.user=!1,a.key=n,a.live=i,a},c=(e,n,r,i,a,o=!0)=>{let s=e.get(n);if(e.delete(n),s===void 0||s.text.length===0)return;let c=r===`said`&&s.user?`prompt`:r;t.push({item:{kind:c,key:s.key,text:s.text,cut:i},at:a??s.at,live:s.live&&o})},l=()=>{for(let e of[...n.keys()])c(n,e,`said`,!0);for(let e of[...r.keys()])c(r,e,`reasoning`,!0)};for(let u of e){let e=pe(u.ts);u.events.forEach((d,f)=>{let p=`${u.id}:${f}`,m=u.live;if(d instanceof me){t.push({item:{kind:`unknown`,key:p,label:d.label,ts:e},at:e,live:m});return}let h=d,g=typeof h==`object`&&!!h,_=g?O(h.type):void 0,v=(g?pe(h.timestamp):void 0)??e;switch((_===`RUN_STARTED`||_===`RUN_FINISHED`||_===`RUN_ERROR`)&&l(),_){case`RUN_STARTED`:{let e=ye(h);t.push({item:{kind:`turn`,key:p,ts:v,...e?{source:e}:{}},at:v,live:m});break}case`RUN_FINISHED`:t.push({item:{kind:`turnEnd`,key:p,ts:v},at:v,live:m});break;case`RUN_ERROR`:t.push({item:{kind:`runError`,key:p,ts:v},at:v,live:m});break;case`TEXT_MESSAGE_START`:s(n,O(h.messageId)??``,p,v,m).user=O(h.role)===`user`;break;case`TEXT_MESSAGE_CONTENT`:{let e=o(n,O(h.messageId)??``,p,v,m);e.text+=O(h.delta)??``;break}case`TEXT_MESSAGE_END`:c(n,O(h.messageId)??``,`said`,!1,v,m);break;case`REASONING_MESSAGE_START`:s(r,O(h.messageId)??``,p,v,m);break;case`REASONING_MESSAGE_CONTENT`:{let e=o(r,O(h.messageId)??``,p,v,m);e.text+=O(h.delta)??``;break}case`REASONING_MESSAGE_END`:c(r,O(h.messageId)??``,`reasoning`,!1,v,m);break;case`TOOL_CALL_START`:{let e=O(h.toolCallName)??`?`,n=ge(e),r={key:p,id:O(h.toolCallId)??``,name:n,full:e,kind:_e(n),...v===void 0?{}:{ts:v},live:m};r.id!==``&&i.set(r.id,r),t.push({call:r,at:v,live:m});break}case`TOOL_CALL_END`:case`TOOL_CALL_ARGS`:case`TOOL_CALL_RESULT`:break;case`CUSTOM`:{let e=T(h);if(e!==void 0){a=!0;let t=i.get(e.toolCallId);t!==void 0&&(v!==void 0&&(t.end=v),t.failed=e.isError,t.live=t.live&&m);break}t.push({item:{kind:`unknown`,key:p,label:`Custom event ${O(h.name)===void 0?`(unnamed)`:JSON.stringify(h.name)}`,ts:v},at:v,live:m});break}default:t.push({item:{kind:`unknown`,key:p,label:`Unrecognised event ${JSON.stringify(_??null)}`,ts:v},at:v,live:m})}})}return l(),{flat:t,marked:a}}function xe(e,t){return e.filter(e=>t(e.msg)).map((e,t)=>({msg:e.msg,i:t,at:pe(e.msg.ts)})).sort((e,t)=>(e.at??1/0)-(t.at??1/0)||e.i-t.i).map(({msg:e,at:t})=>({msg:e,at:t}))}function Se(e,t){let n=(e,t)=>e!==void 0&&t!==void 0&&e<t,r=[],i=0;for(let a of e){for(;i<t.length&&n(t[i].at,a.at);)r.push(t[i++]);r.push(a)}for(;i<t.length;)r.push(t[i++]);return r}function Ce(e,t){let{flat:n,marked:r}=be(e),i=xe(t,e=>typeof e.channel==`string`||typeof e.to==`string`).map(({msg:e,at:t})=>({post:{kind:`post`,key:`post:${e.id}`,msg:e,...typeof e.channel==`string`?{channel:e.channel}:{to:e.to},live:!0},at:t})),a=[],o,s,c=e=>{s=void 0,(o?.steps??a).push(e)},l=(e,t,n)=>{o!==void 0&&(o.outcome=e,t!==void 0&&(o.end=t),o.live=o.live&&n,o=void 0)};for(let e of Se(n,i)){if(`post`in e){c(e.post);continue}if(`call`in e){if(s!==void 0)s.calls.push(e.call),s.live=s.live&&e.call.live;else{let t={kind:`tools`,key:e.call.key,calls:[e.call],live:e.call.live};c(t),s=t}continue}let t=e.item;switch(t.kind){case`turn`:s=void 0,o!==void 0&&(o.superseded=!0),o={kind:`turn`,key:t.key,...t.ts===void 0?{}:{start:t.ts},outcome:`open`,superseded:!1,...t.source?{source:t.source}:{},steps:[],live:e.live},a.push(o);break;case`turnEnd`:s=void 0,o===void 0?a.push({kind:`turnEnd`,key:t.key,...t.ts===void 0?{}:{ts:t.ts},live:e.live}):l(`finished`,t.ts,e.live);break;case`runError`:c({kind:`runError`,key:t.key,...t.ts===void 0?{}:{ts:t.ts},live:e.live}),l(`failed`,t.ts,e.live);break;case`said`:case`prompt`:case`reasoning`:c({...t,...e.at===void 0?{}:{ts:e.at},live:e.live});break;case`unknown`:c({...t,live:e.live})}}let u=a.some(e=>e.kind===`turn`&&e.outcome!==`open`&&e.steps.some(e=>e.kind===`tools`));return{items:a,toolStatus:r||!u}}function we(e,t){if(e.failed!==void 0)return e.failed?`failed`:`done`;if(!t.toolStatus||!t.trailing)return`called`;let n=t.turn;return n===void 0||n.outcome!==`open`||n.superseded?`noResult`:t.status===`working`?`running`:t.status===`waiting`?`pending`:`noResult`}var Te={command:{title:{running:`Running a command`,done:`Ran a command`,failed:`A command failed`,pending:`A command hasn't finished`,noResult:`No result arrived for a command`},one:`ran a command`,many:`ran # commands`,noun:[`command`,`commands`]},edit:{title:{running:`Editing a file`,done:`Edited a file`,failed:`An edit failed`,pending:`An edit hasn't finished`,noResult:`No result arrived for an edit`},one:`made an edit`,many:`made # edits`,noun:[`edit`,`edits`]},write:{title:{running:`Writing a file`,done:`Wrote a file`,failed:`A write failed`,pending:`A write hasn't finished`,noResult:`No result arrived for a write`},one:`wrote a file`,many:`wrote # times`,noun:[`write`,`writes`]},read:{title:{running:`Reading a file`,done:`Read a file`,failed:`A read failed`,pending:`A read hasn't finished`,noResult:`No result arrived for a read`},one:`read a file`,many:`read # times`,noun:[`read`,`reads`]},send:{title:{running:`Sending a message`,done:`Sent a message`,failed:`A message failed`,pending:`A message hasn't finished`,noResult:`No result arrived for a message`},one:`sent a message`,many:`sent # messages`,noun:[`message`,`messages`]},dm:{title:{running:`Sending a direct message`,done:`Sent a direct message`,failed:`A direct message failed`,pending:`A direct message hasn't finished`,noResult:`No result arrived for a direct message`},one:`sent a direct message`,many:`sent # direct messages`,noun:[`direct message`,`direct messages`]},inbox:{title:{running:`Checking the inbox`,done:`Checked the inbox`,failed:`An inbox check failed`,pending:`An inbox check hasn't finished`,noResult:`No result arrived for an inbox check`},one:`checked the inbox`,many:`checked the inbox # times`,noun:[`inbox check`,`inbox checks`]},other:{title:{running:`Using a tool`,done:`Used a tool`,failed:`A tool call failed`,pending:`A tool call hasn't finished`,noResult:`No result arrived for a tool call`},one:`called a tool`,many:`called # tools`,noun:[`tool call`,`tool calls`]}},Ee={one:`called another tool`,many:`called # other tools`},De=e=>e.charAt(0).toUpperCase()+e.slice(1),Oe=(e,t)=>t===1?e.one:e.many.replace(`#`,String(t)),ke=(e,t,n)=>`${e} ${e===1?t:n}`;function Ae(e,t=64){let n=Array.from(e);return n.length>t?`${n.slice(0,t).join(``)}…`:e}function je(e,t,n){return t===`called`?`Called ${Ae(n)}`:Te[e].title[t]}function Me(e,t){let n=e.filter(e=>e.failed===!0).length;if(!t){let t=e.map(e=>Ae(e.name));return{title:`Called ${t.length<2?t.join(``):`${t.slice(0,-1).join(`, `)} and ${t.at(-1)}`}`,failed:n}}let r=new Map;for(let t of e)r.set(t.kind,(r.get(t.kind)??0)+1);let i=r.size>1;return{title:De([...r].map(([e,t])=>Oe(e===`other`&&i?Ee:Te[e],t)).join(`, `)),failed:n}}var Ne=e=>e.steps.flatMap(e=>e.kind===`tools`?e.calls:[]);function Pe(e,t,n){let r=(e,t)=>e===void 0||t===void 0?void 0:ze(t-e,!1),i=(e,t,n)=>t===void 0?n:`${e} ${t}`,a;a=e.outcome===`finished`?i(`Worked for`,r(e.start,e.end),`Worked`):e.outcome===`failed`?i(`Turn failed after`,r(e.start,e.end),`Turn failed`):e.superseded||t!==`working`&&t!==`waiting`?`No end arrived for this turn`:t===`working`?i(`Working for`,r(e.start,n),`Working`):i(`Open for`,r(e.start,n),`Turn open`);let o=Ne(e).filter(e=>e.failed===!0);if(o.length===0)return{title:a};let[s,c]=new Set(o.map(e=>e.kind)).size===1?Te[o[0].kind].noun:[`call`,`calls`];return{title:a,failed:`${ke(o.length,s,c)} failed`}}var Fe={prompt:`started by a prompt`,mesh:`started by a message from the mesh`,continuation:`started by the harness continuing itself`,notification:`started by a notification`};function Ie(e){let t=[],n=D(e.start),r=D(e.end);e.outcome===`open`?n!==void 0&&t.push(`since ${n}`):n!==void 0&&r!==void 0&&t.push(n===r?n:`${n} to ${r}`),e.source!==void 0&&t.push(Fe[e.source]);let i=0;for(let t of e.steps)t.kind===`tools`?i+=t.calls.length:(t.kind===`said`||t.kind===`prompt`||t.kind===`reasoning`||t.kind===`post`)&&i++;t.push(ke(i,`step`,`steps`));let a=e.steps.find(e=>e.kind===`post`&&e.channel!==void 0);return a?.kind===`post`&&t.push(`posted in #${a.channel}`),t.join(` · `)}function Le(e,t,n){let r=D(e.ts);if(t===`called`)return r??``;let i;i=t===`done`||t===`failed`?e.ts===void 0||e.end===void 0?void 0:ze(e.end-e.ts,!0):t===`running`?e.ts===void 0?void 0:ze(n-e.ts,!1):r===void 0?void 0:`started ${r}`;let a=Ae(e.name);return i===void 0?a:`${a} · ${i}`}function Re(e,t){if(t){let t=ke(e.length,`step`,`steps`),n=e.length>0&&e.every(e=>e.ts!==void 0&&e.end!==void 0)?ze(Math.max(...e.map(e=>e.end))-e[0].ts,!0):void 0;return n===void 0?t:`${t} · ${n}`}let n=ke(e.length,`call`,`calls`),r=D(e[0]?.ts),i=D(e.at(-1)?.ts),a=r===void 0?i:i===void 0||i===r?r:`${r} to ${i}`;return a===void 0?n:`${n} · ${a}`}function ze(e,t){if(!Number.isFinite(e)||e<0)return;let n=Math.floor(e/1e3);return n<60?t?`${(Math.floor(e/100)/10).toFixed(1)}s`:`${n}s`:n<3600?`${Math.floor(n/60)}m ${n%60}s`:`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`}var Be=[`work`,`messages`,`profile`],Ve=e=>Be.includes(e),M={view:`activity`},He={view:`topology`},Ue=/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/;function We(e){try{return decodeURIComponent(e)}catch{return}}function Ge(e){let t=e.replace(/^#/,``).split(`/`);if(t[0]!==``)return;let[,n,r,i,a,...o]=t;if(!(o.length>0||a!==void 0&&n!==`agent`))switch(n){case`channel`:{if(!r||i!==void 0)return;let e=We(r);if(!e)return;let t=A(e);return t?{view:`agent`,id:t,tab:`work`}:{view:`channel`,channel:e}}case`agent`:{if(!r)return;let e=We(r);if(!e||!Ue.test(e))return;if(i===void 0)return{view:`agent`,id:e,tab:`work`};if(a===void 0){if(Ve(i))return{view:`agent`,id:e,tab:i};let t=i===``?void 0:We(i);return t?{view:`agent`,id:e,tab:`work`,at:t}:void 0}if(i!==`work`)return;let t=a===``?void 0:We(a);return t?{view:`agent`,id:e,tab:`work`,at:t}:void 0}case`dm`:{if(!r)return;let e=We(r);if(!e)return;if(i===void 0)return{view:`dm`,peer:e};let t=i===``?void 0:We(i);return t?{view:`dm`,peer:e,with:t}:void 0}case`agents`:return i===void 0?r===void 0||r===`status`?{view:`agents`,group:`status`}:r===`host`?{view:`agents`,group:`host`}:void 0:void 0;case`activity`:case`topology`:case`needs`:return r===void 0?{view:n}:void 0;default:return}}function Ke(e,t){return Ge(e)??(t===`/graph`?He:M)}function qe(e){switch(e.view){case`channel`:return`#/channel/${encodeURIComponent(e.channel)}`;case`dm`:return`#/dm/${encodeURIComponent(e.peer)}${e.with===void 0?``:`/${encodeURIComponent(e.with)}`}`;case`agents`:return e.group===`status`?`#/agents`:`#/agents/${e.group}`;case`agent`:{let t=`#/agent/${encodeURIComponent(e.id)}`;return e.at===void 0?e.tab===`work`?t:`${t}/${e.tab}`:`${t}/work/${encodeURIComponent(e.at)}`}default:return`#/${e.view}`}}function Je(e){return Ke(e.location.hash,e.location.pathname)}function N(e,t){let n=()=>t(Je(e));return e.addEventListener(`hashchange`,n),()=>e.removeEventListener(`hashchange`,n)}function Ye(e,t){if(t.view!==`agent`)return;let n=qe(t);e.location.hash!==n&&e.history.replaceState(null,``,n)}function Xe(e,t){e.location.hash=qe(t)}function Ze(e){let t=new Map;for(let n of e)n.card?.id&&t.set(n.card.id,n.card.name);return t}var Qe=`operator (you)`;function $e(e,t,n){if(!e)return`?`;if(n&&(typeof e==`object`?e.id:e)===n&&!t.has(n))return Qe;if(typeof e==`object`)return $e(e.id,t);let r=t.get(e);if(r!==void 0)return r;let i=/^([A-Za-z0-9_]+)\.([A-Za-z0-9_]+)$/.exec(e);return i&&i[2].length>=32?`${i[1]}.${i[2].slice(0,6)}…`:/^[A-Z2-7]{32,}$/.test(e)?e.slice(0,6)+`…`:e}var et=``,tt=(e,t)=>[e,t].sort().join(et);function nt(e){let t=new Map;for(let n of e){let e=n.senderId??n.msg.from?.id,r=typeof n.msg.to==`string`?n.msg.to:void 0;if(!e||!r||e===r)continue;let i=[e,r].sort(),a=i.join(et),o=t.get(a);o||t.set(a,o={parts:i,messages:[]}),o.messages.push(n)}let n=[];for(let[e,{parts:r,messages:i}]of t){i.sort((e,t)=>e.msg.ts-t.msg.ts);let t=i[0];n.push({key:e,parts:r,opener:t.senderId??t.msg.from?.id??r[0],messages:i,last:i[i.length-1]?.msg.ts??0,verified:i.every(e=>e.senderId!==void 0)})}return n}function rt(e){return nt(e).sort((e,t)=>t.last-e.last)}function it(e,t){let n=Ze(t),r=new Map;for(let e of t)e.card?.id&&r.set(e.card.id,e);let i=e=>r.get(e)?.status??`offline`,a=new Map;for(let{key:t,parts:n,messages:r,last:i,verified:o}of nt(e))for(let e of n){let s=n[0]===e?n[1]:n[0],c=a.get(e);c||a.set(e,c={id:e,conversations:[],last:0}),c.conversations.push({key:t,with:s,messages:r,last:i,verified:o}),c.last=Math.max(c.last,i)}return[...a.values()].map(e=>({id:e.id,name:$e(e.id,n),role:r.get(e.id)?.card?.role,status:i(e.id),conversations:e.conversations.sort((e,t)=>t.last-e.last),threads:e.conversations.length,last:e.last})).sort((e,t)=>t.last-e.last)}var at=[`waiting`,`working`,`idle`,`offline`],P=(e,t)=>{let n=e?.[t];return typeof n==`string`?n:void 0},ot=e=>{let t=P(e,`ai.cotal.events`);return t===`on`||t===`off`?{events:t}:{}},st=e=>{let t=at.indexOf(e);return t===-1?at.length:t};function ct(e,t={}){return e.filter(e=>t.includeOffline||e.status!==`offline`).sort((e,t)=>st(e.status)-st(t.status)||e.card.name.localeCompare(t.card.name)).map(e=>({id:e.card.id,name:e.card.name,role:e.card.role,status:e.status,activity:e.activity,harness:P(e.card.meta,`connector`),host:P(e.card.meta,`host`),attention:e.attention,model:P(e.card.meta,`model`),ts:e.ts,statusSince:e.statusSince,condition:e.condition,activitySince:e.activitySince,activeAt:e.activeAt,...ot(e.card.meta)}))}var lt=e=>e.filter(e=>e.status===`waiting`);function ut(e){let t=e.filter(e=>e.status!==`offline`&&typeof e.ts==`number`).map(e=>e.ts);return t.length?Math.min(...t):void 0}var dt=e=>e.status;function ft(e){if(!e||e.fresh)return;if(e.state===`unpopulated`)return{kind:`refused`,name:`roster`,reason:`observer presence snapshot still loading`};let t={kind:`refused`,name:`roster`,reason:`observer presence watch silent since ${Number.isFinite(e.staleSince)?new Date(e.staleSince).toISOString():`unknown`}`};return Number.isFinite(e.staleSince)?{...t,since:e.staleSince}:t}function pt(e,t){let n=()=>t(e.get());return(0,h.useSyncExternalStore)(e.subscribe,n,n)}var F=a(),mt=()=>globalThis.document,ht=`a[href], button, input, select, textarea, [tabindex]`;function gt({onEscape:e,children:t}){let n=(0,h.useRef)(null),r=(0,h.useRef)(e);return r.current=e,(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=mt(),i=t.activeElement,a=()=>Array.from(e.querySelectorAll(ht)).filter(e=>!e.hasAttribute(`disabled`)&&e.tabIndex>=0);a()[0]?.focus();let o=n=>{if(n.key===`Escape`){n.preventDefault(),r.current();return}if(n.key!==`Tab`)return;let i=a();if(i.length===0)return n.preventDefault();let o=i[0],s=i[i.length-1],c=t.activeElement;(!e.contains(c)||n.shiftKey&&c===o||!n.shiftKey&&c===s)&&(n.preventDefault(),(n.shiftKey?s:o).focus())};return t.addEventListener(`keydown`,o),()=>{t.removeEventListener(`keydown`,o),i?.focus?.()}},[]),(0,F.jsx)(`div`,{ref:n,style:{display:`contents`},children:t})}var _t=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 8V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 15.75H12M12.25 15.75C12.25 15.8881 12.1381 16 12 16C11.8619 16 11.75 15.8881 11.75 15.75C11.75 15.6119 11.8619 15.5 12 15.5C12.1381 15.5 12.25 15.6119 12.25 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],vt=[[`path`,{d:`M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],yt=[[`path`,{d:`M12 5.5V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 11C18 11 13.5811 5.00001 12 5C10.4188 4.99999 6 11 6 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],bt=[[`path`,{d:`M9 6.65032C9 6.65032 15.9383 6.10759 16.9154 7.08463C17.8924 8.06167 17.3496 15 17.3496 15M16.5 7.5L6.5 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],xt=[[`path`,{d:`M15.6 8.40033V12.9003C15.6 14.3915 16.8088 15.6003 18.3 15.6003C19.7912 15.6003 21 14.3915 21 12.9003V12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C14.0265 21 15.8965 20.3302 17.4009 19.2M15.6 12.0003C15.6 13.9886 13.9882 15.6003 12 15.6003C10.0118 15.6003 8.4 13.9886 8.4 12.0003C8.4 10.0121 10.0118 8.40033 12 8.40033C13.9882 8.40033 15.6 10.0121 15.6 12.0003Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}]],St=[[`path`,{d:`M4.22222 21.9948V18.4451C4.22222 17.1737 3.88927 16.5128 3.23482 15.4078C2.4503 14.0833 2 12.5375 2 10.8866C2 5.97866 5.97969 2 10.8889 2C15.7981 2 19.7778 5.97866 19.7778 10.8866C19.7778 11.4663 19.7778 11.7562 19.802 11.9187C19.8598 12.3072 20.0411 12.6414 20.2194 12.9873L22 16.4407L20.6006 17.1402C20.195 17.3429 19.9923 17.4443 19.851 17.6314C19.7097 17.8184 19.67 18.0296 19.5904 18.4519L19.5826 18.4931C19.4004 19.4606 19.1993 20.5286 18.6329 21.2024C18.4329 21.4403 18.1853 21.6336 17.9059 21.7699C17.4447 21.9948 16.8777 21.9948 15.7437 21.9948C15.219 21.9948 14.6928 22.0069 14.1682 21.9942C12.9247 21.9639 12 20.9184 12 19.7044`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.388 10.5315C13.9617 10.5315 13.5729 10.3702 13.2784 10.1048M14.388 10.5315C14.388 11.6774 13.7241 12.7658 12.4461 12.7658C11.1681 12.7658 10.5043 13.8541 10.5043 15M14.388 10.5315C16.5373 10.5315 16.5373 7.18017 14.388 7.18017C14.1927 7.18017 14.0053 7.21403 13.8312 7.27624C13.9362 4.77819 10.3349 4.1 9.51923 6.44018M10.5043 8.29729C10.5043 7.52323 10.1133 6.8411 9.51923 6.44018M9.51923 6.44018C7.66742 5.19034 5.19883 7.4331 6.37324 9.43277C4.40226 9.72827 4.61299 12.7658 6.6205 12.7658C7.18344 12.7658 7.68111 12.4844 7.98234 12.0538`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Ct=[[`path`,{d:`M12 21.5C17.2467 21.5 21.5 17.2467 21.5 12C21.5 6.75329 17.2467 2.5 12 2.5C6.75329 2.5 2.5 6.75329 2.5 12C2.5 13.3377 2.66372 14.5604 3.1189 15.6954C3.81756 17.4374 3.68195 18.9241 2.5 20.5C3.86146 21.1644 5.86811 21.1419 7 20.0725C8.45323 20.9748 10.1636 21.5 12 21.5Z`,stroke:`currentColor`,strokeLinecap:`square`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.2 12.0002H12M7.69961 11.9999H7.49961M16.6996 11.9999H16.4996M12.4 12.0002C12.4 12.2212 12.2209 12.4002 12 12.4002C11.7791 12.4002 11.6 12.2212 11.6 12.0002C11.6 11.7793 11.7791 11.6002 12 11.6002C12.2209 11.6002 12.4 11.7793 12.4 12.0002ZM7.89961 11.9999C7.89961 12.2208 7.72052 12.3999 7.49961 12.3999C7.2787 12.3999 7.09961 12.2208 7.09961 11.9999C7.09961 11.7789 7.2787 11.5999 7.49961 11.5999C7.72052 11.5999 7.89961 11.7789 7.89961 11.9999ZM16.8996 11.9999C16.8996 12.2208 16.7205 12.3999 16.4996 12.3999C16.2787 12.3999 16.0996 12.2208 16.0996 11.9999C16.0996 11.7789 16.2787 11.5999 16.4996 11.5999C16.7205 11.5999 16.8996 11.7789 16.8996 11.9999Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],wt=[[`path`,{d:`M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.9994 15L12 12.0003M12 12.0003L9 9M12 12.0003L9.00064 15M12 12.0003L15 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Tt=[[`path`,{d:`M14 4H10C6.22876 4 4.34315 4 3.17157 5.17157C2 6.34315 2 8.22876 2 12C2 15.7712 2 17.6569 3.17157 18.8284C4.34315 20 6.22876 20 10 20H14C17.7712 20 19.6569 20 20.8284 18.8284C22 17.6569 22 15.7712 22 12C22 8.22876 22 6.34315 20.8284 5.17157C19.6569 4 17.7712 4 14 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 9L8.83981 10.5858C9.61327 11.2525 10 11.5858 10 12C10 12.4142 9.61327 12.7475 8.83981 13.4142L7 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 16H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],I=[[`path`,{d:`M7.5 14.5C7.5 11.2002 7.5 9.55025 8.52513 8.52513C9.55025 7.5 11.2002 7.5 14.5 7.5C17.7998 7.5 19.4497 7.5 20.4749 8.52513C21.5 9.55025 21.5 11.2002 21.5 14.5C21.5 17.7998 21.5 19.4497 20.4749 20.4749C19.4497 21.5 17.7998 21.5 14.5 21.5C11.2002 21.5 9.55025 21.5 8.52513 20.4749C7.5 19.4497 7.5 17.7998 7.5 14.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7.5 16.5C6.10355 16.5 5.40533 16.5 4.84402 16.3036C3.83866 15.9518 3.0482 15.1613 2.69641 14.156C2.5 13.5947 2.5 12.8964 2.5 11.5V9.5C2.5 6.20017 2.5 4.55025 3.52513 3.52513C4.55025 2.5 6.20017 2.5 9.5 2.5H11.5C12.8964 2.5 13.5947 2.5 14.156 2.69641C15.1613 3.0482 15.9518 3.83866 16.3036 4.84402C16.5 5.40533 16.5 6.10355 16.5 7.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Et=[[`path`,{d:`M8 7L16 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 11L12 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],L=[[`path`,{d:`M13 20.8268V22H14.1734C14.5827 22 14.7874 22 14.9715 21.9238C15.1555 21.8475 15.3003 21.7028 15.5897 21.4134L20.4133 16.5894C20.6864 16.3164 20.8229 16.1799 20.8959 16.0327C21.0347 15.7525 21.0347 15.4236 20.8959 15.1434C20.8229 14.9961 20.6864 14.8596 20.4133 14.5866C20.1403 14.3136 20.0038 14.1771 19.8565 14.1041C19.5763 13.9653 19.2473 13.9653 18.9671 14.1041C18.8198 14.1771 18.6833 14.3136 18.4103 14.5866L18.4103 14.5866L13.5867 19.4106C13.2972 19.7 13.1525 19.8447 13.0762 20.0287C13 20.2128 13 20.4174 13 20.8268Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19 11C19 11 19 9.4306 18.8478 9.06306C18.6955 8.69552 18.4065 8.40649 17.8284 7.82843L13.0919 3.09188C12.593 2.593 12.3436 2.34355 12.0345 2.19575C11.9702 2.165 11.9044 2.13772 11.8372 2.11401C11.5141 2 11.1614 2 10.4558 2C7.21082 2 5.58831 2 4.48933 2.88607C4.26731 3.06508 4.06508 3.26731 3.88607 3.48933C3 4.58831 3 6.21082 3 9.45584V14C3 17.7712 3 19.6569 4.17157 20.8284C5.23467 21.8915 6.8857 21.99 10 21.9991M12 2.5V3C12 5.82843 12 7.24264 12.8787 8.12132C13.7574 9 15.1716 9 18 9H18.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Dt=[[`path`,{d:`M14 21L18 3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6 21L10 3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5 8H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 16H19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Ot=[[`path`,{d:`M4 3H20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.5 3V5.03039C5.5 6.27227 6.07682 7.4437 7.06116 8.20089L12 12L16.9388 8.20089C17.9232 7.44371 18.5 6.27227 18.5 5.03039V3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5.5 21V18.9696C5.5 17.7277 6.07682 16.5563 7.06116 15.7991L12 12L16.9388 15.7991C17.9232 16.5563 18.5 17.7277 18.5 18.9696V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M4 21H20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],kt=[[`path`,{d:`M7 2.5C5.59269 2.66536 4.62427 3.01488 3.89124 3.75363C2.5 5.15575 2.5 7.41242 2.5 11.9258C2.5 16.4391 2.5 18.6958 3.89124 20.0979C5.28249 21.5 7.52166 21.5 12 21.5C16.4783 21.5 18.7175 21.5 20.1088 20.0979C21.5 18.6958 21.5 16.4391 21.5 11.9258C21.5 7.41242 21.5 5.15575 20.1088 3.75363C19.3757 3.01488 18.4073 2.66536 17 2.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 8C9.99153 8.5057 11.2998 10.5 12 10.5M14.5 8C14.0085 8.5057 12.7002 10.5 12 10.5M12 10.5V2.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M21.5 13.5H16.5743C15.7322 13.5 15.0706 14.2036 14.6995 14.9472C14.2963 15.7551 13.4889 16.5 12 16.5C10.5111 16.5 9.70373 15.7551 9.30054 14.9472C8.92942 14.2036 8.26777 13.5 7.42566 13.5H2.5`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],At=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 16V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 8.25H12M12.25 8.25C12.25 8.11193 12.1381 8 12 8C11.8619 8 11.75 8.11193 11.75 8.25C11.75 8.38807 11.8619 8.5 12 8.5C12.1381 8.5 12.25 8.38807 12.25 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],jt=[[`path`,{d:`M12 3V6`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 18V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M21 12L18 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M6 12L3 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M18.3635 5.63672L16.2422 7.75804`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M7.75804 16.2422L5.63672 18.3635`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M18.3635 18.3635L16.2422 16.2422`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`6`}],[`path`,{d:`M7.75804 7.75804L5.63672 5.63672`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`7`}]],Mt=[[`path`,{d:`M21.9598 12.9919C21.6856 17.2342 18.3536 20.6134 14.1706 20.8915C13.4574 20.9389 12.7285 21.001 12 21.001C10.4054 21.001 8.95127 20.8637 7.44544 20.2902C7.44544 20.2902 5.56108 21.7589 3.69962 21.4587C3.31009 21.3959 3.11532 21.3644 3.00091 21.1343C2.8865 20.9042 3.00788 20.6756 3.25063 20.2185C3.65964 19.4483 3.92248 18.6737 3.80076 17.8306C3.73703 17.3892 3.50433 16.9974 3.27644 16.6136L3.26529 16.5948C2.62637 15.5188 2.12462 14.2975 2.04024 12.9919C1.98659 12.1617 1.98659 11.3019 2.04024 10.4717C2.31441 6.22935 5.64639 2.85011 9.8294 2.57205C11.2536 2.47738 12.7435 2.47719 14.1706 2.57205C18.3536 2.85011 21.6856 6.22935 21.9598 10.4717C22.0134 11.3019 22.0134 12.1617 21.9598 12.9919Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8.75 14.501H15.25M8.75 9.50098H12.25`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Nt=[[`path`,{d:`M21.5 14.0784C20.3003 14.7189 18.9301 15.0821 17.4751 15.0821C12.7491 15.0821 8.91792 11.2509 8.91792 6.52485C8.91792 5.06986 9.28105 3.69968 9.92163 2.5C5.66765 3.49698 2.5 7.31513 2.5 11.8731C2.5 17.1899 6.8101 21.5 12.1269 21.5C16.6849 21.5 20.503 18.3324 21.5 14.0784Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Pt=[[`path`,{d:`M15.5 18C15.5 19.933 13.933 21.5 12 21.5C10.067 21.5 8.5 19.933 8.5 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2 2L22 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M21 16.2311C21 15.762 20.8136 15.3121 20.4819 14.9803L19.8787 14.3771C19.3161 13.8145 19 13.0514 19 12.2558V9.5C19 5.634 15.866 2.5 12 2.5C10.4497 2.5 9.01706 3.00399 7.85707 3.85707M4.76887 18C3.79195 18 3 17.208 3 16.2311C3 15.762 3.18636 15.3121 3.51809 14.9803L4.12132 14.3771C4.68393 13.8145 5 13.0514 5 12.2558V9.5C5 8.20839 5.34981 6.99849 5.95987 5.95987L18 18H4.76887Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Ft=[[`path`,{d:`M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.4999 12.5L14.9999 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],It=[[`path`,{d:`M2 12C2 8.3109 2 6.46633 2.81382 5.1588C3.1149 4.67505 3.48891 4.2543 3.91891 3.91557C5.08116 3.00003 6.72077 3.00003 10 3.00003H14C17.2792 3.00003 18.9188 3.00003 20.0811 3.91557C20.5111 4.2543 20.8851 4.67505 21.1862 5.1588C22 6.46633 22 8.3109 22 12C22 15.6892 22 17.5337 21.1862 18.8413C20.8851 19.325 20.5111 19.7458 20.0811 20.0845C18.9188 21 17.2792 21 14 21H10C6.72077 21 5.08116 21 3.91891 20.0845C3.48891 19.7458 3.1149 19.325 2.81382 18.8413C2 17.5337 2 15.6892 2 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.5 3.00003L14.5 21`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M18 7.00006H19M18 10.0001H19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Lt=[[`path`,{d:`M12 14.5V17.5M13 14.5C13 15.0523 12.5523 15.5 12 15.5C11.4477 15.5 11 15.0523 11 14.5C11 13.9477 11.4477 13.5 12 13.5C12.5523 13.5 13 13.9477 13 14.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.5 9V6.5C16.5 4.01472 14.4853 2 12 2C9.51471 2 7.49999 4.01472 7.49999 6.5V9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M4.2678 18.8447C4.49268 20.515 5.87612 21.8235 7.55965 21.9009C8.97627 21.966 10.4153 22 12 22C13.5847 22 15.0237 21.966 16.4403 21.9009C18.1239 21.8235 19.5073 20.515 19.7322 18.8447C19.8789 17.7547 20 16.6376 20 15.5C20 14.3624 19.8789 13.2453 19.7322 12.1553C19.5073 10.485 18.1239 9.17649 16.4403 9.09909C15.0237 9.03397 13.5847 9 12 9C10.4153 9 8.97627 9.03397 7.55965 9.09909C5.87612 9.17649 4.49268 10.485 4.2678 12.1553C4.12104 13.2453 3.99999 14.3624 3.99999 15.5C3.99999 16.6376 4.12104 17.7547 4.2678 18.8447Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Rt=[[`path`,{d:`M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14 2.20004C13.3538 2.06886 12.6849 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 11.3151 21.9311 10.6462 21.8 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.0303 11.9625L16.5832 7.4096M19.7404 4.34462L19.1872 2.35748C19.0853 2.03011 18.6914 1.89965 18.4259 2.11662C16.9898 3.29018 15.4254 4.87091 16.703 7.36419C19.2771 8.56455 20.7466 6.94584 21.8733 5.5853C22.0975 5.3146 21.9623 4.90767 21.6247 4.81005L19.7404 4.34462Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],zt=[[`path`,{d:`M5 14L8.5 17.5L19 6.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Bt=[[`path`,{d:`M2.25 12C2.25 17.5228 6.72715 22 12.25 22C17.7728 22 22.25 17.5228 22.25 12C22.25 6.47715 17.7728 2 12.25 2C6.72715 2 2.25 6.47715 2.25 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.25 5L19.25 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Vt=[[`path`,{d:`M18.4995 20.5C18.2663 17.5685 15.8417 15.2477 12.808 15.0521L11.9995 15C11.7107 15.0076 11.4416 15.0178 11.1877 15.0298C8.18075 15.1723 5.7304 17.5974 5.49951 20.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.2495 9.25C15.2495 11.0449 13.7944 12.5 11.9995 12.5C10.2046 12.5 8.74952 11.0449 8.74952 9.25C8.74952 7.45507 10.2046 6 11.9995 6C13.7944 6 15.2495 7.45507 15.2495 9.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5.50249 8.5C5.17908 7.99485 4.99158 7.39432 4.99158 6.75C4.99158 4.95507 6.44665 3.5 8.24157 3.5C8.68752 3.5 9.1125 3.58982 9.49939 3.75235`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M18.4963 8.5C18.8197 7.99485 19.0072 7.39432 19.0072 6.75C19.0072 4.95507 17.5521 3.5 15.7572 3.5C15.3113 3.5 14.8863 3.58982 14.4994 3.75235`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M22.0007 17.9996C21.8208 15.7374 19.9995 13.5 17.9995 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M1.99927 17.9996C2.17923 15.7374 4.00049 13.5 6.00049 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Ht=[[`path`,{d:`M3.74416 16.1113L8.66248 12.5982C9.18807 12.2228 9.5 11.6167 9.5 10.9708V7.5C9.5 4.73858 11.7386 2.5 14.5 2.5H18L14.9811 6.81268C14.7029 7.2102 14.7501 7.75013 15.0932 8.09325L15.9068 8.90675C16.2499 9.24987 16.7898 9.29714 17.1873 9.01888L21.5 6V9.5C21.5 12.2614 19.2614 14.5 16.5 14.5H13.0292C12.3833 14.5 11.7772 14.8119 11.4018 15.3375L7.88869 20.2558C7.33099 21.0366 6.43055 21.5 5.47105 21.5C3.83018 21.5 2.5 20.1698 2.5 18.529C2.5 17.5695 2.96338 16.669 3.74416 16.1113Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Ut=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Wt=function(e){return`/`+e},Gt={},Kt=function(e){return e.pathname.endsWith(`.css`)},qt=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},R=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Wt(t,n);let r=s(t),i=Kt(r);return qt(Gt,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ut,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Jt=globalThis;Jt.window??=globalThis,Jt.Path2D??=class{},await R(()=>import(`./characters-BsW4RWhl.js`),[]);var Yt=Jt.window.CotalArt;function Xt(e,t){return Yt.body(e,t)}function Zt(e){return Yt.mark(e)}function Qt(e){return Yt.character({vendor:e,cx:70,cy:66,w:92,look:`right`,mood:`happy`,arms:[{from:[84,50],via:[106,40],to:[112,12],hand:`open`,deg:`auto`}],legs:[{from:[40,94],to:[36,116],dir:-1},{from:[62,94],to:[66,116],dir:1}]})}var $t={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`},en=(0,h.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n,absoluteStrokeWidth:r=!1,className:i=``,altIcon:a,showAlt:o=!1,icon:s,primaryColor:c,secondaryColor:l,disableSecondaryOpacity:u=!1,...d},f)=>{let p=n===void 0?void 0:r?Number(n)*24/Number(t):n,m=p===void 0?{}:{strokeWidth:p,stroke:`currentColor`},g={ref:f,...$t,width:t,height:t,color:c||e,className:i,...m,...d},_=[...o&&a?a:s].sort(([,e],[,t])=>{let n=e.opacity!==void 0;return t.opacity===void 0?n?-1:0:1}).map(([t,n])=>{let r=n.opacity!==void 0,i=r&&!u?n.opacity:void 0,a=l?{...n.stroke===void 0?{fill:r?l:c||e}:{stroke:r?l:c||e}}:{};return(0,h.createElement)(t,{...n,...m,...a,opacity:i,key:n.key})});return(0,h.createElement)(`svg`,g,_)});en.displayName=`HugeiconsIcon`;function z({icon:e,size:t=18,className:n}){return(0,F.jsx)(en,{icon:e,size:t,strokeWidth:1.5,className:n,"aria-hidden":`true`})}function tn(e){let t=globalThis.navigator?.clipboard;t?t.writeText(e).catch(e=>console.error(`copying the command failed:`,e)):console.error(`copying needs the clipboard, which this page cannot reach`)}function nn({command:e,icon:t}){return(0,F.jsxs)(`span`,{className:`ui-cmd`,children:[t&&(0,F.jsx)(z,{icon:t,size:16,className:`ui-ic ui-ic16`}),(0,F.jsx)(`code`,{children:e}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>tn(e),children:[(0,F.jsx)(z,{icon:I,size:16,className:`ui-ic`}),`Copy`]})]})}var rn=(0,h.createContext)(null),an=(0,h.createContext)(null),on=null,sn=new Set;function cn(e){on=g(e);for(let e of sn)e()}var ln=e=>e.split("`").map((e,t)=>t%2==1?(0,F.jsx)(`code`,{children:e},t):e),un={text:``,outgoing:[]};function dn({store:e,target:t,where:n,to:r}){let i=g(t),a=pt(e,e=>e.post),o=pt(e,e=>e.drafts[i])??un,s=(0,h.useContext)(an),c=(0,h.useContext)(rn)!==null,l=(0,h.useRef)(null),u=()=>l.current;if((0,h.useLayoutEffect)(()=>{let e=()=>{on===i&&(on=null,u()?.focus())};return e(),sn.add(e),()=>void sn.delete(e)},[i,a]),a===null)return null;if(a.mode===`off`)return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`ui-card ui-composer`,"aria-disabled":`true`,children:[(0,F.jsxs)(`div`,{className:`ui-reason`,children:[(0,F.jsx)(z,{icon:Lt,size:16,className:`ui-ic ui-ic16`}),(0,F.jsx)(`span`,{children:a.reason===`This dashboard was started with --creds, which can only read.`?ln("This dashboard was started with `--creds`, which can only read."):a.reason})]}),(0,F.jsxs)(`div`,{className:`ui-crow`,children:[(0,F.jsx)(nn,{command:x(t)}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(`button`,{type:`button`,className:`ui-send`,disabled:!0,title:a.reason,"aria-label":`Send`,children:(0,F.jsx)(z,{icon:yt,size:16,className:`ui-ic ui-ic16`})})]})]}),(0,F.jsx)(`div`,{className:`ui-cnote`,children:ln(y(a))})]});let d=o.outgoing.some(e=>e.id===void 0),f=o.refused,p=s!==null&&!d&&o.text.trim()!==``,m=()=>{p&&s.send(t,o.text).catch(()=>void 0)};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:f===void 0?`ui-card ui-composer`:`ui-card ui-composer ui-composer-err`,children:[(0,F.jsx)(`textarea`,{ref:l,className:o.text===``?`ui-input`:`ui-input ui-input-typed`,placeholder:`Message ${n}`,"aria-label":`Message ${n}`,value:o.text,readOnly:s===null,onChange:e=>s?.draft(t,e.currentTarget.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),m())}}),(0,F.jsx)(`div`,{className:`ui-crow`,children:f===void 0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,className:`ui-pick`,disabled:s===null,onClick:()=>{s?.draft(t,`${o.text}@`),u()?.focus()},title:c?`Mention`:void 0,"aria-label":c?`Mention`:void 0,children:[(0,F.jsx)(z,{icon:xt,size:16,className:`ui-ic`}),!c&&`Mention`]}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsxs)(`span`,{className:`ui-pick`,children:[(0,F.jsx)(`i`,{className:`ui-mode-dot`,style:{background:t.kind===`msg`?`var(--multi)`:`var(--uni)`}}),r]}),!c&&(0,F.jsx)(`span`,{className:`ui-pick`,children:`as operator`}),(0,F.jsx)(`button`,{type:`button`,className:`ui-send`,title:d?`Sending`:`Send`,"aria-label":d?`Sending`:`Send`,disabled:!p,onClick:m,children:d?(0,F.jsx)(`span`,{className:`ui-spin`}):(0,F.jsx)(z,{icon:yt,size:16,className:`ui-ic ui-ic16`})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(`button`,{type:`button`,className:`ui-btn ui-btn-sm`,disabled:!p,onClick:m,children:`Try again`})]})})]}),f===void 0?(0,F.jsx)(`div`,{className:`ui-cnote`,children:ln(y(a))}):(0,F.jsx)(`div`,{className:`ui-cnote ui-cnote-err`,role:`alert`,title:f,children:f})]})}function fn({store:e,target:t,shown:n}){let r=pt(e,e=>e.drafts[g(t)])??un;return(0,F.jsx)(F.Fragment,{children:r.outgoing.filter(e=>e.id===void 0||!n.has(e.id)).map(e=>{let t=new Date(e.ts);return(0,F.jsxs)(`div`,{className:e.id===void 0?`ui-msg ui-pending`:`ui-msg`,children:[(0,F.jsx)(`div`,{className:`ui-gut`,children:(0,F.jsx)(`span`,{className:`ui-me`,style:{width:34,height:34},children:`OP`})}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`ui-mh`,children:[(0,F.jsx)(`b`,{children:`operator`}),(0,F.jsx)(`span`,{className:`ui-role`,children:`operator`}),(0,F.jsx)(`time`,{dateTime:t.toISOString(),children:ue(t)})]}),(0,F.jsx)(`div`,{className:`ui-tx`,children:(0,F.jsx)(`p`,{style:{whiteSpace:`pre-wrap`},children:e.text})})]})]},e.seq)})})}function pn({peer:e,name:t,selfId:n}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`ui-card ui-composer`,children:[(0,F.jsx)(`div`,{className:`ui-reason`,children:(0,F.jsx)(`span`,{children:`This conversation is between two agents.`})}),(0,F.jsxs)(`div`,{className:`ui-crow`,children:[(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(`a`,{className:`ui-btn ui-btn-sm`,href:qe(S(e,n)),onClick:()=>cn({kind:`dm`,to:e}),children:`Message ${t}`})]})]}),(0,F.jsx)(`div`,{className:`ui-cnote`})]})}function mn(e){let t=e.snapshot;return t!==void 0&&(t.asOf!==void 0||Array.isArray(t.members)&&t.members.length>0)}function hn(e,t){if(e.unreadable!==void 0)return`unreadable`;if(!mn(e))return`traffic-only`;let n=e.snapshot.asOf;return(n?t-n:1/0)<45e3?`live`:`stale`}function gn(e){return mn(e)&&e.unreadable===void 0}var _n=e=>e.split(`.`).some(e=>e===`*`||e===`>`);function vn(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<n.length;e++){if(n[e]===`>`)return e<r.length;if(e>=r.length||n[e]!==`*`&&n[e]!==r[e])return!1}return n.length===r.length}function yn(e,t,n,r=[]){let i=new Map,a=!1;for(let t of e)if(t===`>`||t===`*`)a=!0;else if(_n(t))for(let e of n)vn(t,e)&&i.set(e,`live`);else i.set(t,`live`);for(let e of t)if(_n(e))for(let t of r)!i.has(t)&&vn(e,t)&&i.set(t,`durable`);else i.has(e)||i.set(e,`durable`);return{channels:i,wide:a}}function bn(e,t,n,r){let i=new Set,a=[],o=(e,t)=>{e&&!i.has(e)&&(i.add(e),a.push({id:e,source:t}))};if(gn(t)){let r=[...n,e];for(let n of t.snapshot.members){let{channels:t,wide:i}=yn(n.live??[],n.durable??[],r);(i||t.has(e))&&o(n.id,`membership`)}return a}for(let t of r)t.msg.channel===e&&o(t.senderId??t.msg.from.id,`traffic`);return a}function xn(e,t,n,r,i){let a=new Set,o=!1;if(gn(t)){let r=t.snapshot.members.find(t=>t.id===e);if(r){let e=yn(r.live??[],r.durable??[],n);o=e.wide;for(let t of e.channels.keys())a.add(t)}}else for(let t of r)(t.senderId??t.msg.from?.id)===e&&typeof t.msg.channel==`string`&&a.add(t.msg.channel);let s=new Map;for(let[e,t]of Object.entries(i??{}))(t===`quiet`||t===`muted`)&&s.set(e,t);for(let e of s.keys())a.add(e);return{channels:[...a].sort().map(e=>s.has(e)?{channel:e,mode:s.get(e)}:{channel:e}),wide:o}}var Sn=26;function Cn({letter:e,slot:t,size:n,offline:r}){let i=n<Sn,a=[`ui-idb`,[...e].length>1&&`ui-idb-2`,i&&`ui-idb-dot`,r&&`ui-idb-off`].filter(Boolean).join(` `);return(0,F.jsx)(`i`,{className:a,style:{"--bf":`var(--id-${t})`},"aria-hidden":`true`,children:i?null:e})}var wn={waiting:Ot,working:jt,idle:Nt,offline:Bt},Tn=e=>e.charAt(0).toUpperCase()+e.slice(1);function En({status:e}){return(0,F.jsx)(`i`,{className:`ui-st ui-st-${e}`,role:`img`,"aria-label":Tn(e)})}var Dn=(e,t)=>e===`working`?`${t} ox-spin`:t;function On({row:e}){let t=Object.hasOwn(wn,e.status)?wn[e.status]:void 0;return(0,F.jsxs)(`span`,{className:`v3-spill v3-s-${e.status}`,children:[t&&(0,F.jsx)(z,{icon:t,size:16,className:Dn(e.status,`ui-ic ui-ic16`)}),Tn(dt(e))]})}var kn={"claude-code":`claude`,claude:`claude`,opencode:`opencode`,codex:`codex`,hermes:`hermes`,pi:`pi`},An=`guest`,jn={working:{look:`down`},waiting:{mood:`surprised`,look:`up`}};function Mn(e,t){return Xt(e!==void 0&&Object.hasOwn(kn,e)?kn[e]:An,Object.hasOwn(jn,t)?jn[t]:{})}function Nn({vendor:e,status:t,size:n,badge:r,dot:i=!0}){return(0,F.jsxs)(`span`,{className:t===`offline`?`ui-av ui-av-off`:`ui-av`,style:{"--s":`${n}px`},children:[(0,F.jsx)(`svg`,{viewBox:`-2 -4 112 112`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:Mn(e,t)}}),r&&(0,F.jsx)(Cn,{letter:r.letter,slot:r.slot,size:n,offline:t===`offline`}),i&&(0,F.jsx)(En,{status:t})]})}var Pn=8;function Fn(e){let t=[...e][0];if(t===void 0)return``;let n=/_(\d+)$/.exec(e);return t.toUpperCase()+(n?n[1]:``)}function In(e){let[t,...n]=[...e];if(t===void 0)return``;let r=n.find(e=>/\p{L}/u.test(e))??``,i=/_(\d+)$/.exec(e);return t.toUpperCase()+r+(i?i[1]:``)}function Ln(e){let t=new Map;for(let n of e)n.status!==`offline`&&t.set(Fn(n.name),(t.get(Fn(n.name))??0)+1);let n=new Map;for(let r of e){let e=Fn(r.name);n.set(r.id,r.status!==`offline`&&(t.get(e)??0)>1?In(r.name):e)}return n}function Rn(e){let t=7;for(let n of e)t=Math.imul(t,31)+n.charCodeAt(0)>>>0;return t%Pn+1}var zn=(e,t)=>e.name<t.name?-1:e.name>t.name?1:e.id<t.id?-1:+(e.id>t.id);function Bn(e){let t=new Map,n=new Set,r=e.filter(e=>e.status!==`offline`).sort(zn);for(let e of r){let r=Rn(e.name);if(n.size<Pn)for(;n.has(r);)r=r%Pn+1;n.add(r),t.set(e.id,r)}for(let n of e)n.status===`offline`&&t.set(n.id,Rn(n.name));return t}var Vn=(0,h.createContext)(()=>void 0);function Hn(){return(0,h.useContext)(Vn)}function Un(e){let t=Bn(e),n=Ln(e),r=new Map;for(let i of e){let e=t.get(i.id);e!==void 0&&r.set(i.id,{letter:n.get(i.id)??``,slot:e})}return e=>r.get(e)}var Wn={claude:{label:`Claude Code`,color:`#d97757`,glyph:`◆`,svg:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"/></svg>`},opencode:{label:`OpenCode`,color:`#cdd6e0`,glyph:`▣`,svg:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M22 24H2V0h20zM17 4.8H7v14.4h10z"/></svg>`},codex:{label:`Codex`,color:`#e5e7eb`,glyph:`◉`,svg:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"/></svg>`},hermes:{label:`Hermes`,color:`#a78bfa`,glyph:`➤`,svg:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 3 3 10.5l7 2.5 2.5 7L21 3Z"/><path d="M21 3 10 13"/></svg>`},jcode:{label:`Jcode`,color:`#4ade80`,glyph:`⟨⟩`,svg:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 4 3 12l5 8"/><path d="m16 4 5 8-5 8"/></svg>`},pi:{label:`Pi`,color:`#7dd3fc`,glyph:`π`,svg:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h16"/><path d="M9 7v12"/><path d="M15 7v12c0 1.5 1.5 2 3 1"/></svg>`}};function Gn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Kn(e){if(Array.isArray(e))return e}function qn(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Jn(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yn(e,t){return Kn(e)||qn(e,t)||Xn(e,t)||Jn()}function Xn(e,t){if(e){if(typeof e==`string`)return Gn(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gn(e,t):void 0}}var Zn=Object.entries,Qn=Object.setPrototypeOf,$n=Object.isFrozen,er=Object.getPrototypeOf,tr=Object.getOwnPropertyDescriptor,B=Object.freeze,V=Object.seal,nr=Object.create,rr=typeof Reflect<`u`&&Reflect,ir=rr.apply,ar=rr.construct;B||=function(e){return e},V||=function(e){return e},ir||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ar||=function(e){return new e(...[...arguments].slice(1))};var or=W(Array.prototype.forEach),sr=W(Array.prototype.lastIndexOf),cr=W(Array.prototype.pop),lr=W(Array.prototype.push),ur=W(Array.prototype.splice),dr=Array.isArray,fr=W(String.prototype.toLowerCase),pr=W(String.prototype.toString),mr=W(String.prototype.match),hr=W(String.prototype.replace),gr=W(String.prototype.indexOf),_r=W(String.prototype.trim),vr=W(Number.prototype.toString),yr=W(Boolean.prototype.toString),br=typeof BigInt>`u`?null:W(BigInt.prototype.toString),xr=typeof Symbol>`u`?null:W(Symbol.prototype.toString),H=W(Object.prototype.hasOwnProperty),Sr=W(Object.prototype.toString),U=W(RegExp.prototype.test),Cr=wr(TypeError);function W(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ir(e,t,n)}}function wr(e){return function(){return ar(e,[...arguments])}}function G(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fr;if(Qn&&Qn(e,null),!dr(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&($n(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Tr(e){for(let t=0;t<e.length;t++)H(e,t)||(e[t]=null);return e}function K(e){let t=nr(null);for(let r of Zn(e)){var n=Yn(r,2);let i=n[0],a=n[1];H(e,i)&&(t[i]=dr(a)?Tr(a):a&&typeof a==`object`&&a.constructor===Object?K(a):a)}return t}function Er(e){switch(typeof e){case`string`:return e;case`number`:return vr(e);case`boolean`:return yr(e);case`bigint`:return br?br(e):`0`;case`symbol`:return xr?xr(e):`Symbol()`;case`undefined`:return Sr(e);case`function`:case`object`:{if(e===null)return Sr(e);let t=e,n=Dr(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Sr(e)}return Sr(e)}default:return Sr(e)}}function Dr(e,t){for(;e!==null;){let n=tr(e,t);if(n){if(n.get)return W(n.get);if(typeof n.value==`function`)return W(n.value)}e=er(e)}function n(){return null}return n}function Or(e){try{return U(e,``),!0}catch{return!1}}var kr=B(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ar=B(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),jr=B([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Mr=B([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Nr=B(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Pr=B([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Fr=B([`#text`]),Ir=B(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Lr=B(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Rr=B(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),zr=B([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Br=V(/{{[\w\W]*|^[\w\W]*}}/g),Vr=V(/<%[\w\W]*|^[\w\W]*%>/g),Hr=V(/\${[\w\W]*/g),Ur=V(/^data-[\-\w.\u00B7-\uFFFF]+$/),Wr=V(/^aria-[\-\w]+$/),Gr=V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kr=V(/^(?:\w+script|data):/i),qr=V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jr=V(/^html$/i),Yr=V(/^[a-z][.\w]*(-[.\w]+)+$/i),Xr=V(/<[/\w!]/g),Zr=V(/<[/\w]/g),Qr=V(/<\/no(script|embed|frames)/i),$r=V(/\/>/i),q={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ei=function(){return typeof window>`u`?null:window},ti=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ni=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ri=function(e,t,n,r){return H(e,t)&&dr(e[t])?G(r.base?K(r.base):{},e[t],r.transform):n};function ii(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ei(),t=e=>ii(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==q.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Dr(d,`cloneNode`),p=Dr(d,`remove`),m=Dr(d,`nextSibling`),h=Dr(d,`childNodes`),g=Dr(d,`parentNode`),_=Dr(d,`shadowRoot`),v=Dr(d,`attributes`),y=o&&o.prototype?Dr(o.prototype,`nodeType`):null,b=o&&o.prototype?Dr(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,ee,te=!1,ne=0,re=function(){if(ne>0)throw Cr(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},C=function(e){re(),ne++;try{return x.createHTML(e)}finally{ne--}},ie=function(e){re(),ne++;try{return x.createScriptURL(e)}finally{ne--}},ae=function(){return te||=(ee=ti(u,i),!0),ee},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,w=oe.getElementsByTagName,T=r.importNode,E=ni();t.isSupported=typeof Zn==`function`&&typeof g==`function`&&se&&se.createHTMLDocument!==void 0;let ue=Br,D=Vr,de=Hr,fe=Ur,O=Wr,pe=Kr,me=qr,he=Yr,ge=Gr,k=null,_e=G({},[...kr,...Ar,...jr,...Nr,...Fr]),A=null,ve=G({},[...Ir,...Lr,...Rr,...zr]),j=Object.seal(nr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ye=null,be=null,xe=Object.seal(nr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Se=!0,Ce=!0,we=!1,Te=!0,Ee=!1,De=!0,Oe=!1,ke=!1,Ae=null,je=null,Me=!1,Ne=!1,Pe=!1,Fe=!1,Ie=!0,Le=!1,Re=`user-content-`,ze=!0,Be=!1,Ve={},M=null,He=G({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ue=null,We=G({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ge=null,Ke=G({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),qe=`http://www.w3.org/1998/Math/MathML`,Je=`http://www.w3.org/2000/svg`,N=`http://www.w3.org/1999/xhtml`,Ye=N,Xe=!1,Ze=null,Qe=G({},[qe,Je,N],pr),$e=B([`mi`,`mo`,`mn`,`ms`,`mtext`]),et=G({},$e),tt=B([`annotation-xml`]),nt=G({},tt),rt=G({},[`title`,`style`,`font`,`a`,`script`]),it=null,at=[`application/xhtml+xml`,`text/html`],P=null,ot=null,st=n.createElement(`form`),ct=function(e){return e instanceof RegExp||e instanceof Function},lt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ot&&ot===e)return;e&&typeof e==`object`||(e={}),e=K(e),it=at.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,P=it===`application/xhtml+xml`?pr:fr,k=ri(e,`ALLOWED_TAGS`,_e,{transform:P}),A=ri(e,`ALLOWED_ATTR`,ve,{transform:P}),Ze=ri(e,`ALLOWED_NAMESPACES`,Qe,{transform:pr}),Ge=ri(e,`ADD_URI_SAFE_ATTR`,Ke,{transform:P,base:Ke}),Ue=ri(e,`ADD_DATA_URI_TAGS`,We,{transform:P,base:We}),M=ri(e,`FORBID_CONTENTS`,He,{transform:P}),ye=ri(e,`FORBID_TAGS`,K({}),{transform:P}),be=ri(e,`FORBID_ATTR`,K({}),{transform:P}),Ve=H(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?K(e.USE_PROFILES):e.USE_PROFILES:!1,Se=e.ALLOW_ARIA_ATTR!==!1,Ce=e.ALLOW_DATA_ATTR!==!1,we=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Te=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=e.SAFE_FOR_TEMPLATES||!1,De=e.SAFE_FOR_XML!==!1,Oe=e.WHOLE_DOCUMENT||!1,Ne=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,Ie=e.SANITIZE_DOM!==!1,Le=e.SANITIZE_NAMED_PROPS||!1,ze=e.KEEP_CONTENT!==!1,Be=e.IN_PLACE||!1,ge=Or(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Gr,Ye=typeof e.NAMESPACE==`string`?e.NAMESPACE:N,et=H(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?K(e.MATHML_TEXT_INTEGRATION_POINTS):G({},$e),nt=H(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?K(e.HTML_INTEGRATION_POINTS):G({},tt);let t=H(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?K(e.CUSTOM_ELEMENT_HANDLING):nr(null);if(j=nr(null),H(t,`tagNameCheck`)&&ct(t.tagNameCheck)&&(j.tagNameCheck=t.tagNameCheck),H(t,`attributeNameCheck`)&&ct(t.attributeNameCheck)&&(j.attributeNameCheck=t.attributeNameCheck),H(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(j.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),V(j),Ee&&(Ce=!1),Pe&&(Ne=!0),Ve&&(k=G({},Fr),A=nr(null),Ve.html===!0&&(G(k,kr),G(A,Ir)),Ve.svg===!0&&(G(k,Ar),G(A,Lr),G(A,zr)),Ve.svgFilters===!0&&(G(k,jr),G(A,Lr),G(A,zr)),Ve.mathMl===!0&&(G(k,Nr),G(A,Rr),G(A,zr))),xe.tagCheck=null,xe.attributeCheck=null,H(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?xe.tagCheck=e.ADD_TAGS:dr(e.ADD_TAGS)&&(k===_e&&(k=K(k)),G(k,e.ADD_TAGS,P))),H(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?xe.attributeCheck=e.ADD_ATTR:dr(e.ADD_ATTR)&&(A===ve&&(A=K(A)),G(A,e.ADD_ATTR,P))),H(e,`ADD_URI_SAFE_ATTR`)&&dr(e.ADD_URI_SAFE_ATTR)&&G(Ge,e.ADD_URI_SAFE_ATTR,P),H(e,`FORBID_CONTENTS`)&&dr(e.FORBID_CONTENTS)&&(M===He&&(M=K(M)),G(M,e.FORBID_CONTENTS,P)),H(e,`ADD_FORBID_CONTENTS`)&&dr(e.ADD_FORBID_CONTENTS)&&(M===He&&(M=K(M)),G(M,e.ADD_FORBID_CONTENTS,P)),ze&&(k[`#text`]=!0),Oe&&G(k,[`html`,`head`,`body`]),k.table&&(G(k,[`tbody`]),delete ye.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Cr(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Cr(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=C(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=ae()),x&&typeof S==`string`&&(S=C(``)));B&&B(e),ot=e},ut=G({},[...Ar,...jr,...Mr]),dt=G({},[...Nr,...Pr]),ft=function(e,t,n){return t.namespaceURI===N?e===`svg`:t.namespaceURI===qe?e===`svg`&&(n===`annotation-xml`||et[n]):!!ut[e]},pt=function(e,t,n){return t.namespaceURI===N?e===`math`:t.namespaceURI===Je?e===`math`&&nt[n]:!!dt[e]},F=function(e,t,n){return t.namespaceURI===Je&&!nt[n]||t.namespaceURI===qe&&!et[n]?!1:!dt[e]&&(rt[e]||!ut[e])},mt=function(e){let t=g(e);t&&t.tagName||(t={namespaceURI:Ye,tagName:`template`});let n=fr(e.tagName),r=fr(t.tagName);return Ze[e.namespaceURI]?e.namespaceURI===Je?ft(n,t,r):e.namespaceURI===qe?pt(n,t,r):e.namespaceURI===N?F(n,t,r):!!(it===`application/xhtml+xml`&&Ze[e.namespaceURI]):!1},ht=function(e){lr(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Cr(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gt=function(e){yt(e);let t=h(e);if(t){let e=[];or(t,t=>{lr(e,t)}),or(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},_t=function(e,n){try{lr(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{lr(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(Ne||Pe)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},vt=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||A[P(i)]))try{e.removeAttribute(i)}catch{}}},yt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===q.element&&vt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},bt=function(e){if(!De)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===q.processingInstruction||n===q.comment&&U(Zr,e.data)){try{p(e)}catch{}continue}if(n===q.element){let t=e,n=P(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},xt=function(e){let t=null,r=null;if(Me)e=`<remove></remove>`+e;else{let t=mr(e,/^[\r\n\t ]+/);r=t&&t[0]}it===`application/xhtml+xml`&&Ye===N&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?C(e):e;if(Ye===N)try{t=new l().parseFromString(i,it)}catch{}if(!t||!t.documentElement){t=se.createDocument(Ye,`template`,null);try{t.documentElement.innerHTML=Xe?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ye===N?w.call(t,Oe?`html`:`body`)[0]:Oe?t.documentElement:a},St=function(e){return ce.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ct=function(e){return e=hr(e,ue,` `),e=hr(e,D,` `),e=hr(e,de,` `),e},wt=function(e){e.normalize();let t=ce.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=Ct(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&or(r,e=>{I(e.content)&&wt(e.content)})},Tt=function(e){let t=b?b(e):null;return typeof t!=`string`||P(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},I=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===q.documentFragment}catch{return!1}},Et=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function L(e,n,r){e.length!==0&&or(e,e=>{e.call(t,n,r,ot)})}let Dt=function(e,t){return!!(De&&e.hasChildNodes()&&!Et(e.firstElementChild)&&U(Xr,e.textContent)&&U(Xr,e.innerHTML)||De&&e.namespaceURI===N&&t===`style`&&Et(e.firstElementChild)||e.nodeType===q.processingInstruction||De&&e.nodeType===q.comment&&U(Zr,e.data))},Ot=function(e,t){if(!ye[t]&&Mt(t)&&(j.tagNameCheck instanceof RegExp&&U(j.tagNameCheck,t)||j.tagNameCheck instanceof Function&&j.tagNameCheck(t)))return!1;if(ze&&!M[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Be?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return ht(e),!0},kt=function(e,n){if(L(E.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(Tt(e))return ht(e),!0;let r=P(b?b(e):e.nodeName);if(L(E.uponSanitizeElement,e,{tagName:r,allowedTags:k}),e!==n&&g(e)===null)return!0;if(Dt(e,r))return ht(e),!0;if(ye[r]||!(xe.tagCheck instanceof Function&&xe.tagCheck(r))&&!k[r]){let t=Ot(e,r);return t===!1&&L(E.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===q.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&U(Qr,e.innerHTML))return ht(e),!0;if(Ee&&e.nodeType===q.text){let n=Ct(e.textContent);e.textContent!==n&&(lr(t.removed,{element:e.cloneNode()}),e.textContent=n)}return L(E.afterSanitizeElements,e,null),!1},At=function(e,t,r){if(be[t]||De&&t===`patchsrc`||De&&t===`for`&&e!==`label`&&e!==`output`||Ie&&(t===`id`||t===`name`)&&(r in n||r in st))return!1;let i=A[t]||xe.attributeCheck instanceof Function&&xe.attributeCheck(t,e);if(!(Ce&&U(fe,t))&&!(Se&&U(O,t))){if(!i){if(!(Mt(e)&&(j.tagNameCheck instanceof RegExp&&U(j.tagNameCheck,e)||j.tagNameCheck instanceof Function&&j.tagNameCheck(e))&&(j.attributeNameCheck instanceof RegExp&&U(j.attributeNameCheck,t)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(t,e))||t===`is`&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&U(j.tagNameCheck,r)||j.tagNameCheck instanceof Function&&j.tagNameCheck(r))))return!1}else if(!Ge[t]&&!U(ge,hr(r,me,``))&&(t!==`src`&&t!==`xlink:href`&&t!==`href`||e===`script`||gr(r,`data:`)!==0||!Ue[e])&&(!we||U(pe,hr(r,me,``)))&&r)return!1}return!0},jt=G({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Mt=function(e){return!jt[fr(e)]&&U(he,e)},Nt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return C(r);case`TrustedScriptURL`:return ie(r)}return r},Pt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Tt(e)?ht(e):cr(t.removed)}catch{_t(n,e)}},Ft=function(e){L(E.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Tt(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0},r=t.length,i=P(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=P(o),u=c,d=o===`value`?u:_r(u);n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,L(E.uponSanitizeAttribute,e,n),d=n.attrValue,Le&&(l===`id`||l===`name`)&&gr(d,Re)!==0&&(_t(o,e),d=Re+d),De&&U(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)||l===`attributename`&&mr(d,`href`)?_t(o,e):n.forceKeepAttr||(n.keepAttr?!Te&&U($r,d)?_t(o,e):(Ee&&(d=Ct(d)),At(i,l,d)?(d=Nt(i,l,s,d),d!==u&&Pt(e,o,s,d)):_t(o,e)):_t(o,e))}L(E.afterSanitizeAttributes,e,null)},It=function(e){let t=null,n=St(e);for(L(E.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(L(E.uponSanitizeShadowNode,t,null),kt(t,e),Ft(t),I(t.content)&&It(t.content),(y?y(t):t.nodeType)===q.element){let e=_(t);I(e)&&(Lt(e),It(e))}L(E.afterSanitizeShadowDOM,e,null)},Lt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){It(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===q.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&P(e)===`template`){let e=n.content;I(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);I(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Xe=!e,Xe&&(e=`<!-->`),typeof e!=`string`&&!Et(e)&&(e=Er(e),typeof e!=`string`))throw Cr(`dirty is not a string, aborting`);if(!t.isSupported)return e;ke?(k=Ae,A=je):lt(n),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(k=K(k)),E.uponSanitizeAttribute.length>0&&(A=K(A)),t.removed=[];let c=Be&&typeof e!=`string`&&Et(e);if(c){bt(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=P(t);if(!k[n]||ye[n])throw gt(e),Cr(`root node is forbidden and cannot be sanitized in-place`)}if(Tt(e))throw gt(e),Cr(`root node is clobbered and cannot be sanitized in-place`);try{Lt(e)}catch(t){throw gt(e),t}}else if(Et(e))i=xt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===q.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Lt(a);else{if(!Ne&&!Ee&&!Oe&&e.indexOf(`<`)===-1)return x&&Fe?C(e):e;if(i=xt(e),!i)return Ne?null:Fe?S:``}i&&Me&&ht(i.firstChild);let l=c?e:i,u=St(l);try{for(;o=u.nextNode();)kt(o,l),Ft(o),I(o.content)&&It(o.content)}catch(n){throw c&&(gt(e),or(t.removed,e=>{e.element&&yt(e.element)})),n}if(c)return or(t.removed,e=>{e.element&&yt(e.element)}),Ee&&wt(e),e;if(Ne){if(Ee&&wt(i),Pe)for(s=le.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(A.shadowroot||A.shadowrootmode)&&(s=T.call(r,s,!0)),s}let d=Oe?i.outerHTML:i.innerHTML;return Oe&&k[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&U(Jr,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
4
- `+d),Ee&&(d=Ct(d)),x&&Fe?C(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(e),ke=!0,Ae=k,je=A},t.clearConfig=function(){ot=null,ke=!1,Ae=null,je=null,x=ee,S=``},t.isValidAttribute=function(e,t,n){ot||lt({});let r=P(e),i=P(t);return At(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&H(E,e)&&lr(E[e],t)},t.removeHook=function(e,t){if(H(E,e)){if(t!==void 0){let n=sr(E[e],t);return n===-1?void 0:ur(E[e],n,1)[0]}return cr(E[e])}},t.removeHooks=function(e){H(E,e)&&(E[e]=[])},t.removeAllHooks=function(){E=ni()},t}var ai=ii();function oi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var si=oi();function ci(e){si=e}var li={exec:()=>null};function ui(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function J(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Y.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var di=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ui(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ui(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:ui(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ui(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ui(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:ui(e=>RegExp(`^ {0,${e}}>`))},fi=/^(?:[ \t]*(?:\n|$))+/,pi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,mi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_i=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,vi=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yi=J(vi).replace(/bull/g,_i).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),bi=J(vi).replace(/bull/g,_i).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Si=/^[^\n]+/,Ci=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,wi=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ci).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ti=J(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_i).getRegex(),Ei=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Di=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Oi=J(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n+|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n+|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n+|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Di).replace(`tag`,Ei).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ki=e=>J(xi).replace(`hr`,hi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ei).getRegex(),Ai=ki(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ji=ki(/ {0,3}(?:[*+-]|\d{1,9}[.)])[ \t]+[^ \t\n]/),Mi={blockquote:J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ji).getRegex(),code:pi,def:wi,fences:mi,heading:gi,hr:hi,html:Oi,lheading:yi,list:Ti,newline:fi,paragraph:Ai,table:li,text:Si},Ni=J(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,hi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ei).getRegex(),Pi={...Mi,lheading:bi,table:Ni,paragraph:J(xi).replace(`hr`,hi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Ni).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ei).getRegex()},Fi={...Mi,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Di).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:li,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(xi).replace(`hr`,hi).replace(`heading`,` *#{1,6} *[^
5
- ]`).replace(`lheading`,yi).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ii=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Li=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ri=/^( {2,}|\\)\n(?!\s*$)/,zi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Bi=/[\p{P}\p{S}]/u,Vi=/[\s\p{P}\p{S}]/u,Hi=/[^\s\p{P}\p{S}]/u,Ui=J(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Vi).getRegex(),Wi=/(?!~)[\p{P}\p{S}]/u,Gi=/(?!~)[\s\p{P}\p{S}]/u,Ki=/(?:[^\s\p{P}\p{S}]|~)/u,qi=J(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,di?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ji=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Yi=J(Ji,`u`).replace(/punct/g,Bi).getRegex(),Xi=J(Ji,`u`).replace(/punct/g,Wi).getRegex(),Zi=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Qi=J(Zi,`gu`).replace(/notPunctSpace/g,Hi).replace(/punctSpace/g,Vi).replace(/punct/g,Bi).getRegex(),$i=J(Zi,`gu`).replace(/notPunctSpace/g,Ki).replace(/punctSpace/g,Gi).replace(/punct/g,Wi).getRegex(),ea=J(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Hi).replace(/punctSpace/g,Vi).replace(/punct/g,Bi).getRegex(),ta=J(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Bi).getRegex(),na=J(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Hi).replace(/punctSpace/g,Vi).replace(/punct/g,Bi).getRegex(),ra=J(/\\(punct)/,`gu`).replace(/punct/g,Bi).getRegex(),ia=J(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),aa=J(Di).replace(`(?:-->|$)`,`-->`).getRegex(),oa=J(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,aa).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ca=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,sa).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),la=J(/^!?\[(label)\]\[(ref)\]/).replace(`label`,sa).replace(`ref`,Ci).getRegex(),ua=J(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ci).getRegex(),da=J(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,la).replace(`nolink`,ua).getRegex(),fa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pa={_backpedal:li,anyPunctuation:ra,autolink:ia,blockSkip:qi,br:Ri,code:Li,del:li,delLDelim:li,delRDelim:li,emStrongLDelim:Yi,emStrongRDelimAst:Qi,emStrongRDelimUnd:ea,escape:Ii,link:ca,nolink:ua,punctuation:Ui,reflink:la,reflinkSearch:da,tag:oa,text:zi,url:li},ma={...pa,link:J(/^!?\[(label)\]\((.*?)\)/).replace(`label`,sa).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,sa).getRegex()},ha={...pa,emStrongRDelimAst:$i,emStrongLDelim:Xi,delLDelim:ta,delRDelim:na,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,fa).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:J(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,fa).getRegex()},ga={...ha,br:J(Ri).replace(`{2,}`,`*`).getRegex(),text:J(ha.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},_a={normal:Mi,gfm:Pi,pedantic:Fi},va={normal:pa,gfm:ha,breaks:ga,pedantic:ma},ya={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},ba=e=>ya[e];function X(e,t){if(t){if(Y.escapeTest.test(e))return e.replace(Y.escapeReplace,ba)}else if(Y.escapeTestNoEncode.test(e))return e.replace(Y.escapeReplaceNoEncode,ba);return e}function xa(e){try{e=encodeURI(e).replace(Y.percentDecode,`%`)}catch{return null}return e}function Sa(e,t){let n=e.replace(Y.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Y.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Y.slashPipe,`|`);return n}function Ca(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function wa(e){let t=e.split(`
6
- `),n=t.length-1;for(;n>=0&&Y.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
7
- `)}function Ta(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ea(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Da(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Oa(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
8
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
9
- `)}var ka=class{options;rules;lexer;constructor(e){this.options=e||si}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:wa(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Oa(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Ca(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Ca(t[0],`
10
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Ca(t[0],`
11
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Ca(t[0],`
12
- `).split(`
13
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
14
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
15
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
16
- ${s}`:s,r=r?`${r}
17
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
18
- `+e.join(`
19
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
20
- `+e.join(`
21
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
22
- `)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Ea(t[2].split(`
23
- `,1)[0],t[1].length),l=e.split(`
24
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
25
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
26
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
27
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
28
- `+l}u=!l.trim(),r+=p+`
29
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=wa(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Ca(t[0],`
30
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Sa(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
31
- `):[],a={type:`table`,raw:Ca(t[0],`
32
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Sa(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Ca(t[0],`
33
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
34
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Ca(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ta(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Da(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Da(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Z=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||si,this.options.tokenizer=this.options.tokenizer||new ka,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Y,block:_a.normal,inline:va.normal};this.options.pedantic?(t.block=_a.pedantic,t.inline=va.pedantic):this.options.gfm&&(t.block=_a.gfm,t.inline=this.options.breaks?va.breaks:va.gfm),this.tokenizer.rules=t}static get rules(){return{block:_a,inline:va}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Y.carriageReturn,`
35
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Y.tabCharGlobal,` `).replace(Y.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
36
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
37
- `)?``:`
38
- `)+i.raw,n.text+=`
39
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
40
- `)?``:`
41
- `)+i.raw,n.text+=`
42
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
43
- `)?``:`
44
- `)+i.raw,r.text+=`
45
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
46
- `)?``:`
47
- `)+i.raw,n.text+=`
48
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if((r=this.tokenizer.escape(e))||(r=this.tokenizer.tag(e))||(r=this.tokenizer.link(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if((r=this.tokenizer.emStrong(e,n,o))||(r=this.tokenizer.codespan(e))||(r=this.tokenizer.br(e))||(r=this.tokenizer.del(e,n,o))||(r=this.tokenizer.autolink(e))||!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Aa=class{options;parser;constructor(e){this.options=e||si}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Y.notSpaceStart)?.[0],i=e.replace(Y.endingNewline,``)+`
49
- `;return r?`<pre><code class="language-`+X(r)+`">`+(n?i:X(i,!0))+`</code></pre>
50
- `:`<pre><code>`+(n?i:X(i,!0))+`</code></pre>
51
- `}blockquote({tokens:e}){return`<blockquote>
52
- ${this.parser.parse(e)}</blockquote>
53
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
54
- `}hr(e){return`<hr>
55
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
56
- `+r+`</`+i+`>
57
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
58
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
59
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
60
- <thead>
61
- `+t+`</thead>
62
- `+r+`</table>
63
- `}tablerow({text:e}){return`<tr>
64
- ${e}</tr>
65
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
66
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${X(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=xa(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+X(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=xa(e);if(i===null)return X(n);e=i;let a=`<img src="${e}" alt="${X(n)}"`;return t&&(a+=` title="${X(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:X(e.text)}},ja=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Q=class e{options;renderer;textRenderer;constructor(e){this.options=e||si,this.options.renderer=this.options.renderer||new Aa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ja}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Ma=class{options;block;constructor(e){this.options=e||si}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Z.lex:Z.lexInline}provideParser(e=this.block){return e?Q.parse:Q.parseInline}},Na=new class{defaults=oi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Q;Renderer=Aa;TextRenderer=ja;Lexer=Z;Tokenizer=ka;Hooks=Ma;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Aa(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ka(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ma;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Ma.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Ma.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Z.lex(e,t??this.defaults)}parser(e,t){return Q.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Z.lex:Z.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Q.parse:Q.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Z.lex:Z.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Q.parse:Q.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
67
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+X(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Na.parse(e,t)}$.options=$.setOptions=function(e){return Na.setOptions(e),$.defaults=Na.defaults,ci($.defaults),$},$.getDefaults=oi,$.defaults=si,$.use=function(...e){return Na.use(...e),$.defaults=Na.defaults,ci($.defaults),$},$.walkTokens=function(e,t){return Na.walkTokens(e,t)},$.parseInline=Na.parseInline,$.Parser=Q,$.parser=Q.parse,$.Renderer=Aa,$.TextRenderer=ja,$.Lexer=Z,$.lexer=Z.lex,$.Tokenizer=ka,$.Hooks=Ma,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Q.parse,Z.lex,$.setOptions({gfm:!0,breaks:!0});var Pa={ALLOWED_TAGS:[`p`,`br`,`strong`,`em`,`del`,`code`,`pre`,`blockquote`,`ul`,`ol`,`li`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`a`,`hr`,`span`],ALLOWED_ATTR:[`href`,`title`,`target`,`rel`],ALLOWED_URI_REGEXP:/^(?:https?:|mailto:|#|\/)/i},Fa;function Ia(){if(Fa)return Fa;let e=ai();if(!e.isSupported)throw Error(`renderMarkdown: DOMPurify cannot sanitize in this environment (no usable DOM), so it refuses to render rather than return unsanitized HTML`);return e.addHook(`afterSanitizeAttributes`,e=>{let t=e;t.tagName===`A`&&t.getAttribute(`href`)&&(t.setAttribute(`target`,`_blank`),t.setAttribute(`rel`,`noopener noreferrer nofollow`))}),Fa=e}function La(e){return Ia().sanitize(e,Pa)}function Ra(e){return e?La($.parse(String(e),{async:!1})):``}function za(e){let t=[],n=``,r=()=>{let e=Ra(n);e&&t.push({kind:`html`,html:e}),n=``};for(let i of $.lexer(String(e)))i.type===`code`&&i.codeBlockStyle!==`indented`?(r(),t.push({kind:`code`,lang:String(i.lang??``).trim().split(/\s+/)[0]??``,text:String(i.text)})):n+=i.raw;return r(),t}function Ba(e,t){let n=(0,h.useRef)(t);n.current=t,(0,h.useEffect)(()=>{let t=e.current?.parentElement;if(!t)return;let r,i,a=!1,o,s=()=>{clearTimeout(r),r=void 0,i=void 0},c=e=>{a=!1,s(),e.pointerType===`touch`&&(i={id:e.pointerId,x:e.clientX,y:e.clientY},r=setTimeout(()=>{r=void 0,i=void 0,a=!0,n.current()},500))},l=e=>{i!==void 0&&e.pointerId===i.id&&Math.hypot(e.clientX-i.x,e.clientY-i.y)>8&&s()},u=e=>{i!==void 0&&e.pointerId===i.id&&s(),a&&(clearTimeout(o),o=setTimeout(()=>{a=!1},100))},d=e=>{a&&(a=!1,e.preventDefault(),e.stopPropagation())},f=e=>{(r!==void 0||a)&&e.preventDefault()};return t.addEventListener(`pointerdown`,c),t.addEventListener(`pointermove`,l),t.addEventListener(`pointerup`,u),t.addEventListener(`pointercancel`,u),t.addEventListener(`click`,d,!0),t.addEventListener(`contextmenu`,f),()=>{s(),clearTimeout(o),t.removeEventListener(`pointerdown`,c),t.removeEventListener(`pointermove`,l),t.removeEventListener(`pointerup`,u),t.removeEventListener(`pointercancel`,u),t.removeEventListener(`click`,d,!0),t.removeEventListener(`contextmenu`,f)}},[e])}function Va({msg:e,senderId:t,name:n,peer:r,onViewAgent:i}){let[a,o]=(0,h.useState)(!1),s=(0,h.useRef)(null);Ba(s,()=>o(!0));let c=D(e.ts),l=qe({view:`agent`,id:t,tab:`work`,at:e.id});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{ref:s,className:`ui-msg-acts`,children:(0,F.jsxs)(`a`,{href:l,title:c?`View ${n}'s work at ${c}`:`View ${n}'s work`,children:[(0,F.jsx)(z,{icon:bt,size:16,className:`ui-ic ui-ic16`}),`View work`]})}),a&&(0,F.jsx)(Ha,{msg:e,senderId:t,name:n,peer:r,at:c,href:l,onViewAgent:i,onClose:()=>o(!1)})]})}function Ha({msg:e,senderId:t,name:n,peer:r,at:i,href:a,onViewAgent:o,onClose:s}){let c=Hn(),l=(0,h.useId)(),u=(0,h.useRef)(!1),d=globalThis.document.body;return(0,C.createPortal)((0,F.jsxs)(gt,{onEscape:s,children:[(0,F.jsx)(`div`,{className:`ui-msg-scrim`,onPointerDown:e=>{u.current=e.target===e.currentTarget},onClick:e=>{e.target===e.currentTarget&&u.current&&s(),u.current=!1}}),(0,F.jsxs)(`div`,{className:`ui-card ui-msg-sheet`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":l,children:[(0,F.jsxs)(`div`,{className:`ui-msg-sheet-h`,id:l,children:[(0,F.jsx)(Nn,{vendor:r.harness,status:r.status,size:28,dot:!1,badge:c(t)}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:n}),(0,F.jsx)(`div`,{className:`ui-msg-sheet-sub`,children:i?`Message at ${i}`:`Message`})]})]}),(0,F.jsxs)(`a`,{className:`ui-row`,href:a,onClick:s,children:[(0,F.jsx)(z,{icon:bt,className:`ui-ic`}),(0,F.jsx)(`span`,{className:`ui-row-lbl`,children:`View ${n}'s work here`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`ui-row`,onClick:()=>{s(),o(t)},children:[(0,F.jsx)(z,{icon:Vt,className:`ui-ic`}),(0,F.jsx)(`span`,{className:`ui-row-lbl`,children:`View agent`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`ui-row`,onClick:()=>{tn(w(e.parts)),s()},children:[(0,F.jsx)(z,{icon:I,className:`ui-ic`}),(0,F.jsx)(`span`,{className:`ui-row-lbl`,children:`Copy text`})]})]})]}),d)}var Ua=(0,h.createContext)(null),Wa=280,Ga=`History does not record who sent this message. The sender shown is the one the message names, and it has not been checked.`;function Ka(e){let t=e===`claude-code`?`claude`:e;return Object.hasOwn(Wn,t)?Wn[t].label:e}function qa({msg:e,senderId:t,mode:n,idx:r,peers:i,compact:a=!1,mention:o,claim:s,place:c}){let[l,u]=(0,h.useState)(!1),d=(0,h.useContext)(Ua),f=Hn(),p=t??e.from?.id,m=p===void 0?void 0:i.get(p),g=w(e.parts),_=!l&&g.length>Wa,v=o!==void 0&&(e.mentions??[]).includes(o.toLowerCase()),y=typeof e.toService==`string`?e.toService:void 0,b=Number.isFinite(e.ts)?new Date(e.ts):void 0,x=a&&t!==void 0,S=$e(t??e.from,r),ee=t!==void 0&&i.has(t)?f(t):void 0,te=(0,F.jsx)(Nn,{vendor:m?.harness,status:m?.status??`offline`,size:34,dot:!1,badge:ee}),ne=[`ui-msg`,x&&`ui-msg-cont`,v&&`ui-msg-mention`].filter(Boolean).join(` `);return(0,F.jsxs)(`div`,{className:ne,children:[(0,F.jsx)(`div`,{className:`ui-gut`,children:!x&&(d&&t!==void 0?(0,F.jsx)(`button`,{type:`button`,className:`ui-who`,tabIndex:-1,"aria-label":S,onClick:()=>d(t),children:te}):te)}),(0,F.jsxs)(`div`,{children:[!x&&(0,F.jsxs)(`div`,{className:`ui-mh`,children:[d&&t!==void 0?(0,F.jsx)(`button`,{type:`button`,className:`ui-who`,onClick:()=>d(t),children:(0,F.jsx)(`b`,{children:S})}):(0,F.jsx)(`b`,{children:S}),t===void 0&&(0,F.jsx)(`span`,{className:`ui-unverified`,title:`History does not record who sent this message. The sender shown is the one the message names, and it has not been checked.`,children:`unverified`}),c&&(0,F.jsx)(`span`,{className:`ui-role`,children:c}),c===void 0&&m?.role&&(0,F.jsx)(`span`,{className:`ui-role`,children:m.role}),c===void 0&&m?.harness&&(0,F.jsx)(`span`,{className:`ui-hz`,children:Ka(m.harness)}),b&&(0,F.jsx)(`time`,{dateTime:b.toISOString(),children:ue(b)})]}),(0,F.jsx)(`div`,{className:_?`ui-tx ui-clamp`:`ui-tx`,dangerouslySetInnerHTML:{__html:Ra(g)}}),_&&(0,F.jsx)(`button`,{type:`button`,className:`ui-more`,onClick:()=>u(!0),children:`Show more`}),n===`anycast`&&y!==void 0&&(0,F.jsxs)(`div`,{className:`ui-route ui-route-any`,title:`Anycast: one free agent with this role takes it.`,children:[(0,F.jsx)(`i`,{}),`To any ${y}`,s!==void 0&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`span`,{className:`ui-route-sep`,children:`·`}),` `,`claimed by ${$e(s.id,r)}`,!s.verified&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`span`,{className:`ui-unverified`,title:`History does not record who sent this message. The sender shown is the one the message names, and it has not been checked.`,children:`unverified`})]})]})]})]}),t!==void 0&&m!==void 0&&i.has(t)&&(0,F.jsx)(Va,{msg:e,senderId:t,name:S,peer:m,onViewAgent:d??Ja})]})}var Ja=()=>void 0;function Ya(e){let t=Math.floor(Math.max(0,e)/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}var Xa=(e,t)=>typeof t==`number`&&Number.isFinite(t)?Math.max(0,e-t):void 0;function Za(e,t){let n=[],r=Xa(t,e.condition?.since);e.condition&&n.push(`${e.condition.code}${r===void 0?``:` for ${Ya(r)}`}`);let i=Xa(t,e.statusSince);i!==void 0&&n.push(`unchanged for ${Ya(i)}`);let a=Xa(t,e.activeAt);a!==void 0&&n.push(`active ${Ya(a)} ago`);let o=e.activity?Xa(t,e.activitySince):void 0;return o!==void 0&&n.push(`activity set ${Ya(o)} ago`),n.join(` · `)}var Qa=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,$a=c,eo=(e,t)=>n=>{if(t?.variants==null)return $a(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Qa(t)||Qa(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return $a(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},to=Object.defineProperty,no=(e,t)=>to(e,`name`,{value:t,configurable:!0}),ro=`Collapsible`,[io,ao]=u(ro),[oo,so]=io(ro),co=h.forwardRef(no(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=f({prop:r,defaultProp:i??!1,onChange:o,caller:ro});return(0,F.jsx)(oo,{scope:n,disabled:a,contentId:m(),open:c,onOpenToggle:h.useCallback(()=>l(e=>!e),[l]),children:(0,F.jsx)(p.div,{"data-state":ho(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),lo=`CollapsibleTrigger`,uo=h.forwardRef(no(function(e,t){let{__scopeCollapsible:n,...r}=e,i=so(lo,n);return(0,F.jsx)(p.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":ho(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:o(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),fo=`CollapsibleContent`,po=h.forwardRef(no(function(e,t){let{forceMount:n,...r}=e,i=so(fo,e.__scopeCollapsible);return(0,F.jsx)(l,{present:n||i.open,children:({present:e})=>(0,F.jsx)(mo,{...r,ref:t,present:e})})},`CollapsibleContent`)),mo=h.forwardRef(no(function(e,t){let{__scopeCollapsible:i,present:a,children:o,...s}=e,c=so(fo,i),[l,u]=h.useState(a),d=h.useRef(null),f=r(t,d),m=h.useRef(0),g=m.current,_=h.useRef(0),v=_.current,y=c.open||l,b=h.useRef(y),x=h.useRef(void 0);return h.useEffect(()=>{let e=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(e)},[]),n(()=>{let e=d.current;if(e){x.current=x.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();m.current=t.height,_.current=t.width,b.current||(e.style.transitionDuration=x.current.transitionDuration,e.style.animationName=x.current.animationName),u(a)}},[c.open,a]),(0,F.jsx)(p.div,{"data-state":ho(c.open),"data-disabled":c.disabled?``:void 0,id:c.contentId,hidden:!y,...s,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:y&&o})},`CollapsibleContentImpl`));function ho(e){return e?`open`:`closed`}no(ho,`getState`);var go=eo(`group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground`,{variants:{variant:{default:``,separator:`before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border`,border:`border-b border-border pb-2`}}});function _o({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?s:`div`;return(0,F.jsx)(i,{"data-slot":`marker`,"data-variant":t,className:d(go({variant:t,className:e})),...r})}function vo({className:e,...t}){return(0,F.jsx)(`span`,{"data-slot":`marker-icon`,"aria-hidden":`true`,className:d(`size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...t})}function yo({className:e,...t}){return(0,F.jsx)(`span`,{"data-slot":`marker-content`,className:d(`min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var bo={dnd:{icon:Pt,word:`Do not disturb`,color:`var(--uni-ink)`,title:`Channel messages wait for its next turn. DMs and mentions still wake it.`},focus:{icon:Rt,word:`Focus`,color:`var(--multi-ink)`,title:`Channel messages stay in the channel. DMs and role requests still reach it.`}};function xo({attention:e}){if(e===void 0||!Object.hasOwn(bo,e))return null;let t=bo[e];return(0,F.jsxs)(`span`,{className:`v3-meta`,style:{color:t.color},title:t.title,children:[(0,F.jsx)(z,{icon:t.icon,size:16,className:`ui-ic ui-ic16`}),t.word]})}var So=[];function Co(e,t){(0,h.useEffect)(()=>{if(e)return e.openSession(t),()=>e.closeSession(t)},[e,t])}function wo(e){let t=e?.condition;if(typeof t==`object`&&t&&typeof t.code==`string`)return typeof t.since==`number`?{code:t.code,since:t.since}:{code:t.code}}function To(e,t){let n=pt(e,e=>e.sessions[t]?.posts)??So,r=pt(e,e=>e.dms);return(0,h.useMemo)(()=>{let e=new Set(n.map(e=>e.msg.id)),i=r.filter(n=>n.senderId===t&&typeof n.msg.to==`string`&&!e.has(n.msg.id));return i.length===0?n:[...n,...i]},[n,r,t])}function Eo(e){let[t]=(0,h.useState)(e),[n,r]=(0,h.useState)(!1);return!n&&e!==t&&r(!0),n||e!==t?`ui-xfade`:void 0}function Do({className:e,...t}){return(0,F.jsx)(en,{icon:jt,strokeWidth:2,"data-slot":`spinner`,"aria-hidden":`true`,className:d(`size-4 animate-spin [animation-duration:1.6s] motion-reduce:animate-none`,e),...t})}function Oo({...e}){return(0,F.jsx)(co,{"data-slot":`collapsible`,...e})}function ko({...e}){return(0,F.jsx)(uo,{"data-slot":`collapsible-trigger`,...e})}function Ao({...e}){return(0,F.jsx)(po,{"data-slot":`collapsible-content`,...e})}function jo({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`trace`,className:d(`flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-lg *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/30`,e),...t})}function Mo({className:e,status:t,...n}){return(0,F.jsx)(`span`,{"data-slot":`trace-line`,"data-status":t,className:d(`flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer data-[status=running]:*:data-[slot=trace-title]:shimmer-color-foreground data-[status=running]:*:data-[slot=trace-title]:shimmer-duration-2400`,e),...n})}function No({className:e,...t}){return(0,F.jsx)(`span`,{"data-slot":`trace-icon`,"aria-hidden":`true`,className:d(`flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1`,e),...t})}function Po({className:e,...t}){return(0,F.jsx)(`span`,{"data-slot":`trace-title`,className:d(`min-w-0 truncate motion-reduce:shimmer-none`,e),...t})}function Fo({className:e,...t}){return(0,F.jsx)(`span`,{"data-slot":`trace-description`,className:d(`shrink-0 text-muted-foreground/70 tabular-nums`,e),...t})}function Io({className:e,...t}){return(0,F.jsx)(Oo,{"data-slot":`trace-collapsible`,className:d(`flex w-full min-w-0 flex-col`,e),...t})}function Lo({className:e,children:t,...n}){return(0,F.jsxs)(ko,{"data-slot":`trace-collapsible-trigger`,className:d(`group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-lg text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/30 has-[[data-status=error]]:text-destructive`,e),...n,children:[t,(0,F.jsx)(No,{className:`transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90`,children:(0,F.jsx)(en,{icon:vt,strokeWidth:2})})]})}function Ro({className:e,children:t,...n}){return(0,F.jsx)(Ao,{"data-slot":`trace-collapsible-content`,className:`min-w-0 overflow-hidden duration-200 [--radix-accordion-content-height:var(--radix-collapsible-content-height)] data-open:animate-accordion-down data-closed:animate-accordion-up`,...n,children:(0,F.jsx)(`div`,{"data-slot":`trace-collapsible-content-inner`,className:d(`mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground`,e),children:t})})}function zo(e){let[t,n]=(0,h.useState)(()=>Date.now()),[r,i]=(0,h.useState)(e);return e!==r&&(i(e),e&&n(Date.now())),(0,h.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}var Bo={command:Tt,edit:L,write:L,read:Et,send:Ft,dm:Ft,inbox:kt,other:Ht},Vo=e=>Bo[e],Ho=`The connector reports the call returned an error. It doesn't publish the error text or the command.`,Uo=`The connector reports the call returned an error. It doesn't publish the error text or the tool's input.`,Wo=(0,h.lazy)(()=>R(()=>import(`./FailedTip-DfF85PmB.js`),__vite__mapDeps([0,1,2,3])));function Go(e,t){if(t===`running`)return(0,F.jsx)(Do,{});let n=t===`failed`?wt:t===`pending`?Ot:t===`noResult`?Bt:Vo(e.kind);return(0,F.jsx)(z,{icon:n,size:16})}function Ko({call:e,state:t,shimmer:n=!0,className:r}){let i=zo(t===`running`),a=Eo(t),o=t===`running`?n?`running`:void 0:t===`failed`?`error`:t===`pending`||t===`noResult`?`pending`:void 0,s=Le(e,t,i),c=Ae(e.name),l=[`ox-line`,r,a].filter(Boolean).join(` `),u=(0,F.jsxs)(Mo,{status:o,role:o===`running`?`status`:void 0,className:l,children:[(0,F.jsx)(No,{children:Go(e,t)}),(0,F.jsx)(Po,{title:t===`called`?e.full:void 0,children:je(e.kind,t,e.name)}),` `,s&&(0,F.jsx)(Fo,{children:t===`called`?s:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`code`,{title:e.full,children:c}),t===`running`?(0,F.jsx)(`span`,{"aria-hidden":`true`,children:s.slice(c.length)}):s.slice(c.length)]})})]},t);return t===`failed`?(0,F.jsx)(h.Suspense,{fallback:u,children:(0,F.jsx)(Wo,{line:u,words:e.kind===`command`?Ho:Uo})}):u}var qo=eo(`group/button inline-flex shrink-0 items-center justify-center rounded-2xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-transparent dark:hover:bg-input/30`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5`,xs:`h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,lg:`h-9 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function Jo({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?s:`button`;return(0,F.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:d(qo({variant:t,size:n,className:e})),...i})}function Yo({children:e}){return(0,F.jsxs)(`div`,{className:`ui-plane`,children:[(0,F.jsx)(z,{icon:At,size:16,className:`ui-ic`}),(0,F.jsx)(`span`,{children:e})]})}function Xo({row:e}){let t=Object.hasOwn(wn,e.status)?wn[e.status]:void 0,n=dt(e),r=Eo(e.status),i=e.activity||void 0,a;if(e.status===`working`||e.status===`waiting`){let t=D(e.statusSince);a=[i&&(/[.!?]$/.test(i)?i:`${i}.`),t&&`Reported ${t}.`].filter(Boolean).join(` `)||void 0}else if(e.status===`offline`){let t=D(e.ts);a=t&&`Last heartbeat ${t}.`}else e.status===`idle`&&(a=`No current activity.`);return(0,F.jsxs)(`div`,{className:r?`ox-foot ${r}`:`ox-foot`,children:[(0,F.jsx)(`span`,{className:`v3-spill v3-s-${e.status}`,children:t&&(0,F.jsx)(z,{icon:t,size:16,className:`ui-ic`})}),(0,F.jsx)(`b`,{children:e.name}),` is ${n} `,a&&(0,F.jsx)(`span`,{className:e.status===`waiting`?`ox-foot-wait`:void 0,children:a})]},e.status)}var Zo=()=>Promise.all([R(()=>import(`./core-Bfff_dYO.js`),__vite__mapDeps([4,1])),R(()=>import(`./engine-javascript-C30F4iNc.js`),[])]),Qo=new Map([[`javascript`,()=>R(()=>import(`./javascript-BgS3c2Ky.js`),[])],[`typescript`,()=>R(()=>import(`./typescript-bsJCZSQ-.js`),[])],[`json`,()=>R(()=>import(`./json-qhed-kSA.js`),[])],[`bash`,()=>R(()=>import(`./bash-CLZ0U2zV.js`),[])],[`diff`,()=>R(()=>import(`./diff-woXpYk--.js`),[])],[`python`,()=>R(()=>import(`./python-gzcpVVnB.js`),[])],[`yaml`,()=>R(()=>import(`./yaml-rwi0_p6S.js`),[])],[`markdown`,()=>R(()=>import(`./markdown-BYOwaDjH.js`),[])]]),$o=new Map([[`js`,`javascript`],[`javascript`,`javascript`],[`ts`,`typescript`],[`typescript`,`typescript`],[`json`,`json`],[`bash`,`bash`],[`sh`,`bash`],[`shell`,`bash`],[`zsh`,`bash`],[`diff`,`diff`],[`python`,`python`],[`py`,`python`],[`yaml`,`yaml`],[`yml`,`yaml`],[`markdown`,`markdown`],[`md`,`markdown`]]),es=`cotal`,ts=1e3,ns,rs=new Map;function is(){return ns??=Zo().then(([{createHighlighterCore:e,createCssVariablesTheme:t},{createJavaScriptRegexEngine:n}])=>e({themes:[t({name:es,variablePrefix:`--shiki-`,fontStyle:!1})],langs:[],engine:n({forgiving:!0})})).catch(e=>{throw ns=void 0,e}),ns}function as(e,t){let n=rs.get(t);return n||(n=e.loadLanguage(Qo.get(t)).catch(e=>{throw rs.delete(t),e}),rs.set(t,n)),n}async function os(e,t){let n=$o.get(t.toLowerCase());if(n!==void 0&&!(e.length>2e4))try{let t=await is();return await as(t,n),t.codeToTokens(e,{lang:n,theme:es,tokenizeMaxLineLength:ts}).tokens.map(e=>e.map(e=>e.color===void 0?{content:e.content}:{content:e.content,color:e.color}))}catch(e){console.error(`highlighting a code block failed, so it stays plain:`,e);return}}var ss=eo(`group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-2xl text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/30 data-[size=sm]:rounded-xl data-[size=sm]:text-xs`,{variants:{variant:{default:`bg-muted text-foreground ring-1 ring-foreground/5 dark:ring-foreground/10`,destructive:`bg-destructive/5 text-destructive ring-1 ring-destructive/15 dark:bg-destructive/10 dark:ring-destructive/20`}},defaultVariants:{variant:`default`}});function cs({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,F.jsx)(`div`,{"data-slot":`code-block`,"data-variant":t,"data-size":n,className:d(ss({variant:t}),e),...r})}function ls({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`code-block-header`,className:d(`flex min-w-0 shrink-0 items-center gap-2 px-4 pt-4 text-muted-foreground group-data-[size=sm]/code-block:px-3 group-data-[size=sm]/code-block:pt-3 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0`,e),...t})}function us({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`code-block-actions`,className:d(`-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 *:data-[slot=button]:hover:bg-foreground/5 dark:*:data-[slot=button]:hover:bg-foreground/10 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-3 [[data-slot=code-block]>&]:top-3 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-2 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10`,e),...t})}function ds({className:e,children:t,style:n,wrap:r=!1,lineNumbers:i=!1,startLine:a=1,...o}){return(0,F.jsx)(`pre`,{"data-slot":`code-block-content`,"data-wrap":r||void 0,"data-numbered":i||void 0,dir:`ltr`,tabIndex:0,style:{counterReset:`line ${a-1}`,...n},className:d(`min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-4 py-4 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-3 group-data-[size=sm]/code-block:py-3 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap`,e),...o,children:(0,F.jsx)(`code`,{"data-slot":`code-block-code`,className:`grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0`,children:i&&typeof t==`string`?t.replace(/\n$/,``).split(`
68
- `).map((e,t)=>(0,F.jsx)(ps,{children:e},t)):t})})}var fs=eo(`relative -mx-4 block min-h-lh px-4 group-data-[size=sm]/code-block:-mx-3 group-data-[size=sm]/code-block:px-3 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']`,{variants:{variant:{default:``,added:`bg-foreground/5 after:content-['+']`,removed:`bg-destructive/10 after:text-destructive after:content-['−']`,highlighted:`bg-foreground/5`}},defaultVariants:{variant:`default`}});function ps({className:e,variant:t=`default`,children:n,...r}){let i=n==null||n===``||Array.isArray(n)&&n.length===0;return(0,F.jsx)(`span`,{"data-slot":`code-block-line`,"data-variant":t,className:d(fs({variant:t}),e),...r,children:(0,F.jsx)(`span`,{"data-slot":`code-block-line-content`,className:`min-w-0`,children:i?`
69
- `:n})})}function ms({lang:e,text:t}){let n=(0,h.useRef)(null),[r,i]=(0,h.useState)(void 0);(0,h.useEffect)(()=>{let r=!0,a=()=>void os(t,e).then(n=>{r&&n&&i({text:t,lang:e,lines:n})}),o=globalThis.IntersectionObserver;if(!o||!n.current)return a(),()=>{r=!1};let s=new o(e=>{e.some(e=>e.isIntersecting)&&(s.disconnect(),a())});return s.observe(n.current),()=>{r=!1,s.disconnect()}},[t,e]);let a=r?.text===t&&r.lang===e?r.lines:void 0;return(0,F.jsxs)(cs,{ref:n,size:`sm`,className:`ox-code`,children:[(0,F.jsxs)(ls,{className:`ox-code-h`,children:[e&&(0,F.jsx)(`span`,{title:e,children:Ae(e,24)}),` `,(0,F.jsx)(us,{className:`ox-code-acts`,children:(0,F.jsxs)(Jo,{type:`button`,variant:`ghost`,size:`xs`,className:`ox-copy`,onClick:()=>tn(t),children:[(0,F.jsx)(z,{icon:I,size:16}),`Copy`]})})]}),(0,F.jsx)(ds,{className:`ox-code-c`,children:a?a.map((e,t)=>(0,F.jsx)(ps,{children:e.map((e,t)=>(0,F.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))},t)):t})]})}var hs=280,gs=e=>e.replace(/<[^>]*>/g,``).length;function _s({src:e,className:t,clamp:n=!0}){let r=(0,h.useMemo)(()=>za(e),[e]),[i,a]=(0,h.useState)(!1),o=n&&r.some(e=>e.kind===`html`&&gs(e.html)>hs);return(0,F.jsxs)(`div`,{className:t,children:[r.map((e,t)=>e.kind===`code`?(0,F.jsx)(ms,{lang:e.lang,text:e.text},t):(0,F.jsx)(`div`,{className:o&&!i&&gs(e.html)>hs?`ox-prose ui-clamp`:`ox-prose`,dangerouslySetInnerHTML:{__html:e.html}},t)),o&&(0,F.jsx)(`button`,{type:`button`,className:`ui-more`,"aria-expanded":i,onClick:()=>a(!i),children:i?`Show less`:`Show more`})]})}function vs({ts:e}){let t=E(e);return t?(0,F.jsx)(`time`,{dateTime:t.toISOString(),children:ue(t)}):null}function ys({msg:e,agent:t,channel:n,to:r,toName:i,compact:a=!1,highlight:o=!1}){let s=n===void 0,c=[`ox-post`,s&&`ox-post-dm`,o&&`ox-post-hl`].filter(Boolean).join(` `),l=qe(s?{view:`dm`,peer:t,...r===void 0?{}:{with:r}}:{view:`channel`,channel:n});return(0,F.jsxs)(`div`,{className:c,"data-post":e.id,children:[(0,F.jsxs)(`div`,{className:`ox-post-h`,children:[(0,F.jsx)(z,{icon:s?Ct:Dt,size:16}),(0,F.jsx)(`span`,{children:s?`Sent to ${i??r??``}`:`Posted in #${n}`}),(0,F.jsx)(vs,{ts:e.ts}),!a&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsxs)(`a`,{className:`ox-act`,href:l,children:[s?`Open conversation`:`Open in #${n}`,(0,F.jsx)(z,{icon:bt,size:16})]})]})]}),(0,F.jsx)(_s,{className:`ui-tx`,src:w(e.parts),clamp:!a})]})}var bs=(e,t)=>t?`${e} …`:e,xs=/^ {0,3}```/gm;function Ss(e,t){return t?(e.match(xs)??[]).length%2==1?`${e}\n\`\`\`\n …`:`${e} …`:e}function Cs({text:e,cut:t,compact:n=!1}){return(0,F.jsx)(_s,{className:`ox-said`,src:Ss(e,t),clamp:!n})}var ws=280;function Ts({text:e,cut:t}){let[n,r]=(0,h.useState)(!1),i=Ss(e,t),a=i.length>ws;return(0,F.jsxs)(`div`,{className:`ui-prompt`,children:[(0,F.jsx)(`span`,{children:`Prompt`}),(0,F.jsx)(`div`,{className:a&&!n?`ui-tx ui-clamp`:`ui-tx`,dangerouslySetInnerHTML:{__html:Ra(i)}}),a&&(0,F.jsx)(`button`,{type:`button`,className:`ui-more`,"aria-expanded":n,onClick:()=>r(!n),children:n?`Show less`:`Show more`})]})}function Es({text:e,cut:t}){return(0,F.jsxs)(Io,{children:[(0,F.jsx)(Lo,{className:`ox-trig`,children:(0,F.jsxs)(Mo,{className:`ox-line`,children:[(0,F.jsx)(No,{children:(0,F.jsx)(z,{icon:St,size:16})}),(0,F.jsx)(Po,{children:`Reasoning`})]})}),(0,F.jsx)(Ro,{className:`ox-cc`,children:(0,F.jsx)(`div`,{className:`ox-think`,children:bs(e,t)})})]})}function Ds({ts:e,condition:t}){return(0,F.jsxs)(`div`,{className:`ui-runerr`,children:[(0,F.jsx)(z,{icon:_t,size:18,className:`ui-ic`}),(0,F.jsx)(`b`,{children:E(e)?(0,F.jsxs)(F.Fragment,{children:[`Turn failed at `,(0,F.jsx)(vs,{ts:e})]}):`Turn failed`}),(0,F.jsx)(`span`,{children:`The event plane doesn't say why.`}),t!==void 0&&(0,F.jsxs)(`span`,{children:[`Presence reports `,(0,F.jsx)(`code`,{children:t.code}),E(t.since)&&(0,F.jsxs)(F.Fragment,{children:[` since `,(0,F.jsx)(vs,{ts:t.since})]}),`.`]})]})}function Os(e,t){if(!t)return Ht;let n=new Map;for(let t of e)n.set(t.kind,(n.get(t.kind)??0)+1);let r=Math.max(...n.values()),i=[...n].filter(([,e])=>e===r);return i.length===1?Vo(i[0][0]):Ht}function ks({calls:e,at:t,toolStatus:n,line:r=!1,className:i}){let{title:a,failed:o}=Me(e,n),s=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(No,{children:(0,F.jsx)(z,{icon:Os(e,n),size:16})}),(0,F.jsxs)(Po,{children:[a,o>0&&(0,F.jsxs)(F.Fragment,{children:[`, `,(0,F.jsxs)(`span`,{className:`ox-fail`,children:[(0,F.jsx)(z,{icon:wt,size:16}),`${o} failed`]})]})]})]});return r?(0,F.jsx)(Mo,{className:i?`ox-line ${i}`:`ox-line`,children:s}):(0,F.jsxs)(Io,{className:i,children:[(0,F.jsx)(Lo,{className:`ox-trig`,children:(0,F.jsxs)(Mo,{className:`ox-line`,children:[s,` `,(0,F.jsx)(Fo,{children:Re(e,n)})]})}),(0,F.jsx)(Ro,{className:`ox-cc`,children:(0,F.jsx)(jo,{className:`ox-calls`,children:e.map(e=>(0,F.jsx)(Ko,{call:e,state:we(e,{...t,toolStatus:n})},e.key))})})]})}var As=(0,h.createContext)(()=>!1),js=new Set([`done`,`failed`,`called`]);function Ms({step:e,at:t,toolStatus:n,compact:r}){let i=(0,h.useContext)(As),a=e.calls.map(e=>we(e,{...t,toolStatus:n})),o=e.calls.length>=2&&a.every(e=>js.has(e)),s=Eo(o?`group`:`lines`),[c,l]=(0,h.useState)(o),[u,d]=(0,h.useState)(!1);if(c!==o&&(l(o),d(o)),o)return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ks,{calls:e.calls,at:t,toolStatus:n,line:r,className:s},`group`),u&&(0,F.jsx)(`div`,{className:`ox-fold`,"aria-hidden":`true`,style:{"--fold-n":e.calls.length-1},onAnimationEnd:()=>d(!1),children:e.calls.slice(1).map((e,t)=>(0,F.jsx)(Ko,{call:e,state:a[t+1]},e.key))})]});let f=a.lastIndexOf(`running`);return(0,F.jsx)(F.Fragment,{children:e.calls.map((e,t)=>(0,F.jsx)(Ko,{call:e,state:a[t],shimmer:t===f,className:t>0&&i(e)?`ui-in`:void 0},e.key))})}function Ns({ts:e}){return(0,F.jsxs)(Mo,{className:`ox-line`,children:[(0,F.jsx)(No,{children:(0,F.jsx)(z,{icon:zt,size:16})}),(0,F.jsx)(Po,{children:`Turn ended`}),` `,(0,F.jsx)(Fo,{children:(0,F.jsx)(vs,{ts:e})})]})}function Ps({label:e,ts:t}){return(0,F.jsxs)(Mo,{className:`ox-line`,children:[(0,F.jsx)(No,{children:(0,F.jsx)(z,{icon:At,size:16})}),(0,F.jsx)(Po,{children:e}),` `,(0,F.jsx)(Fo,{children:(0,F.jsx)(vs,{ts:t})})]})}function Fs({step:e,turn:t,trailing:n,ctx:r,condition:i}){switch(e.kind){case`prompt`:return r.compact?null:(0,F.jsx)(Ts,{text:e.text,cut:e.cut});case`reasoning`:return r.compact?null:(0,F.jsx)(Es,{text:e.text,cut:e.cut});case`said`:return(0,F.jsx)(Cs,{text:e.text,cut:e.cut,compact:r.compact});case`tools`:return(0,F.jsx)(Ms,{step:e,at:{turn:t,trailing:n,status:r.row.status},toolStatus:r.toolStatus,compact:r.compact});case`post`:return(0,F.jsx)(ys,{msg:e.msg,agent:r.row.id,...e.channel===void 0?{to:e.to,toName:r.nameOf(e.to??``)}:{channel:e.channel},compact:r.compact,highlight:r.highlight!==void 0&&e.msg.id===r.highlight});case`runError`:return(0,F.jsx)(Ds,{ts:e.ts,condition:i});case`unknown`:return(0,F.jsx)(Ps,{label:e.label,ts:e.ts})}}function Is({turn:e,row:t}){let n=e.outcome===`open`&&!e.superseded,r=n&&t.status===`working`,i=zo(n&&(t.status===`working`||t.status===`waiting`)),{title:a,failed:o}=Pe(e,t.status,i),s=Ie(e),c=r?(0,F.jsx)(Do,{className:`ox-live`}):(0,F.jsx)(z,{icon:e.outcome===`finished`?zt:e.outcome===`failed`?_t:n&&t.status===`waiting`?Ot:Bt,size:16});return(0,F.jsxs)(Mo,{status:e.outcome===`failed`?`error`:void 0,className:`ox-line`,children:[(0,F.jsx)(No,{children:c}),(0,F.jsxs)(Po,{children:[r?(0,F.jsx)(`b`,{children:a}):a,o!==void 0&&(0,F.jsxs)(F.Fragment,{children:[`, `,(0,F.jsxs)(`span`,{className:`ox-fail`,children:[(0,F.jsx)(z,{icon:wt,size:16}),o]})]})]}),` `,s&&(0,F.jsx)(Fo,{children:s})]})}function Ls({turn:e,row:t,toolStatus:n,defaultOpen:r,highlight:i,condition:a,nameOf:o}){let s=(0,h.useContext)(As),[c,l]=(0,h.useState)(void 0),u=c??r,d={row:t,toolStatus:n,compact:!1,nameOf:o,...i===void 0?{}:{highlight:i}},f=e.steps.at(-1),p=e.steps.findLast(e=>e.kind!==`runError`);return(0,F.jsxs)(Io,{open:u,onOpenChange:l,children:[(0,F.jsx)(Lo,{className:`ox-trig`,children:(0,F.jsx)(Is,{turn:e,row:t})}),(0,F.jsx)(Ro,{className:`ox-cc`,children:(0,F.jsx)(jo,{className:`ox-turn`,children:e.steps.map(t=>(0,F.jsx)(`div`,{className:s(t)?`ox-step ui-in`:`ox-step`,children:(0,F.jsx)(Fs,{step:t,turn:e,trailing:t===p,ctx:d,condition:t===f?a:void 0})},t.key))})})]})}function Rs(e){let t=[],n=e=>{for(let r of e)t.push(r),r.kind===`turn`?n(r.steps):r.kind===`tools`&&t.push(...r.calls)};return n(e),t}function zs(e,t){let n=(0,h.useRef)(void 0),r=n.current?.id===t?n.current:void 0;return(0,h.useEffect)(()=>{let r=Rs(e),i=n.current;if(i?.id!==t)n.current={id:t,known:new Set(r.map(e=>e.key)),rising:new Set};else for(let e of r)i.known.has(e.key)||(i.known.add(e.key),e.live&&i.rising.add(e.key))}),e=>r!==void 0&&(r.rising.has(e.key)||e.live&&!r.known.has(e.key))}function Bs(e,t){let n=e.filter(e=>e.kind===`turn`);return(t===void 0?void 0:n.find(e=>e.steps.some(e=>e.kind===`post`&&e.msg.id===t)))??n.findLast(e=>e.outcome===`open`&&!e.superseded)??n.at(-1)}function Vs({work:e,row:t,highlight:n,compact:r=!1,condition:i,nameOf:a}){let o=zs(e.items,t.id),s=Bs(e.items,n),c={row:t,toolStatus:e.toolStatus,compact:r,nameOf:a,...n===void 0?{}:{highlight:n}},l=e=>!r||e.kind!==`prompt`&&e.kind!==`reasoning`,u=e.items.at(-1),d=(e,t,n,r)=>(0,F.jsx)(`div`,{className:o(e)?`ox-step ui-in`:`ox-step`,children:e.kind===`turnEnd`?(0,F.jsx)(Ns,{ts:e.ts}):(0,F.jsx)(Fs,{step:e,turn:t,trailing:n,ctx:c,condition:r})},e.key);return(0,F.jsx)(As.Provider,{value:o,children:(0,F.jsxs)(jo,{className:r?`ox-work ox-compact`:`ox-work`,children:[!e.toolStatus&&(0,F.jsx)(Yo,{children:`${t.name}'s connector reports which tools it calls but not when they finish, so Work can't show running, done or failed. A connector that reports tool results shows them here once ${t.name} restarts on it.`}),e.items.filter(l).map(c=>{if(c.kind!==`turn`)return d(c,void 0,c===u,c===u?i:void 0);if(r){let e=c.steps.findLast(e=>e.kind!==`runError`),t=c.steps.at(-1);return c.steps.filter(l).map(n=>d(n,c,n===e,c===u&&n===t?i:void 0))}return(0,F.jsx)(`div`,{className:o(c)?`ox-step ui-in`:`ox-step`,children:(0,F.jsx)(Ls,{turn:c,row:t,toolStatus:e.toolStatus,defaultOpen:c===s,highlight:n,condition:c===u?i:void 0,nameOf:a})},c.key)}),!r&&(0,F.jsx)(Xo,{row:t})]})})}var Hs=(0,h.createContext)(e=>Xe(globalThis,e)),Us=e=>Number.isSafeInteger(e)&&e>=0,Ws=e=>e&&typeof e==`object`?e.msg||e:void 0;function Gs(e){try{let t=Ws(e),n=t&&t.parts;if(!Array.isArray(n))return;for(let e of n)if(e&&typeof e==`object`&&e.kind===`ag-ui.frame`&&Us(e.seq))return e;return}catch{return}}function Ks(e,t){let n=Ws(e),r=n&&n.from;return JSON.stringify([r&&typeof r.id==`string`?r.id:null,typeof t.epoch==`string`?t.epoch:null,typeof t.threadId==`string`?t.threadId:null])}function qs(){let e=new Map,t=[],n=!1,r=t=>{let n=e.get(t);return n||(n={baseline:void 0,next:void 0,prefixIncomplete:!1,faulted:!1,released:!1,seen:new Set},e.set(t,n)),n},i=(e,t,n,r)=>{let i=[];if(e.seen.has(n))return{emit:!1,notes:i};if(e.seen.add(n),n>e.next){let a={key:t,expected:e.next,got:n,missing:n-e.next};r?i.push({type:`boundary-hole`,...a}):(i.push({type:`gap`,...a}),e.faulted=!0)}return n>=e.next&&(e.next=n+1),{emit:!0,notes:i}};return{live(e){let a=Gs(e);if(!a)return{emit:[e],held:!1,notes:[]};if(!n)return t.push(e),{emit:[],held:!0,notes:[]};let o=Ks(e,a),s=r(o);s.next===void 0&&(s.baseline=a.seq,s.next=a.seq,s.prefixIncomplete=a.seq>1);let c=i(s,o,a.seq);return{emit:c.emit?[e]:[],held:!1,notes:c.notes}},backfill(a){let o=[],s=Array.isArray(a)?a.slice():[];for(let e of s){let t=Gs(e);if(!t)continue;let n=r(Ks(e,t));(n.baseline===void 0||t.seq<n.baseline)&&(n.baseline=t.seq),n.seen.add(t.seq)}for(let[t,n]of e){if(n.baseline===void 0)continue;let e=n.baseline;for(let t of n.seen)t>e&&(e=t);n.next=e+1,n.prefixIncomplete=n.baseline>1,n.prefixIncomplete&&o.push({type:`prefix-incomplete`,key:t,baseline:n.baseline});let r=0;for(let i=n.baseline+1;i<=e;i++)n.seen.has(i)?r>0&&(o.push({type:`gap`,key:t,expected:i-r,got:i,missing:r}),n.faulted=!0,r=0):r++}let c=t.map((e,t)=>({entry:e,frame:Gs(e),i:t})).filter(e=>e.frame!==void 0);c.sort((e,t)=>e.frame.seq-t.frame.seq||e.i-t.i);for(let e of c){let t=Ks(e.entry,e.frame),n=r(t);n.next===void 0&&(n.baseline=e.frame.seq,n.next=e.frame.seq,n.prefixIncomplete=e.frame.seq>1,n.prefixIncomplete&&o.push({type:`prefix-incomplete`,key:t,baseline:n.baseline}));let a=!n.released;n.released=!0;let c=i(n,t,e.frame.seq,a);for(let e of c.notes)o.push(e);c.emit&&s.push(e.entry)}return t.length=0,n=!0,{emit:s,notes:o}},get settled(){return n},get pendingCount(){return t.length},state(t){let n=e.get(t);return n===void 0?void 0:{baseline:n.baseline,next:n.next,prefixIncomplete:n.prefixIncomplete,faulted:n.faulted}},get chainKeys(){return[...e.keys()]}}}var Js=500,Ys=250,Xs=2e3,Zs={text:``,outgoing:[]};function Qs(e,...t){let n=new Map;for(let e of t)for(let t of e)t?.msg?.id!==void 0&&t.senderId!==void 0&&n.set(t.msg.id,t);return n.size?e.map(e=>(e?.msg?.id===void 0?void 0:n.get(e.msg.id))??e):e}var $s=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function ec(e,t,n){let r=new Set(e.map(e=>e.id)),i=e;for(let a of t){let t=he(a,n);if(!t.some(e=>r.has(e.id))){i===e&&(i=e.slice());for(let e of t)r.add(e.id),i.push(e)}}return i}function tc(e){let t=ve(e),n=0;for(;t>2e3&&n<e.length-1;)t-=e[n++].events.length;return{frames:n?e.slice(n):e,dropped:n>0}}function nc(e,t){let n=new Set,r=[],i=(e,i)=>{e&&i===t&&!n.has(e.id)&&(n.add(e.id),r.push({msg:e,senderId:i}))};for(let t of e.activity)t?.mode===`chat`&&i(t.msg,t.senderId);for(let t of e.open?.messages??[])i(t?.msg,t?.senderId);return r.sort((e,t)=>$s(e.msg.ts)-$s(t.msg.ts)).slice(-500)}function rc(e,t,n={}){let r=n.createOrder??(()=>qs()),i=n.clock??Date.now,a=r(`feed`),o=r(`open`),s=[],c=[],l=null,u=null,d=0,f=new Set,p=(e,t)=>n=>{f.has(e)||t(n)},m=new Map,h=(t,n)=>e.set(e=>({loading:{roster:e.loading.roster&&!t,channels:e.loading.channels&&!n}})),_=t=>{t.length&&e.set(e=>({orderNotes:[...e.orderNotes,...t].slice(-50)}))},v=(t,n)=>e.set(e=>{let r=e.stale.filter(e=>e.name!==t);return{stale:n?[...r,n]:r}}),y=t=>e.set(e=>({membership:{snapshot:e.membership.snapshot,unreadable:t}})),b=(t,n)=>e.set(e=>({drafts:{...e.drafts,[t]:n(e.drafts[t]??Zs)}})),x=new Map,S=null,ee=(e,t)=>{let n=(x.get(e)??0)+t;n>0?x.set(e,n):x.delete(e)},te=e=>{if(S!==e){x=new Map;for(let t of e)ee(t.msg.id,1);S=e}return x},ne=0,C=()=>{let t=e.get();if(!Object.values(t.drafts).some(e=>e.outgoing.some(e=>e.id!==void 0)))return;let n=new Set;for(let e of[t.activity,t.dms,t.open?.messages??[]])for(let t of e)t?.msg?.id&&n.add(t.msg.id);let r=e=>e.id!==void 0&&n.has(e.id);Object.values(t.drafts).some(e=>e.outgoing.some(r))&&e.set(e=>({drafts:Object.fromEntries(Object.entries(e.drafts).map(([e,t])=>[e,{...t,outgoing:t.outgoing.filter(e=>!r(e))}]))}))},ie=t=>e.set(e=>({space:t.space,post:t.post,operatorId:t.operatorId??e.operatorId??null})),oe=0,se=-1,ce=!1,le=()=>{if(ce||se===oe)return;let n=e.get();!n.operatorId&&n.roster.some(e=>e.card.name===`operator`&&e.card.role===`operator`)&&(se=oe,ce=!0,t.meta().then(ie,()=>void 0).finally(()=>{ce=!1,le()}))},w=null,T=new Map,E=new Map,ue=(e,t)=>{let n=(E.get(e)??Promise.resolve()).then(t),r=n.catch(()=>void 0);return E.set(e,r),r.then(()=>{E.get(e)===r&&E.delete(e)}),n},D=(t,n)=>e.set(e=>{let r=e.sessions[t];return r?{sessions:{...e.sessions,[t]:n(r)}}:{}}),de=({reason:e,grant:t,...n})=>({...n,load:`ok`});async function fe(e,n,r,i){let a=++n.reads,o=()=>T.get(e)===n&&n.reads===a;D(e,e=>({...e,limit:r}));try{let n=w;if(i&&n!==null?await ue(e,()=>t.watch(e,n)):await E.get(e),!o())return;let a=await t.agentEvents(e,r);if(!o())return;if(`refused`in a){D(e,e=>({...e,load:`refused`,reason:a.refused,grant:a.grant}));return}D(e,e=>{let t=ec(e.frames,a.frames,!1),n=tc(t===e.frames?t:t.slice().sort((e,t)=>$s(e.ts)-$s(t.ts)));return de({...e,frames:n.frames,more:a.more||n.dropped})})}catch(t){if(!o())return;let n=t instanceof Error?t.message:String(t);D(e,({grant:e,...t})=>({...t,load:`failed`,reason:n}))}}let O=t=>{let n=e.get().roster.find(e=>e.card.id===t);return n!==void 0&&ct([n],{includeOffline:!0})[0]?.events===`off`},pe=()=>{for(let[n,r]of T){let i=!O(n);if(i===r.plane)continue;if(r.plane=i,i){D(n,e=>({...e,load:`loading`})),fe(n,r,e.get().sessions[n]?.limit??200,!0);continue}r.reads++,D(n,e=>de({...e,more:!1}));let a=w;a!==null&&ue(n,()=>t.unwatch(n,a)).catch(()=>void 0)}},me=(e,t)=>D(e,e=>e.posts.some(e=>e.msg.id===t.msg.id)?e:{...e,posts:[...e.posts,t].slice(-500)}),he=()=>{d++,u=null,e.set({open:null})};async function ge(n){if(n===null)return he();if(e.set(e=>({unread:{...e.unread,[n]:0}})),u&&u.key===n)return u.promise;let a=++d,s=e.get().open,l=s?.channel===n?s.messages:[],f=r(`open`);o=f;let p=c=[],h,g={key:n,promise:new Promise(e=>h=e)};u=g,e.set({open:{channel:n,messages:l}});let y=[],b=null;try{let r=(await t.history(n,200)).map(e=>({msg:e})),i=e.get().open;y=Qs(r,l,i?.channel===n?i.messages:[],p)}catch(e){b=e instanceof Error?e.message:String(e),y=l,_([{type:`backfill-failed`,channel:n,reason:b}])}finally{let t=f.backfill(y);if(a===d){_(t.notes);let r=new Set(l),a=e.get().open?.channel===n?e.get().open.messages.filter(e=>!r.has(e)):[],o=t.emit.slice(),s=new Set(o.map(e=>e.msg.id));for(let e of a)e&&!s.has(e.msg.id)&&o.push(e);e.set({open:{channel:n,messages:o.slice(-500)}}),C();let c=`#${n} history`;b||m.set(c,i());let u=m.get(c);v(c,b?{kind:`refused`,name:c,reason:b,...u===void 0?{}:{lastRead:u}}:void 0)}u===g&&(u=null),h()}}async function k(){if(l)return l;let n;l=new Promise(e=>n=e),a=r(`feed`),s=[];let o=[],c=null;try{let n=[{name:`space`,read:()=>t.meta(),apply:ie},...f.has(`peers`)?[]:[{name:`peers`,read:()=>t.roster(),apply:p(`peers`,t=>e.set({roster:t}))}],{name:`channels`,read:()=>t.channels(),apply:t=>e.set({channels:t})},{name:`direct messages`,read:()=>t.dms(500),apply:t=>e.set(e=>({dms:Qs(t.map(e=>({msg:e})),e.dms).slice(-500),dmsCut:t.length>=500}))},{name:`activity`,read:()=>t.activity(200),apply:e=>{o=e.entries,c=e}},...f.has(`membership`)?[]:[{name:`membership`,read:()=>t.membership(),apply:p(`membership`,t=>e.set({membership:{snapshot:t}}))}]],r=await ae(n);pe();let a=i(),s=new Set(n.map(e=>e.name).filter(e=>!r.some(t=>t.name===e)));for(let e of s)m.set(e,a);h(s.has(`peers`),s.has(`channels`));let l=r.filter(e=>!f.has(e.name));for(let e of l){let t=m.get(e.name);t!==void 0&&(e.lastRead=t)}let u=c;u&&u.partial&&l.push({kind:`partial`,name:`activity`,reason:u.missing.map(e=>`${e}: ${u.reasons[e]}`).join(`
70
- `),read:u.read,of:u.of,missing:u.missing.slice()});let d=e.get().stale.find(e=>e.name===`roster`);d&&!l.some(e=>e.name===`roster`)&&l.push(d),e.set({stale:l});let g=l.find(e=>e.name===`membership`);g&&y(g.reason);let v=l.find(e=>e.name===`activity`&&e.kind!==`partial`);v&&_([{type:`backfill-failed`,reason:v.reason}]);let b=e.get().open;b&&ge(b.channel)}finally{for(let e of o)e?.msg&&(e.msg.channel=e.channel);let t=a.backfill(Qs(o,e.get().activity,s));_(t.notes);let r=t.emit.slice(),i=new Set(r.map(e=>e?.msg?.id));for(let t of e.get().activity)t&&t.msg&&!i.has(t.msg.id)&&r.push(t);e.set({activity:r.slice(-500)}),C(),l=null,n()}}let _e=new Set,A;function j(n){_e.has(n)||e.get().channels.some(e=>e.channel===n&&e.deliveryClass!==void 0)||(_e.add(n),A===void 0&&(A=setTimeout(()=>{A=void 0,ae([{name:`channels`,read:()=>t.channels(),apply:t=>e.set({channels:t})}]).then(e=>{for(let t of e)v(t.name,t)})},Ys)))}function ye(t){let n=t.msg;t.arrivedAt=i(),n.channel=t.channel;let r=a.live(t);r.held&&s.push(t),_(r.notes),e.set(e=>{let i=e.activity.slice();for(let e of r.emit)i.some(t=>t.msg.id===e.msg.id)||(i.push(e),i.length>Js&&i.shift());if(t.mode!==`unicast`||te(e.dms).has(n.id))return{activity:i};let a=Math.max(0,e.dms.length+1-500),o=e.dms.slice(a);o.push({msg:t.msg,senderId:t.senderId});for(let t=0;t<a;t++)ee(e.dms[t].msg.id,-1);return ee(n.id,1),S=o,{activity:i,dms:o,dmsCut:e.dmsCut||a>0}}),C(),t.mode===`chat`&&t.senderId!==void 0&&e.get().sessions[t.senderId]&&me(t.senderId,{msg:t.msg,senderId:t.senderId});let l=n.channel;if(l){if(e.set(e=>{let t=e.channels.findIndex(e=>e.channel===l),n=e.channels.slice();return t===-1?n.push({channel:l,messages:1}):n[t]={...n[t],messages:(n[t].messages??0)+1},{channels:n}}),j(l),e.get().open?.channel===l){let n={msg:t.msg,senderId:t.senderId},r=o.live(n);r.held&&c.push(n),_(r.notes),e.set(e=>{if(e.open?.channel!==l)return{};let t=e.open.messages.slice();for(let e of r.emit)t.push(e),t.length>Js&&t.shift();return{open:{channel:l,messages:t}}})}else e.set(e=>({unread:{...e.unread,[l]:(e.unread[l]??0)+1}}))}}return{refresh:k,open:ge,onRoster(t){f.add(`peers`),oe++,e.set({roster:t}),h(!0,!1),le(),pe()},onPresenceView(t){e.set({presenceView:t}),v(`roster`,ft(t))},onMessage:ye,onMembership(t){f.add(`membership`),e.set({membership:{snapshot:t}});for(let e of t.members)for(let t of[...e.live??[],...e.durable??[]])/[*>]/.test(t)||j(t)},onMembershipFailed(e){f.add(`membership`),y(e)},async deleteChannel(n){n&&(await t.deleteChannel(n),e.set(e=>({channels:e.channels.filter(e=>e.channel!==n),unread:Object.fromEntries(Object.entries(e.unread).filter(([e])=>e!==n)),activity:e.activity.filter(e=>e.msg.channel!==n),stale:e.stale.filter(e=>e.name!==`#${n} history`)})),e.get().open?.channel===n&&he())},async send(n,r){let a=g(n);if((e.get().drafts[a]??Zs).outgoing.some(e=>e.id===void 0))throw Error(`a post to this target is already in flight`);let o={seq:++ne,text:r,ts:i()};b(a,e=>({text:``,outgoing:[...e.outgoing,o]}));let s;try{s=await t.send(n,r)}catch(t){let i=e.get(),s=n.kind===`msg`?`#${n.channel}`:$e(n.to,Ze(i.roster),i.operatorId);throw b(a,e=>({text:e.text?`${r}\n${e.text}`:r,refused:re(s,t),outgoing:e.outgoing.filter(e=>e!==o)})),t}e.set(e=>({operatorId:e.operatorId??s.operatorId,drafts:{...e.drafts,[a]:{...e.drafts[a]??Zs,outgoing:(e.drafts[a]??Zs).outgoing.map(e=>e===o?{...e,id:s.id}:e)}}})),C()},draft(e,t){b(g(e),e=>({text:t,outgoing:e.outgoing}))},openSession(t){if(e.get().sessions[t])return D(t,e=>({...e,views:e.views+1}));let n=O(t),r={reads:0,plane:!n};T.set(t,r),e.set(e=>({sessions:{...e.sessions,[t]:{views:1,frames:[],posts:nc(e,t),load:n?`ok`:`loading`,more:!1,limit:200}}})),r.plane&&fe(t,r,200,!0)},closeSession(n){let r=e.get().sessions[n];if(!r)return;if(r.views>1)return D(n,e=>({...e,views:e.views-1}));let i=T.get(n);T.delete(n),e.set(e=>({sessions:Object.fromEntries(Object.entries(e.sessions).filter(([e])=>e!==n))}));let a=w;i?.plane&&a!==null&&ue(n,()=>t.unwatch(n,a)).catch(()=>void 0)},async loadEarlier(t){let n=e.get().sessions[t],r=T.get(t);!n||!r?.plane||!n.more||n.limit>=2e3||ve(n.frames)>=2e3||await fe(t,r,Math.min(n.limit+200,Xs),!1)},async reloadSession(t){let n=e.get().sessions[t],r=T.get(t);n&&r?.plane&&(D(t,e=>({...e,load:`loading`})),await fe(t,r,n.limit,!0))},onHello(t){w=t;for(let[t,n]of T)n.plane&&fe(t,n,e.get().sessions[t]?.limit??200,!0)},onFeedLost(){w=null},onAgentFrame(t){e.set(e=>{let n=e.sessions[t.id];if(!n)return{};let r=ec(n.frames,[t.msg],!0);if(r===n.frames)return{};let i=tc(r);return{sessions:{...e.sessions,[t.id]:{...n,frames:i.frames,more:n.more||i.dropped}}}})}}}export{zt as $,Mn as A,ve as At,pn as B,_ as Bt,Ga as C,Je as Ct,Un as D,qe as Dt,Vn as E,N as Et,xn as F,w as Ft,rn as G,b as Gt,dn as H,S as Ht,bn as I,ce as It,z as J,nn as K,gn as L,ie as Lt,On as M,Pe as Mt,Dn as N,ue as Nt,Hn as O,de as Ot,Tn as P,T as Pt,Ht as Q,yn as R,oe as Rt,qa as S,Ze as St,Ua as T,Ye as Tt,fn as U,x as Ut,an as V,ee as Vt,cn as W,ne as Wt,Qt as X,Zt as Y,R as Z,yo as _,lt as _t,vs as a,Dt as at,Za as b,tt as bt,Jo as c,Ct as ct,Do as d,mt as dt,Lt as et,wo as f,pt as ft,_o as g,dt as gt,xo as h,ct as ht,Vs as i,At as it,wn as j,Ce as jt,Nn as k,we as kt,Ko as l,bt as lt,Co as m,ut as mt,rc as n,Mt as nt,_s as o,I as ot,To as p,at as pt,tn as q,Hs as r,jt as rt,Yo as s,wt as st,Xs as t,It as tt,zo as u,gt as ut,vo as v,rt as vt,Ka as w,Xe as wt,Ya as x,$e as xt,eo as y,it as yt,hn as z,g as zt};