agent-afk 5.207.2 → 5.208.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/dist/agent/tools/handlers/web-request.d.ts +2 -2
- package/dist/agent/tools/handlers/web-scrape.d.ts +2 -2
- package/dist/cli.mjs +581 -581
- package/dist/index.mjs +1 -1
- package/dist/telegram.mjs +1 -1
- package/dist/web-server/shared/ledger-adapter.d.ts +3 -0
- package/dist/web-ui-assets/assets/index-3YQ3Lxgf.css +1 -0
- package/dist/web-ui-assets/assets/index-Ye2O81KT.js +298 -0
- package/dist/web-ui-assets/index.html +14 -87
- package/package.json +2 -2
- package/dist/web-server/frontend/ansi-strip.d.ts +0 -1
- package/dist/web-server/frontend/app-approvals.d.ts +0 -7
- package/dist/web-server/frontend/app-chrome.d.ts +0 -3
- package/dist/web-server/frontend/app-views.d.ts +0 -3
- package/dist/web-server/frontend/app.d.ts +0 -1
- package/dist/web-server/frontend/at-file-panel.d.ts +0 -5
- package/dist/web-server/frontend/bg-jobs-panel.d.ts +0 -14
- package/dist/web-server/frontend/chrome.d.ts +0 -1
- package/dist/web-server/frontend/composer-value.d.ts +0 -1
- package/dist/web-server/frontend/composer-wiring.d.ts +0 -7
- package/dist/web-server/frontend/diff-viewer.d.ts +0 -17
- package/dist/web-server/frontend/dom-utils.d.ts +0 -2
- package/dist/web-server/frontend/ledger-adapter.d.ts +0 -2
- package/dist/web-server/frontend/markdown-dom.d.ts +0 -1
- package/dist/web-server/frontend/memory-panel.d.ts +0 -6
- package/dist/web-server/frontend/model-selector.d.ts +0 -10
- package/dist/web-server/frontend/queue-panel.d.ts +0 -21
- package/dist/web-server/frontend/queue-reorder.d.ts +0 -5
- package/dist/web-server/frontend/render-approvals.d.ts +0 -22
- package/dist/web-server/frontend/render-incremental.d.ts +0 -3
- package/dist/web-server/frontend/render.d.ts +0 -16
- package/dist/web-server/frontend/schedule-form.d.ts +0 -7
- package/dist/web-server/frontend/schedule-history.d.ts +0 -1
- package/dist/web-server/frontend/schedules-view.d.ts +0 -33
- package/dist/web-server/frontend/scroll-pin.d.ts +0 -7
- package/dist/web-server/frontend/session-status.d.ts +0 -11
- package/dist/web-server/frontend/slash-autocomplete-render.d.ts +0 -3
- package/dist/web-server/frontend/slash-autocomplete.d.ts +0 -39
- package/dist/web-server/frontend/slash-highlight.d.ts +0 -8
- package/dist/web-server/frontend/sse-client.d.ts +0 -20
- package/dist/web-server/frontend/subagent-tree.d.ts +0 -27
- package/dist/web-server/frontend/thinking-panel.d.ts +0 -3
- package/dist/web-server/frontend/tool-trace-panel.d.ts +0 -2
- package/dist/web-server/frontend/view-model.d.ts +0 -66
- package/dist/web-server/frontend/web-token.d.ts +0 -3
- package/dist/web-ui-assets/app.js +0 -65
- package/dist/web-ui-assets/approvals.css +0 -55
- package/dist/web-ui-assets/at-file.css +0 -110
- package/dist/web-ui-assets/bg-jobs.css +0 -130
- package/dist/web-ui-assets/chrome.js +0 -1
- package/dist/web-ui-assets/diff-viewer.css +0 -168
- package/dist/web-ui-assets/memory.css +0 -146
- package/dist/web-ui-assets/model-selector.css +0 -118
- package/dist/web-ui-assets/schedules.css +0 -201
- package/dist/web-ui-assets/styles.css +0 -680
- /package/dist/{web → http-client}/egress-guard.d.ts +0 -0
- /package/dist/{web → http-client}/extract.d.ts +0 -0
- /package/dist/{web → http-client}/extraction-advisory.d.ts +0 -0
- /package/dist/{web → http-client}/index.d.ts +0 -0
- /package/dist/{web → http-client}/retryFetch.d.ts +0 -0
- /package/dist/{web → http-client}/scrape.d.ts +0 -0
- /package/dist/{web → http-client}/search.d.ts +0 -0
- /package/dist/{web → http-client}/types.d.ts +0 -0
- /package/dist/{web → http-client}/web-request.d.ts +0 -0
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var Mn="__AFK_WEB_TOKEN__",bt="afk_web_token",kt="";function vt(){let t=new URLSearchParams(location.search);(t.get("token")||t.get("k"))&&history.replaceState(null,"",location.pathname);let e=An();return e?(Rn(e),e):$n()}function An(){let t=document.querySelector('meta[name="afk-token"]')?.getAttribute("content");return!t||t===Mn?"":t}function Rn(t){kt=t;try{sessionStorage.setItem(bt,t)}catch{}}function $n(){try{let t=sessionStorage.getItem(bt);if(t)return t}catch{}return kt}var Fi=Object.freeze({end:!0,reason:"session_closed"});function yt(t){return typeof t=="object"&&t!==null&&t.end===!0}function xt(t){let n=t.replace(/\r\n/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
|
|
4
|
-
`),s=n.pop()??"",i=[];for(let r of n){if(r.trim()==="")continue;let o,l;for(let a of r.split(`
|
|
5
|
-
`))a.startsWith("id: ")?o=a.slice(4):a.startsWith("id:")?o=a.slice(3).trimStart():a.startsWith("data: ")?l=a.slice(6):a.startsWith("data:")&&(l=a.slice(5).trimStart());l!==void 0&&i.push({id:o,data:l})}return{events:i,remainder:s}}var In=15e3,Hn=500,ge=class{constructor(e,n,s){this.sessionId=e;this.token=n;this.handlers=s}sessionId;token;handlers;controller;lastEventId;attempt=0;stopped=!1;start(){this.stopped=!1,this.connect()}stop(){this.stopped=!0,this.controller?.abort(),this.handlers.onStatus?.("closed")}async connect(){if(this.stopped)return;this.handlers.onStatus?.(this.attempt===0?"connecting":"reconnecting");let e=!1;this.controller=new AbortController;let n={authorization:`Bearer ${this.token}`};this.lastEventId!==void 0&&(n["last-event-id"]=this.lastEventId);try{let r=await fetch(`/api/sessions/${encodeURIComponent(this.sessionId)}/stream`,{headers:n,signal:this.controller.signal});if(!r.ok){if(r.status===401||r.status===403||r.status===404){this.stopped=!0;let c=r.status===401?"unauthorized":r.status===403?"forbidden":"not-found";this.handlers.onStatus?.("closed",c);return}throw new Error(`stream failed: ${r.status}`)}if(r.body===null)throw new Error("stream failed: no body");this.attempt=0,this.handlers.onStatus?.("open");let o=r.body.getReader(),l=new TextDecoder,a="";e:for(;;){let{done:c,value:d}=await o.read();if(c)break;a+=l.decode(d,{stream:!0});let{events:u,remainder:p}=xt(a);a=p;for(let m of u){if(m.id!==void 0&&(this.lastEventId=m.id),m.data===void 0)continue;let h;try{h=JSON.parse(m.data)}catch{continue}if(yt(h)){e=!0,this.stopped=!0;break e}this.handlers.onEvent(h,{id:m.id})}}}catch{}if(this.stopped){e&&this.handlers.onStatus?.("ended");return}this.attempt+=1;let s=.75+Math.random()*.5,i=Math.min(Hn*2**(this.attempt-1),In)*s;setTimeout(()=>{this.connect()},i)}};var wt=/(?:^|\s)(\/[A-Za-z][A-Za-z0-9_:-]*)/g,Nn=Number.POSITIVE_INFINITY;function St(t){let e=new Map;for(let n=0;n<t.length;n++){let s=t[n];if(!s)continue;wt.lastIndex=0;let i;for(;(i=wt.exec(s))!==null;){let r=i[1]?.toLowerCase();r!==void 0&&!e.has(r)&&e.set(r,n)}}return e}function Ct(t,e){let n=t.startsWith("/")?t.toLowerCase():`/${t.toLowerCase()}`;return e.get(n)??Nn}function Et(t,e,n){let s=Ct(t,n),i=Ct(e,n);return s!==i?s-i:t.localeCompare(e)}var Pn=20;function _n(t,e){if(t.length===0)return!0;let n=0;for(let s=0;s<e.length&&n<t.length;s++)e[s]===t[n]&&(n+=1);return n===t.length}function Tt(t,e,n=[]){let s=e.toLowerCase(),i=t.map(d=>({key:d.name.replace(/^\//,"").toLowerCase(),cand:{value:d.name,...d.summary!==void 0?{summary:d.summary}:{},...d.hint!==void 0?{hint:d.hint}:{}}})),r=i.filter(d=>d.key.startsWith(s)),o=new Set(r.map(d=>d.cand.value)),l=s.length===0?[]:i.filter(d=>!o.has(d.cand.value)&&_n(s,d.key)),a=St(n),c=(d,u)=>Et(d.cand.value,u.cand.value,a);return r.sort(c),l.sort(c),[...r,...l].map(d=>d.cand).slice(0,Pn)}function be(t){t.dispatchEvent(new Event("input"))}var Lt=new Set(["/clear","/compact","/editor","/exit","/fast","/font-size","/fork","/keys","/model","/reauth","/resume","/rewind","/sh","/theme","/thinking"]);function Mt(t,e,n,s){let i=document.createElement("div");i.id=e,i.setAttribute("role","option"),i.setAttribute("aria-selected",String(n)),i.className=n?"slash-row is-selected":"slash-row";let r=document.createElement("span");if(r.className="slash-name",r.textContent=t.value,i.appendChild(r),Lt.has(t.value)){let o=document.createElement("span");o.className="slash-badge",o.textContent="REPL only",o.title="Drives terminal-only machinery; cannot act in the browser.",i.appendChild(o)}if(t.summary!==void 0&&t.summary!==""){let o=document.createElement("span");o.className="slash-summary",o.textContent=t.summary,i.appendChild(o)}return i.addEventListener("mousedown",o=>{o.button===0&&(o.preventDefault(),s(t))}),i}var At=/^\/(?:[A-Za-z][\w:-]*)?$/,ke=class{constructor(e){this.deps=e;this.menuId=e.menu.id||"slash-autocomplete-listbox",this.focused=document.activeElement===e.input,e.menu.id=this.menuId,e.menu.setAttribute("role","listbox"),e.input.removeAttribute("role"),e.input.setAttribute("aria-autocomplete","list"),e.input.setAttribute("aria-haspopup","listbox"),e.input.setAttribute("aria-controls",this.menuId),this.status=document.createElement("div"),this.status.className="slash-status",this.status.setAttribute("role","status"),this.status.setAttribute("aria-live","polite"),this.status.setAttribute("aria-atomic","true"),e.menu.insertAdjacentElement("afterend",this.status),this.syncAria()}deps;commands=null;loading=null;candidates=[];selected=0;open=!1;openIntent=!1;focused=!1;composing=!1;generation=0;menuId;status;isOpen(){return this.open&&this.candidates.length>0}knows(e){return this.commands?.some(n=>n.name===e)??!1}async preload(){await this.ensureCommands()}current(){return this.isOpen()?this.candidates[this.selected]:void 0}wire(){this.deps.input.addEventListener("focus",()=>{this.focused=!0}),this.deps.input.addEventListener("keydown",e=>this.onKeyDown(e)),this.deps.input.addEventListener("compositionstart",()=>{this.composing=!0}),this.deps.input.addEventListener("compositionend",()=>{this.composing=!1,this.openIntent&&this.refresh()}),this.deps.input.addEventListener("input",()=>{this.openIntent=!0,this.composing||this.refresh()}),this.deps.input.addEventListener("blur",()=>{this.focused=!1,this.composing=!1,this.close(!0)})}onKeyDown(e){if(!(e.isComposing||e.keyCode===229)){if(e.key==="Escape"&&(this.openIntent||this.loading!==null)){this.close(!0),e.preventDefault(),e.stopImmediatePropagation();return}if(this.isOpen()&&!(e.key==="Enter"&&(e.metaKey||e.ctrlKey))){switch(e.key){case"ArrowDown":this.move(1);break;case"ArrowUp":this.move(-1);break;case"Tab":case"Enter":this.accept();break;case"Escape":this.close();break;default:return}e.preventDefault(),e.stopImmediatePropagation()}}}move(e){let n=this.candidates.length;this.selected=(this.selected+e+n)%n,this.render(),this.revealSelected()}revealSelected(){let e=this.deps.menu.children[this.selected];e instanceof HTMLElement&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}accept(){let e=this.current();e&&(this.deps.input.value=`${e.value} `,this.close(!0),this.deps.input.focus(),be(this.deps.input))}close(e=!1){e&&(this.openIntent=!1,this.generation+=1),this.open=!1,this.candidates=[],this.selected=0,this.deps.menu.hidden=!0,this.deps.menu.textContent="",this.status.textContent="",this.syncAria()}syncAria(){let e=this.isOpen();if(this.deps.input.setAttribute("aria-expanded",String(e)),e){this.deps.input.setAttribute("aria-activedescendant",this.optionId(this.selected));let n=this.candidates[this.selected];this.status.textContent=n?`${this.candidates.length} suggestions. ${n.value}, ${this.selected+1} of ${this.candidates.length}.`:""}else this.deps.input.removeAttribute("aria-activedescendant"),this.status.textContent=""}optionId(e){return`${this.menuId}-option-${e}`}async refresh(){!this.focused&&document.activeElement===this.deps.input&&(this.focused=!0);let e=this.deps.input.value;if(!At.test(e)){this.close(!0);return}this.openIntent=!0;let n=++this.generation;if(await this.ensureCommands(),n!==this.generation||!this.openIntent||!this.focused||!At.test(this.deps.input.value)){n===this.generation&&this.close();return}let s=this.deps.input.value.slice(1);this.candidates=Tt(this.commands??[],s),this.selected=0,this.open=this.candidates.length>0,this.openIntent=this.open,this.render()}async ensureCommands(){this.commands===null&&(this.loading??=this.deps.loadCommands().then(e=>{this.commands=e,this.deps.onCommandsLoaded?.()}).catch(e=>{console.error("[web] failed to load slash-command autocomplete:",e)}).finally(()=>{this.loading=null}),await this.loading)}render(){let e=this.deps.menu;if(e.textContent="",!this.isOpen()){e.hidden=!0,this.syncAria();return}this.candidates.forEach((n,s)=>{e.appendChild(this.row(n,s,s===this.selected))}),e.hidden=!1,this.syncAria()}row(e,n,s){return Mt(e,this.optionId(n),s,i=>{this.selected=this.candidates.indexOf(i),this.accept()})}};var Bn=/^\/[A-Za-z][\w:-]*$/;function Dn(t,e){return t===""?[]:t.split(/(\s+)/).filter(n=>n!=="").map(n=>Bn.test(n)?{text:n,kind:e(n)?"known":"slash"}:{text:n,kind:"plain"})}function qn(t,e){t.textContent="";for(let n of e){if(n.kind==="plain"){t.appendChild(document.createTextNode(n.text));continue}let s=document.createElement("span");s.className=n.kind==="known"?"tok-known":"tok-slash",s.textContent=n.text,t.appendChild(s)}t.appendChild(document.createTextNode("\u200B"))}function qe(t,e,n){qn(e,Dn(t.value,n)),e.scrollTop=t.scrollTop,e.scrollLeft=t.scrollLeft}function Rt(t,e,n){let s=()=>{qe(t,e,n)},i=()=>{e.scrollTop=t.scrollTop,e.scrollLeft=t.scrollLeft},r=()=>{t.removeEventListener("input",s),t.removeEventListener("scroll",i),e.textContent=""};return t.addEventListener("input",s),t.addEventListener("scroll",i),s(),r}var zn="slash-menu",On="prompt-mirror";function $t(t){let e=document.getElementById(zn),n=document.getElementById(On);if(!e||!n)return;let s;return s=new ke({input:t.input,menu:e,loadCommands:t.loadCommands,onCommandsLoaded:()=>qe(t.input,n,i=>s.knows(i))}),s.wire(),Rt(t.input,n,i=>s.knows(i)),t.input.classList.add("slash-highlight-active"),s.preload(),s}function ae(t){return document.getElementById(t)}function E(t){let e=document.getElementById(t);if(!e)throw new ReferenceError(`missing required element #${t}`);return e}var jn=[{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"},{id:"opus",label:"Opus"}],Fn="sonnet",It={opus:"model-badge--opus",sonnet:"model-badge--sonnet",haiku:"model-badge--haiku"};function Kn(t){let e=t.toLowerCase();for(let n of Object.keys(It))if(e.includes(n))return It[n]??"model-badge--default";return"model-badge--default"}function Ht(t,e=jn){let n=document.createElement("div");n.className="model-selector";let s=document.createElement("label");s.className="model-selector__label",s.textContent="Model";let i=document.createElement("select");i.className="model-selector__select",i.setAttribute("aria-label","Model");let r=t.current??Fn;for(let o of e){let l=document.createElement("option");l.value=o.id,l.textContent=o.label,o.id===r&&(l.selected=!0),i.appendChild(l)}return t.onSelect(i.value),i.addEventListener("change",()=>{t.onSelect(i.value)}),s.appendChild(i),n.appendChild(s),n}function Nt(t){let e=document.createElement("span");return e.className=`model-badge ${Kn(t)}`,e.textContent=Un(t),e}function Un(t){let e=t.toLowerCase();for(let n of["opus","sonnet","haiku"])if(e.includes(n))return n;return t.length>12?`${t.slice(0,12)}\u2026`:t}function T(t,e=5e3){let n=ae("toast");n&&(n.textContent=t,n.hidden=!1,n.classList.add("is-visible"),setTimeout(()=>{n.classList.remove("is-visible"),setTimeout(()=>{n.hidden=!0},300)},e))}function Pt(){let t=ae("sidebar-backdrop"),e=ae("sidebar");t?.addEventListener("click",()=>{e?.classList.remove("is-open")}),document.addEventListener("keydown",n=>{n.key==="Escape"&&!n.defaultPrevented&&e?.classList.remove("is-open")})}function _t(t){let e=document.getElementById("new-session-form");if(e){e.remove();return}let n=ae("sidebar");if(!n)return;let s=document.createElement("div");s.id="new-session-form",s.className="new-session-form";let i="sonnet",r=Ht({onSelect:c=>{i=c}}),o=document.createElement("input");o.type="text",o.className="nsf-input",o.placeholder="working directory (optional)",o.setAttribute("aria-label","Working directory");let l=document.createElement("button");l.type="button",l.className="nsf-btn",l.textContent="Create";let a=()=>{s.remove(),t(i,o.value.trim())};l.addEventListener("click",a),o.addEventListener("keydown",c=>{c.key==="Enter"&&a(),c.key==="Escape"&&s.remove()}),s.append(r,o,l),n.insertAdjacentElement("afterbegin",s),o.focus()}var Gn=/\x1B\][^\x07\x1B\x9C]*(?:\x07|\x1B\\|\x9C)|\x1B[P^_X][^\x1B\x9C]*(?:\x1B\\|\x9C)|\x1B\[[0-?]*[ -/]*[@-~]|\x9B[0-?]*[ -/]*[@-~]|\x1B[6-_]/g;function Bt(t){return t.replace(Gn,"")}function ve(t){return Bt(t)}function Fe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Q=Fe();function Kt(t){Q=t}var Z={exec:()=>null};function v(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(N.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,e)};return s}var Wn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),N={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Vn=/^(?:[ \t]*(?:\n|$))+/,Zn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pe=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ke=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ut=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Gt=v(Ut).replace(/bull/g,Ke).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Xn=v(Ut).replace(/bull/g,Ke).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ue=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yn=/^[^\n]+/,Ge=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,es=v(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ge).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ts=v(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ke).getRegex(),Se="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",We=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ns=v("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",We).replace("tag",Se).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Wt=v(Ue).replace("hr",pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Se).getRegex(),ss=v(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Wt).getRegex(),Ve={blockquote:ss,code:Zn,def:es,fences:Jn,heading:Qn,hr:pe,html:ns,lheading:Gt,list:ts,newline:Vn,paragraph:Wt,table:Z,text:Yn},Dt=v("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Se).getRegex(),is={...Ve,lheading:Xn,table:Dt,paragraph:v(Ue).replace("hr",pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Dt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Se).getRegex()},rs={...Ve,html:v(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",We).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(Ue).replace("hr",pe).replace("heading",` *#{1,6} *[^
|
|
6
|
-
]`).replace("lheading",Gt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},os=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,as=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Vt=/^( {2,}|\\)\n(?!\s*$)/,ls=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Y=/[\p{P}\p{S}]/u,Ee=/[\s\p{P}\p{S}]/u,Ze=/[^\s\p{P}\p{S}]/u,ds=v(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ee).getRegex(),Zt=/(?!~)[\p{P}\p{S}]/u,cs=/(?!~)[\s\p{P}\p{S}]/u,ps=/(?:[^\s\p{P}\p{S}]|~)/u,us=v(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Wn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Jt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,hs=v(Jt,"u").replace(/punct/g,Y).getRegex(),ms=v(Jt,"u").replace(/punct/g,Zt).getRegex(),Qt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fs=v(Qt,"gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Ee).replace(/punct/g,Y).getRegex(),gs=v(Qt,"gu").replace(/notPunctSpace/g,ps).replace(/punctSpace/g,cs).replace(/punct/g,Zt).getRegex(),bs=v("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Ee).replace(/punct/g,Y).getRegex(),ks=v(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Y).getRegex(),vs="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ys=v(vs,"gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Ee).replace(/punct/g,Y).getRegex(),xs=v(/\\(punct)/,"gu").replace(/punct/g,Y).getRegex(),ws=v(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cs=v(We).replace("(?:-->|$)","-->").getRegex(),Ss=v("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xe=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Es=v(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",xe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xt=v(/^!?\[(label)\]\[(ref)\]/).replace("label",xe).replace("ref",Ge).getRegex(),Yt=v(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ge).getRegex(),Ts=v("reflink|nolink(?!\\()","g").replace("reflink",Xt).replace("nolink",Yt).getRegex(),qt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Je={_backpedal:Z,anyPunctuation:xs,autolink:ws,blockSkip:us,br:Vt,code:as,del:Z,delLDelim:Z,delRDelim:Z,emStrongLDelim:hs,emStrongRDelimAst:fs,emStrongRDelimUnd:bs,escape:os,link:Es,nolink:Yt,punctuation:ds,reflink:Xt,reflinkSearch:Ts,tag:Ss,text:ls,url:Z},Ls={...Je,link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",xe).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xe).getRegex()},ze={...Je,emStrongRDelimAst:gs,emStrongLDelim:ms,delLDelim:ks,delRDelim:ys,url:v(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",qt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:v(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",qt).getRegex()},Ms={...ze,br:v(Vt).replace("{2,}","*").getRegex(),text:v(ze.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ye={normal:Ve,gfm:is,pedantic:rs},le={normal:Je,gfm:ze,breaks:Ms,pedantic:Ls},As={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=t=>As[t];function O(t,e){if(e){if(N.escapeTest.test(t))return t.replace(N.escapeReplace,zt)}else if(N.escapeTestNoEncode.test(t))return t.replace(N.escapeReplaceNoEncode,zt);return t}function Ot(t){try{t=encodeURI(t).replace(N.percentDecode,"%")}catch{return null}return t}function jt(t,e){let n=t.replace(N.findPipe,(r,o,l)=>{let a=!1,c=o;for(;--c>=0&&l[c]==="\\";)a=!a;return a?"|":" |"}),s=n.split(N.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(N.slashPipe,"|");return s}function de(t,e,n){let s=t.length;if(s===0)return"";let i=0;for(;i<s;){let r=t.charAt(s-i-1);if(r===e&&!n)i++;else if(r!==e&&n)i++;else break}return t.slice(0,s-i)}function Rs(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])n++;else if(t[s]===e[1]&&(n--,n<0))return s;return n>0?-2:-1}function $s(t,e=0){let n=e,s="";for(let i of t)if(i===" "){let r=4-n%4;s+=" ".repeat(r),n+=r}else s+=i,n++;return s}function Ft(t,e,n,s,i){let r=e.href,o=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:r,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,a}function Is(t,e,n){let s=t.match(n.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
7
|
-
`).map(r=>{let o=r.match(n.other.beginningSpace);if(o===null)return r;let[l]=o;return l.length>=i.length?r.slice(i.length):r}).join(`
|
|
8
|
-
`)}var we=class{options;rules;lexer;constructor(t){this.options=t||Q}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:de(n,`
|
|
9
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],s=Is(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let s=de(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:de(e[0],`
|
|
10
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=de(e[0],`
|
|
11
|
-
`).split(`
|
|
12
|
-
`),s="",i="",r=[];for(;n.length>0;){let o=!1,l=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))l.push(n[a]),o=!0;else if(!o)l.push(n[a]);else break;n=n.slice(a);let c=l.join(`
|
|
13
|
-
`),d=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
14
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
15
|
-
${c}`:c,i=i?`${i}
|
|
16
|
-
${d}`:d;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,r,!0),this.lexer.state.top=u,n.length===0)break;let p=r.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let m=p,h=m.raw+`
|
|
17
|
-
`+n.join(`
|
|
18
|
-
`),g=this.blockquote(h);r[r.length-1]=g,s=s.substring(0,s.length-m.raw.length)+g.raw,i=i.substring(0,i.length-m.text.length)+g.text;break}else if(p?.type==="list"){let m=p,h=m.raw+`
|
|
19
|
-
`+n.join(`
|
|
20
|
-
`),g=this.list(h);r[r.length-1]=g,s=s.substring(0,s.length-p.raw.length)+g.raw,i=i.substring(0,i.length-m.raw.length)+g.raw,n=h.substring(r.at(-1).raw.length).split(`
|
|
21
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let r=this.rules.other.listItemRegex(n),o=!1;for(;t;){let a=!1,c="",d="";if(!(e=r.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let u=$s(e[2].split(`
|
|
22
|
-
`,1)[0],e[1].length),p=t.split(`
|
|
23
|
-
`,1)[0],m=!u.trim(),h=0;if(this.options.pedantic?(h=2,d=u.trimStart()):m?h=e[1].length+1:(h=u.search(this.rules.other.nonSpaceChar),h=h>4?1:h,d=u.slice(h),h+=e[1].length),m&&this.rules.other.blankLine.test(p)&&(c+=p+`
|
|
24
|
-
`,t=t.substring(p.length+1),a=!0),!a){let g=this.rules.other.nextBulletRegex(h),R=this.rules.other.hrRegex(h),C=this.rules.other.fencesBeginRegex(h),ne=this.rules.other.headingBeginRegex(h),se=this.rules.other.htmlBeginRegex(h),ie=this.rules.other.blockquoteBeginRegex(h);for(;t;){let W=t.split(`
|
|
25
|
-
`,1)[0],K;if(p=W,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),K=p):K=p.replace(this.rules.other.tabCharGlobal," "),C.test(p)||ne.test(p)||se.test(p)||ie.test(p)||g.test(p)||R.test(p))break;if(K.search(this.rules.other.nonSpaceChar)>=h||!p.trim())d+=`
|
|
26
|
-
`+K.slice(h);else{if(m||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(u)||ne.test(u)||R.test(u))break;d+=`
|
|
27
|
-
`+p}m=!p.trim(),c+=W+`
|
|
28
|
-
`,t=t.substring(W.length+1),u=K.slice(h)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=c}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let a of i.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let d={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=d.checked,i.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=d.raw+a.tokens[0].raw,a.tokens[0].text=d.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(d)):a.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):a.tokens.unshift(d)}}if(!i.loose){let c=a.tokens.filter(u=>u.type==="space"),d=c.length>0&&c.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=d}}if(i.loose)for(let a of i.items){a.loose=!0;for(let c of a.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:s,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=jt(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
29
|
-
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<n.length;o++)r.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:r.align[o]});for(let o of i)r.rows.push(jt(o,r.header.length).map((l,a)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[a]})));return r}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
30
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let r=de(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{let r=Rs(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Ft(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return Ft(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,r,o,l=i,a=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+i);(s=c.exec(e))!=null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let d=[...s[0]][0].length,u=t.slice(0,i+s.index+d+o);if(Math.min(i,o)%2){let m=u.slice(1,-1);return{type:"em",raw:u,text:m,tokens:this.lexer.inlineTokens(m)}}let p=u.slice(2,-2);return{type:"strong",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let s=this.rules.inline.delLDelim.exec(t);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,r,o,l=i,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+i);(s=a.exec(e))!=null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(o=[...r].length,o!==i))continue;if(s[3]||s[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...s[0]][0].length,d=t.slice(0,i+s.index+c+o),u=d.slice(i,-i);return{type:"del",raw:d,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,s;return e[2]==="@"?(n=e[1],s="mailto:"+n):(n=e[1],s=n),{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},_=class Oe{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Q,this.options.tokenizer=this.options.tokenizer||new we,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:N,block:ye.normal,inline:le.normal};this.options.pedantic?(n.block=ye.pedantic,n.inline=le.pedantic):this.options.gfm&&(n.block=ye.gfm,this.options.breaks?n.inline=le.breaks:n.inline=le.gfm),this.tokenizer.rules=n}static get rules(){return{block:ye,inline:le}}static lex(e,n){return new Oe(n).lex(e)}static lexInline(e,n){return new Oe(n).inlineTokens(e)}lex(e){e=e.replace(N.carriageReturn,`
|
|
31
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(N.tabCharGlobal," ").replace(N.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
32
|
-
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
33
|
-
`)?"":`
|
|
34
|
-
`)+i.raw,o.text+=`
|
|
35
|
-
`+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
36
|
-
`)?"":`
|
|
37
|
-
`)+i.raw,o.text+=`
|
|
38
|
-
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let r=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),a;this.options.extensions.startBlock.forEach(c=>{a=c.call({lexer:this},l),typeof a=="number"&&a>=0&&(o=Math.min(o,a))}),o<1/0&&o>=0&&(r=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(r))){let o=n.at(-1);s&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
39
|
-
`)?"":`
|
|
40
|
-
`)+i.raw,o.text+=`
|
|
41
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),s=r.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
42
|
-
`)?"":`
|
|
43
|
-
`)+i.raw,o.text+=`
|
|
44
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let s=e,i=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)r=i[2]?i[2].length:0,s=s.slice(0,i.index+r)+"["+"a".repeat(i[0].length-r-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,l="";for(;e;){o||(l=""),o=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=n.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(e,s,l)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(e,s,l)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),n.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),p;this.options.extensions.startInline.forEach(m=>{p=m.call({lexer:this},u),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(l=a.raw.slice(-1)),o=!0;let d=n.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):n.push(a);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},Ce=class{options;parser;constructor(t){this.options=t||Q}space(t){return""}code({text:t,lang:e,escaped:n}){let s=(e||"").match(N.notSpaceStart)?.[0],i=t.replace(N.endingNewline,"")+`
|
|
45
|
-
`;return s?'<pre><code class="language-'+O(s)+'">'+(n?i:O(i,!0))+`</code></pre>
|
|
46
|
-
`:"<pre><code>"+(n?i:O(i,!0))+`</code></pre>
|
|
47
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
48
|
-
${this.parser.parse(t)}</blockquote>
|
|
49
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
50
|
-
`}hr(t){return`<hr>
|
|
51
|
-
`}list(t){let e=t.ordered,n=t.start,s="";for(let o=0;o<t.items.length;o++){let l=t.items[o];s+=this.listitem(l)}let i=e?"ol":"ul",r=e&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
|
52
|
-
`+s+"</"+i+`>
|
|
53
|
-
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
54
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
55
|
-
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let s="";for(let i=0;i<t.rows.length;i++){let r=t.rows[i];n="";for(let o=0;o<r.length;o++)n+=this.tablecell(r[o]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
56
|
-
<thead>
|
|
57
|
-
`+e+`</thead>
|
|
58
|
-
`+s+`</table>
|
|
59
|
-
`}tablerow({text:t}){return`<tr>
|
|
60
|
-
${t}</tr>
|
|
61
|
-
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
62
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${O(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let s=this.parser.parseInline(n),i=Ot(t);if(i===null)return s;t=i;let r='<a href="'+t+'"';return e&&(r+=' title="'+O(e)+'"'),r+=">"+s+"</a>",r}image({href:t,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Ot(t);if(i===null)return O(n);t=i;let r=`<img src="${t}" alt="${O(n)}"`;return e&&(r+=` title="${O(e)}"`),r+=">",r}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:O(t.text)}},Qe=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},D=class je{options;renderer;textRenderer;constructor(e){this.options=e||Q,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qe}static parse(e,n){return new je(n).parse(e)}static parseInline(e,n){return new je(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let r=i;switch(r.type){case"space":{n+=this.renderer.space(r);break}case"hr":{n+=this.renderer.hr(r);break}case"heading":{n+=this.renderer.heading(r);break}case"code":{n+=this.renderer.code(r);break}case"table":{n+=this.renderer.table(r);break}case"blockquote":{n+=this.renderer.blockquote(r);break}case"list":{n+=this.renderer.list(r);break}case"checkbox":{n+=this.renderer.checkbox(r);break}case"html":{n+=this.renderer.html(r);break}case"def":{n+=this.renderer.def(r);break}case"paragraph":{n+=this.renderer.paragraph(r);break}case"text":{n+=this.renderer.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){s+=l||"";continue}}let o=r;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},ce=class{options;block;constructor(t){this.options=t||Q}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?_.lex:_.lexInline}provideParser(){return this.block?D.parse:D.parseInline}},Hs=class{defaults=Fe();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=D;Renderer=Ce;TextRenderer=Qe;Lexer=_;Tokenizer=we;Hooks=ce;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)n=n.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let o of r)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);n=n.concat(this.walkTokens(o,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=r.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),n.renderer){let i=this.defaults.renderer||new Ce(this.defaults);for(let r in n.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,l=n.renderer[o],a=i[o];i[o]=(...c)=>{let d=l.apply(i,c);return d===!1&&(d=a.apply(i,c)),d||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new we(this.defaults);for(let r in n.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,l=n.tokenizer[o],a=i[o];i[o]=(...c)=>{let d=l.apply(i,c);return d===!1&&(d=a.apply(i,c)),d}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new ce;for(let r in n.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,l=n.hooks[o],a=i[o];ce.passThroughHooks.has(r)?i[o]=c=>{if(this.defaults.async&&ce.passThroughHooksRespectAsync.has(r))return(async()=>{let u=await l.call(i,c);return a.call(i,u)})();let d=l.call(i,c);return a.call(i,d)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(i,c);return u===!1&&(u=await a.apply(i,c)),u})();let d=l.apply(i,c);return d===!1&&(d=a.apply(i,c)),d}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(r.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return _.lex(t,e??this.defaults)}parser(t,e){return D.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let s={...n},i={...this.defaults,...s},r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer():t?_.lex:_.lexInline)(o,i),a=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():t?D.parse:D.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():t?_.lex:_.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():t?D.parse:D.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return r(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
63
|
-
Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+O(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},J=new Hs;function x(t,e){return J.parse(t,e)}x.options=x.setOptions=function(t){return J.setOptions(t),x.defaults=J.defaults,Kt(x.defaults),x};x.getDefaults=Fe;x.defaults=Q;x.use=function(...t){return J.use(...t),x.defaults=J.defaults,Kt(x.defaults),x};x.walkTokens=function(t,e){return J.walkTokens(t,e)};x.parseInline=J.parseInline;x.Parser=D;x.parser=D.parse;x.Renderer=Ce;x.TextRenderer=Qe;x.Lexer=_;x.lexer=_.lex;x.Tokenizer=we;x.Hooks=ce;x.parse=x;var fr=x.options,gr=x.setOptions,br=x.use,kr=x.walkTokens,vr=x.parseInline;var yr=D.parse,xr=_.lex;var Ns=["http:","https:","mailto:"];function Ps(t){try{let e=new URL(t);return Ns.includes(e.protocol)?e.href:void 0}catch{return}}function y(t,e){let n=document.createElement(t);return e&&(n.className=e),n}function q(t,e){if(e)for(let n of e)switch(n.type){case"strong":{let s=y("strong");q(s,n.tokens),t.appendChild(s);break}case"em":{let s=y("em");q(s,n.tokens),t.appendChild(s);break}case"del":{let s=y("s");q(s,n.tokens),t.appendChild(s);break}case"codespan":{let s=y("code","md-code-inline");s.textContent=n.text,t.appendChild(s);break}case"link":{let s=n,i=Ps(s.href);if(i===void 0){let o=y("span");q(o,s.tokens),t.appendChild(o);break}let r=y("a","md-link");r.href=i,r.target="_blank",r.rel="noopener noreferrer",q(r,s.tokens),t.appendChild(r);break}case"image":{let s=y("span","md-image");s.textContent=`[image: ${n.text||"untitled"}]`,t.appendChild(s);break}case"br":t.appendChild(y("br"));break;default:{let s=n.text??"",i=n.tokens;i&&i.length>0&&n.type==="text"?q(t,i):s&&t.appendChild(document.createTextNode(s));break}}}function _s(t){let e=t.ordered?y("ol","md-list"):y("ul","md-list");t.ordered&&typeof t.start=="number"&&t.start>1&&(e.start=t.start);for(let n of t.items){let s=y("li");if(n.task){let i=y("input","md-task");i.type="checkbox",i.checked=!!n.checked,i.disabled=!0,s.appendChild(i)}Xe(s,n.tokens),e.appendChild(s)}return e}function Bs(t){let e=y("pre","md-pre"),n=y("code");if(t.lang){let s=t.lang.split(/\s+/)[0]??"";s&&(n.className=`md-lang-${s}`,e.dataset.lang=s)}return n.textContent=t.text,e.appendChild(n),e}function Ds(t){let e=y("table","md-table"),n=y("thead"),s=y("tr");for(let r of t.header){let o=y("th");q(o,r.tokens),s.appendChild(o)}n.appendChild(s),e.appendChild(n);let i=y("tbody");for(let r of t.rows){let o=y("tr");for(let l of r){let a=y("td");q(a,l.tokens),o.appendChild(a)}i.appendChild(o)}return e.appendChild(i),e}function Xe(t,e){for(let n of e)switch(n.type){case"heading":{let s=Math.min(Math.max(n.depth,1),6),i=y(`h${s}`,"md-heading");q(i,n.tokens),t.appendChild(i);break}case"paragraph":{let s=y("p","md-p");q(s,n.tokens),t.appendChild(s);break}case"code":t.appendChild(Bs(n));break;case"list":t.appendChild(_s(n));break;case"blockquote":{let s=y("blockquote","md-quote");Xe(s,n.tokens),t.appendChild(s);break}case"table":t.appendChild(Ds(n));break;case"hr":t.appendChild(y("hr","md-hr"));break;case"space":break;case"html":{let s=y("p","md-p");s.textContent=n.text,t.appendChild(s);break}default:{let s=n.tokens;if(s&&s.length>0){let r=y("p","md-p");q(r,s),t.appendChild(r);break}let i=n.text??"";if(i.trim()){let r=y("p","md-p");r.textContent=i,t.appendChild(r)}break}}}function en(t,e="md"){let n=y("div",e);try{Xe(n,new _().lex(t))}catch{n.textContent=t}return n}var ue=new Map;function tn(){ue.clear()}function qs(t,e){return t.kind!=="tool"?!1:e.className!==`tool tool-${t.status}`}function nn(t,e,n){e.length<t.childElementCount&&(ue.clear(),t.textContent="");for(let s of e){let i=ue.get(s.id);if(i===void 0){let r=n(s);ue.set(s.id,r),t.appendChild(r)}else if(qs(s,i)){let r=n(s);ue.set(s.id,r),t.replaceChild(r,i)}}}function X(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function zs(t){return Math.max(1,Math.round(t.length/800))}function Os(t){return`\u25C6 thought for ${zs(t.text)}s`}function js(t,e){e.textContent="";let n=X("div","thinking-block");n.setAttribute("data-thinking-id",t.id);let s=X("div","thinking-summary"),i=X("span","thinking-label",Os(t)),r=X("span","thinking-chevron","\u203A");s.appendChild(r),s.appendChild(i);let o=X("div","thinking-body"),l=X("pre","thinking-pre",t.text);o.appendChild(l),s.addEventListener("click",()=>{n.classList.toggle("thinking-block--open")}),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n.classList.toggle("thinking-block--open"))}),n.appendChild(s),n.appendChild(o),e.appendChild(n)}function sn(t){let e=X("div","thinking-host");return js(t,e),e}function rn(t,e){return e?.has(t.id)?"needs-input":t.mode==="live"||t.alive===!0?"active":"completed"}var Fs={"needs-input":{label:"Needs input",dotClass:"status-dot status-dot-needs-input",badgeClass:"badge badge-needs-input"},active:{label:"Active",dotClass:"status-dot status-dot-active",badgeClass:"badge badge-active"},completed:{label:"Completed",dotClass:"status-dot status-dot-completed",badgeClass:"badge badge-completed"}};function Ye(t){let{label:e,dotClass:n,badgeClass:s}=Fs[t],i=document.createElement("span");i.className=s;let r=document.createElement("span");r.className=n,r.setAttribute("aria-hidden","true");let o=document.createElement("span");return o.className="status-badge-label",o.textContent=e,i.appendChild(r),i.appendChild(o),i}function B(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function Ks(t){let e=/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/.exec(t);return!e||e[1]===void 0||e[2]===void 0?null:{oldStart:parseInt(e[1],10),newStart:parseInt(e[2],10)}}function Us(t){let e=t.split(`
|
|
64
|
-
`),n=[],s=null,i=0,r=0;for(let o of e){if(o.startsWith("@@")){let l=Ks(o);l&&(s={header:o,oldStart:l.oldStart,newStart:l.newStart,lines:[]},n.push(s),i=l.oldStart,r=l.newStart);continue}s&&(o.startsWith("+")&&!o.startsWith("+++")?s.lines.push({type:"add",content:o.slice(1),newNum:r++}):o.startsWith("-")&&!o.startsWith("---")?s.lines.push({type:"del",content:o.slice(1),oldNum:i++}):(o.startsWith(" ")||o==="")&&s.lines.push({type:"ctx",content:o.startsWith(" ")?o.slice(1):"",oldNum:i++,newNum:r++}))}return n}function Gs(t){return/^\+{3}\s+(?:b\/)?(.+)/m.exec(t)?.[1]?.trim()}function on(t){let e=B("span","dv-gutter");return e.textContent=t!==void 0?String(t):"",e}function Ws(t){let e=B("span",`dv-line dv-line-${t.type}`);e.appendChild(on(t.oldNum)),e.appendChild(on(t.newNum));let n=B("span","dv-sigil");n.textContent=t.type==="add"?"+":t.type==="del"?"-":" ",e.appendChild(n);let s=B("span","dv-content");return s.textContent=t.content,e.appendChild(s),e}function Vs(t){let e=0,n=0;for(let s of t)s.type==="add"?e++:s.type==="del"&&n++;return`+${e} / -${n}`}function Zs(t,e){let n=document.createElement("details");n.className="dv-hunk",e||n.setAttribute("open","");let s=document.createElement("summary");s.className="dv-hunk-header";let i=B("span","dv-chevron");i.textContent="\u25B6",s.appendChild(i);let r=B("span","dv-hunk-range",t.header.replace(/^@@\s*/,"").replace(/\s*@@.*$/," @@"));s.appendChild(r);let o=B("span","dv-hunk-stats",Vs(t.lines));s.appendChild(o),n.appendChild(s);let l=B("div","dv-hunk-body");for(let a of t.lines)l.appendChild(Ws(a));return n.appendChild(l),n}function an(t,e){let n=Us(t),s=n.reduce((l,a)=>l+a.lines.length,0),i=e?.collapsed??s>50,r=B("div","dv-root"),o=e?.fileName??Gs(t);if(o){let l=B("div","dv-file-header"),a=B("span","dv-file-icon");a.textContent="\u{1F4C4}",l.appendChild(a),l.appendChild(B("span","dv-file-name",o)),r.appendChild(l)}if(n.length===0)return r.appendChild(B("div","dv-empty","(no changes)")),r;for(let l of n)r.appendChild(Zs(l,i));return r}var ln=/bash|delete|remove|overwrite|rm |drop/i;function $(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function Js(t){if(!t)return"";let e=Math.floor((Date.now()-new Date(t).getTime())/6e4);return e>=1?`waiting ${e}m`:""}function Te(t,e,n){t.textContent="",t.classList.toggle("has-pending",e.length>0);for(let s of e){let i=s.request??{},r=i.title??i.message??"The agent is waiting for a response.",o=ln.test(r)||ln.test(i.serverName??""),l=$("div",o?"approval-card approval-card--destructive":"approval-card"),a=$("div","approval-head");a.appendChild($("span","approval-badge",i.origin==="agent"?"question":"approval")),i.serverName&&a.appendChild($("span","approval-source",i.serverName));let c=Js(s.createdAt);c&&a.appendChild($("span","approval-time",c)),l.appendChild(a),l.appendChild($("div","approval-title",r)),i.description&&l.appendChild($("div","approval-desc",i.description));let d=$("div","approval-actions");if(i.type==="choice"&&Array.isArray(i.choices)&&i.choices.length>0)for(let p of i.choices){let m=$("button","approval-btn",p);m.addEventListener("click",()=>n(s.id,{action:"accept",content:{value:p}})),d.appendChild(m)}else if(i.type==="multi_choice"&&Array.isArray(i.choices)&&i.choices.length>0){let p=$("div","approval-checkboxes"),m=[];for(let g of i.choices){let R=$("label","approval-checkbox-row"),C=document.createElement("input");C.type="checkbox",C.value=g,m.push(C),R.appendChild(C),R.appendChild($("span",void 0,g)),p.appendChild(R)}l.appendChild(p);let h=$("button","approval-btn approval-primary","Submit");h.addEventListener("click",()=>n(s.id,{action:"accept",content:{value:m.filter(g=>g.checked).map(g=>g.value)}})),d.appendChild(h)}else if(i.type==="text"||i.type==="number"){let p=document.createElement("input");p.className="approval-input",p.type=i.type==="number"?"number":"text",i.questionDefault!==void 0&&(p.value=String(i.questionDefault));let m=()=>n(s.id,{action:"accept",content:{value:i.type==="number"?Number(p.value):p.value}});p.addEventListener("keydown",g=>{g.key==="Enter"&&m()}),l.appendChild(p);let h=$("button","approval-btn approval-primary","Submit");h.addEventListener("click",m),d.appendChild(h)}else{let p=$("button","approval-btn approval-primary","Approve");p.addEventListener("click",()=>n(s.id,{action:"accept",content:{value:!0}})),d.appendChild(p)}let u=$("button","approval-btn approval-danger","Deny");u.addEventListener("click",()=>n(s.id,{action:"decline"})),d.appendChild(u),l.appendChild(d),t.appendChild(l)}}var dn=2e3,cn=2e3;function f(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function Qs(t){if(!t)return;let e=t.replace(/[/\\]+$/,"").split(/[/\\]/).pop()??"";return e&&e!=="."?e:void 0}function Xs(t){return(t.title??"").replace(/^\s*\[[^\]]{0,80}\]\s*/,"").trim()||t.title||t.id.slice(0,8)}function tt(t,e,n,s){t.textContent="";let i=[...e.filter(r=>r.alive===!0||r.mode==="live"),...e.filter(r=>!(r.alive===!0||r.mode==="live"))];for(let r of i){let o=f("button","session-row");r.id===n&&o.classList.add("is-active");let l=f("span","session-title",Xs(r));o.appendChild(l);let a=f("span","session-meta"),c=Qs(r.cwd);if(c){let u=f("span","session-cwd",c);u.title=r.cwd??c,a.appendChild(u)}let d=f("span",r.mode==="live"?"badge badge-live":"badge badge-readonly");d.textContent=r.mode==="live"?"live":"read-only",a.appendChild(d),r.alive===!0&&r.mode==="live"?a.appendChild(Ye("needs-input")):a.appendChild(Ye(rn(r))),r.alive&&a.appendChild(f("span","badge badge-alive","running")),r.model&&a.appendChild(Nt(r.model)),r.updatedAt&&a.appendChild(f("span","session-time",ri(r.updatedAt))),o.appendChild(a),o.addEventListener("click",()=>s(r.id)),t.appendChild(o)}e.length===0&&t.appendChild(f("div","empty","No sessions found."))}function nt(t,e){nn(t,e,Ys)}function Ys(t){switch(t.kind){case"user":{let e=f("div","msg msg-user");return e.appendChild(f("div","msg-role","you")),e.appendChild(f("div","msg-body",t.text)),e}case"assistant":{let e=f("div","msg msg-assistant");e.appendChild(f("div","msg-role","agent"));let n=f("div","msg-body md-body");return n.appendChild(en(t.text)),e.appendChild(n),e}case"thinking":return sn(t);case"error":{let e=f("div","msg msg-error");return e.appendChild(f("div","msg-role","error")),e.appendChild(f("div","msg-body",t.message)),e}case"notice":return f("div","notice",t.text);case"tool":return ei(t);case"subagent":return ni(t);case"bg_job":return si(t)}}function ei(t){let e=f("details",`tool tool-${t.status}`),n=f("summary","tool-summary");n.appendChild(f("span",`tool-dot tool-dot-${t.status}`,"")),n.appendChild(f("span","tool-name",t.name)),t.inputPreview&&n.appendChild(f("span","tool-target",ii(t.name,t.inputPreview))),e.appendChild(n);let s=f("div","tool-body");if(t.inputPreview){s.appendChild(f("div","tool-label","input"));let i=ve(t.inputPreview);if(i.length>cn){let r=f("pre","tool-pre",i.slice(0,cn));s.appendChild(r);let o=f("button","tool-more",`Show full input (${i.length.toLocaleString()} chars)`);o.addEventListener("click",()=>{r.textContent=i,o.remove()}),s.appendChild(o)}else s.appendChild(f("pre","tool-pre",i))}if(t.outputUnavailable===!0)s.appendChild(f("div","tool-unavailable","Result not available after refresh \u2014 successful tool output is not persisted to the session ledger."));else if(t.output!==void 0&&t.output!==""){s.appendChild(f("div","tool-label","output"));let i=ve(t.output);if(i.length>dn){let r=f("pre","tool-pre",i.slice(0,dn));s.appendChild(r);let o=f("button","tool-more",`Show full output (${i.length.toLocaleString()} chars)`);o.addEventListener("click",()=>{r.textContent=i,o.remove()}),s.appendChild(o)}else s.appendChild(f("pre","tool-pre",i))}return t.diff!==void 0&&(s.appendChild(f("div","tool-label","diff")),s.appendChild(an(ve(String(t.diff))))),e.appendChild(s),e}function ti(t){let e=t/1e3;return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`}var pn={started:"\u25B6",succeeded:"\u2713",failed:"\u2717",cancelled:"\u25FC",completed:"\u2713"};function ni(t){let e=t.status,n=f("div",`sa-card sa-card--${e}`),s=f("span","sa-icon",pn[e]??"\u25CF"),i=f("div","sa-header");return i.appendChild(s),i.appendChild(f("span","sa-label",t.label)),t.model&&i.appendChild(f("span","sa-model",t.model)),t.durationMs!==void 0&&i.appendChild(f("span","sa-dur",ti(t.durationMs))),n.appendChild(i),t.promptHead&&n.appendChild(f("div","sa-prompt",t.promptHead)),n}function si(t){let e=f("div",`sa-card sa-card--${t.status}`),n=f("span","sa-icon",pn[t.status]??"\u25CF"),s=f("div","sa-header");return s.appendChild(n),s.appendChild(f("span","sa-label",`bg: ${t.label}`)),e.appendChild(s),e}function et(t,e){let n=t.replace(/\s+/g," ").trim();return n.length<=e?n:`${n.slice(0,e-1)}\u2026`}function ii(t,e){try{let n=JSON.parse(e);if((t==="bash"||t==="shell")&&typeof n.command=="string")return et(n.command,80);if((t==="edit_file"||t==="write_file"||t==="read_file")&&typeof n.file_path=="string")return n.file_path;if(t==="agent"&&typeof n.prompt=="string")return et(n.prompt,60);if((t==="grep"||t==="glob")&&typeof n.pattern=="string")return n.pattern}catch{}return et(e,90)}function ri(t){let e=Date.parse(t);if(Number.isNaN(e))return"";let n=Math.max(0,(Date.now()-e)/1e3);return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function oi(t){let e=t.trim();return e?e.startsWith("/")||e.startsWith("./")||e.startsWith("~/")||/^[\w.]/.test(e):!1}function ai(t,e){let n=t.selectionStart??t.value.length,s=t.selectionEnd??n,i=t.value.slice(0,n),r=t.value.slice(s),o=i.length>0&&!/\s$/.test(i)?" ":"";t.value=i+o+e+" "+r;let l=n+o.length+e.length+1;t.setSelectionRange(l,l),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}function un(t){let{input:e,container:n}=t,s=document.createElement("button");s.type="button",s.className="atf-btn",s.title="Insert @file reference",s.setAttribute("aria-label","Insert file reference"),s.textContent="@";let i=document.createElement("div");i.className="atf-popover",i.setAttribute("role","dialog"),i.setAttribute("aria-label","Insert file path"),i.hidden=!0;let r=document.createElement("p");r.className="atf-hint",r.textContent="Type a file path. @~/file.ts or @src/file.ts";let o=document.createElement("div");o.className="atf-input-row";let l=document.createElement("input");l.type="text",l.className="atf-path-input",l.placeholder="src/foo.ts or ~/file.ts",l.setAttribute("autocomplete","off"),l.setAttribute("spellcheck","false");let a=document.createElement("button");a.type="button",a.className="atf-add-btn",a.textContent="Add";let c=document.createElement("p");c.className="atf-error",c.hidden=!0,c.textContent="Enter a valid file path.",o.appendChild(l),o.appendChild(a),i.appendChild(r),i.appendChild(o),i.appendChild(c);function d(){i.hidden=!1,c.hidden=!0,l.value="",s.classList.add("atf-btn--active"),s.setAttribute("aria-expanded","true"),l.focus()}function u(){i.hidden=!0,s.classList.remove("atf-btn--active"),s.setAttribute("aria-expanded","false")}function p(){let C=l.value.trim();if(!oi(C)){c.hidden=!1,l.focus();return}ai(e,`@${C}`),u()}let m=()=>{i.hidden?d():u()},h=()=>{p()},g=C=>{C.key==="Enter"&&(C.preventDefault(),p()),C.key==="Escape"&&u()},R=C=>{!i.hidden&&!n.contains(C.target)&&u()};return s.addEventListener("click",m),a.addEventListener("click",h),l.addEventListener("keydown",g),document.addEventListener("click",R,{capture:!0}),n.appendChild(i),n.appendChild(s),()=>{s.removeEventListener("click",m),a.removeEventListener("click",h),l.removeEventListener("keydown",g),document.removeEventListener("click",R,{capture:!0}),i.remove(),s.remove()}}var st=0;function it(){st=0}function M(t){return st+=1,`${t}_${st}`}function S(t){return typeof t=="string"?t:void 0}function G(t){return typeof t=="number"?t:void 0}function rt(t,e,n){if(typeof t.kind=="string")switch(t.kind){case"user":return{kind:"user",id:M("u"),text:S(t.text)??""};case"assistant":return{kind:"assistant",id:M("a"),text:S(t.text)??""};case"thinking":return{kind:"thinking",id:M("th"),text:S(t.text)??""};case"tool":{let s=S(t.input)??"";if(s.trim()==="\u2026")return;let i=S(t.toolUseId),r={kind:"tool",id:M("t"),name:S(t.toolName)??"tool",toolUseId:i,inputPreview:s,status:"ok",outputUnavailable:!0};return e!==void 0&&i!==void 0&&e.set(i,r),r}case"tool_result":{let s=S(t.toolUseId),i=S(t.content)??S(t.output)??"",r=G(t.durationMs),o=S(t.diff);if(e!==void 0&&s!==void 0){let l=e.get(s);if(l!==void 0){l.output=i,l.outputUnavailable=!1,l.status="ok",r!==void 0&&(l.durationMs=r),o!==void 0&&(l.diff=o);return}}return{kind:"notice",id:M("n"),text:`tool result: ${i.slice(0,80)}`}}case"tool_error":{let s=S(t.content)??"",i=s.split(`
|
|
65
|
-
`,1)[0]??"";return{kind:"tool",id:M("t"),name:S(t.toolName)??"error",inputPreview:i,status:"error",output:s}}case"error":return{kind:"error",id:M("e"),message:S(t.message)??"error"};case"done":{let s=t.costUsd,i=t.durationMs,r=[];typeof s=="number"&&r.push(`$${s.toFixed(4)}`),typeof i=="number"&&r.push(`${(i/1e3).toFixed(1)}s`);let o=G(t.inputTokens),l=G(t.outputTokens),a=G(t.cacheReadTokens);if(o!==void 0||l!==void 0){let c=[];o!==void 0&&c.push(`${o}in`),l!==void 0&&c.push(`${l}out`),a!==void 0&&c.push(`${a}cache`),r.push(c.join("/"))}return{kind:"notice",id:M("n"),text:r.length?`turn complete \xB7 ${r.join(" \xB7 ")}`:"turn complete"}}case"paused":return{kind:"notice",id:M("n"),text:"paused \u2014 usage limit"};case"resumed":return{kind:"notice",id:M("n"),text:"resumed"};case"tool_activity":{let s=G(t.activeCount)??0;if(s===0)return{kind:"notice",id:M("n"),text:"tool wave complete"};let i=s===1?"tool":"tools";return{kind:"notice",id:M("n"),text:`Running ${s} ${i} in parallel`}}case"rate_limit":{let s=G(t.retryAfterMs),i=s!==void 0?` (retrying in ${Math.ceil(s/1e3)}s)`:"";return{kind:"notice",id:M("n"),text:`Rate limited${i}`}}case"progress":return{kind:"notice",id:M("n"),text:S(t.message)??"progress"};case"subagent_lifecycle":{let s=S(t.subagentId)??"subagent",i=S(t.status)??"unknown",r=S(t.agentType),o=r?`${r} (${s.slice(0,8)})`:s.slice(0,12);if(n!==void 0){let a=n.get(s);if(a!==void 0){a.status=i;let c=G(t.durationMs);c!==void 0&&(a.durationMs=c);return}}let l={kind:"subagent",id:M("sa"),subagentId:s,status:i,label:o,model:S(t.model),durationMs:G(t.durationMs),promptHead:S(t.promptHead)};return n?.set(s,l),l}case"background_job":{let s=S(t.jobId)??"job",i=S(t.status)??"unknown",r=S(t.label)??s.slice(0,12);return{kind:"bg_job",id:M("bj"),jobId:s,status:i,label:r}}case"plan_mode":{let s=S(t.mode)??"default";return{kind:"notice",id:M("n"),text:`Switched to ${s} mode`}}default:return}}function ot(t,e){if(e.kind!=="done")return t;let n=e.costUsd,s=e.durationMs,i=e.inputTokens,r=e.outputTokens,o=e.cacheReadTokens;return{costUsd:t.costUsd+(typeof n=="number"?n:0),durationMs:t.durationMs+(typeof s=="number"?s:0),turns:t.turns+1,inputTokens:(t.inputTokens??0)+(typeof i=="number"?i:0),outputTokens:(t.outputTokens??0)+(typeof r=="number"?r:0),cacheReadTokens:(t.cacheReadTokens??0)+(typeof o=="number"?o:0)}}function Le(t,e){return Number.isInteger(e)&&e>=0&&e<t.length}function hn(t,e){if(!Le(t,e)||e===0)return t.slice();let n=t.slice(),s=n[e-1],i=n[e];return s===void 0||i===void 0?t.slice():(n[e-1]=i,n[e]=s,n)}function mn(t,e){if(!Le(t,e)||e===t.length-1)return t.slice();let n=t.slice(),s=n[e+1],i=n[e];return s===void 0||i===void 0?t.slice():(n[e+1]=i,n[e]=s,n)}function fn(t,e){if(!Le(t,e))return t.slice();let n=t.slice();return n.splice(e,1),n}function gn(t,e,n){if(!Le(t,e))return t.slice();let s=t.slice();return s[e]=n,s}var Me=class{constructor(e){this.deps=e}deps;queue=[];flushing=!1;entries(){return[...this.queue]}clear(){this.queue=[],this.render()}wire(){let e=()=>{let n=this.deps.input.value.trim();n&&(this.queue=[...this.queue,n],this.deps.input.value="",be(this.deps.input),this.render(),this.flush())};this.deps.send.addEventListener("click",e),this.deps.input.addEventListener("keydown",n=>{n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&e()})}render(){let e=this.deps.container;e.textContent="",this.queue.forEach((n,s)=>{let i=document.createElement("div");i.className="queue-row";let r=document.createElement("span");r.className="queue-text",r.textContent=n,i.appendChild(r);let o=document.createElement("button");o.className="queue-btn",o.textContent="\u270E",o.title="Edit",o.addEventListener("click",()=>{let l=document.createElement("input");l.className="queue-text queue-edit-input",l.value=n,i.replaceChild(l,r),l.focus();let a=!1,c=()=>{a||(a=!0,this.queue=gn(this.queue,s,l.value),this.render())};l.addEventListener("keydown",d=>{d.key==="Enter"&&c(),d.key==="Escape"&&(d.preventDefault(),a=!0,i.replaceChild(r,l))}),l.addEventListener("blur",c)}),i.appendChild(o);for(let[l,a]of[["\u2191",()=>{this.queue=hn(this.queue,s)}],["\u2193",()=>{this.queue=mn(this.queue,s)}],["\u2715",()=>{this.queue=fn(this.queue,s)}]]){let c=document.createElement("button");c.className="queue-btn",c.textContent=l,c.addEventListener("click",()=>{a(),this.render()}),i.appendChild(c)}e.appendChild(i)})}async flush(){if(this.flushing||!this.deps.isLive()||this.deps.isTurnActive())return;let e=this.queue[0];if(e!==void 0){this.flushing=!0;try{await this.deps.submit(e),this.queue=this.queue.slice(1),this.render(),this.deps.onAccepted()}catch(n){this.deps.onError(n instanceof Error?n.message:"send failed")}finally{this.flushing=!1}}}};function bn(t,e=80){return t.scrollHeight-t.scrollTop-t.clientHeight<=e}function kn(t,e){let n=[];function s(r,o){n=n.filter(l=>l.id!==r),Te(e,n,s),t("/api/approve",{method:"POST",body:JSON.stringify({requestId:r,response:o})}).catch(l=>{T(l instanceof Error?l.message:"approval failed")})}async function i(){let r=await t("/api/pending"),o=r.pending.length!==n.length||r.pending.some((l,a)=>l.id!==n[a]?.id);n=r.pending,o&&Te(e,n,s),document.title=n.length>0?`(${n.length}) afk web`:"afk web"}return{pollPending:i,answerApproval:s}}function b(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function li(t){let e=t.trim().split(/\s+/);if(e.length<5)return t;let[n,s,i,r,o]=e;return i==="*"&&r==="*"&&o==="*"&&s.startsWith("*/")?`Every ${s.slice(2)} hours`:i==="*"&&r==="*"&&o==="*"&&s!=="*"&&n!=="*"?`Daily at ${s.padStart(2,"0")}:${n.padStart(2,"0")}`:i==="*"&&r==="*"&&o!=="*"&&s!=="*"?`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][Number(o)]??o} at ${s.padStart(2,"0")}:${n.padStart(2,"0")}`:i==="*"&&r==="*"&&o==="*"&&s==="*"&&n!=="*"?`Every hour at :${n.padStart(2,"0")}`:i==="*"&&r==="*"&&o==="*"&&s==="*"&&n==="*"?"Every minute":t}function di(t){let e=Date.now()-new Date(t).getTime(),n=Math.floor(e/1e3);if(n<60)return"just now";let s=Math.floor(n/60);if(s<60)return`${s}m ago`;let i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}var Ae=class{container;api;onEdit;onShowHistory;schedules=[];daemonStatus={running:!1};constructor(e){this.container=e.container,this.api=e.api,this.onEdit=e.onEdit,this.onShowHistory=e.onShowHistory}async load(){try{let[e,n]=await Promise.all([this.api("/api/schedules"),this.api("/api/daemon/status")]);this.schedules=e.schedules,this.daemonStatus=n}catch(e){T(e instanceof Error?e.message:"failed to load schedules")}this.render()}render(){this.container.textContent="";let e=b("div","sched-header"),n=b("div","sched-title-row");n.appendChild(b("h2","sched-title","Schedules"));let s=b("button","sched-add-btn","+ New Schedule");s.addEventListener("click",()=>this.onEdit({id:"",name:"",command:"",cron:"",enabled:!0,createdAt:"",updatedAt:""})),n.appendChild(s),e.appendChild(n);let i=b("div","sched-daemon-status"),r=b("span",this.daemonStatus.running?"sched-dot-ok":"sched-dot-off");if(i.appendChild(r),i.appendChild(b("span","sched-daemon-text",this.daemonStatus.running?`Daemon running (${this.daemonStatus.tasks??0} tasks)`:"Daemon not running")),e.appendChild(i),this.container.appendChild(e),this.schedules.length===0){let l=b("div","sched-empty");l.appendChild(b("div","sched-empty-icon","\u23F0")),l.appendChild(b("div","sched-empty-title","No schedules yet")),l.appendChild(b("div","sched-empty-sub","Create a schedule to run tasks on a cron timer.")),this.container.appendChild(l);return}let o=b("div","sched-list");for(let l of this.schedules)o.appendChild(this.renderCard(l));this.container.appendChild(o)}renderCard(e){let n=b("div",`sched-card${e.enabled?"":" sched-card-disabled"}`),s=b("div","sched-card-top"),i=b("span","sched-card-name",e.name);s.appendChild(i);let r=b("button",`sched-toggle${e.enabled?" is-on":""}`),o=b("span","sched-toggle-dot");r.appendChild(o),r.title=e.enabled?"Disable":"Enable",r.addEventListener("click",()=>{this.toggleSchedule(e.id,r)}),s.appendChild(r),n.appendChild(s);let l=b("div","sched-card-details"),a=b("div","sched-detail-row");a.appendChild(b("span","sched-detail-label","Schedule"));let c=b("span","sched-detail-value");c.appendChild(b("span",void 0,li(e.cron))),c.appendChild(b("span","sched-cron-raw",e.cron)),a.appendChild(c),l.appendChild(a);let d=b("div","sched-detail-row");if(d.appendChild(b("span","sched-detail-label","Command")),d.appendChild(b("code","sched-detail-code",e.command)),l.appendChild(d),e.trigger&&e.trigger!=="cron"){let R=b("div","sched-detail-row");R.appendChild(b("span","sched-detail-label","Trigger")),R.appendChild(b("span","sched-detail-value",e.trigger)),l.appendChild(R)}let u=b("div","sched-card-meta");u.appendChild(b("span","sched-card-id",e.id)),e.updatedAt&&u.appendChild(b("span","sched-card-time",di(e.updatedAt))),l.appendChild(u),n.appendChild(l);let p=b("div","sched-card-actions"),m=b("button","sched-action-btn","History");m.addEventListener("click",()=>this.onShowHistory(e.id)),p.appendChild(m);let h=b("button","sched-action-btn","Edit");h.addEventListener("click",()=>this.onEdit(e)),p.appendChild(h);let g=b("button","sched-action-btn sched-action-danger","Delete");return g.addEventListener("click",()=>{this.deleteSchedule(e.id,e.name,g)}),p.appendChild(g),n.appendChild(p),n}inflight=!1;async toggleSchedule(e,n){if(!this.inflight){this.inflight=!0,n.disabled=!0;try{await this.api(`/api/schedules/${encodeURIComponent(e)}/toggle`,{method:"POST"}),await this.load()}catch(s){T(s instanceof Error?s.message:"toggle failed"),n.disabled=!1}finally{this.inflight=!1}}}async deleteSchedule(e,n,s){if(!this.inflight&&confirm(`Delete schedule "${n}"? This cannot be undone.`)){this.inflight=!0,s.disabled=!0;try{await this.api(`/api/schedules/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.load()}catch(i){T(i instanceof Error?i.message:"delete failed"),s.disabled=!1}finally{this.inflight=!1}}}};function A(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}var at=[{label:"Every hour",value:"0 * * * *"},{label:"Daily at 2:00 AM",value:"0 2 * * *"},{label:"Daily at 9:00 AM",value:"0 9 * * *"},{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Weekly (Monday 9 AM)",value:"0 9 * * 1"},{label:"Custom...",value:""}];function ci(t){let e=t.trim().split(/\s+/);if(e.length<5)return"";let[n,s,i,r,o]=e;return i==="*"&&r==="*"&&o==="*"&&s.startsWith("*/")?`Runs every ${s.slice(2)} hours`:i==="*"&&r==="*"&&o==="*"&&s!=="*"&&n!=="*"?`Runs daily at ${s.padStart(2,"0")}:${n.padStart(2,"0")}`:i==="*"&&r==="*"&&o!=="*"&&s!=="*"?`Runs every ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][Number(o)]??o} at ${s.padStart(2,"0")}:${n.padStart(2,"0")}`:i==="*"&&r==="*"&&o==="*"&&s==="*"?n==="*"?"Runs every minute":`Runs every hour at :${n.padStart(2,"0")}`:`Cron: ${t}`}function vn(t,e){let n=t!==null&&t.id!=="";document.getElementById("sched-form-overlay")?.remove();let s=A("div","sched-overlay");s.id="sched-form-overlay";let i=A("div","sched-modal");i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-labelledby","sched-form-title");let r=A("h3","sched-modal-title",n?"Edit Schedule":"New Schedule");r.id="sched-form-title",i.appendChild(r);let o=A("div","sched-field"),l=A("label","sched-label","Name");l.htmlFor="sf-name",o.appendChild(l);let a=document.createElement("input");a.id="sf-name",a.type="text",a.className="sched-input",a.placeholder="e.g. Nightly forge",a.value=t?.name??"",o.appendChild(a),i.appendChild(o);let c=A("div","sched-field"),d=A("label","sched-label","Command");d.htmlFor="sf-command",c.appendChild(d);let u=document.createElement("input");u.id="sf-command",u.type="text",u.className="sched-input sched-input-mono",u.placeholder="e.g. /forge-friction --auto",u.value=t?.command??"",c.appendChild(u),i.appendChild(c);let p=A("div","sched-field"),m=A("label","sched-label","Schedule");m.htmlFor="sf-cron-select",p.appendChild(m);let h=document.createElement("select");h.id="sf-cron-select",h.className="sched-select";for(let w of at){let I=document.createElement("option");I.value=w.value,I.textContent=w.label,h.appendChild(I)}let g=document.createElement("input");g.id="sf-cron",g.type="text",g.className="sched-input sched-input-mono",g.placeholder="0 2 * * *",g.value=t?.cron??"";let R=A("div","sched-cron-preview"),C=!1,ne=t?.cron??"",se=at.find(w=>w.value===ne);se&&se.value!==""?(h.value=se.value,g.hidden=!0,C=!1):ne?(h.value="",g.hidden=!1,C=!0):(h.value=at[0]?.value??"",g.hidden=!0,g.value=h.value,C=!1);let ie=()=>{let w=C?g.value:h.value;R.textContent=w?ci(w):""};h.addEventListener("change",()=>{h.value===""?(g.hidden=!1,C=!0,g.focus()):(g.hidden=!0,C=!1,g.value=h.value),ie()}),g.addEventListener("input",ie),ie(),p.appendChild(h),p.appendChild(g),p.appendChild(R),i.appendChild(p);let W=A("div","sched-field"),K=A("label","sched-label","Trigger");K.htmlFor="sf-trigger",W.appendChild(K);let re=document.createElement("select");re.id="sf-trigger",re.className="sched-select";for(let[w,I]of[["cron","Cron schedule only"],["sessionstart","On daemon start"],["both","Both (cron + daemon start)"]]){let H=document.createElement("option");H.value=w,H.textContent=I,w===(t?.trigger??"cron")&&(H.selected=!0),re.appendChild(H)}W.appendChild(re),i.appendChild(W);let Pe=A("div","sched-field"),ft=A("label","sched-label","Notifications");ft.htmlFor="sf-notify",Pe.appendChild(ft);let oe=document.createElement("select");oe.id="sf-notify",oe.className="sched-select";for(let[w,I]of[["failure","On failure only"],["always","On every run"],["never","Never"]]){let H=document.createElement("option");H.value=w,H.textContent=I,w===(t?.notifyOn??"failure")&&(H.selected=!0),oe.appendChild(H)}Pe.appendChild(oe),i.appendChild(Pe);let _e=A("div","sched-btn-row"),Be=A("button","sched-cancel-btn","Cancel");Be.type="button",Be.addEventListener("click",()=>s.remove());let V=A("button","sched-save-btn",n?"Save Changes":"Create Schedule");V.type="button",V.addEventListener("click",()=>{Ln()}),_e.appendChild(Be),_e.appendChild(V),i.appendChild(_e);let De=()=>{s.remove(),document.removeEventListener("keydown",gt)};s.appendChild(i),document.body.appendChild(s),a.focus();let Tn="input:not([disabled]), select:not([disabled]), button:not([disabled]), textarea:not([disabled])";i.addEventListener("keydown",w=>{if(w.key!=="Tab")return;let I=Array.from(i.querySelectorAll(Tn));if(I.length===0)return;let H=I[0],U=I[I.length-1];w.shiftKey?document.activeElement===H&&(w.preventDefault(),U.focus()):document.activeElement===U&&(w.preventDefault(),H.focus())}),s.addEventListener("click",w=>{w.target===s&&De()});let gt=w=>{w.key==="Escape"&&De()};document.addEventListener("keydown",gt);async function Ln(){let w=a.value.trim(),I=u.value.trim(),H=C?g.value.trim():h.value;if(!w||!I||!H){T("Name, command, and schedule are required");return}V.disabled=!0,V.textContent="Saving...";try{let U={name:w,command:I,cron:H,trigger:re.value,notifyOn:oe.value,enabled:t?.enabled??!0};n?await e.api(`/api/schedules/${encodeURIComponent(t.id)}`,{method:"PATCH",body:JSON.stringify(U)}):await e.api("/api/schedules",{method:"POST",body:JSON.stringify(U)}),De(),e.onSaved()}catch(U){T(U instanceof Error?U.message:"save failed"),V.disabled=!1,V.textContent=n?"Save Changes":"Create Schedule"}}}function L(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function pi(t){if(t<1e3)return`${t}ms`;let e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;let n=Math.floor(e/60),s=Math.floor(e%60);return`${n}m ${s}s`}function ui(t){try{return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function yn(t,e){document.getElementById("sched-history-overlay")?.remove();let n=L("div","sched-overlay");n.id="sched-history-overlay";let s=L("div","sched-modal sched-modal-wide");s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-labelledby","sched-history-title");let i=L("h3","sched-modal-title",`History: ${t}`);i.id="sched-history-title",s.appendChild(i);let r=L("div","sched-history-body");r.appendChild(L("div","sched-history-loading","Loading...")),s.appendChild(r);let o=()=>{n.remove(),document.removeEventListener("keydown",c)},l=L("button","sched-cancel-btn","Close");l.type="button",l.addEventListener("click",o),s.appendChild(l),n.appendChild(s),document.body.appendChild(n),l.focus();let a="input:not([disabled]), select:not([disabled]), button:not([disabled]), textarea:not([disabled])";s.addEventListener("keydown",d=>{if(d.key!=="Tab")return;let u=Array.from(s.querySelectorAll(a));if(u.length===0)return;let p=u[0],m=u[u.length-1];d.shiftKey?document.activeElement===p&&(d.preventDefault(),m.focus()):document.activeElement===m&&(d.preventDefault(),p.focus())}),n.addEventListener("click",d=>{d.target===n&&o()});let c=d=>{d.key==="Escape"&&o()};document.addEventListener("keydown",c),hi(t,e,r)}async function hi(t,e,n){try{let s=await e(`/api/schedules/${encodeURIComponent(t)}/history`);if(n.textContent="",s.history.length===0){n.appendChild(L("div","sched-empty","No executions recorded yet."));return}let i=[...s.history].reverse();for(let r of i)n.appendChild(mi(r))}catch(s){T(s instanceof Error?s.message:"failed to load history"),n.textContent="",n.appendChild(L("div","sched-empty","Failed to load history."))}}function mi(t){let e=L("div",`sched-hist-row sched-hist-${t.status}`),n=L("div","sched-hist-header"),s=L("span",`sched-hist-dot sched-hist-dot-${t.status}`);if(n.appendChild(s),n.appendChild(L("span","sched-hist-status",t.status)),n.appendChild(L("span","sched-hist-time",ui(t.triggeredAt))),n.appendChild(L("span","sched-hist-duration",pi(t.durationMs))),t.trigger&&n.appendChild(L("span","sched-hist-trigger",t.trigger)),e.appendChild(n),t.status==="error"&&t.errorMessage){let i=L("div","sched-hist-error",t.errorMessage);e.appendChild(i)}if(t.status==="skipped"&&t.skipReason&&e.appendChild(L("div","sched-hist-skip",`Skipped: ${t.skipReason}`)),t.responseExcerpt){let i=L("div","sched-hist-excerpt",t.responseExcerpt);e.appendChild(i)}return e}function z(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function fi(t){switch(t){case"running":return"running";case"completed":return"done";case"failed":return"failed";case"cancelled":return"cancelled"}}function gi(t){switch(t){case"running":return"bgjob-badge bgjob-badge--running";case"completed":return"bgjob-badge bgjob-badge--completed";case"failed":return"bgjob-badge bgjob-badge--failed";case"cancelled":return"bgjob-badge bgjob-badge--cancelled"}}function bi(t,e){if(e===void 0)return"";let n=e-t;if(n<1e3)return`${n}ms`;let s=Math.round(n/1e3);if(s<60)return`${s}s`;let i=Math.floor(s/60),r=s%60;return r===0?`${i}m`:`${i}m ${r}s`}function ki(t){let e=t.lastIndexOf("/");return e!==-1?t.slice(e+1):t}function vi(t){let e=z("div","bgjob-row"),n=z("span",gi(t.status),fi(t.status));if(e.appendChild(n),t.status==="running"){let a=z("span","bgjob-pulse");e.appendChild(a)}let s=z("div","bgjob-body"),i=z("div","bgjob-label",t.label||"(no label)");s.appendChild(i);let r=z("div","bgjob-meta"),o=z("span","bgjob-model",ki(t.model));r.appendChild(o);let l=bi(t.startedAt,t.endedAt);if(l){let a=z("span","bgjob-duration",l);r.appendChild(a)}return s.appendChild(r),e.appendChild(s),e}function xn(t,e){t.textContent="";let n=z("div","bgjobs-panel");if(n.appendChild(z("h2","bgjobs-title","Background Jobs")),e.length===0){n.appendChild(z("div","bgjobs-empty","No background jobs")),t.appendChild(n);return}for(let s of e)n.appendChild(vi(s));t.appendChild(n)}function k(t,e,n){let s=document.createElement(t);return e&&(s.className=e),n!==void 0&&(s.textContent=n),s}function yi(t){if(!t)return"";let e=Date.now()-new Date(t).getTime(),n=Math.floor(Math.abs(e)/1e3);if(n<60)return"just now";let s=Math.floor(n/60);if(s<60)return`${s}m ago`;let i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function xi(){let t=k("div","mem-hot"),e=k("div","mem-hot-header"),n=k("span","mem-hot-title","Hot Memory"),s=k("div","mem-hot-meta"),i=k("span","mem-hot-pct",""),r=k("span","mem-hot-truncated","truncated");r.hidden=!0,s.appendChild(i),s.appendChild(r),e.appendChild(n),e.appendChild(s);let o=k("div","mem-usage-bar"),l=k("div","mem-usage-fill");o.appendChild(l);let a=k("pre","mem-hot-pre"),c=k("p","mem-hot-empty","No hot memory \u2014 HOT.md is empty or not yet created.");t.appendChild(e),t.appendChild(o),t.appendChild(a),t.appendChild(c);function d(u){let{content:p,usage:m}=u;i.textContent=`${m.pct}% of ~${m.maxTokens} token cap`,r.hidden=!m.truncated,l.style.width=`${m.pct}%`,l.className="mem-usage-fill",m.pct>=100?l.classList.add("is-full"):m.pct>=80&&l.classList.add("is-warn"),p?(a.textContent=p,a.hidden=!1,c.hidden=!0):(a.hidden=!0,c.hidden=!1)}return{root:t,update:d}}function wi(t){let e=k("div","mem-card"),n=k("div","mem-card-top"),s=k("span",`mem-badge-type mem-badge-${t.type}`,t.type);if(n.appendChild(s),t.category){let l=k("span",`mem-badge-cat mem-badge-${t.category}`,t.category);n.appendChild(l)}let i=k("span","mem-card-date",yi(t.created_at));i.title=t.created_at,n.appendChild(i),e.appendChild(n);let r=t.content.length>200?`${t.content.slice(0,200)}\u2026`:t.content,o=k("p","mem-card-content",r);return e.appendChild(o),e}var Ci=["","preference","convention","decision","learning"];function Si(t){let e=k("div"),n=k("div","mem-search-row"),s=k("input","mem-search-input");s.type="text",s.placeholder="Search your cross-session memory\u2026",s.setAttribute("autocomplete","off");let i=k("select","mem-cat-select");for(let a of Ci){let c=k("option");c.value=a,c.textContent=a===""?"All categories":a,i.appendChild(c)}let r=k("button","mem-search-btn","Search");n.appendChild(s),n.appendChild(i),n.appendChild(r),e.appendChild(n);let o=k("div","mem-results");Ei(o),e.appendChild(o);async function l(){let a=s.value.trim();if(!a)return;r.setAttribute("disabled",""),Ti(o);let c=new URLSearchParams({q:a}),d=i.value;d&&c.set("category",d);try{let u=await t(`/api/memory/search?${c.toString()}`);Mi(o,u.results)}catch(u){Li(o,u instanceof Error?u.message:"Search failed")}finally{r.removeAttribute("disabled")}}return r.addEventListener("click",()=>{l()}),s.addEventListener("keydown",a=>{a.key==="Enter"&&l()}),{root:e,resultsArea:o}}function Ei(t){t.textContent="";let e=k("div","mem-empty");e.appendChild(k("div","mem-empty-icon","\u{1F9E0}")),e.appendChild(k("div","mem-empty-title","Search your cross-session memory")),e.appendChild(k("div","mem-empty-sub","Type a query above to find facts and procedures.")),t.appendChild(e)}function Ti(t){t.textContent="",t.appendChild(k("div","mem-loading","Searching\u2026"))}function Li(t,e){t.textContent="",t.appendChild(k("div","mem-error",`Error: ${e}`))}function Mi(t,e){if(t.textContent="",e.length===0){let n=k("div","mem-empty");n.appendChild(k("div","mem-empty-icon","\u{1F50D}")),n.appendChild(k("div","mem-empty-title","No results found")),n.appendChild(k("div","mem-empty-sub","Try a different query or category.")),t.appendChild(n);return}for(let n of e)t.appendChild(wi(n))}function wn(t){let{api:e}=t,n=k("div","mem-panel"),s=k("div","mem-inner");s.appendChild(k("h2","mem-title","Memory"));let{root:i,update:r}=xi();s.appendChild(i);let{root:o}=Si(e);s.appendChild(o),n.appendChild(s);let l=()=>{(async()=>{try{let a=await e("/api/memory/hot");r(a)}catch{}})()};return l(),n.refresh=l,n}var Re,$e,lt,Ai=["nav-sessions","nav-schedules","nav-bg-jobs","nav-memory"],Ri=["transcript","approvals","composer"],$i=["schedules-view","bg-jobs-view","memory-view"],Ii={schedules:"schedules-view","bg-jobs":"bg-jobs-view",memory:"memory-view"};function he(t,e){let n=document.getElementById(t);n&&(n.hidden=e)}function me(t,e){let n=t==="sessions";for(let s of Ai){let i=document.getElementById(s),r=i?.getAttribute("data-view")??"";i?.classList.toggle("is-active",r===t)}for(let s of Ri)he(s,!n);he("sidebar-head",!n),he("sessions",!n);for(let s of $i)he(s,!0);if(n||he(Ii[t],!1),t==="schedules"){let s=document.getElementById("schedules-view");!Re&&s&&(Re=new Ae({container:s,api:e,onEdit:i=>vn(i.id?i:null,{api:e,onSaved:()=>{Re?.load()}}),onShowHistory:i=>yn(i,e)})),Re?.load()}if(t==="bg-jobs"){let s=document.getElementById("bg-jobs-view");if(s){lt?.abort(),lt=new AbortController;let{signal:i}=lt;(async()=>{try{let r=await e("/api/bg-jobs",{signal:i});xn(s,r.jobs)}catch(r){if(r instanceof Error&&r.name==="AbortError")return;T(r instanceof Error?r.message:"Failed to load background jobs")}})()}}if(t==="memory"){let s=document.getElementById("memory-view");s&&!$e?($e=wn({api:e}),s.appendChild($e)):$e?.refresh()}}var Sn=vt(),ee=[],P,Ie=[],j={costUsd:0,durationMs:0,turns:0},dt,ct,te=!1,fe=!1,pt;function ut(){return pt||(pt=new Me({container:E("queue"),input:E("prompt"),send:E("send"),submit:async t=>{if(P===void 0)throw new Error("no active session");await F(`/api/sessions/${encodeURIComponent(P)}/prompt`,{method:"POST",body:JSON.stringify({text:t})})},isLive:mt,isTurnActive:()=>te,onAccepted:()=>{te=!0,He()},onError:t=>{T(t)}})),pt}async function F(t,e){let n=await fetch(t,{...e,headers:{authorization:`Bearer ${Sn}`,"content-type":"application/json",...e?.headers??{}}});if(n.status===401){let s="Session credential missing \u2014 reopen the URL printed by `afk web`. A new tab does not inherit the credential from the first one.";try{let i=document.getElementById("status");i&&(i.textContent=s)}catch{}throw new Error(s)}if(!n.ok){let s=await n.text(),i=`${n.status} ${s}`;try{let r=JSON.parse(s);typeof r.message=="string"&&(i=r.message)}catch{}throw new Error(i)}return await n.json()}function Hi(t){t.scrollTop=t.scrollHeight}function Ni(){return ee.find(t=>t.id===P)}function mt(){return Ni()?.mode==="live"}async function ht(){if(ee=(await F("/api/sessions")).sessions,P===void 0&&ee.length>0){let e=ee[0];e&&Ne(e.id)}tt(E("sessions"),ee,P,Ne)}function Ne(t){P=t;let e=t;Ie=[],it(),tn();let n=new Map,s=new Map;ut().clear(),j={costUsd:0,durationMs:0,turns:0},dt?.stop(),te=!1,fe=!1,tt(E("sessions"),ee,P,Ne),nt(E("transcript"),Ie),Cn(),He(),dt=new ge(t,Sn,{onEvent:i=>{if(P!==e)return;let r=i;if(r.error){T(`Stream error: ${r.error}`);return}let o=r.record;if(!o)return;(o.kind==="done"||o.kind==="error")&&(te=!1,He(),ut().flush());let l=rt(o,n,s);if(j=ot(j,o),l){Ie.push(l);let a=E("transcript"),c=!a.hidden&&bn(a);nt(a,Ie),c&&Hi(a)}En()},onStatus:i=>{if(P!==e)return;let r=E("status");r.textContent=i==="ended"?"session ended":i,r.className=`status status-${i}`,i==="ended"&&(te=!1),fe=i==="reconnecting"||i==="connecting",Cn(),He()}}),dt.start()}function Pi(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function En(){let t=[`${j.turns} turns`];j.costUsd>0&&t.push(`$${j.costUsd.toFixed(4)}`);let e=(j.inputTokens??0)+(j.outputTokens??0);e>0&&t.push(`${Pi(e)} tokens`),j.durationMs>0&&t.push(`${(j.durationMs/1e3).toFixed(1)}s`),E("meter").textContent=t.join(" \xB7 ")}function Cn(){let t=mt(),e=E("prompt"),n=E("send"),s=!t||fe;e.disabled=s,n.disabled=s,e.placeholder=t?fe?"Reconnecting\u2026":"Message the agent\u2026 (queues while it works)":"Read-only \u2014 this session runs in another process",E("composer").classList.toggle("is-readonly",!t),E("composer").classList.toggle("is-reconnecting",t&&fe)}function He(){E("stop").hidden=!(te&&mt())}async function _i(t,e){let n=E("new-session");n.disabled=!0,n.textContent="starting\u2026";let s=P;try{let i={model:t};e&&(i.cwd=e);let{session:r}=await F("/api/sessions",{method:"POST",body:JSON.stringify(i)});if(await ht(),P!==s&&P!==r.id)return;Ne(r.id)}catch(i){T(i instanceof Error?i.message:"could not start session")}finally{n.disabled=!1,n.textContent="+ New"}}async function Bi(){if(P===void 0)return;let t=E("stop");t.disabled=!0,t.textContent="Stopping\u2026";try{await F(`/api/sessions/${encodeURIComponent(P)}/interrupt`,{method:"POST",body:JSON.stringify({})})}catch(e){throw t.disabled=!1,t.textContent="Stop",e}}async function Di(){$t({input:E("prompt"),loadCommands:async()=>(await F("/api/commands")).commands}),ut().wire();let t=document.querySelector(".composer-row");t instanceof HTMLElement&&un({input:E("prompt"),container:t}),E("new-session").addEventListener("click",()=>_t((n,s)=>{_i(n,s)})),document.getElementById("nav-sessions")?.addEventListener("click",()=>me("sessions",F)),document.getElementById("nav-schedules")?.addEventListener("click",()=>me("schedules",F)),document.getElementById("nav-bg-jobs")?.addEventListener("click",()=>me("bg-jobs",F)),document.getElementById("nav-memory")?.addEventListener("click",()=>me("memory",F)),Pt(),E("stop").addEventListener("click",()=>{Bi().catch(n=>{T(n instanceof Error?n.message:"stop failed")})}),En(),await ht(),setInterval(()=>{ht().catch(()=>{})},1e4);let e=kn(F,E("approvals"));ct=setInterval(()=>{e.pollPending().catch(()=>{})},1e3),e.pollPending().catch(()=>{}),window.addEventListener("beforeunload",()=>{ct&&clearInterval(ct)})}Di().catch(t=>{T(t instanceof Error?t.message:String(t))});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Approvals.
|
|
3
|
-
*
|
|
4
|
-
* Invariant: a pending approval BLOCKS the agent's turn, so these cards must be
|
|
5
|
-
* impossible to miss — they sit directly above the composer (the region the
|
|
6
|
-
* operator is already looking at) rather than in the transcript, where new
|
|
7
|
-
* output would scroll them out of view while the turn stays stuck.
|
|
8
|
-
*/
|
|
9
|
-
.approvals:empty { display: none; }
|
|
10
|
-
.approvals {
|
|
11
|
-
border-top: 1px solid var(--border); background: var(--bg-sunken);
|
|
12
|
-
padding: 10px 16px; display: flex; flex-direction: column; gap: 8px;
|
|
13
|
-
max-height: 42vh; overflow-y: auto;
|
|
14
|
-
/* z-ladder: approvals=15 must exceed topbar=10 so the card isn't clipped
|
|
15
|
-
by the sticky topbar on short viewports. */
|
|
16
|
-
position: sticky; bottom: 0; z-index: 15;
|
|
17
|
-
}
|
|
18
|
-
.approval-card {
|
|
19
|
-
border: 1px solid var(--warning); border-radius: var(--radius);
|
|
20
|
-
background: var(--bg-raised); padding: 11px 13px;
|
|
21
|
-
}
|
|
22
|
-
.approval-card--destructive {
|
|
23
|
-
border-color: var(--error);
|
|
24
|
-
background: color-mix(in srgb, var(--error) 5%, var(--bg-raised));
|
|
25
|
-
}
|
|
26
|
-
.approval-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
|
|
27
|
-
.approval-badge {
|
|
28
|
-
font-family: var(--mono); font-size: 10px; text-transform: uppercase;
|
|
29
|
-
letter-spacing: 0.06em; color: var(--warning);
|
|
30
|
-
border: 1px solid var(--warning); border-radius: 4px; padding: 1px 6px;
|
|
31
|
-
}
|
|
32
|
-
.approval-source { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
|
|
33
|
-
.approval-time { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-left: auto; }
|
|
34
|
-
.approval-checkboxes { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
|
|
35
|
-
.approval-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); cursor: pointer; }
|
|
36
|
-
.approval-title { font-size: 13px; line-height: 1.5; color: var(--text); }
|
|
37
|
-
.approval-desc { font-size: 12px; line-height: 1.5; color: var(--text-dim); margin-top: 4px; }
|
|
38
|
-
.approval-input {
|
|
39
|
-
width: 100%; margin-top: 8px; padding: 7px 9px;
|
|
40
|
-
font-family: var(--mono); font-size: 12px;
|
|
41
|
-
color: var(--text); background: var(--bg-sunken);
|
|
42
|
-
border: 1px solid var(--border); border-radius: 6px;
|
|
43
|
-
}
|
|
44
|
-
.approval-input:focus { outline: none; border-color: var(--accent); }
|
|
45
|
-
.approval-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
|
|
46
|
-
.approval-btn {
|
|
47
|
-
font: inherit; font-size: 12px; cursor: pointer;
|
|
48
|
-
color: var(--text); background: var(--bg-sunken);
|
|
49
|
-
border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px;
|
|
50
|
-
}
|
|
51
|
-
.approval-btn:hover { border-color: var(--text-dim); }
|
|
52
|
-
.approval-primary { color: var(--bg); background: var(--success); border-color: var(--success); }
|
|
53
|
-
.approval-primary:hover { filter: brightness(1.08); }
|
|
54
|
-
.approval-danger { color: var(--error); border-color: var(--error); background: transparent; }
|
|
55
|
-
.approval-danger:hover { background: rgba(248, 113, 113, 0.12); }
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @file affordance styles (at-file-panel.ts).
|
|
3
|
-
*
|
|
4
|
-
* All class names are prefixed `atf-` to avoid collisions with the base
|
|
5
|
-
* styles.css selectors. Custom properties are the same set used by styles.css
|
|
6
|
-
* so the affordance inherits the page theme automatically.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/* ── trigger button ────────────────────────────────────────────────────────── */
|
|
10
|
-
.atf-btn {
|
|
11
|
-
flex: 0 0 auto;
|
|
12
|
-
padding: 0 10px;
|
|
13
|
-
height: 38px;
|
|
14
|
-
background: var(--bg-sunken);
|
|
15
|
-
border: 1px solid var(--border);
|
|
16
|
-
border-radius: var(--radius);
|
|
17
|
-
color: var(--text-dim);
|
|
18
|
-
font-family: var(--mono);
|
|
19
|
-
font-size: 15px;
|
|
20
|
-
font-weight: 600;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
line-height: 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.atf-btn:hover { color: var(--text); border-color: var(--accent); }
|
|
26
|
-
.atf-btn--active { color: var(--accent); border-color: var(--accent); }
|
|
27
|
-
.atf-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
28
|
-
|
|
29
|
-
/* ── popover ────────────────────────────────────────────────────────────────── */
|
|
30
|
-
/*
|
|
31
|
-
* Invariant: the popover is positioned absolute relative to .composer-row
|
|
32
|
-
* (which has position:relative via the composer-row rule). bottom:100% floats
|
|
33
|
-
* it above the button row — same technique the slash-menu uses — so it never
|
|
34
|
-
* reflows the textarea.
|
|
35
|
-
*/
|
|
36
|
-
.atf-popover {
|
|
37
|
-
position: absolute;
|
|
38
|
-
bottom: 100%;
|
|
39
|
-
right: 0;
|
|
40
|
-
z-index: 25;
|
|
41
|
-
margin-bottom: 8px;
|
|
42
|
-
width: 320px;
|
|
43
|
-
background: var(--bg-raised);
|
|
44
|
-
border: 1px solid var(--border);
|
|
45
|
-
border-radius: var(--radius);
|
|
46
|
-
box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
|
|
47
|
-
padding: 10px 12px 12px;
|
|
48
|
-
max-height: 50vh;
|
|
49
|
-
overflow-y: auto;
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: column;
|
|
52
|
-
gap: 8px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* [hidden] handled by global rule — no per-element override needed. */
|
|
56
|
-
|
|
57
|
-
/* ── hint text ───────────────────────────────────────────────────────────── */
|
|
58
|
-
.atf-hint {
|
|
59
|
-
margin: 0;
|
|
60
|
-
font-size: 11px;
|
|
61
|
-
color: var(--text-faint);
|
|
62
|
-
font-family: var(--mono);
|
|
63
|
-
letter-spacing: 0.02em;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* ── path input row ─────────────────────────────────────────────────────── */
|
|
67
|
-
.atf-input-row {
|
|
68
|
-
display: flex;
|
|
69
|
-
gap: 6px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.atf-path-input {
|
|
73
|
-
flex: 1;
|
|
74
|
-
padding: 5px 8px;
|
|
75
|
-
background: var(--bg-sunken);
|
|
76
|
-
border: 1px solid var(--border);
|
|
77
|
-
border-radius: 6px;
|
|
78
|
-
color: var(--text);
|
|
79
|
-
font-family: var(--mono);
|
|
80
|
-
font-size: 13px;
|
|
81
|
-
min-width: 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.atf-path-input:focus { outline: none; border-color: var(--accent); }
|
|
85
|
-
|
|
86
|
-
.atf-add-btn {
|
|
87
|
-
flex: 0 0 auto;
|
|
88
|
-
padding: 5px 12px;
|
|
89
|
-
background: var(--accent);
|
|
90
|
-
color: #1a0d05;
|
|
91
|
-
border: none;
|
|
92
|
-
border-radius: 6px;
|
|
93
|
-
font: inherit;
|
|
94
|
-
font-size: 13px;
|
|
95
|
-
font-weight: 600;
|
|
96
|
-
cursor: pointer;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.atf-add-btn:hover { opacity: 0.88; }
|
|
100
|
-
.atf-add-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
101
|
-
|
|
102
|
-
/* ── inline validation error ─────────────────────────────────────────────── */
|
|
103
|
-
.atf-error {
|
|
104
|
-
margin: 0;
|
|
105
|
-
font-size: 11px;
|
|
106
|
-
color: var(--error);
|
|
107
|
-
font-family: var(--mono);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* [hidden] handled by global rule — no per-element override needed. */
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/* ── bg-jobs view container ─────────────────────────────────────────────── */
|
|
2
|
-
|
|
3
|
-
.bgjob-view { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 24px; }
|
|
4
|
-
|
|
5
|
-
/* ── bg-jobs panel ────────────────────────────────────────────────────────── */
|
|
6
|
-
|
|
7
|
-
.bgjobs-title { margin: 0 0 16px; font-size: 18px; font-weight: 600; color: var(--text); }
|
|
8
|
-
|
|
9
|
-
.bgjobs-panel {
|
|
10
|
-
max-width: 900px; width: 100%;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
gap: 4px;
|
|
14
|
-
padding: 8px 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* ── empty state ─────────────────────────────────────────────────────────── */
|
|
18
|
-
|
|
19
|
-
.bgjobs-empty {
|
|
20
|
-
padding: 24px 16px;
|
|
21
|
-
text-align: center;
|
|
22
|
-
font-size: 13px;
|
|
23
|
-
color: var(--text-faint);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* ── job row ─────────────────────────────────────────────────────────────── */
|
|
27
|
-
|
|
28
|
-
.bgjob-row {
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
gap: 10px;
|
|
32
|
-
padding: 8px 12px;
|
|
33
|
-
border-radius: 6px;
|
|
34
|
-
background: var(--bg-raised);
|
|
35
|
-
border: 1px solid var(--border);
|
|
36
|
-
min-width: 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* ── status badge ────────────────────────────────────────────────────────── */
|
|
40
|
-
|
|
41
|
-
.bgjob-badge {
|
|
42
|
-
flex: 0 0 auto;
|
|
43
|
-
font-family: var(--mono);
|
|
44
|
-
font-size: 10px;
|
|
45
|
-
font-weight: 600;
|
|
46
|
-
text-transform: uppercase;
|
|
47
|
-
letter-spacing: 0.06em;
|
|
48
|
-
padding: 2px 6px;
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
border: 1px solid transparent;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.bgjob-badge--running {
|
|
54
|
-
color: var(--accent);
|
|
55
|
-
border-color: var(--accent);
|
|
56
|
-
background: color-mix(in srgb, var(--accent) 10%, transparent);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.bgjob-badge--completed {
|
|
60
|
-
color: var(--success);
|
|
61
|
-
border-color: var(--success);
|
|
62
|
-
background: color-mix(in srgb, var(--success) 10%, transparent);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.bgjob-badge--failed {
|
|
66
|
-
color: var(--error);
|
|
67
|
-
border-color: var(--error);
|
|
68
|
-
background: color-mix(in srgb, var(--error) 10%, transparent);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.bgjob-badge--cancelled {
|
|
72
|
-
color: var(--text-dim);
|
|
73
|
-
border-color: var(--border);
|
|
74
|
-
background: transparent;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* ── pulse dot for running jobs ─────────────────────────────────────────── */
|
|
78
|
-
|
|
79
|
-
.bgjob-pulse {
|
|
80
|
-
flex: 0 0 auto;
|
|
81
|
-
width: 7px;
|
|
82
|
-
height: 7px;
|
|
83
|
-
border-radius: 50%;
|
|
84
|
-
background: var(--accent);
|
|
85
|
-
animation: bgjob-pulse 1.6s ease-in-out infinite;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
@keyframes bgjob-pulse {
|
|
89
|
-
0%, 100% { opacity: 1; transform: scale(1); }
|
|
90
|
-
50% { opacity: 0.35; transform: scale(0.75); }
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/* ── label + meta ────────────────────────────────────────────────────────── */
|
|
94
|
-
|
|
95
|
-
.bgjob-body {
|
|
96
|
-
flex: 1 1 0;
|
|
97
|
-
min-width: 0;
|
|
98
|
-
display: flex;
|
|
99
|
-
flex-direction: column;
|
|
100
|
-
gap: 2px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.bgjob-label {
|
|
104
|
-
font-size: 12px;
|
|
105
|
-
color: var(--text);
|
|
106
|
-
white-space: nowrap;
|
|
107
|
-
overflow: hidden;
|
|
108
|
-
text-overflow: ellipsis;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.bgjob-meta {
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
gap: 8px;
|
|
115
|
-
font-family: var(--mono);
|
|
116
|
-
font-size: 10px;
|
|
117
|
-
color: var(--text-faint);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.bgjob-model {
|
|
121
|
-
white-space: nowrap;
|
|
122
|
-
overflow: hidden;
|
|
123
|
-
text-overflow: ellipsis;
|
|
124
|
-
max-width: 140px;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.bgjob-duration {
|
|
128
|
-
white-space: nowrap;
|
|
129
|
-
flex-shrink: 0;
|
|
130
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=document.getElementById("menu-toggle");e?.addEventListener("click",()=>{document.getElementById("sidebar")?.classList.toggle("is-open")});
|