@ashlr/hub 3.5.1 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -0
- package/README.md +3 -0
- package/dist/build-identity.json +2 -2
- package/dist/cli/activation.d.ts +41 -0
- package/dist/cli/activation.js +485 -0
- package/dist/cli/activation.js.map +1 -0
- package/dist/core/daemon/cutoff-checkpoint-scheduler.js +7 -0
- package/dist/core/daemon/cutoff-checkpoint-scheduler.js.map +1 -1
- package/dist/core/daemon/loop.d.ts +19 -0
- package/dist/core/daemon/loop.js +235 -5
- package/dist/core/daemon/loop.js.map +1 -1
- package/dist/core/daemon/overnight-status.d.ts +152 -0
- package/dist/core/daemon/overnight-status.js +275 -0
- package/dist/core/daemon/overnight-status.js.map +1 -0
- package/dist/core/daemon/post-merge-halt.d.ts +212 -0
- package/dist/core/daemon/post-merge-halt.js +503 -0
- package/dist/core/daemon/post-merge-halt.js.map +1 -0
- package/dist/core/daemon/run-window.d.ts +218 -0
- package/dist/core/daemon/run-window.js +420 -0
- package/dist/core/daemon/run-window.js.map +1 -0
- package/dist/core/fleet/generated-repair-resolution.d.ts +36 -0
- package/dist/core/fleet/generated-repair-resolution.js +245 -0
- package/dist/core/fleet/generated-repair-resolution.js.map +1 -0
- package/dist/core/local-runtime/llama/port.d.ts +17 -0
- package/dist/core/local-runtime/llama/port.js +47 -0
- package/dist/core/local-runtime/llama/port.js.map +1 -0
- package/dist/core/local-runtime/llama/proxy-host.d.ts +54 -0
- package/dist/core/local-runtime/llama/proxy-host.js +159 -0
- package/dist/core/local-runtime/llama/proxy-host.js.map +1 -0
- package/dist/core/local-runtime/llama/proxy-process.d.ts +148 -0
- package/dist/core/local-runtime/llama/proxy-process.js +250 -0
- package/dist/core/local-runtime/llama/proxy-process.js.map +1 -0
- package/dist/core/local-runtime/llama/proxy-record.d.ts +40 -0
- package/dist/core/local-runtime/llama/proxy-record.js +133 -0
- package/dist/core/local-runtime/llama/proxy-record.js.map +1 -0
- package/dist/core/local-runtime/llama/proxy-supervisor.d.ts +118 -0
- package/dist/core/local-runtime/llama/proxy-supervisor.js +511 -0
- package/dist/core/local-runtime/llama/proxy-supervisor.js.map +1 -0
- package/dist/core/web/public/next/assets/{App-BbVoUCIi.js → App-vtaHB9mp.js} +2 -2
- package/dist/core/web/public/next/assets/{App-BbVoUCIi.js.map → App-vtaHB9mp.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ApprovalsSection-BW9iVjUa.js → ApprovalsSection-B-bFJ0I9.js} +2 -2
- package/dist/core/web/public/next/assets/{ApprovalsSection-BW9iVjUa.js.map → ApprovalsSection-B-bFJ0I9.js.map} +1 -1
- package/dist/core/web/public/next/assets/{AutonomySection-Cpk_oEhc.css → AutonomySection-CHjxJt2z.css} +1 -1
- package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js +2 -0
- package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js.map +1 -0
- package/dist/core/web/public/next/assets/ChatSection-BfnLe5dT.css +1 -0
- package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js +80 -0
- package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js.map +1 -0
- package/dist/core/web/public/next/assets/{ConfirmDialog-CXevY3Au.js → ConfirmDialog-Dd2APQhB.js} +2 -2
- package/dist/core/web/public/next/assets/{ConfirmDialog-CXevY3Au.js.map → ConfirmDialog-Dd2APQhB.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Dialog-Bn0CgEGz.js → Dialog-CPM9JxBc.js} +2 -2
- package/dist/core/web/public/next/assets/{Dialog-Bn0CgEGz.js.map → Dialog-CPM9JxBc.js.map} +1 -1
- package/dist/core/web/public/next/assets/{DiffViewer-QKyisN2L.js → DiffViewer-B84qVef9.js} +2 -2
- package/dist/core/web/public/next/assets/{DiffViewer-QKyisN2L.js.map → DiffViewer-B84qVef9.js.map} +1 -1
- package/dist/core/web/public/next/assets/McpSection-CEUpV_5X.js +2 -0
- package/dist/core/web/public/next/assets/McpSection-CEUpV_5X.js.map +1 -0
- package/dist/core/web/public/next/assets/McpSection-D88QlDpG.css +1 -0
- package/dist/core/web/public/next/assets/Meter--h3MmZS-.js +2 -0
- package/dist/core/web/public/next/assets/Meter--h3MmZS-.js.map +1 -0
- package/dist/core/web/public/next/assets/Meter-CLcr-4wS.css +1 -0
- package/dist/core/web/public/next/assets/{MutationTokenDialog-DbSHPy3w.js → MutationTokenDialog-DA8t97XT.js} +2 -2
- package/dist/core/web/public/next/assets/{MutationTokenDialog-DbSHPy3w.js.map → MutationTokenDialog-DA8t97XT.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-C-PCgCzo.js → ResourcePoolConsoleApp-Bq7Vyud0.js} +2 -2
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-C-PCgCzo.js.map → ResourcePoolConsoleApp-Bq7Vyud0.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RouteErrorBoundary-Dw8ZjmkS.js → RouteErrorBoundary-Badio_uO.js} +2 -2
- package/dist/core/web/public/next/assets/{RouteErrorBoundary-Dw8ZjmkS.js.map → RouteErrorBoundary-Badio_uO.js.map} +1 -1
- package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js +2 -0
- package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js.map +1 -0
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-Bk5HipM0.js → UniverseConsoleApp-_FSohAdN.js} +2 -2
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-Bk5HipM0.js.map → UniverseConsoleApp-_FSohAdN.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UniverseView-D8k9q0ce.js → UniverseView-DqcXbed4.js} +2 -2
- package/dist/core/web/public/next/assets/{UniverseView-D8k9q0ce.js.map → UniverseView-DqcXbed4.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UsageSection-B2E06ZH1.js → UsageSection-Bq6Daaby.js} +2 -2
- package/dist/core/web/public/next/assets/{UsageSection-B2E06ZH1.js.map → UsageSection-Bq6Daaby.js.map} +1 -1
- package/dist/core/web/public/next/assets/VerseConsoleApp-CMkCizvL.css +1 -0
- package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js +3 -0
- package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js.map +1 -0
- package/dist/core/web/public/next/assets/{charts-DSUpczxG.js → charts-CTZJ-JrH.js} +2 -2
- package/dist/core/web/public/next/assets/{charts-DSUpczxG.js.map → charts-CTZJ-JrH.js.map} +1 -1
- package/dist/core/web/public/next/assets/global-D6bTxIRn.js +2 -0
- package/dist/core/web/public/next/assets/global-D6bTxIRn.js.map +1 -0
- package/dist/core/web/public/next/assets/global-z-JfD3ow.css +1 -0
- package/dist/core/web/public/next/assets/{icons-BxOX8-XB.js → icons-D9vlf85u.js} +2 -2
- package/dist/core/web/public/next/assets/{icons-BxOX8-XB.js.map → icons-D9vlf85u.js.map} +1 -1
- package/dist/core/web/public/next/assets/{index-BMRIET7F.js → index-CZamKRUg.js} +3 -3
- package/dist/core/web/public/next/assets/{index-BMRIET7F.js.map → index-CZamKRUg.js.map} +1 -1
- package/dist/core/web/public/next/assets/{queries-AxnVa02h.js → queries-B8eBnFox.js} +2 -2
- package/dist/core/web/public/next/assets/{queries-AxnVa02h.js.map → queries-B8eBnFox.js.map} +1 -1
- package/dist/core/web/public/next/assets/{use-guarded-action-BO6c94Wp.js → use-guarded-action-bzrVVAYq.js} +2 -2
- package/dist/core/web/public/next/assets/{use-guarded-action-BO6c94Wp.js.map → use-guarded-action-bzrVVAYq.js.map} +1 -1
- package/dist/core/web/public/next/assets/workspace-model-v0a1gl-C.js +2 -0
- package/dist/core/web/public/next/assets/workspace-model-v0a1gl-C.js.map +1 -0
- package/dist/core/web/public/next/index.html +1 -1
- package/dist/release-dependency-inventory.json +1 -1
- package/package.json +1 -1
- package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js +0 -2
- package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js.map +0 -1
- package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js +0 -80
- package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js.map +0 -1
- package/dist/core/web/public/next/assets/ChatSection-LQiAn6Eu.css +0 -1
- package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js +0 -2
- package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js.map +0 -1
- package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js +0 -3
- package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js.map +0 -1
- package/dist/core/web/public/next/assets/VerseConsoleApp-D2E3mU9a.css +0 -1
- package/dist/core/web/public/next/assets/global-C4jfYHrj.js +0 -2
- package/dist/core/web/public/next/assets/global-C4jfYHrj.js.map +0 -1
- package/dist/core/web/public/next/assets/global-D463gG1X.css +0 -1
- package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js +0 -2
- package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js.map +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import{a as e,n as t,o as n}from"./index-CZamKRUg.js";import{A as r,B as i,H as a,L as o,M as s,R as c,V as l,_ as u,b as d,c as f,d as p,i as m,k as h,o as g,p as _,s as v,v as y,y as b,z as x}from"./global-D6bTxIRn.js";import{t as S}from"./Dialog-CPM9JxBc.js";import{r as C}from"./RouteErrorBoundary-Badio_uO.js";import{t as ee}from"./MutationTokenDialog-DA8t97XT.js";import{i as w,n as T,r as E,t as D}from"./DiffViewer-B84qVef9.js";import{n as O,t as k}from"./Meter--h3MmZS-.js";import{F as A,G as te,J as j,K as M,M as N,N as ne,P as re,U as ie,W as ae,X as P,Y as oe,_ as F,a as se,b as ce,c as le,d as ue,f as de,g as fe,i as pe,j as I,l as me,m as L,n as he,o as ge,p as _e,q as ve,r as ye,s as be,t as xe,u as Se,v as Ce,y as we}from"./VerseConsoleApp-CsIQv9id.js";import{_ as Te,a as Ee,b as De,c as Oe,d as ke,f as Ae,g as je,h as Me,i as Ne,l as Pe,m as Fe,n as Ie,o as Le,p as Re,r as ze,s as Be,t as Ve,v as He,y as Ue}from"./verse-model-CvtK6vP6.js";import{_ as We,a as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,l as Qe,m as $e,n as et,o as tt,p as nt,r as rt,s as it,t as at,u as R,v as ot}from"./workspace-model-v0a1gl-C.js";var z=n(e(),1),st={ready:`ready`,tight:`tight`,exhausted:`blocked`,"signed-out":`blocked`,unknown:`unread`};function ct(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return new Date().toDateString()===t.toDateString()?`resets ${n}`:`resets ${t.toLocaleDateString([],{month:`short`,day:`numeric`})} at ${n}`}function lt(e,t){let n=`${e}_`,r=t;for(;r.startsWith(n)&&r.length>n.length;)r=r.slice(n.length);return Ue(r)}function ut(e,t){let n=t.resetDescription??(t.resetsAt===null?null:ct(t.resetsAt));return{id:t.id,label:lt(e,t.id),usedPercent:t.limitReached||!t.measured?null:t.usedPercent,limitReached:t.limitReached,resetText:n,resetsAt:t.resetsAt}}function dt(e){let t=typeof e.usedPercent==`number`&&Number.isFinite(e.usedPercent)?Math.max(0,Math.min(100,e.usedPercent)):null,n=t!==null&&t>=100;return{id:e.id,label:Ue(e.id),usedPercent:n?null:t,limitReached:n,resetText:e.resetsAt===null?null:ct(e.resetsAt),resetsAt:e.resetsAt}}function ft(e){if(e===null)return{phrase:null,title:null};if(e.unlimited)return{phrase:`credits unlimited`,title:null};if(!e.hasCredits)return{phrase:null,title:null};if(e.balance===null)return{phrase:`credits available`,title:null};let t=Number.parseFloat(e.balance);return Number.isFinite(t)?{phrase:`${t.toFixed(2)} credits left`,title:e.balance}:{phrase:`credits available`,title:e.balance}}function pt(e){let t=He(e),n=e.health.state===`ready`,r=t===null?n?`ready`:`unread`:`blocked`;return{kind:`local`,plan:null,cls:r,word:Ie[r],summary:t??(n?`runs on this machine`:`readiness not reported`),binding:null,others:[],credits:null,creditsTitle:null,notes:e.health.summary===null?[]:[e.health.summary],evidenceSource:null,observedAt:e.health.observedAt,extended:!1}}function mt(e){let t=Me(e),n=e.health.windows.map(dt),r=n.find(e=>e.limitReached)??null,i=n.filter(e=>e.usedPercent!==null),a=i.length===0?null:i.reduce((e,t)=>(t.usedPercent??0)>(e.usedPercent??0)?t:e),o=r??a,s=He(e),c=s===null?t.cls:`blocked`;return{kind:`subscription`,plan:null,cls:c,word:Ie[c],summary:s??t.text,binding:o,others:o===null?n:n.filter(e=>e.id!==o.id),credits:null,creditsTitle:null,notes:[],evidenceSource:null,observedAt:e.health.observedAt,extended:!1}}function ht(e){if(e.engine===`local`)return pt(e);let t=e.capacity;if(t===void 0)return mt(e);let n=t.windows.map(t=>ut(e.engine,t)),r=t.binding,i=r===null?null:n.find(e=>e.id===r.id)??ut(e.engine,r),a=i===null?n:n.filter(e=>e.id!==i.id),o=ft(t.credits),s=He(e),c=s===null?st[t.usability]:`blocked`,l;return l=t.usability===`signed-out`?`signed out — reconnect this account`:s===null?i===null?`no capacity reading`:i.limitReached?t.usability===`tight`&&o.phrase!==null?`${i.label} limit reached · credits still spendable`:`${i.label} limit reached`:i.usedPercent===null?`no capacity reading`:`${Math.round(i.usedPercent)}% of ${i.label} used`:s,{kind:`subscription`,plan:t.planType,cls:c,word:Ie[c],summary:l,binding:i,others:a,credits:o.phrase,creditsTitle:o.title,notes:[...t.notes],evidenceSource:t.evidenceSource,observedAt:t.observedAt??e.health.observedAt,extended:!0}}function gt(e){switch(e){case`collector`:return null;case`shared-evidence`:return`read from another collector’s shared evidence, not probed here`;case`baseline`:return`operator-seeded baseline, not a live reading`;case`none`:return`no evidence source — nothing here was measured`;default:return null}}function _t(e,t){let n=[e.label];return t.plan!==null&&n.push(t.plan),n.push(t.word),n.push(t.summary),t.credits!==null&&n.push(t.credits),t.binding?.resetText!=null&&n.push(t.binding.resetText),n.join(` · `)}function vt(e){return e===`tight`||e===`blocked`}var B={chip:`_chip_rrd6q_8`,chipGlyph:`_chipGlyph_rrd6q_22`,window:`_window_rrd6q_35`,windowLead:`_windowLead_rrd6q_36`,windowLabel:`_windowLabel_rrd6q_43`,pct:`_pct_rrd6q_44`,flag:`_flag_rrd6q_60`,unknownHead:`_unknownHead_rrd6q_69`,unknownValue:`_unknownValue_rrd6q_76`,unknownRule:`_unknownRule_rrd6q_85`,reset:`_reset_rrd6q_93`,note:`_note_rrd6q_104`,noteHead:`_noteHead_rrd6q_110`,plan:`_plan_rrd6q_117`,noteSummary:`_noteSummary_rrd6q_130`,credits:`_credits_rrd6q_137`},V=t(),yt={ready:`✓`,tight:`◑`,blocked:`▮`,unread:`?`};function bt({view:e,title:t}){return(0,V.jsxs)(`span`,{className:B.chip,"data-capacity":e.cls,title:t??e.summary,children:[(0,V.jsx)(`span`,{className:B.chipGlyph,"aria-hidden":`true`,children:yt[e.cls]}),e.word]})}function xt({windowView:e,ariaPrefix:t,prominent:n=!1}){let r=`${t} ${e.label}`;if(e.limitReached)return(0,V.jsxs)(`div`,{className:n?B.windowLead:B.window,children:[(0,V.jsx)(k,{value:100,max:100,tone:`danger`,label:(0,V.jsx)(`span`,{className:B.windowLabel,children:e.label}),valueText:(0,V.jsx)(`span`,{className:B.flag,children:`limit reached`}),"aria-label":`${r}: the provider flagged this window as rate-limited, so no percentage was measured`}),e.resetText===null?null:(0,V.jsx)(`p`,{className:B.reset,children:e.resetText})]});if(e.usedPercent===null)return(0,V.jsxs)(`div`,{className:n?B.windowLead:B.window,children:[(0,V.jsxs)(`div`,{className:B.unknownHead,children:[(0,V.jsx)(`span`,{className:B.windowLabel,children:e.label}),(0,V.jsx)(`span`,{className:B.unknownValue,children:`no reading`})]}),(0,V.jsx)(`hr`,{className:B.unknownRule,"aria-hidden":`true`}),e.resetText===null?null:(0,V.jsx)(`p`,{className:B.reset,children:e.resetText})]});let i=Math.round(e.usedPercent);return(0,V.jsxs)(`div`,{className:n?B.windowLead:B.window,children:[(0,V.jsx)(k,{value:i,max:100,label:(0,V.jsx)(`span`,{className:B.windowLabel,children:e.label}),valueText:(0,V.jsxs)(`span`,{className:B.pct,children:[i,`%`]}),"aria-label":`${r} used`}),e.resetText===null?null:(0,V.jsx)(`p`,{className:B.reset,children:e.resetText})]})}function St({seat:e,className:t}){let n=ht(e);return(0,V.jsxs)(`div`,{className:`${B.note} ${t??``}`,"data-capacity":n.cls,children:[(0,V.jsxs)(`div`,{className:B.noteHead,children:[(0,V.jsx)(bt,{view:n}),n.plan===null?null:(0,V.jsx)(`span`,{className:B.plan,children:n.plan}),(0,V.jsx)(`span`,{className:B.noteSummary,children:n.summary})]}),n.binding===null?null:(0,V.jsx)(xt,{windowView:n.binding,ariaPrefix:e.label,prominent:!0}),n.credits===null?null:(0,V.jsxs)(`p`,{className:B.credits,title:n.creditsTitle??void 0,children:[n.credits,` — credits are independent of the window`]})]})}var H={composer:`_composer_um1gd_5`,box:`_box_um1gd_10`,textarea:`_textarea_um1gd_21`,boxListening:`_boxListening_um1gd_28`,row:`_row_um1gd_47`,spacer:`_spacer_um1gd_53`,"engine-claude":`_engine-claude_um1gd_56`,"engine-codex":`_engine-codex_um1gd_57`,"engine-grok":`_engine-grok_um1gd_58`,"engine-local":`_engine-local_um1gd_59`,engineDot:`_engineDot_um1gd_60`,seatField:`_seatField_um1gd_69`,seatFieldCompact:`_seatFieldCompact_um1gd_70`,fieldLabel:`_fieldLabel_um1gd_71`,seatSelect:`_seatSelect_um1gd_72`,seatPillWrap:`_seatPillWrap_um1gd_89`,seatPill:`_seatPill_um1gd_89`,seatPillText:`_seatPillText_um1gd_107`,seatMenu:`_seatMenu_um1gd_109`,seatMenuHeading:`_seatMenuHeading_um1gd_126`,seatMenuEmpty:`_seatMenuEmpty_um1gd_134`,seatMenuItem:`_seatMenuItem_um1gd_135`,seatMenuText:`_seatMenuText_um1gd_148`,seatMenuPrimary:`_seatMenuPrimary_um1gd_149`,seatMenuSecondary:`_seatMenuSecondary_um1gd_150`,seatMenuCapacity:`_seatMenuCapacity_um1gd_156`,dictationWrap:`_dictationWrap_um1gd_167`,dictation:`_dictation_um1gd_167`,dictationLive:`_dictationLive_um1gd_182`,dictationPulse:`_dictationPulse_um1gd_183`,"verse-ring":`_verse-ring_um1gd_1`,dictationError:`_dictationError_um1gd_197`,send:`_send_um1gd_200`,stop:`_stop_um1gd_201`,stopIcon:`_stopIcon_um1gd_220`,help:`_help_um1gd_223`,helpQuiet:`_helpQuiet_um1gd_231`,helpError:`_helpError_um1gd_240`,cost:`_cost_um1gd_268`,costFigure:`_costFigure_um1gd_280`};function Ct(e){return JSON.stringify([e.seatId,e.model])}function wt(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2)return null;let[n,r]=t;return typeof n!=`string`||typeof r!=`string`?null:{seatId:n,model:r}}catch{return null}}function Tt(e){for(let t of Oe(e))for(let e of t.seats)if(e.health.state!==`unavailable`&&e.models.length!==0)return{seatId:e.id,model:e.models[0].id};return null}function Et({seats:e,value:t,onChange:n,disabled:r=!1,label:i=`Seat and model`,id:a,compact:o=!1}){let s=(0,z.useId)(),c=a??s,l=Oe(e),u=t?Ct(t):``,d=t&&e.some(e=>e.id===t.seatId&&e.models.some(e=>e.id===t.model));return(0,V.jsxs)(`label`,{className:`${H.seatField} ${o?H.seatFieldCompact:``}`,htmlFor:c,children:[(0,V.jsx)(`span`,{className:o?`visually-hidden`:H.fieldLabel,children:i}),(0,V.jsxs)(`select`,{id:c,className:H.seatSelect,value:d?u:``,disabled:r||l.length===0,"aria-label":o?i:void 0,onChange:e=>{let t=wt(e.target.value);t&&n(t)},children:[d?null:(0,V.jsx)(`option`,{value:``,disabled:!0,children:l.length===0?`No seats discovered`:`Choose a seat…`}),l.map(e=>(0,V.jsx)(`optgroup`,{label:Ve[e.engine],children:e.seats.flatMap(e=>{let t=He(e),n=ht(e),r=t===null?n.cls===`unread`||n.kind===`local`?null:`${n.plan===null?``:`${n.plan} · `}${n.word} · ${n.summary}`:`unavailable: ${t}`,i=r===null?void 0:r.charAt(0).toUpperCase()+r.slice(1);return e.models.map(n=>(0,V.jsxs)(`option`,{value:Ct({seatId:e.id,model:n.id}),disabled:t!==null,title:i,children:[e.label,` — `,n.label,r?` (${r})`:``]},Ct({seatId:e.id,model:n.id})))})},e.engine))]})]})}var Dt=`plugin:dialog|open`,Ot=`Choose a project folder`;function kt(){let e=globalThis,t=e.__TAURI_INTERNALS__?.invoke;if(typeof t==`function`)return{invoke:t};let n=e.__TAURI__?.core?.invoke;return typeof n==`function`?{invoke:n}:null}function At(){return kt()!==null}async function jt(){let e=kt();if(!e)return null;try{return Nt(await e.invoke(Dt,{options:{directory:!0,multiple:!1,recursive:!1,title:Ot}}))}catch{return null}}var Mt=4;function Nt(e,t=0){if(t>Mt)return null;if(Array.isArray(e))return e.length>0?Nt(e[0],t+1):null;if(typeof e==`object`&&e){let n=e.path;return typeof n==`string`?Nt(n,t+1):null}if(typeof e!=`string`)return null;let n=Pt(e.trim());return!n||n.includes(`\0`)?null:Ft(n)?n:null}function Pt(e){if(e===``)return null;if(!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e)||/^[A-Za-z]:[\\/]/.test(e))return e;if(!/^file:\/\//i.test(e))return null;let t;try{t=new URL(e).pathname}catch{return null}let n;try{n=decodeURIComponent(t)}catch{return null}return/^\/[A-Za-z]:[\\/]/.test(n)?n.slice(1):n}function Ft(e){return e.startsWith(`\\\\`)||e.startsWith(`/`)?!0:/^[A-Za-z]:[\\/]/.test(e)}var U={width:`_width_1185y_1`,form:`_form_1185y_3`,field:`_field_1185y_4`,label:`_label_1185y_5`,optional:`_optional_1185y_13`,select:`_select_1185y_15`,input:`_input_1185y_16`,hint:`_hint_1185y_40`,error:`_error_1185y_41`,actions:`_actions_1185y_49`,cancel:`_cancel_1185y_50`,create:`_create_1185y_51`,capacity:`_capacity_1185y_72`,rootRow:`_rootRow_1185y_78`,removeRoot:`_removeRoot_1185y_87`,addRoot:`_addRoot_1185y_88`},It=`\0workspace:`,Lt=`\0other`;function Rt({open:e,onClose:t,projects:n,seats:r,workspaces:i=[],initialProjectPath:a,initialSeat:o,busy:s=!1,error:c,onCreate:l}){let u=(0,z.useId)(),d=(0,z.useId)(),f=(0,z.useId)(),p=(0,z.useId)(),m=(0,z.useId)(),h=(0,z.useRef)(null),[g,_]=(0,z.useState)(``),[v,y]=(0,z.useState)(``),[x,C]=(0,z.useState)(null),[ee,w]=(0,z.useState)(``),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)([]),[k,A]=(0,z.useState)([]),[te,j]=(0,z.useState)(!1),[M,N]=(0,z.useState)(null),ne=(0,z.useMemo)(()=>[...n].sort((e,t)=>Number(t.enrolled)-Number(e.enrolled)||e.name.localeCompare(t.name)),[n]),re=(0,z.useRef)({initialProjectPath:a,initialSeat:o,projects:n,seats:r,sortedProjects:ne});re.current={initialProjectPath:a,initialSeat:o,projects:n,seats:r,sortedProjects:ne},(0,z.useEffect)(()=>{if(!e)return;let{initialProjectPath:t,initialSeat:n,projects:r,seats:i,sortedProjects:a}=re.current,o=t&&r.some(e=>e.path===t)?t:null;_(o??(t?Lt:a[0]?.path??Lt)),y(o?``:t??``),C(n??Tt(i)),w(``),E(null),O([]),N(null),j(!1),A([])},[e]),(0,z.useEffect)(()=>{e&&x===null&&r.length!==0&&C(o??Tt(r))},[e,x,r,o]);let ie=b(fe);(0,z.useEffect)(()=>{e&&ie()},[e,ie]);let ae=(0,z.useMemo)(()=>{let e=new Map;for(let t of i)e.set(t.id,t);for(let t of k)e.has(t.id)||e.set(t.id,t);return[...e.values()]},[i,k]),P=g.startsWith(It),oe=P?g.slice(11):null,F=P?``:g===Lt?v.trim():g,se=x===null?null:r.find(e=>e.id===x.seatId)??null,ce=se?.health.state===`unavailable`,le=!s&&(P||F.length>0)&&x!==null&&!ce,ue=oe===null?null:ae.find(e=>e.id===oe)??null,de=it(se?.engine??null,1+D.length),I=tt(se?.engine??null,ue?.roots.length??0),me=At();async function L(){let e=await jt();e!==null&&e.length>0&&(_(Lt),y(e))}async function he(e){let t=await jt();t!==null&&t.length>0&&O(D.map((n,r)=>r===e?t:n))}async function ge(){let e=$e(F,D);if(!e.ok){E(e.error);return}j(!0),E(null),N(null);try{let t=Ge(e.roots[0]),n=await pe({name:t,roots:e.roots});A(e=>[...e,n]),_(`${It}${n.id}`),N(`Saved. “${n.name}” is in this list from now on.`)}catch(e){E(e instanceof Error?e.message:String(e))}finally{j(!1)}}function _e(e){if(e.preventDefault(),!x){E(`Pick a seat first.`);return}if(oe!==null){E(null);let e={workspaceId:oe,seatId:x.seatId,model:x.model};delete e.projectPath;let t=ee.trim();t&&(e.title=t),l(e);return}let t=$e(F,D);if(!t.ok){E(t.error);return}E(null);let[n,...r]=t.roots,i={projectPath:n,seatId:x.seatId,model:x.model};r.length>0&&(i.extraRoots=r);let a=ee.trim();a&&(i.title=a),l(i)}let ve=T??c??null;return(0,V.jsx)(S,{open:e,onClose:t,titleId:u,title:`New chat`,initialFocusRef:h,widthClassName:U.width,children:(0,V.jsxs)(`form`,{className:U.form,onSubmit:_e,noValidate:!0,children:[(0,V.jsxs)(`label`,{className:U.field,htmlFor:d,children:[(0,V.jsx)(`span`,{className:U.label,children:`Project`}),(0,V.jsxs)(`select`,{id:d,ref:h,value:g,onChange:e=>_(e.target.value),className:U.select,children:[ae.length>0?(0,V.jsx)(`optgroup`,{label:`Saved projects`,children:ae.map(e=>(0,V.jsxs)(`option`,{value:`${It}${e.id}`,children:[e.name,` — `,ot(e)]},e.id))}):null,ne.map(e=>(0,V.jsxs)(`option`,{value:e.path,children:[e.name,e.enrolled?``:` (recent)`,` — `,e.path]},e.path)),(0,V.jsx)(`option`,{value:Lt,children:`Other folder…`})]})]}),g===Lt&&!P?(0,V.jsxs)(`label`,{className:U.field,htmlFor:f,children:[(0,V.jsx)(`span`,{className:U.label,children:`Folder path`}),(0,V.jsxs)(`div`,{className:U.rootRow,children:[(0,V.jsx)(`input`,{id:f,className:U.input,value:v,onChange:e=>y(e.target.value),placeholder:`/absolute/path/to/project`,autoComplete:`off`,spellCheck:!1}),me?(0,V.jsx)(`button`,{type:`button`,className:U.addRoot,onClick:()=>void L(),children:`Choose folder…`}):null]})]}):null,I?(0,V.jsx)(`p`,{className:U.hint,children:I}):null,P?null:(0,V.jsxs)(`div`,{className:U.field,children:[(0,V.jsxs)(`span`,{className:U.label,children:[`Also include `,(0,V.jsx)(`span`,{className:U.optional,children:`optional`})]}),D.map((e,t)=>(0,V.jsxs)(`div`,{className:U.rootRow,children:[(0,V.jsx)(`input`,{className:U.input,value:e,onChange:e=>O(D.map((n,r)=>r===t?e.target.value:n)),placeholder:`/absolute/path/to/another/folder`,"aria-label":`Additional folder ${t+1}`,autoComplete:`off`,spellCheck:!1}),me?(0,V.jsx)(`button`,{type:`button`,className:U.removeRoot,onClick:()=>void he(t),"aria-label":`Choose additional folder ${t+1}`,children:`Choose folder…`}):null,(0,V.jsx)(`button`,{type:`button`,className:U.removeRoot,onClick:()=>O(D.filter((e,n)=>n!==t)),"aria-label":`Remove additional folder ${t+1}`,children:`Remove`})]},t)),D.length+1<8?(0,V.jsx)(`button`,{type:`button`,className:U.addRoot,onClick:()=>O([...D,``]),children:`Add a folder`}):null,de?(0,V.jsx)(`p`,{className:U.hint,children:de}):null,(0,V.jsxs)(`div`,{className:U.rootRow,children:[(0,V.jsx)(`button`,{type:`button`,className:U.addRoot,onClick:()=>void ge(),disabled:te||F.length===0,children:te?`Saving…`:`Save as a project`}),(0,V.jsx)(`span`,{className:U.hint,children:`Keeps these folders in the list above. No chat needed first.`})]})]}),M?(0,V.jsx)(`p`,{role:`status`,className:U.hint,children:M}):null,(0,V.jsx)(Et,{id:m,seats:r,value:x,onChange:C}),se===null?null:(0,V.jsx)(St,{seat:se,className:U.capacity}),r.length===0?(0,V.jsx)(`p`,{className:U.hint,children:`No seats yet — connect an account or start Ollama, then reload.`}):null,(0,V.jsxs)(`label`,{className:U.field,htmlFor:p,children:[(0,V.jsxs)(`span`,{className:U.label,children:[`Title `,(0,V.jsx)(`span`,{className:U.optional,children:`optional`})]}),(0,V.jsx)(`input`,{id:p,className:U.input,value:ee,onChange:e=>w(e.target.value),placeholder:`Defaults to your first message`,maxLength:120})]}),ve?(0,V.jsx)(`p`,{role:`alert`,className:U.error,children:ve}):null,(0,V.jsxs)(`div`,{className:U.actions,children:[(0,V.jsx)(`button`,{type:`button`,className:U.cancel,onClick:t,children:`Cancel`}),(0,V.jsx)(`button`,{type:`submit`,className:U.create,disabled:!le,children:s?`Creating…`:`Start chat`})]})]})})}var zt={width:`_width_k2wwr_1`,input:`_input_k2wwr_3`,list:`_list_k2wwr_19`,row:`_row_k2wwr_27`,rowActive:`_rowActive_k2wwr_41`,marker:`_marker_k2wwr_44`,"engine-claude":`_engine-claude_k2wwr_45`,"engine-codex":`_engine-codex_k2wwr_46`,"engine-grok":`_engine-grok_k2wwr_47`,"engine-local":`_engine-local_k2wwr_48`,rowText:`_rowText_k2wwr_50`,rowPrimary:`_rowPrimary_k2wwr_51`,rowSecondary:`_rowSecondary_k2wwr_58`,rowTrailing:`_rowTrailing_k2wwr_67`,emptyRow:`_emptyRow_k2wwr_76`};function Bt({open:e,onClose:t,sessions:n,seats:r,projects:i,onSelectSession:a,onNewChat:o}){let s=(0,z.useId)(),c=(0,z.useId)(),l=(0,z.useRef)(null),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>{e&&(d(``),p(0))},[e]);let m=(0,z.useMemo)(()=>{let e=u.trim().toLowerCase(),s=[...n].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({id:`session:${e.id}`,kind:`session`,engine:e.engine,primary:e.title||`Untitled chat`,secondary:`${Re(e.projectPath,i)} · ${je(r,e)} · ${e.model}`,trailing:Be(e.updatedAt),run:()=>{a(e.id),t()}})),c=r.filter(e=>e.health.state!==`unavailable`&&e.models.length>0).map(e=>({id:`seat:${e.id}`,kind:`seat`,engine:e.engine,primary:`New chat on ${e.label}`,secondary:e.models[0].label,trailing:`⌘N`,run:()=>{o({seatId:e.id,model:e.models[0].id}),t()}})),l=[...s,...c];return e?l.filter(t=>t.primary.toLowerCase().includes(e)||t.secondary.toLowerCase().includes(e)):l},[u,n,r,i,a,o,t]);(0,z.useEffect)(()=>{f>=m.length&&p(0)},[m.length,f]);function h(e){e.key===`ArrowDown`?(e.preventDefault(),p(e=>m.length?(e+1)%m.length:0)):e.key===`ArrowUp`?(e.preventDefault(),p(e=>m.length?(e-1+m.length)%m.length:0)):e.key===`Enter`&&(e.preventDefault(),m[f]?.run())}return(0,V.jsxs)(S,{open:e,onClose:t,titleId:s,title:`Switch chat`,initialFocusRef:l,widthClassName:zt.width,children:[(0,V.jsx)(`input`,{ref:l,className:zt.input,value:u,placeholder:`Search chats or start one on a seat…`,role:`combobox`,"aria-expanded":`true`,"aria-controls":c,"aria-activedescendant":m[f]?`${c}-${f}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,onChange:e=>{d(e.target.value),p(0)},onKeyDown:h}),(0,V.jsx)(`ul`,{id:c,role:`listbox`,className:zt.list,"aria-label":`Chats and seats`,children:m.length===0?(0,V.jsx)(`li`,{className:zt.emptyRow,children:`Nothing matches.`}):m.map((e,t)=>(0,V.jsxs)(`li`,{id:`${c}-${t}`,role:`option`,"aria-selected":t===f,className:`${zt.row} ${zt[`engine-${e.engine}`]??``} ${t===f?zt.rowActive:``}`,"data-kind":e.kind,onMouseEnter:()=>p(t),onMouseDown:e=>e.preventDefault(),onClick:e.run,children:[(0,V.jsx)(`span`,{className:zt.marker,"aria-hidden":`true`}),(0,V.jsxs)(`span`,{className:zt.rowText,children:[(0,V.jsx)(`span`,{className:zt.rowPrimary,children:e.primary}),(0,V.jsx)(`span`,{className:zt.rowSecondary,children:e.secondary})]}),(0,V.jsx)(`span`,{className:zt.rowTrailing,"aria-hidden":`true`,children:e.trailing})]},e.id))})]})}var Vt={roots:`_roots_afeac_8`,title:`_title_afeac_10`,count:`_count_afeac_22`,workspace:`_workspace_afeac_30`,list:`_list_afeac_36`,root:`_root_afeac_8`,rootHead:`_rootHead_afeac_57`,name:`_name_afeac_64`,badge:`_badge_afeac_72`,path:`_path_afeac_84`,git:`_git_afeac_97`,remote:`_remote_afeac_98`,caveat:`_caveat_afeac_99`,note:`_note_afeac_116`,error:`_error_afeac_117`};function Ht({session:e,refreshKey:t=0}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),o=e?.id??null;return(0,z.useEffect)(()=>{if(!o){r(null);return}let e=new AbortController;return a(null),le(o,e.signal).then(e=>r(e)).catch(t=>{e.signal.aborted||(r(null),a(t instanceof Error?t.message:`could not read this chat’s folders`))}),()=>e.abort()},[o,t]),!e||n!==null&&n.roots.length<=1&&n.workspaceId===null?null:(0,V.jsxs)(`section`,{className:Vt.roots,"aria-labelledby":`verse-res-roots`,children:[(0,V.jsxs)(`h3`,{id:`verse-res-roots`,className:Vt.title,children:[`Folders`,n?(0,V.jsx)(`span`,{className:Vt.count,children:n.roots.length}):null]}),n?.workspaceName?(0,V.jsxs)(`p`,{className:Vt.workspace,children:[`Workspace `,(0,V.jsx)(`strong`,{children:n.workspaceName})]}):null,i?(0,V.jsx)(`p`,{role:`alert`,className:Vt.error,children:i}):null,(0,V.jsx)(`ul`,{className:Vt.list,children:(n?.roots??[]).map(e=>{let t=qe(e),n=R(e);return(0,V.jsxs)(`li`,{className:Vt.root,"data-tone":nt(e),children:[(0,V.jsxs)(`div`,{className:Vt.rootHead,children:[(0,V.jsx)(`span`,{className:Vt.name,children:e.name}),(0,V.jsx)(`span`,{className:Vt.badge,children:e.primary?`primary`:`added`})]}),(0,V.jsx)(`p`,{className:Vt.path,children:e.path}),(0,V.jsx)(`p`,{className:Vt.git,children:t??`not a git repo`}),e.git?.remote?(0,V.jsx)(`p`,{className:Vt.remote,children:e.git.remote}):null,n?(0,V.jsx)(`p`,{className:Vt.caveat,children:n}):null]},e.path)})}),(n?.notes??[]).map(e=>(0,V.jsx)(`p`,{className:Vt.note,children:e},e))]})}var Ut=`ashlr.verse.resources.v1`,Wt=80,Gt=200;function Kt(){return{collapsedGroups:[],seats:{}}}function qt(e){return e!==`blocked`}function Jt(e,t){return!e.collapsedGroups.includes(t)}function Yt(e,t,n){let r=e.seats[t];return typeof r==`boolean`?r:qt(n)}function Xt(e,t){let n=e.collapsedGroups.includes(t)?e.collapsedGroups.filter(e=>e!==t):[...e.collapsedGroups,t];return{...e,collapsedGroups:n}}function Zt(e,t,n){if(!$t(t))return e;let r={...e.seats,[t]:!Yt(e,t,n)};return{...e,seats:en(r)}}function Qt(e){return e.kind===`local`?[]:e.binding===null?[...e.others]:[e.binding,...e.others.filter(t=>t.id!==e.binding.id)]}function $t(e){return e.length>0&&e.length<=Gt&&e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function en(e){let t=Object.entries(e);return t.length<=Wt?{...e}:Object.fromEntries(t.slice(t.length-Wt))}function tn(e){if(e===null||e===``)return Kt();let t;try{t=JSON.parse(e)}catch{return Kt()}if(!t||typeof t!=`object`||Array.isArray(t))return Kt();let n=t,r=[];if(Array.isArray(n.collapsedGroups))for(let e of n.collapsedGroups)typeof e==`string`&&ke(e)&&!r.includes(e)&&r.push(e);let i={},a=n.seats;if(a&&typeof a==`object`&&!Array.isArray(a)){for(let[e,t]of Object.entries(a))if($t(e)&&typeof t==`boolean`){if(Object.keys(i).length>=Wt)break;Object.defineProperty(i,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}return{collapsedGroups:r,seats:i}}function nn(){try{return tn(localStorage.getItem(Ut))}catch{return Kt()}}function rn(e){try{localStorage.setItem(Ut,JSON.stringify({collapsedGroups:e.collapsedGroups,seats:e.seats}))}catch{}}var an={session:null,events:[],lastSeq:0,loaded:!1,loadError:null,stream:`idle`},on=new Map,sn=new Set;function cn(){for(let e of sn)e()}function ln(e){return sn.add(e),()=>sn.delete(e)}function un(e){let t=on.get(e);return t||(t={sessionId:e,...an},on.set(e,t)),t}function dn(e,t){let n=un(e);on.set(e,{...n,...t}),cn()}var fn={sessionId:``,...an};function pn(e){return e?un(e):fn}function mn(e,t,n){let r=Sn(un(e).events,n);dn(e,{session:vn(t,r),events:r,lastSeq:r.length?r[r.length-1].seq:0,loaded:!0,loadError:null})}function hn(e,t){dn(e,{loadError:t,loaded:!0})}function gn(e,t){un(e).stream!==t&&dn(e,{stream:t})}function _n(e,t,n){dn(e,{session:vn(t,un(e).events,n)})}function vn(e,t,n){if(e.status!==`running`)return e;let r=-1,i=n??null;if(!n){for(let e of t)(e.type===`user-message`||e.type===`turn-started`)&&(r=e.seq,i=e.turnId);if(i===null)return e}let a=null,o=null;for(let e of t)e.seq<=r||(e.type===`error`&&e.turnId===i&&(o=e.message),(e.type===`turn-done`||e.type===`cancelled`)&&e.turnId===i&&(a=e));if(!a)return e;let s=a.type===`turn-done`&&!a.ok&&o!==null;return{...e,status:s?`error`:`idle`,lastError:s?o:null,updatedAt:a.at>e.updatedAt?a.at:e.updatedAt}}function yn(e,t){let n=un(e);n.session&&n.session.status!==t&&dn(e,{session:{...n.session,status:t}})}function bn(e,t){let n=un(e);if(!Number.isFinite(t.seq)||n.events.some(e=>e.seq===t.seq))return!1;let r=Sn(n.events,[t]),i=n.session;if(i)switch(t.type){case`turn-started`:i={...i,status:`running`,lastError:null,updatedAt:t.at};break;case`usage`:i={...i,usage:{inputTokens:i.usage.inputTokens+t.usage.inputTokens,outputTokens:i.usage.outputTokens+t.usage.outputTokens,cacheReadTokens:i.usage.cacheReadTokens+t.usage.cacheReadTokens,cacheCreationTokens:i.usage.cacheCreationTokens+t.usage.cacheCreationTokens,contextTokens:t.usage.contextTokens,contextWindow:t.usage.contextWindow??i.usage.contextWindow},updatedAt:t.at};break;case`turn-done`:i={...i,status:t.ok?`idle`:i.lastError?`error`:`idle`,turnCount:i.turnCount+1,nativeSessionId:t.nativeSessionId??i.nativeSessionId,updatedAt:t.at};break;case`error`:i={...i,status:`error`,lastError:t.message,updatedAt:t.at};break;case`cancelled`:i={...i,status:`idle`,updatedAt:t.at}}return dn(e,{events:r,lastSeq:Math.max(n.lastSeq,t.seq),session:i}),!0}function xn(e){on.delete(e)&&cn()}function Sn(e,t){if(t.length===0)return e;let n=new Map;for(let t of e)n.set(t.seq,t);for(let e of t)n.has(e.seq)||n.set(e.seq,e);return[...n.values()].sort((e,t)=>e.seq-t.seq)}function Cn(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):null}function wn(e){let t=[],n=new Map,r=null,i=!1,a=null,o=e=>{r&&=(t.push({kind:`assistant`,key:r.key,turnId:r.turnId,at:r.at,text:r.text,streaming:e}),null)};for(let s of e)switch(s.type){case`user-message`:o(!1),t.push({kind:`user`,key:`u-${s.seq}`,turnId:s.turnId,at:s.at,text:s.text});break;case`turn-started`:i=!0;break;case`text-delta`:r&&r.turnId!==s.turnId&&o(!1),r||={turnId:s.turnId,at:s.at,text:``,key:`d-${s.seq}`},r.text+=s.text;break;case`assistant-message`:r=null,t.push({kind:`assistant`,key:`a-${s.seq}`,turnId:s.turnId,at:s.at,text:s.text,streaming:!1});break;case`thinking`:o(!1),t.push({kind:`thinking`,key:`t-${s.seq}`,turnId:s.turnId,at:s.at,text:s.text});break;case`tool-use`:o(!1),n.set(s.toolUseId,t.length),t.push({kind:`tool`,key:`tu-${s.seq}`,turnId:s.turnId,at:s.at,toolUseId:s.toolUseId,name:s.name,input:s.input,result:null,durationMs:null});break;case`tool-result`:{let e=n.get(s.toolUseId),r=e===void 0?void 0:t[e];r&&r.kind===`tool`?t[e]={...r,result:{output:s.output,isError:s.isError},durationMs:Cn(r.at,s.at)}:t.push({kind:`tool`,key:`tr-${s.seq}`,turnId:s.turnId,at:s.at,toolUseId:s.toolUseId,name:`tool`,input:null,result:{output:s.output,isError:s.isError},durationMs:null});break}case`usage`:a=s.usage;break;case`error`:o(!1),t.push({kind:`error`,key:`e-${s.seq}`,turnId:s.turnId,at:s.at,message:s.message});break;case`cancelled`:o(!1),i=!1,t.push({kind:`cancelled`,key:`c-${s.seq}`,turnId:s.turnId,at:s.at});break;case`turn-done`:o(!1),i=!1,t.push({kind:`turn-done`,key:`td-${s.seq}`,turnId:s.turnId,at:s.at,ok:s.ok,durationMs:s.durationMs})}return o(i),{items:t,live:i,usage:a}}function Tn(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push(n[0]):t.push(En(n)),n=[])};for(let i of e){if((i.kind===`tool`||i.kind===`thinking`)&&(n.length===0||n[0].turnId===i.turnId)){n.push(i);continue}r(),i.kind===`tool`||i.kind===`thinking`?n.push(i):t.push(i)}return r(),t}function En(e){let t=new Map,n=0,r=!1;for(let i of e)i.kind===`tool`&&(t.set(i.name,(t.get(i.name)??0)+1),i.result===null?r=!0:i.result.isError&&(n+=1));let i=[...t.values()].reduce((e,t)=>e+t,0),a=[...t.entries()].map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `),o=Cn(e[0].at,e[e.length-1].at);return{kind:`toolGroup`,key:`g-${e[0].key}`,turnId:e[0].turnId,at:e[0].at,items:e,toolCount:i,summary:a,errorCount:n,pending:r,spanMs:o}}function Dn(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?String(Math.round(e)):e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}var W={panel:`_panel_1ry56_3`,head:`_head_1ry56_10`,title:`_title_1ry56_22`,close:`_close_1ry56_30`,scroll:`_scroll_1ry56_45`,section:`_section_1ry56_46`,sectionTitle:`_sectionTitle_1ry56_48`,asOf:`_asOf_1ry56_64`,refresh:`_refresh_1ry56_73`,count:`_count_1ry56_89`,skeleton:`_skeleton_1ry56_90`,muted:`_muted_1ry56_91`,engineGroup:`_engineGroup_1ry56_95`,engineTitle:`_engineTitle_1ry56_96`,groupToggle:`_groupToggle_1ry56_105`,seatToggle:`_seatToggle_1ry56_106`,twist:`_twist_1ry56_126`,seatList:`_seatList_1ry56_137`,models:`_models_1ry56_137`,runningList:`_runningList_1ry56_137`,seat:`_seat_1ry56_106`,"engine-claude":`_engine-claude_1ry56_154`,"engine-codex":`_engine-codex_1ry56_155`,"engine-grok":`_engine-grok_1ry56_156`,"engine-local":`_engine-local_1ry56_157`,seatHead:`_seatHead_1ry56_159`,seatLabel:`_seatLabel_1ry56_160`,seatMeta:`_seatMeta_1ry56_169`,seatSummary:`_seatSummary_1ry56_177`,plan:`_plan_1ry56_180`,num:`_num_1ry56_181`,notes:`_notes_1ry56_185`,seatWindows:`_seatWindows_1ry56_202`,credits:`_credits_1ry56_203`,local:`_local_1ry56_206`,mono:`_mono_1ry56_207`,runningRow:`_runningRow_1ry56_220`,runningOpen:`_runningOpen_1ry56_221`,runningMeta:`_runningMeta_1ry56_241`,runningDot:`_runningDot_1ry56_243`,"verse-pulse-res":`_verse-pulse-res_1ry56_1`,runningTitle:`_runningTitle_1ry56_250`,stop:`_stop_1ry56_266`,usage:`_usage_1ry56_281`};function On(e){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function kn(e){let t=null;for(let n of e){let e=ht(n).observedAt;e!==null&&(t===null||e>t)&&(t=e)}return t}function An(){let[e,t]=(0,z.useState)(nn),n=e=>{t(t=>{let n=e(t);return rn(n),n})};return{state:e,toggleGroup:e=>n(t=>Xt(t,e)),toggleSeat:(e,t)=>n(n=>Zt(n,e.id,t.cls))}}function jn({seat:e,view:t}){let n=Qt(t),r=_t(e,t),i=e.contextWindow===null?`ctx n/a`:`${Dn(e.contextWindow)} ctx`,a=`${e.models.length} model${e.models.length===1?``:`s`}`,o=gt(t.evidenceSource),s=o===null?t.notes:[...t.notes,o];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:W.seatMeta,children:[(0,V.jsx)(`span`,{children:Ve[e.engine]}),t.plan===null?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{className:W.plan,children:t.plan})]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{children:a}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{className:W.num,children:i})]}),t.kind===`local`||n.length===0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:W.seatSummary,children:t.summary}),t.kind===`local`||e.health.summary===null||e.health.summary===t.summary?null:(0,V.jsx)(`p`,{className:W.seatSummary,children:e.health.summary})]}):(0,V.jsx)(`div`,{className:W.seatWindows,children:n.map(n=>(0,V.jsx)(xt,{windowView:n,ariaPrefix:e.label,prominent:t.binding?.id===n.id},n.id))}),t.credits===null?null:(0,V.jsx)(`p`,{className:W.credits,title:t.creditsTitle??r,children:t.credits}),s.length===0?null:(0,V.jsx)(`ul`,{className:W.notes,children:s.map(e=>(0,V.jsx)(`li`,{children:e},e))})]})}function Mn({seat:e,open:t,onToggle:n}){let r=ht(e),i=_t(e,r),a=`verse-seat-${e.id.replace(/[^A-Za-z0-9_-]/g,`-`)}`;return(0,V.jsxs)(`li`,{className:`${W.seat} ${W[`engine-${e.engine}`]??``}`,"data-engine":e.engine,"data-capacity":r.cls,"data-open":t?`true`:`false`,children:[(0,V.jsx)(O,{label:i,placement:`left`,children:(0,V.jsxs)(`button`,{type:`button`,className:W.seatToggle,"aria-expanded":t,"aria-controls":a,"aria-label":e.label,onClick:n,children:[(0,V.jsx)(`span`,{className:W.twist,"data-open":t?``:void 0,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:W.seatLabel,children:e.label}),r.kind===`local`?(0,V.jsx)(_,{status:e.health.state,tone:e.health.state===`ready`?`success`:e.health.state===`unavailable`?`danger`:`unknown`}):(0,V.jsx)(bt,{view:r})]})}),t?(0,V.jsx)(`div`,{id:a,children:(0,V.jsx)(jn,{seat:e,view:r})}):(0,V.jsx)(`p`,{id:a,className:W.seatSummary,children:r.summary})]})}function Nn({bootstrap:e,sessions:t,current:n,onStop:r,onOpen:i,onClose:a}){let o=t.filter(e=>e.status===`running`),s=On(o.length>0),c=e?Oe(e.seats):[],l=e?.localRuntime.ollama,u=y(fe),f=d(fe),p=e?kn(e.seats):null,h=p===null?null:Ne(p),v=An();return(0,V.jsxs)(`aside`,{className:W.panel,"aria-label":`Resources`,children:[(0,V.jsxs)(`header`,{className:W.head,children:[(0,V.jsx)(`h2`,{className:W.title,children:`Resources`}),(0,V.jsx)(`button`,{type:`button`,className:W.close,onClick:a,"aria-label":`Hide resources`,children:`×`})]}),(0,V.jsxs)(`div`,{className:W.scroll,children:[(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-seats`,children:[(0,V.jsxs)(`h3`,{id:`verse-res-seats`,className:W.sectionTitle,children:[(0,V.jsx)(`span`,{children:`Seats`}),(0,V.jsx)(`span`,{className:W.asOf,children:h===null?`no reading yet`:`as of ${h}`}),u.status===`refreshing`?(0,V.jsx)(g,{label:`Refreshing seats`}):null,(0,V.jsx)(`button`,{type:`button`,className:W.refresh,onClick:f,children:`Refresh`})]}),e?c.length===0?(0,V.jsxs)(`p`,{className:W.muted,children:[`No seats discovered. Connect an account with `,(0,V.jsx)(`code`,{children:`ashlr accounts`}),` or start Ollama.`]}):c.map(e=>{let t=Jt(v.state,e.engine),n=`verse-res-group-${e.engine}`;return(0,V.jsxs)(`div`,{className:W.engineGroup,children:[(0,V.jsx)(`h4`,{className:W.engineTitle,children:(0,V.jsxs)(`button`,{type:`button`,className:W.groupToggle,"aria-expanded":t,"aria-controls":n,"aria-label":`${Ve[e.engine]} seats`,onClick:()=>v.toggleGroup(e.engine),children:[(0,V.jsx)(`span`,{className:W.twist,"data-open":t?``:void 0,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:Ve[e.engine]}),(0,V.jsx)(`span`,{className:W.count,children:e.seats.length})]})}),t?(0,V.jsx)(`ul`,{id:n,className:W.seatList,children:e.seats.map(e=>{let t=ht(e);return(0,V.jsx)(Mn,{seat:e,open:Yt(v.state,e.id,t.cls),onToggle:()=>v.toggleSeat(e,t)},e.id)})}):(0,V.jsx)(`ul`,{id:n,className:W.seatList,hidden:!0})]},e.engine)}):(0,V.jsxs)(`div`,{className:W.skeleton,children:[(0,V.jsx)(m,{width:`70%`}),(0,V.jsx)(m,{width:`50%`}),(0,V.jsx)(m,{width:`64%`})]})]}),(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-local`,children:[(0,V.jsx)(`h3`,{id:`verse-res-local`,className:W.sectionTitle,children:`Local runtime`}),l?(0,V.jsxs)(`div`,{className:W.local,children:[(0,V.jsxs)(`div`,{className:W.seatHead,children:[(0,V.jsx)(`span`,{className:W.seatLabel,children:`Ollama`}),(0,V.jsx)(_,{status:l.reachable?`ready`:`unavailable`,tone:l.reachable?`success`:`danger`,children:l.reachable?`reachable`:`unreachable`})]}),(0,V.jsx)(`p`,{className:W.mono,title:l.baseUrl,children:l.baseUrl}),l.reachable?l.models.length>0?(0,V.jsx)(`ul`,{className:W.models,children:l.models.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`code`,{children:e})},e))}):(0,V.jsx)(`p`,{className:W.muted,children:`No models pulled yet.`}):(0,V.jsx)(`p`,{className:W.muted,children:`Start Ollama to enable local seats.`})]}):(0,V.jsx)(m,{width:`60%`})]}),(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-running`,children:[(0,V.jsxs)(`h3`,{id:`verse-res-running`,className:W.sectionTitle,children:[`Running `,(0,V.jsx)(`span`,{className:W.count,children:o.length})]}),o.length===0?(0,V.jsx)(`p`,{className:W.muted,children:`Nothing running.`}):(0,V.jsx)(`ul`,{className:W.runningList,children:o.map(t=>(0,V.jsxs)(`li`,{className:W.runningRow,children:[(0,V.jsxs)(`button`,{type:`button`,className:W.runningOpen,onClick:()=>i(t.id),title:t.title,children:[(0,V.jsx)(`span`,{className:W.runningDot,role:`img`,"aria-label":`Running`}),(0,V.jsx)(`span`,{className:W.runningTitle,children:t.title||`Untitled chat`}),(0,V.jsxs)(`span`,{className:W.runningMeta,children:[Re(t.projectPath,e?.projects??[]),` · `,Le(s-new Date(t.updatedAt).getTime())]})]}),(0,V.jsx)(`button`,{type:`button`,className:W.stop,onClick:()=>r(t.id),"aria-label":`Stop ${t.title||`chat`}`,children:`Stop`})]},t.id))})]}),(0,V.jsx)(Ht,{session:n,refreshKey:n?.turnCount??0}),(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-usage`,children:[(0,V.jsx)(`h3`,{id:`verse-res-usage`,className:W.sectionTitle,children:`This chat`}),n?(0,V.jsxs)(`dl`,{className:W.usage,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Input`}),(0,V.jsx)(`dd`,{children:Dn(n.usage.inputTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Output`}),(0,V.jsx)(`dd`,{children:Dn(n.usage.outputTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Cache read`}),(0,V.jsx)(`dd`,{children:Dn(n.usage.cacheReadTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Cache write`}),(0,V.jsx)(`dd`,{children:Dn(n.usage.cacheCreationTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Turns`}),(0,V.jsx)(`dd`,{children:n.turnCount})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Context`}),(0,V.jsxs)(`dd`,{children:[Dn(n.usage.contextTokens),n.usage.contextWindow?` / ${Dn(n.usage.contextWindow)}`:``]})]})]}):(0,V.jsx)(`p`,{className:W.muted,children:`Select a chat to see its usage.`})]})]})]})}var G={width:`_width_jrygt_4`,form:`_form_jrygt_6`,field:`_field_jrygt_7`,label:`_label_jrygt_8`,select:`_select_jrygt_17`,input:`_input_jrygt_18`,hint:`_hint_jrygt_36`,error:`_error_jrygt_37`,rootRow:`_rootRow_jrygt_47`,rowButton:`_rowButton_jrygt_56`,addRoot:`_addRoot_jrygt_57`,checkbox:`_checkbox_jrygt_74`,priorityRow:`_priorityRow_jrygt_82`,priorityPath:`_priorityPath_jrygt_88`,actions:`_actions_jrygt_99`,spacer:`_spacer_jrygt_100`,confirm:`_confirm_jrygt_101`,cancel:`_cancel_jrygt_103`,save:`_save_jrygt_104`,remove:`_remove_jrygt_105`,danger:`_danger_jrygt_106`};function Pn(e){let{open:t,workspace:n,initialRoots:r,priorities:i,focusSectionId:a=null,onClose:o,onSaved:s,onDeleted:c}=e,l=(0,z.useId)(),u=(0,z.useId)(),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)([``]),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)({}),[x,C]=(0,z.useState)(!1),[ee,w]=(0,z.useState)(!1),[T,E]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(!t)return;let e=n;f(e?.name??``),m(e?We(e):[...r??[]].filter(e=>e.length>0)),g(e?.section??!1),v(e!==null&&a===e.id),b({}),C(!1),w(!1),E(null)},[t]);let D=p.length===0?[``]:p,O=At();function k(e,t){m(D.map((n,r)=>r===e?t:n))}async function A(e){let t=await jt();t!==null&&t.length>0&&k(e,t)}function te(e){return y[e]??Qe(e,i)}async function j(e){e.preventDefault();let t=Xe(d,D);if(!t.ok){E(t.error);return}w(!0),E(null);try{let e=n===null?await pe({name:t.name,roots:t.roots,section:h}):await L(n.id,{name:t.name,roots:t.roots,section:h});for(let e of t.roots){let t=y[e];t!==void 0&&t!==Qe(e,i)&&await _e(e,t)}let r=n!==null&&a===n.id;h&&_!==r&&await de(_?e.id:null),s?.(e),o()}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(!1)}}async function M(){if(n!==null){w(!0),E(null);try{await ge(n.id),c?.(n.id),o()}catch(e){E(e instanceof Error?e.message:String(e)),w(!1)}}}return(0,V.jsx)(S,{open:t,onClose:o,titleId:l,title:n===null?`Save a project`:`Edit project`,description:`Saved projects stay in the picker — they do not need a chat on them first.`,widthClassName:G.width,children:(0,V.jsxs)(`form`,{className:G.form,onSubmit:e=>void j(e),noValidate:!0,children:[(0,V.jsxs)(`label`,{className:G.field,htmlFor:u,children:[(0,V.jsx)(`span`,{className:G.label,children:`Name`}),(0,V.jsx)(`input`,{id:u,className:G.input,value:d,onChange:e=>f(e.target.value),placeholder:`Defaults to the folder’s own name`,maxLength:120,autoComplete:`off`})]}),(0,V.jsxs)(`div`,{className:G.field,children:[(0,V.jsx)(`span`,{className:G.label,children:`Folders`}),(0,V.jsx)(`p`,{className:G.hint,children:`The first folder is the primary: it is the chat’s working directory. Move a folder to the top to make it the primary.`}),D.map((e,t)=>(0,V.jsxs)(`div`,{className:G.rootRow,children:[(0,V.jsx)(`input`,{className:G.input,value:e,onChange:e=>k(t,e.target.value),placeholder:`/absolute/path/to/folder`,"aria-label":Je(t),autoComplete:`off`,spellCheck:!1}),O?(0,V.jsx)(`button`,{type:`button`,className:G.rowButton,onClick:()=>void A(t),"aria-label":`Choose ${Je(t).toLowerCase()}`,children:`Choose folder…`}):null,(0,V.jsx)(`button`,{type:`button`,className:G.rowButton,disabled:t===0,onClick:()=>m(Ke(D,t,`up`)),"aria-label":`Move ${Je(t).toLowerCase()} up`,children:`↑`}),(0,V.jsx)(`button`,{type:`button`,className:G.rowButton,disabled:t===D.length-1,onClick:()=>m(Ke(D,t,`down`)),"aria-label":`Move ${Je(t).toLowerCase()} down`,children:`↓`}),(0,V.jsx)(`button`,{type:`button`,className:G.rowButton,disabled:D.length===1,onClick:()=>m(D.filter((e,n)=>n!==t)),"aria-label":`Remove ${Je(t).toLowerCase()}`,children:`Remove`})]},t)),D.length<8?(0,V.jsx)(`button`,{type:`button`,className:G.addRoot,onClick:()=>m([...D,``]),children:`Add a folder`}):null,D.length>1?(0,V.jsx)(`p`,{className:G.hint,children:at}):null]}),(0,V.jsxs)(`div`,{className:G.field,children:[(0,V.jsxs)(`label`,{className:G.checkbox,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),(0,V.jsx)(`span`,{children:`Offer this project to the autonomous lane as a section`})]}),h?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:G.checkbox,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),(0,V.jsx)(`span`,{children:`Focus the fleet on this section`})]}),(0,V.jsx)(`p`,{className:G.hint,children:rt}),D.filter(e=>e.trim().length>0).map((e,t)=>(0,V.jsxs)(`div`,{className:G.priorityRow,children:[(0,V.jsx)(`span`,{className:G.priorityPath,title:e,children:e}),(0,V.jsx)(`select`,{className:G.select,"aria-label":`Priority for ${e}`,value:te(e.trim()),onChange:t=>b({...y,[e.trim()]:t.target.value}),children:Ze.map(e=>(0,V.jsx)(`option`,{value:e,children:et[e]},e))})]},`${e}-${t}`))]}):null]}),T?(0,V.jsx)(`p`,{role:`alert`,className:G.error,children:T}):null,(0,V.jsxs)(`div`,{className:G.actions,children:[n===null?null:x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:G.confirm,children:`Forget this project? Chats already on it are untouched.`}),(0,V.jsx)(`button`,{type:`button`,className:G.danger,onClick:()=>void M(),disabled:ee,children:`Forget`}),(0,V.jsx)(`button`,{type:`button`,className:G.cancel,onClick:()=>C(!1),children:`Keep`})]}):(0,V.jsx)(`button`,{type:`button`,className:G.remove,onClick:()=>C(!0),disabled:ee,children:`Forget project`}),(0,V.jsx)(`span`,{className:G.spacer}),(0,V.jsx)(`button`,{type:`button`,className:G.cancel,onClick:o,children:`Cancel`}),(0,V.jsx)(`button`,{type:`submit`,className:G.save,disabled:ee,children:ee?`Saving…`:`Save project`})]})]})})}var Fn={projects:`_projects_izay2_4`,head:`_head_izay2_10`,headText:`_headText_izay2_23`,add:`_add_izay2_25`,list:`_list_izay2_39`,project:`_project_izay2_4`,name:`_name_izay2_55`,summary:`_summary_izay2_64`,empty:`_empty_izay2_72`};function In(){let e=y(we),t=e.data?.workspaces??[],[n,r]=(0,z.useState)({open:!1,workspace:null});return(0,V.jsxs)(`section`,{className:Fn.projects,"aria-label":`Saved projects`,children:[(0,V.jsxs)(`h2`,{className:Fn.head,children:[(0,V.jsx)(`span`,{className:Fn.headText,children:`Projects`}),(0,V.jsx)(`button`,{type:`button`,className:Fn.add,title:`Save a project`,"aria-label":`Save a project`,onClick:()=>r({open:!0,workspace:null}),children:(0,V.jsx)(M,{})})]}),t.length>0?(0,V.jsx)(`ul`,{className:Fn.list,children:t.map(e=>{let t=Ye(e)??``;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:Fn.project,title:t,"aria-label":`Edit project ${e.name}`,onClick:()=>r({open:!0,workspace:e}),children:[(0,V.jsx)(`span`,{className:Fn.name,children:e.name}),(0,V.jsx)(`span`,{className:Fn.summary,children:ot(e)})]})},e.id)})}):e.status===`error`?null:(0,V.jsx)(`p`,{className:Fn.empty,children:`No saved projects yet.`}),(0,V.jsx)(Pn,{open:n.open,workspace:n.workspace,priorities:e.data?.priorities,focusSectionId:e.data?.focusSectionId??null,onClose:()=>r({open:!1,workspace:null})})]})}var K={sidebar:`_sidebar_1kc2o_1`,head:`_head_1kc2o_9`,headDragStrip:`_headDragStrip_1kc2o_40`,search:`_search_1kc2o_51`,searchIcon:`_searchIcon_1kc2o_58`,iconButton:`_iconButton_1kc2o_80`,scroll:`_scroll_1kc2o_98`,skeleton:`_skeleton_1kc2o_105`,error:`_error_1kc2o_106`,empty:`_empty_1kc2o_125`,emptyTitle:`_emptyTitle_1kc2o_131`,emptyAction:`_emptyAction_1kc2o_134`,emptyKey:`_emptyKey_1kc2o_149`,group:`_group_1kc2o_159`,groupTitle:`_groupTitle_1kc2o_160`,groupName:`_groupName_1kc2o_173`,enrolled:`_enrolled_1kc2o_174`,groupCount:`_groupCount_1kc2o_178`,list:`_list_1kc2o_187`,session:`_session_1kc2o_190`,marker:`_marker_1kc2o_242`,"engine-claude":`_engine-claude_1kc2o_248`,"engine-codex":`_engine-codex_1kc2o_249`,"engine-grok":`_engine-grok_1kc2o_250`,"engine-local":`_engine-local_1kc2o_251`,sessionText:`_sessionText_1kc2o_190`,running:`_running_1kc2o_262`,"verse-pulse":`_verse-pulse_1kc2o_1`,errored:`_errored_1kc2o_269`,seatSpent:`_seatSpent_1kc2o_284`,time:`_time_1kc2o_296`,footer:`_footer_1kc2o_315`,footerButton:`_footerButton_1kc2o_323`};function Ln(e){let{sessions:t,sessionsStatus:n,sessionsError:r,projects:i,seats:a,selectedId:o,query:s,onQuery:c,onSelect:l,onNew:u,onRetry:d,onCollapse:f,onDisconnect:p}=e,h=(0,z.useId)(),_=Pe(t,i,s),v=n===`loading`||n===`idle`&&t.length===0;return(0,V.jsxs)(`nav`,{className:K.sidebar,"aria-label":`Chats`,children:[(0,V.jsxs)(`div`,{className:K.head,children:[(0,V.jsx)(`div`,{className:K.headDragStrip,"aria-hidden":`true`}),(0,V.jsxs)(`label`,{className:K.search,htmlFor:h,children:[(0,V.jsx)(`span`,{className:K.searchIcon,"aria-hidden":`true`,children:(0,V.jsx)(ve,{})}),(0,V.jsx)(`span`,{className:`visually-hidden`,children:`Search chats`}),(0,V.jsx)(`input`,{id:h,type:`search`,value:s,placeholder:`Search chats`,autoComplete:`off`,onChange:e=>c(e.target.value)})]}),(0,V.jsx)(O,{label:`New chat`,shortcut:`⌘N`,placement:`bottom`,children:(0,V.jsx)(`button`,{type:`button`,className:K.iconButton,onClick:u,"aria-label":`New chat`,children:(0,V.jsx)(M,{})})}),(0,V.jsx)(O,{label:`Hide chat list`,placement:`bottom`,children:(0,V.jsx)(`button`,{type:`button`,className:K.iconButton,onClick:f,"aria-label":`Hide chat list`,children:(0,V.jsx)(j,{})})}),n===`refreshing`?(0,V.jsx)(g,{label:`Refreshing chats`}):null]}),(0,V.jsxs)(`div`,{className:K.scroll,children:[(0,V.jsx)(In,{}),v?(0,V.jsxs)(`div`,{className:K.skeleton,"aria-busy":`true`,children:[(0,V.jsx)(m,{width:`48%`}),(0,V.jsx)(m,{width:`86%`}),(0,V.jsx)(m,{width:`74%`}),(0,V.jsx)(m,{width:`40%`}),(0,V.jsx)(m,{width:`80%`})]}):n===`error`&&t.length===0?(0,V.jsxs)(`div`,{role:`alert`,className:K.error,children:[(0,V.jsx)(`p`,{children:r??`Could not load chats.`}),(0,V.jsx)(`button`,{type:`button`,onClick:d,children:`Retry`})]}):_.length===0?(0,V.jsx)(`div`,{className:K.empty,children:s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:K.emptyTitle,children:[`No chats match “`,s,`”`]}),(0,V.jsx)(`p`,{children:`Search covers chat titles and the project each one is on.`}),(0,V.jsx)(`button`,{type:`button`,className:K.emptyAction,onClick:()=>c(``),children:`Clear search`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:K.emptyTitle,children:`No chats yet`}),(0,V.jsx)(`p`,{children:`Start one on any project with any seat.`}),(0,V.jsxs)(`button`,{type:`button`,className:K.emptyAction,onClick:u,children:[`Start your first chat `,(0,V.jsx)(`kbd`,{className:K.emptyKey,children:`⌘N`})]})]})}):_.map(e=>(0,V.jsxs)(`section`,{className:K.group,"aria-label":e.name,children:[(0,V.jsxs)(`h2`,{className:K.groupTitle,title:e.projectPath,children:[(0,V.jsx)(`span`,{className:K.groupName,children:e.name}),e.enrolled?(0,V.jsx)(`span`,{className:K.enrolled,children:`enrolled`}):null,(0,V.jsx)(`span`,{className:K.groupCount,"aria-hidden":`true`,children:e.sessions.length})]}),(0,V.jsx)(`ul`,{className:K.list,children:e.sessions.map(e=>{let t=Fe(a,e.seatId),n=t===void 0?null:ht(t),r=e.status===`running`&&n?.cls===`blocked`,i=n===null||n.cls===`ready`||n.cls===`unread`?`${e.title} · ${Te(a,e)}`:`${e.title} · ${Te(a,e)} · ${n.summary}`;return(0,V.jsx)(`li`,{children:(0,V.jsx)(O,{label:i,placement:`right`,children:(0,V.jsxs)(`button`,{type:`button`,className:`${K.session} ${K[`engine-${e.engine}`]??``}`,"aria-current":e.id===o?`true`:void 0,"data-focus-key":`verse-session:${e.id}`,"data-engine":e.engine,onClick:()=>l(e.id),children:[(0,V.jsx)(`span`,{className:K.marker,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:K.sessionText,children:e.title||`Untitled chat`}),r&&n!==null?(0,V.jsx)(`span`,{className:K.seatSpent,role:`img`,"aria-label":`Seat limit reached: ${n.summary}`,children:`▮`}):null,e.status===`running`?(0,V.jsx)(`span`,{className:K.running,role:`img`,"aria-label":`Running`}):e.status===`error`?(0,V.jsx)(`span`,{className:K.errored,role:`img`,"aria-label":`Last turn failed`,children:`!`}):null,(0,V.jsx)(`time`,{className:K.time,dateTime:e.updatedAt,children:Be(e.updatedAt)})]})})},e.id)})})]},e.projectPath))]}),(0,V.jsx)(`footer`,{className:K.footer,children:(0,V.jsx)(`button`,{type:`button`,onClick:p,className:K.footerButton,children:`Disconnect`})})]})}var Rn=[`user-message`,`turn-started`,`text-delta`,`assistant-message`,`thinking`,`tool-use`,`tool-result`,`usage`,`turn-done`,`error`,`cancelled`];function zn(e){return`${F(e,`/events`)}?client=${encodeURIComponent(s())}`}function Bn(e){return Math.min(1e3*2**e,15e3)}function Vn(e){try{let t=JSON.parse(e);if(!t||typeof t!=`object`)return null;let n=t;return typeof n.seq!=`number`||typeof n.type!=`string`?null:t}catch{return null}}function Hn(e){let t=null,n=null,i=0,a=!1,o=()=>{if(a||typeof EventSource>`u`||r().phase!==`authenticated`)return;gn(e,i===0?`connecting`:`reconnecting`);let s=new EventSource(zn(e),{withCredentials:!0});t=s,s.onopen=()=>{i=0,gn(e,`open`)};for(let t of Rn)s.addEventListener(t,t=>{let n=Vn(t.data);n&&(bn(e,n),(n.type===`turn-done`||n.type===`cancelled`||n.type===`error`)&&me())});s.onerror=c=>{typeof MessageEvent<`u`&&c instanceof MessageEvent||(s.close(),t===s&&(t=null),!a&&(gn(e,`reconnecting`),r().phase===`authenticated`&&(n=setTimeout(()=>{n=null,i+=1,o()},Bn(i)))))}};return o(),()=>{a=!0,n&&clearTimeout(n),n=null,t?.close(),t=null,gn(e,`closed`)}}function Un(){let e=null,t=null,n=0,i=!1,a=()=>{if(i||typeof EventSource>`u`||r().phase!==`authenticated`)return;let o=new EventSource(p(),{withCredentials:!0});e=o,o.onopen=()=>{n=0},o.addEventListener(`verse-sessions`,()=>me()),o.onerror=()=>{o.close(),e===o&&(e=null),!(i||r().phase!==`authenticated`)&&(t=setTimeout(()=>{t=null,n+=1,a()},Bn(n)))}};return a(),()=>{i=!0,t&&clearTimeout(t),t=null,e?.close(),e=null}}function Wn(e,t=0){let n=(0,z.useSyncExternalStore)(ln,()=>pn(e),()=>pn(e));(0,z.useEffect)(()=>{if(!e)return;let t=new AbortController;be(e,t.signal).then(n=>{t.signal.aborted||mn(e,n.session,n.events)}).catch(n=>{t.signal.aborted||hn(e,n instanceof Error?n.message:`Could not load this chat.`)});let n=Hn(e);return()=>{t.abort(),n()}},[e,t]);let r=(0,z.useMemo)(()=>wn(n.events),[n.events]);return(0,z.useMemo)(()=>({...n,transcript:r}),[n,r])}var Gn={sidebar:{min:220,max:420,def:264},resources:{min:240,max:520,def:320}},Kn=1,qn=`ashlr.verse.panels.v1`,Jn=`ashlr.verse.ui.v2`,Yn={containerWidth:0,sidebarVisible:!0,resourcesVisible:!0};function Xn(e,t){let n=Gn[e],r=Number(t);return!Number.isFinite(r)||r<=0?n.def:Math.max(n.min,Math.min(n.max,Math.round(r)))}function Zn(e,t){let n=Xn(`sidebar`,e.sidebar),r=Xn(`resources`,e.resources);if(!Number.isFinite(t.containerWidth)||t.containerWidth<=0)return{sidebar:n,resources:r};let i=(t.sidebarVisible?Kn:0)+(t.resourcesVisible?Kn:0),a=t.containerWidth-480-i,o=(t.sidebarVisible?n:0)+(t.resourcesVisible?r:0)-a;if(o<=0)return{sidebar:n,resources:r};if(t.resourcesVisible){let e=Math.min(o,r-Gn.resources.min);r-=e,o-=e}if(o>0&&t.sidebarVisible){let e=Math.min(o,n-Gn.sidebar.min);n-=e}return{sidebar:n,resources:r}}function Qn(){return{sidebar:Gn.sidebar.def,resources:Gn.resources.def}}function $n(e){if(e===null||e===``)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=n.sidebar??n.sidebarWidth,i=n.resources??n.resourcesWidth;return r===void 0&&i===void 0?null:{sidebar:Xn(`sidebar`,r),resources:Xn(`resources`,i)}}function er(){try{return $n(localStorage.getItem(qn))||($n(localStorage.getItem(Jn))??Qn())}catch{return Qn()}}function tr(e){try{localStorage.setItem(qn,JSON.stringify({sidebar:e.sidebar,resources:e.resources}))}catch{}}var nr=er(),rr=Yn,ir={desired:nr,effective:Zn(nr,rr)},ar=new Set;function or(e,t){return e.sidebar===t.sidebar&&e.resources===t.resources}function sr(){let e=Zn(nr,rr);if(!(or(ir.desired,nr)&&or(ir.effective,e))){ir={desired:nr,effective:e};for(let e of ar)e()}}function cr(e){return ar.add(e),()=>{ar.delete(e)}}function lr(){return ir}function ur(e){(rr.containerWidth!==e.containerWidth||rr.sidebarVisible!==e.sidebarVisible||rr.resourcesVisible!==e.resourcesVisible)&&(rr=e,sr())}function dr(e){or(nr,e)||(nr=e,tr(nr),sr())}function fr(e,t){dr({...nr,[e]:Xn(e,t)})}function pr(e,t){fr(e,ir.effective[e]+t)}function mr(e){fr(e,Gn[e].def)}function hr(){return(0,z.useSyncExternalStore)(cr,lr,lr)}var gr=`verseResizing`;function _r(e){try{e?document.body.dataset[gr]=`true`:delete document.body.dataset[gr]}catch{}}function vr({side:e,label:t,className:n}){let r=hr(),i=Gn[e],a=r.effective[e],o=(0,z.useRef)(null),[s,c]=(0,z.useState)(!1),l=(0,z.useCallback)(()=>{o.current&&(o.current=null,c(!1),_r(!1))},[]),u=(0,z.useCallback)(e=>{if(e.button===0){e.preventDefault(),o.current={pointerId:e.pointerId,originX:e.clientX,startWidth:a},c(!0),_r(!0);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}}},[a]);(0,z.useEffect)(()=>{if(!s)return;let t=t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.originX;fr(e,e===`sidebar`?n.startWidth+r:n.startWidth-r)},n=e=>{let t=o.current;t&&e.pointerId!==t.pointerId||l()},r=t=>{let n=o.current;n&&t.key===`Escape`&&(fr(e,n.startWidth),l())},i=()=>l();return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n),window.addEventListener(`keydown`,r),window.addEventListener(`blur`,i),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n),window.removeEventListener(`keydown`,r),window.removeEventListener(`blur`,i),_r(!1)}},[s,e,l]);let d=(0,z.useCallback)(t=>{let n=t.shiftKey?64:16,r=e===`sidebar`?1:-1;switch(t.key){case`ArrowRight`:pr(e,n*r);break;case`ArrowLeft`:pr(e,-n*r);break;case`Home`:fr(e,i.min);break;case`End`:fr(e,i.max);break;case`Enter`:mr(e);break;default:return}t.preventDefault()},[e,i.min,i.max]);return(0,V.jsx)(`div`,{className:n,"data-verse-resizer":e,"data-dragging":s?`true`:void 0,role:`separator`,"aria-orientation":`vertical`,"aria-label":t,"aria-valuemin":i.min,"aria-valuemax":i.max,"aria-valuenow":a,"aria-valuetext":`${a} pixels`,tabIndex:0,onPointerDown:u,onPointerUp:l,onPointerCancel:l,onLostPointerCapture:l,onKeyDown:d,onDoubleClick:()=>mr(e)})}var q={workspace:`_workspace_tu4pt_1`,header:`_header_tu4pt_14`,headerSpacer:`_headerSpacer_tu4pt_14`,identity:`_identity_tu4pt_41`,eyebrow:`_eyebrow_tu4pt_50`,eyebrowSkeleton:`_eyebrowSkeleton_tu4pt_60`,title:`_title_tu4pt_68`,titleStatic:`_titleStatic_tu4pt_69`,titleButton:`_titleButton_tu4pt_94`,titleInput:`_titleInput_tu4pt_119`,titleSkeleton:`_titleSkeleton_tu4pt_137`,seatPill:`_seatPill_tu4pt_147`,engineDot:`_engineDot_tu4pt_168`,seatText:`_seatText_tu4pt_151`,"engine-claude":`_engine-claude_tu4pt_182`,"engine-codex":`_engine-codex_tu4pt_183`,"engine-grok":`_engine-grok_tu4pt_184`,"engine-local":`_engine-local_tu4pt_185`,streamState:`_streamState_tu4pt_187`,actions:`_actions_tu4pt_195`,actionDivider:`_actionDivider_tu4pt_204`,toggles:`_toggles_tu4pt_213`,ghost:`_ghost_tu4pt_220`,ghostIcon:`_ghostIcon_tu4pt_221`,danger:`_danger_tu4pt_222`,confirm:`_confirm_tu4pt_254`,confirmText:`_confirmText_tu4pt_255`,meter:`_meter_tu4pt_266`,"meter-warn":`_meter-warn_tu4pt_274`,"meter-danger":`_meter-danger_tu4pt_275`,"meter-unknown":`_meter-unknown_tu4pt_276`,meterTrack:`_meterTrack_tu4pt_279`,meterFill:`_meterFill_tu4pt_287`,meterInline:`_meterInline_tu4pt_292`,meterText:`_meterText_tu4pt_300`,meterTokens:`_meterTokens_tu4pt_309`,meterPercent:`_meterPercent_tu4pt_313`,emptyState:`_emptyState_tu4pt_317`,emptyMark:`_emptyMark_tu4pt_328`,emptyTitle:`_emptyTitle_tu4pt_329`,emptyBody:`_emptyBody_tu4pt_336`,emptyButton:`_emptyButton_tu4pt_337`,emptyWarn:`_emptyWarn_tu4pt_353`};function yr(e){return e===null?`unknown`:e>=90?`danger`:e>=70?`warn`:`ok`}function br({contextTokens:e,contextWindow:t,variant:n=`header`}){let r=typeof e==`number`&&Number.isFinite(e)?Math.max(0,e):0,i=typeof t==`number`&&t>0?t:null,a=i?Math.min(100,Math.round(r/i*100)):null,o=yr(a),s=i?`${Dn(r)} / ${Dn(i)}`:`${Dn(r)} / n/a`,c=a===null?`n/a`:`${a}%`;return(0,V.jsxs)(`div`,{className:`${q.meter} ${q[`meter-${o}`]??``} ${n===`inline`?q.meterInline:``}`,role:`meter`,"aria-label":`Context window`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a??void 0,"aria-valuetext":`${s} (${c})`,title:`Context window — ${s} (${c})`,"data-tone":o,children:[(0,V.jsx)(`div`,{className:q.meterTrack,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:q.meterFill,style:{width:`${a??0}%`}})}),(0,V.jsxs)(`span`,{className:q.meterText,children:[(0,V.jsx)(`span`,{className:q.meterTokens,children:s}),(0,V.jsx)(`span`,{className:q.meterPercent,children:c})]})]})}var xr=`Use Wispr Flow / Superwhisper — system dictation works in this box`;function Sr(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Cr({disabled:e=!1,onInterim:t,onFinal:n,onListeningChange:r}){let i=Sr(),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),l=(0,z.useRef)(null),u=(0,z.useRef)({onInterim:t,onFinal:n,onListeningChange:r});u.current={onInterim:t,onFinal:n,onListeningChange:r};let d=(0,z.useCallback)(()=>{let e=l.current;if(l.current=null,e){e.onresult=null,e.onend=null,e.onerror=null;try{e.stop()}catch{}}o(!1),u.current.onInterim(``),u.current.onListeningChange?.(!1)},[]),f=(0,z.useCallback)(()=>{if(!i||l.current)return;let e;try{e=new i}catch{c(`Dictation could not start in this browser.`);return}e.lang=navigator.language||`en-US`,e.continuous=!0,e.interimResults=!0,e.onresult=e=>{let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r+=1){let i=e.results[r];if(!i)continue;let a=i[0]?.transcript??``;i.isFinal?n+=a:t+=a}n&&u.current.onFinal(n.trim()),u.current.onInterim(t)},e.onerror=e=>{let t=e.error??`unknown`;t===`not-allowed`||t===`service-not-allowed`?c(`Microphone access was denied.`):t!==`aborted`&&t!==`no-speech`&&c(`Dictation stopped (${t}).`),d()},e.onend=()=>{l.current===e&&d()},l.current=e,c(null);try{e.start()}catch{l.current=null,c(`Dictation could not start in this browser.`);return}o(!0),u.current.onListeningChange?.(!0)},[i,d]);return(0,z.useEffect)(()=>{if(!a)return;function e(e){e.key===`Escape`&&(e.preventDefault(),d())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,d]),(0,z.useEffect)(()=>()=>{let e=l.current;l.current=null;try{e?.abort()}catch{}},[]),i?(0,V.jsxs)(`span`,{className:H.dictationWrap,children:[(0,V.jsx)(O,{label:a?`Stop dictation`:`Dictate`,shortcut:a?`Esc`:void 0,placement:`top`,children:(0,V.jsxs)(`button`,{type:`button`,className:`${H.dictation} ${a?H.dictationLive:``}`,disabled:e&&!a,"aria-pressed":a,"aria-label":a?`Stop dictation (Esc)`:`Start dictation`,onClick:()=>a?d():f(),children:[(0,V.jsx)(wr,{}),a?(0,V.jsx)(`span`,{className:H.dictationPulse,"aria-hidden":`true`}):null]})}),s?(0,V.jsx)(`span`,{role:`alert`,className:H.dictationError,children:s}):null]}):(0,V.jsx)(`span`,{className:H.dictationWrap,children:(0,V.jsx)(O,{label:xr,placement:`top`,children:(0,V.jsxs)(`button`,{type:`button`,className:H.dictation,disabled:!0,"aria-disabled":`true`,children:[(0,V.jsx)(wr,{}),(0,V.jsx)(`span`,{className:`visually-hidden`,children:`Dictation unavailable`})]})})})}function wr(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 20 20`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`7`,y:`2`,width:`6`,height:`10`,rx:`3`,fill:`currentColor`}),(0,V.jsx)(`path`,{d:`M4.5 9.5a5.5 5.5 0 0 0 11 0M10 15v3M7 18h6`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})]})}var Tr=65536,Er=400,Dr=.4,Or=320;function kr({sessionId:e=null,seats:t,seat:n,engine:r,running:s,disabled:c,disabledReason:u,locked:d,hintSeen:f=!1,contextTokens:p=null,contextWindow:m=null,onSend:h,onStop:g,onSeatChange:_,autoFocus:v=!1}){let[y,b]=(0,z.useState)(()=>x(e)),[S,C]=(0,z.useState)(``),[ee,w]=(0,z.useState)(!1),[T,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(-1),[te]=(0,z.useState)(()=>i(e)),j=(0,z.useRef)(te),M=(0,z.useRef)(``),N=(0,z.useRef)(null),ne=(0,z.useRef)(null),re=(0,z.useId)(),ie=S?`${y}${y&&!y.endsWith(` `)?` `:``}${S}`:y,ae=(0,z.useMemo)(()=>new TextEncoder().encode(ie).length>Tr,[ie]),P=!c&&!s&&!ee&&ie.trim().length>0&&!ae,oe=!f&&!D,F=(0,z.useMemo)(()=>o(ie,p,m,70,90),[ie,p,m]),se=(0,z.useRef)(y),ce=(0,z.useRef)(y);ce.current=y;let le=(0,z.useCallback)(()=>{se.current!==ce.current&&(se.current=ce.current,a(e,ce.current))},[e]);(0,z.useEffect)(()=>{if(se.current===y)return;let e=setTimeout(le,Er);return()=>clearTimeout(e)},[y,le]),(0,z.useEffect)(()=>(window.addEventListener(`beforeunload`,le),()=>{window.removeEventListener(`beforeunload`,le),le()}),[le]),(0,z.useEffect)(()=>{v&&N.current?.focus()},[v]),(0,z.useEffect)(()=>{if(!s)return;let e=e=>{e.key!==`.`||!e.metaKey&&!e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),g())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s,g]),(0,z.useEffect)(()=>{if(s||!v)return;let e=document.activeElement,t=e!==null&&e!==N.current&&ne.current?.contains(e)===!0;(e===null||e===document.body||!e.isConnected||t)&&N.current?.focus()},[s,v]),(0,z.useEffect)(()=>{let e=N.current;if(!e)return;let t=typeof window>`u`?0:window.innerHeight,n=t>0?Math.round(t*Dr):Or;e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,n)}px`},[ie]);let ue=(0,z.useCallback)(async()=>{if(!P)return;let t=ie.trim();w(!0);try{await h(t)&&(j.current[j.current.length-1]!==t&&(j.current=[...j.current,t]),l(e,t),A(-1),M.current=``,b(``),se.current=``,ce.current=``,a(e,``),C(``),O(!0))}finally{w(!1),N.current?.focus()}},[P,ie,h,e]);function de(e){let t=j.current;if(t.length===0)return!1;if(k===-1){if(e>0)return!1;M.current=y;let n=t.length-1;return A(n),b(t[n]),C(``),!0}let n=k+e;return n<0?!0:n>=t.length?(A(-1),b(M.current),!0):(A(n),b(t[n]),!0)}function fe(e){let t=e.currentTarget,n=t.selectionStart===t.selectionEnd;if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),ue();return}if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.nativeEvent.isComposing){e.preventDefault(),ue();return}if(e.key===`ArrowUp`&&n&&(k!==-1||t.selectionStart===0&&!S)){de(-1)&&e.preventDefault();return}e.key===`ArrowDown`&&n&&k!==-1&&de(1)&&e.preventDefault()}let pe=c?u??`Sending is disabled`:s?`Draft your next message…`:`Message the agent…`;return(0,V.jsxs)(`form`,{ref:ne,className:H.composer,onSubmit:e=>{e.preventDefault(),ue()},"aria-describedby":re,children:[(0,V.jsxs)(`div`,{className:`${H.box} ${T?H.boxListening:``}`,children:[(0,V.jsx)(`textarea`,{ref:N,className:H.textarea,value:ie,rows:1,placeholder:pe,"aria-label":`Message`,disabled:c,onChange:e=>{C(``),A(-1),b(e.target.value)},onKeyDown:fe}),(0,V.jsxs)(`div`,{className:H.row,children:[(0,V.jsx)(Ar,{seats:t,seat:n,engine:r,disabled:c,onNewChat:_}),(0,V.jsx)(`div`,{className:H.spacer}),(0,V.jsx)(Cr,{disabled:c,onInterim:C,onFinal:e=>b(t=>t&&!t.endsWith(` `)?`${t} ${e}`:`${t}${e}`),onListeningChange:E}),s?(0,V.jsxs)(`button`,{type:`button`,className:H.stop,onClick:g,title:`Stop the running turn (⌘.)`,"aria-label":`Stop the running turn`,children:[(0,V.jsx)(`span`,{className:H.stopIcon,"aria-hidden":`true`}),`Stop`]},`stop`):(0,V.jsx)(`button`,{type:`submit`,className:H.send,disabled:!P,"aria-label":d?`Send (unlocks first)`:`Send message`,children:ee?`Sending…`:d?`Unlock & send`:`Send`},`send`)]})]}),F?(0,V.jsxs)(`p`,{className:H.cost,"data-tone":F.tone,role:`status`,children:[(0,V.jsxs)(`span`,{className:H.costFigure,children:[`≈`,Dn(F.draftTokens)]}),` tokens for this message — sending would reach `,(0,V.jsxs)(`span`,{className:H.costFigure,children:[F.projectedPercent,`%`]}),` of the context window.`,F.tone===`danger`?` Start a new chat to keep the agent sharp.`:``,(0,V.jsx)(`span`,{className:`visually-hidden`,children:` This is an estimate; the provider counts the real total.`})]}):null,(0,V.jsx)(`p`,{id:re,className:`${H.help} ${oe||ae||T||s||c||k!==-1?``:H.helpQuiet}`,children:ae?(0,V.jsx)(`span`,{role:`alert`,className:H.helpError,children:`Message is over 64 KB — trim it before sending.`}):T?`Listening… Esc stops dictation.`:c&&u?u:s?(0,V.jsxs)(V.Fragment,{children:[`Reply in progress — your draft stays here · `,(0,V.jsx)(`kbd`,{children:`⌘.`}),` or Stop interrupts the turn`]}):k===-1?oe?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`kbd`,{children:`Enter`}),` sends · `,(0,V.jsx)(`kbd`,{children:`Shift`}),`+`,(0,V.jsx)(`kbd`,{children:`Enter`}),` new line · `,(0,V.jsx)(`kbd`,{children:`↑`}),` recalls · `,(0,V.jsx)(`kbd`,{children:`⌘N`}),` new chat · `,(0,V.jsx)(`kbd`,{children:`⌘K`}),` switch`]}):null:(0,V.jsxs)(V.Fragment,{children:[`Recalled message `,k+1,` of `,j.current.length,` · `,(0,V.jsx)(`kbd`,{children:`↓`}),` returns to your draft`]})})]})}function Ar({seats:e,seat:t,engine:n,disabled:r,onNewChat:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useId)(),u=jr(e,t.seatId),d=n??u?.engine,f=Te(e,{seatId:t.seatId,engine:d??`claude`,model:t.model}),p=e.filter(e=>e.health.state!==`unavailable`&&e.models.length>0);(0,z.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)},t=e=>{e.key===`Escape`&&(e.preventDefault(),o(!1),c.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]),(0,z.useEffect)(()=>{a&&s.current?.querySelector(`[role="menuitem"]`)?.focus()},[a]);function m(e){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(s.current?.querySelectorAll(`[role="menuitem"]`)??[]);if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}return(0,V.jsxs)(`div`,{ref:s,className:`${H.seatPillWrap} ${d?H[`engine-${d}`]??``:``}`,children:[(0,V.jsxs)(`button`,{ref:c,type:`button`,className:H.seatPill,"data-engine":d,"aria-haspopup":`menu`,"aria-expanded":a,"aria-controls":a?l:void 0,disabled:r,title:`This chat is bound to one seat — open to start a new chat on another`,onClick:()=>o(e=>!e),children:[(0,V.jsx)(`span`,{className:H.engineDot,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:H.seatPillText,children:f})]}),a?(0,V.jsxs)(`div`,{id:l,role:`menu`,"aria-label":`Seat`,className:H.seatMenu,onKeyDown:m,children:[(0,V.jsxs)(`p`,{className:H.seatMenuHeading,children:[`This chat runs on `,(0,V.jsx)(`strong`,{children:f})]}),p.length===0?(0,V.jsx)(`p`,{className:H.seatMenuEmpty,children:`No other seats are available right now.`}):null,p.map(e=>{let n=Me(e);return(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${H.seatMenuItem} ${H[`engine-${e.engine}`]??``}`,"data-capacity":n.cls,onClick:()=>{o(!1),i({seatId:e.id,model:e.models[0].id})},children:[(0,V.jsx)(`span`,{className:H.engineDot,"aria-hidden":`true`}),(0,V.jsxs)(`span`,{className:H.seatMenuText,children:[(0,V.jsxs)(`span`,{className:H.seatMenuPrimary,children:[`New chat on `,e.label]}),(0,V.jsxs)(`span`,{className:H.seatMenuSecondary,children:[e.models[0].label,e.id===t.seatId?` · same seat`:``]}),n.cls===`unread`?null:(0,V.jsxs)(`span`,{className:H.seatMenuCapacity,children:[Ie[n.cls],` · `,n.text]})]})]},e.id)})]}):null]})}function jr(e,t){return e.find(e=>e.id===t)}var Mr=1200;function Nr(e,t){let n=e.length,r=t.length;if(n===0&&r===0)return[];if(n===0)return t.map(e=>({kind:`add`,text:e}));if(r===0)return e.map(e=>({kind:`del`,text:e}));if(n>Mr||r>Mr)return[...e.map(e=>({kind:`del`,text:e})),...t.map(e=>({kind:`add`,text:e}))];let i=0;for(;i<n&&i<r&&e[i]===t[i];)i++;let a=n-1,o=r-1;for(;a>=i&&o>=i&&e[a]===t[o];)a--,o--;let s=e.slice(i,a+1),c=t.slice(i,o+1),l=s.length,u=c.length,d=u+1,f=new Int32Array((l+1)*d);for(let e=l-1;e>=0;e--)for(let t=u-1;t>=0;t--)f[e*d+t]=s[e]===c[t]?f[(e+1)*d+(t+1)]+1:Math.max(f[(e+1)*d+t],f[e*d+(t+1)]);let p=[];for(let t=0;t<i;t++)p.push({kind:`same`,text:e[t]});let m=0,h=0;for(;m<l&&h<u;)s[m]===c[h]?(p.push({kind:`same`,text:s[m]}),m++,h++):f[(m+1)*d+h]>=f[m*d+(h+1)]?(p.push({kind:`del`,text:s[m]}),m++):(p.push({kind:`add`,text:c[h]}),h++);for(;m<l;)p.push({kind:`del`,text:s[m++]});for(;h<u;)p.push({kind:`add`,text:c[h++]});for(let t=a+1;t<n;t++)p.push({kind:`same`,text:e[t]});return p}function Pr(e,t){let n=Math.max(0,t.context??3),r=t.oldStart??1,i=t.newStart??1;if(e.length===0||!e.some(e=>e.kind!==`same`))return``;let a=[],o=r,s=i;for(let t of e)a.push({...t,oldNo:o,newNo:s}),t.kind!==`add`&&o++,t.kind!==`del`&&s++;let c=[];for(let e=0;e<a.length;e++){if(a[e].kind===`same`)continue;let t=Math.max(0,e-n),r=Math.min(a.length-1,e+n),i=c[c.length-1];i&&t<=i.to+1?i.to=Math.max(i.to,r):c.push({from:t,to:r})}let l=[`--- a/${t.path}`,`+++ b/${t.path}`];for(let e of c){let n=a.slice(e.from,e.to+1),o=n.filter(e=>e.kind!==`add`).length,s=n.filter(e=>e.kind!==`del`).length,c=n.find(e=>e.kind!==`add`)?.oldNo??r,u=n.find(e=>e.kind!==`del`)?.newNo??i,d=t.section?` ${t.section}`:``;l.push(`@@ -${o===0?c-1:c},${o} +${s===0?u-1:u},${s} @@${d}`);for(let e of n)l.push(`${e.kind===`add`?`+`:e.kind===`del`?`-`:` `}${e.text}`)}return l.join(`
|
|
2
|
+
`)}function Fr(e,t,n){return e===t?``:Pr(Nr(Ir(e),Ir(t)),n)}function Ir(e){if(e===``)return[];let t=e.split(`
|
|
3
|
+
`);return t[t.length-1]===``&&t.pop(),t}var Lr=new Map([[`read`,`read`],[`readfile`,`read`],[`read_file`,`read`],[`view`,`read`],[`notebookread`,`read`],[`notebook_read`,`read`],[`cat`,`read`],[`open`,`read`],[`edit`,`edit`],[`multiedit`,`edit`],[`multi_edit`,`edit`],[`notebookedit`,`edit`],[`notebook_edit`,`edit`],[`str_replace`,`edit`],[`str_replace_editor`,`edit`],[`str_replace_based_edit_tool`,`edit`],[`apply_patch`,`edit`],[`patch`,`edit`],[`edit_structural`,`edit`],[`search_replace_regex`,`edit`],[`rename_file`,`edit`],[`update`,`edit`],[`applydiff`,`edit`],[`apply_diff`,`edit`],[`write`,`create`],[`create`,`create`],[`create_file`,`create`],[`writefile`,`create`],[`write_file`,`create`],[`new_file`,`create`],[`delete`,`delete`],[`delete_file`,`delete`],[`remove_file`,`delete`],[`rm`,`delete`],[`bash`,`command`],[`shell`,`command`],[`exec`,`command`],[`run`,`command`],[`run_command`,`command`],[`runcommand`,`command`],[`run_terminal_cmd`,`command`],[`bash_start`,`command`],[`bash_tail`,`command`],[`terminal`,`command`],[`test`,`command`],[`grep`,`search`],[`glob`,`search`],[`search`,`search`],[`find`,`search`],[`codebase_search`,`search`],[`ls`,`search`],[`tree`,`search`],[`list_dir`,`search`],[`task`,`task`],[`agent`,`task`],[`dispatch_agent`,`task`],[`subagent`,`task`],[`webfetch`,`web`],[`websearch`,`web`],[`fetch`,`web`],[`http`,`web`],[`browser`,`web`]]);function Rr(e){let t=e.split(`__`).filter(Boolean);return(t[t.length-1]??e).trim().toLowerCase()}function zr(e){return Lr.get(Rr(e))??`other`}function Br(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Vr(e){return typeof e==`string`&&e.length>0?e:null}var Hr=[`file_path`,`filePath`,`notebook_path`,`notebookPath`,`target_file`,`path`,`file`,`filename`,`fileName`,`relative_workspace_path`];function Ur(e){let t=Br(e);if(!t)return[];let n=[],r=e=>{let t=Vr(e);t&&!n.includes(t)&&n.push(t)};for(let e of Hr)r(t[e]);let i=t.paths??t.file_paths??t.files;if(Array.isArray(i))for(let e of i)r(typeof e==`string`?e:Br(e)?.path);return n}function Wr(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function Gr(e){let t=e.split(/[\\/]/);return t.pop(),t.join(`/`)}var Kr=[`command`,`cmd`,`script`,`shell_command`,`commandLine`],qr=/^[ \t]*(?:exit(?:ed)?[ \t]+(?:with[ \t]+)?(?:code|status)|exit[ \t]*code|exit[ \t]*status|command[ \t]+exited[ \t]+with[ \t]+code)[ \t]*[:=]?[ \t]*(\d{1,3})[ \t]*\.?$/im;function Jr(e){let t=qr.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isInteger(n)&&n>=0&&n<=255?n:null}var Yr=/^diff --git /m,Xr=/^--- (?:a\/|\/dev\/null|[^\n]*\t)/m,Zr=/^\+\+\+ (?:b\/|\/dev\/null|[^\n]*\t)/m,Qr=/^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/m;function $r(e){return e?Yr.test(e)?!0:Qr.test(e)&&Xr.test(e)&&Zr.test(e):!1}function ei(e){let t=e.match(/^diff --git /gm);return t?t.length:(e.match(/^--- /gm)??[]).length}function ti(e){let t=Br(e);if(!t)return null;let n=t.old_string??t.oldString??t.old_str??t.old??t.search??t.find,r=t.new_string??t.newString??t.new_str??t.new??t.replace??t.replacement;return typeof n!=`string`||typeof r!=`string`?null:{old:n,next:r}}function ni(e,t){let n=[],r=1;return t.forEach((i,a)=>{let o=Fr(i.old,i.next,{path:e,oldStart:r,newStart:r,section:t.length>1?`edit ${a+1} of ${t.length}`:void 0});r+=Math.max(Ir(i.old).length,Ir(i.next).length)+8,o&&n.push(o.split(`
|
|
4
|
+
`).slice(2).join(`
|
|
5
|
+
`))}),n.length===0?``:[`--- a/${e}`,`+++ b/${e}`,...n].join(`
|
|
6
|
+
`)}function ri(e,t){let n=Ir(t);return n.length===0?``:[`--- /dev/null`,`+++ b/${e}`,`@@ -0,0 +1,${n.length} @@`,...n.map(e=>`+${e}`)].join(`
|
|
7
|
+
`)}var ii=2e5;function ai(e){return e.length<=2e5?e:`${e.slice(0,ii)}\n… (${e.length-ii} more characters not shown)`}var oi=/\bhas been updated\b|\bsuccessfully (?:over)?written\b|\bupdated successfully\b/i,si=/\b(?:file )?created successfully\b|\bnew file created\b/i;function ci({name:e,input:t,result:n}){let r=Rr(e),i=zr(e),a=Br(t),o=n?.output??``,s=n===null;i===`create`&&n&&oi.test(o)&&!si.test(o)&&(i=`edit`);let c=Ur(t),l=c[0]??null,u=null;if(a)for(let e of Kr){let t=Vr(a[e]);if(t){u={command:t,exitCode:n?Jr(o):null},i===`other`&&(i=`command`);break}}let d=null,f=null;if(n&&$r(o)&&(d={text:ai(o),anchored:!0,multiFile:ei(o)>1,origin:`output`}),!d&&a){let e=Vr(a.patch)??Vr(a.diff);e&&$r(e)&&(d={text:ai(e),anchored:!0,multiFile:ei(e)>1,origin:`payload`})}if(!d&&a&&l){let e=ti(a),t=a.edits??a.replacements??a.changes,n=Array.isArray(t)?t.map(ti).filter(e=>e!==null):[],r=n.length>0?n:e?[e]:[];if(r.length>0){let e=ni(l,r);e&&(d={text:ai(e),anchored:!1,multiFile:!1,origin:`payload`}),i===`other`&&(i=`edit`)}}if(!d&&a&&l){let e=typeof a.content==`string`?a.content:typeof a.contents==`string`?a.contents:typeof a.text==`string`&&(i===`create`||i===`edit`)?a.text:null;if(e!==null){if(i===`create`){let t=ri(l,e);t&&(d={text:ai(t),anchored:!0,multiFile:!1,origin:`payload`})}else f={path:l,text:ai(e)}}}let p=n!==null&&(n.isError||(u?.exitCode??0)>0);return{base:r,action:i,paths:c,command:u,diff:d,written:f,failed:p,pending:s}}function li(e){return`verse-tool-${e.replace(/[^A-Za-z0-9_-]/g,``)}`}function ui(){return{facts:new Map,counts:new Map,toolText:new Map}}function di(e,t){let n=t?.facts.get(e.toolUseId);if(n&&!(n.pending&&e.result!==null))return n;let r=ci({name:e.name,input:e.input,result:e.result});return t&&(t.facts.set(e.toolUseId,r),t.counts.delete(e.toolUseId),t.toolText.delete(e.toolUseId)),r}function fi(e){return`verse-note-${e.replace(/[^A-Za-z0-9_-]/g,``)}`}function pi(e){return`verse-turn-${e.replace(/[^A-Za-z0-9_-]/g,``)}`}var mi={read:0,edit:1,create:2,delete:3};function hi(e){let t=0,n=0;for(let r of w(e).files)t+=r.additions,n+=r.deletions;return{additions:t,deletions:n}}function gi(e,t,n){let r=n?.counts.get(e);if(r)return r;let i=hi(t);return n?.counts.set(e,i),i}function _i(e){return e.kind===`tool`?[e]:e.kind===`toolGroup`?e.items.filter(e=>e.kind===`tool`):[]}function vi(e,t=null){let n=new Map,r=[],i=[],a=[],o=()=>{a.length!==0&&(i.push(yi(a,n,r,t)),a=[])},s;for(let t of e){let e=`turnId`in t?t.turnId:null;(t.kind===`user`||s!==void 0&&e!==null&&e!==s)&&o(),(t.kind===`user`||s===void 0||e!==null)&&(s=e),a.push(t)}return o(),{turns:i,facts:n,errorAnchors:r}}function yi(e,t,n,r){let i=e[0],a=new Map,o=0,s=0,c=0,l=null,u=`running`,d=null,f=null,p=e=>{c++,l||=e,n.push(e)};for(let n of e){n.kind===`user`&&f===null&&(f=n.text);for(let e of _i(n)){o++;let n=di(e,r);t.set(e.toolUseId,n),n.action===`command`&&s++,n.failed&&p(`verse-tool-${e.toolUseId.replace(/[^A-Za-z0-9_-]/g,``)}`);let i=n.action;if(i!==`read`&&i!==`edit`&&i!==`create`&&i!==`delete`)continue;let c=n.diff?gi(e.toolUseId,n.diff.text,r):{additions:0,deletions:0};for(let t of n.paths){let r=a.get(t)??{path:t,reads:0,edits:0,creates:0,deletes:0,action:i,anchorToolUseId:e.toolUseId,additions:0,deletions:0,failed:!1};i===`read`?r.reads++:i===`edit`?r.edits++:i===`create`?r.creates++:r.deletes++,mi[i]>mi[r.action]&&(r.action=i,r.anchorToolUseId=e.toolUseId),i!==`read`&&(r.additions+=c.additions,r.deletions+=c.deletions),n.failed&&(r.failed=!0),a.set(t,r)}}switch(n.kind){case`error`:p(fi(n.key)),u=`error`;break;case`cancelled`:u=`stopped`;break;case`turn-done`:d=n.durationMs>0?n.durationMs:d,n.ok?u=u===`running`?`ok`:u:u===`running`&&(u=`error`,p(fi(n.key)))}}return{key:i.key,turnId:`turnId`in i?i.turnId:null,items:e,prompt:f,at:i.at,files:[...a.values()].sort((e,t)=>mi[t.action]-mi[e.action]||t.additions+t.deletions-(e.additions+e.deletions)||e.path.localeCompare(t.path)),toolCount:o,commandCount:s,errorCount:c,firstErrorAnchor:l,status:u,durationMs:d}}function bi(e){if(e.length===0)return``;let t={edited:0,created:0,deleted:0,read:0};for(let n of e)n.action===`edit`?t.edited++:n.action===`create`?t.created++:n.action===`delete`?t.deleted++:t.read++;let n=[];return t.created&&n.push(`${t.created} created`),t.edited&&n.push(`${t.edited} edited`),t.deleted&&n.push(`${t.deleted} deleted`),t.read&&n.push(`${t.read} read`),n.join(`, `)}var xi=new WeakMap,Si=4e3;function Ci(e,t){let n=t?.toolText.get(e.toolUseId);if(n!==void 0)return n;let r=[e.name];if(typeof e.input==`string`)r.push(e.input.slice(0,Si));else if(e.input)try{r.push(JSON.stringify(e.input).slice(0,Si))}catch{}e.result&&r.push(e.result.output.slice(0,Si));let i=r.join(`
|
|
8
|
+
`);return t&&e.result&&t.toolText.set(e.toolUseId,i),i}function wi(e,t=null){let n=xi.get(e);if(n!==void 0)return n;let r=[],i=e=>{switch(e.kind){case`user`:case`assistant`:case`thinking`:r.push(e.text);break;case`error`:r.push(e.message);break;case`tool`:r.push(Ci(e,t));break;case`toolGroup`:for(let t of e.items)i(t)}};for(let t of e.items)i(t);let a=r.join(`
|
|
9
|
+
`);return xi.set(e,a),a}var Ti=48;function Ei(e,t,n=null){let r=t.trim().toLowerCase();if(r.length===0)return[];let i=[];for(let t of e){let e=wi(t,n),a=e.toLowerCase().indexOf(r);if(a===-1)continue;let o=Math.max(0,a-Ti),s=Math.min(e.length,a+r.length+Ti),c=`${o>0?`…`:``}${e.slice(o,s).replace(/\s+/g,` `).trim()}${s<e.length?`…`:``}`;i.push({turnKey:t.key,snippet:c})}return i}function Di(e,t=72){let n=e.prompt?.replace(/\s+/g,` `).trim();return n?n.length>t?`${n.slice(0,t-1)}…`:n:e.toolCount>0?`${e.toolCount} tool call${e.toolCount===1?``:`s`}`:`Session note`}var J={diff:`_diff_144b5_30`,visuallyHidden:`_visuallyHidden_144b5_46`,diffMulti:`_diffMulti_144b5_58`,diffHead:`_diffHead_144b5_60`,diffPath:`_diffPath_144b5_68`,diffOldPath:`_diffOldPath_144b5_83`,diffStatus:`_diffStatus_144b5_101`,diffStats:`_diffStats_144b5_110`,diffAdd:`_diffAdd_144b5_118`,diffDel:`_diffDel_144b5_119`,diffNotice:`_diffNotice_144b5_121`,diffEmpty:`_diffEmpty_144b5_130`,diffTable:`_diffTable_144b5_136`,diffNo:`_diffNo_144b5_121`,diffMarker:`_diffMarker_144b5_30`,diffText:`_diffText_144b5_159`,diffCode:`_diffCode_144b5_179`,diffRow_add:`_diffRow_add_144b5_181`,diffRow_del:`_diffRow_del_144b5_182`,diffRow_context:`_diffRow_context_144b5_183`,diffHunkRow:`_diffHunkRow_144b5_185`,diffHunkHead:`_diffHunkHead_144b5_192`,diffMore:`_diffMore_144b5_200`,commandMore:`_commandMore_144b5_201`,activityMore:`_activityMore_144b5_202`,diffUnanchored:`_diffUnanchored_144b5_221`,tok_plain:`_tok_plain_144b5_232`,tok_comment:`_tok_comment_144b5_233`,tok_string:`_tok_string_144b5_234`,tok_number:`_tok_number_144b5_235`,tok_keyword:`_tok_keyword_144b5_236`,command:`_command_144b5_201`,commandLine:`_commandLine_144b5_250`,commandPrompt:`_commandPrompt_144b5_257`,commandText:`_commandText_144b5_264`,commandStatus:`_commandStatus_144b5_274`,commandStatusText:`_commandStatusText_144b5_282`,commandMeta:`_commandMeta_144b5_292`,commandPre:`_commandPre_144b5_297`,commandPending:`_commandPending_144b5_309`,activity:`_activity_144b5_202`,activityHead:`_activityHead_144b5_327`,activityCount:`_activityCount_144b5_336`,activityLabel:`_activityLabel_144b5_343`,activityBreakdown:`_activityBreakdown_144b5_350`,activityList:`_activityList_144b5_356`,activityRow:`_activityRow_144b5_369`,activityRule:`_activityRule_144b5_391`,activityVerb:`_activityVerb_144b5_386`,activityFailed:`_activityFailed_144b5_390`,activityPath:`_activityPath_144b5_422`,activityName:`_activityName_144b5_430`,activityDir:`_activityDir_144b5_431`,activityTimes:`_activityTimes_144b5_441`,activityDelta:`_activityDelta_144b5_442`,activityAdd:`_activityAdd_144b5_450`,activityDel:`_activityDel_144b5_442`,nav:`_nav_144b5_457`,navSpacer:`_navSpacer_144b5_468`,navOutlineButton:`_navOutlineButton_144b5_470`,navChevron:`_navChevron_144b5_484`,navCount:`_navCount_144b5_486`,navWord:`_navWord_144b5_492`,navSearch:`_navSearch_144b5_499`,navSearchIcon:`_navSearchIcon_144b5_523`,navMatches:`_navMatches_144b5_536`,navStep:`_navStep_144b5_543`,navError:`_navError_144b5_556`,navErrorGlyph:`_navErrorGlyph_144b5_574`,outline:`_outline_144b5_579`,outlineEmpty:`_outlineEmpty_144b5_593`,outlineList:`_outlineList_144b5_598`,outlineRow:`_outlineRow_144b5_599`,outlineIndex:`_outlineIndex_144b5_613`,outlineBody:`_outlineBody_144b5_620`,outlineTitle:`_outlineTitle_144b5_621`,outlineSnippet:`_outlineSnippet_144b5_628`,outlineMeta:`_outlineMeta_144b5_638`,outlineStatus:`_outlineStatus_144b5_642`},Oi=8,ki={read:`read`,edit:`edited`,create:`created`,delete:`deleted`};function Ai({files:e,onJump:t}){let[n,r]=(0,z.useState)(!1);if(e.length===0)return null;let i=n||e.length<=Oi?e:e.slice(0,Oi),a=e.length-i.length;return(0,V.jsxs)(`section`,{className:J.activity,"aria-label":`Files this turn touched`,children:[(0,V.jsxs)(`h3`,{className:J.activityHead,children:[(0,V.jsx)(`span`,{className:J.activityCount,children:e.length}),(0,V.jsxs)(`span`,{className:J.activityLabel,children:[`file`,e.length===1?``:`s`]}),(0,V.jsx)(`span`,{className:J.activityBreakdown,children:bi(e)})]}),(0,V.jsx)(`ul`,{className:J.activityList,children:i.map(e=>{let n=e.reads+e.edits+e.creates+e.deletes,r=`${ki[e.action]} ${e.path}${n>1?`, ${n} calls`:``}${e.additions||e.deletions?`, +${e.additions} −${e.deletions}`:``}${e.failed?`, a call on this file failed`:``}`;return(0,V.jsx)(`li`,{children:(0,V.jsx)(O,{label:e.path,placement:`right`,children:(0,V.jsxs)(`button`,{type:`button`,className:J.activityRow,"data-action":e.action,"data-failed":e.failed?`true`:void 0,onClick:()=>t(e.anchorToolUseId),"aria-label":r,children:[(0,V.jsx)(`span`,{className:J.activityRule,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:J.activityVerb,children:ki[e.action]}),(0,V.jsxs)(`span`,{className:J.activityPath,children:[(0,V.jsx)(`span`,{className:J.activityName,children:Wr(e.path)}),(0,V.jsx)(`span`,{className:J.activityDir,children:Gr(e.path)})]}),e.failed?(0,V.jsx)(`span`,{className:J.activityFailed,"aria-hidden":`true`,children:`! failed`}):null,n>1?(0,V.jsxs)(`span`,{className:J.activityTimes,children:[`×`,n]}):null,(0,V.jsxs)(`span`,{className:J.activityDelta,children:[e.additions>0?(0,V.jsxs)(`span`,{className:J.activityAdd,children:[`+`,e.additions]}):null,e.deletions>0?(0,V.jsxs)(`span`,{className:J.activityDel,children:[`−`,e.deletions]}):null]})]})})},e.path)})}),a>0||n?(0,V.jsx)(`button`,{type:`button`,className:J.activityMore,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Show fewer files`:`Show ${a} more file${a===1?``:`s`}`}):null]})}var ji={running:`•`,ok:``,error:`!`,stopped:`×`},Mi={running:`running`,ok:`completed`,error:`failed`,stopped:`stopped`};function Ni(e){let{turns:t,query:n,onQuery:r,matches:i,matchIndex:a,onStepMatch:o,errorCount:s,onJumpError:c,onJumpTurn:l,focusToken:u}=e,[d,f]=(0,z.useState)(!1),p=(0,z.useRef)(null),m=(0,z.useId)(),h=(0,z.useId)(),g=n.trim().length>0;(0,z.useEffect)(()=>{u>0&&(p.current?.focus(),p.current?.select())},[u]),(0,z.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&f(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d]);let _=g?t.filter(e=>i.some(t=>t.turnKey===e.key)):t,v=e=>i.find(t=>t.turnKey===e)?.snippet??null;return(0,V.jsxs)(`div`,{className:J.nav,children:[(0,V.jsxs)(`button`,{type:`button`,className:J.navOutlineButton,"aria-expanded":d,"aria-controls":d?m:void 0,onClick:()=>f(e=>!e),children:[(0,V.jsx)(`span`,{className:J.navChevron,"data-open":d?`true`:void 0,"aria-hidden":`true`,children:(0,V.jsx)(ae,{size:12})}),(0,V.jsx)(`span`,{className:J.navCount,children:t.length}),(0,V.jsxs)(`span`,{className:J.navWord,children:[`turn`,t.length===1?``:`s`]})]}),(0,V.jsxs)(`label`,{className:J.navSearch,htmlFor:h,children:[(0,V.jsx)(`span`,{className:J.navSearchIcon,"aria-hidden":`true`,children:(0,V.jsx)(ve,{size:12})}),(0,V.jsx)(`span`,{className:`visually-hidden`,children:`Search this chat`}),(0,V.jsx)(`input`,{ref:p,id:h,type:`search`,value:n,placeholder:`Find in chat`,autoComplete:`off`,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),o(e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),r(``))}})]}),g?(0,V.jsx)(`span`,{className:J.navMatches,role:`status`,children:i.length===0?`no matches`:`${a<0?1:a+1} of ${i.length}`}):null,g&&i.length>0?(0,V.jsxs)(`span`,{className:J.navStep,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>o(-1),"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,children:`↑`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>o(1),"aria-label":`Next match`,title:`Next match (Enter)`,children:`↓`})]}):null,(0,V.jsx)(`span`,{className:J.navSpacer}),s>0?(0,V.jsxs)(`button`,{type:`button`,className:J.navError,onClick:c,children:[(0,V.jsx)(`span`,{className:J.navErrorGlyph,"aria-hidden":`true`,children:`!`}),s,` error`,s===1?``:`s`,(0,V.jsx)(`span`,{className:`visually-hidden`,children:` — jump to the first one`})]}):null,d?(0,V.jsx)(`div`,{id:m,className:J.outline,role:`group`,"aria-label":`Turns in this chat`,children:_.length===0?(0,V.jsxs)(`p`,{className:J.outlineEmpty,children:[`No turn matches “`,n.trim(),`”.`]}):(0,V.jsx)(`ol`,{className:J.outlineList,children:_.map(e=>{let n=t.indexOf(e)+1,r=v(e.key);return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:J.outlineRow,"data-status":e.status,onClick:()=>{f(!1),l(e.key)},children:[(0,V.jsx)(`span`,{className:J.outlineIndex,children:n}),(0,V.jsxs)(`span`,{className:J.outlineBody,children:[(0,V.jsx)(`span`,{className:J.outlineTitle,children:Di(e)}),r?(0,V.jsx)(`span`,{className:J.outlineSnippet,children:r}):null,(0,V.jsxs)(`span`,{className:J.outlineMeta,children:[e.toolCount>0?`${e.toolCount} tool${e.toolCount===1?``:`s`}`:`no tools`,e.files.length>0?` · ${e.files.length} file${e.files.length===1?``:`s`}`:``,e.status===`ok`?``:` · ${Mi[e.status]}`]})]}),ji[e.status]?(0,V.jsx)(`span`,{className:J.outlineStatus,"aria-hidden":`true`,children:ji[e.status]}):null]})},e.key)})})}):null]})}function Pi(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 Fi(e){if(Array.isArray(e))return e}function Ii(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 Li(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ri(e,t){return Fi(e)||Ii(e,t)||zi(e,t)||Li()}function zi(e,t){if(e){if(typeof e==`string`)return Pi(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)?Pi(e,t):void 0}}var Bi=Object.entries,Vi=Object.setPrototypeOf,Hi=Object.isFrozen,Ui=Object.getPrototypeOf,Wi=Object.getOwnPropertyDescriptor,Gi=Object.freeze,Ki=Object.seal,qi=Object.create,Ji=typeof Reflect<`u`&&Reflect,Yi=Ji.apply,Xi=Ji.construct;Gi||=function(e){return e},Ki||=function(e){return e},Yi||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Xi||=function(e){return new e(...[...arguments].slice(1))};var Zi=Y(Array.prototype.forEach),Qi=Y(Array.prototype.lastIndexOf),$i=Y(Array.prototype.pop),ea=Y(Array.prototype.push),ta=Y(Array.prototype.splice),na=Array.isArray,ra=Y(String.prototype.toLowerCase),ia=Y(String.prototype.toString),aa=Y(String.prototype.match),oa=Y(String.prototype.replace),sa=Y(String.prototype.indexOf),ca=Y(String.prototype.trim),la=Y(Number.prototype.toString),ua=Y(Boolean.prototype.toString),da=typeof BigInt>`u`?null:Y(BigInt.prototype.toString),fa=typeof Symbol>`u`?null:Y(Symbol.prototype.toString),pa=Y(Object.prototype.hasOwnProperty),ma=Y(Object.prototype.toString),ha=Y(RegExp.prototype.test),ga=_a(TypeError);function Y(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Yi(e,t,n)}}function _a(e){return function(){return Xi(e,[...arguments])}}function X(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ra;if(Vi&&Vi(e,null),!na(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Hi(t)||(t[r]=e),i=e)}e[i]=!0}return e}function va(e){for(let t=0;t<e.length;t++)pa(e,t)||(e[t]=null);return e}function ya(e){let t=qi(null);for(let r of Bi(e)){var n=Ri(r,2);let i=n[0],a=n[1];pa(e,i)&&(t[i]=na(a)?va(a):a&&typeof a==`object`&&a.constructor===Object?ya(a):a)}return t}function ba(e){switch(typeof e){case`string`:return e;case`number`:return la(e);case`boolean`:return ua(e);case`bigint`:return da?da(e):`0`;case`symbol`:return fa?fa(e):`Symbol()`;case`undefined`:return ma(e);case`function`:case`object`:{if(e===null)return ma(e);let t=e,n=xa(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ma(e)}return ma(e)}default:return ma(e)}}function xa(e,t){for(;e!==null;){let n=Wi(e,t);if(n){if(n.get)return Y(n.get);if(typeof n.value==`function`)return Y(n.value)}e=Ui(e)}function n(){return null}return n}function Sa(e){try{return ha(e,``),!0}catch{return!1}}var Ca=Gi(`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(`.`)),wa=Gi(`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(`.`)),Ta=Gi([`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`]),Ea=Gi([`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`]),Da=Gi(`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(`.`)),Oa=Gi([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),ka=Gi([`#text`]),Aa=Gi(`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(`.`)),ja=Gi(`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.pointer-events.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.vector-effect.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(`.`)),Ma=Gi(`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(`.`)),Na=Gi([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Pa=Ki(/{{[\w\W]*|^[\w\W]*}}/g),Fa=Ki(/<%[\w\W]*|^[\w\W]*%>/g),Ia=Ki(/\${[\w\W]*/g),La=Ki(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ra=Ki(/^aria-[\-\w]+$/),za=Ki(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ba=Ki(/^(?:\w+script|data):/i),Va=Ki(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ha=Ki(/^html$/i),Ua=Ki(/^[a-z][.\w]*(-[.\w]+)+$/i),Wa=Ki(/<[/\w!]/g),Ga=Ki(/<[/\w]/g),Ka=Ki(/<\/no(script|embed|frames)/i),qa=Ki(/\/>/i),Ja={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ya=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Xa=Gi(X({},Ya)),Za=function(){let e={};return Zi(Ya,t=>{e[t]=Ki(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Gi(e)}(),Qa=function(){return typeof window>`u`?null:window},$a=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}},eo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},to=function(e,t,n,r){return pa(e,t)&&na(e[t])?X(r.base?ya(r.base):{},e[t],r.transform):n},no=function(e,t,n){let r=pa(e,t)?e[t]:void 0;return r&&typeof r==`object`?ya(r):n()};function ro(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qa(),t=e=>ro(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==Ja.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=xa(d,`cloneNode`),p=xa(d,`remove`),m=xa(d,`removeAttributeNode`),h=xa(d,`nextSibling`),g=xa(d,`childNodes`),_=xa(d,`parentNode`),v=xa(d,`shadowRoot`),y=xa(d,`attributes`),b=o&&o.prototype?xa(o.prototype,`nodeType`):null,x=o&&o.prototype?xa(o.prototype,`nodeName`):null,S=o&&o.prototype?xa(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},ee=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,T=``,E,D=!1,O=0,k=function(){if(O>0)throw ga(`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.`)},A=function(e){k(),O++;try{return w.createHTML(e)}finally{O--}},te=function(e){k(),O++;try{return w.createScriptURL(e)}finally{O--}},j=function(){return D||=(E=$a(u,i),!0),E},M=n,N=M.implementation,ne=M.createNodeIterator,re=M.createDocumentFragment,ie=M.getElementsByTagName,ae=r.importNode,P=eo();t.isSupported=typeof Bi==`function`&&typeof _==`function`&&N&&N.createHTMLDocument!==void 0;let oe=Pa,F=Fa,se=Ia,ce=La,le=Ra,ue=Ba,de=Va,fe=Ua,pe=za,I=null,me=X({},[...Ca,...wa,...Ta,...Da,...ka]),L=null,he=X({},[...Aa,...ja,...Ma,...Na]),ge=Object.seal(qi(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}})),_e=null,ve=null,ye=Object.seal(qi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),be=!0,xe=!0,Se=!1,Ce=!0,we=!1,Te=!0,Ee=!1,De=!1,Oe=null,ke=null,Ae=!1,je=!1,Me=!1,Ne=!1,Pe=!0,Fe=!1,Ie=`user-content-`,Le=!0,Re=!1,ze={},Be=null,Ve=X({},`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(`.`)),He=null,Ue=X({},[`audio`,`video`,`img`,`source`,`image`,`track`]),We=null,Ge=X({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ke=`http://www.w3.org/1998/Math/MathML`,qe=`http://www.w3.org/2000/svg`,Je=`http://www.w3.org/1999/xhtml`,Ye=Je,Xe=!1,Ze=null,Qe=X({},[Ke,qe,Je],ia),$e=Gi([`mi`,`mo`,`mn`,`ms`,`mtext`]),et=X({},$e),tt=Gi([`annotation-xml`]),nt=X({},tt),rt=X({},[`title`,`style`,`font`,`a`,`script`]),it=null,at=[`application/xhtml+xml`,`text/html`],R=null,ot=null,z=n.createElement(`form`),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ot&&ot===e)return;(!e||typeof e!=`object`)&&(e={}),e=ya(e),it=at.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,R=it===`application/xhtml+xml`?ia:ra,I=to(e,`ALLOWED_TAGS`,me,{transform:R}),L=to(e,`ALLOWED_ATTR`,he,{transform:R}),Ze=to(e,`ALLOWED_NAMESPACES`,Qe,{transform:ia}),We=to(e,`ADD_URI_SAFE_ATTR`,Ge,{transform:R,base:Ge}),He=to(e,`ADD_DATA_URI_TAGS`,Ue,{transform:R,base:Ue}),Be=to(e,`FORBID_CONTENTS`,Ve,{transform:R}),_e=to(e,`FORBID_TAGS`,ya({}),{transform:R}),ve=to(e,`FORBID_ATTR`,ya({}),{transform:R}),ze=pa(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ya(e.USE_PROFILES):e.USE_PROFILES:!1,be=e.ALLOW_ARIA_ATTR!==!1,xe=e.ALLOW_DATA_ATTR!==!1,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=e.SAFE_FOR_TEMPLATES||!1,Te=e.SAFE_FOR_XML!==!1,Ee=e.WHOLE_DOCUMENT||!1,je=e.RETURN_DOM||!1,Me=e.RETURN_DOM_FRAGMENT||!1,Ne=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Pe=e.SANITIZE_DOM!==!1,Fe=e.SANITIZE_NAMED_PROPS||!1,Le=e.KEEP_CONTENT!==!1,Re=e.IN_PLACE||!1,pe=Sa(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:za,Ye=typeof e.NAMESPACE==`string`?e.NAMESPACE:Je,et=no(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>X({},$e)),nt=no(e,`HTML_INTEGRATION_POINTS`,()=>X({},tt));let t=no(e,`CUSTOM_ELEMENT_HANDLING`,()=>qi(null));if(ge=qi(null),pa(t,`tagNameCheck`)&&st(t.tagNameCheck)&&(ge.tagNameCheck=t.tagNameCheck),pa(t,`attributeNameCheck`)&&st(t.attributeNameCheck)&&(ge.attributeNameCheck=t.attributeNameCheck),pa(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ge.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Ki(ge),we&&(xe=!1),Me&&(je=!0),ze&&(I=X({},ka),L=qi(null),ze.html===!0&&(X(I,Ca),X(L,Aa)),ze.svg===!0&&(X(I,wa),X(L,ja),X(L,Na)),ze.svgFilters===!0&&(X(I,Ta),X(L,ja),X(L,Na)),ze.mathMl===!0&&(X(I,Da),X(L,Ma),X(L,Na))),ye.tagCheck=null,ye.attributeCheck=null,pa(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?ye.tagCheck=e.ADD_TAGS:na(e.ADD_TAGS)&&(I===me&&(I=ya(I)),X(I,e.ADD_TAGS,R))),pa(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?ye.attributeCheck=e.ADD_ATTR:na(e.ADD_ATTR)&&(L===he&&(L=ya(L)),X(L,e.ADD_ATTR,R))),pa(e,`ADD_FORBID_CONTENTS`)&&na(e.ADD_FORBID_CONTENTS)&&(Be===Ve&&(Be=ya(Be)),X(Be,e.ADD_FORBID_CONTENTS,R)),Le&&(I[`#text`]=!0),Ee&&X(I,[`html`,`head`,`body`]),I.table&&(X(I,[`tbody`]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw ga(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw ga(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=w;w=e.TRUSTED_TYPES_POLICY;try{T=A(``)}catch(e){throw w=t,e}}else e.TRUSTED_TYPES_POLICY===null?(w=void 0,T=``):(w===void 0&&(w=j()),w&&typeof T==`string`&&(T=A(``)));Gi&&Gi(e),ot=e},lt=X({},[...wa,...Ta,...Ea]),ut=X({},[...Da,...Oa]),dt=function(e,t,n){return t.namespaceURI===Je?e===`svg`:t.namespaceURI===Ke?e===`svg`&&(n===`annotation-xml`||et[n]):!!lt[e]},ft=function(e,t,n){return t.namespaceURI===Je?e===`math`:t.namespaceURI===qe?e===`math`&&nt[n]:!!ut[e]},pt=function(e,t,n){return t.namespaceURI===qe&&!nt[n]||t.namespaceURI===Ke&&!et[n]?!1:!ut[e]&&(rt[e]||!lt[e])},mt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ye,tagName:`template`});let n=ra(e.tagName),r=ra(t.tagName);return Ze[e.namespaceURI]?e.namespaceURI===qe?dt(n,t,r):e.namespaceURI===Ke?ft(n,t,r):e.namespaceURI===Je?pt(n,t,r):!!(it===`application/xhtml+xml`&&Ze[e.namespaceURI]):!1},ht=function(e){ea(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw ga(`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,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},_t=function(e){V(e);let t=g(e);if(t){let e=[];Zi(t,t=>{ea(e,t)}),Zi(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&>(e,r,i)}},vt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ea(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(je||Me)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},B=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||L[R(i)]||gt(e,r,i)}},V=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Ja.element&&B(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},yt=function(e,t){return Te?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},bt=function(e){if(!Te)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Ja.processingInstruction||n===Ja.comment&&ha(Ga,e.data)){try{p(e)}catch{}continue}if(n===Ja.element){let t=e,n=R(ee(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&yt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(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(Ae)e=`<remove></remove>`+e;else{let t=aa(e,/^[\r\n\t ]+/);r=t&&t[0]}it===`application/xhtml+xml`&&Ye===Je&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=w?A(e):e;if(Ye===Je)try{t=new l().parseFromString(i,it)}catch{}if(!t||!t.documentElement){t=N.createDocument(Ye,`template`,null);try{t.documentElement.innerHTML=Xe?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ye===Je?ie.call(t,Ee?`html`:`body`)[0]:Ee?t.documentElement:a},St=function(e){let t=S?S(e):e.ownerDocument;return ne.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},H=function(e){return e=oa(e,oe,` `),e=oa(e,F,` `),e=oa(e,se,` `),e},Ct=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ne.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=H(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Zi(i,e=>{Tt(e.content)&&Ct(e.content)})},wt=function(e){let t=x?x(e):null;return typeof t!=`string`||R(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Tt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Ja.documentFragment}catch{return!1}},Et=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Dt(e,n,r){e.length!==0&&Zi(e,e=>{e.call(t,n,r,ot)})}let Ot=function(e,t){return!!(Te&&e.hasChildNodes()&&!Et(e.firstElementChild)&&ha(Wa,e.textContent)&&ha(Wa,e.innerHTML)||Te&&e.namespaceURI===Je&&Xa[t]&&(Et(e.firstElementChild)||typeof e.textContent==`string`&&ha(Za[t],e.textContent))||e.nodeType===Ja.processingInstruction||Te&&e.nodeType===Ja.comment&&ha(Ga,e.data))},kt=function(e,t){return e instanceof RegExp?ha(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},At=function(e,t,n){if(!_e[t]&&U(t)&&kt(ge.tagNameCheck,t))return!1;if(Le&&!Be[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return ht(e),!0},jt=function(e,t,n,r){return e.length===0?t:t===n||t===r?ya(t):t},Mt=function(e,t){return e===t||_(e)!==null?!1:(Re&&V(e),!0)},Nt=function(e,n){if(Dt(P.beforeSanitizeElements,e,null),Mt(e,n))return!0;if(wt(e))return ht(e),!0;let r=R(ee(e));if(I=jt(P.uponSanitizeElement,I,me,Oe),Dt(P.uponSanitizeElement,e,{tagName:r,allowedTags:I}),Mt(e,n))return!0;if(Ot(e,r))return ht(e),!0;if(_e[r]||!(ye.tagCheck instanceof Function&&ye.tagCheck(r))&&!I[r]){let t=At(e,r,n);return t===!1&&Dt(P.afterSanitizeElements,e,null),t}if(C(e)===Ja.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ha(Ka,e.innerHTML))return ht(e),!0;if(we&&e.nodeType===Ja.text){let n=H(e.textContent);e.textContent!==n&&(ea(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Dt(P.afterSanitizeElements,e,null),!1},Pt=function(e,t,r){if(ve[t]||yt(t,e)||Pe&&(t===`id`||t===`name`)&&(r in n||r in z))return!1;let i=L[t]||ye.attributeCheck instanceof Function&&ye.attributeCheck(t,e);return xe&&ha(ce,t)||be&&ha(le,t)?!0:i?We[t]||ha(pe,oa(r,de,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&sa(r,`data:`)===0&&He[e]||Se&&!ha(ue,oa(r,de,``))?!0:!r:U(e)&&kt(ge.tagNameCheck,e)&&kt(ge.attributeNameCheck,t,e)||t===`is`&&ge.allowCustomizedBuiltInElements&&kt(ge.tagNameCheck,r)},Ft=X({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),U=function(e){return!Ft[ra(e)]&&ha(fe,e)},It=function(e,t,n,r){if(w&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return A(r);case`TrustedScriptURL`:return te(r)}return r},Lt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!wt(e)||(ht(e),!1)}catch{return vt(t,e),!1}},Rt=function(e){Dt(P.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||wt(e))return;L=jt(P.uponSanitizeAttribute,L,he,ke);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},i=n.length,a=R(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=R(s),d=l,f=s===`value`?d:ca(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Dt(P.uponSanitizeAttribute,e,r),f=r.attrValue,Fe&&(u===`id`||u===`name`)&&sa(f,Ie)!==0&&(vt(s,e,o),f=Ie+f,p=!0),Te&&ha(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){vt(s,e,o);continue}if(u===`attributename`&&aa(f,`href`)){vt(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){vt(s,e,o);continue}if(!Ce&&ha(qa,f)){vt(s,e,o);continue}if(we&&(f=H(f)),!Pt(a,u,f)){vt(s,e,o);continue}f=It(a,u,c,f),f!==d&&Lt(e,s,c,f)&&p&&$i(t.removed)}}Dt(P.afterSanitizeAttributes,e,null)},zt=function(e){let t=null,n=St(e);for(Dt(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Dt(P.uponSanitizeShadowNode,t,null),Nt(t,e),Rt(t),Tt(t.content)&&zt(t.content),C(t)===Ja.element){let e=v(t);Tt(e)&&(Bt(e),zt(e))}Dt(P.afterSanitizeShadowDOM,e,null)},Bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zt(e.shadow);continue}let n=e.node,r=C(n)===Ja.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&R(e)===`template`){let e=n.content;Tt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Tt(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=ba(e),typeof e!=`string`))throw ga(`dirty is not a string, aborting`);if(!t.isSupported)return e;De?(I=Oe,L=ke):ct(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(I=ya(I)),P.uponSanitizeAttribute.length>0&&(L=ya(L)),t.removed=[];let c=Re&&typeof e!=`string`&&Et(e);if(c){bt(e);let t=ee(e);if(typeof t==`string`){let n=R(t);if(!I[n]||_e[n])throw _t(e),ga(`root node is forbidden and cannot be sanitized in-place`)}if(wt(e))throw _t(e),ga(`root node is clobbered and cannot be sanitized in-place`);try{Bt(e)}catch(t){throw _t(e),t}}else if(Et(e))i=xt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Ja.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bt(i);else{if(!je&&!we&&!Ee&&e.indexOf(`<`)===-1)return w&&Ne?A(e):e;if(i=xt(e),!i)return je?null:Ne?T:``}i&&Ae&&ht(i.firstChild);let l=c?e:i;try{let e=St(l);for(;o=e.nextNode();)Nt(o,l),Rt(o),Tt(o.content)&&zt(o.content)}catch(n){throw c&&(_t(e),Zi(t.removed,e=>{e.element&&V(e.element)})),n}if(c)return Zi(t.removed,e=>{e.element&&V(e.element)}),we&&Ct(e),e;if(je){if(we&&Ct(i),Me)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(L.shadowroot||L.shadowrootmode)&&(s=ae.call(r,s,!0)),s}let u=Ee?i.outerHTML:i.innerHTML;return Ee&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ha(Ha,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
11
|
+
`+u),we&&(u=H(u)),w&&Ne?A(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(e),De=!0,Oe=I,ke=L},t.clearConfig=function(){ot=null,De=!1,Oe=null,ke=null,w=E,T=``},t.isValidAttribute=function(e,t,n){ot||ct({});let r=R(e),i=R(t);return Pt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&pa(P,e)&&ea(P[e],t)},t.removeHook=function(e,t){if(pa(P,e)){if(t!==void 0){let n=Qi(P[e],t);return n===-1?void 0:ta(P[e],n,1)[0]}return $i(P[e])}},t.removeHooks=function(e){pa(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=eo()},t}var io=ro();function ao(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var oo=ao();function so(e){oo=e}var co={exec:()=>null};function lo(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 Z(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(fo.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var uo=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),fo={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:lo(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:lo(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:lo(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:lo(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:lo(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:lo(e=>RegExp(`^ {0,${e}}>`))},po=/^(?:[ \t]*(?:\n|$))+/,mo=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ho=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,go=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_o=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,yo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bo=Z(yo).replace(/bull/g,vo).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}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),xo=Z(yo).replace(/bull/g,vo).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}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),So=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Co=/^[^\n]+/,wo=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,To=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,wo).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Eo=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,vo).getRegex(),Do=`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`,Oo=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ko=Z(`^ {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`,Oo).replace(`tag`,Do).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ao=e=>Z(So).replace(`hr`,go).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Do).getRegex(),jo=Ao(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Mo=Ao(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),No={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Mo).getRegex(),code:mo,def:To,fences:ho,heading:_o,hr:go,html:ko,lheading:bo,list:Eo,newline:po,paragraph:jo,table:co,text:Co},Po=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,go).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Do).getRegex(),Fo={...No,lheading:xo,table:Po,paragraph:Z(So).replace(`hr`,go).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Po).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Do).getRegex()},Io={...No,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Oo).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:co,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(So).replace(`hr`,go).replace(`heading`,` *#{1,6} *[^
|
|
12
|
+
]`).replace(`lheading`,bo).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Lo=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ro=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zo=/^( {2,}|\\)\n(?!\s*$)/,Bo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Vo=/[\p{P}\p{S}]/u,Ho=/[\s\p{P}\p{S}]/u,Uo=/[^\s\p{P}\p{S}]/u,Wo=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Ho).getRegex(),Go=/[\p{Pi}\p{Ps}"']/u,Ko=/(?!~)[\p{P}\p{S}]/u,qo=/(?!~)[\s\p{P}\p{S}]/u,Jo=/(?:[^\s\p{P}\p{S}]|~)/u,Yo=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,uo?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Xo=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Zo=Z(Xo,`u`).replace(/punct/g,Vo).getRegex(),Qo=Z(Xo,`u`).replace(/punct/g,Ko).getRegex(),$o=Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Go).replace(/punct/g,Vo).getRegex(),es=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,ts=Z(es,`gu`).replace(/notPunctSpace/g,Uo).replace(/punctSpace/g,Ho).replace(/punct/g,Vo).getRegex(),ns=Z(es,`gu`).replace(/notPunctSpace/g,Jo).replace(/punctSpace/g,qo).replace(/punct/g,Ko).getRegex(),rs=Z(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Uo).replace(/punctSpace/g,Ho).replace(/punct/g,Vo).getRegex(),is=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Uo).replace(/punctSpace/g,Ho).replace(/punct/g,Vo).getRegex(),as=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Uo).replace(/punctSpace/g,Ho).replace(/punct/g,Vo).getRegex(),os=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Vo).getRegex(),ss=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Uo).replace(/punctSpace/g,Ho).replace(/punct/g,Vo).getRegex(),cs=Z(/\\(punct)/,`gu`).replace(/punct/g,Vo).getRegex(),ls=Z(/^<(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(),us=Z(Oo).replace(`(?:-->|$)`,`-->`).getRegex(),ds=Z(`^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`,us).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ps=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,fs).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ms=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,fs).replace(`ref`,wo).getRegex(),hs=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,wo).getRegex(),gs=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,ms).replace(`nolink`,hs).getRegex(),_s=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,vs={_backpedal:co,anyPunctuation:cs,autolink:ls,blockSkip:Yo,br:zo,code:Ro,del:co,delLDelim:co,delRDelim:co,emStrongLDelim:Zo,emStrongRDelimAst:ts,emStrongRDelimUnd:is,escape:Lo,link:ps,nolink:hs,punctuation:Wo,reflink:ms,reflinkSearch:gs,tag:ds,text:Bo,url:co},ys={...vs,emStrongLDelim:$o,emStrongRDelimAst:rs,emStrongRDelimUnd:as,link:Z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,fs).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,fs).getRegex()},bs={...vs,emStrongRDelimAst:ns,emStrongLDelim:Qo,delLDelim:os,delRDelim:ss,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,_s).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:Z(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,_s).getRegex()},xs={...bs,br:Z(zo).replace(`{2,}`,`*`).getRegex(),text:Z(bs.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ss={normal:No,gfm:Fo,pedantic:Io},Cs={normal:vs,gfm:bs,breaks:xs,pedantic:ys},ws={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ts=e=>ws[e];function Es(e,t){if(t){if(fo.escapeTest.test(e))return e.replace(fo.escapeReplace,Ts)}else if(fo.escapeTestNoEncode.test(e))return e.replace(fo.escapeReplaceNoEncode,Ts);return e}function Ds(e){try{e=encodeURI(e).replace(fo.percentDecode,`%`)}catch{return null}return e}function Os(e,t){let n=e.replace(fo.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(fo.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(fo.slashPipe,`|`);return n}function ks(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 As(e){let t=e.split(`
|
|
13
|
+
`),n=t.length-1;for(;n>=0&&fo.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
14
|
+
`)}function js(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 Ms(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 Ns(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 Ps(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
15
|
+
`).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(`
|
|
16
|
+
`)}var Fs=class{options;rules;lexer;constructor(e){this.options=e||oo}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]:As(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=Ps(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=ks(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:ks(t[0],`
|
|
17
|
+
`),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:ks(t[0],`
|
|
18
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=ks(t[0],`
|
|
19
|
+
`).split(`
|
|
20
|
+
`),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(`
|
|
21
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
22
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
23
|
+
${s}`:s,r=r?`${r}
|
|
24
|
+
${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=e.join(`
|
|
25
|
+
`),o=t.raw+`
|
|
26
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s,n=`${n}
|
|
27
|
+
${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
28
|
+
`+e.join(`
|
|
29
|
+
`),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(`
|
|
30
|
+
`);continue}}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=Ms(t[2].split(`
|
|
31
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
32
|
+
`,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+`
|
|
33
|
+
`,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(`
|
|
34
|
+
`,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+=`
|
|
35
|
+
`+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+=`
|
|
36
|
+
`+l}u=!l.trim(),r+=p+`
|
|
37
|
+
`,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)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!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))}for(let e of i.items){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)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=As(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:ks(t[0],`
|
|
38
|
+
`),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=Os(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
39
|
+
`):[],a={type:`table`,raw:ks(t[0],`
|
|
40
|
+
`),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(Os(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:ks(t[0],`
|
|
41
|
+
`),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)===`
|
|
42
|
+
`?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=ks(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=js(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)),Ns(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 Ns(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 i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,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}}}},Is=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||oo,this.options.tokenizer=this.options.tokenizer||new Fs,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:fo,block:Ss.normal,inline:Cs.normal};this.options.pedantic?(t.block=Ss.pedantic,t.inline=Cs.pedantic):this.options.gfm&&(t.block=Ss.gfm,t.inline=this.options.breaks?Cs.breaks:Cs.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ss,inline:Cs}}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(fo.carriageReturn,`
|
|
43
|
+
`),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(fo.tabCharGlobal,` `).replace(fo.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+=`
|
|
44
|
+
`: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(`
|
|
45
|
+
`)?``:`
|
|
46
|
+
`)+i.raw,n.text+=`
|
|
47
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(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(`
|
|
48
|
+
`)?``:`
|
|
49
|
+
`)+i.raw,n.text+=`
|
|
50
|
+
`+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)){e=e.substring(i.raw.length),t.push(i);continue}if(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(`
|
|
51
|
+
`)?``:`
|
|
52
|
+
`)+i.raw,r.text+=`
|
|
53
|
+
`+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);continue}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(`
|
|
54
|
+
`)?``:`
|
|
55
|
+
`)+i.raw,n.text+=`
|
|
56
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}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;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=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&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}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)}},Ls=class{options;parser;constructor(e){this.options=e||oo}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(fo.notSpaceStart)?.[0],i=e.replace(fo.endingNewline,``)+`
|
|
57
|
+
`;return r?`<pre><code class="language-`+Es(r)+`">`+(n?i:Es(i,!0))+`</code></pre>
|
|
58
|
+
`:`<pre><code>`+(n?i:Es(i,!0))+`</code></pre>
|
|
59
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
60
|
+
${this.parser.parse(e)}</blockquote>
|
|
61
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
62
|
+
`}hr(e){return`<hr>
|
|
63
|
+
`}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+`>
|
|
64
|
+
`+r+`</`+i+`>
|
|
65
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
66
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
67
|
+
`}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>
|
|
68
|
+
<thead>
|
|
69
|
+
`+t+`</thead>
|
|
70
|
+
`+r+`</table>
|
|
71
|
+
`}tablerow({text:e}){return`<tr>
|
|
72
|
+
${e}</tr>
|
|
73
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
74
|
+
`}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>${Es(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=Ds(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Es(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=Ds(e);if(i===null)return Es(n);e=i;let a=`<img src="${e}" alt="${Es(n)}"`;return t&&(a+=` title="${Es(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Es(e.text)}},Rs=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}},zs=class e{options;renderer;textRenderer;constructor(e){this.options=e||oo,this.options.renderer=this.options.renderer||new Ls,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rs}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`,`checkbox`,`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`,`checkbox`,`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}},Bs=class{options;block;constructor(e){this.options=e||oo}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?Is.lex:Is.lexInline}provideParser(e=this.block){return e?zs.parse:zs.parseInline}},Vs=new class{defaults=ao();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=zs;Renderer=Ls;TextRenderer=Rs;Lexer=Is;Tokenizer=Fs;Hooks=Bs;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 Ls(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 Fs(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 Bs;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]=Bs.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Bs.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 Is.lex(e,t??this.defaults)}parser(e,t){return zs.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?Is.lex:Is.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?zs.parse:zs.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?Is.lex:Is.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?zs.parse:zs.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+=`
|
|
75
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Es(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return Vs.parse(e,t)}Q.options=Q.setOptions=function(e){return Vs.setOptions(e),Q.defaults=Vs.defaults,so(Q.defaults),Q},Q.getDefaults=ao,Q.defaults=oo;function Hs(...e){return Vs.use(...e),Q.defaults=Vs.defaults,so(Q.defaults),Q}Q.use=Hs,Q.walkTokens=function(e,t){return Vs.walkTokens(e,t)},Q.parseInline=Vs.parseInline,Q.Parser=zs,Q.parser=zs.parse,Q.Renderer=Ls,Q.TextRenderer=Rs,Q.Lexer=Is,Q.lexer=Is.lex,Q.Tokenizer=Fs,Q.Hooks=Bs,Q.parse=Q,Q.options,Q.setOptions,Q.walkTokens,Q.parseInline,zs.parse,Is.lex;var $={transcriptWrap:`_transcriptWrap_yy5uu_5`,transcript:`_transcript_yy5uu_5`,list:`_list_yy5uu_14`,item:`_item_yy5uu_24`,skeleton:`_skeleton_yy5uu_26`,skeletonUser:`_skeletonUser_yy5uu_38`,loadError:`_loadError_yy5uu_39`,empty:`_empty_yy5uu_62`,emptyTitle:`_emptyTitle_yy5uu_63`,emptyBody:`_emptyBody_yy5uu_72`,user:`_user_yy5uu_75`,userText:`_userText_yy5uu_76`,assistant:`_assistant_yy5uu_87`,markdown:`_markdown_yy5uu_31`,codeHead:`_codeHead_yy5uu_182`,codeLang:`_codeLang_yy5uu_199`,copy:`_copy_yy5uu_198`,caret:`_caret_yy5uu_224`,streaming:`_streaming_yy5uu_225`,"verse-caret":`_verse-caret_yy5uu_1`,thinking:`_thinking_yy5uu_238`,thinkingSummary:`_thinkingSummary_yy5uu_239`,thinkingBody:`_thinkingBody_yy5uu_251`,tool:`_tool_yy5uu_262`,toolRun:`_toolRun_yy5uu_263`,toolLine:`_toolLine_yy5uu_265`,toolArg:`_toolArg_yy5uu_283`,toolState:`_toolState_yy5uu_283`,toolGlyph:`_toolGlyph_yy5uu_294`,toolName:`_toolName_yy5uu_304`,toolFailed:`_toolFailed_yy5uu_328`,toolBody:`_toolBody_yy5uu_331`,toolRunBody:`_toolRunBody_yy5uu_332`,toolRunList:`_toolRunList_yy5uu_339`,toolLabel:`_toolLabel_yy5uu_341`,toolPre:`_toolPre_yy5uu_350`,toolPending:`_toolPending_yy5uu_365`,note:`_note_yy5uu_368`,noteError:`_noteError_yy5uu_374`,meta:`_meta_yy5uu_375`,noteDuration:`_noteDuration_yy5uu_376`,metaText:`_metaText_yy5uu_380`,jump:`_jump_yy5uu_387`,jumpUnseen:`_jumpUnseen_yy5uu_410`,turn:`_turn_yy5uu_435`,turnItems:`_turnItems_yy5uu_457`,"verse-flash":`_verse-flash_yy5uu_1`,turnErrorJump:`_turnErrorJump_yy5uu_493`,toolDelta:`_toolDelta_yy5uu_511`,toolAdd:`_toolAdd_yy5uu_519`,toolDel:`_toolDel_yy5uu_511`,toolNote:`_toolNote_yy5uu_522`},Us=!1;function Ws(){Us||(Us=!0,io.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))}))}var Gs={USE_PROFILES:{html:!0},ADD_ATTR:[`target`],FORBID_TAGS:[`style`,`form`,`input`,`button`,`iframe`,`object`,`embed`]};function Ks(e){Ws();let t=Q.parse(e,{async:!1,gfm:!0,breaks:!1});return io.sanitize(t,Gs)}var qs=`Copy`,Js=`Copied`;function Ys(e){return/(?:^|\s)(?:language|lang)-([\w+#.-]+)/.exec(e?.className??``)?.[1]??``}function Xs({text:e,streaming:t=!1}){let n=(0,z.useMemo)(()=>Ks(e),[e]),r=(0,z.useRef)(null);(0,z.useEffect)(()=>{let e=r.current;if(e)for(let t of e.querySelectorAll(`pre`)){if(t.querySelector(`[data-code-head]`))continue;let e=document.createElement(`div`);e.className=$.codeHead??``,e.setAttribute(`data-code-head`,``);let n=Ys(t.querySelector(`code`)),r=document.createElement(`span`);r.className=$.codeLang??``,r.textContent=n,e.append(r);let i=document.createElement(`button`);i.type=`button`,i.className=$.copy??``,i.setAttribute(`data-copy`,``),i.setAttribute(`aria-label`,`Copy code`),i.textContent=qs,e.append(i),t.prepend(e)}},[n]);function i(e){let t=e.target?.closest(`[data-copy]`);if(!t)return;e.preventDefault();let n=t.closest(`pre`),r=n?.querySelector(`code`),i=n?.querySelector(`[data-code-head]`);Zs(r?r.textContent??``:Array.from(n?.childNodes??[]).filter(e=>e!==i).map(e=>e.textContent??``).join(``)).then(e=>{t.textContent=e?Js:`Copy failed`,setTimeout(()=>{t.textContent=qs},1500)})}return(0,V.jsx)(`div`,{ref:r,className:`${$.markdown} ${t?$.streaming:``}`,onClick:i,dangerouslySetInnerHTML:{__html:n}})}async function Zs(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}var Qs=/\u001B\[[0-9;:?]*[ -/]*[@-~]/g,$s=/\u001B\][\s\S]*?(?:\u0007|\u001B\\)/g,ec=/\u001B[@-Z\\-_]/g,tc=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g;function nc(e){return e.includes(`\x1B`)}function rc(e){return e.replace($s,``).replace(Qs,``).replace(ec,``).replace(tc,``)}function ic(e){return e.includes(`\r`)?e.split(`
|
|
76
|
+
`).map(e=>{if(!e.includes(`\r`))return e;let t=``;for(let n of e.split(`\r`))t=n.length>=t.length?n:n+t.slice(n.length);return t}).join(`
|
|
77
|
+
`):e}function ac(e){return ic(rc(e)).replace(/[ \t]+$/gm,``).replace(/\n+$/,``)}function oc(e){if(e.length===0)return 0;let t=1;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function sc(e,t){let n=e.split(`
|
|
78
|
+
`);return n.length<=t?{head:e,hidden:0}:{head:n.slice(0,t).join(`
|
|
79
|
+
`),hidden:n.length-t}}var cc=20,lc=2e5;function uc({command:e,output:t,isError:n,pending:r,body:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useMemo)(()=>{let e=ac(t);return e.length>lc?`${e.slice(0,lc)}\n… (${e.length-lc} more characters not shown)`:e},[t]),{head:c,hidden:l}=(0,z.useMemo)(()=>sc(s,cc),[s]),u=a?s:c,d=e?.exitCode??null;return(0,V.jsxs)(`div`,{className:J.command,"data-failed":n?`true`:void 0,children:[e?(0,V.jsxs)(`div`,{className:J.commandLine,children:[(0,V.jsx)(`span`,{className:J.commandPrompt,"aria-hidden":`true`,children:`$`}),(0,V.jsx)(`code`,{className:J.commandText,children:e.command})]}):null,(0,V.jsxs)(`div`,{className:J.commandStatus,children:[(0,V.jsx)(`span`,{className:J.commandStatusText,"data-tone":r?`pending`:n?`bad`:`ok`,children:r?`running…`:d===null?n?`failed — no exit code reported`:`completed — no exit code reported`:`exit ${d}`}),!r&&!i&&s.length===0?(0,V.jsx)(`span`,{className:J.commandMeta,children:`no output`}):null,!r&&!i&&s.length>0?(0,V.jsxs)(`span`,{className:J.commandMeta,children:[oc(s),` line`,oc(s)===1?``:`s`,nc(t)?` · colour codes stripped`:``]}):null]}),r?(0,V.jsx)(`p`,{className:J.commandPending,children:`Waiting for the command to finish…`}):i||(s.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`pre`,{className:J.commandPre,children:u}),l>0?(0,V.jsx)(`button`,{type:`button`,className:J.commandMore,"aria-expanded":a,onClick:()=>o(e=>!e),children:a?`Collapse output`:`Show ${l} more line${l===1?``:`s`}`}):null]}):null)]})}var dc=28,fc=18,pc=4e3;function mc({diff:e,path:t=null}){let n=(0,z.useMemo)(()=>w(e.text),[e.text]);if(n.files.length===0)return null;if(e.multiFile||n.files.length>1)return(0,V.jsx)(`div`,{className:J.diffMulti,children:(0,V.jsx)(D,{diff:e.text,proposalKind:`tool call`})});let r=n.files[0];return(0,V.jsx)(gc,{file:r,anchored:e.anchored,path:t??r.displayPath})}function hc(e){switch(e.status){case`renamed`:return`Renamed. The contents did not change, so there are no lines to show.`;case`added`:return`New file. It was added with no contents to diff against.`;case`deleted`:return`Deleted. The file is gone, so there are no lines to show.`;default:return null}}function gc({file:e,anchored:t,path:n}){let[r,i]=(0,z.useState)(!1),a=T(n),o=(0,z.useMemo)(()=>_c(e.hunks),[e.hunks]),s=o.length>dc,c=s&&!r?o.slice(0,fc):o,l=o.length-c.length,u=e.status===`renamed`?e.oldPath:null,d=hc(e);return(0,V.jsxs)(`div`,{className:J.diff,"data-anchored":t?`true`:`false`,"data-status":e.status,children:[(0,V.jsxs)(`div`,{className:J.diffHead,children:[u?(0,V.jsxs)(`span`,{className:J.diffOldPath,title:u,children:[u,(0,V.jsx)(`span`,{className:J.visuallyHidden,children:` renamed to`})]}):null,(0,V.jsx)(`span`,{className:J.diffPath,title:n,children:n}),e.status===`modified`?null:(0,V.jsx)(`span`,{className:J.diffStatus,children:e.status}),(0,V.jsxs)(`span`,{className:J.diffStats,children:[e.additions>0?(0,V.jsxs)(`span`,{className:J.diffAdd,children:[`+`,e.additions]}):null,e.deletions>0?(0,V.jsxs)(`span`,{className:J.diffDel,children:[`−`,e.deletions]}):null]})]}),e.unparsedNotice?(0,V.jsx)(`pre`,{className:J.diffNotice,children:e.unparsedNotice}):null,o.length===0?(0,V.jsx)(`p`,{className:J.diffEmpty,children:d??`No line-level changes in this call.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`table`,{className:J.diffTable,children:(0,V.jsx)(`tbody`,{children:c.map(e=>e.kind===`hunk`?(0,V.jsxs)(`tr`,{className:J.diffHunkRow,children:[t?(0,V.jsx)(`td`,{className:J.diffNo,"aria-hidden":`true`}):null,(0,V.jsx)(`td`,{className:J.diffMarker,"aria-hidden":`true`}),(0,V.jsx)(`td`,{className:J.diffHunkHead,children:e.label})]},e.key):(0,V.jsxs)(`tr`,{className:J[`diffRow_${e.line.kind}`],children:[t?(0,V.jsx)(`td`,{className:J.diffNo,children:e.line.newLineNo??e.line.oldLineNo??``}):null,(0,V.jsx)(`td`,{className:J.diffMarker,"aria-hidden":`true`,children:e.line.kind===`add`?`+`:e.line.kind===`del`?`−`:``}),(0,V.jsx)(`td`,{className:J.diffText,children:(0,V.jsx)(vc,{text:e.line.text,lang:a})})]},e.key))})}),s?(0,V.jsx)(`button`,{type:`button`,className:J.diffMore,onClick:()=>i(e=>!e),"aria-expanded":r,children:r?`Collapse diff`:`Show ${l} more line${l===1?``:`s`}`}):null]}),t?null:(0,V.jsx)(`p`,{className:J.diffUnanchored,children:`Line numbers are not shown — this tool call reported what it replaced, not where in the file.`})]})}function _c(e){let t=[],n=!1;return e.forEach((r,i)=>{if(n)return;let a=r.header.replace(/^@@[^@]*@@/,``).trim();(a||e.length>1)&&t.push({kind:`hunk`,key:`h${i}`,label:a||`hunk ${i+1}`});for(let e=0;e<r.lines.length;e++){if(t.length>=pc){n=!0,t.push({kind:`hunk`,key:`truncated`,label:`diff truncated at ${pc} lines`});return}t.push({kind:`line`,key:`h${i}l${e}`,line:r.lines[e]})}}),t}function vc({text:e,lang:t}){let n=E(e,t);return(0,V.jsx)(`code`,{className:J.diffCode,children:n.map((e,t)=>(0,V.jsx)(`span`,{className:J[`tok_${e.kind}`],children:e.text},t))})}var yc=2e4;function bc({name:e,input:t,result:n,toolUseId:r,durationMs:i=null,facts:a}){let o=(0,z.useMemo)(()=>a??ci({name:e,input:t,result:n}),[a,e,t,n]),s=De(t),c=o.failed||n?.isError===!0,l=n===null,u=l?`running`:c?`error`:i!==null&&i>0?Ee(i):`done`,d=(0,z.useMemo)(()=>o.diff?hi(o.diff.text):null,[o.diff]),f=n?n.output.length>yc?`${n.output.slice(0,yc)}\n… (${n.output.length-yc} more characters)`:n.output:``;return(0,V.jsxs)(`details`,{id:li(r),className:`${$.tool} ${c?$.toolFailed:``}`,"data-state-key":`tool:${r}`,"data-action":o.action,children:[(0,V.jsxs)(`summary`,{className:$.toolLine,"aria-label":`${e}${s?`: ${s}`:``} (${u})`,children:[(0,V.jsx)(`span`,{className:$.toolGlyph,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:$.toolName,children:e}),s?(0,V.jsx)(`span`,{className:$.toolArg,title:s,children:s}):null,d&&(d.additions>0||d.deletions>0)?(0,V.jsxs)(`span`,{className:$.toolDelta,"aria-hidden":`true`,children:[d.additions>0?(0,V.jsxs)(`span`,{className:$.toolAdd,children:[`+`,d.additions]}):null,d.deletions>0?(0,V.jsxs)(`span`,{className:$.toolDel,children:[`−`,d.deletions]}):null]}):null,(0,V.jsx)(`span`,{className:$.toolState,children:u})]}),(0,V.jsx)(`div`,{className:$.toolBody,children:(0,V.jsx)(xc,{input:t,output:f,facts:o,pending:l,isError:c})})]})}function xc({input:e,output:t,facts:n,pending:r,isError:i}){return n.command?(0,V.jsx)(uc,{command:n.command,output:t,isError:i,pending:r,body:n.diff?(0,V.jsx)(mc,{diff:n.diff,path:n.paths[0]??null}):void 0}):n.diff?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(mc,{diff:n.diff,path:n.paths[0]??null}),r?(0,V.jsx)(`p`,{className:$.toolPending,children:`Waiting for the tool to finish…`}):null,i&&t?(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:`Error`}),(0,V.jsx)(`pre`,{className:$.toolPre,children:t})]}):null]}):n.written?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`h4`,{className:$.toolLabel,children:[`Contents written to `,n.written.path]}),(0,V.jsx)(`pre`,{className:$.toolPre,children:n.written.text}),(0,V.jsx)(`p`,{className:$.toolNote,children:`The previous contents were not in this tool call, so there is nothing to diff against.`})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:i?`Error`:`Result`}),r?(0,V.jsx)(`p`,{className:$.toolPending,children:`Waiting for the tool to finish…`}):(0,V.jsx)(`pre`,{className:$.toolPre,children:t||`(empty)`})]})]}):(0,V.jsxs)(V.Fragment,{children:[e==null?null:(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:`Input`}),(0,V.jsx)(`pre`,{className:$.toolPre,children:Ae(e)})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:i?`Error`:`Result`}),r?(0,V.jsx)(`p`,{className:$.toolPending,children:`Waiting for the tool to finish…`}):(0,V.jsx)(`pre`,{className:$.toolPre,children:t||`(empty)`})]})]})}var Sc=48,Cc=3,wc=1400;function Tc({transcript:e,loaded:t,loadError:n,onRetry:r,emptyHint:i}){let a=(0,z.useRef)(null),o=(0,z.useRef)(new Map),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!0),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(``),[h,g]=(0,z.useState)(-1),[_,v]=(0,z.useState)(0),y=(0,z.useRef)(0),b=(0,z.useRef)(ui()),x=(0,z.useMemo)(()=>Tn(e.items),[e.items]),S=(0,z.useMemo)(()=>vi(x,b.current),[x]),C=(0,z.useMemo)(()=>Ei(S.turns,f,b.current),[S.turns,f]),ee=(0,z.useMemo)(()=>new Set(C.map(e=>e.turnKey)),[C]),w=(0,z.useMemo)(()=>{let t=new Set,n=null;for(let r of e.items)r.kind===`turn-done`&&!r.ok&&n&&n.turnId===r.turnId&&(n.kind===`cancelled`||n.kind===`error`)&&t.add(r.key),n={turnId:r.turnId,kind:r.kind};return t},[e.items]),T=(0,z.useCallback)((e=`auto`)=>{let t=a.current;t&&(typeof t.scrollTo==`function`?t.scrollTo({top:t.scrollHeight,behavior:e}):t.scrollTop=t.scrollHeight)},[]);function E(){let e=a.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<=Sc;l(t),t&&d(!1)}let D=(0,z.useCallback)(e=>{e&&(l(!1),typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`center`,behavior:`smooth`}),typeof e.focus==`function`&&e.focus({preventScroll:!0}),e.setAttribute(`data-flash`,`true`),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>e.removeAttribute(`data-flash`),wc))},[]);(0,z.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let O=(0,z.useCallback)(e=>{D(o.current.get(e)??null)},[D]),k=(0,z.useCallback)(e=>{let t=a.current?.ownerDocument?.getElementById(e)??null;if(t){for(let e=t;e&&(e instanceof HTMLDetailsElement&&(e.open=!0),e!==a.current);e=e.parentElement);D(t)}},[D]),A=(0,z.useCallback)(e=>k(li(e)),[k]),te=(0,z.useCallback)(()=>{let e=S.errorAnchors[0];e&&k(e)},[S.errorAnchors,k]),j=(0,z.useCallback)(e=>{if(C.length===0)return;let t=h<0?e>0?0:C.length-1:(h+e+C.length)%C.length;g(t),O(C[t].turnKey)},[C,h,O]);(0,z.useEffect)(()=>{g(-1)},[f]);let M=(0,z.useCallback)(e=>{let t=S.turns;if(t.length===0)return;let n=a.current?.ownerDocument?.activeElement,r=n instanceof HTMLElement?n.getAttribute(`data-turn-key`):null,i=r?t.findIndex(e=>e.key===r):-1,o=i<0?e>0?0:t.length-1:Math.max(0,Math.min(t.length-1,i+e));O(t[o].key)},[S.turns,O]);(0,z.useEffect)(()=>{if(S.turns.length===0)return;let e=e=>{let t=e.target,n=t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement||t?.isContentEditable===!0;if((e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`f`){if(S.turns.length<Cc)return;e.preventDefault(),v(e=>e+1);return}e.altKey&&!e.metaKey&&!e.ctrlKey&&!n&&(e.key===`ArrowDown`?(e.preventDefault(),M(1)):e.key===`ArrowUp`&&(e.preventDefault(),M(-1)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[S.turns.length,M]);function N(e){e.target?.hasAttribute(`data-turn-key`)&&(e.key===`ArrowDown`?(e.preventDefault(),M(1)):e.key===`ArrowUp`?(e.preventDefault(),M(-1)):e.key===`Home`?(e.preventDefault(),O(S.turns[0].key)):e.key===`End`&&(e.preventDefault(),O(S.turns[S.turns.length-1].key)))}if((0,z.useLayoutEffect)(()=>{let t=e.items.length,n=e.items[t-1],r=t!==y.current||n?.kind===`assistant`&&n.streaming;y.current=t,r&&(c?T():d(!0))},[e,c,T]),(0,z.useEffect)(()=>{t&&T()},[t,T]),!t&&!n)return(0,V.jsx)(`div`,{className:$.transcript,"aria-busy":`true`,children:(0,V.jsxs)(`div`,{className:$.skeleton,children:[(0,V.jsx)(`div`,{className:$.skeletonUser,children:(0,V.jsx)(m,{width:`42%`})}),(0,V.jsx)(m,{width:`88%`}),(0,V.jsx)(m,{width:`72%`}),(0,V.jsx)(m,{width:`80%`}),(0,V.jsx)(`div`,{className:$.skeletonUser,children:(0,V.jsx)(m,{width:`30%`})}),(0,V.jsx)(m,{width:`64%`})]})});if(n)return(0,V.jsx)(`div`,{className:$.transcript,children:(0,V.jsxs)(`div`,{role:`alert`,className:$.loadError,children:[(0,V.jsx)(`p`,{children:n}),r?(0,V.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`}):null]})});let ne=h>=0?C[h]?.turnKey??null:null;return(0,V.jsxs)(`div`,{className:$.transcriptWrap,children:[S.turns.length>=Cc?(0,V.jsx)(Ni,{turns:S.turns,query:f,onQuery:p,matches:C,matchIndex:h,onStepMatch:j,errorCount:S.errorAnchors.length,onJumpError:te,onJumpTurn:O,focusToken:_}):null,(0,V.jsxs)(`div`,{ref:a,className:$.transcript,onScroll:E,role:`log`,"aria-live":`polite`,"aria-relevant":`additions text`,children:[e.items.length===0?(0,V.jsxs)(`div`,{className:$.empty,children:[(0,V.jsx)(`p`,{className:$.emptyTitle,children:`Say something to begin.`}),(0,V.jsx)(`p`,{className:$.emptyBody,children:i??`The agent can read and edit this project. Ask for a change, a review, or an explanation.`})]}):null,(0,V.jsxs)(`ol`,{className:$.list,onKeyDown:N,children:[S.turns.map((e,t)=>(0,V.jsxs)(`li`,{id:pi(e.key),ref:t=>{t?o.current.set(e.key,t):o.current.delete(e.key)},className:$.turn,"data-turn-key":e.key,"data-status":e.status,"data-match":ee.has(e.key)?e.key===ne?`active`:`true`:void 0,tabIndex:-1,"aria-label":`Turn ${t+1} of ${S.turns.length}`,children:[(0,V.jsx)(`ol`,{className:$.turnItems,children:e.items.map(e=>Ec(e,S.facts,w))}),e.files.length>0?(0,V.jsx)(Ai,{files:e.files,onJump:A}):null,e.errorCount>0&&e.firstErrorAnchor?(0,V.jsxs)(`button`,{type:`button`,className:$.turnErrorJump,onClick:()=>k(e.firstErrorAnchor),children:[e.errorCount,` failure`,e.errorCount===1?``:`s`,` in this turn — jump to the first`]}):null]},e.key)),e.live&&!e.items.some(e=>e.kind===`assistant`&&e.streaming)?(0,V.jsx)(`li`,{className:`${$.item} ${$.assistant}`,"data-kind":`pending`,"aria-label":`Waiting for the agent`,children:(0,V.jsx)(`span`,{className:$.caret,"aria-hidden":`true`})}):null]})]}),c?null:(0,V.jsxs)(`button`,{type:`button`,className:`${$.jump} ${u?$.jumpUnseen:``}`,onClick:()=>{l(!0),d(!1),T(`smooth`)},children:[(0,V.jsx)(ie,{size:12}),` Jump to latest`]})]})}function Ec(e,t,n){switch(e.kind){case`user`:return(0,V.jsx)(`li`,{className:`${$.item} ${$.user}`,"data-kind":`user`,children:(0,V.jsx)(`div`,{className:$.userText,children:e.text})},e.key);case`assistant`:return(0,V.jsx)(`li`,{className:`${$.item} ${$.assistant}`,"data-kind":`assistant`,"data-streaming":e.streaming||void 0,children:(0,V.jsx)(Xs,{text:e.text,streaming:e.streaming})},e.key);case`thinking`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`thinking`,children:(0,V.jsx)(Dc,{item:e})},e.key);case`tool`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`tool`,children:(0,V.jsx)(bc,{name:e.name,input:e.input,result:e.result,toolUseId:e.toolUseId,durationMs:e.durationMs,facts:t.get(e.toolUseId)})},e.key);case`toolGroup`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`tool-group`,children:(0,V.jsx)(Oc,{item:e,facts:t})},e.key);case`error`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`error`,children:(0,V.jsx)(`div`,{id:fi(e.key),role:`alert`,className:`${$.note} ${$.noteError}`,children:e.message})},e.key);case`cancelled`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`cancelled`,children:(0,V.jsx)(`div`,{className:$.note,children:`Stopped.`})},e.key);case`turn-done`:return e.ok||n.has(e.key)?e.durationMs>0?(0,V.jsx)(`li`,{className:`${$.item} ${$.meta}`,"data-kind":`turn-done`,children:(0,V.jsx)(`span`,{className:$.metaText,children:Ee(e.durationMs)})},e.key):null:(0,V.jsx)(`li`,{className:$.item,"data-kind":`turn-done`,children:(0,V.jsxs)(`div`,{id:fi(e.key),className:`${$.note} ${$.noteError}`,children:[`Turn ended without a result (`,(0,V.jsx)(`span`,{className:$.noteDuration,children:Ee(e.durationMs)}),`).`]})},e.key);default:return null}}function Dc({item:e}){return(0,V.jsxs)(`details`,{className:$.thinking,"data-state-key":`thinking:${e.key}`,children:[(0,V.jsx)(`summary`,{className:$.thinkingSummary,children:`Thinking`}),(0,V.jsx)(`div`,{className:$.thinkingBody,children:e.text})]})}function Oc({item:e,facts:t}){let n=e.pending?`running`:e.errorCount>0?`${e.errorCount} failed`:e.spanMs!==null&&e.spanMs>0?Ee(e.spanMs):`done`,r=`${e.toolCount} tool${e.toolCount===1?``:`s`}`;return(0,V.jsxs)(`details`,{className:`${$.toolRun} ${e.errorCount>0?$.toolFailed:``}`,"data-state-key":`toolgroup:${e.key}`,children:[(0,V.jsxs)(`summary`,{className:$.toolLine,"aria-label":`${r}: ${e.summary} (${n})`,children:[(0,V.jsx)(`span`,{className:$.toolGlyph,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:$.toolName,children:r}),e.summary?(0,V.jsx)(`span`,{className:$.toolArg,title:e.summary,children:e.summary}):null,(0,V.jsx)(`span`,{className:$.toolState,children:n})]}),(0,V.jsx)(`div`,{className:$.toolRunBody,children:(0,V.jsx)(`ol`,{className:$.toolRunList,children:e.items.map(e=>(0,V.jsx)(`li`,{"data-member":e.kind,children:e.kind===`tool`?(0,V.jsx)(bc,{name:e.name,input:e.input,result:e.result,toolUseId:e.toolUseId,durationMs:e.durationMs,facts:t.get(e.toolUseId)}):(0,V.jsx)(Dc,{item:e})},e.key))})})]})}var kc=3e4;function Ac(e=!0){let t=b(fe);(0,z.useEffect)(()=>{if(!e)return;let n=()=>{(typeof document>`u`||document.visibilityState!==`hidden`)&&t()},r=window.setInterval(n,kc);return document.addEventListener(`visibilitychange`,n),()=>{window.clearInterval(r),document.removeEventListener(`visibilitychange`,n)}},[e,t])}function jc(e){let{view:t,seats:n,projects:r,dispatchEnabled:i,locked:a,hasAnySessions:o,onSend:s,onStop:c,onRename:l,onDelete:u,onSeatChange:d,onNew:f,onRetry:p,sidebarCollapsed:m,onToggleSidebar:h,resourcesOpen:g,onToggleResources:_}=e,v=t.session,[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)(``),[C,ee]=(0,z.useState)(!1),[w,T]=(0,z.useState)(!1),E=(0,z.useRef)(null),D=(0,z.useId)();Ac(),(0,z.useEffect)(()=>{b(!1),ee(!1)},[t.sessionId]),(0,z.useEffect)(()=>{y&&E.current?.select()},[y]);let O=(0,V.jsxs)(`div`,{className:q.toggles,role:`group`,"aria-label":`Panels`,children:[(0,V.jsx)(Nc,{collapsed:m,onToggle:h}),(0,V.jsx)(Pc,{open:g,onToggle:_})]});if(!t.sessionId)return(0,V.jsxs)(`section`,{className:q.workspace,"aria-label":`Chat`,children:[(0,V.jsxs)(`header`,{className:q.header,"data-app-region":`drag`,children:[(0,V.jsx)(Mc,{eyebrow:(0,V.jsx)(`span`,{className:q.eyebrow,children:`Chat`}),title:(0,V.jsx)(`span`,{className:q.titleStatic,"data-state":`empty`,children:o?`No chat selected`:`No chats yet`})}),(0,V.jsx)(`div`,{className:q.headerSpacer}),(0,V.jsx)(`div`,{className:q.actions,children:O})]}),(0,V.jsxs)(`div`,{className:q.emptyState,children:[(0,V.jsx)(`span`,{className:q.emptyMark,"aria-hidden":`true`,children:(0,V.jsx)(P,{size:36})}),(0,V.jsx)(`h1`,{className:q.emptyTitle,children:o?`Pick a chat, or start a new one`:`No chats yet — ⌘N`}),(0,V.jsx)(`p`,{className:q.emptyBody,children:`Open a project, choose a seat — a Claude or Codex account, Grok, or a local Ollama model — and talk to an agent that can edit that project.`}),(0,V.jsxs)(`button`,{type:`button`,className:q.emptyButton,onClick:f,children:[`New chat `,(0,V.jsx)(`kbd`,{children:`⌘N`})]}),i?null:(0,V.jsxs)(`p`,{className:q.emptyWarn,role:`status`,children:[`This server was started without dispatch, so chats are read-only here. Run `,(0,V.jsx)(`code`,{children:`ashlr verse`}),` to enable sending.`]})]})]});async function k(){let e=x.trim();if(b(!1),v&&e&&e!==v.title){T(!0);try{await l(e)}finally{T(!1)}}}function A(e){e.key===`Enter`?(e.preventDefault(),k()):e.key===`Escape`&&(e.preventDefault(),b(!1))}let te=v?.status===`running`,j=v?ze(n,v):null,M=v?Fe(n,v.seatId)??null:null,N=M===null?null:ht(M),ne=v===null?``:`${M===null||N===null?Te(n,v):_t(M,N)} · ${v.projectPath}`,re=i?null:`Sending is disabled: this server was started without dispatch.`;return(0,V.jsxs)(`section`,{className:q.workspace,"aria-labelledby":D,children:[(0,V.jsxs)(`header`,{className:q.header,"data-app-region":`drag`,children:[(0,V.jsx)(Mc,{eyebrow:v?(0,V.jsx)(`span`,{className:q.eyebrow,title:v.projectPath,children:Re(v.projectPath,r)}):(0,V.jsx)(`span`,{className:`${q.eyebrow} skeleton ${q.eyebrowSkeleton}`,"aria-hidden":`true`}),title:v?y?(0,V.jsx)(`input`,{ref:E,className:q.titleInput,value:x,"aria-label":`Chat title`,onChange:e=>S(e.target.value),onBlur:()=>{k()},onKeyDown:A,maxLength:120}):(0,V.jsx)(`h1`,{id:D,className:q.title,children:(0,V.jsx)(`button`,{type:`button`,className:q.titleButton,title:`Rename chat`,disabled:w||!i,onClick:()=>{S(v.title),b(!0)},children:v.title||`Untitled chat`})}):(0,V.jsx)(`h1`,{id:D,className:`${q.titleStatic} skeleton ${q.titleSkeleton}`,"aria-label":`Loading chat`})}),v?(0,V.jsxs)(`span`,{className:`${q.seatPill} ${q[`engine-${v.engine}`]??``}`,"data-engine":v.engine,"data-seat-capacity":N!==null&&vt(N.cls)?N.cls:void 0,title:ne,children:[(0,V.jsx)(`span`,{className:q.engineDot,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:q.seatText,children:Te(n,v)}),N!==null&&vt(N.cls)?(0,V.jsx)(bt,{view:N}):null]}):null,(0,V.jsx)(`div`,{className:q.headerSpacer}),(0,V.jsxs)(`div`,{className:q.actions,children:[t.stream===`reconnecting`?(0,V.jsx)(`span`,{className:q.streamState,role:`status`,children:`reconnecting…`}):null,v?(0,V.jsx)(br,{contextTokens:v.usage.contextTokens,contextWindow:j}):null,v?C?(0,V.jsxs)(`span`,{className:q.confirm,role:`group`,"aria-label":`Confirm delete`,children:[(0,V.jsx)(`span`,{className:q.confirmText,children:`Delete this chat?`}),(0,V.jsx)(`button`,{type:`button`,className:q.danger,disabled:w,onClick:async()=>{T(!0);try{await u()||ee(!1)}finally{T(!1)}},children:`Delete`}),(0,V.jsx)(`button`,{type:`button`,className:q.ghost,onClick:()=>ee(!1),children:`Keep`})]}):(0,V.jsx)(`button`,{type:`button`,className:q.ghostIcon,onClick:()=>ee(!0),disabled:!i||te,"aria-label":`Delete chat`,title:te?`Stop the turn before deleting`:`Delete chat`,children:(0,V.jsx)(oe,{})}):null,(0,V.jsx)(`span`,{className:q.actionDivider,"aria-hidden":`true`}),O]})]}),(0,V.jsx)(Tc,{transcript:t.transcript,loaded:t.loaded,loadError:t.loadError,onRetry:p}),v?(0,V.jsx)(kr,{sessionId:v.id,seats:n,seat:{seatId:v.seatId,model:v.model},engine:v.engine,running:te,disabled:!i,disabledReason:re,locked:a,hintSeen:v.turnCount>0,contextTokens:v.usage.contextTokens,contextWindow:j,onSend:s,onStop:c,onSeatChange:d,autoFocus:!0},v.id):null]})}function Mc({eyebrow:e,title:t}){return(0,V.jsxs)(`div`,{className:q.identity,children:[e,t]})}function Nc({collapsed:e,onToggle:t}){return(0,V.jsx)(`button`,{type:`button`,className:q.ghostIcon,onClick:t,"aria-pressed":!e,title:e?`Show chat list`:`Hide chat list`,"aria-label":e?`Show chat list`:`Chat list`,children:(0,V.jsx)(j,{})})}function Pc({open:e,onToggle:t}){return(0,V.jsx)(`button`,{type:`button`,className:q.ghostIcon,onClick:t,"aria-pressed":e,title:e?`Hide resources`:`Show resources`,"aria-label":`Resources`,children:(0,V.jsx)(te,{})})}var Fc={chat:`_chat_ei2ma_14`,main:`_main_ei2ma_44`,banner:`_banner_ei2ma_54`,bannerWarn:`_bannerWarn_ei2ma_55`,resize:`_resize_ei2ma_98`,scrim:`_scrim_ei2ma_12`},Ic=`ashlr.verse.selected.v1`;function Lc(){try{return localStorage.getItem(Ic)}catch{return null}}function Rc(e){return e instanceof f?"This server was started without dispatch — run `ashlr verse` to chat.":e instanceof v?e.status===409?`A turn is already running in this chat. Stop it first.`:e.status===413?`That message is too large (64 KB max).`:e.status===401?`Mutation token was rejected. Unlock again with the token ashlr verse printed.`:e.message:e instanceof Error?e.message:`Something went wrong.`}function zc(){let e=y(fe),t=y(Ce),n=d(Ce),r=d(fe),i=u(),a=C(),o=ce(),[s,l]=(0,z.useState)(Lc),[f,p]=(0,z.useState)(``),[m,g]=(0,z.useState)({open:!1}),[_,v]=(0,z.useState)(!1),[b,x]=(0,z.useState)(null),[S,w]=(0,z.useState)(!1),[T,E]=(0,z.useState)(0),[D,O]=(0,z.useState)({open:!1,reason:``}),k=(0,z.useRef)(null),te=(0,z.useRef)(null),j=hr(),M=(0,z.useMemo)(()=>e.data?.seats??[],[e.data]),ie=(0,z.useMemo)(()=>e.data?.projects??[],[e.data]),ae=y(we),P=(0,z.useMemo)(()=>ae.data?.workspaces??[],[ae.data]),oe=e.data?.dispatchEnabled??!0,F=Wn(s,T),le=(0,z.useMemo)(()=>{let n=t.data??e.data?.sessions??[];if(!F.session)return n;let r=F.session;return n.some(e=>e.id===r.id)?n.map(e=>e.id===r.id?r:e):[r,...n]},[t.data,e.data,F.session]),de=(0,z.useCallback)(e=>{l(e);try{e?localStorage.setItem(Ic,e):localStorage.removeItem(Ic)}catch{}},[]);(0,z.useEffect)(()=>{s&&t.data&&!t.data.some(e=>e.id===s)&&!F.session&&de(null)},[s,t.data,F.session,de]),(0,z.useEffect)(()=>Un(),[]);let pe=(0,z.useCallback)((e,t)=>i.hasHold?t():new Promise(n=>{k.current={run:()=>{t().then(n)},cancel:()=>n(null)},O({open:!0,reason:e})}),[i.hasHold]),me=(0,z.useCallback)(e=>{e instanceof xe||a.show(Rc(e),`danger`)},[a]),L=(0,z.useCallback)((e={})=>{x(null);let t=F.session,n=e.projectPath===void 0?t?.projectPath??null:e.projectPath,r=t&&n===t.projectPath?{seatId:t.seatId,model:t.model}:null,i=e.seat??r??N(n);g({open:!0,projectPath:n,seat:i})},[F.session]),ge=(0,z.useCallback)(async e=>{await pe(`Starting a chat spawns an agent process for this project.`,async()=>{v(!0),x(null);try{let t=await ye(e);ne(t.projectPath,{seatId:t.seatId,model:t.model}),_n(t.id,t),g({open:!1}),de(t.id),a.show(`Started “${t.title}”`,`success`)}catch(e){x(Rc(e))}finally{v(!1)}})},[pe,de,a]),_e=(0,z.useCallback)(async e=>{let t=s;return t?await pe(`Sending a message runs the agent against this project.`,async()=>{yn(t,`running`);try{let n=await ue(t,e);return _n(t,n.session,n.turnId),!0}catch(e){return yn(t,`idle`),me(e),!1}})===!0:!1},[s,pe,me]),ve=(0,z.useCallback)((e=s)=>{e&&pe(`Stopping the running turn.`,async()=>{try{await he(e)}catch(e){me(e)}})},[s,pe,me]),be=(0,z.useCallback)(async e=>{let t=s;return t?await pe(`Renaming a chat.`,async()=>{try{let n=await Se(t,e);return _n(t,n),!0}catch(e){return me(e),!1}})===!0:!1},[s,pe,me]),Te=(0,z.useCallback)(async()=>{let e=s;return e?await pe(`Deleting a chat removes its transcript from disk.`,async()=>{try{return await se(e),xn(e),c(e),de(null),a.show(`Chat deleted.`,`neutral`),!0}catch(e){return me(e),!1}})===!0:!1},[s,pe,me,de,a]),Ee=(0,z.useCallback)(e=>{let t=F.session;t&&(L({projectPath:t.projectPath,seat:e}),a.show(`Chats are bound to one seat — starting a new chat on the same project.`,`neutral`))},[F.session,L,a]),De=(0,z.useRef)(0);(0,z.useEffect)(()=>{let e=o.command;e&&e.nonce!==De.current&&(De.current=e.nonce,e.name===`quick-switcher`?w(!0):L(),I())},[o.command,F.session,L]);let Oe=e.data?!e.data.dispatchEnabled:!1,ke=o.resourcesOpen,Ae=o.sidebarCollapsed;(0,z.useEffect)(()=>{let e=te.current;if(!e)return;let t=()=>ur({containerWidth:e.clientWidth,sidebarVisible:!Ae,resourcesVisible:ke});t();let n=typeof ResizeObserver==`function`?new ResizeObserver(t):null;return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[Ae,ke]);let je={"--verse-sidebar-width":`${j.effective.sidebar}px`,"--verse-resources-width":`${j.effective.resources}px`};return(0,V.jsxs)(`div`,{ref:te,className:Fc.chat,style:je,"data-sidebar":Ae?`collapsed`:`open`,"data-resources":ke?`open`:`closed`,children:[(0,V.jsx)(Ln,{sessions:le,sessionsStatus:t.status,sessionsError:t.error?.message??null,projects:ie,seats:M,selectedId:s,query:f,onQuery:p,onSelect:e=>{de(e),window.matchMedia?.(`(max-width: 760px)`)?.matches===!0&&A(!0)},onNew:()=>L(),onRetry:()=>{n(),r()},onCollapse:()=>A(!0),onDisconnect:()=>{h()}}),Ae?null:(0,V.jsx)(vr,{side:`sidebar`,label:`Resize chat list`,className:Fc.resize}),(0,V.jsx)(`button`,{type:`button`,className:Fc.scrim,"aria-label":`Close chat list`,tabIndex:-1,onClick:()=>A(!0)}),(0,V.jsxs)(`div`,{className:Fc.main,children:[e.status===`error`&&!e.data?(0,V.jsxs)(`div`,{role:`alert`,className:Fc.banner,children:[(0,V.jsx)(`span`,{children:e.error?.message??`Could not load Verse.`}),(0,V.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`})]}):Oe?(0,V.jsxs)(`div`,{role:`status`,className:Fc.bannerWarn,children:[`Read-only: this server was started without dispatch. Run `,(0,V.jsx)(`code`,{children:`ashlr verse`}),` to send messages.`]}):null,(0,V.jsx)(jc,{view:F,seats:M,projects:ie,dispatchEnabled:oe,locked:!i.hasHold,hasAnySessions:le.length>0,onSend:_e,onStop:()=>ve(),onRename:be,onDelete:Te,onSeatChange:Ee,onNew:()=>L(),onRetry:()=>E(e=>e+1),sidebarCollapsed:Ae,onToggleSidebar:()=>A(!Ae),resourcesOpen:ke,onToggleResources:()=>re(!ke)})]}),ke?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(vr,{side:`resources`,label:`Resize resources panel`,className:Fc.resize}),(0,V.jsx)(Nn,{bootstrap:e.data,sessions:le,current:F.session,onStop:e=>ve(e),onOpen:de,onClose:()=>re(!1)})]}):null,(0,V.jsx)(Rt,{open:m.open,onClose:()=>g({open:!1}),projects:ie,seats:M,workspaces:P,initialProjectPath:m.projectPath??null,initialSeat:m.seat??null,busy:_,error:b,onCreate:ge}),(0,V.jsx)(Bt,{open:S,onClose:()=>w(!1),sessions:le,seats:M,projects:ie,onSelectSession:de,onNewChat:e=>L({projectPath:F.session?.projectPath??null,seat:e})}),(0,V.jsx)(ee,{open:D.open,reason:D.reason,tokenLabel:`Mutation token`,tokenHelp:`the mutation token ashlr verse printed`,onClose:()=>{O({open:!1,reason:``});let e=k.current;e&&setTimeout(()=>{k.current===e&&(k.current=null,e.cancel())},0)},onUnlocked:()=>{let e=k.current;k.current=null,e?.run()}})]})}export{zc as ChatSection};
|
|
80
|
+
//# sourceMappingURL=ChatSection-vNPIJffd.js.map
|