@staff0rd/assist 0.953.0 → 0.954.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/commands/extension/extension/content.js +4 -1
- package/dist/commands/sessions/web/bundle.js +446 -446
- package/dist/index.js +1531 -1432
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -390,7 +390,7 @@ Rules are `- **<code>** — **<title>** — <text>` bullets, the title optional,
|
|
|
390
390
|
### Sessions
|
|
391
391
|
|
|
392
392
|
- `assist sessions` - Start the web dashboard (same as `sessions web`)
|
|
393
|
-
- `assist sessions web [-p, --port <number>] [--no-open]` - Start the web dashboard with Sessions, Backlog and
|
|
393
|
+
- `assist sessions web [-p, --port <number>] [--no-open]` - Start the web dashboard with Sessions, Backlog, News and Inbox tabs (default port 3100); the Inbox tab lists the messages `assist inbox scan` flagged, newest first, each linking to the original with a dismiss button, and its badge shows how many are waiting
|
|
394
394
|
- `assist sessions close` - End the current daemon-managed session
|
|
395
395
|
- `assist sessions rename <title>` - Retitle the current daemon-managed session's dashboard card
|
|
396
396
|
- `assist sessions output [session-id] [--server [group]] [-n, --lines <count>]` - Print the recent output of a session on this node, or with `--server [group]` the current repo's live server run
|
|
@@ -431,7 +431,7 @@ The topnav's **+** button (or Ctrl+N / Alt+N; Cmd+N on macOS) opens the new-sess
|
|
|
431
431
|
|
|
432
432
|
Every hotkey is Alt plus a left-hand key, one keyboard row per screen region, and works while the terminal has focus; on macOS use Option.
|
|
433
433
|
|
|
434
|
-
- **Numbers**: Alt+1 to Alt+
|
|
434
|
+
- **Numbers**: Alt+1 to Alt+6 select the Nth visible top-level tab (with Releases hidden, News is Alt+4; Inbox is always last).
|
|
435
435
|
- **Q W E** (top right): Alt+Q opens the Updates page (the version badge), Alt+W opens the config page and Alt+E opens the menu with focus on its first item.
|
|
436
436
|
- **R** (toolbar): Alt+R focuses the toolbar's repo picker; Tab / Shift+Tab then move along the toolbar.
|
|
437
437
|
- **A S D** (main area, left to right): Alt+A focuses the active session's sidebar card (expanding the sidebar and switching to Active), Alt+S focuses its terminal, and Alt+D opens and focuses its diff panel, or closes it back to the terminal when the diff already has focus. While the session's preview pane is open, Alt+D focuses the pane instead (landing on its primary decision button, **Approve & start** or else **Approve**, when it has one), and pressing it again returns focus to the terminal, leaving the pane open.
|
|
@@ -439,7 +439,7 @@ Every hotkey is Alt plus a left-hand key, one keyboard row per screen region, an
|
|
|
439
439
|
|
|
440
440
|
Keys whose target is on Sessions return there first. Ctrl+/ (Cmd+/ on macOS) or the menu's **Keyboard shortcuts** item opens a sheet listing every sessions-view shortcut. The top-level tabs, the new-session button, the repo picker, the top-bar add agent / VS Code / done buttons, the active session's diff counts, the version badge, the config cog and the menu button show their chord in their tooltip on hover and keyboard focus.
|
|
441
441
|
|
|
442
|
-
Each shortcut's chord can be overridden under `sessions.hotkeys.<action>`, e.g. `assist config set sessions.hotkeys.focusTerminal Ctrl+Alt+J -g`; restart the web server and reload the page to apply it. `assist sessions web --help` lists every action with its default. A chord is modifiers plus one key joined by `+`, such as `Alt+S`, `Ctrl+Shift+K` or `Mod+/`: the modifiers are `Ctrl`, `Alt` (`Option`), `Shift`, `Meta` (`Cmd`) and `Mod` (Cmd on macOS, Ctrl elsewhere), at least one of them other than Shift, and the key is a letter, digit, punctuation, `F1`–`F12` or a named key such as `Enter` or `ArrowUp`. Keys match the physical key, so macOS Option chords work. `navTab` takes modifiers only (e.g. `Ctrl+Alt`); its digits stay 1–
|
|
442
|
+
Each shortcut's chord can be overridden under `sessions.hotkeys.<action>`, e.g. `assist config set sessions.hotkeys.focusTerminal Ctrl+Alt+J -g`; restart the web server and reload the page to apply it. `assist sessions web --help` lists every action with its default. A chord is modifiers plus one key joined by `+`, such as `Alt+S`, `Ctrl+Shift+K` or `Mod+/`: the modifiers are `Ctrl`, `Alt` (`Option`), `Shift`, `Meta` (`Cmd`) and `Mod` (Cmd on macOS, Ctrl elsewhere), at least one of them other than Shift, and the key is a letter, digit, punctuation, `F1`–`F12` or a named key such as `Enter` or `ArrowUp`. Keys match the physical key, so macOS Option chords work. `navTab` takes modifiers only (e.g. `Ctrl+Alt`); its digits stay 1–6. An override replaces all of an action's default chords, and `assist config set` rejects an invalid chord. Tab card-cycling is fixed.
|
|
443
443
|
|
|
444
444
|
Every live session card carries an **add-agent** button (👥) that starts a second agent inside that session's existing workspace rather than allocating a new one. While several agents share a workspace, only the last one to leave triggers teardown.
|
|
445
445
|
|
|
@@ -173,6 +173,9 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
173
173
|
padding: 3px 12px 3px 8px;
|
|
174
174
|
margin-left: 0;
|
|
175
175
|
}
|
|
176
|
+
.assist-send--before-date {
|
|
177
|
+
margin-right: 8px;
|
|
178
|
+
}
|
|
176
179
|
.assist-send:hover:not(:disabled) {
|
|
177
180
|
background: var(--button-default-bgColor-hover, #eff2f5);
|
|
178
181
|
border-color: var(--fgColor-muted, #59636e);
|
|
@@ -199,7 +202,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
199
202
|
transition: none;
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
|
-
`;function $1(){if(document.head.querySelector(`[${F1}]`))return;let e=document.createElement("style");e.setAttribute(F1,""),e.textContent=MB,document.head.append(e)}function q1(e){let t={type:"assist-send",...e};return Bf(t)}var CO=S(bO(),1);var o4=["keydown","keyup","keypress"];function TO(e){for(let t of o4)e.addEventListener(t,o=>o.stopPropagation())}var il=S(U(),1);function r4(e){let t=e.getAttribute("data-color-mode");return t==="light"||t==="dark"?t:globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Sc(e){let t=r4(e),o=e.getAttribute(t==="dark"?"data-dark-theme":"data-light-theme");return o?o.startsWith("dark")?"dark":"light":t}var n4=["data-color-mode","data-light-theme","data-dark-theme"];function vO(e,t){let o=Sc(e),r=()=>{let i=Sc(e);i!==o&&(o=i,t(i))},n=new MutationObserver(r);n.observe(e,{attributeFilter:n4});let a=globalThis.matchMedia?.("(prefers-color-scheme: dark)");return a?.addEventListener?.("change",r),()=>{n.disconnect(),a?.removeEventListener?.("change",r)}}var SO=S(z(),1);function xO({children:e}){let[t,o]=(0,il.useState)(()=>Sc(document.documentElement));(0,il.useEffect)(()=>vO(document.documentElement,o),[]);let r=(0,il.useMemo)(()=>hr({palette:{mode:t},typography:{fontFamily:"inherit"}}),[t]);return(0,SO.jsx)(Bp,{theme:r,children:e})}var gT=S(z(),1);function cm(e,t,o){let r=e.shadowRoot??e.attachShadow({mode:"open"});TO(e);let n=document.createElement("div"),a=document.createElement("div");a.style.cssText="width:100%;font:inherit;color:inherit",r.append(n,a);let i=Lc({key:t,container:n}),s=(0,CO.createRoot)(a);return s.render((0,gT.jsx)(Gm,{value:i,children:(0,gT.jsx)(xO,{children:o})})),s}function EO(e,t){let o=t.closest('dialog, [role="dialog"]'),r=o?i4:a4,n=()=>{e.style.cssText=r(t)};return n(),o?(e.setAttribute("popover","manual"),o.append(e),e.showPopover?.()):document.body.append(e),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}function a4(e){let{top:t,left:o}=PO(e);return["position: absolute",`top: ${t+window.scrollY}px`,`left: ${o+window.scrollX}px`,"width: 320px","z-index: 2147483646"].join(";")}function i4(e){let{top:t,left:o}=PO(e);return["position: fixed","inset: auto",`top: ${t}px`,`left: ${o}px`,"width: 320px","height: auto","margin: 0","padding: 0","border: 0","background: transparent","overflow: visible"].join(";")}function PO(e){let t=e.getBoundingClientRect(),o=Math.max(16,Math.min(t.left,window.innerWidth-320-16));return{top:t.bottom+4,left:o}}var Cc=null;function s4(){Cc?.close()}function RO(e,t){let o=Cc?.anchor;if(s4(),o===e)return;let r=document.createElement("div");r.setAttribute("data-assist-popover","");let n=EO(r,e),a=()=>{Cc?.close===a&&(Cc=null,n(),r.remove(),queueMicrotask(()=>i.unmount()))};Cc={anchor:e,close:a};let i=cm(r,"assist-popover",t(s=>{a(),s&&e.focus()}))}var l4="icons/assist-32.png";function OO(){let e=si()?.getURL?.(l4);if(!e)return;let t=document.createElement("img");return t.src=e,t.alt="",t}function AO(e){try{return decodeURIComponent(e)}catch{return e}}var u4=/^\/([^/]+)\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,c4=/^(?:\/DefaultCollection)?\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,p4=/^([^.]+)\.visualstudio\.com$/;function f4(e,t){if(e==="dev.azure.com"){let n=u4.exec(t);return n&&{path:n[0],parts:n.slice(1)}}let o=p4.exec(e)?.[1],r=o?c4.exec(t):null;return r&&o?{path:r[0],parts:[o,...r.slice(1)]}:null}function Ec(e){let t;try{t=new URL(e)}catch{return}if(t.protocol!=="https:")return;let o=f4(t.hostname.toLowerCase(),t.pathname);if(!o)return;let[r,n,a,i]=o.parts.map(AO);return{org:r,project:n,repo:a,id:i,url:`${t.origin}${o.path}`}}var d4=/^\/[^/]+\/[^/]+\/pull\/(\d+)(?:\/|$)/;function MO(e){let t;try{t=new URL(e)}catch{return}return d4.exec(t.pathname)?.[1]}function wO(e,t){if(typeof t!="function")return"link";if(e!=="header")return"instructions";let o=t();return Ec(o)?"azure-devops-review":MO(o)?"review":"instructions"}var NO="assist";async function m4(e){return typeof e=="function"?e():e.link()}function Jn(e,t,o="comment"){$1();let r=document.createElement("button");r.type="button",r.setAttribute("data-assist-send",""),r.className=o==="header"?"assist-send assist-send--header":"assist-send",r.title=t;let n=document.createElement("span");n.textContent=NO;let a=OO();a&&r.append(a),r.append(n);let i=async s=>{r.disabled=!0,n.textContent="sending\u2026";let l=await m4(e).then(u=>q1({url:u,...s}),u=>({ok:!1,message:u instanceof Error?u.message:String(u)}));zf(l.message,l.ok),r.disabled=!1,n.textContent=NO};return r.addEventListener("mousedown",s=>s.preventDefault()),r.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),RO(r,l=>V1(wO(o,e),{send:i,dismiss:l}))}),r}function DO(e){return`https://mail.google.com/mail/u/0/#search/rfc822msgid%3A${encodeURIComponent(e)}`}var y4={"<":"<",">":">","&":"&",""":'"',"'":"'"},h4=/(?:^|>)Message-ID:[ \t]*(?:\r?\n[ \t]+)?(?:<|<)([^\s<>]+?)(?:>|>)/im;function _O(e){let t=h4.exec(e);return t?`<${t[1].replace(/&(?:lt|gt|amp|quot|#39);/g,r=>y4[r])}>`:void 0}var g4=/GLOBALS=\[(?:[^,]*,){9}"([0-9a-f]+)"/,b4=/^\/mail\/u\/\d+[/]/;function T4(){return globalThis.content?.fetch??fetch}function v4(){for(let e of document.querySelectorAll("script")){let t=g4.exec(e.textContent??"")?.[1];if(t)return t}}function x4(e){let t=b4.exec(location.pathname)?.[0]??"/mail/u/0/",o=`${location.origin}${t}`,r=e.dataset.messageId?.replace(/^#/,""),n=e.dataset.legacyMessageId,a=v4();return[r&&`${o}?${a?`ik=${a}&`:""}view=om&permmsgid=${encodeURIComponent(r)}`,n&&`${o}?view=att&th=${n}&attid=0&disp=comp&safe=1&zw`].filter(i=>!!i)}async function BO(e){for(let t of x4(e)){let o=await T4()(t,{credentials:"include"}).catch(()=>{});if(!o?.ok)continue;let r=_O(await o.text());if(r)return r}throw new Error("Couldn't resolve this message's Message-ID")}var S4="div.adn[data-message-id]",C4="span.g3";function zO(){for(let e of document.querySelectorAll(S4)){let t=e.querySelector(C4)
|
|
205
|
+
`;function $1(){if(document.head.querySelector(`[${F1}]`))return;let e=document.createElement("style");e.setAttribute(F1,""),e.textContent=MB,document.head.append(e)}function q1(e){let t={type:"assist-send",...e};return Bf(t)}var CO=S(bO(),1);var o4=["keydown","keyup","keypress"];function TO(e){for(let t of o4)e.addEventListener(t,o=>o.stopPropagation())}var il=S(U(),1);function r4(e){let t=e.getAttribute("data-color-mode");return t==="light"||t==="dark"?t:globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Sc(e){let t=r4(e),o=e.getAttribute(t==="dark"?"data-dark-theme":"data-light-theme");return o?o.startsWith("dark")?"dark":"light":t}var n4=["data-color-mode","data-light-theme","data-dark-theme"];function vO(e,t){let o=Sc(e),r=()=>{let i=Sc(e);i!==o&&(o=i,t(i))},n=new MutationObserver(r);n.observe(e,{attributeFilter:n4});let a=globalThis.matchMedia?.("(prefers-color-scheme: dark)");return a?.addEventListener?.("change",r),()=>{n.disconnect(),a?.removeEventListener?.("change",r)}}var SO=S(z(),1);function xO({children:e}){let[t,o]=(0,il.useState)(()=>Sc(document.documentElement));(0,il.useEffect)(()=>vO(document.documentElement,o),[]);let r=(0,il.useMemo)(()=>hr({palette:{mode:t},typography:{fontFamily:"inherit"}}),[t]);return(0,SO.jsx)(Bp,{theme:r,children:e})}var gT=S(z(),1);function cm(e,t,o){let r=e.shadowRoot??e.attachShadow({mode:"open"});TO(e);let n=document.createElement("div"),a=document.createElement("div");a.style.cssText="width:100%;font:inherit;color:inherit",r.append(n,a);let i=Lc({key:t,container:n}),s=(0,CO.createRoot)(a);return s.render((0,gT.jsx)(Gm,{value:i,children:(0,gT.jsx)(xO,{children:o})})),s}function EO(e,t){let o=t.closest('dialog, [role="dialog"]'),r=o?i4:a4,n=()=>{e.style.cssText=r(t)};return n(),o?(e.setAttribute("popover","manual"),o.append(e),e.showPopover?.()):document.body.append(e),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}function a4(e){let{top:t,left:o}=PO(e);return["position: absolute",`top: ${t+window.scrollY}px`,`left: ${o+window.scrollX}px`,"width: 320px","z-index: 2147483646"].join(";")}function i4(e){let{top:t,left:o}=PO(e);return["position: fixed","inset: auto",`top: ${t}px`,`left: ${o}px`,"width: 320px","height: auto","margin: 0","padding: 0","border: 0","background: transparent","overflow: visible"].join(";")}function PO(e){let t=e.getBoundingClientRect(),o=Math.max(16,Math.min(t.left,window.innerWidth-320-16));return{top:t.bottom+4,left:o}}var Cc=null;function s4(){Cc?.close()}function RO(e,t){let o=Cc?.anchor;if(s4(),o===e)return;let r=document.createElement("div");r.setAttribute("data-assist-popover","");let n=EO(r,e),a=()=>{Cc?.close===a&&(Cc=null,n(),r.remove(),queueMicrotask(()=>i.unmount()))};Cc={anchor:e,close:a};let i=cm(r,"assist-popover",t(s=>{a(),s&&e.focus()}))}var l4="icons/assist-32.png";function OO(){let e=si()?.getURL?.(l4);if(!e)return;let t=document.createElement("img");return t.src=e,t.alt="",t}function AO(e){try{return decodeURIComponent(e)}catch{return e}}var u4=/^\/([^/]+)\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,c4=/^(?:\/DefaultCollection)?\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,p4=/^([^.]+)\.visualstudio\.com$/;function f4(e,t){if(e==="dev.azure.com"){let n=u4.exec(t);return n&&{path:n[0],parts:n.slice(1)}}let o=p4.exec(e)?.[1],r=o?c4.exec(t):null;return r&&o?{path:r[0],parts:[o,...r.slice(1)]}:null}function Ec(e){let t;try{t=new URL(e)}catch{return}if(t.protocol!=="https:")return;let o=f4(t.hostname.toLowerCase(),t.pathname);if(!o)return;let[r,n,a,i]=o.parts.map(AO);return{org:r,project:n,repo:a,id:i,url:`${t.origin}${o.path}`}}var d4=/^\/[^/]+\/[^/]+\/pull\/(\d+)(?:\/|$)/;function MO(e){let t;try{t=new URL(e)}catch{return}return d4.exec(t.pathname)?.[1]}function wO(e,t){if(typeof t!="function")return"link";if(e!=="header")return"instructions";let o=t();return Ec(o)?"azure-devops-review":MO(o)?"review":"instructions"}var NO="assist";async function m4(e){return typeof e=="function"?e():e.link()}function Jn(e,t,o="comment"){$1();let r=document.createElement("button");r.type="button",r.setAttribute("data-assist-send",""),r.className=o==="header"?"assist-send assist-send--header":"assist-send",r.title=t;let n=document.createElement("span");n.textContent=NO;let a=OO();a&&r.append(a),r.append(n);let i=async s=>{r.disabled=!0,n.textContent="sending\u2026";let l=await m4(e).then(u=>q1({url:u,...s}),u=>({ok:!1,message:u instanceof Error?u.message:String(u)}));zf(l.message,l.ok),r.disabled=!1,n.textContent=NO};return r.addEventListener("mousedown",s=>s.preventDefault()),r.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),RO(r,l=>V1(wO(o,e),{send:i,dismiss:l}))}),r}function DO(e){return`https://mail.google.com/mail/u/0/#search/rfc822msgid%3A${encodeURIComponent(e)}`}var y4={"<":"<",">":">","&":"&",""":'"',"'":"'"},h4=/(?:^|>)Message-ID:[ \t]*(?:\r?\n[ \t]+)?(?:<|<)([^\s<>]+?)(?:>|>)/im;function _O(e){let t=h4.exec(e);return t?`<${t[1].replace(/&(?:lt|gt|amp|quot|#39);/g,r=>y4[r])}>`:void 0}var g4=/GLOBALS=\[(?:[^,]*,){9}"([0-9a-f]+)"/,b4=/^\/mail\/u\/\d+[/]/;function T4(){return globalThis.content?.fetch??fetch}function v4(){for(let e of document.querySelectorAll("script")){let t=g4.exec(e.textContent??"")?.[1];if(t)return t}}function x4(e){let t=b4.exec(location.pathname)?.[0]??"/mail/u/0/",o=`${location.origin}${t}`,r=e.dataset.messageId?.replace(/^#/,""),n=e.dataset.legacyMessageId,a=v4();return[r&&`${o}?${a?`ik=${a}&`:""}view=om&permmsgid=${encodeURIComponent(r)}`,n&&`${o}?view=att&th=${n}&attid=0&disp=comp&safe=1&zw`].filter(i=>!!i)}async function BO(e){for(let t of x4(e)){let o=await T4()(t,{credentials:"include"}).catch(()=>{});if(!o?.ok)continue;let r=_O(await o.text());if(r)return r}throw new Error("Couldn't resolve this message's Message-ID")}var S4="div.adn[data-message-id]",C4="span.g3";function zO(){for(let e of document.querySelectorAll(S4)){let t=e.querySelector(C4);if(!t||e.querySelector("[data-assist-send]"))continue;let o=Jn({link:async()=>DO(await BO(e))},"Start an assist session from this email");o.classList.add("assist-send--before-date"),t.before(o)}}var E4=['a[href*="#discussion_r"]','a[href*="#issuecomment-"]','a[href*="#pullrequestreview-"]'].join(",");function P4(e){return e.classList.contains("js-timestamp")||e.querySelector("relative-time")!==null}function kO(){for(let e of document.querySelectorAll(E4))P4(e)&&(e.nextElementSibling?.hasAttribute("data-assist-send")||e.after(Jn(()=>e.href,"Start an assist session from this comment")))}function pm({owner:e,repo:t,number:o}){return document.querySelector(`a[href$="/${e}/${t}/pull/${o}" i]`)!==null}var R4=/^\/(?:orgs|users)\/[^/]+\/projects\/\d+(?:\/|$)/,O4=/^([\w.-]+)\|([\w.-]+)\|(\d+)$/;function fm({pathname:e,search:t}){if(!R4.test(e))return;let o=new URLSearchParams(t);if(o.get("pane")!=="issue")return;let r=O4.exec(o.get("issue")??"");if(!r)return;let[,n,a,i]=r;return{owner:n,repo:a,number:i}}var A4=/^\/([^/]+)\/([^/]+)\/(pull|issues)\/(\d+)(?:\/|$)/;function bT(e,t=pm){let o=A4.exec(e.pathname);if(o){let[,a,i,s,l]=o;return`${e.origin}/${a}/${i}/${s}/${l}`}let r=fm(e);if(!r)return;let n=t(r)?"pull":"issues";return`${e.origin}/${r.owner}/${r.repo}/${n}/${r.number}`}var M4='.gh-header-actions, [data-component="PH_Actions"]';function UO(){if(!bT(location)){for(let e of document.querySelectorAll(".assist-send--header[data-assist-send]"))e.remove();return}for(let e of document.querySelectorAll(M4))e.querySelector(":scope > [data-assist-send]")||e.prepend(Jn(()=>bT(location)??location.href,"Start an assist session from this page","header"))}var w4=".repos-pr-header .repos-pr-header-complete-button";function LO(){if(!Ec(location.href)){for(let o of document.querySelectorAll(".assist-send--header[data-assist-send]"))o.remove();return}let t=document.querySelector(w4)?.parentElement;!t||t.querySelector(":scope > [data-assist-send]")||t.prepend(Jn(()=>Ec(location.href)?.url??location.href,"Start an assist session for this PR","header"))}var N4=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,D4=/^ {0,3}#{1,6}[ \t]/;function Pr(e){let t=e.split(`
|
|
203
206
|
`),o=t.findIndex(i=>N4.test(i));if(o===-1)return null;let r=o+1;for(;r<t.length&&!D4.test(t[r]);)r+=1;let n=o+1;for(;n<r&&t[n].trim()==="";)n+=1;let a=r;for(;a>n&&t[a-1].trim()==="";)a-=1;return n===r&&(n=o+1,a=o+1),{before:t.slice(0,n),lines:t.slice(n,a),after:t.slice(a)}}function dm(e){let t=0;for(let o of e)t+=o===" "?4:1;return t}function mm(e){let t=[];return e.map(o=>{for(;t.length>0&&o<t[t.length-1];)t.pop();return(t.length===0||o>t[t.length-1])&&t.push(o),t.length-1})}var _4=/^([ \t]*)\d+[.)](?:[ \t]+(.*))?$/;function jO(e){let t=Pr(e);if(!t)return null;let o=[];for(let n of t.lines){if(n.trim()==="")continue;let a=_4.exec(n);if(!a)return null;o.push({width:dm(a[1]),text:a[2]??""})}let r=mm(o.map(n=>n.width));return{before:t.before,items:o.map((n,a)=>({text:n.text,depth:r[a]})),after:t.after}}function ym(e){let t=jO(e);if(t)return{kind:"outline",items:t.items,before:t.before.join(`
|
|
204
207
|
`),after:t.after.join(`
|
|
205
208
|
`)};let o=Pr(e);return o?{kind:"convert",before:[...o.before,...o.lines].join(`
|