codesesh 0.18.0 → 0.19.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/README.md +4 -2
- package/dist/{chunk-HIYT2ZJL.js → chunk-G2BTNW3C.js} +1678 -217
- package/dist/chunk-G2BTNW3C.js.map +1 -0
- package/dist/{chunk-DHNP33L4.js → chunk-KD3DGWZY.js} +2 -2
- package/dist/{dist-DMGLFBW6.js → dist-ALXOBKV2.js} +14 -2
- package/dist/index.js +168 -43
- package/dist/index.js.map +1 -1
- package/dist/scan-refresh-worker.js +243 -24
- package/dist/scan-refresh-worker.js.map +1 -1
- package/dist/search-index-worker.js +2 -2
- package/dist/smart-tag-worker.js +2 -2
- package/dist/web/assets/{AgentIcon-DcUJM198.js → AgentIcon-CEj7HO1m.js} +1 -1
- package/dist/web/assets/BookmarkButton-DLEnIyeE.js +1 -0
- package/dist/web/assets/{Dashboard-wjTLT17d.js → Dashboard-DUG0IFcy.js} +2 -2
- package/dist/web/assets/DialogTitle-Dv6DQPIb.js +1 -0
- package/dist/web/assets/Projects-BMaZc6J5.js +1 -0
- package/dist/web/assets/SearchFilterBar-iP6pzlZo.js +1 -0
- package/dist/web/assets/SearchResultsPanel-RuiLPkbP.js +1 -0
- package/dist/web/assets/{SessionDetail-CgR7ipmi.js → SessionDetail-De1Wl3mu.js} +35 -35
- package/dist/web/assets/{index-DuB6tGoe.css → index-B-CV7pFu.css} +1 -1
- package/dist/web/assets/index-CQI8F_8X.js +1930 -0
- package/dist/web/assets/session-indexes-BuxBafvh.js +4 -0
- package/dist/web/index.html +7 -8
- package/package.json +1 -1
- package/dist/chunk-HIYT2ZJL.js.map +0 -1
- package/dist/web/assets/BookmarkButton-CJjTjyae.js +0 -1
- package/dist/web/assets/DialogTitle-Bz0eXTGu.js +0 -1
- package/dist/web/assets/Projects-DBxubQuM.js +0 -1
- package/dist/web/assets/SearchFilterBar-BG9ah_Po.js +0 -1
- package/dist/web/assets/SearchResultsPanel-Clmf2xKw.js +0 -1
- package/dist/web/assets/index-DR07vs5V.js +0 -1890
- package/dist/web/assets/preload-helper-CmKXJxR3.js +0 -1
- package/dist/web/assets/session-indexes-EHJdYE4j.js +0 -4
- /package/dist/{chunk-DHNP33L4.js.map → chunk-KD3DGWZY.js.map} +0 -0
- /package/dist/{dist-DMGLFBW6.js.map → dist-ALXOBKV2.js.map} +0 -0
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PrismHighlighter-C7OfXHq2.js","assets/jsx-runtime-n5LQ9ujS.js","assets/useTheme-CwDcVdGz.js","assets/index.dom-CCLJ9_FR.js","assets/InteractiveReceipt-xnRqJvfd.js","assets/session-title-CNhapdPJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,i as t,n,r,t as i}from"./jsx-runtime-n5LQ9ujS.js";import{$ as a,A as o,C as s,D as c,E as l,F as u,I as d,J as f,K as p,L as m,M as h,N as g,O as _,P as v,Q as y,S as b,V as x,W as S,Z as C,_ as w,b as T,et as E,f as ee,g as D,h as O,j as te,k as ne,l as k,m as A,nt as re,p as j,q as M,r as ie,rt as ae,s as oe,t as se,tt as ce,v as le,w as ue,x as de,y as fe}from"./AgentIcon-
|
|
3
|
-
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(!(e.charAt(0)!=`/`||e.charAt(1)!=`*`)){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Be=r((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(ze());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Ve=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),He=r(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Be()),r=Ve();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Ue=Ge(`end`),We=Ge(`start`);function Ge(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ke(e){let t=We(e),n=Ue(e);if(t&&n)return{start:t,end:n}}function qe(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ye(e.position):`start`in e||`end`in e?Ye(e):`line`in e||`column`in e?Je(e):``}function Je(e){return Xe(e&&e.line)+`:`+Xe(e&&e.column)}function Ye(e){return Je(e&&e.start)+`-`+Je(e&&e.end)}function Xe(e){return e&&typeof e==`number`?e:1}var N=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=qe(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};N.prototype.file=``,N.prototype.name=``,N.prototype.reason=``,N.prototype.message=``,N.prototype.stack=``,N.prototype.column=void 0,N.prototype.line=void 0,N.prototype.ancestors=void 0,N.prototype.cause=void 0,N.prototype.fatal=void 0,N.prototype.place=void 0,N.prototype.ruleId=void 0,N.prototype.source=void 0;var Ze=e(He(),1),Qe={}.hasOwnProperty,$e=new Map,et=/[A-Z]/g,tt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),nt=new Set([`td`,`th`]);function rt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=mt(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=pt(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Te:Ee,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=it(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function it(e,t,n){if(t.type===`element`)return at(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ot(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ct(e,t,n);if(t.type===`mdxjsEsm`)return st(e,t);if(t.type===`root`)return lt(e,t,n);if(t.type===`text`)return ut(e,t)}function at(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Te,e.schema=i),e.ancestors.push(t);let a=bt(e,t.tagName,!1),o=ht(e,t),s=_t(e,t);return tt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Ie(e)})),dt(e,o,a,t),ft(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ot(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}xt(e,t.position)}function st(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xt(e,t.position)}function ct(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Te,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:bt(e,t.name,!0),o=gt(e,t),s=_t(e,t);return dt(e,o,a,t),ft(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function lt(e,t,n){let r={};return ft(r,_t(e,t)),e.create(t,e.Fragment,r,n)}function ut(e,t){return t.value}function dt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ft(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function pt(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function mt(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=We(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ht(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Qe.call(t.properties,i)){let a=vt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&nt.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function gt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else xt(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else xt(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function _t(e,t){let n=[],r=-1,i=e.passKeys?new Map:$e;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=it(e,a,o);s!==void 0&&n.push(s)}return n}function vt(e,t,n){let r=Oe(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?De(n):ke(n)),r.property===`style`){let t=typeof n==`object`?n:yt(e,String(n));return e.stylePropertyNameCase===`css`&&(t=St(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Re[r.property]||r.property:r.attribute,n]}}function yt(e,t){try{return(0,Ze.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new N("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function bt(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Pe(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Pe(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Qe.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);xt(e)}function xt(e,t){let n=new N("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function St(e){let t={},n;for(n in e)Qe.call(e,n)&&(t[Ct(n)]=e[n]);return t}function Ct(e){let t=e.replace(et,wt);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function wt(e){return`-`+e.toLowerCase()}var Tt={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Et={};function Dt(e,t){let n=t||Et;return Ot(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Ot(e,t,n){if(At(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return kt(e.children,t,n)}return Array.isArray(e)?kt(e,t,n):``}function kt(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Ot(e[i],t,n);return r.join(``)}function At(e){return!!(e&&typeof e==`object`)}function P(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function F(e,t){return e.length>0?(P(e,e.length,0,t),e):t}var jt={}.hasOwnProperty;function Mt(e){let t={},n=-1;for(;++n<e.length;)Nt(t,e[n]);return t}function Nt(e,t){let n;for(n in t){let r=(jt.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){jt.call(r,a)||(r[a]=[]);let e=i[a];Pt(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Pt(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);P(e,0,0,r)}function Ft(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function It(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var I=Wt(/[A-Za-z]/),L=Wt(/[\dA-Za-z]/),Lt=Wt(/[#-'*+\--9=?A-Z^-~]/);function Rt(e){return e!==null&&(e<32||e===127)}var zt=Wt(/\d/),Bt=Wt(/[\dA-Fa-f]/),Vt=Wt(/[!-/:-@[-`{-~]/);function R(e){return e!==null&&e<-2}function z(e){return e!==null&&(e<0||e===32)}function B(e){return e===-2||e===-1||e===32}var Ht=Wt(/\p{P}|\p{S}/u),Ut=Wt(/\s/);function Wt(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Gt(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&L(e.charCodeAt(n+1))&&L(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function V(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return B(r)?(e.enter(n),s(r)):t(r)}function s(r){return B(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Kt={tokenize:qt};function qt(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),V(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return R(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Jt={tokenize:Xt},Yt={tokenize:Zt};function Xt(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return P(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yt,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Yt,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return R(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;P(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Zt(e,t,n){return V(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Qt(e){if(e===null||z(e)||Ut(e))return 1;if(Ht(e))return 2}function $t(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var en={name:`attention`,resolveAll:tn,tokenize:nn};function tn(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};rn(d,-c),rn(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=F(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=F(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=F(l,$t(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=F(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=F(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,P(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function nn(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qt(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Qt(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function rn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var an={name:`autolink`,tokenize:on};function on(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return I(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||L(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||L(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Rt(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Lt(t)?(e.consume(t),l):n(t)}function u(e){return L(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||L(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var sn={partial:!0,tokenize:cn};function cn(e,t,n){return r;function r(t){return B(t)?V(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||R(e)?t(e):n(e)}}var ln={continuation:{tokenize:dn},exit:fn,name:`blockQuote`,tokenize:un};function un(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return B(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function dn(e,t,n){let r=this;return i;function i(t){return B(t)?V(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ln,t,n)(r)}}function fn(e){e.exit(`blockQuote`)}var pn={name:`characterEscape`,tokenize:mn};function mn(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Vt(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var hn={name:`characterReference`,tokenize:gn};function gn(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=L,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Bt,u):(e.enter(`characterReferenceValue`),a=7,o=zt,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===L&&!Ae(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var _n={partial:!0,tokenize:bn},vn={concrete:!0,name:`codeFenced`,tokenize:yn};function yn(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),B(t)?V(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||R(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(_n,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||R(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):B(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),V(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||R(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||R(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&B(t)?V(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||R(t)?e.check(_n,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||R(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),B(t)?V(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),B(t)?V(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||R(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function bn(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var xn={name:`codeIndented`,tokenize:Cn},Sn={partial:!0,tokenize:wn};function Cn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),V(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):R(t)?e.attempt(Sn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||R(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function wn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):V(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):R(e)?i(e):n(e)}}var Tn={name:`codeText`,previous:Dn,resolve:En,tokenize:On};function En(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Dn(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function On(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||R(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var kn=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&An(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),An(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),An(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);An(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);An(this.left,t.reverse())}}};function An(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function jn(e){let t={},n=-1,r,i,a,o,s,c,l,u=new kn(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Mn(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return P(e,0,1/0,u.slice(0)),!l}function Mn(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Nn={resolve:Fn,tokenize:In},Pn={partial:!0,tokenize:Ln};function Fn(e){return jn(e),e}function In(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):R(t)?e.check(Pn,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Ln(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),V(e,a,`linePrefix`)}function a(i){if(i===null||R(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Rn(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Rt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||R(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||z(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Rt(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function zn(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):R(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||R(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!B(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Bn(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),V(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||R(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Vn(e,t){let n;return r;function r(i){return R(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):B(i)?V(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Hn={name:`definition`,tokenize:Wn},Un={partial:!0,tokenize:Gn};function Wn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return zn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=It(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return z(t)?Vn(e,l)(t):l(t)}function l(t){return Rn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Un,d,d)(t)}function d(t){return B(t)?V(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||R(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Gn(e,t,n){return r;function r(t){return z(t)?Vn(e,i)(t):n(t)}function i(t){return Bn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return B(t)?V(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||R(e)?t(e):n(e)}}var Kn={name:`hardBreakEscape`,tokenize:qn};function qn(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return R(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Jn={name:`headingAtx`,resolve:Yn,tokenize:Xn};function Yn(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},P(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Xn(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||z(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||R(n)?(e.exit(`atxHeading`),t(n)):B(n)?V(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||z(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Zn=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Qn=[`pre`,`script`,`style`,`textarea`],$n={concrete:!0,name:`htmlFlow`,resolveTo:nr,tokenize:rr},er={partial:!0,tokenize:ar},tr={partial:!0,tokenize:ir};function nr(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function rr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:M):I(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):I(a)?(e.consume(a),i=4,r.interrupt?t:M):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:M):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return I(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||z(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Qn.includes(l)?(i=1,r.interrupt?t(s):D(s)):Zn.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||L(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return B(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||I(t)?(e.consume(t),b):B(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||L(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):B(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):B(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||R(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||z(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||B(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||R(t)?D(t):B(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),k):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),ie):t===63&&i===3?(e.consume(t),M):t===93&&i===5?(e.consume(t),j):R(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(er,ae,O)(t)):t===null||R(t)?(e.exit(`htmlFlowData`),O(t)):(e.consume(t),D)}function O(t){return e.check(tr,te,ae)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||R(t)?O(t):(e.enter(`htmlFlowData`),D(t))}function k(t){return t===45?(e.consume(t),M):D(t)}function A(t){return t===47?(e.consume(t),o=``,re):D(t)}function re(t){if(t===62){let n=o.toLowerCase();return Qn.includes(n)?(e.consume(t),ie):D(t)}return I(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):D(t)}function j(t){return t===93?(e.consume(t),M):D(t)}function M(t){return t===62?(e.consume(t),ie):t===45&&i===2?(e.consume(t),M):D(t)}function ie(t){return t===null||R(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),ie)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function ir(e,t,n){let r=this;return i;function i(t){return R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ar(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(sn,t,n)}}var or={name:`htmlText`,tokenize:sr};function sr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):I(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):I(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):R(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?k(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):R(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?k(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?k(t):R(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):R(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?k(e):y(e)}function x(t){return I(t)?(e.consume(t),S):n(t)}function S(t){return t===45||L(t)?(e.consume(t),S):C(t)}function C(t){return R(t)?(o=C,A(t)):B(t)?(e.consume(t),C):k(t)}function w(t){return t===45||L(t)?(e.consume(t),w):t===47||t===62||z(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),k):t===58||t===95||I(t)?(e.consume(t),E):R(t)?(o=T,A(t)):B(t)?(e.consume(t),T):k(t)}function E(t){return t===45||t===46||t===58||t===95||L(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):R(t)?(o=ee,A(t)):B(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,O):R(t)?(o=D,A(t)):B(t)?(e.consume(t),D):(e.consume(t),te)}function O(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):R(t)?(o=O,A(t)):(e.consume(t),O)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||z(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||z(e)?T(e):n(e)}function k(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return B(t)?V(e,j,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):j(t)}function j(t){return e.enter(`htmlTextData`),o(t)}}var cr={name:`labelEnd`,resolveAll:fr,resolveTo:pr,tokenize:mr},lr={tokenize:hr},ur={tokenize:gr},dr={tokenize:_r};function fr(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&P(e,0,e.length,n),e}function pr(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=F(s,e.slice(a+1,a+r+3)),s=F(s,[[`enter`,u,t]]),s=F(s,$t(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=F(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=F(s,e.slice(o+1)),s=F(s,[[`exit`,c,t]]),P(e,a,e.length,s),e}function mr(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(It(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(lr,u,o?u:d)(t):t===91?e.attempt(ur,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(dr,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function hr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return z(t)?Vn(e,a)(t):a(t)}function a(t){return t===41?u(t):Rn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return z(t)?Vn(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Bn(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return z(t)?Vn(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function gr(e,t,n){let r=this;return i;function i(t){return zn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(It(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function _r(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var vr={name:`labelStartImage`,resolveAll:cr.resolveAll,tokenize:yr};function yr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var br={name:`labelStartLink`,resolveAll:cr.resolveAll,tokenize:xr};function xr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Sr={name:`lineEnding`,tokenize:Cr};function Cr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),V(e,t,`linePrefix`)}}var wr={name:`thematicBreak`,tokenize:Tr};function Tr(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||R(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),B(t)?V(e,s,`whitespace`)(t):s(t))}}var H={continuation:{tokenize:kr},exit:jr,name:`list`,tokenize:Or},Er={partial:!0,tokenize:Mr},Dr={partial:!0,tokenize:Ar};function Or(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:zt(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(wr,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return zt(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(sn,r.interrupt?n:u,e.attempt(Er,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return B(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function kr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(sn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,V(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!B(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Dr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,V(e,e.attempt(H,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ar(e,t,n){let r=this;return V(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function jr(e){e.exit(this.containerState.type)}function Mr(e,t,n){let r=this;return V(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!B(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Nr={name:`setextUnderline`,resolveTo:Pr,tokenize:Fr};function Pr(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Fr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),B(t)?V(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||R(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Ir={tokenize:Lr};function Lr(e){let t=this,n=e.attempt(sn,r,e.attempt(this.parser.constructs.flowInitial,i,V(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Nn,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Rr={resolveAll:Hr()},zr=Vr(`string`),Br=Vr(`text`);function Vr(e){return{resolveAll:Hr(e===`text`?Ur:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Hr(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Ur(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Wr=t({attentionMarkers:()=>Qr,contentInitial:()=>Kr,disable:()=>$r,document:()=>Gr,flow:()=>Jr,flowInitial:()=>qr,insideSpan:()=>Zr,string:()=>Yr,text:()=>Xr}),Gr={42:H,43:H,45:H,48:H,49:H,50:H,51:H,52:H,53:H,54:H,55:H,56:H,57:H,62:ln},Kr={91:Hn},qr={[-2]:xn,[-1]:xn,32:xn},Jr={35:Jn,42:wr,45:[Nr,wr],60:$n,61:Nr,95:wr,96:vn,126:vn},Yr={38:hn,92:pn},Xr={[-5]:Sr,[-4]:Sr,[-3]:Sr,33:vr,38:hn,42:en,60:[an,or],91:br,92:[Kn,pn],93:cr,95:en,96:Tn},Zr={null:[en,Rr]},Qr={null:[42,95]},$r={null:[]};function ei(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=F(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=$t(a,l.events,l),l.events):[]}function f(e,t){return ni(p(e),t)}function p(e){return ti(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){R(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&P(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ti(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function ni(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
2
|
+
import{a as e,i as t,n,r,t as i}from"./jsx-runtime-n5LQ9ujS.js";import{$ as a,A as o,C as s,D as c,E as l,F as u,I as d,J as f,K as p,L as m,M as h,N as g,O as _,P as v,Q as y,S as b,V as x,W as S,Z as C,_ as w,b as T,et as E,f as ee,g as D,h as O,j as te,k as ne,l as k,m as A,nt as re,p as j,q as M,r as ie,rt as ae,s as oe,t as se,tt as ce,v as le,w as ue,x as de,y as fe}from"./AgentIcon-CEj7HO1m.js";import{T as pe,g as me,o as he}from"./session-indexes-BuxBafvh.js";import{Cn as ge,Sn as _e,Tn as ve,dn as ye,i as be,jt as xe,n as Se,s as Ce,t as we,wn as Te}from"./DialogTitle-Dv6DQPIb.js";import{t as Ee}from"./utils-B6KiDbIe.js";import{a as De,i as Oe,l as ke,o as Ae,r as je,t as Me}from"./index.dom-CCLJ9_FR.js";var Ne=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Fe={};function Ie(e,t){return((t||Fe).jsx?Pe:Ne).test(e)}var Le=/[ \t\n\f\r]/g;function Re(e){return typeof e==`object`?e.type===`text`&&ze(e.value):ze(e)}function ze(e){return e.replace(Le,``)===``}var Be={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ve=r(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
3
|
+
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(!(e.charAt(0)!=`/`||e.charAt(1)!=`*`)){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),He=r((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ve());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Ue=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),We=r(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(He()),r=Ue();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Ge=qe(`end`),Ke=qe(`start`);function qe(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Je(e){let t=Ke(e),n=Ge(e);if(t&&n)return{start:t,end:n}}function Ye(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ze(e.position):`start`in e||`end`in e?Ze(e):`line`in e||`column`in e?Xe(e):``}function Xe(e){return Qe(e&&e.line)+`:`+Qe(e&&e.column)}function Ze(e){return Xe(e&&e.start)+`-`+Xe(e&&e.end)}function Qe(e){return e&&typeof e==`number`?e:1}var N=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ye(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};N.prototype.file=``,N.prototype.name=``,N.prototype.reason=``,N.prototype.message=``,N.prototype.stack=``,N.prototype.column=void 0,N.prototype.line=void 0,N.prototype.ancestors=void 0,N.prototype.cause=void 0,N.prototype.fatal=void 0,N.prototype.place=void 0,N.prototype.ruleId=void 0,N.prototype.source=void 0;var $e=e(We(),1),et={}.hasOwnProperty,tt=new Map,nt=/[A-Z]/g,rt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),it=new Set([`td`,`th`]);function at(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=gt(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ht(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?De:Oe,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ot(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ot(e,t,n){if(t.type===`element`)return st(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ct(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ut(e,t,n);if(t.type===`mdxjsEsm`)return lt(e,t);if(t.type===`root`)return dt(e,t,n);if(t.type===`text`)return ft(e,t)}function st(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=De,e.schema=i),e.ancestors.push(t);let a=St(e,t.tagName,!1),o=_t(e,t),s=yt(e,t);return rt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Re(e)})),pt(e,o,a,t),mt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ct(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ct(e,t.position)}function lt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ct(e,t.position)}function ut(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=De,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:St(e,t.name,!0),o=vt(e,t),s=yt(e,t);return pt(e,o,a,t),mt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function dt(e,t,n){let r={};return mt(r,yt(e,t)),e.create(t,e.Fragment,r,n)}function ft(e,t){return t.value}function pt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function mt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ht(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function gt(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ke(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function _t(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&et.call(t.properties,i)){let a=bt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&it.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function vt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ct(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ct(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function yt(e,t){let n=[],r=-1,i=e.passKeys?new Map:tt;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=ot(e,a,o);s!==void 0&&n.push(s)}return n}function bt(e,t,n){let r=Ae(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ke(n):je(n)),r.property===`style`){let t=typeof n==`object`?n:xt(e,String(n));return e.stylePropertyNameCase===`css`&&(t=wt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Be[r.property]||r.property:r.attribute,n]}}function xt(e,t){try{return(0,$e.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new N("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function St(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Ie(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Ie(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return et.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ct(e)}function Ct(e,t){let n=new N("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function wt(e){let t={},n;for(n in e)et.call(e,n)&&(t[Tt(n)]=e[n]);return t}function Tt(e){let t=e.replace(nt,Et);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Et(e){return`-`+e.toLowerCase()}var Dt={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Ot={};function kt(e,t){let n=t||Ot;return At(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function At(e,t,n){if(Mt(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return jt(e.children,t,n)}return Array.isArray(e)?jt(e,t,n):``}function jt(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=At(e[i],t,n);return r.join(``)}function Mt(e){return!!(e&&typeof e==`object`)}function P(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function F(e,t){return e.length>0?(P(e,e.length,0,t),e):t}var Nt={}.hasOwnProperty;function Pt(e){let t={},n=-1;for(;++n<e.length;)Ft(t,e[n]);return t}function Ft(e,t){let n;for(n in t){let r=(Nt.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Nt.call(r,a)||(r[a]=[]);let e=i[a];It(r[a],Array.isArray(e)?e:e?[e]:[])}}}function It(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);P(e,0,0,r)}function Lt(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Rt(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var I=Kt(/[A-Za-z]/),L=Kt(/[\dA-Za-z]/),zt=Kt(/[#-'*+\--9=?A-Z^-~]/);function Bt(e){return e!==null&&(e<32||e===127)}var Vt=Kt(/\d/),Ht=Kt(/[\dA-Fa-f]/),Ut=Kt(/[!-/:-@[-`{-~]/);function R(e){return e!==null&&e<-2}function z(e){return e!==null&&(e<0||e===32)}function B(e){return e===-2||e===-1||e===32}var Wt=Kt(/\p{P}|\p{S}/u),Gt=Kt(/\s/);function Kt(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function qt(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&L(e.charCodeAt(n+1))&&L(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function V(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return B(r)?(e.enter(n),s(r)):t(r)}function s(r){return B(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Jt={tokenize:Yt};function Yt(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),V(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return R(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Xt={tokenize:Qt},Zt={tokenize:$t};function Qt(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return P(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zt,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Zt,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return R(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;P(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function $t(e,t,n){return V(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function en(e){if(e===null||z(e)||Gt(e))return 1;if(Wt(e))return 2}function tn(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var nn={name:`attention`,resolveAll:rn,tokenize:an};function rn(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};on(d,-c),on(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=F(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=F(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=F(l,tn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=F(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=F(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,P(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function an(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=en(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=en(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function on(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var sn={name:`autolink`,tokenize:cn};function cn(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return I(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||L(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||L(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Bt(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):zt(t)?(e.consume(t),l):n(t)}function u(e){return L(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||L(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var ln={partial:!0,tokenize:un};function un(e,t,n){return r;function r(t){return B(t)?V(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||R(e)?t(e):n(e)}}var dn={continuation:{tokenize:pn},exit:mn,name:`blockQuote`,tokenize:fn};function fn(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return B(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function pn(e,t,n){let r=this;return i;function i(t){return B(t)?V(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(dn,t,n)(r)}}function mn(e){e.exit(`blockQuote`)}var hn={name:`characterEscape`,tokenize:gn};function gn(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Ut(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var _n={name:`characterReference`,tokenize:vn};function vn(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=L,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Ht,u):(e.enter(`characterReferenceValue`),a=7,o=Vt,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===L&&!Me(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var yn={partial:!0,tokenize:Sn},bn={concrete:!0,name:`codeFenced`,tokenize:xn};function xn(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),B(t)?V(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||R(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(yn,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||R(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):B(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),V(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||R(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||R(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&B(t)?V(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||R(t)?e.check(yn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||R(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),B(t)?V(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),B(t)?V(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||R(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Sn(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Cn={name:`codeIndented`,tokenize:Tn},wn={partial:!0,tokenize:En};function Tn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),V(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):R(t)?e.attempt(wn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||R(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function En(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):V(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):R(e)?i(e):n(e)}}var Dn={name:`codeText`,previous:kn,resolve:On,tokenize:An};function On(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function kn(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function An(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||R(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var jn=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Mn(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Mn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Mn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Mn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Mn(this.left,t.reverse())}}};function Mn(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Nn(e){let t={},n=-1,r,i,a,o,s,c,l,u=new jn(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Pn(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return P(e,0,1/0,u.slice(0)),!l}function Pn(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Fn={resolve:Ln,tokenize:Rn},In={partial:!0,tokenize:zn};function Ln(e){return Nn(e),e}function Rn(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):R(t)?e.check(In,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function zn(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),V(e,a,`linePrefix`)}function a(i){if(i===null||R(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Bn(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Bt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||R(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||z(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Bt(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Vn(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):R(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||R(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!B(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Hn(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),V(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||R(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Un(e,t){let n;return r;function r(i){return R(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):B(i)?V(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Wn={name:`definition`,tokenize:Kn},Gn={partial:!0,tokenize:qn};function Kn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Vn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Rt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return z(t)?Un(e,l)(t):l(t)}function l(t){return Bn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Gn,d,d)(t)}function d(t){return B(t)?V(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||R(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function qn(e,t,n){return r;function r(t){return z(t)?Un(e,i)(t):n(t)}function i(t){return Hn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return B(t)?V(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||R(e)?t(e):n(e)}}var Jn={name:`hardBreakEscape`,tokenize:Yn};function Yn(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return R(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Xn={name:`headingAtx`,resolve:Zn,tokenize:Qn};function Zn(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},P(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Qn(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||z(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||R(n)?(e.exit(`atxHeading`),t(n)):B(n)?V(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||z(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var $n=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),er=[`pre`,`script`,`style`,`textarea`],tr={concrete:!0,name:`htmlFlow`,resolveTo:ir,tokenize:ar},nr={partial:!0,tokenize:sr},rr={partial:!0,tokenize:or};function ir(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ar(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:M):I(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):I(a)?(e.consume(a),i=4,r.interrupt?t:M):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:M):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return I(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||z(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&er.includes(l)?(i=1,r.interrupt?t(s):D(s)):$n.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||L(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return B(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||I(t)?(e.consume(t),b):B(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||L(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):B(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):B(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||R(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||z(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||B(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||R(t)?D(t):B(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),k):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),ie):t===63&&i===3?(e.consume(t),M):t===93&&i===5?(e.consume(t),j):R(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(nr,ae,O)(t)):t===null||R(t)?(e.exit(`htmlFlowData`),O(t)):(e.consume(t),D)}function O(t){return e.check(rr,te,ae)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||R(t)?O(t):(e.enter(`htmlFlowData`),D(t))}function k(t){return t===45?(e.consume(t),M):D(t)}function A(t){return t===47?(e.consume(t),o=``,re):D(t)}function re(t){if(t===62){let n=o.toLowerCase();return er.includes(n)?(e.consume(t),ie):D(t)}return I(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):D(t)}function j(t){return t===93?(e.consume(t),M):D(t)}function M(t){return t===62?(e.consume(t),ie):t===45&&i===2?(e.consume(t),M):D(t)}function ie(t){return t===null||R(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),ie)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function or(e,t,n){let r=this;return i;function i(t){return R(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function sr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(ln,t,n)}}var cr={name:`htmlText`,tokenize:lr};function lr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):I(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):I(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):R(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?k(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):R(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?k(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?k(t):R(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):R(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?k(e):y(e)}function x(t){return I(t)?(e.consume(t),S):n(t)}function S(t){return t===45||L(t)?(e.consume(t),S):C(t)}function C(t){return R(t)?(o=C,A(t)):B(t)?(e.consume(t),C):k(t)}function w(t){return t===45||L(t)?(e.consume(t),w):t===47||t===62||z(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),k):t===58||t===95||I(t)?(e.consume(t),E):R(t)?(o=T,A(t)):B(t)?(e.consume(t),T):k(t)}function E(t){return t===45||t===46||t===58||t===95||L(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):R(t)?(o=ee,A(t)):B(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,O):R(t)?(o=D,A(t)):B(t)?(e.consume(t),D):(e.consume(t),te)}function O(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):R(t)?(o=O,A(t)):(e.consume(t),O)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||z(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||z(e)?T(e):n(e)}function k(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return B(t)?V(e,j,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):j(t)}function j(t){return e.enter(`htmlTextData`),o(t)}}var ur={name:`labelEnd`,resolveAll:mr,resolveTo:hr,tokenize:gr},dr={tokenize:_r},fr={tokenize:vr},pr={tokenize:yr};function mr(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&P(e,0,e.length,n),e}function hr(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=F(s,e.slice(a+1,a+r+3)),s=F(s,[[`enter`,u,t]]),s=F(s,tn(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=F(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=F(s,e.slice(o+1)),s=F(s,[[`exit`,c,t]]),P(e,a,e.length,s),e}function gr(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Rt(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(dr,u,o?u:d)(t):t===91?e.attempt(fr,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(pr,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function _r(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return z(t)?Un(e,a)(t):a(t)}function a(t){return t===41?u(t):Bn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return z(t)?Un(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Hn(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return z(t)?Un(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function vr(e,t,n){let r=this;return i;function i(t){return Vn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Rt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function yr(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var br={name:`labelStartImage`,resolveAll:ur.resolveAll,tokenize:xr};function xr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Sr={name:`labelStartLink`,resolveAll:ur.resolveAll,tokenize:Cr};function Cr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var wr={name:`lineEnding`,tokenize:Tr};function Tr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),V(e,t,`linePrefix`)}}var Er={name:`thematicBreak`,tokenize:Dr};function Dr(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||R(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),B(t)?V(e,s,`whitespace`)(t):s(t))}}var H={continuation:{tokenize:jr},exit:Nr,name:`list`,tokenize:Ar},Or={partial:!0,tokenize:Pr},kr={partial:!0,tokenize:Mr};function Ar(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Vt(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Er,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Vt(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(ln,r.interrupt?n:u,e.attempt(Or,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return B(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function jr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ln,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,V(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!B(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(kr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,V(e,e.attempt(H,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Mr(e,t,n){let r=this;return V(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Nr(e){e.exit(this.containerState.type)}function Pr(e,t,n){let r=this;return V(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!B(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Fr={name:`setextUnderline`,resolveTo:Ir,tokenize:Lr};function Ir(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Lr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),B(t)?V(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||R(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Rr={tokenize:zr};function zr(e){let t=this,n=e.attempt(ln,r,e.attempt(this.parser.constructs.flowInitial,i,V(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Fn,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Br={resolveAll:Wr()},Vr=Ur(`string`),Hr=Ur(`text`);function Ur(e){return{resolveAll:Wr(e===`text`?Gr:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Wr(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Gr(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Kr=t({attentionMarkers:()=>ei,contentInitial:()=>Jr,disable:()=>ti,document:()=>qr,flow:()=>Xr,flowInitial:()=>Yr,insideSpan:()=>$r,string:()=>Zr,text:()=>Qr}),qr={42:H,43:H,45:H,48:H,49:H,50:H,51:H,52:H,53:H,54:H,55:H,56:H,57:H,62:dn},Jr={91:Wn},Yr={[-2]:Cn,[-1]:Cn,32:Cn},Xr={35:Xn,42:Er,45:[Fr,Er],60:tr,61:Fr,95:Er,96:bn,126:bn},Zr={38:_n,92:hn},Qr={[-5]:wr,[-4]:wr,[-3]:wr,33:br,38:_n,42:nn,60:[sn,cr],91:Sr,92:[Jn,hn],93:ur,95:nn,96:Dn},$r={null:[nn,Br]},ei={null:[42,95]},ti={null:[]};function ni(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=F(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=tn(a,l.events,l),l.events):[]}function f(e,t){return ii(p(e),t)}function p(e){return ri(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){R(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&P(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ri(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function ii(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
4
4
|
`;break;case-3:o=`\r
|
|
5
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function ri(e){let t={constructs:Mt([Wr,...(e||{}).extensions||[]]),content:n(Kt),defined:[],document:n(Jt),flow:n(Ir),lazy:{},string:n(zr),text:n(Br)};return t;function n(e){return n;function n(n){return ei(t,e,n)}}}function ii(e){for(;!jn(e););return e}var ai=/[\0\t\n\r]/g;function oi(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(ai.lastIndex=u,c=ai.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var si=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ci(e){return e.replace(si,li)}function li(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ft(n.slice(t?2:1),t?16:10)}return Ae(n)||e}var ui={}.hasOwnProperty;function di(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),fi(n)(ii(ri(n).document().write(oi()(e,t,!0))))}function fi(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ve),blockQuote:a(pe),characterEscape:T,characterReference:T,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:T,htmlText:a(be,o),htmlTextData:T,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:oe,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(O),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(A),label:j,labelText:re,lineEnding:ee,link:c(k),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:M,resourceTitleString:ie,resource:ae,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};mi(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];ui.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||gi).call(a,void 0,e[0])}for(r.position={start:pi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:pi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:pi(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||gi).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+qe({start:e.start,end:e.end})+`): it’s not open`);n.position.end=pi(e.end)}function u(){return Dt(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=It(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=De(),n.position={start:pi(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=pi(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=pi(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function O(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ci(t),n.identifier=It(t).toLowerCase()}function j(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=It(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ft(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ae(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=pi(e.end)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function pi(e){return{line:e.line,column:e.column,offset:e.offset}}function mi(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?mi(e,r):hi(e,r)}}function hi(e,t){let n;for(n in t)if(ui.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function gi(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+qe({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qe({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+qe({start:t.start,end:t.end})+`) is still open`)}function _i(e){let t=this;t.parser=n;function n(n){return di(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function vi(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function yi(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
6
|
-
`}]}function
|
|
7
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function
|
|
5
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function ai(e){let t={constructs:Pt([Kr,...(e||{}).extensions||[]]),content:n(Jt),defined:[],document:n(Xt),flow:n(Rr),lazy:{},string:n(Vr),text:n(Hr)};return t;function n(e){return n;function n(n){return ni(t,e,n)}}}function oi(e){for(;!Nn(e););return e}var si=/[\0\t\n\r]/g;function ci(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(si.lastIndex=u,c=si.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var li=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ui(e){return e.replace(li,di)}function di(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Lt(n.slice(t?2:1),t?16:10)}return Me(n)||e}var fi={}.hasOwnProperty;function pi(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),mi(n)(oi(ai(n).document().write(ci()(e,t,!0))))}function mi(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ve),blockQuote:a(pe),characterEscape:T,characterReference:T,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:T,htmlText:a(be,o),htmlTextData:T,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:oe,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(O),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(A),label:j,labelText:re,lineEnding:ee,link:c(k),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:M,resourceTitleString:ie,resource:ae,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};gi(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];fi.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||vi).call(a,void 0,e[0])}for(r.position={start:hi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:hi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:hi(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||vi).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Ye({start:e.start,end:e.end})+`): it’s not open`);n.position.end=hi(e.end)}function u(){return kt(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Rt(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=De(),n.position={start:hi(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=hi(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=hi(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function O(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ui(t),n.identifier=Rt(t).toLowerCase()}function j(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Rt(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Lt(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Me(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=hi(e.end)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function hi(e){return{line:e.line,column:e.column,offset:e.offset}}function gi(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?gi(e,r):_i(e,r)}}function _i(e,t){let n;for(n in t)if(fi.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function vi(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Ye({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ye({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Ye({start:t.start,end:t.end})+`) is still open`)}function yi(e){let t=this;t.parser=n;function n(n){return pi(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function bi(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xi(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
6
|
+
`}]}function Si(e,t){let n=t.value?t.value+`
|
|
7
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Ci(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wi(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ti(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=qt(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Ei(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Di(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Oi(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function ki(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Oi(e,t);let i={src:qt(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Ai(e,t){let n={src:qt(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ji(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Mi(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Oi(e,t);let i={href:qt(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Ni(e,t){let n={href:qt(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Pi(e,t,n){let r=e.all(t),i=n?Fi(n):Ii(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
8
8
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
9
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function
|
|
9
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Fi(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Ii(n[r])}return t}function Ii(e){return e.spread??e.children.length>1}function Li(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Ri(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zi(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Bi(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Vi(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Ke(t.children[1]),o=Ge(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Hi(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Ui(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Wi=9,Gi=32;function Ki(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(qi(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(qi(t.slice(i),i>0,!1)),a.join(``)}function qi(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Wi||t===Gi;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Wi||t===Gi;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Ji(e,t){let n={type:`text`,value:Ki(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Yi(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Xi={blockquote:bi,break:xi,code:Si,delete:Ci,emphasis:wi,footnoteReference:Ti,heading:Ei,html:Di,imageReference:ki,image:Ai,inlineCode:ji,linkReference:Mi,link:Ni,listItem:Pi,list:Li,paragraph:Ri,root:zi,strong:Bi,table:Vi,tableCell:Ui,tableRow:Hi,text:Ji,thematicBreak:Yi,toml:Zi,yaml:Zi,definition:Zi,footnoteDefinition:Zi};function Zi(){}var Qi=typeof self==`object`?self:globalThis,$i=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new Qi[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new Qi[a](o),i)};return r},ea=e=>$i(new Map,e)(0),ta=``,{toString:na}={},{keys:ra}=Object,ia=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=na.call(e).slice(8,-1);switch(n){case`Array`:return[1,ta];case`Object`:return[2,ta];case`Date`:return[3,ta];case`RegExp`:return[4,ta];case`Map`:return[5,ta];case`Set`:return[6,ta];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},aa=([e,t])=>e===0&&(t===`function`||t===`symbol`),oa=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=ia(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of ra(r))(e||!aa(ia(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(aa(ia(n))||aa(ia(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!aa(ia(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},sa=(e,{json:t,lossy:n}={})=>{let r=[];return oa(!(t||n),!!t,new Map,r)(e),r},ca=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?ea(sa(e,t)):structuredClone(e):(e,t)=>ea(sa(e,t));function la(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function ua(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function da(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||la,r=e.options.footnoteBackLabel||ua,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=qt(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...ca(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
10
10
|
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
11
|
-
`}]}}var
|
|
11
|
+
`}]}}var fa=(function(e){if(e==null)return _a;if(typeof e==`function`)return ga(e);if(typeof e==`object`)return Array.isArray(e)?pa(e):ma(e);if(typeof e==`string`)return ha(e);throw Error(`Expected function, string, or object as test`)});function pa(e){let t=[],n=-1;for(;++n<e.length;)t[n]=fa(e[n]);return ga(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function ma(e){let t=e;return ga(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ha(e){return ga(t);function t(t){return t&&t.type===e}}function ga(e){return t;function t(t,n,r){return!!(va(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function _a(){return!0}function va(e){return typeof e==`object`&&!!e&&`type`in e}function ya(e){return e}var ba=[];function xa(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=fa(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+ya(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=ba,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Sa(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Sa(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?ba:[e]}function Ca(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),xa(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var wa={}.hasOwnProperty,Ta={};function Ea(e,t){let n=t||Ta,r=new Map,i=new Map,a={all:s,applyData:Oa,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Xi,...n.handlers},one:o,options:n,patch:Da,wrap:Aa};return Ca(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(wa.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=ca(n);return r.children=a.all(e),r}return ca(e)}return(a.options.unknownHandler||ka)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=ja(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=ja(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Da(e,t){e.position&&(t.position=Je(e))}function Oa(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,ca(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function ka(e,t){let n=t.data||{},r=`value`in t&&!(wa.call(n,`hProperties`)||wa.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Aa(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
12
12
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
13
13
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
14
|
-
`}),n}function
|
|
15
|
-
`},i)),a}function ja(e,t){return e&&`run`in e?async function(n,r){let i=Aa(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Aa(n,{file:r,...e||t})}}function Ma(e){if(e)throw e}var Na=r(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Pa(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Fa(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Ia(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Ia(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var U={basename:La,dirname:Ra,extname:za,join:Ba,sep:`/`};function La(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Ua(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Ra(e){if(Ua(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function za(e){Ua(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Ba(...e){let t=-1,n;for(;++t<e.length;)Ua(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Va(n)}function Va(e){Ua(e);let t=e.codePointAt(0)===47,n=Ha(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Ha(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ua(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Wa={cwd:Ga};function Ga(){return`/`}function Ka(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function qa(e){if(typeof e==`string`)e=new URL(e);else if(!Ka(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Ja(e)}function Ja(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Ya=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Xa=class{constructor(e){let t;t=e?Ka(e)?{path:e}:typeof e==`string`||eo(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Wa.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Ya.length;){let e=Ya[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Ya.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?U.basename(this.path):void 0}set basename(e){Qa(e,`basename`),Za(e,`basename`),this.path=U.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?U.dirname(this.path):void 0}set dirname(e){$a(this.basename,`dirname`),this.path=U.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?U.extname(this.path):void 0}set extname(e){if(Za(e,`extname`),$a(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=U.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ka(e)&&(e=qa(e)),Qa(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?U.basename(this.path,this.extname):void 0}set stem(e){Qa(e,`stem`),Za(e,`stem`),this.path=U.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new N(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Za(e,t){if(e&&e.includes(U.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+U.sep+"`")}function Qa(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function $a(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function eo(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var to=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),no=e(Na(),1),ro={}.hasOwnProperty,io=new class e extends to{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Fa()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,no.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(so(`data`,this.frozen),this.namespace[e]=t,this):ro.call(this.namespace,e)&&this.namespace[e]||void 0:e?(so(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=uo(e),n=this.parser||this.Parser;return ao(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),ao(`process`,this.parser||this.Parser),oo(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=uo(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);po(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),ao(`processSync`,this.parser||this.Parser),oo(`processSync`,this.compiler||this.Compiler),this.process(e,r),lo(`processSync`,`process`,t),n;function r(e,r){t=!0,Ma(e),n=r}}run(e,t,n){co(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=uo(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),lo(`runSync`,`run`,n),r;function i(e,t){Ma(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=uo(t),r=this.compiler||this.Compiler;return oo(`stringify`,r),co(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(so(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,no.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Pa(o)&&Pa(r)&&(r=(0,no.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function ao(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function oo(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function so(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function co(e){if(!Pa(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function lo(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function uo(e){return fo(e)?e:new Xa(e)}function fo(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function po(e){return typeof e==`string`||mo(e)}function mo(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var W=i(),G=e(n(),1),ho=[],go={allowDangerousHtml:!0},_o=/^(https?|ircs?|mailto|xmpp)$/i,vo=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function yo(e){let t=bo(e),n=xo(e);return So(t.runSync(t.parse(n),n),e)}function bo(e){let t=e.rehypePlugins||ho,n=e.remarkPlugins||ho,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...go}:go;return io().use(_i).use(n).use(ja,r).use(t)}function xo(e){let t=e.children||``,n=new Xa;return typeof t==`string`?n.value=t:``+t,n}function So(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Co;for(let e of vo)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return xa(e,l),rt(e,{Fragment:W.Fragment,components:i,ignoreInvalidStyle:!0,jsx:W.jsx,jsxs:W.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Tt)if(Object.hasOwn(Tt,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Tt[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Co(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||_o.test(e.slice(0,t))?e:``}var wo=12*1024*1024,To=/^data:image\/[a-z0-9.+-]+(?:;[a-z0-9-]+=[^,;]*)*(?:;base64)?,/i;function Eo(){return typeof window>`u`?null:window.location.origin}function Do(e){let t=Eo();try{return t?new URL(e,t):new URL(e)}catch{return null}}function Oo(e){return To.test(e)?e.length<=wo:!1}function ko(e){let t=e?.trim();if(!t)return null;if(Oo(t))return t;let n=Do(t);if(!n||n.protocol!==`http:`&&n.protocol!==`https:`)return null;let r=Eo();return r&&n.origin===r?n.href:null}function Ao(e,t){return!e.startsWith(`image/`)||!t?null:ko(`data:${e};base64,${t}`)}var jo={a:({children:e})=>(0,W.jsx)(`span`,{className:`console-markdown-link`,children:e}),img:({src:e,alt:t,title:n})=>{let r=ko(typeof e==`string`?e:void 0);return r?(0,W.jsx)(`img`,{src:r,alt:t??``,title:n,loading:`lazy`,className:`max-h-[520px] max-w-full object-contain`}):(0,W.jsxs)(`span`,{className:`console-mono inline-block rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`Remote image not loaded`,t?`: ${t}`:``]})}};function Mo(e){return ko(e)??``}var No=new Set([`code`,`pre`,`mark`]);function Po(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Fo(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map(Po).join(`|`)})`,`gi`)}function Io(e,t){let n=[],r=0;for(let i of e.matchAll(t)){let t=i.index??0,a=i[0]??``;a&&(t>r&&n.push({type:`text`,value:e.slice(r,t)}),n.push({type:`element`,tagName:`mark`,properties:{},children:[{type:`text`,value:a}]}),r=t+a.length)}return n.length===0?null:(r<e.length&&n.push({type:`text`,value:e.slice(r)}),n)}function Lo(e,t){if(!e.children)return;let n=[],r=!1;for(let i of e.children){if(i.type===`text`){let e=Io(i.value??``,t);if(e){n.push(...e),r=!0;continue}}else i.tagName&&No.has(i.tagName)||Lo(i,t);n.push(i)}r&&(e.children=n)}function Ro(e){return t=>Lo(t,e)}var zo=(0,G.memo)(function({text:e,highlightQuery:t}){let n=(0,G.useMemo)(()=>{let e=Fo(t);return e?[[Ro,e]]:void 0},[t]);return(0,W.jsx)(`div`,{children:(0,W.jsx)(yo,{components:jo,rehypePlugins:n,urlTransform:Mo,children:e})})});function Bo(e){let t=[];for(let n of e){if(n.type===`image`)continue;if(n.type===`plan`){t.push({type:`plan`,parts:[n]});continue}if(n.type!==`tool`&&!n.text.trim())continue;let e=t.at(-1);if(n.type===`text`){e?.type===`text`?e.parts.push(n):t.push({type:`text`,parts:[n]});continue}if(n.type===`reasoning`){e?.type===`reasoning`?e.parts.push(n):t.push({type:`reasoning`,parts:[n]});continue}e?.type===`tool`?e.parts.push(n):t.push({type:`tool`,parts:[n]})}return t}function Vo(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Ho(e){return typeof e==`string`?e:``}function Uo(e){return e.replace(/\\n/g,`
|
|
16
|
-
`)}function
|
|
17
|
-
`)}function
|
|
18
|
-
`)}function
|
|
19
|
-
`)||/^[a-z]+:\/\//i.test(t)||/[<>{}]/.test(t)?!1:t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`~/`)||t.includes(`/`)||t.includes(`\\`)?!0:/^[A-Za-z0-9_.@-]+\.[A-Za-z0-9_-]+$/.test(t)}function vs(e){let t=e.trim().toLowerCase();return!t||t.includes(`command`)||t.includes(`content`)||t.includes(`text`)||t.includes(`prompt`)||t.includes(`url`)||t.includes(`body`)||t.includes(`title`)||t.includes(`description`)||t===`cwd`||t===`workdir`||t===`directory`?!1:t===`path`||t===`paths`||t.includes(`file`)||t.includes(`path`)}function ys(e,t,n,r=0){if(!(e==null||r>4)){if(typeof e==`string`){vs(t)&&_s(e)&&n.add(e.trim());return}if(Array.isArray(e)){for(let i of e)ys(i,t,n,r+1);return}if(typeof e==`object`)for(let[t,i]of Object.entries(e))ys(i,t,n,r+1)}}function bs(e){let t=new Set;return ys(e,``,t),[...t]}function xs(e){return e.state.input??null}function Ss(e){let t=K(e);return q(t.filePath)||q(t.file_path)||q(t.path)||q(t.targetFile)||q(t.effectiveUri)||q(t.relativeWorkspacePath)||``}function Z(e,t){let n=e.trim(),r=(t??``).replace(/\/+$/,``);return!n||!r?n:n===r?`.`:n.startsWith(`${r}/`)?n.slice(r.length+1):n}function Cs(e,t){let n=(t??``).replace(/\/+$/,``);return!e||!n?e:e.replace(RegExp(`${Zo(n)}(?=$|/|[\\s"'\\)\\]}:;,])`,`g`),`.`)}function ws(e,t){return e.startsWith(`${t}/`)?e.slice(t.length+1):e}var Ts=new Set([`read`,`read_file`,`read_file_v2`,`read_text_file`,`readfile`,`view_image`]),Es=new Set([`apply_patch`,`edit`,`edit_file`,`edit_file_v2`,`editfile`,`multiedit`,`notebookedit`,`patch`,`search_replace`,`str_replace`]),Ds=new Set([`create_file`,`write`,`write_file`,`writefile`]),Os=new Set([`delete`,`delete_file`]);function ks(e,t){return`tool-${e}-${t}`}function As(e){let t=ds(e);return Ts.has(t)?`read`:Es.has(t)?`edit`:Ds.has(t)?`write`:Os.has(t)?`delete`:null}function js(e){let t=new Map;for(let n of e){let e=t.get(n.path);if(e){e.count+=1,e.anchors.push({anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}),n.time>=e.latestTime&&(e.latestTime=n.time,e.latestAnchorId=n.anchorId,e.toolLabel=n.toolLabel);continue}t.set(n.path,{path:n.path,count:1,latestTime:n.time,latestAnchorId:n.anchorId,toolLabel:n.toolLabel,anchors:[{anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}]})}return[...t.values()].map(e=>({...e,anchors:e.anchors.toSorted((e,t)=>e.time-t.time)})).toSorted((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime)}function Ms(e){let t=new Map,n={read:[],edit:[],write:[],delete:[]};return e.forEach(({msg:e,blocks:r,index:i})=>{let a=0;for(let o of r)if(o.type===`tool`)for(let[r,s]of o.parts.entries()){let c=o.anchorIds?.[r]??ks(i,a);a+=1,t.set(c,i);let l=xs(s),u=us(s),d=s.time_created??e.time_created,f=Go(l);if(f.length>0){for(let e of f){let t=(e.path||e.oldPath).trim();if(!t)continue;let r=e.type===`write_file`?`write`:e.type===`delete_file`?`delete`:`edit`;n[r].push({kind:r,path:t,anchorId:c,time:d,toolLabel:u})}continue}let p=As(s);if(!p)continue;let m=bs(l);for(let e of m)n[p].push({kind:p,path:e,anchorId:c,time:d,toolLabel:u})}}),{anchorMessageIndexes:t,summary:{read:js(n.read),edit:js(n.edit),write:js(n.write),delete:js(n.delete)}}}function Ns(e,t){if(!e)return t;let n={read:[],edit:[],write:[],delete:[]},r=new Map;for(let e of[`read`,`edit`,`write`,`delete`])for(let n of t[e])r.set(`${e}\0${n.path}`,n);for(let t of e){let e=r.get(`${t.kind}\0${t.path}`);n[t.kind].push({path:t.path,count:t.count,latestTime:t.latestTime,latestAnchorId:e?.latestAnchorId??``,toolLabel:e?.toolLabel??t.kind,anchors:e?.anchors??[]})}for(let e of[`read`,`edit`,`write`,`delete`])n[e].sort((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime);return n}var Ps=48,Fs=1;function Is(e){return`session-message-${e}`}function Ls(e,t){return`${Is(e)}-block-${t}`}function Rs(e){let t=e.replace(/<!--[\s\S]*?-->/g,` `).replace(/(^|\s)#{1,6}\s+/g,`$1`).replace(/(\*\*|__)(.*?)\1/g,`$2`).replace(/([*_])(.*?)\1/g,`$2`).replace(/`([^`]+)`/g,`$1`).replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length<=Ps?t:`${n.slice(0,Ps).join(``)}…`}function zs(e){return Rs(e.map(e=>e.type===`text`||e.type===`reasoning`||e.type===`plan`?e.text:``).filter(Boolean).join(` `))}function Bs(e){let t=As(e);return t===`read`?`tool-read`:t?`tool-write`:`tool-execute`}var Vs={"tool-read":`Read`,"tool-write":`Write`,"tool-execute":`Execute`};function Hs(e){let t=[];for(let{msg:n,blocks:r,index:i}of e){if(n.role===`user`){let e=Is(i),n=zs(r.flatMap(e=>e.parts));t.push({id:e,kind:`user`,anchorId:e,messageIndex:i,tooltip:`User · ${n||`Message`}`});continue}r.forEach((e,n)=>{if(e.type===`tool`){e.parts.forEach((n,r)=>{let a=e.anchorIds?.[r];if(!a)return;let o=Bs(n);t.push({id:a,kind:o,anchorId:a,messageIndex:i,tooltip:`${Vs[o]} · ${us(n)}`})});return}let r=Ls(i,n),a=zs(e.parts);t.push({id:r,kind:`agent`,anchorId:r,messageIndex:i,tooltip:`Agent · ${a||`Response`}`})})}return t}function Us(e,t){if(e.length===0)return null;let n=e.toSorted((e,t)=>e.top-t.top),r=n[0].index;for(let e of n){if(e.top>t)break;r=e.index}return r}function Ws(e,t,n,r){return r<=0?null:e<=Fs?0:e>=Math.max(0,n-t)-Fs?r-1:null}function Gs(e,t,n,r){if(r<=0||n<=0)return null;let i=Math.min(1,Math.max(0,(e-t)/n));return Math.min(r-1,Math.floor(i*r))}function Ks(e){return Zs(e)?`Browser`:e.title?.trim()?Js(e.title):e.tool.trim()?Js(e.tool):`tool`}function qs(e){return Zs(e)?`browser`:Js(e.tool.trim()?e.tool:Ks(e)).toLowerCase()}function Js(e){return e.trim().replace(/^tool:\s*/i,``).replace(/^\.+(?=\w)/,``)}function Ys(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Xs(e){return typeof e==`string`?e.trim():``}function Zs(e){let t=Xs(Ys(e.state.metadata).namespace);return Js(Xs(e.tool)).toLowerCase()===`js`&&(t===`mcp__node_repl__`||t===`mcp__node_repl__.js`)}function Qs(e,t){let n=qs(t),r=`tool:${n}`,i=e.get(n);if(i){i.count+=1;return}e.set(n,{id:r,toolKey:n,label:Ks(t),count:1})}function $s(e){let t={user:0,agent_message:0,thinking:0,plan:0,tools_all:0},n=new Set,r=new Map;for(let{msg:i,blocks:a}of e)for(let e of a){if(i.role===`user`){t.user+=1,n.add(`user`);continue}if(e.type===`text`){t.agent_message+=1,n.add(`agent_message`);continue}if(e.type===`reasoning`){t.thinking+=1,n.add(`thinking`);continue}if(e.type===`plan`){t.plan+=1,n.add(`plan`);continue}t.tools_all+=e.parts.length,n.add(`tools_all`);for(let t of e.parts)Qs(r,t),n.add(`tool:${qs(t)}`)}return{filterIds:n,counts:t,tools:[...r.values()].toSorted((e,t)=>e.label.localeCompare(t.label))}}function ec(e,t){return t.has(`tool:${qs(e)}`)}function tc(e,t,n){return t.role===`user`?n.has(`user`):e.type===`text`?n.has(`agent_message`):e.type===`reasoning`?n.has(`thinking`):e.type===`plan`?n.has(`plan`):e.parts.some(e=>ec(e,n))}function nc(e,t){let n=e.parts.map((e,n)=>ec(e,t)?n:-1).filter(e=>e>=0),r=n.map(t=>e.parts[t]);return r.length===0?null:{...e,parts:r,anchorIds:e.anchorIds?n.map(t=>e.anchorIds[t]):void 0}}function rc(e,t){return e.map(e=>{let n=e.blocks.filter(n=>tc(n,e.msg,t)).map(e=>e.type===`tool`?nc(e,t):e).filter(e=>e!=null);return n.length===0?null:{msg:e.msg,blocks:n,index:e.index}}).filter(e=>e!=null)}var ic=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends ic{};function ac(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function oc(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function sc(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function cc(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function lc(e,t){return sc(e,t,``)}function uc(e,t){return cc(e,t,``)}function dc(e,t){return t.slice(0,fc(e,t))}function fc(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function pc(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function mc(e,t){if(t)return gc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function hc(e,t){if(t)return gc(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function gc(e,t){if(!t)return[hc(e),mc(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=pc(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var _c=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,vc=RegExp(`[${_c}]+|\\s+|[^${_c}]`,`ug`);new class extends ic{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=pc(e,r)}else n=e.match(vc)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&yc(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&yc(n,i,r,null,t.intlSegmenter),e}};function yc(e,t,n,r,i){if(t&&n){let[a,o]=gc(t.value,i),[s,c]=gc(n.value,i);if(e){let r=ac(a,s);e.value=cc(e.value,s,r),t.value=lc(t.value,r),n.value=lc(n.value,r)}if(r){let e=oc(o,c);r.value=sc(r.value,c,e),t.value=uc(t.value,e),n.value=uc(n.value,e)}}else if(n){if(e){let e=hc(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=hc(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=hc(r.value,i),[a,o]=gc(t.value,i),s=ac(n,a);t.value=lc(t.value,s);let c=oc(lc(n,s),o);t.value=uc(t.value,c),r.value=sc(r.value,n,c),e.value=cc(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=hc(r.value,i),n=dc(mc(t.value,i),e);t.value=uc(t.value,n)}else if(e){let n=dc(mc(e.value,i),hc(t.value,i));t.value=lc(t.value,n)}}new class extends ic{tokenize(e){let t=RegExp(`(\\r?\\n)|[${_c}]+|[^\\S\\n\\r]+|[^${_c}]`,`ug`);return e.match(t)||[]}};var bc=new class extends ic{constructor(){super(...arguments),this.tokenize=Sc}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
14
|
+
`}),n}function ja(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ma(e,t){let n=Ea(e,t),r=n.one(e,void 0),i=da(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
15
|
+
`},i)),a}function Na(e,t){return e&&`run`in e?async function(n,r){let i=Ma(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ma(n,{file:r,...e||t})}}function Pa(e){if(e)throw e}var Fa=r(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Ia(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function La(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Ra(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Ra(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var U={basename:za,dirname:Ba,extname:Va,join:Ha,sep:`/`};function za(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Ga(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Ba(e){if(Ga(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Va(e){Ga(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Ha(...e){let t=-1,n;for(;++t<e.length;)Ga(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Ua(n)}function Ua(e){Ga(e);let t=e.codePointAt(0)===47,n=Wa(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Wa(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ga(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Ka={cwd:qa};function qa(){return`/`}function Ja(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ya(e){if(typeof e==`string`)e=new URL(e);else if(!Ja(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Xa(e)}function Xa(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Za=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Qa=class{constructor(e){let t;t=e?Ja(e)?{path:e}:typeof e==`string`||no(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Ka.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Za.length;){let e=Za[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Za.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?U.basename(this.path):void 0}set basename(e){eo(e,`basename`),$a(e,`basename`),this.path=U.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?U.dirname(this.path):void 0}set dirname(e){to(this.basename,`dirname`),this.path=U.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?U.extname(this.path):void 0}set extname(e){if($a(e,`extname`),to(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=U.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ja(e)&&(e=Ya(e)),eo(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?U.basename(this.path,this.extname):void 0}set stem(e){eo(e,`stem`),$a(e,`stem`),this.path=U.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new N(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function $a(e,t){if(e&&e.includes(U.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+U.sep+"`")}function eo(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function to(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function no(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var ro=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),io=e(Fa(),1),ao={}.hasOwnProperty,oo=new class e extends ro{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=La()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,io.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(lo(`data`,this.frozen),this.namespace[e]=t,this):ao.call(this.namespace,e)&&this.namespace[e]||void 0:e?(lo(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=po(e),n=this.parser||this.Parser;return so(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),so(`process`,this.parser||this.Parser),co(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=po(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);ho(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),so(`processSync`,this.parser||this.Parser),co(`processSync`,this.compiler||this.Compiler),this.process(e,r),fo(`processSync`,`process`,t),n;function r(e,r){t=!0,Pa(e),n=r}}run(e,t,n){uo(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=po(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),fo(`runSync`,`run`,n),r;function i(e,t){Pa(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=po(t),r=this.compiler||this.Compiler;return co(`stringify`,r),uo(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(lo(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,io.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Ia(o)&&Ia(r)&&(r=(0,io.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function so(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function co(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function lo(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function uo(e){if(!Ia(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function fo(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function po(e){return mo(e)?e:new Qa(e)}function mo(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function ho(e){return typeof e==`string`||go(e)}function go(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var W=i(),G=e(n(),1),_o=[],vo={allowDangerousHtml:!0},yo=/^(https?|ircs?|mailto|xmpp)$/i,bo=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function xo(e){let t=So(e),n=Co(e);return wo(t.runSync(t.parse(n),n),e)}function So(e){let t=e.rehypePlugins||_o,n=e.remarkPlugins||_o,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vo}:vo;return oo().use(yi).use(n).use(Na,r).use(t)}function Co(e){let t=e.children||``,n=new Qa;return typeof t==`string`?n.value=t:``+t,n}function wo(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||To;for(let e of bo)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Ca(e,l),at(e,{Fragment:W.Fragment,components:i,ignoreInvalidStyle:!0,jsx:W.jsx,jsxs:W.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Dt)if(Object.hasOwn(Dt,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Dt[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function To(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||yo.test(e.slice(0,t))?e:``}var Eo=12*1024*1024,Do=/^data:image\/[a-z0-9.+-]+(?:;[a-z0-9-]+=[^,;]*)*(?:;base64)?,/i;function Oo(){return typeof window>`u`?null:window.location.origin}function ko(e){let t=Oo();try{return t?new URL(e,t):new URL(e)}catch{return null}}function Ao(e){return Do.test(e)?e.length<=Eo:!1}function jo(e){let t=e?.trim();if(!t)return null;if(Ao(t))return t;let n=ko(t);if(!n||n.protocol!==`http:`&&n.protocol!==`https:`)return null;let r=Oo();return r&&n.origin===r?n.href:null}function Mo(e,t){return!e.startsWith(`image/`)||!t?null:jo(`data:${e};base64,${t}`)}var No={a:({children:e})=>(0,W.jsx)(`span`,{className:`console-markdown-link`,children:e}),img:({src:e,alt:t,title:n})=>{let r=jo(typeof e==`string`?e:void 0);return r?(0,W.jsx)(`img`,{src:r,alt:t??``,title:n,loading:`lazy`,className:`max-h-[520px] max-w-full object-contain`}):(0,W.jsxs)(`span`,{className:`console-mono inline-block rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`Remote image not loaded`,t?`: ${t}`:``]})}};function Po(e){return jo(e)??``}var Fo=new Set([`code`,`pre`,`mark`]);function Io(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Lo(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map(Io).join(`|`)})`,`gi`)}function Ro(e,t){let n=[],r=0;for(let i of e.matchAll(t)){let t=i.index??0,a=i[0]??``;a&&(t>r&&n.push({type:`text`,value:e.slice(r,t)}),n.push({type:`element`,tagName:`mark`,properties:{},children:[{type:`text`,value:a}]}),r=t+a.length)}return n.length===0?null:(r<e.length&&n.push({type:`text`,value:e.slice(r)}),n)}function zo(e,t){if(!e.children)return;let n=[],r=!1;for(let i of e.children){if(i.type===`text`){let e=Ro(i.value??``,t);if(e){n.push(...e),r=!0;continue}}else i.tagName&&Fo.has(i.tagName)||zo(i,t);n.push(i)}r&&(e.children=n)}function Bo(e){return t=>zo(t,e)}var Vo=(0,G.memo)(function({text:e,highlightQuery:t}){let n=(0,G.useMemo)(()=>{let e=Lo(t);return e?[[Bo,e]]:void 0},[t]);return(0,W.jsx)(`div`,{children:(0,W.jsx)(xo,{components:No,rehypePlugins:n,urlTransform:Po,children:e})})});function Ho(e){let t=[];for(let n of e){if(n.type===`image`)continue;if(n.type===`plan`){t.push({type:`plan`,parts:[n]});continue}if(n.type!==`tool`&&!n.text.trim())continue;let e=t.at(-1);if(n.type===`text`){e?.type===`text`?e.parts.push(n):t.push({type:`text`,parts:[n]});continue}if(n.type===`reasoning`){e?.type===`reasoning`?e.parts.push(n):t.push({type:`reasoning`,parts:[n]});continue}e?.type===`tool`?e.parts.push(n):t.push({type:`tool`,parts:[n]})}return t}function Uo(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Wo(e){return typeof e==`string`?e:``}function Go(e){return e.replace(/\\n/g,`
|
|
16
|
+
`)}function Ko(e){let t=Uo(e),n=Wo(t.type);return n?{type:n,path:Wo(t.path),oldPath:Wo(t.old_path),targetPath:Wo(t.targetPath),content:Wo(t.content)||Wo(Uo(t.input).content)}:null}function qo(e){return(Array.isArray(e)?e:Array.isArray(Uo(e).content)?Uo(e).content:[]).map(e=>Ko(e)).filter(e=>e!=null)}function Jo(e,t,n){return`${e} ${e===1?t:n}`}function Yo(e){let t=e.filter(e=>e.type===`write_file`).length,n=e.filter(e=>e.type===`edit_file`).length,r=e.filter(e=>e.type===`delete_file`).length,i=e.filter(e=>e.type===`move_file`).length,a=[];return t>0&&a.push(Jo(t,`write`,`writes`)),n>0&&a.push(Jo(n,`edit`,`edits`)),r>0&&a.push(Jo(r,`delete`,`deletes`)),i>0&&a.push(Jo(i,`move`,`moves`)),a.join(` · `)}function Xo(e){return e.targetPath||e.path||e.oldPath||e.type}function Zo(e,t,n){return e.reduce((e,r)=>r.type===`write_file`?(e.push({label:n(Xo(r)),operation:`write`,language:t(r.path),isCode:!0,text:Go(r.content)}),e):r.type===`edit_file`?(e.push({label:n(Xo(r)),operation:`edit`,language:`diff`,isCode:!0,text:Go(r.content)}),e):r.type===`delete_file`?(e.push({label:n(Xo(r)),operation:`edit`,language:`text`,isCode:!1,text:`File deleted.`}),e):(r.type===`move_file`&&e.push({label:n(Xo(r)),operation:`edit`,language:`text`,isCode:!1,text:r.targetPath&&r.path?`Moved from ${n(r.path)} to ${n(r.targetPath)}`:r.oldPath?`Moved from ${n(r.oldPath)}`:`File moved.`}),e),[])}function Qo(e,t,n,r=e=>e){let i=Zo(e,n,r);return i.length>0?{kind:`file-sections`,sections:i}:{kind:`plain`,text:t,language:`text`,isCode:!1}}function $o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function es(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function ts(e){return typeof e==`string`?e.trim():``}function K(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function q(e){return typeof e==`string`?e.trim():``}function J(e){return typeof e==`string`?e:``}function ns(e){try{return JSON.parse(e)}catch{return null}}function Y(e){return e.replaceAll(/\\n/g,`
|
|
17
|
+
`)}function rs(e){return Mo(q(e.mime_type),q(e.data))||(jo(q(e.url))??``)}function is(e){return Array.isArray(e)?e.flatMap((e,t)=>{let n=K(e);if(n.type!==`image`)return[];let r=rs(n);return r?[{src:r,alt:`Tool output image ${t+1}`}]:[]}):[]}function as(e){let t=is(e);if(t.length>0)return{kind:`media`,items:t,text:ls(e,!1)||void 0};let n=typeof e==`string`&&e.trim()?es(e.trim()):e;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=Object.entries(n).map(([e,t])=>({label:e,value:t}));return e.length>0?{kind:`property-list`,items:e}:null}return null}function os(e){if(e==null)return``;if(typeof e==`string`){let t=e.trim();if(!t)return``;try{let e=JSON.parse(t);return JSON.stringify(e,null,2)}catch{return e}}try{return JSON.stringify(e,null,2)}catch{return typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?`${e}`:typeof e==`symbol`?e.description?`Symbol(${e.description})`:`Symbol`:typeof e==`function`?`[Function]`:`[Unserializable value]`}}function ss(e){if(typeof e==`string`)return[e];if(Array.isArray(e))return e.flatMap(e=>ss(e));if(e&&typeof e==`object`){let t=e;if(typeof t.text==`string`)return[t.text];if(t.content!==void 0)return ss(t.content)}return[]}function cs(e){return e.replace(/^<system>/i,``).replace(/<\/system>$/i,``).trim()}function ls(e,t=!0){let n=ss(e).map(e=>e.trim()).filter(e=>t?!!e:!!e&&!/^<system>[\s\S]*<\/system>$/i.test(e));return n.length===0?``:n.map(e=>t&&/^<system>[\s\S]*<\/system>$/i.test(e)?cs(e):e).join(`
|
|
18
|
+
`)}function us(e){let t=es(e);if(t&&typeof t==`object`){let e=t;if(typeof e.cmd==`string`)return e.cmd;if(typeof e.command==`string`)return e.command}return``}function ds(e){let t=e.trim();return t?t.replace(/^tool:\s*/i,``).replace(/^\.+(?=\w)/,``):``}function fs(e){return e.title?.trim()?ds(e.title):e.tool.trim()?ds(e.tool):`tool`}function ps(e){return fs(e).trim().toLowerCase()}function ms(e,t=`Tool`){return ds(q(e.title))||q(e.tool)||t}function hs(e){return Y(ls(e)||os(e))||`No output captured.`}function X(e){let t=hs(e.outputValue);if(t!==`No output captured.`)return t;let n=hs(e.errorValue);return n===`No output captured.`?`No output captured.`:n}function gs(e){let{status:t,input:n,output:r,error:i,metadata:a}=e.state,o=r??``,s=i??``,c=es(n??{}),l=a??{};return{status:t,command:us(c),inputValue:c,outputValue:o,errorValue:s,metadataValue:l,inputText:os(c)}}function _s(e){let t=ts(e.nickname);return e.role===`assistant`&&t?`AGENT (${t})`:e.role===`user`?`USER`:e.role===`tool`?`TOOL`:`AGENT`}function vs(e,t){if(t.toLowerCase()!==`cursor`)return e;let n=[];for(let t of e){if(t.role!==`tool`){n.push({...t,parts:[...t.parts]});continue}let e=n.at(-1);if(e?.role===`assistant`){e.parts.push(...t.parts);continue}n.push({...t,parts:[...t.parts]})}return n}function ys(e){let t=e.trim();return!t||t.length>300||t.includes(`
|
|
19
|
+
`)||/^[a-z]+:\/\//i.test(t)||/[<>{}]/.test(t)?!1:t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`~/`)||t.includes(`/`)||t.includes(`\\`)?!0:/^[A-Za-z0-9_.@-]+\.[A-Za-z0-9_-]+$/.test(t)}function bs(e){let t=e.trim().toLowerCase();return!t||t.includes(`command`)||t.includes(`content`)||t.includes(`text`)||t.includes(`prompt`)||t.includes(`url`)||t.includes(`body`)||t.includes(`title`)||t.includes(`description`)||t===`cwd`||t===`workdir`||t===`directory`?!1:t===`path`||t===`paths`||t.includes(`file`)||t.includes(`path`)}function xs(e,t,n,r=0){if(!(e==null||r>4)){if(typeof e==`string`){bs(t)&&ys(e)&&n.add(e.trim());return}if(Array.isArray(e)){for(let i of e)xs(i,t,n,r+1);return}if(typeof e==`object`)for(let[t,i]of Object.entries(e))xs(i,t,n,r+1)}}function Ss(e){let t=new Set;return xs(e,``,t),[...t]}function Cs(e){return e.state.input??null}function ws(e){let t=K(e);return q(t.filePath)||q(t.file_path)||q(t.path)||q(t.targetFile)||q(t.effectiveUri)||q(t.relativeWorkspacePath)||``}function Z(e,t){let n=e.trim(),r=(t??``).replace(/\/+$/,``);return!n||!r?n:n===r?`.`:n.startsWith(`${r}/`)?n.slice(r.length+1):n}function Ts(e,t){let n=(t??``).replace(/\/+$/,``);return!e||!n?e:e.replace(RegExp(`${$o(n)}(?=$|/|[\\s"'\\)\\]}:;,])`,`g`),`.`)}function Es(e,t){return e.startsWith(`${t}/`)?e.slice(t.length+1):e}var Ds=new Set([`read`,`read_file`,`read_file_v2`,`read_text_file`,`readfile`,`view_image`]),Os=new Set([`apply_patch`,`edit`,`edit_file`,`edit_file_v2`,`editfile`,`multiedit`,`notebookedit`,`patch`,`search_replace`,`str_replace`]),ks=new Set([`create_file`,`write`,`write_file`,`writefile`]),As=new Set([`delete`,`delete_file`]);function js(e,t){return`tool-${e}-${t}`}function Ms(e){let t=ps(e);return Ds.has(t)?`read`:Os.has(t)?`edit`:ks.has(t)?`write`:As.has(t)?`delete`:null}function Ns(e){let t=new Map;for(let n of e){let e=t.get(n.path);if(e){e.count+=1,e.anchors.push({anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}),n.time>=e.latestTime&&(e.latestTime=n.time,e.latestAnchorId=n.anchorId,e.toolLabel=n.toolLabel);continue}t.set(n.path,{path:n.path,count:1,latestTime:n.time,latestAnchorId:n.anchorId,toolLabel:n.toolLabel,anchors:[{anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}]})}return[...t.values()].map(e=>({...e,anchors:e.anchors.toSorted((e,t)=>e.time-t.time)})).toSorted((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime)}function Ps(e){let t=new Map,n={read:[],edit:[],write:[],delete:[]};return e.forEach(({msg:e,blocks:r,index:i})=>{let a=0;for(let o of r)if(o.type===`tool`)for(let[r,s]of o.parts.entries()){let c=o.anchorIds?.[r]??js(i,a);a+=1,t.set(c,i);let l=Cs(s),u=fs(s),d=s.time_created??e.time_created,f=qo(l);if(f.length>0){for(let e of f){let t=(e.path||e.oldPath).trim();if(!t)continue;let r=e.type===`write_file`?`write`:e.type===`delete_file`?`delete`:`edit`;n[r].push({kind:r,path:t,anchorId:c,time:d,toolLabel:u})}continue}let p=Ms(s);if(!p)continue;let m=Ss(l);for(let e of m)n[p].push({kind:p,path:e,anchorId:c,time:d,toolLabel:u})}}),{anchorMessageIndexes:t,summary:{read:Ns(n.read),edit:Ns(n.edit),write:Ns(n.write),delete:Ns(n.delete)}}}function Fs(e,t){if(!e)return t;let n={read:[],edit:[],write:[],delete:[]},r=new Map;for(let e of[`read`,`edit`,`write`,`delete`])for(let n of t[e])r.set(`${e}\0${n.path}`,n);for(let t of e){let e=r.get(`${t.kind}\0${t.path}`);n[t.kind].push({path:t.path,count:t.count,latestTime:t.latestTime,latestAnchorId:e?.latestAnchorId??``,toolLabel:e?.toolLabel??t.kind,anchors:e?.anchors??[]})}for(let e of[`read`,`edit`,`write`,`delete`])n[e].sort((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime);return n}var Is=48,Ls=1;function Rs(e){return`session-message-${e}`}function zs(e,t){return`${Rs(e)}-block-${t}`}function Bs(e){let t=e.replace(/<!--[\s\S]*?-->/g,` `).replace(/(^|\s)#{1,6}\s+/g,`$1`).replace(/(\*\*|__)(.*?)\1/g,`$2`).replace(/([*_])(.*?)\1/g,`$2`).replace(/`([^`]+)`/g,`$1`).replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length<=Is?t:`${n.slice(0,Is).join(``)}…`}function Vs(e){return Bs(e.map(e=>e.type===`text`||e.type===`reasoning`||e.type===`plan`?e.text:``).filter(Boolean).join(` `))}function Hs(e){let t=Ms(e);return t===`read`?`tool-read`:t?`tool-write`:`tool-execute`}var Us={"tool-read":`Read`,"tool-write":`Write`,"tool-execute":`Execute`};function Ws(e){let t=[];for(let{msg:n,blocks:r,index:i}of e){if(n.role===`user`){let e=Rs(i),n=Vs(r.flatMap(e=>e.parts));t.push({id:e,kind:`user`,anchorId:e,messageIndex:i,tooltip:`User · ${n||`Message`}`});continue}r.forEach((e,n)=>{if(e.type===`tool`){e.parts.forEach((n,r)=>{let a=e.anchorIds?.[r];if(!a)return;let o=Hs(n);t.push({id:a,kind:o,anchorId:a,messageIndex:i,tooltip:`${Us[o]} · ${fs(n)}`})});return}let r=zs(i,n),a=Vs(e.parts);t.push({id:r,kind:`agent`,anchorId:r,messageIndex:i,tooltip:`Agent · ${a||`Response`}`})})}return t}function Gs(e,t){if(e.length===0)return null;let n=e.toSorted((e,t)=>e.top-t.top),r=n[0].index;for(let e of n){if(e.top>t)break;r=e.index}return r}function Ks(e,t,n,r){return r<=0?null:e<=Ls?0:e>=Math.max(0,n-t)-Ls?r-1:null}function qs(e,t,n,r){if(r<=0||n<=0)return null;let i=Math.min(1,Math.max(0,(e-t)/n));return Math.min(r-1,Math.floor(i*r))}function Js(e){return $s(e)?`Browser`:e.title?.trim()?Xs(e.title):e.tool.trim()?Xs(e.tool):`tool`}function Ys(e){return $s(e)?`browser`:Xs(e.tool.trim()?e.tool:Js(e)).toLowerCase()}function Xs(e){return e.trim().replace(/^tool:\s*/i,``).replace(/^\.+(?=\w)/,``)}function Zs(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Qs(e){return typeof e==`string`?e.trim():``}function $s(e){let t=Qs(Zs(e.state.metadata).namespace);return Xs(Qs(e.tool)).toLowerCase()===`js`&&(t===`mcp__node_repl__`||t===`mcp__node_repl__.js`)}function ec(e,t){let n=Ys(t),r=`tool:${n}`,i=e.get(n);if(i){i.count+=1;return}e.set(n,{id:r,toolKey:n,label:Js(t),count:1})}function tc(e){let t={user:0,agent_message:0,thinking:0,plan:0,tools_all:0},n=new Set,r=new Map;for(let{msg:i,blocks:a}of e)for(let e of a){if(i.role===`user`){t.user+=1,n.add(`user`);continue}if(e.type===`text`){t.agent_message+=1,n.add(`agent_message`);continue}if(e.type===`reasoning`){t.thinking+=1,n.add(`thinking`);continue}if(e.type===`plan`){t.plan+=1,n.add(`plan`);continue}t.tools_all+=e.parts.length,n.add(`tools_all`);for(let t of e.parts)ec(r,t),n.add(`tool:${Ys(t)}`)}return{filterIds:n,counts:t,tools:[...r.values()].toSorted((e,t)=>e.label.localeCompare(t.label))}}function nc(e,t){return t.has(`tool:${Ys(e)}`)}function rc(e,t,n){return t.role===`user`?n.has(`user`):e.type===`text`?n.has(`agent_message`):e.type===`reasoning`?n.has(`thinking`):e.type===`plan`?n.has(`plan`):e.parts.some(e=>nc(e,n))}function ic(e,t){let n=e.parts.map((e,n)=>nc(e,t)?n:-1).filter(e=>e>=0),r=n.map(t=>e.parts[t]);return r.length===0?null:{...e,parts:r,anchorIds:e.anchorIds?n.map(t=>e.anchorIds[t]):void 0}}function ac(e,t){return e.map(e=>{let n=e.blocks.filter(n=>rc(n,e.msg,t)).map(e=>e.type===`tool`?ic(e,t):e).filter(e=>e!=null);return n.length===0?null:{msg:e.msg,blocks:n,index:e.index}}).filter(e=>e!=null)}var oc=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends oc{};function sc(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function cc(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function lc(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function uc(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function dc(e,t){return lc(e,t,``)}function fc(e,t){return uc(e,t,``)}function pc(e,t){return t.slice(0,mc(e,t))}function mc(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function hc(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function gc(e,t){if(t)return vc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function _c(e,t){if(t)return vc(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function vc(e,t){if(!t)return[_c(e),gc(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=hc(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var yc=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,bc=RegExp(`[${yc}]+|\\s+|[^${yc}]`,`ug`);new class extends oc{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=hc(e,r)}else n=e.match(bc)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&xc(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&xc(n,i,r,null,t.intlSegmenter),e}};function xc(e,t,n,r,i){if(t&&n){let[a,o]=vc(t.value,i),[s,c]=vc(n.value,i);if(e){let r=sc(a,s);e.value=uc(e.value,s,r),t.value=dc(t.value,r),n.value=dc(n.value,r)}if(r){let e=cc(o,c);r.value=lc(r.value,c,e),t.value=fc(t.value,e),n.value=fc(n.value,e)}}else if(n){if(e){let e=_c(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=_c(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=_c(r.value,i),[a,o]=vc(t.value,i),s=sc(n,a);t.value=dc(t.value,s);let c=cc(dc(n,s),o);t.value=fc(t.value,c),r.value=lc(r.value,n,c),e.value=uc(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=_c(r.value,i),n=pc(gc(t.value,i),e);t.value=fc(t.value,n)}else if(e){let n=pc(gc(e.value,i),_c(t.value,i));t.value=dc(t.value,n)}}new class extends oc{tokenize(e){let t=RegExp(`(\\r?\\n)|[${yc}]+|[^\\S\\n\\r]+|[^${yc}]`,`ug`);return e.match(t)||[]}};var Sc=new class extends oc{constructor(){super(...arguments),this.tokenize=wc}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
20
20
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
21
21
|
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
22
22
|
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
23
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function
|
|
24
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function
|
|
23
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Cc(e,t,n){return Sc.diff(e,t,n)}function wc(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
24
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Tc(e){return e==`.`||e==`!`||e==`?`}new class extends oc{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Tc(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends oc{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends oc{constructor(){super(...arguments),this.tokenize=wc}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Ec(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Ec(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Ec(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Ec(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends oc{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Dc(e,t,n){return!t.trim()&&!n.trim()?[]:[{label:Mc(e),lines:Ac(Cc(Y(t),Y(n)))}]}function Oc(e,t){let n=Y(e).split(`
|
|
25
25
|
`),r=Y(t).split(`
|
|
26
26
|
`);return[`@@`,...n.map(e=>`- ${e}`),...r.map(e=>`+ ${e}`)].join(`
|
|
27
|
-
`)}function
|
|
27
|
+
`)}function kc(e){let t=Y(e),n=t.split(`
|
|
28
28
|
`);return t.endsWith(`
|
|
29
|
-
`)&&n.pop(),n}function
|
|
30
|
-
`).map(e=>({type:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`remove`:`context`,text:e}))}]:[]}function
|
|
29
|
+
`)&&n.pop(),n}function Ac(e){return e.flatMap(e=>{let t=e.added?`add`:e.removed?`remove`:`context`;return kc(e.value).map(e=>({type:t,text:e}))})}function jc(e){let t=K(e).edit;return Array.isArray(t)?t:t&&typeof t==`object`?[t]:[]}function Mc(e){let t=e.trim();if(!t)return`edit`;let n=t.split(`/`).pop()||t;return n===t?n:`${n} · ${t}`}function Nc(e,t){let n=jc(e.inputValue),r=Mc(t);return n.map(e=>{let t=K(e),n=J(t.old),i=J(t.new);return!n.trim()&&!i.trim()?null:{label:r,lines:Ac(Cc(Y(n),Y(i)))}}).filter(e=>e!=null&&e.lines.length>0)}function Pc(e,t){let n=K(e.inputValue),r=Array.isArray(n.edits)?n.edits:[],i=Mc(t),a=r.map(e=>{let t=K(e),n=J(t.oldText)||J(t.old),r=J(t.newText)||J(t.new);return!n.trim()&&!r.trim()?null:{label:i,lines:Ac(Cc(Y(n),Y(r)))}}).filter(e=>e!=null&&e.lines.length>0);if(a.length>0)return a;let o=K(e.metadataValue),s=J(o.patch)||J(o.diff);return s.trim()?[{label:i,lines:s.split(`
|
|
30
|
+
`).map(e=>({type:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`remove`:`context`,text:e}))}]:[]}function Fc(e){return e.startsWith(`@@`)?{type:`context`,text:e}:e.startsWith(`+`)?{type:`add`,text:e.slice(1)}:e.startsWith(`-`)?{type:`remove`,text:e.slice(1)}:e.startsWith(` `)?{type:`context`,text:e.slice(1)}:{type:`context`,text:e}}function Ic(e,t){let n=K(K(e.metadataValue).display),r=Array.isArray(n.structuredPatch)?n.structuredPatch:[],i=J(n.filePath)||t;return r.map(e=>{let t=K(e),n=(Array.isArray(t.lines)?t.lines:[]).map(e=>typeof e==`string`?Fc(e):null).filter(e=>e!=null);return n.length===0?null:{label:Mc(i),lines:n}}).filter(e=>e!=null)}function Lc(e){let t=J(K(e.metadataValue).diff);if(t.trim())return Y(t);let n=jc(e.inputValue).map(e=>{let t=K(e),n=J(t.old),r=J(t.new);return!n.trim()&&!r.trim()?``:Oc(n,r)}).filter(Boolean).join(`
|
|
31
31
|
|
|
32
|
-
`);return n.trim()?n:X(e)}var
|
|
32
|
+
`);return n.trim()?n:X(e)}var Rc={".bashrc":`bash`,".zshrc":`bash`,".profile":`bash`,dockerfile:`docker`,".env":`ini`},zc={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,py:`python`,sql:`sql`,rs:`rust`,go:`go`,java:`java`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,cs:`csharp`,sh:`bash`,bash:`bash`,zsh:`bash`,html:`html`,css:`css`,yaml:`yaml`,yml:`yaml`,json:`json`,md:`markdown`,toml:`toml`,conf:`ini`,xml:`markup`,svg:`markup`,properties:`ini`,dockerfile:`docker`};function Bc(e){let t=e.split(`/`).pop()?.toLowerCase()??``;if(!t)return`text`;let n=Rc[t];if(n)return n;if(t.startsWith(`.env.`))return`ini`;let r=t.includes(`.`)?t.split(`.`).pop()??``:``;return r&&zc[r]||`text`}function Vc(e){return e.replace(/\n*<system-reminder>[\s\S]*$/i,``).trimEnd()}function Hc(e){let t=ls(e,!1)||hs(e);return t===`No output captured.`?t:Vc(t.replace(/^<file>\s*/i,``).replace(/\s*<\/file>\s*$/i,``)).split(`
|
|
33
33
|
`).filter(e=>!/^\(End of file - total \d+ lines\)$/.test(e.trim())).map(e=>e.replace(/^\d+\|\s?/,``).replace(/^\s*\d+\t/,``)).join(`
|
|
34
|
-
`).trimEnd()||`No output captured.`}function
|
|
35
|
-
`)
|
|
34
|
+
`).trimEnd()||`No output captured.`}function Uc(e){let t=K(e.inputValue);if(e.status===`completed`){let e=J(t.content);if(e.trim())return Y(e)}return X(e)}function Wc(e){return{...e.defaultStrategy,Icon:e.Icon,title:e.title,secondaryText:e.displayPath||void 0,details:e.details??e.defaultStrategy.details,showInputPreview:!1,outputContent:e.outputContent}}function Gc(e){return Wc({...e,Icon:ee,title:`read`,outputContent:e.outputContent??{kind:`plain`,text:e.text??Hc(e.state.outputValue),language:Bc(e.filePath),isCode:e.isCode??!0}})}function Kc(e){return Wc({...e,Icon:e.Icon??x,title:`write`,outputContent:{kind:`plain`,text:Uc(e.state),language:Bc(e.filePath),isCode:e.isCode??e.state.status===`completed`}})}function qc(e){return Wc({...e,Icon:l,title:`edit`})}function Jc(e,t,n){let r=Ts(t.command||t.inputText||`{}`,n).replace(/\s+/g,` `).trim(),i=r.length>72?`${r.slice(0,72)}...`:r,a=as(t.outputValue);return{Icon:f,title:ms(e),secondaryText:i?`(${i})`:void 0,details:[],expandable:!0,showInputPreview:!0,outputContent:a??{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}function Yc(e,t,n,r){let i=Ts(q(K(t.inputValue).name),r);return{...n,Icon:E,title:q(e.tool)||`skill`,secondaryText:i||void 0,expandable:!1,showInputPreview:!1}}function Xc(e){let t=new Map;return{tasks:e.map(e=>{let n=K(e),r=J(n.status),i=r===`completed`||r===`in_progress`||r===`error`?r:`pending`;return t.set(i,(t.get(i)??0)+1),{label:J(n.content)||J(n.subject)||`Untitled task`,status:i,detail:J(n.activeForm)||J(n.description)||void 0}}),summary:[...t.entries()].map(([e,t])=>`${t} ${e}`).join(` · `)}}function Zc(e,t){let n=[...t.matchAll(/"([^"]+)"="([^"]+)"/g)],r=new Map(n.map(e=>[e[1],[e[2]]]));return(Array.isArray(e.questions)?e.questions:[]).flatMap(e=>{let t=K(e),n=J(t.question);if(!n)return[];let i=(Array.isArray(t.options)?t.options:[]).flatMap(e=>{let t=K(e),n=J(t.label);if(!n)return[];let r=n.replace(/\s*\(Recommended\)\s*$/i,``);return[{label:r,description:J(t.description)||void 0,recommended:r!==n||void 0}]});return[{header:J(t.header)||void 0,question:n,options:i,answers:r.get(n)??[]}]})}function Qc(e){return e.tool.trim().toLowerCase()}function $c(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`boolean`?String(e):``}function el(e,t){let n=X(t),r=J(K(es(n)).message)||n;return[{label:`Recipient`,value:J(e.recipient)||J(e.to)},{label:`Summary`,value:J(e.summary)},{label:`Message`,value:J(e.message)||J(e.content)},{label:`Delivery`,value:r}].filter(e=>e.value&&e.value!==`No output captured.`)}function tl(e,t,n){let r=Jc(e,t,n),i=Qc(e),a=K(t.inputValue),o=ws(t.inputValue),c=Z(o,n);if(i===`read`)return Gc({defaultStrategy:r,state:t,filePath:o,displayPath:c,outputContent:as(t.outputValue)});if(i===`edit`){let e=J(a.old_string),n=J(a.new_string),i=Dc(c||o,e,n);return qc({defaultStrategy:r,displayPath:c,outputContent:i.length>0?{kind:`structured-diff`,blocks:i}:{kind:`plain`,text:X(t),language:`text`,isCode:!1}})}if(i===`write`)return Kc({defaultStrategy:r,state:t,filePath:o,displayPath:c,isCode:!0});if(i===`bash`||i===`workflow`){let e=J(a.command)||J(a.script),o=J(a.description),s=Ts(e,n);return{...r,Icon:f,title:i===`workflow`?`workflow`:`bash`,secondaryText:o||ts(s).slice(0,120)||void 0,details:e?[{label:i===`workflow`?`Script`:`Command`,value:s}]:[],showInputPreview:!1,contentLabel:t.status===`error`?`Error`:`Terminal output`,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`todowrite`||i===`taskcreate`){let e=Xc(i===`todowrite`?Array.isArray(a.todos)?a.todos:[]:[a]);return{...r,Icon:g,title:i===`todowrite`?`tasks`:`create task`,secondaryText:e.summary||void 0,details:[],showInputPreview:!1,contentLabel:`Task state`,outputContent:{kind:`task-list`,items:e.tasks}}}if(i===`taskupdate`||i===`tasklist`){let e=as(i===`taskupdate`?a:t.outputValue);return{...r,Icon:g,title:i===`taskupdate`?`update task`:`list tasks`,secondaryText:J(a.taskId)||J(a.status)||void 0,details:[],showInputPreview:!1,contentLabel:`Task state`,outputContent:e??{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`agent`){let e=J(a.subagent_type)||J(a.name),n=J(a.description);return{...r,Icon:j,title:e?`agent · ${e}`:`agent`,secondaryText:n||void 0,details:[J(a.model)?{label:`Model`,value:J(a.model)}:null,a.run_in_background===!0?{label:`Mode`,value:`Background`}:null].filter(e=>e!=null),showInputPreview:!1,contentLabel:`Agent result`,outputContent:{kind:`plain`,text:X(t),language:`markdown`,isCode:!1}}}if(i===`askuserquestion`){let e=Zc(a,X(t));return{...r,Icon:s,title:`ask`,secondaryText:e.length?`${e.length} question${e.length===1?``:`s`}`:void 0,details:[],showInputPreview:!1,contentLabel:`Questions`,outputContent:e.length?{kind:`question-list`,questions:e}:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`websearch`||i===`webfetch`){let e=J(a.query),n=J(a.url);return{...r,Icon:_,title:i===`websearch`?`web search`:`web fetch`,secondaryText:e||n||void 0,details:[],showInputPreview:!1,contentLabel:`Results`,outputContent:{kind:`plain`,text:X(t),language:`markdown`,isCode:!1}}}if(i===`toolsearch`)return{...r,Icon:M,title:`find tools`,secondaryText:J(a.query)||void 0,details:[],showInputPreview:!1,contentLabel:`Matches`};if(i===`skill`)return{...r,Icon:E,title:`skill`,secondaryText:J(a.skill)||void 0,details:[],showInputPreview:!1,contentLabel:`Result`};if(i===`structuredoutput`||i===`reportfindings`)return{...r,Icon:g,title:i===`reportfindings`?`report findings`:`structured output`,secondaryText:`${Object.keys(a).length} fields`,details:[],showInputPreview:!1,contentLabel:`Submitted fields`,outputContent:{kind:`property-list`,items:Object.entries(a).map(([e,t])=>({label:e,value:t}))}};if(i.startsWith(`mcp__claude-in-chrome__`)){let e=i.replace(`mcp__claude-in-chrome__`,``).replaceAll(`_`,` `),t=J(a.url),n=J(a.action)||J(a.query),o=$c(a.tabId);return{...r,Icon:S,title:`browser · ${e}`,secondaryText:t||n||void 0,details:o?[{label:`Tab`,value:o}]:[],showInputPreview:!1,contentLabel:`Browser result`}}if(i===`sendmessage`){let e=J(a.recipient)||J(a.to);return{...r,Icon:d,title:`send message`,secondaryText:e||void 0,details:[],showInputPreview:!1,contentLabel:`Message details`,outputContent:{kind:`property-list`,items:el(a,t)}}}return{...r,title:ms(e)}}function nl(e,t,n){let r=Jc(e,t,n),i=e.tool.toLowerCase(),a=K(t.inputValue),o=ws(t.inputValue),s=Z(o,n);if(i===`glob`){let n=q(a.pattern);return{...r,Icon:_,title:e.tool||`glob`,secondaryText:n||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`grep`){let i=q(a.path),o=q(a.pattern),s=[Z(i,n),o].filter(Boolean).join(` · `);return{...r,Icon:_,title:e.tool||`grep`,secondaryText:s||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`bash`){let i=q(a.description),o=Ts(q(a.command),n),s=i?`${i}${o?` (${o})`:``}`:o?`(${o})`:void 0;return{...r,Icon:f,title:e.tool||`bash`,secondaryText:s,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}return i===`read`?Gc({defaultStrategy:r,state:t,filePath:o,displayPath:s}):i===`edit`?qc({defaultStrategy:r,displayPath:s,outputContent:{kind:`plain`,text:Lc(t),language:`diff`,isCode:!0}}):i===`write`?Kc({defaultStrategy:r,state:t,filePath:o,displayPath:s}):i===`skill`?Yc(e,t,r,n):r}function rl(e,t,n){let r=Jc(e,t,n),i=e.tool.toLowerCase(),a=K(t.inputValue),o=ws(t.inputValue),s=Z(o,n);if(i===`glob`){let n=q(a.pattern);return{...r,Icon:_,title:e.title||`glob`,secondaryText:n||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`grep`){let i=q(a.path),o=q(a.pattern),s=[Z(i,n),o].filter(Boolean).join(` · `);return{...r,Icon:_,title:e.title||`grep`,secondaryText:s||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`shell`){let i=Ts(q(a.command),n);return{...r,Icon:f,title:e.title||`bash`,secondaryText:i?`(${i})`:void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`readfile`)return Gc({defaultStrategy:r,state:t,filePath:o,displayPath:s});if(i===`strreplacefile`){let e=Nc(t,s||o);return qc({defaultStrategy:r,displayPath:s,outputContent:e.length>0?{kind:`structured-diff`,blocks:e}:{kind:`plain`,text:Lc(t),language:`diff`,isCode:!0}})}return i===`writefile`?Kc({defaultStrategy:r,state:t,filePath:o,displayPath:s}):r}function il(e){return e.replace(/\s*[((](?:Recommended|推荐)[))]\s*$/i,``).trim()}function al(e){let t=new Map;return{text:e.map(e=>{let n=K(e),r=q(n.status)||`pending`,i=q(n.priority),a=q(n.content)||q(n.title);t.set(r,(t.get(r)??0)+1);let o=r===`completed`?`x`:r===`in_progress`?`~`:` `,s=i?` _${i}_`:``;return`- [${o}] ${a||`(empty todo)`}${s}`}).join(`
|
|
35
|
+
`)||`No todos captured.`,summary:[...t.entries()].map(([e,t])=>`${t} ${e}`).join(` · `),details:[...t.entries()].map(([e,t])=>({label:e,value:String(t)}))}}function ol(e){let t=new Map;try{let n=K(K(JSON.parse(e)).answers);if(n)for(let[e,r]of Object.entries(n)){let n=q(r);e.trim()&&n&&t.set(e.trim(),[il(n)])}}catch{}for(let n of e.matchAll(/"([^"]+)"="([^"]+)"/g)){let e=n[1]?.trim(),r=n[2]?.trim();!e||!r||t.set(e,[il(r)])}return t}function sl(e,t){let n=K(e),r=Array.isArray(n.questions)?n.questions:[],i=ol(t),a=r.map(e=>{let t=K(e),n=q(t.question);if(!n)return null;let r=Array.isArray(t.options)?t.options.map(e=>{let t=K(e),n=q(t.label),r=il(n);return r?{label:r,description:q(t.description)||void 0,recommended:r!==n.trim()||void 0}:null}).filter(e=>e!=null):[];return{header:q(t.header)||void 0,question:n,options:r,answers:i.get(n)??[]}}).filter(e=>e!=null);return a.length===0?{secondaryText:void 0,outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}}:{secondaryText:`${a.length} question${a.length===1?``:`s`}`,outputContent:{kind:`question-list`,questions:a}}}function cl(e,t,n){let r=Jc(e,t,n),i=ps(e),a=K(t.inputValue),o=K(t.metadataValue),l=ws(t.inputValue),u=Z(l,n),d=X(t);if(i===`bash`||i===`shell`){let e=q(a.description),t=q(a.command),i=Ts(t,n),o=d===`(Bash completed with no output)`?`No output captured.`:d;return{...r,Icon:f,title:`bash`,secondaryText:e?`${e}${i?` (${i})`:``}`:i?`(${i})`:void 0,details:t?[{label:`Command`,value:i||t}]:[],showInputPreview:!1,outputContent:{kind:`plain`,text:o,language:`text`,isCode:!1}}}if(i===`read`||i===`readfile`)return Gc({defaultStrategy:r,state:t,filePath:l,displayPath:u});if(i===`edit`||i===`strreplacefile`){let e=Ic(t,u||l),n=J(a.old_string),i=J(a.new_string),s=Dc(u||l,n,i),c=e.length>0?e:s,f=K(o.display);return qc({defaultStrategy:r,displayPath:u,details:[typeof f.additions==`number`?{label:`Additions`,value:String(f.additions)}:null,typeof f.deletions==`number`?{label:`Deletions`,value:String(f.deletions)}:null].filter(e=>e!=null),outputContent:c.length>0?{kind:`structured-diff`,blocks:c}:{kind:`plain`,text:d,language:`text`,isCode:!1}})}if(i===`write`||i===`writefile`)return Kc({defaultStrategy:r,state:t,filePath:l,displayPath:u,Icon:c});if(i===`glob`||i===`grep`){let e=q(a.path),t=q(a.pattern),o=[Z(e,n),t].filter(Boolean).join(` · `);return{...r,Icon:_,title:i,secondaryText:o||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:d,language:`text`,isCode:!1}}}if(i===`todowrite`||i===`todolist`){let e=al(Array.isArray(a.todos)?a.todos:[]);return{...r,Icon:g,title:`todo`,secondaryText:e.summary||void 0,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.text,language:`markdown`,isCode:!1}}}if(i===`agent`){let e=q(a.subagent_type),t=q(a.description);return{...r,Icon:j,title:e?`agent · ${e}`:`agent`,secondaryText:t||void 0,details:e?[{label:`Type`,value:e}]:[],showInputPreview:!1,outputContent:{kind:`plain`,text:d,language:`markdown`,isCode:!1}}}if(i===`askuserquestion`){let e=sl(t.inputValue,d);return{...r,Icon:s,title:`ask`,secondaryText:e.secondaryText,details:[],showInputPreview:!1,outputContent:e.outputContent}}if(i===`enterplanmode`||i===`exitplanmode`){let e=J(a.plan);return{...r,Icon:g,title:i===`enterplanmode`?`plan mode`:`plan approved`,secondaryText:e.split(`
|
|
36
|
+
`).find(e=>e.trim())?.replace(/^#+\s*/,``)||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:e||d,language:`markdown`,isCode:!1}}}if(i===`websearch`){let e=q(a.query);return{...r,Icon:_,title:`web search`,secondaryText:e||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:d,language:`markdown`,isCode:!1}}}if(i===`skill`){let e=q(a.skill);return{...r,Icon:E,title:`skill`,secondaryText:e||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:d,language:`markdown`,isCode:!1}}}return r}function ll(e,t,n){return cl({...e,title:``},t,n)}function Q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function $(e){return typeof e==`string`?e.trim():``}function ul(e){return typeof e==`string`?e:``}function dl(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?`${e}`:``}function fl(e){return e.replace(/\\n/g,`
|
|
37
|
+
`)}function pl(e){return e.replace(/\s*\(Recommended\)\s*$/i,``).trim()}function ml(e){let t=e.trim();return{label:pl(t),recommended:/\(Recommended\)\s*$/i.test(t)}}function hl(e){return e.replace(/\s+/g,` `).trim()}function gl(e,t=88){let n=hl(e);return n?n.length>t?`${n.slice(0,t)}...`:n:``}function _l(e,t){return gl([`${t} questions`,...e.filter(Boolean).slice(0,2)].join(` · `),96)}function vl(e){try{return JSON.parse(e)}catch{return null}}function yl(e){let t=fl(e).split(`
|
|
36
38
|
`);if(t.length<5||!(/^Chunk ID:\s+\S+/.test(t[0]||``)&&/^Wall time:\s+/.test(t[1]||``)&&/^Process (?:exited with code \d+|running with session ID \d+)/.test(t[2]||``)&&/^Original token count:\s+\d+/.test(t[3]||``)&&/^Output:$/.test(t[4]||``)))return e;let n=5;for(;n<t.length&&t[n]?.trim()===``;)n+=1;let r=t.slice(n).join(`
|
|
37
|
-
`);return r.trim()?r:e}function
|
|
39
|
+
`);return r.trim()?r:e}function bl(e,t,n){n.trim()&&e.push({label:t,value:n})}function xl(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function Sl(e){return e.trim()?!/[|&;<>()$`*?{}[\]\\]/.test(e):!1}function Cl(e){let t=xl(e.trim());return Sl(t)?t:null}function wl(e){let t=e.trim();if(!t)return null;let n=t.match(/^nl\s+-ba\s+([^\s]+)\s*\|\s*sed\s+-n\s+['"][^'"]+['"]$/);if(n)return Cl(n[1]||``);for(let e of[/^cat\s+([^\s]+)$/,/^sed\s+-n\s+['"][^'"]+['"]\s+([^\s]+)$/,/^head\s+-n\s+\d+\s+([^\s]+)$/,/^tail\s+-n\s+\d+\s+([^\s]+)$/]){let n=t.match(e);if(n)return Cl(n[1]||``)}return null}function Tl(e){let t=e.split(`
|
|
38
40
|
`),n=t.filter(e=>e.trim());if(n.length===0)return e;let r=/^\s*\d+(?:\t|\|\s?)/;return n.filter(e=>r.test(e)).length/n.length<.6?e:t.map(e=>e.replace(/^\s*\d+(?:\t|\|\s?)/,``)).join(`
|
|
39
|
-
`)}function
|
|
40
|
-
`):f||void 0,details:d,outputAnalysis:
|
|
41
|
-
`);if(t===-1)return e;let n=
|
|
42
|
-
`)||e}function
|
|
43
|
-
`):`No output captured.`}function
|
|
41
|
+
`)}function El(e){return/\b(Test Files|Tests|Coverage report|coverage: platform|Ran \d+ tests)\b/.test(e)||/^(PASS|FAIL|stdout\s+\|)/m.test(e)||/\bmodules transformed\b/.test(e)}function Dl(e){let t=e.trim();return!t||El(t)?null:(t.startsWith(`{`)||t.startsWith(`[`))&&vl(t)!=null?`json`:/<(!DOCTYPE html|html\b|body\b|div\b|span\b|main\b|section\b|svg\b|\/[a-z])/i.test(t)?`markup`:[/^#{1,6}\s/m,/^[-*]\s/m,/^\d+\.\s/m,/^```/m].filter(e=>e.test(t)).length>=1&&!/[{};]\s*$/.test(t)?`markdown`:(t.match(/^[A-Za-z0-9_-]+:\s.+$/gm)||[]).length>=2&&!/\b(import|export|const|let|function|class)\b/.test(t)&&!/[{}()[\];]/.test(t)?`yaml`:[/^(from\s+\S+\s+import\s+.+|import\s+\S+)/m,/^def\s+\w+\(/m,/^class\s+\w+[:(]/m].filter(e=>e.test(t)).length>=2||/^(from\s+\S+\s+import\s+.+|import\s+\S+)/m.test(t)&&/^def\s+\w+\(/m.test(t)?`python`:[/\binterface\s+\w+/,/\btype\s+\w+\s*=/,/\bimplements\b/,/\bas const\b/,/:\s*[A-Z][A-Za-z0-9_<>,[\] |&?]+/].filter(e=>e.test(t)).length>=1&&/\b(import|export|const|let|function|class)\b/.test(t)?`typescript`:[/^\s*import\s.+from\s/m,/^\s*export\s/m,/\b(const|let|function|class)\b/].filter(e=>e.test(t)).length>=2?`javascript`:null}function Ol(e,t,n){let r=yl(t),i=wl(e);if(i){let e=n(i);return{text:Tl(r),language:e,isCode:e!==`text`,sourcePath:i,confidence:`path`}}let a=Dl(r);return a?{text:r,language:a,isCode:!0,confidence:`content`}:{text:r,language:`text`,isCode:!1,confidence:`plain`}}function kl(e,t,n,r=e=>e,i=e=>e){let a=Q(e),o=$(a.cmd),s=$(a.workdir),c=$(a.sandbox_permissions),l=$(a.justification),u=i(o),d=[];bl(d,`Command`,u),bl(d,`Workdir`,r(s)),bl(d,`Escalation`,c),bl(d,`Justification`,l);let f=gl(u);return{secondaryText:l?[l,f].filter(Boolean).join(`
|
|
42
|
+
`):f||void 0,details:d,outputAnalysis:Ol(o,t,n)}}function Al(e,t,n){let r=Q(e),i=dl(r.session_id),a=ul(r.chars),o=a?`stdin`:`poll`,s=[];return bl(s,`Session`,i),s.push({label:`Chars`,value:a||`(empty)`}),{secondaryText:i?`session #${i} · ${o}`:o,details:s,outputAnalysis:Ol(``,t,n)}}function jl(e,t){let n=Q(e),r=Array.isArray(n.questions)?n.questions:null;if(!r||r.length===0)return{secondaryText:void 0,details:[],outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}};let i=Q(vl(t)?.answers),a=r.map(e=>{let t=Q(e),n=$(t.id),r=Q(i[n]),a=(Array.isArray(r.answers)?r.answers:[]).map(e=>typeof e==`string`?pl(e):``).filter(Boolean),o=Array.isArray(t.options)?t.options.map(e=>{let t=Q(e),n=ml($(t.label));return n.label?{label:n.label,description:$(t.description)||void 0,recommended:n.recommended||void 0}:null}).filter(e=>e!=null):[],s=$(t.question);return s?{header:$(t.header)||void 0,question:s,options:o,answers:a}:null}).filter(e=>e!=null);return a.length===0?{secondaryText:void 0,details:[],outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}}:{secondaryText:_l(a.map(e=>e.header||``),a.length),details:[],outputContent:{kind:`question-list`,questions:a}}}function Ml(e){let t=Q(e),n=$(t.explanation),r=Array.isArray(t.plan)?t.plan:[],i=new Map,a=r.map(e=>{let t=Q(e),n=$(t.status)||`pending`,r=$(t.step)||$(t.content);return i.set(n,(i.get(n)??0)+1),{label:r||`(empty step)`,status:n===`completed`||n===`in_progress`||n===`error`?n:`pending`}}),o=[...i.entries()].map(([e,t])=>({label:e,value:String(t)}));return{secondaryText:n||[...i.entries()].map(([e,t])=>`${t} ${e}`).join(` · `)||void 0,details:o,items:a}}function Nl(e,t){return e.map(e=>$(Q(e)[t])).filter(Boolean).join(` · `)}function Pl(e){let t=Q(e);return Array.isArray(t.search_query)?{title:`web search`,secondaryText:Nl(t.search_query,`q`)||void 0}:Array.isArray(t.open)?{title:`web open`,secondaryText:Nl(t.open,`ref_id`)||void 0}:{title:`web ${Object.keys(t)[0]||`run`}`,secondaryText:void 0}}function Fl(e,t){let n=Q(e),r=$(n.path),i=$(n.detail),a=r?t(r):``,o=[];return bl(o,`Image`,a),bl(o,`Detail`,i),{secondaryText:a||void 0,details:o}}function Il(e){return e.replace(/^_+/,``).replaceAll(`_`,` `)}function Ll(e){for(let t of[`title`,`summary`,`query`,`q`,`url`,`objective`,`target`,`threadId`]){let n=ts(e[t]);if(n)return n.length>120?`${n.slice(0,120)}…`:n}return``}function Rl(e){let t=e.indexOf(`Output:
|
|
43
|
+
`);if(t===-1)return e;let n=ns(e.slice(t+8).trim());return Array.isArray(n)&&n.map(e=>q(K(e).text)).filter(Boolean).join(`
|
|
44
|
+
`)||e}function zl(e,t,n){let r=Jc(e,t,n),i=ps(e),o=q(K(t.metadataValue).namespace),c=e=>Z(e,n),u=e=>Ts(e,n);if(i===`skill`)return Yc(e,t,r,n);if(i===`js`&&(o===`mcp__node_repl__`||o===`mcp__node_repl__.js`)){let e=q(K(t.inputValue).title);return{...r,Icon:f,title:`Browser`,secondaryText:e||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:Rl(X(t)),language:`text`,isCode:!1}}}if(i===`exec_command`||i===`bash`){let e=kl(t.inputValue,X(t),Bc,c,u);return{...r,Icon:f,title:`bash`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.outputAnalysis.text,language:e.outputAnalysis.language,isCode:e.outputAnalysis.isCode}}}if(i===`write_stdin`){let e=Al(t.inputValue,X(t),Bc);return{...r,Icon:f,title:`bash`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.outputAnalysis.text,language:e.outputAnalysis.language,isCode:e.outputAnalysis.isCode}}}if(i===`request_user_input`){let e=jl(t.inputValue,X(t));return{...r,Icon:s,title:`ask`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:e.outputContent}}if(i===`patch`){let n=qo(t.inputValue),i=Yo(n);return{...r,Icon:l,title:ms(e,`patch`),secondaryText:i||void 0,details:[],showInputPreview:!1,outputContent:Qo(n,X(t),Bc,c)}}if(i===`update_plan`){let e=Ml(t.inputValue);return{...r,Icon:g,title:`update plan`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,contentLabel:`Plan`,outputContent:{kind:`task-list`,items:e.items}}}if(i===`web__run`){let e=Pl(t.inputValue);return{...r,Icon:_,title:e.title,secondaryText:e.secondaryText,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`markdown`,isCode:!1}}}if(i===`view_image`){let e=Fl(t.inputValue,c);return{...r,Icon:te,title:`view image`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`subagent`){let n=K(t.inputValue),i=ts(n.task_name),a=ts(n.model),o=ts(n.reasoning_effort),s=ts(n.fork_turns),c=ts(n.service_tier)===`priority`,l=X(t);return{...r,Icon:j,title:i||ms(e,`subagent`),secondaryText:void 0,details:[a?{label:`Model`,value:c?`${a} · Fast`:a}:null,o?{label:`Effort`,value:o}:null,s?{label:`Fork`,value:s}:null].filter(e=>e!==null),showInputPreview:!1,outputContent:{kind:`plain`,text:l,language:`markdown`,isCode:!1}}}if(i===`collaboration.send_message`||i===`collaboration.followup_task`){let e=K(t.inputValue),n=q(e.target),a=q(e.message);return{...r,Icon:d,title:i.endsWith(`followup_task`)?`follow up with agent`:`message agent`,secondaryText:n||void 0,details:[],showInputPreview:!1,contentLabel:`Message`,outputContent:{kind:`property-list`,items:[n?{label:`Recipient`,value:n}:null,a?{label:`Message`,value:a}:null].filter(e=>e!=null)}}}if(i===`collaboration.wait_agent`||i===`wait`){let e=K(t.inputValue).timeout_ms;return{...r,Icon:ue,title:`wait for agents`,secondaryText:typeof e==`number`?`${Math.round(e/1e3)}s timeout`:void 0,details:[],showInputPreview:!1,contentLabel:`Agent updates`}}if(i===`collaboration.list_agents`)return{...r,Icon:a,title:`list agents`,secondaryText:void 0,details:[],showInputPreview:!1,contentLabel:`Agent tree`};if(i===`collaboration.interrupt_agent`){let e=q(K(t.inputValue).target);return{...r,Icon:a,title:`interrupt agent`,secondaryText:e||void 0,details:[],showInputPreview:!1,contentLabel:`Result`}}if(i===`create_goal`||i===`get_goal`||i===`update_goal`){let e=K(t.inputValue);return{...r,Icon:C,title:Il(i),secondaryText:q(e.objective)||q(e.status)||void 0,details:[],showInputPreview:!1,contentLabel:`Goal state`}}if(o.startsWith(`mcp__`)||i.includes(`._`)){let e=K(t.inputValue),[n,a=`tool`]=i.split(`.`,2),o=Object.entries(e).map(([e,t])=>({label:e,value:t})),s=as(t.outputValue);return{...r,Icon:p,title:`${Il(n??`integration`)} · ${Il(a)}`,secondaryText:Ll(e)||void 0,details:[],showInputPreview:!1,contentLabel:s?`Result`:`Request`,outputContent:s??(o.length>0?{kind:`property-list`,items:o}:r.outputContent)}}return r}function Bl(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:typeof e==`string`&&ns(e)||{}}function Vl(e){let t=J(Bl(e).contents);return t?Y(t):`No output captured.`}function Hl(e){let t=Bl(e),n=Array.isArray(t.directories)?t.directories:[];if(n.length===0)return hs(e);let r=n.flatMap(e=>{let t=K(e);return[q(t.absPath),...(Array.isArray(t.files)?t.files:[]).map(e=>{let t=K(e);return q(t.relPath)||q(t.absPath)}).filter(Boolean).map(e=>` ${e}`)].filter(Boolean)});return r.length>0?r.join(`
|
|
45
|
+
`):`No output captured.`}function Ul(e,t,n){let r=Jc(e,t,n),i=e.tool.toLowerCase(),a=K(t.inputValue),o=ws(t.inputValue),s=Z(o,n);if(i===`read_file_v2`){let e=Vl(t.outputValue);return Gc({defaultStrategy:r,state:t,filePath:o,displayPath:s,text:e,details:e===`No output captured.`?[{label:`Lines`,value:q(Bl(t.outputValue).totalLinesInFile)}]:[],isCode:e!==`No output captured.`})}if(i===`edit_file_v2`){let e=Y(J(a.streamingContent));return qc({defaultStrategy:r,displayPath:s,outputContent:{kind:`plain`,text:e||X(t),language:e?`diff`:`text`,isCode:!!e}})}if(i===`ripgrep_raw_search`){let e=q(a.pattern),i=[Z(q(a.path),n),e].filter(Boolean).join(` · `);return{...r,Icon:_,title:`grep`,secondaryText:i||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}if(i===`glob_file_search`){let e=q(a.globPattern),i=[Z(q(a.targetDirectory),n),e].filter(Boolean).join(` · `);return{...r,Icon:_,title:`glob`,secondaryText:i||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:Hl(t.outputValue),language:`text`,isCode:!1}}}if(i===`run_terminal_command_v2`){let e=Ts(q(a.command),n),i=q(a.commandDescription),o=i?`${i}${e?` (${e})`:``}`:e?`(${e})`:void 0;return{...r,Icon:f,title:`bash`,secondaryText:o,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}return{...r,title:ms(e)}}function Wl(e){let t=K(e.inputValue),n=K(e.metadataValue),r=Array.isArray(n.tasks)?n.tasks:[],i=Number(t.id);return K(Number.isFinite(i)&&i>0?r.find(e=>Number(K(e).id)===i):r.at(-1))}function Gl(e){let t=X(e).match(/\(([^()]+?)\s*→\s*([^()]+?)\)/);return t?`${t[1]} -> ${t[2]}`:``}function Kl(e){let t=(e.split(`
|
|
44
46
|
`)[0]??``).match(/^Agent:\s*(.+)$/i),n=e.split(`
|
|
45
|
-
`).find(e=>e.includes(`Status:`)),r=[];return t?.[1]&&r.push({label:`Agent`,value:t[1].trim()}),n&&r.push({label:`Summary`,value:n.trim()}),r}function Vl(e,t,n){let r=Kc(e,t,n),i=e.tool.toLowerCase(),a=K(t.inputValue),o=K(t.metadataValue),s=Ss(t.inputValue),l=Z(s,n);if(i===`todo`){let e=q(a.action)||q(o.action)||`todo`,n=Rl(t),i=Number(n.id)||Number(a.id),s=q(n.subject)||q(a.subject),c=q(n.description)||q(a.description),l=q(n.status)||q(a.status),u=zl(t),d=[i?`#${i}`:``,s,e===`update`&&u?u:l].filter(Boolean);return{...r,Icon:g,title:e===`create`?`todo create`:e===`update`?`todo update`:`todo`,secondaryText:d.join(` · `)||void 0,details:[i?{label:`ID`,value:`#${i}`}:null,s?{label:`Subject`,value:s}:null,l?{label:`Status`,value:l}:null,u?{label:`Change`,value:u}:null].filter(e=>e!=null),showInputPreview:!1,outputContent:{kind:`plain`,text:c||X(t),language:`markdown`,isCode:!1}}}if(i===`read`)return Uc({defaultStrategy:r,state:t,filePath:s,displayPath:l});if(i===`write`)return Wc({defaultStrategy:r,state:t,filePath:s,displayPath:l,Icon:c});if(i===`edit`){let e=Mc(t,l||s),n=typeof o.firstChangedLine==`number`?String(o.firstChangedLine):J(o.firstChangedLine);return Gc({defaultStrategy:r,displayPath:l,details:n?[{label:`Line`,value:n}]:[],outputContent:e.length>0?{kind:`structured-diff`,blocks:e}:{kind:`plain`,text:X(t),language:`text`,isCode:!1}})}if(i===`agent`){let e=q(a.description)||q(o.description),n=q(a.subagent_type)||q(o.subagentType),i=q(o.agentId),s=q(o.status);return{...r,Icon:j,title:n?`agent · ${n}`:`agent`,secondaryText:[i?`#${i}`:``,e].filter(Boolean).join(` · `),details:[i?{label:`Agent`,value:i}:null,n?{label:`Type`,value:n}:null,s?{label:`Status`,value:s}:null].filter(e=>e!=null),showInputPreview:!1,outputContent:{kind:`plain`,text:J(a.prompt)||X(t),language:`markdown`,isCode:!1}}}if(i===`get_subagent_result`){let e=q(a.agent_id),n=X(t);return{...r,Icon:j,title:`subagent result`,secondaryText:e?`#${e}`:void 0,details:Bl(n),showInputPreview:!1,outputContent:{kind:`plain`,text:n,language:`markdown`,isCode:!1}}}if(i===`analyze_image`){let e=Array.isArray(a.images)?a.images.map(e=>J(e)).filter(Boolean):[],i=J(a.question);return{...r,Icon:te,title:`analyze image`,secondaryText:e.map(e=>Z(e,n)).join(`, `),details:[...e.map((e,t)=>({label:t===0?`Image`:`Image ${t+1}`,value:Z(e,n)})),i?{label:`Question`,value:i}:null].filter(e=>e!=null),showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`markdown`,isCode:!1}}}if(i===`bash`||i===`batch`){let e=Cs(q(a.command),n);return{...r,Icon:f,title:i===`batch`?`batch`:`bash`,secondaryText:e?`(${e})`:void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}return r}function Hl(e){return e.replace(/\s*[((](?:Recommended|推荐)[))]\s*$/i,``).trim()}function Ul(e){let t=new Map;return{text:e.map(e=>{let n=K(e),r=q(n.status)||`pending`,i=q(n.priority),a=q(n.content);t.set(r,(t.get(r)??0)+1);let o=r===`completed`?`x`:r===`in_progress`?`~`:` `,s=i?` _${i}_`:``;return`- [${o}] ${a||`(empty todo)`}${s}`}).join(`
|
|
46
|
-
`)
|
|
47
|
-
`).find(e=>e.trim())?.replace(/^#+\s*/,``)||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:e||d,language:`markdown`,isCode:!1}}}if(i===`websearch`){let e=q(a.query);return{...r,Icon:_,title:`web search`,secondaryText:e||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:d,language:`markdown`,isCode:!1}}}if(i===`skill`){let e=q(a.skill);return{...r,Icon:E,title:`skill`,secondaryText:e||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:d,language:`markdown`,isCode:!1}}}return r}var ql={claudecode:$c,opencode:el,kimi:tl,codex:Nl,cursor:Ll,pi:Vl,zcode:Kl};function Jl(e,t,n,r){return(ql[e.toLowerCase()]??Kc)(t,n,r)}function Yl(e,t){let n=0;return e.map(e=>{if(e.type!==`tool`)return e;let r=e.parts.map(()=>ks(t,n++));return{...e,anchorIds:r}})}function Xl(e){let t=[];for(let n of e){let e=Bo(n.parts);if(e.length===0)continue;let r=t.length;t.push({msg:n,blocks:Yl(e,r),index:r})}return t}function Zl({messages:e,agentName:t,fileActivity:n}){let r=Xl(gs(e,t)),i=$s(r),a=Ms(r);return{messages:r,toc:i,fileChangeSummary:Ns(n,a.summary),select(e){let t=rc(r,e),n=new Map(t.map((e,t)=>[e.index,t]));return{messages:t,timelineEntries:Hs(t),resolveListIndex(e){return n.get(e)}}},resolveMessageIndex(e){return a.anchorMessageIndexes.get(e)}}}function Ql({open:e,children:t,className:n}){return(0,W.jsx)(`div`,{className:we(`motion-collapsible`,n),"data-open":e||void 0,children:(0,W.jsx)(`div`,{className:`motion-collapsible-inner`,children:e?t():null})})}function $l(e){return e===0?`auto`:`smooth`}function eu(e,t){return e===`smooth`&&t?`auto`:e}function tu(e){return e.read.length+e.edit.length+e.write.length+e.delete.length}function nu({summary:e,baseDirectory:t,onJumpToAnchor:n}){let r=[{key:`read`,label:`Read`,Icon:_,items:e.read},{key:`edit`,label:`Edit`,Icon:l,items:e.edit},{key:`write`,label:`Write`,Icon:x,items:e.write},{key:`delete`,label:`Delete`,Icon:re,items:e.delete}].filter(e=>e.items.length>0);return r.length===0?null:(0,W.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`File Tracker`})]}),(0,W.jsx)(`div`,{className:`space-y-3 p-3`,children:r.map(({key:e,label:r,Icon:i,items:a})=>(0,W.jsx)(ru,{label:r,Icon:i,items:a,baseDirectory:t,onJumpToAnchor:n},e))})]})}function ru({label:e,Icon:t,items:n,baseDirectory:r,onJumpToAnchor:i}){let[a,o]=(0,G.useState)(!1);return(0,W.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`motion-hover flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(t,{className:`size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--console-muted)]`,children:e}),(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:n.length}),(0,W.jsx)(w,{className:`motion-chevron size-3.5 shrink-0 text-[var(--console-muted)]`,"data-open":a||void 0})]}),(0,W.jsx)(Ql,{open:a,children:()=>(0,W.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] p-2`,children:n.map(e=>(0,W.jsx)(iu,{item:e,baseDirectory:r,onJumpToAnchor:i},`${e.path}:${e.latestAnchorId||e.latestTime}`))})})]})}function iu({item:e,baseDirectory:t,onJumpToAnchor:n}){let[r,i]=(0,G.useState)(0);function a(t,r){let a=e.anchors.length;if(a===0)return;let o=(t%a+a)%a;i(o);let s=e.anchors[o];s&&n(s.anchorId,r)}return(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm px-2 py-2 motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(`button`,{type:`button`,title:e.path,onClick:e=>a(r,$l(e.detail)),className:`min-w-0 flex-1 text-left`,children:(0,W.jsx)(`span`,{className:`console-mono block break-all text-xs text-[var(--console-text)]`,children:ws(e.path,t)})}),e.anchors.length>1?(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":`Previous ${e.path}`,onClick:e=>a(r-1,$l(e.detail)),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] motion-hover hover:bg-[var(--console-surface)]`,children:(0,W.jsx)(T,{className:`size-3`})}),(0,W.jsxs)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:[r+1,`/`,e.anchors.length]}),(0,W.jsx)(`button`,{type:`button`,"aria-label":`Next ${e.path}`,onClick:e=>a(r+1,$l(e.detail)),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] motion-hover hover:bg-[var(--console-surface)]`,children:(0,W.jsx)(w,{className:`size-3`})})]}):(0,W.jsx)(`button`,{type:`button`,title:`Jump to tool call`,onClick:e=>a(0,$l(e.detail)),className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:e.count})]})}var au=[{id:`user`,label:`User`},{id:`agent_message`,label:`Agent Responses`},{id:`thinking`,label:`Thinking`},{id:`plan`,label:`Plans`},{id:`tools_all`,label:`Tools`}];function ou(e){return e.tools.map(e=>e.id)}function su(e,t,n){let r=new Set(e),i=ou(n);if(t===`tools_all`){if(i.filter(e=>r.has(e)).length<i.length){r.add(`tools_all`);for(let e of i)r.add(e)}else{r.delete(`tools_all`);for(let e of i)r.delete(e)}return r}return t.startsWith(`tool:`)?(r.has(t)?r.delete(t):r.add(t),i.filter(e=>r.has(e)).length===i.length?r.add(`tools_all`):r.delete(`tools_all`),r):(r.has(t)?r.delete(t):r.add(t),r)}function cu({checked:e,indeterminate:t=!1,onChange:n}){let r=(0,G.useRef)(null);return(0,G.useLayoutEffect)(()=>{r.current&&(r.current.indeterminate=t)},[t]),(0,W.jsxs)(`span`,{className:`relative mt-0.5 size-3.5 shrink-0`,children:[(0,W.jsx)(`input`,{ref:r,type:`checkbox`,checked:e,"aria-checked":t?`mixed`:e,"data-indeterminate":t?`true`:void 0,onChange:n,className:`absolute inset-0 z-10 size-full cursor-pointer opacity-0`}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-3.5 items-center justify-center rounded border ${e||t?`border-[var(--console-accent-strong)] bg-[var(--console-accent-strong)] text-white dark:text-[var(--console-bg)]`:`border-[var(--console-border-strong)] bg-[var(--console-surface)] text-transparent`}`,children:t?(0,W.jsx)(m,{className:`size-2.5 stroke-[3]`}):e?(0,W.jsx)(O,{className:`size-2.5 stroke-[3]`}):null})]})}function lu({toc:e,fileChangeSummary:t,baseDirectory:n,selectedFilters:r,onToggle:i,onJumpToAnchor:a}){return(0,W.jsx)(`aside`,{className:`console-scrollbar hidden min-[1025px]:sticky min-[1025px]:top-4 min-[1025px]:block min-[1025px]:max-h-[calc(100dvh-14rem)] min-[1025px]:overflow-y-auto min-[1025px]:overscroll-contain`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(uu,{toc:e,selectedFilters:r,onToggle:i}),(0,W.jsx)(nu,{summary:t,baseDirectory:n,onJumpToAnchor:a})]})})}function uu({toc:e,selectedFilters:t,onToggle:n}){let r=ou(e),i=r.filter(e=>t.has(e)).length,a=r.length>0&&i===r.length,s=i>0&&i<r.length;return(0,W.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,W.jsx)(o,{className:`size-3.5 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`Session TOC`})]}),(0,W.jsxs)(`div`,{className:`space-y-1 p-3`,children:[au.filter(({id:t})=>e.counts[t]>0).map(({id:r,label:i})=>(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-sm px-2 py-2 motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(cu,{checked:r===`tools_all`?a:t.has(r),indeterminate:r===`tools_all`&&s,onChange:()=>n(r)}),(0,W.jsx)(`span`,{className:`console-mono min-w-0 flex-1 break-all text-xs leading-relaxed text-[var(--console-text)]`,children:i}),(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:e.counts[r]})]},r)),e.tools.length>0?(0,W.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] pt-2`,children:e.tools.map(e=>(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-sm px-2 py-2 motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(cu,{checked:t.has(e.id),onChange:()=>n(e.id)}),(0,W.jsx)(`span`,{className:`console-mono min-w-0 flex-1 break-all text-xs leading-relaxed text-[var(--console-text)]`,children:e.label}),(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:e.count})]},e.id))}):null]})]})}var du=(0,G.lazy)(()=>pe(()=>import(`./PrismHighlighter-C7OfXHq2.js`).then(e=>({default:e.PrismHighlighter})),__vite__mapDeps([0,1,2,3])));function fu({text:e}){return(0,W.jsx)(`pre`,{className:`console-mono m-0 overflow-x-auto whitespace-pre-wrap break-words p-3 text-xs leading-relaxed`,style:{background:`transparent`},children:e})}function pu({language:e,text:t}){return(0,W.jsx)(he,{fallback:(0,W.jsx)(fu,{text:t}),children:(0,W.jsx)(G.Suspense,{fallback:(0,W.jsx)(fu,{text:t}),children:(0,W.jsx)(du,{language:e,text:t})})})}function mu(e,t){return`${e}:${t}`}function hu(e){return/^(Index:|diff\s|===)/.test(e)?`text-[var(--console-text)] bg-[#f3f4f6] dark:bg-[var(--console-surface-muted)]`:e.startsWith(`@@`)?`text-[#7c3aed] bg-[#f5f3ff] dark:text-[var(--tag-refactoring-text)] dark:bg-[var(--tag-refactoring-background)]`:e.startsWith(`+++ `)||e.startsWith(`--- `)?`text-[#1d4ed8] bg-[#eff6ff] dark:text-[var(--tag-feature-dev-text)] dark:bg-[var(--tag-feature-dev-background)]`:e.startsWith(`+`)?`text-[#15803d] bg-[#f0fdf4] dark:text-[var(--console-success)] dark:bg-[var(--console-success-bg)]`:e.startsWith(`-`)?`text-[#b91c1c] bg-[#fef2f2] dark:text-[var(--console-error)] dark:bg-[var(--console-error-bg)]`:`text-[var(--console-text)]`}function gu({text:e}){let t=e.split(`
|
|
48
|
-
`),n=new Map;return(0,W.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] p-3 text-xs leading-relaxed`,children:t.map(e=>{let t=n.get(e)??0;return n.set(e,t+1),(0,W.jsx)(`span`,{className:`block rounded-[2px] px-1 ${hu(e)}`,children:e||` `},mu(e,t))})})}function _u(e){let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,W.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-all p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,W.jsx)(gu,{text:t}):(0,W.jsx)(`div`,{className:`max-h-[420px] overflow-auto bg-[var(--console-surface-sunken)]`,children:(0,W.jsx)(pu,{language:e.language,text:t})})}function vu({sections:e}){return(0,W.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.operation}),(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})]})}),_u(e)]},`${e.operation}:${e.label}:${e.language}`))})}function yu({items:e,text:t}){return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(`div`,{className:`grid gap-3 ${e.length>1?`sm:grid-cols-2`:``}`,children:e.map((e,t)=>(0,W.jsxs)(`figure`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] w-full object-contain`,loading:`lazy`}),e.caption?(0,W.jsx)(`figcaption`,{className:`console-mono border-t border-[var(--console-border)] px-3 py-2 text-[11px] text-[var(--console-muted)]`,children:e.caption}):null]},`${e.src.slice(0,80)}:${t}`))}),t?(0,W.jsx)(`pre`,{className:`console-mono whitespace-pre-wrap break-words rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):null]})}function bu(e){return e==null||e===``?`—`:typeof e==`boolean`?e?`Yes`:`No`:typeof e==`string`||typeof e==`number`||typeof e==`bigint`?String(e):null}function xu({value:e,depth:t=0}){let n=bu(e);return n==null?Array.isArray(e)?t>=2?(0,W.jsxs)(`span`,{children:[e.length,` items`]}):(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,n)=>(0,W.jsx)(`span`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5`,children:(0,W.jsx)(xu,{value:e,depth:t+1})},n))}):typeof e==`object`?t>=2?(0,W.jsxs)(`span`,{children:[Object.keys(e).length,` fields`]}):(0,W.jsx)(`dl`,{className:`space-y-1.5`,children:Object.entries(e).map(([e,n])=>(0,W.jsxs)(`div`,{className:`grid grid-cols-[minmax(80px,auto)_1fr] gap-2`,children:[(0,W.jsx)(`dt`,{className:`text-[var(--console-muted)]`,children:e}),(0,W.jsx)(`dd`,{className:`min-w-0`,children:(0,W.jsx)(xu,{value:n,depth:t+1})})]},e))}):(0,W.jsx)(`span`,{children:String(e)}):(0,W.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:n})}function Su({items:e}){return(0,W.jsx)(`dl`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`grid gap-1 border-b border-[var(--console-border)] px-3 py-2.5 last:border-b-0 sm:grid-cols-[130px_1fr] sm:gap-3`,children:[(0,W.jsx)(`dt`,{className:`console-mono text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.label}),(0,W.jsx)(`dd`,{className:`console-mono min-w-0 text-xs leading-relaxed text-[var(--console-text)]`,children:(0,W.jsx)(xu,{value:e.value})})]},e.label))})}function Cu({questions:e}){return(0,W.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsxs)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.header?(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.header}):null,e.answers.length>0?(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-success)]`,children:`Answered`}):(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:`Pending`})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-[var(--console-text)]`,children:e.question})]}),(0,W.jsx)(`div`,{className:`space-y-2 p-3`,children:e.options.map(t=>{let n=e.answers.includes(t.label);return(0,W.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 ${n?`border-[var(--console-success-border)] bg-[var(--console-success-bg)]`:`border-[var(--console-border)] bg-[var(--console-surface)]`}`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`console-mono text-xs font-semibold ${n?`text-[var(--console-success)]`:`text-[var(--console-text)]`}`,children:t.label}),t.recommended?(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:`Recommended`}):null,n?(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-success-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] text-[var(--console-success)]`,children:`Selected`}):null]}),t.description?(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-[var(--console-muted)]`,children:t.description}):null]},`${e.question}:${t.label}`)})})]},`${e.header??`question`}:${e.question}`))})}function wu(e){return`${e.label}:${e.lines.map(e=>`${e.type}:${e.text}`).join(`
|
|
49
|
-
`)}`}function Tu(e){return e===`add`?`text-[#15803d] bg-[#f0fdf4] dark:text-[var(--console-success)] dark:bg-[var(--console-success-bg)]`:e===`remove`?`text-[#b91c1c] bg-[#fef2f2] dark:text-[var(--console-error)] dark:bg-[var(--console-error-bg)]`:`text-[var(--console-text)]`}function Eu({blocks:e}){return(0,W.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let t=new Map;return(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})}),(0,W.jsx)(`pre`,{className:`console-mono max-h-[280px] overflow-auto whitespace-pre p-3 text-xs leading-relaxed`,children:e.lines.map(e=>{let n=`${e.type}:${e.text}`,r=t.get(n)??0;return t.set(n,r+1),(0,W.jsxs)(`span`,{className:`block rounded-[2px] px-1 ${Tu(e.type)}`,children:[e.type===`add`?`+`:e.type===`remove`?`-`:` `,e.text||` `]},`${n}:${r}`)})})]},wu(e))})})}var Du={completed:{Icon:O,label:`Done`,className:`text-[var(--console-success)]`},error:{Icon:ce,label:`Failed`,className:`text-[var(--console-error)]`},in_progress:{Icon:b,label:`In progress`,className:`text-[var(--console-warning)]`},pending:{Icon:de,label:`Pending`,className:`text-[var(--console-muted)]`}};function Ou({items:e}){return(0,W.jsx)(`ol`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)]`,children:e.map((e,t)=>{let n=Du[e.status];return(0,W.jsxs)(`li`,{className:`flex gap-3 border-b border-[var(--console-border)] px-3 py-2.5 last:border-b-0`,children:[(0,W.jsx)(n.Icon,{className:`mt-0.5 size-3.5 shrink-0 ${n.className}`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium leading-relaxed text-[var(--console-text)]`,children:e.label}),(0,W.jsx)(`span`,{className:`console-mono text-[10px] uppercase tracking-wide ${n.className}`,children:n.label})]}),e.detail?(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-[var(--console-muted)]`,children:e.detail}):null]})]},`${e.label}:${t}`)})})}function ku({outputContent:e}){if(e.kind===`structured-diff`)return(0,W.jsx)(Eu,{blocks:e.blocks});if(e.kind===`file-sections`)return(0,W.jsx)(vu,{sections:e.sections});if(e.kind===`question-list`)return(0,W.jsx)(Cu,{questions:e.questions});if(e.kind===`task-list`)return(0,W.jsx)(Ou,{items:e.items});if(e.kind===`media`)return(0,W.jsx)(yu,{items:e.items,text:e.text});if(e.kind===`property-list`)return(0,W.jsx)(Su,{items:e.items});let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,W.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,W.jsx)(gu,{text:t}):(0,W.jsx)(`div`,{className:`max-h-[420px] overflow-auto rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:(0,W.jsx)(pu,{language:e.language,text:t})})}var Au=`<turn_aborted>
|
|
47
|
+
`).find(e=>e.includes(`Status:`)),r=[];return t?.[1]&&r.push({label:`Agent`,value:t[1].trim()}),n&&r.push({label:`Summary`,value:n.trim()}),r}function ql(e,t,n){let r=Jc(e,t,n),i=e.tool.toLowerCase(),a=K(t.inputValue),o=K(t.metadataValue),s=ws(t.inputValue),l=Z(s,n);if(i===`todo`){let e=q(a.action)||q(o.action)||`todo`,n=Wl(t),i=Number(n.id)||Number(a.id),s=q(n.subject)||q(a.subject),c=q(n.description)||q(a.description),l=q(n.status)||q(a.status),u=Gl(t),d=[i?`#${i}`:``,s,e===`update`&&u?u:l].filter(Boolean);return{...r,Icon:g,title:e===`create`?`todo create`:e===`update`?`todo update`:`todo`,secondaryText:d.join(` · `)||void 0,details:[i?{label:`ID`,value:`#${i}`}:null,s?{label:`Subject`,value:s}:null,l?{label:`Status`,value:l}:null,u?{label:`Change`,value:u}:null].filter(e=>e!=null),showInputPreview:!1,outputContent:{kind:`plain`,text:c||X(t),language:`markdown`,isCode:!1}}}if(i===`read`)return Gc({defaultStrategy:r,state:t,filePath:s,displayPath:l});if(i===`write`)return Kc({defaultStrategy:r,state:t,filePath:s,displayPath:l,Icon:c});if(i===`edit`){let e=Pc(t,l||s),n=typeof o.firstChangedLine==`number`?String(o.firstChangedLine):J(o.firstChangedLine);return qc({defaultStrategy:r,displayPath:l,details:n?[{label:`Line`,value:n}]:[],outputContent:e.length>0?{kind:`structured-diff`,blocks:e}:{kind:`plain`,text:X(t),language:`text`,isCode:!1}})}if(i===`agent`){let e=q(a.description)||q(o.description),n=q(a.subagent_type)||q(o.subagentType),i=q(o.agentId),s=q(o.status);return{...r,Icon:j,title:n?`agent · ${n}`:`agent`,secondaryText:[i?`#${i}`:``,e].filter(Boolean).join(` · `),details:[i?{label:`Agent`,value:i}:null,n?{label:`Type`,value:n}:null,s?{label:`Status`,value:s}:null].filter(e=>e!=null),showInputPreview:!1,outputContent:{kind:`plain`,text:J(a.prompt)||X(t),language:`markdown`,isCode:!1}}}if(i===`get_subagent_result`){let e=q(a.agent_id),n=X(t);return{...r,Icon:j,title:`subagent result`,secondaryText:e?`#${e}`:void 0,details:Kl(n),showInputPreview:!1,outputContent:{kind:`plain`,text:n,language:`markdown`,isCode:!1}}}if(i===`analyze_image`){let e=Array.isArray(a.images)?a.images.map(e=>J(e)).filter(Boolean):[],i=J(a.question);return{...r,Icon:te,title:`analyze image`,secondaryText:e.map(e=>Z(e,n)).join(`, `),details:[...e.map((e,t)=>({label:t===0?`Image`:`Image ${t+1}`,value:Z(e,n)})),i?{label:`Question`,value:i}:null].filter(e=>e!=null),showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`markdown`,isCode:!1}}}if(i===`bash`||i===`batch`){let e=Ts(q(a.command),n);return{...r,Icon:f,title:i===`batch`?`batch`:`bash`,secondaryText:e?`(${e})`:void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:X(t),language:`text`,isCode:!1}}}return r}var Jl={claudecode:tl,opencode:nl,kimi:rl,"kimi-code":ll,codex:zl,cursor:Ul,pi:ql,zcode:cl};function Yl(e,t,n,r){return(Jl[e.toLowerCase()]??Jc)(t,n,r)}function Xl(e,t){let n=0;return e.map(e=>{if(e.type!==`tool`)return e;let r=e.parts.map(()=>js(t,n++));return{...e,anchorIds:r}})}function Zl(e){let t=[];for(let n of e){let e=Ho(n.parts);if(e.length===0)continue;let r=t.length;t.push({msg:n,blocks:Xl(e,r),index:r})}return t}function Ql({messages:e,agentName:t,fileActivity:n}){let r=Zl(vs(e,t)),i=tc(r),a=Ps(r);return{messages:r,toc:i,fileChangeSummary:Fs(n,a.summary),select(e){let t=ac(r,e),n=new Map(t.map((e,t)=>[e.index,t]));return{messages:t,timelineEntries:Ws(t),resolveListIndex(e){return n.get(e)}}},resolveMessageIndex(e){return a.anchorMessageIndexes.get(e)}}}function $l({open:e,children:t,className:n}){return(0,W.jsx)(`div`,{className:Ee(`motion-collapsible`,n),"data-open":e||void 0,children:(0,W.jsx)(`div`,{className:`motion-collapsible-inner`,children:e?t():null})})}function eu(e){return e===0?`auto`:`smooth`}function tu(e,t){return e===`smooth`&&t?`auto`:e}function nu(e){return e.read.length+e.edit.length+e.write.length+e.delete.length}function ru({summary:e,baseDirectory:t,onJumpToAnchor:n}){let r=[{key:`read`,label:`Read`,Icon:_,items:e.read},{key:`edit`,label:`Edit`,Icon:l,items:e.edit},{key:`write`,label:`Write`,Icon:x,items:e.write},{key:`delete`,label:`Delete`,Icon:re,items:e.delete}].filter(e=>e.items.length>0);return r.length===0?null:(0,W.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`File Tracker`})]}),(0,W.jsx)(`div`,{className:`space-y-3 p-3`,children:r.map(({key:e,label:r,Icon:i,items:a})=>(0,W.jsx)(iu,{label:r,Icon:i,items:a,baseDirectory:t,onJumpToAnchor:n},e))})]})}function iu({label:e,Icon:t,items:n,baseDirectory:r,onJumpToAnchor:i}){let[a,o]=(0,G.useState)(!1);return(0,W.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`motion-hover flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(t,{className:`size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--console-muted)]`,children:e}),(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:n.length}),(0,W.jsx)(w,{className:`motion-chevron size-3.5 shrink-0 text-[var(--console-muted)]`,"data-open":a||void 0})]}),(0,W.jsx)($l,{open:a,children:()=>(0,W.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] p-2`,children:n.map(e=>(0,W.jsx)(au,{item:e,baseDirectory:r,onJumpToAnchor:i},`${e.path}:${e.latestAnchorId||e.latestTime}`))})})]})}function au({item:e,baseDirectory:t,onJumpToAnchor:n}){let[r,i]=(0,G.useState)(0);function a(t,r){let a=e.anchors.length;if(a===0)return;let o=(t%a+a)%a;i(o);let s=e.anchors[o];s&&n(s.anchorId,r)}return(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm px-2 py-2 motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(`button`,{type:`button`,title:e.path,onClick:e=>a(r,eu(e.detail)),className:`min-w-0 flex-1 text-left`,children:(0,W.jsx)(`span`,{className:`console-mono block break-all text-xs text-[var(--console-text)]`,children:Es(e.path,t)})}),e.anchors.length>1?(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":`Previous ${e.path}`,onClick:e=>a(r-1,eu(e.detail)),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] motion-hover hover:bg-[var(--console-surface)]`,children:(0,W.jsx)(T,{className:`size-3`})}),(0,W.jsxs)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:[r+1,`/`,e.anchors.length]}),(0,W.jsx)(`button`,{type:`button`,"aria-label":`Next ${e.path}`,onClick:e=>a(r+1,eu(e.detail)),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] motion-hover hover:bg-[var(--console-surface)]`,children:(0,W.jsx)(w,{className:`size-3`})})]}):(0,W.jsx)(`button`,{type:`button`,title:`Jump to tool call`,onClick:e=>a(0,eu(e.detail)),className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:e.count})]})}var ou=[{id:`user`,label:`User`},{id:`agent_message`,label:`Agent Responses`},{id:`thinking`,label:`Thinking`},{id:`plan`,label:`Plans`},{id:`tools_all`,label:`Tools`}];function su(e){return e.tools.map(e=>e.id)}function cu(e,t,n){let r=new Set(e),i=su(n);if(t===`tools_all`){if(i.filter(e=>r.has(e)).length<i.length){r.add(`tools_all`);for(let e of i)r.add(e)}else{r.delete(`tools_all`);for(let e of i)r.delete(e)}return r}return t.startsWith(`tool:`)?(r.has(t)?r.delete(t):r.add(t),i.filter(e=>r.has(e)).length===i.length?r.add(`tools_all`):r.delete(`tools_all`),r):(r.has(t)?r.delete(t):r.add(t),r)}function lu({checked:e,indeterminate:t=!1,onChange:n}){let r=(0,G.useRef)(null);return(0,G.useLayoutEffect)(()=>{r.current&&(r.current.indeterminate=t)},[t]),(0,W.jsxs)(`span`,{className:`relative mt-0.5 size-3.5 shrink-0`,children:[(0,W.jsx)(`input`,{ref:r,type:`checkbox`,checked:e,"aria-checked":t?`mixed`:e,"data-indeterminate":t?`true`:void 0,onChange:n,className:`absolute inset-0 z-10 size-full cursor-pointer opacity-0`}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-3.5 items-center justify-center rounded border ${e||t?`border-[var(--console-accent-strong)] bg-[var(--console-accent-strong)] text-white dark:text-[var(--console-bg)]`:`border-[var(--console-border-strong)] bg-[var(--console-surface)] text-transparent`}`,children:t?(0,W.jsx)(m,{className:`size-2.5 stroke-[3]`}):e?(0,W.jsx)(O,{className:`size-2.5 stroke-[3]`}):null})]})}function uu({toc:e,fileChangeSummary:t,baseDirectory:n,selectedFilters:r,onToggle:i,onJumpToAnchor:a}){return(0,W.jsx)(`aside`,{className:`console-scrollbar hidden min-[1025px]:sticky min-[1025px]:top-4 min-[1025px]:block min-[1025px]:max-h-[calc(100dvh-14rem)] min-[1025px]:overflow-y-auto min-[1025px]:overscroll-contain`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(du,{toc:e,selectedFilters:r,onToggle:i}),(0,W.jsx)(ru,{summary:t,baseDirectory:n,onJumpToAnchor:a})]})})}function du({toc:e,selectedFilters:t,onToggle:n}){let r=su(e),i=r.filter(e=>t.has(e)).length,a=r.length>0&&i===r.length,s=i>0&&i<r.length;return(0,W.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,W.jsx)(o,{className:`size-3.5 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`Session TOC`})]}),(0,W.jsxs)(`div`,{className:`space-y-1 p-3`,children:[ou.filter(({id:t})=>e.counts[t]>0).map(({id:r,label:i})=>(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-sm px-2 py-2 motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(lu,{checked:r===`tools_all`?a:t.has(r),indeterminate:r===`tools_all`&&s,onChange:()=>n(r)}),(0,W.jsx)(`span`,{className:`console-mono min-w-0 flex-1 break-all text-xs leading-relaxed text-[var(--console-text)]`,children:i}),(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:e.counts[r]})]},r)),e.tools.length>0?(0,W.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] pt-2`,children:e.tools.map(e=>(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-sm px-2 py-2 motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(lu,{checked:t.has(e.id),onChange:()=>n(e.id)}),(0,W.jsx)(`span`,{className:`console-mono min-w-0 flex-1 break-all text-xs leading-relaxed text-[var(--console-text)]`,children:e.label}),(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:e.count})]},e.id))}):null]})]})}var fu=(0,G.lazy)(()=>me(()=>import(`./PrismHighlighter-C7OfXHq2.js`).then(e=>({default:e.PrismHighlighter})),__vite__mapDeps([0,1,2,3])));function pu({text:e}){return(0,W.jsx)(`pre`,{className:`console-mono m-0 overflow-x-auto whitespace-pre-wrap break-words p-3 text-xs leading-relaxed`,style:{background:`transparent`},children:e})}function mu({language:e,text:t}){return(0,W.jsx)(_e,{fallback:(0,W.jsx)(pu,{text:t}),children:(0,W.jsx)(G.Suspense,{fallback:(0,W.jsx)(pu,{text:t}),children:(0,W.jsx)(fu,{language:e,text:t})})})}function hu(e,t){return`${e}:${t}`}function gu(e){return/^(Index:|diff\s|===)/.test(e)?`text-[var(--console-text)] bg-[#f3f4f6] dark:bg-[var(--console-surface-muted)]`:e.startsWith(`@@`)?`text-[#7c3aed] bg-[#f5f3ff] dark:text-[var(--tag-refactoring-text)] dark:bg-[var(--tag-refactoring-background)]`:e.startsWith(`+++ `)||e.startsWith(`--- `)?`text-[#1d4ed8] bg-[#eff6ff] dark:text-[var(--tag-feature-dev-text)] dark:bg-[var(--tag-feature-dev-background)]`:e.startsWith(`+`)?`text-[#15803d] bg-[#f0fdf4] dark:text-[var(--console-success)] dark:bg-[var(--console-success-bg)]`:e.startsWith(`-`)?`text-[#b91c1c] bg-[#fef2f2] dark:text-[var(--console-error)] dark:bg-[var(--console-error-bg)]`:`text-[var(--console-text)]`}function _u({text:e}){let t=e.split(`
|
|
48
|
+
`),n=new Map;return(0,W.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] p-3 text-xs leading-relaxed`,children:t.map(e=>{let t=n.get(e)??0;return n.set(e,t+1),(0,W.jsx)(`span`,{className:`block rounded-[2px] px-1 ${gu(e)}`,children:e||` `},hu(e,t))})})}function vu(e){let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,W.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-all p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,W.jsx)(_u,{text:t}):(0,W.jsx)(`div`,{className:`max-h-[420px] overflow-auto bg-[var(--console-surface-sunken)]`,children:(0,W.jsx)(mu,{language:e.language,text:t})})}function yu({sections:e}){return(0,W.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.operation}),(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})]})}),vu(e)]},`${e.operation}:${e.label}:${e.language}`))})}function bu({items:e,text:t}){return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(`div`,{className:`grid gap-3 ${e.length>1?`sm:grid-cols-2`:``}`,children:e.map((e,t)=>(0,W.jsxs)(`figure`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] w-full object-contain`,loading:`lazy`}),e.caption?(0,W.jsx)(`figcaption`,{className:`console-mono border-t border-[var(--console-border)] px-3 py-2 text-[11px] text-[var(--console-muted)]`,children:e.caption}):null]},`${e.src.slice(0,80)}:${t}`))}),t?(0,W.jsx)(`pre`,{className:`console-mono whitespace-pre-wrap break-words rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):null]})}function xu(e){return e==null||e===``?`—`:typeof e==`boolean`?e?`Yes`:`No`:typeof e==`string`||typeof e==`number`||typeof e==`bigint`?String(e):null}function Su({value:e,depth:t=0}){let n=xu(e);return n==null?Array.isArray(e)?t>=2?(0,W.jsxs)(`span`,{children:[e.length,` items`]}):(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,n)=>(0,W.jsx)(`span`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5`,children:(0,W.jsx)(Su,{value:e,depth:t+1})},n))}):typeof e==`object`?t>=2?(0,W.jsxs)(`span`,{children:[Object.keys(e).length,` fields`]}):(0,W.jsx)(`dl`,{className:`space-y-1.5`,children:Object.entries(e).map(([e,n])=>(0,W.jsxs)(`div`,{className:`grid grid-cols-[minmax(80px,auto)_1fr] gap-2`,children:[(0,W.jsx)(`dt`,{className:`text-[var(--console-muted)]`,children:e}),(0,W.jsx)(`dd`,{className:`min-w-0`,children:(0,W.jsx)(Su,{value:n,depth:t+1})})]},e))}):(0,W.jsx)(`span`,{children:String(e)}):(0,W.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:n})}function Cu({items:e}){return(0,W.jsx)(`dl`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`grid gap-1 border-b border-[var(--console-border)] px-3 py-2.5 last:border-b-0 sm:grid-cols-[130px_1fr] sm:gap-3`,children:[(0,W.jsx)(`dt`,{className:`console-mono text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.label}),(0,W.jsx)(`dd`,{className:`console-mono min-w-0 text-xs leading-relaxed text-[var(--console-text)]`,children:(0,W.jsx)(Su,{value:e.value})})]},e.label))})}function wu({questions:e}){return(0,W.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsxs)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.header?(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.header}):null,e.answers.length>0?(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-success)]`,children:`Answered`}):(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:`Pending`})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-[var(--console-text)]`,children:e.question})]}),(0,W.jsx)(`div`,{className:`space-y-2 p-3`,children:e.options.map(t=>{let n=e.answers.includes(t.label);return(0,W.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 ${n?`border-[var(--console-success-border)] bg-[var(--console-success-bg)]`:`border-[var(--console-border)] bg-[var(--console-surface)]`}`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`console-mono text-xs font-semibold ${n?`text-[var(--console-success)]`:`text-[var(--console-text)]`}`,children:t.label}),t.recommended?(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:`Recommended`}):null,n?(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-success-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] text-[var(--console-success)]`,children:`Selected`}):null]}),t.description?(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-[var(--console-muted)]`,children:t.description}):null]},`${e.question}:${t.label}`)})})]},`${e.header??`question`}:${e.question}`))})}function Tu(e){return`${e.label}:${e.lines.map(e=>`${e.type}:${e.text}`).join(`
|
|
49
|
+
`)}`}function Eu(e){return e===`add`?`text-[#15803d] bg-[#f0fdf4] dark:text-[var(--console-success)] dark:bg-[var(--console-success-bg)]`:e===`remove`?`text-[#b91c1c] bg-[#fef2f2] dark:text-[var(--console-error)] dark:bg-[var(--console-error-bg)]`:`text-[var(--console-text)]`}function Du({blocks:e}){return(0,W.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let t=new Map;return(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})}),(0,W.jsx)(`pre`,{className:`console-mono max-h-[280px] overflow-auto whitespace-pre p-3 text-xs leading-relaxed`,children:e.lines.map(e=>{let n=`${e.type}:${e.text}`,r=t.get(n)??0;return t.set(n,r+1),(0,W.jsxs)(`span`,{className:`block rounded-[2px] px-1 ${Eu(e.type)}`,children:[e.type===`add`?`+`:e.type===`remove`?`-`:` `,e.text||` `]},`${n}:${r}`)})})]},Tu(e))})})}var Ou={completed:{Icon:O,label:`Done`,className:`text-[var(--console-success)]`},error:{Icon:ce,label:`Failed`,className:`text-[var(--console-error)]`},in_progress:{Icon:b,label:`In progress`,className:`text-[var(--console-warning)]`},pending:{Icon:de,label:`Pending`,className:`text-[var(--console-muted)]`}};function ku({items:e}){return(0,W.jsx)(`ol`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)]`,children:e.map((e,t)=>{let n=Ou[e.status];return(0,W.jsxs)(`li`,{className:`flex gap-3 border-b border-[var(--console-border)] px-3 py-2.5 last:border-b-0`,children:[(0,W.jsx)(n.Icon,{className:`mt-0.5 size-3.5 shrink-0 ${n.className}`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium leading-relaxed text-[var(--console-text)]`,children:e.label}),(0,W.jsx)(`span`,{className:`console-mono text-[10px] uppercase tracking-wide ${n.className}`,children:n.label})]}),e.detail?(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-[var(--console-muted)]`,children:e.detail}):null]})]},`${e.label}:${t}`)})})}function Au({outputContent:e}){if(e.kind===`structured-diff`)return(0,W.jsx)(Du,{blocks:e.blocks});if(e.kind===`file-sections`)return(0,W.jsx)(yu,{sections:e.sections});if(e.kind===`question-list`)return(0,W.jsx)(wu,{questions:e.questions});if(e.kind===`task-list`)return(0,W.jsx)(ku,{items:e.items});if(e.kind===`media`)return(0,W.jsx)(bu,{items:e.items,text:e.text});if(e.kind===`property-list`)return(0,W.jsx)(Cu,{items:e.items});let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,W.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,W.jsx)(_u,{text:t}):(0,W.jsx)(`div`,{className:`max-h-[420px] overflow-auto rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)]`,children:(0,W.jsx)(mu,{language:e.language,text:t})})}var ju=`<turn_aborted>
|
|
50
50
|
The user interrupted the previous turn on purpose. Any running unified exec processes were terminated. If any tools/commands were aborted, they may have partially executed; verify current state before retrying.
|
|
51
|
-
</turn_aborted>`;function
|
|
52
|
-
`).trim()}function
|
|
51
|
+
</turn_aborted>`;function Mu(e){return e.replace(/\r\n/g,`
|
|
52
|
+
`).trim()}function Nu(e,t){if(t.toLowerCase()!==`codex`||e.role!==`user`||e.parts.length!==1)return!1;let[n]=e.parts;return!n||n.type!==`text`?!1:Mu(n.text)===Mu(ju)}function Pu(e){let t=e.approval_status===`fail`?`fail`:`success`,n=e.text.trim();return{title:`plan`,secondaryText:void 0,approvalStatus:t,expandable:!!n,contentLabel:t===`fail`?`Rejected`:`Plan`,contentMarkdown:n}}var Fu={completed:{label:`Success`,className:`border-[var(--console-success-border)] bg-[var(--console-success-bg)] text-[var(--console-success)]`,icon:D},error:{label:`Failed`,className:`border-[var(--console-error-border)] bg-[var(--console-error-bg)] text-[var(--console-error)]`,icon:re},running:{label:`Running`,className:`border-[var(--console-warning-border)] bg-[var(--console-warning-bg)] text-[var(--console-warning)]`,icon:v}};function Iu(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map($o).join(`|`)})`,`gi`)}function Lu(e,t){let n=Iu(t);return n?e.split(n).map((e,t)=>e.match(n)?(0,W.jsx)(`mark`,{children:e},`${e}-${t}`):(0,W.jsx)(`span`,{children:e},`${e}-${t}`)):e}function Ru({text:e,highlightQuery:t}){return(0,W.jsx)(Vo,{text:e,highlightQuery:t})}var zu=(0,G.memo)(function({messageIndex:e,msg:t,blocks:n,formatTokens:r,sessionAgentKey:i,agent:a,baseDirectory:o,highlightQuery:s,childSessionById:c}){let l=t.role===`user`,u=Nu(t,i),d=()=>{let e=a?.displayName??i,t=a?.icon;return(0,W.jsx)(W.Fragment,{children:t?(0,W.jsx)(se,{icon:t,iconColored:a?.iconColored,alt:e,className:`size-4 rounded-sm object-cover`}):(0,W.jsx)(j,{className:`size-4 text-[var(--console-muted)]`})})},f=t.mode?t.mode.toUpperCase():null,p=t.model||null,m=_s(t),h=ie(t.time_created),g=t.subagent_id?c?.get(t.subagent_id):void 0;return(0,W.jsx)(`article`,{id:l?Rs(e):void 0,"data-session-timeline-anchor":l?Rs(e):void 0,className:`w-full scroll-mt-20 border-l-2 border-[var(--console-thread)] pl-4 pr-3 md:pr-5`,children:(0,W.jsxs)(`div`,{className:`flex gap-4`,children:[(0,W.jsx)(`div`,{className:`shrink-0 pt-1`,children:(0,W.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:l?(0,W.jsx)(y,{className:`size-4 text-[var(--console-muted)]`}):d()})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,W.jsx)(`span`,{className:`console-mono text-sm font-bold tracking-wide text-[var(--console-text)]`,children:m}),h?(0,W.jsx)(`time`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:h}):null,f&&(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:f}),p&&(0,W.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:p}),g?(0,W.jsx)(he,{to:pe(g),className:`console-mono rounded-sm border border-[var(--console-accent)] px-1.5 py-0.5 text-[10px] text-[var(--console-accent)] hover:bg-[var(--console-surface-muted)]`,children:`打开子会话 ↗`}):null]}),u?(0,W.jsx)(Bu,{}):n.map((t,n)=>{let r=zs(e,n);return t.type===`reasoning`?(0,W.jsx)(Vu,{anchorId:r,parts:t.parts,highlightQuery:s},n):t.type===`plan`?(0,W.jsx)(Uu,{anchorId:r,parts:t.parts,highlightQuery:s},n):t.type===`tool`?(0,W.jsx)(Hu,{parts:t.parts,anchorIds:t.anchorIds,sessionAgentKey:i,baseDirectory:o,highlightQuery:s},n):(0,W.jsx)(`div`,{id:r,"data-session-timeline-anchor":r,className:`scroll-mt-20 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-4 shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:(0,W.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:t.parts.map((e,t)=>(0,W.jsx)(Ru,{text:e.text,highlightQuery:s},t))})},n)}),!l&&(t.tokens||t.cost)&&(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.tokens?.input?(0,W.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`INPUT `,r(t.tokens.input)]}):null,t.tokens?.output?(0,W.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`OUTPUT `,r(t.tokens.output)]}):null,t.tokens?.reasoning?(0,W.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`REASONING `,r(t.tokens.reasoning)]}):null,t.cost?(0,W.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[t.cost_source===`estimated`?`EST COST`:`COST`,` $`,t.cost.toFixed(4)]}):null]})]})]})})});function Bu(){return(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,W.jsx)(`div`,{className:`w-full rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] md:w-[560px]`,children:(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(u,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:`abort`})})]})})})})}function Vu({anchorId:e,parts:t,highlightQuery:n}){let[r,i]=(0,G.useState)(!1),a=t.map(e=>e.text).filter(Boolean).join(`
|
|
53
53
|
|
|
54
|
-
`);return(0,W.jsxs)(`div`,{id:e,"data-session-timeline-anchor":e,className:`scroll-mt-20 overflow-hidden rounded-sm border border-[var(--console-thinking-border)] bg-[var(--console-thinking-bg)]`,children:[(0,W.jsxs)(`div`,{className:`flex cursor-pointer items-center justify-between bg-[var(--console-surface-muted)] px-3 py-2`,onClick:()=>i(!r),children:[(0,W.jsxs)(`span`,{className:`console-mono flex items-center gap-2 text-xs font-medium text-[var(--console-muted)]`,children:[(0,W.jsx)(h,{className:`size-3.5`}),`Thinking`]}),(0,W.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:(0,W.jsx)(w,{className:`motion-chevron w-4 h-4`,"data-open":r||void 0})})]}),(0,W.jsx)(Ql,{open:r,children:()=>(0,W.jsx)(`div`,{className:`border-t border-dashed border-[var(--console-thinking-border)] px-4 py-3`,children:(0,W.jsx)(`div`,{className:`console-mono whitespace-pre-wrap text-xs leading-relaxed text-[var(--console-muted)]`,children:Iu(a,n)})})})]})}function Vu({parts:e,anchorIds:t,sessionAgentKey:n,baseDirectory:r,highlightQuery:i}){return(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:e.map((e,a)=>(0,W.jsx)(Wu,{tool:e,anchorId:t?.[a],sessionAgentKey:n,baseDirectory:r,highlightQuery:i},a))})})}function Hu({anchorId:e,parts:t,highlightQuery:n}){return(0,W.jsx)(`div`,{id:e,"data-session-timeline-anchor":e,className:`scroll-mt-20 space-y-2`,children:t.map((e,t)=>(0,W.jsx)(Uu,{part:e,highlightQuery:n},t))})}function Uu({part:e,highlightQuery:t}){let[n,r]=(0,G.useState)(!1),i=Nu(e),a=i.approvalStatus===`fail`?Pu.error:Pu.completed,o=a.icon;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,W.jsx)(`div`,{className:`w-full md:w-[560px] rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${i.expandable?`motion-hover hover:bg-[var(--console-surface-muted)]`:``}`,children:i.expandable?(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 text-left`,onClick:()=>r(!n),children:[(0,W.jsx)(A,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})}),(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:(0,W.jsx)(w,{className:`motion-chevron size-3.5`,"data-open":n||void 0})})]}):(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(A,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})})]})}),(0,W.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider ${a.className}`,children:[(0,W.jsx)(o,{className:`size-3`}),a.label]})]}),(0,W.jsx)(Ql,{open:i.expandable&&n,children:()=>(0,W.jsxs)(`div`,{className:`mt-2 overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:i.contentLabel})}),(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,W.jsx)(Lu,{text:i.contentMarkdown,highlightQuery:t})})})]})})]})}function Wu({tool:e,anchorId:t,sessionAgentKey:n,baseDirectory:r,highlightQuery:i}){let[a,o]=(0,G.useState)(!1),s=ms(e),c=Jl(n,e,s,r),l=Cs(s.inputText||`{}`,r),u=Pu[s.status],d=u.icon,f=c.Icon;return(0,W.jsxs)(`div`,{id:t,"data-session-timeline-anchor":t,className:`scroll-mt-20`,children:[(0,W.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,W.jsx)(`div`,{className:`w-full max-w-[720px] rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-3 py-2.5 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${c.expandable?`motion-hover hover:bg-[var(--console-surface-muted)]`:``}`,children:c.expandable?(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2.5 text-left active:scale-[0.995] motion-reduce:transform-none`,onClick:()=>o(!a),"aria-expanded":a,children:[(0,W.jsx)(f,{className:`size-4 shrink-0 text-[var(--console-accent)]`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:c.title}),c.secondaryText?(0,W.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:Iu(c.secondaryText,i)}):null]}),(0,W.jsxs)(`span`,{className:`console-mono inline-flex shrink-0 items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider ${u.className}`,children:[(0,W.jsx)(d,{className:`size-2.5 ${s.status===`running`?`animate-spin motion-reduce:animate-none`:``}`}),u.label]}),(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:(0,W.jsx)(w,{className:`motion-chevron size-3.5`,"data-open":a||void 0})})]}):(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,W.jsx)(f,{className:`size-4 shrink-0 text-[var(--console-accent)]`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:c.title}),c.secondaryText?(0,W.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:Iu(c.secondaryText,i)}):null]}),(0,W.jsxs)(`span`,{className:`console-mono inline-flex shrink-0 items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider ${u.className}`,children:[(0,W.jsx)(d,{className:`size-2.5`}),u.label]})]})})}),(0,W.jsx)(Ql,{open:c.expandable&&a,children:()=>(0,W.jsxs)(`div`,{className:`mt-2 overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:c.contentLabel??`Output`})}),(0,W.jsxs)(`div`,{className:`space-y-3 p-3`,children:[c.details.length>0?(0,W.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] px-3 py-2`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:c.details.map(e=>(0,W.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-start md:gap-3`,children:[(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] font-semibold uppercase tracking-wide text-[var(--console-muted)] md:w-24`,children:e.label}),(0,W.jsx)(`span`,{className:`console-mono whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-text)]`,children:Iu(e.value,i)})]},`${e.label}:${e.value}`))})}):null,(0,W.jsx)(ku,{outputContent:c.outputContent})]}),c.showInputPreview?(0,W.jsxs)(`div`,{className:`border-t border-[var(--console-border)] bg-[var(--console-surface-sunken)] px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:`Input Preview`}),(0,W.jsx)(`pre`,{className:`console-mono mt-1 max-h-[200px] overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:Iu(l,i)})]}):null]})})]})}var Gu=class{count;gap;sizes;measured;tree;constructor(e,t,n){this.count=e,this.gap=n,this.sizes=new Float64Array(e),this.measured=new Uint8Array(e),this.tree=new Float64Array(e+1);for(let n=0;n<e;n+=1)this.sizes[n]=this.extentOf(t,n);this.buildTree()}heightAt(e){return e<0||e>=this.count?0:this.sizes[e]-this.gapAfter(e)}setHeight(e,t){if(e<0||e>=this.count||!Number.isFinite(t)||t<=0)return!1;let n=Math.ceil(t);if(this.measured[e]===1&&Math.abs(this.heightAt(e)-n)<=1)return!1;let r=this.extentOf(n,e),i=r-this.sizes[e];return this.sizes[e]=r,this.measured[e]=1,i!==0&&this.addToTree(e,i),!0}startAt(e){return this.prefixSum(Math.max(0,Math.min(e,this.count)))}endAt(e){return this.startAt(e)+this.heightAt(e)}get totalSize(){return this.prefixSum(this.count)}firstEndAfter(e){let t=0,n=this.count;for(;t<n;){let r=t+n>>1;this.endAt(r)<e?t=r+1:n=r}return t}firstStartAfter(e){let t=0,n=this.count;for(;t<n;){let r=t+n>>1;this.startAt(r)<=e?t=r+1:n=r}return t}gapAfter(e){return e===this.count-1?0:this.gap}extentOf(e,t){return e+this.gapAfter(t)}buildTree(){for(let e=0;e<this.count;e+=1){let t=e+1;this.tree[t]+=this.sizes[e];let n=t+(t&-t);n<=this.count&&(this.tree[n]+=this.tree[t])}}addToTree(e,t){for(let n=e+1;n<=this.count;n+=n&-n)this.tree[n]+=t}prefixSum(e){let t=0;for(let n=e;n>0;n-=n&-n)t+=this.tree[n];return t}},Ku=32,qu=280,Ju=6;function Yu(e){return e===window}function Xu(e){let t=e.parentElement;for(;t;){let{overflowY:e}=window.getComputedStyle(t);if(e===`auto`||e===`scroll`||e===`overlay`)return t;t=t.parentElement}return window}function Zu(e){return Yu(e)?window.scrollY:e.scrollTop}function Qu(e){return Yu(e)?window.innerHeight||900:e.clientHeight}function $u(e,t){if(Yu(t))return e.getBoundingClientRect().top+window.scrollY;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return t.scrollTop+r.top-n.top}function ed(e,t){if(Yu(e)){window.scrollTo({top:t,behavior:`auto`});return}e.scrollTo({top:t,behavior:`auto`})}function td({messages:e,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,apiRef:a}){let o=e.length>80;return(0,G.useEffect)(()=>{o||(a.current=null)},[a,o]),o?(0,W.jsx)(nd,{messages:e,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,apiRef:a}):(0,W.jsx)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:e.map(({msg:e,blocks:a,index:o})=>(0,W.jsx)(Ru,{messageIndex:o,msg:e,blocks:a,formatTokens:oe,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i},`${e.id}:${o}`))})}function nd({messages:e,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,apiRef:a}){let o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),[l,u]=(0,G.useState)(0),d=(0,G.useRef)(0),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(()=>({scrollTop:0,height:900,listTop:0})),g=(0,G.useRef)(m);(0,G.useEffect)(()=>{g.current=m},[m]);let _=(0,G.useCallback)(()=>{if(typeof window>`u`)return null;let e=o.current,t=e?Xu(e):window;s.current=t;let n=e?$u(e,t):0,r={scrollTop:Zu(t),height:Qu(t),listTop:n},i=g.current;return Math.abs(i.scrollTop-r.scrollTop)<1&&Math.abs(i.height-r.height)<1&&Math.abs(i.listTop-r.listTop)<1?t:(g.current=r,h(r),t)},[]);(0,G.useEffect)(()=>{let e=0,t=null,n=null,r=e=>{t!==e&&(t&&(t.removeEventListener(`scroll`,a),n&&!Yu(t)&&n.unobserve(t)),t=e,t.addEventListener(`scroll`,a,{passive:!0}),n&&!Yu(t)&&n.observe(t))},i=()=>{let e=_();e&&r(e)},a=()=>{e||=requestAnimationFrame(()=>{e=0,i()})};window.addEventListener(`resize`,a),typeof ResizeObserver<`u`&&(n=new ResizeObserver(a),o.current&&n.observe(o.current),document.body&&n.observe(document.body));let s=new MutationObserver(a),c=o.current?.parentElement;for(;c;)s.observe(c,{attributes:!0,attributeFilter:[`class`,`style`]}),c=c.parentElement;return document.fonts?.addEventListener(`loadingdone`,a),i(),()=>{e&&cancelAnimationFrame(e),n?.disconnect(),s.disconnect(),document.fonts?.removeEventListener(`loadingdone`,a),t?.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[_]);let v=(0,G.useMemo)(()=>{let t=new Gu(e.length,qu,Ku);return c.current=t,t},[e]);(0,G.useEffect)(()=>{p(null),u(0),_()},[e,_]),(0,G.useEffect)(()=>()=>{d.current&&cancelAnimationFrame(d.current),d.current=0},[]);let y=(0,G.useCallback)((e,t)=>{c.current?.setHeight(e,t)&&(d.current||=requestAnimationFrame(()=>{d.current=0,u(e=>e+1)}))},[]),b=(0,G.useMemo)(()=>{if(e.length===0)return[];let t=Math.max(0,m.scrollTop-m.listTop),n=t+m.height,r=Math.max(0,v.firstEndAfter(t)-Ju),i=Math.min(e.length,v.firstStartAfter(n)+Ju),a=[];for(let e=r;e<i;e+=1)a.push({index:e,start:v.startAt(e)});return f!=null&&f>=0&&f<e.length&&(a.some(e=>e.index===f)||(a.push({index:f,start:v.startAt(f)}),a.sort((e,t)=>e.start-t.start))),a},[f,v,l,e.length,m]),x=(0,G.useCallback)(t=>{if(typeof window>`u`||t<0||t>=e.length)return;p(t);let n=o.current,r=n?Xu(n):s.current??window;s.current=r;let i=n?$u(n,r):0,a=Math.max(0,i+v.startAt(t)-24);ed(r,a);let c={scrollTop:a,height:Qu(r),listTop:i};g.current=c,h(c)},[v,e.length]);return(0,G.useEffect)(()=>(a.current={scrollToIndex:x},()=>{a.current?.scrollToIndex===x&&(a.current=null)}),[a,x]),(0,W.jsx)(`div`,{ref:o,className:`relative min-w-0`,style:{height:Math.max(1,v.totalSize)},children:b.map(({index:a,start:o})=>{let s=e[a];return s?(0,W.jsx)(rd,{index:a,top:o,onMeasure:y,children:(0,W.jsx)(Ru,{messageIndex:s.index,msg:s.msg,blocks:s.blocks,formatTokens:oe,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i})},`${s.msg.id}:${s.index}`):null})})}function rd({index:e,top:t,onMeasure:n,children:r}){let i=(0,G.useRef)(null);return(0,G.useLayoutEffect)(()=>{let t=i.current;if(!t)return;let r=()=>n(e,t.getBoundingClientRect().height);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(t),()=>a.disconnect()},[e,n]),(0,W.jsx)(`div`,{ref:i,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${t}px)`},children:r})}var id={desktop:{backdrop:`z-[60] hidden bg-black/20 min-[1025px]:block`,popup:`z-[61] hidden w-[min(92vw,430px)] p-4 min-[1025px]:block`},mobile:{backdrop:`z-50 bg-black/30 min-[1025px]:hidden`,popup:`console-scrollbar z-[51] w-[min(90vw,380px)] overflow-y-auto p-3 min-[1025px]:hidden`}};function ad({open:e,onOpenChange:t,title:n,variant:r,children:i}){let a=id[r];return(0,W.jsx)(be,{open:e,onOpenChange:t,children:(0,W.jsxs)(ve,{children:[(0,W.jsx)(_e,{className:`motion-backdrop fixed inset-0 ${a.backdrop}`}),(0,W.jsxs)(xe,{className:`motion-drawer fixed bottom-0 right-0 top-0 overscroll-contain border-l border-[var(--console-border)] bg-[var(--console-bg)] shadow-[-12px_0_32px_rgba(15,23,42,0.18)] outline-none ${a.popup}`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,W.jsx)(Se,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:n}),(0,W.jsx)(ye,{"aria-label":`Close ${n.toLowerCase()}`,className:`motion-hover motion-press rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-2 text-[var(--console-muted)] hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--console-accent)] focus-visible:ring-offset-2 focus-visible:outline-none`,children:(0,W.jsx)(ce,{className:`size-4`,"aria-hidden":`true`})})]}),i]})]})})}var od=(0,G.lazy)(()=>pe(()=>import(`./InteractiveReceipt-xnRqJvfd.js`).then(e=>({default:e.InteractiveReceipt})),__vite__mapDeps([4,1,5])));function sd(){return(0,W.jsx)(`div`,{className:`h-[calc(100dvh-5.5rem)] min-h-[420px] rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)]`})}function cd({session:e,toc:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{r(!1)},[e.id]),(0,G.useEffect)(()=>{if(!n){a(!1);return}a(!1);let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>a(!0))}),i=window.matchMedia(`(min-width: 1025px)`),o=()=>{i.matches||r(!1)};return i.addEventListener(`change`,o),o(),()=>{cancelAnimationFrame(t),e&&cancelAnimationFrame(e),i.removeEventListener(`change`,o)}},[n]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`Open session receipt`,onClick:()=>r(!0),className:`console-mono fixed right-0 top-1/2 z-40 hidden h-32 w-10 -translate-y-1/2 items-center justify-center rounded-l-sm border border-r-0 border-[var(--console-border)] bg-[var(--console-surface)] text-[10px] font-semibold uppercase tracking-[0.14em] text-[var(--console-text)] shadow-[-2px_4px_14px_rgba(15,23,42,0.14)] motion-hover hover:bg-[var(--console-surface-muted)] min-[1025px]:flex`,children:(0,W.jsx)(`span`,{className:`[writing-mode:vertical-rl]`,children:`Receipt`})}),(0,W.jsx)(ad,{open:n,onOpenChange:r,title:`Session Receipt`,variant:`desktop`,children:i?(0,W.jsx)(me,{id:`InteractiveReceipt`,children:(0,W.jsx)(he,{children:(0,W.jsx)(G.Suspense,{fallback:(0,W.jsx)(sd,{}),children:(0,W.jsx)(od,{session:e,toc:t},e.id)})})}):(0,W.jsx)(sd,{})})]})}function ld({toc:e,fileChangeSummary:t,onOpen:n}){let r=tu(t);return(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2 min-[1025px]:hidden`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(`toc`),className:`console-mono inline-flex h-9 items-center gap-2 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-3 text-xs font-semibold uppercase tracking-[0.12em] text-[var(--console-text)] shadow-[0_1px_2px_rgba(15,23,42,0.04)] motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(o,{className:`size-3.5 text-[var(--console-accent)]`}),`TOC`,(0,W.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:e.counts.tools_all})]}),r>0?(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(`files`),className:`console-mono inline-flex h-9 items-center gap-2 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-3 text-xs font-semibold uppercase tracking-[0.12em] text-[var(--console-text)] shadow-[0_1px_2px_rgba(15,23,42,0.04)] motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),`Files`,(0,W.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:r})]}):null]})}function ud({openPanel:e,toc:t,fileChangeSummary:n,baseDirectory:r,selectedFilters:i,onClose:a,onToggle:o,onJumpToAnchor:s}){return(0,G.useEffect)(()=>{if(!e)return;let t=window.matchMedia(`(min-width: 1025px)`),n=()=>{t.matches&&a()};return t.addEventListener(`change`,n),n(),()=>{t.removeEventListener(`change`,n)}},[a,e]),(0,W.jsx)(ad,{open:e!==null,onOpenChange:e=>{e||a()},title:e===`files`?`File Tracker`:`Session TOC`,variant:`mobile`,children:e?e===`toc`?(0,W.jsx)(uu,{toc:t,selectedFilters:i,onToggle:o}):(0,W.jsx)(nu,{summary:n,baseDirectory:r,onJumpToAnchor:s}):null})}var dd=e(ae(),1),fd=10,pd=1,md=8,hd=6,gd={user:`bg-[var(--timeline-user)]`,agent:`bg-[var(--timeline-agent)]`,"tool-read":`bg-[var(--timeline-tool-read)]`,"tool-write":`bg-[var(--timeline-tool-write)]`,"tool-execute":`bg-[var(--timeline-tool-execute)]`},_d={user:`#a85f82`,agent:`#5e86aa`,"tool-read":`#478b7d`,"tool-write":`#bd7336`,"tool-execute":`#786ca3`};function vd(e){return{start:0,end:Math.min(e,80)}}function yd(e,t,n,r){if(e<=80)return{start:0,end:e};if(n<=0||r<=0)return vd(e);if(n>=r)return{start:0,end:e};let i=Math.floor(Math.max(0,t)/r*e),a=Math.ceil(Math.min(r,t+n)/r*e);return{start:Math.max(0,i-hd),end:Math.min(e,a+hd)}}function bd(e,t,n){let r=100/t;return{position:`absolute`,top:0,bottom:0,left:`calc(${e*r}% + ${e*n/t}px)`,width:`calc(${r}% - ${(t-1)*n/t}px)`}}var xd=(0,G.memo)(function({entry:e,index:t,isActive:n,isTooltipVisible:r,virtualized:i,entryCount:a,gapWidth:o,onShowTooltip:s,onHideTooltip:c}){let l=`timeline-tooltip-${e.id}`;return(0,W.jsx)(`span`,{className:`session-timeline-item min-w-0`,style:i?bd(t,a,o):void 0,children:(0,W.jsx)(`button`,{type:`button`,"data-timeline-index":t,"aria-current":n?`location`:void 0,"aria-describedby":r?l:void 0,"aria-label":`Go to ${e.tooltip}`,className:`t-tt-trigger session-timeline-segment h-full w-full rounded-[3px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--console-text)] ${gd[e.kind]}`,onPointerEnter:t=>s(e,t.currentTarget,`pointer`),onPointerLeave:()=>c(e.id),onFocus:t=>s(e,t.currentTarget,`focus`),onBlur:()=>c(e.id)})})});function Sd(e){let t=e.parentElement;for(;t;){let{overflowY:e}=window.getComputedStyle(t);if(e===`auto`||e===`scroll`||e===`overlay`)return t;t=t.parentElement}return window}function Cd(e){return e===window}function wd(e){if(Cd(e)){let e=window.innerHeight||900,t=document.scrollingElement??document.documentElement;return{center:e/2,scrollTop:window.scrollY||t.scrollTop,viewportHeight:e,scrollHeight:t.scrollHeight}}return{center:e.getBoundingClientRect().top+e.clientHeight/2,scrollTop:e.scrollTop,viewportHeight:e.clientHeight,scrollHeight:e.scrollHeight}}function Td(e){let t=e>80?{className:`gap-px`,width:1}:e>40?{className:`gap-0.5`,width:2}:{className:`gap-1`,width:4};return{gapClassName:t.className,gapWidth:t.width,minWidth:e*fd+Math.max(0,e-1)*t.width}}function Ed(e,t,n,r,i){if(r===0||e.clientWidth<=0)return;let a=Math.max(e.scrollWidth,t.scrollWidth,t.getBoundingClientRect().width);if(a<=0)return;let o=Math.max(0,(a-Math.max(0,r-1)*i)/r),s=n*(o+i),c=s+o,l=e.scrollLeft,u=l+e.clientWidth;s<l?e.scrollLeft=s:c>u&&(e.scrollLeft=c-e.clientWidth)}function Dd({entries:e,onNavigate:t}){let n=(0,G.useRef)(null),r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)({active:!1,moved:!1,startX:0,lastIndex:-1}),c=(0,G.useRef)(!1),l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)(null),[f,p]=(0,G.useState)(0),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)({left:!1,right:!1}),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(()=>vd(e.length)),S=(0,G.useMemo)(()=>new Map(e.map((e,t)=>[e.anchorId,t])),[e]),C=Td(e.length),w=e.length>80,T=w?Math.min(b.start,e.length):0,E=w?Math.max(T,Math.min(b.end,e.length)):e.length,ee=(0,G.useMemo)(()=>e.slice(T,E).map((e,t)=>({entry:e,index:T+t})),[e,E,T]),D=(0,G.useCallback)(()=>{let t=r.current;if(!t)return;let n=yd(e.length,t.scrollLeft,t.clientWidth,t.scrollWidth);x(e=>e.start===n.start&&e.end===n.end?e:n);let i=Math.max(0,t.scrollWidth-t.clientWidth),a={left:t.scrollLeft>pd,right:t.scrollLeft<i-pd};if(_(e=>e.left===a.left&&e.right===a.right?e:a),i<=0){y(null);return}let o={start:t.scrollLeft/t.scrollWidth,size:t.clientWidth/t.scrollWidth};y(e=>e?.start===o.start&&e.size===o.size?e:o)},[e.length]);(0,G.useLayoutEffect)(()=>{let e=a.current;if(!e||!m)return;let t=e.offsetWidth/2,n=Math.min(window.innerWidth-md-t,Math.max(md+t,m.anchorX));e.style.left=`${n}px`},[m]),(0,G.useLayoutEffect)(()=>{D();let e=r.current,t=i.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(D);return n.observe(e),n.observe(t),()=>n.disconnect()},[e.length,D]),(0,G.useEffect)(()=>{p(0);let t=n.current;if(!t||e.length===0)return;let r=t.closest(`[data-testid="session-detail"]`),i=Sd(t),a=0,o=`[data-session-timeline-anchor]`,s=e=>{let t=e.dataset.sessionTimelineAnchor,n=t?S.get(t):void 0;return n==null?null:{index:n,top:e.getBoundingClientRect().top}},c=()=>Array.from(r?.querySelectorAll(o)??[]).flatMap(e=>s(e)??[]),l=new Map,u=()=>Array.from(l.values()).flatMap(e=>s(e)??[]),d=()=>{let t=wd(i),n=Ws(t.scrollTop,t.viewportHeight,t.scrollHeight,e.length),r=m?u():c(),a=n??Us(r,t.center);a!=null&&p(e=>e===a?e:a)},f=()=>{a||=requestAnimationFrame(()=>{a=0,d()})},m=typeof IntersectionObserver>`u`?null:new IntersectionObserver(e=>{for(let t of e){let e=t.target,n=e.dataset.sessionTimelineAnchor;n&&(t.isIntersecting?l.set(n,e):l.delete(n))}f()},{root:Cd(i)?null:i,threshold:0}),h=e=>m?.observe(e),g=e=>{m?.unobserve(e);let t=e.dataset.sessionTimelineAnchor;t&&l.delete(t)},_=(e,t)=>{e instanceof HTMLElement&&(e.matches(o)&&t(e),e.querySelectorAll(o).forEach(t))};m&&r&&r.querySelectorAll(o).forEach(h),f(),i.addEventListener(`scroll`,f,{passive:!0}),window.addEventListener(`resize`,f);let v=typeof ResizeObserver>`u`?null:new ResizeObserver(f);r&&v?.observe(r);let y=typeof MutationObserver>`u`?null:new MutationObserver(e=>{if(!m){f();return}for(let t of e)t.addedNodes.forEach(e=>_(e,h)),t.removedNodes.forEach(e=>_(e,g));f()});return r&&y?.observe(r,{childList:!0,subtree:!0}),()=>{a&&cancelAnimationFrame(a),m?.disconnect(),v?.disconnect(),y?.disconnect(),i.removeEventListener(`scroll`,f),window.removeEventListener(`resize`,f)}},[e.length,S]),(0,G.useEffect)(()=>{let t=r.current,n=i.current;!t||!n||(Ed(t,n,f,e.length,C.gapWidth),D())},[f,e.length,C.gapWidth,D]),(0,G.useLayoutEffect)(()=>{let e=d.current;if(e==null)return;let t=i.current?.querySelector(`[data-timeline-index="${e}"]`);t&&(d.current=null,t.focus())},[E,T]);let O=v!=null;(0,G.useEffect)(()=>{let t=l.current;if(!t||!O)return;let n=()=>{let n=t.getContext(`2d`),r=t.clientWidth,i=t.clientHeight;if(!n||!r||!i||e.length===0)return;let a=window.devicePixelRatio||1;t.width=Math.round(r*a),t.height=Math.round(i*a),n.scale(a,a),n.clearRect(0,0,r,i);let o=window.getComputedStyle(t),s={user:o.getPropertyValue(`--timeline-user`).trim()||_d.user,agent:o.getPropertyValue(`--timeline-agent`).trim()||_d.agent,"tool-read":o.getPropertyValue(`--timeline-tool-read`).trim()||_d[`tool-read`],"tool-write":o.getPropertyValue(`--timeline-tool-write`).trim()||_d[`tool-write`],"tool-execute":o.getPropertyValue(`--timeline-tool-execute`).trim()||_d[`tool-execute`]};e.forEach((t,a)=>{let o=a/e.length*r,c=(a+1)/e.length*r;n.fillStyle=s[t.kind],n.fillRect(o,0,Math.max(c-o,.5),i)})};n();let r=new MutationObserver(n);if(r.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),typeof ResizeObserver>`u`)return()=>r.disconnect();let i=new ResizeObserver(n);return i.observe(t),()=>{r.disconnect(),i.disconnect()}},[e,O]);let te=(0,G.useCallback)((e,t)=>{let n=r.current;n&&(n.scrollLeft=(e-t)*n.scrollWidth)},[]),ne=(0,G.useCallback)(e=>{let t=r.current;if(!t)return;let n=Math.max(0,t.scrollWidth-t.clientWidth),i=Math.max(40,t.clientWidth*.1),a=Math.max(120,t.clientWidth*.75),o=null;e.key===`ArrowLeft`&&(o=t.scrollLeft-i),e.key===`ArrowRight`&&(o=t.scrollLeft+i),e.key===`PageUp`&&(o=t.scrollLeft-a),e.key===`PageDown`&&(o=t.scrollLeft+a),e.key===`Home`&&(o=0),e.key===`End`&&(o=n),o!=null&&(e.preventDefault(),t.scrollLeft=Math.min(n,Math.max(0,o)))},[]),k=(0,G.useCallback)((e,t,n)=>{let r=t.getBoundingClientRect();o.current=t,h({entryId:e.id,id:`timeline-tooltip-${e.id}`,text:e.tooltip,anchorX:r.left+r.width/2,top:r.bottom+8,source:n})},[]),A=(0,G.useCallback)(e=>{h(t=>t?.entryId===e?(o.current=null,null):t)},[]),re=(0,G.useCallback)(()=>{D(),h(e=>{let t=o.current;if(!e||e.source!==`focus`||!t||t!==document.activeElement)return o.current=null,null;let n=t.getBoundingClientRect();return{...e,anchorX:n.left+n.width/2,top:n.bottom+8}})},[D]),j=(0,G.useCallback)(e=>{let t=r.current;t&&(t.scrollLeft+=e*Math.max(120,t.clientWidth*.75))},[]),M=(0,G.useCallback)((n,r)=>{let a=i.current;if(!a)return;let o=a.getBoundingClientRect(),c=Gs(n,o.left,o.width,e.length);if(c==null||c===s.current.lastIndex)return;let l=e[c];l&&(s.current.lastIndex=c,t(l,r))},[e,t]),ie=(0,G.useCallback)(t=>{let n=r.current,a=i.current;if(!n||!a)return;let o=a.querySelector(`[data-timeline-index="${t}"]`);if(o){o.focus();return}d.current=t,Ed(n,a,t,e.length,C.gapWidth),D()},[e.length,C.gapWidth,D]),ae=(0,G.useCallback)(t=>{let n=t.target.closest(`[data-timeline-index]`)?.dataset.timelineIndex,r=n==null?null:Number(n);if(r==null||!Number.isInteger(r))return;let i=null;t.key===`ArrowLeft`&&(i=Math.max(0,r-1)),t.key===`ArrowRight`&&(i=Math.min(e.length-1,r+1)),t.key===`Home`&&(i=0),t.key===`End`&&(i=e.length-1),!(i==null||i===r)&&(t.preventDefault(),ie(i))},[e.length,ie]);return(0,W.jsx)(`div`,{className:`sticky top-0 z-20 -mx-2 bg-[var(--console-bg)] px-2 py-3`,children:(0,W.jsxs)(`div`,{ref:n,className:`session-message-timeline relative rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-3 py-2.5 shadow-[0_1px_2px_rgba(15,23,42,0.05)]`,children:[(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(`div`,{ref:r,id:`session-timeline-viewport`,role:`navigation`,"aria-label":`Session message timeline`,tabIndex:0,className:`session-timeline-viewport overflow-x-auto overflow-y-hidden overscroll-x-contain py-1`,onScroll:re,children:(0,W.jsx)(`div`,{ref:i,"data-testid":`session-timeline-track`,className:`${w?`relative`:`grid items-stretch ${C.gapClassName}`} h-5 w-full select-none`,style:w?{minWidth:`${C.minWidth}px`}:{gridTemplateColumns:`repeat(${e.length}, minmax(${fd}px, 1fr))`,minWidth:`${C.minWidth}px`},onKeyDown:ae,onPointerDown:e=>{e.button===0&&(s.current={active:!0,moved:!1,startX:e.clientX,lastIndex:-1})},onPointerMove:e=>{let t=s.current;if(t.active){if(!t.moved){if(Math.abs(e.clientX-t.startX)<3)return;t.moved=!0,e.currentTarget.setPointerCapture(e.pointerId)}c.current=!0,M(e.clientX,`auto`)}},onPointerUp:e=>{s.current.active=!1,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),window.setTimeout(()=>{c.current=!1},0)},onPointerCancel:()=>{s.current.active=!1,c.current=!1},onClick:n=>{if(c.current)return;let r=$l(n.detail),i=n.target.closest(`[data-timeline-index]`)?.dataset.timelineIndex,a=i==null?null:Number(i),o=a==null||!Number.isInteger(a)?void 0:e[a];if(o){t(o,r);return}M(n.clientX,r)},children:ee.map(({entry:t,index:n})=>(0,W.jsx)(xd,{entry:t,index:n,isActive:n===f,isTooltipVisible:m?.entryId===t.id,virtualized:w,entryCount:e.length,gapWidth:C.gapWidth,onShowTooltip:k,onHideTooltip:A},t.id))})}),g.left&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Scroll timeline left`,className:`absolute inset-y-0 left-0 z-10 flex w-8 items-center justify-start bg-[linear-gradient(to_right,var(--console-surface)_55%,transparent)] pl-0.5 text-[var(--console-muted)] hover:text-[var(--console-text)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--console-text)]`,onClick:()=>j(-1),children:(0,W.jsx)(le,{size:14,"aria-hidden":`true`})}),g.right&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Scroll timeline right`,className:`absolute inset-y-0 right-0 z-10 flex w-8 items-center justify-end bg-[linear-gradient(to_left,var(--console-surface)_55%,transparent)] pr-0.5 text-[var(--console-muted)] hover:text-[var(--console-text)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--console-text)]`,onClick:()=>j(1),children:(0,W.jsx)(fe,{size:14,"aria-hidden":`true`})})]}),v&&(0,W.jsx)(`div`,{"data-testid":`session-timeline-minimap`,role:`scrollbar`,"aria-controls":`session-timeline-viewport`,"aria-orientation":`horizontal`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(v.start/(1-v.size)*100),"aria-label":`Timeline scroll position`,tabIndex:0,className:`session-timeline-minimap relative mt-2 h-2.5 cursor-pointer touch-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--console-text)]`,onKeyDown:ne,onPointerDown:e=>{if(e.button!==0)return;let t=e.currentTarget.getBoundingClientRect();if(t.width<=0)return;let n=(e.clientX-t.left)/t.width,r=n>=v.start&&n<=v.start+v.size?n-v.start:v.size/2;u.current={pointerId:e.pointerId,grabOffset:r},e.currentTarget.setPointerCapture(e.pointerId),te(n,r)},onPointerMove:e=>{let t=u.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.currentTarget.getBoundingClientRect();n.width<=0||te((e.clientX-n.left)/n.width,t.grabOffset)},onPointerUp:e=>{u.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{u.current=null},children:(0,W.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden rounded-[2px]`,children:[(0,W.jsx)(`canvas`,{ref:l,"aria-hidden":`true`,className:`absolute inset-0 h-full w-full`}),(0,W.jsx)(`div`,{"data-testid":`session-timeline-minimap-window`,className:`session-timeline-minimap-window absolute inset-y-0`,style:{left:`${v.start*100}%`,width:`${v.size*100}%`}})]})}),m&&(0,dd.createPortal)((0,W.jsx)(`span`,{ref:a,id:m.id,role:`tooltip`,className:`t-tt session-timeline-floating-tooltip console-mono text-[11px]`,style:{left:m.anchorX,top:m.top},children:m.text}),document.body)]})})}function Od({anchorId:e,behavior:t,prepareAnchor:n,isCurrent:r}){if(typeof document>`u`)return;let i=eu(t,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),a=document.getElementById(e);if(!a&&n){n();let t=0,o=()=>{if(r()){if(a=document.getElementById(e),a){a.scrollIntoView({behavior:i,block:`center`});return}t+=1,t<8&&requestAnimationFrame(o)}};requestAnimationFrame(o);return}a&&a.scrollIntoView({behavior:i,block:`center`})}function kd(e,t){if(!Ce())return t();let n=performance.now(),r=t(),i=performance.now();return ge({id:e,source:`custom-timing`,phase:`measure`,actualDuration:Math.round((i-n)*100)/100,baseDuration:0,startTime:n,commitTime:i}),r}function Ad({session:e,agentCatalog:t,highlightQuery:n}){let r=e.reference.agentName,i=k(t,r),a=(0,G.useMemo)(()=>kd(`SessionDetail:buildDisplayModel`,()=>Zl({messages:e.messages,agentName:r,fileActivity:e.file_activity})),[e.file_activity,e.messages,r]),{messages:o,toc:s,fileChangeSummary:c}=a,[l,u]=(0,G.useState)(()=>new Set(s.filterIds)),[d,f]=(0,G.useState)(null),p=(0,G.useMemo)(()=>[...s.filterIds].toSorted().join(`|`),[s.filterIds]),m=(0,G.useMemo)(()=>[...l].toSorted().join(`|`),[l]),h=(0,G.useMemo)(()=>kd(`SessionDetail:selectDisplayModel`,()=>a.select(l)),[a,l]),{messages:g,timelineEntries:_}=h,v=(0,G.useRef)(null),y=(0,G.useRef)(0),b=(0,G.useCallback)((e,t,n)=>{let r=y.current+1;y.current=r;let i=t==null?void 0:h.resolveListIndex(t);Od({anchorId:e,behavior:n,prepareAnchor:i==null?void 0:()=>v.current?.scrollToIndex(i),isCurrent:()=>y.current===r})},[h]),x=(0,G.useCallback)((e,t)=>{b(e,a.resolveMessageIndex(e),t)},[a,b]);return(0,G.useEffect)(()=>{u(new Set(s.filterIds))},[p,s.filterIds]),o.length===0?(0,W.jsx)(`div`,{"data-testid":`session-detail`,className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-6 text-sm text-[var(--console-muted)]`,children:`当前会话暂无可展示的消息内容。`}):(0,W.jsxs)(`div`,{"data-testid":`session-detail`,className:`mx-auto w-full max-w-[1440px] space-y-8 px-2 md:px-4`,children:[(0,W.jsx)(jd,{summary:typeof e.summary_files==`string`?e.summary_files:void 0}),(0,W.jsxs)(`div`,{className:`grid gap-6 min-[1025px]:grid-cols-[240px_minmax(0,1fr)] min-[1025px]:items-start min-[1280px]:grid-cols-[220px_minmax(0,1fr)]`,children:[(0,W.jsx)(ld,{toc:s,fileChangeSummary:c,onOpen:f}),(0,W.jsx)(ud,{openPanel:d,toc:s,fileChangeSummary:c,baseDirectory:e.directory,selectedFilters:l,onClose:()=>f(null),onToggle:e=>u(t=>su(t,e,s)),onJumpToAnchor:(e,t)=>{f(null),x(e,t)}}),(0,W.jsx)(lu,{toc:s,fileChangeSummary:c,baseDirectory:e.directory,selectedFilters:l,onToggle:e=>u(t=>su(t,e,s)),onJumpToAnchor:x}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:g.length>0?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Dd,{entries:_,onNavigate:(e,t)=>b(e.anchorId,e.messageIndex,t)}),(0,W.jsx)(me,{id:`MessageList`,detail:{messages:g.length,virtualized:g.length>80},children:(0,W.jsx)(td,{messages:g,sessionAgentKey:r,agent:i,baseDirectory:e.directory,highlightQuery:n,apiRef:v},`${e.id}:${m}`)})]}):(0,W.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-6 text-sm text-[var(--console-muted)]`,children:`当前筛选条件下暂无可展示的消息内容。`})})]}),(0,W.jsx)(cd,{session:e,toc:s})]})}function jd({summary:e,defaultExpanded:t=!1}){let n=typeof e==`string`?e.trim():``,[r,i]=(0,G.useState)(t);return n?(0,W.jsxs)(`section`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:()=>i(e=>!e),children:[(0,W.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),`Session Summary`]}),r?(0,W.jsx)(T,{className:`size-3.5 text-[var(--console-muted)]`}):(0,W.jsx)(w,{className:`size-3.5 text-[var(--console-muted)]`})]}),r?(0,W.jsx)(`div`,{className:`border-t border-[var(--console-border)] px-4 py-4`,children:(0,W.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,W.jsx)(zo,{text:n})})}):null]}):null}export{Ad as SessionDetail};
|
|
54
|
+
`);return(0,W.jsxs)(`div`,{id:e,"data-session-timeline-anchor":e,className:`scroll-mt-20 overflow-hidden rounded-sm border border-[var(--console-thinking-border)] bg-[var(--console-thinking-bg)]`,children:[(0,W.jsxs)(`div`,{className:`flex cursor-pointer items-center justify-between bg-[var(--console-surface-muted)] px-3 py-2`,onClick:()=>i(!r),children:[(0,W.jsxs)(`span`,{className:`console-mono flex items-center gap-2 text-xs font-medium text-[var(--console-muted)]`,children:[(0,W.jsx)(h,{className:`size-3.5`}),`Thinking`]}),(0,W.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:(0,W.jsx)(w,{className:`motion-chevron w-4 h-4`,"data-open":r||void 0})})]}),(0,W.jsx)($l,{open:r,children:()=>(0,W.jsx)(`div`,{className:`border-t border-dashed border-[var(--console-thinking-border)] px-4 py-3`,children:(0,W.jsx)(`div`,{className:`console-mono whitespace-pre-wrap text-xs leading-relaxed text-[var(--console-muted)]`,children:Lu(a,n)})})})]})}function Hu({parts:e,anchorIds:t,sessionAgentKey:n,baseDirectory:r,highlightQuery:i}){return(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:e.map((e,a)=>(0,W.jsx)(Gu,{tool:e,anchorId:t?.[a],sessionAgentKey:n,baseDirectory:r,highlightQuery:i},a))})})}function Uu({anchorId:e,parts:t,highlightQuery:n}){return(0,W.jsx)(`div`,{id:e,"data-session-timeline-anchor":e,className:`scroll-mt-20 space-y-2`,children:t.map((e,t)=>(0,W.jsx)(Wu,{part:e,highlightQuery:n},t))})}function Wu({part:e,highlightQuery:t}){let[n,r]=(0,G.useState)(!1),i=Pu(e),a=i.approvalStatus===`fail`?Fu.error:Fu.completed,o=a.icon;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,W.jsx)(`div`,{className:`w-full md:w-[560px] rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${i.expandable?`motion-hover hover:bg-[var(--console-surface-muted)]`:``}`,children:i.expandable?(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 text-left`,onClick:()=>r(!n),children:[(0,W.jsx)(A,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})}),(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:(0,W.jsx)(w,{className:`motion-chevron size-3.5`,"data-open":n||void 0})})]}):(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(A,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})})]})}),(0,W.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider ${a.className}`,children:[(0,W.jsx)(o,{className:`size-3`}),a.label]})]}),(0,W.jsx)($l,{open:i.expandable&&n,children:()=>(0,W.jsxs)(`div`,{className:`mt-2 overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:i.contentLabel})}),(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,W.jsx)(Ru,{text:i.contentMarkdown,highlightQuery:t})})})]})})]})}function Gu({tool:e,anchorId:t,sessionAgentKey:n,baseDirectory:r,highlightQuery:i}){let[a,o]=(0,G.useState)(!1),s=gs(e),c=Yl(n,e,s,r),l=Ts(s.inputText||`{}`,r),u=Fu[s.status],d=u.icon,f=c.Icon;return(0,W.jsxs)(`div`,{id:t,"data-session-timeline-anchor":t,className:`scroll-mt-20`,children:[(0,W.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,W.jsx)(`div`,{className:`w-full max-w-[720px] rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-3 py-2.5 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${c.expandable?`motion-hover hover:bg-[var(--console-surface-muted)]`:``}`,children:c.expandable?(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2.5 text-left active:scale-[0.995] motion-reduce:transform-none`,onClick:()=>o(!a),"aria-expanded":a,children:[(0,W.jsx)(f,{className:`size-4 shrink-0 text-[var(--console-accent)]`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:c.title}),c.secondaryText?(0,W.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:Lu(c.secondaryText,i)}):null]}),(0,W.jsxs)(`span`,{className:`console-mono inline-flex shrink-0 items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider ${u.className}`,children:[(0,W.jsx)(d,{className:`size-2.5 ${s.status===`running`?`animate-spin motion-reduce:animate-none`:``}`}),u.label]}),(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:(0,W.jsx)(w,{className:`motion-chevron size-3.5`,"data-open":a||void 0})})]}):(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,W.jsx)(f,{className:`size-4 shrink-0 text-[var(--console-accent)]`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:c.title}),c.secondaryText?(0,W.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:Lu(c.secondaryText,i)}):null]}),(0,W.jsxs)(`span`,{className:`console-mono inline-flex shrink-0 items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider ${u.className}`,children:[(0,W.jsx)(d,{className:`size-2.5`}),u.label]})]})})}),(0,W.jsx)($l,{open:c.expandable&&a,children:()=>(0,W.jsxs)(`div`,{className:`mt-2 overflow-hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,W.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:c.contentLabel??`Output`})}),(0,W.jsxs)(`div`,{className:`space-y-3 p-3`,children:[c.details.length>0?(0,W.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-sunken)] px-3 py-2`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:c.details.map(e=>(0,W.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-start md:gap-3`,children:[(0,W.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] font-semibold uppercase tracking-wide text-[var(--console-muted)] md:w-24`,children:e.label}),(0,W.jsx)(`span`,{className:`console-mono whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-text)]`,children:Lu(e.value,i)})]},`${e.label}:${e.value}`))})}):null,(0,W.jsx)(Au,{outputContent:c.outputContent})]}),c.showInputPreview?(0,W.jsxs)(`div`,{className:`border-t border-[var(--console-border)] bg-[var(--console-surface-sunken)] px-3 py-2`,children:[(0,W.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:`Input Preview`}),(0,W.jsx)(`pre`,{className:`console-mono mt-1 max-h-[200px] overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:Lu(l,i)})]}):null]})})]})}var Ku=class{count;gap;sizes;measured;tree;constructor(e,t,n){this.count=e,this.gap=n,this.sizes=new Float64Array(e),this.measured=new Uint8Array(e),this.tree=new Float64Array(e+1);for(let n=0;n<e;n+=1)this.sizes[n]=this.extentOf(t,n);this.buildTree()}heightAt(e){return e<0||e>=this.count?0:this.sizes[e]-this.gapAfter(e)}setHeight(e,t){if(e<0||e>=this.count||!Number.isFinite(t)||t<=0)return!1;let n=Math.ceil(t);if(this.measured[e]===1&&Math.abs(this.heightAt(e)-n)<=1)return!1;let r=this.extentOf(n,e),i=r-this.sizes[e];return this.sizes[e]=r,this.measured[e]=1,i!==0&&this.addToTree(e,i),!0}startAt(e){return this.prefixSum(Math.max(0,Math.min(e,this.count)))}endAt(e){return this.startAt(e)+this.heightAt(e)}get totalSize(){return this.prefixSum(this.count)}firstEndAfter(e){let t=0,n=this.count;for(;t<n;){let r=t+n>>1;this.endAt(r)<e?t=r+1:n=r}return t}firstStartAfter(e){let t=0,n=this.count;for(;t<n;){let r=t+n>>1;this.startAt(r)<=e?t=r+1:n=r}return t}gapAfter(e){return e===this.count-1?0:this.gap}extentOf(e,t){return e+this.gapAfter(t)}buildTree(){for(let e=0;e<this.count;e+=1){let t=e+1;this.tree[t]+=this.sizes[e];let n=t+(t&-t);n<=this.count&&(this.tree[n]+=this.tree[t])}}addToTree(e,t){for(let n=e+1;n<=this.count;n+=n&-n)this.tree[n]+=t}prefixSum(e){let t=0;for(let n=e;n>0;n-=n&-n)t+=this.tree[n];return t}},qu=32,Ju=280,Yu=6;function Xu(e){return e===window}function Zu(e){let t=e.parentElement;for(;t;){let{overflowY:e}=window.getComputedStyle(t);if(e===`auto`||e===`scroll`||e===`overlay`)return t;t=t.parentElement}return window}function Qu(e){return Xu(e)?window.scrollY:e.scrollTop}function $u(e){return Xu(e)?window.innerHeight||900:e.clientHeight}function ed(e,t){if(Xu(t))return e.getBoundingClientRect().top+window.scrollY;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return t.scrollTop+r.top-n.top}function td(e,t){if(Xu(e)){window.scrollTo({top:t,behavior:`auto`});return}e.scrollTo({top:t,behavior:`auto`})}function nd({messages:e,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,childSessionById:a,apiRef:o}){let s=e.length>80;return(0,G.useEffect)(()=>{s||(o.current=null)},[o,s]),s?(0,W.jsx)(rd,{messages:e,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,childSessionById:a,apiRef:o}):(0,W.jsx)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:e.map(({msg:e,blocks:o,index:s})=>(0,W.jsx)(zu,{messageIndex:s,msg:e,blocks:o,formatTokens:oe,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,childSessionById:a},`${e.id}:${s}`))})}function rd({messages:e,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,childSessionById:a,apiRef:o}){let s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),[u,d]=(0,G.useState)(0),f=(0,G.useRef)(0),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(()=>({scrollTop:0,height:900,listTop:0})),_=(0,G.useRef)(h);(0,G.useEffect)(()=>{_.current=h},[h]);let v=(0,G.useCallback)(()=>{if(typeof window>`u`)return null;let e=s.current,t=e?Zu(e):window;c.current=t;let n=e?ed(e,t):0,r={scrollTop:Qu(t),height:$u(t),listTop:n},i=_.current;return Math.abs(i.scrollTop-r.scrollTop)<1&&Math.abs(i.height-r.height)<1&&Math.abs(i.listTop-r.listTop)<1?t:(_.current=r,g(r),t)},[]);(0,G.useEffect)(()=>{let e=0,t=null,n=null,r=e=>{t!==e&&(t&&(t.removeEventListener(`scroll`,a),n&&!Xu(t)&&n.unobserve(t)),t=e,t.addEventListener(`scroll`,a,{passive:!0}),n&&!Xu(t)&&n.observe(t))},i=()=>{let e=v();e&&r(e)},a=()=>{e||=requestAnimationFrame(()=>{e=0,i()})};window.addEventListener(`resize`,a),typeof ResizeObserver<`u`&&(n=new ResizeObserver(a),s.current&&n.observe(s.current),document.body&&n.observe(document.body));let o=new MutationObserver(a),c=s.current?.parentElement;for(;c;)o.observe(c,{attributes:!0,attributeFilter:[`class`,`style`]}),c=c.parentElement;return document.fonts?.addEventListener(`loadingdone`,a),i(),()=>{e&&cancelAnimationFrame(e),n?.disconnect(),o.disconnect(),document.fonts?.removeEventListener(`loadingdone`,a),t?.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[v]);let y=(0,G.useMemo)(()=>{let t=new Ku(e.length,Ju,qu);return l.current=t,t},[e]);(0,G.useEffect)(()=>{m(null),d(0),v()},[e,v]),(0,G.useEffect)(()=>()=>{f.current&&cancelAnimationFrame(f.current),f.current=0},[]);let b=(0,G.useCallback)((e,t)=>{l.current?.setHeight(e,t)&&(f.current||=requestAnimationFrame(()=>{f.current=0,d(e=>e+1)}))},[]),x=(0,G.useMemo)(()=>{if(e.length===0)return[];let t=Math.max(0,h.scrollTop-h.listTop),n=t+h.height,r=Math.max(0,y.firstEndAfter(t)-Yu),i=Math.min(e.length,y.firstStartAfter(n)+Yu),a=[];for(let e=r;e<i;e+=1)a.push({index:e,start:y.startAt(e)});return p!=null&&p>=0&&p<e.length&&(a.some(e=>e.index===p)||(a.push({index:p,start:y.startAt(p)}),a.sort((e,t)=>e.start-t.start))),a},[p,y,u,e.length,h]),S=(0,G.useCallback)(t=>{if(typeof window>`u`||t<0||t>=e.length)return;m(t);let n=s.current,r=n?Zu(n):c.current??window;c.current=r;let i=n?ed(n,r):0,a=Math.max(0,i+y.startAt(t)-24);td(r,a);let o={scrollTop:a,height:$u(r),listTop:i};_.current=o,g(o)},[y,e.length]);return(0,G.useEffect)(()=>(o.current={scrollToIndex:S},()=>{o.current?.scrollToIndex===S&&(o.current=null)}),[o,S]),(0,W.jsx)(`div`,{ref:s,className:`relative min-w-0`,style:{height:Math.max(1,y.totalSize)},children:x.map(({index:o,start:s})=>{let c=e[o];return c?(0,W.jsx)(id,{index:o,top:s,onMeasure:b,children:(0,W.jsx)(zu,{messageIndex:c.index,msg:c.msg,blocks:c.blocks,formatTokens:oe,sessionAgentKey:t,agent:n,baseDirectory:r,highlightQuery:i,childSessionById:a})},`${c.msg.id}:${c.index}`):null})})}function id({index:e,top:t,onMeasure:n,children:r}){let i=(0,G.useRef)(null);return(0,G.useLayoutEffect)(()=>{let t=i.current;if(!t)return;let r=()=>n(e,t.getBoundingClientRect().height);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(t),()=>a.disconnect()},[e,n]),(0,W.jsx)(`div`,{ref:i,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${t}px)`},children:r})}var ad={desktop:{backdrop:`z-[60] hidden bg-black/20 min-[1025px]:block`,popup:`z-[61] hidden w-[min(92vw,430px)] p-4 min-[1025px]:block`},mobile:{backdrop:`z-50 bg-black/30 min-[1025px]:hidden`,popup:`console-scrollbar z-[51] w-[min(90vw,380px)] overflow-y-auto p-3 min-[1025px]:hidden`}};function od({open:e,onOpenChange:t,title:n,variant:r,children:i}){let a=ad[r];return(0,W.jsx)(Se,{open:e,onOpenChange:t,children:(0,W.jsxs)(be,{children:[(0,W.jsx)(ye,{className:`motion-backdrop fixed inset-0 ${a.backdrop}`}),(0,W.jsxs)(Ce,{className:`motion-drawer fixed bottom-0 right-0 top-0 overscroll-contain border-l border-[var(--console-border)] bg-[var(--console-bg)] shadow-[-12px_0_32px_rgba(15,23,42,0.18)] outline-none ${a.popup}`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,W.jsx)(we,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:n}),(0,W.jsx)(xe,{"aria-label":`Close ${n.toLowerCase()}`,className:`motion-hover motion-press rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-2 text-[var(--console-muted)] hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--console-accent)] focus-visible:ring-offset-2 focus-visible:outline-none`,children:(0,W.jsx)(ce,{className:`size-4`,"aria-hidden":`true`})})]}),i]})]})})}var sd=(0,G.lazy)(()=>me(()=>import(`./InteractiveReceipt-xnRqJvfd.js`).then(e=>({default:e.InteractiveReceipt})),__vite__mapDeps([4,1,5])));function cd(){return(0,W.jsx)(`div`,{className:`h-[calc(100dvh-5.5rem)] min-h-[420px] rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)]`})}function ld({session:e,toc:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{r(!1)},[e.id]),(0,G.useEffect)(()=>{if(!n){a(!1);return}a(!1);let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>a(!0))}),i=window.matchMedia(`(min-width: 1025px)`),o=()=>{i.matches||r(!1)};return i.addEventListener(`change`,o),o(),()=>{cancelAnimationFrame(t),e&&cancelAnimationFrame(e),i.removeEventListener(`change`,o)}},[n]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`Open session receipt`,onClick:()=>r(!0),className:`console-mono fixed right-0 top-1/2 z-40 hidden h-32 w-10 -translate-y-1/2 items-center justify-center rounded-l-sm border border-r-0 border-[var(--console-border)] bg-[var(--console-surface)] text-[10px] font-semibold uppercase tracking-[0.14em] text-[var(--console-text)] shadow-[-2px_4px_14px_rgba(15,23,42,0.14)] motion-hover hover:bg-[var(--console-surface-muted)] min-[1025px]:flex`,children:(0,W.jsx)(`span`,{className:`[writing-mode:vertical-rl]`,children:`Receipt`})}),(0,W.jsx)(od,{open:n,onOpenChange:r,title:`Session Receipt`,variant:`desktop`,children:i?(0,W.jsx)(ge,{id:`InteractiveReceipt`,children:(0,W.jsx)(_e,{children:(0,W.jsx)(G.Suspense,{fallback:(0,W.jsx)(cd,{}),children:(0,W.jsx)(sd,{session:e,toc:t},e.id)})})}):(0,W.jsx)(cd,{})})]})}function ud({toc:e,fileChangeSummary:t,onOpen:n}){let r=nu(t);return(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2 min-[1025px]:hidden`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(`toc`),className:`console-mono inline-flex h-9 items-center gap-2 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-3 text-xs font-semibold uppercase tracking-[0.12em] text-[var(--console-text)] shadow-[0_1px_2px_rgba(15,23,42,0.04)] motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(o,{className:`size-3.5 text-[var(--console-accent)]`}),`TOC`,(0,W.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:e.counts.tools_all})]}),r>0?(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(`files`),className:`console-mono inline-flex h-9 items-center gap-2 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-3 text-xs font-semibold uppercase tracking-[0.12em] text-[var(--console-text)] shadow-[0_1px_2px_rgba(15,23,42,0.04)] motion-hover hover:bg-[var(--console-surface-muted)]`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),`Files`,(0,W.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:r})]}):null]})}function dd({openPanel:e,toc:t,fileChangeSummary:n,baseDirectory:r,selectedFilters:i,onClose:a,onToggle:o,onJumpToAnchor:s}){return(0,G.useEffect)(()=>{if(!e)return;let t=window.matchMedia(`(min-width: 1025px)`),n=()=>{t.matches&&a()};return t.addEventListener(`change`,n),n(),()=>{t.removeEventListener(`change`,n)}},[a,e]),(0,W.jsx)(od,{open:e!==null,onOpenChange:e=>{e||a()},title:e===`files`?`File Tracker`:`Session TOC`,variant:`mobile`,children:e?e===`toc`?(0,W.jsx)(du,{toc:t,selectedFilters:i,onToggle:o}):(0,W.jsx)(ru,{summary:n,baseDirectory:r,onJumpToAnchor:s}):null})}var fd=e(ae(),1),pd=10,md=1,hd=8,gd=6,_d={user:`bg-[var(--timeline-user)]`,agent:`bg-[var(--timeline-agent)]`,"tool-read":`bg-[var(--timeline-tool-read)]`,"tool-write":`bg-[var(--timeline-tool-write)]`,"tool-execute":`bg-[var(--timeline-tool-execute)]`},vd={user:`#a85f82`,agent:`#5e86aa`,"tool-read":`#478b7d`,"tool-write":`#bd7336`,"tool-execute":`#786ca3`};function yd(e){return{start:0,end:Math.min(e,80)}}function bd(e,t,n,r){if(e<=80)return{start:0,end:e};if(n<=0||r<=0)return yd(e);if(n>=r)return{start:0,end:e};let i=Math.floor(Math.max(0,t)/r*e),a=Math.ceil(Math.min(r,t+n)/r*e);return{start:Math.max(0,i-gd),end:Math.min(e,a+gd)}}function xd(e,t,n){let r=100/t;return{position:`absolute`,top:0,bottom:0,left:`calc(${e*r}% + ${e*n/t}px)`,width:`calc(${r}% - ${(t-1)*n/t}px)`}}var Sd=(0,G.memo)(function({entry:e,index:t,isActive:n,isTooltipVisible:r,virtualized:i,entryCount:a,gapWidth:o,onShowTooltip:s,onHideTooltip:c}){let l=`timeline-tooltip-${e.id}`;return(0,W.jsx)(`span`,{className:`session-timeline-item min-w-0`,style:i?xd(t,a,o):void 0,children:(0,W.jsx)(`button`,{type:`button`,"data-timeline-index":t,"aria-current":n?`location`:void 0,"aria-describedby":r?l:void 0,"aria-label":`Go to ${e.tooltip}`,className:`t-tt-trigger session-timeline-segment h-full w-full rounded-[3px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--console-text)] ${_d[e.kind]}`,onPointerEnter:t=>s(e,t.currentTarget,`pointer`),onPointerLeave:()=>c(e.id),onFocus:t=>s(e,t.currentTarget,`focus`),onBlur:()=>c(e.id)})})});function Cd(e){let t=e.parentElement;for(;t;){let{overflowY:e}=window.getComputedStyle(t);if(e===`auto`||e===`scroll`||e===`overlay`)return t;t=t.parentElement}return window}function wd(e){return e===window}function Td(e){if(wd(e)){let e=window.innerHeight||900,t=document.scrollingElement??document.documentElement;return{center:e/2,scrollTop:window.scrollY||t.scrollTop,viewportHeight:e,scrollHeight:t.scrollHeight}}return{center:e.getBoundingClientRect().top+e.clientHeight/2,scrollTop:e.scrollTop,viewportHeight:e.clientHeight,scrollHeight:e.scrollHeight}}function Ed(e){let t=e>80?{className:`gap-px`,width:1}:e>40?{className:`gap-0.5`,width:2}:{className:`gap-1`,width:4};return{gapClassName:t.className,gapWidth:t.width,minWidth:e*pd+Math.max(0,e-1)*t.width}}function Dd(e,t,n,r,i){if(r===0||e.clientWidth<=0)return;let a=Math.max(e.scrollWidth,t.scrollWidth,t.getBoundingClientRect().width);if(a<=0)return;let o=Math.max(0,(a-Math.max(0,r-1)*i)/r),s=n*(o+i),c=s+o,l=e.scrollLeft,u=l+e.clientWidth;s<l?e.scrollLeft=s:c>u&&(e.scrollLeft=c-e.clientWidth)}function Od({entries:e,onNavigate:t}){let n=(0,G.useRef)(null),r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)({active:!1,moved:!1,startX:0,lastIndex:-1}),c=(0,G.useRef)(!1),l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)(null),[f,p]=(0,G.useState)(0),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)({left:!1,right:!1}),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(()=>yd(e.length)),S=(0,G.useMemo)(()=>new Map(e.map((e,t)=>[e.anchorId,t])),[e]),C=Ed(e.length),w=e.length>80,T=w?Math.min(b.start,e.length):0,E=w?Math.max(T,Math.min(b.end,e.length)):e.length,ee=(0,G.useMemo)(()=>e.slice(T,E).map((e,t)=>({entry:e,index:T+t})),[e,E,T]),D=(0,G.useCallback)(()=>{let t=r.current;if(!t)return;let n=bd(e.length,t.scrollLeft,t.clientWidth,t.scrollWidth);x(e=>e.start===n.start&&e.end===n.end?e:n);let i=Math.max(0,t.scrollWidth-t.clientWidth),a={left:t.scrollLeft>md,right:t.scrollLeft<i-md};if(_(e=>e.left===a.left&&e.right===a.right?e:a),i<=0){y(null);return}let o={start:t.scrollLeft/t.scrollWidth,size:t.clientWidth/t.scrollWidth};y(e=>e?.start===o.start&&e.size===o.size?e:o)},[e.length]);(0,G.useLayoutEffect)(()=>{let e=a.current;if(!e||!m)return;let t=e.offsetWidth/2,n=Math.min(window.innerWidth-hd-t,Math.max(hd+t,m.anchorX));e.style.left=`${n}px`},[m]),(0,G.useLayoutEffect)(()=>{D();let e=r.current,t=i.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(D);return n.observe(e),n.observe(t),()=>n.disconnect()},[e.length,D]),(0,G.useEffect)(()=>{p(0);let t=n.current;if(!t||e.length===0)return;let r=t.closest(`[data-testid="session-detail"]`),i=Cd(t),a=0,o=`[data-session-timeline-anchor]`,s=e=>{let t=e.dataset.sessionTimelineAnchor,n=t?S.get(t):void 0;return n==null?null:{index:n,top:e.getBoundingClientRect().top}},c=()=>Array.from(r?.querySelectorAll(o)??[]).flatMap(e=>s(e)??[]),l=new Map,u=()=>Array.from(l.values()).flatMap(e=>s(e)??[]),d=()=>{let t=Td(i),n=Ks(t.scrollTop,t.viewportHeight,t.scrollHeight,e.length),r=m?u():c(),a=n??Gs(r,t.center);a!=null&&p(e=>e===a?e:a)},f=()=>{a||=requestAnimationFrame(()=>{a=0,d()})},m=typeof IntersectionObserver>`u`?null:new IntersectionObserver(e=>{for(let t of e){let e=t.target,n=e.dataset.sessionTimelineAnchor;n&&(t.isIntersecting?l.set(n,e):l.delete(n))}f()},{root:wd(i)?null:i,threshold:0}),h=e=>m?.observe(e),g=e=>{m?.unobserve(e);let t=e.dataset.sessionTimelineAnchor;t&&l.delete(t)},_=(e,t)=>{e instanceof HTMLElement&&(e.matches(o)&&t(e),e.querySelectorAll(o).forEach(t))};m&&r&&r.querySelectorAll(o).forEach(h),f(),i.addEventListener(`scroll`,f,{passive:!0}),window.addEventListener(`resize`,f);let v=typeof ResizeObserver>`u`?null:new ResizeObserver(f);r&&v?.observe(r);let y=typeof MutationObserver>`u`?null:new MutationObserver(e=>{if(!m){f();return}for(let t of e)t.addedNodes.forEach(e=>_(e,h)),t.removedNodes.forEach(e=>_(e,g));f()});return r&&y?.observe(r,{childList:!0,subtree:!0}),()=>{a&&cancelAnimationFrame(a),m?.disconnect(),v?.disconnect(),y?.disconnect(),i.removeEventListener(`scroll`,f),window.removeEventListener(`resize`,f)}},[e.length,S]),(0,G.useEffect)(()=>{let t=r.current,n=i.current;!t||!n||(Dd(t,n,f,e.length,C.gapWidth),D())},[f,e.length,C.gapWidth,D]),(0,G.useLayoutEffect)(()=>{let e=d.current;if(e==null)return;let t=i.current?.querySelector(`[data-timeline-index="${e}"]`);t&&(d.current=null,t.focus())},[E,T]);let O=v!=null;(0,G.useEffect)(()=>{let t=l.current;if(!t||!O)return;let n=()=>{let n=t.getContext(`2d`),r=t.clientWidth,i=t.clientHeight;if(!n||!r||!i||e.length===0)return;let a=window.devicePixelRatio||1;t.width=Math.round(r*a),t.height=Math.round(i*a),n.scale(a,a),n.clearRect(0,0,r,i);let o=window.getComputedStyle(t),s={user:o.getPropertyValue(`--timeline-user`).trim()||vd.user,agent:o.getPropertyValue(`--timeline-agent`).trim()||vd.agent,"tool-read":o.getPropertyValue(`--timeline-tool-read`).trim()||vd[`tool-read`],"tool-write":o.getPropertyValue(`--timeline-tool-write`).trim()||vd[`tool-write`],"tool-execute":o.getPropertyValue(`--timeline-tool-execute`).trim()||vd[`tool-execute`]};e.forEach((t,a)=>{let o=a/e.length*r,c=(a+1)/e.length*r;n.fillStyle=s[t.kind],n.fillRect(o,0,Math.max(c-o,.5),i)})};n();let r=new MutationObserver(n);if(r.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),typeof ResizeObserver>`u`)return()=>r.disconnect();let i=new ResizeObserver(n);return i.observe(t),()=>{r.disconnect(),i.disconnect()}},[e,O]);let te=(0,G.useCallback)((e,t)=>{let n=r.current;n&&(n.scrollLeft=(e-t)*n.scrollWidth)},[]),ne=(0,G.useCallback)(e=>{let t=r.current;if(!t)return;let n=Math.max(0,t.scrollWidth-t.clientWidth),i=Math.max(40,t.clientWidth*.1),a=Math.max(120,t.clientWidth*.75),o=null;e.key===`ArrowLeft`&&(o=t.scrollLeft-i),e.key===`ArrowRight`&&(o=t.scrollLeft+i),e.key===`PageUp`&&(o=t.scrollLeft-a),e.key===`PageDown`&&(o=t.scrollLeft+a),e.key===`Home`&&(o=0),e.key===`End`&&(o=n),o!=null&&(e.preventDefault(),t.scrollLeft=Math.min(n,Math.max(0,o)))},[]),k=(0,G.useCallback)((e,t,n)=>{let r=t.getBoundingClientRect();o.current=t,h({entryId:e.id,id:`timeline-tooltip-${e.id}`,text:e.tooltip,anchorX:r.left+r.width/2,top:r.bottom+8,source:n})},[]),A=(0,G.useCallback)(e=>{h(t=>t?.entryId===e?(o.current=null,null):t)},[]),re=(0,G.useCallback)(()=>{D(),h(e=>{let t=o.current;if(!e||e.source!==`focus`||!t||t!==document.activeElement)return o.current=null,null;let n=t.getBoundingClientRect();return{...e,anchorX:n.left+n.width/2,top:n.bottom+8}})},[D]),j=(0,G.useCallback)(e=>{let t=r.current;t&&(t.scrollLeft+=e*Math.max(120,t.clientWidth*.75))},[]),M=(0,G.useCallback)((n,r)=>{let a=i.current;if(!a)return;let o=a.getBoundingClientRect(),c=qs(n,o.left,o.width,e.length);if(c==null||c===s.current.lastIndex)return;let l=e[c];l&&(s.current.lastIndex=c,t(l,r))},[e,t]),ie=(0,G.useCallback)(t=>{let n=r.current,a=i.current;if(!n||!a)return;let o=a.querySelector(`[data-timeline-index="${t}"]`);if(o){o.focus();return}d.current=t,Dd(n,a,t,e.length,C.gapWidth),D()},[e.length,C.gapWidth,D]),ae=(0,G.useCallback)(t=>{let n=t.target.closest(`[data-timeline-index]`)?.dataset.timelineIndex,r=n==null?null:Number(n);if(r==null||!Number.isInteger(r))return;let i=null;t.key===`ArrowLeft`&&(i=Math.max(0,r-1)),t.key===`ArrowRight`&&(i=Math.min(e.length-1,r+1)),t.key===`Home`&&(i=0),t.key===`End`&&(i=e.length-1),!(i==null||i===r)&&(t.preventDefault(),ie(i))},[e.length,ie]);return(0,W.jsx)(`div`,{className:`sticky top-0 z-20 -mx-2 bg-[var(--console-bg)] px-2 py-3`,children:(0,W.jsxs)(`div`,{ref:n,className:`session-message-timeline relative rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-3 py-2.5 shadow-[0_1px_2px_rgba(15,23,42,0.05)]`,children:[(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(`div`,{ref:r,id:`session-timeline-viewport`,role:`navigation`,"aria-label":`Session message timeline`,tabIndex:0,className:`session-timeline-viewport overflow-x-auto overflow-y-hidden overscroll-x-contain py-1`,onScroll:re,children:(0,W.jsx)(`div`,{ref:i,"data-testid":`session-timeline-track`,className:`${w?`relative`:`grid items-stretch ${C.gapClassName}`} h-5 w-full select-none`,style:w?{minWidth:`${C.minWidth}px`}:{gridTemplateColumns:`repeat(${e.length}, minmax(${pd}px, 1fr))`,minWidth:`${C.minWidth}px`},onKeyDown:ae,onPointerDown:e=>{e.button===0&&(s.current={active:!0,moved:!1,startX:e.clientX,lastIndex:-1})},onPointerMove:e=>{let t=s.current;if(t.active){if(!t.moved){if(Math.abs(e.clientX-t.startX)<3)return;t.moved=!0,e.currentTarget.setPointerCapture(e.pointerId)}c.current=!0,M(e.clientX,`auto`)}},onPointerUp:e=>{s.current.active=!1,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),window.setTimeout(()=>{c.current=!1},0)},onPointerCancel:()=>{s.current.active=!1,c.current=!1},onClick:n=>{if(c.current)return;let r=eu(n.detail),i=n.target.closest(`[data-timeline-index]`)?.dataset.timelineIndex,a=i==null?null:Number(i),o=a==null||!Number.isInteger(a)?void 0:e[a];if(o){t(o,r);return}M(n.clientX,r)},children:ee.map(({entry:t,index:n})=>(0,W.jsx)(Sd,{entry:t,index:n,isActive:n===f,isTooltipVisible:m?.entryId===t.id,virtualized:w,entryCount:e.length,gapWidth:C.gapWidth,onShowTooltip:k,onHideTooltip:A},t.id))})}),g.left&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Scroll timeline left`,className:`absolute inset-y-0 left-0 z-10 flex w-8 items-center justify-start bg-[linear-gradient(to_right,var(--console-surface)_55%,transparent)] pl-0.5 text-[var(--console-muted)] hover:text-[var(--console-text)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--console-text)]`,onClick:()=>j(-1),children:(0,W.jsx)(le,{size:14,"aria-hidden":`true`})}),g.right&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Scroll timeline right`,className:`absolute inset-y-0 right-0 z-10 flex w-8 items-center justify-end bg-[linear-gradient(to_left,var(--console-surface)_55%,transparent)] pr-0.5 text-[var(--console-muted)] hover:text-[var(--console-text)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--console-text)]`,onClick:()=>j(1),children:(0,W.jsx)(fe,{size:14,"aria-hidden":`true`})})]}),v&&(0,W.jsx)(`div`,{"data-testid":`session-timeline-minimap`,role:`scrollbar`,"aria-controls":`session-timeline-viewport`,"aria-orientation":`horizontal`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(v.start/(1-v.size)*100),"aria-label":`Timeline scroll position`,tabIndex:0,className:`session-timeline-minimap relative mt-2 h-2.5 cursor-pointer touch-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--console-text)]`,onKeyDown:ne,onPointerDown:e=>{if(e.button!==0)return;let t=e.currentTarget.getBoundingClientRect();if(t.width<=0)return;let n=(e.clientX-t.left)/t.width,r=n>=v.start&&n<=v.start+v.size?n-v.start:v.size/2;u.current={pointerId:e.pointerId,grabOffset:r},e.currentTarget.setPointerCapture(e.pointerId),te(n,r)},onPointerMove:e=>{let t=u.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.currentTarget.getBoundingClientRect();n.width<=0||te((e.clientX-n.left)/n.width,t.grabOffset)},onPointerUp:e=>{u.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{u.current=null},children:(0,W.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden rounded-[2px]`,children:[(0,W.jsx)(`canvas`,{ref:l,"aria-hidden":`true`,className:`absolute inset-0 h-full w-full`}),(0,W.jsx)(`div`,{"data-testid":`session-timeline-minimap-window`,className:`session-timeline-minimap-window absolute inset-y-0`,style:{left:`${v.start*100}%`,width:`${v.size*100}%`}})]})}),m&&(0,fd.createPortal)((0,W.jsx)(`span`,{ref:a,id:m.id,role:`tooltip`,className:`t-tt session-timeline-floating-tooltip console-mono text-[11px]`,style:{left:m.anchorX,top:m.top},children:m.text}),document.body)]})})}function kd({anchorId:e,behavior:t,prepareAnchor:n,isCurrent:r}){if(typeof document>`u`)return;let i=tu(t,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),a=document.getElementById(e);if(!a&&n){n();let t=0,o=()=>{if(r()){if(a=document.getElementById(e),a){a.scrollIntoView({behavior:i,block:`center`});return}t+=1,t<8&&requestAnimationFrame(o)}};requestAnimationFrame(o);return}a&&a.scrollIntoView({behavior:i,block:`center`})}function Ad(e,t){if(!Te())return t();let n=performance.now(),r=t(),i=performance.now();return ve({id:e,source:`custom-timing`,phase:`measure`,actualDuration:Math.round((i-n)*100)/100,baseDuration:0,startTime:n,commitTime:i}),r}function jd({session:e,agentCatalog:t,highlightQuery:n,childSessions:r=[]}){let i=e.reference.agentName,a=k(t,i),o=(0,G.useMemo)(()=>Ad(`SessionDetail:buildDisplayModel`,()=>Ql({messages:e.messages,agentName:i,fileActivity:e.file_activity})),[e.file_activity,e.messages,i]),{messages:s,toc:c,fileChangeSummary:l}=o,[u,d]=(0,G.useState)(()=>new Set(c.filterIds)),[f,p]=(0,G.useState)(null),m=(0,G.useMemo)(()=>[...c.filterIds].toSorted().join(`|`),[c.filterIds]),h=(0,G.useMemo)(()=>[...u].toSorted().join(`|`),[u]),g=(0,G.useMemo)(()=>Ad(`SessionDetail:selectDisplayModel`,()=>o.select(u)),[o,u]),{messages:_,timelineEntries:v}=g,y=(0,G.useMemo)(()=>new Map(r.map(e=>[e.id,e])),[r]),b=(0,G.useRef)(null),x=(0,G.useRef)(0),S=(0,G.useCallback)((e,t,n)=>{let r=x.current+1;x.current=r;let i=t==null?void 0:g.resolveListIndex(t);kd({anchorId:e,behavior:n,prepareAnchor:i==null?void 0:()=>b.current?.scrollToIndex(i),isCurrent:()=>x.current===r})},[g]),C=(0,G.useCallback)((e,t)=>{S(e,o.resolveMessageIndex(e),t)},[o,S]);return(0,G.useEffect)(()=>{d(new Set(c.filterIds))},[m,c.filterIds]),s.length===0?(0,W.jsx)(`div`,{"data-testid":`session-detail`,className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-6 text-sm text-[var(--console-muted)]`,children:`当前会话暂无可展示的消息内容。`}):(0,W.jsxs)(`div`,{"data-testid":`session-detail`,className:`mx-auto w-full max-w-[1440px] space-y-8 px-2 md:px-4`,children:[(0,W.jsx)(Md,{summary:typeof e.summary_files==`string`?e.summary_files:void 0}),(0,W.jsxs)(`div`,{className:`grid gap-6 min-[1025px]:grid-cols-[240px_minmax(0,1fr)] min-[1025px]:items-start min-[1280px]:grid-cols-[220px_minmax(0,1fr)]`,children:[(0,W.jsx)(ud,{toc:c,fileChangeSummary:l,onOpen:p}),(0,W.jsx)(dd,{openPanel:f,toc:c,fileChangeSummary:l,baseDirectory:e.directory,selectedFilters:u,onClose:()=>p(null),onToggle:e=>d(t=>cu(t,e,c)),onJumpToAnchor:(e,t)=>{p(null),C(e,t)}}),(0,W.jsx)(uu,{toc:c,fileChangeSummary:l,baseDirectory:e.directory,selectedFilters:u,onToggle:e=>d(t=>cu(t,e,c)),onJumpToAnchor:C}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:_.length>0?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Od,{entries:v,onNavigate:(e,t)=>S(e.anchorId,e.messageIndex,t)}),(0,W.jsx)(ge,{id:`MessageList`,detail:{messages:_.length,virtualized:_.length>80},children:(0,W.jsx)(nd,{messages:_,sessionAgentKey:i,agent:a,baseDirectory:e.directory,highlightQuery:n,childSessionById:y,apiRef:b},`${e.id}:${h}`)})]}):(0,W.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] p-6 text-sm text-[var(--console-muted)]`,children:`当前筛选条件下暂无可展示的消息内容。`})})]}),(0,W.jsx)(ld,{session:e,toc:c})]})}function Md({summary:e,defaultExpanded:t=!1}){let n=typeof e==`string`?e.trim():``,[r,i]=(0,G.useState)(t);return n?(0,W.jsxs)(`section`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:()=>i(e=>!e),children:[(0,W.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),`Session Summary`]}),r?(0,W.jsx)(T,{className:`size-3.5 text-[var(--console-muted)]`}):(0,W.jsx)(w,{className:`size-3.5 text-[var(--console-muted)]`})]}),r?(0,W.jsx)(`div`,{className:`border-t border-[var(--console-border)] px-4 py-4`,children:(0,W.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,W.jsx)(Vo,{text:n})})}):null]}):null}export{jd as SessionDetail};
|