diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md new file mode 100644 index 000000000..a94d1d27b --- /dev/null +++ b/.agents/skills/review-pr/SKILL.md @@ -0,0 +1,73 @@ +--- +name: review-pr +description: Use when reviewing a pull request in the pythinker-code repository — evaluate the change against the template structure. +disable-model-invocation: true +--- + +# Review PR + +Review a pull request by evaluating the description against the template and the actual diff, then write a structured review summary in English. + +## Workflow + +1. Fetch the PR description and metadata: + + ```bash + gh pr view --json title,body,url,files,additions,deletions,baseRefName,headRefName + ``` + +2. Read the full diff: + + ```bash + gh pr diff + ``` + +3. Read enough surrounding code to verify the claims in the PR description. + +4. Evaluate each section against the criteria below. + +5. Write the review summary in English. + +## Review Criteria + +### Requirement or Bug + +- Is the linked issue valid and relevant? +- If no issue, is the requirement clearly stated in one or two sentences? + +### Bug Reproduction Steps + +- For bug PRs: are the steps clear and reproducible? +- Can you follow the steps to confirm the bug exists on the base branch? + +### Root Cause + +- For bug PRs: is the root cause convincingly explained? +- Does the stated root cause match what you see in the diff? +- Is it clear whether this is a fundamental fix or a workaround? + +### Code Changes + +- Does the description match the actual diff? +- Are visual outlines (diff blocks, call trees, file trees) accurate and helpful? +- Is the approach sound? Are there simpler alternatives? +- Are there edge cases the author missed? + +### Impact Scope + +- Are all affected modules identified? Cross-check with the diff file list. +- Does test coverage match the claimed scope? +- Are there untested paths that carry risk? + +### Checklist + +- Are all applicable items checked? +- For items marked as "not needed", do you agree? + +## Output + +Write the review summary in English. For each section: + +- State whether it is adequately filled in. +- Flag anything missing, inaccurate, or inconsistent with the diff. +- If the PR is ready, say so. If changes are needed, list them as actionable items. diff --git a/.agents/skills/write-pr/SKILL.md b/.agents/skills/write-pr/SKILL.md new file mode 100644 index 000000000..14eedba4b --- /dev/null +++ b/.agents/skills/write-pr/SKILL.md @@ -0,0 +1,116 @@ +--- +name: write-pr +description: Use when creating a pull request in the pythinker-code repository — how to fill in each section of the PR template with concise, reviewer-friendly content. +--- + +# Write PR Description + +Create or update the pull request for the current branch with a description that helps the reviewer understand why the change exists and the shape of the implementation. + +## Workflow + +1. Read the PR template: + + `Read(.github/pull_request_template.md)` + +2. Identify or create the pull request: + - Check the current branch for an existing PR: `gh pr view --json url,number,title,state 2>/dev/null`. + - If no PR exists, inspect `git status --short --branch` and the commits on the current branch. + - Commit remaining changes, push the branch with an upstream, and create the PR with `gh pr create`. + - Follow the repository's git safety protocol. + +3. Gather the context needed to explain the change: + - Read the linked issue and any relevant task artifacts. + - Read the complete diff (`git diff main...HEAD`) and enough surrounding code to understand behavior and ownership. + - Use `gh pr view` to collect PR metadata and changed files if the PR already exists. + +4. Write the PR description following the template sections: + - **Requirement or Bug** — one sentence or `Resolve #`. Nothing more. + - **Bug Reproduction Steps** — bug PRs only; `N/A` for features. Write `See linked issue` when steps are already there. + - **Root Cause** — bug PRs only; `N/A` for features. State the cause and whether this is a fundamental fix or a workaround. + - **Code Changes** — use visual outline views (see below) instead of prose whenever they explain the change better. + - **Impact Scope** — list affected modules and test coverage. + - **Checklist** — check every box that applies. + +5. Publish the description: + - Save to a temp file, then `gh pr edit --body-file ` or `gh pr create --body-file `. + - Confirm the update succeeded. + +## Visual Outline for Code Changes + +Prefer structural views over prose. Use the smallest combination that explains the implementation. Omit categories that did not change. + +Show logic or algorithm changes as pseudocode diff: + +```diff + on(save) +- write content ++ if content is unchanged ++ return cached result ++ write new content ++ invalidate cache +``` + +Show runtime control flow as a call tree diff: + +```diff + submitForm + createSession + persistPrompt ++ expandSkillMention + launchAgent +- navigateToSession ++ navigateToSession ++ subscribeToEvents +``` + +Show file responsibility changes as a shallow file tree diff: + +```diff + src/ + ├── commands/ ++│ └── show-me.ts # expands the slash command + ├── sessions/ +-└── transport.ts ++└── transport/ ++ ├── client.ts ++ └── stream.ts +``` + +Show component or UI structure changes as a tree diff: + +```diff + + useSessionEvents() + ++ + ++ +``` + +Show component interaction, control flow, or data flow with Mermaid (especially useful for explaining bug mechanics): + +```mermaid +sequenceDiagram + participant User + participant UI + participant Daemon + User->>UI: choose command + UI->>Daemon: send expanded prompt + Daemon-->>UI: stream result +``` + +Show key data structure or type changes in a language-specific block: + +```ts +interface SessionEvents { + onTurnStart(cb: (turn: Turn) => void): void; + onTurnEnd(cb: (turn: Turn) => void): void; +} +``` + +Rules for visual outlines: +- Use `diff` blocks when the point is what changes and the surrounding shape already exists. +- Show the complete target shape in a language-specific or `text` block when most of it is new or diff notation would obscure ownership or order. +- Tell the story in the order that makes it easiest to understand — files first, or data structures first, whichever fits. +- Write as one human talking to another: simple, coherent, concise language. diff --git a/.changeset/auto-session-title-config.md b/.changeset/auto-session-title-config.md new file mode 100644 index 000000000..30c14b32e --- /dev/null +++ b/.changeset/auto-session-title-config.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +Add `auto_session_title` so automatic session titles can be turned off. diff --git a/.changeset/browser-extension-skill.md b/.changeset/browser-extension-skill.md new file mode 100644 index 000000000..6f3105222 --- /dev/null +++ b/.changeset/browser-extension-skill.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +The browser extension skill resends a failed command as a file and can move the local daemon off a busy port. diff --git a/.changeset/fork-keeps-title-kind.md b/.changeset/fork-keeps-title-kind.md new file mode 100644 index 000000000..47de8c4da --- /dev/null +++ b/.changeset/fork-keeps-title-kind.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +A forked session keeps the source title kind when you do not set a new title. diff --git a/.changeset/large-transcript-cache.md b/.changeset/large-transcript-cache.md new file mode 100644 index 000000000..56eea714b --- /dev/null +++ b/.changeset/large-transcript-cache.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +Fix a crash when opening a session with a very large transcript. diff --git a/.changeset/mcp-offline-access.md b/.changeset/mcp-offline-access.md new file mode 100644 index 000000000..030b81c0a --- /dev/null +++ b/.changeset/mcp-offline-access.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +MCP sign-in requests offline access when the authorization server advertises it. diff --git a/.changeset/repeat-breaker-switch.md b/.changeset/repeat-breaker-switch.md new file mode 100644 index 000000000..ed09eda25 --- /dev/null +++ b/.changeset/repeat-breaker-switch.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +Set `PYTHINKER_CODE_REPEAT_BREAKER=0` to turn off the repeated-tool-call stop. diff --git a/.changeset/transcript-fold-and-jump.md b/.changeset/transcript-fold-and-jump.md new file mode 100644 index 000000000..aafb60e6c --- /dev/null +++ b/.changeset/transcript-fold-and-jump.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +Click a transcript fold to open or close that block, and jump to the bottom when the transcript is scrolled up. diff --git a/.changeset/tui-mode-setting.md b/.changeset/tui-mode-setting.md new file mode 100644 index 000000000..39e57a2a7 --- /dev/null +++ b/.changeset/tui-mode-setting.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +Choose a regular or fullscreen terminal layout with `tui_mode`. diff --git a/.changeset/workspace-trust-and-symlink-guards.md b/.changeset/workspace-trust-and-symlink-guards.md new file mode 100644 index 000000000..21b195735 --- /dev/null +++ b/.changeset/workspace-trust-and-symlink-guards.md @@ -0,0 +1,5 @@ +--- +"@pymodel/pythinker-code": patch +--- + +File tools and git calls no longer follow a symlink out of the workspace, and project-local config waits for workspace trust. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4875d5cea..3d3acf8be 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,24 +5,34 @@ External PRs are accepted for approved bug fixes only: link an issue that a main See https://github.com/PyModel/pythinker-code/blob/main/CONTRIBUTING.md for more. --> -## Related Issue +## Requirement or Bug - + -Resolve #(issue_number) +## Bug Reproduction Steps -## Problem + - +## Root Cause -## What changed + - +## Code Changes + + + +## Impact Scope + + ## Checklist - [ ] I have read the [CONTRIBUTING](https://github.com/PyModel/pythinker-code/blob/main/CONTRIBUTING.md) document. -- [ ] I have linked a related issue (external PRs: the issue must have a maintainer's `/approve`). +- [ ] I have linked a related issue (external PRs: issue must have a maintainer's `/approve`). - [ ] I have added tests that prove my feature works. - [ ] Ran `gen-changesets` skill, or this PR needs no changeset. - [ ] Ran `gen-docs` skill, or this PR needs no doc update. diff --git a/AGENTS.md b/AGENTS.md index 966679cae..bdaf8547d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -115,7 +115,7 @@ Gate behind flags. Env: `PYTHINKER_CODE_EXPERIMENTAL_` toggles one; `PYTHI - Prefer `rg` / `rg --files` for code reading. - Follow existing boundaries and local patterns. - Replace internal identifiers with neutral placeholders in public text/test data (e.g. `example.com`, `example.test`, `YOUR_API_KEY`). Before opening a PR, ask a read-only agent to audit the diff for context-specific internal identifiers. -- PR titles: Conventional Commit style (e.g. `chore: remove legacy format commands`). +- When creating a PR, use the `write-pr` skill (`.agents/skills/write-pr/SKILL.md`) to write the PR description. PR titles: Conventional Commit style (e.g. `chore: remove legacy format commands`). - Fill in `.github/pull_request_template.md` — link the issue, describe changes. No placeholder text or vague AI-generated PR summaries; the human author must understand the change well enough to explain the code, edge cases, and why the approach fits. - Run `gen-changesets` skill before submitting PRs. Changesets must strictly follow its rules: one short user-facing sentence stating only what changed; skip any change users cannot perceive. Never decide `major` on your own — stop, explain, and get explicit user confirmation first; default to `minor`, fall back to `patch`. - Changeset text is shipped text: the desktop release body is generated from `apps/desktop/CHANGELOG.md`, and the in-app updater shows it to users verbatim. A release body must state what changed for users — never a build stamp, a commit hash, or placeholder text. `desktop-release.yml` fails a stable release whose version has no changelog entry. diff --git a/apps/pythinker-code/dist-web/.web-bundle-manifest.json b/apps/pythinker-code/dist-web/.web-bundle-manifest.json index c779c5ace..352873fe9 100644 --- a/apps/pythinker-code/dist-web/.web-bundle-manifest.json +++ b/apps/pythinker-code/dist-web/.web-bundle-manifest.json @@ -1,4 +1,4 @@ { - "sourceHash": "e55e811106536d4ba7c56e5aa5d31c6d852cd0d560ec69e371349706de04ab06", + "sourceHash": "04602432b100c73fa465235500caccbe13e6af08198ab1c90198cdc5bd19fd1c", "sourceFileCount": 496 } diff --git a/apps/pythinker-code/dist-web/assets/CodeBlockNode-_wK8GSRB.js b/apps/pythinker-code/dist-web/assets/CodeBlockNode-uERC4D15.js similarity index 99% rename from apps/pythinker-code/dist-web/assets/CodeBlockNode-_wK8GSRB.js rename to apps/pythinker-code/dist-web/assets/CodeBlockNode-uERC4D15.js index 0b67466dc..79eaaa558 100644 --- a/apps/pythinker-code/dist-web/assets/CodeBlockNode-_wK8GSRB.js +++ b/apps/pythinker-code/dist-web/assets/CodeBlockNode-uERC4D15.js @@ -1,3 +1,3 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BlrGujvY.js","assets/preload-helper-zJ_50EbN.js"])))=>i.map(i=>d[i]); -import{A as e,G as t,I as n,J as r,N as i,O as a,P as o,S as s,T as c,U as l,_ as u,b as d,c as f,d as p,f as m,g as h,h as g,j as _,lt as ee,m as v,n as te,nt as y,ot as b,q as ne,rt as re,st as ie,u as ae,ut as x,v as S,w as C,y as oe,z as se}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{t as ce}from"./preload-helper-zJ_50EbN.js";import{$ as le,A as ue,D as de,J as fe,M as pe,O as me,Q as he,T as ge,X as _e,Y as ve,Z as ye,_ as be,a as xe,d as Se,et as Ce,g as we,h as Te,j as w,n as Ee,nt as De,o as Oe,p as ke,s as Ae,tt as je,v as Me,x as Ne}from"./index-DAFMRqR8.js";var Pe=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Fe=!1,Ie=null,Le=null,T=null;function Re(){return Pe(this,null,function*(){if(T)return T;T=Pe(null,null,function*(){if(!Le)try{if(Le=function(e){let t=e;if(typeof t?.useMonaco==`function`)return t;let n=e?.default;return typeof n?.useMonaco==`function`?n:null}(yield ce(()=>import(`./dist-BlrGujvY.js`),__vite__mapDeps([0,1]))),!Le)return null}catch{return null}try{return yield function(e){return Pe(this,null,function*(){if(!Fe)return Ie||(Ie=Pe(null,null,function*(){let t=globalThis==null?void 0:globalThis.MonacoEnvironment;t&&(typeof t.getWorker==`function`||typeof t.getWorkerUrl==`function`)||typeof e?.preloadMonacoWorkers!=`function`||(yield e.preloadMonacoWorkers()),Fe=!0}).finally(()=>{Ie=null}),Ie)})}(Le),je(),Le}catch{return null}});try{return yield T}finally{T=null}})}var E=Object.defineProperty,ze=Object.defineProperties,D=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||={})O.call(t,n)&&k(e,n,t[n]);if(Be)for(var n of Be(t))Ve.call(t,n)&&k(e,n,t[n]);return e},j=(e,t)=>ze(e,D(t)),M=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),N={key:0,class:`code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]`},P={class:`flex items-center gap-0.5`},F=[`aria-label`],I={class:`code-diff-stat removed`},He={class:`code-diff-stat added`},L=[`aria-label`],Ue={key:0,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},We={key:1,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Ge=[`aria-pressed`],Ke={key:3,class:`relative`},qe=[`aria-expanded`],Je=[`disabled`],Ye=[`disabled`],R=[`disabled`],Xe={key:0,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Ze={key:1,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Qe={class:`code-loading-placeholder`},$e={class:`sr-only`,"aria-live":`polite`,role:`status`},et=C({__name:`CodeBlockShell`,props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:[`toggleCollapse`,`decreaseFont`,`resetFont`,`increaseFont`,`copy`,`toggleExpand`,`preview`],setup(e,{emit:t}){let i=e,a=t,o=y(!1),c=y(null),l=y(null);function m(){Ee(!0),o.value=!o.value,o.value&&document.addEventListener(`click`,_,{once:!0,capture:!0})}function h(){Ee(!0),o.value=!1}function _(e){let t=e.target;c.value?.contains(t)||l.value?.contains(t)?document.addEventListener(`click`,_,{once:!0,capture:!0}):h()}let re=v(()=>i.showFontSizeButtons&&i.enableFontSizeControl||i.showExpandButton||i.isPreviewable&&i.showPreviewButton),{t:C}=xe(),oe=v(()=>!1!==i.showTooltips);function ce(e,t){oe.value&&Te(e.currentTarget,t,`top`,!1,void 0,i.isDark)}function le(){oe.value&&Ee()}function ue(e){ce(e,i.copyText?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`)}let de=v(()=>!!Number.isFinite(i.codeFontSize)&&(i.codeFontSize??0)<=(i.codeFontMin??0)),fe=v(()=>!i.fontBaselineReady||i.codeFontSize===i.defaultCodeFontSize),pe=v(()=>!!Number.isFinite(i.codeFontSize)&&(i.codeFontSize??0)>=(i.codeFontMax??100));return(t,_)=>(n(),S(p,null,[i.showHeader?(n(),S(`div`,N,[se(t.$slots,`header-left`),se(t.$slots,`header-right`,{},()=>[g(`div`,P,[e.diffStats?(n(),S(`div`,{key:0,class:`code-diff-stats`,"aria-label":e.diffStatsAriaLabel},[g(`span`,I,`-`+x(e.diffStats.removed),1),g(`span`,He,`+`+x(e.diffStats.added),1)],8,F)):u(``,!0),i.showCopyButton?(n(),S(`button`,{key:1,type:`button`,class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,"aria-label":e.copyText?b(C)(`common.copied`)||`Copied`:b(C)(`common.copy`)||`Copy`,onClick:_[0]||=e=>a(`copy`),onMouseenter:_[1]||=e=>ue(e),onFocus:_[2]||=e=>ue(e),onMouseleave:le,onBlur:le},[e.copyText?(n(),S(`svg`,We,[..._[14]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M20 6L9 17l-5-5`},null,-1)]])):(n(),S(`svg`,Ue,[..._[13]||=[g(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[g(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),g(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})],-1)]]))],40,L)):u(``,!0),i.showCollapseButton?(n(),S(`button`,{key:2,type:`button`,class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,"aria-pressed":e.isCollapsed,onClick:_[3]||=e=>a(`toggleCollapse`),onMouseenter:_[4]||=t=>ce(t,e.isCollapsed?b(C)(`common.expand`)||`Expand`:b(C)(`common.collapse`)||`Collapse`),onFocus:_[5]||=t=>ce(t,e.isCollapsed?b(C)(`common.expand`)||`Expand`:b(C)(`common.collapse`)||`Collapse`),onMouseleave:le,onBlur:le},[(n(),S(`svg`,{style:ee({rotate:e.isCollapsed?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[..._[15]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m9 18l6-6l-6-6`},null,-1)]],4))],40,Ge)):u(``,!0),re.value?(n(),S(`div`,Ke,[g(`button`,{ref_key:`moreBtnRef`,ref:l,type:`button`,class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors`,"aria-expanded":o.value,"aria-haspopup":`true`,onClick:ae(m,[`stop`]),onMouseenter:_[6]||=e=>ce(e,b(C)(`common.more`)||`More`),onFocus:_[7]||=e=>ce(e,b(C)(`common.more`)||`More`),onMouseleave:le,onBlur:le},[..._[16]||=[d(``,1)]],40,qe),s(te,{name:`code-menu`},{default:ne(()=>[o.value?(n(),S(`div`,{key:0,ref_key:`moreMenuRef`,ref:c,class:`code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]`,role:`menu`},[i.showFontSizeButtons&&i.enableFontSizeControl?(n(),S(p,{key:0},[g(`button`,{type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,disabled:de.value,onClick:_[8]||=e=>{b(Ee)(!0),a(`decreaseFont`)}},[_[17]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14`})],-1),g(`span`,null,x(b(C)(`common.fontSmaller`)||`Font size −`),1)],8,Je),g(`button`,{type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,disabled:fe.value,onClick:_[9]||=e=>{b(Ee)(!0),a(`resetFont`)}},[_[18]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[g(`path`,{d:`M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8`}),g(`path`,{d:`M3 3v5h5`})])],-1),g(`span`,null,x(b(C)(`common.fontReset`)||`Font size reset`),1)],8,Ye),g(`button`,{type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,disabled:pe.value,onClick:_[10]||=e=>{b(Ee)(!0),a(`increaseFont`)}},[_[19]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14m-7-7v14`})],-1),g(`span`,null,x(b(C)(`common.fontLarger`)||`Font size +`),1)],8,R)],64)):u(``,!0),i.showExpandButton?(n(),S(`button`,{key:1,type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors`,onClick:_[11]||=e=>{h(),a(`toggleExpand`)}},[e.isExpanded?(n(),S(`svg`,Xe,[..._[20]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`},null,-1)]])):(n(),S(`svg`,Ze,[..._[21]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`},null,-1)]])),g(`span`,null,x(e.isExpanded?b(C)(`common.collapse`)||`Collapse`:b(C)(`common.expand`)||`Expand`),1)])):u(``,!0),e.isPreviewable&&i.showPreviewButton?(n(),S(`button`,{key:2,type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors`,onClick:_[12]||=e=>{h(),a(`preview`)}},[_[22]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[g(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),g(`circle`,{cx:`12`,cy:`12`,r:`3`})])],-1),g(`span`,null,x(b(C)(`common.preview`)||`Preview`),1)])):u(``,!0)],512)):u(``,!0)]),_:1})])):u(``,!0)])])])):u(``,!0),r(g(`div`,{class:ie([`code-block-shell-content`,{"code-block-shell-content--collapsed":e.isCollapsed}])},[se(t.$slots,`default`)],2),[[f,!!e.stream||!e.loading]]),r(g(`div`,Qe,[se(t.$slots,`loading`,{},()=>[_[23]||=g(`div`,{class:`loading-skeleton`},[g(`div`,{class:`skeleton-line`}),g(`div`,{class:`skeleton-line`}),g(`div`,{class:`skeleton-line short`})],-1)])],512),[[f,!e.stream&&e.loading]]),g(`span`,$e,x(e.copyText?b(C)(`common.copied`)||`Copied`:``),1)],64))}}),tt={class:`html-preview-frame__header`},nt={class:`html-preview-frame__title`},rt={class:`html-preview-frame__label`},z=[`sandbox`,`srcdoc`],it=be(C({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:r}=xe(),a=v(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`\n\n \n \n \n \n \n \n ${e}\n \n`}),s=v(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function c(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return i(()=>{typeof window<`u`&&window.addEventListener(`keydown`,c)}),o(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,c)}),(e,i)=>(n(),h(m,{to:`body`},[g(`div`,{class:ie([`markstream-vue`,{dark:t.isDark}])},[g(`div`,{class:`html-preview-frame__backdrop`,onClick:i[2]||=e=>t.onClose?.call(t)},[g(`div`,{class:`html-preview-frame`,onClick:i[1]||=ae(()=>{},[`stop`])},[g(`div`,tt,[g(`div`,nt,[i[3]||=g(`span`,{class:`html-preview-frame__dot`},null,-1),g(`span`,rt,x(t.title||b(r)(`common.preview`)||`Preview`),1)]),g(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:i[0]||=e=>t.onClose?.call(t)},` × `)]),g(`iframe`,{class:`html-preview-frame__iframe`,sandbox:s.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,z)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),at=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],ot={class:`code-header-main`},st=[`innerHTML`],ct={class:`code-header-copy`},lt={class:`code-header-title`},ut={key:0,class:`code-header-caption`},dt=[`data-markstream-host-hidden`],ft=`__markstreamMonacoPassiveTouchState__`,pt=be(C({__name:`CodeBlockNode`,props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:`vitesse-dark`},lightTheme:{default:`vitesse-light`},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(d,{emit:p}){let m=d,te=p,ae=l(),C=a(Ce,null),ce=a(`markstreamHostScrollManaged`,null),be=a(ge,void 0),Te=v(()=>Se(m,ae)),je=new Set;function Pe(e){return M(this,null,function*(){if(typeof window>`u`)return yield e();let t=window.Element?.prototype,n=t?.addEventListener;if(!t||!n)return yield e();let r=function(){let e=window,t=e[ft];if(t)return t;let n={depth:0,original:null};return e[ft]=n,n}(),i=null;try{r.depth===0&&(r.original=n,t.addEventListener=function(e,t,i){let a=r.original??n;return e===`touchstart`&&function(e,t){if(!e)return!1;let n=e;return!(typeof n.closest!=`function`||!n.closest(`.monaco-editor, .monaco-diff-editor`)||t&&typeof t==`object`&&`passive`in t)}(this,i)?a.call(this,e,t,function(e){return e==null?{passive:!0}:typeof e==`boolean`?{capture:e,passive:!0}:typeof e==`object`?`passive`in e?e:j(A({},e),{passive:!0}):{passive:!0}}(i)):a.call(this,e,t,i)}),r.depth++;let e=!1;i=()=>{e||(e=!0,je.delete(i),r.depth=Math.max(0,r.depth-1),r.depth===0&&r.original&&t.addEventListener!==r.original&&(t.addEventListener=r.original,r.original=null))},je.add(i)}catch{return yield e()}try{return yield e()}finally{i?.()}})}let Fe=c(),Ie=v(()=>{let e=Fe?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Le}=xe(),T=y(null),E=y(null),ze=y(!1),D=y(Xr(m.node.language,m.node.code,Jr())),Be=v(()=>ye(D.value)),O=v(()=>Be.value===`plaintext`?`text`:Be.value),Ve=v(()=>Be.value===`plaintext`),k=y(!1),N=y(!1),P=y(!1),F=y(!1),I=y(!1),He=y(!1),L=!1,Ue=null,We=null,Ge=null,Ke=0,qe=!1,Je=``,Ye=y(null),R=y(null),Xe=null,Ze=0,Qe=!1,$e=ke(),tt=Ne(),nt=Me(),rt=re(null),z=y(typeof window>`u`||!nt.value),pt=c()?.vnode.el?.textContent??``,mt=y(!(typeof window<`u`&&String(m.node.code??``).length>0&&pt.includes(String(m.node.code))));i(()=>{mt.value=!0}),typeof window<`u`&&t([()=>E.value,nt],([e,t],n,r)=>{var i;if((i=rt.value)==null||i.destroy(),rt.value=null,!t||z.value)return void(z.value=!0);if(!e)return void(z.value=!1);let a=!0,o=$e(e,{rootMargin:tt?.value.heavyBlockMargin??tt?.value.rootMargin??`0px`,allowIdle:!1});rt.value=o,z.value=z.value||o.isVisible.value,o.whenVisible.then(()=>{a&&rt.value===o&&(z.value=!0)}).catch(()=>{}),r(()=>{a=!1,o.destroy(),rt.value===o&&(rt.value=null)})},{immediate:!0}),_(()=>{var e;L=!0;for(let e of Array.from(je))e();(function(){let e=Je;C&&e&&(Je=``,C.markSettled(e))})(),(e=rt.value)==null||e.destroy(),rt.value=null});let B=null,ht=null,gt=()=>{},_t=()=>{},vt=()=>null,V=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),H=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),yt=()=>{},bt=()=>{},xt=()=>{},St=null,Ct=null,wt=null,Tt=null,Et=()=>String(m.node.language??`plaintext`),Dt=()=>M(null,null,function*(){}),Ot=!1,kt=null,At=[],jt=[],Mt=null,U=v(()=>me(m.node)),Nt=y({removed:0,added:0}),Pt=v(()=>`-${Nt.value.removed} +${Nt.value.added}`),Ft=Object.freeze(j(A({},ue),{enabled:!1,revealLineCount:0}));function It(e){var t;return Ae(e,((t=E.value)?.getBoundingClientRect)?.call(t).width||E.value?.clientWidth||(typeof window>`u`?0:window.innerWidth))}function Lt(e,t){return{original:Rt(e),updated:Rt(t)}}function Rt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function zt(e){return String(e?.message??e).includes(`no diff result available`)}function Bt(){if(!Vr())try{let e=xt();e&&typeof e.catch==`function`&&e.catch(e=>{zt(e)})}catch(e){zt(e)}}let W=v(()=>{var e,t;let n=m.monacoOptions?A({},m.monacoOptions):{};if(!U.value)return A({lineDecorationsWidth:0,lineNumbersMinChars:2,glyphMargin:!1},n);let r=n.diffHideUnchangedRegions===void 0?A({},ue):we(n.diffHideUnchangedRegions),i=n.hideUnchangedRegions===void 0?void 0:we(n.hideUnchangedRegions),a=!1!==m.stream&&!1!==m.loading,o=a?A({},Ft):r,s=a?A({},Ft):i,c=function(e){return e.diffWordWrap===void 0?`off`:e.diffWordWrap}(n),l=A({},n.experimental??{}),u=n.diffUnchangedRegionStyle??`line-info`,d=function(e){return A(j(A({},e.scrollbar&&typeof e.scrollbar==`object`?e.scrollbar:{}),{verticalScrollbarSize:0,horizontalScrollbarSize:0}),It(e)?{horizontal:`hidden`}:{})}(n);return j(A(j(A(A({},{maxComputationTime:0,diffAlgorithm:`legacy`,ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:`none`,renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:`off`,matchBrackets:`never`,lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,padding:{top:0,bottom:0},minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffWordWrap:c,renderSideBySide:(e=n.renderSideBySide)==null||e,diffHideUnchangedRegions:o,useInlineViewWhenSpaceIsLimited:(t=n.useInlineViewWhenSpaceIsLimited)!=null&&t,diffLineStyle:`background`,diffAppearance:`auto`,diffUnchangedRegionStyle:u,diffHunkActionsOnHover:!1,experimental:l}),n),{experimental:l}),s===void 0?{}:{hideUnchangedRegions:s}),{diffHideUnchangedRegions:o,diffWordWrap:c,scrollbar:d})}),Vt=v(()=>(m.theme===void 0?Ci(m.darkTheme,m.lightTheme):!xi(m.theme))?function(e){if(e&&typeof e==`object`&&e.colors?.[`editor.background`]){let t=yr(e.colors[`editor.background`]);if(t!=null)return t<128}let t=(Si(e)??``).toLowerCase();return t?[`dark`,`night`,`moon`,`black`,`dracula`,`mocha`,`frappe`,`macchiato`,`palenight`,`ocean`,`poimandres`,`monokai`,`laserwave`,`tokyo`,`slack-dark`,`rose-pine`,`github-dark`,`material-theme`,`one-dark`,`catppuccin-mocha`,`catppuccin-frappe`,`catppuccin-macchiato`].some(e=>t.includes(e))&&![`light`,`latte`,`dawn`,`lotus`].some(e=>t.includes(e)):!!m.isDark}(wi()):!!m.isDark),Ht=v(()=>{if(!U.value)return Vt.value?`dark`:`light`;let e=W.value?.diffAppearance;return e===`light`||e===`dark`?e:Vt.value?`dark`:`light`}),Ut=v(()=>U.value?Ht.value===`dark`:Vt.value),Wt=v(()=>U.value?`diff`:`single`),Gt=y(Wt.value),G=y(!1),K=y(!1),Kt=y(!1),q=y(!1),qt=y(null),Jt=y(0),Yt=y(0),Xt=y(!1),Zt=null,Qt=!1,$t=null,en=!1,tn=v(()=>{if(U.value){let e=W.value?.diffWordWrap;if(e===`inherit`){let e=m.monacoOptions?.wordWrap;return e==null||String(e)!==`off`}return e===`on`}let e=m.monacoOptions?.wordWrap;return e==null||String(e)!==`off`}),nn=v(()=>!!U.value&&It(W.value??{})),rn=v(()=>{let e=m.monacoOptions?.diffHideUnchangedRegions;return e===void 0?A({},ue):we(e)});function an(e){return!0===ce?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let on=v(()=>an(E.value)),sn=v(()=>!(G.value||!q.value&&K.value)),cn=v(()=>sn.value),ln=v(()=>sn.value&&!Kt.value),un=v(()=>!G.value&&!q.value&&sn.value),dn=v(()=>K.value&&!G.value?`ready`:q.value?`fallback`:`pending`),fn=y(!1),pn=v(()=>Rt(m.node.code)),mn=v(()=>U.value?!0===m.node.diff?m.node:j(A({},m.node),{diff:!0}):pn.value===m.node.code?m.node:j(A({},m.node),{code:pn.value})),J=y(typeof m.monacoOptions?.fontSize==`number`?m.monacoOptions.fontSize:NaN),Y=y(J.value),hn=y(null),gn=y(null),_n=y(null),vn=v(()=>{let e=J.value,t=Y.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),yn=v(()=>{let e=hn.value;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=m.monacoOptions?.fontSize;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return t;let n=Y.value;return typeof n==`number`&&Number.isFinite(n)&&n>0?n:12}),bn=v(()=>{let e=gn.value;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=m.monacoOptions?.lineHeight;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:yn.value===12?18:Math.max(12,Math.round(1.5*yn.value))}),xn=v(()=>bn.value),Sn=v(()=>{let e=m.monacoOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),Cn=v(()=>{let e=m.monacoOptions?.padding,t=U.value?0:8;return{top:typeof e?.top==`number`&&Number.isFinite(e.top)&&e.top>=0?e.top:t,bottom:typeof e?.bottom==`number`&&Number.isFinite(e.bottom)&&e.bottom>=0?e.bottom:t}}),wn=v(()=>{let e=m.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Tn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(Kr()))}function En(){return!U.value&&!1!==m.stream&&!1!==m.loading}let Dn=v(()=>U.value?null:wn.value==null||En()?Math.ceil((e=>{let t=String(e??``);return t?Math.max(1,t.split(/\r\n|\n|\r/).length):1})(pn.value)*xn.value+1):null),On=v(()=>{if(U.value)return null;let e=wn.value;return e==null||En()?Tn(Dn.value):Tn(e)}),kn=v(()=>{let e=m.estimatedHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}),An=y(null);function jn(){let e=An.value;return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.round(e):null}let Mn=v(()=>jn()??(!U.value&&Xt.value?null:sn.value||!K.value?On.value:null));function Nn(e){let t=e?`hsl(152 42% 60%)`:`var(--diff-added-fg)`,n=e?`hsl(0 58% 58%)`:`var(--diff-removed-fg)`,r=e?`hsl(152 42% 60% / 0.18)`:`var(--diff-added-bg)`,i=e?`hsl(0 58% 58% / 0.18)`:`var(--diff-removed-bg)`,a=e?`hsl(152 42% 60% / 0.28)`:`var(--diff-added-inline-bg)`,o=e?`hsl(0 58% 58% / 0.28)`:`var(--diff-removed-inline-bg)`,s=`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,c=`linear-gradient(90deg, ${n} 0 4px, transparent 4px 100%)`,l=e?`hsl(0 0% 7% / 0.98)`:`hsl(var(--ms-muted) / 0.45)`,u=`var(--markstream-code-layout-character-width, 1ch)`,d=`calc(${u} + ${u})`,f=`calc(${u} + ${u} + ${u} + ${u} + ${u} + 2px)`,p=`calc(${f} + ${u})`;return{"--markstream-diff-line-number-bg":l,"--markstream-diff-added-fg":t,"--markstream-diff-removed-fg":n,"--markstream-diff-added-line":r,"--markstream-diff-removed-line":i,"--markstream-diff-added-line-fill":r,"--markstream-diff-removed-line-fill":i,"--markstream-diff-added-gutter":s,"--markstream-diff-removed-gutter":c,"--markstream-diff-added-inline":a,"--markstream-diff-removed-inline":o,"--stream-monaco-added-fg":t,"--stream-monaco-removed-fg":n,"--stream-monaco-added-line":r,"--stream-monaco-removed-line":i,"--stream-monaco-added-line-fill":r,"--stream-monaco-removed-line-fill":i,"--stream-monaco-added-gutter":s,"--stream-monaco-removed-gutter":c,"--stream-monaco-added-inline":a,"--stream-monaco-removed-inline":o,"--stream-monaco-gutter-marker-width":`4px`,"--stream-monaco-gutter-gap":`1ch`,"--stream-monaco-line-number-left":`0px`,"--stream-monaco-line-number-width":d,"--stream-monaco-line-number-padding-left":d,"--stream-monaco-line-number-padding-right":u,"--stream-monaco-line-number-separator-width":`2px`,"--stream-monaco-layout-character-width":u,"--stream-monaco-line-number-box-width":f,"--stream-monaco-line-number-gap-to-code":u,"--stream-monaco-line-number-bg":l,"--stream-monaco-diff-code-gap":u,"--stream-monaco-diff-code-padding":`0px`,"--stream-monaco-original-margin-width":p,"--stream-monaco-original-scrollable-left":p,"--stream-monaco-original-scrollable-width":`calc(100% - ${p})`,"--stream-monaco-modified-margin-width":p,"--stream-monaco-modified-scrollable-left":p,"--stream-monaco-modified-scrollable-width":`calc(100% - ${p})`}}let Pn=v(()=>{let e=m.monacoOptions?.fontFamily,t=Tn(wn.value),n=Tn(Dn.value),r=En(),i=A(A({fontSize:`${yn.value}px`,lineHeight:`${xn.value}px`,tabSize:Sn.value,boxSizing:`border-box`,maxHeight:`${Kr()}px`,overflow:`auto`,paddingTop:`${Cn.value.top}px`,paddingBottom:`${Cn.value.bottom}px`},U.value||t==null||r?U.value||n==null?{}:{minHeight:`${n}px`}:{height:`${t}px`,minHeight:`${t}px`}),typeof e==`string`&&e.trim()?{"--markstream-code-font-family":e.trim()}:{});return i[`--markstream-pre-line-number-top`]=`${Cn.value.top}px`,i[`--markstream-code-padding-left`]=`calc(2ch + 2ch + 1ch + 2px + 1ch)`,i[`--markstream-pre-line-number-left`]=`0px`,i[`--markstream-pre-line-number-width`]=`2ch`,i[`--markstream-pre-line-number-padding-left`]=`2ch`,i[`--markstream-pre-line-number-padding-right`]=`1ch`,i[`--markstream-pre-line-number-separator-width`]=`2px`,U.value&&(i[`--markstream-pre-diff-line-height`]=`${xn.value}px`,i[`--markstream-pre-diff-pane-bottom-padding`]=(nn.value,`0px`),Object.assign(i,Nn(Ut.value))),i}),Fn=v(()=>Mn.value!=null&&(!K.value||jn()!=null)),In=v(()=>{let e=Mn.value;if(e==null)return null;if(U.value)return Math.ceil(e);let t=kn.value,n=wn.value;if(t==null||n==null)return Math.ceil(e);let r=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+r)}),Ln=v(()=>{if(U.value&&sn.value)return{};let e=Mn.value;return Fn.value&&e!=null?{minHeight:`${e}px`}:{}});function Rn(){var e,t,n,r;let i=E.value?.querySelector(`pre.code-pre-fallback`),a=H(),o=i?.scrollTop??0;(t=(e=(a?.getOriginalEditor)?.call(a))?.setScrollTop)==null||t.call(e,o),(r=(n=(a?.getModifiedEditor)?.call(a))?.setScrollTop)==null||r.call(n,o)}function zn(){return M(this,null,function*(){return U.value?(Sr()??Bn(),Z(!0),Rn(),Q(),Kt.value=!0,yield e(),Z(!0),yield Un(),Z(!0),!(St&&!(yield St())||(br(),Bn(),Z(!0),K.value=!0,yield e(),Bn(),Z(!0),br(),Q(),$(),0))):!(St&&!(yield St())||(K.value=!0,yield e(),X(!1),Z(),0))})}function Bn(){let e=T.value;return e&&Lr(e)?(Q(),X({preferModelDiffHeight:!0}),Mr(),Number.parseFloat(e.style.height||``)||null):Sr()}function Vn(){if(!U.value||!I.value||!K.value||sn.value)return!1;let e=T.value;return!!e&&vr(e)}function Hn(e,t=!1,n={}){let r=Math.ceil(e),i=jn();if(i==null)return r;let a=!0===n.allowBelowEstimatedFloor||Vn();return r>=i||a?((t||a)&&I.value&&(An.value=null),r):i}function Un(){return new Promise(e=>{let t=!1,n=null,r=null,i=()=>{t||(t=!0,r!=null&&globalThis.clearTimeout(r),n!=null&&pe(n),e())};r=globalThis.setTimeout(i,50),n=w(i)})}function Wn(){try{let e=T.value;if(!e)return null;let t=e.querySelector(`.view-lines .view-line`);if(t){let e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch{}return null}function Gn(){var e;try{let t=U.value?((e=H())?.getModifiedEditor)?.call(e)??H():V(),n=vt()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}try{let e=T.value;if(e){let t=e.querySelector(`.view-lines .view-line`);if(t)try{if(typeof window<`u`&&typeof window.getComputedStyle==`function`){let e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch{}}}catch{}return null}function Kn(e){try{let t=vt()?.EditorOption?.lineHeight;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n==`number`&&n>0)return n}}catch{}let t=Wn();if(t&&t>0)return t;let n=Number.isFinite(Y.value)&&Y.value>0?Y.value:14;return Math.max(12,Math.round(1.35*n))}function qn(e){try{let t=vt()?.EditorOption?.padding;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n?.top==`number`||typeof n?.bottom==`number`)return(typeof n?.top==`number`&&Number.isFinite(n.top)?Math.max(0,n.top):0)+(typeof n?.bottom==`number`&&Number.isFinite(n.bottom)?Math.max(0,n.bottom):0)}}catch{}let t=W.value?.padding;return typeof t?.top==`number`||typeof t?.bottom==`number`?(typeof t?.top==`number`&&Number.isFinite(t.top)?Math.max(0,t.top):0)+(typeof t?.bottom==`number`&&Number.isFinite(t.bottom)?Math.max(0,t.bottom):0):U.value?24:0}function Jn(e,t){return typeof e!=`number`||typeof t!=`number`||e<1||t=i&&o>=i&&n[a]===r[o];)a--,o--;let s=Math.max(0,a-i+1),c=Math.max(0,o-i+1);if(s===0||c===0)return{removed:s,added:c};if((s+1)*(c+1)<=15e5){let e=c+1,t=new Uint32Array(e),a=new Uint32Array(e);for(let e=s-1;e>=0;e--){a[c]=0;for(let o=c-1;o>=0;o--)a[o]=n[i+e]===r[i+o]?t[o+1]+1:Math.max(t[o],a[o+1]);let o=t;t=a,a=o}let o=t[0];return{removed:s-o,added:c-o}}return{removed:s,added:c}}function Zn(e){if(!function(){return!(!U.value||!nn.value)&&(m.node.originalCode!=null||m.node.updatedCode!=null?Xn(String(m.node.originalCode??``),String(m.node.updatedCode??``)).removed>0:String(m.node.code??``).split(/\r\n|\n|\r/).some(e=>function(e){return e.startsWith(`-`)&&!e.startsWith(`---`)}(e)))}())return!0;let t=e?.querySelector(`.stream-monaco-fallback-inline-delete-line`);if((t?.textContent)?.trim()&&(t.hasAttribute(`data-stream-monaco-colorize-signature`)||t.querySelector(`[class*="mtk"]`)))return!0;let n=e?.querySelector([`.editor.modified .view-zones .view-lines.line-delete`,`.editor.modified .view-lines .view-line.line-delete`,`.editor.original .view-zones .view-lines.line-delete`,`.editor.original .view-lines .view-line.line-delete`].join(`,`));if(!n||!n.matches(`.view-line`)&&!n.querySelector(`.view-line`))return!1;let r=n.getBoundingClientRect(),i=e?.getBoundingClientRect();return i?.width===0&&i.height===0||r.width>0&&r.height>0}function Qn(e,t){if(!e)return!1;let n=t.added<=0||!!e.querySelector([`.line-insert`,`.gutter-insert`,`.stream-monaco-fallback-line-insert`,`.stream-monaco-fallback-gutter-insert`,`.stream-monaco-fallback-line-number-insert`].join(`,`)),r=t.removed<=0||!!e.querySelector([`.line-delete`,`.gutter-delete`,`.inline-deleted-margin-view-zone`,`.stream-monaco-fallback-line-delete`,`.stream-monaco-fallback-gutter-delete`,`.stream-monaco-fallback-line-number-delete`,`.stream-monaco-fallback-inline-delete-line`,`.stream-monaco-fallback-inline-delete-margin`].join(`,`));return n&&r}function $n(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?typeof window>`u`||typeof window.getComputedStyle!=`function`?n:window.getComputedStyle(n).display===`none`?null:n:null}function er(e,t){return $n(e,t)!==null}function tr(e,t){if(!e)return!1;let n=t.added<=0||[`.gutter-insert`,`.stream-monaco-fallback-gutter-insert`].some(t=>er(e,t)),r=t.removed<=0||[`.gutter-delete`,`.inline-deleted-margin-view-zone`,`.stream-monaco-fallback-gutter-delete`,`.stream-monaco-fallback-inline-delete-margin`].some(t=>er(e,t));return n&&r}function nr(e){let t=Array.from(e?.querySelectorAll(`.monaco-diff-editor .margin-view-overlays .line-numbers`)??[]);return!!t.length&&t.some(e=>{if(!e.textContent?.trim())return!1;if(typeof window>`u`||typeof window.getComputedStyle!=`function`)return!0;let t=window.getComputedStyle(e);if(t.display===`none`)return!1;let n=e.getBoundingClientRect();if(n.width<=0&&n.height<=0)return!0;let r=Number.parseFloat(t.width||``),i=Number.parseFloat(t.paddingLeft||``),a=Number.parseFloat(t.paddingRight||``);return Math.max(n.width,Number.isFinite(r)?r:0)>=8&&Number.isFinite(i)&&i>=1&&Number.isFinite(a)&&a>=1})}function rr(e){let t=$n(e,`.monaco-diff-editor .view-lines .view-line`);if(!t)return!1;if(!cr())return!0;let n=$n(e,`.monaco-diff-editor .margin-view-overlays .line-numbers`);if(!n)return!1;if(typeof window>`u`||typeof window.getComputedStyle!=`function`)return!0;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();if(r.width<=0&&r.height<=0||i.width<=0&&i.height<=0)return!0;let a=r.left-i.right;return a>=0&&a<=32}function ir(e,t){return!nn.value||!(t||e?.querySelector([`.line-insert`,`.line-delete`,`.gutter-insert`,`.gutter-delete`,`.stream-monaco-line-number-insert`,`.stream-monaco-line-number-delete`,`.stream-monaco-line-insert-fill`,`.stream-monaco-line-delete-fill`,`.stream-monaco-fallback-line-insert`,`.stream-monaco-fallback-line-delete`,`.stream-monaco-fallback-inline-delete-line`].join(`,`)))||!!(e?.classList.contains(`stream-monaco-diff-inline-native-ready`)&&!e.classList.contains(`stream-monaco-diff-native-stale`))}function ar(e,t,n,r){let i=e?.querySelector(`.monaco-diff-editor .editor.${t}`);if(!i)return!1;let a=Array.from(i.querySelectorAll(`.margin-view-overlays .line-numbers.${n}`));if(!a.length)return!0;let o=Array.from(i.querySelectorAll(`.lines-content > .view-lines:not(.line-delete) > .view-line`));return!!o.length&&a.every(e=>{let t=e.getBoundingClientRect(),n=null;for(let e of o){let r=e.getBoundingClientRect(),i=Math.abs(r.top-t.top);(!n||i1.25||n.node.classList.contains(r)})}function or(e,t){if(!e)return!1;let n=t.added<=0||ar(e,`modified`,`stream-monaco-line-number-insert`,`stream-monaco-line-insert-fill`),r=t.removed<=0||(nn.value?!!e.classList.contains(`stream-monaco-diff-inline-native-ready`):ar(e,`original`,`stream-monaco-line-number-delete`,`stream-monaco-line-delete-fill`));return n&&r}function sr(e){if(Ve.value)return!0;if(!e)return!1;let t=Array.from(e.querySelectorAll(`.monaco-diff-editor .view-lines .view-line, .monaco-editor .view-lines .view-line`)).filter(e=>{if(!e.textContent?.trim())return!1;let t=e.getBoundingClientRect();return t.width>0||t.height>0});if(!t.length)return!1;let n=t.filter(e=>{var t;return t=e.textContent??``,/['"`{}()[\]:;=<>.,]|\/\/|\/\*|\b(?:async|await|class|const|enum|export|for|function|if|import|interface|let|return|switch|type|var|while)\b/.test(t.replace(/\u00A0/g,` `).trim())});return!n.length||n.filter(e=>Array.from(e.querySelectorAll(`span`)).filter(e=>e.textContent?.trim()).some(e=>String(e.className||``).split(/\s+/).some(e=>/^mtk\d+$/.test(e)&&e!==`mtk1`))).length>0}function cr(){return W.value?.lineNumbers!==`off`}function lr(){U.value?Nt.value=Xn(String(m.node.originalCode??``),String(m.node.updatedCode??``)):Nt.value={removed:0,added:0}}function ur(){if(U.value)try{let e=H(),t=(e?.getLineChanges)?.call(e);if(!Array.isArray(t))return void lr();let n=0,r=0;for(let e of t)n+=Jn(e.originalStartLineNumber,e.originalEndLineNumber),r+=Jn(e.modifiedStartLineNumber,e.modifiedEndLineNumber);Nt.value={removed:n,added:r}}catch{lr()}else Nt.value={removed:0,added:0}}function dr(){if(Number.isFinite(Y.value)&&Y.value>0&&Number.isFinite(J.value))return Y.value;let e=Gn();return typeof m.monacoOptions?.fontSize==`number`?(J.value=m.monacoOptions.fontSize,Y.value=m.monacoOptions.fontSize,Y.value):e&&e>0?(J.value=e,Y.value=e,e):(J.value=12,Y.value=12,12)}function fr(){let e=dr();Y.value=Math.min(36,e+1)}function pr(){let e=dr();Y.value=Math.max(10,e-1)}function mr(){dr(),Number.isFinite(J.value)&&(Y.value=J.value)}function hr(){var e,t,n,r,i;try{let a=U.value?H():null,o=U.value?a:V();if(!o)return null;if(a?.getOriginalEditor&&a?.getModifiedEditor){let i=a.getOriginalEditor?.call(a),o=a.getModifiedEditor?.call(a);(e=i?.layout)==null||e.call(i),(t=o?.layout)==null||t.call(o);let s=(i?.getContentHeight)?.call(i)||0,c=(o?.getContentHeight)?.call(o)||0,l=Math.max(s,c);if(l>0)return Math.ceil(l);let u=((n=(i?.getModel)?.call(i))?.getLineCount)?.call(n)||1,d=((r=(o?.getModel)?.call(o))?.getLineCount)?.call(r)||1,f=Math.max(u,d),p=Math.max(Kn(i),Kn(o)),m=Math.max(qn(i),qn(o));return Math.ceil(f*p+m+0)}if(o?.getContentHeight){(i=o?.layout)==null||i.call(o);let e=o.getContentHeight();if(e>0)return U.value||(Xt.value=!0),Math.ceil(e)}let s=(o?.getModel)?.call(o),c=1;s&&typeof s.getLineCount==`function`&&(c=s.getLineCount());let l=Kn(o);return Math.ceil(c*(l+1.5)+0)}catch{return null}}function gr(){var e;if(U.value)return!1;try{let t=((e=V())?.getContentHeight)?.call(e),n=typeof t==`number`&&Number.isFinite(t)&&t>0;return n&&(Xt.value=!0),n}catch{return!1}}function _r(e){if(typeof window>`u`)return null;try{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`)return null;let r=e.querySelector(`diffs-container`);if(r instanceof HTMLElement){let e=r.getBoundingClientRect();if(e.height>0&&e.bottom>t.top)return Math.ceil(e.bottom-t.top)}let i=[`.editor.original .view-lines .view-line`,`.editor.modified .view-lines .view-line`,`.editor.original .view-zones > div`,`.editor.modified .view-zones > div`,`.editor.original .margin-view-zones > div`,`.editor.modified .margin-view-zones > div`,`.editor.original .diff-hidden-lines`,`.editor.modified .diff-hidden-lines`,`.stream-monaco-diff-unchanged-bridge`],a=0;for(let n of Array.from(e.querySelectorAll(i.join(`,`)))){if(!(n instanceof HTMLElement)||(n.parentElement?.classList.contains(`view-zones`)||n.parentElement?.classList.contains(`margin-view-zones`))&&!(n.textContent?.trim()||n.matches(`.line-delete, .line-insert, .cdr`)||n.querySelector(`.diff-hidden-lines, .stream-monaco-diff-unchanged-bridge, .line-delete, .line-insert, .cdr`)))continue;let e=window.getComputedStyle(n);if(e.display===`none`||e.visibility===`hidden`||Number.parseFloat(e.opacity||`1`)<=.01)continue;let r=n.getBoundingClientRect();r.height<=0||r.bottom<=t.top||(a=Math.max(a,r.bottom-t.top))}return a>0?Math.ceil(a):null}catch{return null}}function vr(e){if(typeof window>`u`)return!1;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return!1;let n=e.querySelectorAll(`.editor.modified .diff-hidden-lines, .editor.original .diff-hidden-lines, .stream-monaco-diff-unchanged-bridge`);for(let e of Array.from(n)){if(!(e instanceof HTMLElement))continue;let n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||Number.parseFloat(n.opacity||`1`)<=.01)continue;let r=e.getBoundingClientRect();if(!(r.width<=0||r.height<=0||r.bottom<=t.top||r.top>=t.bottom))return!0}return!1}function yr(e){let t=String(e??``).trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];if(n){let e=n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n;return .2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}let r=t.match(/\d+(?:\.\d+)?/g);if(!r||r.length<3)return null;let[i,a,o]=r.slice(0,3).map(Number);return .2126*i+.7152*a+.0722*o}function br(){var e;if(xr())return;let t=Gn();t&&t>0&&(hn.value=t,Y.value=t,J.value=t);try{let t=Kn(U.value?((e=H())?.getModifiedEditor)?.call(e)??H():V());t&&t>0&&(gn.value=t)}catch{}try{let e=Wn();e&&e>0&&(gn.value=e)}catch{}}function xr(){return U.value&&cn.value}function Sr(){if(!U.value||!sn.value)return null;let e=T.value,t=E.value?.querySelector(`pre.code-pre-fallback`);if(!e||!t)return null;let n=Math.ceil(t.getBoundingClientRect().height);return!Number.isFinite(n)||n<=0?null:(e.style.height=`${n}px`,e.style.minHeight=`${n}px`,e.style.maxHeight=`${Math.ceil(Kr())}px`,e.style.overflow=`hidden`,n)}function Cr(){let e=T.value,t=E.value;if(!e||!t)return;let n=e,r=e.querySelector(`.monaco-editor`)||e,i=r.querySelector(`.monaco-editor-background`)||r,a=r.querySelector(`.view-lines`)||r,o=null,s=null,c=null;try{typeof window<`u`&&typeof window.getComputedStyle==`function`&&(o=window.getComputedStyle(r),s=i===r?o:window.getComputedStyle(i),c=a===r?o:window.getComputedStyle(a))}catch{o=null,s=null,c=null}let l=String(o?.getPropertyValue(`--vscode-editor-foreground`)??``).trim(),u=String(o?.getPropertyValue(`--vscode-editor-background`)??``).trim(),d=String(o?.getPropertyValue(`--vscode-editor-selectionBackground`)??o?.getPropertyValue(`--vscode-editor-hoverHighlightBackground`)??``).trim(),f=l||String(c?.color??o?.color??``).trim(),p=u||String(s?.backgroundColor??o?.backgroundColor??``).trim(),m=function(){var e;try{let t=U.value?((e=H())?.getModifiedEditor)?.call(e)??H():V(),n=vt()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.typicalHalfwidthCharacterWidth;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}return null}();if(m!=null&&(_n.value=m),U.value){let e=(e,r)=>{r?(t.style.setProperty(e,r),n.style.setProperty(e,r)):(t.style.removeProperty(e),n.style.removeProperty(e))};for(let[n,r]of Object.entries(Nn(t.classList.contains(`is-dark`))))e(n,r);f?(t.style.setProperty(`--markstream-diff-editor-fg`,f),n.style.setProperty(`--vscode-editor-foreground`,f),n.style.setProperty(`--stream-monaco-editor-fg`,f)):(t.style.removeProperty(`--markstream-diff-editor-fg`),n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--stream-monaco-editor-fg`)),p?(t.style.setProperty(`--markstream-diff-editor-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg-soft`,p),t.style.setProperty(`--markstream-diff-panel-bg-strong`,p),n.style.setProperty(`--vscode-editor-background`,p),n.style.setProperty(`--stream-monaco-editor-bg`,p),n.style.setProperty(`--stream-monaco-fixed-editor-bg`,p),n.style.setProperty(`--stream-monaco-panel-bg`,p),n.style.setProperty(`--stream-monaco-panel-bg-soft`,p),n.style.setProperty(`--stream-monaco-panel-bg-strong`,p),n.style.backgroundColor=p):(t.style.removeProperty(`--markstream-diff-editor-bg`),t.style.removeProperty(`--markstream-diff-panel-bg`),t.style.removeProperty(`--markstream-diff-panel-bg-soft`),t.style.removeProperty(`--markstream-diff-panel-bg-strong`),n.style.removeProperty(`--vscode-editor-background`),n.style.removeProperty(`--stream-monaco-editor-bg`),n.style.removeProperty(`--stream-monaco-fixed-editor-bg`),n.style.removeProperty(`--stream-monaco-panel-bg`),n.style.removeProperty(`--stream-monaco-panel-bg-soft`),n.style.removeProperty(`--stream-monaco-panel-bg-strong`),n.style.backgroundColor=``),d?n.style.setProperty(`--vscode-editor-selectionBackground`,d):n.style.removeProperty(`--vscode-editor-selectionBackground`);return}if(function(e,t,n){if(!Ve.value)return!1;let r=yr(e),i=yr(t);return n?r!=null&&r>170||i!=null&&i<110:r!=null&&r<85||i!=null&&i>190}(p,f,t.classList.contains(`is-dark`)))return n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--vscode-editor-background`),void n.style.removeProperty(`--vscode-editor-selectionBackground`);f&&n.style.setProperty(`--vscode-editor-foreground`,f),p&&n.style.setProperty(`--vscode-editor-background`,p),d&&n.style.setProperty(`--vscode-editor-selectionBackground`,d)}let wr=0,Tr=0,Er=/auto|scroll|overlay/i;function Dr(e,t,n){if(typeof window>`u`||U.value||function(e){return on.value||an(e)}(e))return;let r=Math.ceil(n)-Math.ceil(t);if(Math.abs(r)<=1)return;let i=function(e){if(typeof window>`u`)return null;let t=e?.ownerDocument??document,n=t.scrollingElement||t.documentElement||t.body,r=e?.parentElement??null;for(;r&&r!==t.body&&r!==n;){let e=window.getComputedStyle(r),t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();if(Er.test(t)||Er.test(n))return r;r=r.parentElement}return n}(e);if(!i)return;let a=e.ownerDocument??document,o=i===a.body||i===a.documentElement||i===a.scrollingElement,s=o?0:i.getBoundingClientRect().top;e.getBoundingClientRect().top-s>=0||(o&&typeof window.scrollBy==`function`?window.scrollBy(0,r):i.scrollTop+=r)}function Or(){try{let e=T.value;if(!e)return;let t=e.getBoundingClientRect().height,n=hr();if(n!=null&&n>0){let r=Hn(n,!0,{allowBelowEstimatedFloor:!U.value&&I.value&&gr()}),i=jn();e.style.minHeight=i==null?`0px`:`${i}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,Dr(e,t,r);return}let r=jn();r!=null&&(e.style.minHeight=`${r}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,Dr(e,t,r))}catch{}}function kr(){for(var e,t;At.length>0;)try{(t=(e=At.pop())?.dispose)==null||t.call(e)}catch{}Ue!=null&&(pe(Ue),Ue=null),We!=null&&(pe(We),We=null),Ge!=null&&(pe(Ge),Ge=null),Ke=0,qe=!1}function Ar(){for(var e;jt.length>0;)try{(e=jt.pop())==null||e()}catch{}}function X(e=!1){N.value||(k.value?Or():function(e={}){try{let t=T.value;if(!t)return;let n=t.getBoundingClientRect().height,r=Kr(),i=Math.ceil(t.getBoundingClientRect?.call(t).height||0),a=Number.parseFloat(t.style.height||``),o=i>0?i:Number.isFinite(a)&&a>0?Math.ceil(a):0,s=U.value?function(){var e,t;if(Vr())return null;try{let n=H(),r=(n?.getOriginalEditor)?.call(n),i=(n?.getModifiedEditor)?.call(n);if(!r||!i)return null;let a=((e=r.getModel?.call(r))?.getLineCount)?.call(e)||1,o=((t=i.getModel?.call(i))?.getLineCount)?.call(t)||1,s=Math.max(a,o),c=Math.max(Kn(r),Kn(i)),l=Math.max(qn(r),qn(i)),u=Math.max(r.getContentHeight?.call(r)??0,i.getContentHeight?.call(i)??0);return Math.ceil(Math.max(u,s*c+l+0))}catch{return null}}():null,c=U.value&&vr(t),l=U.value&&Lr(t),u=U.value&&t.classList.contains(`stream-monaco-diff-native-stale`),d=c&&I.value&&K.value&&!sn.value;if(c||(R.value=null),Ze>0&&(Ze--,Ye.value!=null))return void Dr(t,n,Nr(t,Ye.value,r,{allowBelowEstimatedFloor:d,preserveScrollableOverflow:Fr(t)}));if(U.value&&!l&&!c&&sn.value){let e=Sr();if(e!=null){let i=Nr(t,e,r,{allowBelowEstimatedFloor:!0});Z(!0),Dr(t,n,i);return}}let f=U.value&&!0===e.preferModelDiffHeight,p=U.value?_r(t):null,h=p,g=!U.value&&I.value&&gr(),_=U.value&&!1!==m.loading&&(h!=null||s!=null&&i>0&&s0&&s0&&s0?o:null:s;else v=hr();if(U.value&&!1===m.loading&&u&&!d&&v!=null&&s!=null&&(v=Math.min(v,s)),U.value&&v!=null&&o>0&&(!1!==m.loading||!1===m.loading&&u&&!d||!0===e.holdCurrentDiffHeight&&!d)&&(v=Math.max(v,o)),v!=null&&v>0){let e=c&&R.value!=null,a=c&&i>0&&i=r-1,o=Nr(t,e?Math.max(R.value,v):a?i:v,r,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:d||g||_,preserveScrollableOverflow:Fr(t)});c&&o0?s:0);if(te>0){let e=c&&R.value!=null,a=c&&i>0&&i=r-1,o=Nr(t,e?Math.max(R.value,te):a?i:te,r,{allowBelowEstimatedFloor:d});c&&o0?Dr(t,n,Nr(t,b,r,{allowBelowEstimatedFloor:d})):U.value||Dr(t,n,Nr(t,r,r))}catch{}}(typeof e==`object`?e:{}))}function jr(){wr=0,Tr=0}function Z(e=!1){if(N.value)return;let t=T.value;if(!t)return;let n=U.value?H():V();if(n&&typeof n.layout==`function`)try{let r=t.getBoundingClientRect?.call(t),i=Math.ceil((r?.width??0)||t.clientWidth||0),a=Math.ceil((r?.height??0)||t.clientHeight||Number.parseFloat(t.style.height||``)||0);if(i>0&&a>0){if(!e&&i===wr&&a===Tr)return;wr=i,Tr=a,n.layout({width:i,height:a})}else jr(),n.layout()}catch{}}function Q(){if(!U.value)return void Ar();let e=T.value;if(!e)return void Ar();let t=e.querySelector(`.monaco-diff-editor`);if(!t||t.classList.contains(`side-by-side`))return void Ar();let n=Array.from(t.querySelectorAll(`.editor.original .diff-hidden-lines`)),r=Array.from(t.querySelectorAll(`.editor.modified .diff-hidden-lines`)),i=Math.min(n.length,r.length);for(let e=0;e div:first-child`),a=t.querySelector(`.center`);if(!n||!i||!a||a.querySelector(`.markstream-inline-fold-proxy`))continue;let o=document.createElement(`button`);o.type=`button`,o.className=`markstream-inline-fold-proxy`,o.dataset.markstreamInlineFoldProxy=`true`;let s=n.getAttribute(`title`)||`Show Unchanged Region`;o.title=s,o.setAttribute(`aria-label`,s);let c=e=>{e.preventDefault(),e.stopPropagation()},l=e=>{e.preventDefault(),e.stopPropagation(),n.click(),w(()=>$())},u=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.stopPropagation(),n.click(),w(()=>$()))};o.addEventListener(`mousedown`,c),o.addEventListener(`click`,l),o.addEventListener(`keydown`,u),a.appendChild(o),jt.push(()=>{o.removeEventListener(`mousedown`,c),o.removeEventListener(`click`,l),o.removeEventListener(`keydown`,u),o.parentElement===a&&a.removeChild(o)})}}function $(e=!1){if(L||Ue!=null)return;let t=()=>{L||(Q(),X(e),Z())};Ue=w(()=>{Ue=null,t(),We=w(()=>{We=null,t()})}),Mr()}function Mr(e=!1){if(!U.value||L||!e&&!1===m.loading||(qe||=e,Ke=Math.max(Ke,e?18:6),Ge!=null))return;let t=()=>{if(Ge=null,!U.value||L||Ke<=0||!qe&&!1===m.loading)return Ke=0,void(qe=!1);Ke--,Q(),X({preferModelDiffHeight:!0,holdCurrentDiffHeight:qe}),Z(),Ke>0?Ge=w(t):qe=!1};Ge=w(t)}function Nr(e,t,n,r={}){let i=U.value&&!1!==m.loading?_r(e):null,a=i!=null&&i>t+1?i:t,o=Math.min(a,n),s=!0===r.allowBelowEstimatedFloor||Vn(),c=Hn(o,!0===r.clearEstimatedFloor,{allowBelowEstimatedFloor:s}),l=jn();if(e.style.minHeight=l==null||s?`0px`:`${Math.min(l,Math.ceil(n))}px`,e.style.height=`${c}px`,e.style.maxHeight=`${Math.ceil(n)}px`,U.value)e.style.overflow=`hidden`;else{let i=!0===r.preserveScrollableOverflow||t>n+1;e.style.overflow=i?`auto`:`hidden`}return c}function Pr(e,t=0){let n=Math.ceil(e.getBoundingClientRect?.call(e).height||0),r=Math.max(t,e.clientHeight||0,n);return r>0&&e.scrollHeight>r+1}function Fr(e){return!U.value&&(Qe||Pr(e,Ye.value??0))}function Ir(e){var t,n,r,i;if(!U.value)return;let a=k.value||!vr(e)||e.getBoundingClientRect().height>=Kr()-1;if(Xe===a)return;Xe=a;let o=j(A({},m.monacoOptions?.scrollbar??{}),{handleMouseWheel:a}),s=H();try{(n=(t=(s?.getOriginalEditor)?.call(s))?.updateOptions)==null||n.call(t,{scrollbar:o}),(i=(r=(s?.getModifiedEditor)?.call(s))?.updateOptions)==null||i.call(r,{scrollbar:o})}catch{}}function Lr(e=T.value){return!!Vr(e)||!!e?.querySelector(`.monaco-diff-editor .view-lines .view-line`)}function Rr(e=T.value){return!!Vr(e)||!!e?.querySelector(`.monaco-editor .view-lines .view-line`)}function zr(){var e;if(Vr())return!0;let t=((e=V())?.getModel)?.call(e);return typeof t?.getValue==`function`&&t.getValue()===pn.value}function Br(e=T.value){return!!Vr(e)||!!e?.classList.contains(`stream-monaco-diff-root`)&&!(nn.value&&!e.classList.contains(`stream-monaco-diff-inline`))}function Vr(e=T.value){return!!e?.querySelector(`diffs-container`)}function Hr(e){return!1!==m.loading||K.value||e.classList.contains(`stream-monaco-diff-native-stale`)||vr(e)}function Ur(){let e=H();return typeof e?.getOriginalEditor==`function`||typeof e?.getModifiedEditor==`function`||typeof e?.getLineChanges==`function`}function Wr(){return M(this,arguments,function*(t={}){if(!U.value)return!0;if(Vr())return yield e(),yield Un(),Vr();let n=!1!==t.requireHighlight,r=0,i=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``)),a=Xn(i.original,i.updated),o=a.added>0||a.removed>0,s=()=>{let e=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``));e.original===i.original&&e.updated===i.updated||(i=e,a=Xn(i.original,i.updated),o=a.added>0||a.removed>0)};for(let t=0;t<30;t++){if(L)return!1;s();let t=T.value,i=H(),c=cr(),l=!1;try{let e=(i?.getLineChanges)?.call(i);l=Array.isArray(e)&&(!o||e.length>0)}catch{l=!1}let u=!!t?.querySelector(`.monaco-diff-editor`),d=Lr(t),f=!o||Qn(t,a),p=!o||tr(t,a),m=!c||nr(t);if(u&&d&&l&&f&&p&&m&&Zn(t)){try{Bt(),Q(),ur(),$()}catch{}if(yield e(),yield Un(),L)return!1;let t=T.value,i=!cr()||nr(t),s=!o||Qn(t,a),c=!o||tr(t,a),l=ir(t,o),u=or(t,a),d=!n||sr(t),f=Br(t)&&i&&rr(t)&&s&&c&&l&&u&&d,p=Br(t)&&i&&rr(t)&&s&&c&&Zn(t)&&d;if(f||p){if(r++,r>=2)return!0}else r=0}yield e(),yield Un()}return L||(Bt(),Q(),ur(),$(),s()),!1})}function Gr(t,n,r){return M(this,null,function*(){try{yield _t(t,n,r);return}catch(e){if(!zt(e))throw e}if(yield e(),yield Un(),!L&&U.value)try{yield _t(t,n,r)}catch(e){if(!zt(e))throw e}})}function Kr(){let e=m.monacoOptions?.MAX_HEIGHT??500;if(typeof e==`number`)return e;let t=String(e).match(/^(\d+(?:\.\d+)?)/);return t?Number.parseFloat(t[1]):500}let qr=v(()=>m.isShowPreview&&(D.value===`html`||D.value===`svg`));function Jr(){return typeof m.node.loading==`boolean`?m.node.loading:!0===m.loading}function Yr(){if(!Jr())return!0;let e=String(m.node.raw??``),t=e.split(/\r\n|\n|\r/,1)[0]?.trimStart()??``;return!/^(?:`{3,}|~{3,})/.test(t)||/\r\n|\n|\r/.test(e)}function Xr(e,t,n){return!n||Yr()&&String(t??``)?ve(String(e??``)):`plain`}function Zr(){return Jr()}let Qr=null,$r=!1,ei=0;function ti(){Qr=null,ei++}function ni(){return M(this,arguments,function*(t=ei){if(!$r){$r=!0;try{for(;Qr&&!L&&!U.value&&t===ei;){let t=Qr;Qr=null;try{yield Promise.resolve(gt(t.code,t.language)),yield e(),L||U.value||(X(!1),Z())}catch{}}}finally{$r=!1,!Qr||L||U.value||ni()}}})}function ri(e,t){Qr={code:e,language:t},ni(ei)}t(()=>[m.node.language,m.node.code,m.node.raw,m.node.loading,m.loading],([e,t,n,r,i])=>{D.value=Xr(e,t,typeof r==`boolean`?r:!0===i)}),t(()=>[m.node.originalCode,m.node.updatedCode,U.value],()=>{R.value=null,lr(),w(()=>ur())},{immediate:!0});let ii=0;t(()=>[m.node.originalCode,m.node.updatedCode,O.value,U.value,m.stream],t=>M(null,[t],function*([,,,t,n]){let r=++ii;if(!t||Jr()||!1===n&&!P.value)return;if(!1!==n&&B&&!P.value&&T.value)try{yield vi(T.value)}catch{}let i=wt;if(i&&!F.value){try{yield i}catch{}if(L||!U.value||r!==ii)return}if(r!==ii)return;let a=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``)),o=!1===m.loading;o&&ki();try{if(yield Gr(a.original,a.updated,O.value),L||!U.value||r!==ii)return;yield e(),Z(!0),Q(),X(!1===m.loading||{preferModelDiffHeight:!0}),Z(!0),$(!0)}catch{return}if(o){if(L||!U.value)return;Bt(),Q(),ur(),$(),Mr(!0)}k.value&&w(()=>Or())})),t(()=>m.node.code,e=>M(null,null,function*(){if(Jr()||!1===m.stream||(D.value||=ve(Et(e)),U.value))return;let t=wt;if(t&&!F.value){try{yield t}catch{}if(L||U.value)return}if(B&&!P.value&&T.value)try{yield vi(T.value)}catch{}ri(Rt(m.node.code),O.value),k.value&&w(()=>Or())}));let ai=v(()=>{let e=D.value;return e?_e[e]||e.charAt(0).toUpperCase()+e.slice(1):_e[``]||`Plain Text`}),oi=v(()=>de(String(m.node.raw??``),ai.value,U.value)),si=v(()=>oi.value.title),ci=v(()=>oi.value.caption),li=v(()=>(fe.value,function(e,t){if(t===void 0)return De(e);if(t){let n=t(e);if(n!=null&&n!==``)return n}return he(ve(e))||le()}(D.value||``,be))),ui=v(()=>{let e={};e[`--markstream-code-layout-character-width`]=_n.value==null?`1ch`:`${_n.value}px`;let t=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},n=t(m.minWidth),r=t(m.maxWidth);if(n&&(e.minWidth=n),r&&(e.maxWidth=r),Fn.value&&!U.value&&!N.value){let t=In.value;t!=null&&(e.minHeight=`${t}px`)}return U.value||(e.color=`var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))`,e.backgroundColor=`var(--vscode-editor-background, var(--markstream-code-fallback-bg))`,e.borderColor=`var(--markstream-code-border-color)`),e}),di=v(()=>!1!==m.showTooltips);function fi(){return M(this,null,function*(){try{typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(m.node.code)),ze.value=!0,te(`copy`,m.node.code),setTimeout(()=>{ze.value=!1},1e3)}catch(e){console.error(`复制失败:`,e)}})}function pi(){k.value=!k.value;let e=U.value?H():V(),t=T.value;e&&t&&(k.value?(gi(!0),t.style.maxHeight=`none`,t.style.overflow=`visible`,X(!0)):(gi(!1),t.style.overflow=U.value?`hidden`:`auto`,X(!0)),Ir(t))}function mi(){var t;if(N.value=!N.value,N.value){if(Qe=!1,T.value){let e=Math.ceil((t=T.value).getBoundingClientRect?.call(t).height||0);Qe=!U.value&&(Pr(T.value,e)||T.value.style.overflow===`auto`||T.value.style.overflowY===`auto`),e>0&&(Ye.value=e)}gi(!1)}else k.value&&gi(!0),T.value&&Ye.value!=null&&(T.value.style.height=`${Ye.value}px`),Ze=2,e(()=>{N.value||L||(X(!0),Z(!0))})}function hi(){if(!qr.value)return;let e=D.value;if(Ie.value){let t=e===`html`?`text/html`:`image/svg+xml`,n=e===`html`?Le(`artifacts.htmlPreviewTitle`)||`HTML Preview`:Le(`artifacts.svgPreviewTitle`)||`SVG Preview`;te(`previewCode`,{node:m.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`});return}e===`html`&&(fn.value=!fn.value)}function gi(e){var t,n;try{if(U.value){let n=H();(t=n?.updateOptions)==null||t.call(n,{automaticLayout:e})}else{let t=V();(n=t?.updateOptions)==null||n.call(t,{automaticLayout:e})}}catch{}}function _i(t){return M(this,null,function*(){if(!B||L)return;let n=Wt.value;if(en=!1,q.value=!1,qt.value=null,F.value=!1,K.value=!1,Kt.value=!1,Xe=null,hn.value=null,gn.value=null,_n.value=null,function(){let e=function(){let e=T.value?.parentElement;return e instanceof HTMLElement?e:null}();e&&(e.style.removeProperty(`--stream-monaco-line-number-left`),e.style.removeProperty(`--stream-monaco-line-number-width`),e.style.removeProperty(`--stream-monaco-line-number-gap-to-code`),e.style.removeProperty(`--stream-monaco-original-line-number-gap-to-code`),e.style.removeProperty(`--stream-monaco-modified-line-number-gap-to-code`),e.style.removeProperty(`--stream-monaco-original-scrollable-left`),e.style.removeProperty(`--stream-monaco-modified-scrollable-left`))}(),jr(),function(){Xt.value=!1;let e=On.value;An.value=I.value||e==null?null:e}(),kr(),Ar(),function(e){e.replaceChildren()}(t),ki(),L)return;let r=M(null,null,function*(){if(n===`diff`){(function(){if(Ot||typeof window>`u`)return;Ot=!0;let e=e=>{zt(`reason`in e?e.reason:e.error??e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener(`error`,e,!0),window.addEventListener(`unhandledrejection`,e,!0),kt=()=>{window.removeEventListener(`error`,e,!0),window.removeEventListener(`unhandledrejection`,e,!0),Ot=!1,kt=null}})(),bt();let e=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``));ht?yield Pe(()=>ht(t,e.original,e.updated,O.value)):yield Pe(()=>B(t,m.node.code,O.value))}else yield Pe(()=>B(t,pn.value,O.value));F.value=!0}).finally(()=>{wt===r&&(wt=null)});if(wt=r,yield function(t){return M(this,null,function*(){if(!U.value)return void(yield t);let n,r=!1;for(t.then(()=>{r=!0},e=>{r=!0,n=e});;){if(L)return;if(r){if(n)throw n;return}if(Lr()&&Ur())return;yield e(),yield Un()}})}(r),L||Wt.value!==n)return;F.value=!0;let i=n===`diff`?H():V();if(typeof m.monacoOptions?.fontSize==`number`)i?.updateOptions({fontSize:m.monacoOptions.fontSize,automaticLayout:!1}),J.value=m.monacoOptions.fontSize,Y.value=m.monacoOptions.fontSize;else if(!xr()){let e=Gn();e&&e>0?(J.value=e,Y.value=e):(J.value=12,Y.value=12)}br(),yield Ti(),k.value||N.value||X(!1),I.value=!0,Gt.value=n,function(){if(kr(),U.value){let e=H(),t=(e?.getOriginalEditor)?.call(e),n=(e?.getModifiedEditor)?.call(e),r=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>$());r&&At.push(r)}catch{}};try{let t=(e?.onDidUpdateDiff)?.call(e,()=>{$(),w(()=>ur())});t&&At.push(t)}catch{}r(t,`onDidContentSizeChange`),r(n,`onDidContentSizeChange`);let i=T.value;if(i&&typeof MutationObserver<`u`){let e=[`.view-line`,`.view-lines`,`.view-zones`,`.margin-view-zones`,`.diff-hidden-lines`,`.stream-monaco-diff-unchanged-bridge`,`.stream-monaco-fallback-inline-delete-zone`,`.stream-monaco-fallback-inline-delete-margin`].join(`,`),t=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!(n?.closest)?.call(n,e)},n=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!((n?.closest)?.call(n,e)||(n?.querySelector)?.call(n,e))},r=new MutationObserver(e=>{U.value&&Hr(i)&&e.some(e=>t(e.target)||Array.from(e.addedNodes).some(n)||Array.from(e.removedNodes).some(t))&&(Q(),X({preferModelDiffHeight:!0}),Z(),Mr())});r.observe(i,{attributeFilter:[`class`],attributes:!0,childList:!0,characterData:!0,subtree:!0}),At.push({dispose:()=>r.disconnect()})}if(i){let e=e=>{if(!(e.target instanceof Element?e.target:null)?.closest([`.stream-monaco-unchanged-summary`,`.stream-monaco-unchanged-reveal`,`.stream-monaco-unchanged-expand`,`.markstream-inline-fold-proxy`,`.diff-hidden-lines .center`].join(`,`)))return;let t=Math.ceil(i.getBoundingClientRect().height||0);t>0&&(R.value=t)};i.addEventListener(`click`,e,!0),At.push({dispose:()=>i.removeEventListener(`click`,e,!0)})}if(i&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{if(!U.value||(Z(),!Hr(i)))return;let e=_r(i);if(e==null)return;let t=Math.ceil(i.getBoundingClientRect().height||0),n=R.value;if(vr(i)&&n!=null){if(t>n+1)R.value=t;else if(te.disconnect()})}return}let e=V();try{let t=(e?.onDidContentSizeChange)?.call(e,()=>$());t&&At.push(t)}catch{}try{let t=(e?.onDidLayoutChange)?.call(e,()=>$());t&&At.push(t)}catch{}}(),Cr(),br(),Q(),ur(),$(),yield e();let a=null;St&&(a=yield St(),a&&(yield e(),yield Un()));let o=a??(n===`diff`?yield Wr({requireHighlight:!0}):yield function(){return M(this,null,function*(){if(Vr())return yield e(),yield Un(),Vr();for(let t=0;t<30;t++){if(L||U.value)return!1;let t=T.value,n=zr(),r=Rr(t),i=!pn.value.trim()||sr(t);if(n&&r&&i&&(yield e(),yield Un(),!L&&!U.value&&zr()&&Rr(T.value)&&(!pn.value.trim()||sr(T.value))))return!0;yield e(),yield Un()}return!1})}());L||(o?(br(),Bn(),(yield zn())||Ii()):Ii())})}function vi(t,n={}){if(!B||L||!1===m.stream&&!1!==m.loading||(Pi(),Fi())||G.value||T.value!==t||Zr())return null;if(Ct)return Ct;if(P.value&&I.value)return Promise.resolve();let r=Mi(),i=Jt.value,a=!1;P.value=!0,function(){let e=Te.value;C&&e&&Je!==e&&(Je&&C.markSettled(Je),Je=e,C.markPending(e))}();let o=M(null,null,function*(){try{yield _i(t),Zt=null}catch(e){let t=Mi(),o=i!==Jt.value,s=!1!==n.allowStaleContentRetry&&o&&Zt!==t;if(r!==t||s)return s&&(Zt=t),a=!0,P.value=!1,I.value=!1,F.value=!1,void(K.value=!1);throw Ii(r),e}}).finally(()=>{Ct===o&&(Ct=null),function(){let t=Je;C&&t&&(Je=``,e(()=>{if(!L){let e=E.value?.offsetHeight??0;e>0&&C.reportHeight(t,e)}C.markSettled(t)}))}(),a&&!L&&queueMicrotask(()=>{var e;let t=T.value;t&&!L&&((e=vi(t))==null||e.catch(e=>{I.value=!1,K.value=!1,Ii()}))})});return Ct=o,o}t(di,e=>{e||Ee()}),t(()=>Y.value,(e,t)=>{let n=U.value?H():V();n&&typeof e==`number`&&Number.isFinite(e)&&e>0&&(n.updateOptions({fontSize:e}),N.value||X(!0))},{flush:`post`,immediate:!1});let yi=0,bi=t(()=>[T.value,U.value,m.stream,m.loading,He.value,z.value,m.node.language,m.node.raw,m.node.code,m.node.loading],e=>M(null,[e],function*([e,t,n,r,i,a]){let o=++yi;if(!e||!a||Jr()||Qt||!1===n&&!1!==r||!B&&(yield function(){return M(this,null,function*(){if(typeof window>`u`||L||He.value||G.value)return;if(Tt)return Tt;let e=M(null,null,function*(){try{let e=yield Re();if(L)return;if(!e)return void(G.value=!0);let t=e.useMonaco,n=e.detectLanguage;if(typeof n==`function`&&(Et=n),typeof t!=`function`)return;Mt=Oi();let r=t(Mt);B=r.createEditor||B,ht=r.createDiffEditor||ht,gt=r.updateCode||gt,_t=r.updateDiff||_t,vt=r.getEditor||vt,V=r.getEditorView||V,H=r.getDiffEditorView||H,yt=r.cleanupEditor||yt,bt=r.safeClean||r.cleanupEditor||bt,xt=r.refreshDiffPresentation||xt,Dt=r.setTheme||Dt,St=r.whenVisualReady||null,He.value=!0}catch{if(L)return;G.value=!0}}).finally(()=>{Tt===e&&(Tt=null)});return Tt=e,e})}(),o!==yi||!1===m.stream&&!1!==m.loading||Zr()||!z.value||!B||G.value||P.value||Fi()||L||T.value!==e)||Zr())return;let s=vi(e);if(s){try{yield s}catch{I.value=!1,K.value=!1,Ii()}I.value&&K.value&&bi()}}));function xi(e){return!!e&&typeof e==`object`&&`light`in e&&`dark`in e}function Si(e){return typeof e==`string`?e:e&&typeof e==`object`&&`name`in e?String(e.name):null}function Ci(e,t){if(e===t)return!0;let n=Si(e),r=Si(t);return!!n&&n===r}function wi(){let e=function(){if(m.theme!==void 0){let e=m.theme;return xi(e)?m.isDark?e.dark:e.light:e}return m.isDark?m.darkTheme:m.lightTheme}(),t=W.value?.theme,n=e??t;if(typeof n==`object`&&n)return n;let r=Array.isArray(m.themes)?m.themes:[];if(!r.length||n==null)return n;let i=Si(n),a=r.map(e=>Si(e)).filter(e=>!!e);if(!i||a.includes(i))return n;let o=Si(t);return t!=null&&o&&a.includes(o)?t:r[0]}function Ti(){return M(this,arguments,function*(e={}){ki();let t=()=>{U.value&&Bt(),w(()=>{Cr(),$()})};if(e.appearanceOnly)return void t();let n=wi();if(n)try{yield Dt(n),t()}catch{}else t()})}function Ei(e,t){if(typeof t!=`string`)return;let n=ve(t),r=ye(n),i=[`plain`,`objectivec`,`objectivecpp`].includes(n)?r:n;for(let t of[i,r])t&&!e.includes(t)&&e.push(t)}t(Wt,(t,n)=>M(null,null,function*(){if(t===n||q.value||Qt||(ti(),!B||!T.value)||!P.value||!1===m.stream&&!1!==m.loading||!z.value)return;let r=Ct;if(r){try{yield r}catch{}if(L||!T.value)return}if(Gt.value!==t||!P.value||!I.value)try{I.value=!1,K.value=!1,P.value=!1,F.value=!1,kr(),Ar(),bt(),yield e(),yield vi(T.value)}catch{I.value=!1,K.value=!1,Ii()}}));let Di=v(()=>{let e=[],t=W.value?.languages;if(Array.isArray(t))for(let n of t)Ei(e,n);return Yr()&&Ei(e,m.node.language),Ei(e,D.value),Ei(e,O.value),Ei(e,`plaintext`),e});function Oi(){let e=j(A(j(A({wordWrap:`on`,wrappingIndent:`same`,themes:m.themes},W.value||{}),{languages:Di.value,stream:!1,fontSize:yn.value,lineHeight:xn.value,theme:wi(),disableFileHeader:!0}),U.value?{diffAppearance:Ht.value}:{}),{onThemeChange(){Cr()}}),t=function(){let e=W.value?.fontFamily;return typeof e==`string`&&e.trim()?e.trim():U.value?function(){if(typeof window>`u`)return;let e=E.value?.querySelector(`pre.code-pre-fallback`);if(e)return window.getComputedStyle(e).fontFamily.trim()||void 0}():void 0}();if(t&&(e.fontFamily??=t),U.value){e.wordWrap=tn.value?`on`:`off`;let t=typeof e.unsafeCSS==`string`?`${e.unsafeCSS}\n`:``,n=function(){let e=rn.value;if(!1===e||typeof e==`object`&&!1===e.enabled)return null;let t=typeof e==`object`?e:ue,n=Math.max(0,Math.floor(t.contextLineCount??2));return{contextLineCount:n,collapsedContextThreshold:n+Math.max(1,Math.floor(t.minimumLineCount??4))-1}}();e.unsafeCSS=`${t}\npre { column-gap: 0; }\npre > code { column-gap: 0; padding-block: 0; }\n[data-separator="line-info"] { margin-top: 0; }\n`,n?(e.parseDiffOptions=j(A({},e.parseDiffOptions),{context:n.contextLineCount}),e.collapsedContextThreshold=n.collapsedContextThreshold,e.expandUnchanged=!1,e.hunkSeparators=`line-info`,e.unsafeCSS+=`[data-separator="line-info"][data-separator-last] { height: 28px; } +import{A as e,G as t,I as n,J as r,N as i,O as a,P as o,S as s,T as c,U as l,_ as u,b as d,c as f,d as p,f as m,g as h,h as g,j as _,lt as ee,m as v,n as te,nt as y,ot as b,q as ne,rt as re,st as ie,u as ae,ut as x,v as S,w as C,y as oe,z as se}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{t as ce}from"./preload-helper-zJ_50EbN.js";import{$ as le,A as ue,D as de,J as fe,M as pe,O as me,Q as he,T as ge,X as _e,Y as ve,Z as ye,_ as be,a as xe,d as Se,et as Ce,g as we,h as Te,j as w,n as Ee,nt as De,o as Oe,p as ke,s as Ae,tt as je,v as Me,x as Ne}from"./index-CJN6blp7.js";var Pe=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Fe=!1,Ie=null,Le=null,T=null;function Re(){return Pe(this,null,function*(){if(T)return T;T=Pe(null,null,function*(){if(!Le)try{if(Le=function(e){let t=e;if(typeof t?.useMonaco==`function`)return t;let n=e?.default;return typeof n?.useMonaco==`function`?n:null}(yield ce(()=>import(`./dist-BlrGujvY.js`),__vite__mapDeps([0,1]))),!Le)return null}catch{return null}try{return yield function(e){return Pe(this,null,function*(){if(!Fe)return Ie||(Ie=Pe(null,null,function*(){let t=globalThis==null?void 0:globalThis.MonacoEnvironment;t&&(typeof t.getWorker==`function`||typeof t.getWorkerUrl==`function`)||typeof e?.preloadMonacoWorkers!=`function`||(yield e.preloadMonacoWorkers()),Fe=!0}).finally(()=>{Ie=null}),Ie)})}(Le),je(),Le}catch{return null}});try{return yield T}finally{T=null}})}var E=Object.defineProperty,ze=Object.defineProperties,D=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||={})O.call(t,n)&&k(e,n,t[n]);if(Be)for(var n of Be(t))Ve.call(t,n)&&k(e,n,t[n]);return e},j=(e,t)=>ze(e,D(t)),M=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),N={key:0,class:`code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]`},P={class:`flex items-center gap-0.5`},F=[`aria-label`],I={class:`code-diff-stat removed`},He={class:`code-diff-stat added`},L=[`aria-label`],Ue={key:0,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},We={key:1,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Ge=[`aria-pressed`],Ke={key:3,class:`relative`},qe=[`aria-expanded`],Je=[`disabled`],Ye=[`disabled`],R=[`disabled`],Xe={key:0,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Ze={key:1,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Qe={class:`code-loading-placeholder`},$e={class:`sr-only`,"aria-live":`polite`,role:`status`},et=C({__name:`CodeBlockShell`,props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:[`toggleCollapse`,`decreaseFont`,`resetFont`,`increaseFont`,`copy`,`toggleExpand`,`preview`],setup(e,{emit:t}){let i=e,a=t,o=y(!1),c=y(null),l=y(null);function m(){Ee(!0),o.value=!o.value,o.value&&document.addEventListener(`click`,_,{once:!0,capture:!0})}function h(){Ee(!0),o.value=!1}function _(e){let t=e.target;c.value?.contains(t)||l.value?.contains(t)?document.addEventListener(`click`,_,{once:!0,capture:!0}):h()}let re=v(()=>i.showFontSizeButtons&&i.enableFontSizeControl||i.showExpandButton||i.isPreviewable&&i.showPreviewButton),{t:C}=xe(),oe=v(()=>!1!==i.showTooltips);function ce(e,t){oe.value&&Te(e.currentTarget,t,`top`,!1,void 0,i.isDark)}function le(){oe.value&&Ee()}function ue(e){ce(e,i.copyText?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`)}let de=v(()=>!!Number.isFinite(i.codeFontSize)&&(i.codeFontSize??0)<=(i.codeFontMin??0)),fe=v(()=>!i.fontBaselineReady||i.codeFontSize===i.defaultCodeFontSize),pe=v(()=>!!Number.isFinite(i.codeFontSize)&&(i.codeFontSize??0)>=(i.codeFontMax??100));return(t,_)=>(n(),S(p,null,[i.showHeader?(n(),S(`div`,N,[se(t.$slots,`header-left`),se(t.$slots,`header-right`,{},()=>[g(`div`,P,[e.diffStats?(n(),S(`div`,{key:0,class:`code-diff-stats`,"aria-label":e.diffStatsAriaLabel},[g(`span`,I,`-`+x(e.diffStats.removed),1),g(`span`,He,`+`+x(e.diffStats.added),1)],8,F)):u(``,!0),i.showCopyButton?(n(),S(`button`,{key:1,type:`button`,class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,"aria-label":e.copyText?b(C)(`common.copied`)||`Copied`:b(C)(`common.copy`)||`Copy`,onClick:_[0]||=e=>a(`copy`),onMouseenter:_[1]||=e=>ue(e),onFocus:_[2]||=e=>ue(e),onMouseleave:le,onBlur:le},[e.copyText?(n(),S(`svg`,We,[..._[14]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M20 6L9 17l-5-5`},null,-1)]])):(n(),S(`svg`,Ue,[..._[13]||=[g(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[g(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),g(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})],-1)]]))],40,L)):u(``,!0),i.showCollapseButton?(n(),S(`button`,{key:2,type:`button`,class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,"aria-pressed":e.isCollapsed,onClick:_[3]||=e=>a(`toggleCollapse`),onMouseenter:_[4]||=t=>ce(t,e.isCollapsed?b(C)(`common.expand`)||`Expand`:b(C)(`common.collapse`)||`Collapse`),onFocus:_[5]||=t=>ce(t,e.isCollapsed?b(C)(`common.expand`)||`Expand`:b(C)(`common.collapse`)||`Collapse`),onMouseleave:le,onBlur:le},[(n(),S(`svg`,{style:ee({rotate:e.isCollapsed?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[..._[15]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m9 18l6-6l-6-6`},null,-1)]],4))],40,Ge)):u(``,!0),re.value?(n(),S(`div`,Ke,[g(`button`,{ref_key:`moreBtnRef`,ref:l,type:`button`,class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors`,"aria-expanded":o.value,"aria-haspopup":`true`,onClick:ae(m,[`stop`]),onMouseenter:_[6]||=e=>ce(e,b(C)(`common.more`)||`More`),onFocus:_[7]||=e=>ce(e,b(C)(`common.more`)||`More`),onMouseleave:le,onBlur:le},[..._[16]||=[d(``,1)]],40,qe),s(te,{name:`code-menu`},{default:ne(()=>[o.value?(n(),S(`div`,{key:0,ref_key:`moreMenuRef`,ref:c,class:`code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]`,role:`menu`},[i.showFontSizeButtons&&i.enableFontSizeControl?(n(),S(p,{key:0},[g(`button`,{type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,disabled:de.value,onClick:_[8]||=e=>{b(Ee)(!0),a(`decreaseFont`)}},[_[17]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14`})],-1),g(`span`,null,x(b(C)(`common.fontSmaller`)||`Font size −`),1)],8,Je),g(`button`,{type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,disabled:fe.value,onClick:_[9]||=e=>{b(Ee)(!0),a(`resetFont`)}},[_[18]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[g(`path`,{d:`M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8`}),g(`path`,{d:`M3 3v5h5`})])],-1),g(`span`,null,x(b(C)(`common.fontReset`)||`Font size reset`),1)],8,Ye),g(`button`,{type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,disabled:pe.value,onClick:_[10]||=e=>{b(Ee)(!0),a(`increaseFont`)}},[_[19]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14m-7-7v14`})],-1),g(`span`,null,x(b(C)(`common.fontLarger`)||`Font size +`),1)],8,R)],64)):u(``,!0),i.showExpandButton?(n(),S(`button`,{key:1,type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors`,onClick:_[11]||=e=>{h(),a(`toggleExpand`)}},[e.isExpanded?(n(),S(`svg`,Xe,[..._[20]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`},null,-1)]])):(n(),S(`svg`,Ze,[..._[21]||=[g(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`},null,-1)]])),g(`span`,null,x(e.isExpanded?b(C)(`common.collapse`)||`Collapse`:b(C)(`common.expand`)||`Expand`),1)])):u(``,!0),e.isPreviewable&&i.showPreviewButton?(n(),S(`button`,{key:2,type:`button`,role:`menuitem`,class:`flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors`,onClick:_[12]||=e=>{h(),a(`preview`)}},[_[22]||=g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[g(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[g(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),g(`circle`,{cx:`12`,cy:`12`,r:`3`})])],-1),g(`span`,null,x(b(C)(`common.preview`)||`Preview`),1)])):u(``,!0)],512)):u(``,!0)]),_:1})])):u(``,!0)])])])):u(``,!0),r(g(`div`,{class:ie([`code-block-shell-content`,{"code-block-shell-content--collapsed":e.isCollapsed}])},[se(t.$slots,`default`)],2),[[f,!!e.stream||!e.loading]]),r(g(`div`,Qe,[se(t.$slots,`loading`,{},()=>[_[23]||=g(`div`,{class:`loading-skeleton`},[g(`div`,{class:`skeleton-line`}),g(`div`,{class:`skeleton-line`}),g(`div`,{class:`skeleton-line short`})],-1)])],512),[[f,!e.stream&&e.loading]]),g(`span`,$e,x(e.copyText?b(C)(`common.copied`)||`Copied`:``),1)],64))}}),tt={class:`html-preview-frame__header`},nt={class:`html-preview-frame__title`},rt={class:`html-preview-frame__label`},z=[`sandbox`,`srcdoc`],it=be(C({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:r}=xe(),a=v(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`\n\n \n \n \n \n \n \n ${e}\n \n`}),s=v(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function c(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return i(()=>{typeof window<`u`&&window.addEventListener(`keydown`,c)}),o(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,c)}),(e,i)=>(n(),h(m,{to:`body`},[g(`div`,{class:ie([`markstream-vue`,{dark:t.isDark}])},[g(`div`,{class:`html-preview-frame__backdrop`,onClick:i[2]||=e=>t.onClose?.call(t)},[g(`div`,{class:`html-preview-frame`,onClick:i[1]||=ae(()=>{},[`stop`])},[g(`div`,tt,[g(`div`,nt,[i[3]||=g(`span`,{class:`html-preview-frame__dot`},null,-1),g(`span`,rt,x(t.title||b(r)(`common.preview`)||`Preview`),1)]),g(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:i[0]||=e=>t.onClose?.call(t)},` × `)]),g(`iframe`,{class:`html-preview-frame__iframe`,sandbox:s.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,z)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),at=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],ot={class:`code-header-main`},st=[`innerHTML`],ct={class:`code-header-copy`},lt={class:`code-header-title`},ut={key:0,class:`code-header-caption`},dt=[`data-markstream-host-hidden`],ft=`__markstreamMonacoPassiveTouchState__`,pt=be(C({__name:`CodeBlockNode`,props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:`vitesse-dark`},lightTheme:{default:`vitesse-light`},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(d,{emit:p}){let m=d,te=p,ae=l(),C=a(Ce,null),ce=a(`markstreamHostScrollManaged`,null),be=a(ge,void 0),Te=v(()=>Se(m,ae)),je=new Set;function Pe(e){return M(this,null,function*(){if(typeof window>`u`)return yield e();let t=window.Element?.prototype,n=t?.addEventListener;if(!t||!n)return yield e();let r=function(){let e=window,t=e[ft];if(t)return t;let n={depth:0,original:null};return e[ft]=n,n}(),i=null;try{r.depth===0&&(r.original=n,t.addEventListener=function(e,t,i){let a=r.original??n;return e===`touchstart`&&function(e,t){if(!e)return!1;let n=e;return!(typeof n.closest!=`function`||!n.closest(`.monaco-editor, .monaco-diff-editor`)||t&&typeof t==`object`&&`passive`in t)}(this,i)?a.call(this,e,t,function(e){return e==null?{passive:!0}:typeof e==`boolean`?{capture:e,passive:!0}:typeof e==`object`?`passive`in e?e:j(A({},e),{passive:!0}):{passive:!0}}(i)):a.call(this,e,t,i)}),r.depth++;let e=!1;i=()=>{e||(e=!0,je.delete(i),r.depth=Math.max(0,r.depth-1),r.depth===0&&r.original&&t.addEventListener!==r.original&&(t.addEventListener=r.original,r.original=null))},je.add(i)}catch{return yield e()}try{return yield e()}finally{i?.()}})}let Fe=c(),Ie=v(()=>{let e=Fe?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Le}=xe(),T=y(null),E=y(null),ze=y(!1),D=y(Xr(m.node.language,m.node.code,Jr())),Be=v(()=>ye(D.value)),O=v(()=>Be.value===`plaintext`?`text`:Be.value),Ve=v(()=>Be.value===`plaintext`),k=y(!1),N=y(!1),P=y(!1),F=y(!1),I=y(!1),He=y(!1),L=!1,Ue=null,We=null,Ge=null,Ke=0,qe=!1,Je=``,Ye=y(null),R=y(null),Xe=null,Ze=0,Qe=!1,$e=ke(),tt=Ne(),nt=Me(),rt=re(null),z=y(typeof window>`u`||!nt.value),pt=c()?.vnode.el?.textContent??``,mt=y(!(typeof window<`u`&&String(m.node.code??``).length>0&&pt.includes(String(m.node.code))));i(()=>{mt.value=!0}),typeof window<`u`&&t([()=>E.value,nt],([e,t],n,r)=>{var i;if((i=rt.value)==null||i.destroy(),rt.value=null,!t||z.value)return void(z.value=!0);if(!e)return void(z.value=!1);let a=!0,o=$e(e,{rootMargin:tt?.value.heavyBlockMargin??tt?.value.rootMargin??`0px`,allowIdle:!1});rt.value=o,z.value=z.value||o.isVisible.value,o.whenVisible.then(()=>{a&&rt.value===o&&(z.value=!0)}).catch(()=>{}),r(()=>{a=!1,o.destroy(),rt.value===o&&(rt.value=null)})},{immediate:!0}),_(()=>{var e;L=!0;for(let e of Array.from(je))e();(function(){let e=Je;C&&e&&(Je=``,C.markSettled(e))})(),(e=rt.value)==null||e.destroy(),rt.value=null});let B=null,ht=null,gt=()=>{},_t=()=>{},vt=()=>null,V=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),H=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),yt=()=>{},bt=()=>{},xt=()=>{},St=null,Ct=null,wt=null,Tt=null,Et=()=>String(m.node.language??`plaintext`),Dt=()=>M(null,null,function*(){}),Ot=!1,kt=null,At=[],jt=[],Mt=null,U=v(()=>me(m.node)),Nt=y({removed:0,added:0}),Pt=v(()=>`-${Nt.value.removed} +${Nt.value.added}`),Ft=Object.freeze(j(A({},ue),{enabled:!1,revealLineCount:0}));function It(e){var t;return Ae(e,((t=E.value)?.getBoundingClientRect)?.call(t).width||E.value?.clientWidth||(typeof window>`u`?0:window.innerWidth))}function Lt(e,t){return{original:Rt(e),updated:Rt(t)}}function Rt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function zt(e){return String(e?.message??e).includes(`no diff result available`)}function Bt(){if(!Vr())try{let e=xt();e&&typeof e.catch==`function`&&e.catch(e=>{zt(e)})}catch(e){zt(e)}}let W=v(()=>{var e,t;let n=m.monacoOptions?A({},m.monacoOptions):{};if(!U.value)return A({lineDecorationsWidth:0,lineNumbersMinChars:2,glyphMargin:!1},n);let r=n.diffHideUnchangedRegions===void 0?A({},ue):we(n.diffHideUnchangedRegions),i=n.hideUnchangedRegions===void 0?void 0:we(n.hideUnchangedRegions),a=!1!==m.stream&&!1!==m.loading,o=a?A({},Ft):r,s=a?A({},Ft):i,c=function(e){return e.diffWordWrap===void 0?`off`:e.diffWordWrap}(n),l=A({},n.experimental??{}),u=n.diffUnchangedRegionStyle??`line-info`,d=function(e){return A(j(A({},e.scrollbar&&typeof e.scrollbar==`object`?e.scrollbar:{}),{verticalScrollbarSize:0,horizontalScrollbarSize:0}),It(e)?{horizontal:`hidden`}:{})}(n);return j(A(j(A(A({},{maxComputationTime:0,diffAlgorithm:`legacy`,ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:`none`,renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:`off`,matchBrackets:`never`,lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,padding:{top:0,bottom:0},minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffWordWrap:c,renderSideBySide:(e=n.renderSideBySide)==null||e,diffHideUnchangedRegions:o,useInlineViewWhenSpaceIsLimited:(t=n.useInlineViewWhenSpaceIsLimited)!=null&&t,diffLineStyle:`background`,diffAppearance:`auto`,diffUnchangedRegionStyle:u,diffHunkActionsOnHover:!1,experimental:l}),n),{experimental:l}),s===void 0?{}:{hideUnchangedRegions:s}),{diffHideUnchangedRegions:o,diffWordWrap:c,scrollbar:d})}),Vt=v(()=>(m.theme===void 0?Ci(m.darkTheme,m.lightTheme):!xi(m.theme))?function(e){if(e&&typeof e==`object`&&e.colors?.[`editor.background`]){let t=yr(e.colors[`editor.background`]);if(t!=null)return t<128}let t=(Si(e)??``).toLowerCase();return t?[`dark`,`night`,`moon`,`black`,`dracula`,`mocha`,`frappe`,`macchiato`,`palenight`,`ocean`,`poimandres`,`monokai`,`laserwave`,`tokyo`,`slack-dark`,`rose-pine`,`github-dark`,`material-theme`,`one-dark`,`catppuccin-mocha`,`catppuccin-frappe`,`catppuccin-macchiato`].some(e=>t.includes(e))&&![`light`,`latte`,`dawn`,`lotus`].some(e=>t.includes(e)):!!m.isDark}(wi()):!!m.isDark),Ht=v(()=>{if(!U.value)return Vt.value?`dark`:`light`;let e=W.value?.diffAppearance;return e===`light`||e===`dark`?e:Vt.value?`dark`:`light`}),Ut=v(()=>U.value?Ht.value===`dark`:Vt.value),Wt=v(()=>U.value?`diff`:`single`),Gt=y(Wt.value),G=y(!1),K=y(!1),Kt=y(!1),q=y(!1),qt=y(null),Jt=y(0),Yt=y(0),Xt=y(!1),Zt=null,Qt=!1,$t=null,en=!1,tn=v(()=>{if(U.value){let e=W.value?.diffWordWrap;if(e===`inherit`){let e=m.monacoOptions?.wordWrap;return e==null||String(e)!==`off`}return e===`on`}let e=m.monacoOptions?.wordWrap;return e==null||String(e)!==`off`}),nn=v(()=>!!U.value&&It(W.value??{})),rn=v(()=>{let e=m.monacoOptions?.diffHideUnchangedRegions;return e===void 0?A({},ue):we(e)});function an(e){return!0===ce?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let on=v(()=>an(E.value)),sn=v(()=>!(G.value||!q.value&&K.value)),cn=v(()=>sn.value),ln=v(()=>sn.value&&!Kt.value),un=v(()=>!G.value&&!q.value&&sn.value),dn=v(()=>K.value&&!G.value?`ready`:q.value?`fallback`:`pending`),fn=y(!1),pn=v(()=>Rt(m.node.code)),mn=v(()=>U.value?!0===m.node.diff?m.node:j(A({},m.node),{diff:!0}):pn.value===m.node.code?m.node:j(A({},m.node),{code:pn.value})),J=y(typeof m.monacoOptions?.fontSize==`number`?m.monacoOptions.fontSize:NaN),Y=y(J.value),hn=y(null),gn=y(null),_n=y(null),vn=v(()=>{let e=J.value,t=Y.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),yn=v(()=>{let e=hn.value;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=m.monacoOptions?.fontSize;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return t;let n=Y.value;return typeof n==`number`&&Number.isFinite(n)&&n>0?n:12}),bn=v(()=>{let e=gn.value;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=m.monacoOptions?.lineHeight;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:yn.value===12?18:Math.max(12,Math.round(1.5*yn.value))}),xn=v(()=>bn.value),Sn=v(()=>{let e=m.monacoOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),Cn=v(()=>{let e=m.monacoOptions?.padding,t=U.value?0:8;return{top:typeof e?.top==`number`&&Number.isFinite(e.top)&&e.top>=0?e.top:t,bottom:typeof e?.bottom==`number`&&Number.isFinite(e.bottom)&&e.bottom>=0?e.bottom:t}}),wn=v(()=>{let e=m.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Tn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(Kr()))}function En(){return!U.value&&!1!==m.stream&&!1!==m.loading}let Dn=v(()=>U.value?null:wn.value==null||En()?Math.ceil((e=>{let t=String(e??``);return t?Math.max(1,t.split(/\r\n|\n|\r/).length):1})(pn.value)*xn.value+1):null),On=v(()=>{if(U.value)return null;let e=wn.value;return e==null||En()?Tn(Dn.value):Tn(e)}),kn=v(()=>{let e=m.estimatedHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}),An=y(null);function jn(){let e=An.value;return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.round(e):null}let Mn=v(()=>jn()??(!U.value&&Xt.value?null:sn.value||!K.value?On.value:null));function Nn(e){let t=e?`hsl(152 42% 60%)`:`var(--diff-added-fg)`,n=e?`hsl(0 58% 58%)`:`var(--diff-removed-fg)`,r=e?`hsl(152 42% 60% / 0.18)`:`var(--diff-added-bg)`,i=e?`hsl(0 58% 58% / 0.18)`:`var(--diff-removed-bg)`,a=e?`hsl(152 42% 60% / 0.28)`:`var(--diff-added-inline-bg)`,o=e?`hsl(0 58% 58% / 0.28)`:`var(--diff-removed-inline-bg)`,s=`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,c=`linear-gradient(90deg, ${n} 0 4px, transparent 4px 100%)`,l=e?`hsl(0 0% 7% / 0.98)`:`hsl(var(--ms-muted) / 0.45)`,u=`var(--markstream-code-layout-character-width, 1ch)`,d=`calc(${u} + ${u})`,f=`calc(${u} + ${u} + ${u} + ${u} + ${u} + 2px)`,p=`calc(${f} + ${u})`;return{"--markstream-diff-line-number-bg":l,"--markstream-diff-added-fg":t,"--markstream-diff-removed-fg":n,"--markstream-diff-added-line":r,"--markstream-diff-removed-line":i,"--markstream-diff-added-line-fill":r,"--markstream-diff-removed-line-fill":i,"--markstream-diff-added-gutter":s,"--markstream-diff-removed-gutter":c,"--markstream-diff-added-inline":a,"--markstream-diff-removed-inline":o,"--stream-monaco-added-fg":t,"--stream-monaco-removed-fg":n,"--stream-monaco-added-line":r,"--stream-monaco-removed-line":i,"--stream-monaco-added-line-fill":r,"--stream-monaco-removed-line-fill":i,"--stream-monaco-added-gutter":s,"--stream-monaco-removed-gutter":c,"--stream-monaco-added-inline":a,"--stream-monaco-removed-inline":o,"--stream-monaco-gutter-marker-width":`4px`,"--stream-monaco-gutter-gap":`1ch`,"--stream-monaco-line-number-left":`0px`,"--stream-monaco-line-number-width":d,"--stream-monaco-line-number-padding-left":d,"--stream-monaco-line-number-padding-right":u,"--stream-monaco-line-number-separator-width":`2px`,"--stream-monaco-layout-character-width":u,"--stream-monaco-line-number-box-width":f,"--stream-monaco-line-number-gap-to-code":u,"--stream-monaco-line-number-bg":l,"--stream-monaco-diff-code-gap":u,"--stream-monaco-diff-code-padding":`0px`,"--stream-monaco-original-margin-width":p,"--stream-monaco-original-scrollable-left":p,"--stream-monaco-original-scrollable-width":`calc(100% - ${p})`,"--stream-monaco-modified-margin-width":p,"--stream-monaco-modified-scrollable-left":p,"--stream-monaco-modified-scrollable-width":`calc(100% - ${p})`}}let Pn=v(()=>{let e=m.monacoOptions?.fontFamily,t=Tn(wn.value),n=Tn(Dn.value),r=En(),i=A(A({fontSize:`${yn.value}px`,lineHeight:`${xn.value}px`,tabSize:Sn.value,boxSizing:`border-box`,maxHeight:`${Kr()}px`,overflow:`auto`,paddingTop:`${Cn.value.top}px`,paddingBottom:`${Cn.value.bottom}px`},U.value||t==null||r?U.value||n==null?{}:{minHeight:`${n}px`}:{height:`${t}px`,minHeight:`${t}px`}),typeof e==`string`&&e.trim()?{"--markstream-code-font-family":e.trim()}:{});return i[`--markstream-pre-line-number-top`]=`${Cn.value.top}px`,i[`--markstream-code-padding-left`]=`calc(2ch + 2ch + 1ch + 2px + 1ch)`,i[`--markstream-pre-line-number-left`]=`0px`,i[`--markstream-pre-line-number-width`]=`2ch`,i[`--markstream-pre-line-number-padding-left`]=`2ch`,i[`--markstream-pre-line-number-padding-right`]=`1ch`,i[`--markstream-pre-line-number-separator-width`]=`2px`,U.value&&(i[`--markstream-pre-diff-line-height`]=`${xn.value}px`,i[`--markstream-pre-diff-pane-bottom-padding`]=(nn.value,`0px`),Object.assign(i,Nn(Ut.value))),i}),Fn=v(()=>Mn.value!=null&&(!K.value||jn()!=null)),In=v(()=>{let e=Mn.value;if(e==null)return null;if(U.value)return Math.ceil(e);let t=kn.value,n=wn.value;if(t==null||n==null)return Math.ceil(e);let r=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+r)}),Ln=v(()=>{if(U.value&&sn.value)return{};let e=Mn.value;return Fn.value&&e!=null?{minHeight:`${e}px`}:{}});function Rn(){var e,t,n,r;let i=E.value?.querySelector(`pre.code-pre-fallback`),a=H(),o=i?.scrollTop??0;(t=(e=(a?.getOriginalEditor)?.call(a))?.setScrollTop)==null||t.call(e,o),(r=(n=(a?.getModifiedEditor)?.call(a))?.setScrollTop)==null||r.call(n,o)}function zn(){return M(this,null,function*(){return U.value?(Sr()??Bn(),Z(!0),Rn(),Q(),Kt.value=!0,yield e(),Z(!0),yield Un(),Z(!0),!(St&&!(yield St())||(br(),Bn(),Z(!0),K.value=!0,yield e(),Bn(),Z(!0),br(),Q(),$(),0))):!(St&&!(yield St())||(K.value=!0,yield e(),X(!1),Z(),0))})}function Bn(){let e=T.value;return e&&Lr(e)?(Q(),X({preferModelDiffHeight:!0}),Mr(),Number.parseFloat(e.style.height||``)||null):Sr()}function Vn(){if(!U.value||!I.value||!K.value||sn.value)return!1;let e=T.value;return!!e&&vr(e)}function Hn(e,t=!1,n={}){let r=Math.ceil(e),i=jn();if(i==null)return r;let a=!0===n.allowBelowEstimatedFloor||Vn();return r>=i||a?((t||a)&&I.value&&(An.value=null),r):i}function Un(){return new Promise(e=>{let t=!1,n=null,r=null,i=()=>{t||(t=!0,r!=null&&globalThis.clearTimeout(r),n!=null&&pe(n),e())};r=globalThis.setTimeout(i,50),n=w(i)})}function Wn(){try{let e=T.value;if(!e)return null;let t=e.querySelector(`.view-lines .view-line`);if(t){let e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch{}return null}function Gn(){var e;try{let t=U.value?((e=H())?.getModifiedEditor)?.call(e)??H():V(),n=vt()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}try{let e=T.value;if(e){let t=e.querySelector(`.view-lines .view-line`);if(t)try{if(typeof window<`u`&&typeof window.getComputedStyle==`function`){let e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch{}}}catch{}return null}function Kn(e){try{let t=vt()?.EditorOption?.lineHeight;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n==`number`&&n>0)return n}}catch{}let t=Wn();if(t&&t>0)return t;let n=Number.isFinite(Y.value)&&Y.value>0?Y.value:14;return Math.max(12,Math.round(1.35*n))}function qn(e){try{let t=vt()?.EditorOption?.padding;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n?.top==`number`||typeof n?.bottom==`number`)return(typeof n?.top==`number`&&Number.isFinite(n.top)?Math.max(0,n.top):0)+(typeof n?.bottom==`number`&&Number.isFinite(n.bottom)?Math.max(0,n.bottom):0)}}catch{}let t=W.value?.padding;return typeof t?.top==`number`||typeof t?.bottom==`number`?(typeof t?.top==`number`&&Number.isFinite(t.top)?Math.max(0,t.top):0)+(typeof t?.bottom==`number`&&Number.isFinite(t.bottom)?Math.max(0,t.bottom):0):U.value?24:0}function Jn(e,t){return typeof e!=`number`||typeof t!=`number`||e<1||t=i&&o>=i&&n[a]===r[o];)a--,o--;let s=Math.max(0,a-i+1),c=Math.max(0,o-i+1);if(s===0||c===0)return{removed:s,added:c};if((s+1)*(c+1)<=15e5){let e=c+1,t=new Uint32Array(e),a=new Uint32Array(e);for(let e=s-1;e>=0;e--){a[c]=0;for(let o=c-1;o>=0;o--)a[o]=n[i+e]===r[i+o]?t[o+1]+1:Math.max(t[o],a[o+1]);let o=t;t=a,a=o}let o=t[0];return{removed:s-o,added:c-o}}return{removed:s,added:c}}function Zn(e){if(!function(){return!(!U.value||!nn.value)&&(m.node.originalCode!=null||m.node.updatedCode!=null?Xn(String(m.node.originalCode??``),String(m.node.updatedCode??``)).removed>0:String(m.node.code??``).split(/\r\n|\n|\r/).some(e=>function(e){return e.startsWith(`-`)&&!e.startsWith(`---`)}(e)))}())return!0;let t=e?.querySelector(`.stream-monaco-fallback-inline-delete-line`);if((t?.textContent)?.trim()&&(t.hasAttribute(`data-stream-monaco-colorize-signature`)||t.querySelector(`[class*="mtk"]`)))return!0;let n=e?.querySelector([`.editor.modified .view-zones .view-lines.line-delete`,`.editor.modified .view-lines .view-line.line-delete`,`.editor.original .view-zones .view-lines.line-delete`,`.editor.original .view-lines .view-line.line-delete`].join(`,`));if(!n||!n.matches(`.view-line`)&&!n.querySelector(`.view-line`))return!1;let r=n.getBoundingClientRect(),i=e?.getBoundingClientRect();return i?.width===0&&i.height===0||r.width>0&&r.height>0}function Qn(e,t){if(!e)return!1;let n=t.added<=0||!!e.querySelector([`.line-insert`,`.gutter-insert`,`.stream-monaco-fallback-line-insert`,`.stream-monaco-fallback-gutter-insert`,`.stream-monaco-fallback-line-number-insert`].join(`,`)),r=t.removed<=0||!!e.querySelector([`.line-delete`,`.gutter-delete`,`.inline-deleted-margin-view-zone`,`.stream-monaco-fallback-line-delete`,`.stream-monaco-fallback-gutter-delete`,`.stream-monaco-fallback-line-number-delete`,`.stream-monaco-fallback-inline-delete-line`,`.stream-monaco-fallback-inline-delete-margin`].join(`,`));return n&&r}function $n(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?typeof window>`u`||typeof window.getComputedStyle!=`function`?n:window.getComputedStyle(n).display===`none`?null:n:null}function er(e,t){return $n(e,t)!==null}function tr(e,t){if(!e)return!1;let n=t.added<=0||[`.gutter-insert`,`.stream-monaco-fallback-gutter-insert`].some(t=>er(e,t)),r=t.removed<=0||[`.gutter-delete`,`.inline-deleted-margin-view-zone`,`.stream-monaco-fallback-gutter-delete`,`.stream-monaco-fallback-inline-delete-margin`].some(t=>er(e,t));return n&&r}function nr(e){let t=Array.from(e?.querySelectorAll(`.monaco-diff-editor .margin-view-overlays .line-numbers`)??[]);return!!t.length&&t.some(e=>{if(!e.textContent?.trim())return!1;if(typeof window>`u`||typeof window.getComputedStyle!=`function`)return!0;let t=window.getComputedStyle(e);if(t.display===`none`)return!1;let n=e.getBoundingClientRect();if(n.width<=0&&n.height<=0)return!0;let r=Number.parseFloat(t.width||``),i=Number.parseFloat(t.paddingLeft||``),a=Number.parseFloat(t.paddingRight||``);return Math.max(n.width,Number.isFinite(r)?r:0)>=8&&Number.isFinite(i)&&i>=1&&Number.isFinite(a)&&a>=1})}function rr(e){let t=$n(e,`.monaco-diff-editor .view-lines .view-line`);if(!t)return!1;if(!cr())return!0;let n=$n(e,`.monaco-diff-editor .margin-view-overlays .line-numbers`);if(!n)return!1;if(typeof window>`u`||typeof window.getComputedStyle!=`function`)return!0;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();if(r.width<=0&&r.height<=0||i.width<=0&&i.height<=0)return!0;let a=r.left-i.right;return a>=0&&a<=32}function ir(e,t){return!nn.value||!(t||e?.querySelector([`.line-insert`,`.line-delete`,`.gutter-insert`,`.gutter-delete`,`.stream-monaco-line-number-insert`,`.stream-monaco-line-number-delete`,`.stream-monaco-line-insert-fill`,`.stream-monaco-line-delete-fill`,`.stream-monaco-fallback-line-insert`,`.stream-monaco-fallback-line-delete`,`.stream-monaco-fallback-inline-delete-line`].join(`,`)))||!!(e?.classList.contains(`stream-monaco-diff-inline-native-ready`)&&!e.classList.contains(`stream-monaco-diff-native-stale`))}function ar(e,t,n,r){let i=e?.querySelector(`.monaco-diff-editor .editor.${t}`);if(!i)return!1;let a=Array.from(i.querySelectorAll(`.margin-view-overlays .line-numbers.${n}`));if(!a.length)return!0;let o=Array.from(i.querySelectorAll(`.lines-content > .view-lines:not(.line-delete) > .view-line`));return!!o.length&&a.every(e=>{let t=e.getBoundingClientRect(),n=null;for(let e of o){let r=e.getBoundingClientRect(),i=Math.abs(r.top-t.top);(!n||i1.25||n.node.classList.contains(r)})}function or(e,t){if(!e)return!1;let n=t.added<=0||ar(e,`modified`,`stream-monaco-line-number-insert`,`stream-monaco-line-insert-fill`),r=t.removed<=0||(nn.value?!!e.classList.contains(`stream-monaco-diff-inline-native-ready`):ar(e,`original`,`stream-monaco-line-number-delete`,`stream-monaco-line-delete-fill`));return n&&r}function sr(e){if(Ve.value)return!0;if(!e)return!1;let t=Array.from(e.querySelectorAll(`.monaco-diff-editor .view-lines .view-line, .monaco-editor .view-lines .view-line`)).filter(e=>{if(!e.textContent?.trim())return!1;let t=e.getBoundingClientRect();return t.width>0||t.height>0});if(!t.length)return!1;let n=t.filter(e=>{var t;return t=e.textContent??``,/['"`{}()[\]:;=<>.,]|\/\/|\/\*|\b(?:async|await|class|const|enum|export|for|function|if|import|interface|let|return|switch|type|var|while)\b/.test(t.replace(/\u00A0/g,` `).trim())});return!n.length||n.filter(e=>Array.from(e.querySelectorAll(`span`)).filter(e=>e.textContent?.trim()).some(e=>String(e.className||``).split(/\s+/).some(e=>/^mtk\d+$/.test(e)&&e!==`mtk1`))).length>0}function cr(){return W.value?.lineNumbers!==`off`}function lr(){U.value?Nt.value=Xn(String(m.node.originalCode??``),String(m.node.updatedCode??``)):Nt.value={removed:0,added:0}}function ur(){if(U.value)try{let e=H(),t=(e?.getLineChanges)?.call(e);if(!Array.isArray(t))return void lr();let n=0,r=0;for(let e of t)n+=Jn(e.originalStartLineNumber,e.originalEndLineNumber),r+=Jn(e.modifiedStartLineNumber,e.modifiedEndLineNumber);Nt.value={removed:n,added:r}}catch{lr()}else Nt.value={removed:0,added:0}}function dr(){if(Number.isFinite(Y.value)&&Y.value>0&&Number.isFinite(J.value))return Y.value;let e=Gn();return typeof m.monacoOptions?.fontSize==`number`?(J.value=m.monacoOptions.fontSize,Y.value=m.monacoOptions.fontSize,Y.value):e&&e>0?(J.value=e,Y.value=e,e):(J.value=12,Y.value=12,12)}function fr(){let e=dr();Y.value=Math.min(36,e+1)}function pr(){let e=dr();Y.value=Math.max(10,e-1)}function mr(){dr(),Number.isFinite(J.value)&&(Y.value=J.value)}function hr(){var e,t,n,r,i;try{let a=U.value?H():null,o=U.value?a:V();if(!o)return null;if(a?.getOriginalEditor&&a?.getModifiedEditor){let i=a.getOriginalEditor?.call(a),o=a.getModifiedEditor?.call(a);(e=i?.layout)==null||e.call(i),(t=o?.layout)==null||t.call(o);let s=(i?.getContentHeight)?.call(i)||0,c=(o?.getContentHeight)?.call(o)||0,l=Math.max(s,c);if(l>0)return Math.ceil(l);let u=((n=(i?.getModel)?.call(i))?.getLineCount)?.call(n)||1,d=((r=(o?.getModel)?.call(o))?.getLineCount)?.call(r)||1,f=Math.max(u,d),p=Math.max(Kn(i),Kn(o)),m=Math.max(qn(i),qn(o));return Math.ceil(f*p+m+0)}if(o?.getContentHeight){(i=o?.layout)==null||i.call(o);let e=o.getContentHeight();if(e>0)return U.value||(Xt.value=!0),Math.ceil(e)}let s=(o?.getModel)?.call(o),c=1;s&&typeof s.getLineCount==`function`&&(c=s.getLineCount());let l=Kn(o);return Math.ceil(c*(l+1.5)+0)}catch{return null}}function gr(){var e;if(U.value)return!1;try{let t=((e=V())?.getContentHeight)?.call(e),n=typeof t==`number`&&Number.isFinite(t)&&t>0;return n&&(Xt.value=!0),n}catch{return!1}}function _r(e){if(typeof window>`u`)return null;try{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`)return null;let r=e.querySelector(`diffs-container`);if(r instanceof HTMLElement){let e=r.getBoundingClientRect();if(e.height>0&&e.bottom>t.top)return Math.ceil(e.bottom-t.top)}let i=[`.editor.original .view-lines .view-line`,`.editor.modified .view-lines .view-line`,`.editor.original .view-zones > div`,`.editor.modified .view-zones > div`,`.editor.original .margin-view-zones > div`,`.editor.modified .margin-view-zones > div`,`.editor.original .diff-hidden-lines`,`.editor.modified .diff-hidden-lines`,`.stream-monaco-diff-unchanged-bridge`],a=0;for(let n of Array.from(e.querySelectorAll(i.join(`,`)))){if(!(n instanceof HTMLElement)||(n.parentElement?.classList.contains(`view-zones`)||n.parentElement?.classList.contains(`margin-view-zones`))&&!(n.textContent?.trim()||n.matches(`.line-delete, .line-insert, .cdr`)||n.querySelector(`.diff-hidden-lines, .stream-monaco-diff-unchanged-bridge, .line-delete, .line-insert, .cdr`)))continue;let e=window.getComputedStyle(n);if(e.display===`none`||e.visibility===`hidden`||Number.parseFloat(e.opacity||`1`)<=.01)continue;let r=n.getBoundingClientRect();r.height<=0||r.bottom<=t.top||(a=Math.max(a,r.bottom-t.top))}return a>0?Math.ceil(a):null}catch{return null}}function vr(e){if(typeof window>`u`)return!1;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return!1;let n=e.querySelectorAll(`.editor.modified .diff-hidden-lines, .editor.original .diff-hidden-lines, .stream-monaco-diff-unchanged-bridge`);for(let e of Array.from(n)){if(!(e instanceof HTMLElement))continue;let n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||Number.parseFloat(n.opacity||`1`)<=.01)continue;let r=e.getBoundingClientRect();if(!(r.width<=0||r.height<=0||r.bottom<=t.top||r.top>=t.bottom))return!0}return!1}function yr(e){let t=String(e??``).trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];if(n){let e=n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n;return .2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}let r=t.match(/\d+(?:\.\d+)?/g);if(!r||r.length<3)return null;let[i,a,o]=r.slice(0,3).map(Number);return .2126*i+.7152*a+.0722*o}function br(){var e;if(xr())return;let t=Gn();t&&t>0&&(hn.value=t,Y.value=t,J.value=t);try{let t=Kn(U.value?((e=H())?.getModifiedEditor)?.call(e)??H():V());t&&t>0&&(gn.value=t)}catch{}try{let e=Wn();e&&e>0&&(gn.value=e)}catch{}}function xr(){return U.value&&cn.value}function Sr(){if(!U.value||!sn.value)return null;let e=T.value,t=E.value?.querySelector(`pre.code-pre-fallback`);if(!e||!t)return null;let n=Math.ceil(t.getBoundingClientRect().height);return!Number.isFinite(n)||n<=0?null:(e.style.height=`${n}px`,e.style.minHeight=`${n}px`,e.style.maxHeight=`${Math.ceil(Kr())}px`,e.style.overflow=`hidden`,n)}function Cr(){let e=T.value,t=E.value;if(!e||!t)return;let n=e,r=e.querySelector(`.monaco-editor`)||e,i=r.querySelector(`.monaco-editor-background`)||r,a=r.querySelector(`.view-lines`)||r,o=null,s=null,c=null;try{typeof window<`u`&&typeof window.getComputedStyle==`function`&&(o=window.getComputedStyle(r),s=i===r?o:window.getComputedStyle(i),c=a===r?o:window.getComputedStyle(a))}catch{o=null,s=null,c=null}let l=String(o?.getPropertyValue(`--vscode-editor-foreground`)??``).trim(),u=String(o?.getPropertyValue(`--vscode-editor-background`)??``).trim(),d=String(o?.getPropertyValue(`--vscode-editor-selectionBackground`)??o?.getPropertyValue(`--vscode-editor-hoverHighlightBackground`)??``).trim(),f=l||String(c?.color??o?.color??``).trim(),p=u||String(s?.backgroundColor??o?.backgroundColor??``).trim(),m=function(){var e;try{let t=U.value?((e=H())?.getModifiedEditor)?.call(e)??H():V(),n=vt()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.typicalHalfwidthCharacterWidth;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}return null}();if(m!=null&&(_n.value=m),U.value){let e=(e,r)=>{r?(t.style.setProperty(e,r),n.style.setProperty(e,r)):(t.style.removeProperty(e),n.style.removeProperty(e))};for(let[n,r]of Object.entries(Nn(t.classList.contains(`is-dark`))))e(n,r);f?(t.style.setProperty(`--markstream-diff-editor-fg`,f),n.style.setProperty(`--vscode-editor-foreground`,f),n.style.setProperty(`--stream-monaco-editor-fg`,f)):(t.style.removeProperty(`--markstream-diff-editor-fg`),n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--stream-monaco-editor-fg`)),p?(t.style.setProperty(`--markstream-diff-editor-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg-soft`,p),t.style.setProperty(`--markstream-diff-panel-bg-strong`,p),n.style.setProperty(`--vscode-editor-background`,p),n.style.setProperty(`--stream-monaco-editor-bg`,p),n.style.setProperty(`--stream-monaco-fixed-editor-bg`,p),n.style.setProperty(`--stream-monaco-panel-bg`,p),n.style.setProperty(`--stream-monaco-panel-bg-soft`,p),n.style.setProperty(`--stream-monaco-panel-bg-strong`,p),n.style.backgroundColor=p):(t.style.removeProperty(`--markstream-diff-editor-bg`),t.style.removeProperty(`--markstream-diff-panel-bg`),t.style.removeProperty(`--markstream-diff-panel-bg-soft`),t.style.removeProperty(`--markstream-diff-panel-bg-strong`),n.style.removeProperty(`--vscode-editor-background`),n.style.removeProperty(`--stream-monaco-editor-bg`),n.style.removeProperty(`--stream-monaco-fixed-editor-bg`),n.style.removeProperty(`--stream-monaco-panel-bg`),n.style.removeProperty(`--stream-monaco-panel-bg-soft`),n.style.removeProperty(`--stream-monaco-panel-bg-strong`),n.style.backgroundColor=``),d?n.style.setProperty(`--vscode-editor-selectionBackground`,d):n.style.removeProperty(`--vscode-editor-selectionBackground`);return}if(function(e,t,n){if(!Ve.value)return!1;let r=yr(e),i=yr(t);return n?r!=null&&r>170||i!=null&&i<110:r!=null&&r<85||i!=null&&i>190}(p,f,t.classList.contains(`is-dark`)))return n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--vscode-editor-background`),void n.style.removeProperty(`--vscode-editor-selectionBackground`);f&&n.style.setProperty(`--vscode-editor-foreground`,f),p&&n.style.setProperty(`--vscode-editor-background`,p),d&&n.style.setProperty(`--vscode-editor-selectionBackground`,d)}let wr=0,Tr=0,Er=/auto|scroll|overlay/i;function Dr(e,t,n){if(typeof window>`u`||U.value||function(e){return on.value||an(e)}(e))return;let r=Math.ceil(n)-Math.ceil(t);if(Math.abs(r)<=1)return;let i=function(e){if(typeof window>`u`)return null;let t=e?.ownerDocument??document,n=t.scrollingElement||t.documentElement||t.body,r=e?.parentElement??null;for(;r&&r!==t.body&&r!==n;){let e=window.getComputedStyle(r),t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();if(Er.test(t)||Er.test(n))return r;r=r.parentElement}return n}(e);if(!i)return;let a=e.ownerDocument??document,o=i===a.body||i===a.documentElement||i===a.scrollingElement,s=o?0:i.getBoundingClientRect().top;e.getBoundingClientRect().top-s>=0||(o&&typeof window.scrollBy==`function`?window.scrollBy(0,r):i.scrollTop+=r)}function Or(){try{let e=T.value;if(!e)return;let t=e.getBoundingClientRect().height,n=hr();if(n!=null&&n>0){let r=Hn(n,!0,{allowBelowEstimatedFloor:!U.value&&I.value&&gr()}),i=jn();e.style.minHeight=i==null?`0px`:`${i}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,Dr(e,t,r);return}let r=jn();r!=null&&(e.style.minHeight=`${r}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,Dr(e,t,r))}catch{}}function kr(){for(var e,t;At.length>0;)try{(t=(e=At.pop())?.dispose)==null||t.call(e)}catch{}Ue!=null&&(pe(Ue),Ue=null),We!=null&&(pe(We),We=null),Ge!=null&&(pe(Ge),Ge=null),Ke=0,qe=!1}function Ar(){for(var e;jt.length>0;)try{(e=jt.pop())==null||e()}catch{}}function X(e=!1){N.value||(k.value?Or():function(e={}){try{let t=T.value;if(!t)return;let n=t.getBoundingClientRect().height,r=Kr(),i=Math.ceil(t.getBoundingClientRect?.call(t).height||0),a=Number.parseFloat(t.style.height||``),o=i>0?i:Number.isFinite(a)&&a>0?Math.ceil(a):0,s=U.value?function(){var e,t;if(Vr())return null;try{let n=H(),r=(n?.getOriginalEditor)?.call(n),i=(n?.getModifiedEditor)?.call(n);if(!r||!i)return null;let a=((e=r.getModel?.call(r))?.getLineCount)?.call(e)||1,o=((t=i.getModel?.call(i))?.getLineCount)?.call(t)||1,s=Math.max(a,o),c=Math.max(Kn(r),Kn(i)),l=Math.max(qn(r),qn(i)),u=Math.max(r.getContentHeight?.call(r)??0,i.getContentHeight?.call(i)??0);return Math.ceil(Math.max(u,s*c+l+0))}catch{return null}}():null,c=U.value&&vr(t),l=U.value&&Lr(t),u=U.value&&t.classList.contains(`stream-monaco-diff-native-stale`),d=c&&I.value&&K.value&&!sn.value;if(c||(R.value=null),Ze>0&&(Ze--,Ye.value!=null))return void Dr(t,n,Nr(t,Ye.value,r,{allowBelowEstimatedFloor:d,preserveScrollableOverflow:Fr(t)}));if(U.value&&!l&&!c&&sn.value){let e=Sr();if(e!=null){let i=Nr(t,e,r,{allowBelowEstimatedFloor:!0});Z(!0),Dr(t,n,i);return}}let f=U.value&&!0===e.preferModelDiffHeight,p=U.value?_r(t):null,h=p,g=!U.value&&I.value&&gr(),_=U.value&&!1!==m.loading&&(h!=null||s!=null&&i>0&&s0&&s0&&s0?o:null:s;else v=hr();if(U.value&&!1===m.loading&&u&&!d&&v!=null&&s!=null&&(v=Math.min(v,s)),U.value&&v!=null&&o>0&&(!1!==m.loading||!1===m.loading&&u&&!d||!0===e.holdCurrentDiffHeight&&!d)&&(v=Math.max(v,o)),v!=null&&v>0){let e=c&&R.value!=null,a=c&&i>0&&i=r-1,o=Nr(t,e?Math.max(R.value,v):a?i:v,r,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:d||g||_,preserveScrollableOverflow:Fr(t)});c&&o0?s:0);if(te>0){let e=c&&R.value!=null,a=c&&i>0&&i=r-1,o=Nr(t,e?Math.max(R.value,te):a?i:te,r,{allowBelowEstimatedFloor:d});c&&o0?Dr(t,n,Nr(t,b,r,{allowBelowEstimatedFloor:d})):U.value||Dr(t,n,Nr(t,r,r))}catch{}}(typeof e==`object`?e:{}))}function jr(){wr=0,Tr=0}function Z(e=!1){if(N.value)return;let t=T.value;if(!t)return;let n=U.value?H():V();if(n&&typeof n.layout==`function`)try{let r=t.getBoundingClientRect?.call(t),i=Math.ceil((r?.width??0)||t.clientWidth||0),a=Math.ceil((r?.height??0)||t.clientHeight||Number.parseFloat(t.style.height||``)||0);if(i>0&&a>0){if(!e&&i===wr&&a===Tr)return;wr=i,Tr=a,n.layout({width:i,height:a})}else jr(),n.layout()}catch{}}function Q(){if(!U.value)return void Ar();let e=T.value;if(!e)return void Ar();let t=e.querySelector(`.monaco-diff-editor`);if(!t||t.classList.contains(`side-by-side`))return void Ar();let n=Array.from(t.querySelectorAll(`.editor.original .diff-hidden-lines`)),r=Array.from(t.querySelectorAll(`.editor.modified .diff-hidden-lines`)),i=Math.min(n.length,r.length);for(let e=0;e div:first-child`),a=t.querySelector(`.center`);if(!n||!i||!a||a.querySelector(`.markstream-inline-fold-proxy`))continue;let o=document.createElement(`button`);o.type=`button`,o.className=`markstream-inline-fold-proxy`,o.dataset.markstreamInlineFoldProxy=`true`;let s=n.getAttribute(`title`)||`Show Unchanged Region`;o.title=s,o.setAttribute(`aria-label`,s);let c=e=>{e.preventDefault(),e.stopPropagation()},l=e=>{e.preventDefault(),e.stopPropagation(),n.click(),w(()=>$())},u=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.stopPropagation(),n.click(),w(()=>$()))};o.addEventListener(`mousedown`,c),o.addEventListener(`click`,l),o.addEventListener(`keydown`,u),a.appendChild(o),jt.push(()=>{o.removeEventListener(`mousedown`,c),o.removeEventListener(`click`,l),o.removeEventListener(`keydown`,u),o.parentElement===a&&a.removeChild(o)})}}function $(e=!1){if(L||Ue!=null)return;let t=()=>{L||(Q(),X(e),Z())};Ue=w(()=>{Ue=null,t(),We=w(()=>{We=null,t()})}),Mr()}function Mr(e=!1){if(!U.value||L||!e&&!1===m.loading||(qe||=e,Ke=Math.max(Ke,e?18:6),Ge!=null))return;let t=()=>{if(Ge=null,!U.value||L||Ke<=0||!qe&&!1===m.loading)return Ke=0,void(qe=!1);Ke--,Q(),X({preferModelDiffHeight:!0,holdCurrentDiffHeight:qe}),Z(),Ke>0?Ge=w(t):qe=!1};Ge=w(t)}function Nr(e,t,n,r={}){let i=U.value&&!1!==m.loading?_r(e):null,a=i!=null&&i>t+1?i:t,o=Math.min(a,n),s=!0===r.allowBelowEstimatedFloor||Vn(),c=Hn(o,!0===r.clearEstimatedFloor,{allowBelowEstimatedFloor:s}),l=jn();if(e.style.minHeight=l==null||s?`0px`:`${Math.min(l,Math.ceil(n))}px`,e.style.height=`${c}px`,e.style.maxHeight=`${Math.ceil(n)}px`,U.value)e.style.overflow=`hidden`;else{let i=!0===r.preserveScrollableOverflow||t>n+1;e.style.overflow=i?`auto`:`hidden`}return c}function Pr(e,t=0){let n=Math.ceil(e.getBoundingClientRect?.call(e).height||0),r=Math.max(t,e.clientHeight||0,n);return r>0&&e.scrollHeight>r+1}function Fr(e){return!U.value&&(Qe||Pr(e,Ye.value??0))}function Ir(e){var t,n,r,i;if(!U.value)return;let a=k.value||!vr(e)||e.getBoundingClientRect().height>=Kr()-1;if(Xe===a)return;Xe=a;let o=j(A({},m.monacoOptions?.scrollbar??{}),{handleMouseWheel:a}),s=H();try{(n=(t=(s?.getOriginalEditor)?.call(s))?.updateOptions)==null||n.call(t,{scrollbar:o}),(i=(r=(s?.getModifiedEditor)?.call(s))?.updateOptions)==null||i.call(r,{scrollbar:o})}catch{}}function Lr(e=T.value){return!!Vr(e)||!!e?.querySelector(`.monaco-diff-editor .view-lines .view-line`)}function Rr(e=T.value){return!!Vr(e)||!!e?.querySelector(`.monaco-editor .view-lines .view-line`)}function zr(){var e;if(Vr())return!0;let t=((e=V())?.getModel)?.call(e);return typeof t?.getValue==`function`&&t.getValue()===pn.value}function Br(e=T.value){return!!Vr(e)||!!e?.classList.contains(`stream-monaco-diff-root`)&&!(nn.value&&!e.classList.contains(`stream-monaco-diff-inline`))}function Vr(e=T.value){return!!e?.querySelector(`diffs-container`)}function Hr(e){return!1!==m.loading||K.value||e.classList.contains(`stream-monaco-diff-native-stale`)||vr(e)}function Ur(){let e=H();return typeof e?.getOriginalEditor==`function`||typeof e?.getModifiedEditor==`function`||typeof e?.getLineChanges==`function`}function Wr(){return M(this,arguments,function*(t={}){if(!U.value)return!0;if(Vr())return yield e(),yield Un(),Vr();let n=!1!==t.requireHighlight,r=0,i=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``)),a=Xn(i.original,i.updated),o=a.added>0||a.removed>0,s=()=>{let e=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``));e.original===i.original&&e.updated===i.updated||(i=e,a=Xn(i.original,i.updated),o=a.added>0||a.removed>0)};for(let t=0;t<30;t++){if(L)return!1;s();let t=T.value,i=H(),c=cr(),l=!1;try{let e=(i?.getLineChanges)?.call(i);l=Array.isArray(e)&&(!o||e.length>0)}catch{l=!1}let u=!!t?.querySelector(`.monaco-diff-editor`),d=Lr(t),f=!o||Qn(t,a),p=!o||tr(t,a),m=!c||nr(t);if(u&&d&&l&&f&&p&&m&&Zn(t)){try{Bt(),Q(),ur(),$()}catch{}if(yield e(),yield Un(),L)return!1;let t=T.value,i=!cr()||nr(t),s=!o||Qn(t,a),c=!o||tr(t,a),l=ir(t,o),u=or(t,a),d=!n||sr(t),f=Br(t)&&i&&rr(t)&&s&&c&&l&&u&&d,p=Br(t)&&i&&rr(t)&&s&&c&&Zn(t)&&d;if(f||p){if(r++,r>=2)return!0}else r=0}yield e(),yield Un()}return L||(Bt(),Q(),ur(),$(),s()),!1})}function Gr(t,n,r){return M(this,null,function*(){try{yield _t(t,n,r);return}catch(e){if(!zt(e))throw e}if(yield e(),yield Un(),!L&&U.value)try{yield _t(t,n,r)}catch(e){if(!zt(e))throw e}})}function Kr(){let e=m.monacoOptions?.MAX_HEIGHT??500;if(typeof e==`number`)return e;let t=String(e).match(/^(\d+(?:\.\d+)?)/);return t?Number.parseFloat(t[1]):500}let qr=v(()=>m.isShowPreview&&(D.value===`html`||D.value===`svg`));function Jr(){return typeof m.node.loading==`boolean`?m.node.loading:!0===m.loading}function Yr(){if(!Jr())return!0;let e=String(m.node.raw??``),t=e.split(/\r\n|\n|\r/,1)[0]?.trimStart()??``;return!/^(?:`{3,}|~{3,})/.test(t)||/\r\n|\n|\r/.test(e)}function Xr(e,t,n){return!n||Yr()&&String(t??``)?ve(String(e??``)):`plain`}function Zr(){return Jr()}let Qr=null,$r=!1,ei=0;function ti(){Qr=null,ei++}function ni(){return M(this,arguments,function*(t=ei){if(!$r){$r=!0;try{for(;Qr&&!L&&!U.value&&t===ei;){let t=Qr;Qr=null;try{yield Promise.resolve(gt(t.code,t.language)),yield e(),L||U.value||(X(!1),Z())}catch{}}}finally{$r=!1,!Qr||L||U.value||ni()}}})}function ri(e,t){Qr={code:e,language:t},ni(ei)}t(()=>[m.node.language,m.node.code,m.node.raw,m.node.loading,m.loading],([e,t,n,r,i])=>{D.value=Xr(e,t,typeof r==`boolean`?r:!0===i)}),t(()=>[m.node.originalCode,m.node.updatedCode,U.value],()=>{R.value=null,lr(),w(()=>ur())},{immediate:!0});let ii=0;t(()=>[m.node.originalCode,m.node.updatedCode,O.value,U.value,m.stream],t=>M(null,[t],function*([,,,t,n]){let r=++ii;if(!t||Jr()||!1===n&&!P.value)return;if(!1!==n&&B&&!P.value&&T.value)try{yield vi(T.value)}catch{}let i=wt;if(i&&!F.value){try{yield i}catch{}if(L||!U.value||r!==ii)return}if(r!==ii)return;let a=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``)),o=!1===m.loading;o&&ki();try{if(yield Gr(a.original,a.updated,O.value),L||!U.value||r!==ii)return;yield e(),Z(!0),Q(),X(!1===m.loading||{preferModelDiffHeight:!0}),Z(!0),$(!0)}catch{return}if(o){if(L||!U.value)return;Bt(),Q(),ur(),$(),Mr(!0)}k.value&&w(()=>Or())})),t(()=>m.node.code,e=>M(null,null,function*(){if(Jr()||!1===m.stream||(D.value||=ve(Et(e)),U.value))return;let t=wt;if(t&&!F.value){try{yield t}catch{}if(L||U.value)return}if(B&&!P.value&&T.value)try{yield vi(T.value)}catch{}ri(Rt(m.node.code),O.value),k.value&&w(()=>Or())}));let ai=v(()=>{let e=D.value;return e?_e[e]||e.charAt(0).toUpperCase()+e.slice(1):_e[``]||`Plain Text`}),oi=v(()=>de(String(m.node.raw??``),ai.value,U.value)),si=v(()=>oi.value.title),ci=v(()=>oi.value.caption),li=v(()=>(fe.value,function(e,t){if(t===void 0)return De(e);if(t){let n=t(e);if(n!=null&&n!==``)return n}return he(ve(e))||le()}(D.value||``,be))),ui=v(()=>{let e={};e[`--markstream-code-layout-character-width`]=_n.value==null?`1ch`:`${_n.value}px`;let t=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},n=t(m.minWidth),r=t(m.maxWidth);if(n&&(e.minWidth=n),r&&(e.maxWidth=r),Fn.value&&!U.value&&!N.value){let t=In.value;t!=null&&(e.minHeight=`${t}px`)}return U.value||(e.color=`var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))`,e.backgroundColor=`var(--vscode-editor-background, var(--markstream-code-fallback-bg))`,e.borderColor=`var(--markstream-code-border-color)`),e}),di=v(()=>!1!==m.showTooltips);function fi(){return M(this,null,function*(){try{typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(m.node.code)),ze.value=!0,te(`copy`,m.node.code),setTimeout(()=>{ze.value=!1},1e3)}catch(e){console.error(`复制失败:`,e)}})}function pi(){k.value=!k.value;let e=U.value?H():V(),t=T.value;e&&t&&(k.value?(gi(!0),t.style.maxHeight=`none`,t.style.overflow=`visible`,X(!0)):(gi(!1),t.style.overflow=U.value?`hidden`:`auto`,X(!0)),Ir(t))}function mi(){var t;if(N.value=!N.value,N.value){if(Qe=!1,T.value){let e=Math.ceil((t=T.value).getBoundingClientRect?.call(t).height||0);Qe=!U.value&&(Pr(T.value,e)||T.value.style.overflow===`auto`||T.value.style.overflowY===`auto`),e>0&&(Ye.value=e)}gi(!1)}else k.value&&gi(!0),T.value&&Ye.value!=null&&(T.value.style.height=`${Ye.value}px`),Ze=2,e(()=>{N.value||L||(X(!0),Z(!0))})}function hi(){if(!qr.value)return;let e=D.value;if(Ie.value){let t=e===`html`?`text/html`:`image/svg+xml`,n=e===`html`?Le(`artifacts.htmlPreviewTitle`)||`HTML Preview`:Le(`artifacts.svgPreviewTitle`)||`SVG Preview`;te(`previewCode`,{node:m.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`});return}e===`html`&&(fn.value=!fn.value)}function gi(e){var t,n;try{if(U.value){let n=H();(t=n?.updateOptions)==null||t.call(n,{automaticLayout:e})}else{let t=V();(n=t?.updateOptions)==null||n.call(t,{automaticLayout:e})}}catch{}}function _i(t){return M(this,null,function*(){if(!B||L)return;let n=Wt.value;if(en=!1,q.value=!1,qt.value=null,F.value=!1,K.value=!1,Kt.value=!1,Xe=null,hn.value=null,gn.value=null,_n.value=null,function(){let e=function(){let e=T.value?.parentElement;return e instanceof HTMLElement?e:null}();e&&(e.style.removeProperty(`--stream-monaco-line-number-left`),e.style.removeProperty(`--stream-monaco-line-number-width`),e.style.removeProperty(`--stream-monaco-line-number-gap-to-code`),e.style.removeProperty(`--stream-monaco-original-line-number-gap-to-code`),e.style.removeProperty(`--stream-monaco-modified-line-number-gap-to-code`),e.style.removeProperty(`--stream-monaco-original-scrollable-left`),e.style.removeProperty(`--stream-monaco-modified-scrollable-left`))}(),jr(),function(){Xt.value=!1;let e=On.value;An.value=I.value||e==null?null:e}(),kr(),Ar(),function(e){e.replaceChildren()}(t),ki(),L)return;let r=M(null,null,function*(){if(n===`diff`){(function(){if(Ot||typeof window>`u`)return;Ot=!0;let e=e=>{zt(`reason`in e?e.reason:e.error??e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener(`error`,e,!0),window.addEventListener(`unhandledrejection`,e,!0),kt=()=>{window.removeEventListener(`error`,e,!0),window.removeEventListener(`unhandledrejection`,e,!0),Ot=!1,kt=null}})(),bt();let e=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``));ht?yield Pe(()=>ht(t,e.original,e.updated,O.value)):yield Pe(()=>B(t,m.node.code,O.value))}else yield Pe(()=>B(t,pn.value,O.value));F.value=!0}).finally(()=>{wt===r&&(wt=null)});if(wt=r,yield function(t){return M(this,null,function*(){if(!U.value)return void(yield t);let n,r=!1;for(t.then(()=>{r=!0},e=>{r=!0,n=e});;){if(L)return;if(r){if(n)throw n;return}if(Lr()&&Ur())return;yield e(),yield Un()}})}(r),L||Wt.value!==n)return;F.value=!0;let i=n===`diff`?H():V();if(typeof m.monacoOptions?.fontSize==`number`)i?.updateOptions({fontSize:m.monacoOptions.fontSize,automaticLayout:!1}),J.value=m.monacoOptions.fontSize,Y.value=m.monacoOptions.fontSize;else if(!xr()){let e=Gn();e&&e>0?(J.value=e,Y.value=e):(J.value=12,Y.value=12)}br(),yield Ti(),k.value||N.value||X(!1),I.value=!0,Gt.value=n,function(){if(kr(),U.value){let e=H(),t=(e?.getOriginalEditor)?.call(e),n=(e?.getModifiedEditor)?.call(e),r=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>$());r&&At.push(r)}catch{}};try{let t=(e?.onDidUpdateDiff)?.call(e,()=>{$(),w(()=>ur())});t&&At.push(t)}catch{}r(t,`onDidContentSizeChange`),r(n,`onDidContentSizeChange`);let i=T.value;if(i&&typeof MutationObserver<`u`){let e=[`.view-line`,`.view-lines`,`.view-zones`,`.margin-view-zones`,`.diff-hidden-lines`,`.stream-monaco-diff-unchanged-bridge`,`.stream-monaco-fallback-inline-delete-zone`,`.stream-monaco-fallback-inline-delete-margin`].join(`,`),t=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!(n?.closest)?.call(n,e)},n=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!((n?.closest)?.call(n,e)||(n?.querySelector)?.call(n,e))},r=new MutationObserver(e=>{U.value&&Hr(i)&&e.some(e=>t(e.target)||Array.from(e.addedNodes).some(n)||Array.from(e.removedNodes).some(t))&&(Q(),X({preferModelDiffHeight:!0}),Z(),Mr())});r.observe(i,{attributeFilter:[`class`],attributes:!0,childList:!0,characterData:!0,subtree:!0}),At.push({dispose:()=>r.disconnect()})}if(i){let e=e=>{if(!(e.target instanceof Element?e.target:null)?.closest([`.stream-monaco-unchanged-summary`,`.stream-monaco-unchanged-reveal`,`.stream-monaco-unchanged-expand`,`.markstream-inline-fold-proxy`,`.diff-hidden-lines .center`].join(`,`)))return;let t=Math.ceil(i.getBoundingClientRect().height||0);t>0&&(R.value=t)};i.addEventListener(`click`,e,!0),At.push({dispose:()=>i.removeEventListener(`click`,e,!0)})}if(i&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{if(!U.value||(Z(),!Hr(i)))return;let e=_r(i);if(e==null)return;let t=Math.ceil(i.getBoundingClientRect().height||0),n=R.value;if(vr(i)&&n!=null){if(t>n+1)R.value=t;else if(te.disconnect()})}return}let e=V();try{let t=(e?.onDidContentSizeChange)?.call(e,()=>$());t&&At.push(t)}catch{}try{let t=(e?.onDidLayoutChange)?.call(e,()=>$());t&&At.push(t)}catch{}}(),Cr(),br(),Q(),ur(),$(),yield e();let a=null;St&&(a=yield St(),a&&(yield e(),yield Un()));let o=a??(n===`diff`?yield Wr({requireHighlight:!0}):yield function(){return M(this,null,function*(){if(Vr())return yield e(),yield Un(),Vr();for(let t=0;t<30;t++){if(L||U.value)return!1;let t=T.value,n=zr(),r=Rr(t),i=!pn.value.trim()||sr(t);if(n&&r&&i&&(yield e(),yield Un(),!L&&!U.value&&zr()&&Rr(T.value)&&(!pn.value.trim()||sr(T.value))))return!0;yield e(),yield Un()}return!1})}());L||(o?(br(),Bn(),(yield zn())||Ii()):Ii())})}function vi(t,n={}){if(!B||L||!1===m.stream&&!1!==m.loading||(Pi(),Fi())||G.value||T.value!==t||Zr())return null;if(Ct)return Ct;if(P.value&&I.value)return Promise.resolve();let r=Mi(),i=Jt.value,a=!1;P.value=!0,function(){let e=Te.value;C&&e&&Je!==e&&(Je&&C.markSettled(Je),Je=e,C.markPending(e))}();let o=M(null,null,function*(){try{yield _i(t),Zt=null}catch(e){let t=Mi(),o=i!==Jt.value,s=!1!==n.allowStaleContentRetry&&o&&Zt!==t;if(r!==t||s)return s&&(Zt=t),a=!0,P.value=!1,I.value=!1,F.value=!1,void(K.value=!1);throw Ii(r),e}}).finally(()=>{Ct===o&&(Ct=null),function(){let t=Je;C&&t&&(Je=``,e(()=>{if(!L){let e=E.value?.offsetHeight??0;e>0&&C.reportHeight(t,e)}C.markSettled(t)}))}(),a&&!L&&queueMicrotask(()=>{var e;let t=T.value;t&&!L&&((e=vi(t))==null||e.catch(e=>{I.value=!1,K.value=!1,Ii()}))})});return Ct=o,o}t(di,e=>{e||Ee()}),t(()=>Y.value,(e,t)=>{let n=U.value?H():V();n&&typeof e==`number`&&Number.isFinite(e)&&e>0&&(n.updateOptions({fontSize:e}),N.value||X(!0))},{flush:`post`,immediate:!1});let yi=0,bi=t(()=>[T.value,U.value,m.stream,m.loading,He.value,z.value,m.node.language,m.node.raw,m.node.code,m.node.loading],e=>M(null,[e],function*([e,t,n,r,i,a]){let o=++yi;if(!e||!a||Jr()||Qt||!1===n&&!1!==r||!B&&(yield function(){return M(this,null,function*(){if(typeof window>`u`||L||He.value||G.value)return;if(Tt)return Tt;let e=M(null,null,function*(){try{let e=yield Re();if(L)return;if(!e)return void(G.value=!0);let t=e.useMonaco,n=e.detectLanguage;if(typeof n==`function`&&(Et=n),typeof t!=`function`)return;Mt=Oi();let r=t(Mt);B=r.createEditor||B,ht=r.createDiffEditor||ht,gt=r.updateCode||gt,_t=r.updateDiff||_t,vt=r.getEditor||vt,V=r.getEditorView||V,H=r.getDiffEditorView||H,yt=r.cleanupEditor||yt,bt=r.safeClean||r.cleanupEditor||bt,xt=r.refreshDiffPresentation||xt,Dt=r.setTheme||Dt,St=r.whenVisualReady||null,He.value=!0}catch{if(L)return;G.value=!0}}).finally(()=>{Tt===e&&(Tt=null)});return Tt=e,e})}(),o!==yi||!1===m.stream&&!1!==m.loading||Zr()||!z.value||!B||G.value||P.value||Fi()||L||T.value!==e)||Zr())return;let s=vi(e);if(s){try{yield s}catch{I.value=!1,K.value=!1,Ii()}I.value&&K.value&&bi()}}));function xi(e){return!!e&&typeof e==`object`&&`light`in e&&`dark`in e}function Si(e){return typeof e==`string`?e:e&&typeof e==`object`&&`name`in e?String(e.name):null}function Ci(e,t){if(e===t)return!0;let n=Si(e),r=Si(t);return!!n&&n===r}function wi(){let e=function(){if(m.theme!==void 0){let e=m.theme;return xi(e)?m.isDark?e.dark:e.light:e}return m.isDark?m.darkTheme:m.lightTheme}(),t=W.value?.theme,n=e??t;if(typeof n==`object`&&n)return n;let r=Array.isArray(m.themes)?m.themes:[];if(!r.length||n==null)return n;let i=Si(n),a=r.map(e=>Si(e)).filter(e=>!!e);if(!i||a.includes(i))return n;let o=Si(t);return t!=null&&o&&a.includes(o)?t:r[0]}function Ti(){return M(this,arguments,function*(e={}){ki();let t=()=>{U.value&&Bt(),w(()=>{Cr(),$()})};if(e.appearanceOnly)return void t();let n=wi();if(n)try{yield Dt(n),t()}catch{}else t()})}function Ei(e,t){if(typeof t!=`string`)return;let n=ve(t),r=ye(n),i=[`plain`,`objectivec`,`objectivecpp`].includes(n)?r:n;for(let t of[i,r])t&&!e.includes(t)&&e.push(t)}t(Wt,(t,n)=>M(null,null,function*(){if(t===n||q.value||Qt||(ti(),!B||!T.value)||!P.value||!1===m.stream&&!1!==m.loading||!z.value)return;let r=Ct;if(r){try{yield r}catch{}if(L||!T.value)return}if(Gt.value!==t||!P.value||!I.value)try{I.value=!1,K.value=!1,P.value=!1,F.value=!1,kr(),Ar(),bt(),yield e(),yield vi(T.value)}catch{I.value=!1,K.value=!1,Ii()}}));let Di=v(()=>{let e=[],t=W.value?.languages;if(Array.isArray(t))for(let n of t)Ei(e,n);return Yr()&&Ei(e,m.node.language),Ei(e,D.value),Ei(e,O.value),Ei(e,`plaintext`),e});function Oi(){let e=j(A(j(A({wordWrap:`on`,wrappingIndent:`same`,themes:m.themes},W.value||{}),{languages:Di.value,stream:!1,fontSize:yn.value,lineHeight:xn.value,theme:wi(),disableFileHeader:!0}),U.value?{diffAppearance:Ht.value}:{}),{onThemeChange(){Cr()}}),t=function(){let e=W.value?.fontFamily;return typeof e==`string`&&e.trim()?e.trim():U.value?function(){if(typeof window>`u`)return;let e=E.value?.querySelector(`pre.code-pre-fallback`);if(e)return window.getComputedStyle(e).fontFamily.trim()||void 0}():void 0}();if(t&&(e.fontFamily??=t),U.value){e.wordWrap=tn.value?`on`:`off`;let t=typeof e.unsafeCSS==`string`?`${e.unsafeCSS}\n`:``,n=function(){let e=rn.value;if(!1===e||typeof e==`object`&&!1===e.enabled)return null;let t=typeof e==`object`?e:ue,n=Math.max(0,Math.floor(t.contextLineCount??2));return{contextLineCount:n,collapsedContextThreshold:n+Math.max(1,Math.floor(t.minimumLineCount??4))-1}}();e.unsafeCSS=`${t}\npre { column-gap: 0; }\npre > code { column-gap: 0; padding-block: 0; }\n[data-separator="line-info"] { margin-top: 0; }\n`,n?(e.parseDiffOptions=j(A({},e.parseDiffOptions),{context:n.contextLineCount}),e.collapsedContextThreshold=n.collapsedContextThreshold,e.expandUnchanged=!1,e.hunkSeparators=`line-info`,e.unsafeCSS+=`[data-separator="line-info"][data-separator-last] { height: 28px; } `):(e.expandUnchanged=!0,e.hunkSeparators=`simple`)}return e}function ki(){let e=Oi();if(!Mt)return Mt=e,Mt;for(let t of Object.keys(Mt))t in e||delete Mt[t];return Object.assign(Mt,e),Mt}let Ai=v(()=>{var e,t,n,r,i;return JSON.stringify({diffLineStyle:W.value?.diffLineStyle??`background`,diffUnchangedRegionStyle:W.value?.diffUnchangedRegionStyle??`line-info`,diffHideUnchangedRegions:m.monacoOptions?.diffHideUnchangedRegions===void 0?A({},ue):we(m.monacoOptions.diffHideUnchangedRegions),renderSideBySide:(e=W.value?.renderSideBySide)==null||e,useInlineViewWhenSpaceIsLimited:(t=W.value?.useInlineViewWhenSpaceIsLimited)!=null&&t,enableSplitViewResizing:(n=W.value?.enableSplitViewResizing)==null||n,ignoreTrimWhitespace:(r=W.value?.ignoreTrimWhitespace)==null||r,originalEditable:(i=W.value?.originalEditable)!=null&&i})}),ji=y(0);function Mi(){let e=wi();return JSON.stringify({kind:Wt.value,language:O.value,structural:Ai.value,optionsRevision:ji.value,settledContentGeneration:Yt.value,theme:Si(e)??(e==null?null:`custom`),isDark:m.isDark})}t(()=>[m.monacoOptions,m.theme,m.themes,m.lightTheme,m.darkTheme],()=>{ji.value+=1},{deep:!0}),t(()=>[pn.value,m.node.originalCode,m.node.updatedCode],()=>{Jt.value+=1,Jr()||(Yt.value+=1)});let Ni=v(()=>Mi());function Pi(){q.value&&qt.value!==Ni.value&&(q.value=!1,qt.value=null,Zt=null,$t=null,P.value=!1,I.value=!1,F.value=!1,K.value=!1,Kt.value=!1)}function Fi(){return Pi(),q.value&&qt.value===Ni.value}function Ii(e=Ni.value){qt.value=e,q.value=!0,Kt.value=!1}return t(Ni,()=>M(null,null,function*(){if(Qt||!q.value||qt.value===Ni.value||!B||!T.value||G.value||L||!z.value||!1===m.stream&&!1!==m.loading||Zr())return;let t=Ni.value;Qt=!0;try{if(Pi(),q.value)return;yield vi(T.value)}catch{I.value=!1,K.value=!1,Ii()}finally{$t=t,yield e(),Qt=!1}})),t(()=>[m.monacoOptions,z.value],()=>{var e;if(ki(),!B||!z.value)return;let t=U.value?H():V(),n=typeof m.monacoOptions?.fontSize==`number`?m.monacoOptions.fontSize:Number.isFinite(Y.value)?Y.value:void 0;typeof n==`number`&&Number.isFinite(n)&&n>0&&((e=t?.updateOptions)==null||e.call(t,{fontSize:n})),X(!1)},{deep:!0}),t(()=>[wi(),Ht.value,He.value,P.value,z.value],([e],t)=>{He.value&&I.value&&z.value&&Ti({appearanceOnly:t!=null&&Ci(e,t[0])})},{flush:`post`}),t(()=>[Ai.value,He.value,z.value],(t,n)=>M(null,[t,n],function*([t,n,r],[i]){if(ki(),!n||!r||!B||!T.value||!P.value||t===i||!1===m.stream&&!1!==m.loading)return;let a=Ct;if(a){try{yield a}catch{}if(L||!T.value)return}try{I.value=!1,K.value=!1,P.value=!1,F.value=!1,kr(),Ar(),bt(),yield e(),yield vi(T.value,{allowStaleContentRetry:!1})}catch{I.value=!1,K.value=!1,Ii()}}),{flush:`post`}),t(()=>[m.loading,z.value],(t,n)=>M(null,[t,n],function*([t,n],r){if(!n)return;let i=r?.[0];if(!1===i&&!1!==t&&U.value&&P.value&&(yield e(),w(()=>{M(null,null,function*(){let e=Ct;if(e)try{yield e}catch{}!L&&U.value&&!1!==m.loading&&(ki(),Bt(),$())})})),t)return;let a=i!==void 0&&!1!==i;yield e(),w(()=>{M(null,null,function*(){try{if(a&&(yield function(){return M(this,null,function*(){if(!q.value||!B||!T.value||G.value||L||!z.value)return!1;if($t===Ni.value)return!0;Qt=!0;try{q.value=!1,qt.value=null,Zt=null,P.value=!1,I.value=!1,F.value=!1,K.value=!1,kr(),Ar(),bt(),yield e();try{yield vi(T.value)}catch{I.value=!1,K.value=!1,Ii()}}finally{yield e(),Qt=!1}return!0})}()))return void X(!1);if(a&&U.value&&P.value&&en&&T.value)return en=!1,I.value=!1,K.value=!1,P.value=!1,F.value=!1,kr(),Ar(),bt(),yield e(),yield vi(T.value,{allowStaleContentRetry:!1}),void Mr(!0);if(a&&P.value)if(U.value&&T.value){let e=Ct;if(e)try{yield e}catch{}ki();let t=Lt(String(m.node.originalCode??``),String(m.node.updatedCode??``));if(yield Gr(t.original,t.updated,O.value),L||!U.value)return;Bt(),Z(!0),Rn(),Q(),ur();let n=yield Wr({requireHighlight:!0});L||!n||K.value||(yield zn()),$(),Mr(!0)}else ti(),ri(pn.value,O.value);a&&U.value?(X({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),Mr(!0)):X(!1)}catch{}})})}),{immediate:!0,flush:`post`}),o(()=>{kr(),Ar(),yt(),kt?.()}),(e,t)=>G.value?(n(),h(b(Oe),{key:0,class:ie([`code-pre-fallback`,{"is-wrap":tn.value}]),style:ee(Pn.value),node:mn.value,loading:m.loading,"show-line-numbers":!0,"diff-inline":nn.value,"diff-hide-unchanged-regions":rn.value},null,8,[`class`,`style`,`node`,`loading`,`diff-inline`,`diff-hide-unchanged-regions`])):(n(),S(`div`,{key:1,ref_key:`container`,ref:E,style:ee(ui.value),class:ie([`code-block-container rounded-lg border`,[{dark:m.isDark,"is-rendering":m.loading,"is-dark":Ut.value,"is-diff":U.value,"is-plain-text":Ve.value}]]),"data-markstream-code-block":`1`,"data-markstream-enhanced":K.value&&!G.value?`true`:`false`,"data-markstream-enhancement-state":dn.value,"data-markstream-code-block-state":Jr()?`streaming`:`settled`,"data-markstream-pending":un.value?`true`:void 0,"data-markstream-viewport-pending":mt.value&&b(nt)&&!z.value?`true`:void 0},[s(et,{"show-header":m.showHeader,"show-collapse-button":m.showCollapseButton,"show-font-size-buttons":m.showFontSizeButtons,"enable-font-size-control":m.enableFontSizeControl,"show-copy-button":m.showCopyButton,"show-expand-button":m.showExpandButton,"show-preview-button":m.showPreviewButton,"show-tooltips":m.showTooltips,"is-dark":m.isDark,loading:m.loading,stream:d.stream,"is-collapsed":N.value,"is-expanded":k.value,"copy-text":ze.value,"is-previewable":qr.value,"code-font-size":Y.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":J.value,"font-baseline-ready":vn.value,"diff-stats":U.value?Nt.value:null,"diff-stats-aria-label":Pt.value,onToggleCollapse:mi,onDecreaseFont:pr,onResetFont:mr,onIncreaseFont:fr,onCopy:fi,onToggleExpand:pi,onPreview:hi},oe({"header-left":ne(()=>[se(e.$slots,`header-left`,{},()=>[g(`div`,ot,[g(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`,innerHTML:li.value},null,8,st),g(`div`,ct,[g(`div`,lt,x(si.value),1),ci.value?(n(),S(`div`,ut,x(ci.value),1)):u(``,!0)])])],!0)]),loading:ne(()=>[se(e.$slots,`loading`,{loading:d.loading,stream:d.stream},()=>[t[0]||=g(`div`,{class:`loading-skeleton`},[g(`div`,{class:`skeleton-line`}),g(`div`,{class:`skeleton-line`}),g(`div`,{class:`skeleton-line short`})],-1)],!0)]),default:ne(()=>[r(g(`div`,{class:ie([`code-editor-layer`,{"code-editor-layer--collapsed":N.value}])},[g(`div`,{ref_key:`codeEditor`,ref:T,class:ie([`code-editor-container`,d.stream?``:`code-height-placeholder`]),"data-markstream-host-hidden":ln.value?`true`:void 0,style:ee(Ln.value)},null,14,dt),cn.value?(n(),h(b(Oe),{key:0,class:ie([`code-pre-fallback`,{"is-wrap":tn.value}]),style:ee(Pn.value),node:mn.value,"show-line-numbers":!0,"diff-inline":nn.value,"diff-hide-unchanged-regions":rn.value},null,8,[`class`,`style`,`node`,`diff-inline`,`diff-hide-unchanged-regions`])):u(``,!0)],2),[[f,!!d.stream||!d.loading]]),fn.value&&!Ie.value&&qr.value&&D.value===`html`?(n(),h(it,{key:0,code:m.node.code,"html-preview-allow-scripts":m.htmlPreviewAllowScripts,"html-preview-sandbox":m.htmlPreviewSandbox,"is-dark":m.isDark,"on-close":()=>fn.value=!1},null,8,[`code`,`html-preview-allow-scripts`,`html-preview-sandbox`,`is-dark`,`on-close`])):u(``,!0)]),_:2},[e.$slots[`header-right`]?{name:`header-right`,fn:ne(()=>[se(e.$slots,`header-right`,{},void 0,!0)]),key:`0`}:void 0]),1032,[`show-header`,`show-collapse-button`,`show-font-size-buttons`,`enable-font-size-control`,`show-copy-button`,`show-expand-button`,`show-preview-button`,`show-tooltips`,`is-dark`,`loading`,`stream`,`is-collapsed`,`is-expanded`,`copy-text`,`is-previewable`,`code-font-size`,`default-code-font-size`,`font-baseline-ready`,`diff-stats`,`diff-stats-aria-label`])],14,at))}}),[[`__scopeId`,`data-v-72200115`]]);export{pt as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/DesignSystemView-BO8F15GQ.js b/apps/pythinker-code/dist-web/assets/DesignSystemView-CC7yy3PX.js similarity index 99% rename from apps/pythinker-code/dist-web/assets/DesignSystemView-BO8F15GQ.js rename to apps/pythinker-code/dist-web/assets/DesignSystemView-CC7yy3PX.js index 19a4bdd93..100aaafe0 100644 --- a/apps/pythinker-code/dist-web/assets/DesignSystemView-BO8F15GQ.js +++ b/apps/pythinker-code/dist-web/assets/DesignSystemView-CC7yy3PX.js @@ -1,4 +1,4 @@ -import{I as e,N as t,P as n,R as r,S as i,b as a,d as o,h as s,ot as ee,ut as c,v as l,w as te,x as u}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{at as ne,it as d,ot as re,st as f,t as p}from"./index-DAFMRqR8.js";var ie={class:`ds-page`},m={class:`layout`},h={class:`content`},g={class:`content-inner`},_={id:`tokens`},v={class:`icon-sizes`},y={class:`sz`},b={class:`p-ic`,style:{width:`14px`,height:`14px`},viewBox:`0 0 24 24`,fill:`currentColor`},x={class:`sz`},S={class:`p-ic`,style:{width:`16px`,height:`16px`},viewBox:`0 0 24 24`,fill:`currentColor`},C={class:`sz`},w={class:`p-ic`,style:{width:`20px`,height:`20px`},viewBox:`0 0 24 24`,fill:`currentColor`},T={class:`icon-grid`},E={class:`icon-group-label`},D={class:`ic-name`},O={id:`primitives`},k={class:`stage-wrap`},A={class:`stage p col`},j={class:`demo-row`},M={class:`p-btn primary disabled`},N={class:`p-spinner sm`,viewBox:`0 0 24 24`,style:{"--p-accent":`#fff`,"--p-line":`rgba(255,255,255,.35)`}},P={class:`stage-wrap`},F={class:`stage p col`},I={class:`demo-row`,style:{"font-size":`22px`,"line-height":`1`}},L={class:`demo-row`},ae={class:`p-thinking`},R={class:`p-thinking`},z={class:`stage-wrap`},B={class:`stage p col`},V={class:`demo-row`,style:{gap:`24px`,"flex-wrap":`wrap`}},H={class:`demo-row`,style:{gap:`24px`,"align-items":`center`}},U={class:`stage-wrap`},W={class:`stage p col`,style:{gap:`0`,background:`var(--p-surface)`,padding:`0`,"max-width":`300px`,"align-items":`stretch`}},G={style:{display:`flex`,"align-items":`center`,gap:`8px`,padding:`7px 10px`,margin:`1px 6px`,"border-radius":`8px`,color:`var(--p-text)`,"font-size":`13px`}},K={style:{color:`var(--d-fg-faint)`,flex:`none`},width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`currentColor`},q={style:{display:`flex`,"align-items":`center`,gap:`8px`,padding:`7px 10px`,margin:`1px 6px`,"border-radius":`8px`,color:`var(--p-text)`,"font-size":`13px`}},J={style:{color:`var(--d-fg-faint)`,flex:`none`},width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`currentColor`},oe={id:`chat`},se={class:`stage-wrap`},ce={class:`stage p col`,style:{"align-items":`center`,background:`#fff`}},le={class:`demo-chat`},ue={class:`p-thinking`},Y={class:`p-action`},de={class:`p-action-head`},fe={class:`p-ic`,style:{color:`var(--p-accent)`},viewBox:`0 0 24 24`,fill:`currentColor`},pe={class:`p-action warn`},me={class:`p-action-head`},he={class:`p-ic`,style:{color:`var(--p-warning)`},viewBox:`0 0 24 24`,fill:`currentColor`},X=f(te({__name:`DesignSystemView`,emits:[`close`],setup(te,{emit:f}){let X=f;function Z(){X(`close`)}let Q=null;function $(e){e.key===`Escape`&&Z()}return t(()=>{document.addEventListener(`keydown`,$);let e=Array.prototype.slice.call(document.querySelectorAll(`#nav a[href^="#"]`)),t=new Map;e.forEach(e=>{let n=e.getAttribute(`href`);if(!n)return;let r=document.getElementById(n.slice(1));r&&t.set(r,e)});let n=null;Q=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(n&&n.classList.remove(`active`),n=t.get(e.target)??null,n&&n.classList.add(`active`))})},{rootMargin:`-20% 0px -70% 0px`,threshold:0}),t.forEach((e,t)=>Q.observe(t)),e.length&&e[0].classList.add(`active`)}),n(()=>{document.removeEventListener(`keydown`,$),Q&&=(Q.disconnect(),null)}),(t,n)=>(e(),l(`div`,ie,[s(`div`,{class:`ds-topbar`},[s(`button`,{class:`ds-back`,type:`button`,onClick:Z},`← Back`),n[0]||=s(`span`,{class:`ds-topbar-title`},`Design system`,-1)]),s(`div`,m,[n[51]||=a(``,1),s(`main`,h,[s(`div`,g,[n[49]||=a(`
● Design System · v1.0

Pythinker Web Design System

This document defines the visual language and component specification for Pythinker Web — design tokens, component primitives, the chat interface, theming, and style rules. All UI work is grounded in it: unified, restrained, token-driven, and themeable.

Scope apps/pythinker-webComponent primitivesTheme 1 set · 4 customizable colorsLight / dark mode
i
This spec is the single reference when changing the web UI. Before adding or modifying a component, style, layout, or theme, read this document first; color, font, radius, spacing, shadow, z-index, and motion always use the §02 tokens, components reuse the §03 primitives, and the §06 style rules are followed.
01

Design Principles

Every UI decision traces back to the following principles. Pythinker Web is a local Agent tool for developers: quick scanning, long stretches of staring, often in the dark — the design serves the task, and is restrained, clinical, and density-first.

  • Consistency —— The same semantics use the same component. The primary button, dialog, input, and badge should each have exactly "one" correct way to be written across the entire site.
  • Hierarchy —— Build a clear hierarchy through size, weight, color, and whitespace; emphasize through "restraint" rather than "bolder and bigger".
  • Proximity —— Group related elements, leave whitespace between unrelated ones. A card's padding, line spacing, and group spacing all come from the same spacing scale.
  • Feedback —— hover / active / focus / loading / success / error all have visible states, and the state language is unified.
  • Breathing room —— Control density with the spacing scale rather than arbitrary pixels; prefer restrained whitespace over cramming controls together.
  • Accessibility (A11y) —— Text contrast ≥ 4.5:1, visible focus rings, touch targets ≥ 32px, and states that don't rely on color alone.
  • Reduction —— The number of colors, radii, shadow levels, and type sizes all converge to a finite set of tokens; delete stray values.
✓
Brand tone (the do-not list): calm, clinical, never exaggerated. Reject purple gradients, glassmorphism, glowing shadows, AI purple / blue glows, endlessly looping fussy micro-animations, "Boost your productivity"-style marketing copy, and using emoji as icons. These are all common tells of AI-generated interfaces (an "AI tell"), deliberately avoided.
i
Declare design intent first (Design Read): before adding a component / page, write one sentence describing its scenario, audience, and tone (for example, "a lightweight tool card embedded in a conversation, for developers, calm and restrained"), then build. If the intent isn't clear, ask one question first rather than defaulting to the nearest existing style.
`,2),s(`section`,_,[n[7]||=a(`
02

Design Tokens

Collapse every visual decision into tokens. Color tokens keep the existing short names and fill out the semantics (lowering migration cost), while spacing, z-index, motion, and font-weight fill in the scales that are currently missing. Every token has: name, light value, dark value, and usage.

i
Naming convention: --<category>-<role>-<state>. For example --color-text-muted, --radius-md, --space-4. To reduce churn, the existing short names (--bg / --ink / --line / --blue …) are kept as compatibility aliases for one release cycle.

Color

Semantic-first, in three layers: background / text / border + accent + status colors. All colors are defined in light / dark pairs, with contrast ≥ 4.5:1.

i
The table below shows the derived semantic tokens. The neutrals and the accent are derived from the 4 color seeds in §05 — for example --color-accent comes from --accent-primary, and --color-bg comes from the current light / dark surface. The semantic status colors (success / warning / danger / info) are independent palettes paired with the seeds, one set each for light / dark; they are not auto-derived from the seeds. Day-to-day reskinning usually only needs the 4 seeds, with the status colors fine-tuned as needed.
bg
#ffffff / #121212
surface
#fafbfc / #1f1f1f
surface-sunken
#f3f5f8 / #121212
selected
#eceff3 / #2d333b
fg
#14171c / #e8eaed
fg-muted
#6b7280 / #9aa0a8
line
#e7eaee / #2d333b
accent (KMBlue)
#1783ff / #58a6ff
accent-soft
#e8f3ff / rgba(88,166,255,.14)
TokenLightDarkUsage
--color-bg#ffffff#121212Page background
--color-surface#fafbfc#1f1f1fPanel / sidebar / card head
--color-surface-raised#ffffff#292929Raised card / dialog / input
--color-text#14171c#e8eaedBody text / headings
--color-text-muted#6b7280#9aa0a8Secondary text / placeholder
--color-line#e7eaee#2d333bDivider / card border
--color-selected#00000014#ffffff14Neutral selected fill (sidebar rows, list pickers) — translucent, never accent-tinted
--color-hover#0000000d#ffffff0dRow hover wash — lighter than the selected fill (hover < selected); translucent, sits on any surface
--color-media-alpha-bg-1≈#858585≈#676b72Checkerboard square A of the <img> alpha canvas — color-mix of --color-bg/--color-text (52/48); applied via --media-alpha-canvas (16px period)
--color-media-alpha-bg-2≈#6b6b6b≈#7a7e85Checkerboard square B (42/58) — both squares stay ≥3:1 against white and black; opaque images cover the canvas
--color-sidebar-bg#e9eaf2#2c343aSidebar solid composite (row masks / overlays). The visible sidebar surface is the frost pair --color-sidebar-glass + --sidebar-wash blurred by --p-sidebar-backdrop
--color-accent#1783ff#58a6ffPrimary action / link / focus
--color-success#0e7a38#3fb950Success / pass
--color-warning#a9610a#d29922Warning / pending
--color-danger#c0392b#f85149Danger / error / abort

Surface usage

The four surface layers each have a role — choose by "raised layer / default flat layer / sunken layer / page background", and avoid treating --p-surface-raised as a universal background.

TokenLightDarkUsage
--p-surface-raised#ffffff#292929Raised card / dialog / input (raised layer)
--p-surface#fafbfc#1f1f1fPanel / sidebar / card head (default flat layer)
--p-surface-sunken#f3f5f8#121212Code block / inline input / recessed area (sunken layer)
--p-bg#ffffff#121212Page background

Focus ring

All focusable controls (button, input, link, menu item, switch, checkbox) use the focus-ring token uniformly; do not hand-write a box-shadow focus ring.

TokenValueUsage
--p-focus-ring0 0 0 3px var(--p-accent-soft)Default focus ring (link, menu item, switch, checkbox)
--p-focus-ring-strong0 0 0 3px var(--p-accent-soft), 0 0 0 1px var(--p-accent)Strong focus ring (button, primary action)

Text selection

The text-selection color uses --p-selection uniformly (light rgba(23,131,255,.18) / dark rgba(88,166,255,.32)), applied by the global ::selection rule; do not set a separate highlight background.

Disabled state

All disabled controls use opacity:.5 + cursor:not-allowed uniformly; do not separately grey out or recolor.

Font families

Pythinker Web uses two font families: --font-ui (UI and body, Inter first) and --font-mono (code and monospace). Components always reference the variables; do not hard-code font names.

--font-ui · UI & body (Inter first)

Body and UI use self-hosted Inter as the primary face. CJK and platform system UI fonts sit late in the fallback chain so Latin glyphs resolve to Inter while Chinese text can fall through to native CJK fonts:

--font-ui
--font-ui: "Inter Variable", "Inter", "Helvetica Neue", Arial,
+import{I as e,N as t,P as n,R as r,S as i,b as a,d as o,h as s,ot as ee,ut as c,v as l,w as te,x as u}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{at as ne,it as d,ot as re,st as f,t as p}from"./index-CJN6blp7.js";var ie={class:`ds-page`},m={class:`layout`},h={class:`content`},g={class:`content-inner`},_={id:`tokens`},v={class:`icon-sizes`},y={class:`sz`},b={class:`p-ic`,style:{width:`14px`,height:`14px`},viewBox:`0 0 24 24`,fill:`currentColor`},x={class:`sz`},S={class:`p-ic`,style:{width:`16px`,height:`16px`},viewBox:`0 0 24 24`,fill:`currentColor`},C={class:`sz`},w={class:`p-ic`,style:{width:`20px`,height:`20px`},viewBox:`0 0 24 24`,fill:`currentColor`},T={class:`icon-grid`},E={class:`icon-group-label`},D={class:`ic-name`},O={id:`primitives`},k={class:`stage-wrap`},A={class:`stage p col`},j={class:`demo-row`},M={class:`p-btn primary disabled`},N={class:`p-spinner sm`,viewBox:`0 0 24 24`,style:{"--p-accent":`#fff`,"--p-line":`rgba(255,255,255,.35)`}},P={class:`stage-wrap`},F={class:`stage p col`},I={class:`demo-row`,style:{"font-size":`22px`,"line-height":`1`}},L={class:`demo-row`},ae={class:`p-thinking`},R={class:`p-thinking`},z={class:`stage-wrap`},B={class:`stage p col`},V={class:`demo-row`,style:{gap:`24px`,"flex-wrap":`wrap`}},H={class:`demo-row`,style:{gap:`24px`,"align-items":`center`}},U={class:`stage-wrap`},W={class:`stage p col`,style:{gap:`0`,background:`var(--p-surface)`,padding:`0`,"max-width":`300px`,"align-items":`stretch`}},G={style:{display:`flex`,"align-items":`center`,gap:`8px`,padding:`7px 10px`,margin:`1px 6px`,"border-radius":`8px`,color:`var(--p-text)`,"font-size":`13px`}},K={style:{color:`var(--d-fg-faint)`,flex:`none`},width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`currentColor`},q={style:{display:`flex`,"align-items":`center`,gap:`8px`,padding:`7px 10px`,margin:`1px 6px`,"border-radius":`8px`,color:`var(--p-text)`,"font-size":`13px`}},J={style:{color:`var(--d-fg-faint)`,flex:`none`},width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`currentColor`},oe={id:`chat`},se={class:`stage-wrap`},ce={class:`stage p col`,style:{"align-items":`center`,background:`#fff`}},le={class:`demo-chat`},ue={class:`p-thinking`},Y={class:`p-action`},de={class:`p-action-head`},fe={class:`p-ic`,style:{color:`var(--p-accent)`},viewBox:`0 0 24 24`,fill:`currentColor`},pe={class:`p-action warn`},me={class:`p-action-head`},he={class:`p-ic`,style:{color:`var(--p-warning)`},viewBox:`0 0 24 24`,fill:`currentColor`},X=f(te({__name:`DesignSystemView`,emits:[`close`],setup(te,{emit:f}){let X=f;function Z(){X(`close`)}let Q=null;function $(e){e.key===`Escape`&&Z()}return t(()=>{document.addEventListener(`keydown`,$);let e=Array.prototype.slice.call(document.querySelectorAll(`#nav a[href^="#"]`)),t=new Map;e.forEach(e=>{let n=e.getAttribute(`href`);if(!n)return;let r=document.getElementById(n.slice(1));r&&t.set(r,e)});let n=null;Q=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(n&&n.classList.remove(`active`),n=t.get(e.target)??null,n&&n.classList.add(`active`))})},{rootMargin:`-20% 0px -70% 0px`,threshold:0}),t.forEach((e,t)=>Q.observe(t)),e.length&&e[0].classList.add(`active`)}),n(()=>{document.removeEventListener(`keydown`,$),Q&&=(Q.disconnect(),null)}),(t,n)=>(e(),l(`div`,ie,[s(`div`,{class:`ds-topbar`},[s(`button`,{class:`ds-back`,type:`button`,onClick:Z},`← Back`),n[0]||=s(`span`,{class:`ds-topbar-title`},`Design system`,-1)]),s(`div`,m,[n[51]||=a(``,1),s(`main`,h,[s(`div`,g,[n[49]||=a(`
● Design System · v1.0

Pythinker Web Design System

This document defines the visual language and component specification for Pythinker Web — design tokens, component primitives, the chat interface, theming, and style rules. All UI work is grounded in it: unified, restrained, token-driven, and themeable.

Scope apps/pythinker-webComponent primitivesTheme 1 set · 4 customizable colorsLight / dark mode
i
This spec is the single reference when changing the web UI. Before adding or modifying a component, style, layout, or theme, read this document first; color, font, radius, spacing, shadow, z-index, and motion always use the §02 tokens, components reuse the §03 primitives, and the §06 style rules are followed.
01

Design Principles

Every UI decision traces back to the following principles. Pythinker Web is a local Agent tool for developers: quick scanning, long stretches of staring, often in the dark — the design serves the task, and is restrained, clinical, and density-first.

  • Consistency —— The same semantics use the same component. The primary button, dialog, input, and badge should each have exactly "one" correct way to be written across the entire site.
  • Hierarchy —— Build a clear hierarchy through size, weight, color, and whitespace; emphasize through "restraint" rather than "bolder and bigger".
  • Proximity —— Group related elements, leave whitespace between unrelated ones. A card's padding, line spacing, and group spacing all come from the same spacing scale.
  • Feedback —— hover / active / focus / loading / success / error all have visible states, and the state language is unified.
  • Breathing room —— Control density with the spacing scale rather than arbitrary pixels; prefer restrained whitespace over cramming controls together.
  • Accessibility (A11y) —— Text contrast ≥ 4.5:1, visible focus rings, touch targets ≥ 32px, and states that don't rely on color alone.
  • Reduction —— The number of colors, radii, shadow levels, and type sizes all converge to a finite set of tokens; delete stray values.
✓
Brand tone (the do-not list): calm, clinical, never exaggerated. Reject purple gradients, glassmorphism, glowing shadows, AI purple / blue glows, endlessly looping fussy micro-animations, "Boost your productivity"-style marketing copy, and using emoji as icons. These are all common tells of AI-generated interfaces (an "AI tell"), deliberately avoided.
i
Declare design intent first (Design Read): before adding a component / page, write one sentence describing its scenario, audience, and tone (for example, "a lightweight tool card embedded in a conversation, for developers, calm and restrained"), then build. If the intent isn't clear, ask one question first rather than defaulting to the nearest existing style.
`,2),s(`section`,_,[n[7]||=a(`
02

Design Tokens

Collapse every visual decision into tokens. Color tokens keep the existing short names and fill out the semantics (lowering migration cost), while spacing, z-index, motion, and font-weight fill in the scales that are currently missing. Every token has: name, light value, dark value, and usage.

i
Naming convention: --<category>-<role>-<state>. For example --color-text-muted, --radius-md, --space-4. To reduce churn, the existing short names (--bg / --ink / --line / --blue …) are kept as compatibility aliases for one release cycle.

Color

Semantic-first, in three layers: background / text / border + accent + status colors. All colors are defined in light / dark pairs, with contrast ≥ 4.5:1.

i
The table below shows the derived semantic tokens. The neutrals and the accent are derived from the 4 color seeds in §05 — for example --color-accent comes from --accent-primary, and --color-bg comes from the current light / dark surface. The semantic status colors (success / warning / danger / info) are independent palettes paired with the seeds, one set each for light / dark; they are not auto-derived from the seeds. Day-to-day reskinning usually only needs the 4 seeds, with the status colors fine-tuned as needed.
bg
#ffffff / #121212
surface
#fafbfc / #1f1f1f
surface-sunken
#f3f5f8 / #121212
selected
#eceff3 / #2d333b
fg
#14171c / #e8eaed
fg-muted
#6b7280 / #9aa0a8
line
#e7eaee / #2d333b
accent (KMBlue)
#1783ff / #58a6ff
accent-soft
#e8f3ff / rgba(88,166,255,.14)
TokenLightDarkUsage
--color-bg#ffffff#121212Page background
--color-surface#fafbfc#1f1f1fPanel / sidebar / card head
--color-surface-raised#ffffff#292929Raised card / dialog / input
--color-text#14171c#e8eaedBody text / headings
--color-text-muted#6b7280#9aa0a8Secondary text / placeholder
--color-line#e7eaee#2d333bDivider / card border
--color-selected#00000014#ffffff14Neutral selected fill (sidebar rows, list pickers) — translucent, never accent-tinted
--color-hover#0000000d#ffffff0dRow hover wash — lighter than the selected fill (hover < selected); translucent, sits on any surface
--color-media-alpha-bg-1≈#858585≈#676b72Checkerboard square A of the <img> alpha canvas — color-mix of --color-bg/--color-text (52/48); applied via --media-alpha-canvas (16px period)
--color-media-alpha-bg-2≈#6b6b6b≈#7a7e85Checkerboard square B (42/58) — both squares stay ≥3:1 against white and black; opaque images cover the canvas
--color-sidebar-bg#e9eaf2#2c343aSidebar solid composite (row masks / overlays). The visible sidebar surface is the frost pair --color-sidebar-glass + --sidebar-wash blurred by --p-sidebar-backdrop
--color-accent#1783ff#58a6ffPrimary action / link / focus
--color-success#0e7a38#3fb950Success / pass
--color-warning#a9610a#d29922Warning / pending
--color-danger#c0392b#f85149Danger / error / abort

Surface usage

The four surface layers each have a role — choose by "raised layer / default flat layer / sunken layer / page background", and avoid treating --p-surface-raised as a universal background.

TokenLightDarkUsage
--p-surface-raised#ffffff#292929Raised card / dialog / input (raised layer)
--p-surface#fafbfc#1f1f1fPanel / sidebar / card head (default flat layer)
--p-surface-sunken#f3f5f8#121212Code block / inline input / recessed area (sunken layer)
--p-bg#ffffff#121212Page background

Focus ring

All focusable controls (button, input, link, menu item, switch, checkbox) use the focus-ring token uniformly; do not hand-write a box-shadow focus ring.

TokenValueUsage
--p-focus-ring0 0 0 3px var(--p-accent-soft)Default focus ring (link, menu item, switch, checkbox)
--p-focus-ring-strong0 0 0 3px var(--p-accent-soft), 0 0 0 1px var(--p-accent)Strong focus ring (button, primary action)

Text selection

The text-selection color uses --p-selection uniformly (light rgba(23,131,255,.18) / dark rgba(88,166,255,.32)), applied by the global ::selection rule; do not set a separate highlight background.

Disabled state

All disabled controls use opacity:.5 + cursor:not-allowed uniformly; do not separately grey out or recolor.

Font families

Pythinker Web uses two font families: --font-ui (UI and body, Inter first) and --font-mono (code and monospace). Components always reference the variables; do not hard-code font names.

--font-ui · UI & body (Inter first)

Body and UI use self-hosted Inter as the primary face. CJK and platform system UI fonts sit late in the fallback chain so Latin glyphs resolve to Inter while Chinese text can fall through to native CJK fonts:

--font-ui
--font-ui: "Inter Variable", "Inter", "Helvetica Neue", Arial,
       "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
       -apple-system, BlinkMacSystemFont, "Segoe UI",
       Roboto, Ubuntu, sans-serif,
diff --git a/apps/pythinker-code/dist-web/assets/Tooltip-BV-JRC1N.js b/apps/pythinker-code/dist-web/assets/Tooltip-CYPLmGXR.js
similarity index 98%
rename from apps/pythinker-code/dist-web/assets/Tooltip-BV-JRC1N.js
rename to apps/pythinker-code/dist-web/assets/Tooltip-CYPLmGXR.js
index af9be35b9..ff1810256 100644
--- a/apps/pythinker-code/dist-web/assets/Tooltip-BV-JRC1N.js
+++ b/apps/pythinker-code/dist-web/assets/Tooltip-CYPLmGXR.js
@@ -1 +1 @@
-import{A as e,G as t,I as n,J as r,S as i,c as a,f as o,g as s,h as c,j as l,lt as u,n as d,nt as f,q as p,st as m,ut as h,w as g,x as _}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{t as v}from"./preload-helper-zJ_50EbN.js";import{_ as y}from"./index-DAFMRqR8.js";var b=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),x=[`id`],S=[`data-placement`],C=y(g({__name:`Tooltip`,props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(g){let y=g,C=f(null),w=f(null),T=f({transform:`translate3d(0px, 0px, 0px)`,left:`0px`,top:`0px`}),E=f({}),D=f(y.placement??`top`),O=f(!1),k=null,A=null,j=null,M=null,N=null,P=0;function F(){return M?Promise.resolve(M):(N||=v(()=>import(`./floating-ui.dom-DpWEmocp.js`).then(e=>(M=e,e)),[]).catch(e=>{throw N=null,e}),N)}function I(){k&&=(k(),null),A=null,j=null}function L(e){return b(this,null,function*(){let t=y.anchorEl,n=C.value;if(!y.visible||!t||!n||A===t&&j===n)return;let{autoUpdate:r}=yield F();e()&&y.visible&&y.anchorEl===t&&C.value===n&&(I(),A=t,j=n,k=r(t,n,()=>{R().catch(()=>{z()})}))})}function R(){return b(this,null,function*(){let e=y.anchorEl,t=C.value;if(!y.visible||!e||!t)return!1;let{arrow:n,computePosition:r,flip:i,offset:a,shift:o}=yield F();if(!y.visible||y.anchorEl!==e||C.value!==t)return!1;let s=[a(y.offset??6),i(),o({padding:6}),...w.value?[n({element:w.value,padding:4})]:[]],{x:c,y:l,placement:u,middlewareData:d}=yield r(e,t,{placement:y.placement??`top`,middleware:s,strategy:`fixed`});if(!y.visible||y.anchorEl!==e||C.value!==t)return!1;if(T.value.transform=`translate3d(${Math.round(c)}px, ${Math.round(l)}px, 0)`,T.value.left=`0px`,T.value.top=`0px`,D.value=u,d.arrow&&w.value){let{x:e,y:t}=d.arrow,n={top:`bottom`,bottom:`top`,left:`right`,right:`left`}[u.split(`-`)[0]];E.value={left:e==null?``:`${e}px`,top:t==null?``:`${t}px`,[n]:`-3px`}}return!0})}function z(){let e=y.anchorEl,t=C.value;if(!e||!t)return!1;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=y.offset??6,a=y.placement??`top`,o=n.left,s=n.top;return a===`bottom`?s=n.bottom+i:a===`left`?o=n.left-r.width-i:a===`right`?o=n.right+i:s=n.top-r.height-i,T.value.transform=`translate3d(${Math.round(Math.max(0,o))}px, ${Math.round(Math.max(0,s))}px, 0)`,T.value.left=`0px`,T.value.top=`0px`,D.value=a,E.value={},!0}t(()=>y.visible,t=>b(null,null,function*(){let n=++P;if(t){if(O.value=!1,yield e(),n!==P||!y.visible)return;if(y.anchorEl&&C.value)try{let t=y.anchorEl,r=C.value,i=t.getBoundingClientRect();if(!(yield R())||n!==P||!y.visible||y.anchorEl!==t||C.value!==r)return;let a=T.value.transform;if(y.originX!=null&&y.originY!=null){let t=Math.abs(Number(y.originX)-i.left),r=Math.abs(Number(y.originY)-i.top);if(Math.hypot(t,r)>120){if(T.value.transform=`translate3d(${Math.round(y.originX)}px, ${Math.round(y.originY)}px, 0)`,yield e(),n!==P||!y.visible||(O.value=!0,yield e(),n!==P||!y.visible))return;T.value.transform=a}else O.value=!0}else O.value=!0;yield L(()=>n===P)}catch{if(n!==P||!y.visible)return;if(O.value=z(),y.anchorEl&&C.value)try{yield L(()=>n===P)}catch{}}else O.value=!0}else O.value=!1,I()}));let B=0;return t([()=>y.anchorEl,()=>y.placement,()=>y.content],()=>b(null,null,function*(){let t=++B;if(y.visible&&y.anchorEl&&C.value){if(yield e(),t!==B||!y.visible||!y.anchorEl||!C.value)return;try{let e=yield R();if(t!==B||!y.visible||!y.anchorEl||!C.value)return;e||z()}catch{z()}yield L(()=>t===B)}})),l(()=>{P+=1,I()}),(e,t)=>(n(),s(o,{to:`body`},[c(`div`,{class:m([`markstream-vue`,{dark:g.isDark}])},[i(d,{name:`tooltip`,appear:``},{default:p(()=>[r(c(`div`,{id:y.id,ref_key:`tooltip`,ref:C,style:u({position:`fixed`,left:T.value.left,top:T.value.top,transform:T.value.transform,visibility:O.value?`visible`:`hidden`,pointerEvents:O.value?void 0:`none`}),class:`tooltip-element`,role:`tooltip`},[_(h(g.content)+` `,1),c(`div`,{ref_key:`arrowEl`,ref:w,class:`tooltip-arrow`,"data-placement":D.value,style:u(E.value)},null,12,S)],12,x),[[a,g.visible]])]),_:1})],2)]))}}),[[`__scopeId`,`data-v-c606ee4c`]]);export{C as default};
\ No newline at end of file
+import{A as e,G as t,I as n,J as r,S as i,c as a,f as o,g as s,h as c,j as l,lt as u,n as d,nt as f,q as p,st as m,ut as h,w as g,x as _}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{t as v}from"./preload-helper-zJ_50EbN.js";import{_ as y}from"./index-CJN6blp7.js";var b=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),x=[`id`],S=[`data-placement`],C=y(g({__name:`Tooltip`,props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(g){let y=g,C=f(null),w=f(null),T=f({transform:`translate3d(0px, 0px, 0px)`,left:`0px`,top:`0px`}),E=f({}),D=f(y.placement??`top`),O=f(!1),k=null,A=null,j=null,M=null,N=null,P=0;function F(){return M?Promise.resolve(M):(N||=v(()=>import(`./floating-ui.dom-DpWEmocp.js`).then(e=>(M=e,e)),[]).catch(e=>{throw N=null,e}),N)}function I(){k&&=(k(),null),A=null,j=null}function L(e){return b(this,null,function*(){let t=y.anchorEl,n=C.value;if(!y.visible||!t||!n||A===t&&j===n)return;let{autoUpdate:r}=yield F();e()&&y.visible&&y.anchorEl===t&&C.value===n&&(I(),A=t,j=n,k=r(t,n,()=>{R().catch(()=>{z()})}))})}function R(){return b(this,null,function*(){let e=y.anchorEl,t=C.value;if(!y.visible||!e||!t)return!1;let{arrow:n,computePosition:r,flip:i,offset:a,shift:o}=yield F();if(!y.visible||y.anchorEl!==e||C.value!==t)return!1;let s=[a(y.offset??6),i(),o({padding:6}),...w.value?[n({element:w.value,padding:4})]:[]],{x:c,y:l,placement:u,middlewareData:d}=yield r(e,t,{placement:y.placement??`top`,middleware:s,strategy:`fixed`});if(!y.visible||y.anchorEl!==e||C.value!==t)return!1;if(T.value.transform=`translate3d(${Math.round(c)}px, ${Math.round(l)}px, 0)`,T.value.left=`0px`,T.value.top=`0px`,D.value=u,d.arrow&&w.value){let{x:e,y:t}=d.arrow,n={top:`bottom`,bottom:`top`,left:`right`,right:`left`}[u.split(`-`)[0]];E.value={left:e==null?``:`${e}px`,top:t==null?``:`${t}px`,[n]:`-3px`}}return!0})}function z(){let e=y.anchorEl,t=C.value;if(!e||!t)return!1;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=y.offset??6,a=y.placement??`top`,o=n.left,s=n.top;return a===`bottom`?s=n.bottom+i:a===`left`?o=n.left-r.width-i:a===`right`?o=n.right+i:s=n.top-r.height-i,T.value.transform=`translate3d(${Math.round(Math.max(0,o))}px, ${Math.round(Math.max(0,s))}px, 0)`,T.value.left=`0px`,T.value.top=`0px`,D.value=a,E.value={},!0}t(()=>y.visible,t=>b(null,null,function*(){let n=++P;if(t){if(O.value=!1,yield e(),n!==P||!y.visible)return;if(y.anchorEl&&C.value)try{let t=y.anchorEl,r=C.value,i=t.getBoundingClientRect();if(!(yield R())||n!==P||!y.visible||y.anchorEl!==t||C.value!==r)return;let a=T.value.transform;if(y.originX!=null&&y.originY!=null){let t=Math.abs(Number(y.originX)-i.left),r=Math.abs(Number(y.originY)-i.top);if(Math.hypot(t,r)>120){if(T.value.transform=`translate3d(${Math.round(y.originX)}px, ${Math.round(y.originY)}px, 0)`,yield e(),n!==P||!y.visible||(O.value=!0,yield e(),n!==P||!y.visible))return;T.value.transform=a}else O.value=!0}else O.value=!0;yield L(()=>n===P)}catch{if(n!==P||!y.visible)return;if(O.value=z(),y.anchorEl&&C.value)try{yield L(()=>n===P)}catch{}}else O.value=!0}else O.value=!1,I()}));let B=0;return t([()=>y.anchorEl,()=>y.placement,()=>y.content],()=>b(null,null,function*(){let t=++B;if(y.visible&&y.anchorEl&&C.value){if(yield e(),t!==B||!y.visible||!y.anchorEl||!C.value)return;try{let e=yield R();if(t!==B||!y.visible||!y.anchorEl||!C.value)return;e||z()}catch{z()}yield L(()=>t===B)}})),l(()=>{P+=1,I()}),(e,t)=>(n(),s(o,{to:`body`},[c(`div`,{class:m([`markstream-vue`,{dark:g.isDark}])},[i(d,{name:`tooltip`,appear:``},{default:p(()=>[r(c(`div`,{id:y.id,ref_key:`tooltip`,ref:C,style:u({position:`fixed`,left:T.value.left,top:T.value.top,transform:T.value.transform,visibility:O.value?`visible`:`hidden`,pointerEvents:O.value?void 0:`none`}),class:`tooltip-element`,role:`tooltip`},[_(h(g.content)+` `,1),c(`div`,{ref_key:`arrowEl`,ref:w,class:`tooltip-arrow`,"data-placement":D.value,style:u(E.value)},null,12,S)],12,x),[[a,g.visible]])]),_:1})],2)]))}}),[[`__scopeId`,`data-v-c606ee4c`]]);export{C as default};
\ No newline at end of file
diff --git a/apps/pythinker-code/dist-web/assets/index-DAFMRqR8.js b/apps/pythinker-code/dist-web/assets/index-CJN6blp7.js
similarity index 75%
rename from apps/pythinker-code/dist-web/assets/index-DAFMRqR8.js
rename to apps/pythinker-code/dist-web/assets/index-CJN6blp7.js
index 5b4239d94..22afb938c 100644
--- a/apps/pythinker-code/dist-web/assets/index-DAFMRqR8.js
+++ b/apps/pythinker-code/dist-web/assets/index-CJN6blp7.js
@@ -1,7 +1,7 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemView-BO8F15GQ.js","assets/vue.runtime.esm-bundler-Cwbj1t-C.js","assets/chunk-QTnfLwEv.js","assets/DesignSystemView-BKLoAAV8.css","assets/mhchem-CCsrOXlE.js","assets/katex-BMCG0xok.js","assets/mermaid.core-Ddyah3MZ.js","assets/preload-helper-zJ_50EbN.js","assets/chunk-PWAF6VOD-vmg_e0ho.js","assets/src-Cn6kALDM.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/chunk-DU6HZSFF-DfRjAqU1.js","assets/purify.es-CvIXgbbv.js","assets/chunk-75Z2AOVW-D2HolPjd.js","assets/dist-lRkD-JPF.js","assets/chunk-GMAD6QVW-xizYnG4f.js","assets/chunk-2E4U76K2-CUuPs4AQ.js","assets/graphlib-B8gBHxth.js","assets/chunk-4HAMMTFA-B5soPjjq.js","assets/chunk-P2QGCYS3-CQc2NCc1.js","assets/rough.esm-CSKSodPl.js","assets/chunk-GVQU2GXP-BrOdU7Oy.js","assets/chunk-L3NEJ4N5-XwNqFvev.js","assets/chunk-OSK3NFVY-BT2Y-lqQ.js","assets/line-CleFFpQp.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-CLGD4ZFX-D_luxf7b.js","assets/chunk-LNGE3PJU-OosUmKKA.js","assets/chunk-TLUHSLCS-DN2eHVWx.js","assets/Tooltip-BV-JRC1N.js","assets/CodeBlockNode-_wK8GSRB.js","assets/index7-DOLmlvs-.js","assets/index6-CGYWuLMy.js","assets/index5-CCrZjPWg.js","assets/index11-BMhFgxFV.js","assets/index10-Dhnug51i.js","assets/index8-BKeFA_Sf.js","assets/index3-U5vX94Wy.js","assets/index4-Wk5pGiJ7.js","assets/index9-BNCeHK1v.js","assets/editor.main-cSwqhoaG.js","assets/editor.api2-BIJacb07.js","assets/editor-D_FpifaX.css","assets/workers-lk8skNfQ.js","assets/monaco.contribution-DqkvvJIb.js","assets/dist-1YXee3Wk.js","assets/dist-3s__bTmB.js"])))=>i.map(i=>d[i]);
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemView-CC7yy3PX.js","assets/vue.runtime.esm-bundler-Cwbj1t-C.js","assets/chunk-QTnfLwEv.js","assets/DesignSystemView-BKLoAAV8.css","assets/mhchem-CCsrOXlE.js","assets/katex-BMCG0xok.js","assets/mermaid.core-Ddyah3MZ.js","assets/preload-helper-zJ_50EbN.js","assets/chunk-PWAF6VOD-vmg_e0ho.js","assets/src-Cn6kALDM.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/chunk-DU6HZSFF-DfRjAqU1.js","assets/purify.es-CvIXgbbv.js","assets/chunk-75Z2AOVW-D2HolPjd.js","assets/dist-lRkD-JPF.js","assets/chunk-GMAD6QVW-xizYnG4f.js","assets/chunk-2E4U76K2-CUuPs4AQ.js","assets/graphlib-B8gBHxth.js","assets/chunk-4HAMMTFA-B5soPjjq.js","assets/chunk-P2QGCYS3-CQc2NCc1.js","assets/rough.esm-CSKSodPl.js","assets/chunk-GVQU2GXP-BrOdU7Oy.js","assets/chunk-L3NEJ4N5-XwNqFvev.js","assets/chunk-OSK3NFVY-BT2Y-lqQ.js","assets/line-CleFFpQp.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-CLGD4ZFX-D_luxf7b.js","assets/chunk-LNGE3PJU-OosUmKKA.js","assets/chunk-TLUHSLCS-DN2eHVWx.js","assets/Tooltip-CYPLmGXR.js","assets/CodeBlockNode-uERC4D15.js","assets/index7-ClZ3JBPh.js","assets/index6-KRBW8xCP.js","assets/index5-DTEBXfOq.js","assets/index11-BLu1h3am.js","assets/index10-cR1J5t3a.js","assets/index8-CkSxjxQO.js","assets/index3-mVb7iXlv.js","assets/index4-BTqbYikG.js","assets/index9-C3TPz6s3.js","assets/editor.main-cSwqhoaG.js","assets/editor.api2-BIJacb07.js","assets/editor-D_FpifaX.css","assets/workers-lk8skNfQ.js","assets/monaco.contribution-DqkvvJIb.js","assets/dist-1YXee3Wk.js","assets/dist-3s__bTmB.js"])))=>i.map(i=>d[i]);
 import{n as e}from"./chunk-QTnfLwEv.js";import{$ as t,A as n,B as r,C as i,D as a,E as o,G as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,Q as g,R as _,S as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,_ as E,a as D,at as O,b as k,c as A,ct as j,d as M,et as N,f as ee,g as P,h as F,i as I,it as te,j as ne,k as re,l as ie,lt as ae,m as L,n as oe,nt as R,o as se,ot as z,p as ce,q as B,r as le,rt as ue,s as de,st as V,tt as fe,u as H,ut as U,v as W,w as G,x as K,y as pe,z as me}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{t as he}from"./preload-helper-zJ_50EbN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ge=typeof window<`u`,_e=(e,t=!1)=>t?Symbol.for(e):Symbol(e),ve=(e,t,n)=>ye({l:e,k:t,s:n}),ye=e=>JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`).replace(/\u0027/g,`\\u0027`),be=e=>typeof e==`number`&&isFinite(e),xe=e=>Le(e)===`[object Date]`,Se=e=>Le(e)===`[object RegExp]`,Ce=e=>Re(e)&&Object.keys(e).length===0,we=Object.assign,Te=Object.create,Ee=(e=null)=>Te(e),De,Oe=()=>De||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:Ee(),ke=Object.prototype.hasOwnProperty;function Ae(e,t){return ke.call(e,t)}var je=Array.isArray,Me=e=>typeof e==`function`,q=e=>typeof e==`string`,Ne=e=>typeof e==`boolean`,Pe=e=>typeof e==`object`&&!!e,Fe=e=>Pe(e)&&Me(e.then)&&Me(e.catch),Ie=Object.prototype.toString,Le=e=>Ie.call(e),Re=e=>Le(e)===`[object Object]`,ze=e=>e==null?``:je(e)||Re(e)&&e.toString===Ie?JSON.stringify(e,null,2):String(e);function Be(e,t=``){return e.reduce((e,n,r)=>r===0?e+n:e+t+n,``)}function Ve(e,t){typeof console<`u`&&(console.warn(`[intlify] `+e),t&&console.warn(t.stack))}function He(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/\//g,`/`).replace(/=/g,`=`)}function Ue(e){return e.replace(/&(?![a-z0-9#]{2,6};)/gi,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(//g,`>`)}var We=/^javascript:/i,Ge=/^(?:href|src|action|formaction)$/i,Ke=/&#(?:x([0-9a-f]+)|(\d+));?/gi,qe=/&(?:Tab|NewLine);/g,Je=/:?/gi,Ye=/[\u0000-\u0020\u007f-\u009f]/g,Xe=/(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i,Ze=/(^|[\s"'<>/])on(\w+\s*=)/gi,Qe=/(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;function $e(e,t,n){let r=t||n;if(!r)return e;let i=Number.parseInt(r,t?16:10);return i<=127?String.fromCharCode(i):e}function et(e){let t=e.replace(Ke,$e).replace(qe,``).replace(Je,`:`).replace(Ye,``);return We.test(t)}function tt(e){let t=/url\s*\(/gi,n=``,r=0,i;for(;(i=t.exec(e))!==null;){let a=i.index,o=t.lastIndex-1,s=o+1,c=1,l=null;for(;s`${t}="${nt(t,n)}"`),e=e.replace(/([\w:-]+)\s*=\s*'([^']*)'/g,(e,t,n)=>`${t}='${nt(t,n)}'`),Xe.test(e)&&(e=e.replace(Ze,`$1on$2`)),e=e.replace(Qe,(e,t,n,r)=>et(r)?`${t}${n}about:blank`:e),e}var it=e=>!Pe(e)||je(e);function at(e,t){if(it(e)||it(t))throw Error(`Invalid value`);let n=[{src:e,des:t}];for(;n.length;){let{src:e,des:t}=n.pop();Object.keys(e).forEach(r=>{if(r===`__proto__`)return;let i=e[r];if(je(i)){let e=[];e.length=i.length,t[r]=e,n.push({src:i,des:e})}else Pe(i)?((!Pe(t[r])||je(t[r]))&&(t[r]=Ee()),n.push({src:i,des:t[r]})):t[r]=i})}}function ot(e,t,n){return{line:e,column:t,offset:n}}function st(e,t,n){let r={start:e,end:t};return n!=null&&(r.source=n),r}var ct={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};ct.EXPECTED_TOKEN,ct.INVALID_TOKEN_IN_PLACEHOLDER,ct.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,ct.UNKNOWN_ESCAPE_SEQUENCE,ct.INVALID_UNICODE_ESCAPE_SEQUENCE,ct.UNBALANCED_CLOSING_BRACE,ct.UNTERMINATED_CLOSING_BRACE,ct.EMPTY_PLACEHOLDER,ct.NOT_ALLOW_NEST_PLACEHOLDER,ct.INVALID_LINKED_FORMAT,ct.MUST_HAVE_MESSAGES_IN_PLURAL,ct.UNEXPECTED_EMPTY_LINKED_MODIFIER,ct.UNEXPECTED_EMPTY_LINKED_KEY,ct.UNEXPECTED_LEXICAL_ANALYSIS,ct.UNHANDLED_CODEGEN_NODE_TYPE,ct.UNHANDLED_MINIFIER_NODE_TYPE;function lt(e,t,n={}){let{domain:r,messages:i,args:a}=n,o=SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function ut(e){throw e}var dt=` `,ft=`\r`,pt=`
 `,mt=`\u2028`,ht=`\u2029`;function gt(e){let t=e,n=0,r=1,i=1,a=0,o=e=>t[e]===ft&&t[e+1]===pt,s=e=>t[e]===pt,c=e=>t[e]===ht,l=e=>t[e]===mt,u=e=>o(e)||s(e)||c(e)||l(e),d=()=>n,f=()=>r,p=()=>i,m=()=>a,h=e=>o(e)||c(e)||l(e)?pt:t[e],g=()=>h(n),_=()=>h(n+a);function v(){return a=0,u(n)&&(r++,i=0),o(n)&&n++,n++,i++,t[n]}function y(){return o(n+a)&&a++,a++,t[n+a]}function b(){n=0,r=1,i=1,a=0}function x(e=0){a=e}function S(){let e=n+a;for(;e!==n;)v();a=0}return{index:d,line:f,column:p,peekOffset:m,charAt:h,currentChar:g,currentPeek:_,next:v,peek:y,reset:b,resetPeek:x,skipToPeek:S}}var _t=void 0,vt=`'`,yt=`tokenizer`;function bt(e,t={}){let n=t.location!==!1,r=gt(e),i=()=>r.index(),a=()=>ot(r.line(),r.column(),r.index()),o=a(),s=i(),c={currentType:13,offset:s,startLoc:o,endLoc:o,lastType:13,lastOffset:s,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:``},l=()=>c,{onError:u}=t;function d(e,t,r,...i){let a=l();t.column+=r,t.offset+=r,u&&u(lt(e,n?st(a.startLoc,t):null,{domain:yt,args:i}))}function f(e,t,r){e.endLoc=a(),e.currentType=t;let i={type:t};return n&&(i.loc=st(e.startLoc,e.endLoc)),r!=null&&(i.value=r),i}let p=e=>f(e,13);function m(e,t){return e.currentChar()===t?(e.next(),t):(d(ct.EXPECTED_TOKEN,a(),0,t),``)}function h(e){let t=``;for(;e.currentPeek()===dt||e.currentPeek()===pt;)t+=e.currentPeek(),e.peek();return t}function g(e){let t=h(e);return e.skipToPeek(),t}function _(e){if(e===_t)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t===95}function v(e){if(e===_t)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57}function y(e,t){let{currentType:n}=t;if(n!==2)return!1;h(e);let r=_(e.currentPeek());return e.resetPeek(),r}function b(e,t){let{currentType:n}=t;if(n!==2)return!1;h(e);let r=v(e.currentPeek()===`-`?e.peek():e.currentPeek());return e.resetPeek(),r}function x(e,t){let{currentType:n}=t;if(n!==2)return!1;h(e);let r=e.currentPeek()===vt;return e.resetPeek(),r}function S(e,t){let{currentType:n}=t;if(n!==7)return!1;h(e);let r=e.currentPeek()===`.`;return e.resetPeek(),r}function C(e,t){let{currentType:n}=t;if(n!==8)return!1;h(e);let r=_(e.currentPeek());return e.resetPeek(),r}function w(e,t){let{currentType:n}=t;if(!(n===7||n===11))return!1;h(e);let r=e.currentPeek()===`:`;return e.resetPeek(),r}function T(e,t){let{currentType:n}=t;if(n!==9)return!1;let r=()=>{let t=e.currentPeek();return t===`{`?_(e.peek()):t===`@`||t===`|`||t===`:`||t===`.`||t===dt||!t?!1:t===pt?(e.peek(),r()):D(e,!1)},i=r();return e.resetPeek(),i}function E(e){h(e);let t=e.currentPeek()===`|`;return e.resetPeek(),t}function D(e,t=!0){let n=(t=!1,r=``)=>{let i=e.currentPeek();return i===`{`||i===`@`||!i?t:i===`|`?!(r===dt||r===pt):i===dt?(e.peek(),n(!0,dt)):i===pt?(e.peek(),n(!0,pt)):!0},r=n();return t&&e.resetPeek(),r}function O(e,t){let n=e.currentChar();if(n!==_t)return t(n)?(e.next(),n):null}function k(e){let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===95||t===36}function A(e){return O(e,k)}function j(e){let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===95||t===36||t===45}function M(e){return O(e,j)}function N(e){let t=e.charCodeAt(0);return t>=48&&t<=57}function ee(e){return O(e,N)}function P(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function F(e){return O(e,P)}function I(e){let t=``,n=``;for(;t=ee(e);)n+=t;return n}function te(e){let t=``;for(;;){let n=e.currentChar();if(n===`\\`){let r=e.peek();r===`{`||r===`}`||r===`@`||r===`|`||r===`\\`?(t+=n+r,e.next(),e.next()):(e.resetPeek(),t+=n,e.next())}else if(n===`{`||n===`}`||n===`@`||n===`|`||!n)break;else if(n===dt||n===pt)if(D(e))t+=n,e.next();else if(E(e))break;else t+=n,e.next();else t+=n,e.next()}return t}function ne(e){g(e);let t=``,n=``;for(;t=M(e);)n+=t;let r=e.currentChar();if(r&&r!==`}`&&r!==_t&&r!==dt&&r!==pt&&r!==` `){let t=se(e);return d(ct.INVALID_TOKEN_IN_PLACEHOLDER,a(),0,n+t),n+t}return e.currentChar()===_t&&d(ct.UNTERMINATED_CLOSING_BRACE,a(),0),n}function re(e){g(e);let t=``;return e.currentChar()===`-`?(e.next(),t+=`-${I(e)}`):t+=I(e),e.currentChar()===_t&&d(ct.UNTERMINATED_CLOSING_BRACE,a(),0),t}function ie(e){return e!==vt&&e!==pt}function ae(e){g(e),m(e,`'`);let t=``,n=``;for(;t=O(e,ie);)t===`\\`?n+=L(e):n+=t;let r=e.currentChar();return r===pt||r===_t?(d(ct.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),0),r===pt&&(e.next(),m(e,`'`)),n):(m(e,`'`),n)}function L(e){let t=e.currentChar();switch(t){case`\\`:case`'`:return e.next(),`\\${t}`;case`u`:return oe(e,t,4);case`U`:return oe(e,t,6);default:return d(ct.UNKNOWN_ESCAPE_SEQUENCE,a(),0,t),``}}function oe(e,t,n){m(e,t);let r=``;for(let i=0;i{let r=e.currentChar();return r===`{`||r===`@`||r===`|`||r===`(`||r===`)`||!r||r===dt?n:(n+=r,e.next(),t(n))};return t(``)}function B(e){g(e);let t=m(e,`|`);return g(e),t}function le(e,t){let n=null;switch(e.currentChar()){case`{`:return t.braceNest>=1&&d(ct.NOT_ALLOW_NEST_PLACEHOLDER,a(),0),e.next(),n=f(t,2,`{`),g(e),t.braceNest++,n;case`}`:return t.braceNest>0&&t.currentType===2&&d(ct.EMPTY_PLACEHOLDER,a(),0),e.next(),n=f(t,3,`}`),t.braceNest--,t.braceNest>0&&g(e),t.inLinked&&t.braceNest===0&&(t.inLinked=!1),n;case`@`:return t.braceNest>0&&d(ct.UNTERMINATED_CLOSING_BRACE,a(),0),n=ue(e,t)||p(t),t.braceNest=0,n;default:{let r=!0,i=!0,o=!0;if(E(e))return t.braceNest>0&&d(ct.UNTERMINATED_CLOSING_BRACE,a(),0),n=f(t,1,B(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(t.currentType===4||t.currentType===5||t.currentType===6))return d(ct.UNTERMINATED_CLOSING_BRACE,a(),0),t.braceNest=0,de(e,t);if(r=y(e,t))return n=f(t,4,ne(e)),g(e),n;if(i=b(e,t))return n=f(t,5,re(e)),g(e),n;if(o=x(e,t))return n=f(t,6,ae(e)),g(e),n;if(!r&&!i&&!o)return n=f(t,12,se(e)),d(ct.INVALID_TOKEN_IN_PLACEHOLDER,a(),0,n.value),g(e),n;break}}return n}function ue(e,t){let{currentType:n}=t,r=null,i=e.currentChar();switch((n===7||n===8||n===11||n===9)&&(i===pt||i===dt)&&d(ct.INVALID_LINKED_FORMAT,a(),0),i){case`@`:return e.next(),r=f(t,7,`@`),t.inLinked=!0,r;case`.`:return g(e),e.next(),f(t,8,`.`);case`:`:return g(e),e.next(),f(t,9,`:`);default:return E(e)?(r=f(t,1,B(e)),t.braceNest=0,t.inLinked=!1,r):S(e,t)||w(e,t)?(g(e),ue(e,t)):C(e,t)?(g(e),f(t,11,z(e))):T(e,t)?(g(e),i===`{`?le(e,t)||r:f(t,10,ce(e))):(n===7&&d(ct.INVALID_LINKED_FORMAT,a(),0),t.braceNest=0,t.inLinked=!1,de(e,t))}}function de(e,t){let n={type:13};if(t.braceNest>0)return le(e,t)||p(t);if(t.inLinked)return ue(e,t)||p(t);switch(e.currentChar()){case`{`:return le(e,t)||p(t);case`}`:return d(ct.UNBALANCED_CLOSING_BRACE,a(),0),e.next(),f(t,3,`}`);case`@`:return ue(e,t)||p(t);default:if(E(e))return n=f(t,1,B(e)),t.braceNest=0,t.inLinked=!1,n;if(D(e))return f(t,0,te(e));break}return n}function V(){let{currentType:e,offset:t,startLoc:n,endLoc:o}=c;return c.lastType=e,c.lastOffset=t,c.lastStartLoc=n,c.lastEndLoc=o,c.offset=i(),c.startLoc=a(),r.currentChar()===_t?f(c,13):de(r,c)}return{nextToken:V,currentOffset:i,currentPosition:a,context:l}}var xt=`parser`,St=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g,Ct=/\\([\\@{}|])/g;function wt(e,t){return t}function Tt(e,t,n){switch(e){case`\\\\`:return`\\`;case`\\'`:return`'`;default:{let e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):`�`}}}function Et(e={}){let t=e.location!==!1,{onError:n}=e;function r(e,r,i,a,...o){let s=e.currentPosition();s.offset+=a,s.column+=a,n&&n(lt(r,t?st(i,s):null,{domain:xt,args:o}))}function i(e,n,r){let i={type:e};return t&&(i.start=n,i.end=n,i.loc={start:r,end:r}),i}function a(e,n,r,i){t&&(e.end=n,e.loc&&(e.loc.end=r))}function o(e,t){let n=e.context(),r=i(3,n.offset,n.startLoc);return r.value=t.replace(Ct,wt),a(r,e.currentOffset(),e.currentPosition()),r}function s(e,t){let{lastOffset:n,lastStartLoc:r}=e.context(),o=i(5,n,r);return o.index=parseInt(t,10),e.nextToken(),a(o,e.currentOffset(),e.currentPosition()),o}function c(e,t){let{lastOffset:n,lastStartLoc:r}=e.context(),o=i(4,n,r);return o.key=t,e.nextToken(),a(o,e.currentOffset(),e.currentPosition()),o}function l(e,t){let{lastOffset:n,lastStartLoc:r}=e.context(),o=i(9,n,r);return o.value=t.replace(St,Tt),e.nextToken(),a(o,e.currentOffset(),e.currentPosition()),o}function u(e){let t=e.nextToken(),n=e.context(),{lastOffset:o,lastStartLoc:s}=n,c=i(8,o,s);return t.type===11?(t.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,Dt(t)),c.value=t.value||``,a(c,e.currentOffset(),e.currentPosition()),{node:c}):(r(e,ct.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,0),c.value=``,a(c,o,s),{nextConsumeToken:t,node:c})}function d(e,t){let n=e.context(),r=i(7,n.offset,n.startLoc);return r.value=t,a(r,e.currentOffset(),e.currentPosition()),r}function f(e){let t=e.context(),n=i(6,t.offset,t.startLoc),o=e.nextToken();if(o.type===8){let t=u(e);n.modifier=t.node,o=t.nextConsumeToken||e.nextToken()}switch(o.type!==9&&r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(o)),o=e.nextToken(),o.type===2&&(o=e.nextToken()),o.type){case 10:o.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(o)),n.key=d(e,o.value||``);break;case 4:o.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(o)),n.key=c(e,o.value||``);break;case 5:o.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(o)),n.key=s(e,o.value||``);break;case 6:o.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(o)),n.key=l(e,o.value||``);break;default:{r(e,ct.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc,0);let s=e.context(),c=i(7,s.offset,s.startLoc);return c.value=``,a(c,s.offset,s.startLoc),n.key=c,a(n,s.offset,s.startLoc),{nextConsumeToken:o,node:n}}}return a(n,e.currentOffset(),e.currentPosition()),{node:n}}function p(e){let t=e.context(),n=i(2,t.currentType===1?e.currentOffset():t.offset,t.currentType===1?t.endLoc:t.startLoc);n.items=[];let u=null;do{let i=u||e.nextToken();switch(u=null,i.type){case 0:i.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(i)),n.items.push(o(e,i.value||``));break;case 5:i.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(i)),n.items.push(s(e,i.value||``));break;case 4:i.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(i)),n.items.push(c(e,i.value||``));break;case 6:i.value??r(e,ct.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,0,Dt(i)),n.items.push(l(e,i.value||``));break;case 7:{let t=f(e);n.items.push(t.node),u=t.nextConsumeToken||null;break}}}while(t.currentType!==13&&t.currentType!==1);return a(n,t.currentType===1?t.lastOffset:e.currentOffset(),t.currentType===1?t.lastEndLoc:e.currentPosition()),n}function m(e,t,n,o){let s=e.context(),c=o.items.length===0,l=i(1,t,n);l.cases=[],l.cases.push(o);do{let t=p(e);c||=t.items.length===0,l.cases.push(t)}while(s.currentType!==13);return c&&r(e,ct.MUST_HAVE_MESSAGES_IN_PLURAL,n,0),a(l,e.currentOffset(),e.currentPosition()),l}function h(e){let t=e.context(),{offset:n,startLoc:r}=t,i=p(e);return t.currentType===13?i:m(e,n,r,i)}function g(n){let o=bt(n,we({},e)),s=o.context(),c=i(0,s.offset,s.startLoc);return t&&c.loc&&(c.loc.source=n),c.body=h(o),e.onCacheKey&&(c.cacheKey=e.onCacheKey(n)),s.currentType!==13&&r(o,ct.UNEXPECTED_LEXICAL_ANALYSIS,s.lastStartLoc,0,n[s.offset]||``),a(c,o.currentOffset(),o.currentPosition()),c}return{parse:g}}function Dt(e){if(e.type===13)return`EOF`;let t=(e.value||``).replace(/\r?\n/gu,`\\n`);return t.length>10?t.slice(0,9)+`…`:t}function Ot(e,t={}){let n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}function kt(e,t){for(let n=0;nNt(e)),e}function Nt(e){if(e.items.length===1){let t=e.items[0];(t.type===3||t.type===9)&&(e.static=t.value,delete t.value)}else{let t=[];for(let n=0;no;function c(e,t){o.code+=e}function l(e,t=!0){let n=t?r:``;c(i?n+`  `.repeat(e):n)}function u(e=!0){let t=++o.indentLevel;e&&l(t)}function d(e=!0){let t=--o.indentLevel;e&&l(t)}function f(){l(o.indentLevel)}return{context:s,push:c,indent:u,deindent:d,newline:f,helper:e=>`_${e}`,needIndent:()=>o.needIndent}}function It(e,t){let{helper:n}=e;e.push(`${n(`linked`)}(`),Bt(e,t.key),t.modifier?(e.push(`, `),Bt(e,t.modifier),e.push(`, _type`)):e.push(`, undefined, _type`),e.push(`)`)}function Lt(e,t){let{helper:n,needIndent:r}=e;e.push(`${n(`normalize`)}([`),e.indent(r());let i=t.items.length;for(let n=0;n1){e.push(`${n(`plural`)}([`),e.indent(r());let i=t.cases.length;for(let n=0;n{let n=q(t.mode)?t.mode:`normal`,r=q(t.filename)?t.filename:`message.intl`;t.sourceMap;let i=t.breakLineCode==null?n===`arrow`?`;`:`
-`:t.breakLineCode,a=t.needIndent?t.needIndent:n!==`arrow`,o=e.helpers||[],s=Ft(e,{filename:r,breakLineCode:i,needIndent:a});s.push(n===`normal`?`function __msg__ (ctx) {`:`(ctx) => {`),s.indent(a),o.length>0&&(s.push(`const { ${Be(o.map(e=>`${e}: _${e}`),`, `)} } = ctx`),s.newline()),s.push(`return `),Bt(s,e),s.deindent(a),s.push(`}`),delete e.helpers;let{code:c,map:l}=s.context();return{ast:e,code:c,map:l?l.toJSON():void 0}};function Ht(e,t={}){let n=we({},t),r=!!n.jit,i=!!n.minify,a=n.optimize==null?!0:n.optimize,o=Et(n).parse(e);return r?(a&&Mt(o),i&&Pt(o),{ast:o,code:``}):(jt(o,n),Vt(o,n))}function Ut(){typeof __INTLIFY_PROD_DEVTOOLS__!=`boolean`&&(Oe().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!=`boolean`&&(Oe().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function Wt(e){return Pe(e)&&en(e)===0&&(Ae(e,`b`)||Ae(e,`body`))}var Gt=[`b`,`body`];function Kt(e){return cn(e,Gt)}var qt=[`c`,`cases`];function Jt(e){return cn(e,qt,[])}var Yt=[`s`,`static`];function Xt(e){return cn(e,Yt)}var Zt=[`i`,`items`];function Qt(e){return cn(e,Zt,[])}var $t=[`t`,`type`];function en(e){return cn(e,$t)}var tn=[`v`,`value`];function nn(e,t){let n=cn(e,tn);if(n!=null)return n;throw un(t)}var rn=[`m`,`modifier`];function an(e){return cn(e,rn)}var on=[`k`,`key`];function sn(e){let t=cn(e,on);if(t)return t;throw un(6)}function cn(e,t,n){for(let n=0;nfn(t,e)}function fn(e,t){let n=Kt(t);if(n==null)throw un(0);if(en(n)===1){let t=Jt(n);return e.plural(t.reduce((t,n)=>[...t,pn(e,n)],[]))}else return pn(e,n)}function pn(e,t){let n=Xt(t);if(n!=null)return e.type===`text`?n:e.normalize([n]);{let n=Qt(t).reduce((t,n)=>[...t,mn(e,n)],[]);return e.normalize(n)}}function mn(e,t){let n=en(t);switch(n){case 3:return nn(t,n);case 9:return nn(t,n);case 4:{let r=t;if(Ae(r,`k`)&&r.k)return e.interpolate(e.named(r.k));if(Ae(r,`key`)&&r.key)return e.interpolate(e.named(r.key));throw un(n)}case 5:{let r=t;if(Ae(r,`i`)&&be(r.i))return e.interpolate(e.list(r.i));if(Ae(r,`index`)&&be(r.index))return e.interpolate(e.list(r.index));throw un(n)}case 6:{let n=t,r=an(n),i=sn(n);return e.linked(mn(e,i),r?mn(e,r):void 0,e.type)}case 7:return nn(t,n);case 8:return nn(t,n);default:throw Error(`unhandled node on format message part: ${n}`)}}var hn=e=>e,gn=Ee();function _n(e,t={}){let n=!1,r=t.onError||ut;return t.onError=e=>{n=!0,r(e)},{...Ht(e,t),detectError:n}}function vn(e,t){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&q(e)){Ne(t.warnHtmlMessage)&&t.warnHtmlMessage;let n=(t.onCacheKey||hn)(e),r=gn[n];if(r)return r;let{ast:i,detectError:a}=_n(e,{...t,location:!1,jit:!0}),o=dn(i);return a?o:gn[n]=o}else{let t=e.cacheKey;return t?gn[t]||(gn[t]=dn(e)):dn(e)}}var yn=null;function bn(e){yn=e}function xn(e,t,n){yn&&yn.emit(`i18n:init`,{timestamp:Date.now(),i18n:e,version:t,meta:n})}var Sn=Cn(`function:translate`);function Cn(e){return t=>yn&&yn.emit(e,t)}var wn={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function Tn(e){return lt(e,null,void 0)}wn.INVALID_ARGUMENT,wn.INVALID_DATE_ARGUMENT,wn.INVALID_ISO_DATE_ARGUMENT,wn.NOT_SUPPORT_NON_STRING_MESSAGE,wn.NOT_SUPPORT_LOCALE_PROMISE_VALUE,wn.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,wn.NOT_SUPPORT_LOCALE_TYPE;function En(e,t){return t.locale==null?On(e.locale):On(t.locale)}var Dn;function On(e){if(q(e))return e;if(Me(e)){if(e.resolvedOnce&&Dn!=null)return Dn;if(e.constructor.name===`Function`){let t=e();if(Fe(t))throw Tn(wn.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Dn=t}else throw Tn(wn.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Tn(wn.NOT_SUPPORT_LOCALE_TYPE)}function kn(e,t,n){return[...new Set([n,...je(t)?t:Pe(t)?Object.keys(t).filter(e=>e!=="default"):q(t)?[t]:[n]])]}function An(e,t,n){let r=q(n)?n:Kn,i=e,a;Pe(t)?(i.__localeChainObjectCache||=new WeakMap,a=i.__localeChainObjectCache.get(t),a||(a=new Map,i.__localeChainObjectCache.set(t,a))):(i.__localeChainCache||=new Map,a=i.__localeChainCache.get(t),a||(a=new Map,i.__localeChainCache.set(t,a)));let o=a.get(r);if(o)return o;let s=[],c=[n];for(;je(c);)c=jn(s,c,t);let l=je(t)||!Re(t)?t:t.default?t.default:null;return c=q(l)?[l]:l,je(c)&&jn(s,c,!1),a.set(r,s),s}function jn(e,t,n){let r=!0;for(let i=0;i{o===void 0?o=s:o+=s},f[1]=()=>{o!==void 0&&(t.push(o),o=void 0)},f[2]=()=>{f[0](),i++},f[3]=()=>{if(i>0)i--,r=4,f[0]();else{if(i=0,o===void 0||(o=zn(o),o===!1))return!1;f[1]()}};function p(){let t=e[n+1];if(r===5&&t===`'`||r===6&&t===`"`)return n++,s=`\\`+t,f[0](),!0}for(;r!==null;)if(n++,a=e[n],!(a===`\\`&&p())){if(c=Rn(a),d=Pn[r],l=d[c]||d.l||8,l===8||(r=l[0],l[1]!==void 0&&(u=f[l[1]],u&&(s=a,u()===!1))))return;if(r===7)return t}}var Vn=new Map;function Hn(e,t){return Pe(e)?e[t]:null}function Un(e,t){if(!Pe(e))return null;let n=Vn.get(t);if(n||(n=Bn(t),n&&Vn.set(t,n)),!n)return null;let r=n.length,i=e,a=0;for(;a`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function Jn(){return{upper:(e,t)=>t===`text`&&q(e)?e.toUpperCase():t===`vnode`&&Pe(e)&&`__v_isVNode`in e?e.children.toUpperCase():e,lower:(e,t)=>t===`text`&&q(e)?e.toLowerCase():t===`vnode`&&Pe(e)&&`__v_isVNode`in e?e.children.toLowerCase():e,capitalize:(e,t)=>t===`text`&&q(e)?qn(e):t===`vnode`&&Pe(e)&&`__v_isVNode`in e?qn(e.children):e}}var Yn;function Xn(e){Yn=e}var Zn;function Qn(e){Zn=e}var $n;function er(e){$n=e}var tr=null,nr=()=>tr,rr=null,ir=e=>{rr=e},ar=()=>rr,or=0;function sr(e={}){let t=Me(e.onWarn)?e.onWarn:Ve,n=q(e.version)?e.version:Gn,r=q(e.locale)||Me(e.locale)?e.locale:Kn,i=Me(r)?Kn:r,a=je(e.fallbackLocale)||Re(e.fallbackLocale)||q(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:i,o=Re(e.messages)?e.messages:cr(i),s=Re(e.datetimeFormats)?e.datetimeFormats:cr(i),c=Re(e.numberFormats)?e.numberFormats:cr(i),l=we(Ee(),e.modifiers,Jn()),u=e.pluralRules||Ee(),d=Me(e.missing)?e.missing:null,f=Ne(e.missingWarn)||Se(e.missingWarn)?e.missingWarn:!0,p=Ne(e.fallbackWarn)||Se(e.fallbackWarn)?e.fallbackWarn:!0,m=!!e.fallbackFormat,h=!!e.unresolving,g=Me(e.postTranslation)?e.postTranslation:null,_=Re(e.processor)?e.processor:null,v=Ne(e.warnHtmlMessage)?e.warnHtmlMessage:!0,y=!!e.escapeParameter,b=Me(e.messageCompiler)?e.messageCompiler:Yn,x=Me(e.messageResolver)?e.messageResolver:Zn||Hn,S=Me(e.localeFallbacker)?e.localeFallbacker:$n||kn,C=Pe(e.fallbackContext)?e.fallbackContext:void 0,w=e,T=Pe(w.__datetimeFormatters)?w.__datetimeFormatters:new Map,E=Pe(w.__numberFormatters)?w.__numberFormatters:new Map,D=Pe(w.__meta)?w.__meta:{};or++;let O={version:n,cid:or,locale:r,fallbackLocale:a,messages:o,modifiers:l,pluralRules:u,missing:d,missingWarn:f,fallbackWarn:p,fallbackFormat:m,unresolving:h,postTranslation:g,processor:_,warnHtmlMessage:v,escapeParameter:y,messageCompiler:b,messageResolver:x,localeFallbacker:S,fallbackContext:C,onWarn:t,__meta:D};return O.datetimeFormats=s,O.numberFormats=c,O.__datetimeFormatters=T,O.__numberFormatters=E,__INTLIFY_PROD_DEVTOOLS__&&xn(O,n,D),O}var cr=e=>({[e]:Ee()});function lr(e,t,n,r,i){let{missing:a,onWarn:o}=e;if(a!==null){let r=a(e,n,t,i);return q(r)?r:t}else return t}function ur(e,t){let n=e;Pe(t)?n.__localeChainObjectCache?.delete(t):n.__localeChainCache?.delete(t)}function dr(e,t,n){ur(e,n),e.fallbackContext&&ur(e.fallbackContext,n),e.localeFallbacker(e,n,t)}function fr(e,t){return e===t?!1:e.split(`-`)[0]===t.split(`-`)[0]}function pr(e,t){let n=t.indexOf(e);if(n===-1)return!1;for(let r=n+1;r{r.includes(e)?s[e]=i[e]:t[e]=i[e]}),q(a)?t.locale=a:Re(a)&&(s=a),Re(o)&&(s=o),s}var vr=typeof Intl<`u`;vr&&Intl.DateTimeFormat,vr&&Intl.NumberFormat;function yr(e,...t){let{datetimeFormats:n,unresolving:r,onWarn:i}=e,{__datetimeFormatters:a}=e;if(!q(t[0])&&!xe(t[0])&&!be(t[0]))return``;let[o,s,c,l]=xr(...t),u=Ne(c.missingWarn)?c.missingWarn:e.missingWarn,d=Ne(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn,f=!!c.part,p=En(e,c);if(!q(o)||o===``){let e=new Intl.DateTimeFormat(p.replace(/!/g,``),l);return f?e.formatToParts(s):e.format(s)}let m=mr(e,o,p,n,u,d,`datetime format`);if(!q(m))return r?-1:o;let h=n[m][o],g=hr(m,o,l),_=a.get(g);return _||(_=new Intl.DateTimeFormat(m,we({},h,l)),a.set(g,_)),f?_.formatToParts(s):_.format(s)}var br=[`localeMatcher`,`weekday`,`era`,`year`,`month`,`day`,`hour`,`minute`,`second`,`timeZoneName`,`formatMatcher`,`hour12`,`timeZone`,`dateStyle`,`timeStyle`,`calendar`,`dayPeriod`,`numberingSystem`,`hourCycle`,`fractionalSecondDigits`];function xr(...e){let[t]=e,n=Ee(),r=Ee(),i;if(q(t)){let e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Tn(wn.INVALID_ISO_DATE_ARGUMENT);let n=e[3]?e[3].trim().startsWith(`T`)?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();i=new Date(n);try{i.toISOString()}catch{throw Tn(wn.INVALID_ISO_DATE_ARGUMENT)}}else if(xe(t)){if(isNaN(t.getTime()))throw Tn(wn.INVALID_DATE_ARGUMENT);i=t}else if(be(t))i=t;else throw Tn(wn.INVALID_ARGUMENT);let a=_r(e,n,r,br);return[n.key||``,i,n,a]}function Sr(e,t,n){gr(e.__datetimeFormatters,t,n)}function Cr(e,...t){let{numberFormats:n,unresolving:r,onWarn:i}=e,{__numberFormatters:a}=e;if(!be(t[0]))return``;let[o,s,c,l]=Tr(...t),u=Ne(c.missingWarn)?c.missingWarn:e.missingWarn,d=Ne(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn,f=!!c.part,p=En(e,c);if(!q(o)||o===``){let e=new Intl.NumberFormat(p.replace(/!/g,``),l);return f?e.formatToParts(s):e.format(s)}let m=mr(e,o,p,n,u,d,`number format`);if(!q(m))return r?-1:o;let h=n[m][o],g=hr(m,o,l),_=a.get(g);return _||(_=new Intl.NumberFormat(m,we({},h,l)),a.set(g,_)),f?_.formatToParts(s):_.format(s)}var wr=[`localeMatcher`,`style`,`currency`,`currencyDisplay`,`currencySign`,`useGrouping`,`minimumIntegerDigits`,`minimumFractionDigits`,`maximumFractionDigits`,`minimumSignificantDigits`,`maximumSignificantDigits`,`compactDisplay`,`notation`,`signDisplay`,`unit`,`unitDisplay`,`roundingMode`,`roundingPriority`,`roundingIncrement`,`trailingZeroDisplay`];function Tr(...e){let[t]=e,n=Ee(),r=Ee();if(!be(t))throw Tn(wn.INVALID_ARGUMENT);let i=t,a=_r(e,n,r,wr);return[n.key||``,i,n,a]}function Er(e,t,n){gr(e.__numberFormatters,t,n)}var Dr=e=>e,Or=e=>``,kr=`text`,Ar=e=>e.length===0?``:Be(e),jr=ze;function Mr(e,t){return e=Math.abs(e),t===2?e===1?0:1:Math.min(e,2)}function Nr(e){let t=be(e.pluralIndex)?e.pluralIndex:-1;return be(e.named?.count)?e.named.count:be(e.named?.n)?e.named.n:t}function Pr(e={}){let t=e.locale,n=Nr(e),r=q(t)&&Me(e.pluralRules?.[t])?e.pluralRules[t]:Mr,i=r===Mr?void 0:Mr,a=e=>e[r(n,e.length,i)],o=e.list||[],s=e=>o[e],c=e.named||Ee();be(e.pluralIndex)&&(c.count||=e.pluralIndex,c.n||=e.pluralIndex);let l=e=>c[e];function u(t,n){return(Me(e.messages)?e.messages(t,!!n):Pe(e.messages)?e.messages[t]:!1)||(e.parent?e.parent.message(t):Or)}let d=t=>e.modifiers?e.modifiers[t]:Dr,f=Me(e.processor?.normalize)?e.processor.normalize:Ar,p=Me(e.processor?.interpolate)?e.processor.interpolate:jr,m={list:s,named:l,plural:a,linked:(e,...t)=>{let[n,r]=t,i=`text`,a=``;t.length===1?Pe(n)?(a=n.modifier||a,i=n.type||i):q(n)&&(a=n||a):t.length===2&&(q(n)&&(a=n||a),q(r)&&(i=r||i));let o=u(e,!0)(m),s=o===``||o===void 0?e:o,c=i===`vnode`&&je(s)&&a?s[0]:s;return a?d(a)(c,i):c},message:u,type:q(e.processor?.type)?e.processor.type:kr,interpolate:p,normalize:f,values:we(Ee(),o,c)};return m}var Fr=()=>``,Ir=e=>Me(e);function Lr(e,...t){let{fallbackFormat:n,postTranslation:r,unresolving:i,messageCompiler:a,fallbackLocale:o,messages:s}=e,[c,l]=Hr(...t),u=Ne(l.missingWarn)?l.missingWarn:e.missingWarn,d=Ne(l.fallbackWarn)?l.fallbackWarn:e.fallbackWarn,f=Ne(l.escapeParameter)?l.escapeParameter:e.escapeParameter,p=!!l.resolvedMessage,m=q(l.default)||Ne(l.default)?Ne(l.default)?a?c:()=>c:l.default:n?a?c:()=>c:null,h=n||m!=null&&(q(m)||Me(m)),g=En(e,l);f&&Rr(l);let[_,v,y]=p?[c,g,s[g]||Ee()]:zr(e,c,g,o,d,u),b=_,x=c;if(!p&&!(q(b)||Wt(b)||Ir(b))&&h&&(b=m,x=b),!p&&(!(q(b)||Wt(b)||Ir(b))||!q(v)))return i?-1:c;let S=!1,C=Ir(b)?b:Br(e,c,v,b,x,()=>{S=!0});if(S)return b;let w=Vr(e,C,Pr(Wr(e,v,y,l))),T=r?r(w,c):w;if(f&&q(T)&&(T=rt(T)),__INTLIFY_PROD_DEVTOOLS__){let t={timestamp:Date.now(),key:q(c)?c:Ir(b)?b.key:``,locale:v||(Ir(b)?b.locale:``),format:q(b)?b:Ir(b)?b.source:``,message:T};t.meta=we({},e.__meta,nr()||{}),Sn(t)}return T}function Rr(e){je(e.list)?e.list=e.list.map(e=>q(e)?He(e):e):Pe(e.named)&&Object.keys(e.named).forEach(t=>{q(e.named[t])&&(e.named[t]=He(e.named[t]))})}function zr(e,t,n,r,i,a){let{messages:o,onWarn:s,messageResolver:c,localeFallbacker:l}=e,u=l(e,r,n),d=Ee(),f,p=null;for(let n=0;nr);return e.locale=n,e.key=t,e}let c=o(r,Ur(e,n,i,r,s,a));return c.locale=n,c.key=t,c.source=r,c}function Vr(e,t,n){return t(n)}function Hr(...e){let[t,n,r]=e,i=Ee();if(!q(t)&&!be(t)&&!Ir(t)&&!Wt(t))throw Tn(wn.INVALID_ARGUMENT);let a=be(t)?String(t):(Ir(t),t);return be(n)?i.plural=n:q(n)?i.default=n:Re(n)&&!Ce(n)?i.named=n:je(n)&&(i.list=n),be(r)?i.plural=r:q(r)?i.default=r:Re(r)&&we(i,r),[a,i]}function Ur(e,t,n,r,i,a){return{locale:t,key:n,warnHtmlMessage:i,onError:e=>{throw a&&a(e),e},onCacheKey:e=>ve(t,n,e)}}function Wr(e,t,n,r){let{modifiers:i,pluralRules:a,messageResolver:o,fallbackLocale:s,fallbackWarn:c,missingWarn:l,fallbackContext:u}=e,d={locale:t,modifiers:i,pluralRules:a,messages:(r,i)=>{let a=o(n,r);if(a==null&&(u||i)){let[n,,i]=zr(u||e,r,t,s,c,l);a=n??o(i,r)}if(q(a)||Wt(a)){let n=!1,i=Br(e,r,t,a,r,()=>{n=!0});return n?Fr:i}else if(Ir(a))return a;else return Fr}};return e.processor&&(d.processor=e.processor),r.list&&(d.list=r.list),r.named&&(d.named=r.named),be(r.plural)&&(d.pluralIndex=r.plural),d}Ut();var Gr=`11.4.12`;function Kr(){typeof __VUE_I18N_FULL_INSTALL__!=`boolean`&&(Oe().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!=`boolean`&&(Oe().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!=`boolean`&&(Oe().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!=`boolean`&&(Oe().__INTLIFY_PROD_DEVTOOLS__=!1)}var qr={UNEXPECTED_RETURN_TYPE:24,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function Jr(e,...t){return lt(e,null,void 0)}qr.UNEXPECTED_RETURN_TYPE,qr.INVALID_ARGUMENT,qr.MUST_BE_CALL_SETUP_TOP,qr.NOT_INSTALLED,qr.UNEXPECTED_ERROR,qr.REQUIRED_VALUE,qr.INVALID_VALUE,qr.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN,qr.NOT_INSTALLED_WITH_PROVIDE,qr.NOT_COMPATIBLE_LEGACY_VUE_I18N,qr.NOT_AVAILABLE_COMPOSITION_IN_LEGACY;var Yr=_e(`__translateVNode`),Xr=_e(`__datetimeParts`),Zr=_e(`__numberParts`),Qr=_e(`__setPluralRules`);_e(`__intlifyMeta`);var $r=_e(`__injectWithOption`),ei=_e(`__dispose`),ti={FALLBACK_TO_ROOT:10,NOT_FOUND_PARENT_SCOPE:11,IGNORE_OBJ_FLATTEN:12,DEPRECATE_LEGACY_MODE:13,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:14,DUPLICATE_USE_I18N_CALLING:15};ti.FALLBACK_TO_ROOT,ti.NOT_FOUND_PARENT_SCOPE,ti.IGNORE_OBJ_FLATTEN,ti.DEPRECATE_LEGACY_MODE,ti.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE,ti.DUPLICATE_USE_I18N_CALLING;var ni=null;{let e=Oe().__VUE_INSTANCE_SETTERS__;je(e)&&e.push(e=>{ni=e})}function ri(e){if(!Pe(e)||Wt(e))return e;for(let t in e)if(Ae(e,t))if(!t.includes(`.`))Pe(e[t])&&ri(e[t]);else{let n=t.split(`.`),r=n.length-1,i=e,a=!1;for(let e=0;e{if(`locale`in e&&`resource`in e){let{locale:t,resource:n}=e;t?(o[t]=o[t]||Ee(),at(n,o[t])):at(n,o)}else q(e)&&at(JSON.parse(e),o)}),i==null&&a)for(let e in o)Ae(o,e)&&ri(o[e]);return o}function ai(e){return e.type}function oi(e,t,n){let r=Pe(t.messages)?t.messages:Ee();`__i18nGlobal`in n&&(r=ii(e.locale.value,{messages:r,__i18n:n.__i18nGlobal}));let i=Object.keys(r);if(i.length&&i.forEach(t=>{e.mergeLocaleMessage(t,r[t])}),Pe(t.datetimeFormats)){let n=Object.keys(t.datetimeFormats);n.length&&n.forEach(n=>{e.mergeDateTimeFormat(n,t.datetimeFormats[n])})}if(Pe(t.numberFormats)){let n=Object.keys(t.numberFormats);n.length&&n.forEach(n=>{e.mergeNumberFormat(n,t.numberFormats[n])})}}function si(e){return v(ce,null,e,0)}function ci(){return ni??y()}var li=()=>[],ui=()=>!1,di=0;function fi(e){return((t,n,r,i)=>e(n,r,ci()||void 0,i))}function pi(e={}){let{__root:t,__injectWithOption:n}=e,r=t===void 0,i=e.flatJson,a=ge?R:ue,o=Ne(e.inheritLocale)?e.inheritLocale:!0,c=a(t&&o?t.locale.value:q(e.locale)?e.locale:Kn),l=a(t&&o?t.fallbackLocale.value:q(e.fallbackLocale)||je(e.fallbackLocale)||Re(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:c.value),u=a(ii(c.value,e)),d=a(Re(e.datetimeFormats)?e.datetimeFormats:{[c.value]:{}}),f=a(Re(e.numberFormats)?e.numberFormats:{[c.value]:{}}),p=t?t.missingWarn:Ne(e.missingWarn)||Se(e.missingWarn)?e.missingWarn:!0,m=t?t.fallbackWarn:Ne(e.fallbackWarn)||Se(e.fallbackWarn)?e.fallbackWarn:!0,h=t?t.fallbackRoot:Ne(e.fallbackRoot)?e.fallbackRoot:!0,g=!!e.fallbackFormat,_=Me(e.missing)?e.missing:null,v=Me(e.missing)?fi(e.missing):null,y=Me(e.postTranslation)?e.postTranslation:null,b=t?t.warnHtmlMessage:Ne(e.warnHtmlMessage)?e.warnHtmlMessage:!0,x=!!e.escapeParameter,S=t?t.modifiers:Re(e.modifiers)?e.modifiers:{},C=e.pluralRules||t&&t.pluralRules,w;w=(()=>{r&&ir(null);let t={version:Gr,locale:c.value,fallbackLocale:l.value,messages:u.value,modifiers:S,pluralRules:C,missing:v===null?void 0:v,missingWarn:p,fallbackWarn:m,fallbackFormat:g,unresolving:!0,postTranslation:y===null?void 0:y,warnHtmlMessage:b,escapeParameter:x,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:`vue`}};t.datetimeFormats=d.value,t.numberFormats=f.value,t.__datetimeFormatters=Re(w)?w.__datetimeFormatters:void 0,t.__numberFormatters=Re(w)?w.__numberFormatters:void 0;let n=sr(t);return r&&ir(n),n})(),dr(w,c.value,l.value);function T(){return[c.value,l.value,u.value,d.value,f.value]}let E=L({get:()=>c.value,set:e=>{w.locale=e,c.value=e}});function D(e){r||(w.fallbackContext=t?ar():void 0);try{dr(w,c.value,e)}finally{r||(w.fallbackContext=void 0)}}let O=L({get:()=>l.value,set:e=>{l.value=e,w.fallbackLocale=l.value,D(l.value)}}),k=L(()=>u.value),A=L(()=>d.value),j=L(()=>f.value);function M(){return Me(y)?y:null}function N(e){y=e,w.postTranslation=e}function ee(){return _}function P(e){e!==null&&(v=fi(e)),_=e,w.missing=v}let F=(e,n,i,a,o,s)=>{T();let c;try{__INTLIFY_PROD_DEVTOOLS__,r||(w.fallbackContext=t?ar():void 0),c=e(w)}finally{__INTLIFY_PROD_DEVTOOLS__,r||(w.fallbackContext=void 0)}if(i!==`translate exists`&&be(c)&&c===-1||i===`translate exists`&&!c){let[e,r]=n();return t&&h?a(t):o(e)}else if(s(c))return c;else throw Jr(qr.UNEXPECTED_RETURN_TYPE)};function I(...e){return F(t=>Reflect.apply(Lr,null,[t,...e]),()=>Hr(...e),`translate`,t=>Reflect.apply(t.t,t,[...e]),e=>e,e=>q(e))}function te(...e){let[t,n,r]=e;if(r&&!Pe(r))throw Jr(qr.INVALID_ARGUMENT);return I(t,n,we({resolvedMessage:!0},r||{}))}function ne(...e){return F(t=>Reflect.apply(yr,null,[t,...e]),()=>xr(...e),`datetime format`,t=>Reflect.apply(t.d,t,[...e]),()=>``,e=>q(e)||je(e))}function re(...e){return F(t=>Reflect.apply(Cr,null,[t,...e]),()=>Tr(...e),`number format`,t=>Reflect.apply(t.n,t,[...e]),()=>``,e=>q(e)||je(e))}function ie(e){return e.map(e=>q(e)||be(e)||Ne(e)?si(String(e)):e)}let ae={normalize:ie,interpolate:e=>e,type:`vnode`};function oe(...e){return F(t=>{let n,r=t;try{r.processor=ae,n=Reflect.apply(Lr,null,[r,...e])}finally{r.processor=null}return n},()=>Hr(...e),`translate`,t=>t[Yr](...e),e=>[si(e)],e=>je(e))}function se(...e){return F(t=>Reflect.apply(Cr,null,[t,...e]),()=>Tr(...e),`number format`,t=>t[Zr](...e),li,e=>q(e)||je(e))}function z(...e){return F(t=>Reflect.apply(yr,null,[t,...e]),()=>xr(...e),`datetime format`,t=>t[Xr](...e),li,e=>q(e)||je(e))}function ce(e){C=e,w.pluralRules=C}function B(e,t){return F(()=>{if(!e)return!1;let n=q(t)?t:c.value,r=q(t)?[n]:An(w,l.value,n);for(let t=0;t[e],`translate exists`,n=>Reflect.apply(n.te,n,[e,t]),ui,e=>Ne(e))}function le(e){let t=null,n=An(w,l.value,c.value);for(let r=0;rD(l.value),{deep:!0,flush:`sync`}),t&&ge&&(s(t.locale,e=>{o&&(c.value=e,w.locale=e,dr(w,c.value,l.value))}),s(t.fallbackLocale,e=>{o&&(l.value=e,w.fallbackLocale=l.value,dr(w,c.value,l.value))}));let he={id:di,locale:E,fallbackLocale:O,get inheritLocale(){return o},set inheritLocale(e){o=e,e&&t&&(E.value=t.locale.value,O.value=t.fallbackLocale.value)},get availableLocales(){return Object.keys(u.value).sort()},messages:k,get modifiers(){return S},get pluralRules(){return C||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(e){p=e,w.missingWarn=p},get fallbackWarn(){return m},set fallbackWarn(e){m=e,w.fallbackWarn=m},get fallbackRoot(){return h},set fallbackRoot(e){h=e},get fallbackFormat(){return g},set fallbackFormat(e){g=e,w.fallbackFormat=g},get warnHtmlMessage(){return b},set warnHtmlMessage(e){b=e,w.warnHtmlMessage=e},get escapeParameter(){return x},set escapeParameter(e){x=e,w.escapeParameter=e},t:I,getLocaleMessage:V,setLocaleMessage:fe,mergeLocaleMessage:H,getPostTranslationHandler:M,setPostTranslationHandler:N,getMissingHandler:ee,setMissingHandler:P,[Qr]:ce};return he.datetimeFormats=A,he.numberFormats=j,he.rt=te,he.te=B,he.tm=de,he.d=ne,he.n=re,he.getDateTimeFormat=U,he.setDateTimeFormat=W,he.mergeDateTimeFormat=G,he.getNumberFormat=K,he.setNumberFormat=pe,he.mergeNumberFormat=me,he[$r]=n,he[Yr]=oe,he[Xr]=z,he[Zr]=se,he}function mi(e){let t=q(e.locale)?e.locale:Kn,n=q(e.fallbackLocale)||je(e.fallbackLocale)||Re(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:t,r=Me(e.missing)?e.missing:void 0,i=Ne(e.silentTranslationWarn)||Se(e.silentTranslationWarn)?!e.silentTranslationWarn:!0,a=Ne(e.silentFallbackWarn)||Se(e.silentFallbackWarn)?!e.silentFallbackWarn:!0,o=Ne(e.fallbackRoot)?e.fallbackRoot:!0,s=!!e.formatFallbackMessages,c=Re(e.modifiers)?e.modifiers:{},l=e.pluralizationRules,u=Me(e.postTranslation)?e.postTranslation:void 0,d=q(e.warnHtmlInMessage)?e.warnHtmlInMessage!==`off`:!0,f=!!e.escapeParameterHtml,p=Ne(e.sync)?e.sync:!0,m=e.messages;if(Re(e.sharedMessages)){let t=e.sharedMessages;m=Object.keys(t).reduce((e,n)=>(we(e[n]||(e[n]={}),t[n]),e),m||{})}let{__i18n:h,__root:g,__injectWithOption:_}=e,v=e.datetimeFormats,y=e.numberFormats,b=e.flatJson;return{locale:t,fallbackLocale:n,messages:m,flatJson:b,datetimeFormats:v,numberFormats:y,missing:r,missingWarn:i,fallbackWarn:a,fallbackRoot:o,fallbackFormat:s,modifiers:c,pluralRules:l,postTranslation:u,warnHtmlMessage:d,escapeParameter:f,messageResolver:e.messageResolver,inheritLocale:p,__i18n:h,__root:g,__injectWithOption:_}}function hi(e={}){let t=pi(mi(e)),{__extender:n}=e,r={id:t.id,get locale(){return t.locale.value},set locale(e){t.locale.value=e},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(e){t.fallbackLocale.value=e},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get missing(){return t.getMissingHandler()},set missing(e){t.setMissingHandler(e)},get silentTranslationWarn(){return Ne(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(e){t.missingWarn=Ne(e)?!e:e},get silentFallbackWarn(){return Ne(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(e){t.fallbackWarn=Ne(e)?!e:e},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(e){t.fallbackFormat=e},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(e){t.setPostTranslationHandler(e)},get sync(){return t.inheritLocale},set sync(e){t.inheritLocale=e},get warnHtmlInMessage(){return t.warnHtmlMessage?`warn`:`off`},set warnHtmlInMessage(e){t.warnHtmlMessage=e!==`off`},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(e){t.escapeParameter=e},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...e){return Reflect.apply(t.t,t,[...e])},rt(...e){return Reflect.apply(t.rt,t,[...e])},te(e,n){return t.te(e,n)},tm(e){return t.tm(e)},getLocaleMessage(e){return t.getLocaleMessage(e)},setLocaleMessage(e,n){t.setLocaleMessage(e,n)},mergeLocaleMessage(e,n){t.mergeLocaleMessage(e,n)},d(...e){return Reflect.apply(t.d,t,[...e])},getDateTimeFormat(e){return t.getDateTimeFormat(e)},setDateTimeFormat(e,n){t.setDateTimeFormat(e,n)},mergeDateTimeFormat(e,n){t.mergeDateTimeFormat(e,n)},n(...e){return Reflect.apply(t.n,t,[...e])},getNumberFormat(e){return t.getNumberFormat(e)},setNumberFormat(e,n){t.setNumberFormat(e,n)},mergeNumberFormat(e,n){t.mergeNumberFormat(e,n)}};return r.__extender=n,r}function gi(e,t,n){return{beforeCreate(){let r=ci();if(!r)throw Jr(qr.UNEXPECTED_ERROR);let i=this.$options;if(i.i18n){let r=i.i18n;if(i.__i18n&&(r.__i18n=i.__i18n),r.__root=t,this===this.$root)this.$i18n=_i(e,r);else{r.__injectWithOption=!0,r.__extender=n.__vueI18nExtend,this.$i18n=hi(r);let e=this.$i18n;e.__extender&&(e.__disposer=e.__extender(this.$i18n))}}else if(i.__i18n)if(this===this.$root)this.$i18n=_i(e,i);else{this.$i18n=hi({__i18n:i.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:t});let e=this.$i18n;e.__extender&&(e.__disposer=e.__extender(this.$i18n))}else this.$i18n=e;i.__i18nGlobal&&oi(t,i,i),this.$t=(...e)=>this.$i18n.t(...e),this.$rt=(...e)=>this.$i18n.rt(...e),this.$te=(e,t)=>this.$i18n.te(e,t),this.$d=(...e)=>this.$i18n.d(...e),this.$n=(...e)=>this.$i18n.n(...e),this.$tm=e=>this.$i18n.tm(e),n.__setInstance(r,this.$i18n)},mounted(){},unmounted(){let e=ci();if(!e)throw Jr(qr.UNEXPECTED_ERROR);let t=this.$i18n;t&&(delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,t?.__disposer&&(t.__disposer(),delete t.__disposer,delete t.__extender),n.__deleteInstance(e),delete this.$i18n)}}}function _i(e,t){e.locale=t.locale||e.locale,e.fallbackLocale=t.fallbackLocale||e.fallbackLocale,e.missing=t.missing||e.missing,e.silentTranslationWarn=t.silentTranslationWarn||e.silentFallbackWarn,e.silentFallbackWarn=t.silentFallbackWarn||e.silentFallbackWarn,e.formatFallbackMessages=t.formatFallbackMessages||e.formatFallbackMessages,e.postTranslation=t.postTranslation||e.postTranslation,e.warnHtmlInMessage=t.warnHtmlInMessage||e.warnHtmlInMessage,e.escapeParameterHtml=t.escapeParameterHtml||e.escapeParameterHtml,e.sync=t.sync||e.sync,e.__composer[Qr](t.pluralizationRules||e.pluralizationRules);let n=ii(e.locale,{messages:t.messages,__i18n:t.__i18n});return Object.keys(n).forEach(t=>e.mergeLocaleMessage(t,n[t])),t.datetimeFormats&&Object.keys(t.datetimeFormats).forEach(n=>e.mergeDateTimeFormat(n,t.datetimeFormats[n])),t.numberFormats&&Object.keys(t.numberFormats).forEach(n=>e.mergeNumberFormat(n,t.numberFormats[n])),e}var vi={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e===`parent`||e===`global`,default:`parent`},i18n:{type:Object}};function yi({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((e,t)=>[...e,...t.type===M?t.children:[t]],[]):t.reduce((t,n)=>{let r=e[n];return r&&(t[n]=r()),t},Ee())}function bi(){return M}var xi=G({name:`i18n-t`,props:we({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>be(e)||!isNaN(e)}},vi),setup(e,t){let{slots:n,attrs:r}=t,i=e.i18n||J({useScope:e.scope,__useComponent:!0});return()=>{let o=()=>{let r=Object.keys(n).filter(e=>e[0]!==`_`),a=Ee();e.locale&&(a.locale=e.locale),e.plural!==void 0&&(a.plural=q(e.plural)?+e.plural:e.plural);let o=yi(t,r);return i[Yr](e.keypath,o,a)},s=we(Ee(),r),c=q(e.tag)||Pe(e.tag)?e.tag:bi();return Pe(c)?a(c,s,{default:o}):a(c,s,o())}}});function Si(e){return je(e)&&!q(e[0])}function Ci(e,t,n,r){let{slots:i,attrs:o}=t;return()=>{let t=()=>{let t={part:!0},a=Ee();e.locale&&(t.locale=e.locale),q(e.format)?t.key=e.format:Pe(e.format)&&(q(e.format.key)&&(t.key=e.format.key),a=Object.keys(e.format).reduce((t,r)=>n.includes(r)?we(Ee(),t,{[r]:e.format[r]}):t,Ee()));let o=r(e.value,t,a),s=[t.key];return je(o)?s=o.map((e,t)=>{let n=i[e.type],r=n?n({[e.type]:e.value,index:t,parts:o}):[e.value];return Si(r)&&(r[0].key=`${e.type}-${t}`),r}):q(o)&&(s=[o]),s},s=we(Ee(),o),c=q(e.tag)||Pe(e.tag)?e.tag:bi();return Pe(c)?a(c,s,{default:t}):a(c,s,t())}}var wi=G({name:`i18n-n`,props:we({value:{type:Number,required:!0},format:{type:[String,Object]}},vi),setup(e,t){let n=e.i18n||J({useScope:e.scope,__useComponent:!0});return Ci(e,t,wr,(...e)=>n[Zr](...e))}});function Ti(e,t){let n=e;if(e.mode===`composition`)return n.__getInstance(t)||e.global;{let r=n.__getInstance(t);return r==null?e.global.__composer:r.__composer}}function Ei(e){let t=t=>{let{instance:n,value:r}=t;if(!n||!n.$)throw Jr(qr.UNEXPECTED_ERROR);let i=Ti(e,n.$),a=Di(r);return[Reflect.apply(i.t,i,[...Oi(a)]),i]};return{created:(e,n)=>{let[r,i]=t(n);ge&&(e.__i18nWatcher=s(i.locale,()=>{n.instance&&n.instance.$forceUpdate()})),e.__composer=i,e.textContent=r},unmounted:e=>{ge&&e.__i18nWatcher&&(e.__i18nWatcher(),e.__i18nWatcher=void 0,delete e.__i18nWatcher),e.__composer&&(e.__composer=void 0,delete e.__composer)},beforeUpdate:(e,{value:t})=>{if(e.__composer){let n=e.__composer,r=Di(t);e.textContent=Reflect.apply(n.t,n,[...Oi(r)])}},getSSRProps:e=>{let[n]=t(e);return{textContent:n}}}}function Di(e){if(q(e))return{path:e};if(Re(e)){if(!(`path`in e))throw Jr(qr.REQUIRED_VALUE,`path`);return e}else throw Jr(qr.INVALID_VALUE)}function Oi(e){let{path:t,locale:n,args:r,choice:i,plural:a}=e,o={},s=r||{};return q(n)&&(o.locale=n),be(i)&&(o.plural=i),be(a)&&(o.plural=a),[t,s,o]}function ki(e,t,...n){let r=Re(n[0])?n[0]:{};(!Ne(r.globalInstall)||r.globalInstall)&&([xi.name,`I18nT`].forEach(t=>e.component(t,xi)),[wi.name,`I18nN`].forEach(t=>e.component(t,wi)),[Hi.name,`I18nD`].forEach(t=>e.component(t,Hi))),e.directive(`t`,Ei(t))}var Ai=_e(`global-vue-i18n`);function ji(e={}){let t=__VUE_I18N_LEGACY_API__&&Ne(e.legacy)?e.legacy:__VUE_I18N_LEGACY_API__,n=Ne(e.globalInjection)?e.globalInjection:!0,r=new Map,[i,a]=Mi(e,t),o=_e(``);function s(e){return r.get(e)||null}function c(e,t){r.set(e,t)}function l(e){r.delete(e)}let u={get mode(){return __VUE_I18N_LEGACY_API__&&t?`legacy`:`composition`},async install(e,...r){if(e.__VUE_I18N_SYMBOL__=o,e.provide(e.__VUE_I18N_SYMBOL__,u),Re(r[0])){let e=r[0];u.__composerExtend=e.__composerExtend,u.__vueI18nExtend=e.__vueI18nExtend}let i=null;!t&&n&&(i=Vi(e,u.global)),__VUE_I18N_FULL_INSTALL__&&ki(e,u,...r),__VUE_I18N_LEGACY_API__&&t&&e.mixin(gi(a,a.__composer,u));let s=e.unmount;e.unmount=()=>{i&&i(),u.dispose(),s()}},get global(){return a},dispose(){i.stop()},__instances:r,__getInstance:s,__setInstance:c,__deleteInstance:l};return u}function J(e={}){let n=ci();if(n==null)throw Jr(qr.MUST_BE_CALL_SETUP_TOP);if(!n.isCE&&n.appContext.app!=null&&!n.appContext.app.__VUE_I18N_SYMBOL__)throw Jr(qr.NOT_INSTALLED);let r=Ni(n),i=Fi(r),a=ai(n),o=Pi(e,a);if(o===`global`)return oi(i,e,a),i;if(o===`parent`){let t=Ii(r,n,e.__useComponent);return t??=i,t}if(o===`isolated`){if(r.mode!==`composition`)throw Jr(qr.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);let a=r,o=we({},e);o.__root=Ii(r,n)||i;let s=pi(o);return a.__composerExtend&&(s[ei]=a.__composerExtend(s)),C()&&t(()=>{let e=s[ei];e&&(e(),delete s[ei])}),s}let s=r,c=s.__getInstance(n);if(c==null){let t=we({},e);`__i18n`in a&&(t.__i18n=a.__i18n),i&&(t.__root=i),c=pi(t),s.__composerExtend&&(c[ei]=s.__composerExtend(c)),Ri(s,n,c),s.__setInstance(n,c)}return c}function Mi(e,t){let n=w(),r=__VUE_I18N_LEGACY_API__&&t?n.run(()=>hi(e)):n.run(()=>pi(e));if(r==null)throw Jr(qr.UNEXPECTED_ERROR);return[n,r]}function Ni(e){let t=m(e.isCE?Ai:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw Jr(e.isCE?qr.NOT_INSTALLED_WITH_PROVIDE:qr.UNEXPECTED_ERROR);return t}function Pi(e,t){return Ce(e)?`__i18n`in t?`local`:`global`:e.useScope?e.useScope:`local`}function Fi(e){return e.mode===`composition`?e.global:e.global.__composer}function Ii(e,t,n=!1){let r=null,i=t.root,a=Li(t,n);for(;a!=null;){let t=e;if(e.mode===`composition`)r=t.__getInstance(a);else if(__VUE_I18N_LEGACY_API__){let e=t.__getInstance(a);e!=null&&(r=e.__composer,n&&r&&!r[$r]&&(r=null))}if(r!=null||i===a)break;a=a.parent}return r}function Li(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function Ri(e,t,n){p(()=>{},t),h(()=>{let r=n;e.__deleteInstance(t);let i=r[ei];i&&(i(),delete r[ei])},t)}var zi=[`locale`,`fallbackLocale`,`availableLocales`],Bi=[`t`,`rt`,`d`,`n`,`tm`,`te`];function Vi(e,t){let n=Object.create(null);return zi.forEach(e=>{let r=Object.getOwnPropertyDescriptor(t,e);if(!r)throw Jr(qr.UNEXPECTED_ERROR);let i=T(r.value)?{get(){return r.value.value},set(e){r.value.value=e}}:{get(){return r.get&&r.get()}};Object.defineProperty(n,e,i)}),e.config.globalProperties.$i18n=n,Bi.forEach(n=>{let r=Object.getOwnPropertyDescriptor(t,n);if(!r||!r.value)throw Jr(qr.UNEXPECTED_ERROR);Object.defineProperty(e.config.globalProperties,`$${n}`,r)}),()=>{delete e.config.globalProperties.$i18n,Bi.forEach(t=>{delete e.config.globalProperties[`$${t}`]})}}var Hi=G({name:`i18n-d`,props:we({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},vi),setup(e,t){let n=e.i18n||J({useScope:e.scope,__useComponent:!0});return Ci(e,t,br,(...e)=>n[Xr](...e))}});if(Kr(),Xn(vn),Qn(Un),er(An),__INTLIFY_PROD_DEVTOOLS__){let e=Oe();e.__INTLIFY__=!0,bn(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}var Ui=`/brand/pythinker_banner_dark.svg`;async function Wi(e){let t=typeof navigator<`u`?navigator.clipboard:void 0;if(t&&typeof t.writeText==`function`)try{return await t.writeText(e),!0}catch{}return Ki(e)}function Gi(e){if(typeof e!=`string`)return;let t=typeof navigator<`u`?navigator.clipboard:void 0;t&&typeof t.writeText==`function`||Wi(e)}function Ki(e){if(typeof document>`u`||typeof document.execCommand!=`function`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,t.style.left=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand(`copy`)}catch{n=!1}finally{document.body.removeChild(t)}return n}var qi={permission:`pythinker-web.permission`,activeWorkspace:`pythinker-active-workspace`,planMode:`pythinker-web.plan-mode`,planArmed:`pythinker-web.plan-armed`,dynamicWorkflowMode:`pythinker-web.dynamic-workflow-mode`,goalMode:`pythinker-web.goal-mode`,discussionPair:`pythinker-web.discussion-pair`,discussionReasoning:`pythinker-web.discussion-reasoning`,uiFontSize:`pythinker-web.ui-font-size`,starredModels:`pythinker-web.starred-models`,unread:`pythinker-web.unread`,onboarded:`pythinker-web.onboarded`,accent:`pythinker-web.accent`,colorScheme:`pythinker-web.color-scheme`,hiddenWorkspaces:`pythinker-web.hidden-workspaces`,collapsedWorkspaces:`pythinker-web.collapsed-workspaces`,workspaceOrder:`pythinker-web.workspace-order`,workspaceNameOverrides:`pythinker-web.workspace-name-overrides`,workspaceSort:`pythinker-web.workspace-sort`,pinnedSessions:`pythinker-web.pinned-sessions`,pinnedCollapsed:`pythinker-web.pinned-collapsed`,recentEmojis:`pythinker-web.recent-emojis`,conversationToc:`pythinker-web.beta-toc`,turnFolding:`pythinker-web.turn-folding`,activityRunFolding:`pythinker-web.activity-run-folding`,notifyOnComplete:`pythinker-web.notify-on-complete`,notifyOnQuestion:`pythinker-web.notify-on-question`,notifyOnApproval:`pythinker-web.notify-on-approval`,soundOnComplete:`pythinker-web.sound-on-complete`,inputHistory:`pythinker-web.input-history`,clientId:`pythinker-web.client-id`,debug:`pythinker-web.debug`,openInLastTarget:`pythinker-web.open-in.last-target`,sidebarCollapsed:`pythinker-web.sidebar-collapsed`,sidebarPinnedHeight:`pythinker-web.sidebar-pinned-height`,sidebarWidth:`pythinker-web.sidebar-width`,codeFont:`pythinker-web.code-font`,contentAlign:`pythinker-web.content-align`,theme:`pythinker-web.theme`,thinking:`pythinker-web.thinking`};function Ji(e){return`pythinker-web.draft.${e&&e.length>0?e:`__new__`}`}function Yi(e){try{return globalThis.localStorage.getItem(e)}catch{return null}}function Xi(e,t){try{globalThis.localStorage.setItem(e,t)}catch{}}function Zi(e){try{globalThis.localStorage.removeItem(e)}catch{}}function Qi(e){let t=Yi(e);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}function $i(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}function ea(){let e=Yi(qi.unread);if(!e)return{};try{let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))r===!0&&(n[e]=!0);return n}catch{return{}}}function ta(e){let t={...ea()};for(let[n,r]of Object.entries(e))r?t[n]=!0:delete t[n];Xi(qi.unread,JSON.stringify(t))}function na(){let e=Qi(qi.collapsedWorkspaces);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function ra(e){$i(qi.collapsedWorkspaces,Array.from(e))}function ia(){let e=Qi(qi.workspaceOrder);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function aa(e){$i(qi.workspaceOrder,Array.from(e))}function oa(){let e=Qi(qi.workspaceNameOverrides);if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function sa(e){$i(qi.workspaceNameOverrides,e)}function ca(){return Yi(qi.workspaceSort)}function la(e){Xi(qi.workspaceSort,e)}function ua(e,t){if(e.length===0)return null;let n=new Set(e),r=t.filter(e=>n.has(e)),i=e.filter(e=>!t.includes(e));return i.length===0&&r.length===t.length?null:[...i,...r]}function da(e,t){let n=new Map(t.map((e,t)=>[e,t]));return e.toSorted((e,t)=>(n.get(e.id)??-1)-(n.get(t.id)??-1))}function fa(e,t,n,r=`before`){let i=e.indexOf(t),a=e.indexOf(n);if(i===-1||a===-1||i===a)return e;let o=[...e];o.splice(i,1);let s=i(t.get(n.id)??-1/0)-(t.get(e.id)??-1/0))}var ma={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function ha(e){return e.replace(/[&<>"']/g,e=>ma[e]??e)}function ga(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _a(e,t,n=40){let r=e.replace(/\s+/g,` `).trim();if(r.length===0)return``;let i=t.trim();if(i.length===0)return va(r,n*2);let a=r.toLowerCase().indexOf(i.toLowerCase());if(a<0)return va(r,n*2);let o=Math.max(0,a-n),s=Math.min(r.length,a+i.length+n),c=o>0,l=s`${e}`)}var ba=R(0),xa=[`type`,`disabled`,`aria-label`],Sa=G({__name:`IconButton`,props:{size:{default:`md`},disabled:{type:Boolean},label:{},type:{default:`button`}},setup(e,{expose:t}){let n=R();return t({el:n}),(t,r)=>(c(),W(`button`,{ref_key:`el`,ref:n,class:V([`ui-icon-button`,`ui-icon-button--${e.size}`]),type:e.type,disabled:e.disabled,"aria-label":e.label},[me(t.$slots,`default`,{},void 0,!0)],10,xa))}}),Y=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ca=Y(Sa,[[`__scopeId`,`data-v-4b23513f`]]),wa=R(!1),Ta=!1;function Ea(){let e=document.documentElement.dataset.colorScheme;return e===`dark`?!0:e===`light`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-color-scheme: dark)`).matches}function Da(){return!Ta&&typeof window<`u`&&typeof document<`u`&&(Ta=!0,wa.value=Ea(),new MutationObserver(()=>{wa.value=Ea()}).observe(document.documentElement,{attributes:!0,attributeFilter:[`data-color-scheme`]}),window.matchMedia?.(`(prefers-color-scheme: dark)`)?.addEventListener(`change`,()=>{wa.value=Ea()})),wa}var Oa={"._sc_":`godot-assets`,".adonisrc.json":`adonis`,".aiexclude":`gemini-ai`,".angular-cli.json":`angular`,".appveyor.yml":`appveyor`,".astylerc":`astyle`,".autorc":`auto`,".babel-plugin-macrosrc":`babel`,".babel-plugin-macrosrc.cjs":`babel`,".babel-plugin-macrosrc.cts":`babel`,".babel-plugin-macrosrc.js":`babel`,".babel-plugin-macrosrc.json":`babel`,".babel-plugin-macrosrc.json5":`babel`,".babel-plugin-macrosrc.jsonc":`babel`,".babel-plugin-macrosrc.mjs":`babel`,".babel-plugin-macrosrc.mts":`babel`,".babel-plugin-macrosrc.toml":`babel`,".babel-plugin-macrosrc.ts":`babel`,".babel-plugin-macrosrc.yaml":`babel`,".babel-plugin-macrosrc.yml":`babel`,".babelrc":`babel`,".babelrc.cjs":`babel`,".babelrc.cts":`babel`,".babelrc.js":`babel`,".babelrc.json":`babel`,".babelrc.json5":`babel`,".babelrc.jsonc":`babel`,".babelrc.mjs":`babel`,".babelrc.mts":`babel`,".babelrc.toml":`babel`,".babelrc.ts":`babel`,".babelrc.yaml":`babel`,".babelrc.yml":`babel`,".bazelignore":`bazel`,".bazelrc":`bazel`,".bazelversion":`bazel`,".biome.json":`biome`,".biome.jsonc":`biome`,".bithoundrc":`bithound`,".blitz.config.compiled.js":`blitz`,".bowerrc":`bower`,".browserslistrc":`browserlist`,".buckconfig":`buck`,".buildignore":`settings`,".bun-version":`bun`,".cfignore":`cloudfoundry`,".clang-format":`settings`,".clang-format-ignore":`settings`,".clang-tidy":`settings`,".clangd":`clangd`,".clinerules":`cline`,".codeclimate.yml":`code-climate`,".codecov.yaml":`codecov`,".codecov.yml":`codecov`,".coderabbit.yaml":`coderabbit-ai`,".coderabbit.yml":`coderabbit-ai`,".commitlint.yaml":`commitlint`,".commitlint.yml":`commitlint`,".commitlintrc":`commitlint`,".commitlintrc.cjs":`commitlint`,".commitlintrc.cts":`commitlint`,".commitlintrc.js":`commitlint`,".commitlintrc.json":`commitlint`,".commitlintrc.json5":`commitlint`,".commitlintrc.jsonc":`commitlint`,".commitlintrc.mjs":`commitlint`,".commitlintrc.mts":`commitlint`,".commitlintrc.toml":`commitlint`,".commitlintrc.ts":`commitlint`,".commitlintrc.yaml":`commitlint`,".commitlintrc.yml":`commitlint`,".conf":`settings`,".config/babel-plugin-macrosrc":`babel`,".config/babel-plugin-macrosrc.cjs":`babel`,".config/babel-plugin-macrosrc.cts":`babel`,".config/babel-plugin-macrosrc.js":`babel`,".config/babel-plugin-macrosrc.json":`babel`,".config/babel-plugin-macrosrc.json5":`babel`,".config/babel-plugin-macrosrc.jsonc":`babel`,".config/babel-plugin-macrosrc.mjs":`babel`,".config/babel-plugin-macrosrc.mts":`babel`,".config/babel-plugin-macrosrc.toml":`babel`,".config/babel-plugin-macrosrc.ts":`babel`,".config/babel-plugin-macrosrc.yaml":`babel`,".config/babel-plugin-macrosrc.yml":`babel`,".config/babelrc":`babel`,".config/babelrc.cjs":`babel`,".config/babelrc.cts":`babel`,".config/babelrc.js":`babel`,".config/babelrc.json":`babel`,".config/babelrc.json5":`babel`,".config/babelrc.jsonc":`babel`,".config/babelrc.mjs":`babel`,".config/babelrc.mts":`babel`,".config/babelrc.toml":`babel`,".config/babelrc.ts":`babel`,".config/babelrc.yaml":`babel`,".config/babelrc.yml":`babel`,".config/commitlintrc":`commitlint`,".config/commitlintrc.cjs":`commitlint`,".config/commitlintrc.cts":`commitlint`,".config/commitlintrc.js":`commitlint`,".config/commitlintrc.json":`commitlint`,".config/commitlintrc.json5":`commitlint`,".config/commitlintrc.jsonc":`commitlint`,".config/commitlintrc.mjs":`commitlint`,".config/commitlintrc.mts":`commitlint`,".config/commitlintrc.toml":`commitlint`,".config/commitlintrc.ts":`commitlint`,".config/commitlintrc.yaml":`commitlint`,".config/commitlintrc.yml":`commitlint`,".config/cracorc":`craco`,".config/cracorc.cjs":`craco`,".config/cracorc.cts":`craco`,".config/cracorc.js":`craco`,".config/cracorc.json":`craco`,".config/cracorc.json5":`craco`,".config/cracorc.jsonc":`craco`,".config/cracorc.mjs":`craco`,".config/cracorc.mts":`craco`,".config/cracorc.toml":`craco`,".config/cracorc.ts":`craco`,".config/cracorc.yaml":`craco`,".config/cracorc.yml":`craco`,".config/eslintrc":`eslint`,".config/eslintrc.cjs":`eslint`,".config/eslintrc.cts":`eslint`,".config/eslintrc.js":`eslint`,".config/eslintrc.json":`eslint`,".config/eslintrc.json5":`eslint`,".config/eslintrc.jsonc":`eslint`,".config/eslintrc.mjs":`eslint`,".config/eslintrc.mts":`eslint`,".config/eslintrc.toml":`eslint`,".config/eslintrc.ts":`eslint`,".config/eslintrc.yaml":`eslint`,".config/eslintrc.yml":`eslint`,".config/graphqlrc":`graphql`,".config/graphqlrc.cjs":`graphql`,".config/graphqlrc.cts":`graphql`,".config/graphqlrc.js":`graphql`,".config/graphqlrc.json":`graphql`,".config/graphqlrc.json5":`graphql`,".config/graphqlrc.jsonc":`graphql`,".config/graphqlrc.mjs":`graphql`,".config/graphqlrc.mts":`graphql`,".config/graphqlrc.toml":`graphql`,".config/graphqlrc.ts":`graphql`,".config/graphqlrc.yaml":`graphql`,".config/graphqlrc.yml":`graphql`,".config/huskyrc":`husky`,".config/huskyrc.cjs":`husky`,".config/huskyrc.cts":`husky`,".config/huskyrc.js":`husky`,".config/huskyrc.json":`husky`,".config/huskyrc.json5":`husky`,".config/huskyrc.jsonc":`husky`,".config/huskyrc.mjs":`husky`,".config/huskyrc.mts":`husky`,".config/huskyrc.toml":`husky`,".config/huskyrc.ts":`husky`,".config/huskyrc.yaml":`husky`,".config/huskyrc.yml":`husky`,".config/postcssrc":`postcss`,".config/postcssrc.cjs":`postcss`,".config/postcssrc.cts":`postcss`,".config/postcssrc.js":`postcss`,".config/postcssrc.json":`postcss`,".config/postcssrc.json5":`postcss`,".config/postcssrc.jsonc":`postcss`,".config/postcssrc.mjs":`postcss`,".config/postcssrc.mts":`postcss`,".config/postcssrc.toml":`postcss`,".config/postcssrc.ts":`postcss`,".config/postcssrc.yaml":`postcss`,".config/postcssrc.yml":`postcss`,".config/posthtmlrc":`posthtml`,".config/posthtmlrc.cjs":`posthtml`,".config/posthtmlrc.cts":`posthtml`,".config/posthtmlrc.js":`posthtml`,".config/posthtmlrc.json":`posthtml`,".config/posthtmlrc.json5":`posthtml`,".config/posthtmlrc.jsonc":`posthtml`,".config/posthtmlrc.mjs":`posthtml`,".config/posthtmlrc.mts":`posthtml`,".config/posthtmlrc.toml":`posthtml`,".config/posthtmlrc.ts":`posthtml`,".config/posthtmlrc.yaml":`posthtml`,".config/posthtmlrc.yml":`posthtml`,".config/prettierrc":`prettier`,".config/prettierrc.cjs":`prettier`,".config/prettierrc.cts":`prettier`,".config/prettierrc.js":`prettier`,".config/prettierrc.json":`prettier`,".config/prettierrc.json5":`prettier`,".config/prettierrc.jsonc":`prettier`,".config/prettierrc.mjs":`prettier`,".config/prettierrc.mts":`prettier`,".config/prettierrc.toml":`prettier`,".config/prettierrc.ts":`prettier`,".config/prettierrc.yaml":`prettier`,".config/prettierrc.yml":`prettier`,".config/puppeteerrc":`puppeteer`,".config/puppeteerrc.cjs":`puppeteer`,".config/puppeteerrc.cts":`puppeteer`,".config/puppeteerrc.js":`puppeteer`,".config/puppeteerrc.json":`puppeteer`,".config/puppeteerrc.json5":`puppeteer`,".config/puppeteerrc.jsonc":`puppeteer`,".config/puppeteerrc.mjs":`puppeteer`,".config/puppeteerrc.mts":`puppeteer`,".config/puppeteerrc.toml":`puppeteer`,".config/puppeteerrc.ts":`puppeteer`,".config/puppeteerrc.yaml":`puppeteer`,".config/puppeteerrc.yml":`puppeteer`,".config/releaserc":`semantic-release`,".config/releaserc.cjs":`semantic-release`,".config/releaserc.cts":`semantic-release`,".config/releaserc.js":`semantic-release`,".config/releaserc.json":`semantic-release`,".config/releaserc.json5":`semantic-release`,".config/releaserc.jsonc":`semantic-release`,".config/releaserc.mjs":`semantic-release`,".config/releaserc.mts":`semantic-release`,".config/releaserc.toml":`semantic-release`,".config/releaserc.ts":`semantic-release`,".config/releaserc.yaml":`semantic-release`,".config/releaserc.yml":`semantic-release`,".config/stylelintrc":`stylelint`,".config/stylelintrc.cjs":`stylelint`,".config/stylelintrc.cts":`stylelint`,".config/stylelintrc.js":`stylelint`,".config/stylelintrc.json":`stylelint`,".config/stylelintrc.json5":`stylelint`,".config/stylelintrc.jsonc":`stylelint`,".config/stylelintrc.mjs":`stylelint`,".config/stylelintrc.mts":`stylelint`,".config/stylelintrc.toml":`stylelint`,".config/stylelintrc.ts":`stylelint`,".config/stylelintrc.yaml":`stylelint`,".config/stylelintrc.yml":`stylelint`,".config/svgrrc":`svgr`,".config/svgrrc.cjs":`svgr`,".config/svgrrc.cts":`svgr`,".config/svgrrc.js":`svgr`,".config/svgrrc.json":`svgr`,".config/svgrrc.json5":`svgr`,".config/svgrrc.jsonc":`svgr`,".config/svgrrc.mjs":`svgr`,".config/svgrrc.mts":`svgr`,".config/svgrrc.toml":`svgr`,".config/svgrrc.ts":`svgr`,".config/svgrrc.yaml":`svgr`,".config/svgrrc.yml":`svgr`,".config/syncpackrc":`syncpack`,".config/syncpackrc.cjs":`syncpack`,".config/syncpackrc.cts":`syncpack`,".config/syncpackrc.js":`syncpack`,".config/syncpackrc.json":`syncpack`,".config/syncpackrc.json5":`syncpack`,".config/syncpackrc.jsonc":`syncpack`,".config/syncpackrc.mjs":`syncpack`,".config/syncpackrc.mts":`syncpack`,".config/syncpackrc.toml":`syncpack`,".config/syncpackrc.ts":`syncpack`,".config/syncpackrc.yaml":`syncpack`,".config/syncpackrc.yml":`syncpack`,".copilotignore":`copilot`,".coverage":`python-misc`,".coveragerc":`python-misc`,".cracorc":`craco`,".cracorc.cjs":`craco`,".cracorc.cts":`craco`,".cracorc.js":`craco`,".cracorc.json":`craco`,".cracorc.json5":`craco`,".cracorc.jsonc":`craco`,".cracorc.mjs":`craco`,".cracorc.mts":`craco`,".cracorc.toml":`craco`,".cracorc.ts":`craco`,".cracorc.yaml":`craco`,".cracorc.yml":`craco`,".cursor":`cursor`,".cursor.json":`cursor`,".cursorignore":`cursor`,".cursorindexingignore":`cursor`,".cursorrc":`cursor`,".cursorrules":`cursor`,".cz.json":`commitizen`,".cz.toml":`commitizen`,".cz.yaml":`commitizen`,".cz.yml":`commitizen`,".czrc":`commitizen`,".deepsource.toml":`deepsource`,".dev.vars":`tune`,".drone.yml":`drone`,".easignore":`expo`,".ecrc":`editorconfig`,".editorconfig":`editorconfig`,".editorconfig-checker.json":`editorconfig`,".ember-cli":`ember`,".ember-cli.js":`ember`,".env.alpha":`tune`,".env.defaults":`tune`,".env.dev":`tune`,".env.dev.local":`tune`,".env.development":`tune`,".env.development.local":`tune`,".env.dist":`tune`,".env.e2e":`tune`,".env.example":`tune`,".env.local":`tune`,".env.preview":`tune`,".env.prod":`tune`,".env.prod.example":`tune`,".env.prod.local":`tune`,".env.production":`tune`,".env.production.example":`tune`,".env.production.local":`tune`,".env.qa":`tune`,".env.qa.local":`tune`,".env.sample":`tune`,".env.schema":`tune`,".env.sentry-build-plugin":`sentry`,".env.stage":`tune`,".env.staging":`tune`,".env.staging.local":`tune`,".env.stg":`tune`,".env.stg.local":`tune`,".env.template":`tune`,".env.test":`tune`,".env.test.local":`tune`,".env.testing":`tune`,".env.uat":`tune`,".envrc":`console`,".esformatter":`json`,".eslintcache":`eslint`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc-jsdoc.js":`eslint`,".eslintrc-md.js":`eslint`,".eslintrc.base.json":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.cts":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.json5":`eslint`,".eslintrc.jsonc":`eslint`,".eslintrc.mjs":`eslint`,".eslintrc.mts":`eslint`,".eslintrc.toml":`eslint`,".eslintrc.ts":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".esmrc":`nodejs`,".firebaserc":`firebase`,".flowconfig":`flow`,".gardenignore":`garden`,".gcloudignore":`gcp`,".gdignore":`godot-assets`,".git":`git`,".git-blame-ignore":`git`,".git-blame-ignore-revs":`git`,".git-for-windows-updater":`git`,".gitattributes":`git`,".gitattributes-global":`git`,".gitattributes_global":`git`,".gitconfig":`git`,".github/funding.yml":`github-sponsors`,".github/labeler.yaml":`label`,".github/labeler.yml":`label`,".gitignore":`git`,".gitignore-global":`git`,".gitignore_global":`git`,".gitinclude":`git`,".gitkeep":`git`,".gitmessage":`git`,".gitmodules":`git`,".gitpod.yml":`gitpod`,".gitpreserve":`git`,".graphqlconfig":`graphql`,".graphqlrc":`graphql`,".graphqlrc.cjs":`graphql`,".graphqlrc.cts":`graphql`,".graphqlrc.js":`graphql`,".graphqlrc.json":`graphql`,".graphqlrc.json5":`graphql`,".graphqlrc.jsonc":`graphql`,".graphqlrc.mjs":`graphql`,".graphqlrc.mts":`graphql`,".graphqlrc.toml":`graphql`,".graphqlrc.ts":`graphql`,".graphqlrc.yaml":`graphql`,".graphqlrc.yml":`graphql`,".hadolint.yaml":`hadolint`,".hadolint.yml":`hadolint`,".happo.cjs":`happo`,".happo.js":`happo`,".happo.mjs":`happo`,".helmignore":`helm`,".hg":`mercurial`,".hgflow":`mercurial`,".hgignore":`mercurial`,".hgrc":`mercurial`,".hgtags":`mercurial`,".hhconfig":`hack`,".hintrc":`webhint`,".histoire.cjs":`histoire`,".histoire.cts":`histoire`,".histoire.js":`histoire`,".histoire.mjs":`histoire`,".histoire.mts":`histoire`,".histoire.ts":`histoire`,".htaccess":`xml`,".htpasswd":`key`,".hushlogin":`console`,".huskyrc":`husky`,".huskyrc.cjs":`husky`,".huskyrc.cts":`husky`,".huskyrc.js":`husky`,".huskyrc.json":`husky`,".huskyrc.json5":`husky`,".huskyrc.jsonc":`husky`,".huskyrc.mjs":`husky`,".huskyrc.mts":`husky`,".huskyrc.toml":`husky`,".huskyrc.ts":`husky`,".huskyrc.yaml":`husky`,".huskyrc.yml":`husky`,".io-config.json":`ionic`,".istanbul.yml":`istanbul`,".jestrc":`jest`,".jestrc.js":`jest`,".jestrc.json":`jest`,".jsbeautifyrc":`json`,".jscsrc":`json`,".jshintignore":`settings`,".jshintrc":`json`,".justfile":`just`,".k8s.yaml":`kubernetes`,".k8s.yml":`kubernetes`,".keep":`git`,".kl":`kl`,".knip.json":`knip`,".knip.jsonc":`knip`,".latexmkrc":`latexmk`,".lefthook-local.json":`lefthook`,".lefthook-local.toml":`lefthook`,".lefthook-local.yaml":`lefthook`,".lefthook-local.yml":`lefthook`,".lefthook.json":`lefthook`,".lefthook.toml":`lefthook`,".lefthook.yaml":`lefthook`,".lefthook.yml":`lefthook`,".lefthookrc":`lefthook`,".liaraignore":`liara`,".lighthouserc.cjs":`lighthouse`,".lighthouserc.js":`lighthouse`,".lighthouserc.json":`lighthouse`,".lighthouserc.yaml":`lighthouse`,".lighthouserc.yml":`lighthouse`,".lintstagedrc":`lintstaged`,".lintstagedrc.cjs":`lintstaged`,".lintstagedrc.js":`lintstaged`,".lintstagedrc.json":`lintstaged`,".lintstagedrc.mjs":`lintstaged`,".lintstagedrc.yaml":`lintstaged`,".lintstagedrc.yml":`lintstaged`,".luacheckrc":`lua`,".luaurc":`luau`,".mailmap":`email`,".markdownlint-cli2.cjs":`markdownlint`,".markdownlint-cli2.jsonc":`markdownlint`,".markdownlint-cli2.mjs":`markdownlint`,".markdownlint-cli2.yaml":`markdownlint`,".markdownlint.json":`markdownlint`,".markdownlint.jsonc":`markdownlint`,".markdownlint.yaml":`markdownlint`,".markdownlint.yml":`markdownlint`,".markdownlintignore":`markdownlint`,".mcattributes":`minecraft`,".mcdefinitions":`minecraft`,".mcignore":`minecraft`,".mincloudrc":`ifanr-cloud`,".mjmlconfig":`mjml`,".mocharc.cjs":`mocha`,".mocharc.js":`mocha`,".mocharc.json":`mocha`,".mocharc.jsonc":`mocha`,".mocharc.yaml":`mocha`,".mocharc.yml":`mocha`,".modernizrrc":`modernizr`,".modernizrrc.js":`modernizr`,".modernizrrc.json":`modernizr`,".mrconfig":`settings`,".nano-staged.cjs":`nano-staged`,".nano-staged.js":`nano-staged`,".nano-staged.json":`nano-staged`,".nano-staged.mjs":`nano-staged`,".nanostagedrc":`nano-staged`,".nest-cli.json":`nest`,".nestconfig.json":`nest`,".node-version":`nodejs`,".nowignore":`vercel`,".npmignore":`npm`,".npmrc":`npm`,".nuspec":`nuget`,".nuxtignore":`nuxt`,".nuxtrc":`nuxt`,".nvmrc":`nodejs`,".nxignore":`nx`,".nycrc":`istanbul`,".nycrc.json":`istanbul`,".nycrc.yaml":`istanbul`,".nycrc.yml":`istanbul`,".oxfmtrc.json":`oxc`,".oxfmtrc.jsonc":`oxc`,".oxlintrc.json":`oxc`,".oxlintrc.jsonc":`oxc`,".packshiprc":`packship`,".packshiprc.js":`packship`,".packshiprc.json":`packship`,".packshiprc.ts":`packship`,".parcelrc":`parcel`,".pdm-python":`pdm`,".percy.yml":`percy`,".php-cs-fixer.dist.php":`php-cs-fixer`,".php-cs-fixer.php":`php-cs-fixer`,".php_cs":`php-cs-fixer`,".php_cs.dist":`php-cs-fixer`,".php_cs.dist.php":`php-cs-fixer`,".php_cs.php":`php-cs-fixer`,".phpunit-watcher.yml":`phpunit`,".phpunit.result.cache":`phpunit`,".pnpmfile.cjs":`pnpm`,".postcssrc":`postcss`,".postcssrc.cjs":`postcss`,".postcssrc.cts":`postcss`,".postcssrc.js":`postcss`,".postcssrc.json":`postcss`,".postcssrc.json5":`postcss`,".postcssrc.jsonc":`postcss`,".postcssrc.mjs":`postcss`,".postcssrc.mts":`postcss`,".postcssrc.toml":`postcss`,".postcssrc.ts":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".posthtmlrc":`posthtml`,".posthtmlrc.cjs":`posthtml`,".posthtmlrc.cts":`posthtml`,".posthtmlrc.js":`posthtml`,".posthtmlrc.json":`posthtml`,".posthtmlrc.json5":`posthtml`,".posthtmlrc.jsonc":`posthtml`,".posthtmlrc.mjs":`posthtml`,".posthtmlrc.mts":`posthtml`,".posthtmlrc.toml":`posthtml`,".posthtmlrc.ts":`posthtml`,".posthtmlrc.yaml":`posthtml`,".posthtmlrc.yml":`posthtml`,".pre-commit-config.yaml":`pre-commit`,".pre-commit-hooks.yaml":`pre-commit`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.cts":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.json5":`prettier`,".prettierrc.jsonc":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.mts":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.ts":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".pubignore":`dart`,".pug-lintrc":`pug`,".pug-lintrc.js":`pug`,".pug-lintrc.json":`pug`,".puppeteerrc":`puppeteer`,".puppeteerrc.cjs":`puppeteer`,".puppeteerrc.cts":`puppeteer`,".puppeteerrc.js":`puppeteer`,".puppeteerrc.json":`puppeteer`,".puppeteerrc.json5":`puppeteer`,".puppeteerrc.jsonc":`puppeteer`,".puppeteerrc.mjs":`puppeteer`,".puppeteerrc.mts":`puppeteer`,".puppeteerrc.toml":`puppeteer`,".puppeteerrc.ts":`puppeteer`,".puppeteerrc.yaml":`puppeteer`,".puppeteerrc.yml":`puppeteer`,".pylintrc":`python-misc`,".python-version":`python-misc`,".qa-mincloudrc":`ifanr-cloud`,".release-it.cjs":`rocket`,".release-it.js":`rocket`,".release-it.json":`rocket`,".release-it.toml":`rocket`,".release-it.ts":`rocket`,".release-it.yaml":`rocket`,".release-it.yml":`rocket`,".release-plz.toml":`rocket`,".releaserc":`semantic-release`,".releaserc.cjs":`semantic-release`,".releaserc.cts":`semantic-release`,".releaserc.js":`semantic-release`,".releaserc.json":`semantic-release`,".releaserc.json5":`semantic-release`,".releaserc.jsonc":`semantic-release`,".releaserc.mjs":`semantic-release`,".releaserc.mts":`semantic-release`,".releaserc.toml":`semantic-release`,".releaserc.ts":`semantic-release`,".releaserc.yaml":`semantic-release`,".releaserc.yml":`semantic-release`,".remarkignore":`remark`,".remarkrc":`remark`,".remarkrc.cjs":`remark`,".remarkrc.js":`remark`,".remarkrc.json":`remark`,".remarkrc.mjs":`remark`,".remarkrc.yaml":`remark`,".remarkrc.yml":`remark`,".renovaterc":`renovate`,".renovaterc.json":`renovate`,".replit":`replit`,".rhistory":`r`,".rspec":`rspec`,".rubocop-todo.yml":`rubocop`,".rubocop.yml":`rubocop`,".rubocop_todo.yml":`rubocop`,".ruby-version":`ruby`,".ruff.toml":`ruff`,".scrapy":`python-misc`,".secrets":`key`,".semgrepignore":`semgrep`,".sentryclirc":`sentry`,".sequelizerc":`sequelize`,".shellcheckrc":`shellcheck`,".slugignore":`slug`,".snyk":`snyk`,".sonarcloud.properties":`sonarcloud`,".stackblitzrc":`stackblitz`,".steadybit.yaml":`steadybit`,".steadybit.yml":`steadybit`,".stryker.conf.cjs":`stryker`,".stryker.conf.js":`stryker`,".stryker.conf.json":`stryker`,".stryker.conf.mjs":`stryker`,".stryker.config.cjs":`stryker`,".stryker.config.js":`stryker`,".stryker.config.json":`stryker`,".stryker.config.mjs":`stryker`,".stylelintcache":`stylelint`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.cts":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.json5":`stylelint`,".stylelintrc.jsonc":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.mts":`stylelint`,".stylelintrc.toml":`stylelint`,".stylelintrc.ts":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".svgrrc":`svgr`,".svgrrc.cjs":`svgr`,".svgrrc.cts":`svgr`,".svgrrc.js":`svgr`,".svgrrc.json":`svgr`,".svgrrc.json5":`svgr`,".svgrrc.jsonc":`svgr`,".svgrrc.mjs":`svgr`,".svgrrc.mts":`svgr`,".svgrrc.toml":`svgr`,".svgrrc.ts":`svgr`,".svgrrc.yaml":`svgr`,".svgrrc.yml":`svgr`,".swift-format":`swift`,".swift-version":`swift`,".swiftformat":`swift`,".syncpackrc":`syncpack`,".syncpackrc.cjs":`syncpack`,".syncpackrc.cts":`syncpack`,".syncpackrc.js":`syncpack`,".syncpackrc.json":`syncpack`,".syncpackrc.json5":`syncpack`,".syncpackrc.jsonc":`syncpack`,".syncpackrc.mjs":`syncpack`,".syncpackrc.mts":`syncpack`,".syncpackrc.toml":`syncpack`,".syncpackrc.ts":`syncpack`,".syncpackrc.yaml":`syncpack`,".syncpackrc.yml":`syncpack`,".taskrc.yaml":`taskfile`,".taskrc.yml":`taskfile`,".taurignore":`tauri`,".tazerc":`taze`,".tazerc.json":`taze`,".textlintignore":`textlint`,".textlintrc":`textlint`,".textlintrc.cjs":`textlint`,".textlintrc.js":`textlint`,".textlintrc.json":`textlint`,".textlintrc.yaml":`textlint`,".textlintrc.yml":`textlint`,".tobimake":`tobimake`,".travis.yml":`travis`,".umirc.cjs":`umi`,".umirc.cts":`umi`,".umirc.js":`umi`,".umirc.mjs":`umi`,".umirc.mts":`umi`,".umirc.ts":`umi`,".uv.toml":`uv`,".vars":`tune`,".vercelignore":`vercel`,".vfl":`vfl`,".vsconfig":`visualstudio`,".vuerc":`vue-config`,".wakatime-project":`wakatime`,".watchmanconfig":`watchman`,".whitesource":`json`,".yardopts":`settings`,".yarn-integrity":`yarn`,".yarnclean":`yarn`,".yarnrc":`yarn`,".yarnrc.yaml":`yarn`,".yarnrc.yml":`yarn`,_sc_:`godot-assets`,ace:`adonis`,"amplify.yml":`amplify`,"androidmanifest.xml":`android`,"angular-cli.json":`angular`,"angular.json":`angular`,apkbuild:`console`,"apollo.config.js":`apollo`,appfile:`fastlane`,appraisals:`ruby`,"appveyor.yml":`appveyor`,"appwrite.js":`appwrite`,"appwrite.json":`appwrite`,"appwrite.ts":`appwrite`,architecture:`architecture`,"architecture.md":`architecture`,"architecture.rst":`architecture`,"architecture.txt":`architecture`,artisan:`laravel`,"astro.config.cjs":`astro-config`,"astro.config.cts":`astro-config`,"astro.config.js":`astro-config`,"astro.config.mjs":`astro-config`,"astro.config.mts":`astro-config`,"astro.config.ts":`astro-config`,"aurelia.json":`aurelia`,authors:`authors`,"authors.md":`authors`,"authors.rst":`authors`,"authors.txt":`authors`,"auto-config.js":`auto`,"auto-config.json":`auto`,"auto-config.ts":`auto`,"auto-config.yaml":`auto`,"auto-config.yml":`auto`,"auto.config.js":`auto`,"auto.config.ts":`auto`,"azure-pipelines-main.yaml":`azure-pipelines`,"azure-pipelines-main.yml":`azure-pipelines`,"azure-pipelines.yaml":`azure-pipelines`,"azure-pipelines.yml":`azure-pipelines`,"babel-plugin-macros.config.cjs":`babel`,"babel-plugin-macros.config.cts":`babel`,"babel-plugin-macros.config.js":`babel`,"babel-plugin-macros.config.json":`babel`,"babel-plugin-macros.config.json5":`babel`,"babel-plugin-macros.config.jsonc":`babel`,"babel-plugin-macros.config.mjs":`babel`,"babel-plugin-macros.config.mts":`babel`,"babel-plugin-macros.config.toml":`babel`,"babel-plugin-macros.config.ts":`babel`,"babel-plugin-macros.config.yaml":`babel`,"babel-plugin-macros.config.yml":`babel`,"babel-transform.js":`babel`,"babel.config.cjs":`babel`,"babel.config.cts":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.json5":`babel`,"babel.config.jsonc":`babel`,"babel.config.mjs":`babel`,"babel.config.mts":`babel`,"babel.config.toml":`babel`,"babel.config.ts":`babel`,"babel.config.yaml":`babel`,"babel.config.yml":`babel`,bashrc_apple_terminal:`console`,berksfile:`ruby`,"berksfile.lock":`ruby`,"biome.json":`biome`,"biome.jsonc":`biome`,"bitbucket-pipelines.yaml":`bitbucket`,"bitbucket-pipelines.yml":`bitbucket`,"blitz.config.js":`blitz`,"blitz.config.ts":`blitz`,"bower.json":`bower`,brewfile:`ruby`,browserslist:`browserlist`,"buildkite.yaml":`buildkite`,"buildkite.yml":`buildkite`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"cabal.project":`cabal`,"cabal.project.freeze":`cabal`,"cabal.project.local":`cabal`,caddyfile:`caddy`,"capacitor.config.json":`capacitor`,"capacitor.config.ts":`capacitor`,capfile:`ruby`,"cdp.pid":`json`,"celerybeat-schedule":`python-misc`,"celerybeat.pid":`python-misc`,changelog:`changelog`,"changelog.md":`changelog`,"changelog.rst":`changelog`,"changelog.txt":`changelog`,changes:`changelog`,"changes.md":`changelog`,"changes.rst":`changelog`,"changes.txt":`changelog`,cheffile:`ruby`,"chromatic.config.json":`chromatic`,"circle.yml":`circleci`,"citation.cff":`citation`,"claude.local.md":`claude`,"claude.md":`claude`,"cmakecache.txt":`cmake`,"cmakelists.txt":`cmake`,"cmakepresets.json":`cmake`,cname:`http`,code_of_conduct:`conduct`,"code_of_conduct.md":`conduct`,"code_of_conduct.txt":`conduct`,"codecov.yaml":`codecov`,"codecov.yml":`codecov`,codeowners:`codeowners`,"commit-msg":`console`,commit_editmsg:`git`,"commitlint.config.cjs":`commitlint`,"commitlint.config.cts":`commitlint`,"commitlint.config.js":`commitlint`,"commitlint.config.json":`commitlint`,"commitlint.config.json5":`commitlint`,"commitlint.config.jsonc":`commitlint`,"commitlint.config.mjs":`commitlint`,"commitlint.config.mts":`commitlint`,"commitlint.config.toml":`commitlint`,"commitlint.config.ts":`commitlint`,"commitlint.config.yaml":`commitlint`,"commitlint.config.yml":`commitlint`,"compile_flags.txt":`settings`,"compose.alpha.yaml":`docker`,"compose.alpha.yml":`docker`,"compose.beta.yaml":`docker`,"compose.beta.yml":`docker`,"compose.ci.yaml":`docker`,"compose.ci.yml":`docker`,"compose.dev.yaml":`docker`,"compose.dev.yml":`docker`,"compose.development.yaml":`docker`,"compose.development.yml":`docker`,"compose.local.yaml":`docker`,"compose.local.yml":`docker`,"compose.override.yaml":`docker`,"compose.override.yml":`docker`,"compose.prod.yaml":`docker`,"compose.prod.yml":`docker`,"compose.production.yaml":`docker`,"compose.production.yml":`docker`,"compose.stage.yaml":`docker`,"compose.stage.yml":`docker`,"compose.staging.yaml":`docker`,"compose.staging.yml":`docker`,"compose.test.yaml":`docker`,"compose.test.yml":`docker`,"compose.testing.yaml":`docker`,"compose.testing.yml":`docker`,"compose.web.yaml":`docker`,"compose.web.yml":`docker`,"compose.worker.yaml":`docker`,"compose.worker.yml":`docker`,"compose.yaml":`docker`,"compose.yml":`docker`,"composer.lock":`json`,"concourse.yml":`concourse`,containerfile:`docker`,"containerfile.alpha":`docker`,"containerfile.beta":`docker`,"containerfile.ci":`docker`,"containerfile.dev":`docker`,"containerfile.development":`docker`,"containerfile.local":`docker`,"containerfile.prod":`docker`,"containerfile.production":`docker`,"containerfile.stage":`docker`,"containerfile.staging":`docker`,"containerfile.test":`docker`,"containerfile.testing":`docker`,"containerfile.web":`docker`,"containerfile.worker":`docker`,"contentlayer.config.cjs":`contentlayer`,"contentlayer.config.cts":`contentlayer`,"contentlayer.config.js":`contentlayer`,"contentlayer.config.mjs":`contentlayer`,"contentlayer.config.mts":`contentlayer`,"contentlayer.config.ts":`contentlayer`,contributing:`contributing`,"contributing.md":`contributing`,"contributing.rst":`contributing`,"contributing.txt":`contributing`,contributors:`authors`,"contributors.md":`authors`,"contributors.rst":`authors`,"contributors.txt":`authors`,"copilot-instructions.md":`copilot`,copying:`license`,"copying.md":`license`,"copying.rst":`license`,"copying.txt":`license`,copyright:`license`,"copyright.md":`license`,"copyright.rst":`license`,"copyright.txt":`license`,"craco.config.cjs":`craco`,"craco.config.cts":`craco`,"craco.config.js":`craco`,"craco.config.json":`craco`,"craco.config.json5":`craco`,"craco.config.jsonc":`craco`,"craco.config.mjs":`craco`,"craco.config.mts":`craco`,"craco.config.toml":`craco`,"craco.config.ts":`craco`,"craco.config.yaml":`craco`,"craco.config.yml":`craco`,credits:`credits`,"credits.md":`credits`,"credits.rst":`credits`,"credits.txt":`credits`,"cypress.config.cjs":`cypress`,"cypress.config.cts":`cypress`,"cypress.config.js":`cypress`,"cypress.config.mjs":`cypress`,"cypress.config.mts":`cypress`,"cypress.config.ts":`cypress`,"cypress.env.json":`cypress`,"cypress.json":`cypress`,"cz.json":`commitizen`,"cz.toml":`commitizen`,"cz.yaml":`commitizen`,"cz.yml":`commitizen`,dangerfile:`ruby`,deliverfile:`ruby`,"deno.json":`deno`,"deno.jsonc":`deno`,"deno.lock":`deno`,"dependabot.yaml":`dependabot`,"dependabot.yml":`dependabot`,"docker-compose.alpha.yaml":`docker`,"docker-compose.alpha.yml":`docker`,"docker-compose.beta.yaml":`docker`,"docker-compose.beta.yml":`docker`,"docker-compose.ci.yaml":`docker`,"docker-compose.ci.yml":`docker`,"docker-compose.dev.yaml":`docker`,"docker-compose.dev.yml":`docker`,"docker-compose.development.yaml":`docker`,"docker-compose.development.yml":`docker`,"docker-compose.local.yaml":`docker`,"docker-compose.local.yml":`docker`,"docker-compose.override.yaml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.prod.yaml":`docker`,"docker-compose.prod.yml":`docker`,"docker-compose.production.yaml":`docker`,"docker-compose.production.yml":`docker`,"docker-compose.stage.yaml":`docker`,"docker-compose.stage.yml":`docker`,"docker-compose.staging.yaml":`docker`,"docker-compose.staging.yml":`docker`,"docker-compose.test.yaml":`docker`,"docker-compose.test.yml":`docker`,"docker-compose.testing.yaml":`docker`,"docker-compose.testing.yml":`docker`,"docker-compose.web.yaml":`docker`,"docker-compose.web.yml":`docker`,"docker-compose.worker.yaml":`docker`,"docker-compose.worker.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"dockerfile.alpha":`docker`,"dockerfile.beta":`docker`,"dockerfile.ci":`docker`,"dockerfile.dev":`docker`,"dockerfile.development":`docker`,"dockerfile.local":`docker`,"dockerfile.prod":`docker`,"dockerfile.production":`docker`,"dockerfile.stage":`docker`,"dockerfile.staging":`docker`,"dockerfile.test":`docker`,"dockerfile.testing":`docker`,"dockerfile.web":`docker`,"dockerfile.windows":`docker`,"dockerfile.worker":`docker`,"drizzle.config.dev.js":`drizzle`,"drizzle.config.dev.json":`drizzle`,"drizzle.config.dev.ts":`drizzle`,"drizzle.config.js":`drizzle`,"drizzle.config.json":`drizzle`,"drizzle.config.prod.js":`drizzle`,"drizzle.config.prod.json":`drizzle`,"drizzle.config.prod.ts":`drizzle`,"drizzle.config.ts":`drizzle`,"duc.fbs":`duc`,dune:`dune`,"dune-project":`dune`,"dune-workspace":`dune`,"dune-workspace.dev":`dune`,"eas.json":`expo`,"ecosystem.config.cjs":`pm2-ecosystem`,"ecosystem.config.cts":`pm2-ecosystem`,"ecosystem.config.js":`pm2-ecosystem`,"ecosystem.config.mjs":`pm2-ecosystem`,"ecosystem.config.mts":`pm2-ecosystem`,"ecosystem.config.ts":`pm2-ecosystem`,"ember-cli-builds.js":`ember`,"esbuild.cjs":`esbuild`,"esbuild.config.cjs":`esbuild`,"esbuild.config.cts":`esbuild`,"esbuild.config.js":`esbuild`,"esbuild.config.mjs":`esbuild`,"esbuild.config.mts":`esbuild`,"esbuild.config.ts":`esbuild`,"esbuild.cts":`esbuild`,"esbuild.dev.cjs":`esbuild`,"esbuild.dev.cts":`esbuild`,"esbuild.dev.js":`esbuild`,"esbuild.dev.mjs":`esbuild`,"esbuild.dev.mts":`esbuild`,"esbuild.dev.ts":`esbuild`,"esbuild.js":`esbuild`,"esbuild.mjs":`esbuild`,"esbuild.mts":`esbuild`,"esbuild.prod.cjs":`esbuild`,"esbuild.prod.cts":`esbuild`,"esbuild.prod.js":`esbuild`,"esbuild.prod.mjs":`esbuild`,"esbuild.prod.mts":`esbuild`,"esbuild.prod.ts":`esbuild`,"esbuild.stage.cjs":`esbuild`,"esbuild.stage.cts":`esbuild`,"esbuild.stage.js":`esbuild`,"esbuild.stage.mjs":`esbuild`,"esbuild.stage.mts":`esbuild`,"esbuild.stage.ts":`esbuild`,"esbuild.test.cjs":`esbuild`,"esbuild.test.cts":`esbuild`,"esbuild.test.js":`esbuild`,"esbuild.test.mjs":`esbuild`,"esbuild.test.mts":`esbuild`,"esbuild.test.ts":`esbuild`,"esbuild.ts":`esbuild`,"eslint-options.js":`eslint`,"eslint.config.cjs":`eslint`,"eslint.config.cts":`eslint`,"eslint.config.js":`eslint`,"eslint.config.json":`eslint`,"eslint.config.json5":`eslint`,"eslint.config.jsonc":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.toml":`eslint`,"eslint.config.ts":`eslint`,"eslint.config.yaml":`eslint`,"eslint.config.yml":`eslint`,excalidraw:`excalidraw`,"excalidraw.json":`excalidraw`,"excalidraw.png":`excalidraw`,"excalidraw.svg":`excalidraw`,"fabric.mod.json":`minecraft-fabric`,fastfile:`fastlane`,"favicon.ico":`favicon`,"firebase.config.js":`firebase`,"firebase.json":`firebase`,"firestore.indexes.json":`firebase`,"firestore.rules":`firebase`,"fuse.js":`fusebox`,"garden.yaml":`garden`,"garden.yml":`garden`,"gatsby-browser.js":`gatsby`,"gatsby-browser.tsx":`gatsby`,"gatsby-config.js":`gatsby`,"gatsby-config.mjs":`gatsby`,"gatsby-config.ts":`gatsby`,"gatsby-node.js":`gatsby`,"gatsby-node.mjs":`gatsby`,"gatsby-node.ts":`gatsby`,"gatsby-ssr.js":`gatsby`,"gatsby-ssr.tsx":`gatsby`,gemfile:`gemfile`,"gemini.md":`gemini-ai`,"git-history":`git`,"git-rebase-todo":`git`,"gleam.toml":`gleam`,gnumakefile:`makefile`,"go.mod":`go-mod`,"go.sum":`go-mod`,"go.work":`go-mod`,"go.work.sum":`go-mod`,"google-services.json":`google`,"googleservice-info.plist":`google`,"gradle-wrapper.properties":`gradle`,"gradle.properties":`gradle`,gradlew:`gradle`,"gradlew.bat":`gradle`,"graphql.config.cjs":`graphql`,"graphql.config.cts":`graphql`,"graphql.config.js":`graphql`,"graphql.config.json":`graphql`,"graphql.config.json5":`graphql`,"graphql.config.jsonc":`graphql`,"graphql.config.mjs":`graphql`,"graphql.config.mts":`graphql`,"graphql.config.toml":`graphql`,"graphql.config.ts":`graphql`,"graphql.config.yaml":`graphql`,"graphql.config.yml":`graphql`,"gridsome.config.js":`gridsome`,"gridsome.server.js":`gridsome`,"gruntfile.babel.coffee":`grunt`,"gruntfile.babel.js":`grunt`,"gruntfile.babel.ts":`grunt`,"gruntfile.cjs":`grunt`,"gruntfile.coffee":`grunt`,"gruntfile.cts":`grunt`,"gruntfile.js":`grunt`,"gruntfile.ts":`grunt`,guardfile:`ruby`,"gulpfile.babel.js":`gulp`,"gulpfile.cjs":`gulp`,"gulpfile.cts":`gulp`,"gulpfile.js":`gulp`,"gulpfile.mjs":`gulp`,"gulpfile.mts":`gulp`,"gulpfile.ts":`gulp`,gymfile:`ruby`,"hadolint.yaml":`hadolint`,"hadolint.yml":`hadolint`,"hardhat.config.js":`hardhat`,"hardhat.config.ts":`hardhat`,"harmonix.config.js":`harmonix`,"harmonix.config.ts":`harmonix`,hgrc:`mercurial`,"histoire.config.cjs":`histoire`,"histoire.config.cts":`histoire`,"histoire.config.js":`histoire`,"histoire.config.mjs":`histoire`,"histoire.config.mts":`histoire`,"histoire.config.ts":`histoire`,hobofile:`ruby`,"horusec-config.json":`horusec`,hosts:`hosts`,"husky.config.cjs":`husky`,"husky.config.cts":`husky`,"husky.config.js":`husky`,"husky.config.json":`husky`,"husky.config.json5":`husky`,"husky.config.jsonc":`husky`,"husky.config.mjs":`husky`,"husky.config.mts":`husky`,"husky.config.toml":`husky`,"husky.config.ts":`husky`,"husky.config.yaml":`husky`,"husky.config.yml":`husky`,install:`installation`,installation:`installation`,"ionic.config.json":`ionic`,jakefile:`javascript`,jenkinsfile:`jenkins`,"jest-e2e.config.cjs":`jest`,"jest-e2e.config.cts":`jest`,"jest-e2e.config.js":`jest`,"jest-e2e.config.json":`jest`,"jest-e2e.config.mjs":`jest`,"jest-e2e.config.mts":`jest`,"jest-e2e.config.ts":`jest`,"jest-e2e.json":`jest`,"jest-github-actions-reporter.js":`jest`,"jest-preset.cjs":`jest`,"jest-preset.js":`jest`,"jest-preset.json":`jest`,"jest-preset.mjs":`jest`,"jest-unit.config.js":`jest`,"jest.config.cjs":`jest`,"jest.config.cts":`jest`,"jest.config.js":`jest`,"jest.config.json":`jest`,"jest.config.mjs":`jest`,"jest.config.mts":`jest`,"jest.config.ts":`jest`,"jest.e2e.config.cjs":`jest`,"jest.e2e.config.cts":`jest`,"jest.e2e.config.js":`jest`,"jest.e2e.config.json":`jest`,"jest.e2e.config.mjs":`jest`,"jest.e2e.config.mts":`jest`,"jest.e2e.config.ts":`jest`,"jest.e2e.json":`jest`,"jest.json":`jest`,"jest.preset.cjs":`jest`,"jest.preset.js":`jest`,"jest.preset.json":`jest`,"jest.preset.mjs":`jest`,"jest.setup.js":`jest`,"jest.setup.ts":`jest`,"jest.teardown.js":`jest`,"jsconfig.json":`jsconfig`,"jsr.json":`jsr`,"jsr.jsonc":`jsr`,justfile:`just`,"jvm.config":`maven`,"k8s.yaml":`kubernetes`,"k8s.yml":`kubernetes`,"karma-main.js":`karma`,"karma-main.ts":`karma`,"karma.conf.coffee":`karma`,"karma.conf.js":`karma`,"karma.conf.ts":`karma`,"karma.config.js":`karma`,"karma.config.ts":`karma`,kbuild:`makefile`,"kcl.mod":`kcl`,"kcl.yaml":`kcl`,"kcl.yml":`kcl`,"keystatic.config.js":`keystatic`,"keystatic.config.jsx":`keystatic`,"keystatic.config.ts":`keystatic`,"keystatic.config.tsx":`keystatic`,"knip.config.js":`knip`,"knip.config.ts":`knip`,"knip.js":`knip`,"knip.json":`knip`,"knip.jsonc":`knip`,"knip.ts":`knip`,"kubernetes.yaml":`kubernetes`,"kubernetes.yml":`kubernetes`,latexmkrc:`latexmk`,"lefthook-local.json":`lefthook`,"lefthook-local.toml":`lefthook`,"lefthook-local.yaml":`lefthook`,"lefthook-local.yml":`lefthook`,"lefthook.json":`lefthook`,"lefthook.toml":`lefthook`,"lefthook.yaml":`lefthook`,"lefthook.yml":`lefthook`,lefthookrc:`lefthook`,"lerna.json":`lerna`,"liara.json":`liara`,licence:`license`,"licence-agpl":`license`,"licence-apache":`license`,"licence-bsd":`license`,"licence-gpl":`license`,"licence-lgpl":`license`,"licence-mit":`license`,"licence.md":`license`,"licence.rst":`license`,"licence.txt":`license`,license:`license`,"license-agpl":`license`,"license-apache":`license`,"license-bsd":`license`,"license-gpl":`license`,"license-lgpl":`license`,"license-mit":`license`,"license.md":`license`,"license.rst":`license`,"license.txt":`license`,"lighthouserc.cjs":`lighthouse`,"lighthouserc.js":`lighthouse`,"lighthouserc.json":`lighthouse`,"lighthouserc.yaml":`lighthouse`,"lighthouserc.yml":`lighthouse`,"lint-staged.config.cjs":`lintstaged`,"lint-staged.config.js":`lintstaged`,"lint-staged.config.mjs":`lintstaged`,"lynx.config.cjs":`lynx`,"lynx.config.cts":`lynx`,"lynx.config.js":`lynx`,"lynx.config.mjs":`lynx`,"lynx.config.mts":`lynx`,"lynx.config.ts":`lynx`,makefile:`makefile`,"manifest.in":`python-misc`,"manifest.mf":`settings`,"markdoc.config.cjs":`markdoc-config`,"markdoc.config.cts":`markdoc-config`,"markdoc.config.js":`markdoc-config`,"markdoc.config.mjs":`markdoc-config`,"markdoc.config.mts":`markdoc-config`,"markdoc.config.ts":`markdoc-config`,matchfile:`ruby`,"maven.config":`maven`,"mercurial.ini":`mercurial`,merge_msg:`git`,"meson.build":`meson`,"meson.options":`meson`,"meson_options.txt":`meson`,"metro.config.cjs":`metro`,"metro.config.cts":`metro`,"metro.config.js":`metro`,"metro.config.json":`metro`,"metro.config.mjs":`metro`,"metro.config.mts":`metro`,"metro.config.ts":`metro`,"milestones.md":`roadmap`,"milestones.txt":`roadmap`,"mocha.opts":`mocha`,"moon.yml":`moon`,"nano-staged.cjs":`nano-staged`,"nano-staged.js":`nano-staged`,"nano-staged.json":`nano-staged`,"nano-staged.mjs":`nano-staged`,"nest-cli.json":`nest`,"nestconfig.json":`nest`,"netlify.json":`netlify`,"netlify.toml":`netlify`,"netlify.yaml":`netlify`,"netlify.yml":`netlify`,"next.config.js":`next`,"next.config.mjs":`next`,"next.config.mts":`next`,"next.config.ts":`next`,"ng-package.json":`angular`,"nginx.conf":`nginx`,"nodemon-debug.json":`nodemon`,"nodemon.json":`nodemon`,"now.json":`vercel`,"nuget.config":`nuget`,"nuget.exe":`nuget`,"nuxt.config.js":`nuxt`,"nuxt.config.ts":`nuxt`,"nx.json":`nx`,"nyc.config.cjs":`istanbul`,"nyc.config.js":`istanbul`,"openapi.json":`openapi`,"openapi.yaml":`openapi`,"openapi.yml":`openapi`,"opencode.json":`opencode`,"opencode.jsonc":`opencode`,owners:`codeowners`,"oxfmt.config.ts":`oxc`,"oxlint.config.ts":`oxc`,"package-lock.json":`nodejs`,"package.json":`nodejs`,"packship.config.js":`packship`,"packship.config.json":`packship`,"packship.config.mjs":`packship`,"packship.config.mts":`packship`,"packship.config.ts":`packship`,"panda.config.cjs":`panda`,"panda.config.cts":`panda`,"panda.config.js":`panda`,"panda.config.mjs":`panda`,"panda.config.mts":`panda`,"panda.config.ts":`panda`,"payload.config.js":`payload`,"payload.config.mjs":`payload`,"payload.config.mts":`payload`,"payload.config.ts":`payload`,"pdm.lock":`pdm`,"pdm.toml":`pdm`,"phpstan.dist.neon":`phpstan`,"phpstan.neon":`phpstan`,"phpstan.neon.dist":`phpstan`,"phpunit-watcher.yml":`phpunit`,"phpunit-watcher.yml.dist":`phpunit`,"phpunit.xml":`phpunit`,"phpunit.xml.dist":`phpunit`,pipfile:`python-misc`,pkgbuild:`console`,pklproject:`pkl`,"pklproject.deps.json":`pkl`,"plastic.branchexplorer":`plastic`,"plastic.selector":`plastic`,"plastic.wktree":`plastic`,"plastic.workspace":`plastic`,"plastic.workspaces":`plastic`,"playwright-ct.config.cjs":`playwright`,"playwright-ct.config.cts":`playwright`,"playwright-ct.config.js":`playwright`,"playwright-ct.config.mjs":`playwright`,"playwright-ct.config.mts":`playwright`,"playwright-ct.config.ts":`playwright`,"playwright.config.base.cjs":`playwright`,"playwright.config.base.cts":`playwright`,"playwright.config.base.js":`playwright`,"playwright.config.base.mjs":`playwright`,"playwright.config.base.mts":`playwright`,"playwright.config.base.ts":`playwright`,"playwright.config.cjs":`playwright`,"playwright.config.cts":`playwright`,"playwright.config.js":`playwright`,"playwright.config.mjs":`playwright`,"playwright.config.mts":`playwright`,"playwright.config.ts":`playwright`,"plopfile.cjs":`plop`,"plopfile.js":`plop`,"plopfile.mjs":`plop`,"plopfile.ts":`plop`,"pnpm-lock.yaml":`pnpm`,"pnpm-workspace.yaml":`pnpm`,podfile:`ruby`,"poetry.lock":`poetry`,"pom.xml":`maven`,"post-merge":`console`,"postcss.config.cjs":`postcss`,"postcss.config.cts":`postcss`,"postcss.config.js":`postcss`,"postcss.config.json":`postcss`,"postcss.config.json5":`postcss`,"postcss.config.jsonc":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.mts":`postcss`,"postcss.config.toml":`postcss`,"postcss.config.ts":`postcss`,"postcss.config.yaml":`postcss`,"postcss.config.yml":`postcss`,"posthtml.config.cjs":`posthtml`,"posthtml.config.cts":`posthtml`,"posthtml.config.js":`posthtml`,"posthtml.config.json":`posthtml`,"posthtml.config.json5":`posthtml`,"posthtml.config.jsonc":`posthtml`,"posthtml.config.mjs":`posthtml`,"posthtml.config.mts":`posthtml`,"posthtml.config.toml":`posthtml`,"posthtml.config.ts":`posthtml`,"posthtml.config.yaml":`posthtml`,"posthtml.config.yml":`posthtml`,"pre-commit":`console`,"pre-push":`console`,"prettier.config.cjs":`prettier`,"prettier.config.cts":`prettier`,"prettier.config.js":`prettier`,"prettier.config.json":`prettier`,"prettier.config.json5":`prettier`,"prettier.config.jsonc":`prettier`,"prettier.config.mjs":`prettier`,"prettier.config.mts":`prettier`,"prettier.config.toml":`prettier`,"prettier.config.ts":`prettier`,"prettier.config.yaml":`prettier`,"prettier.config.yml":`prettier`,"prisma.config.ts":`prisma`,"prisma.yml":`prisma`,procfile:`heroku`,"procfile.windows":`heroku`,"project.garden.yaml":`garden`,"project.garden.yml":`garden`,"project.graphcool":`graphcool`,"protractor.conf.coffee":`protractor`,"protractor.conf.js":`protractor`,"protractor.conf.ts":`protractor`,"protractor.config.js":`protractor`,"protractor.config.ts":`protractor`,"puppeteer.config.cjs":`puppeteer`,"puppeteer.config.cts":`puppeteer`,"puppeteer.config.js":`puppeteer`,"puppeteer.config.json":`puppeteer`,"puppeteer.config.json5":`puppeteer`,"puppeteer.config.jsonc":`puppeteer`,"puppeteer.config.mjs":`puppeteer`,"puppeteer.config.mts":`puppeteer`,"puppeteer.config.toml":`puppeteer`,"puppeteer.config.ts":`puppeteer`,"puppeteer.config.yaml":`puppeteer`,"puppeteer.config.yml":`puppeteer`,puppetfile:`ruby`,"py.typed":`python-misc`,pylintrc:`python-misc`,"pyproject.toml":`python-misc`,"quasar.conf.js":`quasar`,"quasar.conf.ts":`quasar`,"quasar.config.cjs":`quasar`,"quasar.config.js":`quasar`,"quasar.config.ts":`quasar`,rakefile:`ruby`,rantfile:`ruby`,readme:`readme`,"readme.md":`readme`,"readme.rst":`readme`,"readme.txt":`readme`,"release-plz.toml":`rocket`,"release.config.cjs":`semantic-release`,"release.config.cts":`semantic-release`,"release.config.js":`semantic-release`,"release.config.json":`semantic-release`,"release.config.json5":`semantic-release`,"release.config.jsonc":`semantic-release`,"release.config.mjs":`semantic-release`,"release.config.mts":`semantic-release`,"release.config.toml":`semantic-release`,"release.config.ts":`semantic-release`,"release.config.yaml":`semantic-release`,"release.config.yml":`semantic-release`,"release.toml":`rocket`,"remix.config.js":`remix`,"remix.config.ts":`remix`,"renovate-config.json":`renovate`,"renovate.json":`renovate`,"renovate.json5":`renovate`,"requirements.txt":`python-misc`,"roadmap.md":`roadmap`,"roadmap.txt":`roadmap`,"robots.txt":`robots`,"rolldown.config.cjs":`rolldown`,"rolldown.config.cts":`rolldown`,"rolldown.config.js":`rolldown`,"rolldown.config.mjs":`rolldown`,"rolldown.config.mts":`rolldown`,"rolldown.config.ts":`rolldown`,"rollup-config.js":`rollup`,"rollup-config.mjs":`rollup`,"rollup-config.ts":`rollup`,"rollup.config.base.js":`rollup`,"rollup.config.base.mjs":`rollup`,"rollup.config.base.ts":`rollup`,"rollup.config.common.js":`rollup`,"rollup.config.common.mjs":`rollup`,"rollup.config.common.ts":`rollup`,"rollup.config.dev.js":`rollup`,"rollup.config.dev.mjs":`rollup`,"rollup.config.dev.ts":`rollup`,"rollup.config.js":`rollup`,"rollup.config.mjs":`rollup`,"rollup.config.prod.js":`rollup`,"rollup.config.prod.mjs":`rollup`,"rollup.config.prod.ts":`rollup`,"rollup.config.prod.vendor.js":`rollup`,"rollup.config.prod.vendor.mjs":`rollup`,"rollup.config.prod.vendor.ts":`rollup`,"rollup.config.ts":`rollup`,"rome.json":`rome`,"route.js":`routing`,"route.jsx":`routing`,"route.ts":`routing`,"route.tsx":`routing`,"router.js":`routing`,"router.jsx":`routing`,"router.ts":`routing`,"router.tsx":`routing`,"routes.js":`routing`,"routes.jsx":`routing`,"routes.ts":`routing`,"routes.tsx":`routing`,"rsbuild.config.cjs":`rstack`,"rsbuild.config.cts":`rstack`,"rsbuild.config.js":`rstack`,"rsbuild.config.mjs":`rstack`,"rsbuild.config.mts":`rstack`,"rsbuild.config.ts":`rstack`,"rslib.config.cjs":`rstack`,"rslib.config.cts":`rstack`,"rslib.config.js":`rstack`,"rslib.config.mjs":`rstack`,"rslib.config.mts":`rstack`,"rslib.config.ts":`rstack`,"rslint.config.cjs":`rstack`,"rslint.config.cts":`rstack`,"rslint.config.js":`rstack`,"rslint.config.mjs":`rstack`,"rslint.config.mts":`rstack`,"rslint.config.ts":`rstack`,"rslint.json":`rstack`,"rslint.jsonc":`rstack`,"rspack.config.cjs":`rstack`,"rspack.config.cts":`rstack`,"rspack.config.js":`rstack`,"rspack.config.mjs":`rstack`,"rspack.config.mts":`rstack`,"rspack.config.ts":`rstack`,"rspress.config.cjs":`rstack`,"rspress.config.cts":`rstack`,"rspress.config.js":`rstack`,"rspress.config.mjs":`rstack`,"rspress.config.mts":`rstack`,"rspress.config.ts":`rstack`,"rstest.config.cjs":`rstack`,"rstest.config.cts":`rstack`,"rstest.config.js":`rstack`,"rstest.config.mjs":`rstack`,"rstest.config.mts":`rstack`,"rstest.config.ts":`rstack`,"ruff.toml":`ruff`,scanfile:`ruby`,sconscript:`scons`,sconstruct:`scons`,"screwdriver.yaml":`screwdriver`,"screwdriver.yml":`screwdriver`,scsub:`scons`,security:`lock`,"security.md":`lock`,"security.txt":`lock`,"semgrep.yml":`semgrep`,"sentry.client.config.cjs":`sentry`,"sentry.client.config.cts":`sentry`,"sentry.client.config.js":`sentry`,"sentry.client.config.mjs":`sentry`,"sentry.client.config.mts":`sentry`,"sentry.client.config.ts":`sentry`,"sentry.edge.config.cjs":`sentry`,"sentry.edge.config.cts":`sentry`,"sentry.edge.config.js":`sentry`,"sentry.edge.config.mjs":`sentry`,"sentry.edge.config.mts":`sentry`,"sentry.edge.config.ts":`sentry`,"sentry.server.config.cjs":`sentry`,"sentry.server.config.cts":`sentry`,"sentry.server.config.js":`sentry`,"sentry.server.config.mjs":`sentry`,"sentry.server.config.mts":`sentry`,"sentry.server.config.ts":`sentry`,"serverless.js":`serverless`,"serverless.json":`serverless`,"serverless.ts":`serverless`,"serverless.yaml":`serverless`,"serverless.yml":`serverless`,sha256sums:`key`,shellcheckrc:`shellcheck`,"skill.md":`skill`,snakefile:`snakemake`,"snapcraft.yaml":`snapcraft`,"snapcraft.yml":`snapcraft`,snapfile:`ruby`,"snowpack.config.cjs":`snowpack`,"snowpack.config.cts":`snowpack`,"snowpack.config.js":`snowpack`,"snowpack.config.json":`snowpack`,"snowpack.config.mjs":`snowpack`,"snowpack.config.mts":`snowpack`,"snowpack.config.ts":`snowpack`,"snowpack.deps.json":`snowpack`,"sonar-project.properties":`sonarcloud`,"sonarcloud.yaml":`sonarcloud`,"sonarqube.analysis.xml":`sonarcloud`,"src/bashly.yaml":`bashly`,"src/bashly.yml":`bashly`,"steadybit.yaml":`steadybit`,"steadybit.yml":`steadybit`,"stencil.config.js":`stencil`,"stencil.config.ts":`stencil`,"stitches.config.js":`stitches`,"stitches.config.ts":`stitches`,"stryker.conf.cjs":`stryker`,"stryker.conf.js":`stryker`,"stryker.conf.json":`stryker`,"stryker.conf.mjs":`stryker`,"stryker.config.cjs":`stryker`,"stryker.config.js":`stryker`,"stryker.config.json":`stryker`,"stryker.config.mjs":`stryker`,"stylelint.config.cjs":`stylelint`,"stylelint.config.cts":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.json":`stylelint`,"stylelint.config.json5":`stylelint`,"stylelint.config.jsonc":`stylelint`,"stylelint.config.mjs":`stylelint`,"stylelint.config.mts":`stylelint`,"stylelint.config.toml":`stylelint`,"stylelint.config.ts":`stylelint`,"stylelint.config.yaml":`stylelint`,"stylelint.config.yml":`stylelint`,"supabase.js":`supabase`,"supabase.py":`supabase`,"supabase.ts":`supabase`,"svelte.config.cjs":`svelte`,"svelte.config.cts":`svelte`,"svelte.config.js":`svelte`,"svelte.config.mjs":`svelte`,"svelte.config.mts":`svelte`,"svelte.config.ts":`svelte`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgr.config.cjs":`svgr`,"svgr.config.cts":`svgr`,"svgr.config.js":`svgr`,"svgr.config.json":`svgr`,"svgr.config.json5":`svgr`,"svgr.config.jsonc":`svgr`,"svgr.config.mjs":`svgr`,"svgr.config.mts":`svgr`,"svgr.config.toml":`svgr`,"svgr.config.ts":`svgr`,"svgr.config.yaml":`svgr`,"svgr.config.yml":`svgr`,"swagger.json":`swagger`,"swagger.yaml":`swagger`,"swagger.yml":`swagger`,"syncpack.config.cjs":`syncpack`,"syncpack.config.cts":`syncpack`,"syncpack.config.js":`syncpack`,"syncpack.config.json":`syncpack`,"syncpack.config.json5":`syncpack`,"syncpack.config.jsonc":`syncpack`,"syncpack.config.mjs":`syncpack`,"syncpack.config.mts":`syncpack`,"syncpack.config.toml":`syncpack`,"syncpack.config.ts":`syncpack`,"syncpack.config.yaml":`syncpack`,"syncpack.config.yml":`syncpack`,tags:`label`,"tailwind.config.cjs":`tailwindcss`,"tailwind.config.cts":`tailwindcss`,"tailwind.config.js":`tailwindcss`,"tailwind.config.mjs":`tailwindcss`,"tailwind.config.mts":`tailwindcss`,"tailwind.config.ts":`tailwindcss`,"tailwind.js":`tailwindcss`,"tailwind.ts":`tailwindcss`,"taskfile.dist.yaml":`taskfile`,"taskfile.dist.yml":`taskfile`,"taskfile.yaml":`taskfile`,"taskfile.yml":`taskfile`,"tauri.conf.json":`tauri`,"tauri.config.json":`tauri`,"tauri.linux.conf.json":`tauri`,"tauri.macos.conf.json":`tauri`,"tauri.windows.conf.json":`tauri`,"taze.config.cjs":`taze`,"taze.config.cts":`taze`,"taze.config.js":`taze`,"taze.config.mjs":`taze`,"taze.config.mts":`taze`,"taze.config.ts":`taze`,thorfile:`ruby`,tiltfile:`tilt`,"timeline.md":`roadmap`,"timeline.txt":`roadmap`,"todo.md":`todo`,"todos.md":`todo`,"trigger.config.cjs":`trigger`,"trigger.config.cts":`trigger`,"trigger.config.js":`trigger`,"trigger.config.mjs":`trigger`,"trigger.config.mts":`trigger`,"trigger.config.ts":`trigger`,"tsconfig.app.json":`tsconfig`,"tsconfig.base.json":`tsconfig`,"tsconfig.build.json":`tsconfig`,"tsconfig.cjs.json":`tsconfig`,"tsconfig.client.json":`tsconfig`,"tsconfig.config.json":`tsconfig`,"tsconfig.declaration.json":`tsconfig`,"tsconfig.doc.json":`tsconfig`,"tsconfig.e2e.json":`tsconfig`,"tsconfig.editor.json":`tsconfig`,"tsconfig.eslint.json":`tsconfig`,"tsconfig.esm.json":`tsconfig`,"tsconfig.json":`tsconfig`,"tsconfig.lib.json":`tsconfig`,"tsconfig.lib.prod.json":`tsconfig`,"tsconfig.main.json":`tsconfig`,"tsconfig.mjs.json":`tsconfig`,"tsconfig.node.json":`tsconfig`,"tsconfig.paths.json":`tsconfig`,"tsconfig.renderer.json":`tsconfig`,"tsconfig.server.json":`tsconfig`,"tsconfig.spec.json":`tsconfig`,"tsconfig.test.json":`tsconfig`,"tsconfig.vitest.json":`tsconfig`,"tsconfig.web.json":`tsconfig`,"tsconfig.webworker.json":`tsconfig`,"tsconfig.worker.json":`tsconfig`,"tsdoc.json":`tsdoc`,"tsdown.config":`tsdown`,"tsdown.config.cjs":`tsdown`,"tsdown.config.cts":`tsdown`,"tsdown.config.js":`tsdown`,"tsdown.config.json":`tsdown`,"tsdown.config.mjs":`tsdown`,"tsdown.config.mts":`tsdown`,"tsdown.config.ts":`tsdown`,"turbo.json":`turborepo`,"turbo.jsonc":`turborepo`,"typedoc.js":`typedoc`,"typedoc.json":`typedoc`,"typst.toml":`typst`,unlicense:`unlicense`,"unlicense.txt":`unlicense`,"uno.config.js":`unocss`,"uno.config.mjs":`unocss`,"uno.config.mts":`unocss`,"uno.config.ts":`unocss`,"unocss.config.js":`unocss`,"unocss.config.mjs":`unocss`,"unocss.config.mts":`unocss`,"unocss.config.ts":`unocss`,"uv.lock":`uv`,"uv.toml":`uv`,"v.mod":`vlang`,vagrantfile:`vagrant`,"velite.config.cjs":`velite`,"velite.config.cts":`velite`,"velite.config.js":`velite`,"velite.config.mjs":`velite`,"velite.config.mts":`velite`,"velite.config.ts":`velite`,"vercel.json":`vercel`,"vercel.ts":`vercel`,"verdaccio.yml":`verdaccio`,"vetur.config.js":`vue-config`,"vetur.config.ts":`vue-config`,"vite.config.cjs":`vite`,"vite.config.cts":`vite`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"vitest.config.cjs":`vitest`,"vitest.config.cts":`vitest`,"vitest.config.js":`vitest`,"vitest.config.mjs":`vitest`,"vitest.config.mts":`vitest`,"vitest.config.ts":`vitest`,"vitest.e2e.config.cjs":`vitest`,"vitest.e2e.config.cts":`vitest`,"vitest.e2e.config.js":`vitest`,"vitest.e2e.config.mjs":`vitest`,"vitest.e2e.config.mts":`vitest`,"vitest.e2e.config.ts":`vitest`,"vitest.unit.config.cjs":`vitest`,"vitest.unit.config.cts":`vitest`,"vitest.unit.config.js":`vitest`,"vitest.unit.config.mjs":`vitest`,"vitest.unit.config.mts":`vitest`,"vitest.unit.config.ts":`vitest`,"vitest.workspace.cjs":`vitest`,"vitest.workspace.cts":`vitest`,"vitest.workspace.js":`vitest`,"vitest.workspace.mjs":`vitest`,"vitest.workspace.mts":`vitest`,"vitest.workspace.ts":`vitest`,"volar.config.js":`vue-config`,"vpkg.json":`vlang`,"vue.config.cjs":`vue-config`,"vue.config.js":`vue-config`,"vue.config.mjs":`vue-config`,"vue.config.ts":`vue-config`,"wallaby.conf.js":`wallaby`,"wallaby.js":`wallaby`,"wally.toml":`wally`,"warp.md":`warp`,"webpack.base.cjs":`webpack`,"webpack.base.cts":`webpack`,"webpack.base.js":`webpack`,"webpack.base.mjs":`webpack`,"webpack.base.mts":`webpack`,"webpack.base.ts":`webpack`,"webpack.cjs":`webpack`,"webpack.client.cjs":`webpack`,"webpack.client.cts":`webpack`,"webpack.client.js":`webpack`,"webpack.client.mjs":`webpack`,"webpack.client.mts":`webpack`,"webpack.client.ts":`webpack`,"webpack.common.cjs":`webpack`,"webpack.common.cts":`webpack`,"webpack.common.js":`webpack`,"webpack.common.mjs":`webpack`,"webpack.common.mts":`webpack`,"webpack.common.ts":`webpack`,"webpack.config.babel.cjs":`webpack`,"webpack.config.babel.cts":`webpack`,"webpack.config.babel.js":`webpack`,"webpack.config.babel.mjs":`webpack`,"webpack.config.babel.mts":`webpack`,"webpack.config.babel.ts":`webpack`,"webpack.config.base.babel.cjs":`webpack`,"webpack.config.base.babel.cts":`webpack`,"webpack.config.base.babel.js":`webpack`,"webpack.config.base.babel.mjs":`webpack`,"webpack.config.base.babel.mts":`webpack`,"webpack.config.base.babel.ts":`webpack`,"webpack.config.base.cjs":`webpack`,"webpack.config.base.cts":`webpack`,"webpack.config.base.js":`webpack`,"webpack.config.base.mjs":`webpack`,"webpack.config.base.mts":`webpack`,"webpack.config.base.ts":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.client.cjs":`webpack`,"webpack.config.client.cts":`webpack`,"webpack.config.client.js":`webpack`,"webpack.config.client.mjs":`webpack`,"webpack.config.client.mts":`webpack`,"webpack.config.client.ts":`webpack`,"webpack.config.coffee":`webpack`,"webpack.config.common.babel.cjs":`webpack`,"webpack.config.common.babel.cts":`webpack`,"webpack.config.common.babel.js":`webpack`,"webpack.config.common.babel.mjs":`webpack`,"webpack.config.common.babel.mts":`webpack`,"webpack.config.common.babel.ts":`webpack`,"webpack.config.common.cjs":`webpack`,"webpack.config.common.cts":`webpack`,"webpack.config.common.js":`webpack`,"webpack.config.common.mjs":`webpack`,"webpack.config.common.mts":`webpack`,"webpack.config.common.ts":`webpack`,"webpack.config.cts":`webpack`,"webpack.config.dev.babel.cjs":`webpack`,"webpack.config.dev.babel.cts":`webpack`,"webpack.config.dev.babel.js":`webpack`,"webpack.config.dev.babel.mjs":`webpack`,"webpack.config.dev.babel.mts":`webpack`,"webpack.config.dev.babel.ts":`webpack`,"webpack.config.dev.cjs":`webpack`,"webpack.config.dev.cts":`webpack`,"webpack.config.dev.js":`webpack`,"webpack.config.dev.mjs":`webpack`,"webpack.config.dev.mts":`webpack`,"webpack.config.dev.ts":`webpack`,"webpack.config.js":`webpack`,"webpack.config.main.cjs":`webpack`,"webpack.config.main.cts":`webpack`,"webpack.config.main.js":`webpack`,"webpack.config.main.mjs":`webpack`,"webpack.config.main.mts":`webpack`,"webpack.config.main.ts":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.mts":`webpack`,"webpack.config.prod.babel.cjs":`webpack`,"webpack.config.prod.babel.cts":`webpack`,"webpack.config.prod.babel.js":`webpack`,"webpack.config.prod.babel.mjs":`webpack`,"webpack.config.prod.babel.mts":`webpack`,"webpack.config.prod.babel.ts":`webpack`,"webpack.config.prod.cjs":`webpack`,"webpack.config.prod.cts":`webpack`,"webpack.config.prod.js":`webpack`,"webpack.config.prod.mjs":`webpack`,"webpack.config.prod.mts":`webpack`,"webpack.config.prod.ts":`webpack`,"webpack.config.production.babel.cjs":`webpack`,"webpack.config.production.babel.cts":`webpack`,"webpack.config.production.babel.js":`webpack`,"webpack.config.production.babel.mjs":`webpack`,"webpack.config.production.babel.mts":`webpack`,"webpack.config.production.babel.ts":`webpack`,"webpack.config.production.cjs":`webpack`,"webpack.config.production.cts":`webpack`,"webpack.config.production.js":`webpack`,"webpack.config.production.mjs":`webpack`,"webpack.config.production.mts":`webpack`,"webpack.config.production.ts":`webpack`,"webpack.config.renderer.cjs":`webpack`,"webpack.config.renderer.cts":`webpack`,"webpack.config.renderer.js":`webpack`,"webpack.config.renderer.mjs":`webpack`,"webpack.config.renderer.mts":`webpack`,"webpack.config.renderer.ts":`webpack`,"webpack.config.server.cjs":`webpack`,"webpack.config.server.cts":`webpack`,"webpack.config.server.js":`webpack`,"webpack.config.server.mjs":`webpack`,"webpack.config.server.mts":`webpack`,"webpack.config.server.ts":`webpack`,"webpack.config.staging.babel.cjs":`webpack`,"webpack.config.staging.babel.cts":`webpack`,"webpack.config.staging.babel.js":`webpack`,"webpack.config.staging.babel.mjs":`webpack`,"webpack.config.staging.babel.mts":`webpack`,"webpack.config.staging.babel.ts":`webpack`,"webpack.config.staging.cjs":`webpack`,"webpack.config.staging.cts":`webpack`,"webpack.config.staging.js":`webpack`,"webpack.config.staging.mjs":`webpack`,"webpack.config.staging.mts":`webpack`,"webpack.config.staging.ts":`webpack`,"webpack.config.test.cjs":`webpack`,"webpack.config.test.cts":`webpack`,"webpack.config.test.js":`webpack`,"webpack.config.test.mjs":`webpack`,"webpack.config.test.mts":`webpack`,"webpack.config.test.ts":`webpack`,"webpack.config.ts":`webpack`,"webpack.config.vendor.cjs":`webpack`,"webpack.config.vendor.cts":`webpack`,"webpack.config.vendor.js":`webpack`,"webpack.config.vendor.mjs":`webpack`,"webpack.config.vendor.mts":`webpack`,"webpack.config.vendor.production.cjs":`webpack`,"webpack.config.vendor.production.cts":`webpack`,"webpack.config.vendor.production.js":`webpack`,"webpack.config.vendor.production.mjs":`webpack`,"webpack.config.vendor.production.mts":`webpack`,"webpack.config.vendor.production.ts":`webpack`,"webpack.config.vendor.ts":`webpack`,"webpack.cts":`webpack`,"webpack.dev.cjs":`webpack`,"webpack.dev.cts":`webpack`,"webpack.dev.js":`webpack`,"webpack.dev.mjs":`webpack`,"webpack.dev.mts":`webpack`,"webpack.dev.ts":`webpack`,"webpack.development.cjs":`webpack`,"webpack.development.cts":`webpack`,"webpack.development.js":`webpack`,"webpack.development.mjs":`webpack`,"webpack.development.mts":`webpack`,"webpack.development.ts":`webpack`,"webpack.dist.cjs":`webpack`,"webpack.dist.cts":`webpack`,"webpack.dist.js":`webpack`,"webpack.dist.mjs":`webpack`,"webpack.dist.mts":`webpack`,"webpack.dist.ts":`webpack`,"webpack.js":`webpack`,"webpack.mix.cjs":`webpack`,"webpack.mix.cts":`webpack`,"webpack.mix.js":`webpack`,"webpack.mix.mjs":`webpack`,"webpack.mix.mts":`webpack`,"webpack.mix.ts":`webpack`,"webpack.mjs":`webpack`,"webpack.mts":`webpack`,"webpack.prod.cjs":`webpack`,"webpack.prod.config.cjs":`webpack`,"webpack.prod.config.cts":`webpack`,"webpack.prod.config.js":`webpack`,"webpack.prod.config.mjs":`webpack`,"webpack.prod.config.mts":`webpack`,"webpack.prod.config.ts":`webpack`,"webpack.prod.cts":`webpack`,"webpack.prod.js":`webpack`,"webpack.prod.mjs":`webpack`,"webpack.prod.mts":`webpack`,"webpack.prod.ts":`webpack`,"webpack.production.cjs":`webpack`,"webpack.production.cts":`webpack`,"webpack.production.js":`webpack`,"webpack.production.mjs":`webpack`,"webpack.production.mts":`webpack`,"webpack.production.ts":`webpack`,"webpack.server.cjs":`webpack`,"webpack.server.cts":`webpack`,"webpack.server.js":`webpack`,"webpack.server.mjs":`webpack`,"webpack.server.mts":`webpack`,"webpack.server.ts":`webpack`,"webpack.test.cjs":`webpack`,"webpack.test.cts":`webpack`,"webpack.test.js":`webpack`,"webpack.test.mjs":`webpack`,"webpack.test.mts":`webpack`,"webpack.test.ts":`webpack`,"webpack.ts":`webpack`,"webpackfile.cjs":`webpack`,"webpackfile.cts":`webpack`,"webpackfile.js":`webpack`,"webpackfile.mjs":`webpack`,"webpackfile.mts":`webpack`,"webpackfile.ts":`webpack`,"werf-giterminism.yaml":`werf`,"werf-giterminism.yml":`werf`,"werf-includes.lock":`werf`,"werf-includes.yaml":`werf`,"werf-includes.yml":`werf`,"werf.yaml":`werf`,"werf.yml":`werf`,"windi.config.cjs":`windicss`,"windi.config.cts":`windicss`,"windi.config.js":`windicss`,"windi.config.json":`windicss`,"windi.config.ts":`windicss`,"wrangler.json":`wrangler`,"wrangler.jsonc":`wrangler`,"wrangler.toml":`wrangler`,"wxt.config.cjs":`wxt`,"wxt.config.cts":`wxt`,"wxt.config.js":`wxt`,"wxt.config.mjs":`wxt`,"wxt.config.mts":`wxt`,"wxt.config.ts":`wxt`,"xamlstyler.json":`xaml`,xmake:`xmake`,"xmake.lua":`xmake`,"yarn-error.log":`yarn`,"yarn.lock":`yarn`,"zeabur.json":`zeabur`,"zeabur.json5":`zeabur`,"zeabur.jsonc":`zeabur`,"zeabur.toml":`zeabur`,"zeabur.yaml":`zeabur`,"zeabur.yml":`zeabur`,zlogin:`console`,zlogout:`console`,zprofile:`console`,zshenv:`console`,zshrc:`console`,zshrc_apple_terminal:`console`},ka={60:`slint`,".ncurc.js":`dependencies-update`,".ncurc.json":`dependencies-update`,".ncurc.yml":`dependencies-update`,".wakatime-project":`wakatime`,"001":`zip`,"123dx":`3d`,"3dm":`3d`,"3ds":`3d`,"3fr":`image`,"3mf":`3d`,"4th":`forth`,"7z":`zip`,"8svx":`audio`,a:`lib`,a51:`assembly`,aa:`audio`,aac:`audio`,aax:`audio`,abap:`abap`,abc:`abc`,ac:`3d`,ac3:`audio`,accdb:`database`,accde:`database`,acds:`abap`,act:`palette`,ad:`asciidoc`,ada:`ada`,adb:`ada`,adoc:`asciidoc`,adp:`database`,ads:`ada`,aea:`assembly`,afphoto:`image`,agc:`assembly`,ags:`assembly`,ahk:`autohotkey`,ai:`adobe-illustrator`,aif:`audio`,aiff:`audio`,ait:`adobe-illustrator`,alac:`audio`,ali:`ada`,alloy:`grafana-alloy`,ami:`image`,amr:`audio`,amx:`pawn`,ape:`audio`,apfs:`zip`,apib:`apiblueprint`,apiblueprint:`apiblueprint`,apk:`android`,applescript:`applescript`,apx:`image`,argus:`assembly`,ari:`image`,arj:`zip`,arw:`image`,as:`actionscript`,asc:`key`,asciidoc:`asciidoc`,ascx:`xml`,asddls:`abap`,ase:`image`,aseprite:`image`,asm:`assembly`,asp:`html`,aspx:`html`,ass:`subtitles`,ast:`sas`,astore:`sas`,astro:`astro`,atom:`xml`,au3:`autoit`,aux:`tex`,avi:`video`,avif:`image`,awk:`console`,axaml:`xml`,axml:`xml`,azcli:`azure`,"azure-pipelines-main.yaml":`azure-pipelines`,"azure-pipelines-main.yml":`azure-pipelines`,"azure-pipelines.yaml":`azure-pipelines`,"azure-pipelines.yml":`azure-pipelines`,b:`brainfuck`,bak:`database`,bal:`ballerina`,balx:`ballerina`,bas:`visualstudio`,bash:`console`,bash_aliases:`console`,bash_login:`console`,bash_logout:`console`,bash_profile:`console`,bashrc:`console`,bat:`console`,bay:`image`,bazel:`bazel`,bbl:`bibliography`,bbx:`bbx`,bcf:`bibliography`,bdb:`database`,bean:`beancount`,beancount:`beancount`,"bench.cjs":`bench-js`,"bench.cts":`bench-ts`,"bench.js":`bench-js`,"bench.jsx":`bench-jsx`,"bench.mjs":`bench-js`,"bench.mts":`bench-ts`,"bench.ts":`bench-ts`,"bench.tsx":`bench-jsx`,bf:`brainfuck`,bib:`bibliography`,bicep:`bicep`,bin:`hex`,binsource:`assembly`,"blade.php":`laravel`,blend:`blender`,blend1:`blender`,blend2:`blender`,blg:`bibliography`,blink:`blink`,bmap:`font`,bmp:`image`,bpg:`image`,bpmn:`xml`,br:`zip`,braw:`image`,brk:`image`,brotli:`zip`,brs:`visualstudio`,bru:`bruno`,bst:`bibtex-style`,bubble:`dinophp`,bz2:`zip`,bzip2:`zip`,bzl:`bazel`,c:`c`,"c++":`cpp`,"c++m":`cpp`,c3:`c3`,cab:`zip`,cabal:`cabal`,caf:`audio`,cairo:`cairo`,cake:`cake`,cap:`image`,capnp:`capnp`,catpart:`3d`,catproduct:`3d`,cbl:`cobol`,cbx:`cbx`,cc:`cpp`,ccm:`cpp`,cda:`audio`,cdc:`cadence`,cdr:`audio`,cds:`cds`,cer:`certificate`,cert:`certificate`,cfc:`coldfusion`,cff:`yaml`,cfg:`settings`,cfm:`coldfusion`,cfml:`coldfusion`,cginc:`shader`,cjs:`javascript`,"cjs.map":`javascript-map`,cl:`lisp`,class:`javaclass`,clip:`image`,clj:`clojure`,cljc:`clojure`,cljs:`clojure`,cljx:`clojure`,clo:`tex`,clojure:`clojure`,cls:`tex`,cm:`sml`,cmake:`cmake`,cmd:`console`,cmj:`bucklescript`,cmx:`ocaml`,cnf:`settings`,coafile:`coala`,coarc:`coala`,cob:`cobol`,coco:`coconut`,"code-profile":`vscode`,"code-search":`search`,"code-snippets":`vscode`,"code-workplace":`vscode`,"code-workspace":`vscode`,coffee:`coffee`,command:`command`,comp:`shader`,"comp.glsl":`shader`,"comp.hlsl":`shader`,"compose.yaml":`docker`,"compose.yml":`docker`,compute:`shader`,"compute.glsl":`shader`,"compute.hlsl":`shader`,computeshader:`shader`,conf:`settings`,config:`settings`,containerfile:`docker`,containerignore:`docker`,"controller.js":`controller`,"controller.ts":`controller`,copilotmd:`markdown`,cp:`cpp`,cpio:`zip`,cpn:`coloredpetrinets`,cpp:`cpp`,cppm:`cpp`,cpt:`image`,cpy:`python`,cr:`crystal`,cr2:`image`,cr3:`image`,crt:`certificate`,crw:`image`,crx:`chrome`,cs:`csharp`,csh:`console`,csharp:`csharp`,cshrc:`console`,cshtml:`razor`,csl:`xml`,cson:`coffee`,csproj:`visualstudio`,"csproj.user":`xml`,css:`css`,"css.cjs":`vanilla-extract`,"css.js":`vanilla-extract`,"css.jsx":`vanilla-extract`,"css.map":`css-map`,"css.mjs":`vanilla-extract`,"css.ts":`vanilla-extract`,"css.tsx":`vanilla-extract`,csv:`table`,csx:`csharp`,ctp:`php`,cts:`typescript`,ctx:`context`,cu:`cuda`,cue:`cue`,cuh:`cuda`,cur:`image`,cxx:`cpp`,cxxm:`cpp`,"cy.js":`test-js`,"cy.jsx":`test-jsx`,"cy.ts":`test-ts`,"cy.tsx":`test-jsx`,d:`d`,"d.cts":`typescript-def`,"d.ets":`typescript-def`,"d.mts":`typescript-def`,"d.ts":`typescript-def`,dae:`3d`,dart:`dart`,dat:`hex`,data:`image`,db:`database`,db3:`database`,dbf:`database`,dblite:`database`,dblite3:`database`,dcr:`image`,dcs:`image`,dds:`image`,deb:`zip`,debugsymbols:`database`,def:`dotjs`,dex:`android`,dfxp:`subtitles`,dhall:`dhall`,dhallb:`dhall`,diff:`diff`,dio:`drawio`,directory:`settings`,dita:`xml`,ditamap:`xml`,djt:`django`,dlc:`settings`,dll:`dll`,dmg:`disc`,dmn:`xml`,dng:`image`,do:`tcl`,doc:`word`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,dockerignore:`docker`,docx:`word`,dot:`dotjs`,drawio:`drawio`,drf:`image`,"drone.yml":`drone`,dsc:`denizenscript`,dsql:`database`,dss:`audio`,dtd:`xml`,dtml:`xml`,duc:`duc`,dwg:`3d`,dxf:`3d`,"e2e-spec.cjs":`test-js`,"e2e-spec.cts":`test-ts`,"e2e-spec.js":`test-js`,"e2e-spec.mjs":`test-js`,"e2e-spec.mts":`test-ts`,"e2e-spec.ts":`test-ts`,ebuild:`console`,ec3:`audio`,eclass:`console`,ecr:`crystal`,edb:`email`,edge:`edge`,edn:`clojure`,eex:`elixir`,efs:`audio`,egg:`python-misc`,eip:`image`,ejs:`ejs`,elm:`elm`,eml:`email`,emlx:`email`,enc:`audio`,ent:`xml`,env:`tune`,eot:`font`,eps:`image`,epub:`epub`,erb:`ruby`,erf:`image`,erl:`erlang`,es6:`javascript`,esd:`zip`,esx:`javascript`,ex:`elixir`,excalidraw:`excalidraw`,"excalidraw.json":`excalidraw`,"excalidraw.png":`excalidraw`,"excalidraw.svg":`excalidraw`,exe:`exe`,exp:`console`,exr:`image`,exrc:`vim`,exs:`elixir`,eyaml:`yaml`,eyml:`yaml`,f:`fortran`,f03:`fortran`,f08:`fortran`,f3d:`3d`,f77:`fortran`,f90:`fortran`,f95:`fortran`,far:`zip`,fast:`lisp`,fat:`zip`,fbx:`3d`,fdb:`database`,feather:`database`,feature:`cucumber`,features:`cucumber`,fen:`chess`,fff:`image`,fhtml:`velocity`,fig:`figma`,fish:`console`,flac:`audio`,flp:`audio`,flv:`video`,fnt:`font`,font:`font`,fonts:`font`,fpx:`image`,frag:`shader`,"frag.glsl":`shader`,"fragment.glsl":`shader`,fragmentshader:`shader`,"freezed.dart":`dart_generated`,frm:`database`,frt:`forth`,fs:`fsharp`,"fs.glsl":`shader`,fsi:`fsharp`,fsproj:`fsharp`,fsscript:`fsharp`,fsx:`fsharp`,fth:`forth`,ftl:`freemarker`,fun:`sml`,fx:`shader`,fxh:`shader`,fxml:`xml`,fxp:`foxpro`,"g.dart":`dart_generated`,g4:`antlr`,"garden.yaml":`garden`,"garden.yml":`garden`,gbr:`image`,gd:`godot`,gdb:`database`,gdextension:`godot-assets`,gdnlib:`godot-assets`,gdns:`godot-assets`,gdshader:`godot-assets`,gdshaderinc:`godot-assets`,gemini:`gemini`,gemspec:`ruby`,geojson:`json`,geom:`shader`,"geom.glsl":`shader`,"geom.hlsl":`shader`,"geometry.glsl":`shader`,"geometry.hlsl":`shader`,geometryshader:`shader`,gif:`image`,gifv:`video`,"gitlab-ci.yml":`gitlab`,glb:`3d`,gleam:`gleam`,glsl:`shader`,gltf:`3d`,gmi:`gemini`,gml:`gamemaker`,gnu:`gnuplot`,go:`go`,godot:`godot-assets`,gp:`audio`,gpg:`key`,gpl:`palette`,gpr:`image`,gql:`graphql`,gr:`grain`,gradle:`gradle`,graphcool:`graphcool`,graphql:`graphql`,grm:`sml`,groovy:`groovy`,gs:`apps-script`,"gs.glsl":`shader`,gsm:`audio`,gvimrc:`vim`,gvy:`groovy`,gyp:`python`,gypi:`python`,gz:`zip`,gzip:`zip`,h:`h`,"h++":`hpp`,"h.in":`cpp`,haml:`haml`,handlebars:`handlebars`,har:`json`,hbs:`handlebars`,hcl:`hcl`,hdd:`disc`,heex:`elixir`,heic:`image`,heif:`image`,hex:`hex`,hfs:`zip`,hh:`hpp`,hip:`hip`,hjs:`handlebars`,hjson:`hjson`,hlsl:`shader`,hlsli:`shader`,"horusec-config.json":`horusec`,hp:`hpp`,hpp:`hpp`,"hpp.in":`cpp`,hs:`haskell`,htm:`html`,html:`html`,"html.bubble":`dinophp`,html_vm:`html`,http:`http`,huff:`huff`,hurl:`hurl`,hx:`haxe`,hxx:`hpp`,i:`c`,iam:`3d`,ibc:`idris`,ibd:`database`,iced:`coffee`,icns:`image`,ico:`image`,ics:`email`,idr:`idris`,ige:`3d`,iges:`3d`,igs:`3d`,ii:`cpp`,iiq:`image`,ilk:`dll`,imba:`imba`,img:`image`,iml:`xml`,inc:`assembly`,ini:`settings`,"inky.php":`laravel`,inl:`hpp`,ino:`arduino`,ins:`doctex-installer`,ipa:`applescript`,ipp:`cpp`,ipt:`3d`,ipy:`python`,ipynb:`jupyter`,isml:`xml`,iso:`disc`,it:`audio`,iuml:`uml`,ixx:`cpp`,j2:`jinja`,jade:`pug`,jar:`jar`,jav:`java`,java:`java`,jb2:`image`,jbig2:`image`,jenkins:`jenkins`,jenkinsfile:`jenkins`,jfif:`image`,jinja:`jinja`,"jinja-html":`jinja`,jinja2:`jinja`,jl:`julia`,jmx:`xml`,jng:`image`,jpeg:`image`,jpg:`image`,jrxml:`xml`,js:`javascript`,"js.map":`javascript-map`,"js.snap":`test-js`,"jsconfig.json":`jsconfig`,jshtm:`html`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsonld:`json`,jsp:`java`,jst:`dotjs`,jsx:`react`,"jsx.snap":`test-jsx`,jt:`3d`,jxl:`image`,jxr:`image`,k:`kcl`,k25:`image`,kdbx:`database`,kdc:`image`,key:`key`,kl:`kl`,kql:`kusto`,kra:`image`,ksh:`console`,kt:`kotlin`,kts:`kotlin`,ktx:`image`,ktx2:`image`,kv:`kivy`,lang:`i18n`,latex:`tex`,launch:`xml`,lbx:`lbx`,ldf:`database`,lean:`lean`,leex:`elixir`,less:`less`,lex:`sml`,lha:`zip`,lhs:`haskell`,lib:`lib`,liquid:`liquid`,lisp:`lisp`,litcoffee:`markdown`,liz:`zip`,lock:`lock`,log:`log`,lol:`lolcode`,lottie:`lottie`,lrc:`lyric`,ls:`livescript`,lsp:`lisp`,ltx:`tex`,lua:`lua`,luau:`luau`,lucee:`coldfusion`,ly:`lilypond`,lz:`zip`,lz4:`zip`,lz5:`zip`,lzh:`zip`,lzma:`zip`,lzma2:`zip`,m:`objective-c`,m2:`macaulay2`,m2v:`video`,m3u:`audio`,m3u8:`audio`,m4a:`audio`,m4b:`audio`,m4p:`audio`,m4r:`audio`,m4v:`video`,mak:`settings`,manifest:`xml`,markdn:`markdown`,markdoc:`markdoc`,"markdoc.md":`markdoc`,markdown:`markdown`,marko:`markojs`,mbox:`email`,mca:`minecraft`,mcaddon:`minecraft`,mcfunction:`minecraft`,mcgame:`minecraft`,mclevel:`minecraft`,mcmeta:`minecraft`,mcpack:`minecraft`,mcproject:`minecraft`,mcr:`minecraft`,mcstructure:`minecraft`,mctemplate:`minecraft`,mcworld:`minecraft`,md:`markdown`,mdb:`database`,mdc:`image`,mde:`database`,mdf:`database`,mdoc:`markdoc`,mdown:`markdown`,mdp:`image`,mdtext:`markdown`,mdtxt:`markdown`,mdwn:`markdown`,mdx:`mdx`,mef:`image`,menu:`xml`,merlin:`merlin`,mermaid:`mermaid`,mesh:`3d`,mi:`c`,mid:`audio`,mii:`cpp`,mine:`minecraft`,mint:`mint`,mitigus:`assembly`,mjml:`mjml`,mjs:`javascript`,"mjs.map":`javascript-map`,mk:`makefile`,mka:`audio`,mkd:`markdown`,mkdn:`markdown`,mkv:`video`,ml:`ocaml`,mlb:`sml`,mli:`ocaml`,mlton:`sml`,mm:`objective-cpp`,mmd:`mermaid`,mmf:`audio`,mo:`i18n`,mod:`audio`,"module.js":`angular`,"module.ts":`angular`,mojo:`mojo`,moon:`moonscript`,mos:`image`,mov:`video`,mp2:`video`,mp3:`audio`,mp4:`video`,mpc:`audio`,mpe:`video`,mpeg:`video`,mpg:`video`,mpv:`video`,mqo:`3d`,mrf:`font`,mrpack:`mrpack`,mrw:`image`,ms:`assembly`,mscz:`audio`,msg:`email`,msi:`exe`,mtm:`audio`,mts:`typescript`,mui:`audio`,mus:`minecraft`,mustache:`handlebars`,musx:`audio`,mxl:`audio`,mxml:`mxml`,myd:`database`,myi:`database`,nasm:`assembly`,nb:`mathematica`,ndf:`database`,ndjson:`json`,"ndst.json":`ndst`,"ndst.yaml":`ndst`,"ndst.yml":`ndst`,nef:`image`,nf:`groovy`,"ng-template":`angular`,nginx:`nginx`,nginxconf:`nginx`,nginxconfig:`nginx`,nim:`nim`,nimble:`nim`,nix:`nix`,njk:`nunjucks`,npmrc:`settings`,nrw:`image`,nsa:`audio`,ntf:`font`,ntfs:`zip`,nu:`console`,nunjucks:`nunjucks`,nupkg:`nuget`,nuspec:`nuget`,o:`3d`,obj:`3d`,obm:`image`,odb:`database`,odin:`odin`,odp:`powerpoint`,ods:`table`,odt:`word`,odttf:`font`,oft:`email`,ogg:`video`,ogv:`video`,olm:`email`,onnx:`onnx`,opam:`opam`,"openapi.json":`openapi`,"openapi.yaml":`openapi`,"openapi.yml":`openapi`,opml:`xml`,option:`settings`,opus:`audio`,ora:`image`,orc:`database`,orf:`image`,ost:`email`,otf:`font`,otne:`otne`,owl:`xml`,p:`prolog`,p7s:`email`,pac:`javascript`,pal:`palette`,parquet:`database`,pas:`pascal`,passwd:`key`,patch:`git`,pbm:`image`,pcss:`postcss`,pdb:`database`,pde:`processing`,pdf:`pdf`,"pdm.lock":`pdm`,"pdm.toml":`pdm`,pdn:`image`,pef:`image`,pem:`key`,pgf:`image`,pgm:`image`,pgn:`chess`,pgsql:`database`,php:`php`,"php.bubble":`dinophp`,php4:`php`,php5:`php`,phtml:`php`,pic:`image`,pine:`pinejs`,pipeline:`pipeline`,"pixel.hlsl":`shader`,pkb:`database`,pkf:`audio`,pkl:`pkl`,pks:`database`,pl:`prolog`,plantuml:`uml`,plist:`xml`,plpgsql:`database`,ply:`3d`,pm:`perl`,pmd:`3d`,pmx:`3d`,png:`image`,pnm:`image`,pnml:`coloredpetrinets`,po:`i18n`,pod:`perl`,podspec:`ruby`,postgres:`database`,pot:`i18n`,potm:`powerpoint`,potx:`powerpoint`,pp:`puppet`,ppa:`powerpoint`,ppam:`powerpoint`,ppm:`image`,pps:`powerpoint`,ppsm:`powerpoint`,ppsx:`powerpoint`,ppt:`powerpoint`,pptm:`powerpoint`,pptx:`powerpoint`,prefs:`settings`,prg:`foxpro`,prisma:`prisma`,pro:`prolog`,profile:`console`,proj:`xml`,project:`xml`,"prompt.md":`prompt`,"prompts.md":`prompt`,prop:`settings`,properties:`settings`,props:`settings`,proto:`proto`,prt:`3d`,prw:`advpl`,prx:`advpl`,ps1:`powershell`,ps1xml:`powershell`,psb:`adobe-photoshop`,psc1:`powershell`,psd:`adobe-photoshop`,psd1:`powershell`,psdt:`adobe-photoshop`,psgi:`perl`,psh:`shader`,psm1:`powershell`,psql:`database`,psrc:`powershell`,pssc:`powershell`,pst:`email`,psv:`table`,pt:`pytorch`,pth:`pytorch`,ptx:`image`,pu:`uml`,pub:`key`,publishsettings:`xml`,pubxml:`xml`,"pubxml.user":`xml`,pug:`pug`,puml:`uml`,pure:`purescript`,purs:`purescript`,pwf:`pytorch`,pwn:`pawn`,"px.hlsl":`shader`,pxn:`image`,py:`python`,pyc:`python-misc`,pyi:`python`,pyt:`python`,pyw:`python`,qcow:`disc`,qcow2:`disc`,qcp:`audio`,qed:`disc`,qmd:`quarto`,qs:`qsharp`,qt:`video`,"quokka.js":`quokka`,"quokka.jsx":`quokka`,"quokka.ts":`quokka`,"quokka.tsx":`quokka`,r:`r`,r3d:`image`,ra:`audio`,raf:`image`,rahit:`shader`,"rahit.glsl":`shader`,rake:`ruby`,raku:`perl`,raml:`raml`,rar:`zip`,raw:`image`,razor:`razor`,rb:`ruby`,rbi:`ruby`,rbs:`ruby`,rbx:`ruby`,rbxl:`roblox`,rbxlx:`roblox`,rbxm:`roblox`,"rbxmk.lua":`rbxmk`,"rbxmk.luau":`rbxmk`,rbxmx:`roblox`,rc:`rc`,rcall:`shader`,"rcall.glsl":`shader`,rchit:`shader`,"rchit.glsl":`shader`,rdf:`xml`,re:`reason`,reb:`image`,red:`red`,reg:`regedit`,rego:`opa`,rei:`reason`,rej:`diff`,repo:`settings`,res:`rescript`,resi:`rescript-interface`,rest:`http`,restql:`restql`,resx:`xml`,rf64:`audio`,rgen:`shader`,"rgen.glsl":`shader`,rhistory:`r`,rhtml:`html`,rint:`shader`,"rint.glsl":`shader`,riot:`riot`,rip:`audio`,rjs:`ruby`,rkt:`racket`,rm:`video`,rmd:`r`,rmiss:`shader`,"rmiss.glsl":`shader`,rmvb:`video`,rng:`xml`,robot:`robot`,ron:`rust`,ronn:`markdown`,"route.js":`routing`,"route.jsx":`routing`,"route.ts":`routing`,"route.tsx":`routing`,"routes.js":`routing`,"routes.jsx":`routing`,"routes.ts":`routing`,"routes.tsx":`routing`,"routing.js":`routing`,"routing.jsx":`routing`,"routing.ts":`routing`,"routing.tsx":`routing`,rpm:`zip`,rpmsg:`email`,rprofile:`r`,rpy:`python`,rql:`restql`,rs:`rust`,rss:`xml`,rst:`markdown`,rt:`r`,rtf:`word`,ru:`ruby`,ruleset:`visualstudio`,rw2:`image`,rwl:`image`,rwz:`image`,s:`assembly`,sab:`3d`,sai:`image`,san:`san`,sas:`sas`,sas7bdat:`sas`,sashdat:`sas`,sass:`sass`,sast:`sas`,sat:`3d`,sbt:`sbt`,sbv:`subtitles`,sc:`scala`,scala:`scala`,"schema.json":`json_schema`,scm:`scheme`,scss:`sass`,sdf:`database`,sdt:`audio`,secret:`key`,sesx:`audio`,settings:`settings`,sf2:`audio`,sh:`console`,sha256:`key`,sha256sum:`key`,sha256sums:`key`,shader:`shader`,shasum:`key`,shproj:`xml`,shtml:`html`,sig:`sml`,"sigstore.json":`verified`,sketch:`sketch`,"skill.md":`skill`,"skills.md":`skill`,skp:`3d`,slang:`shader`,sldasm:`3d`,slddrw:`3d`,sldprt:`3d`,slim:`slim`,slint:`slint`,sln:`visualstudio`,"sln.dotsettings":`settings`,"sln.dotsettings.user":`settings`,slnf:`visualstudio`,slnx:`visualstudio`,sls:`salt`,slx:`simulink`,smali:`android`,smb:`3d`,smk:`snakemake`,sml:`sml`,smt:`3d`,snakemake:`snakemake`,so:`dll`,sol:`solidity`,"spec-d.ts":`test-ts`,"spec-d.tsx":`test-jsx`,"spec.cjs":`test-js`,"spec.cts":`test-ts`,"spec.js":`test-js`,"spec.jsx":`test-jsx`,"spec.mjs":`test-js`,"spec.mts":`test-ts`,"spec.ts":`test-ts`,"spec.tsx":`test-jsx`,spv:`shader`,spwn:`spwn`,sql:`database`,sqlite:`database`,sqlite3:`database`,squashfs:`zip`,sr2:`image`,srf:`image`,srt:`subtitles`,srw:`image`,ss:`scheme`,ssa:`subtitles`,sss:`postcss`,"st.css":`stylable`,stan:`stan`,stap:`audio`,ste:`3d`,"steadybit.yaml":`steadybit`,"steadybit.yml":`steadybit`,step:`3d`,stl:`3d`,"stories.js":`storybook`,"stories.jsx":`storybook`,"stories.mdx":`storybook`,"stories.svelte":`storybook`,"stories.ts":`storybook`,"stories.tsx":`storybook`,"stories.vue":`storybook`,"story.js":`storybook`,"story.jsx":`storybook`,"story.mdx":`storybook`,"story.ts":`storybook`,"story.tsx":`storybook`,storyboard:`xml`,stp:`3d`,styl:`stylus`,sub:`subtitles`,"sublime-project":`sublime`,"sublime-workspace":`sublime`,sui:`font`,suit:`font`,suo:`visualstudio`,sv:`verilog`,svelte:`svelte`,svg:`svg`,svh:`verilog`,svx:`mdsvex`,sw:`sway`,"swagger.json":`swagger`,"swagger.yaml":`swagger`,"swagger.yml":`swagger`,swc:`adobe-swc`,swcrc:`swc`,swf:`flash`,swift:`swift`,swiftdeps:`swift`,swiftdoc:`swift`,swiftmodule:`swift`,swiftsourceinfo:`swift`,swm:`zip`,sy:`siyuan`,synctex:`tex`,"synctex.gz":`tex`,t:`perl`,tag:`riot`,tar:`zip`,targets:`xml`,"taskfile.yaml":`taskfile`,"taskfile.yml":`taskfile`,tauri:`tauri`,taz:`zip`,tbz:`zip`,tbz2:`zip`,tcc:`hpp`,tcl:`tcl`,tcsh:`console`,tcshrc:`console`,templ:`templ`,template:`template`,terraformignore:`terraform`,tesc:`shader`,"tesc.glsl":`shader`,tese:`shader`,"tese.glsl":`shader`,"tess.hlsl":`shader`,"tessellation.hlsl":`shader`,"test-d.ts":`test-ts`,"test-d.tsx":`test-jsx`,"test.cjs":`test-js`,"test.cts":`test-ts`,"test.js":`test-js`,"test.jsx":`test-jsx`,"test.mjs":`test-js`,"test.mts":`test-ts`,"test.ts":`test-ts`,"test.tsx":`test-jsx`,tex:`tex`,tf:`terraform`,"tf.json":`terraform`,tfbackend:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tg:`audio`,tga:`image`,tgz:`zip`,tif:`image`,tiff:`image`,tikz:`tex`,tl:`teal`,tld:`xml`,tldr:`tldraw`,tlz:`zip`,tmlanguage:`xml`,tmx:`xml`,tnef:`email`,tobi:`tobi`,toc:`toc`,todo:`todo`,tofu:`opentofu`,toml:`toml`,"tool-versions":`settings`,toon:`toon`,tpl:`smarty`,tpp:`cpp`,tpz:`zip`,tree:`tree`,tres:`godot-assets`,ts:`typescript`,"ts.glsl":`shader`,"ts.map":`json`,"ts.snap":`test-ts`,tsbuildinfo:`json`,tscn:`godot-assets`,"tsconfig.json":`tsconfig`,tsv:`table`,tsx:`react_ts`,"tsx.snap":`test-jsx`,ttc:`font`,ttf:`font`,ttml:`subtitles`,tw:`twine`,twee:`twine`,twig:`twig`,txt:`document`,txx:`cpp`,txz:`zip`,typ:`typst`,tz:`zip`,tzst:`zip`,tzstd:`zip`,ua:`uiua`,unity:`unity`,unitypackage:`unity`,url:`url`,usd:`3d`,usdz:`3d`,use:`sml`,v:`vlang`,vac:`3d`,vagrantfile:`vagrant`,vala:`vala`,vb:`visualstudio`,vba:`visualstudio`,vbhtml:`razor`,vbox:`virtual`,"vbox-prev":`virtual`,vbproj:`xml`,"vbproj.user":`xml`,vbs:`visualstudio`,vcl:`varnish`,vcxitems:`visualstudio`,"vcxitems.filters":`visualstudio`,vcxproj:`visualstudio`,"vcxproj.filters":`visualstudio`,vdi:`virtual`,vdp:`3d`,ved:`vedic`,veda:`vedic`,vedic:`vedic`,verse:`verse`,vert:`shader`,"vert.glsl":`shader`,"vertex.glsl":`shader`,vertexshader:`shader`,vfl:`vfl`,vhd:`verilog`,vhdl:`verilog`,vhdx:`verilog`,vim:`vim`,viminfo:`vim`,vimrc:`vim`,vm:`velocity`,vmdk:`disc`,vob:`video`,voc:`audio`,volt:`html`,vox:`3d`,vqf:`audio`,"vs.glsl":`shader`,vscodeignore:`vscode`,vsh:`shader`,vsix:`vscode`,vsixmanifest:`vscode`,vtl:`velocity`,vtt:`subtitles`,vue:`vue`,wasm:`webassembly`,wat:`webassembly`,wav:`audio`,weba:`audio`,webm:`video`,webmanifest:`json`,webp:`image`,wfp:`audio`,wgsl:`shader`,whl:`python-misc`,wim:`zip`,windi:`windicss`,winget:`yaml`,wire:`3d`,wixproj:`visualstudio`,wl:`wolframlanguage`,wls:`wolframlanguage`,wma:`audio`,wmv:`video`,woff:`font`,woff2:`font`,workbook:`markdown`,wpl:`audio`,wproj:`audio`,wpy:`wepy`,wrap:`meson`,wrl:`3d`,wsd:`uml`,wsdl:`xml`,wv:`audio`,wxi:`xml`,wxl:`xml`,wxs:`xml`,x3f:`image`,x_b:`3d`,x_t:`3d`,xaml:`xaml`,xar:`zip`,xbl:`xml`,xcf:`image`,xcplayground:`swift`,xht:`html`,xhtml:`html`,xib:`xml`,xlf:`i18n`,xliff:`xml`,xls:`table`,xlsm:`table`,xlsx:`table`,xml:`xml`,"xml.dist":`xml`,"xml.dist.sample":`xml`,xmp:`xml`,xoml:`xml`,xpdl:`xml`,xprofile:`console`,xquery:`xml`,xsd:`xml`,xsession:`console`,xsessionrc:`console`,xsh:`console`,xsl:`xml`,xslt:`xml`,xul:`xml`,xz:`zip`,yaml:`yaml`,"yaml-tmlanguage":`yaml`,"yaml-tmpreferences":`yaml`,"yaml-tmtheme":`yaml`,"yaml.dist":`yaml`,yang:`yang`,yash_profile:`console`,yashrc:`console`,yml:`yaml`,"yml.dist":`yaml`,yuv:`video`,yy:`gamemaker`,yyp:`gamemaker`,yyz:`gamemaker`,z:`zip`,zeabur:`zeabur`,zig:`zig`,zip:`zip`,zlogin:`console`,zlogout:`console`,zon:`zig`,zprofile:`console`,zsh:`console`,"zsh-theme":`console`,zshenv:`console`,zshrc:`console`,zst:`zip`,zstd:`zip`,ц:`tsil`,"🔥":`mojo`},Aa={"-@types":`folder-typescript`,"-addin":`folder-plugin`,"-addins":`folder-plugin`,"-addon":`folder-plugin`,"-addons":`folder-plugin`,"-admin":`folder-admin`,"-admins":`folder-admin`,"-agent":`folder-robot`,"-agents":`folder-robot`,"-android":`folder-android`,"-angular":`folder-angular`,"-anim":`folder-animation`,"-animated":`folder-animation`,"-animation":`folder-animation`,"-animations":`folder-animation`,"-anims":`folder-animation`,"-ansible":`folder-ansible`,"-api":`folder-api`,"-apis":`folder-api`,"-apollo":`folder-apollo`,"-apollo-cache":`folder-apollo`,"-apollo-client":`folder-apollo`,"-apollo-config":`folder-apollo`,"-app":`folder-app`,"-apple":`folder-macos`,"-application":`folder-app`,"-applications":`folder-app`,"-apps":`folder-app`,"-appwrite":`folder-appwrite`,"-arc":`folder-archive`,"-archival":`folder-archive`,"-archive":`folder-archive`,"-archives":`folder-archive`,"-arcs":`folder-archive`,"-article":`folder-docs`,"-articles":`folder-docs`,"-asm":`folder-assembly`,"-assembly":`folder-assembly`,"-asset":`folder-resource`,"-assets":`folder-resource`,"-astro":`folder-astro`,"-atom":`folder-atom`,"-atoms":`folder-atom`,"-attachment":`folder-attachment`,"-attachments":`folder-attachment`,"-aud":`folder-audio`,"-audio":`folder-audio`,"-audios":`folder-audio`,"-auds":`folder-audio`,"-aurelia_project":`folder-aurelia`,"-auth":`folder-secure`,"-authentication":`folder-secure`,"-auto":`folder-generator`,"-aws":`folder-aws`,"-azure":`folder-aws`,"-azure-pipelines":`folder-azure-pipelines`,"-azure-pipelines-ci":`folder-azure-pipelines`,"-back-up":`folder-backup`,"-back-ups":`folder-backup`,"-backend":`folder-server`,"-backends":`folder-server`,"-backup":`folder-backup`,"-backups":`folder-backup`,"-bak":`folder-backup`,"-baks":`folder-backup`,"-base":`folder-base`,"-bases":`folder-base`,"-batch":`folder-batch`,"-batches":`folder-batch`,"-batchs":`folder-batch`,"-bench":`folder-benchmark`,"-benches":`folder-benchmark`,"-benchmark":`folder-benchmark`,"-benchmarks":`folder-benchmark`,"-bibliographies":`folder-bibliography`,"-bibliography":`folder-bibliography`,"-bicep":`folder-bicep`,"-bin":`folder-dist`,"-bkp":`folder-backup`,"-bkps":`folder-backup`,"-blender":`folder-blender`,"-blender-assets":`folder-blender`,"-blender-files":`folder-blender`,"-blender-models":`folder-blender`,"-blender-project":`folder-blender`,"-bloc":`folder-bloc`,"-blocs":`folder-bloc`,"-blog":`folder-docs`,"-book":`folder-bibliography`,"-books":`folder-bibliography`,"-bot":`folder-robot`,"-bots":`folder-robot`,"-bower_components":`folder-bower`,"-browser":`folder-public`,"-browsers":`folder-public`,"-build":`folder-dist`,"-buildkite":`folder-buildkite`,"-builds":`folder-dist`,"-built":`folder-dist`,"-bull":`folder-queue`,"-cache":`folder-temp`,"-cached":`folder-temp`,"-calc":`folder-functions`,"-calcs":`folder-functions`,"-calculation":`folder-functions`,"-calculations":`folder-functions`,"-cargo":`folder-rust`,"-cart":`folder-cart`,"-centos":`folder-linux`,"-cert":`folder-secure`,"-certificate":`folder-secure`,"-certificates":`folder-secure`,"-certs":`folder-secure`,"-cfg":`folder-config`,"-cfgs":`folder-config`,"-cfn-gen":`folder-generator`,"-changes":`folder-delta`,"-changeset":`folder-changesets`,"-changesets":`folder-changesets`,"-chat":`folder-messages`,"-chats":`folder-messages`,"-ci":`folder-ci`,"-cipher":`folder-secure`,"-circleci":`folder-circleci`,"-cjs":`folder-javascript`,"-class":`folder-class`,"-classes":`folder-class`,"-claude":`folder-claude`,"-cli":`folder-command`,"-client":`folder-client`,"-clients":`folder-client`,"-cline_docs":`folder-cline`,"-clis":`folder-command`,"-cloud-firestore":`folder-firestore`,"-cloud-functions":`folder-cloud-functions`,"-cloudflare":`folder-cloudflare`,"-cloudfunctions":`folder-cloud-functions`,"-cluster":`folder-cluster`,"-clusters":`folder-cluster`,"-cmd":`folder-command`,"-cobol":`folder-cobol`,"-code":`folder-src`,"-color":`folder-theme`,"-colors":`folder-theme`,"-colour":`folder-theme`,"-colours":`folder-theme`,"-command":`folder-command`,"-commandline":`folder-command`,"-commands":`folder-command`,"-common":`folder-shared`,"-compiled":`folder-dist`,"-components":`folder-components`,"-composable":`folder-functions`,"-composables":`folder-functions`,"-concept":`folder-mock`,"-concepts":`folder-mock`,"-conf":`folder-config`,"-config":`folder-config`,"-configs":`folder-config`,"-configuration":`folder-config`,"-configurations":`folder-config`,"-confs":`folder-config`,"-connection":`folder-connection`,"-connections":`folder-connection`,"-console":`folder-console`,"-const":`folder-constant`,"-constant":`folder-constant`,"-constants":`folder-constant`,"-consts":`folder-constant`,"-container":`folder-container`,"-containers":`folder-container`,"-content":`folder-content`,"-contents":`folder-content`,"-context":`folder-context`,"-contexts":`folder-context`,"-contract":`folder-contract`,"-contract-test":`folder-contract`,"-contract-testing":`folder-contract`,"-contract-tests":`folder-contract`,"-contracts":`folder-contract`,"-controller":`folder-controller`,"-controllers":`folder-controller`,"-controls":`folder-controller`,"-conversation":`folder-messages`,"-conversations":`folder-messages`,"-core":`folder-core`,"-coverage":`folder-coverage`,"-crash":`folder-error`,"-crashes":`folder-error`,"-crates":`folder-lib`,"-css":`folder-css`,"-cts":`folder-typescript`,"-cubit":`folder-bloc`,"-cubits":`folder-bloc`,"-cue":`folder-cue`,"-cues":`folder-cue`,"-cursor":`folder-cursor`,"-custom":`folder-custom`,"-customs":`folder-custom`,"-cypher":`folder-secure`,"-cypress":`folder-cypress`,"-dal":`folder-dal`,"-dart":`folder-dart`,"-dart_tool":`folder-dart`,"-dart_tools":`folder-dart`,"-data":`folder-database`,"-data-access":`folder-dal`,"-data-access-layer":`folder-dal`,"-database":`folder-database`,"-databases":`folder-database`,"-db":`folder-database`,"-deb":`folder-linux`,"-debian":`folder-linux`,"-debug":`folder-debug`,"-debugger":`folder-debug`,"-debugging":`folder-debug`,"-decorator":`folder-decorators`,"-decorators":`folder-decorators`,"-deepin":`folder-linux`,"-delta":`folder-delta`,"-deltas":`folder-delta`,"-demo":`folder-examples`,"-demos":`folder-examples`,"-dependencies":`folder-packages`,"-design":`folder-theme`,"-designs":`folder-theme`,"-desktop":`folder-desktop`,"-devcontainer":`folder-container`,"-devpackages":`folder-packages`,"-devtools":`folder-tools`,"-dialog":`folder-messages`,"-dialogs":`folder-messages`,"-diary":`folder-docs`,"-directive":`folder-directive`,"-directives":`folder-directive`,"-display":`folder-desktop`,"-dist":`folder-dist`,"-distribution":`folder-dist`,"-doc":`folder-docs`,"-docker":`folder-docker`,"-dockerfiles":`folder-docker`,"-dockerhub":`folder-docker`,"-docs":`folder-docs`,"-document":`folder-docs`,"-documentation":`folder-docs`,"-documents":`folder-docs`,"-download":`folder-download`,"-downloader":`folder-download`,"-downloaders":`folder-download`,"-downloads":`folder-download`,"-draft":`folder-mock`,"-drafts":`folder-mock`,"-drizzle":`folder-drizzle`,"-ds_store":`folder-macos`,"-dump":`folder-dump`,"-dumps":`folder-dump`,"-e2e":`folder-coverage`,"-easing":`folder-animation`,"-easings":`folder-animation`,"-element":`folder-element`,"-elements":`folder-element`,"-email":`folder-mail`,"-emails":`folder-mail`,"-enum":`folder-enum`,"-enums":`folder-enum`,"-env":`folder-environment`,"-environment":`folder-environment`,"-environments":`folder-environment`,"-envs":`folder-environment`,"-err":`folder-error`,"-error":`folder-error`,"-errors":`folder-error`,"-errs":`folder-error`,"-eslint":`folder-eslint`,"-eslint-config":`folder-eslint`,"-eslint-configs":`folder-eslint`,"-eslint-plugin":`folder-eslint`,"-eslint-plugins":`folder-eslint`,"-etc":`folder-other`,"-event":`folder-event`,"-events":`folder-event`,"-example":`folder-examples`,"-examples":`folder-examples`,"-expo":`folder-expo`,"-expo-shared":`folder-expo`,"-export":`folder-export`,"-exported":`folder-export`,"-exports":`folder-export`,"-extension":`folder-plugin`,"-extensions":`folder-plugin`,"-external":`folder-lib`,"-externals":`folder-lib`,"-extra":`folder-other`,"-extras":`folder-other`,"-fastlane":`folder-fastlane`,"-favicon":`folder-favicon`,"-favicons":`folder-favicon`,"-feat":`folder-features`,"-feats":`folder-features`,"-feature":`folder-features`,"-features":`folder-features`,"-fig":`folder-images`,"-figs":`folder-images`,"-figure":`folder-images`,"-figures":`folder-images`,"-filter":`folder-filter`,"-filters":`folder-filter`,"-firebase":`folder-firebase`,"-firebase-cloud-functions":`folder-cloud-functions`,"-firebase-cloudfunctions":`folder-cloud-functions`,"-firebase-firestore":`folder-firestore`,"-firestore":`folder-firestore`,"-fixture":`folder-mock`,"-fixtures":`folder-mock`,"-flow-typed":`folder-flow`,"-flutter":`folder-flutter`,"-font":`folder-font`,"-fonts":`folder-font`,"-forgejo":`folder-forgejo`,"-form":`folder-form`,"-forms":`folder-form`,"-forum":`folder-messages`,"-fragments":`folder-components`,"-frontend":`folder-client`,"-frontends":`folder-client`,"-func":`folder-functions`,"-funcs":`folder-functions`,"-function":`folder-functions`,"-functions":`folder-functions`,"-game":`folder-console`,"-gamemaker":`folder-gamemaker`,"-gamemaker2":`folder-gamemaker`,"-games":`folder-console`,"-gcp":`folder-aws`,"-gemini":`folder-gemini-ai`,"-gemini-ai":`folder-gemini-ai`,"-geminiai":`folder-gemini-ai`,"-gen":`folder-generator`,"-generated":`folder-generator`,"-generator":`folder-generator`,"-generators":`folder-generator`,"-gens":`folder-generator`,"-git":`folder-git`,"-gitea":`folder-gitea`,"-githooks":`folder-git`,"-github":`folder-github`,"-github/issue_template":`folder-template`,"-github/pull_request_template":`folder-template`,"-github/workflows":`folder-gh-workflows`,"-gitlab":`folder-gitlab`,"-global":`folder-global`,"-glsl":`folder-shader`,"-go":`folder-go`,"-godot":`folder-godot`,"-godot-cpp":`folder-godot`,"-golang":`folder-go`,"-gql":`folder-graphql`,"-gradle":`folder-gradle`,"-graphql":`folder-graphql`,"-guard":`folder-guard`,"-guards":`folder-guard`,"-gui":`folder-ui`,"-gulp":`folder-gulp`,"-gulp-tasks":`folder-gulp`,"-gulpfile.babel.js":`folder-gulp`,"-gulpfile.js":`folder-gulp`,"-gulpfile.mjs":`folder-gulp`,"-gulpfile.ts":`folder-gulp`,"-gulpfiles":`folder-gulp`,"-handler":`folder-controller`,"-handlers":`folder-controller`,"-helm":`folder-helm`,"-helmchart":`folder-helm`,"-helmcharts":`folder-helm`,"-helper":`folder-helper`,"-helpers":`folder-helper`,"-hg":`folder-mercurial`,"-hgext":`folder-mercurial`,"-hghooks":`folder-mercurial`,"-histories":`folder-backup`,"-history":`folder-backup`,"-hlsl":`folder-shader`,"-home":`folder-home`,"-hook":`folder-hook`,"-hooks":`folder-hook`,"-html":`folder-views`,"-husky":`folder-husky`,"-i18n":`folder-i18n`,"-ico":`folder-images`,"-icon":`folder-images`,"-icons":`folder-images`,"-icos":`folder-images`,"-idea":`folder-intellij`,"-image":`folder-images`,"-images":`folder-images`,"-img":`folder-images`,"-imgs":`folder-images`,"-import":`folder-import`,"-imported":`folder-import`,"-imports":`folder-import`,"-in":`folder-input`,"-inc":`folder-include`,"-inc64":`folder-include`,"-include":`folder-include`,"-includes":`folder-include`,"-infra":`folder-server`,"-infrastructure":`folder-server`,"-input":`folder-input`,"-inputs":`folder-input`,"-integration":`folder-connection`,"-integration-test":`folder-coverage`,"-integration-tests":`folder-coverage`,"-integrations":`folder-connection`,"-interceptor":`folder-interceptor`,"-interceptors":`folder-interceptor`,"-interface":`folder-interface`,"-interfaces":`folder-interface`,"-internationalization":`folder-i18n`,"-inventories":`folder-server`,"-inventory":`folder-server`,"-io":`folder-input`,"-ios":`folder-ios`,"-ipad":`folder-macos`,"-iphone":`folder-macos`,"-ipod":`folder-macos`,"-ipynb":`folder-jupyter`,"-it":`folder-coverage`,"-j2":`folder-jinja`,"-java":`folder-java`,"-javascript":`folder-javascript`,"-javascripts":`folder-javascript`,"-jinja":`folder-jinja`,"-jinja2":`folder-jinja`,"-job":`folder-job`,"-jobs":`folder-job`,"-js":`folder-javascript`,"-json":`folder-json`,"-jsonc":`folder-json`,"-jsonl":`folder-json`,"-jsons":`folder-json`,"-jupyter":`folder-jupyter`,"-jwt":`folder-keys`,"-k8s":`folder-kubernetes`,"-key":`folder-keys`,"-keys":`folder-keys`,"-kit":`folder-tools`,"-kits":`folder-tools`,"-knowledge":`folder-docs`,"-kotlin":`folder-kotlin`,"-kql":`folder-kusto`,"-kubernetes":`folder-kubernetes`,"-kusto":`folder-kusto`,"-l10n":`folder-i18n`,"-lambda":`folder-functions`,"-lambdas":`folder-functions`,"-landing":`folder-home`,"-lang":`folder-i18n`,"-langs":`folder-i18n`,"-language":`folder-i18n`,"-languages":`folder-i18n`,"-layout":`folder-layout`,"-layouts":`folder-layout`,"-lefthook":`folder-lefthook`,"-lefthook-local":`folder-lefthook`,"-less":`folder-less`,"-lib":`folder-lib`,"-lib64":`folder-lib`,"-libraries":`folder-lib`,"-library":`folder-lib`,"-libs":`folder-lib`,"-license":`folder-license`,"-licenses":`folder-license`,"-link":`folder-link`,"-links":`folder-link`,"-linux":`folder-linux`,"-linuxbsd":`folder-linux`,"-liquibase":`folder-liquibase`,"-locale":`folder-i18n`,"-locales":`folder-i18n`,"-localization":`folder-i18n`,"-log":`folder-log`,"-logging":`folder-log`,"-logic":`folder-functions`,"-logs":`folder-log`,"-lottie":`folder-lottie`,"-lottiefiles":`folder-lottie`,"-lotties":`folder-lottie`,"-lua":`folder-lua`,"-luau":`folder-luau`,"-mac":`folder-macos`,"-macbook":`folder-macos`,"-macbook-air":`folder-macos`,"-macos":`folder-macos`,"-macosx":`folder-macos`,"-mail":`folder-mail`,"-mailers":`folder-mail`,"-mails":`folder-mail`,"-main":`folder-home`,"-manager":`folder-admin`,"-managers":`folder-admin`,"-mapping":`folder-mappings`,"-mappings":`folder-mappings`,"-markdown":`folder-markdown`,"-math":`folder-functions`,"-maths":`folder-functions`,"-md":`folder-markdown`,"-measure":`folder-benchmark`,"-measurement":`folder-benchmark`,"-measures":`folder-benchmark`,"-media":`folder-video`,"-messages":`folder-messages`,"-messaging":`folder-messages`,"-meta":`folder-meta`,"-meta-inf":`folder-config`,"-metadata":`folder-meta`,"-metro":`folder-metro`,"-middleware":`folder-middleware`,"-middlewares":`folder-middleware`,"-migration":`folder-migrations`,"-migrations":`folder-migrations`,"-mint":`folder-linux`,"-misc":`folder-other`,"-miscellaneous":`folder-other`,"-mjml":`folder-mjml`,"-mjs":`folder-javascript`,"-mobile":`folder-mobile`,"-mobiles":`folder-mobile`,"-mock":`folder-mock`,"-mocks":`folder-mock`,"-mod":`folder-plugin`,"-modding":`folder-plugin`,"-model":`folder-class`,"-models":`folder-class`,"-moderator":`folder-admin`,"-moderators":`folder-admin`,"-mods":`folder-plugin`,"-module":`folder-plugin`,"-modules":`folder-plugin`,"-mojo":`folder-mojo`,"-molecule":`folder-molecule`,"-molecules":`folder-molecule`,"-moon":`folder-moon`,"-motion":`folder-animation`,"-motions":`folder-animation`,"-movie":`folder-video`,"-movies":`folder-video`,"-mq":`folder-queue`,"-mts":`folder-typescript`,"-music":`folder-audio`,"-navigation":`folder-routes`,"-navigations":`folder-routes`,"-netlify":`folder-netlify`,"-news":`folder-docs`,"-next":`folder-next`,"-nginx":`folder-nginx`,"-node":`folder-node`,"-node_modules":`folder-node`,"-nodejs":`folder-node`,"-note":`folder-docs`,"-notebook":`folder-jupyter`,"-notebooks":`folder-jupyter`,"-notes":`folder-docs`,"-now":`folder-vercel`,"-nuxt":`folder-nuxt`,"-nyc-output":`folder-coverage`,"-nyc_output":`folder-coverage`,"-obsidian":`folder-obsidian`,"-opencode":`folder-opencode`,"-option":`folder-config`,"-options":`folder-config`,"-organism":`folder-organism`,"-organisms":`folder-organism`,"-osx":`folder-macos`,"-other":`folder-other`,"-others":`folder-other`,"-out":`folder-dist`,"-output":`folder-dist`,"-outputs":`folder-dist`,"-package":`folder-packages`,"-packages":`folder-packages`,"-pact":`folder-contract`,"-pacts":`folder-contract`,"-page":`folder-views`,"-pages":`folder-views`,"-palette":`folder-theme`,"-palettes":`folder-theme`,"-partial":`folder-include`,"-partials":`folder-include`,"-patches":`folder-git`,"-pdf":`folder-pdf`,"-pdfs":`folder-pdf`,"-pdm-build":`folder-pdm`,"-pdm-plugins":`folder-pdm`,"-perf":`folder-benchmark`,"-performance":`folder-benchmark`,"-phone":`folder-mobile`,"-phones":`folder-mobile`,"-photo":`folder-images`,"-photograph":`folder-images`,"-photographs":`folder-images`,"-photos":`folder-images`,"-php":`folder-php`,"-phpmailer":`folder-phpmailer`,"-pic":`folder-images`,"-pics":`folder-images`,"-picture":`folder-images`,"-pictures":`folder-images`,"-pipe":`folder-pipe`,"-pipeline":`folder-pipe`,"-pipelines":`folder-pipe`,"-pipes":`folder-pipe`,"-pkg":`folder-packages`,"-pkgs":`folder-packages`,"-plastic":`folder-plastic`,"-playground":`folder-sandbox`,"-playgrounds":`folder-sandbox`,"-playlist":`folder-audio`,"-playlists":`folder-audio`,"-plugin":`folder-plugin`,"-plugins":`folder-plugin`,"-policies":`folder-policy`,"-policy":`folder-policy`,"-popos":`folder-linux`,"-portability":`folder-mobile`,"-portable":`folder-mobile`,"-post":`folder-docs`,"-postman":`folder-postman`,"-posts":`folder-docs`,"-powershell":`folder-powershell`,"-pref":`folder-config`,"-preference":`folder-config`,"-preferences":`folder-config`,"-prefs":`folder-config`,"-presentation":`folder-ui`,"-preview":`folder-review`,"-previews":`folder-review`,"-prisma":`folder-prisma`,"-prisma/schema":`folder-prisma`,"-private":`folder-private`,"-profiling":`folder-benchmark`,"-proj":`folder-project`,"-project":`folder-project`,"-projects":`folder-project`,"-projs":`folder-project`,"-prompt":`folder-prompts`,"-prompts":`folder-prompts`,"-properties":`folder-config`,"-props":`folder-config`,"-proto":`folder-proto`,"-protobuf":`folder-proto`,"-protobufs":`folder-proto`,"-protos":`folder-proto`,"-provider":`folder-controller`,"-providers":`folder-controller`,"-proxy":`folder-public`,"-ps":`folder-powershell`,"-ps1":`folder-powershell`,"-ps4":`folder-console`,"-ps5":`folder-console`,"-public":`folder-public`,"-public_html":`folder-views`,"-pwa":`folder-client`,"-pycache":`folder-python`,"-pytest_cache":`folder-python`,"-python":`folder-python`,"-pytorch":`folder-pytorch`,"-quasar":`folder-quasar`,"-queue":`folder-queue`,"-queues":`folder-queue`,"-r":`folder-r`,"-recordings":`folder-audio`,"-release":`folder-dist`,"-remote":`folder-connection`,"-remotes":`folder-connection`,"-repo":`folder-repository`,"-report":`folder-resource`,"-reports":`folder-resource`,"-repos":`folder-repository`,"-repositories":`folder-repository`,"-repository":`folder-repository`,"-res":`folder-resource`,"-resolver":`folder-resolver`,"-resolvers":`folder-resolver`,"-resource":`folder-resource`,"-resources":`folder-resource`,"-restapi":`folder-api`,"-review":`folder-review`,"-reviewed":`folder-review`,"-reviews":`folder-review`,"-revisal":`folder-review`,"-revisals":`folder-review`,"-robot":`folder-robot`,"-robots":`folder-robot`,"-router":`folder-routes`,"-routers":`folder-routes`,"-routes":`folder-routes`,"-routing":`folder-routes`,"-rule":`folder-rules`,"-rules":`folder-rules`,"-rust":`folder-rust`,"-salt":`folder-salt`,"-saltstack":`folder-salt`,"-sample":`folder-examples`,"-sample-data":`folder-examples`,"-samples":`folder-examples`,"-sandbox":`folder-sandbox`,"-sandboxes":`folder-sandbox`,"-sass":`folder-sass`,"-scala":`folder-scala`,"-schema":`folder-class`,"-schemas":`folder-class`,"-sconf_temp":`folder-scons`,"-scons":`folder-scons`,"-scons_cache":`folder-scons`,"-screen":`folder-views`,"-screengrab":`folder-images`,"-screengrabs":`folder-images`,"-screens":`folder-views`,"-screenshot":`folder-images`,"-screenshots":`folder-images`,"-script":`folder-scripts`,"-scripting":`folder-scripts`,"-scripts":`folder-scripts`,"-scss":`folder-sass`,"-secret":`folder-keys`,"-secrets":`folder-keys`,"-secure":`folder-secure`,"-security":`folder-secure`,"-seed":`folder-seeders`,"-seeders":`folder-seeders`,"-seeding":`folder-seeders`,"-seeds":`folder-seeders`,"-server":`folder-server`,"-serverless":`folder-serverless`,"-serverpackages":`folder-packages`,"-servers":`folder-server`,"-service":`folder-controller`,"-services":`folder-controller`,"-setting":`folder-config`,"-settings":`folder-config`,"-shader":`folder-shader`,"-shaders":`folder-shader`,"-shared":`folder-shared`,"-shop":`folder-cart`,"-shopping":`folder-cart`,"-shopping-cart":`folder-cart`,"-sim":`folder-simulations`,"-sims":`folder-simulations`,"-simulation":`folder-simulations`,"-simulations":`folder-simulations`,"-site":`folder-public`,"-sketch":`folder-mock`,"-sketches":`folder-mock`,"-skill":`folder-skills`,"-skills":`folder-skills`,"-smtp":`folder-mail`,"-snap":`folder-snapcraft`,"-snapcraft":`folder-snapcraft`,"-snapshots":`folder-test`,"-snippet":`folder-snippet`,"-snippets":`folder-snippet`,"-song":`folder-audio`,"-songs":`folder-audio`,"-sound":`folder-audio`,"-sounds":`folder-audio`,"-source":`folder-src`,"-sources":`folder-src`,"-spa":`folder-client`,"-spec":`folder-test`,"-specs":`folder-test`,"-spellcheck":`folder-syntax`,"-spellcheckers":`folder-syntax`,"-sql":`folder-database`,"-src":`folder-src`,"-src-tauri":`folder-src-tauri`,"-srcs":`folder-src`,"-ssl":`folder-secure`,"-stack":`folder-stack`,"-stacks":`folder-stack`,"-start":`folder-home`,"-static":`folder-resource`,"-stencil":`folder-stencil`,"-store":`folder-store`,"-stores":`folder-store`,"-stories":`folder-storybook`,"-storybook":`folder-storybook`,"-style":`folder-css`,"-styles":`folder-css`,"-stylesheet":`folder-css`,"-stylesheets":`folder-css`,"-stylus":`folder-stylus`,"-sublime":`folder-sublime`,"-submodules":`folder-git`,"-supabase":`folder-supabase`,"-svelte":`folder-svelte`,"-svelte-kit":`folder-svelte`,"-svg":`folder-svg`,"-svgs":`folder-svg`,"-switch":`folder-console`,"-syntax":`folder-syntax`,"-syntaxes":`folder-syntax`,"-table-of-contents":`folder-toc`,"-target":`folder-target`,"-taskfile":`folder-taskfile`,"-taskfiles":`folder-taskfile`,"-tasks":`folder-tasks`,"-television":`folder-television`,"-temp":`folder-temp`,"-template":`folder-template`,"-templates":`folder-template`,"-terraform":`folder-terraform`,"-test":`folder-test`,"-testfiles":`folder-test`,"-testing":`folder-test`,"-tests":`folder-test`,"-texture":`folder-images`,"-textures":`folder-images`,"-theme":`folder-theme`,"-themes":`folder-theme`,"-third-party":`folder-lib`,"-thirdparty":`folder-lib`,"-tickets":`folder-tasks`,"-tls":`folder-secure`,"-tmp":`folder-temp`,"-toc":`folder-toc`,"-token":`folder-keys`,"-tokens":`folder-keys`,"-toolbox":`folder-tools`,"-toolboxes":`folder-tools`,"-tooling":`folder-tools`,"-toolkit":`folder-tools`,"-toolkits":`folder-tools`,"-tools":`folder-tools`,"-torch":`folder-pytorch`,"-transition":`folder-animation`,"-transitions":`folder-animation`,"-translate":`folder-i18n`,"-translation":`folder-i18n`,"-translations":`folder-i18n`,"-trash":`folder-trash`,"-trigger":`folder-trigger`,"-triggers":`folder-trigger`,"-ts":`folder-typescript`,"-turbo":`folder-turborepo`,"-tv":`folder-television`,"-tx":`folder-i18n`,"-typeface":`folder-font`,"-typefaces":`folder-font`,"-types":`folder-typescript`,"-typescript":`folder-typescript`,"-typings":`folder-typescript`,"-ubuntu":`folder-linux`,"-ui":`folder-ui`,"-unity":`folder-unity`,"-unix":`folder-linux`,"-update":`folder-update`,"-updates":`folder-update`,"-upgrade":`folder-update`,"-upgrades":`folder-update`,"-upload":`folder-upload`,"-uploads":`folder-upload`,"-util":`folder-utils`,"-utilities":`folder-utils`,"-utility":`folder-utils`,"-utils":`folder-utils`,"-ux":`folder-ui`,"-validation":`folder-rules`,"-validations":`folder-rules`,"-validator":`folder-rules`,"-validators":`folder-rules`,"-vector":`folder-svg`,"-vectors":`folder-svg`,"-vendor":`folder-lib`,"-vendors":`folder-lib`,"-venv":`folder-environment`,"-vercel":`folder-vercel`,"-verdaccio":`folder-verdaccio`,"-vid":`folder-video`,"-video":`folder-video`,"-videos":`folder-video`,"-vids":`folder-video`,"-view":`folder-views`,"-views":`folder-views`,"-vm":`folder-vm`,"-vms":`folder-vm`,"-voice":`folder-audio`,"-voices":`folder-audio`,"-vscode":`folder-vscode`,"-vscode-test":`folder-vscode`,"-vue":`folder-vue`,"-vuepress":`folder-vuepress`,"-wakatime":`folder-wakatime`,"-web":`folder-public`,"-webpack":`folder-webpack`,"-website":`folder-public`,"-websites":`folder-public`,"-widget":`folder-components`,"-widgets":`folder-components`,"-wiki":`folder-docs`,"-win":`folder-windows`,"-win10":`folder-windows`,"-win11":`folder-windows`,"-win32":`folder-windows`,"-windows":`folder-windows`,"-windows10":`folder-windows`,"-windows11":`folder-windows`,"-windowsnt":`folder-windows`,"-windowsxp":`folder-windows`,"-winnt":`folder-windows`,"-winxp":`folder-windows`,"-wordpress-org":`folder-wordpress`,"-wp-content":`folder-wordpress`,"-wsl":`folder-linux`,"-www":`folder-public`,"-wwwroot":`folder-public`,"-xbox":`folder-console`,"-xtask":`folder-scripts`,"-yarn":`folder-yarn`,"-zeabur":`folder-zeabur`,"-zed":`folder-zed`,".@types":`folder-typescript`,".addin":`folder-plugin`,".addins":`folder-plugin`,".addon":`folder-plugin`,".addons":`folder-plugin`,".admin":`folder-admin`,".admins":`folder-admin`,".agent":`folder-robot`,".agents":`folder-robot`,".android":`folder-android`,".angular":`folder-angular`,".anim":`folder-animation`,".animated":`folder-animation`,".animation":`folder-animation`,".animations":`folder-animation`,".anims":`folder-animation`,".ansible":`folder-ansible`,".api":`folder-api`,".apis":`folder-api`,".apollo":`folder-apollo`,".apollo-cache":`folder-apollo`,".apollo-client":`folder-apollo`,".apollo-config":`folder-apollo`,".app":`folder-app`,".apple":`folder-macos`,".application":`folder-app`,".applications":`folder-app`,".apps":`folder-app`,".appwrite":`folder-appwrite`,".arc":`folder-archive`,".archival":`folder-archive`,".archive":`folder-archive`,".archives":`folder-archive`,".arcs":`folder-archive`,".article":`folder-docs`,".articles":`folder-docs`,".asm":`folder-assembly`,".assembly":`folder-assembly`,".asset":`folder-resource`,".assets":`folder-resource`,".astro":`folder-astro`,".atom":`folder-atom`,".atoms":`folder-atom`,".attachment":`folder-attachment`,".attachments":`folder-attachment`,".aud":`folder-audio`,".audio":`folder-audio`,".audios":`folder-audio`,".auds":`folder-audio`,".aurelia_project":`folder-aurelia`,".auth":`folder-secure`,".authentication":`folder-secure`,".auto":`folder-generator`,".aws":`folder-aws`,".azure":`folder-aws`,".azure-pipelines":`folder-azure-pipelines`,".azure-pipelines-ci":`folder-azure-pipelines`,".back-up":`folder-backup`,".back-ups":`folder-backup`,".backend":`folder-server`,".backends":`folder-server`,".backup":`folder-backup`,".backups":`folder-backup`,".bak":`folder-backup`,".baks":`folder-backup`,".base":`folder-base`,".bases":`folder-base`,".batch":`folder-batch`,".batches":`folder-batch`,".batchs":`folder-batch`,".bench":`folder-benchmark`,".benches":`folder-benchmark`,".benchmark":`folder-benchmark`,".benchmarks":`folder-benchmark`,".bibliographies":`folder-bibliography`,".bibliography":`folder-bibliography`,".bicep":`folder-bicep`,".bin":`folder-dist`,".bkp":`folder-backup`,".bkps":`folder-backup`,".blender":`folder-blender`,".blender-assets":`folder-blender`,".blender-files":`folder-blender`,".blender-models":`folder-blender`,".blender-project":`folder-blender`,".bloc":`folder-bloc`,".blocs":`folder-bloc`,".blog":`folder-docs`,".book":`folder-bibliography`,".books":`folder-bibliography`,".bot":`folder-robot`,".bots":`folder-robot`,".bower_components":`folder-bower`,".browser":`folder-public`,".browsers":`folder-public`,".build":`folder-dist`,".buildkite":`folder-buildkite`,".builds":`folder-dist`,".built":`folder-dist`,".bull":`folder-queue`,".cache":`folder-temp`,".cached":`folder-temp`,".calc":`folder-functions`,".calcs":`folder-functions`,".calculation":`folder-functions`,".calculations":`folder-functions`,".cargo":`folder-rust`,".cart":`folder-cart`,".centos":`folder-linux`,".cert":`folder-secure`,".certificate":`folder-secure`,".certificates":`folder-secure`,".certs":`folder-secure`,".cfg":`folder-config`,".cfgs":`folder-config`,".cfn-gen":`folder-generator`,".changes":`folder-delta`,".changeset":`folder-changesets`,".changesets":`folder-changesets`,".chat":`folder-messages`,".chats":`folder-messages`,".ci":`folder-ci`,".cipher":`folder-secure`,".circleci":`folder-circleci`,".cjs":`folder-javascript`,".class":`folder-class`,".classes":`folder-class`,".claude":`folder-claude`,".cli":`folder-command`,".client":`folder-client`,".clients":`folder-client`,".cline_docs":`folder-cline`,".clis":`folder-command`,".cloud-firestore":`folder-firestore`,".cloud-functions":`folder-cloud-functions`,".cloudflare":`folder-cloudflare`,".cloudfunctions":`folder-cloud-functions`,".cluster":`folder-cluster`,".clusters":`folder-cluster`,".cmd":`folder-command`,".cobol":`folder-cobol`,".code":`folder-src`,".color":`folder-theme`,".colors":`folder-theme`,".colour":`folder-theme`,".colours":`folder-theme`,".command":`folder-command`,".commandline":`folder-command`,".commands":`folder-command`,".common":`folder-shared`,".compiled":`folder-dist`,".components":`folder-components`,".composable":`folder-functions`,".composables":`folder-functions`,".concept":`folder-mock`,".concepts":`folder-mock`,".conf":`folder-config`,".config":`folder-config`,".configs":`folder-config`,".configuration":`folder-config`,".configurations":`folder-config`,".confs":`folder-config`,".connection":`folder-connection`,".connections":`folder-connection`,".console":`folder-console`,".const":`folder-constant`,".constant":`folder-constant`,".constants":`folder-constant`,".consts":`folder-constant`,".container":`folder-container`,".containers":`folder-container`,".content":`folder-content`,".contents":`folder-content`,".context":`folder-context`,".contexts":`folder-context`,".contract":`folder-contract`,".contract-test":`folder-contract`,".contract-testing":`folder-contract`,".contract-tests":`folder-contract`,".contracts":`folder-contract`,".controller":`folder-controller`,".controllers":`folder-controller`,".controls":`folder-controller`,".conversation":`folder-messages`,".conversations":`folder-messages`,".core":`folder-core`,".coverage":`folder-coverage`,".crash":`folder-error`,".crashes":`folder-error`,".crates":`folder-lib`,".css":`folder-css`,".cts":`folder-typescript`,".cubit":`folder-bloc`,".cubits":`folder-bloc`,".cue":`folder-cue`,".cues":`folder-cue`,".cursor":`folder-cursor`,".custom":`folder-custom`,".customs":`folder-custom`,".cypher":`folder-secure`,".cypress":`folder-cypress`,".dal":`folder-dal`,".dart":`folder-dart`,".dart_tool":`folder-dart`,".dart_tools":`folder-dart`,".data":`folder-database`,".data-access":`folder-dal`,".data-access-layer":`folder-dal`,".database":`folder-database`,".databases":`folder-database`,".db":`folder-database`,".deb":`folder-linux`,".debian":`folder-linux`,".debug":`folder-debug`,".debugger":`folder-debug`,".debugging":`folder-debug`,".decorator":`folder-decorators`,".decorators":`folder-decorators`,".deepin":`folder-linux`,".delta":`folder-delta`,".deltas":`folder-delta`,".demo":`folder-examples`,".demos":`folder-examples`,".dependencies":`folder-packages`,".design":`folder-theme`,".designs":`folder-theme`,".desktop":`folder-desktop`,".devcontainer":`folder-container`,".devpackages":`folder-packages`,".devtools":`folder-tools`,".dialog":`folder-messages`,".dialogs":`folder-messages`,".diary":`folder-docs`,".directive":`folder-directive`,".directives":`folder-directive`,".display":`folder-desktop`,".dist":`folder-dist`,".distribution":`folder-dist`,".doc":`folder-docs`,".docker":`folder-docker`,".dockerfiles":`folder-docker`,".dockerhub":`folder-docker`,".docs":`folder-docs`,".document":`folder-docs`,".documentation":`folder-docs`,".documents":`folder-docs`,".download":`folder-download`,".downloader":`folder-download`,".downloaders":`folder-download`,".downloads":`folder-download`,".draft":`folder-mock`,".drafts":`folder-mock`,".drizzle":`folder-drizzle`,".ds_store":`folder-macos`,".dump":`folder-dump`,".dumps":`folder-dump`,".e2e":`folder-coverage`,".easing":`folder-animation`,".easings":`folder-animation`,".element":`folder-element`,".elements":`folder-element`,".email":`folder-mail`,".emails":`folder-mail`,".enum":`folder-enum`,".enums":`folder-enum`,".env":`folder-environment`,".environment":`folder-environment`,".environments":`folder-environment`,".envs":`folder-environment`,".err":`folder-error`,".error":`folder-error`,".errors":`folder-error`,".errs":`folder-error`,".eslint":`folder-eslint`,".eslint-config":`folder-eslint`,".eslint-configs":`folder-eslint`,".eslint-plugin":`folder-eslint`,".eslint-plugins":`folder-eslint`,".etc":`folder-other`,".event":`folder-event`,".events":`folder-event`,".example":`folder-examples`,".examples":`folder-examples`,".expo":`folder-expo`,".expo-shared":`folder-expo`,".export":`folder-export`,".exported":`folder-export`,".exports":`folder-export`,".extension":`folder-plugin`,".extensions":`folder-plugin`,".external":`folder-lib`,".externals":`folder-lib`,".extra":`folder-other`,".extras":`folder-other`,".fastlane":`folder-fastlane`,".favicon":`folder-favicon`,".favicons":`folder-favicon`,".feat":`folder-features`,".feats":`folder-features`,".feature":`folder-features`,".features":`folder-features`,".fig":`folder-images`,".figs":`folder-images`,".figure":`folder-images`,".figures":`folder-images`,".filter":`folder-filter`,".filters":`folder-filter`,".firebase":`folder-firebase`,".firebase-cloud-functions":`folder-cloud-functions`,".firebase-cloudfunctions":`folder-cloud-functions`,".firebase-firestore":`folder-firestore`,".firestore":`folder-firestore`,".fixture":`folder-mock`,".fixtures":`folder-mock`,".flow-typed":`folder-flow`,".flutter":`folder-flutter`,".font":`folder-font`,".fonts":`folder-font`,".forgejo":`folder-forgejo`,".form":`folder-form`,".forms":`folder-form`,".forum":`folder-messages`,".fragments":`folder-components`,".frontend":`folder-client`,".frontends":`folder-client`,".func":`folder-functions`,".funcs":`folder-functions`,".function":`folder-functions`,".functions":`folder-functions`,".game":`folder-console`,".gamemaker":`folder-gamemaker`,".gamemaker2":`folder-gamemaker`,".games":`folder-console`,".gcp":`folder-aws`,".gemini":`folder-gemini-ai`,".gemini-ai":`folder-gemini-ai`,".geminiai":`folder-gemini-ai`,".gen":`folder-generator`,".generated":`folder-generator`,".generator":`folder-generator`,".generators":`folder-generator`,".gens":`folder-generator`,".git":`folder-git`,".gitea":`folder-gitea`,".githooks":`folder-git`,".github":`folder-github`,".github/issue_template":`folder-template`,".github/pull_request_template":`folder-template`,".github/workflows":`folder-gh-workflows`,".gitlab":`folder-gitlab`,".global":`folder-global`,".glsl":`folder-shader`,".go":`folder-go`,".godot":`folder-godot`,".godot-cpp":`folder-godot`,".golang":`folder-go`,".gql":`folder-graphql`,".gradle":`folder-gradle`,".graphql":`folder-graphql`,".guard":`folder-guard`,".guards":`folder-guard`,".gui":`folder-ui`,".gulp":`folder-gulp`,".gulp-tasks":`folder-gulp`,".gulpfile.babel.js":`folder-gulp`,".gulpfile.js":`folder-gulp`,".gulpfile.mjs":`folder-gulp`,".gulpfile.ts":`folder-gulp`,".gulpfiles":`folder-gulp`,".handler":`folder-controller`,".handlers":`folder-controller`,".helm":`folder-helm`,".helmchart":`folder-helm`,".helmcharts":`folder-helm`,".helper":`folder-helper`,".helpers":`folder-helper`,".hg":`folder-mercurial`,".hgext":`folder-mercurial`,".hghooks":`folder-mercurial`,".histories":`folder-backup`,".history":`folder-backup`,".hlsl":`folder-shader`,".home":`folder-home`,".hook":`folder-hook`,".hooks":`folder-hook`,".html":`folder-views`,".husky":`folder-husky`,".i18n":`folder-i18n`,".ico":`folder-images`,".icon":`folder-images`,".icons":`folder-images`,".icos":`folder-images`,".idea":`folder-intellij`,".image":`folder-images`,".images":`folder-images`,".img":`folder-images`,".imgs":`folder-images`,".import":`folder-import`,".imported":`folder-import`,".imports":`folder-import`,".in":`folder-input`,".inc":`folder-include`,".inc64":`folder-include`,".include":`folder-include`,".includes":`folder-include`,".infra":`folder-server`,".infrastructure":`folder-server`,".input":`folder-input`,".inputs":`folder-input`,".integration":`folder-connection`,".integration-test":`folder-coverage`,".integration-tests":`folder-coverage`,".integrations":`folder-connection`,".interceptor":`folder-interceptor`,".interceptors":`folder-interceptor`,".interface":`folder-interface`,".interfaces":`folder-interface`,".internationalization":`folder-i18n`,".inventories":`folder-server`,".inventory":`folder-server`,".io":`folder-input`,".ios":`folder-ios`,".ipad":`folder-macos`,".iphone":`folder-macos`,".ipod":`folder-macos`,".ipynb":`folder-jupyter`,".it":`folder-coverage`,".j2":`folder-jinja`,".java":`folder-java`,".javascript":`folder-javascript`,".javascripts":`folder-javascript`,".jinja":`folder-jinja`,".jinja2":`folder-jinja`,".job":`folder-job`,".jobs":`folder-job`,".js":`folder-javascript`,".json":`folder-json`,".jsonc":`folder-json`,".jsonl":`folder-json`,".jsons":`folder-json`,".jupyter":`folder-jupyter`,".jwt":`folder-keys`,".k8s":`folder-kubernetes`,".key":`folder-keys`,".keys":`folder-keys`,".kit":`folder-tools`,".kits":`folder-tools`,".knowledge":`folder-docs`,".kotlin":`folder-kotlin`,".kql":`folder-kusto`,".kubernetes":`folder-kubernetes`,".kusto":`folder-kusto`,".l10n":`folder-i18n`,".lambda":`folder-functions`,".lambdas":`folder-functions`,".landing":`folder-home`,".lang":`folder-i18n`,".langs":`folder-i18n`,".language":`folder-i18n`,".languages":`folder-i18n`,".layout":`folder-layout`,".layouts":`folder-layout`,".lefthook":`folder-lefthook`,".lefthook-local":`folder-lefthook`,".less":`folder-less`,".lib":`folder-lib`,".lib64":`folder-lib`,".libraries":`folder-lib`,".library":`folder-lib`,".libs":`folder-lib`,".license":`folder-license`,".licenses":`folder-license`,".link":`folder-link`,".links":`folder-link`,".linux":`folder-linux`,".linuxbsd":`folder-linux`,".liquibase":`folder-liquibase`,".locale":`folder-i18n`,".locales":`folder-i18n`,".localization":`folder-i18n`,".log":`folder-log`,".logging":`folder-log`,".logic":`folder-functions`,".logs":`folder-log`,".lottie":`folder-lottie`,".lottiefiles":`folder-lottie`,".lotties":`folder-lottie`,".lua":`folder-lua`,".luau":`folder-luau`,".mac":`folder-macos`,".macbook":`folder-macos`,".macbook-air":`folder-macos`,".macos":`folder-macos`,".macosx":`folder-macos`,".mail":`folder-mail`,".mailers":`folder-mail`,".mails":`folder-mail`,".main":`folder-home`,".manager":`folder-admin`,".managers":`folder-admin`,".mapping":`folder-mappings`,".mappings":`folder-mappings`,".markdown":`folder-markdown`,".math":`folder-functions`,".maths":`folder-functions`,".md":`folder-markdown`,".measure":`folder-benchmark`,".measurement":`folder-benchmark`,".measures":`folder-benchmark`,".media":`folder-video`,".messages":`folder-messages`,".messaging":`folder-messages`,".meta":`folder-meta`,".meta-inf":`folder-config`,".metadata":`folder-meta`,".metro":`folder-metro`,".middleware":`folder-middleware`,".middlewares":`folder-middleware`,".migration":`folder-migrations`,".migrations":`folder-migrations`,".mint":`folder-linux`,".misc":`folder-other`,".miscellaneous":`folder-other`,".mjml":`folder-mjml`,".mjs":`folder-javascript`,".mobile":`folder-mobile`,".mobiles":`folder-mobile`,".mock":`folder-mock`,".mocks":`folder-mock`,".mod":`folder-plugin`,".modding":`folder-plugin`,".model":`folder-class`,".models":`folder-class`,".moderator":`folder-admin`,".moderators":`folder-admin`,".mods":`folder-plugin`,".module":`folder-plugin`,".modules":`folder-plugin`,".mojo":`folder-mojo`,".molecule":`folder-molecule`,".molecules":`folder-molecule`,".moon":`folder-moon`,".motion":`folder-animation`,".motions":`folder-animation`,".movie":`folder-video`,".movies":`folder-video`,".mq":`folder-queue`,".mts":`folder-typescript`,".music":`folder-audio`,".navigation":`folder-routes`,".navigations":`folder-routes`,".netlify":`folder-netlify`,".news":`folder-docs`,".next":`folder-next`,".nginx":`folder-nginx`,".node":`folder-node`,".node_modules":`folder-node`,".nodejs":`folder-node`,".note":`folder-docs`,".notebook":`folder-jupyter`,".notebooks":`folder-jupyter`,".notes":`folder-docs`,".now":`folder-vercel`,".nuxt":`folder-nuxt`,".nyc-output":`folder-coverage`,".nyc_output":`folder-coverage`,".obsidian":`folder-obsidian`,".opencode":`folder-opencode`,".option":`folder-config`,".options":`folder-config`,".organism":`folder-organism`,".organisms":`folder-organism`,".osx":`folder-macos`,".other":`folder-other`,".others":`folder-other`,".out":`folder-dist`,".output":`folder-dist`,".outputs":`folder-dist`,".package":`folder-packages`,".packages":`folder-packages`,".pact":`folder-contract`,".pacts":`folder-contract`,".page":`folder-views`,".pages":`folder-views`,".palette":`folder-theme`,".palettes":`folder-theme`,".partial":`folder-include`,".partials":`folder-include`,".patches":`folder-git`,".pdf":`folder-pdf`,".pdfs":`folder-pdf`,".pdm-build":`folder-pdm`,".pdm-plugins":`folder-pdm`,".perf":`folder-benchmark`,".performance":`folder-benchmark`,".phone":`folder-mobile`,".phones":`folder-mobile`,".photo":`folder-images`,".photograph":`folder-images`,".photographs":`folder-images`,".photos":`folder-images`,".php":`folder-php`,".phpmailer":`folder-phpmailer`,".pic":`folder-images`,".pics":`folder-images`,".picture":`folder-images`,".pictures":`folder-images`,".pipe":`folder-pipe`,".pipeline":`folder-pipe`,".pipelines":`folder-pipe`,".pipes":`folder-pipe`,".pkg":`folder-packages`,".pkgs":`folder-packages`,".plastic":`folder-plastic`,".playground":`folder-sandbox`,".playgrounds":`folder-sandbox`,".playlist":`folder-audio`,".playlists":`folder-audio`,".plugin":`folder-plugin`,".plugins":`folder-plugin`,".policies":`folder-policy`,".policy":`folder-policy`,".popos":`folder-linux`,".portability":`folder-mobile`,".portable":`folder-mobile`,".post":`folder-docs`,".postman":`folder-postman`,".posts":`folder-docs`,".powershell":`folder-powershell`,".pref":`folder-config`,".preference":`folder-config`,".preferences":`folder-config`,".prefs":`folder-config`,".presentation":`folder-ui`,".preview":`folder-review`,".previews":`folder-review`,".prisma":`folder-prisma`,".prisma/schema":`folder-prisma`,".private":`folder-private`,".profiling":`folder-benchmark`,".proj":`folder-project`,".project":`folder-project`,".projects":`folder-project`,".projs":`folder-project`,".prompt":`folder-prompts`,".prompts":`folder-prompts`,".properties":`folder-config`,".props":`folder-config`,".proto":`folder-proto`,".protobuf":`folder-proto`,".protobufs":`folder-proto`,".protos":`folder-proto`,".provider":`folder-controller`,".providers":`folder-controller`,".proxy":`folder-public`,".ps":`folder-powershell`,".ps1":`folder-powershell`,".ps4":`folder-console`,".ps5":`folder-console`,".public":`folder-public`,".public_html":`folder-views`,".pwa":`folder-client`,".pycache":`folder-python`,".pytest_cache":`folder-python`,".python":`folder-python`,".pytorch":`folder-pytorch`,".quasar":`folder-quasar`,".queue":`folder-queue`,".queues":`folder-queue`,".r":`folder-r`,".recordings":`folder-audio`,".release":`folder-dist`,".remote":`folder-connection`,".remotes":`folder-connection`,".repo":`folder-repository`,".report":`folder-resource`,".reports":`folder-resource`,".repos":`folder-repository`,".repositories":`folder-repository`,".repository":`folder-repository`,".res":`folder-resource`,".resolver":`folder-resolver`,".resolvers":`folder-resolver`,".resource":`folder-resource`,".resources":`folder-resource`,".restapi":`folder-api`,".review":`folder-review`,".reviewed":`folder-review`,".reviews":`folder-review`,".revisal":`folder-review`,".revisals":`folder-review`,".robot":`folder-robot`,".robots":`folder-robot`,".router":`folder-routes`,".routers":`folder-routes`,".routes":`folder-routes`,".routing":`folder-routes`,".rule":`folder-rules`,".rules":`folder-rules`,".rust":`folder-rust`,".salt":`folder-salt`,".saltstack":`folder-salt`,".sample":`folder-examples`,".sample-data":`folder-examples`,".samples":`folder-examples`,".sandbox":`folder-sandbox`,".sandboxes":`folder-sandbox`,".sass":`folder-sass`,".scala":`folder-scala`,".schema":`folder-class`,".schemas":`folder-class`,".sconf_temp":`folder-scons`,".scons":`folder-scons`,".scons_cache":`folder-scons`,".screen":`folder-views`,".screengrab":`folder-images`,".screengrabs":`folder-images`,".screens":`folder-views`,".screenshot":`folder-images`,".screenshots":`folder-images`,".script":`folder-scripts`,".scripting":`folder-scripts`,".scripts":`folder-scripts`,".scss":`folder-sass`,".secret":`folder-keys`,".secrets":`folder-keys`,".secure":`folder-secure`,".security":`folder-secure`,".seed":`folder-seeders`,".seeders":`folder-seeders`,".seeding":`folder-seeders`,".seeds":`folder-seeders`,".server":`folder-server`,".serverless":`folder-serverless`,".serverpackages":`folder-packages`,".servers":`folder-server`,".service":`folder-controller`,".services":`folder-controller`,".setting":`folder-config`,".settings":`folder-config`,".shader":`folder-shader`,".shaders":`folder-shader`,".shared":`folder-shared`,".shop":`folder-cart`,".shopping":`folder-cart`,".shopping-cart":`folder-cart`,".sim":`folder-simulations`,".sims":`folder-simulations`,".simulation":`folder-simulations`,".simulations":`folder-simulations`,".site":`folder-public`,".sketch":`folder-mock`,".sketches":`folder-mock`,".skill":`folder-skills`,".skills":`folder-skills`,".smtp":`folder-mail`,".snap":`folder-snapcraft`,".snapcraft":`folder-snapcraft`,".snapshots":`folder-test`,".snippet":`folder-snippet`,".snippets":`folder-snippet`,".song":`folder-audio`,".songs":`folder-audio`,".sound":`folder-audio`,".sounds":`folder-audio`,".source":`folder-src`,".sources":`folder-src`,".spa":`folder-client`,".spec":`folder-test`,".specs":`folder-test`,".spellcheck":`folder-syntax`,".spellcheckers":`folder-syntax`,".sql":`folder-database`,".src":`folder-src`,".src-tauri":`folder-src-tauri`,".srcs":`folder-src`,".ssl":`folder-secure`,".stack":`folder-stack`,".stacks":`folder-stack`,".start":`folder-home`,".static":`folder-resource`,".stencil":`folder-stencil`,".store":`folder-store`,".stores":`folder-store`,".stories":`folder-storybook`,".storybook":`folder-storybook`,".style":`folder-css`,".styles":`folder-css`,".stylesheet":`folder-css`,".stylesheets":`folder-css`,".stylus":`folder-stylus`,".sublime":`folder-sublime`,".submodules":`folder-git`,".supabase":`folder-supabase`,".svelte":`folder-svelte`,".svelte-kit":`folder-svelte`,".svg":`folder-svg`,".svgs":`folder-svg`,".switch":`folder-console`,".syntax":`folder-syntax`,".syntaxes":`folder-syntax`,".table-of-contents":`folder-toc`,".target":`folder-target`,".taskfile":`folder-taskfile`,".taskfiles":`folder-taskfile`,".tasks":`folder-tasks`,".television":`folder-television`,".temp":`folder-temp`,".template":`folder-template`,".templates":`folder-template`,".terraform":`folder-terraform`,".test":`folder-test`,".testfiles":`folder-test`,".testing":`folder-test`,".tests":`folder-test`,".texture":`folder-images`,".textures":`folder-images`,".theme":`folder-theme`,".themes":`folder-theme`,".third-party":`folder-lib`,".thirdparty":`folder-lib`,".tickets":`folder-tasks`,".tls":`folder-secure`,".tmp":`folder-temp`,".toc":`folder-toc`,".token":`folder-keys`,".tokens":`folder-keys`,".toolbox":`folder-tools`,".toolboxes":`folder-tools`,".tooling":`folder-tools`,".toolkit":`folder-tools`,".toolkits":`folder-tools`,".tools":`folder-tools`,".torch":`folder-pytorch`,".transition":`folder-animation`,".transitions":`folder-animation`,".translate":`folder-i18n`,".translation":`folder-i18n`,".translations":`folder-i18n`,".trash":`folder-trash`,".trigger":`folder-trigger`,".triggers":`folder-trigger`,".ts":`folder-typescript`,".turbo":`folder-turborepo`,".tv":`folder-television`,".tx":`folder-i18n`,".typeface":`folder-font`,".typefaces":`folder-font`,".types":`folder-typescript`,".typescript":`folder-typescript`,".typings":`folder-typescript`,".ubuntu":`folder-linux`,".ui":`folder-ui`,".unity":`folder-unity`,".unix":`folder-linux`,".update":`folder-update`,".updates":`folder-update`,".upgrade":`folder-update`,".upgrades":`folder-update`,".upload":`folder-upload`,".uploads":`folder-upload`,".util":`folder-utils`,".utilities":`folder-utils`,".utility":`folder-utils`,".utils":`folder-utils`,".ux":`folder-ui`,".validation":`folder-rules`,".validations":`folder-rules`,".validator":`folder-rules`,".validators":`folder-rules`,".vector":`folder-svg`,".vectors":`folder-svg`,".vendor":`folder-lib`,".vendors":`folder-lib`,".venv":`folder-environment`,".vercel":`folder-vercel`,".verdaccio":`folder-verdaccio`,".vid":`folder-video`,".video":`folder-video`,".videos":`folder-video`,".vids":`folder-video`,".view":`folder-views`,".views":`folder-views`,".vm":`folder-vm`,".vms":`folder-vm`,".voice":`folder-audio`,".voices":`folder-audio`,".vscode":`folder-vscode`,".vscode-test":`folder-vscode`,".vue":`folder-vue`,".vuepress":`folder-vuepress`,".wakatime":`folder-wakatime`,".web":`folder-public`,".webpack":`folder-webpack`,".website":`folder-public`,".websites":`folder-public`,".widget":`folder-components`,".widgets":`folder-components`,".wiki":`folder-docs`,".win":`folder-windows`,".win10":`folder-windows`,".win11":`folder-windows`,".win32":`folder-windows`,".windows":`folder-windows`,".windows10":`folder-windows`,".windows11":`folder-windows`,".windowsnt":`folder-windows`,".windowsxp":`folder-windows`,".winnt":`folder-windows`,".winxp":`folder-windows`,".wordpress-org":`folder-wordpress`,".wp-content":`folder-wordpress`,".wsl":`folder-linux`,".www":`folder-public`,".wwwroot":`folder-public`,".xbox":`folder-console`,".xtask":`folder-scripts`,".yarn":`folder-yarn`,".zeabur":`folder-zeabur`,".zed":`folder-zed`,"@types":`folder-typescript`,"_@types":`folder-typescript`,"__@types__":`folder-typescript`,__addin__:`folder-plugin`,__addins__:`folder-plugin`,__addon__:`folder-plugin`,__addons__:`folder-plugin`,__admin__:`folder-admin`,__admins__:`folder-admin`,__agent__:`folder-robot`,__agents__:`folder-robot`,__android__:`folder-android`,__angular__:`folder-angular`,__anim__:`folder-animation`,__animated__:`folder-animation`,__animation__:`folder-animation`,__animations__:`folder-animation`,__anims__:`folder-animation`,__ansible__:`folder-ansible`,__api__:`folder-api`,__apis__:`folder-api`,"__apollo-cache__":`folder-apollo`,"__apollo-client__":`folder-apollo`,"__apollo-config__":`folder-apollo`,__apollo__:`folder-apollo`,__app__:`folder-app`,__apple__:`folder-macos`,__application__:`folder-app`,__applications__:`folder-app`,__apps__:`folder-app`,__appwrite__:`folder-appwrite`,__arc__:`folder-archive`,__archival__:`folder-archive`,__archive__:`folder-archive`,__archives__:`folder-archive`,__arcs__:`folder-archive`,__article__:`folder-docs`,__articles__:`folder-docs`,__asm__:`folder-assembly`,__assembly__:`folder-assembly`,__asset__:`folder-resource`,__assets__:`folder-resource`,__astro__:`folder-astro`,__atom__:`folder-atom`,__atoms__:`folder-atom`,__attachment__:`folder-attachment`,__attachments__:`folder-attachment`,__aud__:`folder-audio`,__audio__:`folder-audio`,__audios__:`folder-audio`,__auds__:`folder-audio`,__aurelia_project__:`folder-aurelia`,__auth__:`folder-secure`,__authentication__:`folder-secure`,__auto__:`folder-generator`,__aws__:`folder-aws`,"__azure-pipelines-ci__":`folder-azure-pipelines`,"__azure-pipelines__":`folder-azure-pipelines`,__azure__:`folder-aws`,"__back-up__":`folder-backup`,"__back-ups__":`folder-backup`,__backend__:`folder-server`,__backends__:`folder-server`,__backup__:`folder-backup`,__backups__:`folder-backup`,__bak__:`folder-backup`,__baks__:`folder-backup`,__base__:`folder-base`,__bases__:`folder-base`,__batch__:`folder-batch`,__batches__:`folder-batch`,__batchs__:`folder-batch`,__bench__:`folder-benchmark`,__benches__:`folder-benchmark`,__benchmark__:`folder-benchmark`,__benchmarks__:`folder-benchmark`,__bibliographies__:`folder-bibliography`,__bibliography__:`folder-bibliography`,__bicep__:`folder-bicep`,__bin__:`folder-dist`,__bkp__:`folder-backup`,__bkps__:`folder-backup`,"__blender-assets__":`folder-blender`,"__blender-files__":`folder-blender`,"__blender-models__":`folder-blender`,"__blender-project__":`folder-blender`,__blender__:`folder-blender`,__bloc__:`folder-bloc`,__blocs__:`folder-bloc`,__blog__:`folder-docs`,__book__:`folder-bibliography`,__books__:`folder-bibliography`,__bot__:`folder-robot`,__bots__:`folder-robot`,__bower_components__:`folder-bower`,__browser__:`folder-public`,__browsers__:`folder-public`,__build__:`folder-dist`,__buildkite__:`folder-buildkite`,__builds__:`folder-dist`,__built__:`folder-dist`,__bull__:`folder-queue`,__cache__:`folder-temp`,__cached__:`folder-temp`,__calc__:`folder-functions`,__calcs__:`folder-functions`,__calculation__:`folder-functions`,__calculations__:`folder-functions`,__cargo__:`folder-rust`,__cart__:`folder-cart`,__centos__:`folder-linux`,__cert__:`folder-secure`,__certificate__:`folder-secure`,__certificates__:`folder-secure`,__certs__:`folder-secure`,__cfg__:`folder-config`,__cfgs__:`folder-config`,"__cfn-gen__":`folder-generator`,__changes__:`folder-delta`,__changeset__:`folder-changesets`,__changesets__:`folder-changesets`,__chat__:`folder-messages`,__chats__:`folder-messages`,__ci__:`folder-ci`,__cipher__:`folder-secure`,__circleci__:`folder-circleci`,__cjs__:`folder-javascript`,__class__:`folder-class`,__classes__:`folder-class`,__claude__:`folder-claude`,__cli__:`folder-command`,__client__:`folder-client`,__clients__:`folder-client`,__cline_docs__:`folder-cline`,__clis__:`folder-command`,"__cloud-firestore__":`folder-firestore`,"__cloud-functions__":`folder-cloud-functions`,__cloudflare__:`folder-cloudflare`,__cloudfunctions__:`folder-cloud-functions`,__cluster__:`folder-cluster`,__clusters__:`folder-cluster`,__cmd__:`folder-command`,__cobol__:`folder-cobol`,__code__:`folder-src`,__color__:`folder-theme`,__colors__:`folder-theme`,__colour__:`folder-theme`,__colours__:`folder-theme`,__command__:`folder-command`,__commandline__:`folder-command`,__commands__:`folder-command`,__common__:`folder-shared`,__compiled__:`folder-dist`,__components__:`folder-components`,__composable__:`folder-functions`,__composables__:`folder-functions`,__concept__:`folder-mock`,__concepts__:`folder-mock`,__conf__:`folder-config`,__config__:`folder-config`,__configs__:`folder-config`,__configuration__:`folder-config`,__configurations__:`folder-config`,__confs__:`folder-config`,__connection__:`folder-connection`,__connections__:`folder-connection`,__console__:`folder-console`,__const__:`folder-constant`,__constant__:`folder-constant`,__constants__:`folder-constant`,__consts__:`folder-constant`,__container__:`folder-container`,__containers__:`folder-container`,__content__:`folder-content`,__contents__:`folder-content`,__context__:`folder-context`,__contexts__:`folder-context`,"__contract-test__":`folder-contract`,"__contract-testing__":`folder-contract`,"__contract-tests__":`folder-contract`,__contract__:`folder-contract`,__contracts__:`folder-contract`,__controller__:`folder-controller`,__controllers__:`folder-controller`,__controls__:`folder-controller`,__conversation__:`folder-messages`,__conversations__:`folder-messages`,__core__:`folder-core`,__coverage__:`folder-coverage`,__crash__:`folder-error`,__crashes__:`folder-error`,__crates__:`folder-lib`,__css__:`folder-css`,__cts__:`folder-typescript`,__cubit__:`folder-bloc`,__cubits__:`folder-bloc`,__cue__:`folder-cue`,__cues__:`folder-cue`,__cursor__:`folder-cursor`,__custom__:`folder-custom`,__customs__:`folder-custom`,__cypher__:`folder-secure`,__cypress__:`folder-cypress`,__dal__:`folder-dal`,__dart__:`folder-dart`,__dart_tool__:`folder-dart`,__dart_tools__:`folder-dart`,"__data-access-layer__":`folder-dal`,"__data-access__":`folder-dal`,__data__:`folder-database`,__database__:`folder-database`,__databases__:`folder-database`,__db__:`folder-database`,__deb__:`folder-linux`,__debian__:`folder-linux`,__debug__:`folder-debug`,__debugger__:`folder-debug`,__debugging__:`folder-debug`,__decorator__:`folder-decorators`,__decorators__:`folder-decorators`,__deepin__:`folder-linux`,__delta__:`folder-delta`,__deltas__:`folder-delta`,__demo__:`folder-examples`,__demos__:`folder-examples`,__dependencies__:`folder-packages`,__design__:`folder-theme`,__designs__:`folder-theme`,__desktop__:`folder-desktop`,__devcontainer__:`folder-container`,__devpackages__:`folder-packages`,__devtools__:`folder-tools`,__dialog__:`folder-messages`,__dialogs__:`folder-messages`,__diary__:`folder-docs`,__directive__:`folder-directive`,__directives__:`folder-directive`,__display__:`folder-desktop`,__dist__:`folder-dist`,__distribution__:`folder-dist`,__doc__:`folder-docs`,__docker__:`folder-docker`,__dockerfiles__:`folder-docker`,__dockerhub__:`folder-docker`,__docs__:`folder-docs`,__document__:`folder-docs`,__documentation__:`folder-docs`,__documents__:`folder-docs`,__download__:`folder-download`,__downloader__:`folder-download`,__downloaders__:`folder-download`,__downloads__:`folder-download`,__draft__:`folder-mock`,__drafts__:`folder-mock`,__drizzle__:`folder-drizzle`,__ds_store__:`folder-macos`,__dump__:`folder-dump`,__dumps__:`folder-dump`,__e2e__:`folder-coverage`,__easing__:`folder-animation`,__easings__:`folder-animation`,__element__:`folder-element`,__elements__:`folder-element`,__email__:`folder-mail`,__emails__:`folder-mail`,__enum__:`folder-enum`,__enums__:`folder-enum`,__env__:`folder-environment`,__environment__:`folder-environment`,__environments__:`folder-environment`,__envs__:`folder-environment`,__err__:`folder-error`,__error__:`folder-error`,__errors__:`folder-error`,__errs__:`folder-error`,"__eslint-config__":`folder-eslint`,"__eslint-configs__":`folder-eslint`,"__eslint-plugin__":`folder-eslint`,"__eslint-plugins__":`folder-eslint`,__eslint__:`folder-eslint`,__etc__:`folder-other`,__event__:`folder-event`,__events__:`folder-event`,__example__:`folder-examples`,__examples__:`folder-examples`,"__expo-shared__":`folder-expo`,__expo__:`folder-expo`,__export__:`folder-export`,__exported__:`folder-export`,__exports__:`folder-export`,__extension__:`folder-plugin`,__extensions__:`folder-plugin`,__external__:`folder-lib`,__externals__:`folder-lib`,__extra__:`folder-other`,__extras__:`folder-other`,__fastlane__:`folder-fastlane`,__favicon__:`folder-favicon`,__favicons__:`folder-favicon`,__feat__:`folder-features`,__feats__:`folder-features`,__feature__:`folder-features`,__features__:`folder-features`,__fig__:`folder-images`,__figs__:`folder-images`,__figure__:`folder-images`,__figures__:`folder-images`,__filter__:`folder-filter`,__filters__:`folder-filter`,"__firebase-cloud-functions__":`folder-cloud-functions`,"__firebase-cloudfunctions__":`folder-cloud-functions`,"__firebase-firestore__":`folder-firestore`,__firebase__:`folder-firebase`,__firestore__:`folder-firestore`,__fixture__:`folder-mock`,__fixtures__:`folder-mock`,"__flow-typed__":`folder-flow`,__flutter__:`folder-flutter`,__font__:`folder-font`,__fonts__:`folder-font`,__forgejo__:`folder-forgejo`,__form__:`folder-form`,__forms__:`folder-form`,__forum__:`folder-messages`,__fragments__:`folder-components`,__frontend__:`folder-client`,__frontends__:`folder-client`,__func__:`folder-functions`,__funcs__:`folder-functions`,__function__:`folder-functions`,__functions__:`folder-functions`,__game__:`folder-console`,__gamemaker2__:`folder-gamemaker`,__gamemaker__:`folder-gamemaker`,__games__:`folder-console`,__gcp__:`folder-aws`,"__gemini-ai__":`folder-gemini-ai`,__gemini__:`folder-gemini-ai`,__geminiai__:`folder-gemini-ai`,__gen__:`folder-generator`,__generated__:`folder-generator`,__generator__:`folder-generator`,__generators__:`folder-generator`,__gens__:`folder-generator`,__git__:`folder-git`,__gitea__:`folder-gitea`,__githooks__:`folder-git`,"__github/issue_template__":`folder-template`,"__github/pull_request_template__":`folder-template`,"__github/workflows__":`folder-gh-workflows`,__github__:`folder-github`,__gitlab__:`folder-gitlab`,__global__:`folder-global`,__glsl__:`folder-shader`,__go__:`folder-go`,"__godot-cpp__":`folder-godot`,__godot__:`folder-godot`,__golang__:`folder-go`,__gql__:`folder-graphql`,__gradle__:`folder-gradle`,__graphql__:`folder-graphql`,__guard__:`folder-guard`,__guards__:`folder-guard`,__gui__:`folder-ui`,"__gulp-tasks__":`folder-gulp`,__gulp__:`folder-gulp`,"__gulpfile.babel.js__":`folder-gulp`,"__gulpfile.js__":`folder-gulp`,"__gulpfile.mjs__":`folder-gulp`,"__gulpfile.ts__":`folder-gulp`,__gulpfiles__:`folder-gulp`,__handler__:`folder-controller`,__handlers__:`folder-controller`,__helm__:`folder-helm`,__helmchart__:`folder-helm`,__helmcharts__:`folder-helm`,__helper__:`folder-helper`,__helpers__:`folder-helper`,__hg__:`folder-mercurial`,__hgext__:`folder-mercurial`,__hghooks__:`folder-mercurial`,__histories__:`folder-backup`,__history__:`folder-backup`,__hlsl__:`folder-shader`,__home__:`folder-home`,__hook__:`folder-hook`,__hooks__:`folder-hook`,__html__:`folder-views`,__husky__:`folder-husky`,__i18n__:`folder-i18n`,__ico__:`folder-images`,__icon__:`folder-images`,__icons__:`folder-images`,__icos__:`folder-images`,__idea__:`folder-intellij`,__image__:`folder-images`,__images__:`folder-images`,__img__:`folder-images`,__imgs__:`folder-images`,__import__:`folder-import`,__imported__:`folder-import`,__imports__:`folder-import`,__in__:`folder-input`,__inc64__:`folder-include`,__inc__:`folder-include`,__include__:`folder-include`,__includes__:`folder-include`,__infra__:`folder-server`,__infrastructure__:`folder-server`,__input__:`folder-input`,__inputs__:`folder-input`,"__integration-test__":`folder-coverage`,"__integration-tests__":`folder-coverage`,__integration__:`folder-connection`,__integrations__:`folder-connection`,__interceptor__:`folder-interceptor`,__interceptors__:`folder-interceptor`,__interface__:`folder-interface`,__interfaces__:`folder-interface`,__internationalization__:`folder-i18n`,__inventories__:`folder-server`,__inventory__:`folder-server`,__io__:`folder-input`,__ios__:`folder-ios`,__ipad__:`folder-macos`,__iphone__:`folder-macos`,__ipod__:`folder-macos`,__ipynb__:`folder-jupyter`,__it__:`folder-coverage`,__j2__:`folder-jinja`,__java__:`folder-java`,__javascript__:`folder-javascript`,__javascripts__:`folder-javascript`,__jinja2__:`folder-jinja`,__jinja__:`folder-jinja`,__job__:`folder-job`,__jobs__:`folder-job`,__js__:`folder-javascript`,__json__:`folder-json`,__jsonc__:`folder-json`,__jsonl__:`folder-json`,__jsons__:`folder-json`,__jupyter__:`folder-jupyter`,__jwt__:`folder-keys`,__k8s__:`folder-kubernetes`,__key__:`folder-keys`,__keys__:`folder-keys`,__kit__:`folder-tools`,__kits__:`folder-tools`,__knowledge__:`folder-docs`,__kotlin__:`folder-kotlin`,__kql__:`folder-kusto`,__kubernetes__:`folder-kubernetes`,__kusto__:`folder-kusto`,__l10n__:`folder-i18n`,__lambda__:`folder-functions`,__lambdas__:`folder-functions`,__landing__:`folder-home`,__lang__:`folder-i18n`,__langs__:`folder-i18n`,__language__:`folder-i18n`,__languages__:`folder-i18n`,__layout__:`folder-layout`,__layouts__:`folder-layout`,"__lefthook-local__":`folder-lefthook`,__lefthook__:`folder-lefthook`,__less__:`folder-less`,__lib64__:`folder-lib`,__lib__:`folder-lib`,__libraries__:`folder-lib`,__library__:`folder-lib`,__libs__:`folder-lib`,__license__:`folder-license`,__licenses__:`folder-license`,__link__:`folder-link`,__links__:`folder-link`,__linux__:`folder-linux`,__linuxbsd__:`folder-linux`,__liquibase__:`folder-liquibase`,__locale__:`folder-i18n`,__locales__:`folder-i18n`,__localization__:`folder-i18n`,__log__:`folder-log`,__logging__:`folder-log`,__logic__:`folder-functions`,__logs__:`folder-log`,__lottie__:`folder-lottie`,__lottiefiles__:`folder-lottie`,__lotties__:`folder-lottie`,__lua__:`folder-lua`,__luau__:`folder-luau`,__mac__:`folder-macos`,"__macbook-air__":`folder-macos`,__macbook__:`folder-macos`,__macos__:`folder-macos`,__macosx__:`folder-macos`,__mail__:`folder-mail`,__mailers__:`folder-mail`,__mails__:`folder-mail`,__main__:`folder-home`,__manager__:`folder-admin`,__managers__:`folder-admin`,__mapping__:`folder-mappings`,__mappings__:`folder-mappings`,__markdown__:`folder-markdown`,__math__:`folder-functions`,__maths__:`folder-functions`,__md__:`folder-markdown`,__measure__:`folder-benchmark`,__measurement__:`folder-benchmark`,__measures__:`folder-benchmark`,__media__:`folder-video`,__messages__:`folder-messages`,__messaging__:`folder-messages`,"__meta-inf__":`folder-config`,__meta__:`folder-meta`,__metadata__:`folder-meta`,__metro__:`folder-metro`,__middleware__:`folder-middleware`,__middlewares__:`folder-middleware`,__migration__:`folder-migrations`,__migrations__:`folder-migrations`,__mint__:`folder-linux`,__misc__:`folder-other`,__miscellaneous__:`folder-other`,__mjml__:`folder-mjml`,__mjs__:`folder-javascript`,__mobile__:`folder-mobile`,__mobiles__:`folder-mobile`,__mock__:`folder-mock`,__mocks__:`folder-mock`,__mod__:`folder-plugin`,__modding__:`folder-plugin`,__model__:`folder-class`,__models__:`folder-class`,__moderator__:`folder-admin`,__moderators__:`folder-admin`,__mods__:`folder-plugin`,__module__:`folder-plugin`,__modules__:`folder-plugin`,__mojo__:`folder-mojo`,__molecule__:`folder-molecule`,__molecules__:`folder-molecule`,__moon__:`folder-moon`,__motion__:`folder-animation`,__motions__:`folder-animation`,__movie__:`folder-video`,__movies__:`folder-video`,__mq__:`folder-queue`,__mts__:`folder-typescript`,__music__:`folder-audio`,__navigation__:`folder-routes`,__navigations__:`folder-routes`,__netlify__:`folder-netlify`,__news__:`folder-docs`,__next__:`folder-next`,__nginx__:`folder-nginx`,__node__:`folder-node`,__node_modules__:`folder-node`,__nodejs__:`folder-node`,__note__:`folder-docs`,__notebook__:`folder-jupyter`,__notebooks__:`folder-jupyter`,__notes__:`folder-docs`,__now__:`folder-vercel`,__nuxt__:`folder-nuxt`,"__nyc-output__":`folder-coverage`,__nyc_output__:`folder-coverage`,__obsidian__:`folder-obsidian`,__opencode__:`folder-opencode`,__option__:`folder-config`,__options__:`folder-config`,__organism__:`folder-organism`,__organisms__:`folder-organism`,__osx__:`folder-macos`,__other__:`folder-other`,__others__:`folder-other`,__out__:`folder-dist`,__output__:`folder-dist`,__outputs__:`folder-dist`,__package__:`folder-packages`,__packages__:`folder-packages`,__pact__:`folder-contract`,__pacts__:`folder-contract`,__page__:`folder-views`,__pages__:`folder-views`,__palette__:`folder-theme`,__palettes__:`folder-theme`,__partial__:`folder-include`,__partials__:`folder-include`,__patches__:`folder-git`,__pdf__:`folder-pdf`,__pdfs__:`folder-pdf`,"__pdm-build__":`folder-pdm`,"__pdm-plugins__":`folder-pdm`,__perf__:`folder-benchmark`,__performance__:`folder-benchmark`,__phone__:`folder-mobile`,__phones__:`folder-mobile`,__photo__:`folder-images`,__photograph__:`folder-images`,__photographs__:`folder-images`,__photos__:`folder-images`,__php__:`folder-php`,__phpmailer__:`folder-phpmailer`,__pic__:`folder-images`,__pics__:`folder-images`,__picture__:`folder-images`,__pictures__:`folder-images`,__pipe__:`folder-pipe`,__pipeline__:`folder-pipe`,__pipelines__:`folder-pipe`,__pipes__:`folder-pipe`,__pkg__:`folder-packages`,__pkgs__:`folder-packages`,__plastic__:`folder-plastic`,__playground__:`folder-sandbox`,__playgrounds__:`folder-sandbox`,__playlist__:`folder-audio`,__playlists__:`folder-audio`,__plugin__:`folder-plugin`,__plugins__:`folder-plugin`,__policies__:`folder-policy`,__policy__:`folder-policy`,__popos__:`folder-linux`,__portability__:`folder-mobile`,__portable__:`folder-mobile`,__post__:`folder-docs`,__postman__:`folder-postman`,__posts__:`folder-docs`,__powershell__:`folder-powershell`,__pref__:`folder-config`,__preference__:`folder-config`,__preferences__:`folder-config`,__prefs__:`folder-config`,__presentation__:`folder-ui`,__preview__:`folder-review`,__previews__:`folder-review`,"__prisma/schema__":`folder-prisma`,__prisma__:`folder-prisma`,__private__:`folder-private`,__profiling__:`folder-benchmark`,__proj__:`folder-project`,__project__:`folder-project`,__projects__:`folder-project`,__projs__:`folder-project`,__prompt__:`folder-prompts`,__prompts__:`folder-prompts`,__properties__:`folder-config`,__props__:`folder-config`,__protobuf__:`folder-proto`,__protobufs__:`folder-proto`,__protos__:`folder-proto`,__provider__:`folder-controller`,__providers__:`folder-controller`,__proxy__:`folder-public`,__ps1__:`folder-powershell`,__ps4__:`folder-console`,__ps5__:`folder-console`,__ps__:`folder-powershell`,__public__:`folder-public`,__public_html__:`folder-views`,__pwa__:`folder-client`,__pycache__:`folder-python`,__pytest_cache__:`folder-python`,__python__:`folder-python`,__pytorch__:`folder-pytorch`,__quasar__:`folder-quasar`,__queue__:`folder-queue`,__queues__:`folder-queue`,__r__:`folder-r`,__recordings__:`folder-audio`,__release__:`folder-dist`,__remote__:`folder-connection`,__remotes__:`folder-connection`,__repo__:`folder-repository`,__report__:`folder-resource`,__reports__:`folder-resource`,__repos__:`folder-repository`,__repositories__:`folder-repository`,__repository__:`folder-repository`,__res__:`folder-resource`,__resolver__:`folder-resolver`,__resolvers__:`folder-resolver`,__resource__:`folder-resource`,__resources__:`folder-resource`,__restapi__:`folder-api`,__review__:`folder-review`,__reviewed__:`folder-review`,__reviews__:`folder-review`,__revisal__:`folder-review`,__revisals__:`folder-review`,__robot__:`folder-robot`,__robots__:`folder-robot`,__router__:`folder-routes`,__routers__:`folder-routes`,__routes__:`folder-routes`,__routing__:`folder-routes`,__rule__:`folder-rules`,__rules__:`folder-rules`,__rust__:`folder-rust`,__salt__:`folder-salt`,__saltstack__:`folder-salt`,"__sample-data__":`folder-examples`,__sample__:`folder-examples`,__samples__:`folder-examples`,__sandbox__:`folder-sandbox`,__sandboxes__:`folder-sandbox`,__sass__:`folder-sass`,__scala__:`folder-scala`,__schema__:`folder-class`,__schemas__:`folder-class`,__sconf_temp__:`folder-scons`,__scons__:`folder-scons`,__scons_cache__:`folder-scons`,__screen__:`folder-views`,__screengrab__:`folder-images`,__screengrabs__:`folder-images`,__screens__:`folder-views`,__screenshot__:`folder-images`,__screenshots__:`folder-images`,__script__:`folder-scripts`,__scripting__:`folder-scripts`,__scripts__:`folder-scripts`,__scss__:`folder-sass`,__secret__:`folder-keys`,__secrets__:`folder-keys`,__secure__:`folder-secure`,__security__:`folder-secure`,__seed__:`folder-seeders`,__seeders__:`folder-seeders`,__seeding__:`folder-seeders`,__seeds__:`folder-seeders`,__server__:`folder-server`,__serverless__:`folder-serverless`,__serverpackages__:`folder-packages`,__servers__:`folder-server`,__service__:`folder-controller`,__services__:`folder-controller`,__setting__:`folder-config`,__settings__:`folder-config`,__shader__:`folder-shader`,__shaders__:`folder-shader`,__shared__:`folder-shared`,__shop__:`folder-cart`,"__shopping-cart__":`folder-cart`,__shopping__:`folder-cart`,__sim__:`folder-simulations`,__sims__:`folder-simulations`,__simulation__:`folder-simulations`,__simulations__:`folder-simulations`,__site__:`folder-public`,__sketch__:`folder-mock`,__sketches__:`folder-mock`,__skill__:`folder-skills`,__skills__:`folder-skills`,__smtp__:`folder-mail`,__snap__:`folder-snapcraft`,__snapcraft__:`folder-snapcraft`,__snapshots__:`folder-test`,__snippet__:`folder-snippet`,__snippets__:`folder-snippet`,__song__:`folder-audio`,__songs__:`folder-audio`,__sound__:`folder-audio`,__sounds__:`folder-audio`,__source__:`folder-src`,__sources__:`folder-src`,__spa__:`folder-client`,__spec__:`folder-test`,__specs__:`folder-test`,__spellcheck__:`folder-syntax`,__spellcheckers__:`folder-syntax`,__sql__:`folder-database`,"__src-tauri__":`folder-src-tauri`,__src__:`folder-src`,__srcs__:`folder-src`,__ssl__:`folder-secure`,__stack__:`folder-stack`,__stacks__:`folder-stack`,__start__:`folder-home`,__static__:`folder-resource`,__stencil__:`folder-stencil`,__store__:`folder-store`,__stores__:`folder-store`,__stories__:`folder-storybook`,__storybook__:`folder-storybook`,__style__:`folder-css`,__styles__:`folder-css`,__stylesheet__:`folder-css`,__stylesheets__:`folder-css`,__stylus__:`folder-stylus`,__sublime__:`folder-sublime`,__submodules__:`folder-git`,__supabase__:`folder-supabase`,"__svelte-kit__":`folder-svelte`,__svelte__:`folder-svelte`,__svg__:`folder-svg`,__svgs__:`folder-svg`,__switch__:`folder-console`,__syntax__:`folder-syntax`,__syntaxes__:`folder-syntax`,"__table-of-contents__":`folder-toc`,__target__:`folder-target`,__taskfile__:`folder-taskfile`,__taskfiles__:`folder-taskfile`,__tasks__:`folder-tasks`,__television__:`folder-television`,__temp__:`folder-temp`,__template__:`folder-template`,__templates__:`folder-template`,__terraform__:`folder-terraform`,__test__:`folder-test`,__testfiles__:`folder-test`,__testing__:`folder-test`,__tests__:`folder-test`,__texture__:`folder-images`,__textures__:`folder-images`,__theme__:`folder-theme`,__themes__:`folder-theme`,"__third-party__":`folder-lib`,__thirdparty__:`folder-lib`,__tickets__:`folder-tasks`,__tls__:`folder-secure`,__tmp__:`folder-temp`,__toc__:`folder-toc`,__token__:`folder-keys`,__tokens__:`folder-keys`,__toolbox__:`folder-tools`,__toolboxes__:`folder-tools`,__tooling__:`folder-tools`,__toolkit__:`folder-tools`,__toolkits__:`folder-tools`,__tools__:`folder-tools`,__torch__:`folder-pytorch`,__transition__:`folder-animation`,__transitions__:`folder-animation`,__translate__:`folder-i18n`,__translation__:`folder-i18n`,__translations__:`folder-i18n`,__trash__:`folder-trash`,__trigger__:`folder-trigger`,__triggers__:`folder-trigger`,__ts__:`folder-typescript`,__turbo__:`folder-turborepo`,__tv__:`folder-television`,__tx__:`folder-i18n`,__typeface__:`folder-font`,__typefaces__:`folder-font`,__types__:`folder-typescript`,__typescript__:`folder-typescript`,__typings__:`folder-typescript`,__ubuntu__:`folder-linux`,__ui__:`folder-ui`,__unity__:`folder-unity`,__unix__:`folder-linux`,__update__:`folder-update`,__updates__:`folder-update`,__upgrade__:`folder-update`,__upgrades__:`folder-update`,__upload__:`folder-upload`,__uploads__:`folder-upload`,__util__:`folder-utils`,__utilities__:`folder-utils`,__utility__:`folder-utils`,__utils__:`folder-utils`,__ux__:`folder-ui`,__validation__:`folder-rules`,__validations__:`folder-rules`,__validator__:`folder-rules`,__validators__:`folder-rules`,__vector__:`folder-svg`,__vectors__:`folder-svg`,__vendor__:`folder-lib`,__vendors__:`folder-lib`,__venv__:`folder-environment`,__vercel__:`folder-vercel`,__verdaccio__:`folder-verdaccio`,__vid__:`folder-video`,__video__:`folder-video`,__videos__:`folder-video`,__vids__:`folder-video`,__view__:`folder-views`,__views__:`folder-views`,__vm__:`folder-vm`,__vms__:`folder-vm`,__voice__:`folder-audio`,__voices__:`folder-audio`,"__vscode-test__":`folder-vscode`,__vscode__:`folder-vscode`,__vue__:`folder-vue`,__vuepress__:`folder-vuepress`,__wakatime__:`folder-wakatime`,__web__:`folder-public`,__webpack__:`folder-webpack`,__website__:`folder-public`,__websites__:`folder-public`,__widget__:`folder-components`,__widgets__:`folder-components`,__wiki__:`folder-docs`,__win10__:`folder-windows`,__win11__:`folder-windows`,__win32__:`folder-windows`,__win__:`folder-windows`,__windows10__:`folder-windows`,__windows11__:`folder-windows`,__windows__:`folder-windows`,__windowsnt__:`folder-windows`,__windowsxp__:`folder-windows`,__winnt__:`folder-windows`,__winxp__:`folder-windows`,"__wordpress-org__":`folder-wordpress`,"__wp-content__":`folder-wordpress`,__wsl__:`folder-linux`,__www__:`folder-public`,__wwwroot__:`folder-public`,__xbox__:`folder-console`,__xtask__:`folder-scripts`,__yarn__:`folder-yarn`,__zeabur__:`folder-zeabur`,__zed__:`folder-zed`,_addin:`folder-plugin`,_addins:`folder-plugin`,_addon:`folder-plugin`,_addons:`folder-plugin`,_admin:`folder-admin`,_admins:`folder-admin`,_agent:`folder-robot`,_agents:`folder-robot`,_android:`folder-android`,_angular:`folder-angular`,_anim:`folder-animation`,_animated:`folder-animation`,_animation:`folder-animation`,_animations:`folder-animation`,_anims:`folder-animation`,_ansible:`folder-ansible`,_api:`folder-api`,_apis:`folder-api`,_apollo:`folder-apollo`,"_apollo-cache":`folder-apollo`,"_apollo-client":`folder-apollo`,"_apollo-config":`folder-apollo`,_app:`folder-app`,_apple:`folder-macos`,_application:`folder-app`,_applications:`folder-app`,_apps:`folder-app`,_appwrite:`folder-appwrite`,_arc:`folder-archive`,_archival:`folder-archive`,_archive:`folder-archive`,_archives:`folder-archive`,_arcs:`folder-archive`,_article:`folder-docs`,_articles:`folder-docs`,_asm:`folder-assembly`,_assembly:`folder-assembly`,_asset:`folder-resource`,_assets:`folder-resource`,_astro:`folder-astro`,_atom:`folder-atom`,_atoms:`folder-atom`,_attachment:`folder-attachment`,_attachments:`folder-attachment`,_aud:`folder-audio`,_audio:`folder-audio`,_audios:`folder-audio`,_auds:`folder-audio`,_aurelia_project:`folder-aurelia`,_auth:`folder-secure`,_authentication:`folder-secure`,_auto:`folder-generator`,_aws:`folder-aws`,_azure:`folder-aws`,"_azure-pipelines":`folder-azure-pipelines`,"_azure-pipelines-ci":`folder-azure-pipelines`,"_back-up":`folder-backup`,"_back-ups":`folder-backup`,_backend:`folder-server`,_backends:`folder-server`,_backup:`folder-backup`,_backups:`folder-backup`,_bak:`folder-backup`,_baks:`folder-backup`,_base:`folder-base`,_bases:`folder-base`,_batch:`folder-batch`,_batches:`folder-batch`,_batchs:`folder-batch`,_bench:`folder-benchmark`,_benches:`folder-benchmark`,_benchmark:`folder-benchmark`,_benchmarks:`folder-benchmark`,_bibliographies:`folder-bibliography`,_bibliography:`folder-bibliography`,_bicep:`folder-bicep`,_bin:`folder-dist`,_bkp:`folder-backup`,_bkps:`folder-backup`,_blender:`folder-blender`,"_blender-assets":`folder-blender`,"_blender-files":`folder-blender`,"_blender-models":`folder-blender`,"_blender-project":`folder-blender`,_bloc:`folder-bloc`,_blocs:`folder-bloc`,_blog:`folder-docs`,_book:`folder-bibliography`,_books:`folder-bibliography`,_bot:`folder-robot`,_bots:`folder-robot`,_bower_components:`folder-bower`,_browser:`folder-public`,_browsers:`folder-public`,_build:`folder-dist`,_buildkite:`folder-buildkite`,_builds:`folder-dist`,_built:`folder-dist`,_bull:`folder-queue`,_cache:`folder-temp`,_cached:`folder-temp`,_calc:`folder-functions`,_calcs:`folder-functions`,_calculation:`folder-functions`,_calculations:`folder-functions`,_cargo:`folder-rust`,_cart:`folder-cart`,_centos:`folder-linux`,_cert:`folder-secure`,_certificate:`folder-secure`,_certificates:`folder-secure`,_certs:`folder-secure`,_cfg:`folder-config`,_cfgs:`folder-config`,"_cfn-gen":`folder-generator`,_changes:`folder-delta`,_changeset:`folder-changesets`,_changesets:`folder-changesets`,_chat:`folder-messages`,_chats:`folder-messages`,_ci:`folder-ci`,_cipher:`folder-secure`,_circleci:`folder-circleci`,_cjs:`folder-javascript`,_class:`folder-class`,_classes:`folder-class`,_claude:`folder-claude`,_cli:`folder-command`,_client:`folder-client`,_clients:`folder-client`,_cline_docs:`folder-cline`,_clis:`folder-command`,"_cloud-firestore":`folder-firestore`,"_cloud-functions":`folder-cloud-functions`,_cloudflare:`folder-cloudflare`,_cloudfunctions:`folder-cloud-functions`,_cluster:`folder-cluster`,_clusters:`folder-cluster`,_cmd:`folder-command`,_cobol:`folder-cobol`,_code:`folder-src`,_color:`folder-theme`,_colors:`folder-theme`,_colour:`folder-theme`,_colours:`folder-theme`,_command:`folder-command`,_commandline:`folder-command`,_commands:`folder-command`,_common:`folder-shared`,_compiled:`folder-dist`,_components:`folder-components`,_composable:`folder-functions`,_composables:`folder-functions`,_concept:`folder-mock`,_concepts:`folder-mock`,_conf:`folder-config`,_config:`folder-config`,_configs:`folder-config`,_configuration:`folder-config`,_configurations:`folder-config`,_confs:`folder-config`,_connection:`folder-connection`,_connections:`folder-connection`,_console:`folder-console`,_const:`folder-constant`,_constant:`folder-constant`,_constants:`folder-constant`,_consts:`folder-constant`,_container:`folder-container`,_containers:`folder-container`,_content:`folder-content`,_contents:`folder-content`,_context:`folder-context`,_contexts:`folder-context`,_contract:`folder-contract`,"_contract-test":`folder-contract`,"_contract-testing":`folder-contract`,"_contract-tests":`folder-contract`,_contracts:`folder-contract`,_controller:`folder-controller`,_controllers:`folder-controller`,_controls:`folder-controller`,_conversation:`folder-messages`,_conversations:`folder-messages`,_core:`folder-core`,_coverage:`folder-coverage`,_crash:`folder-error`,_crashes:`folder-error`,_crates:`folder-lib`,_css:`folder-css`,_cts:`folder-typescript`,_cubit:`folder-bloc`,_cubits:`folder-bloc`,_cue:`folder-cue`,_cues:`folder-cue`,_cursor:`folder-cursor`,_custom:`folder-custom`,_customs:`folder-custom`,_cypher:`folder-secure`,_cypress:`folder-cypress`,_dal:`folder-dal`,_dart:`folder-dart`,_dart_tool:`folder-dart`,_dart_tools:`folder-dart`,_data:`folder-database`,"_data-access":`folder-dal`,"_data-access-layer":`folder-dal`,_database:`folder-database`,_databases:`folder-database`,_db:`folder-database`,_deb:`folder-linux`,_debian:`folder-linux`,_debug:`folder-debug`,_debugger:`folder-debug`,_debugging:`folder-debug`,_decorator:`folder-decorators`,_decorators:`folder-decorators`,_deepin:`folder-linux`,_delta:`folder-delta`,_deltas:`folder-delta`,_demo:`folder-examples`,_demos:`folder-examples`,_dependencies:`folder-packages`,_design:`folder-theme`,_designs:`folder-theme`,_desktop:`folder-desktop`,_devcontainer:`folder-container`,_devpackages:`folder-packages`,_devtools:`folder-tools`,_dialog:`folder-messages`,_dialogs:`folder-messages`,_diary:`folder-docs`,_directive:`folder-directive`,_directives:`folder-directive`,_display:`folder-desktop`,_dist:`folder-dist`,_distribution:`folder-dist`,_doc:`folder-docs`,_docker:`folder-docker`,_dockerfiles:`folder-docker`,_dockerhub:`folder-docker`,_docs:`folder-docs`,_document:`folder-docs`,_documentation:`folder-docs`,_documents:`folder-docs`,_download:`folder-download`,_downloader:`folder-download`,_downloaders:`folder-download`,_downloads:`folder-download`,_draft:`folder-mock`,_drafts:`folder-mock`,_drizzle:`folder-drizzle`,_ds_store:`folder-macos`,_dump:`folder-dump`,_dumps:`folder-dump`,_e2e:`folder-coverage`,_easing:`folder-animation`,_easings:`folder-animation`,_element:`folder-element`,_elements:`folder-element`,_email:`folder-mail`,_emails:`folder-mail`,_enum:`folder-enum`,_enums:`folder-enum`,_env:`folder-environment`,_environment:`folder-environment`,_environments:`folder-environment`,_envs:`folder-environment`,_err:`folder-error`,_error:`folder-error`,_errors:`folder-error`,_errs:`folder-error`,_eslint:`folder-eslint`,"_eslint-config":`folder-eslint`,"_eslint-configs":`folder-eslint`,"_eslint-plugin":`folder-eslint`,"_eslint-plugins":`folder-eslint`,_etc:`folder-other`,_event:`folder-event`,_events:`folder-event`,_example:`folder-examples`,_examples:`folder-examples`,_expo:`folder-expo`,"_expo-shared":`folder-expo`,_export:`folder-export`,_exported:`folder-export`,_exports:`folder-export`,_extension:`folder-plugin`,_extensions:`folder-plugin`,_external:`folder-lib`,_externals:`folder-lib`,_extra:`folder-other`,_extras:`folder-other`,_fastlane:`folder-fastlane`,_favicon:`folder-favicon`,_favicons:`folder-favicon`,_feat:`folder-features`,_feats:`folder-features`,_feature:`folder-features`,_features:`folder-features`,_fig:`folder-images`,_figs:`folder-images`,_figure:`folder-images`,_figures:`folder-images`,_filter:`folder-filter`,_filters:`folder-filter`,_firebase:`folder-firebase`,"_firebase-cloud-functions":`folder-cloud-functions`,"_firebase-cloudfunctions":`folder-cloud-functions`,"_firebase-firestore":`folder-firestore`,_firestore:`folder-firestore`,_fixture:`folder-mock`,_fixtures:`folder-mock`,"_flow-typed":`folder-flow`,_flutter:`folder-flutter`,_font:`folder-font`,_fonts:`folder-font`,_forgejo:`folder-forgejo`,_form:`folder-form`,_forms:`folder-form`,_forum:`folder-messages`,_fragments:`folder-components`,_frontend:`folder-client`,_frontends:`folder-client`,_func:`folder-functions`,_funcs:`folder-functions`,_function:`folder-functions`,_functions:`folder-functions`,_game:`folder-console`,_gamemaker:`folder-gamemaker`,_gamemaker2:`folder-gamemaker`,_games:`folder-console`,_gcp:`folder-aws`,_gemini:`folder-gemini-ai`,"_gemini-ai":`folder-gemini-ai`,_geminiai:`folder-gemini-ai`,_gen:`folder-generator`,_generated:`folder-generator`,_generator:`folder-generator`,_generators:`folder-generator`,_gens:`folder-generator`,_git:`folder-git`,_gitea:`folder-gitea`,_githooks:`folder-git`,_github:`folder-github`,"_github/issue_template":`folder-template`,"_github/pull_request_template":`folder-template`,"_github/workflows":`folder-gh-workflows`,_gitlab:`folder-gitlab`,_global:`folder-global`,_glsl:`folder-shader`,_go:`folder-go`,_godot:`folder-godot`,"_godot-cpp":`folder-godot`,_golang:`folder-go`,_gql:`folder-graphql`,_gradle:`folder-gradle`,_graphql:`folder-graphql`,_guard:`folder-guard`,_guards:`folder-guard`,_gui:`folder-ui`,_gulp:`folder-gulp`,"_gulp-tasks":`folder-gulp`,"_gulpfile.babel.js":`folder-gulp`,"_gulpfile.js":`folder-gulp`,"_gulpfile.mjs":`folder-gulp`,"_gulpfile.ts":`folder-gulp`,_gulpfiles:`folder-gulp`,_handler:`folder-controller`,_handlers:`folder-controller`,_helm:`folder-helm`,_helmchart:`folder-helm`,_helmcharts:`folder-helm`,_helper:`folder-helper`,_helpers:`folder-helper`,_hg:`folder-mercurial`,_hgext:`folder-mercurial`,_hghooks:`folder-mercurial`,_histories:`folder-backup`,_history:`folder-backup`,_hlsl:`folder-shader`,_home:`folder-home`,_hook:`folder-hook`,_hooks:`folder-hook`,_html:`folder-views`,_husky:`folder-husky`,_i18n:`folder-i18n`,_ico:`folder-images`,_icon:`folder-images`,_icons:`folder-images`,_icos:`folder-images`,_idea:`folder-intellij`,_image:`folder-images`,_images:`folder-images`,_img:`folder-images`,_imgs:`folder-images`,_import:`folder-import`,_imported:`folder-import`,_imports:`folder-import`,_in:`folder-input`,_inc:`folder-include`,_inc64:`folder-include`,_include:`folder-include`,_includes:`folder-include`,_infra:`folder-server`,_infrastructure:`folder-server`,_input:`folder-input`,_inputs:`folder-input`,_integration:`folder-connection`,"_integration-test":`folder-coverage`,"_integration-tests":`folder-coverage`,_integrations:`folder-connection`,_interceptor:`folder-interceptor`,_interceptors:`folder-interceptor`,_interface:`folder-interface`,_interfaces:`folder-interface`,_internationalization:`folder-i18n`,_inventories:`folder-server`,_inventory:`folder-server`,_io:`folder-input`,_ios:`folder-ios`,_ipad:`folder-macos`,_iphone:`folder-macos`,_ipod:`folder-macos`,_ipynb:`folder-jupyter`,_it:`folder-coverage`,_j2:`folder-jinja`,_java:`folder-java`,_javascript:`folder-javascript`,_javascripts:`folder-javascript`,_jinja:`folder-jinja`,_jinja2:`folder-jinja`,_job:`folder-job`,_jobs:`folder-job`,_js:`folder-javascript`,_json:`folder-json`,_jsonc:`folder-json`,_jsonl:`folder-json`,_jsons:`folder-json`,_jupyter:`folder-jupyter`,_jwt:`folder-keys`,_k8s:`folder-kubernetes`,_key:`folder-keys`,_keys:`folder-keys`,_kit:`folder-tools`,_kits:`folder-tools`,_knowledge:`folder-docs`,_kotlin:`folder-kotlin`,_kql:`folder-kusto`,_kubernetes:`folder-kubernetes`,_kusto:`folder-kusto`,_l10n:`folder-i18n`,_lambda:`folder-functions`,_lambdas:`folder-functions`,_landing:`folder-home`,_lang:`folder-i18n`,_langs:`folder-i18n`,_language:`folder-i18n`,_languages:`folder-i18n`,_layout:`folder-layout`,_layouts:`folder-layout`,_lefthook:`folder-lefthook`,"_lefthook-local":`folder-lefthook`,_less:`folder-less`,_lib:`folder-lib`,_lib64:`folder-lib`,_libraries:`folder-lib`,_library:`folder-lib`,_libs:`folder-lib`,_license:`folder-license`,_licenses:`folder-license`,_link:`folder-link`,_links:`folder-link`,_linux:`folder-linux`,_linuxbsd:`folder-linux`,_liquibase:`folder-liquibase`,_locale:`folder-i18n`,_locales:`folder-i18n`,_localization:`folder-i18n`,_log:`folder-log`,_logging:`folder-log`,_logic:`folder-functions`,_logs:`folder-log`,_lottie:`folder-lottie`,_lottiefiles:`folder-lottie`,_lotties:`folder-lottie`,_lua:`folder-lua`,_luau:`folder-luau`,_mac:`folder-macos`,_macbook:`folder-macos`,"_macbook-air":`folder-macos`,_macos:`folder-macos`,_macosx:`folder-macos`,_mail:`folder-mail`,_mailers:`folder-mail`,_mails:`folder-mail`,_main:`folder-home`,_manager:`folder-admin`,_managers:`folder-admin`,_mapping:`folder-mappings`,_mappings:`folder-mappings`,_markdown:`folder-markdown`,_math:`folder-functions`,_maths:`folder-functions`,_md:`folder-markdown`,_measure:`folder-benchmark`,_measurement:`folder-benchmark`,_measures:`folder-benchmark`,_media:`folder-video`,_messages:`folder-messages`,_messaging:`folder-messages`,_meta:`folder-meta`,"_meta-inf":`folder-config`,_metadata:`folder-meta`,_metro:`folder-metro`,_middleware:`folder-middleware`,_middlewares:`folder-middleware`,_migration:`folder-migrations`,_migrations:`folder-migrations`,_mint:`folder-linux`,_misc:`folder-other`,_miscellaneous:`folder-other`,_mjml:`folder-mjml`,_mjs:`folder-javascript`,_mobile:`folder-mobile`,_mobiles:`folder-mobile`,_mock:`folder-mock`,_mocks:`folder-mock`,_mod:`folder-plugin`,_modding:`folder-plugin`,_model:`folder-class`,_models:`folder-class`,_moderator:`folder-admin`,_moderators:`folder-admin`,_mods:`folder-plugin`,_module:`folder-plugin`,_modules:`folder-plugin`,_mojo:`folder-mojo`,_molecule:`folder-molecule`,_molecules:`folder-molecule`,_moon:`folder-moon`,_motion:`folder-animation`,_motions:`folder-animation`,_movie:`folder-video`,_movies:`folder-video`,_mq:`folder-queue`,_mts:`folder-typescript`,_music:`folder-audio`,_navigation:`folder-routes`,_navigations:`folder-routes`,_netlify:`folder-netlify`,_news:`folder-docs`,_next:`folder-next`,_nginx:`folder-nginx`,_node:`folder-node`,_node_modules:`folder-node`,_nodejs:`folder-node`,_note:`folder-docs`,_notebook:`folder-jupyter`,_notebooks:`folder-jupyter`,_notes:`folder-docs`,_now:`folder-vercel`,_nuxt:`folder-nuxt`,"_nyc-output":`folder-coverage`,_nyc_output:`folder-coverage`,_obsidian:`folder-obsidian`,_opencode:`folder-opencode`,_option:`folder-config`,_options:`folder-config`,_organism:`folder-organism`,_organisms:`folder-organism`,_osx:`folder-macos`,_other:`folder-other`,_others:`folder-other`,_out:`folder-dist`,_output:`folder-dist`,_outputs:`folder-dist`,_package:`folder-packages`,_packages:`folder-packages`,_pact:`folder-contract`,_pacts:`folder-contract`,_page:`folder-views`,_pages:`folder-views`,_palette:`folder-theme`,_palettes:`folder-theme`,_partial:`folder-include`,_partials:`folder-include`,_patches:`folder-git`,_pdf:`folder-pdf`,_pdfs:`folder-pdf`,"_pdm-build":`folder-pdm`,"_pdm-plugins":`folder-pdm`,_perf:`folder-benchmark`,_performance:`folder-benchmark`,_phone:`folder-mobile`,_phones:`folder-mobile`,_photo:`folder-images`,_photograph:`folder-images`,_photographs:`folder-images`,_photos:`folder-images`,_php:`folder-php`,_phpmailer:`folder-phpmailer`,_pic:`folder-images`,_pics:`folder-images`,_picture:`folder-images`,_pictures:`folder-images`,_pipe:`folder-pipe`,_pipeline:`folder-pipe`,_pipelines:`folder-pipe`,_pipes:`folder-pipe`,_pkg:`folder-packages`,_pkgs:`folder-packages`,_plastic:`folder-plastic`,_playground:`folder-sandbox`,_playgrounds:`folder-sandbox`,_playlist:`folder-audio`,_playlists:`folder-audio`,_plugin:`folder-plugin`,_plugins:`folder-plugin`,_policies:`folder-policy`,_policy:`folder-policy`,_popos:`folder-linux`,_portability:`folder-mobile`,_portable:`folder-mobile`,_post:`folder-docs`,_postman:`folder-postman`,_posts:`folder-docs`,_powershell:`folder-powershell`,_pref:`folder-config`,_preference:`folder-config`,_preferences:`folder-config`,_prefs:`folder-config`,_presentation:`folder-ui`,_preview:`folder-review`,_previews:`folder-review`,_prisma:`folder-prisma`,"_prisma/schema":`folder-prisma`,_private:`folder-private`,_profiling:`folder-benchmark`,_proj:`folder-project`,_project:`folder-project`,_projects:`folder-project`,_projs:`folder-project`,_prompt:`folder-prompts`,_prompts:`folder-prompts`,_properties:`folder-config`,_props:`folder-config`,_proto:`folder-proto`,_protobuf:`folder-proto`,_protobufs:`folder-proto`,_protos:`folder-proto`,_provider:`folder-controller`,_providers:`folder-controller`,_proxy:`folder-public`,_ps:`folder-powershell`,_ps1:`folder-powershell`,_ps4:`folder-console`,_ps5:`folder-console`,_public:`folder-public`,_public_html:`folder-views`,_pwa:`folder-client`,_pycache:`folder-python`,_pytest_cache:`folder-python`,_python:`folder-python`,_pytorch:`folder-pytorch`,_quasar:`folder-quasar`,_queue:`folder-queue`,_queues:`folder-queue`,_r:`folder-r`,_recordings:`folder-audio`,_release:`folder-dist`,_remote:`folder-connection`,_remotes:`folder-connection`,_repo:`folder-repository`,_report:`folder-resource`,_reports:`folder-resource`,_repos:`folder-repository`,_repositories:`folder-repository`,_repository:`folder-repository`,_res:`folder-resource`,_resolver:`folder-resolver`,_resolvers:`folder-resolver`,_resource:`folder-resource`,_resources:`folder-resource`,_restapi:`folder-api`,_review:`folder-review`,_reviewed:`folder-review`,_reviews:`folder-review`,_revisal:`folder-review`,_revisals:`folder-review`,_robot:`folder-robot`,_robots:`folder-robot`,_router:`folder-routes`,_routers:`folder-routes`,_routes:`folder-routes`,_routing:`folder-routes`,_rule:`folder-rules`,_rules:`folder-rules`,_rust:`folder-rust`,_salt:`folder-salt`,_saltstack:`folder-salt`,_sample:`folder-examples`,"_sample-data":`folder-examples`,_samples:`folder-examples`,_sandbox:`folder-sandbox`,_sandboxes:`folder-sandbox`,_sass:`folder-sass`,_scala:`folder-scala`,_schema:`folder-class`,_schemas:`folder-class`,_sconf_temp:`folder-scons`,_scons:`folder-scons`,_scons_cache:`folder-scons`,_screen:`folder-views`,_screengrab:`folder-images`,_screengrabs:`folder-images`,_screens:`folder-views`,_screenshot:`folder-images`,_screenshots:`folder-images`,_script:`folder-scripts`,_scripting:`folder-scripts`,_scripts:`folder-scripts`,_scss:`folder-sass`,_secret:`folder-keys`,_secrets:`folder-keys`,_secure:`folder-secure`,_security:`folder-secure`,_seed:`folder-seeders`,_seeders:`folder-seeders`,_seeding:`folder-seeders`,_seeds:`folder-seeders`,_server:`folder-server`,_serverless:`folder-serverless`,_serverpackages:`folder-packages`,_servers:`folder-server`,_service:`folder-controller`,_services:`folder-controller`,_setting:`folder-config`,_settings:`folder-config`,_shader:`folder-shader`,_shaders:`folder-shader`,_shared:`folder-shared`,_shop:`folder-cart`,_shopping:`folder-cart`,"_shopping-cart":`folder-cart`,_sim:`folder-simulations`,_sims:`folder-simulations`,_simulation:`folder-simulations`,_simulations:`folder-simulations`,_site:`folder-public`,_sketch:`folder-mock`,_sketches:`folder-mock`,_skill:`folder-skills`,_skills:`folder-skills`,_smtp:`folder-mail`,_snap:`folder-snapcraft`,_snapcraft:`folder-snapcraft`,_snapshots:`folder-test`,_snippet:`folder-snippet`,_snippets:`folder-snippet`,_song:`folder-audio`,_songs:`folder-audio`,_sound:`folder-audio`,_sounds:`folder-audio`,_source:`folder-src`,_sources:`folder-src`,_spa:`folder-client`,_spec:`folder-test`,_specs:`folder-test`,_spellcheck:`folder-syntax`,_spellcheckers:`folder-syntax`,_sql:`folder-database`,_src:`folder-src`,"_src-tauri":`folder-src-tauri`,_srcs:`folder-src`,_ssl:`folder-secure`,_stack:`folder-stack`,_stacks:`folder-stack`,_start:`folder-home`,_static:`folder-resource`,_stencil:`folder-stencil`,_store:`folder-store`,_stores:`folder-store`,_stories:`folder-storybook`,_storybook:`folder-storybook`,_style:`folder-css`,_styles:`folder-css`,_stylesheet:`folder-css`,_stylesheets:`folder-css`,_stylus:`folder-stylus`,_sublime:`folder-sublime`,_submodules:`folder-git`,_supabase:`folder-supabase`,_svelte:`folder-svelte`,"_svelte-kit":`folder-svelte`,_svg:`folder-svg`,_svgs:`folder-svg`,_switch:`folder-console`,_syntax:`folder-syntax`,_syntaxes:`folder-syntax`,"_table-of-contents":`folder-toc`,_target:`folder-target`,_taskfile:`folder-taskfile`,_taskfiles:`folder-taskfile`,_tasks:`folder-tasks`,_television:`folder-television`,_temp:`folder-temp`,_template:`folder-template`,_templates:`folder-template`,_terraform:`folder-terraform`,_test:`folder-test`,_testfiles:`folder-test`,_testing:`folder-test`,_tests:`folder-test`,_texture:`folder-images`,_textures:`folder-images`,_theme:`folder-theme`,_themes:`folder-theme`,"_third-party":`folder-lib`,_thirdparty:`folder-lib`,_tickets:`folder-tasks`,_tls:`folder-secure`,_tmp:`folder-temp`,_toc:`folder-toc`,_token:`folder-keys`,_tokens:`folder-keys`,_toolbox:`folder-tools`,_toolboxes:`folder-tools`,_tooling:`folder-tools`,_toolkit:`folder-tools`,_toolkits:`folder-tools`,_tools:`folder-tools`,_torch:`folder-pytorch`,_transition:`folder-animation`,_transitions:`folder-animation`,_translate:`folder-i18n`,_translation:`folder-i18n`,_translations:`folder-i18n`,_trash:`folder-trash`,_trigger:`folder-trigger`,_triggers:`folder-trigger`,_ts:`folder-typescript`,_turbo:`folder-turborepo`,_tv:`folder-television`,_tx:`folder-i18n`,_typeface:`folder-font`,_typefaces:`folder-font`,_types:`folder-typescript`,_typescript:`folder-typescript`,_typings:`folder-typescript`,_ubuntu:`folder-linux`,_ui:`folder-ui`,_unity:`folder-unity`,_unix:`folder-linux`,_update:`folder-update`,_updates:`folder-update`,_upgrade:`folder-update`,_upgrades:`folder-update`,_upload:`folder-upload`,_uploads:`folder-upload`,_util:`folder-utils`,_utilities:`folder-utils`,_utility:`folder-utils`,_utils:`folder-utils`,_ux:`folder-ui`,_validation:`folder-rules`,_validations:`folder-rules`,_validator:`folder-rules`,_validators:`folder-rules`,_vector:`folder-svg`,_vectors:`folder-svg`,_vendor:`folder-lib`,_vendors:`folder-lib`,_venv:`folder-environment`,_vercel:`folder-vercel`,_verdaccio:`folder-verdaccio`,_vid:`folder-video`,_video:`folder-video`,_videos:`folder-video`,_vids:`folder-video`,_view:`folder-views`,_views:`folder-views`,_vm:`folder-vm`,_vms:`folder-vm`,_voice:`folder-audio`,_voices:`folder-audio`,_vscode:`folder-vscode`,"_vscode-test":`folder-vscode`,_vue:`folder-vue`,_vuepress:`folder-vuepress`,_wakatime:`folder-wakatime`,_web:`folder-public`,_webpack:`folder-webpack`,_website:`folder-public`,_websites:`folder-public`,_widget:`folder-components`,_widgets:`folder-components`,_wiki:`folder-docs`,_win:`folder-windows`,_win10:`folder-windows`,_win11:`folder-windows`,_win32:`folder-windows`,_windows:`folder-windows`,_windows10:`folder-windows`,_windows11:`folder-windows`,_windowsnt:`folder-windows`,_windowsxp:`folder-windows`,_winnt:`folder-windows`,_winxp:`folder-windows`,"_wordpress-org":`folder-wordpress`,"_wp-content":`folder-wordpress`,_wsl:`folder-linux`,_www:`folder-public`,_wwwroot:`folder-public`,_xbox:`folder-console`,_xtask:`folder-scripts`,_yarn:`folder-yarn`,_zeabur:`folder-zeabur`,_zed:`folder-zed`,addin:`folder-plugin`,addins:`folder-plugin`,addon:`folder-plugin`,addons:`folder-plugin`,admin:`folder-admin`,admins:`folder-admin`,agent:`folder-robot`,agents:`folder-robot`,android:`folder-android`,angular:`folder-angular`,anim:`folder-animation`,animated:`folder-animation`,animation:`folder-animation`,animations:`folder-animation`,anims:`folder-animation`,ansible:`folder-ansible`,api:`folder-api`,apis:`folder-api`,apollo:`folder-apollo`,"apollo-cache":`folder-apollo`,"apollo-client":`folder-apollo`,"apollo-config":`folder-apollo`,app:`folder-app`,apple:`folder-macos`,application:`folder-app`,applications:`folder-app`,apps:`folder-app`,appwrite:`folder-appwrite`,arc:`folder-archive`,archival:`folder-archive`,archive:`folder-archive`,archives:`folder-archive`,arcs:`folder-archive`,article:`folder-docs`,articles:`folder-docs`,asm:`folder-assembly`,assembly:`folder-assembly`,asset:`folder-resource`,assets:`folder-resource`,astro:`folder-astro`,atom:`folder-atom`,atoms:`folder-atom`,attachment:`folder-attachment`,attachments:`folder-attachment`,aud:`folder-audio`,audio:`folder-audio`,audios:`folder-audio`,auds:`folder-audio`,aurelia_project:`folder-aurelia`,auth:`folder-secure`,authentication:`folder-secure`,auto:`folder-generator`,aws:`folder-aws`,azure:`folder-aws`,"azure-pipelines":`folder-azure-pipelines`,"azure-pipelines-ci":`folder-azure-pipelines`,"back-up":`folder-backup`,"back-ups":`folder-backup`,backend:`folder-server`,backends:`folder-server`,backup:`folder-backup`,backups:`folder-backup`,bak:`folder-backup`,baks:`folder-backup`,base:`folder-base`,bases:`folder-base`,batch:`folder-batch`,batches:`folder-batch`,batchs:`folder-batch`,bench:`folder-benchmark`,benches:`folder-benchmark`,benchmark:`folder-benchmark`,benchmarks:`folder-benchmark`,bibliographies:`folder-bibliography`,bibliography:`folder-bibliography`,bicep:`folder-bicep`,bin:`folder-dist`,bkp:`folder-backup`,bkps:`folder-backup`,blender:`folder-blender`,"blender-assets":`folder-blender`,"blender-files":`folder-blender`,"blender-models":`folder-blender`,"blender-project":`folder-blender`,bloc:`folder-bloc`,blocs:`folder-bloc`,blog:`folder-docs`,book:`folder-bibliography`,books:`folder-bibliography`,bot:`folder-robot`,bots:`folder-robot`,bower_components:`folder-bower`,browser:`folder-public`,browsers:`folder-public`,build:`folder-dist`,buildkite:`folder-buildkite`,builds:`folder-dist`,built:`folder-dist`,bull:`folder-queue`,cache:`folder-temp`,cached:`folder-temp`,calc:`folder-functions`,calcs:`folder-functions`,calculation:`folder-functions`,calculations:`folder-functions`,cargo:`folder-rust`,cart:`folder-cart`,centos:`folder-linux`,cert:`folder-secure`,certificate:`folder-secure`,certificates:`folder-secure`,certs:`folder-secure`,cfg:`folder-config`,cfgs:`folder-config`,"cfn-gen":`folder-generator`,changes:`folder-delta`,changeset:`folder-changesets`,changesets:`folder-changesets`,chat:`folder-messages`,chats:`folder-messages`,ci:`folder-ci`,cipher:`folder-secure`,circleci:`folder-circleci`,cjs:`folder-javascript`,class:`folder-class`,classes:`folder-class`,claude:`folder-claude`,cli:`folder-command`,client:`folder-client`,clients:`folder-client`,cline_docs:`folder-cline`,clis:`folder-command`,"cloud-firestore":`folder-firestore`,"cloud-functions":`folder-cloud-functions`,cloudflare:`folder-cloudflare`,cloudfunctions:`folder-cloud-functions`,cluster:`folder-cluster`,clusters:`folder-cluster`,cmd:`folder-command`,cobol:`folder-cobol`,code:`folder-src`,color:`folder-theme`,colors:`folder-theme`,colour:`folder-theme`,colours:`folder-theme`,command:`folder-command`,commandline:`folder-command`,commands:`folder-command`,common:`folder-shared`,compiled:`folder-dist`,components:`folder-components`,composable:`folder-functions`,composables:`folder-functions`,concept:`folder-mock`,concepts:`folder-mock`,conf:`folder-config`,config:`folder-config`,configs:`folder-config`,configuration:`folder-config`,configurations:`folder-config`,confs:`folder-config`,connection:`folder-connection`,connections:`folder-connection`,console:`folder-console`,const:`folder-constant`,constant:`folder-constant`,constants:`folder-constant`,consts:`folder-constant`,container:`folder-container`,containers:`folder-container`,content:`folder-content`,contents:`folder-content`,context:`folder-context`,contexts:`folder-context`,contract:`folder-contract`,"contract-test":`folder-contract`,"contract-testing":`folder-contract`,"contract-tests":`folder-contract`,contracts:`folder-contract`,controller:`folder-controller`,controllers:`folder-controller`,controls:`folder-controller`,conversation:`folder-messages`,conversations:`folder-messages`,core:`folder-core`,coverage:`folder-coverage`,crash:`folder-error`,crashes:`folder-error`,crates:`folder-lib`,css:`folder-css`,cts:`folder-typescript`,cubit:`folder-bloc`,cubits:`folder-bloc`,cue:`folder-cue`,cues:`folder-cue`,cursor:`folder-cursor`,custom:`folder-custom`,customs:`folder-custom`,cypher:`folder-secure`,cypress:`folder-cypress`,dal:`folder-dal`,dart:`folder-dart`,dart_tool:`folder-dart`,dart_tools:`folder-dart`,data:`folder-database`,"data-access":`folder-dal`,"data-access-layer":`folder-dal`,database:`folder-database`,databases:`folder-database`,db:`folder-database`,deb:`folder-linux`,debian:`folder-linux`,debug:`folder-debug`,debugger:`folder-debug`,debugging:`folder-debug`,decorator:`folder-decorators`,decorators:`folder-decorators`,deepin:`folder-linux`,delta:`folder-delta`,deltas:`folder-delta`,demo:`folder-examples`,demos:`folder-examples`,dependencies:`folder-packages`,design:`folder-theme`,designs:`folder-theme`,desktop:`folder-desktop`,devcontainer:`folder-container`,devpackages:`folder-packages`,devtools:`folder-tools`,dialog:`folder-messages`,dialogs:`folder-messages`,diary:`folder-docs`,directive:`folder-directive`,directives:`folder-directive`,display:`folder-desktop`,dist:`folder-dist`,distribution:`folder-dist`,doc:`folder-docs`,docker:`folder-docker`,dockerfiles:`folder-docker`,dockerhub:`folder-docker`,docs:`folder-docs`,document:`folder-docs`,documentation:`folder-docs`,documents:`folder-docs`,download:`folder-download`,downloader:`folder-download`,downloaders:`folder-download`,downloads:`folder-download`,draft:`folder-mock`,drafts:`folder-mock`,drizzle:`folder-drizzle`,ds_store:`folder-macos`,dump:`folder-dump`,dumps:`folder-dump`,e2e:`folder-coverage`,easing:`folder-animation`,easings:`folder-animation`,element:`folder-element`,elements:`folder-element`,email:`folder-mail`,emails:`folder-mail`,enum:`folder-enum`,enums:`folder-enum`,env:`folder-environment`,environment:`folder-environment`,environments:`folder-environment`,envs:`folder-environment`,err:`folder-error`,error:`folder-error`,errors:`folder-error`,errs:`folder-error`,eslint:`folder-eslint`,"eslint-config":`folder-eslint`,"eslint-configs":`folder-eslint`,"eslint-plugin":`folder-eslint`,"eslint-plugins":`folder-eslint`,etc:`folder-other`,event:`folder-event`,events:`folder-event`,example:`folder-examples`,examples:`folder-examples`,expo:`folder-expo`,"expo-shared":`folder-expo`,export:`folder-export`,exported:`folder-export`,exports:`folder-export`,extension:`folder-plugin`,extensions:`folder-plugin`,external:`folder-lib`,externals:`folder-lib`,extra:`folder-other`,extras:`folder-other`,fastlane:`folder-fastlane`,favicon:`folder-favicon`,favicons:`folder-favicon`,feat:`folder-features`,feats:`folder-features`,feature:`folder-features`,features:`folder-features`,fig:`folder-images`,figs:`folder-images`,figure:`folder-images`,figures:`folder-images`,filter:`folder-filter`,filters:`folder-filter`,firebase:`folder-firebase`,"firebase-cloud-functions":`folder-cloud-functions`,"firebase-cloudfunctions":`folder-cloud-functions`,"firebase-firestore":`folder-firestore`,firestore:`folder-firestore`,fixture:`folder-mock`,fixtures:`folder-mock`,"flow-typed":`folder-flow`,flutter:`folder-flutter`,font:`folder-font`,fonts:`folder-font`,forgejo:`folder-forgejo`,form:`folder-form`,forms:`folder-form`,forum:`folder-messages`,fragments:`folder-components`,frontend:`folder-client`,frontends:`folder-client`,func:`folder-functions`,funcs:`folder-functions`,function:`folder-functions`,functions:`folder-functions`,game:`folder-console`,gamemaker:`folder-gamemaker`,gamemaker2:`folder-gamemaker`,games:`folder-console`,gcp:`folder-aws`,gemini:`folder-gemini-ai`,"gemini-ai":`folder-gemini-ai`,geminiai:`folder-gemini-ai`,gen:`folder-generator`,generated:`folder-generator`,generator:`folder-generator`,generators:`folder-generator`,gens:`folder-generator`,git:`folder-git`,gitea:`folder-gitea`,githooks:`folder-git`,github:`folder-github`,"github/issue_template":`folder-template`,"github/pull_request_template":`folder-template`,"github/workflows":`folder-gh-workflows`,gitlab:`folder-gitlab`,global:`folder-global`,glsl:`folder-shader`,go:`folder-go`,godot:`folder-godot`,"godot-cpp":`folder-godot`,golang:`folder-go`,gql:`folder-graphql`,gradle:`folder-gradle`,graphql:`folder-graphql`,guard:`folder-guard`,guards:`folder-guard`,gui:`folder-ui`,gulp:`folder-gulp`,"gulp-tasks":`folder-gulp`,"gulpfile.babel.js":`folder-gulp`,"gulpfile.js":`folder-gulp`,"gulpfile.mjs":`folder-gulp`,"gulpfile.ts":`folder-gulp`,gulpfiles:`folder-gulp`,handler:`folder-controller`,handlers:`folder-controller`,helm:`folder-helm`,helmchart:`folder-helm`,helmcharts:`folder-helm`,helper:`folder-helper`,helpers:`folder-helper`,hg:`folder-mercurial`,hgext:`folder-mercurial`,hghooks:`folder-mercurial`,histories:`folder-backup`,history:`folder-backup`,hlsl:`folder-shader`,home:`folder-home`,hook:`folder-hook`,hooks:`folder-hook`,html:`folder-views`,husky:`folder-husky`,i18n:`folder-i18n`,ico:`folder-images`,icon:`folder-images`,icons:`folder-images`,icos:`folder-images`,idea:`folder-intellij`,image:`folder-images`,images:`folder-images`,img:`folder-images`,imgs:`folder-images`,import:`folder-import`,imported:`folder-import`,imports:`folder-import`,in:`folder-input`,inc:`folder-include`,inc64:`folder-include`,include:`folder-include`,includes:`folder-include`,infra:`folder-server`,infrastructure:`folder-server`,input:`folder-input`,inputs:`folder-input`,integration:`folder-connection`,"integration-test":`folder-coverage`,"integration-tests":`folder-coverage`,integrations:`folder-connection`,interceptor:`folder-interceptor`,interceptors:`folder-interceptor`,interface:`folder-interface`,interfaces:`folder-interface`,internationalization:`folder-i18n`,inventories:`folder-server`,inventory:`folder-server`,io:`folder-input`,ios:`folder-ios`,ipad:`folder-macos`,iphone:`folder-macos`,ipod:`folder-macos`,ipynb:`folder-jupyter`,it:`folder-coverage`,j2:`folder-jinja`,java:`folder-java`,javascript:`folder-javascript`,javascripts:`folder-javascript`,jinja:`folder-jinja`,jinja2:`folder-jinja`,job:`folder-job`,jobs:`folder-job`,js:`folder-javascript`,json:`folder-json`,jsonc:`folder-json`,jsonl:`folder-json`,jsons:`folder-json`,jupyter:`folder-jupyter`,jwt:`folder-keys`,k8s:`folder-kubernetes`,key:`folder-keys`,keys:`folder-keys`,kit:`folder-tools`,kits:`folder-tools`,knowledge:`folder-docs`,kotlin:`folder-kotlin`,kql:`folder-kusto`,kubernetes:`folder-kubernetes`,kusto:`folder-kusto`,l10n:`folder-i18n`,lambda:`folder-functions`,lambdas:`folder-functions`,landing:`folder-home`,lang:`folder-i18n`,langs:`folder-i18n`,language:`folder-i18n`,languages:`folder-i18n`,layout:`folder-layout`,layouts:`folder-layout`,lefthook:`folder-lefthook`,"lefthook-local":`folder-lefthook`,less:`folder-less`,lib:`folder-lib`,lib64:`folder-lib`,libraries:`folder-lib`,library:`folder-lib`,libs:`folder-lib`,license:`folder-license`,licenses:`folder-license`,link:`folder-link`,links:`folder-link`,linux:`folder-linux`,linuxbsd:`folder-linux`,liquibase:`folder-liquibase`,locale:`folder-i18n`,locales:`folder-i18n`,localization:`folder-i18n`,log:`folder-log`,logging:`folder-log`,logic:`folder-functions`,logs:`folder-log`,lottie:`folder-lottie`,lottiefiles:`folder-lottie`,lotties:`folder-lottie`,lua:`folder-lua`,luau:`folder-luau`,mac:`folder-macos`,macbook:`folder-macos`,"macbook-air":`folder-macos`,macos:`folder-macos`,macosx:`folder-macos`,mail:`folder-mail`,mailers:`folder-mail`,mails:`folder-mail`,main:`folder-home`,manager:`folder-admin`,managers:`folder-admin`,mapping:`folder-mappings`,mappings:`folder-mappings`,markdown:`folder-markdown`,math:`folder-functions`,maths:`folder-functions`,md:`folder-markdown`,measure:`folder-benchmark`,measurement:`folder-benchmark`,measures:`folder-benchmark`,media:`folder-video`,messages:`folder-messages`,messaging:`folder-messages`,meta:`folder-meta`,"meta-inf":`folder-config`,metadata:`folder-meta`,metro:`folder-metro`,middleware:`folder-middleware`,middlewares:`folder-middleware`,migration:`folder-migrations`,migrations:`folder-migrations`,mint:`folder-linux`,misc:`folder-other`,miscellaneous:`folder-other`,mjml:`folder-mjml`,mjs:`folder-javascript`,mobile:`folder-mobile`,mobiles:`folder-mobile`,mock:`folder-mock`,mocks:`folder-mock`,mod:`folder-plugin`,modding:`folder-plugin`,model:`folder-class`,models:`folder-class`,moderator:`folder-admin`,moderators:`folder-admin`,mods:`folder-plugin`,module:`folder-plugin`,modules:`folder-plugin`,mojo:`folder-mojo`,molecule:`folder-molecule`,molecules:`folder-molecule`,moon:`folder-moon`,motion:`folder-animation`,motions:`folder-animation`,movie:`folder-video`,movies:`folder-video`,mq:`folder-queue`,mts:`folder-typescript`,music:`folder-audio`,navigation:`folder-routes`,navigations:`folder-routes`,netlify:`folder-netlify`,news:`folder-docs`,next:`folder-next`,nginx:`folder-nginx`,node:`folder-node`,node_modules:`folder-node`,nodejs:`folder-node`,note:`folder-docs`,notebook:`folder-jupyter`,notebooks:`folder-jupyter`,notes:`folder-docs`,now:`folder-vercel`,nuxt:`folder-nuxt`,"nyc-output":`folder-coverage`,nyc_output:`folder-coverage`,obsidian:`folder-obsidian`,opencode:`folder-opencode`,option:`folder-config`,options:`folder-config`,organism:`folder-organism`,organisms:`folder-organism`,osx:`folder-macos`,other:`folder-other`,others:`folder-other`,out:`folder-dist`,output:`folder-dist`,outputs:`folder-dist`,package:`folder-packages`,packages:`folder-packages`,pact:`folder-contract`,pacts:`folder-contract`,page:`folder-views`,pages:`folder-views`,palette:`folder-theme`,palettes:`folder-theme`,partial:`folder-include`,partials:`folder-include`,patches:`folder-git`,pdf:`folder-pdf`,pdfs:`folder-pdf`,"pdm-build":`folder-pdm`,"pdm-plugins":`folder-pdm`,perf:`folder-benchmark`,performance:`folder-benchmark`,phone:`folder-mobile`,phones:`folder-mobile`,photo:`folder-images`,photograph:`folder-images`,photographs:`folder-images`,photos:`folder-images`,php:`folder-php`,phpmailer:`folder-phpmailer`,pic:`folder-images`,pics:`folder-images`,picture:`folder-images`,pictures:`folder-images`,pipe:`folder-pipe`,pipeline:`folder-pipe`,pipelines:`folder-pipe`,pipes:`folder-pipe`,pkg:`folder-packages`,pkgs:`folder-packages`,plastic:`folder-plastic`,playground:`folder-sandbox`,playgrounds:`folder-sandbox`,playlist:`folder-audio`,playlists:`folder-audio`,plugin:`folder-plugin`,plugins:`folder-plugin`,policies:`folder-policy`,policy:`folder-policy`,popos:`folder-linux`,portability:`folder-mobile`,portable:`folder-mobile`,post:`folder-docs`,postman:`folder-postman`,posts:`folder-docs`,powershell:`folder-powershell`,pref:`folder-config`,preference:`folder-config`,preferences:`folder-config`,prefs:`folder-config`,presentation:`folder-ui`,preview:`folder-review`,previews:`folder-review`,prisma:`folder-prisma`,"prisma/schema":`folder-prisma`,private:`folder-private`,profiling:`folder-benchmark`,proj:`folder-project`,project:`folder-project`,projects:`folder-project`,projs:`folder-project`,prompt:`folder-prompts`,prompts:`folder-prompts`,properties:`folder-config`,props:`folder-config`,proto:`folder-proto`,protobuf:`folder-proto`,protobufs:`folder-proto`,protos:`folder-proto`,provider:`folder-controller`,providers:`folder-controller`,proxy:`folder-public`,ps:`folder-powershell`,ps1:`folder-powershell`,ps4:`folder-console`,ps5:`folder-console`,public:`folder-public`,public_html:`folder-views`,pwa:`folder-client`,pycache:`folder-python`,pytest_cache:`folder-python`,python:`folder-python`,pytorch:`folder-pytorch`,quasar:`folder-quasar`,queue:`folder-queue`,queues:`folder-queue`,r:`folder-r`,recordings:`folder-audio`,release:`folder-dist`,remote:`folder-connection`,remotes:`folder-connection`,repo:`folder-repository`,report:`folder-resource`,reports:`folder-resource`,repos:`folder-repository`,repositories:`folder-repository`,repository:`folder-repository`,res:`folder-resource`,resolver:`folder-resolver`,resolvers:`folder-resolver`,resource:`folder-resource`,resources:`folder-resource`,restapi:`folder-api`,review:`folder-review`,reviewed:`folder-review`,reviews:`folder-review`,revisal:`folder-review`,revisals:`folder-review`,robot:`folder-robot`,robots:`folder-robot`,router:`folder-routes`,routers:`folder-routes`,routes:`folder-routes`,routing:`folder-routes`,rule:`folder-rules`,rules:`folder-rules`,rust:`folder-rust`,salt:`folder-salt`,saltstack:`folder-salt`,sample:`folder-examples`,"sample-data":`folder-examples`,samples:`folder-examples`,sandbox:`folder-sandbox`,sandboxes:`folder-sandbox`,sass:`folder-sass`,scala:`folder-scala`,schema:`folder-class`,schemas:`folder-class`,sconf_temp:`folder-scons`,scons:`folder-scons`,scons_cache:`folder-scons`,screen:`folder-views`,screengrab:`folder-images`,screengrabs:`folder-images`,screens:`folder-views`,screenshot:`folder-images`,screenshots:`folder-images`,script:`folder-scripts`,scripting:`folder-scripts`,scripts:`folder-scripts`,scss:`folder-sass`,secret:`folder-keys`,secrets:`folder-keys`,secure:`folder-secure`,security:`folder-secure`,seed:`folder-seeders`,seeders:`folder-seeders`,seeding:`folder-seeders`,seeds:`folder-seeders`,server:`folder-server`,serverless:`folder-serverless`,serverpackages:`folder-packages`,servers:`folder-server`,service:`folder-controller`,services:`folder-controller`,setting:`folder-config`,settings:`folder-config`,shader:`folder-shader`,shaders:`folder-shader`,shared:`folder-shared`,shop:`folder-cart`,shopping:`folder-cart`,"shopping-cart":`folder-cart`,sim:`folder-simulations`,sims:`folder-simulations`,simulation:`folder-simulations`,simulations:`folder-simulations`,site:`folder-public`,sketch:`folder-mock`,sketches:`folder-mock`,skill:`folder-skills`,skills:`folder-skills`,smtp:`folder-mail`,snap:`folder-snapcraft`,snapcraft:`folder-snapcraft`,snapshots:`folder-test`,snippet:`folder-snippet`,snippets:`folder-snippet`,song:`folder-audio`,songs:`folder-audio`,sound:`folder-audio`,sounds:`folder-audio`,source:`folder-src`,sources:`folder-src`,spa:`folder-client`,spec:`folder-test`,specs:`folder-test`,spellcheck:`folder-syntax`,spellcheckers:`folder-syntax`,sql:`folder-database`,src:`folder-src`,"src-tauri":`folder-src-tauri`,srcs:`folder-src`,ssl:`folder-secure`,stack:`folder-stack`,stacks:`folder-stack`,start:`folder-home`,static:`folder-resource`,stencil:`folder-stencil`,store:`folder-store`,stores:`folder-store`,stories:`folder-storybook`,storybook:`folder-storybook`,style:`folder-css`,styles:`folder-css`,stylesheet:`folder-css`,stylesheets:`folder-css`,stylus:`folder-stylus`,sublime:`folder-sublime`,submodules:`folder-git`,supabase:`folder-supabase`,svelte:`folder-svelte`,"svelte-kit":`folder-svelte`,svg:`folder-svg`,svgs:`folder-svg`,switch:`folder-console`,syntax:`folder-syntax`,syntaxes:`folder-syntax`,"table-of-contents":`folder-toc`,target:`folder-target`,taskfile:`folder-taskfile`,taskfiles:`folder-taskfile`,tasks:`folder-tasks`,television:`folder-television`,temp:`folder-temp`,template:`folder-template`,templates:`folder-template`,terraform:`folder-terraform`,test:`folder-test`,testfiles:`folder-test`,testing:`folder-test`,tests:`folder-test`,texture:`folder-images`,textures:`folder-images`,theme:`folder-theme`,themes:`folder-theme`,"third-party":`folder-lib`,thirdparty:`folder-lib`,tickets:`folder-tasks`,tls:`folder-secure`,tmp:`folder-temp`,toc:`folder-toc`,token:`folder-keys`,tokens:`folder-keys`,toolbox:`folder-tools`,toolboxes:`folder-tools`,tooling:`folder-tools`,toolkit:`folder-tools`,toolkits:`folder-tools`,tools:`folder-tools`,torch:`folder-pytorch`,transition:`folder-animation`,transitions:`folder-animation`,translate:`folder-i18n`,translation:`folder-i18n`,translations:`folder-i18n`,trash:`folder-trash`,trigger:`folder-trigger`,triggers:`folder-trigger`,ts:`folder-typescript`,turbo:`folder-turborepo`,tv:`folder-television`,tx:`folder-i18n`,typeface:`folder-font`,typefaces:`folder-font`,types:`folder-typescript`,typescript:`folder-typescript`,typings:`folder-typescript`,ubuntu:`folder-linux`,ui:`folder-ui`,unity:`folder-unity`,unix:`folder-linux`,update:`folder-update`,updates:`folder-update`,upgrade:`folder-update`,upgrades:`folder-update`,upload:`folder-upload`,uploads:`folder-upload`,util:`folder-utils`,utilities:`folder-utils`,utility:`folder-utils`,utils:`folder-utils`,ux:`folder-ui`,validation:`folder-rules`,validations:`folder-rules`,validator:`folder-rules`,validators:`folder-rules`,vector:`folder-svg`,vectors:`folder-svg`,vendor:`folder-lib`,vendors:`folder-lib`,venv:`folder-environment`,vercel:`folder-vercel`,verdaccio:`folder-verdaccio`,vid:`folder-video`,video:`folder-video`,videos:`folder-video`,vids:`folder-video`,view:`folder-views`,views:`folder-views`,vm:`folder-vm`,vms:`folder-vm`,voice:`folder-audio`,voices:`folder-audio`,vscode:`folder-vscode`,"vscode-test":`folder-vscode`,vue:`folder-vue`,vuepress:`folder-vuepress`,wakatime:`folder-wakatime`,web:`folder-public`,webpack:`folder-webpack`,website:`folder-public`,websites:`folder-public`,widget:`folder-components`,widgets:`folder-components`,wiki:`folder-docs`,win:`folder-windows`,win10:`folder-windows`,win11:`folder-windows`,win32:`folder-windows`,windows:`folder-windows`,windows10:`folder-windows`,windows11:`folder-windows`,windowsnt:`folder-windows`,windowsxp:`folder-windows`,winnt:`folder-windows`,winxp:`folder-windows`,"wordpress-org":`folder-wordpress`,"wp-content":`folder-wordpress`,wsl:`folder-linux`,www:`folder-public`,wwwroot:`folder-public`,xbox:`folder-console`,xtask:`folder-scripts`,yarn:`folder-yarn`,zeabur:`folder-zeabur`,zed:`folder-zed`},ja={".autorc":`auto_light`,".browserslistrc":`browserlist_light`,".bun-version":`bun_light`,".codeclimate.yml":`code-climate_light`,".config/releaserc":`semantic-release_light`,".config/releaserc.cjs":`semantic-release_light`,".config/releaserc.cts":`semantic-release_light`,".config/releaserc.js":`semantic-release_light`,".config/releaserc.json":`semantic-release_light`,".config/releaserc.json5":`semantic-release_light`,".config/releaserc.jsonc":`semantic-release_light`,".config/releaserc.mjs":`semantic-release_light`,".config/releaserc.mts":`semantic-release_light`,".config/releaserc.toml":`semantic-release_light`,".config/releaserc.ts":`semantic-release_light`,".config/releaserc.yaml":`semantic-release_light`,".config/releaserc.yml":`semantic-release_light`,".config/stylelintrc":`stylelint_light`,".config/stylelintrc.cjs":`stylelint_light`,".config/stylelintrc.cts":`stylelint_light`,".config/stylelintrc.js":`stylelint_light`,".config/stylelintrc.json":`stylelint_light`,".config/stylelintrc.json5":`stylelint_light`,".config/stylelintrc.jsonc":`stylelint_light`,".config/stylelintrc.mjs":`stylelint_light`,".config/stylelintrc.mts":`stylelint_light`,".config/stylelintrc.toml":`stylelint_light`,".config/stylelintrc.ts":`stylelint_light`,".config/stylelintrc.yaml":`stylelint_light`,".config/stylelintrc.yml":`stylelint_light`,".copilotignore":`copilot_light`,".cursor":`cursor_light`,".cursor.json":`cursor_light`,".cursorignore":`cursor_light`,".cursorindexingignore":`cursor_light`,".cursorrc":`cursor_light`,".cursorrules":`cursor_light`,".drone.yml":`drone_light`,".easignore":`expo_light`,".nano-staged.cjs":`nano-staged_light`,".nano-staged.js":`nano-staged_light`,".nano-staged.json":`nano-staged_light`,".nano-staged.mjs":`nano-staged_light`,".nanostagedrc":`nano-staged_light`,".nowignore":`vercel_light`,".pnpmfile.cjs":`pnpm_light`,".releaserc":`semantic-release_light`,".releaserc.cjs":`semantic-release_light`,".releaserc.cts":`semantic-release_light`,".releaserc.js":`semantic-release_light`,".releaserc.json":`semantic-release_light`,".releaserc.json5":`semantic-release_light`,".releaserc.jsonc":`semantic-release_light`,".releaserc.mjs":`semantic-release_light`,".releaserc.mts":`semantic-release_light`,".releaserc.toml":`semantic-release_light`,".releaserc.ts":`semantic-release_light`,".releaserc.yaml":`semantic-release_light`,".releaserc.yml":`semantic-release_light`,".rubocop-todo.yml":`rubocop_light`,".rubocop.yml":`rubocop_light`,".rubocop_todo.yml":`rubocop_light`,".shellcheckrc":`shellcheck_light`,".stylelintcache":`stylelint_light`,".stylelintignore":`stylelint_light`,".stylelintrc":`stylelint_light`,".stylelintrc.cjs":`stylelint_light`,".stylelintrc.cts":`stylelint_light`,".stylelintrc.js":`stylelint_light`,".stylelintrc.json":`stylelint_light`,".stylelintrc.json5":`stylelint_light`,".stylelintrc.jsonc":`stylelint_light`,".stylelintrc.mjs":`stylelint_light`,".stylelintrc.mts":`stylelint_light`,".stylelintrc.toml":`stylelint_light`,".stylelintrc.ts":`stylelint_light`,".stylelintrc.yaml":`stylelint_light`,".stylelintrc.yml":`stylelint_light`,".vercelignore":`vercel_light`,".wakatime-project":`wakatime_light`,"auto-config.js":`auto_light`,"auto-config.json":`auto_light`,"auto-config.ts":`auto_light`,"auto-config.yaml":`auto_light`,"auto-config.yml":`auto_light`,"auto.config.js":`auto_light`,"auto.config.ts":`auto_light`,browserslist:`browserlist_light`,"bun.lock":`bun_light`,"bun.lockb":`bun_light`,"bunfig.toml":`bun_light`,"circle.yml":`circleci_light`,"copilot-instructions.md":`copilot_light`,"deno.json":`deno_light`,"deno.jsonc":`deno_light`,"deno.lock":`deno_light`,"eas.json":`expo_light`,hosts:`hosts_light`,"jsr.json":`jsr_light`,"jsr.jsonc":`jsr_light`,"nano-staged.cjs":`nano-staged_light`,"nano-staged.js":`nano-staged_light`,"nano-staged.json":`nano-staged_light`,"nano-staged.mjs":`nano-staged_light`,"netlify.json":`netlify_light`,"netlify.toml":`netlify_light`,"netlify.yaml":`netlify_light`,"netlify.yml":`netlify_light`,"next.config.js":`next_light`,"next.config.mjs":`next_light`,"next.config.mts":`next_light`,"next.config.ts":`next_light`,"now.json":`vercel_light`,"openapi.json":`openapi_light`,"openapi.yaml":`openapi_light`,"openapi.yml":`openapi_light`,"opencode.json":`opencode_light`,"opencode.jsonc":`opencode_light`,"payload.config.js":`payload_light`,"payload.config.mjs":`payload_light`,"payload.config.mts":`payload_light`,"payload.config.ts":`payload_light`,"pnpm-lock.yaml":`pnpm_light`,"pnpm-workspace.yaml":`pnpm_light`,"release.config.cjs":`semantic-release_light`,"release.config.cts":`semantic-release_light`,"release.config.js":`semantic-release_light`,"release.config.json":`semantic-release_light`,"release.config.json5":`semantic-release_light`,"release.config.jsonc":`semantic-release_light`,"release.config.mjs":`semantic-release_light`,"release.config.mts":`semantic-release_light`,"release.config.toml":`semantic-release_light`,"release.config.ts":`semantic-release_light`,"release.config.yaml":`semantic-release_light`,"release.config.yml":`semantic-release_light`,"remix.config.js":`remix_light`,"remix.config.ts":`remix_light`,sconscript:`scons_light`,sconstruct:`scons_light`,scsub:`scons_light`,shellcheckrc:`shellcheck_light`,"snowpack.config.cjs":`snowpack_light`,"snowpack.config.cts":`snowpack_light`,"snowpack.config.js":`snowpack_light`,"snowpack.config.json":`snowpack_light`,"snowpack.config.mjs":`snowpack_light`,"snowpack.config.mts":`snowpack_light`,"snowpack.config.ts":`snowpack_light`,"snowpack.deps.json":`snowpack_light`,"stitches.config.js":`stitches_light`,"stitches.config.ts":`stitches_light`,"stylelint.config.cjs":`stylelint_light`,"stylelint.config.cts":`stylelint_light`,"stylelint.config.js":`stylelint_light`,"stylelint.config.json":`stylelint_light`,"stylelint.config.json5":`stylelint_light`,"stylelint.config.jsonc":`stylelint_light`,"stylelint.config.mjs":`stylelint_light`,"stylelint.config.mts":`stylelint_light`,"stylelint.config.toml":`stylelint_light`,"stylelint.config.ts":`stylelint_light`,"stylelint.config.yaml":`stylelint_light`,"stylelint.config.yml":`stylelint_light`,"turbo.json":`turborepo_light`,"turbo.jsonc":`turborepo_light`,"vercel.json":`vercel_light`,"vercel.ts":`vercel_light`,"warp.md":`warp_light`,"zeabur.json":`zeabur_light`,"zeabur.json5":`zeabur_light`,"zeabur.jsonc":`zeabur_light`,"zeabur.toml":`zeabur_light`,"zeabur.yaml":`zeabur_light`,"zeabur.yml":`zeabur_light`},Ma={".wakatime-project":`wakatime_light`,ai:`adobe-illustrator_light`,ait:`adobe-illustrator_light`,blink:`blink_light`,cr:`crystal_light`,"drone.yml":`drone_light`,ecr:`crystal_light`,fen:`chess_light`,hcl:`hcl_light`,huff:`huff_light`,iuml:`uml_light`,j2:`jinja_light`,jinja:`jinja_light`,"jinja-html":`jinja_light`,jinja2:`jinja_light`,"openapi.json":`openapi_light`,"openapi.yaml":`openapi_light`,"openapi.yml":`openapi_light`,pgn:`chess_light`,plantuml:`uml_light`,psb:`adobe-photoshop_light`,psd:`adobe-photoshop_light`,psdt:`adobe-photoshop_light`,pu:`uml_light`,puml:`uml_light`,tldr:`tldraw_light`,tofu:`opentofu_light`,toml:`toml_light`,verse:`verse_light`,wsd:`uml_light`,zeabur:`zeabur_light`},Na={"-cursor":`folder-cursor_light`,"-idea":`folder-intellij_light`,"-j2":`folder-jinja_light`,"-jinja":`folder-jinja_light`,"-jinja2":`folder-jinja_light`,".cursor":`folder-cursor_light`,".idea":`folder-intellij_light`,".j2":`folder-jinja_light`,".jinja":`folder-jinja_light`,".jinja2":`folder-jinja_light`,__cursor__:`folder-cursor_light`,__idea__:`folder-intellij_light`,__j2__:`folder-jinja_light`,__jinja2__:`folder-jinja_light`,__jinja__:`folder-jinja_light`,_cursor:`folder-cursor_light`,_idea:`folder-intellij_light`,_j2:`folder-jinja_light`,_jinja:`folder-jinja_light`,_jinja2:`folder-jinja_light`,cursor:`folder-cursor_light`,idea:`folder-intellij_light`,j2:`folder-jinja_light`,jinja:`folder-jinja_light`,jinja2:`folder-jinja_light`},Pa={pug:``,just:``,json:``,playwright:``,xml:``,javascript:``,rocket:``,routing:``,settings:``,typedoc:``,"markdoc-config":``,"astro-config":``,visualstudio:``,"go-mod":``,"python-misc":``,ruff:``,uv:``,scons:``,console:``,excalidraw:``,gradle:``,license:``,unlicense:``,key:``,keystatic:``,ruby:``,gemfile:``,rubocop:``,rspec:``,swift:``,docker:``,latexmk:``,email:``,graphql:``,xaml:``,happo:``,chromatic:``,git:``,lua:``,r:``,dart:``,cmake:``,semgrep:``,"vue-config":``,nuxt:``,harmonix:``,lock:``,angular:``,mjml:``,vercel:``,liara:``,verdaccio:``,payload:``,next:``,remark:``,remix:``,laravel:``,vfl:``,kl:``,postcss:``,posthtml:``,todo:``,cabal:``,http:``,graphcool:``,webpack:``,rstack:``,lynx:``,ionic:``,gulp:``,nodejs:``,npm:``,yarn:``,android:``,tune:``,turborepo:``,babel:``,blitz:``,contributing:``,readme:``,changelog:``,architecture:``,credits:``,authors:``,flow:``,favicon:``,karma:``,bithound:``,svgo:``,appveyor:``,travis:``,codecov:``,sonarcloud:``,protractor:``,fusebox:``,heroku:``,editorconfig:``,bower:``,eslint:``,conduct:``,watchman:``,aurelia:``,auto:``,mocha:``,jenkins:``,firebase:``,rollup:``,hack:``,hardhat:``,stylelint:``,"code-climate":``,prettier:``,renovate:``,apollo:``,nodemon:``,webhint:``,browserlist:``,snyk:``,drone:``,opencode:``,sequelize:``,gatsby:``,wakatime:``,circleci:``,cloudfoundry:``,grunt:``,jest:``,fastlane:``,helm:``,wallaby:``,stencil:``,makefile:``,"semantic-release":``,bitbucket:``,bazel:``,"godot-assets":``,"azure-pipelines":``,vagrant:``,prisma:``,istanbul:``,tailwindcss:``,buildkite:``,netlify:``,svelte:``,nest:``,moon:``,percy:``,gitpod:``,stackblitz:``,codeowners:``,gcp:``,amplify:``,husky:``,tilt:``,capacitor:``,adonis:``,meson:``,commitizen:``,commitlint:``,buck:``,nx:``,dune:``,roadmap:``,nuget:``,stryker:``,modernizr:``,slug:``,stitches:``,nginx:``,minecraft:``,replit:``,duc:``,snowpack:``,quasar:``,dependabot:``,vite:``,vitest:``,velite:``,rolldown:``,lerna:``,windicss:``,textlint:``,vlang:``,sentry:``,contentlayer:``,phpunit:``,"php-cs-fixer":``,robots:``,tsconfig:``,tauri:``,jsconfig:``,maven:``,serverless:``,supabase:``,ember:``,horusec:``,poetry:``,pdm:``,parcel:``,astyle:``,lighthouse:``,svgr:``,rome:``,cypress:``,plop:``,tobimake:``,gleam:``,pnpm:``,gridsome:``,steadybit:``,caddy:``,openapi:``,swagger:``,bun:``,"nano-staged":``,knip:``,taskfile:``,craco:``,mercurial:``,deno:``,plastic:``,typst:``,unocss:``,"ifanr-cloud":``,concourse:``,syncpack:``,werf:``,luau:``,wally:``,panda:``,biome:``,esbuild:``,drizzle:``,puppeteer:``,garden:``,pkl:``,kubernetes:``,phpstan:``,screwdriver:``,snapcraft:``,kcl:``,clangd:``,markdownlint:``,trigger:``,deepsource:``,jsr:``,"coderabbit-ai":``,"gemini-ai":``,taze:``,wxt:``,lefthook:``,label:``,zeabur:``,copilot:``,"pre-commit":``,lintstaged:``,histoire:``,installation:``,"github-sponsors":``,"minecraft-fabric":``,umi:``,"pm2-ecosystem":``,hosts:``,citation:``,xmake:``,wrangler:``,cline:``,packship:``,snakemake:``,hadolint:``,tsdoc:``,oxc:``,claude:``,cursor:``,metro:``,bashly:``,google:``,shellcheck:``,warp:``,skill:``,tsdown:``,appwrite:``,expo:``,slint:``,html:``,markdown:``,blink:``,css:``,sass:``,less:``,json_schema:``,hjson:``,jinja:``,proto:``,prompt:``,sublime:``,simulink:``,quarto:``,twine:``,yaml:``,toml:``,toon:``,image:``,palette:``,react:``,react_ts:``,typescript:``,"typescript-def":``,markdoc:``,markojs:``,astro:``,pdf:``,table:``,vscode:``,varnish:``,database:``,kusto:``,csharp:``,qsharp:``,zip:``,vala:``,zig:``,exe:``,hex:``,java:``,jar:``,javaclass:``,c3:``,c:``,h:``,hip:``,cpp:``,hpp:``,"objective-c":``,"objective-cpp":``,rc:``,go:``,python:``,url:``,powershell:``,word:``,certificate:``,font:``,lib:``,bibliography:``,"bibtex-style":``,dll:``,fsharp:``,arduino:``,tex:``,context:``,"doctex-installer":``,bbx:``,cbx:``,lbx:``,powerpoint:``,video:``,virtual:``,vedic:``,audio:``,coffee:``,document:``,lyric:``,rust:``,raml:``,haskell:``,kotlin:``,otne:``,diff:``,clojure:``,groovy:``,dart_generated:``,actionscript:``,mxml:``,autohotkey:``,flash:``,"adobe-swc":``,swc:``,assembly:``,vue:``,ocaml:``,odin:``,onnx:``,"javascript-map":``,"css-map":``,handlebars:``,perl:``,haxe:``,"test-ts":``,"test-jsx":``,"test-js":``,puppet:``,elixir:``,livescript:``,erlang:``,twig:``,julia:``,elm:``,purescript:``,smarty:``,stylus:``,reason:``,bucklescript:``,merlin:``,verilog:``,mathematica:``,wolframlanguage:``,nunjucks:``,robot:``,solidity:``,autoit:``,haml:``,yang:``,terraform:``,opentofu:``,applescript:``,cake:``,cucumber:``,nim:``,apiblueprint:``,riot:``,coldfusion:``,nix:``,slim:``,restql:``,kivy:``,sbt:``,gitlab:``,figma:``,huff:``,crystal:``,cuda:``,log:``,dotjs:``,ejs:``,processing:``,storybook:``,wepy:``,hcl:``,san:``,quokka:``,django:``,red:``,foxpro:``,i18n:``,webassembly:``,jupyter:``,d:``,mdx:``,mdsvex:``,ballerina:``,racket:``,mint:``,velocity:``,godot:``,azure:``,razor:``,abc:``,asciidoc:``,edge:``,scheme:``,lisp:``,"3d":``,svg:``,"adobe-illustrator":``,"adobe-photoshop":``,vim:``,moonscript:``,advpl:``,disc:``,fortran:``,tcl:``,liquid:``,prolog:``,coconut:``,sketch:``,pawn:``,forth:``,uml:``,dhall:``,sml:``,opam:``,imba:``,drawio:``,pascal:``,unity:``,sas:``,command:``,denizenscript:``,search:``,rescript:``,"rescript-interface":``,brainfuck:``,bicep:``,cobol:``,grain:``,lolcode:``,idris:``,pipeline:``,opa:``,scala:``,lilypond:``,chess:``,gemini:``,php:``,ada:``,coala:``,dinophp:``,teal:``,template:``,shader:``,siyuan:``,ndst:``,tobi:``,capnp:``,tree:``,cadence:``,antlr:``,stylable:``,pinejs:``,gamemaker:``,tldraw:``,mermaid:``,mojo:``,roblox:``,rbxmk:``,spwn:``,templ:``,chrome:``,stan:``,abap:``,lottie:``,"apps-script":``,verified:``,bruno:``,cairo:``,"grafana-alloy":``,freemarker:``,tsil:``,hurl:``,cds:``,verse:``,sway:``,"bench-ts":``,"bench-jsx":``,"bench-js":``,controller:``,"dependencies-update":``,subtitles:``,beancount:``,epub:``,regedit:``,gnuplot:``,coloredpetrinets:``,pytorch:``,blender:``,"vanilla-extract":``,toc:``,cue:``,lean:``,salt:``,macaulay2:``,uiua:``,mrpack:``,"folder-rust":``,"folder-robot":``,"folder-src":``,"folder-dist":``,"folder-css":``,"folder-sass":``,"folder-television":``,"folder-desktop":``,"folder-console":``,"folder-images":``,"folder-scripts":``,"folder-node":``,"folder-javascript":``,"folder-json":``,"folder-font":``,"folder-bower":``,"folder-test":``,"folder-directive":``,"folder-jinja":``,"folder-markdown":``,"folder-pdm":``,"folder-php":``,"folder-phpmailer":``,"folder-sublime":``,"folder-docs":``,"folder-gh-workflows":``,"folder-git":``,"folder-github":``,"folder-gitea":``,"folder-gitlab":``,"folder-forgejo":``,"folder-vscode":``,"folder-views":``,"folder-vue":``,"folder-vuepress":``,"folder-expo":``,"folder-config":``,"folder-i18n":``,"folder-components":``,"folder-verdaccio":``,"folder-aurelia":``,"folder-resource":``,"folder-lib":``,"folder-theme":``,"folder-webpack":``,"folder-global":``,"folder-public":``,"folder-include":``,"folder-docker":``,"folder-nginx":``,"folder-astro":``,"folder-database":``,"folder-migrations":``,"folder-log":``,"folder-target":``,"folder-temp":``,"folder-aws":``,"folder-audio":``,"folder-video":``,"folder-kubernetes":``,"folder-import":``,"folder-export":``,"folder-wakatime":``,"folder-circleci":``,"folder-wordpress":``,"folder-gradle":``,"folder-coverage":``,"folder-class":``,"folder-other":``,"folder-lua":``,"folder-turborepo":``,"folder-typescript":``,"folder-graphql":``,"folder-routes":``,"folder-ci":``,"folder-eslint":``,"folder-benchmark":``,"folder-messages":``,"folder-less":``,"folder-gulp":``,"folder-python":``,"folder-r":``,"folder-sandbox":``,"folder-scons":``,"folder-mojo":``,"folder-moon":``,"folder-debug":``,"folder-fastlane":``,"folder-plugin":``,"folder-middleware":``,"folder-controller":``,"folder-ansible":``,"folder-server":``,"folder-client":``,"folder-tasks":``,"folder-android":``,"folder-ios":``,"folder-ui":``,"folder-upload":``,"folder-download":``,"folder-tools":``,"folder-helper":``,"folder-serverless":``,"folder-api":``,"folder-app":``,"folder-apollo":``,"folder-archive":``,"folder-backup":``,"folder-batch":``,"folder-buildkite":``,"folder-cluster":``,"folder-command":``,"folder-constant":``,"folder-container":``,"folder-content":``,"folder-context":``,"folder-core":``,"folder-delta":``,"folder-dump":``,"folder-examples":``,"folder-environment":``,"folder-functions":``,"folder-generator":``,"folder-hook":``,"folder-trigger":``,"folder-job":``,"folder-keys":``,"folder-layout":``,"folder-mail":``,"folder-mappings":``,"folder-meta":``,"folder-changesets":``,"folder-packages":``,"folder-shared":``,"folder-shader":``,"folder-stack":``,"folder-template":``,"folder-utils":``,"folder-supabase":``,"folder-private":``,"folder-linux":``,"folder-windows":``,"folder-macos":``,"folder-error":``,"folder-event":``,"folder-secure":``,"folder-custom":``,"folder-mock":``,"folder-syntax":``,"folder-vm":``,"folder-stylus":``,"folder-flow":``,"folder-rules":``,"folder-review":``,"folder-animation":``,"folder-guard":``,"folder-prisma":``,"folder-pipe":``,"folder-interceptor":``,"folder-svg":``,"folder-nuxt":``,"folder-terraform":``,"folder-mobile":``,"folder-stencil":``,"folder-firebase":``,"folder-firestore":``,"folder-cloud-functions":``,"folder-svelte":``,"folder-update":``,"folder-intellij":``,"folder-azure-pipelines":``,"folder-mjml":``,"folder-admin":``,"folder-jupyter":``,"folder-scala":``,"folder-connection":``,"folder-quasar":``,"folder-next":``,"folder-dal":``,"folder-cobol":``,"folder-yarn":``,"folder-husky":``,"folder-storybook":``,"folder-base":``,"folder-cart":``,"folder-home":``,"folder-project":``,"folder-prompts":``,"folder-interface":``,"folder-netlify":``,"folder-enum":``,"folder-contract":``,"folder-helm":``,"folder-queue":``,"folder-vercel":``,"folder-cypress":``,"folder-decorators":``,"folder-java":``,"folder-resolver":``,"folder-angular":``,"folder-unity":``,"folder-pdf":``,"folder-proto":``,"folder-plastic":``,"folder-gamemaker":``,"folder-mercurial":``,"folder-godot":``,"folder-lottie":``,"folder-taskfile":``,"folder-drizzle":``,"folder-cloudflare":``,"folder-seeders":``,"folder-store":``,"folder-bicep":``,"folder-snapcraft":``,"folder-flutter":``,"folder-snippet":``,"folder-element":``,"folder-src-tauri":``,"folder-favicon":``,"folder-features":``,"folder-lefthook":``,"folder-bloc":``,"folder-powershell":``,"folder-repository":``,"folder-luau":``,"folder-obsidian":``,"folder-trash":``,"folder-cline":``,"folder-liquibase":``,"folder-dart":``,"folder-zeabur":``,"folder-kusto":``,"folder-policy":``,"folder-attachment":``,"folder-bibliography":``,"folder-link":``,"folder-pytorch":``,"folder-blender":``,"folder-atom":``,"folder-molecule":``,"folder-organism":``,"folder-claude":``,"folder-cursor":``,"folder-gemini-ai":``,"folder-opencode":``,"folder-input":``,"folder-salt":``,"folder-simulations":``,"folder-metro":``,"folder-filter":``,"folder-toc":``,"folder-cue":``,"folder-license":``,"folder-form":``,"folder-postman":``,"folder-skills":``,"folder-zed":``,"folder-appwrite":``,"folder-assembly":``,"folder-go":``,"folder-kotlin":``,file:``,folder:``,scons_light:``,rubocop_light:``,vercel_light:``,payload_light:``,next_light:``,remix_light:``,turborepo_light:``,auto_light:``,stylelint_light:``,"code-climate_light":``,browserlist_light:``,drone_light:``,opencode_light:``,wakatime_light:``,circleci_light:``,"semantic-release_light":``,netlify_light:``,stitches_light:``,snowpack_light:``,pnpm_light:``,openapi_light:``,bun_light:``,"nano-staged_light":``,deno_light:``,jsr_light:``,zeabur_light:``,copilot_light:``,hosts_light:``,cursor_light:``,shellcheck_light:``,warp_light:``,expo_light:``,blink_light:``,jinja_light:``,toml_light:``,opentofu_light:``,huff_light:``,crystal_light:``,hcl_light:``,"adobe-illustrator_light":``,"adobe-photoshop_light":``,uml_light:``,chess_light:``,tldraw_light:``,verse_light:``,"folder-jinja_light":``,"folder-intellij_light":``,"folder-cursor_light":``};function Fa(e,t){return Object.hasOwn(e,t)}function Ia(e,t,n,r){let i=e[n];return!r||!Fa(t,n)?i:t[n]}function La(){return typeof window<`u`&&typeof window.matchMedia!=`function`?!1:!Da().value}function Ra(e,t){let n=e.toLowerCase();if(Fa(Oa,e))return Ia(Oa,ja,e,t);if(Fa(Oa,n))return Ia(Oa,ja,n,t)}function za(e,t){let n=e.toLowerCase().split(`.`);for(let e=1;ee.length>0).at(-1)??e}function Ha(e){return e.replaceAll(/\s(?:width|height)="[^"]*"/g,``).replace(/^
\n`;let n=e.attrIndex(`class`),a=e.attrs?e.attrs.slice():[],o=`${i.langPrefix??`language-`}${r}`;return n<0?a.push([`class`,o]):(a[n]=a[n].slice(),a[n][1]+=` ${o}`),`
${t}
\n`}return`
${t}
\n`}function qF(e){return!e.attrs||e.attrs.length===0?`${jP(e.content)}`:`${jP(e.content)}`}function JF(e){let t=jP(e.content);return e.attrs?`${t}
\n`:`
${t}
\n`}function YF(e,t){let n=e.attrs;if(!n||n.length===0)switch(e.type){case`paragraph_open`:return`${t}

`;case`heading_open`:return`<${e.tag}>`;case`td_open`:return`${t}`;case`th_open`:return`${t}`;default:return null}if(n.length===1&&n[0][0]===`style`){if(e.type===`td_open`)return`${t}`;if(e.type===`th_open`)return`${t}`}return null}function XF(e){let t=e.attrs;return!t||t.length===0?``:t.length===1?``:t.length===2?``:``}function ZF(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:case`image`:return!0;default:return!1}}function QF(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:return!0;default:return!1}}function $F(e,t){if(e.hidden)return``;let n=e.attrs,r=e.nesting,i=e.tag;if(!n||n.length===0)return r===0?t?`<${i} />`:`<${i}>`:r===-1?``:`<${i}>`;let a=(r===-1?``}var eI={langPrefix:`language-`,xhtmlOut:!1,breaks:!1},tI=Object.prototype.hasOwnProperty,nI={code_inline(e,t){return qF(e[t])},code_block(e,t){return JF(e[t])},fence(e,t,n,r,i){let a=e[t],o=a.info?PP(a.info).trim():``,{langName:s,langAttrs:c}=GF(o),l=n.highlight,u=jP(a.content);if(!l)return KF(a,u,o,s,n);let d=l(a.content,s,c);return BF(d)?d.then(e=>KF(a,e||u,o,s,n)):KF(a,d||u,o,s,n)},image(e,t,n,r,i){let a=e[t],o=i.renderInlineAsText(a.children||[],n,r),s=a.attrIndex(`alt`);return s>=0&&a.attrs?a.attrs[s][1]=o:a.attrs?a.attrs.push([`alt`,o]):a.attrs=[[`alt`,o]],$F(a,n.xhtmlOut===!0)},hardbreak(e,t,n){return n.xhtmlOut?`
+`}function koe(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),`

  • `}function Aoe(){return`
  • +`}function joe(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),` \u21a9\uFE0E`}function Moe(e){let t=e.helpers.parseLinkLabel,n=e.utils.isSpace;e.renderer.rules.footnote_ref=Eoe,e.renderer.rules.footnote_block_open=Doe,e.renderer.rules.footnote_block_close=Ooe,e.renderer.rules.footnote_open=koe,e.renderer.rules.footnote_close=Aoe,e.renderer.rules.footnote_anchor=joe,e.renderer.rules.footnote_caption=Toe,e.renderer.rules.footnote_anchor_name=woe;function r(e,t,r,i){let a=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(a+4>o||e.src.charCodeAt(a)!==91||e.src.charCodeAt(a+1)!==94)return!1;let s;for(s=a+2;s=o||e.src.charCodeAt(++s)!==58)return!1;if(i)return!0;s++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={});let c=e.src.slice(a+2,s-2);e.env.footnotes.refs[`:${c}`]=-1;let l=new e.Token(`footnote_reference_open`,``,1);l.meta={label:c},l.level=e.level++,e.tokens.push(l);let u=e.bMarks[t],d=e.tShift[t],f=e.sCount[t],p=e.parentType,m=s,h=e.sCount[t]+s-(e.bMarks[t]+e.tShift[t]),g=h;for(;s=r||e.src.charCodeAt(i)!==94||e.src.charCodeAt(i+1)!==91)return!1;let a=i+2,o=t(e,i+1);if(o<0)return!1;if(!n){e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]);let t=e.env.footnotes.list.length,n=[];e.md.inline.parse(e.src.slice(a,o),e.md,e.env,n);let r=e.push(`footnote_ref`,``,0);r.meta={id:t},e.env.footnotes.list[t]={content:e.src.slice(a,o),tokens:n}}return e.pos=o+1,e.posMax=r,!0}function a(e,t){let n=e.posMax,r=e.pos;if(r+3>n||!e.env.footnotes||!e.env.footnotes.refs||e.src.charCodeAt(r)!==91||e.src.charCodeAt(r+1)!==94)return!1;let i;for(i=r+2;i=n)return!1;i++;let a=e.src.slice(r+2,i-1);if(e.env.footnotes.refs[`:${a}`]===void 0)return!1;if(!t){e.env.footnotes.list||(e.env.footnotes.list=[]);let t;e.env.footnotes.refs[`:${a}`]<0?(t=e.env.footnotes.list.length,e.env.footnotes.list[t]={label:a,count:0},e.env.footnotes.refs[`:${a}`]=t):t=e.env.footnotes.refs[`:${a}`];let n=e.env.footnotes.list[t].count;e.env.footnotes.list[t].count++;let r=e.push(`footnote_ref`,``,0);r.meta={id:t,subId:n,label:a}}return e.pos=i,e.posMax=n,!0}function o(e){let t,n,r,i=!1,a={};if(!e.env.footnotes||(e.tokens=e.tokens.filter(function(e){return e.type===`footnote_reference_open`?(i=!0,n=[],r=e.meta.label,!1):e.type===`footnote_reference_close`?(i=!1,a[`:`+r]=n,!1):(i&&n.push(e),!i)}),!e.env.footnotes.list))return;let o=e.env.footnotes.list;e.tokens.push(new e.Token(`footnote_block_open`,``,1));for(let n=0,r=o.length;n0?o[n].count:1;for(let t=0;t?@[\]^_`{|}~-])/g;function Ioe(e,t){let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==126||t||r+2>=n)return!1;e.pos=r+1;let i=!1;for(;e.pos?@[\]^_`{|}~-])/g;function zoe(e,t){let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==94||t||r+2>=n)return!1;e.pos=r+1;let i=!1;for(;e.pos{t.exports=function(e,t){t=Object.assign({},{disabled:!0,divWrap:!1,divClass:`checkbox`,idPrefix:`cbx_`,ulClass:`task-list`,liClass:`task-list-item`},t),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var o=e.tokens,s=0,c=2;c=0;r--)if(e[r].level===n)return r;return-1}function i(e,t){return d(e[t])&&f(e[t-1])&&p(e[t-2])&&m(e[t])}function a(e,t,n,r){var i=n.idPrefix+t;e.children[0].content=e.children[0].content.slice(3),e.children.unshift(s(i,r)),e.children.push(c(r)),e.children.unshift(o(e,i,n,r)),n.divWrap&&(e.children.unshift(l(n,r)),e.children.push(u(r)))}function o(e,t,n,r){var i=new r(`checkbox_input`,`input`,0);return i.attrs=[[`type`,`checkbox`],[`id`,t]],/^\[[xX]\][ \u00A0]/.test(e.content)===!0&&i.attrs.push([`checked`,`true`]),n.disabled===!0&&i.attrs.push([`disabled`,`true`]),i}function s(e,t){var n=new t(`label_open`,`label`,1);return n.attrs=[[`for`,e]],n}function c(e){return new e(`label_close`,`label`,-1)}function l(e,t){var n=new t(`checkbox_open`,`div`,0);return n.attrs=[[`class`,e.divClass]],n}function u(e){return new e(`checkbox_close`,`div`,-1)}function d(e){return e.type===`inline`}function f(e){return e.type===`paragraph_open`}function p(e){return e.type===`list_item_open`}function m(e){return/^\[[xX \u00A0]\][ \u00A0]/.test(e.content)}})}),Hoe=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),Uoe=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),Woe=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Goe=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function Koe(e){return e>=55296&&e<=57343||e>1114111?65533:Woe.get(e)??e}var LO;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(LO||={});var qoe=32,RO;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(RO||={});function zO(e){return e>=LO.ZERO&&e<=LO.NINE}function Joe(e){return e>=LO.UPPER_A&&e<=LO.UPPER_F||e>=LO.LOWER_A&&e<=LO.LOWER_F}function Yoe(e){return e>=LO.UPPER_A&&e<=LO.UPPER_Z||e>=LO.LOWER_A&&e<=LO.LOWER_Z||zO(e)}function Xoe(e){return e===LO.EQUALS||Yoe(e)}var BO;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(BO||={});var VO;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(VO||={});var Zoe=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=BO.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=VO.Strict}startEntity(e){this.decodeMode=e,this.state=BO.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case BO.EntityStart:return e.charCodeAt(t)===LO.NUM?(this.state=BO.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=BO.NamedEntity,this.stateNamedEntity(e,t));case BO.NumericStart:return this.stateNumericStart(e,t);case BO.NumericDecimal:return this.stateNumericDecimal(e,t);case BO.NumericHex:return this.stateNumericHex(e,t);case BO.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|qoe)===LO.LOWER_X?(this.state=BO.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=BO.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t>14;for(;t>14,i!==0){if(a===LO.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==VO.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&RO.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~RO.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case BO.NamedEntity:return this.result!==0&&(this.decodeMode!==VO.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case BO.NumericDecimal:return this.emitNumericEntity(0,2);case BO.NumericHex:return this.emitNumericEntity(0,3);case BO.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case BO.EntityStart:return 0}}};function HO(e){let t=``,n=new Zoe(e,e=>t+=Goe(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function Qoe(e,t,n,r){let i=(t&RO.BRANCH_LENGTH)>>7,a=t&RO.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(nr)s=t-1;else return e[t+i]}return-1}var $oe=HO(Hoe);HO(Uoe);function UO(e,t=VO.Legacy){return $oe(e,t)}var ese=IO(Voe(),1),WO={};function tse(e){let t=WO[e];if(t)return t;t=WO[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+91114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}GO.defaultChars=`;/?:@&=+$,#`,GO.componentChars=``;var KO=GO,qO={};function JO(e){let t=qO[e];if(t)return t;t=qO[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}YO.defaultChars=`;/?:@&=+$,-_.!~*'()#`,YO.componentChars=`-_.!~*'()`;var XO=YO;function ZO(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function QO(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var $O=/^([a-z0-9.+-]+:)/i,ek=/:[0-9]*$/,tk=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,nk=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,` +`,` `],rk=[`/`,`?`,`#`],ik=255,ak=/^[+a-z0-9A-Z_-]{0,63}$/,ok=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,sk={javascript:!0,"javascript:":!0},ck={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function lk(e,t){if(e&&e instanceof QO)return e;let n=new QO;return n.parse(e,t),n}QO.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=tk.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=$O.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&sk[o])&&(a=a.substr(2),this.slashes=!0)),!sk[o]&&(i||o&&!ck[o])){let e=-1;for(let t=0;t127?r+=`x`:r+=n[e];if(!r.match(ak)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(ok);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>ik&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),ck[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},QO.prototype.parseHost=function(e){let t=ek.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var uk=lk,dk=FO({decode:()=>KO,encode:()=>XO,format:()=>ZO,parse:()=>uk}),fk=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,pk=/[\0-\x1F\x7F-\x9F]/,mk=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,hk=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,gk=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,_k=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,vk=FO({Any:()=>fk,Cc:()=>pk,Cf:()=>mk,P:()=>hk,S:()=>gk,Z:()=>_k}),yk=Object.defineProperty,bk=e=>{let t={};for(var n in e)yk(t,n,{get:e[n],enumerable:!0});return t},xk=class{type;tag;attrs;map;nesting;level;children;content;markup;info;meta;block;hidden;constructor(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}attrIndex(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},Sk=bk({arrayReplaceAt:()=>Ik,assign:()=>Ok,countLines:()=>$k,escapeHtml:()=>Yk,escapeRE:()=>Zk,fromCodePoint:()=>Rk,has:()=>Dk,isMdAsciiPunct:()=>Pk,isPunctChar:()=>jk,isPunctCode:()=>Nk,isSpace:()=>kk,isString:()=>Tk,isValidEntityCode:()=>Lk,isWhiteSpace:()=>Ak,lib:()=>Qk,mdurl:()=>dk,normalizeReference:()=>Fk,ucmicro:()=>Ck,unescapeAll:()=>Wk,unescapeMd:()=>Uk}),Ck=vk;function wk(e){return Object.prototype.toString.call(e)}function Tk(e){return wk(e)===`[object String]`}var Ek=Object.prototype.hasOwnProperty;function Dk(e,t){return Ek.call(e,t)}function Ok(e,...t){return t.forEach(t=>{if(t){if(typeof t!=`object`)throw TypeError(`${String(t)}must be object`);Object.keys(t).forEach(n=>{e[n]=t[n]})}}),e}function kk(e){return e===9||e===32}function Ak(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function jk(e){return Ck.P.test(e)||Ck.S.test(e)}var Mk=new Map;function Nk(e){if(Pk(e))return!0;if(e>=0&&e<128)return!1;let t=Mk.get(e);if(t!==void 0)return t;let n=jk(String.fromCharCode(e));return Mk.set(e,n),n}function Pk(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Fk(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function Ik(e,t,n){return[...e.slice(0,t),...n,...e.slice(t+1)]}function Lk(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Rk(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var zk=/\\([!"#$%&'()*+,\-\./:;<=>?@[\\\]^_`{|}~])/g,Bk=RegExp(`${zk.source}|&([a-z#][a-z0-9]{1,31});`,`gi`),Vk=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Hk(e,t){if(t.charCodeAt(0)===35&&Vk.test(t)){let n=t[1].toLowerCase()===`x`?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return Lk(n)?Rk(n):e}let n=UO(e);return n===e?e:n}function Uk(e){return e.includes(`\\`)?e.replace(zk,`$1`):e}function Wk(e){return!e.includes(`\\`)&&!e.includes(`&`)?e:e.replace(Bk,(e,t,n)=>t||Hk(e,n))}var Gk=/[&<>"]/,Kk=/[&<>"]/g,qk={"&":`&`,"<":`<`,">":`>`,'"':`"`};function Jk(e){return qk[e]}function Yk(e){return Gk.test(e)?e.replace(Kk,Jk):e}var Xk=/[.?*+^$[\]\\(){}|-]/g;function Zk(e){return e.replace(Xk,`\\$&`)}var Qk={mdurl:dk,ucmicro:Ck};function $k(e){if(e.length===0)return 0;let t=0,n=-1;for(;(n=e.indexOf(` +`,n+1))!==-1;)t++;return t}var eA=/(?:^|\n)[ \t]{0,3}\[\^[^\]\n]+\]:/m,tA=/(?:^|\n)[ \t]{0,3}\*\[[^\]\n]+\]:/m,nA=/(?:^|\n)[ \t]{0,3}\[(?!\^)(?:\\[\s\S]|[^\]\\[])+\][ \t]*:/m,rA=[`references`,`footnotes`,`abbreviations`,`abbr`,`abbrs`],iA=Symbol.for(`markdown-it-ts.global-state`),aA=Object.prototype.hasOwnProperty;function oA(e){return e===`reference-definition`||e===`footnote-definition`||e===`abbreviation-definition`}function sA(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function cA(e){if(Array.isArray(e))return e.map(e=>cA(e));if(sA(e)){let t={};for(let n of Object.keys(e))t[n]=cA(e[n]);return t}return e}function lA(e){return Array.isArray(e)?e.map((e,t)=>String(t)):sA(e)?Object.keys(e):[]}function uA(e,t){if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;na.has(e)?!uA(i[e],dA(r.value,e)):!0)}}function xA(e){let t=mA(e);if(t){for(let n of rA){let r=t.snapshot[n];if(!r){delete e[n];continue}if(r.ownedKeys){pA(e,n,r);continue}r.existed?e[n]=fA(e[n],r.value):delete e[n]}delete e[iA]}}function SA(e){return{area:e,attempted:!0,matched:!1,attemptMs:0,blocks:0,headings:0,paragraphs:0,lists:0,fences:0,paragraphCacheHits:0,paragraphCacheMisses:0,paragraphCacheBypasses:0,listCacheHits:0,listCacheMisses:0,fenceCacheHits:0,fenceCacheMisses:0}}var CA=Symbol.for(`markdown-it-ts.diagnostics`);function wA(e,t){if(e)try{let n=e[CA];if(n&&typeof n==`object`)return n;if(!t)return;let r={};return e[CA]=r,r}catch{return}}function TA(e){return wA(e,!1)}function EA(e){if(e)try{let t=e[CA];t&&typeof t==`object`&&(delete t.strategy,delete t.chunk,delete t.unbounded,delete t.editable,delete t.stockFast)}catch{}}function DA(e){EA(e)}function OA(e,t){let n=wA(e,!0);n&&(n.stockFast=t)}function kA(e,t){let n=wA(e,!0);n&&(n.strategy=t)}function AA(e,t){let n=wA(e,!0);n&&(n.chunk=t)}function jA(e,t){let n=wA(e,!0);n&&(n.unbounded=t)}function MA(e){let t={};e||={},t.src_Any=fk.source,t.src_Cc=pk.source,t.src_Z=_k.source,t.src_P=hk.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><|]`;return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function NA(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function PA(e){return Object.prototype.toString.call(e)}function FA(e){return PA(e)===`[object String]`}function IA(e){return PA(e)===`[object Object]`}function LA(e){return PA(e)===`[object RegExp]`}function RA(e){return PA(e)===`[object Function]`}function zA(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var BA={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function VA(e){return Object.keys(e||{}).reduce(function(e,t){return e||BA.hasOwnProperty(t)},!1)}var HA={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},UA=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,WA=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function GA(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function KA(){return function(e,t){t.normalize(e)}}function qA(e){let t=e.re=MA(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(UA),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.email_fuzzy_global=RegExp(r(t.tpl_email_fuzzy),`ig`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_fuzzy_global=RegExp(r(t.tpl_link_fuzzy),`ig`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.link_no_ip_fuzzy_global=RegExp(r(t.tpl_link_no_ip_fuzzy),`ig`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "${e}": ${t}`)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,IA(n)){LA(n.validate)?r.validate=GA(n.validate):RA(n.validate)?r.validate=n.validate:a(t,n),RA(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=KA();return}if(FA(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:KA()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(zA).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`ig`),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,`i`),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,`i`)}function JA(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}function YA(e,t){if(!(this instanceof YA))return new YA(e,t);t||VA(e)&&(t=e,e={}),this.__opts__=NA({},BA,t),this.__schemas__=NA({},HA,e),this.__compiled__={},this.__tlds__=WA,this.__tlds_replaced__=!1,this.re={},qA(this)}YA.prototype.add=function(e,t){return this.__schemas__[e]=t,qA(this),this},YA.prototype.set=function(e){return this.__opts__=NA(this.__opts__,e),this},YA.prototype.test=function(e){if(!e.length)return!1;let t,n;if(this.re.schema_test.test(e)){for(n=this.re.schema_search,n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&e.search(this.re.host_fuzzy_test)>=0&&e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&e.indexOf(`@`)>=0&&e.match(this.re.email_fuzzy)!==null)},YA.prototype.pretest=function(e){return this.re.pretest.test(e)},YA.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},YA.prototype.match=function(e){let t=[],n=[],r=[],i=[],a,o,s;function c(e,t){return e?t?e.index===t.index?e.lastIndex>=t.lastIndex?e:t:e.index{let n=2147483647,r=/^xn--/,i=/[^\0-\x7F]/,a=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},s=Math.floor,c=String.fromCharCode;function l(e){throw RangeError(o[e])}function u(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function d(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(a,`.`);let i=u(e.split(`.`),t).join(`.`);return r+i}function f(e){let t=[],n=0,r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),m=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},h=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},g=function(e,t,n){let r=0;for(e=n?s(e/700):e>>1,e+=s(e/t);e>455;r+=36)e=s(e/35);return s(r+36*e/(e+38))},_=function(e){let t=[],r=e.length,i=0,a=128,o=72,c=e.lastIndexOf(`-`);c<0&&(c=0);for(let n=0;n=128&&l(`not-basic`),t.push(e.charCodeAt(n));for(let u=c>0?c+1:0;u=r&&l(`invalid-input`);let c=m(e.charCodeAt(u++));c>=36&&l(`invalid-input`),c>s((n-i)/t)&&l(`overflow`),i+=c*t;let d=a<=o?1:a>=o+26?26:a-o;if(cs(n/f)&&l(`overflow`),t*=f}let d=t.length+1;o=g(i-c,d,c==0),s(i/d)>n-a&&l(`overflow`),a+=s(i/d),i%=d,t.splice(i++,0,a)}return String.fromCodePoint(...t)},v=function(e){let t=[];e=f(e);let r=e.length,i=128,a=0,o=72;for(let n of e)n<128&&t.push(c(n));let u=t.length,d=u;for(u&&t.push(`-`);d=i&&ts((n-a)/f)&&l(`overflow`),a+=(r-i)*f,i=r;for(let r of e)if(rn&&l(`overflow`),r===i){let e=a;for(let n=36;;n+=36){let r=n<=o?1:n>=o+26?26:n-o;if(e32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=Wk(e.slice(t,i)),a.pos=i,a.ok=!0,a)}var $A=QA,ej=-2;function tj(e,t,n,r){let i=1,a=t+1;for(;a=0&&t+1>=u)return-1;let d=s.indexOf(`]`,t+1);if(d<0||d>=c)return e.linkLabelNoCloseFrom=t+1,-1;let f=tj(s,t,c,n);if(f!==ej)return f;for(e.pos=t+1;e.pos=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a=0?e.attrs[n][1]:null}function uj(e,t,n){let r=oj(e,t);r<0?sj(e,[t,n]):e.attrs[r][1]=`${e.attrs[r][1]} ${n}`}var dj=bk({attrGet:()=>lj,attrIndex:()=>oj,attrJoin:()=>uj,attrPush:()=>sj,attrSet:()=>cj,parseLinkDestination:()=>QA,parseLinkLabel:()=>nj,parseLinkTitle:()=>ij});function fj(e){return e.includes(`\r`)||e.includes(`\0`)}function pj(e){return typeof e==`string`?e:e.toString()}function mj(e){if(e.inlineMode){let t=new xk(`inline`,``,0);t.content=pj(e.src),t.map=[0,1],t.children=[],t.level=0,e.tokens.push(t)}else e.md&&e.md.block&&e.md.block.parse(e.src,e.md,e.env,e.tokens)}var hj=/^([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])?)*)$/,gj=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function _j(e,t){let n=e.pos,r=e.src;if(r.charCodeAt(n)!==60)return!1;let i=n,a=e.posMax;for(;;){if(++n>=a)return!1;let e=r.charCodeAt(n);if(e===60)return!1;if(e===62)break}let o=r.slice(i+1,n);if(gj.test(o)){let n=e.md.normalizeLink(o);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(o);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=o.length+2,!0}if(hj.test(o)){let n=e.md.normalizeLink(`mailto:${o}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(o);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=o.length+2,!0}return!1}var vj=_j;function yj(e,t){let n=e.src,r=e.pos;if(n.charCodeAt(r)!==96)return!1;let i=r;r++;let a=e.posMax;for(;r2&&i.charCodeAt(0)===32&&i.charCodeAt(i.length-1)===32&&(i=i.slice(1,-1)),t.content=i}return e.pos=c,!0}e.backticks[i]=l}return e.backticksScanned=!0,t||(e.pending+=o),e.pos+=s,!0}var bj=yj;function xj(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;os;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function Sj(e){let t=e.tokens_meta,n=e.tokens_meta.length;xj(e.delimiters);for(let e=0;e=0;e--){let n=t[e],i=n.marker;if(i!==95&&i!==42||n.end===-1)continue;let a=t[n.end],o=n.token,s=a.token,c=e>0&&t[e-1].end===n.end+1&&t[e-1].marker===i&&t[e-1].token===o-1&&t[n.end+1].token===s+1,l=i===42?wj:Tj,u=r[o];c?(u.type=`strong_open`,u.tag=`strong`,u.nesting=1,u.markup=l+l,u.content=``):(u.type=`em_open`,u.tag=`em`,u.nesting=1,u.markup=l,u.content=``);let d=r[s];c?(d.type=`strong_close`,d.tag=`strong`,d.nesting=-1,d.markup=l+l,d.content=``):(d.type=`em_close`,d.tag=`em`,d.nesting=-1,d.markup=l,d.content=``),c&&(r[t[e-1].token].content=``,r[t[n.end+1].token].content=``,e--)}}function Oj(e){let t=e.tokens_meta,n=e.tokens_meta.length;Dj(e,e.delimiters);for(let r=0;r=48&&e<=57}function Mj(e){let t=e|32;return jj(e)||t>=97&&t<=102}function Nj(e){let t=e|32;return t>=97&&t<=122}function Pj(e){return Nj(e)||jj(e)}function Fj(e,t,n){let r=t+2;if(r>=n)return null;let i=!1,a=7,o=r;for((e.charCodeAt(r)|32)==120&&(i=!0,a=6,r++,o=r);r=n||e.charCodeAt(r)!==59?null:e.slice(t,r+1)}function Ij(e,t,n){let r=t+1;if(r>=n||!Nj(e.charCodeAt(r)))return null;for(r++;r=n||e.charCodeAt(r)!==59)return null;let i=e.slice(t,r+1);return Aj(i)===i?null:i}function Lj(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let i=Fj(e.src,n,r);if(i){if(!t){let t=(i.charCodeAt(2)|32)==120?Number.parseInt(i.slice(3,-1),16):Number.parseInt(i.slice(2,-1),10),n=e.push(`text_special`,``,0);n.content=Lk(t)?Rk(t):Rk(65533),n.markup=i,n.info=`entity`}return e.pos+=i.length,!0}}else{let i=Ij(e.src,n,r);if(i){let n=Aj(i);if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=i,t.info=`entity`}return e.pos+=i.length,!0}}return!1}var Rj=Lj,zj=(()=>{let e=Array(256).fill(0);for(let t=0;t<32;t++)e[`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.charCodeAt(t)]=1;return e})(),Bj=Array(128),Vj=Array(128);for(let e=0;e<128;e++){let t=String.fromCharCode(e);Bj[e]=`\\${t}`,Vj[e]=zj[e]?t:Bj[e]}function Hj(e,t,n){e.pending&&e.pushPending();let r=new xk(`text_special`,``,0);r.level=e.level,r.content=t,r.markup=n,r.info=`escape`,e.pendingLevel=e.level,e.tokens.push(r),e.tokens_meta.push(null)}function Uj(e,t){let n=e.pos,r=e.posMax,i=e.src;if(i.charCodeAt(n)!==92||(n++,n>=r))return!1;let a=i.charCodeAt(n);if(a===10){for(t||e.push(`hardbreak`,`br`,0),n++;n=55296&&a<=56319&&n+1=56320&&e<=57343&&n++}return e.pos=n+1,!0}let o=i.charAt(n);if(a>=55296&&a<=56319&&n+1=56320&&e<=57343&&(o+=i.charAt(n+1),n++)}let s=`\\${o}`;return Hj(e,a<256&&zj[a]?o:s,s),e.pos=n+1,!0}var Wj=Uj;function Gj(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t0&&r++,e.type===`text`&&t+1\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Jj=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,Yj=RegExp(`^(?:${qj}|${Jj}||<\\?[\\s\\S]*?\\?>|]*>|)`),Xj=RegExp(`^(?:${qj}|${Jj})`);function Zj(e){return e===32||e===9||e===10||e===12||e===13}function Qj(e){if(e.length<3||e.charCodeAt(0)!==60||(e.charCodeAt(1)|32)!=97)return!1;let t=e.charCodeAt(2);return t===62||Zj(t)}function $j(e){if(e.length<4||e.charCodeAt(0)!==60||e.charCodeAt(1)!==47||(e.charCodeAt(2)|32)!=97)return!1;for(let t=3;t=97&&t<=122}function tM(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos,i=e.src;if(i.charCodeAt(r)!==60||r+2>=n)return!1;let a=i.charCodeAt(r+1);if(a!==33&&a!==63&&a!==47&&!eM(a))return!1;let o=i.slice(r).match(Yj);if(!o)return!1;let s=o[0];if(!t){let t=e.pushSimple(`html_inline`,``);t.content=s,Qj(s)&&e.linkLevel++,$j(s)&&e.linkLevel--}return e.pos+=s.length,!0}var nM=tM;function rM(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=rj(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a=f)return!1;if(s=$A(e.src,a,e.posMax),s.ok){for(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``,l=a;a=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[Fk(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0);n.attrs=[[`src`,u],[`alt`,``]],n.children=t,n.content=r,c&&n.attrs.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var iM=rM;function aM(e,t,n){for(;t=0?(t=n.slice(r,i),t||=n.slice(a,o),s=i+1):t=n.slice(a,o)}else t=n.slice(a,o);let u=e.env.references[Fk(t)];if(!u)return e.pos=r,!1;c=u.href,l=u.title}if(!t){e.pos=a,e.posMax=o;let t=e.push(`link_open`,`a`,1);t.attrs=l?[[`href`,c],[`title`,l]]:[[`href`,c]],e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=s,e.posMax=i,!0}var sM=oM;function cM(e){let t=e|32;return t>=97&&t<=122}function lM(e){return e>=48&&e<=57}function uM(e){return cM(e)||lM(e)||e===43||e===45||e===46}function dM(e){if(e.length===0)return null;let t=e.length-1;for(;t>=0&&uM(e.charCodeAt(t));)t--;return t++,t>=e.length||!cM(e.charCodeAt(t))?null:e.slice(t)}function fM(e,t,n){let r=t;for(;r0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=dM(e.pending);if(!i)return!1;let a=fM(e.src,n-i.length,r),o=e.md.linkify.matchAtStart(a);if(!o)return!1;let s=o.url;if(s.length<=i.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-i.length,!0}function mM(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.pushSimple(`hardbreak`,`br`)}else e.pending=e.pending.slice(0,-1),e.pushSimple(`softbreak`,`br`);else e.pushSimple(`softbreak`,`br`);for(n++;n=i||bM(n.charCodeAt(r)))return!1;let a=r+1;for(;ae-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]}function TM(e,t){return{chain:e,name:t,calls:0,hits:0,inclusiveMs:0,medianMs:0,maxMs:0,normalCalls:0,normalHits:0,silentCalls:0,silentHits:0,samples:[]}}function EM(e){let t=e;if(!t)return null;if(t.__mdtsRuleProfile)return t.__mdtsRuleProfile;if(!t.__mdtsProfileRules)return null;let n=t.__mdtsProfileRules===!0?{}:t.__mdtsProfileRules,r={enabled:!0,fixture:n.fixture,mode:n.mode,startedAt:CM(),records:Object.create(null)};return t.__mdtsRuleProfile=r,r}function DM(e,t,n,r,i,a){let o=EM(e);if(!o)return;let s=`${t}:${n}`,c=o.records[s]??(o.records[s]=TM(t,n));c.calls++,c.inclusiveMs+=r,r>c.maxMs&&(c.maxMs=r),c.samples.push(r),a?(c.silentCalls++,i&&c.silentHits++):(c.normalCalls++,i&&c.normalHits++),i&&c.hits++,o.completedAt=CM()}function OM(e){let t=EM(e);if(!t)return null;let n=Object.keys(t.records);for(let e=0;et.name===e);r>=0&&this.rules.splice(r,1),this.rules.push({name:e,fn:t,alt:n?.alt||[],enabled:!0}),this.invalidateCache()}at(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(t===void 0){if(r<0)return;let e=this.rules[r];return Object.freeze({name:e.name,fn:e.fn,alt:e.alt?Object.freeze(e.alt.slice()):void 0,enabled:e.enabled})}if(r<0)throw Error(`Parser rule not found: ${e}`);this.rules[r].fn=t,n?.alt!==void 0&&(this.rules[r].alt=n.alt),this.invalidateCache()}before(e,t,n,r){let i=this.rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this.rules.findIndex(e=>e.name===t);a>=0&&this.rules.splice(a,1),this.rules.splice(i,0,{name:t,fn:n,alt:r?.alt||[],enabled:!0}),this.invalidateCache()}after(e,t,n,r){let i=this.rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this.rules.findIndex(e=>e.name===t);a>=0&&this.rules.splice(a,1),this.rules.splice(i+1,0,{name:t,fn:n,alt:r?.alt||[],enabled:!0}),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled||(this.rules[n].enabled=!0,i=!0)}return i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled&&(this.rules[n].enabled=!1,i=!0)}return i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this.rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}getRules(e){let t=e||``;return this.cache||this.compileCache(),this.cache.get(t)??[]}getNamedRules(e){let t=e||``;return this.namedCache||this.compileCache(),this.namedCache.get(t)??[]}compileCache(){let e=new Set([``]);for(let t of this.rules)if(t.enabled&&t.alt)for(let n of t.alt)e.add(n);let t=new Map,n=new Map;for(let r of e){let e=[],i=[];for(let t of this.rules)t.enabled&&(r!==``&&!t.alt?.includes(r)||(e.push(t.fn),i.push({name:t.name,fn:t.fn})));t.set(r,e),n.set(r,i)}this.cache=t,this.namedCache=n}},AM=class{src;md;env;tokens;tokens_meta;pos;posMax;level;pending;pendingLevel;cache;delimiters;_prev_delimiters;backticks;backticksScanned;linkLevel;linkLabelNoCloseFrom;maxNesting;constructor(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=e.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache=[],this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0,this.linkLabelNoCloseFrom=-1,this.maxNesting=t.options.maxNesting}pushPending(){let e=new xk(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}pushSimple(e,t){this.pending&&this.pushPending();let n=new xk(e,t,0);return n.level=this.level,this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(null),n}push(e,t,n){if(this.pending&&this.pushPending(),n===0)return this.pushSimple(e,t);let r=new xk(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let{src:n,posMax:r}=this,i=n.charCodeAt(e),a=e;for(;a0?n.charCodeAt(e-1):32,c=a@[\]\\^_`{}~]/;function MM(e,t){switch(e.src.charCodeAt(e.pos)){case 10:return hM(e,t);case 33:return iM(e,t);case 38:return Rj(e,t);case 42:case 95:return kj.tokenize(e,t);case 58:return e.md.options.linkify&&pM(e,t);case 60:return vj(e,t)||nM(e,t);case 91:return sM(e,t);case 92:return Wj(e,t);case 96:return bj(e,t);case 126:return yM.tokenize(e,t);default:return SM(e,t)}}function NM(e){return!jM.test(e)}var PM=class{ruler;ruler2;cachedRulesVersion=-1;cachedRules=[];cachedRules2Version=-1;cachedRules2=[];defaultRulerVersion;defaultRuler2Version;constructor(){this.ruler=new kM,this.ruler2=new kM,this.ruler.push(`text`,SM),this.ruler.push(`linkify`,pM),this.ruler.push(`newline`,hM),this.ruler.push(`escape`,Wj),this.ruler.push(`backticks`,bj),this.ruler.push(`strikethrough`,yM.tokenize),this.ruler.push(`emphasis`,kj.tokenize),this.ruler.push(`link`,sM),this.ruler.push(`image`,iM),this.ruler.push(`autolink`,vj),this.ruler.push(`html_inline`,nM),this.ruler.push(`entity`,Rj),this.ruler2.push(`balance_pairs`,Cj),this.ruler2.push(`strikethrough`,yM.postProcess),this.ruler2.push(`emphasis`,kj.postProcess),this.ruler2.push(`fragments_join`,Kj),this.defaultRulerVersion=this.ruler.version,this.defaultRuler2Version=this.ruler2.version}skipToken(e){let t=e.pos,n=this.getRules(),r=n.length,i=e.cache,a=i[t],o=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`));if(a!==void 0){e.pos=a;return}let s=!1;if(e.level=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}}else if(this.isDefaultRuleset()){if(e.level++,s=MM(e,!0),e.level--,s&&t>=e.pos)throw Error(`inline rule didn't increment state.pos`)}else for(let i=0;i=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;s||e.pos++,i[t]=e.pos}tokenize(e){let t=this.getRules(),n=t.length,r=e.posMax;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`)))){let i=this.isDefaultRuleset();for(;e.pos=e.pos)throw Error(`inline rule didn't increment state.pos`)}if(o){if(e.pos>=r)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending();return}let i=this.ruler.getNamedRules(``);for(;e.pos=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending()}isDefaultRuleset(){return this.ruler.version===this.defaultRulerVersion&&this.ruler2.version===this.defaultRuler2Version}parseSource(e,t,n,r){if(typeof e==`string`&&e.length>0&&this.isDefaultRuleset()&&NM(e)){let t=new xk(`text`,``,0);t.content=e,r.push(t);return}let i=new AM(e,t,n,r);this.tokenize(i);let a=this.getRules2(),o=a.length;if(!(i.env&&(Object.prototype.hasOwnProperty.call(i.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(i.env,`__mdtsProfileRules`)))){for(let e=0;e0&&NM(i.content)){let e=new xk(`text`,``,0);e.content=i.content,i.children.push(e);continue}e.md.inline.parse(i.content,e.md,e.env,i.children)}}}var IM=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,LM=/[0-9a-z]/i;function RM(e){return/^\s]/i.test(e)}function zM(e){return/^<\/a\s*>/i.test(e)}function BM(e,t){if(t.schema||t.index!==0||!t.raw)return t;for(let n=1;n=0;t--){let n=i[t];if(n.type===`link_close`){for(t--;t>=0&&i[t].level!==n.level&&i[t].type!==`link_open`;)t--;continue}if(n.type===`html_inline`&&(RM(n.content)&&a>0&&a--,zM(n.content)&&a++),a>0||n.type!==`text`||!e.md.linkify.test(n.content))continue;let r=n.content,o=(e.md.linkify.match(r)||[]).map(t=>BM(e.md.linkify,t));if(o.length===0)continue;let s=[],c=n.level,l=0;o.length>0&&o[0].index===0&&t>0&&i[t-1].type===`text_special`&&(o=o.slice(1));for(let t=0;tl){let e=new xk(`text`,``,0);e.content=r.slice(l,u),e.level=c,s.push(e)}let d=new xk(`link_open`,`a`,1);d.attrs=[[`href`,i]],d.level=c++,d.markup=`linkify`,d.info=`auto`,s.push(d);let f=new xk(`text`,``,0);f.content=a,f.level=c,s.push(f);let p=new xk(`link_close`,`a`,-1);p.level=--c,p.markup=`linkify`,p.info=`auto`,s.push(p),l=n.lastIndex}if(l!==0){if(l=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(qM,YM)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function ZM(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&GM.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function QM(e){if(e.md?.options?.typographer)for(let t=e.tokens.length-1;t>=0;t--){let n=e.tokens[t];if(n.type!==`inline`)continue;let r=n.content||(Array.isArray(n.children)?n.children.map(e=>e.type===`text`?e.content:``).join(``):``);KM.test(r)&&XM(n.children||[]),GM.test(r)&&ZM(n.children||[])}}var $M=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t){let n=this.rules.findIndex(t=>t.name===e);n>=0&&this.rules.splice(n,1),this.rules.push({name:e,fn:t,enabled:!0}),this.invalidateCache()}at(e,t){let n=this.rules.findIndex(t=>t.name===e);if(n<0)throw Error(`Parser rule not found: ${e}`);this.rules[n].fn=t,this.invalidateCache()}before(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(r<0)throw Error(`Parser rule not found: ${e}`);let i=this.rules.findIndex(e=>e.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(r,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}after(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(r<0)throw Error(`Parser rule not found: ${e}`);let i=this.rules.findIndex(e=>e.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(r+1,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled||(this.rules[n].enabled=!0,i=!0)}return i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled&&(this.rules[n].enabled=!1,i=!0)}return i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this.rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}compileCache(){this.cache=this.rules.filter(e=>e.enabled).map(e=>e.fn),this.namedCache=this.rules.filter(e=>e.enabled).map(e=>({name:e.name,fn:e.fn}))}getRules(e=``){return this.cache||this.compileCache(),this.cache}getNamedRules(e=``){return this.namedCache||this.compileCache(),this.namedCache}},eN=/['"]/,tN=/['"]/g,nN=`’`;function rN(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function iN(e,t){let n,r=[],i=t.md&&t.md.options&&t.md.options.quotes||`“”‘’`;for(let t=0;t=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c=0)m=s.charCodeAt(u.index-1);else for(n=t-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=rN(a.content,u.index,nN));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level=0;t--){let n=e.tokens[t];if(n.type!==`inline`)continue;let r=typeof n.content==`string`?n.content:(n.children||[]).map(e=>e.content||``).join(``);!eN.test(r)||!n.children||iN(n.children,e)}}function oN(e){let t=e.tokens||[],n=t.length;for(let e=0;e=4||i.charCodeAt(u)!==62)return!1;if(r)return!0;let p=[],m=[],h=[],g=[],_=e.md.block.ruler.getRulesForState(e,`blockquote`),v=e.parentType;e.parentType=`blockquote`;let y=!1,b;for(b=t;b=d)break;if(i.charCodeAt(u++)===62&&!t){let e=c[b]+1,t,n;i.charCodeAt(u)===32?(u++,e++,n=!1,t=!0):i.charCodeAt(u)===9?(t=!0,(l[b]+e)%4==3?(u++,e++,n=!1):n=!0):t=!1;let r=e;for(p.push(a[b]),a[b]=u;u=d,m.push(l[b]),l[b]=c[b]+1+ +!!t,h.push(c[b]),c[b]=r-e,g.push(s[b]),s[b]=u-a[b];continue}if(y)break;let r=!1;for(let t=0,i=_.length;t`;let C=[t,0];S.map=C,e.md.block.tokenize(e,t,b);let w=e.push(`blockquote_close`,`blockquote`,-1);w.markup=`>`,e.lineMax=f,e.parentType=v,C[1]=e.line;for(let e=0;e=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=`${e.getLines(t,i,4+e.blkIndent,!1)}\n`,a.map=[t,e.line],!0}function gN(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.includes(String.fromCharCode(o)))return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i=4)&&(i=e.skipChars(i,o),!(i-s=4)return!1;let u=i.charCodeAt(c);if(u!==35||c>=l)return!1;let d=1;for(u=i.charCodeAt(++c);u===35&&c6||cc&&yN(i.charCodeAt(f-1))&&(l=f),e.line=t+1;let p=e.push(`heading_open`,_N[d],1);p.markup=vN[d],p.map=[t,e.line];let m=e.push(`inline`,``,0);m.content=i.slice(c,l).trim(),m.map=[t,e.line],m.children=[];let h=e.push(`heading_close`,_N[d],-1);return h.markup=vN[d],!0}function xN(e){switch(e){case 9:case 32:return!0}return!1}function SN(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[RegExp(`^|$))`,`i`),/^$/,!0],[RegExp(`${Xj.source}\\s*$`),/^$/,!1]];function wN(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s=48&&e<=57}var ON=class{src;md;env;tokens;bMarks=[];eMarks=[];tShift=[];sCount=[];bsCount=[];lineFlags=[];blkIndent=0;line=0;lineMax=0;tight=!1;ddIndent=-1;listIndent=-1;parentType=`root`;level=0;constructor(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src,a=0,o=0,s=0,c=!1,l=0;for(let e=0,t=i.length;e0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){let t=this.bMarks,n=this.tShift,r=this.eMarks;for(let i=this.lineMax;et;){let t=n.charCodeAt(--e);if(t!==9&&t!==32)return e+1}return e}skipChars(e,t){let n=this.src;for(let r=n.length;en;)if(t!==r.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;if(e+1===t){let t=e,i=this.bMarks[t],a=i,o=r?this.eMarks[t]+1:this.eMarks[t],s=0,c=this.src,l=this.bsCount,u=this.tShift;for(;an?Array(s-n+1).join(` `)+c.slice(a,o):c.slice(a,o)}let i=Array(t-e),a=this.src,o=this.bMarks,s=this.eMarks,c=this.bsCount,l=this.tShift;for(let u=0,d=e;dn?i[u]=Array(e-n+1).join(` `)+a.slice(p,m):i[u]=a.slice(p,m)}return i.join(``)}};ON.prototype.Token=xk;function kN(e,t,n){for(let r=t;r=i)return!1;let a=n.charCodeAt(r);switch(a){case 35:case 42:case 43:case 45:case 60:case 62:case 95:case 96:case 126:return!0}return a>=48&&a<=57?!0:kN(n,r,i)}var MN=[``,`h1`,`h2`];function NN(e,t,n){let r=e.md.block.ruler.getRulesForState(e,`paragraph`),i=e.src,a=e.bMarks,o=e.tShift,s=e.eMarks,c=e.sCount,l=e.blkIndent,u=AN(e);if(c[t]-l>=4)return!1;let d=e.parentType;e.parentType=`paragraph`;let f=0,p,m=t+1;for(;m=d)break;if(c[m]-l>3)continue;if(c[m]>=l&&(p=i.charCodeAt(t),p===45||p===61)){let e=t+1,n=e;for(;e=d){f=p===61?1:2;break}if(n-t>1)continue}if(c[m]<0||u&&!jN(e,m,i,t,d))continue;let h=!1;for(let t=0,i=r.length;te;){let e=i.charCodeAt(n-1);if(e!==9&&e!==32)break;n--}h=i.slice(e,n)}else h=e.getLines(t,m,l,!1).trim();e.line=m+1;let g=p===61?`=`:`-`,_=e.push(`heading_open`,MN[f],1);_.markup=g,_.map=[t,e.line];let v=e.push(`inline`,``,0);v.content=h,v.map=[t,e.line-1],v.children=[];let y=e.push(`heading_close`,MN[f],-1);return y.markup=g,e.parentType=d,!0}function PN(e){switch(e){case 9:case 32:return!0}return!1}function FN(e,t){let n=e.eMarks,r=e.bMarks,i=e.tShift,a=e.src,o=n[t],s=r[t]+i[t],c=a.charCodeAt(s++);return c!==42&&c!==45&&c!==43||s=s)return-1;let l=a.charCodeAt(c++);if(l<48||l>57)return-1;for(;;){if(c>=s)return-1;if(l=a.charCodeAt(c++),l>=48&&l<=57){if(c-o>=10)return-1;continue}if(l===41||l===46)break;return-1}return c0&&++e=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]=e.blkIndent&&(l=!0);let u,d,f,p=e.src,m=e.bMarks,h=e.tShift,g=e.eMarks,_=e.sCount,v=e.bsCount,y=m[s]+h[s];if(y>=g[s])return!1;let b=p.charCodeAt(y);if(b>=48&&b<=57){if(f=IN(e,s),f<0||(u=!0,o=y,d=LN(e,s,f),l&&d!==1))return!1}else if(b===42||b===45||b===43){if(f=FN(e,s),f<0)return!1;u=!1}else return!1;if(l&&e.skipSpaces(f)>=g[s])return!1;if(r)return!0;let x=p.charCodeAt(f-1),S=String.fromCharCode(x);if(u){let t=e.push(`ordered_list_open`,`ol`,1);d!==void 0&&d!==1&&(t.attrs=[[`start`,String(d)]])}else e.push(`bullet_list_open`,`ul`,1);let C=[s,0];e.tokens[e.tokens.length-1].map=C,e.tokens[e.tokens.length-1].markup=S;let w=!1,T=e.tokens.length-1,E=e.md.block.ruler.getRulesForState(e,`list`),D=e.parentType;for(e.parentType=`list`;s=i?1:r-t,d>4&&(d=1);let y=t+d,b=e.push(`list_item_open`,`li`,1);b.markup=S;let C=[s,0];b.map=C,u&&(b.info=f-o-1==1?RN[p.charCodeAt(o)-48]:p.slice(o,f-1));let T=e.tight,D=e.tShift[s],O=e.sCount[s],k=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=y,e.tight=!0,e.tShift[s]=l-m[s],e.sCount[s]=r,l>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(c=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=k,e.tShift[s]=D,e.sCount[s]=O,e.tight=T,e.push(`list_item_close`,`li`,-1).markup=S,s=e.line,C[1]=s,s>=n||e.sCount[s]=4)break;let A=!1;for(let t=0,r=E.length;t3||l[f]<0)continue;if(i===`list`&&l[f]>=u){let e=o[f]+s[f],t=c[f];if(e=t||VN(a.charCodeAt(e+1)))break}else if(n>=48&&n<=57&&e+1=t){n=-1;break}let r=a.charCodeAt(n++);if(r>=48&&r<=57){if(n-e>=10){n=-1;break}continue}if((r===41||r===46)&&(n>=t||VN(a.charCodeAt(n))))break;n=-1;break}if(n>=0)break}}}let t=o[f]+s[f],p=c[f];if(d&&!jN(e,f,a,t,p))continue;let m=!1;for(let t=0,i=r.length;t=4||e.src.charCodeAt(i)!==91)return!1;function c(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.parentType;e.parentType=`reference`;let i=!1;for(let r=0,a=s.length;rn)return!1;let i=t+1;if(e.sCount[i]=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!GN(s)||o===45&&GN(s)||!JN(e,t))return!1;for(;a=4)return!1;l=YN(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRulesForState(e,`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t=4||(l=YN(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>KN))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;tt.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this._rules.findIndex(e=>e.name===t);a>=0&&this._rules.splice(a,1),this._rules.splice(i,0,{name:t,enabled:!0,fn:n,alt:r?.alt||[]}),this.invalidateCache()}after(e,t,n,r){let i=this._rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this._rules.findIndex(e=>e.name===t);a>=0&&this._rules.splice(a,1),this._rules.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:r?.alt||[]}),this.invalidateCache()}getRules(e){let t=e||``;return this.cache||this.compileCache(),this.cache[t]??[]}getNamedRules(e){let t=e||``;return this.namedCache||this.compileCache(),this.namedCache[t]??[]}getRulesForState(e,t){let n=e?.env;return n&&(Object.prototype.hasOwnProperty.call(n,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(n,`__mdtsProfileRules`))?this.getNamedRules(t).map(({name:e,fn:t})=>(n,r,i,a)=>{let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),s=t(n,r,i,a),c=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();return DM(n?.env,`block`,e,c-o,s,!!a),s}):this.getRules(t)}at(e,t,n){let r=this._rules.findIndex(t=>t.name===e);if(r===-1)throw Error(`Parser rule not found: ${e}`);this._rules[r].fn=t,n?.alt&&(this._rules[r].alt=n.alt),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;return n.forEach(e=>{let n=this._rules.findIndex(t=>t.name===e);if(n===-1){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}r.push(e),this._rules[n].enabled||(this._rules[n].enabled=!0,i=!0)}),i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;return n.forEach(e=>{let n=this._rules.findIndex(t=>t.name===e);if(n===-1){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}r.push(e),this._rules[n].enabled&&(this._rules[n].enabled=!1,i=!0)}),i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this._rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}compileCache(){let e=new Set([``]);for(let t of this._rules)if(t.enabled)for(let n of t.alt)e.add(n);let t=Object.create(null),n=Object.create(null);for(let r of e){let e=[],i=[];for(let t of this._rules)t.enabled&&(r!==``&&!t.alt.includes(r)||(e.push(t.fn),i.push({name:t.name,fn:t.fn})));t[r]=e,n[r]=i}this.cache=t,this.namedCache=n}},QN=[[`table`,XN,[`paragraph`,`reference`]],[`code`,hN],[`fence`,gN,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,mN,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,SN,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,BN,[`paragraph`,`reference`,`blockquote`]],[`reference`,WN],[`html_block`,wN,[`paragraph`,`reference`,`blockquote`]],[`heading`,bN,[`paragraph`,`reference`,`blockquote`]],[`lheading`,NN],[`paragraph`,HN]],$N=class{ruler;cachedRulesVersion=-1;cachedRules=[];constructor(){this.ruler=new ZN;for(let e=0;e=c[u];)u++;if(e.line=u,u>=n||l[u]=a){e.line=n;break}let t=e.line,f=!1;for(let a=0;a=e.line)throw Error(`block rule didn't increment state.line`);break}if(!f)throw Error(`none of the block rules matched`);e.tight=!d,o[e.line-1]+s[e.line-1]>=c[e.line-1]&&(d=!0),u=e.line,u=c[u]&&(d=!0,u++,e.line=u)}return}let f=this.ruler.getNamedRules(``);for(;u=c[u];)u++;if(e.line=u,u>=n||l[u]=a){e.line=n;break}let t=e.line,r=!1;for(let a=0;a=e.line)throw Error(`block rule didn't increment state.line`);break}}if(!r)throw Error(`none of the block rules matched`);e.tight=!d,o[e.line-1]+s[e.line-1]>=c[e.line-1]&&(d=!0),u=e.line,u=c[u]&&(d=!0,u++,e.line=u)}}parse(e,t,n,r){if(!e||e.length===0)return;let i=new ON(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(``),this.cachedRulesVersion=this.ruler.version),this.cachedRules}},eP=class{src;env;tokens;inlineMode;md;constructor(e,t,n={}){this.src=typeof e==`string`?e||``:e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}};eP.prototype.Token=xk;var tP=[[`normalize`,WM],[`block`,mj],[`inline`,FM],[`linkify`,VM],[`replacements`,QM],[`smartquotes`,aN],[`text_join`,oN]],nP={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,maxNesting:100},rP={parseLinkLabel:nj,parseLinkDestination:QA,parseLinkTitle:ij};function iP(){return{...nP}}function aP(){return{...rP}}var oP=class{fallbackParser;lastState=null;block;inline;ruler;linkifyInstance=null;cachedCoreRulesVersion=-1;cachedCoreRules=[];cachedCoreNamedRulesVersion=-1;cachedCoreNamedRules=[];constructor(){this.block=new $N,this.inline=new PM,this.ruler=new $M;for(let e=0;e@[\]\\^_`{}~]/;function cP(e){return!sP.test(e)}function lP(e,t){let n=e.indexOf(` +`,t);return n===-1?e.length:n}function uP(e,t,n){for(let r=t;r3)return cP(e);for(let t=0;t=r||t.charCodeAt(o)!==32)return!1;let s=o+1;for(;ss&&t.charCodeAt(c-1)===32;)c--;let l=c;for(;l>s&&t.charCodeAt(l-1)===35;)l--;if(l>s&&t.charCodeAt(l-1)===32)for(c=l-1;c>s&&t.charCodeAt(c-1)===32;)c--;let u=t.slice(s,c);if(!cP(u))return!1;let d=mP[a],f=hP[a],p=yP(`heading_open`,d,1,0);p.map=[i,i+1],p.markup=f,e.push(p),e.push(bP(u,i,1));let m=yP(`heading_close`,d,-1,0);return m.markup=f,e.push(m),!0}function SP(e,t,n){let r=yP(`paragraph_open`,`p`,1,0);r.map=[n,n+1],e.push(r),e.push(bP(t,n,1)),e.push(yP(`paragraph_close`,`p`,-1,0))}function CP(e,t,n){let r=e.charCodeAt(n-1);return r===32||r===9?e.slice(t,n).trim():e.slice(t,n)}function wP(e,t){for(;t=1e5?gP:vP,i=``,a=!1,o=!1,s=0,c=0;for(;s"]/,jP=/[&<>"]/g,MP=/&/g,NP=/[<>"]/g,PP={"&":`&`,"<":`<`,">":`>`,'"':`"`};function FP(e){return PP[e]||e}function IP(e){if(e.length===0)return``;if(e.length<32)return AP.test(e)?e.replace(jP,FP):e;let t=e.includes(`&`),n=e.includes(`<`),r=e.includes(`>`),i=e.includes(`"`);return!t&&!n&&!r&&!i?e:t&&!n&&!r&&!i?e.replace(MP,`&`):t?e.replace(jP,FP):e.replace(NP,FP)}var LP=RegExp(`\\\\([!"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_\`{|}~])|&([a-z#][a-z0-9]{1,31});`,`gi`),RP=/^#(?:x[a-f0-9]{1,8}|\d{1,8})$/i;function zP(e){return!e.includes(`\\`)&&!e.includes(`&`)?e:e.replace(LP,(e,t,n)=>{if(t)return t;if(RP.test(n)){let e=n[1].toLowerCase()===`x`?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return Lk(e)?Rk(e):`�`}let r=UO(e);return r===e?e:r})}var BP=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/,VP=/[\n!"#$%&*+\-:<=>@[\]\\^_`{}~]/,HP=/"/g;function UP(e,t){let n=e.indexOf(` +`,t);return n===-1?e.length:n}function WP(e,t,n){for(let r=t;r=e.length||e.charCodeAt(t)===10?!1:!WP(e,t,UP(e,t))}function qP(e,t,n){return t+2=n||e.charCodeAt(i)!==32)return null;let a=i+1;for(;aa&&e.charCodeAt(o-1)===32;)o--;let s=o;for(;s>a&&e.charCodeAt(s-1)===35;)s--;if(s>a&&e.charCodeAt(s-1)===32)for(o=s-1;o>a&&e.charCodeAt(o-1)===32;)o--;let c=YP(e.slice(a,o));return c===null?null:`${c}\n`}function ZP(e,t,n){return t+1" +`;case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return null}return`
  • ${e[t]}
  • \n`}function $P(e,t,n){let r=t+2;if(n===r+1)return QP(e,r);let i=YP(e.slice(t+2,n));return i===null?null:`
  • ${i}
  • \n`}function eF(e,t,n){for(;tt;){let t=e.charCodeAt(n-1);if(t!==32&&t!==9)break;n--}let r=n;for(let i=t;i`:`
    `,r.lang=a,r.open=c),{html:`${c}${IP(n)}
    \n`,nextPos:t=25e4,a=[],o={lang:null,open:``},s=``,c=``,l=``,u=``;for(;n +`;r +`,s=l,c=u}let d=GP(e,o);for(;d${e}

    \n`,l=p,u=m}let h=de.core.parse(t,n,e).tokens);let o=sF(t,i);if(i.maxChunks&&o.length>i.maxChunks&&(o=fF(o,i.maxChunks)),cF(t,o))return AA(n,{count:1,fallback:!0,fallbackReason:`unsafe-chunk-boundary`,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines}),vA(n,a,()=>e.core.parse(t,n,e).tokens);let s=0,c=[];return AA(n,{count:o.length,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines,globalStateDetected:a||void 0,globalStateFallbackDisabled:i.fallbackOnGlobalState===!1&&!!a}),vA(n,a,()=>{for(let r=0;r=3&&(u?u.marker===i&&a>=u.length&&(u=null):u={marker:i,length:a})}}let p=o-n;i+=p,a+=1,s+=1,f?(c=0,l=0):(c+=1,l+=p);let m=f;if((i>=t.maxChunkChars||a>=t.maxChunkLines)&&!u)if(m)d(o);else{let e=Math.max(10,Math.floor(t.maxChunkLines*.5)),n=Math.max(t.maxChunkChars,8e3);(c>=e||l>=n)&&d(o)}n=o}return n&&d(e.length),r}function cF(e,t,n={rangesCoverWholeSource:!0}){let r=n.rangesCoverWholeSource?t.length-1:t.length;for(let n=0;ne.length||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;for(let r=n+1;r=0;t--)n.push(e[t]);for(;n.length;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function dF(e,t){for(let n=0;n=0;t--)n.push(e[t]);for(;n.length;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function SF(e){return e.length===0?0:$k(e)+(e.charCodeAt(e.length-1)===10?0:1)}function CF(e,t,n){for(let r=t;r=3&&(n?n.marker===a&&o>=n.length&&(n=null):n={marker:a,length:o})}t=r===e.length?e.length:r+1}return n!==null}function TF(e,t){if(e.length===0||e.charCodeAt(e.length-1)!==10)return!1;let n=e.length-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;return CF(e,n+1,e.length-1)?!wF(e,t):!1}function EF(e,t,n,r={}){let i=r.mode??`full`,a=r.fenceAware??(i===`stream`?e.options.streamChunkFenceAware??!0:e.options.fullChunkFenceAware??!0);if(r.maxChunkChars!==void 0||r.maxChunkLines!==void 0||r.autoTune===!1){let t=r.maxChunkChars??(i===`stream`?e.options.streamChunkSizeChars??vF:e.options.fullChunkSizeChars??gF),n=r.maxChunkLines??(i===`stream`?e.options.streamChunkSizeLines??yF:e.options.fullChunkSizeLines??_F);return{maxChunkChars:t,maxChunkLines:n,holdBelowChars:t,holdBelowLines:n,fenceAware:a}}return i===`stream`?t<=5e3?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:a}:t<=2e4?{maxChunkChars:16e3,maxChunkLines:200,holdBelowChars:16e3,holdBelowLines:200,fenceAware:a}:t<=5e4?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:a}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:a}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:a}:t<=1e5&&n<=2500?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:1e5,holdBelowLines:2500,fenceAware:a}:t<=2e5?{maxChunkChars:2e4,maxChunkLines:150,holdBelowChars:2e4,holdBelowLines:150,fenceAware:a}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:a}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:a}}var DF=class{md;options;pending=``;tokens=[];committedChars=0;committedLines=0;fedChunks=0;parsedChunks=0;globalStateEnv=null;markedGlobalStateReason=null;constructor(e,t={}){if(this.md=e,this.options={mode:`full`,autoTune:!0,retainTokens:!0,...t},this.options.retainTokens===!1&&!this.options.onChunkTokens)throw Error(`UnboundedBuffer with retainTokens=false requires onChunkTokens`)}feed(e){e&&(this.pending+=e,this.fedChunks+=1)}flushAvailable(e={}){if(!this.pending)return null;let t=this.resolveWindow(),n=SF(this.pending);if(this.pending.length=r||n>=i}function NF(e,t,n){if(e.options.autoUnbounded===!1)return`no`;if(t>=(e.options.autoUnboundedThresholdChars??mF))return`yes`;let r=e.options.autoUnboundedThresholdLines??hF;return n===void 0?t+1=r?`yes`:`no`}function PF(e,t,n={},r={}){DA(n);let i=gA(t);if(_A(n)&&xA(n),r.fallbackOnGlobalState!==!1&&i)return jA(n,{mode:`full`,fallback:!0,fallbackReason:i,committedChars:t.length,committedLines:$k(t),pendingChars:0,pendingLines:0,fedChunks:1,parsedChunks:1,globalStateDetected:i}),vA(n,i,()=>e.core.parse(t,n,e).tokens);let a=[],o=new DF(e,{mode:`full`,...r,retainTokens:!1,onChunkTokens(e){bF(a,e)}});if(i&&yA(n,i),o.feed(t),o.flushForce(n),i&&(bA(n),r.fallbackOnGlobalState===!1)){let e=TA(n)?.unbounded;e&&(e.globalStateDetected=i,e.globalStateFallbackDisabled=!0)}return a}var FF=(e,t,n)=>en?n:e;function IF(e){return e.experimental?{...e,...e.experimental}:e}var LF=[{max:5e3,strategy:`discrete`,maxChunkChars:32e3,maxChunkLines:150,maxChunks:8,notes:`<=5k`},{max:2e4,strategy:`discrete`,maxChunkChars:24e3,maxChunkLines:200,maxChunks:12,notes:`<=20k`},{max:1e5,strategy:`plain`,notes:`<=100k plain`},{max:2e5,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:150,maxChunks:12,notes:`<=200k`},{max:5e5,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:`<=500k`},{max:5e6,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:`<=5M`}],RF=[{max:5e3,strategy:`discrete`,maxChunkChars:16e3,maxChunkLines:250,maxChunks:8,notes:`<=5k`},{max:2e4,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:`<=20k`},{max:1e5,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:`<=100k`},{max:5e5,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:`<=500k`},{max:5e6,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:`<=5M`}];function zF(e,t){return{strategy:t.strategy,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,maxChunks:t.maxChunks,fenceAware:e,notes:t.notes}}function BF(e,t=Math.max(0,e/40|0),n={}){let r=IF(n),i=r.fullChunkFenceAware??!0,a=r.fullChunkTargetChunks??8,o=r.fullChunkAdaptive!==!1;for(let t=0;t5e6?{strategy:`plain`,fenceAware:i,notes:`>5M plain`}:o?{strategy:`adaptive`,maxChunkChars:FF(Math.ceil(e/a),8e3,64e3),maxChunkLines:FF(Math.ceil(t/a),150,700),maxChunks:FF(Math.ceil(e/64e3),a,16),fenceAware:i,notes:`adaptive fallback`}:{strategy:`discrete`,maxChunkChars:r.fullChunkSizeChars??1e4,maxChunkLines:r.fullChunkSizeLines??200,fenceAware:i,maxChunks:r.fullChunkMaxChunks}}function VF(e,t=Math.max(0,e/40|0),n={}){let r=IF(n),i=r.streamChunkFenceAware??!0,a=r.streamChunkTargetChunks??8,o=r.streamChunkAdaptive!==!1;for(let t=0;t5e6?{strategy:`plain`,fenceAware:i,notes:`>5M plain`}:o?{strategy:`adaptive`,maxChunkChars:FF(Math.ceil(e/a),8e3,64e3),maxChunkLines:FF(Math.ceil(t/a),150,700),maxChunks:FF(Math.ceil(e/64e3),a,32),fenceAware:i,notes:`adaptive fallback`}:{strategy:`discrete`,maxChunkChars:r.streamChunkSizeChars??1e4,maxChunkLines:r.streamChunkSizeLines??200,maxChunks:r.streamChunkMaxChunks,fenceAware:i}}var HF={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`]},inline2:{rules:[`balance_pairs`,`emphasis`,`fragments_join`]}}},UF={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},WF={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`]},inline2:{rules:[`balance_pairs`,`fragments_join`]}}};function GF(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function KF(e,t){if(GF(e))throw TypeError(`Renderer rule "${t}" returned a Promise. Use renderAsync() instead.`);return e}var qF=e=>GF(e)?e:Promise.resolve(e);function JF(e){switch(e){case`alt`:case`class`:case`href`:case`id`:case`lang`:case`rel`:case`src`:case`start`:case`style`:case`target`:case`title`:return e;default:return IP(e)}}function YF(e){if(!e||e.length===0)return``;let t=e[0],n=` ${JF(t[0])}="${IP(t[1])}"`;for(let t=1;t=e.length)return{langName:e,langAttrs:``};let n=t;for(;n${t}\n`;let n=e.attrIndex(`class`),a=e.attrs?e.attrs.slice():[],o=`${i.langPrefix??`language-`}${r}`;return n<0?a.push([`class`,o]):(a[n]=a[n].slice(),a[n][1]+=` ${o}`),`
    ${t}
    \n`}return`
    ${t}
    \n`}function QF(e){return!e.attrs||e.attrs.length===0?`${IP(e.content)}`:`${IP(e.content)}`}function $F(e){let t=IP(e.content);return e.attrs?`${t}\n`:`
    ${t}
    \n`}function eI(e,t){let n=e.attrs;if(!n||n.length===0)switch(e.type){case`paragraph_open`:return`${t}

    `;case`heading_open`:return`<${e.tag}>`;case`td_open`:return`${t}`;case`th_open`:return`${t}`;default:return null}if(n.length===1&&n[0][0]===`style`){if(e.type===`td_open`)return`${t}`;if(e.type===`th_open`)return`${t}`}return null}function tI(e){let t=e.attrs;return!t||t.length===0?``:t.length===1?``:t.length===2?``:``}function nI(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:case`image`:return!0;default:return!1}}function rI(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:return!0;default:return!1}}function iI(e,t){if(e.hidden)return``;let n=e.attrs,r=e.nesting,i=e.tag;if(!n||n.length===0)return r===0?t?`<${i} />`:`<${i}>`:r===-1?``:`<${i}>`;let a=(r===-1?``}var aI={langPrefix:`language-`,xhtmlOut:!1,breaks:!1},oI=Object.prototype.hasOwnProperty,sI={code_inline(e,t){return QF(e[t])},code_block(e,t){return $F(e[t])},fence(e,t,n,r,i){let a=e[t],o=a.info?zP(a.info).trim():``,{langName:s,langAttrs:c}=XF(o),l=n.highlight,u=IP(a.content);if(!l)return ZF(a,u,o,s,n);let d=l(a.content,s,c);return GF(d)?d.then(e=>ZF(a,e||u,o,s,n)):ZF(a,d||u,o,s,n)},image(e,t,n,r,i){let a=e[t],o=i.renderInlineAsText(a.children||[],n,r),s=a.attrIndex(`alt`);return s>=0&&a.attrs?a.attrs[s][1]=o:a.attrs?a.attrs.push([`alt`,o]):a.attrs=[[`alt`,o]],iI(a,n.xhtmlOut===!0)},hardbreak(e,t,n){return n.xhtmlOut?`
    `:`
    `},softbreak(e,t,n){return n.breaks?n.xhtmlOut?`
    `:`
    `:` -`},text(e,t){return jP(e[t].content)},text_special(e,t){return jP(e[t].content)},html_block(e,t){return e[t].content},html_inline(e,t){return e[t].content}};function rI(e,t,n){let r=e.info?PP(e.info).trim():``,{langName:i,langAttrs:a}=GF(r),o=t.highlight,s=jP(e.content);if(!o)return KF(e,s,r,i,t);let c=o(e.content,i,a);if(BF(c))throw TypeError(`Renderer rule "fence" returned a Promise. Use renderAsync() instead.`);return KF(e,c||s,r,i,t)}function iI(e,t,n,r){switch(e.type){case`text`:return t.text===nI.text?e.content.length===0?``:jP(e.content):null;case`text_special`:return t.text_special===nI.text_special?e.content.length===0?``:jP(e.content):null;case`softbreak`:return t.softbreak===nI.softbreak?r:null;case`hardbreak`:return t.hardbreak===nI.hardbreak?n:null;case`html_inline`:return t.html_inline===nI.html_inline?e.content:null;case`code_inline`:return t.code_inline===nI.code_inline?qF(e):null;default:return null}}function aI(e,t,n,r,i){let a=e[0];switch(a.type){case`text`:if(i.text===nI.text)return a.content.length===0?``:jP(a.content);break;case`text_special`:if(i.text_special===nI.text_special)return a.content.length===0?``:jP(a.content);break;case`softbreak`:if(i.softbreak===nI.softbreak)return t.breaks?t.xhtmlOut?`
    +`},text(e,t){return IP(e[t].content)},text_special(e,t){return IP(e[t].content)},html_block(e,t){return e[t].content},html_inline(e,t){return e[t].content}};function cI(e,t,n){let r=e.info?zP(e.info).trim():``,{langName:i,langAttrs:a}=XF(r),o=t.highlight,s=IP(e.content);if(!o)return ZF(e,s,r,i,t);let c=o(e.content,i,a);if(GF(c))throw TypeError(`Renderer rule "fence" returned a Promise. Use renderAsync() instead.`);return ZF(e,c||s,r,i,t)}function lI(e,t,n,r){switch(e.type){case`text`:return t.text===sI.text?e.content.length===0?``:IP(e.content):null;case`text_special`:return t.text_special===sI.text_special?e.content.length===0?``:IP(e.content):null;case`softbreak`:return t.softbreak===sI.softbreak?r:null;case`hardbreak`:return t.hardbreak===sI.hardbreak?n:null;case`html_inline`:return t.html_inline===sI.html_inline?e.content:null;case`code_inline`:return t.code_inline===sI.code_inline?QF(e):null;default:return null}}function uI(e,t,n,r,i){let a=e[0];switch(a.type){case`text`:if(i.text===sI.text)return a.content.length===0?``:IP(a.content);break;case`text_special`:if(i.text_special===sI.text_special)return a.content.length===0?``:IP(a.content);break;case`softbreak`:if(i.softbreak===sI.softbreak)return t.breaks?t.xhtmlOut?`
    `:`
    `:` -`;break;case`hardbreak`:if(i.hardbreak===nI.hardbreak)return t.xhtmlOut?`
    +`;break;case`hardbreak`:if(i.hardbreak===sI.hardbreak)return t.xhtmlOut?`
    `:`
    -`;break;case`html_inline`:if(i.html_inline===nI.html_inline)return a.content;break;case`code_inline`:if(i.code_inline===nI.code_inline)return qF(a);break}let o=i[a.type];if(!o)return $F(a,t.xhtmlOut===!0);let s=o(e,0,t,n,r);return typeof s==`string`?s:VF(s,a.type)}var oI=class{rules;baseOptions;normalizedBase;constructor(e={}){this.baseOptions={...e},this.normalizedBase=this.buildNormalizedBase(),this.rules={...nI}}set(e){return this.baseOptions={...this.baseOptions,...e},this.normalizedBase=this.buildNormalizedBase(),this}render(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);if(e.length===1)return this.renderSingleToken(e,e[0],t,n);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=r.xhtmlOut===!0,s,c,l,u,d,f,p=``,m=``,h=!1,g=``;for(let t=0;t0&&e[t-1].hidden?` -`:``;if(_===`list_item_open`&&(!n.attrs||n.attrs.length===0)&&t+3${this.renderInlineTokens(a.children||[],r,i)}`,t+=3;continue}}if(t+2\n`,t+=2;continue}}}if(_===`inline`){let e=n.children||[];if(e.length===1){h||=(s=a.text,c=a.text_special,l=a.softbreak,u=a.hardbreak,d=a.html_inline,f=a.code_inline,p=r.xhtmlOut?`
    +`;break;case`html_inline`:if(i.html_inline===sI.html_inline)return a.content;break;case`code_inline`:if(i.code_inline===sI.code_inline)return QF(a);break}let o=i[a.type];if(!o)return iI(a,t.xhtmlOut===!0);let s=o(e,0,t,n,r);return typeof s==`string`?s:KF(s,a.type)}var dI=class{rules;baseOptions;normalizedBase;constructor(e={}){this.baseOptions={...e},this.normalizedBase=this.buildNormalizedBase(),this.rules={...sI}}set(e){return this.baseOptions={...this.baseOptions,...e},this.normalizedBase=this.buildNormalizedBase(),this}render(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);if(e.length===1)return this.renderSingleToken(e,e[0],t,n);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=r.xhtmlOut===!0,s,c,l,u,d,f,p=``,m=``,h=!1,g=``;for(let t=0;t0&&e[t-1].hidden?` +`:``;if(_===`list_item_open`&&(!n.attrs||n.attrs.length===0)&&t+3${this.renderInlineTokens(a.children||[],r,i)}`,t+=3;continue}}if(t+2\n`,t+=2;continue}}}if(_===`inline`){let e=n.children||[];if(e.length===1){h||=(s=a.text,c=a.text_special,l=a.softbreak,u=a.hardbreak,d=a.html_inline,f=a.code_inline,p=r.xhtmlOut?`
    `:`
    `,m=r.breaks?p:` -`,!0);let t=e[0];switch(t.type){case`text`:if(s===nI.text){g+=jP(t.content);continue}break;case`text_special`:if(c===nI.text_special){g+=jP(t.content);continue}break;case`softbreak`:if(l===nI.softbreak){g+=m;continue}break;case`hardbreak`:if(u===nI.hardbreak){g+=p;continue}break;case`html_inline`:if(d===nI.html_inline){g+=t.content;continue}break;case`code_inline`:if(f===nI.code_inline){g+=qF(t);continue}break;default:break}}g+=this.renderInlineTokens(e,r,i);continue}let y=a[_];if(!y){let i=n.attrs;if(!n.hidden){if(!i||i.length===0)switch(_){case`hr`:g+=o?`


    +`,!0);let t=e[0];switch(t.type){case`text`:if(s===sI.text){g+=IP(t.content);continue}break;case`text_special`:if(c===sI.text_special){g+=IP(t.content);continue}break;case`softbreak`:if(l===sI.softbreak){g+=m;continue}break;case`hardbreak`:if(u===sI.hardbreak){g+=p;continue}break;case`html_inline`:if(d===sI.html_inline){g+=t.content;continue}break;case`code_inline`:if(f===sI.code_inline){g+=QF(t);continue}break;default:break}}g+=this.renderInlineTokens(e,r,i);continue}let y=a[_];if(!y){let i=n.attrs;if(!n.hidden){if(!i||i.length===0)switch(_){case`hr`:g+=o?`
    `:`
    `;continue;case`heading_open`:g+=`<${n.tag}>`;continue;case`heading_close`:g+=`\n`;continue;case`paragraph_open`:g+=`${v}

    `;continue;case`paragraph_close`:g+=`

    `;continue;case`list_item_open`:{let n=e[t+1];g+=v+(n&&(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===`li`)?`
  • `:`
  • @@ -760,101 +760,101 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `;continue;case`tr_open`:g+=`${v}\n`;continue;case`tr_close`:g+=` `;continue;case`td_open`:g+=`${v}`;continue;case`td_close`:g+=` `;continue;case`th_open`:g+=`${v}`;continue;case`th_close`:g+=` -`;continue;default:break}else if(i.length===1){let e=i[0];if(_===`ordered_list_open`&&e[0]===`start`){g+=`${v}
      \n`;continue}if(_===`td_open`&&e[0]===`style`){g+=`${v}`;continue}if(_===`th_open`&&e[0]===`style`){g+=`${v}`;continue}}}g+=this.renderToken(e,t,r);continue}if(_===`code_block`&&y===nI.code_block){g+=JF(n);continue}if(_===`fence`&&y===nI.fence){g+=rI(n,r,this);continue}if(_===`html_block`&&y===nI.html_block){g+=n.content;continue}let b=y(e,t,r,i,this);typeof b==`string`?g+=b:g+=VF(b,n.type)}return g}async renderAsync(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=``;for(let t=0;t0&&e[t-1].hidden?` +`;continue;default:break}else if(i.length===1){let e=i[0];if(_===`ordered_list_open`&&e[0]===`start`){g+=`${v}
        \n`;continue}if(_===`td_open`&&e[0]===`style`){g+=`${v}`;continue}if(_===`th_open`&&e[0]===`style`){g+=`${v}`;continue}}}g+=this.renderToken(e,t,r);continue}if(_===`code_block`&&y===sI.code_block){g+=$F(n);continue}if(_===`fence`&&y===sI.fence){g+=cI(n,r,this);continue}if(_===`html_block`&&y===sI.html_block){g+=n.content;continue}let b=y(e,t,r,i,this);typeof b==`string`?g+=b:g+=KF(b,n.type)}return g}async renderAsync(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=``;for(let t=0;t0&&e[t-1].hidden?` `:``,u=c?`> -`:`>`;if(!s||s.length===0)return a===0?n.xhtmlOut?`${l}<${o} /${u}`:`${l}<${o}${u}`:a===-1?`${l}(n||={...t},n);if(tI.call(e,`highlight`)&&e.highlight!==t.highlight&&(r().highlight=e.highlight),tI.call(e,`langPrefix`)){let n=e.langPrefix;n!==t.langPrefix&&(r().langPrefix=n)}if(tI.call(e,`xhtmlOut`)){let n=e.xhtmlOut;n!==t.xhtmlOut&&(r().xhtmlOut=n)}if(tI.call(e,`breaks`)){let n=e.breaks;n!==t.breaks&&(r().breaks=n)}return n||t}buildNormalizedBase(){return Object.freeze({...eI,...this.baseOptions})}renderSingleToken(e,t,n,r){let i=this.rules,a=t.type;if(a===`code_block`&&i.code_block===nI.code_block)return JF(t);if(a===`html_block`&&i.html_block===nI.html_block)return t.content;let o=this.mergeOptions(n),s=r??{};if(a===`inline`)return this.renderInlineTokens(t.children||[],o,s);let c=i[a];if(!c)return t.block?this.renderToken(e,0,o):$F(t,o.xhtmlOut===!0);if(a===`fence`&&c===nI.fence)return rI(t,o,this);let l=c(e,0,o,s,this);return typeof l==`string`?l:VF(l,a)}renderInlineTokens(e,t,n){if(!e||e.length===0)return``;let r=this.rules;if(e.length===1)return aI(e,t,n,this,r);let i=t.xhtmlOut===!0,a=i?`
        +`:`>`;if(!s||s.length===0)return a===0?n.xhtmlOut?`${l}<${o} /${u}`:`${l}<${o}${u}`:a===-1?`${l}(n||={...t},n);if(oI.call(e,`highlight`)&&e.highlight!==t.highlight&&(r().highlight=e.highlight),oI.call(e,`langPrefix`)){let n=e.langPrefix;n!==t.langPrefix&&(r().langPrefix=n)}if(oI.call(e,`xhtmlOut`)){let n=e.xhtmlOut;n!==t.xhtmlOut&&(r().xhtmlOut=n)}if(oI.call(e,`breaks`)){let n=e.breaks;n!==t.breaks&&(r().breaks=n)}return n||t}buildNormalizedBase(){return Object.freeze({...aI,...this.baseOptions})}renderSingleToken(e,t,n,r){let i=this.rules,a=t.type;if(a===`code_block`&&i.code_block===sI.code_block)return $F(t);if(a===`html_block`&&i.html_block===sI.html_block)return t.content;let o=this.mergeOptions(n),s=r??{};if(a===`inline`)return this.renderInlineTokens(t.children||[],o,s);let c=i[a];if(!c)return t.block?this.renderToken(e,0,o):iI(t,o.xhtmlOut===!0);if(a===`fence`&&c===sI.fence)return cI(t,o,this);let l=c(e,0,o,s,this);return typeof l==`string`?l:KF(l,a)}renderInlineTokens(e,t,n){if(!e||e.length===0)return``;let r=this.rules;if(e.length===1)return uI(e,t,n,this,r);let i=t.xhtmlOut===!0,a=i?`
        `:`
        `,o=t.breaks?a:` -`,s=r.text,c=r.text_special,l=r.softbreak,u=r.hardbreak,d=r.html_inline,f=r.code_inline,p=r.link_open,m=r.link_close,h=r.em_open,g=r.em_close,_=r.strong_open,v=r.strong_close,y=``;for(let b=0;b`;if(l===nI.softbreak&&b+3`,b+=1;continue}if(x.type===`em_open`&&!h&&!g&&b+2${e}`,b+=2;continue}}}if(x.type===`strong_open`&&!_&&!v&&b+2${e}`,b+=2;continue}}}switch(x.type){case`text`:if(s===nI.text){let t=x.content.length===0?``:jP(x.content);if(d===nI.html_inline&&b+1=4)return!0;continue}if(t===9){if(o+=4-o%4,a++,o>=4)return!0;continue}break}if(a0&&n<=6){if(t=3)return!0;break}default:if(t>=48&&t<=57){let t=a+1;for(;t57)break;t++}if(t=v,!x&&y!==void 0&&(b=Jk(e),x=b>=y)),x){let r=this.parseFullDocument(e,t,n,b,!1);return this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,wA(t,{area:`stream`,path:`stream-full`,reason:`skip-cache-large-one-shot`,unbounded:!!bA(t)?.unbounded}),r.tokens}else if(c){let r=(e,t,n)=>en?n:e;b===void 0&&(b=Jk(e));let i=h&&!m?IF(e.length,b,n.options):null,a=i?.maxChunkChars??(l?r(Math.ceil(e.length/u),8e3,64e3):d??1e4),c=i?.maxChunkLines??(l?r(Math.ceil(b/u),150,700):f??200),_=i?.maxChunks??(l?r(Math.ceil(e.length/64e3),u,32):p),v=e.length>0&&e.charCodeAt(e.length-1)===10,y=s&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&i?.strategy!==`plain`;if((o||y)&&(e.length>=a*2||b>=c*2)&&v){let r=tF(n,e,t,{maxChunkChars:a,maxChunkLines:c,fenceAware:i?.fenceAware??g,maxChunks:_});return this.cache={src:e,tokens:r,env:t,lineCount:b,lastSegment:void 0,globalStateReason:dA(e)},this.updateCacheLineCount(this.cache,b),this.recordChunkedParseResult(t,o?`explicit-initial-large-doc`:`default-initial-large-doc`),r}}let S=this.parseFullDocument(e,t,n,b);return b=S.lineCount,this.cache={src:e,tokens:S.tokens,env:t,lineCount:b,lastSegment:void 0,globalStateReason:dA(e)},this.updateCacheLineCount(this.cache,b),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,wA(t,{area:`stream`,path:`stream-full`,reason:`initial-parse`,unbounded:!!bA(t)?.unbounded}),S.tokens}if(e===i.src)return this.stats.total+=1,this.stats.cacheHits+=1,this.stats.lastMode=`cache`,wA(i.env,{area:`stream`,path:`stream-cache`,reason:`same-source`}),i.tokens;let a=e.startsWith(i.src)?e.slice(i.src.length):null,o=i.globalStateReason;o===void 0&&(o=dA(i.src),i.globalStateReason=o);let s=o?null:a===null?dA(e):this.detectGlobalStateForAppend(i,a),c=o||s;if(c){let t=r??i.env;gA(t);let a=dA(e),o=this.parseFullDocument(e,t,n),s=o.tokens,l=o.lineCount;return this.cache={src:e,tokens:s,env:t,lineCount:l,lastSegment:void 0,globalStateReason:a},this.updateCacheLineCount(this.cache,l),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,wA(t,{area:`stream`,path:`stream-full`,reason:`global-state:${c}`,unbounded:!!bA(t)?.unbounded}),s}let l=n.options?.streamOptimizationMinSize??this.MIN_SIZE_FOR_OPTIMIZATION;if(i.src.length5e3?r=8:u.length>1e3?r=6:u.length>200&&(r=4),r=Math.min(r,t);let a=null,o=n.options?.streamContextParseStrategy??`chars`,s=n.options?.streamContextParseMinChars??200,c=n.options?.streamContextParseMinLines??2,l,d=()=>(l===void 0&&(l=Jk(u)),l),f=this.canDirectlyParseAppend(i),p=f&&this.shouldUseUnboundedAppend(e,i,u),m=!1;if(!f)switch(o){case`lines`:m=d()>=c;break;case`constructs`:if(u.length>=s){m=!0;break}if(lI(u)){m=!0;break}m=d()>=c;break;case`chars`:default:m=u.length>=s}if(r>0&&m){let e=this.getTailLines(i.src,r)+u;try{let o=this.core.parse(e,i.env,n).tokens,s=o.findIndex(e=>e.map&&typeof e.map[1]==`number`&&e.map[1]>r);if(s!==-1){let e=o.slice(s),n=t-r;n!==0&&this.shiftTokenLines(e,n),a={tokens:e}}}catch{a=null}}else a=null;if(!a){let e=t;if(p)a={tokens:kF(n,u,i.env,{mode:`stream`})},e>0&&this.shiftTokenLines(a.tokens,e);else{let t=this.core.parse(u,i.env,n);e>0&&this.shiftTokenLines(t.tokens,e),a=t}}let h=0;if(i.tokens.length>0&&a.tokens.length>0){let e=i.tokens[i.tokens.length-1],t=a.tokens[0];try{e.type===`inline`&&t.type===`inline`&&(t.children&&t.children.length>0&&(e.children||=[],this.appendTokens(e.children,t.children)),e.content=(e.content||``)+(t.content||``),h=1)}catch{h=0}}let g=i.tokens.length;if(a.tokens.length>h){let e=i.tokens,t=a.tokens,n=Math.min(e.length,t.length-h),r=0;for(let i=n;i>0;i--){let n=!0;for(let r=0;r0&&(h+=r),t.length>h&&this.appendTokens(i.tokens,t,h)}if(i.src=e,i.globalStateReason=null,i.lineCount=t+(l??d()),i.tokens.length>g){let n=this.getLastSegment(i.tokens,e,g,i.tokens.length,e.length-u.length,t);n?i.lastSegment=n:i.lastSegment=void 0}else i.lastSegment=void 0;return this.stats.total+=1,this.stats.appendHits+=1,p&&(this.stats.unboundedAppendHits=(this.stats.unboundedAppendHits||0)+1),this.stats.lastMode=`append`,wA(i.env,{area:`stream`,path:p?`stream-unbounded-append`:`stream-append`,reason:p?`large-delta`:`safe-append`,unbounded:p}),i.tokens}let d=r??i.env,f=this.tryTailSegmentReparse(e,i,d,n);if(f)return this.stats.total+=1,this.stats.tailHits+=1,this.stats.lastMode=`tail`,wA(d,{area:`stream`,path:`stream-tail`,reason:`tail-reparse`}),f;let p=!!n.__explicitStreamChunkFallbackSetting,m=typeof n.__canUseImplicitLargeInputStrategy==`function`?n.__canUseImplicitLargeInputStrategy():!0,h=!!n.options?.streamChunkedFallback,g=!p&&!u&&m,_=h||g,v=n.options?.streamChunkAdaptive!==!1,y=n.options?.streamChunkTargetChunks??8,b=n.options?.streamChunkSizeChars,x=n.options?.streamChunkSizeLines,S=n.options?.streamChunkMaxChunks,C=!!n.__explicitStreamChunkConfig,w=n.options?.autoTuneChunks!==!1,T=n.options?.streamChunkFenceAware??!0,E=u&&i.lineCount!==void 0?i.lineCount+Jk(u):void 0;if(_){E===void 0&&(E=Jk(e));let t=(e,t,n)=>en?n:e,r=w&&!C?IF(e.length,E,n.options):null,i=r?.maxChunkChars??(v?t(Math.ceil(e.length/y),8e3,64e3):b??1e4),a=r?.maxChunkLines??(v?t(Math.ceil(E/y),150,700):x??200),o=r?.maxChunks??(v?t(Math.ceil(e.length/64e3),y,32):S),s=e.length>0&&e.charCodeAt(e.length-1)===10,c=g&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&r?.strategy!==`plain`;if((h||c)&&(e.length>=i*2||E>=a*2)&&s){let t=tF(n,e,d,{maxChunkChars:i,maxChunkLines:a,fenceAware:r?.fenceAware??T,maxChunks:o});return this.cache={src:e,tokens:t,env:d,lineCount:E,lastSegment:void 0,globalStateReason:dA(e)},this.updateCacheLineCount(this.cache,E),this.recordChunkedParseResult(d,h?`explicit-fallback-large-doc`:`default-fallback-large-doc`),t}}let D=this.parseFullDocument(e,d,n,E),O=D.tokens;return E=D.lineCount,this.cache={src:e,tokens:O,env:d,lineCount:E,lastSegment:void 0,globalStateReason:dA(e)},this.updateCacheLineCount(this.cache,E),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,wA(d,{area:`stream`,path:`stream-full`,reason:`fallback-full`,unbounded:!!bA(d)?.unbounded}),O}recordChunkedParseResult(e,t){let n=bA(e)?.chunk,r=n?.fallback?String(n.fallbackReason||`global-state`):null;if(this.stats.total+=1,r){this.stats.fullParses+=1,this.stats.lastMode=`full`,wA(e,{area:`stream`,path:`stream-full`,reason:`global-state:${r}`,unbounded:!!bA(e)?.unbounded});return}this.stats.chunkedParses=(this.stats.chunkedParses||0)+1,this.stats.lastMode=`chunked`,wA(e,{area:`stream`,path:`stream-chunked`,chunked:!0,reason:t})}parseFullDocument(e,t,n,r,i=!0){let a=dA(e);fA(t)&&gA(t);let o=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy()?OF(n,e.length,r):`no`;if(o===`yes`){let a=kF(n,e,t);return wA(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-char-threshold`,unbounded:!0}),{tokens:a,lineCount:r??(i?Jk(e):0)}}let s=r;if(o===`need-lines`&&(s=Jk(e),DF(n,e.length,s))){let r=kF(n,e,t);return wA(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-line-threshold`,unbounded:!0}),{tokens:r,lineCount:s}}return s===void 0&&(s=i?Jk(e):0),{tokens:pA(t,a,()=>this.core.parse(e,t,n).tokens),lineCount:s}}shouldUseUnboundedAppend(e,t,n){return!n||e.length=this.MIN_UNBOUNDED_APPEND_CHARS?!0:Jk(n)>=this.MIN_UNBOUNDED_APPEND_LINES}getAppendedSegment(e,t,n){if(n===null||n===void 0&&!t.startsWith(e)||!e.endsWith(` +`,s=r.text,c=r.text_special,l=r.softbreak,u=r.hardbreak,d=r.html_inline,f=r.code_inline,p=r.link_open,m=r.link_close,h=r.em_open,g=r.em_close,_=r.strong_open,v=r.strong_close,y=``;for(let b=0;b`;if(l===sI.softbreak&&b+3`,b+=1;continue}if(x.type===`em_open`&&!h&&!g&&b+2${e}`,b+=2;continue}}}if(x.type===`strong_open`&&!_&&!v&&b+2${e}`,b+=2;continue}}}switch(x.type){case`text`:if(s===sI.text){let t=x.content.length===0?``:IP(x.content);if(d===sI.html_inline&&b+1=4)return!0;continue}if(t===9){if(o+=4-o%4,a++,o>=4)return!0;continue}break}if(a0&&n<=6){if(t=3)return!0;break}default:if(t>=48&&t<=57){let t=a+1;for(;t57)break;t++}if(t=v,!x&&y!==void 0&&(b=$k(e),x=b>=y)),x){let r=this.parseFullDocument(e,t,n,b,!1);return this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,kA(t,{area:`stream`,path:`stream-full`,reason:`skip-cache-large-one-shot`,unbounded:!!TA(t)?.unbounded}),r.tokens}else if(c){let r=(e,t,n)=>en?n:e;b===void 0&&(b=$k(e));let i=h&&!m?VF(e.length,b,n.options):null,a=i?.maxChunkChars??(l?r(Math.ceil(e.length/u),8e3,64e3):d??1e4),c=i?.maxChunkLines??(l?r(Math.ceil(b/u),150,700):f??200),_=i?.maxChunks??(l?r(Math.ceil(e.length/64e3),u,32):p),v=e.length>0&&e.charCodeAt(e.length-1)===10,y=s&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&i?.strategy!==`plain`;if((o||y)&&(e.length>=a*2||b>=c*2)&&v){let r=oF(n,e,t,{maxChunkChars:a,maxChunkLines:c,fenceAware:i?.fenceAware??g,maxChunks:_});return this.cache={src:e,tokens:r,env:t,lineCount:b,lastSegment:void 0,globalStateReason:gA(e)},this.updateCacheLineCount(this.cache,b),this.recordChunkedParseResult(t,o?`explicit-initial-large-doc`:`default-initial-large-doc`),r}}let S=this.parseFullDocument(e,t,n,b);return b=S.lineCount,this.cache={src:e,tokens:S.tokens,env:t,lineCount:b,lastSegment:void 0,globalStateReason:gA(e)},this.updateCacheLineCount(this.cache,b),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,kA(t,{area:`stream`,path:`stream-full`,reason:`initial-parse`,unbounded:!!TA(t)?.unbounded}),S.tokens}if(e===i.src)return this.stats.total+=1,this.stats.cacheHits+=1,this.stats.lastMode=`cache`,kA(i.env,{area:`stream`,path:`stream-cache`,reason:`same-source`}),i.tokens;let a=e.startsWith(i.src)?e.slice(i.src.length):null,o=i.globalStateReason;o===void 0&&(o=gA(i.src),i.globalStateReason=o);let s=o?null:a===null?gA(e):this.detectGlobalStateForAppend(i,a),c=o||s;if(c){let t=r??i.env;xA(t);let a=gA(e),o=this.parseFullDocument(e,t,n),s=o.tokens,l=o.lineCount;return this.cache={src:e,tokens:s,env:t,lineCount:l,lastSegment:void 0,globalStateReason:a},this.updateCacheLineCount(this.cache,l),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,kA(t,{area:`stream`,path:`stream-full`,reason:`global-state:${c}`,unbounded:!!TA(t)?.unbounded}),s}let l=n.options?.streamOptimizationMinSize??this.MIN_SIZE_FOR_OPTIMIZATION;if(i.src.length5e3?r=8:u.length>1e3?r=6:u.length>200&&(r=4),r=Math.min(r,t);let a=null,o=n.options?.streamContextParseStrategy??`chars`,s=n.options?.streamContextParseMinChars??200,c=n.options?.streamContextParseMinLines??2,l,d=()=>(l===void 0&&(l=$k(u)),l),f=this.canDirectlyParseAppend(i),p=f&&this.shouldUseUnboundedAppend(e,i,u),m=!1;if(!f)switch(o){case`lines`:m=d()>=c;break;case`constructs`:if(u.length>=s){m=!0;break}if(mI(u)){m=!0;break}m=d()>=c;break;case`chars`:default:m=u.length>=s}if(r>0&&m){let e=this.getTailLines(i.src,r)+u;try{let o=this.core.parse(e,i.env,n).tokens,s=o.findIndex(e=>e.map&&typeof e.map[1]==`number`&&e.map[1]>r);if(s!==-1){let e=o.slice(s),n=t-r;n!==0&&this.shiftTokenLines(e,n),a={tokens:e}}}catch{a=null}}else a=null;if(!a){let e=t;if(p)a={tokens:PF(n,u,i.env,{mode:`stream`})},e>0&&this.shiftTokenLines(a.tokens,e);else{let t=this.core.parse(u,i.env,n);e>0&&this.shiftTokenLines(t.tokens,e),a=t}}let h=0;if(i.tokens.length>0&&a.tokens.length>0){let e=i.tokens[i.tokens.length-1],t=a.tokens[0];try{e.type===`inline`&&t.type===`inline`&&(t.children&&t.children.length>0&&(e.children||=[],this.appendTokens(e.children,t.children)),e.content=(e.content||``)+(t.content||``),h=1)}catch{h=0}}let g=i.tokens.length;if(a.tokens.length>h){let e=i.tokens,t=a.tokens,n=Math.min(e.length,t.length-h),r=0;for(let i=n;i>0;i--){let n=!0;for(let r=0;r0&&(h+=r),t.length>h&&this.appendTokens(i.tokens,t,h)}if(i.src=e,i.globalStateReason=null,i.lineCount=t+(l??d()),i.tokens.length>g){let n=this.getLastSegment(i.tokens,e,g,i.tokens.length,e.length-u.length,t);n?i.lastSegment=n:i.lastSegment=void 0}else i.lastSegment=void 0;return this.stats.total+=1,this.stats.appendHits+=1,p&&(this.stats.unboundedAppendHits=(this.stats.unboundedAppendHits||0)+1),this.stats.lastMode=`append`,kA(i.env,{area:`stream`,path:p?`stream-unbounded-append`:`stream-append`,reason:p?`large-delta`:`safe-append`,unbounded:p}),i.tokens}let d=r??i.env,f=this.tryTailSegmentReparse(e,i,d,n);if(f)return this.stats.total+=1,this.stats.tailHits+=1,this.stats.lastMode=`tail`,kA(d,{area:`stream`,path:`stream-tail`,reason:`tail-reparse`}),f;let p=!!n.__explicitStreamChunkFallbackSetting,m=typeof n.__canUseImplicitLargeInputStrategy==`function`?n.__canUseImplicitLargeInputStrategy():!0,h=!!n.options?.streamChunkedFallback,g=!p&&!u&&m,_=h||g,v=n.options?.streamChunkAdaptive!==!1,y=n.options?.streamChunkTargetChunks??8,b=n.options?.streamChunkSizeChars,x=n.options?.streamChunkSizeLines,S=n.options?.streamChunkMaxChunks,C=!!n.__explicitStreamChunkConfig,w=n.options?.autoTuneChunks!==!1,T=n.options?.streamChunkFenceAware??!0,E=u&&i.lineCount!==void 0?i.lineCount+$k(u):void 0;if(_){E===void 0&&(E=$k(e));let t=(e,t,n)=>en?n:e,r=w&&!C?VF(e.length,E,n.options):null,i=r?.maxChunkChars??(v?t(Math.ceil(e.length/y),8e3,64e3):b??1e4),a=r?.maxChunkLines??(v?t(Math.ceil(E/y),150,700):x??200),o=r?.maxChunks??(v?t(Math.ceil(e.length/64e3),y,32):S),s=e.length>0&&e.charCodeAt(e.length-1)===10,c=g&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&r?.strategy!==`plain`;if((h||c)&&(e.length>=i*2||E>=a*2)&&s){let t=oF(n,e,d,{maxChunkChars:i,maxChunkLines:a,fenceAware:r?.fenceAware??T,maxChunks:o});return this.cache={src:e,tokens:t,env:d,lineCount:E,lastSegment:void 0,globalStateReason:gA(e)},this.updateCacheLineCount(this.cache,E),this.recordChunkedParseResult(d,h?`explicit-fallback-large-doc`:`default-fallback-large-doc`),t}}let D=this.parseFullDocument(e,d,n,E),O=D.tokens;return E=D.lineCount,this.cache={src:e,tokens:O,env:d,lineCount:E,lastSegment:void 0,globalStateReason:gA(e)},this.updateCacheLineCount(this.cache,E),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,kA(d,{area:`stream`,path:`stream-full`,reason:`fallback-full`,unbounded:!!TA(d)?.unbounded}),O}recordChunkedParseResult(e,t){let n=TA(e)?.chunk,r=n?.fallback?String(n.fallbackReason||`global-state`):null;if(this.stats.total+=1,r){this.stats.fullParses+=1,this.stats.lastMode=`full`,kA(e,{area:`stream`,path:`stream-full`,reason:`global-state:${r}`,unbounded:!!TA(e)?.unbounded});return}this.stats.chunkedParses=(this.stats.chunkedParses||0)+1,this.stats.lastMode=`chunked`,kA(e,{area:`stream`,path:`stream-chunked`,chunked:!0,reason:t})}parseFullDocument(e,t,n,r,i=!0){let a=gA(e);_A(t)&&xA(t);let o=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy()?NF(n,e.length,r):`no`;if(o===`yes`){let a=PF(n,e,t);return kA(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-char-threshold`,unbounded:!0}),{tokens:a,lineCount:r??(i?$k(e):0)}}let s=r;if(o===`need-lines`&&(s=$k(e),MF(n,e.length,s))){let r=PF(n,e,t);return kA(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-line-threshold`,unbounded:!0}),{tokens:r,lineCount:s}}return s===void 0&&(s=i?$k(e):0),{tokens:vA(t,a,()=>this.core.parse(e,t,n).tokens),lineCount:s}}shouldUseUnboundedAppend(e,t,n){return!n||e.length=this.MIN_UNBOUNDED_APPEND_CHARS?!0:$k(n)>=this.MIN_UNBOUNDED_APPEND_LINES}getAppendedSegment(e,t,n){if(n===null||n===void 0&&!t.startsWith(e)||!e.endsWith(` `))return null;let r=n??t.slice(e.length);if(!r)return null;let i=r.length;if(r.charCodeAt(i-1)!==10)return null;let a=0,o=-1;for(let e=0;e=2));e++);if(a<2)return null;let s=(o===-1?r:r.slice(0,o)).trim();if(s.length===0)return null;if(/^[-=]+$/.test(s)){let t=e.slice(0,-1),n=t.lastIndexOf(` -`);if(t.slice(n+1).trim().length>0)return null}return this.endsInsideOpenFence(e)||this.mayContainReferenceDefinition(r)?null:r}tryTailSegmentReparse(e,t,n,r){let i=this.ensureLastSegment(t);if(!i||i.srcOffset<=0&&i.tokenStart<=0)return null;let a=t.src.slice(0,i.srcOffset);if(!e.startsWith(a))return null;let o=t.src.slice(i.srcOffset),s=e.slice(i.srcOffset);if(s===o)return null;let c=e.startsWith(t.src)?e.slice(t.src.length):null;if(c){let a=this.tryContainerTailAppendMerge(e,t,n,r,i,c);if(a)return a}if(this.mayContainReferenceDefinition(o)||this.mayContainReferenceDefinition(s))return null;try{let a=this.core.parse(s,n,r),o=this.getLastSegment(a.tokens,s);return i.lineStart>0&&this.shiftTokenLines(a.tokens,i.lineStart),t.src=e,t.env=n,t.globalStateReason=null,t.globalStateCarry=void 0,t.tokens.length=i.tokenStart,this.appendTokens(t.tokens,a.tokens),t.lineCount=i.lineStart+Jk(s),o?t.lastSegment={tokenStart:i.tokenStart+o.tokenStart,tokenEnd:i.tokenStart+o.tokenEnd,lineStart:i.lineStart+o.lineStart,lineEnd:i.lineStart+o.lineEnd,srcOffset:i.srcOffset+o.srcOffset}:t.lastSegment=null,t.tokens}catch{return null}}getTailLines(e,t){if(t<=0)return``;let n=t;for(let t=e.length-1;t>=0;t--)if(e.charCodeAt(t)===10&&(n--,n===0))return e.slice(t+1);return e}endsInsideOpenFence(e){let t=4e3,n=e.length>t?e.length-t:0,r=e.slice(n),i=r.length,a=null,o=0;for(;o<=i;){let e=r.indexOf(` -`,o);e===-1&&(e=i);let t=o;for(;t=3&&(a?a.marker===n&&o>=a.length&&(a=null):a={marker:n,length:o})}}if(e===i)break;o=e+1}return a!==null}peek(){return this.cache?.tokens??sI}getStats(){return{...this.stats}}appendTokens(e,t,n=0,r=t.length){for(let i=n;icI?n.slice(n.length-cI):n,r&&(e.globalStateReason=r),r}ensureLastSegment(e){return e.lastSegment===void 0&&(e.lastSegment=this.getLastSegment(e.tokens,e.src)),e.lastSegment}getLastSegment(e,t,n=0,r=e.length,i,a){if(r<=n)return null;let o=1/0,s=-1,c=0;for(let l=r-1;l>=n;l--){let n=e[l];if(n.map&&(n.map[0]s&&(s=n.map[1])),n.nesting<0){c+=-n.nesting;continue}if(n.nesting>0){if(c-=n.nesting,n.level===0&&c<=0){let e=Number.isFinite(o)?o:n.map?.[0]??0,c=s>=e?s:n.map?.[1]??e;return{tokenStart:l,tokenEnd:r,lineStart:e,lineEnd:c,srcOffset:this.getLineStartOffset(t,e,i,a)}}continue}if(n.level===0&&c===0){let e=Number.isFinite(o)?o:n.map?.[0]??0,c=s>=e?s:n.map?.[1]??e;return{tokenStart:l,tokenEnd:r,lineStart:e,lineEnd:c,srcOffset:this.getLineStartOffset(t,e,i,a)}}}return null}getLineStartOffset(e,t,n,r){if(n!==void 0&&r!==void 0&&t>=r)return this.getLineStartOffsetFrom(e,n,t-r);if(t<=0)return 0;let i=t,a=-1;for(;i>0;){if(a=e.indexOf(` +`);if(t.slice(n+1).trim().length>0)return null}return this.endsInsideOpenFence(e)||this.mayContainReferenceDefinition(r)?null:r}tryTailSegmentReparse(e,t,n,r){let i=this.ensureLastSegment(t);if(!i||i.srcOffset<=0&&i.tokenStart<=0)return null;let a=t.src.slice(0,i.srcOffset);if(!e.startsWith(a))return null;let o=t.src.slice(i.srcOffset),s=e.slice(i.srcOffset);if(s===o)return null;let c=e.startsWith(t.src)?e.slice(t.src.length):null;if(c){let a=this.tryContainerTailAppendMerge(e,t,n,r,i,c);if(a)return a}if(this.mayContainReferenceDefinition(o)||this.mayContainReferenceDefinition(s))return null;try{let a=this.core.parse(s,n,r),o=this.getLastSegment(a.tokens,s);return i.lineStart>0&&this.shiftTokenLines(a.tokens,i.lineStart),t.src=e,t.env=n,t.globalStateReason=null,t.globalStateCarry=void 0,t.tokens.length=i.tokenStart,this.appendTokens(t.tokens,a.tokens),t.lineCount=i.lineStart+$k(s),o?t.lastSegment={tokenStart:i.tokenStart+o.tokenStart,tokenEnd:i.tokenStart+o.tokenEnd,lineStart:i.lineStart+o.lineStart,lineEnd:i.lineStart+o.lineEnd,srcOffset:i.srcOffset+o.srcOffset}:t.lastSegment=null,t.tokens}catch{return null}}getTailLines(e,t){if(t<=0)return``;let n=t;for(let t=e.length-1;t>=0;t--)if(e.charCodeAt(t)===10&&(n--,n===0))return e.slice(t+1);return e}endsInsideOpenFence(e){let t=4e3,n=e.length>t?e.length-t:0,r=e.slice(n),i=r.length,a=null,o=0;for(;o<=i;){let e=r.indexOf(` +`,o);e===-1&&(e=i);let t=o;for(;t=3&&(a?a.marker===n&&o>=a.length&&(a=null):a={marker:n,length:o})}}if(e===i)break;o=e+1}return a!==null}peek(){return this.cache?.tokens??fI}getStats(){return{...this.stats}}appendTokens(e,t,n=0,r=t.length){for(let i=n;ipI?n.slice(n.length-pI):n,r&&(e.globalStateReason=r),r}ensureLastSegment(e){return e.lastSegment===void 0&&(e.lastSegment=this.getLastSegment(e.tokens,e.src)),e.lastSegment}getLastSegment(e,t,n=0,r=e.length,i,a){if(r<=n)return null;let o=1/0,s=-1,c=0;for(let l=r-1;l>=n;l--){let n=e[l];if(n.map&&(n.map[0]s&&(s=n.map[1])),n.nesting<0){c+=-n.nesting;continue}if(n.nesting>0){if(c-=n.nesting,n.level===0&&c<=0){let e=Number.isFinite(o)?o:n.map?.[0]??0,c=s>=e?s:n.map?.[1]??e;return{tokenStart:l,tokenEnd:r,lineStart:e,lineEnd:c,srcOffset:this.getLineStartOffset(t,e,i,a)}}continue}if(n.level===0&&c===0){let e=Number.isFinite(o)?o:n.map?.[0]??0,c=s>=e?s:n.map?.[1]??e;return{tokenStart:l,tokenEnd:r,lineStart:e,lineEnd:c,srcOffset:this.getLineStartOffset(t,e,i,a)}}}return null}getLineStartOffset(e,t,n,r){if(n!==void 0&&r!==void 0&&t>=r)return this.getLineStartOffsetFrom(e,n,t-r);if(t<=0)return 0;let i=t,a=-1;for(;i>0;){if(a=e.indexOf(` `,a+1),a===-1)return e.length;i--}return a+1}getLineStartOffsetFrom(e,t,n){if(n<=0)return t;let r=n,i=t-1;for(;r>0;){if(i=e.indexOf(` -`,i+1),i===-1)return e.length;r--}return i+1}mayContainReferenceDefinition(e){return e.includes(`]:`)?/(?:^|\n)[ \t]{0,3}\[[^\]\n]+\]:/.test(e):!1}canDirectlyParseAppend(e){if(!this.endsWithBlankLine(e.src))return!1;let t=this.ensureLastSegment(e);if(!t)return!1;switch(e.tokens[t.tokenStart]?.type){case`paragraph_open`:case`heading_open`:case`fence`:case`code_block`:case`html_block`:case`hr`:case`table_open`:return!0;default:return!1}}tryContainerTailAppendMerge(e,t,n,r,i,a){if(!a||this.mayContainReferenceDefinition(a))return null;let o=t.tokens[i.tokenStart];switch(o?.type){case`bullet_list_open`:case`ordered_list_open`:return this.tryListTailAppendMerge(e,t,n,r,i,a,o);case`table_open`:return this.tryTableTailAppendMerge(e,t,n,r,i,a,o);default:return null}}tryListTailAppendMerge(e,t,n,r,i,a,o){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10)return null;let s=i.lineEnd-i.lineStart,c=t.src.length-i.srcOffset;if(s0&&this.shiftTokenLines(d,f);let p=this.getListParagraphMode(t.tokens,i.tokenStart,t.tokens.length,o.level),m=this.getListParagraphMode(u,0,u.length,0);(p===`loose`||m===`loose`||this.endsWithBlankLine(t.src)||(u[0]?.map?.[0]??0)>0)&&(this.setListParagraphVisibility(t.tokens,i.tokenStart,t.tokens.length,o.level,!1),this.setListParagraphVisibility(d,0,d.length,o.level,!1)),t.tokens.splice(t.tokens.length-1,0,...d),t.src=e,t.env=n,t.globalStateReason=null;let h=f+Jk(a);t.lineCount=h;let g=this.getDocLineCount(e,h);return o.map&&(o.map[1]=g),t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:g,srcOffset:i.srcOffset},t.tokens}tryTableTailAppendMerge(e,t,n,r,i,a,o){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10||/(?:^|\n)[ \t]*\n/.test(a))return null;let s=i.lineEnd-i.lineStart,c=t.src.length-i.srcOffset;if(s=0?d.slice(f.tbodyOpenIndex+1,f.tbodyCloseIndex):d.slice(f.tbodyOpenIndex,f.tbodyCloseIndex+1);if(m.length===0)return null;let h=i.lineEnd-2;h!==0&&this.shiftTokenLines(m,h);let g=p.tbodyCloseIndex>=0?p.tbodyCloseIndex:p.tableCloseIndex,_=t.lineCount??Jk(t.src);t.tokens.splice(g,0,...m),t.src=e,t.env=n,t.globalStateReason=null;let v=_+Jk(a);t.lineCount=v;let y=this.getDocLineCount(e,v);if(o.map&&(o.map[1]=y),p.tbodyOpenIndex>=0){let e=t.tokens[p.tbodyOpenIndex];e?.map&&(e.map[1]=y)}return t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:y,srcOffset:i.srcOffset},t.tokens}getTableHeaderContext(e){let t=e.indexOf(` +`,i+1),i===-1)return e.length;r--}return i+1}mayContainReferenceDefinition(e){return e.includes(`]:`)?/(?:^|\n)[ \t]{0,3}\[[^\]\n]+\]:/.test(e):!1}canDirectlyParseAppend(e){if(!this.endsWithBlankLine(e.src))return!1;let t=this.ensureLastSegment(e);if(!t)return!1;switch(e.tokens[t.tokenStart]?.type){case`paragraph_open`:case`heading_open`:case`fence`:case`code_block`:case`html_block`:case`hr`:case`table_open`:return!0;default:return!1}}tryContainerTailAppendMerge(e,t,n,r,i,a){if(!a||this.mayContainReferenceDefinition(a))return null;let o=t.tokens[i.tokenStart];switch(o?.type){case`bullet_list_open`:case`ordered_list_open`:return this.tryListTailAppendMerge(e,t,n,r,i,a,o);case`table_open`:return this.tryTableTailAppendMerge(e,t,n,r,i,a,o);default:return null}}tryListTailAppendMerge(e,t,n,r,i,a,o){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10)return null;let s=i.lineEnd-i.lineStart,c=t.src.length-i.srcOffset;if(s0&&this.shiftTokenLines(d,f);let p=this.getListParagraphMode(t.tokens,i.tokenStart,t.tokens.length,o.level),m=this.getListParagraphMode(u,0,u.length,0);(p===`loose`||m===`loose`||this.endsWithBlankLine(t.src)||(u[0]?.map?.[0]??0)>0)&&(this.setListParagraphVisibility(t.tokens,i.tokenStart,t.tokens.length,o.level,!1),this.setListParagraphVisibility(d,0,d.length,o.level,!1)),t.tokens.splice(t.tokens.length-1,0,...d),t.src=e,t.env=n,t.globalStateReason=null;let h=f+$k(a);t.lineCount=h;let g=this.getDocLineCount(e,h);return o.map&&(o.map[1]=g),t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:g,srcOffset:i.srcOffset},t.tokens}tryTableTailAppendMerge(e,t,n,r,i,a,o){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10||/(?:^|\n)[ \t]*\n/.test(a))return null;let s=i.lineEnd-i.lineStart,c=t.src.length-i.srcOffset;if(s=0?d.slice(f.tbodyOpenIndex+1,f.tbodyCloseIndex):d.slice(f.tbodyOpenIndex,f.tbodyCloseIndex+1);if(m.length===0)return null;let h=i.lineEnd-2;h!==0&&this.shiftTokenLines(m,h);let g=p.tbodyCloseIndex>=0?p.tbodyCloseIndex:p.tableCloseIndex,_=t.lineCount??$k(t.src);t.tokens.splice(g,0,...m),t.src=e,t.env=n,t.globalStateReason=null;let v=_+$k(a);t.lineCount=v;let y=this.getDocLineCount(e,v);if(o.map&&(o.map[1]=y),p.tbodyOpenIndex>=0){let e=t.tokens[p.tbodyOpenIndex];e?.map&&(e.map[1]=y)}return t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:y,srcOffset:i.srcOffset},t.tokens}getTableHeaderContext(e){let t=e.indexOf(` `);if(t<0)return null;let n=e.indexOf(` -`,t+1);return n<0?null:e.slice(0,n+1)}getTableBodySection(e,t,n,r){if(t<0||t>=n||e[t]?.type!==`table_open`)return null;let i=-1;for(let a=n-1;a>t;a--){let t=e[a];if(t.type===`table_close`&&t.level===r){i=a;break}}if(i<0)return null;let a=-1,o=-1;for(let n=t+1;n=0){for(let t=i-1;t>a;t--){let n=e[t];if(n.type===`tbody_close`&&n.level===r+1){o=t;break}}if(o<0)return null}return{tableCloseIndex:i,tbodyOpenIndex:a,tbodyCloseIndex:o}}isSingleTopLevelContainer(e,t,n,r){if(e.length<2)return!1;let i=e[0],a=e[e.length-1];if(i.type!==t||a.type!==n||i.level!==0||a.level!==0||r!==void 0&&i.markup!==r)return!1;let o=0;for(let t=0;t0&&t0||n.nesting<0)&&(o+=n.nesting)}return o===0}getListParagraphMode(e,t,n,r){let i=!1,a=!1,o=r+2;for(let r=t;r=0;){let t=e.charCodeAt(n);if(t===32||t===9){n--;continue}return t===10}return!0}getDocLineCount(e,t=Jk(e)){return e.length===0?0:e.charCodeAt(e.length-1)===10?t:t+1}shiftTokenLines(e,t){if(t===0)return;let n=null;for(let r=0;r=0;e--)n.push(i.children[e]);for(;n.length>0;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}}}},hI={default:RF,zero:zF,commonmark:LF};function gI(e){return{core:e.core.ruler.version,block:e.block.ruler.version,inline:e.inline.ruler.version,inline2:e.inline.ruler2.version}}function _I(e,t){return e.core.ruler.version!==t.core||e.block.ruler.version!==t.block||e.inline.ruler.version!==t.inline||e.inline.ruler2.version!==t.inline2}function vI(e){return e.experimental?{...e,...e.experimental}:e}function yI(e,t){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0)return!0;let n=e.experimental;return!!n&&Object.prototype.hasOwnProperty.call(n,t)&&n[t]!==void 0}function bI(e,t,n){for(let r=0;r=4?n.quotes=[e[0],e[1],e[2],e[3]]:n.quotes=[`“`,`”`,`‘`,`’`]}let o=bI(a?.options,i,[`fullChunkSizeChars`,`fullChunkSizeLines`,`fullChunkMaxChunks`]),s=bI(a?.options,i,[`streamChunkSizeChars`,`streamChunkSizeLines`,`streamChunkMaxChunks`]),c=xI(a?.options,i,`fullChunkedFallback`),l=xI(a?.options,i,`streamChunkedFallback`),u=!1,d=null,f=null,p=new tP,m=null,h=()=>(m||=new oI(n),m),g=null,_=()=>(g||=new mI(p),g),v=null,y=()=>(v||=new GA,v),b=e=>!u&&!!d&&!_I(e,d),x=(e,t)=>r==="default"&&!u&&m===null&&f!==null&&e.parse===f&&b(e)&&!e.stream.enabled&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.xhtmlOut===!1&&e.options.breaks===!1&&e.options.langPrefix===`language-`&&e.options.linkify===!1&&e.options.typographer===!1&&e.options.highlight===null,S=(e,t)=>r==="default"&&!u&&b(e)&&!e.stream.enabled&&!e.options.fullChunkedFallback&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.linkify===!1&&e.options.typographer===!1,C={core:p,block:p.block,inline:p.inline,get linkify(){let e=y();return Object.defineProperty(this,"linkify",{value:e,writable:!0,configurable:!0}),e},get renderer(){let e=h();return Object.defineProperty(this,"renderer",{value:e,writable:!0,configurable:!0}),e},options:n,__explicitFullChunkConfig:o,__explicitStreamChunkConfig:s,__explicitFullChunkFallbackSetting:c,__explicitStreamChunkFallbackSetting:l,__canUseImplicitLargeInputStrategy(){return b(this)},set(e){let t=vI(e);return this.options={...this.options,...t},(yI(e,`fullChunkSizeChars`)||yI(e,`fullChunkSizeLines`)||yI(e,`fullChunkMaxChunks`))&&(o=!0,this.__explicitFullChunkConfig=!0),(yI(e,`streamChunkSizeChars`)||yI(e,`streamChunkSizeLines`)||yI(e,`streamChunkMaxChunks`))&&(s=!0,this.__explicitStreamChunkConfig=!0),yI(e,`fullChunkedFallback`)&&(c=!0,this.__explicitFullChunkFallbackSetting=!0),yI(e,`streamChunkedFallback`)&&(l=!0,this.__explicitStreamChunkFallbackSetting=!0),m&&m.set(t),typeof t.stream==`boolean`&&(this.stream.enabled=t.stream,g&&(g.reset(),g.resetStats())),this},configure(e){let t=typeof e==`string`?hI[e]:e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");if(t.options&&this.set(t.options),t.components){let e=t.components;e.core?.rules&&this.core.ruler.enableOnly(e.core.rules),e.block?.rules&&this.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&this.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&this.inline.ruler2.enableOnly(e.inline2.rules)}return this},enable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.enable(n,!0);for(let e=0;e!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},disable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.disable(n,!0);for(let e=0;e!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},use(e,...t){let n=typeof e==`function`?e:e&&typeof e.default==`function`?e.default:void 0;if(!n)throw TypeError(`MarkdownIt.use: plugin must be a function`);let r=[this,...t],i=e;return u=!0,n.apply(i,r),this},render(e,t){let n;if(x(this,e.length)){t!==void 0&&(SA(t),n=_A(`render`));let r=n?CI():0,i=n?$P(e,n):QP(e);if(n&&(n.attemptMs=CI()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),CA(t,n)),i!==null)return t!==void 0&&wA(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&CA(r,n),h().render(i,this.options,r)},async renderAsync(e,t){let n;if(x(this,e.length)){t!==void 0&&(SA(t),n=_A(`render`));let r=n?CI():0,i=n?$P(e,n):QP(e);if(n&&(n.attemptMs=CI()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),CA(t,n)),i!==null)return t!==void 0&&wA(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&CA(r,n),h().renderAsync(i,this.options,r)},renderIterable(e,t={}){let n=this.parseIterable(e,t);return h().render(n,this.options,t)},async renderAsyncIterable(e,t={}){let n=await this.parseAsyncIterable(e,t);return h().renderAsync(n,this.options,t)},renderInline(e,t={}){let n=this.parseInline(e,t);return h().render(n,this.options,t)},validateLink:aN,normalizeLink:oN,normalizeLinkText:sN,utils:_k,helpers:{...oj},parse(e,t){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);if(t!==void 0&&SA(t),S(this,e.length)){let n=t===void 0?void 0:_A(`parse`),r=n?CI():0,i=wP(e,n);if(n&&(n.attemptMs=CI()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),CA(t,n)),i!==null)return t!==void 0&&wA(t,{area:`parse`,path:`stock-fast`,reason:`stock-subset`}),i}let n=t??{},r;if(!this.stream.enabled&&!this.options.fullChunkedFallback&&b(this)){let i=OF(this,e.length);if(i===`yes`){let r=kF(this,e,n);return wA(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`char-threshold`}),r}i===`need-lines`&&(r=Jk(e))}if(!this.stream.enabled){let i=e.length,a=this.options.autoTuneChunks!==!1,s=o,l=!c&&b(this),u=!!this.options.fullChunkedFallback,d=l&&i>=2e5,f;(u||d||r!==void 0)&&(f=r??Jk(e));let p=(u||d)&&a&&!s?FF(i,f,this.options):null;if(u||d){let r=f??0;if(u?i>=(this.options.fullChunkThresholdChars??2e4)||r>=(this.options.fullChunkThresholdLines??400):d){if(p&&p.strategy!==`plain`){let r=tF(this,e,n,{maxChunkChars:p.maxChunkChars,maxChunkLines:p.maxChunkLines,fenceAware:p.fenceAware,maxChunks:p.maxChunks});return t&&SI(t,u?`explicit-full-chunk`:`default-large-string`),r}if(u){let a=(e,t,n)=>en?n:e,o=this.options.fullChunkAdaptive!==!1,s=this.options.fullChunkTargetChunks??8,c=a(Math.ceil(i/s),8e3,64e3),l=a(Math.ceil(r/s),150,700),u=o?c:this.options.fullChunkSizeChars??1e4,d=o?l:this.options.fullChunkSizeLines??200,f=o?a(Math.ceil(i/64e3),s,32):this.options.fullChunkMaxChunks,p=tF(this,e,n,{maxChunkChars:u,maxChunkLines:d,fenceAware:this.options.fullChunkFenceAware??!0,maxChunks:f});return t&&SI(t,`explicit-full-chunk`),p}}}if(r!==void 0&&b(this)&&DF(this,i,f??r)){let r=kF(this,e,n);return wA(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`line-threshold`}),r}}let i=dA(e);return wA(t,{area:`parse`,path:`plain`,reason:`default-plain`}),pA(n,i,()=>p.parse(e,n,this).tokens)},parseIterable(e,t={}){return SA(t),CF(this,e,t)},parseAsyncIterable(e,t={}){return SA(t),wF(this,e,t)},parseIterableToSink(e,t,n={}){return SA(n),TF(this,e,t,n)},parseAsyncIterableToSink(e,t,n={}){return SA(n),EF(this,e,t,n)},parseInline(e,t={}){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);SA(t),fA(t)&&gA(t);let n=p.createState(e,t,this);return n.inlineMode=!0,p.process(n),n.tokens}};if(C.stream={enabled:!!n.stream,parse(e,t){return C.stream.enabled?_().parse(e,t,C):C.parse(e,t??{})},reset(){_().reset()},peek(){return g?g.peek():[]},stats(){return g?g.getStats():{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:`idle`}},resetStats(){g&&g.resetStats()}},a?.components){let e=a.components;e.core?.rules&&C.core.ruler.enableOnly(e.core.rules),e.block?.rules&&C.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&C.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&C.inline.ruler2.enableOnly(e.inline2.rules)}return d=gI(C),f=C.parse,C}var TI=wI,EI;function DI(){return EI}var OI=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`],kI=`a.abbr.b.bdi.bdo.button.cite.code.data.del.dfn.em.font.i.ins.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var`.split(`.`),AI=`article.aside.blockquote.details.div.figcaption.figure.footer.header.h1.h2.h3.h4.h5.h6.li.main.nav.ol.p.pre.section.summary.table.tbody.td.th.thead.tr.ul`.split(`.`),jI=[`svg`,`g`,`path`],MI=`address.audio.body.canvas.caption.colgroup.datalist.dd.dialog.dl.dt.fieldset.form.head.hgroup.html.iframe.legend.map.menu.meter.noscript.object.optgroup.option.output.picture.progress.rp.rt.ruby.script.select.style.template.textarea.tfoot.title.video`.split(`.`),NI=`onclick.onerror.onload.onmouseover.onmouseout.onmousedown.onmouseup.onkeydown.onkeyup.onfocus.onblur.onsubmit.onreset.onchange.onselect.ondblclick.ontouchstart.ontouchend.ontouchmove.ontouchcancel.onwheel.onscroll.oncopy.oncut.onpaste.oninput.oninvalid.onsearch.innerhtml.outerhtml.textcontent.innertext.srcdoc.ping`.split(`.`),PI=[`action`,`data`,`href`,`src`,`srcset`,`poster`,`xlink:href`,`formaction`],FI=[`script`],II=[`pre`,`iframe`,`picture`,`script`,`style`,`table`,`tbody`,`td`,`tfoot`,`th`,`thead`,`textarea`,`tr`,`title`,`video`],LI=new Set(OI),RI=new Set(AI),zI=new Set([...OI,...kI,...AI,...jI]),BI=new Set([...zI,...MI]),VI=new Set(NI),HI=new Set(PI),UI=new Set(FI),WI=new Set(II);function GI(e){let t=``;for(let n of e){let e=n.charCodeAt(0);e<=31||e>=127&&e<=159||/\s/u.test(n)||(t+=n)}return t}var KI={amp:`&`,bsol:`\\`,colon:`:`,newline:` -`,sol:`/`,tab:` `};function qI(e){return e.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]+));?/gi,(e,t,n,r)=>{let i=t??n;if(i){let e=Number.parseInt(i,t?10:16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return KI[String(r??``).toLowerCase()]??e})}var JI=new Set([`http`,`https`,`mailto`,`tel`]),YI=new Set([`javascript`,`vbscript`,`data`,`file`,`ftp`,`blob`,`filesystem`,`intent`,`chrome`,`chrome-extension`,`moz-extension`,`ms-browser-extension`,`view-source`]),XI=new Set([`http`,`https`]);function ZI(e){return e.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()??``}var QI=/^https?:\/\//i;function $I(e){if(!QI.test(e))return!1;for(let t of e){let e=t.charCodeAt(0);if(t===`&`||e<=32||e>=127&&e<=159||e>127&&/\s/u.test(t))return!1}return!0}function eL(e,t,n){if(!tL(t,n)||!e.startsWith(`file:///`))return!1;let r=e.charAt(8);return r!==`/`&&r!==`\\`}function tL(e,t){return e?(e===`a`||e===`area`)&&(!t||t===`href`||t===`xlink:href`):!t||t===`href`}function nL(e,t){return t===`href`||t===`xlink:href`?tL(e,t)?JI:XI:t===`src`||t===`srcset`||t===`poster`||t===`action`||t===`formaction`||t===`data`?XI:JI}function rL(e,t={}){if($I(e))return!1;let n=GI(qI(e)).toLowerCase(),r=String(t.tagName??``).toLowerCase(),i=String(t.attrName??``).toLowerCase();if(!n)return!1;if(n.startsWith(`data:`)){let e=/^data:image\/(?:png|gif|jpe?g|webp|avif|bmp);/i.test(n);return r===`img`&&i===`src`?!e:!0}if(/^[\\/]{2}/.test(n))return!0;if(n.startsWith(`/`)||n.startsWith(`./`)||n.startsWith(`../`)||n.startsWith(`#`)||n.startsWith(`?`))return!1;let a=ZI(n);return a?a===`file`?!eL(n,r,i):tL(r,i)?YI.has(a):!nL(r,i).has(a):!1}function iL(e){let t=qI(String(e??``)).trim();if(!t||t.startsWith(`#`)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`?`))return!1;let n=ZI(GI(t).toLowerCase());return n===`http`||n===`https`}function aL(e,t={}){let n=String(e??``).trim();return n?rL(n,t)?``:n:``}function oL(e){return aL(e,{tagName:`img`,attrName:`src`})}function sL(e,t,n){function r(e){return e.trim().split(` `,2)[0]===t}function i(e,n,r,i,a){return e[n].nesting===1&&e[n].attrJoin(`class`,t),a.renderToken(e,n,r,i,a)}n||={};let a=n.marker||`:`,o=a.charCodeAt(0),s=a.length,c=n.validate||r,l=n.render||i;function u(e,n,r,i){let l,u=!1,d=e.bMarks[n]+e.tShift[n],f=e.eMarks[n];if(o!==e.src.charCodeAt(d))return!1;for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);let p=Math.floor((l-d)/s);if(p<3)return!1;l-=(l-d)%s;let m=e.src.slice(d,l),h=e.src.slice(l,f);if(!c(h,m))return!1;if(i)return!0;let g=n;for(;g++,!(g>=r||(d=e.bMarks[g]+e.tShift[g],f=e.eMarks[g],d=4)){for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);if(!(Math.floor((l-d)/s)=2){let r=Number(i[0]),a=Number(i[1]);Number.isFinite(r)&&Number.isFinite(a)&&(e.map=[r+t,Math.min(a+t,n)])}Array.isArray(e.children)&&lL(e.children,t,n)}}function uL(e){[`admonition`,`info`,`warning`,`error`,`tip`,`danger`,`note`,`caution`].forEach(t=>{e.use(sL,t,{render(e,n){return e[n].nesting===1?`
        `:`
        -`}})}),e.block.ruler.before(`fence`,`vmr_container_fallback`,(e,t,n,r)=>{let i=e,a=i.bMarks[t]+i.tShift[t],o=i.eMarks[t],s=i.src.slice(a,o),c=s.match(/^:::\s*([^\s{]+)/);if(!c)return!1;let l=c[1];if(!l.trim())return!1;let u=s.slice(c[0].length).trim(),d,f,p=u.indexOf(`{`),m=p>=0?u.slice(p).trimStart():void 0;if(p===-1)d=u||void 0;else{if(d=u.slice(0,p).trim()||void 0,m?.startsWith(`{`)){let e=0,t=-1;for(let n=0;n0&&(f=m.slice(0,t))}f||(d=u||void 0)}if(r)return!0;let h=!!i.env.__markstreamFinal,g=t+1,_=!1;for(;g<=n;){let e=i.bMarks[g]+i.tShift[g],t=i.eMarks[g];if(i.src.slice(e,t).trim()===`:::`){_=!0;break}g++}_||(g=n);let v=i.push(`vmr_container_open`,`div`,1);if(v.attrSet(`class`,`vmr-container vmr-container-${l}`),v.map=[t,_?g:n],v.meta={...v.meta??{},unclosed:!_&&!h},d&&v.attrSet(`data-args`,d),f)try{let e=JSON.parse(f);for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}}catch{let e=cL(f);if(e)for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}else v.attrSet(`data-attrs`,f)}let y=[];for(let e=t+1;ee.trim().length>0)){let e=y.join(` +`,t+1);return n<0?null:e.slice(0,n+1)}getTableBodySection(e,t,n,r){if(t<0||t>=n||e[t]?.type!==`table_open`)return null;let i=-1;for(let a=n-1;a>t;a--){let t=e[a];if(t.type===`table_close`&&t.level===r){i=a;break}}if(i<0)return null;let a=-1,o=-1;for(let n=t+1;n=0){for(let t=i-1;t>a;t--){let n=e[t];if(n.type===`tbody_close`&&n.level===r+1){o=t;break}}if(o<0)return null}return{tableCloseIndex:i,tbodyOpenIndex:a,tbodyCloseIndex:o}}isSingleTopLevelContainer(e,t,n,r){if(e.length<2)return!1;let i=e[0],a=e[e.length-1];if(i.type!==t||a.type!==n||i.level!==0||a.level!==0||r!==void 0&&i.markup!==r)return!1;let o=0;for(let t=0;t0&&t0||n.nesting<0)&&(o+=n.nesting)}return o===0}getListParagraphMode(e,t,n,r){let i=!1,a=!1,o=r+2;for(let r=t;r=0;){let t=e.charCodeAt(n);if(t===32||t===9){n--;continue}return t===10}return!0}getDocLineCount(e,t=$k(e)){return e.length===0?0:e.charCodeAt(e.length-1)===10?t:t+1}shiftTokenLines(e,t){if(t===0)return;let n=null;for(let r=0;r=0;e--)n.push(i.children[e]);for(;n.length>0;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}}}},bI={default:UF,zero:WF,commonmark:HF};function xI(e){return{core:e.core.ruler.version,block:e.block.ruler.version,inline:e.inline.ruler.version,inline2:e.inline.ruler2.version}}function SI(e,t){return e.core.ruler.version!==t.core||e.block.ruler.version!==t.block||e.inline.ruler.version!==t.inline||e.inline.ruler2.version!==t.inline2}function CI(e){return e.experimental?{...e,...e.experimental}:e}function wI(e,t){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0)return!0;let n=e.experimental;return!!n&&Object.prototype.hasOwnProperty.call(n,t)&&n[t]!==void 0}function TI(e,t,n){for(let r=0;r=4?n.quotes=[e[0],e[1],e[2],e[3]]:n.quotes=[`“`,`”`,`‘`,`’`]}let o=TI(a?.options,i,[`fullChunkSizeChars`,`fullChunkSizeLines`,`fullChunkMaxChunks`]),s=TI(a?.options,i,[`streamChunkSizeChars`,`streamChunkSizeLines`,`streamChunkMaxChunks`]),c=EI(a?.options,i,`fullChunkedFallback`),l=EI(a?.options,i,`streamChunkedFallback`),u=!1,d=null,f=null,p=new oP,m=null,h=()=>(m||=new dI(n),m),g=null,_=()=>(g||=new yI(p),g),v=null,y=()=>(v||=new XA,v),b=e=>!u&&!!d&&!SI(e,d),x=(e,t)=>r==="default"&&!u&&m===null&&f!==null&&e.parse===f&&b(e)&&!e.stream.enabled&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.xhtmlOut===!1&&e.options.breaks===!1&&e.options.langPrefix===`language-`&&e.options.linkify===!1&&e.options.typographer===!1&&e.options.highlight===null,S=(e,t)=>r==="default"&&!u&&b(e)&&!e.stream.enabled&&!e.options.fullChunkedFallback&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.linkify===!1&&e.options.typographer===!1,C={core:p,block:p.block,inline:p.inline,get linkify(){let e=y();return Object.defineProperty(this,"linkify",{value:e,writable:!0,configurable:!0}),e},get renderer(){let e=h();return Object.defineProperty(this,"renderer",{value:e,writable:!0,configurable:!0}),e},options:n,__explicitFullChunkConfig:o,__explicitStreamChunkConfig:s,__explicitFullChunkFallbackSetting:c,__explicitStreamChunkFallbackSetting:l,__canUseImplicitLargeInputStrategy(){return b(this)},set(e){let t=CI(e);return this.options={...this.options,...t},(wI(e,`fullChunkSizeChars`)||wI(e,`fullChunkSizeLines`)||wI(e,`fullChunkMaxChunks`))&&(o=!0,this.__explicitFullChunkConfig=!0),(wI(e,`streamChunkSizeChars`)||wI(e,`streamChunkSizeLines`)||wI(e,`streamChunkMaxChunks`))&&(s=!0,this.__explicitStreamChunkConfig=!0),wI(e,`fullChunkedFallback`)&&(c=!0,this.__explicitFullChunkFallbackSetting=!0),wI(e,`streamChunkedFallback`)&&(l=!0,this.__explicitStreamChunkFallbackSetting=!0),m&&m.set(t),typeof t.stream==`boolean`&&(this.stream.enabled=t.stream,g&&(g.reset(),g.resetStats())),this},configure(e){let t=typeof e==`string`?bI[e]:e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");if(t.options&&this.set(t.options),t.components){let e=t.components;e.core?.rules&&this.core.ruler.enableOnly(e.core.rules),e.block?.rules&&this.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&this.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&this.inline.ruler2.enableOnly(e.inline2.rules)}return this},enable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.enable(n,!0);for(let e=0;e!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},disable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.disable(n,!0);for(let e=0;e!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},use(e,...t){let n=typeof e==`function`?e:e&&typeof e.default==`function`?e.default:void 0;if(!n)throw TypeError(`MarkdownIt.use: plugin must be a function`);let r=[this,...t],i=e;return u=!0,n.apply(i,r),this},render(e,t){let n;if(x(this,e.length)){t!==void 0&&(DA(t),n=SA(`render`));let r=n?OI():0,i=n?iF(e,n):rF(e);if(n&&(n.attemptMs=OI()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),OA(t,n)),i!==null)return t!==void 0&&kA(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&OA(r,n),h().render(i,this.options,r)},async renderAsync(e,t){let n;if(x(this,e.length)){t!==void 0&&(DA(t),n=SA(`render`));let r=n?OI():0,i=n?iF(e,n):rF(e);if(n&&(n.attemptMs=OI()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),OA(t,n)),i!==null)return t!==void 0&&kA(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&OA(r,n),h().renderAsync(i,this.options,r)},renderIterable(e,t={}){let n=this.parseIterable(e,t);return h().render(n,this.options,t)},async renderAsyncIterable(e,t={}){let n=await this.parseAsyncIterable(e,t);return h().renderAsync(n,this.options,t)},renderInline(e,t={}){let n=this.parseInline(e,t);return h().render(n,this.options,t)},validateLink:uN,normalizeLink:dN,normalizeLinkText:fN,utils:Sk,helpers:{...dj},parse(e,t){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);if(t!==void 0&&DA(t),S(this,e.length)){let n=t===void 0?void 0:SA(`parse`),r=n?OI():0,i=kP(e,n);if(n&&(n.attemptMs=OI()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),OA(t,n)),i!==null)return t!==void 0&&kA(t,{area:`parse`,path:`stock-fast`,reason:`stock-subset`}),i}let n=t??{},r;if(!this.stream.enabled&&!this.options.fullChunkedFallback&&b(this)){let i=NF(this,e.length);if(i===`yes`){let r=PF(this,e,n);return kA(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`char-threshold`}),r}i===`need-lines`&&(r=$k(e))}if(!this.stream.enabled){let i=e.length,a=this.options.autoTuneChunks!==!1,s=o,l=!c&&b(this),u=!!this.options.fullChunkedFallback,d=l&&i>=2e5,f;(u||d||r!==void 0)&&(f=r??$k(e));let p=(u||d)&&a&&!s?BF(i,f,this.options):null;if(u||d){let r=f??0;if(u?i>=(this.options.fullChunkThresholdChars??2e4)||r>=(this.options.fullChunkThresholdLines??400):d){if(p&&p.strategy!==`plain`){let r=oF(this,e,n,{maxChunkChars:p.maxChunkChars,maxChunkLines:p.maxChunkLines,fenceAware:p.fenceAware,maxChunks:p.maxChunks});return t&&DI(t,u?`explicit-full-chunk`:`default-large-string`),r}if(u){let a=(e,t,n)=>en?n:e,o=this.options.fullChunkAdaptive!==!1,s=this.options.fullChunkTargetChunks??8,c=a(Math.ceil(i/s),8e3,64e3),l=a(Math.ceil(r/s),150,700),u=o?c:this.options.fullChunkSizeChars??1e4,d=o?l:this.options.fullChunkSizeLines??200,f=o?a(Math.ceil(i/64e3),s,32):this.options.fullChunkMaxChunks,p=oF(this,e,n,{maxChunkChars:u,maxChunkLines:d,fenceAware:this.options.fullChunkFenceAware??!0,maxChunks:f});return t&&DI(t,`explicit-full-chunk`),p}}}if(r!==void 0&&b(this)&&MF(this,i,f??r)){let r=PF(this,e,n);return kA(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`line-threshold`}),r}}let i=gA(e);return kA(t,{area:`parse`,path:`plain`,reason:`default-plain`}),vA(n,i,()=>p.parse(e,n,this).tokens)},parseIterable(e,t={}){return DA(t),OF(this,e,t)},parseAsyncIterable(e,t={}){return DA(t),kF(this,e,t)},parseIterableToSink(e,t,n={}){return DA(n),AF(this,e,t,n)},parseAsyncIterableToSink(e,t,n={}){return DA(n),jF(this,e,t,n)},parseInline(e,t={}){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);DA(t),_A(t)&&xA(t);let n=p.createState(e,t,this);return n.inlineMode=!0,p.process(n),n.tokens}};if(C.stream={enabled:!!n.stream,parse(e,t){return C.stream.enabled?_().parse(e,t,C):C.parse(e,t??{})},reset(){_().reset()},peek(){return g?g.peek():[]},stats(){return g?g.getStats():{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:`idle`}},resetStats(){g&&g.resetStats()}},a?.components){let e=a.components;e.core?.rules&&C.core.ruler.enableOnly(e.core.rules),e.block?.rules&&C.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&C.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&C.inline.ruler2.enableOnly(e.inline2.rules)}return d=xI(C),f=C.parse,C}var AI=kI,jI;function MI(){return jI}var NI=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`],PI=`a.abbr.b.bdi.bdo.button.cite.code.data.del.dfn.em.font.i.ins.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var`.split(`.`),FI=`article.aside.blockquote.details.div.figcaption.figure.footer.header.h1.h2.h3.h4.h5.h6.li.main.nav.ol.p.pre.section.summary.table.tbody.td.th.thead.tr.ul`.split(`.`),II=[`svg`,`g`,`path`],LI=`address.audio.body.canvas.caption.colgroup.datalist.dd.dialog.dl.dt.fieldset.form.head.hgroup.html.iframe.legend.map.menu.meter.noscript.object.optgroup.option.output.picture.progress.rp.rt.ruby.script.select.style.template.textarea.tfoot.title.video`.split(`.`),RI=`onclick.onerror.onload.onmouseover.onmouseout.onmousedown.onmouseup.onkeydown.onkeyup.onfocus.onblur.onsubmit.onreset.onchange.onselect.ondblclick.ontouchstart.ontouchend.ontouchmove.ontouchcancel.onwheel.onscroll.oncopy.oncut.onpaste.oninput.oninvalid.onsearch.innerhtml.outerhtml.textcontent.innertext.srcdoc.ping`.split(`.`),zI=[`action`,`data`,`href`,`src`,`srcset`,`poster`,`xlink:href`,`formaction`],BI=[`script`],VI=[`pre`,`iframe`,`picture`,`script`,`style`,`table`,`tbody`,`td`,`tfoot`,`th`,`thead`,`textarea`,`tr`,`title`,`video`],HI=new Set(NI),UI=new Set(FI),WI=new Set([...NI,...PI,...FI,...II]),GI=new Set([...WI,...LI]),KI=new Set(RI),qI=new Set(zI),JI=new Set(BI),YI=new Set(VI);function XI(e){let t=``;for(let n of e){let e=n.charCodeAt(0);e<=31||e>=127&&e<=159||/\s/u.test(n)||(t+=n)}return t}var ZI={amp:`&`,bsol:`\\`,colon:`:`,newline:` +`,sol:`/`,tab:` `};function QI(e){return e.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]+));?/gi,(e,t,n,r)=>{let i=t??n;if(i){let e=Number.parseInt(i,t?10:16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return ZI[String(r??``).toLowerCase()]??e})}var $I=new Set([`http`,`https`,`mailto`,`tel`]),eL=new Set([`javascript`,`vbscript`,`data`,`file`,`ftp`,`blob`,`filesystem`,`intent`,`chrome`,`chrome-extension`,`moz-extension`,`ms-browser-extension`,`view-source`]),tL=new Set([`http`,`https`]);function nL(e){return e.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()??``}var rL=/^https?:\/\//i;function iL(e){if(!rL.test(e))return!1;for(let t of e){let e=t.charCodeAt(0);if(t===`&`||e<=32||e>=127&&e<=159||e>127&&/\s/u.test(t))return!1}return!0}function aL(e,t,n){if(!oL(t,n)||!e.startsWith(`file:///`))return!1;let r=e.charAt(8);return r!==`/`&&r!==`\\`}function oL(e,t){return e?(e===`a`||e===`area`)&&(!t||t===`href`||t===`xlink:href`):!t||t===`href`}function sL(e,t){return t===`href`||t===`xlink:href`?oL(e,t)?$I:tL:t===`src`||t===`srcset`||t===`poster`||t===`action`||t===`formaction`||t===`data`?tL:$I}function cL(e,t={}){if(iL(e))return!1;let n=XI(QI(e)).toLowerCase(),r=String(t.tagName??``).toLowerCase(),i=String(t.attrName??``).toLowerCase();if(!n)return!1;if(n.startsWith(`data:`)){let e=/^data:image\/(?:png|gif|jpe?g|webp|avif|bmp);/i.test(n);return r===`img`&&i===`src`?!e:!0}if(/^[\\/]{2}/.test(n))return!0;if(n.startsWith(`/`)||n.startsWith(`./`)||n.startsWith(`../`)||n.startsWith(`#`)||n.startsWith(`?`))return!1;let a=nL(n);return a?a===`file`?!aL(n,r,i):oL(r,i)?eL.has(a):!sL(r,i).has(a):!1}function lL(e){let t=QI(String(e??``)).trim();if(!t||t.startsWith(`#`)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`?`))return!1;let n=nL(XI(t).toLowerCase());return n===`http`||n===`https`}function uL(e,t={}){let n=String(e??``).trim();return n?cL(n,t)?``:n:``}function dL(e){return uL(e,{tagName:`img`,attrName:`src`})}function fL(e,t,n){function r(e){return e.trim().split(` `,2)[0]===t}function i(e,n,r,i,a){return e[n].nesting===1&&e[n].attrJoin(`class`,t),a.renderToken(e,n,r,i,a)}n||={};let a=n.marker||`:`,o=a.charCodeAt(0),s=a.length,c=n.validate||r,l=n.render||i;function u(e,n,r,i){let l,u=!1,d=e.bMarks[n]+e.tShift[n],f=e.eMarks[n];if(o!==e.src.charCodeAt(d))return!1;for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);let p=Math.floor((l-d)/s);if(p<3)return!1;l-=(l-d)%s;let m=e.src.slice(d,l),h=e.src.slice(l,f);if(!c(h,m))return!1;if(i)return!0;let g=n;for(;g++,!(g>=r||(d=e.bMarks[g]+e.tShift[g],f=e.eMarks[g],d=4)){for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);if(!(Math.floor((l-d)/s)=2){let r=Number(i[0]),a=Number(i[1]);Number.isFinite(r)&&Number.isFinite(a)&&(e.map=[r+t,Math.min(a+t,n)])}Array.isArray(e.children)&&mL(e.children,t,n)}}function hL(e){[`admonition`,`info`,`warning`,`error`,`tip`,`danger`,`note`,`caution`].forEach(t=>{e.use(fL,t,{render(e,n){return e[n].nesting===1?`
        `:`
        +`}})}),e.block.ruler.before(`fence`,`vmr_container_fallback`,(e,t,n,r)=>{let i=e,a=i.bMarks[t]+i.tShift[t],o=i.eMarks[t],s=i.src.slice(a,o),c=s.match(/^:::\s*([^\s{]+)/);if(!c)return!1;let l=c[1];if(!l.trim())return!1;let u=s.slice(c[0].length).trim(),d,f,p=u.indexOf(`{`),m=p>=0?u.slice(p).trimStart():void 0;if(p===-1)d=u||void 0;else{if(d=u.slice(0,p).trim()||void 0,m?.startsWith(`{`)){let e=0,t=-1;for(let n=0;n0&&(f=m.slice(0,t))}f||(d=u||void 0)}if(r)return!0;let h=!!i.env.__markstreamFinal,g=t+1,_=!1;for(;g<=n;){let e=i.bMarks[g]+i.tShift[g],t=i.eMarks[g];if(i.src.slice(e,t).trim()===`:::`){_=!0;break}g++}_||(g=n);let v=i.push(`vmr_container_open`,`div`,1);if(v.attrSet(`class`,`vmr-container vmr-container-${l}`),v.map=[t,_?g:n],v.meta={...v.meta??{},unclosed:!_&&!h},d&&v.attrSet(`data-args`,d),f)try{let e=JSON.parse(f);for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}}catch{let e=pL(f);if(e)for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}else v.attrSet(`data-attrs`,f)}let y=[];for(let e=t+1;ee.trim().length>0)){let e=y.join(` `);e.endsWith(` `)||(e+=` `),e.endsWith(` `)||(e+=` -`);let n=i.tokens[i.tokens.length-1];n&&(n.raw=e);let r=[];i.md.block.parse(e,i.md,i.env,r),lL(r,t+1,t+1+y.length),i.tokens.push(...r)}let b=i.push(`vmr_container_close`,`div`,-1);return _||(b.hidden=!0,b.map=[n,n]),i.line=_?g+1:g,!0},{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function dL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fL(e){let t=!1,n=!1;for(let r=0;r`)return r}return-1}function pL(e){let t=[],n=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!e)continue;let n=r[2]||r[3]||r[4]||``;t.push([e,n])}return t}var mL=/^[a-z][a-z0-9_-]*$/;function hL(e){return mL.test(String(e??``).trim().toLowerCase())}function gL(e){let t=String(e??``).trim();if(!t)return``;if(!t.startsWith(`<`))return hL(t)?t.toLowerCase():``;let n=1;for(;n]/.test(a)?``:hL(i)?i:``}function _L(e){if(!e||e.length===0)return[];let t=new Set,n=[];for(let r of e){let e=gL(r);!e||t.has(e)||(t.add(e),n.push(e))}return n}function vL(...e){let t=new Set,n=[];for(let r of e)for(let e of _L(r))t.has(e)||(t.add(e),n.push(e));return n}function yL(e){let t=_L(e);return{key:t.join(`,`),tags:t}}function bL(e){return gL(e)}function xL(e,t){let n=String(e??``),r=gL(t);if(!r)return!1;let i=dL(r),a=n.match(new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?(\s*\/)?>`,`i`));return a?a[1]?!0:new RegExp(String.raw`<\s*\/\s*${i}\s*>`,`i`).test(n):!1}function SL(e,t){let n=gL(t);return!!n&&!zI.has(n)&&!xL(e,n)}function CL(e,t){let n=String(e??``),r=gL(t);if(!r)return n;let i=dL(r),a=new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?>\s*`,`i`),o=new RegExp(String.raw`\s*<\s*\/\s*${i}\s*>\s*$`,`i`);return n.replace(a,``).replace(o,``)}var wL=LI,TL=zI,EL=new Set(RI);EL.delete(`details`);var DL=/<([A-Z][\w-]*)(?=[\s/>]|$)/gi,OL=/<\/\s*([A-Z][\w-]*)(?=[\s/>]|$)/gi,kL=/^<\s*(?:\/\s*)?([A-Z][\w-]*)/i,AL=/^<\s*([A-Z][\w:-]*)(?=[\s/>]|$)/i;function jL(e){return(e.match(kL)?.[1]??``).toLowerCase()}function ML(e){return/^\s*<\s*\//.test(e)}function NL(e,t){return wL.has(t)||/\/\s*>\s*$/.test(e)}function PL(e,t){let n=0;for(let r=0;r0&&n--;continue}NL(e,i)||n++}}return n}function IL(e,t,n=0){let r=new RegExp(String.raw`<\s*(\/?)\s*${dL(t)}(?=[\s>/])[^>]*>`,`gi`);r.lastIndex=Math.max(0,n);let i=0,a;for(;(a=r.exec(e))!==null;){let e=a[0]??``,t=!!a[1],n=!t&&/\/\s*>$/.test(e);if(t){if(i===0)return{start:a.index,end:a.index+e.length};i--;continue}n||i++}return null}function LL(e,t){let n=new RegExp(String.raw`<\s*(\/?)\s*${dL(t)}(?=[\s>/])[^>]*>`,`gi`),r=0,i;for(;(i=n.exec(e))!==null;){let e=i[0]??``,t=!!i[1],n=!t&&/\/\s*>$/.test(e);if(t){r>0&&r--;continue}n||r++}return r}function RL(e){let t=e;return String(t.raw??t.content??t.markup??``)}function zL(e){let t=e;return t.meta||={},t.meta}function BL(e,t,n){let r=zL(e);r.markstreamCustomHtmlRaw=t,r.markstreamCustomHtmlInner=n}function VL(e,t){if(!t.size)return;let n=Array.from(t,e=>new RegExp(String.raw`<\s*${dL(e)}(?=[\s>/])`,`i`)),r=[],i=!1,a=e=>e?n.some(t=>t.test(e)):!1,o=e=>{if(!(!e||!r.length))for(let t of r)t.raw+=e,t.inner+=e},s=()=>{!r.length||!i||(o(` -`),i=!1)},c=e=>{o(e)},l=e=>{for(let t=0;t{let t=r[r.length-1]?.tag;if(!t)return null;let n=new RegExp(String.raw`^\s*<\s*\/\s*${dL(t)}\s*>`,`i`);return e.match(n)?.[0]??null},d=e=>!!u(e),f=(e,n,i)=>{let a=i??(e.type===`html_inline`?jL(n):``);if(!(a&&t.has(a))){o(n);return}let s=ML(n),c=!s&&NL(n,a);if(s){if(!r.length||r[r.length-1].tag!==a){o(n);return}l(n);return}if(o(n),c){BL(e,n,``);return}r.push({tag:a,token:e,raw:n,inner:``})};for(let n of e){if(n.type===`inline`&&Array.isArray(n.children)){let e=String(n.content??``);if(d(e)?i=!1:s(),!r.length&&!a(e)){i=!1;continue}let o=0,l=!0;for(let i of n.children){let n=RL(i),a=i.type===`html_inline`?jL(n):``,s=a&&t.has(a),u=n;if(l&&e&&n&&(r.length||s)){let t=e.indexOf(n,o);if(t!==-1)c(e.slice(o,t)),u=e.slice(t,t+n.length),o=t+n.length;else{if(r.length&&!s)continue;l=!1}}f(i,u,a)}l&&e&&o0;continue}if(r.length&&typeof n.content==`string`){let e=RL(n),t=n.type===`html_block`?u(e):null;if(t){l(`${i?` -`:``}${t}`),i=r.length>0;continue}if(!n.content)continue;s(),o(n.content),i=!0}}for(let e of r)BL(e.token,e.raw,e.inner)}function HL(e){return/^\s*<\s*[!?]/.test(e)}function UL(e){let t=new Set(TL);if(e&&Array.isArray(e))for(let n of e){let e=String(n??``).trim();if(!e)continue;let r=e.match(/^[<\s/]*([A-Z][\w-]*)/i);r&&t.add(r[1].toLowerCase())}return t}function WL(e,t){if(t.has(e))return!0;for(let n of t)if(n.startsWith(e))return!0;return!1}function GL(e,t){let n=null;for(let r of e.matchAll(DL)){let i=r.index??-1;if(i<0)continue;let a=(r[1]??``).toLowerCase();WL(a,t)&&fL(e.slice(i))===-1&&(!n||i`)&&(!n||t`)&&(!n||t{let t=e,r=new Set(n),i=Array.isArray(t.env?.__markstreamCustomHtmlTags)?t.env.__markstreamCustomHtmlTags:[];for(let e of i){let t=gL(String(e??``));t&&r.add(t)}let a=UL(Array.from(r)),o=new Set(JL);for(let e of r)o.add(e);return{autoCloseInlineTagSet:o,commonHtmlTags:a,customTagSet:r,shouldMergeHtmlBlockTag:e=>r.has(e)||!a.has(e)||EL.has(e)}},i=e=>{if(e.type===`html_block`)return String(e.content??``);if(e.type!==`inline`||!Array.isArray(e.children)||e.children.length!==1)return``;let t=e.children[0];return t?.type===`html_block`?String(e.content??t.content??``):``},a=(e,t)=>{e.type=`html_block`,e.content=t,e.raw=t,e.children=[]},o=e=>e.replace(/^(?:\r?\n)+/,``),s=e=>/^(?: {4}|\t)/.test(e),c=e=>e.replace(/^(?: {4}|\t)/gm,``),l=(e,t)=>{let n=o(e);if(!/\S/.test(n))return[];if(s(n))return[{type:`code_block`,content:c(n),raw:n}];let r=n.replace(/^[\t ]+/,``);if(!r)return[];if(r.startsWith(`<`))return[{type:`html_block`,content:r}];let i={type:`inline`,tag:``,nesting:0,content:r,children:[{type:`text`,content:r,raw:r}]};return t===`paragraph`?[{type:`paragraph_open`,tag:`p`,nesting:1},i,{type:`paragraph_close`,tag:`p`,nesting:-1}]:t===`text`?[{type:`text`,content:r,raw:r}]:[i]},u=(e,t,n)=>e[t-1]?.type===`paragraph_open`&&e[t+1]?.type===`paragraph_close`?`inline`:n,d=(e,t)=>{let n=o(t);return!/\S/.test(n)||e.type!==`inline`||!Array.isArray(e.children)?!1:(e.content=`${String(e.content??``)}${n}`,e.children.push({type:`text`,content:n,raw:n}),!0)};e.core.ruler.after(`inline`,`fix_html_inline_streaming`,e=>{let t=e.tokens??[],{commonHtmlTags:n,customTagSet:i}=r(e);for(let e of t){let t=e;if(t.type!==`inline`||!Array.isArray(t.children))continue;let r=String(t.content??``),i=t.children.length?t.children:r.includes(`<`)?[{type:`text`,content:r,raw:r}]:null;if(i)try{let e=qL(i,n);if(t.children=e.children,e.pendingBuffer){let n=r.lastIndexOf(e.pendingBuffer);if(n!==-1){let e=r.slice(0,n);t.content=e,typeof t.raw==`string`&&(t.raw=e)}}}catch(e){console.error(`[applyFixHtmlInlineTokens] failed to fix streaming html inline`,e)}}VL(t,i)}),e.core.ruler.push(`fix_html_inline_tokens`,e=>{let t=e.tokens??[],{autoCloseInlineTagSet:n,customTagSet:o,shouldMergeHtmlBlockTag:s}=r(e),c=[];for(let e=0;e0){let[r,i]=c[c.length-1];if(e!==i){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let a=String(n.content??n.raw??``);if(a){let n=t[i],o=`${String(n.content||``)}\n${a}`,s=fL(o),f=s===-1?null:IL(o,r,s+1);if(f){let r=o.slice(0,f.end),i=o.slice(f.end);n.content=r,n.loading=!1,t.splice(e,1),c.pop();let a=d(n,i)?[]:l(i,u(t,e,`paragraph`));a.length&&t.splice(e,0,...a),e--;continue}n.content=o,n.loading!==!1&&(n.loading=!0)}t.splice(e,1),e--;continue}}let r=i(n);if(r){if(HL(r))continue;let i=(r.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1]??``).toLowerCase(),o=/^\s*<\s*\//.test(r);if(!i||!s(i))continue;if(a(n,r),!o)i&&!RegExp(`^\\s*<\\s*${i}\\b[^>]*\\/\\s*>`,`i`).test(r)&&LL(r,i)>0&&c.push([i,e]);else if(c.length>0&&i&&c[c.length-1][0]===i){let[,n]=c[c.length-1],i=t[n];i.content=`${String(i.content||``)}\n${r}`,i.loading=!1,c.pop(),t.splice(e,1),e--}continue}else if(c.length>0){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let r=n.content||``,i=RegExp(`<\\s*\\/\\s*${c[c.length-1][0]}\\s*>`,`i`).test(r);if(r){let[,e]=c[c.length-1],n=t[e];n.content=`${n.content||``}\n${r}`,n.loading!==!1&&(n.loading=!i)}i&&c.pop(),t.splice(e,1),e--}else continue}if(o.size>0){let e=new Map,n=new Map,r=t=>{let n=e.get(t);return n||(n=RegExp(`<\\s*${t}\\b`,`i`),e.set(t,n)),n},i=e=>{let t=n.get(e);return t||(t=RegExp(`<\\s*\\/\\s*${e}\\s*>`,`i`),n.set(e,t)),t},a=[];for(let e=0;e0){let r=a[a.length-1],o=t[r.index],c=n.type===`html_block`?i(r.tag).exec(s):null;if(c){let n=c.index+c[0].length,i=s.slice(0,n),f=s.slice(n);o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push({type:`html_inline`,content:``,raw:``}),a.pop();let p=d(o,f)?[]:l(f,u(t,e,`paragraph`));p.length?t.splice(e,1,...p):(t.splice(e,1),e--);continue}if(n.type!==`inline`)continue;let f=Array.isArray(n.children)?n.children:[],p=PL(f,r.tag);if(p!==-1){let n=f.slice(0,p+1),r=f.slice(p+1),i=n.map(e=>String(e?.content??e?.raw??``)).join(``);if(o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push(...n),r.length){let n=r.map(e=>String(e.content??e.raw??``)).join(``);if(n.trim()){let r=n.replace(/^\s+/,``);if(d(o,n))t.splice(e,1),e--;else if(r.startsWith(`<`))t.splice(e,1,{type:`html_block`,content:r});else{let r=l(n,u(t,e,`paragraph`));t.splice(e,1,...r)}}else t.splice(e,1),e--}else t.splice(e,1),e--;a.pop();continue}o.content=`${String(o.content??``)}\n${s}`,Array.isArray(o.children)&&o.children.push(...f),t.splice(e,1),e--;continue}if(n.type!==`inline`)continue;let c=Array.isArray(n.children)?n.children:[];for(let t of o)if((c.length?FL(c,t):r(t).test(s)&&!i(t).test(s)?1:0)>0){a.push({tag:t,index:e});break}}}{let e=0;for(let n=0;n0?e--:(t.splice(n,1),n--))}}for(let e=0;e/]+)/)?.[1]??``).toLowerCase();if(n.startsWith(`!`)||n.startsWith(`?`)){r.loading=!1;continue}if(o.has(n)){let i=String(r.content??``),a=fL(i),o=a===-1?null:IL(i,n,a+1);r.loading=o?!1:r.loading===void 0?!0:r.loading;let s=o?.start??-1,c=o?o.end-o.start:0;if(s!==-1){let o=i.slice(0,s+c),u=``;a!==-1&&a]+)))?/g,s;for(;(s=a.exec(r.content||``))!==null;){let e=s[1],t=s[2]||s[3]||s[4]||``;i.push([e,t])}let c=String(r.content??``),u=RegExp(`<\\/\\s*${n}\\s*>`,`i`).exec(c),d=u?u.index:-1,f=u?u[0].length:0;if(d!==-1){let i=c.slice(0,d+f),a=(c.slice(d+f)||``).replace(/^\s+/,``);r.children=[{type:`html_block`,content:i,tag:n,loading:!1}],r.content=i,r.raw=i,a&&t.splice(e+1,0,a.startsWith(`<`)?{type:`html_block`,content:a}:{type:`text`,content:a,raw:a})}else r.children=[{type:`html_block`,content:r.content,tag:n,loading:!0}];continue}if(!r||r.type!==`inline`)continue;if(r.children.length===2&&r.children[0].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase(),t=r.children[1],i=String(t?.content??``).match(/^<\s*\/\s*([^\s>]+)/)?.[1]?.toLowerCase()??``;if(t?.type===`html_inline`&&i===e)continue;n.has(e)?(r.children[0].loading=!0,r.children[0].tag=e,r.children.push({type:`html_inline`,tag:e,loading:!0,content:``})):r.children=[{type:`html_block`,loading:!0,tag:e,content:String(r.children[0]?.content??``)+String(r.children[1]?.content??``)}];continue}else if(r.children.length===3&&r.children[0].type===`html_inline`&&r.children[2].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase();if(n.has(e))continue;r.children=[{type:`html_block`,loading:!1,tag:e,content:r.children.map(e=>e.content).join(``)}];continue}if(!r.content?.startsWith(`<`)||r.children?.length!==1)continue;let i=String(r.content),a=r,s=a.children[0];if(s?.type!==`html_inline`){/^<\s*(?:\/\s*)?[A-Z][\w:-]*\s*$/i.test(i)&&(a.children.length=0);continue}let c=String(s.content??i).match(AL)?.[1]?.toLowerCase()??``;if(c){if(/\/\s*>\s*$/.test(i)||wL.has(c)){a.children=[{type:`html_inline`,content:i}];continue}a.children.length=0}}})}function XL(e){let t=e.trim();return!t||/^&[a-z0-9#]+;/i.test(t)?!1:!!(/^(?:const|let|var|function|class|import|export|if|for|while|return|await|async|yield|try|catch|throw|new|typeof|instanceof|switch|case|break|continue|def|ruby|perl|print|echo|true|false|null|undefined|NaN|Infinity|this)\b/.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\])*\s*\(/i.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[[\d+\]])+/i.test(t)||/\w+\s*(?:===?|!==?|<=?|>=?|\+\+|--|&&|\|\||\?\.)/.test(t)||/^(?:!!|\+\+|--)\s*\w/.test(t)||/[\w$]+\s*(?:\+=|-=|\*=|\/=|%=|\*\*=|=)/.test(t)||/^(?:https?:\/\/|ftp:\/\/|file:\/\/|\/\/|www\.)/i.test(t)||/`[^`]*\$\{[^}]*\}[^`]*`/.test(t)||/<\/?[A-Z][a-zA-Z0-9]*/.test(t)||/<[a-z][a-z0-9]*\s[^>]+>/.test(t)||/^(["'`]).*\1\s*[;,]?$/.test(t)||/^\[[\s\S]*\]$/.test(t)||/^\{[\s\S]*\}$/.test(t)||/^\(\s*\)$/.test(t)||/[\w$]+(?:\s*[+\-*/%<>=!&|^~:]+\s*[\w$]+|\s*\.\s*[\w$]+)/.test(t)||/=>|->|::/.test(t)||/^@[\w.$]+$/.test(t)||/^(?:0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\d+(?:\.\d*)?(?:px|em|rem|%|vh|vw|deg|s|ms)?)$/.test(t)||/^\$[\w$]+\s*[=:]/.test(t)||/\|\s*\w+|\w+\s*\|/.test(t)||/^(?:git|npm|yarn|pnpm|bun|pip|cargo|go|rust|python|node|java|mvn|gradle|docker|kubectl)\s+/.test(t)||/(?:console|window|document|Math|JSON|Date|Array|Object|String|Number|Boolean)\.[a-zA-Z]/.test(t)||/^(?:\/\/|#|\/\*|\*\/|)/.test(t)||/^(?:<<<|<<\s*['"]?\w+['"]?)/.test(t))}function ZL(e,t={}){t.enabled!==!1&&e.core.ruler.after(`inline`,`fix_indented_code_block`,e=>{let t=e.tokens??[];for(let e=0;ee.trim().length>0);if(i.length===1&&!XL(i[0]??``)){let r=i[0]??``,a=n.level??0;t.splice(e,1,{type:`paragraph_open`,tag:`p`,nesting:1,level:a},{type:`inline`,tag:``,nesting:0,level:a,content:r,children:[{type:`text`,content:r,level:a+1,raw:r}],block:!0},{type:`paragraph_close`,tag:`p`,nesting:-1,level:a}),e+=2}}})}var QL=/\.([a-z0-9]{1,15})$/i,$L=/[_()[\]{}<>]/u,eR=/^(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/i,tR=/[?#@]/u,nR=/[\\/]/u,rR=/^[\p{L}\p{N}./\\-]+$/u,iR=/^[A-Za-z0-9-]{1,63}$/u,aR=/^xn--[a-z0-9-]{2,59}$/i,oR=/^(?:[A-Z]{1,6}|\d{1,8})$/u,sR=/^(?=.{1,12}$)[A-Z0-9]+(?:[-.][A-Z0-9]+)*$/iu,cR=/文件名\s*[::]?|附件\s*[::]?|路径\s*[::]?|路徑\s*[::]?|文件列表\s*[::]?|文档列表\s*[::]?|文檔列表\s*[::]?|\bfile\s*names?\b\s*[::]?|\battachments?\b\s*[::]?|\bpaths?\b\s*[::]?|\bfile\s+lists?\b\s*[::]?|\bdocument\s+lists?\b\s*[::]?/iu,lR=/文件名\s*[::]?|文件\s*[::]?|附件\s*[::]?|档案\s*[::]?|檔案\s*[::]?|文档\s*[::]?|文檔\s*[::]?|资料\s*[::]?|資料\s*[::]?|路径\s*[::]?|路徑\s*[::]?|\bfile\s*name\b\s*[::]?|\battachments?\b\s*[::]?|\bfiles?\b\s*[::]?|\bdocuments?\b\s*[::]?|\bdocs?\b\s*[::]?|\bpaths?\b\s*[::]?/iu,uR=/股票代码|股票代碼|证券代码|證券代碼|(?:代码|代碼|交易所|后缀|後綴|市场|市場)(?=$|[\s::/|,,、()()])|\btickers?\b|\bsymbols?\b|\bexchanges?\b/iu,dR=2e3,fR=512,pR={},mR=new Set([`ai`,`md`,`py`,`rs`,`sh`,`zip`]),hR=new Set([`as`,`bj`,`de`,`hk`,`l`,`ln`,`ny`,`pa`,`sh`,`ss`,`sz`,`t`,`us`]),gR=new Set([...hR,`at`,`ax`,`cn`,`co`,`it`,`jp`,`ks`,`mc`,`mx`,`nz`,`pl`,`sa`,`si`,`to`,`tw`]),_R=new Set([`com`,`dev`,`io`,`page`,`site`]),vR=new Set([`app`,`apk`,`dmg`,`exe`,`ipa`,`lock`,`log`,`markdown`,`webmanifest`]),yR=new Set(`7z.ai.astro.avi.bash.bz2.c.cjs.cpp.cs.csv.doc.docx.fish.flac.gif.go.gz.h.hpp.html.java.jpeg.jpg.js.json.jsx.kt.md.mdx.mjs.mov.mp3.mp4.pdf.php.png.ppt.pptx.ps1.py.rar.rb.rs.sh.sql.svg.swift.svelte.tar.tgz.toml.ts.tsx.txt.vue.wav.webp.xls.xlsx.xml.yaml.yml.zip.zsh`.split(`.`)),bR=new Map;function xR(e,t){if(!e||e.length>fR)return t;for(bR.set(e,t);bR.size>dR;){let e=bR.keys().next().value;if(!e)break;bR.delete(e)}return t}function SR(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function CR(e,t){let n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return SR(n)?n:void 0}function wR(e,t){if(!SR(t))return e;let n=e?.__linkifyDemotionContext;return{...e,__linkifyDemotionContext:{filename:n?.filename||t?.filename,explicitFilename:n?.explicitFilename||t?.explicitFilename,marketTicker:n?.marketTicker||t?.marketTicker}}}function TR(e){let t=IR(e);return SR(t)?t:void 0}function ER(e){return e.replace(/^[\s>*_`[\]((【《"'“‘]+/u,``).replace(/[\s<*_`\]))】》"'.。;;,,、::!?!?]+$/u,``)}function DR(e,t){if(!SR(t))return;let n=String(e??``).trim().split(/\s+/u).map(ER).filter(Boolean);if(n.length===0)return;let r={};return t?.filename&&n.every(e=>VR(e,{filename:!0,explicitFilename:t.explicitFilename}))&&(r.filename=!0),t?.explicitFilename&&r.filename&&(r.explicitFilename=!0),t?.marketTicker&&n.every(e=>VR(e,{marketTicker:!0}))&&(r.marketTicker=!0),SR(r)?r:void 0}function OR(e,t=!1){let n;return{options(r){return t||r==null?wR(e,n):wR(e,CR(TR(r),DR(r,n)))},remember(e){let r=TR(e);n=t?CR(n,r):CR(r,DR(e,n))},reset(){n=void 0}}}function kR(e){return iR.test(e)&&!e.startsWith(`-`)&&!e.endsWith(`-`)}function AR(e){let t=e.split(`.`);if(t.length<2)return!1;let n=t[t.length-1]?.toLowerCase()??``;return kR(n)||aR.test(n)?t.every(kR):!1}function jR(e){return Array.from(e).some(e=>e.charCodeAt(0)>127)}function MR(e){return e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``).split(/[/?#]/,1)[0]??``}function NR(e){return e.split(`.`).some(e=>e.toLowerCase().startsWith(`xn--`))}function PR(e,t,n){let r=MR(t);return jR(e)&&NR(r)&&String(n??``).toLowerCase().includes(r.toLowerCase())}function FR(e){if(!e)return!1;if(e.includes(`文件`)||e.includes(`附件`)||e.includes(`路径`)||e.includes(`路徑`)||e.includes(`文档`)||e.includes(`文檔`)||e.includes(`档案`)||e.includes(`檔案`)||e.includes(`资料`)||e.includes(`資料`)||e.includes(`股票`)||e.includes(`证券`)||e.includes(`證券`)||e.includes(`代码`)||e.includes(`代碼`)||e.includes(`交易所`)||e.includes(`后缀`)||e.includes(`後綴`)||e.includes(`市场`)||e.includes(`市場`))return!0;let t=e.toLowerCase();return t.includes(`file`)||t.includes(`attachment`)||t.includes(`document`)||t.includes(`doc`)||t.includes(`path`)||t.includes(`ticker`)||t.includes(`symbol`)||t.includes(`exchange`)}function IR(e){let t=String(e??``),n=bR.get(t);return n?(bR.delete(t),bR.set(t,n),n):FR(t)?xR(t,{explicitFilename:cR.test(t),filename:lR.test(t),marketTicker:uR.test(t)}):xR(t,pR)}function LR(e){return AR(e.split(/[\\/]/)[0]??``)}function RR(e){let t=e.replace(/[^a-z]/gi,``);return t.length>=2&&t===t.toUpperCase()}function zR(e){if($L.test(e)||!rR.test(e))return!0;if(nR.test(e))return!LR(e);let t=e.replace(QL,``);return jR(t)?!0:t.split(`.`).filter(Boolean).some(RR)}function BR(e,t,n){if(!(n?gR:hR).has(t))return!1;let r=e.slice(0,-(t.length+1));return r===``?e.startsWith(`.`):(n?sR:oR).test(r)}function VR(e,t={}){if(!e||eR.test(e)||tR.test(e))return!1;let n=e.match(QL);if(!n)return!1;let r=String(n[1]??``).toLowerCase();return BR(e,r,t.marketTicker===!0)?!0:yR.has(r)?!mR.has(r)||t.filename?!0:zR(e):!!(t.explicitFilename&&_R.has(r)||t.filename&&vR.has(r))}var HR=[`!`];function UR(e){return{type:`text`,content:e,raw:e}}function WR(e,t){t===1?e.push({type:`em_open`,tag:`em`,nesting:1}):t===2?e.push({type:`strong_open`,tag:`strong`,nesting:1}):t===3&&(e.push({type:`strong_open`,tag:`strong`,nesting:1}),e.push({type:`em_open`,tag:`em`,nesting:1}))}function GR(e,t){t===1?e.push({type:`em_close`,tag:`em`,nesting:-1}):t===2?e.push({type:`strong_close`,tag:`strong`,nesting:-1}):t===3&&(e.push({type:`em_close`,tag:`em`,nesting:-1}),e.push({type:`strong_close`,tag:`strong`,nesting:-1}))}function KR(e,t,n){let r=``;if(t.includes(`"`)){let e=t.split(`"`);t=e[0].trim(),r=e[1].trim()}return{type:`link`,loading:n,href:t,title:r,text:e,children:[{type:`text`,content:e,raw:e}],raw:String(`[${e}](${t})`)}}function qR(e,t){if(!(!e||!t)&&(e.href=String(e.href??``)+t,e.text=String(e.text??``)+t,e.raw=String(`[${e.text}](${e.href})`),Array.isArray(e.children)&&e.children.length)){let n=e.children[e.children.length-1];n?.type===`text`?(n.content=String(n.content??``)+t,n.raw=String(n.raw??``)+t):e.children.push(UR(t))}}function JR(e,t){let n=-1;for(let r of t){let t=e.indexOf(r);t!==-1&&(n===-1||te?.[0]===`href`)?.[1];return typeof t==`string`?t:``}function XR(e,t){if(!e)return;e.attrs=Array.isArray(e.attrs)?e.attrs:[];let n=e.attrs.findIndex(e=>e?.[0]===`href`);n>=0?e.attrs[n][1]=t:e.attrs.push([`href`,t])}function ZR(e,t,n){let r=``;for(let i=t+1;i{let t=e.tokens??[];for(let e=0;ee.type===`code_inline`),r=new Map,i=0;for(let t=0;t0&&o?QR(o):-1;if(s!==-1&&o)for(let e of o.slice(s))e===`(`?i++:e===`)`&&i>0&&i--}a!==-1&&(t=a);continue}if(!(n.type!==`text`||typeof n.content!=`string`))for(let e of n.content)e===`(`?i++:e===`)`&&i>0&&i--}let a=IR(t);for(let i=0;i<=e.length-1;i++){i<0&&(i=0);let o=e[i];if(!o)break;if(o.type===`link_open`&&(o.markup===`linkify`||o.markup===`autolink`)){let s=-1;for(let t=i+1;t0){let e=QR(c);e!==-1&&(u===-1||e=n.content.length){f-=n.content.length;continue}if(f<0)break;let r=n.content[f],i=n.content.slice(0,f),a=n.content.slice(f);for(let n=t+1;n0&&(e.splice(t+1,c),s=t+1);let u=l;if(r===`!`&&d!==-1)u=l.slice(0,d);else if(a){let e=encodeURI(a);if(e&&l.endsWith(e))u=l.slice(0,l.length-e.length);else{let e=r?encodeURI(r):``,t=e?l.indexOf(e):-1;t!==-1&&(u=l.slice(0,t))}}u!==l&&XR(o,u),a&&e.splice(s+1,0,UR(a));break}}}if(!n){if(o?.type===`em_open`&&e[i-1]?.type===`text`&&e[i-1].content?.endsWith(`*`)){let t=e[i-1].content?.replace(/(\*+)$/,``)||``;e[i-1].content=t,o.type=`strong_open`,o.tag=`strong`,o.markup=`**`;for(let t=i+1;te[0]===`href`)?.[1]||``;if(e[i+3]?.type===`text`){let a=(e[i+3]?.content??``).indexOf(`)`),o=a===-1;a===-1&&(r+=e[i+3]?.content?.slice(0,a)||``,e[i+3].content=``),t.push(KR(n,r,o));let s=e[i+3].content?.replace(/^\)\**/,``);s&&t.push(UR(s)),e.splice(i-4,8,...t)}else t.push({type:`link`,loading:!0,href:r,title:``,text:n,children:[{type:`text`,content:r,raw:r}],raw:String(`[${n}](${r})`)}),e.splice(i-4,7,...t);continue}else if(e[i-1].content===`](`&&e[i-3]?.type===`text`&&e[i-3].content?.endsWith(`)`))if(e[i-2]?.type===`strong_open`){let[t,n]=e[i-3].content?.split(`[**`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else if(e[i-2]?.type===`em_open`){let[t,n]=e[i-3].content?.split(`[*`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else{let[t,n]=e[i-3].content?.split(`[`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}}if(o.type===`link_close`&&o.nesting===-1&&e[i-2]?.type===`link_open`&&e[i+1]?.type===`text`&&e[i-1]?.type===`text`){let t=e[i-1].content||``,n=e[i-2].attrs||[],r=n.find(e=>e[0]===`href`)?.[1]||``,a=n.find(e=>e[0]===`title`)?.[1]||``,s=3,c=2,l=(e[i-3]?.content||``).match(/^(\*+)$/),u=[];if(l){c+=1;let e=l[1].length;WR(u,e)}if(o.markup!==`linkify`&&e[i+1].type===`text`&&e[i+1]?.content?.startsWith(`](`)){s+=1;for(let t=i+1;te[0]===`href`)?.[1];e[i+5]?.type===`text`&&e[i+5].content===`.`?(s=(t||s)+e[i+5].content,e[i+5].content=``):s=t||s,c+=3}let l=!0;if(o.nesting===-1&&(a=a.replace(/\*+$/,``)),e[i+2]?.type===`text`){let t=(e[i+2]?.content??``).indexOf(`)`);l=t===-1,t===-1&&(s+=e[i+2]?.content?.slice(0,t)||``,e[i+2].content=``)}t.push(KR(a,s,l)),GR(t,2),e.splice(i-2,c,...t)}if(o.type===`text`&&/\*+\[[^\]]*$/.test(o.content||``)&&e[i+1]?.type===`strong_open`&&e[i+2]?.type===`text`&&e[i+2].content===`](`&&e[i+3]?.type===`link_open`&&e[i+5]?.type===`link_close`&&e[i+6]?.type===`text`&&e[i+6].content===`)`&&e[i+7]?.type===`strong_close`){let t=(o.content||``).match(/^(\*+)\[(.*)$/);if(t){let n=(t[2]||``)+t[1],r=e[i+3]?.attrs?.find(e=>e[0]===`href`)?.[1]||``;!r&&e[i+4]?.type===`text`&&(r=e[i+4].content||``);let a=[];WR(a,2),a.push(KR(n,r,!1)),GR(a,2),e.splice(i,9,...a),i-=a.length-1;continue}}}}if(n)return e;for(let t=0;t{let t=e.tokens??[];for(let e=0;e{let t=e.tokens??[];for(let e=0;e=0&&e[i].type===`text`&&e[i].content===``;)i--;let s=e[i],c=a+1;for(;c=0&&e[n].type===`text`&&e[n].content===``;)n--;let s=e[n],c=a+1;for(;c{let t=e;try{let e=yz(t.tokens??[],!!t.env?.__markstreamFinal,t.src??``);Array.isArray(e)&&(t.tokens=e)}catch(e){console.error(`[applyFixTableTokens] failed to fix table tokens`,e)}})}function cz(){return[{type:`table_open`,tag:`table`,attrs:null,map:null,children:null,content:``,markup:``,info:``,level:0,loading:!0,meta:null},{type:`thead_open`,tag:`thead`,attrs:null,block:!0,level:1,children:null},{type:`tr_open`,tag:`tr`,attrs:null,block:!0,level:2,children:null}]}function lz(){return[{type:`tr_close`,tag:`tr`,attrs:null,block:!0,level:2,children:null},{type:`thead_close`,tag:`thead`,attrs:null,block:!0,level:1,children:null},{type:`table_close`,tag:`table`,attrs:null,map:null,children:null,content:``,markup:``,info:``,level:0,meta:null}]}function uz(e){return[{type:`th_open`,tag:`th`,attrs:null,block:!0,level:3,children:null},{type:`inline`,tag:``,children:null,content:e,level:4,attrs:null,block:!0},{type:`th_close`,tag:`th`,attrs:null,block:!0,level:3,children:null}]}function dz(e,t){if(!e.startsWith(`|`)||e.includes(` -`)||t&&!e.endsWith(`|`))return null;let n=e.slice(1).split(`|`);return n.at(-1)===``&&n.pop(),n.length>0&&n.every(e=>e.trim().length>0)?n:null}function fz(e){return dz(e,!0)!==null}function pz(e){return/^:?-+:?$/.test(e.trim())}function mz(e){if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`);return t.at(-1)===``&&t.pop(),t.length>0&&t.every(pz)}function hz(e){return/^(?:[::]-*|:?-+:?)?$/.test(e.trim())}function gz(e){if(e===``)return!0;if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`),n=t.at(-1)??``;return t.slice(0,-1).every(pz)&&hz(n)}function _z(e){return e===`|`||e===`|:`}function vz(e){let t=dz(e,!0);return t!==null&&t.every(e=>!e.includes(`:`))}function yz(e,t=!1,n=``){let r=[...e];if(e.length<3)return r;let i=e.length-2,a=e[i];if(a.type===`inline`){let e=String(a.content??``),o=e.split(` +`);let n=i.tokens[i.tokens.length-1];n&&(n.raw=e);let r=[];i.md.block.parse(e,i.md,i.env,r),mL(r,t+1,t+1+y.length),i.tokens.push(...r)}let b=i.push(`vmr_container_close`,`div`,-1);return _||(b.hidden=!0,b.map=[n,n]),i.line=_?g+1:g,!0},{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function gL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _L(e){let t=!1,n=!1;for(let r=0;r`)return r}return-1}function vL(e){let t=[],n=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!e)continue;let n=r[2]||r[3]||r[4]||``;t.push([e,n])}return t}var yL=/^[a-z][a-z0-9_-]*$/;function bL(e){return yL.test(String(e??``).trim().toLowerCase())}function xL(e){let t=String(e??``).trim();if(!t)return``;if(!t.startsWith(`<`))return bL(t)?t.toLowerCase():``;let n=1;for(;n]/.test(a)?``:bL(i)?i:``}function SL(e){if(!e||e.length===0)return[];let t=new Set,n=[];for(let r of e){let e=xL(r);!e||t.has(e)||(t.add(e),n.push(e))}return n}function CL(...e){let t=new Set,n=[];for(let r of e)for(let e of SL(r))t.has(e)||(t.add(e),n.push(e));return n}function wL(e){let t=SL(e);return{key:t.join(`,`),tags:t}}function TL(e){return xL(e)}function EL(e,t){let n=String(e??``),r=xL(t);if(!r)return!1;let i=gL(r),a=n.match(new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?(\s*\/)?>`,`i`));return a?a[1]?!0:new RegExp(String.raw`<\s*\/\s*${i}\s*>`,`i`).test(n):!1}function DL(e,t){let n=xL(t);return!!n&&!WI.has(n)&&!EL(e,n)}function OL(e,t){let n=String(e??``),r=xL(t);if(!r)return n;let i=gL(r),a=new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?>\s*`,`i`),o=new RegExp(String.raw`\s*<\s*\/\s*${i}\s*>\s*$`,`i`);return n.replace(a,``).replace(o,``)}var kL=HI,AL=WI,jL=new Set(UI);jL.delete(`details`);var ML=/<([A-Z][\w-]*)(?=[\s/>]|$)/gi,NL=/<\/\s*([A-Z][\w-]*)(?=[\s/>]|$)/gi,PL=/^<\s*(?:\/\s*)?([A-Z][\w-]*)/i,FL=/^<\s*([A-Z][\w:-]*)(?=[\s/>]|$)/i;function IL(e){return(e.match(PL)?.[1]??``).toLowerCase()}function LL(e){return/^\s*<\s*\//.test(e)}function RL(e,t){return kL.has(t)||/\/\s*>\s*$/.test(e)}function zL(e,t){let n=0;for(let r=0;r0&&n--;continue}RL(e,i)||n++}}return n}function VL(e,t,n=0){let r=new RegExp(String.raw`<\s*(\/?)\s*${gL(t)}(?=[\s>/])[^>]*>`,`gi`);r.lastIndex=Math.max(0,n);let i=0,a;for(;(a=r.exec(e))!==null;){let e=a[0]??``,t=!!a[1],n=!t&&/\/\s*>$/.test(e);if(t){if(i===0)return{start:a.index,end:a.index+e.length};i--;continue}n||i++}return null}function HL(e,t){let n=new RegExp(String.raw`<\s*(\/?)\s*${gL(t)}(?=[\s>/])[^>]*>`,`gi`),r=0,i;for(;(i=n.exec(e))!==null;){let e=i[0]??``,t=!!i[1],n=!t&&/\/\s*>$/.test(e);if(t){r>0&&r--;continue}n||r++}return r}function UL(e){let t=e;return String(t.raw??t.content??t.markup??``)}function WL(e){let t=e;return t.meta||={},t.meta}function GL(e,t,n){let r=WL(e);r.markstreamCustomHtmlRaw=t,r.markstreamCustomHtmlInner=n}function KL(e,t){if(!t.size)return;let n=Array.from(t,e=>new RegExp(String.raw`<\s*${gL(e)}(?=[\s>/])`,`i`)),r=[],i=!1,a=e=>e?n.some(t=>t.test(e)):!1,o=e=>{if(!(!e||!r.length))for(let t of r)t.raw+=e,t.inner+=e},s=()=>{!r.length||!i||(o(` +`),i=!1)},c=e=>{o(e)},l=e=>{for(let t=0;t{let t=r[r.length-1]?.tag;if(!t)return null;let n=new RegExp(String.raw`^\s*<\s*\/\s*${gL(t)}\s*>`,`i`);return e.match(n)?.[0]??null},d=e=>!!u(e),f=(e,n,i)=>{let a=i??(e.type===`html_inline`?IL(n):``);if(!(a&&t.has(a))){o(n);return}let s=LL(n),c=!s&&RL(n,a);if(s){if(!r.length||r[r.length-1].tag!==a){o(n);return}l(n);return}if(o(n),c){GL(e,n,``);return}r.push({tag:a,token:e,raw:n,inner:``})};for(let n of e){if(n.type===`inline`&&Array.isArray(n.children)){let e=String(n.content??``);if(d(e)?i=!1:s(),!r.length&&!a(e)){i=!1;continue}let o=0,l=!0;for(let i of n.children){let n=UL(i),a=i.type===`html_inline`?IL(n):``,s=a&&t.has(a),u=n;if(l&&e&&n&&(r.length||s)){let t=e.indexOf(n,o);if(t!==-1)c(e.slice(o,t)),u=e.slice(t,t+n.length),o=t+n.length;else{if(r.length&&!s)continue;l=!1}}f(i,u,a)}l&&e&&o0;continue}if(r.length&&typeof n.content==`string`){let e=UL(n),t=n.type===`html_block`?u(e):null;if(t){l(`${i?` +`:``}${t}`),i=r.length>0;continue}if(!n.content)continue;s(),o(n.content),i=!0}}for(let e of r)GL(e.token,e.raw,e.inner)}function qL(e){return/^\s*<\s*[!?]/.test(e)}function JL(e){let t=new Set(AL);if(e&&Array.isArray(e))for(let n of e){let e=String(n??``).trim();if(!e)continue;let r=e.match(/^[<\s/]*([A-Z][\w-]*)/i);r&&t.add(r[1].toLowerCase())}return t}function YL(e,t){if(t.has(e))return!0;for(let n of t)if(n.startsWith(e))return!0;return!1}function XL(e,t){let n=null;for(let r of e.matchAll(ML)){let i=r.index??-1;if(i<0)continue;let a=(r[1]??``).toLowerCase();YL(a,t)&&_L(e.slice(i))===-1&&(!n||i`)&&(!n||t`)&&(!n||t{let t=e,r=new Set(n),i=Array.isArray(t.env?.__markstreamCustomHtmlTags)?t.env.__markstreamCustomHtmlTags:[];for(let e of i){let t=xL(String(e??``));t&&r.add(t)}let a=JL(Array.from(r)),o=new Set($L);for(let e of r)o.add(e);return{autoCloseInlineTagSet:o,commonHtmlTags:a,customTagSet:r,shouldMergeHtmlBlockTag:e=>r.has(e)||!a.has(e)||jL.has(e)}},i=e=>{if(e.type===`html_block`)return String(e.content??``);if(e.type!==`inline`||!Array.isArray(e.children)||e.children.length!==1)return``;let t=e.children[0];return t?.type===`html_block`?String(e.content??t.content??``):``},a=(e,t)=>{e.type=`html_block`,e.content=t,e.raw=t,e.children=[]},o=e=>e.replace(/^(?:\r?\n)+/,``),s=e=>/^(?: {4}|\t)/.test(e),c=e=>e.replace(/^(?: {4}|\t)/gm,``),l=(e,t)=>{let n=o(e);if(!/\S/.test(n))return[];if(s(n))return[{type:`code_block`,content:c(n),raw:n}];let r=n.replace(/^[\t ]+/,``);if(!r)return[];if(r.startsWith(`<`))return[{type:`html_block`,content:r}];let i={type:`inline`,tag:``,nesting:0,content:r,children:[{type:`text`,content:r,raw:r}]};return t===`paragraph`?[{type:`paragraph_open`,tag:`p`,nesting:1},i,{type:`paragraph_close`,tag:`p`,nesting:-1}]:t===`text`?[{type:`text`,content:r,raw:r}]:[i]},u=(e,t,n)=>e[t-1]?.type===`paragraph_open`&&e[t+1]?.type===`paragraph_close`?`inline`:n,d=(e,t)=>{let n=o(t);return!/\S/.test(n)||e.type!==`inline`||!Array.isArray(e.children)?!1:(e.content=`${String(e.content??``)}${n}`,e.children.push({type:`text`,content:n,raw:n}),!0)};e.core.ruler.after(`inline`,`fix_html_inline_streaming`,e=>{let t=e.tokens??[],{commonHtmlTags:n,customTagSet:i}=r(e);for(let e of t){let t=e;if(t.type!==`inline`||!Array.isArray(t.children))continue;let r=String(t.content??``),i=t.children.length?t.children:r.includes(`<`)?[{type:`text`,content:r,raw:r}]:null;if(i)try{let e=QL(i,n);if(t.children=e.children,e.pendingBuffer){let n=r.lastIndexOf(e.pendingBuffer);if(n!==-1){let e=r.slice(0,n);t.content=e,typeof t.raw==`string`&&(t.raw=e)}}}catch(e){console.error(`[applyFixHtmlInlineTokens] failed to fix streaming html inline`,e)}}KL(t,i)}),e.core.ruler.push(`fix_html_inline_tokens`,e=>{let t=e.tokens??[],{autoCloseInlineTagSet:n,customTagSet:o,shouldMergeHtmlBlockTag:s}=r(e),c=[];for(let e=0;e0){let[r,i]=c[c.length-1];if(e!==i){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let a=String(n.content??n.raw??``);if(a){let n=t[i],o=`${String(n.content||``)}\n${a}`,s=_L(o),f=s===-1?null:VL(o,r,s+1);if(f){let r=o.slice(0,f.end),i=o.slice(f.end);n.content=r,n.loading=!1,t.splice(e,1),c.pop();let a=d(n,i)?[]:l(i,u(t,e,`paragraph`));a.length&&t.splice(e,0,...a),e--;continue}n.content=o,n.loading!==!1&&(n.loading=!0)}t.splice(e,1),e--;continue}}let r=i(n);if(r){if(qL(r))continue;let i=(r.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1]??``).toLowerCase(),o=/^\s*<\s*\//.test(r);if(!i||!s(i))continue;if(a(n,r),!o)i&&!RegExp(`^\\s*<\\s*${i}\\b[^>]*\\/\\s*>`,`i`).test(r)&&HL(r,i)>0&&c.push([i,e]);else if(c.length>0&&i&&c[c.length-1][0]===i){let[,n]=c[c.length-1],i=t[n];i.content=`${String(i.content||``)}\n${r}`,i.loading=!1,c.pop(),t.splice(e,1),e--}continue}else if(c.length>0){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let r=n.content||``,i=RegExp(`<\\s*\\/\\s*${c[c.length-1][0]}\\s*>`,`i`).test(r);if(r){let[,e]=c[c.length-1],n=t[e];n.content=`${n.content||``}\n${r}`,n.loading!==!1&&(n.loading=!i)}i&&c.pop(),t.splice(e,1),e--}else continue}if(o.size>0){let e=new Map,n=new Map,r=t=>{let n=e.get(t);return n||(n=RegExp(`<\\s*${t}\\b`,`i`),e.set(t,n)),n},i=e=>{let t=n.get(e);return t||(t=RegExp(`<\\s*\\/\\s*${e}\\s*>`,`i`),n.set(e,t)),t},a=[];for(let e=0;e0){let r=a[a.length-1],o=t[r.index],c=n.type===`html_block`?i(r.tag).exec(s):null;if(c){let n=c.index+c[0].length,i=s.slice(0,n),f=s.slice(n);o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push({type:`html_inline`,content:``,raw:``}),a.pop();let p=d(o,f)?[]:l(f,u(t,e,`paragraph`));p.length?t.splice(e,1,...p):(t.splice(e,1),e--);continue}if(n.type!==`inline`)continue;let f=Array.isArray(n.children)?n.children:[],p=zL(f,r.tag);if(p!==-1){let n=f.slice(0,p+1),r=f.slice(p+1),i=n.map(e=>String(e?.content??e?.raw??``)).join(``);if(o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push(...n),r.length){let n=r.map(e=>String(e.content??e.raw??``)).join(``);if(n.trim()){let r=n.replace(/^\s+/,``);if(d(o,n))t.splice(e,1),e--;else if(r.startsWith(`<`))t.splice(e,1,{type:`html_block`,content:r});else{let r=l(n,u(t,e,`paragraph`));t.splice(e,1,...r)}}else t.splice(e,1),e--}else t.splice(e,1),e--;a.pop();continue}o.content=`${String(o.content??``)}\n${s}`,Array.isArray(o.children)&&o.children.push(...f),t.splice(e,1),e--;continue}if(n.type!==`inline`)continue;let c=Array.isArray(n.children)?n.children:[];for(let t of o)if((c.length?BL(c,t):r(t).test(s)&&!i(t).test(s)?1:0)>0){a.push({tag:t,index:e});break}}}{let e=0;for(let n=0;n0?e--:(t.splice(n,1),n--))}}for(let e=0;e/]+)/)?.[1]??``).toLowerCase();if(n.startsWith(`!`)||n.startsWith(`?`)){r.loading=!1;continue}if(o.has(n)){let i=String(r.content??``),a=_L(i),o=a===-1?null:VL(i,n,a+1);r.loading=o?!1:r.loading===void 0?!0:r.loading;let s=o?.start??-1,c=o?o.end-o.start:0;if(s!==-1){let o=i.slice(0,s+c),u=``;a!==-1&&a]+)))?/g,s;for(;(s=a.exec(r.content||``))!==null;){let e=s[1],t=s[2]||s[3]||s[4]||``;i.push([e,t])}let c=String(r.content??``),u=RegExp(`<\\/\\s*${n}\\s*>`,`i`).exec(c),d=u?u.index:-1,f=u?u[0].length:0;if(d!==-1){let i=c.slice(0,d+f),a=(c.slice(d+f)||``).replace(/^\s+/,``);r.children=[{type:`html_block`,content:i,tag:n,loading:!1}],r.content=i,r.raw=i,a&&t.splice(e+1,0,a.startsWith(`<`)?{type:`html_block`,content:a}:{type:`text`,content:a,raw:a})}else r.children=[{type:`html_block`,content:r.content,tag:n,loading:!0}];continue}if(!r||r.type!==`inline`)continue;if(r.children.length===2&&r.children[0].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase(),t=r.children[1],i=String(t?.content??``).match(/^<\s*\/\s*([^\s>]+)/)?.[1]?.toLowerCase()??``;if(t?.type===`html_inline`&&i===e)continue;n.has(e)?(r.children[0].loading=!0,r.children[0].tag=e,r.children.push({type:`html_inline`,tag:e,loading:!0,content:``})):r.children=[{type:`html_block`,loading:!0,tag:e,content:String(r.children[0]?.content??``)+String(r.children[1]?.content??``)}];continue}else if(r.children.length===3&&r.children[0].type===`html_inline`&&r.children[2].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase();if(n.has(e))continue;r.children=[{type:`html_block`,loading:!1,tag:e,content:r.children.map(e=>e.content).join(``)}];continue}if(!r.content?.startsWith(`<`)||r.children?.length!==1)continue;let i=String(r.content),a=r,s=a.children[0];if(s?.type!==`html_inline`){/^<\s*(?:\/\s*)?[A-Z][\w:-]*\s*$/i.test(i)&&(a.children.length=0);continue}let c=String(s.content??i).match(FL)?.[1]?.toLowerCase()??``;if(c){if(/\/\s*>\s*$/.test(i)||kL.has(c)){a.children=[{type:`html_inline`,content:i}];continue}a.children.length=0}}})}function tR(e){let t=e.trim();return!t||/^&[a-z0-9#]+;/i.test(t)?!1:!!(/^(?:const|let|var|function|class|import|export|if|for|while|return|await|async|yield|try|catch|throw|new|typeof|instanceof|switch|case|break|continue|def|ruby|perl|print|echo|true|false|null|undefined|NaN|Infinity|this)\b/.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\])*\s*\(/i.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[[\d+\]])+/i.test(t)||/\w+\s*(?:===?|!==?|<=?|>=?|\+\+|--|&&|\|\||\?\.)/.test(t)||/^(?:!!|\+\+|--)\s*\w/.test(t)||/[\w$]+\s*(?:\+=|-=|\*=|\/=|%=|\*\*=|=)/.test(t)||/^(?:https?:\/\/|ftp:\/\/|file:\/\/|\/\/|www\.)/i.test(t)||/`[^`]*\$\{[^}]*\}[^`]*`/.test(t)||/<\/?[A-Z][a-zA-Z0-9]*/.test(t)||/<[a-z][a-z0-9]*\s[^>]+>/.test(t)||/^(["'`]).*\1\s*[;,]?$/.test(t)||/^\[[\s\S]*\]$/.test(t)||/^\{[\s\S]*\}$/.test(t)||/^\(\s*\)$/.test(t)||/[\w$]+(?:\s*[+\-*/%<>=!&|^~:]+\s*[\w$]+|\s*\.\s*[\w$]+)/.test(t)||/=>|->|::/.test(t)||/^@[\w.$]+$/.test(t)||/^(?:0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\d+(?:\.\d*)?(?:px|em|rem|%|vh|vw|deg|s|ms)?)$/.test(t)||/^\$[\w$]+\s*[=:]/.test(t)||/\|\s*\w+|\w+\s*\|/.test(t)||/^(?:git|npm|yarn|pnpm|bun|pip|cargo|go|rust|python|node|java|mvn|gradle|docker|kubectl)\s+/.test(t)||/(?:console|window|document|Math|JSON|Date|Array|Object|String|Number|Boolean)\.[a-zA-Z]/.test(t)||/^(?:\/\/|#|\/\*|\*\/|)/.test(t)||/^(?:<<<|<<\s*['"]?\w+['"]?)/.test(t))}function nR(e,t={}){t.enabled!==!1&&e.core.ruler.after(`inline`,`fix_indented_code_block`,e=>{let t=e.tokens??[];for(let e=0;ee.trim().length>0);if(i.length===1&&!tR(i[0]??``)){let r=i[0]??``,a=n.level??0;t.splice(e,1,{type:`paragraph_open`,tag:`p`,nesting:1,level:a},{type:`inline`,tag:``,nesting:0,level:a,content:r,children:[{type:`text`,content:r,level:a+1,raw:r}],block:!0},{type:`paragraph_close`,tag:`p`,nesting:-1,level:a}),e+=2}}})}var rR=/\.([a-z0-9]{1,15})$/i,iR=/[_()[\]{}<>]/u,aR=/^(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/i,oR=/[?#@]/u,sR=/[\\/]/u,cR=/^[\p{L}\p{N}./\\-]+$/u,lR=/^[A-Za-z0-9-]{1,63}$/u,uR=/^xn--[a-z0-9-]{2,59}$/i,dR=/^(?:[A-Z]{1,6}|\d{1,8})$/u,fR=/^(?=.{1,12}$)[A-Z0-9]+(?:[-.][A-Z0-9]+)*$/iu,pR=/文件名\s*[::]?|附件\s*[::]?|路径\s*[::]?|路徑\s*[::]?|文件列表\s*[::]?|文档列表\s*[::]?|文檔列表\s*[::]?|\bfile\s*names?\b\s*[::]?|\battachments?\b\s*[::]?|\bpaths?\b\s*[::]?|\bfile\s+lists?\b\s*[::]?|\bdocument\s+lists?\b\s*[::]?/iu,mR=/文件名\s*[::]?|文件\s*[::]?|附件\s*[::]?|档案\s*[::]?|檔案\s*[::]?|文档\s*[::]?|文檔\s*[::]?|资料\s*[::]?|資料\s*[::]?|路径\s*[::]?|路徑\s*[::]?|\bfile\s*name\b\s*[::]?|\battachments?\b\s*[::]?|\bfiles?\b\s*[::]?|\bdocuments?\b\s*[::]?|\bdocs?\b\s*[::]?|\bpaths?\b\s*[::]?/iu,hR=/股票代码|股票代碼|证券代码|證券代碼|(?:代码|代碼|交易所|后缀|後綴|市场|市場)(?=$|[\s::/|,,、()()])|\btickers?\b|\bsymbols?\b|\bexchanges?\b/iu,gR=2e3,_R=512,vR={},yR=new Set([`ai`,`md`,`py`,`rs`,`sh`,`zip`]),bR=new Set([`as`,`bj`,`de`,`hk`,`l`,`ln`,`ny`,`pa`,`sh`,`ss`,`sz`,`t`,`us`]),xR=new Set([...bR,`at`,`ax`,`cn`,`co`,`it`,`jp`,`ks`,`mc`,`mx`,`nz`,`pl`,`sa`,`si`,`to`,`tw`]),SR=new Set([`com`,`dev`,`io`,`page`,`site`]),CR=new Set([`app`,`apk`,`dmg`,`exe`,`ipa`,`lock`,`log`,`markdown`,`webmanifest`]),wR=new Set(`7z.ai.astro.avi.bash.bz2.c.cjs.cpp.cs.csv.doc.docx.fish.flac.gif.go.gz.h.hpp.html.java.jpeg.jpg.js.json.jsx.kt.md.mdx.mjs.mov.mp3.mp4.pdf.php.png.ppt.pptx.ps1.py.rar.rb.rs.sh.sql.svg.swift.svelte.tar.tgz.toml.ts.tsx.txt.vue.wav.webp.xls.xlsx.xml.yaml.yml.zip.zsh`.split(`.`)),TR=new Map;function ER(e,t){if(!e||e.length>_R)return t;for(TR.set(e,t);TR.size>gR;){let e=TR.keys().next().value;if(!e)break;TR.delete(e)}return t}function DR(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function OR(e,t){let n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return DR(n)?n:void 0}function kR(e,t){if(!DR(t))return e;let n=e?.__linkifyDemotionContext;return{...e,__linkifyDemotionContext:{filename:n?.filename||t?.filename,explicitFilename:n?.explicitFilename||t?.explicitFilename,marketTicker:n?.marketTicker||t?.marketTicker}}}function AR(e){let t=VR(e);return DR(t)?t:void 0}function jR(e){return e.replace(/^[\s>*_`[\]((【《"'“‘]+/u,``).replace(/[\s<*_`\]))】》"'.。;;,,、::!?!?]+$/u,``)}function MR(e,t){if(!DR(t))return;let n=String(e??``).trim().split(/\s+/u).map(jR).filter(Boolean);if(n.length===0)return;let r={};return t?.filename&&n.every(e=>KR(e,{filename:!0,explicitFilename:t.explicitFilename}))&&(r.filename=!0),t?.explicitFilename&&r.filename&&(r.explicitFilename=!0),t?.marketTicker&&n.every(e=>KR(e,{marketTicker:!0}))&&(r.marketTicker=!0),DR(r)?r:void 0}function NR(e,t=!1){let n;return{options(r){return t||r==null?kR(e,n):kR(e,OR(AR(r),MR(r,n)))},remember(e){let r=AR(e);n=t?OR(n,r):OR(r,MR(e,n))},reset(){n=void 0}}}function PR(e){return lR.test(e)&&!e.startsWith(`-`)&&!e.endsWith(`-`)}function FR(e){let t=e.split(`.`);if(t.length<2)return!1;let n=t[t.length-1]?.toLowerCase()??``;return PR(n)||uR.test(n)?t.every(PR):!1}function IR(e){return Array.from(e).some(e=>e.charCodeAt(0)>127)}function LR(e){return e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``).split(/[/?#]/,1)[0]??``}function RR(e){return e.split(`.`).some(e=>e.toLowerCase().startsWith(`xn--`))}function zR(e,t,n){let r=LR(t);return IR(e)&&RR(r)&&String(n??``).toLowerCase().includes(r.toLowerCase())}function BR(e){if(!e)return!1;if(e.includes(`文件`)||e.includes(`附件`)||e.includes(`路径`)||e.includes(`路徑`)||e.includes(`文档`)||e.includes(`文檔`)||e.includes(`档案`)||e.includes(`檔案`)||e.includes(`资料`)||e.includes(`資料`)||e.includes(`股票`)||e.includes(`证券`)||e.includes(`證券`)||e.includes(`代码`)||e.includes(`代碼`)||e.includes(`交易所`)||e.includes(`后缀`)||e.includes(`後綴`)||e.includes(`市场`)||e.includes(`市場`))return!0;let t=e.toLowerCase();return t.includes(`file`)||t.includes(`attachment`)||t.includes(`document`)||t.includes(`doc`)||t.includes(`path`)||t.includes(`ticker`)||t.includes(`symbol`)||t.includes(`exchange`)}function VR(e){let t=String(e??``),n=TR.get(t);return n?(TR.delete(t),TR.set(t,n),n):BR(t)?ER(t,{explicitFilename:pR.test(t),filename:mR.test(t),marketTicker:hR.test(t)}):ER(t,vR)}function HR(e){return FR(e.split(/[\\/]/)[0]??``)}function UR(e){let t=e.replace(/[^a-z]/gi,``);return t.length>=2&&t===t.toUpperCase()}function WR(e){if(iR.test(e)||!cR.test(e))return!0;if(sR.test(e))return!HR(e);let t=e.replace(rR,``);return IR(t)?!0:t.split(`.`).filter(Boolean).some(UR)}function GR(e,t,n){if(!(n?xR:bR).has(t))return!1;let r=e.slice(0,-(t.length+1));return r===``?e.startsWith(`.`):(n?fR:dR).test(r)}function KR(e,t={}){if(!e||aR.test(e)||oR.test(e))return!1;let n=e.match(rR);if(!n)return!1;let r=String(n[1]??``).toLowerCase();return GR(e,r,t.marketTicker===!0)?!0:wR.has(r)?!yR.has(r)||t.filename?!0:WR(e):!!(t.explicitFilename&&SR.has(r)||t.filename&&CR.has(r))}var qR=[`!`];function JR(e){return{type:`text`,content:e,raw:e}}function YR(e,t){t===1?e.push({type:`em_open`,tag:`em`,nesting:1}):t===2?e.push({type:`strong_open`,tag:`strong`,nesting:1}):t===3&&(e.push({type:`strong_open`,tag:`strong`,nesting:1}),e.push({type:`em_open`,tag:`em`,nesting:1}))}function XR(e,t){t===1?e.push({type:`em_close`,tag:`em`,nesting:-1}):t===2?e.push({type:`strong_close`,tag:`strong`,nesting:-1}):t===3&&(e.push({type:`em_close`,tag:`em`,nesting:-1}),e.push({type:`strong_close`,tag:`strong`,nesting:-1}))}function ZR(e,t,n){let r=``;if(t.includes(`"`)){let e=t.split(`"`);t=e[0].trim(),r=e[1].trim()}return{type:`link`,loading:n,href:t,title:r,text:e,children:[{type:`text`,content:e,raw:e}],raw:String(`[${e}](${t})`)}}function QR(e,t){if(!(!e||!t)&&(e.href=String(e.href??``)+t,e.text=String(e.text??``)+t,e.raw=String(`[${e.text}](${e.href})`),Array.isArray(e.children)&&e.children.length)){let n=e.children[e.children.length-1];n?.type===`text`?(n.content=String(n.content??``)+t,n.raw=String(n.raw??``)+t):e.children.push(JR(t))}}function $R(e,t){let n=-1;for(let r of t){let t=e.indexOf(r);t!==-1&&(n===-1||te?.[0]===`href`)?.[1];return typeof t==`string`?t:``}function tz(e,t){if(!e)return;e.attrs=Array.isArray(e.attrs)?e.attrs:[];let n=e.attrs.findIndex(e=>e?.[0]===`href`);n>=0?e.attrs[n][1]=t:e.attrs.push([`href`,t])}function nz(e,t,n){let r=``;for(let i=t+1;i{let t=e.tokens??[];for(let e=0;ee.type===`code_inline`),r=new Map,i=0;for(let t=0;t0&&o?rz(o):-1;if(s!==-1&&o)for(let e of o.slice(s))e===`(`?i++:e===`)`&&i>0&&i--}a!==-1&&(t=a);continue}if(!(n.type!==`text`||typeof n.content!=`string`))for(let e of n.content)e===`(`?i++:e===`)`&&i>0&&i--}let a=VR(t);for(let i=0;i<=e.length-1;i++){i<0&&(i=0);let o=e[i];if(!o)break;if(o.type===`link_open`&&(o.markup===`linkify`||o.markup===`autolink`)){let s=-1;for(let t=i+1;t0){let e=rz(c);e!==-1&&(u===-1||e=n.content.length){f-=n.content.length;continue}if(f<0)break;let r=n.content[f],i=n.content.slice(0,f),a=n.content.slice(f);for(let n=t+1;n0&&(e.splice(t+1,c),s=t+1);let u=l;if(r===`!`&&d!==-1)u=l.slice(0,d);else if(a){let e=encodeURI(a);if(e&&l.endsWith(e))u=l.slice(0,l.length-e.length);else{let e=r?encodeURI(r):``,t=e?l.indexOf(e):-1;t!==-1&&(u=l.slice(0,t))}}u!==l&&tz(o,u),a&&e.splice(s+1,0,JR(a));break}}}if(!n){if(o?.type===`em_open`&&e[i-1]?.type===`text`&&e[i-1].content?.endsWith(`*`)){let t=e[i-1].content?.replace(/(\*+)$/,``)||``;e[i-1].content=t,o.type=`strong_open`,o.tag=`strong`,o.markup=`**`;for(let t=i+1;te[0]===`href`)?.[1]||``;if(e[i+3]?.type===`text`){let a=(e[i+3]?.content??``).indexOf(`)`),o=a===-1;a===-1&&(r+=e[i+3]?.content?.slice(0,a)||``,e[i+3].content=``),t.push(ZR(n,r,o));let s=e[i+3].content?.replace(/^\)\**/,``);s&&t.push(JR(s)),e.splice(i-4,8,...t)}else t.push({type:`link`,loading:!0,href:r,title:``,text:n,children:[{type:`text`,content:r,raw:r}],raw:String(`[${n}](${r})`)}),e.splice(i-4,7,...t);continue}else if(e[i-1].content===`](`&&e[i-3]?.type===`text`&&e[i-3].content?.endsWith(`)`))if(e[i-2]?.type===`strong_open`){let[t,n]=e[i-3].content?.split(`[**`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else if(e[i-2]?.type===`em_open`){let[t,n]=e[i-3].content?.split(`[*`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else{let[t,n]=e[i-3].content?.split(`[`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}}if(o.type===`link_close`&&o.nesting===-1&&e[i-2]?.type===`link_open`&&e[i+1]?.type===`text`&&e[i-1]?.type===`text`){let t=e[i-1].content||``,n=e[i-2].attrs||[],r=n.find(e=>e[0]===`href`)?.[1]||``,a=n.find(e=>e[0]===`title`)?.[1]||``,s=3,c=2,l=(e[i-3]?.content||``).match(/^(\*+)$/),u=[];if(l){c+=1;let e=l[1].length;YR(u,e)}if(o.markup!==`linkify`&&e[i+1].type===`text`&&e[i+1]?.content?.startsWith(`](`)){s+=1;for(let t=i+1;te[0]===`href`)?.[1];e[i+5]?.type===`text`&&e[i+5].content===`.`?(s=(t||s)+e[i+5].content,e[i+5].content=``):s=t||s,c+=3}let l=!0;if(o.nesting===-1&&(a=a.replace(/\*+$/,``)),e[i+2]?.type===`text`){let t=(e[i+2]?.content??``).indexOf(`)`);l=t===-1,t===-1&&(s+=e[i+2]?.content?.slice(0,t)||``,e[i+2].content=``)}t.push(ZR(a,s,l)),XR(t,2),e.splice(i-2,c,...t)}if(o.type===`text`&&/\*+\[[^\]]*$/.test(o.content||``)&&e[i+1]?.type===`strong_open`&&e[i+2]?.type===`text`&&e[i+2].content===`](`&&e[i+3]?.type===`link_open`&&e[i+5]?.type===`link_close`&&e[i+6]?.type===`text`&&e[i+6].content===`)`&&e[i+7]?.type===`strong_close`){let t=(o.content||``).match(/^(\*+)\[(.*)$/);if(t){let n=(t[2]||``)+t[1],r=e[i+3]?.attrs?.find(e=>e[0]===`href`)?.[1]||``;!r&&e[i+4]?.type===`text`&&(r=e[i+4].content||``);let a=[];YR(a,2),a.push(ZR(n,r,!1)),XR(a,2),e.splice(i,9,...a),i-=a.length-1;continue}}}}if(n)return e;for(let t=0;t{let t=e.tokens??[];for(let e=0;e{let t=e.tokens??[];for(let e=0;e=0&&e[i].type===`text`&&e[i].content===``;)i--;let s=e[i],c=a+1;for(;c=0&&e[n].type===`text`&&e[n].content===``;)n--;let s=e[n],c=a+1;for(;c{let t=e;try{let e=wz(t.tokens??[],!!t.env?.__markstreamFinal,t.src??``);Array.isArray(e)&&(t.tokens=e)}catch(e){console.error(`[applyFixTableTokens] failed to fix table tokens`,e)}})}function pz(){return[{type:`table_open`,tag:`table`,attrs:null,map:null,children:null,content:``,markup:``,info:``,level:0,loading:!0,meta:null},{type:`thead_open`,tag:`thead`,attrs:null,block:!0,level:1,children:null},{type:`tr_open`,tag:`tr`,attrs:null,block:!0,level:2,children:null}]}function mz(){return[{type:`tr_close`,tag:`tr`,attrs:null,block:!0,level:2,children:null},{type:`thead_close`,tag:`thead`,attrs:null,block:!0,level:1,children:null},{type:`table_close`,tag:`table`,attrs:null,map:null,children:null,content:``,markup:``,info:``,level:0,meta:null}]}function hz(e){return[{type:`th_open`,tag:`th`,attrs:null,block:!0,level:3,children:null},{type:`inline`,tag:``,children:null,content:e,level:4,attrs:null,block:!0},{type:`th_close`,tag:`th`,attrs:null,block:!0,level:3,children:null}]}function gz(e,t){if(!e.startsWith(`|`)||e.includes(` +`)||t&&!e.endsWith(`|`))return null;let n=e.slice(1).split(`|`);return n.at(-1)===``&&n.pop(),n.length>0&&n.every(e=>e.trim().length>0)?n:null}function _z(e){return gz(e,!0)!==null}function vz(e){return/^:?-+:?$/.test(e.trim())}function yz(e){if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`);return t.at(-1)===``&&t.pop(),t.length>0&&t.every(vz)}function bz(e){return/^(?:[::]-*|:?-+:?)?$/.test(e.trim())}function xz(e){if(e===``)return!0;if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`),n=t.at(-1)??``;return t.slice(0,-1).every(vz)&&bz(n)}function Sz(e){return e===`|`||e===`|:`}function Cz(e){let t=gz(e,!0);return t!==null&&t.every(e=>!e.includes(`:`))}function wz(e,t=!1,n=``){let r=[...e];if(e.length<3)return r;let i=e.length-2,a=e[i];if(a.type===`inline`){let e=String(a.content??``),o=e.split(` `)[0]??``,[s=``,c=``,...l]=e.split(` `),u=!t&&!e.includes(` -`)&&/\r?\n$/.test(n)&&fz(e);if(!t&&(e.includes(` -`)&&l.length===0&&fz(s)&&gz(c)||u)){let e=o.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>uz(e)),t=[...cz(),...e,...lz()];r.splice(i-1,3,...t)}else if(e.includes(` -`)&&l.length===0&&fz(s)&&mz(c)){let e=o.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>uz(e)),t=[...cz(),...e,...lz()];r.splice(i-1,3,...t)}else e.includes(` -`)&&l.length===0&&vz(s)&&_z(c)&&(a.content=e.slice(0,-2),a.children.splice(2,1))}return r}function bz(e,t,n,r){let i=e.length;if(n===`$$`&&r===`$$`){let n=t;for(;n=0&&e[t]===`\\`;)r++,t--;if(r%2==0)return n}n++}return-1}let a=n[n.length-1],o=r,s=0,c=t;for(;c=0&&e[t]===`\\`;)n++,t--;if(n%2==0){if(s===0)return c;s--,c+=o.length;continue}}let t=e[c];if(t===`\\`){c+=2;continue}t===a?s++:t===o[o.length-1]&&s>0&&s--,c++}return-1}var xz=bz,Sz=[`boldsymbol`,`mathbb`,`mathcal`,`mathfrak`,`mathrm`,`mathit`,`mathsf`,`vec`,`hat`,`bar`,`tilde`,`overline`,`underline`,`mathscr`,`mathnormal`,`operatorname`,`mathbf*`].map(e=>e.replace(/[.*+?^${}()|[\\]"\]/g,`\\$&`)).join(`|`),Cz=/\\[a-z]+/i,wz=`(?:\\\\|\\u0008)`,Tz=new RegExp(String.raw`${wz}(?:${Sz})\s*\{[^}]+\}`,`i`),Ez=new RegExp(String.raw`(?:${wz})?(?:${Sz})\s*\{`,`i`),Dz=/\\(?:text|frac|left|right|times)/,Oz=/(?:^|[^+])\+(?!\+)|[=\-*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/,kz=/\b[A-Z]{2,}-[A-Z]{2,}\b/i,Az=/[A-Z]+\s*\([^)]+\)/i,jz=/^\(\s*[a-z](?:\s*,\s*[a-z])+\s*\)$/i,Mz=/\b(?:sin|cos|tan|log|ln|exp|sqrt|frac|sum|lim|int|prod)\b/,Nz=/\b\d{4}\/\d{1,2}\/\d{1,2}(?:[ T]\d{1,2}:\d{2}(?::\d{2})?)?\b/,Pz={"\b":`\\b`,"\v":`\\v`,"\f":`\\f`};function Fz(e){let t=``;for(let n of e)t+=Pz[n]??n;return t}function Iz(e){if(!e)return!1;let t=Fz(e),n=t.trim();if(Nz.test(n)||n.includes(`**`))return!1;if(n.length>2e3)return!0;let r=Cz.test(t),i=Tz.test(t),a=Ez.test(t),o=Dz.test(t),s=/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)_(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t)||/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)\^(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t),c=Oz.test(t)&&!kz.test(t),l=Az.test(t),u=jz.test(n),d=Mz.test(t),f=/^\([a-z]\)$/i.test(n)||/^(?:[a-z]|pi)$/i.test(n),p=/^(?:[A-Z][a-z]?(?:_\{?\d+\}?|\^\{?\d+\}?)?)+$/.test(n);return r||i||a||o||s||c||l||u||d||f||p}var Lz=`__markstreamMathPluginApplied`,Rz=80,zz=2e4,Bz=24096;function Vz(e){return!!e[Lz]}function Hz(e){e[Lz]=!0}var Uz=`ldots.cdots.quad.in.displaystyle.int_.lim.lim_.ce.pu.end.infty.perp.mid.operatorname.to.rightarrow.leftarrow.math.mathrm.mathit.mathbb.mathcal.mathfrak.implies.alpha.beta.gamma.delta.epsilon.lambda.sum.sum_.prod.sqrt.fbox.boxed.color.rule.edef.fcolorbox.hline.hdashline.cdot.times.pm.le.ge.neq.sin.cos.tan.log.ln.exp.frac.text.left.right`.split(`.`),Wz=[`cdot`,`mathbf{`,`partial`,`mu_{`],Gz=Uz.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),Kz=`[ \r\b\f\v]`,qz=RegExp(`([^\\\\])(${Wz.map(e=>e).join(`|`)})+`,`g`),Jz=/span\{([^}]+)\}/,Yz=/\\operatorname\{span\}\{((?:[^{}]|\{[^}]*\})+)\}/,Xz=/(^|[^\\])\\\r?\n/g,Zz=/(^|[^\\])\\$/g,Qz=/[\p{L}\p{M}\p{N}\p{Pe}\p{Pf}'′″‴|‖]/u,$z=RegExp(`(${Kz})|(${Gz})\\b`,`g`),eB=new Map,tB=new Map;function nB(e){if(!e)return $z;let t=[...e];t.sort((e,t)=>t.length-e.length);let n=t.join(``),r=eB.get(n);if(r)return r;let i=`(?:${t.map(e=>e.replace(/[.*+?^${}()|[\\]\\"\]/g,`\\$&`)).join(`|`)})`,a=RegExp(`(${Kz})|(${i})\\b`,`g`);return eB.set(n,a),a}function rB(e,t){let n=e?[]:[...t??[]];e||n.sort((e,t)=>t.length-e.length);let r=e?`__default__`:n.join(``),i=tB.get(r);if(i)return i;let a=e?[Sz,Gz].filter(Boolean).join(`|`):[n.map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),Sz].filter(Boolean).join(`|`),o=RegExp(`(^|[^\\\\\\w])(${a})\\s*\\{`,`g`);return tB.set(r,o),o}var iB={" ":`t`,"\r":`r`,"\b":`b`,"\f":`f`,"\v":`v`};function aB(e){let t=/(^|[^\\])(__|\*\*)/g,n=0;for(;t.exec(e)!==null;)n++;return n}function oB(e){return e.replace(/(^|[^\\])!+/gu,(e,t)=>{if(t&&Qz.test(t))return e;let n=t?e.slice(t.length):e;return`${t}${`\\!`.repeat(n.length)}`})}function sB(e){let t=/(^|[^\\])(__|\*\*)/g,n,r=null;for(;(n=t.exec(e))!==null;)r={marker:n[2],index:n.index+(n[1]?.length??0)};return r}function cB(e,t){let n=t?.commands??Uz,r=t?.escapeExclamation??!0,i=t?.commands==null,a=nB(i?void 0:n),o=e.replace(a,(e,t,r,i,a)=>{if(t!==void 0&&iB[t]!==void 0)return`\\${iB[t]}`;if(r&&n.includes(r)){let t=a&&typeof i==`number`?a[i-1]:void 0;return t===`\\`||t&&/\w/.test(t)?e:`\\${r}`}return e});r&&(o=oB(o));let s=o,c=rB(i,i?void 0:n);return s=s.replace(c,(e,t,n)=>`${t}\\${n}{`),s=s.replace(Jz,`span\\{$1\\}`).replace(Yz,`\\operatorname{span}\\{$1\\}`),s=s.replace(Xz,`$1\\\\ -`),s=s.replace(Zz,`$1\\\\`),s=s.replace(qz,`$1\\$2`),s}function lB(e){let t=e.trim();return!(!Iz(t)||/"[^"\n]{1,80}"\s*:\s*/.test(t)||!(/\\[a-z]+/i.test(t)||/[=+*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/.test(t)||/[_^]/.test(t))&&/\s-\s/.test(t))}function uB(e){let t=[],n=0;for(;n=n[0]&&t0;){if(e[a]===`\\`&&a+10;){if(e[o]===`\\`&&o+1=0&&e[n]===`\\`;)r++,n--;return r%2==1}function mB(e,t){let n=t;for(;n0&&e[t-1]===`$`||t+1=s)break;let r=dB(i,n);if(r){o=Math.max(n+Math.max(1,t.length),r[1]);continue}pB(e,n)||a++,o=n+Math.max(1,t.length)}return a}function vB(e,t,n){let r=bB(String(e??``));if(!r.endsWith(t))return-1;let i=r.length-t.length;if(i<=0||!bB(r.slice(0,i)).trim()||pB(r,i))return-1;let a=uB(r);if(dB(a,i))return-1;let o=_B(r,t,0,i,a);if(t===`$$`){if(o%2==1)return-1}else if(o>_B(r,n,0,i,a))return-1;return i}function yB(e){return e===` `||e===` `}function bB(e){let t=e.length;for(;t>0&&yB(e[t-1]);)t--;return e.slice(0,t)}function xB(e){let t=0;for(let n=0;n=48&&t<=57}function CB(e){if(e.length<3)return!1;let t=e[0];if(t!==`-`&&t!==`*`&&t!==`_`&&t!==`=`)return!1;let n=0;for(let r=0;r=3}function wB(e){let t=e.trim();if(!t)return!1;let n=0;t[n]===`:`&&n++;let r=0;for(;t[n]===`-`;)r++,n++;return r<3?!1:(t[n]===`:`&&n++,n===t.length)}function TB(e){if(!e.includes(`|`))return!1;let t=e[0]===`|`?e.slice(1):e;return(t.endsWith(`|`)?t.slice(0,-1):t).split(`|`).every(wB)}function EB(e){let t=0;if(!SB(e[t]))return!1;for(;SB(e[t]);)t++;return e[t]!==`.`&&e[t]!==`)`?!1:yB(e[t+1])}function DB(e){let t=e.trimStart();if(!t||t.startsWith("```")||t.startsWith(`~~~`)||t.startsWith(`:::`)||t[0]===`>`||t[0]===`<`)return!0;if(t[0]===`#`){let e=0;for(;t[e]===`#`;)e++;if(e>=1&&e<=6&&yB(t[e]))return!0}return!!((t[0]===`-`||t[0]===`+`||t[0]===`*`)&&yB(t[1])||EB(t)||CB(t)||TB(t))}function OB(e,t){return e?t?`${e}\n${t}`:e:t}function kB(e){let t=String(e??``).trim();return t?Iz(t):!1}function AB(e){let t=0;for(let n=0;nRz){c=!0;break}let l=i[t],u=gB(l,a);if(u!==-1){let i=OB(s,l.slice(0,u));if(!kB(i)){c=!0;break}let d=l.slice(u+a.length),f=d.trim()?`suffix:${AB(d)}`:`nosuffix`;return[`closed`,n,r+e,o,r+t,u,AB(i),f].join(`:`)}if(DB(l)){c=!0;break}if(s=OB(s,l),s.length>zz){c=!0;break}}if(!c&&kB(s))return[`pending`,n,r+e,o].join(`:`)}}return null}function PB(e,t){let n=String(e??``).trim();return!n||!/^\d[\d,.]*\s*[~~-]\s*$/.test(n)?!1:/\d/.test(String(t??``))}function FB(e){let t=String(e??``).trimStart(),n=t.match(/^\d+(?:,\d{3})*(?:\.\d+)?/);if(!n)return!1;let r=t.slice(n[0].length);return/^\s*(?:[+\-*/^_=<>]|\\[a-z]+)/i.test(r)?!1:r===``||/^[)\s,.!?;:]/.test(r)}function IB(e){let t=String(e??``).trim();return t?/^(?:\.{3,}|…+)$/.test(t):!1}function LB(e,t){Hz(e);let n=(e,t,n)=>{let r=String(t??``).replace(/^[\t ]+/,``).replace(/[\t ]+$/,``);if(!r)return;let i=e.push(`paragraph_open`,`p`,1);i.map=[n,n+1];let a=e.push(`inline`,``,0);a.content=r,a.map=[n,n+1],a.children=[],e.push(`paragraph_close`,`p`,-1)},r=(e,n)=>{let r=e,i=!!t?.strictDelimiters,a=!r?.env?.__markstreamFinal,o=(e,t)=>{let n=t;for(;ne.trim()).flatMap(e=>hz(e)),t=[...pz(),...e,...mz()];r.splice(i-1,3,...t)}else if(e.includes(` +`)&&l.length===0&&_z(s)&&yz(c)){let e=o.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>hz(e)),t=[...pz(),...e,...mz()];r.splice(i-1,3,...t)}else e.includes(` +`)&&l.length===0&&Cz(s)&&Sz(c)&&(a.content=e.slice(0,-2),a.children.splice(2,1))}return r}function Tz(e,t,n,r){let i=e.length;if(n===`$$`&&r===`$$`){let n=t;for(;n=0&&e[t]===`\\`;)r++,t--;if(r%2==0)return n}n++}return-1}let a=n[n.length-1],o=r,s=0,c=t;for(;c=0&&e[t]===`\\`;)n++,t--;if(n%2==0){if(s===0)return c;s--,c+=o.length;continue}}let t=e[c];if(t===`\\`){c+=2;continue}t===a?s++:t===o[o.length-1]&&s>0&&s--,c++}return-1}var Ez=Tz,Dz=[`boldsymbol`,`mathbb`,`mathcal`,`mathfrak`,`mathrm`,`mathit`,`mathsf`,`vec`,`hat`,`bar`,`tilde`,`overline`,`underline`,`mathscr`,`mathnormal`,`operatorname`,`mathbf*`].map(e=>e.replace(/[.*+?^${}()|[\\]"\]/g,`\\$&`)).join(`|`),Oz=/\\[a-z]+/i,kz=`(?:\\\\|\\u0008)`,Az=new RegExp(String.raw`${kz}(?:${Dz})\s*\{[^}]+\}`,`i`),jz=new RegExp(String.raw`(?:${kz})?(?:${Dz})\s*\{`,`i`),Mz=/\\(?:text|frac|left|right|times)/,Nz=/(?:^|[^+])\+(?!\+)|[=\-*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/,Pz=/\b[A-Z]{2,}-[A-Z]{2,}\b/i,Fz=/[A-Z]+\s*\([^)]+\)/i,Iz=/^\(\s*[a-z](?:\s*,\s*[a-z])+\s*\)$/i,Lz=/\b(?:sin|cos|tan|log|ln|exp|sqrt|frac|sum|lim|int|prod)\b/,Rz=/\b\d{4}\/\d{1,2}\/\d{1,2}(?:[ T]\d{1,2}:\d{2}(?::\d{2})?)?\b/,zz={"\b":`\\b`,"\v":`\\v`,"\f":`\\f`};function Bz(e){let t=``;for(let n of e)t+=zz[n]??n;return t}function Vz(e){if(!e)return!1;let t=Bz(e),n=t.trim();if(Rz.test(n)||n.includes(`**`))return!1;if(n.length>2e3)return!0;let r=Oz.test(t),i=Az.test(t),a=jz.test(t),o=Mz.test(t),s=/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)_(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t)||/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)\^(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t),c=Nz.test(t)&&!Pz.test(t),l=Fz.test(t),u=Iz.test(n),d=Lz.test(t),f=/^\([a-z]\)$/i.test(n)||/^(?:[a-z]|pi)$/i.test(n),p=/^(?:[A-Z][a-z]?(?:_\{?\d+\}?|\^\{?\d+\}?)?)+$/.test(n);return r||i||a||o||s||c||l||u||d||f||p}var Hz=`__markstreamMathPluginApplied`,Uz=80,Wz=2e4,Gz=24096;function Kz(e){return!!e[Hz]}function qz(e){e[Hz]=!0}var Jz=`ldots.cdots.quad.in.displaystyle.int_.lim.lim_.ce.pu.end.infty.perp.mid.operatorname.to.rightarrow.leftarrow.math.mathrm.mathit.mathbb.mathcal.mathfrak.implies.alpha.beta.gamma.delta.epsilon.lambda.sum.sum_.prod.sqrt.fbox.boxed.color.rule.edef.fcolorbox.hline.hdashline.cdot.times.pm.le.ge.neq.sin.cos.tan.log.ln.exp.frac.text.left.right`.split(`.`),Yz=[`cdot`,`mathbf{`,`partial`,`mu_{`],Xz=Jz.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),Zz=`[ \r\b\f\v]`,Qz=RegExp(`([^\\\\])(${Yz.map(e=>e).join(`|`)})+`,`g`),$z=/span\{([^}]+)\}/,eB=/\\operatorname\{span\}\{((?:[^{}]|\{[^}]*\})+)\}/,tB=/(^|[^\\])\\\r?\n/g,nB=/(^|[^\\])\\$/g,rB=/[\p{L}\p{M}\p{N}\p{Pe}\p{Pf}'′″‴|‖]/u,iB=RegExp(`(${Zz})|(${Xz})\\b`,`g`),aB=new Map,oB=new Map;function sB(e){if(!e)return iB;let t=[...e];t.sort((e,t)=>t.length-e.length);let n=t.join(``),r=aB.get(n);if(r)return r;let i=`(?:${t.map(e=>e.replace(/[.*+?^${}()|[\\]\\"\]/g,`\\$&`)).join(`|`)})`,a=RegExp(`(${Zz})|(${i})\\b`,`g`);return aB.set(n,a),a}function cB(e,t){let n=e?[]:[...t??[]];e||n.sort((e,t)=>t.length-e.length);let r=e?`__default__`:n.join(``),i=oB.get(r);if(i)return i;let a=e?[Dz,Xz].filter(Boolean).join(`|`):[n.map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),Dz].filter(Boolean).join(`|`),o=RegExp(`(^|[^\\\\\\w])(${a})\\s*\\{`,`g`);return oB.set(r,o),o}var lB={" ":`t`,"\r":`r`,"\b":`b`,"\f":`f`,"\v":`v`};function uB(e){let t=/(^|[^\\])(__|\*\*)/g,n=0;for(;t.exec(e)!==null;)n++;return n}function dB(e){return e.replace(/(^|[^\\])!+/gu,(e,t)=>{if(t&&rB.test(t))return e;let n=t?e.slice(t.length):e;return`${t}${`\\!`.repeat(n.length)}`})}function fB(e){let t=/(^|[^\\])(__|\*\*)/g,n,r=null;for(;(n=t.exec(e))!==null;)r={marker:n[2],index:n.index+(n[1]?.length??0)};return r}function pB(e,t){let n=t?.commands??Jz,r=t?.escapeExclamation??!0,i=t?.commands==null,a=sB(i?void 0:n),o=e.replace(a,(e,t,r,i,a)=>{if(t!==void 0&&lB[t]!==void 0)return`\\${lB[t]}`;if(r&&n.includes(r)){let t=a&&typeof i==`number`?a[i-1]:void 0;return t===`\\`||t&&/\w/.test(t)?e:`\\${r}`}return e});r&&(o=dB(o));let s=o,c=cB(i,i?void 0:n);return s=s.replace(c,(e,t,n)=>`${t}\\${n}{`),s=s.replace($z,`span\\{$1\\}`).replace(eB,`\\operatorname{span}\\{$1\\}`),s=s.replace(tB,`$1\\\\ +`),s=s.replace(nB,`$1\\\\`),s=s.replace(Qz,`$1\\$2`),s}function mB(e){let t=e.trim();return!(!Vz(t)||/"[^"\n]{1,80}"\s*:\s*/.test(t)||!(/\\[a-z]+/i.test(t)||/[=+*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/.test(t)||/[_^]/.test(t))&&/\s-\s/.test(t))}function hB(e){let t=[],n=0;for(;n=n[0]&&t0;){if(e[a]===`\\`&&a+10;){if(e[o]===`\\`&&o+1=0&&e[n]===`\\`;)r++,n--;return r%2==1}function yB(e,t){let n=t;for(;n0&&e[t-1]===`$`||t+1=s)break;let r=gB(i,n);if(r){o=Math.max(n+Math.max(1,t.length),r[1]);continue}vB(e,n)||a++,o=n+Math.max(1,t.length)}return a}function CB(e,t,n){let r=TB(String(e??``));if(!r.endsWith(t))return-1;let i=r.length-t.length;if(i<=0||!TB(r.slice(0,i)).trim()||vB(r,i))return-1;let a=hB(r);if(gB(a,i))return-1;let o=SB(r,t,0,i,a);if(t===`$$`){if(o%2==1)return-1}else if(o>SB(r,n,0,i,a))return-1;return i}function wB(e){return e===` `||e===` `}function TB(e){let t=e.length;for(;t>0&&wB(e[t-1]);)t--;return e.slice(0,t)}function EB(e){let t=0;for(let n=0;n=48&&t<=57}function OB(e){if(e.length<3)return!1;let t=e[0];if(t!==`-`&&t!==`*`&&t!==`_`&&t!==`=`)return!1;let n=0;for(let r=0;r=3}function kB(e){let t=e.trim();if(!t)return!1;let n=0;t[n]===`:`&&n++;let r=0;for(;t[n]===`-`;)r++,n++;return r<3?!1:(t[n]===`:`&&n++,n===t.length)}function AB(e){if(!e.includes(`|`))return!1;let t=e[0]===`|`?e.slice(1):e;return(t.endsWith(`|`)?t.slice(0,-1):t).split(`|`).every(kB)}function jB(e){let t=0;if(!DB(e[t]))return!1;for(;DB(e[t]);)t++;return e[t]!==`.`&&e[t]!==`)`?!1:wB(e[t+1])}function MB(e){let t=e.trimStart();if(!t||t.startsWith("```")||t.startsWith(`~~~`)||t.startsWith(`:::`)||t[0]===`>`||t[0]===`<`)return!0;if(t[0]===`#`){let e=0;for(;t[e]===`#`;)e++;if(e>=1&&e<=6&&wB(t[e]))return!0}return!!((t[0]===`-`||t[0]===`+`||t[0]===`*`)&&wB(t[1])||jB(t)||OB(t)||AB(t))}function NB(e,t){return e?t?`${e}\n${t}`:e:t}function PB(e){let t=String(e??``).trim();return t?Vz(t):!1}function FB(e){let t=0;for(let n=0;nUz){c=!0;break}let l=i[t],u=xB(l,a);if(u!==-1){let i=NB(s,l.slice(0,u));if(!PB(i)){c=!0;break}let d=l.slice(u+a.length),f=d.trim()?`suffix:${FB(d)}`:`nosuffix`;return[`closed`,n,r+e,o,r+t,u,FB(i),f].join(`:`)}if(MB(l)){c=!0;break}if(s=NB(s,l),s.length>Wz){c=!0;break}}if(!c&&PB(s))return[`pending`,n,r+e,o].join(`:`)}}return null}function zB(e,t){let n=String(e??``).trim();return!n||!/^\d[\d,.]*\s*[~~-]\s*$/.test(n)?!1:/\d/.test(String(t??``))}function BB(e){let t=String(e??``).trimStart(),n=t.match(/^\d+(?:,\d{3})*(?:\.\d+)?/);if(!n)return!1;let r=t.slice(n[0].length);return/^\s*(?:[+\-*/^_=<>]|\\[a-z]+)/i.test(r)?!1:r===``||/^[)\s,.!?;:]/.test(r)}function VB(e){let t=String(e??``).trim();return t?/^(?:\.{3,}|…+)$/.test(t):!1}function HB(e,t){qz(e);let n=(e,t,n)=>{let r=String(t??``).replace(/^[\t ]+/,``).replace(/[\t ]+$/,``);if(!r)return;let i=e.push(`paragraph_open`,`p`,1);i.map=[n,n+1];let a=e.push(`inline`,``,0);a.content=r,a.map=[n,n+1],a.children=[],e.push(`paragraph_close`,`p`,-1)},r=(e,n)=>{let r=e,i=!!t?.strictDelimiters,a=!r?.env?.__markstreamFinal,o=(e,t)=>{let n=t;for(;n=3&&(!n||/\s/.test(n))){let t=r.push(`text`,``,0);return t.content=r.src.slice(r.pos,e),r.pos=e,!0}}let s=[[`$$`,`$$`],[`$`,`$`],[`\\(`,`\\)`]],c=String(r.pending??``),l=Math.max(0,r.pos-c.length),u=l,d=l,f=l;for(let[e,c]of s){let s=r.src,l=uB(s),p=fB(s,a),m=!1;e===`$$`&&u!==f&&(u=f);let h=-1,g=-1,_=0,v=n=>{if((n===`undefined`||n==null)&&(n=``),n===`\\`){r.pos+=n.length,u=r.pos;return}if(n===`\\)`||n===`\\(`){let e=r.push(`text_special`,``,0);e.content=n===`\\)`?`)`:`(`,e.markup=n,r.pos+=n.length,u=r.pos;return}if(!n)return;if(e===`$$`&&n.includes(`$`)){let e=0;for(;e0&&n[i-1]===`$`||i+10){let e=n.slice(0,i),t=r.push(`text`,``,0);t.content=e,r.pos+=e.length,u=r.pos}let e=n.slice(i).match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(e){let[,t,a]=e,o=a.match(/^(\S+)(?:\s+"([^"]+)")?\s*$/),s=o?o[1]:a,c=o&&o[2]?o[2]:null,l=r.push(`image`,`img`,0);l.attrs=[[`src`,s],[`alt`,t]],c&&l.attrs.push([`title`,c]),l.content=t,l.children=[{type:`text`,content:t,tag:``}],r.pos+=e[0].length,u=r.pos;let d=n.slice(i+e[0].length);d&&v(d);return}let t=r.push(`text`,``,0);t.content=n,r.pos+=n.length,u=r.pos;return}let a=r.push(`text`,``,0);a.content=n,r.pos+=n.length,u=r.pos};for(;!(u>=s.length);){let f=s.indexOf(e,u);if(f===-1)break;if(pB(s,f)){u=f+Math.max(1,e.length);continue}let y=dB(l,f);if(y){u=y[1];continue}let b=dB(p,f);if(b){u=b[1];continue}if(f===h&&u===g){if(_++,_>2){u=f+Math.max(1,e.length);continue}}else _=0,h=f,g=u;if(e===`(`&&f>0){let t=f-1;for(;t>=0&&s[t]===` `;)t--;if(t>=0&&s[t]===`]`){u=f+e.length;continue}}if(e===`$`&&f>0&&s[f-1]===`$`){u=f+1;continue}if(e===`$`&&f=s.length);){let n=mB(s,e);if(n===-1)break;if(n+10&&s[n-1]===`$`){e=n+1;continue}let i=hB(s,n+1);if(i===-1)break;let a=s.slice(n+1,i),o=a.includes("`"),c=!a||!a.trim(),l=s[i+1],d=PB(a,l),f=IB(a);if(!o&&!c&&!d&&!f){let o=s.slice(u,n);o&&v(o);let c=r.push(`math_inline`,`math`,0);c.content=cB(a,t),c.markup=`$`,c.raw=`$${a}$`,c.loading=!1,u=i+1,e=i+1}else v(`$`),e=n+1}e{let o=e,s=!o?.env?.__markstreamFinal,c=t?.strictDelimiters,l=c?[[`\\[`,`\\]`],[`$$`,`$$`]]:[[`\\[`,`\\]`],[`[`,`]`],[`$$`,`$$`]],u=o.bMarks[r]+o.tShift[r],d=o.src.slice(u,o.eMarks[r]).trim(),f=!1,p=``,m=``,h=!1,g=``,_=!1;for(let[e,n]of l)if(d.startsWith(e))if(e.includes(`[`)){let a=e===`\\[`?d.slice(e.length):``;if(e===`\\[`&&gB(a,n)===-1&&!/^\s*!\[/.test(a)&&!a.includes("`")&&Iz(a)){f=!0,p=e,m=n;break}if(t?.strictDelimiters){if(d.replace(`\\`,``)===`[`){if(r+1=0?`\\]`:m,S=b>=0?b:gB(d,m,y);if(!h&&S>p.length){let e=d.slice(v+p.length,S),t=o.push(`math_block`,`math`,0);t.content=cB(e),t.markup=p===`$$`?`$$`:p===`[`?`[]`:`\\[\\]`,t.map=[r,r+1],t.raw=`${p}${e}${x}`,t.block=!0,t.loading=!1,o.line=r+1;let i=d.slice(S+x.length);return i.trim()&&n(o,i,r),!0}let C=r,w=``,T=!1,E=``,D=r,O=h?d:d===p?``:d.slice(p.length),k=!c&&p===`\\[`?`]`:``,A=gB(O,m);if(A!==-1){let e=A;w=O.slice(0,e),E=O.slice(e+m.length),D=h?r+1:r,T=!0,C=D}else for(O&&!h&&(w=O),C=r+1;C=3&&(!n||/\s/.test(n))){let t=r.push(`text`,``,0);return t.content=r.src.slice(r.pos,e),r.pos=e,!0}}let s=[[`$$`,`$$`],[`$`,`$`],[`\\(`,`\\)`]],c=String(r.pending??``),l=Math.max(0,r.pos-c.length),u=l,d=l,f=l;for(let[e,c]of s){let s=r.src,l=hB(s),p=_B(s,a),m=!1;e===`$$`&&u!==f&&(u=f);let h=-1,g=-1,_=0,v=n=>{if((n===`undefined`||n==null)&&(n=``),n===`\\`){r.pos+=n.length,u=r.pos;return}if(n===`\\)`||n===`\\(`){let e=r.push(`text_special`,``,0);e.content=n===`\\)`?`)`:`(`,e.markup=n,r.pos+=n.length,u=r.pos;return}if(!n)return;if(e===`$$`&&n.includes(`$`)){let e=0;for(;e0&&n[i-1]===`$`||i+10){let e=n.slice(0,i),t=r.push(`text`,``,0);t.content=e,r.pos+=e.length,u=r.pos}let e=n.slice(i).match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(e){let[,t,a]=e,o=a.match(/^(\S+)(?:\s+"([^"]+)")?\s*$/),s=o?o[1]:a,c=o&&o[2]?o[2]:null,l=r.push(`image`,`img`,0);l.attrs=[[`src`,s],[`alt`,t]],c&&l.attrs.push([`title`,c]),l.content=t,l.children=[{type:`text`,content:t,tag:``}],r.pos+=e[0].length,u=r.pos;let d=n.slice(i+e[0].length);d&&v(d);return}let t=r.push(`text`,``,0);t.content=n,r.pos+=n.length,u=r.pos;return}let a=r.push(`text`,``,0);a.content=n,r.pos+=n.length,u=r.pos};for(;!(u>=s.length);){let f=s.indexOf(e,u);if(f===-1)break;if(vB(s,f)){u=f+Math.max(1,e.length);continue}let y=gB(l,f);if(y){u=y[1];continue}let b=gB(p,f);if(b){u=b[1];continue}if(f===h&&u===g){if(_++,_>2){u=f+Math.max(1,e.length);continue}}else _=0,h=f,g=u;if(e===`(`&&f>0){let t=f-1;for(;t>=0&&s[t]===` `;)t--;if(t>=0&&s[t]===`]`){u=f+e.length;continue}}if(e===`$`&&f>0&&s[f-1]===`$`){u=f+1;continue}if(e===`$`&&f=s.length);){let n=yB(s,e);if(n===-1)break;if(n+10&&s[n-1]===`$`){e=n+1;continue}let i=bB(s,n+1);if(i===-1)break;let a=s.slice(n+1,i),o=a.includes("`"),c=!a||!a.trim(),l=s[i+1],d=zB(a,l),f=VB(a);if(!o&&!c&&!d&&!f){let o=s.slice(u,n);o&&v(o);let c=r.push(`math_inline`,`math`,0);c.content=pB(a,t),c.markup=`$`,c.raw=`$${a}$`,c.loading=!1,u=i+1,e=i+1}else v(`$`),e=n+1}e{let o=e,s=!o?.env?.__markstreamFinal,c=t?.strictDelimiters,l=c?[[`\\[`,`\\]`],[`$$`,`$$`]]:[[`\\[`,`\\]`],[`[`,`]`],[`$$`,`$$`]],u=o.bMarks[r]+o.tShift[r],d=o.src.slice(u,o.eMarks[r]).trim(),f=!1,p=``,m=``,h=!1,g=``,_=!1;for(let[e,n]of l)if(d.startsWith(e))if(e.includes(`[`)){let a=e===`\\[`?d.slice(e.length):``;if(e===`\\[`&&xB(a,n)===-1&&!/^\s*!\[/.test(a)&&!a.includes("`")&&Vz(a)){f=!0,p=e,m=n;break}if(t?.strictDelimiters){if(d.replace(`\\`,``)===`[`){if(r+1=0?`\\]`:m,S=b>=0?b:xB(d,m,y);if(!h&&S>p.length){let e=d.slice(v+p.length,S),t=o.push(`math_block`,`math`,0);t.content=pB(e),t.markup=p===`$$`?`$$`:p===`[`?`[]`:`\\[\\]`,t.map=[r,r+1],t.raw=`${p}${e}${x}`,t.block=!0,t.loading=!1,o.line=r+1;let i=d.slice(S+x.length);return i.trim()&&n(o,i,r),!0}let C=r,w=``,T=!1,E=``,D=r,O=h?d:d===p?``:d.slice(p.length),k=!c&&p===`\\[`?`]`:``,A=xB(O,m);if(A!==-1){let e=A;w=O.slice(0,e),E=O.slice(e+m.length),D=h?r+1:r,T=!0,C=D}else for(O&&!h&&(w=O),C=r+1;C{let a=e,o=a.bMarks[t]+a.tShift[t],s=a.src.slice(o,a.eMarks[t]).trim();return!s.startsWith(`$$`)&&!s.startsWith(`\\[`)?!1:i(e,t,n,r)},{alt:[`paragraph`,`reference`,`blockquote`,`list`]}),e.block.ruler.before(`paragraph`,`math_block`,i,{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function RB(e){let t=e.renderer.rules.image||function(e,t,n,r,i){let a=e,o=i;return o.renderToken?o.renderToken(a,t,n):``};e.renderer.rules.image=(e,n,r,i,a)=>{let o=e;return o[n].attrSet?.(`loading`,`lazy`),t(o,n,r,i,a)},e.renderer.rules.fence=e.renderer.rules.fence||((t,n)=>{let r=t[n],i=String(r.info??``).trim();return`
        ${e.utils.escapeHtml(String(r.content??``))}
        `})}var zB=/^\s]/i,BB=/^<\/a\s*>/i;function VB(e,t){if(e?.type!==`inline`)return!1;let n=e.children;if(!Array.isArray(n)||n.length===0)return t.pretest(String(e.content??``));let r=0;for(let e=n.length-1;e>=0;e--){let i=n[e];if(i?.type===`link_close`){for(e--;e>=0&&n[e]?.level!==i.level&&n[e]?.type!==`link_open`;)e--;continue}if(i?.type===`html_inline`){let e=String(i.content??``);zB.test(e)&&r>0&&r--,BB.test(e)&&r++}if(!(r>0)&&i?.type===`text`&&t.pretest(String(i.content??``)))return!0}return!1}function HB(e){let t=e.core?.ruler,n=t.getNamedRules?.().find(e=>e.name===`linkify`)?.fn;typeof n==`function`&&t.at(`linkify`,e=>{if(!e.md?.options?.linkify)return;let t=Array.isArray(e.tokens)?e.tokens:[],r=e.md.linkify;if(!r)return;let i=t.filter(e=>VB(e,r));if(i.length)return n(Object.assign(Object.create(Object.getPrototypeOf(e)),e,{tokens:i}))})}function UB(e){let t=e.inline.ruler,n=t.getNamedRules?.(),r=n?.find(e=>e.name===`link`)?.fn,i=n?.find(e=>e.name===`image`)?.fn;if(typeof r!=`function`||typeof i!=`function`)return;let a=e.validateLink,o=e;o.__markstreamOriginalValidateLink=a,t.at(`link`,(...e)=>{let t=e[0].md,n=t?.validateLink===a?t.options?.validateLink:t?.validateLink;if(!t||typeof n!=`function`)return r(...e);let i=t.validateLink;t.validateLink=n;try{return r(...e)}finally{t.validateLink=i}}),t.at(`image`,(...e)=>{let t=e[0].md;if(!t)return i(...e);let n=t.validateLink;t.validateLink=a;try{return i(...e)}finally{t.validateLink=n}})}function WB(e={}){let t=e.markdownItOptions??{},n=typeof t.experimental==`object`&&t.experimental!==null?t.experimental:{},r=Object.prototype.hasOwnProperty.call(t,`stream`)?!!t.stream:!0,i=Object.prototype.hasOwnProperty.call(t,`validateLink`),a=new TI({html:!0,linkify:!0,typographer:!0,...t,experimental:{stream:r,...n}});return i||a.set({validateLink:e=>!rL(e,{tagName:`a`,attrName:`href`})}),UB(a),HB(a),(e.enableMath??!0)&&LB(a,{...DI()??{},...e.mathOptions??{}}),(e.enableContainers??!0)&&uL(a),e.enableFixIndentedCodeBlock!==!1&&ZL(a),$R(a),rz(a),tz(a),sz(a),RB(a),YL(a,{customHtmlTags:e.customHtmlTags}),a}function GB(e){let t=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return Array.isArray(e.attrs)&&(t.attrs=e.attrs.map(e=>[...e])),Array.isArray(e.map)&&(t.map=[...e.map]),Array.isArray(e.children)&&(t.children=e.children.map(e=>GB(e))),t}function KB(e){let t=e.meta??{};return{type:`checkbox`,checked:t.checked===!0,raw:t.checked?`[x]`:`[ ]`}}function qB(e){let t=e,n=t.attrGet?t.attrGet(`checked`):void 0,r=n===``||n===`true`;return{type:`checkbox_input`,checked:r,raw:r?`[x]`:`[ ]`}}function JB(e){let t=String(e.content??``);return{type:`emoji`,name:t,markup:String(e.markup??``),raw:`:${t}:`}}function YB(e,t,n){let r=[],i=``,a=t+1,o=[];for(;ae.startsWith(t)||t.startsWith(e)):!1}function eV(e,t,n,r){n.length>0&&e.push(...n),r.length>0&&t.push(...r),n.length=0,r.length=0}function tV(e,t){return!t&&e.startsWith(` `)&&!e.startsWith(` `)?` ${e}`:e}function nV(e,t){let n=[],r=[],i=[],a=[],o=e.split(QB),s=/\r?\n$/.test(e),c=o.some(e=>e.startsWith(`diff `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@ `)),l=e=>{let t=e;if(!ZB.some(e=>t.startsWith(e)))if(t.startsWith(`-`)){let e=t.slice(1);i.push(tV(e,c))}else if(t.startsWith(`+`)){let e=t.slice(1);a.push(tV(e,c))}else{eV(n,r,i,a);let e=c&&t.startsWith(` `)?t.slice(1):t;n.push(e),r.push(e)}},u=s?Math.max(0,o.length-1):o.length;for(let e=0;e0||a.length>0)&&eV(n,r,i,a);let d=n.join(` +`:``}${m}`,M.map=[r,C+1],M.block=!0,M.loading=!T,o.line=C+1,E.trim()&&n(o,E,D),!0};e.inline.ruler.before(`escape`,`math`,r),e.block.ruler.before(`lheading`,`explicit_math_block`,(e,t,n,r)=>{let a=e,o=a.bMarks[t]+a.tShift[t],s=a.src.slice(o,a.eMarks[t]).trim();return!s.startsWith(`$$`)&&!s.startsWith(`\\[`)?!1:i(e,t,n,r)},{alt:[`paragraph`,`reference`,`blockquote`,`list`]}),e.block.ruler.before(`paragraph`,`math_block`,i,{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function UB(e){let t=e.renderer.rules.image||function(e,t,n,r,i){let a=e,o=i;return o.renderToken?o.renderToken(a,t,n):``};e.renderer.rules.image=(e,n,r,i,a)=>{let o=e;return o[n].attrSet?.(`loading`,`lazy`),t(o,n,r,i,a)},e.renderer.rules.fence=e.renderer.rules.fence||((t,n)=>{let r=t[n],i=String(r.info??``).trim();return`
        ${e.utils.escapeHtml(String(r.content??``))}
        `})}var WB=/^\s]/i,GB=/^<\/a\s*>/i;function KB(e,t){if(e?.type!==`inline`)return!1;let n=e.children;if(!Array.isArray(n)||n.length===0)return t.pretest(String(e.content??``));let r=0;for(let e=n.length-1;e>=0;e--){let i=n[e];if(i?.type===`link_close`){for(e--;e>=0&&n[e]?.level!==i.level&&n[e]?.type!==`link_open`;)e--;continue}if(i?.type===`html_inline`){let e=String(i.content??``);WB.test(e)&&r>0&&r--,GB.test(e)&&r++}if(!(r>0)&&i?.type===`text`&&t.pretest(String(i.content??``)))return!0}return!1}function qB(e){let t=e.core?.ruler,n=t.getNamedRules?.().find(e=>e.name===`linkify`)?.fn;typeof n==`function`&&t.at(`linkify`,e=>{if(!e.md?.options?.linkify)return;let t=Array.isArray(e.tokens)?e.tokens:[],r=e.md.linkify;if(!r)return;let i=t.filter(e=>KB(e,r));if(i.length)return n(Object.assign(Object.create(Object.getPrototypeOf(e)),e,{tokens:i}))})}function JB(e){let t=e.inline.ruler,n=t.getNamedRules?.(),r=n?.find(e=>e.name===`link`)?.fn,i=n?.find(e=>e.name===`image`)?.fn;if(typeof r!=`function`||typeof i!=`function`)return;let a=e.validateLink,o=e;o.__markstreamOriginalValidateLink=a,t.at(`link`,(...e)=>{let t=e[0].md,n=t?.validateLink===a?t.options?.validateLink:t?.validateLink;if(!t||typeof n!=`function`)return r(...e);let i=t.validateLink;t.validateLink=n;try{return r(...e)}finally{t.validateLink=i}}),t.at(`image`,(...e)=>{let t=e[0].md;if(!t)return i(...e);let n=t.validateLink;t.validateLink=a;try{return i(...e)}finally{t.validateLink=n}})}function YB(e={}){let t=e.markdownItOptions??{},n=typeof t.experimental==`object`&&t.experimental!==null?t.experimental:{},r=Object.prototype.hasOwnProperty.call(t,`stream`)?!!t.stream:!0,i=Object.prototype.hasOwnProperty.call(t,`validateLink`),a=new AI({html:!0,linkify:!0,typographer:!0,...t,experimental:{stream:r,...n}});return i||a.set({validateLink:e=>!cL(e,{tagName:`a`,attrName:`href`})}),JB(a),qB(a),(e.enableMath??!0)&&HB(a,{...MI()??{},...e.mathOptions??{}}),(e.enableContainers??!0)&&hL(a),e.enableFixIndentedCodeBlock!==!1&&nR(a),iz(a),cz(a),oz(a),fz(a),UB(a),eR(a,{customHtmlTags:e.customHtmlTags}),a}function XB(e){let t=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return Array.isArray(e.attrs)&&(t.attrs=e.attrs.map(e=>[...e])),Array.isArray(e.map)&&(t.map=[...e.map]),Array.isArray(e.children)&&(t.children=e.children.map(e=>XB(e))),t}function ZB(e){let t=e.meta??{};return{type:`checkbox`,checked:t.checked===!0,raw:t.checked?`[x]`:`[ ]`}}function QB(e){let t=e,n=t.attrGet?t.attrGet(`checked`):void 0,r=n===``||n===`true`;return{type:`checkbox_input`,checked:r,raw:r?`[x]`:`[ ]`}}function $B(e){let t=String(e.content??``);return{type:`emoji`,name:t,markup:String(e.markup??``),raw:`:${t}:`}}function eV(e,t,n){let r=[],i=``,a=t+1,o=[];for(;ae.startsWith(t)||t.startsWith(e)):!1}function aV(e,t,n,r){n.length>0&&e.push(...n),r.length>0&&t.push(...r),n.length=0,r.length=0}function oV(e,t){return!t&&e.startsWith(` `)&&!e.startsWith(` `)?` ${e}`:e}function sV(e,t){let n=[],r=[],i=[],a=[],o=e.split(rV),s=/\r?\n$/.test(e),c=o.some(e=>e.startsWith(`diff `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@ `)),l=e=>{let t=e;if(!nV.some(e=>t.startsWith(e)))if(t.startsWith(`-`)){let e=t.slice(1);i.push(oV(e,c))}else if(t.startsWith(`+`)){let e=t.slice(1);a.push(oV(e,c))}else{aV(n,r,i,a);let e=c&&t.startsWith(` `)?t.slice(1):t;n.push(e),r.push(e)}},u=s?Math.max(0,o.length-1):o.length;for(let e=0;e0||a.length>0)&&aV(n,r,i,a);let d=n.join(` `),f=r.join(` -`);return{original:t&&s&&d?`${d}\n`:d,updated:t&&s&&f?`${f}\n`:f}}function rV(e){let t=Array.isArray(e.map)&&e.map.length===2,n=e.meta??{},r=typeof n.closed==`boolean`?n.closed:void 0,i=r===!0||r!==!1&&t,a=String(e.info??``),o=a.startsWith(`diff`),s=o?(()=>{let e=a,t=e.indexOf(` `);return t===-1?``:String(e.slice(t+1)??``)})():a,c=String(e.content??``);if(XB.test(c)&&(c=c.replace(XB,``)),o){let{original:e,updated:n}=nV(c,i===!0);return{type:`code_block`,language:s,code:String(n??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1?!0:!t,originalCode:e,updatedCode:n}}return{type:`code_block`,language:s,code:String(c??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1?!0:!t}}function iV(e){let t=e.meta??{};return{type:`footnote_reference`,id:String(t.label??``),raw:`[^${String(t.label??``)}]`}}function aV(){return{type:`hardbreak`,raw:`\\ -`}}function oV(e,t,n){let r=[],i=``,a=t+1,o=[];for(;a\s*$/.test(t)||LI.has(e)}function pV(e){if(!e||e.length===0)return lV();let t=cV.get(e);if(t)return t;let n=e.map(gL).filter(Boolean);if(!n.length){let t=lV();return cV.set(e,t),t}let r={customTagSet:new Set(n),allowedTagSet:$W({customHtmlTags:e})};return cV.set(e,r),r}function mV(e){let t=e,n=t.raw??t.content??t.markup??``;return String(n??``)}function hV(e){let t=e.meta,n=t?.markstreamCustomHtmlRaw,r=t?.markstreamCustomHtmlInner;return typeof n==`string`&&typeof r==`string`?{raw:n,inner:r}:null}function gV(e,t){let n=t.toLowerCase();for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function _V(e,t,n){let r=e.slice();return gV(r,`href`)||r.push([`href`,t]),n!=null&&!gV(r,`title`)&&r.push([`title`,n]),r}function vV(e){return e.map(mV).join(``)}function yV(e){let t=[],n=e=>{let n=String(e??``);if(!n)return;let r=t[t.length-1];if(r?.type===`text`){r.content=`${r.content}${n}`,r.raw=`${r.raw}${n}`;return}t.push({type:`text`,content:n,raw:n})};for(let r of e)if(r){if(r.type===`reference`||r.type===`footnote_reference`){n(String(r.raw??``));continue}if(`children`in r&&Array.isArray(r.children)){t.push({...r,children:yV(r.children)});continue}t.push(r)}return t}function bV(e,t,n){let r=0;for(let i=t;i`;h.toLowerCase().includes(e.toLowerCase())||(h+=e),_=!0,g=!0}let v=[],y=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,b;for(;(b=y.exec(s))!==null;){let e=b[1],t=b[2]||b[3]||b[4]||``;v.push([e,t])}if(l?.has(c)){let t=hV(e);return[{type:c,tag:c,attrs:v,content:t?t.inner:p.innerTokens.length?vV(p.innerTokens):``,children:p.innerTokens.length?r(p.innerTokens,i,a,o):[],raw:t?.raw??h,loading:e.loading||g,autoClosed:_},p.nextIndex]}return[{type:`html_inline`,tag:c,attrs:v,content:h,children:m,raw:h,loading:g,autoClosed:_},p.nextIndex]}function CV(e){if(e.type===`math_inline`){if(e.raw)return String(e.raw);let t=e.markup===`$$`?`$$`:`$`;return`${t}${String(e.content??``)}${t}`}return Array.isArray(e.children)&&e.children.length>0?e.children.map(e=>CV(e)).join(``):String(e.content??``)}function wV(e){return!e||!Array.isArray(e.children)||e.children.length===0?``:e.children.map(e=>CV(e)).join(``)}function TV(e,t=!1){let n=e.attrs??[],r=null;if((!n||n.length===0)&&Array.isArray(e.children))for(let t of e.children){let e=t.attrs;if(Array.isArray(e)&&e.length>0){n=e,r=t;break}}let i=String(n.find(e=>e[0]===`src`)?.[1]??``),a=n.find(e=>e[0]===`alt`)?.[1],o=wV(r??e),s=``;o?s=o:a!=null&&String(a).length>0?s=String(a):r?.content!=null&&String(r.content).length>0?s=String(r.content):Array.isArray(r?.children)&&r.children[0]?.content?s=String(r.children[0].content):Array.isArray(e.children)&&e.children[0]?.content?s=String(e.children[0].content):e.content!=null&&String(e.content).length>0&&(s=String(e.content));let c=n.find(e=>e[0]===`title`)?.[1]??null,l=c===null?null:String(c),u=String(e.content??``);return{type:`image`,src:i,alt:s,title:l,raw:u,loading:t}}function EV(e){let t=String(e.content??``);return{type:`inline_code`,code:t,raw:t}}function DV(e,t,n){let r=[],i=``,a=t+1,o=[];for(;a=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function AV(e,t,n){let r=e.slice();return kV(r,`href`)||r.push([`href`,t]),n!=null&&!kV(r,`title`)&&r.push([`title`,n]),r}function jV(e,t,n){let r=e[t],i=OV(r.attrs),a=String(kV(i,`href`)??``),o=kV(i,`title`),s=o==null?null:String(o),c=AV(i,a,s),l=t+1,u=[],d=!0;for(;le.type===`strong_open`)){let e=String(p.content??``),t=String(p.raw??e),n=GB(p);n.content=e.slice(0,-2),n.raw=t.replace(/\*\*$/,``),f=u.slice(),f[f.length-1]=n}let m=LH(f,void 0,void 0,n),h=m.map(e=>{let t=e;return`content`in e?String(t.content??``):String(t.raw??``)}).join(``);return{node:{type:`link`,href:a,title:s,text:h,children:m,raw:String(`[${h}](${a}${s?` "${s}"`:``})`),loading:d,attrs:c},nextIndex:l0?r:[{type:`text`,content:c,raw:c}],raw:`~${c}~`},nextIndex:a0?r:[{type:`text`,content:i||String(e[t].content??``),raw:i||String(e[t].content??``)}],raw:`^${i||String(e[t].content??``)}^`},nextIndex:a?@[\\\]^_`{|}~]/,JV=/\p{P}/u,YV=/^[《「『【〔〖〘〚〈([{“‘﹁﹃﹙﹛﹝]$/u,XV=/^[》」』】〕〗〙〛〉)]}”’﹂﹄﹚﹜﹞]$/u,ZV=/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,QV=/:\/\//,$V=1,eH=2,tH=4,nH=8,rH=16,iH=32,aH=64,oH=128,sH=256,cH=512,lH=1024,uH=1982;function dH(e){let t=0;for(let n=0;n=t){n++,r++;continue}n++,r++;continue}if(i===`*`&&n>=t)return n;n++}return-1}function mH(e){return!!e&&KV.test(e)}function hH(e){return!!e&&(qV.test(e)||JV.test(e))}function gH(e,t){return!!e&&!!t&&/^\p{Script=Han}$/u.test(t)&&YV.test(e)}function _H(e,t){return!!e&&!!t&&/^[\p{L}\p{N}]$/u.test(t)&&XV.test(e)}function vH(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!r||mH(r)?!1:!(hH(r)&&!gH(r,n)&&n&&!mH(n)&&!hH(n))}function yH(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!n||mH(n)?!1:!(hH(n)&&!_H(n,r)&&r&&!mH(r)&&!hH(r))}function bH(e,t,n=0){let r=n,i=!1;for(;r0?e[t-1]:void 0,r=e[t+2];return!r||mH(r)?!1:!(hH(r)&&!gH(r,n)&&n&&!mH(n)&&!hH(n))}function SH(e,t){let n=t>0?e[t-1]:void 0,r=e[t+2];return!n||mH(n)?!1:!(hH(n)&&!_H(n,r)&&r&&!mH(r)&&!hH(r))}function CH(e,t=0){let n=t,r=!1;for(;n=0&&e[t]===`\\`;t--)i++;return i%2==1}var DH=/[\p{L}\p{N}]/u,OH=/^[\p{L}\p{N}]+$/u;function kH(e){return e?DH.test(e):!1}function AH(e){return e?OH.test(e):!1}function jH(e,t){let n=t;for(;n0?e[t-1]:void 0,i=n=2&&r.intraword&&t.push({start:n,end:i}),n=i}for(let n=0;n=3)return t;n=t+r.len}return-1}function FH(e){return e?ZV.test(e)||QV.test(e):!1}function IH(e,t){if(!e||!t)return null;let n=e.match(/\[([^\]\n]+)\]\(([^)]*)$/);return n&&n[2]===t?n[1]:null}function LH(e,t,n,r){if(!e||e.length===0)return[];let i=r?.__linkifyDemotionContext,a=IR(t),o={filename:i?.filename||a.filename,explicitFilename:i?.explicitFilename||a.explicitFilename,marketTicker:i?.marketTicker||a.marketTicker};(o.filename||o.explicitFilename||o.marketTicker)&&(r={...r,__linkifyDemotionContext:o});let s=r,c=[],l=null,u=0,d=r?.requireClosingStrong,f=e;function p(){return e===f&&(e=e.slice()),e}function m(){l=null}function h(n,i){let a=e.length===1?t:String(i.content??``),o=[],s=MH(n);if(s!==-1){x(n.slice(0,s),n.slice(0,s));let e=n.slice(s);return e&&(D({type:`text`,content:e,raw:e}),u--),u++,!0}if(VV.test(n)){let e=n.indexOf(`~~`);e!==-1&&o.push({type:`strikethrough`,index:e})}if(HV.test(n)){let e=n.indexOf(`**`);e!==-1&&o.push({type:`strong`,index:e})}if(/[^*]*\*[^*]+/.test(n)){let e=a?pH(a,0):n.indexOf(`*`);if(a&&e===-1)return!1;e!==-1&&o.push({type:`emphasis`,index:e})}o.sort((e,t)=>e.index===t.index?e.type===t.type?0:e.type===`strong`?-1:+(t.type===`strong`):e.index-t.index);let c=o[0];if(!c)return!1;if(c.type===`strikethrough`){let e=c.index,t=e>-1?n.slice(0,e):``;if(t&&x(t,t),e===-1)return u++,!0;let i=n.indexOf(`~~`,e+2),a=i===-1?n.slice(e+2):n.slice(e+2,i),o=i===-1?``:n.slice(i+2),{node:s}=PV([{type:`s_open`,tag:`s`,content:``,markup:`~~`,info:``,meta:null},{type:`text`,tag:``,content:a,markup:``,info:``,meta:null},{type:`s_close`,tag:`s`,content:``,markup:`~~`,info:``,meta:null}],0,r);return m(),b(s),o&&(D({type:`text`,content:o,raw:o}),u--),u++,!0}if(c.type===`strong`){let e=c.index,i=e>-1?n.slice(0,e):``;if(i&&x(i,i),e===-1)return u++,!0;if(t&&e===0){let e=!1,r=0;for(;r=2)return x(n,n),u++,!0}}if(t&&(n.match(/\*/g)||[]).length>fH(t))return x(n.slice(i.length),n.slice(i.length)),u++,!0;let a=jH(n,e);if(a.len>=3){let i=PH(n,e+a.len);if(i!==-1){let o=n.slice(e+a.len,i);if(NH(o)){let{node:e}=LV([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:o,markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,t,r);m(),b(e);let a=n.slice(i+3);return a&&(D({type:`text`,content:a,raw:a}),u--),u++,!0}}}if(!xH(n,e)){let t=n.slice(e,e+a.len);x(t,t);let r=n.slice(e+a.len);return r&&(D({type:`text`,content:r,raw:r}),u--),u++,!0}let o=CH(n,e+2),s=``,l=``;if(o.index!==-1){s=n.slice(e+2,o.index),l=n.slice(o.index+2);let t=o.index,r=jH(n,t);if(a.intraword&&r.intraword&&!AH(s)||!s&&a.len>=4&&a.intraword)return x(n.slice(i.length),n.slice(i.length)),u++,!0}else{if(d||o.sawInvalidClose||a.intraword)return x(n.slice(i.length),n.slice(i.length)),u++,!0;s=n.slice(e+2),l=``}if(!s&&/^\*+$/.test(l))return x(n,n),u++,!0;let{node:f}=LV([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`text`,tag:``,content:s,markup:``,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,t,r);return m(),b(f),l&&(D({type:`text`,content:l,raw:l}),u--),u++,!0}if(c.type===`emphasis`){let t=c.index;t===-1&&(t=0);let i=n.slice(0,t);if(i&&x(i,i),!vH(n,t)){x(n[t],n[t]);let e=n.slice(t+1);return e&&(D({type:`text`,content:e,raw:e}),u--),u++,!0}let o=jH(n,t),s=bH(a,n,t+1),l=s.index,d=e[u+1];if(r?.final&&d?.type===`em_open`&&l!==-1&&n.slice(t+1,l).trim()!==n.slice(t+1,l)||l===-1&&(s.sawInvalidClose||r?.final||o.intraword||!kH(n[t+1])))return x(n.slice(t),n.slice(t)),u++,!0;let{node:f}=YB([{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:l>-1?n.slice(t+1,l):n.slice(t+1),markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null}],0,r);if(m(),b(f),l!==-1&&l{for(let t=0;t=0&&e[r]===`\\`;r--)n++;if(n%2==0)return t}return-1})(t);if(r===-1)return!1;let i=1;for(let e=r+1;ee?.type===`math_inline`)||!UV.test(t))return null;let a=i.parseInline(t,{__markstreamFinal:!!r?.final});if(!Array.isArray(a)||a.length===0)return null;let o=(a.find(e=>e?.type===`inline`)?.children??[]).filter(e=>!(e?.type===`text`&&String(e.content??``)===``));if(!o.length||!o.some(e=>e?.type!==`text`)||o.length===1&&o[0]?.type===`text`&&String(o[0].content??``)===t)return null;let c=LH(o,t,n,r);return c.length?c:null}function v(e){m(),c.push(e)}function y(e){m();let t=GB(e);c.push(t)}function b(e){v(e)}function x(e,t){l?(l.content+=e,l.raw+=t??e):(l={type:`text`,content:String(e??``),raw:String(t??e??``)},c.push(l))}function S(e,t){if(!e)return;let i=LH([{...t,type:`text`,content:e,raw:e}],e,n,r);if(i.length===1&&i[0]?.type===`text`){let e=i[0];x(String(e.content??``),String(e.raw??e.content??``));return}for(let e of i)b(e)}function C(e,t){return String(e.markup??``).startsWith(t)}function w(t){if(!l||t.loading!==!0||t.markup!==`\\(\\)`)return;let n=e[u-1];!n||n.type!==`text`||!C(n,`\\(`)||l.content.endsWith(`(`)&&(l.content=l.content.slice(0,-1),l.raw.endsWith(`(`)&&(l.raw=l.raw.slice(0,-1)),!l.content&&c[c.length-1]===l&&(c.pop(),l=null))}function T(t){return t.endsWith(`](`)?e[u+1]?.type===`link_open`&&e[u+1]?.markup===`linkify`&&e[u+2]?.type===`text`&&e[u+3]?.type===`link_close`&&e[u+4]?.type===`text`&&String(e[u+4]?.content??``).startsWith(`)`):!1}function E(e,t,n=dH(e)){let r=e,i=String(t.content??``);return(n&$V)!==0&&r.endsWith(`\\`)&&!C(t,`\\\\`)&&!i.endsWith(`\\\\`)&&(r=r.slice(0,-1)),(n&lH)!==0&&r.endsWith(`(`)&&!C(t,`\\(`)&&!i.endsWith(`\\(`)&&(r=r.slice(0,-1)),(n&eH)!==0&&/\*+$/.test(r)&&!C(t,`\\*`)&&!i.endsWith(`\\*`)&&(r=r.replace(/\*+$/,``)),r}for(;u{let e=a,t=e.indexOf(` `);return t===-1?``:String(e.slice(t+1)??``)})():a,c=String(e.content??``);if(tV.test(c)&&(c=c.replace(tV,``)),o){let{original:e,updated:n}=sV(c,i===!0);return{type:`code_block`,language:s,code:String(n??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1?!0:!t,originalCode:e,updatedCode:n}}return{type:`code_block`,language:s,code:String(c??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1?!0:!t}}function lV(e){let t=e.meta??{};return{type:`footnote_reference`,id:String(t.label??``),raw:`[^${String(t.label??``)}]`}}function uV(){return{type:`hardbreak`,raw:`\\ +`}}function dV(e,t,n){let r=[],i=``,a=t+1,o=[];for(;a\s*$/.test(t)||HI.has(e)}function vV(e){if(!e||e.length===0)return mV();let t=pV.get(e);if(t)return t;let n=e.map(xL).filter(Boolean);if(!n.length){let t=mV();return pV.set(e,t),t}let r={customTagSet:new Set(n),allowedTagSet:iG({customHtmlTags:e})};return pV.set(e,r),r}function yV(e){let t=e,n=t.raw??t.content??t.markup??``;return String(n??``)}function bV(e){let t=e.meta,n=t?.markstreamCustomHtmlRaw,r=t?.markstreamCustomHtmlInner;return typeof n==`string`&&typeof r==`string`?{raw:n,inner:r}:null}function xV(e,t){let n=t.toLowerCase();for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function SV(e,t,n){let r=e.slice();return xV(r,`href`)||r.push([`href`,t]),n!=null&&!xV(r,`title`)&&r.push([`title`,n]),r}function CV(e){return e.map(yV).join(``)}function wV(e){let t=[],n=e=>{let n=String(e??``);if(!n)return;let r=t[t.length-1];if(r?.type===`text`){r.content=`${r.content}${n}`,r.raw=`${r.raw}${n}`;return}t.push({type:`text`,content:n,raw:n})};for(let r of e)if(r){if(r.type===`reference`||r.type===`footnote_reference`){n(String(r.raw??``));continue}if(`children`in r&&Array.isArray(r.children)){t.push({...r,children:wV(r.children)});continue}t.push(r)}return t}function TV(e,t,n){let r=0;for(let i=t;i`;h.toLowerCase().includes(e.toLowerCase())||(h+=e),_=!0,g=!0}let v=[],y=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,b;for(;(b=y.exec(s))!==null;){let e=b[1],t=b[2]||b[3]||b[4]||``;v.push([e,t])}if(l?.has(c)){let t=bV(e);return[{type:c,tag:c,attrs:v,content:t?t.inner:p.innerTokens.length?CV(p.innerTokens):``,children:p.innerTokens.length?r(p.innerTokens,i,a,o):[],raw:t?.raw??h,loading:e.loading||g,autoClosed:_},p.nextIndex]}return[{type:`html_inline`,tag:c,attrs:v,content:h,children:m,raw:h,loading:g,autoClosed:_},p.nextIndex]}function OV(e){if(e.type===`math_inline`){if(e.raw)return String(e.raw);let t=e.markup===`$$`?`$$`:`$`;return`${t}${String(e.content??``)}${t}`}return Array.isArray(e.children)&&e.children.length>0?e.children.map(e=>OV(e)).join(``):String(e.content??``)}function kV(e){return!e||!Array.isArray(e.children)||e.children.length===0?``:e.children.map(e=>OV(e)).join(``)}function AV(e,t=!1){let n=e.attrs??[],r=null;if((!n||n.length===0)&&Array.isArray(e.children))for(let t of e.children){let e=t.attrs;if(Array.isArray(e)&&e.length>0){n=e,r=t;break}}let i=String(n.find(e=>e[0]===`src`)?.[1]??``),a=n.find(e=>e[0]===`alt`)?.[1],o=kV(r??e),s=``;o?s=o:a!=null&&String(a).length>0?s=String(a):r?.content!=null&&String(r.content).length>0?s=String(r.content):Array.isArray(r?.children)&&r.children[0]?.content?s=String(r.children[0].content):Array.isArray(e.children)&&e.children[0]?.content?s=String(e.children[0].content):e.content!=null&&String(e.content).length>0&&(s=String(e.content));let c=n.find(e=>e[0]===`title`)?.[1]??null,l=c===null?null:String(c),u=String(e.content??``);return{type:`image`,src:i,alt:s,title:l,raw:u,loading:t}}function jV(e){let t=String(e.content??``);return{type:`inline_code`,code:t,raw:t}}function MV(e,t,n){let r=[],i=``,a=t+1,o=[];for(;a=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function FV(e,t,n){let r=e.slice();return PV(r,`href`)||r.push([`href`,t]),n!=null&&!PV(r,`title`)&&r.push([`title`,n]),r}function IV(e,t,n){let r=e[t],i=NV(r.attrs),a=String(PV(i,`href`)??``),o=PV(i,`title`),s=o==null?null:String(o),c=FV(i,a,s),l=t+1,u=[],d=!0;for(;le.type===`strong_open`)){let e=String(p.content??``),t=String(p.raw??e),n=XB(p);n.content=e.slice(0,-2),n.raw=t.replace(/\*\*$/,``),f=u.slice(),f[f.length-1]=n}let m=HH(f,void 0,void 0,n),h=m.map(e=>{let t=e;return`content`in e?String(t.content??``):String(t.raw??``)}).join(``);return{node:{type:`link`,href:a,title:s,text:h,children:m,raw:String(`[${h}](${a}${s?` "${s}"`:``})`),loading:d,attrs:c},nextIndex:l0?r:[{type:`text`,content:c,raw:c}],raw:`~${c}~`},nextIndex:a0?r:[{type:`text`,content:i||String(e[t].content??``),raw:i||String(e[t].content??``)}],raw:`^${i||String(e[t].content??``)}^`},nextIndex:a?@[\\\]^_`{|}~]/,$V=/\p{P}/u,eH=/^[《「『【〔〖〘〚〈([{“‘﹁﹃﹙﹛﹝]$/u,tH=/^[》」』】〕〗〙〛〉)]}”’﹂﹄﹚﹜﹞]$/u,nH=/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,rH=/:\/\//,iH=1,aH=2,oH=4,sH=8,cH=16,lH=32,uH=64,dH=128,fH=256,pH=512,mH=1024,hH=1982;function gH(e){let t=0;for(let n=0;n=t){n++,r++;continue}n++,r++;continue}if(i===`*`&&n>=t)return n;n++}return-1}function yH(e){return!!e&&ZV.test(e)}function bH(e){return!!e&&(QV.test(e)||$V.test(e))}function xH(e,t){return!!e&&!!t&&/^\p{Script=Han}$/u.test(t)&&eH.test(e)}function SH(e,t){return!!e&&!!t&&/^[\p{L}\p{N}]$/u.test(t)&&tH.test(e)}function CH(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!r||yH(r)?!1:!(bH(r)&&!xH(r,n)&&n&&!yH(n)&&!bH(n))}function wH(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!n||yH(n)?!1:!(bH(n)&&!SH(n,r)&&r&&!yH(r)&&!bH(r))}function TH(e,t,n=0){let r=n,i=!1;for(;r0?e[t-1]:void 0,r=e[t+2];return!r||yH(r)?!1:!(bH(r)&&!xH(r,n)&&n&&!yH(n)&&!bH(n))}function DH(e,t){let n=t>0?e[t-1]:void 0,r=e[t+2];return!n||yH(n)?!1:!(bH(n)&&!SH(n,r)&&r&&!yH(r)&&!bH(r))}function OH(e,t=0){let n=t,r=!1;for(;n=0&&e[t]===`\\`;t--)i++;return i%2==1}var MH=/[\p{L}\p{N}]/u,NH=/^[\p{L}\p{N}]+$/u;function PH(e){return e?MH.test(e):!1}function FH(e){return e?NH.test(e):!1}function IH(e,t){let n=t;for(;n0?e[t-1]:void 0,i=n=2&&r.intraword&&t.push({start:n,end:i}),n=i}for(let n=0;n=3)return t;n=t+r.len}return-1}function BH(e){return e?nH.test(e)||rH.test(e):!1}function VH(e,t){if(!e||!t)return null;let n=e.match(/\[([^\]\n]+)\]\(([^)]*)$/);return n&&n[2]===t?n[1]:null}function HH(e,t,n,r){if(!e||e.length===0)return[];let i=r?.__linkifyDemotionContext,a=VR(t),o={filename:i?.filename||a.filename,explicitFilename:i?.explicitFilename||a.explicitFilename,marketTicker:i?.marketTicker||a.marketTicker};(o.filename||o.explicitFilename||o.marketTicker)&&(r={...r,__linkifyDemotionContext:o});let s=r,c=[],l=null,u=0,d=r?.requireClosingStrong,f=e;function p(){return e===f&&(e=e.slice()),e}function m(){l=null}function h(n,i){let a=e.length===1?t:String(i.content??``),o=[],s=LH(n);if(s!==-1){x(n.slice(0,s),n.slice(0,s));let e=n.slice(s);return e&&(D({type:`text`,content:e,raw:e}),u--),u++,!0}if(KV.test(n)){let e=n.indexOf(`~~`);e!==-1&&o.push({type:`strikethrough`,index:e})}if(qV.test(n)){let e=n.indexOf(`**`);e!==-1&&o.push({type:`strong`,index:e})}if(/[^*]*\*[^*]+/.test(n)){let e=a?vH(a,0):n.indexOf(`*`);if(a&&e===-1)return!1;e!==-1&&o.push({type:`emphasis`,index:e})}o.sort((e,t)=>e.index===t.index?e.type===t.type?0:e.type===`strong`?-1:+(t.type===`strong`):e.index-t.index);let c=o[0];if(!c)return!1;if(c.type===`strikethrough`){let e=c.index,t=e>-1?n.slice(0,e):``;if(t&&x(t,t),e===-1)return u++,!0;let i=n.indexOf(`~~`,e+2),a=i===-1?n.slice(e+2):n.slice(e+2,i),o=i===-1?``:n.slice(i+2),{node:s}=zV([{type:`s_open`,tag:`s`,content:``,markup:`~~`,info:``,meta:null},{type:`text`,tag:``,content:a,markup:``,info:``,meta:null},{type:`s_close`,tag:`s`,content:``,markup:`~~`,info:``,meta:null}],0,r);return m(),b(s),o&&(D({type:`text`,content:o,raw:o}),u--),u++,!0}if(c.type===`strong`){let e=c.index,i=e>-1?n.slice(0,e):``;if(i&&x(i,i),e===-1)return u++,!0;if(t&&e===0){let e=!1,r=0;for(;r=2)return x(n,n),u++,!0}}if(t&&(n.match(/\*/g)||[]).length>_H(t))return x(n.slice(i.length),n.slice(i.length)),u++,!0;let a=IH(n,e);if(a.len>=3){let i=zH(n,e+a.len);if(i!==-1){let o=n.slice(e+a.len,i);if(RH(o)){let{node:e}=HV([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:o,markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,t,r);m(),b(e);let a=n.slice(i+3);return a&&(D({type:`text`,content:a,raw:a}),u--),u++,!0}}}if(!EH(n,e)){let t=n.slice(e,e+a.len);x(t,t);let r=n.slice(e+a.len);return r&&(D({type:`text`,content:r,raw:r}),u--),u++,!0}let o=OH(n,e+2),s=``,l=``;if(o.index!==-1){s=n.slice(e+2,o.index),l=n.slice(o.index+2);let t=o.index,r=IH(n,t);if(a.intraword&&r.intraword&&!FH(s)||!s&&a.len>=4&&a.intraword)return x(n.slice(i.length),n.slice(i.length)),u++,!0}else{if(d||o.sawInvalidClose||a.intraword)return x(n.slice(i.length),n.slice(i.length)),u++,!0;s=n.slice(e+2),l=``}if(!s&&/^\*+$/.test(l))return x(n,n),u++,!0;let{node:f}=HV([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`text`,tag:``,content:s,markup:``,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,t,r);return m(),b(f),l&&(D({type:`text`,content:l,raw:l}),u--),u++,!0}if(c.type===`emphasis`){let t=c.index;t===-1&&(t=0);let i=n.slice(0,t);if(i&&x(i,i),!CH(n,t)){x(n[t],n[t]);let e=n.slice(t+1);return e&&(D({type:`text`,content:e,raw:e}),u--),u++,!0}let o=IH(n,t),s=TH(a,n,t+1),l=s.index,d=e[u+1];if(r?.final&&d?.type===`em_open`&&l!==-1&&n.slice(t+1,l).trim()!==n.slice(t+1,l)||l===-1&&(s.sawInvalidClose||r?.final||o.intraword||!PH(n[t+1])))return x(n.slice(t),n.slice(t)),u++,!0;let{node:f}=eV([{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:l>-1?n.slice(t+1,l):n.slice(t+1),markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null}],0,r);if(m(),b(f),l!==-1&&l{for(let t=0;t=0&&e[r]===`\\`;r--)n++;if(n%2==0)return t}return-1})(t);if(r===-1)return!1;let i=1;for(let e=r+1;ee?.type===`math_inline`)||!JV.test(t))return null;let a=i.parseInline(t,{__markstreamFinal:!!r?.final});if(!Array.isArray(a)||a.length===0)return null;let o=(a.find(e=>e?.type===`inline`)?.children??[]).filter(e=>!(e?.type===`text`&&String(e.content??``)===``));if(!o.length||!o.some(e=>e?.type!==`text`)||o.length===1&&o[0]?.type===`text`&&String(o[0].content??``)===t)return null;let c=HH(o,t,n,r);return c.length?c:null}function v(e){m(),c.push(e)}function y(e){m();let t=XB(e);c.push(t)}function b(e){v(e)}function x(e,t){l?(l.content+=e,l.raw+=t??e):(l={type:`text`,content:String(e??``),raw:String(t??e??``)},c.push(l))}function S(e,t){if(!e)return;let i=HH([{...t,type:`text`,content:e,raw:e}],e,n,r);if(i.length===1&&i[0]?.type===`text`){let e=i[0];x(String(e.content??``),String(e.raw??e.content??``));return}for(let e of i)b(e)}function C(e,t){return String(e.markup??``).startsWith(t)}function w(t){if(!l||t.loading!==!0||t.markup!==`\\(\\)`)return;let n=e[u-1];!n||n.type!==`text`||!C(n,`\\(`)||l.content.endsWith(`(`)&&(l.content=l.content.slice(0,-1),l.raw.endsWith(`(`)&&(l.raw=l.raw.slice(0,-1)),!l.content&&c[c.length-1]===l&&(c.pop(),l=null))}function T(t){return t.endsWith(`](`)?e[u+1]?.type===`link_open`&&e[u+1]?.markup===`linkify`&&e[u+2]?.type===`text`&&e[u+3]?.type===`link_close`&&e[u+4]?.type===`text`&&String(e[u+4]?.content??``).startsWith(`)`):!1}function E(e,t,n=gH(e)){let r=e,i=String(t.content??``);return(n&iH)!==0&&r.endsWith(`\\`)&&!C(t,`\\\\`)&&!i.endsWith(`\\\\`)&&(r=r.slice(0,-1)),(n&mH)!==0&&r.endsWith(`(`)&&!C(t,`\\(`)&&!i.endsWith(`\\(`)&&(r=r.slice(0,-1)),(n&aH)!==0&&/\*+$/.test(r)&&!C(t,`\\*`)&&!i.endsWith(`\\*`)&&(r=r.replace(/\*+$/,``)),r}for(;u=0;e--){let t=c[e];if(t.type!==`text`)break;p=e,v=String(t.content??``)+v}pe===`href`)?.[1],d=String(l??``);if(t&&d){let e=t.indexOf(`](`);if(e!==-1){let n=t.indexOf(`)`,e+2);n===-1?i.loading=!0:i.loading&&t.slice(e+2,n).includes(d)&&(i.loading=!1)}}N(i)||v(i)}function j(t){if(t.markup!==`linkify`)return!1;let{node:n,nextIndex:i}=jV(e,u,r);return P(n,i)?(u=i,!0):!1}function M(e){m(),b(NV(e)),u++}function N(e){if(e.type!==`link`)return!1;let t=c[c.length-1];if(!t||t.type!==`text`)return!1;let n=String(t.content??``).match(/^([^[]*)\[([^\]\n]+)\]\($/);if(!n)return!1;let r=e,i=String(r.href??``),a=String(r.text??``),o=String(n[2]??``),s=i.replace(/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,``);if(!i||!(a===i||a===s||FH(a)))return!1;let l=String(n[1]??``);return l?(t.content=l,t.raw=l):c.pop(),v({...e,text:o,children:[{type:`text`,content:o,raw:o}],raw:String(`[${o}](${i}${r.title?` "${r.title}"`:``})`)}),!0}function ee(e){if(e.type!==`link`)return!1;let t=e,n=String(t.href??``);return n?P({href:n,title:t.title==null||t.title===``?null:String(t.title),loading:!!t.loading},u+1):!1}function P(t,n){let r=c[c.length-1];if(r?.type!==`image`||r.src||!r.loading||!String(r.raw??``).endsWith(`](`))return!1;let i=e[n],a=String(i?.content??``);if(i?.type!==`text`||!a.startsWith(`)`))return!1;c.pop(),l=null;let o=String(r.alt??``);v({type:`image`,src:t.href,alt:o,title:t.title,raw:String(`![${o}](${t.href}${t.title?` "${t.title}"`:``})`),loading:!!t.loading});let s=a.slice(1),u=GB(i);return u.content=s,u.raw=s,p()[n]=u,!0}function F(t){if(t.type!==`link`)return!1;let n=c[c.length-1],r=e[u-1];if(!n||n.type!==`text`||r?.type!==`text`)return!1;let i=String(n.content??``),a=String(r.content??``);if(!i.endsWith(`!`)||!a.endsWith(`!`)||C(r,`\\!`))return!1;let o=i.slice(0,-1);o?(n.content=o,n.raw=o,l=n):(c.pop(),l=null);let s=t,d=String(s.text??s.children?.map(e=>String(e?.content??e?.raw??``)).join(``)??``),f=String(s.href??``),p=s.title==null||s.title===``?null:String(s.title);return v({type:`image`,src:f,alt:d,title:p,raw:String(`![${d}](${f}${p?` "${p}"`:``})`),loading:!!s.loading}),!0}function I(e,t=``,n=null){let r=String(e.alt??e.raw??``);return{type:`link`,href:t,title:n,text:r,children:[e],raw:String(`[${r}](${t}${n?` "${n}"`:``})`),loading:!0}}function te(e){let t=e.startsWith(`![`)?e:`![${e}`,n=t.slice(2),r=n.indexOf(`](`);return{type:`image`,src:``,alt:r===-1?n.replace(/\]$/,``):n.slice(0,r),title:null,raw:t,loading:!0}}function ne(n){let r=n.indexOf(`[![`);if(r===-1||typeof t==`string`&&e.length===1&&EH(t,r,`[`))return!1;let i=n.slice(0,r);return i&&x(i,i),v(I(te(n.slice(r+1)))),u++,!0}function re(t){if(r?.final)return!1;let n=e[u-1];if(n?.type!==`text`||!String(n.content??``).endsWith(`[`)||C(n,`\\[`))return!1;let i=c[c.length-1];if(i?.type===`text`&&i.content.endsWith(`[`)){let e=i.content.slice(0,-1);e?(i.content=e,i.raw=e,l=i):(c.pop(),l=null)}return v(I(TV(t))),u++,!0}function ie(e){if(e.type!==`link`)return!1;let t=e,n=String(t.raw??``),r=String(t.text??``);if(!n.startsWith(`[![`)&&!r.startsWith(`![`))return!1;let i=t.title==null||t.title===``?null:String(t.title);return v(I({type:`image`,src:String(t.href??``),alt:r.replace(/^!\[/,``).replace(/\]$/,``),title:i,raw:n.startsWith(`[![`)?n.slice(1):n,loading:!0})),!0}function ae(t){if(!t.startsWith(`](`))return!1;let n=e[u-2];if(n?.type===`text`&&String(n.content??``).endsWith(`[`)&&C(n,`\\[`))return!1;let i=c[c.length-1];if(i?.type!==`image`&&i?.type!==`link`)return!1;let a=i,o=i?.type===`link`&&Array.isArray(a.children)&&a.children.length===1&&a.children[0]?.type===`image`?c.pop():null,s=o?o.children[0]:c.pop();if(!s||s.type!==`image`)return!1;let l=e[u+1],d=String(o?.href??``),f=o?.title==null?null:String(o.title),p=!0;if(l?.type===`link_open`){let{node:t,nextIndex:n}=jV(e,u+1,r);d=t.href,f=t.title,p=!0,u=n}else{if(d=t.slice(2),d.includes(`"`)){let e=d.split(`"`);d=String(e[0]??``).trim(),f=e[1]==null?null:String(e[1]).trim()}u++}let m=I(s,d,f);return m.loading=p,v(m),!0}function L(){let t=e[u-3];return e[u-2]?.type===`image`&&e[u-1]?.type===`text`&&String(e[u-1].content??``)===`](`&&t?.type===`text`&&String(t.content??``).endsWith(`[`)&&C(t,`\\[`)}function oe(t,n){let i=t.indexOf(`[`);if(i===-1)return!1;let a=t.slice(0,i),o=t.indexOf(`](`,i);if(o!==-1){let s=e[u+2],c=t.slice(i+1,o);if(c.includes(`[`)){let e=c.indexOf(`[`);a+=t.slice(0,i+e+1);let n=i+e+1;c=t.slice(n+1,o)}let l=e[u+1];if(t.endsWith(`](`)&&l?.type===`link_open`&&s){let t=e[u+4],i=4,o=!0;if(t?.type===`text`){let e=String(t.content??``);if(e.startsWith(`)`)){o=!1;let n=e.slice(1);if(n){let e=GB(t);e.content=n,e.raw=n,p()[u+4]=e}else i++}else e===`.`&&i++}S(a,n);let l=String(s.content??``);return r?.validateLink&&!r.validateLink(l)?x(c,c):v({type:`link`,href:l,title:null,text:c,children:[{type:`text`,content:c,raw:c}],loading:o}),u+=i,!0}let f=t.indexOf(`)`,o),m=f===-1?``:t.slice(o+2,f),h=f===-1,g=a.match(/\*+$/);if(g&&(a=a.replace(/\*+$/,``)),S(a,n),g||=c.match(/^\*+/),!d&&g){let e=g[0].length;c=c.replace(/^\*+/,``).replace(/\*+$/,``);let t=[];if(e===1?t.push({type:`em_open`,tag:`em`,nesting:1}):e===2?t.push({type:`strong_open`,tag:`strong`,nesting:1}):e===3&&(t.push({type:`strong_open`,tag:`strong`,nesting:1}),t.push({type:`em_open`,tag:`em`,nesting:1})),t.push({type:`link`,href:m,title:null,text:c,children:[{type:`text`,content:c,raw:c}],loading:h}),e===1){t.push({type:`em_close`,tag:`em`,nesting:-1});let{node:e}=YB(t,0,r);b(e)}else if(e===2){t.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:e}=LV(t,0,void 0,r);b(e)}else if(e===3){t.push({type:`em_close`,tag:`em`,nesting:-1}),t.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:e}=LV(t,0,void 0,r);b(e)}else{let{node:e}=YB(t,0,r);b(e)}}else r?.validateLink&&!r.validateLink(m)?x(c,c):v({type:`link`,href:m,title:null,text:c,children:[{type:`text`,content:c,raw:c}],loading:h});let _=f===-1?``:t.slice(f+1);return _&&(D({type:`text`,content:_,raw:_}),u--),u++,!0}return!1}function R(e){let t=e.indexOf(`![`);if(t===-1)return!1;let n=e.slice(0,t);return n&&!l?l={type:`text`,content:n,raw:n}:n&&l&&(l.content+=n),l&&=(c.push(l),null),v(te(e.slice(t))),u++,!0}function se(e){if(!(e?.startsWith(`[`)&&n?.type===`list_item_open`))return!1;let t=e.slice(1).match(/[^\s\]]/);if(t===null)return u++,!0;if(t&&/x/i.test(t[0])){let e=t[0]===`x`||t[0]===`X`;return v({type:`checkbox_input`,checked:e,raw:e?`[x]`:`[ ]`}),u++,!0}return!1}return c}function RH(e,t,n){let r=n?.__sourceLineMapper;if(!r)return{startLine:e,endLine:t};let i=r(e),a=t>e?r(t-1).endLine:r(t).startLine;return{startLine:i.startLine,endLine:Math.max(i.startLine,a)}}function zH(e,t){let n=Math.max(0,Math.min(e.length,Math.trunc(t))),r=0;for(let t=0;tr&&e[i-1]!==` -`&&o++,{startLine:a,endLine:o}}function VH(e,t,n,r){let i=BH(e,t,n);return RH(i.startLine,i.endLine,r)}function HH(e,t){let n=e?.map;if(!Array.isArray(n)||n.length<2)return null;let r=Number(n[0]),i=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(i)?null:RH(r,i,t)}function UH(e,t,n){if(!n?.includeSourceMap)return e;let r=HH(t,n);if(!r)return e;if(e.sourceMap=r,e.type===`code_block`){let t=e;t.startLine=r.startLine,t.endLine=r.endLine}return e}function WH(e,t,n,r){if(!r?.includeSourceMap)return e;let i=t?.map;if(!Array.isArray(i)||i.length<2)return e;let a=Number(i[0]),o=Number(i[1]),s=Number(n);return!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(s)||(e.sourceMap=RH(a,Math.max(o,s),r)),e}function GH(e){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)return;e.content=n;let r=e.children;if(!(!Array.isArray(r)||r.length===0))for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)break;if(n){e.content=n;break}r.pop();continue}break}}function KH(e){let t=String(e.content??``),n=t.match(/\r?\n\s*\d+[.)]?\s*$/);if(!n||typeof n.index!=`number`)return;e.content=t.slice(0,n.index);let r=e.children;if(!(!Array.isArray(r)||r.length===0))for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``);if(/^[ \t\r\n\d.)]*$/.test(t)){r.pop();continue}let n=t.replace(/[ \t\r\n\d.)]+$/g,``);n!==t&&(n?e.content=n:r.pop())}break}}function qH(e){let t=String(e.content??``);return/[ \t\r\n]+$/.test(t)||/\r?\n\s*\d+[.)]?\s*$/.test(t)}function JH(e,t,n){let r=e[t],i=[],a=OR(n,!0),o=t+1;for(;oe.raw).join(``)};n?.includeSourceMap&&UH(s,e[o],n),i.push(s),o=r+1}else o+=1;let s={type:`list`,ordered:r.type===`ordered_list_open`,start:(()=>{if(r.attrs&&r.attrs.length){let e=r.attrs.find(e=>e[0]===`start`);if(e){let t=Number(e[1]);return Number.isFinite(t)&&t!==0?t:1}}})(),items:i,raw:i.map(e=>e.raw).join(` -`)};return n?.includeSourceMap&&UH(s,r,n),[s,o+1]}function YH(e,t,n,r){let i=String(n[1]??`note`),a=String(n[2]??i.charAt(0).toUpperCase()+i.slice(1)),o=[],s=OR(r,!0),c=t+1;for(;ce.raw).join(` -`)}\n:::`},c+1]}var XH=new Set([`warning`,`info`,`note`,`tip`,`danger`,`caution`]);function ZH(e){let t=0;for(;t=0;e--){let t=r[e];if(t.type===`text`&&/:+/.test(t.content)){i=e;break}}let a={type:`paragraph`,children:LH((i===-1?r:r.slice(0,i))||[],void 0,void 0,c.options()),raw:String(t.content??``).replace(/\n:+$/,``).replace(/\n\s*:::\s*$/,``)};n?.includeSourceMap&&UH(a,e[l],n),s.push(a),c.remember(a.raw)}l+=3}else if(e[l].type===`bullet_list_open`||e[l].type===`ordered_list_open`){let[t,r]=JH(e,l,c.options());n?.includeSourceMap&&UH(t,e[l],n),s.push(t),c.remember(t.raw),l=r}else if(e[l].type===`blockquote_open`){let[t,r]=nU(e,l,c.options());n?.includeSourceMap&&UH(t,e[l],n),s.push(t),c.remember(t.raw),l=r}else{let t=OU(e,l,c.options());t?(s.push(t[0]),c.remember(t[0].raw),l=t[1]):l++}return[{type:`admonition`,kind:i,title:a,children:s,raw:`:::${i} ${a}\n${s.map(e=>e.raw).join(` -`)}\n:::`},l+1]}var $H=/^::: ?(warning|info|note|tip|danger|caution|error) ?(.*)$/;function eU(e,t,n){let r=e[t];if(r.type!==`container_open`)return null;let i=$H.exec(String(r.info??``));return i?YH(e,t,i,n):null}var tU={parseContainer:(e,t,n)=>QH(e,t,n),matchAdmonition:eU};function nU(e,t,n){let r=[],i=OR(n,!0),a=t+1;for(;ae.raw).join(` -`)};return n?.includeSourceMap&&UH(o,e[t],n),[o,a+1]}function rU(e){if(e.info?.startsWith(`diff`))return rV(e);let t=String(e.content??``),n=t.match(/ type="application\/vnd\.ant\.([^"]+)"/),r=t;n?.[1]&&(r=t.replace(/]*>/g,``).replace(/<\/antArtifact>/g,``));let i=Array.isArray(e.map)&&e.map.length===2;return{type:`code_block`,language:n?n[1]:String(e.info??``),code:r,raw:r,loading:!i}}function iU(e,t,n){let r=[],i=t+1,a=[],o=[],s=OR(n,!0);for(;ie.raw).join(``)),i+=3}else if(e[i].type===`dd_open`){let t=i+1;for(o=[];t0&&(r.push({type:`definition_item`,term:a,definition:o,raw:`${a.map(e=>e.raw).join(``)}: ${o.map(e=>e.raw).join(` +`},c.push(l)),u++;break;case`code_inline`:b(jV(i)),u++;break;case`html_inline`:{let[a,o]=DV(i,e,u,HH,t,n,r);b(a),u=o;break}case`link_open`:A(i);break;case`image`:re(i)||(m(),b(AV(i)),u++);break;case`strong_open`:{m();let{node:t,nextIndex:n}=HV(e,u,i.content,r);b(t),u=n;break}case`em_open`:{m();let{node:t,nextIndex:n}=eV(e,u,r);b(t),u=n;break}case`s_open`:{m();let{node:t,nextIndex:n}=zV(e,u,r);b(t),u=n;break}case`mark_open`:{m();let{node:t,nextIndex:n}=dV(e,u,r);b(t),u=n;break}case`ins_open`:{m();let{node:t,nextIndex:n}=MV(e,u,r);b(t),u=n;break}case`sub_open`:{m();let{node:t,nextIndex:n}=UV(e,u,r);b(t),u=n;break}case`sup_open`:{m();let{node:t,nextIndex:n}=WV(e,u,r);b(t),u=n;break}case`sub`:m(),b({type:`subscript`,children:[{type:`text`,content:String(i.content??``),raw:String(i.content??``)}],raw:`~${String(i.content??``)}~`}),u++;break;case`sup`:m(),b({type:`superscript`,children:[{type:`text`,content:String(i.content??``),raw:String(i.content??``)}],raw:`^${String(i.content??``)}^`}),u++;break;case`emoji`:{m();let t=e[u-1];t?.type===`text`&&/\|:-+/.test(String(t.content??``))?x(``,``):b($B(i)),u++;break}case`checkbox`:m(),b(ZB(i)),u++;break;case`checkbox_input`:m(),b(QB(i)),u++;break;case`footnote_ref`:m(),b(lV(i)),u++;break;case`footnote_anchor`:{m();let e=i.meta??{};v({type:`footnote_anchor`,id:String(e.label??i.content??``),raw:String(i.content??``)}),u++;break}case`hardbreak`:m(),b(uV()),u++;break;case`fence`:m(),b(cV(e[u])),u++;break;case`math_inline`:w(i),m(),!i.content&&i.markup===`$`&&e[u+1]?.type===`text`&&e[u+2]?.type===`math_inline`?(b(LV({...i,content:e[u+1].content})),u+=2):b(LV(i)),u++;break;case`reference`:M(i);break;case`text_special`:x(String(i.content??``),String(i.content??``)),u++;break;default:{let e=i;if(i.type===`link`&&e.href!=null&&r?.validateLink&&!r.validateLink(String(e.href))){m();let t=String(e.text??``);x(t,t),u++}else ie(i)||ee(i)||F(i)||N(i)||y(i),u++;break}}}function O(t,n,r,i,a=gH(t)){let o=GV({...n,content:t});if(l){l.content+=E(o.content,n,a),l.raw+=o.raw;return}let s=r?.tag===`br`&&e[u-2]?.content===`[`;i||(o.content=E(o.content,n,a)),l=o,l.center=s,c.push(l)}function k(n){let r=String(n.content??``),i=gH(r),a=(i&iH)!==0,o=e.length===1&&a&&typeof t==`string`?String(t):``,s=o?kH(o):a?r.replace(YV,`$1`):r,d=s===r?i:gH(s);if(n.content===`<`||s===`1`&&e[u-1]?.tag===`br`){u++;return}let f=(d&fH)===0?-1:s.indexOf(`$`);f!==-1&&f===s.lastIndexOf(`$`)&&s.endsWith(`$`)&&(s=s.slice(0,-1)),s.endsWith(`undefined`)&&!t?.endsWith(`undefined`)&&(s=s.slice(0,-9));let p=c.length,v=``;for(let e=c.length-1;e>=0;e--){let t=c[e];if(t.type!==`text`)break;p=e,v=String(t.content??``)+v}pe===`href`)?.[1],d=String(l??``);if(t&&d){let e=t.indexOf(`](`);if(e!==-1){let n=t.indexOf(`)`,e+2);n===-1?i.loading=!0:i.loading&&t.slice(e+2,n).includes(d)&&(i.loading=!1)}}N(i)||v(i)}function j(t){if(t.markup!==`linkify`)return!1;let{node:n,nextIndex:i}=IV(e,u,r);return P(n,i)?(u=i,!0):!1}function M(e){m(),b(RV(e)),u++}function N(e){if(e.type!==`link`)return!1;let t=c[c.length-1];if(!t||t.type!==`text`)return!1;let n=String(t.content??``).match(/^([^[]*)\[([^\]\n]+)\]\($/);if(!n)return!1;let r=e,i=String(r.href??``),a=String(r.text??``),o=String(n[2]??``),s=i.replace(/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,``);if(!i||!(a===i||a===s||BH(a)))return!1;let l=String(n[1]??``);return l?(t.content=l,t.raw=l):c.pop(),v({...e,text:o,children:[{type:`text`,content:o,raw:o}],raw:String(`[${o}](${i}${r.title?` "${r.title}"`:``})`)}),!0}function ee(e){if(e.type!==`link`)return!1;let t=e,n=String(t.href??``);return n?P({href:n,title:t.title==null||t.title===``?null:String(t.title),loading:!!t.loading},u+1):!1}function P(t,n){let r=c[c.length-1];if(r?.type!==`image`||r.src||!r.loading||!String(r.raw??``).endsWith(`](`))return!1;let i=e[n],a=String(i?.content??``);if(i?.type!==`text`||!a.startsWith(`)`))return!1;c.pop(),l=null;let o=String(r.alt??``);v({type:`image`,src:t.href,alt:o,title:t.title,raw:String(`![${o}](${t.href}${t.title?` "${t.title}"`:``})`),loading:!!t.loading});let s=a.slice(1),u=XB(i);return u.content=s,u.raw=s,p()[n]=u,!0}function F(t){if(t.type!==`link`)return!1;let n=c[c.length-1],r=e[u-1];if(!n||n.type!==`text`||r?.type!==`text`)return!1;let i=String(n.content??``),a=String(r.content??``);if(!i.endsWith(`!`)||!a.endsWith(`!`)||C(r,`\\!`))return!1;let o=i.slice(0,-1);o?(n.content=o,n.raw=o,l=n):(c.pop(),l=null);let s=t,d=String(s.text??s.children?.map(e=>String(e?.content??e?.raw??``)).join(``)??``),f=String(s.href??``),p=s.title==null||s.title===``?null:String(s.title);return v({type:`image`,src:f,alt:d,title:p,raw:String(`![${d}](${f}${p?` "${p}"`:``})`),loading:!!s.loading}),!0}function I(e,t=``,n=null){let r=String(e.alt??e.raw??``);return{type:`link`,href:t,title:n,text:r,children:[e],raw:String(`[${r}](${t}${n?` "${n}"`:``})`),loading:!0}}function te(e){let t=e.startsWith(`![`)?e:`![${e}`,n=t.slice(2),r=n.indexOf(`](`);return{type:`image`,src:``,alt:r===-1?n.replace(/\]$/,``):n.slice(0,r),title:null,raw:t,loading:!0}}function ne(n){let r=n.indexOf(`[![`);if(r===-1||typeof t==`string`&&e.length===1&&jH(t,r,`[`))return!1;let i=n.slice(0,r);return i&&x(i,i),v(I(te(n.slice(r+1)))),u++,!0}function re(t){if(r?.final)return!1;let n=e[u-1];if(n?.type!==`text`||!String(n.content??``).endsWith(`[`)||C(n,`\\[`))return!1;let i=c[c.length-1];if(i?.type===`text`&&i.content.endsWith(`[`)){let e=i.content.slice(0,-1);e?(i.content=e,i.raw=e,l=i):(c.pop(),l=null)}return v(I(AV(t))),u++,!0}function ie(e){if(e.type!==`link`)return!1;let t=e,n=String(t.raw??``),r=String(t.text??``);if(!n.startsWith(`[![`)&&!r.startsWith(`![`))return!1;let i=t.title==null||t.title===``?null:String(t.title);return v(I({type:`image`,src:String(t.href??``),alt:r.replace(/^!\[/,``).replace(/\]$/,``),title:i,raw:n.startsWith(`[![`)?n.slice(1):n,loading:!0})),!0}function ae(t){if(!t.startsWith(`](`))return!1;let n=e[u-2];if(n?.type===`text`&&String(n.content??``).endsWith(`[`)&&C(n,`\\[`))return!1;let i=c[c.length-1];if(i?.type!==`image`&&i?.type!==`link`)return!1;let a=i,o=i?.type===`link`&&Array.isArray(a.children)&&a.children.length===1&&a.children[0]?.type===`image`?c.pop():null,s=o?o.children[0]:c.pop();if(!s||s.type!==`image`)return!1;let l=e[u+1],d=String(o?.href??``),f=o?.title==null?null:String(o.title),p=!0;if(l?.type===`link_open`){let{node:t,nextIndex:n}=IV(e,u+1,r);d=t.href,f=t.title,p=!0,u=n}else{if(d=t.slice(2),d.includes(`"`)){let e=d.split(`"`);d=String(e[0]??``).trim(),f=e[1]==null?null:String(e[1]).trim()}u++}let m=I(s,d,f);return m.loading=p,v(m),!0}function L(){let t=e[u-3];return e[u-2]?.type===`image`&&e[u-1]?.type===`text`&&String(e[u-1].content??``)===`](`&&t?.type===`text`&&String(t.content??``).endsWith(`[`)&&C(t,`\\[`)}function oe(t,n){let i=t.indexOf(`[`);if(i===-1)return!1;let a=t.slice(0,i),o=t.indexOf(`](`,i);if(o!==-1){let s=e[u+2],c=t.slice(i+1,o);if(c.includes(`[`)){let e=c.indexOf(`[`);a+=t.slice(0,i+e+1);let n=i+e+1;c=t.slice(n+1,o)}let l=e[u+1];if(t.endsWith(`](`)&&l?.type===`link_open`&&s){let t=e[u+4],i=4,o=!0;if(t?.type===`text`){let e=String(t.content??``);if(e.startsWith(`)`)){o=!1;let n=e.slice(1);if(n){let e=XB(t);e.content=n,e.raw=n,p()[u+4]=e}else i++}else e===`.`&&i++}S(a,n);let l=String(s.content??``);return r?.validateLink&&!r.validateLink(l)?x(c,c):v({type:`link`,href:l,title:null,text:c,children:[{type:`text`,content:c,raw:c}],loading:o}),u+=i,!0}let f=t.indexOf(`)`,o),m=f===-1?``:t.slice(o+2,f),h=f===-1,g=a.match(/\*+$/);if(g&&(a=a.replace(/\*+$/,``)),S(a,n),g||=c.match(/^\*+/),!d&&g){let e=g[0].length;c=c.replace(/^\*+/,``).replace(/\*+$/,``);let t=[];if(e===1?t.push({type:`em_open`,tag:`em`,nesting:1}):e===2?t.push({type:`strong_open`,tag:`strong`,nesting:1}):e===3&&(t.push({type:`strong_open`,tag:`strong`,nesting:1}),t.push({type:`em_open`,tag:`em`,nesting:1})),t.push({type:`link`,href:m,title:null,text:c,children:[{type:`text`,content:c,raw:c}],loading:h}),e===1){t.push({type:`em_close`,tag:`em`,nesting:-1});let{node:e}=eV(t,0,r);b(e)}else if(e===2){t.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:e}=HV(t,0,void 0,r);b(e)}else if(e===3){t.push({type:`em_close`,tag:`em`,nesting:-1}),t.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:e}=HV(t,0,void 0,r);b(e)}else{let{node:e}=eV(t,0,r);b(e)}}else r?.validateLink&&!r.validateLink(m)?x(c,c):v({type:`link`,href:m,title:null,text:c,children:[{type:`text`,content:c,raw:c}],loading:h});let _=f===-1?``:t.slice(f+1);return _&&(D({type:`text`,content:_,raw:_}),u--),u++,!0}return!1}function R(e){let t=e.indexOf(`![`);if(t===-1)return!1;let n=e.slice(0,t);return n&&!l?l={type:`text`,content:n,raw:n}:n&&l&&(l.content+=n),l&&=(c.push(l),null),v(te(e.slice(t))),u++,!0}function se(e){if(!(e?.startsWith(`[`)&&n?.type===`list_item_open`))return!1;let t=e.slice(1).match(/[^\s\]]/);if(t===null)return u++,!0;if(t&&/x/i.test(t[0])){let e=t[0]===`x`||t[0]===`X`;return v({type:`checkbox_input`,checked:e,raw:e?`[x]`:`[ ]`}),u++,!0}return!1}return c}function UH(e,t,n){let r=n?.__sourceLineMapper;if(!r)return{startLine:e,endLine:t};let i=r(e),a=t>e?r(t-1).endLine:r(t).startLine;return{startLine:i.startLine,endLine:Math.max(i.startLine,a)}}function WH(e,t){let n=Math.max(0,Math.min(e.length,Math.trunc(t))),r=0;for(let t=0;tr&&e[i-1]!==` +`&&o++,{startLine:a,endLine:o}}function KH(e,t,n,r){let i=GH(e,t,n);return UH(i.startLine,i.endLine,r)}function qH(e,t){let n=e?.map;if(!Array.isArray(n)||n.length<2)return null;let r=Number(n[0]),i=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(i)?null:UH(r,i,t)}function JH(e,t,n){if(!n?.includeSourceMap)return e;let r=qH(t,n);if(!r)return e;if(e.sourceMap=r,e.type===`code_block`){let t=e;t.startLine=r.startLine,t.endLine=r.endLine}return e}function YH(e,t,n,r){if(!r?.includeSourceMap)return e;let i=t?.map;if(!Array.isArray(i)||i.length<2)return e;let a=Number(i[0]),o=Number(i[1]),s=Number(n);return!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(s)||(e.sourceMap=UH(a,Math.max(o,s),r)),e}function XH(e){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)return;e.content=n;let r=e.children;if(!(!Array.isArray(r)||r.length===0))for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)break;if(n){e.content=n;break}r.pop();continue}break}}function ZH(e){let t=String(e.content??``),n=t.match(/\r?\n\s*\d+[.)]?\s*$/);if(!n||typeof n.index!=`number`)return;e.content=t.slice(0,n.index);let r=e.children;if(!(!Array.isArray(r)||r.length===0))for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``);if(/^[ \t\r\n\d.)]*$/.test(t)){r.pop();continue}let n=t.replace(/[ \t\r\n\d.)]+$/g,``);n!==t&&(n?e.content=n:r.pop())}break}}function QH(e){let t=String(e.content??``);return/[ \t\r\n]+$/.test(t)||/\r?\n\s*\d+[.)]?\s*$/.test(t)}function $H(e,t,n){let r=e[t],i=[],a=NR(n,!0),o=t+1;for(;oe.raw).join(``)};n?.includeSourceMap&&JH(s,e[o],n),i.push(s),o=r+1}else o+=1;let s={type:`list`,ordered:r.type===`ordered_list_open`,start:(()=>{if(r.attrs&&r.attrs.length){let e=r.attrs.find(e=>e[0]===`start`);if(e){let t=Number(e[1]);return Number.isFinite(t)&&t!==0?t:1}}})(),items:i,raw:i.map(e=>e.raw).join(` +`)};return n?.includeSourceMap&&JH(s,r,n),[s,o+1]}function eU(e,t,n,r){let i=String(n[1]??`note`),a=String(n[2]??i.charAt(0).toUpperCase()+i.slice(1)),o=[],s=NR(r,!0),c=t+1;for(;ce.raw).join(` +`)}\n:::`},c+1]}var tU=new Set([`warning`,`info`,`note`,`tip`,`danger`,`caution`]);function nU(e){let t=0;for(;t=0;e--){let t=r[e];if(t.type===`text`&&/:+/.test(t.content)){i=e;break}}let a={type:`paragraph`,children:HH((i===-1?r:r.slice(0,i))||[],void 0,void 0,c.options()),raw:String(t.content??``).replace(/\n:+$/,``).replace(/\n\s*:::\s*$/,``)};n?.includeSourceMap&&JH(a,e[l],n),s.push(a),c.remember(a.raw)}l+=3}else if(e[l].type===`bullet_list_open`||e[l].type===`ordered_list_open`){let[t,r]=$H(e,l,c.options());n?.includeSourceMap&&JH(t,e[l],n),s.push(t),c.remember(t.raw),l=r}else if(e[l].type===`blockquote_open`){let[t,r]=sU(e,l,c.options());n?.includeSourceMap&&JH(t,e[l],n),s.push(t),c.remember(t.raw),l=r}else{let t=NU(e,l,c.options());t?(s.push(t[0]),c.remember(t[0].raw),l=t[1]):l++}return[{type:`admonition`,kind:i,title:a,children:s,raw:`:::${i} ${a}\n${s.map(e=>e.raw).join(` +`)}\n:::`},l+1]}var iU=/^::: ?(warning|info|note|tip|danger|caution|error) ?(.*)$/;function aU(e,t,n){let r=e[t];if(r.type!==`container_open`)return null;let i=iU.exec(String(r.info??``));return i?eU(e,t,i,n):null}var oU={parseContainer:(e,t,n)=>rU(e,t,n),matchAdmonition:aU};function sU(e,t,n){let r=[],i=NR(n,!0),a=t+1;for(;ae.raw).join(` +`)};return n?.includeSourceMap&&JH(o,e[t],n),[o,a+1]}function cU(e){if(e.info?.startsWith(`diff`))return cV(e);let t=String(e.content??``),n=t.match(/ type="application\/vnd\.ant\.([^"]+)"/),r=t;n?.[1]&&(r=t.replace(/]*>/g,``).replace(/<\/antArtifact>/g,``));let i=Array.isArray(e.map)&&e.map.length===2;return{type:`code_block`,language:n?n[1]:String(e.info??``),code:r,raw:r,loading:!i}}function lU(e,t,n){let r=[],i=t+1,a=[],o=[],s=NR(n,!0);for(;ie.raw).join(``)),i+=3}else if(e[i].type===`dd_open`){let t=i+1;for(o=[];t0&&(r.push({type:`definition_item`,term:a,definition:o,raw:`${a.map(e=>e.raw).join(``)}: ${o.map(e=>e.raw).join(` `)}`}),a=[]),i=t+1}else i++;return[{type:`definition_list`,items:r,raw:r.map(e=>e.raw).join(` -`)},i+1]}function aU(e,t,n){let r=e[t].meta??{},i=String(r?.label??`0`),a=[],o=OR(n,!0),s=t+1;for(;se.raw).join(` -`)}`},s+1]}function oU(e,t,n){let r=e[t],i=r.attrs,a=Array.isArray(i)&&i.length?Object.fromEntries(i.filter(e=>Array.isArray(e)&&e.length>=1&&e[0]).map(([e,t])=>[String(e),t==null||t===``?!0:String(t)])):void 0,o=String(r.tag?.substring(1)??`1`),s=Number.parseInt(o,10),c=e[t+1],l=String(c.content??``);return{type:`heading`,level:s,text:l,...a?{attrs:a}:{},children:LH(c.children||[],l,void 0,n),raw:l}}function sU(e,t,n){let r=t.toLowerCase(),i=new RegExp(String.raw`^<\s*${r}(?=\s|>|/)`,`i`),a=new RegExp(String.raw`^<\s*\/\s*${r}(?=\s|>)`,`i`),o=0,s=Math.max(0,n);for(;s$/.test(r)||o++,s=t+e+1;continue}s=t+1}return-1}function cU(e){let t=String(e.content??``);if(/^\s*`);else if(c)c=!e.includes(`>`);else if(l)l=!e.includes(`?>`);else if(e.startsWith(``);else if(e.startsWith(``);else if(e.startsWith(``);else{let t=i(e);if(t)if(t.closing){for(let e=o.length-1;e>=0;e--)if(o[e]===t.tag){o.length=e;break}}else t.selfClosing||a(t.after,t.tag)||o.push(t.tag)}}if(n===-1||n>=t)break;u=n+1}return s||c||l||o.length>0}function PW(e,t,n){if(!n?.length)return!1;let r=new Set(_L(n));if(!r.size)return!1;let i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>e===` `||e===` `,o=e=>{if(e[0]!==`<`)return null;let t=1;for(;t`&&c!==`/`)return null;let l=e.indexOf(`>`,t);if(l===-1)return null;let u=l-1;for(;u>=0&&a(e[u]);)u--;return{closing:n,tag:s,selfClosing:!n&&e[u]===`/`,after:e.slice(l+1)}},s=(e,t)=>{let n=e.toLowerCase(),r=0;for(;r`)return!0}}return!1},c=[],l=0;for(;l=t?t:n,i=e.slice(l,r),a=i.endsWith(`\r`)?i.slice(0,-1):i,u=DW(a);if(u){let e=o(a.slice(u.index));if(e)if(e.closing){for(let t=c.length-1;t>=0;t--)if(c[t]===e.tag){c.length=t;break}}else e.selfClosing||s(e.after,e.tag)||c.push(e.tag)}if(n===-1||n>=t)break;l=n+1}return c.length>0}function FW(e,t){let n=BU.exec(e);if(!n)return null;let r=n[1]??``,i=n.index+r.length,a=e.indexOf(` -`,i),o=e.slice(i,a===-1?e.length:a);return!DW(o.endsWith(`\r`)?o.slice(0,-1):o)||MW(e,i)||NW(e,i)||PW(e,i,t)?null:`${e.slice(0,n.index)}${r}`}function IW(e,t,n){let r=t;for(;rr&&(o=!0),t.inMath=!1,t.mathOpenOffset=null,a+=2;continue}a++;continue}if(t.inDollarMath){if(e.startsWith(`$$`,a)&&!CW(e,s)){r!=null&&i&&n+a+2>r&&(o=!0),t.inDollarMath=!1,t.dollarMathOpenOffset=null,a+=2;continue}a++;continue}if(e[a]==="`"&&!CW(e,s)){let t=IW(e,a,"`"),n=LW(e,a+t,t);if(n===-1)break;a=n+t;continue}if(e.startsWith(`\\[`,a)&&!CW(e,s)){t.inMath=!0,t.mathOpenOffset=n+a,a+=2;continue}if(e.startsWith(`$$`,a)&&!CW(e,s)){t.inDollarMath=!0,t.dollarMathOpenOffset=n+a,a+=2;continue}a++}return o}function BW(e,t){if(!Vz(t))return e;let n=t,r=RU.get(n),i=r?.source===e?r.state:r&&e.startsWith(r.source)?UW(r.state,e.slice(r.source.length),r.source.length-r.state.lineBuffer.length).state:HW(e).state;RU.set(n,{source:e,state:i});let{context:a}=i,o=a.inMath?a.mathOpenOffset:a.inDollarMath?a.dollarMathOpenOffset:null;if(o==null)return e;let s=e.slice(o+2),c=e.lastIndexOf(` -`,o-1)+1;if(e.slice(c,o).trim()!==``&&!/^\r?\n/.test(s)||/^\s*!\[/.test(s))return e;let l=s.trim(),u=/^(?:[a-z]|pi)$/i.test(l);return Iz(s)&&!u?e:e.slice(0,o)}function VW(e,t,n,r,i){let a=EW(e),o=kW(e);if(t.inFence&&t.fenceInBlockquote&&e.trim()&&AW(e)==null&&RW(t),t.inFence&&t.fenceInList&&e.trim()&&a.column=t.fenceLen&&/^\s*$/.test(o.rest)&&RW(t):(t.inFence=!0,t.fenceChar=o.markerChar,t.fenceLen=o.markerLen,t.fenceInBlockquote=o.inBlockquote,t.fenceInList=o.inList||t.listContentIndent!=null&&!o.inBlockquote&&a.column>=t.listContentIndent,t.fenceListIndent=o.listIndent||t.listContentIndent||0);else if(!t.inFence)return zW(e,t,n,r,i)}else return zW(e,t,n,r,i);return!1}function HW(e,t=_W(),n=null,r=!1,i=0){let a=vW(t),o=vW(t),s=``,c=!1,l=0;for(;ll&&e[t-1]===`\r`?t-1:u?t:e.length,f=e.slice(l,d);VW(f,a,i+l,n,r)&&(c=!0),u?(o=vW(a),s=``):s=f,l=u?t+1:e.length}return{closedOpenMath:c,state:{committedContext:o,context:a,lineBuffer:s}}}function UW(e,t,n=0){return t&&!e.context.inMath&&!e.context.inDollarMath&&!e.context.inFence&&!e.committedContext.inFence&&!/[\\$`~\r\n]/.test(t)&&!(e.lineBuffer.endsWith(`\\`)&&(t[0]===`[`||t[0]===`]`))?{closedOpenMath:!1,state:{committedContext:vW(e.committedContext),context:vW(e.context),lineBuffer:e.lineBuffer+t}}:HW(e.lineBuffer+t,e.committedContext,n+e.lineBuffer.length,e.context.inMath||e.context.inDollarMath,n)}function WW(e,t){if(!Vz(e))return;let n=e.stream;if(typeof n?.reset!=`function`)return;let r=e,i=LU.get(r);if(i?.source===t)return;let a=i?t.startsWith(i.source):!1,o=a&&i?t.slice(i.source.length):``,s=a&&i?UW(i.explicitBracketMath,o,i.source.length-i.explicitBracketMath.lineBuffer.length):HW(t),c=s.state,l=a&&i?s.closedOpenMath:!1;if(i&&a&&i.key===null&&i.pendingCandidate===!1&&!l&&!SW(i.source,o)&&!bW(t)){i.source=t,i.explicitBracketMath=c;return}let u=NB(t);(i&&(i&&!a||i.key!==u||l)||!i&&u)&&n.reset(),yW(e,t,u,c)}function GW(e){return typeof e.preTransformTokens==`function`||typeof e.postTransformTokens==`function`}function KW(e,t){let n=e?.map,r=t?.map;return n===r?!0:!Array.isArray(n)||!Array.isArray(r)?!1:n.length===r.length&&n.every((e,t)=>e===r[t])}function qW(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.markup===t.markup&&e.content===t.content&&KW(e,t)}function JW(e,t){return e[t]?.type===`paragraph_open`&&e[t+1]?.type===`inline`&&e[t+2]?.type===`paragraph_close`}function YW(e){for(let t=0;t+5`:``}function tG(e){return{type:`paragraph`,children:e,raw:e.map(eG).join(``)}}function nG(e,t){if(t.sourceMap)for(let n of e)n.sourceMap||=t.sourceMap}function rG(e,t){if(e.type!==`paragraph`)return null;let n=KU(e).children,r=Array.isArray(n)?n:[];if(r.length===0)return null;let i=sW(t);if(!i?.size)return null;let a=-1;for(let e=0;ee?.type===`hardbreak`)){a=e;break}}if(a===-1)return null;let o=r.slice(0,a),s=r[a];if(!s)return null;let c=[];o.length&&c.push(tG(o)),c.push(s);let l=r.slice(a+1);return l.length&&c.push(tG(l)),c}function iG(e){let t=e.trim();if(!t)return null;let n=/^(?:]*>\s*)?]*)?>/i.test(t),r=/<\/html>\s*$/i.test(t);return!n||!r?null:[{type:`html_block`,tag:`html`,raw:e,content:e,loading:!1}]}function aG(e){let t=e.raw;if(typeof t==`string`)return t;let n=KU(e).content;return typeof n==`string`?n:``}function oG(e,t){if(e.type!==`html_block`||!t)return!1;let n=String(e.raw??e.content??``);return new RegExp(String.raw`^\s*<\s*\/\s*${dL(t)}\s*>\s*$`,`i`).test(n)}var sG=new Set([`iframe`,`script`,`style`,`textarea`,`title`]);function cG(e,t,n){if(!e||!t)return null;let r=t.toLowerCase(),i=t=>{if(e.startsWith(``,t+4);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}if(e.startsWith(``,t+9);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}let n=fL(e.slice(t));if(n===-1)return null;let r=t+n+1,i=e.slice(t,r);if(/^<\s*[!?]/.test(i))return{closing:!1,end:r,selfClosing:!1,tag:``};let a=i.slice(1).trimStart(),o=a.startsWith(`/`);o&&(a=a.slice(1).trimStart());let s=a.match(/^([A-Z][\w:-]*)/i);return s?.[1]?{closing:o,end:r,selfClosing:/\/\s*>$/.test(i),tag:s[1].toLowerCase()}:{closing:!1,end:t+1,selfClosing:!1,tag:``}},a=(t,n)=>{let r=new RegExp(String.raw`<\s*\/\s*${dL(t)}(?=\s|>)`,`gi`);r.lastIndex=n;let a=r.exec(e);if(!a||a.index==null)return null;let o=i(a.index);return o?{start:a.index,end:o.end}:null},o=-1,s=-1,c=Math.max(0,n);for(;c$/.test(l))return{raw:l,start:o,end:s+1,closed:!0};if(sG.has(r)){let t=a(r,s+1);return t?{raw:e.slice(o,t.end),start:o,end:t.end,closeStart:t.start,closed:!0}:{raw:e.slice(o),start:o,end:e.length,closed:!1}}let u=1,d=s+1;for(;d]*$/,``)}\n`}function dG(e){return e.replace(/\r\n/g,` -`).replace(/(^|\n)[ \t]{1,4}/g,`$1`)}function fG(e,t,n){return n?e.includes(n,t)?!0:dG(e.slice(Math.max(0,t))).includes(dG(n)):!1}function pG(e,t){let n=Math.max(0,t);for(;n0?o:void 0,children:s,raw:f},u?l+1:l]}function EU(e,t,n,r){if(n?.type.endsWith(`_close`)){let i=Array.isArray(n.map)?Number(n.map[1]):NaN;return Number.isFinite(i)||(i=Array.isArray(t.map)?Number(t.map[1])+1:NaN),YH(e,t,i,r)}return JH(e,t,r)}function DU(e){return e.replace(/^\r?\n/,``).replace(/\r?\n$/,``)}function OU(e,t){if(!e||!t)return e;let n=new RegExp(String.raw`[\t ]*<\s*\/\s*${t}[^>]*$`,`i`);return e.replace(n,``)}function kU(e,t,n){if(!e||!t)return null;let r=t.toLowerCase(),i=new RegExp(String.raw`^<\s*${gL(r)}(?=\s|>|/)`,`i`),a=new RegExp(String.raw`^<\s*\/\s*${gL(r)}(?=\s|>)`,`i`),o=0,s=Math.max(0,n);for(;s$/.test(r)||o++,s=t+e+1;continue}s=t+1}return null}function AU(e,t,n){if(!e||!t)return null;let r=t.toLowerCase(),i=new RegExp(String.raw`<\s*${r}(?=\s|>|/)`,`gi`);i.lastIndex=Math.max(0,n||0);let a=i.exec(e);if(!a||a.index==null)return null;let o=a.index,s=e.slice(o),c=_L(s);if(c===-1)return null;let l=o+c;if(/\/\s*>\s*$/.test(s.slice(0,c+1))){let t=l+1;return{raw:e.slice(o,t),start:o,end:t}}let u=1,d=l+1,f=t=>{let n=e.slice(t);return new RegExp(String.raw`^<\s*${r}(?=\s|>|/)`,`i`).test(n)},p=t=>{let n=e.slice(t);return new RegExp(String.raw`^<\s*\/\s*${r}(?=\s|>)`,`i`).test(n)};for(;d`,t);if(n===-1)return null;if(u--,u===0){let t=n+1;return{raw:e.slice(o,t),start:o,end:t}}d=n+1;continue}if(f(t)){let n=_L(e.slice(t));if(n===-1)return null;u++,d=t+n+1;continue}d=t+1}return{raw:e.slice(o),start:o,end:e.length}}function jU(e){return Number.isFinite(e)&&e>0?e:0}function MU(e,t){let n=jU(t);if(!e||n<=0)return 0;let r=0;for(let t=0;t\s*$/.test(f),m=d===-1?null:kU(u,a,d+1),h=m?.start??-1,g=``;d!==-1&&(g=h!==-1&&d]+)))?/g,y;for(;(y=v.exec(f))!==null;){let e=y[1];if(!e||e.toLowerCase()===a)continue;let t=y[2]||y[3]||y[4]||``;_.push([e,t])}let b=!n?.final&&!p&&m==null,x={type:a,tag:a,content:DU(g),raw:String(l?.raw??e.raw??u),loading:b,attrs:_.length?_:void 0};return i&&(l?x.sourceMap=KH(o,l.start,l.end,n):JH(x,r,n)),[x,t+1]}return i&&JH(e,r,n),[e,t+1]}case`table_open`:{let[a,o]=yU(e,t,n);return i&&JH(a,r,n),[a,o]}case`dl_open`:{let[a,o]=lU(e,t,n);return i&&JH(a,r,n),[a,o]}case`footnote_open`:{let[a,o]=uU(e,t,n);return i&&JH(a,r,n),[a,o]}case`hr`:{let e=bU();return i&&JH(e,r,n),[e,t+1]}default:break}return null}function PU(e,t,n,r){let i=NU(e,t,n);if(i)return i;let a=e[t],o=n?.includeSourceMap===!0;switch(a.type){case`container_warning_open`:case`container_info_open`:case`container_note_open`:case`container_tip_open`:case`container_danger_open`:case`container_caution_open`:case`container_error_open`:if(r?.parseContainer){let i=r.parseContainer(e,t,n);return o&&EU(i[0],a,e[i[1]-1],n),i}break;case`container_open`:if(r?.matchAdmonition){let i=r.matchAdmonition(e,t,n);if(i)return o&&EU(i[0],a,e[i[1]-1],n),i}break;case`vmr_container_open`:{let r=TU(e,t,n);return o&&EU(r[0],a,e[r[1]-1],n),r}default:break}return null}function FU(){return{type:`hardbreak`,raw:`\\ +`}}function IU(e,t,n){let r=e[t+1],i=String(r.content??``);return{type:`paragraph`,children:HH(r.children||[],i,void 0,n),raw:i}}var LU=new WeakMap,RU=new WeakMap,zU=new WeakMap,BU=new WeakMap;function VU(e,t,n){let r=t?.map,i=n?.__sourceMarkdown;if(!Array.isArray(r)||r.length<2||typeof i!=`string`||!n)return;let a=Number(r[0]),o=Number(r[1]);if(!Number.isFinite(a)||!Number.isFinite(o))return;let s=zU.get(n);if(!s){s=[0];for(let e=0;e{if(!JU.has(e.type))return!1;let t=e.children;return!Array.isArray(t)||aW(t)})}function oW(e){let t=[],n=!1,r=0;for(;r{let r=o[t+1]??n.length;return{firstToken:n[e],lastToken:n[r-1],tokenCount:r-e}});KU.set(e,{groupBoundaries:s,source:t,nodes:i,stableGroupCount:r.mixed?Math.max(0,o.length-1):sW(t)?o.length:Math.max(0,o.length-1),requireClosingStrong:a.requireClosingStrong})}function uW(e,t,n,r){for(let i=0;i0&&c.requireClosingStrong===r.requireClosingStrong&&t.startsWith(c.source)&&s.length>=u&&(l===`append`||l===`tail`)&&uW(c,n,s,u)){let a=s[u]??n.length,l=iW(n.slice(a),r,i),d=s.length-u;if(l.length===d){let a=c.nodes.slice(0,u).concat(l);return $U(i,`processTokensReusedTopLevelNodes`,u),lW(e,t,n,o,a,r),a}}let d=iW(n,r,i);return lW(e,t,n,o,d,r),d}function fW(e){let t=e?.customHtmlTags;if(!Array.isArray(t)||t.length===0)return null;let n=SL(t);return n.length?new Set(n):null}function pW(e,t){let n=e,r=LU.get(n);r||(r=new Map,LU.set(n,r));let i=t.__markstreamFinal===!0?`final`:`streaming`,a=r.get(i);a||(a={},r.set(i,a));for(let e of Object.keys(a))Object.prototype.hasOwnProperty.call(t,e)||delete a[e];return Object.assign(a,t),a}function mW(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function hW(e,t,n){for(let r of Reflect.ownKeys(e)){let i=Object.getOwnPropertyDescriptor(e,r);if(!i||!(`value`in i))continue;let a=Object.getOwnPropertyDescriptor(t,r);a&&(!(`value`in a)||a.writable===!1)||(t[r]=gW(i.value,n))}}function gW(e,t=new WeakMap){if(!e||typeof e!=`object`)return e;let n=e,r=t.get(n);if(r)return r;if(Array.isArray(e)){let r=[];t.set(n,r);for(let n of e)r.push(gW(n,t));return r}if(e instanceof Map){let r=new Map;t.set(n,r);for(let[n,i]of e)r.set(gW(n,t),gW(i,t));return r}if(e instanceof Set){let r=new Set;t.set(n,r);for(let n of e)r.add(gW(n,t));return r}if(e instanceof Date){let r=new Date(e.getTime());return t.set(n,r),r}if(e instanceof RegExp){let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,t.set(n,r),r}if(typeof URL<`u`&&e instanceof URL){let r=new URL(e.href);return t.set(n,r),hW(n,r,t),r}if(typeof URLSearchParams<`u`&&e instanceof URLSearchParams){let r=new URLSearchParams(e.toString());return t.set(n,r),hW(n,r,t),r}if(e instanceof Error){let r,i=e.constructor;try{r=new i(e.message)}catch{r=Error(e.message)}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),t.set(n,r),hW(n,r,t),r}if(typeof Promise<`u`&&e instanceof Promise||typeof Node<`u`&&e instanceof Node)return t.set(n,e),e;if(!mW(e)){let r=Object.create(Object.getPrototypeOf(e));return t.set(n,r),hW(n,r,t),r}let i={};t.set(n,i);let a=e;for(let e of Object.keys(a))i[e]=gW(a[e],t);return i}function _W(e,t=!0){if(!t)return XB(e);let n=Object.create(Object.getPrototypeOf(e)),r=new WeakMap;for(let i of Reflect.ownKeys(e)){let a=Object.getOwnPropertyDescriptor(e,i);if(!a)continue;if(!(`value`in a)){Object.defineProperty(n,i,a);continue}let o=a.value,s=o;i===`attrs`&&Array.isArray(o)?s=o.map(e=>[...e]):i===`map`&&Array.isArray(o)?s=[...o]:i===`children`&&Array.isArray(o)?s=o.map(e=>_W(e,t)):t&&o&&typeof o==`object`&&(s=gW(o,r)),Object.defineProperty(n,i,{...a,value:s})}return n}function vW(e,t=!0){return e.map(e=>_W(e,t))}function yW(e,t){let n=t,r=e.stream,i=t.streamParse??`auto`;return n.__disableStreamParse!==!0&&e.__markstreamHasCustomParserExtensions!==!0&&(i===!0||i===`auto`&&t.final!==!0)&&r?.enabled===!0&&typeof r.parse==`function`}function bW(e,t){let n=t,r=t.streamParse??`auto`,i=e.stream;return t.final===!0&&r===`auto`&&n.__disableStreamParse!==!0&&e.__markstreamHasCustomParserExtensions!==!0&&i?.enabled===!0&&typeof i.reset==`function`}function xW(e){HU.delete(e)}function SW(){return{fenceChar:``,fenceInBlockquote:!1,fenceInList:!1,fenceLen:0,fenceListIndent:0,inDollarMath:!1,inFence:!1,inMath:!1,listContentIndent:null,dollarMathOpenOffset:null,mathOpenOffset:null}}function CW(e){return{...e}}function wW(e,t,n,r=qW(t).state){HU.set(e,{explicitBracketMath:r,source:t,key:n,pendingCandidate:n===null&&LB(t)})}function TW(e){return e.endsWith(`$`)||e.endsWith(`\\`)}function EW(e){let t=Math.max(e.lastIndexOf(` +`)+1,0),n=e.slice(t).replace(/[\t ]+$/,``);return WU.some(e=>n.endsWith(e))}function DW(e,t){return t?!!(t.includes(`$$`)||t.includes(`\\[`)||e.endsWith(`$`)&&t[0]===`$`||e.endsWith(`\\`)&&t[0]===`[`||EW(e)&&/[\r\n]/.test(t)):!1}function OW(e,t){let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function kW(e){return e===` `||e===` `}function AW(e,t){return t===` `?e+1:e+4-e%4}function jW(e){let t=0,n=0;for(;t3?null:t}function NW(e){let t=MW(e);if(!t)return null;let n=t.index,r=e[n];if(r!=="`"&&r!==`~`)return null;let i=n;for(;i`)return n?t:null;n=!0,r++,(t[r]===` `||t[r]===` `)&&r++,t=t.slice(r)}}function IW(e){let t=NW(e);if(t)return{...t,inBlockquote:!1,inList:!1,listIndent:0};let n=FW(e),r=n==null?null:NW(n);if(r)return{...r,inBlockquote:!0,inList:!1,listIndent:0};let i=PW(e);if(!i)return null;let a=NW(i.content);return a==null?null:{...a,inBlockquote:!1,inList:!0,listIndent:i.contentIndent}}function LW(e,t){let n=!1,r=``,i=0,a=!1,o=!1,s=0,c=null,l=0;for(;l=t?t:u,f=e.slice(l,d),p=f.endsWith(`\r`)?f.slice(0,-1):f,m=jW(p),h=PW(p);n&&a&&p.trim()&&FW(p)==null&&(n=!1,r=``,i=0,a=!1,o=!1,s=0),n&&o&&p.trim()&&m.column=i&&/^\s*$/.test(g.rest)&&(n=!1,r=``,i=0,a=!1,o=!1,s=0):(n=!0,r=g.markerChar,i=g.markerLen,a=g.inBlockquote,o=g.inList||c!=null&&!g.inBlockquote&&m.column>=c,s=g.listIndent||c||0)),u===-1||u>=t)break;l=u+1}return n}function RW(e,t){let n=e=>e===` `||e===` `,r=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},i=e=>{if(e[0]!==`<`)return null;let t=1;for(;t`&&s!==`/`)return null;let c=_L(e);if(c===-1)return null;let l=c-1;for(;l>=0&&n(e[l]);)l--;return{closing:i,tag:o,selfClosing:!i&&e[l]===`/`,after:e.slice(c+1)}},a=(e,t)=>{let r=e.toLowerCase(),i=0;for(;i`)return!0}}return!1},o=[],s=!1,c=!1,l=!1,u=0;for(;u=t?t:n,d=e.slice(u,r),f=d.endsWith(`\r`)?d.slice(0,-1):d,p=MW(f);if(p){let e=f.slice(p.index);if(s)s=!e.includes(`-->`);else if(c)c=!e.includes(`>`);else if(l)l=!e.includes(`?>`);else if(e.startsWith(``);else if(e.startsWith(``);else if(e.startsWith(``);else{let t=i(e);if(t)if(t.closing){for(let e=o.length-1;e>=0;e--)if(o[e]===t.tag){o.length=e;break}}else t.selfClosing||a(t.after,t.tag)||o.push(t.tag)}}if(n===-1||n>=t)break;u=n+1}return s||c||l||o.length>0}function zW(e,t,n){if(!n?.length)return!1;let r=new Set(SL(n));if(!r.size)return!1;let i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>e===` `||e===` `,o=e=>{if(e[0]!==`<`)return null;let t=1;for(;t`&&c!==`/`)return null;let l=e.indexOf(`>`,t);if(l===-1)return null;let u=l-1;for(;u>=0&&a(e[u]);)u--;return{closing:n,tag:s,selfClosing:!n&&e[u]===`/`,after:e.slice(l+1)}},s=(e,t)=>{let n=e.toLowerCase(),r=0;for(;r`)return!0}}return!1},c=[],l=0;for(;l=t?t:n,i=e.slice(l,r),a=i.endsWith(`\r`)?i.slice(0,-1):i,u=MW(a);if(u){let e=o(a.slice(u.index));if(e)if(e.closing){for(let t=c.length-1;t>=0;t--)if(c[t]===e.tag){c.length=t;break}}else e.selfClosing||s(e.after,e.tag)||c.push(e.tag)}if(n===-1||n>=t)break;l=n+1}return c.length>0}function BW(e,t){let n=GU.exec(e);if(!n)return null;let r=n[1]??``,i=n.index+r.length,a=e.indexOf(` +`,i),o=e.slice(i,a===-1?e.length:a);return!MW(o.endsWith(`\r`)?o.slice(0,-1):o)||LW(e,i)||RW(e,i)||zW(e,i,t)?null:`${e.slice(0,n.index)}${r}`}function VW(e,t,n){let r=t;for(;rr&&(o=!0),t.inMath=!1,t.mathOpenOffset=null,a+=2;continue}a++;continue}if(t.inDollarMath){if(e.startsWith(`$$`,a)&&!OW(e,s)){r!=null&&i&&n+a+2>r&&(o=!0),t.inDollarMath=!1,t.dollarMathOpenOffset=null,a+=2;continue}a++;continue}if(e[a]==="`"&&!OW(e,s)){let t=VW(e,a,"`"),n=HW(e,a+t,t);if(n===-1)break;a=n+t;continue}if(e.startsWith(`\\[`,a)&&!OW(e,s)){t.inMath=!0,t.mathOpenOffset=n+a,a+=2;continue}if(e.startsWith(`$$`,a)&&!OW(e,s)){t.inDollarMath=!0,t.dollarMathOpenOffset=n+a,a+=2;continue}a++}return o}function GW(e,t){if(!Kz(t))return e;let n=t,r=UU.get(n),i=r?.source===e?r.state:r&&e.startsWith(r.source)?JW(r.state,e.slice(r.source.length),r.source.length-r.state.lineBuffer.length).state:qW(e).state;UU.set(n,{source:e,state:i});let{context:a}=i,o=a.inMath?a.mathOpenOffset:a.inDollarMath?a.dollarMathOpenOffset:null;if(o==null)return e;let s=e.slice(o+2),c=e.lastIndexOf(` +`,o-1)+1;if(e.slice(c,o).trim()!==``&&!/^\r?\n/.test(s)||/^\s*!\[/.test(s))return e;let l=s.trim(),u=/^(?:[a-z]|pi)$/i.test(l);return Vz(s)&&!u?e:e.slice(0,o)}function KW(e,t,n,r,i){let a=jW(e),o=PW(e);if(t.inFence&&t.fenceInBlockquote&&e.trim()&&FW(e)==null&&UW(t),t.inFence&&t.fenceInList&&e.trim()&&a.column=t.fenceLen&&/^\s*$/.test(o.rest)&&UW(t):(t.inFence=!0,t.fenceChar=o.markerChar,t.fenceLen=o.markerLen,t.fenceInBlockquote=o.inBlockquote,t.fenceInList=o.inList||t.listContentIndent!=null&&!o.inBlockquote&&a.column>=t.listContentIndent,t.fenceListIndent=o.listIndent||t.listContentIndent||0);else if(!t.inFence)return WW(e,t,n,r,i)}else return WW(e,t,n,r,i);return!1}function qW(e,t=SW(),n=null,r=!1,i=0){let a=CW(t),o=CW(t),s=``,c=!1,l=0;for(;ll&&e[t-1]===`\r`?t-1:u?t:e.length,f=e.slice(l,d);KW(f,a,i+l,n,r)&&(c=!0),u?(o=CW(a),s=``):s=f,l=u?t+1:e.length}return{closedOpenMath:c,state:{committedContext:o,context:a,lineBuffer:s}}}function JW(e,t,n=0){return t&&!e.context.inMath&&!e.context.inDollarMath&&!e.context.inFence&&!e.committedContext.inFence&&!/[\\$`~\r\n]/.test(t)&&!(e.lineBuffer.endsWith(`\\`)&&(t[0]===`[`||t[0]===`]`))?{closedOpenMath:!1,state:{committedContext:CW(e.committedContext),context:CW(e.context),lineBuffer:e.lineBuffer+t}}:qW(e.lineBuffer+t,e.committedContext,n+e.lineBuffer.length,e.context.inMath||e.context.inDollarMath,n)}function YW(e,t){if(!Kz(e))return;let n=e.stream;if(typeof n?.reset!=`function`)return;let r=e,i=HU.get(r);if(i?.source===t)return;let a=i?t.startsWith(i.source):!1,o=a&&i?t.slice(i.source.length):``,s=a&&i?JW(i.explicitBracketMath,o,i.source.length-i.explicitBracketMath.lineBuffer.length):qW(t),c=s.state,l=a&&i?s.closedOpenMath:!1;if(i&&a&&i.key===null&&i.pendingCandidate===!1&&!l&&!DW(i.source,o)&&!TW(t)){i.source=t,i.explicitBracketMath=c;return}let u=RB(t);(i&&(i&&!a||i.key!==u||l)||!i&&u)&&n.reset(),wW(e,t,u,c)}function XW(e){return typeof e.preTransformTokens==`function`||typeof e.postTransformTokens==`function`}function ZW(e,t){let n=e?.map,r=t?.map;return n===r?!0:!Array.isArray(n)||!Array.isArray(r)?!1:n.length===r.length&&n.every((e,t)=>e===r[t])}function QW(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.markup===t.markup&&e.content===t.content&&ZW(e,t)}function $W(e,t){return e[t]?.type===`paragraph_open`&&e[t+1]?.type===`inline`&&e[t+2]?.type===`paragraph_close`}function eG(e){for(let t=0;t+5`:``}function oG(e){return{type:`paragraph`,children:e,raw:e.map(aG).join(``)}}function sG(e,t){if(t.sourceMap)for(let n of e)n.sourceMap||=t.sourceMap}function cG(e,t){if(e.type!==`paragraph`)return null;let n=ZU(e).children,r=Array.isArray(n)?n:[];if(r.length===0)return null;let i=fW(t);if(!i?.size)return null;let a=-1;for(let e=0;ee?.type===`hardbreak`)){a=e;break}}if(a===-1)return null;let o=r.slice(0,a),s=r[a];if(!s)return null;let c=[];o.length&&c.push(oG(o)),c.push(s);let l=r.slice(a+1);return l.length&&c.push(oG(l)),c}function lG(e){let t=e.trim();if(!t)return null;let n=/^(?:]*>\s*)?]*)?>/i.test(t),r=/<\/html>\s*$/i.test(t);return!n||!r?null:[{type:`html_block`,tag:`html`,raw:e,content:e,loading:!1}]}function uG(e){let t=e.raw;if(typeof t==`string`)return t;let n=ZU(e).content;return typeof n==`string`?n:``}function dG(e,t){if(e.type!==`html_block`||!t)return!1;let n=String(e.raw??e.content??``);return new RegExp(String.raw`^\s*<\s*\/\s*${gL(t)}\s*>\s*$`,`i`).test(n)}var fG=new Set([`iframe`,`script`,`style`,`textarea`,`title`]);function pG(e,t,n){if(!e||!t)return null;let r=t.toLowerCase(),i=t=>{if(e.startsWith(``,t+4);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}if(e.startsWith(``,t+9);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}let n=_L(e.slice(t));if(n===-1)return null;let r=t+n+1,i=e.slice(t,r);if(/^<\s*[!?]/.test(i))return{closing:!1,end:r,selfClosing:!1,tag:``};let a=i.slice(1).trimStart(),o=a.startsWith(`/`);o&&(a=a.slice(1).trimStart());let s=a.match(/^([A-Z][\w:-]*)/i);return s?.[1]?{closing:o,end:r,selfClosing:/\/\s*>$/.test(i),tag:s[1].toLowerCase()}:{closing:!1,end:t+1,selfClosing:!1,tag:``}},a=(t,n)=>{let r=new RegExp(String.raw`<\s*\/\s*${gL(t)}(?=\s|>)`,`gi`);r.lastIndex=n;let a=r.exec(e);if(!a||a.index==null)return null;let o=i(a.index);return o?{start:a.index,end:o.end}:null},o=-1,s=-1,c=Math.max(0,n);for(;c$/.test(l))return{raw:l,start:o,end:s+1,closed:!0};if(fG.has(r)){let t=a(r,s+1);return t?{raw:e.slice(o,t.end),start:o,end:t.end,closeStart:t.start,closed:!0}:{raw:e.slice(o),start:o,end:e.length,closed:!1}}let u=1,d=s+1;for(;d]*$/,``)}\n`}function gG(e){return e.replace(/\r\n/g,` +`).replace(/(^|\n)[ \t]{1,4}/g,`$1`)}function _G(e,t,n){return n?e.includes(n,t)?!0:gG(e.slice(Math.max(0,t))).includes(gG(n)):!1}function vG(e,t){let n=Math.max(0,t);for(;n)`,`gi`),r=-1,i;for(;(i=n.exec(e))!==null;)r=i.index;return r}function _G(e,t){return{final:t,__disableStreamParse:!0,requireClosingStrong:e.requireClosingStrong,customHtmlTags:e.customHtmlTags,validateLink:e.validateLink}}var vG=new Set([`admonition`,`blockquote`,`code_block`,`definition_list`,`footnote`,`heading`,`list`,`math_block`,`table`,`thematic_break`]),yG=/(?:^|\n)\s{0,3}(?:#{1,6}\s+\S|[-+*]\s+\S|\d+[.)]\s+\S|>\s*\S|`{3,}|~{3,}|(?:\*{3,}|-{3,}|_{3,})(?:\s|$)|\|.*\|)/m;function bG(e){return/\n\s*\n/.test(e)||yG.test(e)}function xG(e,t){if(!e.trim()||t.length===0)return!1;if(t.some(e=>vG.has(String(e?.type??``).toLowerCase()))||t.some(e=>{if(e?.type!==`html_block`)return!1;let t=KU(e);return Array.isArray(t.children)&&t.children.length>0}))return!0;if(!bG(e))return!1;if(t.length>1)return!0;let[n]=t;return!!(n&&n.type===`paragraph`)}function SG(e){let t=[],n=0;for(;n=e.length)break;let r=e.slice(n).match(/^<([A-Z][\w:-]*)/i);if(!r?.[1])return null;let i=cG(e,r[1],n);if(!i||i.start!==n)return null;t.push(i.raw),n=i.end}return t.length>1?t:null}function CG(e,t,n,r){let i=n.customHtmlTags?.join(`\0`)??``,a=t,o=FU.get(a),s=o&&o.final===r&&o.customHtmlTags===i&&o.requireClosingStrong===n.requireClosingStrong&&o.validateLink===n.validateLink,c=e.map((e,r)=>s&&o.blocks[r]===e?o.children[r]:EG(e,t,n));return FU.set(a,{blocks:e,children:c,customHtmlTags:i,final:r,requireClosingStrong:n.requireClosingStrong,validateLink:n.validateLink}),c.flat()}function wG(e,t,n,r){return e.map(e=>{if(e?.type!==`html_block`)return e;let i=KU(e),a=String(i.tag??``).toLowerCase();if(!a||a===`details`||WI.has(a)||Array.isArray(i.children))return e;let o=String(e.raw??i.content??``);if(!o)return e;let s=fL(o);if(s===-1)return e;let c=cG(o,a,0),l=c?.closeStart??-1,u=c?.closed===!0&&l>=s+1,d=u?o.slice(s+1,l):o.slice(s+1);if(!d.trim())return e;let f=_G(n,r),p=u?null:SG(d),m=p?CG(p,t,f,r):EG(d,t,f);return xG(d,m)?{...e,children:m}:e})}function TG(e){for(let t of e)if(t?.type===`html_block`)return!0;return!1}function EG(e,t,n){return e.trim()?RG(e,t,{...n,__disableStreamParse:!0}):[]}function DG(e,t,n){let r=EG(e,t,n),i=r[0];return r.length===1&&i?.type===`paragraph`&&Array.isArray(i.children)?i.children:r}function OG(e,t,n){let r=cU({content:e}),i=fL(e),a=gG(e,`summary`);if(i!==-1&&a!==-1&&a>=i+1){let o=DG(e.slice(i+1,a),t,n);o.length>0&&(r.children=o)}return r.raw=e,r}function kG(e,t,n){let r=fL(e);if(r===-1)return[];let i=e.slice(r+1);if(!i.trim())return[];let a=cG(i,`summary`,0);if(!a)return EG(i,t,n);let o=i.slice(0,a.start),s=i.slice(a.end);return[...EG(o,t,n),OG(a.raw,t,n),...EG(s,t,n)]}function AG(e,t,n,r,i,a=0){let o=[],s=a;for(let a=0;a{let e=gG(d,`details`);return e===-1?d:d.slice(0,e)})():d,[v]=AG(g?[]:m===-1?e.slice(a+1):e.slice(a+1,m),t,n,r,i,f+d.length),y=kG(_,n,_G(r,i)),b=m===-1?``:String(e[m].raw??aG(e[m])??``),x=g||m!==-1&&h?.closed===!0,S=b.replace(/[\t\r\n ]+$/,``),C=x?(()=>{let e=(h?.raw??``).lastIndexOf(S);return e===-1?t.length:f+e})():t.length,w=fL(d),T=g&&w!==-1?f+w+1:f+d.length,E=t.slice(T,C===-1?t.length:C),D=n.parse(E,{__markstreamFinal:i}),O=n.renderer.render(D,n.options,{__markstreamFinal:i}),k=C+S.length,A=x?Math.max(C+b.length,pG(t,k)):t.length,j=x?t.slice(C,A):b,M=x?t.slice(f,A):t.slice(f),N=g&&w!==-1?d.slice(0,w+1):d,ee={...c,tag:`details`,attrs:pL(d.slice(0,w+1)),raw:M,content:`${N}${O}${j}`,children:[...y,...v],loading:!i&&!x};if(r.includeSourceMap&&(ee.sourceMap=VH(t,f,x?A:t.length,r)),o.push(ee),s=x?A:t.length,m===-1&&!g)break;m!==-1&&(a=m)}return[o,s]}function jG(e,t,n,r){if(!n)return e;let i=e.slice(),a=0;for(let e=0;e=u.start&&t.end<=u.end){i.splice(x,1);continue}break}b=t+e.length,i.splice(x,1)}}return i}function MG(e){let t=e=>e===` `||e===` `||e===` +`?n+1:t}function yG(e){if(e.type!==`html_block`||String(e.tag??``).toLowerCase()!==`details`)return!1;let t=String(e.raw??e.content??``);return/^\s*)`,`gi`),r=-1,i;for(;(i=n.exec(e))!==null;)r=i.index;return r}function SG(e,t){return{final:t,__disableStreamParse:!0,requireClosingStrong:e.requireClosingStrong,customHtmlTags:e.customHtmlTags,validateLink:e.validateLink}}var CG=new Set([`admonition`,`blockquote`,`code_block`,`definition_list`,`footnote`,`heading`,`list`,`math_block`,`table`,`thematic_break`]),wG=/(?:^|\n)\s{0,3}(?:#{1,6}\s+\S|[-+*]\s+\S|\d+[.)]\s+\S|>\s*\S|`{3,}|~{3,}|(?:\*{3,}|-{3,}|_{3,})(?:\s|$)|\|.*\|)/m;function TG(e){return/\n\s*\n/.test(e)||wG.test(e)}function EG(e,t){if(!e.trim()||t.length===0)return!1;if(t.some(e=>CG.has(String(e?.type??``).toLowerCase()))||t.some(e=>{if(e?.type!==`html_block`)return!1;let t=ZU(e);return Array.isArray(t.children)&&t.children.length>0}))return!0;if(!TG(e))return!1;if(t.length>1)return!0;let[n]=t;return!!(n&&n.type===`paragraph`)}function DG(e){let t=[],n=0;for(;n=e.length)break;let r=e.slice(n).match(/^<([A-Z][\w:-]*)/i);if(!r?.[1])return null;let i=pG(e,r[1],n);if(!i||i.start!==n)return null;t.push(i.raw),n=i.end}return t.length>1?t:null}function OG(e,t,n,r){let i=n.customHtmlTags?.join(`\0`)??``,a=t,o=BU.get(a),s=o&&o.final===r&&o.customHtmlTags===i&&o.requireClosingStrong===n.requireClosingStrong&&o.validateLink===n.validateLink,c=e.map((e,r)=>s&&o.blocks[r]===e?o.children[r]:jG(e,t,n));return BU.set(a,{blocks:e,children:c,customHtmlTags:i,final:r,requireClosingStrong:n.requireClosingStrong,validateLink:n.validateLink}),c.flat()}function kG(e,t,n,r){return e.map(e=>{if(e?.type!==`html_block`)return e;let i=ZU(e),a=String(i.tag??``).toLowerCase();if(!a||a===`details`||YI.has(a)||Array.isArray(i.children))return e;let o=String(e.raw??i.content??``);if(!o)return e;let s=_L(o);if(s===-1)return e;let c=pG(o,a,0),l=c?.closeStart??-1,u=c?.closed===!0&&l>=s+1,d=u?o.slice(s+1,l):o.slice(s+1);if(!d.trim())return e;let f=SG(n,r),p=u?null:DG(d),m=p?OG(p,t,f,r):jG(d,t,f);return EG(d,m)?{...e,children:m}:e})}function AG(e){for(let t of e)if(t?.type===`html_block`)return!0;return!1}function jG(e,t,n){return e.trim()?UG(e,t,{...n,__disableStreamParse:!0}):[]}function MG(e,t,n){let r=jG(e,t,n),i=r[0];return r.length===1&&i?.type===`paragraph`&&Array.isArray(i.children)?i.children:r}function NG(e,t,n){let r=pU({content:e}),i=_L(e),a=xG(e,`summary`);if(i!==-1&&a!==-1&&a>=i+1){let o=MG(e.slice(i+1,a),t,n);o.length>0&&(r.children=o)}return r.raw=e,r}function PG(e,t,n){let r=_L(e);if(r===-1)return[];let i=e.slice(r+1);if(!i.trim())return[];let a=pG(i,`summary`,0);if(!a)return jG(i,t,n);let o=i.slice(0,a.start),s=i.slice(a.end);return[...jG(o,t,n),NG(a.raw,t,n),...jG(s,t,n)]}function FG(e,t,n,r,i,a=0){let o=[],s=a;for(let a=0;a{let e=xG(d,`details`);return e===-1?d:d.slice(0,e)})():d,[v]=FG(g?[]:m===-1?e.slice(a+1):e.slice(a+1,m),t,n,r,i,f+d.length),y=PG(_,n,SG(r,i)),b=m===-1?``:String(e[m].raw??uG(e[m])??``),x=g||m!==-1&&h?.closed===!0,S=b.replace(/[\t\r\n ]+$/,``),C=x?(()=>{let e=(h?.raw??``).lastIndexOf(S);return e===-1?t.length:f+e})():t.length,w=_L(d),T=g&&w!==-1?f+w+1:f+d.length,E=t.slice(T,C===-1?t.length:C),D=n.parse(E,{__markstreamFinal:i}),O=n.renderer.render(D,n.options,{__markstreamFinal:i}),k=C+S.length,A=x?Math.max(C+b.length,vG(t,k)):t.length,j=x?t.slice(C,A):b,M=x?t.slice(f,A):t.slice(f),N=g&&w!==-1?d.slice(0,w+1):d,ee={...c,tag:`details`,attrs:vL(d.slice(0,w+1)),raw:M,content:`${N}${O}${j}`,children:[...y,...v],loading:!i&&!x};if(r.includeSourceMap&&(ee.sourceMap=KH(t,f,x?A:t.length,r)),o.push(ee),s=x?A:t.length,m===-1&&!g)break;m!==-1&&(a=m)}return[o,s]}function IG(e,t,n,r){if(!n)return e;let i=e.slice(),a=0;for(let e=0;e=u.start&&t.end<=u.end){i.splice(x,1);continue}break}b=t+e.length,i.splice(x,1)}}return i}function LG(e){let t=e=>e===` `||e===` `||e===` `||e===`\r`,n=e=>{if(!e||e[0]!==`<`||e.includes(`>`))return!1;let n=1;if(n{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122},i=e=>{let t=e.charCodeAt(0);return t>=48&&t<=57},a=e=>e===`!`||r(e),o=e=>r(e)||i(e)||e===`:`||e===`-`,s=e=>r(e)||i(e)||e===`_`||e===`.`||e===`:`||e===`-`,c=s;if(n>=e.length||!a(e[n]))return!1;for(n++;n=e.length)return!0;if(e[n]===`/`){for(n++;n=e.length}if(!s(e[n]))return!1;for(n++;n=e.length)return!0;let r=e[n];if(r===`"`||r===`'`){for(n++;n=e.length)return!0;n++}else{for(;n`||r===`"`||r===`'`||r==="`")break;n++}if(n>=e.length)return!0}}}return!0},r=(e,t)=>{let n=!1,r=``,i=0,a=e=>e===` `||e===` `,o=e=>{let t=0;for(;t{let t=0;for(;t`;)for(n=!0,t++;t{let t=o(e);if(t)return t;let n=s(e);return n==null?null:o(n)},l=0,u=e.split(/\r?\n/);for(let e of u){let a=l,o=l+e.length;if(t=i&&/^\s*$/.test(s.rest)&&(n=!1,r=``,i=0):(n=!0,r=e,i=t)}if(t<=o)break;l=o+1}return n},i=String(e??``),a=i.lastIndexOf(`<`);if(a===-1||r(i,a))return i;if(a>0){let e=i[a-1],t=e===` `||e===` `||e===` `||e===`\r`,n=i[a-2];if(!t&&!((e===`n`||e===`r`)&&n===`\\`))return i}let o=i.slice(a);return o.includes(`>`)||o.length>1&&(o[1]===` `||o[1]===` `||o[1]===` -`||o[1]===`\r`)||!n(o)?i:i.slice(0,a)}function NG(e,t){if(e===t)return;let n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=[],a=0;for(let e=0;e{let t=Number.isFinite(e)?Math.max(0,Math.trunc(e)):0;if(tString(e??``).toLowerCase()).filter(Boolean));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n=4)return!0;continue}if(r===` `)return!0;break}return!1},o=e=>{let t=!1,n=!1;for(let r=0;r`)return r}return-1},s=e=>{let t=0;for(;t{if(a(t))return-1;let c=t.replace(/^[ \t]+/,``);if(!c||c.startsWith(`>`)||c.startsWith(`|`)||/^(?:[*+-]|\d+[.)])[\t ]+/.test(c))return-1;let l=!1,u=0;for(;u=d.length){l=!0,u++;continue}let p=d[f];if(p===`!`||p===`?`){l=!0,u+=c+1;continue}if(p===`/`){l=!0,u+=c+1;continue}let m=f;for(;f`&&g!==`/`){l=!0,u++;continue}let _=new RegExp(String.raw`<\s*\/\s*${h}\s*>`,`i`),v=/\/\s*>$/.test(d),y=_.test(t.slice(u+c+1)),b=_.test(e.slice(s+u+c+1)),x=/[\r\n]/.test(e.slice(s+u+c+1));if(l&&n.has(h)&&!v&&!y&&(b||x))return u;l=!0,u+=c+1}return-1},l=!1,u=``,d=0,f=``,p=0;for(;p{let t=Number.isFinite(e)?Math.max(0,Math.trunc(e)):0;if(tString(e??``).toLowerCase()).filter(Boolean));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n=4)return!0;continue}if(r===` `)return!0;break}return!1},o=e=>{let t=!1,n=!1;for(let r=0;r`)return r}return-1},s=e=>{let t=0;for(;t{if(a(t))return-1;let c=t.replace(/^[ \t]+/,``);if(!c||c.startsWith(`>`)||c.startsWith(`|`)||/^(?:[*+-]|\d+[.)])[\t ]+/.test(c))return-1;let l=!1,u=0;for(;u=d.length){l=!0,u++;continue}let p=d[f];if(p===`!`||p===`?`){l=!0,u+=c+1;continue}if(p===`/`){l=!0,u+=c+1;continue}let m=f;for(;f`&&g!==`/`){l=!0,u++;continue}let _=new RegExp(String.raw`<\s*\/\s*${h}\s*>`,`i`),v=/\/\s*>$/.test(d),y=_.test(t.slice(u+c+1)),b=_.test(e.slice(s+u+c+1)),x=/[\r\n]/.test(e.slice(s+u+c+1));if(l&&n.has(h)&&!v&&!y&&(b||x))return u;l=!0,u+=c+1}return-1},l=!1,u=``,d=0,f=``,p=0;for(;pp&&e[t-1]===`\r`,i=n?r?t-1:t:e.length,a=e.slice(p,i),o=n?r?`\r `:` `:``,m=s(a),h=a;if(!l&&!m){let e=c(a,p);if(e!==-1){let t=o||` -`;h=`${a.slice(0,e).replace(/[ \t]+$/,``)}${t}${t}${a.slice(e).replace(/^[ \t]+/,``)}`}}f+=h,f+=o,m&&(l?m.markerChar===u&&m.markerLen>=d&&/^\s*$/.test(m.rest)&&(l=!1,u=``,d=0):(l=!0,u=m.markerChar,d=m.markerLen)),p=n?t+1:e.length}return f}function FG(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`},a=e=>{let t=0;for(;t{let t=!1,n=!1;for(let r=0;r`)return r}return-1},s=(e,t,n)=>{let a=n.toLowerCase(),o=e.indexOf(`<`,t);for(;o!==-1;){let t=o+1;for(;t=e.length||e[t]!==`/`){o=e.indexOf(`<`,o+1);continue}for(t++;te.length){o=e.indexOf(`<`,o+1);continue}let n=!0;for(let r=0;r=`A`&&i<=`Z`?String.fromCharCode(i.charCodeAt(0)+32):i)!==a[r]){n=!1;break}}if(!n){o=e.indexOf(`<`,o+1);continue}let s=t+a.length;if(s`)return!0;o=e.indexOf(`<`,o+1)}return!1},c=e=>{let t=0;for(;t=e.length||e[t]!==`<`)return e;for(t++;t=e.length||e[t]===`/`)return e;let c=t;for(;t=d&&/^\s*$/.test(m.rest)&&(l=!1,u=``,d=0):(l=!0,u=m.markerChar,d=m.markerLen)),p=n?t+1:e.length}return f}function BG(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`},a=e=>{let t=0;for(;t{let t=!1,n=!1;for(let r=0;r`)return r}return-1},s=(e,t,n)=>{let a=n.toLowerCase(),o=e.indexOf(`<`,t);for(;o!==-1;){let t=o+1;for(;t=e.length||e[t]!==`/`){o=e.indexOf(`<`,o+1);continue}for(t++;te.length){o=e.indexOf(`<`,o+1);continue}let n=!0;for(let r=0;r=`A`&&i<=`Z`?String.fromCharCode(i.charCodeAt(0)+32):i)!==a[r]){n=!1;break}}if(!n){o=e.indexOf(`<`,o+1);continue}let s=t+a.length;if(s`)return!0;o=e.indexOf(`<`,o+1)}return!1},c=e=>{let t=0;for(;t=e.length||e[t]!==`<`)return e;for(t++;t=e.length||e[t]===`/`)return e;let c=t;for(;tu&&e[t-1]===`\r`,r=n?t-1:t,i=e.slice(u,r);l+=c(i),l+=n?`\r `:` -`,u=t+1}return l}function IG(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=0,n=!1,i=0;for(;t=e.length||e[t]!==`>`)break;for(n=!0,t++;t{let t=0;for(;tnew RegExp(String.raw`(<\s*\/\s*${e}\s*>)${"(?=[\\t ]*(?:#{1,6}[\\t ]+|>|(?:[*+-]|\\d+[.)])[\\t ]+|(?:`{3,}|~{3,})|\\||\\$\\$|:{3,}|\\[\\^[^\\]]+\\]:|(?:-{3,}|\\*{3,}|_{3,})))"}`,`gi`)),s=!1,c=``,l=0,u=``,d=0;for(;dString(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=0,n=!1,i=0;for(;t=e.length||e[t]!==`>`)break;for(n=!0,t++;t{let t=0;for(;tnew RegExp(String.raw`(<\s*\/\s*${e}\s*>)${"(?=[\\t ]*(?:#{1,6}[\\t ]+|>|(?:[*+-]|\\d+[.)])[\\t ]+|(?:`{3,}|~{3,})|\\||\\$\\$|:{3,}|\\[\\^[^\\]]+\\]:|(?:-{3,}|\\*{3,}|_{3,})))"}`,`gi`)),s=!1,c=``,l=0,u=``,d=0;for(;dd&&e[t-1]===`\r`,f=n?r?t-1:t:e.length,p=e.slice(d,f),m=n?r?`\r `:` `:``,h=i(p),g=h?.prefix??``,_=h?.content??p,v=a(_);v&&(s?v.markerChar===c&&v.markerLen>=l&&/^\s*$/.test(v.rest)&&(s=!1,c=``,l=0):(s=!0,c=v.markerChar,l=v.markerLen));let y=_;if(!s&&y.includes(`{if(r.replace(/^[\t ]+/,``).startsWith(`|`))return e;let i=r.slice(0,n).replace(/^[\t ]+/,``);if(i.length>0){let n=t.match(/^<\s*\/\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??``,r=i.match(/^<\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??``;if(!n||!r||n!==r)return e}return`${t}\n\n`});if(g){let e=g+y.split(` -`).join(`\n${g}`);u+=e}else u+=y;u+=m,d=n?t+1:e.length}return u}function LG(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n=4)return!0;continue}if(r===` `)return!0;break}return!1},a=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},o=e=>{let t=0;for(;t{let t=0,n=!1,i=0;for(;t=e.length||e[t]!==`>`)break;for(n=!0,t++;to(e).startsWith(`<`),l=e=>{for(let t=0;t{if(i(e))return``;let t=o(e);if(!t.startsWith(`<`))return``;let s=1;for(;s=t.length||t[s]===`/`||t[s]===`!`||t[s]===`?`)return``;let c=s;for(;s`&&u!==`/`?``:l},d=e=>{if(i(e))return null;let t=o(e);if(!t.startsWith(`<`))return null;let s=1;for(;s=t.length)return null;let c=t[s]===`/`;if(c)for(s++;s`&&f!==`/`)return null;if(c)return{type:`close`,name:d};if(/\/\s*>\s*$/.test(t))return{type:`open`,name:d,complete:!0};let p=t.indexOf(`>`,s);if(p!==-1){let e=t.slice(p+1);if(RegExp(`<\\s*\\/\\s*${d}\\s*>`,`i`).test(e))return{type:`open`,name:d,complete:!0}}return{type:`open`,name:d,complete:!1}},f=e=>{if(i(e))return null;let t=o(e).replace(/[ \t]+$/,``);if(!t.startsWith(`<`)||/^<\s*(?:!--|!doctype\b|\?)/i.test(t))return null;let n=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*\/\s*>\s*$/i);if(n?.[1])return n[1].toLowerCase();let r=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*>[\s\S]*<\s*\/\s*([A-Z][\w:-]*)\s*>\s*$/i);if(!r?.[1]||!r[2])return null;let a=r[1].toLowerCase();return a===r[2].toLowerCase()?a:null},p=!1,m=``,h=0,g=e=>{let t=0;for(;tg(e),v=e=>{let t=o(e);return t?i(e)?!0:/^(?:#{1,6}[ \t]+|>|[*+-][ \t]+|\d+[.)][ \t]+|`{3,}|~{3,}|\||\$\$|:{3,}|\[\^[^\]]+\]:|-{3,}|\*{3,}|_{3,})/.test(t):!1},y=(t,n,r)=>{let i=t,a=0;for(;iString(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n=4)return!0;continue}if(r===` `)return!0;break}return!1},a=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},o=e=>{let t=0;for(;t{let t=0,n=!1,i=0;for(;t=e.length||e[t]!==`>`)break;for(n=!0,t++;to(e).startsWith(`<`),l=e=>{for(let t=0;t{if(i(e))return``;let t=o(e);if(!t.startsWith(`<`))return``;let s=1;for(;s=t.length||t[s]===`/`||t[s]===`!`||t[s]===`?`)return``;let c=s;for(;s`&&u!==`/`?``:l},d=e=>{if(i(e))return null;let t=o(e);if(!t.startsWith(`<`))return null;let s=1;for(;s=t.length)return null;let c=t[s]===`/`;if(c)for(s++;s`&&f!==`/`)return null;if(c)return{type:`close`,name:d};if(/\/\s*>\s*$/.test(t))return{type:`open`,name:d,complete:!0};let p=t.indexOf(`>`,s);if(p!==-1){let e=t.slice(p+1);if(RegExp(`<\\s*\\/\\s*${d}\\s*>`,`i`).test(e))return{type:`open`,name:d,complete:!0}}return{type:`open`,name:d,complete:!1}},f=e=>{if(i(e))return null;let t=o(e).replace(/[ \t]+$/,``);if(!t.startsWith(`<`)||/^<\s*(?:!--|!doctype\b|\?)/i.test(t))return null;let n=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*\/\s*>\s*$/i);if(n?.[1])return n[1].toLowerCase();let r=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*>[\s\S]*<\s*\/\s*([A-Z][\w:-]*)\s*>\s*$/i);if(!r?.[1]||!r[2])return null;let a=r[1].toLowerCase();return a===r[2].toLowerCase()?a:null},p=!1,m=``,h=0,g=e=>{let t=0;for(;tg(e),v=e=>{let t=o(e);return t?i(e)?!0:/^(?:#{1,6}[ \t]+|>|[*+-][ \t]+|\d+[.)][ \t]+|`{3,}|~{3,}|\||\$\$|:{3,}|\[\^[^\]]+\]:|-{3,}|\*{3,}|_{3,})/.test(t):!1},y=(t,n,r)=>{let i=t,a=0;for(;ii&&e[t-1]===`\r`,u=o?c?t-1:t:e.length,f=e.slice(i,u),p=s(f),m=p?.key??``;if(a>0&&n&&m!==n)break;let h=p?.content??f,g=d(h);if(g?.name===r){if(g.type===`open`)g.complete||a++;else if(a>0&&(a--,a===0))return!1}else if(a>0&&(l(h)||v(h)))return!0;if(o)i=t+1;else break}return!1},b=``,x=0,S=!0,C=!1,w=!1,T=` `,E=[],D=``;for(;xx&&e[t-1]===`\r`,i=n?r?t-1:t:e.length,a=e.slice(x,i),o=n?r?`\r `:` -`:``,g=s(a),v=g?.key??``,O=g?.content??a,k=_(O);k&&(p?k.markerChar===m&&k.markerLen>=h&&/^\s*$/.test(k.rest)&&(p=!1,m=``,h=0):(p=!0,m=k.markerChar,h=k.markerLen));let A=E.length>0;if(!p&&!A){let e=u(O),t=!!e&&!S&&C&&w&&y(x,v,e);e&&!S&&(!C||t)&&(v&&D&&v===D?b+=`${v}${T}`:v||(b+=T))}if(b+=a,b+=o,o&&(T=o),!p){let e=d(O);if(e){if(e.type===`open`)e.complete||E.push(e.name);else for(let t=E.length-1;t>=0;t--)if(E[t]===e.name){E.length=t;break}}}let j=l(O);S=j,C=!j&&c(O),w=!j&&!!f(O),D=v,x=n?t+1:e.length}return b}function RG(e,t,n={}){let r=YU(n),i=r?qU():0,a=!!n.final,o=(e??``).toString(),s=o.replace(/([^\\])\r(ight|ho)/g,`$1\\r$2`).replace(/([^\\])\r?\n(abla|eq|ot|exists)/g,`$1\\n$2`);if(hW(t,n)&&(t.stream.reset(),gW(t)),a||(s.endsWith(`- *`)&&(s=s.replace(/- \*$/,`- \\*`)),/(?:^|\n)\s*-\s*$/.test(s)?s=s.replace(/(?:^|\n)\s*-\s*$/,e=>e.startsWith(` +`:``,g=s(a),v=g?.key??``,O=g?.content??a,k=_(O);k&&(p?k.markerChar===m&&k.markerLen>=h&&/^\s*$/.test(k.rest)&&(p=!1,m=``,h=0):(p=!0,m=k.markerChar,h=k.markerLen));let A=E.length>0;if(!p&&!A){let e=u(O),t=!!e&&!S&&C&&w&&y(x,v,e);e&&!S&&(!C||t)&&(v&&D&&v===D?b+=`${v}${T}`:v||(b+=T))}if(b+=a,b+=o,o&&(T=o),!p){let e=d(O);if(e){if(e.type===`open`)e.complete||E.push(e.name);else for(let t=E.length-1;t>=0;t--)if(E[t]===e.name){E.length=t;break}}}let j=l(O);S=j,C=!j&&c(O),w=!j&&!!f(O),D=v,x=n?t+1:e.length}return b}function UG(e,t,n={}){let r=eW(n),i=r?QU():0,a=!!n.final,o=(e??``).toString(),s=o.replace(/([^\\])\r(ight|ho)/g,`$1\\r$2`).replace(/([^\\])\r?\n(abla|eq|ot|exists)/g,`$1\\n$2`);if(bW(t,n)&&(t.stream.reset(),xW(t)),a||(s.endsWith(`- *`)&&(s=s.replace(/- \*$/,`- \\*`)),/(?:^|\n)\s*-\s*$/.test(s)?s=s.replace(/(?:^|\n)\s*-\s*$/,e=>e.startsWith(` `)?` `:``):/(?:^|\n)\s*--\s*$/.test(s)?s=s.replace(/(?:^|\n)\s*--\s*$/,e=>e.startsWith(` `)?` @@ -866,30 +866,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `:``)):/(?:^|\n)\s*\d+[.)]\s+\*{1,3}\s*$/.test(s)?s=s.replace(/((?:^|\n)\s*\d+[.)]\s+)(\*{1,3})\s*$/,(e,t,n)=>`${t}${n.split(``).map(()=>`\\*`).join(``)}`):/(?:^|\n)\s*\d+[.)]\s*$/.test(s)?s=s.replace(/(?:^|\n)\s*\d+[.)]\s*$/,e=>e.startsWith(` `)?` `:``):/\n[[(]\n*$/.test(s)&&(s=s.replace(/(\n\[|\n\()+\n*$/g,` -`)),s=BW(s,t),s=FW(s,n.customHtmlTags)??s),n.customHtmlTags?.length&&s.includes(`<`)){let e=_L(n.customHtmlTags);if(e.length&&(s=PG(s,e),s=FG(s,e),s=LG(s,e),s=IG(s,e),s.includes(`[\t ]*)(\r?\n)(?![\t ]*\r?\n|$)`,`gim`);s=s.replace(e,`$1$2$2`)}}a||(s=MG(s));let c=iG(s);if(c){if(n.includeSourceMap){let e={...n,__sourceLineMapper:NG(o,s)};c[0].sourceMap=VH(s,0,s.length,e)}let e=n.preTransformTokens,l=n.postTransformTokens;if(mW(t,n)||typeof e==`function`||typeof l==`function`){let r=QW(t,s,{__markstreamFinal:a},n),i=typeof e==`function`&&e(r)||r;typeof l==`function`&&l(i)}return QU(c,n,r,i)}let l=QW(t,s,{__markstreamFinal:a},n);if(!l||!Array.isArray(l))return QU([],n,r,i);let u=n.preTransformTokens,d=n.postTransformTokens,f=l;u&&typeof u==`function`&&(f=u(f)||f);let p=t,m=typeof p.validateLink==`function`&&p.__markstreamOriginalValidateLink&&p.validateLink!==p.__markstreamOriginalValidateLink?p.validateLink:void 0,h=n.validateLink??m??p.options?.validateLink??(typeof p.validateLink==`function`?p.validateLink:void 0),g={...n,validateLink:h,__markdownIt:t,__sourceLineMapper:n.includeSourceMap===!0?NG(o,s):void 0,__sourceMarkdown:s,__customHtmlBlockCursor:0},_=oW(t,s,f,g,r);if(d&&typeof d==`function`){let e=d(f);if(Array.isArray(e)){let t=e[0],n=t?.type;_=t&&typeof n==`string`?$U(e,{...g,__customHtmlBlockCursor:0},r):e}}if(TG(_)&&(_=jG(_,a,s,g),_=AG(_,s,t,g,a)[0],_=wG(_,t,g,a)),a){let e=new WeakSet,t=n=>{if(!n||typeof n!=`object`||e.has(n))return;if(e.add(n),Array.isArray(n)){for(let e of n)t(e);return}let r=n;r.type===`html_block`&&r.loading===!0&&(r.loading=!1);for(let e of Object.values(r))t(e)};t(_)}return _=ZU(_,n),n.debug&&console.log(`Parsed Markdown Tree Structure:`,_),XU(_,r,i)}function zG(e,t){if(!e||!Array.isArray(e))return[];let n=[],r=OR(t),i=t?.includeSourceMap===!0,a=0;for(;ae.type===`html_block`)){if(i)for(let e of a)UH(e,s,t);for(let e of a)IU(e,s,t);n.push(...a)}else{let r={type:`paragraph`,raw:e,children:a};i&&UH(r,s,t);let o=rG(r,t);if(o){i&&nG(o,r);for(let e of o)IU(e,s,t);n.push(...o)}else IU(r,s,t),n.push(r)}r.remember(e)}a+=1;break;default:a+=1;break}}return n}var BG=/^([a-z][\w-]*)(?=[\t\n\f\r />]|$)/i,VG=new Set([...UI,`base`,`button`,`datalist`,`dialog`,`embed`,`fieldset`,`form`,`iframe`,`input`,`legend`,`link`,`meta`,`object`,`optgroup`,`option`,`output`,`param`,`select`,`style`,`template`,`textarea`,`title`]),HG=new Set(`a.abbr.b.blockquote.br.caption.code.col.colgroup.dd.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.ins.kbd.li.mark.ol.p.picture.pre.s.small.source.span.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.ul`.split(`.`));function UG(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function WG(e){return typeof e==`string`?e:e==null?``:String(e)}function GG(e){return/^[^\s"'<>`=]+$/.test(e)&&!/^on/i.test(e)}function KG(e){return WG(e).replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function qG(e){return KG(e).replace(/`/g,```)}function JG(e){return String(e??``).trim().toLowerCase()}function YG(e,t=`safe`){let n=JG(e);return n?t===`escape`?!0:t===`trusted`?UI.has(n):!HG.has(n):!1}function XG(e,t=`safe`){let n=JG(e);return n?t===`escape`?!0:t===`trusted`?UI.has(n):VG.has(n):!1}function ZG(e){let t=Object.entries(e);return t.length===0?``:t.map(([e,t])=>t===``?` ${e}`:` ${e}="${qG(t)}"`).join(``)}function QG(e){let t=e.startsWith(`/`),n=t?e.slice(1):e,r=n.match(BG);return r?{attrsStr:t?``:n.slice(r[0].length).trimStart(),isClosing:t,isSelfClosing:!t&&e.trimEnd().endsWith(`/`),tagName:r[1]}:null}function $G(e,t){let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length===0?!1:n.some(e=>{let n=e.split(/\s+/,1)[0]??``;return!n||rL(n,{tagName:t,attrName:`srcset`})})}function eK(e,t,n,r){return VI.has(e)||n===`safe`&&e===`style`?!0:e===`srcset`?$G(t,r):!!(HI.has(e)&&t&&rL(t,{tagName:r,attrName:e}))}function tK(e,t){let n=t.toLowerCase();return Object.keys(e).find(e=>e.toLowerCase()===n)}function nK(e,t,n,r=!1){if(t!==`safe`||JG(n)!==`a`)return e;let i=tK(e,`href`);if(r&&(!i||!e[i])){let t=tK(e,`target`),n=tK(e,`rel`);return t&&delete e[t],n&&delete e[n],e}let a=tK(e,`target`);if((a?String(e[a]).trim():``).toLowerCase()!==`_blank`)return e;let o=tK(e,`rel`),s=new Set(String(o?e[o]:``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));return s.add(`noopener`),s.add(`noreferrer`),o&&o!==`rel`&&delete e[o],e.rel=Array.from(s).join(` `),e}function rK(e,t=`safe`,n){let r={};for(let[i,a]of Object.entries(e)){let e=i.trim(),o=e.toLowerCase();!e||!GG(e)||eK(o,a,t,n)||(r[e]=a)}return nK(r,t,n,!!tK(e,`href`))}function iK(e,t){let n=e.toLowerCase();return BI.has(n)?!1:UG(t,n)||UG(t,e)}function aK(e,t=`safe`,n){let r={};for(let[i,a]of Object.entries(e)){let e=i.trim(),o=e.toLowerCase();!e||!GG(e)||eK(o,a,t,n)||(r[e]=a)}return nK(r,t,n,!!tK(e,`href`))}function oK(e){let t={};if(!Array.isArray(e)||e.length===0)return t;for(let[n,r]of e)n&&(t[String(n)]=r==null?``:String(r));return t}function sK(e,t=`safe`,n){let r=aK(oK(e),t,n),i=Object.entries(r).map(([e,t])=>[e,t]);return i.length>0?i:void 0}function cK(e,t){let n=t.toLowerCase();if([`checked`,`disabled`,`readonly`,`required`,`autofocus`,`multiple`,`hidden`].includes(n))return e===`true`||e===``||e===t;if([`value`,`min`,`max`,`step`,`width`,`height`,`size`,`maxlength`].includes(n)){let t=Number(e);if(e!==``&&!Number.isNaN(t))return t}return e}function lK(e){let t={};for(let[n,r]of Object.entries(e))t[n]=cK(r,n);return t}function uK(e){return e.trim().length>0}function dK(e){let t=[],n=0;for(;n`,n);if(t!==-1){n=t+3;continue}break}let r=e.indexOf(`<`,n);if(r===-1){if(nn){let i=e.slice(n,r);uK(i)&&t.push({type:`text`,content:i})}if(e.startsWith(`![CDATA[`,r+1)){let i=e.indexOf(`]]>`,r);if(i!==-1){t.push({type:`text`,content:e.slice(r,i+3)}),n=i+3;continue}break}if(e.startsWith(`!`,r+1)){let t=e.indexOf(`>`,r);if(t!==-1){n=t+1;continue}break}let i=e.indexOf(`>`,r);if(i===-1)break;let a=QG(e.slice(r+1,i));if(!a){let a=e.slice(r,i+1);uK(a)&&t.push({type:`text`,content:a}),n=i+1;continue}if(a.isClosing)t.push({type:`tag_close`,tagName:a.tagName});else{let e={};if(a.attrsStr){let t=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g,n;for(;(n=t.exec(a.attrsStr))!==null;){let t=n[1],r=n[2]??n[3]??n[4]??``;t&&!t.endsWith(`/`)&&(e[t]=r)}}t.push({type:a.isSelfClosing||LI.has(a.tagName.toLowerCase())?`self_closing`:`tag_open`,tagName:a.tagName,attrs:e})}n=i+1}return t}function fK(e){let t=[],n=0;for(;n`,n);if(t!==-1){n=t+3;continue}break}let r=e.indexOf(`<`,n);if(r===-1){nn&&t.push({type:`text`,content:e.slice(n,r)}),e.startsWith(`![CDATA[`,r+1)){let i=e.indexOf(`]]>`,r);if(i!==-1){t.push({type:`text`,content:e.slice(r,i+3)}),n=i+3;continue}break}if(e.startsWith(`!`,r+1)){let t=e.indexOf(`>`,r);if(t!==-1){n=t+1;continue}break}let i=e.indexOf(`>`,r);if(i===-1)break;let a=QG(e.slice(r+1,i));if(!a){t.push({type:`text`,content:e.slice(r,i+1)}),n=i+1;continue}if(a.isClosing){t.push({type:`tag_close`,tagName:a.tagName}),n=i+1;continue}let o={};if(a.attrsStr){let e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g,t;for(;(t=e.exec(a.attrsStr))!==null;){let e=t[1],n=t[2]??t[3]??t[4]??``;e&&!e.endsWith(`/`)&&(o[e]=n)}}t.push({type:a.isSelfClosing||LI.has(a.tagName.toLowerCase())?`self_closing`:`tag_open`,tagName:a.tagName,attrs:o}),n=i+1}return t}function pK(e){let t=String(e.tagName??``).trim();if(!t)return``;if(e.type===`tag_close`)return`</${KG(t)}>`;let n=Object.entries(e.attrs??{}).map(([e,t])=>t===``?` ${KG(e)}`:` ${KG(e)}="${qG(t)}"`).join(``);return e.type===`self_closing`?`<${KG(t)}${n} />`:`<${KG(t)}${n}>`}function mK(e,t){if(!e||!e.includes(`<`)||!t||Object.keys(t).length===0)return!1;for(let n of dK(e))if((n.type===`tag_open`||n.type===`self_closing`)&&iK(n.tagName??``,t))return!0;return!1}function hK(e,t=`safe`){if(!e)return``;if(t===`escape`)return KG(e);let n=fK(e),r=[],i=[],a=[];for(let e of n){if(e.type===`text`){a.length===0&&i.push(KG(e.content??``));continue}let n=JG(e.tagName);if(!n)continue;if(XG(n,t)){e.type===`tag_open`?a.push(n):e.type===`tag_close`&&a[a.length-1]===n&&a.pop();continue}if(a.length>0)continue;if(t===`safe`&&YG(n,t)){i.push(pK(e));continue}if(e.type===`self_closing`){i.push(`<${n}${ZG(rK(e.attrs??{},t,n))}>`);continue}if(e.type===`tag_open`){i.push(`<${n}${ZG(rK(e.attrs??{},t,n))}>`),LI.has(n)||r.push(n);continue}let o=r.lastIndexOf(n);if(o===-1)continue;for(;r.length>o+1;){let e=r.pop();e&&i.push(``)}let s=r.pop();s&&i.push(``)}for(;r.length>0;){let e=r.pop();e&&i.push(``)}return i.join(``)}var gK=[/javascript:/i,/vbscript:/i,/data:text\/html/i,/expression\s*\(/i,/@import/i],_K=`http://www.w3.org/2000/svg`,vK=new Set([`script`,`style`,`iframe`,`object`,`embed`,`link`,`meta`]),yK=new Set([`svg`,`style`,`g`,`a`,`defs`,`marker`,`path`,`rect`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`text`,`tspan`,`title`,`desc`,`use`,`image`,`lineargradient`,`radialgradient`,`stop`,`clippath`,`mask`,`pattern`]),bK=new Set([`href`,`xlink:href`,`src`,`srcdoc`,`action`,`data`,`formaction`,`poster`]),xK=new Set([`clip-path`,`fill`,`filter`,`marker-end`,`marker-mid`,`marker-start`,`mask`,`stroke`]),SK=new Set([`circle`,`ellipse`,`image`,`line`,`path`,`polygon`,`polyline`,`rect`,`text`,`tspan`,`use`]);function CK(e){return(e.getAttribute(`href`)||e.getAttribute(`xlink:href`))?.startsWith(`#`)===!0}function wK(e){return!!(e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||e.getAttribute(`src`))}function TK(e){let t=e.nodeName.toLowerCase();return t===`use`?CK(e):t===`image`?wK(e):t===`text`||t===`tspan`?!!e.textContent?.trim():SK.has(t)}function EK(e){return e.replace(/(["'])\s*javascript:/gi,`$1#`).replace(/\bjavascript:/gi,`#`).replace(/(["'])\s*vbscript:/gi,`$1#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function DK(e,t,n){let r=e.toLowerCase(),i=t.toLowerCase(),a=String(n??``).trim();return a?(r===`use`||r===`marker`||r===`clippath`||r===`mask`)&&(i===`href`||i===`xlink:href`)?a.startsWith(`#`)?a:``:r===`a`&&(i===`href`||i===`xlink:href`)?rL(a,{tagName:`a`,attrName:`href`})?``:a:r===`image`&&(i===`href`||i===`xlink:href`||i===`src`)?rL(a,{tagName:`img`,attrName:`src`})?``:a:i===`href`||i===`xlink:href`?a.startsWith(`#`)?a:``:rL(a,{tagName:r,attrName:i})?``:a:``}function OK(e,t){let n=t+4;for(;n{let n=t.trim();if(/^[0-9a-f]+$/i.test(n)){let e=Number.parseInt(n,16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return String(t).trim()})}function AK(e){let t=kK(e),n=t.toLowerCase(),r=0;for(;re.test(t))||AK(t)}function MK(e){if(e.tagName.toLowerCase()!==`a`||e.getAttribute(`target`)?.trim().toLowerCase()!==`_blank`)return;let t=new Set(String(e.getAttribute(`rel`)??``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));t.add(`noopener`),t.add(`noreferrer`),e.setAttribute(`rel`,Array.from(t).join(` `))}function NK(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)?t:0}function PK(e,t){if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;n&&t.push(n);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=n.tagName.toLowerCase();if(!vK.has(r)){if(r===`br`){t.push(` -`);return}for(let e of Array.from(n.childNodes))PK(e,t)}}function FK(e){for(let t of Array.from(e.querySelectorAll(`foreignObject`))){let n=[];PK(t,n);let r=n.join(``).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(!r.length){t.remove();continue}let i=NK(t.getAttribute(`width`)),a=NK(t.getAttribute(`height`)),o=NK(t.getAttribute(`x`)),s=NK(t.getAttribute(`y`)),c=e.ownerDocument.createElementNS(_K,`text`);c.setAttribute(`x`,String(o+i/2)),c.setAttribute(`y`,String(s+a/2)),c.setAttribute(`text-anchor`,`middle`),c.setAttribute(`dominant-baseline`,`central`);let l=t.querySelector(`.nodeLabel`);if(l?.getAttribute(`class`)&&c.setAttribute(`class`,l.getAttribute(`class`)),r.length===1)c.textContent=r[0];else{let t=-.6*(r.length-1);for(let[n,a]of r.entries()){let r=e.ownerDocument.createElementNS(_K,`tspan`);r.setAttribute(`x`,String(o+i/2)),r.setAttribute(`dy`,n===0?`${t}em`:`1.2em`),r.textContent=a,c.appendChild(r)}}t.parentNode?.replaceChild(c,t)}}function IK(e){FK(e);let t=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of t){let t=e.tagName.toLowerCase();if(!yK.has(t)){e.remove();continue}if(t===`style`&&jK(e.textContent??``)){e.remove();continue}let n=Array.from(e.attributes);for(let r of n){let n=r.name.toLowerCase();if(/^on/i.test(n)){e.removeAttribute(r.name);continue}if(n===`style`&&r.value&&jK(r.value)){e.removeAttribute(r.name);continue}if(n===`srcdoc`){e.removeAttribute(r.name);continue}if(bK.has(n)&&r.value){let i=DK(t,n,r.value);if(!i){e.removeAttribute(r.name);continue}i!==r.value&&e.setAttribute(r.name,i);continue}if(xK.has(n)&&r.value&&AK(r.value)){e.removeAttribute(r.name);continue}if(r.value){let t=EK(r.value);t!==r.value&&e.setAttribute(r.name,t)}}MK(e)}}function LK(e){if(typeof DOMParser>`u`||!e)return null;try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement;if(!t||t.nodeName.toLowerCase()!==`svg`)return null;let n=t;return IK(n),RK(n)?null:n}catch{return null}}function RK(e){let t=e.getAttribute(`viewBox`);if(t){let e=t.trim().split(/[\s,]+/);if(e.length===4){let t=Number.parseFloat(e[2]||``),n=Number.parseFloat(e[3]||``);if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return!0}}let n=[e,...Array.from(e.querySelectorAll(`*`))],r=!1;for(let e of n){TK(e)&&(r=!0);for(let t of Array.from(e.attributes))if(/\bNaN\b/i.test(t.value)||t.name===`style`&&/max-width:\s*0(?:px)?/i.test(t.value))return!0}return!r}var zK=[];function BK(e){return String(e??``).replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function VK(e){return(String(e||`text`).trim().split(/\s+/)[0]||`text`).replace(/[^\w+.#:-]/g,`-`).replace(/-+/g,`-`)||`text`}function HK(e){return e.replace(/[^\w:.+-]/g,`-`).replace(/-+/g,`-`)}function UK(e=`editor-${Date.now()}`,t={}){let n=WB(t),r=n;r.__markstreamRegisteredPluginCount=zK.length,r.__markstreamHasCustomParserExtensions=!!(t.plugin?.length||t.apply?.length||zK.length);let i={"common.copy":`Copy`},a;if(typeof t.i18n==`function`)a=t.i18n;else if(t.i18n&&typeof t.i18n==`object`){let e=t.i18n;a=t=>e[t]??i[t]??t}else a=e=>i[e]??e;if(Array.isArray(t.plugin))for(let e of t.plugin){let t=e;if(Array.isArray(t)){let[e,...r]=t;typeof e==`function`&&n.use(e,...r)}else typeof t==`function`&&n.use(t)}if(Array.isArray(t.apply))for(let e of t.apply)try{e(n)}catch(e){console.error(`[getMarkdown] apply function threw an error`,e)}if(zK.length)for(let e of zK)if(Array.isArray(e)){let[t,...r]=e;typeof t==`function`&&n.use(t,...r)}else typeof e==`function`&&n.use(e);n.use(Foe),n.use(Roe),n.use(Moe);let o=Qoe,s=o.default??o;n.use(s),n.use(joe),n.use(Aoe),n.core.ruler.after(`block`,`mark_fence_closed`,e=>{let t=e,n=t.src,r=!!t.env?.__markstreamFinal,i=n.split(/\r?\n/);for(let e of t.tokens){if(e.type!==`fence`||!e.map||!e.markup)continue;let t=e.map[0],n=e.map[1],a=e.markup,o=a[0],s=a.length,c=i[Math.max(0,n-1)]??``,l=0;for(;lt+1&&u>=s&&d===c.length,p=e;p.meta=p.meta??{},p.meta.unclosed=!f,p.meta.closed=!!f}}),n.inline.ruler.before(`sub`,`wave`,(e,t)=>{let n=e,r=n.pos;if(n.src[r]!==`~`)return!1;let i=n.src[r-1],a=n.src[r+1];if(/\d/.test(i)&&/\d/.test(a)){if(!t){let e=n.push(`text`,``,0);e.content=`~`}return n.pos+=1,!0}return!1}),n.renderer.rules.fence=(t,n)=>{let r=t[n],i=String(r.info??``).trim(),o=String(r.content??``),s=btoa(unescape(encodeURIComponent(o))),c=VK(i),l=BK(c),u=HK(`editor-${e}-${n}-${c}`),d=BK(a(`common.copy`));return`
        +`)),s=GW(s,t),s=BW(s,n.customHtmlTags)??s),n.customHtmlTags?.length&&s.includes(`<`)){let e=SL(n.customHtmlTags);if(e.length&&(s=zG(s,e),s=BG(s,e),s=HG(s,e),s=VG(s,e),s.includes(`[\t ]*)(\r?\n)(?![\t ]*\r?\n|$)`,`gim`);s=s.replace(e,`$1$2$2`)}}a||(s=LG(s));let c=lG(s);if(c){if(n.includeSourceMap){let e={...n,__sourceLineMapper:RG(o,s)};c[0].sourceMap=KH(s,0,s.length,e)}let e=n.preTransformTokens,l=n.postTransformTokens;if(yW(t,n)||typeof e==`function`||typeof l==`function`){let r=rG(t,s,{__markstreamFinal:a},n),i=typeof e==`function`&&e(r)||r;typeof l==`function`&&l(i)}return rW(c,n,r,i)}let l=rG(t,s,{__markstreamFinal:a},n);if(!l||!Array.isArray(l))return rW([],n,r,i);let u=n.preTransformTokens,d=n.postTransformTokens,f=l;u&&typeof u==`function`&&(f=u(f)||f);let p=t,m=typeof p.validateLink==`function`&&p.__markstreamOriginalValidateLink&&p.validateLink!==p.__markstreamOriginalValidateLink?p.validateLink:void 0,h=n.validateLink??m??p.options?.validateLink??(typeof p.validateLink==`function`?p.validateLink:void 0),g={...n,validateLink:h,__markdownIt:t,__sourceLineMapper:n.includeSourceMap===!0?RG(o,s):void 0,__sourceMarkdown:s,__customHtmlBlockCursor:0},_=dW(t,s,f,g,r);if(d&&typeof d==`function`){let e=d(f);if(Array.isArray(e)){let t=e[0],n=t?.type;_=t&&typeof n==`string`?iW(e,{...g,__customHtmlBlockCursor:0},r):e}}if(AG(_)&&(_=IG(_,a,s,g),_=FG(_,s,t,g,a)[0],_=kG(_,t,g,a)),a){let e=new WeakSet,t=n=>{if(!n||typeof n!=`object`||e.has(n))return;if(e.add(n),Array.isArray(n)){for(let e of n)t(e);return}let r=n;r.type===`html_block`&&r.loading===!0&&(r.loading=!1);for(let e of Object.values(r))t(e)};t(_)}return _=nW(_,n),n.debug&&console.log(`Parsed Markdown Tree Structure:`,_),tW(_,r,i)}function WG(e,t){if(!e||!Array.isArray(e))return[];let n=[],r=NR(t),i=t?.includeSourceMap===!0,a=0;for(;ae.type===`html_block`)){if(i)for(let e of a)JH(e,s,t);for(let e of a)VU(e,s,t);n.push(...a)}else{let r={type:`paragraph`,raw:e,children:a};i&&JH(r,s,t);let o=cG(r,t);if(o){i&&sG(o,r);for(let e of o)VU(e,s,t);n.push(...o)}else VU(r,s,t),n.push(r)}r.remember(e)}a+=1;break;default:a+=1;break}}return n}var GG=/^([a-z][\w-]*)(?=[\t\n\f\r />]|$)/i,KG=new Set([...JI,`base`,`button`,`datalist`,`dialog`,`embed`,`fieldset`,`form`,`iframe`,`input`,`legend`,`link`,`meta`,`object`,`optgroup`,`option`,`output`,`param`,`select`,`style`,`template`,`textarea`,`title`]),qG=new Set(`a.abbr.b.blockquote.br.caption.code.col.colgroup.dd.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.ins.kbd.li.mark.ol.p.picture.pre.s.small.source.span.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.ul`.split(`.`));function JG(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function YG(e){return typeof e==`string`?e:e==null?``:String(e)}function XG(e){return/^[^\s"'<>`=]+$/.test(e)&&!/^on/i.test(e)}function ZG(e){return YG(e).replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function QG(e){return ZG(e).replace(/`/g,```)}function $G(e){return String(e??``).trim().toLowerCase()}function eK(e,t=`safe`){let n=$G(e);return n?t===`escape`?!0:t===`trusted`?JI.has(n):!qG.has(n):!1}function tK(e,t=`safe`){let n=$G(e);return n?t===`escape`?!0:t===`trusted`?JI.has(n):KG.has(n):!1}function nK(e){let t=Object.entries(e);return t.length===0?``:t.map(([e,t])=>t===``?` ${e}`:` ${e}="${QG(t)}"`).join(``)}function rK(e){let t=e.startsWith(`/`),n=t?e.slice(1):e,r=n.match(GG);return r?{attrsStr:t?``:n.slice(r[0].length).trimStart(),isClosing:t,isSelfClosing:!t&&e.trimEnd().endsWith(`/`),tagName:r[1]}:null}function iK(e,t){let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length===0?!1:n.some(e=>{let n=e.split(/\s+/,1)[0]??``;return!n||cL(n,{tagName:t,attrName:`srcset`})})}function aK(e,t,n,r){return KI.has(e)||n===`safe`&&e===`style`?!0:e===`srcset`?iK(t,r):!!(qI.has(e)&&t&&cL(t,{tagName:r,attrName:e}))}function oK(e,t){let n=t.toLowerCase();return Object.keys(e).find(e=>e.toLowerCase()===n)}function sK(e,t,n,r=!1){if(t!==`safe`||$G(n)!==`a`)return e;let i=oK(e,`href`);if(r&&(!i||!e[i])){let t=oK(e,`target`),n=oK(e,`rel`);return t&&delete e[t],n&&delete e[n],e}let a=oK(e,`target`);if((a?String(e[a]).trim():``).toLowerCase()!==`_blank`)return e;let o=oK(e,`rel`),s=new Set(String(o?e[o]:``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));return s.add(`noopener`),s.add(`noreferrer`),o&&o!==`rel`&&delete e[o],e.rel=Array.from(s).join(` `),e}function cK(e,t=`safe`,n){let r={};for(let[i,a]of Object.entries(e)){let e=i.trim(),o=e.toLowerCase();!e||!XG(e)||aK(o,a,t,n)||(r[e]=a)}return sK(r,t,n,!!oK(e,`href`))}function lK(e,t){let n=e.toLowerCase();return GI.has(n)?!1:JG(t,n)||JG(t,e)}function uK(e,t=`safe`,n){let r={};for(let[i,a]of Object.entries(e)){let e=i.trim(),o=e.toLowerCase();!e||!XG(e)||aK(o,a,t,n)||(r[e]=a)}return sK(r,t,n,!!oK(e,`href`))}function dK(e){let t={};if(!Array.isArray(e)||e.length===0)return t;for(let[n,r]of e)n&&(t[String(n)]=r==null?``:String(r));return t}function fK(e,t=`safe`,n){let r=uK(dK(e),t,n),i=Object.entries(r).map(([e,t])=>[e,t]);return i.length>0?i:void 0}function pK(e,t){let n=t.toLowerCase();if([`checked`,`disabled`,`readonly`,`required`,`autofocus`,`multiple`,`hidden`].includes(n))return e===`true`||e===``||e===t;if([`value`,`min`,`max`,`step`,`width`,`height`,`size`,`maxlength`].includes(n)){let t=Number(e);if(e!==``&&!Number.isNaN(t))return t}return e}function mK(e){let t={};for(let[n,r]of Object.entries(e))t[n]=pK(r,n);return t}function hK(e){return e.trim().length>0}function gK(e){let t=[],n=0;for(;n`,n);if(t!==-1){n=t+3;continue}break}let r=e.indexOf(`<`,n);if(r===-1){if(nn){let i=e.slice(n,r);hK(i)&&t.push({type:`text`,content:i})}if(e.startsWith(`![CDATA[`,r+1)){let i=e.indexOf(`]]>`,r);if(i!==-1){t.push({type:`text`,content:e.slice(r,i+3)}),n=i+3;continue}break}if(e.startsWith(`!`,r+1)){let t=e.indexOf(`>`,r);if(t!==-1){n=t+1;continue}break}let i=e.indexOf(`>`,r);if(i===-1)break;let a=rK(e.slice(r+1,i));if(!a){let a=e.slice(r,i+1);hK(a)&&t.push({type:`text`,content:a}),n=i+1;continue}if(a.isClosing)t.push({type:`tag_close`,tagName:a.tagName});else{let e={};if(a.attrsStr){let t=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g,n;for(;(n=t.exec(a.attrsStr))!==null;){let t=n[1],r=n[2]??n[3]??n[4]??``;t&&!t.endsWith(`/`)&&(e[t]=r)}}t.push({type:a.isSelfClosing||HI.has(a.tagName.toLowerCase())?`self_closing`:`tag_open`,tagName:a.tagName,attrs:e})}n=i+1}return t}function _K(e){let t=[],n=0;for(;n`,n);if(t!==-1){n=t+3;continue}break}let r=e.indexOf(`<`,n);if(r===-1){nn&&t.push({type:`text`,content:e.slice(n,r)}),e.startsWith(`![CDATA[`,r+1)){let i=e.indexOf(`]]>`,r);if(i!==-1){t.push({type:`text`,content:e.slice(r,i+3)}),n=i+3;continue}break}if(e.startsWith(`!`,r+1)){let t=e.indexOf(`>`,r);if(t!==-1){n=t+1;continue}break}let i=e.indexOf(`>`,r);if(i===-1)break;let a=rK(e.slice(r+1,i));if(!a){t.push({type:`text`,content:e.slice(r,i+1)}),n=i+1;continue}if(a.isClosing){t.push({type:`tag_close`,tagName:a.tagName}),n=i+1;continue}let o={};if(a.attrsStr){let e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g,t;for(;(t=e.exec(a.attrsStr))!==null;){let e=t[1],n=t[2]??t[3]??t[4]??``;e&&!e.endsWith(`/`)&&(o[e]=n)}}t.push({type:a.isSelfClosing||HI.has(a.tagName.toLowerCase())?`self_closing`:`tag_open`,tagName:a.tagName,attrs:o}),n=i+1}return t}function vK(e){let t=String(e.tagName??``).trim();if(!t)return``;if(e.type===`tag_close`)return`</${ZG(t)}>`;let n=Object.entries(e.attrs??{}).map(([e,t])=>t===``?` ${ZG(e)}`:` ${ZG(e)}="${QG(t)}"`).join(``);return e.type===`self_closing`?`<${ZG(t)}${n} />`:`<${ZG(t)}${n}>`}function yK(e,t){if(!e||!e.includes(`<`)||!t||Object.keys(t).length===0)return!1;for(let n of gK(e))if((n.type===`tag_open`||n.type===`self_closing`)&&lK(n.tagName??``,t))return!0;return!1}function bK(e,t=`safe`){if(!e)return``;if(t===`escape`)return ZG(e);let n=_K(e),r=[],i=[],a=[];for(let e of n){if(e.type===`text`){a.length===0&&i.push(ZG(e.content??``));continue}let n=$G(e.tagName);if(!n)continue;if(tK(n,t)){e.type===`tag_open`?a.push(n):e.type===`tag_close`&&a[a.length-1]===n&&a.pop();continue}if(a.length>0)continue;if(t===`safe`&&eK(n,t)){i.push(vK(e));continue}if(e.type===`self_closing`){i.push(`<${n}${nK(cK(e.attrs??{},t,n))}>`);continue}if(e.type===`tag_open`){i.push(`<${n}${nK(cK(e.attrs??{},t,n))}>`),HI.has(n)||r.push(n);continue}let o=r.lastIndexOf(n);if(o===-1)continue;for(;r.length>o+1;){let e=r.pop();e&&i.push(``)}let s=r.pop();s&&i.push(``)}for(;r.length>0;){let e=r.pop();e&&i.push(``)}return i.join(``)}var xK=[/javascript:/i,/vbscript:/i,/data:text\/html/i,/expression\s*\(/i,/@import/i],SK=`http://www.w3.org/2000/svg`,CK=new Set([`script`,`style`,`iframe`,`object`,`embed`,`link`,`meta`]),wK=new Set([`svg`,`style`,`g`,`a`,`defs`,`marker`,`path`,`rect`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`text`,`tspan`,`title`,`desc`,`use`,`image`,`lineargradient`,`radialgradient`,`stop`,`clippath`,`mask`,`pattern`]),TK=new Set([`href`,`xlink:href`,`src`,`srcdoc`,`action`,`data`,`formaction`,`poster`]),EK=new Set([`clip-path`,`fill`,`filter`,`marker-end`,`marker-mid`,`marker-start`,`mask`,`stroke`]),DK=new Set([`circle`,`ellipse`,`image`,`line`,`path`,`polygon`,`polyline`,`rect`,`text`,`tspan`,`use`]);function OK(e){return(e.getAttribute(`href`)||e.getAttribute(`xlink:href`))?.startsWith(`#`)===!0}function kK(e){return!!(e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||e.getAttribute(`src`))}function AK(e){let t=e.nodeName.toLowerCase();return t===`use`?OK(e):t===`image`?kK(e):t===`text`||t===`tspan`?!!e.textContent?.trim():DK.has(t)}function jK(e){return e.replace(/(["'])\s*javascript:/gi,`$1#`).replace(/\bjavascript:/gi,`#`).replace(/(["'])\s*vbscript:/gi,`$1#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function MK(e,t,n){let r=e.toLowerCase(),i=t.toLowerCase(),a=String(n??``).trim();return a?(r===`use`||r===`marker`||r===`clippath`||r===`mask`)&&(i===`href`||i===`xlink:href`)?a.startsWith(`#`)?a:``:r===`a`&&(i===`href`||i===`xlink:href`)?cL(a,{tagName:`a`,attrName:`href`})?``:a:r===`image`&&(i===`href`||i===`xlink:href`||i===`src`)?cL(a,{tagName:`img`,attrName:`src`})?``:a:i===`href`||i===`xlink:href`?a.startsWith(`#`)?a:``:cL(a,{tagName:r,attrName:i})?``:a:``}function NK(e,t){let n=t+4;for(;n{let n=t.trim();if(/^[0-9a-f]+$/i.test(n)){let e=Number.parseInt(n,16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return String(t).trim()})}function FK(e){let t=PK(e),n=t.toLowerCase(),r=0;for(;re.test(t))||FK(t)}function LK(e){if(e.tagName.toLowerCase()!==`a`||e.getAttribute(`target`)?.trim().toLowerCase()!==`_blank`)return;let t=new Set(String(e.getAttribute(`rel`)??``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));t.add(`noopener`),t.add(`noreferrer`),e.setAttribute(`rel`,Array.from(t).join(` `))}function RK(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)?t:0}function zK(e,t){if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;n&&t.push(n);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=n.tagName.toLowerCase();if(!CK.has(r)){if(r===`br`){t.push(` +`);return}for(let e of Array.from(n.childNodes))zK(e,t)}}function BK(e){for(let t of Array.from(e.querySelectorAll(`foreignObject`))){let n=[];zK(t,n);let r=n.join(``).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(!r.length){t.remove();continue}let i=RK(t.getAttribute(`width`)),a=RK(t.getAttribute(`height`)),o=RK(t.getAttribute(`x`)),s=RK(t.getAttribute(`y`)),c=e.ownerDocument.createElementNS(SK,`text`);c.setAttribute(`x`,String(o+i/2)),c.setAttribute(`y`,String(s+a/2)),c.setAttribute(`text-anchor`,`middle`),c.setAttribute(`dominant-baseline`,`central`);let l=t.querySelector(`.nodeLabel`);if(l?.getAttribute(`class`)&&c.setAttribute(`class`,l.getAttribute(`class`)),r.length===1)c.textContent=r[0];else{let t=-.6*(r.length-1);for(let[n,a]of r.entries()){let r=e.ownerDocument.createElementNS(SK,`tspan`);r.setAttribute(`x`,String(o+i/2)),r.setAttribute(`dy`,n===0?`${t}em`:`1.2em`),r.textContent=a,c.appendChild(r)}}t.parentNode?.replaceChild(c,t)}}function VK(e){BK(e);let t=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of t){let t=e.tagName.toLowerCase();if(!wK.has(t)){e.remove();continue}if(t===`style`&&IK(e.textContent??``)){e.remove();continue}let n=Array.from(e.attributes);for(let r of n){let n=r.name.toLowerCase();if(/^on/i.test(n)){e.removeAttribute(r.name);continue}if(n===`style`&&r.value&&IK(r.value)){e.removeAttribute(r.name);continue}if(n===`srcdoc`){e.removeAttribute(r.name);continue}if(TK.has(n)&&r.value){let i=MK(t,n,r.value);if(!i){e.removeAttribute(r.name);continue}i!==r.value&&e.setAttribute(r.name,i);continue}if(EK.has(n)&&r.value&&FK(r.value)){e.removeAttribute(r.name);continue}if(r.value){let t=jK(r.value);t!==r.value&&e.setAttribute(r.name,t)}}LK(e)}}function HK(e){if(typeof DOMParser>`u`||!e)return null;try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement;if(!t||t.nodeName.toLowerCase()!==`svg`)return null;let n=t;return VK(n),UK(n)?null:n}catch{return null}}function UK(e){let t=e.getAttribute(`viewBox`);if(t){let e=t.trim().split(/[\s,]+/);if(e.length===4){let t=Number.parseFloat(e[2]||``),n=Number.parseFloat(e[3]||``);if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return!0}}let n=[e,...Array.from(e.querySelectorAll(`*`))],r=!1;for(let e of n){AK(e)&&(r=!0);for(let t of Array.from(e.attributes))if(/\bNaN\b/i.test(t.value)||t.name===`style`&&/max-width:\s*0(?:px)?/i.test(t.value))return!0}return!r}var WK=[];function GK(e){return String(e??``).replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function KK(e){return(String(e||`text`).trim().split(/\s+/)[0]||`text`).replace(/[^\w+.#:-]/g,`-`).replace(/-+/g,`-`)||`text`}function qK(e){return e.replace(/[^\w:.+-]/g,`-`).replace(/-+/g,`-`)}function JK(e=`editor-${Date.now()}`,t={}){let n=YB(t),r=n;r.__markstreamRegisteredPluginCount=WK.length,r.__markstreamHasCustomParserExtensions=!!(t.plugin?.length||t.apply?.length||WK.length);let i={"common.copy":`Copy`},a;if(typeof t.i18n==`function`)a=t.i18n;else if(t.i18n&&typeof t.i18n==`object`){let e=t.i18n;a=t=>e[t]??i[t]??t}else a=e=>i[e]??e;if(Array.isArray(t.plugin))for(let e of t.plugin){let t=e;if(Array.isArray(t)){let[e,...r]=t;typeof e==`function`&&n.use(e,...r)}else typeof t==`function`&&n.use(t)}if(Array.isArray(t.apply))for(let e of t.apply)try{e(n)}catch(e){console.error(`[getMarkdown] apply function threw an error`,e)}if(WK.length)for(let e of WK)if(Array.isArray(e)){let[t,...r]=e;typeof t==`function`&&n.use(t,...r)}else typeof e==`function`&&n.use(e);n.use(Loe),n.use(Boe),n.use(Poe);let o=ese,s=o.default??o;n.use(s),n.use(Noe),n.use(Moe),n.core.ruler.after(`block`,`mark_fence_closed`,e=>{let t=e,n=t.src,r=!!t.env?.__markstreamFinal,i=n.split(/\r?\n/);for(let e of t.tokens){if(e.type!==`fence`||!e.map||!e.markup)continue;let t=e.map[0],n=e.map[1],a=e.markup,o=a[0],s=a.length,c=i[Math.max(0,n-1)]??``,l=0;for(;lt+1&&u>=s&&d===c.length,p=e;p.meta=p.meta??{},p.meta.unclosed=!f,p.meta.closed=!!f}}),n.inline.ruler.before(`sub`,`wave`,(e,t)=>{let n=e,r=n.pos;if(n.src[r]!==`~`)return!1;let i=n.src[r-1],a=n.src[r+1];if(/\d/.test(i)&&/\d/.test(a)){if(!t){let e=n.push(`text`,``,0);e.content=`~`}return n.pos+=1,!0}return!1}),n.renderer.rules.fence=(t,n)=>{let r=t[n],i=String(r.info??``).trim(),o=String(r.content??``),s=btoa(unescape(encodeURIComponent(o))),c=KK(i),l=GK(c),u=qK(`editor-${e}-${n}-${c}`),d=GK(a(`common.copy`));return`
        - ${BK(c.toUpperCase())} + ${GK(c.toUpperCase())}
        -
        `};let c=/^\[(\d+)\]/,l=/^\[([^\]\n]+)\]/,u=e=>{if(!e.startsWith(`[`))return!1;let t=l.exec(e);if(!t)return e!==`[`&&!/^\[\d+$/.test(e);let n=String(t[1]??``);return e.slice(t[0].length).startsWith(`(`)?!1:!/^\d+$/.test(n)};n.inline.ruler.before(`escape`,`reference`,(e,t)=>{let n=e;if(n.src[n.pos]!==`[`)return!1;let r=c.exec(n.src.slice(n.pos));if(!r)return!1;let i=n.src.slice(Math.max(0,n.pos-120),n.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(i))return!1;let a=n.src.slice(n.pos+r[0].length);if(a.startsWith(`](`)||a.startsWith(`(`)||u(a))return!1;if(!t){let e=r[1],t=n.push(`reference`,`span`,0);t.content=e,t.markup=r[0],t.raw=r[0]}return n.pos+=r[0].length,!0}),n.renderer.rules.reference=(e,t)=>{let n=String(e[t].content??``);return`${n}`};let d=n.use.bind(n);return n.use=((...e)=>(r.__markstreamHasCustomParserExtensions=!0,d(...e))),n}function WK({nextContent:e,previousContent:t,typewriterEnabled:n}){return!n||e===t?{settledContent:e,streamedDelta:``,appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:``,appended:!1}}function GK({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:r,streamRenderVersionChanged:i=!1}){let a=`${n.settledContent}${n.streamedDelta}`;return r?n.streamedDelta&&a===e?i?{settledContent:a,streamedDelta:``,appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:WK({nextContent:e,previousContent:t??a,typewriterEnabled:r}):{settledContent:e,streamedDelta:``,appended:!1}}var KK={plain:`plaintext`,text:`plaintext`,txt:`plaintext`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,ts:`typescript`,mts:`typescript`,cts:`typescript`,golang:`go`,py:`python`,rb:`ruby`,rs:`rust`,kt:`kotlin`,kts:`kotlin`,md:`markdown`,yml:`yaml`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,shell:`shellscript`,shellscript:`shellscript`,ps:`powershell`,ps1:`powershell`,pwsh:`powershell`,"c++":`cpp`,"c#":`csharp`,cs:`csharp`,objc:`objective-c`,objectivec:`objective-c`,"objective-c":`objective-c`,objectivecpp:`objective-cpp`,"objective-c++":`objective-cpp`,"objective-cpp":`objective-cpp`};function qK(e){let t=String(e??``).trim();if(!t)return``;let[n=``]=t.split(/\s+/);return n.split(`:`)[0]?.trim().toLowerCase()??``}function JK(e){let t=qK(e);return KK[t]??t}function YK(e){if(!Array.isArray(e))return;let t=e.filter(e=>typeof e==`string`).map(e=>JK(e)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function XK(e){if(!Array.isArray(e))return;let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();!e||n.has(e)||(n.add(e),t.push(e))}return t.length>0?t:void 0}function ZK(e){return XK(e)?.join(`\0`)??``}function QK(e,t){return`${ZK(e)}\u0000\u0000${YK(t)?.join(`\0`)??``}`}function $K(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.max(n,r):t}function eq(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var tq=class{constructor(e={},t){this.source=``,this.visible=``,this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=e=>this.destroyed?()=>{}:(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.enqueue=e=>{if(this.destroyed||!e)return;this.done&&=!1;let t=this.source.length>0,n=this.pendingChars<=0;if(this.source+=e,n){let e=aq();this.startedAt=t&&this.hasStarted?e-this.normalizedStartDelayMs:e,this.lastTick=e,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(e={})=>{if(!this.destroyed){if(this.done=!0,e.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(e=``)=>{this.destroyed||(this.cancelLoop(),this.source=e,this.visible=e,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;let e=aq();this.lastTick=e,this.startedAt||=e,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=e=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(e-this.startedAtthis.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,a=oq(r/Math.max(.001,i/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(a-this.currentCps)*.2,this.charBudget+=this.currentCps*(n/1e3),this.charBudget<1){this.ensureLoop();return}let o=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),s=iq(this.source.slice(this.visible.length),o,this.segmenter);s.text&&(this.visible+=s.text,this.charBudget=Math.max(0,this.charBudget-s.graphemeCount),this.emit()),this.ensureLoop()};let{minCharsPerSecond:n=40,maxCharsPerSecond:r=1e3,targetLatencyMs:i=900,catchUpLatencyMs:a=350,catchUpThreshold:o=600,maxCommitFps:s=30,startDelayMs:c=80,maxCharsPerCommit:l=80,flushOnFinish:u=!1}=e;this.minCharsPerSecond=$K(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,$K(r,1e3,1)),this.normalizedTargetLatencyMs=$K(i,900,1),this.normalizedCatchUpLatencyMs=$K(a,350,1),this.normalizedCatchUpThreshold=eq(o,600),this.normalizedStartDelayMs=eq(c,80),this.maxCommitFps=Math.trunc($K(s,30,1)),this.maxCharsPerCommit=Math.trunc($K(l,80,1)),this.flushOnFinish=u,this.segmenter=rq(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!=`function`){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0)}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function nq(e={},t){let n=new tq(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function rq(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function iq(e,t,n){if(!e||t<=0)return{text:``,graphemeCount:0};if(!n){let n=Array.from(e).slice(0,t);return{text:n.join(``),graphemeCount:n.length}}let r=``,i=0;for(let a of n.segment(e)){if(i>=t)break;r+=a.segment,i++}return{text:r,graphemeCount:i}}function aq(){return typeof performance<`u`?performance.now():Date.now()}function oq(e,t,n){return Math.min(n,Math.max(t,e))}var sq=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),cq=Symbol.for(`markstream-vue:node-lifecycle`);function lq(){}var uq=new Map,dq=`material`,fq=new Map,pq=new Map,mq=null;function hq(e){uq.set(e.id,e)}function gq(e){let t=uq.get(dq);if(!t)return;let n=t.core[e];if(n)return n;let r=fq.get(t.id);if(r){let t=r[e];if(t)return t}t.loadExtended&&!fq.has(t.id)&&vq(t)}function _q(){return uq.get(dq)?.fallback??``}function vq(e){return sq(this,null,function*(){if(fq.has(e.id))return fq.get(e.id)??null;let t=pq.get(e.id);return t||(t=(e.loadExtended?.call(e)??Promise.resolve(null)).then(t=>(fq.set(e.id,t),mq?.(),t)).catch(()=>(fq.set(e.id,null),null)),pq.set(e.id,t)),t})}var yq=``,bq=``,xq={id:`material`,core:{"":bq,plain:``,text:bq,javascript:``,typescript:``,jsx:``,tsx:``,html:``,css:``,scss:``,json:``,python:``,ruby:``,go:``,java:``,kotlin:``,c:``,cpp:``,cs:yq,csharp:yq,php:``,shell:``,powershell:``,sql:``,yaml:``,markdown:``,xml:``,rust:``,vue:``,mermaid:``},fallback:``,loadExtended:()=>he(()=>import(`./extended-BP0HZdSW.js`).then(e=>e.materialExtendedMap),[])},Sq=null,Cq=ue(0);mq=()=>{Cq.value++},hq(xq);var wq={"":``,javascript:`javascript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,typescript:`typescript`,ts:`typescript`,jsx:`jsx`,tsx:`tsx`,golang:`go`,py:`python`,rb:`ruby`,sh:`shell`,bash:`shell`,zsh:`shell`,shellscript:`shell`,bat:`shell`,batch:`shell`,ps1:`powershell`,plaintext:`plain`,text:`plain`,txt:`plain`,"c++":`cpp`,"c#":`csharp`,cs:`csharp`,"objective-c":`objectivec`,"objective-c++":`objectivecpp`,yml:`yaml`,md:`markdown`,rs:`rust`,kt:`kotlin`};function Tq(e){let t=function(e){if(!e)return``;let t=e.trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}(e);return wq[t]??t}function Eq(e){let t=Tq(e);if(!t)return`plaintext`;switch(t){case`plain`:return`plaintext`;case`jsx`:return`javascript`;case`tsx`:return`typescript`;case`objectivec`:return`objective-c`;case`objectivecpp`:return`objective-cpp`;default:return t}}function Dq(e){if(Sq){let t=Sq(e);if(t!=null&&t!==``)return t}return gq(Tq(e))||_q()}var Oq={js:`JavaScript`,javascript:`JavaScript`,ts:`TypeScript`,jsx:`JSX`,tsx:`TSX`,html:`HTML`,css:`CSS`,scss:`SCSS`,json:`JSON`,py:`Python`,python:`Python`,rb:`Ruby`,go:`Go`,java:`Java`,c:`C`,cpp:`C++`,cs:`C#`,csharp:`C#`,php:`PHP`,sh:`Shell`,bash:`Bash`,sql:`SQL`,yaml:`YAML`,md:`Markdown`,d2:`D2`,d2lang:`D2`,"":`Plain Text`,plain:`Plain Text`},kq=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Aq=null,jq=!1,Mq=null,Nq=Iq;function Pq(e){let t=e?.default??e;return t&&typeof t.renderToString==`function`?t:null}function Fq(){try{return Pq(globalThis?.katex)}catch{return null}}function Iq(){return kq(null,null,function*(){let e=Fq();if(e)return e;let t=yield he(()=>import(`./katex-BMCG0xok.js`),[]);try{yield he(()=>import(`./mhchem-CCsrOXlE.js`),__vite__mapDeps([4,5]))}catch{}return Pq(t)})}function Lq(e){let t=Promise.resolve(e).then(e=>Mq===t&&e?(Aq=Pq(e)??e,Aq):null).catch(()=>null).finally(()=>{Mq===t&&(Mq=null)});return Mq=t,jq=!0,t}function Rq(e){Nq=e,Aq=null,jq=!1,Mq=null}function zq(e){Rq(e??Iq)}function Bq(){return typeof Nq==`function`}function Vq(){let e=Nq;if(!e||e===Iq)return null;if(Aq)return Aq;let t=Fq();if(t)return Aq=t,Aq;if(jq)return null;try{let t=e();return t?typeof t?.then==`function`?(Lq(t),null):(Aq=Pq(t)??t,Aq):null}catch{return null}}function Hq(){return kq(this,null,function*(){let e=Fq();if(e)return Aq=e,Aq;if(Aq)return Aq;if(Mq)return Mq;if(jq)return null;let t=Nq;if(!t)return jq=!0,null;try{let e=t();if(typeof e?.then==`function`)return Lq(e);if(e)return Aq=Pq(e)??e,jq=!0,Aq}catch{}return jq=!0,null})}function Uq(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}var Wq=null,Gq=null,Kq=new Map,qq=new Map,Jq=5,Yq=new Set;function Xq(){if(Kq.size{let{id:t,html:n,error:r}=e.data,i=Kq.get(t);if(i)if(Kq.delete(t),clearTimeout(i.timeoutId),i.cleanup(),Xq(),r)i.aborted||i.reject(Error(r));else{let{content:t,displayMode:r}=e.data;if(t){let e=`${r?`d`:`i`}:${t}`;if(qq.set(e,n),qq.size>200){let e=qq.keys().next().value;qq.delete(e)}}i.aborted||i.resolve(n)}},Wq.onerror=e=>{console.error(`[katexWorkerClient] Worker error:`,e);for(let[t,n]of Kq.entries())clearTimeout(n.timeoutId),n.cleanup(),n.aborted||n.reject(Error(`Worker error: ${e.message}`));Kq.clear(),Zq()}}function $q(){var e;for(let e of Kq.values())clearTimeout(e.timeoutId),e.cleanup(),e.aborted||e.reject(Error(`Worker cleared`));Kq.clear(),Zq(),Wq&&((e=Wq.terminate)==null||e.call(Wq)),Wq=null,Gq=null}function eJ(e,t=!0,n=2e3,r){return kq(this,null,function*(){performance.now();let i=Uq(e);if(!Bq()){let e=Error(`KaTeX rendering disabled`);return e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,Promise.reject(e)}if(Gq)return Promise.reject(Gq);let a=`${t?`d`:`i`}:${i}`,o=qq.get(a);if(o)return Xq(),Promise.resolve(o);let s=Wq||(Gq=Error(`[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),Gq.name=`WorkerInitError`,Gq.code=`WORKER_INIT_ERROR`,null);if(!s)return Promise.reject(Gq);if(Kq.size>=Jq){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=`WORKER_BUSY`,e.busy=!0,e.inFlight=Kq.size,e.max=Jq,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=null,l=globalThis.setTimeout(()=>{let e=Kq.get(o);if(!e)return;Kq.delete(o),e.cleanup();let t=Error(`Worker render timed out`);t.name=`WorkerTimeout`,t.code=`WORKER_TIMEOUT`,e.aborted||e.reject(t),Xq()},n);c=()=>{let e=Kq.get(o);if(!e||e.aborted)return;e.aborted=!0,e.cleanup();let t=Error(`Aborted`);t.name=`AbortError`,a(t)},r&&r.addEventListener(`abort`,c,{once:!0});let u=e,d=a;Kq.set(o,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:l,aborted:!1,cleanup:()=>{r&&c&&r.removeEventListener(`abort`,c),c=null}});try{s.postMessage({id:o,content:i,displayMode:t})}catch(e){let t=Kq.get(o);Kq.delete(o),clearTimeout(l),t?.cleanup(),t?.reject(e),Xq()}})})}function tJ(e,t=!0,n){let r=`${t?`d`:`i`}:${Uq(e)}`;if(qq.set(r,n),qq.size>200){let e=qq.keys().next().value;qq.delete(e)}}var nJ=`WORKER_BUSY`;function rJ(e=2e3,t){return Kq.size{let i,a=!1,o=null,s=()=>{},c=()=>{i&&globalThis.clearTimeout(i),Yq.delete(s),t&&o&&t.removeEventListener(`abort`,o),o=null};s=()=>{a||(a=!0,c(),n())},Yq.add(s),i=globalThis.setTimeout(()=>{if(a)return;a=!0,c();let e=Error(`Wait for worker slot timed out`);e.name=`WorkerBusyTimeout`,e.code=`WORKER_BUSY_TIMEOUT`,r(e)},e),queueMicrotask(()=>Xq()),t&&(o=()=>{if(a)return;a=!0,c();let e=Error(`Aborted`);e.name=`AbortError`,r(e)},t.aborted?o():t.addEventListener(`abort`,o,{once:!0}))})}var iJ={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function aJ(e){return kq(this,arguments,function*(e,t=!0,n={}){if(!Bq()){let e=Error(`KaTeX rendering disabled`);throw e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,e}let r=n.timeout??iJ.timeout,i=n.waitTimeout??iJ.waitTimeout,a=n.backoffMs??iJ.backoffMs,o=n.maxRetries??iJ.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),8)):iJ.maxRetries,c=n.signal,l=0;for(;;){if(c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return yield eJ(e,t,r,c)}catch(e){if(e?.code!==`WORKER_BUSY`||l>=s)throw e;if(l++,yield rJ(i,c).catch(()=>{}),c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}a>0&&(yield new Promise(e=>globalThis.setTimeout(e,a*l)))}}})}function oJ(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function sJ(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!(!e||e.startsWith(`%%`)))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function cJ(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=sJ(e);return r===`gantt`?220+28*n:r===`sequencediagram`?180+26*n:r===`classdiagram`||r===`statediagram`||r===`erdiagram`?180+24*n:r===`flowchart`||r===`graph`?170+28*n:200+22*n}function lJ(e){let t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+60*t:360}function uJ(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function dJ(e,t=360,n=500){return uJ(e,t,n)}function fJ(e,t=360,n=500){return uJ(e,t,n)}var pJ=Object.defineProperty,mJ=Object.defineProperties,hJ=Object.getOwnPropertyDescriptors,gJ=Object.getOwnPropertySymbols,_J=Object.prototype.hasOwnProperty,vJ=Object.prototype.propertyIsEnumerable,yJ=(e,t,n)=>t in e?pJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bJ=(e,t)=>{for(var n in t||={})_J.call(t,n)&&yJ(e,n,t[n]);if(gJ)for(var n of gJ(t))vJ.call(t,n)&&yJ(e,n,t[n]);return e},xJ=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),SJ=()=>he(()=>import(`./mermaid.core-Ddyah3MZ.js`),__vite__mapDeps([6,7,8,9,2,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29])),CJ=null,wJ=SJ,TJ=null,EJ=!1,DJ=!1,OJ=0;function kJ(e){wJ=e,OJ++,CJ=null,TJ=null,EJ=!1,DJ=!1}function AJ(e){kJ(e??SJ)}function jJ(){return typeof wJ==`function`}function MJ(e){if(!e)return e;let t=e&&e.default?e.default:e;if(t&&(typeof t.render==`function`||typeof t.parse==`function`||typeof t.initialize==`function`))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render==`function`||typeof t.mermaidAPI.parse==`function`)){let e=t.mermaidAPI;return n=bJ({},t),r={render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:n=>typeof t.initialize==`function`?t.initialize(n):e.initialize?e.initialize(n):void 0},mJ(n,hJ(r))}var n,r;return e.mermaid&&typeof e.mermaid.render==`function`?e.mermaid:t}function NJ(e){if(e)try{let t=e?.initialize;e.initialize=n=>{let r=bJ({suppressErrorRendering:!0},n||{});return typeof t==`function`?t.call(e,r):e?.mermaidAPI&&typeof e.mermaidAPI.initialize==`function`?e.mermaidAPI.initialize(r):void 0}}catch{}}function PJ(){return xJ(this,null,function*(){if(CJ)return CJ;let e=function(){try{return MJ(globalThis?.mermaid)}catch{return null}}();if(e)return CJ=e,NJ(CJ),CJ;let t=wJ,n=OJ;return t?t===SJ&&EJ?null:TJ||(TJ=xJ(null,null,function*(){let e;try{e=yield t()}catch(e){if(t===SJ)return n===OJ&&t===wJ&&(EJ=!0,function(e){DJ||(DJ=!0,console.warn(`[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.`,e))}(e)),null;throw e}finally{n===OJ&&t===wJ&&(TJ=null)}return n!==OJ||t!==wJ?null:e?(CJ=MJ(e),NJ(CJ),CJ):null}),TJ):null})}var FJ=null,IJ=null,LJ=new Map,RJ=new Map;function zJ(e){for(let t of LJ.values())t.reject(e);LJ.clear(),RJ.clear()}var BJ=5,VJ=!1,HJ=`MERMAID_DISABLED`;function UJ(e){if(FJ&&FJ!==e){let e=Error(`Worker replaced`);e.code=`WORKER_REPLACED`,zJ(e)}FJ=e,IJ=null;let t=e;FJ.onmessage=e=>{if(FJ!==t)return;let{id:n,ok:r,result:i,error:a}=e.data,o=LJ.get(n);o&&(!1===r||a?o.reject(Error(a||`Unknown error`)):o.resolve(i))},FJ.onerror=e=>{var n,r;if(FJ===t)if(LJ.size!==0){try{VJ?console.error(`[mermaidWorkerClient] Worker error:`,e?.message||e):(r=console.debug)==null||r.call(console,`[mermaidWorkerClient] Worker error:`,e?.message||e)}catch{}zJ(Error(`Worker error: ${e.message}`))}else (n=console.debug)==null||n.call(console,`[mermaidWorkerClient] Worker error (no pending):`,e?.message||e)},FJ.onmessageerror=e=>{var n,r;if(FJ===t)if(LJ.size!==0){try{VJ?console.error(`[mermaidWorkerClient] Worker messageerror:`,e):(r=console.debug)==null||r.call(console,`[mermaidWorkerClient] Worker messageerror:`,e)}catch{}zJ(Error(`Worker messageerror`))}else (n=console.debug)==null||n.call(console,`[mermaidWorkerClient] Worker messageerror (no pending):`,e)}}function WJ(){var e;if(FJ)try{zJ(Error(`Worker cleared`)),(e=FJ.terminate)==null||e.call(FJ)}catch{}FJ=null,IJ=null}function GJ(e,t,n,r){if(!jJ()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=HJ,Promise.reject(e)}let i=`${e}\0${t.theme}\0${n}\0${t.code}`,a=RJ.get(i);return a||(a=function(e,t,n=1400){if(!jJ()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=`MERMAID_DISABLED`,Promise.reject(e)}if(IJ)return Promise.reject(IJ);let r=FJ||(IJ=Error(`[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),IJ.name=`WorkerInitError`,IJ.code=`WORKER_INIT_ERROR`,null);if(!r)return Promise.reject(IJ);if(LJ.size>=BJ){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=`WORKER_BUSY`,e.inFlight=LJ.size,e.max=BJ,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s,c=!1,l=()=>{c||(c=!0,s!=null&&globalThis.clearTimeout(s),LJ.delete(o))};LJ.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){LJ.delete(o),a(e);return}s=globalThis.setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`;let t=LJ.get(o);t&&t.reject(e)},n)})}(e,t,n),RJ.set(i,a),a.then(()=>{RJ.get(i)===a&&RJ.delete(i)},()=>{RJ.get(i)===a&&RJ.delete(i)})),function(e,t){if(!t)return e;if(t.aborted){let e=Error(`Aborted`);return e.name=`AbortError`,Promise.reject(e)}return new Promise((n,r)=>{let i=()=>{},a=()=>t.removeEventListener(`abort`,i);i=()=>{a();let e=Error(`Aborted`);e.name=`AbortError`,r(e)},t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{a(),n(e)},e=>{a(),r(e)})})}(a,r)}function KJ(e,t,n=1400,r){return GJ(`canParse`,{code:e,theme:t},n,r)}function qJ(e,t,n=1400,r){return GJ(`findPrefix`,{code:e,theme:t},n,r)}function JJ(e){try{if(typeof globalThis<`u`&&typeof globalThis.requestAnimationFrame==`function`)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}function YJ(e){try{if(e==null)return;if(typeof globalThis<`u`&&typeof globalThis.cancelAnimationFrame==`function`)return void globalThis.cancelAnimationFrame(e)}catch{}try{globalThis.clearTimeout(e)}catch{}}var XJ=Object.defineProperty,ZJ=Object.defineProperties,QJ=Object.getOwnPropertyDescriptors,$J=Object.getOwnPropertySymbols,eY=Object.prototype.hasOwnProperty,tY=Object.prototype.propertyIsEnumerable,nY=(e,t,n)=>t in e?XJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rY=(e,t)=>{for(var n in t||={})eY.call(t,n)&&nY(e,n,t[n]);if($J)for(var n of $J(t))tY.call(t,n)&&nY(e,n,t[n]);return e},iY=(e,t)=>ZJ(e,QJ(t)),aY=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),oY=`__global__`,sY=`__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__`,cY=(()=>{let e=globalThis;if(e[sY])return e[sY];let t={scopedCustomComponents:{},revision:ue(0)};return e[sY]=t,t})(),lY=cY.revision,uY=Symbol(`markstreamCustomComponents`),dY=new Set(`text.paragraph.heading.code_block.list.list_item.blockquote.table.table_row.table_cell.definition_list.definition_item.footnote.footnote_reference.footnote_anchor.admonition.hardbreak.link.image.thematic_break.math_inline.math_block.strong.emphasis.strikethrough.highlight.insert.subscript.superscript.emoji.checkbox.checkbox_input.inline_code.html_inline.html_block.reference.mermaid.infographic.d2.vmr_container`.split(`.`));function fY(e){return dY.has(String(e).trim().toLowerCase())}function pY(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[_\s]+/g,`-`).toLowerCase()}function mY(e={}){let t={};for(let[n,r]of Object.entries(e))if(r!=null){t[n]=r;for(let e of new Set([gL(n),gL(pY(n))]))!e||fY(e)||Object.prototype.hasOwnProperty.call(t,e)||(t[e]=r)}return t}function hY(e){let t=m(uY,null);return L(()=>(lY.value,function(e,t={}){return lY.value,rY(rY(rY({},mY(cY.scopedCustomComponents[oY]||{})),mY(t)),mY(function(e){return e&&cY.scopedCustomComponents[e]||{}}(e)))}(e?.(),t?.value??{})))}var gY=[`aria-label`],_Y={key:0,xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,class:`checkbox-icon checkbox-unchecked`},vY={key:1,xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,class:`checkbox-icon checkbox-checked`},yY=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},bY=yY(G({__name:`CheckboxNode`,props:{node:{}},setup:e=>(t,n)=>(c(),W(`span`,{class:`checkbox-node`,role:`img`,"aria-label":e.node.checked?`checked`:`unchecked`},[e.node.checked?(c(),W(`svg`,vY,[...n[1]||=[F(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`4`,fill:`currentColor`},null,-1),F(`path`,{d:`M9 12l2 2 4-4`,stroke:`hsl(var(--ms-background))`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(c(),W(`svg`,_Y,[...n[0]||=[F(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`4`,stroke:`currentColor`,"stroke-width":`2`},null,-1)]]))],8,gY))}),[[`__scopeId`,`data-v-be21ab83`]]);bY.install=e=>{e.component(bY.__name,bY)};var xY={class:`emoji-node`},SY=yY(G({__name:`EmojiNode`,props:{node:{}},setup:e=>(t,n)=>(c(),W(`span`,xY,U(e.node.name),1))}),[[`__scopeId`,`data-v-de55dc97`]]);SY.install=e=>{e.component(SY.__name,SY)};var CY=[`id`],wY=[`title`],TY=yY(G({__name:`FootnoteReferenceNode`,props:{node:{}},setup(e){let t=`#fnref--${e.node.id}`;function n(){if(typeof document>`u`)return;let e=document.querySelector(t);e?e.scrollIntoView({behavior:`smooth`}):console.warn(`Element with href: ${t} not found`)}return(r,i)=>(c(),W(`sup`,{id:`fnref-${e.node.id}`,class:`footnote-reference`,onClick:n},[F(`span`,{href:t,title:`查看脚注 ${e.node.id}`,class:`footnote-link cursor-pointer`},`[`+U(e.node.id)+`]`,9,wY)],8,CY))}}),[[`__scopeId`,`data-v-c1463a29`]]);TY.install=e=>{e.component(TY.__name,TY)};var EY=(()=>{try{return!1}catch{}return!1})();function DY(e){EY&&console.warn(e)}function OY(e,t=`safe`,n){return aK(e,t,n)}function kY(e){return lK(e)}function AY(e){return!0===e?``:!1===e?`false`:e==null?null:String(e)}function jY(e,t=`safe`){let n=String(e.tag||e.type||``).trim(),r=sK((i=e.attrs)?Array.isArray(i)?i.every(Array.isArray)?i.map(([e,t])=>[String(e),AY(t)]):i.filter(e=>e&&typeof e==`object`&&!Array.isArray(e)&&`name`in e).map(e=>[String(e.name),AY(e.value)]):Object.entries(i).map(([e,t])=>[e,AY(t)]):null,t,n);var i;if(!r)return;let a=kY(oK(r));return Object.keys(a).length>0?a:void 0}function MY(e,t,n=!1){let r=Object.entries(t??{}),i=r.length>0?r.map(([e,t])=>t===``?` ${e}`:` ${e}="${t}"`).join(``):``;return n?`<${e}${i} />`:`<${e}${i}>`}function NY(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function PY(e,t,n,r,i,o,s=!1){let c=function(e,t){return iK(e,t)}(e,r);if(UI.has(e.toLowerCase())||!c&&XG(e,o))return null;if(!c&&YG(e,o))return s?[MY(e,t,!0)]:[MY(e,t),...n,``];let l=aK(t,o,e),u=l.key,d=u!=null&&u!==``?u:i;return c?a(r[e]||r[e.toLowerCase()],iY(rY({},kY(l)),{key:d}),n.length>0?n:void 0):a(e,iY(rY({},l),{innerHTML:void 0,key:d}),n.length>0?n:void 0)}function FY(e,t){return mK(e,t)}function IY(e,t,n=`safe`){if(!e)return[];try{return function(e,t,n=`safe`){let r=0,i=[],a=[];for(let o of e)if(o.type===`text`)(i.length>0?i[i.length-1].children:a).push(o.content);else if(o.type===`self_closing`){let e=PY(o.tagName,o.attrs||{},[],t,`ms-html-`+ r++,n,!0);NY(i.length>0?i[i.length-1].children:a,e)}else if(o.type===`tag_open`)i.push({tagName:o.tagName,children:[],attrs:o.attrs,autoKey:`ms-html-`+ r++});else if(o.type===`tag_close`){let e=o.tagName.toLowerCase(),r=-1;for(let t=i.length-1;t>=0;t--)if(i[t].tagName.toLowerCase()===e){r=t;break}if(r!==-1)for(;i.length>r;){let o=i.pop(),s=PY(o.tagName,o.attrs||{},o.children,t,o.autoKey,n);i.length>0?NY(i[i.length-1].children,s):NY(a,s),o.tagName.toLowerCase()!==e&&i.length>r&&DY(`Auto-closing unclosed tag: <${o.tagName}>`)}else DY(`Ignoring closing tag with no matching opening tag: `)}for(;i.length>0;){let e=i.pop(),r=PY(e.tagName,e.attrs||{},e.children,t,e.autoKey,n);i.length>0?NY(i[i.length-1].children,r):NY(a,r),DY(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(dK(e),t,n)}catch(e){return r=e,EY&&console.error(`Failed to parse HTML to VNodes:`,r),null}var r}var LY=[`innerHTML`],RY=yY(G({__name:`HtmlInlineNode`,props:{node:{},customId:{},htmlPolicy:{}},setup(e){let t=e,n=m(`markstreamHtmlPolicy`,void 0),r=L(()=>t.htmlPolicy??n?.value??`safe`),i=hY(()=>t.customId),a=G({name:`DynamicRenderer`,props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),o=L(()=>{let e=t.node.content;if(!e)return{mode:`html`,content:``};if(r.value===`escape`)return{mode:`html`,content:hK(e,r.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:`text`,content:e};if(t.node.loading&&t.node.autoClosed){let t=IY(e,i.value,r.value);if(t!==null)return{mode:`dynamic`,nodes:t}}if(!FY(e,i.value))return{mode:`html`,content:hK(e,r.value)};let n=IY(e,i.value,r.value);return n===null?{mode:`html`,content:hK(e,r.value)}:{mode:`dynamic`,nodes:n}});return(e,n)=>o.value.mode===`dynamic`?(c(),W(`span`,{key:0,class:V([`html-inline-node`,{"html-inline-node--loading":t.node.loading}])},[v(z(a),{nodes:o.value.nodes},null,8,[`nodes`])],2)):o.value.mode===`text`?(c(),W(`span`,{key:1,class:V([`html-inline-node`,{"html-inline-node--loading":t.node.loading}])},U(o.value.content),3)):(c(),W(`span`,{key:2,class:V([`html-inline-node`,{"html-inline-node--loading":t.node.loading}]),innerHTML:o.value.content},null,10,LY))}}),[[`__scopeId`,`data-v-d17f12b0`]]);RY.install=e=>{e.component(RY.__name,RY)};var zY={class:`inline-code`},BY={key:0},VY=yY(G({__name:`InlineCodeNode`,props:{node:{}},setup(e){let n=e,r=b(),i=m(`markstreamFade`,void 0),a=m(`markstreamTextStreamState`,void 0),o=m(`markstreamStreamVersion`,void 0),l=L(()=>{let e=r.fade;return e===``||!0===e||e===`true`||!1!==e&&e!==`false`&&void 0}),u=L(()=>typeof l.value==`boolean`?l.value:typeof i?.value!=`boolean`||i.value),d=L(()=>String(n.node.code??``)),f=L(()=>!u.value),p=L(()=>{let e=r[`index-key`]??r.indexKey;return e==null||e===``?``:String(e)}),h=R(n.node.code),g=R(``),_=R(0),v;function y(){v?.(),v=void 0}function x(){y(),g.value&&=(h.value+=g.value,``)}s([()=>n.node.code,p,u],([e])=>{let t=String(e??``),n=p.value,r=GK({nextContent:t,persistedContent:n?a?.get(n):void 0,currentState:{settledContent:h.value,streamedDelta:g.value},typewriterEnabled:u.value});h.value=r.settledContent,g.value=r.streamedDelta,r.appended?(_.value+=1,function(){if(!g.value||v||!o)return;let e=o.value;v=s(()=>o.value,t=>{t!==e&&x()},{flush:`sync`})}()):g.value||y(),n&&a?.set(n,t)},{immediate:!0}),t(y);let S=L(()=>_.value%2==0?`inline-code-stream-delta--a`:`inline-code-stream-delta--b`);return(e,t)=>(c(),W(`code`,zY,[f.value?(c(),W(M,{key:0},[K(U(d.value),1)],64)):(c(),W(M,{key:1},[h.value?(c(),W(`span`,BY,U(h.value),1)):E(``,!0),g.value?(c(),W(`span`,{key:1,class:V([`inline-code-stream-delta`,[S.value]]),onAnimationend:x},U(g.value),35)):E(``,!0)],64))]))}}),[[`__scopeId`,`data-v-4e331c97`]]);VY.install=e=>{e.component(VY.__name,VY)};var HY=R(!1),UY=R(``),WY=R(`top`),GY=R(null),KY=R(null),qY=R(null),JY=R(null),YY=R(null),XY=null,ZY=null,QY=0;function $Y(){XY&&=(clearTimeout(XY),null),ZY&&=(clearTimeout(ZY),null)}var eX=!1,tX=null,nX=!1;function rX(e,t,n=`top`,r=!1,i,a){if(!e)return;let o=++QY;$Y();let s=()=>aY(null,null,function*(){if(yield function(){return aY(this,null,function*(){if(!eX&&!nX&&typeof document<`u`){tX??=aY(null,null,function*(){let[{createApp:e,h:t},{default:n}]=yield Promise.all([he(()=>import(`./vue.runtime.esm-bundler-Cwbj1t-C.js`).then(e=>e.t),__vite__mapDeps([1,2])),he(()=>import(`./Tooltip-BV-JRC1N.js`),__vite__mapDeps([30,7,1,2]))]),r=document.createElement(`div`);r.setAttribute(`data-singleton-tooltip`,`1`),document.body.appendChild(r),e({setup:()=>()=>t(n,{visible:HY.value,"anchor-el":GY.value,content:UY.value,placement:WY.value,id:KY.value,originX:qY.value,originY:JY.value,isDark:YY.value??void 0})}).mount(r),eX=!0});try{yield tX}catch(e){eX=!1,tX=null,nX=!0,console.warn(`[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.`,e)}}})}(),eX&&o===QY){KY.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,GY.value=e,UY.value=t,WY.value=n,qY.value=i?.x??null,JY.value=i?.y??null,YY.value=typeof a==`boolean`?a:null,HY.value=!0;try{e.setAttribute(`aria-describedby`,KY.value)}catch{}}});r?s():XY=setTimeout(s,80)}function iX(e=!1){QY+=1,$Y();let t=()=>{if(GY.value&&KY.value)try{GY.value.removeAttribute(`aria-describedby`)}catch{}HY.value=!1,GY.value=null,KY.value=null,qY.value=null,JY.value=null};e?t():ZY=setTimeout(t,120)}var aX={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.minimize":`Minimize`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`},oX=Symbol(`markstreamI18nFallback`);function sX(e,t){return t?.[e]??aX[e]}var cX=(e,t)=>sX(e,t)??function(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e);function lX(e,t){return{t(n){let r=sX(n,t);if(e.te&&r!=null&&!e.te(n))return cX(n,t);let i=e.t(n);return i===n&&r!=null?cX(n,t):i}}}function uX(){let e=function(){try{let e=y(),t=oX,n=e?.provides,r=e?.appContext?.provides;return n?.[t]??r?.[t]??null}catch{}return null}(),t=function(){try{let e=y(),t=e?.proxy,n=t?.$t;if(typeof n==`function`){let e=t?.$te;return{t:n.bind(t),te:typeof e==`function`?e.bind(t):void 0}}let r=e?.appContext?.config?.globalProperties,i=r?.$t;if(typeof i==`function`){let e=r?.$te;return{t:i.bind(r),te:typeof e==`function`?e.bind(r):void 0}}}catch{}return null}();if(t)return lX(t,e);try{let t=globalThis.$vueI18nUse||null;if(t&&typeof t==`function`)try{let n=t();if(n&&typeof n.t==`function`)return lX({t:n.t.bind(n),te:typeof n.te==`function`?n.te.bind(n):void 0},e)}catch{}}catch{}return{t:t=>cX(t,e)}}var dX=Symbol(`ViewportPriority`),fX=Symbol(`ViewportPriorityOptions`),pX=Symbol(`OffscreenHeavyNodeDeferral`),mX=L(()=>!1),hX=`400px`;function gX(){return m(fX,void 0)}function _X(){return m(pX,mX)}function vX(e,t){let n=typeof window<`u`&&typeof document<`u`,r=typeof t==`boolean`?R(t):t,i=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,a=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null,o=new WeakMap,c=1,l=new Map,u=new Map,f=new Set,p=null,m=null;function h(e){if(!e)return`viewport`;let t=o.get(e);return t||(t=c++,o.set(e,t)),String(t)}function g(){if(p!=null){try{a?.(p)}catch{}p=null}}function _(e){if(e){let t=l.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch{}l.delete(e)}}u.size||f.size||g()}function v(e){let t=u.get(e);if(!t)return;let n=l.get(t.bucketKey);if(!t.visible.value){t.visible.value=!0;try{t.resolve()}catch{}}try{n?.io.unobserve(e)}catch{}n?.targets.delete(e),u.delete(e),f.delete(e),_(t.bucketKey)}function y(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&p==null&&f.size&&(p=i(()=>{p=null;let e=f.values().next().value;e&&(f.delete(e),v(e),f.size&&y())},{timeout:1200}))}function b(t,r){if(!n||typeof IntersectionObserver>`u`)return null;let i=function(t,n){return{root:e?.(t??null)??null,rootMargin:n?.rootMargin??hX,threshold:n?.threshold??0}}(t,r),a=[h((o=i).root),o.rootMargin,o.threshold].join(`\0`);var o;let s=l.get(a);if(s)return{key:a,bucket:s};let c;try{c=new IntersectionObserver(e=>{for(let t of e)(t.isIntersecting||t.intersectionRatio>0)&&v(t.target)},{root:i.root,rootMargin:i.rootMargin,threshold:i.threshold})}catch{return null}let u={io:c,targets:new Map};return l.set(a,u),{key:a,bucket:u}}function x(){if(n&&r.value)for(let[e,t]of Array.from(u.entries())){let n=b(e,t.opts);if(!n){v(e);continue}if(n.key===t.bucketKey)continue;let r=t.bucketKey,i=l.get(r);try{i?.io.unobserve(e)}catch{}i?.targets.delete(e),t.bucketKey=n.key,n.bucket.targets.set(e,t),n.bucket.io.observe(e),_(r)}}s(r,e=>{if(!e){for(let e of Array.from(u.keys()))v(e);g()}},{flush:`sync`});let S=(e,t)=>{let i=R(!1),a,o=!1,s=new Promise(e=>{a=()=>{o||(o=!0,e())}}),c=()=>{let t=u.get(e);if(!t)return f.delete(e),void _();let n=l.get(t.bucketKey);try{n?.io.unobserve(e)}catch{}n?.targets.delete(e),u.delete(e),f.delete(e),_(t.bucketKey)};if(!n||!r.value)return i.value=!0,a(),{isVisible:i,whenVisible:s,destroy:c};let d=b(e,t);if(!d)return i.value=!0,a(),{isVisible:i,whenVisible:s,destroy:c};let p={resolve:a,visible:i,bucketKey:d.key,opts:t};return u.set(e,p),d.bucket.targets.set(e,p),d.bucket.io.observe(e),n&&m==null&&(m=window.requestAnimationFrame(()=>{m=null,x()})),!1!==t?.allowIdle&&(f.add(e),y()),{isVisible:i,whenVisible:s,destroy:c}};return S.refresh=x,d(dX,S),S}function yX(){let e=m(dX,void 0);if(e)return e;let t=new WeakMap,n=new Map,r=new Set,i=null,a=typeof window<`u`?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,o=typeof window<`u`?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null,s=()=>{if(i!=null){try{o?.(i)}catch{}i=null}},c=e=>{if(!e)return;let t=n.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch{}n.delete(e)}},l=e=>{let i=t.get(e);if(!i)return;let a=n.get(i.bucketKey);if(!i.visible.value){i.visible.value=!0;try{i.resolve()}catch{}}try{a?.io.unobserve(e)}catch{}t.delete(e),a?.targets.delete(e),r.delete(e),c(i.bucketKey),r.size||s()},u=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&i==null&&r.size&&(i=a(()=>{i=null;let e=r.values().next().value;e&&(r.delete(e),l(e),r.size&&u())},{timeout:1200}))};return(e,i)=>{let a=R(!1),o,d=!1,f=new Promise(e=>{o=()=>{d||(d=!0,e())}}),p=()=>{let i=t.get(e);if(!i)return r.delete(e),void(r.size||s());let a=n.get(i.bucketKey);try{a?.io.unobserve(e)}catch{}t.delete(e),a?.targets.delete(e),r.delete(e),c(i.bucketKey),r.size||s()},m=(e=>{if(typeof window>`u`||typeof IntersectionObserver>`u`)return null;let t=(e=>[e?.rootMargin??hX,e?.threshold??0].join(`\0`))(e),r=n.get(t);if(r)return{key:t,bucket:r};let i=e?.rootMargin??hX,a;try{a=new IntersectionObserver(e=>{for(let t of e)(t.isIntersecting||t.intersectionRatio>0)&&l(t.target)},{root:null,rootMargin:i,threshold:e?.threshold??0})}catch{return null}let o={io:a,targets:new Set};return n.set(t,o),{key:t,bucket:o}})(i);return m?(t.set(e,{resolve:o,visible:a,bucketKey:m.key}),m.bucket.targets.add(e),m.bucket.io.observe(e),!1!==i?.allowIdle&&(r.add(e),u()),{isVisible:a,whenVisible:f,destroy:p}):(a.value=!0,o(),{isVisible:a,whenVisible:f,destroy:p})}}function bX(e,t){let n=e.indexKey??t[`index-key`]??t.indexKey;return n==null||n===``?``:String(n)}var xX=[`data-markstream-viewport-pending`],SX=[`src`,`alt`,`title`,`loading`,`fetchpriority`,`decoding`,`tabindex`,`aria-label`],CX={key:1,class:`image-placeholder`},wX={key:1,class:`image-node__raw-text`},TX={key:2,class:`image-shimmer-overlay`},EX={key:1,class:`image-node__raw-text`},DX={key:3,class:`image-error`},OX=yY(G({__name:`ImageNode`,props:{node:{},fallbackSrc:{default:``},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:[`load`,`error`,`click`],setup(e,{emit:t}){var r;let i=e,a=t,o=R(!1),l=R(!1),u=R(``),d=R(`primary`),f=R(null),p=b(),h=m(cq,null),g=yX(),_=gX(),v=_X(),x=L(()=>oL(i.node.src)),S=L(()=>oL(i.fallbackSrc)),C=((r=y()?.vnode.el)?.querySelector)?.call(r,`img`),w=typeof window<`u`&&C?.getAttribute(`src`)===(x.value||S.value),T=R(typeof window>`u`||w||!v.value),D=ue(null),O=``,k=null,A=L(()=>u.value),j=L(()=>!i.lazy),M=L(()=>typeof window<`u`&&v.value&&!w),N=L(()=>!M.value||T.value),ee=L(()=>N.value?A.value:``),P=L(()=>_?.value.heavyBlockMargin??_?.value.rootMargin??hX),I=L(()=>!i.node.loading&&d.value!==`failed`&&u.value.length>0),te=L(()=>d.value===`failed`),re=L(()=>(!j.value||M.value&&!T.value)&&!o.value&&!l.value&&d.value!==`failed`&&u.value.length>0),ie=L(()=>bX(i,p));function ae(e=ie.value){e&&f.value&&h?.reportHeight(e,f.value.offsetHeight)}function oe(e=ie.value){e&&n(()=>{ae(e)})}function se(){k&&=(clearTimeout(k),null)}function ce(){let e=ie.value;e&&O!==e&&(O&&h?.markSettled(O),se(),O=e,h?.markPending(e),typeof window<`u`&&(k=window.setTimeout(()=>{O===e&&(oe(e),B())},8e3)))}function B(){return aY(this,null,function*(){let e=O;e&&(se(),O=``,yield n(),ae(e),h?.markSettled(e))})}function le(){if(d.value===`primary`&&S.value&&S.value!==u.value)return d.value=`fallback`,u.value=S.value,o.value=!1,l.value=!1,void oe();d.value=`failed`,l.value=!0,a(`error`,u.value),oe()}function de(){o.value=!0,l.value=!1,a(`load`,A.value),oe()}function fe(e){e.preventDefault(),o.value&&!l.value&&a(`click`,[e,A.value])}let{t:H}=uX();return s([x,S,()=>i.node.loading],()=>(o.value=!1,l.value=!1,i.node.loading||x.value?(u.value=x.value,void(d.value=`primary`)):S.value?(u.value=S.value,void(d.value=`fallback`)):(u.value=``,d.value=`failed`,void(l.value=!0))),{immediate:!0}),typeof window<`u`&&s([f,M],([e,t],n,r)=>{var i;if((i=D.value)==null||i.destroy(),D.value=null,!t||T.value)return void(T.value=!0);if(!e)return void(T.value=!1);let a=!0,o=g(e,{rootMargin:P.value,allowIdle:!1});D.value=o,T.value=o.isVisible.value,o.whenVisible.then(()=>{a&&D.value===o&&(T.value=!0)}),r(()=>{a=!1,o.destroy(),D.value===o&&(D.value=null)})},{immediate:!0}),s([I,o,l,A,()=>i.lazy,N],([e,t,n,r,i,a])=>e&&r&&!n&&a?t?(B(),void oe()):i?(ce(),void oe()):void(t||n||ce()):(B(),void oe()),{flush:`post`,immediate:!0}),ne(()=>{var e;(e=D.value)==null||e.destroy(),D.value=null,function(){let e=O;e&&(se(),O=``,h?.markSettled(e))}()}),(t,n)=>(c(),W(`span`,{ref_key:`rootRef`,ref:f,class:`image-node-container`,"data-markstream-viewport-pending":M.value&&!T.value?`true`:void 0},[I.value?(c(),W(`img`,{key:0,src:ee.value||void 0,alt:String(i.node.alt??i.node.title??``),title:String(i.node.title??i.node.alt??``),class:V([`image-node__img`,{"is-loading":!j.value&&!o.value,"is-loaded":j.value||o.value,"has-natural-size":o.value,"cursor-pointer":o.value}]),loading:i.lazy?`lazy`:void 0,fetchpriority:j.value?`high`:void 0,decoding:j.value?`sync`:`async`,tabindex:o.value?0:-1,"aria-label":i.node.alt??z(H)(`image.preview`),onError:le,onLoad:de,onClick:fe},null,42,SX)):E(``,!0),e.node.loading&&!l.value?(c(),W(`span`,CX,[i.usePlaceholder?me(t.$slots,`placeholder`,{key:0,node:i.node,displaySrc:A.value,imageLoaded:o.value,hasError:l.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[n[0]||=F(`span`,{class:`image-shimmer`},null,-1)],!0):(c(),W(`span`,wX,U(e.node.raw),1))])):E(``,!0),re.value&&!e.node.loading?(c(),W(`span`,TX,[i.usePlaceholder?me(t.$slots,`placeholder`,{key:0,node:i.node,displaySrc:A.value,imageLoaded:o.value,hasError:l.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[n[1]||=F(`span`,{class:`image-shimmer`},null,-1)],!0):(c(),W(`span`,EX,U(e.node.raw),1))])):E(``,!0),te.value?(c(),W(`span`,DX,[me(t.$slots,`error`,{node:i.node,displaySrc:A.value,imageLoaded:o.value,hasError:l.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[n[2]||=F(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`},[F(`path`,{fill:`currentColor`,d:`M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z`})],-1),F(`span`,null,U(z(H)(`image.loadError`)),1)],!0)])):E(``,!0)],8,xX))}}),[[`__scopeId`,`data-v-046e82ac`]]);OX.install=e=>{e.component(OX.__name,OX)};var kX={key:2},AX=G({__name:`NodeChildRenderer`,props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){let t=e,n=hY(()=>t.customId),r=m(`markstreamHtmlPolicy`,void 0),a=m(`markstreamNestedRendererProps`,void 0),o=L(()=>r?.value??`safe`),s=L(()=>{let e=a?.value??{};return iY(rY({},e),{customId:t.customId??e.customId,htmlPolicy:o.value})}),l=i({loader:()=>Promise.resolve().then(()=>A0),suspensible:!1}),u=L(()=>t.components[String(t.node.type)]),d=L(()=>!!(u.value&&n.value[t.node.type]&&!fY(String(t.node.type)))),f=L(()=>d.value?jY(t.node,o.value):void 0),p=L(()=>Array.isArray(t.node.children)&&t.node.children.length>0),h=L(()=>String(t.node.content??``)),g=L(()=>String(t.node.content??t.node.raw??``));return(t,n)=>u.value&&d.value?(c(),P(x(u.value),re({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":s.value.isDark}),{default:B(()=>[p.value?(c(),P(z(l),re({key:0},s.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):h.value?(c(),P(z(l),re({key:1},s.value,{content:h.value,final:!e.node.loading,"index-key":`${e.indexKey||`child`}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:1},16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):u.value?(c(),P(x(u.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,[`node`,`custom-id`,`index-key`])):e.fallbackToText?(c(),W(`span`,kX,U(g.value),1)):E(``,!0)}}),jX=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function MX(e){var t;if(typeof e==`boolean`)return e;if(e&&typeof e==`object`){let n=e;return iY(rY(rY({},jX),n),{enabled:(t=n.enabled)==null||t})}return rY({},jX)}function NX(e,t){if(!1===e.renderSideBySide)return!0;if(!0!==e.useInlineViewWhenSpaceIsLimited)return!1;let n=e.renderSideBySideInlineBreakpoint;return t>0&&t<=(typeof n==`number`&&Number.isFinite(n)?n:900)}function PX(e){let t=String(e??``).split(/\r?\n/,1)[0]?.trim()??``;if(t.length<3)return``;let n=t[0];if(n!=="`"&&n!==`~`||t[1]!==n||t[2]!==n)return``;let r=3;for(;t[r]===n;)r+=1;return t.slice(r).trim()}function FX(e){return(String(e??``).trim().split(/\s+/,1)[0]??``)===`diff`}function IX(e){return!0===e.diff||FX(e.language)||FX(PX(String(e.raw??``)))}function LX(e,t,n){let r=function(e){let t=PX(e);if(!t)return``;let n=t.split(/\s+/).filter(Boolean);if(!n.length)return``;let r=n[0]===`diff`?n.slice(1):n;for(let e of r){let t=e.includes(`:`)?e.slice(e.indexOf(`:`)+1):e;if(t&&/[./\\-]/.test(t))return t}return``}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:``}}var RX=[`aria-busy`,`aria-label`,`data-language`,`data-markstream-line-numbers`],zX={key:0,translate:`no`,class:`markstream-pre__diff-code`},BX={class:`markstream-pre__diff-pane-content`},VX={class:`markstream-pre__diff-number`,"aria-hidden":`true`},HX={class:`markstream-pre__diff-content`},UX={class:`markstream-pre__diff-content-inner`},WX={key:0,class:`markstream-pre__line-numbers`,"aria-hidden":`true`},GX=[`textContent`],KX=[`textContent`],qX=G({__name:`PreCodeNode`,props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){let t=e;function r(e,t){let n=String(e??``);return t?n:n.replace(/\r\n$|\n$|\r$/,``)}let i=L(()=>{let e=String(t.node?.language??``);return String(String(e).split(/\s+/g)[0]??``).toLowerCase().replace(/[^\w-]/g,``)||`plaintext`}),a=L(()=>`language-${i.value}`),o=L(()=>!0===t.loading||!0===t.node?.loading),l=L(()=>r(t.node?.code,o.value)),u=``,d=1,f=L(()=>function(e){let t=0,n=1;e.startsWith(u)&&(t=u.length,n=d,t>0&&e[t-1]===`\r`&&e[t]===` +
        `};let c=/^\[(\d+)\]/,l=/^\[([^\]\n]+)\]/,u=e=>{if(!e.startsWith(`[`))return!1;let t=l.exec(e);if(!t)return e!==`[`&&!/^\[\d+$/.test(e);let n=String(t[1]??``);return e.slice(t[0].length).startsWith(`(`)?!1:!/^\d+$/.test(n)};n.inline.ruler.before(`escape`,`reference`,(e,t)=>{let n=e;if(n.src[n.pos]!==`[`)return!1;let r=c.exec(n.src.slice(n.pos));if(!r)return!1;let i=n.src.slice(Math.max(0,n.pos-120),n.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(i))return!1;let a=n.src.slice(n.pos+r[0].length);if(a.startsWith(`](`)||a.startsWith(`(`)||u(a))return!1;if(!t){let e=r[1],t=n.push(`reference`,`span`,0);t.content=e,t.markup=r[0],t.raw=r[0]}return n.pos+=r[0].length,!0}),n.renderer.rules.reference=(e,t)=>{let n=String(e[t].content??``);return`${n}`};let d=n.use.bind(n);return n.use=((...e)=>(r.__markstreamHasCustomParserExtensions=!0,d(...e))),n}function YK({nextContent:e,previousContent:t,typewriterEnabled:n}){return!n||e===t?{settledContent:e,streamedDelta:``,appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:``,appended:!1}}function XK({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:r,streamRenderVersionChanged:i=!1}){let a=`${n.settledContent}${n.streamedDelta}`;return r?n.streamedDelta&&a===e?i?{settledContent:a,streamedDelta:``,appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:YK({nextContent:e,previousContent:t??a,typewriterEnabled:r}):{settledContent:e,streamedDelta:``,appended:!1}}var ZK={plain:`plaintext`,text:`plaintext`,txt:`plaintext`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,ts:`typescript`,mts:`typescript`,cts:`typescript`,golang:`go`,py:`python`,rb:`ruby`,rs:`rust`,kt:`kotlin`,kts:`kotlin`,md:`markdown`,yml:`yaml`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,shell:`shellscript`,shellscript:`shellscript`,ps:`powershell`,ps1:`powershell`,pwsh:`powershell`,"c++":`cpp`,"c#":`csharp`,cs:`csharp`,objc:`objective-c`,objectivec:`objective-c`,"objective-c":`objective-c`,objectivecpp:`objective-cpp`,"objective-c++":`objective-cpp`,"objective-cpp":`objective-cpp`};function QK(e){let t=String(e??``).trim();if(!t)return``;let[n=``]=t.split(/\s+/);return n.split(`:`)[0]?.trim().toLowerCase()??``}function $K(e){let t=QK(e);return ZK[t]??t}function eq(e){if(!Array.isArray(e))return;let t=e.filter(e=>typeof e==`string`).map(e=>$K(e)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function tq(e){if(!Array.isArray(e))return;let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();!e||n.has(e)||(n.add(e),t.push(e))}return t.length>0?t:void 0}function nq(e){return tq(e)?.join(`\0`)??``}function rq(e,t){return`${nq(e)}\u0000\u0000${eq(t)?.join(`\0`)??``}`}function iq(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.max(n,r):t}function aq(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var oq=class{constructor(e={},t){this.source=``,this.visible=``,this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=e=>this.destroyed?()=>{}:(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.enqueue=e=>{if(this.destroyed||!e)return;this.done&&=!1;let t=this.source.length>0,n=this.pendingChars<=0;if(this.source+=e,n){let e=uq();this.startedAt=t&&this.hasStarted?e-this.normalizedStartDelayMs:e,this.lastTick=e,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(e={})=>{if(!this.destroyed){if(this.done=!0,e.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(e=``)=>{this.destroyed||(this.cancelLoop(),this.source=e,this.visible=e,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;let e=uq();this.lastTick=e,this.startedAt||=e,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=e=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(e-this.startedAtthis.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,a=dq(r/Math.max(.001,i/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(a-this.currentCps)*.2,this.charBudget+=this.currentCps*(n/1e3),this.charBudget<1){this.ensureLoop();return}let o=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),s=lq(this.source.slice(this.visible.length),o,this.segmenter);s.text&&(this.visible+=s.text,this.charBudget=Math.max(0,this.charBudget-s.graphemeCount),this.emit()),this.ensureLoop()};let{minCharsPerSecond:n=40,maxCharsPerSecond:r=1e3,targetLatencyMs:i=900,catchUpLatencyMs:a=350,catchUpThreshold:o=600,maxCommitFps:s=30,startDelayMs:c=80,maxCharsPerCommit:l=80,flushOnFinish:u=!1}=e;this.minCharsPerSecond=iq(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,iq(r,1e3,1)),this.normalizedTargetLatencyMs=iq(i,900,1),this.normalizedCatchUpLatencyMs=iq(a,350,1),this.normalizedCatchUpThreshold=aq(o,600),this.normalizedStartDelayMs=aq(c,80),this.maxCommitFps=Math.trunc(iq(s,30,1)),this.maxCharsPerCommit=Math.trunc(iq(l,80,1)),this.flushOnFinish=u,this.segmenter=cq(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!=`function`){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0)}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function sq(e={},t){let n=new oq(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function cq(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function lq(e,t,n){if(!e||t<=0)return{text:``,graphemeCount:0};if(!n){let n=Array.from(e).slice(0,t);return{text:n.join(``),graphemeCount:n.length}}let r=``,i=0;for(let a of n.segment(e)){if(i>=t)break;r+=a.segment,i++}return{text:r,graphemeCount:i}}function uq(){return typeof performance<`u`?performance.now():Date.now()}function dq(e,t,n){return Math.min(n,Math.max(t,e))}var fq=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),pq=Symbol.for(`markstream-vue:node-lifecycle`);function mq(){}var hq=new Map,gq=`material`,_q=new Map,vq=new Map,yq=null;function bq(e){hq.set(e.id,e)}function xq(e){let t=hq.get(gq);if(!t)return;let n=t.core[e];if(n)return n;let r=_q.get(t.id);if(r){let t=r[e];if(t)return t}t.loadExtended&&!_q.has(t.id)&&Cq(t)}function Sq(){return hq.get(gq)?.fallback??``}function Cq(e){return fq(this,null,function*(){if(_q.has(e.id))return _q.get(e.id)??null;let t=vq.get(e.id);return t||(t=(e.loadExtended?.call(e)??Promise.resolve(null)).then(t=>(_q.set(e.id,t),yq?.(),t)).catch(()=>(_q.set(e.id,null),null)),vq.set(e.id,t)),t})}var wq=``,Tq=``,Eq={id:`material`,core:{"":Tq,plain:``,text:Tq,javascript:``,typescript:``,jsx:``,tsx:``,html:``,css:``,scss:``,json:``,python:``,ruby:``,go:``,java:``,kotlin:``,c:``,cpp:``,cs:wq,csharp:wq,php:``,shell:``,powershell:``,sql:``,yaml:``,markdown:``,xml:``,rust:``,vue:``,mermaid:``},fallback:``,loadExtended:()=>he(()=>import(`./extended-BP0HZdSW.js`).then(e=>e.materialExtendedMap),[])},Dq=null,Oq=ue(0);yq=()=>{Oq.value++},bq(Eq);var kq={"":``,javascript:`javascript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,typescript:`typescript`,ts:`typescript`,jsx:`jsx`,tsx:`tsx`,golang:`go`,py:`python`,rb:`ruby`,sh:`shell`,bash:`shell`,zsh:`shell`,shellscript:`shell`,bat:`shell`,batch:`shell`,ps1:`powershell`,plaintext:`plain`,text:`plain`,txt:`plain`,"c++":`cpp`,"c#":`csharp`,cs:`csharp`,"objective-c":`objectivec`,"objective-c++":`objectivecpp`,yml:`yaml`,md:`markdown`,rs:`rust`,kt:`kotlin`};function Aq(e){let t=function(e){if(!e)return``;let t=e.trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}(e);return kq[t]??t}function jq(e){let t=Aq(e);if(!t)return`plaintext`;switch(t){case`plain`:return`plaintext`;case`jsx`:return`javascript`;case`tsx`:return`typescript`;case`objectivec`:return`objective-c`;case`objectivecpp`:return`objective-cpp`;default:return t}}function Mq(e){if(Dq){let t=Dq(e);if(t!=null&&t!==``)return t}return xq(Aq(e))||Sq()}var Nq={js:`JavaScript`,javascript:`JavaScript`,ts:`TypeScript`,jsx:`JSX`,tsx:`TSX`,html:`HTML`,css:`CSS`,scss:`SCSS`,json:`JSON`,py:`Python`,python:`Python`,rb:`Ruby`,go:`Go`,java:`Java`,c:`C`,cpp:`C++`,cs:`C#`,csharp:`C#`,php:`PHP`,sh:`Shell`,bash:`Bash`,sql:`SQL`,yaml:`YAML`,md:`Markdown`,d2:`D2`,d2lang:`D2`,"":`Plain Text`,plain:`Plain Text`},Pq=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Fq=null,Iq=!1,Lq=null,Rq=Vq;function zq(e){let t=e?.default??e;return t&&typeof t.renderToString==`function`?t:null}function Bq(){try{return zq(globalThis?.katex)}catch{return null}}function Vq(){return Pq(null,null,function*(){let e=Bq();if(e)return e;let t=yield he(()=>import(`./katex-BMCG0xok.js`),[]);try{yield he(()=>import(`./mhchem-CCsrOXlE.js`),__vite__mapDeps([4,5]))}catch{}return zq(t)})}function Hq(e){let t=Promise.resolve(e).then(e=>Lq===t&&e?(Fq=zq(e)??e,Fq):null).catch(()=>null).finally(()=>{Lq===t&&(Lq=null)});return Lq=t,Iq=!0,t}function Uq(e){Rq=e,Fq=null,Iq=!1,Lq=null}function Wq(e){Uq(e??Vq)}function Gq(){return typeof Rq==`function`}function Kq(){let e=Rq;if(!e||e===Vq)return null;if(Fq)return Fq;let t=Bq();if(t)return Fq=t,Fq;if(Iq)return null;try{let t=e();return t?typeof t?.then==`function`?(Hq(t),null):(Fq=zq(t)??t,Fq):null}catch{return null}}function qq(){return Pq(this,null,function*(){let e=Bq();if(e)return Fq=e,Fq;if(Fq)return Fq;if(Lq)return Lq;if(Iq)return null;let t=Rq;if(!t)return Iq=!0,null;try{let e=t();if(typeof e?.then==`function`)return Hq(e);if(e)return Fq=zq(e)??e,Iq=!0,Fq}catch{}return Iq=!0,null})}function Jq(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}var Yq=null,Xq=null,Zq=new Map,Qq=new Map,$q=5,eJ=new Set;function tJ(){if(Zq.size<$q&&eJ.size){let e=$q-Zq.size;for(let t of Array.from(eJ)){if(e<=0)break;eJ.delete(t),e--;try{t()}catch{}}}}function nJ(){for(let e of Array.from(eJ)){eJ.delete(e);try{e()}catch{}}}function rJ(e){Yq=e,Xq=null,Yq.onmessage=e=>{let{id:t,html:n,error:r}=e.data,i=Zq.get(t);if(i)if(Zq.delete(t),clearTimeout(i.timeoutId),i.cleanup(),tJ(),r)i.aborted||i.reject(Error(r));else{let{content:t,displayMode:r}=e.data;if(t){let e=`${r?`d`:`i`}:${t}`;if(Qq.set(e,n),Qq.size>200){let e=Qq.keys().next().value;Qq.delete(e)}}i.aborted||i.resolve(n)}},Yq.onerror=e=>{console.error(`[katexWorkerClient] Worker error:`,e);for(let[t,n]of Zq.entries())clearTimeout(n.timeoutId),n.cleanup(),n.aborted||n.reject(Error(`Worker error: ${e.message}`));Zq.clear(),nJ()}}function iJ(){var e;for(let e of Zq.values())clearTimeout(e.timeoutId),e.cleanup(),e.aborted||e.reject(Error(`Worker cleared`));Zq.clear(),nJ(),Yq&&((e=Yq.terminate)==null||e.call(Yq)),Yq=null,Xq=null}function aJ(e,t=!0,n=2e3,r){return Pq(this,null,function*(){performance.now();let i=Jq(e);if(!Gq()){let e=Error(`KaTeX rendering disabled`);return e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,Promise.reject(e)}if(Xq)return Promise.reject(Xq);let a=`${t?`d`:`i`}:${i}`,o=Qq.get(a);if(o)return tJ(),Promise.resolve(o);let s=Yq||(Xq=Error(`[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),Xq.name=`WorkerInitError`,Xq.code=`WORKER_INIT_ERROR`,null);if(!s)return Promise.reject(Xq);if(Zq.size>=$q){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=`WORKER_BUSY`,e.busy=!0,e.inFlight=Zq.size,e.max=$q,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=null,l=globalThis.setTimeout(()=>{let e=Zq.get(o);if(!e)return;Zq.delete(o),e.cleanup();let t=Error(`Worker render timed out`);t.name=`WorkerTimeout`,t.code=`WORKER_TIMEOUT`,e.aborted||e.reject(t),tJ()},n);c=()=>{let e=Zq.get(o);if(!e||e.aborted)return;e.aborted=!0,e.cleanup();let t=Error(`Aborted`);t.name=`AbortError`,a(t)},r&&r.addEventListener(`abort`,c,{once:!0});let u=e,d=a;Zq.set(o,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:l,aborted:!1,cleanup:()=>{r&&c&&r.removeEventListener(`abort`,c),c=null}});try{s.postMessage({id:o,content:i,displayMode:t})}catch(e){let t=Zq.get(o);Zq.delete(o),clearTimeout(l),t?.cleanup(),t?.reject(e),tJ()}})})}function oJ(e,t=!0,n){let r=`${t?`d`:`i`}:${Jq(e)}`;if(Qq.set(r,n),Qq.size>200){let e=Qq.keys().next().value;Qq.delete(e)}}var sJ=`WORKER_BUSY`;function cJ(e=2e3,t){return Zq.size<$q?Promise.resolve():new Promise((n,r)=>{let i,a=!1,o=null,s=()=>{},c=()=>{i&&globalThis.clearTimeout(i),eJ.delete(s),t&&o&&t.removeEventListener(`abort`,o),o=null};s=()=>{a||(a=!0,c(),n())},eJ.add(s),i=globalThis.setTimeout(()=>{if(a)return;a=!0,c();let e=Error(`Wait for worker slot timed out`);e.name=`WorkerBusyTimeout`,e.code=`WORKER_BUSY_TIMEOUT`,r(e)},e),queueMicrotask(()=>tJ()),t&&(o=()=>{if(a)return;a=!0,c();let e=Error(`Aborted`);e.name=`AbortError`,r(e)},t.aborted?o():t.addEventListener(`abort`,o,{once:!0}))})}var lJ={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function uJ(e){return Pq(this,arguments,function*(e,t=!0,n={}){if(!Gq()){let e=Error(`KaTeX rendering disabled`);throw e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,e}let r=n.timeout??lJ.timeout,i=n.waitTimeout??lJ.waitTimeout,a=n.backoffMs??lJ.backoffMs,o=n.maxRetries??lJ.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),8)):lJ.maxRetries,c=n.signal,l=0;for(;;){if(c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return yield aJ(e,t,r,c)}catch(e){if(e?.code!==`WORKER_BUSY`||l>=s)throw e;if(l++,yield cJ(i,c).catch(()=>{}),c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}a>0&&(yield new Promise(e=>globalThis.setTimeout(e,a*l)))}}})}function dJ(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function fJ(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!(!e||e.startsWith(`%%`)))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function pJ(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=fJ(e);return r===`gantt`?220+28*n:r===`sequencediagram`?180+26*n:r===`classdiagram`||r===`statediagram`||r===`erdiagram`?180+24*n:r===`flowchart`||r===`graph`?170+28*n:200+22*n}function mJ(e){let t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+60*t:360}function hJ(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function gJ(e,t=360,n=500){return hJ(e,t,n)}function _J(e,t=360,n=500){return hJ(e,t,n)}var vJ=Object.defineProperty,yJ=Object.defineProperties,bJ=Object.getOwnPropertyDescriptors,xJ=Object.getOwnPropertySymbols,SJ=Object.prototype.hasOwnProperty,CJ=Object.prototype.propertyIsEnumerable,wJ=(e,t,n)=>t in e?vJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TJ=(e,t)=>{for(var n in t||={})SJ.call(t,n)&&wJ(e,n,t[n]);if(xJ)for(var n of xJ(t))CJ.call(t,n)&&wJ(e,n,t[n]);return e},EJ=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),DJ=()=>he(()=>import(`./mermaid.core-Ddyah3MZ.js`),__vite__mapDeps([6,7,8,9,2,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29])),OJ=null,kJ=DJ,AJ=null,jJ=!1,MJ=!1,NJ=0;function PJ(e){kJ=e,NJ++,OJ=null,AJ=null,jJ=!1,MJ=!1}function FJ(e){PJ(e??DJ)}function IJ(){return typeof kJ==`function`}function LJ(e){if(!e)return e;let t=e&&e.default?e.default:e;if(t&&(typeof t.render==`function`||typeof t.parse==`function`||typeof t.initialize==`function`))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render==`function`||typeof t.mermaidAPI.parse==`function`)){let e=t.mermaidAPI;return n=TJ({},t),r={render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:n=>typeof t.initialize==`function`?t.initialize(n):e.initialize?e.initialize(n):void 0},yJ(n,bJ(r))}var n,r;return e.mermaid&&typeof e.mermaid.render==`function`?e.mermaid:t}function RJ(e){if(e)try{let t=e?.initialize;e.initialize=n=>{let r=TJ({suppressErrorRendering:!0},n||{});return typeof t==`function`?t.call(e,r):e?.mermaidAPI&&typeof e.mermaidAPI.initialize==`function`?e.mermaidAPI.initialize(r):void 0}}catch{}}function zJ(){return EJ(this,null,function*(){if(OJ)return OJ;let e=function(){try{return LJ(globalThis?.mermaid)}catch{return null}}();if(e)return OJ=e,RJ(OJ),OJ;let t=kJ,n=NJ;return t?t===DJ&&jJ?null:AJ||(AJ=EJ(null,null,function*(){let e;try{e=yield t()}catch(e){if(t===DJ)return n===NJ&&t===kJ&&(jJ=!0,function(e){MJ||(MJ=!0,console.warn(`[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.`,e))}(e)),null;throw e}finally{n===NJ&&t===kJ&&(AJ=null)}return n!==NJ||t!==kJ?null:e?(OJ=LJ(e),RJ(OJ),OJ):null}),AJ):null})}var BJ=null,VJ=null,HJ=new Map,UJ=new Map;function WJ(e){for(let t of HJ.values())t.reject(e);HJ.clear(),UJ.clear()}var GJ=5,KJ=!1,qJ=`MERMAID_DISABLED`;function JJ(e){if(BJ&&BJ!==e){let e=Error(`Worker replaced`);e.code=`WORKER_REPLACED`,WJ(e)}BJ=e,VJ=null;let t=e;BJ.onmessage=e=>{if(BJ!==t)return;let{id:n,ok:r,result:i,error:a}=e.data,o=HJ.get(n);o&&(!1===r||a?o.reject(Error(a||`Unknown error`)):o.resolve(i))},BJ.onerror=e=>{var n,r;if(BJ===t)if(HJ.size!==0){try{KJ?console.error(`[mermaidWorkerClient] Worker error:`,e?.message||e):(r=console.debug)==null||r.call(console,`[mermaidWorkerClient] Worker error:`,e?.message||e)}catch{}WJ(Error(`Worker error: ${e.message}`))}else (n=console.debug)==null||n.call(console,`[mermaidWorkerClient] Worker error (no pending):`,e?.message||e)},BJ.onmessageerror=e=>{var n,r;if(BJ===t)if(HJ.size!==0){try{KJ?console.error(`[mermaidWorkerClient] Worker messageerror:`,e):(r=console.debug)==null||r.call(console,`[mermaidWorkerClient] Worker messageerror:`,e)}catch{}WJ(Error(`Worker messageerror`))}else (n=console.debug)==null||n.call(console,`[mermaidWorkerClient] Worker messageerror (no pending):`,e)}}function YJ(){var e;if(BJ)try{WJ(Error(`Worker cleared`)),(e=BJ.terminate)==null||e.call(BJ)}catch{}BJ=null,VJ=null}function XJ(e,t,n,r){if(!IJ()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=qJ,Promise.reject(e)}let i=`${e}\0${t.theme}\0${n}\0${t.code}`,a=UJ.get(i);return a||(a=function(e,t,n=1400){if(!IJ()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=`MERMAID_DISABLED`,Promise.reject(e)}if(VJ)return Promise.reject(VJ);let r=BJ||(VJ=Error(`[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),VJ.name=`WorkerInitError`,VJ.code=`WORKER_INIT_ERROR`,null);if(!r)return Promise.reject(VJ);if(HJ.size>=GJ){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=`WORKER_BUSY`,e.inFlight=HJ.size,e.max=GJ,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s,c=!1,l=()=>{c||(c=!0,s!=null&&globalThis.clearTimeout(s),HJ.delete(o))};HJ.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){HJ.delete(o),a(e);return}s=globalThis.setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`;let t=HJ.get(o);t&&t.reject(e)},n)})}(e,t,n),UJ.set(i,a),a.then(()=>{UJ.get(i)===a&&UJ.delete(i)},()=>{UJ.get(i)===a&&UJ.delete(i)})),function(e,t){if(!t)return e;if(t.aborted){let e=Error(`Aborted`);return e.name=`AbortError`,Promise.reject(e)}return new Promise((n,r)=>{let i=()=>{},a=()=>t.removeEventListener(`abort`,i);i=()=>{a();let e=Error(`Aborted`);e.name=`AbortError`,r(e)},t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{a(),n(e)},e=>{a(),r(e)})})}(a,r)}function ZJ(e,t,n=1400,r){return XJ(`canParse`,{code:e,theme:t},n,r)}function QJ(e,t,n=1400,r){return XJ(`findPrefix`,{code:e,theme:t},n,r)}function $J(e){try{if(typeof globalThis<`u`&&typeof globalThis.requestAnimationFrame==`function`)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}function eY(e){try{if(e==null)return;if(typeof globalThis<`u`&&typeof globalThis.cancelAnimationFrame==`function`)return void globalThis.cancelAnimationFrame(e)}catch{}try{globalThis.clearTimeout(e)}catch{}}var tY=Object.defineProperty,nY=Object.defineProperties,rY=Object.getOwnPropertyDescriptors,iY=Object.getOwnPropertySymbols,aY=Object.prototype.hasOwnProperty,oY=Object.prototype.propertyIsEnumerable,sY=(e,t,n)=>t in e?tY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cY=(e,t)=>{for(var n in t||={})aY.call(t,n)&&sY(e,n,t[n]);if(iY)for(var n of iY(t))oY.call(t,n)&&sY(e,n,t[n]);return e},lY=(e,t)=>nY(e,rY(t)),uY=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),dY=`__global__`,fY=`__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__`,pY=(()=>{let e=globalThis;if(e[fY])return e[fY];let t={scopedCustomComponents:{},revision:ue(0)};return e[fY]=t,t})(),mY=pY.revision,hY=Symbol(`markstreamCustomComponents`),gY=new Set(`text.paragraph.heading.code_block.list.list_item.blockquote.table.table_row.table_cell.definition_list.definition_item.footnote.footnote_reference.footnote_anchor.admonition.hardbreak.link.image.thematic_break.math_inline.math_block.strong.emphasis.strikethrough.highlight.insert.subscript.superscript.emoji.checkbox.checkbox_input.inline_code.html_inline.html_block.reference.mermaid.infographic.d2.vmr_container`.split(`.`));function _Y(e){return gY.has(String(e).trim().toLowerCase())}function vY(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[_\s]+/g,`-`).toLowerCase()}function yY(e={}){let t={};for(let[n,r]of Object.entries(e))if(r!=null){t[n]=r;for(let e of new Set([xL(n),xL(vY(n))]))!e||_Y(e)||Object.prototype.hasOwnProperty.call(t,e)||(t[e]=r)}return t}function bY(e){let t=m(hY,null);return L(()=>(mY.value,function(e,t={}){return mY.value,cY(cY(cY({},yY(pY.scopedCustomComponents[dY]||{})),yY(t)),yY(function(e){return e&&pY.scopedCustomComponents[e]||{}}(e)))}(e?.(),t?.value??{})))}var xY=[`aria-label`],SY={key:0,xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,class:`checkbox-icon checkbox-unchecked`},CY={key:1,xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,class:`checkbox-icon checkbox-checked`},wY=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},TY=wY(G({__name:`CheckboxNode`,props:{node:{}},setup:e=>(t,n)=>(c(),W(`span`,{class:`checkbox-node`,role:`img`,"aria-label":e.node.checked?`checked`:`unchecked`},[e.node.checked?(c(),W(`svg`,CY,[...n[1]||=[F(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`4`,fill:`currentColor`},null,-1),F(`path`,{d:`M9 12l2 2 4-4`,stroke:`hsl(var(--ms-background))`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(c(),W(`svg`,SY,[...n[0]||=[F(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`4`,stroke:`currentColor`,"stroke-width":`2`},null,-1)]]))],8,xY))}),[[`__scopeId`,`data-v-be21ab83`]]);TY.install=e=>{e.component(TY.__name,TY)};var EY={class:`emoji-node`},DY=wY(G({__name:`EmojiNode`,props:{node:{}},setup:e=>(t,n)=>(c(),W(`span`,EY,U(e.node.name),1))}),[[`__scopeId`,`data-v-de55dc97`]]);DY.install=e=>{e.component(DY.__name,DY)};var OY=[`id`],kY=[`title`],AY=wY(G({__name:`FootnoteReferenceNode`,props:{node:{}},setup(e){let t=`#fnref--${e.node.id}`;function n(){if(typeof document>`u`)return;let e=document.querySelector(t);e?e.scrollIntoView({behavior:`smooth`}):console.warn(`Element with href: ${t} not found`)}return(r,i)=>(c(),W(`sup`,{id:`fnref-${e.node.id}`,class:`footnote-reference`,onClick:n},[F(`span`,{href:t,title:`查看脚注 ${e.node.id}`,class:`footnote-link cursor-pointer`},`[`+U(e.node.id)+`]`,9,kY)],8,OY))}}),[[`__scopeId`,`data-v-c1463a29`]]);AY.install=e=>{e.component(AY.__name,AY)};var jY=(()=>{try{return!1}catch{}return!1})();function MY(e){jY&&console.warn(e)}function NY(e,t=`safe`,n){return uK(e,t,n)}function PY(e){return mK(e)}function FY(e){return!0===e?``:!1===e?`false`:e==null?null:String(e)}function IY(e,t=`safe`){let n=String(e.tag||e.type||``).trim(),r=fK((i=e.attrs)?Array.isArray(i)?i.every(Array.isArray)?i.map(([e,t])=>[String(e),FY(t)]):i.filter(e=>e&&typeof e==`object`&&!Array.isArray(e)&&`name`in e).map(e=>[String(e.name),FY(e.value)]):Object.entries(i).map(([e,t])=>[e,FY(t)]):null,t,n);var i;if(!r)return;let a=PY(dK(r));return Object.keys(a).length>0?a:void 0}function LY(e,t,n=!1){let r=Object.entries(t??{}),i=r.length>0?r.map(([e,t])=>t===``?` ${e}`:` ${e}="${t}"`).join(``):``;return n?`<${e}${i} />`:`<${e}${i}>`}function RY(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function zY(e,t,n,r,i,o,s=!1){let c=function(e,t){return lK(e,t)}(e,r);if(JI.has(e.toLowerCase())||!c&&tK(e,o))return null;if(!c&&eK(e,o))return s?[LY(e,t,!0)]:[LY(e,t),...n,``];let l=uK(t,o,e),u=l.key,d=u!=null&&u!==``?u:i;return c?a(r[e]||r[e.toLowerCase()],lY(cY({},PY(l)),{key:d}),n.length>0?n:void 0):a(e,lY(cY({},l),{innerHTML:void 0,key:d}),n.length>0?n:void 0)}function BY(e,t){return yK(e,t)}function VY(e,t,n=`safe`){if(!e)return[];try{return function(e,t,n=`safe`){let r=0,i=[],a=[];for(let o of e)if(o.type===`text`)(i.length>0?i[i.length-1].children:a).push(o.content);else if(o.type===`self_closing`){let e=zY(o.tagName,o.attrs||{},[],t,`ms-html-`+ r++,n,!0);RY(i.length>0?i[i.length-1].children:a,e)}else if(o.type===`tag_open`)i.push({tagName:o.tagName,children:[],attrs:o.attrs,autoKey:`ms-html-`+ r++});else if(o.type===`tag_close`){let e=o.tagName.toLowerCase(),r=-1;for(let t=i.length-1;t>=0;t--)if(i[t].tagName.toLowerCase()===e){r=t;break}if(r!==-1)for(;i.length>r;){let o=i.pop(),s=zY(o.tagName,o.attrs||{},o.children,t,o.autoKey,n);i.length>0?RY(i[i.length-1].children,s):RY(a,s),o.tagName.toLowerCase()!==e&&i.length>r&&MY(`Auto-closing unclosed tag: <${o.tagName}>`)}else MY(`Ignoring closing tag with no matching opening tag: `)}for(;i.length>0;){let e=i.pop(),r=zY(e.tagName,e.attrs||{},e.children,t,e.autoKey,n);i.length>0?RY(i[i.length-1].children,r):RY(a,r),MY(`Auto-closing unclosed tag: <${e.tagName}>`)}return a}(gK(e),t,n)}catch(e){return r=e,jY&&console.error(`Failed to parse HTML to VNodes:`,r),null}var r}var HY=[`innerHTML`],UY=wY(G({__name:`HtmlInlineNode`,props:{node:{},customId:{},htmlPolicy:{}},setup(e){let t=e,n=m(`markstreamHtmlPolicy`,void 0),r=L(()=>t.htmlPolicy??n?.value??`safe`),i=bY(()=>t.customId),a=G({name:`DynamicRenderer`,props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),o=L(()=>{let e=t.node.content;if(!e)return{mode:`html`,content:``};if(r.value===`escape`)return{mode:`html`,content:bK(e,r.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:`text`,content:e};if(t.node.loading&&t.node.autoClosed){let t=VY(e,i.value,r.value);if(t!==null)return{mode:`dynamic`,nodes:t}}if(!BY(e,i.value))return{mode:`html`,content:bK(e,r.value)};let n=VY(e,i.value,r.value);return n===null?{mode:`html`,content:bK(e,r.value)}:{mode:`dynamic`,nodes:n}});return(e,n)=>o.value.mode===`dynamic`?(c(),W(`span`,{key:0,class:V([`html-inline-node`,{"html-inline-node--loading":t.node.loading}])},[v(z(a),{nodes:o.value.nodes},null,8,[`nodes`])],2)):o.value.mode===`text`?(c(),W(`span`,{key:1,class:V([`html-inline-node`,{"html-inline-node--loading":t.node.loading}])},U(o.value.content),3)):(c(),W(`span`,{key:2,class:V([`html-inline-node`,{"html-inline-node--loading":t.node.loading}]),innerHTML:o.value.content},null,10,HY))}}),[[`__scopeId`,`data-v-d17f12b0`]]);UY.install=e=>{e.component(UY.__name,UY)};var WY={class:`inline-code`},GY={key:0},KY=wY(G({__name:`InlineCodeNode`,props:{node:{}},setup(e){let n=e,r=b(),i=m(`markstreamFade`,void 0),a=m(`markstreamTextStreamState`,void 0),o=m(`markstreamStreamVersion`,void 0),l=L(()=>{let e=r.fade;return e===``||!0===e||e===`true`||!1!==e&&e!==`false`&&void 0}),u=L(()=>typeof l.value==`boolean`?l.value:typeof i?.value!=`boolean`||i.value),d=L(()=>String(n.node.code??``)),f=L(()=>!u.value),p=L(()=>{let e=r[`index-key`]??r.indexKey;return e==null||e===``?``:String(e)}),h=R(n.node.code),g=R(``),_=R(0),v;function y(){v?.(),v=void 0}function x(){y(),g.value&&=(h.value+=g.value,``)}s([()=>n.node.code,p,u],([e])=>{let t=String(e??``),n=p.value,r=XK({nextContent:t,persistedContent:n?a?.get(n):void 0,currentState:{settledContent:h.value,streamedDelta:g.value},typewriterEnabled:u.value});h.value=r.settledContent,g.value=r.streamedDelta,r.appended?(_.value+=1,function(){if(!g.value||v||!o)return;let e=o.value;v=s(()=>o.value,t=>{t!==e&&x()},{flush:`sync`})}()):g.value||y(),n&&a?.set(n,t)},{immediate:!0}),t(y);let S=L(()=>_.value%2==0?`inline-code-stream-delta--a`:`inline-code-stream-delta--b`);return(e,t)=>(c(),W(`code`,WY,[f.value?(c(),W(M,{key:0},[K(U(d.value),1)],64)):(c(),W(M,{key:1},[h.value?(c(),W(`span`,GY,U(h.value),1)):E(``,!0),g.value?(c(),W(`span`,{key:1,class:V([`inline-code-stream-delta`,[S.value]]),onAnimationend:x},U(g.value),35)):E(``,!0)],64))]))}}),[[`__scopeId`,`data-v-4e331c97`]]);KY.install=e=>{e.component(KY.__name,KY)};var qY=R(!1),JY=R(``),YY=R(`top`),XY=R(null),ZY=R(null),QY=R(null),$Y=R(null),eX=R(null),tX=null,nX=null,rX=0;function iX(){tX&&=(clearTimeout(tX),null),nX&&=(clearTimeout(nX),null)}var aX=!1,oX=null,sX=!1;function cX(e,t,n=`top`,r=!1,i,a){if(!e)return;let o=++rX;iX();let s=()=>uY(null,null,function*(){if(yield function(){return uY(this,null,function*(){if(!aX&&!sX&&typeof document<`u`){oX??=uY(null,null,function*(){let[{createApp:e,h:t},{default:n}]=yield Promise.all([he(()=>import(`./vue.runtime.esm-bundler-Cwbj1t-C.js`).then(e=>e.t),__vite__mapDeps([1,2])),he(()=>import(`./Tooltip-CYPLmGXR.js`),__vite__mapDeps([30,7,1,2]))]),r=document.createElement(`div`);r.setAttribute(`data-singleton-tooltip`,`1`),document.body.appendChild(r),e({setup:()=>()=>t(n,{visible:qY.value,"anchor-el":XY.value,content:JY.value,placement:YY.value,id:ZY.value,originX:QY.value,originY:$Y.value,isDark:eX.value??void 0})}).mount(r),aX=!0});try{yield oX}catch(e){aX=!1,oX=null,sX=!0,console.warn(`[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.`,e)}}})}(),aX&&o===rX){ZY.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,XY.value=e,JY.value=t,YY.value=n,QY.value=i?.x??null,$Y.value=i?.y??null,eX.value=typeof a==`boolean`?a:null,qY.value=!0;try{e.setAttribute(`aria-describedby`,ZY.value)}catch{}}});r?s():tX=setTimeout(s,80)}function lX(e=!1){rX+=1,iX();let t=()=>{if(XY.value&&ZY.value)try{XY.value.removeAttribute(`aria-describedby`)}catch{}qY.value=!1,XY.value=null,ZY.value=null,QY.value=null,$Y.value=null};e?t():nX=setTimeout(t,120)}var uX={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.minimize":`Minimize`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`},dX=Symbol(`markstreamI18nFallback`);function fX(e,t){return t?.[e]??uX[e]}var pX=(e,t)=>fX(e,t)??function(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e);function mX(e,t){return{t(n){let r=fX(n,t);if(e.te&&r!=null&&!e.te(n))return pX(n,t);let i=e.t(n);return i===n&&r!=null?pX(n,t):i}}}function hX(){let e=function(){try{let e=y(),t=dX,n=e?.provides,r=e?.appContext?.provides;return n?.[t]??r?.[t]??null}catch{}return null}(),t=function(){try{let e=y(),t=e?.proxy,n=t?.$t;if(typeof n==`function`){let e=t?.$te;return{t:n.bind(t),te:typeof e==`function`?e.bind(t):void 0}}let r=e?.appContext?.config?.globalProperties,i=r?.$t;if(typeof i==`function`){let e=r?.$te;return{t:i.bind(r),te:typeof e==`function`?e.bind(r):void 0}}}catch{}return null}();if(t)return mX(t,e);try{let t=globalThis.$vueI18nUse||null;if(t&&typeof t==`function`)try{let n=t();if(n&&typeof n.t==`function`)return mX({t:n.t.bind(n),te:typeof n.te==`function`?n.te.bind(n):void 0},e)}catch{}}catch{}return{t:t=>pX(t,e)}}var gX=Symbol(`ViewportPriority`),_X=Symbol(`ViewportPriorityOptions`),vX=Symbol(`OffscreenHeavyNodeDeferral`),yX=L(()=>!1),bX=`400px`;function xX(){return m(_X,void 0)}function SX(){return m(vX,yX)}function CX(e,t){let n=typeof window<`u`&&typeof document<`u`,r=typeof t==`boolean`?R(t):t,i=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,a=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null,o=new WeakMap,c=1,l=new Map,u=new Map,f=new Set,p=null,m=null;function h(e){if(!e)return`viewport`;let t=o.get(e);return t||(t=c++,o.set(e,t)),String(t)}function g(){if(p!=null){try{a?.(p)}catch{}p=null}}function _(e){if(e){let t=l.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch{}l.delete(e)}}u.size||f.size||g()}function v(e){let t=u.get(e);if(!t)return;let n=l.get(t.bucketKey);if(!t.visible.value){t.visible.value=!0;try{t.resolve()}catch{}}try{n?.io.unobserve(e)}catch{}n?.targets.delete(e),u.delete(e),f.delete(e),_(t.bucketKey)}function y(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&p==null&&f.size&&(p=i(()=>{p=null;let e=f.values().next().value;e&&(f.delete(e),v(e),f.size&&y())},{timeout:1200}))}function b(t,r){if(!n||typeof IntersectionObserver>`u`)return null;let i=function(t,n){return{root:e?.(t??null)??null,rootMargin:n?.rootMargin??bX,threshold:n?.threshold??0}}(t,r),a=[h((o=i).root),o.rootMargin,o.threshold].join(`\0`);var o;let s=l.get(a);if(s)return{key:a,bucket:s};let c;try{c=new IntersectionObserver(e=>{for(let t of e)(t.isIntersecting||t.intersectionRatio>0)&&v(t.target)},{root:i.root,rootMargin:i.rootMargin,threshold:i.threshold})}catch{return null}let u={io:c,targets:new Map};return l.set(a,u),{key:a,bucket:u}}function x(){if(n&&r.value)for(let[e,t]of Array.from(u.entries())){let n=b(e,t.opts);if(!n){v(e);continue}if(n.key===t.bucketKey)continue;let r=t.bucketKey,i=l.get(r);try{i?.io.unobserve(e)}catch{}i?.targets.delete(e),t.bucketKey=n.key,n.bucket.targets.set(e,t),n.bucket.io.observe(e),_(r)}}s(r,e=>{if(!e){for(let e of Array.from(u.keys()))v(e);g()}},{flush:`sync`});let S=(e,t)=>{let i=R(!1),a,o=!1,s=new Promise(e=>{a=()=>{o||(o=!0,e())}}),c=()=>{let t=u.get(e);if(!t)return f.delete(e),void _();let n=l.get(t.bucketKey);try{n?.io.unobserve(e)}catch{}n?.targets.delete(e),u.delete(e),f.delete(e),_(t.bucketKey)};if(!n||!r.value)return i.value=!0,a(),{isVisible:i,whenVisible:s,destroy:c};let d=b(e,t);if(!d)return i.value=!0,a(),{isVisible:i,whenVisible:s,destroy:c};let p={resolve:a,visible:i,bucketKey:d.key,opts:t};return u.set(e,p),d.bucket.targets.set(e,p),d.bucket.io.observe(e),n&&m==null&&(m=window.requestAnimationFrame(()=>{m=null,x()})),!1!==t?.allowIdle&&(f.add(e),y()),{isVisible:i,whenVisible:s,destroy:c}};return S.refresh=x,d(gX,S),S}function wX(){let e=m(gX,void 0);if(e)return e;let t=new WeakMap,n=new Map,r=new Set,i=null,a=typeof window<`u`?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,o=typeof window<`u`?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null,s=()=>{if(i!=null){try{o?.(i)}catch{}i=null}},c=e=>{if(!e)return;let t=n.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch{}n.delete(e)}},l=e=>{let i=t.get(e);if(!i)return;let a=n.get(i.bucketKey);if(!i.visible.value){i.visible.value=!0;try{i.resolve()}catch{}}try{a?.io.unobserve(e)}catch{}t.delete(e),a?.targets.delete(e),r.delete(e),c(i.bucketKey),r.size||s()},u=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&i==null&&r.size&&(i=a(()=>{i=null;let e=r.values().next().value;e&&(r.delete(e),l(e),r.size&&u())},{timeout:1200}))};return(e,i)=>{let a=R(!1),o,d=!1,f=new Promise(e=>{o=()=>{d||(d=!0,e())}}),p=()=>{let i=t.get(e);if(!i)return r.delete(e),void(r.size||s());let a=n.get(i.bucketKey);try{a?.io.unobserve(e)}catch{}t.delete(e),a?.targets.delete(e),r.delete(e),c(i.bucketKey),r.size||s()},m=(e=>{if(typeof window>`u`||typeof IntersectionObserver>`u`)return null;let t=(e=>[e?.rootMargin??bX,e?.threshold??0].join(`\0`))(e),r=n.get(t);if(r)return{key:t,bucket:r};let i=e?.rootMargin??bX,a;try{a=new IntersectionObserver(e=>{for(let t of e)(t.isIntersecting||t.intersectionRatio>0)&&l(t.target)},{root:null,rootMargin:i,threshold:e?.threshold??0})}catch{return null}let o={io:a,targets:new Set};return n.set(t,o),{key:t,bucket:o}})(i);return m?(t.set(e,{resolve:o,visible:a,bucketKey:m.key}),m.bucket.targets.add(e),m.bucket.io.observe(e),!1!==i?.allowIdle&&(r.add(e),u()),{isVisible:a,whenVisible:f,destroy:p}):(a.value=!0,o(),{isVisible:a,whenVisible:f,destroy:p})}}function TX(e,t){let n=e.indexKey??t[`index-key`]??t.indexKey;return n==null||n===``?``:String(n)}var EX=[`data-markstream-viewport-pending`],DX=[`src`,`alt`,`title`,`loading`,`fetchpriority`,`decoding`,`tabindex`,`aria-label`],OX={key:1,class:`image-placeholder`},kX={key:1,class:`image-node__raw-text`},AX={key:2,class:`image-shimmer-overlay`},jX={key:1,class:`image-node__raw-text`},MX={key:3,class:`image-error`},NX=wY(G({__name:`ImageNode`,props:{node:{},fallbackSrc:{default:``},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:[`load`,`error`,`click`],setup(e,{emit:t}){var r;let i=e,a=t,o=R(!1),l=R(!1),u=R(``),d=R(`primary`),f=R(null),p=b(),h=m(pq,null),g=wX(),_=xX(),v=SX(),x=L(()=>dL(i.node.src)),S=L(()=>dL(i.fallbackSrc)),C=((r=y()?.vnode.el)?.querySelector)?.call(r,`img`),w=typeof window<`u`&&C?.getAttribute(`src`)===(x.value||S.value),T=R(typeof window>`u`||w||!v.value),D=ue(null),O=``,k=null,A=L(()=>u.value),j=L(()=>!i.lazy),M=L(()=>typeof window<`u`&&v.value&&!w),N=L(()=>!M.value||T.value),ee=L(()=>N.value?A.value:``),P=L(()=>_?.value.heavyBlockMargin??_?.value.rootMargin??bX),I=L(()=>!i.node.loading&&d.value!==`failed`&&u.value.length>0),te=L(()=>d.value===`failed`),re=L(()=>(!j.value||M.value&&!T.value)&&!o.value&&!l.value&&d.value!==`failed`&&u.value.length>0),ie=L(()=>TX(i,p));function ae(e=ie.value){e&&f.value&&h?.reportHeight(e,f.value.offsetHeight)}function oe(e=ie.value){e&&n(()=>{ae(e)})}function se(){k&&=(clearTimeout(k),null)}function ce(){let e=ie.value;e&&O!==e&&(O&&h?.markSettled(O),se(),O=e,h?.markPending(e),typeof window<`u`&&(k=window.setTimeout(()=>{O===e&&(oe(e),B())},8e3)))}function B(){return uY(this,null,function*(){let e=O;e&&(se(),O=``,yield n(),ae(e),h?.markSettled(e))})}function le(){if(d.value===`primary`&&S.value&&S.value!==u.value)return d.value=`fallback`,u.value=S.value,o.value=!1,l.value=!1,void oe();d.value=`failed`,l.value=!0,a(`error`,u.value),oe()}function de(){o.value=!0,l.value=!1,a(`load`,A.value),oe()}function fe(e){e.preventDefault(),o.value&&!l.value&&a(`click`,[e,A.value])}let{t:H}=hX();return s([x,S,()=>i.node.loading],()=>(o.value=!1,l.value=!1,i.node.loading||x.value?(u.value=x.value,void(d.value=`primary`)):S.value?(u.value=S.value,void(d.value=`fallback`)):(u.value=``,d.value=`failed`,void(l.value=!0))),{immediate:!0}),typeof window<`u`&&s([f,M],([e,t],n,r)=>{var i;if((i=D.value)==null||i.destroy(),D.value=null,!t||T.value)return void(T.value=!0);if(!e)return void(T.value=!1);let a=!0,o=g(e,{rootMargin:P.value,allowIdle:!1});D.value=o,T.value=o.isVisible.value,o.whenVisible.then(()=>{a&&D.value===o&&(T.value=!0)}),r(()=>{a=!1,o.destroy(),D.value===o&&(D.value=null)})},{immediate:!0}),s([I,o,l,A,()=>i.lazy,N],([e,t,n,r,i,a])=>e&&r&&!n&&a?t?(B(),void oe()):i?(ce(),void oe()):void(t||n||ce()):(B(),void oe()),{flush:`post`,immediate:!0}),ne(()=>{var e;(e=D.value)==null||e.destroy(),D.value=null,function(){let e=O;e&&(se(),O=``,h?.markSettled(e))}()}),(t,n)=>(c(),W(`span`,{ref_key:`rootRef`,ref:f,class:`image-node-container`,"data-markstream-viewport-pending":M.value&&!T.value?`true`:void 0},[I.value?(c(),W(`img`,{key:0,src:ee.value||void 0,alt:String(i.node.alt??i.node.title??``),title:String(i.node.title??i.node.alt??``),class:V([`image-node__img`,{"is-loading":!j.value&&!o.value,"is-loaded":j.value||o.value,"has-natural-size":o.value,"cursor-pointer":o.value}]),loading:i.lazy?`lazy`:void 0,fetchpriority:j.value?`high`:void 0,decoding:j.value?`sync`:`async`,tabindex:o.value?0:-1,"aria-label":i.node.alt??z(H)(`image.preview`),onError:le,onLoad:de,onClick:fe},null,42,DX)):E(``,!0),e.node.loading&&!l.value?(c(),W(`span`,OX,[i.usePlaceholder?me(t.$slots,`placeholder`,{key:0,node:i.node,displaySrc:A.value,imageLoaded:o.value,hasError:l.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[n[0]||=F(`span`,{class:`image-shimmer`},null,-1)],!0):(c(),W(`span`,kX,U(e.node.raw),1))])):E(``,!0),re.value&&!e.node.loading?(c(),W(`span`,AX,[i.usePlaceholder?me(t.$slots,`placeholder`,{key:0,node:i.node,displaySrc:A.value,imageLoaded:o.value,hasError:l.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[n[1]||=F(`span`,{class:`image-shimmer`},null,-1)],!0):(c(),W(`span`,jX,U(e.node.raw),1))])):E(``,!0),te.value?(c(),W(`span`,MX,[me(t.$slots,`error`,{node:i.node,displaySrc:A.value,imageLoaded:o.value,hasError:l.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[n[2]||=F(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`},[F(`path`,{fill:`currentColor`,d:`M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z`})],-1),F(`span`,null,U(z(H)(`image.loadError`)),1)],!0)])):E(``,!0)],8,EX))}}),[[`__scopeId`,`data-v-046e82ac`]]);NX.install=e=>{e.component(NX.__name,NX)};var PX={key:2},FX=G({__name:`NodeChildRenderer`,props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){let t=e,n=bY(()=>t.customId),r=m(`markstreamHtmlPolicy`,void 0),a=m(`markstreamNestedRendererProps`,void 0),o=L(()=>r?.value??`safe`),s=L(()=>{let e=a?.value??{};return lY(cY({},e),{customId:t.customId??e.customId,htmlPolicy:o.value})}),l=i({loader:()=>Promise.resolve().then(()=>F0),suspensible:!1}),u=L(()=>t.components[String(t.node.type)]),d=L(()=>!!(u.value&&n.value[t.node.type]&&!_Y(String(t.node.type)))),f=L(()=>d.value?IY(t.node,o.value):void 0),p=L(()=>Array.isArray(t.node.children)&&t.node.children.length>0),h=L(()=>String(t.node.content??``)),g=L(()=>String(t.node.content??t.node.raw??``));return(t,n)=>u.value&&d.value?(c(),P(x(u.value),re({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":s.value.isDark}),{default:B(()=>[p.value?(c(),P(z(l),re({key:0},s.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):h.value?(c(),P(z(l),re({key:1},s.value,{content:h.value,final:!e.node.loading,"index-key":`${e.indexKey||`child`}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:1},16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):u.value?(c(),P(x(u.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,[`node`,`custom-id`,`index-key`])):e.fallbackToText?(c(),W(`span`,PX,U(g.value),1)):E(``,!0)}}),IX=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function LX(e){var t;if(typeof e==`boolean`)return e;if(e&&typeof e==`object`){let n=e;return lY(cY(cY({},IX),n),{enabled:(t=n.enabled)==null||t})}return cY({},IX)}function RX(e,t){if(!1===e.renderSideBySide)return!0;if(!0!==e.useInlineViewWhenSpaceIsLimited)return!1;let n=e.renderSideBySideInlineBreakpoint;return t>0&&t<=(typeof n==`number`&&Number.isFinite(n)?n:900)}function zX(e){let t=String(e??``).split(/\r?\n/,1)[0]?.trim()??``;if(t.length<3)return``;let n=t[0];if(n!=="`"&&n!==`~`||t[1]!==n||t[2]!==n)return``;let r=3;for(;t[r]===n;)r+=1;return t.slice(r).trim()}function BX(e){return(String(e??``).trim().split(/\s+/,1)[0]??``)===`diff`}function VX(e){return!0===e.diff||BX(e.language)||BX(zX(String(e.raw??``)))}function HX(e,t,n){let r=function(e){let t=zX(e);if(!t)return``;let n=t.split(/\s+/).filter(Boolean);if(!n.length)return``;let r=n[0]===`diff`?n.slice(1):n;for(let e of r){let t=e.includes(`:`)?e.slice(e.indexOf(`:`)+1):e;if(t&&/[./\\-]/.test(t))return t}return``}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:``}}var UX=[`aria-busy`,`aria-label`,`data-language`,`data-markstream-line-numbers`],WX={key:0,translate:`no`,class:`markstream-pre__diff-code`},GX={class:`markstream-pre__diff-pane-content`},KX={class:`markstream-pre__diff-number`,"aria-hidden":`true`},qX={class:`markstream-pre__diff-content`},JX={class:`markstream-pre__diff-content-inner`},YX={key:0,class:`markstream-pre__line-numbers`,"aria-hidden":`true`},XX=[`textContent`],ZX=[`textContent`],QX=G({__name:`PreCodeNode`,props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){let t=e;function r(e,t){let n=String(e??``);return t?n:n.replace(/\r\n$|\n$|\r$/,``)}let i=L(()=>{let e=String(t.node?.language??``);return String(String(e).split(/\s+/g)[0]??``).toLowerCase().replace(/[^\w-]/g,``)||`plaintext`}),a=L(()=>`language-${i.value}`),o=L(()=>!0===t.loading||!0===t.node?.loading),l=L(()=>r(t.node?.code,o.value)),u=``,d=1,f=L(()=>function(e){let t=0,n=1;e.startsWith(u)&&(t=u.length,n=d,t>0&&e[t-1]===`\r`&&e[t]===` `&&t++);for(let r=t;rl.value.split(/\r\n|\n|\r/)),m=0,h=``,g=L(()=>{let e=f.value;e!0===t.showLineNumbers&&!0===t.node?.diff),y=L(()=>v.value&&!0===t.diffInline),b=L(()=>{let e=Number(t.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;let n=`${Math.ceil(e)}px`;return o.value?{maxHeight:n,overflow:`auto`}:{height:n,minHeight:n,maxHeight:n,overflow:`auto`}}),x=[`diff `,`index `,`--- `,`+++ `,`@@ `];function S(e){return String(e??``).trim().length===0}function C(e,t=`context`,n={}){let r=S(e);return{code:e,kind:r&&t!==`hunk`&&t!==`spacer`&&!n.preserveBlankKind?`context`:t,empty:r}}function w(e){let t=r(e,o.value);return t?t.split(/\r\n|\n|\r/):[]}function T(e,t){return!S(e[t])||tx.some(t=>e.startsWith(t)))}function A(e,t){return t||!e.startsWith(` `)||e.startsWith(` `)?e:` ${e}`}function j(e,t){let n=e.length,r=t.length,i=[],a=0;for(;a=a&&l>=a&&e[c]===t[l];)s.unshift({originalIndex:c,modifiedIndex:l}),c--,l--;let u=c-a+1,d=l-a+1;if(u<=0||d<=0||o.value||(u+1)*(d+1)>15e5)return i.concat(s);let f=d+1,p=new Uint32Array((u+1)*(d+1));for(let n=u-1;n>=0;n--)for(let r=d-1;r>=0;r--){let i=n*f+r;if(e[a+n]===t[a+r])p[i]=p[(n+1)*f+r+1]+1;else{let e=p[(n+1)*f+r],t=p[n*f+r+1];p[i]=e>=t?e:t}}let m=[],h=0,g=0;for(;h=p[h*f+g+1]?h++:g++;return i.concat(m,s)}function N(e){let n=function(){let e=t.diffHideUnchangedRegions;if(e==null||!1===e)return null;let n=!0===e?{}:e;return!1===n.enabled?null:{contextLineCount:Math.max(0,Math.floor(n.contextLineCount??2)),minimumLineCount:Math.max(1,Math.floor(n.minimumLineCount??4))}}();if(!n||e.length<1||e.length>2||e.length===2&&e[0].lines.length!==e[1].lines.length)return e;let r=e[0].lines,i=e[1]?.lines,a=e=>r[e].kind===`context`&&(i===void 0||i[e].kind===`context`&&r[e].code===i[e].code),o=[],s=0;for(;s=n.minimumLineCount){let i=e+(e===0?0:n.contextLineCount),a=t-(t===r.length?0:n.contextLineCount);a-i>=n.minimumLineCount&&o.push({start:i,end:a})}s===e&&s++}return o.length?e.map((e,t)=>{let n=[],r=0;for(let i of o)n.push(...e.lines.slice(r,i.start)),n.push({code:t===0?`Unmodified lines`:``,kind:`collapsed`,empty:!1,key:`${e.key}-collapsed-${i.start}-${i.end}`,number:``}),r=i.end;return n.push(...e.lines.slice(r)),iY(rY({},e),{lines:n})}):e}let ee=L(()=>{if(!v.value)return[];let e=function(e){let n=e.some(e=>D(e)),r=e.some(e=>O(e));return n&&r||function(){if(i.value===`diff`)return!0;let e=String(t.node?.raw??``).split(/\r?\n/,1)[0]?.trim()??``;return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(e)}()&&(n||r)}(p.value),n=function(){return t.node?.originalCode!=null||t.node?.updatedCode!=null}();if(y.value)return N([{key:`inline`,className:`markstream-pre__diff-pane--inline`,lines:n?function(e,t){let n=w(e),r=w(t),i=j(n,r);if(i.length>0){let e=[],t=0,a=0;for(let o of i){for(;t=o&&c>=o&&n[s]===r[c];)l.unshift(iY(rY({},C(r[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let e=o;e<=s;e++)a.push(iY(rY({},C(n[e],`removed`,{preserveBlankKind:T(n,e)})),{key:`inline-removed-source-${e}`,number:e+1}));for(let e=o;e<=c;e++)a.push(iY(rY({},C(r[e],`added`,{preserveBlankKind:T(r,e)})),{key:`inline-added-source-${e}`,number:e+1}));return a.concat(l)}(t.node?.originalCode,t.node?.updatedCode):function(e){let t=[],n=1,r=1,i=k(e);for(let[a,o]of e.entries())if(o.startsWith(`@@`)){let e=o.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);e&&(n=Number(e[1]),r=Number(e[2])),t.push(iY(rY({},C(o,`hunk`)),{key:`inline-hunk-${a}`,number:``}))}else if(D(o))t.push(iY(rY({},C(A(o.slice(1),i),`removed`,{preserveBlankKind:!0})),{key:`inline-removed-${a}`,number:n++}));else if(O(o))t.push(iY(rY({},C(A(o.slice(1),i),`added`,{preserveBlankKind:!0})),{key:`inline-added-${a}`,number:r++}));else{let e=i&&o.startsWith(` `)?o.slice(1):o;t.push(iY(rY({},C(e)),{key:`inline-context-${a}`,number:r})),n++,r++}return t}(p.value)}]);if(!e&&n)return function(e,t){let n=w(e),r=w(t),i=j(n,r),a=[],o=[],s=0,c=0,l=0,u=(e,t)=>{let i=Math.max(e-s,t-c);for(let u=0;uiY(rY({},e),{key:`original-${t}`,number:t+1}))},{key:`modified`,className:`markstream-pre__diff-pane--modified`,lines:a.map((e,t)=>iY(rY({},e),{key:`modified-${t}`,number:t+1}))}])}),P=L(()=>ee.value.some(e=>e.lines.some(e=>e.kind===`collapsed`))),I=L(()=>{let e=i.value;return e?`Code block: ${e}`:`Code block`}),te=R(null),re=R([]),ie=null,oe=!1,se=null;function z(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:0}function ce(e,t){if(!e)return t;if(e.classList.contains(`markstream-pre__diff-line--collapsed`))return 32;let n=e.querySelector(`.markstream-pre__diff-content`)?.getBoundingClientRect()?.height??0;return Math.max(t,Math.ceil(n))}function B(){oe||typeof window>`u`||(ie!=null&&window.cancelAnimationFrame(ie),ie=window.requestAnimationFrame(()=>{ie=null,oe||function(){ie=null;let e=te.value;if(!e||!v.value||y.value||!e.classList.contains(`is-wrap`))return void(re.value.length&&(re.value=[]));let t=function(e){let t=window.getComputedStyle(e),n=z(t.getPropertyValue(`--markstream-pre-diff-line-height`));if(n>0)return n;let r=z(t.lineHeight);return r>0?r:18}(e),n=Array.from(e.querySelectorAll(`.markstream-pre__diff-pane--original .markstream-pre__diff-line`)),r=Array.from(e.querySelectorAll(`.markstream-pre__diff-pane--modified .markstream-pre__diff-line`)),i=Math.max(n.length,r.length),a=[];for(let e=0;e{let n=s[t];return n&&Math.abs(e.rowHeight-n.rowHeight)<=.5&&Math.abs(e.originalHeight-n.originalHeight)<=.5&&Math.abs(e.modifiedHeight-n.modifiedHeight)<=.5})||(re.value=a)}()}))}function le(e){se?.disconnect(),se=null,e&&v.value&&!y.value&&typeof ResizeObserver<`u`&&(se=new ResizeObserver(()=>{B()}),se.observe(e))}function ue(e,t){let n=re.value[e];if(!n)return;let r=t===`original`?n.originalHeight:n.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(n.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(r)}px`}}return s(te,e=>{le(e),n(()=>B())},{flush:`post`}),s([v,y,ee],()=>{le(te.value),n(()=>B())},{flush:`post`,immediate:!0}),ne(()=>{oe=!0,ie!=null&&(window.cancelAnimationFrame(ie),ie=null),se?.disconnect(),se=null}),(e,n)=>(c(),W(`pre`,{ref_key:`preRef`,ref:te,style:ae(b.value),class:V([a.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":v.value,"markstream-pre--diff-inline":y.value,"markstream-pre--diff-collapsed":P.value}]),"aria-busy":o.value,"aria-label":I.value,"data-language":i.value,"data-markstream-line-numbers":t.showLineNumbers?`1`:void 0,"data-markstream-pre":`1`,tabindex:`0`},[v.value?(c(),W(`code`,zX,[(c(!0),W(M,null,_(ee.value,e=>(c(),W(`span`,{key:e.key,class:V([`markstream-pre__diff-pane`,e.className])},[F(`span`,BX,[(c(!0),W(M,null,_(e.lines,(t,r)=>(c(),W(`span`,{key:t.key,class:V([`markstream-pre__diff-line`,[`markstream-pre__diff-line--${t.kind}`,{"markstream-pre__diff-line--empty":t.empty}]]),style:ae(ue(r,e.key))},[n[0]||=F(`span`,{class:`markstream-pre__diff-rail`,"aria-hidden":`true`},null,-1),F(`span`,VX,U(t.number),1),F(`span`,HX,[F(`span`,UX,U(t.code),1)])],6))),128))])],2))),128))])):(c(),W(M,{key:1},[t.showLineNumbers?(c(),W(`span`,WX,[F(`span`,{class:`markstream-pre__line-numbers-text`,textContent:U(g.value)},null,8,GX)])):E(``,!0),F(`code`,{translate:`no`,class:`markstream-pre__code`,textContent:U(l.value)},null,8,KX)],64))],14,RX))}});qX.install=e=>{e.component(qX.__name,qX)};var JX={key:0},YX=yY(G({__name:`TextNode`,props:{node:{}},emits:[`copy`],setup(e){let n=e,r=b(),i=m(`markstreamFade`,void 0),a=m(`markstreamTextStreamState`,void 0),o=m(`markstreamStreamVersion`,void 0),l=L(()=>{let e=r.fade;return e===``||!0===e||e===`true`||!1!==e&&e!==`false`&&void 0}),u=L(()=>typeof l.value==`boolean`?l.value:typeof i?.value!=`boolean`||i.value),d=L(()=>{let e=r[`index-key`]??r.indexKey;return e==null||e===``?``:String(e)}),f=R(n.node.content),p=R(``),h=R(0),g;function _(){g?.(),g=void 0}function v(){_(),p.value&&=(f.value+=p.value,``)}s([()=>n.node.content,d,u],([e])=>{let t=String(e??``),n=d.value,r=GK({nextContent:t,persistedContent:n?a?.get(n):void 0,currentState:{settledContent:f.value,streamedDelta:p.value},typewriterEnabled:u.value});f.value=r.settledContent,p.value=r.streamedDelta,r.appended?(h.value+=1,function(){if(!p.value||g||!o)return;let e=o.value;g=s(()=>o.value,t=>{t!==e&&v()},{flush:`sync`})}()):p.value||_(),n&&a?.set(n,t)},{immediate:!0}),t(_);let y=L(()=>h.value%2==0?`text-node-stream-delta--a`:`text-node-stream-delta--b`);return(t,n)=>(c(),W(`span`,{class:V([[e.node.center?`text-node-center`:``],`text-node`])},[f.value?(c(),W(`span`,JX,U(f.value),1)):E(``,!0),p.value?(c(),W(`span`,{key:1,class:V([`text-node-stream-delta`,[y.value]]),onAnimationend:v},U(p.value),35)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-a7e90764`]]);function XX(e,t,n){return G({name:e,inheritAttrs:!1,setup(e,{attrs:r,slots:i}){let o=yX(),c=gX(),l=_X(),u=typeof window<`u`&&y()?.vnode.el?.nodeType===1,d=R(typeof window>`u`||u||!l.value),f=ue(null),p=null;function m(e){let t=e&&`$el`in e?e.$el:e;f.value=t instanceof HTMLElement?t:null}return typeof window<`u`&&s([f,l],([e,t],n,r)=>{if(p?.destroy(),p=null,!t||d.value)return void(d.value=!0);if(!e)return;let i=!0,a=o(e,{rootMargin:c?.value.heavyBlockMargin,allowIdle:!1});p=a,d.value=a.isVisible.value,a.whenVisible.then(()=>{i&&p===a&&(d.value=!0)}),r(()=>{i=!1,a.destroy(),p===a&&(p=null)})},{immediate:!0}),ne(()=>{p?.destroy(),p=null}),()=>a(d.value?t:n,iY(rY({},r),{ref:m}),i)}})}YX.install=e=>{e.component(YX.__name,YX)};var ZX=G({name:`CodeBlockNodeLoading`,inheritAttrs:!1,props:`node.isDark.loading.stream.theme.darkTheme.lightTheme.isShowPreview.monacoOptions.enableFontSizeControl.minWidth.maxWidth.themes.showHeader.showCopyButton.showExpandButton.showPreviewButton.showCollapseButton.showFontSizeButtons.showTooltips.htmlPreviewAllowScripts.htmlPreviewSandbox.customId.estimatedHeightPx.estimatedContentHeightPx.estimatedDiffInline`.split(`.`),emits:[`previewCode`,`copy`],setup(e,{attrs:t}){let n=e;return()=>{let e=Tq(String(n.node?.language??``)),r=Oq[e]||(e?e.charAt(0).toUpperCase()+e.slice(1):Oq[``]),i=IX(n.node),o=LX(String(n.node?.raw??``),r,i),s=n.monacoOptions,c=i&&(n.estimatedDiffInline??NX(s??{},typeof window>`u`?0:window.innerWidth)),l=s?.diffAppearance,u=l===`dark`||l!==`light`&&!0===n.isDark,d=typeof s?.fontSize==`number`&&Number.isFinite(s.fontSize)&&s.fontSize>0?s.fontSize:12,f=typeof s?.lineHeight==`number`&&Number.isFinite(s.lineHeight)&&s.lineHeight>0?s.lineHeight:d===12?18:Math.max(12,Math.round(1.5*d)),p=typeof s?.tabSize==`number`&&Number.isFinite(s.tabSize)&&s.tabSize>0?s.tabSize:4,m=i?0:8,h=typeof s?.padding?.top==`number`&&Number.isFinite(s.padding.top)&&s.padding.top>=0?s.padding.top:m,g=typeof s?.padding?.bottom==`number`&&Number.isFinite(s.padding.bottom)&&s.padding.bottom>=0?s.padding.bottom:m,_=typeof s?.fontFamily==`string`?s.fontFamily.trim():``,v=rY(rY({fontSize:`${d}px`,lineHeight:`${f}px`,tabSize:p,paddingTop:`${h}px`,paddingBottom:`${g}px`,"--markstream-pre-line-number-top":`${h}px`},i?{"--markstream-pre-diff-line-height":`${f}px`}:{}),_?{"--markstream-code-font-family":_}:{}),y=()=>a(`button`,{class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0`,"aria-hidden":`true`,disabled:!0,tabindex:-1,type:`button`},[a(`svg`,{class:`action-icon`})]),b=!1!==n.isShowPreview&&(e===`html`||e===`svg`),x=!1!==n.showFontSizeButtons&&!1!==n.enableFontSizeControl||!1!==n.showExpandButton||b&&!1!==n.showPreviewButton,S=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},C=rY(rY(rY({"--markstream-code-layout-character-width":`1ch`},S(n.minWidth)?{minWidth:S(n.minWidth)}:{}),S(n.maxWidth)?{maxWidth:S(n.maxWidth)}:{}),i?{}:{color:`var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))`,backgroundColor:`var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))`,borderColor:`var(--markstream-code-border-color, var(--code-border))`});return a(`div`,iY(rY({},t),{class:[`code-block-container`,`rounded-lg`,`border`,{dark:!0===n.isDark,"is-rendering":!1!==n.loading,"is-dark":u,"is-diff":i,"is-plain-text":e===``||e===`plaintext`||e===`text`},t.class],style:[C,t.style],"data-markstream-code-block":`1`,"data-markstream-enhanced":`false`,"data-markstream-code-block-state":n.loading?`streaming`:`settled`,"data-markstream-code-loading":`1`}),[!1===n.showHeader?null:a(`div`,{class:`code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]`},[a(`div`,{class:`code-header-main`},[a(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`}),a(`div`,{class:`code-header-copy`},[a(`div`,{class:`code-header-title`},o.title),o.caption?a(`div`,{class:`code-header-caption`},o.caption):null])]),a(`div`,{class:`flex items-center gap-0.5`,style:{visibility:`hidden`}},[i?a(`div`,{class:`code-diff-stats`,"aria-hidden":`true`},[a(`span`,{class:`code-diff-stat removed`},`-0`),a(`span`,{class:`code-diff-stat added`},`+0`)]):null,!1===n.showCopyButton?null:y(),!1===n.showCollapseButton?null:y(),x?a(`div`,{class:`relative`},[y()]):null])]),a(`div`,{class:`code-block-shell-content`,style:!1!==n.stream||!1===n.loading?void 0:{display:`none`}},[a(qX,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:i?void 0:n.estimatedContentHeightPx,diffInline:c,diffHideUnchangedRegions:i?MX(s?.diffHideUnchangedRegions):void 0,class:`code-pre-fallback`,style:v,"data-markstream-code-loading":`1`})]),a(`div`,{class:`code-loading-placeholder`,style:!1===n.stream&&!1!==n.loading?void 0:{display:`none`}},[a(`div`,{class:`loading-skeleton`},[a(`div`,{class:`skeleton-line`}),a(`div`,{class:`skeleton-line`}),a(`div`,{class:`skeleton-line short`})])]),a(`span`,{class:`sr-only`,"aria-live":`polite`,role:`status`})])}}}),QX=XX(`ViewportDeferredCodeBlockNode`,i({loader:()=>aY(null,null,function*(){try{return(yield he(()=>import(`./CodeBlockNode-_wK8GSRB.js`),__vite__mapDeps([31,7,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".`,e),qX}}),loadingComponent:ZX,delay:0,suspensible:!1}),ZX),$X=i(()=>aY(null,null,function*(){if(function(){return Reflect.get(globalThis,`process`)?.env}()?.NODE_ENV===`test`&&typeof window<`u`)return e=>a(YX,iY(rY({},e),{node:{type:`text`,content:e.node.raw??`$${e.node.content??``}$`,raw:e.node.raw??`$${e.node.content??``}$`}}));try{return yield Hq(),(yield he(()=>import(`./index7-DOLmlvs-.js`),__vite__mapDeps([32,1,2]))).default}catch(e){console.warn(`[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".`,e)}return e=>a(YX,iY(rY({},e),{node:{type:`text`,content:e.node.raw??`$${e.node.content??``}$`,raw:e.node.raw??`$${e.node.content??``}$`}}))})),eZ=i(()=>aY(null,null,function*(){try{return yield Hq(),(yield he(()=>import(`./index6-CGYWuLMy.js`),__vite__mapDeps([33,1,2]))).default}catch(e){console.warn(`[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".`,e)}return e=>a(YX,iY(rY({},e),{node:{type:`text`,content:e.node.raw??`$$${e.node.content??``}$$`,raw:e.node.raw??`$$${e.node.content??``}$$`}}))})),tZ=yY(G({__name:`ReferenceNode`,props:{node:{},messageId:{},threadId:{}},emits:[`click`,`mouseEnter`,`mouseLeave`],setup:e=>(t,n)=>(c(),W(`span`,{class:`reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5`,role:`button`,tabindex:`0`,onClick:n[0]||=n=>t.$emit(`click`,n,e.node.id,e.messageId,e.threadId),onMouseenter:n[1]||=n=>t.$emit(`mouseEnter`,n,e.node.id,e.messageId,e.threadId),onMouseleave:n[2]||=n=>t.$emit(`mouseLeave`,n,e.node.id,e.messageId,e.threadId)},U(e.node.id),33))}),[[`__scopeId`,`data-v-775c65e4`]]);tZ.install=e=>{e.component(tZ.__name,tZ)};var nZ={class:`superscript-node`},rZ=yY(G({__name:`SuperscriptNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,strong:sZ,emphasis:bZ,footnote_reference:TY,strikethrough:lZ,highlight:vZ,insert:gZ,subscript:aZ,emoji:SY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`sup`,nZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`superscript`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`superscript`}-${i}`,"fallback-to-text":``},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-24160b22`]]);rZ.install=e=>{e.component(rZ.__name,rZ)};var iZ={class:`subscript-node`},aZ=yY(G({__name:`SubscriptNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,strong:sZ,emphasis:bZ,footnote_reference:TY,strikethrough:lZ,highlight:vZ,insert:gZ,superscript:rZ,emoji:SY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`sub`,iZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`subscript`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`subscript`}-${i}`,"fallback-to-text":``},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-197fa13b`]]);aZ.install=e=>{e.component(aZ.__name,aZ)};var oZ={class:`strong-node`},sZ=yY(G({__name:`StrongNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,emphasis:bZ,strikethrough:lZ,highlight:vZ,insert:gZ,subscript:aZ,superscript:rZ,emoji:SY,footnote_reference:TY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`strong`,oZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`strong`}-${i}`,components:r.value,node:n,"index-key":`${e.indexKey||`strong`}-${i}`,"custom-id":t.customId},null,8,[`components`,`node`,`index-key`,`custom-id`]))),128))]))}}),[[`__scopeId`,`data-v-a8647104`]]);sZ.install=e=>{e.component(sZ.__name,sZ)};var cZ={class:`strikethrough-node`},lZ=yY(G({__name:`StrikethroughNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,strong:sZ,emphasis:bZ,highlight:vZ,insert:gZ,subscript:aZ,superscript:rZ,emoji:SY,footnote_reference:TY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`del`,cZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`strikethrough`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`strikethrough`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-b7a531fa`]]);lZ.install=e=>{e.component(lZ.__name,lZ)};var uZ=[`href`,`title`,`aria-label`,`aria-hidden`,`target`,`rel`],dZ=[`aria-hidden`],fZ={class:`link-text-wrapper relative inline-flex`},pZ={class:`leading-[normal] link-text`},mZ=yY(G({__name:`LinkNode`,props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){let t=e,n=m(`markstreamShowTooltips`,void 0),r=L(()=>{let e=n?.value;return typeof e==`boolean`?e:t.showTooltip}),i=L(()=>{let e=t.underlineBottom===void 0?`-3px`:typeof t.underlineBottom==`number`?`${t.underlineBottom}px`:String(t.underlineBottom),n=t.animationOpacity??.35,r=Math.max(.12,Math.min(.5*n,n)),i={"--underline-height":`${t.underlineHeight??2}px`,"--underline-bottom":e,"--underline-opacity":String(n),"--underline-rest-opacity":String(r),"--underline-duration":`${t.animationDuration??1.6}s`,"--underline-timing":t.animationTiming??`ease-in-out`,"--underline-iteration":typeof t.animationIteration==`number`?String(t.animationIteration):t.animationIteration??`infinite`};return t.color&&(i[`--link-color`]=t.color),i}),a=hY(()=>t.customId),o=L(()=>rY({text:YX,strong:sZ,strikethrough:lZ,emphasis:bZ,image:OX,html_inline:RY,inline_code:VY},a.value)),s=b(),l=L(()=>{let e=t.node?.attrs;if(!e||typeof e!=`object`)return{};let n={};if(Array.isArray(e))for(let t of e)Array.isArray(t)&&t[0]&&(n[String(t[0])]=String(t[1]??``));else for(let[t,r]of Object.entries(e))t&&r!=null&&!1!==r&&(n[t]=!0===r?``:String(r));return OY(n,`safe`,`a`)}),u=L(()=>rY(rY({},s),l.value)),d=L(()=>OY({href:String(t.node?.href??``)},`safe`,`a`).href),f=L(()=>{if(!d.value)return;let e=u.value.target;return(typeof e==`string`?e.trim():String(e??``).trim())||(iL(d.value)?`_blank`:void 0)}),p=L(()=>String(f.value??``).trim().toLowerCase()===`_blank`),h=L(()=>{if(!d.value)return;let e=u.value.rel,t=new Set((typeof e==`string`?e:String(e??``)).split(/\s+/).filter(Boolean)),n=new Set(Array.from(t).filter(e=>e.toLowerCase()!==`opener`));return p.value&&(n.add(`noopener`),n.add(`noreferrer`)),n.size>0?Array.from(n).join(` `):void 0}),g=L(()=>{let e=rY({},u.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function y(){r.value&&iX()}let x=L(()=>{let e=t.node?.title;return typeof e==`string`&&e.trim().length>0?e:String(d.value??``)});return(n,a)=>e.node.loading?(c(),W(`span`,re({key:1,class:`link-loading inline-flex items-baseline gap-1.5`,"aria-hidden":e.node.loading?`false`:`true`},z(s),{style:i.value}),[F(`span`,fZ,[F(`span`,pZ,[v(z(YX),{class:`leading-[normal] link-text`,node:{type:`text`,content:String(e.node.text??``),raw:String(e.node.text??``)},"index-key":`${e.indexKey||`link-text`}-loading`},null,8,[`node`,`index-key`])]),a[1]||=F(`span`,{class:`link-loading-indicator`,"aria-hidden":`true`},null,-1)])],16,dZ)):(c(),W(`a`,re({key:0,class:`link-node`,href:d.value,title:r.value?``:x.value,"aria-label":`Link: ${x.value}`,"aria-hidden":e.node.loading?`true`:`false`,target:f.value,rel:h.value},g.value,{style:i.value,onMouseenter:a[0]||=e=>function(e){if(!r.value)return;let n=e,i=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0,a=t.node?.title||(d.value?.includes(`xn--`)&&(t.node?.text)?.includes(`://`)?t.node.text:d.value)||``;rX(e.currentTarget,a,`top`,!1,i)}(e),onMouseleave:y}),[(c(!0),W(M,null,_(e.node.children,(n,r)=>(c(),P(z(AX),{key:`${e.indexKey||`emphasis`}-${r}`,components:o.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`link-text`}-${r}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))],16,uZ))}}),[[`__scopeId`,`data-v-367e6ca4`]]);mZ.install=e=>{e.component(mZ.__name,mZ)};var hZ={class:`insert-node`},gZ=yY(G({__name:`InsertNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,strong:sZ,emphasis:bZ,strikethrough:lZ,highlight:vZ,subscript:aZ,superscript:rZ,emoji:SY,footnote_reference:TY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`ins`,hZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`insert`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`insert`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-1e2c29d4`]]);gZ.install=e=>{e.component(gZ.__name,gZ)};var _Z={class:`highlight-node`},vZ=yY(G({__name:`HighlightNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,strong:sZ,emphasis:bZ,strikethrough:lZ,insert:gZ,subscript:aZ,superscript:rZ,emoji:SY,footnote_reference:TY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`mark`,_Z,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`highlight`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`highlight`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-7a62982a`]]);vZ.install=e=>{e.component(vZ.__name,vZ)};var yZ={class:`emphasis-node`},bZ=yY(G({__name:`EmphasisNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>rY({text:YX,inline_code:VY,link:mZ,html_inline:RY,strong:sZ,strikethrough:lZ,highlight:vZ,insert:gZ,subscript:aZ,superscript:rZ,emoji:SY,footnote_reference:TY,math_inline:$X,reference:tZ},n.value));return(n,i)=>(c(),W(`em`,yZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(AX),{key:`${e.indexKey||`emphasis`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`emphasis`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-2a5aafbf`]]);bZ.install=e=>{e.component(bZ.__name,bZ)};var xZ={class:`hard-break`},SZ=yY(G({__name:`HardBreakNode`,props:{node:{}},setup:e=>(e,t)=>(c(),W(`br`,xZ))}),[[`__scopeId`,`data-v-50c58f70`]]);SZ.install=e=>{e.component(SZ.__name,SZ)};var CZ=G({__name:`SimpleInlineRenderer`,props:{nodes:{},customId:{},indexKey:{}},setup(e){let t=e,n=g({checkbox:bY,checkbox_input:bY,emoji:SY,emphasis:bZ,hardbreak:SZ,highlight:vZ,inline_code:VY,insert:gZ,link:mZ,reference:tZ,strikethrough:lZ,strong:sZ,subscript:aZ,superscript:rZ,text:YX}),r=hY(()=>t.customId),i=L(()=>{let e=r.value;return Object.keys(e).length>0?rY(rY({},n),e):n});return(n,r)=>(c(!0),W(M,null,_(e.nodes,(n,r)=>(c(),P(z(AX),{key:r,components:i.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`inline`}-${r}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))}});function wZ(e){if(!e||typeof e!=`object`)return!1;let t=`|${e.type}|`;if(!`|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|`.includes(t))return!1;if(!`|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|`.includes(t))return!0;let n=e.children;return Array.isArray(n)&&n.every(wZ)}function TZ(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(wZ))return e;if(!t||e.length!==1)return null;let r=e[0];if(r?.type!==`paragraph`||!Array.isArray(r.children))return null;let i=r.children;return(n||i.length>0)&&i.every(wZ)?i:null}function EZ(e){if(!e?.length)return null;let t=``;for(let n of e){if(n?.type!==`text`||!0===n.center)return null;t+=String(n.content??n.raw??``)}return t}var DZ=[`cite`],OZ={key:0,dir:`auto`,class:`paragraph-node`},kZ=[`custom-id`],AZ=yY(G({__name:`BlockquoteNode`,props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:[`copy`],setup(e){let t=e,n=hY(()=>t.customId),r=L(()=>!!n.value.paragraph),i=L(()=>!!n.value.text),a=L(()=>TZ(t.node.children,!r.value)),o=L(()=>!1!==t.fade||i.value?null:EZ(a.value));return d(`markstreamShowTooltips`,L(()=>t.showTooltips)),d(`markstreamFade`,L(()=>t.fade)),(n,r)=>(c(),W(`blockquote`,{class:`blockquote blockquote-node`,dir:`auto`,cite:e.node.cite},[a.value?(c(),W(`p`,OZ,[o.value===null?(c(),P(z(CZ),{key:1,nodes:a.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(o.value),9,kZ))])):(c(),P(z(k0),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:r[0]||=e=>n.$emit(`copy`,e)},null,8,[`show-tooltips`,`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`]))],8,DZ))}}),[[`__scopeId`,`data-v-abfecebc`]]);AZ.install=e=>{e.component(AZ.__name,AZ)};var jZ={class:`definition-list`},MZ={class:`definition-term`},NZ={class:`definition-desc`},PZ=yY(G({__name:`DefinitionListNode`,props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:[`copy`],setup(e){let t=e;return(e,n)=>(c(),W(`dl`,jZ,[(c(!0),W(M,null,_(t.node.items,(r,i)=>(c(),W(M,{key:i},[F(`dt`,MZ,[v(z(k0),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:r.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:n[0]||=t=>e.$emit(`copy`,t)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])]),F(`dd`,NZ,[v(z(k0),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:r.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:n[1]||=t=>e.$emit(`copy`,t)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])])],64))),128))]))}}),[[`__scopeId`,`data-v-4e103b30`]]);PZ.install=e=>{e.component(PZ.__name,PZ)};var FZ=[`href`,`title`],IZ=yY(G({__name:`FootnoteAnchorNode`,props:{node:{}},setup(e){let t=e;function n(e){if(e.preventDefault(),typeof document>`u`)return;let n=`fnref-${String(t.node.id??``)}`,r=document.getElementById(n);r&&r.scrollIntoView({behavior:`smooth`,block:`center`})}return(t,r)=>(c(),W(`a`,{class:`footnote-anchor text-sm hover:underline cursor-pointer`,href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n},` ↩︎ `,8,FZ))}}),[[`__scopeId`,`data-v-e1eb37b6`]]);IZ.install=e=>{e.component(IZ.__name,IZ)};var LZ=[`id`],RZ={class:`flex-1`},zZ=G({__name:`FootnoteNode`,props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:[`copy`],setup(e){let t=e;return(n,r)=>(c(),W(`div`,{id:`fnref--${e.node.id}`,class:`footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2`},[F(`div`,RZ,[v(z(k0),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:r[0]||=e=>n.$emit(`copy`,e)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])])],8,LZ))}});zZ.install=e=>{e.component(zZ.__name,zZ)};var BZ=[`custom-id`],VZ=yY(G({__name:`HeadingNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=hY(()=>t.customId),r=m(`markstreamFade`,void 0),i=L(()=>!1!==r?.value||n.value.text?null:EZ(t.node.children)),a=L(()=>rY({text:YX,inline_code:VY,link:mZ,image:OX,strong:sZ,emphasis:bZ,strikethrough:lZ,highlight:vZ,insert:gZ,subscript:aZ,superscript:rZ,emoji:SY,checkbox:bY,checkbox_input:bY,footnote_reference:TY,hardbreak:SZ,math_inline:$X,reference:tZ},n.value));return(n,r)=>(c(),P(x(`h${e.node.level}`),re({class:[`heading-node`,[`heading-${e.node.level}`]],dir:`auto`},e.node.attrs),{default:B(()=>[i.value===null?(c(!0),W(M,{key:1},_(e.node.children,(n,r)=>(c(),P(z(AX),{key:r,components:a.value,"custom-id":t.customId,node:n,"index-key":`${e.indexKey||`heading`}-${r}`},null,8,[`components`,`custom-id`,`node`,`index-key`]))),128)):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(i.value),9,BZ))]),_:1},16,[`class`]))}}),[[`__scopeId`,`data-v-7122dbe1`]]),HZ=VZ;HZ.install=e=>{e.component(VZ.__name,VZ)};var UZ={key:0,dir:`auto`,class:`paragraph-node`},WZ=[`custom-id`],GZ={dir:`auto`,class:`paragraph-node`},KZ=[`custom-id`],qZ=yY(G({__name:`ListItemNode`,props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:[`copy`],setup(e){let t=e,n=L(()=>t.node??t.item),r=hY(()=>t.customId),i=L(()=>!!r.value.paragraph),a=L(()=>!!r.value.text),o=L(()=>TZ(n.value?.children,!i.value)),s=L(()=>{if(i.value)return null;let e=n.value?.children;if(!Array.isArray(e)||e.length<2)return null;let t=e[0];if(t?.type!==`paragraph`||!Array.isArray(t.children))return null;let r=e.slice(1);if(!r.every(e=>e?.type===`list`))return null;let a=TZ([t]);return a?{paragraphChildren:a,nestedLists:r}:null});function l(){return!1===t.fade&&!a.value}let u=L(()=>l()?EZ(o.value):null),f=L(()=>l()?EZ(s.value?.paragraphChildren):null),p=Object.freeze({}),m=L(()=>{let{value:e}=t;return typeof e==`number`&&Number.isFinite(e)?{value:e}:p});return d(`markstreamShowTooltips`,L(()=>t.showTooltips)),d(`markstreamFade`,L(()=>t.fade)),(e,r)=>(c(),W(`li`,re({class:`list-item`,dir:`auto`},m.value),[o.value?(c(),W(`p`,UZ,[u.value===null?(c(),P(z(CZ),{key:1,nodes:o.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(u.value),9,WZ))])):s.value?(c(),W(M,{key:1},[F(`p`,GZ,[f.value===null?(c(),P(z(CZ),{key:1,nodes:s.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(f.value),9,KZ))]),(c(!0),W(M,null,_(s.value.nestedLists,(n,i)=>(c(),P(z(k0),{key:i,nodes:[n],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${i}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:r[0]||=t=>e.$emit(`copy`,t)},null,8,[`nodes`,`custom-id`,`index-key`,`show-tooltips`,`typewriter`,`fade`,`is-dark`]))),128))],64)):(c(),P(z(k0),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:n.value?.children??[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:r[1]||=t=>e.$emit(`copy`,t)},null,8,[`show-tooltips`,`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`,`is-dark`]))],16))}}),[[`__scopeId`,`data-v-617214f9`]]);qZ.install=e=>{e.component(qZ.__name,qZ)};var JZ=yY(G({__name:`ListNode`,props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:[`copy`],setup(e){let t=hY(()=>e.customId),n=L(()=>t.value.list_item||qZ);return(t,r)=>(c(),P(x(e.node.ordered?`ol`:`ul`),{class:V([`list-node`,{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:B(()=>[(c(!0),W(M,null,_(e.node.items,(i,a)=>(c(),P(x(n.value),re({key:`${e.indexKey||`list`}-${a}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||`list`}-${a}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(e.node.start??1)+a:void 0,onCopy:r[0]||=e=>t.$emit(`copy`,e)}),null,16,[`node`,`custom-id`,`index-key`,`typewriter`,`fade`,`is-dark`,`value`]))),128))]),_:1},8,[`class`]))}}),[[`__scopeId`,`data-v-99cb95e0`]]);JZ.install=e=>{e.component(JZ.__name,JZ)};var YZ={key:2,class:`html-block-node__raw`},XZ=[`innerHTML`],ZZ={key:1,class:`html-block-node__placeholder`},QZ=yY(G({__name:`HtmlBlockNode`,props:{node:{},customId:{},htmlPolicy:{}},setup(e){let t=e,n=m(`markstreamHtmlPolicy`,void 0),r=m(`markstreamNestedRendererProps`,void 0),a=L(()=>t.htmlPolicy??n?.value??`safe`),l=L(()=>{let e=r?.value??{};return iY(rY({},e),{customId:t.customId??e.customId,htmlPolicy:a.value})}),u=i({loader:()=>Promise.resolve().then(()=>A0),suspensible:!1}),d=L(()=>{let e=sK(t.node.attrs,a.value);if(!e)return;let n=oK(e);return Object.keys(n).length>0?n:void 0}),f=L(()=>{let e=String(t.node.tag||``).trim(),n=sK(t.node.attrs,a.value,e);if(!n)return;let r=oK(n);return Object.keys(r).length>0?r:void 0}),p=hY(()=>t.customId),h=G({name:`DynamicRenderer`,props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),g=R(null),_=R(typeof window>`u`),v=R(t.node.content),y=L(()=>Array.isArray(t.node.children)?t.node.children:[]),b=L(()=>String(t.node.tag||`div`)),S=L(()=>{if(b.value.trim().toLowerCase()!==`details`||t.node.attrs?.some(([e])=>String(e).toLowerCase()===`open`))return null;let e=y.value[0];return e?.type===`html_block`&&String(e.tag||``).toLowerCase()===`summary`?e:null}),C=L(()=>EZ(S.value?.children)),w=L(()=>{let e=S.value;if(!e)return;let t=sK(e.attrs,a.value,`summary`);if(!t)return;let n=oK(t);return Object.keys(n).length>0?n:void 0}),T=L(()=>C.value==null?y.value:y.value.slice(1)),D=L(()=>{let e=b.value.trim().toLowerCase();return WI.has(e)||YG(e,a.value)}),O=L(()=>y.value.length>0&&!!t.node.tag&&!D.value),k=L(()=>{if(O.value)return{mode:`structured`};if(!_.value)return{mode:`html`,content:v.value??``};let e=v.value??t.node.content;if(!e)return{mode:`html`,content:``};if(a.value===`escape`)return{mode:`html`,content:hK(e,a.value)};if(t.node.loading){let n=IY(e,p.value,a.value);return n===null?{mode:`text`,content:t.node.raw??e}:{mode:`dynamic`,nodes:n}}if(!FY(e,p.value))return{mode:`html`,content:hK(e,a.value)};let n=IY(e,p.value,a.value);return n===null?{mode:`html`,content:hK(e,a.value)}:{mode:`dynamic`,nodes:n}}),A=yX(),N=gX(),ee=_X(),I=ue(null),te=!!t.node.loading;return typeof window<`u`?(s([()=>g.value,()=>N?.value.heavyBlockMargin,()=>N?.value.rootMargin],([e],n,r)=>{var i,a;if((a=(i=I.value)?.destroy)==null||a.call(i),I.value=null,!te)return _.value=!0,void(v.value=t.node.content);if(!e)return void(_.value=!1);let o=!0,s=A(e,{rootMargin:N?.value.heavyBlockMargin??N?.value.rootMargin??hX,allowIdle:!ee.value});I.value=s,_.value=_.value||s.isVisible.value,s.whenVisible.then(()=>{o&&I.value===s&&(_.value=!0)}),r(()=>{o=!1,s.destroy(),I.value===s&&(I.value=null)})},{immediate:!0}),s(()=>t.node.content,e=>{te&&!_.value||(v.value=e)})):_.value=!0,ne(()=>{var e,t;(t=(e=I.value)?.destroy)==null||t.call(e),I.value=null}),(t,n)=>(c(),P(x(O.value?b.value:`div`),re({ref_key:`htmlRef`,ref:g,class:`html-block-node`,"data-markstream-viewport-pending":z(ee)&&!_.value?`true`:void 0},O.value?f.value:void 0),{default:B(()=>[_.value?(c(),W(M,{key:0},[k.value.mode===`structured`?(c(),W(M,{key:0},[C.value===null?(c(),P(z(u),re({key:1},l.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`])):(c(),W(M,{key:0},[F(`summary`,j(o(w.value)),U(C.value),17),T.value.length?(c(),P(z(u),re({key:0},l.value,{nodes:T.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`])):E(``,!0)],64))],64)):k.value.mode===`dynamic`?(c(),P(z(h),{key:1,nodes:k.value.nodes},null,8,[`nodes`])):k.value.mode===`text`?(c(),W(`pre`,YZ,U(k.value.content),1)):(c(),W(`div`,re({key:3},d.value,{innerHTML:k.value.content}),null,16,XZ))],64)):(c(),W(`div`,ZZ,[me(t.$slots,`placeholder`,{node:e.node},()=>[n[0]||=F(`span`,{class:`html-block-node__placeholder-bar`},null,-1),n[1]||=F(`span`,{class:`html-block-node__placeholder-bar w-4/5`},null,-1),n[2]||=F(`span`,{class:`html-block-node__placeholder-bar w-2/3`},null,-1)],!0)]))]),_:3},16,[`data-markstream-viewport-pending`]))}}),[[`__scopeId`,`data-v-e140a874`]]);QZ.install=e=>{e.component(QZ.__name,QZ)};var $Z={dir:`auto`,class:`paragraph-node`},eQ=[`custom-id`],tQ=yY(G({__name:`ParagraphNode`,props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){let t=e,n=hY(()=>t.customId),r=m(`markstreamHtmlPolicy`,void 0),a=m(`markstreamFade`,void 0),o=m(`markstreamParseOptions`,void 0),s=m(`markstreamCustomMarkdownIt`,void 0),l=m(`markstreamNestedRendererProps`,void 0),u=L(()=>r?.value??`safe`),d=L(()=>t.parseOptions??o?.value),f=L(()=>t.customMarkdownIt??s?.value),p=L(()=>t.customHtmlTags??l?.value?.customHtmlTags),h=L(()=>{let e=l?.value??{};return iY(rY({},e),{customId:t.customId??e.customId,customHtmlTags:p.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:u.value})}),g=i({loader:()=>Promise.resolve().then(()=>A0),suspensible:!1});function v(e){return e.type===`text`&&String(e.content??``).trim()===``}let y=L(()=>t.node.children.filter(e=>!v(e))),b=L(()=>y.value.length>0&&y.value.every(e=>e.type===`image`||function(e){let t=function(e){return e.type===`link`&&Array.isArray(e.children)?e.children.filter(e=>!v(e)):[]}(e);return t.length===1&&t[0]?.type===`image`}(e))),S=L(()=>new Set(_L(p.value))),C=L(()=>{if(!b.value||y.value.length<=1)return t.node.children;let e=[];for(let n=0;n0,a=t.node.children.slice(n+1).some(e=>!v(e));i&&a&&e.push(iY(rY({},r),{content:` `,raw:` `}))}return e}),w=L(()=>!1===a?.value&&!n.value.text),T=L(()=>w.value?EZ(C.value):null);function D(e,n){return{node:e,"index-key":`${t.indexKey}-${n}`,"custom-id":t.customId,"custom-html-tags":p.value}}let O=L(()=>rY({inline_code:VY,image:OX,link:mZ,hardbreak:SZ,emphasis:bZ,strong:sZ,strikethrough:lZ,highlight:vZ,insert:gZ,subscript:aZ,superscript:rZ,html_inline:RY,html_block:QZ,emoji:SY,checkbox:bY,math_inline:$X,checkbox_input:bY,reference:tZ,footnote_anchor:IZ,footnote_reference:TY,text:YX},n.value)),k=L(()=>C.value.map((e,r)=>{let i=function(e){if(e.type===`html_block`||e.type===`html_inline`){let t=String(e.tag??``).trim().toLowerCase()||bL(e.content);if(t&&!S.value.has(t)&&SL(e.content??e.raw,t)){let t=String(e.content??e.raw??``);return{child:{type:`text`,content:t,raw:t},component:YX,isCustomComponent:!1}}}return{child:e,component:O.value[e.type],isCustomComponent:!!(n.value[e.type]&&!fY(String(e.type)))}}(e);return iY(rY({},i),{index:r,key:`${t.indexKey||`paragraph`}-${r}`,customAttrs:i.isCustomComponent?jY(i.child,u.value):void 0,hasSlotChildren:Array.isArray(i.child.children)&&i.child.children.length>0,slotContent:String(i.child.content??``),originalChild:e})}));return(e,n)=>(c(),W(`p`,$Z,[T.value===null?(c(!0),W(M,{key:1},_(k.value,e=>{return c(),W(M,{key:e.key},[b.value&&v(e.originalChild)?(c(),W(M,{key:0},[K(U((n=e.originalChild,String((r=n.content)??``))),1)],64)):e.isCustomComponent?(c(),P(x(e.component),re({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":t.customId,"custom-html-tags":p.value,"is-dark":h.value.isDark}),{default:B(()=>[e.hasSlotChildren?(c(),P(z(g),re({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(z(g),re({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`custom-html-tags`,`is-dark`])):(c(),P(x(e.component),re({key:2,ref_for:!0},D(e.child,e.index)),null,16))],64);var n,r}),128)):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(T.value),9,eQ))]))}}),[[`__scopeId`,`data-v-c59ff506`]]);tQ.install=e=>{e.component(tQ.__name,tQ)};var nQ={class:`table-node-wrapper`},rQ=[`aria-busy`],iQ={key:0},aQ=[`custom-id`],oQ=[`aria-label`,`onPointerdown`],sQ=[`custom-id`],cQ={key:0,class:`table-node__loading`,role:`status`,"aria-live":`polite`},lQ=yY(G({__name:`TableNode`,props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:[`copy`],setup(e){let t=e,n=L(()=>{var e;return(e=t.node.loading)!=null&&e}),r=L(()=>t.node.rows??[]),i=R(null),a=R([]),o=null,l=L(()=>t.node.header.cells.length),u=L(()=>a.value.some(e=>Number.isFinite(e)&&e>0)),f=L(()=>u.value?a.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);d(`markstreamShowTooltips`,L(()=>t.showTooltips)),d(`markstreamFade`,L(()=>t.fade));let p=hY(()=>t.customId),m=L(()=>!!p.value.text),h=L(()=>!!p.value.paragraph),g=new WeakMap;function y(e){let n=!1===t.fade&&!m.value,r=!h.value,i=g.get(e);if(i?.children===e.children&&i.textFastPath===n&&i.paragraphFastPath===r)return i.info;let a=TZ(e.children,r,!0),o={simpleChildren:a,plainText:a&&n?EZ(a):null};return g.set(e,{children:e.children,textFastPath:n,paragraphFastPath:r,info:o}),o}function b(e){if(!o)return;e.preventDefault();let t=o.startWidth+o.nextStartWidth,n=Math.min(48,Math.floor(t/2)),r=Math.max(n,Math.min(t-n,Math.round(o.startWidth+e.clientX-o.startX))),i=[...o.widths];i[o.index]=r,i[o.index+1]=t-r,a.value=i}function x(){o&&=(window.removeEventListener(`pointermove`,b),window.removeEventListener(`pointerup`,x),window.removeEventListener(`pointercancel`,x),null)}return s(l,()=>{x(),a.value=[]}),ne(x),(s,l)=>(c(),W(`div`,nQ,[F(`table`,{ref_key:`tableRef`,ref:i,class:V([`table-node`,{"table-node--loading":n.value}]),"aria-busy":n.value},[u.value?(c(),W(`colgroup`,iQ,[(c(!0),W(M,null,_(e.node.header.cells,(e,t)=>(c(),W(`col`,{key:t,style:ae(f.value[t])},null,4))),128))])):E(``,!0),F(`thead`,null,[F(`tr`,null,[(c(!0),W(M,null,_(e.node.header.cells,(n,r)=>(c(),W(`th`,{key:r,dir:`auto`,class:V([n.align===`right`?`text-right`:n.align===`center`?`text-center`:`text-left`])},[y(n).plainText===null?y(n).simpleChildren?(c(),P(z(CZ),{key:1,nodes:y(n).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${r}`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),P(z(k0),{key:2,nodes:n.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:l[0]||=e=>s.$emit(`copy`,e)},null,8,[`nodes`,`index-key`,`custom-id`,`typewriter`,`fade`,`show-tooltips`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(y(n).plainText),9,aQ)),rfunction(e,t){if(t.button!==0)return;let n=function(){let e=i.value?.querySelectorAll(`thead th`);return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))}(),r=n[e],s=n[e+1];r&&s&&(t.preventDefault(),o={index:e,startX:t.clientX,startWidth:r,nextStartWidth:s,widths:n},a.value=n,window.addEventListener(`pointermove`,b),window.addEventListener(`pointerup`,x),window.addEventListener(`pointercancel`,x))}(r,e)},null,40,oQ)):E(``,!0)],2))),128))])]),F(`tbody`,null,[(c(!0),W(M,null,_(r.value,(e,n)=>(c(),W(`tr`,{key:n},[(c(!0),W(M,null,_(e.cells,(e,r)=>(c(),W(`td`,{key:r,class:V([e.align===`right`?`text-right`:e.align===`center`?`text-center`:`text-left`]),dir:`auto`},[y(e).plainText===null?y(e).simpleChildren?(c(),P(z(CZ),{key:1,nodes:y(e).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${n}-${r}`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),P(z(k0),{key:2,nodes:e.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:l[1]||=e=>s.$emit(`copy`,e)},null,8,[`nodes`,`index-key`,`custom-id`,`typewriter`,`fade`,`show-tooltips`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(y(e).plainText),9,sQ))],2))),128))]))),128))])],10,rQ),v(oe,{name:`table-node-fade`},{default:B(()=>[n.value?(c(),W(`div`,cQ,[me(s.$slots,`loading`,{isLoading:n.value},()=>[l[2]||=F(`span`,{class:`table-node__spinner animate-spin`,"aria-hidden":`true`},null,-1),l[3]||=F(`span`,{class:`sr-only`},`Loading`,-1)],!0)])):E(``,!0)]),_:3})]))}}),[[`__scopeId`,`data-v-39f87b5d`]]);lQ.install=e=>{e.component(lQ.__name,lQ)};var uQ={class:`hr-node`},dQ=yY({},[[`render`,function(e,t){return c(),W(`hr`,uQ)}],[`__scopeId`,`data-v-39b2349c`]]);dQ.install=e=>{e.component(dQ.__name,dQ)};var fQ={class:`unknown-node`},pQ=G({__name:`FallbackComponent`,props:{node:{}},setup:e=>(t,n)=>(c(),W(`div`,fQ,U(e.node.raw),1))}),mQ=yY(G({__name:`VmrContainerNode`,props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){let t=e,n=L(()=>`vmr-container vmr-container-${t.node.name}`),r=hY(()=>t.customId),i=L(()=>rY({text:YX,paragraph:tQ,heading:HZ,inline_code:VY,link:mZ,image:OX,strong:sZ,emphasis:bZ,strikethrough:lZ,insert:gZ,subscript:aZ,superscript:rZ,checkbox:bY,checkbox_input:bY,hardbreak:SZ,math_inline:$X,reference:tZ,list:JZ,math_block:eZ,table:lQ},r.value));return(r,a)=>(c(),W(`div`,re({class:n.value},e.node.attrs),[(c(!0),W(M,null,_(e.node.children,(n,r)=>{return c(),P(x((a=n.type,i.value[a]||pQ)),{key:`${e.indexKey||`vmr-container`}-${r}`,"custom-id":t.customId,node:n,"index-key":`${e.indexKey||`vmr-container`}-${r}`,typewriter:t.typewriter,fade:t.fade},null,8,[`custom-id`,`node`,`index-key`,`typewriter`,`fade`]);var a}),128))],16))}}),[[`__scopeId`,`data-v-911e41c4`]]);mQ.install=e=>{e.component(mQ.__name,mQ)};var hQ=`BN.BN.BN.BN.BN.BN.BN.BN.BN.S.B.S.WS.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.B.B.B.S.WS.ON.ON.ET.ET.ET.ON.ON.ON.ON.ON.ES.CS.ES.CS.CS.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.CS.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.BN.BN.BN.BN.BN.BN.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.CS.ON.ET.ET.ET.ET.ON.ON.ON.ON.L.ON.ON.BN.ON.ON.ET.ET.EN.EN.ON.L.ON.ON.ON.EN.L.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L`.split(`.`),gQ=[[697,698,`ON`],[706,719,`ON`],[722,735,`ON`],[741,749,`ON`],[751,767,`ON`],[768,879,`NSM`],[884,885,`ON`],[894,894,`ON`],[900,901,`ON`],[903,903,`ON`],[1014,1014,`ON`],[1155,1161,`NSM`],[1418,1418,`ON`],[1421,1422,`ON`],[1423,1423,`ET`],[1424,1424,`R`],[1425,1469,`NSM`],[1470,1470,`R`],[1471,1471,`NSM`],[1472,1472,`R`],[1473,1474,`NSM`],[1475,1475,`R`],[1476,1477,`NSM`],[1478,1478,`R`],[1479,1479,`NSM`],[1480,1535,`R`],[1536,1541,`AN`],[1542,1543,`ON`],[1544,1544,`AL`],[1545,1546,`ET`],[1547,1547,`AL`],[1548,1548,`CS`],[1549,1549,`AL`],[1550,1551,`ON`],[1552,1562,`NSM`],[1563,1610,`AL`],[1611,1631,`NSM`],[1632,1641,`AN`],[1642,1642,`ET`],[1643,1644,`AN`],[1645,1647,`AL`],[1648,1648,`NSM`],[1649,1749,`AL`],[1750,1756,`NSM`],[1757,1757,`AN`],[1758,1758,`ON`],[1759,1764,`NSM`],[1765,1766,`AL`],[1767,1768,`NSM`],[1769,1769,`ON`],[1770,1773,`NSM`],[1774,1775,`AL`],[1776,1785,`EN`],[1786,1808,`AL`],[1809,1809,`NSM`],[1810,1839,`AL`],[1840,1866,`NSM`],[1867,1957,`AL`],[1958,1968,`NSM`],[1969,1983,`AL`],[1984,2026,`R`],[2027,2035,`NSM`],[2036,2037,`R`],[2038,2041,`ON`],[2042,2044,`R`],[2045,2045,`NSM`],[2046,2069,`R`],[2070,2073,`NSM`],[2074,2074,`R`],[2075,2083,`NSM`],[2084,2084,`R`],[2085,2087,`NSM`],[2088,2088,`R`],[2089,2093,`NSM`],[2094,2136,`R`],[2137,2139,`NSM`],[2140,2143,`R`],[2144,2191,`AL`],[2192,2193,`AN`],[2194,2198,`AL`],[2199,2207,`NSM`],[2208,2249,`AL`],[2250,2273,`NSM`],[2274,2274,`AN`],[2275,2306,`NSM`],[2362,2362,`NSM`],[2364,2364,`NSM`],[2369,2376,`NSM`],[2381,2381,`NSM`],[2385,2391,`NSM`],[2402,2403,`NSM`],[2433,2433,`NSM`],[2492,2492,`NSM`],[2497,2500,`NSM`],[2509,2509,`NSM`],[2530,2531,`NSM`],[2546,2547,`ET`],[2555,2555,`ET`],[2558,2558,`NSM`],[2561,2562,`NSM`],[2620,2620,`NSM`],[2625,2626,`NSM`],[2631,2632,`NSM`],[2635,2637,`NSM`],[2641,2641,`NSM`],[2672,2673,`NSM`],[2677,2677,`NSM`],[2689,2690,`NSM`],[2748,2748,`NSM`],[2753,2757,`NSM`],[2759,2760,`NSM`],[2765,2765,`NSM`],[2786,2787,`NSM`],[2801,2801,`ET`],[2810,2815,`NSM`],[2817,2817,`NSM`],[2876,2876,`NSM`],[2879,2879,`NSM`],[2881,2884,`NSM`],[2893,2893,`NSM`],[2901,2902,`NSM`],[2914,2915,`NSM`],[2946,2946,`NSM`],[3008,3008,`NSM`],[3021,3021,`NSM`],[3059,3064,`ON`],[3065,3065,`ET`],[3066,3066,`ON`],[3072,3072,`NSM`],[3076,3076,`NSM`],[3132,3132,`NSM`],[3134,3136,`NSM`],[3142,3144,`NSM`],[3146,3149,`NSM`],[3157,3158,`NSM`],[3170,3171,`NSM`],[3192,3198,`ON`],[3201,3201,`NSM`],[3260,3260,`NSM`],[3276,3277,`NSM`],[3298,3299,`NSM`],[3328,3329,`NSM`],[3387,3388,`NSM`],[3393,3396,`NSM`],[3405,3405,`NSM`],[3426,3427,`NSM`],[3457,3457,`NSM`],[3530,3530,`NSM`],[3538,3540,`NSM`],[3542,3542,`NSM`],[3633,3633,`NSM`],[3636,3642,`NSM`],[3647,3647,`ET`],[3655,3662,`NSM`],[3761,3761,`NSM`],[3764,3772,`NSM`],[3784,3790,`NSM`],[3864,3865,`NSM`],[3893,3893,`NSM`],[3895,3895,`NSM`],[3897,3897,`NSM`],[3898,3901,`ON`],[3953,3966,`NSM`],[3968,3972,`NSM`],[3974,3975,`NSM`],[3981,3991,`NSM`],[3993,4028,`NSM`],[4038,4038,`NSM`],[4141,4144,`NSM`],[4146,4151,`NSM`],[4153,4154,`NSM`],[4157,4158,`NSM`],[4184,4185,`NSM`],[4190,4192,`NSM`],[4209,4212,`NSM`],[4226,4226,`NSM`],[4229,4230,`NSM`],[4237,4237,`NSM`],[4253,4253,`NSM`],[4957,4959,`NSM`],[5008,5017,`ON`],[5120,5120,`ON`],[5760,5760,`WS`],[5787,5788,`ON`],[5906,5908,`NSM`],[5938,5939,`NSM`],[5970,5971,`NSM`],[6002,6003,`NSM`],[6068,6069,`NSM`],[6071,6077,`NSM`],[6086,6086,`NSM`],[6089,6099,`NSM`],[6107,6107,`ET`],[6109,6109,`NSM`],[6128,6137,`ON`],[6144,6154,`ON`],[6155,6157,`NSM`],[6158,6158,`BN`],[6159,6159,`NSM`],[6277,6278,`NSM`],[6313,6313,`NSM`],[6432,6434,`NSM`],[6439,6440,`NSM`],[6450,6450,`NSM`],[6457,6459,`NSM`],[6464,6464,`ON`],[6468,6469,`ON`],[6622,6655,`ON`],[6679,6680,`NSM`],[6683,6683,`NSM`],[6742,6742,`NSM`],[6744,6750,`NSM`],[6752,6752,`NSM`],[6754,6754,`NSM`],[6757,6764,`NSM`],[6771,6780,`NSM`],[6783,6783,`NSM`],[6832,6877,`NSM`],[6880,6891,`NSM`],[6912,6915,`NSM`],[6964,6964,`NSM`],[6966,6970,`NSM`],[6972,6972,`NSM`],[6978,6978,`NSM`],[7019,7027,`NSM`],[7040,7041,`NSM`],[7074,7077,`NSM`],[7080,7081,`NSM`],[7083,7085,`NSM`],[7142,7142,`NSM`],[7144,7145,`NSM`],[7149,7149,`NSM`],[7151,7153,`NSM`],[7212,7219,`NSM`],[7222,7223,`NSM`],[7376,7378,`NSM`],[7380,7392,`NSM`],[7394,7400,`NSM`],[7405,7405,`NSM`],[7412,7412,`NSM`],[7416,7417,`NSM`],[7616,7679,`NSM`],[8125,8125,`ON`],[8127,8129,`ON`],[8141,8143,`ON`],[8157,8159,`ON`],[8173,8175,`ON`],[8189,8190,`ON`],[8192,8202,`WS`],[8203,8205,`BN`],[8207,8207,`R`],[8208,8231,`ON`],[8232,8232,`WS`],[8233,8233,`B`],[8234,8238,`BN`],[8239,8239,`CS`],[8240,8244,`ET`],[8245,8259,`ON`],[8260,8260,`CS`],[8261,8286,`ON`],[8287,8287,`WS`],[8288,8303,`BN`],[8304,8304,`EN`],[8308,8313,`EN`],[8314,8315,`ES`],[8316,8318,`ON`],[8320,8329,`EN`],[8330,8331,`ES`],[8332,8334,`ON`],[8352,8399,`ET`],[8400,8432,`NSM`],[8448,8449,`ON`],[8451,8454,`ON`],[8456,8457,`ON`],[8468,8468,`ON`],[8470,8472,`ON`],[8478,8483,`ON`],[8485,8485,`ON`],[8487,8487,`ON`],[8489,8489,`ON`],[8494,8494,`ET`],[8506,8507,`ON`],[8512,8516,`ON`],[8522,8525,`ON`],[8528,8543,`ON`],[8585,8587,`ON`],[8592,8721,`ON`],[8722,8722,`ES`],[8723,8723,`ET`],[8724,9013,`ON`],[9083,9108,`ON`],[9110,9257,`ON`],[9280,9290,`ON`],[9312,9351,`ON`],[9352,9371,`EN`],[9450,9899,`ON`],[9901,10239,`ON`],[10496,11123,`ON`],[11126,11263,`ON`],[11493,11498,`ON`],[11503,11505,`NSM`],[11513,11519,`ON`],[11647,11647,`NSM`],[11744,11775,`NSM`],[11776,11869,`ON`],[11904,11929,`ON`],[11931,12019,`ON`],[12032,12245,`ON`],[12272,12287,`ON`],[12288,12288,`WS`],[12289,12292,`ON`],[12296,12320,`ON`],[12330,12333,`NSM`],[12336,12336,`ON`],[12342,12343,`ON`],[12349,12351,`ON`],[12441,12442,`NSM`],[12443,12444,`ON`],[12448,12448,`ON`],[12539,12539,`ON`],[12736,12773,`ON`],[12783,12783,`ON`],[12829,12830,`ON`],[12880,12895,`ON`],[12924,12926,`ON`],[12977,12991,`ON`],[13004,13007,`ON`],[13175,13178,`ON`],[13278,13279,`ON`],[13311,13311,`ON`],[19904,19967,`ON`],[42128,42182,`ON`],[42509,42511,`ON`],[42607,42610,`NSM`],[42611,42611,`ON`],[42612,42621,`NSM`],[42622,42623,`ON`],[42654,42655,`NSM`],[42736,42737,`NSM`],[42752,42785,`ON`],[42888,42888,`ON`],[43010,43010,`NSM`],[43014,43014,`NSM`],[43019,43019,`NSM`],[43045,43046,`NSM`],[43048,43051,`ON`],[43052,43052,`NSM`],[43064,43065,`ET`],[43124,43127,`ON`],[43204,43205,`NSM`],[43232,43249,`NSM`],[43263,43263,`NSM`],[43302,43309,`NSM`],[43335,43345,`NSM`],[43392,43394,`NSM`],[43443,43443,`NSM`],[43446,43449,`NSM`],[43452,43453,`NSM`],[43493,43493,`NSM`],[43561,43566,`NSM`],[43569,43570,`NSM`],[43573,43574,`NSM`],[43587,43587,`NSM`],[43596,43596,`NSM`],[43644,43644,`NSM`],[43696,43696,`NSM`],[43698,43700,`NSM`],[43703,43704,`NSM`],[43710,43711,`NSM`],[43713,43713,`NSM`],[43756,43757,`NSM`],[43766,43766,`NSM`],[43882,43883,`ON`],[44005,44005,`NSM`],[44008,44008,`NSM`],[44013,44013,`NSM`],[64285,64285,`R`],[64286,64286,`NSM`],[64287,64296,`R`],[64297,64297,`ES`],[64298,64335,`R`],[64336,64450,`AL`],[64451,64466,`ON`],[64467,64829,`AL`],[64830,64847,`ON`],[64848,64911,`AL`],[64912,64913,`ON`],[64914,64967,`AL`],[64968,64975,`ON`],[64976,65007,`BN`],[65008,65020,`AL`],[65021,65023,`ON`],[65024,65039,`NSM`],[65040,65049,`ON`],[65056,65071,`NSM`],[65072,65103,`ON`],[65104,65104,`CS`],[65105,65105,`ON`],[65106,65106,`CS`],[65108,65108,`ON`],[65109,65109,`CS`],[65110,65118,`ON`],[65119,65119,`ET`],[65120,65121,`ON`],[65122,65123,`ES`],[65124,65126,`ON`],[65128,65128,`ON`],[65129,65130,`ET`],[65131,65131,`ON`],[65136,65278,`AL`],[65279,65279,`BN`],[65281,65282,`ON`],[65283,65285,`ET`],[65286,65290,`ON`],[65291,65291,`ES`],[65292,65292,`CS`],[65293,65293,`ES`],[65294,65295,`CS`],[65296,65305,`EN`],[65306,65306,`CS`],[65307,65312,`ON`],[65339,65344,`ON`],[65371,65381,`ON`],[65504,65505,`ET`],[65506,65508,`ON`],[65509,65510,`ET`],[65512,65518,`ON`],[65520,65528,`BN`],[65529,65533,`ON`],[65534,65535,`BN`],[65793,65793,`ON`],[65856,65932,`ON`],[65936,65948,`ON`],[65952,65952,`ON`],[66045,66045,`NSM`],[66272,66272,`NSM`],[66273,66299,`EN`],[66422,66426,`NSM`],[67584,67870,`R`],[67871,67871,`ON`],[67872,68096,`R`],[68097,68099,`NSM`],[68100,68100,`R`],[68101,68102,`NSM`],[68103,68107,`R`],[68108,68111,`NSM`],[68112,68151,`R`],[68152,68154,`NSM`],[68155,68158,`R`],[68159,68159,`NSM`],[68160,68324,`R`],[68325,68326,`NSM`],[68327,68408,`R`],[68409,68415,`ON`],[68416,68863,`R`],[68864,68899,`AL`],[68900,68903,`NSM`],[68904,68911,`AL`],[68912,68921,`AN`],[68922,68927,`AL`],[68928,68937,`AN`],[68938,68968,`R`],[68969,68973,`NSM`],[68974,68974,`ON`],[68975,69215,`R`],[69216,69246,`AN`],[69247,69290,`R`],[69291,69292,`NSM`],[69293,69311,`R`],[69312,69327,`AL`],[69328,69336,`ON`],[69337,69369,`AL`],[69370,69375,`NSM`],[69376,69423,`R`],[69424,69445,`AL`],[69446,69456,`NSM`],[69457,69487,`AL`],[69488,69505,`R`],[69506,69509,`NSM`],[69510,69631,`R`],[69633,69633,`NSM`],[69688,69702,`NSM`],[69714,69733,`ON`],[69744,69744,`NSM`],[69747,69748,`NSM`],[69759,69761,`NSM`],[69811,69814,`NSM`],[69817,69818,`NSM`],[69826,69826,`NSM`],[69888,69890,`NSM`],[69927,69931,`NSM`],[69933,69940,`NSM`],[70003,70003,`NSM`],[70016,70017,`NSM`],[70070,70078,`NSM`],[70089,70092,`NSM`],[70095,70095,`NSM`],[70191,70193,`NSM`],[70196,70196,`NSM`],[70198,70199,`NSM`],[70206,70206,`NSM`],[70209,70209,`NSM`],[70367,70367,`NSM`],[70371,70378,`NSM`],[70400,70401,`NSM`],[70459,70460,`NSM`],[70464,70464,`NSM`],[70502,70508,`NSM`],[70512,70516,`NSM`],[70587,70592,`NSM`],[70606,70606,`NSM`],[70608,70608,`NSM`],[70610,70610,`NSM`],[70625,70626,`NSM`],[70712,70719,`NSM`],[70722,70724,`NSM`],[70726,70726,`NSM`],[70750,70750,`NSM`],[70835,70840,`NSM`],[70842,70842,`NSM`],[70847,70848,`NSM`],[70850,70851,`NSM`],[71090,71093,`NSM`],[71100,71101,`NSM`],[71103,71104,`NSM`],[71132,71133,`NSM`],[71219,71226,`NSM`],[71229,71229,`NSM`],[71231,71232,`NSM`],[71264,71276,`ON`],[71339,71339,`NSM`],[71341,71341,`NSM`],[71344,71349,`NSM`],[71351,71351,`NSM`],[71453,71453,`NSM`],[71455,71455,`NSM`],[71458,71461,`NSM`],[71463,71467,`NSM`],[71727,71735,`NSM`],[71737,71738,`NSM`],[71995,71996,`NSM`],[71998,71998,`NSM`],[72003,72003,`NSM`],[72148,72151,`NSM`],[72154,72155,`NSM`],[72160,72160,`NSM`],[72193,72198,`NSM`],[72201,72202,`NSM`],[72243,72248,`NSM`],[72251,72254,`NSM`],[72263,72263,`NSM`],[72273,72278,`NSM`],[72281,72283,`NSM`],[72330,72342,`NSM`],[72344,72345,`NSM`],[72544,72544,`NSM`],[72546,72548,`NSM`],[72550,72550,`NSM`],[72752,72758,`NSM`],[72760,72765,`NSM`],[72850,72871,`NSM`],[72874,72880,`NSM`],[72882,72883,`NSM`],[72885,72886,`NSM`],[73009,73014,`NSM`],[73018,73018,`NSM`],[73020,73021,`NSM`],[73023,73029,`NSM`],[73031,73031,`NSM`],[73104,73105,`NSM`],[73109,73109,`NSM`],[73111,73111,`NSM`],[73459,73460,`NSM`],[73472,73473,`NSM`],[73526,73530,`NSM`],[73536,73536,`NSM`],[73538,73538,`NSM`],[73562,73562,`NSM`],[73685,73692,`ON`],[73693,73696,`ET`],[73697,73713,`ON`],[78912,78912,`NSM`],[78919,78933,`NSM`],[90398,90409,`NSM`],[90413,90415,`NSM`],[92912,92916,`NSM`],[92976,92982,`NSM`],[94031,94031,`NSM`],[94095,94098,`NSM`],[94178,94178,`ON`],[94180,94180,`NSM`],[113821,113822,`NSM`],[113824,113827,`BN`],[117760,117973,`ON`],[118e3,118009,`EN`],[118010,118012,`ON`],[118016,118451,`ON`],[118458,118480,`ON`],[118496,118512,`ON`],[118528,118573,`NSM`],[118576,118598,`NSM`],[119143,119145,`NSM`],[119155,119162,`BN`],[119163,119170,`NSM`],[119173,119179,`NSM`],[119210,119213,`NSM`],[119273,119274,`ON`],[119296,119361,`ON`],[119362,119364,`NSM`],[119365,119365,`ON`],[119552,119638,`ON`],[120513,120513,`ON`],[120539,120539,`ON`],[120571,120571,`ON`],[120597,120597,`ON`],[120629,120629,`ON`],[120655,120655,`ON`],[120687,120687,`ON`],[120713,120713,`ON`],[120745,120745,`ON`],[120771,120771,`ON`],[120782,120831,`EN`],[121344,121398,`NSM`],[121403,121452,`NSM`],[121461,121461,`NSM`],[121476,121476,`NSM`],[121499,121503,`NSM`],[121505,121519,`NSM`],[122880,122886,`NSM`],[122888,122904,`NSM`],[122907,122913,`NSM`],[122915,122916,`NSM`],[122918,122922,`NSM`],[123023,123023,`NSM`],[123184,123190,`NSM`],[123566,123566,`NSM`],[123628,123631,`NSM`],[123647,123647,`ET`],[124140,124143,`NSM`],[124398,124399,`NSM`],[124643,124643,`NSM`],[124646,124646,`NSM`],[124654,124655,`NSM`],[124661,124661,`NSM`],[124928,125135,`R`],[125136,125142,`NSM`],[125143,125251,`R`],[125252,125258,`NSM`],[125259,126063,`R`],[126064,126143,`AL`],[126144,126207,`R`],[126208,126287,`AL`],[126288,126463,`R`],[126464,126703,`AL`],[126704,126705,`ON`],[126706,126719,`AL`],[126720,126975,`R`],[126976,127019,`ON`],[127024,127123,`ON`],[127136,127150,`ON`],[127153,127167,`ON`],[127169,127183,`ON`],[127185,127221,`ON`],[127232,127242,`EN`],[127243,127247,`ON`],[127279,127279,`ON`],[127338,127343,`ON`],[127405,127405,`ON`],[127584,127589,`ON`],[127744,128728,`ON`],[128732,128748,`ON`],[128752,128764,`ON`],[128768,128985,`ON`],[128992,129003,`ON`],[129008,129008,`ON`],[129024,129035,`ON`],[129040,129095,`ON`],[129104,129113,`ON`],[129120,129159,`ON`],[129168,129197,`ON`],[129200,129211,`ON`],[129216,129217,`ON`],[129232,129240,`ON`],[129280,129623,`ON`],[129632,129645,`ON`],[129648,129660,`ON`],[129664,129674,`ON`],[129678,129734,`ON`],[129736,129736,`ON`],[129741,129756,`ON`],[129759,129770,`ON`],[129775,129784,`ON`],[129792,129938,`ON`],[129940,130031,`ON`],[130032,130041,`EN`],[130042,130042,`ON`],[131070,131071,`BN`],[196606,196607,`BN`],[262142,262143,`BN`],[327678,327679,`BN`],[393214,393215,`BN`],[458750,458751,`BN`],[524286,524287,`BN`],[589822,589823,`BN`],[655358,655359,`BN`],[720894,720895,`BN`],[786430,786431,`BN`],[851966,851967,`BN`],[917502,917759,`BN`],[917760,917999,`NSM`],[918e3,921599,`BN`],[983038,983039,`BN`],[1048574,1048575,`BN`],[1114110,1114111,`BN`]];function _Q(e){if(e<=255)return hQ[e];let t=0,n=gQ.length-1;for(;t<=n;){let r=t+n>>1,i=gQ[r];if(ei[1]))return i[2];t=r+1}}return`L`}var vQ=/[ \t\n\r\f]+/g,yQ=/[\t\n\r\f]| {2,}|^ | $/,bQ=null,xQ=RegExp(`\\p{Script=Arabic}`,`u`),SQ=RegExp(`\\p{M}`,`u`),CQ=RegExp(`\\p{Nd}`,`u`);function wQ(e){return xQ.test(e)}function TQ(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function EQ(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){if(TQ(r-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(TQ(n))return!0}}return!1}var DQ=new Set([`\xA0`,` `,`⁠`,``]),OQ=new Set([`-`,`‐`,`–`,`—`]);function kQ(e,t){return!(function(e){let t=HQ(e);return t!==null&&DQ.has(t)}(e)||t&&(function(e){let t=HQ(e);return t!==null&&(AQ.has(t)||NQ.has(t))}(e)||function(e){let t=HQ(e);return t!==null&&OQ.has(t)}(e)))}var AQ=new Set(`,...!.:.;.?.、.。.・.).〕.〉.》.」.』.】.〗.〙.〛.ー.々.〻.ゝ.ゞ.ヽ.ヾ`.split(`.`)),jQ=new Set([`"`,`(`,`[`,`{`,`¡`,`¿`,`“`,`‘`,`‚`,`„`,`«`,`‹`,`⸘`,`(`,`〔`,`〈`,`《`,`「`,`『`,`【`,`〖`,`〘`,`〚`]),MQ=new Set([`'`,`’`]),NQ=new Set(`.(,(!(?(:(;(،(؛(؟(।(॥(၊(။(၌(၍(၏()(](}(%("(”(’(»(›(…`.split(`(`)),PQ=new Set([`:`,`.`,`،`,`؛`]),FQ=new Set([`၏`]),IQ=new Set([`”`,`’`,`»`,`›`,`」`,`』`,`】`,`》`,`〉`,`〕`,`)`]);function LQ(e){if(BQ(e))return!0;let t=!1;for(let n of e)if(NQ.has(n)||WQ(n))t=!0;else if(!t||!SQ.test(n))return!1;return t}function RQ(e){for(let t of e)if(!AQ.has(t)&&!NQ.has(t))return!1;return e.length>0}function zQ(e){if(BQ(e))return!0;for(let t of e)if(!(jQ.has(t)||MQ.has(t)||SQ.test(t)||WQ(t)))return!1;return e.length>0}function BQ(e){let t=!1;for(let n of e)if(n!==`\\`&&!SQ.test(n)){if(!(jQ.has(n)||NQ.has(n)||MQ.has(n)))return!1;t=!0}return t}function VQ(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let a=e.charCodeAt(i);return a>=55296&&a<=56319?i:n}function HQ(e){if(e.length===0)return null;let t=VQ(e,e.length);return e.slice(t)}var UQ=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function WQ(e){let t=e.codePointAt(0);return t!==void 0&&function(e,t){for(let n=0;n=t[n]&&e<=t[n+1])return!0;return!1}(t,UQ)}function GQ(e){let t=function(e){for(let t of e)if(!SQ.test(t))return t;return null}(e);return t!==null&&CQ.test(t)}function KQ(e){let t=Array.from(e),n=t.length;for(;n>0;){let e=t[n-1];if(SQ.test(e))n--;else{if(!jQ.has(e)&&!MQ.has(e))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(``),tail:t.slice(n).join(``)}}function qQ(e,t,n){return n!==`text`||t||e.length!==1||e===`-`||e===`—`?null:e}function JQ(e,t,n,r){let i=t[r],a=e[r];if(i==null)return a;let o=n[r];if(a.length===o)return a;let s=i.repeat(o);return e[r]=s,s}function YQ(e,t){return e&&t!==null&&PQ.has(t)}function XQ(e){let t=HQ(e);return t!==null&&FQ.has(t)}function ZQ(e){if(e.length<2||e[0]!==` `)return null;let t=e.slice(1);return RegExp(`^\\p{M}+$`,`u`).test(t)?{space:` `,marks:t}:null}function QQ(e){let t=e.length;for(;t>0;){let n=VQ(e,t),r=e.slice(n,t);if(IQ.has(r))return!0;if(!NQ.has(r))return!1;t=n}return!1}function $Q(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===` `)return`preserved-space`;if(e===` `)return`tab`;if(t.preserveHardBreaks&&e===` -`)return`hard-break`}return e===` `?`space`:e===`\xA0`||e===` `||e===`⁠`||e===``?`glue`:e===`​`?`zero-width-break`:e===`­`?`soft-hyphen`:`text`}var e$=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function t$(e){return e.length===1?e[0]:e.join(``)}function n$(e,t){let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);return n.push(t),t$(n)}function r$(e,t,n,r){if(!e$.test(e))return[{text:e,isWordLike:t,kind:`text`,start:n}];let i=[],a=null,o=[],s=n,c=!1,l=0;for(let u of e){let e=$Q(u,r),d=e===`text`&&t;a===null||e!==a||d!==c?(a!==null&&i.push({text:t$(o),isWordLike:c,kind:a,start:s}),a=e,o=[u],s=n+l,c=d,l+=u.length):(o.push(u),l+=u.length)}return a!==null&&i.push({text:t$(o),isWordLike:c,kind:a,start:s}),i}function i$(e){return e===`space`||e===`preserved-space`||e===`zero-width-break`||e===`hard-break`}var a$=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function o$(e,t){let n=e.texts[t];return!!n.startsWith(`www.`)||a$.test(n)&&t+1=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}(t):!d$.has(e)&&!u$.test(e)&&l$.test(e)}function p$(e){let t=!1;for(let n of e)if(!SQ.test(n)){if(!f$(n))return!1;t=!0}return t}function m$(e,t,n,r){let i=!t&&p$(e),a=!r&&p$(n),o=function(e){let t=function(e){for(let t=e.length;t>0;){let n=VQ(e,t),r=e.slice(n,t);if(!SQ.test(r))return r;t=n}return null}(e);return t!==null&&WQ(t)}(e),s=(t||o)&&function(e){for(let t=e.length;t>0;){let n=VQ(e,t),r=e.slice(n,t);if(!SQ.test(r))return f$(r)||WQ(r);t=n}return!1}(e);return!!(i||a||s)&&!EQ(e)&&!EQ(n)&&(t||i||o)&&(r||a)}function h$(e){for(let t of e)if(CQ.test(t))return!0;return!1}function g$(e){if(e.length===0)return!1;for(let t of e)if(!CQ.test(t)&&!c$.has(t))return!1;return!0}function _$(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let t=0;t!0===t.showLineNumbers&&!0===t.node?.diff),y=L(()=>v.value&&!0===t.diffInline),b=L(()=>{let e=Number(t.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;let n=`${Math.ceil(e)}px`;return o.value?{maxHeight:n,overflow:`auto`}:{height:n,minHeight:n,maxHeight:n,overflow:`auto`}}),x=[`diff `,`index `,`--- `,`+++ `,`@@ `];function S(e){return String(e??``).trim().length===0}function C(e,t=`context`,n={}){let r=S(e);return{code:e,kind:r&&t!==`hunk`&&t!==`spacer`&&!n.preserveBlankKind?`context`:t,empty:r}}function w(e){let t=r(e,o.value);return t?t.split(/\r\n|\n|\r/):[]}function T(e,t){return!S(e[t])||tx.some(t=>e.startsWith(t)))}function A(e,t){return t||!e.startsWith(` `)||e.startsWith(` `)?e:` ${e}`}function j(e,t){let n=e.length,r=t.length,i=[],a=0;for(;a=a&&l>=a&&e[c]===t[l];)s.unshift({originalIndex:c,modifiedIndex:l}),c--,l--;let u=c-a+1,d=l-a+1;if(u<=0||d<=0||o.value||(u+1)*(d+1)>15e5)return i.concat(s);let f=d+1,p=new Uint32Array((u+1)*(d+1));for(let n=u-1;n>=0;n--)for(let r=d-1;r>=0;r--){let i=n*f+r;if(e[a+n]===t[a+r])p[i]=p[(n+1)*f+r+1]+1;else{let e=p[(n+1)*f+r],t=p[n*f+r+1];p[i]=e>=t?e:t}}let m=[],h=0,g=0;for(;h=p[h*f+g+1]?h++:g++;return i.concat(m,s)}function N(e){let n=function(){let e=t.diffHideUnchangedRegions;if(e==null||!1===e)return null;let n=!0===e?{}:e;return!1===n.enabled?null:{contextLineCount:Math.max(0,Math.floor(n.contextLineCount??2)),minimumLineCount:Math.max(1,Math.floor(n.minimumLineCount??4))}}();if(!n||e.length<1||e.length>2||e.length===2&&e[0].lines.length!==e[1].lines.length)return e;let r=e[0].lines,i=e[1]?.lines,a=e=>r[e].kind===`context`&&(i===void 0||i[e].kind===`context`&&r[e].code===i[e].code),o=[],s=0;for(;s=n.minimumLineCount){let i=e+(e===0?0:n.contextLineCount),a=t-(t===r.length?0:n.contextLineCount);a-i>=n.minimumLineCount&&o.push({start:i,end:a})}s===e&&s++}return o.length?e.map((e,t)=>{let n=[],r=0;for(let i of o)n.push(...e.lines.slice(r,i.start)),n.push({code:t===0?`Unmodified lines`:``,kind:`collapsed`,empty:!1,key:`${e.key}-collapsed-${i.start}-${i.end}`,number:``}),r=i.end;return n.push(...e.lines.slice(r)),lY(cY({},e),{lines:n})}):e}let ee=L(()=>{if(!v.value)return[];let e=function(e){let n=e.some(e=>D(e)),r=e.some(e=>O(e));return n&&r||function(){if(i.value===`diff`)return!0;let e=String(t.node?.raw??``).split(/\r?\n/,1)[0]?.trim()??``;return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(e)}()&&(n||r)}(p.value),n=function(){return t.node?.originalCode!=null||t.node?.updatedCode!=null}();if(y.value)return N([{key:`inline`,className:`markstream-pre__diff-pane--inline`,lines:n?function(e,t){let n=w(e),r=w(t),i=j(n,r);if(i.length>0){let e=[],t=0,a=0;for(let o of i){for(;t=o&&c>=o&&n[s]===r[c];)l.unshift(lY(cY({},C(r[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let e=o;e<=s;e++)a.push(lY(cY({},C(n[e],`removed`,{preserveBlankKind:T(n,e)})),{key:`inline-removed-source-${e}`,number:e+1}));for(let e=o;e<=c;e++)a.push(lY(cY({},C(r[e],`added`,{preserveBlankKind:T(r,e)})),{key:`inline-added-source-${e}`,number:e+1}));return a.concat(l)}(t.node?.originalCode,t.node?.updatedCode):function(e){let t=[],n=1,r=1,i=k(e);for(let[a,o]of e.entries())if(o.startsWith(`@@`)){let e=o.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);e&&(n=Number(e[1]),r=Number(e[2])),t.push(lY(cY({},C(o,`hunk`)),{key:`inline-hunk-${a}`,number:``}))}else if(D(o))t.push(lY(cY({},C(A(o.slice(1),i),`removed`,{preserveBlankKind:!0})),{key:`inline-removed-${a}`,number:n++}));else if(O(o))t.push(lY(cY({},C(A(o.slice(1),i),`added`,{preserveBlankKind:!0})),{key:`inline-added-${a}`,number:r++}));else{let e=i&&o.startsWith(` `)?o.slice(1):o;t.push(lY(cY({},C(e)),{key:`inline-context-${a}`,number:r})),n++,r++}return t}(p.value)}]);if(!e&&n)return function(e,t){let n=w(e),r=w(t),i=j(n,r),a=[],o=[],s=0,c=0,l=0,u=(e,t)=>{let i=Math.max(e-s,t-c);for(let u=0;ulY(cY({},e),{key:`original-${t}`,number:t+1}))},{key:`modified`,className:`markstream-pre__diff-pane--modified`,lines:a.map((e,t)=>lY(cY({},e),{key:`modified-${t}`,number:t+1}))}])}),P=L(()=>ee.value.some(e=>e.lines.some(e=>e.kind===`collapsed`))),I=L(()=>{let e=i.value;return e?`Code block: ${e}`:`Code block`}),te=R(null),re=R([]),ie=null,oe=!1,se=null;function z(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:0}function ce(e,t){if(!e)return t;if(e.classList.contains(`markstream-pre__diff-line--collapsed`))return 32;let n=e.querySelector(`.markstream-pre__diff-content`)?.getBoundingClientRect()?.height??0;return Math.max(t,Math.ceil(n))}function B(){oe||typeof window>`u`||(ie!=null&&window.cancelAnimationFrame(ie),ie=window.requestAnimationFrame(()=>{ie=null,oe||function(){ie=null;let e=te.value;if(!e||!v.value||y.value||!e.classList.contains(`is-wrap`))return void(re.value.length&&(re.value=[]));let t=function(e){let t=window.getComputedStyle(e),n=z(t.getPropertyValue(`--markstream-pre-diff-line-height`));if(n>0)return n;let r=z(t.lineHeight);return r>0?r:18}(e),n=Array.from(e.querySelectorAll(`.markstream-pre__diff-pane--original .markstream-pre__diff-line`)),r=Array.from(e.querySelectorAll(`.markstream-pre__diff-pane--modified .markstream-pre__diff-line`)),i=Math.max(n.length,r.length),a=[];for(let e=0;e{let n=s[t];return n&&Math.abs(e.rowHeight-n.rowHeight)<=.5&&Math.abs(e.originalHeight-n.originalHeight)<=.5&&Math.abs(e.modifiedHeight-n.modifiedHeight)<=.5})||(re.value=a)}()}))}function le(e){se?.disconnect(),se=null,e&&v.value&&!y.value&&typeof ResizeObserver<`u`&&(se=new ResizeObserver(()=>{B()}),se.observe(e))}function ue(e,t){let n=re.value[e];if(!n)return;let r=t===`original`?n.originalHeight:n.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(n.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(r)}px`}}return s(te,e=>{le(e),n(()=>B())},{flush:`post`}),s([v,y,ee],()=>{le(te.value),n(()=>B())},{flush:`post`,immediate:!0}),ne(()=>{oe=!0,ie!=null&&(window.cancelAnimationFrame(ie),ie=null),se?.disconnect(),se=null}),(e,n)=>(c(),W(`pre`,{ref_key:`preRef`,ref:te,style:ae(b.value),class:V([a.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":v.value,"markstream-pre--diff-inline":y.value,"markstream-pre--diff-collapsed":P.value}]),"aria-busy":o.value,"aria-label":I.value,"data-language":i.value,"data-markstream-line-numbers":t.showLineNumbers?`1`:void 0,"data-markstream-pre":`1`,tabindex:`0`},[v.value?(c(),W(`code`,WX,[(c(!0),W(M,null,_(ee.value,e=>(c(),W(`span`,{key:e.key,class:V([`markstream-pre__diff-pane`,e.className])},[F(`span`,GX,[(c(!0),W(M,null,_(e.lines,(t,r)=>(c(),W(`span`,{key:t.key,class:V([`markstream-pre__diff-line`,[`markstream-pre__diff-line--${t.kind}`,{"markstream-pre__diff-line--empty":t.empty}]]),style:ae(ue(r,e.key))},[n[0]||=F(`span`,{class:`markstream-pre__diff-rail`,"aria-hidden":`true`},null,-1),F(`span`,KX,U(t.number),1),F(`span`,qX,[F(`span`,JX,U(t.code),1)])],6))),128))])],2))),128))])):(c(),W(M,{key:1},[t.showLineNumbers?(c(),W(`span`,YX,[F(`span`,{class:`markstream-pre__line-numbers-text`,textContent:U(g.value)},null,8,XX)])):E(``,!0),F(`code`,{translate:`no`,class:`markstream-pre__code`,textContent:U(l.value)},null,8,ZX)],64))],14,UX))}});QX.install=e=>{e.component(QX.__name,QX)};var $X={key:0},eZ=wY(G({__name:`TextNode`,props:{node:{}},emits:[`copy`],setup(e){let n=e,r=b(),i=m(`markstreamFade`,void 0),a=m(`markstreamTextStreamState`,void 0),o=m(`markstreamStreamVersion`,void 0),l=L(()=>{let e=r.fade;return e===``||!0===e||e===`true`||!1!==e&&e!==`false`&&void 0}),u=L(()=>typeof l.value==`boolean`?l.value:typeof i?.value!=`boolean`||i.value),d=L(()=>{let e=r[`index-key`]??r.indexKey;return e==null||e===``?``:String(e)}),f=R(n.node.content),p=R(``),h=R(0),g;function _(){g?.(),g=void 0}function v(){_(),p.value&&=(f.value+=p.value,``)}s([()=>n.node.content,d,u],([e])=>{let t=String(e??``),n=d.value,r=XK({nextContent:t,persistedContent:n?a?.get(n):void 0,currentState:{settledContent:f.value,streamedDelta:p.value},typewriterEnabled:u.value});f.value=r.settledContent,p.value=r.streamedDelta,r.appended?(h.value+=1,function(){if(!p.value||g||!o)return;let e=o.value;g=s(()=>o.value,t=>{t!==e&&v()},{flush:`sync`})}()):p.value||_(),n&&a?.set(n,t)},{immediate:!0}),t(_);let y=L(()=>h.value%2==0?`text-node-stream-delta--a`:`text-node-stream-delta--b`);return(t,n)=>(c(),W(`span`,{class:V([[e.node.center?`text-node-center`:``],`text-node`])},[f.value?(c(),W(`span`,$X,U(f.value),1)):E(``,!0),p.value?(c(),W(`span`,{key:1,class:V([`text-node-stream-delta`,[y.value]]),onAnimationend:v},U(p.value),35)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-a7e90764`]]);function tZ(e,t,n){return G({name:e,inheritAttrs:!1,setup(e,{attrs:r,slots:i}){let o=wX(),c=xX(),l=SX(),u=typeof window<`u`&&y()?.vnode.el?.nodeType===1,d=R(typeof window>`u`||u||!l.value),f=ue(null),p=null;function m(e){let t=e&&`$el`in e?e.$el:e;f.value=t instanceof HTMLElement?t:null}return typeof window<`u`&&s([f,l],([e,t],n,r)=>{if(p?.destroy(),p=null,!t||d.value)return void(d.value=!0);if(!e)return;let i=!0,a=o(e,{rootMargin:c?.value.heavyBlockMargin,allowIdle:!1});p=a,d.value=a.isVisible.value,a.whenVisible.then(()=>{i&&p===a&&(d.value=!0)}),r(()=>{i=!1,a.destroy(),p===a&&(p=null)})},{immediate:!0}),ne(()=>{p?.destroy(),p=null}),()=>a(d.value?t:n,lY(cY({},r),{ref:m}),i)}})}eZ.install=e=>{e.component(eZ.__name,eZ)};var nZ=G({name:`CodeBlockNodeLoading`,inheritAttrs:!1,props:`node.isDark.loading.stream.theme.darkTheme.lightTheme.isShowPreview.monacoOptions.enableFontSizeControl.minWidth.maxWidth.themes.showHeader.showCopyButton.showExpandButton.showPreviewButton.showCollapseButton.showFontSizeButtons.showTooltips.htmlPreviewAllowScripts.htmlPreviewSandbox.customId.estimatedHeightPx.estimatedContentHeightPx.estimatedDiffInline`.split(`.`),emits:[`previewCode`,`copy`],setup(e,{attrs:t}){let n=e;return()=>{let e=Aq(String(n.node?.language??``)),r=Nq[e]||(e?e.charAt(0).toUpperCase()+e.slice(1):Nq[``]),i=VX(n.node),o=HX(String(n.node?.raw??``),r,i),s=n.monacoOptions,c=i&&(n.estimatedDiffInline??RX(s??{},typeof window>`u`?0:window.innerWidth)),l=s?.diffAppearance,u=l===`dark`||l!==`light`&&!0===n.isDark,d=typeof s?.fontSize==`number`&&Number.isFinite(s.fontSize)&&s.fontSize>0?s.fontSize:12,f=typeof s?.lineHeight==`number`&&Number.isFinite(s.lineHeight)&&s.lineHeight>0?s.lineHeight:d===12?18:Math.max(12,Math.round(1.5*d)),p=typeof s?.tabSize==`number`&&Number.isFinite(s.tabSize)&&s.tabSize>0?s.tabSize:4,m=i?0:8,h=typeof s?.padding?.top==`number`&&Number.isFinite(s.padding.top)&&s.padding.top>=0?s.padding.top:m,g=typeof s?.padding?.bottom==`number`&&Number.isFinite(s.padding.bottom)&&s.padding.bottom>=0?s.padding.bottom:m,_=typeof s?.fontFamily==`string`?s.fontFamily.trim():``,v=cY(cY({fontSize:`${d}px`,lineHeight:`${f}px`,tabSize:p,paddingTop:`${h}px`,paddingBottom:`${g}px`,"--markstream-pre-line-number-top":`${h}px`},i?{"--markstream-pre-diff-line-height":`${f}px`}:{}),_?{"--markstream-code-font-family":_}:{}),y=()=>a(`button`,{class:`code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0`,"aria-hidden":`true`,disabled:!0,tabindex:-1,type:`button`},[a(`svg`,{class:`action-icon`})]),b=!1!==n.isShowPreview&&(e===`html`||e===`svg`),x=!1!==n.showFontSizeButtons&&!1!==n.enableFontSizeControl||!1!==n.showExpandButton||b&&!1!==n.showPreviewButton,S=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},C=cY(cY(cY({"--markstream-code-layout-character-width":`1ch`},S(n.minWidth)?{minWidth:S(n.minWidth)}:{}),S(n.maxWidth)?{maxWidth:S(n.maxWidth)}:{}),i?{}:{color:`var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))`,backgroundColor:`var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))`,borderColor:`var(--markstream-code-border-color, var(--code-border))`});return a(`div`,lY(cY({},t),{class:[`code-block-container`,`rounded-lg`,`border`,{dark:!0===n.isDark,"is-rendering":!1!==n.loading,"is-dark":u,"is-diff":i,"is-plain-text":e===``||e===`plaintext`||e===`text`},t.class],style:[C,t.style],"data-markstream-code-block":`1`,"data-markstream-enhanced":`false`,"data-markstream-code-block-state":n.loading?`streaming`:`settled`,"data-markstream-code-loading":`1`}),[!1===n.showHeader?null:a(`div`,{class:`code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]`},[a(`div`,{class:`code-header-main`},[a(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`}),a(`div`,{class:`code-header-copy`},[a(`div`,{class:`code-header-title`},o.title),o.caption?a(`div`,{class:`code-header-caption`},o.caption):null])]),a(`div`,{class:`flex items-center gap-0.5`,style:{visibility:`hidden`}},[i?a(`div`,{class:`code-diff-stats`,"aria-hidden":`true`},[a(`span`,{class:`code-diff-stat removed`},`-0`),a(`span`,{class:`code-diff-stat added`},`+0`)]):null,!1===n.showCopyButton?null:y(),!1===n.showCollapseButton?null:y(),x?a(`div`,{class:`relative`},[y()]):null])]),a(`div`,{class:`code-block-shell-content`,style:!1!==n.stream||!1===n.loading?void 0:{display:`none`}},[a(QX,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:i?void 0:n.estimatedContentHeightPx,diffInline:c,diffHideUnchangedRegions:i?LX(s?.diffHideUnchangedRegions):void 0,class:`code-pre-fallback`,style:v,"data-markstream-code-loading":`1`})]),a(`div`,{class:`code-loading-placeholder`,style:!1===n.stream&&!1!==n.loading?void 0:{display:`none`}},[a(`div`,{class:`loading-skeleton`},[a(`div`,{class:`skeleton-line`}),a(`div`,{class:`skeleton-line`}),a(`div`,{class:`skeleton-line short`})])]),a(`span`,{class:`sr-only`,"aria-live":`polite`,role:`status`})])}}}),rZ=tZ(`ViewportDeferredCodeBlockNode`,i({loader:()=>uY(null,null,function*(){try{return(yield he(()=>import(`./CodeBlockNode-uERC4D15.js`),__vite__mapDeps([31,7,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".`,e),QX}}),loadingComponent:nZ,delay:0,suspensible:!1}),nZ),iZ=i(()=>uY(null,null,function*(){if(function(){return Reflect.get(globalThis,`process`)?.env}()?.NODE_ENV===`test`&&typeof window<`u`)return e=>a(eZ,lY(cY({},e),{node:{type:`text`,content:e.node.raw??`$${e.node.content??``}$`,raw:e.node.raw??`$${e.node.content??``}$`}}));try{return yield qq(),(yield he(()=>import(`./index7-ClZ3JBPh.js`),__vite__mapDeps([32,1,2]))).default}catch(e){console.warn(`[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".`,e)}return e=>a(eZ,lY(cY({},e),{node:{type:`text`,content:e.node.raw??`$${e.node.content??``}$`,raw:e.node.raw??`$${e.node.content??``}$`}}))})),aZ=i(()=>uY(null,null,function*(){try{return yield qq(),(yield he(()=>import(`./index6-KRBW8xCP.js`),__vite__mapDeps([33,1,2]))).default}catch(e){console.warn(`[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".`,e)}return e=>a(eZ,lY(cY({},e),{node:{type:`text`,content:e.node.raw??`$$${e.node.content??``}$$`,raw:e.node.raw??`$$${e.node.content??``}$$`}}))})),oZ=wY(G({__name:`ReferenceNode`,props:{node:{},messageId:{},threadId:{}},emits:[`click`,`mouseEnter`,`mouseLeave`],setup:e=>(t,n)=>(c(),W(`span`,{class:`reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5`,role:`button`,tabindex:`0`,onClick:n[0]||=n=>t.$emit(`click`,n,e.node.id,e.messageId,e.threadId),onMouseenter:n[1]||=n=>t.$emit(`mouseEnter`,n,e.node.id,e.messageId,e.threadId),onMouseleave:n[2]||=n=>t.$emit(`mouseLeave`,n,e.node.id,e.messageId,e.threadId)},U(e.node.id),33))}),[[`__scopeId`,`data-v-775c65e4`]]);oZ.install=e=>{e.component(oZ.__name,oZ)};var sZ={class:`superscript-node`},cZ=wY(G({__name:`SuperscriptNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,strong:fZ,emphasis:TZ,footnote_reference:AY,strikethrough:mZ,highlight:CZ,insert:xZ,subscript:uZ,emoji:DY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`sup`,sZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`superscript`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`superscript`}-${i}`,"fallback-to-text":``},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-24160b22`]]);cZ.install=e=>{e.component(cZ.__name,cZ)};var lZ={class:`subscript-node`},uZ=wY(G({__name:`SubscriptNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,strong:fZ,emphasis:TZ,footnote_reference:AY,strikethrough:mZ,highlight:CZ,insert:xZ,superscript:cZ,emoji:DY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`sub`,lZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`subscript`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`subscript`}-${i}`,"fallback-to-text":``},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-197fa13b`]]);uZ.install=e=>{e.component(uZ.__name,uZ)};var dZ={class:`strong-node`},fZ=wY(G({__name:`StrongNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,emphasis:TZ,strikethrough:mZ,highlight:CZ,insert:xZ,subscript:uZ,superscript:cZ,emoji:DY,footnote_reference:AY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`strong`,dZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`strong`}-${i}`,components:r.value,node:n,"index-key":`${e.indexKey||`strong`}-${i}`,"custom-id":t.customId},null,8,[`components`,`node`,`index-key`,`custom-id`]))),128))]))}}),[[`__scopeId`,`data-v-a8647104`]]);fZ.install=e=>{e.component(fZ.__name,fZ)};var pZ={class:`strikethrough-node`},mZ=wY(G({__name:`StrikethroughNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,strong:fZ,emphasis:TZ,highlight:CZ,insert:xZ,subscript:uZ,superscript:cZ,emoji:DY,footnote_reference:AY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`del`,pZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`strikethrough`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`strikethrough`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-b7a531fa`]]);mZ.install=e=>{e.component(mZ.__name,mZ)};var hZ=[`href`,`title`,`aria-label`,`aria-hidden`,`target`,`rel`],gZ=[`aria-hidden`],_Z={class:`link-text-wrapper relative inline-flex`},vZ={class:`leading-[normal] link-text`},yZ=wY(G({__name:`LinkNode`,props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){let t=e,n=m(`markstreamShowTooltips`,void 0),r=L(()=>{let e=n?.value;return typeof e==`boolean`?e:t.showTooltip}),i=L(()=>{let e=t.underlineBottom===void 0?`-3px`:typeof t.underlineBottom==`number`?`${t.underlineBottom}px`:String(t.underlineBottom),n=t.animationOpacity??.35,r=Math.max(.12,Math.min(.5*n,n)),i={"--underline-height":`${t.underlineHeight??2}px`,"--underline-bottom":e,"--underline-opacity":String(n),"--underline-rest-opacity":String(r),"--underline-duration":`${t.animationDuration??1.6}s`,"--underline-timing":t.animationTiming??`ease-in-out`,"--underline-iteration":typeof t.animationIteration==`number`?String(t.animationIteration):t.animationIteration??`infinite`};return t.color&&(i[`--link-color`]=t.color),i}),a=bY(()=>t.customId),o=L(()=>cY({text:eZ,strong:fZ,strikethrough:mZ,emphasis:TZ,image:NX,html_inline:UY,inline_code:KY},a.value)),s=b(),l=L(()=>{let e=t.node?.attrs;if(!e||typeof e!=`object`)return{};let n={};if(Array.isArray(e))for(let t of e)Array.isArray(t)&&t[0]&&(n[String(t[0])]=String(t[1]??``));else for(let[t,r]of Object.entries(e))t&&r!=null&&!1!==r&&(n[t]=!0===r?``:String(r));return NY(n,`safe`,`a`)}),u=L(()=>cY(cY({},s),l.value)),d=L(()=>NY({href:String(t.node?.href??``)},`safe`,`a`).href),f=L(()=>{if(!d.value)return;let e=u.value.target;return(typeof e==`string`?e.trim():String(e??``).trim())||(lL(d.value)?`_blank`:void 0)}),p=L(()=>String(f.value??``).trim().toLowerCase()===`_blank`),h=L(()=>{if(!d.value)return;let e=u.value.rel,t=new Set((typeof e==`string`?e:String(e??``)).split(/\s+/).filter(Boolean)),n=new Set(Array.from(t).filter(e=>e.toLowerCase()!==`opener`));return p.value&&(n.add(`noopener`),n.add(`noreferrer`)),n.size>0?Array.from(n).join(` `):void 0}),g=L(()=>{let e=cY({},u.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function y(){r.value&&lX()}let x=L(()=>{let e=t.node?.title;return typeof e==`string`&&e.trim().length>0?e:String(d.value??``)});return(n,a)=>e.node.loading?(c(),W(`span`,re({key:1,class:`link-loading inline-flex items-baseline gap-1.5`,"aria-hidden":e.node.loading?`false`:`true`},z(s),{style:i.value}),[F(`span`,_Z,[F(`span`,vZ,[v(z(eZ),{class:`leading-[normal] link-text`,node:{type:`text`,content:String(e.node.text??``),raw:String(e.node.text??``)},"index-key":`${e.indexKey||`link-text`}-loading`},null,8,[`node`,`index-key`])]),a[1]||=F(`span`,{class:`link-loading-indicator`,"aria-hidden":`true`},null,-1)])],16,gZ)):(c(),W(`a`,re({key:0,class:`link-node`,href:d.value,title:r.value?``:x.value,"aria-label":`Link: ${x.value}`,"aria-hidden":e.node.loading?`true`:`false`,target:f.value,rel:h.value},g.value,{style:i.value,onMouseenter:a[0]||=e=>function(e){if(!r.value)return;let n=e,i=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0,a=t.node?.title||(d.value?.includes(`xn--`)&&(t.node?.text)?.includes(`://`)?t.node.text:d.value)||``;cX(e.currentTarget,a,`top`,!1,i)}(e),onMouseleave:y}),[(c(!0),W(M,null,_(e.node.children,(n,r)=>(c(),P(z(FX),{key:`${e.indexKey||`emphasis`}-${r}`,components:o.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`link-text`}-${r}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))],16,hZ))}}),[[`__scopeId`,`data-v-367e6ca4`]]);yZ.install=e=>{e.component(yZ.__name,yZ)};var bZ={class:`insert-node`},xZ=wY(G({__name:`InsertNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,strong:fZ,emphasis:TZ,strikethrough:mZ,highlight:CZ,subscript:uZ,superscript:cZ,emoji:DY,footnote_reference:AY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`ins`,bZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`insert`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`insert`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-1e2c29d4`]]);xZ.install=e=>{e.component(xZ.__name,xZ)};var SZ={class:`highlight-node`},CZ=wY(G({__name:`HighlightNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,strong:fZ,emphasis:TZ,strikethrough:mZ,insert:xZ,subscript:uZ,superscript:cZ,emoji:DY,footnote_reference:AY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`mark`,SZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`highlight`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`highlight`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-7a62982a`]]);CZ.install=e=>{e.component(CZ.__name,CZ)};var wZ={class:`emphasis-node`},TZ=wY(G({__name:`EmphasisNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>cY({text:eZ,inline_code:KY,link:yZ,html_inline:UY,strong:fZ,strikethrough:mZ,highlight:CZ,insert:xZ,subscript:uZ,superscript:cZ,emoji:DY,footnote_reference:AY,math_inline:iZ,reference:oZ},n.value));return(n,i)=>(c(),W(`em`,wZ,[(c(!0),W(M,null,_(e.node.children,(n,i)=>(c(),P(z(FX),{key:`${e.indexKey||`emphasis`}-${i}`,components:r.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`emphasis`}-${i}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))]))}}),[[`__scopeId`,`data-v-2a5aafbf`]]);TZ.install=e=>{e.component(TZ.__name,TZ)};var EZ={class:`hard-break`},DZ=wY(G({__name:`HardBreakNode`,props:{node:{}},setup:e=>(e,t)=>(c(),W(`br`,EZ))}),[[`__scopeId`,`data-v-50c58f70`]]);DZ.install=e=>{e.component(DZ.__name,DZ)};var OZ=G({__name:`SimpleInlineRenderer`,props:{nodes:{},customId:{},indexKey:{}},setup(e){let t=e,n=g({checkbox:TY,checkbox_input:TY,emoji:DY,emphasis:TZ,hardbreak:DZ,highlight:CZ,inline_code:KY,insert:xZ,link:yZ,reference:oZ,strikethrough:mZ,strong:fZ,subscript:uZ,superscript:cZ,text:eZ}),r=bY(()=>t.customId),i=L(()=>{let e=r.value;return Object.keys(e).length>0?cY(cY({},n),e):n});return(n,r)=>(c(!0),W(M,null,_(e.nodes,(n,r)=>(c(),P(z(FX),{key:r,components:i.value,node:n,"custom-id":t.customId,"index-key":`${e.indexKey||`inline`}-${r}`},null,8,[`components`,`node`,`custom-id`,`index-key`]))),128))}});function kZ(e){if(!e||typeof e!=`object`)return!1;let t=`|${e.type}|`;if(!`|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|`.includes(t))return!1;if(!`|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|`.includes(t))return!0;let n=e.children;return Array.isArray(n)&&n.every(kZ)}function AZ(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(kZ))return e;if(!t||e.length!==1)return null;let r=e[0];if(r?.type!==`paragraph`||!Array.isArray(r.children))return null;let i=r.children;return(n||i.length>0)&&i.every(kZ)?i:null}function jZ(e){if(!e?.length)return null;let t=``;for(let n of e){if(n?.type!==`text`||!0===n.center)return null;t+=String(n.content??n.raw??``)}return t}var MZ=[`cite`],NZ={key:0,dir:`auto`,class:`paragraph-node`},PZ=[`custom-id`],FZ=wY(G({__name:`BlockquoteNode`,props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:[`copy`],setup(e){let t=e,n=bY(()=>t.customId),r=L(()=>!!n.value.paragraph),i=L(()=>!!n.value.text),a=L(()=>AZ(t.node.children,!r.value)),o=L(()=>!1!==t.fade||i.value?null:jZ(a.value));return d(`markstreamShowTooltips`,L(()=>t.showTooltips)),d(`markstreamFade`,L(()=>t.fade)),(n,r)=>(c(),W(`blockquote`,{class:`blockquote blockquote-node`,dir:`auto`,cite:e.node.cite},[a.value?(c(),W(`p`,NZ,[o.value===null?(c(),P(z(OZ),{key:1,nodes:a.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(o.value),9,PZ))])):(c(),P(z(P0),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:r[0]||=e=>n.$emit(`copy`,e)},null,8,[`show-tooltips`,`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`]))],8,MZ))}}),[[`__scopeId`,`data-v-abfecebc`]]);FZ.install=e=>{e.component(FZ.__name,FZ)};var IZ={class:`definition-list`},LZ={class:`definition-term`},RZ={class:`definition-desc`},zZ=wY(G({__name:`DefinitionListNode`,props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:[`copy`],setup(e){let t=e;return(e,n)=>(c(),W(`dl`,IZ,[(c(!0),W(M,null,_(t.node.items,(r,i)=>(c(),W(M,{key:i},[F(`dt`,LZ,[v(z(P0),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:r.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:n[0]||=t=>e.$emit(`copy`,t)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])]),F(`dd`,RZ,[v(z(P0),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:r.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:n[1]||=t=>e.$emit(`copy`,t)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])])],64))),128))]))}}),[[`__scopeId`,`data-v-4e103b30`]]);zZ.install=e=>{e.component(zZ.__name,zZ)};var BZ=[`href`,`title`],VZ=wY(G({__name:`FootnoteAnchorNode`,props:{node:{}},setup(e){let t=e;function n(e){if(e.preventDefault(),typeof document>`u`)return;let n=`fnref-${String(t.node.id??``)}`,r=document.getElementById(n);r&&r.scrollIntoView({behavior:`smooth`,block:`center`})}return(t,r)=>(c(),W(`a`,{class:`footnote-anchor text-sm hover:underline cursor-pointer`,href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n},` ↩︎ `,8,BZ))}}),[[`__scopeId`,`data-v-e1eb37b6`]]);VZ.install=e=>{e.component(VZ.__name,VZ)};var HZ=[`id`],UZ={class:`flex-1`},WZ=G({__name:`FootnoteNode`,props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:[`copy`],setup(e){let t=e;return(n,r)=>(c(),W(`div`,{id:`fnref--${e.node.id}`,class:`footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2`},[F(`div`,UZ,[v(z(P0),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:r[0]||=e=>n.$emit(`copy`,e)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])])],8,HZ))}});WZ.install=e=>{e.component(WZ.__name,WZ)};var GZ=[`custom-id`],KZ=wY(G({__name:`HeadingNode`,props:{node:{},customId:{},indexKey:{}},setup(e){let t=e,n=bY(()=>t.customId),r=m(`markstreamFade`,void 0),i=L(()=>!1!==r?.value||n.value.text?null:jZ(t.node.children)),a=L(()=>cY({text:eZ,inline_code:KY,link:yZ,image:NX,strong:fZ,emphasis:TZ,strikethrough:mZ,highlight:CZ,insert:xZ,subscript:uZ,superscript:cZ,emoji:DY,checkbox:TY,checkbox_input:TY,footnote_reference:AY,hardbreak:DZ,math_inline:iZ,reference:oZ},n.value));return(n,r)=>(c(),P(x(`h${e.node.level}`),re({class:[`heading-node`,[`heading-${e.node.level}`]],dir:`auto`},e.node.attrs),{default:B(()=>[i.value===null?(c(!0),W(M,{key:1},_(e.node.children,(n,r)=>(c(),P(z(FX),{key:r,components:a.value,"custom-id":t.customId,node:n,"index-key":`${e.indexKey||`heading`}-${r}`},null,8,[`components`,`custom-id`,`node`,`index-key`]))),128)):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(i.value),9,GZ))]),_:1},16,[`class`]))}}),[[`__scopeId`,`data-v-7122dbe1`]]),qZ=KZ;qZ.install=e=>{e.component(KZ.__name,KZ)};var JZ={key:0,dir:`auto`,class:`paragraph-node`},YZ=[`custom-id`],XZ={dir:`auto`,class:`paragraph-node`},ZZ=[`custom-id`],QZ=wY(G({__name:`ListItemNode`,props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:[`copy`],setup(e){let t=e,n=L(()=>t.node??t.item),r=bY(()=>t.customId),i=L(()=>!!r.value.paragraph),a=L(()=>!!r.value.text),o=L(()=>AZ(n.value?.children,!i.value)),s=L(()=>{if(i.value)return null;let e=n.value?.children;if(!Array.isArray(e)||e.length<2)return null;let t=e[0];if(t?.type!==`paragraph`||!Array.isArray(t.children))return null;let r=e.slice(1);if(!r.every(e=>e?.type===`list`))return null;let a=AZ([t]);return a?{paragraphChildren:a,nestedLists:r}:null});function l(){return!1===t.fade&&!a.value}let u=L(()=>l()?jZ(o.value):null),f=L(()=>l()?jZ(s.value?.paragraphChildren):null),p=Object.freeze({}),m=L(()=>{let{value:e}=t;return typeof e==`number`&&Number.isFinite(e)?{value:e}:p});return d(`markstreamShowTooltips`,L(()=>t.showTooltips)),d(`markstreamFade`,L(()=>t.fade)),(e,r)=>(c(),W(`li`,re({class:`list-item`,dir:`auto`},m.value),[o.value?(c(),W(`p`,JZ,[u.value===null?(c(),P(z(OZ),{key:1,nodes:o.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(u.value),9,YZ))])):s.value?(c(),W(M,{key:1},[F(`p`,XZ,[f.value===null?(c(),P(z(OZ),{key:1,nodes:s.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(f.value),9,ZZ))]),(c(!0),W(M,null,_(s.value.nestedLists,(n,i)=>(c(),P(z(P0),{key:i,nodes:[n],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${i}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:r[0]||=t=>e.$emit(`copy`,t)},null,8,[`nodes`,`custom-id`,`index-key`,`show-tooltips`,`typewriter`,`fade`,`is-dark`]))),128))],64)):(c(),P(z(P0),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:n.value?.children??[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:r[1]||=t=>e.$emit(`copy`,t)},null,8,[`show-tooltips`,`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`,`is-dark`]))],16))}}),[[`__scopeId`,`data-v-617214f9`]]);QZ.install=e=>{e.component(QZ.__name,QZ)};var $Z=wY(G({__name:`ListNode`,props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:[`copy`],setup(e){let t=bY(()=>e.customId),n=L(()=>t.value.list_item||QZ);return(t,r)=>(c(),P(x(e.node.ordered?`ol`:`ul`),{class:V([`list-node`,{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:B(()=>[(c(!0),W(M,null,_(e.node.items,(i,a)=>(c(),P(x(n.value),re({key:`${e.indexKey||`list`}-${a}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||`list`}-${a}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(e.node.start??1)+a:void 0,onCopy:r[0]||=e=>t.$emit(`copy`,e)}),null,16,[`node`,`custom-id`,`index-key`,`typewriter`,`fade`,`is-dark`,`value`]))),128))]),_:1},8,[`class`]))}}),[[`__scopeId`,`data-v-99cb95e0`]]);$Z.install=e=>{e.component($Z.__name,$Z)};var eQ={key:2,class:`html-block-node__raw`},tQ=[`innerHTML`],nQ={key:1,class:`html-block-node__placeholder`},rQ=wY(G({__name:`HtmlBlockNode`,props:{node:{},customId:{},htmlPolicy:{}},setup(e){let t=e,n=m(`markstreamHtmlPolicy`,void 0),r=m(`markstreamNestedRendererProps`,void 0),a=L(()=>t.htmlPolicy??n?.value??`safe`),l=L(()=>{let e=r?.value??{};return lY(cY({},e),{customId:t.customId??e.customId,htmlPolicy:a.value})}),u=i({loader:()=>Promise.resolve().then(()=>F0),suspensible:!1}),d=L(()=>{let e=fK(t.node.attrs,a.value);if(!e)return;let n=dK(e);return Object.keys(n).length>0?n:void 0}),f=L(()=>{let e=String(t.node.tag||``).trim(),n=fK(t.node.attrs,a.value,e);if(!n)return;let r=dK(n);return Object.keys(r).length>0?r:void 0}),p=bY(()=>t.customId),h=G({name:`DynamicRenderer`,props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),g=R(null),_=R(typeof window>`u`),v=R(t.node.content),y=L(()=>Array.isArray(t.node.children)?t.node.children:[]),b=L(()=>String(t.node.tag||`div`)),S=L(()=>{if(b.value.trim().toLowerCase()!==`details`||t.node.attrs?.some(([e])=>String(e).toLowerCase()===`open`))return null;let e=y.value[0];return e?.type===`html_block`&&String(e.tag||``).toLowerCase()===`summary`?e:null}),C=L(()=>jZ(S.value?.children)),w=L(()=>{let e=S.value;if(!e)return;let t=fK(e.attrs,a.value,`summary`);if(!t)return;let n=dK(t);return Object.keys(n).length>0?n:void 0}),T=L(()=>C.value==null?y.value:y.value.slice(1)),D=L(()=>{let e=b.value.trim().toLowerCase();return YI.has(e)||eK(e,a.value)}),O=L(()=>y.value.length>0&&!!t.node.tag&&!D.value),k=L(()=>{if(O.value)return{mode:`structured`};if(!_.value)return{mode:`html`,content:v.value??``};let e=v.value??t.node.content;if(!e)return{mode:`html`,content:``};if(a.value===`escape`)return{mode:`html`,content:bK(e,a.value)};if(t.node.loading){let n=VY(e,p.value,a.value);return n===null?{mode:`text`,content:t.node.raw??e}:{mode:`dynamic`,nodes:n}}if(!BY(e,p.value))return{mode:`html`,content:bK(e,a.value)};let n=VY(e,p.value,a.value);return n===null?{mode:`html`,content:bK(e,a.value)}:{mode:`dynamic`,nodes:n}}),A=wX(),N=xX(),ee=SX(),I=ue(null),te=!!t.node.loading;return typeof window<`u`?(s([()=>g.value,()=>N?.value.heavyBlockMargin,()=>N?.value.rootMargin],([e],n,r)=>{var i,a;if((a=(i=I.value)?.destroy)==null||a.call(i),I.value=null,!te)return _.value=!0,void(v.value=t.node.content);if(!e)return void(_.value=!1);let o=!0,s=A(e,{rootMargin:N?.value.heavyBlockMargin??N?.value.rootMargin??bX,allowIdle:!ee.value});I.value=s,_.value=_.value||s.isVisible.value,s.whenVisible.then(()=>{o&&I.value===s&&(_.value=!0)}),r(()=>{o=!1,s.destroy(),I.value===s&&(I.value=null)})},{immediate:!0}),s(()=>t.node.content,e=>{te&&!_.value||(v.value=e)})):_.value=!0,ne(()=>{var e,t;(t=(e=I.value)?.destroy)==null||t.call(e),I.value=null}),(t,n)=>(c(),P(x(O.value?b.value:`div`),re({ref_key:`htmlRef`,ref:g,class:`html-block-node`,"data-markstream-viewport-pending":z(ee)&&!_.value?`true`:void 0},O.value?f.value:void 0),{default:B(()=>[_.value?(c(),W(M,{key:0},[k.value.mode===`structured`?(c(),W(M,{key:0},[C.value===null?(c(),P(z(u),re({key:1},l.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`])):(c(),W(M,{key:0},[F(`summary`,j(o(w.value)),U(C.value),17),T.value.length?(c(),P(z(u),re({key:0},l.value,{nodes:T.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`])):E(``,!0)],64))],64)):k.value.mode===`dynamic`?(c(),P(z(h),{key:1,nodes:k.value.nodes},null,8,[`nodes`])):k.value.mode===`text`?(c(),W(`pre`,eQ,U(k.value.content),1)):(c(),W(`div`,re({key:3},d.value,{innerHTML:k.value.content}),null,16,tQ))],64)):(c(),W(`div`,nQ,[me(t.$slots,`placeholder`,{node:e.node},()=>[n[0]||=F(`span`,{class:`html-block-node__placeholder-bar`},null,-1),n[1]||=F(`span`,{class:`html-block-node__placeholder-bar w-4/5`},null,-1),n[2]||=F(`span`,{class:`html-block-node__placeholder-bar w-2/3`},null,-1)],!0)]))]),_:3},16,[`data-markstream-viewport-pending`]))}}),[[`__scopeId`,`data-v-e140a874`]]);rQ.install=e=>{e.component(rQ.__name,rQ)};var iQ={dir:`auto`,class:`paragraph-node`},aQ=[`custom-id`],oQ=wY(G({__name:`ParagraphNode`,props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){let t=e,n=bY(()=>t.customId),r=m(`markstreamHtmlPolicy`,void 0),a=m(`markstreamFade`,void 0),o=m(`markstreamParseOptions`,void 0),s=m(`markstreamCustomMarkdownIt`,void 0),l=m(`markstreamNestedRendererProps`,void 0),u=L(()=>r?.value??`safe`),d=L(()=>t.parseOptions??o?.value),f=L(()=>t.customMarkdownIt??s?.value),p=L(()=>t.customHtmlTags??l?.value?.customHtmlTags),h=L(()=>{let e=l?.value??{};return lY(cY({},e),{customId:t.customId??e.customId,customHtmlTags:p.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:u.value})}),g=i({loader:()=>Promise.resolve().then(()=>F0),suspensible:!1});function v(e){return e.type===`text`&&String(e.content??``).trim()===``}let y=L(()=>t.node.children.filter(e=>!v(e))),b=L(()=>y.value.length>0&&y.value.every(e=>e.type===`image`||function(e){let t=function(e){return e.type===`link`&&Array.isArray(e.children)?e.children.filter(e=>!v(e)):[]}(e);return t.length===1&&t[0]?.type===`image`}(e))),S=L(()=>new Set(SL(p.value))),C=L(()=>{if(!b.value||y.value.length<=1)return t.node.children;let e=[];for(let n=0;n0,a=t.node.children.slice(n+1).some(e=>!v(e));i&&a&&e.push(lY(cY({},r),{content:` `,raw:` `}))}return e}),w=L(()=>!1===a?.value&&!n.value.text),T=L(()=>w.value?jZ(C.value):null);function D(e,n){return{node:e,"index-key":`${t.indexKey}-${n}`,"custom-id":t.customId,"custom-html-tags":p.value}}let O=L(()=>cY({inline_code:KY,image:NX,link:yZ,hardbreak:DZ,emphasis:TZ,strong:fZ,strikethrough:mZ,highlight:CZ,insert:xZ,subscript:uZ,superscript:cZ,html_inline:UY,html_block:rQ,emoji:DY,checkbox:TY,math_inline:iZ,checkbox_input:TY,reference:oZ,footnote_anchor:VZ,footnote_reference:AY,text:eZ},n.value)),k=L(()=>C.value.map((e,r)=>{let i=function(e){if(e.type===`html_block`||e.type===`html_inline`){let t=String(e.tag??``).trim().toLowerCase()||TL(e.content);if(t&&!S.value.has(t)&&DL(e.content??e.raw,t)){let t=String(e.content??e.raw??``);return{child:{type:`text`,content:t,raw:t},component:eZ,isCustomComponent:!1}}}return{child:e,component:O.value[e.type],isCustomComponent:!!(n.value[e.type]&&!_Y(String(e.type)))}}(e);return lY(cY({},i),{index:r,key:`${t.indexKey||`paragraph`}-${r}`,customAttrs:i.isCustomComponent?IY(i.child,u.value):void 0,hasSlotChildren:Array.isArray(i.child.children)&&i.child.children.length>0,slotContent:String(i.child.content??``),originalChild:e})}));return(e,n)=>(c(),W(`p`,iQ,[T.value===null?(c(!0),W(M,{key:1},_(k.value,e=>{return c(),W(M,{key:e.key},[b.value&&v(e.originalChild)?(c(),W(M,{key:0},[K(U((n=e.originalChild,String((r=n.content)??``))),1)],64)):e.isCustomComponent?(c(),P(x(e.component),re({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":t.customId,"custom-html-tags":p.value,"is-dark":h.value.isDark}),{default:B(()=>[e.hasSlotChildren?(c(),P(z(g),re({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(z(g),re({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`custom-html-tags`,`is-dark`])):(c(),P(x(e.component),re({key:2,ref_for:!0},D(e.child,e.index)),null,16))],64);var n,r}),128)):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(T.value),9,aQ))]))}}),[[`__scopeId`,`data-v-c59ff506`]]);oQ.install=e=>{e.component(oQ.__name,oQ)};var sQ={class:`table-node-wrapper`},cQ=[`aria-busy`],lQ={key:0},uQ=[`custom-id`],dQ=[`aria-label`,`onPointerdown`],fQ=[`custom-id`],pQ={key:0,class:`table-node__loading`,role:`status`,"aria-live":`polite`},mQ=wY(G({__name:`TableNode`,props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:[`copy`],setup(e){let t=e,n=L(()=>{var e;return(e=t.node.loading)!=null&&e}),r=L(()=>t.node.rows??[]),i=R(null),a=R([]),o=null,l=L(()=>t.node.header.cells.length),u=L(()=>a.value.some(e=>Number.isFinite(e)&&e>0)),f=L(()=>u.value?a.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);d(`markstreamShowTooltips`,L(()=>t.showTooltips)),d(`markstreamFade`,L(()=>t.fade));let p=bY(()=>t.customId),m=L(()=>!!p.value.text),h=L(()=>!!p.value.paragraph),g=new WeakMap;function y(e){let n=!1===t.fade&&!m.value,r=!h.value,i=g.get(e);if(i?.children===e.children&&i.textFastPath===n&&i.paragraphFastPath===r)return i.info;let a=AZ(e.children,r,!0),o={simpleChildren:a,plainText:a&&n?jZ(a):null};return g.set(e,{children:e.children,textFastPath:n,paragraphFastPath:r,info:o}),o}function b(e){if(!o)return;e.preventDefault();let t=o.startWidth+o.nextStartWidth,n=Math.min(48,Math.floor(t/2)),r=Math.max(n,Math.min(t-n,Math.round(o.startWidth+e.clientX-o.startX))),i=[...o.widths];i[o.index]=r,i[o.index+1]=t-r,a.value=i}function x(){o&&=(window.removeEventListener(`pointermove`,b),window.removeEventListener(`pointerup`,x),window.removeEventListener(`pointercancel`,x),null)}return s(l,()=>{x(),a.value=[]}),ne(x),(s,l)=>(c(),W(`div`,sQ,[F(`table`,{ref_key:`tableRef`,ref:i,class:V([`table-node`,{"table-node--loading":n.value}]),"aria-busy":n.value},[u.value?(c(),W(`colgroup`,lQ,[(c(!0),W(M,null,_(e.node.header.cells,(e,t)=>(c(),W(`col`,{key:t,style:ae(f.value[t])},null,4))),128))])):E(``,!0),F(`thead`,null,[F(`tr`,null,[(c(!0),W(M,null,_(e.node.header.cells,(n,r)=>(c(),W(`th`,{key:r,dir:`auto`,class:V([n.align===`right`?`text-right`:n.align===`center`?`text-center`:`text-left`])},[y(n).plainText===null?y(n).simpleChildren?(c(),P(z(OZ),{key:1,nodes:y(n).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${r}`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),P(z(P0),{key:2,nodes:n.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:l[0]||=e=>s.$emit(`copy`,e)},null,8,[`nodes`,`index-key`,`custom-id`,`typewriter`,`fade`,`show-tooltips`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(y(n).plainText),9,uQ)),rfunction(e,t){if(t.button!==0)return;let n=function(){let e=i.value?.querySelectorAll(`thead th`);return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))}(),r=n[e],s=n[e+1];r&&s&&(t.preventDefault(),o={index:e,startX:t.clientX,startWidth:r,nextStartWidth:s,widths:n},a.value=n,window.addEventListener(`pointermove`,b),window.addEventListener(`pointerup`,x),window.addEventListener(`pointercancel`,x))}(r,e)},null,40,dQ)):E(``,!0)],2))),128))])]),F(`tbody`,null,[(c(!0),W(M,null,_(r.value,(e,n)=>(c(),W(`tr`,{key:n},[(c(!0),W(M,null,_(e.cells,(e,r)=>(c(),W(`td`,{key:r,class:V([e.align===`right`?`text-right`:e.align===`center`?`text-center`:`text-left`]),dir:`auto`},[y(e).plainText===null?y(e).simpleChildren?(c(),P(z(OZ),{key:1,nodes:y(e).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${n}-${r}`},null,8,[`nodes`,`custom-id`,`index-key`])):(c(),P(z(P0),{key:2,nodes:e.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:l[1]||=e=>s.$emit(`copy`,e)},null,8,[`nodes`,`index-key`,`custom-id`,`typewriter`,`fade`,`show-tooltips`])):(c(),W(`span`,{key:0,class:`text-node`,"custom-id":t.customId},U(y(e).plainText),9,fQ))],2))),128))]))),128))])],10,cQ),v(oe,{name:`table-node-fade`},{default:B(()=>[n.value?(c(),W(`div`,pQ,[me(s.$slots,`loading`,{isLoading:n.value},()=>[l[2]||=F(`span`,{class:`table-node__spinner animate-spin`,"aria-hidden":`true`},null,-1),l[3]||=F(`span`,{class:`sr-only`},`Loading`,-1)],!0)])):E(``,!0)]),_:3})]))}}),[[`__scopeId`,`data-v-39f87b5d`]]);mQ.install=e=>{e.component(mQ.__name,mQ)};var hQ={class:`hr-node`},gQ=wY({},[[`render`,function(e,t){return c(),W(`hr`,hQ)}],[`__scopeId`,`data-v-39b2349c`]]);gQ.install=e=>{e.component(gQ.__name,gQ)};var _Q={class:`unknown-node`},vQ=G({__name:`FallbackComponent`,props:{node:{}},setup:e=>(t,n)=>(c(),W(`div`,_Q,U(e.node.raw),1))}),yQ=wY(G({__name:`VmrContainerNode`,props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){let t=e,n=L(()=>`vmr-container vmr-container-${t.node.name}`),r=bY(()=>t.customId),i=L(()=>cY({text:eZ,paragraph:oQ,heading:qZ,inline_code:KY,link:yZ,image:NX,strong:fZ,emphasis:TZ,strikethrough:mZ,insert:xZ,subscript:uZ,superscript:cZ,checkbox:TY,checkbox_input:TY,hardbreak:DZ,math_inline:iZ,reference:oZ,list:$Z,math_block:aZ,table:mQ},r.value));return(r,a)=>(c(),W(`div`,re({class:n.value},e.node.attrs),[(c(!0),W(M,null,_(e.node.children,(n,r)=>{return c(),P(x((a=n.type,i.value[a]||vQ)),{key:`${e.indexKey||`vmr-container`}-${r}`,"custom-id":t.customId,node:n,"index-key":`${e.indexKey||`vmr-container`}-${r}`,typewriter:t.typewriter,fade:t.fade},null,8,[`custom-id`,`node`,`index-key`,`typewriter`,`fade`]);var a}),128))],16))}}),[[`__scopeId`,`data-v-911e41c4`]]);yQ.install=e=>{e.component(yQ.__name,yQ)};var bQ=`BN.BN.BN.BN.BN.BN.BN.BN.BN.S.B.S.WS.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.B.B.B.S.WS.ON.ON.ET.ET.ET.ON.ON.ON.ON.ON.ES.CS.ES.CS.CS.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.CS.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.BN.BN.BN.BN.BN.BN.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.CS.ON.ET.ET.ET.ET.ON.ON.ON.ON.L.ON.ON.BN.ON.ON.ET.ET.EN.EN.ON.L.ON.ON.ON.EN.L.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L`.split(`.`),xQ=[[697,698,`ON`],[706,719,`ON`],[722,735,`ON`],[741,749,`ON`],[751,767,`ON`],[768,879,`NSM`],[884,885,`ON`],[894,894,`ON`],[900,901,`ON`],[903,903,`ON`],[1014,1014,`ON`],[1155,1161,`NSM`],[1418,1418,`ON`],[1421,1422,`ON`],[1423,1423,`ET`],[1424,1424,`R`],[1425,1469,`NSM`],[1470,1470,`R`],[1471,1471,`NSM`],[1472,1472,`R`],[1473,1474,`NSM`],[1475,1475,`R`],[1476,1477,`NSM`],[1478,1478,`R`],[1479,1479,`NSM`],[1480,1535,`R`],[1536,1541,`AN`],[1542,1543,`ON`],[1544,1544,`AL`],[1545,1546,`ET`],[1547,1547,`AL`],[1548,1548,`CS`],[1549,1549,`AL`],[1550,1551,`ON`],[1552,1562,`NSM`],[1563,1610,`AL`],[1611,1631,`NSM`],[1632,1641,`AN`],[1642,1642,`ET`],[1643,1644,`AN`],[1645,1647,`AL`],[1648,1648,`NSM`],[1649,1749,`AL`],[1750,1756,`NSM`],[1757,1757,`AN`],[1758,1758,`ON`],[1759,1764,`NSM`],[1765,1766,`AL`],[1767,1768,`NSM`],[1769,1769,`ON`],[1770,1773,`NSM`],[1774,1775,`AL`],[1776,1785,`EN`],[1786,1808,`AL`],[1809,1809,`NSM`],[1810,1839,`AL`],[1840,1866,`NSM`],[1867,1957,`AL`],[1958,1968,`NSM`],[1969,1983,`AL`],[1984,2026,`R`],[2027,2035,`NSM`],[2036,2037,`R`],[2038,2041,`ON`],[2042,2044,`R`],[2045,2045,`NSM`],[2046,2069,`R`],[2070,2073,`NSM`],[2074,2074,`R`],[2075,2083,`NSM`],[2084,2084,`R`],[2085,2087,`NSM`],[2088,2088,`R`],[2089,2093,`NSM`],[2094,2136,`R`],[2137,2139,`NSM`],[2140,2143,`R`],[2144,2191,`AL`],[2192,2193,`AN`],[2194,2198,`AL`],[2199,2207,`NSM`],[2208,2249,`AL`],[2250,2273,`NSM`],[2274,2274,`AN`],[2275,2306,`NSM`],[2362,2362,`NSM`],[2364,2364,`NSM`],[2369,2376,`NSM`],[2381,2381,`NSM`],[2385,2391,`NSM`],[2402,2403,`NSM`],[2433,2433,`NSM`],[2492,2492,`NSM`],[2497,2500,`NSM`],[2509,2509,`NSM`],[2530,2531,`NSM`],[2546,2547,`ET`],[2555,2555,`ET`],[2558,2558,`NSM`],[2561,2562,`NSM`],[2620,2620,`NSM`],[2625,2626,`NSM`],[2631,2632,`NSM`],[2635,2637,`NSM`],[2641,2641,`NSM`],[2672,2673,`NSM`],[2677,2677,`NSM`],[2689,2690,`NSM`],[2748,2748,`NSM`],[2753,2757,`NSM`],[2759,2760,`NSM`],[2765,2765,`NSM`],[2786,2787,`NSM`],[2801,2801,`ET`],[2810,2815,`NSM`],[2817,2817,`NSM`],[2876,2876,`NSM`],[2879,2879,`NSM`],[2881,2884,`NSM`],[2893,2893,`NSM`],[2901,2902,`NSM`],[2914,2915,`NSM`],[2946,2946,`NSM`],[3008,3008,`NSM`],[3021,3021,`NSM`],[3059,3064,`ON`],[3065,3065,`ET`],[3066,3066,`ON`],[3072,3072,`NSM`],[3076,3076,`NSM`],[3132,3132,`NSM`],[3134,3136,`NSM`],[3142,3144,`NSM`],[3146,3149,`NSM`],[3157,3158,`NSM`],[3170,3171,`NSM`],[3192,3198,`ON`],[3201,3201,`NSM`],[3260,3260,`NSM`],[3276,3277,`NSM`],[3298,3299,`NSM`],[3328,3329,`NSM`],[3387,3388,`NSM`],[3393,3396,`NSM`],[3405,3405,`NSM`],[3426,3427,`NSM`],[3457,3457,`NSM`],[3530,3530,`NSM`],[3538,3540,`NSM`],[3542,3542,`NSM`],[3633,3633,`NSM`],[3636,3642,`NSM`],[3647,3647,`ET`],[3655,3662,`NSM`],[3761,3761,`NSM`],[3764,3772,`NSM`],[3784,3790,`NSM`],[3864,3865,`NSM`],[3893,3893,`NSM`],[3895,3895,`NSM`],[3897,3897,`NSM`],[3898,3901,`ON`],[3953,3966,`NSM`],[3968,3972,`NSM`],[3974,3975,`NSM`],[3981,3991,`NSM`],[3993,4028,`NSM`],[4038,4038,`NSM`],[4141,4144,`NSM`],[4146,4151,`NSM`],[4153,4154,`NSM`],[4157,4158,`NSM`],[4184,4185,`NSM`],[4190,4192,`NSM`],[4209,4212,`NSM`],[4226,4226,`NSM`],[4229,4230,`NSM`],[4237,4237,`NSM`],[4253,4253,`NSM`],[4957,4959,`NSM`],[5008,5017,`ON`],[5120,5120,`ON`],[5760,5760,`WS`],[5787,5788,`ON`],[5906,5908,`NSM`],[5938,5939,`NSM`],[5970,5971,`NSM`],[6002,6003,`NSM`],[6068,6069,`NSM`],[6071,6077,`NSM`],[6086,6086,`NSM`],[6089,6099,`NSM`],[6107,6107,`ET`],[6109,6109,`NSM`],[6128,6137,`ON`],[6144,6154,`ON`],[6155,6157,`NSM`],[6158,6158,`BN`],[6159,6159,`NSM`],[6277,6278,`NSM`],[6313,6313,`NSM`],[6432,6434,`NSM`],[6439,6440,`NSM`],[6450,6450,`NSM`],[6457,6459,`NSM`],[6464,6464,`ON`],[6468,6469,`ON`],[6622,6655,`ON`],[6679,6680,`NSM`],[6683,6683,`NSM`],[6742,6742,`NSM`],[6744,6750,`NSM`],[6752,6752,`NSM`],[6754,6754,`NSM`],[6757,6764,`NSM`],[6771,6780,`NSM`],[6783,6783,`NSM`],[6832,6877,`NSM`],[6880,6891,`NSM`],[6912,6915,`NSM`],[6964,6964,`NSM`],[6966,6970,`NSM`],[6972,6972,`NSM`],[6978,6978,`NSM`],[7019,7027,`NSM`],[7040,7041,`NSM`],[7074,7077,`NSM`],[7080,7081,`NSM`],[7083,7085,`NSM`],[7142,7142,`NSM`],[7144,7145,`NSM`],[7149,7149,`NSM`],[7151,7153,`NSM`],[7212,7219,`NSM`],[7222,7223,`NSM`],[7376,7378,`NSM`],[7380,7392,`NSM`],[7394,7400,`NSM`],[7405,7405,`NSM`],[7412,7412,`NSM`],[7416,7417,`NSM`],[7616,7679,`NSM`],[8125,8125,`ON`],[8127,8129,`ON`],[8141,8143,`ON`],[8157,8159,`ON`],[8173,8175,`ON`],[8189,8190,`ON`],[8192,8202,`WS`],[8203,8205,`BN`],[8207,8207,`R`],[8208,8231,`ON`],[8232,8232,`WS`],[8233,8233,`B`],[8234,8238,`BN`],[8239,8239,`CS`],[8240,8244,`ET`],[8245,8259,`ON`],[8260,8260,`CS`],[8261,8286,`ON`],[8287,8287,`WS`],[8288,8303,`BN`],[8304,8304,`EN`],[8308,8313,`EN`],[8314,8315,`ES`],[8316,8318,`ON`],[8320,8329,`EN`],[8330,8331,`ES`],[8332,8334,`ON`],[8352,8399,`ET`],[8400,8432,`NSM`],[8448,8449,`ON`],[8451,8454,`ON`],[8456,8457,`ON`],[8468,8468,`ON`],[8470,8472,`ON`],[8478,8483,`ON`],[8485,8485,`ON`],[8487,8487,`ON`],[8489,8489,`ON`],[8494,8494,`ET`],[8506,8507,`ON`],[8512,8516,`ON`],[8522,8525,`ON`],[8528,8543,`ON`],[8585,8587,`ON`],[8592,8721,`ON`],[8722,8722,`ES`],[8723,8723,`ET`],[8724,9013,`ON`],[9083,9108,`ON`],[9110,9257,`ON`],[9280,9290,`ON`],[9312,9351,`ON`],[9352,9371,`EN`],[9450,9899,`ON`],[9901,10239,`ON`],[10496,11123,`ON`],[11126,11263,`ON`],[11493,11498,`ON`],[11503,11505,`NSM`],[11513,11519,`ON`],[11647,11647,`NSM`],[11744,11775,`NSM`],[11776,11869,`ON`],[11904,11929,`ON`],[11931,12019,`ON`],[12032,12245,`ON`],[12272,12287,`ON`],[12288,12288,`WS`],[12289,12292,`ON`],[12296,12320,`ON`],[12330,12333,`NSM`],[12336,12336,`ON`],[12342,12343,`ON`],[12349,12351,`ON`],[12441,12442,`NSM`],[12443,12444,`ON`],[12448,12448,`ON`],[12539,12539,`ON`],[12736,12773,`ON`],[12783,12783,`ON`],[12829,12830,`ON`],[12880,12895,`ON`],[12924,12926,`ON`],[12977,12991,`ON`],[13004,13007,`ON`],[13175,13178,`ON`],[13278,13279,`ON`],[13311,13311,`ON`],[19904,19967,`ON`],[42128,42182,`ON`],[42509,42511,`ON`],[42607,42610,`NSM`],[42611,42611,`ON`],[42612,42621,`NSM`],[42622,42623,`ON`],[42654,42655,`NSM`],[42736,42737,`NSM`],[42752,42785,`ON`],[42888,42888,`ON`],[43010,43010,`NSM`],[43014,43014,`NSM`],[43019,43019,`NSM`],[43045,43046,`NSM`],[43048,43051,`ON`],[43052,43052,`NSM`],[43064,43065,`ET`],[43124,43127,`ON`],[43204,43205,`NSM`],[43232,43249,`NSM`],[43263,43263,`NSM`],[43302,43309,`NSM`],[43335,43345,`NSM`],[43392,43394,`NSM`],[43443,43443,`NSM`],[43446,43449,`NSM`],[43452,43453,`NSM`],[43493,43493,`NSM`],[43561,43566,`NSM`],[43569,43570,`NSM`],[43573,43574,`NSM`],[43587,43587,`NSM`],[43596,43596,`NSM`],[43644,43644,`NSM`],[43696,43696,`NSM`],[43698,43700,`NSM`],[43703,43704,`NSM`],[43710,43711,`NSM`],[43713,43713,`NSM`],[43756,43757,`NSM`],[43766,43766,`NSM`],[43882,43883,`ON`],[44005,44005,`NSM`],[44008,44008,`NSM`],[44013,44013,`NSM`],[64285,64285,`R`],[64286,64286,`NSM`],[64287,64296,`R`],[64297,64297,`ES`],[64298,64335,`R`],[64336,64450,`AL`],[64451,64466,`ON`],[64467,64829,`AL`],[64830,64847,`ON`],[64848,64911,`AL`],[64912,64913,`ON`],[64914,64967,`AL`],[64968,64975,`ON`],[64976,65007,`BN`],[65008,65020,`AL`],[65021,65023,`ON`],[65024,65039,`NSM`],[65040,65049,`ON`],[65056,65071,`NSM`],[65072,65103,`ON`],[65104,65104,`CS`],[65105,65105,`ON`],[65106,65106,`CS`],[65108,65108,`ON`],[65109,65109,`CS`],[65110,65118,`ON`],[65119,65119,`ET`],[65120,65121,`ON`],[65122,65123,`ES`],[65124,65126,`ON`],[65128,65128,`ON`],[65129,65130,`ET`],[65131,65131,`ON`],[65136,65278,`AL`],[65279,65279,`BN`],[65281,65282,`ON`],[65283,65285,`ET`],[65286,65290,`ON`],[65291,65291,`ES`],[65292,65292,`CS`],[65293,65293,`ES`],[65294,65295,`CS`],[65296,65305,`EN`],[65306,65306,`CS`],[65307,65312,`ON`],[65339,65344,`ON`],[65371,65381,`ON`],[65504,65505,`ET`],[65506,65508,`ON`],[65509,65510,`ET`],[65512,65518,`ON`],[65520,65528,`BN`],[65529,65533,`ON`],[65534,65535,`BN`],[65793,65793,`ON`],[65856,65932,`ON`],[65936,65948,`ON`],[65952,65952,`ON`],[66045,66045,`NSM`],[66272,66272,`NSM`],[66273,66299,`EN`],[66422,66426,`NSM`],[67584,67870,`R`],[67871,67871,`ON`],[67872,68096,`R`],[68097,68099,`NSM`],[68100,68100,`R`],[68101,68102,`NSM`],[68103,68107,`R`],[68108,68111,`NSM`],[68112,68151,`R`],[68152,68154,`NSM`],[68155,68158,`R`],[68159,68159,`NSM`],[68160,68324,`R`],[68325,68326,`NSM`],[68327,68408,`R`],[68409,68415,`ON`],[68416,68863,`R`],[68864,68899,`AL`],[68900,68903,`NSM`],[68904,68911,`AL`],[68912,68921,`AN`],[68922,68927,`AL`],[68928,68937,`AN`],[68938,68968,`R`],[68969,68973,`NSM`],[68974,68974,`ON`],[68975,69215,`R`],[69216,69246,`AN`],[69247,69290,`R`],[69291,69292,`NSM`],[69293,69311,`R`],[69312,69327,`AL`],[69328,69336,`ON`],[69337,69369,`AL`],[69370,69375,`NSM`],[69376,69423,`R`],[69424,69445,`AL`],[69446,69456,`NSM`],[69457,69487,`AL`],[69488,69505,`R`],[69506,69509,`NSM`],[69510,69631,`R`],[69633,69633,`NSM`],[69688,69702,`NSM`],[69714,69733,`ON`],[69744,69744,`NSM`],[69747,69748,`NSM`],[69759,69761,`NSM`],[69811,69814,`NSM`],[69817,69818,`NSM`],[69826,69826,`NSM`],[69888,69890,`NSM`],[69927,69931,`NSM`],[69933,69940,`NSM`],[70003,70003,`NSM`],[70016,70017,`NSM`],[70070,70078,`NSM`],[70089,70092,`NSM`],[70095,70095,`NSM`],[70191,70193,`NSM`],[70196,70196,`NSM`],[70198,70199,`NSM`],[70206,70206,`NSM`],[70209,70209,`NSM`],[70367,70367,`NSM`],[70371,70378,`NSM`],[70400,70401,`NSM`],[70459,70460,`NSM`],[70464,70464,`NSM`],[70502,70508,`NSM`],[70512,70516,`NSM`],[70587,70592,`NSM`],[70606,70606,`NSM`],[70608,70608,`NSM`],[70610,70610,`NSM`],[70625,70626,`NSM`],[70712,70719,`NSM`],[70722,70724,`NSM`],[70726,70726,`NSM`],[70750,70750,`NSM`],[70835,70840,`NSM`],[70842,70842,`NSM`],[70847,70848,`NSM`],[70850,70851,`NSM`],[71090,71093,`NSM`],[71100,71101,`NSM`],[71103,71104,`NSM`],[71132,71133,`NSM`],[71219,71226,`NSM`],[71229,71229,`NSM`],[71231,71232,`NSM`],[71264,71276,`ON`],[71339,71339,`NSM`],[71341,71341,`NSM`],[71344,71349,`NSM`],[71351,71351,`NSM`],[71453,71453,`NSM`],[71455,71455,`NSM`],[71458,71461,`NSM`],[71463,71467,`NSM`],[71727,71735,`NSM`],[71737,71738,`NSM`],[71995,71996,`NSM`],[71998,71998,`NSM`],[72003,72003,`NSM`],[72148,72151,`NSM`],[72154,72155,`NSM`],[72160,72160,`NSM`],[72193,72198,`NSM`],[72201,72202,`NSM`],[72243,72248,`NSM`],[72251,72254,`NSM`],[72263,72263,`NSM`],[72273,72278,`NSM`],[72281,72283,`NSM`],[72330,72342,`NSM`],[72344,72345,`NSM`],[72544,72544,`NSM`],[72546,72548,`NSM`],[72550,72550,`NSM`],[72752,72758,`NSM`],[72760,72765,`NSM`],[72850,72871,`NSM`],[72874,72880,`NSM`],[72882,72883,`NSM`],[72885,72886,`NSM`],[73009,73014,`NSM`],[73018,73018,`NSM`],[73020,73021,`NSM`],[73023,73029,`NSM`],[73031,73031,`NSM`],[73104,73105,`NSM`],[73109,73109,`NSM`],[73111,73111,`NSM`],[73459,73460,`NSM`],[73472,73473,`NSM`],[73526,73530,`NSM`],[73536,73536,`NSM`],[73538,73538,`NSM`],[73562,73562,`NSM`],[73685,73692,`ON`],[73693,73696,`ET`],[73697,73713,`ON`],[78912,78912,`NSM`],[78919,78933,`NSM`],[90398,90409,`NSM`],[90413,90415,`NSM`],[92912,92916,`NSM`],[92976,92982,`NSM`],[94031,94031,`NSM`],[94095,94098,`NSM`],[94178,94178,`ON`],[94180,94180,`NSM`],[113821,113822,`NSM`],[113824,113827,`BN`],[117760,117973,`ON`],[118e3,118009,`EN`],[118010,118012,`ON`],[118016,118451,`ON`],[118458,118480,`ON`],[118496,118512,`ON`],[118528,118573,`NSM`],[118576,118598,`NSM`],[119143,119145,`NSM`],[119155,119162,`BN`],[119163,119170,`NSM`],[119173,119179,`NSM`],[119210,119213,`NSM`],[119273,119274,`ON`],[119296,119361,`ON`],[119362,119364,`NSM`],[119365,119365,`ON`],[119552,119638,`ON`],[120513,120513,`ON`],[120539,120539,`ON`],[120571,120571,`ON`],[120597,120597,`ON`],[120629,120629,`ON`],[120655,120655,`ON`],[120687,120687,`ON`],[120713,120713,`ON`],[120745,120745,`ON`],[120771,120771,`ON`],[120782,120831,`EN`],[121344,121398,`NSM`],[121403,121452,`NSM`],[121461,121461,`NSM`],[121476,121476,`NSM`],[121499,121503,`NSM`],[121505,121519,`NSM`],[122880,122886,`NSM`],[122888,122904,`NSM`],[122907,122913,`NSM`],[122915,122916,`NSM`],[122918,122922,`NSM`],[123023,123023,`NSM`],[123184,123190,`NSM`],[123566,123566,`NSM`],[123628,123631,`NSM`],[123647,123647,`ET`],[124140,124143,`NSM`],[124398,124399,`NSM`],[124643,124643,`NSM`],[124646,124646,`NSM`],[124654,124655,`NSM`],[124661,124661,`NSM`],[124928,125135,`R`],[125136,125142,`NSM`],[125143,125251,`R`],[125252,125258,`NSM`],[125259,126063,`R`],[126064,126143,`AL`],[126144,126207,`R`],[126208,126287,`AL`],[126288,126463,`R`],[126464,126703,`AL`],[126704,126705,`ON`],[126706,126719,`AL`],[126720,126975,`R`],[126976,127019,`ON`],[127024,127123,`ON`],[127136,127150,`ON`],[127153,127167,`ON`],[127169,127183,`ON`],[127185,127221,`ON`],[127232,127242,`EN`],[127243,127247,`ON`],[127279,127279,`ON`],[127338,127343,`ON`],[127405,127405,`ON`],[127584,127589,`ON`],[127744,128728,`ON`],[128732,128748,`ON`],[128752,128764,`ON`],[128768,128985,`ON`],[128992,129003,`ON`],[129008,129008,`ON`],[129024,129035,`ON`],[129040,129095,`ON`],[129104,129113,`ON`],[129120,129159,`ON`],[129168,129197,`ON`],[129200,129211,`ON`],[129216,129217,`ON`],[129232,129240,`ON`],[129280,129623,`ON`],[129632,129645,`ON`],[129648,129660,`ON`],[129664,129674,`ON`],[129678,129734,`ON`],[129736,129736,`ON`],[129741,129756,`ON`],[129759,129770,`ON`],[129775,129784,`ON`],[129792,129938,`ON`],[129940,130031,`ON`],[130032,130041,`EN`],[130042,130042,`ON`],[131070,131071,`BN`],[196606,196607,`BN`],[262142,262143,`BN`],[327678,327679,`BN`],[393214,393215,`BN`],[458750,458751,`BN`],[524286,524287,`BN`],[589822,589823,`BN`],[655358,655359,`BN`],[720894,720895,`BN`],[786430,786431,`BN`],[851966,851967,`BN`],[917502,917759,`BN`],[917760,917999,`NSM`],[918e3,921599,`BN`],[983038,983039,`BN`],[1048574,1048575,`BN`],[1114110,1114111,`BN`]];function SQ(e){if(e<=255)return bQ[e];let t=0,n=xQ.length-1;for(;t<=n;){let r=t+n>>1,i=xQ[r];if(ei[1]))return i[2];t=r+1}}return`L`}var CQ=/[ \t\n\r\f]+/g,wQ=/[\t\n\r\f]| {2,}|^ | $/,TQ=null,EQ=RegExp(`\\p{Script=Arabic}`,`u`),DQ=RegExp(`\\p{M}`,`u`),OQ=RegExp(`\\p{Nd}`,`u`);function kQ(e){return EQ.test(e)}function AQ(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function jQ(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){if(AQ(r-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(AQ(n))return!0}}return!1}var MQ=new Set([`\xA0`,` `,`⁠`,``]),NQ=new Set([`-`,`‐`,`–`,`—`]);function PQ(e,t){return!(function(e){let t=qQ(e);return t!==null&&MQ.has(t)}(e)||t&&(function(e){let t=qQ(e);return t!==null&&(FQ.has(t)||RQ.has(t))}(e)||function(e){let t=qQ(e);return t!==null&&NQ.has(t)}(e)))}var FQ=new Set(`,...!.:.;.?.、.。.・.).〕.〉.》.」.』.】.〗.〙.〛.ー.々.〻.ゝ.ゞ.ヽ.ヾ`.split(`.`)),IQ=new Set([`"`,`(`,`[`,`{`,`¡`,`¿`,`“`,`‘`,`‚`,`„`,`«`,`‹`,`⸘`,`(`,`〔`,`〈`,`《`,`「`,`『`,`【`,`〖`,`〘`,`〚`]),LQ=new Set([`'`,`’`]),RQ=new Set(`.(,(!(?(:(;(،(؛(؟(।(॥(၊(။(၌(၍(၏()(](}(%("(”(’(»(›(…`.split(`(`)),zQ=new Set([`:`,`.`,`،`,`؛`]),BQ=new Set([`၏`]),VQ=new Set([`”`,`’`,`»`,`›`,`」`,`』`,`】`,`》`,`〉`,`〕`,`)`]);function HQ(e){if(GQ(e))return!0;let t=!1;for(let n of e)if(RQ.has(n)||YQ(n))t=!0;else if(!t||!DQ.test(n))return!1;return t}function UQ(e){for(let t of e)if(!FQ.has(t)&&!RQ.has(t))return!1;return e.length>0}function WQ(e){if(GQ(e))return!0;for(let t of e)if(!(IQ.has(t)||LQ.has(t)||DQ.test(t)||YQ(t)))return!1;return e.length>0}function GQ(e){let t=!1;for(let n of e)if(n!==`\\`&&!DQ.test(n)){if(!(IQ.has(n)||RQ.has(n)||LQ.has(n)))return!1;t=!0}return t}function KQ(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let a=e.charCodeAt(i);return a>=55296&&a<=56319?i:n}function qQ(e){if(e.length===0)return null;let t=KQ(e,e.length);return e.slice(t)}var JQ=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function YQ(e){let t=e.codePointAt(0);return t!==void 0&&function(e,t){for(let n=0;n=t[n]&&e<=t[n+1])return!0;return!1}(t,JQ)}function XQ(e){let t=function(e){for(let t of e)if(!DQ.test(t))return t;return null}(e);return t!==null&&OQ.test(t)}function ZQ(e){let t=Array.from(e),n=t.length;for(;n>0;){let e=t[n-1];if(DQ.test(e))n--;else{if(!IQ.has(e)&&!LQ.has(e))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(``),tail:t.slice(n).join(``)}}function QQ(e,t,n){return n!==`text`||t||e.length!==1||e===`-`||e===`—`?null:e}function $Q(e,t,n,r){let i=t[r],a=e[r];if(i==null)return a;let o=n[r];if(a.length===o)return a;let s=i.repeat(o);return e[r]=s,s}function e$(e,t){return e&&t!==null&&zQ.has(t)}function t$(e){let t=qQ(e);return t!==null&&BQ.has(t)}function n$(e){if(e.length<2||e[0]!==` `)return null;let t=e.slice(1);return RegExp(`^\\p{M}+$`,`u`).test(t)?{space:` `,marks:t}:null}function r$(e){let t=e.length;for(;t>0;){let n=KQ(e,t),r=e.slice(n,t);if(VQ.has(r))return!0;if(!RQ.has(r))return!1;t=n}return!1}function i$(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===` `)return`preserved-space`;if(e===` `)return`tab`;if(t.preserveHardBreaks&&e===` +`)return`hard-break`}return e===` `?`space`:e===`\xA0`||e===` `||e===`⁠`||e===``?`glue`:e===`​`?`zero-width-break`:e===`­`?`soft-hyphen`:`text`}var a$=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function o$(e){return e.length===1?e[0]:e.join(``)}function s$(e,t){let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);return n.push(t),o$(n)}function c$(e,t,n,r){if(!a$.test(e))return[{text:e,isWordLike:t,kind:`text`,start:n}];let i=[],a=null,o=[],s=n,c=!1,l=0;for(let u of e){let e=i$(u,r),d=e===`text`&&t;a===null||e!==a||d!==c?(a!==null&&i.push({text:o$(o),isWordLike:c,kind:a,start:s}),a=e,o=[u],s=n+l,c=d,l+=u.length):(o.push(u),l+=u.length)}return a!==null&&i.push({text:o$(o),isWordLike:c,kind:a,start:s}),i}function l$(e){return e===`space`||e===`preserved-space`||e===`zero-width-break`||e===`hard-break`}var u$=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function d$(e,t){let n=e.texts[t];return!!n.startsWith(`www.`)||u$.test(n)&&t+1=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}(t):!g$.has(e)&&!h$.test(e)&&m$.test(e)}function v$(e){let t=!1;for(let n of e)if(!DQ.test(n)){if(!_$(n))return!1;t=!0}return t}function y$(e,t,n,r){let i=!t&&v$(e),a=!r&&v$(n),o=function(e){let t=function(e){for(let t=e.length;t>0;){let n=KQ(e,t),r=e.slice(n,t);if(!DQ.test(r))return r;t=n}return null}(e);return t!==null&&YQ(t)}(e),s=(t||o)&&function(e){for(let t=e.length;t>0;){let n=KQ(e,t),r=e.slice(n,t);if(!DQ.test(r))return _$(r)||YQ(r);t=n}return!1}(e);return!!(i||a||s)&&!jQ(e)&&!jQ(n)&&(t||i||o)&&(r||a)}function b$(e){for(let t of e)if(OQ.test(t))return!0;return!1}function x$(e){if(e.length===0)return!1;for(let t of e)if(!OQ.test(t)&&!p$.has(t))return!1;return!0}function S$(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let t=0;t0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}(e);if(a.length===0)return{normalized:a,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let o=function(e,t,n){var r;let i=(bQ===null&&(bQ=new Intl.Segmenter(void 0,{granularity:`word`})),bQ),a=0,o=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=[],g=[],_=[];for(let v of i.segment(e))for(let e of r$(v.segment,(r=v.isWordLike)!=null&&r,v.index,n)){let n=function(){d[C]!==null&&(s[C]=[JQ(o,d,f,C)],d[C]=null),s[C].push(e.text),c[C]=c[C]||e.isWordLike,p[C]=p[C]||v,m[C]=m[C]||y,h[C]=x,g[C]=S,_[C]=YQ(m[C],b)},r=e.kind===`text`,i=qQ(e.text,e.isWordLike,e.kind),v=EQ(e.text),y=wQ(e.text),b=HQ(e.text),x=QQ(e.text),S=XQ(e.text),C=a-1;t.carryCJKAfterClosingQuote&&r&&a>0&&l[C]===`text`&&v&&p[C]&&h[C]||r&&a>0&&l[C]===`text`&&RQ(e.text)&&p[C]||r&&a>0&&l[C]===`text`&&g[C]?n():r&&a>0&&l[C]===`text`&&e.isWordLike&&y&&_[C]?(n(),c[C]=!0):i!==null&&a>0&&l[C]===`text`&&d[C]===i?f[C]=(f[C]??1)+1:r&&!e.isWordLike&&a>0&&l[C]===`text`&&!p[C]&&(LQ(e.text)||e.text===`-`&&c[C])?n():(o[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,l[a]=e.kind,u[a]=e.start,d[a]=i,f[a]=i===null?0:1,p[a]=v,m[a]=y,h[a]=x,g[a]=S,_[a]=YQ(y,b),a++)}for(let e=0;enull),y=-1;for(let e=a-1;e>=0;e--){let t=o[e];if(t.length!==0){if(l[e]===`text`&&!c[e]&&y>=0&&l[y]===`text`&&(zQ(t)||t===`-`&&GQ(o[y]))){let n=v[y]??[];n.push(t),v[y]=n,u[y]=u[e],o[e]=``;continue}y=e}}for(let e=0;ea+1){t.push(t$(s)),n.push(u),r.push(`text`),i.push(e.starts[a]),a=l;continue}}t.push(o),n.push(c),r.push(s),i.push(e.starts[a]),a++}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a1;for(let e=0;e=e.len||i$(e.kinds[s]))continue;let c=[],l=e.starts[s],u=s;for(;u0&&(t.push(t$(c)),n.push(!0),r.push(`text`),i.push(l),a=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let i=0;i=0&&!kQ(t.texts[e-1],n)&&u(e),s<0&&(s=e),c||=EQ(l)):(u(e),r.push(l),i.push(t.isWordLike[e]),a.push(d),o.push(t.starts[e]))}return u(t.len),{len:r.length,texts:r,isWordLike:i,kinds:a,starts:o}}(a,o,t.breakKeepAllAfterPunctuation):o;return rY({normalized:a,chunks:_$(s,i)},s)}var y$=null,b$=new Map,x$=null,S$=RegExp(`\\p{Emoji_Presentation}`,`u`),C$=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,w$=null,T$=new Map;function E$(){if(y$!==null)return y$;if(typeof OffscreenCanvas<`u`)return y$=new OffscreenCanvas(1,1).getContext(`2d`),y$;if(typeof document<`u`)return y$=document.createElement(`canvas`).getContext(`2d`),y$;throw Error(`Text measurement requires OffscreenCanvas or a DOM canvas context.`)}function D$(e,t){let n=t.get(e);return n===void 0&&(n={width:E$().measureText(e).width,containsCJK:EQ(e)},t.set(e,n)),n}function O$(){if(x$!==null)return x$;if(typeof navigator>`u`)return x$={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},x$;let e=navigator.userAgent,t=navigator.vendor===`Apple Computer, Inc.`&&e.includes(`Safari/`)&&!e.includes(`Chrome/`)&&!e.includes(`Chromium/`)&&!e.includes(`CriOS/`)&&!e.includes(`FxiOS/`)&&!e.includes(`EdgiOS/`),n=e.includes(`Chrome/`)||e.includes(`Chromium/`)||e.includes(`CriOS/`)||e.includes(`Edg/`);return x$={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},x$}function k$(){return w$===null&&(w$=new Intl.Segmenter(void 0,{granularity:`grapheme`})),w$}function A$(e){return S$.test(e)||e.includes(`️`)}function j$(e,t,n){return n===0?t.width:t.width-function(e,t){return t.emojiCount===void 0&&(t.emojiCount=function(e){let t=0,n=k$();for(let r of n.segment(e))A$(r.segment)&&t++;return t}(e)),t.emojiCount}(e,t)*n}function M$(e){return e===`space`||e===`zero-width-break`||e===`soft-hyphen`}function N$(e){return e===`space`||e===`preserved-space`||e===`tab`||e===`zero-width-break`||e===`soft-hyphen`}function P$(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function L$(e,t){return t===0?0:e+t}function R$(e,t,n,r,i){return L$(r,t===`tab`?i+function(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}(e,n):e.lineEndFitAdvances[n])}function z$(e,t,n,r){return L$(r,t===`tab`?0:e.lineEndFitAdvances[n])}function B$(e,t,n,r,i){return L$(r,t===`tab`?i:e.lineEndPaintAdvances[n])}function V$(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function H$(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function U$(e,t,n){let r=t;for(;ro){if(r!==null&&f>t){m(e,f,p),h=f,s=U$(r,s,h+1),f=-1,p=0;continue}m(),g(e,h,i)}else c+=i,u=e,d=h+1;else g(e,h,i);let a=h+1;r!==null&&r[s]===a&&(f=a,p=c,s++),h++}l&&u===e&&d===n.length&&(u=e+1,d=0)}let y=0;for(;y=n.length)));){let e=n[y],t=N$(r[y]);if(l)if(c+e>o){if(t){_(y,e),m(y+1,0,c-e),y++;continue}if(f>=0){if(u>f||u===f&&d>0){m();continue}m(f,0,p);continue}if(e>o&&i[y]!==null){m(),v(y,0),y++;continue}m()}else _(y,e),t&&(f=y+1,p=c-e),y++;else e>o&&i[y]!==null?v(y,0):h(y,e),t&&(f=y+1,p=c-e),y++}return l&&m(),s}(e,t);let{widths:n,kinds:r,breakableFitAdvances:i,breakablePreferredBreaks:a,discretionaryHyphenWidth:o,chunks:s}=e;if(n.length===0||s.length===0)return 0;let c=O$(),l=t+c.lineFitEpsilon,u=0,d=0,f=!1,p=0,m=0,h=-1,g=0,_=null;function v(){h=-1,g=0,_=null}function y(e=p,t=m,n){u++,d=0,f=!1,v()}function b(e,t){f=!0,p=e+1,m=0,d=t}function x(e,t,n){f=!0,p=e,m=t+1,d=n}function S(e,t){f?(d+=t,p=e+1,m=0):b(e,t)}function C(t,n,r,i,a,o){if(!n)return;let s=z$(e,t,r,a),c=B$(e,t,r,a,i);h=r+1,g=d-o+s,d-o+c,_=t}function w(t,n){let r=i[t],o=a[t]??null,s=o===null?-1:U$(o,0,n+1),c=-1,u=n;for(;ul){if(o!==null&&c>n){y(t,c),u=c,s=U$(o,s,u+1),c=-1;continue}y(),x(t,u,i)}else d=a,p=t,m=u+1}else x(t,u,i);let a=u+1;o!==null&&o[s]===a&&(c=a,s++),u++}f&&p===t&&m===r.length&&(p=t+1,m=0)}function T(e){u++,v()}for(let t=0;t=a.endSegmentIndex)));){let t=r[u],a=N$(t),s=I$(e,f,u),v=t===`tab`?F$(d+s,e.tabStopAdvance):n[u],x=s+v,T=R$(e,t,u,s,v);if(t!==`soft-hyphen`)if(f){if(d+T>l){let n=d+z$(e,t,u,s);if(B$(e,t,u,s,v),_===`soft-hyphen`&&c.preferEarlySoftHyphenBreak&&g<=l){y(h,0);continue}if(a&&n<=l){S(u,x),y(u+1,0),u++;continue}if(h>=0&&g<=l){if(p>h||p===h&&m>0){y();continue}let e=h;y(e,0),u=e;continue}if(T>l&&i[u]!==null){y(),w(u,0),u++;continue}y();continue}S(u,x),C(t,a,u,v,s,x),u++}else T>l&&i[u]!==null?w(u,0):b(u,v),C(t,a,u,v,s,x),u++;else f&&(p=u+1,m=0,h=u+1,g=d+o,d+o,_=t),u++}f&&(a.consumedEndSegmentIndex,y(a.consumedEndSegmentIndex,0))}return u}(e,t)}var G$=null;function K$(){return G$===null&&(G$=new Intl.Segmenter(void 0,{granularity:`grapheme`})),G$}function q$(e,t){let n=[],r=[],i=0,a=!1,o=!1,s=!1;function c(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(``),start:i}),r=[],a=!1,o=!1,s=!1)}function l(e,t,n){r=[e],i=t,a=n,o=QQ(e),s=jQ.has(e)}function u(e,t){r.push(e),a||=t;let n=QQ(e);o=e.length===1&&NQ.has(e)&&o||n,s=!1}for(let n of K$().segment(e)){let e=n.segment,i=EQ(e);r.length===0?l(e,n.index,i):s||AQ.has(e)||NQ.has(e)||t.carryCJKAfterClosingQuote&&i&&o?u(e,i):a||i?(c(),l(e,n.index,i)):u(e,i)}return c(),n}function J$(e,t,n){if(t.length<=1)return t;let r=[],i=-1,a=!1;function o(n){if(!(i<0)){if(a)i+1===n?r.push(t[i]):function(n,i){let a=t[n].start,o=i=0&&!kQ(t[e-1].text,n)&&o(e),i<0&&(i=e),a||=EQ(r.text)}return o(t.length),r}function Y$(e,t){if(t===`zero-width-break`||t===`soft-hyphen`||t===`hard-break`)return 0;if(t===`tab`)return 1;let n=0,r=K$();for(let t of r.segment(e))n++;return n}function X$(e){return e===`-`||e===`֊`||e===`‐`||e===`‒`||e===`–`||e===`—`}function Z$(e,t,n,r,i){let a=O$(),{cache:o,emojiCorrection:s}=function(e,t){E$().font=e;let n=function(e){let t=b$.get(e);return t||(t=new Map,b$.set(e,t)),t}(e),r=function(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}(e);return{cache:n,fontSize:r,emojiCorrection:t?function(e,t){let n=T$.get(e);if(n!==void 0)return n;let r=E$();r.font=e;let i=r.measureText(`😀`).width;if(n=0,i>t+.5&&typeof document<`u`&&document.body!==null){let t=document.createElement(`span`);t.style.font=e,t.style.display=`inline-block`,t.style.visibility=`hidden`,t.style.position=`absolute`,t.textContent=`😀`,document.body.appendChild(t);let r=t.getBoundingClientRect().width;document.body.removeChild(t),i-r>.5&&(n=i-r)}return T$.set(e,n),n}(e,r):0}}(t,(c=e.normalized,C$.test(c)));var c;let l=j$(`-`,D$(`-`,o),s)+(i===0?0:2*i),u=8*j$(` `,D$(` `,o),s),d=i!==0;if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};let f=[],p=[],m=[],h=[],g=e.chunks.length<=1&&!d,_=n?[]:null,v=[],y=[],b=[],x=n?[]:null,S=Array.from({length:e.len});function C(e,t,n,r,i,a,o,s,c){i!==`text`&&i!==`space`&&i!==`zero-width-break`&&(g=!1),f.push(t),p.push(n),m.push(r),h.push(i),_?.push(a),v.push(o),y.push(s),d&&b.push(c),x!==null&&x.push(e)}function w(e,t,n,c,l){let u=D$(e,o),f=d?Y$(e,t):0,p=function(e,t,n){return t>1?e+(t-1)*n:e}(j$(e,u,s),f,i),m=t===`space`||t===`preserved-space`||t===`zero-width-break`?0:p,h=m===0?0:m+(f>0?i:0),g=t===`space`||t===`zero-width-break`?0:p;if(l&&c&&e.length>1){let c=`sum-graphemes`;i===0?g$(e)?c=`pair-context`:a.preferPrefixWidthsForBreakableRuns&&(c=`segment-prefixes`):c=`segment-prefixes`;let l=function(e,t,n,r,i){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===i)return t.breakableFitAdvances;t.breakableFitMode=i;let a=k$(),o=[];for(let t of a.segment(e))o.push(t.segment);if(o.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i===`sum-graphemes`){let e=[];for(let t of o){let i=D$(t,n);e.push(j$(t,i,r))}return t.breakableFitAdvances=e,t.breakableFitAdvances}if(i===`pair-context`||o.length>96){let e=[],i=null,a=0;for(let t of o){let o=j$(t,D$(t,n),r);if(i===null)e.push(o);else{let o=i+t,s=D$(o,n);e.push(j$(o,s,r)-a)}i=t,a=o}return t.breakableFitAdvances=e,t.breakableFitAdvances}let s=[],c=``,l=0;for(let e of o){c+=e;let t=j$(c,D$(c,n),r);s.push(t-l),l=t}return t.breakableFitAdvances=s,t.breakableFitAdvances}(e,u,o,s,c);C(e,p,h,g,t,n,l,l===null||r===`keep-all`?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;let t=[],n=0;for(let r of K$().segment(e))n++,X$(r.segment)&&t.push(n);return t.length===0?null:t}(e),f);return}C(e,p,h,g,t,n,null,null,f)}for(let t=0;t=55296&&a<=56319&&i+1=56320&&t<=57343&&(o=t-56320+(a-55296<<10)+65536,s=2)}let c=_Q(o);c!==`R`&&c!==`AL`&&c!==`AN`||(r=!0);for(let e=0;e=0&&n[r]===`ET`;r--)n[r]=`EN`;for(r=e+1;r0?n[e-1]:s)===`L`?`L`:`R`;if(i===((r{let e=globalThis;if(e[Q$])return e[Q$];let t={configs:{},controllers:{},revision:ue(0),preparedCache:new Map,blockEstimateCache:new Map};return e[Q$]=t,t})(),t1=null,n1=e1.revision;function r1(e){var t;return e&&(t=e1.configs[e])!=null?t:null}function i1(e,t){let n=Number.parseFloat(String(e??``));return Number.isFinite(n)&&n>0?n:t}function a1(e){return e?.type===`text`||e?.type===`emoji`||e?.type===`hardbreak`}function o1(e){if(!Array.isArray(e)||e.length===0)return null;let t=``;for(let n of e){if(!a1(n))return null;n.type===`text`?t+=String(n.content??``):n.type===`emoji`?t+=String(n.name??n.raw??``):n.type===`hardbreak`&&(t+=` -`)}return t.length>0?t:null}function s1(e,t,n){if(!e||!Number.isFinite(t)||t<=0||!function(){if(t1!=null)return t1;if(typeof document>`u`)return!1;try{let e=document.createElement(`canvas`);return t1=!!e.getContext?.call(e,`2d`),t1}catch{return t1=!1,!1}}())return null;try{let r=Math.round(100*t)/100,i=[n.whiteSpace??`pre-wrap`,n.font,n.lineHeight,n.wrapperOverhead,n.widthAdjustment,r,e].join(`\0`),a=e1.blockEstimateCache.get(i);if(a)return e1.blockEstimateCache.delete(i),e1.blockEstimateCache.set(i,a),{kind:`simple-text`,height:a.height,contentHeight:a.contentHeight};let o=n.whiteSpace??`pre-wrap`,s=function(e,t,n){let r=W$(e,t);return{lineCount:r,height:r*n}}(function(e,t,n){let r=`${n}\0${t}\0${e}`,i=e1.preparedCache.get(r);if(i)return e1.preparedCache.delete(r),e1.preparedCache.set(r,i),i.prepared;let a=function(e,t,n){return function(e,t,n,r){let i=r?.wordBreak??`normal`,a=r?.letterSpacing??0;return Z$(v$(e,O$(),r?.whiteSpace,i),t,!1,i,a)}(e,t,0,n)}(e,t,{whiteSpace:n});for(e1.preparedCache.set(r,{prepared:a});e1.preparedCache.size>240;){let e=e1.preparedCache.keys().next().value;if(!e)break;e1.preparedCache.delete(e)}return a}(e,n.font,o),Math.max(24,r-n.widthAdjustment),n.lineHeight),c=Math.max(n.lineHeight,s.height),l=Math.max(n.lineHeight,Math.round(c+n.wrapperOverhead));for(e1.blockEstimateCache.set(i,{height:l,contentHeight:Math.round(c)});e1.blockEstimateCache.size>4e3;){let e=e1.blockEstimateCache.keys().next().value;if(!e)break;e1.blockEstimateCache.delete(e)}return{kind:`simple-text`,height:l,contentHeight:Math.round(c)}}catch{return null}}function c1(e,t,n){if(!n||!e||!Number.isFinite(t)||t<=0)return null;if(e.type===`paragraph`){let r=o1(e.children);return r&&n.paragraph?s1(r,t,n.paragraph):null}if(e.type===`heading`){let r=Number(e.level||0),i=o1(e.children),a=n.headings[r];return i&&a?s1(i,t,a):null}if(e.type===`list_item`){let r=Array.isArray(e.children)?e.children:[];if(r.length!==1||r[0]?.type!==`paragraph`||!n.listItem)return null;let i=o1(r[0]?.children);return i?s1(i,t,n.listItem):null}if(e.type===`list`){let r=Array.isArray(e.items)?e.items:[];if(!r.length)return null;let i=Math.max(0,n.listWrapperOverhead);for(let e of r){let r=c1(e,t,n);if(!r)return null;i+=r.height}return{kind:`simple-text`,height:Math.max(1,Math.round(i)),contentHeight:Math.max(1,Math.round(i))}}return null}function l1(e){if(!e)return 1;let t=String(e).split(/\r?\n/);return Math.max(1,t.length)}function u1(e,t){let n=String(e??``);return t?n:n.replace(/\r\n$|\n$|\r$/,``)}function d1(e,t,n=0){return e.diff?NX(t??{},n)?function(e){let t=u1(e.raw);if(t){let n=t.split(/\r?\n/);return e.originalCode!=null||e.updatedCode!=null?Math.max(1,n.filter(e=>!$$.some(t=>e.startsWith(t))).length):Math.max(1,n.length)}return l1(u1(e.originalCode))+l1(u1(e.updatedCode))}(e):function(e){let t=e.originalCode,n=e.updatedCode;if(t!=null||n!=null)return Math.max(l1(u1(t)),l1(u1(n)));let r=u1(e.code).split(/\r?\n/),i=0,a=0;for(let e of r)e.startsWith(`+`)&&!e.startsWith(`+++`)?a++:e.startsWith(`-`)&&!e.startsWith(`---`)?i++:(i++,a++);return Math.max(1,i,a)}(e):l1(u1(e.code,!0===e.loading))}function f1(e){return e?`${e.fontStyle||`normal`} ${e.fontWeight||`400`} ${e.fontSize||`16px`} ${e.fontFamily||`sans-serif`}`:``}function p1(e,t,n=`pre-wrap`){if(!e||!t||typeof window>`u`)return null;let r=window.getComputedStyle(t),i=e.offsetHeight,a=i1(r.lineHeight,1.5*i1(r.fontSize,16)),o=e.getBoundingClientRect().width,s=t.getBoundingClientRect().width;return{font:f1(r),lineHeight:a,wrapperOverhead:Math.max(0,i-a),widthAdjustment:Math.max(0,o-s),whiteSpace:n}}var m1=new Set([`node`,`key`,`ref`,`ctx`,`renderNode`,`indexKey`,`__proto__`,`prototype`,`constructor`]);function h1(e,t={}){let n={},r=new Set(t.omit??[]);if(!e||typeof e!=`object`)return n;let i=Object.getOwnPropertyDescriptors(e);for(let[e,t]of Object.entries(i))m1.has(e)||r.has(e)||t.enumerable&&`value`in t&&(n[e]=t.value);return n}function g1(e,t,n,r){let i=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),a=function(e,t){return Number.isFinite(e)?Math.min(Math.max(0,e),t):0}(n,i);if(!r.isReverseFlexScrollRoot(e))return void(e.scrollTop=a);let o=Math.max(0,i-a),s=[-o,o],c=s[0],l=1/0;for(let n of s){e.scrollTop=n;let i=r.getNormalizedScrollTop(e,t,!1),o=Math.abs(i-a);ou&&(e.scrollTop=c)}function _1(e,t){let n=0,r=null,i=null,a=()=>{let t=i;i=null,r=null,t&&(n=Date.now(),e(...t))};return function(...o){let s=Date.now(),c=t-(s-n);i=o,c<=0?(r&&=(clearTimeout(r),null),n=s,i=null,e(...o)):r||=setTimeout(a,c)}}function v1(e){return e===`simple`?`simple`:!0===e||e===`true`||e===`precise`?`precise`:`off`}var y1=Symbol(`MarkstreamMathBlockMinHeightCache`);function b1(){return m(y1,null)}var x1=new Set([`text`,`inline_code`,`emoji`,`footnote_reference`]),S1=new Set([`strong`,`emphasis`,`strikethrough`,`highlight`,`insert`,`subscript`,`superscript`,`link`]);function C1(e){let t=Number(e);return!Number.isFinite(t)||t<=0?-1:Math.round(t/32)}function w1(e,t,n,r=22){let i=String(e??``);if(!i)return n;let a=Math.max(18,Math.floor(Math.max(320,t)/8)),o=i.split(/\r?\n/).length,s=Math.ceil(i.length/a);return Math.max(n,Math.ceil(Math.max(1,o,s)*r+12))}function T1(e){if(!e||typeof e!=`object`)return!1;let t=e,n=String(t.type??``);if(x1.has(n))return!0;if(!S1.has(n))return!1;let r=t.children;return!Array.isArray(r)||!r.length||r.every(T1)}function E1(e){if(!e||typeof e!=`object`)return``;let t=e,n=String(t.type??``);if(n===`text`)return String(t.content??t.raw??``);if(n===`inline_code`)return String(t.code??t.content??t.raw??``);if(n===`emoji`)return String(t.name??t.raw??``);if(typeof t.text==`string`)return t.text;let r=[];for(let e of[`children`,`items`,`cells`,`rows`]){let n=t[e];if(Array.isArray(n)){let e=n.map(E1).filter(Boolean).join(` `);e&&r.push(e)}}return r.join(` `).replace(/\s+/g,` `).trim()}function D1(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`inline_code`||[`children`,`items`,`cells`,`rows`].some(e=>{let n=t[e];return Array.isArray(n)&&n.some(D1)})}function O1(e,t){if(!e)return 30;let n=Math.max(18,Math.floor(Math.max(320,t)/8)),r=e.split(/\r?\n/).length,i=Math.ceil(e.length/n);return 30+26*Math.max(0,Math.max(1,r,i)-1)}function k1(e,t){if(!e||typeof e!=`object`)return 32;let n=e,r=String(n.type??``),i=Number.isFinite(t)&&t>0?t:640;switch(r){case`heading`:return function(e){let t=Number(e.level??e.depth);return t>=4?20:t===3?30:t===2?32:44}(n);case`paragraph`:return function(e,t){let n=String(e??``);if(!n)return 28;let r=Math.max(18,Math.floor(Math.max(320,t)/8)),i=n.split(/\r?\n/).length,a=Math.ceil(n.length/r);return Math.max(1,i,a)<=1?28:w1(n,t,34)}(String(n.raw??n.content??``),i);case`list`:return function(e,t){let n=Array.isArray(e.items)?e.items:[];if(!n.length)return 48;let r=Math.max(48,30*n.length+12),i=12;for(let e of n)i+=O1(E1(e)||String(e.raw??``),t);let a=Math.max(0,i-r);if(n.length>20){let e=Math.round(2.4*n.length);return Math.round(r+Math.max(e,Math.min(a,3*n.length)))}if(a<=0)return r;let o=n.length>8?8*n.length:a;return Math.round(r+Math.min(a,o))}(n,i);case`list_item`:return w1(String(n.raw??n.content??``),i,34);case`blockquote`:return w1(String(n.raw??n.content??``),i,56);case`table`:return function(e,t){let n=[...e.header?[e.header]:[],...Array.isArray(e.rows)?e.rows:[]];if(!n.length){let t=Array.isArray(e.children)?e.children.length:3;return Math.max(120,38*t+48)}return Math.max(120,Math.round(4+n.reduce((e,n)=>e+function(e,t){let n=Math.max(1,e.length),r=Math.max(80,(t-32)/n),i=Math.max(10,Math.floor(r/8)),a=Math.max(1,...e.map(e=>{let t=E1(e)||String(e?.raw??``);return Math.ceil(t.length/i)||1}));return 54+34*Math.max(0,a-1)+(n<=3&&e.some(D1)?14:0)}(function(e){var t;return Array.isArray(e?.cells)&&(t=e.cells)!=null?t:[]}(n),t),0)))}(n,i);case`code_block`:{let e=String(n.language??``).trim().toLowerCase(),t=String(n.code??n.raw??``);return e===`mermaid`?dJ(cJ(t)):e===`infographic`?fJ(lJ(t)):w1(t,i,96,20)}case`math_block`:return 72;case`image`:return 220;case`admonition`:case`vmr_container`:case`html_block`:return function(e,t){let n=e.match(/^\s*]*)>/i);return n&&!/(?:^|\s)open(?:\s|=|$)/i.test(n[1]??``)?w1((e.match(/]*>([\s\S]*?)<\/summary>/i)?.[1])?.replace(/<[^>]*>/g,``).trim()||`Details`,t,28,28):w1(e,t,96)}(String(n.raw??n.content??``),i);case`thematic_break`:return 24;default:return w1(String(n.raw??n.content??``),i,40)}}function A1(e,t,n){return Math.min(Math.max(e,t),n)}var j1=[`total`,`cacheHits`,`appendHits`,`tailHits`,`fullParses`,`chunkedParses`],M1=[`tokenCloneMs`,`processTokensInputTokens`,`processTokensReusedTopLevelNodes`,`processTokensMs`,`parseMarkdownToStructureTotalMs`],N1=new Set([`attrs`,`data`,`items`,`header`,`payload`,`props`,`rows`,`cells`,`term`,`definition`,`sourceMap`]),P1=[`raw`,`content`,`code`,`originalCode`,`updatedCode`],F1=new WeakMap,I1=new WeakMap,L1=1;function R1(){return typeof performance<`u`?performance.now():Date.now()}function z1(e){let t=e.stream;return t&&typeof t.stats==`function`?t.stats():null}function B1(e){if(typeof e!=`object`&&typeof e!=`function`||e===null)return``;let t=e,n=F1.get(t);return n||(n=L1++,F1.set(t,n)),String(n)}function V1(e,t,n,r={}){let i=!1!==r.includeFinal,a={md:B1(t),customMarkdownIt:B1(n),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:e.customHtmlTags??[],includeSourceMap:!0===e.includeSourceMap,streamParse:e.streamParse??`auto`,validateLink:B1(e.validateLink),preTransformTokens:B1(e.preTransformTokens),postTransformTokens:B1(e.postTransformTokens),postTransformNodes:B1(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function H1(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===10;)--t;let n=e.lastIndexOf(` -`,t-1)+1;return e.slice(n,t).trim()}function U1(e){let t=W1(e);return t.length>=2&&t.every(e=>{let t=e.trim();return t.length>=1&&t.replace(/^:/,``).replace(/:$/,``).split(``).every(e=>e===`-`)})}function W1(e){return e.includes(`|`)?e.replace(/^\|/,``).replace(/\|$/,``).split(`|`):[]}function G1(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function K1(e){let t=String(e??``);return`${t.length}:${G1(t)}`}function q1(e,t=new WeakMap,n=0){if(e==null||typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`string`)return`s:${function(e){return e.length<=8192?K1(e):`${e.length}:${G1(e.slice(0,8192))}:truncated`}(e)}`;if(typeof e==`function`)return`fn:${B1(e)}`;if(typeof e!=`object`)return typeof e;let r=e,i=t.get(r);if(i)return`cycle:${i}`;if(n>=6)return`object:${B1(r)}`;let a=B1(r);if(t.set(r,a),Array.isArray(e)){let r=e.slice(0,200);return`a:${e.length}:${r.map(e=>q1(e,t,n+1)).join(`,`)}`}if(typeof e==`object`){let r=e,i=Object.keys(r).sort(),a=i.slice(0,80);return`o:${i.length}:${a.sort().map(e=>`${e}:${q1(r[e],t,n+1)}`).join(`;`)}`}return typeof e}function J1(e){return typeof e==`object`&&!!e&&typeof e.type==`string`&&typeof e.raw==`string`}function Y1(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>J1(e)?Q1(e,t,n+1):Y1(e,t,n+1)).join(`,`)}`:J1(e)?Q1(e,t,n):q1(e,t,n)}function X1(e,t,n){return Object.keys(e).sort().filter(e=>e!==`children`&&!P1.includes(e)).map(r=>{let i=e[r];return typeof i==`string`?`${r}=s:${K1(i)}`:typeof i==`number`||typeof i==`boolean`||i==null?`${r}=${String(i)}`:typeof i==`function`?`${r}=fn:${B1(i)}`:N1.has(r)&&(Array.isArray(i)||typeof i==`object`)?`${r}=${Y1(i,t,n+1)}`:i&&typeof i==`object`?`${r}=object:${B1(i)}`:``}).filter(Boolean).join(`;`)}function Z1(e){return P1.map(t=>{let n=e[t];return typeof n==`string`?`${t}=s:${K1(n)}`:``}).filter(Boolean).join(`;`)}function Q1(e,t=new WeakMap,n=0){let r=I1.get(e);if(r)return r;let i=e,a=t.get(i);if(a)return`node-cycle:${a}`;if(n>=6)return`node:${e.type}:${B1(i)}`;let o=B1(i);t.set(i,o);let s=function(e,t,n){let r=e,i=Array.isArray(r.children)?r.children:[],a=i.length?i.slice(0,200).map(e=>Q1(e,t,n+1)).join(`|`):``;return[e.type,Z1(r),X1(r,t,n),i.length,a].join(`:`)}(e,t,n);return I1.set(i,s),s}function $1(e,t){return Q1(e)===Q1(t)}function e0(e,t,n){let r=R1(),i=t===`stabilizeSignatureMs`?`stabilizeSignatureCallCount`:`primeSignatureCallCount`;try{return n()}finally{e[t]+=R1()-r,e[i]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function t0(e,t,n){return e0(t,n,()=>Q1(e))}function n0(e,t,n){return t0(e,n,`stabilizeSignatureMs`)===t0(t,n,`stabilizeSignatureMs`)}function r0(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function i0(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function a0(e){return!0===e.__markstreamHasCustomParserExtensions||function(e){return Number(e.__markstreamRegisteredPluginCount??0)>0}(e)}function o0(e,t){return e.length===t.length&&e===t}function s0(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;let r=e,i=t,a=Object.keys(r).filter(e=>e!==`type`&&e!==`children`).sort(),o=Object.keys(i).filter(e=>e!==`type`&&e!==`children`).sort();if(a.length!==o.length)return!1;for(let e=0;e{r=s0(e,t)}),r??n0(e,t,n)}function u0(e,t){let n={};for(let r of j1){let i=e[r],a=t?.[r];typeof i==`number`&&(n[r]=i-(typeof a==`number`?a:0))}return n}function d0(e,n){let r=UK(n.instanceMsgId),i=new Map,a=n.smoothStreamingEnabled??L(()=>!1),o=R(n.renderContent.value),c=[],l=``,u=``,d=``,f=!1,p=function(){let e=``,t=0,n=!1,r=!1,i=!1,a=!1;function o(){e=``,t=0,n=!1,r=!1,i=!1,a=!1}function s(e){let o=!1;for(let s=0;s{if(!t||!n.startsWith(t)||n.length<=t.length)return o(),[!0,0];let r=0;e!==t&&(o(),s(t),r=t.length);let i=n.slice(t.length),a=s(i);return e=n,[a,r+i.length]}}(),m,h=0,_=0,v=R1(),y=-1,b=0;function x(e){y=Number.isInteger(e)?e:0,b+=1}function S(){m&&=(clearTimeout(m),void 0)}function C(){S();let e=n.renderContent.value;o.value!==e&&(o.value=e),v=R1()}s([n.renderContent,n.effectiveFinal,a],([t,n,r])=>{o.value!==t&&(!r||n||function(e,t){if(!e&&t||t.length<=80||t.length0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}(e);if(a.length===0)return{normalized:a,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let o=function(e,t,n){var r;let i=(TQ===null&&(TQ=new Intl.Segmenter(void 0,{granularity:`word`})),TQ),a=0,o=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=[],g=[],_=[];for(let v of i.segment(e))for(let e of c$(v.segment,(r=v.isWordLike)!=null&&r,v.index,n)){let n=function(){d[C]!==null&&(s[C]=[$Q(o,d,f,C)],d[C]=null),s[C].push(e.text),c[C]=c[C]||e.isWordLike,p[C]=p[C]||v,m[C]=m[C]||y,h[C]=x,g[C]=S,_[C]=e$(m[C],b)},r=e.kind===`text`,i=QQ(e.text,e.isWordLike,e.kind),v=jQ(e.text),y=kQ(e.text),b=qQ(e.text),x=r$(e.text),S=t$(e.text),C=a-1;t.carryCJKAfterClosingQuote&&r&&a>0&&l[C]===`text`&&v&&p[C]&&h[C]||r&&a>0&&l[C]===`text`&&UQ(e.text)&&p[C]||r&&a>0&&l[C]===`text`&&g[C]?n():r&&a>0&&l[C]===`text`&&e.isWordLike&&y&&_[C]?(n(),c[C]=!0):i!==null&&a>0&&l[C]===`text`&&d[C]===i?f[C]=(f[C]??1)+1:r&&!e.isWordLike&&a>0&&l[C]===`text`&&!p[C]&&(HQ(e.text)||e.text===`-`&&c[C])?n():(o[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,l[a]=e.kind,u[a]=e.start,d[a]=i,f[a]=i===null?0:1,p[a]=v,m[a]=y,h[a]=x,g[a]=S,_[a]=e$(y,b),a++)}for(let e=0;enull),y=-1;for(let e=a-1;e>=0;e--){let t=o[e];if(t.length!==0){if(l[e]===`text`&&!c[e]&&y>=0&&l[y]===`text`&&(WQ(t)||t===`-`&&XQ(o[y]))){let n=v[y]??[];n.push(t),v[y]=n,u[y]=u[e],o[e]=``;continue}y=e}}for(let e=0;ea+1){t.push(o$(s)),n.push(u),r.push(`text`),i.push(e.starts[a]),a=l;continue}}t.push(o),n.push(c),r.push(s),i.push(e.starts[a]),a++}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a1;for(let e=0;e=e.len||l$(e.kinds[s]))continue;let c=[],l=e.starts[s],u=s;for(;u0&&(t.push(o$(c)),n.push(!0),r.push(`text`),i.push(l),a=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let i=0;i=0&&!PQ(t.texts[e-1],n)&&u(e),s<0&&(s=e),c||=jQ(l)):(u(e),r.push(l),i.push(t.isWordLike[e]),a.push(d),o.push(t.starts[e]))}return u(t.len),{len:r.length,texts:r,isWordLike:i,kinds:a,starts:o}}(a,o,t.breakKeepAllAfterPunctuation):o;return cY({normalized:a,chunks:S$(s,i)},s)}var w$=null,T$=new Map,E$=null,D$=RegExp(`\\p{Emoji_Presentation}`,`u`),O$=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,k$=null,A$=new Map;function j$(){if(w$!==null)return w$;if(typeof OffscreenCanvas<`u`)return w$=new OffscreenCanvas(1,1).getContext(`2d`),w$;if(typeof document<`u`)return w$=document.createElement(`canvas`).getContext(`2d`),w$;throw Error(`Text measurement requires OffscreenCanvas or a DOM canvas context.`)}function M$(e,t){let n=t.get(e);return n===void 0&&(n={width:j$().measureText(e).width,containsCJK:jQ(e)},t.set(e,n)),n}function N$(){if(E$!==null)return E$;if(typeof navigator>`u`)return E$={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},E$;let e=navigator.userAgent,t=navigator.vendor===`Apple Computer, Inc.`&&e.includes(`Safari/`)&&!e.includes(`Chrome/`)&&!e.includes(`Chromium/`)&&!e.includes(`CriOS/`)&&!e.includes(`FxiOS/`)&&!e.includes(`EdgiOS/`),n=e.includes(`Chrome/`)||e.includes(`Chromium/`)||e.includes(`CriOS/`)||e.includes(`Edg/`);return E$={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},E$}function P$(){return k$===null&&(k$=new Intl.Segmenter(void 0,{granularity:`grapheme`})),k$}function F$(e){return D$.test(e)||e.includes(`️`)}function I$(e,t,n){return n===0?t.width:t.width-function(e,t){return t.emojiCount===void 0&&(t.emojiCount=function(e){let t=0,n=P$();for(let r of n.segment(e))F$(r.segment)&&t++;return t}(e)),t.emojiCount}(e,t)*n}function L$(e){return e===`space`||e===`zero-width-break`||e===`soft-hyphen`}function R$(e){return e===`space`||e===`preserved-space`||e===`tab`||e===`zero-width-break`||e===`soft-hyphen`}function z$(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function H$(e,t){return t===0?0:e+t}function U$(e,t,n,r,i){return H$(r,t===`tab`?i+function(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}(e,n):e.lineEndFitAdvances[n])}function W$(e,t,n,r){return H$(r,t===`tab`?0:e.lineEndFitAdvances[n])}function G$(e,t,n,r,i){return H$(r,t===`tab`?i:e.lineEndPaintAdvances[n])}function K$(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function q$(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function J$(e,t,n){let r=t;for(;ro){if(r!==null&&f>t){m(e,f,p),h=f,s=J$(r,s,h+1),f=-1,p=0;continue}m(),g(e,h,i)}else c+=i,u=e,d=h+1;else g(e,h,i);let a=h+1;r!==null&&r[s]===a&&(f=a,p=c,s++),h++}l&&u===e&&d===n.length&&(u=e+1,d=0)}let y=0;for(;y=n.length)));){let e=n[y],t=R$(r[y]);if(l)if(c+e>o){if(t){_(y,e),m(y+1,0,c-e),y++;continue}if(f>=0){if(u>f||u===f&&d>0){m();continue}m(f,0,p);continue}if(e>o&&i[y]!==null){m(),v(y,0),y++;continue}m()}else _(y,e),t&&(f=y+1,p=c-e),y++;else e>o&&i[y]!==null?v(y,0):h(y,e),t&&(f=y+1,p=c-e),y++}return l&&m(),s}(e,t);let{widths:n,kinds:r,breakableFitAdvances:i,breakablePreferredBreaks:a,discretionaryHyphenWidth:o,chunks:s}=e;if(n.length===0||s.length===0)return 0;let c=N$(),l=t+c.lineFitEpsilon,u=0,d=0,f=!1,p=0,m=0,h=-1,g=0,_=null;function v(){h=-1,g=0,_=null}function y(e=p,t=m,n){u++,d=0,f=!1,v()}function b(e,t){f=!0,p=e+1,m=0,d=t}function x(e,t,n){f=!0,p=e,m=t+1,d=n}function S(e,t){f?(d+=t,p=e+1,m=0):b(e,t)}function C(t,n,r,i,a,o){if(!n)return;let s=W$(e,t,r,a),c=G$(e,t,r,a,i);h=r+1,g=d-o+s,d-o+c,_=t}function w(t,n){let r=i[t],o=a[t]??null,s=o===null?-1:J$(o,0,n+1),c=-1,u=n;for(;ul){if(o!==null&&c>n){y(t,c),u=c,s=J$(o,s,u+1),c=-1;continue}y(),x(t,u,i)}else d=a,p=t,m=u+1}else x(t,u,i);let a=u+1;o!==null&&o[s]===a&&(c=a,s++),u++}f&&p===t&&m===r.length&&(p=t+1,m=0)}function T(e){u++,v()}for(let t=0;t=a.endSegmentIndex)));){let t=r[u],a=R$(t),s=V$(e,f,u),v=t===`tab`?B$(d+s,e.tabStopAdvance):n[u],x=s+v,T=U$(e,t,u,s,v);if(t!==`soft-hyphen`)if(f){if(d+T>l){let n=d+W$(e,t,u,s);if(G$(e,t,u,s,v),_===`soft-hyphen`&&c.preferEarlySoftHyphenBreak&&g<=l){y(h,0);continue}if(a&&n<=l){S(u,x),y(u+1,0),u++;continue}if(h>=0&&g<=l){if(p>h||p===h&&m>0){y();continue}let e=h;y(e,0),u=e;continue}if(T>l&&i[u]!==null){y(),w(u,0),u++;continue}y();continue}S(u,x),C(t,a,u,v,s,x),u++}else T>l&&i[u]!==null?w(u,0):b(u,v),C(t,a,u,v,s,x),u++;else f&&(p=u+1,m=0,h=u+1,g=d+o,d+o,_=t),u++}f&&(a.consumedEndSegmentIndex,y(a.consumedEndSegmentIndex,0))}return u}(e,t)}var X$=null;function Z$(){return X$===null&&(X$=new Intl.Segmenter(void 0,{granularity:`grapheme`})),X$}function Q$(e,t){let n=[],r=[],i=0,a=!1,o=!1,s=!1;function c(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(``),start:i}),r=[],a=!1,o=!1,s=!1)}function l(e,t,n){r=[e],i=t,a=n,o=r$(e),s=IQ.has(e)}function u(e,t){r.push(e),a||=t;let n=r$(e);o=e.length===1&&RQ.has(e)&&o||n,s=!1}for(let n of Z$().segment(e)){let e=n.segment,i=jQ(e);r.length===0?l(e,n.index,i):s||FQ.has(e)||RQ.has(e)||t.carryCJKAfterClosingQuote&&i&&o?u(e,i):a||i?(c(),l(e,n.index,i)):u(e,i)}return c(),n}function $$(e,t,n){if(t.length<=1)return t;let r=[],i=-1,a=!1;function o(n){if(!(i<0)){if(a)i+1===n?r.push(t[i]):function(n,i){let a=t[n].start,o=i=0&&!PQ(t[e-1].text,n)&&o(e),i<0&&(i=e),a||=jQ(r.text)}return o(t.length),r}function e1(e,t){if(t===`zero-width-break`||t===`soft-hyphen`||t===`hard-break`)return 0;if(t===`tab`)return 1;let n=0,r=Z$();for(let t of r.segment(e))n++;return n}function t1(e){return e===`-`||e===`֊`||e===`‐`||e===`‒`||e===`–`||e===`—`}function n1(e,t,n,r,i){let a=N$(),{cache:o,emojiCorrection:s}=function(e,t){j$().font=e;let n=function(e){let t=T$.get(e);return t||(t=new Map,T$.set(e,t)),t}(e),r=function(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}(e);return{cache:n,fontSize:r,emojiCorrection:t?function(e,t){let n=A$.get(e);if(n!==void 0)return n;let r=j$();r.font=e;let i=r.measureText(`😀`).width;if(n=0,i>t+.5&&typeof document<`u`&&document.body!==null){let t=document.createElement(`span`);t.style.font=e,t.style.display=`inline-block`,t.style.visibility=`hidden`,t.style.position=`absolute`,t.textContent=`😀`,document.body.appendChild(t);let r=t.getBoundingClientRect().width;document.body.removeChild(t),i-r>.5&&(n=i-r)}return A$.set(e,n),n}(e,r):0}}(t,(c=e.normalized,O$.test(c)));var c;let l=I$(`-`,M$(`-`,o),s)+(i===0?0:2*i),u=8*I$(` `,M$(` `,o),s),d=i!==0;if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};let f=[],p=[],m=[],h=[],g=e.chunks.length<=1&&!d,_=n?[]:null,v=[],y=[],b=[],x=n?[]:null,S=Array.from({length:e.len});function C(e,t,n,r,i,a,o,s,c){i!==`text`&&i!==`space`&&i!==`zero-width-break`&&(g=!1),f.push(t),p.push(n),m.push(r),h.push(i),_?.push(a),v.push(o),y.push(s),d&&b.push(c),x!==null&&x.push(e)}function w(e,t,n,c,l){let u=M$(e,o),f=d?e1(e,t):0,p=function(e,t,n){return t>1?e+(t-1)*n:e}(I$(e,u,s),f,i),m=t===`space`||t===`preserved-space`||t===`zero-width-break`?0:p,h=m===0?0:m+(f>0?i:0),g=t===`space`||t===`zero-width-break`?0:p;if(l&&c&&e.length>1){let c=`sum-graphemes`;i===0?x$(e)?c=`pair-context`:a.preferPrefixWidthsForBreakableRuns&&(c=`segment-prefixes`):c=`segment-prefixes`;let l=function(e,t,n,r,i){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===i)return t.breakableFitAdvances;t.breakableFitMode=i;let a=P$(),o=[];for(let t of a.segment(e))o.push(t.segment);if(o.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i===`sum-graphemes`){let e=[];for(let t of o){let i=M$(t,n);e.push(I$(t,i,r))}return t.breakableFitAdvances=e,t.breakableFitAdvances}if(i===`pair-context`||o.length>96){let e=[],i=null,a=0;for(let t of o){let o=I$(t,M$(t,n),r);if(i===null)e.push(o);else{let o=i+t,s=M$(o,n);e.push(I$(o,s,r)-a)}i=t,a=o}return t.breakableFitAdvances=e,t.breakableFitAdvances}let s=[],c=``,l=0;for(let e of o){c+=e;let t=I$(c,M$(c,n),r);s.push(t-l),l=t}return t.breakableFitAdvances=s,t.breakableFitAdvances}(e,u,o,s,c);C(e,p,h,g,t,n,l,l===null||r===`keep-all`?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;let t=[],n=0;for(let r of Z$().segment(e))n++,t1(r.segment)&&t.push(n);return t.length===0?null:t}(e),f);return}C(e,p,h,g,t,n,null,null,f)}for(let t=0;t=55296&&a<=56319&&i+1=56320&&t<=57343&&(o=t-56320+(a-55296<<10)+65536,s=2)}let c=SQ(o);c!==`R`&&c!==`AL`&&c!==`AN`||(r=!0);for(let e=0;e=0&&n[r]===`ET`;r--)n[r]=`EN`;for(r=e+1;r0?n[e-1]:s)===`L`?`L`:`R`;if(i===((r{let e=globalThis;if(e[r1])return e[r1];let t={configs:{},controllers:{},revision:ue(0),preparedCache:new Map,blockEstimateCache:new Map};return e[r1]=t,t})(),o1=null,s1=a1.revision;function c1(e){var t;return e&&(t=a1.configs[e])!=null?t:null}function l1(e,t){let n=Number.parseFloat(String(e??``));return Number.isFinite(n)&&n>0?n:t}function u1(e){return e?.type===`text`||e?.type===`emoji`||e?.type===`hardbreak`}function d1(e){if(!Array.isArray(e)||e.length===0)return null;let t=``;for(let n of e){if(!u1(n))return null;n.type===`text`?t+=String(n.content??``):n.type===`emoji`?t+=String(n.name??n.raw??``):n.type===`hardbreak`&&(t+=` +`)}return t.length>0?t:null}function f1(e,t,n){if(!e||!Number.isFinite(t)||t<=0||!function(){if(o1!=null)return o1;if(typeof document>`u`)return!1;try{let e=document.createElement(`canvas`);return o1=!!e.getContext?.call(e,`2d`),o1}catch{return o1=!1,!1}}())return null;try{let r=Math.round(100*t)/100,i=[n.whiteSpace??`pre-wrap`,n.font,n.lineHeight,n.wrapperOverhead,n.widthAdjustment,r,e].join(`\0`),a=a1.blockEstimateCache.get(i);if(a)return a1.blockEstimateCache.delete(i),a1.blockEstimateCache.set(i,a),{kind:`simple-text`,height:a.height,contentHeight:a.contentHeight};let o=n.whiteSpace??`pre-wrap`,s=function(e,t,n){let r=Y$(e,t);return{lineCount:r,height:r*n}}(function(e,t,n){let r=`${n}\0${t}\0${e}`,i=a1.preparedCache.get(r);if(i)return a1.preparedCache.delete(r),a1.preparedCache.set(r,i),i.prepared;let a=function(e,t,n){return function(e,t,n,r){let i=r?.wordBreak??`normal`,a=r?.letterSpacing??0;return n1(C$(e,N$(),r?.whiteSpace,i),t,!1,i,a)}(e,t,0,n)}(e,t,{whiteSpace:n});for(a1.preparedCache.set(r,{prepared:a});a1.preparedCache.size>240;){let e=a1.preparedCache.keys().next().value;if(!e)break;a1.preparedCache.delete(e)}return a}(e,n.font,o),Math.max(24,r-n.widthAdjustment),n.lineHeight),c=Math.max(n.lineHeight,s.height),l=Math.max(n.lineHeight,Math.round(c+n.wrapperOverhead));for(a1.blockEstimateCache.set(i,{height:l,contentHeight:Math.round(c)});a1.blockEstimateCache.size>4e3;){let e=a1.blockEstimateCache.keys().next().value;if(!e)break;a1.blockEstimateCache.delete(e)}return{kind:`simple-text`,height:l,contentHeight:Math.round(c)}}catch{return null}}function p1(e,t,n){if(!n||!e||!Number.isFinite(t)||t<=0)return null;if(e.type===`paragraph`){let r=d1(e.children);return r&&n.paragraph?f1(r,t,n.paragraph):null}if(e.type===`heading`){let r=Number(e.level||0),i=d1(e.children),a=n.headings[r];return i&&a?f1(i,t,a):null}if(e.type===`list_item`){let r=Array.isArray(e.children)?e.children:[];if(r.length!==1||r[0]?.type!==`paragraph`||!n.listItem)return null;let i=d1(r[0]?.children);return i?f1(i,t,n.listItem):null}if(e.type===`list`){let r=Array.isArray(e.items)?e.items:[];if(!r.length)return null;let i=Math.max(0,n.listWrapperOverhead);for(let e of r){let r=p1(e,t,n);if(!r)return null;i+=r.height}return{kind:`simple-text`,height:Math.max(1,Math.round(i)),contentHeight:Math.max(1,Math.round(i))}}return null}function m1(e){if(!e)return 1;let t=String(e).split(/\r?\n/);return Math.max(1,t.length)}function h1(e,t){let n=String(e??``);return t?n:n.replace(/\r\n$|\n$|\r$/,``)}function g1(e,t,n=0){return e.diff?RX(t??{},n)?function(e){let t=h1(e.raw);if(t){let n=t.split(/\r?\n/);return e.originalCode!=null||e.updatedCode!=null?Math.max(1,n.filter(e=>!i1.some(t=>e.startsWith(t))).length):Math.max(1,n.length)}return m1(h1(e.originalCode))+m1(h1(e.updatedCode))}(e):function(e){let t=e.originalCode,n=e.updatedCode;if(t!=null||n!=null)return Math.max(m1(h1(t)),m1(h1(n)));let r=h1(e.code).split(/\r?\n/),i=0,a=0;for(let e of r)e.startsWith(`+`)&&!e.startsWith(`+++`)?a++:e.startsWith(`-`)&&!e.startsWith(`---`)?i++:(i++,a++);return Math.max(1,i,a)}(e):m1(h1(e.code,!0===e.loading))}function _1(e){return e?`${e.fontStyle||`normal`} ${e.fontWeight||`400`} ${e.fontSize||`16px`} ${e.fontFamily||`sans-serif`}`:``}function v1(e,t,n=`pre-wrap`){if(!e||!t||typeof window>`u`)return null;let r=window.getComputedStyle(t),i=e.offsetHeight,a=l1(r.lineHeight,1.5*l1(r.fontSize,16)),o=e.getBoundingClientRect().width,s=t.getBoundingClientRect().width;return{font:_1(r),lineHeight:a,wrapperOverhead:Math.max(0,i-a),widthAdjustment:Math.max(0,o-s),whiteSpace:n}}var y1=new Set([`node`,`key`,`ref`,`ctx`,`renderNode`,`indexKey`,`__proto__`,`prototype`,`constructor`]);function b1(e,t={}){let n={},r=new Set(t.omit??[]);if(!e||typeof e!=`object`)return n;let i=Object.getOwnPropertyDescriptors(e);for(let[e,t]of Object.entries(i))y1.has(e)||r.has(e)||t.enumerable&&`value`in t&&(n[e]=t.value);return n}function x1(e,t,n,r){let i=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),a=function(e,t){return Number.isFinite(e)?Math.min(Math.max(0,e),t):0}(n,i);if(!r.isReverseFlexScrollRoot(e))return void(e.scrollTop=a);let o=Math.max(0,i-a),s=[-o,o],c=s[0],l=1/0;for(let n of s){e.scrollTop=n;let i=r.getNormalizedScrollTop(e,t,!1),o=Math.abs(i-a);ou&&(e.scrollTop=c)}function S1(e,t){let n=0,r=null,i=null,a=()=>{let t=i;i=null,r=null,t&&(n=Date.now(),e(...t))};return function(...o){let s=Date.now(),c=t-(s-n);i=o,c<=0?(r&&=(clearTimeout(r),null),n=s,i=null,e(...o)):r||=setTimeout(a,c)}}function C1(e){return e===`simple`?`simple`:!0===e||e===`true`||e===`precise`?`precise`:`off`}var w1=Symbol(`MarkstreamMathBlockMinHeightCache`);function T1(){return m(w1,null)}var E1=new Set([`text`,`inline_code`,`emoji`,`footnote_reference`]),D1=new Set([`strong`,`emphasis`,`strikethrough`,`highlight`,`insert`,`subscript`,`superscript`,`link`]);function O1(e){let t=Number(e);return!Number.isFinite(t)||t<=0?-1:Math.round(t/32)}function k1(e,t,n,r=22){let i=String(e??``);if(!i)return n;let a=Math.max(18,Math.floor(Math.max(320,t)/8)),o=i.split(/\r?\n/).length,s=Math.ceil(i.length/a);return Math.max(n,Math.ceil(Math.max(1,o,s)*r+12))}function A1(e){if(!e||typeof e!=`object`)return!1;let t=e,n=String(t.type??``);if(E1.has(n))return!0;if(!D1.has(n))return!1;let r=t.children;return!Array.isArray(r)||!r.length||r.every(A1)}function j1(e){if(!e||typeof e!=`object`)return``;let t=e,n=String(t.type??``);if(n===`text`)return String(t.content??t.raw??``);if(n===`inline_code`)return String(t.code??t.content??t.raw??``);if(n===`emoji`)return String(t.name??t.raw??``);if(typeof t.text==`string`)return t.text;let r=[];for(let e of[`children`,`items`,`cells`,`rows`]){let n=t[e];if(Array.isArray(n)){let e=n.map(j1).filter(Boolean).join(` `);e&&r.push(e)}}return r.join(` `).replace(/\s+/g,` `).trim()}function M1(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`inline_code`||[`children`,`items`,`cells`,`rows`].some(e=>{let n=t[e];return Array.isArray(n)&&n.some(M1)})}function N1(e,t){if(!e)return 30;let n=Math.max(18,Math.floor(Math.max(320,t)/8)),r=e.split(/\r?\n/).length,i=Math.ceil(e.length/n);return 30+26*Math.max(0,Math.max(1,r,i)-1)}function P1(e,t){if(!e||typeof e!=`object`)return 32;let n=e,r=String(n.type??``),i=Number.isFinite(t)&&t>0?t:640;switch(r){case`heading`:return function(e){let t=Number(e.level??e.depth);return t>=4?20:t===3?30:t===2?32:44}(n);case`paragraph`:return function(e,t){let n=String(e??``);if(!n)return 28;let r=Math.max(18,Math.floor(Math.max(320,t)/8)),i=n.split(/\r?\n/).length,a=Math.ceil(n.length/r);return Math.max(1,i,a)<=1?28:k1(n,t,34)}(String(n.raw??n.content??``),i);case`list`:return function(e,t){let n=Array.isArray(e.items)?e.items:[];if(!n.length)return 48;let r=Math.max(48,30*n.length+12),i=12;for(let e of n)i+=N1(j1(e)||String(e.raw??``),t);let a=Math.max(0,i-r);if(n.length>20){let e=Math.round(2.4*n.length);return Math.round(r+Math.max(e,Math.min(a,3*n.length)))}if(a<=0)return r;let o=n.length>8?8*n.length:a;return Math.round(r+Math.min(a,o))}(n,i);case`list_item`:return k1(String(n.raw??n.content??``),i,34);case`blockquote`:return k1(String(n.raw??n.content??``),i,56);case`table`:return function(e,t){let n=[...e.header?[e.header]:[],...Array.isArray(e.rows)?e.rows:[]];if(!n.length){let t=Array.isArray(e.children)?e.children.length:3;return Math.max(120,38*t+48)}return Math.max(120,Math.round(4+n.reduce((e,n)=>e+function(e,t){let n=Math.max(1,e.length),r=Math.max(80,(t-32)/n),i=Math.max(10,Math.floor(r/8)),a=Math.max(1,...e.map(e=>{let t=j1(e)||String(e?.raw??``);return Math.ceil(t.length/i)||1}));return 54+34*Math.max(0,a-1)+(n<=3&&e.some(M1)?14:0)}(function(e){var t;return Array.isArray(e?.cells)&&(t=e.cells)!=null?t:[]}(n),t),0)))}(n,i);case`code_block`:{let e=String(n.language??``).trim().toLowerCase(),t=String(n.code??n.raw??``);return e===`mermaid`?gJ(pJ(t)):e===`infographic`?_J(mJ(t)):k1(t,i,96,20)}case`math_block`:return 72;case`image`:return 220;case`admonition`:case`vmr_container`:case`html_block`:return function(e,t){let n=e.match(/^\s*]*)>/i);return n&&!/(?:^|\s)open(?:\s|=|$)/i.test(n[1]??``)?k1((e.match(/]*>([\s\S]*?)<\/summary>/i)?.[1])?.replace(/<[^>]*>/g,``).trim()||`Details`,t,28,28):k1(e,t,96)}(String(n.raw??n.content??``),i);case`thematic_break`:return 24;default:return k1(String(n.raw??n.content??``),i,40)}}function F1(e,t,n){return Math.min(Math.max(e,t),n)}var I1=[`total`,`cacheHits`,`appendHits`,`tailHits`,`fullParses`,`chunkedParses`],L1=[`tokenCloneMs`,`processTokensInputTokens`,`processTokensReusedTopLevelNodes`,`processTokensMs`,`parseMarkdownToStructureTotalMs`],R1=new Set([`attrs`,`data`,`items`,`header`,`payload`,`props`,`rows`,`cells`,`term`,`definition`,`sourceMap`]),z1=[`raw`,`content`,`code`,`originalCode`,`updatedCode`],B1=new WeakMap,V1=new WeakMap,H1=1;function U1(){return typeof performance<`u`?performance.now():Date.now()}function W1(e){let t=e.stream;return t&&typeof t.stats==`function`?t.stats():null}function G1(e){if(typeof e!=`object`&&typeof e!=`function`||e===null)return``;let t=e,n=B1.get(t);return n||(n=H1++,B1.set(t,n)),String(n)}function K1(e,t,n,r={}){let i=!1!==r.includeFinal,a={md:G1(t),customMarkdownIt:G1(n),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:e.customHtmlTags??[],includeSourceMap:!0===e.includeSourceMap,streamParse:e.streamParse??`auto`,validateLink:G1(e.validateLink),preTransformTokens:G1(e.preTransformTokens),postTransformTokens:G1(e.postTransformTokens),postTransformNodes:G1(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function q1(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===10;)--t;let n=e.lastIndexOf(` +`,t-1)+1;return e.slice(n,t).trim()}function J1(e){let t=Y1(e);return t.length>=2&&t.every(e=>{let t=e.trim();return t.length>=1&&t.replace(/^:/,``).replace(/:$/,``).split(``).every(e=>e===`-`)})}function Y1(e){return e.includes(`|`)?e.replace(/^\|/,``).replace(/\|$/,``).split(`|`):[]}function X1(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Z1(e){let t=String(e??``);return`${t.length}:${X1(t)}`}function Q1(e,t=new WeakMap,n=0){if(e==null||typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`string`)return`s:${function(e){return e.length<=8192?Z1(e):`${e.length}:${X1(e.slice(0,8192))}:truncated`}(e)}`;if(typeof e==`function`)return`fn:${G1(e)}`;if(typeof e!=`object`)return typeof e;let r=e,i=t.get(r);if(i)return`cycle:${i}`;if(n>=6)return`object:${G1(r)}`;let a=G1(r);if(t.set(r,a),Array.isArray(e)){let r=e.slice(0,200);return`a:${e.length}:${r.map(e=>Q1(e,t,n+1)).join(`,`)}`}if(typeof e==`object`){let r=e,i=Object.keys(r).sort(),a=i.slice(0,80);return`o:${i.length}:${a.sort().map(e=>`${e}:${Q1(r[e],t,n+1)}`).join(`;`)}`}return typeof e}function $1(e){return typeof e==`object`&&!!e&&typeof e.type==`string`&&typeof e.raw==`string`}function e0(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>$1(e)?r0(e,t,n+1):e0(e,t,n+1)).join(`,`)}`:$1(e)?r0(e,t,n):Q1(e,t,n)}function t0(e,t,n){return Object.keys(e).sort().filter(e=>e!==`children`&&!z1.includes(e)).map(r=>{let i=e[r];return typeof i==`string`?`${r}=s:${Z1(i)}`:typeof i==`number`||typeof i==`boolean`||i==null?`${r}=${String(i)}`:typeof i==`function`?`${r}=fn:${G1(i)}`:R1.has(r)&&(Array.isArray(i)||typeof i==`object`)?`${r}=${e0(i,t,n+1)}`:i&&typeof i==`object`?`${r}=object:${G1(i)}`:``}).filter(Boolean).join(`;`)}function n0(e){return z1.map(t=>{let n=e[t];return typeof n==`string`?`${t}=s:${Z1(n)}`:``}).filter(Boolean).join(`;`)}function r0(e,t=new WeakMap,n=0){let r=V1.get(e);if(r)return r;let i=e,a=t.get(i);if(a)return`node-cycle:${a}`;if(n>=6)return`node:${e.type}:${G1(i)}`;let o=G1(i);t.set(i,o);let s=function(e,t,n){let r=e,i=Array.isArray(r.children)?r.children:[],a=i.length?i.slice(0,200).map(e=>r0(e,t,n+1)).join(`|`):``;return[e.type,n0(r),t0(r,t,n),i.length,a].join(`:`)}(e,t,n);return V1.set(i,s),s}function i0(e,t){return r0(e)===r0(t)}function a0(e,t,n){let r=U1(),i=t===`stabilizeSignatureMs`?`stabilizeSignatureCallCount`:`primeSignatureCallCount`;try{return n()}finally{e[t]+=U1()-r,e[i]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function o0(e,t,n){return a0(t,n,()=>r0(e))}function s0(e,t,n){return o0(e,n,`stabilizeSignatureMs`)===o0(t,n,`stabilizeSignatureMs`)}function c0(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function l0(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function u0(e){return!0===e.__markstreamHasCustomParserExtensions||function(e){return Number(e.__markstreamRegisteredPluginCount??0)>0}(e)}function d0(e,t){return e.length===t.length&&e===t}function f0(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;let r=e,i=t,a=Object.keys(r).filter(e=>e!==`type`&&e!==`children`).sort(),o=Object.keys(i).filter(e=>e!==`type`&&e!==`children`).sort();if(a.length!==o.length)return!1;for(let e=0;e{r=f0(e,t)}),r??s0(e,t,n)}function h0(e,t){let n={};for(let r of I1){let i=e[r],a=t?.[r];typeof i==`number`&&(n[r]=i-(typeof a==`number`?a:0))}return n}function g0(e,n){let r=JK(n.instanceMsgId),i=new Map,a=n.smoothStreamingEnabled??L(()=>!1),o=R(n.renderContent.value),c=[],l=``,u=``,d=``,f=!1,p=function(){let e=``,t=0,n=!1,r=!1,i=!1,a=!1;function o(){e=``,t=0,n=!1,r=!1,i=!1,a=!1}function s(e){let o=!1;for(let s=0;s{if(!t||!n.startsWith(t)||n.length<=t.length)return o(),[!0,0];let r=0;e!==t&&(o(),s(t),r=t.length);let i=n.slice(t.length),a=s(i);return e=n,[a,r+i.length]}}(),m,h=0,_=0,v=U1(),y=-1,b=0;function x(e){y=Number.isInteger(e)?e:0,b+=1}function S(){m&&=(clearTimeout(m),void 0)}function C(){S();let e=n.renderContent.value;o.value!==e&&(o.value=e),v=U1()}s([n.renderContent,n.effectiveFinal,a],([t,n,r])=>{o.value!==t&&(!r||n||function(e,t){if(!e&&t||t.length<=80||t.length\s*|`{3,}|~{3,})/.test(n))||n.endsWith(` -`)&&!function(e){let t=H1(e);if(U1(t))return!1;let n=W1(t);return n.length>=2&&n.some(e=>e.trim())}(t))}(o.value,t)?C():function(){if(_+=1,m)return;let t=Math.max(0,function(e){let t=e.parseCoalesceMs;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:80}(e)-(R1()-v));t<=0?C():m=setTimeout(C,t)}())},{flush:`sync`,immediate:!0}),t(S);let w=L(()=>{var t;return vL(e.customHtmlTags,e.parseOptions?.customHtmlTags,(t=n.customComponentsMap?.value??{},Object.entries(t).map(([e,t])=>{let n=gL(e);return t==null||!n||fY(n)||BI.has(n)||UI.has(n)?``:n}).filter(Boolean)))}),T=L(()=>{let{key:e,tags:t}=yL(w.value);if(!e)return r;let a=i.get(e);if(a)return a;let o=UK(n.instanceMsgId,{customHtmlTags:t});return i.set(e,o),o}),E=L(()=>{let t=T.value;if(!e.customMarkdownIt)return t;let n=e.customMarkdownIt(t);return t.__markstreamHasCustomParserExtensions=!0,n.__markstreamHasCustomParserExtensions=!0,n}),D=L(()=>{var t;let r=e.parseOptions??{},i=n.effectiveFinal.value,a=w.value,o=i!=null,s=a.length>0;return o||s||r.streamParse==null?rY(rY(iY(rY({},r),{streamParse:(t=r.streamParse)==null||t}),o?{final:i}:{}),s?{customHtmlTags:a}:{}):r}),O=L(()=>new Set((D.value.customHtmlTags??[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))),k=L(()=>V1(D.value,E.value,e.customMarkdownIt,{includeFinal:!0})),A=L(()=>V1(D.value,E.value,e.customMarkdownIt,{includeFinal:!1}));return s([k,A],([e,t],[n,r])=>{n&&(e===n&&t===r||(C(),t!==r&&(c=[],d=``)))},{flush:`sync`}),{effectiveCustomHtmlTags:w,effectiveCustomHtmlTagsSet:O,mdBase:T,mdInstance:E,mergedParseOptions:D,getParsedNodesDirtyStartIndex:()=>y,getParsedNodesRevision:()=>b,parsedNodes:L(()=>{if(e.nodes?.length)return c=[],d=``,x(0),g(e.nodes.slice());let t=o.value;if(!t)return c=[],d=``,x(-1),[];let r=n.debugPerformanceEnabled.value,i=r?R1():0,a=E.value,s=k.value,m=A.value;l&&s!==l&&function(e){var t,n;(n=(t=e.stream)?.reset)==null||n.call(t)}(a),u&&m!==u&&(c=[],d=``);let v=Object.keys(n.customComponentsMap?.value??{}).length>0||typeof D.value.postTransformNodes==`function`;v!==f&&(c=[],d=``);let b=!v&&c.length>0&&t.startsWith(d)&&m===u,S=r?z1(a):null,C=r?{}:void 0,w=a0(a),T=!w&&!v,O=RG(t,a,rY(rY(iY(rY({},D.value),{__reuseStableTopLevelNodes:T}),w?{__disableStreamParse:!0}:{}),C?{__timing:C}:{})),j=r?R1():0,M=r?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0,N,ee=r?r0(O.length):void 0,P=0,F=0,I=0;if(b){let n=r?R1():0,[i,o]=function(e){let[t,n]=e.scanGlobalReferenceAppend(e.previousContent,e.content),r=e.parseOptions;return[e.previousDirtyStartIndex>0&&!0!==r.final&&!e.customMarkdownIt&&!a0(e.md)&&!t&&typeof r.preTransformTokens!=`function`&&typeof r.postTransformTokens!=`function`&&typeof r.postTransformNodes!=`function`&&(r.customHtmlTags?.length??0)===0?e.previousDirtyStartIndex:0,n]}({content:t,previousContent:d,previousDirtyStartIndex:y,parseOptions:D.value,customMarkdownIt:e.customMarkdownIt,md:a,scanGlobalReferenceAppend:p});I=o;let s=i<=0;if(M){let e=function(e,t,n,r={}){if(!t.length)return{nodes:e,metrics:r0(e.length)};let i=r.scanStartIndex??0,a=!1!==r.reuseDirtyTail,o=function(e,t,n,r=0){let i=Math.min(e.length,t.length);for(let a=Math.min(i,Math.max(0,r));aQ1(e[r]))}(N,M,F):function(e,t=0){for(let n=Math.max(0,t);n(S?.total??0);n.logPerf(r?`parse(stream)`:`parse(sync)`,rY(rY(rY({rendererId:n.instanceMsgId,ms:Math.round(R1()-i),nodes:N.length,contentLength:t.length,parseCommitCount:h,parseCoalescedCount:_,nodeReuseMs:te,referenceDefinitionScanChars:I,signatureMs:M?.signatureMs??0,stabilizeSignatureMs:M?.stabilizeSignatureMs??0,primeSignatureMs:M?.primeSignatureMs??0,signatureCallCount:M?.signatureCallCount??0,stabilizeSignatureCallCount:M?.stabilizeSignatureCallCount??0,primeSignatureCallCount:M?.primeSignatureCallCount??0,stabilizeMs:P},ee??{}),C?Object.fromEntries(M1.map(e=>[e,C[e]??0])):{}),e?{streamMode:e.lastMode,streamDelta:u0(e,S),streamStats:e}:{}))}return g(N)})}}function f0(e){let{isClient:t}=e,n=R(new Set),r=new Map,i=new Map,a=new Map;function o(e){if(!t)return;let n=a.get(e);n!=null&&(window.clearTimeout(n),a.delete(e))}function s(){if(t)for(let e of a.values())window.clearTimeout(e);a.clear()}function c(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:r,nodeVisibilityWatchStops:i,nodeVisibilityFallbackTimers:a,clearVisibilityFallback:o,clearAllVisibilityFallbacks:s,markNodeVisible:function(t,r=!0){var i;r&&o(t),function(t,r){if((a=(i=e.shouldTrackVisibleNodeIndices)?.call(e))!=null&&!a)return;var i,a;let o=n.value,s=o.has(t);if(r){if(s)return;let e=new Set(o);e.add(t),n.value=e;return}if(!s)return;let c=new Set(o);c.delete(t),n.value=c}(t,r),r&&((i=e.onNodeMarkedVisible)==null||i.call(e,t))},resetNodeVisibleState:c,cleanupNodeVisibility:function(t){var s;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(let[e,n]of i.entries())e{let e=a.getSnapshot();n.value=e.source,r.value=e.visible,i.value=e.done},s=a.subscribe(o);o();let c=L(()=>Math.max(0,n.value.length-r.value.length)),l=L(()=>c.value===0),u=L(()=>i.value&&l.value);return C()&&t(()=>{s(),a.destroy()}),{source:n,visible:r,done:i,final:u,caughtUp:l,pendingChars:c,enqueue:e=>a.enqueue(e),finish:e=>a.finish(e),flush:()=>a.flush(),reset:e=>a.reset(e),pause:()=>a.pause(),resume:()=>a.resume()}}var m0={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},h0=/auto|scroll|overlay/i;function g0(e){if(!e)return!1;let t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();return h0.test(t)||h0.test(n)}function _0(e){let t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}var v0={class:`m-0 p-0`},y0=[`data-probe`],b0=yY(G(iY(rY({},{name:`HeightEstimationProbes`}),{__name:`HeightEstimationProbes`,props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){let t=e;function n(e){return t.headingNodes?.[e]??null}return(t,r)=>(c(),W(`div`,{class:`height-estimation-probes`,style:ae({width:`${e.width}px`}),"aria-hidden":`true`},[F(`div`,{ref:t=>e.setParagraphWrapper(t),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`paragraph`},[v(z(tQ),{node:e.paragraphNode,"index-key":`probe-paragraph`},null,8,[`node`])],2),F(`div`,{ref:t=>e.setListItemWrapper(t),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`list-item`},[F(`ul`,v0,[v(z(qZ),{node:e.listItemNode,"index-key":`probe-list-item`},null,8,[`node`])])],2),F(`div`,{ref:t=>e.setListWrapper(t),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`list`},[v(z(JZ),{node:e.listNode,"index-key":`probe-list`},null,8,[`node`])],2),(c(),W(M,null,_(6,t=>F(`div`,{key:`probe-heading-${t}`,ref_for:!0,ref:n=>e.setHeadingWrapper(t,n),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${t}`},[v(z(HZ),{node:n(t),"index-key":`probe-heading-${t}`},null,8,[`node`,`index-key`])],10,y0)),64))],4))}})),[[`__scopeId`,`data-v-3e0766e2`]]),x0=G({name:`InfographicBlockNodeLoading`,props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){let t=L(()=>fJ(oJ(e.estimatedPreviewHeightPx)??lJ(String(e.node.code??``))));return()=>a(`div`,{class:`infographic-block-container rounded-lg border overflow-hidden`,style:{margin:`var(--ms-flow-diagram-y) 0`,background:`var(--diagram-bg)`,borderColor:`var(--diagram-border)`,color:`hsl(var(--ms-foreground))`},"data-markstream-infographic":`1`,"data-markstream-mode":`pending`},[e.showHeader?a(`div`,{class:`infographic-block-header flex justify-between items-center border-b`,style:{padding:`var(--ms-inset-panel-y) var(--ms-inset-panel-x)`,background:`var(--diagram-header-bg)`,borderColor:`var(--diagram-border)`,minHeight:`calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)`}},[a(`div`,{class:`flex items-center gap-x-2 overflow-hidden`},[a(`span`,{class:`icon-slot action-icon shrink-0`,style:{display:`inline-flex`,width:`var(--ms-action-btn-icon)`,height:`var(--ms-action-btn-icon)`}}),a(`span`,{class:`infographic-label font-medium font-mono truncate`,style:{fontSize:`var(--ms-text-label)`,color:`hsl(var(--ms-muted-foreground))`}},`Infographic`)]),a(`div`,{class:`infographic-header-actions flex items-center opacity-0 pointer-events-none`,style:{gap:`var(--ms-gap-header-actions)`},"aria-hidden":`true`},Array.from({length:4},()=>a(`span`,{class:`infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded`,style:{width:`calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))`,height:`calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))`}})))]):null,a(`div`,{class:`infographic-preview relative overflow-hidden block`,style:{height:`${t.value}px`,minHeight:`var(--ms-size-diagram-min-height)`,background:`var(--diagram-bg)`}},[a(`pre`,{class:`infographic-pending-source text-sm font-mono whitespace-pre-wrap`,style:{position:`absolute`,inset:`0`,zIndex:`1`,margin:`0`,padding:`var(--ms-inset-panel-body)`,overflow:`auto`,textAlign:`left`}},String(e.node.code??``)),a(`div`,{class:`absolute inset-0`},[a(`div`,{class:`w-full text-center flex items-center justify-center min-h-full`})])])])}}),S0=G({name:`MermaidBlockNodeLoading`,props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){let t=L(()=>dJ(oJ(e.estimatedPreviewHeightPx)??cJ(String(e.node.code??``))));return()=>a(`div`,{class:`mermaid-block-container rounded-lg border overflow-hidden`,style:{margin:`var(--ms-flow-diagram-y) 0`,borderColor:`var(--diagram-border)`},"data-markstream-mermaid":`1`,"data-markstream-mode":`pending`},[e.showHeader?a(`div`,{class:`mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]`,style:{background:`var(--diagram-header-bg)`,borderColor:`var(--diagram-border)`}},[a(`div`,{class:`flex items-center gap-x-2 overflow-hidden`},[a(`span`,{class:`mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate`,style:{color:`var(--code-action-fg)`}},`Mermaid`)]),a(`div`,{class:`mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none`,"aria-hidden":`true`},Array.from({length:4},()=>a(`span`,{class:`mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded`},[a(`span`,{class:`action-icon block`})])))]):null,a(`div`,{class:`mermaid-preview-area relative overflow-hidden block`,style:{height:`${t.value}px`,minHeight:`var(--ms-size-diagram-min-height)`,background:`var(--diagram-bg)`}},[a(`pre`,{class:`mermaid-source-code text-sm font-mono whitespace-pre-wrap`,style:{position:`absolute`,inset:`0`,margin:`0`,padding:`var(--ms-inset-panel-body)`,overflow:`auto`,textAlign:`left`}},String(e.node.code??``)),a(`div`,{class:`_mermaid w-full text-center flex items-center justify-center min-h-full`,style:{fontFamily:`inherit`,contentVisibility:`auto`,contain:`content`,containIntrinsicSize:`var(--ms-size-diagram-min-height) 240px`}})])])}}),C0={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:`auto`},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:`auto`},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:`auto`}};function w0(e){if(e==null)return``;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var T0=[`data-custom-id`],E0=[`data-node-index`,`data-node-type`],D0=`typewriter-simple-cursor-target`,O0=yY(G(iY(rY({},{name:`NodeRenderer`}),{__name:`NodeRenderer`,props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:`auto`},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:[`copy`,`copy-code`,`handleArtifactClick`,`click`,`mouseover`,`mouseout`,`virtual-state-change`,`height-change`,`render-settled`,`render-final`,`anchor-change`],setup(e,{expose:t,emit:a}){let o=e,l=a;function f(e){if(!(typeof Event<`u`&&e instanceof Event))return typeof e==`string`&&l(`copy-code`,e),void l(`copy`,e)}let h=y(),v=m(`markstreamNestedRendererProps`,void 0);function S(e){let t=h?.vnode.props;return!!t&&(Object.prototype.hasOwnProperty.call(t,e)||Object.prototype.hasOwnProperty.call(t,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}function C(e){let t=o[e];return S(e)?t:v?.value?.[e]??t}let w=L(()=>{return(e=C(`mode`))===`chat`||e===`minimal`||e===`docs`?e:`docs`;var e}),T=L(()=>v1(C(`typewriter`))),D=L(()=>T.value!==`off`),k=L(()=>C(`domMode`)===`minimal`?`minimal`:`full`),A=L(()=>{return!0===(e={mode:w.value,codeRenderer:C(`codeRenderer`),renderCodeBlocksAsPre:C(`renderCodeBlocksAsPre`)}).renderCodeBlocksAsPre?`pre`:e.codeRenderer===`pre`||e.codeRenderer===`shiki`||e.codeRenderer===`monaco`?e.codeRenderer:!1===e.renderCodeBlocksAsPre||e.mode===`docs`?`monaco`:`pre`;var e}),j=L(()=>C0[w.value]),ee=L(()=>C(`showTooltips`)??j.value.showTooltips),F=L(()=>C(`fade`)??j.value.fade),I=L(()=>C(`batchRendering`)??j.value.batchRendering),te=L(()=>C(`initialRenderBatchSize`)??j.value.initialRenderBatchSize),ie=L(()=>C(`renderBatchSize`)??j.value.renderBatchSize),se=L(()=>C(`renderBatchDelay`)??j.value.renderBatchDelay),ce=L(()=>C(`renderBatchBudgetMs`)??j.value.renderBatchBudgetMs),le=L(()=>C(`renderBatchIdleTimeoutMs`)??j.value.renderBatchIdleTimeoutMs),de=L(()=>C(`deferNodesUntilVisible`)??j.value.deferNodesUntilVisible),fe=L(()=>C(`maxLiveNodes`)??j.value.maxLiveNodes),H=L(()=>C(`liveNodeBuffer`)??j.value.liveNodeBuffer),U=L(()=>C(`nodeVirtual`)??j.value.nodeVirtual),G={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return C(`parseOptions`)},get customMarkdownIt(){return C(`customMarkdownIt`)},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return C(`customHtmlTags`)},get mode(){return C(`mode`)},get domMode(){return k.value},get htmlPolicy(){return C(`htmlPolicy`)},get viewportPriority(){return C(`viewportPriority`)},get viewportPriorityOptions(){return C(`viewportPriorityOptions`)},get codeBlockStream(){return C(`codeBlockStream`)},get codeBlockDarkTheme(){return C(`codeBlockDarkTheme`)},get codeBlockLightTheme(){return C(`codeBlockLightTheme`)},get codeBlockMonacoOptions(){return C(`codeBlockMonacoOptions`)},get codeRenderer(){return C(`codeRenderer`)},get renderCodeBlocksAsPre(){return C(`renderCodeBlocksAsPre`)},get codeBlockMinWidth(){return C(`codeBlockMinWidth`)},get codeBlockMaxWidth(){return C(`codeBlockMaxWidth`)},get codeBlockProps(){return C(`codeBlockProps`)},get mermaidProps(){return C(`mermaidProps`)},get d2Props(){return C(`d2Props`)},get infographicProps(){return C(`infographicProps`)},get showTooltips(){return ee.value},get themes(){return C(`themes`)},get langs(){return C(`langs`)},get isDark(){return C(`isDark`)},get customId(){return C(`customId`)},get indexKey(){return o.indexKey},get typewriter(){return C(`typewriter`)},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return C(`smoothStreamingOptions`)},get parseCoalesceMs(){return C(`parseCoalesceMs`)},get fade(){return F.value},get batchRendering(){return I.value},get initialRenderBatchSize(){return te.value},get renderBatchSize(){return ie.value},get renderBatchDelay(){return se.value},get renderBatchBudgetMs(){return ce.value},get renderBatchIdleTimeoutMs(){return le.value},get deferNodesUntilVisible(){return de.value},get maxLiveNodes(){return fe.value},get liveNodeBuffer(){return H.value},get nodeVirtual(){return U.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function K(e){l(`height-change`,e)}function pe(e){l(`virtual-state-change`,e)}function me(e){l(`anchor-change`,e)}let ge=R(),_e=R(null),ve=R(null),ye=R(null),be=N({1:null,2:null,3:null,4:null,5:null,6:null}),xe=R(!1),Se=new Map,Ce=R(0),we=R(0),Te=R({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Ee(e,t){return typeof e==`string`&&e.trim()||t}function De(e){let t=Number(e);return Number.isFinite(t)&&t>0?Math.max(1,Math.trunc(t)):640}let Oe=L(()=>{let e=G.viewportPriorityOptions??{},t=Ee(e.rootMargin,hX);return{rootMargin:t,heavyBlockMargin:Ee(e.heavyBlockMargin,t),maxTargets:De(e.maxTargets)}}),ke=L(()=>Oe.value.rootMargin??hX),Ae=L(()=>Oe.value.maxTargets??640);function je(){if(!0!==o.virtualScroll?.enabled)return null;let e=o.virtualScroll?.scrollRoot;return Me(typeof e==`function`?e():e)}function Me(e){return e?typeof HTMLElement<`u`&&e instanceof HTMLElement?e:typeof e==`object`&&`value`in e?Me(e.value):typeof e==`object`&&`$el`in e?Me(e.$el):null:null}d(fX,Oe);let{isClient:q,renderAsFragment:Ne,debugPerformanceEnabled:Pe,resolvedShowTooltips:Fe,resolvedHtmlPolicy:Ie,inheritedSmoothStreaming:Le,ownsTypewriterCursor:Re}=function(e){let t=typeof window<`u`,n=b(),r=m(`markstreamHtmlPolicy`,void 0),i=m(`markstreamTypewriterCursor`,void 0),a=m(`markstreamSmoothStreaming`,void 0);return{isClient:t,renderAsFragment:L(()=>!0===e.renderAsFragment),debugPerformanceEnabled:L(()=>!!(e.debugPerformance&&t&&typeof console<`u`)),resolvedShowTooltips:L(()=>{if(typeof e.showTooltips==`boolean`)return e.showTooltips;let t=n.showTooltips??n[`show-tooltips`];return t===``||!0===t||t===`true`||!1!==t&&t!==`false`&&void 0}),resolvedHtmlPolicy:L(()=>e.htmlPolicy??r?.value??`safe`),inheritedSmoothStreaming:a,inheritedTypewriterCursor:i,ownsTypewriterCursor:L(()=>!0!==i?.value)}}(G),{resolveViewportRoot:ze,resolveScrollContainer:Be,isReverseFlexScrollRoot:Ve,getNormalizedScrollTop:He,getOffsetTopWithinRoot:Ue}=function(e,t){function n(){return t.scrollRoot?.call(t)??null}function r(t){if(typeof window>`u`)return null;let r=n();if(r)return r;let i=t??e.value;if(!i)return null;let a=i.ownerDocument||document,o=a.scrollingElement||a.documentElement,s=i;for(;s&&s!==a.body&&s!==o;){if(g0(window.getComputedStyle(s))&&_0(s))return s;s=s.parentElement}return null}function i(e){if(!t.isClient)return!1;try{let t=window.getComputedStyle(e);return!!(t.display||``).toLowerCase().includes(`flex`)&&(t.flexDirection||``).toLowerCase().endsWith(`reverse`)}catch{return!1}}function a(e,t,n){if(n)return o(t);let r=e.scrollTop;if(!i(e))return r;let a=r<0?-r:r;return Math.max(0,(e.scrollHeight??0)-(e.clientHeight??0))-a}function o(e){let t=Number(e.scrollingElement?.scrollTop),n=Number(e.documentElement?.scrollTop??0),r=Number(e.body?.scrollTop??0);return Math.max(0,Number.isFinite(t)?t:0,Number.isFinite(n)?n:0,Number.isFinite(r)?r:0)}return{resolveViewportRoot:r,resolveScrollContainer:function(t){let i=n();if(i)return i;let a=r(t??e.value??null);if(a)return a;let o=t?.ownerDocument??e.value?.ownerDocument??(typeof document<`u`?document:null);return o?.scrollingElement||o?.documentElement||null},isReverseFlexScrollRoot:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:function(e,t){let n=t.ownerDocument||e.ownerDocument||document;if(function(e,t){return e===t.documentElement||e===t.body||e===t.scrollingElement}(t,n))return e.getBoundingClientRect().top+o(n);let r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=a(t,n,!1);return i.top-r.top+s}}}(ge,{isClient:q,scrollRoot:je});d(`markstreamShowTooltips`,Fe),d(`markstreamHtmlPolicy`,Ie),d(`markstreamTypewriter`,D),d(`markstreamFade`,L(()=>!1!==G.fade)),d(`markstreamTypewriterCursor`,L(()=>!0)),d(`markstreamTextStreamState`,Se),d(`markstreamStreamVersion`,Ce),d(`markstreamParseOptions`,L(()=>G.parseOptions)),d(`markstreamCustomMarkdownIt`,L(()=>G.customMarkdownIt));let{smoothStreamingEnabled:We,renderContent:Ge,requestedFinal:Ke,effectiveFinal:qe}=function(e,t){let n=p0(rY(rY({},m0),e.smoothStreamingOptions)),r=L(()=>!1!==e.smoothStreaming&&!e.nodes?.length&&(!0===e.smoothStreaming||!t.inheritedSmoothStreaming?.value)&&(!0===e.smoothStreaming||v1(e.typewriter)!==`off`||(e.maxLiveNodes??0)<=0)),i=R(!t.isClient||!0===e.smoothStreaming);p(()=>{i.value=!0});let a=L(()=>i.value&&r.value),o=L(()=>a.value?n.visible.value:e.content??``),c=L(()=>{let t=e.parseOptions??{};return e.final??t.final}),l=L(()=>{let e=c.value;return a.value&&e!=null?!!e&&n.caughtUp.value:e}),u=0,d=!1;function f(){u=0,d=!1}return s([()=>e.content,()=>e.nodes,a,c],([e,t,r,i])=>{if(t?.length)return f(),void n.reset(``);let a=e??``;if(!r)return f(),n.reset(a),void(i&&n.finish({flush:!0}));let o=n.source.value;if(a){if(a!==o)if(a.startsWith(o)){let e=a.slice(o.length),t=n.pendingChars.value;e.length<=8?(u++,d||u>=2&&t<=8?(d=!0,n.reset(a)):n.enqueue(e)):(f(),n.enqueue(e))}else f(),n.reset(a)}else f(),n.reset(``);i&&n.finish()},{immediate:!0}),{smoothStream:n,smoothStreamingEligible:r,smoothStreamingEnabled:a,renderContent:o,requestedFinal:c,effectiveFinal:l}}(G,{isClient:q,inheritedSmoothStreaming:Le}),Je=!0===Ke.value;d(`markstreamSmoothStreaming`,We);let Ye=R(!1),Xe=R(!1),Ze=R(!1),Qe=``,$e=!1,et=null;function tt(){q&&et!=null&&(window.clearTimeout(et),et=null)}function nt(){Ye.value=!1,tt()}function rt(e,t){if(!Pe.value)return;let n=function(){if(!Pe.value)return null;let e=ct(it),t=ct(at),n=Math.max(st,t);if(e<=0&&n<=0)return null;let r={total:e,maxPerFrame:n,byLabel:(i=it,Object.fromEntries(Array.from(i.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))))};var i;return it.clear(),at.clear(),st=0,r}();console.info(`[markstream-vue][perf] ${e}`,n?iY(rY({},t),{layoutReads:n}):t)}s([()=>G.indexKey,()=>G.customId],()=>{nt(),Xe.value=!1,Ze.value=!o.nodes?.length&&!0!==Ke.value&&!!o.content,Qe=Ge.value??``,$e=Qe.length>0},{flush:`sync`}),s([()=>o.content,()=>o.nodes,Ke],([e,t,n])=>{!t?.length&&!0!==n&&e&&(Ze.value=!0)},{flush:`sync`,immediate:!0}),s([Ge,()=>o.nodes,Ke],([e,t,n])=>{let r=e??``;t?.length||!0===n?(nt(),Xe.value=!1,Qe=r,$e=!0):(r.length>0&&(Ze.value=!0),$e?(Qe&&r.length>Qe.length&&r.startsWith(Qe)?(Ye.value=!0,Xe.value=!0,q&&(tt(),et=window.setTimeout(()=>{var e;et=null,!0===qe.value||(e=o.nodes)!=null&&e.length||(po(),Ye.value=!1,ho())},1200))):(r.length`u`)return null;let e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;let t={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=t,t}();t&&(t.total=Number(t.total||0)+1,t.byLabel[e]=Number(t.byLabel[e]||0)+1,t.currentFrameTotal=Number(t.currentFrameTotal||0)+1,t.frameScheduled||(t.frameScheduled=!0,typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>ut(t)):typeof queueMicrotask==`function`?queueMicrotask(()=>ut(t)):setTimeout(()=>ut(t),0)))}(e),ot||(ot=!0,q&&typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(lt):typeof queueMicrotask==`function`?queueMicrotask(lt):setTimeout(lt,0)))}function ft(e,t){return dt(e),t()}let pt=G.customId?`renderer-${G.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,mt=function(e){let t=new Map;return{scope:e,cache:t,clear:()=>t.clear()}}(pt),ht=pt;d(y1,mt);let gt=hY(()=>G.customId),{effectiveCustomHtmlTagsSet:_t,mergedParseOptions:vt,parsedNodes:yt,getParsedNodesDirtyStartIndex:bt,getParsedNodesRevision:xt}=d0(G,{instanceMsgId:pt,renderContent:Ge,effectiveFinal:qe,smoothStreamingEnabled:We,debugPerformanceEnabled:Pe,customComponentsMap:gt,logPerf:rt});s(yt,()=>{Ye.value||mt.clear(),Ce.value+=1},{immediate:!0});let St=L(()=>({customId:G.customId,customHtmlTags:vt.value.customHtmlTags,parseOptions:G.parseOptions,customMarkdownIt:G.customMarkdownIt,htmlPolicy:Ie.value,viewportPriority:G.viewportPriority,viewportPriorityOptions:Oe.value,mode:w.value,domMode:G.domMode,codeRenderer:A.value,codeBlockStream:G.codeBlockStream,codeBlockDarkTheme:G.codeBlockDarkTheme,codeBlockLightTheme:G.codeBlockLightTheme,codeBlockMonacoOptions:G.codeBlockMonacoOptions,renderCodeBlocksAsPre:G.renderCodeBlocksAsPre,codeBlockMinWidth:G.codeBlockMinWidth,codeBlockMaxWidth:G.codeBlockMaxWidth,codeBlockProps:G.codeBlockProps,mermaidProps:G.mermaidProps,d2Props:G.d2Props,infographicProps:G.infographicProps,showTooltips:Fe.value,themes:G.themes,langs:G.langs,isDark:G.isDark,typewriter:D.value,smoothStreamingOptions:G.smoothStreamingOptions,parseCoalesceMs:G.parseCoalesceMs,fade:G.fade}));d(`markstreamNestedRendererProps`,St);let Ct=L(()=>yt.value),wt=L(()=>yt.value.length),Tt=R(null),Et=R(null),Dt=R(null),Ot=R(null),kt=o.indexKey!=null&&String(o.indexKey).startsWith(`list-item-`),At=!kt&&G.customId?r1(G.customId):null,jt=L(()=>At?(n1.value,r1(G.customId)):null),Mt=L(()=>!!(!Ne.value&&G.customId&&!kt&&jt.value?.enabled)),Nt=L(()=>!!(q&&Mt.value)),Pt=L(()=>!!(!Ne.value&&o.virtualScroll?.enabled)),Ft=L(()=>Pt.value),It=R(!1);p(()=>{It.value=!0});let Lt=L(()=>!!(q&&Pt.value));d(`markstreamHostScrollManaged`,Lt);let Rt=L(()=>!!(It.value&&Lt.value)),zt=L(()=>Nt.value||Lt.value),Bt=L(()=>Nt.value||Rt.value),Vt=L(()=>zt.value&&!1!==jt.value?.textEstimation);function Ht(){let e=we.value||ft(`getMeasuredContainerWidth.clientWidth`,()=>ge.value?.clientWidth||0);return Number.isFinite(e)&&e>0?e:0}let Ut=L(()=>{let e=Ht();return e>0?Math.max(1,Math.round(e)):640}),Wt=L(()=>!(!0!==qe.value||Pt.value||w.value!==`chat`&&w.value!==`minimal`||S(`maxLiveNodes`)||S(`liveNodeBuffer`)||o.nodes?.length||Ze.value||!((G.maxLiveNodes??0)<=0))),Gt=L(()=>Wt.value?50:Math.max(1,G.maxLiveNodes??320)),Kt=L(()=>Wt.value?16:Math.max(0,G.liveNodeBuffer??60)),qt=L(()=>!Ne.value&&!1!==G.nodeVirtual&&!((G.maxLiveNodes??0)<=0&&!Wt.value)&&(!0===G.nodeVirtual?yt.value.length>0:yt.value.length>Gt.value)),Jt=L(()=>qt.value||Nt.value||Lt.value),Yt=L(()=>!1!==G.viewportPriority),Xt=L(()=>!!Yt.value&&!xe.value);d(pX,L(()=>Yt.value));let Zt=L(()=>!(Ne.value||!1===G.deferNodesUntilVisible||(G.maxLiveNodes??0)<=0||qt.value||yt.value.length>900||!1===G.viewportPriority)),Qt=vX(e=>ze(e??ge.value??null),Yt),{requestFrame:$t,cancelFrame:en,hasIdleCallback:tn,isTestEnv:nn}=function(e){return{requestFrame:e.isClient&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame.bind(window):null,cancelFrame:e.isClient&&typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame.bind(window):null,hasIdleCallback:e.isClient&&typeof window.requestIdleCallback==`function`,isTestEnv:function(){return typeof globalThis>`u`||!(`process`in globalThis)?void 0:Object.getOwnPropertyDescriptor(globalThis,`process`)?.value?.env}()?.NODE_ENV===`test`}}({isClient:q}),rn=L(()=>!0===qe.value&&!Pt.value),{resolvedBatchSize:an,resolvedInitialBatch:on,batchingEnabled:sn,incrementalRenderingActive:cn,renderedCount:ln,previousRenderContext:un,adaptiveBatchSize:dn,previousBatchConfig:fn}=function(e,t){let n=L(()=>{let t=Math.trunc(e.renderBatchSize??80);return Number.isFinite(t)?Math.max(0,t):0}),r=L(()=>{let t=Math.trunc(e.initialRenderBatchSize??n.value);return Number.isFinite(t)?Math.max(0,t):n.value}),i=L(()=>!t.renderAsFragment.value&&!1!==e.batchRendering&&n.value>0&&t.isClient&&!t.isTestEnv),a=R(0),o=R({key:e.indexKey,total:0}),s=R(Math.max(1,n.value||1)),c=L(()=>i.value&&!t.continuousStreaming?.value&&!t.forceFullRenderFinalContent?.value&&(e.maxLiveNodes??0)<=0);return{resolvedBatchSize:n,resolvedInitialBatch:r,batchingEnabled:i,incrementalRenderingActive:c,renderedCount:a,previousRenderContext:o,adaptiveBatchSize:s,previousBatchConfig:R({batchSize:n.value,initial:r.value,delay:e.renderBatchDelay??16,enabled:c.value})}}(G,{isClient:q,isTestEnv:nn,renderAsFragment:Ne,forceFullRenderFinalContent:rn,continuousStreaming:L(()=>Xe.value&&!0!==qe.value)}),pn=L(()=>!Ne.value&&!1!==G.batchRendering&&an.value>0&&!nn&&(G.maxLiveNodes??0)<=0&&!rn.value),mn=L(()=>pn.value),hn=L(()=>zt.value||mn.value),gn=L(()=>hn.value&&!1!==jt.value?.codeBlockEstimation),_n=new Map,vn=new Map,yn=new WeakMap,bn=null,xn=new WeakMap,Sn=new Map,Cn=[],wn=[],Tn=[],En=-1,Dn=ue(Cn),On=new Set,kn=R(0),An=0,jn=R(0),Mn=L(()=>(jn.value,Array.from(_n.entries()).sort((e,t)=>e[0]-t[0]))),Nn=R(null),Pn=R(null),Fn,In=null,Ln=0,Rn=null;function zn(){Fn.markFallbackHeightPrefixDirty()}function Bn(e){return Fn.getFallbackNodeHeight(e)}function Vn(e,t){return Fn.estimateHeightRange(e,t)}function Hn(e){return Fn.estimateIndexForOffset(e)}let{activeRestoreAnchor:Un,getRelativeScrollTopWithinContainer:Wn,setRelativeScrollTopWithinContainer:Gn,resolveAnchorOffset:Kn,clearRestoreReconcile:qn,scheduleRestoreReconcile:Jn,captureRestoreAnchor:Yn,restoreAnchor:Xn,getAnchorDrift:Zn}=function(e){let{isClient:t,containerRef:n,parsedNodeCount:r,requestFrame:i,cancelFrame:a,resolveScrollContainer:o,getNormalizedScrollTop:s,getOffsetTopWithinRoot:c,isReverseFlexScrollRoot:l,estimateIndexForOffset:u,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:p}=e,m=R(null),h=null,g=[];function _(){let e=o(),t=n.value;if(!e||!t)return null;let r=e.ownerDocument||t.ownerDocument||document;if(e===r.documentElement||e===r.body||e===r.scrollingElement){let e=t.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,s(e,r,!1)-c(t,e))}function v(e){var t;let r=o(),i=n.value;if(!r||!i)return;let a=Math.max(0,e),u=r.ownerDocument||i.ownerDocument||document,d=u.defaultView||(typeof window<`u`?window:null);if(r===u.documentElement||r===u.body||r===u.scrollingElement){let e=s(r,u,!0)+i.getBoundingClientRect().top;(t=d?.scrollTo)==null||t.call(d,0,Math.max(0,e+a));return}g1(r,u,c(i,r)+a,{isReverseFlexScrollRoot:e=>{var t;return(t=l?.(e))!=null&&t},getNormalizedScrollTop:s})}function y(e){let t=r.value;return d(0,p(e.nodeIndex,0,Math.max(0,t-1)))+Math.max(0,e.offsetWithinNodePx)}function b(){if(h!=null&&(a?.(h),h=null),t)for(let e of g)window.clearTimeout(e);g=[]}function x(e){let t=y(e),n=_();n!=null&&Math.abs(n-t)<=.5||v(t)}return{activeRestoreAnchor:m,getRelativeScrollTopWithinContainer:_,setRelativeScrollTopWithinContainer:v,resolveAnchorOffset:y,clearRestoreReconcile:b,applyRestoreAnchor:x,scheduleRestoreReconcile:function(){m.value&&t&&h==null&&(h=i?i(()=>{h=null,m.value&&x(m.value)}):null,h==null&&m.value&&x(m.value))},captureRestoreAnchor:function(){let e=_(),t=r.value;if(e==null||t<=0)return null;let n=p(u(e+1),0,t-1),i=d(0,n),a=f(n);return{nodeIndex:n,offsetWithinNodePx:p(e-i,0,Math.max(0,a-1))}},restoreAnchor:function(e){let n=r.value;if(m.value={nodeIndex:p(e.nodeIndex,0,Math.max(0,n-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},b(),x(m.value),t)for(let e of[0,120,280,480])g.push(window.setTimeout(()=>{m.value&&x(m.value)},e))},getAnchorDrift:function(e){let t=_();return t==null?null:t-y(e)}}}({isClient:q,containerRef:ge,parsedNodeCount:wt,requestFrame:$t,cancelFrame:en,resolveScrollContainer:()=>Nn.value||Be(),getNormalizedScrollTop:He,getOffsetTopWithinRoot:Ue,isReverseFlexScrollRoot:Ve,estimateIndexForOffset:Hn,estimateHeightRange:Vn,getFallbackNodeHeight:Bn,clamp:ui}),{nodeHeights:Qn,heightStats:$n,heightTreeSize:er,heightSumTree:tr,heightKnownTree:nr,averageNodeHeight:rr,resetHeightMeasurements:ir,pruneHeightMeasurements:ar,rebuildHeightTrees:or,recordNodeHeight:sr,removeNodeHeights:cr,exportHeightCache:lr,importHeightCache:ur,fenwickRangeSum:dr}=function(e={}){let t=N({}),n=N({total:0,count:0}),r=R(0),i=R([]),a=R([]);function o(){for(let e of Object.keys(t))delete t[Number(e)];n.total=0,n.count=0,r.value=0,i.value=[],a.value=[]}function s(e,t,n){for(let r=t+1;r0;r-=r&-r)n+=e[r];return n}function l(e){r.value=e;let n=Array(e+1).fill(0),o=Array(e+1).fill(0);for(let[r,i]of Object.entries(t)){let t=Number(r),a=Number(i);!Number.isFinite(t)||t<0||t>=e||!Number.isFinite(a)||a<=0||(s(n,t,a),s(o,t,1))}i.value=n,a.value=o}function u(e){if(!Number.isInteger(e)||e<0)return!1;let o=t[e];if(!Number.isFinite(o)||o<=0)return!1;if(delete t[e],n.total=Math.max(0,n.total-o),n.count=Math.max(0,n.count-1),r.value>e){let t=i.value,n=a.value;t.length&&n.length&&(s(t,e,-o),s(n,e,-1))}return!0}return{nodeHeights:t,heightStats:n,heightTreeSize:r,heightSumTree:i,heightKnownTree:a,averageNodeHeight:L(()=>n.count>0?Math.max(12,n.total/n.count):32),resetHeightMeasurements:o,pruneHeightMeasurements:function(e){if(e<=0)return void o();let r=0,i=0;for(let[n,a]of Object.entries(t)){let o=Number(n),s=Number(a);!Number.isFinite(o)||o<0||o>=e||!Number.isFinite(s)||s<=0?delete t[o]:(r+=s,i++)}n.total=r,n.count=i},rebuildHeightTrees:l,recordNodeHeight:function(o,c,l={}){(function(o,c,l={}){var u;if(!Number.isFinite(c)||c<=0)return!1;let d=t[o];if(d&&(!1===l.allowShrink&&co){let e=i.value,t=a.value;if(e.length&&t.length)if(d){let t=c-d;t!==0&&s(e,o,t)}else s(e,o,c),s(t,o,1)}!1!==l.notify&&((u=e.onHeightRecorded)==null||u.call(e))})(o,c,iY(rY({},l),{notify:!0}))},removeNodeHeight:function(t,n={}){var r;let i=u(t);return i&&!1!==n.notify&&((r=e.onHeightRecorded)==null||r.call(e)),i},removeNodeHeights:function(t,n={}){var r;let i=0;for(let e of t)u(Number(e))&&i++;return i>0&&!1!==n.notify&&((r=e.onHeightRecorded)==null||r.call(e)),i},exportHeightCache:function(){return Object.entries(t).map(([e,t])=>({index:Number(e),height:Number(t)})).filter(e=>Number.isFinite(e.index)&&e.index>=0&&Number.isFinite(e.height)&&e.height>0).sort((e,t)=>e.index-t.index)},importHeightCache:function(i,a={}){var o;if(!Array.isArray(i))return;let s=r.value,c=!1;if(a.mode!==`merge`){let e=Object.keys(t);if(e.length>0){for(let n of e)delete t[Number(n)];c=!0}}for(let e of i){let n=Number(e.index),r=Number(e.height);if(!Number.isInteger(n)||n<0||s>0&&n>=s||!Number.isFinite(r)||r<=0)continue;let i=t[n];i&&Math.abs(i-r)<=1||(t[n]=r,c=!0)}c&&(function(){let e=0,i=0,a=r.value;for(let[n,r]of Object.entries(t)){let o=Number(n),s=Number(r);!Number.isFinite(o)||o<0||a>0&&o>=a||!Number.isFinite(s)||s<=0?delete t[o]:(e+=s,i++)}n.total=e,n.count=i}(),s>0&&l(s),(o=e.onHeightRecorded)==null||o.call(e))},fenwickRangeSum:function(e,t,n){if(n<=t)return 0;let r=c(e,n-1);return t<=0?r:r-c(e,t-1)}}}({onHeightRecorded:()=>{zn(),Lt.value&&wo(),Un.value&&Jn(),Pn.value&&xa(),oo(`node-resize`)}});function fr(e){Number.isInteger(e)&&e>=0&&On.add(e)}function pr(e){for(let t of e)fr(Number(t))}function mr(e){An++;let t=!0;try{let n=e();return t=!1!==n,n}finally{An--,An===0&&t&&kn.value++}}function hr(){wn=[],Tn=[],En=-1,On.clear(),Dn.value=Cn}function gr(){hr(),mr(()=>ir()),Sn.clear()}function _r(e){!Number.isInteger(e)||e<0||e>=yt.value.length||Sn.set(e,pa(e))}function vr(e,t,n={}){let r=Qn[e];fr(e),sr(e,t,n);let i=Qn[e];return Object.is(r,i)?(On.delete(e),!1):(i&&i>0?_r(e):r&&Sn.delete(e),!0)}function yr(e,t){let n=ft(`getNodeLayoutHeight.slot.offsetHeight`,()=>_n.get(e)?.offsetHeight??0);return n>0?n:ft(`getNodeLayoutHeight.content.offsetHeight`,()=>t.offsetHeight)}function br(e,t={}){t.mode===`merge`?pr(e.map(e=>e.index)):hr(),mr(()=>ur(e,t)),La()}let xr=L(()=>Zt.value&&Xt.value),Sr=L(()=>!Ne.value&&!1!==G.batchRendering&&an.value>0&&(G.maxLiveNodes??0)<=0),Cr=L(()=>!Ne.value&&Je&&!0===qe.value&&!qt.value&&!Pt.value&&!Mt.value&&!xr.value&&!Sr.value),wr=L(()=>!!Qt&&xr.value),Tr=L(()=>qt.value||Lt.value),{focusIndex:Er,liveRange:Dr,updateLiveRange:Or}=function(e,t){let{parsedNodeCount:n,virtualizationEnabled:r,maxLiveNodesResolved:i,liveNodeBufferResolved:a,clamp:o}=t,s=a??L(()=>Math.max(0,e.liveNodeBuffer??60)),c=R(0),l=N({start:0,end:0});return{liveNodeBufferResolved:s,focusIndex:c,liveRange:l,updateLiveRange:function(){let e=n.value;if(!r.value||e===0)return l.start=0,void(l.end=e);let t=Math.min(i.value,e),a=s.value,u=o(c.value-a,0,Math.max(0,e-t));l.start=u,l.end=Math.min(e,u+t)}}}(G,{parsedNodeCount:wt,virtualizationEnabled:qt,maxLiveNodesResolved:Gt,liveNodeBufferResolved:Kt,clamp:ui}),kr=new Map,Ar=new Map,jr=new Map,Mr=[],Nr=new Map,Pr=new Set,Fr=R(0),Ir=!1,Lr=L(()=>(Fr.value,Pr.size)),Rr=new Map,zr=new Map,Br=R(0),Vr=L(()=>{Br.value;let e=0;for(let t of Rr.values())e+=Math.max(0,t);return e}),Hr=null,Ur=L(()=>{if(!qt.value)return yt.value.length;let e=Kt.value,t=Math.max(Dr.end+e,on.value),n=Math.min(yt.value.length,t);return Math.max(ln.value,n)});function Wr(){Ir||(Ir=!0,queueMicrotask(()=>{Ir=!1,Fr.value+=1}))}function Gr(e,t,n=`node-resize`){if(!q||typeof window>`u`)return null;let r=window.setTimeout(()=>{Pr.delete(r)&&Wr();try{t()}finally{oo(n)}},Math.max(0,e));return Pr.add(r),Wr(),r}function Kr(e){q&&e!=null&&(Pr.delete(e)&&Wr(),window.clearTimeout(e))}function qr(){if(q&&typeof window<`u`)for(let e of Pr)window.clearTimeout(e);Pr.size&&(Pr.clear(),Wr()),Mr.length=0,jr.clear()}function Jr(e){_e.value=e}function Yr(e){ve.value=e}function Xr(e){ye.value=e}let{cancelScheduledFocusSync:Zr,scheduleFocusSync:Qr}=function(e){let{isClient:t,containerRef:n,virtualizationEnabled:r,requestFrame:i,cancelFrame:a,syncFocusToScroll:o}=e,s=null;function c(){return n.value?.ownerDocument?.defaultView??(typeof window<`u`?window:null)}function l(){if(!s)return;let e=c();s.viaTimeout?e?e.clearTimeout(s.id):clearTimeout(s.id):a?.(s.id),s=null}return{cancelScheduledFocusSync:l,scheduleFocusSync:function(e={}){if(!r.value)return;if(!t)return void o(!0);if(e.immediate)return l(),void o(!0);if(s)return;let n=()=>{s=null,o()};if(i)return void(s={id:i(n),viaTimeout:!1});let a=c();s={id:a?a.setTimeout(n,16):setTimeout(n,16),viaTimeout:!0}}}}({isClient:q,containerRef:ge,virtualizationEnabled:qt,requestFrame:$t,cancelFrame:en,syncFocusToScroll:function(e=!1){if(!qt.value)return;let t=Nn.value||Be();if(!t)return;let n=t.ownerDocument||ge.value?.ownerDocument||document,r=n?.defaultView||(typeof window<`u`?window:null),i=t===n?.documentElement||t===n?.body,a=yt.value.length;if(a<=0)return;if(!i&&a>0&&Ve(t)){let n=ft(`syncFocusToScroll.clientHeight`,()=>t.clientHeight||0),r=ft(`syncFocusToScroll.scrollTop`,()=>t.scrollTop),i=r<0?-r:r;li(ui((o=Math.max(0,i)+.5*Math.max(0,n),Fn.estimateIndexForOffsetFromEnd(o)),0,Math.max(0,a-1)),e);return}var o;let s=function(e,t,n,r){let i=ge.value;if(!i)return null;let a=r?0:ft(`syncFocusToScroll.model.root.getBoundingClientRect`,()=>e.getBoundingClientRect().top),o=ft(`syncFocusToScroll.model.container.getBoundingClientRect`,()=>i.getBoundingClientRect().top),s=Math.max(0,a-o),c=r?ft(`syncFocusToScroll.model.viewport.clientHeight`,()=>n?.innerHeight??t.documentElement?.clientHeight??e.clientHeight??0):ft(`syncFocusToScroll.model.root.clientHeight`,()=>e.clientHeight);return ui(Hn(s+.5*Math.max(0,c)),0,Math.max(0,yt.value.length-1))}(t,n,r,i);if(s!=null)return void li(s,e);let c=i?null:ft(`syncFocusToScroll.root.getBoundingClientRect`,()=>t.getBoundingClientRect()),l=i?0:c.top,u=i?ft(`syncFocusToScroll.viewport.clientHeight`,()=>r?.innerHeight??t.clientHeight??0):c.bottom,d=Mn.value,f=null,p=null;for(let[e,t]of d){if(!t)continue;let n=ft(`syncFocusToScroll.slot.getBoundingClientRect`,()=>t.getBoundingClientRect());n.bottom<=l||n.top>=u||(f??=e,p=e)}if(f==null||p==null){let e=ge.value;if(!e)return;let a=i?{top:0}:ft(`syncFocusToScroll.fallback.root.getBoundingClientRect`,()=>t.getBoundingClientRect()),o=ft(`syncFocusToScroll.fallback.scrollTop`,()=>He(t,n,i)),s=i?(()=>{let t=ft(`syncFocusToScroll.fallback.container.getBoundingClientRect`,()=>e.getBoundingClientRect()),n=(i?0:a.top)-t.top;return Math.max(0,n)})():(()=>{let n=Ue(e,t);return Math.max(0,o-n)})(),c=i?ft(`syncFocusToScroll.fallback.viewport.clientHeight`,()=>r?.innerHeight??n?.documentElement?.clientHeight??t.clientHeight??0):ft(`syncFocusToScroll.fallback.root.clientHeight`,()=>t.clientHeight);li(ui(Hn(s+.5*Math.max(0,c)),0,Math.max(0,yt.value.length-1)),!0);return}li(Math.round((f+p)/2),e)}}),{visibleNodeIndices:$r,nodeVisibilityHandles:ei,nodeVisibilityWatchStops:ti,nodeVisibilityFallbackTimers:ni,clearVisibilityFallback:ri,markNodeVisible:ii,cleanupNodeVisibility:ai,destroyNodeVisibilityState:oi}=f0({isClient:q,shouldTrackVisibleNodeIndices:()=>xr.value,shouldCleanupNodeVisibility:()=>qt.value,onNodeMarkedVisible:e=>{qt.value?Qr():Er.value=ui(e,0,Math.max(0,yt.value.length-1))},onNodeVisibilityCleaned:e=>{_n.delete(e)&&so()}}),{cleanupScrollListener:si,setupScrollListener:ci}=function(e){let{isClient:t,virtualizationEnabled:n,listenerEnabled:r,scrollRootElement:i,resolveScrollContainer:a,scheduleFocusSync:o,onScroll:s}=e,c=null,l=null;function u(){c&&=(c(),null),l=null,i.value=null}function d(t){let n=e.getScrollTop?e.getScrollTop(t):t.scrollTop;return Math.max(0,Number.isFinite(n)?Math.abs(n):0)}return{cleanupScrollListener:u,setupScrollListener:function(){if(!t)return;if(!((e=r?.value)??n.value))return void u();var e;let f=a();if(!f)return void u();if(i.value===f&&c)return;u(),l=d(f);let p=()=>{if(s?.(),n.value){let e=function(e){let t=d(e),n=l;l=t;let r=Math.max(480,.75*(e.clientHeight||0));return n==null?t>r?{immediate:!0}:void 0:Math.abs(t-n)>r?{immediate:!0}:void 0}(f);e?o(e):o()}};f.addEventListener(`scroll`,p,{passive:!0}),i.value=f,c=()=>{f.removeEventListener(`scroll`,p)}}}}({isClient:q,virtualizationEnabled:qt,listenerEnabled:Tr,scrollRootElement:Nn,resolveScrollContainer:Be,scheduleFocusSync:Qr,onScroll:function(){let e=Pn.value;if(!e)return;let t=na();if(!t||function(e){if(Xa()>=Ln)return Rn=null,!1;let t=Rn;if(t==null)return!0;let n=Math.abs(e.scrollTop-t)<=2;return n||(Rn=null),n}(t))return;let n=ia(t);(n==null||n<-32||Math.abs(Math.max(0,n)-Math.max(0,e.distanceFromBottomPx))>32)&&ba(`restore`)},getScrollTop:e=>{let t=e.ownerDocument||ge.value?.ownerDocument||document,n=e===t.documentElement||e===t.body||e===t.scrollingElement;return ft(`scrollListener.getScrollTop`,()=>He(e,t,n))}});function li(e,t=!1){let n=ui(e,0,Math.max(0,yt.value.length-1));!t&&Math.abs(n-Er.value)<=1||(Er.value=n,Or())}function ui(e,t,n){return Math.min(Math.max(e,t),n)}function di(e=yt.value.length){let t=bt();return!Number.isInteger(t)||t<0?e:ui(t,0,e)}function fi(e){return e?.firstElementChild}function pi(e,t){return e?e.matches?.call(e,t)?e:e.querySelector(t):null}function mi(e,t){e<1||e>6||(be[e]=t)}function hi(){if(!zt.value)return void(we.value=0);let e=ft(`updateExperimentContainerWidth.clientWidth`,()=>ge.value?.clientWidth??0);we.value=e>0?e:0}let gi=null;function _i(){gi?.disconnect(),gi=null}let vi=XX(`ViewportDeferredMarkdownCodeBlockNode`,i({loader:()=>aY(null,null,function*(){return(yield he(()=>import(`./index5-CCrZjPWg.js`),__vite__mapDeps([34,1,2,31,7]))).default}),loadingComponent:ZX,delay:0,suspensible:!1}),ZX);function yi(e){return e===vi}let bi=L(()=>A.value===`pre`?qX:A.value===`shiki`?vi:QX);function xi(){return!1!==G.codeBlockProps?.showHeader}function Si(e,t,n){let r=Qn[t],i=typeof r==`number`&&r>0;if(Vt.value&&!i&&!function(e){return!!gt.value.paragraph&&(e.type===`paragraph`||e.type===`list_item`||e.type===`list`)}(e)){let t=c1(e,n,Te.value);if(t)return t}if(gn.value&&e.type===`code_block`){let t=function(e){if(e.type!==`code_block`)return null;let t=ns(e,Zo(e));return yi(t)?`markdown`:t===qX?`pre`:t===bi.value||t===QX?`monaco`:null}(e);if(t===`monaco`||t===`markdown`||t===`pre`)return function(e,t){if(!e||e.type!==`code_block`)return null;let n=t.rendererKind,r=n!==`pre`&&!1!==t.showHeader,i=!!e.diff,a=0,o=500;if(n===`monaco`){let n=t.monacoOptions??{},r=d1(e,n,t.width),s=function(e){let t=typeof e?.fontSize==`number`&&e.fontSize>0?e.fontSize:12;return typeof e?.lineHeight==`number`&&e.lineHeight>0?e.lineHeight:Math.round(1.5*t)}(n),c=function(e,t){let n=typeof e?.padding?.top==`number`?e.padding.top:t?0:8,r=typeof e?.padding?.bottom==`number`?e.padding.bottom:t?0:8;return Math.max(0,n)+Math.max(0,r)}(n,i);o=typeof n.MAX_HEIGHT==`number`&&n.MAX_HEIGHT>0?n.MAX_HEIGHT:500,a=Math.round(r*s+c)}else if(n===`markdown`){let t=d1(e);a=Math.round(21*t+32)}else{let t=d1(e);a=Math.round(28*t),o=1/0}let s=Math.max(1,Math.min(a,o));return rY({kind:`code-block`,height:Math.round(s+(r?40:0)),contentHeight:s,rendererKind:n},i&&n===`monaco`?{diffInline:NX(t.monacoOptions??{},t.width??0)}:{})}(e,{rendererKind:t,monacoOptions:G.codeBlockMonacoOptions,showHeader:xi(),width:n})}return null}u(()=>{if(kn.value,An>0)return;let e=yt.value,t=xt();if(!e.length||!hn.value)return wn=[],Tn=[],En=-1,On.clear(),void(Dn.value=Cn);let n=we.value||ft(`estimatedNodeHeights.clientWidth`,()=>ge.value?.clientWidth||0);if(!Number.isFinite(n)||n<=0)return wn=[],Tn=[],En=-1,On.clear(),void(Dn.value=Cn);let r=function(e){return[Math.round(e),Vt.value,gn.value,Te.value,G.codeBlockMonacoOptions,xi(),A.value,gt.value,n1.value]}(n),i=wn.length<=e.length&&(o=r,(a=Tn).length===o.length&&a.every((e,t)=>Object.is(e,o[t])));var a,o;let s=i&&En===t?e.length:i?di(e.length):0,c=i?Array.from(On):[];wn.length=e.length;for(let t=s;t=0&&tDn.value);Fn=function(e){let t=!0,n=[0],r=``;function i(t){let n=e.nodeHeights[t];if(Number.isFinite(n)&&n>0)return n;let r=e.parsedNodes.value[t],i=r?.type,a=!!e.hasCustomParagraphComponent?.call(e),o=e.estimatedNodeHeights.value[t],s=o?.height;if(!function(e,t,n){return!!(n&&t?.kind===`simple-text`&&(e===`paragraph`||e===`list_item`||e===`list`))}(i,o,a)&&Number.isFinite(s)&&s>0)return s;let c=k1(r,e.getContainerWidth()||640);return i===`heading`||i===`paragraph`&&c<=28&&function(e,t){if(t)return!1;let n=e.children;return!Array.isArray(n)||!n.length||n.every(T1)}(r,a)?c:Math.max(e.averageNodeHeight.value,c)}function a(){let a=e.parsedNodes.value.length,o=e.getPrefixCacheKeyParts().join(`:`);if(!t&&r===o)return n;let s=Array(a+1);s[0]=0;for(let t=0;t=(r[n]??0))return n-1;let i=0,o=n-1,s=n-1;for(;i<=o;){let e=i+o>>1;(r[e+1]??0)>=t?(s=e,o=e-1):i=e+1}return s}function s(t,n){if(t>=n)return 0;if(e.heightEstimationActive.value)return function(t,n){let r=e.parsedNodes.value.length,i=A1(Math.trunc(t),0,r),o=A1(Math.trunc(n),i,r);if(i>=o)return 0;let s=a();return(s[o]??0)-(s[i]??0)}(t,n);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let r=0;for(let i=t;it<=0?0:e.fenwickRangeSum(i,0,t)+(t-e.fenwickRangeSum(a,0,t))*r,s=0,c=n.length-1,l=n.length-1;for(;s<=c;){let e=s+c>>1;o(e+1)>=t?(l=e,c=e-1):s=e+1}return l}let r=t;for(let t=0;t0||t++}return t}return{markFallbackHeightPrefixDirty:function(){t=!0},getFallbackNodeHeight:i,estimateHeightRange:s,estimateIndexForOffset:c,estimateIndexForOffsetFromEnd:function(t){let n=e.parsedNodes.value;if(!n.length)return 0;if(t<=0)return Math.max(0,n.length-1);if(e.heightEstimationActive.value){let e=a()[n.length]??0;return o(Math.max(0,e-t))}if(e.heightTreeSize.value===n.length){let e=s(0,n.length);return c(Math.max(0,e-t))}let r=t;for(let t=n.length-1;t>=0;t--){let n=e.nodeHeights[t]??e.averageNodeHeight.value;if(r<=n)return t;r-=n}return 0},getEstimatedNodeHeightCount:l,buildVirtualHeightSummary:function(t){let n=e.parsedNodes.value.length;return{totalNodes:n,measuredCount:e.heightStats.count,estimatedCount:l(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,estimatedTotalHeight:s(0,n),width:t.width??e.getContainerWidth()}}}}({parsedNodes:yt,nodeHeights:Qn,heightStats:$n,heightTreeSize:er,heightSumTree:tr,heightKnownTree:nr,averageNodeHeight:rr,heightEstimationActive:zt,estimatedNodeHeights:Ci,getContainerWidth:Ht,hasCustomParagraphComponent:()=>!!gt.value.paragraph,getPrefixCacheKeyParts:()=>{let e=C1(we.value||ft(`getFallbackHeightPrefix.clientWidth`,()=>ge.value?.clientWidth||0)),t=o.virtualScroll?.measurementKey==null?``:String(o.virtualScroll.measurementKey);return[yt.value.length,$n.count,Math.round($n.total),Math.round(100*rr.value),t,e,+!!zt.value,n1.value,Ce.value,+!!gt.value.paragraph]},fenwickRangeSum:dr}),s(()=>yt.value.length,e=>{var t;zn(),e<=0?gr():(ear(t))),e!==er.value&&or(e))},{immediate:!0});let wi=L(()=>{if(!qt.value)return yt.value.map((e,t)=>({node:e,index:t}));let e=yt.value.length,t=ui(Dr.start,0,e),n=ui(Dr.end,t,e);return yt.value.slice(t,n).map((e,n)=>({node:e,index:t+n}))}),Ti=L(()=>qt.value?Vn(0,Math.min(Dr.start,yt.value.length)):0),Ei=L(()=>{if(!qt.value)return 0;let e=yt.value.length;return Vn(Math.min(Dr.end,e),e)});function Di(){return Fn.buildVirtualHeightSummary({topSpacerHeight:Ti.value,bottomSpacerHeight:Ei.value,width:Fi()})}function Oi(){let e=yt.value;return iY(rY({},Di()),{probe:{paragraphReady:!!Te.value.paragraph,listItemReady:!!Te.value.listItem,listWrapperOverhead:Te.value.listWrapperOverhead,headingReadyLevels:Object.entries(Te.value.headings).filter(([,e])=>!!e).map(([e])=>Number(e))},nodes:e.map((e,t)=>({index:t,type:e.type,estimateKind:Ci.value[t]?.kind??null,rendererKind:Ci.value[t]?.rendererKind??null,estimatedHeight:Ci.value[t]?.height??null,estimatedContentHeight:Ci.value[t]?.contentHeight??null,measuredHeight:Qn[t]??null}))})}function ki(){return o.indexKey==null?Pt.value?`virtual-${ji()}`:`markdown-renderer`:String(o.indexKey)}function Ai(e){let t=String(e),n=`${ki()}-`;if(!t.startsWith(n))return null;let r=t.slice(n.length).match(/^(\d+)(?:$|-)/);if(!r)return null;let i=Number(r[1]);return!Number.isInteger(i)||i<0||i>=yt.value.length?null:i}function ji(){let e=o.virtualScroll?.sessionKey;return String(e!=null&&e!==``?e:o.indexKey??G.customId??pt)}function J(){let e=o.virtualScroll?.threadKey;return e==null||e===``?void 0:String(e)}let Mi=L(()=>J()??String(o.indexKey??G.customId??pt));function Ni(e){return(e??``)===(J()??``)}function Pi(){var e,t;return e=o.virtualScroll?.measurementKey,t=function(){let e=A.value;return function(e){let t=e.renderer,n=t===`monaco`?e.codeBlockMonacoOptions:void 0,r=e.codeBlockProps,i=t===`shiki`;return[e.isDark?`dark`:`light`,t===`monaco`?`code-rich`:t===`pre`?`code-pre`:`code-shiki`,!1===e.codeBlockStream?`code-static`:`code-stream`,w0(e.codeBlockMinWidth),w0(e.codeBlockMaxWidth),...i?[QK(r?.themes??e.themes,r?.langs??e.langs)]:[],w0(n?.fontSize),w0(n?.lineHeight),w0(n?.fontFamily),w0(n?.tabSize),w0(n?.MAX_HEIGHT),w0(n?.wordWrap),w0(n?.wrappingIndent),w0(n?.padding),w0(r?.showHeader),w0(r?.showCopyButton),w0(r?.showExpandButton),w0(r?.showPreviewButton),w0(r?.showCollapseButton),w0(r?.showFontSizeButtons)].join(`\0`)}({renderer:e,isDark:G.isDark,codeBlockStream:G.codeBlockStream,codeBlockMinWidth:G.codeBlockMinWidth,codeBlockMaxWidth:G.codeBlockMaxWidth,codeBlockMonacoOptions:e===`monaco`?G.codeBlockMonacoOptions:void 0,codeBlockProps:G.codeBlockProps,themes:e===`shiki`?G.themes:void 0,langs:e===`shiki`?G.langs:void 0})}(),[e==null?``:String(e),t].join(`\0`)}function Fi(){return Ht()}let Ii=L(()=>C1(Fi())),Li=L(()=>[Pi(),Ii.value].join(`\0`)),Ri=L(()=>Pt.value?[`virtual`,J()??``,ji(),Li.value].join(`\0`):o.indexKey);function zi(){Br.value+=1}function Bi(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=yt.value.length||e.sessionKey!==ji()||e.threadKey!==J()||e.layoutEpochKey!==Li.value)}function Vi(e){let t=String(e),n=zr.get(t);return n?Bi(n)?n.index:null:Ai(t)}function Hi(e=`async-node`){(Rr.size||zr.size)&&(Rr.clear(),zr.clear(),zi(),oo(e))}let Ui=m(cq,null),Wi={reportHeight(e,t){if(!Lt.value)return;let n=Vi(e);if(n==null)return;let r=kr.get(n);if(!r)return;let i=Number(t),a=yr(n,r);(function(e,t,n={}){mr(()=>vr(e,t,n))})(n,Number.isFinite(i)&&i>0?Math.max(i,a||0):a)},markPending(e){if(!Lt.value)return;let t=Ai(e);t!=null&&function(e,t){let n=zr.get(e);if(n&&Bi(n))return Rr.set(e,Math.max(0,Rr.get(e)??0)+1),zi(),void oo(`async-node`);Rr.set(e,1),zr.set(e,function(e){return{index:e,sessionKey:ji(),threadKey:J(),layoutEpochKey:Li.value}}(t)),zi(),oo(`async-node`)}(String(e),t)},markSettled(e){if(!Lt.value)return;let t=String(e),n=Vi(e);(n!=null||function(e){return Rr.has(String(e))}(t))&&function(e){let t=Rr.get(e)??0;return!(t<=0||(t<=1?(Rr.delete(e),zr.delete(e)):Rr.set(e,t-1),zi(),t===1&&oo(`async-node`),0))}(t)&&n!=null&&ho()}};function Gi(){let e=0;for(let t of kr.values())e+=ft(`getVisibleDomHeight.offsetHeight`,()=>t?.offsetHeight??0);return Math.ceil(Math.max(0,e))}d(cq,{reportHeight(e,t){Wi.reportHeight(e,t),Ui?.reportHeight(e,t)},markPending(e){Wi.markPending(e),Ui?.markPending(e)},markSettled(e){Wi.markSettled(e),Ui?.markSettled(e)}});let Ki,qi=null,Ji=null;function Yi(e){return!1!==e&&e!=null&&e!==``}function Xi(){return qt.value?function(){if(!qt.value)return!0;let e=yt.value.length,t=ui(Dr.start,0,e),n=ui(Dr.end,t,e);if(t>=n)return!0;for(let e=t;e=Ur.value}function Zi(){return!0===qe.value&&!Ye.value&&Vr.value===0&&Pr.size===0&&Nr.size===0&&Hr==null&&Xi()}function Qi(){if(o.virtualScroll?.settleMode!==`manual`||qi===ji()&&Ki===J())return!0;let e=o.virtualScroll?.settledToken;return!!Yi(e)&&Ji===Do(e)}function $i(){return Zi()&&Qi()}function ea(e,t){return t.totalNodes<=0?e===`final`?`final`:`estimate`:t.measuredCount>=t.totalNodes?e===`final`?`final`:`measured`:t.measuredCount>0||t.estimatedCount>0?`mixed`:`estimate`}function ta(e=`manual`,t){let n=Di(),r=function(e){return e||(!0===qe.value?!Xi()||Nr.size>0||Hr!=null?`measuring`:$i()?`settled`:`settling`:yt.value.length>0?`streaming`:`estimating`)}(t);return{sessionKey:ji(),threadKey:J(),phase:r,nodeCount:n.totalNodes,liveRange:{start:Dr.start,end:Dr.end},renderedCount:ln.value,measuredCount:n.measuredCount,estimatedCount:n.estimatedCount,averageNodeHeight:n.averageNodeHeight,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,visibleDomHeight:Gi(),totalHeight:ra(),width:n.width,final:!0===qe.value,stable:$i(),confidence:ea(r,n),reason:e}}function na(){let e=Nn.value||Be(),t=ge.value;if(!e||!t)return null;let n=e.ownerDocument||t.ownerDocument||document,r=e===n.documentElement||e===n.body||e===n.scrollingElement;return{root:e,doc:n,isViewportRoot:r,scrollTop:ft(`getScrollBox.scrollTop`,()=>He(e,n,r)),scrollHeight:ft(`getScrollBox.scrollHeight`,()=>r?Math.max(n.documentElement?.scrollHeight??0,n.body?.scrollHeight??0,e.scrollHeight??0):e.scrollHeight),clientHeight:ft(`getScrollBox.clientHeight`,()=>r?n.documentElement?.clientHeight||e.clientHeight||0:e.clientHeight)}}function ra(){let e=yt.value.length,t=Math.max(0,Vn(0,e)),n=ft(`getRendererLogicalHeight.offsetHeight`,()=>ge.value?.offsetHeight??0),r=Math.max(0,n>0?n:ft(`getRendererLogicalHeight.scrollHeight`,()=>ge.value?.scrollHeight??0));return e<=0?Math.ceil(n):qt.value?t>0?Math.max(1,Math.ceil(t),function(){let e=Ti.value+Ei.value;for(let t of _n.values())t&&(e+=Math.max(0,ft(`getVirtualizedDomLogicalHeight.offsetHeight`,()=>t.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,t){return e<=0||t<=0?0:t<=e+Math.max(512,.05*e)?Math.ceil(t):0}(t,r)):Math.max(1,Math.ceil(r)):Lt.value?t>0||$n.count>0||Fn.getEstimatedNodeHeightCount()>0?(cn.value&&ln.value,Math.max(1,Math.ceil(r),Math.ceil(t))):Math.ceil(r):Math.max(1,Math.ceil(r),Math.ceil(t))}function ia(e){let t=ge.value;if(!t)return null;let n=ft(`getRendererBottomDistanceFromViewport.getBoundingClientRect`,()=>t.getBoundingClientRect());return function(e){return e.isViewportRoot?e.clientHeight:ft(`getViewportBottomInRoot.getBoundingClientRect`,()=>e.root.getBoundingClientRect().bottom)}(e)-n.bottom}function aa(e={}){let t=!1!==e.requireViewport,n=function(e=64){let t=na(),n=ge.value;if(!t||!n)return!1;let r=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};let t=ft(`getVirtualViewportRect.getBoundingClientRect`,()=>e.root.getBoundingClientRect());return{top:t.top,bottom:t.bottom}}(t),i=ft(`isRendererNearVirtualViewport.getBoundingClientRect`,()=>n.getBoundingClientRect());return i.bottom>=r.top-e&&i.top<=r.bottom+e}();if(t&&!n)return null;let r=function(){let e=na(),t=ge.value;if(!e||!t||Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;let n=ia(e);return n==null?null:n>=-8&&n<=160?{type:`bottom`,distanceFromBottomPx:Math.max(0,n)}:null}();if(r)return{anchor:r,captured:!0};let i=Yn();if(i)return{anchor:{type:`node`,nodeIndex:i.nodeIndex,offsetWithinNodePx:i.offsetWithinNodePx},captured:n};if(!0===e.allowFallback){let e=function(){let e=yt.value.length;return e<=0?null:{type:`node`,nodeIndex:ui(Er.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function oa(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function sa(e,t){let n=e;for(let e=0;e8192?`${e.slice(0,8192)}...${e.length}`:e;return`${e.length}:${oa(t)}`}(e)}`;if(typeof e==`function`)return`fn`;if(typeof e!=`object`)return typeof e;if(t.has(e))return`cycle`;if(n>=6)return`max-depth`;t.add(e);try{if(Array.isArray(e)){if(e.length<=160){let r=[];for(let i=0;i=a&&i.push(c)}return[`a:${e.length}`,`h=${r.join(`,`)}`,`t=${i.join(`,`)}`,`all=${(o>>>0).toString(36)}`].join(`:`)}let r=e,i=Object.keys(r).filter(e=>{let t=r[e];return e!==`parent`&&e!==`el`&&e!==`component`&&(t==null||typeof t==`string`||typeof t==`number`||typeof t==`boolean`||ca.has(e))}).sort();return`o:${i.length}:${i.map(e=>`${e}=${la(r[e],t,n+1)}`).join(`;`)}`}finally{t.delete(e)}}let ua=-1,da=``,fa=[2166136261];function pa(e){let t=yt.value[e];return t?oa(la(t)):``}function ma(e,t){let n=e;for(let e=0;e>>0}function ha(){let e=Ce.value;if(ua===e)return da;let t=yt.value.length,n=di(t);(ua!==e-1||n>t||fa.length>>0).toString(36),ua=e,da}function ga(e,t={}){let n=!0===t.includeHeightCache,r=t.includeContentHash??n,i=n?function(e){let t=function(){let e=Number(o.virtualScroll?.heightCacheLimit??5e3);return!Number.isFinite(e)||e<=0?1/0:Math.max(1,Math.trunc(e))}();if(!Number.isFinite(t)||e.length<=t)return e;let n=new Map,r=e=>{!e||n.size>=t||n.set(e.index,e)},i=yt.value.length,a=ui(Dr.start-2*Kt.value,0,i),s=ui(Dr.end+2*Kt.value,a,i);for(let t of e)t.index>=a&&t.index=0&&n.sizee.index-t.index).slice(0,t)}(lr().map(e=>{let t=yt.value[e.index];return t?iY(rY({},e),{nodeType:String(t.type??``),signature:pa(e.index)}):null}).filter(e=>!!e)):[],a=aa({allowFallback:!0===t.allowAnchorFallback,requireViewport:t.requireViewport});return a||i.length||!0===t.includeEmptyState?iY(rY({sessionKey:e.sessionKey,threadKey:e.threadKey},a?{anchor:a.anchor,anchorCaptured:a.captured}:{anchorCaptured:!1}),{metrics:e,width:e.width,contentHash:r?ha():void 0,measurementKey:Pi()||void 0,heightCache:i.length?i:void 0}):null}function _a(e){var t,n;let r=na();if(!r)return;let i=function(e){let t=ge.value;if(!t)return null;let n=Ue(t,e.root),r=yt.value.length,i=ft(`getRendererBottomOffsetWithinRoot.offsetHeight`,()=>t.offsetHeight||0),a=Math.max(0,i>0?i:r>0?ft(`getRendererBottomOffsetWithinRoot.scrollHeight`,()=>t.scrollHeight||0):0),o=ra();return n+Math.max(a,o)}(r);if(i==null)return;let a=Math.max(0,e.distanceFromBottomPx),o=Math.max(0,i-r.clientHeight-a);(function(e){Ln=Xa()+120,Rn=e})(o),r.isViewportRoot?(n=(t=r.doc.defaultView)?.scrollTo)==null||n.call(t,0,o):g1(r.root,r.doc,o,{isReverseFlexScrollRoot:Ve,getNormalizedScrollTop:He})}let va=[];function ya(){if(q)for(In!=null&&(en?.(In),In=null);va.length;){let e=va.pop();e!=null&&window.clearTimeout(e)}}function ba(e){let t=!!Pn.value;Pn.value=null,Ln=0,Rn=null,ya(),t&&e&&oo(e)}function xa(){if(!Pn.value||!q||In!=null)return;let e=()=>{In=null;let e=Pn.value;e&&_a(e)};In=$t?$t(e):null,In??e()}function Sa(e,t={}){let n=yt.value.length;return n<=0?[]:e.filter(e=>!(!Number.isInteger(e.index)||e.index<0||e.index>=n)&&!(!Number.isFinite(e.height)||e.height<=0)&&!(t.requireSignature&&!e.signature)&&!(t.requireCompatibilityMetadata&&!e.nodeType&&!e.signature)&&function(e){let t=yt.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(t.type??``)||e.signature&&e.signature!==pa(e.index))}(e))}function Y(e){let t=C1(Fi()),n=C1(e);return t!==-1&&n!==-1&&t===n}function Ca(e){let t=Number(e?.width);if(Number.isFinite(t)&&t>0)return t;let n=Number(e?.metrics?.width);return Number.isFinite(n)&&n>0?n:null}function wa(e){return e.sessionKey===ji()&&!!Ni(e.threadKey)&&(e.measurementKey??``)===Pi()&&!!Y(Ca(e))&&!!function(e){let t=e.heightCache;return!!t?.length&&(Ta(e)?t.some(e=>!!(e.nodeType||e.signature)):t.some(e=>!!e.signature))}(e)}function Ta(e){return!!(e.contentHash&&e.contentHash===ha())}function Ea(e){return!Ta(e)}let Da=null,Oa=null,ka=null,Aa=null,ja=null;function Ma(e){let t=e.map(e=>[e.index,Math.round(10*e.height),e.nodeType??``,e.signature??``].join(``)).join(``),n=C1(Fi());return[J()??``,ji(),Pi(),yt.value.length,n,e.length,oa(t)].join(`:`)}function Na(e=(e=>(e=o.virtualScroll)?.heightCache)()){if(!Lt.value||!e?.length||yt.value.length<=0||!Y((t=o.virtualScroll)?.heightCacheWidth))return!1;var t;let n=Sa(e,{requireSignature:!0});if(!n.length)return!1;let r=Ma(n);return r===Da?(Oa=`standalone`,!0):(br(n,{mode:`merge`}),zn(),Da=r,Oa=`standalone`,eo(),oo(`restore`),!0)}function Pa(e,t={}){if(!Lt.value||!e||e.sessionKey!==ji()||!Ni(e.threadKey)||yt.value.length<=0)return!1;let r=!!e.heightCache?.length&&!Fa(),i=!e.anchor||!1===e.anchorCaptured&&!0!==t.allowUncapturedAnchor?null:e.anchor,a=!0===t.restoreAnchor&&!!i&&!Fa()&&Number(Ca(e))>0,o=!1;if(e.heightCache?.length&&wa(e)){let t=Sa(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Ea(e)});t.length&&(br(t,{mode:`merge`}),zn(),Da=Ma(t),Oa=`restore`,eo(),o=!0)}if(r||a)return!1;if(!t.restoreAnchor||!i)return o&&oo(`restore`),!0;let s=function(e,t){let n=e.anchor,r=n?n.type===`bottom`?`bottom:${Math.round(n.distanceFromBottomPx)}`:`node:${n.nodeIndex}:${Math.round(n.offsetWithinNodePx)}`:`none`;return[J()??``,ji(),Pi(),Ii.value,t,r].join(`:`)}(e,t.restoreToken??`imperative`);return ka===s?(o&&oo(`restore`),!0):(ka=s,function(e){let t=()=>{if(e.type===`node`)return ba(),void Xn({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(qn(),Un.value=null,Pn.value=e,ya(),_a(e),q)for(let e of[0,120,280,480])va.push(window.setTimeout(()=>{let e=Pn.value;e&&_a(e)},e))};(function(e){if(!qt.value)return!1;let t=yt.value.length;return!(t<=0||(Er.value=e.type===`node`?ui(e.nodeIndex,0,t-1):t-1,Or(),0))})(e)?n(t):t()}(i),oo(`restore`),!0)}function Fa(){let e=Fi();return Number.isFinite(e)&&e>0}function Ia(e){return e.sessionKey===ji()&&!!Ni(e.threadKey)&&(yt.value.length<=0||!(!e.heightCache?.length||Fa())||!(!(e.anchor&&Number(Ca(e))>0)||Fa()))}function La(){Sn.clear();for(let e of Object.keys(Qn)){let t=Number(e);Number.isInteger(t)&&t>=0&&t{let t=!1,n=null,r=()=>{t||(t=!0,n!=null&&window.clearTimeout(n),e())};if($t)return $t(r),void(n=window.setTimeout(r,50));n=window.setTimeout(r,0)})}function Ba(e,t=J(),n=Li.value){return ji()===e&&J()===t&&Li.value===n}function Va(){return aY(this,arguments,function*(e={}){let t=ji(),r=J(),i=Li.value,a=e.frames??2,s=e.timeoutMs??120,c=e.reason??`manual`,l=e.expectedSettledTokenKey,u=!0===e.flushPendingTimers,d=ta(c),f=()=>iY(rY({},d),{phase:d.final?`settling`:d.phase,stable:!1,confidence:d.confidence===`final`?`mixed`:d.confidence,reason:c}),p=()=>Ba(t,r,i)&&(l==null||Qa()===l);for(let e=0;ewindow.setTimeout(t,e))}(s),!p()||(u&&qr(),ho(),Ra(),!p()))return f();let m=Zi();m&&(qi=t,Ki=r,o.virtualScroll?.settleMode===`manual`&&l!=null&&Yi(o.virtualScroll?.settledToken)&&Qa()===l&&(Ji=Do(o.virtualScroll.settledToken)));let h=ta(c,p()&&m&&Qi()?`final`:void 0);return ro(h,!0),h})}let Ha=`content`,Ua=null,Wa=null,Ga=0,Ka=null,qa=null,Ja=null,Ya=null;function Xa(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Za(e){let t=Ka;if(!t)return!0;let n=o.virtualScroll?.heightDiffThresholdPx??1;return Math.abs(e.totalHeight-t.totalHeight)>n||e.sessionKey!==t.sessionKey||e.phase!==t.phase||e.stable!==t.stable||e.final!==t.final||e.threadKey!==t.threadKey||e.nodeCount!==t.nodeCount||e.measuredCount!==t.measuredCount||e.width!==t.width}function Qa(e=(e=>(e=o.virtualScroll)?.settledToken)()){return w0(e)}function $a(e,t){return[e,t.sessionKey,t.threadKey??``,Pi(),ha(),w0(o.virtualScroll?.settledToken),Math.round(t.totalHeight),Math.round(t.width)].join(`\0`)}function eo(){Ja=null,Ya=null,qa=null}function to(e){let t=e.heightCache;return t?.length?Ma(t):``}function no(e){let t=e.metrics,n=e.anchor?(r=e.anchor).type===`bottom`?`bottom:${Math.round(r.distanceFromBottomPx)}`:`node:${r.nodeIndex}:${Math.round(r.offsetWithinNodePx)}`:`none`;var r;return[e.sessionKey,e.threadKey??``,e.measurementKey??Pi(),e.contentHash??``,to(e),n,+!!e.anchorCaptured,t.liveRange.start,t.liveRange.end,t.renderedCount,t.nodeCount,Math.round(t.totalHeight),Math.round(t.width),t.phase,+!!t.stable].join(`\0`)}function ro(e,t=!1){if(!Lt.value||function(e=!1){return!e&&Pt.value&&!Rt.value}(t))return;let n=t||Za(e),r=function(e,t=!1){return t||e.stable||e.phase===`final`?{state:ga(e,{includeHeightCache:!0})}:{state:ga(e)}}(e,t).state,i=!!(r&&(n||function(e,t=!1){return!!t||no(e)!==qa}(r,t)));if(n&&(K(e),Ka=e,Ga=Xa()),r&&i&&(pe(r),r.anchor&&me(r.anchor),qa=no(r)),e.stable){let t=$a(`settled`,e);if(t!==Ja){Ja=t;let n=ga(e,{includeHeightCache:!0});n&&(pe(n),qa=no(n)),function(e){l(`render-settled`,e)}(e)}}if(e.phase===`final`){let t=$a(`final`,e);if(t!==Ya){Ya=t;let n=ga(e,{includeHeightCache:!0});n&&(pe(n),qa=no(n)),function(e){l(`render-final`,e)}(e)}}}function io(){Ua!=null&&(en?.(Ua),Ua=null),Wa!=null&&q&&(window.clearTimeout(Wa),Wa=null)}function ao(){Ua=null,Wa=null,function(e){if(Nr.size>0||Hr!=null)return!0;switch(e){case`node-resize`:case`async-node`:case`resize`:case`restore`:case`final`:case`manual`:return!0;default:return!1}}(Ha)&&(ho(),Ra()),ro(ta(Ha))}function oo(e){if(!Lt.value||(Ha=e,Ua!=null||Wa!=null))return;let t=Math.max(0,o.virtualScroll?.emitIntervalMs??32),n=Math.max(0,t-(Xa()-Ga)),r=()=>{Wa=null,Ua=$t?$t(ao):null,Ua??ao()};q&&n>0?Wa=window.setTimeout(r,n):r()}function so(){jn.value+=1}function co(e){if(cn.value&&e>=ln.value){let t=yt.value[e],n=!0===Ke.value&&!0!==qe.value&&e>=yt.value.length-2,r=t?.type===`code_block`||t?.type===`image`||t?.type===`mermaid`||t?.type===`infographic`;if(!n||r)return!1}return!xr.value||e=Ae.value&&(xe.value||(xe.value=!0,oi()),!wr.value||!Qt))return lo(e),void(t&&ii(e,!0));if(e{if(ni.delete(e),!xr.value||$r.value.has(e))return;let t=_n.get(e);if(!t)return;let n=Be(t),r=t.ownerDocument||document,i=r.defaultView||window,a=!n||n===r.documentElement||n===r.body,o=!a&&n?ft(`nodeVisibilityFallback.root.getBoundingClientRect`,()=>n.getBoundingClientRect()):null,s=a?0:o.top,c=a?ft(`nodeVisibilityFallback.clientHeight`,()=>i.innerHeight??n?.clientHeight??0):o.bottom,l=ft(`nodeVisibilityFallback.node.getBoundingClientRect`,()=>t.getBoundingClientRect());l.bottom>=s-500&&l.top<=c+500&&ii(e,!0)},1800+t);ni.set(e,n)}(e);let i=null;i=s(()=>r.isVisible.value,t=>{if(t){ri(e),ii(e,!0),i?.(),ti.delete(e),ei.get(e)===r&&ei.delete(e);try{r.destroy()}catch{}}},{immediate:!0}),ti.set(e,i),qt.value&&Qr()}function fo(){Hr=null,mr(()=>{let e=!1;for(let[t,n]of Nr)Nr.delete(t),kr.get(t)===n.el&&Ar.get(t)===n.version&&(e=vr(t,n.height,{allowShrink:n.allowShrink})||e);return e})}function po(){Hr!=null&&(en?.(Hr),Hr=null),Nr.clear()}function mo(e,t){(function(e,t,n){if(!Number.isFinite(n)||n<=0||kr.get(e)!==t)return;let r=Ar.get(e);if(r==null)return;let i=yt.value[e],a=Ye.value&&!0!==qe.value&&!o.nodes?.length&&e>=yt.value.length-2,s=!(!0===i?.loading||a),c=Nr.get(e),l=c?c.allowShrink&&s:s,u=c&&!l?Math.max(c.height,n):n;Nr.set(e,{height:u,allowShrink:l,version:r,el:t}),Hr??(Hr=$t?$t(fo):null,Hr??fo())})(e,t,yr(e,t))}function ho(){for(let[e,t]of kr)t&&mo(e,t)}function go(){bn?.disconnect(),bn=null,vn.clear()}function _o(){for(;Mr.length;)Kr(Mr.pop())}s(Rt,e=>{e&&oo(`content`)},{flush:`post`}),t({getVirtualMetrics:ta,captureVirtualState:function(e={}){var t;return ga(ta(`manual`),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!0===e.allowFallbackAnchor,requireViewport:!0===e.requireViewport,includeEmptyState:(t=e.includeEmptyState)==null||t})},restoreVirtualState:function(e,t={}){let n=!0===t.restoreAnchor,r=t.restoreToken==null?`imperative`:String(t.restoreToken);Aa=e,ja={restoreAnchor:n,restoreToken:r,allowUncapturedAnchor:!0===t.allowUncapturedAnchor},!Pa(e,{restoreAnchor:n,restoreToken:r,allowUncapturedAnchor:!0===t.allowUncapturedAnchor})&&Ia(e)||(Aa=null,ja=null)},forceMeasure:function(e=`manual`){return aY(this,null,function*(){yield n(),yield za(),ho(),Ra(),yield n();let t=ta(e);return ro(t,!0),t})},settle:Va,scrollToNode:function(e,t=`start`){ba(),qn();let r=yt.value.length;if(r<=0)return;let i=ui(e,0,r-1),a=()=>{let e=Kn({nodeIndex:i,offsetWithinNodePx:0}),n=Bn(i),r=na()?.clientHeight??0,a=Wn(),o=e;if(t===`center`)o=e-r/2+n/2;else if(t===`end`)o=e-r+n;else if(t===`nearest`&&a!=null){if(e>=a&&e+n<=a+r)return;o=eJt.value,e=>{if(!e){go();for(let e of jr.values())for(let t of e)Kr(t);jr.clear(),Ar.clear(),_o(),po()}},{immediate:!0}),s(qe,e=>{e&&function(){if(q&&qe.value&&kr.size){_o();for(let e of[80,240,640]){let t=Gr(e,()=>{for(let[e,t]of kr)t&&mo(e,t)},`final`);t!=null&&Mr.push(t)}}}(),oo(e?`final`:`content`)});let vo=_1(()=>oo(`content`),16),yo=_1(()=>oo(`batch`),16);s([()=>yt.value.length,()=>ln.value],()=>{Pn.value&&xa(),vo()},{flush:`post`,immediate:!0}),s([()=>Dr.start,()=>Dr.end],()=>{yo()},{flush:`post`});let{cleanupBatchScheduler:bo}=function(e){let{props:t,isClient:r,isTestEnv:i,parsedNodesIdentity:a,parsedNodeCount:o,desiredRenderedCount:c,datasetKey:l,batchingEnabled:u,incrementalRenderingActive:d,resolvedBatchSize:f,resolvedInitialBatch:p,renderedCount:m,adaptiveBatchSize:h,previousRenderContext:g,previousBatchConfig:_,requestFrame:v,cancelFrame:y,hasIdleCallback:b,cleanupNodeVisibility:x,onDatasetKeyChanged:S,onDatasetChanged:C}=e,w=null,T=`raf`,E=null,D=0,O=!1,k=!1,A=new Set,j=new Set;function M(){if(r){w!=null&&(T===`raf`&&y?y(w):T===`idle`&&typeof window.cancelIdleCallback==`function`?window.cancelIdleCallback(w):T===`timeout`&&window.clearTimeout(w),w=null),D+=1;for(let e of A)y&&y(e);for(let e of j)window.clearTimeout(e);A.clear(),j.clear(),E=null,O=!1,k=!1}}function N(){return typeof performance<`u`?performance.now():Date.now()}function ee(e){(function(e){if(!d.value)return;let n=Math.max(2,t.renderBatchBudgetMs??6),r=Math.max(1,f.value||1),i=Math.max(1,Math.floor(r/4));e>1.5*n?h.value=Math.max(i,Math.floor(.8*h.value)):e<.6*n&&h.value=o)return;let s=Math.max(1,e),l=()=>{let e=N();w=null;let i=E??s;E=null;let a=N();m.value=Math.min(o,m.value+i),x(m.value),function(e,i){if(!r)return void ee(i);O=!0;let a=++D;n().then(()=>{if(a!==D)return;let n=N(),r=Math.max(i,n-e),o=()=>{a===D&&ee(r)};if(v){let e=null,n=null,r=!1,i=()=>{r||(r=!0,e!==null&&(A.delete(e),e=null),n!==null&&(j.delete(n),window.clearTimeout(n),n=null),o())};e=v(()=>{i()}),A.add(e),n=window.setTimeout(()=>{e!==null&&y&&y(e),i()},Math.max(32,t.renderBatchIdleTimeoutMs??120)),j.add(n);return}let s=window.setTimeout(()=>{j.delete(s),o()},0);j.add(s)})}(e,N()-a)};if(!r||a.immediate)return void l();let u=Math.max(0,t.renderBatchDelay??16);if(E=E==null?s:Math.max(E,s),w==null){if(!i&&b&&window.requestIdleCallback){let e=Math.max(0,t.renderBatchIdleTimeoutMs??120);T=`idle`,w=window.requestIdleCallback(()=>l(),{timeout:e});return}if(v&&!i)return T=`raf`,void(w=v(()=>{u===0?l():(T=`timeout`,w=window.setTimeout(()=>l(),u))}));T=`timeout`,w=window.setTimeout(()=>l(),u)}}function F(e,t={}){O?k=!0:e==null?I():P(e,t)}function I(){d.value&&P(u.value?Math.max(1,Math.round(h.value)):Math.max(1,f.value))}return s([a,o,l,d,f,p,()=>t.renderBatchDelay],()=>{let e=o.value,n=g.value,i=l.value,a=!Object.is(i,n.key),s=e!==n.total,u=a||s;g.value={key:i,total:e};let v=_.value,y=t.renderBatchDelay??16,b=v.batchSize!==f.value||v.initial!==p.value||v.delay!==y||v.enabled!==d.value;_.value={batchSize:f.value,initial:p.value,delay:y,enabled:d.value},a&&S(e),(u||b||!d.value)&&M(),(u||b)&&(h.value=Math.max(1,f.value||1)),u&&C();let w=c.value;if(!e)return m.value=0,void x(0);if(!d.value)return m.value=w,void x(m.value);m.value=a||n.total===0||b?Math.min(w,p.value):Math.min(m.value,w);let T=Math.max(1,p.value||f.value||e);m.value{d.value&&(typeof t==`number`&&e<=t||e>m.value&&F())}),{cleanupBatchScheduler:M}}({props:G,isClient:q,isTestEnv:nn,parsedNodesIdentity:Ct,parsedNodeCount:wt,desiredRenderedCount:Ur,datasetKey:Ri,batchingEnabled:sn,incrementalRenderingActive:cn,resolvedBatchSize:an,resolvedInitialBatch:on,renderedCount:ln,adaptiveBatchSize:dn,previousRenderContext:un,previousBatchConfig:fn,requestFrame:$t,cancelFrame:en,hasIdleCallback:tn,cleanupNodeVisibility:ai,onDatasetKeyChanged:e=>{po(),gr(),zn(),eo(),e>0&&or(e)},onDatasetChanged:()=>{qt.value&&Qr({immediate:!0})}});s([Tr,qt,()=>ge.value,()=>je()],([e,t])=>{if(!e)return si(),void Zr();ci(),t?Qr({immediate:!0}):Zr()},{flush:`post`,immediate:!0}),s([()=>yt.value.length,()=>qt.value],e=>aY(null,[e],function*([e,t]){t&&e&&q&&(yield n(),Qr({immediate:!0}))}),{flush:`post`}),s(zt,e=>{e&&function(){if(Tt.value&&Et.value&&Dt.value&&Ot.value?.[1])return;let e=g({type:`paragraph`,children:[{type:`text`,content:`Probe paragraph text`,raw:`Probe paragraph text`}],raw:`Probe paragraph text`}),t=g({type:`list_item`,children:[e],raw:`- Probe paragraph text`}),n=g({type:`list`,ordered:!1,items:[t],raw:`- Probe paragraph text`});Tt.value=e,Et.value=t,Dt.value=n;let r={1:null,2:null,3:null,4:null,5:null,6:null};for(let e=1;e<=6;e++)r[e]=g({type:`heading`,level:e,text:`Probe heading`,children:[{type:`text`,content:`Probe heading`,raw:`Probe heading`}],raw:`${`#`.repeat(e)} Probe heading`});Ot.value=r}()},{immediate:!0}),s([()=>ge.value,zt],()=>{if(!zt.value)return _i(),void(we.value=0);hi(),_i(),zt.value&&ge.value&&typeof ResizeObserver<`u`&&(gi=new ResizeObserver(()=>{hi(),Un.value&&Jn(),Pn.value&&xa(),oo(`resize`)}),gi.observe(ge.value))},{immediate:!0}),s([zt,Ut,Li],()=>aY(null,null,function*(){if(!zt.value)return Te.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void zn();yield n(),function(){if(!zt.value||typeof window>`u`)return Te.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void zn();let e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},t=pi(fi(_e.value),`.paragraph-node`);e.paragraph=p1(_e.value,t,`pre-wrap`);let n=fi(ve.value)?.querySelector(`.paragraph-node`);e.listItem=p1(ve.value,n,`pre-wrap`);let r=ft(`readSimpleTextProbeProfile.list.offsetHeight`,()=>ye.value?.offsetHeight??0),i=ft(`readSimpleTextProbeProfile.listItem.offsetHeight`,()=>ve.value?.offsetHeight??0);e.listWrapperOverhead=Math.max(0,r-i);for(let t=1;t<=6;t++){let n=pi(fi(be[t]),`h${t}`);e.headings[t]=p1(be[t],n,`pre-wrap`)}Te.value=e,zn()}()}),{flush:`post`,immediate:!0}),s(()=>yt.value.length,()=>{qt.value&&Qr({immediate:!0})}),s([zt,we],()=>{zn(),qt.value&&Qr({immediate:!0}),Un.value&&Jn(),Pn.value&&xa(),oo(`resize`)},{immediate:!1}),s(()=>xr.value,e=>{if(e)for(let[e,t]of _n)uo(e,t);else if(oi(),qt.value)Qr({immediate:!0});else for(let[e,t]of _n)t&&ii(e,!0)},{immediate:!1}),s([ke,Ae,()=>je()],()=>{var e;(e=Qt.refresh)==null||e.call(Qt);for(let[e,t]of _n)uo(e,t)},{immediate:!1}),s([()=>G.viewportPriority,()=>yt.value.length,Ae],([e,t,n])=>{if(!1!==e){if(xe.value&&(t<=200||t<=n)){xe.value=!1;for(let[e,t]of _n)uo(e,t)}}else xe.value=!1}),s(()=>ln.value,()=>{qt.value&&Qr({immediate:!0})}),s([Er,Gt,Kt,()=>yt.value.length,qt],()=>{Or()},{immediate:!0});let xo=null,So=!1,Co=null;function wo(){xo=null,qi=null,Ki=void 0,Ji=null,eo()}function To(){po(),gr(),zn(),Sn.clear();let e=yt.value.length;e>0&&or(e),La()}function Eo(){io(),qr(),Ka=null,Da=null,Oa=null,ka=null,Aa=null,ja=null,So=!1,wo(),Hi(`restore`),qn(),ba()}function Do(e){return[J()??``,ji(),Pi(),Ii.value,Qa(e),yt.value.length,Math.round(Vn(0,yt.value.length)),Math.round(Fi()),$n.count,Math.round($n.total)].join(`:`)}function Oo(){return aY(this,null,function*(){let e=o.virtualScroll?.settledToken,t=Qa(e),r=ji(),i=J(),a=Li.value;if(Lt.value&&o.virtualScroll?.settleMode===`manual`&&Yi(e))if(Zi()){if(Do(e)!==Ji&&!So){So=!0;try{let e=yield Va({reason:`manual`,expectedSettledTokenKey:t}),n=Qa()===t;Ba(r,i,a)&&e.sessionKey===r&&e.threadKey===i&&n&&e.stable&&e.phase===`final`&&(Ji=Do(o.virtualScroll?.settledToken))}finally{So=!1,yield n();let e=o.virtualScroll?.settledToken,t=Yi(e)?Do(e):``;Ba(r,i,a)&&t&&Ji!==t&&Oo()}}}else oo(`manual`)})}s(Lt,(e,t)=>{if(e!==t){if(!e)return Eo(),void io();Eo(),To(),Co=Li.value,oo(`content`)}},{flush:`post`}),s([Lt,Li],([e,t])=>{e?Co==null?Co=t:Co!==t&&(Co=t,function(e=`resize`){po(),gr(),zn(),Sn.clear();let t=yt.value.length;t>0&&or(t),La(),Da=null,Oa=null,ka=null,Ka=null,So=!1,wo(),Na(),n(()=>{ho(),Un.value&&Jn(),Pn.value&&xa(),oo(e)})}(`resize`)):Co=null},{flush:`post`,immediate:!0}),s([Lt,()=>ji(),()=>J()],([e])=>{e&&(Eo(),To(),Hi(`content`),oo(`content`))}),s([Lt,()=>ji(),()=>J(),Li,()=>yt.value.length],([e])=>{e&&function(e=`async-node`){let t=!1;for(let[e,n]of Array.from(zr.entries()))Bi(n)||(zr.delete(e),Rr.delete(e),t=!0);t&&(zi(),oo(e))}(`async-node`)},{flush:`post`}),s([Lt,()=>o.virtualScroll?.sessionKey,()=>o.virtualScroll?.measurementKey,()=>o.indexKey,()=>Ce.value],([e])=>{e&&(eo(),function(e=`content`){if(!Lt.value)return;let t=[],n=yt.value.length,r=di(n);for(let e of Array.from(Sn.keys())){if(e>=n){t.push(e);continue}if(e=n&&Sn.delete(e);t.length&&(function(e,t={}){let n=Array.from(e,Number);pr(n);let r=0;if(mr(()=>(r=cr(n,t),r>0)),r>0)(function(e){for(let t of e)Sn.delete(t)})(n);else for(let e of n)On.delete(e)}(t,{notify:!1}),zn(),wo(),Un.value&&Jn(),Pn.value&&xa(),oo(e))}(`content`))},{flush:`post`,immediate:!0}),s([Lt,()=>yt.value.length,()=>ji(),()=>J()],([e,t,n,r],[i,a,o,s])=>{e&&i&&n===o&&r===s&&t!==a&&wo()},{flush:`post`}),s([Lt,()=>o.virtualScroll?.heightCache,()=>o.virtualScroll?.heightCacheWidth,()=>o.virtualScroll?.restoreState,()=>o.virtualScroll?.measurementKey,()=>yt.value.length,()=>ji(),we],()=>{Na()},{flush:`post`,immediate:!0}),s([Lt,()=>o.virtualScroll?.restoreState,()=>o.virtualScroll?.restoreAnchor,()=>o.virtualScroll?.measurementKey,()=>yt.value.length,()=>ji(),we],e=>aY(null,[e],function*([e,t]){if(!e||!t)return;yield n();let r=function(){let e=o.virtualScroll?.restoreAnchor;return e==null||!1===e?null:!0===e?`true`:String(e)}();Pa(t,{restoreAnchor:r!=null,restoreToken:r??void 0})}),{flush:`post`,immediate:!0}),s([Lt,we,()=>o.virtualScroll?.restoreState,()=>o.virtualScroll?.measurementKey],([e])=>{if(!e)return;let t=o.virtualScroll?.restoreState;t&&Da&&Oa===`restore`&&(wa(t)||(To(),Da=null,Oa=null,oo(`resize`)))},{flush:`post`}),s([Lt,()=>yt.value.length,()=>ji(),we],e=>aY(null,[e],function*([e]){let t=Aa,r=ja;e&&t&&(yield n(),!Pa(t,{restoreAnchor:!0===r?.restoreAnchor,restoreToken:r?.restoreToken??`imperative`,allowUncapturedAnchor:!0===r?.allowUncapturedAnchor})&&Ia(t)||(Aa=null,ja=null))}),{flush:`post`,immediate:!0}),s([Lt,qe,()=>o.virtualScroll?.settleMode,()=>ji(),()=>J(),Li,Vr,Lr,()=>ln.value,Ur,()=>$n.count,()=>$n.total],([e,t,n])=>{if(!e||!0!==t||n===`manual`||!$i())return;let r=function(){let e=yt.value.length;return[J()??``,ji(),Pi(),Ii.value,e,Math.round(Vn(0,e)),Math.round(Fi()),$n.count,Math.round($n.total)].join(`:`)}();xo!==r&&(xo=r,Va({reason:`final`}).then(e=>{e.stable||xo!==r||(xo=null)}))},{flush:`post`,immediate:!0}),s([Lt,qe,()=>o.virtualScroll?.settleMode,()=>o.virtualScroll?.settledToken,()=>ji(),()=>J(),Li,Vr,Lr,()=>ln.value,Ur,()=>yt.value.length,()=>$n.count,()=>$n.total],()=>{Oo()},{flush:`post`,immediate:!0}),s([()=>yt.value.length,qt,Gt,Kt,()=>Dr.start,()=>Dr.end],([e,t,n,r,i,a])=>{Pe.value&&rt(`virtualization`,{nodes:e,virtualization:t,maxLiveNodes:n,buffer:r,focusIndex:Er.value,scroll:t?(()=>{let e=Nn.value||Be();return e?{reverse:Ve(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:i,end:a},rendered:ln.value})}),s([()=>G.customId],([e],t,n)=>{if(!e||kt)return;let r=function(e,t){return e?(e1.controllers[e]=t,()=>{e1.controllers[e]===t&&delete e1.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Yn,restoreAnchor:Xn,getAnchorDrift:Zn,getReport:Oi});n(()=>{r()})},{immediate:!0}),ne(()=>{(function(){if(Lt.value)try{ho(),Ra();let e=ta(`manual`);Za(e)&&(K(e),Ka=e,Ga=Xa());let t=ga(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});t&&(pe(t),t.anchor&&me(t.anchor),qa=no(t))}catch{}})(),bo(),oi(),tt(),go();for(let e of jr.values())for(let t of e)Kr(t);jr.clear(),Ar.clear(),Sn.clear(),_o(),po(),_i(),qn(),ba(),io(),si(),Zr()});let ko=XX(`ViewportDeferredMermaidBlockNode`,i({loader:()=>aY(null,null,function*(){try{return(yield he(()=>import(`./index11-BMhFgxFV.js`),__vite__mapDeps([35,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".`,e),qX}}),loadingComponent:S0,delay:0}),S0),Ao=XX(`ViewportDeferredInfographicBlockNode`,i({loader:()=>aY(null,null,function*(){try{return(yield he(()=>import(`./index10-Dhnug51i.js`),__vite__mapDeps([36,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.`,e),qX}}),loadingComponent:x0,delay:0}),x0),jo=XX(`ViewportDeferredD2BlockNode`,i(()=>aY(null,null,function*(){try{return(yield he(()=>import(`./index8-BKeFA_Sf.js`),__vite__mapDeps([37,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".`,e),qX}})),qX),Mo={text:YX,paragraph:tQ,heading:HZ,code_block:QX,list:JZ,list_item:qZ,blockquote:AZ,table:lQ,definition_list:PZ,footnote:zZ,footnote_reference:TY,footnote_anchor:IZ,admonition:R0,vmr_container:mQ,hardbreak:SZ,link:mZ,image:OX,thematic_break:dQ,math_inline:$X,math_block:eZ,strong:sZ,emphasis:bZ,strikethrough:lZ,highlight:vZ,insert:gZ,subscript:aZ,superscript:rZ,emoji:SY,checkbox:bY,checkbox_input:bY,inline_code:VY,html_inline:RY,reference:tZ,html_block:QZ},No=L(()=>ki()),Po=L(()=>h1(G.codeBlockProps)),Fo=L(()=>h1(G.codeBlockProps,{omit:[`langs`]})),Io=L(()=>rY(rY({stream:G.codeBlockStream,darkTheme:G.codeBlockDarkTheme,lightTheme:G.codeBlockLightTheme,monacoOptions:G.codeBlockMonacoOptions,themes:G.themes,langs:A.value===`shiki`?G.langs:void 0,minWidth:G.codeBlockMinWidth,maxWidth:G.codeBlockMaxWidth},typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{}),Fo.value)),Lo=L(()=>rY(iY(rY({},Io.value),{langs:G.langs}),Po.value));function Ro(e){return typeof e==`boolean`?e:void 0}let zo=L(()=>{let e=G.codeBlockProps||{},t={},n=Ro(e.showLineNumbers);n!==void 0&&(t.showLineNumbers=n);let r=Ro(e.diffInline);r!==void 0&&(t.diffInline=r);let i=function(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}(e.reservedHeightPx);return i!==void 0&&(t.reservedHeightPx=i),t}),Bo=L(()=>rY(rY({stream:G.codeBlockStream,darkTheme:G.codeBlockDarkTheme,lightTheme:G.codeBlockLightTheme,themes:G.themes,langs:G.langs,minWidth:G.codeBlockMinWidth,maxWidth:G.codeBlockMaxWidth},typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{}),Po.value)),Vo=L(()=>rY({},G.mermaidProps||{})),Ho=L(()=>rY({},G.d2Props||{})),Uo=L(()=>rY({},G.infographicProps||{})),Wo=L(()=>({typewriter:D.value,fade:G.fade,customHtmlTags:vt.value.customHtmlTags})),Go=L(()=>rY(rY({},Wo.value),typeof Fe.value==`boolean`?{showTooltip:Fe.value}:{})),Ko=L(()=>rY(rY({},Wo.value),typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{})),qo=L(()=>rY(rY({},Wo.value),typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{})),Jo=L(()=>rY(rY({},Wo.value),typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{}));function Yo(e){return Array.isArray(e.children)&&e.children.length>0}let Xo=L(()=>wi.value.map(e=>{let t=function(e){if(e.type!==`code_block`)return e;let t=e,n=[String(t.language??``),String(t.loading??``),String(t.diff??``),String(t.code??``),String(t.originalCode??``),String(t.updatedCode??``),String(t.raw??``)].join(`\0`),r=xn.get(t);if(r&&r.signature===n)return r.node;let i=rY({},t);return xn.set(t,{signature:n,node:i}),i}(e.node),n=Zo(t),r=ns(t,n);if((t.type===`html_block`||t.type===`html_inline`)&&r===Mo[t.type]){let e=t,n=String(e.tag??``).trim().toLowerCase()||bL(e.content);if(n){let i=gt.value[n];if(_t.value.has(n)&&i)r=i,t=iY(rY({},e),{type:n,tag:n,content:CL(e.content,n)});else if(SL(e.content??e.raw,n)){let n=String(e.content??e.raw??``);t.type===`html_inline`?(r=YX,t={type:`text`,content:n,raw:n}):(r=tQ,t={type:`paragraph`,children:[{type:`text`,content:n,raw:n}],raw:n})}}}let i=t.type===`code_block`&&A.value===`pre`&&r===qX&&!Qo(gt.value,n),a=rY({},function(e,t,n){let r=t??Zo(e);if(e.type===`code_block`){let t=r?Qo(gt.value,r):void 0;if(n&&A.value===`pre`&&!t&&n===qX)return zo.value;if(n&&r&&n===t)return r===`mermaid`?es(e):r===`infographic`?ts(e):r===`d2`||r===`d2lang`?Ho.value:Lo.value;if(n&&n===gt.value.code_block)return Lo.value;if(yi(n))return Bo.value}return r===`mermaid`?es(e):r===`infographic`?ts(e):r===`d2`||r===`d2lang`?Ho.value:e.type===`link`?Go.value:e.type===`list`?Ko.value:e.type===`blockquote`?qo.value:e.type===`table`?Jo.value:e.type===`code_block`?Io.value:Wo.value}(t,n,r)),o=zt.value?Ci.value[e.index]:null;t.type===`code_block`&&o?.kind===`code-block`&&(a=iY(rY({},a),i?{reservedHeightPx:o.height??o.contentHeight}:{estimatedHeightPx:o.height,estimatedContentHeightPx:o.contentHeight,estimatedDiffInline:o.diffInline})),i||t.type!==`code_block`||n!==`mermaid`||oJ(a.estimatedPreviewHeightPx)!=null||(a=iY(rY({},a),{estimatedPreviewHeightPx:dJ(cJ(String(t.code??``)))})),i||t.type!==`code_block`||n!==`infographic`||oJ(a.estimatedPreviewHeightPx)!=null||(a=iY(rY({},a),{estimatedPreviewHeightPx:fJ(lJ(String(t.code??``)))})),t.type===`math_block`&&(a=iY(rY({},a),{cacheScope:ht}));let s=function(e,t){let n=String(e.type);return!fY(n)&>.value[n]===t}(t,r),c=s?jY(t,Ie.value):void 0;return iY(rY({},e),{node:t,component:r,bindings:a,customBindings:rY(rY({},c??{}),a),rendersCustomNode:s,hasSlotChildren:Yo(t),slotContent:String(t.content??``),isCodeBlock:t.type===`code_block`,indexKey:`${No.value}-${e.index}`,vnodeKey:`${Mi.value}\0${e.index}\0${t.type}`})}));function Zo(e){return e?.type===`code_block`?String(e.language??``).trim().toLowerCase():``}function Qo(e,t){let n=t.trim().toLowerCase();if(n)for(let t of[n,Tq(n),JK(n)]){let n=t&&e[t];if(n)return n}}function $o(e,t,n,r){let i=rY({},e.value);return oJ(i.estimatedPreviewHeightPx)??(i.estimatedPreviewHeightPx=r(n(String(t?.code??``)),void 0,i.maxHeight===`none`?null:oJ(i.maxHeight)??void 0)),i}function es(e){return $o(Vo,e,cJ,dJ)}function ts(e){return $o(Uo,e,lJ,fJ)}function ns(e,t){if(!e)return pQ;let n=gt.value,r=n[String(e.type)];if(e.type===`code_block`){let i=t??Zo(e);return(i?Qo(n,i):void 0)||(A.value===`pre`?n.code_block||qX:i===`mermaid`?n.mermaid||ko:i===`infographic`?n.infographic||Ao:i===`d2`||i===`d2lang`?n.d2||jo:r||n.code_block||bi.value)}return r||Mo[String(e.type)]||pQ}function rs(e){l(`click`,e)}function is(e){var t;(t=e.target)!=null&&t.closest(`[data-node-index]`)&&l(`mouseover`,e)}function as(e){var t;(t=e.target)!=null&&t.closest(`[data-node-index]`)&&l(`mouseout`,e)}function os(e){l(`mouseover`,e)}function ss(e){l(`mouseout`,e)}let cs=R(null),ls=R(!1),us=R(null),ds=L(()=>!(G.domMode!==`minimal`||Ne.value||!1!==G.fade||D.value||ls.value||pn.value||qt.value||Ft.value||Mt.value||Zt.value||Object.keys(gt.value).length!==0)),fs,ps=null,ms=0,hs=0,gs=0,_s=[`code_block`,`admonition`,`table`,`math_block`,`html_block`,`image`,`thematic_break`],vs=new Set(_s),ys=[`.typewriter-cursor`,`.height-estimation-probes`,..._s.map(e=>`[data-node-type="${e}"]`),`script`,`style`].join(`,`);function bs(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return typeof t==`string`&&vs.has(t)}function xs(e){if(!e||typeof e!=`object`)return 0;let t=e,n=t.raw??t.content??t.code;if(typeof n==`string`)return n.length;let r=t.children;if(Array.isArray(r))return r.reduce((e,t)=>e+xs(t),0);let i=t.items;return Array.isArray(i)?i.reduce((e,t)=>e+xs(t),0):0}function Ss(){fs&&=(clearTimeout(fs),void 0)}function Cs(){ms+=1,ps!=null&&(en?.(ps),ps=null)}function ws(){Cs(),Os(),cs.value&&(cs.value.style.visibility=`hidden`)}function Ts(e){if(e.nodeType!==Node.TEXT_NODE||!(e.textContent??``).trim())return!1;let t=e.parentElement;return!!t&&!t.closest(ys)}function Es(e){let t=e.lastChild;for(;t;){if(Ts(t))return t;if(t.nodeType===Node.ELEMENT_NODE){let e=t;if(!e.matches(ys)&&e.lastChild){t=e.lastChild;continue}}for(;t&&t!==e&&!t.previousSibling;)t=t.parentNode;if(!t||t===e)break;t=t.previousSibling}return null}function Ds(){let e=Xo.value;for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n||bs(n.node)||!co(n.index))continue;let r=_n.get(n.index);if(!r)continue;let i=Es(r);if(i)return i}return null}function Os(){us.value&&=(us.value.classList.remove(D0),null)}function ks(){if(T.value!==`simple`||!q||!ls.value||!ge.value)return void Os();let e=Ds(),t=e?function(e){let t=e.parentElement?.closest(`.text-node`);return t instanceof HTMLElement?t:e.parentElement}(e):null;t!==us.value&&(Os(),t&&(t.classList.add(D0),us.value=t))}function As(){if(T.value!==`precise`||!q||!ls.value||ps!=null)return;let e=ms,t=()=>{ps=null,e===ms&&function(){if(T.value!==`precise`||!(q&&ls.value&&ge.value&&cs.value))return;let e=ge.value,t=cs.value;t.style.visibility=`hidden`;let n=Ds();if(!n)return;let r=0,i=0,a=20,o=!1;if(n?.textContent){let t=n.textContent.length,s=document.createRange();s.setStart(n,Math.max(0,t-1)),s.setEnd(n,t);let c=typeof s.getClientRects==`function`?s.getClientRects():void 0,l=c?.[c.length-1]??n.parentElement?.getBoundingClientRect();if(l){let t=ft(`typewriterCursor.root.getBoundingClientRect`,()=>e.getBoundingClientRect());r=l.right-t.left+e.scrollLeft,i=l.top-t.top+e.scrollTop,a=l.height||a,o=!0}s.detach()}o&&(t.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,t.style.height=`${a}px`,t.style.visibility=`visible`)}()};$t?ps=$t(t):t()}return s([Ge,()=>o.content,()=>o.nodes,()=>G.typewriter,qe],()=>aY(null,null,function*(){if(!q||Ne.value||!Re.value)return;if(qe.value)return ls.value=!1,Ss(),void ws();if(o.nodes?.length)return ls.value=!1,Ss(),ws(),hs=(o.content??``).length,void(gs=Ge.value.length);let e=function(){return o.nodes?.length?o.nodes.reduce((e,t)=>e+xs(t),0):(o.content??``).length}(),t=function(){return o.nodes?.length?o.nodes.reduce((e,t)=>e+xs(t),0):Ge.value.length}(),r=!bs(yt.value[yt.value.length-1]),i=e>hs,a=t>gs;if(!D.value||!r||!i&&!a)return D.value&&r||(ls.value=!1,ws()),hs=e,void(gs=t);hs=e,gs=t,ls.value=!0,T.value===`precise`&&cs.value&&(cs.value.style.visibility=`hidden`),Ss(),yield n(),T.value===`simple`?ks():(Os(),As()),fs=setTimeout(()=>{fs=void 0,ls.value=!1},3e3)}),{flush:`post`,immediate:!0}),s(ls,e=>aY(null,null,function*(){e?(yield n(),T.value===`simple`?ks():(Os(),T.value===`precise`&&As())):ws()}),{flush:`post`}),s(T,()=>aY(null,null,function*(){if(q&&!Ne.value&&Re.value&&ls.value){if(yield n(),T.value===`simple`)return Cs(),void ks();Os(),T.value===`precise`?As():ws()}}),{flush:`post`}),s([()=>ln.value,()=>Dr.start,()=>Dr.end],()=>aY(null,null,function*(){q&&!Ne.value&&Re.value&&ls.value&&(yield n(),T.value===`simple`?ks():(Os(),T.value===`precise`&&As()))}),{flush:`post`}),ne(()=>{Ss(),Cs(),Os(),mt.clear()}),(e,t)=>{let n=r(`NodeRenderer`,!0);return z(Ne)?(c(!0),W(M,{key:0},_(Xo.value,e=>(c(),W(M,{key:e.vnodeKey},[e.rendersCustomNode?(c(),P(x(e.component),re({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":G.customId,"is-dark":G.isDark,onClick:rs,onMouseover:os,onMouseout:ss,onCopy:t[0]||=e=>f(e),onHandleArtifactClick:t[1]||=e=>l(`handleArtifactClick`,e)}),{default:B(()=>[e.hasSlotChildren?(c(),P(n,re({key:0,ref_for:!0},St.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(n,re({key:1,ref_for:!0},St.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(x(e.component),re({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onClick:rs,onMouseover:os,onMouseout:ss,onCopy:t[2]||=e=>f(e),onHandleArtifactClick:t[3]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`]))],64))),128)):(c(),W(`div`,{key:1,ref_key:`containerRef`,ref:ge,class:V([`markstream-vue markdown-renderer`,[{dark:G.isDark},{virtualized:qt.value},{"virtual-scroll-coordinated":Rt.value},{"stable-layout":Cr.value},{"typewriter-simple-cursor":ls.value&&T.value===`simple`}]]),"data-custom-id":G.customId,onClick:rs,onMouseover:is,onMouseout:as},[Bt.value||qt.value?(c(),W(M,{key:0},[Bt.value?(c(),P(b0,{key:0,width:Ut.value,"flow-root":qt.value||Rt.value,"paragraph-node":Tt.value,"list-item-node":Et.value,"list-node":Dt.value,"heading-nodes":Ot.value,"set-paragraph-wrapper":Jr,"set-list-item-wrapper":Yr,"set-list-wrapper":Xr,"set-heading-wrapper":mi},null,8,[`width`,`flow-root`,`paragraph-node`,`list-item-node`,`list-node`,`heading-nodes`])):E(``,!0),qt.value?(c(),W(`div`,{key:1,class:`node-spacer`,style:ae({height:`${Ti.value}px`}),"aria-hidden":`true`},null,4)):E(``,!0)],64)):E(``,!0),ds.value?(c(!0),W(M,{key:1},_(Xo.value,e=>(c(),W(M,{key:e.vnodeKey},[co(e.index)?(c(),P(x(e.component),re({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onMouseover:t[4]||=e=>l(`mouseover`,e),onMouseout:t[5]||=e=>l(`mouseout`,e),onCopy:t[6]||=e=>f(e),onHandleArtifactClick:t[7]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):E(``,!0)],64))),128)):(c(!0),W(M,{key:2},_(Xo.value,e=>(c(),W(`div`,{key:e.vnodeKey,ref_for:!0,ref:t=>uo(e.index,t),class:`node-slot`,"data-node-index":e.index,"data-node-type":e.node.type},[co(e.index)?(c(),W(`div`,{key:0,ref_for:!0,ref:t=>function(e,t){t||function(e){let t=`${ki()}-${e}`,n=!1;for(let r of Array.from(Rr.keys()))(zr.get(r)?.index===e||r===t||r.startsWith(`${t}-`))&&(Rr.delete(r),zr.delete(r),n=!0);n&&(zi(),oo(`async-node`))}(e),Nr.delete(e),function(e){let t=(Ar.get(e)??0)+1;Ar.set(e,t)}(e);let n=jr.get(e);if(n){for(let e of n)Kr(e);jr.delete(e)}if(function(e){let t=vn.get(e);t&&(bn?.unobserve(t),yn.delete(t),vn.delete(e))}(e),!t||!Jt.value)return kr.delete(e),void Ar.delete(e);kr.set(e,t);let r=()=>{mo(e,t)};queueMicrotask(r);let i=(bn||typeof ResizeObserver>`u`||(bn=new ResizeObserver(e=>{if(e.length)for(let t of e){let e=yn.get(t.target),n=vn.get(e??-1);e!=null&&n&&mo(e,n)}else ho()})),bn);if(i&&(vn.set(e,t),yn.set(t,e),i.observe(t)),typeof window<`u`){let t=yt.value[e]?.type===`code_block`?[16,80,240,800]:qe.value?[80]:[];if(t.length){let n=t.map(e=>Gr(e,r,`node-resize`)).filter(e=>e!=null);n.length&&jr.set(e,n)}}}(e.index,t),class:`node-content`},[e.isCodeBlock?e.rendersCustomNode?(c(),P(x(e.component),re({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[12]||=e=>f(e),onHandleArtifactClick:t[13]||=e=>l(`handleArtifactClick`,e)}),{default:B(()=>[e.hasSlotChildren?(c(),P(n,re({key:0,ref_for:!0},St.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(n,re({key:1,ref_for:!0},St.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(x(e.component),re({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[14]||=e=>f(e),onHandleArtifactClick:t[15]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(oe,{key:0,name:`fade`,css:!1!==G.fade,appear:!1!==G.fade},{default:B(()=>[e.rendersCustomNode?(c(),P(x(e.component),re({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[8]||=e=>f(e),onHandleArtifactClick:t[9]||=e=>l(`handleArtifactClick`,e)}),{default:B(()=>[e.hasSlotChildren?(c(),P(n,re({key:0,ref_for:!0},St.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(n,re({key:1,ref_for:!0},St.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(x(e.component),re({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[10]||=e=>f(e),onHandleArtifactClick:t[11]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`]))]),_:2},1032,[`css`,`appear`]))],512)):(c(),W(`div`,{key:1,class:`node-placeholder`,style:ae({height:`${Bn(e.index)}px`})},null,4))],8,E0))),128)),ls.value&&T.value===`precise`?(c(),W(`span`,{key:3,ref_key:`typewriterCursorRef`,ref:cs,class:`typewriter-cursor`,"aria-hidden":`true`},null,512)):E(``,!0),qt.value?(c(),W(`div`,{key:4,class:`node-spacer`,style:ae({height:`${Ei.value}px`}),"aria-hidden":`true`},null,4)):E(``,!0)],42,T0))}}})),[[`__scopeId`,`data-v-a9489508`]]),k0=O0;k0.install=e=>{let t=new Set([`MarkdownRender`,`NodeRenderer`,k0.__name,k0.name].filter(e=>!!e));for(let n of t)e.component(n,O0)};var A0=Object.freeze(Object.defineProperty({__proto__:null,default:k0},Symbol.toStringTag,{value:`Module`})),j0={key:0,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},M0={key:1,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},N0={key:2,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},P0={key:3,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},F0={class:`admonition-title`},I0=[`aria-expanded`,`aria-controls`],L0=[`id`],R0=yY(G({__name:`AdmonitionNode`,props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:[`copy`],setup(e,{emit:t}){var n;let r=e,i=t,a=L(()=>{if(r.node.title&&r.node.title.trim().length)return r.node.title;let e=r.node.kind||`note`;return e.charAt(0).toUpperCase()+e.slice(1)}),o=R(!!r.node.collapsible&&!((n=r.node.open)==null||n));function s(){r.node.collapsible&&(o.value=!o.value)}let u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(t,n)=>(c(),W(`div`,{class:V([`admonition`,[`admonition-${r.node.kind}`]])},[F(`div`,{id:u,class:`admonition-legend`},[r.node.kind===`note`||r.node.kind===`info`?(c(),W(`svg`,j0,[...n[1]||=[F(`circle`,{cx:`12`,cy:`12`,r:`10`},null,-1),F(`path`,{d:`M12 16v-4`},null,-1),F(`path`,{d:`M12 8h.01`},null,-1)]])):r.node.kind===`tip`?(c(),W(`svg`,M0,[...n[2]||=[F(`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`},null,-1),F(`path`,{d:`M9 18h6`},null,-1),F(`path`,{d:`M10 22h4`},null,-1)]])):r.node.kind===`warning`||r.node.kind===`caution`?(c(),W(`svg`,N0,[...n[3]||=[F(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`},null,-1),F(`path`,{d:`M12 9v4`},null,-1),F(`path`,{d:`M12 17h.01`},null,-1)]])):r.node.kind===`danger`||r.node.kind===`error`?(c(),W(`svg`,P0,[...n[4]||=[F(`polygon`,{points:`7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2`},null,-1),F(`path`,{d:`M12 8v4`},null,-1),F(`path`,{d:`M12 16h.01`},null,-1)]])):E(``,!0),F(`span`,F0,U(a.value),1),r.node.collapsible?(c(),W(`button`,{key:4,class:`admonition-toggle`,"aria-expanded":!o.value,"aria-controls":`${u}-content`,onClick:s},[(c(),W(`svg`,{style:ae({rotate:o.value?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...n[5]||=[F(`path`,{d:`m9 18 6-6-6-6`},null,-1)]],4))],8,I0)):E(``,!0)]),l(F(`div`,{id:`${u}-content`,class:`admonition-content`,"aria-labelledby":u},[v(z(k0),{"index-key":`admonition-${e.indexKey}`,nodes:r.node.children,"custom-id":r.customId,typewriter:r.typewriter,fade:r.fade,onCopy:n[0]||=e=>i(`copy`,e)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])],8,L0),[[A,!o.value]])],2))}}),[[`__scopeId`,`data-v-a83480e1`]]);R0.install=e=>{e.component(R0.__name,R0)};var z0=()=>he(()=>import(`./d2_markstream-vue-xMoF3M5G.js`),[]),B0=null,V0=z0,H0=null,U0=!1,W0=!1,G0=0;function K0(){return aY(this,null,function*(){if(B0)return B0;let e=V0,t=G0;return e?e===z0&&U0?null:H0||(H0=aY(null,null,function*(){let n;try{n=yield e()}catch(n){if(e===z0)return t===G0&&e===V0&&(U0=!0,function(e){W0||(W0=!0,console.warn(`[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.`,e))}(n)),null;throw n}finally{t===G0&&e===V0&&(H0=null)}return t!==G0||e!==V0?null:n?(B0=function(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}(n),B0):null}),H0):null})}var q0=null,J0=null,Y0=null,X0=0;function Z0(){return typeof J0==`function`}function Q0(){return aY(this,null,function*(){if(q0)return q0;let e=J0,t=X0;return e?Y0||(Y0=aY(null,null,function*(){let n=yield e();if(t!==X0||e!==J0)return null;let r=function(e){if(!e)return null;let t=e.default??e,n=typeof t==`function`&&typeof t.prototype?.render==`function`?t:e.Infographic??t?.Infographic;return typeof n==`function`?n:null}(n);return t!==X0||e!==J0?null:r?(q0=r,q0):null}).finally(()=>{t===X0&&e===J0&&(Y0=null)}),Y0):null})}function $0(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)?t:0}function e2(e,t){e?.(t)}function t2(e,t){return e?(e2(t,`readElementBoxHeight.offsetHeight`),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function n2(e,t){let n=t2(e,t);if(!e||typeof window>`u`||typeof window.getComputedStyle!=`function`)return n;e2(t,`readElementOuterHeight.getComputedStyle`);let r=window.getComputedStyle(e),i=$0(r.marginTop),a=$0(r.marginBottom);return Math.ceil(Math.max(0,n+i+a))}function r2(e,t,n){if(!e)return 0;let r=function(e){return e?e.matches?.call(e,`.markstream-vue.markdown-renderer`)?e:e.querySelector(`.markstream-vue.markdown-renderer`):null}(e);if(!r)return 0;let i=Number.isFinite(n)?Number(n):n2(e,t),a=t2(r,t);return Math.max(0,i-a)}function i2(e,t,n){let r=n.getKey?.call(n,e,t)??e.id??t;return String(r)}function a2(e,t,n){return n.getKind?.call(n,e,t)??String(e.kind??``)}function o2(e,t,n){let r=n.getContent?.call(n,e,t)??e.content;return typeof r==`string`?r:``}function s2(e,t,n){let r=n.getFinal?.call(n,e,t);if(typeof r==`boolean`)return r;let i=e.final;return typeof i!=`boolean`||i}function c2(e,t,n){return n.getRevision?.call(n,e,t)??e.revision}function l2(e,t,n){let r=a2(e,t,n);return r===`assistant-markdown`||r===`markdown`||!r&&o2(e,t,n).length>0}function u2(e,t,n){let r=n.estimateItemHeight?.call(n,e,t);if(Number.isFinite(r)&&r>0)return r;let i=a2(e,t,n);return i===`assistant-markdown`||i===`markdown`?360:i===`system-divider`?44:i===`tool-call`?72:i===`thinking`?92:i===`error`?76:i===`user-message`?88:o2(e,t,n).length>0?360:96}var d2=Symbol(`markstreamLanguageIconResolver`);function f2(e){return i(e)}f2(()=>he(()=>import(`./index3-U5vX94Wy.js`),__vite__mapDeps([38,31,7,1,2]))),f2(()=>he(()=>import(`./index6-CGYWuLMy.js`),__vite__mapDeps([33,1,2]))),f2(()=>he(()=>import(`./index7-DOLmlvs-.js`),__vite__mapDeps([32,1,2]))),f2(()=>he(()=>import(`./index11-BMhFgxFV.js`),__vite__mapDeps([35,1,2]))),f2(()=>he(()=>import(`./index10-Dhnug51i.js`),__vite__mapDeps([36,1,2]))),f2(()=>he(()=>import(`./index8-BKeFA_Sf.js`),__vite__mapDeps([37,1,2]))),f2(()=>he(()=>import(`./index4-Wk5pGiJ7.js`),__vite__mapDeps([39,30,7,1,2]))),f2(()=>he(()=>import(`./index5-CCrZjPWg.js`),__vite__mapDeps([34,1,2,31,7]))),f2(()=>he(()=>import(`./index9-BNCeHK1v.js`),__vite__mapDeps([40,1,2])));var p2=`cjs.css.csv.gif.htm.html.jpeg.jpg.js.json.jsx.log.md.mjs.pdf.png.scss.svg.ts.tsx.txt.vue.webp.xml.yaml.yml`.split(`.`),m2=new Set([`AGENTS.md`,`CHANGELOG.md`,`Dockerfile`,`LICENSE`,`Makefile`,`README.md`,`package.json`,`pnpm-lock.yaml`,`pnpm-workspace.yaml`,`tsconfig.json`,`vite.config.ts`]),h2=[...p2].toSorted((e,t)=>t.length-e.length).join(`|`),g2=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${h2}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${h2})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?])`].join(``),`gi`),_2=/[),.;!?]+$/;function v2(e){let t=e.toLowerCase();return p2.some(e=>t.endsWith(`.${e}`))}function y2(e){let t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${h2}))["']`,`gi`),r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!e)continue;let n=e.split(`/`).pop();n&&t.set(n,e)}return t}function b2(e,t={}){let n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;let r=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!r)return null;let i=(r[1]??``).replace(_2,``);if(!i)return null;let a=i.split(`/`).pop()??i,o=i.includes(`/`),s=m2.has(a),c=v2(a);if(o&&!s&&!c)return null;if(!o&&!s){let e=t.aliases?.get(a);if(!e)return null;i=e}let l=r[2]??r[3],u=l?Number(l):void 0;return{path:i,line:u!==void 0&&Number.isFinite(u)&&u>0?u:void 0}}function x2(e,t={}){let n=[];g2.lastIndex=0;let r;for(;(r=g2.exec(e))!==null;){let e=r[0]??``,i=r[1]??``,a=e.indexOf(i);if(a<0)continue;let o=i+(r[2]??r[3]?e.slice(a+i.length):``),s=o.replace(_2,``),c=o.length-s.length;o=s;let l=b2(o,t);if(!l)continue;let u=r.index+a,d=u+o.length;n.push({...l,start:u,end:d,text:o}),c>0&&(g2.lastIndex-=c)}return n}var S2=12e4,C2=6e4,w2=32,T2=3e4,E2=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function D2(e){let t=0,n=0,r=0;E2.lastIndex=0;let i;for(;(i=E2.exec(e))!==null;){let e=i[3]??``;t+=1,n+=e.length,r=Math.max(r,e.length)}return{codeRenderer:e.length>=S2||n>=C2||t>=w2||r>=T2?`pre`:`shiki`,codeFenceCount:t,codeChars:n}}function O2(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}var k2=/\s/,A2=/\p{Nd}/u;function j2(e,t){let n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function M2(e,t){if(t<=0)return;let n=e.codePointAt(t-1),r=n!==void 0&&n>=55296&&n<=56319&&t>1?t-2:t-1,i=e.codePointAt(r);return i===void 0?void 0:String.fromCodePoint(i)}function N2(e){return e!==void 0&&k2.test(e)}function P2(e){return e!==void 0&&A2.test(e)}function F2(e){return e!==void 0&&e>=`A`&&e<=`Z`}var I2=new RegExp(String.raw`^(?:AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHF|CLF|CLP|CNY|COP|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SLL|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|UYU|UZS|VED|VES|VND|VUV|WST|XAF|XCD|XOF|XPF|YER|ZAR|ZMW|ZWL|HK|US|SG|AU|CA|NZ|NT|TW|RMB|MEX|TT|BZ|EU|UK)$`);function L2(e,t){if(!F2(e[t-1]))return!1;let n=t-1;for(;n>0&&F2(e[n-1]);)n--;return I2.test(e.slice(n,t))||P2(j2(e,t+1))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??``)&&!/\p{L}/u.test(j2(e,t+1)??``)}function R2(e,t){if(!F2(e[t-1]))return!1;let n=t-1;for(;n>0&&F2(e[n-1]);)n--;return I2.test(e.slice(n,t))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??``)}function z2(e,t){let n=e[t+1];return P2(j2(e,t+1))?!0:(n===`-`||n===`+`||n===`.`||n===`−`)&&P2(j2(e,t+2))}var B2=/^[-–—,;:~([/]$/;function V2(e,t){let n=e[t+1];if(n!==`-`&&n!==`+`&&n!==`.`||!P2(j2(e,t+2)))return!1;let r=e[t-1];return r!==void 0&&B2.test(r)}var H2=String.raw`[,;:~\-–—/\s()=*×]|and|or`;function U2(e){let t=e.replace(new RegExp(String.raw`^(?:${H2})+`,`u`),``);for(;;){let e=t.replace(new RegExp(String.raw`^\p{L}+(?:${H2})+`,`u`),``).replace(/^[\p{L}][\p{L} ]*(?=\p{Nd})/u,``);if(e===t)break;t=e}if(!/\p{Nd}/u.test(t))return!1;let n=String.raw`[-+]?[\p{Nd}][\p{Nd},.'’]*`;return new RegExp(String.raw`^${n}(?:\p{L}+)?(?:(?:${H2})+${n}(?:\p{L}+)?)*$`,`u`).test(t)}var W2=1,G2=2,K2=3,q2=-1;function J2(e){let t=e.length,n=new Uint8Array(t),r=new Int32Array(t+1).fill(q2),i=new Int32Array(t+1),a=new Int32Array(t+1),o=[],s=[];{let n=[];for(let r=0;r\`*—–“”‘’`),l=[];for(let t of e.matchAll(/\b(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/gi))l.push(t.index);for(let t of e.matchAll(/\b(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,})(?=(?:\/|\?|:\d))/gi))l.push(t.index);for(let t of e.matchAll(/(?:\.{1,2})?\/[\p{L}\p{Nd}._-]+(?:\/[\p{L}\p{Nd}._-]*)*\?/gu))(t.index===0||!/[\w~/.-]/.test(e[t.index-1]??``))&&l.push(t.index);l.sort((e,t)=>e-t);let u=-1;for(let n of l){if(nn+7&&!/[\w/?#@~.+&=%-]/.test(e[r+1]??``))break}o.push([n,r]),u=r}let d=[];for(let n=0;n]/.test(s))continue;let c=q2,l=q2;for(;i`){l=i;break}if(!a&&n===`/`&&e[i+1]===`>`){l=i+1;break}if(!/\s/.test(n)){c=i;break}for(;i`){l=i;break}if(a){c=i;break}if(r===`/`&&e[i+1]===`>`){l=i+1;break}let o=/^[a-zA-Z_:][\w:.-]*/.exec(e.slice(i));if(!o){c=i;break}i+=o[0].length;let s=i;for(;s`]+/.exec(e.slice(s));if(!t){c=s;break}i=s+t[0].length}}}if(l!==q2)d.push([n,l+1]),n=l;else if(c!==q2){let t=e.indexOf(`<`,n+1);n=(t!==-1&&t`,n+2);t===-1?f=!1:(d.push([n,t+2]),n=t+1,i=!0)}else if(r===`!`){if(e[n+2]===`-`&&e[n+3]===`-`){if(p){let t=e.indexOf(`-->`,n+4);t===-1?p=!1:(d.push([n,t+3]),n=t+2,i=!0)}}else if(e.startsWith(`[CDATA[`,n+2)){if(m){let t=e.indexOf(`]]>`,n+9);t===-1?m=!1:(d.push([n,t+3]),n=t+2,i=!0)}}else if(h&&/[A-Z]/.test(e[n+2]??``)){let t=e.indexOf(`>`,n+3);t===-1?h=!1:(d.push([n,t+1]),n=t,i=!0)}}if(i)continue;if(r!==void 0&&/[a-zA-Z]/.test(r)){let r=/^[a-zA-Z][a-zA-Z0-9+.-]{1,31}:/.exec(e.slice(n+1));if(r){let i=n+1+r[0].length;for(;i`&&e[i]!==`<`&&!/\s/.test(e[i]);)i++;if(e[i]===`>`){d.push([n,i+1]),n=i;continue}}}if(r===void 0||!/[\w.!#$%&'*+/=?^`{|}~-]/.test(r))continue;let a=n+1;for(;a`&&(d.push([n,a+1]),n=a)}}d.sort((e,t)=>e[0]-t[0]);let g=[];for(let e of d){let t=g.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):g.push([e[0],e[1]])}o.push(...g);let _=e=>{let t=0;for(;t=(s[t]?.[1]??0);)t++;let n=s[t];return n!==void 0&&e>=n[0]},v=e=>{let t=0;for(;t=(g[t]?.[1]??0);)t++;let n=g[t];return n!==void 0&&e>=n[0]},y=[],b=null,x=0,S=!1;for(let n=0;n`&&(S=!1);continue}if(!(_(n)||v(n))){if(b!==null){e[n]===b&&(b=null);continue}if(y.length>0&&(e[n]===`"`||e[n]===`'`)&&n>0&&/\s/.test(e[n-1]??``))b=e[n];else if(e[n]===`[`)x++;else if(e[n]===`]`)x>0&&e[n+1]===`(`&&(y.push(n),S=e[n+2]===`<`,n++),x=Math.max(0,x-1);else if(e[n]===`(`&&y.length>0)y.push(-1);else if(e[n]===`)`&&y.length>0){let t=y.pop();if(t!==void 0&&t>=0){let r=e.slice(t+2,n);(/\s/.exec(r)===null||r.startsWith(`<`)&&/^<(?:\\[<>]|[^<>])*>$/.test(r)||/^[^\s]*\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\(([^()\\]|\\.)*\))$/.test(r))&&o.push([t,n+1])}}}}o.sort((e,t)=>e[0]-t[0]);let C=[];for(let e of o){let t=C.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):C.push([e[0],e[1]])}let w=e=>{let t=0,n=C.length-1;for(;t<=n;){let r=t+n>>1,i=C[r];if(i===void 0)return!1;if(e=i[1])t=r+1;else return!0}return!1},T=new Uint8Array(t);{let n=-1,r=!1,i=!1,a=0;for(let o=0;o<=t;o++){let s=o0&&(c===`{`?a++:c===`}`&&a--)}}for(let r=0;r=0;e--)n[e]===K2&&(E=e),r[e]=E;let D=/^[\p{L}\p{Nd}\\|{([+.¬°-±×÷′-″←-⇿∀-⋿^_<>=-]$/u,O=/[^\p{L}\p{Nd}\s]$/u,k=/[^\s\u0020-\u007E\u0370-\u03FF\u{1D400}-\u{1D7FF}\p{Nd}¬°-±×÷′-″←-⇿∀-⋿]/u,A=/(?:^|\s)[a-z]{2,}/,j=(t,n)=>{let o=j2(e,t+1);if(o===void 0||!D.test(o))return!1;let s=r[t+1]??q2;if(s!==q2){let n=e.slice(t+1,s);return s-(t+1)!==((e.codePointAt(t+1)??0)>65535?2:1)&&k.test(n)||/[,;:!?]$/.test(n)||/^[a-z]{2,}$/.test(n)?!1:(i[s]??0)-(i[t+1]??0)===0&&(a[s]??0)-(a[t+1]??0)===0}return O.test(n)||k.test(n)||A.test(n)};return(o,s=-1)=>{if(e[o]!==`$`||n[o]===W2||e[o+1]===`$`||e[o-1]===`$`&&s!==o||L2(e,o)||o+1>=t||N2(j2(e,o+1)))return null;let c=r[o+1]??q2;if(c===q2||(i[c]??0)-(i[o+1]??0)>0||(a[c]??0)-(a[o+1]??0)>0)return null;let l=e.slice(o+1,c);return/^\{[A-Z_][A-Z0-9_]*(?:\}$|[:-])/.test(l)||e[c+1]===`{`&&/^\{[A-Za-z_][A-Za-z0-9_]*(?:[:-][^{}]*)?\}$/.test(l)||P2(M2(e,o))&&U2(l)||z2(e,o)&&(j(c,l)||R2(e,c)||/\s/.test(l)&&/\p{Nd}$/u.test(l)&&!/[+\-*/^=_<>|\\¬°-±×÷′-″←-⇿∀-⋿]/.test(l))||e[c+1]===`$`&&!/\p{L}/u.test(l)&&O.test(l)?null:{content:l,end:c+1}}}var Y2=/^---[ \t]*(?:\r\n|\n)/,X2=/^---[ \t]*$/;function Z2(e){let t=Y2.exec(e);if(t===null)return{frontmatter:null,body:e};let n=t[0].length,r=n;for(;n<=e.length;){let t=e.indexOf(` -`,n);t===-1&&(t=e.length);let i=e.slice(n,t);if(i.endsWith(`\r`)&&(i=i.slice(0,-1)),X2.test(i)){let i=e.slice(r,n);return i===``?{frontmatter:null,body:e}:{frontmatter:i,body:t\n]*>|[^()\s]+)\)/g,$2=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,e4=/^[a-zA-Z]:(?:[\\/]|%5c)/i,t4=/^[A-Za-z0-9._~-]$/,ese=`pythinker-code://skill/`,n4;function r4(e){return e.replaceAll(`%`,`%25`).replaceAll(`&`,`%26`).replaceAll(`<`,`%3C`).replaceAll(`>`,`%3E`).replaceAll(/[[\]\\]/g,`\\$&`).replaceAll(` -`,`%0A`).replaceAll(`\r`,`%0D`)}function tse(e){return e.replaceAll(/\\([\\[\]])/g,`$1`).replaceAll(`%26`,`&`).replaceAll(`%3C`,`<`).replaceAll(`%3E`,`>`).replaceAll(`%0A`,` -`).replaceAll(`%0D`,`\r`).replaceAll(`%25`,`%`)}function i4(e){let t=``;for(let n of e){let e=n.codePointAt(0);e>127||t4.test(n)?t+=n:t+=`%${e.toString(16).toUpperCase().padStart(2,`0`)}`}return t}function nse(e){let t=e.split(`/`).map(i4).join(`/`);return t.startsWith(`//`)?`/%2F${t.slice(2)}`:t}function a4(e){return e.startsWith(`<`)&&e.endsWith(`>`)?e.slice(1,-1):e}function o4(e){let t=a4(e);try{return decodeURIComponent(t)}catch{return t}}function rse(e){let t=a4(e);return!t||t.startsWith(`#`)||t.startsWith(`?`)||t.startsWith(`//`)?null:t.startsWith(`pythinker-code://skill/`)&&t.length>23?`skill`:$2.test(t)&&!e4.test(t)?null:/(?:[\\/]|%5c)$/i.test(t)?`folder`:`file`}function s4(e,t){if(!t)return;let n=e.at(-1);n?.type===`text`?n.value+=t:e.push({type:`text`,value:t})}function c4(e){if(e.kind===`skill`)return`[${r4(e.name)}](${ese}${i4(e.name)})`;let t=e.kind===`folder`&&!/[\\/]$/.test(e.path)?`${e.path}/`:e.path;return`[${r4(e.name)}](${nse(t)})`}function l4(e){let t=[],n=0;Q2.lastIndex=0;for(let r of e.matchAll(Q2)){let i=r.index;s4(t,e.slice(n,i));let a=r[0],o=r[1],s=r[2],c=e[i-1]===`!`?null:rse(s);if(c&&o){let e=c===`skill`?o4(s).slice(23):void 0;t.push({type:`mention`,attrs:{kind:c,name:e??tse(o),path:c===`skill`?``:o4(s)}})}else s4(t,a);n=i+a.length}return s4(t,e.slice(n)),t}function u4(e){let t=l4(e.args??``).filter(e=>e.type===`mention`&&e.attrs.kind===`skill`),n=t[0];return t.length===1&&n?.type===`mention`&&n.attrs.name===e.name}function d4(e,t){if(u4(e))return t.revivePill?e.args??``:null;if(e.name.includes(` `))return null;let n=e.args??``;return`/skill:${e.name}${n.length>0?` ${n}`:``}`}function ise(e,t){return d4(e,t)!==null}function ase(e){if(u4(e))return e.args??``;let t=c4({kind:`skill`,name:e.name,path:``});return e.args?`${t} ${e.args}`:t}function f4(e){return n4??=new Intl.Segmenter(`und`,{granularity:`grapheme`}),Array.from(n4.segment(e),({segment:e})=>e)}function p4(e){let t=f4(e);if(t.length<=32)return e;let n=e.lastIndexOf(`.`),r=(n>=0?f4(e.slice(n)).length:0)+4,i=31-r;return i<8?`${t.slice(0,31).join(``)}…`:`${t.slice(0,i).join(``)}…${t.slice(-r).join(``)}`}function ose(e){return new Worker(`/assets/katexRenderer.worker-DE1eyXe6.js`,{type:`module`,name:e?.name})}function sse(e){return new Worker(`/assets/mermaidParser.worker-_pLIm6No.js`,{type:`module`,name:e?.name})}var cse={key:0,class:`md-frontmatter`},lse={class:`diff-bar`},use=[`aria-label`,`onClick`],dse={class:`diff-pre`},fse={key:0,class:`diff-sign`},pse={class:`diff-text`},mse=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,hse=`pythinker-code://skill/`,m4=`md-table-wide`,h4=`md-table-toggle`,g4=`md-table-fade`,_4=`md-table-toggle--show`,gse=`md-table-at-end`,_se=26,v4=`md-code-wrap`,y4=`md-code-wrap-toggle`,b4=`md-code-nums`,x4=`md-code-nums-toggle`,S4=`data-md-code-css`,vse=` +`)&&!function(e){let t=q1(e);if(J1(t))return!1;let n=Y1(t);return n.length>=2&&n.some(e=>e.trim())}(t))}(o.value,t)?C():function(){if(_+=1,m)return;let t=Math.max(0,function(e){let t=e.parseCoalesceMs;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:80}(e)-(U1()-v));t<=0?C():m=setTimeout(C,t)}())},{flush:`sync`,immediate:!0}),t(S);let w=L(()=>{var t;return CL(e.customHtmlTags,e.parseOptions?.customHtmlTags,(t=n.customComponentsMap?.value??{},Object.entries(t).map(([e,t])=>{let n=xL(e);return t==null||!n||_Y(n)||GI.has(n)||JI.has(n)?``:n}).filter(Boolean)))}),T=L(()=>{let{key:e,tags:t}=wL(w.value);if(!e)return r;let a=i.get(e);if(a)return a;let o=JK(n.instanceMsgId,{customHtmlTags:t});return i.set(e,o),o}),E=L(()=>{let t=T.value;if(!e.customMarkdownIt)return t;let n=e.customMarkdownIt(t);return t.__markstreamHasCustomParserExtensions=!0,n.__markstreamHasCustomParserExtensions=!0,n}),D=L(()=>{var t;let r=e.parseOptions??{},i=n.effectiveFinal.value,a=w.value,o=i!=null,s=a.length>0;return o||s||r.streamParse==null?cY(cY(lY(cY({},r),{streamParse:(t=r.streamParse)==null||t}),o?{final:i}:{}),s?{customHtmlTags:a}:{}):r}),O=L(()=>new Set((D.value.customHtmlTags??[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))),k=L(()=>K1(D.value,E.value,e.customMarkdownIt,{includeFinal:!0})),A=L(()=>K1(D.value,E.value,e.customMarkdownIt,{includeFinal:!1}));return s([k,A],([e,t],[n,r])=>{n&&(e===n&&t===r||(C(),t!==r&&(c=[],d=``)))},{flush:`sync`}),{effectiveCustomHtmlTags:w,effectiveCustomHtmlTagsSet:O,mdBase:T,mdInstance:E,mergedParseOptions:D,getParsedNodesDirtyStartIndex:()=>y,getParsedNodesRevision:()=>b,parsedNodes:L(()=>{if(e.nodes?.length)return c=[],d=``,x(0),g(e.nodes.slice());let t=o.value;if(!t)return c=[],d=``,x(-1),[];let r=n.debugPerformanceEnabled.value,i=r?U1():0,a=E.value,s=k.value,m=A.value;l&&s!==l&&function(e){var t,n;(n=(t=e.stream)?.reset)==null||n.call(t)}(a),u&&m!==u&&(c=[],d=``);let v=Object.keys(n.customComponentsMap?.value??{}).length>0||typeof D.value.postTransformNodes==`function`;v!==f&&(c=[],d=``);let b=!v&&c.length>0&&t.startsWith(d)&&m===u,S=r?W1(a):null,C=r?{}:void 0,w=u0(a),T=!w&&!v,O=UG(t,a,cY(cY(lY(cY({},D.value),{__reuseStableTopLevelNodes:T}),w?{__disableStreamParse:!0}:{}),C?{__timing:C}:{})),j=r?U1():0,M=r?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0,N,ee=r?c0(O.length):void 0,P=0,F=0,I=0;if(b){let n=r?U1():0,[i,o]=function(e){let[t,n]=e.scanGlobalReferenceAppend(e.previousContent,e.content),r=e.parseOptions;return[e.previousDirtyStartIndex>0&&!0!==r.final&&!e.customMarkdownIt&&!u0(e.md)&&!t&&typeof r.preTransformTokens!=`function`&&typeof r.postTransformTokens!=`function`&&typeof r.postTransformNodes!=`function`&&(r.customHtmlTags?.length??0)===0?e.previousDirtyStartIndex:0,n]}({content:t,previousContent:d,previousDirtyStartIndex:y,parseOptions:D.value,customMarkdownIt:e.customMarkdownIt,md:a,scanGlobalReferenceAppend:p});I=o;let s=i<=0;if(M){let e=function(e,t,n,r={}){if(!t.length)return{nodes:e,metrics:c0(e.length)};let i=r.scanStartIndex??0,a=!1!==r.reuseDirtyTail,o=function(e,t,n,r=0){let i=Math.min(e.length,t.length);for(let a=Math.min(i,Math.max(0,r));ar0(e[r]))}(N,M,F):function(e,t=0){for(let n=Math.max(0,t);n(S?.total??0);n.logPerf(r?`parse(stream)`:`parse(sync)`,cY(cY(cY({rendererId:n.instanceMsgId,ms:Math.round(U1()-i),nodes:N.length,contentLength:t.length,parseCommitCount:h,parseCoalescedCount:_,nodeReuseMs:te,referenceDefinitionScanChars:I,signatureMs:M?.signatureMs??0,stabilizeSignatureMs:M?.stabilizeSignatureMs??0,primeSignatureMs:M?.primeSignatureMs??0,signatureCallCount:M?.signatureCallCount??0,stabilizeSignatureCallCount:M?.stabilizeSignatureCallCount??0,primeSignatureCallCount:M?.primeSignatureCallCount??0,stabilizeMs:P},ee??{}),C?Object.fromEntries(L1.map(e=>[e,C[e]??0])):{}),e?{streamMode:e.lastMode,streamDelta:h0(e,S),streamStats:e}:{}))}return g(N)})}}function _0(e){let{isClient:t}=e,n=R(new Set),r=new Map,i=new Map,a=new Map;function o(e){if(!t)return;let n=a.get(e);n!=null&&(window.clearTimeout(n),a.delete(e))}function s(){if(t)for(let e of a.values())window.clearTimeout(e);a.clear()}function c(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:r,nodeVisibilityWatchStops:i,nodeVisibilityFallbackTimers:a,clearVisibilityFallback:o,clearAllVisibilityFallbacks:s,markNodeVisible:function(t,r=!0){var i;r&&o(t),function(t,r){if((a=(i=e.shouldTrackVisibleNodeIndices)?.call(e))!=null&&!a)return;var i,a;let o=n.value,s=o.has(t);if(r){if(s)return;let e=new Set(o);e.add(t),n.value=e;return}if(!s)return;let c=new Set(o);c.delete(t),n.value=c}(t,r),r&&((i=e.onNodeMarkedVisible)==null||i.call(e,t))},resetNodeVisibleState:c,cleanupNodeVisibility:function(t){var s;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(let[e,n]of i.entries())e{let e=a.getSnapshot();n.value=e.source,r.value=e.visible,i.value=e.done},s=a.subscribe(o);o();let c=L(()=>Math.max(0,n.value.length-r.value.length)),l=L(()=>c.value===0),u=L(()=>i.value&&l.value);return C()&&t(()=>{s(),a.destroy()}),{source:n,visible:r,done:i,final:u,caughtUp:l,pendingChars:c,enqueue:e=>a.enqueue(e),finish:e=>a.finish(e),flush:()=>a.flush(),reset:e=>a.reset(e),pause:()=>a.pause(),resume:()=>a.resume()}}var y0={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},b0=/auto|scroll|overlay/i;function x0(e){if(!e)return!1;let t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();return b0.test(t)||b0.test(n)}function S0(e){let t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}var C0={class:`m-0 p-0`},w0=[`data-probe`],T0=wY(G(lY(cY({},{name:`HeightEstimationProbes`}),{__name:`HeightEstimationProbes`,props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){let t=e;function n(e){return t.headingNodes?.[e]??null}return(t,r)=>(c(),W(`div`,{class:`height-estimation-probes`,style:ae({width:`${e.width}px`}),"aria-hidden":`true`},[F(`div`,{ref:t=>e.setParagraphWrapper(t),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`paragraph`},[v(z(oQ),{node:e.paragraphNode,"index-key":`probe-paragraph`},null,8,[`node`])],2),F(`div`,{ref:t=>e.setListItemWrapper(t),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`list-item`},[F(`ul`,C0,[v(z(QZ),{node:e.listItemNode,"index-key":`probe-list-item`},null,8,[`node`])])],2),F(`div`,{ref:t=>e.setListWrapper(t),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`list`},[v(z($Z),{node:e.listNode,"index-key":`probe-list`},null,8,[`node`])],2),(c(),W(M,null,_(6,t=>F(`div`,{key:`probe-heading-${t}`,ref_for:!0,ref:n=>e.setHeadingWrapper(t,n),class:V([`node-content`,{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${t}`},[v(z(qZ),{node:n(t),"index-key":`probe-heading-${t}`},null,8,[`node`,`index-key`])],10,w0)),64))],4))}})),[[`__scopeId`,`data-v-3e0766e2`]]),E0=G({name:`InfographicBlockNodeLoading`,props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){let t=L(()=>_J(dJ(e.estimatedPreviewHeightPx)??mJ(String(e.node.code??``))));return()=>a(`div`,{class:`infographic-block-container rounded-lg border overflow-hidden`,style:{margin:`var(--ms-flow-diagram-y) 0`,background:`var(--diagram-bg)`,borderColor:`var(--diagram-border)`,color:`hsl(var(--ms-foreground))`},"data-markstream-infographic":`1`,"data-markstream-mode":`pending`},[e.showHeader?a(`div`,{class:`infographic-block-header flex justify-between items-center border-b`,style:{padding:`var(--ms-inset-panel-y) var(--ms-inset-panel-x)`,background:`var(--diagram-header-bg)`,borderColor:`var(--diagram-border)`,minHeight:`calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)`}},[a(`div`,{class:`flex items-center gap-x-2 overflow-hidden`},[a(`span`,{class:`icon-slot action-icon shrink-0`,style:{display:`inline-flex`,width:`var(--ms-action-btn-icon)`,height:`var(--ms-action-btn-icon)`}}),a(`span`,{class:`infographic-label font-medium font-mono truncate`,style:{fontSize:`var(--ms-text-label)`,color:`hsl(var(--ms-muted-foreground))`}},`Infographic`)]),a(`div`,{class:`infographic-header-actions flex items-center opacity-0 pointer-events-none`,style:{gap:`var(--ms-gap-header-actions)`},"aria-hidden":`true`},Array.from({length:4},()=>a(`span`,{class:`infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded`,style:{width:`calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))`,height:`calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))`}})))]):null,a(`div`,{class:`infographic-preview relative overflow-hidden block`,style:{height:`${t.value}px`,minHeight:`var(--ms-size-diagram-min-height)`,background:`var(--diagram-bg)`}},[a(`pre`,{class:`infographic-pending-source text-sm font-mono whitespace-pre-wrap`,style:{position:`absolute`,inset:`0`,zIndex:`1`,margin:`0`,padding:`var(--ms-inset-panel-body)`,overflow:`auto`,textAlign:`left`}},String(e.node.code??``)),a(`div`,{class:`absolute inset-0`},[a(`div`,{class:`w-full text-center flex items-center justify-center min-h-full`})])])])}}),D0=G({name:`MermaidBlockNodeLoading`,props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){let t=L(()=>gJ(dJ(e.estimatedPreviewHeightPx)??pJ(String(e.node.code??``))));return()=>a(`div`,{class:`mermaid-block-container rounded-lg border overflow-hidden`,style:{margin:`var(--ms-flow-diagram-y) 0`,borderColor:`var(--diagram-border)`},"data-markstream-mermaid":`1`,"data-markstream-mode":`pending`},[e.showHeader?a(`div`,{class:`mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]`,style:{background:`var(--diagram-header-bg)`,borderColor:`var(--diagram-border)`}},[a(`div`,{class:`flex items-center gap-x-2 overflow-hidden`},[a(`span`,{class:`mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate`,style:{color:`var(--code-action-fg)`}},`Mermaid`)]),a(`div`,{class:`mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none`,"aria-hidden":`true`},Array.from({length:4},()=>a(`span`,{class:`mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded`},[a(`span`,{class:`action-icon block`})])))]):null,a(`div`,{class:`mermaid-preview-area relative overflow-hidden block`,style:{height:`${t.value}px`,minHeight:`var(--ms-size-diagram-min-height)`,background:`var(--diagram-bg)`}},[a(`pre`,{class:`mermaid-source-code text-sm font-mono whitespace-pre-wrap`,style:{position:`absolute`,inset:`0`,margin:`0`,padding:`var(--ms-inset-panel-body)`,overflow:`auto`,textAlign:`left`}},String(e.node.code??``)),a(`div`,{class:`_mermaid w-full text-center flex items-center justify-center min-h-full`,style:{fontFamily:`inherit`,contentVisibility:`auto`,contain:`content`,containIntrinsicSize:`var(--ms-size-diagram-min-height) 240px`}})])])}}),O0={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:`auto`},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:`auto`},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:`auto`}};function k0(e){if(e==null)return``;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var A0=[`data-custom-id`],j0=[`data-node-index`,`data-node-type`],M0=`typewriter-simple-cursor-target`,N0=wY(G(lY(cY({},{name:`NodeRenderer`}),{__name:`NodeRenderer`,props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:`auto`},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:[`copy`,`copy-code`,`handleArtifactClick`,`click`,`mouseover`,`mouseout`,`virtual-state-change`,`height-change`,`render-settled`,`render-final`,`anchor-change`],setup(e,{expose:t,emit:a}){let o=e,l=a;function f(e){if(!(typeof Event<`u`&&e instanceof Event))return typeof e==`string`&&l(`copy-code`,e),void l(`copy`,e)}let h=y(),v=m(`markstreamNestedRendererProps`,void 0);function S(e){let t=h?.vnode.props;return!!t&&(Object.prototype.hasOwnProperty.call(t,e)||Object.prototype.hasOwnProperty.call(t,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}function C(e){let t=o[e];return S(e)?t:v?.value?.[e]??t}let w=L(()=>{return(e=C(`mode`))===`chat`||e===`minimal`||e===`docs`?e:`docs`;var e}),T=L(()=>C1(C(`typewriter`))),D=L(()=>T.value!==`off`),k=L(()=>C(`domMode`)===`minimal`?`minimal`:`full`),A=L(()=>{return!0===(e={mode:w.value,codeRenderer:C(`codeRenderer`),renderCodeBlocksAsPre:C(`renderCodeBlocksAsPre`)}).renderCodeBlocksAsPre?`pre`:e.codeRenderer===`pre`||e.codeRenderer===`shiki`||e.codeRenderer===`monaco`?e.codeRenderer:!1===e.renderCodeBlocksAsPre||e.mode===`docs`?`monaco`:`pre`;var e}),j=L(()=>O0[w.value]),ee=L(()=>C(`showTooltips`)??j.value.showTooltips),F=L(()=>C(`fade`)??j.value.fade),I=L(()=>C(`batchRendering`)??j.value.batchRendering),te=L(()=>C(`initialRenderBatchSize`)??j.value.initialRenderBatchSize),ie=L(()=>C(`renderBatchSize`)??j.value.renderBatchSize),se=L(()=>C(`renderBatchDelay`)??j.value.renderBatchDelay),ce=L(()=>C(`renderBatchBudgetMs`)??j.value.renderBatchBudgetMs),le=L(()=>C(`renderBatchIdleTimeoutMs`)??j.value.renderBatchIdleTimeoutMs),de=L(()=>C(`deferNodesUntilVisible`)??j.value.deferNodesUntilVisible),fe=L(()=>C(`maxLiveNodes`)??j.value.maxLiveNodes),H=L(()=>C(`liveNodeBuffer`)??j.value.liveNodeBuffer),U=L(()=>C(`nodeVirtual`)??j.value.nodeVirtual),G={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return C(`parseOptions`)},get customMarkdownIt(){return C(`customMarkdownIt`)},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return C(`customHtmlTags`)},get mode(){return C(`mode`)},get domMode(){return k.value},get htmlPolicy(){return C(`htmlPolicy`)},get viewportPriority(){return C(`viewportPriority`)},get viewportPriorityOptions(){return C(`viewportPriorityOptions`)},get codeBlockStream(){return C(`codeBlockStream`)},get codeBlockDarkTheme(){return C(`codeBlockDarkTheme`)},get codeBlockLightTheme(){return C(`codeBlockLightTheme`)},get codeBlockMonacoOptions(){return C(`codeBlockMonacoOptions`)},get codeRenderer(){return C(`codeRenderer`)},get renderCodeBlocksAsPre(){return C(`renderCodeBlocksAsPre`)},get codeBlockMinWidth(){return C(`codeBlockMinWidth`)},get codeBlockMaxWidth(){return C(`codeBlockMaxWidth`)},get codeBlockProps(){return C(`codeBlockProps`)},get mermaidProps(){return C(`mermaidProps`)},get d2Props(){return C(`d2Props`)},get infographicProps(){return C(`infographicProps`)},get showTooltips(){return ee.value},get themes(){return C(`themes`)},get langs(){return C(`langs`)},get isDark(){return C(`isDark`)},get customId(){return C(`customId`)},get indexKey(){return o.indexKey},get typewriter(){return C(`typewriter`)},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return C(`smoothStreamingOptions`)},get parseCoalesceMs(){return C(`parseCoalesceMs`)},get fade(){return F.value},get batchRendering(){return I.value},get initialRenderBatchSize(){return te.value},get renderBatchSize(){return ie.value},get renderBatchDelay(){return se.value},get renderBatchBudgetMs(){return ce.value},get renderBatchIdleTimeoutMs(){return le.value},get deferNodesUntilVisible(){return de.value},get maxLiveNodes(){return fe.value},get liveNodeBuffer(){return H.value},get nodeVirtual(){return U.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function K(e){l(`height-change`,e)}function pe(e){l(`virtual-state-change`,e)}function me(e){l(`anchor-change`,e)}let ge=R(),_e=R(null),ve=R(null),ye=R(null),be=N({1:null,2:null,3:null,4:null,5:null,6:null}),xe=R(!1),Se=new Map,Ce=R(0),we=R(0),Te=R({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Ee(e,t){return typeof e==`string`&&e.trim()||t}function De(e){let t=Number(e);return Number.isFinite(t)&&t>0?Math.max(1,Math.trunc(t)):640}let Oe=L(()=>{let e=G.viewportPriorityOptions??{},t=Ee(e.rootMargin,bX);return{rootMargin:t,heavyBlockMargin:Ee(e.heavyBlockMargin,t),maxTargets:De(e.maxTargets)}}),ke=L(()=>Oe.value.rootMargin??bX),Ae=L(()=>Oe.value.maxTargets??640);function je(){if(!0!==o.virtualScroll?.enabled)return null;let e=o.virtualScroll?.scrollRoot;return Me(typeof e==`function`?e():e)}function Me(e){return e?typeof HTMLElement<`u`&&e instanceof HTMLElement?e:typeof e==`object`&&`value`in e?Me(e.value):typeof e==`object`&&`$el`in e?Me(e.$el):null:null}d(_X,Oe);let{isClient:q,renderAsFragment:Ne,debugPerformanceEnabled:Pe,resolvedShowTooltips:Fe,resolvedHtmlPolicy:Ie,inheritedSmoothStreaming:Le,ownsTypewriterCursor:Re}=function(e){let t=typeof window<`u`,n=b(),r=m(`markstreamHtmlPolicy`,void 0),i=m(`markstreamTypewriterCursor`,void 0),a=m(`markstreamSmoothStreaming`,void 0);return{isClient:t,renderAsFragment:L(()=>!0===e.renderAsFragment),debugPerformanceEnabled:L(()=>!!(e.debugPerformance&&t&&typeof console<`u`)),resolvedShowTooltips:L(()=>{if(typeof e.showTooltips==`boolean`)return e.showTooltips;let t=n.showTooltips??n[`show-tooltips`];return t===``||!0===t||t===`true`||!1!==t&&t!==`false`&&void 0}),resolvedHtmlPolicy:L(()=>e.htmlPolicy??r?.value??`safe`),inheritedSmoothStreaming:a,inheritedTypewriterCursor:i,ownsTypewriterCursor:L(()=>!0!==i?.value)}}(G),{resolveViewportRoot:ze,resolveScrollContainer:Be,isReverseFlexScrollRoot:Ve,getNormalizedScrollTop:He,getOffsetTopWithinRoot:Ue}=function(e,t){function n(){return t.scrollRoot?.call(t)??null}function r(t){if(typeof window>`u`)return null;let r=n();if(r)return r;let i=t??e.value;if(!i)return null;let a=i.ownerDocument||document,o=a.scrollingElement||a.documentElement,s=i;for(;s&&s!==a.body&&s!==o;){if(x0(window.getComputedStyle(s))&&S0(s))return s;s=s.parentElement}return null}function i(e){if(!t.isClient)return!1;try{let t=window.getComputedStyle(e);return!!(t.display||``).toLowerCase().includes(`flex`)&&(t.flexDirection||``).toLowerCase().endsWith(`reverse`)}catch{return!1}}function a(e,t,n){if(n)return o(t);let r=e.scrollTop;if(!i(e))return r;let a=r<0?-r:r;return Math.max(0,(e.scrollHeight??0)-(e.clientHeight??0))-a}function o(e){let t=Number(e.scrollingElement?.scrollTop),n=Number(e.documentElement?.scrollTop??0),r=Number(e.body?.scrollTop??0);return Math.max(0,Number.isFinite(t)?t:0,Number.isFinite(n)?n:0,Number.isFinite(r)?r:0)}return{resolveViewportRoot:r,resolveScrollContainer:function(t){let i=n();if(i)return i;let a=r(t??e.value??null);if(a)return a;let o=t?.ownerDocument??e.value?.ownerDocument??(typeof document<`u`?document:null);return o?.scrollingElement||o?.documentElement||null},isReverseFlexScrollRoot:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:function(e,t){let n=t.ownerDocument||e.ownerDocument||document;if(function(e,t){return e===t.documentElement||e===t.body||e===t.scrollingElement}(t,n))return e.getBoundingClientRect().top+o(n);let r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=a(t,n,!1);return i.top-r.top+s}}}(ge,{isClient:q,scrollRoot:je});d(`markstreamShowTooltips`,Fe),d(`markstreamHtmlPolicy`,Ie),d(`markstreamTypewriter`,D),d(`markstreamFade`,L(()=>!1!==G.fade)),d(`markstreamTypewriterCursor`,L(()=>!0)),d(`markstreamTextStreamState`,Se),d(`markstreamStreamVersion`,Ce),d(`markstreamParseOptions`,L(()=>G.parseOptions)),d(`markstreamCustomMarkdownIt`,L(()=>G.customMarkdownIt));let{smoothStreamingEnabled:We,renderContent:Ge,requestedFinal:Ke,effectiveFinal:qe}=function(e,t){let n=v0(cY(cY({},y0),e.smoothStreamingOptions)),r=L(()=>!1!==e.smoothStreaming&&!e.nodes?.length&&(!0===e.smoothStreaming||!t.inheritedSmoothStreaming?.value)&&(!0===e.smoothStreaming||C1(e.typewriter)!==`off`||(e.maxLiveNodes??0)<=0)),i=R(!t.isClient||!0===e.smoothStreaming);p(()=>{i.value=!0});let a=L(()=>i.value&&r.value),o=L(()=>a.value?n.visible.value:e.content??``),c=L(()=>{let t=e.parseOptions??{};return e.final??t.final}),l=L(()=>{let e=c.value;return a.value&&e!=null?!!e&&n.caughtUp.value:e}),u=0,d=!1;function f(){u=0,d=!1}return s([()=>e.content,()=>e.nodes,a,c],([e,t,r,i])=>{if(t?.length)return f(),void n.reset(``);let a=e??``;if(!r)return f(),n.reset(a),void(i&&n.finish({flush:!0}));let o=n.source.value;if(a){if(a!==o)if(a.startsWith(o)){let e=a.slice(o.length),t=n.pendingChars.value;e.length<=8?(u++,d||u>=2&&t<=8?(d=!0,n.reset(a)):n.enqueue(e)):(f(),n.enqueue(e))}else f(),n.reset(a)}else f(),n.reset(``);i&&n.finish()},{immediate:!0}),{smoothStream:n,smoothStreamingEligible:r,smoothStreamingEnabled:a,renderContent:o,requestedFinal:c,effectiveFinal:l}}(G,{isClient:q,inheritedSmoothStreaming:Le}),Je=!0===Ke.value;d(`markstreamSmoothStreaming`,We);let Ye=R(!1),Xe=R(!1),Ze=R(!1),Qe=``,$e=!1,et=null;function tt(){q&&et!=null&&(window.clearTimeout(et),et=null)}function nt(){Ye.value=!1,tt()}function rt(e,t){if(!Pe.value)return;let n=function(){if(!Pe.value)return null;let e=ct(it),t=ct(at),n=Math.max(st,t);if(e<=0&&n<=0)return null;let r={total:e,maxPerFrame:n,byLabel:(i=it,Object.fromEntries(Array.from(i.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))))};var i;return it.clear(),at.clear(),st=0,r}();console.info(`[markstream-vue][perf] ${e}`,n?lY(cY({},t),{layoutReads:n}):t)}s([()=>G.indexKey,()=>G.customId],()=>{nt(),Xe.value=!1,Ze.value=!o.nodes?.length&&!0!==Ke.value&&!!o.content,Qe=Ge.value??``,$e=Qe.length>0},{flush:`sync`}),s([()=>o.content,()=>o.nodes,Ke],([e,t,n])=>{!t?.length&&!0!==n&&e&&(Ze.value=!0)},{flush:`sync`,immediate:!0}),s([Ge,()=>o.nodes,Ke],([e,t,n])=>{let r=e??``;t?.length||!0===n?(nt(),Xe.value=!1,Qe=r,$e=!0):(r.length>0&&(Ze.value=!0),$e?(Qe&&r.length>Qe.length&&r.startsWith(Qe)?(Ye.value=!0,Xe.value=!0,q&&(tt(),et=window.setTimeout(()=>{var e;et=null,!0===qe.value||(e=o.nodes)!=null&&e.length||(po(),Ye.value=!1,ho())},1200))):(r.length`u`)return null;let e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;let t={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=t,t}();t&&(t.total=Number(t.total||0)+1,t.byLabel[e]=Number(t.byLabel[e]||0)+1,t.currentFrameTotal=Number(t.currentFrameTotal||0)+1,t.frameScheduled||(t.frameScheduled=!0,typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>ut(t)):typeof queueMicrotask==`function`?queueMicrotask(()=>ut(t)):setTimeout(()=>ut(t),0)))}(e),ot||(ot=!0,q&&typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(lt):typeof queueMicrotask==`function`?queueMicrotask(lt):setTimeout(lt,0)))}function ft(e,t){return dt(e),t()}let pt=G.customId?`renderer-${G.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,mt=function(e){let t=new Map;return{scope:e,cache:t,clear:()=>t.clear()}}(pt),ht=pt;d(w1,mt);let gt=bY(()=>G.customId),{effectiveCustomHtmlTagsSet:_t,mergedParseOptions:vt,parsedNodes:yt,getParsedNodesDirtyStartIndex:bt,getParsedNodesRevision:xt}=g0(G,{instanceMsgId:pt,renderContent:Ge,effectiveFinal:qe,smoothStreamingEnabled:We,debugPerformanceEnabled:Pe,customComponentsMap:gt,logPerf:rt});s(yt,()=>{Ye.value||mt.clear(),Ce.value+=1},{immediate:!0});let St=L(()=>({customId:G.customId,customHtmlTags:vt.value.customHtmlTags,parseOptions:G.parseOptions,customMarkdownIt:G.customMarkdownIt,htmlPolicy:Ie.value,viewportPriority:G.viewportPriority,viewportPriorityOptions:Oe.value,mode:w.value,domMode:G.domMode,codeRenderer:A.value,codeBlockStream:G.codeBlockStream,codeBlockDarkTheme:G.codeBlockDarkTheme,codeBlockLightTheme:G.codeBlockLightTheme,codeBlockMonacoOptions:G.codeBlockMonacoOptions,renderCodeBlocksAsPre:G.renderCodeBlocksAsPre,codeBlockMinWidth:G.codeBlockMinWidth,codeBlockMaxWidth:G.codeBlockMaxWidth,codeBlockProps:G.codeBlockProps,mermaidProps:G.mermaidProps,d2Props:G.d2Props,infographicProps:G.infographicProps,showTooltips:Fe.value,themes:G.themes,langs:G.langs,isDark:G.isDark,typewriter:D.value,smoothStreamingOptions:G.smoothStreamingOptions,parseCoalesceMs:G.parseCoalesceMs,fade:G.fade}));d(`markstreamNestedRendererProps`,St);let Ct=L(()=>yt.value),wt=L(()=>yt.value.length),Tt=R(null),Et=R(null),Dt=R(null),Ot=R(null),kt=o.indexKey!=null&&String(o.indexKey).startsWith(`list-item-`),At=!kt&&G.customId?c1(G.customId):null,jt=L(()=>At?(s1.value,c1(G.customId)):null),Mt=L(()=>!!(!Ne.value&&G.customId&&!kt&&jt.value?.enabled)),Nt=L(()=>!!(q&&Mt.value)),Pt=L(()=>!!(!Ne.value&&o.virtualScroll?.enabled)),Ft=L(()=>Pt.value),It=R(!1);p(()=>{It.value=!0});let Lt=L(()=>!!(q&&Pt.value));d(`markstreamHostScrollManaged`,Lt);let Rt=L(()=>!!(It.value&&Lt.value)),zt=L(()=>Nt.value||Lt.value),Bt=L(()=>Nt.value||Rt.value),Vt=L(()=>zt.value&&!1!==jt.value?.textEstimation);function Ht(){let e=we.value||ft(`getMeasuredContainerWidth.clientWidth`,()=>ge.value?.clientWidth||0);return Number.isFinite(e)&&e>0?e:0}let Ut=L(()=>{let e=Ht();return e>0?Math.max(1,Math.round(e)):640}),Wt=L(()=>!(!0!==qe.value||Pt.value||w.value!==`chat`&&w.value!==`minimal`||S(`maxLiveNodes`)||S(`liveNodeBuffer`)||o.nodes?.length||Ze.value||!((G.maxLiveNodes??0)<=0))),Gt=L(()=>Wt.value?50:Math.max(1,G.maxLiveNodes??320)),Kt=L(()=>Wt.value?16:Math.max(0,G.liveNodeBuffer??60)),qt=L(()=>!Ne.value&&!1!==G.nodeVirtual&&!((G.maxLiveNodes??0)<=0&&!Wt.value)&&(!0===G.nodeVirtual?yt.value.length>0:yt.value.length>Gt.value)),Jt=L(()=>qt.value||Nt.value||Lt.value),Yt=L(()=>!1!==G.viewportPriority),Xt=L(()=>!!Yt.value&&!xe.value);d(vX,L(()=>Yt.value));let Zt=L(()=>!(Ne.value||!1===G.deferNodesUntilVisible||(G.maxLiveNodes??0)<=0||qt.value||yt.value.length>900||!1===G.viewportPriority)),Qt=CX(e=>ze(e??ge.value??null),Yt),{requestFrame:$t,cancelFrame:en,hasIdleCallback:tn,isTestEnv:nn}=function(e){return{requestFrame:e.isClient&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame.bind(window):null,cancelFrame:e.isClient&&typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame.bind(window):null,hasIdleCallback:e.isClient&&typeof window.requestIdleCallback==`function`,isTestEnv:function(){return typeof globalThis>`u`||!(`process`in globalThis)?void 0:Object.getOwnPropertyDescriptor(globalThis,`process`)?.value?.env}()?.NODE_ENV===`test`}}({isClient:q}),rn=L(()=>!0===qe.value&&!Pt.value),{resolvedBatchSize:an,resolvedInitialBatch:on,batchingEnabled:sn,incrementalRenderingActive:cn,renderedCount:ln,previousRenderContext:un,adaptiveBatchSize:dn,previousBatchConfig:fn}=function(e,t){let n=L(()=>{let t=Math.trunc(e.renderBatchSize??80);return Number.isFinite(t)?Math.max(0,t):0}),r=L(()=>{let t=Math.trunc(e.initialRenderBatchSize??n.value);return Number.isFinite(t)?Math.max(0,t):n.value}),i=L(()=>!t.renderAsFragment.value&&!1!==e.batchRendering&&n.value>0&&t.isClient&&!t.isTestEnv),a=R(0),o=R({key:e.indexKey,total:0}),s=R(Math.max(1,n.value||1)),c=L(()=>i.value&&!t.continuousStreaming?.value&&!t.forceFullRenderFinalContent?.value&&(e.maxLiveNodes??0)<=0);return{resolvedBatchSize:n,resolvedInitialBatch:r,batchingEnabled:i,incrementalRenderingActive:c,renderedCount:a,previousRenderContext:o,adaptiveBatchSize:s,previousBatchConfig:R({batchSize:n.value,initial:r.value,delay:e.renderBatchDelay??16,enabled:c.value})}}(G,{isClient:q,isTestEnv:nn,renderAsFragment:Ne,forceFullRenderFinalContent:rn,continuousStreaming:L(()=>Xe.value&&!0!==qe.value)}),pn=L(()=>!Ne.value&&!1!==G.batchRendering&&an.value>0&&!nn&&(G.maxLiveNodes??0)<=0&&!rn.value),mn=L(()=>pn.value),hn=L(()=>zt.value||mn.value),gn=L(()=>hn.value&&!1!==jt.value?.codeBlockEstimation),_n=new Map,vn=new Map,yn=new WeakMap,bn=null,xn=new WeakMap,Sn=new Map,Cn=[],wn=[],Tn=[],En=-1,Dn=ue(Cn),On=new Set,kn=R(0),An=0,jn=R(0),Mn=L(()=>(jn.value,Array.from(_n.entries()).sort((e,t)=>e[0]-t[0]))),Nn=R(null),Pn=R(null),Fn,In=null,Ln=0,Rn=null;function zn(){Fn.markFallbackHeightPrefixDirty()}function Bn(e){return Fn.getFallbackNodeHeight(e)}function Vn(e,t){return Fn.estimateHeightRange(e,t)}function Hn(e){return Fn.estimateIndexForOffset(e)}let{activeRestoreAnchor:Un,getRelativeScrollTopWithinContainer:Wn,setRelativeScrollTopWithinContainer:Gn,resolveAnchorOffset:Kn,clearRestoreReconcile:qn,scheduleRestoreReconcile:Jn,captureRestoreAnchor:Yn,restoreAnchor:Xn,getAnchorDrift:Zn}=function(e){let{isClient:t,containerRef:n,parsedNodeCount:r,requestFrame:i,cancelFrame:a,resolveScrollContainer:o,getNormalizedScrollTop:s,getOffsetTopWithinRoot:c,isReverseFlexScrollRoot:l,estimateIndexForOffset:u,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:p}=e,m=R(null),h=null,g=[];function _(){let e=o(),t=n.value;if(!e||!t)return null;let r=e.ownerDocument||t.ownerDocument||document;if(e===r.documentElement||e===r.body||e===r.scrollingElement){let e=t.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,s(e,r,!1)-c(t,e))}function v(e){var t;let r=o(),i=n.value;if(!r||!i)return;let a=Math.max(0,e),u=r.ownerDocument||i.ownerDocument||document,d=u.defaultView||(typeof window<`u`?window:null);if(r===u.documentElement||r===u.body||r===u.scrollingElement){let e=s(r,u,!0)+i.getBoundingClientRect().top;(t=d?.scrollTo)==null||t.call(d,0,Math.max(0,e+a));return}x1(r,u,c(i,r)+a,{isReverseFlexScrollRoot:e=>{var t;return(t=l?.(e))!=null&&t},getNormalizedScrollTop:s})}function y(e){let t=r.value;return d(0,p(e.nodeIndex,0,Math.max(0,t-1)))+Math.max(0,e.offsetWithinNodePx)}function b(){if(h!=null&&(a?.(h),h=null),t)for(let e of g)window.clearTimeout(e);g=[]}function x(e){let t=y(e),n=_();n!=null&&Math.abs(n-t)<=.5||v(t)}return{activeRestoreAnchor:m,getRelativeScrollTopWithinContainer:_,setRelativeScrollTopWithinContainer:v,resolveAnchorOffset:y,clearRestoreReconcile:b,applyRestoreAnchor:x,scheduleRestoreReconcile:function(){m.value&&t&&h==null&&(h=i?i(()=>{h=null,m.value&&x(m.value)}):null,h==null&&m.value&&x(m.value))},captureRestoreAnchor:function(){let e=_(),t=r.value;if(e==null||t<=0)return null;let n=p(u(e+1),0,t-1),i=d(0,n),a=f(n);return{nodeIndex:n,offsetWithinNodePx:p(e-i,0,Math.max(0,a-1))}},restoreAnchor:function(e){let n=r.value;if(m.value={nodeIndex:p(e.nodeIndex,0,Math.max(0,n-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},b(),x(m.value),t)for(let e of[0,120,280,480])g.push(window.setTimeout(()=>{m.value&&x(m.value)},e))},getAnchorDrift:function(e){let t=_();return t==null?null:t-y(e)}}}({isClient:q,containerRef:ge,parsedNodeCount:wt,requestFrame:$t,cancelFrame:en,resolveScrollContainer:()=>Nn.value||Be(),getNormalizedScrollTop:He,getOffsetTopWithinRoot:Ue,isReverseFlexScrollRoot:Ve,estimateIndexForOffset:Hn,estimateHeightRange:Vn,getFallbackNodeHeight:Bn,clamp:ui}),{nodeHeights:Qn,heightStats:$n,heightTreeSize:er,heightSumTree:tr,heightKnownTree:nr,averageNodeHeight:rr,resetHeightMeasurements:ir,pruneHeightMeasurements:ar,rebuildHeightTrees:or,recordNodeHeight:sr,removeNodeHeights:cr,exportHeightCache:lr,importHeightCache:ur,fenwickRangeSum:dr}=function(e={}){let t=N({}),n=N({total:0,count:0}),r=R(0),i=R([]),a=R([]);function o(){for(let e of Object.keys(t))delete t[Number(e)];n.total=0,n.count=0,r.value=0,i.value=[],a.value=[]}function s(e,t,n){for(let r=t+1;r0;r-=r&-r)n+=e[r];return n}function l(e){r.value=e;let n=Array(e+1).fill(0),o=Array(e+1).fill(0);for(let[r,i]of Object.entries(t)){let t=Number(r),a=Number(i);!Number.isFinite(t)||t<0||t>=e||!Number.isFinite(a)||a<=0||(s(n,t,a),s(o,t,1))}i.value=n,a.value=o}function u(e){if(!Number.isInteger(e)||e<0)return!1;let o=t[e];if(!Number.isFinite(o)||o<=0)return!1;if(delete t[e],n.total=Math.max(0,n.total-o),n.count=Math.max(0,n.count-1),r.value>e){let t=i.value,n=a.value;t.length&&n.length&&(s(t,e,-o),s(n,e,-1))}return!0}return{nodeHeights:t,heightStats:n,heightTreeSize:r,heightSumTree:i,heightKnownTree:a,averageNodeHeight:L(()=>n.count>0?Math.max(12,n.total/n.count):32),resetHeightMeasurements:o,pruneHeightMeasurements:function(e){if(e<=0)return void o();let r=0,i=0;for(let[n,a]of Object.entries(t)){let o=Number(n),s=Number(a);!Number.isFinite(o)||o<0||o>=e||!Number.isFinite(s)||s<=0?delete t[o]:(r+=s,i++)}n.total=r,n.count=i},rebuildHeightTrees:l,recordNodeHeight:function(o,c,l={}){(function(o,c,l={}){var u;if(!Number.isFinite(c)||c<=0)return!1;let d=t[o];if(d&&(!1===l.allowShrink&&co){let e=i.value,t=a.value;if(e.length&&t.length)if(d){let t=c-d;t!==0&&s(e,o,t)}else s(e,o,c),s(t,o,1)}!1!==l.notify&&((u=e.onHeightRecorded)==null||u.call(e))})(o,c,lY(cY({},l),{notify:!0}))},removeNodeHeight:function(t,n={}){var r;let i=u(t);return i&&!1!==n.notify&&((r=e.onHeightRecorded)==null||r.call(e)),i},removeNodeHeights:function(t,n={}){var r;let i=0;for(let e of t)u(Number(e))&&i++;return i>0&&!1!==n.notify&&((r=e.onHeightRecorded)==null||r.call(e)),i},exportHeightCache:function(){return Object.entries(t).map(([e,t])=>({index:Number(e),height:Number(t)})).filter(e=>Number.isFinite(e.index)&&e.index>=0&&Number.isFinite(e.height)&&e.height>0).sort((e,t)=>e.index-t.index)},importHeightCache:function(i,a={}){var o;if(!Array.isArray(i))return;let s=r.value,c=!1;if(a.mode!==`merge`){let e=Object.keys(t);if(e.length>0){for(let n of e)delete t[Number(n)];c=!0}}for(let e of i){let n=Number(e.index),r=Number(e.height);if(!Number.isInteger(n)||n<0||s>0&&n>=s||!Number.isFinite(r)||r<=0)continue;let i=t[n];i&&Math.abs(i-r)<=1||(t[n]=r,c=!0)}c&&(function(){let e=0,i=0,a=r.value;for(let[n,r]of Object.entries(t)){let o=Number(n),s=Number(r);!Number.isFinite(o)||o<0||a>0&&o>=a||!Number.isFinite(s)||s<=0?delete t[o]:(e+=s,i++)}n.total=e,n.count=i}(),s>0&&l(s),(o=e.onHeightRecorded)==null||o.call(e))},fenwickRangeSum:function(e,t,n){if(n<=t)return 0;let r=c(e,n-1);return t<=0?r:r-c(e,t-1)}}}({onHeightRecorded:()=>{zn(),Lt.value&&wo(),Un.value&&Jn(),Pn.value&&xa(),oo(`node-resize`)}});function fr(e){Number.isInteger(e)&&e>=0&&On.add(e)}function pr(e){for(let t of e)fr(Number(t))}function mr(e){An++;let t=!0;try{let n=e();return t=!1!==n,n}finally{An--,An===0&&t&&kn.value++}}function hr(){wn=[],Tn=[],En=-1,On.clear(),Dn.value=Cn}function gr(){hr(),mr(()=>ir()),Sn.clear()}function _r(e){!Number.isInteger(e)||e<0||e>=yt.value.length||Sn.set(e,pa(e))}function vr(e,t,n={}){let r=Qn[e];fr(e),sr(e,t,n);let i=Qn[e];return Object.is(r,i)?(On.delete(e),!1):(i&&i>0?_r(e):r&&Sn.delete(e),!0)}function yr(e,t){let n=ft(`getNodeLayoutHeight.slot.offsetHeight`,()=>_n.get(e)?.offsetHeight??0);return n>0?n:ft(`getNodeLayoutHeight.content.offsetHeight`,()=>t.offsetHeight)}function br(e,t={}){t.mode===`merge`?pr(e.map(e=>e.index)):hr(),mr(()=>ur(e,t)),La()}let xr=L(()=>Zt.value&&Xt.value),Sr=L(()=>!Ne.value&&!1!==G.batchRendering&&an.value>0&&(G.maxLiveNodes??0)<=0),Cr=L(()=>!Ne.value&&Je&&!0===qe.value&&!qt.value&&!Pt.value&&!Mt.value&&!xr.value&&!Sr.value),wr=L(()=>!!Qt&&xr.value),Tr=L(()=>qt.value||Lt.value),{focusIndex:Er,liveRange:Dr,updateLiveRange:Or}=function(e,t){let{parsedNodeCount:n,virtualizationEnabled:r,maxLiveNodesResolved:i,liveNodeBufferResolved:a,clamp:o}=t,s=a??L(()=>Math.max(0,e.liveNodeBuffer??60)),c=R(0),l=N({start:0,end:0});return{liveNodeBufferResolved:s,focusIndex:c,liveRange:l,updateLiveRange:function(){let e=n.value;if(!r.value||e===0)return l.start=0,void(l.end=e);let t=Math.min(i.value,e),a=s.value,u=o(c.value-a,0,Math.max(0,e-t));l.start=u,l.end=Math.min(e,u+t)}}}(G,{parsedNodeCount:wt,virtualizationEnabled:qt,maxLiveNodesResolved:Gt,liveNodeBufferResolved:Kt,clamp:ui}),kr=new Map,Ar=new Map,jr=new Map,Mr=[],Nr=new Map,Pr=new Set,Fr=R(0),Ir=!1,Lr=L(()=>(Fr.value,Pr.size)),Rr=new Map,zr=new Map,Br=R(0),Vr=L(()=>{Br.value;let e=0;for(let t of Rr.values())e+=Math.max(0,t);return e}),Hr=null,Ur=L(()=>{if(!qt.value)return yt.value.length;let e=Kt.value,t=Math.max(Dr.end+e,on.value),n=Math.min(yt.value.length,t);return Math.max(ln.value,n)});function Wr(){Ir||(Ir=!0,queueMicrotask(()=>{Ir=!1,Fr.value+=1}))}function Gr(e,t,n=`node-resize`){if(!q||typeof window>`u`)return null;let r=window.setTimeout(()=>{Pr.delete(r)&&Wr();try{t()}finally{oo(n)}},Math.max(0,e));return Pr.add(r),Wr(),r}function Kr(e){q&&e!=null&&(Pr.delete(e)&&Wr(),window.clearTimeout(e))}function qr(){if(q&&typeof window<`u`)for(let e of Pr)window.clearTimeout(e);Pr.size&&(Pr.clear(),Wr()),Mr.length=0,jr.clear()}function Jr(e){_e.value=e}function Yr(e){ve.value=e}function Xr(e){ye.value=e}let{cancelScheduledFocusSync:Zr,scheduleFocusSync:Qr}=function(e){let{isClient:t,containerRef:n,virtualizationEnabled:r,requestFrame:i,cancelFrame:a,syncFocusToScroll:o}=e,s=null;function c(){return n.value?.ownerDocument?.defaultView??(typeof window<`u`?window:null)}function l(){if(!s)return;let e=c();s.viaTimeout?e?e.clearTimeout(s.id):clearTimeout(s.id):a?.(s.id),s=null}return{cancelScheduledFocusSync:l,scheduleFocusSync:function(e={}){if(!r.value)return;if(!t)return void o(!0);if(e.immediate)return l(),void o(!0);if(s)return;let n=()=>{s=null,o()};if(i)return void(s={id:i(n),viaTimeout:!1});let a=c();s={id:a?a.setTimeout(n,16):setTimeout(n,16),viaTimeout:!0}}}}({isClient:q,containerRef:ge,virtualizationEnabled:qt,requestFrame:$t,cancelFrame:en,syncFocusToScroll:function(e=!1){if(!qt.value)return;let t=Nn.value||Be();if(!t)return;let n=t.ownerDocument||ge.value?.ownerDocument||document,r=n?.defaultView||(typeof window<`u`?window:null),i=t===n?.documentElement||t===n?.body,a=yt.value.length;if(a<=0)return;if(!i&&a>0&&Ve(t)){let n=ft(`syncFocusToScroll.clientHeight`,()=>t.clientHeight||0),r=ft(`syncFocusToScroll.scrollTop`,()=>t.scrollTop),i=r<0?-r:r;li(ui((o=Math.max(0,i)+.5*Math.max(0,n),Fn.estimateIndexForOffsetFromEnd(o)),0,Math.max(0,a-1)),e);return}var o;let s=function(e,t,n,r){let i=ge.value;if(!i)return null;let a=r?0:ft(`syncFocusToScroll.model.root.getBoundingClientRect`,()=>e.getBoundingClientRect().top),o=ft(`syncFocusToScroll.model.container.getBoundingClientRect`,()=>i.getBoundingClientRect().top),s=Math.max(0,a-o),c=r?ft(`syncFocusToScroll.model.viewport.clientHeight`,()=>n?.innerHeight??t.documentElement?.clientHeight??e.clientHeight??0):ft(`syncFocusToScroll.model.root.clientHeight`,()=>e.clientHeight);return ui(Hn(s+.5*Math.max(0,c)),0,Math.max(0,yt.value.length-1))}(t,n,r,i);if(s!=null)return void li(s,e);let c=i?null:ft(`syncFocusToScroll.root.getBoundingClientRect`,()=>t.getBoundingClientRect()),l=i?0:c.top,u=i?ft(`syncFocusToScroll.viewport.clientHeight`,()=>r?.innerHeight??t.clientHeight??0):c.bottom,d=Mn.value,f=null,p=null;for(let[e,t]of d){if(!t)continue;let n=ft(`syncFocusToScroll.slot.getBoundingClientRect`,()=>t.getBoundingClientRect());n.bottom<=l||n.top>=u||(f??=e,p=e)}if(f==null||p==null){let e=ge.value;if(!e)return;let a=i?{top:0}:ft(`syncFocusToScroll.fallback.root.getBoundingClientRect`,()=>t.getBoundingClientRect()),o=ft(`syncFocusToScroll.fallback.scrollTop`,()=>He(t,n,i)),s=i?(()=>{let t=ft(`syncFocusToScroll.fallback.container.getBoundingClientRect`,()=>e.getBoundingClientRect()),n=(i?0:a.top)-t.top;return Math.max(0,n)})():(()=>{let n=Ue(e,t);return Math.max(0,o-n)})(),c=i?ft(`syncFocusToScroll.fallback.viewport.clientHeight`,()=>r?.innerHeight??n?.documentElement?.clientHeight??t.clientHeight??0):ft(`syncFocusToScroll.fallback.root.clientHeight`,()=>t.clientHeight);li(ui(Hn(s+.5*Math.max(0,c)),0,Math.max(0,yt.value.length-1)),!0);return}li(Math.round((f+p)/2),e)}}),{visibleNodeIndices:$r,nodeVisibilityHandles:ei,nodeVisibilityWatchStops:ti,nodeVisibilityFallbackTimers:ni,clearVisibilityFallback:ri,markNodeVisible:ii,cleanupNodeVisibility:ai,destroyNodeVisibilityState:oi}=_0({isClient:q,shouldTrackVisibleNodeIndices:()=>xr.value,shouldCleanupNodeVisibility:()=>qt.value,onNodeMarkedVisible:e=>{qt.value?Qr():Er.value=ui(e,0,Math.max(0,yt.value.length-1))},onNodeVisibilityCleaned:e=>{_n.delete(e)&&so()}}),{cleanupScrollListener:si,setupScrollListener:ci}=function(e){let{isClient:t,virtualizationEnabled:n,listenerEnabled:r,scrollRootElement:i,resolveScrollContainer:a,scheduleFocusSync:o,onScroll:s}=e,c=null,l=null;function u(){c&&=(c(),null),l=null,i.value=null}function d(t){let n=e.getScrollTop?e.getScrollTop(t):t.scrollTop;return Math.max(0,Number.isFinite(n)?Math.abs(n):0)}return{cleanupScrollListener:u,setupScrollListener:function(){if(!t)return;if(!((e=r?.value)??n.value))return void u();var e;let f=a();if(!f)return void u();if(i.value===f&&c)return;u(),l=d(f);let p=()=>{if(s?.(),n.value){let e=function(e){let t=d(e),n=l;l=t;let r=Math.max(480,.75*(e.clientHeight||0));return n==null?t>r?{immediate:!0}:void 0:Math.abs(t-n)>r?{immediate:!0}:void 0}(f);e?o(e):o()}};f.addEventListener(`scroll`,p,{passive:!0}),i.value=f,c=()=>{f.removeEventListener(`scroll`,p)}}}}({isClient:q,virtualizationEnabled:qt,listenerEnabled:Tr,scrollRootElement:Nn,resolveScrollContainer:Be,scheduleFocusSync:Qr,onScroll:function(){let e=Pn.value;if(!e)return;let t=na();if(!t||function(e){if(Xa()>=Ln)return Rn=null,!1;let t=Rn;if(t==null)return!0;let n=Math.abs(e.scrollTop-t)<=2;return n||(Rn=null),n}(t))return;let n=ia(t);(n==null||n<-32||Math.abs(Math.max(0,n)-Math.max(0,e.distanceFromBottomPx))>32)&&ba(`restore`)},getScrollTop:e=>{let t=e.ownerDocument||ge.value?.ownerDocument||document,n=e===t.documentElement||e===t.body||e===t.scrollingElement;return ft(`scrollListener.getScrollTop`,()=>He(e,t,n))}});function li(e,t=!1){let n=ui(e,0,Math.max(0,yt.value.length-1));!t&&Math.abs(n-Er.value)<=1||(Er.value=n,Or())}function ui(e,t,n){return Math.min(Math.max(e,t),n)}function di(e=yt.value.length){let t=bt();return!Number.isInteger(t)||t<0?e:ui(t,0,e)}function fi(e){return e?.firstElementChild}function pi(e,t){return e?e.matches?.call(e,t)?e:e.querySelector(t):null}function mi(e,t){e<1||e>6||(be[e]=t)}function hi(){if(!zt.value)return void(we.value=0);let e=ft(`updateExperimentContainerWidth.clientWidth`,()=>ge.value?.clientWidth??0);we.value=e>0?e:0}let gi=null;function _i(){gi?.disconnect(),gi=null}let vi=tZ(`ViewportDeferredMarkdownCodeBlockNode`,i({loader:()=>uY(null,null,function*(){return(yield he(()=>import(`./index5-DTEBXfOq.js`),__vite__mapDeps([34,1,2,31,7]))).default}),loadingComponent:nZ,delay:0,suspensible:!1}),nZ);function yi(e){return e===vi}let bi=L(()=>A.value===`pre`?QX:A.value===`shiki`?vi:rZ);function xi(){return!1!==G.codeBlockProps?.showHeader}function Si(e,t,n){let r=Qn[t],i=typeof r==`number`&&r>0;if(Vt.value&&!i&&!function(e){return!!gt.value.paragraph&&(e.type===`paragraph`||e.type===`list_item`||e.type===`list`)}(e)){let t=p1(e,n,Te.value);if(t)return t}if(gn.value&&e.type===`code_block`){let t=function(e){if(e.type!==`code_block`)return null;let t=ns(e,Zo(e));return yi(t)?`markdown`:t===QX?`pre`:t===bi.value||t===rZ?`monaco`:null}(e);if(t===`monaco`||t===`markdown`||t===`pre`)return function(e,t){if(!e||e.type!==`code_block`)return null;let n=t.rendererKind,r=n!==`pre`&&!1!==t.showHeader,i=!!e.diff,a=0,o=500;if(n===`monaco`){let n=t.monacoOptions??{},r=g1(e,n,t.width),s=function(e){let t=typeof e?.fontSize==`number`&&e.fontSize>0?e.fontSize:12;return typeof e?.lineHeight==`number`&&e.lineHeight>0?e.lineHeight:Math.round(1.5*t)}(n),c=function(e,t){let n=typeof e?.padding?.top==`number`?e.padding.top:t?0:8,r=typeof e?.padding?.bottom==`number`?e.padding.bottom:t?0:8;return Math.max(0,n)+Math.max(0,r)}(n,i);o=typeof n.MAX_HEIGHT==`number`&&n.MAX_HEIGHT>0?n.MAX_HEIGHT:500,a=Math.round(r*s+c)}else if(n===`markdown`){let t=g1(e);a=Math.round(21*t+32)}else{let t=g1(e);a=Math.round(28*t),o=1/0}let s=Math.max(1,Math.min(a,o));return cY({kind:`code-block`,height:Math.round(s+(r?40:0)),contentHeight:s,rendererKind:n},i&&n===`monaco`?{diffInline:RX(t.monacoOptions??{},t.width??0)}:{})}(e,{rendererKind:t,monacoOptions:G.codeBlockMonacoOptions,showHeader:xi(),width:n})}return null}u(()=>{if(kn.value,An>0)return;let e=yt.value,t=xt();if(!e.length||!hn.value)return wn=[],Tn=[],En=-1,On.clear(),void(Dn.value=Cn);let n=we.value||ft(`estimatedNodeHeights.clientWidth`,()=>ge.value?.clientWidth||0);if(!Number.isFinite(n)||n<=0)return wn=[],Tn=[],En=-1,On.clear(),void(Dn.value=Cn);let r=function(e){return[Math.round(e),Vt.value,gn.value,Te.value,G.codeBlockMonacoOptions,xi(),A.value,gt.value,s1.value]}(n),i=wn.length<=e.length&&(o=r,(a=Tn).length===o.length&&a.every((e,t)=>Object.is(e,o[t])));var a,o;let s=i&&En===t?e.length:i?di(e.length):0,c=i?Array.from(On):[];wn.length=e.length;for(let t=s;t=0&&tDn.value);Fn=function(e){let t=!0,n=[0],r=``;function i(t){let n=e.nodeHeights[t];if(Number.isFinite(n)&&n>0)return n;let r=e.parsedNodes.value[t],i=r?.type,a=!!e.hasCustomParagraphComponent?.call(e),o=e.estimatedNodeHeights.value[t],s=o?.height;if(!function(e,t,n){return!!(n&&t?.kind===`simple-text`&&(e===`paragraph`||e===`list_item`||e===`list`))}(i,o,a)&&Number.isFinite(s)&&s>0)return s;let c=P1(r,e.getContainerWidth()||640);return i===`heading`||i===`paragraph`&&c<=28&&function(e,t){if(t)return!1;let n=e.children;return!Array.isArray(n)||!n.length||n.every(A1)}(r,a)?c:Math.max(e.averageNodeHeight.value,c)}function a(){let a=e.parsedNodes.value.length,o=e.getPrefixCacheKeyParts().join(`:`);if(!t&&r===o)return n;let s=Array(a+1);s[0]=0;for(let t=0;t=(r[n]??0))return n-1;let i=0,o=n-1,s=n-1;for(;i<=o;){let e=i+o>>1;(r[e+1]??0)>=t?(s=e,o=e-1):i=e+1}return s}function s(t,n){if(t>=n)return 0;if(e.heightEstimationActive.value)return function(t,n){let r=e.parsedNodes.value.length,i=F1(Math.trunc(t),0,r),o=F1(Math.trunc(n),i,r);if(i>=o)return 0;let s=a();return(s[o]??0)-(s[i]??0)}(t,n);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let r=0;for(let i=t;it<=0?0:e.fenwickRangeSum(i,0,t)+(t-e.fenwickRangeSum(a,0,t))*r,s=0,c=n.length-1,l=n.length-1;for(;s<=c;){let e=s+c>>1;o(e+1)>=t?(l=e,c=e-1):s=e+1}return l}let r=t;for(let t=0;t0||t++}return t}return{markFallbackHeightPrefixDirty:function(){t=!0},getFallbackNodeHeight:i,estimateHeightRange:s,estimateIndexForOffset:c,estimateIndexForOffsetFromEnd:function(t){let n=e.parsedNodes.value;if(!n.length)return 0;if(t<=0)return Math.max(0,n.length-1);if(e.heightEstimationActive.value){let e=a()[n.length]??0;return o(Math.max(0,e-t))}if(e.heightTreeSize.value===n.length){let e=s(0,n.length);return c(Math.max(0,e-t))}let r=t;for(let t=n.length-1;t>=0;t--){let n=e.nodeHeights[t]??e.averageNodeHeight.value;if(r<=n)return t;r-=n}return 0},getEstimatedNodeHeightCount:l,buildVirtualHeightSummary:function(t){let n=e.parsedNodes.value.length;return{totalNodes:n,measuredCount:e.heightStats.count,estimatedCount:l(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,estimatedTotalHeight:s(0,n),width:t.width??e.getContainerWidth()}}}}({parsedNodes:yt,nodeHeights:Qn,heightStats:$n,heightTreeSize:er,heightSumTree:tr,heightKnownTree:nr,averageNodeHeight:rr,heightEstimationActive:zt,estimatedNodeHeights:Ci,getContainerWidth:Ht,hasCustomParagraphComponent:()=>!!gt.value.paragraph,getPrefixCacheKeyParts:()=>{let e=O1(we.value||ft(`getFallbackHeightPrefix.clientWidth`,()=>ge.value?.clientWidth||0)),t=o.virtualScroll?.measurementKey==null?``:String(o.virtualScroll.measurementKey);return[yt.value.length,$n.count,Math.round($n.total),Math.round(100*rr.value),t,e,+!!zt.value,s1.value,Ce.value,+!!gt.value.paragraph]},fenwickRangeSum:dr}),s(()=>yt.value.length,e=>{var t;zn(),e<=0?gr():(ear(t))),e!==er.value&&or(e))},{immediate:!0});let wi=L(()=>{if(!qt.value)return yt.value.map((e,t)=>({node:e,index:t}));let e=yt.value.length,t=ui(Dr.start,0,e),n=ui(Dr.end,t,e);return yt.value.slice(t,n).map((e,n)=>({node:e,index:t+n}))}),Ti=L(()=>qt.value?Vn(0,Math.min(Dr.start,yt.value.length)):0),Ei=L(()=>{if(!qt.value)return 0;let e=yt.value.length;return Vn(Math.min(Dr.end,e),e)});function Di(){return Fn.buildVirtualHeightSummary({topSpacerHeight:Ti.value,bottomSpacerHeight:Ei.value,width:Fi()})}function Oi(){let e=yt.value;return lY(cY({},Di()),{probe:{paragraphReady:!!Te.value.paragraph,listItemReady:!!Te.value.listItem,listWrapperOverhead:Te.value.listWrapperOverhead,headingReadyLevels:Object.entries(Te.value.headings).filter(([,e])=>!!e).map(([e])=>Number(e))},nodes:e.map((e,t)=>({index:t,type:e.type,estimateKind:Ci.value[t]?.kind??null,rendererKind:Ci.value[t]?.rendererKind??null,estimatedHeight:Ci.value[t]?.height??null,estimatedContentHeight:Ci.value[t]?.contentHeight??null,measuredHeight:Qn[t]??null}))})}function ki(){return o.indexKey==null?Pt.value?`virtual-${ji()}`:`markdown-renderer`:String(o.indexKey)}function Ai(e){let t=String(e),n=`${ki()}-`;if(!t.startsWith(n))return null;let r=t.slice(n.length).match(/^(\d+)(?:$|-)/);if(!r)return null;let i=Number(r[1]);return!Number.isInteger(i)||i<0||i>=yt.value.length?null:i}function ji(){let e=o.virtualScroll?.sessionKey;return String(e!=null&&e!==``?e:o.indexKey??G.customId??pt)}function J(){let e=o.virtualScroll?.threadKey;return e==null||e===``?void 0:String(e)}let Mi=L(()=>J()??String(o.indexKey??G.customId??pt));function Ni(e){return(e??``)===(J()??``)}function Pi(){var e,t;return e=o.virtualScroll?.measurementKey,t=function(){let e=A.value;return function(e){let t=e.renderer,n=t===`monaco`?e.codeBlockMonacoOptions:void 0,r=e.codeBlockProps,i=t===`shiki`;return[e.isDark?`dark`:`light`,t===`monaco`?`code-rich`:t===`pre`?`code-pre`:`code-shiki`,!1===e.codeBlockStream?`code-static`:`code-stream`,k0(e.codeBlockMinWidth),k0(e.codeBlockMaxWidth),...i?[rq(r?.themes??e.themes,r?.langs??e.langs)]:[],k0(n?.fontSize),k0(n?.lineHeight),k0(n?.fontFamily),k0(n?.tabSize),k0(n?.MAX_HEIGHT),k0(n?.wordWrap),k0(n?.wrappingIndent),k0(n?.padding),k0(r?.showHeader),k0(r?.showCopyButton),k0(r?.showExpandButton),k0(r?.showPreviewButton),k0(r?.showCollapseButton),k0(r?.showFontSizeButtons)].join(`\0`)}({renderer:e,isDark:G.isDark,codeBlockStream:G.codeBlockStream,codeBlockMinWidth:G.codeBlockMinWidth,codeBlockMaxWidth:G.codeBlockMaxWidth,codeBlockMonacoOptions:e===`monaco`?G.codeBlockMonacoOptions:void 0,codeBlockProps:G.codeBlockProps,themes:e===`shiki`?G.themes:void 0,langs:e===`shiki`?G.langs:void 0})}(),[e==null?``:String(e),t].join(`\0`)}function Fi(){return Ht()}let Ii=L(()=>O1(Fi())),Li=L(()=>[Pi(),Ii.value].join(`\0`)),Ri=L(()=>Pt.value?[`virtual`,J()??``,ji(),Li.value].join(`\0`):o.indexKey);function zi(){Br.value+=1}function Bi(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=yt.value.length||e.sessionKey!==ji()||e.threadKey!==J()||e.layoutEpochKey!==Li.value)}function Vi(e){let t=String(e),n=zr.get(t);return n?Bi(n)?n.index:null:Ai(t)}function Hi(e=`async-node`){(Rr.size||zr.size)&&(Rr.clear(),zr.clear(),zi(),oo(e))}let Ui=m(pq,null),Wi={reportHeight(e,t){if(!Lt.value)return;let n=Vi(e);if(n==null)return;let r=kr.get(n);if(!r)return;let i=Number(t),a=yr(n,r);(function(e,t,n={}){mr(()=>vr(e,t,n))})(n,Number.isFinite(i)&&i>0?Math.max(i,a||0):a)},markPending(e){if(!Lt.value)return;let t=Ai(e);t!=null&&function(e,t){let n=zr.get(e);if(n&&Bi(n))return Rr.set(e,Math.max(0,Rr.get(e)??0)+1),zi(),void oo(`async-node`);Rr.set(e,1),zr.set(e,function(e){return{index:e,sessionKey:ji(),threadKey:J(),layoutEpochKey:Li.value}}(t)),zi(),oo(`async-node`)}(String(e),t)},markSettled(e){if(!Lt.value)return;let t=String(e),n=Vi(e);(n!=null||function(e){return Rr.has(String(e))}(t))&&function(e){let t=Rr.get(e)??0;return!(t<=0||(t<=1?(Rr.delete(e),zr.delete(e)):Rr.set(e,t-1),zi(),t===1&&oo(`async-node`),0))}(t)&&n!=null&&ho()}};function Gi(){let e=0;for(let t of kr.values())e+=ft(`getVisibleDomHeight.offsetHeight`,()=>t?.offsetHeight??0);return Math.ceil(Math.max(0,e))}d(pq,{reportHeight(e,t){Wi.reportHeight(e,t),Ui?.reportHeight(e,t)},markPending(e){Wi.markPending(e),Ui?.markPending(e)},markSettled(e){Wi.markSettled(e),Ui?.markSettled(e)}});let Ki,qi=null,Ji=null;function Yi(e){return!1!==e&&e!=null&&e!==``}function Xi(){return qt.value?function(){if(!qt.value)return!0;let e=yt.value.length,t=ui(Dr.start,0,e),n=ui(Dr.end,t,e);if(t>=n)return!0;for(let e=t;e=Ur.value}function Zi(){return!0===qe.value&&!Ye.value&&Vr.value===0&&Pr.size===0&&Nr.size===0&&Hr==null&&Xi()}function Qi(){if(o.virtualScroll?.settleMode!==`manual`||qi===ji()&&Ki===J())return!0;let e=o.virtualScroll?.settledToken;return!!Yi(e)&&Ji===Do(e)}function $i(){return Zi()&&Qi()}function ea(e,t){return t.totalNodes<=0?e===`final`?`final`:`estimate`:t.measuredCount>=t.totalNodes?e===`final`?`final`:`measured`:t.measuredCount>0||t.estimatedCount>0?`mixed`:`estimate`}function ta(e=`manual`,t){let n=Di(),r=function(e){return e||(!0===qe.value?!Xi()||Nr.size>0||Hr!=null?`measuring`:$i()?`settled`:`settling`:yt.value.length>0?`streaming`:`estimating`)}(t);return{sessionKey:ji(),threadKey:J(),phase:r,nodeCount:n.totalNodes,liveRange:{start:Dr.start,end:Dr.end},renderedCount:ln.value,measuredCount:n.measuredCount,estimatedCount:n.estimatedCount,averageNodeHeight:n.averageNodeHeight,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,visibleDomHeight:Gi(),totalHeight:ra(),width:n.width,final:!0===qe.value,stable:$i(),confidence:ea(r,n),reason:e}}function na(){let e=Nn.value||Be(),t=ge.value;if(!e||!t)return null;let n=e.ownerDocument||t.ownerDocument||document,r=e===n.documentElement||e===n.body||e===n.scrollingElement;return{root:e,doc:n,isViewportRoot:r,scrollTop:ft(`getScrollBox.scrollTop`,()=>He(e,n,r)),scrollHeight:ft(`getScrollBox.scrollHeight`,()=>r?Math.max(n.documentElement?.scrollHeight??0,n.body?.scrollHeight??0,e.scrollHeight??0):e.scrollHeight),clientHeight:ft(`getScrollBox.clientHeight`,()=>r?n.documentElement?.clientHeight||e.clientHeight||0:e.clientHeight)}}function ra(){let e=yt.value.length,t=Math.max(0,Vn(0,e)),n=ft(`getRendererLogicalHeight.offsetHeight`,()=>ge.value?.offsetHeight??0),r=Math.max(0,n>0?n:ft(`getRendererLogicalHeight.scrollHeight`,()=>ge.value?.scrollHeight??0));return e<=0?Math.ceil(n):qt.value?t>0?Math.max(1,Math.ceil(t),function(){let e=Ti.value+Ei.value;for(let t of _n.values())t&&(e+=Math.max(0,ft(`getVirtualizedDomLogicalHeight.offsetHeight`,()=>t.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,t){return e<=0||t<=0?0:t<=e+Math.max(512,.05*e)?Math.ceil(t):0}(t,r)):Math.max(1,Math.ceil(r)):Lt.value?t>0||$n.count>0||Fn.getEstimatedNodeHeightCount()>0?(cn.value&&ln.value,Math.max(1,Math.ceil(r),Math.ceil(t))):Math.ceil(r):Math.max(1,Math.ceil(r),Math.ceil(t))}function ia(e){let t=ge.value;if(!t)return null;let n=ft(`getRendererBottomDistanceFromViewport.getBoundingClientRect`,()=>t.getBoundingClientRect());return function(e){return e.isViewportRoot?e.clientHeight:ft(`getViewportBottomInRoot.getBoundingClientRect`,()=>e.root.getBoundingClientRect().bottom)}(e)-n.bottom}function aa(e={}){let t=!1!==e.requireViewport,n=function(e=64){let t=na(),n=ge.value;if(!t||!n)return!1;let r=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};let t=ft(`getVirtualViewportRect.getBoundingClientRect`,()=>e.root.getBoundingClientRect());return{top:t.top,bottom:t.bottom}}(t),i=ft(`isRendererNearVirtualViewport.getBoundingClientRect`,()=>n.getBoundingClientRect());return i.bottom>=r.top-e&&i.top<=r.bottom+e}();if(t&&!n)return null;let r=function(){let e=na(),t=ge.value;if(!e||!t||Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;let n=ia(e);return n==null?null:n>=-8&&n<=160?{type:`bottom`,distanceFromBottomPx:Math.max(0,n)}:null}();if(r)return{anchor:r,captured:!0};let i=Yn();if(i)return{anchor:{type:`node`,nodeIndex:i.nodeIndex,offsetWithinNodePx:i.offsetWithinNodePx},captured:n};if(!0===e.allowFallback){let e=function(){let e=yt.value.length;return e<=0?null:{type:`node`,nodeIndex:ui(Er.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function oa(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function sa(e,t){let n=e;for(let e=0;e8192?`${e.slice(0,8192)}...${e.length}`:e;return`${e.length}:${oa(t)}`}(e)}`;if(typeof e==`function`)return`fn`;if(typeof e!=`object`)return typeof e;if(t.has(e))return`cycle`;if(n>=6)return`max-depth`;t.add(e);try{if(Array.isArray(e)){if(e.length<=160){let r=[];for(let i=0;i=a&&i.push(c)}return[`a:${e.length}`,`h=${r.join(`,`)}`,`t=${i.join(`,`)}`,`all=${(o>>>0).toString(36)}`].join(`:`)}let r=e,i=Object.keys(r).filter(e=>{let t=r[e];return e!==`parent`&&e!==`el`&&e!==`component`&&(t==null||typeof t==`string`||typeof t==`number`||typeof t==`boolean`||ca.has(e))}).sort();return`o:${i.length}:${i.map(e=>`${e}=${la(r[e],t,n+1)}`).join(`;`)}`}finally{t.delete(e)}}let ua=-1,da=``,fa=[2166136261];function pa(e){let t=yt.value[e];return t?oa(la(t)):``}function ma(e,t){let n=e;for(let e=0;e>>0}function ha(){let e=Ce.value;if(ua===e)return da;let t=yt.value.length,n=di(t);(ua!==e-1||n>t||fa.length>>0).toString(36),ua=e,da}function ga(e,t={}){let n=!0===t.includeHeightCache,r=t.includeContentHash??n,i=n?function(e){let t=function(){let e=Number(o.virtualScroll?.heightCacheLimit??5e3);return!Number.isFinite(e)||e<=0?1/0:Math.max(1,Math.trunc(e))}();if(!Number.isFinite(t)||e.length<=t)return e;let n=new Map,r=e=>{!e||n.size>=t||n.set(e.index,e)},i=yt.value.length,a=ui(Dr.start-2*Kt.value,0,i),s=ui(Dr.end+2*Kt.value,a,i);for(let t of e)t.index>=a&&t.index=0&&n.sizee.index-t.index).slice(0,t)}(lr().map(e=>{let t=yt.value[e.index];return t?lY(cY({},e),{nodeType:String(t.type??``),signature:pa(e.index)}):null}).filter(e=>!!e)):[],a=aa({allowFallback:!0===t.allowAnchorFallback,requireViewport:t.requireViewport});return a||i.length||!0===t.includeEmptyState?lY(cY({sessionKey:e.sessionKey,threadKey:e.threadKey},a?{anchor:a.anchor,anchorCaptured:a.captured}:{anchorCaptured:!1}),{metrics:e,width:e.width,contentHash:r?ha():void 0,measurementKey:Pi()||void 0,heightCache:i.length?i:void 0}):null}function _a(e){var t,n;let r=na();if(!r)return;let i=function(e){let t=ge.value;if(!t)return null;let n=Ue(t,e.root),r=yt.value.length,i=ft(`getRendererBottomOffsetWithinRoot.offsetHeight`,()=>t.offsetHeight||0),a=Math.max(0,i>0?i:r>0?ft(`getRendererBottomOffsetWithinRoot.scrollHeight`,()=>t.scrollHeight||0):0),o=ra();return n+Math.max(a,o)}(r);if(i==null)return;let a=Math.max(0,e.distanceFromBottomPx),o=Math.max(0,i-r.clientHeight-a);(function(e){Ln=Xa()+120,Rn=e})(o),r.isViewportRoot?(n=(t=r.doc.defaultView)?.scrollTo)==null||n.call(t,0,o):x1(r.root,r.doc,o,{isReverseFlexScrollRoot:Ve,getNormalizedScrollTop:He})}let va=[];function ya(){if(q)for(In!=null&&(en?.(In),In=null);va.length;){let e=va.pop();e!=null&&window.clearTimeout(e)}}function ba(e){let t=!!Pn.value;Pn.value=null,Ln=0,Rn=null,ya(),t&&e&&oo(e)}function xa(){if(!Pn.value||!q||In!=null)return;let e=()=>{In=null;let e=Pn.value;e&&_a(e)};In=$t?$t(e):null,In??e()}function Sa(e,t={}){let n=yt.value.length;return n<=0?[]:e.filter(e=>!(!Number.isInteger(e.index)||e.index<0||e.index>=n)&&!(!Number.isFinite(e.height)||e.height<=0)&&!(t.requireSignature&&!e.signature)&&!(t.requireCompatibilityMetadata&&!e.nodeType&&!e.signature)&&function(e){let t=yt.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(t.type??``)||e.signature&&e.signature!==pa(e.index))}(e))}function Y(e){let t=O1(Fi()),n=O1(e);return t!==-1&&n!==-1&&t===n}function Ca(e){let t=Number(e?.width);if(Number.isFinite(t)&&t>0)return t;let n=Number(e?.metrics?.width);return Number.isFinite(n)&&n>0?n:null}function wa(e){return e.sessionKey===ji()&&!!Ni(e.threadKey)&&(e.measurementKey??``)===Pi()&&!!Y(Ca(e))&&!!function(e){let t=e.heightCache;return!!t?.length&&(Ta(e)?t.some(e=>!!(e.nodeType||e.signature)):t.some(e=>!!e.signature))}(e)}function Ta(e){return!!(e.contentHash&&e.contentHash===ha())}function Ea(e){return!Ta(e)}let Da=null,Oa=null,ka=null,Aa=null,ja=null;function Ma(e){let t=e.map(e=>[e.index,Math.round(10*e.height),e.nodeType??``,e.signature??``].join(``)).join(``),n=O1(Fi());return[J()??``,ji(),Pi(),yt.value.length,n,e.length,oa(t)].join(`:`)}function Na(e=(e=>(e=o.virtualScroll)?.heightCache)()){if(!Lt.value||!e?.length||yt.value.length<=0||!Y((t=o.virtualScroll)?.heightCacheWidth))return!1;var t;let n=Sa(e,{requireSignature:!0});if(!n.length)return!1;let r=Ma(n);return r===Da?(Oa=`standalone`,!0):(br(n,{mode:`merge`}),zn(),Da=r,Oa=`standalone`,eo(),oo(`restore`),!0)}function Pa(e,t={}){if(!Lt.value||!e||e.sessionKey!==ji()||!Ni(e.threadKey)||yt.value.length<=0)return!1;let r=!!e.heightCache?.length&&!Fa(),i=!e.anchor||!1===e.anchorCaptured&&!0!==t.allowUncapturedAnchor?null:e.anchor,a=!0===t.restoreAnchor&&!!i&&!Fa()&&Number(Ca(e))>0,o=!1;if(e.heightCache?.length&&wa(e)){let t=Sa(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Ea(e)});t.length&&(br(t,{mode:`merge`}),zn(),Da=Ma(t),Oa=`restore`,eo(),o=!0)}if(r||a)return!1;if(!t.restoreAnchor||!i)return o&&oo(`restore`),!0;let s=function(e,t){let n=e.anchor,r=n?n.type===`bottom`?`bottom:${Math.round(n.distanceFromBottomPx)}`:`node:${n.nodeIndex}:${Math.round(n.offsetWithinNodePx)}`:`none`;return[J()??``,ji(),Pi(),Ii.value,t,r].join(`:`)}(e,t.restoreToken??`imperative`);return ka===s?(o&&oo(`restore`),!0):(ka=s,function(e){let t=()=>{if(e.type===`node`)return ba(),void Xn({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(qn(),Un.value=null,Pn.value=e,ya(),_a(e),q)for(let e of[0,120,280,480])va.push(window.setTimeout(()=>{let e=Pn.value;e&&_a(e)},e))};(function(e){if(!qt.value)return!1;let t=yt.value.length;return!(t<=0||(Er.value=e.type===`node`?ui(e.nodeIndex,0,t-1):t-1,Or(),0))})(e)?n(t):t()}(i),oo(`restore`),!0)}function Fa(){let e=Fi();return Number.isFinite(e)&&e>0}function Ia(e){return e.sessionKey===ji()&&!!Ni(e.threadKey)&&(yt.value.length<=0||!(!e.heightCache?.length||Fa())||!(!(e.anchor&&Number(Ca(e))>0)||Fa()))}function La(){Sn.clear();for(let e of Object.keys(Qn)){let t=Number(e);Number.isInteger(t)&&t>=0&&t{let t=!1,n=null,r=()=>{t||(t=!0,n!=null&&window.clearTimeout(n),e())};if($t)return $t(r),void(n=window.setTimeout(r,50));n=window.setTimeout(r,0)})}function Ba(e,t=J(),n=Li.value){return ji()===e&&J()===t&&Li.value===n}function Va(){return uY(this,arguments,function*(e={}){let t=ji(),r=J(),i=Li.value,a=e.frames??2,s=e.timeoutMs??120,c=e.reason??`manual`,l=e.expectedSettledTokenKey,u=!0===e.flushPendingTimers,d=ta(c),f=()=>lY(cY({},d),{phase:d.final?`settling`:d.phase,stable:!1,confidence:d.confidence===`final`?`mixed`:d.confidence,reason:c}),p=()=>Ba(t,r,i)&&(l==null||Qa()===l);for(let e=0;ewindow.setTimeout(t,e))}(s),!p()||(u&&qr(),ho(),Ra(),!p()))return f();let m=Zi();m&&(qi=t,Ki=r,o.virtualScroll?.settleMode===`manual`&&l!=null&&Yi(o.virtualScroll?.settledToken)&&Qa()===l&&(Ji=Do(o.virtualScroll.settledToken)));let h=ta(c,p()&&m&&Qi()?`final`:void 0);return ro(h,!0),h})}let Ha=`content`,Ua=null,Wa=null,Ga=0,Ka=null,qa=null,Ja=null,Ya=null;function Xa(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Za(e){let t=Ka;if(!t)return!0;let n=o.virtualScroll?.heightDiffThresholdPx??1;return Math.abs(e.totalHeight-t.totalHeight)>n||e.sessionKey!==t.sessionKey||e.phase!==t.phase||e.stable!==t.stable||e.final!==t.final||e.threadKey!==t.threadKey||e.nodeCount!==t.nodeCount||e.measuredCount!==t.measuredCount||e.width!==t.width}function Qa(e=(e=>(e=o.virtualScroll)?.settledToken)()){return k0(e)}function $a(e,t){return[e,t.sessionKey,t.threadKey??``,Pi(),ha(),k0(o.virtualScroll?.settledToken),Math.round(t.totalHeight),Math.round(t.width)].join(`\0`)}function eo(){Ja=null,Ya=null,qa=null}function to(e){let t=e.heightCache;return t?.length?Ma(t):``}function no(e){let t=e.metrics,n=e.anchor?(r=e.anchor).type===`bottom`?`bottom:${Math.round(r.distanceFromBottomPx)}`:`node:${r.nodeIndex}:${Math.round(r.offsetWithinNodePx)}`:`none`;var r;return[e.sessionKey,e.threadKey??``,e.measurementKey??Pi(),e.contentHash??``,to(e),n,+!!e.anchorCaptured,t.liveRange.start,t.liveRange.end,t.renderedCount,t.nodeCount,Math.round(t.totalHeight),Math.round(t.width),t.phase,+!!t.stable].join(`\0`)}function ro(e,t=!1){if(!Lt.value||function(e=!1){return!e&&Pt.value&&!Rt.value}(t))return;let n=t||Za(e),r=function(e,t=!1){return t||e.stable||e.phase===`final`?{state:ga(e,{includeHeightCache:!0})}:{state:ga(e)}}(e,t).state,i=!!(r&&(n||function(e,t=!1){return!!t||no(e)!==qa}(r,t)));if(n&&(K(e),Ka=e,Ga=Xa()),r&&i&&(pe(r),r.anchor&&me(r.anchor),qa=no(r)),e.stable){let t=$a(`settled`,e);if(t!==Ja){Ja=t;let n=ga(e,{includeHeightCache:!0});n&&(pe(n),qa=no(n)),function(e){l(`render-settled`,e)}(e)}}if(e.phase===`final`){let t=$a(`final`,e);if(t!==Ya){Ya=t;let n=ga(e,{includeHeightCache:!0});n&&(pe(n),qa=no(n)),function(e){l(`render-final`,e)}(e)}}}function io(){Ua!=null&&(en?.(Ua),Ua=null),Wa!=null&&q&&(window.clearTimeout(Wa),Wa=null)}function ao(){Ua=null,Wa=null,function(e){if(Nr.size>0||Hr!=null)return!0;switch(e){case`node-resize`:case`async-node`:case`resize`:case`restore`:case`final`:case`manual`:return!0;default:return!1}}(Ha)&&(ho(),Ra()),ro(ta(Ha))}function oo(e){if(!Lt.value||(Ha=e,Ua!=null||Wa!=null))return;let t=Math.max(0,o.virtualScroll?.emitIntervalMs??32),n=Math.max(0,t-(Xa()-Ga)),r=()=>{Wa=null,Ua=$t?$t(ao):null,Ua??ao()};q&&n>0?Wa=window.setTimeout(r,n):r()}function so(){jn.value+=1}function co(e){if(cn.value&&e>=ln.value){let t=yt.value[e],n=!0===Ke.value&&!0!==qe.value&&e>=yt.value.length-2,r=t?.type===`code_block`||t?.type===`image`||t?.type===`mermaid`||t?.type===`infographic`;if(!n||r)return!1}return!xr.value||e=Ae.value&&(xe.value||(xe.value=!0,oi()),!wr.value||!Qt))return lo(e),void(t&&ii(e,!0));if(e{if(ni.delete(e),!xr.value||$r.value.has(e))return;let t=_n.get(e);if(!t)return;let n=Be(t),r=t.ownerDocument||document,i=r.defaultView||window,a=!n||n===r.documentElement||n===r.body,o=!a&&n?ft(`nodeVisibilityFallback.root.getBoundingClientRect`,()=>n.getBoundingClientRect()):null,s=a?0:o.top,c=a?ft(`nodeVisibilityFallback.clientHeight`,()=>i.innerHeight??n?.clientHeight??0):o.bottom,l=ft(`nodeVisibilityFallback.node.getBoundingClientRect`,()=>t.getBoundingClientRect());l.bottom>=s-500&&l.top<=c+500&&ii(e,!0)},1800+t);ni.set(e,n)}(e);let i=null;i=s(()=>r.isVisible.value,t=>{if(t){ri(e),ii(e,!0),i?.(),ti.delete(e),ei.get(e)===r&&ei.delete(e);try{r.destroy()}catch{}}},{immediate:!0}),ti.set(e,i),qt.value&&Qr()}function fo(){Hr=null,mr(()=>{let e=!1;for(let[t,n]of Nr)Nr.delete(t),kr.get(t)===n.el&&Ar.get(t)===n.version&&(e=vr(t,n.height,{allowShrink:n.allowShrink})||e);return e})}function po(){Hr!=null&&(en?.(Hr),Hr=null),Nr.clear()}function mo(e,t){(function(e,t,n){if(!Number.isFinite(n)||n<=0||kr.get(e)!==t)return;let r=Ar.get(e);if(r==null)return;let i=yt.value[e],a=Ye.value&&!0!==qe.value&&!o.nodes?.length&&e>=yt.value.length-2,s=!(!0===i?.loading||a),c=Nr.get(e),l=c?c.allowShrink&&s:s,u=c&&!l?Math.max(c.height,n):n;Nr.set(e,{height:u,allowShrink:l,version:r,el:t}),Hr??(Hr=$t?$t(fo):null,Hr??fo())})(e,t,yr(e,t))}function ho(){for(let[e,t]of kr)t&&mo(e,t)}function go(){bn?.disconnect(),bn=null,vn.clear()}function _o(){for(;Mr.length;)Kr(Mr.pop())}s(Rt,e=>{e&&oo(`content`)},{flush:`post`}),t({getVirtualMetrics:ta,captureVirtualState:function(e={}){var t;return ga(ta(`manual`),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!0===e.allowFallbackAnchor,requireViewport:!0===e.requireViewport,includeEmptyState:(t=e.includeEmptyState)==null||t})},restoreVirtualState:function(e,t={}){let n=!0===t.restoreAnchor,r=t.restoreToken==null?`imperative`:String(t.restoreToken);Aa=e,ja={restoreAnchor:n,restoreToken:r,allowUncapturedAnchor:!0===t.allowUncapturedAnchor},!Pa(e,{restoreAnchor:n,restoreToken:r,allowUncapturedAnchor:!0===t.allowUncapturedAnchor})&&Ia(e)||(Aa=null,ja=null)},forceMeasure:function(e=`manual`){return uY(this,null,function*(){yield n(),yield za(),ho(),Ra(),yield n();let t=ta(e);return ro(t,!0),t})},settle:Va,scrollToNode:function(e,t=`start`){ba(),qn();let r=yt.value.length;if(r<=0)return;let i=ui(e,0,r-1),a=()=>{let e=Kn({nodeIndex:i,offsetWithinNodePx:0}),n=Bn(i),r=na()?.clientHeight??0,a=Wn(),o=e;if(t===`center`)o=e-r/2+n/2;else if(t===`end`)o=e-r+n;else if(t===`nearest`&&a!=null){if(e>=a&&e+n<=a+r)return;o=eJt.value,e=>{if(!e){go();for(let e of jr.values())for(let t of e)Kr(t);jr.clear(),Ar.clear(),_o(),po()}},{immediate:!0}),s(qe,e=>{e&&function(){if(q&&qe.value&&kr.size){_o();for(let e of[80,240,640]){let t=Gr(e,()=>{for(let[e,t]of kr)t&&mo(e,t)},`final`);t!=null&&Mr.push(t)}}}(),oo(e?`final`:`content`)});let vo=S1(()=>oo(`content`),16),yo=S1(()=>oo(`batch`),16);s([()=>yt.value.length,()=>ln.value],()=>{Pn.value&&xa(),vo()},{flush:`post`,immediate:!0}),s([()=>Dr.start,()=>Dr.end],()=>{yo()},{flush:`post`});let{cleanupBatchScheduler:bo}=function(e){let{props:t,isClient:r,isTestEnv:i,parsedNodesIdentity:a,parsedNodeCount:o,desiredRenderedCount:c,datasetKey:l,batchingEnabled:u,incrementalRenderingActive:d,resolvedBatchSize:f,resolvedInitialBatch:p,renderedCount:m,adaptiveBatchSize:h,previousRenderContext:g,previousBatchConfig:_,requestFrame:v,cancelFrame:y,hasIdleCallback:b,cleanupNodeVisibility:x,onDatasetKeyChanged:S,onDatasetChanged:C}=e,w=null,T=`raf`,E=null,D=0,O=!1,k=!1,A=new Set,j=new Set;function M(){if(r){w!=null&&(T===`raf`&&y?y(w):T===`idle`&&typeof window.cancelIdleCallback==`function`?window.cancelIdleCallback(w):T===`timeout`&&window.clearTimeout(w),w=null),D+=1;for(let e of A)y&&y(e);for(let e of j)window.clearTimeout(e);A.clear(),j.clear(),E=null,O=!1,k=!1}}function N(){return typeof performance<`u`?performance.now():Date.now()}function ee(e){(function(e){if(!d.value)return;let n=Math.max(2,t.renderBatchBudgetMs??6),r=Math.max(1,f.value||1),i=Math.max(1,Math.floor(r/4));e>1.5*n?h.value=Math.max(i,Math.floor(.8*h.value)):e<.6*n&&h.value=o)return;let s=Math.max(1,e),l=()=>{let e=N();w=null;let i=E??s;E=null;let a=N();m.value=Math.min(o,m.value+i),x(m.value),function(e,i){if(!r)return void ee(i);O=!0;let a=++D;n().then(()=>{if(a!==D)return;let n=N(),r=Math.max(i,n-e),o=()=>{a===D&&ee(r)};if(v){let e=null,n=null,r=!1,i=()=>{r||(r=!0,e!==null&&(A.delete(e),e=null),n!==null&&(j.delete(n),window.clearTimeout(n),n=null),o())};e=v(()=>{i()}),A.add(e),n=window.setTimeout(()=>{e!==null&&y&&y(e),i()},Math.max(32,t.renderBatchIdleTimeoutMs??120)),j.add(n);return}let s=window.setTimeout(()=>{j.delete(s),o()},0);j.add(s)})}(e,N()-a)};if(!r||a.immediate)return void l();let u=Math.max(0,t.renderBatchDelay??16);if(E=E==null?s:Math.max(E,s),w==null){if(!i&&b&&window.requestIdleCallback){let e=Math.max(0,t.renderBatchIdleTimeoutMs??120);T=`idle`,w=window.requestIdleCallback(()=>l(),{timeout:e});return}if(v&&!i)return T=`raf`,void(w=v(()=>{u===0?l():(T=`timeout`,w=window.setTimeout(()=>l(),u))}));T=`timeout`,w=window.setTimeout(()=>l(),u)}}function F(e,t={}){O?k=!0:e==null?I():P(e,t)}function I(){d.value&&P(u.value?Math.max(1,Math.round(h.value)):Math.max(1,f.value))}return s([a,o,l,d,f,p,()=>t.renderBatchDelay],()=>{let e=o.value,n=g.value,i=l.value,a=!Object.is(i,n.key),s=e!==n.total,u=a||s;g.value={key:i,total:e};let v=_.value,y=t.renderBatchDelay??16,b=v.batchSize!==f.value||v.initial!==p.value||v.delay!==y||v.enabled!==d.value;_.value={batchSize:f.value,initial:p.value,delay:y,enabled:d.value},a&&S(e),(u||b||!d.value)&&M(),(u||b)&&(h.value=Math.max(1,f.value||1)),u&&C();let w=c.value;if(!e)return m.value=0,void x(0);if(!d.value)return m.value=w,void x(m.value);m.value=a||n.total===0||b?Math.min(w,p.value):Math.min(m.value,w);let T=Math.max(1,p.value||f.value||e);m.value{d.value&&(typeof t==`number`&&e<=t||e>m.value&&F())}),{cleanupBatchScheduler:M}}({props:G,isClient:q,isTestEnv:nn,parsedNodesIdentity:Ct,parsedNodeCount:wt,desiredRenderedCount:Ur,datasetKey:Ri,batchingEnabled:sn,incrementalRenderingActive:cn,resolvedBatchSize:an,resolvedInitialBatch:on,renderedCount:ln,adaptiveBatchSize:dn,previousRenderContext:un,previousBatchConfig:fn,requestFrame:$t,cancelFrame:en,hasIdleCallback:tn,cleanupNodeVisibility:ai,onDatasetKeyChanged:e=>{po(),gr(),zn(),eo(),e>0&&or(e)},onDatasetChanged:()=>{qt.value&&Qr({immediate:!0})}});s([Tr,qt,()=>ge.value,()=>je()],([e,t])=>{if(!e)return si(),void Zr();ci(),t?Qr({immediate:!0}):Zr()},{flush:`post`,immediate:!0}),s([()=>yt.value.length,()=>qt.value],e=>uY(null,[e],function*([e,t]){t&&e&&q&&(yield n(),Qr({immediate:!0}))}),{flush:`post`}),s(zt,e=>{e&&function(){if(Tt.value&&Et.value&&Dt.value&&Ot.value?.[1])return;let e=g({type:`paragraph`,children:[{type:`text`,content:`Probe paragraph text`,raw:`Probe paragraph text`}],raw:`Probe paragraph text`}),t=g({type:`list_item`,children:[e],raw:`- Probe paragraph text`}),n=g({type:`list`,ordered:!1,items:[t],raw:`- Probe paragraph text`});Tt.value=e,Et.value=t,Dt.value=n;let r={1:null,2:null,3:null,4:null,5:null,6:null};for(let e=1;e<=6;e++)r[e]=g({type:`heading`,level:e,text:`Probe heading`,children:[{type:`text`,content:`Probe heading`,raw:`Probe heading`}],raw:`${`#`.repeat(e)} Probe heading`});Ot.value=r}()},{immediate:!0}),s([()=>ge.value,zt],()=>{if(!zt.value)return _i(),void(we.value=0);hi(),_i(),zt.value&&ge.value&&typeof ResizeObserver<`u`&&(gi=new ResizeObserver(()=>{hi(),Un.value&&Jn(),Pn.value&&xa(),oo(`resize`)}),gi.observe(ge.value))},{immediate:!0}),s([zt,Ut,Li],()=>uY(null,null,function*(){if(!zt.value)return Te.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void zn();yield n(),function(){if(!zt.value||typeof window>`u`)return Te.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void zn();let e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},t=pi(fi(_e.value),`.paragraph-node`);e.paragraph=v1(_e.value,t,`pre-wrap`);let n=fi(ve.value)?.querySelector(`.paragraph-node`);e.listItem=v1(ve.value,n,`pre-wrap`);let r=ft(`readSimpleTextProbeProfile.list.offsetHeight`,()=>ye.value?.offsetHeight??0),i=ft(`readSimpleTextProbeProfile.listItem.offsetHeight`,()=>ve.value?.offsetHeight??0);e.listWrapperOverhead=Math.max(0,r-i);for(let t=1;t<=6;t++){let n=pi(fi(be[t]),`h${t}`);e.headings[t]=v1(be[t],n,`pre-wrap`)}Te.value=e,zn()}()}),{flush:`post`,immediate:!0}),s(()=>yt.value.length,()=>{qt.value&&Qr({immediate:!0})}),s([zt,we],()=>{zn(),qt.value&&Qr({immediate:!0}),Un.value&&Jn(),Pn.value&&xa(),oo(`resize`)},{immediate:!1}),s(()=>xr.value,e=>{if(e)for(let[e,t]of _n)uo(e,t);else if(oi(),qt.value)Qr({immediate:!0});else for(let[e,t]of _n)t&&ii(e,!0)},{immediate:!1}),s([ke,Ae,()=>je()],()=>{var e;(e=Qt.refresh)==null||e.call(Qt);for(let[e,t]of _n)uo(e,t)},{immediate:!1}),s([()=>G.viewportPriority,()=>yt.value.length,Ae],([e,t,n])=>{if(!1!==e){if(xe.value&&(t<=200||t<=n)){xe.value=!1;for(let[e,t]of _n)uo(e,t)}}else xe.value=!1}),s(()=>ln.value,()=>{qt.value&&Qr({immediate:!0})}),s([Er,Gt,Kt,()=>yt.value.length,qt],()=>{Or()},{immediate:!0});let xo=null,So=!1,Co=null;function wo(){xo=null,qi=null,Ki=void 0,Ji=null,eo()}function To(){po(),gr(),zn(),Sn.clear();let e=yt.value.length;e>0&&or(e),La()}function Eo(){io(),qr(),Ka=null,Da=null,Oa=null,ka=null,Aa=null,ja=null,So=!1,wo(),Hi(`restore`),qn(),ba()}function Do(e){return[J()??``,ji(),Pi(),Ii.value,Qa(e),yt.value.length,Math.round(Vn(0,yt.value.length)),Math.round(Fi()),$n.count,Math.round($n.total)].join(`:`)}function Oo(){return uY(this,null,function*(){let e=o.virtualScroll?.settledToken,t=Qa(e),r=ji(),i=J(),a=Li.value;if(Lt.value&&o.virtualScroll?.settleMode===`manual`&&Yi(e))if(Zi()){if(Do(e)!==Ji&&!So){So=!0;try{let e=yield Va({reason:`manual`,expectedSettledTokenKey:t}),n=Qa()===t;Ba(r,i,a)&&e.sessionKey===r&&e.threadKey===i&&n&&e.stable&&e.phase===`final`&&(Ji=Do(o.virtualScroll?.settledToken))}finally{So=!1,yield n();let e=o.virtualScroll?.settledToken,t=Yi(e)?Do(e):``;Ba(r,i,a)&&t&&Ji!==t&&Oo()}}}else oo(`manual`)})}s(Lt,(e,t)=>{if(e!==t){if(!e)return Eo(),void io();Eo(),To(),Co=Li.value,oo(`content`)}},{flush:`post`}),s([Lt,Li],([e,t])=>{e?Co==null?Co=t:Co!==t&&(Co=t,function(e=`resize`){po(),gr(),zn(),Sn.clear();let t=yt.value.length;t>0&&or(t),La(),Da=null,Oa=null,ka=null,Ka=null,So=!1,wo(),Na(),n(()=>{ho(),Un.value&&Jn(),Pn.value&&xa(),oo(e)})}(`resize`)):Co=null},{flush:`post`,immediate:!0}),s([Lt,()=>ji(),()=>J()],([e])=>{e&&(Eo(),To(),Hi(`content`),oo(`content`))}),s([Lt,()=>ji(),()=>J(),Li,()=>yt.value.length],([e])=>{e&&function(e=`async-node`){let t=!1;for(let[e,n]of Array.from(zr.entries()))Bi(n)||(zr.delete(e),Rr.delete(e),t=!0);t&&(zi(),oo(e))}(`async-node`)},{flush:`post`}),s([Lt,()=>o.virtualScroll?.sessionKey,()=>o.virtualScroll?.measurementKey,()=>o.indexKey,()=>Ce.value],([e])=>{e&&(eo(),function(e=`content`){if(!Lt.value)return;let t=[],n=yt.value.length,r=di(n);for(let e of Array.from(Sn.keys())){if(e>=n){t.push(e);continue}if(e=n&&Sn.delete(e);t.length&&(function(e,t={}){let n=Array.from(e,Number);pr(n);let r=0;if(mr(()=>(r=cr(n,t),r>0)),r>0)(function(e){for(let t of e)Sn.delete(t)})(n);else for(let e of n)On.delete(e)}(t,{notify:!1}),zn(),wo(),Un.value&&Jn(),Pn.value&&xa(),oo(e))}(`content`))},{flush:`post`,immediate:!0}),s([Lt,()=>yt.value.length,()=>ji(),()=>J()],([e,t,n,r],[i,a,o,s])=>{e&&i&&n===o&&r===s&&t!==a&&wo()},{flush:`post`}),s([Lt,()=>o.virtualScroll?.heightCache,()=>o.virtualScroll?.heightCacheWidth,()=>o.virtualScroll?.restoreState,()=>o.virtualScroll?.measurementKey,()=>yt.value.length,()=>ji(),we],()=>{Na()},{flush:`post`,immediate:!0}),s([Lt,()=>o.virtualScroll?.restoreState,()=>o.virtualScroll?.restoreAnchor,()=>o.virtualScroll?.measurementKey,()=>yt.value.length,()=>ji(),we],e=>uY(null,[e],function*([e,t]){if(!e||!t)return;yield n();let r=function(){let e=o.virtualScroll?.restoreAnchor;return e==null||!1===e?null:!0===e?`true`:String(e)}();Pa(t,{restoreAnchor:r!=null,restoreToken:r??void 0})}),{flush:`post`,immediate:!0}),s([Lt,we,()=>o.virtualScroll?.restoreState,()=>o.virtualScroll?.measurementKey],([e])=>{if(!e)return;let t=o.virtualScroll?.restoreState;t&&Da&&Oa===`restore`&&(wa(t)||(To(),Da=null,Oa=null,oo(`resize`)))},{flush:`post`}),s([Lt,()=>yt.value.length,()=>ji(),we],e=>uY(null,[e],function*([e]){let t=Aa,r=ja;e&&t&&(yield n(),!Pa(t,{restoreAnchor:!0===r?.restoreAnchor,restoreToken:r?.restoreToken??`imperative`,allowUncapturedAnchor:!0===r?.allowUncapturedAnchor})&&Ia(t)||(Aa=null,ja=null))}),{flush:`post`,immediate:!0}),s([Lt,qe,()=>o.virtualScroll?.settleMode,()=>ji(),()=>J(),Li,Vr,Lr,()=>ln.value,Ur,()=>$n.count,()=>$n.total],([e,t,n])=>{if(!e||!0!==t||n===`manual`||!$i())return;let r=function(){let e=yt.value.length;return[J()??``,ji(),Pi(),Ii.value,e,Math.round(Vn(0,e)),Math.round(Fi()),$n.count,Math.round($n.total)].join(`:`)}();xo!==r&&(xo=r,Va({reason:`final`}).then(e=>{e.stable||xo!==r||(xo=null)}))},{flush:`post`,immediate:!0}),s([Lt,qe,()=>o.virtualScroll?.settleMode,()=>o.virtualScroll?.settledToken,()=>ji(),()=>J(),Li,Vr,Lr,()=>ln.value,Ur,()=>yt.value.length,()=>$n.count,()=>$n.total],()=>{Oo()},{flush:`post`,immediate:!0}),s([()=>yt.value.length,qt,Gt,Kt,()=>Dr.start,()=>Dr.end],([e,t,n,r,i,a])=>{Pe.value&&rt(`virtualization`,{nodes:e,virtualization:t,maxLiveNodes:n,buffer:r,focusIndex:Er.value,scroll:t?(()=>{let e=Nn.value||Be();return e?{reverse:Ve(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:i,end:a},rendered:ln.value})}),s([()=>G.customId],([e],t,n)=>{if(!e||kt)return;let r=function(e,t){return e?(a1.controllers[e]=t,()=>{a1.controllers[e]===t&&delete a1.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Yn,restoreAnchor:Xn,getAnchorDrift:Zn,getReport:Oi});n(()=>{r()})},{immediate:!0}),ne(()=>{(function(){if(Lt.value)try{ho(),Ra();let e=ta(`manual`);Za(e)&&(K(e),Ka=e,Ga=Xa());let t=ga(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});t&&(pe(t),t.anchor&&me(t.anchor),qa=no(t))}catch{}})(),bo(),oi(),tt(),go();for(let e of jr.values())for(let t of e)Kr(t);jr.clear(),Ar.clear(),Sn.clear(),_o(),po(),_i(),qn(),ba(),io(),si(),Zr()});let ko=tZ(`ViewportDeferredMermaidBlockNode`,i({loader:()=>uY(null,null,function*(){try{return(yield he(()=>import(`./index11-BLu1h3am.js`),__vite__mapDeps([35,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".`,e),QX}}),loadingComponent:D0,delay:0}),D0),Ao=tZ(`ViewportDeferredInfographicBlockNode`,i({loader:()=>uY(null,null,function*(){try{return(yield he(()=>import(`./index10-cR1J5t3a.js`),__vite__mapDeps([36,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.`,e),QX}}),loadingComponent:E0,delay:0}),E0),jo=tZ(`ViewportDeferredD2BlockNode`,i(()=>uY(null,null,function*(){try{return(yield he(()=>import(`./index8-CkSxjxQO.js`),__vite__mapDeps([37,1,2]))).default}catch(e){return console.warn(`[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".`,e),QX}})),QX),Mo={text:eZ,paragraph:oQ,heading:qZ,code_block:rZ,list:$Z,list_item:QZ,blockquote:FZ,table:mQ,definition_list:zZ,footnote:WZ,footnote_reference:AY,footnote_anchor:VZ,admonition:U0,vmr_container:yQ,hardbreak:DZ,link:yZ,image:NX,thematic_break:gQ,math_inline:iZ,math_block:aZ,strong:fZ,emphasis:TZ,strikethrough:mZ,highlight:CZ,insert:xZ,subscript:uZ,superscript:cZ,emoji:DY,checkbox:TY,checkbox_input:TY,inline_code:KY,html_inline:UY,reference:oZ,html_block:rQ},No=L(()=>ki()),Po=L(()=>b1(G.codeBlockProps)),Fo=L(()=>b1(G.codeBlockProps,{omit:[`langs`]})),Io=L(()=>cY(cY({stream:G.codeBlockStream,darkTheme:G.codeBlockDarkTheme,lightTheme:G.codeBlockLightTheme,monacoOptions:G.codeBlockMonacoOptions,themes:G.themes,langs:A.value===`shiki`?G.langs:void 0,minWidth:G.codeBlockMinWidth,maxWidth:G.codeBlockMaxWidth},typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{}),Fo.value)),Lo=L(()=>cY(lY(cY({},Io.value),{langs:G.langs}),Po.value));function Ro(e){return typeof e==`boolean`?e:void 0}let zo=L(()=>{let e=G.codeBlockProps||{},t={},n=Ro(e.showLineNumbers);n!==void 0&&(t.showLineNumbers=n);let r=Ro(e.diffInline);r!==void 0&&(t.diffInline=r);let i=function(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}(e.reservedHeightPx);return i!==void 0&&(t.reservedHeightPx=i),t}),Bo=L(()=>cY(cY({stream:G.codeBlockStream,darkTheme:G.codeBlockDarkTheme,lightTheme:G.codeBlockLightTheme,themes:G.themes,langs:G.langs,minWidth:G.codeBlockMinWidth,maxWidth:G.codeBlockMaxWidth},typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{}),Po.value)),Vo=L(()=>cY({},G.mermaidProps||{})),Ho=L(()=>cY({},G.d2Props||{})),Uo=L(()=>cY({},G.infographicProps||{})),Wo=L(()=>({typewriter:D.value,fade:G.fade,customHtmlTags:vt.value.customHtmlTags})),Go=L(()=>cY(cY({},Wo.value),typeof Fe.value==`boolean`?{showTooltip:Fe.value}:{})),Ko=L(()=>cY(cY({},Wo.value),typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{})),qo=L(()=>cY(cY({},Wo.value),typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{})),Jo=L(()=>cY(cY({},Wo.value),typeof Fe.value==`boolean`?{showTooltips:Fe.value}:{}));function Yo(e){return Array.isArray(e.children)&&e.children.length>0}let Xo=L(()=>wi.value.map(e=>{let t=function(e){if(e.type!==`code_block`)return e;let t=e,n=[String(t.language??``),String(t.loading??``),String(t.diff??``),String(t.code??``),String(t.originalCode??``),String(t.updatedCode??``),String(t.raw??``)].join(`\0`),r=xn.get(t);if(r&&r.signature===n)return r.node;let i=cY({},t);return xn.set(t,{signature:n,node:i}),i}(e.node),n=Zo(t),r=ns(t,n);if((t.type===`html_block`||t.type===`html_inline`)&&r===Mo[t.type]){let e=t,n=String(e.tag??``).trim().toLowerCase()||TL(e.content);if(n){let i=gt.value[n];if(_t.value.has(n)&&i)r=i,t=lY(cY({},e),{type:n,tag:n,content:OL(e.content,n)});else if(DL(e.content??e.raw,n)){let n=String(e.content??e.raw??``);t.type===`html_inline`?(r=eZ,t={type:`text`,content:n,raw:n}):(r=oQ,t={type:`paragraph`,children:[{type:`text`,content:n,raw:n}],raw:n})}}}let i=t.type===`code_block`&&A.value===`pre`&&r===QX&&!Qo(gt.value,n),a=cY({},function(e,t,n){let r=t??Zo(e);if(e.type===`code_block`){let t=r?Qo(gt.value,r):void 0;if(n&&A.value===`pre`&&!t&&n===QX)return zo.value;if(n&&r&&n===t)return r===`mermaid`?es(e):r===`infographic`?ts(e):r===`d2`||r===`d2lang`?Ho.value:Lo.value;if(n&&n===gt.value.code_block)return Lo.value;if(yi(n))return Bo.value}return r===`mermaid`?es(e):r===`infographic`?ts(e):r===`d2`||r===`d2lang`?Ho.value:e.type===`link`?Go.value:e.type===`list`?Ko.value:e.type===`blockquote`?qo.value:e.type===`table`?Jo.value:e.type===`code_block`?Io.value:Wo.value}(t,n,r)),o=zt.value?Ci.value[e.index]:null;t.type===`code_block`&&o?.kind===`code-block`&&(a=lY(cY({},a),i?{reservedHeightPx:o.height??o.contentHeight}:{estimatedHeightPx:o.height,estimatedContentHeightPx:o.contentHeight,estimatedDiffInline:o.diffInline})),i||t.type!==`code_block`||n!==`mermaid`||dJ(a.estimatedPreviewHeightPx)!=null||(a=lY(cY({},a),{estimatedPreviewHeightPx:gJ(pJ(String(t.code??``)))})),i||t.type!==`code_block`||n!==`infographic`||dJ(a.estimatedPreviewHeightPx)!=null||(a=lY(cY({},a),{estimatedPreviewHeightPx:_J(mJ(String(t.code??``)))})),t.type===`math_block`&&(a=lY(cY({},a),{cacheScope:ht}));let s=function(e,t){let n=String(e.type);return!_Y(n)&>.value[n]===t}(t,r),c=s?IY(t,Ie.value):void 0;return lY(cY({},e),{node:t,component:r,bindings:a,customBindings:cY(cY({},c??{}),a),rendersCustomNode:s,hasSlotChildren:Yo(t),slotContent:String(t.content??``),isCodeBlock:t.type===`code_block`,indexKey:`${No.value}-${e.index}`,vnodeKey:`${Mi.value}\0${e.index}\0${t.type}`})}));function Zo(e){return e?.type===`code_block`?String(e.language??``).trim().toLowerCase():``}function Qo(e,t){let n=t.trim().toLowerCase();if(n)for(let t of[n,Aq(n),$K(n)]){let n=t&&e[t];if(n)return n}}function $o(e,t,n,r){let i=cY({},e.value);return dJ(i.estimatedPreviewHeightPx)??(i.estimatedPreviewHeightPx=r(n(String(t?.code??``)),void 0,i.maxHeight===`none`?null:dJ(i.maxHeight)??void 0)),i}function es(e){return $o(Vo,e,pJ,gJ)}function ts(e){return $o(Uo,e,mJ,_J)}function ns(e,t){if(!e)return vQ;let n=gt.value,r=n[String(e.type)];if(e.type===`code_block`){let i=t??Zo(e);return(i?Qo(n,i):void 0)||(A.value===`pre`?n.code_block||QX:i===`mermaid`?n.mermaid||ko:i===`infographic`?n.infographic||Ao:i===`d2`||i===`d2lang`?n.d2||jo:r||n.code_block||bi.value)}return r||Mo[String(e.type)]||vQ}function rs(e){l(`click`,e)}function is(e){var t;(t=e.target)!=null&&t.closest(`[data-node-index]`)&&l(`mouseover`,e)}function as(e){var t;(t=e.target)!=null&&t.closest(`[data-node-index]`)&&l(`mouseout`,e)}function os(e){l(`mouseover`,e)}function ss(e){l(`mouseout`,e)}let cs=R(null),ls=R(!1),us=R(null),ds=L(()=>!(G.domMode!==`minimal`||Ne.value||!1!==G.fade||D.value||ls.value||pn.value||qt.value||Ft.value||Mt.value||Zt.value||Object.keys(gt.value).length!==0)),fs,ps=null,ms=0,hs=0,gs=0,_s=[`code_block`,`admonition`,`table`,`math_block`,`html_block`,`image`,`thematic_break`],vs=new Set(_s),ys=[`.typewriter-cursor`,`.height-estimation-probes`,..._s.map(e=>`[data-node-type="${e}"]`),`script`,`style`].join(`,`);function bs(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return typeof t==`string`&&vs.has(t)}function xs(e){if(!e||typeof e!=`object`)return 0;let t=e,n=t.raw??t.content??t.code;if(typeof n==`string`)return n.length;let r=t.children;if(Array.isArray(r))return r.reduce((e,t)=>e+xs(t),0);let i=t.items;return Array.isArray(i)?i.reduce((e,t)=>e+xs(t),0):0}function Ss(){fs&&=(clearTimeout(fs),void 0)}function Cs(){ms+=1,ps!=null&&(en?.(ps),ps=null)}function ws(){Cs(),Os(),cs.value&&(cs.value.style.visibility=`hidden`)}function Ts(e){if(e.nodeType!==Node.TEXT_NODE||!(e.textContent??``).trim())return!1;let t=e.parentElement;return!!t&&!t.closest(ys)}function Es(e){let t=e.lastChild;for(;t;){if(Ts(t))return t;if(t.nodeType===Node.ELEMENT_NODE){let e=t;if(!e.matches(ys)&&e.lastChild){t=e.lastChild;continue}}for(;t&&t!==e&&!t.previousSibling;)t=t.parentNode;if(!t||t===e)break;t=t.previousSibling}return null}function Ds(){let e=Xo.value;for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n||bs(n.node)||!co(n.index))continue;let r=_n.get(n.index);if(!r)continue;let i=Es(r);if(i)return i}return null}function Os(){us.value&&=(us.value.classList.remove(M0),null)}function ks(){if(T.value!==`simple`||!q||!ls.value||!ge.value)return void Os();let e=Ds(),t=e?function(e){let t=e.parentElement?.closest(`.text-node`);return t instanceof HTMLElement?t:e.parentElement}(e):null;t!==us.value&&(Os(),t&&(t.classList.add(M0),us.value=t))}function As(){if(T.value!==`precise`||!q||!ls.value||ps!=null)return;let e=ms,t=()=>{ps=null,e===ms&&function(){if(T.value!==`precise`||!(q&&ls.value&&ge.value&&cs.value))return;let e=ge.value,t=cs.value;t.style.visibility=`hidden`;let n=Ds();if(!n)return;let r=0,i=0,a=20,o=!1;if(n?.textContent){let t=n.textContent.length,s=document.createRange();s.setStart(n,Math.max(0,t-1)),s.setEnd(n,t);let c=typeof s.getClientRects==`function`?s.getClientRects():void 0,l=c?.[c.length-1]??n.parentElement?.getBoundingClientRect();if(l){let t=ft(`typewriterCursor.root.getBoundingClientRect`,()=>e.getBoundingClientRect());r=l.right-t.left+e.scrollLeft,i=l.top-t.top+e.scrollTop,a=l.height||a,o=!0}s.detach()}o&&(t.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,t.style.height=`${a}px`,t.style.visibility=`visible`)}()};$t?ps=$t(t):t()}return s([Ge,()=>o.content,()=>o.nodes,()=>G.typewriter,qe],()=>uY(null,null,function*(){if(!q||Ne.value||!Re.value)return;if(qe.value)return ls.value=!1,Ss(),void ws();if(o.nodes?.length)return ls.value=!1,Ss(),ws(),hs=(o.content??``).length,void(gs=Ge.value.length);let e=function(){return o.nodes?.length?o.nodes.reduce((e,t)=>e+xs(t),0):(o.content??``).length}(),t=function(){return o.nodes?.length?o.nodes.reduce((e,t)=>e+xs(t),0):Ge.value.length}(),r=!bs(yt.value[yt.value.length-1]),i=e>hs,a=t>gs;if(!D.value||!r||!i&&!a)return D.value&&r||(ls.value=!1,ws()),hs=e,void(gs=t);hs=e,gs=t,ls.value=!0,T.value===`precise`&&cs.value&&(cs.value.style.visibility=`hidden`),Ss(),yield n(),T.value===`simple`?ks():(Os(),As()),fs=setTimeout(()=>{fs=void 0,ls.value=!1},3e3)}),{flush:`post`,immediate:!0}),s(ls,e=>uY(null,null,function*(){e?(yield n(),T.value===`simple`?ks():(Os(),T.value===`precise`&&As())):ws()}),{flush:`post`}),s(T,()=>uY(null,null,function*(){if(q&&!Ne.value&&Re.value&&ls.value){if(yield n(),T.value===`simple`)return Cs(),void ks();Os(),T.value===`precise`?As():ws()}}),{flush:`post`}),s([()=>ln.value,()=>Dr.start,()=>Dr.end],()=>uY(null,null,function*(){q&&!Ne.value&&Re.value&&ls.value&&(yield n(),T.value===`simple`?ks():(Os(),T.value===`precise`&&As()))}),{flush:`post`}),ne(()=>{Ss(),Cs(),Os(),mt.clear()}),(e,t)=>{let n=r(`NodeRenderer`,!0);return z(Ne)?(c(!0),W(M,{key:0},_(Xo.value,e=>(c(),W(M,{key:e.vnodeKey},[e.rendersCustomNode?(c(),P(x(e.component),re({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":G.customId,"is-dark":G.isDark,onClick:rs,onMouseover:os,onMouseout:ss,onCopy:t[0]||=e=>f(e),onHandleArtifactClick:t[1]||=e=>l(`handleArtifactClick`,e)}),{default:B(()=>[e.hasSlotChildren?(c(),P(n,re({key:0,ref_for:!0},St.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(n,re({key:1,ref_for:!0},St.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(x(e.component),re({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onClick:rs,onMouseover:os,onMouseout:ss,onCopy:t[2]||=e=>f(e),onHandleArtifactClick:t[3]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`]))],64))),128)):(c(),W(`div`,{key:1,ref_key:`containerRef`,ref:ge,class:V([`markstream-vue markdown-renderer`,[{dark:G.isDark},{virtualized:qt.value},{"virtual-scroll-coordinated":Rt.value},{"stable-layout":Cr.value},{"typewriter-simple-cursor":ls.value&&T.value===`simple`}]]),"data-custom-id":G.customId,onClick:rs,onMouseover:is,onMouseout:as},[Bt.value||qt.value?(c(),W(M,{key:0},[Bt.value?(c(),P(T0,{key:0,width:Ut.value,"flow-root":qt.value||Rt.value,"paragraph-node":Tt.value,"list-item-node":Et.value,"list-node":Dt.value,"heading-nodes":Ot.value,"set-paragraph-wrapper":Jr,"set-list-item-wrapper":Yr,"set-list-wrapper":Xr,"set-heading-wrapper":mi},null,8,[`width`,`flow-root`,`paragraph-node`,`list-item-node`,`list-node`,`heading-nodes`])):E(``,!0),qt.value?(c(),W(`div`,{key:1,class:`node-spacer`,style:ae({height:`${Ti.value}px`}),"aria-hidden":`true`},null,4)):E(``,!0)],64)):E(``,!0),ds.value?(c(!0),W(M,{key:1},_(Xo.value,e=>(c(),W(M,{key:e.vnodeKey},[co(e.index)?(c(),P(x(e.component),re({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onMouseover:t[4]||=e=>l(`mouseover`,e),onMouseout:t[5]||=e=>l(`mouseout`,e),onCopy:t[6]||=e=>f(e),onHandleArtifactClick:t[7]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):E(``,!0)],64))),128)):(c(!0),W(M,{key:2},_(Xo.value,e=>(c(),W(`div`,{key:e.vnodeKey,ref_for:!0,ref:t=>uo(e.index,t),class:`node-slot`,"data-node-index":e.index,"data-node-type":e.node.type},[co(e.index)?(c(),W(`div`,{key:0,ref_for:!0,ref:t=>function(e,t){t||function(e){let t=`${ki()}-${e}`,n=!1;for(let r of Array.from(Rr.keys()))(zr.get(r)?.index===e||r===t||r.startsWith(`${t}-`))&&(Rr.delete(r),zr.delete(r),n=!0);n&&(zi(),oo(`async-node`))}(e),Nr.delete(e),function(e){let t=(Ar.get(e)??0)+1;Ar.set(e,t)}(e);let n=jr.get(e);if(n){for(let e of n)Kr(e);jr.delete(e)}if(function(e){let t=vn.get(e);t&&(bn?.unobserve(t),yn.delete(t),vn.delete(e))}(e),!t||!Jt.value)return kr.delete(e),void Ar.delete(e);kr.set(e,t);let r=()=>{mo(e,t)};queueMicrotask(r);let i=(bn||typeof ResizeObserver>`u`||(bn=new ResizeObserver(e=>{if(e.length)for(let t of e){let e=yn.get(t.target),n=vn.get(e??-1);e!=null&&n&&mo(e,n)}else ho()})),bn);if(i&&(vn.set(e,t),yn.set(t,e),i.observe(t)),typeof window<`u`){let t=yt.value[e]?.type===`code_block`?[16,80,240,800]:qe.value?[80]:[];if(t.length){let n=t.map(e=>Gr(e,r,`node-resize`)).filter(e=>e!=null);n.length&&jr.set(e,n)}}}(e.index,t),class:`node-content`},[e.isCodeBlock?e.rendersCustomNode?(c(),P(x(e.component),re({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[12]||=e=>f(e),onHandleArtifactClick:t[13]||=e=>l(`handleArtifactClick`,e)}),{default:B(()=>[e.hasSlotChildren?(c(),P(n,re({key:0,ref_for:!0},St.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(n,re({key:1,ref_for:!0},St.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(x(e.component),re({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[14]||=e=>f(e),onHandleArtifactClick:t[15]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(oe,{key:0,name:`fade`,css:!1!==G.fade,appear:!1!==G.fade},{default:B(()=>[e.rendersCustomNode?(c(),P(x(e.component),re({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[8]||=e=>f(e),onHandleArtifactClick:t[9]||=e=>l(`handleArtifactClick`,e)}),{default:B(()=>[e.hasSlotChildren?(c(),P(n,re({key:0,ref_for:!0},St.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`nodes`,`index-key`])):e.slotContent?(c(),P(n,re({key:1,ref_for:!0},St.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,[`content`,`final`,`index-key`])):E(``,!0)]),_:2},1040,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`])):(c(),P(x(e.component),re({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":G.customId,"is-dark":G.isDark,onCopy:t[10]||=e=>f(e),onHandleArtifactClick:t[11]||=e=>l(`handleArtifactClick`,e)}),null,16,[`node`,`loading`,`index-key`,`custom-id`,`is-dark`]))]),_:2},1032,[`css`,`appear`]))],512)):(c(),W(`div`,{key:1,class:`node-placeholder`,style:ae({height:`${Bn(e.index)}px`})},null,4))],8,j0))),128)),ls.value&&T.value===`precise`?(c(),W(`span`,{key:3,ref_key:`typewriterCursorRef`,ref:cs,class:`typewriter-cursor`,"aria-hidden":`true`},null,512)):E(``,!0),qt.value?(c(),W(`div`,{key:4,class:`node-spacer`,style:ae({height:`${Ei.value}px`}),"aria-hidden":`true`},null,4)):E(``,!0)],42,A0))}}})),[[`__scopeId`,`data-v-a9489508`]]),P0=N0;P0.install=e=>{let t=new Set([`MarkdownRender`,`NodeRenderer`,P0.__name,P0.name].filter(e=>!!e));for(let n of t)e.component(n,N0)};var F0=Object.freeze(Object.defineProperty({__proto__:null,default:P0},Symbol.toStringTag,{value:`Module`})),I0={key:0,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},L0={key:1,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},R0={key:2,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},z0={key:3,xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,class:`admonition-icon`},B0={class:`admonition-title`},V0=[`aria-expanded`,`aria-controls`],H0=[`id`],U0=wY(G({__name:`AdmonitionNode`,props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:[`copy`],setup(e,{emit:t}){var n;let r=e,i=t,a=L(()=>{if(r.node.title&&r.node.title.trim().length)return r.node.title;let e=r.node.kind||`note`;return e.charAt(0).toUpperCase()+e.slice(1)}),o=R(!!r.node.collapsible&&!((n=r.node.open)==null||n));function s(){r.node.collapsible&&(o.value=!o.value)}let u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(t,n)=>(c(),W(`div`,{class:V([`admonition`,[`admonition-${r.node.kind}`]])},[F(`div`,{id:u,class:`admonition-legend`},[r.node.kind===`note`||r.node.kind===`info`?(c(),W(`svg`,I0,[...n[1]||=[F(`circle`,{cx:`12`,cy:`12`,r:`10`},null,-1),F(`path`,{d:`M12 16v-4`},null,-1),F(`path`,{d:`M12 8h.01`},null,-1)]])):r.node.kind===`tip`?(c(),W(`svg`,L0,[...n[2]||=[F(`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`},null,-1),F(`path`,{d:`M9 18h6`},null,-1),F(`path`,{d:`M10 22h4`},null,-1)]])):r.node.kind===`warning`||r.node.kind===`caution`?(c(),W(`svg`,R0,[...n[3]||=[F(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`},null,-1),F(`path`,{d:`M12 9v4`},null,-1),F(`path`,{d:`M12 17h.01`},null,-1)]])):r.node.kind===`danger`||r.node.kind===`error`?(c(),W(`svg`,z0,[...n[4]||=[F(`polygon`,{points:`7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2`},null,-1),F(`path`,{d:`M12 8v4`},null,-1),F(`path`,{d:`M12 16h.01`},null,-1)]])):E(``,!0),F(`span`,B0,U(a.value),1),r.node.collapsible?(c(),W(`button`,{key:4,class:`admonition-toggle`,"aria-expanded":!o.value,"aria-controls":`${u}-content`,onClick:s},[(c(),W(`svg`,{style:ae({rotate:o.value?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...n[5]||=[F(`path`,{d:`m9 18 6-6-6-6`},null,-1)]],4))],8,V0)):E(``,!0)]),l(F(`div`,{id:`${u}-content`,class:`admonition-content`,"aria-labelledby":u},[v(z(P0),{"index-key":`admonition-${e.indexKey}`,nodes:r.node.children,"custom-id":r.customId,typewriter:r.typewriter,fade:r.fade,onCopy:n[0]||=e=>i(`copy`,e)},null,8,[`index-key`,`nodes`,`custom-id`,`typewriter`,`fade`])],8,H0),[[A,!o.value]])],2))}}),[[`__scopeId`,`data-v-a83480e1`]]);U0.install=e=>{e.component(U0.__name,U0)};var W0=()=>he(()=>import(`./d2_markstream-vue-xMoF3M5G.js`),[]),G0=null,K0=W0,q0=null,J0=!1,Y0=!1,X0=0;function Z0(){return uY(this,null,function*(){if(G0)return G0;let e=K0,t=X0;return e?e===W0&&J0?null:q0||(q0=uY(null,null,function*(){let n;try{n=yield e()}catch(n){if(e===W0)return t===X0&&e===K0&&(J0=!0,function(e){Y0||(Y0=!0,console.warn(`[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.`,e))}(n)),null;throw n}finally{t===X0&&e===K0&&(q0=null)}return t!==X0||e!==K0?null:n?(G0=function(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}(n),G0):null}),q0):null})}var Q0=null,$0=null,e2=null,t2=0;function n2(){return typeof $0==`function`}function r2(){return uY(this,null,function*(){if(Q0)return Q0;let e=$0,t=t2;return e?e2||(e2=uY(null,null,function*(){let n=yield e();if(t!==t2||e!==$0)return null;let r=function(e){if(!e)return null;let t=e.default??e,n=typeof t==`function`&&typeof t.prototype?.render==`function`?t:e.Infographic??t?.Infographic;return typeof n==`function`?n:null}(n);return t!==t2||e!==$0?null:r?(Q0=r,Q0):null}).finally(()=>{t===t2&&e===$0&&(e2=null)}),e2):null})}function i2(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)?t:0}function a2(e,t){e?.(t)}function o2(e,t){return e?(a2(t,`readElementBoxHeight.offsetHeight`),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function s2(e,t){let n=o2(e,t);if(!e||typeof window>`u`||typeof window.getComputedStyle!=`function`)return n;a2(t,`readElementOuterHeight.getComputedStyle`);let r=window.getComputedStyle(e),i=i2(r.marginTop),a=i2(r.marginBottom);return Math.ceil(Math.max(0,n+i+a))}function c2(e,t,n){if(!e)return 0;let r=function(e){return e?e.matches?.call(e,`.markstream-vue.markdown-renderer`)?e:e.querySelector(`.markstream-vue.markdown-renderer`):null}(e);if(!r)return 0;let i=Number.isFinite(n)?Number(n):s2(e,t),a=o2(r,t);return Math.max(0,i-a)}function l2(e,t,n){let r=n.getKey?.call(n,e,t)??e.id??t;return String(r)}function u2(e,t,n){return n.getKind?.call(n,e,t)??String(e.kind??``)}function d2(e,t,n){let r=n.getContent?.call(n,e,t)??e.content;return typeof r==`string`?r:``}function f2(e,t,n){let r=n.getFinal?.call(n,e,t);if(typeof r==`boolean`)return r;let i=e.final;return typeof i!=`boolean`||i}function p2(e,t,n){return n.getRevision?.call(n,e,t)??e.revision}function m2(e,t,n){let r=u2(e,t,n);return r===`assistant-markdown`||r===`markdown`||!r&&d2(e,t,n).length>0}function h2(e,t,n){let r=n.estimateItemHeight?.call(n,e,t);if(Number.isFinite(r)&&r>0)return r;let i=u2(e,t,n);return i===`assistant-markdown`||i===`markdown`?360:i===`system-divider`?44:i===`tool-call`?72:i===`thinking`?92:i===`error`?76:i===`user-message`?88:d2(e,t,n).length>0?360:96}var g2=Symbol(`markstreamLanguageIconResolver`);function _2(e){return i(e)}_2(()=>he(()=>import(`./index3-mVb7iXlv.js`),__vite__mapDeps([38,31,7,1,2]))),_2(()=>he(()=>import(`./index6-KRBW8xCP.js`),__vite__mapDeps([33,1,2]))),_2(()=>he(()=>import(`./index7-ClZ3JBPh.js`),__vite__mapDeps([32,1,2]))),_2(()=>he(()=>import(`./index11-BLu1h3am.js`),__vite__mapDeps([35,1,2]))),_2(()=>he(()=>import(`./index10-cR1J5t3a.js`),__vite__mapDeps([36,1,2]))),_2(()=>he(()=>import(`./index8-CkSxjxQO.js`),__vite__mapDeps([37,1,2]))),_2(()=>he(()=>import(`./index4-BTqbYikG.js`),__vite__mapDeps([39,30,7,1,2]))),_2(()=>he(()=>import(`./index5-DTEBXfOq.js`),__vite__mapDeps([34,1,2,31,7]))),_2(()=>he(()=>import(`./index9-C3TPz6s3.js`),__vite__mapDeps([40,1,2])));var v2=`cjs.css.csv.gif.htm.html.jpeg.jpg.js.json.jsx.log.md.mjs.pdf.png.scss.svg.ts.tsx.txt.vue.webp.xml.yaml.yml`.split(`.`),y2=new Set([`AGENTS.md`,`CHANGELOG.md`,`Dockerfile`,`LICENSE`,`Makefile`,`README.md`,`package.json`,`pnpm-lock.yaml`,`pnpm-workspace.yaml`,`tsconfig.json`,`vite.config.ts`]),b2=[...v2].toSorted((e,t)=>t.length-e.length).join(`|`),x2=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${b2}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${b2})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?])`].join(``),`gi`),S2=/[),.;!?]+$/;function C2(e){let t=e.toLowerCase();return v2.some(e=>t.endsWith(`.${e}`))}function w2(e){let t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${b2}))["']`,`gi`),r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!e)continue;let n=e.split(`/`).pop();n&&t.set(n,e)}return t}function T2(e,t={}){let n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;let r=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!r)return null;let i=(r[1]??``).replace(S2,``);if(!i)return null;let a=i.split(`/`).pop()??i,o=i.includes(`/`),s=y2.has(a),c=C2(a);if(o&&!s&&!c)return null;if(!o&&!s){let e=t.aliases?.get(a);if(!e)return null;i=e}let l=r[2]??r[3],u=l?Number(l):void 0;return{path:i,line:u!==void 0&&Number.isFinite(u)&&u>0?u:void 0}}function E2(e,t={}){let n=[];x2.lastIndex=0;let r;for(;(r=x2.exec(e))!==null;){let e=r[0]??``,i=r[1]??``,a=e.indexOf(i);if(a<0)continue;let o=i+(r[2]??r[3]?e.slice(a+i.length):``),s=o.replace(S2,``),c=o.length-s.length;o=s;let l=T2(o,t);if(!l)continue;let u=r.index+a,d=u+o.length;n.push({...l,start:u,end:d,text:o}),c>0&&(x2.lastIndex-=c)}return n}var D2=12e4,O2=6e4,k2=32,A2=3e4,j2=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function M2(e){let t=0,n=0,r=0;j2.lastIndex=0;let i;for(;(i=j2.exec(e))!==null;){let e=i[3]??``;t+=1,n+=e.length,r=Math.max(r,e.length)}return{codeRenderer:e.length>=D2||n>=O2||t>=k2||r>=A2?`pre`:`shiki`,codeFenceCount:t,codeChars:n}}function N2(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}var P2=/\s/,F2=/\p{Nd}/u;function I2(e,t){let n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function L2(e,t){if(t<=0)return;let n=e.codePointAt(t-1),r=n!==void 0&&n>=55296&&n<=56319&&t>1?t-2:t-1,i=e.codePointAt(r);return i===void 0?void 0:String.fromCodePoint(i)}function R2(e){return e!==void 0&&P2.test(e)}function z2(e){return e!==void 0&&F2.test(e)}function B2(e){return e!==void 0&&e>=`A`&&e<=`Z`}var V2=new RegExp(String.raw`^(?:AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHF|CLF|CLP|CNY|COP|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SLL|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|UYU|UZS|VED|VES|VND|VUV|WST|XAF|XCD|XOF|XPF|YER|ZAR|ZMW|ZWL|HK|US|SG|AU|CA|NZ|NT|TW|RMB|MEX|TT|BZ|EU|UK)$`);function H2(e,t){if(!B2(e[t-1]))return!1;let n=t-1;for(;n>0&&B2(e[n-1]);)n--;return V2.test(e.slice(n,t))||z2(I2(e,t+1))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??``)&&!/\p{L}/u.test(I2(e,t+1)??``)}function U2(e,t){if(!B2(e[t-1]))return!1;let n=t-1;for(;n>0&&B2(e[n-1]);)n--;return V2.test(e.slice(n,t))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??``)}function W2(e,t){let n=e[t+1];return z2(I2(e,t+1))?!0:(n===`-`||n===`+`||n===`.`||n===`−`)&&z2(I2(e,t+2))}var G2=/^[-–—,;:~([/]$/;function K2(e,t){let n=e[t+1];if(n!==`-`&&n!==`+`&&n!==`.`||!z2(I2(e,t+2)))return!1;let r=e[t-1];return r!==void 0&&G2.test(r)}var q2=String.raw`[,;:~\-–—/\s()=*×]|and|or`;function J2(e){let t=e.replace(new RegExp(String.raw`^(?:${q2})+`,`u`),``);for(;;){let e=t.replace(new RegExp(String.raw`^\p{L}+(?:${q2})+`,`u`),``).replace(/^[\p{L}][\p{L} ]*(?=\p{Nd})/u,``);if(e===t)break;t=e}if(!/\p{Nd}/u.test(t))return!1;let n=String.raw`[-+]?[\p{Nd}][\p{Nd},.'’]*`;return new RegExp(String.raw`^${n}(?:\p{L}+)?(?:(?:${q2})+${n}(?:\p{L}+)?)*$`,`u`).test(t)}var Y2=1,X2=2,Z2=3,Q2=-1;function $2(e){let t=e.length,n=new Uint8Array(t),r=new Int32Array(t+1).fill(Q2),i=new Int32Array(t+1),a=new Int32Array(t+1),o=[],s=[];{let n=[];for(let r=0;r\`*—–“”‘’`),l=[];for(let t of e.matchAll(/\b(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/gi))l.push(t.index);for(let t of e.matchAll(/\b(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,})(?=(?:\/|\?|:\d))/gi))l.push(t.index);for(let t of e.matchAll(/(?:\.{1,2})?\/[\p{L}\p{Nd}._-]+(?:\/[\p{L}\p{Nd}._-]*)*\?/gu))(t.index===0||!/[\w~/.-]/.test(e[t.index-1]??``))&&l.push(t.index);l.sort((e,t)=>e-t);let u=-1;for(let n of l){if(nn+7&&!/[\w/?#@~.+&=%-]/.test(e[r+1]??``))break}o.push([n,r]),u=r}let d=[];for(let n=0;n]/.test(s))continue;let c=Q2,l=Q2;for(;i`){l=i;break}if(!a&&n===`/`&&e[i+1]===`>`){l=i+1;break}if(!/\s/.test(n)){c=i;break}for(;i`){l=i;break}if(a){c=i;break}if(r===`/`&&e[i+1]===`>`){l=i+1;break}let o=/^[a-zA-Z_:][\w:.-]*/.exec(e.slice(i));if(!o){c=i;break}i+=o[0].length;let s=i;for(;s`]+/.exec(e.slice(s));if(!t){c=s;break}i=s+t[0].length}}}if(l!==Q2)d.push([n,l+1]),n=l;else if(c!==Q2){let t=e.indexOf(`<`,n+1);n=(t!==-1&&t`,n+2);t===-1?f=!1:(d.push([n,t+2]),n=t+1,i=!0)}else if(r===`!`){if(e[n+2]===`-`&&e[n+3]===`-`){if(p){let t=e.indexOf(`-->`,n+4);t===-1?p=!1:(d.push([n,t+3]),n=t+2,i=!0)}}else if(e.startsWith(`[CDATA[`,n+2)){if(m){let t=e.indexOf(`]]>`,n+9);t===-1?m=!1:(d.push([n,t+3]),n=t+2,i=!0)}}else if(h&&/[A-Z]/.test(e[n+2]??``)){let t=e.indexOf(`>`,n+3);t===-1?h=!1:(d.push([n,t+1]),n=t,i=!0)}}if(i)continue;if(r!==void 0&&/[a-zA-Z]/.test(r)){let r=/^[a-zA-Z][a-zA-Z0-9+.-]{1,31}:/.exec(e.slice(n+1));if(r){let i=n+1+r[0].length;for(;i`&&e[i]!==`<`&&!/\s/.test(e[i]);)i++;if(e[i]===`>`){d.push([n,i+1]),n=i;continue}}}if(r===void 0||!/[\w.!#$%&'*+/=?^`{|}~-]/.test(r))continue;let a=n+1;for(;a`&&(d.push([n,a+1]),n=a)}}d.sort((e,t)=>e[0]-t[0]);let g=[];for(let e of d){let t=g.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):g.push([e[0],e[1]])}o.push(...g);let _=e=>{let t=0;for(;t=(s[t]?.[1]??0);)t++;let n=s[t];return n!==void 0&&e>=n[0]},v=e=>{let t=0;for(;t=(g[t]?.[1]??0);)t++;let n=g[t];return n!==void 0&&e>=n[0]},y=[],b=null,x=0,S=!1;for(let n=0;n`&&(S=!1);continue}if(!(_(n)||v(n))){if(b!==null){e[n]===b&&(b=null);continue}if(y.length>0&&(e[n]===`"`||e[n]===`'`)&&n>0&&/\s/.test(e[n-1]??``))b=e[n];else if(e[n]===`[`)x++;else if(e[n]===`]`)x>0&&e[n+1]===`(`&&(y.push(n),S=e[n+2]===`<`,n++),x=Math.max(0,x-1);else if(e[n]===`(`&&y.length>0)y.push(-1);else if(e[n]===`)`&&y.length>0){let t=y.pop();if(t!==void 0&&t>=0){let r=e.slice(t+2,n);(/\s/.exec(r)===null||r.startsWith(`<`)&&/^<(?:\\[<>]|[^<>])*>$/.test(r)||/^[^\s]*\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\(([^()\\]|\\.)*\))$/.test(r))&&o.push([t,n+1])}}}}o.sort((e,t)=>e[0]-t[0]);let C=[];for(let e of o){let t=C.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):C.push([e[0],e[1]])}let w=e=>{let t=0,n=C.length-1;for(;t<=n;){let r=t+n>>1,i=C[r];if(i===void 0)return!1;if(e=i[1])t=r+1;else return!0}return!1},T=new Uint8Array(t);{let n=-1,r=!1,i=!1,a=0;for(let o=0;o<=t;o++){let s=o0&&(c===`{`?a++:c===`}`&&a--)}}for(let r=0;r=0;e--)n[e]===Z2&&(E=e),r[e]=E;let D=/^[\p{L}\p{Nd}\\|{([+.¬°-±×÷′-″←-⇿∀-⋿^_<>=-]$/u,O=/[^\p{L}\p{Nd}\s]$/u,k=/[^\s\u0020-\u007E\u0370-\u03FF\u{1D400}-\u{1D7FF}\p{Nd}¬°-±×÷′-″←-⇿∀-⋿]/u,A=/(?:^|\s)[a-z]{2,}/,j=(t,n)=>{let o=I2(e,t+1);if(o===void 0||!D.test(o))return!1;let s=r[t+1]??Q2;if(s!==Q2){let n=e.slice(t+1,s);return s-(t+1)!==((e.codePointAt(t+1)??0)>65535?2:1)&&k.test(n)||/[,;:!?]$/.test(n)||/^[a-z]{2,}$/.test(n)?!1:(i[s]??0)-(i[t+1]??0)===0&&(a[s]??0)-(a[t+1]??0)===0}return O.test(n)||k.test(n)||A.test(n)};return(o,s=-1)=>{if(e[o]!==`$`||n[o]===Y2||e[o+1]===`$`||e[o-1]===`$`&&s!==o||H2(e,o)||o+1>=t||R2(I2(e,o+1)))return null;let c=r[o+1]??Q2;if(c===Q2||(i[c]??0)-(i[o+1]??0)>0||(a[c]??0)-(a[o+1]??0)>0)return null;let l=e.slice(o+1,c);return/^\{[A-Z_][A-Z0-9_]*(?:\}$|[:-])/.test(l)||e[c+1]===`{`&&/^\{[A-Za-z_][A-Za-z0-9_]*(?:[:-][^{}]*)?\}$/.test(l)||z2(L2(e,o))&&J2(l)||W2(e,o)&&(j(c,l)||U2(e,c)||/\s/.test(l)&&/\p{Nd}$/u.test(l)&&!/[+\-*/^=_<>|\\¬°-±×÷′-″←-⇿∀-⋿]/.test(l))||e[c+1]===`$`&&!/\p{L}/u.test(l)&&O.test(l)?null:{content:l,end:c+1}}}var nse=/^---[ \t]*(?:\r\n|\n)/,rse=/^---[ \t]*$/;function ise(e){let t=nse.exec(e);if(t===null)return{frontmatter:null,body:e};let n=t[0].length,r=n;for(;n<=e.length;){let t=e.indexOf(` +`,n);t===-1&&(t=e.length);let i=e.slice(n,t);if(i.endsWith(`\r`)&&(i=i.slice(0,-1)),rse.test(i)){let i=e.slice(r,n);return i===``?{frontmatter:null,body:e}:{frontmatter:i,body:t\n]*>|[^()\s]+)\)/g,ase=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,ose=/^[a-zA-Z]:(?:[\\/]|%5c)/i,sse=/^[A-Za-z0-9._~-]$/,cse=`pythinker-code://skill/`,t4;function n4(e){return e.replaceAll(`%`,`%25`).replaceAll(`&`,`%26`).replaceAll(`<`,`%3C`).replaceAll(`>`,`%3E`).replaceAll(/[[\]\\]/g,`\\$&`).replaceAll(` +`,`%0A`).replaceAll(`\r`,`%0D`)}function lse(e){return e.replaceAll(/\\([\\[\]])/g,`$1`).replaceAll(`%26`,`&`).replaceAll(`%3C`,`<`).replaceAll(`%3E`,`>`).replaceAll(`%0A`,` +`).replaceAll(`%0D`,`\r`).replaceAll(`%25`,`%`)}function r4(e){let t=``;for(let n of e){let e=n.codePointAt(0);e>127||sse.test(n)?t+=n:t+=`%${e.toString(16).toUpperCase().padStart(2,`0`)}`}return t}function use(e){let t=e.split(`/`).map(r4).join(`/`);return t.startsWith(`//`)?`/%2F${t.slice(2)}`:t}function i4(e){return e.startsWith(`<`)&&e.endsWith(`>`)?e.slice(1,-1):e}function a4(e){let t=i4(e);try{return decodeURIComponent(t)}catch{return t}}function dse(e){let t=i4(e);return!t||t.startsWith(`#`)||t.startsWith(`?`)||t.startsWith(`//`)?null:t.startsWith(`pythinker-code://skill/`)&&t.length>23?`skill`:ase.test(t)&&!ose.test(t)?null:/(?:[\\/]|%5c)$/i.test(t)?`folder`:`file`}function o4(e,t){if(!t)return;let n=e.at(-1);n?.type===`text`?n.value+=t:e.push({type:`text`,value:t})}function s4(e){if(e.kind===`skill`)return`[${n4(e.name)}](${cse}${r4(e.name)})`;let t=e.kind===`folder`&&!/[\\/]$/.test(e.path)?`${e.path}/`:e.path;return`[${n4(e.name)}](${use(t)})`}function c4(e){let t=[],n=0;e4.lastIndex=0;for(let r of e.matchAll(e4)){let i=r.index;o4(t,e.slice(n,i));let a=r[0],o=r[1],s=r[2],c=e[i-1]===`!`?null:dse(s);if(c&&o){let e=c===`skill`?a4(s).slice(23):void 0;t.push({type:`mention`,attrs:{kind:c,name:e??lse(o),path:c===`skill`?``:a4(s)}})}else o4(t,a);n=i+a.length}return o4(t,e.slice(n)),t}function l4(e){let t=c4(e.args??``).filter(e=>e.type===`mention`&&e.attrs.kind===`skill`),n=t[0];return t.length===1&&n?.type===`mention`&&n.attrs.name===e.name}function u4(e,t){if(l4(e))return t.revivePill?e.args??``:null;if(e.name.includes(` `))return null;let n=e.args??``;return`/skill:${e.name}${n.length>0?` ${n}`:``}`}function fse(e,t){return u4(e,t)!==null}function pse(e){if(l4(e))return e.args??``;let t=s4({kind:`skill`,name:e.name,path:``});return e.args?`${t} ${e.args}`:t}function d4(e){return t4??=new Intl.Segmenter(`und`,{granularity:`grapheme`}),Array.from(t4.segment(e),({segment:e})=>e)}function f4(e){let t=d4(e);if(t.length<=32)return e;let n=e.lastIndexOf(`.`),r=(n>=0?d4(e.slice(n)).length:0)+4,i=31-r;return i<8?`${t.slice(0,31).join(``)}…`:`${t.slice(0,i).join(``)}…${t.slice(-r).join(``)}`}function mse(e){return new Worker(`/assets/katexRenderer.worker-DE1eyXe6.js`,{type:`module`,name:e?.name})}function hse(e){return new Worker(`/assets/mermaidParser.worker-_pLIm6No.js`,{type:`module`,name:e?.name})}var gse={key:0,class:`md-frontmatter`},_se={class:`diff-bar`},vse=[`aria-label`,`onClick`],yse={class:`diff-pre`},bse={key:0,class:`diff-sign`},xse={class:`diff-text`},Sse=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,Cse=`pythinker-code://skill/`,p4=`md-table-wide`,m4=`md-table-toggle`,h4=`md-table-fade`,g4=`md-table-toggle--show`,wse=`md-table-at-end`,Tse=26,_4=`md-code-wrap`,v4=`md-code-wrap-toggle`,y4=`md-code-nums`,b4=`md-code-nums-toggle`,x4=`data-md-code-css`,Ese=` [data-line], [data-no-newline] { padding-inline: var(--space-3); } pre::selection, pre ::selection { background: var(--color-code-selection); @@ -936,65 +936,65 @@ pre[data-md-nums="on"] [data-line]::before { color: var(--color-text-faint); user-select: none; } -`,C4=`github-light`,w4=`github-dark`,yse=G({__name:`Markdown`,props:{text:{},openFile:{},skills:{},streaming:{type:Boolean,default:!1}},setup(e){zq(),AJ(),$q(),WJ(),Qq(new ose),UJ(new sse);let t=new WeakMap;function r(e,n){if(e.src[e.pos]!==`$`)return!1;let r=t.get(e);(!r||r.src!==e.src)&&(r={src:e.src,match:J2(e.src),lastEnd:-1},t.set(e,r));let i=r.match(e.pos,r.lastEnd);if(!i||i.end>e.posMax)return!1;if(r.lastEnd=i.end,n)return e.pos=i.end,!0;let a=e.push(`math_inline`,`math`,0);return a.content=i.content,a.markup=`$`,a.raw=e.src.slice(e.pos,i.end),a.loading=!1,e.pos=i.end,!0}function i(e){return e.set({typographer:!1}),e.inline.ruler.disable(`math`),e.inline.ruler.before(`escape`,`math`,r),e}let{t:a,locale:o}=J(),l=m(`resolveImage`),u=R(null),d=e,f=L(()=>!d.streaming),g=L(()=>Z2(d.text??``)),y=L(()=>g.value.body),b=L(()=>y2(y.value)),x=L(()=>d.streaming?{codeRenderer:`shiki`,codeFenceCount:0,codeChars:0}:D2(y.value)),S=Da(),C=L(()=>!d.streaming),w=N(new Map),T=new Set,D=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,O=/(]*?\bsrc=")([^"]+)(")/gi;function k(e){return!/^(https?:|data:|blob:)/i.test(e)}function A(e){if(!l)return;let t=[];for(let n of[D,O]){n.lastIndex=0;let r;for(;(r=n.exec(e))!==null;)t.push(r[2]??``)}for(let e of t)!e||!k(e)||w.has(e)||T.has(e)||(T.add(e),l(e).then(t=>{w.set(e,t===e?``:t)}).catch(()=>{w.set(e,``)}).finally(()=>{T.delete(e)}))}function j(e){if(!l)return e;let t=e=>{if(!k(e))return null;let t=w.get(e);return t===void 0?mse:t===``?null:t};return e.replace(D,(e,n,r,i)=>{let a=t(r);return a===null?e:`${n}${a}${i}`}).replace(O,(e,n,r,i)=>{let a=t(r);return a===null?e:`${n}${a}${i}`})}s(()=>y.value,e=>A(e),{immediate:!0});function ee(){if(!u.value||!d.openFile||d.streaming)return;let e=document.createTreeWalker(u.value,NodeFilter.SHOW_TEXT),t=[],n=e.nextNode();for(;n;){let r=n,i=r.parentElement;i&&!i.closest(`a, pre, .md-file-link, svg`)&&r.data.trim().length>0&&t.push(r),n=e.nextNode()}for(let e of t){let t=x2(e.data,{aliases:b.value});if(t.length===0||!e.parentNode)continue;let n=document.createDocumentFragment(),r=0;for(let i of t){i.start>r&&n.append(document.createTextNode(e.data.slice(r,i.start)));let t=document.createElement(`button`);t.type=`button`,t.className=`md-file-link`,t.textContent=i.text,t.title=i.line?`${i.path}:${i.line}`:i.path,t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),d.openFile?.({path:i.path,line:i.line})}),n.append(t),r=i.end}r23?`skill`:e.startsWith(`#`)||e.startsWith(`?`)||e.startsWith(`//`)||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)&&!/^[a-zA-Z]:(?:[\\/]|%5c)/i.test(e)?null:e.endsWith(`/`)||e.endsWith(`\\`)||/%5c$/i.test(e)?`folder`:`file`:null}function re(e){try{return decodeURIComponent(e.slice(23))}catch{return e.slice(23)}}function ie(e){return e.replace(/%0A/g,` -`).replace(/%0D/g,`\r`).replace(/%26/g,`&`).replace(/%3C/g,`<`).replace(/%3E/g,`>`).replace(/%25/g,`%`)}function ae(){if(!u.value||d.streaming)return;let e=u.value.querySelectorAll(`a[href]`);for(let t of e){if(t.dataset.mdLinkHandled===`true`||t.closest(`svg`)||t.querySelector(`img`))continue;let e=t.getAttribute(`href`)??``,n=ne(e);if(n===null)continue;t.dataset.mdLinkHandled=`true`,t.removeAttribute(`title`);let r=n===`skill`?e:I(e),i=ie(t.textContent??``);t.classList.add(`mention-pill`,`mention-${n}`),t.dataset.mentionKind=n,t.dataset.mentionName=n===`skill`?re(e):i,t.dataset.mentionPath=r,(n===`skill`||d.openFile)&&t.removeAttribute(`href`),(n===`skill`||n===`file`&&d.openFile)&&(t.tabIndex=0,t.setAttribute(`role`,`button`));let a=p4(i),o=document.createElement(`span`);if(o.className=`mention-pill-name`,o.textContent=a,t.replaceChildren(o),!t.querySelector(`.mention-pill-icon`)){let e=document.createElement(`span`);e.className=`mention-pill-icon`,e.setAttribute(`aria-hidden`,`true`),e.innerHTML=n===`skill`?wf(`sparkles`,`sm`):n===`folder`?wf(`folder`,`sm`):Tf(r,i),t.prepend(e)}t.addEventListener(`click`,t=>{n!==`skill`&&!d.openFile||(t.preventDefault(),t.stopPropagation(),n===`file`&&d.openFile?.({path:te(I(e))}))}),n===`file`&&d.openFile&&t.addEventListener(`keydown`,t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),t.stopPropagation(),d.openFile?.({path:te(I(e))}))}),Ee(t)}}function oe(e){return{kind:e.dataset.mentionKind??(e.classList.contains(`mention-skill`)?`skill`:e.classList.contains(`mention-folder`)?`folder`:`file`),name:e.dataset.mentionName??e.querySelector(`.mention-pill-name`)?.textContent??``,path:e.dataset.mentionPath??``}}function se(e,t){let n;return()=>{if(n===void 0){let r=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),i=parseFloat(r);n=Number.isFinite(i)?r.endsWith(`s`)?i*1e3:i:t}return n}}let ce=se(`--space-1-5`,6),le=se(`--p-mention-tip-vmargin`,12),ue=se(`--duration-tooltip`,150),de=se(`--duration-fast`,120),fe=se(`--duration-flash`,1e3),H=R(null),G=null,K=0,pe=0;function me(e){return H.value?.contains(e)??!1}function he(){let e=H.value;return e||(e=document.createElement(`div`),e.className=`mention-tip`,e.id=`mention-tip`,e.setAttribute(`role`,`tooltip`),e.addEventListener(`mouseenter`,()=>window.clearTimeout(pe)),e.addEventListener(`mouseleave`,()=>Ce()),e.addEventListener(`focusin`,()=>window.clearTimeout(pe)),e.addEventListener(`focusout`,t=>{let n=t.relatedTarget;n instanceof Node&&(e.contains(n)||G?.contains(n))||xe()}),document.body.append(e),H.value=e),e}function ge(){let e=H.value,t=G;if(!e||!t)return;let n=t.getBoundingClientRect(),r=ce(),i=le(),a=n.top-r-e.offsetHeight;at.name===e)}function ve(e){let t=document.createElement(`div`);t.className=`mention-tip-path`;let n=document.createElement(`div`);n.className=`mention-tip-path-text`;let r=e.split(/([/\\])/),i=r.length-1;for(;i>0&&(r[i]===``||r[i]===`/`||r[i]===`\\`);)i--;for(let e=0;e{t.preventDefault(),t.stopPropagation(),Wi(e).then(e=>{e&&(o.innerHTML=wf(`check`,`sm`),window.setTimeout(()=>{o.innerHTML=s},fe()))})}),t.append(o),t}function ye(e){let t=document.createElement(`div`);t.className=`mention-tip-skill`;let n=document.createElement(`div`);n.className=`mention-tip-head`;let r=document.createElement(`span`);if(r.className=`mention-tip-name`,r.textContent=e.name,n.append(r),e.path&&d.openFile){let t=document.createElement(`button`);t.type=`button`,t.className=`mention-tip-open`,t.setAttribute(`aria-label`,a(`mention.openSkill`)),t.innerHTML=wf(`external-link`,`sm`);let r=e.path;t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),xe(),d.openFile?.({path:r})}),n.append(t)}if(t.append(n),e.description){let n=document.createElement(`div`);n.className=`mention-tip-desc`,n.textContent=e.description,t.append(n)}return t}function be(e){let t=he();G?.removeAttribute(`aria-describedby`),G=e,e.setAttribute(`aria-describedby`,t.id);let n=oe(e);t.replaceChildren(n.kind===`skill`?ye(_e(n.name)??{name:n.name,description:``,source:``}):ve(n.path||n.name)),t.classList.remove(`positioned`),ge(),t.classList.add(`positioned`),t.removeAttribute(`inert`)}function xe(){window.clearTimeout(K),window.clearTimeout(pe),G?.removeAttribute(`aria-describedby`),G=null;let e=H.value;e?.classList.remove(`positioned`),e?.setAttribute(`inert`,``)}function Se(e){window.clearTimeout(pe),window.clearTimeout(K);let t=H.value?.classList.contains(`positioned`)&&G===e;K=window.setTimeout(()=>{e.isConnected&&be(e)},t?0:ue())}function Ce(){window.clearTimeout(K),window.clearTimeout(pe),pe=window.setTimeout(xe,de())}function we(e){let t=H.value;if(!(!t||!t.classList.contains(`positioned`)||!G)){if(e.key===`Escape`){e.target instanceof Node&&t.contains(e.target)&&G.focus(),xe(),e.preventDefault(),e.stopImmediatePropagation();return}if(e.key===`Tab`&&e.target instanceof Node&&t.contains(e.target)){let n=Array.from(t.querySelectorAll(`button`)),r=n[0],i=n[n.length-1];(!e.shiftKey&&e.target===i||e.shiftKey&&e.target===r)&&(e.preventDefault(),G.focus(),xe())}}}function Te(e){let t=e.target;t instanceof Node&&(me(t)||G?.contains(t))||xe()}function Ee(e){e.addEventListener(`mouseenter`,()=>Se(e)),e.addEventListener(`mouseleave`,e=>{let t=e.relatedTarget;t instanceof Node&&me(t)||Ce()}),e.addEventListener(`focus`,()=>Se(e)),e.addEventListener(`blur`,e=>{let t=e.relatedTarget;t instanceof Node&&me(t)||Ce()})}function De(){xe()}function Oe(e){return e.querySelector(`button.${h4}`)}function ke(e){return e.querySelector(`.${g4}`)}function Ae(e){let t=Oe(e);if(!t)return;let n=e.querySelector(`thead tr`)??e.querySelector(`tr`);if(!n)return;let r=n.getBoundingClientRect(),i=e.getBoundingClientRect().top,a=Math.max(2,Math.round(r.top-i+(r.height-_se)/2));t.style.top=`${a}px`,t.style.right=`${a}px`}function je(e){let t=e.querySelector(`table`);return t!==null&&t.scrollWidth>e.clientWidth+1}function Me(e){let t=`translateX(${e.scrollLeft}px)`,n=ke(e);n&&(n.style.transform=t);let r=Oe(e);r&&(r.style.transform=t);let i=e.scrollLeft+e.clientWidth>=e.scrollWidth-2;e.classList.toggle(gse,i)}function q(e){let t=Oe(e);if(!t)return;let n=je(e),r=e.classList.contains(m4);t.classList.toggle(_4,n||r),ke(e)?.classList.toggle(_4,n),Ae(e),Me(e)}function Ne(e){let t=Oe(e);if(t)return t;if(!e.closest(`.a-msg .msg`))return null;let n=document.createElement(`div`);n.className=g4,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`button`);return r.type=`button`,r.className=h4,r.innerHTML=wf(`expand`,`sm`),r.setAttribute(`aria-label`,a(`conversation.widenTable`)),r.title=a(`conversation.widenTable`),r.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),Pe(e)}),e.append(n,r),e.addEventListener(`scroll`,()=>Me(e),{passive:!0}),q(e),r}function Pe(e){let t=e.classList.toggle(m4),n=Oe(e);if(n){n.innerHTML=wf(t?`collapse`:`expand`,`sm`);let e=a(t?`conversation.restoreTableWidth`:`conversation.widenTable`);n.setAttribute(`aria-label`,e),n.title=e}q(e),e.dispatchEvent(new CustomEvent(`pythinker-table-layout`,{bubbles:!0}))}function Fe(){if(!(!u.value||d.streaming))for(let e of u.value.querySelectorAll(`.table-node-wrapper`))Ne(e)}function Ie(){if(!(!u.value||d.streaming))for(let e of u.value.querySelectorAll(`.table-node-wrapper`))q(e)}function Le(e){return`${Math.max(String(e).length+1,4)}ch`}let Re={stateClass:b4,toggleClass:x4,iconOn:`list-numbers`,iconOff:`list-numbers`,labelOn:()=>a(`conversation.hideLineNumbers`),labelOff:()=>a(`conversation.showLineNumbers`)},ze={stateClass:v4,toggleClass:y4,iconOn:`text-wrap-disabled`,iconOff:`text-wrap`,labelOn:()=>a(`conversation.unwrapCode`),labelOff:()=>a(`conversation.wrapCode`)},Be=new WeakMap;function Ve(e){let t=e.querySelector(`diffs-container`),n=t?.shadowRoot;if(!t||!n)return;if(!Be.has(t)){let r=new MutationObserver(()=>Ve(e));r.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-overflow`,`data-md-nums`]}),Be.set(t,r)}if(!n.querySelector(`style[${S4}]`)){let e=document.createElement(`style`);e.setAttribute(S4,``),e.textContent=vse,n.append(e)}let r=n.querySelector(`pre[data-overflow]`);if(!r)return;let i=e.classList.contains(v4)?`wrap`:`scroll`;r.getAttribute(`data-overflow`)!==i&&r.setAttribute(`data-overflow`,i);let a=e.classList.contains(b4)?`on`:`off`;if(r.getAttribute(`data-md-nums`)!==a&&r.setAttribute(`data-md-nums`,a),a===`on`){let e=Le(n.querySelectorAll(`[data-line]`).length);r.style.getPropertyValue(`--md-nums-gutter`)!==e&&r.style.setProperty(`--md-nums-gutter`,e)}else r.style.getPropertyValue(`--md-nums-gutter`)&&r.style.removeProperty(`--md-nums-gutter`)}function He(e,t){let n=e.querySelector(`button.${t.toggleClass}`);if(!n)return;let r=e.classList.contains(t.stateClass),i=r?t.labelOn():t.labelOff(),a=r?t.iconOn:t.iconOff;n.dataset.mdIcon!==a&&(n.innerHTML=wf(a,`sm`),n.dataset.mdIcon=a),n.setAttribute(`aria-label`,i),n.setAttribute(`aria-pressed`,String(r)),n.title=i}function Ue(e){He(e,Re),He(e,ze),Ve(e)}function We(e,t,n){let r=e.querySelector(`button.${n.toggleClass}`);if(r)return He(e,n),r;if(!t)return null;let i=document.createElement(`button`);i.type=`button`,i.className=`${t.anchor.className} ${n.toggleClass}`,i.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.classList.toggle(n.stateClass),Ue(e)});let a=n===Re?e.querySelector(`button.${y4}`)??t.anchor:t.anchor;return t.row.insertBefore(i,a),He(e,n),i}function Ge(e){let t=e.querySelector(`.code-block-header .code-action-btn:not([disabled]):not(.${y4}):not(.${x4})`),n=t?.parentElement;return t&&n?{row:n,anchor:t}:null}function Ke(){if(!(!u.value||d.streaming))for(let e of u.value.querySelectorAll(`.code-block-container`)){let t=Ge(e);e.querySelector(`diffs-container`)&&We(e,t,Re),We(e,t,ze),Ve(e)}}function qe(){xe(),n().then(()=>{ee(),ae(),Fe(),Ke()})}s(()=>d.text,qe),s(()=>d.streaming,qe),s(o,()=>{if(u.value)for(let e of u.value.querySelectorAll(`.code-block-container`))He(e,Re),He(e,ze)});let Je=null,Ye=null;p(()=>{qe(),u.value&&(Je=new MutationObserver(qe),Je.observe(u.value,{childList:!0,subtree:!0}),typeof ResizeObserver<`u`&&(Ye=new ResizeObserver(Ie),Ye.observe(u.value))),window.addEventListener(`scroll`,De,{capture:!0}),window.addEventListener(`resize`,De),document.addEventListener(`pointerdown`,Te,{capture:!0}),document.addEventListener(`keydown`,we,{capture:!0})}),h(()=>{Je?.disconnect(),Ye?.disconnect(),window.removeEventListener(`scroll`,De,{capture:!0}),window.removeEventListener(`resize`,De),document.removeEventListener(`pointerdown`,Te,{capture:!0}),document.removeEventListener(`keydown`,we,{capture:!0}),xe(),H.value?.remove(),H.value=null});let Xe={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:`var(--font-mono)`,padding:{top:12,bottom:12}}},Ze=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,Qe=L(()=>{let e=j(y.value),t=[],n=0;Ze.lastIndex=0;let r;for(;(r=Ze.exec(e))!==null;){let i=r[1]??``,a=e.slice(n,r.index)+(i||``);a.trim()&&t.push({kind:`md`,text:a}),t.push({kind:`diff`,code:r[2]??``}),n=Ze.lastIndex}let i=e.slice(n);return(i.trim()||t.length===0)&&t.push({kind:`md`,text:i}),t});function $e(e){return e.split(` -`).map(e=>e.startsWith(`@@`)?{type:`hunk`,sign:``,text:e}:/^\+(?!\+\+)/.test(e)?{type:`add`,sign:`+`,text:e.slice(1)}:/^-(?!--)/.test(e)?{type:`del`,sign:`-`,text:e.slice(1)}:e.startsWith(` `)?{type:`ctx`,sign:``,text:e.slice(1)}:{type:`ctx`,sign:``,text:e})}let et=N(new Set),tt=N(new Set),nt=L(()=>{let e=new Map;return Qe.value.map(t=>{if(t.kind!==`diff`)return``;let n=(e.get(t.code)??0)+1;return e.set(t.code,n),`${n}#${t.code}`})});s(nt,e=>{let t=new Set(e);for(let e of[et,tt]){let n=Array.from(e).filter(e=>!t.has(e));for(let t of n)e.delete(t)}});function rt(e,t){let n=nt.value[t];n===void 0||n===``||(e.has(n)?e.delete(n):e.add(n))}function it(e){let t=nt.value[e];return t!==void 0&&t!==``&&et.has(t)}function at(e){let t=nt.value[e];return t!==void 0&&t!==``&&tt.has(t)}function ot(e){rt(et,e)}function st(e){rt(tt,e)}function ct(){for(let e of u.value?.querySelectorAll(`.diff-wrap .diff-pre`)??[]){if(!e.closest(`.diff-wrap`)?.classList.contains(b4)){e.style.removeProperty(`--md-nums-gutter`);continue}let t=e.querySelectorAll(`.diff-line:not(.diff-hunk)`).length;e.style.setProperty(`--md-nums-gutter`,Le(t))}}s([()=>tt.size,Qe],()=>{n(ct)});let lt=R(null);function ut(e,t){Wi(e).then(e=>{e&&(lt.value=t,setTimeout(()=>{lt.value=null},1400))})}return(t,n)=>(c(),W(`div`,{ref_key:`mdRef`,ref:u,class:`md`},[g.value.frontmatter===null?E(``,!0):(c(),W(`pre`,cse,U(g.value.frontmatter),1)),(c(!0),W(M,null,_(Qe.value,(t,r)=>(c(),W(M,{key:r},[t.kind===`md`?(c(),P(z(k0),{key:0,content:t.text,"custom-markdown-it":i,mode:`chat`,"code-renderer":x.value.codeRenderer,"is-dark":z(S),"code-block-light-theme":C4,"code-block-dark-theme":w4,themes:[C4,w4],"code-block-props":Xe,final:f.value,"smooth-streaming":e.streaming,"batch-rendering":C.value,"defer-nodes-until-visible":!1,onCopy:z(Gi)},null,8,[`content`,`code-renderer`,`is-dark`,`themes`,`final`,`smooth-streaming`,`batch-rendering`,`onCopy`])):(c(),W(`div`,{key:1,class:V([`diff-wrap`,{"md-code-wrap":it(r),"md-code-nums":at(r)}])},[F(`div`,lse,[n[0]||=F(`span`,{class:`diff-lang`},`diff`,-1),v(vp,{text:at(r)?z(a)(`conversation.hideLineNumbers`):z(a)(`conversation.showLineNumbers`)},{default:B(()=>[v(Ca,{size:`sm`,label:at(r)?z(a)(`conversation.hideLineNumbers`):z(a)(`conversation.showLineNumbers`),"aria-pressed":at(r),onClick:e=>st(r)},{default:B(()=>[v(X,{name:`list-numbers`,size:`sm`})]),_:1},8,[`label`,`aria-pressed`,`onClick`])]),_:2},1032,[`text`]),v(vp,{text:it(r)?z(a)(`conversation.unwrapCode`):z(a)(`conversation.wrapCode`)},{default:B(()=>[v(Ca,{size:`sm`,label:it(r)?z(a)(`conversation.unwrapCode`):z(a)(`conversation.wrapCode`),"aria-pressed":it(r),onClick:e=>ot(r)},{default:B(()=>[v(X,{name:it(r)?`text-wrap-disabled`:`text-wrap`,size:`sm`},null,8,[`name`])]),_:2},1032,[`label`,`aria-pressed`,`onClick`])]),_:2},1032,[`text`]),v(vp,{text:z(a)(`filePreview.copyCode`)},{default:B(()=>[F(`button`,{class:`diff-copy`,"aria-label":z(a)(`filePreview.copyCode`),onClick:e=>ut(t.code,r)},[v(X,{name:lt.value===r?`check`:`copy`,size:`sm`},null,8,[`name`])],8,use)]),_:2},1032,[`text`])]),F(`pre`,dse,[F(`code`,null,[(c(!0),W(M,null,_($e(t.code),(e,t)=>(c(),W(`span`,{key:t,class:V([`diff-line`,`diff-${e.type}`])},[e.type===`hunk`?E(``,!0):(c(),W(`span`,fse,U(e.sign),1)),F(`span`,pse,U(e.text),1)],2))),128))])])],2))],64))),128))],512))}}),bse=e({default:()=>T4}),T4=Y(yse,[[`__scopeId`,`data-v-a23761a0`]]),xse={class:`activity-notice`,role:`status`},Sse={"aria-hidden":`true`},Cse={class:`an-label`},wse=Y(G({__name:`ActivityNotice`,props:{label:{}},setup(e){return(t,n)=>(c(),W(`div`,xse,[F(`span`,Sse,[v(np,{size:`sm`})]),F(`span`,Cse,U(e.label),1)]))}}),[[`__scopeId`,`data-v-5e7a6420`]]);function Tse(e,t=`Yesterday`){try{let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=new Date,i=e=>String(e).padStart(2,`0`),a=`${i(n.getHours())}:${i(n.getMinutes())}`,o=n.getFullYear()===r.getFullYear(),s=n.getMonth()===r.getMonth(),c=n.getDate()===r.getDate();if(o&&s&&c)return a;let l=new Date(r);return l.setDate(r.getDate()-1),n.getFullYear()===l.getFullYear()&&n.getMonth()===l.getMonth()&&n.getDate()===l.getDate()?`${t} ${a}`:o?`${i(n.getMonth()+1)}-${i(n.getDate())} ${a}`:`${n.getFullYear()}-${i(n.getMonth()+1)}-${i(n.getDate())} ${a}`}catch{return e}}var E4=Y(G({__name:`MessageTime`,props:{time:{}},setup(e){let t=e,{t:n}=J(),r=R(!1),i=L(()=>{let e=new Date(t.time);if(Number.isNaN(e.getTime()))return t.time;let n=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}),a=L(()=>r.value?i.value:Tse(t.time,n(`conversation.yesterday`)));function o(){r.value=!r.value}return(e,t)=>(c(),W(`button`,{type:`button`,class:`msg-time`,onClick:H(o,[`stop`])},U(a.value),1))}}),[[`__scopeId`,`data-v-6761370d`]]);function Ese(e){return e.length===1?`0${e}`:e}function Dse(e,t){return`${String(Number(e))}:${Ese(t)}`}var D4=e=>/^\d+$/.test(e);function Ose(e,t){let n=e.trim().split(/\s+/);if(n.length!==5)return e;let[r,i,a,o,s]=n,c=a===`*`&&o===`*`&&s===`*`,l=a===`*`&&o===`*`;if(r===`*`&&i===`*`&&c)return t(`conversation.cron.everyMinute`);let u=/^\*\/(\d+)$/.exec(r);if(u&&i===`*`&&c)return u[1]===`1`?t(`conversation.cron.everyMinute`):t(`conversation.cron.everyNMinutes`,{n:u[1]});if(r===`0`&&i===`*`&&c)return t(`conversation.cron.everyHour`);let d=/^\*\/(\d+)$/.exec(i);if(r===`0`&&d&&c)return t(`conversation.cron.everyNHours`,{n:d[1]});if(D4(r)&&D4(i)&&l){let e=Dse(i,r);if(s===`1-5`)return t(`conversation.cron.weekdaysAt`,{time:e});if(s===`*`)return t(`conversation.cron.dailyAt`,{time:e})}return e}var kse=[`data-turn-id`],Ase={class:`cn-bubble`},jse={class:`cn-title`},Mse={key:0,class:`cn-prompt`},Nse={class:`cn-meta`},Pse={key:0,class:`cn-meta-item`},Fse={key:1,class:`cn-meta-item`},Ise=[`aria-label`],Lse=[`title`],Rse=Y(G({__name:`CronNotice`,props:{text:{},cron:{},turnId:{},createdAt:{}},setup(e){let t=e,{t:n}=J(),r=L(()=>t.cron),i=L(()=>r.value?.missedCount!==void 0),a=L(()=>i.value?n(`conversation.cron.missed`):n(`conversation.cron.fired`)),o=L(()=>{let e=r.value?.cron;return e?Ose(e,n):``}),s=L(()=>i.value?`error`:`ok`),l=L(()=>{let e=r.value;if(!e)return``;let t=[];return e.recurring===!1&&t.push(n(`conversation.cron.oneShot`)),typeof e.coalescedCount==`number`&&e.coalescedCount>1&&t.push(n(`conversation.cron.coalesced`,{n:e.coalescedCount})),e.missedCount!==void 0&&t.push(n(`conversation.cron.missedCount`,{n:e.missedCount})),e.stale===!0&&t.push(n(`conversation.cron.finalDelivery`)),t.join(` · `)}),u=L(()=>t.text??``);return(t,i)=>(c(),W(`div`,{class:V([`cn cron-notice`,{"turn-anchor":!!e.turnId}]),"data-turn-id":e.turnId,role:`status`},[F(`div`,Ase,[F(`span`,jse,U(a.value),1),u.value?(c(),W(`span`,Mse,U(u.value),1)):E(``,!0)]),F(`div`,Nse,[v(X,{name:`clock`,size:`sm`,class:`cn-meta-ico`,"aria-hidden":`true`}),o.value?(c(),W(`span`,Pse,U(o.value),1)):E(``,!0),l.value?(c(),W(`span`,Fse,U(l.value),1)):E(``,!0),F(`span`,{class:V([`cn-status`,s.value]),"aria-label":s.value},[s.value===`ok`?(c(),P(X,{key:0,name:`check`,size:`sm`})):(c(),P(X,{key:1,name:`close`,size:`sm`}))],10,Ise),r.value?.jobId?(c(),W(`span`,{key:2,class:`cn-meta-item cn-id`,title:z(n)(`conversation.cron.job`,{id:r.value.jobId})},U(r.value.jobId),9,Lse)):E(``,!0),e.createdAt?(c(),P(E4,{key:3,time:e.createdAt},null,8,[`time`])):E(``,!0)])],10,kse))}}),[[`__scopeId`,`data-v-d3807b0f`]]),O4=`pythinkerWeb.taskNotification`,zse=/]*)>([\s\S]*?)<\/notification>/g,Bse=/([\w-]+)="([^"]*)"/g,Vse=/]*)>[\s\S]*?<\/output-file>/,Hse=/]*)>([\s\S]*?)<\/output-preview>/,Use=/^Title: (.*)$/m,Wse=/^Severity: (.*)$/m;function k4(e){return e.replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`&`,`&`)}function A4(e){let t={};for(let n of e.matchAll(Bse))n[1]!==void 0&&n[2]!==void 0&&(t[n[1]]=k4(n[2]));return t}function j4(e){if(e===void 0)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function Gse(e,t,n){let r=A4(e),i=Use.exec(t)?.[1]?.trim()??``,a=Wse.exec(t)?.[1]?.trim()??``,o=t.split(` +`,S4=`github-light`,C4=`github-dark`,Dse=G({__name:`Markdown`,props:{text:{},openFile:{},skills:{},streaming:{type:Boolean,default:!1}},setup(e){Wq(),FJ(),iJ(),YJ(),rJ(new mse),JJ(new hse);let t=new WeakMap;function r(e,n){if(e.src[e.pos]!==`$`)return!1;let r=t.get(e);(!r||r.src!==e.src)&&(r={src:e.src,match:$2(e.src),lastEnd:-1},t.set(e,r));let i=r.match(e.pos,r.lastEnd);if(!i||i.end>e.posMax)return!1;if(r.lastEnd=i.end,n)return e.pos=i.end,!0;let a=e.push(`math_inline`,`math`,0);return a.content=i.content,a.markup=`$`,a.raw=e.src.slice(e.pos,i.end),a.loading=!1,e.pos=i.end,!0}function i(e){return e.set({typographer:!1}),e.inline.ruler.disable(`math`),e.inline.ruler.before(`escape`,`math`,r),e}let{t:a,locale:o}=J(),l=m(`resolveImage`),u=R(null),d=e,f=L(()=>!d.streaming),g=L(()=>ise(d.text??``)),y=L(()=>g.value.body),b=L(()=>w2(y.value)),x=L(()=>d.streaming?{codeRenderer:`shiki`,codeFenceCount:0,codeChars:0}:M2(y.value)),S=Da(),C=L(()=>!d.streaming),w=N(new Map),T=new Set,D=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,O=/(]*?\bsrc=")([^"]+)(")/gi;function k(e){return!/^(https?:|data:|blob:)/i.test(e)}function A(e){if(!l)return;let t=[];for(let n of[D,O]){n.lastIndex=0;let r;for(;(r=n.exec(e))!==null;)t.push(r[2]??``)}for(let e of t)!e||!k(e)||w.has(e)||T.has(e)||(T.add(e),l(e).then(t=>{w.set(e,t===e?``:t)}).catch(()=>{w.set(e,``)}).finally(()=>{T.delete(e)}))}function j(e){if(!l)return e;let t=e=>{if(!k(e))return null;let t=w.get(e);return t===void 0?Sse:t===``?null:t};return e.replace(D,(e,n,r,i)=>{let a=t(r);return a===null?e:`${n}${a}${i}`}).replace(O,(e,n,r,i)=>{let a=t(r);return a===null?e:`${n}${a}${i}`})}s(()=>y.value,e=>A(e),{immediate:!0});function ee(){if(!u.value||!d.openFile||d.streaming)return;let e=document.createTreeWalker(u.value,NodeFilter.SHOW_TEXT),t=[],n=e.nextNode();for(;n;){let r=n,i=r.parentElement;i&&!i.closest(`a, pre, .md-file-link, svg`)&&r.data.trim().length>0&&t.push(r),n=e.nextNode()}for(let e of t){let t=E2(e.data,{aliases:b.value});if(t.length===0||!e.parentNode)continue;let n=document.createDocumentFragment(),r=0;for(let i of t){i.start>r&&n.append(document.createTextNode(e.data.slice(r,i.start)));let t=document.createElement(`button`);t.type=`button`,t.className=`md-file-link`,t.textContent=i.text,t.title=i.line?`${i.path}:${i.line}`:i.path,t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),d.openFile?.({path:i.path,line:i.line})}),n.append(t),r=i.end}r23?`skill`:e.startsWith(`#`)||e.startsWith(`?`)||e.startsWith(`//`)||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)&&!/^[a-zA-Z]:(?:[\\/]|%5c)/i.test(e)?null:e.endsWith(`/`)||e.endsWith(`\\`)||/%5c$/i.test(e)?`folder`:`file`:null}function re(e){try{return decodeURIComponent(e.slice(23))}catch{return e.slice(23)}}function ie(e){return e.replace(/%0A/g,` +`).replace(/%0D/g,`\r`).replace(/%26/g,`&`).replace(/%3C/g,`<`).replace(/%3E/g,`>`).replace(/%25/g,`%`)}function ae(){if(!u.value||d.streaming)return;let e=u.value.querySelectorAll(`a[href]`);for(let t of e){if(t.dataset.mdLinkHandled===`true`||t.closest(`svg`)||t.querySelector(`img`))continue;let e=t.getAttribute(`href`)??``,n=ne(e);if(n===null)continue;t.dataset.mdLinkHandled=`true`,t.removeAttribute(`title`);let r=n===`skill`?e:I(e),i=ie(t.textContent??``);t.classList.add(`mention-pill`,`mention-${n}`),t.dataset.mentionKind=n,t.dataset.mentionName=n===`skill`?re(e):i,t.dataset.mentionPath=r,(n===`skill`||d.openFile)&&t.removeAttribute(`href`),(n===`skill`||n===`file`&&d.openFile)&&(t.tabIndex=0,t.setAttribute(`role`,`button`));let a=f4(i),o=document.createElement(`span`);if(o.className=`mention-pill-name`,o.textContent=a,t.replaceChildren(o),!t.querySelector(`.mention-pill-icon`)){let e=document.createElement(`span`);e.className=`mention-pill-icon`,e.setAttribute(`aria-hidden`,`true`),e.innerHTML=n===`skill`?Of(`sparkles`,`sm`):n===`folder`?Of(`folder`,`sm`):kf(r,i),t.prepend(e)}t.addEventListener(`click`,t=>{n!==`skill`&&!d.openFile||(t.preventDefault(),t.stopPropagation(),n===`file`&&d.openFile?.({path:te(I(e))}))}),n===`file`&&d.openFile&&t.addEventListener(`keydown`,t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),t.stopPropagation(),d.openFile?.({path:te(I(e))}))}),Ee(t)}}function oe(e){return{kind:e.dataset.mentionKind??(e.classList.contains(`mention-skill`)?`skill`:e.classList.contains(`mention-folder`)?`folder`:`file`),name:e.dataset.mentionName??e.querySelector(`.mention-pill-name`)?.textContent??``,path:e.dataset.mentionPath??``}}function se(e,t){let n;return()=>{if(n===void 0){let r=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),i=parseFloat(r);n=Number.isFinite(i)?r.endsWith(`s`)?i*1e3:i:t}return n}}let ce=se(`--space-1-5`,6),le=se(`--p-mention-tip-vmargin`,12),ue=se(`--duration-tooltip`,150),de=se(`--duration-fast`,120),fe=se(`--duration-flash`,1e3),H=R(null),G=null,K=0,pe=0;function me(e){return H.value?.contains(e)??!1}function he(){let e=H.value;return e||(e=document.createElement(`div`),e.className=`mention-tip`,e.id=`mention-tip`,e.setAttribute(`role`,`tooltip`),e.addEventListener(`mouseenter`,()=>window.clearTimeout(pe)),e.addEventListener(`mouseleave`,()=>Ce()),e.addEventListener(`focusin`,()=>window.clearTimeout(pe)),e.addEventListener(`focusout`,t=>{let n=t.relatedTarget;n instanceof Node&&(e.contains(n)||G?.contains(n))||xe()}),document.body.append(e),H.value=e),e}function ge(){let e=H.value,t=G;if(!e||!t)return;let n=t.getBoundingClientRect(),r=ce(),i=le(),a=n.top-r-e.offsetHeight;at.name===e)}function ve(e){let t=document.createElement(`div`);t.className=`mention-tip-path`;let n=document.createElement(`div`);n.className=`mention-tip-path-text`;let r=e.split(/([/\\])/),i=r.length-1;for(;i>0&&(r[i]===``||r[i]===`/`||r[i]===`\\`);)i--;for(let e=0;e{t.preventDefault(),t.stopPropagation(),Wi(e).then(e=>{e&&(o.innerHTML=Of(`check`,`sm`),window.setTimeout(()=>{o.innerHTML=s},fe()))})}),t.append(o),t}function ye(e){let t=document.createElement(`div`);t.className=`mention-tip-skill`;let n=document.createElement(`div`);n.className=`mention-tip-head`;let r=document.createElement(`span`);if(r.className=`mention-tip-name`,r.textContent=e.name,n.append(r),e.path&&d.openFile){let t=document.createElement(`button`);t.type=`button`,t.className=`mention-tip-open`,t.setAttribute(`aria-label`,a(`mention.openSkill`)),t.innerHTML=Of(`external-link`,`sm`);let r=e.path;t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),xe(),d.openFile?.({path:r})}),n.append(t)}if(t.append(n),e.description){let n=document.createElement(`div`);n.className=`mention-tip-desc`,n.textContent=e.description,t.append(n)}return t}function be(e){let t=he();G?.removeAttribute(`aria-describedby`),G=e,e.setAttribute(`aria-describedby`,t.id);let n=oe(e);t.replaceChildren(n.kind===`skill`?ye(_e(n.name)??{name:n.name,description:``,source:``}):ve(n.path||n.name)),t.classList.remove(`positioned`),ge(),t.classList.add(`positioned`),t.removeAttribute(`inert`)}function xe(){window.clearTimeout(K),window.clearTimeout(pe),G?.removeAttribute(`aria-describedby`),G=null;let e=H.value;e?.classList.remove(`positioned`),e?.setAttribute(`inert`,``)}function Se(e){window.clearTimeout(pe),window.clearTimeout(K);let t=H.value?.classList.contains(`positioned`)&&G===e;K=window.setTimeout(()=>{e.isConnected&&be(e)},t?0:ue())}function Ce(){window.clearTimeout(K),window.clearTimeout(pe),pe=window.setTimeout(xe,de())}function we(e){let t=H.value;if(!(!t||!t.classList.contains(`positioned`)||!G)){if(e.key===`Escape`){e.target instanceof Node&&t.contains(e.target)&&G.focus(),xe(),e.preventDefault(),e.stopImmediatePropagation();return}if(e.key===`Tab`&&e.target instanceof Node&&t.contains(e.target)){let n=Array.from(t.querySelectorAll(`button`)),r=n[0],i=n[n.length-1];(!e.shiftKey&&e.target===i||e.shiftKey&&e.target===r)&&(e.preventDefault(),G.focus(),xe())}}}function Te(e){let t=e.target;t instanceof Node&&(me(t)||G?.contains(t))||xe()}function Ee(e){e.addEventListener(`mouseenter`,()=>Se(e)),e.addEventListener(`mouseleave`,e=>{let t=e.relatedTarget;t instanceof Node&&me(t)||Ce()}),e.addEventListener(`focus`,()=>Se(e)),e.addEventListener(`blur`,e=>{let t=e.relatedTarget;t instanceof Node&&me(t)||Ce()})}function De(){xe()}function Oe(e){return e.querySelector(`button.${m4}`)}function ke(e){return e.querySelector(`.${h4}`)}function Ae(e){let t=Oe(e);if(!t)return;let n=e.querySelector(`thead tr`)??e.querySelector(`tr`);if(!n)return;let r=n.getBoundingClientRect(),i=e.getBoundingClientRect().top,a=Math.max(2,Math.round(r.top-i+(r.height-Tse)/2));t.style.top=`${a}px`,t.style.right=`${a}px`}function je(e){let t=e.querySelector(`table`);return t!==null&&t.scrollWidth>e.clientWidth+1}function Me(e){let t=`translateX(${e.scrollLeft}px)`,n=ke(e);n&&(n.style.transform=t);let r=Oe(e);r&&(r.style.transform=t);let i=e.scrollLeft+e.clientWidth>=e.scrollWidth-2;e.classList.toggle(wse,i)}function q(e){let t=Oe(e);if(!t)return;let n=je(e),r=e.classList.contains(p4);t.classList.toggle(g4,n||r),ke(e)?.classList.toggle(g4,n),Ae(e),Me(e)}function Ne(e){let t=Oe(e);if(t)return t;if(!e.closest(`.a-msg .msg`))return null;let n=document.createElement(`div`);n.className=h4,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`button`);return r.type=`button`,r.className=m4,r.innerHTML=Of(`expand`,`sm`),r.setAttribute(`aria-label`,a(`conversation.widenTable`)),r.title=a(`conversation.widenTable`),r.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),Pe(e)}),e.append(n,r),e.addEventListener(`scroll`,()=>Me(e),{passive:!0}),q(e),r}function Pe(e){let t=e.classList.toggle(p4),n=Oe(e);if(n){n.innerHTML=Of(t?`collapse`:`expand`,`sm`);let e=a(t?`conversation.restoreTableWidth`:`conversation.widenTable`);n.setAttribute(`aria-label`,e),n.title=e}q(e),e.dispatchEvent(new CustomEvent(`pythinker-table-layout`,{bubbles:!0}))}function Fe(){if(!(!u.value||d.streaming))for(let e of u.value.querySelectorAll(`.table-node-wrapper`))Ne(e)}function Ie(){if(!(!u.value||d.streaming))for(let e of u.value.querySelectorAll(`.table-node-wrapper`))q(e)}function Le(e){return`${Math.max(String(e).length+1,4)}ch`}let Re={stateClass:y4,toggleClass:b4,iconOn:`list-numbers`,iconOff:`list-numbers`,labelOn:()=>a(`conversation.hideLineNumbers`),labelOff:()=>a(`conversation.showLineNumbers`)},ze={stateClass:_4,toggleClass:v4,iconOn:`text-wrap-disabled`,iconOff:`text-wrap`,labelOn:()=>a(`conversation.unwrapCode`),labelOff:()=>a(`conversation.wrapCode`)},Be=new WeakMap;function Ve(e){let t=e.querySelector(`diffs-container`),n=t?.shadowRoot;if(!t||!n)return;if(!Be.has(t)){let r=new MutationObserver(()=>Ve(e));r.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-overflow`,`data-md-nums`]}),Be.set(t,r)}if(!n.querySelector(`style[${x4}]`)){let e=document.createElement(`style`);e.setAttribute(x4,``),e.textContent=Ese,n.append(e)}let r=n.querySelector(`pre[data-overflow]`);if(!r)return;let i=e.classList.contains(_4)?`wrap`:`scroll`;r.getAttribute(`data-overflow`)!==i&&r.setAttribute(`data-overflow`,i);let a=e.classList.contains(y4)?`on`:`off`;if(r.getAttribute(`data-md-nums`)!==a&&r.setAttribute(`data-md-nums`,a),a===`on`){let e=Le(n.querySelectorAll(`[data-line]`).length);r.style.getPropertyValue(`--md-nums-gutter`)!==e&&r.style.setProperty(`--md-nums-gutter`,e)}else r.style.getPropertyValue(`--md-nums-gutter`)&&r.style.removeProperty(`--md-nums-gutter`)}function He(e,t){let n=e.querySelector(`button.${t.toggleClass}`);if(!n)return;let r=e.classList.contains(t.stateClass),i=r?t.labelOn():t.labelOff(),a=r?t.iconOn:t.iconOff;n.dataset.mdIcon!==a&&(n.innerHTML=Of(a,`sm`),n.dataset.mdIcon=a),n.setAttribute(`aria-label`,i),n.setAttribute(`aria-pressed`,String(r)),n.title=i}function Ue(e){He(e,Re),He(e,ze),Ve(e)}function We(e,t,n){let r=e.querySelector(`button.${n.toggleClass}`);if(r)return He(e,n),r;if(!t)return null;let i=document.createElement(`button`);i.type=`button`,i.className=`${t.anchor.className} ${n.toggleClass}`,i.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.classList.toggle(n.stateClass),Ue(e)});let a=n===Re?e.querySelector(`button.${v4}`)??t.anchor:t.anchor;return t.row.insertBefore(i,a),He(e,n),i}function Ge(e){let t=e.querySelector(`.code-block-header .code-action-btn:not([disabled]):not(.${v4}):not(.${b4})`),n=t?.parentElement;return t&&n?{row:n,anchor:t}:null}function Ke(){if(!(!u.value||d.streaming))for(let e of u.value.querySelectorAll(`.code-block-container`)){let t=Ge(e);e.querySelector(`diffs-container`)&&We(e,t,Re),We(e,t,ze),Ve(e)}}function qe(){xe(),n().then(()=>{ee(),ae(),Fe(),Ke()})}s(()=>d.text,qe),s(()=>d.streaming,qe),s(o,()=>{if(u.value)for(let e of u.value.querySelectorAll(`.code-block-container`))He(e,Re),He(e,ze)});let Je=null,Ye=null;p(()=>{qe(),u.value&&(Je=new MutationObserver(qe),Je.observe(u.value,{childList:!0,subtree:!0}),typeof ResizeObserver<`u`&&(Ye=new ResizeObserver(Ie),Ye.observe(u.value))),window.addEventListener(`scroll`,De,{capture:!0}),window.addEventListener(`resize`,De),document.addEventListener(`pointerdown`,Te,{capture:!0}),document.addEventListener(`keydown`,we,{capture:!0})}),h(()=>{Je?.disconnect(),Ye?.disconnect(),window.removeEventListener(`scroll`,De,{capture:!0}),window.removeEventListener(`resize`,De),document.removeEventListener(`pointerdown`,Te,{capture:!0}),document.removeEventListener(`keydown`,we,{capture:!0}),xe(),H.value?.remove(),H.value=null});let Xe={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:`var(--font-mono)`,padding:{top:12,bottom:12}}},Ze=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,Qe=L(()=>{let e=j(y.value),t=[],n=0;Ze.lastIndex=0;let r;for(;(r=Ze.exec(e))!==null;){let i=r[1]??``,a=e.slice(n,r.index)+(i||``);a.trim()&&t.push({kind:`md`,text:a}),t.push({kind:`diff`,code:r[2]??``}),n=Ze.lastIndex}let i=e.slice(n);return(i.trim()||t.length===0)&&t.push({kind:`md`,text:i}),t});function $e(e){return e.split(` +`).map(e=>e.startsWith(`@@`)?{type:`hunk`,sign:``,text:e}:/^\+(?!\+\+)/.test(e)?{type:`add`,sign:`+`,text:e.slice(1)}:/^-(?!--)/.test(e)?{type:`del`,sign:`-`,text:e.slice(1)}:e.startsWith(` `)?{type:`ctx`,sign:``,text:e.slice(1)}:{type:`ctx`,sign:``,text:e})}let et=N(new Set),tt=N(new Set),nt=L(()=>{let e=new Map;return Qe.value.map(t=>{if(t.kind!==`diff`)return``;let n=(e.get(t.code)??0)+1;return e.set(t.code,n),`${n}#${t.code}`})});s(nt,e=>{let t=new Set(e);for(let e of[et,tt]){let n=Array.from(e).filter(e=>!t.has(e));for(let t of n)e.delete(t)}});function rt(e,t){let n=nt.value[t];n===void 0||n===``||(e.has(n)?e.delete(n):e.add(n))}function it(e){let t=nt.value[e];return t!==void 0&&t!==``&&et.has(t)}function at(e){let t=nt.value[e];return t!==void 0&&t!==``&&tt.has(t)}function ot(e){rt(et,e)}function st(e){rt(tt,e)}function ct(){for(let e of u.value?.querySelectorAll(`.diff-wrap .diff-pre`)??[]){if(!e.closest(`.diff-wrap`)?.classList.contains(y4)){e.style.removeProperty(`--md-nums-gutter`);continue}let t=e.querySelectorAll(`.diff-line:not(.diff-hunk)`).length;e.style.setProperty(`--md-nums-gutter`,Le(t))}}s([()=>tt.size,Qe],()=>{n(ct)});let lt=R(null);function ut(e,t){Wi(e).then(e=>{e&&(lt.value=t,setTimeout(()=>{lt.value=null},1400))})}return(t,n)=>(c(),W(`div`,{ref_key:`mdRef`,ref:u,class:`md`},[g.value.frontmatter===null?E(``,!0):(c(),W(`pre`,gse,U(g.value.frontmatter),1)),(c(!0),W(M,null,_(Qe.value,(t,r)=>(c(),W(M,{key:r},[t.kind===`md`?(c(),P(z(P0),{key:0,content:t.text,"custom-markdown-it":i,mode:`chat`,"code-renderer":x.value.codeRenderer,"is-dark":z(S),"code-block-light-theme":S4,"code-block-dark-theme":C4,themes:[S4,C4],"code-block-props":Xe,final:f.value,"smooth-streaming":e.streaming,"batch-rendering":C.value,"defer-nodes-until-visible":!1,onCopy:z(Gi)},null,8,[`content`,`code-renderer`,`is-dark`,`themes`,`final`,`smooth-streaming`,`batch-rendering`,`onCopy`])):(c(),W(`div`,{key:1,class:V([`diff-wrap`,{"md-code-wrap":it(r),"md-code-nums":at(r)}])},[F(`div`,_se,[n[0]||=F(`span`,{class:`diff-lang`},`diff`,-1),v(Sp,{text:at(r)?z(a)(`conversation.hideLineNumbers`):z(a)(`conversation.showLineNumbers`)},{default:B(()=>[v(Ca,{size:`sm`,label:at(r)?z(a)(`conversation.hideLineNumbers`):z(a)(`conversation.showLineNumbers`),"aria-pressed":at(r),onClick:e=>st(r)},{default:B(()=>[v(X,{name:`list-numbers`,size:`sm`})]),_:1},8,[`label`,`aria-pressed`,`onClick`])]),_:2},1032,[`text`]),v(Sp,{text:it(r)?z(a)(`conversation.unwrapCode`):z(a)(`conversation.wrapCode`)},{default:B(()=>[v(Ca,{size:`sm`,label:it(r)?z(a)(`conversation.unwrapCode`):z(a)(`conversation.wrapCode`),"aria-pressed":it(r),onClick:e=>ot(r)},{default:B(()=>[v(X,{name:it(r)?`text-wrap-disabled`:`text-wrap`,size:`sm`},null,8,[`name`])]),_:2},1032,[`label`,`aria-pressed`,`onClick`])]),_:2},1032,[`text`]),v(Sp,{text:z(a)(`filePreview.copyCode`)},{default:B(()=>[F(`button`,{class:`diff-copy`,"aria-label":z(a)(`filePreview.copyCode`),onClick:e=>ut(t.code,r)},[v(X,{name:lt.value===r?`check`:`copy`,size:`sm`},null,8,[`name`])],8,vse)]),_:2},1032,[`text`])]),F(`pre`,yse,[F(`code`,null,[(c(!0),W(M,null,_($e(t.code),(e,t)=>(c(),W(`span`,{key:t,class:V([`diff-line`,`diff-${e.type}`])},[e.type===`hunk`?E(``,!0):(c(),W(`span`,bse,U(e.sign),1)),F(`span`,xse,U(e.text),1)],2))),128))])])],2))],64))),128))],512))}}),Ose=e({default:()=>w4}),w4=Y(Dse,[[`__scopeId`,`data-v-a23761a0`]]),kse={class:`activity-notice`,role:`status`},Ase={"aria-hidden":`true`},jse={class:`an-label`},Mse=Y(G({__name:`ActivityNotice`,props:{label:{}},setup(e){return(t,n)=>(c(),W(`div`,kse,[F(`span`,Ase,[v(op,{size:`sm`})]),F(`span`,jse,U(e.label),1)]))}}),[[`__scopeId`,`data-v-5e7a6420`]]);function Nse(e,t=`Yesterday`){try{let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=new Date,i=e=>String(e).padStart(2,`0`),a=`${i(n.getHours())}:${i(n.getMinutes())}`,o=n.getFullYear()===r.getFullYear(),s=n.getMonth()===r.getMonth(),c=n.getDate()===r.getDate();if(o&&s&&c)return a;let l=new Date(r);return l.setDate(r.getDate()-1),n.getFullYear()===l.getFullYear()&&n.getMonth()===l.getMonth()&&n.getDate()===l.getDate()?`${t} ${a}`:o?`${i(n.getMonth()+1)}-${i(n.getDate())} ${a}`:`${n.getFullYear()}-${i(n.getMonth()+1)}-${i(n.getDate())} ${a}`}catch{return e}}var T4=Y(G({__name:`MessageTime`,props:{time:{}},setup(e){let t=e,{t:n}=J(),r=R(!1),i=L(()=>{let e=new Date(t.time);if(Number.isNaN(e.getTime()))return t.time;let n=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}),a=L(()=>r.value?i.value:Nse(t.time,n(`conversation.yesterday`)));function o(){r.value=!r.value}return(e,t)=>(c(),W(`button`,{type:`button`,class:`msg-time`,onClick:H(o,[`stop`])},U(a.value),1))}}),[[`__scopeId`,`data-v-6761370d`]]);function Pse(e){return e.length===1?`0${e}`:e}function Fse(e,t){return`${String(Number(e))}:${Pse(t)}`}var E4=e=>/^\d+$/.test(e);function Ise(e,t){let n=e.trim().split(/\s+/);if(n.length!==5)return e;let[r,i,a,o,s]=n,c=a===`*`&&o===`*`&&s===`*`,l=a===`*`&&o===`*`;if(r===`*`&&i===`*`&&c)return t(`conversation.cron.everyMinute`);let u=/^\*\/(\d+)$/.exec(r);if(u&&i===`*`&&c)return u[1]===`1`?t(`conversation.cron.everyMinute`):t(`conversation.cron.everyNMinutes`,{n:u[1]});if(r===`0`&&i===`*`&&c)return t(`conversation.cron.everyHour`);let d=/^\*\/(\d+)$/.exec(i);if(r===`0`&&d&&c)return t(`conversation.cron.everyNHours`,{n:d[1]});if(E4(r)&&E4(i)&&l){let e=Fse(i,r);if(s===`1-5`)return t(`conversation.cron.weekdaysAt`,{time:e});if(s===`*`)return t(`conversation.cron.dailyAt`,{time:e})}return e}var Lse=[`data-turn-id`],Rse={class:`cn-bubble`},zse={class:`cn-title`},Bse={key:0,class:`cn-prompt`},Vse={class:`cn-meta`},Hse={key:0,class:`cn-meta-item`},Use={key:1,class:`cn-meta-item`},Wse=[`aria-label`],Gse=[`title`],Kse=Y(G({__name:`CronNotice`,props:{text:{},cron:{},turnId:{},createdAt:{}},setup(e){let t=e,{t:n}=J(),r=L(()=>t.cron),i=L(()=>r.value?.missedCount!==void 0),a=L(()=>i.value?n(`conversation.cron.missed`):n(`conversation.cron.fired`)),o=L(()=>{let e=r.value?.cron;return e?Ise(e,n):``}),s=L(()=>i.value?`error`:`ok`),l=L(()=>{let e=r.value;if(!e)return``;let t=[];return e.recurring===!1&&t.push(n(`conversation.cron.oneShot`)),typeof e.coalescedCount==`number`&&e.coalescedCount>1&&t.push(n(`conversation.cron.coalesced`,{n:e.coalescedCount})),e.missedCount!==void 0&&t.push(n(`conversation.cron.missedCount`,{n:e.missedCount})),e.stale===!0&&t.push(n(`conversation.cron.finalDelivery`)),t.join(` · `)}),u=L(()=>t.text??``);return(t,i)=>(c(),W(`div`,{class:V([`cn cron-notice`,{"turn-anchor":!!e.turnId}]),"data-turn-id":e.turnId,role:`status`},[F(`div`,Rse,[F(`span`,zse,U(a.value),1),u.value?(c(),W(`span`,Bse,U(u.value),1)):E(``,!0)]),F(`div`,Vse,[v(X,{name:`clock`,size:`sm`,class:`cn-meta-ico`,"aria-hidden":`true`}),o.value?(c(),W(`span`,Hse,U(o.value),1)):E(``,!0),l.value?(c(),W(`span`,Use,U(l.value),1)):E(``,!0),F(`span`,{class:V([`cn-status`,s.value]),"aria-label":s.value},[s.value===`ok`?(c(),P(X,{key:0,name:`check`,size:`sm`})):(c(),P(X,{key:1,name:`close`,size:`sm`}))],10,Wse),r.value?.jobId?(c(),W(`span`,{key:2,class:`cn-meta-item cn-id`,title:z(n)(`conversation.cron.job`,{id:r.value.jobId})},U(r.value.jobId),9,Gse)):E(``,!0),e.createdAt?(c(),P(T4,{key:3,time:e.createdAt},null,8,[`time`])):E(``,!0)])],10,Lse))}}),[[`__scopeId`,`data-v-d3807b0f`]]),D4=`pythinkerWeb.taskNotification`,qse=/]*)>([\s\S]*?)<\/notification>/g,Jse=/([\w-]+)="([^"]*)"/g,Yse=/]*)>[\s\S]*?<\/output-file>/,Xse=/]*)>([\s\S]*?)<\/output-preview>/,Zse=/^Title: (.*)$/m,Qse=/^Severity: (.*)$/m;function O4(e){return e.replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`&`,`&`)}function k4(e){let t={};for(let n of e.matchAll(Jse))n[1]!==void 0&&n[2]!==void 0&&(t[n[1]]=O4(n[2]));return t}function A4(e){if(e===void 0)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function $se(e,t,n){let r=k4(e),i=Zse.exec(t)?.[1]?.trim()??``,a=Qse.exec(t)?.[1]?.trim()??``,o=t.split(` `).filter(e=>!e.startsWith(`Title: `)&&!e.startsWith(`Severity: `)).join(` -`),s=o.search(/^<\w/m);s!==-1&&(o=o.slice(0,s));let c=Vse.exec(t),l=c?A4(c[1]??``):void 0,u=l?.path?{path:l.path,bytes:j4(l.bytes)}:void 0,d=Hse.exec(t),f=d?A4(d[1]??``):void 0,p=(d?.[2]??``).replace(/^\n/,``),m=p.indexOf(` -`),h=d?{text:k4(m===-1?``:p.slice(m+1)).replace(/\n$/,``),bytes:j4(f?.bytes),totalBytes:j4(f?.total_bytes),truncated:f?.truncated===`true`?!0:f?.truncated===`false`?!1:void 0}:void 0;return{id:r.id??``,category:r.category??``,type:r.type??``,sourceKind:r.source_kind??``,sourceId:r.source_id??``,agentId:r.agent_id,title:k4(i),severity:a,body:k4(o.trim()),outputFile:u,outputPreview:h,raw:n}}function M4(e){if(!e.includes(`{g=null,m.value=null},1200))}return h(()=>{g!==null&&clearTimeout(g)}),(e,r)=>(c(),W(`div`,Jse,[(c(!0),W(M,null,_(t.items,(e,t)=>(c(),W(`div`,{key:i(e,t),class:V([`ntn`,z(qse)(e)]),role:`status`},[F(`div`,Yse,[v(X,{name:a(e),size:`sm`,class:`ntn-ico`,"aria-hidden":`true`},null,8,[`name`]),F(`span`,Xse,U(u(e)),1)]),F(`div`,Zse,[e.title?(c(),W(`div`,Qse,U(e.title),1)):E(``,!0),e.body?(c(),W(`div`,$se,U(e.body),1)):E(``,!0),e.outputFile?(c(),W(`div`,ece,[v(X,{class:`ntn-out-ic`,name:`file-text`,size:`sm`,"aria-hidden":`true`}),F(`span`,{class:`ntn-out-path`,title:e.outputFile.path},U(e.outputFile.path),9,tce),e.outputFile.bytes===void 0?E(``,!0):(c(),W(`span`,nce,U(d(e.outputFile.bytes)),1)),v(YT,{"data-testid":`notification-copy-path`,variant:`secondary`,size:`sm`,type:`button`,onClick:n=>y(e.outputFile.path,i(e,t))},{default:B(()=>[v(X,{name:`copy`,size:`sm`,"aria-hidden":`true`}),K(` `+U(m.value===i(e,t)?z(n)(`conversation.notification.copied`):z(n)(`conversation.notification.copyPath`)),1)]),_:2},1032,[`onClick`])])):E(``,!0),p(e)?(c(),W(`div`,rce,[f(e)?(c(),W(`div`,ice,U(f(e)),1)):E(``,!0),e.outputPreview?.text?(c(),W(`pre`,ace,U(e.outputPreview.text),1)):E(``,!0)])):E(``,!0),F(`details`,oce,[F(`summary`,null,[v(X,{class:`ntn-raw-car`,name:`chevron-right`,size:`sm`,"aria-hidden":`true`}),F(`span`,null,U(z(n)(`conversation.notification.rawPayload`)),1)]),F(`div`,sce,[F(`div`,cce,[F(`span`,lce,U(z(n)(`conversation.notification.fields.type`)),1),F(`span`,uce,U(e.type),1),F(`span`,dce,U(z(n)(`conversation.notification.fields.source`)),1),F(`span`,fce,U(e.sourceKind)+` · `+U(e.sourceId),1),F(`span`,pce,U(z(n)(`conversation.notification.fields.severity`)),1),F(`span`,mce,U(e.severity||`—`),1)]),F(`pre`,hce,U(e.raw),1)])])]),F(`div`,gce,[e.createdAt?(c(),P(E4,{key:0,time:e.createdAt},null,8,[`time`])):E(``,!0)])],2))),128))]))}}),[[`__scopeId`,`data-v-6e055dc6`]]),_ce=[`src`,`controls`,`muted`],vce=[`aria-label`],yce=[`src`,`alt`],bce=[`aria-label`],F4=G({__name:`AuthMedia`,props:{url:{},kind:{},alt:{},fileId:{},mediaClass:{default:`u-img`},controls:{type:Boolean,default:!0},muted:{type:Boolean,default:!1}},setup(e){let t=e,n=R(t.fileId?``:t.url),r=R(null),i=R(!t.fileId),a=null,o=0,l=!1,u=null;function d(){a!==null&&(URL.revokeObjectURL(a),a=null)}async function f(){let e=++o;if(d(),!t.fileId){n.value=t.url;return}if(i.value)try{let r=await Q().getFileBlob(t.fileId),i=URL.createObjectURL(r);if(l||e!==o){URL.revokeObjectURL(i);return}a=i,n.value=a}catch{if(l||e!==o)return;n.value=t.url}}return s(()=>[t.fileId,t.url,i.value],f,{immediate:!0}),p(()=>{typeof IntersectionObserver==`function`&&r.value?(u=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(i.value=!0,u?.disconnect(),u=null)},{rootMargin:`200px`}),u.observe(r.value)):i.value=!0}),ne(()=>{l=!0,u?.disconnect(),u=null,d()}),(t,i)=>e.kind===`video`?(c(),W(M,{key:0},[n.value?(c(),W(`video`,{key:0,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),src:n.value,controls:e.controls,muted:e.muted,playsinline:``,preload:`metadata`},null,10,_ce)):(c(),W(`span`,{key:1,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),role:`status`,"aria-label":e.alt||``},null,10,vce))],64)):n.value?(c(),W(`img`,{key:1,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),src:n.value,alt:e.alt||``,loading:`lazy`},null,10,yce)):(c(),W(`span`,{key:2,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),role:`img`,"aria-label":e.alt||``},null,10,bce))}}),xce=[`title`,`data-kind`,`draggable`],Sce=[`aria-label`,`aria-haspopup`,`aria-expanded`,`aria-keyshortcuts`],Cce={class:`att-tile`},wce={key:4,class:`att-ord`,"aria-hidden":`true`},Tce={class:`att-name`},Ece={key:1,class:`att-err`},Dce=[`aria-label`],Oce=[`aria-label`],kce=[`data-side`,`aria-label`],Ace={class:`att-tip-preview`},jce={key:1,class:`att-tip-placeholder`},Mce={class:`att-tip-meta`},Nce={key:0},Pce={key:0,class:`att-tip-error`},Fce={class:`att-tip-foot`},I4=Y(G({__name:`AttachmentChip`,props:{kind:{},name:{},url:{},fileId:{},mediaType:{},size:{},ordinal:{},uploading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},removeLabel:{},mentionable:{type:Boolean,default:!1},mentionLabel:{},reorderable:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:[`activate`,`remove`,`mention`,`reorderStep`,`dragStart`,`dragOver`,`drop`,`dragEnd`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null),l=R(null),u=R(!1),d=R(`top`),f=R({}),p=null,m=L(()=>{let e=r.name?.match(/\.([A-Za-z0-9]{1,8})$/)?.[1]??r.mediaType?.split(`/`)[1]?.split(`+`)[0];return e?e.toUpperCase():void 0}),g=L(()=>{let e=m.value??``;return/^(txt|md|doc|docx|rtf|log)$/i.test(e)?`file-text`:`file`}),_=L(()=>r.name?r.name:r.kind===`image`?a(`composer.attachmentImage`):r.kind===`video`?a(`composer.attachmentVideo`):a(`composer.attachmentFile`));function y(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}let b=L(()=>{let e=[_.value];return r.size!==void 0&&e.push(y(r.size)),e.join(` · `)}),x=L(()=>r.kind!==`file`),S=L(()=>x.value&&(!!r.url||!!r.fileId)),C=L(()=>r.error?a(`mention.stateUploadFailed`):r.uploading?a(`mention.stateUploading`):a(`mention.stateUploaded`));function w(){let e=o.value,t=l.value;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.offsetWidth,i=t.offsetHeight,a=n.top-i-8,s=`top`;a<8&&(a=n.bottom+8,s=`bottom`),a=Math.min(Math.max(a,8),Math.max(8,window.innerHeight-i-8));let c=Math.min(Math.max(n.left+n.width/2-r/2,8),Math.max(8,window.innerWidth-r-8)),u=Math.min(Math.max(n.left+n.width/2-c,10),Math.max(10,r-10));d.value=s,f.value={top:`${Math.round(a)}px`,left:`${Math.round(c)}px`,"--tip-caret-x":`${Math.round(u)}px`}}function T(){x.value&&(p!==null&&(clearTimeout(p),p=null),u.value=!0,n(w))}function D(){p!==null&&clearTimeout(p),p=setTimeout(()=>{u.value=!1,p=null},120)}function O(){p!==null&&clearTimeout(p),p=null,u.value=!1}function k(e){if(!(!r.reorderable||!e.altKey)){if(e.key===`ArrowLeft`){e.preventDefault(),i(`reorderStep`,-1);return}e.key===`ArrowRight`&&(e.preventDefault(),i(`reorderStep`,1))}}function A(e){if(!r.reorderable||r.uploading){e.preventDefault();return}u.value=!1,i(`dragStart`,e)}function j(e){r.reorderable&&(e.preventDefault(),i(`dragOver`,e))}function N(e){r.reorderable&&(e.preventDefault(),i(`drop`,e))}return s(u,e=>{let t=e?`addEventListener`:`removeEventListener`;window[t](`resize`,w),window[t](`scroll`,w,!0)}),h(()=>{O(),window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,w,!0)}),(t,n)=>(c(),W(M,null,[F(`span`,{ref_key:`anchorRef`,ref:o,class:V([`att-chip`,{"is-error":e.error,uploading:e.uploading,"is-reorderable":e.reorderable,"is-dragging":e.dragging}]),title:b.value,"data-kind":e.kind,draggable:e.reorderable&&!e.uploading,onMouseenter:T,onMouseleave:D,onFocusin:T,onFocusout:D,onKeydown:ie(O,[`esc`]),onDragstart:A,onDragover:j,onDrop:N,onDragend:n[3]||=e=>i(`dragEnd`)},[F(`button`,{type:`button`,class:`att-activate`,"aria-label":b.value,"aria-haspopup":x.value?`dialog`:void 0,"aria-expanded":x.value?u.value:void 0,"aria-keyshortcuts":e.reorderable?`Alt+ArrowLeft Alt+ArrowRight`:void 0,onClick:n[0]||=e=>i(`activate`),onKeydown:k},[F(`span`,Cce,[e.kind===`image`&&e.url?(c(),P(F4,{key:0,url:e.url,kind:`image`,alt:e.name,"file-id":e.fileId,"media-class":`att-thumb`},null,8,[`url`,`alt`,`file-id`])):e.kind===`video`?(c(),P(X,{key:1,name:`play`,size:`sm`})):e.kind===`image`?(c(),P(X,{key:2,name:`image`,size:`sm`})):(c(),P(X,{key:3,name:g.value,size:`sm`},null,8,[`name`])),e.ordinal===void 0?E(``,!0):(c(),W(`span`,wce,U(e.ordinal),1))]),F(`span`,Tce,U(_.value),1),e.uploading?(c(),P(np,{key:0,size:`sm`,label:z(a)(`composer.uploading`)},null,8,[`label`])):e.error?(c(),W(`span`,Ece,[v(X,{name:`info`,size:`sm`})])):E(``,!0)],40,Sce),e.mentionable?(c(),P(vp,{key:0,text:e.mentionLabel??z(a)(`composer.mentionNamed`,{name:_.value})},{default:B(()=>[F(`button`,{type:`button`,class:`att-mention`,"aria-label":e.mentionLabel??z(a)(`composer.mentionNamed`,{name:_.value}),onClick:n[1]||=e=>i(`mention`)},[...n[5]||=[F(`span`,{class:`att-mention-glyph`,"aria-hidden":`true`},`@`,-1)]],8,Dce)]),_:1},8,[`text`])):E(``,!0),e.removable?(c(),P(vp,{key:1,text:e.removeLabel??z(a)(`composer.remove`)},{default:B(()=>[F(`button`,{type:`button`,class:`att-rm`,"aria-label":e.removeLabel??z(a)(`composer.remove`),onClick:n[2]||=e=>i(`remove`)},[v(X,{name:`close`,size:`sm`})],8,Oce)]),_:1},8,[`text`])):E(``,!0)],42,xce),(c(),P(ee,{to:`body`},[u.value&&x.value?(c(),W(`div`,{key:0,ref_key:`tipRef`,ref:l,class:`att-tip`,"data-side":d.value,style:ae(f.value),role:`dialog`,"aria-label":b.value,onMouseenter:T,onMouseleave:D,onFocusin:T,onFocusout:D,onKeydown:ie(O,[`esc`])},[n[6]||=F(`span`,{class:`att-tip-caret`,"aria-hidden":`true`},null,-1),F(`div`,Ace,[S.value?(c(),P(F4,{key:0,url:e.url??``,kind:e.kind===`video`?`video`:`image`,alt:_.value,"file-id":e.fileId,"media-class":`att-tip-media`,controls:e.kind===`video`,muted:``},null,8,[`url`,`kind`,`alt`,`file-id`,`controls`])):(c(),W(`span`,jce,[e.uploading?(c(),P(np,{key:0,size:`sm`,label:z(a)(`mention.mediaPreviewUploading`)},null,8,[`label`])):(c(),P(X,{key:1,name:e.kind===`video`?`play`:`image`},null,8,[`name`])),F(`span`,null,U(e.uploading?z(a)(`mention.mediaPreviewUploading`):z(a)(`mention.mediaPreviewUnavailable`)),1)]))]),F(`div`,Mce,[v(X,{name:e.kind===`video`?`play`:`image`,size:`sm`},null,8,[`name`]),F(`strong`,null,U(_.value),1),e.size===void 0?E(``,!0):(c(),W(`span`,Nce,`· `+U(y(e.size)),1))]),e.error?(c(),W(`div`,Pce,U(z(a)(`mention.attachmentUploadFailed`)),1)):E(``,!0),F(`div`,Fce,[F(`span`,{class:V([`att-tip-state`,{danger:e.error}])},[e.uploading?(c(),P(np,{key:0,size:`sm`})):E(``,!0),K(` `+U(C.value),1)],2),S.value?(c(),W(`button`,{key:0,type:`button`,class:`att-tip-open`,onClick:n[4]||=e=>i(`activate`)},[v(X,{name:`expand`,size:`sm`}),F(`span`,null,U(z(a)(`mention.viewFullscreen`)),1)])):E(``,!0)])],44,kce)):E(``,!0)]))],64))}}),[[`__scopeId`,`data-v-e8af44e9`]]),Ice=[`data-mention-kind`,`data-mention-name`,`data-mention-path`,`tabindex`,`role`,`onClick`,`onKeydown`],Lce=[`innerHTML`],Rce={class:`mention-pill-name`},L4=G({__name:`ComposerText`,props:{text:{},interactive:{type:Boolean,default:!0},openFile:{}},setup(e){let t=e,n=R(null),r=L(()=>l4(t.text));function i(e,n){n.kind!==`file`||!t.interactive||!t.openFile||(e.preventDefault(),e.stopPropagation(),t.openFile({path:n.path}))}function a(e){let t=window.getSelection(),r=n.value;if(!t||t.rangeCount===0||!r||!e.clipboardData)return;let i=t.getRangeAt(0);if(!i.intersectsNode(r))return;let a=i.cloneContents();for(let e of a.querySelectorAll(`.mention-pill`)){let{mentionKind:t,mentionName:n,mentionPath:r}=e.dataset;t!==`file`&&t!==`folder`&&t!==`skill`||n===void 0||r===void 0||e.replaceWith(document.createTextNode(c4({kind:t,name:n,path:r})))}e.clipboardData.setData(`text/plain`,a.textContent??``),e.preventDefault()}return(t,o)=>(c(),W(`span`,{ref_key:`root`,ref:n,class:`composer-text`,onCopy:a},[(c(!0),W(M,null,_(r.value,(t,n)=>(c(),W(M,{key:n},[t.type===`text`?(c(),W(M,{key:0},[K(U(t.value),1)],64)):(c(),W(`span`,{key:1,class:V([`mention-pill`,`mention-${t.attrs.kind}`]),"data-mention-kind":t.attrs.kind,"data-mention-name":t.attrs.name,"data-mention-path":t.attrs.path,tabindex:t.attrs.kind===`file`&&e.interactive&&e.openFile?0:void 0,role:t.attrs.kind===`file`&&e.interactive&&e.openFile?`button`:void 0,onClick:e=>i(e,t.attrs),onKeydown:[ie(e=>i(e,t.attrs),[`enter`]),ie(e=>i(e,t.attrs),[`space`])]},[F(`span`,{class:`mention-pill-icon`,"aria-hidden":`true`,innerHTML:t.attrs.kind===`skill`?z(wf)(`sparkles`,`sm`):z(Tf)(t.attrs.path,t.attrs.name)},null,8,Lce),F(`span`,Rce,U(z(p4)(t.attrs.name)),1)],42,Ice))],64))),128))],544))}}),zce=[`aria-expanded`,`title`],Bce={class:`tf-sum`},Vce=[`inert`],Hce={class:`tf-body-inner`},Uce={key:1,class:`msg`},Wce=Y(G({__name:`TurnFold`,props:{items:{},live:{type:Boolean,default:!1},parked:{type:Boolean,default:!1},seedMs:{default:void 0},createdMs:{default:void 0},endedMs:{default:void 0},streamingTailIndex:{default:null},durationMs:{default:void 0},toolDiffPanel:{type:Boolean,default:!1},mobile:{type:Boolean,default:!1}},emits:[`openMedia`,`openFile`,`openToolDiff`,`openAgent`,`detach`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=L(()=>r.streamingTailIndex!==null),l=L(()=>r.live?r.parked?`parked`:`live`:`settled`),u=R(!1),d=L(()=>o.value||u.value),f=R(d.value),p=R(d.value),g=null;s(d,e=>{if(e){if(g!==null&&(clearTimeout(g),g=null),f.value){p.value=!0;return}f.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{p.value=!0})});return}p.value=!1,g=setTimeout(()=>{g=null,f.value=!1},200)});let y=m(`pinScroll`,()=>void 0),b=R(null);function x(){u.value=!u.value,n(()=>{let e=b.value;e&&y(e)})}let S=R(Date.now()),C=null;function w(){C!==null&&(clearInterval(C),C=null)}s(l,(e,t)=>{e===`settled`?w():(S.value=Date.now(),C===null&&(C=setInterval(()=>{S.value=Date.now()},1e3))),t===`live`&&e!==`live`&&(u.value=!1)},{immediate:!0}),h(()=>{w(),g!==null&&clearTimeout(g)});let T=L(()=>r.seedMs===void 0?r.createdMs:r.createdMs===void 0?r.seedMs:Math.min(r.seedMs,r.createdMs)),D=L(()=>{if(l.value===`settled`)return r.durationMs===void 0?T.value===void 0||r.endedMs===void 0?void 0:Math.max(0,r.endedMs-T.value):Math.max(0,r.durationMs);if(T.value!==void 0)return Math.max(0,S.value-T.value)}),O=L(()=>{let e=D.value;if(e===void 0)return a(`conversation.fold.workedUnknown`);let t=gO(e);return t?a(`conversation.fold.worked`,{duration:t}):a(`conversation.fold.workedUnknown`)});function k(e){return yO(e)?!1:r.streamingTailIndex!==null&&`sourceIndex`in e&&e.sourceIndex===r.streamingTailIndex}function A(e){if(r.streamingTailIndex===null)return!1;let t=e.items.at(-1);return t!==void 0&&yO(t)?!1:t!==void 0&&t.sourceIndex===r.streamingTailIndex}return(t,n)=>e.items.length>0?(c(),W(`div`,{key:0,class:V([`turn-fold`,{open:d.value,streaming:o.value}])},[o.value?E(``,!0):(c(),W(`button`,{key:0,ref_key:`headEl`,ref:b,type:`button`,class:`tf-head`,"aria-expanded":u.value,title:O.value,onClick:x},[F(`span`,Bce,U(O.value),1),v(X,{class:`tf-car`,name:`chevron-right`,size:`sm`,"aria-hidden":`true`})],8,zce)),f.value?(c(),W(`div`,{key:1,class:V([`tf-body`,{open:p.value}]),inert:!d.value},[F(`div`,Hce,[(c(!0),W(M,null,_(e.items,(t,r)=>(c(),W(M,{key:z(SO)(t,r)},[t.kind===`thinking`?(c(),P(TO,{key:0,text:t.thinking,mobile:e.mobile,streaming:k(t),"started-at-ms":z(vO)(t.startedAt),"duration-ms":t.durationMs},null,8,[`text`,`mobile`,`streaming`,`started-at-ms`,`duration-ms`])):t.kind===`text`&&t.text?(c(),W(`div`,Uce,[v(T4,{text:t.text,streaming:k(t),"open-file":e=>i(`openFile`,e)},null,8,[`text`,`streaming`,`open-file`])])):t.kind===`activity-run`?(c(),P(EO,{key:2,items:t.items,mobile:e.mobile,streaming:A(t),"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[0]||=e=>i(`openMedia`,e),onOpenFile:n[1]||=e=>i(`openFile`,e),onOpenToolDiff:n[2]||=e=>i(`openToolDiff`,e),onOpenAgent:n[3]||=e=>i(`openAgent`,e),onDetach:n[4]||=e=>i(`detach`,e)},null,8,[`items`,`mobile`,`streaming`,`tool-diff-panel`])):t.kind===`tool`?(c(),P(pO,{key:3,tool:t.tool,mobile:e.mobile,"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[5]||=e=>i(`openMedia`,e),onOpenFile:n[6]||=e=>i(`openFile`,e),onOpenToolDiff:n[7]||=e=>i(`openToolDiff`,e),onOpenAgent:n[8]||=e=>i(`openAgent`,e),onDetach:n[9]||=e=>i(`detach`,e)},null,8,[`tool`,`mobile`,`tool-diff-panel`])):t.kind===`notification`?(c(),P(P4,{key:4,items:t.items},null,8,[`items`])):E(``,!0)],64))),128))])],10,Vce)):E(``,!0)],2)):E(``,!0)}}),[[`__scopeId`,`data-v-331ba726`]]),Gce={key:0,class:`ui-card__head`},Kce={class:`ui-card__body`},qce={key:1,class:`ui-card__foot`},R4=Y(G({__name:`Card`,props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-card`,{"is-elevated":e.elevated}])},[t.$slots.head?(c(),W(`div`,Gce,[me(t.$slots,`head`,{},void 0,!0)])):E(``,!0),F(`div`,Kce,[me(t.$slots,`default`,{},void 0,!0)]),t.$slots.foot?(c(),W(`div`,qce,[me(t.$slots,`foot`,{},void 0,!0)])):E(``,!0)],2))}}),[[`__scopeId`,`data-v-d2cab471`]]),Jce={class:`tf-ic`},Yce={class:`tf-title`},Xce={key:0,class:`tf-stats`},Zce={key:0,class:`tf-add`},Qce={key:1,class:`tf-del`},$ce={class:`diffbar`,"aria-hidden":`true`},ele={class:`tf-list`},tle=[`innerHTML`],nle={class:`tf-dir`},rle={class:`tf-base`},ile={key:0,class:`tf-stats`},ale={key:0,class:`tf-add`},ole={key:1,class:`tf-del`},sle=Y(G({__name:`TurnFilesSummary`,props:{changes:{},cwd:{},interactive:{type:Boolean,default:!0}},emits:[`openDiff`,`openFile`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=ue(!1),a=L(()=>i.value?e.changes:e.changes.slice(0,3)),o=L(()=>Math.max(0,e.changes.length-3)),s=L(()=>e.changes.reduce((e,t)=>e+t.added,0)),l=L(()=>e.changes.reduce((e,t)=>e+t.removed,0)),u=L(()=>e.changes.every(e=>!e.statsIncomplete)),d=L(()=>s.value+l.value),f=L(()=>d.value===0?1:s.value),p=L(()=>d.value===0?1:l.value);function m(t){if(!e.cwd)return t;let n=e.cwd.replaceAll(`\\`,`/`).replace(/\/$/,``),r=t.replaceAll(`\\`,`/`);return r.startsWith(`${n}/`)?r.slice(n.length+1):t}function h(e){let t=m(e).replaceAll(`\\`,`/`),n=t.lastIndexOf(`/`);return n<0?{dir:``,base:t}:{dir:t.slice(0,n+1),base:t.slice(n+1)}}function g(t){e.interactive&&(t.hasWrite?n(`openFile`,{path:t.path}):n(`openDiff`,t))}return(t,n)=>(c(),P(R4,{class:`turn-files`},pe({head:B(()=>[F(`span`,Jce,[v(X,{name:`pencil`,size:`sm`})]),F(`span`,Yce,U(z(r)(e.changes.length===1?`conversation.turnFiles.titleOne`:`conversation.turnFiles.titleOther`,{number:e.changes.length})),1),u.value&&d.value>0?(c(),W(`span`,Xce,[s.value>0?(c(),W(`span`,Zce,`+`+U(s.value),1)):E(``,!0),l.value>0?(c(),W(`span`,Qce,`−`+U(l.value),1)):E(``,!0),F(`span`,$ce,[F(`span`,{class:`seg-add`,style:ae({flexGrow:f.value})},null,4),F(`span`,{class:`seg-del`,style:ae({flexGrow:p.value})},null,4)])])):E(``,!0)]),default:B(()=>[F(`ul`,ele,[(c(!0),W(M,null,_(a.value,t=>(c(),W(`li`,{key:t.path,class:`tf-row`},[(c(),P(x(e.interactive?`button`:`span`),{type:e.interactive?`button`:void 0,class:`tf-file`,onClick:e=>g(t)},{default:B(()=>[F(`span`,{class:`tf-ficon`,"aria-hidden":`true`,innerHTML:z(Tf)(t.path)},null,8,tle),F(`span`,nle,U(h(t.path).dir),1),F(`span`,rle,U(h(t.path).base),1)]),_:2},1032,[`type`,`onClick`])),!t.statsIncomplete&&(t.added>0||t.removed>0)?(c(),W(`span`,ile,[t.added>0?(c(),W(`span`,ale,`+`+U(t.added),1)):E(``,!0),t.removed>0?(c(),W(`span`,ole,`−`+U(t.removed),1)):E(``,!0)])):E(``,!0)]))),128))])]),_:2},[o.value>0?{name:`foot`,fn:B(()=>[v(YT,{class:`tf-more`,variant:`ghost`,size:`sm`,onClick:n[0]||=e=>i.value=!i.value},{default:B(()=>[v(X,{class:V([`tf-more-car`,{open:i.value}]),name:`chevron-down`,size:`sm`},null,8,[`class`]),K(` `+U(i.value?z(r)(`conversation.turnFiles.showLess`):z(r)(o.value===1?`conversation.turnFiles.moreOne`:`conversation.turnFiles.more`,{number:o.value})),1)]),_:1})]),key:`0`}:void 0]),1024))}}),[[`__scopeId`,`data-v-11486090`]]),cle=[`src`],lle=6,ule=300,dle=6,fle=250,ple=Y(G({__name:`MascotSprite`,props:{state:{},size:{default:48}},setup(e){let t=lle*ule,n=dle*fle,r=e,i=R(`laptop`),a,o=L(()=>{let e=r.size;return{width:`${e}px`,height:`${e*208/192}px`}}),l=L(()=>r.state===`failed`?`/brand/mascot-failed.png`:r.state===`waiting`?`/brand/mascot-idle.png`:`/brand/mascot-${i.value}.png`);function u(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function d(){a!==void 0&&(clearTimeout(a),a=void 0)}function f(){if(d(),r.state!==`running`||u())return;let e=i.value===`laptop`?t:n;a=setTimeout(()=>{a=void 0,i.value=i.value===`laptop`?`review`:`laptop`,f()},e)}return p(f),h(d),s(()=>r.state,e=>{d(),i.value=`laptop`,e===`running`&&f()}),(e,t)=>(c(),W(`img`,{"aria-hidden":`true`,class:`mascot-apng`,src:l.value,style:ae(o.value)},null,12,cle))}}),[[`__scopeId`,`data-v-bee6ba86`]]),mle={class:`working-indicator`,role:`status`},hle={class:`wi-mascot`,"aria-hidden":`true`},gle=Y(G({__name:`WorkingIndicator`,props:{label:{},state:{}},setup(e){return(t,n)=>(c(),W(`div`,mle,[F(`span`,hle,[v(ple,{state:e.state,size:40},null,8,[`state`])]),F(`span`,{class:V([`wi-label`,{"ui-shimmer":e.state===`running`}])},U(e.label),3)]))}}),[[`__scopeId`,`data-v-c98397bf`]]),_le=`"answer":"`;function vle(e){if(e===void 0)return;let t=e.trimStart();if(!t.startsWith(`{`))return;let n=t.indexOf(_le);if(n===-1)return``;let r=n+10,i=``;for(;r=t.length)break;let e=t.slice(r,r+2);if(e===`\\u`){if(r+6>t.length)break;i+=t.slice(r,r+6),r+=6;continue}i+=e,r+=2;continue}i+=e,r+=1}try{return JSON.parse(`"${i}"`)}catch{return i}}var z4=R(Yi(qi.discussionReasoning)!==`false`),yle=fe(z4);function ble(e){z4.value=e,Xi(qi.discussionReasoning,String(e))}var xle={showReasoning:yle,setShowReasoning:ble};function B4(){return xle}var Sle={class:`expert-talk__artifact-body`},Cle={class:`expert-talk__thinking-head`},wle={class:`expert-talk__thinking-label`},Tle=[`aria-expanded`],Ele={key:0,class:`expert-talk__thinking-full`},Dle={key:1,class:`expert-talk__thinking-preview`},Ole={key:2,class:`expert-talk__thinking-preview`},kle=[`title`],Ale={class:`expert-talk__tools-breakdown`},jle={key:2,class:`expert-talk__artifact-text`},Mle={key:3},Nle=2,V4=Y(G({__name:`ExpertTalkArtifactBody`,props:{artifact:{},state:{},text:{}},setup(e){let t=e,{t:n}=J(),{showReasoning:r}=B4(),i=L(()=>t.state===`running`),a=L(()=>t.artifact?.thinking?.trim()??``),o=L(()=>r.value&&(a.value.length>0||i.value));function l(e){return e.replaceAll(/^#{1,6}\s+/gm,``).replaceAll(/[*_`]+/g,``).replaceAll(/\s+/g,` `).trim()}let u=L(()=>(l(a.value).match(/[^.!?]+[.!?]+["')\]]*|[^.!?]+$/g)??[]).slice(0,Nle).map(e=>e.trim()).join(` `)),d=L(()=>l(a.value).length>u.value.length),f=R(!1);s(()=>t.artifact?.stage,()=>{f.value=!1});let p=L(()=>{let e=t.artifact?.tools??[];if(e.length===0)return;let r=new Map;for(let t of e){let e=t.name??n(`expertTalk.tool`);r.set(e,(r.get(e)??0)+1)}let i=Array.from(r.entries()).toSorted((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>t>1?`${e} ×${t}`:e).join(` · `);return{total:e.length,breakdown:i}}),m=L(()=>t.text??t.artifact?.text);return(t,r)=>(c(),W(`div`,Sle,[o.value?(c(),W(`section`,{key:0,class:V([`expert-talk__thinking`,{"is-expanded":f.value}])},[F(`header`,Cle,[F(`span`,wle,[r[1]||=F(`span`,{"aria-hidden":`true`},`▹`,-1),K(` `+U(z(n)(`expertTalk.thinking`)),1)]),d.value?(c(),W(`button`,{key:0,type:`button`,class:`expert-talk__thinking-toggle`,"aria-expanded":f.value,onClick:r[0]||=e=>f.value=!f.value},[K(U(f.value?z(n)(`expertTalk.reasoningLess`):z(n)(`expertTalk.reasoningMore`))+` `,1),v(X,{name:f.value?`chevron-down`:`chevron-right`,size:`sm`},null,8,[`name`])],8,Tle)):E(``,!0)]),f.value?(c(),W(`div`,Ele,[v(T4,{text:a.value,streaming:i.value},null,8,[`text`,`streaming`])])):u.value?(c(),W(`p`,Dle,U(u.value),1)):(c(),W(`p`,Ole,U(z(n)(`expertTalk.thinkingPending`)),1))],2)):E(``,!0),p.value?(c(),W(`p`,{key:1,class:`expert-talk__tools`,title:p.value.breakdown},[r[2]||=F(`span`,{"aria-hidden":`true`},`▸`,-1),K(` `+U(z(n)(`expertTalk.toolSummary`,{count:p.value.total}))+` `,1),F(`span`,Ale,U(p.value.breakdown),1)],8,kle)):E(``,!0),m.value?(c(),W(`div`,jle,[v(T4,{text:m.value,streaming:i.value},null,8,[`text`,`streaming`])])):i.value?E(``,!0):(c(),W(`p`,Mle,U(e.artifact?.error??z(n)(`expertTalk.artifactState.${e.state}`)),1))]))}}),[[`__scopeId`,`data-v-462ed3a1`]]),Ple=[`aria-label`],Fle={class:`expert-talk__sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},Ile=[`open`],Lle={class:`expert-opinion-exchange__top`},Rle={class:`expert-opinion-exchange__title`},zle={class:`expert-opinion-exchange__phases`},Ble=[`data-state`],Vle={class:`expert-talk__run-metrics`},Hle={key:0,class:`expert-opinion-exchange__error`,role:`status`},Ule={key:1,class:`expert-opinion-exchange__error`,role:`alert`},Wle={class:`expert-talk__agent-grid`},Gle=[`aria-label`],Kle={class:`expert-talk__agent-head`},qle={class:`expert-talk__agent-symbol`,"aria-hidden":`true`},Jle={class:`expert-talk__agent-role`},Yle={class:`expert-talk__agent-model`},Xle={class:`expert-talk__stage-head`},Zle={key:0,class:`expert-talk__metrics`},Qle={key:0,class:`expert-talk__agent-actions`},$le=[`aria-label`],eue={class:`expert-talk__agent-head`},tue={class:`expert-talk__agent-role`},nue={class:`expert-talk__agent-model`},rue={key:0,class:`expert-talk__metrics`},iue=[`aria-label`],aue={class:`expert-talk__comparison-grid`},oue={key:0,class:`expert-talk__comparison-card expert-talk__comparison-card--agreement`},sue={key:1,class:`expert-talk__comparison-card expert-talk__comparison-card--difference`},cue={key:2,class:`expert-talk__comparison-card expert-talk__comparison-card--uncertainty`},lue={key:2,class:`expert-talk__fusion-actions`},uue=G({__name:`ExpertTalkExchange`,props:{run:{},models:{default:()=>[]}},emits:[`take`,`build`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=L(()=>n.run.state===`running`),o=R(!0);s(a,e=>{e&&(o.value=!0)});function l(e){o.value=e.currentTarget.open}let u=L(()=>a.value?i(`expertTalk.flowTitle`):i(`expertTalk.viewExchange`)),d=L(()=>i(`expertTalk.liveAnnouncement`,{state:i(`expertTalk.runState.${n.run.state}`),stage:i(`expertTalk.stage.${n.run.stage}`)})),f=L(()=>[{label:i(`expertTalk.metric.requests`),value:n.run.usage.requestCount===void 0?i(`expertTalk.unavailable`):String(n.run.usage.requestCount)},{label:i(`expertTalk.metric.attempts`),value:n.run.usage.providerAttemptCount===void 0?i(`expertTalk.unavailable`):String(n.run.usage.providerAttemptCount)},{label:i(`expertTalk.metric.cost`),value:i(`expertTalk.unavailable`)}]);function p(e){return e.some(e=>e.state===`running`)?`running`:e.some(e=>e.state===`failed`||e.state===`cancelled`)?`failed`:e.length>0&&e.every(e=>e.state===`unavailable`)?`skipped`:e.every(e=>e.state===`completed`||e.state===`unavailable`)?`completed`:`pending`}let m=L(()=>[{id:`opening`,label:i(`expertTalk.opinions`),state:p([n.run.opening.lead,n.run.opening.peer])},{id:`review`,label:i(`expertTalk.review`),state:p([n.run.review.lead,n.run.review.peer])},{id:`fusion`,label:i(`expertTalk.fusion`),state:n.run.fusion===void 0?`pending`:p([n.run.fusion])}]);function h(e){let t=n.models.find(t=>t.id===e);return t?.displayName??t?.model??e}function g(...e){return e.map(e=>e.text?.trim()).find(e=>e!==void 0&&e.length>0)}let y=L(()=>[{key:`lead`,role:i(`expertTalk.model1`),model:h(n.run.bindings.fusionLead.effectiveModelId),symbol:`◆`,stages:[{key:`lead-opening`,label:i(`expertTalk.opening`),artifact:n.run.opening.lead},{key:`lead-review`,label:i(`expertTalk.reviewPeer`),artifact:n.run.review.lead}],answer:g(n.run.review.lead,n.run.opening.lead)},{key:`peer`,role:i(`expertTalk.model2`),model:h(n.run.bindings.peer.effectiveModelId),symbol:`▲`,stages:[{key:`peer-opening`,label:i(`expertTalk.opening`),artifact:n.run.opening.peer},{key:`peer-review`,label:i(`expertTalk.reviewLead`),artifact:n.run.review.peer}],answer:g(n.run.review.peer,n.run.opening.peer)}]);function b(e){return(vle(e)??e)?.trim()||void 0}let x=L(()=>{if(!(n.run.fusion===void 0&&n.run.stage!==`fusion`))return{model:h(n.run.bindings.fusionLead.effectiveModelId),artifact:n.run.fusion,state:n.run.fusion?.state??`running`,answer:n.run.result?.answer.trim()||b(n.run.fusion?.text)}});function S(e){if(e.startedAt===void 0||e.endedAt===void 0)return;let t=Date.parse(e.startedAt),n=Date.parse(e.endedAt);if(!(!Number.isFinite(t)||!Number.isFinite(n)||n0&&e.usage.output>0&&t.push({label:i(`expertTalk.metric.tps`),value:String(Math.round(e.usage.output/n))})}return e.toolCallCount!==void 0&&t.push({label:i(`expertTalk.metric.tools`),value:String(e.toolCallCount)}),t}function w(e){return e===`completed`?`success`:e===`failed`||e===`cancelled`?`danger`:e===`running`?`info`:`neutral`}function T(e){return e===`completed`?`success`:e===`failed`||e===`cancelled`||e===`interrupted`?`danger`:e===`running`?`info`:`neutral`}return(t,n)=>(c(),W(`section`,{class:`expert-opinion-exchange`,"aria-label":z(i)(`expertTalk.flowLabel`)},[F(`p`,Fle,U(d.value),1),F(`details`,{open:o.value,onToggle:l},[F(`summary`,Lle,[F(`span`,Rle,[n[2]||=F(`span`,{"aria-hidden":`true`},`◆`,-1),F(`span`,null,U(u.value),1)]),v(ip,{variant:T(e.run.state),dot:``},{default:B(()=>[K(U(z(i)(`expertTalk.runState.${e.run.state}`)),1)]),_:1},8,[`variant`])]),F(`ol`,zle,[(c(!0),W(M,null,_(m.value,e=>(c(),W(`li`,{key:e.id,"data-state":e.state},[v(KD,{status:e.state},null,8,[`status`]),F(`span`,null,U(e.label),1)],8,Ble))),128))]),F(`dl`,Vle,[(c(!0),W(M,null,_(f.value,e=>(c(),W(`div`,{key:e.label},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))]),e.run.resultUnsupported?(c(),W(`p`,Hle,U(z(i)(`expertTalk.unsupportedResult`,{version:e.run.resultVersion})),1)):E(``,!0),e.run.error?(c(),W(`p`,Ule,U(e.run.error.message)+` `+U(e.run.error.action),1)):E(``,!0),F(`div`,Wle,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`article`,{key:e.key,class:V([`expert-talk__agent-column`,`expert-talk__agent-column--${e.key}`]),"aria-label":`${e.role}: ${e.model}`},[F(`header`,Kle,[F(`span`,qle,U(e.symbol),1),F(`span`,Jle,U(e.role),1),F(`span`,Yle,U(e.model),1)]),(c(!0),W(M,null,_(e.stages,e=>(c(),W(`section`,{key:e.key,class:`expert-talk__stage`},[F(`header`,Xle,[F(`span`,null,U(e.label),1),v(ip,{size:`sm`,variant:w(e.artifact.state),dot:``},{default:B(()=>[K(U(z(i)(`expertTalk.artifactState.${e.artifact.state}`)),1)]),_:2},1032,[`variant`])]),C(e.artifact).length>0?(c(),W(`dl`,Zle,[(c(!0),W(M,null,_(C(e.artifact),e=>(c(),W(`div`,{key:e.label},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))])):E(``,!0),v(V4,{artifact:e.artifact,state:e.artifact.state},null,8,[`artifact`,`state`])]))),128)),e.answer?(c(),W(`footer`,Qle,[v(YT,{size:`sm`,variant:`secondary`,title:z(i)(`expertTalk.takeHint`),onClick:t=>r(`take`,e.answer)},{default:B(()=>[v(X,{name:`pencil`,size:`sm`}),K(` `+U(z(i)(e.key===`lead`?`expertTalk.takeModel1`:`expertTalk.takeModel2`)),1)]),_:2},1032,[`title`,`onClick`])])):E(``,!0)],10,Gle))),128))]),x.value?(c(),W(`article`,{key:2,class:`expert-talk__fusion`,"aria-label":`${z(i)(`expertTalk.fusion`)}: ${x.value.model}`},[F(`header`,eue,[n[3]||=F(`span`,{class:`expert-talk__agent-symbol`,"aria-hidden":`true`},`⧉`,-1),F(`span`,tue,U(z(i)(`expertTalk.fusion`)),1),F(`span`,nue,U(x.value.model)+` · `+U(z(i)(`expertTalk.freshFusion`)),1),v(ip,{size:`sm`,variant:w(x.value.state),dot:``},{default:B(()=>[K(U(z(i)(`expertTalk.artifactState.${x.value.state}`)),1)]),_:1},8,[`variant`])]),C(x.value.artifact).length>0?(c(),W(`dl`,rue,[(c(!0),W(M,null,_(C(x.value.artifact),e=>(c(),W(`div`,{key:e.label},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))])):E(``,!0),v(V4,{artifact:x.value.artifact,state:x.value.state,text:x.value.answer},null,8,[`artifact`,`state`,`text`]),e.run.result&&(e.run.result.notes.consensus.length>0||e.run.result.notes.divergence.length>0||e.run.result.notes.uncertainty.length>0)?(c(),W(`section`,{key:1,class:`expert-talk__comparison`,"data-testid":`discussion-comparison`,"aria-label":z(i)(`expertTalk.finalComparison`)},[F(`h3`,null,U(z(i)(`expertTalk.finalComparison`)),1),F(`div`,aue,[e.run.result.notes.consensus.length>0?(c(),W(`section`,oue,[F(`h4`,null,[n[4]||=F(`span`,{"aria-hidden":`true`},`✓`,-1),K(U(z(i)(`expertTalk.agreement`)),1)]),F(`ul`,null,[(c(!0),W(M,null,_(e.run.result.notes.consensus,e=>(c(),W(`li`,{key:e},[v(T4,{text:e},null,8,[`text`])]))),128))])])):E(``,!0),e.run.result.notes.divergence.length>0?(c(),W(`section`,sue,[F(`h4`,null,[n[5]||=F(`span`,{"aria-hidden":`true`},`↔`,-1),K(U(z(i)(`expertTalk.differences`)),1)]),F(`ul`,null,[(c(!0),W(M,null,_(e.run.result.notes.divergence,e=>(c(),W(`li`,{key:e},[v(T4,{text:e},null,8,[`text`])]))),128))])])):E(``,!0),e.run.result.notes.uncertainty.length>0?(c(),W(`section`,cue,[F(`h4`,null,[n[6]||=F(`span`,{"aria-hidden":`true`},`?`,-1),K(U(z(i)(`expertTalk.uncertainty`)),1)]),F(`ul`,null,[(c(!0),W(M,null,_(e.run.result.notes.uncertainty,e=>(c(),W(`li`,{key:e},[v(T4,{text:e},null,8,[`text`])]))),128))])])):E(``,!0)])],8,iue)):E(``,!0),x.value.answer?(c(),W(`footer`,lue,[v(YT,{size:`sm`,variant:`secondary`,"data-testid":`expert-opinion-take`,title:z(i)(`expertTalk.takeHint`),onClick:n[0]||=e=>r(`take`,x.value.answer)},{default:B(()=>[v(X,{name:`pencil`,size:`sm`}),K(` `+U(z(i)(`expertTalk.takeFusion`)),1)]),_:1},8,[`title`]),v(YT,{size:`sm`,"data-testid":`expert-opinion-build`,title:z(i)(`expertTalk.buildHint`),onClick:n[1]||=e=>r(`build`,x.value.answer)},{default:B(()=>[v(X,{name:`play`,size:`sm`}),K(` `+U(z(i)(`expertTalk.buildFusion`)),1)]),_:1},8,[`title`])])):E(``,!0)],8,$le)):E(``,!0)],40,Ile)],8,Ple))}}),due=e({default:()=>H4}),H4=Y(uue,[[`__scopeId`,`data-v-7b58346d`]]),U4=R(null),W4=R(!1);function G4(e){let t=U4.value;!t||W4.value||(U4.value=null,t.resolve(e))}async function fue(){let e=U4.value;if(!(!e||W4.value)){if(!e.action){G4(!0);return}W4.value=!0;try{await e.action(),U4.value===e&&(U4.value=null),e.resolve(!0)}catch(t){U4.value===e&&(U4.value=null),e.reject(t)}finally{W4.value=!1}}}function pue(e){return W4.value?Promise.resolve(!1):(U4.value&&G4(!1),new Promise((t,n)=>{U4.value={...e,resolve:t,reject:n}}))}function K4(){return{current:U4,busy:W4,confirm:pue,settle:G4,runAction:fue}}var mue=/^(application\/pdf|image\/(png|jpe?g|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon)|video\/[\w.+-]+|audio\/[\w.+-]+)$/i,hue=/^(txt|md|markdown|log|json|ya?ml|csv|tsv|ts|mts|tsx|jsx|css|py|go|rs|java|c|h|cc|cpp|hpp|sh|zsh|sql|toml|ini|cfg|conf|vue)$/i,gue=/^(png|jpe?g|gif|webp|avif|bmp|ico)$/i,q4=`text/plain;charset=utf-8`;function _ue(e,t){let n=(t??``).toLowerCase();if(mue.test(n))return n;if(n.startsWith(`text/`))return n===`text/html`?null:q4;let r=e?.match(/\.([A-Za-z0-9]{1,8})$/)?.[1]?.toLowerCase();return r===void 0?null:hue.test(r)?q4:gue.test(r)?`image/${r===`jpg`?`jpeg`:r===`ico`?`x-icon`:r}`:r===`pdf`?`application/pdf`:null}async function J4(e,t,n){let r=_ue(t,n);if(r===null)return`unsupported`;let i=window.open(``,`_blank`);i!==null&&(i.opener=null);let a=await Q().getFileBlob(e).catch(()=>null);if(a===null)return i?.close(),`failed`;let o=URL.createObjectURL(new Blob([a],{type:r}));if(i!==null)i.location.href=o;else{let n=document.createElement(`a`);n.href=o,n.download=t??e,n.click()}return setTimeout(()=>{URL.revokeObjectURL(o)},6e4),`previewed`}function vue(e){let t=e.replaceAll(`\\`,`/`),n=``,r=t,i=!1,a=/^\/\/([^/]+\/[^/]+)(\/|$)/.exec(t);a?(n=`//${a[1].toLowerCase()}/`,r=t.slice(a[0].length-+!!a[0].endsWith(`/`)),i=!0):/^[a-zA-Z]:\//.test(t)?(n=`${t[0].toLowerCase()}:/`,r=t.slice(3),i=!0):t.startsWith(`/`)&&(n=`/`,r=t.slice(1));let o=n!==``,s=[];for(let e of r.split(`/`))!e||e===`.`||(e===`..`?s.length>0&&s.at(-1)!==`..`?s.pop():o||s.push(e):s.push(e));let c=n+s.join(`/`);return i?c.toLowerCase():c}function yue(e,t){let n=0,r=0;for(let t of e)t.oldNo!==void 0&&(n=Math.max(n,t.oldNo)),t.newNo!==void 0&&(r=Math.max(r,t.newNo));return t.map(e=>({...e,oldNo:e.oldNo===void 0?void 0:e.oldNo+n,newNo:e.newNo===void 0?void 0:e.newNo+r}))}function bue(e){let t=new Map;for(let n of _O(e)){if(n.kind!==`tool`||n.tool.status===`error`)continue;let e=Qx(n.tool.name);if(e!==`edit`&&e!==`multi_edit`&&e!==`write`)continue;let r=nO(n.tool.arg);if(!r)continue;let i=e===`write`,a=i?null:tO(n.tool),o=a?$D(a):{added:0,removed:0},s=i||a===null,c=vue(r),l=t.get(c);if(!l){t.set(c,{path:r,...o,hasWrite:i,statsIncomplete:s,diff:a});continue}l.added+=o.added,l.removed+=o.removed,l.hasWrite||=i,l.statsIncomplete||=s,l.diff!==null&&a!==null?l.diff=[...l.diff,{type:`hunk`,text:`···`},...yue(l.diff,a)]:l.diff=null}return[...t.values()]}var xue={class:`chat`},Sue={key:0,class:`chat-loading`},Cue={class:`chat-loading-text`},wue={key:1,class:`chat-empty`},Tue={key:1,class:`top-sentinel-text`},Eue={class:`u-turn`},Due=[`data-turn-id`],Oue={key:0,class:`u-atts`},kue={key:1,class:`skill-act`},Aue={class:`skill-act-head`},jue=[`aria-expanded`,`onClick`],Mue={key:0,class:`u-meta`},Nue=[`aria-label`,`onClick`],Pue=[`aria-label`,`onClick`],Fue={key:0,class:`expert-opinion-turn`},Iue=[`data-turn-id`],Lue=[`onClick`],Rue={class:`cd-view`},zue={key:1,class:`cd-label`},Bue=[`data-turn-id`],Vue={key:1,class:`msg`},Hue={key:1,class:`a-msg-ft`},Uue={key:0,class:`a-duration`},Wue=[`aria-label`,`onClick`],Gue={key:3,class:`turn-failed`,role:`alert`},Kue={class:`tf-chip`,"aria-hidden":`true`},que={class:`tf-main`},Jue={class:`tf-title`},Yue=[`title`],Xue={key:5,class:`sending-placeholder`},Zue={key:6,class:`q-stack`},Que={class:`q-head`},$ue={class:`q-title`},ede=[`onDragover`,`onDrop`],tde=[`aria-label`,`onClick`],nde={class:`u-bub q-bub`},rde=[`title`,`onDragstart`],ide=[`title`,`onClick`],ade={key:0,class:`u-text q-text`},ode={key:1,class:`q-text q-text-placeholder`},sde={key:0,class:`q-imgs`},cde={key:0,class:`q-file`},lde=[`aria-label`,`onClick`],ude={key:0,class:`open-unsupported`,role:`status`},dde=`running`,fde=2500,Y4=Y(G({__name:`ChatPane`,props:{turns:{},expertTalkRuns:{default:()=>[]},expertTalkModels:{default:()=>[]},approvals:{default:()=>[]},questions:{default:()=>[]},turnActive:{type:Boolean,default:!1},working:{type:Boolean,default:!1},fastMoon:{type:Boolean,default:!1},sessionLoading:{type:Boolean},compaction:{default:null},hasMoreMessages:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},loadingMoreError:{type:Boolean,default:!1},isFollowing:{type:Boolean,default:!1},toolDiffPanel:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},inspector:{type:Boolean,default:!1},turnFolding:{type:Boolean,default:!0},activityRunFolding:{type:Boolean,default:!0},lastTurnReason:{},turnErrorKind:{},turnErrorMessage:{},cwd:{},queued:{default:()=>[]}},emits:[`openFile`,`openMedia`,`copyConversationCopied`,`openCompaction`,`openAgent`,`detachTask`,`openToolDiff`,`openTurnDiff`,`editMessage`,`loadOlderMessages`,`unqueue`,`editQueued`,`reorderQueue`,`steerQueued`,`continueTurn`,`takeExpertTalk`,`buildExpertTalk`],setup(e,{expose:t,emit:r}){let{t:i}=J(),{confirm:a}=K4();h(()=>{for(let e of k.values())e.disconnect();k.clear(),O.clear(),Ce!==null&&(clearTimeout(Ce),Ce=null),ge!==null&&(clearTimeout(ge),ge=null),G!==null&&(clearTimeout(G),G=null),Oe!==null&&(clearTimeout(Oe),Oe=null)});let o=e,l=R(null),u=null;function d(){!l.value||typeof IntersectionObserver>`u`||(u?.disconnect(),u=new IntersectionObserver(e=>{e[0]?.isIntersecting&&o.hasMoreMessages&&!o.loadingMore&&!o.loadingMoreError&&!o.sessionLoading&&!o.isFollowing&&S(`loadOlderMessages`)},{root:null,rootMargin:`200px 0px 0px 0px`,threshold:0}),u.observe(l.value))}p(d),h(()=>{u?.disconnect(),u=null}),s(()=>[o.hasMoreMessages,o.loadingMore,o.loadingMoreError],()=>{n().then(d)});let f=L(()=>{if(!o.turnActive||o.turns.length===0)return null;let e=o.turns.at(-1);return e.role===`assistant`?e.id:null}),m=L(()=>o.working),g=new WeakMap;function y(e){let t=g.get(e);if(t?.activityRunFolding===o.activityRunFolding&&t.turnFolding===o.turnFolding)return t.model;let n=Xae(e,o.activityRunFolding),{folded:r,visible:i}=Zae(n,o.turnFolding),a={all:n,folded:r,visible:i,changes:bue(e)};return g.set(e,{activityRunFolding:o.activityRunFolding,turnFolding:o.turnFolding,model:a}),a}let b=L(()=>{let e=new Map;for(let t of o.turns)t.role===`assistant`&&e.set(t.id,y(t));return e}),x=L(()=>{let e=o.turns.at(-1);if(e?.role!==`assistant`)return i(`conversation.requesting`);let t=b.value.get(e.id)?.all.some(e=>e.kind===`text`?e.text.trim().length>0:!0);return i(t?`conversation.working`:`conversation.requesting`)}),S=r,C=L(()=>{let e=new Map;for(let t of o.expertTalkRuns)e.set(t.promptId,t),e.set(`t${t.turnId}`,t);return e});function w(e){return e.promptId===void 0?void 0:C.value.get(e.promptId)}let T=R({}),D=R({}),O=new Map,k=new Map;function A(e){let t=O.get(e)?.querySelector(`.u-text`);if(!t)return;let n=Number.parseFloat(getComputedStyle(t).lineHeight)||24;D.value[e]=t.scrollHeight>n*10+1}function j(e,t){let r=t instanceof HTMLElement?t:null;if(!r){k.get(e)?.disconnect(),k.delete(e),O.delete(e);return}if(O.get(e)!==r){if(k.get(e)?.disconnect(),O.set(e,r),typeof ResizeObserver<`u`){let t=new ResizeObserver(()=>A(e));t.observe(r.querySelector(`.u-text`)??r),k.set(e,t)}n(()=>A(e))}}function N(e){T.value[e]=!T.value[e]}let ee=R(null),I=R(null);function te(e){return(e.attachments?.length??0)>0}function ne(e){S(`editQueued`,e)}function re(e,t){if(ee.value=e,!t.dataTransfer)return;t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e));let n=t.currentTarget?.closest(`.q-turn`);n&&t.dataTransfer.setDragImage(n,24,24)}function ie(e,t){if(ee.value===null)return;t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=`move`);let n=t.currentTarget.getBoundingClientRect();I.value={index:e,position:t.clientY{for(let e=o.turns.length-1;e>=0;e--)if(o.turns[e].role===`user`)return o.turns[e].id;return null});function ce(e){return!o.readOnly&&e.role===`user`&&e.id===se.value&&!o.working&&!e.pluginCommand&&!(e.skillActivation&&!ise(e.skillActivation,{revivePill:!1}))}function le(e){return e.skillActivation?ase(e.skillActivation):e.pluginCommand?e.pluginCommand.args||null:e.text||null}function ue(e){let t=e.compaction,n=t?.trigger===`auto`?i(`conversation.compactedAuto`):i(`conversation.compactedPlain`);return typeof t?.tokensBefore==`number`&&typeof t?.tokensAfter==`number`?n+i(`conversation.compactedTokens`,{before:mO(t.tokensBefore),after:mO(t.tokensAfter)}):n}let de=R(null),fe=R(null),G=null;async function pe(e){await a({title:i(`conversation.undo`),message:i(`conversation.undoConfirm`),variant:`primary`})&&me(e)}function me(e){fe.value===null&&(fe.value=e.id,S(`editMessage`,{text:e.skillActivation?d4(e.skillActivation,{revivePill:!1})??e.text:e.text,attachments:e.attachments}),G=setTimeout(()=>{G=null,fe.value=null},fde))}s(()=>o.turns,e=>{fe.value!==null&&(e.some(e=>e.id===fe.value)||(fe.value=null,G!==null&&(clearTimeout(G),G=null)))},{flush:`post`});let he=R(!1),ge=null;function _e(){if(o.turns.length===0)return;let e=[];for(let t of o.turns){if(t.role===`compaction`||t.role===`cron`)continue;let n=t.role===`user`?`User`:`Assistant`,r=$ae(t);r.trim()&&e.push(`**${n}**\n\n${r}`)}Wi(e.join(` +`),s=o.search(/^<\w/m);s!==-1&&(o=o.slice(0,s));let c=Yse.exec(t),l=c?k4(c[1]??``):void 0,u=l?.path?{path:l.path,bytes:A4(l.bytes)}:void 0,d=Xse.exec(t),f=d?k4(d[1]??``):void 0,p=(d?.[2]??``).replace(/^\n/,``),m=p.indexOf(` +`),h=d?{text:O4(m===-1?``:p.slice(m+1)).replace(/\n$/,``),bytes:A4(f?.bytes),totalBytes:A4(f?.total_bytes),truncated:f?.truncated===`true`?!0:f?.truncated===`false`?!1:void 0}:void 0;return{id:r.id??``,category:r.category??``,type:r.type??``,sourceKind:r.source_kind??``,sourceId:r.source_id??``,agentId:r.agent_id,title:O4(i),severity:a,body:O4(o.trim()),outputFile:u,outputPreview:h,raw:n}}function j4(e){if(!e.includes(`{g=null,m.value=null},1200))}return h(()=>{g!==null&&clearTimeout(g)}),(e,r)=>(c(),W(`div`,nce,[(c(!0),W(M,null,_(t.items,(e,t)=>(c(),W(`div`,{key:i(e,t),class:V([`ntn`,z(tce)(e)]),role:`status`},[F(`div`,rce,[v(X,{name:a(e),size:`sm`,class:`ntn-ico`,"aria-hidden":`true`},null,8,[`name`]),F(`span`,ice,U(u(e)),1)]),F(`div`,ace,[e.title?(c(),W(`div`,oce,U(e.title),1)):E(``,!0),e.body?(c(),W(`div`,sce,U(e.body),1)):E(``,!0),e.outputFile?(c(),W(`div`,cce,[v(X,{class:`ntn-out-ic`,name:`file-text`,size:`sm`,"aria-hidden":`true`}),F(`span`,{class:`ntn-out-path`,title:e.outputFile.path},U(e.outputFile.path),9,lce),e.outputFile.bytes===void 0?E(``,!0):(c(),W(`span`,uce,U(d(e.outputFile.bytes)),1)),v(pD,{"data-testid":`notification-copy-path`,variant:`secondary`,size:`sm`,type:`button`,onClick:n=>y(e.outputFile.path,i(e,t))},{default:B(()=>[v(X,{name:`copy`,size:`sm`,"aria-hidden":`true`}),K(` `+U(m.value===i(e,t)?z(n)(`conversation.notification.copied`):z(n)(`conversation.notification.copyPath`)),1)]),_:2},1032,[`onClick`])])):E(``,!0),p(e)?(c(),W(`div`,dce,[f(e)?(c(),W(`div`,fce,U(f(e)),1)):E(``,!0),e.outputPreview?.text?(c(),W(`pre`,pce,U(e.outputPreview.text),1)):E(``,!0)])):E(``,!0),F(`details`,mce,[F(`summary`,null,[v(X,{class:`ntn-raw-car`,name:`chevron-right`,size:`sm`,"aria-hidden":`true`}),F(`span`,null,U(z(n)(`conversation.notification.rawPayload`)),1)]),F(`div`,hce,[F(`div`,gce,[F(`span`,_ce,U(z(n)(`conversation.notification.fields.type`)),1),F(`span`,vce,U(e.type),1),F(`span`,yce,U(z(n)(`conversation.notification.fields.source`)),1),F(`span`,bce,U(e.sourceKind)+` · `+U(e.sourceId),1),F(`span`,xce,U(z(n)(`conversation.notification.fields.severity`)),1),F(`span`,Sce,U(e.severity||`—`),1)]),F(`pre`,Cce,U(e.raw),1)])])]),F(`div`,wce,[e.createdAt?(c(),P(T4,{key:0,time:e.createdAt},null,8,[`time`])):E(``,!0)])],2))),128))]))}}),[[`__scopeId`,`data-v-6e055dc6`]]),Tce=[`src`,`controls`,`muted`],Ece=[`aria-label`],Dce=[`src`,`alt`],Oce=[`aria-label`],P4=G({__name:`AuthMedia`,props:{url:{},kind:{},alt:{},fileId:{},mediaClass:{default:`u-img`},controls:{type:Boolean,default:!0},muted:{type:Boolean,default:!1}},setup(e){let t=e,n=R(t.fileId?``:t.url),r=R(null),i=R(!t.fileId),a=null,o=0,l=!1,u=null;function d(){a!==null&&(URL.revokeObjectURL(a),a=null)}async function f(){let e=++o;if(d(),!t.fileId){n.value=t.url;return}if(i.value)try{let r=await Q().getFileBlob(t.fileId),i=URL.createObjectURL(r);if(l||e!==o){URL.revokeObjectURL(i);return}a=i,n.value=a}catch{if(l||e!==o)return;n.value=t.url}}return s(()=>[t.fileId,t.url,i.value],f,{immediate:!0}),p(()=>{typeof IntersectionObserver==`function`&&r.value?(u=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(i.value=!0,u?.disconnect(),u=null)},{rootMargin:`200px`}),u.observe(r.value)):i.value=!0}),ne(()=>{l=!0,u?.disconnect(),u=null,d()}),(t,i)=>e.kind===`video`?(c(),W(M,{key:0},[n.value?(c(),W(`video`,{key:0,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),src:n.value,controls:e.controls,muted:e.muted,playsinline:``,preload:`metadata`},null,10,Tce)):(c(),W(`span`,{key:1,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),role:`status`,"aria-label":e.alt||``},null,10,Ece))],64)):n.value?(c(),W(`img`,{key:1,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),src:n.value,alt:e.alt||``,loading:`lazy`},null,10,Dce)):(c(),W(`span`,{key:2,ref_key:`mediaEl`,ref:r,class:V(e.mediaClass),role:`img`,"aria-label":e.alt||``},null,10,Oce))}}),kce=[`title`,`data-kind`,`draggable`],Ace=[`aria-label`,`aria-haspopup`,`aria-expanded`,`aria-keyshortcuts`],jce={class:`att-tile`},Mce={key:4,class:`att-ord`,"aria-hidden":`true`},Nce={class:`att-name`},Pce={key:1,class:`att-err`},Fce=[`aria-label`],Ice=[`aria-label`],Lce=[`data-side`,`aria-label`],Rce={class:`att-tip-preview`},zce={key:1,class:`att-tip-placeholder`},Bce={class:`att-tip-meta`},Vce={key:0},Hce={key:0,class:`att-tip-error`},Uce={class:`att-tip-foot`},F4=Y(G({__name:`AttachmentChip`,props:{kind:{},name:{},url:{},fileId:{},mediaType:{},size:{},ordinal:{},uploading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},removeLabel:{},mentionable:{type:Boolean,default:!1},mentionLabel:{},reorderable:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:[`activate`,`remove`,`mention`,`reorderStep`,`dragStart`,`dragOver`,`drop`,`dragEnd`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null),l=R(null),u=R(!1),d=R(`top`),f=R({}),p=null,m=L(()=>{let e=r.name?.match(/\.([A-Za-z0-9]{1,8})$/)?.[1]??r.mediaType?.split(`/`)[1]?.split(`+`)[0];return e?e.toUpperCase():void 0}),g=L(()=>{let e=m.value??``;return/^(txt|md|doc|docx|rtf|log)$/i.test(e)?`file-text`:`file`}),_=L(()=>r.name?r.name:r.kind===`image`?a(`composer.attachmentImage`):r.kind===`video`?a(`composer.attachmentVideo`):a(`composer.attachmentFile`));function y(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}let b=L(()=>{let e=[_.value];return r.size!==void 0&&e.push(y(r.size)),e.join(` · `)}),x=L(()=>r.kind!==`file`),S=L(()=>x.value&&(!!r.url||!!r.fileId)),C=L(()=>r.error?a(`mention.stateUploadFailed`):r.uploading?a(`mention.stateUploading`):a(`mention.stateUploaded`));function w(){let e=o.value,t=l.value;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.offsetWidth,i=t.offsetHeight,a=n.top-i-8,s=`top`;a<8&&(a=n.bottom+8,s=`bottom`),a=Math.min(Math.max(a,8),Math.max(8,window.innerHeight-i-8));let c=Math.min(Math.max(n.left+n.width/2-r/2,8),Math.max(8,window.innerWidth-r-8)),u=Math.min(Math.max(n.left+n.width/2-c,10),Math.max(10,r-10));d.value=s,f.value={top:`${Math.round(a)}px`,left:`${Math.round(c)}px`,"--tip-caret-x":`${Math.round(u)}px`}}function T(){x.value&&(p!==null&&(clearTimeout(p),p=null),u.value=!0,n(w))}function D(){p!==null&&clearTimeout(p),p=setTimeout(()=>{u.value=!1,p=null},120)}function O(){p!==null&&clearTimeout(p),p=null,u.value=!1}function k(e){if(!(!r.reorderable||!e.altKey)){if(e.key===`ArrowLeft`){e.preventDefault(),i(`reorderStep`,-1);return}e.key===`ArrowRight`&&(e.preventDefault(),i(`reorderStep`,1))}}function A(e){if(!r.reorderable||r.uploading){e.preventDefault();return}u.value=!1,i(`dragStart`,e)}function j(e){r.reorderable&&(e.preventDefault(),i(`dragOver`,e))}function N(e){r.reorderable&&(e.preventDefault(),i(`drop`,e))}return s(u,e=>{let t=e?`addEventListener`:`removeEventListener`;window[t](`resize`,w),window[t](`scroll`,w,!0)}),h(()=>{O(),window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,w,!0)}),(t,n)=>(c(),W(M,null,[F(`span`,{ref_key:`anchorRef`,ref:o,class:V([`att-chip`,{"is-error":e.error,uploading:e.uploading,"is-reorderable":e.reorderable,"is-dragging":e.dragging}]),title:b.value,"data-kind":e.kind,draggable:e.reorderable&&!e.uploading,onMouseenter:T,onMouseleave:D,onFocusin:T,onFocusout:D,onKeydown:ie(O,[`esc`]),onDragstart:A,onDragover:j,onDrop:N,onDragend:n[3]||=e=>i(`dragEnd`)},[F(`button`,{type:`button`,class:`att-activate`,"aria-label":b.value,"aria-haspopup":x.value?`dialog`:void 0,"aria-expanded":x.value?u.value:void 0,"aria-keyshortcuts":e.reorderable?`Alt+ArrowLeft Alt+ArrowRight`:void 0,onClick:n[0]||=e=>i(`activate`),onKeydown:k},[F(`span`,jce,[e.kind===`image`&&e.url?(c(),P(P4,{key:0,url:e.url,kind:`image`,alt:e.name,"file-id":e.fileId,"media-class":`att-thumb`},null,8,[`url`,`alt`,`file-id`])):e.kind===`video`?(c(),P(X,{key:1,name:`play`,size:`sm`})):e.kind===`image`?(c(),P(X,{key:2,name:`image`,size:`sm`})):(c(),P(X,{key:3,name:g.value,size:`sm`},null,8,[`name`])),e.ordinal===void 0?E(``,!0):(c(),W(`span`,Mce,U(e.ordinal),1))]),F(`span`,Nce,U(_.value),1),e.uploading?(c(),P(op,{key:0,size:`sm`,label:z(a)(`composer.uploading`)},null,8,[`label`])):e.error?(c(),W(`span`,Pce,[v(X,{name:`info`,size:`sm`})])):E(``,!0)],40,Ace),e.mentionable?(c(),P(Sp,{key:0,text:e.mentionLabel??z(a)(`composer.mentionNamed`,{name:_.value})},{default:B(()=>[F(`button`,{type:`button`,class:`att-mention`,"aria-label":e.mentionLabel??z(a)(`composer.mentionNamed`,{name:_.value}),onClick:n[1]||=e=>i(`mention`)},[...n[5]||=[F(`span`,{class:`att-mention-glyph`,"aria-hidden":`true`},`@`,-1)]],8,Fce)]),_:1},8,[`text`])):E(``,!0),e.removable?(c(),P(Sp,{key:1,text:e.removeLabel??z(a)(`composer.remove`)},{default:B(()=>[F(`button`,{type:`button`,class:`att-rm`,"aria-label":e.removeLabel??z(a)(`composer.remove`),onClick:n[2]||=e=>i(`remove`)},[v(X,{name:`close`,size:`sm`})],8,Ice)]),_:1},8,[`text`])):E(``,!0)],42,kce),(c(),P(ee,{to:`body`},[u.value&&x.value?(c(),W(`div`,{key:0,ref_key:`tipRef`,ref:l,class:`att-tip`,"data-side":d.value,style:ae(f.value),role:`dialog`,"aria-label":b.value,onMouseenter:T,onMouseleave:D,onFocusin:T,onFocusout:D,onKeydown:ie(O,[`esc`])},[n[6]||=F(`span`,{class:`att-tip-caret`,"aria-hidden":`true`},null,-1),F(`div`,Rce,[S.value?(c(),P(P4,{key:0,url:e.url??``,kind:e.kind===`video`?`video`:`image`,alt:_.value,"file-id":e.fileId,"media-class":`att-tip-media`,controls:e.kind===`video`,muted:``},null,8,[`url`,`kind`,`alt`,`file-id`,`controls`])):(c(),W(`span`,zce,[e.uploading?(c(),P(op,{key:0,size:`sm`,label:z(a)(`mention.mediaPreviewUploading`)},null,8,[`label`])):(c(),P(X,{key:1,name:e.kind===`video`?`play`:`image`},null,8,[`name`])),F(`span`,null,U(e.uploading?z(a)(`mention.mediaPreviewUploading`):z(a)(`mention.mediaPreviewUnavailable`)),1)]))]),F(`div`,Bce,[v(X,{name:e.kind===`video`?`play`:`image`,size:`sm`},null,8,[`name`]),F(`strong`,null,U(_.value),1),e.size===void 0?E(``,!0):(c(),W(`span`,Vce,`· `+U(y(e.size)),1))]),e.error?(c(),W(`div`,Hce,U(z(a)(`mention.attachmentUploadFailed`)),1)):E(``,!0),F(`div`,Uce,[F(`span`,{class:V([`att-tip-state`,{danger:e.error}])},[e.uploading?(c(),P(op,{key:0,size:`sm`})):E(``,!0),K(` `+U(C.value),1)],2),S.value?(c(),W(`button`,{key:0,type:`button`,class:`att-tip-open`,onClick:n[4]||=e=>i(`activate`)},[v(X,{name:`expand`,size:`sm`}),F(`span`,null,U(z(a)(`mention.viewFullscreen`)),1)])):E(``,!0)])],44,Lce)):E(``,!0)]))],64))}}),[[`__scopeId`,`data-v-e8af44e9`]]),Wce=[`data-mention-kind`,`data-mention-name`,`data-mention-path`,`tabindex`,`role`,`onClick`,`onKeydown`],Gce=[`innerHTML`],Kce={class:`mention-pill-name`},I4=G({__name:`ComposerText`,props:{text:{},interactive:{type:Boolean,default:!0},openFile:{}},setup(e){let t=e,n=R(null),r=L(()=>c4(t.text));function i(e,n){n.kind!==`file`||!t.interactive||!t.openFile||(e.preventDefault(),e.stopPropagation(),t.openFile({path:n.path}))}function a(e){let t=window.getSelection(),r=n.value;if(!t||t.rangeCount===0||!r||!e.clipboardData)return;let i=t.getRangeAt(0);if(!i.intersectsNode(r))return;let a=i.cloneContents();for(let e of a.querySelectorAll(`.mention-pill`)){let{mentionKind:t,mentionName:n,mentionPath:r}=e.dataset;t!==`file`&&t!==`folder`&&t!==`skill`||n===void 0||r===void 0||e.replaceWith(document.createTextNode(s4({kind:t,name:n,path:r})))}e.clipboardData.setData(`text/plain`,a.textContent??``),e.preventDefault()}return(t,o)=>(c(),W(`span`,{ref_key:`root`,ref:n,class:`composer-text`,onCopy:a},[(c(!0),W(M,null,_(r.value,(t,n)=>(c(),W(M,{key:n},[t.type===`text`?(c(),W(M,{key:0},[K(U(t.value),1)],64)):(c(),W(`span`,{key:1,class:V([`mention-pill`,`mention-${t.attrs.kind}`]),"data-mention-kind":t.attrs.kind,"data-mention-name":t.attrs.name,"data-mention-path":t.attrs.path,tabindex:t.attrs.kind===`file`&&e.interactive&&e.openFile?0:void 0,role:t.attrs.kind===`file`&&e.interactive&&e.openFile?`button`:void 0,onClick:e=>i(e,t.attrs),onKeydown:[ie(e=>i(e,t.attrs),[`enter`]),ie(e=>i(e,t.attrs),[`space`])]},[F(`span`,{class:`mention-pill-icon`,"aria-hidden":`true`,innerHTML:t.attrs.kind===`skill`?z(Of)(`sparkles`,`sm`):z(kf)(t.attrs.path,t.attrs.name)},null,8,Gce),F(`span`,Kce,U(z(f4)(t.attrs.name)),1)],42,Wce))],64))),128))],544))}}),qce=[`aria-expanded`,`title`],Jce={class:`tf-sum`},Yce=[`inert`],Xce={class:`tf-body-inner`},Zce={key:1,class:`msg`},Qce=Y(G({__name:`TurnFold`,props:{items:{},live:{type:Boolean,default:!1},parked:{type:Boolean,default:!1},seedMs:{default:void 0},createdMs:{default:void 0},endedMs:{default:void 0},streamingTailIndex:{default:null},durationMs:{default:void 0},toolDiffPanel:{type:Boolean,default:!1},mobile:{type:Boolean,default:!1}},emits:[`openMedia`,`openFile`,`openToolDiff`,`openAgent`,`detach`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=L(()=>r.streamingTailIndex!==null),l=L(()=>r.live?r.parked?`parked`:`live`:`settled`),u=R(!1),d=L(()=>o.value||u.value),f=R(d.value),p=R(d.value),g=null;s(d,e=>{if(e){if(g!==null&&(clearTimeout(g),g=null),f.value){p.value=!0;return}f.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{p.value=!0})});return}p.value=!1,g=setTimeout(()=>{g=null,f.value=!1},200)});let y=m(`pinScroll`,()=>void 0),b=R(null);function x(){u.value=!u.value,n(()=>{let e=b.value;e&&y(e)})}let S=R(Date.now()),C=null;function w(){C!==null&&(clearInterval(C),C=null)}s(l,(e,t)=>{e===`settled`?w():(S.value=Date.now(),C===null&&(C=setInterval(()=>{S.value=Date.now()},1e3))),t===`live`&&e!==`live`&&(u.value=!1)},{immediate:!0}),h(()=>{w(),g!==null&&clearTimeout(g)});let T=L(()=>r.seedMs===void 0?r.createdMs:r.createdMs===void 0?r.seedMs:Math.min(r.seedMs,r.createdMs)),D=L(()=>{if(l.value===`settled`)return r.durationMs===void 0?T.value===void 0||r.endedMs===void 0?void 0:Math.max(0,r.endedMs-T.value):Math.max(0,r.durationMs);if(T.value!==void 0)return Math.max(0,S.value-T.value)}),O=L(()=>{let e=D.value;if(e===void 0)return a(`conversation.fold.workedUnknown`);let t=xO(e);return t?a(`conversation.fold.worked`,{duration:t}):a(`conversation.fold.workedUnknown`)});function k(e){return wO(e)?!1:r.streamingTailIndex!==null&&`sourceIndex`in e&&e.sourceIndex===r.streamingTailIndex}function A(e){if(r.streamingTailIndex===null)return!1;let t=e.items.at(-1);return t!==void 0&&wO(t)?!1:t!==void 0&&t.sourceIndex===r.streamingTailIndex}return(t,n)=>e.items.length>0?(c(),W(`div`,{key:0,class:V([`turn-fold`,{open:d.value,streaming:o.value}])},[o.value?E(``,!0):(c(),W(`button`,{key:0,ref_key:`headEl`,ref:b,type:`button`,class:`tf-head`,"aria-expanded":u.value,title:O.value,onClick:x},[F(`span`,Jce,U(O.value),1),v(X,{class:`tf-car`,name:`chevron-right`,size:`sm`,"aria-hidden":`true`})],8,qce)),f.value?(c(),W(`div`,{key:1,class:V([`tf-body`,{open:p.value}]),inert:!d.value},[F(`div`,Xce,[(c(!0),W(M,null,_(e.items,(t,r)=>(c(),W(M,{key:z(DO)(t,r)},[t.kind===`thinking`?(c(),P(AO,{key:0,text:t.thinking,mobile:e.mobile,streaming:k(t),"started-at-ms":z(CO)(t.startedAt),"duration-ms":t.durationMs},null,8,[`text`,`mobile`,`streaming`,`started-at-ms`,`duration-ms`])):t.kind===`text`&&t.text?(c(),W(`div`,Zce,[v(w4,{text:t.text,streaming:k(t),"open-file":e=>i(`openFile`,e)},null,8,[`text`,`streaming`,`open-file`])])):t.kind===`activity-run`?(c(),P(jO,{key:2,items:t.items,mobile:e.mobile,streaming:A(t),"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[0]||=e=>i(`openMedia`,e),onOpenFile:n[1]||=e=>i(`openFile`,e),onOpenToolDiff:n[2]||=e=>i(`openToolDiff`,e),onOpenAgent:n[3]||=e=>i(`openAgent`,e),onDetach:n[4]||=e=>i(`detach`,e)},null,8,[`items`,`mobile`,`streaming`,`tool-diff-panel`])):t.kind===`tool`?(c(),P(vO,{key:3,tool:t.tool,mobile:e.mobile,"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[5]||=e=>i(`openMedia`,e),onOpenFile:n[6]||=e=>i(`openFile`,e),onOpenToolDiff:n[7]||=e=>i(`openToolDiff`,e),onOpenAgent:n[8]||=e=>i(`openAgent`,e),onDetach:n[9]||=e=>i(`detach`,e)},null,8,[`tool`,`mobile`,`tool-diff-panel`])):t.kind===`notification`?(c(),P(N4,{key:4,items:t.items},null,8,[`items`])):E(``,!0)],64))),128))])],10,Yce)):E(``,!0)],2)):E(``,!0)}}),[[`__scopeId`,`data-v-331ba726`]]),$ce={key:0,class:`ui-card__head`},ele={class:`ui-card__body`},tle={key:1,class:`ui-card__foot`},L4=Y(G({__name:`Card`,props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-card`,{"is-elevated":e.elevated}])},[t.$slots.head?(c(),W(`div`,$ce,[me(t.$slots,`head`,{},void 0,!0)])):E(``,!0),F(`div`,ele,[me(t.$slots,`default`,{},void 0,!0)]),t.$slots.foot?(c(),W(`div`,tle,[me(t.$slots,`foot`,{},void 0,!0)])):E(``,!0)],2))}}),[[`__scopeId`,`data-v-d2cab471`]]),nle={class:`tf-ic`},rle={class:`tf-title`},ile={key:0,class:`tf-stats`},ale={key:0,class:`tf-add`},ole={key:1,class:`tf-del`},sle={class:`diffbar`,"aria-hidden":`true`},cle={class:`tf-list`},lle=[`innerHTML`],ule={class:`tf-dir`},dle={class:`tf-base`},fle={key:0,class:`tf-stats`},ple={key:0,class:`tf-add`},mle={key:1,class:`tf-del`},hle=Y(G({__name:`TurnFilesSummary`,props:{changes:{},cwd:{},interactive:{type:Boolean,default:!0}},emits:[`openDiff`,`openFile`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=ue(!1),a=L(()=>i.value?e.changes:e.changes.slice(0,3)),o=L(()=>Math.max(0,e.changes.length-3)),s=L(()=>e.changes.reduce((e,t)=>e+t.added,0)),l=L(()=>e.changes.reduce((e,t)=>e+t.removed,0)),u=L(()=>e.changes.every(e=>!e.statsIncomplete)),d=L(()=>s.value+l.value),f=L(()=>d.value===0?1:s.value),p=L(()=>d.value===0?1:l.value);function m(t){if(!e.cwd)return t;let n=e.cwd.replaceAll(`\\`,`/`).replace(/\/$/,``),r=t.replaceAll(`\\`,`/`);return r.startsWith(`${n}/`)?r.slice(n.length+1):t}function h(e){let t=m(e).replaceAll(`\\`,`/`),n=t.lastIndexOf(`/`);return n<0?{dir:``,base:t}:{dir:t.slice(0,n+1),base:t.slice(n+1)}}function g(t){e.interactive&&(t.hasWrite?n(`openFile`,{path:t.path}):n(`openDiff`,t))}return(t,n)=>(c(),P(L4,{class:`turn-files`},pe({head:B(()=>[F(`span`,nle,[v(X,{name:`pencil`,size:`sm`})]),F(`span`,rle,U(z(r)(e.changes.length===1?`conversation.turnFiles.titleOne`:`conversation.turnFiles.titleOther`,{number:e.changes.length})),1),u.value&&d.value>0?(c(),W(`span`,ile,[s.value>0?(c(),W(`span`,ale,`+`+U(s.value),1)):E(``,!0),l.value>0?(c(),W(`span`,ole,`−`+U(l.value),1)):E(``,!0),F(`span`,sle,[F(`span`,{class:`seg-add`,style:ae({flexGrow:f.value})},null,4),F(`span`,{class:`seg-del`,style:ae({flexGrow:p.value})},null,4)])])):E(``,!0)]),default:B(()=>[F(`ul`,cle,[(c(!0),W(M,null,_(a.value,t=>(c(),W(`li`,{key:t.path,class:`tf-row`},[(c(),P(x(e.interactive?`button`:`span`),{type:e.interactive?`button`:void 0,class:`tf-file`,onClick:e=>g(t)},{default:B(()=>[F(`span`,{class:`tf-ficon`,"aria-hidden":`true`,innerHTML:z(kf)(t.path)},null,8,lle),F(`span`,ule,U(h(t.path).dir),1),F(`span`,dle,U(h(t.path).base),1)]),_:2},1032,[`type`,`onClick`])),!t.statsIncomplete&&(t.added>0||t.removed>0)?(c(),W(`span`,fle,[t.added>0?(c(),W(`span`,ple,`+`+U(t.added),1)):E(``,!0),t.removed>0?(c(),W(`span`,mle,`−`+U(t.removed),1)):E(``,!0)])):E(``,!0)]))),128))])]),_:2},[o.value>0?{name:`foot`,fn:B(()=>[v(pD,{class:`tf-more`,variant:`ghost`,size:`sm`,onClick:n[0]||=e=>i.value=!i.value},{default:B(()=>[v(X,{class:V([`tf-more-car`,{open:i.value}]),name:`chevron-down`,size:`sm`},null,8,[`class`]),K(` `+U(i.value?z(r)(`conversation.turnFiles.showLess`):z(r)(o.value===1?`conversation.turnFiles.moreOne`:`conversation.turnFiles.more`,{number:o.value})),1)]),_:1})]),key:`0`}:void 0]),1024))}}),[[`__scopeId`,`data-v-11486090`]]),gle=[`src`],_le=6,vle=300,yle=6,ble=250,xle=Y(G({__name:`MascotSprite`,props:{state:{},size:{default:48}},setup(e){let t=_le*vle,n=yle*ble,r=e,i=R(`laptop`),a,o=L(()=>{let e=r.size;return{width:`${e}px`,height:`${e*208/192}px`}}),l=L(()=>r.state===`failed`?`/brand/mascot-failed.png`:r.state===`waiting`?`/brand/mascot-idle.png`:`/brand/mascot-${i.value}.png`);function u(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function d(){a!==void 0&&(clearTimeout(a),a=void 0)}function f(){if(d(),r.state!==`running`||u())return;let e=i.value===`laptop`?t:n;a=setTimeout(()=>{a=void 0,i.value=i.value===`laptop`?`review`:`laptop`,f()},e)}return p(f),h(d),s(()=>r.state,e=>{d(),i.value=`laptop`,e===`running`&&f()}),(e,t)=>(c(),W(`img`,{"aria-hidden":`true`,class:`mascot-apng`,src:l.value,style:ae(o.value)},null,12,gle))}}),[[`__scopeId`,`data-v-bee6ba86`]]),Sle={class:`working-indicator`,role:`status`},Cle={class:`wi-mascot`,"aria-hidden":`true`},wle=Y(G({__name:`WorkingIndicator`,props:{label:{},state:{}},setup(e){return(t,n)=>(c(),W(`div`,Sle,[F(`span`,Cle,[v(xle,{state:e.state,size:40},null,8,[`state`])]),F(`span`,{class:V([`wi-label`,{"ui-shimmer":e.state===`running`}])},U(e.label),3)]))}}),[[`__scopeId`,`data-v-c98397bf`]]),Tle=`"answer":"`;function Ele(e){if(e===void 0)return;let t=e.trimStart();if(!t.startsWith(`{`))return;let n=t.indexOf(Tle);if(n===-1)return``;let r=n+10,i=``;for(;r=t.length)break;let e=t.slice(r,r+2);if(e===`\\u`){if(r+6>t.length)break;i+=t.slice(r,r+6),r+=6;continue}i+=e,r+=2;continue}i+=e,r+=1}try{return JSON.parse(`"${i}"`)}catch{return i}}var R4=R(Yi(qi.discussionReasoning)!==`false`),Dle=fe(R4);function Ole(e){R4.value=e,Xi(qi.discussionReasoning,String(e))}var kle={showReasoning:Dle,setShowReasoning:Ole};function z4(){return kle}var Ale={class:`expert-talk__artifact-body`},jle={class:`expert-talk__thinking-head`},Mle={class:`expert-talk__thinking-label`},Nle=[`aria-expanded`],Ple={key:0,class:`expert-talk__thinking-full`},Fle={key:1,class:`expert-talk__thinking-preview`},Ile={key:2,class:`expert-talk__thinking-preview`},Lle=[`title`],Rle={class:`expert-talk__tools-breakdown`},zle={key:2,class:`expert-talk__artifact-text`},Ble={key:3},Vle=2,B4=Y(G({__name:`ExpertTalkArtifactBody`,props:{artifact:{},state:{},text:{}},setup(e){let t=e,{t:n}=J(),{showReasoning:r}=z4(),i=L(()=>t.state===`running`),a=L(()=>t.artifact?.thinking?.trim()??``),o=L(()=>r.value&&(a.value.length>0||i.value));function l(e){return e.replaceAll(/^#{1,6}\s+/gm,``).replaceAll(/[*_`]+/g,``).replaceAll(/\s+/g,` `).trim()}let u=L(()=>(l(a.value).match(/[^.!?]+[.!?]+["')\]]*|[^.!?]+$/g)??[]).slice(0,Vle).map(e=>e.trim()).join(` `)),d=L(()=>l(a.value).length>u.value.length),f=R(!1);s(()=>t.artifact?.stage,()=>{f.value=!1});let p=L(()=>{let e=t.artifact?.tools??[];if(e.length===0)return;let r=new Map;for(let t of e){let e=t.name??n(`expertTalk.tool`);r.set(e,(r.get(e)??0)+1)}let i=Array.from(r.entries()).toSorted((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>t>1?`${e} ×${t}`:e).join(` · `);return{total:e.length,breakdown:i}}),m=L(()=>t.text??t.artifact?.text);return(t,r)=>(c(),W(`div`,Ale,[o.value?(c(),W(`section`,{key:0,class:V([`expert-talk__thinking`,{"is-expanded":f.value}])},[F(`header`,jle,[F(`span`,Mle,[r[1]||=F(`span`,{"aria-hidden":`true`},`▹`,-1),K(` `+U(z(n)(`expertTalk.thinking`)),1)]),d.value?(c(),W(`button`,{key:0,type:`button`,class:`expert-talk__thinking-toggle`,"aria-expanded":f.value,onClick:r[0]||=e=>f.value=!f.value},[K(U(f.value?z(n)(`expertTalk.reasoningLess`):z(n)(`expertTalk.reasoningMore`))+` `,1),v(X,{name:f.value?`chevron-down`:`chevron-right`,size:`sm`},null,8,[`name`])],8,Nle)):E(``,!0)]),f.value?(c(),W(`div`,Ple,[v(w4,{text:a.value,streaming:i.value},null,8,[`text`,`streaming`])])):u.value?(c(),W(`p`,Fle,U(u.value),1)):(c(),W(`p`,Ile,U(z(n)(`expertTalk.thinkingPending`)),1))],2)):E(``,!0),p.value?(c(),W(`p`,{key:1,class:`expert-talk__tools`,title:p.value.breakdown},[r[2]||=F(`span`,{"aria-hidden":`true`},`▸`,-1),K(` `+U(z(n)(`expertTalk.toolSummary`,{count:p.value.total}))+` `,1),F(`span`,Rle,U(p.value.breakdown),1)],8,Lle)):E(``,!0),m.value?(c(),W(`div`,zle,[v(w4,{text:m.value,streaming:i.value},null,8,[`text`,`streaming`])])):i.value?E(``,!0):(c(),W(`p`,Ble,U(e.artifact?.error??z(n)(`expertTalk.artifactState.${e.state}`)),1))]))}}),[[`__scopeId`,`data-v-462ed3a1`]]),Hle=[`aria-label`],Ule={class:`expert-talk__sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},Wle=[`open`],Gle={class:`expert-opinion-exchange__top`},Kle={class:`expert-opinion-exchange__title`},qle={class:`expert-opinion-exchange__phases`},Jle=[`data-state`],Yle={class:`expert-talk__run-metrics`},Xle={key:0,class:`expert-opinion-exchange__error`,role:`status`},Zle={key:1,class:`expert-opinion-exchange__error`,role:`alert`},Qle={class:`expert-talk__agent-grid`},$le=[`aria-label`],eue={class:`expert-talk__agent-head`},tue={class:`expert-talk__agent-symbol`,"aria-hidden":`true`},nue={class:`expert-talk__agent-role`},rue={class:`expert-talk__agent-model`},iue={class:`expert-talk__stage-head`},aue={key:0,class:`expert-talk__metrics`},oue={key:0,class:`expert-talk__agent-actions`},sue=[`aria-label`],cue={class:`expert-talk__agent-head`},lue={class:`expert-talk__agent-role`},uue={class:`expert-talk__agent-model`},due={key:0,class:`expert-talk__metrics`},fue=[`aria-label`],pue={class:`expert-talk__comparison-grid`},mue={key:0,class:`expert-talk__comparison-card expert-talk__comparison-card--agreement`},hue={key:1,class:`expert-talk__comparison-card expert-talk__comparison-card--difference`},gue={key:2,class:`expert-talk__comparison-card expert-talk__comparison-card--uncertainty`},_ue={key:2,class:`expert-talk__fusion-actions`},vue=G({__name:`ExpertTalkExchange`,props:{run:{},models:{default:()=>[]}},emits:[`take`,`build`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=L(()=>n.run.state===`running`),o=R(!0);s(a,e=>{e&&(o.value=!0)});function l(e){o.value=e.currentTarget.open}let u=L(()=>a.value?i(`expertTalk.flowTitle`):i(`expertTalk.viewExchange`)),d=L(()=>i(`expertTalk.liveAnnouncement`,{state:i(`expertTalk.runState.${n.run.state}`),stage:i(`expertTalk.stage.${n.run.stage}`)})),f=L(()=>[{label:i(`expertTalk.metric.requests`),value:n.run.usage.requestCount===void 0?i(`expertTalk.unavailable`):String(n.run.usage.requestCount)},{label:i(`expertTalk.metric.attempts`),value:n.run.usage.providerAttemptCount===void 0?i(`expertTalk.unavailable`):String(n.run.usage.providerAttemptCount)},{label:i(`expertTalk.metric.cost`),value:i(`expertTalk.unavailable`)}]);function p(e){return e.some(e=>e.state===`running`)?`running`:e.some(e=>e.state===`failed`||e.state===`cancelled`)?`failed`:e.length>0&&e.every(e=>e.state===`unavailable`)?`skipped`:e.every(e=>e.state===`completed`||e.state===`unavailable`)?`completed`:`pending`}let m=L(()=>[{id:`opening`,label:i(`expertTalk.opinions`),state:p([n.run.opening.lead,n.run.opening.peer])},{id:`review`,label:i(`expertTalk.review`),state:p([n.run.review.lead,n.run.review.peer])},{id:`fusion`,label:i(`expertTalk.fusion`),state:n.run.fusion===void 0?`pending`:p([n.run.fusion])}]);function h(e){let t=n.models.find(t=>t.id===e);return t?.displayName??t?.model??e}function g(...e){return e.map(e=>e.text?.trim()).find(e=>e!==void 0&&e.length>0)}let y=L(()=>[{key:`lead`,role:i(`expertTalk.model1`),model:h(n.run.bindings.fusionLead.effectiveModelId),symbol:`◆`,stages:[{key:`lead-opening`,label:i(`expertTalk.opening`),artifact:n.run.opening.lead},{key:`lead-review`,label:i(`expertTalk.reviewPeer`),artifact:n.run.review.lead}],answer:g(n.run.review.lead,n.run.opening.lead)},{key:`peer`,role:i(`expertTalk.model2`),model:h(n.run.bindings.peer.effectiveModelId),symbol:`▲`,stages:[{key:`peer-opening`,label:i(`expertTalk.opening`),artifact:n.run.opening.peer},{key:`peer-review`,label:i(`expertTalk.reviewLead`),artifact:n.run.review.peer}],answer:g(n.run.review.peer,n.run.opening.peer)}]);function b(e){return(Ele(e)??e)?.trim()||void 0}let x=L(()=>{if(!(n.run.fusion===void 0&&n.run.stage!==`fusion`))return{model:h(n.run.bindings.fusionLead.effectiveModelId),artifact:n.run.fusion,state:n.run.fusion?.state??`running`,answer:n.run.result?.answer.trim()||b(n.run.fusion?.text)}});function S(e){if(e.startedAt===void 0||e.endedAt===void 0)return;let t=Date.parse(e.startedAt),n=Date.parse(e.endedAt);if(!(!Number.isFinite(t)||!Number.isFinite(n)||n0&&e.usage.output>0&&t.push({label:i(`expertTalk.metric.tps`),value:String(Math.round(e.usage.output/n))})}return e.toolCallCount!==void 0&&t.push({label:i(`expertTalk.metric.tools`),value:String(e.toolCallCount)}),t}function w(e){return e===`completed`?`success`:e===`failed`||e===`cancelled`?`danger`:e===`running`?`info`:`neutral`}function T(e){return e===`completed`?`success`:e===`failed`||e===`cancelled`||e===`interrupted`?`danger`:e===`running`?`info`:`neutral`}return(t,n)=>(c(),W(`section`,{class:`expert-opinion-exchange`,"aria-label":z(i)(`expertTalk.flowLabel`)},[F(`p`,Ule,U(d.value),1),F(`details`,{open:o.value,onToggle:l},[F(`summary`,Gle,[F(`span`,Kle,[n[2]||=F(`span`,{"aria-hidden":`true`},`◆`,-1),F(`span`,null,U(u.value),1)]),v(cp,{variant:T(e.run.state),dot:``},{default:B(()=>[K(U(z(i)(`expertTalk.runState.${e.run.state}`)),1)]),_:1},8,[`variant`])]),F(`ol`,qle,[(c(!0),W(M,null,_(m.value,e=>(c(),W(`li`,{key:e.id,"data-state":e.state},[v(ZD,{status:e.state},null,8,[`status`]),F(`span`,null,U(e.label),1)],8,Jle))),128))]),F(`dl`,Yle,[(c(!0),W(M,null,_(f.value,e=>(c(),W(`div`,{key:e.label},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))]),e.run.resultUnsupported?(c(),W(`p`,Xle,U(z(i)(`expertTalk.unsupportedResult`,{version:e.run.resultVersion})),1)):E(``,!0),e.run.error?(c(),W(`p`,Zle,U(e.run.error.message)+` `+U(e.run.error.action),1)):E(``,!0),F(`div`,Qle,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`article`,{key:e.key,class:V([`expert-talk__agent-column`,`expert-talk__agent-column--${e.key}`]),"aria-label":`${e.role}: ${e.model}`},[F(`header`,eue,[F(`span`,tue,U(e.symbol),1),F(`span`,nue,U(e.role),1),F(`span`,rue,U(e.model),1)]),(c(!0),W(M,null,_(e.stages,e=>(c(),W(`section`,{key:e.key,class:`expert-talk__stage`},[F(`header`,iue,[F(`span`,null,U(e.label),1),v(cp,{size:`sm`,variant:w(e.artifact.state),dot:``},{default:B(()=>[K(U(z(i)(`expertTalk.artifactState.${e.artifact.state}`)),1)]),_:2},1032,[`variant`])]),C(e.artifact).length>0?(c(),W(`dl`,aue,[(c(!0),W(M,null,_(C(e.artifact),e=>(c(),W(`div`,{key:e.label},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))])):E(``,!0),v(B4,{artifact:e.artifact,state:e.artifact.state},null,8,[`artifact`,`state`])]))),128)),e.answer?(c(),W(`footer`,oue,[v(pD,{size:`sm`,variant:`secondary`,title:z(i)(`expertTalk.takeHint`),onClick:t=>r(`take`,e.answer)},{default:B(()=>[v(X,{name:`pencil`,size:`sm`}),K(` `+U(z(i)(e.key===`lead`?`expertTalk.takeModel1`:`expertTalk.takeModel2`)),1)]),_:2},1032,[`title`,`onClick`])])):E(``,!0)],10,$le))),128))]),x.value?(c(),W(`article`,{key:2,class:`expert-talk__fusion`,"aria-label":`${z(i)(`expertTalk.fusion`)}: ${x.value.model}`},[F(`header`,cue,[n[3]||=F(`span`,{class:`expert-talk__agent-symbol`,"aria-hidden":`true`},`⧉`,-1),F(`span`,lue,U(z(i)(`expertTalk.fusion`)),1),F(`span`,uue,U(x.value.model)+` · `+U(z(i)(`expertTalk.freshFusion`)),1),v(cp,{size:`sm`,variant:w(x.value.state),dot:``},{default:B(()=>[K(U(z(i)(`expertTalk.artifactState.${x.value.state}`)),1)]),_:1},8,[`variant`])]),C(x.value.artifact).length>0?(c(),W(`dl`,due,[(c(!0),W(M,null,_(C(x.value.artifact),e=>(c(),W(`div`,{key:e.label},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))])):E(``,!0),v(B4,{artifact:x.value.artifact,state:x.value.state,text:x.value.answer},null,8,[`artifact`,`state`,`text`]),e.run.result&&(e.run.result.notes.consensus.length>0||e.run.result.notes.divergence.length>0||e.run.result.notes.uncertainty.length>0)?(c(),W(`section`,{key:1,class:`expert-talk__comparison`,"data-testid":`discussion-comparison`,"aria-label":z(i)(`expertTalk.finalComparison`)},[F(`h3`,null,U(z(i)(`expertTalk.finalComparison`)),1),F(`div`,pue,[e.run.result.notes.consensus.length>0?(c(),W(`section`,mue,[F(`h4`,null,[n[4]||=F(`span`,{"aria-hidden":`true`},`✓`,-1),K(U(z(i)(`expertTalk.agreement`)),1)]),F(`ul`,null,[(c(!0),W(M,null,_(e.run.result.notes.consensus,e=>(c(),W(`li`,{key:e},[v(w4,{text:e},null,8,[`text`])]))),128))])])):E(``,!0),e.run.result.notes.divergence.length>0?(c(),W(`section`,hue,[F(`h4`,null,[n[5]||=F(`span`,{"aria-hidden":`true`},`↔`,-1),K(U(z(i)(`expertTalk.differences`)),1)]),F(`ul`,null,[(c(!0),W(M,null,_(e.run.result.notes.divergence,e=>(c(),W(`li`,{key:e},[v(w4,{text:e},null,8,[`text`])]))),128))])])):E(``,!0),e.run.result.notes.uncertainty.length>0?(c(),W(`section`,gue,[F(`h4`,null,[n[6]||=F(`span`,{"aria-hidden":`true`},`?`,-1),K(U(z(i)(`expertTalk.uncertainty`)),1)]),F(`ul`,null,[(c(!0),W(M,null,_(e.run.result.notes.uncertainty,e=>(c(),W(`li`,{key:e},[v(w4,{text:e},null,8,[`text`])]))),128))])])):E(``,!0)])],8,fue)):E(``,!0),x.value.answer?(c(),W(`footer`,_ue,[v(pD,{size:`sm`,variant:`secondary`,"data-testid":`expert-opinion-take`,title:z(i)(`expertTalk.takeHint`),onClick:n[0]||=e=>r(`take`,x.value.answer)},{default:B(()=>[v(X,{name:`pencil`,size:`sm`}),K(` `+U(z(i)(`expertTalk.takeFusion`)),1)]),_:1},8,[`title`]),v(pD,{size:`sm`,"data-testid":`expert-opinion-build`,title:z(i)(`expertTalk.buildHint`),onClick:n[1]||=e=>r(`build`,x.value.answer)},{default:B(()=>[v(X,{name:`play`,size:`sm`}),K(` `+U(z(i)(`expertTalk.buildFusion`)),1)]),_:1},8,[`title`])])):E(``,!0)],8,sue)):E(``,!0)],40,Wle)],8,Hle))}}),yue=e({default:()=>V4}),V4=Y(vue,[[`__scopeId`,`data-v-7b58346d`]]),H4=R(null),U4=R(!1);function W4(e){let t=H4.value;!t||U4.value||(H4.value=null,t.resolve(e))}async function bue(){let e=H4.value;if(!(!e||U4.value)){if(!e.action){W4(!0);return}U4.value=!0;try{await e.action(),H4.value===e&&(H4.value=null),e.resolve(!0)}catch(t){H4.value===e&&(H4.value=null),e.reject(t)}finally{U4.value=!1}}}function xue(e){return U4.value?Promise.resolve(!1):(H4.value&&W4(!1),new Promise((t,n)=>{H4.value={...e,resolve:t,reject:n}}))}function G4(){return{current:H4,busy:U4,confirm:xue,settle:W4,runAction:bue}}var Sue=/^(application\/pdf|image\/(png|jpe?g|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon)|video\/[\w.+-]+|audio\/[\w.+-]+)$/i,Cue=/^(txt|md|markdown|log|json|ya?ml|csv|tsv|ts|mts|tsx|jsx|css|py|go|rs|java|c|h|cc|cpp|hpp|sh|zsh|sql|toml|ini|cfg|conf|vue)$/i,wue=/^(png|jpe?g|gif|webp|avif|bmp|ico)$/i,K4=`text/plain;charset=utf-8`;function Tue(e,t){let n=(t??``).toLowerCase();if(Sue.test(n))return n;if(n.startsWith(`text/`))return n===`text/html`?null:K4;let r=e?.match(/\.([A-Za-z0-9]{1,8})$/)?.[1]?.toLowerCase();return r===void 0?null:Cue.test(r)?K4:wue.test(r)?`image/${r===`jpg`?`jpeg`:r===`ico`?`x-icon`:r}`:r===`pdf`?`application/pdf`:null}async function q4(e,t,n){let r=Tue(t,n);if(r===null)return`unsupported`;let i=window.open(``,`_blank`);i!==null&&(i.opener=null);let a=await Q().getFileBlob(e).catch(()=>null);if(a===null)return i?.close(),`failed`;let o=URL.createObjectURL(new Blob([a],{type:r}));if(i!==null)i.location.href=o;else{let n=document.createElement(`a`);n.href=o,n.download=t??e,n.click()}return setTimeout(()=>{URL.revokeObjectURL(o)},6e4),`previewed`}function Eue(e){let t=e.replaceAll(`\\`,`/`),n=``,r=t,i=!1,a=/^\/\/([^/]+\/[^/]+)(\/|$)/.exec(t);a?(n=`//${a[1].toLowerCase()}/`,r=t.slice(a[0].length-+!!a[0].endsWith(`/`)),i=!0):/^[a-zA-Z]:\//.test(t)?(n=`${t[0].toLowerCase()}:/`,r=t.slice(3),i=!0):t.startsWith(`/`)&&(n=`/`,r=t.slice(1));let o=n!==``,s=[];for(let e of r.split(`/`))!e||e===`.`||(e===`..`?s.length>0&&s.at(-1)!==`..`?s.pop():o||s.push(e):s.push(e));let c=n+s.join(`/`);return i?c.toLowerCase():c}function Due(e,t){let n=0,r=0;for(let t of e)t.oldNo!==void 0&&(n=Math.max(n,t.oldNo)),t.newNo!==void 0&&(r=Math.max(r,t.newNo));return t.map(e=>({...e,oldNo:e.oldNo===void 0?void 0:e.oldNo+n,newNo:e.newNo===void 0?void 0:e.newNo+r}))}function Oue(e){let t=new Map;for(let n of SO(e)){if(n.kind!==`tool`||n.tool.status===`error`)continue;let e=gC(n.tool.name);if(e!==`edit`&&e!==`multi_edit`&&e!==`write`)continue;let r=sO(n.tool.arg);if(!r)continue;let i=e===`write`,a=i?null:oO(n.tool),o=a?iO(a):{added:0,removed:0},s=i||a===null,c=Eue(r),l=t.get(c);if(!l){t.set(c,{path:r,...o,hasWrite:i,statsIncomplete:s,diff:a});continue}l.added+=o.added,l.removed+=o.removed,l.hasWrite||=i,l.statsIncomplete||=s,l.diff!==null&&a!==null?l.diff=[...l.diff,{type:`hunk`,text:`···`},...Due(l.diff,a)]:l.diff=null}return[...t.values()]}var kue={class:`chat`},Aue={key:0,class:`chat-loading`},jue={class:`chat-loading-text`},Mue={key:1,class:`chat-empty`},Nue={key:1,class:`top-sentinel-text`},Pue={class:`u-turn`},Fue=[`data-turn-id`],Iue={key:0,class:`u-atts`},Lue={key:1,class:`skill-act`},Rue={class:`skill-act-head`},zue=[`aria-expanded`,`onClick`],Bue={key:0,class:`u-meta`},Vue=[`aria-label`,`onClick`],Hue=[`aria-label`,`onClick`],Uue={key:0,class:`expert-opinion-turn`},Wue=[`data-turn-id`],Gue=[`onClick`],Kue={class:`cd-view`},que={key:1,class:`cd-label`},Jue=[`data-turn-id`],Yue={key:1,class:`msg`},Xue={key:1,class:`a-msg-ft`},Zue={key:0,class:`a-duration`},Que=[`aria-label`,`onClick`],$ue={key:3,class:`turn-failed`,role:`alert`},ede={class:`tf-chip`,"aria-hidden":`true`},tde={class:`tf-main`},nde={class:`tf-title`},rde=[`title`],ide={key:5,class:`sending-placeholder`},ade={key:6,class:`q-stack`},ode={class:`q-head`},sde={class:`q-title`},cde=[`onDragover`,`onDrop`],lde=[`aria-label`,`onClick`],ude={class:`u-bub q-bub`},dde=[`title`,`onDragstart`],fde=[`title`,`onClick`],pde={key:0,class:`u-text q-text`},mde={key:1,class:`q-text q-text-placeholder`},hde={key:0,class:`q-imgs`},gde={key:0,class:`q-file`},_de=[`aria-label`,`onClick`],vde={key:0,class:`open-unsupported`,role:`status`},yde=`running`,bde=2500,J4=Y(G({__name:`ChatPane`,props:{turns:{},expertTalkRuns:{default:()=>[]},expertTalkModels:{default:()=>[]},approvals:{default:()=>[]},questions:{default:()=>[]},turnActive:{type:Boolean,default:!1},working:{type:Boolean,default:!1},fastMoon:{type:Boolean,default:!1},sessionLoading:{type:Boolean},compaction:{default:null},hasMoreMessages:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},loadingMoreError:{type:Boolean,default:!1},isFollowing:{type:Boolean,default:!1},toolDiffPanel:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},inspector:{type:Boolean,default:!1},turnFolding:{type:Boolean,default:!0},activityRunFolding:{type:Boolean,default:!0},lastTurnReason:{},turnErrorKind:{},turnErrorMessage:{},cwd:{},queued:{default:()=>[]}},emits:[`openFile`,`openMedia`,`copyConversationCopied`,`openCompaction`,`openAgent`,`detachTask`,`openToolDiff`,`openTurnDiff`,`editMessage`,`loadOlderMessages`,`unqueue`,`editQueued`,`reorderQueue`,`steerQueued`,`continueTurn`,`takeExpertTalk`,`buildExpertTalk`],setup(e,{expose:t,emit:r}){let{t:i}=J(),{confirm:a}=G4();h(()=>{for(let e of k.values())e.disconnect();k.clear(),O.clear(),Ce!==null&&(clearTimeout(Ce),Ce=null),ge!==null&&(clearTimeout(ge),ge=null),G!==null&&(clearTimeout(G),G=null),Oe!==null&&(clearTimeout(Oe),Oe=null)});let o=e,l=R(null),u=null;function d(){!l.value||typeof IntersectionObserver>`u`||(u?.disconnect(),u=new IntersectionObserver(e=>{e[0]?.isIntersecting&&o.hasMoreMessages&&!o.loadingMore&&!o.loadingMoreError&&!o.sessionLoading&&!o.isFollowing&&S(`loadOlderMessages`)},{root:null,rootMargin:`200px 0px 0px 0px`,threshold:0}),u.observe(l.value))}p(d),h(()=>{u?.disconnect(),u=null}),s(()=>[o.hasMoreMessages,o.loadingMore,o.loadingMoreError],()=>{n().then(d)});let f=L(()=>{if(!o.turnActive||o.turns.length===0)return null;let e=o.turns.at(-1);return e.role===`assistant`?e.id:null}),m=L(()=>o.working),g=new WeakMap;function y(e){let t=g.get(e);if(t?.activityRunFolding===o.activityRunFolding&&t.turnFolding===o.turnFolding)return t.model;let n=Qae(e,o.activityRunFolding),{folded:r,visible:i}=$ae(n,o.turnFolding),a={all:n,folded:r,visible:i,changes:Oue(e)};return g.set(e,{activityRunFolding:o.activityRunFolding,turnFolding:o.turnFolding,model:a}),a}let b=L(()=>{let e=new Map;for(let t of o.turns)t.role===`assistant`&&e.set(t.id,y(t));return e}),x=L(()=>{let e=o.turns.at(-1);if(e?.role!==`assistant`)return i(`conversation.requesting`);let t=b.value.get(e.id)?.all.some(e=>e.kind===`text`?e.text.trim().length>0:!0);return i(t?`conversation.working`:`conversation.requesting`)}),S=r,C=L(()=>{let e=new Map;for(let t of o.expertTalkRuns)e.set(t.promptId,t),e.set(`t${t.turnId}`,t);return e});function w(e){return e.promptId===void 0?void 0:C.value.get(e.promptId)}let T=R({}),D=R({}),O=new Map,k=new Map;function A(e){let t=O.get(e)?.querySelector(`.u-text`);if(!t)return;let n=Number.parseFloat(getComputedStyle(t).lineHeight)||24;D.value[e]=t.scrollHeight>n*10+1}function j(e,t){let r=t instanceof HTMLElement?t:null;if(!r){k.get(e)?.disconnect(),k.delete(e),O.delete(e);return}if(O.get(e)!==r){if(k.get(e)?.disconnect(),O.set(e,r),typeof ResizeObserver<`u`){let t=new ResizeObserver(()=>A(e));t.observe(r.querySelector(`.u-text`)??r),k.set(e,t)}n(()=>A(e))}}function N(e){T.value[e]=!T.value[e]}let ee=R(null),I=R(null);function te(e){return(e.attachments?.length??0)>0}function ne(e){S(`editQueued`,e)}function re(e,t){if(ee.value=e,!t.dataTransfer)return;t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e));let n=t.currentTarget?.closest(`.q-turn`);n&&t.dataTransfer.setDragImage(n,24,24)}function ie(e,t){if(ee.value===null)return;t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=`move`);let n=t.currentTarget.getBoundingClientRect();I.value={index:e,position:t.clientY{for(let e=o.turns.length-1;e>=0;e--)if(o.turns[e].role===`user`)return o.turns[e].id;return null});function ce(e){return!o.readOnly&&e.role===`user`&&e.id===se.value&&!o.working&&!e.pluginCommand&&!(e.skillActivation&&!fse(e.skillActivation,{revivePill:!1}))}function le(e){return e.skillActivation?pse(e.skillActivation):e.pluginCommand?e.pluginCommand.args||null:e.text||null}function ue(e){let t=e.compaction,n=t?.trigger===`auto`?i(`conversation.compactedAuto`):i(`conversation.compactedPlain`);return typeof t?.tokensBefore==`number`&&typeof t?.tokensAfter==`number`?n+i(`conversation.compactedTokens`,{before:yO(t.tokensBefore),after:yO(t.tokensAfter)}):n}let de=R(null),fe=R(null),G=null;async function pe(e){await a({title:i(`conversation.undo`),message:i(`conversation.undoConfirm`),variant:`primary`})&&me(e)}function me(e){fe.value===null&&(fe.value=e.id,S(`editMessage`,{text:e.skillActivation?u4(e.skillActivation,{revivePill:!1})??e.text:e.text,attachments:e.attachments}),G=setTimeout(()=>{G=null,fe.value=null},bde))}s(()=>o.turns,e=>{fe.value!==null&&(e.some(e=>e.id===fe.value)||(fe.value=null,G!==null&&(clearTimeout(G),G=null)))},{flush:`post`});let he=R(!1),ge=null;function _e(){if(o.turns.length===0)return;let e=[];for(let t of o.turns){if(t.role===`compaction`||t.role===`cron`)continue;let n=t.role===`user`?`User`:`Assistant`,r=toe(t);r.trim()&&e.push(`**${n}**\n\n${r}`)}Wi(e.join(` --- -`)).then(e=>{e&&(he.value=!0,S(`copyConversationCopied`),ge!==null&&clearTimeout(ge),ge=setTimeout(()=>{ge=null,he.value=!1},2e3))}).catch(()=>{})}function ve(e){let t=[];for(let n=e;n>=0;n--){let e=o.turns[n];if(!e||e.role!==`assistant`)break;t.unshift(e)}return t}function ye(e){let t=ve(e);for(let e=t.length-1;e>=0;--e){let n=Qae(t[e]);if(n.trim())return n}return``}function be(){for(let e=o.turns.length-1;e>=0;--e)if(o.turns[e]?.role===`assistant`)return ye(e);return``}function xe(){let e=be();e.trim()&&Wi(e).then(e=>{e&&(he.value=!0,S(`copyConversationCopied`),ge!==null&&clearTimeout(ge),ge=setTimeout(()=>{ge=null,he.value=!1},2e3))}).catch(()=>{})}t({copyConversation:_e,copyFinalSummary:xe});function Se(e){let t=o.turns[e];if(!t||t.role!==`assistant`)return!1;let n=o.turns[e+1];return!n||n.role!==`assistant`}let Ce=null;function we(e){let t=o.turns[e];if(!t)return;let n=ye(e);n.trim()&&Wi(n).then(e=>{e&&(de.value=t.id,Ce!==null&&clearTimeout(Ce),Ce=setTimeout(()=>{Ce=null,de.value=null},1400))}).catch(()=>{})}function Te(e){let t=e.text;t.trim()&&Wi(t).then(t=>{t&&(de.value=e.id,Ce!==null&&clearTimeout(Ce),Ce=setTimeout(()=>{Ce=null,de.value=null},1400))}).catch(()=>{})}function Ee(e){return{kind:e.kind===`video`?`video`:`image`,url:e.url,path:e.name,fileId:e.fileId}}let De=R(null),Oe=null;function ke(e){if(e.kind===`image`||e.kind===`video`){S(`openMedia`,Ee(e));return}e.fileId!==void 0&&J4(e.fileId,e.name,e.mediaType).then(t=>{t===`unsupported`&&(De.value=e.name??e.fileId??``,Oe!==null&&clearTimeout(Oe),Oe=setTimeout(()=>{Oe=null,De.value=null},2400))})}function Ae(e,t){return e.id!==f.value||yO(t)?!1:t.sourceIndex===_O(e).length-1}function je(e){if(e.id!==f.value)return null;let t=_O(e),n=t.at(-1);if(n!==void 0&&yO(n))return null;if(n?.kind===`tool`&&n.tool.status===`running`){let e=n.tool.id;if(o.approvals.some(t=>t.toolCallId===e)||(o.questions??[]).some(t=>t.toolCallId===e))return null}return t.length-1}function Me(e){if(!e.createdAt)return;let t=Date.parse(e.createdAt);return Number.isFinite(t)?t:void 0}function q(e,t){if(e.id!==f.value)return!1;let n=t.items.at(-1);return n!==void 0&&yO(n)?!1:n!==void 0&&n.sourceIndex===_O(e).length-1}function Ne(){S(`continueTurn`,i(`conversation.turnFailedResumeText`))}return(t,n)=>(c(),W(M,null,[F(`div`,xue,[e.sessionLoading?(c(),W(`div`,Sue,[v(np,{size:`sm`}),F(`span`,Cue,U(z(i)(`conversation.loading`)),1)])):e.turns.length===0&&(!e.approvals||e.approvals.length===0)?(c(),W(`div`,wue)):E(``,!0),e.hasMoreMessages||e.loadingMore?(c(),W(`div`,{key:2,ref_key:`topSentinelRef`,ref:l,class:V([`top-sentinel`,{"top-sentinel-loading":e.loadingMore}])},[e.loadingMore?(c(),W(`span`,Tue,[v(np,{size:`sm`}),K(` `+U(z(i)(`conversation.loadingOlder`)),1)])):(c(),W(`button`,{key:0,type:`button`,class:`top-sentinel-btn`,onClick:n[0]||=e=>S(`loadOlderMessages`)},U(z(i)(`conversation.loadOlder`)),1))],2)):E(``,!0),(c(!0),W(M,null,_(e.turns,(t,r)=>(c(),W(M,{key:t.id},[t.role===`user`?(c(),W(M,{key:0},[F(`div`,Eue,[F(`div`,{class:V([`u-bub turn-anchor`,{undoing:fe.value===t.id}]),"data-turn-id":t.id},[t.attachments&&t.attachments.length>0?(c(),W(`div`,Oue,[(c(!0),W(M,null,_(t.attachments,(e,t)=>(c(),P(I4,{key:t,kind:e.kind,name:e.name,url:e.url,"file-id":e.fileId,"media-type":e.mediaType,size:e.size,onActivate:t=>ke(e)},null,8,[`kind`,`name`,`url`,`file-id`,`media-type`,`size`,`onActivate`]))),128))])):E(``,!0),t.pluginCommand?(c(),W(`div`,kue,[F(`div`,Aue,[n[19]||=F(`span`,{class:`skill-act-arrow`},`▶`,-1),F(`span`,null,`/`+U(t.pluginCommand.pluginId)+`:`+U(t.pluginCommand.commandName),1)])])):E(``,!0),le(t)===null?E(``,!0):(c(),W(`div`,{key:2,ref_for:!0,ref:e=>j(t.id,e),class:V([`u-text-wrap`,{"u-text-wrap-args":!!t.pluginCommand,"is-clamped":D.value[t.id]&&!T.value[t.id]}])},[F(`div`,{class:V(t.pluginCommand?`skill-act-args`:`u-text`)},[v(L4,{text:le(t)??``,"open-file":e=>S(`openFile`,e)},null,8,[`text`,`open-file`])],2),D.value[t.id]?(c(),W(`button`,{key:0,type:`button`,class:`u-text-toggle`,"aria-expanded":!!T.value[t.id],onClick:e=>N(t.id)},[K(U(z(i)(T.value[t.id]?`conversation.userMessage.collapse`:`conversation.userMessage.expand`))+` `,1),v(X,{class:`u-text-toggle-car`,name:`chevron-down`,size:`sm`})],8,jue)):E(``,!0)],2))],10,Due),t.createdAt||ce(t)?(c(),W(`div`,Mue,[ce(t)?(c(),W(`div`,{key:0,class:V([`u-edit-wrap`,{undoing:fe.value===t.id}])},[F(`button`,{type:`button`,class:`u-edit`,"aria-label":z(i)(`conversation.undoTooltip`),onClick:e=>pe(t)},[v(X,{name:`undo`,size:`sm`})],8,Nue)],2)):E(``,!0),t.text.trim().length>0?(c(),W(`button`,{key:1,type:`button`,class:`u-copy`,"aria-label":z(i)(`filePreview.copy`),onClick:H(e=>Te(t),[`stop`])},[de.value===t.id?(c(),P(X,{key:1,name:`check`,size:`sm`})):(c(),P(X,{key:0,name:`copy`,size:`sm`}))],8,Pue)):E(``,!0),t.createdAt?(c(),P(E4,{key:2,time:t.createdAt},null,8,[`time`])):E(``,!0)])):E(``,!0)]),w(t)?(c(),W(`div`,Fue,[v(H4,{run:w(t),models:e.expertTalkModels,onTake:n[1]||=e=>S(`takeExpertTalk`,e),onBuild:n[2]||=e=>S(`buildExpertTalk`,e)},null,8,[`run`,`models`])])):E(``,!0)],64)):t.role===`compaction`?(c(),W(`div`,{key:1,class:`compact-divider turn-anchor`,"data-turn-id":t.id,role:`separator`},[n[20]||=F(`span`,{class:`cd-line`,"aria-hidden":`true`},null,-1),t.text?(c(),W(`button`,{key:0,type:`button`,class:`cd-label cd-btn`,onClick:e=>S(`openCompaction`,{turnId:t.id})},[F(`span`,null,U(ue(t)),1),F(`span`,Rue,U(z(i)(`conversation.viewSummary`)),1)],8,Lue)):(c(),W(`span`,zue,U(ue(t)),1)),n[21]||=F(`span`,{class:`cd-line`,"aria-hidden":`true`},null,-1)],8,Iue)):t.role===`cron`?(c(),P(Rse,{key:2,text:t.text,cron:t.cron,"turn-id":t.id,"created-at":t.createdAt},null,8,[`text`,`cron`,`turn-id`,`created-at`])):t.role===`assistant`&&w(t)?(c(),W(M,{key:3},[],64)):(c(),W(`div`,{key:4,class:`a-msg turn-anchor`,"data-turn-id":t.id},[v(Wce,{items:b.value.get(t.id)?.folded??[],live:t.id===f.value,parked:t.id===f.value&&je(t)===null,"streaming-tail-index":je(t),"seed-ms":z(Yae)(t),"created-ms":Me(t),"duration-ms":t.durationMs,"tool-diff-panel":e.toolDiffPanel,mobile:``,onOpenMedia:n[3]||=e=>S(`openMedia`,e),onOpenFile:n[4]||=e=>S(`openFile`,e),onOpenToolDiff:n[5]||=e=>S(`openToolDiff`,e),onOpenAgent:n[6]||=e=>S(`openAgent`,e),onDetach:n[7]||=e=>S(`detachTask`,e)},null,8,[`items`,`live`,`parked`,`streaming-tail-index`,`seed-ms`,`created-ms`,`duration-ms`,`tool-diff-panel`]),(c(!0),W(M,null,_(b.value.get(t.id)?.visible??[],(r,i)=>(c(),W(M,{key:z(SO)(r,i)},[r.kind===`thinking`?(c(),P(TO,{key:0,text:r.thinking,mobile:``,streaming:Ae(t,r),"started-at-ms":z(vO)(r.startedAt),"duration-ms":r.durationMs},null,8,[`text`,`streaming`,`started-at-ms`,`duration-ms`])):r.kind===`text`&&r.text?(c(),W(`div`,Vue,[v(T4,{text:r.text,streaming:Ae(t,r),"open-file":e=>S(`openFile`,e)},null,8,[`text`,`streaming`,`open-file`])])):r.kind===`activity-run`?(c(),P(EO,{key:2,items:r.items,mobile:``,streaming:q(t,r),"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[8]||=e=>S(`openMedia`,e),onOpenFile:n[9]||=e=>S(`openFile`,e),onOpenToolDiff:n[10]||=e=>S(`openToolDiff`,e),onOpenAgent:n[11]||=e=>S(`openAgent`,e),onDetach:n[12]||=e=>S(`detachTask`,e)},null,8,[`items`,`streaming`,`tool-diff-panel`])):r.kind===`tool`?(c(),P(pO,{key:3,tool:r.tool,mobile:``,"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[13]||=e=>S(`openMedia`,e),onOpenFile:n[14]||=e=>S(`openFile`,e),onOpenToolDiff:n[15]||=e=>S(`openToolDiff`,e),onOpenAgent:n[16]||=e=>S(`openAgent`,e),onDetach:n[17]||=e=>S(`detachTask`,e)},null,8,[`tool`,`tool-diff-panel`])):r.kind===`notification`?(c(),P(P4,{key:4,items:r.items},null,8,[`items`])):E(``,!0)],64))),128)),t.id!==f.value&&(b.value.get(t.id)?.changes.length??0)>0?(c(),P(sle,{key:0,changes:b.value.get(t.id)?.changes??[],cwd:e.cwd,onOpenDiff:e=>S(`openTurnDiff`,{turnId:t.id,changes:b.value.get(t.id)?.changes??[]}),onOpenFile:n[18]||=e=>S(`openFile`,e)},null,8,[`changes`,`cwd`,`onOpenDiff`])):E(``,!0),t.id!==f.value&&Se(r)&&(ye(r).trim().length>0||t.durationMs!==void 0)?(c(),W(`div`,Hue,[v(vp,{text:`${t.durationMs} ms`},{default:B(()=>[t.durationMs===void 0?E(``,!0):(c(),W(`span`,Uue,U(z(Jae)(t.durationMs)),1))]),_:2},1032,[`text`]),ye(r).trim().length>0?(c(),W(`button`,{key:0,class:`a-cpbtn`,"aria-label":z(i)(`filePreview.copy`),onClick:e=>we(r)},[de.value===t.id?(c(),P(X,{key:1,name:`check`,size:`sm`})):(c(),P(X,{key:0,name:`copy`,size:`sm`}))],8,Wue)):E(``,!0)])):E(``,!0)],8,Bue))],64))),128)),e.lastTurnReason===`failed`&&!e.working?(c(),W(`div`,Gue,[F(`span`,Kue,[v(X,{name:`alert-triangle`,size:`sm`})]),F(`div`,que,[F(`span`,Jue,U(e.turnErrorKind===`max_steps`?z(i)(`conversation.turnFailedMaxSteps`):z(i)(`conversation.turnFailed`)),1),e.turnErrorMessage?(c(),W(`span`,{key:0,class:`tf-sub`,title:e.turnErrorMessage},U(e.turnErrorMessage),9,Yue)):E(``,!0)]),v(YT,{variant:`secondary`,size:`sm`,onClick:Ne},{default:B(()=>[K(U(z(i)(`conversation.turnFailedResume`)),1)]),_:1})])):E(``,!0),e.compaction?(c(),P(wse,{key:4,label:z(i)(`conversation.compacting`)},null,8,[`label`])):E(``,!0),m.value?(c(),W(`div`,Xue,[v(gle,{label:x.value,state:dde},null,8,[`label`])])):E(``,!0),e.queued.length>0?(c(),W(`div`,Zue,[F(`div`,Que,[F(`span`,$ue,[v(X,{name:`mail`,size:`sm`}),K(` `+U(z(i)(`composer.queueLabel`))+` · `,1),F(`b`,null,U(z(i)(`composer.queuePending`,{n:e.queued.length})),1)])]),(c(!0),W(M,null,_(e.queued,(e,t)=>(c(),W(`div`,{key:e.id,class:V([`u-turn q-turn`,{"q-dragging":ee.value===t,"drop-before":I.value?.index===t&&I.value.position===`before`,"drop-after":I.value?.index===t&&I.value.position===`after`}]),onDragover:e=>ie(t,e),onDrop:e=>ae(t,e)},[t===0?(c(),P(vp,{key:0,text:z(i)(`composer.queueSteer`)},{default:B(()=>[F(`button`,{type:`button`,class:`q-send`,"aria-label":z(i)(`composer.queueSteer`),onClick:H(e=>S(`steerQueued`,t),[`stop`])},[v(X,{name:`send`,size:`lg`})],8,tde)]),_:2},1032,[`text`])):E(``,!0),F(`div`,nde,[F(`span`,{class:`q-grip`,title:z(i)(`composer.queueDragTitle`),draggable:`true`,onDragstart:e=>re(t,e),onDragend:oe},[v(X,{name:`grip`,size:`sm`})],40,rde),F(`button`,{type:`button`,class:`q-body`,title:z(i)(`composer.editQueued`),onClick:e=>ne(t)},[e.text?(c(),W(`span`,ade,[v(L4,{text:e.text,interactive:!1},null,8,[`text`])])):(c(),W(`span`,ode,[v(X,{name:`file`,size:`sm`}),K(` `+U(z(i)(`composer.queuedAttachments`,{n:e.attachments?.length??0})),1)]))],8,ide),te(e)?(c(),W(`div`,sde,[(c(!0),W(M,null,_(e.attachments,(e,t)=>(c(),W(M,{key:t},[e.kind===`file`?(c(),W(`span`,cde,[v(X,{name:`file`,size:`sm`}),K(` `+U(e.name??e.fileId),1)])):(c(),P(F4,{key:1,url:e.url,kind:e.kind,"file-id":e.fileId,"media-class":`q-img`,controls:!1,muted:``},null,8,[`url`,`kind`,`file-id`]))],64))),128))])):E(``,!0),F(`button`,{type:`button`,class:`q-rm`,"aria-label":z(i)(`composer.remove`),onClick:H(e=>S(`unqueue`,t),[`stop`])},[v(X,{name:`close`,size:`sm`})],8,lde)])],42,ede))),128))])):E(``,!0)]),De.value===null?E(``,!0):(c(),W(`div`,ude,U(z(i)(`composer.attachmentOpenUnsupported`,{name:De.value})),1))],64))}}),[[`__scopeId`,`data-v-01f8f83d`]]),pde={class:`ch-id`},mde={key:0,class:`ch-ws`},hde={key:1,class:`ch-sep`},gde=[`onKeydown`],_de={class:`ch-ses`},vde={key:0,class:`ch-pill ch-sync-pill`},yde={key:0,class:`ch-ahead`},bde={key:1,class:`ch-behind`},xde={key:1,class:`ch-pill ch-diff-pill`},Sde={key:0,class:`ch-add`},Cde={key:1,class:`ch-del`},wde={class:`ch-pill ch-pr pr-merged ch-done-pill`},Tde=Y(G({__name:`ChatHeader`,props:{sessionId:{},workspaceName:{},workspaceRoot:{},sessionTitle:{},branch:{},ahead:{},behind:{},changesCount:{},gitDiffStats:{},isGitRepo:{type:Boolean},pr:{},copied:{type:Boolean},sessionDone:{type:Boolean},pinned:{type:Boolean},panelVisible:{type:Boolean}},emits:[`copyAll`,`copyFinalSummary`,`openChanges`,`openPr`,`renameSession`,`forkSession`,`togglePin`,`archiveSession`,`restoreSession`,`exportSession`,`togglePanel`],setup(e,{emit:t}){let{t:r}=J(),i=e,a=t,o=L(()=>i.ahead??0),s=L(()=>i.behind??0),u=L(()=>i.gitDiffStats?.totalAdditions??0),d=L(()=>i.gitDiffStats?.totalDeletions??0),f=L(()=>u.value>0||d.value>0),p={open:`header.prStatusOpen`,closed:`header.prStatusClosed`,merged:`header.prStatusMerged`,draft:`header.prStatusDraft`};function m(e){return e.trim().toLowerCase().replaceAll(`_`,`-`)}function g(e){let t=m(e);return p[t]?`pr-${t}`:`pr-unknown`}function _(e){return r(p[m(e)]??`header.prStatusUnknown`)}let y=R(!1),b=R(null),x=R(null),S=R({});function C(e){let t=e.target;x.value?.el?.contains(t)||b.value?.el?.contains(t)||D()}function w(){D()}async function T(e){if(e.stopPropagation(),y.value){D();return}y.value=!0,document.addEventListener(`mousedown`,C),window.addEventListener(`resize`,w),await n();let t=b.value?.el,r=x.value?.el;if(!t||!r)return;let i=t.getBoundingClientRect(),a=r.offsetWidth,o=r.offsetHeight,s=i.bottom+4;s+o>window.innerHeight-8&&(s=Math.max(8,i.top-o-4));let c=i.left;c+a>window.innerWidth-8&&(c=Math.max(8,i.right-a)),S.value={top:`${Math.round(s)}px`,left:`${Math.round(c)}px`}}function D(){y.value=!1,document.removeEventListener(`mousedown`,C),window.removeEventListener(`resize`,w)}h(()=>{document.removeEventListener(`mousedown`,C),window.removeEventListener(`resize`,w)});function O(){a(`copyAll`),D()}function k(){a(`copyFinalSummary`),D()}let A=R(!1);function j(){i.sessionId&&Wi(i.sessionId).then(e=>{e&&(A.value=!0,setTimeout(()=>{A.value=!1},1200))})}let N=R(!1),ee=R(``),I=R(null);async function te(){if(D(),i.sessionId){N.value=!0,ee.value=i.sessionTitle??``,await n();try{I.value?.focus(),I.value?.select()}catch{}}}function ne(){let e=ee.value.trim();e&&i.sessionId&&e!==(i.sessionTitle??``).trim()&&a(`renameSession`,i.sessionId,e),N.value=!1}function re(){N.value=!1}function oe(){i.sessionId&&(D(),a(`forkSession`,i.sessionId))}function se(){i.sessionId&&(D(),a(`exportSession`,i.sessionId))}function ce(){i.sessionId&&(D(),a(`togglePin`,i.sessionId))}function le(){i.sessionId&&(D(),a(`archiveSession`,i.sessionId))}function ue(){i.sessionId&&(D(),a(`restoreSession`,i.sessionId))}return(t,n)=>(c(),W(`header`,{class:V([`chat-header`,{"macos-desktop":z(OT)}])},[F(`div`,pde,[e.workspaceName?(c(),W(`span`,mde,U(e.workspaceName),1)):E(``,!0),e.workspaceName&&e.sessionTitle?(c(),W(`span`,hde,`/`)):E(``,!0),N.value?l((c(),W(`input`,{key:2,ref_key:`renameInputRef`,ref:I,"onUpdate:modelValue":n[0]||=e=>ee.value=e,class:`ch-rename`,type:`text`,onKeydown:[ie(H(ne,[`stop`]),[`enter`]),ie(H(re,[`stop`]),[`esc`])],onBlur:ne,onClick:n[1]||=H(()=>{},[`stop`])},null,40,gde)),[[de,ee.value]]):e.sessionTitle?(c(),P(vp,{key:3,text:e.sessionTitle},{default:B(()=>[F(`span`,_de,U(e.sessionTitle),1)]),_:1},8,[`text`])):E(``,!0)]),v(Ca,{ref_key:`kebabRef`,ref:b,class:V([`ch-act-more`,{open:y.value}]),label:z(r)(`header.options`),"aria-expanded":y.value,"aria-haspopup":`menu`,onClick:n[2]||=H(e=>T(e),[`stop`])},{default:B(()=>[v(X,{name:`dots-horizontal`,size:`md`})]),_:1},8,[`class`,`label`,`aria-expanded`]),y.value?(c(),P(dp,{key:0,ref_key:`menuRef`,ref:x,class:`ch-menu`,style:ae(S.value),onClick:n[3]||=H(()=>{},[`stop`])},{default:B(()=>[v(mp,{onClick:O},{default:B(()=>[v(X,{name:e.copied?`check`:`copy`,size:`sm`},null,8,[`name`]),K(` `+U(e.copied?z(r)(`header.copied`):z(r)(`header.copyAll`)),1)]),_:1}),v(mp,{onClick:k},{default:B(()=>[v(X,{name:`file-text`,size:`sm`}),K(` `+U(z(r)(`header.copyFinalSummary`)),1)]),_:1}),e.sessionId?(c(),W(M,{key:0},[v(mp,{separator:``}),v(mp,{onClick:j},{default:B(()=>[v(X,{name:A.value?`check`:`copy`,size:`sm`},null,8,[`name`]),K(` `+U(A.value?z(r)(`header.copied`):z(r)(`header.copySessionId`)),1)]),_:1}),e.sessionDone?E(``,!0):(c(),P(mp,{key:0,onClick:ce},{default:B(()=>[v(X,{name:e.pinned?`pushpin-fill`:`pushpin-line`,size:`sm`},null,8,[`name`]),K(` `+U(e.pinned?z(r)(`header.unpinSession`):z(r)(`header.pinSession`)),1)]),_:1})),v(mp,{onClick:te},{default:B(()=>[v(X,{name:`pencil`,size:`sm`}),K(` `+U(z(r)(`header.renameSession`)),1)]),_:1}),v(mp,{onClick:oe},{default:B(()=>[v(X,{name:`git-fork`,size:`sm`}),K(` `+U(z(r)(`header.forkSession`)),1)]),_:1}),v(mp,{onClick:se},{default:B(()=>[v(X,{name:`download`,size:`sm`}),K(` `+U(z(r)(`header.exportSession`)),1)]),_:1}),e.sessionDone?(c(),P(mp,{key:1,onClick:ue},{default:B(()=>[v(X,{name:`undo`,size:`sm`}),K(` `+U(z(r)(`header.reopenSession`)),1)]),_:1})):(c(),P(mp,{key:2,onClick:le},{default:B(()=>[v(X,{name:`archive`,size:`sm`}),K(` `+U(z(r)(`header.markSessionDone`)),1)]),_:1}))],64)):E(``,!0)]),_:1},8,[`style`])):E(``,!0),n[7]||=F(`div`,{class:`ch-spacer`},null,-1),e.isGitRepo?(c(),W(`button`,{key:1,type:`button`,class:`ch-git`,onClick:n[4]||=e=>a(`openChanges`)},[F(`span`,{class:V([`ch-branch`,{"ch-detached":!e.branch}])},U(e.branch||z(r)(`header.detached`)),3),o.value>0||s.value>0?(c(),W(`span`,vde,[o.value>0?(c(),W(`span`,yde,`↑`+U(o.value),1)):E(``,!0),s.value>0?(c(),W(`span`,bde,`↓`+U(s.value),1)):E(``,!0)])):E(``,!0),f.value?(c(),W(`span`,xde,[u.value>0?(c(),W(`span`,Sde,`+`+U(u.value),1)):E(``,!0),d.value>0?(c(),W(`span`,Cde,`-`+U(d.value),1)):E(``,!0)])):E(``,!0)])):E(``,!0),e.pr?(c(),W(`button`,{key:2,type:`button`,class:V([`ch-pill ch-pr`,g(e.pr.state)]),onClick:n[5]||=t=>e.pr&&a(`openPr`,e.pr.url)},[v(X,{name:`git-pull-request`,size:`sm`}),F(`span`,null,`PR #`+U(e.pr.number)+` · `+U(_(e.pr.state)),1)],2)):E(``,!0),e.sessionId&&e.sessionDone?(c(),W(M,{key:3},[F(`span`,wde,[v(X,{name:`circle-check`,size:`sm`}),F(`span`,null,U(z(r)(`header.sessionDone`)),1)]),v(YT,{variant:`secondary`,size:`sm`,onClick:ue},{default:B(()=>[v(X,{name:`undo`,size:`sm`}),K(` `+U(z(r)(`header.reopenSession`)),1)]),_:1})],64)):E(``,!0),e.panelVisible?E(``,!0):(c(),P(Ca,{key:4,class:`ch-panel`,label:z(r)(`panel.openPanel`),onClick:n[6]||=e=>a(`togglePanel`)},{default:B(()=>[v(X,{name:`panel-expand-right`,size:`md`})]),_:1},8,[`label`]))],2))}}),[[`__scopeId`,`data-v-28de58d9`]]),Ede=`BN.BN.BN.BN.BN.BN.BN.BN.BN.S.B.S.WS.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.B.B.B.S.WS.ON.ON.ET.ET.ET.ON.ON.ON.ON.ON.ES.CS.ES.CS.CS.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.CS.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.BN.BN.BN.BN.BN.BN.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.CS.ON.ET.ET.ET.ET.ON.ON.ON.ON.L.ON.ON.BN.ON.ON.ET.ET.EN.EN.ON.L.ON.ON.ON.EN.L.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L`.split(`.`),X4=[[697,698,`ON`],[706,719,`ON`],[722,735,`ON`],[741,749,`ON`],[751,767,`ON`],[768,879,`NSM`],[884,885,`ON`],[894,894,`ON`],[900,901,`ON`],[903,903,`ON`],[1014,1014,`ON`],[1155,1161,`NSM`],[1418,1418,`ON`],[1421,1422,`ON`],[1423,1423,`ET`],[1424,1424,`R`],[1425,1469,`NSM`],[1470,1470,`R`],[1471,1471,`NSM`],[1472,1472,`R`],[1473,1474,`NSM`],[1475,1475,`R`],[1476,1477,`NSM`],[1478,1478,`R`],[1479,1479,`NSM`],[1480,1535,`R`],[1536,1541,`AN`],[1542,1543,`ON`],[1544,1544,`AL`],[1545,1546,`ET`],[1547,1547,`AL`],[1548,1548,`CS`],[1549,1549,`AL`],[1550,1551,`ON`],[1552,1562,`NSM`],[1563,1610,`AL`],[1611,1631,`NSM`],[1632,1641,`AN`],[1642,1642,`ET`],[1643,1644,`AN`],[1645,1647,`AL`],[1648,1648,`NSM`],[1649,1749,`AL`],[1750,1756,`NSM`],[1757,1757,`AN`],[1758,1758,`ON`],[1759,1764,`NSM`],[1765,1766,`AL`],[1767,1768,`NSM`],[1769,1769,`ON`],[1770,1773,`NSM`],[1774,1775,`AL`],[1776,1785,`EN`],[1786,1808,`AL`],[1809,1809,`NSM`],[1810,1839,`AL`],[1840,1866,`NSM`],[1867,1957,`AL`],[1958,1968,`NSM`],[1969,1983,`AL`],[1984,2026,`R`],[2027,2035,`NSM`],[2036,2037,`R`],[2038,2041,`ON`],[2042,2044,`R`],[2045,2045,`NSM`],[2046,2069,`R`],[2070,2073,`NSM`],[2074,2074,`R`],[2075,2083,`NSM`],[2084,2084,`R`],[2085,2087,`NSM`],[2088,2088,`R`],[2089,2093,`NSM`],[2094,2136,`R`],[2137,2139,`NSM`],[2140,2143,`R`],[2144,2191,`AL`],[2192,2193,`AN`],[2194,2198,`AL`],[2199,2207,`NSM`],[2208,2249,`AL`],[2250,2273,`NSM`],[2274,2274,`AN`],[2275,2306,`NSM`],[2362,2362,`NSM`],[2364,2364,`NSM`],[2369,2376,`NSM`],[2381,2381,`NSM`],[2385,2391,`NSM`],[2402,2403,`NSM`],[2433,2433,`NSM`],[2492,2492,`NSM`],[2497,2500,`NSM`],[2509,2509,`NSM`],[2530,2531,`NSM`],[2546,2547,`ET`],[2555,2555,`ET`],[2558,2558,`NSM`],[2561,2562,`NSM`],[2620,2620,`NSM`],[2625,2626,`NSM`],[2631,2632,`NSM`],[2635,2637,`NSM`],[2641,2641,`NSM`],[2672,2673,`NSM`],[2677,2677,`NSM`],[2689,2690,`NSM`],[2748,2748,`NSM`],[2753,2757,`NSM`],[2759,2760,`NSM`],[2765,2765,`NSM`],[2786,2787,`NSM`],[2801,2801,`ET`],[2810,2815,`NSM`],[2817,2817,`NSM`],[2876,2876,`NSM`],[2879,2879,`NSM`],[2881,2884,`NSM`],[2893,2893,`NSM`],[2901,2902,`NSM`],[2914,2915,`NSM`],[2946,2946,`NSM`],[3008,3008,`NSM`],[3021,3021,`NSM`],[3059,3064,`ON`],[3065,3065,`ET`],[3066,3066,`ON`],[3072,3072,`NSM`],[3076,3076,`NSM`],[3132,3132,`NSM`],[3134,3136,`NSM`],[3142,3144,`NSM`],[3146,3149,`NSM`],[3157,3158,`NSM`],[3170,3171,`NSM`],[3192,3198,`ON`],[3201,3201,`NSM`],[3260,3260,`NSM`],[3276,3277,`NSM`],[3298,3299,`NSM`],[3328,3329,`NSM`],[3387,3388,`NSM`],[3393,3396,`NSM`],[3405,3405,`NSM`],[3426,3427,`NSM`],[3457,3457,`NSM`],[3530,3530,`NSM`],[3538,3540,`NSM`],[3542,3542,`NSM`],[3633,3633,`NSM`],[3636,3642,`NSM`],[3647,3647,`ET`],[3655,3662,`NSM`],[3761,3761,`NSM`],[3764,3772,`NSM`],[3784,3790,`NSM`],[3864,3865,`NSM`],[3893,3893,`NSM`],[3895,3895,`NSM`],[3897,3897,`NSM`],[3898,3901,`ON`],[3953,3966,`NSM`],[3968,3972,`NSM`],[3974,3975,`NSM`],[3981,3991,`NSM`],[3993,4028,`NSM`],[4038,4038,`NSM`],[4141,4144,`NSM`],[4146,4151,`NSM`],[4153,4154,`NSM`],[4157,4158,`NSM`],[4184,4185,`NSM`],[4190,4192,`NSM`],[4209,4212,`NSM`],[4226,4226,`NSM`],[4229,4230,`NSM`],[4237,4237,`NSM`],[4253,4253,`NSM`],[4957,4959,`NSM`],[5008,5017,`ON`],[5120,5120,`ON`],[5760,5760,`WS`],[5787,5788,`ON`],[5906,5908,`NSM`],[5938,5939,`NSM`],[5970,5971,`NSM`],[6002,6003,`NSM`],[6068,6069,`NSM`],[6071,6077,`NSM`],[6086,6086,`NSM`],[6089,6099,`NSM`],[6107,6107,`ET`],[6109,6109,`NSM`],[6128,6137,`ON`],[6144,6154,`ON`],[6155,6157,`NSM`],[6158,6158,`BN`],[6159,6159,`NSM`],[6277,6278,`NSM`],[6313,6313,`NSM`],[6432,6434,`NSM`],[6439,6440,`NSM`],[6450,6450,`NSM`],[6457,6459,`NSM`],[6464,6464,`ON`],[6468,6469,`ON`],[6622,6655,`ON`],[6679,6680,`NSM`],[6683,6683,`NSM`],[6742,6742,`NSM`],[6744,6750,`NSM`],[6752,6752,`NSM`],[6754,6754,`NSM`],[6757,6764,`NSM`],[6771,6780,`NSM`],[6783,6783,`NSM`],[6832,6877,`NSM`],[6880,6891,`NSM`],[6912,6915,`NSM`],[6964,6964,`NSM`],[6966,6970,`NSM`],[6972,6972,`NSM`],[6978,6978,`NSM`],[7019,7027,`NSM`],[7040,7041,`NSM`],[7074,7077,`NSM`],[7080,7081,`NSM`],[7083,7085,`NSM`],[7142,7142,`NSM`],[7144,7145,`NSM`],[7149,7149,`NSM`],[7151,7153,`NSM`],[7212,7219,`NSM`],[7222,7223,`NSM`],[7376,7378,`NSM`],[7380,7392,`NSM`],[7394,7400,`NSM`],[7405,7405,`NSM`],[7412,7412,`NSM`],[7416,7417,`NSM`],[7616,7679,`NSM`],[8125,8125,`ON`],[8127,8129,`ON`],[8141,8143,`ON`],[8157,8159,`ON`],[8173,8175,`ON`],[8189,8190,`ON`],[8192,8202,`WS`],[8203,8205,`BN`],[8207,8207,`R`],[8208,8231,`ON`],[8232,8232,`WS`],[8233,8233,`B`],[8234,8238,`BN`],[8239,8239,`CS`],[8240,8244,`ET`],[8245,8259,`ON`],[8260,8260,`CS`],[8261,8286,`ON`],[8287,8287,`WS`],[8288,8303,`BN`],[8304,8304,`EN`],[8308,8313,`EN`],[8314,8315,`ES`],[8316,8318,`ON`],[8320,8329,`EN`],[8330,8331,`ES`],[8332,8334,`ON`],[8352,8399,`ET`],[8400,8432,`NSM`],[8448,8449,`ON`],[8451,8454,`ON`],[8456,8457,`ON`],[8468,8468,`ON`],[8470,8472,`ON`],[8478,8483,`ON`],[8485,8485,`ON`],[8487,8487,`ON`],[8489,8489,`ON`],[8494,8494,`ET`],[8506,8507,`ON`],[8512,8516,`ON`],[8522,8525,`ON`],[8528,8543,`ON`],[8585,8587,`ON`],[8592,8721,`ON`],[8722,8722,`ES`],[8723,8723,`ET`],[8724,9013,`ON`],[9083,9108,`ON`],[9110,9257,`ON`],[9280,9290,`ON`],[9312,9351,`ON`],[9352,9371,`EN`],[9450,9899,`ON`],[9901,10239,`ON`],[10496,11123,`ON`],[11126,11263,`ON`],[11493,11498,`ON`],[11503,11505,`NSM`],[11513,11519,`ON`],[11647,11647,`NSM`],[11744,11775,`NSM`],[11776,11869,`ON`],[11904,11929,`ON`],[11931,12019,`ON`],[12032,12245,`ON`],[12272,12287,`ON`],[12288,12288,`WS`],[12289,12292,`ON`],[12296,12320,`ON`],[12330,12333,`NSM`],[12336,12336,`ON`],[12342,12343,`ON`],[12349,12351,`ON`],[12441,12442,`NSM`],[12443,12444,`ON`],[12448,12448,`ON`],[12539,12539,`ON`],[12736,12773,`ON`],[12783,12783,`ON`],[12829,12830,`ON`],[12880,12895,`ON`],[12924,12926,`ON`],[12977,12991,`ON`],[13004,13007,`ON`],[13175,13178,`ON`],[13278,13279,`ON`],[13311,13311,`ON`],[19904,19967,`ON`],[42128,42182,`ON`],[42509,42511,`ON`],[42607,42610,`NSM`],[42611,42611,`ON`],[42612,42621,`NSM`],[42622,42623,`ON`],[42654,42655,`NSM`],[42736,42737,`NSM`],[42752,42785,`ON`],[42888,42888,`ON`],[43010,43010,`NSM`],[43014,43014,`NSM`],[43019,43019,`NSM`],[43045,43046,`NSM`],[43048,43051,`ON`],[43052,43052,`NSM`],[43064,43065,`ET`],[43124,43127,`ON`],[43204,43205,`NSM`],[43232,43249,`NSM`],[43263,43263,`NSM`],[43302,43309,`NSM`],[43335,43345,`NSM`],[43392,43394,`NSM`],[43443,43443,`NSM`],[43446,43449,`NSM`],[43452,43453,`NSM`],[43493,43493,`NSM`],[43561,43566,`NSM`],[43569,43570,`NSM`],[43573,43574,`NSM`],[43587,43587,`NSM`],[43596,43596,`NSM`],[43644,43644,`NSM`],[43696,43696,`NSM`],[43698,43700,`NSM`],[43703,43704,`NSM`],[43710,43711,`NSM`],[43713,43713,`NSM`],[43756,43757,`NSM`],[43766,43766,`NSM`],[43882,43883,`ON`],[44005,44005,`NSM`],[44008,44008,`NSM`],[44013,44013,`NSM`],[64285,64285,`R`],[64286,64286,`NSM`],[64287,64296,`R`],[64297,64297,`ES`],[64298,64335,`R`],[64336,64450,`AL`],[64451,64466,`ON`],[64467,64829,`AL`],[64830,64847,`ON`],[64848,64911,`AL`],[64912,64913,`ON`],[64914,64967,`AL`],[64968,64975,`ON`],[64976,65007,`BN`],[65008,65020,`AL`],[65021,65023,`ON`],[65024,65039,`NSM`],[65040,65049,`ON`],[65056,65071,`NSM`],[65072,65103,`ON`],[65104,65104,`CS`],[65105,65105,`ON`],[65106,65106,`CS`],[65108,65108,`ON`],[65109,65109,`CS`],[65110,65118,`ON`],[65119,65119,`ET`],[65120,65121,`ON`],[65122,65123,`ES`],[65124,65126,`ON`],[65128,65128,`ON`],[65129,65130,`ET`],[65131,65131,`ON`],[65136,65278,`AL`],[65279,65279,`BN`],[65281,65282,`ON`],[65283,65285,`ET`],[65286,65290,`ON`],[65291,65291,`ES`],[65292,65292,`CS`],[65293,65293,`ES`],[65294,65295,`CS`],[65296,65305,`EN`],[65306,65306,`CS`],[65307,65312,`ON`],[65339,65344,`ON`],[65371,65381,`ON`],[65504,65505,`ET`],[65506,65508,`ON`],[65509,65510,`ET`],[65512,65518,`ON`],[65520,65528,`BN`],[65529,65533,`ON`],[65534,65535,`BN`],[65793,65793,`ON`],[65856,65932,`ON`],[65936,65948,`ON`],[65952,65952,`ON`],[66045,66045,`NSM`],[66272,66272,`NSM`],[66273,66299,`EN`],[66422,66426,`NSM`],[67584,67870,`R`],[67871,67871,`ON`],[67872,68096,`R`],[68097,68099,`NSM`],[68100,68100,`R`],[68101,68102,`NSM`],[68103,68107,`R`],[68108,68111,`NSM`],[68112,68151,`R`],[68152,68154,`NSM`],[68155,68158,`R`],[68159,68159,`NSM`],[68160,68324,`R`],[68325,68326,`NSM`],[68327,68408,`R`],[68409,68415,`ON`],[68416,68863,`R`],[68864,68899,`AL`],[68900,68903,`NSM`],[68904,68911,`AL`],[68912,68921,`AN`],[68922,68927,`AL`],[68928,68937,`AN`],[68938,68968,`R`],[68969,68973,`NSM`],[68974,68974,`ON`],[68975,69215,`R`],[69216,69246,`AN`],[69247,69290,`R`],[69291,69292,`NSM`],[69293,69311,`R`],[69312,69327,`AL`],[69328,69336,`ON`],[69337,69369,`AL`],[69370,69375,`NSM`],[69376,69423,`R`],[69424,69445,`AL`],[69446,69456,`NSM`],[69457,69487,`AL`],[69488,69505,`R`],[69506,69509,`NSM`],[69510,69631,`R`],[69633,69633,`NSM`],[69688,69702,`NSM`],[69714,69733,`ON`],[69744,69744,`NSM`],[69747,69748,`NSM`],[69759,69761,`NSM`],[69811,69814,`NSM`],[69817,69818,`NSM`],[69826,69826,`NSM`],[69888,69890,`NSM`],[69927,69931,`NSM`],[69933,69940,`NSM`],[70003,70003,`NSM`],[70016,70017,`NSM`],[70070,70078,`NSM`],[70089,70092,`NSM`],[70095,70095,`NSM`],[70191,70193,`NSM`],[70196,70196,`NSM`],[70198,70199,`NSM`],[70206,70206,`NSM`],[70209,70209,`NSM`],[70367,70367,`NSM`],[70371,70378,`NSM`],[70400,70401,`NSM`],[70459,70460,`NSM`],[70464,70464,`NSM`],[70502,70508,`NSM`],[70512,70516,`NSM`],[70587,70592,`NSM`],[70606,70606,`NSM`],[70608,70608,`NSM`],[70610,70610,`NSM`],[70625,70626,`NSM`],[70712,70719,`NSM`],[70722,70724,`NSM`],[70726,70726,`NSM`],[70750,70750,`NSM`],[70835,70840,`NSM`],[70842,70842,`NSM`],[70847,70848,`NSM`],[70850,70851,`NSM`],[71090,71093,`NSM`],[71100,71101,`NSM`],[71103,71104,`NSM`],[71132,71133,`NSM`],[71219,71226,`NSM`],[71229,71229,`NSM`],[71231,71232,`NSM`],[71264,71276,`ON`],[71339,71339,`NSM`],[71341,71341,`NSM`],[71344,71349,`NSM`],[71351,71351,`NSM`],[71453,71453,`NSM`],[71455,71455,`NSM`],[71458,71461,`NSM`],[71463,71467,`NSM`],[71727,71735,`NSM`],[71737,71738,`NSM`],[71995,71996,`NSM`],[71998,71998,`NSM`],[72003,72003,`NSM`],[72148,72151,`NSM`],[72154,72155,`NSM`],[72160,72160,`NSM`],[72193,72198,`NSM`],[72201,72202,`NSM`],[72243,72248,`NSM`],[72251,72254,`NSM`],[72263,72263,`NSM`],[72273,72278,`NSM`],[72281,72283,`NSM`],[72330,72342,`NSM`],[72344,72345,`NSM`],[72544,72544,`NSM`],[72546,72548,`NSM`],[72550,72550,`NSM`],[72752,72758,`NSM`],[72760,72765,`NSM`],[72850,72871,`NSM`],[72874,72880,`NSM`],[72882,72883,`NSM`],[72885,72886,`NSM`],[73009,73014,`NSM`],[73018,73018,`NSM`],[73020,73021,`NSM`],[73023,73029,`NSM`],[73031,73031,`NSM`],[73104,73105,`NSM`],[73109,73109,`NSM`],[73111,73111,`NSM`],[73459,73460,`NSM`],[73472,73473,`NSM`],[73526,73530,`NSM`],[73536,73536,`NSM`],[73538,73538,`NSM`],[73562,73562,`NSM`],[73685,73692,`ON`],[73693,73696,`ET`],[73697,73713,`ON`],[78912,78912,`NSM`],[78919,78933,`NSM`],[90398,90409,`NSM`],[90413,90415,`NSM`],[92912,92916,`NSM`],[92976,92982,`NSM`],[94031,94031,`NSM`],[94095,94098,`NSM`],[94178,94178,`ON`],[94180,94180,`NSM`],[113821,113822,`NSM`],[113824,113827,`BN`],[117760,117973,`ON`],[118e3,118009,`EN`],[118010,118012,`ON`],[118016,118451,`ON`],[118458,118480,`ON`],[118496,118512,`ON`],[118528,118573,`NSM`],[118576,118598,`NSM`],[119143,119145,`NSM`],[119155,119162,`BN`],[119163,119170,`NSM`],[119173,119179,`NSM`],[119210,119213,`NSM`],[119273,119274,`ON`],[119296,119361,`ON`],[119362,119364,`NSM`],[119365,119365,`ON`],[119552,119638,`ON`],[120513,120513,`ON`],[120539,120539,`ON`],[120571,120571,`ON`],[120597,120597,`ON`],[120629,120629,`ON`],[120655,120655,`ON`],[120687,120687,`ON`],[120713,120713,`ON`],[120745,120745,`ON`],[120771,120771,`ON`],[120782,120831,`EN`],[121344,121398,`NSM`],[121403,121452,`NSM`],[121461,121461,`NSM`],[121476,121476,`NSM`],[121499,121503,`NSM`],[121505,121519,`NSM`],[122880,122886,`NSM`],[122888,122904,`NSM`],[122907,122913,`NSM`],[122915,122916,`NSM`],[122918,122922,`NSM`],[123023,123023,`NSM`],[123184,123190,`NSM`],[123566,123566,`NSM`],[123628,123631,`NSM`],[123647,123647,`ET`],[124140,124143,`NSM`],[124398,124399,`NSM`],[124643,124643,`NSM`],[124646,124646,`NSM`],[124654,124655,`NSM`],[124661,124661,`NSM`],[124928,125135,`R`],[125136,125142,`NSM`],[125143,125251,`R`],[125252,125258,`NSM`],[125259,126063,`R`],[126064,126143,`AL`],[126144,126207,`R`],[126208,126287,`AL`],[126288,126463,`R`],[126464,126703,`AL`],[126704,126705,`ON`],[126706,126719,`AL`],[126720,126975,`R`],[126976,127019,`ON`],[127024,127123,`ON`],[127136,127150,`ON`],[127153,127167,`ON`],[127169,127183,`ON`],[127185,127221,`ON`],[127232,127242,`EN`],[127243,127247,`ON`],[127279,127279,`ON`],[127338,127343,`ON`],[127405,127405,`ON`],[127584,127589,`ON`],[127744,128728,`ON`],[128732,128748,`ON`],[128752,128764,`ON`],[128768,128985,`ON`],[128992,129003,`ON`],[129008,129008,`ON`],[129024,129035,`ON`],[129040,129095,`ON`],[129104,129113,`ON`],[129120,129159,`ON`],[129168,129197,`ON`],[129200,129211,`ON`],[129216,129217,`ON`],[129232,129240,`ON`],[129280,129623,`ON`],[129632,129645,`ON`],[129648,129660,`ON`],[129664,129674,`ON`],[129678,129734,`ON`],[129736,129736,`ON`],[129741,129756,`ON`],[129759,129770,`ON`],[129775,129784,`ON`],[129792,129938,`ON`],[129940,130031,`ON`],[130032,130041,`EN`],[130042,130042,`ON`],[131070,131071,`BN`],[196606,196607,`BN`],[262142,262143,`BN`],[327678,327679,`BN`],[393214,393215,`BN`],[458750,458751,`BN`],[524286,524287,`BN`],[589822,589823,`BN`],[655358,655359,`BN`],[720894,720895,`BN`],[786430,786431,`BN`],[851966,851967,`BN`],[917502,917759,`BN`],[917760,917999,`NSM`],[918e3,921599,`BN`],[983038,983039,`BN`],[1048574,1048575,`BN`],[1114110,1114111,`BN`]];function Dde(e){if(e<=255)return Ede[e];let t=0,n=X4.length-1;for(;t<=n;){let r=t+n>>1,i=X4[r];if(ei[1]){t=r+1;continue}return i[2]}return`L`}function Ode(e){let t=e.length;if(t===0)return null;let n=Array(t),r=!1;for(let i=0;i=55296&&a<=56319&&i+1=56320&&t<=57343&&(o=(a-55296<<10)+(t-56320)+65536,s=2)}let c=Dde(o);(c===`R`||c===`AL`||c===`AN`)&&(r=!0);for(let e=0;e=0&&n[r]===`ET`;r--)n[r]=`EN`;for(r=e+1;r0?n[e-1]:s,a=r0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function Pde(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` +`)).then(e=>{e&&(he.value=!0,S(`copyConversationCopied`),ge!==null&&clearTimeout(ge),ge=setTimeout(()=>{ge=null,he.value=!1},2e3))}).catch(()=>{})}function ve(e){let t=[];for(let n=e;n>=0;n--){let e=o.turns[n];if(!e||e.role!==`assistant`)break;t.unshift(e)}return t}function ye(e){let t=ve(e);for(let e=t.length-1;e>=0;--e){let n=eoe(t[e]);if(n.trim())return n}return``}function be(){for(let e=o.turns.length-1;e>=0;--e)if(o.turns[e]?.role===`assistant`)return ye(e);return``}function xe(){let e=be();e.trim()&&Wi(e).then(e=>{e&&(he.value=!0,S(`copyConversationCopied`),ge!==null&&clearTimeout(ge),ge=setTimeout(()=>{ge=null,he.value=!1},2e3))}).catch(()=>{})}t({copyConversation:_e,copyFinalSummary:xe});function Se(e){let t=o.turns[e];if(!t||t.role!==`assistant`)return!1;let n=o.turns[e+1];return!n||n.role!==`assistant`}let Ce=null;function we(e){let t=o.turns[e];if(!t)return;let n=ye(e);n.trim()&&Wi(n).then(e=>{e&&(de.value=t.id,Ce!==null&&clearTimeout(Ce),Ce=setTimeout(()=>{Ce=null,de.value=null},1400))}).catch(()=>{})}function Te(e){let t=e.text;t.trim()&&Wi(t).then(t=>{t&&(de.value=e.id,Ce!==null&&clearTimeout(Ce),Ce=setTimeout(()=>{Ce=null,de.value=null},1400))}).catch(()=>{})}function Ee(e){return{kind:e.kind===`video`?`video`:`image`,url:e.url,path:e.name,fileId:e.fileId}}let De=R(null),Oe=null;function ke(e){if(e.kind===`image`||e.kind===`video`){S(`openMedia`,Ee(e));return}e.fileId!==void 0&&q4(e.fileId,e.name,e.mediaType).then(t=>{t===`unsupported`&&(De.value=e.name??e.fileId??``,Oe!==null&&clearTimeout(Oe),Oe=setTimeout(()=>{Oe=null,De.value=null},2400))})}function Ae(e,t){return e.id!==f.value||wO(t)?!1:t.sourceIndex===SO(e).length-1}function je(e){if(e.id!==f.value)return null;let t=SO(e),n=t.at(-1);if(n!==void 0&&wO(n))return null;if(n?.kind===`tool`&&n.tool.status===`running`){let e=n.tool.id;if(o.approvals.some(t=>t.toolCallId===e)||(o.questions??[]).some(t=>t.toolCallId===e))return null}return t.length-1}function Me(e){if(!e.createdAt)return;let t=Date.parse(e.createdAt);return Number.isFinite(t)?t:void 0}function q(e,t){if(e.id!==f.value)return!1;let n=t.items.at(-1);return n!==void 0&&wO(n)?!1:n!==void 0&&n.sourceIndex===SO(e).length-1}function Ne(){S(`continueTurn`,i(`conversation.turnFailedResumeText`))}return(t,n)=>(c(),W(M,null,[F(`div`,kue,[e.sessionLoading?(c(),W(`div`,Aue,[v(op,{size:`sm`}),F(`span`,jue,U(z(i)(`conversation.loading`)),1)])):e.turns.length===0&&(!e.approvals||e.approvals.length===0)?(c(),W(`div`,Mue)):E(``,!0),e.hasMoreMessages||e.loadingMore?(c(),W(`div`,{key:2,ref_key:`topSentinelRef`,ref:l,class:V([`top-sentinel`,{"top-sentinel-loading":e.loadingMore}])},[e.loadingMore?(c(),W(`span`,Nue,[v(op,{size:`sm`}),K(` `+U(z(i)(`conversation.loadingOlder`)),1)])):(c(),W(`button`,{key:0,type:`button`,class:`top-sentinel-btn`,onClick:n[0]||=e=>S(`loadOlderMessages`)},U(z(i)(`conversation.loadOlder`)),1))],2)):E(``,!0),(c(!0),W(M,null,_(e.turns,(t,r)=>(c(),W(M,{key:t.id},[t.role===`user`?(c(),W(M,{key:0},[F(`div`,Pue,[F(`div`,{class:V([`u-bub turn-anchor`,{undoing:fe.value===t.id}]),"data-turn-id":t.id},[t.attachments&&t.attachments.length>0?(c(),W(`div`,Iue,[(c(!0),W(M,null,_(t.attachments,(e,t)=>(c(),P(F4,{key:t,kind:e.kind,name:e.name,url:e.url,"file-id":e.fileId,"media-type":e.mediaType,size:e.size,onActivate:t=>ke(e)},null,8,[`kind`,`name`,`url`,`file-id`,`media-type`,`size`,`onActivate`]))),128))])):E(``,!0),t.pluginCommand?(c(),W(`div`,Lue,[F(`div`,Rue,[n[19]||=F(`span`,{class:`skill-act-arrow`},`▶`,-1),F(`span`,null,`/`+U(t.pluginCommand.pluginId)+`:`+U(t.pluginCommand.commandName),1)])])):E(``,!0),le(t)===null?E(``,!0):(c(),W(`div`,{key:2,ref_for:!0,ref:e=>j(t.id,e),class:V([`u-text-wrap`,{"u-text-wrap-args":!!t.pluginCommand,"is-clamped":D.value[t.id]&&!T.value[t.id]}])},[F(`div`,{class:V(t.pluginCommand?`skill-act-args`:`u-text`)},[v(I4,{text:le(t)??``,"open-file":e=>S(`openFile`,e)},null,8,[`text`,`open-file`])],2),D.value[t.id]?(c(),W(`button`,{key:0,type:`button`,class:`u-text-toggle`,"aria-expanded":!!T.value[t.id],onClick:e=>N(t.id)},[K(U(z(i)(T.value[t.id]?`conversation.userMessage.collapse`:`conversation.userMessage.expand`))+` `,1),v(X,{class:`u-text-toggle-car`,name:`chevron-down`,size:`sm`})],8,zue)):E(``,!0)],2))],10,Fue),t.createdAt||ce(t)?(c(),W(`div`,Bue,[ce(t)?(c(),W(`div`,{key:0,class:V([`u-edit-wrap`,{undoing:fe.value===t.id}])},[F(`button`,{type:`button`,class:`u-edit`,"aria-label":z(i)(`conversation.undoTooltip`),onClick:e=>pe(t)},[v(X,{name:`undo`,size:`sm`})],8,Vue)],2)):E(``,!0),t.text.trim().length>0?(c(),W(`button`,{key:1,type:`button`,class:`u-copy`,"aria-label":z(i)(`filePreview.copy`),onClick:H(e=>Te(t),[`stop`])},[de.value===t.id?(c(),P(X,{key:1,name:`check`,size:`sm`})):(c(),P(X,{key:0,name:`copy`,size:`sm`}))],8,Hue)):E(``,!0),t.createdAt?(c(),P(T4,{key:2,time:t.createdAt},null,8,[`time`])):E(``,!0)])):E(``,!0)]),w(t)?(c(),W(`div`,Uue,[v(V4,{run:w(t),models:e.expertTalkModels,onTake:n[1]||=e=>S(`takeExpertTalk`,e),onBuild:n[2]||=e=>S(`buildExpertTalk`,e)},null,8,[`run`,`models`])])):E(``,!0)],64)):t.role===`compaction`?(c(),W(`div`,{key:1,class:`compact-divider turn-anchor`,"data-turn-id":t.id,role:`separator`},[n[20]||=F(`span`,{class:`cd-line`,"aria-hidden":`true`},null,-1),t.text?(c(),W(`button`,{key:0,type:`button`,class:`cd-label cd-btn`,onClick:e=>S(`openCompaction`,{turnId:t.id})},[F(`span`,null,U(ue(t)),1),F(`span`,Kue,U(z(i)(`conversation.viewSummary`)),1)],8,Gue)):(c(),W(`span`,que,U(ue(t)),1)),n[21]||=F(`span`,{class:`cd-line`,"aria-hidden":`true`},null,-1)],8,Wue)):t.role===`cron`?(c(),P(Kse,{key:2,text:t.text,cron:t.cron,"turn-id":t.id,"created-at":t.createdAt},null,8,[`text`,`cron`,`turn-id`,`created-at`])):t.role===`assistant`&&w(t)?(c(),W(M,{key:3},[],64)):(c(),W(`div`,{key:4,class:`a-msg turn-anchor`,"data-turn-id":t.id},[v(Qce,{items:b.value.get(t.id)?.folded??[],live:t.id===f.value,parked:t.id===f.value&&je(t)===null,"streaming-tail-index":je(t),"seed-ms":z(Zae)(t),"created-ms":Me(t),"duration-ms":t.durationMs,"tool-diff-panel":e.toolDiffPanel,mobile:``,onOpenMedia:n[3]||=e=>S(`openMedia`,e),onOpenFile:n[4]||=e=>S(`openFile`,e),onOpenToolDiff:n[5]||=e=>S(`openToolDiff`,e),onOpenAgent:n[6]||=e=>S(`openAgent`,e),onDetach:n[7]||=e=>S(`detachTask`,e)},null,8,[`items`,`live`,`parked`,`streaming-tail-index`,`seed-ms`,`created-ms`,`duration-ms`,`tool-diff-panel`]),(c(!0),W(M,null,_(b.value.get(t.id)?.visible??[],(r,i)=>(c(),W(M,{key:z(DO)(r,i)},[r.kind===`thinking`?(c(),P(AO,{key:0,text:r.thinking,mobile:``,streaming:Ae(t,r),"started-at-ms":z(CO)(r.startedAt),"duration-ms":r.durationMs},null,8,[`text`,`streaming`,`started-at-ms`,`duration-ms`])):r.kind===`text`&&r.text?(c(),W(`div`,Yue,[v(w4,{text:r.text,streaming:Ae(t,r),"open-file":e=>S(`openFile`,e)},null,8,[`text`,`streaming`,`open-file`])])):r.kind===`activity-run`?(c(),P(jO,{key:2,items:r.items,mobile:``,streaming:q(t,r),"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[8]||=e=>S(`openMedia`,e),onOpenFile:n[9]||=e=>S(`openFile`,e),onOpenToolDiff:n[10]||=e=>S(`openToolDiff`,e),onOpenAgent:n[11]||=e=>S(`openAgent`,e),onDetach:n[12]||=e=>S(`detachTask`,e)},null,8,[`items`,`streaming`,`tool-diff-panel`])):r.kind===`tool`?(c(),P(vO,{key:3,tool:r.tool,mobile:``,"tool-diff-panel":e.toolDiffPanel,onOpenMedia:n[13]||=e=>S(`openMedia`,e),onOpenFile:n[14]||=e=>S(`openFile`,e),onOpenToolDiff:n[15]||=e=>S(`openToolDiff`,e),onOpenAgent:n[16]||=e=>S(`openAgent`,e),onDetach:n[17]||=e=>S(`detachTask`,e)},null,8,[`tool`,`tool-diff-panel`])):r.kind===`notification`?(c(),P(N4,{key:4,items:r.items},null,8,[`items`])):E(``,!0)],64))),128)),t.id!==f.value&&(b.value.get(t.id)?.changes.length??0)>0?(c(),P(hle,{key:0,changes:b.value.get(t.id)?.changes??[],cwd:e.cwd,onOpenDiff:e=>S(`openTurnDiff`,{turnId:t.id,changes:b.value.get(t.id)?.changes??[]}),onOpenFile:n[18]||=e=>S(`openFile`,e)},null,8,[`changes`,`cwd`,`onOpenDiff`])):E(``,!0),t.id!==f.value&&Se(r)&&(ye(r).trim().length>0||t.durationMs!==void 0)?(c(),W(`div`,Xue,[v(Sp,{text:`${t.durationMs} ms`},{default:B(()=>[t.durationMs===void 0?E(``,!0):(c(),W(`span`,Zue,U(z(Xae)(t.durationMs)),1))]),_:2},1032,[`text`]),ye(r).trim().length>0?(c(),W(`button`,{key:0,class:`a-cpbtn`,"aria-label":z(i)(`filePreview.copy`),onClick:e=>we(r)},[de.value===t.id?(c(),P(X,{key:1,name:`check`,size:`sm`})):(c(),P(X,{key:0,name:`copy`,size:`sm`}))],8,Que)):E(``,!0)])):E(``,!0)],8,Jue))],64))),128)),e.lastTurnReason===`failed`&&!e.working?(c(),W(`div`,$ue,[F(`span`,ede,[v(X,{name:`alert-triangle`,size:`sm`})]),F(`div`,tde,[F(`span`,nde,U(e.turnErrorKind===`max_steps`?z(i)(`conversation.turnFailedMaxSteps`):z(i)(`conversation.turnFailed`)),1),e.turnErrorMessage?(c(),W(`span`,{key:0,class:`tf-sub`,title:e.turnErrorMessage},U(e.turnErrorMessage),9,rde)):E(``,!0)]),v(pD,{variant:`secondary`,size:`sm`,onClick:Ne},{default:B(()=>[K(U(z(i)(`conversation.turnFailedResume`)),1)]),_:1})])):E(``,!0),e.compaction?(c(),P(Mse,{key:4,label:z(i)(`conversation.compacting`)},null,8,[`label`])):E(``,!0),m.value?(c(),W(`div`,ide,[v(wle,{label:x.value,state:yde},null,8,[`label`])])):E(``,!0),e.queued.length>0?(c(),W(`div`,ade,[F(`div`,ode,[F(`span`,sde,[v(X,{name:`mail`,size:`sm`}),K(` `+U(z(i)(`composer.queueLabel`))+` · `,1),F(`b`,null,U(z(i)(`composer.queuePending`,{n:e.queued.length})),1)])]),(c(!0),W(M,null,_(e.queued,(e,t)=>(c(),W(`div`,{key:e.id,class:V([`u-turn q-turn`,{"q-dragging":ee.value===t,"drop-before":I.value?.index===t&&I.value.position===`before`,"drop-after":I.value?.index===t&&I.value.position===`after`}]),onDragover:e=>ie(t,e),onDrop:e=>ae(t,e)},[t===0?(c(),P(Sp,{key:0,text:z(i)(`composer.queueSteer`)},{default:B(()=>[F(`button`,{type:`button`,class:`q-send`,"aria-label":z(i)(`composer.queueSteer`),onClick:H(e=>S(`steerQueued`,t),[`stop`])},[v(X,{name:`send`,size:`lg`})],8,lde)]),_:2},1032,[`text`])):E(``,!0),F(`div`,ude,[F(`span`,{class:`q-grip`,title:z(i)(`composer.queueDragTitle`),draggable:`true`,onDragstart:e=>re(t,e),onDragend:oe},[v(X,{name:`grip`,size:`sm`})],40,dde),F(`button`,{type:`button`,class:`q-body`,title:z(i)(`composer.editQueued`),onClick:e=>ne(t)},[e.text?(c(),W(`span`,pde,[v(I4,{text:e.text,interactive:!1},null,8,[`text`])])):(c(),W(`span`,mde,[v(X,{name:`file`,size:`sm`}),K(` `+U(z(i)(`composer.queuedAttachments`,{n:e.attachments?.length??0})),1)]))],8,fde),te(e)?(c(),W(`div`,hde,[(c(!0),W(M,null,_(e.attachments,(e,t)=>(c(),W(M,{key:t},[e.kind===`file`?(c(),W(`span`,gde,[v(X,{name:`file`,size:`sm`}),K(` `+U(e.name??e.fileId),1)])):(c(),P(P4,{key:1,url:e.url,kind:e.kind,"file-id":e.fileId,"media-class":`q-img`,controls:!1,muted:``},null,8,[`url`,`kind`,`file-id`]))],64))),128))])):E(``,!0),F(`button`,{type:`button`,class:`q-rm`,"aria-label":z(i)(`composer.remove`),onClick:H(e=>S(`unqueue`,t),[`stop`])},[v(X,{name:`close`,size:`sm`})],8,_de)])],42,cde))),128))])):E(``,!0)]),De.value===null?E(``,!0):(c(),W(`div`,vde,U(z(i)(`composer.attachmentOpenUnsupported`,{name:De.value})),1))],64))}}),[[`__scopeId`,`data-v-01f8f83d`]]),xde={class:`ch-id`},Sde={key:0,class:`ch-ws`},Cde={key:1,class:`ch-sep`},wde=[`onKeydown`],Tde={class:`ch-ses`},Ede={key:0,class:`ch-pill ch-sync-pill`},Dde={key:0,class:`ch-ahead`},Ode={key:1,class:`ch-behind`},kde={key:1,class:`ch-pill ch-diff-pill`},Ade={key:0,class:`ch-add`},jde={key:1,class:`ch-del`},Mde={class:`ch-pill ch-pr pr-merged ch-done-pill`},Nde=Y(G({__name:`ChatHeader`,props:{sessionId:{},workspaceName:{},workspaceRoot:{},sessionTitle:{},branch:{},ahead:{},behind:{},changesCount:{},gitDiffStats:{},isGitRepo:{type:Boolean},pr:{},copied:{type:Boolean},sessionDone:{type:Boolean},pinned:{type:Boolean},panelVisible:{type:Boolean}},emits:[`copyAll`,`copyFinalSummary`,`openChanges`,`openPr`,`renameSession`,`forkSession`,`togglePin`,`archiveSession`,`restoreSession`,`exportSession`,`togglePanel`],setup(e,{emit:t}){let{t:r}=J(),i=e,a=t,o=L(()=>i.ahead??0),s=L(()=>i.behind??0),u=L(()=>i.gitDiffStats?.totalAdditions??0),d=L(()=>i.gitDiffStats?.totalDeletions??0),f=L(()=>u.value>0||d.value>0),p={open:`header.prStatusOpen`,closed:`header.prStatusClosed`,merged:`header.prStatusMerged`,draft:`header.prStatusDraft`};function m(e){return e.trim().toLowerCase().replaceAll(`_`,`-`)}function g(e){let t=m(e);return p[t]?`pr-${t}`:`pr-unknown`}function _(e){return r(p[m(e)]??`header.prStatusUnknown`)}let y=R(!1),b=R(null),x=R(null),S=R({});function C(e){let t=e.target;x.value?.el?.contains(t)||b.value?.el?.contains(t)||D()}function w(){D()}async function T(e){if(e.stopPropagation(),y.value){D();return}y.value=!0,document.addEventListener(`mousedown`,C),window.addEventListener(`resize`,w),await n();let t=b.value?.el,r=x.value?.el;if(!t||!r)return;let i=t.getBoundingClientRect(),a=r.offsetWidth,o=r.offsetHeight,s=i.bottom+4;s+o>window.innerHeight-8&&(s=Math.max(8,i.top-o-4));let c=i.left;c+a>window.innerWidth-8&&(c=Math.max(8,i.right-a)),S.value={top:`${Math.round(s)}px`,left:`${Math.round(c)}px`}}function D(){y.value=!1,document.removeEventListener(`mousedown`,C),window.removeEventListener(`resize`,w)}h(()=>{document.removeEventListener(`mousedown`,C),window.removeEventListener(`resize`,w)});function O(){a(`copyAll`),D()}function k(){a(`copyFinalSummary`),D()}let A=R(!1);function j(){i.sessionId&&Wi(i.sessionId).then(e=>{e&&(A.value=!0,setTimeout(()=>{A.value=!1},1200))})}let N=R(!1),ee=R(``),I=R(null);async function te(){if(D(),i.sessionId){N.value=!0,ee.value=i.sessionTitle??``,await n();try{I.value?.focus(),I.value?.select()}catch{}}}function ne(){let e=ee.value.trim();e&&i.sessionId&&e!==(i.sessionTitle??``).trim()&&a(`renameSession`,i.sessionId,e),N.value=!1}function re(){N.value=!1}function oe(){i.sessionId&&(D(),a(`forkSession`,i.sessionId))}function se(){i.sessionId&&(D(),a(`exportSession`,i.sessionId))}function ce(){i.sessionId&&(D(),a(`togglePin`,i.sessionId))}function le(){i.sessionId&&(D(),a(`archiveSession`,i.sessionId))}function ue(){i.sessionId&&(D(),a(`restoreSession`,i.sessionId))}return(t,n)=>(c(),W(`header`,{class:V([`chat-header`,{"macos-desktop":z(KE)}])},[F(`div`,xde,[e.workspaceName?(c(),W(`span`,Sde,U(e.workspaceName),1)):E(``,!0),e.workspaceName&&e.sessionTitle?(c(),W(`span`,Cde,`/`)):E(``,!0),N.value?l((c(),W(`input`,{key:2,ref_key:`renameInputRef`,ref:I,"onUpdate:modelValue":n[0]||=e=>ee.value=e,class:`ch-rename`,type:`text`,onKeydown:[ie(H(ne,[`stop`]),[`enter`]),ie(H(re,[`stop`]),[`esc`])],onBlur:ne,onClick:n[1]||=H(()=>{},[`stop`])},null,40,wde)),[[de,ee.value]]):e.sessionTitle?(c(),P(Sp,{key:3,text:e.sessionTitle},{default:B(()=>[F(`span`,Tde,U(e.sessionTitle),1)]),_:1},8,[`text`])):E(``,!0)]),v(Ca,{ref_key:`kebabRef`,ref:b,class:V([`ch-act-more`,{open:y.value}]),label:z(r)(`header.options`),"aria-expanded":y.value,"aria-haspopup":`menu`,onClick:n[2]||=H(e=>T(e),[`stop`])},{default:B(()=>[v(X,{name:`dots-horizontal`,size:`md`})]),_:1},8,[`class`,`label`,`aria-expanded`]),y.value?(c(),P(hp,{key:0,ref_key:`menuRef`,ref:x,class:`ch-menu`,style:ae(S.value),onClick:n[3]||=H(()=>{},[`stop`])},{default:B(()=>[v(vp,{onClick:O},{default:B(()=>[v(X,{name:e.copied?`check`:`copy`,size:`sm`},null,8,[`name`]),K(` `+U(e.copied?z(r)(`header.copied`):z(r)(`header.copyAll`)),1)]),_:1}),v(vp,{onClick:k},{default:B(()=>[v(X,{name:`file-text`,size:`sm`}),K(` `+U(z(r)(`header.copyFinalSummary`)),1)]),_:1}),e.sessionId?(c(),W(M,{key:0},[v(vp,{separator:``}),v(vp,{onClick:j},{default:B(()=>[v(X,{name:A.value?`check`:`copy`,size:`sm`},null,8,[`name`]),K(` `+U(A.value?z(r)(`header.copied`):z(r)(`header.copySessionId`)),1)]),_:1}),e.sessionDone?E(``,!0):(c(),P(vp,{key:0,onClick:ce},{default:B(()=>[v(X,{name:e.pinned?`pushpin-fill`:`pushpin-line`,size:`sm`},null,8,[`name`]),K(` `+U(e.pinned?z(r)(`header.unpinSession`):z(r)(`header.pinSession`)),1)]),_:1})),v(vp,{onClick:te},{default:B(()=>[v(X,{name:`pencil`,size:`sm`}),K(` `+U(z(r)(`header.renameSession`)),1)]),_:1}),v(vp,{onClick:oe},{default:B(()=>[v(X,{name:`git-fork`,size:`sm`}),K(` `+U(z(r)(`header.forkSession`)),1)]),_:1}),v(vp,{onClick:se},{default:B(()=>[v(X,{name:`download`,size:`sm`}),K(` `+U(z(r)(`header.exportSession`)),1)]),_:1}),e.sessionDone?(c(),P(vp,{key:1,onClick:ue},{default:B(()=>[v(X,{name:`undo`,size:`sm`}),K(` `+U(z(r)(`header.reopenSession`)),1)]),_:1})):(c(),P(vp,{key:2,onClick:le},{default:B(()=>[v(X,{name:`archive`,size:`sm`}),K(` `+U(z(r)(`header.markSessionDone`)),1)]),_:1}))],64)):E(``,!0)]),_:1},8,[`style`])):E(``,!0),n[7]||=F(`div`,{class:`ch-spacer`},null,-1),e.isGitRepo?(c(),W(`button`,{key:1,type:`button`,class:`ch-git`,onClick:n[4]||=e=>a(`openChanges`)},[F(`span`,{class:V([`ch-branch`,{"ch-detached":!e.branch}])},U(e.branch||z(r)(`header.detached`)),3),o.value>0||s.value>0?(c(),W(`span`,Ede,[o.value>0?(c(),W(`span`,Dde,`↑`+U(o.value),1)):E(``,!0),s.value>0?(c(),W(`span`,Ode,`↓`+U(s.value),1)):E(``,!0)])):E(``,!0),f.value?(c(),W(`span`,kde,[u.value>0?(c(),W(`span`,Ade,`+`+U(u.value),1)):E(``,!0),d.value>0?(c(),W(`span`,jde,`-`+U(d.value),1)):E(``,!0)])):E(``,!0)])):E(``,!0),e.pr?(c(),W(`button`,{key:2,type:`button`,class:V([`ch-pill ch-pr`,g(e.pr.state)]),onClick:n[5]||=t=>e.pr&&a(`openPr`,e.pr.url)},[v(X,{name:`git-pull-request`,size:`sm`}),F(`span`,null,`PR #`+U(e.pr.number)+` · `+U(_(e.pr.state)),1)],2)):E(``,!0),e.sessionId&&e.sessionDone?(c(),W(M,{key:3},[F(`span`,Mde,[v(X,{name:`circle-check`,size:`sm`}),F(`span`,null,U(z(r)(`header.sessionDone`)),1)]),v(pD,{variant:`secondary`,size:`sm`,onClick:ue},{default:B(()=>[v(X,{name:`undo`,size:`sm`}),K(` `+U(z(r)(`header.reopenSession`)),1)]),_:1})],64)):E(``,!0),e.panelVisible?E(``,!0):(c(),P(Ca,{key:4,class:`ch-panel`,label:z(r)(`panel.openPanel`),onClick:n[6]||=e=>a(`togglePanel`)},{default:B(()=>[v(X,{name:`panel-expand-right`,size:`md`})]),_:1},8,[`label`]))],2))}}),[[`__scopeId`,`data-v-28de58d9`]]),Pde=`BN.BN.BN.BN.BN.BN.BN.BN.BN.S.B.S.WS.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.B.B.B.S.WS.ON.ON.ET.ET.ET.ON.ON.ON.ON.ON.ES.CS.ES.CS.CS.EN.EN.EN.EN.EN.EN.EN.EN.EN.EN.CS.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.ON.ON.ON.BN.BN.BN.BN.BN.BN.B.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.BN.CS.ON.ET.ET.ET.ET.ON.ON.ON.ON.L.ON.ON.BN.ON.ON.ET.ET.EN.EN.ON.L.ON.ON.ON.EN.L.ON.ON.ON.ON.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.ON.L.L.L.L.L.L.L.L`.split(`.`),Y4=[[697,698,`ON`],[706,719,`ON`],[722,735,`ON`],[741,749,`ON`],[751,767,`ON`],[768,879,`NSM`],[884,885,`ON`],[894,894,`ON`],[900,901,`ON`],[903,903,`ON`],[1014,1014,`ON`],[1155,1161,`NSM`],[1418,1418,`ON`],[1421,1422,`ON`],[1423,1423,`ET`],[1424,1424,`R`],[1425,1469,`NSM`],[1470,1470,`R`],[1471,1471,`NSM`],[1472,1472,`R`],[1473,1474,`NSM`],[1475,1475,`R`],[1476,1477,`NSM`],[1478,1478,`R`],[1479,1479,`NSM`],[1480,1535,`R`],[1536,1541,`AN`],[1542,1543,`ON`],[1544,1544,`AL`],[1545,1546,`ET`],[1547,1547,`AL`],[1548,1548,`CS`],[1549,1549,`AL`],[1550,1551,`ON`],[1552,1562,`NSM`],[1563,1610,`AL`],[1611,1631,`NSM`],[1632,1641,`AN`],[1642,1642,`ET`],[1643,1644,`AN`],[1645,1647,`AL`],[1648,1648,`NSM`],[1649,1749,`AL`],[1750,1756,`NSM`],[1757,1757,`AN`],[1758,1758,`ON`],[1759,1764,`NSM`],[1765,1766,`AL`],[1767,1768,`NSM`],[1769,1769,`ON`],[1770,1773,`NSM`],[1774,1775,`AL`],[1776,1785,`EN`],[1786,1808,`AL`],[1809,1809,`NSM`],[1810,1839,`AL`],[1840,1866,`NSM`],[1867,1957,`AL`],[1958,1968,`NSM`],[1969,1983,`AL`],[1984,2026,`R`],[2027,2035,`NSM`],[2036,2037,`R`],[2038,2041,`ON`],[2042,2044,`R`],[2045,2045,`NSM`],[2046,2069,`R`],[2070,2073,`NSM`],[2074,2074,`R`],[2075,2083,`NSM`],[2084,2084,`R`],[2085,2087,`NSM`],[2088,2088,`R`],[2089,2093,`NSM`],[2094,2136,`R`],[2137,2139,`NSM`],[2140,2143,`R`],[2144,2191,`AL`],[2192,2193,`AN`],[2194,2198,`AL`],[2199,2207,`NSM`],[2208,2249,`AL`],[2250,2273,`NSM`],[2274,2274,`AN`],[2275,2306,`NSM`],[2362,2362,`NSM`],[2364,2364,`NSM`],[2369,2376,`NSM`],[2381,2381,`NSM`],[2385,2391,`NSM`],[2402,2403,`NSM`],[2433,2433,`NSM`],[2492,2492,`NSM`],[2497,2500,`NSM`],[2509,2509,`NSM`],[2530,2531,`NSM`],[2546,2547,`ET`],[2555,2555,`ET`],[2558,2558,`NSM`],[2561,2562,`NSM`],[2620,2620,`NSM`],[2625,2626,`NSM`],[2631,2632,`NSM`],[2635,2637,`NSM`],[2641,2641,`NSM`],[2672,2673,`NSM`],[2677,2677,`NSM`],[2689,2690,`NSM`],[2748,2748,`NSM`],[2753,2757,`NSM`],[2759,2760,`NSM`],[2765,2765,`NSM`],[2786,2787,`NSM`],[2801,2801,`ET`],[2810,2815,`NSM`],[2817,2817,`NSM`],[2876,2876,`NSM`],[2879,2879,`NSM`],[2881,2884,`NSM`],[2893,2893,`NSM`],[2901,2902,`NSM`],[2914,2915,`NSM`],[2946,2946,`NSM`],[3008,3008,`NSM`],[3021,3021,`NSM`],[3059,3064,`ON`],[3065,3065,`ET`],[3066,3066,`ON`],[3072,3072,`NSM`],[3076,3076,`NSM`],[3132,3132,`NSM`],[3134,3136,`NSM`],[3142,3144,`NSM`],[3146,3149,`NSM`],[3157,3158,`NSM`],[3170,3171,`NSM`],[3192,3198,`ON`],[3201,3201,`NSM`],[3260,3260,`NSM`],[3276,3277,`NSM`],[3298,3299,`NSM`],[3328,3329,`NSM`],[3387,3388,`NSM`],[3393,3396,`NSM`],[3405,3405,`NSM`],[3426,3427,`NSM`],[3457,3457,`NSM`],[3530,3530,`NSM`],[3538,3540,`NSM`],[3542,3542,`NSM`],[3633,3633,`NSM`],[3636,3642,`NSM`],[3647,3647,`ET`],[3655,3662,`NSM`],[3761,3761,`NSM`],[3764,3772,`NSM`],[3784,3790,`NSM`],[3864,3865,`NSM`],[3893,3893,`NSM`],[3895,3895,`NSM`],[3897,3897,`NSM`],[3898,3901,`ON`],[3953,3966,`NSM`],[3968,3972,`NSM`],[3974,3975,`NSM`],[3981,3991,`NSM`],[3993,4028,`NSM`],[4038,4038,`NSM`],[4141,4144,`NSM`],[4146,4151,`NSM`],[4153,4154,`NSM`],[4157,4158,`NSM`],[4184,4185,`NSM`],[4190,4192,`NSM`],[4209,4212,`NSM`],[4226,4226,`NSM`],[4229,4230,`NSM`],[4237,4237,`NSM`],[4253,4253,`NSM`],[4957,4959,`NSM`],[5008,5017,`ON`],[5120,5120,`ON`],[5760,5760,`WS`],[5787,5788,`ON`],[5906,5908,`NSM`],[5938,5939,`NSM`],[5970,5971,`NSM`],[6002,6003,`NSM`],[6068,6069,`NSM`],[6071,6077,`NSM`],[6086,6086,`NSM`],[6089,6099,`NSM`],[6107,6107,`ET`],[6109,6109,`NSM`],[6128,6137,`ON`],[6144,6154,`ON`],[6155,6157,`NSM`],[6158,6158,`BN`],[6159,6159,`NSM`],[6277,6278,`NSM`],[6313,6313,`NSM`],[6432,6434,`NSM`],[6439,6440,`NSM`],[6450,6450,`NSM`],[6457,6459,`NSM`],[6464,6464,`ON`],[6468,6469,`ON`],[6622,6655,`ON`],[6679,6680,`NSM`],[6683,6683,`NSM`],[6742,6742,`NSM`],[6744,6750,`NSM`],[6752,6752,`NSM`],[6754,6754,`NSM`],[6757,6764,`NSM`],[6771,6780,`NSM`],[6783,6783,`NSM`],[6832,6877,`NSM`],[6880,6891,`NSM`],[6912,6915,`NSM`],[6964,6964,`NSM`],[6966,6970,`NSM`],[6972,6972,`NSM`],[6978,6978,`NSM`],[7019,7027,`NSM`],[7040,7041,`NSM`],[7074,7077,`NSM`],[7080,7081,`NSM`],[7083,7085,`NSM`],[7142,7142,`NSM`],[7144,7145,`NSM`],[7149,7149,`NSM`],[7151,7153,`NSM`],[7212,7219,`NSM`],[7222,7223,`NSM`],[7376,7378,`NSM`],[7380,7392,`NSM`],[7394,7400,`NSM`],[7405,7405,`NSM`],[7412,7412,`NSM`],[7416,7417,`NSM`],[7616,7679,`NSM`],[8125,8125,`ON`],[8127,8129,`ON`],[8141,8143,`ON`],[8157,8159,`ON`],[8173,8175,`ON`],[8189,8190,`ON`],[8192,8202,`WS`],[8203,8205,`BN`],[8207,8207,`R`],[8208,8231,`ON`],[8232,8232,`WS`],[8233,8233,`B`],[8234,8238,`BN`],[8239,8239,`CS`],[8240,8244,`ET`],[8245,8259,`ON`],[8260,8260,`CS`],[8261,8286,`ON`],[8287,8287,`WS`],[8288,8303,`BN`],[8304,8304,`EN`],[8308,8313,`EN`],[8314,8315,`ES`],[8316,8318,`ON`],[8320,8329,`EN`],[8330,8331,`ES`],[8332,8334,`ON`],[8352,8399,`ET`],[8400,8432,`NSM`],[8448,8449,`ON`],[8451,8454,`ON`],[8456,8457,`ON`],[8468,8468,`ON`],[8470,8472,`ON`],[8478,8483,`ON`],[8485,8485,`ON`],[8487,8487,`ON`],[8489,8489,`ON`],[8494,8494,`ET`],[8506,8507,`ON`],[8512,8516,`ON`],[8522,8525,`ON`],[8528,8543,`ON`],[8585,8587,`ON`],[8592,8721,`ON`],[8722,8722,`ES`],[8723,8723,`ET`],[8724,9013,`ON`],[9083,9108,`ON`],[9110,9257,`ON`],[9280,9290,`ON`],[9312,9351,`ON`],[9352,9371,`EN`],[9450,9899,`ON`],[9901,10239,`ON`],[10496,11123,`ON`],[11126,11263,`ON`],[11493,11498,`ON`],[11503,11505,`NSM`],[11513,11519,`ON`],[11647,11647,`NSM`],[11744,11775,`NSM`],[11776,11869,`ON`],[11904,11929,`ON`],[11931,12019,`ON`],[12032,12245,`ON`],[12272,12287,`ON`],[12288,12288,`WS`],[12289,12292,`ON`],[12296,12320,`ON`],[12330,12333,`NSM`],[12336,12336,`ON`],[12342,12343,`ON`],[12349,12351,`ON`],[12441,12442,`NSM`],[12443,12444,`ON`],[12448,12448,`ON`],[12539,12539,`ON`],[12736,12773,`ON`],[12783,12783,`ON`],[12829,12830,`ON`],[12880,12895,`ON`],[12924,12926,`ON`],[12977,12991,`ON`],[13004,13007,`ON`],[13175,13178,`ON`],[13278,13279,`ON`],[13311,13311,`ON`],[19904,19967,`ON`],[42128,42182,`ON`],[42509,42511,`ON`],[42607,42610,`NSM`],[42611,42611,`ON`],[42612,42621,`NSM`],[42622,42623,`ON`],[42654,42655,`NSM`],[42736,42737,`NSM`],[42752,42785,`ON`],[42888,42888,`ON`],[43010,43010,`NSM`],[43014,43014,`NSM`],[43019,43019,`NSM`],[43045,43046,`NSM`],[43048,43051,`ON`],[43052,43052,`NSM`],[43064,43065,`ET`],[43124,43127,`ON`],[43204,43205,`NSM`],[43232,43249,`NSM`],[43263,43263,`NSM`],[43302,43309,`NSM`],[43335,43345,`NSM`],[43392,43394,`NSM`],[43443,43443,`NSM`],[43446,43449,`NSM`],[43452,43453,`NSM`],[43493,43493,`NSM`],[43561,43566,`NSM`],[43569,43570,`NSM`],[43573,43574,`NSM`],[43587,43587,`NSM`],[43596,43596,`NSM`],[43644,43644,`NSM`],[43696,43696,`NSM`],[43698,43700,`NSM`],[43703,43704,`NSM`],[43710,43711,`NSM`],[43713,43713,`NSM`],[43756,43757,`NSM`],[43766,43766,`NSM`],[43882,43883,`ON`],[44005,44005,`NSM`],[44008,44008,`NSM`],[44013,44013,`NSM`],[64285,64285,`R`],[64286,64286,`NSM`],[64287,64296,`R`],[64297,64297,`ES`],[64298,64335,`R`],[64336,64450,`AL`],[64451,64466,`ON`],[64467,64829,`AL`],[64830,64847,`ON`],[64848,64911,`AL`],[64912,64913,`ON`],[64914,64967,`AL`],[64968,64975,`ON`],[64976,65007,`BN`],[65008,65020,`AL`],[65021,65023,`ON`],[65024,65039,`NSM`],[65040,65049,`ON`],[65056,65071,`NSM`],[65072,65103,`ON`],[65104,65104,`CS`],[65105,65105,`ON`],[65106,65106,`CS`],[65108,65108,`ON`],[65109,65109,`CS`],[65110,65118,`ON`],[65119,65119,`ET`],[65120,65121,`ON`],[65122,65123,`ES`],[65124,65126,`ON`],[65128,65128,`ON`],[65129,65130,`ET`],[65131,65131,`ON`],[65136,65278,`AL`],[65279,65279,`BN`],[65281,65282,`ON`],[65283,65285,`ET`],[65286,65290,`ON`],[65291,65291,`ES`],[65292,65292,`CS`],[65293,65293,`ES`],[65294,65295,`CS`],[65296,65305,`EN`],[65306,65306,`CS`],[65307,65312,`ON`],[65339,65344,`ON`],[65371,65381,`ON`],[65504,65505,`ET`],[65506,65508,`ON`],[65509,65510,`ET`],[65512,65518,`ON`],[65520,65528,`BN`],[65529,65533,`ON`],[65534,65535,`BN`],[65793,65793,`ON`],[65856,65932,`ON`],[65936,65948,`ON`],[65952,65952,`ON`],[66045,66045,`NSM`],[66272,66272,`NSM`],[66273,66299,`EN`],[66422,66426,`NSM`],[67584,67870,`R`],[67871,67871,`ON`],[67872,68096,`R`],[68097,68099,`NSM`],[68100,68100,`R`],[68101,68102,`NSM`],[68103,68107,`R`],[68108,68111,`NSM`],[68112,68151,`R`],[68152,68154,`NSM`],[68155,68158,`R`],[68159,68159,`NSM`],[68160,68324,`R`],[68325,68326,`NSM`],[68327,68408,`R`],[68409,68415,`ON`],[68416,68863,`R`],[68864,68899,`AL`],[68900,68903,`NSM`],[68904,68911,`AL`],[68912,68921,`AN`],[68922,68927,`AL`],[68928,68937,`AN`],[68938,68968,`R`],[68969,68973,`NSM`],[68974,68974,`ON`],[68975,69215,`R`],[69216,69246,`AN`],[69247,69290,`R`],[69291,69292,`NSM`],[69293,69311,`R`],[69312,69327,`AL`],[69328,69336,`ON`],[69337,69369,`AL`],[69370,69375,`NSM`],[69376,69423,`R`],[69424,69445,`AL`],[69446,69456,`NSM`],[69457,69487,`AL`],[69488,69505,`R`],[69506,69509,`NSM`],[69510,69631,`R`],[69633,69633,`NSM`],[69688,69702,`NSM`],[69714,69733,`ON`],[69744,69744,`NSM`],[69747,69748,`NSM`],[69759,69761,`NSM`],[69811,69814,`NSM`],[69817,69818,`NSM`],[69826,69826,`NSM`],[69888,69890,`NSM`],[69927,69931,`NSM`],[69933,69940,`NSM`],[70003,70003,`NSM`],[70016,70017,`NSM`],[70070,70078,`NSM`],[70089,70092,`NSM`],[70095,70095,`NSM`],[70191,70193,`NSM`],[70196,70196,`NSM`],[70198,70199,`NSM`],[70206,70206,`NSM`],[70209,70209,`NSM`],[70367,70367,`NSM`],[70371,70378,`NSM`],[70400,70401,`NSM`],[70459,70460,`NSM`],[70464,70464,`NSM`],[70502,70508,`NSM`],[70512,70516,`NSM`],[70587,70592,`NSM`],[70606,70606,`NSM`],[70608,70608,`NSM`],[70610,70610,`NSM`],[70625,70626,`NSM`],[70712,70719,`NSM`],[70722,70724,`NSM`],[70726,70726,`NSM`],[70750,70750,`NSM`],[70835,70840,`NSM`],[70842,70842,`NSM`],[70847,70848,`NSM`],[70850,70851,`NSM`],[71090,71093,`NSM`],[71100,71101,`NSM`],[71103,71104,`NSM`],[71132,71133,`NSM`],[71219,71226,`NSM`],[71229,71229,`NSM`],[71231,71232,`NSM`],[71264,71276,`ON`],[71339,71339,`NSM`],[71341,71341,`NSM`],[71344,71349,`NSM`],[71351,71351,`NSM`],[71453,71453,`NSM`],[71455,71455,`NSM`],[71458,71461,`NSM`],[71463,71467,`NSM`],[71727,71735,`NSM`],[71737,71738,`NSM`],[71995,71996,`NSM`],[71998,71998,`NSM`],[72003,72003,`NSM`],[72148,72151,`NSM`],[72154,72155,`NSM`],[72160,72160,`NSM`],[72193,72198,`NSM`],[72201,72202,`NSM`],[72243,72248,`NSM`],[72251,72254,`NSM`],[72263,72263,`NSM`],[72273,72278,`NSM`],[72281,72283,`NSM`],[72330,72342,`NSM`],[72344,72345,`NSM`],[72544,72544,`NSM`],[72546,72548,`NSM`],[72550,72550,`NSM`],[72752,72758,`NSM`],[72760,72765,`NSM`],[72850,72871,`NSM`],[72874,72880,`NSM`],[72882,72883,`NSM`],[72885,72886,`NSM`],[73009,73014,`NSM`],[73018,73018,`NSM`],[73020,73021,`NSM`],[73023,73029,`NSM`],[73031,73031,`NSM`],[73104,73105,`NSM`],[73109,73109,`NSM`],[73111,73111,`NSM`],[73459,73460,`NSM`],[73472,73473,`NSM`],[73526,73530,`NSM`],[73536,73536,`NSM`],[73538,73538,`NSM`],[73562,73562,`NSM`],[73685,73692,`ON`],[73693,73696,`ET`],[73697,73713,`ON`],[78912,78912,`NSM`],[78919,78933,`NSM`],[90398,90409,`NSM`],[90413,90415,`NSM`],[92912,92916,`NSM`],[92976,92982,`NSM`],[94031,94031,`NSM`],[94095,94098,`NSM`],[94178,94178,`ON`],[94180,94180,`NSM`],[113821,113822,`NSM`],[113824,113827,`BN`],[117760,117973,`ON`],[118e3,118009,`EN`],[118010,118012,`ON`],[118016,118451,`ON`],[118458,118480,`ON`],[118496,118512,`ON`],[118528,118573,`NSM`],[118576,118598,`NSM`],[119143,119145,`NSM`],[119155,119162,`BN`],[119163,119170,`NSM`],[119173,119179,`NSM`],[119210,119213,`NSM`],[119273,119274,`ON`],[119296,119361,`ON`],[119362,119364,`NSM`],[119365,119365,`ON`],[119552,119638,`ON`],[120513,120513,`ON`],[120539,120539,`ON`],[120571,120571,`ON`],[120597,120597,`ON`],[120629,120629,`ON`],[120655,120655,`ON`],[120687,120687,`ON`],[120713,120713,`ON`],[120745,120745,`ON`],[120771,120771,`ON`],[120782,120831,`EN`],[121344,121398,`NSM`],[121403,121452,`NSM`],[121461,121461,`NSM`],[121476,121476,`NSM`],[121499,121503,`NSM`],[121505,121519,`NSM`],[122880,122886,`NSM`],[122888,122904,`NSM`],[122907,122913,`NSM`],[122915,122916,`NSM`],[122918,122922,`NSM`],[123023,123023,`NSM`],[123184,123190,`NSM`],[123566,123566,`NSM`],[123628,123631,`NSM`],[123647,123647,`ET`],[124140,124143,`NSM`],[124398,124399,`NSM`],[124643,124643,`NSM`],[124646,124646,`NSM`],[124654,124655,`NSM`],[124661,124661,`NSM`],[124928,125135,`R`],[125136,125142,`NSM`],[125143,125251,`R`],[125252,125258,`NSM`],[125259,126063,`R`],[126064,126143,`AL`],[126144,126207,`R`],[126208,126287,`AL`],[126288,126463,`R`],[126464,126703,`AL`],[126704,126705,`ON`],[126706,126719,`AL`],[126720,126975,`R`],[126976,127019,`ON`],[127024,127123,`ON`],[127136,127150,`ON`],[127153,127167,`ON`],[127169,127183,`ON`],[127185,127221,`ON`],[127232,127242,`EN`],[127243,127247,`ON`],[127279,127279,`ON`],[127338,127343,`ON`],[127405,127405,`ON`],[127584,127589,`ON`],[127744,128728,`ON`],[128732,128748,`ON`],[128752,128764,`ON`],[128768,128985,`ON`],[128992,129003,`ON`],[129008,129008,`ON`],[129024,129035,`ON`],[129040,129095,`ON`],[129104,129113,`ON`],[129120,129159,`ON`],[129168,129197,`ON`],[129200,129211,`ON`],[129216,129217,`ON`],[129232,129240,`ON`],[129280,129623,`ON`],[129632,129645,`ON`],[129648,129660,`ON`],[129664,129674,`ON`],[129678,129734,`ON`],[129736,129736,`ON`],[129741,129756,`ON`],[129759,129770,`ON`],[129775,129784,`ON`],[129792,129938,`ON`],[129940,130031,`ON`],[130032,130041,`EN`],[130042,130042,`ON`],[131070,131071,`BN`],[196606,196607,`BN`],[262142,262143,`BN`],[327678,327679,`BN`],[393214,393215,`BN`],[458750,458751,`BN`],[524286,524287,`BN`],[589822,589823,`BN`],[655358,655359,`BN`],[720894,720895,`BN`],[786430,786431,`BN`],[851966,851967,`BN`],[917502,917759,`BN`],[917760,917999,`NSM`],[918e3,921599,`BN`],[983038,983039,`BN`],[1048574,1048575,`BN`],[1114110,1114111,`BN`]];function Fde(e){if(e<=255)return Pde[e];let t=0,n=Y4.length-1;for(;t<=n;){let r=t+n>>1,i=Y4[r];if(ei[1]){t=r+1;continue}return i[2]}return`L`}function Ide(e){let t=e.length;if(t===0)return null;let n=Array(t),r=!1;for(let i=0;i=55296&&a<=56319&&i+1=56320&&t<=57343&&(o=(a-55296<<10)+(t-56320)+65536,s=2)}let c=Fde(o);(c===`R`||c===`AL`||c===`AN`)&&(r=!0);for(let e=0;e=0&&n[r]===`ET`;r--)n[r]=`EN`;for(r=e+1;r0?n[e-1]:s,a=r0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function Hde(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` `).replace(/[\r\f]/g,` -`):e}var Z4=null,Fde;function Ide(){return Z4===null&&(Z4=new Intl.Segmenter(Fde,{granularity:`word`})),Z4}var Lde=/\p{Script=Arabic}/u,Q4=/\p{M}/u,$4=/\p{Nd}/u;function e3(e){return Lde.test(e)}function t3(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function n3(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){if(t3((n-55296<<10)+(r-56320)+65536))return!0;t++;continue}}if(t3(n))return!0}}return!1}function Rde(e){let t=u3(e);return t!==null&&(i3.has(t)||s3.has(t))}var zde=new Set([`\xA0`,` `,`⁠`,``]),Bde=new Set([`-`,`‐`,`–`,`—`]);function Vde(e){let t=u3(e);return t!==null&&zde.has(t)}function Hde(e){let t=u3(e);return t!==null&&Bde.has(t)}function r3(e,t){return Vde(e)?!1:t?!(Rde(e)||Hde(e)):!0}var i3=new Set(`,...!.:.;.?.、.。.・.).〕.〉.》.」.』.】.〗.〙.〛.ー.々.〻.ゝ.ゞ.ヽ.ヾ`.split(`.`)),a3=new Set([`"`,`(`,`[`,`{`,`¡`,`¿`,`“`,`‘`,`‚`,`„`,`«`,`‹`,`⸘`,`(`,`〔`,`〈`,`《`,`「`,`『`,`【`,`〖`,`〘`,`〚`]),o3=new Set([`'`,`’`]),s3=new Set(`.(,(!(?(:(;(،(؛(؟(।(॥(၊(။(၌(၍(၏()(](}(%("(”(’(»(›(…`.split(`(`)),Ude=new Set([`:`,`.`,`،`,`؛`]),Wde=new Set([`၏`]),Gde=new Set([`”`,`’`,`»`,`›`,`」`,`』`,`】`,`》`,`〉`,`〕`,`)`]);function Kde(e){if(c3(e))return!0;let t=!1;for(let n of e){if(s3.has(n)||d3(n)){t=!0;continue}if(!(t&&Q4.test(n)))return!1}return t}function qde(e){for(let t of e)if(!i3.has(t)&&!s3.has(t))return!1;return e.length>0}function Jde(e){if(c3(e))return!0;for(let t of e)if(!a3.has(t)&&!o3.has(t)&&!Q4.test(t)&&!d3(t))return!1;return e.length>0}function c3(e){let t=!1;for(let n of e)if(!(n===`\\`||Q4.test(n))){if(a3.has(n)||s3.has(n)||o3.has(n)){t=!0;continue}return!1}return t}function l3(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let a=e.charCodeAt(i);return a>=55296&&a<=56319?i:n}function u3(e){if(e.length===0)return null;let t=l3(e,e.length);return e.slice(t)}function Yde(e){for(let t of e)if(!Q4.test(t))return t;return null}function Xde(e){for(let t=e.length;t>0;){let n=l3(e,t),r=e.slice(n,t);if(!Q4.test(r))return r;t=n}return null}var Zde=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Qde(e,t){for(let n=0;n=t[n]&&e<=t[n+1])return!0;return!1}function d3(e){let t=e.codePointAt(0);return t!==void 0&&Qde(t,Zde)}function $de(e){let t=Xde(e);return t!==null&&d3(t)}function efe(e){let t=Yde(e);return t!==null&&$4.test(t)}function tfe(e){let t=Array.from(e),n=t.length;for(;n>0;){let e=t[n-1];if(Q4.test(e)){n--;continue}if(a3.has(e)||o3.has(e)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(``),tail:t.slice(n).join(``)}}function nfe(e,t,n){return n===`text`&&!t&&e.length===1&&e!==`-`&&e!==`—`?e:null}function f3(e,t,n,r){let i=t[r],a=e[r];if(i==null)return a;let o=n[r];if(a.length===o)return a;let s=i.repeat(o);return e[r]=s,s}function p3(e,t){return e&&t!==null&&Ude.has(t)}function rfe(e){let t=u3(e);return t!==null&&Wde.has(t)}function ife(e){if(e.length<2||e[0]!==` `)return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:` `,marks:t}:null}function m3(e){let t=e.length;for(;t>0;){let n=l3(e,t),r=e.slice(n,t);if(Gde.has(r))return!0;if(!s3.has(r))return!1;t=n}return!1}function afe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===` `)return`preserved-space`;if(e===` `)return`tab`;if(t.preserveHardBreaks&&e===` -`)return`hard-break`}return e===` `?`space`:e===`\xA0`||e===` `||e===`⁠`||e===``?`glue`:e===`​`?`zero-width-break`:e===`­`?`soft-hyphen`:`text`}var ofe=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function h3(e){return e.length===1?e[0]:e.join(``)}function sfe(e,t){let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);return n.push(t),h3(n)}function cfe(e,t,n,r){if(!ofe.test(e))return[{text:e,isWordLike:t,kind:`text`,start:n}];let i=[],a=null,o=[],s=n,c=!1,l=0;for(let u of e){let e=afe(u,r),d=e===`text`&&t;if(a!==null&&e===a&&d===c){o.push(u),l+=u.length;continue}a!==null&&i.push({text:h3(o),isWordLike:c,kind:a,start:s}),a=e,o=[u],s=n+l,c=d,l+=u.length}return a!==null&&i.push({text:h3(o),isWordLike:c,kind:a,start:s}),i}function g3(e){return e===`space`||e===`preserved-space`||e===`zero-width-break`||e===`hard-break`}var lfe=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function ufe(e,t){let n=e.texts[t];return n.startsWith(`www.`)?!0:lfe.test(n)&&t+1=e.len||g3(e.kinds[s]))continue;let c=[],l=e.starts[s],u=s;for(;u0&&(t.push(h3(c)),n.push(!0),r.push(`text`),i.push(l),a=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var mfe=new Set([`:`,`-`,`/`,`×`,`,`,`.`,`+`,`–`,`—`]),hfe=/[\p{P}\p{S}\p{Co}]/u,gfe=/\p{Emoji_Presentation}/u,_fe=new Set([`?`,`֊`,`-`,`‐`,`‒`,`–`,`—`,`…`,`‼`,`‽`,`⁉`]);function vfe(e){return e>=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}function _3(e){let t=e.charCodeAt(0);return t<128?vfe(t):!_fe.has(e)&&!gfe.test(e)&&hfe.test(e)}function v3(e){let t=!1;for(let n of e)if(!Q4.test(n)){if(!_3(n))return!1;t=!0}return t}function yfe(e){for(let t=e.length;t>0;){let n=l3(e,t),r=e.slice(n,t);if(Q4.test(r)){t=n;continue}return _3(r)||d3(r)}return!1}function bfe(e,t,n,r){let i=!t&&v3(e),a=!r&&v3(n),o=$de(e),s=(t||o)&&yfe(e);return!i&&!a&&!s||n3(e)||n3(n)?!1:(t||i||o)&&(r||a)}function y3(e){for(let t of e)if($4.test(t))return!0;return!1}function b3(e){if(e.length===0)return!1;for(let t of e)if(!($4.test(t)||mfe.has(t)))return!1;return!0}function xfe(e){let t=[],n=[],r=[],i=[];for(let a=0;aa+1){t.push(h3(s)),n.push(u),r.push(`text`),i.push(e.starts[a]),a=l;continue}}t.push(o),n.push(c),r.push(s),i.push(e.starts[a]),a++}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Cfe(e){let t=[],n=[],r=[],i=[];for(let a=0;a1;for(let e=0;e0&&c[S]===`text`&&_&&f[S]&&m[S]||n&&i>0&&c[S]===`text`&&qde(e.text)&&f[S]||n&&i>0&&c[S]===`text`&&h[S]?C():n&&i>0&&c[S]===`text`&&e.isWordLike&&v&&g[S]?(C(),s[S]=!0):r!==null&&i>0&&c[S]===`text`&&u[S]===r?d[S]=(d[S]??1)+1:n&&!e.isWordLike&&i>0&&c[S]===`text`&&!f[S]&&(Kde(e.text)||e.text===`-`&&s[S])?C():(a[i]=e.text,o[i]=[e.text],s[i]=e.isWordLike,c[i]=e.kind,l[i]=e.start,u[i]=r,d[i]=r===null?0:1,f[i]=_,p[i]=v,m[i]=b,h[i]=x,g[i]=p3(v,y),i++)}for(let e=0;enull),v=-1;for(let e=i-1;e>=0;e--){let t=a[e];if(t.length!==0){if(c[e]===`text`&&!s[e]&&v>=0&&c[v]===`text`&&(Jde(t)||t===`-`&&efe(a[v]))){let n=_[v]??[];n.push(t),_[v]=n,l[v]=l[e],a[e]=``;continue}v=e}}for(let e=0;e=0&&!r3(t.texts[e-1],n)&&d(e),s<0&&(s=e),c||=n3(l);continue}d(e),r.push(l),i.push(t.isWordLike[e]),a.push(u),o.push(t.starts[e])}return d(t.len),{len:r.length,texts:r,isWordLike:i,kinds:a,starts:o}}function kfe(e,t,n=`normal`,r=`normal`){let i=Mde(n),a=i.mode===`pre-wrap`?Pde(e):Nde(e);if(a.length===0)return{normalized:a,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let o=Efe(a,t,i),s=r===`keep-all`?Ofe(a,o,t.breakKeepAllAfterPunctuation):o;return{normalized:a,chunks:Dfe(s,i),...s}}var x3=null,S3=new Map,C3=null,Afe=96,jfe=/\p{Emoji_Presentation}/u,Mfe=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,w3=null,T3=new Map;function E3(){if(x3!==null)return x3;if(typeof OffscreenCanvas<`u`)return x3=new OffscreenCanvas(1,1).getContext(`2d`),x3;if(typeof document<`u`)return x3=document.createElement(`canvas`).getContext(`2d`),x3;throw Error(`Text measurement requires OffscreenCanvas or a DOM canvas context.`)}function Nfe(e){let t=S3.get(e);return t||(t=new Map,S3.set(e,t)),t}function D3(e,t){let n=t.get(e);return n===void 0&&(n={width:E3().measureText(e).width,containsCJK:n3(e)},t.set(e,n)),n}function O3(){if(C3!==null)return C3;if(typeof navigator>`u`)return C3={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},C3;let e=navigator.userAgent,t=navigator.vendor===`Apple Computer, Inc.`&&e.includes(`Safari/`)&&!e.includes(`Chrome/`)&&!e.includes(`Chromium/`)&&!e.includes(`CriOS/`)&&!e.includes(`FxiOS/`)&&!e.includes(`EdgiOS/`),n=e.includes(`Chrome/`)||e.includes(`Chromium/`)||e.includes(`CriOS/`)||e.includes(`Edg/`);return C3={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},C3}function Pfe(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}function k3(){return w3===null&&(w3=new Intl.Segmenter(void 0,{granularity:`grapheme`})),w3}function Ffe(e){return jfe.test(e)||e.includes(`️`)}function Ife(e){return Mfe.test(e)}function Lfe(e,t){let n=T3.get(e);if(n!==void 0)return n;let r=E3();r.font=e;let i=r.measureText(`😀`).width;if(n=0,i>t+.5&&typeof document<`u`&&document.body!==null){let t=document.createElement(`span`);t.style.font=e,t.style.display=`inline-block`,t.style.visibility=`hidden`,t.style.position=`absolute`,t.textContent=`😀`,document.body.appendChild(t);let r=t.getBoundingClientRect().width;document.body.removeChild(t),i-r>.5&&(n=i-r)}return T3.set(e,n),n}function Rfe(e){let t=0,n=k3();for(let r of n.segment(e))Ffe(r.segment)&&t++;return t}function zfe(e,t){return t.emojiCount===void 0&&(t.emojiCount=Rfe(e)),t.emojiCount}function A3(e,t,n){return n===0?t.width:t.width-zfe(e,t)*n}function Bfe(e,t,n,r,i){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===i)return t.breakableFitAdvances;t.breakableFitMode=i;let a=k3(),o=[];for(let t of a.segment(e))o.push(t.segment);if(o.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i===`sum-graphemes`){let e=[];for(let t of o){let i=D3(t,n);e.push(A3(t,i,r))}return t.breakableFitAdvances=e,t.breakableFitAdvances}if(i===`pair-context`||o.length>Afe){let e=[],i=null,a=0;for(let t of o){let o=A3(t,D3(t,n),r);if(i===null)e.push(o);else{let o=i+t,s=D3(o,n);e.push(A3(o,s,r)-a)}i=t,a=o}return t.breakableFitAdvances=e,t.breakableFitAdvances}let s=[],c=``,l=0;for(let e of o){c+=e;let t=D3(c,n),i=A3(c,t,r);s.push(i-l),l=i}return t.breakableFitAdvances=s,t.breakableFitAdvances}function Vfe(e,t){let n=E3();n.font=e;let r=Nfe(e),i=Pfe(e);return{cache:r,fontSize:i,emojiCorrection:t?Lfe(e,i):0}}function Hfe(e){return e===`space`||e===`zero-width-break`||e===`soft-hyphen`}function j3(e){return e===`space`||e===`preserved-space`||e===`tab`||e===`zero-width-break`||e===`soft-hyphen`}function M3(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function N3(e,t){return t===0?0:e+t}function Gfe(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function Kfe(e,t,n,r,i){return N3(r,t===`tab`?i+Gfe(e,n):e.lineEndFitAdvances[n])}function P3(e,t,n,r){return N3(r,t===`tab`?0:e.lineEndFitAdvances[n])}function F3(e,t,n,r,i){return N3(r,t===`tab`?i:e.lineEndPaintAdvances[n])}function qfe(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Jfe(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function I3(e,t,n){let r=t;for(;r0)return e.spacingGraphemeCounts[r]>0?e.letterSpacing:0;for(let i=r-1;i>=t;i--){let a=e.kinds[i];if(!(a===`space`||a===`zero-width-break`||a===`hard-break`)){if(a===`soft-hyphen`){if(i===r-1)return 0;continue}return i===t&&n>0||e.spacingGraphemeCounts[i]>0?e.letterSpacing:0}}return 0}function Xfe(e,t,n,r,i,a){return t+Yfe(e,n,r,i,a)}function Zfe(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:a,breakablePreferredBreaks:o}=e;if(r.length===0)return 0;let s=t+O3().lineFitEpsilon,c=0,l=0,u=!1,d=0,f=0,p=0,m=0,h=-1,g=0;function _(){h=-1,g=0}function v(e=p,t=m,r=l){c++,n?.(r,d,f,e,t),l=0,u=!1,_()}function y(e,t){u=!0,d=e,f=0,p=e+1,m=0,l=t}function b(e,t,n){u=!0,d=e,f=t,p=e,m=t+1,l=n}function x(e,t){if(!u){y(e,t);return}l+=t,p=e+1,m=0}function S(e,t){let n=a[e],r=o[e]??null,i=r===null?-1:I3(r,0,t+1),c=-1,d=0,f=t;for(;fs){if(r!==null&&c>t){v(e,c,d),f=c,i=I3(r,i,f+1),c=-1,d=0;continue}v(),b(e,f,a)}else l+=a,p=e,m=f+1;let o=f+1;r!==null&&r[i]===o&&(c=o,d=l,i++),f++}u&&p===e&&m===n.length&&(p=e+1,m=0)}let C=0;for(;C=r.length));){let e=r[C],t=i[C],n=j3(t);if(!u){e>s&&a[C]!==null?S(C,0):y(C,e),n&&(h=C+1,g=l-e),C++;continue}if(l+e>s){if(n){x(C,e),v(C+1,0,l-e),C++;continue}if(h>=0){if(p>h||p===h&&m>0){v();continue}v(h,0,g);continue}if(e>s&&a[C]!==null){v(),S(C,0),C++;continue}v();continue}x(C,e),n&&(h=C+1,g=l-e),C++}return u&&v(),c}function Qfe(e,t,n){if(e.simpleLineWalkFastPath)return Zfe(e,t,n);let{widths:r,kinds:i,breakableFitAdvances:a,breakablePreferredBreaks:o,discretionaryHyphenWidth:s,chunks:c}=e;if(r.length===0||c.length===0)return 0;let l=O3(),u=t+l.lineFitEpsilon,d=0,f=0,p=!1,m=0,h=0,g=0,_=0,v=-1,y=0,b=0,x=null;function S(){v=-1,y=0,b=0,x=null}function C(){return x===`soft-hyphen`&&v===g&&_===0?b:f}function w(t=g,r=_,i){d++,n!==void 0&&n(Xfe(e,i??C(),m,h,t,r),m,h,t,r),f=0,p=!1,S()}function T(e,t){p=!0,m=e,h=0,g=e+1,_=0,f=t}function E(e,t,n){p=!0,m=e,h=t,g=e,_=t+1,f=n}function D(e,t){if(!p){T(e,t);return}f+=t,g=e+1,_=0}function O(t,n,r,i,a,o){if(!n)return;let s=P3(e,t,r,a),c=F3(e,t,r,a,i);v=r+1,y=f-o+s,b=f-o+c,x=t}function k(t,n){let r=a[t],i=o[t]??null,s=i===null?-1:I3(i,0,n+1),c=-1,l=0,d=n;for(;du){if(i!==null&&c>n){w(t,c,l),d=c,s=I3(i,s,d+1),c=-1,l=0;continue}w(),E(t,d,a)}else f=o,g=t,_=d+1}let o=d+1;i!==null&&i[s]===o&&(c=o,l=f,s++),d++}p&&g===t&&_===r.length&&(g=t+1,_=0)}function A(e){d++,n?.(0,e.startSegmentIndex,0,e.consumedEndSegmentIndex,0),S()}for(let t=0;t=n.endSegmentIndex));){let t=i[o],n=j3(t),c=Wfe(e,p,o),d=t===`tab`?Ufe(f+c,e.tabStopAdvance):r[o],m=c+d,h=Kfe(e,t,o,c,d);if(t===`soft-hyphen`){p&&(g=o+1,_=0,v=o+1,y=f+s,b=f+s,x=t),o++;continue}if(!p){h>u&&a[o]!==null?k(o,0):T(o,d),O(t,n,o,d,c,m),o++;continue}if(f+h>u){let r=f+P3(e,t,o,c),i=f+F3(e,t,o,c,d);if(x===`soft-hyphen`&&l.preferEarlySoftHyphenBreak&&y<=u){w(v,0,b);continue}if(n&&r<=u){D(o,m),w(o+1,0,i),o++;continue}if(v>=0&&y<=u){if(g>v||g===v&&_>0){w();continue}let e=v;w(e,0,b),o=e;continue}if(h>u&&a[o]!==null){w(),k(o,0),o++;continue}w();continue}D(o,m),O(t,n,o,d,c,m),o++}if(p){let e=v===n.consumedEndSegmentIndex?b:f;w(n.consumedEndSegmentIndex,0,e)}}return d}var L3=null;function R3(){return L3===null&&(L3=new Intl.Segmenter(void 0,{granularity:`grapheme`})),L3}function $fe(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function epe(e,t){let n=[],r=[],i=0,a=!1,o=!1,s=!1;function c(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(``),start:i}),r=[],a=!1,o=!1,s=!1)}function l(e,t,n){r=[e],i=t,a=n,o=m3(e),s=a3.has(e)}function u(e,t){r.push(e),a||=t;let n=m3(e);e.length===1&&s3.has(e)?o||=n:o=n,s=!1}for(let n of R3().segment(e)){let e=n.segment,i=n3(e);if(r.length===0){l(e,n.index,i);continue}if(s||i3.has(e)||s3.has(e)||t.carryCJKAfterClosingQuote&&i&&o){u(e,i);continue}if(!a&&!i){u(e,i);continue}c(),l(e,n.index,i)}return c(),n}function tpe(e,t,n){if(t.length<=1)return t;let r=[],i=-1,a=!1;function o(n,i){let a=t[n].start,o=i=0&&!r3(t[e-1].text,n)&&s(e),i<0&&(i=e),a||=n3(r.text)}return s(t.length),r}function z3(e,t){if(t===`zero-width-break`||t===`soft-hyphen`||t===`hard-break`)return 0;if(t===`tab`)return 1;let n=0,r=R3();for(let t of r.segment(e))n++;return n}function npe(e){return e===`-`||e===`֊`||e===`‐`||e===`‒`||e===`–`||e===`—`}function rpe(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;let t=[],n=0;for(let r of R3().segment(e))n++,npe(r.segment)&&t.push(n);return t.length===0?null:t}function ipe(e,t,n){return t>1?e+(t-1)*n:e}function ape(e,t,n,r,i){let a=O3(),{cache:o,emojiCorrection:s}=Vfe(t,Ife(e.normalized)),c=A3(`-`,D3(`-`,o),s)+(i===0?0:i*2),l=A3(` `,D3(` `,o),s)*8,u=i!==0;if(e.len===0)return $fe(n);let d=[],f=[],p=[],m=[],h=e.chunks.length<=1&&!u,g=n?[]:null,_=[],v=[],y=[],b=n?[]:null,x=Array.from({length:e.len});function S(e,t,n,r,i,a,o,s,c){i!==`text`&&i!==`space`&&i!==`zero-width-break`&&(h=!1),d.push(t),f.push(n),p.push(r),m.push(i),g?.push(a),_.push(o),v.push(s),u&&y.push(c),b!==null&&b.push(e)}function C(e,t,n,c,l){let d=D3(e,o),f=u?z3(e,t):0,p=ipe(A3(e,d,s),f,i),m=t===`space`||t===`preserved-space`||t===`zero-width-break`?0:p,h=m===0?0:m+(f>0?i:0),g=t===`space`||t===`zero-width-break`?0:p;if(l&&c&&e.length>1){let c=`sum-graphemes`;i===0?b3(e)?c=`pair-context`:a.preferPrefixWidthsForBreakableRuns&&(c=`segment-prefixes`):c=`segment-prefixes`;let l=Bfe(e,d,o,s,c);S(e,p,h,g,t,n,l,l===null||r===`keep-all`?null:rpe(e),f);return}S(e,p,h,g,t,n,null,null,f)}for(let t=0;t{e>t&&(t=e)}),t}function dpe(e){let t=e.toLowerCase(),n=[],r=0;for(let t of e){let e=t.toLowerCase().length;for(let i=0;i=0&&te[0]-t[0]),n=[];for(let e of t){let t=n.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):n.push([...e])}return n}function H3(e,t){if(!t||t.length===0||e.length===0)return[{text:e,hit:!1}];let n=[],r=0;for(let[i,a]of fpe(t)){let t=Math.max(0,Math.min(i,e.length)),o=Math.max(t,Math.min(a,e.length));o<=t||(t>r&&n.push({text:e.slice(r,t),hit:!1}),n.push({text:e.slice(t,o),hit:!0}),r=o)}return r0?n:[{text:e,hit:!1}]}function U3(e,t){let n=e.toLowerCase().indexOf(t);return n<0?void 0:[n,n+t.length]}function ppe(e,t){let n=e.toLowerCase(),r=-1,i=-1,a=0;for(let e=0;e0,u.value=e.scrollTop+e.clientHeight{let e={},t=`var(--menu-scroll-fade)`,n;return l.value&&u.value?n=`linear-gradient(to bottom, transparent 0, black ${t}, black calc(100% - ${t}), transparent 100%)`:l.value?n=`linear-gradient(to bottom, transparent, black ${t})`:u.value&&(n=`linear-gradient(to top, transparent, black ${t})`),n&&(e.maskImage=n,e.WebkitMaskImage=n),f.value&&(e.maxHeight=f.value),Object.keys(e).length>0?e:void 0}),_=L(()=>{let e=d.value;return e?{top:`${e.top}px`,height:`${e.height}px`}:void 0});function v(){let e=t.value,a=r.value,o=e?.offsetParent;if(!e||!a||!o)return;let s=getComputedStyle(e),c=W3(e,`--space-2`,8),l=(parseFloat(s.paddingTop)||0)+(parseFloat(s.paddingBottom)||0),u=W3(a,i,1/0),d=window.visualViewport?.offsetTop??0,p=o.getBoundingClientRect().top-d-c-l;f.value=`${Math.max(Math.floor(Math.min(u,p)),0)}px`,n(m)}function y(){let e=r.value;if(!e)return;let t=e.querySelectorAll(`[role="option"]`)[a?.value??-1];if(!t)return;let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=i.top-n.top+e.scrollTop,s=o+i.height;oe.scrollTop+e.clientHeight&&(e.scrollTop=s-e.clientHeight)}let b=null;function x(e){let t=r.value,n=d.value;if(!t||!n)return;e.preventDefault(),b?.();let i=e.pointerId;(e.target instanceof Element?e.target:null)?.setPointerCapture?.(i);let a=W3(t,`--menu-scrollbar-track-inset`,0),o=t.clientHeight-a*2-n.height,s=t.scrollHeight-t.clientHeight,c=e.clientY,l=t.scrollTop,u=e=>{e.pointerId!==i||o<=0||(t.scrollTop=l+(e.clientY-c)/o*s)},f=e=>{e.pointerId===i&&b?.()};b=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),b=null},window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)}let S=null;return p(()=>{if(typeof ResizeObserver==`function`&&r.value&&(S=new ResizeObserver(e=>{for(let t of e)t.target===r.value?m():v()}),S.observe(r.value),c)){let e=t.value?.offsetParent;e&&S.observe(e)}c&&(window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v),v()),m()}),h(()=>{S?.disconnect(),S=null,b?.(),window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v)}),s(()=>[a?.value,o?.value],()=>{n(()=>{m(),y()})}),{atTop:l,atBottom:u,thumb:d,scrollStyle:g,thumbStyle:_,onScroll:m,onThumbPointerDown:x}}var hpe={key:0,class:`slash-empty`,role:`status`},gpe=[`id`,`aria-selected`,`onMouseenter`,`onMousedown`],_pe={class:`slash-name`},vpe={key:0,class:`slash-match`},ype={class:`slash-desc`},bpe={key:0,class:`slash-desc-match`},K3=Y(G({__name:`SlashMenu`,props:{items:{},activeIndex:{},query:{default:``},ranges:{default:()=>[]},layout:{default:`popup`}},emits:[`select`,`hover`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=R(null);lp(a);let o=R(null),{thumb:s,scrollStyle:l,thumbStyle:u,onScroll:d,onThumbPointerDown:f}=G3({menuEl:a,scrollEl:o,maxHeightVar:`--p-slash-menu-h`,activeIndex:L(()=>n.activeIndex),refreshKey:L(()=>n.items),fitToViewport:n.layout!==`sheet`}),p=L(()=>n.items.map((e,t)=>{let r=e.isSkill?e.desc:i(e.desc),a=n.ranges[t]??mpe(n.query,e.name,r);return{item:e,namePieces:H3(e.name,a.name),desc:r,descPieces:H3(r,a.desc)}}));return(e,t)=>(c(),W(`div`,{ref_key:`menuEl`,ref:a,class:V([`slash-menu`,{"is-sheet":n.layout===`sheet`}]),"data-menu-frame":``},[n.items.length===0?(c(),W(`div`,hpe,U(z(i)(`composer.noCommands`)),1)):E(``,!0),F(`div`,{ref_key:`scrollEl`,ref:o,class:`slash-scroll`,role:`listbox`,style:ae(z(l)),onScroll:t[0]||=(...e)=>z(d)&&z(d)(...e)},[(c(!0),W(M,null,_(p.value,(e,t)=>(c(),W(`div`,{id:`composer-slash-option-${t}`,key:`${e.item.name}-${t}`,class:V([`slash-item`,{active:t===n.activeIndex}]),role:`option`,"aria-selected":t===n.activeIndex,onMouseenter:e=>r(`hover`,t),onMousedown:H(t=>r(`select`,e.item),[`prevent`])},[F(`span`,_pe,[(c(!0),W(M,null,_(e.namePieces,(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,vpe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))]),F(`span`,ype,[(c(!0),W(M,null,_(e.descPieces,(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,bpe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))])],42,gpe))),128))],36),z(s)&&n.items.length>0?(c(),W(`div`,{key:1,class:`scroll-thumb`,style:ae(z(u)),onPointerdown:t[1]||=(...e)=>z(f)&&z(f)(...e)},null,36)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-9f177a8d`]]),xpe={key:0,class:`mention-state dim`,role:`status`},Spe={key:1,class:`mention-state dim`,role:`status`},Cpe=[`id`,`aria-selected`,`onMouseenter`,`onMousedown`],wpe=[`innerHTML`],Tpe={class:`mention-name`},Epe={key:0,class:`mention-hit`},Dpe={class:`mention-meta`},Ope=[`innerHTML`],kpe={class:`mention-name`},Ape={key:0,class:`mention-hit`},jpe={key:0,class:`mention-meta`},Mpe={key:0,class:`mention-hit`},q3=Y(G({__name:`MentionMenu`,props:{items:{},activeIndex:{},loading:{type:Boolean,default:!1},stale:{type:Boolean,default:!1},layout:{default:`popup`}},emits:[`select`,`hover`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=R(null);lp(a);let o=R(null),{thumb:s,scrollStyle:l,thumbStyle:u,onScroll:d,onThumbPointerDown:f}=G3({menuEl:a,scrollEl:o,maxHeightVar:`--p-mention-menu-h`,activeIndex:L(()=>n.activeIndex),refreshKey:L(()=>n.items),fitToViewport:n.layout!==`sheet`});function p(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n)}function m(e){let t=e.file.path.endsWith(`/`)?e.file.path.slice(0,-1):e.file.path;return V3(e.file.name,e.file.matchPositions,Math.max(0,t.length-e.file.name.length))}function h(e){return V3(p(e.file.path),e.file.matchPositions,0)}function g(e){return V3(e.skill.name,e.matchPositions,0)}function v(e){return e.kind===`skill`?`skill:${e.skill.name}`:e.file.path}return(e,t)=>(c(),W(`div`,{ref_key:`menuEl`,ref:a,class:V([`mention-menu`,{"is-sheet":n.layout===`sheet`}]),"data-menu-frame":``},[n.loading&&n.items.length===0?(c(),W(`div`,xpe,U(z(i)(`mention.searching`)),1)):n.items.length===0?(c(),W(`div`,Spe,U(z(i)(`mention.noMatch`)),1)):E(``,!0),n.loading&&n.items.length>0?(c(),P(np,{key:2,class:`mention-spin`,size:`sm`,label:z(i)(`mention.searching`)},null,8,[`label`])):E(``,!0),F(`div`,{ref_key:`scrollEl`,ref:o,class:`mention-scroll`,role:`listbox`,style:ae(z(l)),onScroll:t[0]||=(...e)=>z(d)&&z(d)(...e)},[(c(!0),W(M,null,_(n.items,(e,t)=>(c(),W(`div`,{id:`composer-mention-option-${t}`,key:v(e),class:V([`mention-item`,{active:t===n.activeIndex,stale:n.stale&&e.kind!==`skill`}]),role:`option`,"aria-selected":t===n.activeIndex,onMouseenter:e=>r(`hover`,t),onMousedown:H(t=>r(`select`,e),[`prevent`])},[e.kind===`skill`?(c(),W(M,{key:0},[F(`span`,{class:`mention-icon`,innerHTML:z(wf)(`sparkles`,`sm`),"aria-hidden":`true`},null,8,wpe),F(`span`,Tpe,[(c(!0),W(M,null,_(g(e),(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Epe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))]),F(`span`,Dpe,U(e.skill.description),1)],64)):(c(),W(M,{key:1},[F(`span`,{class:`mention-icon`,innerHTML:z(Tf)(e.file.path,e.file.name),"aria-hidden":`true`},null,8,Ope),F(`span`,kpe,[(c(!0),W(M,null,_(m(e),(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Ape,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))]),p(e.file.path)?(c(),W(`span`,jpe,[(c(!0),W(M,null,_(h(e),(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Mpe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))])):E(``,!0)],64))],42,Cpe))),128))],36),z(s)&&n.items.length>0?(c(),W(`div`,{key:3,class:`scroll-thumb`,style:ae(z(u)),onPointerdown:t[1]||=(...e)=>z(f)&&z(f)(...e)},null,36)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-0ac2fbc1`]]),J3=[{name:`/new`,desc:`commands.new.desc`},{name:`/clear`,desc:`commands.clear.desc`},{name:`/login`,desc:`commands.login.desc`},{name:`/plan`,desc:`commands.plan.desc`},{name:`/discussion`,desc:`commands.expertTalk.desc`},{name:`/workflow`,desc:`commands.dynamicWorkflow.desc`,acceptsInput:!0},{name:`/goal`,desc:`commands.goal.desc`,acceptsInput:!0},{name:`/tower`,desc:`commands.tower.desc`,acceptsInput:!0},{name:`/btw`,desc:`commands.btw.desc`,acceptsInput:!0},{name:`/compact`,desc:`commands.compact.desc`,acceptsInput:!0},{name:`/undo`,desc:`commands.undo.desc`},{name:`/fork`,desc:`commands.fork.desc`},{name:`/export`,desc:`commands.export.desc`},{name:`/status`,desc:`commands.status.desc`}];function Npe(e){if(!e.startsWith(`/`))return null;let t=e.indexOf(` `);return t===-1?{cmd:e,arg:``}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}var Ppe=`skill:`;function Fpe(e){return e.startsWith(`skill:`)?e.slice(6):e}function Y3(e=[]){let t=e.map(e=>({name:e.source===`builtin`?`/${e.name}`:`/${Ppe}${e.name}`,desc:e.description,isSkill:!0,acceptsInput:!0}));return[...J3,...t]}function Ipe(e,t=J3){let n=e.toLowerCase().trim().replace(/^\//,``);return n===``?t:t.map((e,t)=>{let r=e.name.toLowerCase().replace(/^\//,``),i=0;return r===n?i=3:r.startsWith(n)?i=2:r.includes(n)&&(i=1),{item:e,index:t,score:i}}).filter(({score:e})=>e>0).toSorted((e,t)=>e.score===t.score?e.index-t.index:t.score-e.score).map(({item:e})=>e)}function X3(e){if(e===void 0)return`toggle`;let t=e.capabilities??[];return t.includes(`always_thinking`)?`always-on`:t.includes(`thinking`)||e.adaptiveThinking===!0?`toggle`:`unsupported`}function Z3(e){return e?.supportEfforts??[]}function Lpe(e){return e[Math.floor(e.length/2)]}function Q3(e){if(X3(e)===`unsupported`)return`off`;let t=Z3(e);return t.length>0?e?.defaultEffort??Lpe(t):`on`}function $3(e){let t=Z3(e),n=X3(e);return t.length>0?n===`always-on`?[...t]:[`off`,...t]:n===`always-on`?[`on`]:n===`unsupported`?[`off`]:[`on`,`off`]}function e6(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function t6(e,t){return $3(e).includes(t)}function n6(e,t){return t===`off`?`off`:t===`on`?Q3(e):t}function r6(e,t){return t??Q3(e)}function Rpe(e,t){if(e===`off`)return{enabled:!1};if(e===`on`)return{enabled:!0};let n=t?.at(-1);return n!==void 0&&e===n?{enabled:!0}:{enabled:!0,effort:e}}function zpe(e,t,n){return!n||e===void 0?t:Q3(e)}var i6=100;function Bpe(e){let t=Qi(qi.inputHistory);if(Array.isArray(t)){let n=t.filter(e=>typeof e==`string`&&e.length>0);if(!e||n.length===0)return{};let r=n.length>i6?n.slice(-100):n,i={[e]:r};return $i(qi.inputHistory,i),i}return t&&typeof t==`object`?t:{}}function Vpe(e){let{text:t,textareaRef:r,autosize:i,sessionId:a}=e,o=R(Bpe(a())),c=L(()=>o.value[a()??``]??[]),l=-1,u=``;function d(e){let t=a();if(l=-1,!t)return;let n=e.trim();if(!n)return;let r=o.value[t]??[];if(r.at(-1)===n)return;let i=[...r,n],s=i.length>i6?i.slice(-100):i;o.value={...o.value,[t]:s},$i(qi.inputHistory,o.value)}function f(){let e=r.value;return e?(e.selectionStart??0)===0:!1}function p(e){t.value=e,n(()=>{let t=r.value;if(!t)return;i();let n=e.length;t.setSelectionRange(n,n)})}function m(){let e=c.value;if(e.length!==0){if(l===-1)u=t.value,l=e.length-1;else if(l>0)--l;else return;p(e[l])}}function h(){if(l===-1)return;let e=c.value;l0}return s(a,()=>{l=-1}),{push:d,caretAtTextStart:f,recallOlder:m,recallNewer:h,resetBrowsing:g,isBrowsing:_,hasHistory:v}}function Hpe(e){let{text:t,textareaRef:r,autosize:i,skills:a,emitCommand:o,historyPush:s,clearDraft:c}=e,l=R(!1),u=R([]),d=R(0);function f(){let e=t.value;e.startsWith(`/`)&&!e.includes(` `)?(u.value=Ipe(e,Y3(a())),d.value=0,l.value=u.value.length>0):l.value=!1}function p(e){if(l.value=!1,e.acceptsInput){t.value=`${e.name} `,n(()=>{let e=r.value;if(!e)return;let n=t.value.length;e.setSelectionRange(n,n),e.focus(),i()});return}t.value=``,c?.(),s(e.name),o(e.name)}return{open:l,items:u,active:d,update:f,select:p}}function Upe(e){let{text:t,textareaRef:r,autosize:i,searchFiles:a,searchSkills:o,insertSkill:s}=e,c=R(!1),l=R([]),u=R(0),d=R(!1),f=R(!1),p=null,m=0;function h(){let e=t.value,n=r.value?.selectionStart??e.length,i=n-1;for(;i>=0&&!/\s/.test(e[i]);)i--;i++;let a=e.slice(i,n);return a.startsWith(`@`)?{token:a.slice(1),start:i,end:n}:null}function g(){let e=h(),t=a(),n=o?.();if(!e||!t&&!n){c.value=!1,f.value=!1;return}let r=e.token;p!==null&&clearTimeout(p),p=setTimeout(async()=>{let e=++m;d.value=!0,c.value=!0,u.value=0,l.value.length>0&&(f.value=!0);try{let[i,a]=await Promise.all([t?t(r).catch(()=>[]):Promise.resolve([]),n?n(r).catch(()=>[]):Promise.resolve([])]);if(e!==m)return;l.value=[...i.map(e=>({kind:e.path.endsWith(`/`)?`folder`:`file`,file:{...e,matchPositions:B3(r,e.path)}})),...a.map(e=>({kind:`skill`,skill:e,matchPositions:B3(r,e.name)}))]}catch{e===m&&(l.value=[])}finally{e===m&&(d.value=!1,f.value=!1)}},200)}function _(){p!==null&&clearTimeout(p),p=null,m++,c.value=!1,d.value=!1,f.value=!1}function v(e){let a=h();if(!a)return;if(c.value=!1,e.kind===`skill`){s?.(e.skill.name);return}let o=t.value,l=e.file.name||e.file.path.split(/[\\/]/).findLast(Boolean)||e.file.path,u=c4({kind:e.kind,name:l,path:e.file.path});t.value=`${o.slice(0,a.start)}${u} ${o.slice(a.end)}`,n(()=>{let e=r.value;if(!e)return;let t=a.start+u.length+1;e.setSelectionRange(t,t),e.focus(),i()})}function y(e){let a=h();if(!a)return;if(e.kind===`skill`){v(e);return}let o=e.file.name||e.file.path.split(/[\\/]/).findLast(Boolean)||e.file.path,s=t.value;t.value=`${s.slice(0,a.start)}@${o}${s.slice(a.end)}`,c.value=!0,n(()=>{let e=r.value;if(!e)return;let t=a.start+1+o.length;e.setSelectionRange(t,t),e.focus(),i(),g()})}return{open:c,items:l,active:u,loading:d,stale:f,update:g,select:v,complete:y,close:_,getMentionToken:h}}function Wpe(e){let{sessionId:t}=e;function r(e){return Yi(Ji(e))??``}function i(e,t){let n=Ji(e);t?Xi(n,t):Zi(n)}let a=R(r(t())),o=R(null);function c(){let e=o.value;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)}s(a,e=>{n(c),i(t(),e)}),s(t,(e,t)=>{e!==t&&(i(t,a.value),a.value=r(e),n(c))});function l(e){a.value=e,n(()=>{let t=o.value;if(!t)return;t.focus();let n=e.length;t.setSelectionRange(n,n),c()})}function u(){i(t(),``)}return{text:a,textareaRef:o,autosize:c,loadForEdit:l,clearDraft:u}}function Gpe(e){let{uploadImage:t,sessionId:n}=e,r=R({}),i=L(()=>r.value[n()??``]??[]),a=R(null),o=R(null),c=R(!1),l=0;function u(){return`att_${++l}`}function d(e,t){r.value={...r.value,[e]:t}}function f(e){let t=0;for(let n of e)(n.kind===`image`||n.kind===`video`)&&n.mediaOrdinal!==void 0&&(t=Math.max(t,n.mediaOrdinal));return t+1}function m(e){return e.kind===`image`?e.mediaOrdinal===void 0?`Image`:`Image ${e.mediaOrdinal}`:e.kind===`video`?e.mediaOrdinal===void 0?`Video`:`Video ${e.mediaOrdinal}`:e.name}function g(e){if(e.previewUrl!==void 0)try{URL.revokeObjectURL(e.previewUrl)}catch{}}function _(e){return e.startsWith(`image/`)?`image`:e.startsWith(`video/`)?`video`:`file`}async function v(e){let i=t();if(!i)return;let a=n()??``;if(e.length!==0)for(let t of e){let e=_(t.type),n=u(),o=e===`file`?void 0:URL.createObjectURL(t),s=r.value[a]??[],c={localId:n,name:t.name,kind:e,previewUrl:o,mediaType:t.type||`application/octet-stream`,size:t.size,mediaOrdinal:e===`file`?void 0:f(s),uploading:!0};d(a,[...s,c]),i(t,t.name).then(e=>{d(a,(r.value[a]??[]).map(t=>t.localId===n?{...t,uploading:!1,fileId:e?.fileId,mediaType:e?.mediaType??t.mediaType,error:e===null}:t))}).catch(()=>{d(a,(r.value[a]??[]).map(e=>e.localId===n?{...e,uploading:!1,error:!0}:e))})}}function y(e){let t=n()??``,i=r.value[t]??[],o=i.find(t=>t.localId===e);a.value?.localId===e&&(a.value=null),o&&g(o),d(t,i.filter(t=>t.localId!==e))}function b(e,t){let i=n()??``,a=[...r.value[i]??[]],o=a.findIndex(t=>t.localId===e);if(o<0)return;let s=Math.max(0,Math.min(t,a.length-1));if(o===s)return;let[c]=a.splice(o,1);c!==void 0&&(a.splice(s,0,c),d(i,a))}function x(e){a.value=e}function S(){a.value=null}function C(){o.value?.click()}function w(e){let t=e.target;v(Array.from(t.files??[])),t.value=``}function T(e){if(!t())return;let n=e.clipboardData;if(!n)return;let r=[],i=new Set,a=(e,t)=>{let n=`${e.size}:${e.type}:${t}`;if(i.has(n))return;i.add(n);let a=e.type.split(`/`)[1]??`png`,o=t.includes(`.`)?t:`paste-${Date.now()}.${a}`;r.push(e instanceof File?e:new File([e],o,{type:e.type}))};for(let e of Array.from(n.items))if(e.kind===`file`){let t=e.getAsFile();t&&a(t,t.name||`paste-${Date.now()}.${e.type.split(`/`)[1]??`png`}`)}for(let e of Array.from(n.files))a(e,e.name);r.length!==0&&(e.preventDefault(),v(r))}let E=0;function D(e){t()&&Array.from(e.dataTransfer?.items??[]).some(e=>e.kind===`file`)&&(e.preventDefault(),e.stopPropagation(),c.value=!0)}function O(){c.value=!1}function k(e){E=0,c.value=!1,t()&&(e.preventDefault(),e.stopPropagation(),v(Array.from(e.dataTransfer?.files??[])))}function A(e){return Array.from(e.dataTransfer?.items??[]).some(e=>e.kind===`file`)}function j(e){!t()||!A(e)||(e.preventDefault(),E+=1,c.value=!0)}function M(e){!t()||!A(e)||e.preventDefault()}function N(e){!t()||!A(e)||(E=Math.max(0,E-1),E===0&&(c.value=!1))}function ee(e){E=0,c.value=!1,t()&&(e.preventDefault(),v(Array.from(e.dataTransfer?.files??[])))}function P(){let e=n()??``;for(let t of r.value[e]??[])g(t);d(e,[])}function F(e,t,n){let i=r.value[e]??[];i.some(e=>e.localId===t)&&d(e,i.map(e=>e.localId===t?{...e,...n}:e))}function I(e){return fetch(e).then(e=>{if(!e.ok)throw Error(`fetch failed: ${e.status}`);return e.blob()})}function te(e){let i=n()??``;for(let e of r.value[i]??[])g(e);d(i,[]);for(let n of e){let e=u(),a=/^data:/i.test(n.url),o=/^blob:/i.test(n.url),s=n.name??n.kind;if(n.fileId){let t=r.value[i]??[],c={localId:e,name:s,kind:n.kind,previewUrl:n.kind===`file`?void 0:n.url,mediaOrdinal:n.kind===`file`?void 0:f(t),uploading:!1,fileId:n.fileId};d(i,[...t,c]),n.kind!==`file`&&!a&&!o&&Q().getFileBlob(n.fileId).then(t=>{let n=URL.createObjectURL(t);if(!(r.value[i]??[]).some(t=>t.localId===e)){URL.revokeObjectURL(n);return}F(i,e,{previewUrl:n})}).catch(()=>{})}else{if(!n.url)continue;let a=t();if(!a)continue;let o=r.value[i]??[],c={localId:e,name:s,kind:n.kind,previewUrl:n.url,mediaOrdinal:n.kind===`file`?void 0:f(o),uploading:!0};d(i,[...o,c]),I(n.url).then(e=>a(e,s.includes(`.`)?s:`${s}.${e.type.split(`/`)[1]??`bin`}`)).then(t=>{if(t===null){d(i,(r.value[i]??[]).filter(t=>t.localId!==e));return}F(i,e,{uploading:!1,fileId:t.fileId})}).catch(()=>{d(i,(r.value[i]??[]).filter(t=>t.localId!==e))})}}}return s(n,()=>{a.value=null}),p(()=>{document.addEventListener(`paste`,T),document.addEventListener(`dragenter`,j),document.addEventListener(`dragover`,M),document.addEventListener(`dragleave`,N),document.addEventListener(`drop`,ee)}),h(()=>{document.removeEventListener(`paste`,T),document.removeEventListener(`dragenter`,j),document.removeEventListener(`dragover`,M),document.removeEventListener(`dragleave`,N),document.removeEventListener(`drop`,ee);for(let e of Object.values(r.value))for(let t of e)g(t);a.value=null}),{attachments:i,previewAttachment:a,fileInputRef:o,isDragOver:c,removeAttachment:y,reorderAttachment:b,mediaLabel:m,openAttachmentPreview:x,closeAttachmentPreview:S,openFilePicker:C,handleFileInputChange:w,handleDragOver:D,handleDragLeave:O,handleDrop:k,clearAfterSubmit:P,loadAttachments:te}}var Kpe=`(max-width: 640px)`;function a6(){let e=R(!1);if(typeof window>`u`||typeof window.matchMedia!=`function`)return e;let t=window.matchMedia(Kpe);e.value=t.matches;let n=t=>{e.value=t.matches};return typeof t.addEventListener==`function`?(t.addEventListener(`change`,n),h(()=>t.removeEventListener(`change`,n))):typeof t.addListener==`function`&&(t.addListener(n),h(()=>t.removeListener(n))),e}var qpe={class:`ctx-ring`,viewBox:`0 0 20 20`,"aria-hidden":`true`},Jpe=[`stroke-dasharray`,`stroke-dashoffset`],o6=7,Ype=Y(G({__name:`ContextRing`,props:{pct:{}},setup(e){let t=e,n=2*Math.PI*o6;return(e,r)=>(c(),W(`svg`,qpe,[F(`circle`,{class:`ctx-ring-track`,cx:`10`,cy:`10`,r:o6,fill:`none`,"stroke-width":`2.5`}),F(`circle`,{class:`ctx-ring-fill`,cx:`10`,cy:`10`,r:o6,fill:`none`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,Jpe)]))}}),[[`__scopeId`,`data-v-97f3cf66`]]),Xpe=[`aria-selected`,`onClick`],s6=Y(G({__name:`SegmentedControl`,props:{modelValue:{},options:{},size:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(c(),W(`div`,{class:V([`ui-seg`,`ui-seg--${e.size??`md`}`]),role:`tablist`},[(c(!0),W(M,null,_(e.options,t=>(c(),W(`button`,{key:t.value,class:V([`ui-seg__item`,{"is-on":t.value===e.modelValue}]),type:`button`,role:`tab`,"aria-selected":t.value===e.modelValue,onClick:e=>n(`update:modelValue`,t.value)},U(t.label),11,Xpe))),128))],2))}}),[[`__scopeId`,`data-v-bffb3dae`]]),c6=[`pythinking`,`pyreasoning`,`pypondering`,`pyplanning`,`pyiterating`,`pyorchestrating`,`reasonating`,`pondercrafting`,`neuroning`,`logic-weaving`,`rubber-duckoning`,`token-wrangling`,`bug-whispering`,`stack-divining`,`gizmo-tinkering`],Zpe=6e4;function Qpe(e=Date.now()){return c6[Math.floor(e/6e4)%c6.length]??c6[0]}function $pe(e=Date.now()){return`${Qpe(e)}…`}var l6=[`⣷`,`⣯`,`⣟`,`⡿`,`⢿`,`⣻`,`⣽`,`⣾`],eme=[`aria-label`],u6=Y(G({__name:`ActivitySpinner`,props:{fast:{type:Boolean},label:{}},setup(e){let t=l6.length*80,n=e,r=R(Date.now()),i;p(()=>{n.label===void 0&&(i=setInterval(()=>{r.value=Date.now()},Zpe))}),h(()=>{i!==void 0&&clearInterval(i)});let a=L(()=>n.label??$pe(r.value));function o(e){return{"--spinner-frame-delay":`${e*80-t}ms`,"--spinner-frame-fast-delay":`${e*40-t/2}ms`}}return(t,n)=>(c(),W(`span`,{class:V([`activity-spin`,{"activity-spin--fast":e.fast}]),"aria-label":a.value,role:`img`},[(c(!0),W(M,null,_(z(l6),(e,t)=>(c(),W(`span`,{key:e,class:`activity-frame`,style:ae(o(t)),"aria-hidden":`true`},U(e),5))),128))],10,eme))}}),[[`__scopeId`,`data-v-c12d8332`]]),tme=[`disabled`],nme={key:0,class:`leading`},rme={class:`label`},ime={key:1,class:`count`},ame={key:2,class:`trailing`},d6=Y(G({__name:`MenuRow`,props:{count:{},active:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(c(),W(`button`,{type:`button`,class:V([`menu-row`,{active:e.active,selected:e.selected,disabled:e.disabled}]),disabled:e.disabled},[t.$slots.leading?(c(),W(`span`,nme,[me(t.$slots,`leading`,{},void 0,!0)])):E(``,!0),F(`span`,rme,[me(t.$slots,`label`,{},()=>[me(t.$slots,`default`,{},void 0,!0)],!0)]),e.count===void 0?E(``,!0):(c(),W(`span`,ime,U(e.count),1)),t.$slots.trailing?(c(),W(`span`,ame,[me(t.$slots,`trailing`,{},void 0,!0)])):E(``,!0)],10,tme))}}),[[`__scopeId`,`data-v-261bf74a`]]),ome=[`aria-checked`,`disabled`],f6=Y(G({__name:`SwitchToggle`,props:{modelValue:{type:Boolean},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t;function i(){n.disabled||r(`update:modelValue`,!n.modelValue)}function a(e){n.disabled||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i())}return(t,n)=>(c(),W(`button`,{type:`button`,class:`switch-toggle`,role:`switch`,"aria-checked":e.modelValue,disabled:e.disabled,onClick:i,onKeydown:a},[...n[0]||=[F(`span`,{class:`track`,"aria-hidden":`true`},null,-1),F(`span`,{class:`thumb`,"aria-hidden":`true`},null,-1)]],40,ome))}}),[[`__scopeId`,`data-v-169237c7`]]);function sme({initialized:e,onboardingCompleted:t,authReady:n}){return e?t?n?`app`:`recovery`:`first-run`:`loading`}function cme(e,t){return e||t}function lme(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}var ume=/^(?:[A-Za-z]:[\\/]|\\\\|\/\/)/;function p6(e){let t=e.replaceAll(`\\`,`/`),n=ume.test(t),r=t.replace(/\/+$/,``);return n?r.toLowerCase():r}function dme(e,t){let n=p6(t.cwd);return e.find(e=>p6(e.root)===n)?.id??t.workspaceId??t.cwd}function fme(e){let{workspaces:t,sessions:n,hiddenWorkspaceRoots:r,sessionsHasMoreByWorkspace:i}=e,a=new Set(r.map(p6)),o=new Map;for(let e of t){let t=p6(e.root);a.has(t)||o.has(t)||o.set(t,{...e})}for(let e of n){let t=e.cwd;if(!t)continue;let n=p6(t);a.has(n)||o.has(n)||o.set(n,{id:e.workspaceId??t,root:t,name:lme(t),sessionCount:0})}let s=new Map;for(let e of n){let n=dme(t,e);s.set(n,(s.get(n)??0)+1)}let c=[];for(let e of t){let t=p6(e.root);!a.has(t)&&!c.includes(t)&&c.push(t)}let l=[...o.keys()].filter(e=>!c.includes(e));l.sort((e,t)=>o.get(e).root.localeCompare(o.get(t).root));let u=[];for(let e of[...c,...l]){let t=o.get(e),n=s.get(t.id)??s.get(t.root)??0,r=i[t.id]===!1?n:Math.max(t.sessionCount,n);u.push({...t,sessionCount:r})}return u}function pme(e,t){if(t.length===0||e.length===0)return t;let n=Date.parse(t[0].createdAt);if(Number.isNaN(n))return t;let r=new Set(t.map(e=>e.id)),i=new Set(t.filter(e=>e.role===`user`).map(e=>e.id)),a=e.filter(e=>{let t=Date.parse(e.createdAt);return!(Number.isNaN(t)||t>=n||r.has(e.id)||e.role===`user`&&e.promptId!==void 0&&i.has(e.promptId))});return a.length>0?[...a,...t]:t}function mme(e,t){let n=new Set(e.map(e=>e.id)),r=t.filter(e=>e.kind===`subagent`&&!n.has(e.id));if(r.length===0)return e;let i=new Map(e.map(e=>[e.id,e])),a=new Map;for(let t of e)t.kind===`subagent`&&t.agentId!==void 0&&!a.has(t.agentId)&&a.set(t.agentId,t);let o=new Set,s=r.map(e=>{let t=(e.backgroundTaskId===void 0?void 0:i.get(e.backgroundTaskId))??a.get(e.id)??(e.agentId===void 0?void 0:a.get(e.agentId));if(t===void 0)return e;o.add(t.id);let n=e.status===`running`&&t.status!==`running`,r=t.completedAt!==void 0&&t.completedAtEstimated!==!0;return{...e,status:e.status===`running`?t.status:e.status,subagentPhase:n?t.status===`completed`?`completed`:t.status===`cancelled`?`cancelled`:`failed`:e.subagentPhase,agentId:e.agentId??t.agentId,model:e.model??t.model,thinkingEffort:e.thinkingEffort??t.thinkingEffort,routing:e.routing??t.routing,currentRoutingEnvRevision:e.currentRoutingEnvRevision??t.currentRoutingEnvRevision,completedAt:r?t.completedAt:e.completedAt??t.completedAt,completedAtEstimated:r||e.completedAt===void 0?t.completedAtEstimated:e.completedAtEstimated,outputPreview:t.outputPreview??e.outputPreview,outputBytes:t.outputBytes??e.outputBytes}});return[...e.filter(e=>!o.has(e.id)),...s]}function hme(e,t){if(e.length===0)return t;let n=new Map(t.map(e=>[e.id,e])),r=new Set(e.map(e=>e.id)),i=e.map(e=>{let t=n.get(e.id);return t?{...e,outputLines:t.outputLines,text:t.text}:e}),a=t.filter(e=>!r.has(e.id));return a.length===0?i:[...i,...a]}function gme(e){let t=new Map,n=new Set;function r(i){let a=t.get(i);if(a!==void 0)return a;let o=(async()=>e(i))().finally(()=>{t.delete(i),n.delete(i)&&r(i)});return t.set(i,o),o}function i(e){if(t.has(e)){n.add(e);return}r(e)}return{run:r,request:i}}var _me=new Set([`assistantDelta`,`agentDelta`,`toolOutput`,`taskProgress`]);function vme(e){return _me.has(e.type)}var yme=50,bme=100,m6=32*1024,xme={requestFrame(e){return typeof requestAnimationFrame==`function`?requestAnimationFrame(e):null},cancelFrame(e){typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(e)},requestTask(e){return setTimeout(e,yme)},cancelTask(e){clearTimeout(e)}};function Sme(e,t,n={}){let r=n.scheduler??xme,i=Math.max(1,Math.floor(n.maxItemsPerSlice??bme)),a=[],o=0,s=null,c=null,l=0,u=!1,d=()=>a.length-o,f=()=>{l+=1,s!==null&&(r.cancelFrame(s),s=null),c!==null&&(r.cancelTask(c),c=null)},p=()=>{o===a.length?(a.length=0,o=0):o>=1024&&(a.splice(0,o),o=0)},m,h=()=>{if(u||s!==null||c!==null||d()===0)return;let e=++l,t=()=>{e===l&&m()};s=r.requestFrame(t),c=r.requestTask(t)};m=()=>{f();let t=0;for(;!u&&t{if(!u){if(t(r)){let e=a.length>o?a.at(-1):void 0,t=e===void 0?void 0:n.coalesce?.(e,r);t===void 0?a.push(r):a[a.length-1]=t,h();return}if(d()===0){e(r);return}a.push(r),m()}});return g.flush=()=>{if(!u){for(f();!u&&o{if(u||d()===0)return;let t=o;for(let n=o;n{u||(u=!0,f(),a.length=0,o=0)},g}function h6(e){if(e.type===`assistantDelta`){if(e.delta.text!==void 0&&e.delta.thinking===void 0)return{kind:`text`,value:e.delta.text};if(e.delta.thinking!==void 0&&e.delta.text===void 0)return{kind:`thinking`,value:e.delta.thinking}}}function Cme(e){if(e.appEvent.type!==`assistantDelta`)return[e];let t=e.appEvent,n=e.meta.stream,r=h6(t);if(n===void 0||r===void 0||n.kind!==r.kind||r.value.length<=m6)return[e];let i=[],a=0;for(;aa&&/[\uD800-\uDBFF]/u.test(r.value[o-1])&&/[\uDC00-\uDFFF]/u.test(r.value[o])&&--o;let s=r.value.slice(a,o);i.push({appEvent:{...t,delta:r.kind===`text`?{text:s}:{thinking:s}},meta:{...e.meta,stream:{...n,offset:n.offset+a}}}),a=o}return i}function wme(e,t){if(e.appEvent.type!==`assistantDelta`||t.appEvent.type!==`assistantDelta`)return;let n=e.meta.stream,r=t.meta.stream,i=h6(e.appEvent),a=h6(t.appEvent);if(n===void 0||r===void 0||i===void 0||a===void 0||e.meta.sessionId!==t.meta.sessionId||e.appEvent.sessionId!==t.appEvent.sessionId||e.appEvent.messageId!==t.appEvent.messageId||e.appEvent.contentIndex!==t.appEvent.contentIndex||n.turnId!==r.turnId||n.kind!==r.kind||i.kind!==a.kind||n.kind!==i.kind||r.kind!==a.kind||r.offset!==n.offset+i.value.length||i.value.length+a.value.length>m6)return;let o=i.value+a.value;return{appEvent:{...e.appEvent,delta:i.kind===`text`?{text:o}:{thinking:o}},meta:{...t.meta,stream:{...n}}}}var g6=[{value:`small`,label:`S`},{value:`medium`,label:`M`},{value:`large`,label:`L`},{value:`xlarge`,label:`XL`}],_6=new Set([`blue`,`mono`]),v6=new Set([`light`,`dark`,`system`]),y6=14,Tme=12,Eme=20,Dme={small:12,medium:14,large:16,xlarge:18};function Ome(){let e=Yi(qi.accent);return e&&_6.has(e)?e:`blue`}function kme(e){typeof document>`u`||!document.documentElement||(document.documentElement.dataset.accent=e)}function Ame(){let e=Yi(qi.colorScheme);return e&&v6.has(e)?e:`system`}function jme(e){if(typeof document>`u`||!document.documentElement)return;document.documentElement.dataset.colorScheme=e;let t=document.querySelectorAll(`meta[name="theme-color"]`);if(t.length===0)return;let n=e===`dark`?`#121212`:e===`light`?`#ffffff`:null;t.forEach(e=>{let t=(e.getAttribute(`media`)??``).includes(`dark`)?`#121212`:`#ffffff`;e.setAttribute(`content`,n??t)})}function b6(e){return Number.isFinite(e)?Math.min(Eme,Math.max(Tme,Math.round(e))):y6}function x6(e){let t=b6(e);return t<=13?`small`:t<=15?`medium`:t<=17?`large`:`xlarge`}function S6(e){return Dme[e]}function Mme(){let e=Yi(qi.uiFontSize);return e===null?y6:b6(Number(e))}function Nme(e){typeof document>`u`||!document.documentElement||(document.documentElement.dataset.fontScale=x6(e))}var C6=R(Ame()),w6=R(Ome()),T6=R(Mme());s(C6,jme,{immediate:!0}),s(w6,kme,{immediate:!0}),s(T6,Nme,{immediate:!0});function Pme(e){v6.has(e)&&(C6.value=e,Xi(qi.colorScheme,e))}function Fme(e){_6.has(e)&&(w6.value=e,Xi(qi.accent,e))}function Ime(e){let t=b6(e);T6.value=t,Xi(qi.uiFontSize,String(t))}var Lme=600,Rme=250,zme=250,Bme=1e3,Vme=160,E6=R(!1),D6=[],O6=null,k6=-250;function Hme(){D6=[],k6=-250,E6.value=!1,O6!==null&&(clearTimeout(O6),O6=null)}function Ume(){E6.value=!0,O6!==null&&clearTimeout(O6),O6=setTimeout(()=>{O6=null,D6=[],k6=-250,E6.value=!1},Bme)}function Wme(e){if(e<=0)return;let t=Date.now();D6.push({time:t,chars:e});let n=t-Lme;if(D6=D6.filter(e=>e.time>=n),t-k6e+t.chars,0)/i*1e3>=Vme&&Ume()}function A6(){return{colorScheme:C6,accent:w6,uiFontSize:T6,fastMoon:E6,setColorScheme:Pme,setAccent:Fme,setUiFontSize:Ime,resetFastMoon:Hme,recordMoonDelta:Wme}}function Gme(e,t,n){return e===`idle`&&!t&&!n}function j6(e,t){let n=Yi(e);return n===null?t:n===`1`}var M6=R(j6(qi.notifyOnComplete,!0)),N6=R(j6(qi.notifyOnQuestion,!1)),P6=R(j6(qi.notifyOnApproval,!1)),F6=R(typeof Notification<`u`?Notification.permission:`denied`),Kme=`/favicon.ico`;async function I6(e,t,n){if(!n){e.value=!1,Xi(t,`0`);return}if(typeof Notification>`u`)return;let r=Notification.permission;if(r==="default")try{r=await Notification.requestPermission()}catch{}F6.value=r,r===`granted`&&(e.value=!0,Xi(t,`1`))}function qme(e){return I6(M6,qi.notifyOnComplete,e)}function Jme(e){return I6(N6,qi.notifyOnQuestion,e)}function Yme(e){return I6(P6,qi.notifyOnApproval,e)}function L6(...e){for(let t of e){let e=t?.trim();if(e)return e}return``}function Xme(e){return{title:Jx.global.t(`settings.notifyTitle`),body:L6(e,Jx.global.t(`settings.notifyFallback`))}}function Zme(e,t){return{title:Jx.global.t(`settings.notifyQuestionTitle`),body:L6(t,e,Jx.global.t(`settings.notifyQuestionFallback`))}}function Qme(e,t){return{title:Jx.global.t(`settings.notifyApprovalTitle`),body:L6(t,e,Jx.global.t(`settings.notifyApprovalFallback`))}}function R6(e,t,n,r){if(!e||typeof Notification>`u`)return;let i=Notification.permission;if(i!==`denied`){if(i==="default"){Notification.requestPermission().then(e=>{F6.value=e,e===`granted`&&z6(t,n,r)});return}z6(t,n,r)}}function z6(e,t,n){if(!e.isUserWatching)try{let r=new Notification(t.title,{body:t.body,tag:n,icon:Kme});r.onclick=()=>{try{window.focus()}catch{}e.onClick(),r.close()}}catch{}}function $me(e,t){R6(M6.value,t,Xme(t.sessionTitle),`pythinker-complete-${e}-${t.promptId??Date.now()}`)}function ehe(e){R6(N6.value,e,Zme(e.sessionTitle,e.questionPreview),`pythinker-question-${e.questionId}`)}function the(e){R6(P6.value,e,Qme(e.sessionTitle,e.toolName),`pythinker-approval-${e.approvalId}`)}function nhe(){return{notifyOnComplete:M6,notifyOnQuestion:N6,notifyOnApproval:P6,notifyPermission:F6,setNotifyOnComplete:qme,setNotifyOnQuestion:Jme,setNotifyOnApproval:Yme,maybeNotifyCompletion:$me,maybeNotifyQuestion:ehe,maybeNotifyApproval:the}}function rhe(){return Yi(qi.soundOnComplete)===`1`}var B6=R(rhe());function ihe(){if(typeof window>`u`)return;let e=window;return window.AudioContext??e.webkitAudioContext}var V6=null;function H6(){let e=ihe();if(!e)return null;if(V6===null)try{V6=new e}catch{return null}return V6}function U6(){if(!B6.value)return;let e=H6();e!==null&&e.state===`suspended`&&e.resume().then(()=>{zx(`sound: audio context resumed`,{state:e.state})},e=>{zx(`sound: audio context resume rejected`,{error:String(e)})})}var W6=!1;function ahe(){if(W6||typeof window>`u`)return;W6=!0;let e=()=>{U6()};window.addEventListener(`pointerdown`,e,{capture:!0}),window.addEventListener(`keydown`,e,{capture:!0})}ahe();function ohe(e){B6.value=e,Xi(qi.soundOnComplete,e?`1`:`0`),e&&U6()}function G6(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t,a.connect(o),o.connect(e.destination);let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.exponentialRampToValueAtTime(i,s+.01),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.start(s),a.stop(s+r+.02)}function K6(){let e=H6();if(e===null){zx(`sound: skipped, AudioContext unavailable`);return}if(e.state!==`running`){zx(`sound: skipped, context not running`,{state:e.state}),e.state===`suspended`&&e.resume().then(()=>{zx(`sound: context resumed for next time`,{state:e.state})},e=>{zx(`sound: resume rejected`,{error:String(e)})});return}try{G6(e,880,0,.16,.18),G6(e,1320,.1,.22,.16),zx(`sound: chime scheduled`,{state:e.state})}catch(e){zx(`sound: failed to play`,{error:String(e)})}}function she(){B6.value&&K6()}function che(){B6.value&&K6()}function lhe(){B6.value&&K6()}function uhe(){return{soundOnComplete:B6,setSoundOnComplete:ohe,maybePlayCompletionSound:she,maybePlayQuestionSound:che,maybePlayApprovalSound:lhe}}var q6=1e3,dhe=4096,J6=32*1024;function fhe(e,t){return e.length===t.length&&e.every((e,n)=>Object.is(e,t[n]))}function Y6(e,t){let n=e,r=t,i=new Set([...Object.keys(n),...Object.keys(r)]);for(let e of i){let t=n[e],i=r[e];if(e===`outputLines`&&Array.isArray(t)&&Array.isArray(i)){if(!fhe(t,i))return!1}else if(e===`routing`&&t&&i){if(!Y6(t,i))return!1}else if(!Object.is(t,i))return!1}return!0}function phe(e,t){let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>{let t=n.get(e.id);return t&&Y6(e,t)?t:e});return r.length===t.length&&r.every((e,n)=>e===t[n])?t:r}function mhe(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{...e,outputLines:t?.outputLines,text:t?.text,outputPreview:e.outputPreview??t?.outputPreview,outputBytes:e.outputBytes??t?.outputBytes}})}function X6(e){return e.status!==`running`}function hhe(e,t){let n=null,r=null,i=null,a=null,o=null,c=0,l,u,d=new Set,f=R(0);function p(e){u!==e&&(u=e,d.clear())}function m(t,n){let r=e.tasksBySession[t]??[],i=phe(mme(mhe(n,r),r),r);i!==r&&(e.tasksBySession={...e.tasksBySession,[t]:i})}function h(e){for(let t of e)X6(t)&&d.add(t.id)}function g(e){return e.some(e=>X6(e)&&!d.has(e.id))}async function _(t,n){try{let r=await Q().listTasks(t,{withOutput:!0,outputBytes:J6,outputStatus:`all`,signal:n});if(n.aborted||e.activeSessionId!==t)return;h(r),m(t,r)}catch{return}}async function v(t){if(e.activeSessionId!==t)return;p(t);let n=++c,r=o;if(a?.abort(),r!==null&&await r,n!==c||e.activeSessionId!==t)return;let i=new AbortController,s=_(t,i.signal);a=i,o=s;try{await s}finally{o===s&&(o=null,a=null)}n===c&&l===t&&e.activeSessionId===t&&b(t)&&x(t,q6)}async function y(t,n){try{let r=Q(),i=await r.listTasks(t,{withOutput:!0,outputBytes:dhe,outputStatus:`running`,signal:n});if(n.aborted||e.activeSessionId!==t)return;if(g(i)){if(i=await r.listTasks(t,{withOutput:!0,outputBytes:J6,outputStatus:`all`,signal:n}),n.aborted||e.activeSessionId!==t)return;h(i)}m(t,i)}catch{return}}function b(t){return(e.tasksBySession[t]??[]).some(e=>e.status===`running`)}function x(e,t){n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,S(e)},t)}async function S(t){if(l!==t||e.activeSessionId!==t||!b(t)||typeof document<`u`&&document.visibilityState===`hidden`)return;if(o!==null){x(t,q6);return}let n=++c,r=new AbortController,i=y(t,r.signal);a=r,o=i;try{await i}finally{o===i&&(o=null,a=null)}n===c&&!r.signal.aborted&&l===t&&e.activeSessionId===t&&b(t)&&x(t,q6)}function C(){document.visibilityState!==`visible`||l===void 0||n!==null||o!==null||S(l)}typeof document<`u`&&document.addEventListener(`visibilitychange`,C);function w(){n!==null&&(clearTimeout(n),n=null),a?.abort(),l=void 0}function T(e){l!==e&&(w(),p(e),l=e,S(e))}let E=s(()=>t.value.some(e=>e.status===`running`),e=>{e&&i===null?i=setInterval(()=>{f.value=(f.value+1)%(2**53-1)},1e3):!e&&i!==null&&(clearInterval(i),i=null)},{immediate:!0}),D=s([()=>e.activeSessionId,()=>{let t=e.activeSessionId;return t===void 0?!1:b(t)}],([t,n],[i,o])=>{if(r!==null&&(clearTimeout(r),r=null),t!==i&&(a?.abort(),p(t)),t!==void 0&&n){T(t);return}w(),!(t===void 0||!o)&&g(e.tasksBySession[t]??[])&&(r=setTimeout(()=>{r=null,e.activeSessionId===t&&!b(t)&&v(t)},1500))},{immediate:!0});function O(){c+=1,typeof document<`u`&&document.removeEventListener(`visibilitychange`,C),E(),D(),w(),r!==null&&clearTimeout(r),r=null,i!==null&&clearInterval(i),i=null,d.clear()}return{taskClock:L(()=>f.value),loadTasksForSession:v,dispose:O}}function ghe(e){return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`new file mode`)||e.startsWith(`deleted file mode`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`similarity index`)||e.startsWith(`dissimilarity index`)||e.startsWith(`rename from`)||e.startsWith(`rename to`)||e.startsWith(`copy from`)||e.startsWith(`copy to`)||e.startsWith(`Binary files`)}function _he(e){let t=[];if(!e)return t;let n=0,r=0,i=!1;for(let a of e.split(` -`)){if(a.startsWith(`diff --git`)){i=!1;continue}if(!i&&ghe(a))continue;if(a.startsWith(`@@`)){let e=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(a);e&&(n=Number.parseInt(e[1],10),r=Number.parseInt(e[2],10)),i=!0,t.push({type:`hunk`,text:a});continue}if(!i||a.startsWith(`\\`))continue;let e=a.charAt(0),o=a.slice(1);e===`+`?(t.push({type:`add`,text:o,newNo:r}),r+=1):e===`-`?(t.push({type:`del`,text:o,oldNo:n}),n+=1):e===` `&&(t.push({type:`context`,text:o,oldNo:n,newNo:r}),n+=1,r+=1)}return t}var Z6=`/sessions/`;function Q6(e){let{pathname:t}=e;if(!t.startsWith(Z6))return;let n=t.slice(10);if(!(!n||n.includes(`/`)))try{let e=decodeURIComponent(n);return e.length>0?e:void 0}catch{return}}function vhe(e){return e===void 0||e.length===0?`/`:`${Z6}${encodeURIComponent(e)}`}var yhe=50,bhe=40402,xhe=40410,She=40110,$6=40113,Che=40902,whe=2e3;function e8(e){return QC(e)&&e.code===Che}var The=40904;function t8(e){return QC(e)&&e.code===The}var n8=N({}),r8=N({}),i8=N({}),a8=N({}),o8=N(new Set),s8=new Map,c8=new Map,l8=new Map,Ehe=0,u8=new Map,Dhe=3,d8=0;function Ohe(){return d8+=1,`${Date.now().toString(36)}-${d8}`}function khe(e){return{generation:s8.get(e)??0,pending:(c8.get(e)?.size??0)>0}}function f8(e){let t=++Ehe;s8.set(e,t);let n=c8.get(e)??new Set;return n.add(t),c8.set(e,n),t}function p8(e,t){let n=c8.get(e);if(n===void 0||(n.delete(t),n.size>0))return;c8.delete(e);let r=l8.get(e);l8.delete(e),r?.()}function Ahe(e){s8.delete(e),c8.delete(e),l8.delete(e),u8.delete(e)}function jhe(e,t){return!t.pending&&t.generation===(s8.get(e)??0)}function Mhe(e,t){if((c8.get(e)?.size??0)===0){t();return}l8.set(e,t)}function Nhe(e,t){let{t:n}=Jx.global,{confirm:r}=K4(),i=new Set,{taskPoller:a,sideChat:o,modelProvider:s,pushOperationFailure:c,activity:l,sessionsKnownEmpty:u,setSessions:d,updateSession:f,upsertSessionFront:p,appendSession:m,forgetSession:h,setActiveSessionId:g,updateSessionMessages:_,nextOptimisticMsgId:v,getEventConn:y,syncSessionFromSnapshot:b,reopenSession:x,hasLoadedMessages:S,refreshSessionStatus:C,refreshSessionGoal:w,persistSessionProfile:T,mergedWorkspaces:E,workspacesView:D,status:O,workspaceIdForSession:k,seedPermissionFromDaemonDefault:A,savePlanModeToStorage:j,saveDynamicWorkflowModeToStorage:M,saveGoalModeToStorage:N,draftModes:ee,saveUnread:P,saveActiveWorkspaceToStorage:F,saveHiddenWorkspacesToStorage:I,goalErrorMessage:te,resetFastMoon:ne,getExpertTalkArmId:re,onExpertTalkPromptAccepted:ie,initialized:ae,connectIssue:L,bootStage:oe,bootRetries:R,selectedDiffPath:se,fileDiffLines:z,fileDiffLoading:ce}=t,B=!1,le=0;function ue(){let t=e.config?.defaultPermissionMode;return t===`auto`||t===`yolo`||t===`manual`?t:`manual`}function de(t){return e.permissionBySession[t]??ue()}async function V(t){if(e.messagesLoadingMoreBySession[t])return;let n=e.messagesBySession[t];if(!n||n.length===0)return;let r=n[0].id;e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[t]:!0},e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[t]:!1};try{let n=await Q().listMessages(t,{beforeId:r,pageSize:yhe}),i=[...n.items].toReversed();_(t,e=>[...i,...e]),e.messagesHasMoreBySession={...e.messagesHasMoreBySession,[t]:n.hasMore}}catch(n){e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[t]:!0},c(`loadOlderMessages`,n,{sessionId:t})}finally{e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[t]:!1}}}function fe(e){a.loadTasksForSession(e),W(e),C(e),w(e),Object.prototype.hasOwnProperty.call(s.skillsBySession.value,e)||s.loadSkillsForSession(e)}async function H(t){let n=e.activeSessionId;if(n){se.value=t,z.value=[],ce.value=!0;try{let e=await Q().getFileDiff(n,t);if(se.value!==t)return;z.value=_he(e.diff)}catch(e){se.value===t&&(z.value=[]),console.warn(`[loadFileDiff] diff unavailable for`,t,e)}finally{se.value===t&&(ce.value=!1)}}}function U(){se.value=null,z.value=[],ce.value=!1}async function W(t){try{let n=await Q().getGitStatus(t);e.gitStatusBySession={...e.gitStatusBySession,[t]:n}}catch{}}async function G(){try{let t=await Q().getAuth();return e.authReady=t.ready,e.defaultModel=t.defaultModel,L.value=null,`proceed`}catch(e){return QC(e)&&(e.code===401||e.code===40101)?(L.value=null,`server-auth-required`):(L.value=(e instanceof Error?e.message:String(e)).slice(0,140),`retry`)}}async function K(){let e=!0;for(R.value=0;;){let t=await G();if(t!==`retry`)return t;R.value+=1,e&&=(L.value=null,!1),await new Promise(e=>{setTimeout(e,whe)})}}async function pe(){try{e.subagentModelPolicy=await Q().getSubagentModelPolicy()}catch{e.subagentModelPolicy=null}}async function me(t){e.subagentModelPolicySaving=!0;try{return e.subagentModelPolicy=await t(e.subagentModelPolicy?.resourceVersion),!0}catch(t){return t instanceof rm?(e.subagentModelPolicy=t.current,c(`saveSubagentModelPolicy`,t,{message:t.message}),!1):(c(`saveSubagentModelPolicy`,t),!1)}finally{e.subagentModelPolicySaving=!1}}function he(e){return me(t=>Q().setSubagentModelPolicy(e,t))}function ge(){return me(e=>Q().clearSubagentModelPolicy(e))}async function _e(){await pe();try{e.config=await Q().getConfig(),A()}catch{}}function ve(t){t!==`manual`&&t!==`auto`&&t!==`yolo`||e.activeSessionId||(e.permission=t)}function ye(t,n){if(n===t)return;s.draftModel.value=null;let r=e.activeSessionId;if(!r)return;let i=e.sessions.find(e=>e.id===r);i===void 0||i.messageCount>0||i.busy||e.inFlightBySession[r]||!i.model||i.model.length===0||i.model!==t||(f(r,e=>({...e,model:n})),T({model:n},r))}async function be(t){try{let n=Q(),r=e.defaultModel,i=await n.setConfig(t);e.config=i,e.defaultModel=i.defaultModel??null;let a=i.defaultModel;return t.defaultPermissionMode!==void 0&&ve(i.defaultPermissionMode??t.defaultPermissionMode),t.defaultModel!==void 0&&a!=null&&a.length>0&&ye(r,a),!0}catch(e){return c(`setConfig`,e),!1}}let xe=720*60*1e3;async function Se(){let e=Q(),t=[],n,r;for(;;){let i;try{i=await e.listSessions({pageSize:100,beforeId:n,excludeEmpty:!0})}catch(e){if(t.length===0)throw e;r=e;break}if(t.push(...i.items),!i.hasMore||i.items.length===0)break;n=i.items.at(-1).id}return{sessions:t,error:r}}function Ce(t){let n=new Map(e.sessions.map(e=>[e.id,e.usage]));d(t.map(e=>{let t=n.get(e.id);return t!==void 0&&_S(e.usage)&&!_S(t)?{...e,usage:t}:e}))}function we(t){let n=[...t],r=new Set(n.map(e=>e.id));for(let t of e.sessions)r.has(t.id)||(n.push(t),r.add(t.id));return n.sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),n}async function Te(e){let t=Q(),n=[],r=Date.now(),i=e=>r-new Date(e.updatedAt).getTime(),a,o=!1,s=!0,c;for(;;){let r;try{r=await t.listSessions({workspaceId:e,pageSize:5,beforeId:a,excludeEmpty:!0})}catch(e){if(s)throw e;c=e,o=!0;break}if(o=r.hasMore,r.items.length===0)break;let l=r.items.at(-1),u=i(l)>=xe;if(!s&&u){let e=r.items.findIndex(e=>i(e)>=xe),t=e>=0?e+1:r.items.length;n.push(...r.items.slice(0,t)),o=r.hasMore||tTe(e.id))),r=[],i=new Set,a=new Map,o=new Set,s;for(let e=0;eo.has(e.id)).map(e=>e.root)),u=new Set(t.map(e=>e.id));for(let t of e.sessions)!(t.workspaceId!==void 0&&u.has(t.workspaceId)?o.has(t.workspaceId):l.has(t.cwd)||o.has(k(t)))||i.has(t.id)||(r.push(t),i.add(t.id));let d={},f={},p={};for(let{id:n}of t){let t=a.get(n);if(t===void 0){let t=e.sessionsHasMoreByWorkspace[n],r=e.sessionsCursorByWorkspace[n],i=e.sessionsInitialCountByWorkspace[n];t!==void 0&&(d[n]=t),r!==void 0&&(f[n]=r),i!==void 0&&(p[n]=i);continue}d[n]=t.hasMore,f[n]=t.items.length>0?t.items.at(-1).id:void 0,p[n]=Math.max(t.items.length,5)}return e.sessionsHasMoreByWorkspace=d,e.sessionsCursorByWorkspace=f,e.sessionsInitialCountByWorkspace=p,e.sessionsFullyLoaded=!1,r.sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),o.size>0&&c(`load`,s),r}function De(){let t=++le;if(e.backend!==`v2`)return;let n={groupPageSize:5,hasPrompt:!0};return{firstPage:Promise.resolve().then(()=>Q().listSessionGroupsV2(n)).then(e=>({page:e}),e=>({error:e})),input:n,serial:t}}function Oe(t,n){let r=new Map(t.map(e=>[e.workspace.id,e])),i=new Map;for(let e of t)e.workspace.cwd!==null&&i.set(p6(e.workspace.cwd),e);let a=[],o=new Set,s={},c={},l={},u=[];for(let t of e.workspaces){let e=r.get(t.id)??i.get(p6(t.root));if(e===void 0){s[t.id]=!n,c[t.id]=void 0,l[t.id]=5;continue}let d=[];for(let n of e.sessions){if(!n.lastPrompt||o.has(n.id))continue;let e={...n,cwd:n.cwd||t.root,workspaceId:t.id};a.push(e),d.push(e),o.add(e.id),(e.busy||e.pendingInteraction===`approval`||e.pendingInteraction===`question`)&&u.push(e.id)}s[t.id]=e.sessions.lengthnew Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),{loaded:a,hasMore:s,cursors:c,counts:l,liveIds:u}}function ke(t,n){if(n===void 0){e.sessionsHasMoreByWorkspace=t.hasMore,e.sessionsCursorByWorkspace=t.cursors,e.sessionsInitialCountByWorkspace=t.counts;return}let r={...e.sessionsHasMoreByWorkspace},i={...e.sessionsCursorByWorkspace},a={...e.sessionsInitialCountByWorkspace};for(let o of e.workspaces)e.sessionsCursorByWorkspace[o.id]===n[o.id]&&(r[o.id]=t.hasMore[o.id]??!1,i[o.id]=t.cursors[o.id],a[o.id]=t.counts[o.id]??5);e.sessionsHasMoreByWorkspace=r,e.sessionsCursorByWorkspace=i,e.sessionsInitialCountByWorkspace=a}async function Ae(t,n,r){let a=[...t.groups],o=t.nextPageToken;for(;o!==null;){if(n.serial!==le)return;let e;try{e=await Q().listSessionGroupsV2({...n.input,pageToken:o})}catch(e){c(`load`,e);return}a.push(...e.groups),o=e.nextPageToken}if(n.serial!==le)return;let s=Oe(a,!0),l=new Set(s.loaded.map(e=>e.id));if(Ce([...s.loaded.filter(e=>!i.has(e.id)),...e.sessions.filter(e=>!l.has(e.id)&&!i.has(e.id))].toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())),e.sessionsFullyLoaded){let t={};for(let n of e.workspaces)t[n.id]=!1;e.sessionsHasMoreByWorkspace=t}else ke(s,r.cursors);await Promise.allSettled(s.liveIds.map(e=>C(e)))}async function je(t){if(e.workspaces.length===0){let e=await Ee();return e===void 0?void 0:{sessions:e,liveIds:[]}}let{page:n,error:r}=await t.firstPage;if(n===void 0){c(`load`,r);return}let i=n.nextPageToken===null,a=Oe(n.groups,i);return ke(a),e.sessionsFullyLoaded=!1,{sessions:a.loaded,liveIds:a.liveIds,finishInBackground:i?void 0:()=>{Ae(n,t,a)}}}async function Me(t){if(e.sessionsLoadingMoreByWorkspace[t]||e.sessionsHasMoreByWorkspace[t]===!1)return;let n=e.sessionsCursorByWorkspace[t];if(n!==void 0){e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[t]:!0};try{let r=await Q().listSessions({workspaceId:t,pageSize:30,beforeId:n,excludeEmpty:!0}),a=new Set(e.sessions.map(e=>e.id)),o=r.items.filter(e=>!a.has(e.id)&&!i.has(e.id));o.length>0&&d([...e.sessions,...o]),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[t]:r.items.length>0?r.items.at(-1).id:n},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[t]:r.hasMore}}catch(e){c(`loadMoreSessions`,e)}finally{e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[t]:!1}}}}async function q(){if(e.sessionsFullyLoaded)return;let t=await Se().catch(e=>(console.warn(`[pythinker-web] loadAllSessions failed; search covers only loaded sessions`,e),null));if(t===null)return;let n=t.error===void 0?t.sessions:we(t.sessions);if(Ce(i.size>0?n.filter(e=>!i.has(e.id)):n),e.sessionsFullyLoaded=t.error===void 0,t.error!==void 0)return;i.clear();let r={};for(let t of e.workspaces)r[t.id]=!1;e.sessionsHasMoreByWorkspace=r}async function Ne(){let t=await Q().getMeta().catch(()=>null);t!==null&&(e.serverVersion=t.serverVersion,e.availableOpenInApps=t.openInApps,e.dangerousBypassAuth=t.dangerousBypassAuth,e.backend=t.backend,e.experimentalFlagStates=t.experimentalFlagStates,e.serverCapabilities=t.capabilities)}async function Pe(){let t=Date.now(),n=`accepted`;Bx(`app:load:start`),e.loading=!0;let r=!ae.value,a=!0;try{if(oe.value=`auth`,R.value=0,r&&await K()===`server-auth-required`){a=!1,n=`auth-required`;return}R.value=0;let t=Q();oe.value=`server`,await Promise.all([t.getHealth().catch(()=>null),Ne(),s.loadModels()]),r||await G(),oe.value=`config`,await _e(),oe.value=`sessions`;let o=De();await Fe();let c=o===void 0?void 0:await je(o),l=o===void 0?await Ee():c?.sessions,u=l===void 0?void 0:i.size>0?l.filter(e=>!i.has(e.id)):l,d=u??e.sessions;u!==void 0&&Ce(u),c?.finishInBackground?.(),c!==void 0&&await Promise.allSettled(c.liveIds.map(e=>C(e)));let f=d[0],p=e.activeWorkspaceId;!(p!==null&&E.value.some(e=>e.id===p))&&f&&Le(k(f)),oe.value=`session`,et();let m=typeof window<`u`?Q6(window.location):void 0;!e.activeSessionId&&m!==void 0&&(e.sessions.some(e=>e.id===m)||await Ze(m))&&await tt(m,{urlMode:`replace`}),!e.activeSessionId&&d.length>0&&await tt(d[0].id,{urlMode:`replace`})}catch(e){n=`failed`,c(`load`,e)}finally{e.loading=!1,a&&(ae.value=!0),Bx(`app:load:complete`,{status:n,sessionId:e.activeSessionId,sessionCount:e.sessions.length,workspaceCount:e.workspaces.length,durationMs:Date.now()-t})}}async function Fe(){try{let t=Q(),[n,r]=await Promise.all([t.listWorkspaces().catch(()=>[]),t.getFsHome().catch(()=>({home:``,recentRoots:[]}))]);e.workspaces=Ie(n),e.fsHome=r.home||null,e.recentRoots=r.recentRoots}catch{}}function Ie(e){let t=oa();return Object.keys(t).length===0?e:e.map(e=>{let n=t[e.root];return n===void 0?e:{...e,name:n}})}function Le(t){e.activeWorkspaceId=t,F(t)}function Re(t){Le(t);let n=e.sessions.filter(e=>k(e)===t);if(n.length>0){let t=n[0];t&&t.id!==e.activeSessionId&&tt(t.id)}else g(void 0),Xe(void 0,`push`)}function ze(t){let n=oa()[t.root],r=n===void 0?t:{...t,name:n},i=p6(r.root);e.hiddenWorkspaceRoots.some(e=>p6(e)===i)&&(e.hiddenWorkspaceRoots=e.hiddenWorkspaceRoots.filter(e=>p6(e)!==i),I(e.hiddenWorkspaceRoots));let a=e.workspaces.findIndex(e=>e.id===r.id||e.root===r.root);if(a===-1){e.workspaces=[r,...e.workspaces];return}let o=[...e.workspaces];o[a]=r,e.workspaces=o}function Be(t){if(t.type===`workspaceCreated`||t.type===`workspaceUpdated`){ze(t.workspace);return}let n=e.workspaces.find(e=>e.id===t.workspaceId)?.root??t.root;if(n&&!e.hiddenWorkspaceRoots.includes(n)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,n],I(e.hiddenWorkspaceRoots)),e.workspaces=e.workspaces.filter(e=>e.id!==t.workspaceId&&e.root!==n),e.activeWorkspaceId===t.workspaceId||e.activeWorkspaceId===n){let t=D.value[0]?.id??null;if(e.activeWorkspaceId=t,t)F(t);else try{Zi(qi.activeWorkspace)}catch{}g(void 0),e.sessionLoading=!1,U(),Xe(void 0,`replace`)}}function Ve(){g(void 0),e.permission=ue(),Xe(void 0,`push`)}function He(e){Le(e),Ve(),U()}async function Ue(t){let n=E.value.find(e=>e.id===t);if(!n)return null;let r=e.thinking,i=e.permission,a=Q(),o,c=n.root;try{let e=await a.addWorkspace({root:n.root});o=e.id,c=e.root,ze(e)}catch{}let l=s.draftModel.value??void 0,u=await a.createSession({workspaceId:o,cwd:c,model:l});s.draftModel.value=null,p(l!==void 0&&(!u.model||u.model.length===0)?{...u,model:l}:u),e.permissionBySession={...e.permissionBySession,[u.id]:i},Le(u.workspaceId??o??t),await tt(u.id);let d=u.id;return r!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[d]:r}),ee.planMode&&(e.planModeBySession={...e.planModeBySession,[d]:!0},j()),ee.dynamicWorkflowMode&&(e.dynamicWorkflowModeBySession={...e.dynamicWorkflowModeBySession,[d]:!0},M()),ee.goalMode&&(e.goalModeBySession={...e.goalModeBySession,[d]:!0},N()),ee.planMode=!1,ee.dynamicWorkflowMode=!1,ee.goalMode=!1,d}async function We(e,t,n){if(!o8.has(e)){o8.add(e);try{let r=await Ue(e);if(!r)return;await nt(r,t,n)}catch(e){c(`startSessionAndSendPrompt`,e)}finally{o8.delete(e)}}}async function Ge(t,n,r){if(!o8.has(t)){o8.add(t);try{let i=await Ue(t);if(!i)return;let a=e.planModeBySession[i]??!1,o=e.dynamicWorkflowModeBySession[i]??!1,c=e.sessions.find(e=>e.id===i);if(!await T({model:(c?.model&&c.model.length>0?c.model:e.defaultModel)??void 0,planMode:a,dynamicWorkflowMode:o,permissionMode:de(i)},i))return;await s.activateSkill(n,r,i)}catch(e){c(`startSessionAndActivateSkill`,e)}finally{o8.delete(t)}}}async function Ke(e,t){if(!o8.has(e)){o8.add(e);try{let n=await Ue(e);if(!n)return;await o.openSideChatOn(n,t)}catch(e){c(`startSessionAndOpenSideChat`,e)}finally{o8.delete(e)}}}async function qe(e){let t=e.trim();if(!t)return!1;let n=Q();try{let e=await n.addWorkspace({root:t});return ze(e),He(e.id),!0}catch(e){return console.warn(`[pythinker-web] addWorkspaceByPath failed for`,t,e),!1}}async function Je(e){try{return await Q().browseFs(e)}catch{return{path:``,parent:null,entries:[]}}}async function Ye(){try{return await Q().getFsHome()}catch{return{home:``,recentRoots:[]}}}function Xe(e,t){if(t===`none`||typeof window>`u`||!window.history)return;let n=vhe(e);if(window.location.pathname!==n)try{t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n)}catch{}}async function Ze(t){try{let n=await Q().getSession(t);return e.sessions.some(e=>e.id===n.id)||m(n),!0}catch{return!1}}function Qe(){let t=Q6(window.location);if(t===void 0){g(void 0);return}if(t!==e.activeSessionId){if(e.sessions.some(e=>e.id===t)){tt(t,{urlMode:`none`});return}(async()=>{if(await Ze(t)){await tt(t,{urlMode:`none`});return}let n=e.sessions[0];n?await tt(n.id,{urlMode:`replace`}):(g(void 0),Xe(void 0,`replace`))})()}}let $e=!1;function et(){$e||typeof window>`u`||($e=!0,window.addEventListener(`popstate`,Qe))}async function tt(t,n){let r=S(t),i=!r&&u.has(t);u.delete(t);try{Xe(t,n?.urlMode??`push`),e.sessionLoading=!r&&!i,g(t),e.permission=de(t),ne(),e.unreadBySession[t]&&(e.unreadBySession={...e.unreadBySession,[t]:!1},P({[t]:!1})),U();let a=e.sessions.find(e=>e.id===t);if(a){let t=k(a);e.activeWorkspaceId!==t&&Le(t)}if(!r){if(await b(t)===`not-found`)return}else if(await x(t)===`not-found`)return;fe(t)}catch(e){c(`selectSession`,e,{sessionId:t})}finally{e.activeSessionId===t&&(e.sessionLoading=!1)}}async function nt(t,r,i){let a=f8(t);e.inFlightBySession={...e.inFlightBySession,[t]:!0};let o=v();try{let n=Q(),a=[];r&&a.push({type:`text`,text:r});for(let e of i??[])e.kind===`video`?a.push({type:`video`,source:{kind:`file`,fileId:e.fileId}}):e.kind===`file`?a.push({type:`file`,fileId:e.fileId,name:e.name??``,mediaType:e.mediaType||`application/octet-stream`,size:e.size??0}):a.push({type:`image`,source:{kind:`file`,fileId:e.fileId}});if(a.length===0)return e.inFlightBySession={...e.inFlightBySession,[t]:!1},`rejected`;let l={id:o,sessionId:t,role:`user`,content:a,createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0}};_(t,e=>[...e,l]);let u=e.sessions.find(e=>e.id===t),d=(u?.model&&u.model.length>0?u.model:e.defaultModel)??void 0,f=re(t),p=e.planModeBySession[t]??!1,m=e.dynamicWorkflowModeBySession[t]??!1,h=e.goalModeBySession[t]??!1;if(h&&r)try{await n.updateSession(t,{goalObjective:r.trim()})}catch(n){return c(`createGoal`,n,{sessionId:t}),e.inFlightBySession={...e.inFlightBySession,[t]:!1},_(t,e=>e.some(e=>e.id===o)?e.filter(e=>e.id!==o):e),`rejected`}let g=await n.submitPrompt(t,{content:a,model:f===void 0?d:void 0,thinking:f===void 0?await s.resolveThinkingForPrompt(t,d)??e.thinking:void 0,permissionMode:f===void 0?de(t):void 0,planMode:f===void 0?p:void 0,dynamicWorkflowMode:f===void 0?m:void 0,expertTalkArmId:f});return g.expertTalkRunId!==void 0&&ie(t,g.expertTalkRunId),h&&(e.goalModeBySession={...e.goalModeBySession,[t]:!1},N()),e.promptIdBySession={...e.promptIdBySession,[t]:g.promptId},_(t,e=>{let t=e.findIndex(e=>e.id===o);if(t===-1)return e;let n=[...e];return n[t]={...n[t],promptId:n[t].promptId??g.promptId},n}),y()?.bindNextPromptId(t,g.promptId),`ok`}catch(r){return e.inFlightBySession={...e.inFlightBySession,[t]:!1},_(t,e=>e.some(e=>e.id===o)?e.filter(e=>e.id!==o):e),QC(r)&&(r.code===She||r.code===$6)?(c(`sendPrompt`,r,{title:n(r.code===$6?`warnings.modelNotResolvedTitle`:`warnings.provisioningRequiredTitle`),message:r.message,sessionId:t}),G()):c(`sendPrompt`,r,{sessionId:t}),QC(r)?`rejected`:`uncertain`}finally{p8(t,a)}}async function rt(t,n){let r=e.activeSessionId;if(r){if(l.value!==`idle`||e.inFlightBySession[r]){ft(t,n);return}if((e.queuedBySession[r]?.length??0)>0){ft(t,n),pt(r);return}await nt(r,t,n)}}let it=new Map;function at(e,t){let n=(it.get(e)??Promise.resolve()).catch(()=>void 0).then(t);return it.set(e,n),n.finally(()=>{it.get(e)===n&&it.delete(e)})}function ot(t,n){let r=e.activeSessionId;return r?at(r,()=>st(r,t,n)):Promise.resolve()}async function st(t,n,r){let i=e.queuedBySession[t]??[],a=[],o=[];for(let e of i){let t=e.text.trim();t&&a.push(t),e.attachments?.length&&o.push(...e.attachments)}let s=n.trim();if(s&&a.push(s),r?.length&&o.push(...r),a.length===0&&o.length===0||(i.length>0&&(e.queuedBySession={...e.queuedBySession,[t]:[]}),await ut(t,a.join(` +`):e}var X4=null,Ude;function Wde(){return X4===null&&(X4=new Intl.Segmenter(Ude,{granularity:`word`})),X4}var Gde=/\p{Script=Arabic}/u,Z4=/\p{M}/u,Q4=/\p{Nd}/u;function $4(e){return Gde.test(e)}function e3(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function t3(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){if(e3((n-55296<<10)+(r-56320)+65536))return!0;t++;continue}}if(e3(n))return!0}}return!1}function Kde(e){let t=l3(e);return t!==null&&(r3.has(t)||o3.has(t))}var qde=new Set([`\xA0`,` `,`⁠`,``]),Jde=new Set([`-`,`‐`,`–`,`—`]);function Yde(e){let t=l3(e);return t!==null&&qde.has(t)}function Xde(e){let t=l3(e);return t!==null&&Jde.has(t)}function n3(e,t){return Yde(e)?!1:t?!(Kde(e)||Xde(e)):!0}var r3=new Set(`,...!.:.;.?.、.。.・.).〕.〉.》.」.』.】.〗.〙.〛.ー.々.〻.ゝ.ゞ.ヽ.ヾ`.split(`.`)),i3=new Set([`"`,`(`,`[`,`{`,`¡`,`¿`,`“`,`‘`,`‚`,`„`,`«`,`‹`,`⸘`,`(`,`〔`,`〈`,`《`,`「`,`『`,`【`,`〖`,`〘`,`〚`]),a3=new Set([`'`,`’`]),o3=new Set(`.(,(!(?(:(;(،(؛(؟(।(॥(၊(။(၌(၍(၏()(](}(%("(”(’(»(›(…`.split(`(`)),Zde=new Set([`:`,`.`,`،`,`؛`]),Qde=new Set([`၏`]),$de=new Set([`”`,`’`,`»`,`›`,`」`,`』`,`】`,`》`,`〉`,`〕`,`)`]);function efe(e){if(s3(e))return!0;let t=!1;for(let n of e){if(o3.has(n)||u3(n)){t=!0;continue}if(!(t&&Z4.test(n)))return!1}return t}function tfe(e){for(let t of e)if(!r3.has(t)&&!o3.has(t))return!1;return e.length>0}function nfe(e){if(s3(e))return!0;for(let t of e)if(!i3.has(t)&&!a3.has(t)&&!Z4.test(t)&&!u3(t))return!1;return e.length>0}function s3(e){let t=!1;for(let n of e)if(!(n===`\\`||Z4.test(n))){if(i3.has(n)||o3.has(n)||a3.has(n)){t=!0;continue}return!1}return t}function c3(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let a=e.charCodeAt(i);return a>=55296&&a<=56319?i:n}function l3(e){if(e.length===0)return null;let t=c3(e,e.length);return e.slice(t)}function rfe(e){for(let t of e)if(!Z4.test(t))return t;return null}function ife(e){for(let t=e.length;t>0;){let n=c3(e,t),r=e.slice(n,t);if(!Z4.test(r))return r;t=n}return null}var afe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function ofe(e,t){for(let n=0;n=t[n]&&e<=t[n+1])return!0;return!1}function u3(e){let t=e.codePointAt(0);return t!==void 0&&ofe(t,afe)}function sfe(e){let t=ife(e);return t!==null&&u3(t)}function cfe(e){let t=rfe(e);return t!==null&&Q4.test(t)}function lfe(e){let t=Array.from(e),n=t.length;for(;n>0;){let e=t[n-1];if(Z4.test(e)){n--;continue}if(i3.has(e)||a3.has(e)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(``),tail:t.slice(n).join(``)}}function ufe(e,t,n){return n===`text`&&!t&&e.length===1&&e!==`-`&&e!==`—`?e:null}function d3(e,t,n,r){let i=t[r],a=e[r];if(i==null)return a;let o=n[r];if(a.length===o)return a;let s=i.repeat(o);return e[r]=s,s}function f3(e,t){return e&&t!==null&&Zde.has(t)}function dfe(e){let t=l3(e);return t!==null&&Qde.has(t)}function ffe(e){if(e.length<2||e[0]!==` `)return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:` `,marks:t}:null}function p3(e){let t=e.length;for(;t>0;){let n=c3(e,t),r=e.slice(n,t);if($de.has(r))return!0;if(!o3.has(r))return!1;t=n}return!1}function pfe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===` `)return`preserved-space`;if(e===` `)return`tab`;if(t.preserveHardBreaks&&e===` +`)return`hard-break`}return e===` `?`space`:e===`\xA0`||e===` `||e===`⁠`||e===``?`glue`:e===`​`?`zero-width-break`:e===`­`?`soft-hyphen`:`text`}var mfe=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function m3(e){return e.length===1?e[0]:e.join(``)}function hfe(e,t){let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);return n.push(t),m3(n)}function gfe(e,t,n,r){if(!mfe.test(e))return[{text:e,isWordLike:t,kind:`text`,start:n}];let i=[],a=null,o=[],s=n,c=!1,l=0;for(let u of e){let e=pfe(u,r),d=e===`text`&&t;if(a!==null&&e===a&&d===c){o.push(u),l+=u.length;continue}a!==null&&i.push({text:m3(o),isWordLike:c,kind:a,start:s}),a=e,o=[u],s=n+l,c=d,l+=u.length}return a!==null&&i.push({text:m3(o),isWordLike:c,kind:a,start:s}),i}function h3(e){return e===`space`||e===`preserved-space`||e===`zero-width-break`||e===`hard-break`}var _fe=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function vfe(e,t){let n=e.texts[t];return n.startsWith(`www.`)?!0:_fe.test(n)&&t+1=e.len||h3(e.kinds[s]))continue;let c=[],l=e.starts[s],u=s;for(;u0&&(t.push(m3(c)),n.push(!0),r.push(`text`),i.push(l),a=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var Sfe=new Set([`:`,`-`,`/`,`×`,`,`,`.`,`+`,`–`,`—`]),Cfe=/[\p{P}\p{S}\p{Co}]/u,wfe=/\p{Emoji_Presentation}/u,Tfe=new Set([`?`,`֊`,`-`,`‐`,`‒`,`–`,`—`,`…`,`‼`,`‽`,`⁉`]);function Efe(e){return e>=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}function g3(e){let t=e.charCodeAt(0);return t<128?Efe(t):!Tfe.has(e)&&!wfe.test(e)&&Cfe.test(e)}function _3(e){let t=!1;for(let n of e)if(!Z4.test(n)){if(!g3(n))return!1;t=!0}return t}function Dfe(e){for(let t=e.length;t>0;){let n=c3(e,t),r=e.slice(n,t);if(Z4.test(r)){t=n;continue}return g3(r)||u3(r)}return!1}function Ofe(e,t,n,r){let i=!t&&_3(e),a=!r&&_3(n),o=sfe(e),s=(t||o)&&Dfe(e);return!i&&!a&&!s||t3(e)||t3(n)?!1:(t||i||o)&&(r||a)}function v3(e){for(let t of e)if(Q4.test(t))return!0;return!1}function y3(e){if(e.length===0)return!1;for(let t of e)if(!(Q4.test(t)||Sfe.has(t)))return!1;return!0}function kfe(e){let t=[],n=[],r=[],i=[];for(let a=0;aa+1){t.push(m3(s)),n.push(u),r.push(`text`),i.push(e.starts[a]),a=l;continue}}t.push(o),n.push(c),r.push(s),i.push(e.starts[a]),a++}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function jfe(e){let t=[],n=[],r=[],i=[];for(let a=0;a1;for(let e=0;e0&&c[S]===`text`&&_&&f[S]&&m[S]||n&&i>0&&c[S]===`text`&&tfe(e.text)&&f[S]||n&&i>0&&c[S]===`text`&&h[S]?C():n&&i>0&&c[S]===`text`&&e.isWordLike&&v&&g[S]?(C(),s[S]=!0):r!==null&&i>0&&c[S]===`text`&&u[S]===r?d[S]=(d[S]??1)+1:n&&!e.isWordLike&&i>0&&c[S]===`text`&&!f[S]&&(efe(e.text)||e.text===`-`&&s[S])?C():(a[i]=e.text,o[i]=[e.text],s[i]=e.isWordLike,c[i]=e.kind,l[i]=e.start,u[i]=r,d[i]=r===null?0:1,f[i]=_,p[i]=v,m[i]=b,h[i]=x,g[i]=f3(v,y),i++)}for(let e=0;enull),v=-1;for(let e=i-1;e>=0;e--){let t=a[e];if(t.length!==0){if(c[e]===`text`&&!s[e]&&v>=0&&c[v]===`text`&&(nfe(t)||t===`-`&&cfe(a[v]))){let n=_[v]??[];n.push(t),_[v]=n,l[v]=l[e],a[e]=``;continue}v=e}}for(let e=0;e=0&&!n3(t.texts[e-1],n)&&d(e),s<0&&(s=e),c||=t3(l);continue}d(e),r.push(l),i.push(t.isWordLike[e]),a.push(u),o.push(t.starts[e])}return d(t.len),{len:r.length,texts:r,isWordLike:i,kinds:a,starts:o}}function Lfe(e,t,n=`normal`,r=`normal`){let i=Bde(n),a=i.mode===`pre-wrap`?Hde(e):Vde(e);if(a.length===0)return{normalized:a,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let o=Pfe(a,t,i),s=r===`keep-all`?Ife(a,o,t.breakKeepAllAfterPunctuation):o;return{normalized:a,chunks:Ffe(s,i),...s}}var b3=null,x3=new Map,S3=null,Rfe=96,zfe=/\p{Emoji_Presentation}/u,Bfe=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,C3=null,w3=new Map;function T3(){if(b3!==null)return b3;if(typeof OffscreenCanvas<`u`)return b3=new OffscreenCanvas(1,1).getContext(`2d`),b3;if(typeof document<`u`)return b3=document.createElement(`canvas`).getContext(`2d`),b3;throw Error(`Text measurement requires OffscreenCanvas or a DOM canvas context.`)}function Vfe(e){let t=x3.get(e);return t||(t=new Map,x3.set(e,t)),t}function E3(e,t){let n=t.get(e);return n===void 0&&(n={width:T3().measureText(e).width,containsCJK:t3(e)},t.set(e,n)),n}function D3(){if(S3!==null)return S3;if(typeof navigator>`u`)return S3={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},S3;let e=navigator.userAgent,t=navigator.vendor===`Apple Computer, Inc.`&&e.includes(`Safari/`)&&!e.includes(`Chrome/`)&&!e.includes(`Chromium/`)&&!e.includes(`CriOS/`)&&!e.includes(`FxiOS/`)&&!e.includes(`EdgiOS/`),n=e.includes(`Chrome/`)||e.includes(`Chromium/`)||e.includes(`CriOS/`)||e.includes(`Edg/`);return S3={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},S3}function Hfe(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}function O3(){return C3===null&&(C3=new Intl.Segmenter(void 0,{granularity:`grapheme`})),C3}function Ufe(e){return zfe.test(e)||e.includes(`️`)}function Wfe(e){return Bfe.test(e)}function Gfe(e,t){let n=w3.get(e);if(n!==void 0)return n;let r=T3();r.font=e;let i=r.measureText(`😀`).width;if(n=0,i>t+.5&&typeof document<`u`&&document.body!==null){let t=document.createElement(`span`);t.style.font=e,t.style.display=`inline-block`,t.style.visibility=`hidden`,t.style.position=`absolute`,t.textContent=`😀`,document.body.appendChild(t);let r=t.getBoundingClientRect().width;document.body.removeChild(t),i-r>.5&&(n=i-r)}return w3.set(e,n),n}function Kfe(e){let t=0,n=O3();for(let r of n.segment(e))Ufe(r.segment)&&t++;return t}function qfe(e,t){return t.emojiCount===void 0&&(t.emojiCount=Kfe(e)),t.emojiCount}function k3(e,t,n){return n===0?t.width:t.width-qfe(e,t)*n}function Jfe(e,t,n,r,i){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===i)return t.breakableFitAdvances;t.breakableFitMode=i;let a=O3(),o=[];for(let t of a.segment(e))o.push(t.segment);if(o.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i===`sum-graphemes`){let e=[];for(let t of o){let i=E3(t,n);e.push(k3(t,i,r))}return t.breakableFitAdvances=e,t.breakableFitAdvances}if(i===`pair-context`||o.length>Rfe){let e=[],i=null,a=0;for(let t of o){let o=k3(t,E3(t,n),r);if(i===null)e.push(o);else{let o=i+t,s=E3(o,n);e.push(k3(o,s,r)-a)}i=t,a=o}return t.breakableFitAdvances=e,t.breakableFitAdvances}let s=[],c=``,l=0;for(let e of o){c+=e;let t=E3(c,n),i=k3(c,t,r);s.push(i-l),l=i}return t.breakableFitAdvances=s,t.breakableFitAdvances}function Yfe(e,t){let n=T3();n.font=e;let r=Vfe(e),i=Hfe(e);return{cache:r,fontSize:i,emojiCorrection:t?Gfe(e,i):0}}function Xfe(e){return e===`space`||e===`zero-width-break`||e===`soft-hyphen`}function A3(e){return e===`space`||e===`preserved-space`||e===`tab`||e===`zero-width-break`||e===`soft-hyphen`}function j3(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function M3(e,t){return t===0?0:e+t}function $fe(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function epe(e,t,n,r,i){return M3(r,t===`tab`?i+$fe(e,n):e.lineEndFitAdvances[n])}function N3(e,t,n,r){return M3(r,t===`tab`?0:e.lineEndFitAdvances[n])}function P3(e,t,n,r,i){return M3(r,t===`tab`?i:e.lineEndPaintAdvances[n])}function tpe(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function npe(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function F3(e,t,n){let r=t;for(;r0)return e.spacingGraphemeCounts[r]>0?e.letterSpacing:0;for(let i=r-1;i>=t;i--){let a=e.kinds[i];if(!(a===`space`||a===`zero-width-break`||a===`hard-break`)){if(a===`soft-hyphen`){if(i===r-1)return 0;continue}return i===t&&n>0||e.spacingGraphemeCounts[i]>0?e.letterSpacing:0}}return 0}function ipe(e,t,n,r,i,a){return t+rpe(e,n,r,i,a)}function ape(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:a,breakablePreferredBreaks:o}=e;if(r.length===0)return 0;let s=t+D3().lineFitEpsilon,c=0,l=0,u=!1,d=0,f=0,p=0,m=0,h=-1,g=0;function _(){h=-1,g=0}function v(e=p,t=m,r=l){c++,n?.(r,d,f,e,t),l=0,u=!1,_()}function y(e,t){u=!0,d=e,f=0,p=e+1,m=0,l=t}function b(e,t,n){u=!0,d=e,f=t,p=e,m=t+1,l=n}function x(e,t){if(!u){y(e,t);return}l+=t,p=e+1,m=0}function S(e,t){let n=a[e],r=o[e]??null,i=r===null?-1:F3(r,0,t+1),c=-1,d=0,f=t;for(;fs){if(r!==null&&c>t){v(e,c,d),f=c,i=F3(r,i,f+1),c=-1,d=0;continue}v(),b(e,f,a)}else l+=a,p=e,m=f+1;let o=f+1;r!==null&&r[i]===o&&(c=o,d=l,i++),f++}u&&p===e&&m===n.length&&(p=e+1,m=0)}let C=0;for(;C=r.length));){let e=r[C],t=i[C],n=A3(t);if(!u){e>s&&a[C]!==null?S(C,0):y(C,e),n&&(h=C+1,g=l-e),C++;continue}if(l+e>s){if(n){x(C,e),v(C+1,0,l-e),C++;continue}if(h>=0){if(p>h||p===h&&m>0){v();continue}v(h,0,g);continue}if(e>s&&a[C]!==null){v(),S(C,0),C++;continue}v();continue}x(C,e),n&&(h=C+1,g=l-e),C++}return u&&v(),c}function ope(e,t,n){if(e.simpleLineWalkFastPath)return ape(e,t,n);let{widths:r,kinds:i,breakableFitAdvances:a,breakablePreferredBreaks:o,discretionaryHyphenWidth:s,chunks:c}=e;if(r.length===0||c.length===0)return 0;let l=D3(),u=t+l.lineFitEpsilon,d=0,f=0,p=!1,m=0,h=0,g=0,_=0,v=-1,y=0,b=0,x=null;function S(){v=-1,y=0,b=0,x=null}function C(){return x===`soft-hyphen`&&v===g&&_===0?b:f}function w(t=g,r=_,i){d++,n!==void 0&&n(ipe(e,i??C(),m,h,t,r),m,h,t,r),f=0,p=!1,S()}function T(e,t){p=!0,m=e,h=0,g=e+1,_=0,f=t}function E(e,t,n){p=!0,m=e,h=t,g=e,_=t+1,f=n}function D(e,t){if(!p){T(e,t);return}f+=t,g=e+1,_=0}function O(t,n,r,i,a,o){if(!n)return;let s=N3(e,t,r,a),c=P3(e,t,r,a,i);v=r+1,y=f-o+s,b=f-o+c,x=t}function k(t,n){let r=a[t],i=o[t]??null,s=i===null?-1:F3(i,0,n+1),c=-1,l=0,d=n;for(;du){if(i!==null&&c>n){w(t,c,l),d=c,s=F3(i,s,d+1),c=-1,l=0;continue}w(),E(t,d,a)}else f=o,g=t,_=d+1}let o=d+1;i!==null&&i[s]===o&&(c=o,l=f,s++),d++}p&&g===t&&_===r.length&&(g=t+1,_=0)}function A(e){d++,n?.(0,e.startSegmentIndex,0,e.consumedEndSegmentIndex,0),S()}for(let t=0;t=n.endSegmentIndex));){let t=i[o],n=A3(t),c=Qfe(e,p,o),d=t===`tab`?Zfe(f+c,e.tabStopAdvance):r[o],m=c+d,h=epe(e,t,o,c,d);if(t===`soft-hyphen`){p&&(g=o+1,_=0,v=o+1,y=f+s,b=f+s,x=t),o++;continue}if(!p){h>u&&a[o]!==null?k(o,0):T(o,d),O(t,n,o,d,c,m),o++;continue}if(f+h>u){let r=f+N3(e,t,o,c),i=f+P3(e,t,o,c,d);if(x===`soft-hyphen`&&l.preferEarlySoftHyphenBreak&&y<=u){w(v,0,b);continue}if(n&&r<=u){D(o,m),w(o+1,0,i),o++;continue}if(v>=0&&y<=u){if(g>v||g===v&&_>0){w();continue}let e=v;w(e,0,b),o=e;continue}if(h>u&&a[o]!==null){w(),k(o,0),o++;continue}w();continue}D(o,m),O(t,n,o,d,c,m),o++}if(p){let e=v===n.consumedEndSegmentIndex?b:f;w(n.consumedEndSegmentIndex,0,e)}}return d}var I3=null;function L3(){return I3===null&&(I3=new Intl.Segmenter(void 0,{granularity:`grapheme`})),I3}function spe(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function cpe(e,t){let n=[],r=[],i=0,a=!1,o=!1,s=!1;function c(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(``),start:i}),r=[],a=!1,o=!1,s=!1)}function l(e,t,n){r=[e],i=t,a=n,o=p3(e),s=i3.has(e)}function u(e,t){r.push(e),a||=t;let n=p3(e);e.length===1&&o3.has(e)?o||=n:o=n,s=!1}for(let n of L3().segment(e)){let e=n.segment,i=t3(e);if(r.length===0){l(e,n.index,i);continue}if(s||r3.has(e)||o3.has(e)||t.carryCJKAfterClosingQuote&&i&&o){u(e,i);continue}if(!a&&!i){u(e,i);continue}c(),l(e,n.index,i)}return c(),n}function lpe(e,t,n){if(t.length<=1)return t;let r=[],i=-1,a=!1;function o(n,i){let a=t[n].start,o=i=0&&!n3(t[e-1].text,n)&&s(e),i<0&&(i=e),a||=t3(r.text)}return s(t.length),r}function R3(e,t){if(t===`zero-width-break`||t===`soft-hyphen`||t===`hard-break`)return 0;if(t===`tab`)return 1;let n=0,r=L3();for(let t of r.segment(e))n++;return n}function upe(e){return e===`-`||e===`֊`||e===`‐`||e===`‒`||e===`–`||e===`—`}function dpe(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;let t=[],n=0;for(let r of L3().segment(e))n++,upe(r.segment)&&t.push(n);return t.length===0?null:t}function fpe(e,t,n){return t>1?e+(t-1)*n:e}function ppe(e,t,n,r,i){let a=D3(),{cache:o,emojiCorrection:s}=Yfe(t,Wfe(e.normalized)),c=k3(`-`,E3(`-`,o),s)+(i===0?0:i*2),l=k3(` `,E3(` `,o),s)*8,u=i!==0;if(e.len===0)return spe(n);let d=[],f=[],p=[],m=[],h=e.chunks.length<=1&&!u,g=n?[]:null,_=[],v=[],y=[],b=n?[]:null,x=Array.from({length:e.len});function S(e,t,n,r,i,a,o,s,c){i!==`text`&&i!==`space`&&i!==`zero-width-break`&&(h=!1),d.push(t),f.push(n),p.push(r),m.push(i),g?.push(a),_.push(o),v.push(s),u&&y.push(c),b!==null&&b.push(e)}function C(e,t,n,c,l){let d=E3(e,o),f=u?R3(e,t):0,p=fpe(k3(e,d,s),f,i),m=t===`space`||t===`preserved-space`||t===`zero-width-break`?0:p,h=m===0?0:m+(f>0?i:0),g=t===`space`||t===`zero-width-break`?0:p;if(l&&c&&e.length>1){let c=`sum-graphemes`;i===0?y3(e)?c=`pair-context`:a.preferPrefixWidthsForBreakableRuns&&(c=`segment-prefixes`):c=`segment-prefixes`;let l=Jfe(e,d,o,s,c);S(e,p,h,g,t,n,l,l===null||r===`keep-all`?null:dpe(e),f);return}S(e,p,h,g,t,n,null,null,f)}for(let t=0;t{e>t&&(t=e)}),t}function ype(e){let t=e.toLowerCase(),n=[],r=0;for(let t of e){let e=t.toLowerCase().length;for(let i=0;i=0&&te[0]-t[0]),n=[];for(let e of t){let t=n.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):n.push([...e])}return n}function V3(e,t){if(!t||t.length===0||e.length===0)return[{text:e,hit:!1}];let n=[],r=0;for(let[i,a]of bpe(t)){let t=Math.max(0,Math.min(i,e.length)),o=Math.max(t,Math.min(a,e.length));o<=t||(t>r&&n.push({text:e.slice(r,t),hit:!1}),n.push({text:e.slice(t,o),hit:!0}),r=o)}return r0?n:[{text:e,hit:!1}]}function H3(e,t){let n=e.toLowerCase().indexOf(t);return n<0?void 0:[n,n+t.length]}function xpe(e,t){let n=e.toLowerCase(),r=-1,i=-1,a=0;for(let e=0;e0,u.value=e.scrollTop+e.clientHeight{let e={},t=`var(--menu-scroll-fade)`,n;return l.value&&u.value?n=`linear-gradient(to bottom, transparent 0, black ${t}, black calc(100% - ${t}), transparent 100%)`:l.value?n=`linear-gradient(to bottom, transparent, black ${t})`:u.value&&(n=`linear-gradient(to top, transparent, black ${t})`),n&&(e.maskImage=n,e.WebkitMaskImage=n),f.value&&(e.maxHeight=f.value),Object.keys(e).length>0?e:void 0}),_=L(()=>{let e=d.value;return e?{top:`${e.top}px`,height:`${e.height}px`}:void 0});function v(){let e=t.value,a=r.value,o=e?.offsetParent;if(!e||!a||!o)return;let s=getComputedStyle(e),c=U3(e,`--space-2`,8),l=(parseFloat(s.paddingTop)||0)+(parseFloat(s.paddingBottom)||0),u=U3(a,i,1/0),d=window.visualViewport?.offsetTop??0,p=o.getBoundingClientRect().top-d-c-l;f.value=`${Math.max(Math.floor(Math.min(u,p)),0)}px`,n(m)}function y(){let e=r.value;if(!e)return;let t=e.querySelectorAll(`[role="option"]`)[a?.value??-1];if(!t)return;let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=i.top-n.top+e.scrollTop,s=o+i.height;oe.scrollTop+e.clientHeight&&(e.scrollTop=s-e.clientHeight)}let b=null;function x(e){let t=r.value,n=d.value;if(!t||!n)return;e.preventDefault(),b?.();let i=e.pointerId;(e.target instanceof Element?e.target:null)?.setPointerCapture?.(i);let a=U3(t,`--menu-scrollbar-track-inset`,0),o=t.clientHeight-a*2-n.height,s=t.scrollHeight-t.clientHeight,c=e.clientY,l=t.scrollTop,u=e=>{e.pointerId!==i||o<=0||(t.scrollTop=l+(e.clientY-c)/o*s)},f=e=>{e.pointerId===i&&b?.()};b=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),b=null},window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)}let S=null;return p(()=>{if(typeof ResizeObserver==`function`&&r.value&&(S=new ResizeObserver(e=>{for(let t of e)t.target===r.value?m():v()}),S.observe(r.value),c)){let e=t.value?.offsetParent;e&&S.observe(e)}c&&(window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v),v()),m()}),h(()=>{S?.disconnect(),S=null,b?.(),window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v)}),s(()=>[a?.value,o?.value],()=>{n(()=>{m(),y()})}),{atTop:l,atBottom:u,thumb:d,scrollStyle:g,thumbStyle:_,onScroll:m,onThumbPointerDown:x}}var Cpe={key:0,class:`slash-empty`,role:`status`},wpe=[`id`,`aria-selected`,`onMouseenter`,`onMousedown`],Tpe={class:`slash-name`},Epe={key:0,class:`slash-match`},Dpe={class:`slash-desc`},Ope={key:0,class:`slash-desc-match`},G3=Y(G({__name:`SlashMenu`,props:{items:{},activeIndex:{},query:{default:``},ranges:{default:()=>[]},layout:{default:`popup`}},emits:[`select`,`hover`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=R(null);pp(a);let o=R(null),{thumb:s,scrollStyle:l,thumbStyle:u,onScroll:d,onThumbPointerDown:f}=W3({menuEl:a,scrollEl:o,maxHeightVar:`--p-slash-menu-h`,activeIndex:L(()=>n.activeIndex),refreshKey:L(()=>n.items),fitToViewport:n.layout!==`sheet`}),p=L(()=>n.items.map((e,t)=>{let r=e.isSkill?e.desc:i(e.desc),a=n.ranges[t]??Spe(n.query,e.name,r);return{item:e,namePieces:V3(e.name,a.name),desc:r,descPieces:V3(r,a.desc)}}));return(e,t)=>(c(),W(`div`,{ref_key:`menuEl`,ref:a,class:V([`slash-menu`,{"is-sheet":n.layout===`sheet`}]),"data-menu-frame":``},[n.items.length===0?(c(),W(`div`,Cpe,U(z(i)(`composer.noCommands`)),1)):E(``,!0),F(`div`,{ref_key:`scrollEl`,ref:o,class:`slash-scroll`,role:`listbox`,style:ae(z(l)),onScroll:t[0]||=(...e)=>z(d)&&z(d)(...e)},[(c(!0),W(M,null,_(p.value,(e,t)=>(c(),W(`div`,{id:`composer-slash-option-${t}`,key:`${e.item.name}-${t}`,class:V([`slash-item`,{active:t===n.activeIndex}]),role:`option`,"aria-selected":t===n.activeIndex,onMouseenter:e=>r(`hover`,t),onMousedown:H(t=>r(`select`,e.item),[`prevent`])},[F(`span`,Tpe,[(c(!0),W(M,null,_(e.namePieces,(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Epe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))]),F(`span`,Dpe,[(c(!0),W(M,null,_(e.descPieces,(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Ope,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))])],42,wpe))),128))],36),z(s)&&n.items.length>0?(c(),W(`div`,{key:1,class:`scroll-thumb`,style:ae(z(u)),onPointerdown:t[1]||=(...e)=>z(f)&&z(f)(...e)},null,36)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-9f177a8d`]]),kpe={key:0,class:`mention-state dim`,role:`status`},Ape={key:1,class:`mention-state dim`,role:`status`},jpe=[`id`,`aria-selected`,`onMouseenter`,`onMousedown`],Mpe=[`innerHTML`],Npe={class:`mention-name`},Ppe={key:0,class:`mention-hit`},Fpe={class:`mention-meta`},Ipe=[`innerHTML`],Lpe={class:`mention-name`},Rpe={key:0,class:`mention-hit`},zpe={key:0,class:`mention-meta`},Bpe={key:0,class:`mention-hit`},K3=Y(G({__name:`MentionMenu`,props:{items:{},activeIndex:{},loading:{type:Boolean,default:!1},stale:{type:Boolean,default:!1},layout:{default:`popup`}},emits:[`select`,`hover`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=R(null);pp(a);let o=R(null),{thumb:s,scrollStyle:l,thumbStyle:u,onScroll:d,onThumbPointerDown:f}=W3({menuEl:a,scrollEl:o,maxHeightVar:`--p-mention-menu-h`,activeIndex:L(()=>n.activeIndex),refreshKey:L(()=>n.items),fitToViewport:n.layout!==`sheet`});function p(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n)}function m(e){let t=e.file.path.endsWith(`/`)?e.file.path.slice(0,-1):e.file.path;return B3(e.file.name,e.file.matchPositions,Math.max(0,t.length-e.file.name.length))}function h(e){return B3(p(e.file.path),e.file.matchPositions,0)}function g(e){return B3(e.skill.name,e.matchPositions,0)}function v(e){return e.kind===`skill`?`skill:${e.skill.name}`:e.file.path}return(e,t)=>(c(),W(`div`,{ref_key:`menuEl`,ref:a,class:V([`mention-menu`,{"is-sheet":n.layout===`sheet`}]),"data-menu-frame":``},[n.loading&&n.items.length===0?(c(),W(`div`,kpe,U(z(i)(`mention.searching`)),1)):n.items.length===0?(c(),W(`div`,Ape,U(z(i)(`mention.noMatch`)),1)):E(``,!0),n.loading&&n.items.length>0?(c(),P(op,{key:2,class:`mention-spin`,size:`sm`,label:z(i)(`mention.searching`)},null,8,[`label`])):E(``,!0),F(`div`,{ref_key:`scrollEl`,ref:o,class:`mention-scroll`,role:`listbox`,style:ae(z(l)),onScroll:t[0]||=(...e)=>z(d)&&z(d)(...e)},[(c(!0),W(M,null,_(n.items,(e,t)=>(c(),W(`div`,{id:`composer-mention-option-${t}`,key:v(e),class:V([`mention-item`,{active:t===n.activeIndex,stale:n.stale&&e.kind!==`skill`}]),role:`option`,"aria-selected":t===n.activeIndex,onMouseenter:e=>r(`hover`,t),onMousedown:H(t=>r(`select`,e),[`prevent`])},[e.kind===`skill`?(c(),W(M,{key:0},[F(`span`,{class:`mention-icon`,innerHTML:z(Of)(`sparkles`,`sm`),"aria-hidden":`true`},null,8,Mpe),F(`span`,Npe,[(c(!0),W(M,null,_(g(e),(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Ppe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))]),F(`span`,Fpe,U(e.skill.description),1)],64)):(c(),W(M,{key:1},[F(`span`,{class:`mention-icon`,innerHTML:z(kf)(e.file.path,e.file.name),"aria-hidden":`true`},null,8,Ipe),F(`span`,Lpe,[(c(!0),W(M,null,_(m(e),(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Rpe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))]),p(e.file.path)?(c(),W(`span`,zpe,[(c(!0),W(M,null,_(h(e),(e,t)=>(c(),W(M,{key:t},[e.hit?(c(),W(`span`,Bpe,U(e.text),1)):(c(),W(M,{key:1},[K(U(e.text),1)],64))],64))),128))])):E(``,!0)],64))],42,jpe))),128))],36),z(s)&&n.items.length>0?(c(),W(`div`,{key:3,class:`scroll-thumb`,style:ae(z(u)),onPointerdown:t[1]||=(...e)=>z(f)&&z(f)(...e)},null,36)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-0ac2fbc1`]]),q3=[{name:`/new`,desc:`commands.new.desc`},{name:`/clear`,desc:`commands.clear.desc`},{name:`/login`,desc:`commands.login.desc`},{name:`/plan`,desc:`commands.plan.desc`},{name:`/discussion`,desc:`commands.expertTalk.desc`},{name:`/workflow`,desc:`commands.dynamicWorkflow.desc`,acceptsInput:!0},{name:`/goal`,desc:`commands.goal.desc`,acceptsInput:!0},{name:`/tower`,desc:`commands.tower.desc`,acceptsInput:!0},{name:`/btw`,desc:`commands.btw.desc`,acceptsInput:!0},{name:`/compact`,desc:`commands.compact.desc`,acceptsInput:!0},{name:`/undo`,desc:`commands.undo.desc`},{name:`/fork`,desc:`commands.fork.desc`},{name:`/export`,desc:`commands.export.desc`},{name:`/status`,desc:`commands.status.desc`}];function Vpe(e){if(!e.startsWith(`/`))return null;let t=e.indexOf(` `);return t===-1?{cmd:e,arg:``}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}var Hpe=`skill:`;function Upe(e){return e.startsWith(`skill:`)?e.slice(6):e}function J3(e=[]){let t=e.map(e=>({name:e.source===`builtin`?`/${e.name}`:`/${Hpe}${e.name}`,desc:e.description,isSkill:!0,acceptsInput:!0}));return[...q3,...t]}function Wpe(e,t=q3){let n=e.toLowerCase().trim().replace(/^\//,``);return n===``?t:t.map((e,t)=>{let r=e.name.toLowerCase().replace(/^\//,``),i=0;return r===n?i=3:r.startsWith(n)?i=2:r.includes(n)&&(i=1),{item:e,index:t,score:i}}).filter(({score:e})=>e>0).toSorted((e,t)=>e.score===t.score?e.index-t.index:t.score-e.score).map(({item:e})=>e)}function Y3(e){if(e===void 0)return`toggle`;let t=e.capabilities??[];return t.includes(`always_thinking`)?`always-on`:t.includes(`thinking`)||e.adaptiveThinking===!0?`toggle`:`unsupported`}function X3(e){return e?.supportEfforts??[]}function Gpe(e){return e[Math.floor(e.length/2)]}function Z3(e){if(Y3(e)===`unsupported`)return`off`;let t=X3(e);return t.length>0?e?.defaultEffort??Gpe(t):`on`}function Q3(e){let t=X3(e),n=Y3(e);return t.length>0?n===`always-on`?[...t]:[`off`,...t]:n===`always-on`?[`on`]:n===`unsupported`?[`off`]:[`on`,`off`]}function $3(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function e6(e,t){return Q3(e).includes(t)}function t6(e,t){return t===`off`?`off`:t===`on`?Z3(e):t}function n6(e,t){return t??Z3(e)}function Kpe(e,t){if(e===`off`)return{enabled:!1};if(e===`on`)return{enabled:!0};let n=t?.at(-1);return n!==void 0&&e===n?{enabled:!0}:{enabled:!0,effort:e}}function qpe(e,t,n){return!n||e===void 0?t:Z3(e)}var r6=100;function Jpe(e){let t=Qi(qi.inputHistory);if(Array.isArray(t)){let n=t.filter(e=>typeof e==`string`&&e.length>0);if(!e||n.length===0)return{};let r=n.length>r6?n.slice(-100):n,i={[e]:r};return $i(qi.inputHistory,i),i}return t&&typeof t==`object`?t:{}}function Ype(e){let{text:t,textareaRef:r,autosize:i,sessionId:a}=e,o=R(Jpe(a())),c=L(()=>o.value[a()??``]??[]),l=-1,u=``;function d(e){let t=a();if(l=-1,!t)return;let n=e.trim();if(!n)return;let r=o.value[t]??[];if(r.at(-1)===n)return;let i=[...r,n],s=i.length>r6?i.slice(-100):i;o.value={...o.value,[t]:s},$i(qi.inputHistory,o.value)}function f(){let e=r.value;return e?(e.selectionStart??0)===0:!1}function p(e){t.value=e,n(()=>{let t=r.value;if(!t)return;i();let n=e.length;t.setSelectionRange(n,n)})}function m(){let e=c.value;if(e.length!==0){if(l===-1)u=t.value,l=e.length-1;else if(l>0)--l;else return;p(e[l])}}function h(){if(l===-1)return;let e=c.value;l0}return s(a,()=>{l=-1}),{push:d,caretAtTextStart:f,recallOlder:m,recallNewer:h,resetBrowsing:g,isBrowsing:_,hasHistory:v}}function Xpe(e){let{text:t,textareaRef:r,autosize:i,skills:a,emitCommand:o,historyPush:s,clearDraft:c}=e,l=R(!1),u=R([]),d=R(0);function f(){let e=t.value;e.startsWith(`/`)&&!e.includes(` `)?(u.value=Wpe(e,J3(a())),d.value=0,l.value=u.value.length>0):l.value=!1}function p(e){if(l.value=!1,e.acceptsInput){t.value=`${e.name} `,n(()=>{let e=r.value;if(!e)return;let n=t.value.length;e.setSelectionRange(n,n),e.focus(),i()});return}t.value=``,c?.(),s(e.name),o(e.name)}return{open:l,items:u,active:d,update:f,select:p}}function Zpe(e){let{text:t,textareaRef:r,autosize:i,searchFiles:a,searchSkills:o,insertSkill:s}=e,c=R(!1),l=R([]),u=R(0),d=R(!1),f=R(!1),p=null,m=0;function h(){let e=t.value,n=r.value?.selectionStart??e.length,i=n-1;for(;i>=0&&!/\s/.test(e[i]);)i--;i++;let a=e.slice(i,n);return a.startsWith(`@`)?{token:a.slice(1),start:i,end:n}:null}function g(){let e=h(),t=a(),n=o?.();if(!e||!t&&!n){c.value=!1,f.value=!1;return}let r=e.token;p!==null&&clearTimeout(p),p=setTimeout(async()=>{let e=++m;d.value=!0,c.value=!0,u.value=0,l.value.length>0&&(f.value=!0);try{let[i,a]=await Promise.all([t?t(r).catch(()=>[]):Promise.resolve([]),n?n(r).catch(()=>[]):Promise.resolve([])]);if(e!==m)return;l.value=[...i.map(e=>({kind:e.path.endsWith(`/`)?`folder`:`file`,file:{...e,matchPositions:z3(r,e.path)}})),...a.map(e=>({kind:`skill`,skill:e,matchPositions:z3(r,e.name)}))]}catch{e===m&&(l.value=[])}finally{e===m&&(d.value=!1,f.value=!1)}},200)}function _(){p!==null&&clearTimeout(p),p=null,m++,c.value=!1,d.value=!1,f.value=!1}function v(e){let a=h();if(!a)return;if(c.value=!1,e.kind===`skill`){s?.(e.skill.name);return}let o=t.value,l=e.file.name||e.file.path.split(/[\\/]/).findLast(Boolean)||e.file.path,u=s4({kind:e.kind,name:l,path:e.file.path});t.value=`${o.slice(0,a.start)}${u} ${o.slice(a.end)}`,n(()=>{let e=r.value;if(!e)return;let t=a.start+u.length+1;e.setSelectionRange(t,t),e.focus(),i()})}function y(e){let a=h();if(!a)return;if(e.kind===`skill`){v(e);return}let o=e.file.name||e.file.path.split(/[\\/]/).findLast(Boolean)||e.file.path,s=t.value;t.value=`${s.slice(0,a.start)}@${o}${s.slice(a.end)}`,c.value=!0,n(()=>{let e=r.value;if(!e)return;let t=a.start+1+o.length;e.setSelectionRange(t,t),e.focus(),i(),g()})}return{open:c,items:l,active:u,loading:d,stale:f,update:g,select:v,complete:y,close:_,getMentionToken:h}}function Qpe(e){let{sessionId:t}=e;function r(e){return Yi(Ji(e))??``}function i(e,t){let n=Ji(e);t?Xi(n,t):Zi(n)}let a=R(r(t())),o=R(null);function c(){let e=o.value;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)}s(a,e=>{n(c),i(t(),e)}),s(t,(e,t)=>{e!==t&&(i(t,a.value),a.value=r(e),n(c))});function l(e){a.value=e,n(()=>{let t=o.value;if(!t)return;t.focus();let n=e.length;t.setSelectionRange(n,n),c()})}function u(){i(t(),``)}return{text:a,textareaRef:o,autosize:c,loadForEdit:l,clearDraft:u}}function $pe(e){let{uploadImage:t,sessionId:n}=e,r=R({}),i=L(()=>r.value[n()??``]??[]),a=R(null),o=R(null),c=R(!1),l=0;function u(){return`att_${++l}`}function d(e,t){r.value={...r.value,[e]:t}}function f(e){let t=0;for(let n of e)(n.kind===`image`||n.kind===`video`)&&n.mediaOrdinal!==void 0&&(t=Math.max(t,n.mediaOrdinal));return t+1}function m(e){return e.kind===`image`?e.mediaOrdinal===void 0?`Image`:`Image ${e.mediaOrdinal}`:e.kind===`video`?e.mediaOrdinal===void 0?`Video`:`Video ${e.mediaOrdinal}`:e.name}function g(e){if(e.previewUrl!==void 0)try{URL.revokeObjectURL(e.previewUrl)}catch{}}function _(e){return e.startsWith(`image/`)?`image`:e.startsWith(`video/`)?`video`:`file`}async function v(e){let i=t();if(!i)return;let a=n()??``;if(e.length!==0)for(let t of e){let e=_(t.type),n=u(),o=e===`file`?void 0:URL.createObjectURL(t),s=r.value[a]??[],c={localId:n,name:t.name,kind:e,previewUrl:o,mediaType:t.type||`application/octet-stream`,size:t.size,mediaOrdinal:e===`file`?void 0:f(s),uploading:!0};d(a,[...s,c]),i(t,t.name).then(e=>{d(a,(r.value[a]??[]).map(t=>t.localId===n?{...t,uploading:!1,fileId:e?.fileId,mediaType:e?.mediaType??t.mediaType,error:e===null}:t))}).catch(()=>{d(a,(r.value[a]??[]).map(e=>e.localId===n?{...e,uploading:!1,error:!0}:e))})}}function y(e){let t=n()??``,i=r.value[t]??[],o=i.find(t=>t.localId===e);a.value?.localId===e&&(a.value=null),o&&g(o),d(t,i.filter(t=>t.localId!==e))}function b(e,t){let i=n()??``,a=[...r.value[i]??[]],o=a.findIndex(t=>t.localId===e);if(o<0)return;let s=Math.max(0,Math.min(t,a.length-1));if(o===s)return;let[c]=a.splice(o,1);c!==void 0&&(a.splice(s,0,c),d(i,a))}function x(e){a.value=e}function S(){a.value=null}function C(){o.value?.click()}function w(e){let t=e.target;v(Array.from(t.files??[])),t.value=``}function T(e){if(!t())return;let n=e.clipboardData;if(!n)return;let r=[],i=new Set,a=(e,t)=>{let n=`${e.size}:${e.type}:${t}`;if(i.has(n))return;i.add(n);let a=e.type.split(`/`)[1]??`png`,o=t.includes(`.`)?t:`paste-${Date.now()}.${a}`;r.push(e instanceof File?e:new File([e],o,{type:e.type}))};for(let e of Array.from(n.items))if(e.kind===`file`){let t=e.getAsFile();t&&a(t,t.name||`paste-${Date.now()}.${e.type.split(`/`)[1]??`png`}`)}for(let e of Array.from(n.files))a(e,e.name);r.length!==0&&(e.preventDefault(),v(r))}let E=0;function D(e){t()&&Array.from(e.dataTransfer?.items??[]).some(e=>e.kind===`file`)&&(e.preventDefault(),e.stopPropagation(),c.value=!0)}function O(){c.value=!1}function k(e){E=0,c.value=!1,t()&&(e.preventDefault(),e.stopPropagation(),v(Array.from(e.dataTransfer?.files??[])))}function A(e){return Array.from(e.dataTransfer?.items??[]).some(e=>e.kind===`file`)}function j(e){!t()||!A(e)||(e.preventDefault(),E+=1,c.value=!0)}function M(e){!t()||!A(e)||e.preventDefault()}function N(e){!t()||!A(e)||(E=Math.max(0,E-1),E===0&&(c.value=!1))}function ee(e){E=0,c.value=!1,t()&&(e.preventDefault(),v(Array.from(e.dataTransfer?.files??[])))}function P(){let e=n()??``;for(let t of r.value[e]??[])g(t);d(e,[])}function F(e,t,n){let i=r.value[e]??[];i.some(e=>e.localId===t)&&d(e,i.map(e=>e.localId===t?{...e,...n}:e))}function I(e){return fetch(e).then(e=>{if(!e.ok)throw Error(`fetch failed: ${e.status}`);return e.blob()})}function te(e){let i=n()??``;for(let e of r.value[i]??[])g(e);d(i,[]);for(let n of e){let e=u(),a=/^data:/i.test(n.url),o=/^blob:/i.test(n.url),s=n.name??n.kind;if(n.fileId){let t=r.value[i]??[],c={localId:e,name:s,kind:n.kind,previewUrl:n.kind===`file`?void 0:n.url,mediaOrdinal:n.kind===`file`?void 0:f(t),uploading:!1,fileId:n.fileId};d(i,[...t,c]),n.kind!==`file`&&!a&&!o&&Q().getFileBlob(n.fileId).then(t=>{let n=URL.createObjectURL(t);if(!(r.value[i]??[]).some(t=>t.localId===e)){URL.revokeObjectURL(n);return}F(i,e,{previewUrl:n})}).catch(()=>{})}else{if(!n.url)continue;let a=t();if(!a)continue;let o=r.value[i]??[],c={localId:e,name:s,kind:n.kind,previewUrl:n.url,mediaOrdinal:n.kind===`file`?void 0:f(o),uploading:!0};d(i,[...o,c]),I(n.url).then(e=>a(e,s.includes(`.`)?s:`${s}.${e.type.split(`/`)[1]??`bin`}`)).then(t=>{if(t===null){d(i,(r.value[i]??[]).filter(t=>t.localId!==e));return}F(i,e,{uploading:!1,fileId:t.fileId})}).catch(()=>{d(i,(r.value[i]??[]).filter(t=>t.localId!==e))})}}}return s(n,()=>{a.value=null}),p(()=>{document.addEventListener(`paste`,T),document.addEventListener(`dragenter`,j),document.addEventListener(`dragover`,M),document.addEventListener(`dragleave`,N),document.addEventListener(`drop`,ee)}),h(()=>{document.removeEventListener(`paste`,T),document.removeEventListener(`dragenter`,j),document.removeEventListener(`dragover`,M),document.removeEventListener(`dragleave`,N),document.removeEventListener(`drop`,ee);for(let e of Object.values(r.value))for(let t of e)g(t);a.value=null}),{attachments:i,previewAttachment:a,fileInputRef:o,isDragOver:c,removeAttachment:y,reorderAttachment:b,mediaLabel:m,openAttachmentPreview:x,closeAttachmentPreview:S,openFilePicker:C,handleFileInputChange:w,handleDragOver:D,handleDragLeave:O,handleDrop:k,clearAfterSubmit:P,loadAttachments:te}}var eme=`(max-width: 640px)`;function i6(){let e=R(!1);if(typeof window>`u`||typeof window.matchMedia!=`function`)return e;let t=window.matchMedia(eme);e.value=t.matches;let n=t=>{e.value=t.matches};return typeof t.addEventListener==`function`?(t.addEventListener(`change`,n),h(()=>t.removeEventListener(`change`,n))):typeof t.addListener==`function`&&(t.addListener(n),h(()=>t.removeListener(n))),e}var tme={class:`ctx-ring`,viewBox:`0 0 20 20`,"aria-hidden":`true`},nme=[`stroke-dasharray`,`stroke-dashoffset`],a6=7,rme=Y(G({__name:`ContextRing`,props:{pct:{}},setup(e){let t=e,n=2*Math.PI*a6;return(e,r)=>(c(),W(`svg`,tme,[F(`circle`,{class:`ctx-ring-track`,cx:`10`,cy:`10`,r:a6,fill:`none`,"stroke-width":`2.5`}),F(`circle`,{class:`ctx-ring-fill`,cx:`10`,cy:`10`,r:a6,fill:`none`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,nme)]))}}),[[`__scopeId`,`data-v-97f3cf66`]]),ime=[`aria-selected`,`onClick`],o6=Y(G({__name:`SegmentedControl`,props:{modelValue:{},options:{},size:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(c(),W(`div`,{class:V([`ui-seg`,`ui-seg--${e.size??`md`}`]),role:`tablist`},[(c(!0),W(M,null,_(e.options,t=>(c(),W(`button`,{key:t.value,class:V([`ui-seg__item`,{"is-on":t.value===e.modelValue}]),type:`button`,role:`tab`,"aria-selected":t.value===e.modelValue,onClick:e=>n(`update:modelValue`,t.value)},U(t.label),11,ime))),128))],2))}}),[[`__scopeId`,`data-v-bffb3dae`]]),s6=[`pythinking`,`pyreasoning`,`pypondering`,`pyplanning`,`pyiterating`,`pyorchestrating`,`reasonating`,`pondercrafting`,`neuroning`,`logic-weaving`,`rubber-duckoning`,`token-wrangling`,`bug-whispering`,`stack-divining`,`gizmo-tinkering`],ame=6e4;function ome(e=Date.now()){return s6[Math.floor(e/6e4)%s6.length]??s6[0]}function sme(e=Date.now()){return`${ome(e)}…`}var c6=[`⣷`,`⣯`,`⣟`,`⡿`,`⢿`,`⣻`,`⣽`,`⣾`],cme=[`aria-label`],l6=Y(G({__name:`ActivitySpinner`,props:{fast:{type:Boolean},label:{}},setup(e){let t=c6.length*80,n=e,r=R(Date.now()),i;p(()=>{n.label===void 0&&(i=setInterval(()=>{r.value=Date.now()},ame))}),h(()=>{i!==void 0&&clearInterval(i)});let a=L(()=>n.label??sme(r.value));function o(e){return{"--spinner-frame-delay":`${e*80-t}ms`,"--spinner-frame-fast-delay":`${e*40-t/2}ms`}}return(t,n)=>(c(),W(`span`,{class:V([`activity-spin`,{"activity-spin--fast":e.fast}]),"aria-label":a.value,role:`img`},[(c(!0),W(M,null,_(z(c6),(e,t)=>(c(),W(`span`,{key:e,class:`activity-frame`,style:ae(o(t)),"aria-hidden":`true`},U(e),5))),128))],10,cme))}}),[[`__scopeId`,`data-v-c12d8332`]]),lme=[`disabled`],ume={key:0,class:`leading`},dme={class:`label`},fme={key:1,class:`count`},pme={key:2,class:`trailing`},u6=Y(G({__name:`MenuRow`,props:{count:{},active:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(c(),W(`button`,{type:`button`,class:V([`menu-row`,{active:e.active,selected:e.selected,disabled:e.disabled}]),disabled:e.disabled},[t.$slots.leading?(c(),W(`span`,ume,[me(t.$slots,`leading`,{},void 0,!0)])):E(``,!0),F(`span`,dme,[me(t.$slots,`label`,{},()=>[me(t.$slots,`default`,{},void 0,!0)],!0)]),e.count===void 0?E(``,!0):(c(),W(`span`,fme,U(e.count),1)),t.$slots.trailing?(c(),W(`span`,pme,[me(t.$slots,`trailing`,{},void 0,!0)])):E(``,!0)],10,lme))}}),[[`__scopeId`,`data-v-261bf74a`]]),mme=[`aria-checked`,`disabled`],d6=Y(G({__name:`SwitchToggle`,props:{modelValue:{type:Boolean},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t;function i(){n.disabled||r(`update:modelValue`,!n.modelValue)}function a(e){n.disabled||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i())}return(t,n)=>(c(),W(`button`,{type:`button`,class:`switch-toggle`,role:`switch`,"aria-checked":e.modelValue,disabled:e.disabled,onClick:i,onKeydown:a},[...n[0]||=[F(`span`,{class:`track`,"aria-hidden":`true`},null,-1),F(`span`,{class:`thumb`,"aria-hidden":`true`},null,-1)]],40,mme))}}),[[`__scopeId`,`data-v-169237c7`]]);function hme({initialized:e,onboardingCompleted:t,authReady:n}){return e?t?n?`app`:`recovery`:`first-run`:`loading`}function gme(e,t){return e||t}function _me(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}var vme=/^(?:[A-Za-z]:[\\/]|\\\\|\/\/)/;function f6(e){let t=e.replaceAll(`\\`,`/`),n=vme.test(t),r=t.replace(/\/+$/,``);return n?r.toLowerCase():r}function yme(e,t){let n=f6(t.cwd);return e.find(e=>f6(e.root)===n)?.id??t.workspaceId??t.cwd}function bme(e){let{workspaces:t,sessions:n,hiddenWorkspaceRoots:r,sessionsHasMoreByWorkspace:i}=e,a=new Set(r.map(f6)),o=new Map;for(let e of t){let t=f6(e.root);a.has(t)||o.has(t)||o.set(t,{...e})}for(let e of n){let t=e.cwd;if(!t)continue;let n=f6(t);a.has(n)||o.has(n)||o.set(n,{id:e.workspaceId??t,root:t,name:_me(t),sessionCount:0})}let s=new Map;for(let e of n){let n=yme(t,e);s.set(n,(s.get(n)??0)+1)}let c=[];for(let e of t){let t=f6(e.root);!a.has(t)&&!c.includes(t)&&c.push(t)}let l=[...o.keys()].filter(e=>!c.includes(e));l.sort((e,t)=>o.get(e).root.localeCompare(o.get(t).root));let u=[];for(let e of[...c,...l]){let t=o.get(e),n=s.get(t.id)??s.get(t.root)??0,r=i[t.id]===!1?n:Math.max(t.sessionCount,n);u.push({...t,sessionCount:r})}return u}function xme(e,t){if(t.length===0||e.length===0)return t;let n=Date.parse(t[0].createdAt);if(Number.isNaN(n))return t;let r=new Set(t.map(e=>e.id)),i=new Set(t.filter(e=>e.role===`user`).map(e=>e.id)),a=e.filter(e=>{let t=Date.parse(e.createdAt);return!(Number.isNaN(t)||t>=n||r.has(e.id)||e.role===`user`&&e.promptId!==void 0&&i.has(e.promptId))});return a.length>0?[...a,...t]:t}function Sme(e,t){let n=new Set(e.map(e=>e.id)),r=t.filter(e=>e.kind===`subagent`&&!n.has(e.id));if(r.length===0)return e;let i=new Map(e.map(e=>[e.id,e])),a=new Map;for(let t of e)t.kind===`subagent`&&t.agentId!==void 0&&!a.has(t.agentId)&&a.set(t.agentId,t);let o=new Set,s=r.map(e=>{let t=(e.backgroundTaskId===void 0?void 0:i.get(e.backgroundTaskId))??a.get(e.id)??(e.agentId===void 0?void 0:a.get(e.agentId));if(t===void 0)return e;o.add(t.id);let n=e.status===`running`&&t.status!==`running`,r=t.completedAt!==void 0&&t.completedAtEstimated!==!0;return{...e,status:e.status===`running`?t.status:e.status,subagentPhase:n?t.status===`completed`?`completed`:t.status===`cancelled`?`cancelled`:`failed`:e.subagentPhase,agentId:e.agentId??t.agentId,model:e.model??t.model,thinkingEffort:e.thinkingEffort??t.thinkingEffort,routing:e.routing??t.routing,currentRoutingEnvRevision:e.currentRoutingEnvRevision??t.currentRoutingEnvRevision,completedAt:r?t.completedAt:e.completedAt??t.completedAt,completedAtEstimated:r||e.completedAt===void 0?t.completedAtEstimated:e.completedAtEstimated,outputPreview:t.outputPreview??e.outputPreview,outputBytes:t.outputBytes??e.outputBytes}});return[...e.filter(e=>!o.has(e.id)),...s]}function Cme(e,t){if(e.length===0)return t;let n=new Map(t.map(e=>[e.id,e])),r=new Set(e.map(e=>e.id)),i=e.map(e=>{let t=n.get(e.id);return t?{...e,outputLines:t.outputLines,text:t.text}:e}),a=t.filter(e=>!r.has(e.id));return a.length===0?i:[...i,...a]}function wme(e){let t=new Map,n=new Set;function r(i){let a=t.get(i);if(a!==void 0)return a;let o=(async()=>e(i))().finally(()=>{t.delete(i),n.delete(i)&&r(i)});return t.set(i,o),o}function i(e){if(t.has(e)){n.add(e);return}r(e)}return{run:r,request:i}}var Tme=new Set([`assistantDelta`,`agentDelta`,`toolOutput`,`taskProgress`]);function Eme(e){return Tme.has(e.type)}var Dme=50,Ome=100,p6=32*1024,kme={requestFrame(e){return typeof requestAnimationFrame==`function`?requestAnimationFrame(e):null},cancelFrame(e){typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(e)},requestTask(e){return setTimeout(e,Dme)},cancelTask(e){clearTimeout(e)}};function Ame(e,t,n={}){let r=n.scheduler??kme,i=Math.max(1,Math.floor(n.maxItemsPerSlice??Ome)),a=[],o=0,s=null,c=null,l=0,u=!1,d=()=>a.length-o,f=()=>{l+=1,s!==null&&(r.cancelFrame(s),s=null),c!==null&&(r.cancelTask(c),c=null)},p=()=>{o===a.length?(a.length=0,o=0):o>=1024&&(a.splice(0,o),o=0)},m,h=()=>{if(u||s!==null||c!==null||d()===0)return;let e=++l,t=()=>{e===l&&m()};s=r.requestFrame(t),c=r.requestTask(t)};m=()=>{f();let t=0;for(;!u&&t{if(!u){if(t(r)){let e=a.length>o?a.at(-1):void 0,t=e===void 0?void 0:n.coalesce?.(e,r);t===void 0?a.push(r):a[a.length-1]=t,h();return}if(d()===0){e(r);return}a.push(r),m()}});return g.flush=()=>{if(!u){for(f();!u&&o{if(u||d()===0)return;let t=o;for(let n=o;n{u||(u=!0,f(),a.length=0,o=0)},g}function m6(e){if(e.type===`assistantDelta`){if(e.delta.text!==void 0&&e.delta.thinking===void 0)return{kind:`text`,value:e.delta.text};if(e.delta.thinking!==void 0&&e.delta.text===void 0)return{kind:`thinking`,value:e.delta.thinking}}}function jme(e){if(e.appEvent.type!==`assistantDelta`)return[e];let t=e.appEvent,n=e.meta.stream,r=m6(t);if(n===void 0||r===void 0||n.kind!==r.kind||r.value.length<=p6)return[e];let i=[],a=0;for(;aa&&/[\uD800-\uDBFF]/u.test(r.value[o-1])&&/[\uDC00-\uDFFF]/u.test(r.value[o])&&--o;let s=r.value.slice(a,o);i.push({appEvent:{...t,delta:r.kind===`text`?{text:s}:{thinking:s}},meta:{...e.meta,stream:{...n,offset:n.offset+a}}}),a=o}return i}function Mme(e,t){if(e.appEvent.type!==`assistantDelta`||t.appEvent.type!==`assistantDelta`)return;let n=e.meta.stream,r=t.meta.stream,i=m6(e.appEvent),a=m6(t.appEvent);if(n===void 0||r===void 0||i===void 0||a===void 0||e.meta.sessionId!==t.meta.sessionId||e.appEvent.sessionId!==t.appEvent.sessionId||e.appEvent.messageId!==t.appEvent.messageId||e.appEvent.contentIndex!==t.appEvent.contentIndex||n.turnId!==r.turnId||n.kind!==r.kind||i.kind!==a.kind||n.kind!==i.kind||r.kind!==a.kind||r.offset!==n.offset+i.value.length||i.value.length+a.value.length>p6)return;let o=i.value+a.value;return{appEvent:{...e.appEvent,delta:i.kind===`text`?{text:o}:{thinking:o}},meta:{...t.meta,stream:{...n}}}}var h6=[{value:`small`,label:`S`},{value:`medium`,label:`M`},{value:`large`,label:`L`},{value:`xlarge`,label:`XL`}],g6=new Set([`blue`,`mono`]),_6=new Set([`light`,`dark`,`system`]),v6=14,Nme=12,Pme=20,Fme={small:12,medium:14,large:16,xlarge:18};function Ime(){let e=Yi(qi.accent);return e&&g6.has(e)?e:`blue`}function Lme(e){typeof document>`u`||!document.documentElement||(document.documentElement.dataset.accent=e)}function Rme(){let e=Yi(qi.colorScheme);return e&&_6.has(e)?e:`system`}function zme(e){if(typeof document>`u`||!document.documentElement)return;document.documentElement.dataset.colorScheme=e;let t=document.querySelectorAll(`meta[name="theme-color"]`);if(t.length===0)return;let n=e===`dark`?`#121212`:e===`light`?`#ffffff`:null;t.forEach(e=>{let t=(e.getAttribute(`media`)??``).includes(`dark`)?`#121212`:`#ffffff`;e.setAttribute(`content`,n??t)})}function y6(e){return Number.isFinite(e)?Math.min(Pme,Math.max(Nme,Math.round(e))):v6}function b6(e){let t=y6(e);return t<=13?`small`:t<=15?`medium`:t<=17?`large`:`xlarge`}function x6(e){return Fme[e]}function Bme(){let e=Yi(qi.uiFontSize);return e===null?v6:y6(Number(e))}function Vme(e){typeof document>`u`||!document.documentElement||(document.documentElement.dataset.fontScale=b6(e))}var S6=R(Rme()),C6=R(Ime()),w6=R(Bme());s(S6,zme,{immediate:!0}),s(C6,Lme,{immediate:!0}),s(w6,Vme,{immediate:!0});function Hme(e){_6.has(e)&&(S6.value=e,Xi(qi.colorScheme,e))}function Ume(e){g6.has(e)&&(C6.value=e,Xi(qi.accent,e))}function Wme(e){let t=y6(e);w6.value=t,Xi(qi.uiFontSize,String(t))}var Gme=600,Kme=250,qme=250,Jme=1e3,Yme=160,T6=R(!1),E6=[],D6=null,O6=-250;function Xme(){E6=[],O6=-250,T6.value=!1,D6!==null&&(clearTimeout(D6),D6=null)}function Zme(){T6.value=!0,D6!==null&&clearTimeout(D6),D6=setTimeout(()=>{D6=null,E6=[],O6=-250,T6.value=!1},Jme)}function Qme(e){if(e<=0)return;let t=Date.now();E6.push({time:t,chars:e});let n=t-Gme;if(E6=E6.filter(e=>e.time>=n),t-O6e+t.chars,0)/i*1e3>=Yme&&Zme()}function k6(){return{colorScheme:S6,accent:C6,uiFontSize:w6,fastMoon:T6,setColorScheme:Hme,setAccent:Ume,setUiFontSize:Wme,resetFastMoon:Xme,recordMoonDelta:Qme}}function $me(e,t,n){return e===`idle`&&!t&&!n}function A6(e,t){let n=Yi(e);return n===null?t:n===`1`}var j6=R(A6(qi.notifyOnComplete,!0)),M6=R(A6(qi.notifyOnQuestion,!1)),N6=R(A6(qi.notifyOnApproval,!1)),P6=R(typeof Notification<`u`?Notification.permission:`denied`),ehe=`/favicon.ico`;async function F6(e,t,n){if(!n){e.value=!1,Xi(t,`0`);return}if(typeof Notification>`u`)return;let r=Notification.permission;if(r==="default")try{r=await Notification.requestPermission()}catch{}P6.value=r,r===`granted`&&(e.value=!0,Xi(t,`1`))}function the(e){return F6(j6,qi.notifyOnComplete,e)}function nhe(e){return F6(M6,qi.notifyOnQuestion,e)}function rhe(e){return F6(N6,qi.notifyOnApproval,e)}function I6(...e){for(let t of e){let e=t?.trim();if(e)return e}return``}function ihe(e){return{title:fC.global.t(`settings.notifyTitle`),body:I6(e,fC.global.t(`settings.notifyFallback`))}}function ahe(e,t){return{title:fC.global.t(`settings.notifyQuestionTitle`),body:I6(t,e,fC.global.t(`settings.notifyQuestionFallback`))}}function ohe(e,t){return{title:fC.global.t(`settings.notifyApprovalTitle`),body:I6(t,e,fC.global.t(`settings.notifyApprovalFallback`))}}function L6(e,t,n,r){if(!e||typeof Notification>`u`)return;let i=Notification.permission;if(i!==`denied`){if(i==="default"){Notification.requestPermission().then(e=>{P6.value=e,e===`granted`&&R6(t,n,r)});return}R6(t,n,r)}}function R6(e,t,n){if(!e.isUserWatching)try{let r=new Notification(t.title,{body:t.body,tag:n,icon:ehe});r.onclick=()=>{try{window.focus()}catch{}e.onClick(),r.close()}}catch{}}function she(e,t){L6(j6.value,t,ihe(t.sessionTitle),`pythinker-complete-${e}-${t.promptId??Date.now()}`)}function che(e){L6(M6.value,e,ahe(e.sessionTitle,e.questionPreview),`pythinker-question-${e.questionId}`)}function lhe(e){L6(N6.value,e,ohe(e.sessionTitle,e.toolName),`pythinker-approval-${e.approvalId}`)}function uhe(){return{notifyOnComplete:j6,notifyOnQuestion:M6,notifyOnApproval:N6,notifyPermission:P6,setNotifyOnComplete:the,setNotifyOnQuestion:nhe,setNotifyOnApproval:rhe,maybeNotifyCompletion:she,maybeNotifyQuestion:che,maybeNotifyApproval:lhe}}function dhe(){return Yi(qi.soundOnComplete)===`1`}var z6=R(dhe());function fhe(){if(typeof window>`u`)return;let e=window;return window.AudioContext??e.webkitAudioContext}var B6=null;function V6(){let e=fhe();if(!e)return null;if(B6===null)try{B6=new e}catch{return null}return B6}function H6(){if(!z6.value)return;let e=V6();e!==null&&e.state===`suspended`&&e.resume().then(()=>{rC(`sound: audio context resumed`,{state:e.state})},e=>{rC(`sound: audio context resume rejected`,{error:String(e)})})}var U6=!1;function phe(){if(U6||typeof window>`u`)return;U6=!0;let e=()=>{H6()};window.addEventListener(`pointerdown`,e,{capture:!0}),window.addEventListener(`keydown`,e,{capture:!0})}phe();function mhe(e){z6.value=e,Xi(qi.soundOnComplete,e?`1`:`0`),e&&H6()}function W6(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t,a.connect(o),o.connect(e.destination);let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.exponentialRampToValueAtTime(i,s+.01),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.start(s),a.stop(s+r+.02)}function G6(){let e=V6();if(e===null){rC(`sound: skipped, AudioContext unavailable`);return}if(e.state!==`running`){rC(`sound: skipped, context not running`,{state:e.state}),e.state===`suspended`&&e.resume().then(()=>{rC(`sound: context resumed for next time`,{state:e.state})},e=>{rC(`sound: resume rejected`,{error:String(e)})});return}try{W6(e,880,0,.16,.18),W6(e,1320,.1,.22,.16),rC(`sound: chime scheduled`,{state:e.state})}catch(e){rC(`sound: failed to play`,{error:String(e)})}}function hhe(){z6.value&&G6()}function ghe(){z6.value&&G6()}function _he(){z6.value&&G6()}function vhe(){return{soundOnComplete:z6,setSoundOnComplete:mhe,maybePlayCompletionSound:hhe,maybePlayQuestionSound:ghe,maybePlayApprovalSound:_he}}var K6=1e3,yhe=4096,q6=32*1024;function bhe(e,t){return e.length===t.length&&e.every((e,n)=>Object.is(e,t[n]))}function J6(e,t){let n=e,r=t,i=new Set([...Object.keys(n),...Object.keys(r)]);for(let e of i){let t=n[e],i=r[e];if(e===`outputLines`&&Array.isArray(t)&&Array.isArray(i)){if(!bhe(t,i))return!1}else if(e===`routing`&&t&&i){if(!J6(t,i))return!1}else if(!Object.is(t,i))return!1}return!0}function xhe(e,t){let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>{let t=n.get(e.id);return t&&J6(e,t)?t:e});return r.length===t.length&&r.every((e,n)=>e===t[n])?t:r}function She(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{...e,outputLines:t?.outputLines,text:t?.text,outputPreview:e.outputPreview??t?.outputPreview,outputBytes:e.outputBytes??t?.outputBytes}})}function Y6(e){return e.status!==`running`}function Che(e,t){let n=null,r=null,i=null,a=null,o=null,c=0,l,u,d=new Set,f=R(0);function p(e){u!==e&&(u=e,d.clear())}function m(t,n){let r=e.tasksBySession[t]??[],i=xhe(Sme(She(n,r),r),r);i!==r&&(e.tasksBySession={...e.tasksBySession,[t]:i})}function h(e){for(let t of e)Y6(t)&&d.add(t.id)}function g(e){return e.some(e=>Y6(e)&&!d.has(e.id))}async function _(t,n){try{let r=await Q().listTasks(t,{withOutput:!0,outputBytes:q6,outputStatus:`all`,signal:n});if(n.aborted||e.activeSessionId!==t)return;h(r),m(t,r)}catch{return}}async function v(t){if(e.activeSessionId!==t)return;p(t);let n=++c,r=o;if(a?.abort(),r!==null&&await r,n!==c||e.activeSessionId!==t)return;let i=new AbortController,s=_(t,i.signal);a=i,o=s;try{await s}finally{o===s&&(o=null,a=null)}n===c&&l===t&&e.activeSessionId===t&&b(t)&&x(t,K6)}async function y(t,n){try{let r=Q(),i=await r.listTasks(t,{withOutput:!0,outputBytes:yhe,outputStatus:`running`,signal:n});if(n.aborted||e.activeSessionId!==t)return;if(g(i)){if(i=await r.listTasks(t,{withOutput:!0,outputBytes:q6,outputStatus:`all`,signal:n}),n.aborted||e.activeSessionId!==t)return;h(i)}m(t,i)}catch{return}}function b(t){return(e.tasksBySession[t]??[]).some(e=>e.status===`running`)}function x(e,t){n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,S(e)},t)}async function S(t){if(l!==t||e.activeSessionId!==t||!b(t)||typeof document<`u`&&document.visibilityState===`hidden`)return;if(o!==null){x(t,K6);return}let n=++c,r=new AbortController,i=y(t,r.signal);a=r,o=i;try{await i}finally{o===i&&(o=null,a=null)}n===c&&!r.signal.aborted&&l===t&&e.activeSessionId===t&&b(t)&&x(t,K6)}function C(){document.visibilityState!==`visible`||l===void 0||n!==null||o!==null||S(l)}typeof document<`u`&&document.addEventListener(`visibilitychange`,C);function w(){n!==null&&(clearTimeout(n),n=null),a?.abort(),l=void 0}function T(e){l!==e&&(w(),p(e),l=e,S(e))}let E=s(()=>t.value.some(e=>e.status===`running`),e=>{e&&i===null?i=setInterval(()=>{f.value=(f.value+1)%(2**53-1)},1e3):!e&&i!==null&&(clearInterval(i),i=null)},{immediate:!0}),D=s([()=>e.activeSessionId,()=>{let t=e.activeSessionId;return t===void 0?!1:b(t)}],([t,n],[i,o])=>{if(r!==null&&(clearTimeout(r),r=null),t!==i&&(a?.abort(),p(t)),t!==void 0&&n){T(t);return}w(),!(t===void 0||!o)&&g(e.tasksBySession[t]??[])&&(r=setTimeout(()=>{r=null,e.activeSessionId===t&&!b(t)&&v(t)},1500))},{immediate:!0});function O(){c+=1,typeof document<`u`&&document.removeEventListener(`visibilitychange`,C),E(),D(),w(),r!==null&&clearTimeout(r),r=null,i!==null&&clearInterval(i),i=null,d.clear()}return{taskClock:L(()=>f.value),loadTasksForSession:v,dispose:O}}function whe(e){return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`new file mode`)||e.startsWith(`deleted file mode`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`similarity index`)||e.startsWith(`dissimilarity index`)||e.startsWith(`rename from`)||e.startsWith(`rename to`)||e.startsWith(`copy from`)||e.startsWith(`copy to`)||e.startsWith(`Binary files`)}function The(e){let t=[];if(!e)return t;let n=0,r=0,i=!1;for(let a of e.split(` +`)){if(a.startsWith(`diff --git`)){i=!1;continue}if(!i&&whe(a))continue;if(a.startsWith(`@@`)){let e=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(a);e&&(n=Number.parseInt(e[1],10),r=Number.parseInt(e[2],10)),i=!0,t.push({type:`hunk`,text:a});continue}if(!i||a.startsWith(`\\`))continue;let e=a.charAt(0),o=a.slice(1);e===`+`?(t.push({type:`add`,text:o,newNo:r}),r+=1):e===`-`?(t.push({type:`del`,text:o,oldNo:n}),n+=1):e===` `&&(t.push({type:`context`,text:o,oldNo:n,newNo:r}),n+=1,r+=1)}return t}var X6=`/sessions/`;function Z6(e){let{pathname:t}=e;if(!t.startsWith(X6))return;let n=t.slice(10);if(!(!n||n.includes(`/`)))try{let e=decodeURIComponent(n);return e.length>0?e:void 0}catch{return}}function Ehe(e){return e===void 0||e.length===0?`/`:`${X6}${encodeURIComponent(e)}`}var Dhe=50,Ohe=40402,khe=40410,Ahe=40110,Q6=40113,jhe=40902,Mhe=2e3;function $6(e){return gT(e)&&e.code===jhe}var Nhe=40904;function e8(e){return gT(e)&&e.code===Nhe}var t8=N({}),n8=N({}),r8=N({}),i8=N({}),a8=N(new Set),o8=new Map,s8=new Map,c8=new Map,Phe=0,l8=new Map,Fhe=3,u8=0;function Ihe(){return u8+=1,`${Date.now().toString(36)}-${u8}`}function Lhe(e){return{generation:o8.get(e)??0,pending:(s8.get(e)?.size??0)>0}}function d8(e){let t=++Phe;o8.set(e,t);let n=s8.get(e)??new Set;return n.add(t),s8.set(e,n),t}function f8(e,t){let n=s8.get(e);if(n===void 0||(n.delete(t),n.size>0))return;s8.delete(e);let r=c8.get(e);c8.delete(e),r?.()}function Rhe(e){o8.delete(e),s8.delete(e),c8.delete(e),l8.delete(e)}function zhe(e,t){return!t.pending&&t.generation===(o8.get(e)??0)}function Bhe(e,t){if((s8.get(e)?.size??0)===0){t();return}c8.set(e,t)}function Vhe(e,t){let{t:n}=fC.global,{confirm:r}=G4(),i=new Set,{taskPoller:a,sideChat:o,modelProvider:s,pushOperationFailure:c,activity:l,sessionsKnownEmpty:u,setSessions:d,updateSession:f,upsertSessionFront:p,appendSession:m,forgetSession:h,setActiveSessionId:g,updateSessionMessages:_,nextOptimisticMsgId:v,getEventConn:y,syncSessionFromSnapshot:b,reopenSession:x,hasLoadedMessages:S,refreshSessionStatus:C,refreshSessionGoal:w,persistSessionProfile:T,mergedWorkspaces:E,workspacesView:D,status:O,workspaceIdForSession:k,seedPermissionFromDaemonDefault:A,savePlanModeToStorage:j,saveDynamicWorkflowModeToStorage:M,saveGoalModeToStorage:N,draftModes:ee,saveUnread:P,saveActiveWorkspaceToStorage:F,saveHiddenWorkspacesToStorage:I,goalErrorMessage:te,resetFastMoon:ne,getExpertTalkArmId:re,onExpertTalkPromptAccepted:ie,initialized:ae,connectIssue:L,bootStage:oe,bootRetries:R,selectedDiffPath:se,fileDiffLines:z,fileDiffLoading:ce}=t,B=!1,le=0;function ue(){let t=e.config?.defaultPermissionMode;return t===`auto`||t===`yolo`||t===`manual`?t:`manual`}function de(t){return e.permissionBySession[t]??ue()}async function V(t){if(e.messagesLoadingMoreBySession[t])return;let n=e.messagesBySession[t];if(!n||n.length===0)return;let r=n[0].id;e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[t]:!0},e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[t]:!1};try{let n=await Q().listMessages(t,{beforeId:r,pageSize:Dhe}),i=[...n.items].toReversed();_(t,e=>[...i,...e]),e.messagesHasMoreBySession={...e.messagesHasMoreBySession,[t]:n.hasMore}}catch(n){e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[t]:!0},c(`loadOlderMessages`,n,{sessionId:t})}finally{e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[t]:!1}}}function fe(e){a.loadTasksForSession(e),W(e),C(e),w(e),Object.prototype.hasOwnProperty.call(s.skillsBySession.value,e)||s.loadSkillsForSession(e)}async function H(t){let n=e.activeSessionId;if(n){se.value=t,z.value=[],ce.value=!0;try{let e=await Q().getFileDiff(n,t);if(se.value!==t)return;z.value=The(e.diff)}catch(e){se.value===t&&(z.value=[]),console.warn(`[loadFileDiff] diff unavailable for`,t,e)}finally{se.value===t&&(ce.value=!1)}}}function U(){se.value=null,z.value=[],ce.value=!1}async function W(t){try{let n=await Q().getGitStatus(t);e.gitStatusBySession={...e.gitStatusBySession,[t]:n}}catch{}}async function G(){try{let t=await Q().getAuth();return e.authReady=t.ready,e.defaultModel=t.defaultModel,L.value=null,`proceed`}catch(e){return gT(e)&&(e.code===401||e.code===40101)?(L.value=null,`server-auth-required`):(L.value=(e instanceof Error?e.message:String(e)).slice(0,140),`retry`)}}async function K(){let e=!0;for(R.value=0;;){let t=await G();if(t!==`retry`)return t;R.value+=1,e&&=(L.value=null,!1),await new Promise(e=>{setTimeout(e,Mhe)})}}async function pe(){try{e.subagentModelPolicy=await Q().getSubagentModelPolicy()}catch{e.subagentModelPolicy=null}}async function me(t){e.subagentModelPolicySaving=!0;try{return e.subagentModelPolicy=await t(e.subagentModelPolicy?.resourceVersion),!0}catch(t){return t instanceof Hp?(e.subagentModelPolicy=t.current,c(`saveSubagentModelPolicy`,t,{message:t.message}),!1):(c(`saveSubagentModelPolicy`,t),!1)}finally{e.subagentModelPolicySaving=!1}}function he(e){return me(t=>Q().setSubagentModelPolicy(e,t))}function ge(){return me(e=>Q().clearSubagentModelPolicy(e))}async function _e(){await pe();try{e.config=await Q().getConfig(),A()}catch{}}function ve(t){t!==`manual`&&t!==`auto`&&t!==`yolo`||e.activeSessionId||(e.permission=t)}function ye(t,n){if(n===t)return;s.draftModel.value=null;let r=e.activeSessionId;if(!r)return;let i=e.sessions.find(e=>e.id===r);i===void 0||i.messageCount>0||i.busy||e.inFlightBySession[r]||!i.model||i.model.length===0||i.model!==t||(f(r,e=>({...e,model:n})),T({model:n},r))}async function be(t){try{let n=Q(),r=e.defaultModel,i=await n.setConfig(t);e.config=i,e.defaultModel=i.defaultModel??null;let a=i.defaultModel;return t.defaultPermissionMode!==void 0&&ve(i.defaultPermissionMode??t.defaultPermissionMode),t.defaultModel!==void 0&&a!=null&&a.length>0&&ye(r,a),!0}catch(e){return c(`setConfig`,e),!1}}let xe=720*60*1e3;async function Se(){let e=Q(),t=[],n,r;for(;;){let i;try{i=await e.listSessions({pageSize:100,beforeId:n,excludeEmpty:!0})}catch(e){if(t.length===0)throw e;r=e;break}if(t.push(...i.items),!i.hasMore||i.items.length===0)break;n=i.items.at(-1).id}return{sessions:t,error:r}}function Ce(t){let n=new Map(e.sessions.map(e=>[e.id,e.usage]));d(t.map(e=>{let t=n.get(e.id);return t!==void 0&&FC(e.usage)&&!FC(t)?{...e,usage:t}:e}))}function we(t){let n=[...t],r=new Set(n.map(e=>e.id));for(let t of e.sessions)r.has(t.id)||(n.push(t),r.add(t.id));return n.sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),n}async function Te(e){let t=Q(),n=[],r=Date.now(),i=e=>r-new Date(e.updatedAt).getTime(),a,o=!1,s=!0,c;for(;;){let r;try{r=await t.listSessions({workspaceId:e,pageSize:5,beforeId:a,excludeEmpty:!0})}catch(e){if(s)throw e;c=e,o=!0;break}if(o=r.hasMore,r.items.length===0)break;let l=r.items.at(-1),u=i(l)>=xe;if(!s&&u){let e=r.items.findIndex(e=>i(e)>=xe),t=e>=0?e+1:r.items.length;n.push(...r.items.slice(0,t)),o=r.hasMore||tTe(e.id))),r=[],i=new Set,a=new Map,o=new Set,s;for(let e=0;eo.has(e.id)).map(e=>e.root)),u=new Set(t.map(e=>e.id));for(let t of e.sessions)!(t.workspaceId!==void 0&&u.has(t.workspaceId)?o.has(t.workspaceId):l.has(t.cwd)||o.has(k(t)))||i.has(t.id)||(r.push(t),i.add(t.id));let d={},f={},p={};for(let{id:n}of t){let t=a.get(n);if(t===void 0){let t=e.sessionsHasMoreByWorkspace[n],r=e.sessionsCursorByWorkspace[n],i=e.sessionsInitialCountByWorkspace[n];t!==void 0&&(d[n]=t),r!==void 0&&(f[n]=r),i!==void 0&&(p[n]=i);continue}d[n]=t.hasMore,f[n]=t.items.length>0?t.items.at(-1).id:void 0,p[n]=Math.max(t.items.length,5)}return e.sessionsHasMoreByWorkspace=d,e.sessionsCursorByWorkspace=f,e.sessionsInitialCountByWorkspace=p,e.sessionsFullyLoaded=!1,r.sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),o.size>0&&c(`load`,s),r}function De(){let t=++le;if(e.backend!==`v2`)return;let n={groupPageSize:5,hasPrompt:!0};return{firstPage:Promise.resolve().then(()=>Q().listSessionGroupsV2(n)).then(e=>({page:e}),e=>({error:e})),input:n,serial:t}}function Oe(t,n){let r=new Map(t.map(e=>[e.workspace.id,e])),i=new Map;for(let e of t)e.workspace.cwd!==null&&i.set(f6(e.workspace.cwd),e);let a=[],o=new Set,s={},c={},l={},u=[];for(let t of e.workspaces){let e=r.get(t.id)??i.get(f6(t.root));if(e===void 0){s[t.id]=!n,c[t.id]=void 0,l[t.id]=5;continue}let d=[];for(let n of e.sessions){if(!n.lastPrompt||o.has(n.id))continue;let e={...n,cwd:n.cwd||t.root,workspaceId:t.id};a.push(e),d.push(e),o.add(e.id),(e.busy||e.pendingInteraction===`approval`||e.pendingInteraction===`question`)&&u.push(e.id)}s[t.id]=e.sessions.lengthnew Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),{loaded:a,hasMore:s,cursors:c,counts:l,liveIds:u}}function ke(t,n){if(n===void 0){e.sessionsHasMoreByWorkspace=t.hasMore,e.sessionsCursorByWorkspace=t.cursors,e.sessionsInitialCountByWorkspace=t.counts;return}let r={...e.sessionsHasMoreByWorkspace},i={...e.sessionsCursorByWorkspace},a={...e.sessionsInitialCountByWorkspace};for(let o of e.workspaces)e.sessionsCursorByWorkspace[o.id]===n[o.id]&&(r[o.id]=t.hasMore[o.id]??!1,i[o.id]=t.cursors[o.id],a[o.id]=t.counts[o.id]??5);e.sessionsHasMoreByWorkspace=r,e.sessionsCursorByWorkspace=i,e.sessionsInitialCountByWorkspace=a}async function Ae(t,n,r){let a=[...t.groups],o=t.nextPageToken;for(;o!==null;){if(n.serial!==le)return;let e;try{e=await Q().listSessionGroupsV2({...n.input,pageToken:o})}catch(e){c(`load`,e);return}a.push(...e.groups),o=e.nextPageToken}if(n.serial!==le)return;let s=Oe(a,!0),l=new Set(s.loaded.map(e=>e.id));if(Ce([...s.loaded.filter(e=>!i.has(e.id)),...e.sessions.filter(e=>!l.has(e.id)&&!i.has(e.id))].toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())),e.sessionsFullyLoaded){let t={};for(let n of e.workspaces)t[n.id]=!1;e.sessionsHasMoreByWorkspace=t}else ke(s,r.cursors);await Promise.allSettled(s.liveIds.map(e=>C(e)))}async function je(t){if(e.workspaces.length===0){let e=await Ee();return e===void 0?void 0:{sessions:e,liveIds:[]}}let{page:n,error:r}=await t.firstPage;if(n===void 0){c(`load`,r);return}let i=n.nextPageToken===null,a=Oe(n.groups,i);return ke(a),e.sessionsFullyLoaded=!1,{sessions:a.loaded,liveIds:a.liveIds,finishInBackground:i?void 0:()=>{Ae(n,t,a)}}}async function Me(t){if(e.sessionsLoadingMoreByWorkspace[t]||e.sessionsHasMoreByWorkspace[t]===!1)return;let n=e.sessionsCursorByWorkspace[t];if(n!==void 0){e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[t]:!0};try{let r=await Q().listSessions({workspaceId:t,pageSize:30,beforeId:n,excludeEmpty:!0}),a=new Set(e.sessions.map(e=>e.id)),o=r.items.filter(e=>!a.has(e.id)&&!i.has(e.id));o.length>0&&d([...e.sessions,...o]),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[t]:r.items.length>0?r.items.at(-1).id:n},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[t]:r.hasMore}}catch(e){c(`loadMoreSessions`,e)}finally{e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[t]:!1}}}}async function q(){if(e.sessionsFullyLoaded)return;let t=await Se().catch(e=>(console.warn(`[pythinker-web] loadAllSessions failed; search covers only loaded sessions`,e),null));if(t===null)return;let n=t.error===void 0?t.sessions:we(t.sessions);if(Ce(i.size>0?n.filter(e=>!i.has(e.id)):n),e.sessionsFullyLoaded=t.error===void 0,t.error!==void 0)return;i.clear();let r={};for(let t of e.workspaces)r[t.id]=!1;e.sessionsHasMoreByWorkspace=r}async function Ne(){let t=await Q().getMeta().catch(()=>null);t!==null&&(e.serverVersion=t.serverVersion,e.availableOpenInApps=t.openInApps,e.dangerousBypassAuth=t.dangerousBypassAuth,e.backend=t.backend,e.experimentalFlagStates=t.experimentalFlagStates,e.serverCapabilities=t.capabilities)}async function Pe(){let t=Date.now(),n=`accepted`;iC(`app:load:start`),e.loading=!0;let r=!ae.value,a=!0;try{if(oe.value=`auth`,R.value=0,r&&await K()===`server-auth-required`){a=!1,n=`auth-required`;return}R.value=0;let t=Q();oe.value=`server`,await Promise.all([t.getHealth().catch(()=>null),Ne(),s.loadModels()]),r||await G(),oe.value=`config`,await _e(),oe.value=`sessions`;let o=De();await Fe();let c=o===void 0?void 0:await je(o),l=o===void 0?await Ee():c?.sessions,u=l===void 0?void 0:i.size>0?l.filter(e=>!i.has(e.id)):l,d=u??e.sessions;u!==void 0&&Ce(u),c?.finishInBackground?.(),c!==void 0&&await Promise.allSettled(c.liveIds.map(e=>C(e)));let f=d[0],p=e.activeWorkspaceId;!(p!==null&&E.value.some(e=>e.id===p))&&f&&Le(k(f)),oe.value=`session`,et();let m=typeof window<`u`?Z6(window.location):void 0;!e.activeSessionId&&m!==void 0&&(e.sessions.some(e=>e.id===m)||await Ze(m))&&await tt(m,{urlMode:`replace`}),!e.activeSessionId&&d.length>0&&await tt(d[0].id,{urlMode:`replace`})}catch(e){n=`failed`,c(`load`,e)}finally{e.loading=!1,a&&(ae.value=!0),iC(`app:load:complete`,{status:n,sessionId:e.activeSessionId,sessionCount:e.sessions.length,workspaceCount:e.workspaces.length,durationMs:Date.now()-t})}}async function Fe(){try{let t=Q(),[n,r]=await Promise.all([t.listWorkspaces().catch(()=>[]),t.getFsHome().catch(()=>({home:``,recentRoots:[]}))]);e.workspaces=Ie(n),e.fsHome=r.home||null,e.recentRoots=r.recentRoots}catch{}}function Ie(e){let t=oa();return Object.keys(t).length===0?e:e.map(e=>{let n=t[e.root];return n===void 0?e:{...e,name:n}})}function Le(t){e.activeWorkspaceId=t,F(t)}function Re(t){Le(t);let n=e.sessions.filter(e=>k(e)===t);if(n.length>0){let t=n[0];t&&t.id!==e.activeSessionId&&tt(t.id)}else g(void 0),Xe(void 0,`push`)}function ze(t){let n=oa()[t.root],r=n===void 0?t:{...t,name:n},i=f6(r.root);e.hiddenWorkspaceRoots.some(e=>f6(e)===i)&&(e.hiddenWorkspaceRoots=e.hiddenWorkspaceRoots.filter(e=>f6(e)!==i),I(e.hiddenWorkspaceRoots));let a=e.workspaces.findIndex(e=>e.id===r.id||e.root===r.root);if(a===-1){e.workspaces=[r,...e.workspaces];return}let o=[...e.workspaces];o[a]=r,e.workspaces=o}function Be(t){if(t.type===`workspaceCreated`||t.type===`workspaceUpdated`){ze(t.workspace);return}let n=e.workspaces.find(e=>e.id===t.workspaceId)?.root??t.root;if(n&&!e.hiddenWorkspaceRoots.includes(n)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,n],I(e.hiddenWorkspaceRoots)),e.workspaces=e.workspaces.filter(e=>e.id!==t.workspaceId&&e.root!==n),e.activeWorkspaceId===t.workspaceId||e.activeWorkspaceId===n){let t=D.value[0]?.id??null;if(e.activeWorkspaceId=t,t)F(t);else try{Zi(qi.activeWorkspace)}catch{}g(void 0),e.sessionLoading=!1,U(),Xe(void 0,`replace`)}}function Ve(){g(void 0),e.permission=ue(),Xe(void 0,`push`)}function He(e){Le(e),Ve(),U()}async function Ue(t){let n=E.value.find(e=>e.id===t);if(!n)return null;let r=e.thinking,i=e.permission,a=Q(),o,c=n.root;try{let e=await a.addWorkspace({root:n.root});o=e.id,c=e.root,ze(e)}catch{}let l=s.draftModel.value??void 0,u=await a.createSession({workspaceId:o,cwd:c,model:l});s.draftModel.value=null,p(l!==void 0&&(!u.model||u.model.length===0)?{...u,model:l}:u),e.permissionBySession={...e.permissionBySession,[u.id]:i},Le(u.workspaceId??o??t),await tt(u.id);let d=u.id;return r!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[d]:r}),ee.planMode&&(e.planModeBySession={...e.planModeBySession,[d]:!0},j()),ee.dynamicWorkflowMode&&(e.dynamicWorkflowModeBySession={...e.dynamicWorkflowModeBySession,[d]:!0},M()),ee.goalMode&&(e.goalModeBySession={...e.goalModeBySession,[d]:!0},N()),ee.planMode=!1,ee.dynamicWorkflowMode=!1,ee.goalMode=!1,d}async function We(e,t,n){if(!a8.has(e)){a8.add(e);try{let r=await Ue(e);if(!r)return;await nt(r,t,n)}catch(e){c(`startSessionAndSendPrompt`,e)}finally{a8.delete(e)}}}async function Ge(t,n,r){if(!a8.has(t)){a8.add(t);try{let i=await Ue(t);if(!i)return;let a=e.planModeBySession[i]??!1,o=e.dynamicWorkflowModeBySession[i]??!1,c=e.sessions.find(e=>e.id===i);if(!await T({model:(c?.model&&c.model.length>0?c.model:e.defaultModel)??void 0,planMode:a,dynamicWorkflowMode:o,permissionMode:de(i)},i))return;await s.activateSkill(n,r,i)}catch(e){c(`startSessionAndActivateSkill`,e)}finally{a8.delete(t)}}}async function Ke(e,t){if(!a8.has(e)){a8.add(e);try{let n=await Ue(e);if(!n)return;await o.openSideChatOn(n,t)}catch(e){c(`startSessionAndOpenSideChat`,e)}finally{a8.delete(e)}}}async function qe(e){let t=e.trim();if(!t)return!1;let n=Q();try{let e=await n.addWorkspace({root:t});return ze(e),He(e.id),!0}catch(e){return console.warn(`[pythinker-web] addWorkspaceByPath failed for`,t,e),!1}}async function Je(e){try{return await Q().browseFs(e)}catch{return{path:``,parent:null,entries:[]}}}async function Ye(){try{return await Q().getFsHome()}catch{return{home:``,recentRoots:[]}}}function Xe(e,t){if(t===`none`||typeof window>`u`||!window.history)return;let n=Ehe(e);if(window.location.pathname!==n)try{t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n)}catch{}}async function Ze(t){try{let n=await Q().getSession(t);return e.sessions.some(e=>e.id===n.id)||m(n),!0}catch{return!1}}function Qe(){let t=Z6(window.location);if(t===void 0){g(void 0);return}if(t!==e.activeSessionId){if(e.sessions.some(e=>e.id===t)){tt(t,{urlMode:`none`});return}(async()=>{if(await Ze(t)){await tt(t,{urlMode:`none`});return}let n=e.sessions[0];n?await tt(n.id,{urlMode:`replace`}):(g(void 0),Xe(void 0,`replace`))})()}}let $e=!1;function et(){$e||typeof window>`u`||($e=!0,window.addEventListener(`popstate`,Qe))}async function tt(t,n){let r=S(t),i=!r&&u.has(t);u.delete(t);try{Xe(t,n?.urlMode??`push`),e.sessionLoading=!r&&!i,g(t),e.permission=de(t),ne(),e.unreadBySession[t]&&(e.unreadBySession={...e.unreadBySession,[t]:!1},P({[t]:!1})),U();let a=e.sessions.find(e=>e.id===t);if(a){let t=k(a);e.activeWorkspaceId!==t&&Le(t)}if(!r){if(await b(t)===`not-found`)return}else if(await x(t)===`not-found`)return;fe(t)}catch(e){c(`selectSession`,e,{sessionId:t})}finally{e.activeSessionId===t&&(e.sessionLoading=!1)}}async function nt(t,r,i){let a=d8(t);e.inFlightBySession={...e.inFlightBySession,[t]:!0};let o=v();try{let n=Q(),a=[];r&&a.push({type:`text`,text:r});for(let e of i??[])e.kind===`video`?a.push({type:`video`,source:{kind:`file`,fileId:e.fileId}}):e.kind===`file`?a.push({type:`file`,fileId:e.fileId,name:e.name??``,mediaType:e.mediaType||`application/octet-stream`,size:e.size??0}):a.push({type:`image`,source:{kind:`file`,fileId:e.fileId}});if(a.length===0)return e.inFlightBySession={...e.inFlightBySession,[t]:!1},`rejected`;let l={id:o,sessionId:t,role:`user`,content:a,createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0}};_(t,e=>[...e,l]);let u=e.sessions.find(e=>e.id===t),d=(u?.model&&u.model.length>0?u.model:e.defaultModel)??void 0,f=re(t),p=e.planModeBySession[t]??!1,m=e.dynamicWorkflowModeBySession[t]??!1,h=e.goalModeBySession[t]??!1;if(h&&r)try{await n.updateSession(t,{goalObjective:r.trim()})}catch(n){return c(`createGoal`,n,{sessionId:t}),e.inFlightBySession={...e.inFlightBySession,[t]:!1},_(t,e=>e.some(e=>e.id===o)?e.filter(e=>e.id!==o):e),`rejected`}let g=await n.submitPrompt(t,{content:a,model:f===void 0?d:void 0,thinking:f===void 0?await s.resolveThinkingForPrompt(t,d)??e.thinking:void 0,permissionMode:f===void 0?de(t):void 0,planMode:f===void 0?p:void 0,dynamicWorkflowMode:f===void 0?m:void 0,expertTalkArmId:f});return g.expertTalkRunId!==void 0&&ie(t,g.expertTalkRunId),h&&(e.goalModeBySession={...e.goalModeBySession,[t]:!1},N()),e.promptIdBySession={...e.promptIdBySession,[t]:g.promptId},_(t,e=>{let t=e.findIndex(e=>e.id===o);if(t===-1)return e;let n=[...e];return n[t]={...n[t],promptId:n[t].promptId??g.promptId},n}),y()?.bindNextPromptId(t,g.promptId),`ok`}catch(r){return e.inFlightBySession={...e.inFlightBySession,[t]:!1},_(t,e=>e.some(e=>e.id===o)?e.filter(e=>e.id!==o):e),gT(r)&&(r.code===Ahe||r.code===Q6)?(c(`sendPrompt`,r,{title:n(r.code===Q6?`warnings.modelNotResolvedTitle`:`warnings.provisioningRequiredTitle`),message:r.message,sessionId:t}),G()):c(`sendPrompt`,r,{sessionId:t}),gT(r)?`rejected`:`uncertain`}finally{f8(t,a)}}async function rt(t,n){let r=e.activeSessionId;if(r){if(l.value!==`idle`||e.inFlightBySession[r]){ft(t,n);return}if((e.queuedBySession[r]?.length??0)>0){ft(t,n),pt(r);return}await nt(r,t,n)}}let it=new Map;function at(e,t){let n=(it.get(e)??Promise.resolve()).catch(()=>void 0).then(t);return it.set(e,n),n.finally(()=>{it.get(e)===n&&it.delete(e)})}function ot(t,n){let r=e.activeSessionId;return r?at(r,()=>st(r,t,n)):Promise.resolve()}async function st(t,n,r){let i=e.queuedBySession[t]??[],a=[],o=[];for(let e of i){let t=e.text.trim();t&&a.push(t),e.attachments?.length&&o.push(...e.attachments)}let s=n.trim();if(s&&a.push(s),r?.length&&o.push(...r),a.length===0&&o.length===0||(i.length>0&&(e.queuedBySession={...e.queuedBySession,[t]:[]}),await ut(t,a.join(` -`),o)!==`rejected`||i.length===0))return;let c=e.queuedBySession[t]??[];e.queuedBySession={...e.queuedBySession,[t]:[...i,...c]}}function ct(t){let n=e.activeSessionId;if(!n)return Promise.resolve();let r=(e.queuedBySession[n]??[])[t];if(r===void 0)return Promise.resolve();let i=r.id??r.text;return at(n,()=>lt(n,i))}async function lt(t,n){let r=e.queuedBySession[t]??[],i=r.findIndex(e=>(e.id??e.text)===n),a=i>=0?r[i]:void 0;if(a===void 0)return;let o=a.attachments??[];if(a.text.trim().length===0&&o.length===0)return;let s=[...r];if(s.splice(i,1),e.queuedBySession={...e.queuedBySession,[t]:s},await ut(t,a.text,o)!==`rejected`||!e.sessions.some(e=>e.id===t))return;let c=[...e.queuedBySession[t]??[]];c.splice(Math.min(i,c.length),0,a),e.queuedBySession={...e.queuedBySession,[t]:c}}async function ut(t,n,r){if(l.value===`idle`&&!e.inFlightBySession[t])return nt(t,n,r);let i=[];n&&i.push({type:`text`,text:n});for(let e of r)e.kind===`video`?i.push({type:`video`,source:{kind:`file`,fileId:e.fileId}}):e.kind===`file`?i.push({type:`file`,fileId:e.fileId,name:e.name??``,mediaType:e.mediaType||`application/octet-stream`,size:e.size??0}):i.push({type:`image`,source:{kind:`file`,fileId:e.fileId}});let a=v(),o={id:a,sessionId:t,role:`user`,content:i,createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0}};_(t,e=>[...e,o]);let u=f8(t);try{let n=Q(),r=e.sessions.find(e=>e.id===t),o=(r?.model&&r.model.length>0?r.model:e.defaultModel)??void 0,c=await n.submitPrompt(t,{content:i,model:o,thinking:await s.resolveThinkingForPrompt(t,o)??e.thinking,permissionMode:de(t),planMode:e.planModeBySession[t]??!1,dynamicWorkflowMode:e.dynamicWorkflowModeBySession[t]??!1});if(_(t,e=>{let t=e.findIndex(e=>e.id===a);if(t===-1)return e;let n=[...e];return n[t]={...n[t],promptId:n[t].promptId??c.promptId},n}),c.status!==`queued`)return e.promptIdBySession={...e.promptIdBySession,[t]:c.promptId},y()?.bindNextPromptId(t,c.promptId),`ok`;try{await n.steerPrompts(t,[c.promptId])}catch{return`ok`}return`ok`}catch(e){return _(t,e=>e.filter(e=>e.id!==a)),c(`steer`,e,{sessionId:t}),QC(e)?`rejected`:`uncertain`}finally{p8(t,u)}}async function dt(e,t){try{let n=await Q().uploadFile({file:e,name:t});return{fileId:n.id,name:n.name,mediaType:n.mediaType}}catch(e){return c(`uploadImage`,e),null}}function ft(t,n){let r=e.activeSessionId;if(!r)return;let i=e.queuedBySession[r]??[],a={text:t,attachments:n,id:Ohe()};e.queuedBySession={...e.queuedBySession,[r]:[...i,a]}}function pt(t){let[n,...r]=e.queuedBySession[t]??[];n!==void 0&&(e.queuedBySession={...e.queuedBySession,[t]:r},nt(t,n.text,n.attachments).then(r=>{if(r===`ok`){u8.delete(t);return}if(r===`uncertain`){u8.delete(t);return}if(!e.sessions.some(e=>e.id===t)){u8.delete(t);return}let i=n.id??n.text,a=u8.get(t),o=a!==void 0&&a.key===i?a.count+1:1;if(o>=Dhe){u8.delete(t),(e.queuedBySession[t]?.length??0)>0&&pt(t);return}u8.set(t,{key:i,count:o});let s=e.queuedBySession[t]??[];e.queuedBySession={...e.queuedBySession,[t]:[n,...s]}}))}function mt(t,n){let r=e.inFlightBySession[t]===!0;if(e.inFlightBySession={...e.inFlightBySession,[t]:!1},e.promptIdBySession[t]!==void 0){let n={...e.promptIdBySession};delete n[t],e.promptIdBySession=n}return t===e.activeSessionId&&ne(),(r||n?.turnWasActive===!0||(e.turnActiveBySession[t]??!1))&&pt(t),r}function ht(e,t){t.inFlightTurn!==null&&t.busy||mt(e)}async function gt(){let t=e.activeSessionId;if(!t)return;let n=e.sessions.find(e=>e.id===t),r=e.promptIdBySession[t];if(r===void 0){let e=n?.currentPromptId;e!==void 0&&e.length>0&&!e.startsWith(`pr_`)&&(r=e)}let i=Q();if(r!==void 0)try{if((await i.abortPrompt(t,r)).aborted)return;let n={...e.promptIdBySession};delete n[t],e.promptIdBySession=n}catch(n){if(QC(n)&&n.code===bhe){let n={...e.promptIdBySession};delete n[t],e.promptIdBySession=n}else{c(`abortCurrentPrompt`,n,{sessionId:t});return}}try{await i.abortSession(t)}catch(e){c(`abortCurrentPrompt`,e,{sessionId:t})}}function _t(t,n){let r=e.approvalsBySession[t]??[];e.approvalsBySession={...e.approvalsBySession,[t]:r.filter(e=>e.approvalId!==n)}}function vt(t,n){let r=e.questionsBySession[t]??[];e.questionsBySession={...e.questionsBySession,[t]:r.filter(e=>e.questionId!==n)}}async function yt(t,n){let r=e.activeSessionId;if(r&&!r8[t]){r8[t]=!0;try{let e=Q(),i={decision:n.decision,scope:n.scope,feedback:n.feedback,selectedLabel:n.selectedLabel};await e.respondApproval(r,t,i),_t(r,t)}catch(e){e8(e)?_t(r,t):c(`respondApproval`,e,{sessionId:r})}finally{delete r8[t]}}}async function bt(t,n){let r=e.activeSessionId;if(r&&!n8[t]){n8[t]=`answer`;try{await Q().respondQuestion(r,t,n),vt(r,t)}catch(e){e8(e)?vt(r,t):c(`respondQuestion`,e,{sessionId:r})}finally{delete n8[t]}}}async function xt(t){let n=e.activeSessionId;if(n&&!n8[t]){n8[t]=`dismiss`;try{await Q().dismissQuestion(n,t),vt(n,t)}catch(e){e8(e)?vt(n,t):c(`dismissQuestion`,e,{sessionId:n})}finally{delete n8[t]}}}async function St(t){let n=e.activeSessionId;if(n&&!a8[t]){a8[t]=!0;try{let r=Q(),i=e=>e.id===t||e.parentToolCallId===t,a=(e.tasksBySession[n]??[]).find(i),o;if(a===void 0){let e;try{e=await r.listTasks(n)}catch(e){c(`detachTask`,e,{sessionId:n});return}let t=e.find(i);if(t===void 0)return;a=t,o=t.id}let s=a;o??=s.backgroundTaskId??s.id;let l=await r.detachTask(n,o),u=e.tasksBySession[n]??[];e.tasksBySession={...e.tasksBySession,[n]:u.map(e=>e.id===s.id?l.status===`running`?{...e,runInBackground:!0}:{...e,status:l.status,completedAt:e.completedAt??new Date().toISOString(),completedAtEstimated:e.completedAt===void 0?!0:e.completedAtEstimated}:e)}}catch(e){t8(e)||c(`detachTask`,e,{sessionId:n})}finally{delete a8[t]}}}async function Ct(t){let n=e.activeSessionId;if(n&&!i8[t]){i8[t]=!0;try{let r=Q(),i=(e.tasksBySession[n]??[]).find(e=>e.id===t)?.backgroundTaskId;await r.cancelTask(n,i??t);let a=e.tasksBySession[n]??[];e.tasksBySession={...e.tasksBySession,[n]:a.map(e=>e.id===t?{...e,status:`cancelled`}:e)}}catch(e){t8(e)||c(`cancelTask`,e,{sessionId:n})}finally{delete i8[t]}}}function wt(t){let n=e.activeSessionId;n?(e.planModeBySession={...e.planModeBySession,[n]:t},j(),T({planMode:t})):ee.planMode=t}function Tt(){let t=e.activeSessionId;wt(!(t?e.planModeBySession[t]??!1:ee.planMode))}function Et(t,n){let r=e.activeSessionId;r?(e.towerModeBySession={...e.towerModeBySession,[r]:t},T({towerMode:t,...t&&n!==void 0&&n.trim()!==``?{towerBase:n.trim()}:{}})):ee.towerMode=t}function Dt(){let t=e.activeSessionId;Et(!(t?e.towerModeBySession[t]??!1:ee.towerMode))}function Ot(t){let n=e.activeSessionId;n?(e.dynamicWorkflowModeBySession={...e.dynamicWorkflowModeBySession,[n]:t},M(),T({dynamicWorkflowMode:t})):ee.dynamicWorkflowMode=t}async function kt(){let t=e.activeSessionId,i=!(t?e.dynamicWorkflowModeBySession[t]??!1:ee.dynamicWorkflowMode);i&&e.permission===`manual`&&!await r({title:n(`workspace.dynamicWorkflowEnableTitle`),message:n(`workspace.dynamicWorkflowEnableConfirm`),variant:`primary`})||Ot(i)}function At(t){let n=e.activeSessionId;n?(e.goalModeBySession={...e.goalModeBySession,[n]:t},N()):ee.goalMode=t}function jt(){let t=e.activeSessionId;At(!(t?e.goalModeBySession[t]??!1:ee.goalMode))}async function Mt(t){let i=t.trim();if(!i||e.permission===`manual`&&!await r({title:n(`workspace.goalStartConfirm`,{objective:i}),variant:`primary`}))return;let a=e.activeSessionId;if(!a){let t=e.activeWorkspaceId,n=t&&D.value.some(e=>e.id===t)?t:D.value[0]?.id??null;if(!n)return;try{a=await Ue(n)??void 0}catch(e){c(`createGoal`,e);return}if(!a)return}try{await Q().updateSession(a,{goalObjective:i})}catch(e){c(`createGoal`,e,{sessionId:a,message:te(e)});return}e.goalModeBySession[a]&&(e.goalModeBySession={...e.goalModeBySession,[a]:!1},N()),e.activeSessionId===a?await rt(i):await nt(a,i)}function Nt(t){let n=e.activeSessionId;n&&Promise.resolve(Q().updateSession(n,{goalControl:t})).catch(e=>{c(`controlGoal`,e,{sessionId:n,message:te(e)})})}function Pt(t){e.permission=t;let n=e.activeSessionId;n&&(e.permissionBySession={...e.permissionBySession,[n]:t},T({permissionMode:t},n))}function Ft(t){let n=[...e.warnings];n.splice(t,1),e.warnings=n}async function It(e,t){try{await Q().updateSession(e,{title:t}),f(e,e=>({...e,title:t}))}catch(t){c(`renameSession`,t,{sessionId:e})}}async function Lt(e){try{let t=await Q().generateSessionTitle(e,{force:!0,source:`digest`});return t.title.length>0?t.title:null}catch(t){return console.warn(`[pythinker-web] generateSessionTitle failed for`,e,t),null}}async function Rt(t,n){let r=e.workspaces.find(e=>e.id===t)?.root,i=()=>{e.workspaces=e.workspaces.map(e=>e.id===t?{...e,name:n}:e)};try{if(await Q().updateWorkspace(t,{name:n}),r!==void 0){let e=oa();r in e&&(delete e[r],sa(e))}i()}catch(e){if(r!==void 0&&QC(e)&&e.code===xhe){sa({...oa(),[r]:n}),i();return}c(`renameWorkspace`,e)}}async function zt(t){let n=e.workspaces.find(e=>e.id===t)?.root??E.value.find(e=>e.id===t)?.root??t,r=e.activeSessionId?e.sessions.find(t=>t.id===e.activeSessionId):void 0,i=e.activeWorkspaceId===t||e.activeWorkspaceId===n,a=!!(r&&(r.cwd===n||r.workspaceId===t||k(r)===t));n&&!e.hiddenWorkspaceRoots.includes(n)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,n],I(e.hiddenWorkspaceRoots));try{await Q().deleteWorkspace(t)}catch(e){console.warn(`[pythinker-web] deleteWorkspace registry cleanup failed for`,t,e)}if(e.workspaces=e.workspaces.filter(e=>e.id!==t&&e.root!==n),i||a){let t=D.value[0]?.id??null;if(e.activeWorkspaceId=t,t)F(t);else try{Zi(qi.activeWorkspace)}catch{}}(i||a)&&(g(void 0),e.sessionLoading=!1,U(),Xe(void 0,`replace`))}async function Bt(t){try{await Q().archiveSession(t),h(t),o.clearSideChatForSession?.(t);let{[t]:n,...r}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=r,e.activeSessionId===t){let t=e.sessions[0];t?await tt(t.id,{urlMode:`replace`}):(g(void 0),Xe(void 0,`replace`))}}catch(e){c(`archiveSession`,e,{sessionId:t})}}function Vt(e){i.add(e)}async function Ht(t,n=e.activeSessionId===t){Vt(t),h(t),o.clearSideChatForSession?.(t);let{[t]:r,...i}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=i,n||e.activeSessionId===t){let t=e.sessions[0];t?await tt(t.id,{urlMode:`replace`}):(g(void 0),Xe(void 0,`replace`))}}async function Ut(e){try{await Q().deleteSession(e),await Ht(e)}catch(t){throw c(`deleteSession`,t,{sessionId:e}),t}}async function Wt(t){if(B)return!1;let r=t??e.activeSessionId;if(!r){let e=n(`commands.export.noSession`);return Bx(`export:failed`,{status:`no-session`}),c(`exportSession`,Error(e),{message:e}),!1}B=!0;let i=Date.now();Bx(`export:start`,{sessionId:r});try{let e=qx(),{blob:t,fileName:n}=await Q().exportSession(r,e);if(typeof document>`u`)throw Error(`Document is unavailable`);let a=URL.createObjectURL(t),o;try{o=document.createElement(`a`),o.href=a,o.download=n,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(a)}catch{}},0)}return Bx(`export:accepted`,{sessionId:r,status:`accepted`,zipBytes:t.size,durationMs:Date.now()-i}),!0}catch(e){let t=typeof e==`object`&&e?e:void 0;return Bx(`export:failed`,{sessionId:r,status:`failed`,durationMs:Date.now()-i,errorName:typeof t?.name==`string`?t.name:typeof e,errorCode:typeof t?.code==`number`?t.code:void 0,requestId:typeof t?.requestId==`string`?t.requestId:void 0,phase:typeof t?.phase==`string`?t.phase:void 0,httpStatus:typeof t?.status==`number`?t.status:void 0}),c(`exportSession`,e,{sessionId:r}),!1}finally{B=!1}}async function Gt(e){try{return p(await Q().restoreSession(e)),!0}catch(t){return c(`restoreSession`,t,{sessionId:e}),!1}}function Kt(e){return Q().listSessions({archivedOnly:!0,beforeId:e?.beforeId,pageSize:e?.pageSize??50})}function qt(t){let n=e.activeSessionId;n&&Q().compactSession(n,t).catch(e=>{c(`compact`,e,{sessionId:n})})}async function Jt(t){let n=t??e.activeSessionId;if(n)try{let e=await Q().forkSession(n);p(e),await tt(e.id)}catch(e){c(`fork`,e,{sessionId:n})}}async function Yt(t=1){let n=e.activeSessionId;if(!n)return null;let r=(()=>{let t=e.messagesBySession[n]??[];for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.role===`user`&&!(n.metadata?.origin&&n.metadata.origin.kind!==`user`))return n.content.filter(e=>e.type===`text`).map(e=>e.text).join(` -`)}return null})();try{return await Q().undoSession(n,t),await b(n),r}catch(e){return c(`undo`,e,{sessionId:n}),null}}function Xt(t){let n=e.activeSessionId;if(!n)return;let r=e.queuedBySession[n]??[];if(t<0||t>=r.length)return;let i=[...r];i.splice(t,1),e.queuedBySession={...e.queuedBySession,[n]:i}}function Zt(t,n){let r=e.activeSessionId;if(!r)return;let i=e.queuedBySession[r]??[];if(t===n||t<0||t>=i.length||n<0||n>=i.length)return;let a=[...i],[o]=a.splice(t,1);o!==void 0&&(a.splice(n,0,o),e.queuedBySession={...e.queuedBySession,[r]:a})}async function Qt(t){let n=e.activeSessionId;if(!n)return[];try{return(await Q().listDirectory(n,{path:t,includeGitStatus:!0})).items}catch{return[]}}async function $t(t){let n=e.activeSessionId;if(!n)return null;try{let e=await Q().readFile(n,{path:t});return{path:e.path,content:e.content,encoding:e.encoding,mime:e.mime,languageId:e.languageId,isBinary:e.isBinary,size:e.size,lineCount:e.lineCount}}catch(e){return console.warn(`[pythinker-web] readFileContent failed for`,t,e),null}}function en(t){let n=e.activeSessionId;return n?Q().getFileDownloadUrl(n,t):null}async function tn(t,n){let r=e.activeSessionId;if(!r)return!1;try{return await Q().openFile(r,{path:t,line:n}),!0}catch(e){return c(`openFile`,e,{sessionId:r}),!1}}async function nn(t){let n=e.activeSessionId;if(!n)return;let r=O.value.cwd||`.`;try{await Q().openInApp(n,t,r)}catch(e){c(`openInApp`,e,{sessionId:n})}}async function rn(t){let n=e.activeSessionId;if(!n)return!1;try{return await Q().revealFile(n,{path:t}),!0}catch(e){return c(`revealFile`,e,{sessionId:n}),!1}}async function an(t,n){let r=e.activeSessionId;if(!r)return!1;try{return await Q().revealSavedPlan(r,{agentId:t,toolCallId:n}),!0}catch(e){return c(`revealSavedPlan`,e,{sessionId:r}),!1}}async function on(t){if(/^(https?:|data:|blob:)/i.test(t))return t;let n=e.activeSessionId;if(!n)return t;let r=t;if(r.startsWith(`/`)){let i=e.sessions.find(e=>e.id===n)?.cwd;if(i&&(r===i||r.startsWith(i.endsWith(`/`)?i:`${i}/`))){if(r=r.slice(i.length).replace(/^\//,``),!r)return t}else return t}try{let e=await Q().readFile(n,{path:r,length:10485760});return!e.isBinary||e.encoding!==`base64`||e.truncated?t:`data:${e.mime};base64,${e.content}`}catch{return t}}async function sn(t){let n=e.sessions.find(t=>t.id===e.activeSessionId),r=n===void 0?e.activeWorkspaceId:k(n);if(!r)return[];try{return(await Q().searchFiles(r,{query:t,limit:20})).items.map(e=>({path:e.path,name:e.name}))}catch{return[]}}return{loadFileDiff:H,clearFileDiff:U,loadGitStatus:W,checkAuth:G,loadConfig:_e,updateConfig:be,loadSubagentModelPolicy:pe,saveSubagentModelPolicy:he,clearSubagentModelPolicy:ge,listAllSessionsGlobal:Se,load:Pe,refreshServerMeta:Ne,loadWorkspaces:Fe,loadMoreSessions:Me,loadAllSessions:q,selectWorkspace:Le,openWorkspace:Re,upsertWorkspacePreserveOrder:ze,applyWorkspaceEvent:Be,clearActiveSession:Ve,openWorkspaceDraft:He,createDraftSession:Ue,startSessionAndSendPrompt:We,startSessionAndActivateSkill:Ge,startSessionAndOpenSideChat:Ke,addWorkspaceByPath:qe,browseFs:Je,getFsHome:Ye,writeSessionUrl:Xe,fetchSessionIntoList:Ze,onSessionRoutePopState:Qe,bindSessionRoute:et,selectSession:tt,submitPromptInternal:nt,finishPromptLocal:mt,localTurnStartState:khe,isLocalTurnSnapshotCurrent:jhe,afterLocalTurnStartsSettle:Mhe,handleSessionSnapshot:ht,sendPrompt:rt,steerPrompt:ot,steerQueued:ct,uploadImage:dt,enqueue:ft,unqueue:Xt,reorderQueue:Zt,abortCurrentPrompt:gt,respondApproval:yt,respondQuestion:bt,dismissQuestion:xt,pendingQuestionActions:n8,pendingApprovalActions:r8,cancelTask:Ct,detachTask:St,setPlanMode:wt,togglePlanMode:Tt,setTowerMode:Et,toggleTowerMode:Dt,setDynamicWorkflowMode:Ot,toggleDynamicWorkflowMode:kt,setGoalMode:At,toggleGoalMode:jt,createGoal:Mt,controlGoal:Nt,setPermission:Pt,dismissWarning:Ft,renameSession:It,generateSessionTitle:Lt,renameWorkspace:Rt,deleteWorkspace:zt,archiveSession:Bt,deleteSession:Ut,cleanupDeletedSession:Ht,rememberDeletedSession:Vt,exportSession:Wt,restoreSession:Gt,loadArchivedSessions:Kt,compact:qt,forkSession:Jt,undo:Yt,listDir:Qt,readFileContent:$t,getFileDownloadUrl:en,openWorkspaceFile:tn,openInApp:nn,revealWorkspaceFile:rn,revealSavedPlan:an,resolveImageUrl:on,searchFiles:sn,loadOlderMessages:V,refreshSessionSidecars:fe,isStartingFirstPrompt:()=>o8.size>0}}var m8=qi.starredModels,h8=Error(`profile persist failed`);function Phe(){try{let e=Yi(m8);if(!e)return[];let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t}catch{}return[]}function Fhe(e){try{Xi(m8,JSON.stringify(e))}catch{}}function Ihe(){let e=Qi(qi.thinking);return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`&&e[1].length>0))}function Lhe(e,t){let{pushOperationFailure:n,refreshSessionStatus:r,persistSessionProfile:i,activity:a,updateSession:o,updateSessionMessages:c}=t,l=R([]),u=R(Phe()),d=R(Ihe()),f=R({}),p=R({}),m=R([]),h=R([]),g=R(null);function _(e){if(!(e==null||e.length===0))return l.value.find(t=>t.id===e)??l.value.find(t=>t.model===e)}function v(){let t=e.activeSessionId?e.sessions.find(t=>t.id===e.activeSessionId):void 0,n=t===void 0?g.value??e.defaultModel:t.model||e.defaultModel;return _(n)?.id??n??void 0}function y(e){if(e===void 0)return;let t=_(e);return t===void 0?void 0:b(t)}function b(e){let t=d.value[e.id];return t!==void 0&&t6(e,t)?t:Q3(e)}function x(t,n){let r=t==null?void 0:e.thinkingBySession[t];return r!==void 0&&t6(n,r)?r:b(n)}function S(e,t){if(t===void 0)return;let n=_(t);return n===void 0?void 0:x(e,n)}async function C(t,n){return t!=null&&e.thinkingBySession[t]===void 0&&await r(t),S(t,n)}function w(t){e.thinking=t;let n=e.activeSessionId;return t!==void 0&&n!=null&&(e.thinkingBySession={...e.thinkingBySession,[n]:t}),t}s([()=>e.activeSessionId,()=>v(),()=>{let t=e.activeSessionId;return t==null?void 0:e.thinkingBySession[t]}],()=>{let t=_(v());t!==void 0&&(e.thinking=x(e.activeSessionId,t))});function T(e){Q().setConfig({thinking:Rpe(e,_(v())?.supportEfforts)}).catch(e=>n(`setConfig`,e))}async function E(e){try{let t=await Q().listSkills(e);f.value={...f.value,[e]:t}}catch{}}async function D(e){try{let t=await Q().listSkillsForWorkspace(e);p.value={...p.value,[e]:t}}catch{}}async function O(){try{l.value=await Q().listModels();let t=_(v());t!==void 0&&(e.thinking=x(e.activeSessionId,t))}catch(e){n(`loadModels`,e)}}async function k(){try{m.value=await Q().listProviders()}catch(e){n(`loadProviders`,e)}}async function A(){try{h.value=await Q().listCatalogProviders()}catch(e){n(`loadCatalogProviders`,e)}}async function j(t){let i=e.activeSessionId,a=_(t),s=e.thinking,c=i?e.sessions.find(e=>e.id===i)?.model:void 0,l=e.thinkingBySession,u=v()!==(a?.id??t),f=a===void 0?void 0:d.value[a.id],p=f!==void 0&&a!==void 0&&t6(a,f)?f:void 0,m=u&&a!==void 0?p??b(a):zpe(a,s,u);if(!i)return g.value=t,e.thinking=m,!0;if(o(i,e=>({...e,model:t})),m!==s){e.thinking=m;let t={...e.thinkingBySession};p===void 0?delete t[i]:t[i]=p,e.thinkingBySession=t}try{await Q().updateSession(i,{model:t,thinking:m===s?void 0:p})}catch(t){return o(i,e=>({...e,model:c??e.model})),m!==s&&(e.thinking=s,e.thinkingBySession=l),n(`setModel`,t,{sessionId:i}),!1}return await r(i),!0}function M(e){let t=new Set(u.value);t.has(e)?t.delete(e):t.add(e),u.value=Array.from(t),Fhe(u.value)}async function N(t,r,o){let s=o??e.activeSessionId;if(!s)return;let l=a.value===`idle`&&!e.inFlightBySession[s],u=`msg_skill_opt_${Date.now().toString(36)}`,d=l?f8(s):void 0;if(l){e.inFlightBySession={...e.inFlightBySession,[s]:!0};let n={id:u,sessionId:s,role:`user`,content:[{type:`text`,text:`/${t}${r?` ${r}`:``}`}],createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0,origin:{kind:`skill_activation`,trigger:`user-slash`,skillName:t,skillArgs:r}}};c(s,e=>[...e,n])}try{let n=e.sessions.find(e=>e.id===s)?.model;if(!await i({thinking:await C(s,(n&&n.length>0?n:e.defaultModel)??void 0)??e.thinking},s))throw h8;await Q().activateSkill(s,t,r)}catch(t){l&&(e.inFlightBySession={...e.inFlightBySession,[s]:!1},c(s,e=>e.filter(e=>e.id!==u))),t!==h8&&n(`activateSkill`,t,{sessionId:s})}finally{d!==void 0&&p8(s,d)}}async function ee(e){try{await Q().importCatalogProvider(e),await Promise.all([k(),O()])}catch(e){n(`importCatalogProvider`,e)}}async function P(e){try{await Q().deleteProvider(e),await Promise.all([k(),O()])}catch(e){n(`deleteProvider`,e)}}async function F(e){try{let t=await Q().refreshProvider(e);for(let e of t.failed)n(`refreshProvider`,Error(e.reason),{message:e.provider});await Promise.all([k(),O()])}catch(e){n(`refreshProvider`,e)}}async function I(){try{let e=await Q().refreshAllProviders();for(let t of e.failed)n(`refreshAllProviders`,Error(t.reason),{message:t.provider});await Promise.all([k(),O()])}catch(e){n(`refreshAllProviders`,e)}}function te(e){let t=w(e),n=v();t!==void 0&&n!==void 0&&(d.value={...d.value,[n]:t},$i(qi.thinking,d.value)),i({thinking:t}),t!==void 0&&T(t)}return{models:l,starredModelIds:u,providers:m,catalogProviders:h,draftModel:g,skillsBySession:f,skillsByWorkspace:p,loadSkillsForSession:E,loadSkillsForWorkspace:D,loadModels:O,loadProviders:k,loadCatalogProviders:A,setModel:j,thinkingLevelForModelId:y,thinkingLevelForSessionId:S,resolveThinkingForPrompt:C,toggleStarModel:M,activateSkill:N,importCatalogProvider:ee,addProvider:e=>ee({catalogId:e.type,apiKey:e.apiKey,baseUrl:e.baseUrl}),deleteProvider:P,refreshProvider:F,refreshAllProviders:I,setThinking:te}}var Rhe=/^read[_-]?media(?:file)?$/i,zhe=/^data:([^;]+);base64,(.*)$/s,Bhe=/^<(image|video|audio)\s+path="([^"]+)">$/,Vhe=/^<(image|video|audio)\s+path="([^"]+)">(?:<\/\1>)?$/,Hhe=/Mime type:\s*([^.\s]+)/i,Uhe=/Size:\s*(\d+)\s*bytes/i,Whe=/Original dimensions:\s*(\d+)x(\d+)\s*pixels/i,Ghe=`Image compressed to fit model limits:`,Khe=/Image compressed to fit model limits:[\s\S]*?<\/system>/g;function qhe(e){return e.includes(Ghe)?e.replace(Khe,``):e}function Jhe(e){return e.replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`&`,`&`)}function Yhe(e){let t=Vhe.exec(e.trim());return t?{kind:t[1],path:Jhe(t[2])}:null}var g8=/^f_(?:[0-9A-Za-z]{26}|[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})$/,Xhe=/^f_(?:[0-9A-Za-z]{26}|[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})(?=-)/;function Zhe(e){let t=e.split(/[\\/]/).at(-1)??``,n=t.lastIndexOf(`.`),r=n>0?t.slice(0,n):t;return g8.test(r)?r:void 0}var Qhe=/^Attached file "(.+)" \(([^,]+), (\d+) bytes\): (.+) — open it with the Read tool$/;function $he(e){let t=Qhe.exec(e.trim());if(!t)return null;let n=(t[4]??``).split(/[\\/]/).at(-1)??``,r=Xhe.exec(n)?.[0];return{name:t[1],mediaType:t[2],size:Number(t[3]),fileId:r!==void 0&&g8.test(r)?r:void 0}}function ege(e){if(e.length===0)return 0;let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return Math.floor(e.length*3/4)-t}function tge(e){if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function nge(e){let t=e.type,n=t===`image_url`?`image`:t===`video_url`?`video`:t===`audio_url`?`audio`:null;if(n===null)return null;let r=e[n===`image`?`imageUrl`:n===`video`?`videoUrl`:`audioUrl`];if(typeof r!=`object`||!r)return null;let i=r.url;return typeof i==`string`?{kind:n,url:i}:null}function rge(e,t){if(!Rhe.test(e))return;let n=tge(t);if(n===null)return;let r,i,a,o,s,c=null;for(let e of n){if(typeof e!=`object`||!e)continue;let t=e;if(t.type===`text`&&typeof t.text==`string`){let e=t.text,n=Bhe.exec(e);n&&(i=n[1],r=n[2]);let c=Hhe.exec(e);c?.[1]&&(a=c[1]);let l=Uhe.exec(e);l?.[1]&&(o=Number(l[1]));let u=Whe.exec(e);u?.[1]&&u[2]&&(s=`${u[1]}x${u[2]}`);continue}let n=nge(t);n&&(c=n)}if(c===null)return;let l=zhe.exec(c.url);return l?.[1]&&(a=l[1]),l?.[2]&&(o=ege(l[2])),{kind:c.kind??i??`image`,url:c.url,path:r,mimeType:a,bytes:Number.isFinite(o)?o:void 0,dimensions:s}}function ige(e){if(e!=null){if(typeof e==`string`)return e.split(` +`),o)!==`rejected`||i.length===0))return;let c=e.queuedBySession[t]??[];e.queuedBySession={...e.queuedBySession,[t]:[...i,...c]}}function ct(t){let n=e.activeSessionId;if(!n)return Promise.resolve();let r=(e.queuedBySession[n]??[])[t];if(r===void 0)return Promise.resolve();let i=r.id??r.text;return at(n,()=>lt(n,i))}async function lt(t,n){let r=e.queuedBySession[t]??[],i=r.findIndex(e=>(e.id??e.text)===n),a=i>=0?r[i]:void 0;if(a===void 0)return;let o=a.attachments??[];if(a.text.trim().length===0&&o.length===0)return;let s=[...r];if(s.splice(i,1),e.queuedBySession={...e.queuedBySession,[t]:s},await ut(t,a.text,o)!==`rejected`||!e.sessions.some(e=>e.id===t))return;let c=[...e.queuedBySession[t]??[]];c.splice(Math.min(i,c.length),0,a),e.queuedBySession={...e.queuedBySession,[t]:c}}async function ut(t,n,r){if(l.value===`idle`&&!e.inFlightBySession[t])return nt(t,n,r);let i=[];n&&i.push({type:`text`,text:n});for(let e of r)e.kind===`video`?i.push({type:`video`,source:{kind:`file`,fileId:e.fileId}}):e.kind===`file`?i.push({type:`file`,fileId:e.fileId,name:e.name??``,mediaType:e.mediaType||`application/octet-stream`,size:e.size??0}):i.push({type:`image`,source:{kind:`file`,fileId:e.fileId}});let a=v(),o={id:a,sessionId:t,role:`user`,content:i,createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0}};_(t,e=>[...e,o]);let u=d8(t);try{let n=Q(),r=e.sessions.find(e=>e.id===t),o=(r?.model&&r.model.length>0?r.model:e.defaultModel)??void 0,c=await n.submitPrompt(t,{content:i,model:o,thinking:await s.resolveThinkingForPrompt(t,o)??e.thinking,permissionMode:de(t),planMode:e.planModeBySession[t]??!1,dynamicWorkflowMode:e.dynamicWorkflowModeBySession[t]??!1});if(_(t,e=>{let t=e.findIndex(e=>e.id===a);if(t===-1)return e;let n=[...e];return n[t]={...n[t],promptId:n[t].promptId??c.promptId},n}),c.status!==`queued`)return e.promptIdBySession={...e.promptIdBySession,[t]:c.promptId},y()?.bindNextPromptId(t,c.promptId),`ok`;try{await n.steerPrompts(t,[c.promptId])}catch{return`ok`}return`ok`}catch(e){return _(t,e=>e.filter(e=>e.id!==a)),c(`steer`,e,{sessionId:t}),gT(e)?`rejected`:`uncertain`}finally{f8(t,u)}}async function dt(e,t){try{let n=await Q().uploadFile({file:e,name:t});return{fileId:n.id,name:n.name,mediaType:n.mediaType}}catch(e){return c(`uploadImage`,e),null}}function ft(t,n){let r=e.activeSessionId;if(!r)return;let i=e.queuedBySession[r]??[],a={text:t,attachments:n,id:Ihe()};e.queuedBySession={...e.queuedBySession,[r]:[...i,a]}}function pt(t){let[n,...r]=e.queuedBySession[t]??[];n!==void 0&&(e.queuedBySession={...e.queuedBySession,[t]:r},nt(t,n.text,n.attachments).then(r=>{if(r===`ok`){l8.delete(t);return}if(r===`uncertain`){l8.delete(t);return}if(!e.sessions.some(e=>e.id===t)){l8.delete(t);return}let i=n.id??n.text,a=l8.get(t),o=a!==void 0&&a.key===i?a.count+1:1;if(o>=Fhe){l8.delete(t),(e.queuedBySession[t]?.length??0)>0&&pt(t);return}l8.set(t,{key:i,count:o});let s=e.queuedBySession[t]??[];e.queuedBySession={...e.queuedBySession,[t]:[n,...s]}}))}function mt(t,n){let r=e.inFlightBySession[t]===!0;if(e.inFlightBySession={...e.inFlightBySession,[t]:!1},e.promptIdBySession[t]!==void 0){let n={...e.promptIdBySession};delete n[t],e.promptIdBySession=n}return t===e.activeSessionId&&ne(),(r||n?.turnWasActive===!0||(e.turnActiveBySession[t]??!1))&&pt(t),r}function ht(e,t){t.inFlightTurn!==null&&t.busy||mt(e)}async function gt(){let t=e.activeSessionId;if(!t)return;let n=e.sessions.find(e=>e.id===t),r=e.promptIdBySession[t];if(r===void 0){let e=n?.currentPromptId;e!==void 0&&e.length>0&&!e.startsWith(`pr_`)&&(r=e)}let i=Q();if(r!==void 0)try{if((await i.abortPrompt(t,r)).aborted)return;let n={...e.promptIdBySession};delete n[t],e.promptIdBySession=n}catch(n){if(gT(n)&&n.code===Ohe){let n={...e.promptIdBySession};delete n[t],e.promptIdBySession=n}else{c(`abortCurrentPrompt`,n,{sessionId:t});return}}try{await i.abortSession(t)}catch(e){c(`abortCurrentPrompt`,e,{sessionId:t})}}function _t(t,n){let r=e.approvalsBySession[t]??[];e.approvalsBySession={...e.approvalsBySession,[t]:r.filter(e=>e.approvalId!==n)}}function vt(t,n){let r=e.questionsBySession[t]??[];e.questionsBySession={...e.questionsBySession,[t]:r.filter(e=>e.questionId!==n)}}async function yt(t,n){let r=e.activeSessionId;if(r&&!n8[t]){n8[t]=!0;try{let e=Q(),i={decision:n.decision,scope:n.scope,feedback:n.feedback,selectedLabel:n.selectedLabel};await e.respondApproval(r,t,i),_t(r,t)}catch(e){$6(e)?_t(r,t):c(`respondApproval`,e,{sessionId:r})}finally{delete n8[t]}}}async function bt(t,n){let r=e.activeSessionId;if(r&&!t8[t]){t8[t]=`answer`;try{await Q().respondQuestion(r,t,n),vt(r,t)}catch(e){$6(e)?vt(r,t):c(`respondQuestion`,e,{sessionId:r})}finally{delete t8[t]}}}async function xt(t){let n=e.activeSessionId;if(n&&!t8[t]){t8[t]=`dismiss`;try{await Q().dismissQuestion(n,t),vt(n,t)}catch(e){$6(e)?vt(n,t):c(`dismissQuestion`,e,{sessionId:n})}finally{delete t8[t]}}}async function St(t){let n=e.activeSessionId;if(n&&!i8[t]){i8[t]=!0;try{let r=Q(),i=e=>e.id===t||e.parentToolCallId===t,a=(e.tasksBySession[n]??[]).find(i),o;if(a===void 0){let e;try{e=await r.listTasks(n)}catch(e){c(`detachTask`,e,{sessionId:n});return}let t=e.find(i);if(t===void 0)return;a=t,o=t.id}let s=a;o??=s.backgroundTaskId??s.id;let l=await r.detachTask(n,o),u=e.tasksBySession[n]??[];e.tasksBySession={...e.tasksBySession,[n]:u.map(e=>e.id===s.id?l.status===`running`?{...e,runInBackground:!0}:{...e,status:l.status,completedAt:e.completedAt??new Date().toISOString(),completedAtEstimated:e.completedAt===void 0?!0:e.completedAtEstimated}:e)}}catch(e){e8(e)||c(`detachTask`,e,{sessionId:n})}finally{delete i8[t]}}}async function Ct(t){let n=e.activeSessionId;if(n&&!r8[t]){r8[t]=!0;try{let r=Q(),i=(e.tasksBySession[n]??[]).find(e=>e.id===t)?.backgroundTaskId;await r.cancelTask(n,i??t);let a=e.tasksBySession[n]??[];e.tasksBySession={...e.tasksBySession,[n]:a.map(e=>e.id===t?{...e,status:`cancelled`}:e)}}catch(e){e8(e)||c(`cancelTask`,e,{sessionId:n})}finally{delete r8[t]}}}function wt(t){let n=e.activeSessionId;n?(e.planModeBySession={...e.planModeBySession,[n]:t},j(),T({planMode:t})):ee.planMode=t}function Tt(){let t=e.activeSessionId;wt(!(t?e.planModeBySession[t]??!1:ee.planMode))}function Et(t,n){let r=e.activeSessionId;r?(e.towerModeBySession={...e.towerModeBySession,[r]:t},T({towerMode:t,...t&&n!==void 0&&n.trim()!==``?{towerBase:n.trim()}:{}})):ee.towerMode=t}function Dt(){let t=e.activeSessionId;Et(!(t?e.towerModeBySession[t]??!1:ee.towerMode))}function Ot(t){let n=e.activeSessionId;n?(e.dynamicWorkflowModeBySession={...e.dynamicWorkflowModeBySession,[n]:t},M(),T({dynamicWorkflowMode:t})):ee.dynamicWorkflowMode=t}async function kt(){let t=e.activeSessionId,i=!(t?e.dynamicWorkflowModeBySession[t]??!1:ee.dynamicWorkflowMode);i&&e.permission===`manual`&&!await r({title:n(`workspace.dynamicWorkflowEnableTitle`),message:n(`workspace.dynamicWorkflowEnableConfirm`),variant:`primary`})||Ot(i)}function At(t){let n=e.activeSessionId;n?(e.goalModeBySession={...e.goalModeBySession,[n]:t},N()):ee.goalMode=t}function jt(){let t=e.activeSessionId;At(!(t?e.goalModeBySession[t]??!1:ee.goalMode))}async function Mt(t){let i=t.trim();if(!i||e.permission===`manual`&&!await r({title:n(`workspace.goalStartConfirm`,{objective:i}),variant:`primary`}))return;let a=e.activeSessionId;if(!a){let t=e.activeWorkspaceId,n=t&&D.value.some(e=>e.id===t)?t:D.value[0]?.id??null;if(!n)return;try{a=await Ue(n)??void 0}catch(e){c(`createGoal`,e);return}if(!a)return}try{await Q().updateSession(a,{goalObjective:i})}catch(e){c(`createGoal`,e,{sessionId:a,message:te(e)});return}e.goalModeBySession[a]&&(e.goalModeBySession={...e.goalModeBySession,[a]:!1},N()),e.activeSessionId===a?await rt(i):await nt(a,i)}function Nt(t){let n=e.activeSessionId;n&&Promise.resolve(Q().updateSession(n,{goalControl:t})).catch(e=>{c(`controlGoal`,e,{sessionId:n,message:te(e)})})}function Pt(t){e.permission=t;let n=e.activeSessionId;n&&(e.permissionBySession={...e.permissionBySession,[n]:t},T({permissionMode:t},n))}function Ft(t){let n=[...e.warnings];n.splice(t,1),e.warnings=n}async function It(e,t){try{await Q().updateSession(e,{title:t}),f(e,e=>({...e,title:t}))}catch(t){c(`renameSession`,t,{sessionId:e})}}async function Lt(e){try{let t=await Q().generateSessionTitle(e,{force:!0,source:`digest`});return t.title.length>0?t.title:null}catch(t){return console.warn(`[pythinker-web] generateSessionTitle failed for`,e,t),null}}async function Rt(t,n){let r=e.workspaces.find(e=>e.id===t)?.root,i=()=>{e.workspaces=e.workspaces.map(e=>e.id===t?{...e,name:n}:e)};try{if(await Q().updateWorkspace(t,{name:n}),r!==void 0){let e=oa();r in e&&(delete e[r],sa(e))}i()}catch(e){if(r!==void 0&&gT(e)&&e.code===khe){sa({...oa(),[r]:n}),i();return}c(`renameWorkspace`,e)}}async function zt(t){let n=e.workspaces.find(e=>e.id===t)?.root??E.value.find(e=>e.id===t)?.root??t,r=e.activeSessionId?e.sessions.find(t=>t.id===e.activeSessionId):void 0,i=e.activeWorkspaceId===t||e.activeWorkspaceId===n,a=!!(r&&(r.cwd===n||r.workspaceId===t||k(r)===t));n&&!e.hiddenWorkspaceRoots.includes(n)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,n],I(e.hiddenWorkspaceRoots));try{await Q().deleteWorkspace(t)}catch(e){console.warn(`[pythinker-web] deleteWorkspace registry cleanup failed for`,t,e)}if(e.workspaces=e.workspaces.filter(e=>e.id!==t&&e.root!==n),i||a){let t=D.value[0]?.id??null;if(e.activeWorkspaceId=t,t)F(t);else try{Zi(qi.activeWorkspace)}catch{}}(i||a)&&(g(void 0),e.sessionLoading=!1,U(),Xe(void 0,`replace`))}async function Bt(t){try{await Q().archiveSession(t),h(t),o.clearSideChatForSession?.(t);let{[t]:n,...r}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=r,e.activeSessionId===t){let t=e.sessions[0];t?await tt(t.id,{urlMode:`replace`}):(g(void 0),Xe(void 0,`replace`))}}catch(e){c(`archiveSession`,e,{sessionId:t})}}function Vt(e){i.add(e)}async function Ht(t,n=e.activeSessionId===t){Vt(t),h(t),o.clearSideChatForSession?.(t);let{[t]:r,...i}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=i,n||e.activeSessionId===t){let t=e.sessions[0];t?await tt(t.id,{urlMode:`replace`}):(g(void 0),Xe(void 0,`replace`))}}async function Ut(e){try{await Q().deleteSession(e),await Ht(e)}catch(t){throw c(`deleteSession`,t,{sessionId:e}),t}}async function Wt(t){if(B)return!1;let r=t??e.activeSessionId;if(!r){let e=n(`commands.export.noSession`);return iC(`export:failed`,{status:`no-session`}),c(`exportSession`,Error(e),{message:e}),!1}B=!0;let i=Date.now();iC(`export:start`,{sessionId:r});try{let e=dC(),{blob:t,fileName:n}=await Q().exportSession(r,e);if(typeof document>`u`)throw Error(`Document is unavailable`);let a=URL.createObjectURL(t),o;try{o=document.createElement(`a`),o.href=a,o.download=n,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(a)}catch{}},0)}return iC(`export:accepted`,{sessionId:r,status:`accepted`,zipBytes:t.size,durationMs:Date.now()-i}),!0}catch(e){let t=typeof e==`object`&&e?e:void 0;return iC(`export:failed`,{sessionId:r,status:`failed`,durationMs:Date.now()-i,errorName:typeof t?.name==`string`?t.name:typeof e,errorCode:typeof t?.code==`number`?t.code:void 0,requestId:typeof t?.requestId==`string`?t.requestId:void 0,phase:typeof t?.phase==`string`?t.phase:void 0,httpStatus:typeof t?.status==`number`?t.status:void 0}),c(`exportSession`,e,{sessionId:r}),!1}finally{B=!1}}async function Gt(e){try{return p(await Q().restoreSession(e)),!0}catch(t){return c(`restoreSession`,t,{sessionId:e}),!1}}function Kt(e){return Q().listSessions({archivedOnly:!0,beforeId:e?.beforeId,pageSize:e?.pageSize??50})}function qt(t){let n=e.activeSessionId;n&&Q().compactSession(n,t).catch(e=>{c(`compact`,e,{sessionId:n})})}async function Jt(t){let n=t??e.activeSessionId;if(n)try{let e=await Q().forkSession(n);p(e),await tt(e.id)}catch(e){c(`fork`,e,{sessionId:n})}}async function Yt(t=1){let n=e.activeSessionId;if(!n)return null;let r=(()=>{let t=e.messagesBySession[n]??[];for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.role===`user`&&!(n.metadata?.origin&&n.metadata.origin.kind!==`user`))return n.content.filter(e=>e.type===`text`).map(e=>e.text).join(` +`)}return null})();try{return await Q().undoSession(n,t),await b(n),r}catch(e){return c(`undo`,e,{sessionId:n}),null}}function Xt(t){let n=e.activeSessionId;if(!n)return;let r=e.queuedBySession[n]??[];if(t<0||t>=r.length)return;let i=[...r];i.splice(t,1),e.queuedBySession={...e.queuedBySession,[n]:i}}function Zt(t,n){let r=e.activeSessionId;if(!r)return;let i=e.queuedBySession[r]??[];if(t===n||t<0||t>=i.length||n<0||n>=i.length)return;let a=[...i],[o]=a.splice(t,1);o!==void 0&&(a.splice(n,0,o),e.queuedBySession={...e.queuedBySession,[r]:a})}async function Qt(t){let n=e.activeSessionId;if(!n)return[];try{return(await Q().listDirectory(n,{path:t,includeGitStatus:!0})).items}catch{return[]}}async function $t(t){let n=e.activeSessionId;if(!n)return null;try{let e=await Q().readFile(n,{path:t});return{path:e.path,content:e.content,encoding:e.encoding,mime:e.mime,languageId:e.languageId,isBinary:e.isBinary,size:e.size,lineCount:e.lineCount}}catch(e){return console.warn(`[pythinker-web] readFileContent failed for`,t,e),null}}function en(t){let n=e.activeSessionId;return n?Q().getFileDownloadUrl(n,t):null}async function tn(t,n){let r=e.activeSessionId;if(!r)return!1;try{return await Q().openFile(r,{path:t,line:n}),!0}catch(e){return c(`openFile`,e,{sessionId:r}),!1}}async function nn(t){let n=e.activeSessionId;if(!n)return;let r=O.value.cwd||`.`;try{await Q().openInApp(n,t,r)}catch(e){c(`openInApp`,e,{sessionId:n})}}async function rn(t){let n=e.activeSessionId;if(!n)return!1;try{return await Q().revealFile(n,{path:t}),!0}catch(e){return c(`revealFile`,e,{sessionId:n}),!1}}async function an(t,n){let r=e.activeSessionId;if(!r)return!1;try{return await Q().revealSavedPlan(r,{agentId:t,toolCallId:n}),!0}catch(e){return c(`revealSavedPlan`,e,{sessionId:r}),!1}}async function on(t){if(/^(https?:|data:|blob:)/i.test(t))return t;let n=e.activeSessionId;if(!n)return t;let r=t;if(r.startsWith(`/`)){let i=e.sessions.find(e=>e.id===n)?.cwd;if(i&&(r===i||r.startsWith(i.endsWith(`/`)?i:`${i}/`))){if(r=r.slice(i.length).replace(/^\//,``),!r)return t}else return t}try{let e=await Q().readFile(n,{path:r,length:10485760});return!e.isBinary||e.encoding!==`base64`||e.truncated?t:`data:${e.mime};base64,${e.content}`}catch{return t}}async function sn(t){let n=e.sessions.find(t=>t.id===e.activeSessionId),r=n===void 0?e.activeWorkspaceId:k(n);if(!r)return[];try{return(await Q().searchFiles(r,{query:t,limit:20})).items.map(e=>({path:e.path,name:e.name}))}catch{return[]}}return{loadFileDiff:H,clearFileDiff:U,loadGitStatus:W,checkAuth:G,loadConfig:_e,updateConfig:be,loadSubagentModelPolicy:pe,saveSubagentModelPolicy:he,clearSubagentModelPolicy:ge,listAllSessionsGlobal:Se,load:Pe,refreshServerMeta:Ne,loadWorkspaces:Fe,loadMoreSessions:Me,loadAllSessions:q,selectWorkspace:Le,openWorkspace:Re,upsertWorkspacePreserveOrder:ze,applyWorkspaceEvent:Be,clearActiveSession:Ve,openWorkspaceDraft:He,createDraftSession:Ue,startSessionAndSendPrompt:We,startSessionAndActivateSkill:Ge,startSessionAndOpenSideChat:Ke,addWorkspaceByPath:qe,browseFs:Je,getFsHome:Ye,writeSessionUrl:Xe,fetchSessionIntoList:Ze,onSessionRoutePopState:Qe,bindSessionRoute:et,selectSession:tt,submitPromptInternal:nt,finishPromptLocal:mt,localTurnStartState:Lhe,isLocalTurnSnapshotCurrent:zhe,afterLocalTurnStartsSettle:Bhe,handleSessionSnapshot:ht,sendPrompt:rt,steerPrompt:ot,steerQueued:ct,uploadImage:dt,enqueue:ft,unqueue:Xt,reorderQueue:Zt,abortCurrentPrompt:gt,respondApproval:yt,respondQuestion:bt,dismissQuestion:xt,pendingQuestionActions:t8,pendingApprovalActions:n8,cancelTask:Ct,detachTask:St,setPlanMode:wt,togglePlanMode:Tt,setTowerMode:Et,toggleTowerMode:Dt,setDynamicWorkflowMode:Ot,toggleDynamicWorkflowMode:kt,setGoalMode:At,toggleGoalMode:jt,createGoal:Mt,controlGoal:Nt,setPermission:Pt,dismissWarning:Ft,renameSession:It,generateSessionTitle:Lt,renameWorkspace:Rt,deleteWorkspace:zt,archiveSession:Bt,deleteSession:Ut,cleanupDeletedSession:Ht,rememberDeletedSession:Vt,exportSession:Wt,restoreSession:Gt,loadArchivedSessions:Kt,compact:qt,forkSession:Jt,undo:Yt,listDir:Qt,readFileContent:$t,getFileDownloadUrl:en,openWorkspaceFile:tn,openInApp:nn,revealWorkspaceFile:rn,revealSavedPlan:an,resolveImageUrl:on,searchFiles:sn,loadOlderMessages:V,refreshSessionSidecars:fe,isStartingFirstPrompt:()=>a8.size>0}}var p8=qi.starredModels,m8=Error(`profile persist failed`);function Hhe(){try{let e=Yi(p8);if(!e)return[];let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t}catch{}return[]}function Uhe(e){try{Xi(p8,JSON.stringify(e))}catch{}}function Whe(){let e=Qi(qi.thinking);return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`&&e[1].length>0))}function Ghe(e,t){let{pushOperationFailure:n,refreshSessionStatus:r,persistSessionProfile:i,activity:a,updateSession:o,updateSessionMessages:c}=t,l=R([]),u=R(Hhe()),d=R(Whe()),f=R({}),p=R({}),m=R([]),h=R([]),g=R(null);function _(e){if(!(e==null||e.length===0))return l.value.find(t=>t.id===e)??l.value.find(t=>t.model===e)}function v(){let t=e.activeSessionId?e.sessions.find(t=>t.id===e.activeSessionId):void 0,n=t===void 0?g.value??e.defaultModel:t.model||e.defaultModel;return _(n)?.id??n??void 0}function y(e){if(e===void 0)return;let t=_(e);return t===void 0?void 0:b(t)}function b(e){let t=d.value[e.id];return t!==void 0&&e6(e,t)?t:Z3(e)}function x(t,n){let r=t==null?void 0:e.thinkingBySession[t];return r!==void 0&&e6(n,r)?r:b(n)}function S(e,t){if(t===void 0)return;let n=_(t);return n===void 0?void 0:x(e,n)}async function C(t,n){return t!=null&&e.thinkingBySession[t]===void 0&&await r(t),S(t,n)}function w(t){e.thinking=t;let n=e.activeSessionId;return t!==void 0&&n!=null&&(e.thinkingBySession={...e.thinkingBySession,[n]:t}),t}s([()=>e.activeSessionId,()=>v(),()=>{let t=e.activeSessionId;return t==null?void 0:e.thinkingBySession[t]}],()=>{let t=_(v());t!==void 0&&(e.thinking=x(e.activeSessionId,t))});function T(e){Q().setConfig({thinking:Kpe(e,_(v())?.supportEfforts)}).catch(e=>n(`setConfig`,e))}async function E(e){try{let t=await Q().listSkills(e);f.value={...f.value,[e]:t}}catch{}}async function D(e){try{let t=await Q().listSkillsForWorkspace(e);p.value={...p.value,[e]:t}}catch{}}async function O(){try{l.value=await Q().listModels();let t=_(v());t!==void 0&&(e.thinking=x(e.activeSessionId,t))}catch(e){n(`loadModels`,e)}}async function k(){try{m.value=await Q().listProviders()}catch(e){n(`loadProviders`,e)}}async function A(){try{h.value=await Q().listCatalogProviders()}catch(e){n(`loadCatalogProviders`,e)}}async function j(t){let i=e.activeSessionId,a=_(t),s=e.thinking,c=i?e.sessions.find(e=>e.id===i)?.model:void 0,l=e.thinkingBySession,u=v()!==(a?.id??t),f=a===void 0?void 0:d.value[a.id],p=f!==void 0&&a!==void 0&&e6(a,f)?f:void 0,m=u&&a!==void 0?p??b(a):qpe(a,s,u);if(!i)return g.value=t,e.thinking=m,!0;if(o(i,e=>({...e,model:t})),m!==s){e.thinking=m;let t={...e.thinkingBySession};p===void 0?delete t[i]:t[i]=p,e.thinkingBySession=t}try{await Q().updateSession(i,{model:t,thinking:m===s?void 0:p})}catch(t){return o(i,e=>({...e,model:c??e.model})),m!==s&&(e.thinking=s,e.thinkingBySession=l),n(`setModel`,t,{sessionId:i}),!1}return await r(i),!0}function M(e){let t=new Set(u.value);t.has(e)?t.delete(e):t.add(e),u.value=Array.from(t),Uhe(u.value)}async function N(t,r,o){let s=o??e.activeSessionId;if(!s)return;let l=a.value===`idle`&&!e.inFlightBySession[s],u=`msg_skill_opt_${Date.now().toString(36)}`,d=l?d8(s):void 0;if(l){e.inFlightBySession={...e.inFlightBySession,[s]:!0};let n={id:u,sessionId:s,role:`user`,content:[{type:`text`,text:`/${t}${r?` ${r}`:``}`}],createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0,origin:{kind:`skill_activation`,trigger:`user-slash`,skillName:t,skillArgs:r}}};c(s,e=>[...e,n])}try{let n=e.sessions.find(e=>e.id===s)?.model;if(!await i({thinking:await C(s,(n&&n.length>0?n:e.defaultModel)??void 0)??e.thinking},s))throw m8;await Q().activateSkill(s,t,r)}catch(t){l&&(e.inFlightBySession={...e.inFlightBySession,[s]:!1},c(s,e=>e.filter(e=>e.id!==u))),t!==m8&&n(`activateSkill`,t,{sessionId:s})}finally{d!==void 0&&f8(s,d)}}async function ee(e){try{await Q().importCatalogProvider(e),await Promise.all([k(),O()])}catch(e){n(`importCatalogProvider`,e)}}async function P(e){try{await Q().deleteProvider(e),await Promise.all([k(),O()])}catch(e){n(`deleteProvider`,e)}}async function F(e){try{let t=await Q().refreshProvider(e);for(let e of t.failed)n(`refreshProvider`,Error(e.reason),{message:e.provider});await Promise.all([k(),O()])}catch(e){n(`refreshProvider`,e)}}async function I(){try{let e=await Q().refreshAllProviders();for(let t of e.failed)n(`refreshAllProviders`,Error(t.reason),{message:t.provider});await Promise.all([k(),O()])}catch(e){n(`refreshAllProviders`,e)}}function te(e){let t=w(e),n=v();t!==void 0&&n!==void 0&&(d.value={...d.value,[n]:t},$i(qi.thinking,d.value)),i({thinking:t}),t!==void 0&&T(t)}return{models:l,starredModelIds:u,providers:m,catalogProviders:h,draftModel:g,skillsBySession:f,skillsByWorkspace:p,loadSkillsForSession:E,loadSkillsForWorkspace:D,loadModels:O,loadProviders:k,loadCatalogProviders:A,setModel:j,thinkingLevelForModelId:y,thinkingLevelForSessionId:S,resolveThinkingForPrompt:C,toggleStarModel:M,activateSkill:N,importCatalogProvider:ee,addProvider:e=>ee({catalogId:e.type,apiKey:e.apiKey,baseUrl:e.baseUrl}),deleteProvider:P,refreshProvider:F,refreshAllProviders:I,setThinking:te}}var Khe=/^read[_-]?media(?:file)?$/i,qhe=/^data:([^;]+);base64,(.*)$/s,Jhe=/^<(image|video|audio)\s+path="([^"]+)">$/,Yhe=/^<(image|video|audio)\s+path="([^"]+)">(?:<\/\1>)?$/,Xhe=/Mime type:\s*([^.\s]+)/i,Zhe=/Size:\s*(\d+)\s*bytes/i,Qhe=/Original dimensions:\s*(\d+)x(\d+)\s*pixels/i,$he=`Image compressed to fit model limits:`,ege=/Image compressed to fit model limits:[\s\S]*?<\/system>/g;function tge(e){return e.includes($he)?e.replace(ege,``):e}function nge(e){return e.replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`&`,`&`)}function rge(e){let t=Yhe.exec(e.trim());return t?{kind:t[1],path:nge(t[2])}:null}var h8=/^f_(?:[0-9A-Za-z]{26}|[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})$/,ige=/^f_(?:[0-9A-Za-z]{26}|[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})(?=-)/;function age(e){let t=e.split(/[\\/]/).at(-1)??``,n=t.lastIndexOf(`.`),r=n>0?t.slice(0,n):t;return h8.test(r)?r:void 0}var oge=/^Attached file "(.+)" \(([^,]+), (\d+) bytes\): (.+) — open it with the Read tool$/;function sge(e){let t=oge.exec(e.trim());if(!t)return null;let n=(t[4]??``).split(/[\\/]/).at(-1)??``,r=ige.exec(n)?.[0];return{name:t[1],mediaType:t[2],size:Number(t[3]),fileId:r!==void 0&&h8.test(r)?r:void 0}}function cge(e){if(e.length===0)return 0;let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return Math.floor(e.length*3/4)-t}function lge(e){if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function uge(e){let t=e.type,n=t===`image_url`?`image`:t===`video_url`?`video`:t===`audio_url`?`audio`:null;if(n===null)return null;let r=e[n===`image`?`imageUrl`:n===`video`?`videoUrl`:`audioUrl`];if(typeof r!=`object`||!r)return null;let i=r.url;return typeof i==`string`?{kind:n,url:i}:null}function dge(e,t){if(!Khe.test(e))return;let n=lge(t);if(n===null)return;let r,i,a,o,s,c=null;for(let e of n){if(typeof e!=`object`||!e)continue;let t=e;if(t.type===`text`&&typeof t.text==`string`){let e=t.text,n=Jhe.exec(e);n&&(i=n[1],r=n[2]);let c=Xhe.exec(e);c?.[1]&&(a=c[1]);let l=Zhe.exec(e);l?.[1]&&(o=Number(l[1]));let u=Qhe.exec(e);u?.[1]&&u[2]&&(s=`${u[1]}x${u[2]}`);continue}let n=uge(t);n&&(c=n)}if(c===null)return;let l=qhe.exec(c.url);return l?.[1]&&(a=l[1]),l?.[2]&&(o=cge(l[2])),{kind:c.kind??i??`image`,url:c.url,path:r,mimeType:a,bytes:Number.isFinite(o)?o:void 0,dimensions:s}}function fge(e){if(e!=null){if(typeof e==`string`)return e.split(` `);if(Array.isArray(e)){let t=[];for(let n of e)if(typeof n==`string`)t.push(...n.split(` `));else if(n&&typeof n==`object`){let e=n;e.type===`text`&&typeof e.text==`string`?t.push(...e.text.split(` `)):e.type===`think`&&typeof e.think==`string`?t.push(...e.think.split(` -`)):e.type===`image_url`||e.type===`image`?t.push(`[image]`):typeof e.type==`string`?t.push(`[${e.type}]`):t.push(JSON.stringify(n))}return t.length>0?t:void 0}return[JSON.stringify(e)]}}function age(e){return{id:e.agentId??e.id,toolCallId:e.parentToolCallId,name:e.description,subagentType:e.subagentType,prompt:e.command,model:e.model,thinkingEffort:e.thinkingEffort,phase:e.subagentPhase??(e.status===`completed`?`completed`:e.status===`failed`?`failed`:`working`),status:e.status,summary:e.outputPreview,outputLines:e.outputLines,text:e.text,suspendedReason:e.suspendedReason,dynamicWorkflowIndex:e.dynamicWorkflowIndex}}function oge(e,t){let n=e.split(` +`)):e.type===`image_url`||e.type===`image`?t.push(`[image]`):typeof e.type==`string`?t.push(`[${e.type}]`):t.push(JSON.stringify(n))}return t.length>0?t:void 0}return[JSON.stringify(e)]}}function pge(e){return{id:e.agentId??e.id,toolCallId:e.parentToolCallId,name:e.description,subagentType:e.subagentType,prompt:e.command,model:e.model,thinkingEffort:e.thinkingEffort,phase:e.subagentPhase??(e.status===`completed`?`completed`:e.status===`failed`?`failed`:`working`),status:e.status,summary:e.outputPreview,outputLines:e.outputLines,text:e.text,suspendedReason:e.suspendedReason,dynamicWorkflowIndex:e.dynamicWorkflowIndex}}function mge(e,t){let n=e.split(` `),r=t.split(` -`),i=[];return n.forEach((e,t)=>{i.push({kind:`rem`,gutter:String(t+1),text:`- ${e}`})}),r.forEach((e,t)=>{i.push({kind:`add`,gutter:String(t+1),text:`+ ${e}`})}),i}function sge(e){let t=e.display??{},n=typeof t.kind==`string`?t.kind:``;if(n===`diff`){let e=typeof t.path==`string`?t.path:``;return Array.isArray(t.diff)?{kind:`diff`,path:e,diff:t.diff}:typeof t.old_text==`string`&&typeof t.new_text==`string`?{kind:`diff`,path:e,diff:oge(t.old_text,t.new_text)}:{kind:`diff`,path:e,diff:[]}}if(n===`shell`||n===`command`)return{kind:`shell`,command:typeof t.command==`string`?t.command:e.action,cwd:typeof t.cwd==`string`?t.cwd:void 0,danger:typeof t.danger==`string`?t.danger:void 0};if(n===`file_content`||n===`file`)return{kind:`file`,path:typeof t.path==`string`?t.path:``,content:typeof t.content==`string`?t.content:``,language:typeof t.language==`string`?t.language:void 0};if(n===`file_op`||n===`fileop`)return{kind:`fileop`,op:typeof t.operation==`string`?t.operation:typeof t.op==`string`?t.op:n,path:typeof t.path==`string`?t.path:``,detail:typeof t.detail==`string`?t.detail:void 0};if(n===`url_fetch`||n===`url`)return{kind:`url`,method:typeof t.method==`string`?t.method:void 0,url:typeof t.url==`string`?t.url:e.action};if(n===`search`)return{kind:`search`,query:typeof t.query==`string`?t.query:e.action,scope:typeof t.scope==`string`?t.scope:void 0};if(n===`invocation`||n===`agent_call`||n===`skill_call`)return{kind:`invocation`,kind2:typeof t.kind==`string`?t.kind:n,name:typeof t.name==`string`?t.name:e.toolName,description:typeof t.description==`string`?t.description:void 0};if(n===`todo`||n===`todo_list`)return{kind:`todo`,items:(Array.isArray(t.items)?t.items:[]).map(e=>{let t=e??{};return{title:typeof t.title==`string`?t.title:``,status:typeof t.status==`string`?t.status:`pending`}})};if(n===`plan_review`){let e=typeof t.plan==`string`?t.plan:``,n=typeof t.path==`string`?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(e=>{let t=e??{},n=typeof t.label==`string`?t.label:``;return n?{label:n,description:typeof t.description==`string`?t.description:void 0}:null}).filter(e=>e!==null);return{kind:`plan_review`,plan:e,path:n,options:r.length>0?r:void 0}}return{kind:`generic`,summary:e.action}}var _8={};function cge(e){let t=e.indexOf(` +`),i=[];return n.forEach((e,t)=>{i.push({kind:`rem`,gutter:String(t+1),text:`- ${e}`})}),r.forEach((e,t)=>{i.push({kind:`add`,gutter:String(t+1),text:`+ ${e}`})}),i}function hge(e){let t=e.display??{},n=typeof t.kind==`string`?t.kind:``;if(n===`diff`){let e=typeof t.path==`string`?t.path:``;return Array.isArray(t.diff)?{kind:`diff`,path:e,diff:t.diff}:typeof t.old_text==`string`&&typeof t.new_text==`string`?{kind:`diff`,path:e,diff:mge(t.old_text,t.new_text)}:{kind:`diff`,path:e,diff:[]}}if(n===`shell`||n===`command`)return{kind:`shell`,command:typeof t.command==`string`?t.command:e.action,cwd:typeof t.cwd==`string`?t.cwd:void 0,danger:typeof t.danger==`string`?t.danger:void 0};if(n===`file_content`||n===`file`)return{kind:`file`,path:typeof t.path==`string`?t.path:``,content:typeof t.content==`string`?t.content:``,language:typeof t.language==`string`?t.language:void 0};if(n===`file_op`||n===`fileop`)return{kind:`fileop`,op:typeof t.operation==`string`?t.operation:typeof t.op==`string`?t.op:n,path:typeof t.path==`string`?t.path:``,detail:typeof t.detail==`string`?t.detail:void 0};if(n===`url_fetch`||n===`url`)return{kind:`url`,method:typeof t.method==`string`?t.method:void 0,url:typeof t.url==`string`?t.url:e.action};if(n===`search`)return{kind:`search`,query:typeof t.query==`string`?t.query:e.action,scope:typeof t.scope==`string`?t.scope:void 0};if(n===`invocation`||n===`agent_call`||n===`skill_call`)return{kind:`invocation`,kind2:typeof t.kind==`string`?t.kind:n,name:typeof t.name==`string`?t.name:e.toolName,description:typeof t.description==`string`?t.description:void 0};if(n===`todo`||n===`todo_list`)return{kind:`todo`,items:(Array.isArray(t.items)?t.items:[]).map(e=>{let t=e??{};return{title:typeof t.title==`string`?t.title:``,status:typeof t.status==`string`?t.status:`pending`}})};if(n===`plan_review`){let e=typeof t.plan==`string`?t.plan:``,n=typeof t.path==`string`?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(e=>{let t=e??{},n=typeof t.label==`string`?t.label:``;return n?{label:n,description:typeof t.description==`string`?t.description:void 0}:null}).filter(e=>e!==null);return{kind:`plan_review`,plan:e,path:n,options:r.length>0?r:void 0}}return{kind:`generic`,summary:e.action}}var g8={};function gge(e){let t=e.indexOf(` `),n=e.lastIndexOf(` -`);return t>=0&&n>=t+9?e.slice(t+9,n):lge(e)}function lge(e){let t=e.split(` +`);return t>=0&&n>=t+9?e.slice(t+9,n):_ge(e)}function _ge(e){let t=e.split(` `);return t.length>=2&&t[0]?.startsWith(``?t.slice(1,-1).join(` -`):e}function uge(e){let t=e.metadata?.origin;if(t?.kind===`cron_job`||t?.kind===`cron_missed`)return t.kind}function dge(e){return cge(e.content.filter(e=>e.type===`text`).map(e=>e.text).join(` -`))}function fge(e,t){let n=e.metadata?.origin??{},r=dge(e);return t===`cron_missed`?{text:r,cron:{missedCount:typeof n.count==`number`?n.count:void 0}}:{text:r,cron:{jobId:typeof n.jobId==`string`?n.jobId:void 0,cron:typeof n.cron==`string`?n.cron:void 0,recurring:typeof n.recurring==`boolean`?n.recurring:void 0,coalescedCount:typeof n.coalescedCount==`number`?n.coalescedCount:void 0,stale:typeof n.stale==`boolean`?n.stale:void 0}}}function pge(e,t,n){let{text:r,cron:i}=fge(e,n);return{id:e.id,role:`cron`,no:t,text:r,createdAt:e.createdAt,cron:i}}function mge(e){let t=e.metadata?.origin,n=t?.kind;return n===void 0||n===`user`?!0:n===`skill_activation`||n===`plugin_command`?t?.trigger===`user-slash`:!1}function v8(e){return e.metadata?.origin?.kind===`compaction_summary`}function hge(e,t){return e===null?!1:e.promptId===void 0||t===void 0||e.promptId===t}function gge(e){if(!(!e||e.length===0)){for(let t of e)if(t.startsWith(`Plan saved to: `))return t.slice(15).trim()}}function _ge(e){let t=``,n=``,r=[],i=[];for(let a of e)a.type===`text`?t+=a.text:a.type===`thinking`?n+=a.thinking:a.type===`toolUse`?r.push(a.toolCallId):i.push(JSON.stringify(a));return r.sort(),i.sort(),{text:t,thinking:n,toolIds:r,rest:i}}function vge(e,t){return t.text!==``&&t.text!==e.text||t.thinking!==``&&t.thinking!==e.thinking?!1:t.toolIds.every(t=>e.toolIds.includes(t))&&t.rest.every(t=>e.rest.includes(t))}function y8(e,t,n,r=!0,i=_8){let a=[],o=1,s=new Map;for(let e of t)s.set(e.toolCallId,e);let c=null;function l(e=!1){if(!c)return;let t=c;if(c=null,!e||!r)for(let e=0;ee.kind===`tool`&&e.tool.id===r.id);i&&i.kind===`tool`&&(i.tool=r)}a.push({id:t.id,promptId:t.promptId,role:`assistant`,no:o++,text:t.textParts.join(` +`):e}function vge(e){let t=e.metadata?.origin;if(t?.kind===`cron_job`||t?.kind===`cron_missed`)return t.kind}function yge(e){return gge(e.content.filter(e=>e.type===`text`).map(e=>e.text).join(` +`))}function bge(e,t){let n=e.metadata?.origin??{},r=yge(e);return t===`cron_missed`?{text:r,cron:{missedCount:typeof n.count==`number`?n.count:void 0}}:{text:r,cron:{jobId:typeof n.jobId==`string`?n.jobId:void 0,cron:typeof n.cron==`string`?n.cron:void 0,recurring:typeof n.recurring==`boolean`?n.recurring:void 0,coalescedCount:typeof n.coalescedCount==`number`?n.coalescedCount:void 0,stale:typeof n.stale==`boolean`?n.stale:void 0}}}function xge(e,t,n){let{text:r,cron:i}=bge(e,n);return{id:e.id,role:`cron`,no:t,text:r,createdAt:e.createdAt,cron:i}}function Sge(e){let t=e.metadata?.origin,n=t?.kind;return n===void 0||n===`user`?!0:n===`skill_activation`||n===`plugin_command`?t?.trigger===`user-slash`:!1}function _8(e){return e.metadata?.origin?.kind===`compaction_summary`}function Cge(e,t){return e===null?!1:e.promptId===void 0||t===void 0||e.promptId===t}function wge(e){if(!(!e||e.length===0)){for(let t of e)if(t.startsWith(`Plan saved to: `))return t.slice(15).trim()}}function Tge(e){let t=``,n=``,r=[],i=[];for(let a of e)a.type===`text`?t+=a.text:a.type===`thinking`?n+=a.thinking:a.type===`toolUse`?r.push(a.toolCallId):i.push(JSON.stringify(a));return r.sort(),i.sort(),{text:t,thinking:n,toolIds:r,rest:i}}function Ege(e,t){return t.text!==``&&t.text!==e.text||t.thinking!==``&&t.thinking!==e.thinking?!1:t.toolIds.every(t=>e.toolIds.includes(t))&&t.rest.every(t=>e.rest.includes(t))}function v8(e,t,n,r=!0,i=g8){let a=[],o=1,s=new Map;for(let e of t)s.set(e.toolCallId,e);let c=null;function l(e=!1){if(!c)return;let t=c;if(c=null,!e||!r)for(let e=0;ee.kind===`tool`&&e.tool.id===r.id);i&&i.kind===`tool`&&(i.tool=r)}a.push({id:t.id,promptId:t.promptId,role:`assistant`,no:o++,text:t.textParts.join(` `),thinking:t.thinkingParts.length>0?t.thinkingParts.join(` `):void 0,tools:t.tools.length>0?t.tools:void 0,blocks:t.blocks.length>0?t.blocks:void 0,approval:t.approval,approvalId:t.approvalId,durationMs:t.durationMs})}function u(e,t){for(let n of t)if(n.type===`text`){if(n.text){e.textParts.push(n.text);let t=e.blocks.at(-1);t&&t.kind===`text`?t.text+=` `+n.text:e.blocks.push({kind:`text`,text:n.text})}}else if(n.type===`thinking`){if(n.thinking){e.thinkingParts.push(n.thinking);let t=e.blocks.at(-1);t&&t.kind===`thinking`?(t.thinking+=` -`+n.thinking,t.durationMs=n.durationMs):e.blocks.push({kind:`thinking`,thinking:n.thinking,startedAt:n.startedAt,durationMs:n.durationMs})}}else if(n.type===`toolUse`){let t=s.get(n.toolCallId),r={id:n.toolCallId,name:n.toolName,arg:typeof n.input==`string`?n.input:JSON.stringify(n.input),status:`running`,output:n.outputLines,planPath:n.toolName===`ExitPlanMode`?i[n.toolCallId]?.path:void 0};e.tools.push(r),e.blocks.push({kind:`tool`,tool:r}),t&&(e.approval=sge(t),e.approvalId=t.approvalId)}else if(n.type===`toolResult`){let t=e.tools.findIndex(e=>e.id===n.toolCallId);if(t!==-1){let r=e.tools[t],i={...r,status:n.isError?`error`:`ok`,output:ige(n.output),media:n.isError?void 0:rge(r.name,n.output)};i.name===`ExitPlanMode`&&!i.planPath&&(i.planPath=gge(i.output)),e.tools[t]=i;let a=e.blocks.find(e=>e.kind===`tool`&&e.tool.id===n.toolCallId);a&&a.kind===`tool`&&(a.tool=i)}}}function d(e,t){for(let n of t){if(n.type!==`toolUse`||!n.outputLines?.length)continue;let t=e.tools.findIndex(e=>e.id===n.toolCallId);if(t===-1)continue;let r=e.tools[t];if(r.output!==void 0)continue;let i={...r,output:n.outputLines};e.tools[t]=i;let a=e.blocks.find(e=>e.kind===`tool`&&e.tool.id===n.toolCallId);a&&a.kind===`tool`&&(a.tool=i)}}function f(e){if(e.type===`image`||e.type===`video`){let t=e.type,r=e.source;if(r.kind===`url`)return{url:r.url,kind:t};if(r.kind===`base64`)return{url:`data:${r.mediaType};base64,${r.data}`,kind:t};if(r.kind===`file`&&n)return{url:n(r.fileId),kind:t,fileId:r.fileId}}if(e.type===`file`&&n){if(e.mediaType.startsWith(`image/`))return{url:n(e.fileId),kind:`image`,fileId:e.fileId};if(e.mediaType.startsWith(`video/`))return{url:n(e.fileId),kind:`video`,fileId:e.fileId}}}for(let t of e){if(t.role===`system`)continue;if(v8(t)){l();let e=t.metadata?.[nm];a.push({id:t.id,role:`compaction`,no:o,text:t.content.filter(e=>e.type===`text`).map(e=>e.text).join(` -`),compaction:{trigger:e?.trigger,tokensBefore:e?.tokensBefore,tokensAfter:e?.tokensAfter}});continue}if(t.role===`user`){let e=uge(t);if(e!==void 0){l(),a.push(pge(t,o++,e));continue}let r=t.metadata?.origin?.kind;if(r===`task`||r===`background_task`||r===`task_notification`){let e=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(` -`),n=Kse(t.metadata),r=n?[n]:M4(e);if(r.length>0){c??={id:t.id,promptId:void 0,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,foldedSigs:[]};for(let e of r)c.blocks.push({kind:`notification`,notification:{...e,createdAt:t.createdAt}})}continue}if(l(),!mge(t))continue;let i=t.metadata?.origin,s=i?.kind===`skill_activation`&&i?.trigger===`user-slash`,u=i?.kind===`plugin_command`&&i?.trigger===`user-slash`,d=[],p=[];for(let e of t.content){if(e.type===`text`)if(s)d.push(i.skillArgs??``);else if(u)d.push(i.commandArgs??``);else{let t=Yhe(e.text);if(t&&(t.kind===`video`||t.kind===`image`)&&n){let e=Zhe(t.path);if(e){p.push({url:n(e),kind:t.kind,fileId:e});continue}}let r=$he(e.text);if(r){p.push({kind:`file`,url:r.fileId&&n?n(r.fileId):``,fileId:r.fileId,name:r.name,mediaType:r.mediaType,size:r.size});continue}let i=qhe(e.text);if(i!==e.text&&i.trim().length===0)continue;d.push(i)}let t=f(e);if(t){p.push({url:t.url,kind:t.kind,name:e.type===`file`?e.name:void 0,fileId:t.fileId});continue}e.type===`file`&&n&&p.push({kind:`file`,url:n(e.fileId),fileId:e.fileId,name:e.name,mediaType:e.mediaType||void 0,size:e.size})}a.push({id:t.id,promptId:t.promptId,role:`user`,no:o++,text:d.join(` -`),attachments:p.length>0?p:void 0,skillActivation:s?{name:i.skillName,args:i.skillArgs}:void 0,pluginCommand:u?{pluginId:i.pluginId,commandName:i.commandName,args:i.commandArgs}:void 0,createdAt:t.createdAt});continue}if(t.role===`tool`){c&&u(c,t.content);continue}let e=t.promptId;hge(c,e)?c!==null&&c.promptId===void 0&&e!==void 0&&(c.promptId=e):(l(),c={id:t.id,promptId:e,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,foldedSigs:[],durationMs:t.durationMs});let r=c;if(r===null)continue;let i=_ge(t.content);if(r.promptId!==void 0&&r.foldedSigs.some(e=>vge(e,i))){d(r,t.content);continue}r.foldedSigs.push(i),u(r,t.content)}return l(!0),a}function yge(e){if(v8(e))return!0;if(e.role!==`user`)return!1;let t=e.metadata?.origin?.kind;return t!==`task`&&t!==`background_task`&&t!==`task_notification`}function bge(e){for(let t=e.length-1;t>=0;--t)if(yge(e[t]))return t;return 0}function xge(){let e;return(t,n,r,i=!0,a=_8)=>{let o=t.at(-1),s=e!==void 0&&(e.approvals===n||e.approvals.length===0&&n.length===0)&&e.getFileUrl===r&&e.sessionActive===i&&e.planReviewByToolCallId===a;if(e!==void 0&&s&&e.messages===t&&e.messageCount===t.length){if(e.lastMessage===o)return e.turns;if(o?.role===`assistant`&&!v8(o)&&e.lastMessage?.role===`assistant`&&e.lastMessage.id===o.id){let s=y8(t.slice(e.boundaryIndex),n,r,i,a),c=e.prefixTurns.filter(e=>e.role!==`compaction`).length,l=s.map(e=>({...e,no:e.no+c})),u=e.tailTurns;if(l.length===u.length&&l.every((e,t)=>e.id===u[t]?.id&&e.role===u[t]?.role)){for(let e=0;e{let t=e.activeSessionId;if(!t)return null;let n=s.value[t];return n?{parentId:t,agentId:n.agentId}:null}),l=L(()=>c.value?.parentId??null),u=L(()=>c.value!==null),d=L(()=>{let t=c.value;return t?!!e.sideChatSendingByAgent[t.agentId]:!1}),f=L(()=>{let t=c.value;return t?e.sideChatSendingByAgent[t.agentId]?!0:(e.tasksBySession[t.parentId]??[]).some(e=>e.id===t.agentId&&e.status===`running`):!1}),p=L(()=>{let t=c.value;return t?y8(e.sideChatMessagesByAgent[t.agentId]??[],[],e=>Q().getFileUrl(e),f.value):[]});function m(t,n){e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[t]:n(e.sideChatMessagesByAgent[t]??[])}}function h(e,t){m(e,e=>[...e,t])}function g(e){m(e,e=>{let t=[...e].reverse().findIndex(e=>e.role===`user`);if(t===-1)return e;let n=e.length-1-t;return e.filter((e,t)=>t!==n)})}function _(e,t){m(e,e=>{let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r.role===`user`)return n[e]={...r,promptId:r.promptId??t},n}return e})}function v(e,t,n){n&&m(e,e=>{let i=e.at(-1);if(i?.role===`assistant`){let t=i.content[0],r=t?.type===`text`?t.text:``;return[...e.slice(0,-1),{...i,content:[{type:`text`,text:`${r}${n}`}]}]}return[...e,{id:r(),sessionId:t,role:`assistant`,content:[{type:`text`,text:n}],createdAt:new Date().toISOString()}]})}function y(t,n,r){if(e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[t]:!1},!r)return;let i=(e.sideChatMessagesByAgent[t]??[]).at(-1);(i?.role===`assistant`&&i.content[0]?.type===`text`?i.content[0].text:``).trim().length>0||v(t,n,r)}async function b(t){let n=e.activeSessionId;n&&await x(n,t)}async function x(t,r){if(!s.value[t]){let r;try{({agentId:r}=await Q().startBtw(t))}catch(e){n(`openSideChat`,e,{sessionId:t});return}e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[r]:e.sideChatMessagesByAgent[r]??[]},s.value={...s.value,[t]:{agentId:r}},i(),a()?.markSideChannelAgent(r)}r&&r.trim()&&await S(t,r.trim())}async function S(t,i){let a=s.value[t],c=i.trim();if(!a||!c)return;let l=t,u=a.agentId;e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[u]:!0},h(u,{id:r(),sessionId:l,role:`user`,content:[{type:`text`,text:c}],createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0}});try{let t=e.sessions.find(e=>e.id===l),n=(t?.model&&t.model.length>0?t.model:e.defaultModel)??void 0,r=await Q().submitPrompt(l,{content:[{type:`text`,text:c}],agentId:u,model:n,thinking:await o(l,n)??e.thinking,permissionMode:e.permissionBySession[l]??e.permission,planMode:e.planModeBySession[l]??!1,dynamicWorkflowMode:e.dynamicWorkflowModeBySession[l]??!1});_(u,r.promptId),e.sideChatUserMessageIdsBySession={...e.sideChatUserMessageIdsBySession,[l]:[...e.sideChatUserMessageIdsBySession[l]??[],r.userMessageId]}}catch(t){n(`sendSideChatPrompt`,t,{sessionId:l}),g(u),e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[u]:!1}}}function C(){let t=e.activeSessionId;if(!t)return;let{[t]:n,...r}=s.value;s.value=r}async function w(e){let t=c.value;t&&await S(t.parentId,e)}function T(e){if(!s.value[e])return;let{[e]:t,...n}=s.value;s.value=n}return{sideChatTargetBySession:s,sideChatSessionId:l,sideChatVisible:u,sideChatSending:d,sideChatRunning:f,sideChatTurns:p,appendSideChatAssistantText:v,finishSideChatAgent:y,openSideChat:b,openSideChatOn:x,closeSideChat:C,sendSideChatPrompt:w,clearSideChatForSession:T}}function Cge(){let e=Qi(qi.discussionPair);if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.fusionLeadModelId!=`string`||t.fusionLeadModelId.length===0||typeof t.peerModelId!=`string`||t.peerModelId.length===0||t.fusionLeadModelId===t.peerModelId||t.fusionLeadThinkingEffort!==void 0&&typeof t.fusionLeadThinkingEffort!=`string`||t.peerThinkingEffort!==void 0&&typeof t.peerThinkingEffort!=`string`))return e}function wge(e,t,n){let r=R({}),i=R({}),a=R(Cge()),o=R(!1),c=R(),l=new Map,u=new Map,d=new Map,f=L(()=>r.value[e.value]),p=L(()=>{let e=f.value,t=e?.activeRunId??e?.latestRunId;return t===void 0?void 0:i.value[t]}),m=L(()=>Object.values(i.value).filter(t=>t.sessionId===e.value).toSorted((e,t)=>e.turnId-t.turnId||e.createdAt.localeCompare(t.createdAt))),h=L(()=>t.value&&f.value?.feature===`enabled`);function g(e,t){r.value={...r.value,[e]:t},a.value===void 0&&t.config!==null&&_(t.config);let n=t.activeRunId??t.latestRunId;n!==void 0&&x(e,n)}function _(e){a.value={...e},$i(qi.discussionPair,a.value)}function v(e){let t=(l.get(e)??0)+1;return l.set(e,t),t}function y(e,t){d.set(e,t.resourceVersion),g(e,t)}function b(e){let t=i.value[e.runId];t!==void 0&&t.revision>e.revision||t!==void 0&&t.revision===e.revision&&(t.progressRevision??0)>(e.progressRevision??0)||(i.value={...i.value,[e.runId]:e})}async function x(e,t){try{b(await Q().getExpertTalkRun(e,t))}catch(t){c.value=t instanceof Error?t.message:String(t),n(`expertTalkRefreshRun`,t,{sessionId:e})}}async function S(n=e.value){if(!t.value||n.length===0)return;let r=v(n);try{let[e,t]=await Promise.all([Q().getExpertTalkStatus(n),Q().listExpertTalkRuns(n)]);if(l.get(n)!==r)return;d.delete(n),g(n,e);for(let e of t.runs)b(e)}catch(e){c.value=e instanceof Error?e.message:String(e)}}async function C(t,r){let i=e.value;if(!(i.length===0||o.value)){v(i),o.value=!0,c.value=void 0;try{await r(i)}catch(e){c.value=e instanceof Error?e.message:String(e),n(t,e,{sessionId:i})}finally{o.value=!1}}}async function w(e,t){if(t.fusionLeadModelId===t.peerModelId)throw Error(`Select two different models`);let n=r.value[e]??await Q().getExpertTalkStatus(e);return n.config?.fusionLeadModelId!==t.fusionLeadModelId||n.config.peerModelId!==t.peerModelId||n.config.fusionLeadThinkingEffort!==t.fusionLeadThinkingEffort||n.config.peerThinkingEffort!==t.peerThinkingEffort?(n=await Q().configureExpertTalk(e,t,n.resourceVersion),y(e,n),n):(g(e,n),n)}async function T(t){if(t.fusionLeadModelId===t.peerModelId)throw Error(`Select two different models`);if(e.value.length===0){c.value=void 0,_(t);return}await C(`expertTalkConfigure`,async e=>{_((await w(e,t)).config??t)})}async function E(e){await C(`expertTalkArm`,async t=>{let n=await w(t,e);_(n.config??e),y(t,await Q().armExpertTalk(t,n.resourceVersion))})}async function D(){await C(`expertTalkDisarm`,async e=>{let t=r.value[e]?.activation.armId;y(e,await Q().disarmExpertTalk(e,t))})}async function O(){await C(`expertTalkClear`,async e=>{let t=r.value[e];y(e,await Q().clearExpertTalk(e,t?.resourceVersion))})}async function k(){await C(`expertTalkCancel`,async e=>{let t=r.value[e]?.activeRunId;t!==void 0&&(b(await Q().cancelExpertTalkRun(e,t)),await S(e))})}async function A(){await C(`expertTalkRetry`,async e=>{let t=r.value[e]?.latestRunId;t!==void 0&&(b(await Q().retryExpertTalkRun(e,t)),await S(e))})}function j(e,t,n){if(n!==void 0){let t=u.get(e)??0;if(nt&&u.set(e,n)}let r=d.get(e);r!==void 0&&t.resourceVersion!==r||(r===t.resourceVersion&&d.delete(e),g(e,t))}function M(e){let t=r.value[e];return t?.activation.state===`armed`?t.activation.armId:void 0}function N(e,t){let n=r.value[e];n!==void 0&&g(e,{...n,activation:{state:`idle`},activeRunId:t,latestRunId:t}),S(e)}return s([e,t],([e,t])=>{t&&e.length>0&&S(e)},{immediate:!0}),{available:h,preferredPair:a,status:f,run:p,runs:m,busy:o,error:c,refresh:S,configurePair:T,useForNextMessage:E,disarm:D,clear:O,cancel:k,retry:A,applyStatus:j,armIdForSession:M,promptAccepted:N}}var b8=20,Tge=class{sessionId;agentId;fetchPage;onChange;onGap;transcript;refreshPromise=null;buffered=[];agentsValue=[];seqValue;loadingOlderValue=!1;loadOlderErrorValue=!1;refreshErrorValue=!1;constructor(e,t,n,r,i){this.sessionId=e,this.agentId=t,this.fetchPage=n,this.onChange=r,this.onGap=i,this.transcript=new ste(t)}get snapshot(){return this.transcript.snapshot()}get agents(){return this.agentsValue}get seq(){return this.seqValue}get loading(){return this.refreshPromise!==null}get loadingOlder(){return this.loadingOlderValue}get loadOlderError(){return this.loadOlderErrorValue}get refreshError(){return this.refreshErrorValue}refresh(){if(this.refreshPromise!==null)return this.refreshPromise;this.refreshErrorValue=!1;let e=this.fetchPage({pageSize:b8}).then(e=>this.applyPage(e,!0)).catch(e=>{throw this.refreshErrorValue=!0,e}).finally(()=>{this.refreshPromise=null,this.flushBuffered(),this.onChange()});return this.refreshPromise=e,this.onChange(),e}receiveReset(e,t){this.transcript.receive([{op:`reset`,agentId:this.agentId,snapshot:e}]),t!==void 0&&(this.seqValue=t),this.refreshErrorValue=!1,this.onChange()}applyOps(e,t){if(this.refreshPromise!==null||this.loadingOlderValue)return this.buffered.push({ops:e,seq:t}),!1;if(t!==void 0&&this.seqValue!==void 0){if(t<=this.seqValue)return!0;if(t!==this.seqValue+1)return this.onGap(),!1}let n=this.transcript.apply(e);return t!==void 0&&(this.seqValue=t),n.gap!==void 0&&this.onGap(),n.accepted.length>0&&this.onChange(),n.gap===void 0}async loadOlder(){if(!this.snapshot.hasMoreOlder||this.loadingOlderValue)return;let e=this.snapshot.items.find(e=>e.kind===`turn`);if(e?.kind===`turn`){this.loadingOlderValue=!0,this.loadOlderErrorValue=!1,this.onChange();try{let t=await this.fetchPage({beforeTurn:e.turnId,pageSize:b8});this.applyPage(t,!1)}catch(e){throw this.loadOlderErrorValue=!0,e}finally{this.loadingOlderValue=!1,this.flushBuffered(),this.onChange()}}}applyPage(e,t){this.agentsValue=e.agents;let n=this.snapshot,r=t?e.snapshot:{...e.snapshot,items:Ege(e.snapshot.items,n.items),hasMoreOlder:e.snapshot.hasMoreOlder};this.receiveReset(r,t?e.seq:void 0)}flushBuffered(){let e=this.buffered;this.buffered=[];for(let t of e)this.applyOps(t.ops,t.seq)}};function Ege(e,t){let n=new Set,r=[];for(let i of[...e,...t]){let e=Iee(i);n.has(e)||(n.add(e),r.push(i))}return r}function x8(e,t){return`${e}\0${t}`}function Dge(e){let t=new Map,n=new Map,r=new Map;function i(e){e.version.value+=1}function a(t,n,i){let a=e.getEventConnection();a!==null&&(a.subscribeTranscript(t,n,i),r.set(t,n))}function o(n,r){let a=x8(n,r),o=t.get(a);if(o!==void 0)return o;let c;return c={channel:new Tge(n,r,t=>e.api.getSessionTranscript(n,{...t,agentId:r}),()=>i(c),()=>void s(c)),version:ue(0)},t.set(a,c),c}async function s(e){try{await e.channel.refresh(),n.get(e.channel.sessionId)===e.channel.agentId&&a(e.channel.sessionId,e.channel.agentId,e.channel.seq)}catch{n.get(e.channel.sessionId)===e.channel.agentId&&a(e.channel.sessionId,e.channel.agentId)}}function c(t,r){e.connectEventsIfNeeded(),n.set(t,r);let i=o(t,r);return i.channel.snapshot.items.length>0||i.channel.seq!==void 0?a(t,r,i.channel.seq):s(i),i}function l(t,i){if(n.get(t)!==i)return;n.delete(t);let a=r.get(t);a!==void 0&&(e.getEventConnection()?.unsubscribeTranscript(t,[a]),r.delete(t))}return{getEntry(e,n){return t.get(x8(e,n))},activate:c,deactivate:l,receiveReset(e,t,r,i){n.get(e)===t&&o(e,t).channel.receiveReset(r,i)},applyOps(e,t,r,i){return n.get(e)===t?o(e,t).channel.applyOps(r,i):!0},forgetSession(e){let r=n.get(e);r!==void 0&&l(e,r);for(let n of t.keys())n.startsWith(`${e}\0`)&&t.delete(n)}}}var Oge=`pythinkerWeb.optimisticUserMessage`,S8=`Sub Agent`;function kge(){return{sessions:[],activeSessionId:void 0,messagesBySession:{},approvalsBySession:{},planReviewByToolCallId:{},questionsBySession:{},tasksBySession:{},goalBySession:{},goalVersionBySession:{},lastSeqBySession:{},turnActiveBySession:{},compactionBySession:{},warnings:[]}}function Age(e){return{...e,sessions:e.sessions,messagesBySession:{...e.messagesBySession},approvalsBySession:{...e.approvalsBySession},planReviewByToolCallId:{...e.planReviewByToolCallId},questionsBySession:{...e.questionsBySession},tasksBySession:{...e.tasksBySession},goalBySession:{...e.goalBySession},goalVersionBySession:{...e.goalVersionBySession},lastSeqBySession:{...e.lastSeqBySession},turnActiveBySession:{...e.turnActiveBySession},compactionBySession:{...e.compactionBySession},warnings:[...e.warnings]}}function jge(e,t,n){t!==void 0&&n!==void 0&&n>0&&n>(e.lastSeqBySession[t]??0)&&(e.lastSeqBySession[t]=n)}function C8(e){return e.role===`user`&&e.metadata?.[Oge]===!0}function Mge(e){let t=e.metadata?.origin;return t?.kind===`cron_job`||t?.kind===`cron_missed`}function Nge(e,t){return JSON.stringify(e.content)===JSON.stringify(t.content)}function Pge(e,t){if(e.role!==`assistant`||t.role!==`assistant`||e.promptId===void 0||e.promptId!==t.promptId)return!1;let n=e=>JSON.stringify(e.content.map(e=>e.type===`thinking`?{type:e.type,thinking:e.thinking}:e.type===`toolUse`?{type:e.type,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input}:e));return n(e)===n(t)}var Fge=/^<(image|video|audio)\s+path="[^"]+"><\/\1>$/;function w8(e){let t=``,n=0;for(let r of e.content)r.type===`text`?Fge.test(r.text.trim())?n+=1:t+=r.text:(r.type===`image`||r.type===`video`||r.type===`file`)&&(n+=1);return{text:t,media:n}}function Ige(e,t){let n=w8(e),r=w8(t);return n.text===r.text&&n.media===r.media}function Lge(e,t){let n=t.promptId;if(n!==void 0)for(let t=e.length-1;t>=0;t--){let r=e[t];if(C8(r)&&r.promptId===n)return t}for(let n=e.length-1;n>=0;n--){let r=e[n];if(C8(r)&&Nge(r,t))return n}for(let n=e.length-1;n>=0;n--){let r=e[n];if(C8(r)&&Ige(r,t))return n}return-1}function Rge(e,t,n){let r=!1,i=e.map(e=>{let i=!1,a=e.content.map(e=>e.type!==`toolUse`||e.toolCallId!==t?e:(i=!0,{...e,outputLines:[...e.outputLines??[],n]}));return i?(r=!0,{...e,content:a}):e});return r?i:e}function T8(e,t,n=e.length){for(let r=0;re.id===t.messageId);return r===-1?!1:(e[r]=E8(e[r],t),!0)}var Bge={"provider.connection_error":`connection`,"provider.auth_error":`auth`,"provider.rate_limit":`rateLimit`,"provider.overloaded":`overloaded`,"provider.filtered":`filtered`,"provider.api_error":`api`,"context.overflow":`contextOverflow`};function Vge(e){let t=Jx.global.t,n=[],r=(e,t)=>{typeof t==`number`||typeof t==`boolean`?n.push({label:e,value:String(t)}):typeof t==`string`&&t.length>0&&n.push({label:e,value:t})};r(t(`warnings.details.code`),e.code);let i=e.details??{};r(t(`warnings.details.status`),i.statusCode),r(t(`warnings.details.requestId`),i.requestId),r(t(`warnings.details.errorName`),e.name);for(let[e,t]of Object.entries(i))e===`statusCode`||e===`requestId`||r(e,t);return{severity:`error`,title:t(`warnings.agentError.${(e.code===void 0?void 0:Bge[e.code])??`title`}`),message:e.message,details:n.length>0?n:void 0}}function Hge(e,t,n){let r=Age(e);switch(jge(r,n.sessionId,n.seq),t.type){case`sessionCreated`:r.sessions.some(e=>e.id===t.session.id)||(r.sessions=[t.session,...r.sessions]);break;case`sessionDeleted`:{let e=t.sessionId;r.sessions=r.sessions.filter(t=>t.id!==e),delete r.messagesBySession[e],delete r.tasksBySession[e],delete r.goalBySession[e],delete r.approvalsBySession[e],delete r.questionsBySession[e],delete r.lastSeqBySession[e],delete r.turnActiveBySession[e],r.activeSessionId===e&&(r.activeSessionId=void 0);break}case`sessionArchived`:{let e=t.sessionId;r.sessions=r.sessions.filter(t=>t.id!==e),r.activeSessionId===e&&(r.activeSessionId=void 0);break}case`sessionWorkChanged`:r.sessions=r.sessions.map(e=>e.id===t.sessionId?{...e,busy:t.busy,mainTurnActive:t.mainTurnActive??(t.busy?e.mainTurnActive:!1),pendingInteraction:t.pendingInteraction??e.pendingInteraction,lastTurnReason:t.lastTurnReason}:e),t.mainTurnActive===!0?r.turnActiveBySession[t.sessionId]=!0:(t.mainTurnActive===!1||!t.busy)&&delete r.turnActiveBySession[t.sessionId];break;case`sessionMetaUpdated`:r.sessions=r.sessions.map(e=>e.id===t.sessionId?{...e,title:t.title??e.title,lastPrompt:t.lastPrompt??e.lastPrompt}:e);break;case`sessionUsageUpdated`:r.sessions=r.sessions.map(e=>{if(e.id!==t.sessionId)return e;let n=t.model&&t.model.length>0?t.model:e.model;return{...e,usage:t.usage,model:n}});break;case`historyCompacted`:break;case`compactionStarted`:r.compactionBySession={...r.compactionBySession,[t.sessionId]:{status:`running`,trigger:t.trigger}};break;case`compactionCompleted`:{let e=t.sessionId,i=r.compactionBySession[e],{[e]:a,...o}=r.compactionBySession;if(r.compactionBySession=o,Object.prototype.hasOwnProperty.call(r.messagesBySession,e)){let a=r.messagesBySession[e]??[],o=`compaction_${e}_${n.seq}`;if(!a.some(e=>e.id===o)){let n={trigger:i?.trigger??`auto`,tokensBefore:t.tokensBefore,tokensAfter:t.tokensAfter};r.messagesBySession[e]=[...a,{id:o,sessionId:e,role:`assistant`,content:t.summary?[{type:`text`,text:t.summary}]:[],createdAt:new Date().toISOString(),metadata:{origin:{kind:`compaction_summary`},[nm]:n}}]}}break}case`compactionCancelled`:{let{[t.sessionId]:e,...n}=r.compactionBySession;r.compactionBySession=n;break}case`messageCreated`:{let e=t.message.sessionId,n=t.message.createdAt;r.sessions=r.sessions.map(t=>t.id===e&&n>t.updatedAt?{...t,updatedAt:n}:t);let i=r.messagesBySession[e]??[];if(!i.some(e=>e.id===t.message.id||Pge(e,t.message))){if(t.message.role===`user`&&!Mge(t.message)){let n=Lge(i,t.message);if(n!==-1){let a=[...i],o=a[n];a[n]={...t.message,id:o.id,promptId:t.message.promptId??o.promptId,metadata:{...t.message.metadata,...o.metadata}},r.messagesBySession[e]=a;break}}r.messagesBySession[e]=[...i,t.message]}break}case`messageUpdated`:{let e=t.sessionId,n=r.messagesBySession[e]??[];r.messagesBySession[e]=n.map(e=>{if(e.id!==t.messageId)return e;let n=t.content.map((t,n)=>{let r=e.content[n];return t.type===`thinking`&&r?.type===`thinking`?{...t,startedAt:r.startedAt,durationMs:r.durationMs}:t}),r=Date.now();return T8(n,r,n.length-1),(t.status!==`pending`||t.durationMs!==void 0)&&T8(n,r),{...e,content:n,durationMs:t.durationMs??e.durationMs}});break}case`assistantDelta`:{let e=t.sessionId,n=r.messagesBySession[e]??[],i=n.findIndex(e=>e.id===t.messageId);i!==-1&&(r.messagesBySession[e]=n.with(i,E8(n[i],t)));break}case`toolOutput`:{let e=t.sessionId,n=r.messagesBySession[e]??[];r.messagesBySession[e]=Rge(n,t.toolCallId,t.outputChunk);break}case`approvalRequested`:{let e=t.sessionId,n=r.approvalsBySession[e]??[];n.some(e=>e.approvalId===t.approval.approvalId)||(r.approvalsBySession[e]=[...n,t.approval]);let i=t.approval.display;i?.kind===`plan_review`&&typeof i.plan==`string`&&i.plan.length>0&&(r.planReviewByToolCallId={...r.planReviewByToolCallId,[t.approval.toolCallId]:{plan:i.plan,path:typeof i.path==`string`?i.path:void 0}});break}case`approvalResolved`:case`approvalExpired`:{let e=t.sessionId,n=t.approvalId,i=r.approvalsBySession[e]??[];r.approvalsBySession[e]=i.filter(e=>e.approvalId!==n);break}case`questionRequested`:{let e=t.sessionId,n=r.questionsBySession[e]??[];n.some(e=>e.questionId===t.question.questionId)||(r.questionsBySession[e]=[...n,t.question]);break}case`questionAnswered`:case`questionDismissed`:{let e=t.sessionId,n=t.questionId,i=r.questionsBySession[e]??[];r.questionsBySession[e]=i.filter(e=>e.questionId!==n);break}case`taskCreated`:{let e=t.sessionId,n=r.tasksBySession[e]??[],i=n.findIndex(e=>e.id===t.task.id);if(i===-1)r.tasksBySession[e]=[...n,t.task];else{let a=[...n],o=n[i],s=o.kind===`subagent`&&(o.status===`completed`||o.status===`failed`||o.status===`cancelled`)&&t.task.kind===`subagent`&&t.task.status===`running`&&t.task.subagentPhase===`queued`,c=!s&&o.completedAt!==void 0&&o.completedAtEstimated!==!0&&t.task.completedAtEstimated===!0;a[i]={...t.task,outputLines:s?t.task.outputLines:o.outputLines,text:s?t.task.text:o.text,completedAt:c?o.completedAt:t.task.completedAt,completedAtEstimated:c?o.completedAtEstimated:t.task.completedAtEstimated,description:t.task.description===S8&&o.description!==S8?o.description:t.task.description,dynamicWorkflowIndex:t.task.dynamicWorkflowIndex??o.dynamicWorkflowIndex,parentToolCallId:t.task.parentToolCallId??o.parentToolCallId,subagentType:t.task.subagentType??o.subagentType,runInBackground:t.task.runInBackground??o.runInBackground,backgroundTaskId:t.task.backgroundTaskId??o.backgroundTaskId},r.tasksBySession[e]=a}break}case`taskProgress`:{let e=t.sessionId,n=r.tasksBySession[e]??[];r.tasksBySession[e]=n.map(e=>{if(e.id!==t.taskId)return e;if(e.kind===`subagent`&&t.kind===`text`)return{...e,text:(e.text??``)+t.outputChunk};let n=e.outputLines??[];if(n.at(-1)===t.outputChunk)return e;let r=[...n,t.outputChunk];return{...e,outputLines:e.kind===`subagent`?r:r.slice(-40)}});break}case`taskCompleted`:{let e=t.sessionId,n=r.tasksBySession[e]??[];r.tasksBySession[e]=n.map(e=>{if(e.id!==t.taskId&&e.backgroundTaskId!==t.taskId)return e;let n=e.status===`completed`||e.status===`failed`||e.status===`cancelled`;return{...e,status:n?e.status:t.status,completedAt:e.completedAt??new Date().toISOString(),completedAtEstimated:e.completedAt===void 0?!0:e.completedAtEstimated,outputPreview:t.outputPreview??e.outputPreview,outputBytes:t.outputBytes??e.outputBytes}});break}case`goalUpdated`:{let e=t.sessionId;r.goalVersionBySession[e]=(r.goalVersionBySession[e]??0)+1,t.goal===null||t.goal.status===`complete`?delete r.goalBySession[e]:r.goalBySession[e]=t.goal;break}case`configChanged`:r.config=t.config;break;case`modelCatalogChanged`:break;case`agentDelta`:case`agentTurnEnded`:case`expertTalkChanged`:break;case`promptCompleted`:case`promptAborted`:break;case`turnActiveChanged`:r.sessions=r.sessions.map(e=>e.id===t.sessionId?{...e,mainTurnActive:t.active}:e),t.active?r.turnActiveBySession[t.sessionId]=!0:delete r.turnActiveBySession[t.sessionId];break;case`unknown`:{let e=t.raw;if(!(e&&e._noop===!0))if(e&&e._agentError)r.warnings=[...r.warnings,Vge(e)];else if(e&&e._agentWarning){let t=e.message??e.code??`agent warning`;r.warnings=[...r.warnings,`${Jx.global.t(`warnings.noteLabel`)}: ${t}`]}else{let t=e?.type??`(unknown)`;r.warnings=[...r.warnings,`Unhandled event: ${t}`]}break}case`workspaceCreated`:case`workspaceUpdated`:case`workspaceDeleted`:break;default:break}return r}function Uge(e){return e===`in_progress`?`in_progress`:e===`done`||e===`completed`?`done`:`pending`}function Wge(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`assistant`)for(let e=n.content.length-1;e>=0;e--){let t=n.content[e];if(t.type!==`toolUse`||Qx(t.toolName)!==`todo`)continue;let r=t.input;if(typeof r==`string`)try{r=JSON.parse(r)}catch{continue}let i=r?.todos;if(Array.isArray(i))return i.flatMap(e=>{let t=e??{},n=typeof t.title==`string`?t.title:typeof t.content==`string`?t.content:``;return n?[{title:n,status:Uge(t.status)}]:[]})}}return[]}var Gge=[`queued`,`working`,`suspended`,`completed`,`failed`,`cancelled`];function D8(e){return e.status===`completed`?`completed`:e.status===`failed`?`failed`:e.status===`cancelled`?`cancelled`:e.subagentPhase?e.subagentPhase:`working`}function Kge(){return{queued:0,working:0,suspended:0,completed:0,failed:0,cancelled:0}}function qge(e){let t=new Map;for(let n of e){if(n.kind!==`subagent`||n.dynamicWorkflowIndex===void 0)continue;let e=n.parentToolCallId??`dynamic-workflow`,r=t.get(e)??[];r.push({id:n.id,name:n.description,subagentType:n.subagentType,model:n.model,thinkingEffort:n.thinkingEffort,routing:n.routing,currentRoutingEnvRevision:n.currentRoutingEnvRevision,startedAt:n.startedAt,completedAt:n.completedAt,phase:D8(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,dynamicWorkflowIndex:n.dynamicWorkflowIndex}),t.set(e,r)}return[...t.entries()].map(([e,t])=>{let n=t.toSorted((e,t)=>e.dynamicWorkflowIndex-t.dynamicWorkflowIndex||e.id.localeCompare(t.id)),r=Kge();for(let e of n)r[e.phase]++;return{id:e,members:n,counts:r}}).filter(e=>e.members.length>1).toSorted((e,t)=>{let n=e.members.at(0)?.dynamicWorkflowIndex??0,r=t.members.at(0)?.dynamicWorkflowIndex??0;return n===r?e.id.localeCompare(t.id):n-r})}function Jge(e){let t=0,n=0;for(let r of e){n+=r.members.length;for(let e of Gge)(e===`completed`||e===`failed`||e===`cancelled`)&&(t+=r.counts[e])}return{done:t,total:n}}function Yge(e){let t=new Map;for(let n of e){if(n.kind!==`subagent`||!n.parentToolCallId)continue;let e=t.get(n.parentToolCallId)??[];e.push({id:n.id,name:n.description,subagentType:n.subagentType,model:n.model,thinkingEffort:n.thinkingEffort,routing:n.routing,currentRoutingEnvRevision:n.currentRoutingEnvRevision,startedAt:n.startedAt,completedAt:n.completedAt,phase:D8(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,dynamicWorkflowIndex:n.dynamicWorkflowIndex??2**53-1}),t.set(n.parentToolCallId,e)}for(let[e,n]of t)t.set(e,n.toSorted((e,t)=>e.dynamicWorkflowIndex-t.dynamicWorkflowIndex||e.id.localeCompare(t.id)));return t}var O8=A6(),k8=nhe(),A8=uhe(),j8=new Map,M8=qi.activeWorkspace,N8=qi.planMode,P8=qi.planArmed,F8=qi.dynamicWorkflowMode,I8=qi.goalMode,L8=40401,R8=qi.onboarded;Zi(qi.codeFont),Zi(qi.theme),Zi(qi.permission);function z8(e){let t=Yi(e);if(!t)return{};try{let e=JSON.parse(t);if(!e||typeof e!=`object`||Array.isArray(e))return{};let n={};for(let[t,r]of Object.entries(e))r===!0&&(n[t]=!0);return n}catch{return{}}}function B8(e,t){try{let n={};for(let[e,r]of Object.entries(t))r&&(n[e]=!0);Xi(e,JSON.stringify(n))}catch{}}function V8(){B8(N8,$.planModeBySession)}function Xge(){B8(P8,$.planArmedBySession)}function H8(){B8(F8,$.dynamicWorkflowModeBySession)}function U8(){B8(I8,$.goalModeBySession)}function Zge(){try{return Yi(M8)}catch{return null}}var W8=qi.hiddenWorkspaces;function Qge(){try{let e=Yi(W8);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function $ge(e){try{Xi(W8,JSON.stringify(e))}catch{}}function e_e(e){try{Xi(M8,e)}catch{}}function t_e(e,t){if(t&&e.startsWith(t)){let n=e.slice(t.length);return n?`~${n}`:`~`}let n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??``}`:e}var $=N({...kge(),connected:!1,serverVersion:``,dangerousBypassAuth:!1,backend:`v1`,experimentalFlagStates:[],subagentModelPolicy:null,subagentModelPolicySaving:!1,workspaceName:`pythinker-web`,connection:`disconnected`,permission:`manual`,permissionBySession:{},thinking:void 0,thinkingBySession:{},planModeBySession:z8(N8),planArmedBySession:z8(P8),dynamicWorkflowModeBySession:z8(F8),towerModeBySession:{},goalModeBySession:z8(I8),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},inFlightBySession:{},unreadBySession:ea(),authReady:!1,defaultModel:null,workspaces:[],activeWorkspaceId:Zge(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:Qge(),availableOpenInApps:[],serverCapabilities:{},config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1}),G8=N({planMode:!1,dynamicWorkflowMode:!1,goalMode:!1,towerMode:!1});function n_e(){if($.activeSessionId)return;let e=$.config?.defaultPermissionMode;(e===`auto`||e===`yolo`||e===`manual`)&&($.permission=e)}var r_e=new Set([`providers`,`models`,`default_model`,`defaultModel`]);function i_e(e){return e.length===0||e.some(e=>r_e.has(e))}function K8(e,t){return e===t||e.length===t.length&&e.every((e,n)=>e===t[n])}function q8(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}function J8(e){K8($.sessions,e)||($.sessions=e)}function Y8(e,t){$.sessions=$.sessions.map(n=>n.id===e?t(n):n)}function a_e(e){$.sessions=[e,...$.sessions.filter(t=>t.id!==e.id)]}function o_e(e){$.sessions=[...$.sessions,e]}function s_e(e){$.sessions=$.sessions.filter(t=>t.id!==e)}function X8(){let e=$.activeSessionId;e&&$.unreadBySession[e]&&typeof document<`u`&&document.visibilityState===`visible`&&($.unreadBySession={...$.unreadBySession,[e]:!1},ta({[e]:!1}))}typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===qi.unread&&($.unreadBySession=ea(),X8())});function Z8(){if(_5===null||!_5.health().stale)return;Bx(`ws:stale-reconnect`,{sessionId:$.activeSessionId,status:`stale`}),zx(`ws: stale socket on focus, reconnecting`,{activeSessionId:$.activeSessionId}),_5.reconnect();let e=$.activeSessionId;e&&I5.request(e)}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&(X8(),Z8())}),typeof window<`u`&&(window.addEventListener(`focus`,Z8),window.addEventListener(`online`,Z8));function Q8(e){$.activeSessionId=e}function c_e(e){q8($.messagesBySession,e)||($.messagesBySession=e)}function l_e(e,t){$.messagesBySession={...$.messagesBySession,[e]:t}}function $8(e,t){$.messagesBySession={...$.messagesBySession,[e]:t($.messagesBySession[e]??[])}}function u_e(e){let{[e]:t,...n}=$.messagesBySession;$.messagesBySession=n}function e5(e){_5?.unsubscribe(e),I_e(e),S5.discard(({meta:t})=>t.sessionId===e),s_e(e),u_e(e),delete $.approvalsBySession[e],delete $.questionsBySession[e],delete $.tasksBySession[e],delete $.goalBySession[e],delete $.gitStatusBySession[e],delete $.lastSeqBySession[e],delete $.compactionBySession[e],delete $.messagesLoadingMoreBySession[e],delete $.messagesHasMoreBySession[e],delete $.messagesLoadMoreErrorBySession[e],delete w5[e],T5.delete(e),E5.delete(e),D5.delete(e),Ahe(e),delete $.queuedBySession[e],delete $.promptIdBySession[e],delete $.inFlightBySession[e],delete $.turnActiveBySession[e],delete $.planModeBySession[e],delete $.planArmedBySession[e],delete $.dynamicWorkflowModeBySession[e],delete $.towerModeBySession[e],delete $.goalModeBySession[e],delete $.thinkingBySession[e],V8(),Xge(),H8(),U8()}var t5=R(null),n5=R([]),r5=R(!1),i5=R(!1),a5=R(null),o5=R(`auth`),s5=R(0);async function c5(e){let t;try{t=await Q().getSessionStatus(e)}catch{return}Y8(e,e=>({...e,model:t.model||e.model,usage:{...e.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),$.dynamicWorkflowModeBySession={...$.dynamicWorkflowModeBySession,[e]:t.dynamicWorkflowMode},$.planModeBySession={...$.planModeBySession,[e]:t.planMode},(t.permission===`auto`||t.permission===`yolo`||t.permission===`manual`)&&($.permissionBySession={...$.permissionBySession,[e]:t.permission},$.activeSessionId===e&&($.permission=t.permission)),t.thinkingEffort.length>0&&($.thinkingBySession={...$.thinkingBySession,[e]:t.thinkingEffort})}async function d_e(e){let t=$.goalVersionBySession[e]??0,n;try{n=await Q().getSessionGoal(e)}catch{return}if(($.goalVersionBySession[e]??0)!==t)return;let r={...$.goalBySession};n===null||n.status===`complete`?delete r[e]:r[e]=n,$.goalBySession=r}function l5(e,t){let n=t??$.activeSessionId;return n?Promise.resolve(Q().updateSession(n,e)).then(()=>!0,e=>(N5(`persistSessionProfile`,e,{sessionId:n}),!1)).finally(()=>{c5(n)}):Promise.resolve(!1)}var u5=qi.conversationToc;function f_e(){try{let e=Yi(u5);return e===null?!0:e===`true`}catch{return!0}}function p_e(e){try{Xi(u5,e?`true`:`false`)}catch{}}var d5=R(f_e());function m_e(e){d5.value=e,p_e(e)}function f5(e){try{return Yi(e)!==`false`}catch{return!0}}function p5(e,t){try{Xi(e,t?`true`:`false`)}catch{}}var m5=R(f5(qi.turnFolding));function h_e(e){m5.value=e,p5(qi.turnFolding,e)}var h5=R(f5(qi.activityRunFolding));function g_e(e){h5.value=e,p5(qi.activityRunFolding,e)}function __e(e){try{return Yi(e)??``}catch{return``}}var g5=R(__e(R8)===`1`);function v_e(e){g5.value=e;try{Xi(R8,e?`1`:`0`)}catch{}}var _5=null,v5=R(null),y5=Dge({api:Q(),connectEventsIfNeeded:C5,getEventConnection:()=>_5}),b5=0;function x5(){return b5+=1,`msg_opt_${Date.now().toString(36)}_${b5}`}function y_e(e,t,n){if(e.type===`assistantDelta`){let r=$.messagesBySession[e.sessionId]??[];if(r.at(-1)?.id===e.messageId){zge(r,e);let i=$.lastSeqBySession[t]??0;n>0&&n>i&&($.lastSeqBySession={...$.lastSeqBySession,[t]:n});return}}let r={sessions:$.sessions,activeSessionId:$.activeSessionId,messagesBySession:$.messagesBySession,approvalsBySession:$.approvalsBySession,planReviewByToolCallId:$.planReviewByToolCallId,questionsBySession:$.questionsBySession,tasksBySession:$.tasksBySession,goalBySession:$.goalBySession,goalVersionBySession:$.goalVersionBySession,lastSeqBySession:$.lastSeqBySession,turnActiveBySession:$.turnActiveBySession,compactionBySession:$.compactionBySession,config:$.config,warnings:$.warnings},i=e.type===`sessionDeleted`&&$.activeSessionId===e.sessionId,a=Hge(r,e,{sessionId:t,seq:n});J8(a.sessions),Q8(a.activeSessionId),e.type===`sessionDeleted`&&(v5.value=e.sessionId,T7.cleanupDeletedSession(e.sessionId,i)),c_e(a.messagesBySession),q8($.approvalsBySession,a.approvalsBySession)||($.approvalsBySession=a.approvalsBySession),q8($.planReviewByToolCallId,a.planReviewByToolCallId)||($.planReviewByToolCallId=a.planReviewByToolCallId),q8($.questionsBySession,a.questionsBySession)||($.questionsBySession=a.questionsBySession),q8($.tasksBySession,a.tasksBySession)||($.tasksBySession=a.tasksBySession),q8($.goalBySession,a.goalBySession)||($.goalBySession=a.goalBySession),q8($.goalVersionBySession,a.goalVersionBySession)||($.goalVersionBySession=a.goalVersionBySession),q8($.lastSeqBySession,a.lastSeqBySession)||($.lastSeqBySession=a.lastSeqBySession),q8($.turnActiveBySession,a.turnActiveBySession)||($.turnActiveBySession=a.turnActiveBySession),q8($.compactionBySession,a.compactionBySession)||($.compactionBySession=a.compactionBySession);let o=a.config??null;$.config!==o&&($.config=o),K8($.warnings,a.warnings)||($.warnings=a.warnings),e.type===`configChanged`&&($.defaultModel=e.config.defaultModel??null,T7.checkAuth(),i_e(e.changedFields)&&(l7.loadModels(),l7.loadProviders())),e.type===`modelCatalogChanged`&&(l7.loadModels(),l7.loadProviders()),e.type===`sessionUsageUpdated`&&(e.dynamicWorkflowMode!==void 0&&($.dynamicWorkflowModeBySession={...$.dynamicWorkflowModeBySession,[e.sessionId]:e.dynamicWorkflowMode}),e.planMode!==void 0&&($.planModeBySession={...$.planModeBySession,[e.sessionId]:e.planMode}),e.thinking!==void 0&&($.thinkingBySession={...$.thinkingBySession,[e.sessionId]:e.thinking}))}function b_e(e,t){if(e.type===`expertTalkChanged`){w7.applyStatus(e.sessionId,e.status,t.seq);return}let n=$.lastSeqBySession[t.sessionId]??0,r=$.turnActiveBySession[t.sessionId]??!1;y_e(e,t.sessionId,t.seq);let i=Q5.sideChatTargetBySession.value[t.sessionId];if(i){let{agentId:n}=i,r=t.sessionId;e.type===`agentDelta`&&e.agentId===n?e.delta.text&&Q5.appendSideChatAssistantText(n,r,e.delta.text):e.type===`agentTurnEnded`&&e.agentId===n?Q5.finishSideChatAgent(n,r):e.type===`taskProgress`&&e.taskId===n?Q5.appendSideChatAssistantText(n,r,e.outputChunk):e.type===`taskCompleted`&&e.taskId===n&&Q5.finishSideChatAgent(n,r,e.outputPreview)}if(e.type===`messageCreated`&&e.message.role===`user`&&e.message.promptId!==void 0){let t=e.message.sessionId;$.promptIdBySession[t]!==e.message.promptId&&($.promptIdBySession={...$.promptIdBySession,[t]:e.message.promptId})}if(e.type===`assistantDelta`&&t.sessionId===$.activeSessionId&&O8.recordMoonDelta((e.delta.text?.length??0)+(e.delta.thinking?.length??0)),e.type===`turnActiveChanged`&&!e.active&&t.seq>n){let t=e.reason;mye(e.sessionId,t===`cancelled`||t===`failed`||t===`blocked`?`aborted`:`idle`,r)}e.type===`sessionWorkChanged`&&(e.mainTurnActive===!1&&r||e.mainTurnActive===void 0&&!e.busy)&&t.seq>n&&pye(e.sessionId),(e.type===`promptAborted`||e.type===`promptCompleted`&&e.reason===`blocked`)&&t.seq>n&&$.promptIdBySession[e.sessionId]===e.promptId&&T7.finishPromptLocal(e.sessionId),e.type===`questionRequested`&&hye(e.sessionId,e.question),e.type===`approvalRequested`&&gye(e.sessionId,e.approval)}var S5=Sme(({appEvent:e,meta:t})=>b_e(e,t),({appEvent:e})=>vme(e),{coalesce:wme});function C5(){_5===null&&(typeof WebSocket>`u`||(Bx(`ws:connection`,{status:`connecting`}),$.connection=`connecting`,_5=Q().connectEvents({onEvent(e,t){if(e.type===`workspaceCreated`||e.type===`workspaceUpdated`||e.type===`workspaceDeleted`){T7.applyWorkspaceEvent(e);return}for(let n of Cme({appEvent:e,meta:t}))S5(n)},onResync(e,t,n){Bx(`ws:resync`,{sessionId:e,status:`required`,seq:t}),S5.flush(),T5.add(e),I5.request(e)},onError(e,t,n){Bx(`ws:error`,{status:`failed`,errorCode:e,fatal:n}),M5({severity:`error`,title:Jx.global.t(`warnings.wsTitle`),message:t,details:[O5(`message`,t)].filter(e=>e!==void 0)})},onConnectionChange(e){Bx(`ws:connection`,{status:e?`connected`:`disconnected`}),$.connected=e,$.connection=e?`connected`:`disconnected`,e&&(O_e(),T7.refreshServerMeta())},onTranscriptReset(e,t,n,r){y5.receiveReset(e,t,n,r)},onTranscriptOps(e,t,n,r){return y5.applyOps(e,t,n,r)}})))}var w5={},T5=new Set,E5=new Set,D5=new Set;function x_e(e){return QC(e)&&e.code===L8?!0:typeof e==`object`&&!!e&&e.code===L8}function O5(e,t){if(!(t==null||t===``))return{label:Jx.global.t(`warnings.details.${e}`),value:k5(t)}}function k5(e){if(e instanceof Error)return typeof e.stack==`string`&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function S_e(e){return e instanceof Error||typeof e==`object`&&e&&typeof e.name==`string`?e.name:void 0}function C_e(e){return e instanceof Error||typeof e==`object`&&e&&typeof e.message==`string`?e.message:void 0}function w_e(e){return e instanceof Error&&typeof e.stack==`string`&&e.stack?e.stack:void 0}function T_e(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return new Date(e).toISOString()}function A5(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return`${Math.round(e)}ms`}function E_e(e,t,n){let r=$C(t),i=QC(t),a=r||i?t.timestamp:void 0,o=r||i?t.durationMs:void 0,s=[O5(`operation`,e),O5(`sessionId`,n??$.activeSessionId),O5(`connection`,$.connection),O5(`timestamp`,T_e(a??Date.now()))];return r?s.push(O5(`duration`,A5(o)),O5(`request`,`${t.method} ${t.path}`),O5(`endpoint`,t.url),O5(`requestId`,t.requestId),O5(`phase`,t.phase),O5(`timeout`,`${t.timeoutMs}ms`),O5(`status`,t.status===void 0?void 0:`${t.status} ${t.statusText??``}`.trim()),O5(`contentType`,t.contentType),O5(`responsePreview`,t.bodyPreview),O5(`cause`,t.cause)):i?s.push(O5(`duration`,A5(o)),O5(`code`,t.code),O5(`requestId`,t.requestId),O5(`message`,t.message),O5(`details`,t.details)):s.push(O5(`errorName`,S_e(t)),O5(`message`,C_e(t)??k5(t)),O5(`stack`,w_e(t))),s.filter(e=>e!==void 0)}function D_e(e,t,n={}){let r=$C(t),i=QC(t);return{severity:`error`,title:n.title??(r?Jx.global.t(`warnings.daemonNetworkTitle`):i?Jx.global.t(`warnings.daemonApiTitle`):Jx.global.t(`warnings.operationFailedTitle`)),message:n.message??(r?Jx.global.t(`warnings.daemonNetworkMessage`):i?t.message:Jx.global.t(`warnings.operationFailedMessage`)),details:E_e(e,t,n.sessionId)}}var j5=5;function M5(e){let t=$.warnings;if(typeof e==`object`&&e){let n=t.findIndex(t=>typeof t==`object`&&!!t&&t.severity===e.severity&&t.title===e.title&&t.message===e.message);if(n!==-1){let e=t[n];if(e!==void 0&&typeof e==`object`){let r=[...t];r[n]={...e,count:(e.count??1)+1},$.warnings=r;return}}}let n=[...t,e];$.warnings=n.length>j5?n.slice(n.length-j5):n}function O_e(){let e=Jx.global.t(`warnings.wsTitle`),t=$.warnings.filter(t=>!(typeof t==`object`&&t&&t.severity===`error`&&t.title===e));t.length!==$.warnings.length&&($.warnings=t)}function N5(e,t,n){console.error(`[pythinker-web] operation failed: ${e}`,t);let r=QC(t),i=$C(t);Bx(`operation:failed`,{sessionId:n?.sessionId,status:`failed`,operation:e,errorName:t instanceof Error?t.name:typeof t,errorCode:r?t.code:void 0,requestId:r||i?t.requestId:void 0,phase:i?t.phase:void 0,httpStatus:i?t.status:void 0}),M5(D_e(e,t,n))}var k_e={40913:`warnings.goal.alreadyExists`,40914:`warnings.goal.notFound`,40915:`warnings.goal.statusInvalid`,40916:`warnings.goal.notResumable`,40918:`warnings.goal.objectiveTooLong`};function A_e(e){if(!QC(e))return;let t=k_e[e.code];return t?Jx.global.t(t):void 0}async function j_e(e){if(e5(e),$.activeSessionId!==e)return;let t=$.sessions[0];t?await T7.selectSession(t.id,{urlMode:`replace`}):(Q8(void 0),$.sessionLoading=!1,T7.writeSessionUrl(void 0,`replace`))}var P5=new Set;async function M_e(e){if(!P5.has(e)){P5.add(e);try{let t=await Q().getSessionWarnings(e),n=Jx.global.t(`warnings.noteLabel`);for(let e of t)M5(`${n}: ${e.message}`)}catch{}}}async function F5(e){let t=T7.localTurnStartState(e);try{let n=await Q().getSessionSnapshot(e);if(!$.sessions.some(t=>t.id===e))return`ok`;S5.flush();let r=$.lastSeqBySession[e]??0,i=w5[e];if(!(T5.has(e)||R5.has(e))&&i!==void 0&&i===n.epoch&&r>n.asOfSeq)return E5.delete(e)?`ok`:(E5.add(e),I5.request(e),`ok`);if(!T7.isLocalTurnSnapshotCurrent(e,t))return T7.afterLocalTurnStartsSettle(e,()=>{I5.request(e)}),`ok`;let a=_S(n.session.usage);Y8(e,e=>({...n.session,model:n.session.model&&n.session.model.length>0?n.session.model:e.model,usage:a?e.usage:n.session.usage})),l_e(e,pme($.messagesBySession[e]??[],n.messages)),$.tasksBySession={...$.tasksBySession,[e]:hme(n.subagents,$.tasksBySession[e]??[])},$.messagesHasMoreBySession={...$.messagesHasMoreBySession,[e]:n.hasMoreMessages},$.approvalsBySession={...$.approvalsBySession,[e]:n.pendingApprovals};for(let e of n.pendingApprovals){let t=e.display;t?.kind===`plan_review`&&typeof t.plan==`string`&&t.plan.length>0&&($.planReviewByToolCallId={...$.planReviewByToolCallId,[e.toolCallId]:{plan:t.plan,path:typeof t.path==`string`?t.path:void 0}})}$.questionsBySession={...$.questionsBySession,[e]:n.pendingQuestions},$.lastSeqBySession={...$.lastSeqBySession,[e]:n.asOfSeq},w5[e]=n.epoch,T5.delete(e),E5.delete(e),T7.handleSessionSnapshot(e,{inFlightTurn:n.inFlightTurn,busy:n.session.busy});{let t={...$.turnActiveBySession};n.session.mainTurnActive??(n.inFlightTurn!==null&&n.session.busy)?t[e]=!0:delete t[e],$.turnActiveBySession=t}return C5(),_5&&(_5.seedSnapshot(e,n),_5.subscribe(e,{seq:n.asOfSeq,epoch:n.epoch}),F_e(e)),R5.delete(e),a&&c5(e),M_e(e),`ok`}catch(t){return x_e(t)?(await j_e(e),`not-found`):(N5(`getSessionSnapshot`,t,{title:Jx.global.t(`warnings.sessionSnapshotTitle`),message:Jx.global.t(`warnings.sessionSnapshotMessage`),sessionId:e}),`failed`)}}var I5=gme(F5);function N_e(e){return Object.prototype.hasOwnProperty.call($.messagesBySession,e)}var P_e=4,L5=[],R5=new Set;function F_e(e){let t=L5.indexOf(e);for(t!==-1&&L5.splice(t,1),L5.unshift(e);L5.length>P_e;){let e=-1;for(let t=L5.length-1;t>=0;t--)if(L5[t]!==$.activeSessionId){e=t;break}if(e===-1)break;let[t]=L5.splice(e,1);if(t===void 0)break;_5?.unsubscribe(t),R5.add(t)}}function I_e(e){let t=L5.indexOf(e);t!==-1&&L5.splice(t,1),R5.delete(e)}async function L_e(e){return F5(e)}function z5(e,t){return($.inFlightBySession[e]??!1)||($.turnActiveBySession[e]??!1)||(t??$.sessions.find(t=>t.id===e)?.mainTurnActive??!1)}function B5(e){try{let t=new Date(e),n=Date.now()-t.getTime(),r=n/36e5;if(n<6e4)return Jx.global.t(`sessions.justNow`);if(r<1)return`${Math.round(n/6e4)}m`;if(r<24)return`${Math.round(r)}h`;let i=n/864e5;return i<7?`${Math.round(i)}d`:i<30?`${Math.round(i/7)}w`:i<365?`${Math.round(i/30)}mo`:`${Math.round(i/365)}y`}catch{return e}}var R_e=3e4,V5=R(0),H5=null;function z_e(){H5===null&&(H5=setInterval(()=>{V5.value=(V5.value+1)%(2**53-1)},R_e),H5.unref?.())}function B_e(e,t){let n=e.split(` +`+n.thinking,t.durationMs=n.durationMs):e.blocks.push({kind:`thinking`,thinking:n.thinking,startedAt:n.startedAt,durationMs:n.durationMs})}}else if(n.type===`toolUse`){let t=s.get(n.toolCallId),r={id:n.toolCallId,name:n.toolName,arg:typeof n.input==`string`?n.input:JSON.stringify(n.input),status:`running`,output:n.outputLines,planPath:n.toolName===`ExitPlanMode`?i[n.toolCallId]?.path:void 0};e.tools.push(r),e.blocks.push({kind:`tool`,tool:r}),t&&(e.approval=hge(t),e.approvalId=t.approvalId)}else if(n.type===`toolResult`){let t=e.tools.findIndex(e=>e.id===n.toolCallId);if(t!==-1){let r=e.tools[t],i={...r,status:n.isError?`error`:`ok`,output:fge(n.output),media:n.isError?void 0:dge(r.name,n.output)};i.name===`ExitPlanMode`&&!i.planPath&&(i.planPath=wge(i.output)),e.tools[t]=i;let a=e.blocks.find(e=>e.kind===`tool`&&e.tool.id===n.toolCallId);a&&a.kind===`tool`&&(a.tool=i)}}}function d(e,t){for(let n of t){if(n.type!==`toolUse`||!n.outputLines?.length)continue;let t=e.tools.findIndex(e=>e.id===n.toolCallId);if(t===-1)continue;let r=e.tools[t];if(r.output!==void 0)continue;let i={...r,output:n.outputLines};e.tools[t]=i;let a=e.blocks.find(e=>e.kind===`tool`&&e.tool.id===n.toolCallId);a&&a.kind===`tool`&&(a.tool=i)}}function f(e){if(e.type===`image`||e.type===`video`){let t=e.type,r=e.source;if(r.kind===`url`)return{url:r.url,kind:t};if(r.kind===`base64`)return{url:`data:${r.mediaType};base64,${r.data}`,kind:t};if(r.kind===`file`&&n)return{url:n(r.fileId),kind:t,fileId:r.fileId}}if(e.type===`file`&&n){if(e.mediaType.startsWith(`image/`))return{url:n(e.fileId),kind:`image`,fileId:e.fileId};if(e.mediaType.startsWith(`video/`))return{url:n(e.fileId),kind:`video`,fileId:e.fileId}}}for(let t of e){if(t.role===`system`)continue;if(_8(t)){l();let e=t.metadata?.[Vp];a.push({id:t.id,role:`compaction`,no:o,text:t.content.filter(e=>e.type===`text`).map(e=>e.text).join(` +`),compaction:{trigger:e?.trigger,tokensBefore:e?.tokensBefore,tokensAfter:e?.tokensAfter}});continue}if(t.role===`user`){let e=vge(t);if(e!==void 0){l(),a.push(xge(t,o++,e));continue}let r=t.metadata?.origin?.kind;if(r===`task`||r===`background_task`||r===`task_notification`){let e=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(` +`),n=ece(t.metadata),r=n?[n]:j4(e);if(r.length>0){c??={id:t.id,promptId:void 0,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,foldedSigs:[]};for(let e of r)c.blocks.push({kind:`notification`,notification:{...e,createdAt:t.createdAt}})}continue}if(l(),!Sge(t))continue;let i=t.metadata?.origin,s=i?.kind===`skill_activation`&&i?.trigger===`user-slash`,u=i?.kind===`plugin_command`&&i?.trigger===`user-slash`,d=[],p=[];for(let e of t.content){if(e.type===`text`)if(s)d.push(i.skillArgs??``);else if(u)d.push(i.commandArgs??``);else{let t=rge(e.text);if(t&&(t.kind===`video`||t.kind===`image`)&&n){let e=age(t.path);if(e){p.push({url:n(e),kind:t.kind,fileId:e});continue}}let r=sge(e.text);if(r){p.push({kind:`file`,url:r.fileId&&n?n(r.fileId):``,fileId:r.fileId,name:r.name,mediaType:r.mediaType,size:r.size});continue}let i=tge(e.text);if(i!==e.text&&i.trim().length===0)continue;d.push(i)}let t=f(e);if(t){p.push({url:t.url,kind:t.kind,name:e.type===`file`?e.name:void 0,fileId:t.fileId});continue}e.type===`file`&&n&&p.push({kind:`file`,url:n(e.fileId),fileId:e.fileId,name:e.name,mediaType:e.mediaType||void 0,size:e.size})}a.push({id:t.id,promptId:t.promptId,role:`user`,no:o++,text:d.join(` +`),attachments:p.length>0?p:void 0,skillActivation:s?{name:i.skillName,args:i.skillArgs}:void 0,pluginCommand:u?{pluginId:i.pluginId,commandName:i.commandName,args:i.commandArgs}:void 0,createdAt:t.createdAt});continue}if(t.role===`tool`){c&&u(c,t.content);continue}let e=t.promptId;Cge(c,e)?c!==null&&c.promptId===void 0&&e!==void 0&&(c.promptId=e):(l(),c={id:t.id,promptId:e,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,foldedSigs:[],durationMs:t.durationMs});let r=c;if(r===null)continue;let i=Tge(t.content);if(r.promptId!==void 0&&r.foldedSigs.some(e=>Ege(e,i))){d(r,t.content);continue}r.foldedSigs.push(i),u(r,t.content)}return l(!0),a}function Dge(e){if(_8(e))return!0;if(e.role!==`user`)return!1;let t=e.metadata?.origin?.kind;return t!==`task`&&t!==`background_task`&&t!==`task_notification`}function Oge(e){for(let t=e.length-1;t>=0;--t)if(Dge(e[t]))return t;return 0}function kge(){let e;return(t,n,r,i=!0,a=g8)=>{let o=t.at(-1),s=e!==void 0&&(e.approvals===n||e.approvals.length===0&&n.length===0)&&e.getFileUrl===r&&e.sessionActive===i&&e.planReviewByToolCallId===a;if(e!==void 0&&s&&e.messages===t&&e.messageCount===t.length){if(e.lastMessage===o)return e.turns;if(o?.role===`assistant`&&!_8(o)&&e.lastMessage?.role===`assistant`&&e.lastMessage.id===o.id){let s=v8(t.slice(e.boundaryIndex),n,r,i,a),c=e.prefixTurns.filter(e=>e.role!==`compaction`).length,l=s.map(e=>({...e,no:e.no+c})),u=e.tailTurns;if(l.length===u.length&&l.every((e,t)=>e.id===u[t]?.id&&e.role===u[t]?.role)){for(let e=0;e{let t=e.activeSessionId;if(!t)return null;let n=s.value[t];return n?{parentId:t,agentId:n.agentId}:null}),l=L(()=>c.value?.parentId??null),u=L(()=>c.value!==null),d=L(()=>{let t=c.value;return t?!!e.sideChatSendingByAgent[t.agentId]:!1}),f=L(()=>{let t=c.value;return t?e.sideChatSendingByAgent[t.agentId]?!0:(e.tasksBySession[t.parentId]??[]).some(e=>e.id===t.agentId&&e.status===`running`):!1}),p=L(()=>{let t=c.value;return t?v8(e.sideChatMessagesByAgent[t.agentId]??[],[],e=>Q().getFileUrl(e),f.value):[]});function m(t,n){e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[t]:n(e.sideChatMessagesByAgent[t]??[])}}function h(e,t){m(e,e=>[...e,t])}function g(e){m(e,e=>{let t=[...e].reverse().findIndex(e=>e.role===`user`);if(t===-1)return e;let n=e.length-1-t;return e.filter((e,t)=>t!==n)})}function _(e,t){m(e,e=>{let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r.role===`user`)return n[e]={...r,promptId:r.promptId??t},n}return e})}function v(e,t,n){n&&m(e,e=>{let i=e.at(-1);if(i?.role===`assistant`){let t=i.content[0],r=t?.type===`text`?t.text:``;return[...e.slice(0,-1),{...i,content:[{type:`text`,text:`${r}${n}`}]}]}return[...e,{id:r(),sessionId:t,role:`assistant`,content:[{type:`text`,text:n}],createdAt:new Date().toISOString()}]})}function y(t,n,r){if(e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[t]:!1},!r)return;let i=(e.sideChatMessagesByAgent[t]??[]).at(-1);(i?.role===`assistant`&&i.content[0]?.type===`text`?i.content[0].text:``).trim().length>0||v(t,n,r)}async function b(t){let n=e.activeSessionId;n&&await x(n,t)}async function x(t,r){if(!s.value[t]){let r;try{({agentId:r}=await Q().startBtw(t))}catch(e){n(`openSideChat`,e,{sessionId:t});return}e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[r]:e.sideChatMessagesByAgent[r]??[]},s.value={...s.value,[t]:{agentId:r}},i(),a()?.markSideChannelAgent(r)}r&&r.trim()&&await S(t,r.trim())}async function S(t,i){let a=s.value[t],c=i.trim();if(!a||!c)return;let l=t,u=a.agentId;e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[u]:!0},h(u,{id:r(),sessionId:l,role:`user`,content:[{type:`text`,text:c}],createdAt:new Date().toISOString(),metadata:{"pythinkerWeb.optimisticUserMessage":!0}});try{let t=e.sessions.find(e=>e.id===l),n=(t?.model&&t.model.length>0?t.model:e.defaultModel)??void 0,r=await Q().submitPrompt(l,{content:[{type:`text`,text:c}],agentId:u,model:n,thinking:await o(l,n)??e.thinking,permissionMode:e.permissionBySession[l]??e.permission,planMode:e.planModeBySession[l]??!1,dynamicWorkflowMode:e.dynamicWorkflowModeBySession[l]??!1});_(u,r.promptId),e.sideChatUserMessageIdsBySession={...e.sideChatUserMessageIdsBySession,[l]:[...e.sideChatUserMessageIdsBySession[l]??[],r.userMessageId]}}catch(t){n(`sendSideChatPrompt`,t,{sessionId:l}),g(u),e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[u]:!1}}}function C(){let t=e.activeSessionId;if(!t)return;let{[t]:n,...r}=s.value;s.value=r}async function w(e){let t=c.value;t&&await S(t.parentId,e)}function T(e){if(!s.value[e])return;let{[e]:t,...n}=s.value;s.value=n}return{sideChatTargetBySession:s,sideChatSessionId:l,sideChatVisible:u,sideChatSending:d,sideChatRunning:f,sideChatTurns:p,appendSideChatAssistantText:v,finishSideChatAgent:y,openSideChat:b,openSideChatOn:x,closeSideChat:C,sendSideChatPrompt:w,clearSideChatForSession:T}}function jge(){let e=Qi(qi.discussionPair);if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.fusionLeadModelId!=`string`||t.fusionLeadModelId.length===0||typeof t.peerModelId!=`string`||t.peerModelId.length===0||t.fusionLeadModelId===t.peerModelId||t.fusionLeadThinkingEffort!==void 0&&typeof t.fusionLeadThinkingEffort!=`string`||t.peerThinkingEffort!==void 0&&typeof t.peerThinkingEffort!=`string`))return e}function Mge(e,t,n){let r=R({}),i=R({}),a=R(jge()),o=R(!1),c=R(),l=new Map,u=new Map,d=new Map,f=L(()=>r.value[e.value]),p=L(()=>{let e=f.value,t=e?.activeRunId??e?.latestRunId;return t===void 0?void 0:i.value[t]}),m=L(()=>Object.values(i.value).filter(t=>t.sessionId===e.value).toSorted((e,t)=>e.turnId-t.turnId||e.createdAt.localeCompare(t.createdAt))),h=L(()=>t.value&&f.value?.feature===`enabled`);function g(e,t){r.value={...r.value,[e]:t},a.value===void 0&&t.config!==null&&_(t.config);let n=t.activeRunId??t.latestRunId;n!==void 0&&x(e,n)}function _(e){a.value={...e},$i(qi.discussionPair,a.value)}function v(e){let t=(l.get(e)??0)+1;return l.set(e,t),t}function y(e,t){d.set(e,t.resourceVersion),g(e,t)}function b(e){let t=i.value[e.runId];t!==void 0&&t.revision>e.revision||t!==void 0&&t.revision===e.revision&&(t.progressRevision??0)>(e.progressRevision??0)||(i.value={...i.value,[e.runId]:e})}async function x(e,t){try{b(await Q().getExpertTalkRun(e,t))}catch(t){c.value=t instanceof Error?t.message:String(t),n(`expertTalkRefreshRun`,t,{sessionId:e})}}async function S(n=e.value){if(!t.value||n.length===0)return;let r=v(n);try{let[e,t]=await Promise.all([Q().getExpertTalkStatus(n),Q().listExpertTalkRuns(n)]);if(l.get(n)!==r)return;d.delete(n),g(n,e);for(let e of t.runs)b(e)}catch(e){c.value=e instanceof Error?e.message:String(e)}}async function C(t,r){let i=e.value;if(!(i.length===0||o.value)){v(i),o.value=!0,c.value=void 0;try{await r(i)}catch(e){c.value=e instanceof Error?e.message:String(e),n(t,e,{sessionId:i})}finally{o.value=!1}}}async function w(e,t){if(t.fusionLeadModelId===t.peerModelId)throw Error(`Select two different models`);let n=r.value[e]??await Q().getExpertTalkStatus(e);return n.config?.fusionLeadModelId!==t.fusionLeadModelId||n.config.peerModelId!==t.peerModelId||n.config.fusionLeadThinkingEffort!==t.fusionLeadThinkingEffort||n.config.peerThinkingEffort!==t.peerThinkingEffort?(n=await Q().configureExpertTalk(e,t,n.resourceVersion),y(e,n),n):(g(e,n),n)}async function T(t){if(t.fusionLeadModelId===t.peerModelId)throw Error(`Select two different models`);if(e.value.length===0){c.value=void 0,_(t);return}await C(`expertTalkConfigure`,async e=>{_((await w(e,t)).config??t)})}async function E(e){await C(`expertTalkArm`,async t=>{let n=await w(t,e);_(n.config??e),y(t,await Q().armExpertTalk(t,n.resourceVersion))})}async function D(){await C(`expertTalkDisarm`,async e=>{let t=r.value[e]?.activation.armId;y(e,await Q().disarmExpertTalk(e,t))})}async function O(){await C(`expertTalkClear`,async e=>{let t=r.value[e];y(e,await Q().clearExpertTalk(e,t?.resourceVersion))})}async function k(){await C(`expertTalkCancel`,async e=>{let t=r.value[e]?.activeRunId;t!==void 0&&(b(await Q().cancelExpertTalkRun(e,t)),await S(e))})}async function A(){await C(`expertTalkRetry`,async e=>{let t=r.value[e]?.latestRunId;t!==void 0&&(b(await Q().retryExpertTalkRun(e,t)),await S(e))})}function j(e,t,n){if(n!==void 0){let t=u.get(e)??0;if(nt&&u.set(e,n)}let r=d.get(e);r!==void 0&&t.resourceVersion!==r||(r===t.resourceVersion&&d.delete(e),g(e,t))}function M(e){let t=r.value[e];return t?.activation.state===`armed`?t.activation.armId:void 0}function N(e,t){let n=r.value[e];n!==void 0&&g(e,{...n,activation:{state:`idle`},activeRunId:t,latestRunId:t}),S(e)}return s([e,t],([e,t])=>{t&&e.length>0&&S(e)},{immediate:!0}),{available:h,preferredPair:a,status:f,run:p,runs:m,busy:o,error:c,refresh:S,configurePair:T,useForNextMessage:E,disarm:D,clear:O,cancel:k,retry:A,applyStatus:j,armIdForSession:M,promptAccepted:N}}var y8=20,Nge=class{sessionId;agentId;fetchPage;onChange;onGap;transcript;refreshPromise=null;buffered=[];agentsValue=[];seqValue;loadingOlderValue=!1;loadOlderErrorValue=!1;refreshErrorValue=!1;constructor(e,t,n,r,i){this.sessionId=e,this.agentId=t,this.fetchPage=n,this.onChange=r,this.onGap=i,this.transcript=new wm(t)}get snapshot(){return this.transcript.snapshot()}get agents(){return this.agentsValue}get seq(){return this.seqValue}get loading(){return this.refreshPromise!==null}get loadingOlder(){return this.loadingOlderValue}get loadOlderError(){return this.loadOlderErrorValue}get refreshError(){return this.refreshErrorValue}refresh(){if(this.refreshPromise!==null)return this.refreshPromise;this.refreshErrorValue=!1;let e=this.fetchPage({pageSize:y8}).then(e=>this.applyPage(e,!0)).catch(e=>{throw this.refreshErrorValue=!0,e}).finally(()=>{this.refreshPromise=null,this.flushBuffered(),this.onChange()});return this.refreshPromise=e,this.onChange(),e}receiveReset(e,t){this.transcript.receive([{op:`reset`,agentId:this.agentId,snapshot:e}]),t!==void 0&&(this.seqValue=t),this.refreshErrorValue=!1,this.onChange()}applyOps(e,t){if(this.refreshPromise!==null||this.loadingOlderValue)return this.buffered.push({ops:e,seq:t}),!1;if(t!==void 0&&this.seqValue!==void 0){if(t<=this.seqValue)return!0;if(t!==this.seqValue+1)return this.onGap(),!1}let n=this.transcript.apply(e);return t!==void 0&&(this.seqValue=t),n.gap!==void 0&&this.onGap(),n.accepted.length>0&&this.onChange(),n.gap===void 0}async loadOlder(){if(!this.snapshot.hasMoreOlder||this.loadingOlderValue)return;let e=this.snapshot.items.find(e=>e.kind===`turn`);if(e?.kind===`turn`){this.loadingOlderValue=!0,this.loadOlderErrorValue=!1,this.onChange();try{let t=await this.fetchPage({beforeTurn:e.turnId,pageSize:y8});this.applyPage(t,!1)}catch(e){throw this.loadOlderErrorValue=!0,e}finally{this.loadingOlderValue=!1,this.flushBuffered(),this.onChange()}}}applyPage(e,t){this.agentsValue=e.agents;let n=this.snapshot,r=t?e.snapshot:{...e.snapshot,items:Pge(e.snapshot.items,n.items),hasMoreOlder:e.snapshot.hasMoreOlder};this.receiveReset(r,t?e.seq:void 0)}flushBuffered(){let e=this.buffered;this.buffered=[];for(let t of e)this.applyOps(t.ops,t.seq)}};function Pge(e,t){let n=new Set,r=[];for(let i of[...e,...t]){let e=Up(i);n.has(e)||(n.add(e),r.push(i))}return r}function b8(e,t){return`${e}\0${t}`}function Fge(e){let t=new Map,n=new Map,r=new Map;function i(e){e.version.value+=1}function a(t,n,i){let a=e.getEventConnection();a!==null&&(a.subscribeTranscript(t,n,i),r.set(t,n))}function o(n,r){let a=b8(n,r),o=t.get(a);if(o!==void 0)return o;let c;return c={channel:new Nge(n,r,t=>e.api.getSessionTranscript(n,{...t,agentId:r}),()=>i(c),()=>void s(c)),version:ue(0)},t.set(a,c),c}async function s(e){try{await e.channel.refresh(),n.get(e.channel.sessionId)===e.channel.agentId&&a(e.channel.sessionId,e.channel.agentId,e.channel.seq)}catch{n.get(e.channel.sessionId)===e.channel.agentId&&a(e.channel.sessionId,e.channel.agentId)}}function c(t,r){e.connectEventsIfNeeded(),n.set(t,r);let i=o(t,r);return i.channel.snapshot.items.length>0||i.channel.seq!==void 0?a(t,r,i.channel.seq):s(i),i}function l(t,i){if(n.get(t)!==i)return;n.delete(t);let a=r.get(t);a!==void 0&&(e.getEventConnection()?.unsubscribeTranscript(t,[a]),r.delete(t))}return{getEntry(e,n){return t.get(b8(e,n))},activate:c,deactivate:l,receiveReset(e,t,r,i){n.get(e)===t&&o(e,t).channel.receiveReset(r,i)},applyOps(e,t,r,i){return n.get(e)===t?o(e,t).channel.applyOps(r,i):!0},forgetSession(e){let r=n.get(e);r!==void 0&&l(e,r);for(let n of t.keys())n.startsWith(`${e}\0`)&&t.delete(n)}}}var Ige=`pythinkerWeb.optimisticUserMessage`,x8=`Sub Agent`;function Lge(){return{sessions:[],activeSessionId:void 0,messagesBySession:{},approvalsBySession:{},planReviewByToolCallId:{},questionsBySession:{},tasksBySession:{},goalBySession:{},goalVersionBySession:{},lastSeqBySession:{},turnActiveBySession:{},compactionBySession:{},warnings:[]}}function Rge(e){return{...e,sessions:e.sessions,messagesBySession:{...e.messagesBySession},approvalsBySession:{...e.approvalsBySession},planReviewByToolCallId:{...e.planReviewByToolCallId},questionsBySession:{...e.questionsBySession},tasksBySession:{...e.tasksBySession},goalBySession:{...e.goalBySession},goalVersionBySession:{...e.goalVersionBySession},lastSeqBySession:{...e.lastSeqBySession},turnActiveBySession:{...e.turnActiveBySession},compactionBySession:{...e.compactionBySession},warnings:[...e.warnings]}}function zge(e,t,n){t!==void 0&&n!==void 0&&n>0&&n>(e.lastSeqBySession[t]??0)&&(e.lastSeqBySession[t]=n)}function S8(e){return e.role===`user`&&e.metadata?.[Ige]===!0}function Bge(e){let t=e.metadata?.origin;return t?.kind===`cron_job`||t?.kind===`cron_missed`}function Vge(e,t){return JSON.stringify(e.content)===JSON.stringify(t.content)}function Hge(e,t){if(e.role!==`assistant`||t.role!==`assistant`||e.promptId===void 0||e.promptId!==t.promptId)return!1;let n=e=>JSON.stringify(e.content.map(e=>e.type===`thinking`?{type:e.type,thinking:e.thinking}:e.type===`toolUse`?{type:e.type,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input}:e));return n(e)===n(t)}var Uge=/^<(image|video|audio)\s+path="[^"]+"><\/\1>$/;function C8(e){let t=``,n=0;for(let r of e.content)r.type===`text`?Uge.test(r.text.trim())?n+=1:t+=r.text:(r.type===`image`||r.type===`video`||r.type===`file`)&&(n+=1);return{text:t,media:n}}function Wge(e,t){let n=C8(e),r=C8(t);return n.text===r.text&&n.media===r.media}function Gge(e,t){let n=t.promptId;if(n!==void 0)for(let t=e.length-1;t>=0;t--){let r=e[t];if(S8(r)&&r.promptId===n)return t}for(let n=e.length-1;n>=0;n--){let r=e[n];if(S8(r)&&Vge(r,t))return n}for(let n=e.length-1;n>=0;n--){let r=e[n];if(S8(r)&&Wge(r,t))return n}return-1}function Kge(e,t,n){let r=!1,i=e.map(e=>{let i=!1,a=e.content.map(e=>e.type!==`toolUse`||e.toolCallId!==t?e:(i=!0,{...e,outputLines:[...e.outputLines??[],n]}));return i?(r=!0,{...e,content:a}):e});return r?i:e}function w8(e,t,n=e.length){for(let r=0;re.id===t.messageId);return r===-1?!1:(e[r]=T8(e[r],t),!0)}var Jge={"provider.connection_error":`connection`,"provider.auth_error":`auth`,"provider.rate_limit":`rateLimit`,"provider.overloaded":`overloaded`,"provider.filtered":`filtered`,"provider.api_error":`api`,"context.overflow":`contextOverflow`};function Yge(e){let t=fC.global.t,n=[],r=(e,t)=>{typeof t==`number`||typeof t==`boolean`?n.push({label:e,value:String(t)}):typeof t==`string`&&t.length>0&&n.push({label:e,value:t})};r(t(`warnings.details.code`),e.code);let i=e.details??{};r(t(`warnings.details.status`),i.statusCode),r(t(`warnings.details.requestId`),i.requestId),r(t(`warnings.details.errorName`),e.name);for(let[e,t]of Object.entries(i))e===`statusCode`||e===`requestId`||r(e,t);return{severity:`error`,title:t(`warnings.agentError.${(e.code===void 0?void 0:Jge[e.code])??`title`}`),message:e.message,details:n.length>0?n:void 0}}function Xge(e,t,n){let r=Rge(e);switch(zge(r,n.sessionId,n.seq),t.type){case`sessionCreated`:r.sessions.some(e=>e.id===t.session.id)||(r.sessions=[t.session,...r.sessions]);break;case`sessionDeleted`:{let e=t.sessionId;r.sessions=r.sessions.filter(t=>t.id!==e),delete r.messagesBySession[e],delete r.tasksBySession[e],delete r.goalBySession[e],delete r.approvalsBySession[e],delete r.questionsBySession[e],delete r.lastSeqBySession[e],delete r.turnActiveBySession[e],r.activeSessionId===e&&(r.activeSessionId=void 0);break}case`sessionArchived`:{let e=t.sessionId;r.sessions=r.sessions.filter(t=>t.id!==e),r.activeSessionId===e&&(r.activeSessionId=void 0);break}case`sessionWorkChanged`:r.sessions=r.sessions.map(e=>e.id===t.sessionId?{...e,busy:t.busy,mainTurnActive:t.mainTurnActive??(t.busy?e.mainTurnActive:!1),pendingInteraction:t.pendingInteraction??e.pendingInteraction,lastTurnReason:t.lastTurnReason}:e),t.mainTurnActive===!0?r.turnActiveBySession[t.sessionId]=!0:(t.mainTurnActive===!1||!t.busy)&&delete r.turnActiveBySession[t.sessionId];break;case`sessionMetaUpdated`:r.sessions=r.sessions.map(e=>e.id===t.sessionId?{...e,title:t.title??e.title,lastPrompt:t.lastPrompt??e.lastPrompt}:e);break;case`sessionUsageUpdated`:r.sessions=r.sessions.map(e=>{if(e.id!==t.sessionId)return e;let n=t.model&&t.model.length>0?t.model:e.model;return{...e,usage:t.usage,model:n}});break;case`historyCompacted`:break;case`compactionStarted`:r.compactionBySession={...r.compactionBySession,[t.sessionId]:{status:`running`,trigger:t.trigger}};break;case`compactionCompleted`:{let e=t.sessionId,i=r.compactionBySession[e],{[e]:a,...o}=r.compactionBySession;if(r.compactionBySession=o,Object.prototype.hasOwnProperty.call(r.messagesBySession,e)){let a=r.messagesBySession[e]??[],o=`compaction_${e}_${n.seq}`;if(!a.some(e=>e.id===o)){let n={trigger:i?.trigger??`auto`,tokensBefore:t.tokensBefore,tokensAfter:t.tokensAfter};r.messagesBySession[e]=[...a,{id:o,sessionId:e,role:`assistant`,content:t.summary?[{type:`text`,text:t.summary}]:[],createdAt:new Date().toISOString(),metadata:{origin:{kind:`compaction_summary`},[Vp]:n}}]}}break}case`compactionCancelled`:{let{[t.sessionId]:e,...n}=r.compactionBySession;r.compactionBySession=n;break}case`messageCreated`:{let e=t.message.sessionId,n=t.message.createdAt;r.sessions=r.sessions.map(t=>t.id===e&&n>t.updatedAt?{...t,updatedAt:n}:t);let i=r.messagesBySession[e]??[];if(!i.some(e=>e.id===t.message.id||Hge(e,t.message))){if(t.message.role===`user`&&!Bge(t.message)){let n=Gge(i,t.message);if(n!==-1){let a=[...i],o=a[n];a[n]={...t.message,id:o.id,promptId:t.message.promptId??o.promptId,metadata:{...t.message.metadata,...o.metadata}},r.messagesBySession[e]=a;break}}r.messagesBySession[e]=[...i,t.message]}break}case`messageUpdated`:{let e=t.sessionId,n=r.messagesBySession[e]??[];r.messagesBySession[e]=n.map(e=>{if(e.id!==t.messageId)return e;let n=t.content.map((t,n)=>{let r=e.content[n];return t.type===`thinking`&&r?.type===`thinking`?{...t,startedAt:r.startedAt,durationMs:r.durationMs}:t}),r=Date.now();return w8(n,r,n.length-1),(t.status!==`pending`||t.durationMs!==void 0)&&w8(n,r),{...e,content:n,durationMs:t.durationMs??e.durationMs}});break}case`assistantDelta`:{let e=t.sessionId,n=r.messagesBySession[e]??[],i=n.findIndex(e=>e.id===t.messageId);i!==-1&&(r.messagesBySession[e]=n.with(i,T8(n[i],t)));break}case`toolOutput`:{let e=t.sessionId,n=r.messagesBySession[e]??[];r.messagesBySession[e]=Kge(n,t.toolCallId,t.outputChunk);break}case`approvalRequested`:{let e=t.sessionId,n=r.approvalsBySession[e]??[];n.some(e=>e.approvalId===t.approval.approvalId)||(r.approvalsBySession[e]=[...n,t.approval]);let i=t.approval.display;i?.kind===`plan_review`&&typeof i.plan==`string`&&i.plan.length>0&&(r.planReviewByToolCallId={...r.planReviewByToolCallId,[t.approval.toolCallId]:{plan:i.plan,path:typeof i.path==`string`?i.path:void 0}});break}case`approvalResolved`:case`approvalExpired`:{let e=t.sessionId,n=t.approvalId,i=r.approvalsBySession[e]??[];r.approvalsBySession[e]=i.filter(e=>e.approvalId!==n);break}case`questionRequested`:{let e=t.sessionId,n=r.questionsBySession[e]??[];n.some(e=>e.questionId===t.question.questionId)||(r.questionsBySession[e]=[...n,t.question]);break}case`questionAnswered`:case`questionDismissed`:{let e=t.sessionId,n=t.questionId,i=r.questionsBySession[e]??[];r.questionsBySession[e]=i.filter(e=>e.questionId!==n);break}case`taskCreated`:{let e=t.sessionId,n=r.tasksBySession[e]??[],i=n.findIndex(e=>e.id===t.task.id);if(i===-1)r.tasksBySession[e]=[...n,t.task];else{let a=[...n],o=n[i],s=o.kind===`subagent`&&(o.status===`completed`||o.status===`failed`||o.status===`cancelled`)&&t.task.kind===`subagent`&&t.task.status===`running`&&t.task.subagentPhase===`queued`,c=!s&&o.completedAt!==void 0&&o.completedAtEstimated!==!0&&t.task.completedAtEstimated===!0;a[i]={...t.task,outputLines:s?t.task.outputLines:o.outputLines,text:s?t.task.text:o.text,completedAt:c?o.completedAt:t.task.completedAt,completedAtEstimated:c?o.completedAtEstimated:t.task.completedAtEstimated,description:t.task.description===x8&&o.description!==x8?o.description:t.task.description,dynamicWorkflowIndex:t.task.dynamicWorkflowIndex??o.dynamicWorkflowIndex,parentToolCallId:t.task.parentToolCallId??o.parentToolCallId,subagentType:t.task.subagentType??o.subagentType,runInBackground:t.task.runInBackground??o.runInBackground,backgroundTaskId:t.task.backgroundTaskId??o.backgroundTaskId},r.tasksBySession[e]=a}break}case`taskProgress`:{let e=t.sessionId,n=r.tasksBySession[e]??[];r.tasksBySession[e]=n.map(e=>{if(e.id!==t.taskId)return e;if(e.kind===`subagent`&&t.kind===`text`)return{...e,text:(e.text??``)+t.outputChunk};let n=e.outputLines??[];if(n.at(-1)===t.outputChunk)return e;let r=[...n,t.outputChunk];return{...e,outputLines:e.kind===`subagent`?r:r.slice(-40)}});break}case`taskCompleted`:{let e=t.sessionId,n=r.tasksBySession[e]??[];r.tasksBySession[e]=n.map(e=>{if(e.id!==t.taskId&&e.backgroundTaskId!==t.taskId)return e;let n=e.status===`completed`||e.status===`failed`||e.status===`cancelled`;return{...e,status:n?e.status:t.status,completedAt:e.completedAt??new Date().toISOString(),completedAtEstimated:e.completedAt===void 0?!0:e.completedAtEstimated,outputPreview:t.outputPreview??e.outputPreview,outputBytes:t.outputBytes??e.outputBytes}});break}case`goalUpdated`:{let e=t.sessionId;r.goalVersionBySession[e]=(r.goalVersionBySession[e]??0)+1,t.goal===null||t.goal.status===`complete`?delete r.goalBySession[e]:r.goalBySession[e]=t.goal;break}case`configChanged`:r.config=t.config;break;case`modelCatalogChanged`:break;case`agentDelta`:case`agentTurnEnded`:case`expertTalkChanged`:break;case`promptCompleted`:case`promptAborted`:break;case`turnActiveChanged`:r.sessions=r.sessions.map(e=>e.id===t.sessionId?{...e,mainTurnActive:t.active}:e),t.active?r.turnActiveBySession[t.sessionId]=!0:delete r.turnActiveBySession[t.sessionId];break;case`unknown`:{let e=t.raw;if(!(e&&e._noop===!0))if(e&&e._agentError)r.warnings=[...r.warnings,Yge(e)];else if(e&&e._agentWarning){let t=e.message??e.code??`agent warning`;r.warnings=[...r.warnings,`${fC.global.t(`warnings.noteLabel`)}: ${t}`]}else{let t=e?.type??`(unknown)`;r.warnings=[...r.warnings,`Unhandled event: ${t}`]}break}case`workspaceCreated`:case`workspaceUpdated`:case`workspaceDeleted`:break;default:break}return r}function Zge(e){return e===`in_progress`?`in_progress`:e===`done`||e===`completed`?`done`:`pending`}function Qge(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`assistant`)for(let e=n.content.length-1;e>=0;e--){let t=n.content[e];if(t.type!==`toolUse`||gC(t.toolName)!==`todo`)continue;let r=t.input;if(typeof r==`string`)try{r=JSON.parse(r)}catch{continue}let i=r?.todos;if(Array.isArray(i))return i.flatMap(e=>{let t=e??{},n=typeof t.title==`string`?t.title:typeof t.content==`string`?t.content:``;return n?[{title:n,status:Zge(t.status)}]:[]})}}return[]}var $ge=[`queued`,`working`,`suspended`,`completed`,`failed`,`cancelled`];function E8(e){return e.status===`completed`?`completed`:e.status===`failed`?`failed`:e.status===`cancelled`?`cancelled`:e.subagentPhase?e.subagentPhase:`working`}function e_e(){return{queued:0,working:0,suspended:0,completed:0,failed:0,cancelled:0}}function t_e(e){let t=new Map;for(let n of e){if(n.kind!==`subagent`||n.dynamicWorkflowIndex===void 0)continue;let e=n.parentToolCallId??`dynamic-workflow`,r=t.get(e)??[];r.push({id:n.id,name:n.description,subagentType:n.subagentType,model:n.model,thinkingEffort:n.thinkingEffort,routing:n.routing,currentRoutingEnvRevision:n.currentRoutingEnvRevision,startedAt:n.startedAt,completedAt:n.completedAt,phase:E8(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,dynamicWorkflowIndex:n.dynamicWorkflowIndex}),t.set(e,r)}return[...t.entries()].map(([e,t])=>{let n=t.toSorted((e,t)=>e.dynamicWorkflowIndex-t.dynamicWorkflowIndex||e.id.localeCompare(t.id)),r=e_e();for(let e of n)r[e.phase]++;return{id:e,members:n,counts:r}}).filter(e=>e.members.length>1).toSorted((e,t)=>{let n=e.members.at(0)?.dynamicWorkflowIndex??0,r=t.members.at(0)?.dynamicWorkflowIndex??0;return n===r?e.id.localeCompare(t.id):n-r})}function n_e(e){let t=0,n=0;for(let r of e){n+=r.members.length;for(let e of $ge)(e===`completed`||e===`failed`||e===`cancelled`)&&(t+=r.counts[e])}return{done:t,total:n}}function r_e(e){let t=new Map;for(let n of e){if(n.kind!==`subagent`||!n.parentToolCallId)continue;let e=t.get(n.parentToolCallId)??[];e.push({id:n.id,name:n.description,subagentType:n.subagentType,model:n.model,thinkingEffort:n.thinkingEffort,routing:n.routing,currentRoutingEnvRevision:n.currentRoutingEnvRevision,startedAt:n.startedAt,completedAt:n.completedAt,phase:E8(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,dynamicWorkflowIndex:n.dynamicWorkflowIndex??2**53-1}),t.set(n.parentToolCallId,e)}for(let[e,n]of t)t.set(e,n.toSorted((e,t)=>e.dynamicWorkflowIndex-t.dynamicWorkflowIndex||e.id.localeCompare(t.id)));return t}var D8=k6(),O8=uhe(),k8=vhe(),A8=new Map,j8=qi.activeWorkspace,M8=qi.planMode,N8=qi.planArmed,P8=qi.dynamicWorkflowMode,F8=qi.goalMode,I8=40401,L8=qi.onboarded;Zi(qi.codeFont),Zi(qi.theme),Zi(qi.permission);function R8(e){let t=Yi(e);if(!t)return{};try{let e=JSON.parse(t);if(!e||typeof e!=`object`||Array.isArray(e))return{};let n={};for(let[t,r]of Object.entries(e))r===!0&&(n[t]=!0);return n}catch{return{}}}function z8(e,t){try{let n={};for(let[e,r]of Object.entries(t))r&&(n[e]=!0);Xi(e,JSON.stringify(n))}catch{}}function B8(){z8(M8,$.planModeBySession)}function i_e(){z8(N8,$.planArmedBySession)}function V8(){z8(P8,$.dynamicWorkflowModeBySession)}function H8(){z8(F8,$.goalModeBySession)}function a_e(){try{return Yi(j8)}catch{return null}}var U8=qi.hiddenWorkspaces;function o_e(){try{let e=Yi(U8);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function s_e(e){try{Xi(U8,JSON.stringify(e))}catch{}}function c_e(e){try{Xi(j8,e)}catch{}}function l_e(e,t){if(t&&e.startsWith(t)){let n=e.slice(t.length);return n?`~${n}`:`~`}let n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??``}`:e}var $=N({...Lge(),connected:!1,serverVersion:``,dangerousBypassAuth:!1,backend:`v1`,experimentalFlagStates:[],subagentModelPolicy:null,subagentModelPolicySaving:!1,workspaceName:`pythinker-web`,connection:`disconnected`,permission:`manual`,permissionBySession:{},thinking:void 0,thinkingBySession:{},planModeBySession:R8(M8),planArmedBySession:R8(N8),dynamicWorkflowModeBySession:R8(P8),towerModeBySession:{},goalModeBySession:R8(F8),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},inFlightBySession:{},unreadBySession:ea(),authReady:!1,defaultModel:null,workspaces:[],activeWorkspaceId:a_e(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:o_e(),availableOpenInApps:[],serverCapabilities:{},config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1}),W8=N({planMode:!1,dynamicWorkflowMode:!1,goalMode:!1,towerMode:!1});function u_e(){if($.activeSessionId)return;let e=$.config?.defaultPermissionMode;(e===`auto`||e===`yolo`||e===`manual`)&&($.permission=e)}var d_e=new Set([`providers`,`models`,`default_model`,`defaultModel`]);function f_e(e){return e.length===0||e.some(e=>d_e.has(e))}function G8(e,t){return e===t||e.length===t.length&&e.every((e,n)=>e===t[n])}function K8(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}function q8(e){G8($.sessions,e)||($.sessions=e)}function J8(e,t){$.sessions=$.sessions.map(n=>n.id===e?t(n):n)}function p_e(e){$.sessions=[e,...$.sessions.filter(t=>t.id!==e.id)]}function m_e(e){$.sessions=[...$.sessions,e]}function h_e(e){$.sessions=$.sessions.filter(t=>t.id!==e)}function Y8(){let e=$.activeSessionId;e&&$.unreadBySession[e]&&typeof document<`u`&&document.visibilityState===`visible`&&($.unreadBySession={...$.unreadBySession,[e]:!1},ta({[e]:!1}))}typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===qi.unread&&($.unreadBySession=ea(),Y8())});function X8(){if(g5===null||!g5.health().stale)return;iC(`ws:stale-reconnect`,{sessionId:$.activeSessionId,status:`stale`}),rC(`ws: stale socket on focus, reconnecting`,{activeSessionId:$.activeSessionId}),g5.reconnect();let e=$.activeSessionId;e&&F5.request(e)}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&(Y8(),X8())}),typeof window<`u`&&(window.addEventListener(`focus`,X8),window.addEventListener(`online`,X8));function Z8(e){$.activeSessionId=e}function g_e(e){K8($.messagesBySession,e)||($.messagesBySession=e)}function __e(e,t){$.messagesBySession={...$.messagesBySession,[e]:t}}function Q8(e,t){$.messagesBySession={...$.messagesBySession,[e]:t($.messagesBySession[e]??[])}}function v_e(e){let{[e]:t,...n}=$.messagesBySession;$.messagesBySession=n}function $8(e){g5?.unsubscribe(e),W_e(e),x5.discard(({meta:t})=>t.sessionId===e),h_e(e),v_e(e),delete $.approvalsBySession[e],delete $.questionsBySession[e],delete $.tasksBySession[e],delete $.goalBySession[e],delete $.gitStatusBySession[e],delete $.lastSeqBySession[e],delete $.compactionBySession[e],delete $.messagesLoadingMoreBySession[e],delete $.messagesHasMoreBySession[e],delete $.messagesLoadMoreErrorBySession[e],delete C5[e],w5.delete(e),T5.delete(e),E5.delete(e),Rhe(e),delete $.queuedBySession[e],delete $.promptIdBySession[e],delete $.inFlightBySession[e],delete $.turnActiveBySession[e],delete $.planModeBySession[e],delete $.planArmedBySession[e],delete $.dynamicWorkflowModeBySession[e],delete $.towerModeBySession[e],delete $.goalModeBySession[e],delete $.thinkingBySession[e],B8(),i_e(),V8(),H8()}var e5=R(null),t5=R([]),n5=R(!1),r5=R(!1),i5=R(null),a5=R(`auth`),o5=R(0);async function s5(e){let t;try{t=await Q().getSessionStatus(e)}catch{return}J8(e,e=>({...e,model:t.model||e.model,usage:{...e.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),$.dynamicWorkflowModeBySession={...$.dynamicWorkflowModeBySession,[e]:t.dynamicWorkflowMode},$.planModeBySession={...$.planModeBySession,[e]:t.planMode},(t.permission===`auto`||t.permission===`yolo`||t.permission===`manual`)&&($.permissionBySession={...$.permissionBySession,[e]:t.permission},$.activeSessionId===e&&($.permission=t.permission)),t.thinkingEffort.length>0&&($.thinkingBySession={...$.thinkingBySession,[e]:t.thinkingEffort})}async function y_e(e){let t=$.goalVersionBySession[e]??0,n;try{n=await Q().getSessionGoal(e)}catch{return}if(($.goalVersionBySession[e]??0)!==t)return;let r={...$.goalBySession};n===null||n.status===`complete`?delete r[e]:r[e]=n,$.goalBySession=r}function c5(e,t){let n=t??$.activeSessionId;return n?Promise.resolve(Q().updateSession(n,e)).then(()=>!0,e=>(M5(`persistSessionProfile`,e,{sessionId:n}),!1)).finally(()=>{s5(n)}):Promise.resolve(!1)}var l5=qi.conversationToc;function b_e(){try{let e=Yi(l5);return e===null?!0:e===`true`}catch{return!0}}function x_e(e){try{Xi(l5,e?`true`:`false`)}catch{}}var u5=R(b_e());function S_e(e){u5.value=e,x_e(e)}function d5(e){try{return Yi(e)!==`false`}catch{return!0}}function f5(e,t){try{Xi(e,t?`true`:`false`)}catch{}}var p5=R(d5(qi.turnFolding));function C_e(e){p5.value=e,f5(qi.turnFolding,e)}var m5=R(d5(qi.activityRunFolding));function w_e(e){m5.value=e,f5(qi.activityRunFolding,e)}function T_e(e){try{return Yi(e)??``}catch{return``}}var h5=R(T_e(L8)===`1`);function E_e(e){h5.value=e;try{Xi(L8,e?`1`:`0`)}catch{}}var g5=null,_5=R(null),v5=Fge({api:Q(),connectEventsIfNeeded:S5,getEventConnection:()=>g5}),y5=0;function b5(){return y5+=1,`msg_opt_${Date.now().toString(36)}_${y5}`}function D_e(e,t,n){if(e.type===`assistantDelta`){let r=$.messagesBySession[e.sessionId]??[];if(r.at(-1)?.id===e.messageId){qge(r,e);let i=$.lastSeqBySession[t]??0;n>0&&n>i&&($.lastSeqBySession={...$.lastSeqBySession,[t]:n});return}}let r={sessions:$.sessions,activeSessionId:$.activeSessionId,messagesBySession:$.messagesBySession,approvalsBySession:$.approvalsBySession,planReviewByToolCallId:$.planReviewByToolCallId,questionsBySession:$.questionsBySession,tasksBySession:$.tasksBySession,goalBySession:$.goalBySession,goalVersionBySession:$.goalVersionBySession,lastSeqBySession:$.lastSeqBySession,turnActiveBySession:$.turnActiveBySession,compactionBySession:$.compactionBySession,config:$.config,warnings:$.warnings},i=e.type===`sessionDeleted`&&$.activeSessionId===e.sessionId,a=Xge(r,e,{sessionId:t,seq:n});q8(a.sessions),Z8(a.activeSessionId),e.type===`sessionDeleted`&&(_5.value=e.sessionId,w7.cleanupDeletedSession(e.sessionId,i)),g_e(a.messagesBySession),K8($.approvalsBySession,a.approvalsBySession)||($.approvalsBySession=a.approvalsBySession),K8($.planReviewByToolCallId,a.planReviewByToolCallId)||($.planReviewByToolCallId=a.planReviewByToolCallId),K8($.questionsBySession,a.questionsBySession)||($.questionsBySession=a.questionsBySession),K8($.tasksBySession,a.tasksBySession)||($.tasksBySession=a.tasksBySession),K8($.goalBySession,a.goalBySession)||($.goalBySession=a.goalBySession),K8($.goalVersionBySession,a.goalVersionBySession)||($.goalVersionBySession=a.goalVersionBySession),K8($.lastSeqBySession,a.lastSeqBySession)||($.lastSeqBySession=a.lastSeqBySession),K8($.turnActiveBySession,a.turnActiveBySession)||($.turnActiveBySession=a.turnActiveBySession),K8($.compactionBySession,a.compactionBySession)||($.compactionBySession=a.compactionBySession);let o=a.config??null;$.config!==o&&($.config=o),G8($.warnings,a.warnings)||($.warnings=a.warnings),e.type===`configChanged`&&($.defaultModel=e.config.defaultModel??null,w7.checkAuth(),f_e(e.changedFields)&&(c7.loadModels(),c7.loadProviders())),e.type===`modelCatalogChanged`&&(c7.loadModels(),c7.loadProviders()),e.type===`sessionUsageUpdated`&&(e.dynamicWorkflowMode!==void 0&&($.dynamicWorkflowModeBySession={...$.dynamicWorkflowModeBySession,[e.sessionId]:e.dynamicWorkflowMode}),e.planMode!==void 0&&($.planModeBySession={...$.planModeBySession,[e.sessionId]:e.planMode}),e.thinking!==void 0&&($.thinkingBySession={...$.thinkingBySession,[e.sessionId]:e.thinking}))}function O_e(e,t){if(e.type===`expertTalkChanged`){C7.applyStatus(e.sessionId,e.status,t.seq);return}let n=$.lastSeqBySession[t.sessionId]??0,r=$.turnActiveBySession[t.sessionId]??!1;D_e(e,t.sessionId,t.seq);let i=Z5.sideChatTargetBySession.value[t.sessionId];if(i){let{agentId:n}=i,r=t.sessionId;e.type===`agentDelta`&&e.agentId===n?e.delta.text&&Z5.appendSideChatAssistantText(n,r,e.delta.text):e.type===`agentTurnEnded`&&e.agentId===n?Z5.finishSideChatAgent(n,r):e.type===`taskProgress`&&e.taskId===n?Z5.appendSideChatAssistantText(n,r,e.outputChunk):e.type===`taskCompleted`&&e.taskId===n&&Z5.finishSideChatAgent(n,r,e.outputPreview)}if(e.type===`messageCreated`&&e.message.role===`user`&&e.message.promptId!==void 0){let t=e.message.sessionId;$.promptIdBySession[t]!==e.message.promptId&&($.promptIdBySession={...$.promptIdBySession,[t]:e.message.promptId})}if(e.type===`assistantDelta`&&t.sessionId===$.activeSessionId&&D8.recordMoonDelta((e.delta.text?.length??0)+(e.delta.thinking?.length??0)),e.type===`turnActiveChanged`&&!e.active&&t.seq>n){let t=e.reason;Sye(e.sessionId,t===`cancelled`||t===`failed`||t===`blocked`?`aborted`:`idle`,r)}e.type===`sessionWorkChanged`&&(e.mainTurnActive===!1&&r||e.mainTurnActive===void 0&&!e.busy)&&t.seq>n&&xye(e.sessionId),(e.type===`promptAborted`||e.type===`promptCompleted`&&e.reason===`blocked`)&&t.seq>n&&$.promptIdBySession[e.sessionId]===e.promptId&&w7.finishPromptLocal(e.sessionId),e.type===`questionRequested`&&Cye(e.sessionId,e.question),e.type===`approvalRequested`&&wye(e.sessionId,e.approval)}var x5=Ame(({appEvent:e,meta:t})=>O_e(e,t),({appEvent:e})=>Eme(e),{coalesce:Mme});function S5(){g5===null&&(typeof WebSocket>`u`||(iC(`ws:connection`,{status:`connecting`}),$.connection=`connecting`,g5=Q().connectEvents({onEvent(e,t){if(e.type===`workspaceCreated`||e.type===`workspaceUpdated`||e.type===`workspaceDeleted`){w7.applyWorkspaceEvent(e);return}for(let n of jme({appEvent:e,meta:t}))x5(n)},onResync(e,t,n){iC(`ws:resync`,{sessionId:e,status:`required`,seq:t}),x5.flush(),w5.add(e),F5.request(e)},onError(e,t,n){iC(`ws:error`,{status:`failed`,errorCode:e,fatal:n}),j5({severity:`error`,title:fC.global.t(`warnings.wsTitle`),message:t,details:[D5(`message`,t)].filter(e=>e!==void 0)})},onConnectionChange(e){iC(`ws:connection`,{status:e?`connected`:`disconnected`}),$.connected=e,$.connection=e?`connected`:`disconnected`,e&&(I_e(),w7.refreshServerMeta())},onTranscriptReset(e,t,n,r){v5.receiveReset(e,t,n,r)},onTranscriptOps(e,t,n,r){return v5.applyOps(e,t,n,r)}})))}var C5={},w5=new Set,T5=new Set,E5=new Set;function k_e(e){return gT(e)&&e.code===I8?!0:typeof e==`object`&&!!e&&e.code===I8}function D5(e,t){if(!(t==null||t===``))return{label:fC.global.t(`warnings.details.${e}`),value:O5(t)}}function O5(e){if(e instanceof Error)return typeof e.stack==`string`&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function A_e(e){return e instanceof Error||typeof e==`object`&&e&&typeof e.name==`string`?e.name:void 0}function j_e(e){return e instanceof Error||typeof e==`object`&&e&&typeof e.message==`string`?e.message:void 0}function M_e(e){return e instanceof Error&&typeof e.stack==`string`&&e.stack?e.stack:void 0}function N_e(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return new Date(e).toISOString()}function k5(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return`${Math.round(e)}ms`}function P_e(e,t,n){let r=_T(t),i=gT(t),a=r||i?t.timestamp:void 0,o=r||i?t.durationMs:void 0,s=[D5(`operation`,e),D5(`sessionId`,n??$.activeSessionId),D5(`connection`,$.connection),D5(`timestamp`,N_e(a??Date.now()))];return r?s.push(D5(`duration`,k5(o)),D5(`request`,`${t.method} ${t.path}`),D5(`endpoint`,t.url),D5(`requestId`,t.requestId),D5(`phase`,t.phase),D5(`timeout`,`${t.timeoutMs}ms`),D5(`status`,t.status===void 0?void 0:`${t.status} ${t.statusText??``}`.trim()),D5(`contentType`,t.contentType),D5(`responsePreview`,t.bodyPreview),D5(`cause`,t.cause)):i?s.push(D5(`duration`,k5(o)),D5(`code`,t.code),D5(`requestId`,t.requestId),D5(`message`,t.message),D5(`details`,t.details)):s.push(D5(`errorName`,A_e(t)),D5(`message`,j_e(t)??O5(t)),D5(`stack`,M_e(t))),s.filter(e=>e!==void 0)}function F_e(e,t,n={}){let r=_T(t),i=gT(t);return{severity:`error`,title:n.title??(r?fC.global.t(`warnings.daemonNetworkTitle`):i?fC.global.t(`warnings.daemonApiTitle`):fC.global.t(`warnings.operationFailedTitle`)),message:n.message??(r?fC.global.t(`warnings.daemonNetworkMessage`):i?t.message:fC.global.t(`warnings.operationFailedMessage`)),details:P_e(e,t,n.sessionId)}}var A5=5;function j5(e){let t=$.warnings;if(typeof e==`object`&&e){let n=t.findIndex(t=>typeof t==`object`&&!!t&&t.severity===e.severity&&t.title===e.title&&t.message===e.message);if(n!==-1){let e=t[n];if(e!==void 0&&typeof e==`object`){let r=[...t];r[n]={...e,count:(e.count??1)+1},$.warnings=r;return}}}let n=[...t,e];$.warnings=n.length>A5?n.slice(n.length-A5):n}function I_e(){let e=fC.global.t(`warnings.wsTitle`),t=$.warnings.filter(t=>!(typeof t==`object`&&t&&t.severity===`error`&&t.title===e));t.length!==$.warnings.length&&($.warnings=t)}function M5(e,t,n){console.error(`[pythinker-web] operation failed: ${e}`,t);let r=gT(t),i=_T(t);iC(`operation:failed`,{sessionId:n?.sessionId,status:`failed`,operation:e,errorName:t instanceof Error?t.name:typeof t,errorCode:r?t.code:void 0,requestId:r||i?t.requestId:void 0,phase:i?t.phase:void 0,httpStatus:i?t.status:void 0}),j5(F_e(e,t,n))}var L_e={40913:`warnings.goal.alreadyExists`,40914:`warnings.goal.notFound`,40915:`warnings.goal.statusInvalid`,40916:`warnings.goal.notResumable`,40918:`warnings.goal.objectiveTooLong`};function R_e(e){if(!gT(e))return;let t=L_e[e.code];return t?fC.global.t(t):void 0}async function z_e(e){if($8(e),$.activeSessionId!==e)return;let t=$.sessions[0];t?await w7.selectSession(t.id,{urlMode:`replace`}):(Z8(void 0),$.sessionLoading=!1,w7.writeSessionUrl(void 0,`replace`))}var N5=new Set;async function B_e(e){if(!N5.has(e)){N5.add(e);try{let t=await Q().getSessionWarnings(e),n=fC.global.t(`warnings.noteLabel`);for(let e of t)j5(`${n}: ${e.message}`)}catch{}}}async function P5(e){let t=w7.localTurnStartState(e);try{let n=await Q().getSessionSnapshot(e);if(!$.sessions.some(t=>t.id===e))return`ok`;x5.flush();let r=$.lastSeqBySession[e]??0,i=C5[e];if(!(w5.has(e)||L5.has(e))&&i!==void 0&&i===n.epoch&&r>n.asOfSeq)return T5.delete(e)?`ok`:(T5.add(e),F5.request(e),`ok`);if(!w7.isLocalTurnSnapshotCurrent(e,t))return w7.afterLocalTurnStartsSettle(e,()=>{F5.request(e)}),`ok`;let a=FC(n.session.usage);J8(e,e=>({...n.session,model:n.session.model&&n.session.model.length>0?n.session.model:e.model,usage:a?e.usage:n.session.usage})),__e(e,xme($.messagesBySession[e]??[],n.messages)),$.tasksBySession={...$.tasksBySession,[e]:Cme(n.subagents,$.tasksBySession[e]??[])},$.messagesHasMoreBySession={...$.messagesHasMoreBySession,[e]:n.hasMoreMessages},$.approvalsBySession={...$.approvalsBySession,[e]:n.pendingApprovals};for(let e of n.pendingApprovals){let t=e.display;t?.kind===`plan_review`&&typeof t.plan==`string`&&t.plan.length>0&&($.planReviewByToolCallId={...$.planReviewByToolCallId,[e.toolCallId]:{plan:t.plan,path:typeof t.path==`string`?t.path:void 0}})}$.questionsBySession={...$.questionsBySession,[e]:n.pendingQuestions},$.lastSeqBySession={...$.lastSeqBySession,[e]:n.asOfSeq},C5[e]=n.epoch,w5.delete(e),T5.delete(e),w7.handleSessionSnapshot(e,{inFlightTurn:n.inFlightTurn,busy:n.session.busy});{let t={...$.turnActiveBySession};n.session.mainTurnActive??(n.inFlightTurn!==null&&n.session.busy)?t[e]=!0:delete t[e],$.turnActiveBySession=t}return S5(),g5&&(g5.seedSnapshot(e,n),g5.subscribe(e,{seq:n.asOfSeq,epoch:n.epoch}),U_e(e)),L5.delete(e),a&&s5(e),B_e(e),`ok`}catch(t){return k_e(t)?(await z_e(e),`not-found`):(M5(`getSessionSnapshot`,t,{title:fC.global.t(`warnings.sessionSnapshotTitle`),message:fC.global.t(`warnings.sessionSnapshotMessage`),sessionId:e}),`failed`)}}var F5=wme(P5);function V_e(e){return Object.prototype.hasOwnProperty.call($.messagesBySession,e)}var H_e=4,I5=[],L5=new Set;function U_e(e){let t=I5.indexOf(e);for(t!==-1&&I5.splice(t,1),I5.unshift(e);I5.length>H_e;){let e=-1;for(let t=I5.length-1;t>=0;t--)if(I5[t]!==$.activeSessionId){e=t;break}if(e===-1)break;let[t]=I5.splice(e,1);if(t===void 0)break;g5?.unsubscribe(t),L5.add(t)}}function W_e(e){let t=I5.indexOf(e);t!==-1&&I5.splice(t,1),L5.delete(e)}async function G_e(e){return P5(e)}function R5(e,t){return($.inFlightBySession[e]??!1)||($.turnActiveBySession[e]??!1)||(t??$.sessions.find(t=>t.id===e)?.mainTurnActive??!1)}function z5(e){try{let t=new Date(e),n=Date.now()-t.getTime(),r=n/36e5;if(n<6e4)return fC.global.t(`sessions.justNow`);if(r<1)return`${Math.round(n/6e4)}m`;if(r<24)return`${Math.round(r)}h`;let i=n/864e5;return i<7?`${Math.round(i)}d`:i<30?`${Math.round(i/7)}w`:i<365?`${Math.round(i/30)}mo`:`${Math.round(i/365)}y`}catch{return e}}var K_e=3e4,B5=R(0),V5=null;function q_e(){V5===null&&(V5=setInterval(()=>{B5.value=(B5.value+1)%(2**53-1)},K_e),V5.unref?.())}function J_e(e,t){let n=e.split(` `),r=t.split(` -`),i=[];return n.forEach((e,t)=>{i.push({kind:`rem`,gutter:String(t+1),text:`- ${e}`})}),r.forEach((e,t)=>{i.push({kind:`add`,gutter:String(t+1),text:`+ ${e}`})}),i}function V_e(e){let t=e.display??{},n=typeof t.kind==`string`?t.kind:``;if(n===`diff`){let e=typeof t.path==`string`?t.path:``;return Array.isArray(t.diff)?{kind:`diff`,path:e,diff:t.diff}:typeof t.old_text==`string`&&typeof t.new_text==`string`?{kind:`diff`,path:e,diff:B_e(t.old_text,t.new_text)}:{kind:`diff`,path:e,diff:[]}}if(n===`shell`||n===`command`)return{kind:`shell`,command:typeof t.command==`string`?t.command:e.action,cwd:typeof t.cwd==`string`?t.cwd:void 0,danger:typeof t.danger==`string`?t.danger:void 0};if(n===`file_content`||n===`file`)return{kind:`file`,path:typeof t.path==`string`?t.path:``,content:typeof t.content==`string`?t.content:``,language:typeof t.language==`string`?t.language:void 0};if(n===`file_op`||n===`fileop`)return{kind:`fileop`,op:typeof t.operation==`string`?t.operation:typeof t.op==`string`?t.op:n,path:typeof t.path==`string`?t.path:``,detail:typeof t.detail==`string`?t.detail:void 0};if(n===`url_fetch`||n===`url`){let n=typeof t.url==`string`?t.url:e.action;return{kind:`url`,method:typeof t.method==`string`?t.method:void 0,url:n}}if(n===`search`)return{kind:`search`,query:typeof t.query==`string`?t.query:e.action,scope:typeof t.scope==`string`?t.scope:void 0};if(n===`invocation`||n===`agent_call`||n===`skill_call`)return{kind:`invocation`,kind2:typeof t.kind==`string`?t.kind:n,name:typeof t.name==`string`?t.name:e.toolName,description:typeof t.description==`string`?t.description:void 0};if(n===`todo`||n===`todo_list`)return{kind:`todo`,items:(Array.isArray(t.items)?t.items:[]).map(e=>{let t=e??{};return{title:typeof t.title==`string`?t.title:``,status:typeof t.status==`string`?t.status:`pending`}})};if(n===`plan_review`){let e=typeof t.plan==`string`?t.plan:``,n=typeof t.path==`string`?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(e=>{let t=e??{},n=typeof t.label==`string`?t.label:``;return n?{label:n,description:typeof t.description==`string`?t.description:void 0}:null}).filter(e=>e!==null);return{kind:`plan_review`,plan:e,path:n,options:r.length>0?r:void 0}}return{kind:`generic`,summary:e.action}}function H_e(e){return{questionId:e.questionId,sessionId:e.sessionId,toolCallId:e.toolCallId,questions:e.questions.map(e=>({id:e.id,question:e.question,header:e.header,body:e.body,options:e.options.map(e=>({id:e.id,label:e.label,description:e.description,recommended:e.recommended})),multiSelect:e.multiSelect,allowOther:e.allowOther,otherLabel:e.otherLabel,otherDescription:e.otherDescription}))}}function U_e(e){let t=$.messagesBySession[e.sessionId];if(!t||t.length===0)return;let n=new Map;for(let e of t)if(e.role===`assistant`)for(let t of e.content){if(t.type!==`toolUse`||t.toolName!==`Bash`&&t.toolName!==`bash`)continue;let e=t.input,r=e&&typeof e.command==`string`?e.command:void 0;r&&n.set(t.toolCallId,r)}if(n.size===0)return;let r=`task_id: ${e.id}`;for(let e of t)if(e.role===`tool`){for(let t of e.content)if(t.type===`toolResult`&&(typeof t.output==`string`?t.output:t.output===void 0?``:JSON.stringify(t.output)).includes(r)){let e=n.get(t.toolCallId);if(e)return e}}}function W_e(e){let t;t=e.status===`running`?`run`:e.status===`completed`?`done`:e.status===`cancelled`?`cancelled`:`fail`;let n=``,r;if(e.status===`running`&&e.startedAt){r=Date.now()-new Date(e.startedAt).getTime();let t=Math.round(r/1e3),i=Math.floor(t/60),a=t%60;n=Jx.global.t(`tasks.timingRunning`,{time:`${i}:${String(a).padStart(2,`0`)}`})}else if(e.completedAt&&e.startedAt){r=new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime();let t=Math.round(r/1e3);n=Jx.global.t(`tasks.timingDone`,{sec:t})}else n=e.status;let i=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,a=e.command??U_e(e),o=e.kind===`bash`&&a?`$ ${a}`:void 0;return{id:e.id,agentId:e.agentId,backgroundTaskId:e.backgroundTaskId,name:e.description,kind:e.kind,state:t,timing:n,durationMs:r,meta:o,output:i,subagentType:e.subagentType,phase:e.subagentPhase,model:e.model,thinkingEffort:e.thinkingEffort,dynamicWorkflowIndex:e.dynamicWorkflowIndex,swarmIndex:e.swarmIndex,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId,createdAt:e.createdAt,completedAt:e.completedAt}}var G_e=L(()=>{let e=$.sessions.find(e=>e.id===$.activeSessionId),t=e?e.cwd.split(`/`).pop()??e.cwd:`main`;return{name:$.workspaceName,branch:t}}),K_e=L(()=>(V5.value,$.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:B5(e.updatedAt),busy:z5(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason})))),U5=L(()=>$.activeSessionId??``),q_e=L(()=>{let e=$.activeSessionId;if(e)return l7.skillsBySession.value[e]??[];let t=S7.value;return t?l7.skillsByWorkspace.value[t]??[]:[]}),W5=R({}),G5=R([]),K5=R(!1),q5=R([]),J5=R(!1),Y5=R({}),J_e=L(()=>{let e=$.activeSessionId;return e?Y5.value[e]??{}:{}});async function Y_e(e){W5.value={...W5.value,[e]:!0};try{await l7.loadSkillsForSession(e)}finally{W5.value={...W5.value,[e]:!1}}}async function X_e(){K5.value=!0;try{G5.value=await Q().listConnectors()}catch{G5.value=[]}finally{K5.value=!1}}async function X5(){J5.value=!0;try{q5.value=await Q().listPlugins()}catch{q5.value=[]}finally{J5.value=!1}}async function Z_e(e,t){let n=q5.value.find(t=>t.id===e)?.enabled;q5.value=q5.value.map(n=>n.id===e?{...n,enabled:t}:n);try{await Q().setPluginEnabled(e,t)}catch(t){n!==void 0&&(q5.value=q5.value.map(t=>t.id===e?{...t,enabled:n}:t)),N5(`setPluginEnabled`,t);return}await X5()}async function Q_e(e){await Promise.all([Y_e(e),X_e(),X5()])}async function $_e(e){let t=$.activeSessionId;if(!t)return;let n=Y5.value[t]??{};Y5.value={...Y5.value,[t]:{...n,...e}};try{await Q().updateSession(t,e)}catch(e){throw Y5.value={...Y5.value,[t]:n},N5(`updateCapabilities`,e,{sessionId:t}),e}}var Z5=L(()=>{let e=$.activeSessionId;return e?$.inFlightBySession[e]??!1:!1}),eve=L(()=>T7.isStartingFirstPrompt()),Q5=Sge($,{pushOperationFailure:N5,nextOptimisticMsgId:x5,connectEventsIfNeeded:C5,getEventConn:()=>_5,resolveThinkingForPrompt:(e,t)=>l7.resolveThinkingForPrompt(e,t)}),$5=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=Q5.sideChatTargetBySession.value[e]?.agentId;return($.tasksBySession[e]??[]).filter(e=>e.id!==t)}),e7=hhe($,$5),tve=xge(),nve=e=>Q().getFileUrl(e),rve=[],ive=[],ave=[],t7;function ove(e,t){if(t.length===0)return e;let n=e.at(-1),r=t7;if(r!==void 0&&r.source===e&&r.length===e.length&&r.hiddenIds===t){if(r.last===n)return r.result;let e=r.result.at(-1);if(n!==void 0&&e!==void 0&&r.last?.id===n.id&&e.id===n.id)return r.result[r.result.length-1]=n,r.last=n,r.result}let i=e.filter(e=>!t.includes(e.id));return t7={source:e,length:e.length,hiddenIds:t,last:n,result:i},i}var sve=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=$.sideChatUserMessageIdsBySession[e]??ave;return tve(ove($.messagesBySession[e]??ive,t),$.approvalsBySession[e]??rve,nve,n7.value,$.planReviewByToolCallId)}),n7=L(()=>{let e=$.activeSessionId;return e?($.turnActiveBySession[e]??!1)||($.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),cve=L(()=>Z5.value||n7.value),r7=new Map,lve=L(()=>{e7.taskClock.value;let e=$5.value.filter(e=>e.kind===`subagent`&&e.runInBackground).toSorted((e,t)=>Date.parse(e.createdAt)-Date.parse(t.createdAt)),t=$.activeSessionId??`__draft__`,n=r7.get(t)??{indexes:new Map,next:1};r7.set(t,n);for(let t of e){let e=n.indexes.get(t.id)??(t.backgroundTaskId?n.indexes.get(t.backgroundTaskId):void 0)??n.next++;n.indexes.set(t.id,e),t.backgroundTaskId&&n.indexes.set(t.backgroundTaskId,e)}return $5.value.map(e=>{let t=W_e(e);return e.kind===`subagent`&&e.runInBackground&&(t.dynamicWorkflowIndex=e.dynamicWorkflowIndex??n.indexes.get(e.id)),t})}),uve=L(()=>{let e=$.activeSessionId;if(!e)return{};let t={};for(let n of $.messagesBySession[e]??[])for(let e of n.content){if(e.type!==`toolUse`||e.toolName!==`ExitPlanMode`)continue;let r=e.input&&typeof e.input==`object`?e.input:{},i=$.planReviewByToolCallId[e.toolCallId],a=i?.plan??(typeof r.plan==`string`?r.plan:void 0),o=i?.path??(typeof r.path==`string`?r.path:void 0)??(typeof r.planPath==`string`?r.planPath:void 0);t[e.toolCallId]={agentId:`main`,toolCallId:e.toolCallId,turnId:n.id,source:`interaction`,plan:a,path:o}}return t}),i7=L(()=>qge($5.value)),dve=L(()=>Yge($5.value)),a7=L(()=>{let e=$.activeSessionId;return e?$.goalBySession[e]??null:null}),fve=L(()=>{let e=$.activeSessionId;return e?Wge($.messagesBySession[e]??[]):[]}),pve=L(()=>{let e=$.activeSessionId;return e?$.compactionBySession[e]??null:null}),mve=L(()=>$.connection),hve=L(()=>$.loading),gve=L(()=>$.sessionLoading),_ve=L(()=>{let e=$.activeSessionId;return e?$.messagesLoadingMoreBySession[e]??!1:!1}),vve=L(()=>{let e=$.activeSessionId;return e?$.messagesHasMoreBySession[e]??!1:!1}),yve=L(()=>{let e=$.activeSessionId;return e?$.messagesLoadMoreErrorBySession[e]??!1:!1}),bve=L(()=>$.serverVersion),xve=L(()=>$.backend),Sve=L(()=>$.experimentalFlagStates),Cve=L(()=>$.subagentModelPolicy),wve=L(()=>$.subagentModelPolicySaving);function o7(e){return $.experimentalFlagStates.find(t=>t.id===e)}var Tve=L(()=>$.dangerousBypassAuth);function Eve(){$.dangerousBypassAuth=!1}var Dve=L(()=>$.permission),Ove=L(()=>$.thinking),s7=L(()=>{let e=$.activeSessionId;return e?$.planModeBySession[e]??!1:G8.planMode}),kve=L(()=>{let e=$.activeSessionId;return e?$.planArmedBySession[e]??!1:G8.planMode}),Ave=L(()=>{let e=$.activeSessionId;return e?$.dynamicWorkflowModeBySession[e]??!1:G8.dynamicWorkflowMode}),jve=L(()=>{let e=$.activeSessionId;return e?$.goalModeBySession[e]??!1:G8.goalMode}),Mve=L(()=>{let e=$.activeSessionId;return e?$.towerModeBySession[e]??!1:G8.towerMode}),Nve=L(()=>o7(`tower`)?.enabled===!0),Pve=L(()=>{let e=Jge(i7.value);return{plan:s7.value,goal:a7.value&&a7.value.status!==`complete`?{status:a7.value.status,turnsUsed:a7.value.turnsUsed,elapsedMs:a7.value.wallClockMs}:null,dynamicWorkflow:e.total>0?e:null}}),Fve=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=Q();return($.queuedBySession[e]??[]).map(e=>({id:e.id??e.text,text:e.text,attachmentCount:e.attachments?.length??0,attachments:e.attachments?.map(e=>({fileId:e.fileId,kind:e.kind,url:t.getFileUrl(e.fileId),name:e.name}))}))}),Ive=L(()=>$.warnings),Lve=L(()=>{let e=$.activeSessionId;return e?($.questionsBySession[e]??[]).map(H_e):[]}),Rve=L(()=>{let e=$.activeSessionId;return e?($.approvalsBySession[e]??[]).map(e=>({approvalId:e.approvalId,block:V_e(e),agentName:e.agentName,toolCallId:e.toolCallId})):[]}),c7=L(()=>{let e=$.activeSessionId;return e?($.approvalsBySession[e]??[]).length>0?`awaiting-approval`:($.questionsBySession[e]??[]).length>0?`awaiting-question`:Z5.value||n7.value?`running`:`idle`:`idle`}),l7=Lhe($,{pushOperationFailure:N5,refreshSessionStatus:c5,persistSessionProfile:l5,activity:c7,updateSession:Y8,updateSessionMessages:$8}),u7=L(()=>{let e=$.activeSessionId;if(!e)return null;let t=$.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),zve=L(()=>{let e=$.activeSessionId;return e?$.gitStatusBySession[e]?.pullRequest??null:null}),Bve=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=$.gitStatusBySession[e];return t?Object.entries(t.entries).map(([e,t])=>({path:e,status:t})).toSorted((e,t)=>e.path.localeCompare(t.path)):[]}),Vve=L(()=>{let e=$.activeSessionId;if(!e)return null;let t=$.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),d7=L(()=>{let e=$.sessions.find(e=>e.id===$.activeSessionId),t=u7.value?.branch??(e?e.cwd.split(`/`).pop()??e.cwd:`main`),n=e===void 0?l7.draftModel.value:null,r=(e?.model&&e.model.length>0?e.model:n??$.defaultModel)??`—`,i=l7.models.value.find(e=>e.id===r)??l7.models.value.find(e=>e.model===r);return{model:i?.displayName||i?.model||(r.includes(`/`)?r.split(`/`).pop():r),modelId:i?.id??r,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:e?$.permissionBySession[e.id]??$.permission:$.permission,branch:t,cwd:e?.cwd??``,isGitRepo:u7.value!==null}}),Hve=L(()=>n5.value),Uve=L(()=>$.sessions.find(e=>e.id===$.activeSessionId)?.usage.totalCostUsd??0),f7=L(()=>$.authReady),p7=R(null);s(i5,e=>{e&&p7.value===null&&(p7.value=f7.value)},{immediate:!0});var m7=L(()=>cme(g5.value,p7.value??!1)),Wve=L(()=>sme({initialized:i5.value,onboardingCompleted:m7.value,authReady:f7.value})),Gve=L(()=>$.defaultModel),Kve=L(()=>$.config),qve=L(()=>{let e=$.activeSessionId;if(!e)return{};let t=$.gitStatusBySession[e];return t?{...t.entries}:{}});function h7(e){let t=p6(e.cwd);return $.workspaces.find(e=>p6(e.root)===t)?.id??e.workspaceId??e.cwd}var g7=L(()=>fme({workspaces:$.workspaces,sessions:$.sessions,hiddenWorkspaceRoots:$.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:$.sessionsHasMoreByWorkspace})),_7=R(ia()),v7=R(ca()===`manual`?`manual`:`recent`);function Jve(e){let t=Qi(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}var y7=R(Jve(qi.pinnedSessions)),b7=R(Yi(qi.pinnedCollapsed)===`true`);function Yve(e){y7.value=y7.value.includes(e)?y7.value.filter(t=>t!==e):[...y7.value,e],$i(qi.pinnedSessions,y7.value)}function Xve(e){let t=new Set(y7.value),n=e.filter(e=>t.has(e));y7.value=[...n,...y7.value.filter(e=>!n.includes(e))],$i(qi.pinnedSessions,y7.value)}function Zve(){b7.value=!b7.value,Xi(qi.pinnedCollapsed,String(b7.value))}s(()=>[g7.value.map(e=>e.id).join(`\0`),$.loading],([e,t])=>{if(t)return;let n=ua(e?e.split(`\0`):[],_7.value);n!==null&&(_7.value=n,aa(n))});var x7=L(()=>{let e=g7.value.map(e=>({id:e.id,name:e.name,root:e.root,shortPath:t_e(e.root,$.fsHome),sessionCount:e.sessionCount}));if(v7.value===`recent`){let t=new Map;for(let e of $.sessions){if(e.parentSessionId)continue;let n=h7(e),r=new Date(e.updatedAt).getTime();r>(t.get(n)??-1/0)&&t.set(n,r)}return pa(e,t)}return da(e,_7.value)}),S7=L(()=>{let e=$.activeWorkspaceId,t=x7.value;return e&&t.some(t=>t.id===e)?e:t[0]?.id??null});s(S7,e=>{e&&(Object.prototype.hasOwnProperty.call(l7.skillsByWorkspace.value,e)||l7.loadSkillsForWorkspace(e))},{immediate:!0});var Qve=L(()=>{let e=S7.value;return e?x7.value.find(t=>t.id===e)??null:null}),$ve=L(()=>{V5.value;let e=new Set(x7.value.map(e=>e.id)),t=new Map(x7.value.map(e=>[e.id,e.name]));return $.sessions.filter(t=>!t.parentSessionId&&e.has(h7(t))).map(e=>{let n=h7(e);return{id:e.id,title:e.title,time:B5(e.updatedAt),busy:z5(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason,lastPrompt:e.lastPrompt,workspaceId:n,workspaceName:t.get(n)}})}),eye=L(()=>{V5.value;let e=new Map;for(let t of $.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())){if(t.parentSessionId)continue;let n=h7(t),r={id:t.id,title:t.title,time:B5(t.updatedAt),busy:z5(t.id,t.mainTurnActive),pendingInteraction:t.pendingInteraction,lastTurnReason:t.lastTurnReason,updatedAt:t.updatedAt},i=e.get(n)??[];i.push(r),e.set(n,i)}return x7.value.map(t=>({workspace:t,sessions:e.get(t.id)??[],hasMore:$.sessionsHasMoreByWorkspace[t.id]??!1,loadingMore:$.sessionsLoadingMoreByWorkspace[t.id]??!1,initialCount:$.sessionsInitialCountByWorkspace[t.id]??5}))});function tye(e){_7.value=e,aa(e),v7.value!==`manual`&&(v7.value=`manual`,la(`manual`))}function nye(e){v7.value!==e&&(v7.value=e,la(e))}var C7=L(()=>{let e={};for(let[t,n]of Object.entries($.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(let[t,n]of Object.entries($.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),rye=L(()=>{let e={};for(let[t,n]of Object.entries($.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(let[t,n]of Object.entries($.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),iye=L(()=>{let e={};for(let[t,n]of Object.entries($.unreadBySession))n&&(e[t]=!0);return e}),aye=L(()=>{let e={},t=C7.value;for(let n of $.sessions){let r=t[n.id]??0;if(r<=0)continue;let i=h7(n);e[i]=(e[i]??0)+r}return e}),oye=L(()=>$.recentRoots),sye=L(()=>$.availableOpenInApps),cye=L(()=>$.serverCapabilities.fs_write===!0),w7=wge(U5,L(()=>$.serverCapabilities.expert_talk_v1===!0),N5),T7=Nhe($,{taskPoller:e7,sideChat:Q5,modelProvider:l7,pushOperationFailure:N5,activity:c7,sessionsKnownEmpty:D5,setSessions:J8,updateSession:Y8,upsertSessionFront:a_e,appendSession:o_e,forgetSession:e5,setActiveSessionId:Q8,updateSessionMessages:$8,nextOptimisticMsgId:x5,getEventConn:()=>_5,syncSessionFromSnapshot:F5,reopenSession:L_e,hasLoadedMessages:N_e,refreshSessionStatus:c5,refreshSessionGoal:d_e,persistSessionProfile:l5,mergedWorkspaces:g7,workspacesView:x7,status:d7,workspaceIdForSession:h7,seedPermissionFromDaemonDefault:n_e,savePlanModeToStorage:V8,saveDynamicWorkflowModeToStorage:H8,saveGoalModeToStorage:U8,draftModes:G8,saveUnread:ta,saveActiveWorkspaceToStorage:e_e,saveHiddenWorkspacesToStorage:$ge,goalErrorMessage:A_e,resetFastMoon:O8.resetFastMoon,getExpertTalkArmId:w7.armIdForSession,onExpertTalkPromptAccepted:w7.promptAccepted,initialized:i5,connectIssue:a5,bootStage:o5,bootRetries:s5,selectedDiffPath:t5,fileDiffLines:n5,fileDiffLoading:r5});async function lye(){if(w7.status.value?.activeRunId!==void 0){await w7.cancel();return}await T7.abortCurrentPrompt()}function uye(e,t){let n=j8.get(e);if(n!==void 0)return n;let r=(async()=>{try{return await T7.createDraftSession(e)===null?!1:(await w7.useForNextMessage(t),w7.status.value?.activation.state===`armed`)}catch(e){return N5(`expertOpinionSession`,e),!1}})();return j8.set(e,r),r.finally(()=>{j8.get(e)===r&&j8.delete(e)}),r}async function dye(){await T7.loadConfig(),await Promise.all([T7.checkAuth(),l7.loadModels(),l7.loadProviders()])}function fye(e,t){let n=$.sessions.find(t=>t.id===e);return n?T7.renameSession(e,kp(t,n.title)):Promise.resolve()}function E7(e){return e===$.activeSessionId&&typeof document<`u`&&document.visibilityState===`visible`&&document.hasFocus()}function pye(e){if($.turnActiveBySession[e]){let t={...$.turnActiveBySession};delete t[e],$.turnActiveBySession=t}$.inFlightBySession[e]&&($.inFlightBySession={...$.inFlightBySession,[e]:!1})}function mye(e,t,n){let r=$.promptIdBySession[e];T7.finishPromptLocal(e,{turnWasActive:n}),l7.loadSkillsForSession(e),e===$.activeSessionId?(T7.loadGitStatus(e),c5(e)):t===`idle`&&($.unreadBySession={...$.unreadBySession,[e]:!0},ta({[e]:!0})),Gme(t,($.approvalsBySession[e]??[]).length>0,($.questionsBySession[e]??[]).length>0)&&k8.maybeNotifyCompletion(e,{isUserWatching:E7(e),sessionTitle:$.sessions.find(t=>t.id===e)?.title??``,promptId:r,onClick:()=>{T7.selectSession(e)}}),t===`idle`&&A8.maybePlayCompletionSound()}function hye(e,t){let n=t.questions[0],r=n?.header?.trim()??``,i=n?.question?.trim()??``,a=r&&i?`${r}: ${i}`:i||r;k8.maybeNotifyQuestion({isUserWatching:E7(e),sessionTitle:$.sessions.find(t=>t.id===e)?.title??``,questionPreview:a,questionId:t.questionId,onClick:()=>{T7.selectSession(e)}}),A8.maybePlayQuestionSound()}function gye(e,t){k8.maybeNotifyApproval({isUserWatching:E7(e),sessionTitle:$.sessions.find(t=>t.id===e)?.title??``,toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{T7.selectSession(e)}}),A8.maybePlayApprovalSound()}function D7(){return z_e(),{workspace:G_e,sessions:K_e,activeSessionId:U5,workspacesView:x7,workspaceSortMode:v7,pinnedSessionIds:y7,pinnedCollapsed:b7,visibleWorkspace:Qve,activeWorkspaceId:S7,sessionsForView:$ve,workspaceGroups:eye,attentionBySession:C7,pendingBySession:rye,attentionByWorkspace:aye,unreadBySession:iye,recentRoots:oye,turns:sve,tasks:lve,activeAppTasks:$5,auxiliaryTranscripts:y5,todos:fve,goal:a7,dynamicWorkflows:i7,dynamicWorkflowMembersByToolCallId:dve,activationBadges:Pve,compaction:pve,status:d7,sessionCost:Uve,fileDiff:Hve,selectedDiffPath:t5,fileDiffLoading:r5,changes:Bve,gitInfo:u7,gitDiffStats:Vve,activePullRequest:zve,changesByPath:qve,pendingApprovals:Rve,availableOpenInApps:sye,fsWriteSupported:cye,expertTalk:w7,connection:mve,loading:hve,sessionLoading:gve,loadingMoreMessages:_ve,hasMoreMessages:vve,loadMoreMessagesError:yve,serverVersion:bve,backend:xve,experimentalFlagStates:Sve,experimentalFlagState:o7,subagentModelPolicy:Cve,subagentModelPolicySaving:wve,saveSubagentModelPolicy:T7.saveSubagentModelPolicy,clearSubagentModelPolicy:T7.clearSubagentModelPolicy,reloadSubagentModelPolicy:T7.loadSubagentModelPolicy,dangerousBypassAuth:Tve,clearDangerousBypassAuth:Eve,initialized:i5,connectIssue:a5,bootStage:o5,bootRetries:s5,permission:Dve,thinking:Ove,planMode:s7,planArmed:kve,sessionPlans:uve,dynamicWorkflowMode:Ave,goalMode:jve,towerMode:Mve,towerAvailable:Nve,queued:Fve,warnings:Ive,questions:Lve,activity:c7,turnActive:n7,inFlight:Z5,working:cve,isStartingFirstPrompt:eve,fastMoon:O8.fastMoon,models:l7.models,starredModelIds:l7.starredModelIds,providers:l7.providers,uiFontSize:O8.uiFontSize,setUiFontSize:O8.setUiFontSize,conversationToc:d5,setConversationToc:m_e,turnFolding:m5,setTurnFolding:h_e,activityRunFolding:h5,setActivityRunFolding:g_e,colorScheme:O8.colorScheme,setColorScheme:O8.setColorScheme,accent:O8.accent,setAccent:O8.setAccent,notifyOnComplete:k8.notifyOnComplete,notifyOnQuestion:k8.notifyOnQuestion,notifyOnApproval:k8.notifyOnApproval,notifyPermission:k8.notifyPermission,setNotifyOnComplete:k8.setNotifyOnComplete,setNotifyOnQuestion:k8.setNotifyOnQuestion,setNotifyOnApproval:k8.setNotifyOnApproval,soundOnComplete:A8.soundOnComplete,setSoundOnComplete:A8.setSoundOnComplete,onboarded:g5,setOnboarded:v_e,onboardingCompleted:m7,appState:Wve,load:T7.load,selectSession:T7.selectSession,clearActiveSession:T7.clearActiveSession,loadOlderMessages:T7.loadOlderMessages,loadWorkspaces:T7.loadWorkspaces,loadMoreSessions:T7.loadMoreSessions,loadAllSessions:T7.loadAllSessions,selectWorkspace:T7.selectWorkspace,openWorkspace:T7.openWorkspace,openWorkspaceDraft:T7.openWorkspaceDraft,startExpertOpinionSession:uye,startSessionAndSendPrompt:T7.startSessionAndSendPrompt,startSessionAndActivateSkill:T7.startSessionAndActivateSkill,startSessionAndOpenSideChat:T7.startSessionAndOpenSideChat,addWorkspaceByPath:T7.addWorkspaceByPath,browseFs:T7.browseFs,getFsHome:T7.getFsHome,sendPrompt:T7.sendPrompt,steerPrompt:T7.steerPrompt,steerQueued:T7.steerQueued,sideChatVisible:Q5.sideChatVisible,sideChatSessionId:Q5.sideChatSessionId,sideChatTurns:Q5.sideChatTurns,sideChatRunning:Q5.sideChatRunning,sideChatSending:Q5.sideChatSending,openSideChat:Q5.openSideChat,closeSideChat:Q5.closeSideChat,sendSideChatPrompt:Q5.sendSideChatPrompt,uploadImage:T7.uploadImage,abortCurrentPrompt:lye,respondApproval:T7.respondApproval,respondQuestion:T7.respondQuestion,dismissQuestion:T7.dismissQuestion,pendingQuestionActions:T7.pendingQuestionActions,pendingApprovalActions:T7.pendingApprovalActions,cancelTask:T7.cancelTask,detachTask:T7.detachTask,setPermission:T7.setPermission,setThinking:l7.setThinking,setPlanMode:T7.setPlanMode,togglePlanMode:T7.togglePlanMode,setTowerMode:T7.setTowerMode,toggleTowerMode:T7.toggleTowerMode,setDynamicWorkflowMode:T7.setDynamicWorkflowMode,toggleDynamicWorkflowMode:T7.toggleDynamicWorkflowMode,setGoalMode:T7.setGoalMode,toggleGoalMode:T7.toggleGoalMode,createGoal:T7.createGoal,controlGoal:T7.controlGoal,enqueue:T7.enqueue,dismissWarning:T7.dismissWarning,renameSession:T7.renameSession,renameWorkspace:T7.renameWorkspace,deleteWorkspace:T7.deleteWorkspace,reorderWorkspaces:tye,setWorkspaceSortMode:nye,togglePinnedSession:Yve,reorderPinnedSessions:Xve,togglePinnedCollapsed:Zve,setSessionEmoji:fye,lastDeletedSessionId:v5,archiveSession:T7.archiveSession,deleteSession:T7.deleteSession,cleanupDeletedSession:T7.cleanupDeletedSession,exportSession:T7.exportSession,restoreSession:T7.restoreSession,loadArchivedSessions:T7.loadArchivedSessions,compact:T7.compact,forkSession:T7.forkSession,generateSessionTitle:T7.generateSessionTitle,undo:T7.undo,unqueue:T7.unqueue,reorderQueue:T7.reorderQueue,searchFiles:T7.searchFiles,loadGitStatus:T7.loadGitStatus,loadFileDiff:T7.loadFileDiff,clearFileDiff:T7.clearFileDiff,listDir:T7.listDir,readFileContent:T7.readFileContent,getFileDownloadUrl:T7.getFileDownloadUrl,openWorkspaceFile:T7.openWorkspaceFile,openInApp:T7.openInApp,revealWorkspaceFile:T7.revealWorkspaceFile,revealSavedPlan:T7.revealSavedPlan,resolveImageUrl:T7.resolveImageUrl,getFileUrl:e=>Q().getFileUrl(e),loadModels:l7.loadModels,loadProviders:l7.loadProviders,skills:q_e,skillsLoadingBySession:W5,connectors:G5,connectorsLoading:K5,plugins:q5,pluginsLoading:J5,activeSessionCapabilities:J_e,loadCapabilityData:Q_e,updateCapabilities:$_e,setPluginEnabled:Z_e,activateSkill:l7.activateSkill,setModel:l7.setModel,toggleStarModel:l7.toggleStarModel,addProvider:l7.addProvider,deleteProvider:l7.deleteProvider,refreshProvider:l7.refreshProvider,refreshAllProviders:l7.refreshAllProviders,authReady:f7,defaultModel:Gve,config:Kve,updateConfig:T7.updateConfig,refreshServerMeta:T7.refreshServerMeta,checkAuth:T7.checkAuth,refreshRuntimeState:dye}}var _ye=[`aria-expanded`,`aria-label`],vye={class:`capability-trigger-label`},yye={class:`capability-panel`},bye={class:`capability-viewport`},xye={class:`capability-view`},Sye={key:1,class:`capability-group`},Cye={class:`capability-group-title`},wye={class:`capability-caption`},Tye={key:0,class:`capability-loading`},Eye={class:`capability-view capability-view-secondary`},Dye={class:`capability-caption`},Oye={key:0,class:`capability-loading`},kye={class:`capability-caption`},Aye={key:0,class:`capability-loading`},jye=Y(G({__name:`CapabilityMenu`,props:{sessionId:{},triggerless:{type:Boolean}},setup(e,{expose:t}){let n=e,{t:r}=J(),i=D7(),a=R(null),o=R(null),l=R(!1),u=R(`root`),d=R([]),f=L(()=>n.sessionId===i.activeSessionId.value?i.skills.value:[]),p=L(()=>{let e=n.sessionId;return e?i.skillsLoadingBySession.value[e]===!0:!1}),m=L(()=>i.connectors.value),h=L(()=>i.connectorsLoading.value),g=L(()=>i.plugins.value),y=L(()=>i.pluginsLoading.value),b=L(()=>n.sessionId===i.activeSessionId.value?i.activeSessionCapabilities.value:{}),x=L(()=>p.value||f.value.length>0),S=L(()=>h.value||m.value.length>0),C=L(()=>y.value||g.value.length>0),w=L(()=>{switch(u.value){case`skills`:return r(`capabilityMenu.skills.title`);case`plugins`:return r(`capabilityMenu.plugins.title`);case`root`:return``}}),T=L(()=>{switch(u.value){case`skills`:return f.value.length;case`plugins`:return g.value.length;case`root`:return 0}});function D(){d.value=b.value.mcpServers===void 0?m.value.map(e=>e.id):[...b.value.mcpServers]}s([()=>n.sessionId,m,b],D,{immediate:!0}),s([f,p,g,y],()=>{u.value===`skills`&&!p.value&&f.value.length===0&&(u.value=`root`),u.value===`plugins`&&!y.value&&g.value.length===0&&(u.value=`root`)});function O(){if(l.value=!l.value,!l.value){u.value=`root`;return}n.sessionId&&i.loadCapabilityData(n.sessionId)}t({toggleOpen:O});function A(){l.value=!1,u.value=`root`}let j={tools:Promise.resolve(),mcpServers:Promise.resolve()},N={tools:0,mcpServers:0};function ee(e,t,r){let a=++N[e],o=n.sessionId,s=j[e].then(async()=>{if(n.sessionId===o)try{await i.updateCapabilities({[e]:[...t.value]})}catch{a===N[e]&&n.sessionId===o&&(t.value=r)}});return j[e]=s,s}function I(e,t){let n=[...d.value],r=new Set(n);return t?r.add(e):r.delete(e),d.value=[...r],ee(`mcpServers`,d,n)}function te(e,t){i.setPluginEnabled(e,t)}return(e,t)=>(c(),W(`div`,{ref_key:`rootRef`,ref:a,class:`capability-control`},[n.triggerless?E(``,!0):(c(),W(`button`,{key:0,ref_key:`triggerRef`,ref:o,type:`button`,class:V([`capability-trigger`,{open:l.value}]),"aria-expanded":l.value,"aria-haspopup":`dialog`,"aria-label":z(r)(`capabilityMenu.triggerLabel`),onClick:H(O,[`stop`])},[t[5]||=k(``,1),F(`span`,vye,U(z(r)(`capabilityMenu.trigger`)),1)],10,_ye)),v(Ip,{anchor:n.triggerless?a.value:o.value,open:l.value,label:z(r)(`capabilityMenu.triggerLabel`),onClose:A},{default:B(()=>[F(`div`,yye,[F(`div`,bye,[F(`div`,{class:V([`capability-track`,{"is-drilled":u.value!==`root`}])},[F(`div`,xye,[x.value?(c(),P(d6,{key:0,count:f.value.length,onClick:t[0]||=e=>u.value=`skills`},{label:B(()=>[K(U(z(r)(`capabilityMenu.skills.title`)),1)]),trailing:B(()=>[...t[6]||=[F(`svg`,{class:`chevron`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`path`,{d:`m6 3 5 5-5 5`})],-1)]]),_:1},8,[`count`])):E(``,!0),S.value?(c(),W(`div`,Sye,[F(`div`,Cye,U(z(r)(`capabilityMenu.mcp.title`)),1),F(`p`,wye,U(z(r)(`capabilityMenu.mcp.caption`)),1),h.value?(c(),W(`div`,Tye,[v(u6,{label:z(r)(`capabilityMenu.loading`)},null,8,[`label`])])):(c(!0),W(M,{key:1},_(m.value,e=>(c(),P(d6,{key:e.id,class:`mcp-row`,selected:d.value.includes(e.id),title:e.name,onClick:t=>void I(e.id,!d.value.includes(e.id))},{label:B(()=>[K(U(e.name),1)]),trailing:B(()=>[v(f6,{"model-value":d.value.includes(e.id),"aria-label":z(r)(`capabilityMenu.mcp.toggle`,{name:e.name}),onClick:t[1]||=H(()=>{},[`stop`]),"onUpdate:modelValue":t=>void I(e.id,t)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])]),_:2},1032,[`selected`,`title`,`onClick`]))),128))])):E(``,!0),C.value?(c(),P(d6,{key:2,count:g.value.length,onClick:t[2]||=e=>u.value=`plugins`},{label:B(()=>[K(U(z(r)(`capabilityMenu.plugins.title`)),1)]),trailing:B(()=>[...t[7]||=[F(`svg`,{class:`chevron`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`path`,{d:`m6 3 5 5-5 5`})],-1)]]),_:1},8,[`count`])):E(``,!0)]),F(`div`,Eye,[u.value===`root`?E(``,!0):(c(),P(d6,{key:0,class:`capability-back`,count:T.value,onClick:t[3]||=e=>u.value=`root`},{leading:B(()=>[...t[8]||=[F(`svg`,{class:`back-chevron`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`path`,{d:`m10 3-5 5 5 5`})],-1)]]),label:B(()=>[K(U(w.value||z(r)(`capabilityMenu.back`)),1)]),_:1},8,[`count`])),u.value===`skills`?(c(),W(M,{key:1},[F(`p`,Dye,U(z(r)(`capabilityMenu.skills.caption`)),1),p.value?(c(),W(`div`,Oye,[v(u6,{label:z(r)(`capabilityMenu.loading`)},null,8,[`label`])])):(c(!0),W(M,{key:1},_(f.value,e=>(c(),P(d6,{key:e.name,class:`skill-row`,disabled:``,title:e.description},{label:B(()=>[K(U(e.name),1)]),_:2},1032,[`title`]))),128))],64)):u.value===`plugins`?(c(),W(M,{key:2},[F(`p`,kye,U(z(r)(`capabilityMenu.plugins.caption`)),1),y.value?(c(),W(`div`,Aye,[v(u6,{label:z(r)(`capabilityMenu.loading`)},null,8,[`label`])])):(c(!0),W(M,{key:1},_(g.value,e=>(c(),P(d6,{key:e.id,class:`plugin-row`,selected:e.enabled,title:e.displayName,onClick:t=>te(e.id,!e.enabled)},{label:B(()=>[K(U(e.displayName),1)]),trailing:B(()=>[v(f6,{"model-value":e.enabled,"aria-label":z(r)(`capabilityMenu.plugins.toggle`,{name:e.displayName}),onClick:t[4]||=H(()=>{},[`stop`]),"onUpdate:modelValue":t=>te(e.id,t)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])]),_:2},1032,[`selected`,`title`,`onClick`]))),128))],64)):E(``,!0)])],2)])])]),_:1},8,[`anchor`,`open`,`label`])],512))}}),[[`__scopeId`,`data-v-ff3a96c4`]]),O7=Symbol(`expertTalk`),Mye={key:0,class:`ui-field__label`},Nye={key:1,class:`ui-field__error`},Pye={key:2,class:`ui-field__hint`},k7=Y(G({__name:`Field`,props:{label:{},hint:{},error:{}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-field`,{"has-error":!!e.error}])},[e.label?(c(),W(`label`,Mye,U(e.label),1)):E(``,!0),me(t.$slots,`default`,{},void 0,!0),e.error?(c(),W(`span`,Nye,U(e.error),1)):e.hint?(c(),W(`span`,Pye,U(e.hint),1)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-bd93f701`]]),Fye=[`aria-expanded`,`aria-label`,`disabled`],Iye=[`aria-label`],Lye=[`aria-label`],Rye=[`aria-selected`],zye={class:`sm-picker__option-label`},Bye={key:1,class:`sm-picker__divider`},Vye={class:`sm-picker__group`},Hye=[`aria-selected`,`onMouseenter`,`onClick`],Uye={class:`sm-picker__option-label`},Wye=[`aria-label`],Gye={class:`sm-picker__group`},Kye=[`aria-selected`,`onMouseenter`,`onClick`],qye={class:`sm-picker__option-label`},Jye=250,Yye=188,A7=Y(G({__name:`SecondaryModelPicker`,props:{modelValue:{},effort:{},groups:{},modelInfoById:{},disabled:{type:Boolean},allowEmpty:{type:Boolean,default:!0},emptyLabel:{},ariaLabel:{}},emits:[`inherit`,`select`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=`sm-picker-${Math.random().toString(36).slice(2,9)}`,s=R(null),l=R(null),u=R(null),d=R(!1),f=R(!1),m=R({}),g=R(null),y=R(``),b=R(0),x=R(`models`),S=R(0),C=R(0),w=R(`right`),T=new Map,D=null,O=L(()=>[...r.allowEmpty?[{id:``,label:a(`settings.noSecondaryModel`)}]:[],...r.groups.flatMap(e=>e.options)]),k=L(()=>r.emptyLabel??a(`settings.noSecondaryModel`)),A=L(()=>r.modelValue?O.value.find(e=>e.id===r.modelValue)?.label??r.modelValue:``),j=L(()=>r.modelValue?r.effort?`${A.value} · ${r.effort}`:A.value:k.value),N=L(()=>{let e=g.value;if(e===null||e===``)return[];let t=$3(r.modelInfoById[e]),n=r.effort===``?[null,...t]:[...t];return r.modelValue===e&&r.effort!==``&&!t.includes(r.effort)&&n.push(r.effort),n});function I(e){return r.modelValue===g.value?e===null?r.effort===``:r.effort===e:!1}function te(){let e=N.value.findIndex(I);return e>=0?e:0}function ne(e,t){e instanceof HTMLElement?T.set(t,e):T.delete(t)}function re(){D!==null&&(clearTimeout(D),D=null)}function ie(){re(),D=setTimeout(()=>{g.value=null,x.value===`efforts`&&(x.value=`models`)},Jye)}function oe(e){e!==y.value&&(y.value=e,b.value=Math.max(0,O.value.findIndex(t=>t.id===e)))}function se(){let e=s.value,t=l.value;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.offsetHeight;f.value=window.innerHeight-n.bottomr;let i=Math.max(8,window.innerWidth-n.right);m.value=f.value?{right:`${i}px`,bottom:`${window.innerHeight-n.top+4}px`,top:`auto`}:{right:`${i}px`,top:`${n.bottom+4}px`,bottom:`auto`}}function ce(){let e=l.value,t=g.value===null?void 0:T.get(g.value);if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=u.value?.offsetHeight??0,a=Math.max(0,window.innerHeight-8-i-n.top);C.value=Math.max(0,Math.min(r.top-n.top-4,e.offsetHeight-40,a));let o=window.innerWidth-n.right;w.value=o>=Yye||o>=n.left?`right`:`left`}function B(){d.value||r.disabled||(d.value=!0,y.value=r.modelValue||O.value[0]?.id||``,b.value=Math.max(0,O.value.findIndex(e=>e.id===y.value)),g.value=null,x.value=`models`,n(se))}function le({restoreFocus:e=!1}={}){d.value&&(re(),d.value=!1,g.value=null,e&&n(()=>s.value?.focus()))}function ue(){d.value?le({restoreFocus:!0}):B()}function de(){g.value=null,x.value=`models`}function fe(e,{moveFocus:t=!1}={}){if(oe(e),re(),e===``){g.value=null,x.value=`models`;return}g.value=e,n(ce),t&&(x.value=`efforts`,S.value=te())}function H(e){let t=g.value;if(t===null)return;let n={model:t,...e===null?{}:{effort:e}};(n.model!==r.modelValue||(n.effort??``)!==r.effort)&&i(`select`,n),le({restoreFocus:!0})}function G(){i(`inherit`),le({restoreFocus:!0})}function K(){n(()=>{l.value?.querySelector(`.sm-picker__option.is-kb-active`)?.scrollIntoView({block:`nearest`})})}function pe(e){let t=O.value;if(t.length===0)return;let n=t[(b.value+e+t.length)%t.length];oe(n.id),g.value!==null&&fe(n.id),K()}function me(e){let t=N.value;t.length!==0&&(S.value=(S.value+e+t.length)%t.length,K())}function he(e){if(!d.value){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),B());return}if(e.key===`ArrowDown`)e.preventDefault(),x.value===`models`?pe(1):me(1);else if(e.key===`ArrowUp`)e.preventDefault(),x.value===`models`?pe(-1):me(-1);else if(e.key===`ArrowRight`)e.preventDefault(),y.value!==``&&fe(y.value,{moveFocus:!0});else if(e.key===`ArrowLeft`)e.preventDefault(),g.value!==null&&de();else if(e.key===`Enter`||e.key===` `)e.preventDefault(),x.value===`models`&&y.value===``?G():x.value===`models`?fe(y.value,{moveFocus:!0}):H(N.value[S.value]??null);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`;if(x.value===`models`){let e=O.value;if(e.length===0)return;let n=(t?e[0]:e.at(-1)).id;oe(n),g.value!==null&&fe(n)}else S.value=t?0:N.value.length-1;K()}else e.key===`Escape`&&(e.preventDefault(),le({restoreFocus:!0}))}function ge(e){let t=e.target;t instanceof Node&&(s.value?.contains(t)||l.value?.contains(t)||le())}function _e(e){if(d.value){if(l.value?.contains(e.target instanceof Node?e.target:null)){ce();return}le(),se()}}function ve(){d.value&&se()}return p(()=>{document.addEventListener(`pointerdown`,ge),document.addEventListener(`scroll`,_e,!0),window.addEventListener(`resize`,ve)}),h(()=>{document.removeEventListener(`pointerdown`,ge),document.removeEventListener(`scroll`,_e,!0),window.removeEventListener(`resize`,ve),re()}),(t,n)=>(c(),W(`div`,{class:V([`sm-picker`,{"is-open":d.value}])},[F(`button`,{ref_key:`triggerRef`,ref:s,class:`sm-picker__trigger`,type:`button`,role:`combobox`,"aria-controls":o,"aria-expanded":d.value,"aria-haspopup":`dialog`,"aria-label":e.ariaLabel??z(a)(`settings.secondaryModel`),disabled:e.disabled,onClick:ue,onKeydown:he},[F(`span`,{class:V([`sm-picker__value`,{"is-placeholder":!e.modelValue}])},[F(`span`,null,U(j.value),1)],2),v(X,{class:`sm-picker__chevron`,name:`chevron-down`,size:`sm`})],40,Fye),(c(),P(ee,{to:`body`},[d.value?(c(),W(`div`,{key:0,id:o,ref_key:`menuRef`,ref:l,class:V([`sm-picker__menu`,{"sm-picker__menu--up":f.value}]),style:ae(m.value),role:`dialog`,"aria-label":e.ariaLabel??z(a)(`settings.secondaryModel`)},[F(`div`,{class:`sm-picker__models`,role:`listbox`,"aria-label":e.ariaLabel??z(a)(`settings.secondaryModel`)},[e.allowEmpty?(c(),W(`button`,{key:0,ref:e=>ne(e,``),type:`button`,class:V([`sm-picker__option`,{"is-selected":e.modelValue===``,"is-active":y.value===``,"is-kb-active":x.value===`models`&&y.value===``}]),role:`option`,"aria-selected":e.modelValue===``,onMouseenter:n[0]||=e=>fe(``),onClick:G},[v(X,{class:`sm-picker__check`,name:`check`,size:`sm`}),F(`span`,zye,U(z(a)(`settings.noSecondaryModel`)),1)],42,Rye)):E(``,!0),e.allowEmpty?(c(),W(`div`,Bye)):E(``,!0),(c(!0),W(M,null,_(e.groups,t=>(c(),W(M,{key:t.provider},[F(`div`,Vye,U(t.provider),1),(c(!0),W(M,null,_(t.options,t=>(c(),W(`button`,{key:t.id,ref_for:!0,ref:e=>ne(e,t.id),type:`button`,class:V([`sm-picker__option`,{"is-selected":t.id===e.modelValue,"is-active":t.id===y.value,"is-kb-active":x.value===`models`&&t.id===y.value}]),role:`option`,"aria-selected":t.id===e.modelValue,onMouseenter:e=>fe(t.id),onMouseleave:ie,onClick:e=>fe(t.id,{moveFocus:!0})},[v(X,{class:`sm-picker__check`,name:`check`,size:`sm`}),F(`span`,Uye,U(t.label),1),v(X,{class:`sm-picker__flyout-caret`,name:`chevron-right`,size:`sm`})],42,Hye))),128))],64))),128))],8,Lye),g.value===null?E(``,!0):(c(),W(`div`,{key:0,ref_key:`flyoutRef`,ref:u,class:V([`sm-picker__flyout`,`sm-picker__flyout--${w.value}`]),style:ae({top:`${C.value}px`}),role:`listbox`,"aria-label":z(a)(`settings.secondaryModelEffort`),onMouseenter:re,onMouseleave:ie},[F(`div`,Gye,U(z(a)(`settings.secondaryModelEffort`)),1),(c(!0),W(M,null,_(N.value,(e,t)=>(c(),W(`button`,{key:e??`__default__`,type:`button`,class:V([`sm-picker__option`,{"is-selected":I(e),"is-kb-active":x.value===`efforts`&&t===S.value,"is-muted":e===null}]),role:`option`,"aria-selected":I(e),onMouseenter:e=>{x.value=`efforts`,S.value=t},onClick:t=>H(e)},[v(X,{class:`sm-picker__check`,name:`check`,size:`sm`}),F(`span`,qye,U(e??z(a)(`settings.secondaryModelEffortAuto`)),1)],42,Kye))),128))],46,Wye))],14,Iye)):E(``,!0)]))],2))}}),[[`__scopeId`,`data-v-c4c36368`]]),Xye=[`aria-label`],Zye={class:`expert-talk__one-shot-title`},Qye={class:`expert-talk__one-shot-pair`},$ye={class:`expert-talk__one-shot-lead`},ebe={class:`expert-talk__one-shot-peer`},tbe={class:`expert-talk__one-shot-scope`},nbe={class:`expert-talk`},rbe=[`aria-label`],ibe={class:`expert-talk__pair`,"aria-labelledby":`expert-talk-pair-title`},abe={id:`expert-talk-pair-title`,class:`expert-talk__section-title`},obe={class:`expert-talk__fields`},sbe={class:`expert-talk__exchange`,"aria-hidden":`true`},cbe={key:0,class:`expert-talk__error`,role:`alert`},lbe={key:1,class:`expert-talk__error`,role:`alert`},ube={key:2,class:`expert-talk__error`,role:`alert`},dbe={class:`expert-talk__disclosure`},fbe={key:2,class:`expert-talk__error`,role:`alert`},pbe={class:`expert-talk__actions`},j7=Y(G({__name:`ExpertTalkControl`,props:{models:{},trigger:{default:`pill`}},emits:[`take`,`build`],setup(e,{expose:t,emit:n}){let r=i(()=>he(()=>Promise.resolve().then(()=>due),void 0)),a=e,o=n,l=m(O7),{t:u}=J(),d=R(!1),f=R(``),p=R(``),h=R(``),g=R(``),_=L(()=>a.models.filter(e=>e.maxContextSize>0&&(e.capabilities??[]).some(e=>e.trim().toLowerCase().replaceAll(`-`,`_`)===`tool_use`))),y=L(()=>{let e=new Map;for(let t of _.value){let n=e.get(t.provider)??[];n.push(t),e.set(t.provider,n)}return Array.from(e.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({provider:e,models:t.toSorted((e,t)=>te(e.id).localeCompare(te(t.id)))}))}),b=L(()=>y.value.map(e=>({provider:e.provider,options:e.models.map(e=>({id:e.id,label:te(e.id)}))}))),x=L(()=>Object.fromEntries(a.models.map(e=>[e.id,e]))),S=L(()=>l?.status.value),C=L(()=>l?.run.value),w=L(()=>l?.available.value===!0),T=L(()=>C.value?.state===`running`),D=L(()=>S.value?.activation.state===`armed`),O=L(()=>S.value?.config),k=L(()=>l?.preferredPair.value??O.value),A=L(()=>O.value===null||O.value===void 0?``:te(O.value.fusionLeadModelId)),j=L(()=>O.value===null||O.value===void 0?``:te(O.value.peerModelId)),N=L(()=>f.value.length>0&&p.value.length>0&&f.value!==p.value),ee=L(()=>{let e=C.value?.state;return e===`failed`||e===`cancelled`||e===`interrupted`}),I=L(()=>D.value?u(`expertTalk.next`):T.value?u(`expertTalk.stage.${C.value?.stage??`opening`}`):u(`expertTalk.title`));function te(e){let t=a.models.find(t=>t.id===e);return t?.displayName??t?.model??e}function ne(){let e=k.value;f.value=e?.fusionLeadModelId??``,p.value=e?.peerModelId??``,h.value=e?.fusionLeadThinkingEffort??``,g.value=e?.peerThinkingEffort??``}s(d,e=>{e&&ne()});function re(){w.value&&(d.value=!0)}async function ie(){let e=k.value;if(!l||e==null||T.value||D.value){re();return}await l.useForNextMessage(e)}function ae(){return!l||!T.value?!1:(l.cancel(),!0)}t({available:w,openDialog:re,activate:ie,cancelActive:ae});async function oe(){!l||!N.value||(await l.useForNextMessage({fusionLeadModelId:f.value,peerModelId:p.value,fusionLeadThinkingEffort:h.value||void 0,peerThinkingEffort:g.value||void 0}),l.error.value===void 0&&(d.value=!1))}function se(e){f.value=e.model,h.value=e.effort??``}function ce(e){p.value=e.model,g.value=e.effort??``}async function le(e,t){l&&(D.value&&(await l.disarm(),D.value||l.error.value!==void 0)||(o(e===`take`?`take`:`build`,t),d.value=!1))}return(t,n)=>w.value?(c(),W(M,{key:0},[e.trigger===`widget`&&D.value?(c(),W(`button`,{key:0,type:`button`,class:`expert-talk__one-shot`,"aria-label":z(u)(`expertTalk.armedLabel`,{lead:A.value,peer:j.value}),onClick:re},[F(`span`,Zye,[v(X,{name:`sparkles`,size:`sm`}),K(` `+U(z(u)(`expertTalk.oneShot`)),1)]),F(`span`,Qye,[F(`span`,$ye,`◆ `+U(A.value),1),n[7]||=F(`span`,{"aria-hidden":`true`},`⊕`,-1),F(`span`,ebe,`▲ `+U(j.value),1)]),F(`span`,tbe,U(z(u)(`expertTalk.oneShotScope`)),1)],8,Xye)):e.trigger===`launcher`?(c(),W(`button`,{key:1,type:`button`,class:`expert-talk__launcher`,"aria-haspopup":`dialog`,onClick:re},[v(X,{name:`sparkles`,size:`md`}),F(`span`,null,U(I.value),1)])):e.trigger===`pill`&&T.value?(c(),P(tE,{key:2,active:``,onClick:re},{default:B(()=>[v(X,{name:`sparkles`,size:`sm`}),F(`span`,null,U(I.value),1)]),_:1})):E(``,!0),v(If,{open:d.value,"onUpdate:open":n[6]||=e=>d.value=e,title:z(u)(`expertTalk.title`),description:z(u)(`expertTalk.description`),size:`xl`},{foot:B(()=>[F(`div`,pbe,[S.value?.config&&!T.value&&!D.value?(c(),P(YT,{key:0,variant:`ghost`,disabled:z(l)?.busy.value,onClick:n[2]||=e=>z(l)?.clear()},{default:B(()=>[K(U(z(u)(`expertTalk.clear`)),1)]),_:1},8,[`disabled`])):E(``,!0),D.value?(c(),P(YT,{key:1,variant:`secondary`,loading:z(l)?.busy.value,onClick:n[3]||=e=>z(l)?.disarm()},{default:B(()=>[K(U(z(u)(`expertTalk.disarm`)),1)]),_:1},8,[`loading`])):T.value?(c(),P(YT,{key:2,variant:`danger-soft`,loading:z(l)?.busy.value,onClick:n[4]||=e=>z(l)?.cancel()},{default:B(()=>[K(U(z(u)(`expertTalk.stop`)),1)]),_:1},8,[`loading`])):ee.value&&C.value?.error?.retryable?(c(),P(YT,{key:3,variant:`secondary`,loading:z(l)?.busy.value,onClick:n[5]||=e=>z(l)?.retry()},{default:B(()=>[K(U(z(u)(`expertTalk.retry`)),1)]),_:1},8,[`loading`])):E(``,!0),!T.value&&!D.value?(c(),P(YT,{key:4,disabled:!N.value||_.value.length<2,loading:z(l)?.busy.value,onClick:oe},{default:B(()=>[v(X,{name:`sparkles`,size:`sm`}),K(` `+U(z(u)(`expertTalk.useNext`)),1)]),_:1},8,[`disabled`,`loading`])):E(``,!0)])]),default:B(()=>[F(`div`,nbe,[!S.value?.config&&!C.value?(c(),W(`section`,{key:0,class:`expert-talk__boot`,"aria-label":z(u)(`expertTalk.bootTitle`)},[F(`strong`,null,U(z(u)(`expertTalk.bootTitle`)),1),F(`span`,null,U(z(u)(`expertTalk.bootSubtitle`)),1),n[8]||=F(`span`,{class:`expert-talk__boot-pair`,"aria-hidden":`true`},`●\xA0 + \xA0●`,-1)],8,rbe)):E(``,!0),F(`section`,ibe,[F(`div`,abe,U(z(u)(`expertTalk.pair`)),1),F(`div`,obe,[v(k7,{label:z(u)(`expertTalk.lead`),hint:z(u)(`expertTalk.leadHint`)},{default:B(()=>[v(A7,{class:`expert-talk__model-select`,"model-value":f.value,effort:h.value,groups:b.value,"model-info-by-id":x.value,"allow-empty":!1,"empty-label":z(u)(`expertTalk.selectModel`),"aria-label":z(u)(`expertTalk.lead`),disabled:T.value||D.value||z(l)?.busy.value,onSelect:se},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`]),F(`span`,sbe,[v(X,{name:`chevron-right`,size:`md`})]),v(k7,{label:z(u)(`expertTalk.peer`),hint:z(u)(`expertTalk.peerHint`)},{default:B(()=>[v(A7,{class:`expert-talk__model-select`,"model-value":p.value,effort:g.value,groups:b.value,"model-info-by-id":x.value,"allow-empty":!1,"empty-label":z(u)(`expertTalk.selectModel`),"aria-label":z(u)(`expertTalk.peer`),disabled:T.value||D.value||z(l)?.busy.value,onSelect:ce},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`])]),_.value.length<2?(c(),W(`p`,cbe,U(z(u)(`expertTalk.modelsRequired`)),1)):N.value?E(``,!0):(c(),W(`p`,lbe,U(z(u)(`expertTalk.distinctRequired`)),1)),S.value?.pairValidation.state!==`valid`&&S.value?.pairValidation.reason?(c(),W(`p`,ube,U(S.value.pairValidation.reason),1)):E(``,!0)]),F(`section`,dbe,[v(X,{name:`info`,size:`md`}),F(`span`,null,U(z(u)(`expertTalk.disclosure`)),1)]),C.value?(c(),P(z(r),{key:1,run:C.value,models:_.value,onTake:n[0]||=e=>le(`take`,e),onBuild:n[1]||=e=>le(`build`,e)},null,8,[`run`,`models`])):E(``,!0),z(l)?.error.value?(c(),W(`p`,fbe,U(z(l).error.value),1)):E(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64)):E(``,!0)}}),[[`__scopeId`,`data-v-74ffa547`]]),M7=0,N7=null;function P7(){function e(){typeof document>`u`||(M7+=1,M7===1&&(N7=document.body.style.overflow,document.body.style.overflow=`hidden`))}function t(){M7<=0||(--M7,M7===0&&typeof document<`u`&&(document.body.style.overflow=N7??``,N7=null))}return{lock:e,unlock:t}}var mbe={key:0,class:`sheet-root`},hbe=[`aria-label`],gbe=[`aria-label`],_be={key:0,class:`sheet-head`},vbe={class:`sheet-title`},ybe={class:`sheet-body`},F7=Y(G({__name:`BottomSheet`,props:{modelValue:{type:Boolean},title:{default:``},closeOnEsc:{type:Boolean,default:!0}},emits:[`update:modelValue`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,{lock:a,unlock:o}=P7();function l(){i(`update:modelValue`,!1),i(`close`)}function u(e){e.key===`Escape`&&r.closeOnEsc&&l()}return s(()=>r.modelValue,e=>{typeof document>`u`||(e?(a(),document.addEventListener(`keydown`,u)):(o(),document.removeEventListener(`keydown`,u)))},{immediate:!0}),h(()=>{typeof document<`u`&&(o(),document.removeEventListener(`keydown`,u))}),(t,r)=>(c(),P(oe,{name:`sheet`},{default:B(()=>[e.modelValue?(c(),W(`div`,mbe,[F(`div`,{class:`sheet-scrim`,onClick:l}),F(`div`,{class:`sheet-panel`,role:`dialog`,"aria-label":e.title||z(n)(`mobile.sheetLabel`)},[F(`button`,{type:`button`,class:`sheet-grab`,"aria-label":z(n)(`mobile.closeSheet`),onClick:l},null,8,gbe),e.title?(c(),W(`div`,_be,[F(`span`,vbe,U(e.title),1)])):E(``,!0),F(`div`,ybe,[me(t.$slots,`default`,{},void 0,!0)])],8,hbe)])):E(``,!0)]),_:3}))}}),[[`__scopeId`,`data-v-92ecd88c`]]),bbe={class:`ui-toast__icon`,"aria-hidden":`true`},xbe={class:`ui-toast__body`},Sbe={class:`ui-toast__title`},Cbe={key:0,class:`ui-toast__count`},wbe={key:0,class:`ui-toast__msg`},I7=Y(G({__name:`Toast`,props:{variant:{default:`info`},title:{},message:{},dismissLabel:{default:`Dismiss`},count:{default:1}},emits:[`dismiss`],setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-toast`,`ui-toast--${e.variant}`])},[F(`span`,bbe,[me(t.$slots,`icon`,{},()=>[e.variant===`success`?(c(),P(X,{key:0,name:`check`})):e.variant===`danger`?(c(),P(X,{key:1,name:`close`})):e.variant===`warning`?(c(),P(X,{key:2,name:`alert-triangle`})):(c(),P(X,{key:3,name:`info`}))],!0)]),F(`div`,xbe,[F(`div`,Sbe,[K(U(e.title),1),e.count>1?(c(),W(`span`,Cbe,`×`+U(e.count),1)):E(``,!0)]),e.message?(c(),W(`div`,wbe,U(e.message),1)):E(``,!0),me(t.$slots,`default`,{},void 0,!0)]),v(Ca,{class:`ui-toast__close`,size:`sm`,label:e.dismissLabel,onClick:n[0]||=e=>t.$emit(`dismiss`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])],2))}}),[[`__scopeId`,`data-v-633d877d`]]),Tbe={class:`att-lightbox-card`},Ebe=[`src`],Dbe=[`src`,`alt`],Obe={class:`att-lightbox-name`},kbe=[`aria-label`],Abe={class:`quote-copy`},jbe={key:0,class:`quote-source`},Mbe={class:`quote-text`},Nbe={key:1,class:`quote-comment`},Pbe={key:1,class:`att-strip`},Fbe={class:`att-scroll-content`},Ibe=[`aria-label`],Lbe={key:1,class:`att-row`},Rbe={key:0,class:`att-more`},zbe={class:`discussion-row`},Bbe={class:`cin-wrap`},Vbe=[`onClick`],Hbe={class:`am-icon`},Ube={class:`am-name`},Wbe={key:0,class:`am-desc`},Gbe={class:`input-row`},Kbe=[`placeholder`,`disabled`,`aria-expanded`,`aria-controls`,`aria-activedescendant`],qbe=[`aria-label`],Jbe={class:`toolbar-left`},Ybe=[`aria-label`,`onKeydown`],Xbe={class:`perm-pill-label`},Zbe=[`onClick`],Qbe={class:`pd-info`},$be={class:`pd-desc`},exe={class:`pd-check`},txe={key:1,class:`workflow-chip`},nxe={class:`workflow-label`},rxe=[`aria-label`],ixe=[`aria-haspopup`,`aria-expanded`,`aria-label`],axe=[`disabled`,`aria-expanded`,`aria-label`,`onKeydown`],oxe={class:`thinking-pill-label`},sxe=[`aria-label`],cxe=[`aria-label`,`disabled`],lxe={class:`md-list`},uxe={key:0,class:`md-section`},dxe=[`onClick`],fxe={class:`md-check`},pxe={class:`md-name`},mxe={class:`md-provider`},hxe={key:1,class:`md-divider`},gxe={key:2,class:`md-section`},_xe=[`onClick`],vxe={class:`md-check`},yxe={class:`md-name`},bxe={key:0,class:`md-divider`},xxe={class:`md-check md-more-icon`},Sxe={class:`md-name`},Cxe=[`aria-label`,`onKeydown`],wxe={class:`thinking-dropdown-title`},Txe={class:`thinking-cache-note`},Exe={class:`drop-card`},Dxe={key:0,class:`composer-warning-toast`,role:`status`,"aria-live":`polite`},Oxe={class:`msheet-search`},kxe={class:`msheet-search`},Axe=[`onClick`],jxe={class:`am-icon`},Mxe={class:`am-name`},Nxe={key:0,class:`am-desc`},L7=56,R7=Y(G({__name:`Composer`,props:{running:{type:Boolean,default:!1},starting:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},planArmed:{type:Boolean},working:{type:Boolean,default:!1},goalMode:{type:Boolean},towerMode:{type:Boolean},towerAvailable:{type:Boolean},workflowActive:{type:Boolean},goal:{},activationBadges:{},models:{default:()=>[]},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean,default:!1}},emits:[`submit`,`steer`,`command`,`interrupt`,`setPermission`,`setThinking`,`togglePlan`,`toggleWorkflow`,`toggleGoal`,`toggleTower`,`openBtw`,`createGoal`,`controlGoal`,`focusGoal`,`compact`,`pickModel`,`selectModel`],setup(e,{expose:t,emit:r}){let i=e,a=L(()=>i.starting?u(`composer.starting`):i.running?u(`composer.placeholderRunning`):i.goalMode?u(`status.goalPlaceholder`):i.planArmed||i.planMode?u(`status.planPlaceholder`):u(`composer.placeholder`)),o=r,{t:u,locale:d}=J(),f=a6(),{text:g,textareaRef:y,autosize:b,loadForEdit:x,clearDraft:S}=Wpe({sessionId:()=>i.sessionId}),C=R([]),w=1;function D(e){let t=e.quote.trim();t&&(C.value.push({id:w++,text:t,comment:e.comment?.trim()||void 0,source:e.source?.trim()||void 0}),n(dt))}function O(e){C.value=C.value.filter(t=>t.id!==e)}function k(e){return[...C.value.map(e=>{let t=e.text.split(` +`),i=[];return n.forEach((e,t)=>{i.push({kind:`rem`,gutter:String(t+1),text:`- ${e}`})}),r.forEach((e,t)=>{i.push({kind:`add`,gutter:String(t+1),text:`+ ${e}`})}),i}function Y_e(e){let t=e.display??{},n=typeof t.kind==`string`?t.kind:``;if(n===`diff`){let e=typeof t.path==`string`?t.path:``;return Array.isArray(t.diff)?{kind:`diff`,path:e,diff:t.diff}:typeof t.old_text==`string`&&typeof t.new_text==`string`?{kind:`diff`,path:e,diff:J_e(t.old_text,t.new_text)}:{kind:`diff`,path:e,diff:[]}}if(n===`shell`||n===`command`)return{kind:`shell`,command:typeof t.command==`string`?t.command:e.action,cwd:typeof t.cwd==`string`?t.cwd:void 0,danger:typeof t.danger==`string`?t.danger:void 0};if(n===`file_content`||n===`file`)return{kind:`file`,path:typeof t.path==`string`?t.path:``,content:typeof t.content==`string`?t.content:``,language:typeof t.language==`string`?t.language:void 0};if(n===`file_op`||n===`fileop`)return{kind:`fileop`,op:typeof t.operation==`string`?t.operation:typeof t.op==`string`?t.op:n,path:typeof t.path==`string`?t.path:``,detail:typeof t.detail==`string`?t.detail:void 0};if(n===`url_fetch`||n===`url`){let n=typeof t.url==`string`?t.url:e.action;return{kind:`url`,method:typeof t.method==`string`?t.method:void 0,url:n}}if(n===`search`)return{kind:`search`,query:typeof t.query==`string`?t.query:e.action,scope:typeof t.scope==`string`?t.scope:void 0};if(n===`invocation`||n===`agent_call`||n===`skill_call`)return{kind:`invocation`,kind2:typeof t.kind==`string`?t.kind:n,name:typeof t.name==`string`?t.name:e.toolName,description:typeof t.description==`string`?t.description:void 0};if(n===`todo`||n===`todo_list`)return{kind:`todo`,items:(Array.isArray(t.items)?t.items:[]).map(e=>{let t=e??{};return{title:typeof t.title==`string`?t.title:``,status:typeof t.status==`string`?t.status:`pending`}})};if(n===`plan_review`){let e=typeof t.plan==`string`?t.plan:``,n=typeof t.path==`string`?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(e=>{let t=e??{},n=typeof t.label==`string`?t.label:``;return n?{label:n,description:typeof t.description==`string`?t.description:void 0}:null}).filter(e=>e!==null);return{kind:`plan_review`,plan:e,path:n,options:r.length>0?r:void 0}}return{kind:`generic`,summary:e.action}}function X_e(e){return{questionId:e.questionId,sessionId:e.sessionId,toolCallId:e.toolCallId,questions:e.questions.map(e=>({id:e.id,question:e.question,header:e.header,body:e.body,options:e.options.map(e=>({id:e.id,label:e.label,description:e.description,recommended:e.recommended})),multiSelect:e.multiSelect,allowOther:e.allowOther,otherLabel:e.otherLabel,otherDescription:e.otherDescription}))}}function Z_e(e){let t=$.messagesBySession[e.sessionId];if(!t||t.length===0)return;let n=new Map;for(let e of t)if(e.role===`assistant`)for(let t of e.content){if(t.type!==`toolUse`||t.toolName!==`Bash`&&t.toolName!==`bash`)continue;let e=t.input,r=e&&typeof e.command==`string`?e.command:void 0;r&&n.set(t.toolCallId,r)}if(n.size===0)return;let r=`task_id: ${e.id}`;for(let e of t)if(e.role===`tool`){for(let t of e.content)if(t.type===`toolResult`&&(typeof t.output==`string`?t.output:t.output===void 0?``:JSON.stringify(t.output)).includes(r)){let e=n.get(t.toolCallId);if(e)return e}}}function Q_e(e){let t;t=e.status===`running`?`run`:e.status===`completed`?`done`:e.status===`cancelled`?`cancelled`:`fail`;let n=``,r;if(e.status===`running`&&e.startedAt){r=Date.now()-new Date(e.startedAt).getTime();let t=Math.round(r/1e3),i=Math.floor(t/60),a=t%60;n=fC.global.t(`tasks.timingRunning`,{time:`${i}:${String(a).padStart(2,`0`)}`})}else if(e.completedAt&&e.startedAt){r=new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime();let t=Math.round(r/1e3);n=fC.global.t(`tasks.timingDone`,{sec:t})}else n=e.status;let i=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,a=e.command??Z_e(e),o=e.kind===`bash`&&a?`$ ${a}`:void 0;return{id:e.id,agentId:e.agentId,backgroundTaskId:e.backgroundTaskId,name:e.description,kind:e.kind,state:t,timing:n,durationMs:r,meta:o,output:i,subagentType:e.subagentType,phase:e.subagentPhase,model:e.model,thinkingEffort:e.thinkingEffort,dynamicWorkflowIndex:e.dynamicWorkflowIndex,swarmIndex:e.swarmIndex,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId,createdAt:e.createdAt,completedAt:e.completedAt}}var $_e=L(()=>{let e=$.sessions.find(e=>e.id===$.activeSessionId),t=e?e.cwd.split(`/`).pop()??e.cwd:`main`;return{name:$.workspaceName,branch:t}}),eve=L(()=>(B5.value,$.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:z5(e.updatedAt),busy:R5(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason})))),H5=L(()=>$.activeSessionId??``),tve=L(()=>{let e=$.activeSessionId;if(e)return c7.skillsBySession.value[e]??[];let t=x7.value;return t?c7.skillsByWorkspace.value[t]??[]:[]}),U5=R({}),W5=R([]),G5=R(!1),K5=R([]),q5=R(!1),J5=R({}),nve=L(()=>{let e=$.activeSessionId;return e?J5.value[e]??{}:{}});async function rve(e){U5.value={...U5.value,[e]:!0};try{await c7.loadSkillsForSession(e)}finally{U5.value={...U5.value,[e]:!1}}}async function ive(){G5.value=!0;try{W5.value=await Q().listConnectors()}catch{W5.value=[]}finally{G5.value=!1}}async function Y5(){q5.value=!0;try{K5.value=await Q().listPlugins()}catch{K5.value=[]}finally{q5.value=!1}}async function ave(e,t){let n=K5.value.find(t=>t.id===e)?.enabled;K5.value=K5.value.map(n=>n.id===e?{...n,enabled:t}:n);try{await Q().setPluginEnabled(e,t)}catch(t){n!==void 0&&(K5.value=K5.value.map(t=>t.id===e?{...t,enabled:n}:t)),M5(`setPluginEnabled`,t);return}await Y5()}async function ove(e){await Promise.all([rve(e),ive(),Y5()])}async function sve(e){let t=$.activeSessionId;if(!t)return;let n=J5.value[t]??{};J5.value={...J5.value,[t]:{...n,...e}};try{await Q().updateSession(t,e)}catch(e){throw J5.value={...J5.value,[t]:n},M5(`updateCapabilities`,e,{sessionId:t}),e}}var X5=L(()=>{let e=$.activeSessionId;return e?$.inFlightBySession[e]??!1:!1}),cve=L(()=>w7.isStartingFirstPrompt()),Z5=Age($,{pushOperationFailure:M5,nextOptimisticMsgId:b5,connectEventsIfNeeded:S5,getEventConn:()=>g5,resolveThinkingForPrompt:(e,t)=>c7.resolveThinkingForPrompt(e,t)}),Q5=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=Z5.sideChatTargetBySession.value[e]?.agentId;return($.tasksBySession[e]??[]).filter(e=>e.id!==t)}),$5=Che($,Q5),lve=kge(),uve=e=>Q().getFileUrl(e),dve=[],fve=[],pve=[],e7;function mve(e,t){if(t.length===0)return e;let n=e.at(-1),r=e7;if(r!==void 0&&r.source===e&&r.length===e.length&&r.hiddenIds===t){if(r.last===n)return r.result;let e=r.result.at(-1);if(n!==void 0&&e!==void 0&&r.last?.id===n.id&&e.id===n.id)return r.result[r.result.length-1]=n,r.last=n,r.result}let i=e.filter(e=>!t.includes(e.id));return e7={source:e,length:e.length,hiddenIds:t,last:n,result:i},i}var hve=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=$.sideChatUserMessageIdsBySession[e]??pve;return lve(mve($.messagesBySession[e]??fve,t),$.approvalsBySession[e]??dve,uve,t7.value,$.planReviewByToolCallId)}),t7=L(()=>{let e=$.activeSessionId;return e?($.turnActiveBySession[e]??!1)||($.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),gve=L(()=>X5.value||t7.value),n7=new Map,_ve=L(()=>{$5.taskClock.value;let e=Q5.value.filter(e=>e.kind===`subagent`&&e.runInBackground).toSorted((e,t)=>Date.parse(e.createdAt)-Date.parse(t.createdAt)),t=$.activeSessionId??`__draft__`,n=n7.get(t)??{indexes:new Map,next:1};n7.set(t,n);for(let t of e){let e=n.indexes.get(t.id)??(t.backgroundTaskId?n.indexes.get(t.backgroundTaskId):void 0)??n.next++;n.indexes.set(t.id,e),t.backgroundTaskId&&n.indexes.set(t.backgroundTaskId,e)}return Q5.value.map(e=>{let t=Q_e(e);return e.kind===`subagent`&&e.runInBackground&&(t.dynamicWorkflowIndex=e.dynamicWorkflowIndex??n.indexes.get(e.id)),t})}),vve=L(()=>{let e=$.activeSessionId;if(!e)return{};let t={};for(let n of $.messagesBySession[e]??[])for(let e of n.content){if(e.type!==`toolUse`||e.toolName!==`ExitPlanMode`)continue;let r=e.input&&typeof e.input==`object`?e.input:{},i=$.planReviewByToolCallId[e.toolCallId],a=i?.plan??(typeof r.plan==`string`?r.plan:void 0),o=i?.path??(typeof r.path==`string`?r.path:void 0)??(typeof r.planPath==`string`?r.planPath:void 0);t[e.toolCallId]={agentId:`main`,toolCallId:e.toolCallId,turnId:n.id,source:`interaction`,plan:a,path:o}}return t}),r7=L(()=>t_e(Q5.value)),yve=L(()=>r_e(Q5.value)),i7=L(()=>{let e=$.activeSessionId;return e?$.goalBySession[e]??null:null}),bve=L(()=>{let e=$.activeSessionId;return e?Qge($.messagesBySession[e]??[]):[]}),xve=L(()=>{let e=$.activeSessionId;return e?$.compactionBySession[e]??null:null}),Sve=L(()=>$.connection),Cve=L(()=>$.loading),wve=L(()=>$.sessionLoading),Tve=L(()=>{let e=$.activeSessionId;return e?$.messagesLoadingMoreBySession[e]??!1:!1}),Eve=L(()=>{let e=$.activeSessionId;return e?$.messagesHasMoreBySession[e]??!1:!1}),Dve=L(()=>{let e=$.activeSessionId;return e?$.messagesLoadMoreErrorBySession[e]??!1:!1}),Ove=L(()=>$.serverVersion),kve=L(()=>$.backend),Ave=L(()=>$.experimentalFlagStates),jve=L(()=>$.subagentModelPolicy),Mve=L(()=>$.subagentModelPolicySaving);function a7(e){return $.experimentalFlagStates.find(t=>t.id===e)}var Nve=L(()=>$.dangerousBypassAuth);function Pve(){$.dangerousBypassAuth=!1}var Fve=L(()=>$.permission),Ive=L(()=>$.thinking),o7=L(()=>{let e=$.activeSessionId;return e?$.planModeBySession[e]??!1:W8.planMode}),Lve=L(()=>{let e=$.activeSessionId;return e?$.planArmedBySession[e]??!1:W8.planMode}),Rve=L(()=>{let e=$.activeSessionId;return e?$.dynamicWorkflowModeBySession[e]??!1:W8.dynamicWorkflowMode}),zve=L(()=>{let e=$.activeSessionId;return e?$.goalModeBySession[e]??!1:W8.goalMode}),Bve=L(()=>{let e=$.activeSessionId;return e?$.towerModeBySession[e]??!1:W8.towerMode}),Vve=L(()=>a7(`tower`)?.enabled===!0),Hve=L(()=>{let e=n_e(r7.value);return{plan:o7.value,goal:i7.value&&i7.value.status!==`complete`?{status:i7.value.status,turnsUsed:i7.value.turnsUsed,elapsedMs:i7.value.wallClockMs}:null,dynamicWorkflow:e.total>0?e:null}}),Uve=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=Q();return($.queuedBySession[e]??[]).map(e=>({id:e.id??e.text,text:e.text,attachmentCount:e.attachments?.length??0,attachments:e.attachments?.map(e=>({fileId:e.fileId,kind:e.kind,url:t.getFileUrl(e.fileId),name:e.name}))}))}),Wve=L(()=>$.warnings),Gve=L(()=>{let e=$.activeSessionId;return e?($.questionsBySession[e]??[]).map(X_e):[]}),Kve=L(()=>{let e=$.activeSessionId;return e?($.approvalsBySession[e]??[]).map(e=>({approvalId:e.approvalId,block:Y_e(e),agentName:e.agentName,toolCallId:e.toolCallId})):[]}),s7=L(()=>{let e=$.activeSessionId;return e?($.approvalsBySession[e]??[]).length>0?`awaiting-approval`:($.questionsBySession[e]??[]).length>0?`awaiting-question`:X5.value||t7.value?`running`:`idle`:`idle`}),c7=Ghe($,{pushOperationFailure:M5,refreshSessionStatus:s5,persistSessionProfile:c5,activity:s7,updateSession:J8,updateSessionMessages:Q8}),l7=L(()=>{let e=$.activeSessionId;if(!e)return null;let t=$.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),qve=L(()=>{let e=$.activeSessionId;return e?$.gitStatusBySession[e]?.pullRequest??null:null}),Jve=L(()=>{let e=$.activeSessionId;if(!e)return[];let t=$.gitStatusBySession[e];return t?Object.entries(t.entries).map(([e,t])=>({path:e,status:t})).toSorted((e,t)=>e.path.localeCompare(t.path)):[]}),Yve=L(()=>{let e=$.activeSessionId;if(!e)return null;let t=$.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),u7=L(()=>{let e=$.sessions.find(e=>e.id===$.activeSessionId),t=l7.value?.branch??(e?e.cwd.split(`/`).pop()??e.cwd:`main`),n=e===void 0?c7.draftModel.value:null,r=(e?.model&&e.model.length>0?e.model:n??$.defaultModel)??`—`,i=c7.models.value.find(e=>e.id===r)??c7.models.value.find(e=>e.model===r);return{model:i?.displayName||i?.model||(r.includes(`/`)?r.split(`/`).pop():r),modelId:i?.id??r,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:e?$.permissionBySession[e.id]??$.permission:$.permission,branch:t,cwd:e?.cwd??``,isGitRepo:l7.value!==null}}),Xve=L(()=>t5.value),Zve=L(()=>$.sessions.find(e=>e.id===$.activeSessionId)?.usage.totalCostUsd??0),d7=L(()=>$.authReady),f7=R(null);s(r5,e=>{e&&f7.value===null&&(f7.value=d7.value)},{immediate:!0});var p7=L(()=>gme(h5.value,f7.value??!1)),Qve=L(()=>hme({initialized:r5.value,onboardingCompleted:p7.value,authReady:d7.value})),$ve=L(()=>$.defaultModel),eye=L(()=>$.config),tye=L(()=>{let e=$.activeSessionId;if(!e)return{};let t=$.gitStatusBySession[e];return t?{...t.entries}:{}});function m7(e){let t=f6(e.cwd);return $.workspaces.find(e=>f6(e.root)===t)?.id??e.workspaceId??e.cwd}var h7=L(()=>bme({workspaces:$.workspaces,sessions:$.sessions,hiddenWorkspaceRoots:$.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:$.sessionsHasMoreByWorkspace})),g7=R(ia()),_7=R(ca()===`manual`?`manual`:`recent`);function nye(e){let t=Qi(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}var v7=R(nye(qi.pinnedSessions)),y7=R(Yi(qi.pinnedCollapsed)===`true`);function rye(e){v7.value=v7.value.includes(e)?v7.value.filter(t=>t!==e):[...v7.value,e],$i(qi.pinnedSessions,v7.value)}function iye(e){let t=new Set(v7.value),n=e.filter(e=>t.has(e));v7.value=[...n,...v7.value.filter(e=>!n.includes(e))],$i(qi.pinnedSessions,v7.value)}function aye(){y7.value=!y7.value,Xi(qi.pinnedCollapsed,String(y7.value))}s(()=>[h7.value.map(e=>e.id).join(`\0`),$.loading],([e,t])=>{if(t)return;let n=ua(e?e.split(`\0`):[],g7.value);n!==null&&(g7.value=n,aa(n))});var b7=L(()=>{let e=h7.value.map(e=>({id:e.id,name:e.name,root:e.root,shortPath:l_e(e.root,$.fsHome),sessionCount:e.sessionCount}));if(_7.value===`recent`){let t=new Map;for(let e of $.sessions){if(e.parentSessionId)continue;let n=m7(e),r=new Date(e.updatedAt).getTime();r>(t.get(n)??-1/0)&&t.set(n,r)}return pa(e,t)}return da(e,g7.value)}),x7=L(()=>{let e=$.activeWorkspaceId,t=b7.value;return e&&t.some(t=>t.id===e)?e:t[0]?.id??null});s(x7,e=>{e&&(Object.prototype.hasOwnProperty.call(c7.skillsByWorkspace.value,e)||c7.loadSkillsForWorkspace(e))},{immediate:!0});var oye=L(()=>{let e=x7.value;return e?b7.value.find(t=>t.id===e)??null:null}),sye=L(()=>{B5.value;let e=new Set(b7.value.map(e=>e.id)),t=new Map(b7.value.map(e=>[e.id,e.name]));return $.sessions.filter(t=>!t.parentSessionId&&e.has(m7(t))).map(e=>{let n=m7(e);return{id:e.id,title:e.title,time:z5(e.updatedAt),busy:R5(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason,lastPrompt:e.lastPrompt,workspaceId:n,workspaceName:t.get(n)}})}),cye=L(()=>{B5.value;let e=new Map;for(let t of $.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())){if(t.parentSessionId)continue;let n=m7(t),r={id:t.id,title:t.title,time:z5(t.updatedAt),busy:R5(t.id,t.mainTurnActive),pendingInteraction:t.pendingInteraction,lastTurnReason:t.lastTurnReason,updatedAt:t.updatedAt},i=e.get(n)??[];i.push(r),e.set(n,i)}return b7.value.map(t=>({workspace:t,sessions:e.get(t.id)??[],hasMore:$.sessionsHasMoreByWorkspace[t.id]??!1,loadingMore:$.sessionsLoadingMoreByWorkspace[t.id]??!1,initialCount:$.sessionsInitialCountByWorkspace[t.id]??5}))});function lye(e){g7.value=e,aa(e),_7.value!==`manual`&&(_7.value=`manual`,la(`manual`))}function uye(e){_7.value!==e&&(_7.value=e,la(e))}var S7=L(()=>{let e={};for(let[t,n]of Object.entries($.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(let[t,n]of Object.entries($.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),dye=L(()=>{let e={};for(let[t,n]of Object.entries($.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(let[t,n]of Object.entries($.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),fye=L(()=>{let e={};for(let[t,n]of Object.entries($.unreadBySession))n&&(e[t]=!0);return e}),pye=L(()=>{let e={},t=S7.value;for(let n of $.sessions){let r=t[n.id]??0;if(r<=0)continue;let i=m7(n);e[i]=(e[i]??0)+r}return e}),mye=L(()=>$.recentRoots),hye=L(()=>$.availableOpenInApps),gye=L(()=>$.serverCapabilities.fs_write===!0),C7=Mge(H5,L(()=>$.serverCapabilities.expert_talk_v1===!0),M5),w7=Vhe($,{taskPoller:$5,sideChat:Z5,modelProvider:c7,pushOperationFailure:M5,activity:s7,sessionsKnownEmpty:E5,setSessions:q8,updateSession:J8,upsertSessionFront:p_e,appendSession:m_e,forgetSession:$8,setActiveSessionId:Z8,updateSessionMessages:Q8,nextOptimisticMsgId:b5,getEventConn:()=>g5,syncSessionFromSnapshot:P5,reopenSession:G_e,hasLoadedMessages:V_e,refreshSessionStatus:s5,refreshSessionGoal:y_e,persistSessionProfile:c5,mergedWorkspaces:h7,workspacesView:b7,status:u7,workspaceIdForSession:m7,seedPermissionFromDaemonDefault:u_e,savePlanModeToStorage:B8,saveDynamicWorkflowModeToStorage:V8,saveGoalModeToStorage:H8,draftModes:W8,saveUnread:ta,saveActiveWorkspaceToStorage:c_e,saveHiddenWorkspacesToStorage:s_e,goalErrorMessage:R_e,resetFastMoon:D8.resetFastMoon,getExpertTalkArmId:C7.armIdForSession,onExpertTalkPromptAccepted:C7.promptAccepted,initialized:r5,connectIssue:i5,bootStage:a5,bootRetries:o5,selectedDiffPath:e5,fileDiffLines:t5,fileDiffLoading:n5});async function _ye(){if(C7.status.value?.activeRunId!==void 0){await C7.cancel();return}await w7.abortCurrentPrompt()}function vye(e,t){let n=A8.get(e);if(n!==void 0)return n;let r=(async()=>{try{return await w7.createDraftSession(e)===null?!1:(await C7.useForNextMessage(t),C7.status.value?.activation.state===`armed`)}catch(e){return M5(`expertOpinionSession`,e),!1}})();return A8.set(e,r),r.finally(()=>{A8.get(e)===r&&A8.delete(e)}),r}async function yye(){await w7.loadConfig(),await Promise.all([w7.checkAuth(),c7.loadModels(),c7.loadProviders()])}function bye(e,t){let n=$.sessions.find(t=>t.id===e);return n?w7.renameSession(e,Np(t,n.title)):Promise.resolve()}function T7(e){return e===$.activeSessionId&&typeof document<`u`&&document.visibilityState===`visible`&&document.hasFocus()}function xye(e){if($.turnActiveBySession[e]){let t={...$.turnActiveBySession};delete t[e],$.turnActiveBySession=t}$.inFlightBySession[e]&&($.inFlightBySession={...$.inFlightBySession,[e]:!1})}function Sye(e,t,n){let r=$.promptIdBySession[e];w7.finishPromptLocal(e,{turnWasActive:n}),c7.loadSkillsForSession(e),e===$.activeSessionId?(w7.loadGitStatus(e),s5(e)):t===`idle`&&($.unreadBySession={...$.unreadBySession,[e]:!0},ta({[e]:!0})),$me(t,($.approvalsBySession[e]??[]).length>0,($.questionsBySession[e]??[]).length>0)&&O8.maybeNotifyCompletion(e,{isUserWatching:T7(e),sessionTitle:$.sessions.find(t=>t.id===e)?.title??``,promptId:r,onClick:()=>{w7.selectSession(e)}}),t===`idle`&&k8.maybePlayCompletionSound()}function Cye(e,t){let n=t.questions[0],r=n?.header?.trim()??``,i=n?.question?.trim()??``,a=r&&i?`${r}: ${i}`:i||r;O8.maybeNotifyQuestion({isUserWatching:T7(e),sessionTitle:$.sessions.find(t=>t.id===e)?.title??``,questionPreview:a,questionId:t.questionId,onClick:()=>{w7.selectSession(e)}}),k8.maybePlayQuestionSound()}function wye(e,t){O8.maybeNotifyApproval({isUserWatching:T7(e),sessionTitle:$.sessions.find(t=>t.id===e)?.title??``,toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{w7.selectSession(e)}}),k8.maybePlayApprovalSound()}function E7(){return q_e(),{workspace:$_e,sessions:eve,activeSessionId:H5,workspacesView:b7,workspaceSortMode:_7,pinnedSessionIds:v7,pinnedCollapsed:y7,visibleWorkspace:oye,activeWorkspaceId:x7,sessionsForView:sye,workspaceGroups:cye,attentionBySession:S7,pendingBySession:dye,attentionByWorkspace:pye,unreadBySession:fye,recentRoots:mye,turns:hve,tasks:_ve,activeAppTasks:Q5,auxiliaryTranscripts:v5,todos:bve,goal:i7,dynamicWorkflows:r7,dynamicWorkflowMembersByToolCallId:yve,activationBadges:Hve,compaction:xve,status:u7,sessionCost:Zve,fileDiff:Xve,selectedDiffPath:e5,fileDiffLoading:n5,changes:Jve,gitInfo:l7,gitDiffStats:Yve,activePullRequest:qve,changesByPath:tye,pendingApprovals:Kve,availableOpenInApps:hye,fsWriteSupported:gye,expertTalk:C7,connection:Sve,loading:Cve,sessionLoading:wve,loadingMoreMessages:Tve,hasMoreMessages:Eve,loadMoreMessagesError:Dve,serverVersion:Ove,backend:kve,experimentalFlagStates:Ave,experimentalFlagState:a7,subagentModelPolicy:jve,subagentModelPolicySaving:Mve,saveSubagentModelPolicy:w7.saveSubagentModelPolicy,clearSubagentModelPolicy:w7.clearSubagentModelPolicy,reloadSubagentModelPolicy:w7.loadSubagentModelPolicy,dangerousBypassAuth:Nve,clearDangerousBypassAuth:Pve,initialized:r5,connectIssue:i5,bootStage:a5,bootRetries:o5,permission:Fve,thinking:Ive,planMode:o7,planArmed:Lve,sessionPlans:vve,dynamicWorkflowMode:Rve,goalMode:zve,towerMode:Bve,towerAvailable:Vve,queued:Uve,warnings:Wve,questions:Gve,activity:s7,turnActive:t7,inFlight:X5,working:gve,isStartingFirstPrompt:cve,fastMoon:D8.fastMoon,models:c7.models,starredModelIds:c7.starredModelIds,providers:c7.providers,uiFontSize:D8.uiFontSize,setUiFontSize:D8.setUiFontSize,conversationToc:u5,setConversationToc:S_e,turnFolding:p5,setTurnFolding:C_e,activityRunFolding:m5,setActivityRunFolding:w_e,colorScheme:D8.colorScheme,setColorScheme:D8.setColorScheme,accent:D8.accent,setAccent:D8.setAccent,notifyOnComplete:O8.notifyOnComplete,notifyOnQuestion:O8.notifyOnQuestion,notifyOnApproval:O8.notifyOnApproval,notifyPermission:O8.notifyPermission,setNotifyOnComplete:O8.setNotifyOnComplete,setNotifyOnQuestion:O8.setNotifyOnQuestion,setNotifyOnApproval:O8.setNotifyOnApproval,soundOnComplete:k8.soundOnComplete,setSoundOnComplete:k8.setSoundOnComplete,onboarded:h5,setOnboarded:E_e,onboardingCompleted:p7,appState:Qve,load:w7.load,selectSession:w7.selectSession,clearActiveSession:w7.clearActiveSession,loadOlderMessages:w7.loadOlderMessages,loadWorkspaces:w7.loadWorkspaces,loadMoreSessions:w7.loadMoreSessions,loadAllSessions:w7.loadAllSessions,selectWorkspace:w7.selectWorkspace,openWorkspace:w7.openWorkspace,openWorkspaceDraft:w7.openWorkspaceDraft,startExpertOpinionSession:vye,startSessionAndSendPrompt:w7.startSessionAndSendPrompt,startSessionAndActivateSkill:w7.startSessionAndActivateSkill,startSessionAndOpenSideChat:w7.startSessionAndOpenSideChat,addWorkspaceByPath:w7.addWorkspaceByPath,browseFs:w7.browseFs,getFsHome:w7.getFsHome,sendPrompt:w7.sendPrompt,steerPrompt:w7.steerPrompt,steerQueued:w7.steerQueued,sideChatVisible:Z5.sideChatVisible,sideChatSessionId:Z5.sideChatSessionId,sideChatTurns:Z5.sideChatTurns,sideChatRunning:Z5.sideChatRunning,sideChatSending:Z5.sideChatSending,openSideChat:Z5.openSideChat,closeSideChat:Z5.closeSideChat,sendSideChatPrompt:Z5.sendSideChatPrompt,uploadImage:w7.uploadImage,abortCurrentPrompt:_ye,respondApproval:w7.respondApproval,respondQuestion:w7.respondQuestion,dismissQuestion:w7.dismissQuestion,pendingQuestionActions:w7.pendingQuestionActions,pendingApprovalActions:w7.pendingApprovalActions,cancelTask:w7.cancelTask,detachTask:w7.detachTask,setPermission:w7.setPermission,setThinking:c7.setThinking,setPlanMode:w7.setPlanMode,togglePlanMode:w7.togglePlanMode,setTowerMode:w7.setTowerMode,toggleTowerMode:w7.toggleTowerMode,setDynamicWorkflowMode:w7.setDynamicWorkflowMode,toggleDynamicWorkflowMode:w7.toggleDynamicWorkflowMode,setGoalMode:w7.setGoalMode,toggleGoalMode:w7.toggleGoalMode,createGoal:w7.createGoal,controlGoal:w7.controlGoal,enqueue:w7.enqueue,dismissWarning:w7.dismissWarning,renameSession:w7.renameSession,renameWorkspace:w7.renameWorkspace,deleteWorkspace:w7.deleteWorkspace,reorderWorkspaces:lye,setWorkspaceSortMode:uye,togglePinnedSession:rye,reorderPinnedSessions:iye,togglePinnedCollapsed:aye,setSessionEmoji:bye,lastDeletedSessionId:_5,archiveSession:w7.archiveSession,deleteSession:w7.deleteSession,cleanupDeletedSession:w7.cleanupDeletedSession,exportSession:w7.exportSession,restoreSession:w7.restoreSession,loadArchivedSessions:w7.loadArchivedSessions,compact:w7.compact,forkSession:w7.forkSession,generateSessionTitle:w7.generateSessionTitle,undo:w7.undo,unqueue:w7.unqueue,reorderQueue:w7.reorderQueue,searchFiles:w7.searchFiles,loadGitStatus:w7.loadGitStatus,loadFileDiff:w7.loadFileDiff,clearFileDiff:w7.clearFileDiff,listDir:w7.listDir,readFileContent:w7.readFileContent,getFileDownloadUrl:w7.getFileDownloadUrl,openWorkspaceFile:w7.openWorkspaceFile,openInApp:w7.openInApp,revealWorkspaceFile:w7.revealWorkspaceFile,revealSavedPlan:w7.revealSavedPlan,resolveImageUrl:w7.resolveImageUrl,getFileUrl:e=>Q().getFileUrl(e),loadModels:c7.loadModels,loadProviders:c7.loadProviders,skills:tve,skillsLoadingBySession:U5,connectors:W5,connectorsLoading:G5,plugins:K5,pluginsLoading:q5,activeSessionCapabilities:nve,loadCapabilityData:ove,updateCapabilities:sve,setPluginEnabled:ave,activateSkill:c7.activateSkill,setModel:c7.setModel,toggleStarModel:c7.toggleStarModel,addProvider:c7.addProvider,deleteProvider:c7.deleteProvider,refreshProvider:c7.refreshProvider,refreshAllProviders:c7.refreshAllProviders,authReady:d7,defaultModel:$ve,config:eye,updateConfig:w7.updateConfig,refreshServerMeta:w7.refreshServerMeta,checkAuth:w7.checkAuth,refreshRuntimeState:yye}}var Tye=[`aria-expanded`,`aria-label`],Eye={class:`capability-trigger-label`},Dye={class:`capability-panel`},Oye={class:`capability-viewport`},kye={class:`capability-view`},Aye={key:1,class:`capability-group`},jye={class:`capability-group-title`},Mye={class:`capability-caption`},Nye={key:0,class:`capability-loading`},Pye={class:`capability-view capability-view-secondary`},Fye={class:`capability-caption`},Iye={key:0,class:`capability-loading`},Lye={class:`capability-caption`},Rye={key:0,class:`capability-loading`},zye=Y(G({__name:`CapabilityMenu`,props:{sessionId:{},triggerless:{type:Boolean}},setup(e,{expose:t}){let n=e,{t:r}=J(),i=E7(),a=R(null),o=R(null),l=R(!1),u=R(`root`),d=R([]),f=L(()=>n.sessionId===i.activeSessionId.value?i.skills.value:[]),p=L(()=>{let e=n.sessionId;return e?i.skillsLoadingBySession.value[e]===!0:!1}),m=L(()=>i.connectors.value),h=L(()=>i.connectorsLoading.value),g=L(()=>i.plugins.value),y=L(()=>i.pluginsLoading.value),b=L(()=>n.sessionId===i.activeSessionId.value?i.activeSessionCapabilities.value:{}),x=L(()=>p.value||f.value.length>0),S=L(()=>h.value||m.value.length>0),C=L(()=>y.value||g.value.length>0),w=L(()=>{switch(u.value){case`skills`:return r(`capabilityMenu.skills.title`);case`plugins`:return r(`capabilityMenu.plugins.title`);case`root`:return``}}),T=L(()=>{switch(u.value){case`skills`:return f.value.length;case`plugins`:return g.value.length;case`root`:return 0}});function D(){d.value=b.value.mcpServers===void 0?m.value.map(e=>e.id):[...b.value.mcpServers]}s([()=>n.sessionId,m,b],D,{immediate:!0}),s([f,p,g,y],()=>{u.value===`skills`&&!p.value&&f.value.length===0&&(u.value=`root`),u.value===`plugins`&&!y.value&&g.value.length===0&&(u.value=`root`)});function O(){if(l.value=!l.value,!l.value){u.value=`root`;return}n.sessionId&&i.loadCapabilityData(n.sessionId)}t({toggleOpen:O});function A(){l.value=!1,u.value=`root`}let j={tools:Promise.resolve(),mcpServers:Promise.resolve()},N={tools:0,mcpServers:0};function ee(e,t,r){let a=++N[e],o=n.sessionId,s=j[e].then(async()=>{if(n.sessionId===o)try{await i.updateCapabilities({[e]:[...t.value]})}catch{a===N[e]&&n.sessionId===o&&(t.value=r)}});return j[e]=s,s}function I(e,t){let n=[...d.value],r=new Set(n);return t?r.add(e):r.delete(e),d.value=[...r],ee(`mcpServers`,d,n)}function te(e,t){i.setPluginEnabled(e,t)}return(e,t)=>(c(),W(`div`,{ref_key:`rootRef`,ref:a,class:`capability-control`},[n.triggerless?E(``,!0):(c(),W(`button`,{key:0,ref_key:`triggerRef`,ref:o,type:`button`,class:V([`capability-trigger`,{open:l.value}]),"aria-expanded":l.value,"aria-haspopup":`dialog`,"aria-label":z(r)(`capabilityMenu.triggerLabel`),onClick:H(O,[`stop`])},[t[5]||=k(``,1),F(`span`,Eye,U(z(r)(`capabilityMenu.trigger`)),1)],10,Tye)),v(Ip,{anchor:n.triggerless?a.value:o.value,open:l.value,label:z(r)(`capabilityMenu.triggerLabel`),onClose:A},{default:B(()=>[F(`div`,Dye,[F(`div`,Oye,[F(`div`,{class:V([`capability-track`,{"is-drilled":u.value!==`root`}])},[F(`div`,kye,[x.value?(c(),P(u6,{key:0,count:f.value.length,onClick:t[0]||=e=>u.value=`skills`},{label:B(()=>[K(U(z(r)(`capabilityMenu.skills.title`)),1)]),trailing:B(()=>[...t[6]||=[F(`svg`,{class:`chevron`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`path`,{d:`m6 3 5 5-5 5`})],-1)]]),_:1},8,[`count`])):E(``,!0),S.value?(c(),W(`div`,Aye,[F(`div`,jye,U(z(r)(`capabilityMenu.mcp.title`)),1),F(`p`,Mye,U(z(r)(`capabilityMenu.mcp.caption`)),1),h.value?(c(),W(`div`,Nye,[v(l6,{label:z(r)(`capabilityMenu.loading`)},null,8,[`label`])])):(c(!0),W(M,{key:1},_(m.value,e=>(c(),P(u6,{key:e.id,class:`mcp-row`,selected:d.value.includes(e.id),title:e.name,onClick:t=>void I(e.id,!d.value.includes(e.id))},{label:B(()=>[K(U(e.name),1)]),trailing:B(()=>[v(d6,{"model-value":d.value.includes(e.id),"aria-label":z(r)(`capabilityMenu.mcp.toggle`,{name:e.name}),onClick:t[1]||=H(()=>{},[`stop`]),"onUpdate:modelValue":t=>void I(e.id,t)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])]),_:2},1032,[`selected`,`title`,`onClick`]))),128))])):E(``,!0),C.value?(c(),P(u6,{key:2,count:g.value.length,onClick:t[2]||=e=>u.value=`plugins`},{label:B(()=>[K(U(z(r)(`capabilityMenu.plugins.title`)),1)]),trailing:B(()=>[...t[7]||=[F(`svg`,{class:`chevron`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`path`,{d:`m6 3 5 5-5 5`})],-1)]]),_:1},8,[`count`])):E(``,!0)]),F(`div`,Pye,[u.value===`root`?E(``,!0):(c(),P(u6,{key:0,class:`capability-back`,count:T.value,onClick:t[3]||=e=>u.value=`root`},{leading:B(()=>[...t[8]||=[F(`svg`,{class:`back-chevron`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`path`,{d:`m10 3-5 5 5 5`})],-1)]]),label:B(()=>[K(U(w.value||z(r)(`capabilityMenu.back`)),1)]),_:1},8,[`count`])),u.value===`skills`?(c(),W(M,{key:1},[F(`p`,Fye,U(z(r)(`capabilityMenu.skills.caption`)),1),p.value?(c(),W(`div`,Iye,[v(l6,{label:z(r)(`capabilityMenu.loading`)},null,8,[`label`])])):(c(!0),W(M,{key:1},_(f.value,e=>(c(),P(u6,{key:e.name,class:`skill-row`,disabled:``,title:e.description},{label:B(()=>[K(U(e.name),1)]),_:2},1032,[`title`]))),128))],64)):u.value===`plugins`?(c(),W(M,{key:2},[F(`p`,Lye,U(z(r)(`capabilityMenu.plugins.caption`)),1),y.value?(c(),W(`div`,Rye,[v(l6,{label:z(r)(`capabilityMenu.loading`)},null,8,[`label`])])):(c(!0),W(M,{key:1},_(g.value,e=>(c(),P(u6,{key:e.id,class:`plugin-row`,selected:e.enabled,title:e.displayName,onClick:t=>te(e.id,!e.enabled)},{label:B(()=>[K(U(e.displayName),1)]),trailing:B(()=>[v(d6,{"model-value":e.enabled,"aria-label":z(r)(`capabilityMenu.plugins.toggle`,{name:e.displayName}),onClick:t[4]||=H(()=>{},[`stop`]),"onUpdate:modelValue":t=>te(e.id,t)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])]),_:2},1032,[`selected`,`title`,`onClick`]))),128))],64)):E(``,!0)])],2)])])]),_:1},8,[`anchor`,`open`,`label`])],512))}}),[[`__scopeId`,`data-v-ff3a96c4`]]),D7=Symbol(`expertTalk`),Bye={key:0,class:`ui-field__label`},Vye={key:1,class:`ui-field__error`},Hye={key:2,class:`ui-field__hint`},O7=Y(G({__name:`Field`,props:{label:{},hint:{},error:{}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-field`,{"has-error":!!e.error}])},[e.label?(c(),W(`label`,Bye,U(e.label),1)):E(``,!0),me(t.$slots,`default`,{},void 0,!0),e.error?(c(),W(`span`,Vye,U(e.error),1)):e.hint?(c(),W(`span`,Hye,U(e.hint),1)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-bd93f701`]]),Uye=[`aria-expanded`,`aria-label`,`disabled`],Wye=[`aria-label`],Gye=[`aria-label`],Kye=[`aria-selected`],qye={class:`sm-picker__option-label`},Jye={key:1,class:`sm-picker__divider`},Yye={class:`sm-picker__group`},Xye=[`aria-selected`,`onMouseenter`,`onClick`],Zye={class:`sm-picker__option-label`},Qye=[`aria-label`],$ye={class:`sm-picker__group`},ebe=[`aria-selected`,`onMouseenter`,`onClick`],tbe={class:`sm-picker__option-label`},nbe=250,rbe=188,k7=Y(G({__name:`SecondaryModelPicker`,props:{modelValue:{},effort:{},groups:{},modelInfoById:{},disabled:{type:Boolean},allowEmpty:{type:Boolean,default:!0},emptyLabel:{},ariaLabel:{}},emits:[`inherit`,`select`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=`sm-picker-${Math.random().toString(36).slice(2,9)}`,s=R(null),l=R(null),u=R(null),d=R(!1),f=R(!1),m=R({}),g=R(null),y=R(``),b=R(0),x=R(`models`),S=R(0),C=R(0),w=R(`right`),T=new Map,D=null,O=L(()=>[...r.allowEmpty?[{id:``,label:a(`settings.noSecondaryModel`)}]:[],...r.groups.flatMap(e=>e.options)]),k=L(()=>r.emptyLabel??a(`settings.noSecondaryModel`)),A=L(()=>r.modelValue?O.value.find(e=>e.id===r.modelValue)?.label??r.modelValue:``),j=L(()=>r.modelValue?r.effort?`${A.value} · ${r.effort}`:A.value:k.value),N=L(()=>{let e=g.value;if(e===null||e===``)return[];let t=Q3(r.modelInfoById[e]),n=r.effort===``?[null,...t]:[...t];return r.modelValue===e&&r.effort!==``&&!t.includes(r.effort)&&n.push(r.effort),n});function I(e){return r.modelValue===g.value?e===null?r.effort===``:r.effort===e:!1}function te(){let e=N.value.findIndex(I);return e>=0?e:0}function ne(e,t){e instanceof HTMLElement?T.set(t,e):T.delete(t)}function re(){D!==null&&(clearTimeout(D),D=null)}function ie(){re(),D=setTimeout(()=>{g.value=null,x.value===`efforts`&&(x.value=`models`)},nbe)}function oe(e){e!==y.value&&(y.value=e,b.value=Math.max(0,O.value.findIndex(t=>t.id===e)))}function se(){let e=s.value,t=l.value;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.offsetHeight;f.value=window.innerHeight-n.bottomr;let i=Math.max(8,window.innerWidth-n.right);m.value=f.value?{right:`${i}px`,bottom:`${window.innerHeight-n.top+4}px`,top:`auto`}:{right:`${i}px`,top:`${n.bottom+4}px`,bottom:`auto`}}function ce(){let e=l.value,t=g.value===null?void 0:T.get(g.value);if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=u.value?.offsetHeight??0,a=Math.max(0,window.innerHeight-8-i-n.top);C.value=Math.max(0,Math.min(r.top-n.top-4,e.offsetHeight-40,a));let o=window.innerWidth-n.right;w.value=o>=rbe||o>=n.left?`right`:`left`}function B(){d.value||r.disabled||(d.value=!0,y.value=r.modelValue||O.value[0]?.id||``,b.value=Math.max(0,O.value.findIndex(e=>e.id===y.value)),g.value=null,x.value=`models`,n(se))}function le({restoreFocus:e=!1}={}){d.value&&(re(),d.value=!1,g.value=null,e&&n(()=>s.value?.focus()))}function ue(){d.value?le({restoreFocus:!0}):B()}function de(){g.value=null,x.value=`models`}function fe(e,{moveFocus:t=!1}={}){if(oe(e),re(),e===``){g.value=null,x.value=`models`;return}g.value=e,n(ce),t&&(x.value=`efforts`,S.value=te())}function H(e){let t=g.value;if(t===null)return;let n={model:t,...e===null?{}:{effort:e}};(n.model!==r.modelValue||(n.effort??``)!==r.effort)&&i(`select`,n),le({restoreFocus:!0})}function G(){i(`inherit`),le({restoreFocus:!0})}function K(){n(()=>{l.value?.querySelector(`.sm-picker__option.is-kb-active`)?.scrollIntoView({block:`nearest`})})}function pe(e){let t=O.value;if(t.length===0)return;let n=t[(b.value+e+t.length)%t.length];oe(n.id),g.value!==null&&fe(n.id),K()}function me(e){let t=N.value;t.length!==0&&(S.value=(S.value+e+t.length)%t.length,K())}function he(e){if(!d.value){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),B());return}if(e.key===`ArrowDown`)e.preventDefault(),x.value===`models`?pe(1):me(1);else if(e.key===`ArrowUp`)e.preventDefault(),x.value===`models`?pe(-1):me(-1);else if(e.key===`ArrowRight`)e.preventDefault(),y.value!==``&&fe(y.value,{moveFocus:!0});else if(e.key===`ArrowLeft`)e.preventDefault(),g.value!==null&&de();else if(e.key===`Enter`||e.key===` `)e.preventDefault(),x.value===`models`&&y.value===``?G():x.value===`models`?fe(y.value,{moveFocus:!0}):H(N.value[S.value]??null);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`;if(x.value===`models`){let e=O.value;if(e.length===0)return;let n=(t?e[0]:e.at(-1)).id;oe(n),g.value!==null&&fe(n)}else S.value=t?0:N.value.length-1;K()}else e.key===`Escape`&&(e.preventDefault(),le({restoreFocus:!0}))}function ge(e){let t=e.target;t instanceof Node&&(s.value?.contains(t)||l.value?.contains(t)||le())}function _e(e){if(d.value){if(l.value?.contains(e.target instanceof Node?e.target:null)){ce();return}le(),se()}}function ve(){d.value&&se()}return p(()=>{document.addEventListener(`pointerdown`,ge),document.addEventListener(`scroll`,_e,!0),window.addEventListener(`resize`,ve)}),h(()=>{document.removeEventListener(`pointerdown`,ge),document.removeEventListener(`scroll`,_e,!0),window.removeEventListener(`resize`,ve),re()}),(t,n)=>(c(),W(`div`,{class:V([`sm-picker`,{"is-open":d.value}])},[F(`button`,{ref_key:`triggerRef`,ref:s,class:`sm-picker__trigger`,type:`button`,role:`combobox`,"aria-controls":o,"aria-expanded":d.value,"aria-haspopup":`dialog`,"aria-label":e.ariaLabel??z(a)(`settings.secondaryModel`),disabled:e.disabled,onClick:ue,onKeydown:he},[F(`span`,{class:V([`sm-picker__value`,{"is-placeholder":!e.modelValue}])},[F(`span`,null,U(j.value),1)],2),v(X,{class:`sm-picker__chevron`,name:`chevron-down`,size:`sm`})],40,Uye),(c(),P(ee,{to:`body`},[d.value?(c(),W(`div`,{key:0,id:o,ref_key:`menuRef`,ref:l,class:V([`sm-picker__menu`,{"sm-picker__menu--up":f.value}]),style:ae(m.value),role:`dialog`,"aria-label":e.ariaLabel??z(a)(`settings.secondaryModel`)},[F(`div`,{class:`sm-picker__models`,role:`listbox`,"aria-label":e.ariaLabel??z(a)(`settings.secondaryModel`)},[e.allowEmpty?(c(),W(`button`,{key:0,ref:e=>ne(e,``),type:`button`,class:V([`sm-picker__option`,{"is-selected":e.modelValue===``,"is-active":y.value===``,"is-kb-active":x.value===`models`&&y.value===``}]),role:`option`,"aria-selected":e.modelValue===``,onMouseenter:n[0]||=e=>fe(``),onClick:G},[v(X,{class:`sm-picker__check`,name:`check`,size:`sm`}),F(`span`,qye,U(z(a)(`settings.noSecondaryModel`)),1)],42,Kye)):E(``,!0),e.allowEmpty?(c(),W(`div`,Jye)):E(``,!0),(c(!0),W(M,null,_(e.groups,t=>(c(),W(M,{key:t.provider},[F(`div`,Yye,U(t.provider),1),(c(!0),W(M,null,_(t.options,t=>(c(),W(`button`,{key:t.id,ref_for:!0,ref:e=>ne(e,t.id),type:`button`,class:V([`sm-picker__option`,{"is-selected":t.id===e.modelValue,"is-active":t.id===y.value,"is-kb-active":x.value===`models`&&t.id===y.value}]),role:`option`,"aria-selected":t.id===e.modelValue,onMouseenter:e=>fe(t.id),onMouseleave:ie,onClick:e=>fe(t.id,{moveFocus:!0})},[v(X,{class:`sm-picker__check`,name:`check`,size:`sm`}),F(`span`,Zye,U(t.label),1),v(X,{class:`sm-picker__flyout-caret`,name:`chevron-right`,size:`sm`})],42,Xye))),128))],64))),128))],8,Gye),g.value===null?E(``,!0):(c(),W(`div`,{key:0,ref_key:`flyoutRef`,ref:u,class:V([`sm-picker__flyout`,`sm-picker__flyout--${w.value}`]),style:ae({top:`${C.value}px`}),role:`listbox`,"aria-label":z(a)(`settings.secondaryModelEffort`),onMouseenter:re,onMouseleave:ie},[F(`div`,$ye,U(z(a)(`settings.secondaryModelEffort`)),1),(c(!0),W(M,null,_(N.value,(e,t)=>(c(),W(`button`,{key:e??`__default__`,type:`button`,class:V([`sm-picker__option`,{"is-selected":I(e),"is-kb-active":x.value===`efforts`&&t===S.value,"is-muted":e===null}]),role:`option`,"aria-selected":I(e),onMouseenter:e=>{x.value=`efforts`,S.value=t},onClick:t=>H(e)},[v(X,{class:`sm-picker__check`,name:`check`,size:`sm`}),F(`span`,tbe,U(e??z(a)(`settings.secondaryModelEffortAuto`)),1)],42,ebe))),128))],46,Qye))],14,Wye)):E(``,!0)]))],2))}}),[[`__scopeId`,`data-v-c4c36368`]]),ibe=[`aria-label`],abe={class:`expert-talk__one-shot-title`},obe={class:`expert-talk__one-shot-pair`},sbe={class:`expert-talk__one-shot-lead`},cbe={class:`expert-talk__one-shot-peer`},lbe={class:`expert-talk__one-shot-scope`},ube={class:`expert-talk`},dbe=[`aria-label`],fbe={class:`expert-talk__pair`,"aria-labelledby":`expert-talk-pair-title`},pbe={id:`expert-talk-pair-title`,class:`expert-talk__section-title`},mbe={class:`expert-talk__fields`},hbe={class:`expert-talk__exchange`,"aria-hidden":`true`},gbe={key:0,class:`expert-talk__error`,role:`alert`},_be={key:1,class:`expert-talk__error`,role:`alert`},vbe={key:2,class:`expert-talk__error`,role:`alert`},ybe={class:`expert-talk__disclosure`},bbe={key:2,class:`expert-talk__error`,role:`alert`},xbe={class:`expert-talk__actions`},A7=Y(G({__name:`ExpertTalkControl`,props:{models:{},trigger:{default:`pill`}},emits:[`take`,`build`],setup(e,{expose:t,emit:n}){let r=i(()=>he(()=>Promise.resolve().then(()=>yue),void 0)),a=e,o=n,l=m(D7),{t:u}=J(),d=R(!1),f=R(``),p=R(``),h=R(``),g=R(``),_=L(()=>a.models.filter(e=>e.maxContextSize>0&&(e.capabilities??[]).some(e=>e.trim().toLowerCase().replaceAll(`-`,`_`)===`tool_use`))),y=L(()=>{let e=new Map;for(let t of _.value){let n=e.get(t.provider)??[];n.push(t),e.set(t.provider,n)}return Array.from(e.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({provider:e,models:t.toSorted((e,t)=>te(e.id).localeCompare(te(t.id)))}))}),b=L(()=>y.value.map(e=>({provider:e.provider,options:e.models.map(e=>({id:e.id,label:te(e.id)}))}))),x=L(()=>Object.fromEntries(a.models.map(e=>[e.id,e]))),S=L(()=>l?.status.value),C=L(()=>l?.run.value),w=L(()=>l?.available.value===!0),T=L(()=>C.value?.state===`running`),D=L(()=>S.value?.activation.state===`armed`),O=L(()=>S.value?.config),k=L(()=>l?.preferredPair.value??O.value),A=L(()=>O.value===null||O.value===void 0?``:te(O.value.fusionLeadModelId)),j=L(()=>O.value===null||O.value===void 0?``:te(O.value.peerModelId)),N=L(()=>f.value.length>0&&p.value.length>0&&f.value!==p.value),ee=L(()=>{let e=C.value?.state;return e===`failed`||e===`cancelled`||e===`interrupted`}),I=L(()=>D.value?u(`expertTalk.next`):T.value?u(`expertTalk.stage.${C.value?.stage??`opening`}`):u(`expertTalk.title`));function te(e){let t=a.models.find(t=>t.id===e);return t?.displayName??t?.model??e}function ne(){let e=k.value;f.value=e?.fusionLeadModelId??``,p.value=e?.peerModelId??``,h.value=e?.fusionLeadThinkingEffort??``,g.value=e?.peerThinkingEffort??``}s(d,e=>{e&&ne()});function re(){w.value&&(d.value=!0)}async function ie(){let e=k.value;if(!l||e==null||T.value||D.value){re();return}await l.useForNextMessage(e)}function ae(){return!l||!T.value?!1:(l.cancel(),!0)}t({available:w,openDialog:re,activate:ie,cancelActive:ae});async function oe(){!l||!N.value||(await l.useForNextMessage({fusionLeadModelId:f.value,peerModelId:p.value,fusionLeadThinkingEffort:h.value||void 0,peerThinkingEffort:g.value||void 0}),l.error.value===void 0&&(d.value=!1))}function se(e){f.value=e.model,h.value=e.effort??``}function ce(e){p.value=e.model,g.value=e.effort??``}async function le(e,t){l&&(D.value&&(await l.disarm(),D.value||l.error.value!==void 0)||(o(e===`take`?`take`:`build`,t),d.value=!1))}return(t,n)=>w.value?(c(),W(M,{key:0},[e.trigger===`widget`&&D.value?(c(),W(`button`,{key:0,type:`button`,class:`expert-talk__one-shot`,"aria-label":z(u)(`expertTalk.armedLabel`,{lead:A.value,peer:j.value}),onClick:re},[F(`span`,abe,[v(X,{name:`sparkles`,size:`sm`}),K(` `+U(z(u)(`expertTalk.oneShot`)),1)]),F(`span`,obe,[F(`span`,sbe,`◆ `+U(A.value),1),n[7]||=F(`span`,{"aria-hidden":`true`},`⊕`,-1),F(`span`,cbe,`▲ `+U(j.value),1)]),F(`span`,lbe,U(z(u)(`expertTalk.oneShotScope`)),1)],8,ibe)):e.trigger===`launcher`?(c(),W(`button`,{key:1,type:`button`,class:`expert-talk__launcher`,"aria-haspopup":`dialog`,onClick:re},[v(X,{name:`sparkles`,size:`md`}),F(`span`,null,U(I.value),1)])):e.trigger===`pill`&&T.value?(c(),P(yD,{key:2,active:``,onClick:re},{default:B(()=>[v(X,{name:`sparkles`,size:`sm`}),F(`span`,null,U(I.value),1)]),_:1})):E(``,!0),v(Bf,{open:d.value,"onUpdate:open":n[6]||=e=>d.value=e,title:z(u)(`expertTalk.title`),description:z(u)(`expertTalk.description`),size:`xl`},{foot:B(()=>[F(`div`,xbe,[S.value?.config&&!T.value&&!D.value?(c(),P(pD,{key:0,variant:`ghost`,disabled:z(l)?.busy.value,onClick:n[2]||=e=>z(l)?.clear()},{default:B(()=>[K(U(z(u)(`expertTalk.clear`)),1)]),_:1},8,[`disabled`])):E(``,!0),D.value?(c(),P(pD,{key:1,variant:`secondary`,loading:z(l)?.busy.value,onClick:n[3]||=e=>z(l)?.disarm()},{default:B(()=>[K(U(z(u)(`expertTalk.disarm`)),1)]),_:1},8,[`loading`])):T.value?(c(),P(pD,{key:2,variant:`danger-soft`,loading:z(l)?.busy.value,onClick:n[4]||=e=>z(l)?.cancel()},{default:B(()=>[K(U(z(u)(`expertTalk.stop`)),1)]),_:1},8,[`loading`])):ee.value&&C.value?.error?.retryable?(c(),P(pD,{key:3,variant:`secondary`,loading:z(l)?.busy.value,onClick:n[5]||=e=>z(l)?.retry()},{default:B(()=>[K(U(z(u)(`expertTalk.retry`)),1)]),_:1},8,[`loading`])):E(``,!0),!T.value&&!D.value?(c(),P(pD,{key:4,disabled:!N.value||_.value.length<2,loading:z(l)?.busy.value,onClick:oe},{default:B(()=>[v(X,{name:`sparkles`,size:`sm`}),K(` `+U(z(u)(`expertTalk.useNext`)),1)]),_:1},8,[`disabled`,`loading`])):E(``,!0)])]),default:B(()=>[F(`div`,ube,[!S.value?.config&&!C.value?(c(),W(`section`,{key:0,class:`expert-talk__boot`,"aria-label":z(u)(`expertTalk.bootTitle`)},[F(`strong`,null,U(z(u)(`expertTalk.bootTitle`)),1),F(`span`,null,U(z(u)(`expertTalk.bootSubtitle`)),1),n[8]||=F(`span`,{class:`expert-talk__boot-pair`,"aria-hidden":`true`},`●\xA0 + \xA0●`,-1)],8,dbe)):E(``,!0),F(`section`,fbe,[F(`div`,pbe,U(z(u)(`expertTalk.pair`)),1),F(`div`,mbe,[v(O7,{label:z(u)(`expertTalk.lead`),hint:z(u)(`expertTalk.leadHint`)},{default:B(()=>[v(k7,{class:`expert-talk__model-select`,"model-value":f.value,effort:h.value,groups:b.value,"model-info-by-id":x.value,"allow-empty":!1,"empty-label":z(u)(`expertTalk.selectModel`),"aria-label":z(u)(`expertTalk.lead`),disabled:T.value||D.value||z(l)?.busy.value,onSelect:se},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`]),F(`span`,hbe,[v(X,{name:`chevron-right`,size:`md`})]),v(O7,{label:z(u)(`expertTalk.peer`),hint:z(u)(`expertTalk.peerHint`)},{default:B(()=>[v(k7,{class:`expert-talk__model-select`,"model-value":p.value,effort:g.value,groups:b.value,"model-info-by-id":x.value,"allow-empty":!1,"empty-label":z(u)(`expertTalk.selectModel`),"aria-label":z(u)(`expertTalk.peer`),disabled:T.value||D.value||z(l)?.busy.value,onSelect:ce},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`])]),_.value.length<2?(c(),W(`p`,gbe,U(z(u)(`expertTalk.modelsRequired`)),1)):N.value?E(``,!0):(c(),W(`p`,_be,U(z(u)(`expertTalk.distinctRequired`)),1)),S.value?.pairValidation.state!==`valid`&&S.value?.pairValidation.reason?(c(),W(`p`,vbe,U(S.value.pairValidation.reason),1)):E(``,!0)]),F(`section`,ybe,[v(X,{name:`info`,size:`md`}),F(`span`,null,U(z(u)(`expertTalk.disclosure`)),1)]),C.value?(c(),P(z(r),{key:1,run:C.value,models:_.value,onTake:n[0]||=e=>le(`take`,e),onBuild:n[1]||=e=>le(`build`,e)},null,8,[`run`,`models`])):E(``,!0),z(l)?.error.value?(c(),W(`p`,bbe,U(z(l).error.value),1)):E(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64)):E(``,!0)}}),[[`__scopeId`,`data-v-74ffa547`]]),j7=0,M7=null;function N7(){function e(){typeof document>`u`||(j7+=1,j7===1&&(M7=document.body.style.overflow,document.body.style.overflow=`hidden`))}function t(){j7<=0||(--j7,j7===0&&typeof document<`u`&&(document.body.style.overflow=M7??``,M7=null))}return{lock:e,unlock:t}}var Sbe={key:0,class:`sheet-root`},Cbe=[`aria-label`],wbe=[`aria-label`],Tbe={key:0,class:`sheet-head`},Ebe={class:`sheet-title`},Dbe={class:`sheet-body`},P7=Y(G({__name:`BottomSheet`,props:{modelValue:{type:Boolean},title:{default:``},closeOnEsc:{type:Boolean,default:!0}},emits:[`update:modelValue`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,{lock:a,unlock:o}=N7();function l(){i(`update:modelValue`,!1),i(`close`)}function u(e){e.key===`Escape`&&r.closeOnEsc&&l()}return s(()=>r.modelValue,e=>{typeof document>`u`||(e?(a(),document.addEventListener(`keydown`,u)):(o(),document.removeEventListener(`keydown`,u)))},{immediate:!0}),h(()=>{typeof document<`u`&&(o(),document.removeEventListener(`keydown`,u))}),(t,r)=>(c(),P(oe,{name:`sheet`},{default:B(()=>[e.modelValue?(c(),W(`div`,Sbe,[F(`div`,{class:`sheet-scrim`,onClick:l}),F(`div`,{class:`sheet-panel`,role:`dialog`,"aria-label":e.title||z(n)(`mobile.sheetLabel`)},[F(`button`,{type:`button`,class:`sheet-grab`,"aria-label":z(n)(`mobile.closeSheet`),onClick:l},null,8,wbe),e.title?(c(),W(`div`,Tbe,[F(`span`,Ebe,U(e.title),1)])):E(``,!0),F(`div`,Dbe,[me(t.$slots,`default`,{},void 0,!0)])],8,Cbe)])):E(``,!0)]),_:3}))}}),[[`__scopeId`,`data-v-92ecd88c`]]),Obe={class:`ui-toast__icon`,"aria-hidden":`true`},kbe={class:`ui-toast__body`},Abe={class:`ui-toast__title`},jbe={key:0,class:`ui-toast__count`},Mbe={key:0,class:`ui-toast__msg`},F7=Y(G({__name:`Toast`,props:{variant:{default:`info`},title:{},message:{},dismissLabel:{default:`Dismiss`},count:{default:1}},emits:[`dismiss`],setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-toast`,`ui-toast--${e.variant}`])},[F(`span`,Obe,[me(t.$slots,`icon`,{},()=>[e.variant===`success`?(c(),P(X,{key:0,name:`check`})):e.variant===`danger`?(c(),P(X,{key:1,name:`close`})):e.variant===`warning`?(c(),P(X,{key:2,name:`alert-triangle`})):(c(),P(X,{key:3,name:`info`}))],!0)]),F(`div`,kbe,[F(`div`,Abe,[K(U(e.title),1),e.count>1?(c(),W(`span`,jbe,`×`+U(e.count),1)):E(``,!0)]),e.message?(c(),W(`div`,Mbe,U(e.message),1)):E(``,!0),me(t.$slots,`default`,{},void 0,!0)]),v(Ca,{class:`ui-toast__close`,size:`sm`,label:e.dismissLabel,onClick:n[0]||=e=>t.$emit(`dismiss`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])],2))}}),[[`__scopeId`,`data-v-633d877d`]]),Nbe={class:`att-lightbox-card`},Pbe=[`src`],Fbe=[`src`,`alt`],Ibe={class:`att-lightbox-name`},Lbe=[`aria-label`],Rbe={class:`quote-copy`},zbe={key:0,class:`quote-source`},Bbe={class:`quote-text`},Vbe={key:1,class:`quote-comment`},Hbe={key:1,class:`att-strip`},Ube={class:`att-scroll-content`},Wbe=[`aria-label`],Gbe={key:1,class:`att-row`},Kbe={key:0,class:`att-more`},qbe={class:`discussion-row`},Jbe={class:`cin-wrap`},Ybe=[`onClick`],Xbe={class:`am-icon`},Zbe={class:`am-name`},Qbe={key:0,class:`am-desc`},$be={class:`input-row`},exe=[`placeholder`,`disabled`,`aria-expanded`,`aria-controls`,`aria-activedescendant`],txe=[`aria-label`],nxe={class:`toolbar-left`},rxe=[`aria-label`,`onKeydown`],ixe={class:`perm-pill-label`},axe=[`onClick`],oxe={class:`pd-info`},sxe={class:`pd-desc`},cxe={class:`pd-check`},lxe={key:1,class:`workflow-chip`},uxe={class:`workflow-label`},dxe=[`aria-label`],fxe=[`aria-haspopup`,`aria-expanded`,`aria-label`],pxe=[`disabled`,`aria-expanded`,`aria-label`,`onKeydown`],mxe={class:`thinking-pill-label`},hxe=[`aria-label`],gxe=[`aria-label`,`disabled`],_xe={class:`md-list`},vxe={key:0,class:`md-section`},yxe=[`onClick`],bxe={class:`md-check`},xxe={class:`md-name`},Sxe={class:`md-provider`},Cxe={key:1,class:`md-divider`},wxe={key:2,class:`md-section`},Txe=[`onClick`],Exe={class:`md-check`},Dxe={class:`md-name`},Oxe={key:0,class:`md-divider`},kxe={class:`md-check md-more-icon`},Axe={class:`md-name`},jxe=[`aria-label`,`onKeydown`],Mxe={class:`thinking-dropdown-title`},Nxe={class:`thinking-cache-note`},Pxe={class:`drop-card`},Fxe={key:0,class:`composer-warning-toast`,role:`status`,"aria-live":`polite`},Ixe={class:`msheet-search`},Lxe={class:`msheet-search`},Rxe=[`onClick`],zxe={class:`am-icon`},Bxe={class:`am-name`},Vxe={key:0,class:`am-desc`},I7=56,L7=Y(G({__name:`Composer`,props:{running:{type:Boolean,default:!1},starting:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},planArmed:{type:Boolean},working:{type:Boolean,default:!1},goalMode:{type:Boolean},towerMode:{type:Boolean},towerAvailable:{type:Boolean},workflowActive:{type:Boolean},goal:{},activationBadges:{},models:{default:()=>[]},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean,default:!1}},emits:[`submit`,`steer`,`command`,`interrupt`,`setPermission`,`setThinking`,`togglePlan`,`toggleWorkflow`,`toggleGoal`,`toggleTower`,`openBtw`,`createGoal`,`controlGoal`,`focusGoal`,`compact`,`pickModel`,`selectModel`],setup(e,{expose:t,emit:r}){let i=e,a=L(()=>i.starting?u(`composer.starting`):i.running?u(`composer.placeholderRunning`):i.goalMode?u(`status.goalPlaceholder`):i.planArmed||i.planMode?u(`status.planPlaceholder`):u(`composer.placeholder`)),o=r,{t:u,locale:d}=J(),f=i6(),{text:g,textareaRef:y,autosize:b,loadForEdit:x,clearDraft:S}=Qpe({sessionId:()=>i.sessionId}),C=R([]),w=1;function D(e){let t=e.quote.trim();t&&(C.value.push({id:w++,text:t,comment:e.comment?.trim()||void 0,source:e.source?.trim()||void 0}),n(dt))}function O(e){C.value=C.value.filter(t=>t.id!==e)}function k(e){return[...C.value.map(e=>{let t=e.text.split(` `).map(e=>`> ${e}`).join(` `);return[e.source?`From ${e.source}:`:void 0,t,e.comment].filter(e=>!!e).join(` `)}),e].filter(Boolean).join(` -`)}function A(){i.planArmed||i.planMode||(i.goalMode&&o(`toggleGoal`),o(`togglePlan`))}function j(){if(wn.value){o(`focusGoal`);return}i.goalMode||((i.planArmed||i.planMode)&&o(`togglePlan`),o(`toggleGoal`))}let N=R(!1);function I(){N.value=!N.value,n(()=>{b(),se(),y.value?.focus()})}function te(){N.value&&(N.value=!1,n(b))}function ne(e){if(typeof getComputedStyle>`u`)return L7;let t=Number.parseFloat(getComputedStyle(e).minHeight);return Number.isFinite(t)&&t>0?t:L7}let re=R(!1);function se(){let e=y.value;re.value=!!e&&e.scrollHeight>ne(e)}s(g,()=>{n(se)}),s(()=>i.sessionId,()=>{N.value=!1,ue.value=!1,me.value=!1,C.value=[]});let ce=Vpe({text:g,textareaRef:y,autosize:b,sessionId:()=>i.sessionId});function le(e){if(e===`/plan`){A();return}if(e===`/goal`){j();return}if(e===`/discussion`||e===`/expert-talk`||e===`/expert-opinion`){ir();return}o(`command`,e)}let{open:ue,items:fe,active:G,update:K,select:pe}=Hpe({text:g,textareaRef:y,autosize:b,skills:()=>i.skills,emitCommand:le,historyPush:e=>ce.push(e),clearDraft:S}),{open:me,items:he,active:ge,loading:_e,stale:ve,update:ye,select:be,complete:xe,close:Se,getMentionToken:Ce}=Upe({text:g,textareaRef:y,autosize:b,searchFiles:()=>i.searchFiles}),we=R(null),Te=R(null),Ee=R(null);function De(e){y.value?.setSelectionRange(e,e)}let Oe=L({get:()=>g.value.startsWith(`/`)?g.value.slice(1):g.value,set:e=>{g.value=`/${e}`,n(()=>{De(g.value.length),K()})}}),ke=L({get:()=>{let e=Ee.value;return e?g.value.slice(e.start+1,e.end):``},set:e=>{let t=Ee.value;if(!t)return;g.value=`${g.value.slice(0,t.start)}@${e}${g.value.slice(t.end)}`;let r=t.start+e.length+1;Ee.value={start:t.start,end:r},n(()=>{De(r),ye()})}});s([ue,f],async([e,t])=>{!e||!t||(await n(),we.value?.focus())}),s([me,f],async([e,t])=>{!e||!t||(Ee.value=Ce(),await n(),Te.value?.focus())});function Ae(){ue.value=!1,y.value?.focus()}function je(e){e||Ae()}function Me(){Se(),Ee.value=null,y.value?.focus()}function q(e){e||Me()}function Ne(){ce.resetBrowsing(),K(),ye()}let{attachments:Pe,previewAttachment:Fe,fileInputRef:Ie,isDragOver:Le,removeAttachment:Re,reorderAttachment:ze,mediaLabel:Be,openAttachmentPreview:Ve,closeAttachmentPreview:He,openFilePicker:Ue,handleFileInputChange:We,handleDragOver:Ge,handleDragLeave:Ke,handleDrop:qe,clearAfterSubmit:Je,loadAttachments:Ye}=Gpe({uploadImage:()=>i.uploadImage,sessionId:()=>i.sessionId});function Xe(){let e=Pe.value.map(e=>e.localId);for(let t of e)Re(t)}let Ze=L(()=>Pe.value.filter(e=>e.kind!==`file`)),Qe=L(()=>Pe.value.filter(e=>e.kind===`file`));function $e(e){let t=Be(e),r=y.value,i=r?.selectionStart??g.value.length,a=r?.selectionEnd??i,o=g.value.slice(0,i),s=g.value.slice(a),c=o.length>0&&!/\s$/.test(o),l=s.length>0&&!/^\s/.test(s),u=`${c?` `:``}${t}${l?` `:``}`;g.value=`${o}${u}${s}`,n(()=>{De(i+u.length),r?.focus(),b()})}function et(e,t){let n=Pe.value.findIndex(t=>t.localId===e.localId);n<0||ze(e.localId,n+t)}let tt=R(null);function nt(e,t){tt.value=e.localId,t.dataTransfer?.setData(`text/plain`,e.localId),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)}function rt(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`)}function it(e,t){t.preventDefault();let n=t.dataTransfer?.getData(`text/plain`)||tt.value;if(tt.value=null,!n||n===e.localId)return;let r=Pe.value.findIndex(t=>t.localId===e.localId);r<0||ze(n,r)}function at(){tt.value=null}let ot=R(null),st=R(null),ct=R(!1),lt=null;function ut(){let e=ot.value;ct.value=e!==null&&e.scrollHeight>e.clientHeight+1}s(ot,e=>{lt?.disconnect(),lt=null,e&&typeof ResizeObserver==`function`&&(lt=new ResizeObserver(ut),lt.observe(e)),ut()},{immediate:!0}),s(Pe,()=>void n(ut),{deep:!0}),s(()=>[Ze.value.length,Qe.value.length],([e,t],[r,i])=>{e<=r&&t<=i||n(()=>{let t=ot.value;t&&(t.scrollTop=e>r&&st.value?st.value.offsetHeight-t.clientHeight:t.scrollHeight)})}),p(()=>{g.value&&n(()=>{b(),se()})}),h(()=>{document.removeEventListener(`click`,tn,!0),lt?.disconnect(),Kn?.disconnect(),kn?.disconnect(),St()});function dt(){y.value?.focus({preventScroll:!0})}function ft(e){Ye(e)}t({loadForEdit:x,loadAttachmentsForEdit:ft,insertQuote:D,focus:dt,anyPopupOpen:L(()=>ue.value||me.value||Mt.value||Nt.value||Pt.value||Vn.value),isEmpty:L(()=>g.value.trim().length===0&&Pe.value.length===0&&C.value.length===0)});let pt=R(null),mt=null;function ht(e){pt.value=u(`composer.noArgCommand`,{cmd:e}),mt!==null&&clearTimeout(mt),mt=setTimeout(()=>{pt.value=null,mt=null},3e3)}h(()=>{mt!==null&&clearTimeout(mt)});function gt(e){return{fileId:e.fileId,kind:e.kind,name:e.name,mediaType:e.mediaType,size:e.size}}function _t(e){if(e.kind===`file`){e.fileId!==void 0&&J4(e.fileId,e.name,e.mediaType);return}Ve(e)}function vt(){let e=g.value.trim(),t=k(e);if(Pe.value.some(e=>e.uploading))return;let n=Pe.value.filter(e=>!e.uploading&&!e.error&&e.fileId);if(!t&&n.length===0)return;if(C.value.length===0&&e===`/plan`){ce.push(e),g.value=``,S(),ue.value=!1,te(),A();return}if(C.value.length===0&&e===`/goal`){ce.push(e),g.value=``,S(),ue.value=!1,te(),j();return}if(C.value.length===0&&e){let t=Npe(e),n=t===null?``:t.cmd===`/expert-talk`||t.cmd===`/expert-opinion`?`/discussion`:t.cmd,r=t?Y3(i.skills).find(e=>e.name===n||e.name===`/skill:${n.slice(1)}`):void 0;if(t&&r){if(t.arg.trim()&&r.acceptsInput!==!0){ht(t.cmd);return}ce.push(e),g.value=``,S(),ue.value=!1,te(),le(t.arg?`${n} ${t.arg}`:n);return}}e&&ce.push(e);let r={text:t,attachments:n.map(e=>gt(e))};Fe.value=null,Je(),g.value=``,C.value=[],S(),ue.value=!1,me.value=!1,te(),o(`submit`,r)}function yt(){if(!i.running||Pe.value.some(e=>e.uploading))return;let e=g.value.trim(),t=k(e),n=Pe.value.filter(e=>!e.uploading&&!e.error&&e.fileId);if(!t&&n.length===0&&i.queued.length===0)return;let r={text:t,attachments:n.map(e=>gt(e))};Je(),e&&ce.push(e),g.value=``,C.value=[],S(),ue.value=!1,me.value=!1,te(),o(`steer`,r)}let bt=!1,xt=null;function St(){xt!==null&&(clearTimeout(xt),xt=null)}function Ct(){St(),bt=!0}function wt(){St(),xt=setTimeout(()=>{xt=null,bt=!1},0)}function Tt(e){return bt||e.isComposing||e.keyCode===229}function Et(e){if(!Tt(e)){if(Tn.value&&e.key===`Backspace`&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=y.value;if(t&&t.selectionStart===0&&t.selectionEnd===0){e.preventDefault(),An();return}}if(e.key===`Escape`){if(Vn.value){e.preventDefault(),Yn();return}if(Mt.value){e.preventDefault(),Zt();return}if(Nt.value){e.preventDefault(),Xt();return}if(Pt.value){e.preventDefault(),$t();return}}if(ue.value){if(e.key===`Escape`){e.preventDefault(),ue.value=!1;return}if(e.key===`Tab`&&fe.value.length===0){ue.value=!1;return}if(e.key===`ArrowDown`){e.preventDefault(),G.value=(G.value+1)%fe.value.length;return}if(e.key===`ArrowUp`){e.preventDefault(),G.value=(G.value-1+fe.value.length)%fe.value.length;return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=fe.value[G.value];t&&pe(t);return}}if(me.value&&!_e.value){if(e.key===`ArrowDown`){e.preventDefault(),ge.value=(ge.value+1)%Math.max(1,he.value.length);return}if(e.key===`ArrowUp`){e.preventDefault(),ge.value=(ge.value-1+Math.max(1,he.value.length))%Math.max(1,he.value.length);return}if(e.key===`Tab`){e.preventDefault();let t=he.value[ge.value];t&&xe(t);return}if(e.key===`Enter`){e.preventDefault();let t=he.value[ge.value];t&&be(t);return}if(e.key===`Escape`){e.preventDefault(),me.value=!1;return}}if(e.key===`Escape`&&Fn.value?.cancelActive()){e.preventDefault();return}if(e.key===`s`&&(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){i.running&&(e.preventDefault(),yt());return}if(!N.value&&!ue.value&&!me.value&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=ce.isBrowsing();if(e.key===`ArrowUp`&&ce.hasHistory()&&(t||ce.caretAtTextStart())){e.preventDefault(),ce.recallOlder(),ue.value=!1;return}if(e.key===`ArrowDown`&&t){e.preventDefault(),ce.recallNewer(),ue.value=!1;return}}if(e.key===`Enter`&&!e.shiftKey){if(N.value&&!(e.metaKey||e.ctrlKey))return;e.preventDefault(),vt()}}}let Dt=L(()=>u(`composer.send`)),Ot=L(()=>!!i.uploadImage),kt=L(()=>!Pe.value.some(e=>e.uploading)&&(g.value.trim()!==``||C.value.length>0||Pe.value.some(e=>!e.error&&e.fileId))),At=L(()=>{if(ue.value)return`composer-slash-menu`;if(me.value)return`composer-mention-menu`}),jt=L(()=>{if(ue.value&&fe.value.length>0)return`composer-slash-option-${G.value}`;if(me.value&&he.value.length>0)return`composer-mention-option-${ge.value}`}),Mt=R(!1),Nt=R(!1),Pt=R(!1),Ft=R(null),It=R(null),Lt=R(null),Rt=R(null),zt=R(null),Bt=R(null),Vt=R(null),Ht=R(null);lp(Bt),lp(Vt),lp(Ht);let Ut=R(``),Wt=R(``),Gt=R(``),Kt=R(``),qt=R(!1);function Jt(){Mt.value=!Mt.value,Mt.value&&(rn(),Nt.value=!1,Pt.value=!1,Yn(),ue.value=!1,me.value=!1,document.addEventListener(`click`,tn,!0))}function Yt(){mn.value||(Nt.value=!Nt.value,Nt.value&&(an(),Mt.value=!1,Pt.value=!1,Yn(),ue.value=!1,me.value=!1,document.addEventListener(`click`,tn,!0)))}function Xt(){Nt.value=!1,en()}function Zt(){Mt.value=!1,en()}function Qt(){Pt.value=!Pt.value,Pt.value&&(nn(),Mt.value=!1,Nt.value=!1,Yn(),ue.value=!1,me.value=!1,document.addEventListener(`click`,tn,!0))}function $t(){Pt.value=!1,en()}function en(){!Mt.value&&!Nt.value&&!Pt.value&&!Vn.value&&document.removeEventListener(`click`,tn,!0)}function tn(e){let t=e.target;Ft.value?.contains(t)||Hn.value?.contains(t)||Un.value?.contains(t)||(Zt(),Xt(),$t(),Yn())}function nn(){let e=It.value,t=Ft.value;Ut.value=e&&t?`${Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}px`:``}function rn(){let e=Lt.value,t=Ft.value;Wt.value=e&&t?`${Math.round(t.getBoundingClientRect().right-e.getBoundingClientRect().right)}px`:``}function an(){let e=Rt.value,t=Ft.value;Gt.value=e&&t?`${Math.round(t.getBoundingClientRect().right-e.getBoundingClientRect().right)}px`:``}let on=L(()=>{let e=i.status?.ctxMax??0;return e<=0?0:Math.min(100,Math.max(0,Math.ceil((i.status?.ctxUsed??0)/e*100)))}),sn=L(()=>u(`status.ctxTooltip`,{used:mO(i.status?.ctxUsed??0),max:mO(i.status?.ctxMax??0),pct:on.value})),cn=L(()=>on.value>=80),ln=L(()=>i.models?.find(e=>e.id===i.status?.modelId)),un=L(()=>X3(ln.value)),dn=L(()=>$3(ln.value)),fn=L(()=>r6(ln.value,i.thinking)),pn=L(()=>dn.value.includes(fn.value)?fn.value:``),mn=L(()=>un.value===`unsupported`||dn.value.length<=1),hn=L(()=>{let e=(ln.value?.supportEfforts?.length??0)>0,t=fn.value;return e&&t!==`on`&&t!==`off`?e6(t):vn(t)}),gn=L(()=>u(`composer.thinkingControl`,{level:hn.value}));function _n(e){mn.value||(o(`setThinking`,n6(ln.value,e)),Xt())}function vn(e){return e===`on`?u(`status.thinkingOn`):e===`off`?u(`status.thinkingOff`):e6(e)}let yn=L(()=>dn.value.map(e=>({value:e,label:vn(e)}))),bn=L(()=>i.planArmed===!0||i.planMode===!0),xn=L(()=>i.workflowActive===!0),Sn=L(()=>i.towerMode===!0),Cn=L(()=>i.goal?.status??i.activationBadges?.goal?.status??null),wn=L(()=>Cn.value!==null&&Cn.value!==`complete`),Tn=L(()=>i.goalMode?`goal`:i.towerMode?`tower`:i.planArmed?`plan`:null),En=R(null),Dn=R(``),On=L(()=>Dn.value?{textIndent:Dn.value}:void 0),kn=null;function An(){Tn.value===`goal`?o(`toggleGoal`):Tn.value===`tower`?o(`toggleTower`):Tn.value===`plan`&&o(`togglePlan`)}function jn(e){return e===`goal`?`target`:e===`tower`?`git-fork`:`file-edit`}function Mn(e){return u(e===`goal`?`status.goalLabel`:e===`tower`?`status.towerLabel`:`status.planLabel`)}function Nn(){let e=En.value;Dn.value=e?`calc(${e.offsetWidth}px + var(--space-1-5) - var(--space-05))`:``}s(Tn,async e=>{if(kn?.disconnect(),kn=null,!e){Dn.value=``;return}await n(),Nn(),typeof ResizeObserver==`function`&&En.value&&(kn=new ResizeObserver(Nn),kn.observe(En.value))},{immediate:!0});let Pn=R(null),Fn=R(null),In=m(O7,void 0),Ln=L(()=>In?.status.value?.activation.state===`armed`||In?.run.value?.state===`running`),Rn=L(()=>Ln.value?u(`expertTalk.title`):i.status?.model??``);s(Ln,e=>{e&&Zt()});function zn(e){x(u(`expertTalk.buildPrompt`,{answer:e})),vt()}function Bn(){if(Ln.value){Fn.value?.openDialog();return}Jt()}let Vn=R(!1),Hn=R(null),Un=R(null);lp(Hn),lp(Un);let Wn=R(null),Gn=R(null),Kn=null,qn=L(()=>{let e=[];return Ot.value&&e.push({id:`files`,icon:`attachment`,nameKey:`composer.addFiles`,action:er}),f.value&&e.push({id:`slash`,icon:`terminal`,nameKey:`composer.addSlash`,descKey:`composer.addSlashDesc`,action:tr},{id:`mention`,icon:`link`,nameKey:`composer.addMention`,descKey:`composer.addMentionDesc`,action:nr}),e.push({id:`capabilities`,icon:`sliders`,nameKey:`capabilityMenu.trigger`,action:rr},...Fn.value?.available?[{id:`expertOpinion`,icon:`sparkles`,nameKey:`expertTalk.title`,descKey:`composer.addExpertOpinionDesc`,action:ir}]:[],{id:`goal`,icon:`target`,nameKey:`status.goalLabel`,descKey:`composer.addGoalDesc`,action:ar},{id:`plan`,icon:`file-edit`,nameKey:`status.planLabel`,descKey:`composer.addPlanDesc`,action:or},...i.towerAvailable?[{id:`tower`,icon:`git-fork`,nameKey:`status.towerLabel`,descKey:`composer.addTowerDesc`,action:sr}]:[],{id:`workflow`,icon:`sparkles`,nameKey:`status.dynamicWorkflowLabel`,descKey:`composer.addWorkflowDesc`,action:cr}),e});function Jn(){let e=Wn.value;if(!e||e.scrollHeight<=e.clientHeight+1){Gn.value=null;return}let t=getComputedStyle(e),n=Number.parseFloat(t.getPropertyValue(`--menu-scrollbar-track-inset`))||0,r=Number.parseFloat(t.getPropertyValue(`--menu-scrollbar-thumb-min`))||24,i=e.clientHeight-n*2,a=Math.max(r,e.clientHeight/e.scrollHeight*i),o=e.scrollHeight-e.clientHeight;Gn.value={top:e.offsetTop+n+e.scrollTop/o*(i-a),height:a}}s(Vn,async e=>{Kn?.disconnect(),Kn=null,Gn.value=null,e&&(await n(),Jn(),typeof ResizeObserver==`function`&&Wn.value&&(Kn=new ResizeObserver(Jn),Kn.observe(Wn.value)))});function Yn(){Vn.value=!1,en()}function Xn(e){e||Yn()}function Zn(){if(Vn.value){Yn();return}Zt(),Xt(),$t(),ue.value=!1,me.value=!1,Vn.value=!0,document.addEventListener(`click`,tn,!0),n(()=>{(f.value?Un.value:Hn.value)?.querySelector(`.am-row`)?.focus()})}function Qn(e){e.action(),f.value&&e.id===`files`||y.value?.focus()}function $n(e){if(e.key===`Escape`){e.preventDefault(),Yn(),y.value?.focus();return}if(e.key===`Tab`){Yn();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=f.value?Un.value:Hn.value,n=Array.from(t?.querySelectorAll(`.am-row`)??[]);if(n.length===0)return;let r=n.indexOf(document.activeElement);n[e.key===`ArrowDown`?(r+1)%n.length:(r-1+n.length)%n.length]?.focus()}function er(){Yn(),Ue()}function tr(){Yn(),g.value=`/`,n(()=>{De(1),K()})}function nr(){Yn(),g.value=`@`,n(()=>{De(1),ye()})}function rr(){Yn(),Pn.value?.toggleOpen()}function ir(){Yn(),Fn.value?.activate()}function ar(){Yn(),i.goalMode||j()}function or(){Yn(),Sn.value&&o(`toggleTower`),bn.value||A()}function sr(){Yn(),bn.value&&o(`togglePlan`),Sn.value||o(`toggleTower`)}function cr(){Yn(),xn.value||o(`toggleWorkflow`)}let lr=[{mode:`manual`,icon:`fingerprint`,color:`var(--color-text)`,labelKey:`status.permissionManual`,descKey:`status.permissionManualDesc`},{mode:`yolo`,icon:`shield-question`,color:`var(--color-warning)`,labelKey:`status.permissionYolo`,descKey:`status.permissionYoloDesc`},{mode:`auto`,icon:`full-access`,color:`var(--color-danger)`,labelKey:`status.permissionAuto`,descKey:`status.permissionAutoDesc`}],ur=R(null),dr=R(``);function fr(e){let t={};return e&&(t[`--composer-menu-desc-width`]=e),t}let pr=L(()=>{let e=fr(dr.value);return Ut.value&&(e.left=Ut.value),e}),mr=L(()=>{let e={};return Wt.value&&(e.right=Wt.value),Kt.value&&(e.maxHeight=Kt.value),e}),hr=L(()=>{let e={};return Gt.value&&(e.right=Gt.value),e}),gr=null;function _r(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function vr(e){return`${e.fontStyle||`normal`} ${e.fontWeight||`400`} ${e.fontSize} ${e.fontFamily}`}function yr(e){return e.letterSpacing===`normal`?0:_r(e.letterSpacing)}function br(e,t){return e?upe(cpe(e,vr(t),{letterSpacing:yr(t)})):0}function xr(){let e=ur.value?.querySelector(`.pd-desc`);if(!e)return;let t=getComputedStyle(e),n=Math.max(0,...lr.map(e=>br(u(e.descKey),t)));dr.value=n>0?`${Math.ceil(n)}px`:``}function Sr(){typeof window>`u`||(gr!==null&&window.cancelAnimationFrame(gr),n(()=>{gr=window.requestAnimationFrame(()=>{gr=null,xr()})}))}s(d,Sr,{immediate:!0}),p(()=>{Sr(),document.fonts?.ready.then(Sr)}),h(()=>{gr!==null&&(window.cancelAnimationFrame(gr),gr=null)});function Cr(e){o(`setPermission`,e),$t()}let wr=L(()=>lr.find(e=>e.mode===i.status?.permission)),Tr=L(()=>wr.value?u(wr.value.labelKey):``),Er=L(()=>wr.value?.icon??`fingerprint`),Dr=R(!1),Or=R(!1),kr=R(!1),Ar=R(!1),jr=0,Mr=0,Nr=0,Pr=0,Fr=R(null),Ir=null;function Lr(e,t,n){let r=e.getPropertyValue(t).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?r.endsWith(`em`)?i*Number.parseFloat(e.fontSize):i:n}function Rr(e){return e.scrollWidth>e.clientWidth+1||e.clientWidth===0&&(e.textContent?.length??0)>0}function zr(e){let t=e.getBoundingClientRect().left;for(let n of e.querySelectorAll(`.compact-chip, .ctx-group, .model-pill, .stop, .send`)){let e=n.getBoundingClientRect();if(e.width>0&&e.leftPr+i&&(Ar.value=!1,n(Br));return}if(kr.value){if(a>Nr+i){kr.value=!1,n(Br);return}o&&zr(o)&&(Pr=a,Ar.value=!0,n(Br));return}if(Or.value){if(a>Mr+i){Or.value=!1,n(Br);return}o&&zr(o)&&(cn.value?(Nr=a,kr.value=!0):(Pr=a,Ar.value=!0),n(Br));return}if(Dr.value&&a>jr+i){Dr.value=!1,n(Br);return}let s=zt.value;!s||!Rr(s)||s.getBoundingClientRect().width>=r||(Dr.value?(Mr=a,Or.value=!0):(jr=a,Dr.value=!0),n(Br))}p(()=>{typeof ResizeObserver==`function`&&Ft.value&&(Ir=new ResizeObserver(Br),Ir.observe(Ft.value)),document.fonts?.ready.then(Br)}),s([Tr,xn,cn,hn,()=>i.status?.model,()=>i.working,d],()=>{Dr.value=!1,Or.value=!1,kr.value=!1,Ar.value=!1,n(Br)}),h(()=>{Ir?.disconnect(),Ir=null});let Vr=L(()=>ln.value?.provider??``),Hr=L(()=>!Vr.value||!i.models?.length?[]:i.models.filter(e=>e.provider===Vr.value)),Ur=L(()=>new Set(i.starredIds??[]));function Wr(e){return Ur.value.has(e)}let Gr=L(()=>i.models?.length?i.models.filter(e=>Wr(e.id)&&e.provider!==Vr.value):[]);function Kr(){let e=Bt.value,t=Ft.value;if(!e||!t)return;let n=getComputedStyle(e),r=_r(n.getPropertyValue(`--space-1`))||4,i=_r(n.getPropertyValue(`--space-2`))||8,a=window.visualViewport,o=a?.offsetTop??0,s=o+(a?.height??window.innerHeight),c=t.getBoundingClientRect(),l=c.top-o-r-i,u=s-c.bottom-r-i;e.offsetHeight>l&&u>l?(qt.value=!0,Kt.value=`${Math.max(Math.floor(u),0)}px`):(qt.value=!1,Kt.value=`${Math.max(Math.floor(l),0)}px`)}function qr(){Zt()}function Jr(){window.addEventListener(`resize`,qr),window.visualViewport?.addEventListener(`resize`,qr),window.visualViewport?.addEventListener(`scroll`,qr)}function Yr(){window.removeEventListener(`resize`,qr),window.visualViewport?.removeEventListener(`resize`,qr),window.visualViewport?.removeEventListener(`scroll`,qr)}s(Mt,async e=>{if(!e){Yr();return}Jr(),qt.value=!1,Kt.value=``,await n(),Kr(),(Bt.value?.querySelector(`.md-row.is-current`)??Bt.value?.querySelector(`.md-row`))?.focus()}),h(Yr);function Xr(e){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(Bt.value?.querySelectorAll(`.md-row:not(:disabled)`)??[]);if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}function Zr(e){o(`selectModel`,e),Zt()}return(t,n)=>(c(),W(`div`,{class:V([`composer`,{"drag-over":z(Le),expanded:N.value}]),onDragover:n[27]||=(...e)=>z(Ge)&&z(Ge)(...e),onDragleave:n[28]||=(...e)=>z(Ke)&&z(Ke)(...e),onDrop:n[29]||=(...e)=>z(qe)&&z(qe)(...e)},[z(Fe)?(c(),W(`div`,{key:0,class:`att-lightbox`,onClick:n[1]||=H((...e)=>z(He)&&z(He)(...e),[`self`])},[F(`div`,Tbe,[v(vp,{text:z(u)(`model.close`)},{default:B(()=>[F(`button`,{type:`button`,class:`att-lightbox-close`,onClick:n[0]||=(...e)=>z(He)&&z(He)(...e)},`✕`)]),_:1},8,[`text`]),z(Fe).kind===`video`?(c(),W(`video`,{key:0,class:`att-lightbox-media`,src:z(Fe).previewUrl,controls:``,playsinline:``},null,8,Ebe)):(c(),W(`img`,{key:1,class:`att-lightbox-media`,src:z(Fe).previewUrl,alt:z(Fe).name},null,8,Dbe)),F(`div`,Obe,U(z(Fe).name),1)])])):E(``,!0),F(`div`,{class:V([`composer-card`,{"labels-collapsed":Dr.value}])},[C.value.length>0?(c(),W(`div`,{key:0,class:`quote-strip`,"aria-label":z(u)(`selection.quoteLabel`)},[(c(!0),W(M,null,_(C.value,e=>(c(),W(`div`,{key:e.id,class:`quote-chip`},[F(`span`,Abe,[e.source?(c(),W(`span`,jbe,U(e.source),1)):E(``,!0),F(`span`,Mbe,U(e.text),1),e.comment?(c(),W(`span`,Nbe,U(e.comment),1)):E(``,!0)]),v(Ca,{size:`sm`,label:z(u)(`composer.removeNamed`,{name:e.text}),onClick:t=>O(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`onClick`])]))),128))],8,kbe)):E(``,!0),z(Pe).length>0?(c(),W(`div`,Pbe,[F(`div`,{ref_key:`attachmentScrollRef`,ref:ot,class:V([`att-scroll`,{"is-overflowing":ct.value}])},[F(`div`,Fbe,[Ze.value.length>0?(c(),W(`div`,{key:0,ref_key:`attachmentMediaRowRef`,ref:st,class:`att-row att-row-media`,role:`list`,"aria-label":z(u)(`composer.mediaAttachments`)},[(c(!0),W(M,null,_(Ze.value,e=>(c(),P(I4,{key:e.localId,kind:e.kind,name:z(Be)(e),url:e.previewUrl,"file-id":e.fileId,"media-type":e.mediaType,size:e.size,ordinal:e.mediaOrdinal,uploading:e.uploading,error:e.error,mentionable:``,reorderable:``,dragging:tt.value===e.localId,removable:``,"mention-label":z(u)(`composer.mentionNamed`,{name:z(Be)(e)}),"remove-label":z(u)(`composer.removeNamed`,{name:z(Be)(e)}),onActivate:t=>_t(e),onMention:t=>$e(e),onReorderStep:t=>et(e,t),onDragStart:t=>nt(e,t),onDragOver:rt,onDrop:t=>it(e,t),onDragEnd:at,onRemove:t=>z(Re)(e.localId)},null,8,[`kind`,`name`,`url`,`file-id`,`media-type`,`size`,`ordinal`,`uploading`,`error`,`dragging`,`mention-label`,`remove-label`,`onActivate`,`onMention`,`onReorderStep`,`onDragStart`,`onDrop`,`onRemove`]))),128))],8,Ibe)):E(``,!0),Qe.value.length>0?(c(),W(`div`,Lbe,[(c(!0),W(M,null,_(Qe.value,e=>(c(),P(I4,{key:e.localId,kind:`file`,name:e.name,"media-type":e.mediaType,size:e.size,uploading:e.uploading,error:e.error,removable:``,"remove-label":z(u)(`composer.removeNamed`,{name:e.name}),onActivate:t=>_t(e),onRemove:t=>z(Re)(e.localId)},null,8,[`name`,`media-type`,`size`,`uploading`,`error`,`remove-label`,`onActivate`,`onRemove`]))),128))])):E(``,!0)])],2),ct.value?(c(),W(`span`,Rbe,U(z(u)(`composer.attachmentCount`,{n:z(Pe).length})),1)):E(``,!0),z(Pe).length>=2?(c(),P(vp,{key:1,text:z(u)(`composer.clearAll`)},{default:B(()=>[v(Ca,{class:`att-clear`,size:`sm`,label:z(u)(`composer.clearAll`),onClick:Xe},{default:B(()=>[v(X,{name:`trash`})]),_:1},8,[`label`])]),_:1},8,[`text`])):E(``,!0)])):E(``,!0),F(`div`,zbe,[v(j7,{models:e.models,trigger:`widget`},null,8,[`models`])]),F(`div`,Bbe,[z(ue)&&!z(f)?(c(),P(K3,{key:0,id:`composer-slash-menu`,items:z(fe),"active-index":z(G),onSelect:z(pe),onHover:n[2]||=e=>G.value=e},null,8,[`items`,`active-index`,`onSelect`])):E(``,!0),z(me)&&!z(f)?(c(),P(q3,{key:1,id:`composer-mention-menu`,items:z(he),"active-index":z(ge),loading:z(_e),stale:z(ve),onSelect:z(be),onHover:n[3]||=e=>ge.value=e},null,8,[`items`,`active-index`,`loading`,`stale`,`onSelect`])):E(``,!0),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Vn.value&&!z(f)?(c(),W(`div`,{key:0,ref_key:`modesMenuRef`,ref:Hn,class:`add-menu`,onClick:n[5]||=H(()=>{},[`stop`]),onKeydown:$n},[F(`div`,{ref_key:`addMenuScrollRef`,ref:Wn,class:`am-scroll`,role:`menu`,onScroll:Jn},[(c(!0),W(M,null,_(qn.value,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`am-row`,role:`menuitem`,onMousedown:n[4]||=H(()=>{},[`prevent`]),onClick:t=>Qn(e)},[F(`span`,Hbe,[v(X,{name:e.icon,size:`sm`},null,8,[`name`])]),F(`span`,Ube,U(z(u)(e.nameKey)),1),e.descKey?(c(),W(`span`,Wbe,U(z(u)(e.descKey)),1)):E(``,!0)],40,Vbe))),128))],544),Gn.value?(c(),W(`div`,{key:0,class:`scroll-thumb`,style:ae({top:`${Gn.value.top}px`,height:`${Gn.value.height}px`})},null,4)):E(``,!0)],544)):E(``,!0)]),_:1}),F(`div`,Gbe,[Tn.value?(c(),W(`span`,{key:0,ref_key:`workModePillRef`,ref:En,class:`wm-pill`},[v(X,{name:jn(Tn.value),size:`sm`},null,8,[`name`]),F(`span`,null,U(Mn(Tn.value)),1),v(Ca,{class:`wm-x`,size:`sm`,label:z(u)(`status.workModeDismiss`),onMousedown:n[6]||=H(()=>{},[`prevent`]),onClick:An},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])],512)):E(``,!0),l(F(`textarea`,{ref_key:`textareaRef`,ref:y,"onUpdate:modelValue":n[7]||=e=>T(g)?g.value=e:null,class:`ph`,style:ae(On.value),placeholder:a.value,disabled:e.starting,autocomplete:`off`,spellcheck:`false`,rows:`1`,role:`combobox`,"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-expanded":!!At.value,"aria-controls":At.value,"aria-activedescendant":jt.value,onKeydown:Et,onCompositionstart:Ct,onCompositionend:wt,onInput:Ne,onBlur:n[8]||=e=>{z(f)||(ue.value=!1,me.value=!1)}},null,44,Kbe),[[de,z(g)]]),v(vp,{text:N.value?z(u)(`composer.collapseTitle`):z(u)(`composer.expandTitle`)},{default:B(()=>[N.value||re.value?(c(),W(`button`,{key:0,class:`expand-btn`,type:`button`,"aria-label":N.value?z(u)(`composer.collapseTitle`):z(u)(`composer.expandTitle`),onClick:I},[N.value?(c(),P(X,{key:0,name:`collapse`,size:`sm`})):(c(),P(X,{key:1,name:`expand`,size:`sm`}))],8,qbe)):E(``,!0)]),_:1},8,[`text`])])]),Ot.value?(c(),W(`input`,{key:2,ref_key:`fileInputRef`,ref:Ie,type:`file`,multiple:``,class:`file-input-hidden`,onChange:n[9]||=(...e)=>z(We)&&z(We)(...e)},null,544)):E(``,!0),F(`div`,{ref_key:`toolbarRef`,ref:Ft,class:`toolbar`},[F(`div`,{ref_key:`menuMeasureRef`,ref:ur,class:`menu-measure`,"aria-hidden":`true`},[...n[30]||=[F(`span`,{class:`pd-desc`},null,-1)]],512),F(`div`,Jbe,[v(Ca,{size:`md`,class:`composer-attach`,label:z(u)(`composer.addMenu`),"aria-haspopup":`menu`,"aria-expanded":Vn.value,onMousedown:n[10]||=H(()=>{},[`prevent`]),onClick:H(Zn,[`stop`])},{default:B(()=>[v(X,{name:`plus`})]),_:1},8,[`label`,`aria-expanded`]),v(jye,{ref_key:`capMenuRef`,ref:Pn,"session-id":e.sessionId,triggerless:``},null,8,[`session-id`]),v(j7,{ref_key:`expertTalkControlRef`,ref:Fn,models:e.models,onTake:z(x),onBuild:zn},null,8,[`models`,`onTake`]),e.status?(c(),W(`span`,{key:0,ref_key:`permissionPillRef`,ref:It,class:V([`perm-pill`,[`perm-`+e.status.permission,{open:Pt.value}]]),role:`button`,tabindex:`0`,"aria-label":Tr.value,onClick:H(Qt,[`stop`]),onKeydown:[ie(Qt,[`enter`]),ie(H(Qt,[`prevent`]),[`space`])]},[v(X,{class:`perm-pill-icon`,name:Er.value,size:`md`},null,8,[`name`]),F(`span`,Xbe,U(Tr.value),1)],42,Ybe)):E(``,!0),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Pt.value&&e.status?(c(),W(`div`,{key:0,ref_key:`permDropdownRef`,ref:Ht,class:`perm-dropdown`,style:ae(pr.value),role:`menu`,onClick:n[11]||=H(()=>{},[`stop`])},[(c(),W(M,null,_(lr,t=>F(`button`,{key:t.mode,class:V([`pd-row`,{"is-current":t.mode===e.status.permission}]),role:`menuitem`,onClick:e=>Cr(t.mode)},[F(`span`,{class:`pd-icon`,style:ae({color:t.color})},[v(X,{name:t.icon,size:`md`},null,8,[`name`])],4),F(`span`,Qbe,[F(`span`,{class:`pd-name`,style:ae({color:t.color})},U(z(u)(t.labelKey)),5),F(`span`,$be,U(z(u)(t.descKey)),1)]),F(`span`,exe,[t.mode===e.status.permission?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)])],10,Zbe)),64))],4)):E(``,!0)]),_:1}),xn.value?(c(),W(`span`,txe,[v(X,{class:`workflow-ic`,name:`sparkles`,size:`md`}),F(`span`,nxe,U(z(u)(`status.dynamicWorkflowLabel`)),1),v(Ca,{class:`workflow-x`,size:`sm`,label:z(u)(`status.dynamicWorkflowDismiss`),onMousedown:n[12]||=H(()=>{},[`prevent`]),onClick:n[13]||=H(e=>o(`toggleWorkflow`),[`stop`])},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])])):E(``,!0)]),F(`div`,{ref_key:`toolbarRightRef`,ref:Fr,class:`toolbar-right`},[cn.value?(c(),W(`button`,{key:0,class:V([`compact-chip`,{gone:kr.value}]),onClick:n[14]||=H(e=>o(`compact`),[`stop`])},`/compact`,2)):E(``,!0),v(vp,{text:sn.value},{default:B(()=>[e.status&&!e.hideContext?(c(),W(`span`,{key:0,class:`ctx-group`,role:`img`,tabindex:`0`,"aria-label":sn.value},[v(Ype,{pct:on.value},null,8,[`pct`])],8,rxe)):E(``,!0)]),_:1},8,[`text`]),v(vp,{text:Or.value?Rn.value:null},{default:B(()=>[e.status?(c(),W(`button`,{key:0,ref_key:`modelPillRef`,ref:Lt,type:`button`,class:V([`model-pill`,{open:Mt.value,"icon-only":Or.value,"model-gone":Ar.value&&!Ln.value,"is-discussion":Ln.value}]),"aria-haspopup":Ln.value?`dialog`:`menu`,"aria-expanded":Ln.value?void 0:Mt.value,"aria-label":Or.value?Rn.value:void 0,onClick:H(Bn,[`stop`])},[Or.value?(c(),P(X,{key:0,name:Ln.value?`sparkles`:`cute-bot`,size:`md`,live:e.running},null,8,[`name`,`live`])):(c(),W(M,{key:1},[Ln.value?(c(),P(X,{key:0,name:`sparkles`,size:`sm`})):E(``,!0),F(`span`,{ref_key:`modelNameRef`,ref:zt,class:`mp-name`},U(Rn.value),513),v(X,{class:`cv`,name:`chevron-down`,size:`sm`})],64))],10,ixe)):E(``,!0)]),_:1},8,[`text`]),e.status&&un.value!==`unsupported`?(c(),P(vp,{key:1,text:gn.value},{default:B(()=>[F(`button`,{ref_key:`thinkingPillRef`,ref:Rt,type:`button`,class:V([`thinking-pill`,{open:Nt.value}]),disabled:mn.value,"aria-haspopup":`dialog`,"aria-expanded":Nt.value,"aria-label":gn.value,onClick:H(Yt,[`stop`]),onKeydown:ie(H(Xt,[`prevent`]),[`escape`])},[v(X,{name:`thinking`,size:`sm`}),F(`span`,oxe,U(hn.value),1),mn.value?E(``,!0):(c(),P(X,{key:0,class:`cv`,name:`chevron-down`,size:`sm`}))],42,axe)]),_:1},8,[`text`])):E(``,!0),e.working?(c(),P(vp,{key:2,text:z(u)(`composer.interruptTitle`)},{default:B(()=>[F(`button`,{class:`stop`,"aria-label":z(u)(`composer.interrupt`),onClick:n[15]||=e=>o(`interrupt`)},[...n[31]||=[F(`span`,{class:`stop-square`,"aria-hidden":`true`},null,-1)]],8,sxe)]),_:1},8,[`text`])):E(``,!0),F(`button`,{class:V([`send`,{"is-starting":e.starting}]),"aria-label":Dt.value,disabled:e.starting||!kt.value,onClick:n[16]||=e=>vt()},[e.starting?(c(),P(np,{key:0,size:`sm`})):(c(),P(X,{key:1,name:`send`,size:`sm`}))],10,cxe)],512),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Mt.value&&e.status?(c(),W(`div`,{key:0,ref_key:`modelDropdownRef`,ref:Bt,class:V([`composer-dropdown model-dropdown`,{"flip-down":qt.value}]),style:ae(mr.value),role:`menu`,onClick:n[18]||=H(()=>{},[`stop`]),onKeydown:Xr},[F(`div`,lxe,[Gr.value.length>0?(c(),W(`div`,uxe,U(z(u)(`status.starredModels`)),1)):E(``,!0),(c(!0),W(M,null,_(Gr.value,t=>(c(),W(`button`,{key:t.id,class:V([`md-row`,{"is-current":t.id===e.status.modelId}]),role:`menuitem`,onClick:e=>Zr(t.id)},[F(`span`,fxe,[t.id===e.status.modelId?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)]),F(`span`,pxe,U(t.displayName??t.model),1),F(`span`,mxe,U(t.provider),1),v(X,{class:`md-star`,name:`star`,size:`sm`})],10,dxe))),128)),Gr.value.length>0?(c(),W(`div`,hxe)):E(``,!0),Hr.value.length>0?(c(),W(`div`,gxe,U(Vr.value),1)):E(``,!0),(c(!0),W(M,null,_(Hr.value,t=>(c(),W(`button`,{key:t.id,class:V([`md-row`,{"is-current":t.id===e.status.modelId}]),role:`menuitem`,onClick:e=>Zr(t.id)},[F(`span`,vxe,[t.id===e.status.modelId?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)]),F(`span`,yxe,U(t.displayName??t.model),1),Wr(t.id)?(c(),P(X,{key:0,class:`md-star`,name:`star`,size:`sm`})):E(``,!0)],10,_xe))),128))]),Hr.value.length>0?(c(),W(`div`,bxe)):E(``,!0),F(`button`,{class:`md-row md-row-more`,role:`menuitem`,onClick:n[17]||=e=>{Zt(),o(`pickModel`)}},[F(`span`,xxe,[v(X,{name:`list`,size:`sm`})]),F(`span`,Sxe,U(z(u)(`status.moreModels`)),1),v(X,{class:`md-more-arrow`,name:`chevron-right`,size:`sm`})])],38)):E(``,!0)]),_:1}),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Nt.value&&e.status?(c(),W(`div`,{key:0,ref_key:`thinkingDropdownRef`,ref:Vt,class:`composer-dropdown thinking-dropdown`,style:ae(hr.value),role:`dialog`,"aria-label":z(u)(`composer.thinkingMenuTitle`),onClick:n[19]||=H(()=>{},[`stop`]),onKeydown:ie(H(Xt,[`prevent`]),[`escape`])},[F(`div`,wxe,[v(X,{name:`thinking`,size:`sm`}),F(`span`,null,U(z(u)(`composer.thinkingMenuTitle`)),1)]),v(s6,{"model-value":pn.value,options:yn.value,size:`sm`,"onUpdate:modelValue":_n},null,8,[`model-value`,`options`]),F(`div`,Txe,U(z(u)(`status.cacheNote`)),1)],44,Cxe)):E(``,!0)]),_:1})],512)],2),F(`div`,{class:V([`drop-overlay`,{show:z(Le)}]),"aria-hidden":`true`},[F(`div`,Exe,[v(X,{name:`file-plus`,size:`lg`}),F(`span`,null,U(z(u)(`composer.dropToAttach`)),1)])],2),(c(),P(ee,{to:`body`},[v(oe,{name:`composer-warning`},{default:B(()=>[pt.value?(c(),W(`div`,Dxe,[v(I7,{variant:`warning`,title:pt.value,"dismiss-label":z(u)(`common.dismiss`),onDismiss:n[20]||=e=>pt.value=null},null,8,[`title`,`dismiss-label`])])):E(``,!0)]),_:1}),v(F7,{"model-value":z(f)&&z(ue),title:z(u)(`composer.slashSheetTitle`),"onUpdate:modelValue":je},{default:B(()=>[F(`div`,Oxe,[v(Pp,{ref_key:`slashSheetSearchRef`,ref:we,modelValue:Oe.value,"onUpdate:modelValue":n[21]||=e=>Oe.value=e,placeholder:z(u)(`composer.slashSearchPlaceholder`),autocomplete:`off`,spellcheck:`false`,onKeydown:Et},null,8,[`modelValue`,`placeholder`])]),v(K3,{id:`composer-slash-menu`,layout:`sheet`,items:z(fe),"active-index":z(G),query:Oe.value,onSelect:z(pe),onHover:n[22]||=e=>G.value=e},null,8,[`items`,`active-index`,`query`,`onSelect`])]),_:1},8,[`model-value`,`title`]),v(F7,{"model-value":z(f)&&z(me),title:z(u)(`composer.mentionSheetTitle`),"onUpdate:modelValue":q},{default:B(()=>[F(`div`,kxe,[v(Pp,{ref_key:`mentionSheetSearchRef`,ref:Te,modelValue:ke.value,"onUpdate:modelValue":n[23]||=e=>ke.value=e,placeholder:z(u)(`composer.mentionSearchPlaceholder`),autocomplete:`off`,spellcheck:`false`,onKeydown:Et},null,8,[`modelValue`,`placeholder`])]),v(q3,{id:`composer-mention-menu`,layout:`sheet`,items:z(he),"active-index":z(ge),loading:z(_e),stale:z(ve),onSelect:z(be),onHover:n[24]||=e=>ge.value=e},null,8,[`items`,`active-index`,`loading`,`stale`,`onSelect`])]),_:1},8,[`model-value`,`title`]),v(F7,{"model-value":z(f)&&Vn.value,"onUpdate:modelValue":Xn},{default:B(()=>[F(`div`,{ref_key:`mobileModesMenuRef`,ref:Un,class:`msheet-add`,role:`menu`,onClick:n[26]||=H(()=>{},[`stop`]),onKeydown:$n},[(c(!0),W(M,null,_(qn.value,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`am-row`,role:`menuitem`,onMousedown:n[25]||=H(()=>{},[`prevent`]),onClick:t=>Qn(e)},[F(`span`,jxe,[v(X,{name:e.icon,size:`sm`},null,8,[`name`])]),F(`span`,Mxe,U(z(u)(e.nameKey)),1),e.descKey?(c(),W(`span`,Nxe,U(z(u)(e.descKey)),1)):E(``,!0)],40,Axe))),128))],544)]),_:1},8,[`model-value`])]))],34))}}),[[`__scopeId`,`data-v-0a01a109`]]),Pxe={class:`ah`},Fxe={class:`akind`},Ixe={class:`apath`},Lxe={class:`ah-path`},Rxe={class:`dg`},zxe={class:`dc`},Bxe={key:2,class:`body-shell`},Vxe={class:`shell-cmd`},Hxe={key:0,class:`shell-cwd`},Uxe={key:1,class:`shell-danger`},Wxe={class:`file-bar`},Gxe={class:`file-lang`},Kxe={class:`file-ln`},qxe={class:`file-text`},Jxe={key:4,class:`body-chip`},Yxe={class:`chip-label`},Xxe={class:`chip-value`},Zxe={key:0,class:`chip-detail`},Qxe={key:5,class:`body-chip`},$xe={key:0,class:`chip-label`},eSe={class:`chip-value`},tSe={key:6,class:`body-chip`},nSe={class:`chip-label`},rSe={class:`chip-value`},iSe={key:0,class:`chip-detail`},aSe={key:7,class:`body-chip`},oSe={class:`chip-label`},sSe={class:`chip-value`},cSe={key:0,class:`chip-detail`},lSe={key:8,class:`body-todo`},uSe={class:`todo-glyph`},dSe={key:10,class:`body-generic`},fSe={class:`gen-text`},pSe={key:11,class:`feedback-wrap`},mSe=[`placeholder`],hSe={class:`feedback-hint`},gSe={key:0,class:`plan-actions`},_Se={key:1,class:`abtn`},vSe=.4,ySe=Y(G({__name:`ApprovalCard`,props:{block:{},agentName:{},busy:{type:Boolean}},emits:[`decide`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=L(()=>{let e=r.block;return e.kind===`plan_review`?{plan:e.plan,path:e.path,options:e.options??[]}:null}),u=R(!1),d=R(!1),f=L(()=>[`plan_review`,`diff`,`file`].includes(r.block.kind)),m=R(null),g=R(null),y=R(null),b=R({top:!1,bottom:!1}),x=R({top:!1,bottom:!1}),S=R({top:!1,bottom:!1});function C(e){return t=>{let n=t.currentTarget;n instanceof HTMLElement&&(e.value={top:n.scrollTop>0,bottom:n.scrollTop+n.clientHeight{let{top:t,bottom:n}=e.value;if(!t&&!n)return;let r=`var(--menu-scroll-fade)`,i=t&&n?`linear-gradient(to bottom, transparent 0, black ${r}, black calc(100% - ${r}), transparent 100%)`:t?`linear-gradient(to bottom, transparent, black ${r})`:`linear-gradient(to top, transparent, black ${r})`;return{maskImage:i,WebkitMaskImage:i}})}let k=O(b),A=O(x),j=O(S);function N(){let e=[[m.value,b],[g.value,x],[y.value,S]];for(let[t,n]of e)t&&(n.value={top:t.scrollTop>0,bottom:t.scrollTop+t.clientHeightvoid n(N)),s(u,()=>void n(N)),s(()=>r.block,()=>void n(N));let ee=[`shell`,`diff`,`file`,`fileop`,`url`,`search`,`invocation`,`todo`,`plan_review`,`generic`];function I(){return a(`approval.title.${ee.includes(r.block.kind)?r.block.kind:`generic`}`)}let te=R(!1),ne=R(``),re=R(null);function ie(){let e=re.value;if(!e)return;e.style.height=`auto`;let t=(window.visualViewport?.height??window.innerHeight)*vSe,n=Math.min(e.scrollHeight,t);e.style.height=`${n}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`}let oe=null,se=0;function ce(){if(oe?.disconnect(),oe=null,typeof ResizeObserver>`u`)return;let e=re.value;e&&(oe=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;t!==se&&(se=t,ie())}),oe.observe(e))}s(ne,()=>void n(ie)),s(te,e=>{if(!e){oe?.disconnect(),oe=null;return}n(()=>{ie(),ce()})}),s(u,e=>{e||n(ie)});let{uiFontSize:le}=A6();s(le,()=>void n(ie));function ue(){r.busy||(te.value=!0,ne.value=``,setTimeout(()=>re.value?.focus(),0))}function fe(){if(r.busy)return;let e=ne.value.trim();o.value?he(`feedback`,{decision:`rejected`,selectedLabel:`Revise`,feedback:e||void 0}):he(`feedback`,{decision:`rejected`,feedback:e||void 0}),te.value=!1,ne.value=``}function H(){te.value=!1,ne.value=``}function G(e){e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),fe()):e.key===`Escape`&&(e.preventDefault(),H())}let me=R(null);s(()=>r.busy,e=>{e||(me.value=null)});function he(e,t){r.busy||(me.value=e,i(`decide`,t))}function ge(){he(`approve`,{decision:`approved`})}function _e(){he(`approveSession`,{decision:`approved`,scope:`session`})}function ve(){he(`reject`,{decision:`rejected`})}function ye(){he(`approvePlan`,{decision:`approved`})}function be(e){he(`option:${e}`,{decision:`approved`,selectedLabel:e})}function xe(){r.busy||ue()}function Se(){he(`rejectAndExit`,{decision:`rejected`,selectedLabel:`Reject and Exit`})}function Ce(e){let t=(document.activeElement?.tagName??``).toLowerCase();if(t===`input`||t===`textarea`||r.busy||u.value)return;let n=o.value;if(n){if(n.options.length===0){e.key===`1`?(e.preventDefault(),ye()):e.key===`2`?(e.preventDefault(),xe()):e.key===`3`&&(e.preventDefault(),Se());return}e.key===`1`&&n.options[0]?(e.preventDefault(),be(n.options[0].label)):e.key===`2`&&n.options[1]?(e.preventDefault(),be(n.options[1].label)):e.key===`3`&&n.options[2]&&(e.preventDefault(),be(n.options[2].label));return}e.key===`1`?(e.preventDefault(),ge()):e.key===`2`?(e.preventDefault(),_e()):e.key===`3`?(e.preventDefault(),ve()):e.key===`4`&&(e.preventDefault(),ue())}return p(()=>{document.addEventListener(`keydown`,Ce),window.addEventListener(`resize`,ie),window.visualViewport?.addEventListener(`resize`,ie)}),h(()=>{document.removeEventListener(`keydown`,Ce),window.removeEventListener(`resize`,ie),window.visualViewport?.removeEventListener(`resize`,ie),oe?.disconnect(),oe=null}),(t,n)=>(c(),P(R4,{class:V([`appr`,{minimized:u.value}])},pe({head:B(()=>[F(`div`,Pxe,[n[6]||=F(`span`,{class:`ah-ic`},`!`,-1),F(`span`,Fxe,U(I()),1),F(`span`,Ixe,[e.block.kind===`diff`||e.block.kind===`file`||e.block.kind===`fileop`?(c(),W(M,{key:0},[K(U(e.block.path),1)],64)):e.block.kind===`shell`?(c(),W(M,{key:1},[K(U(e.block.command),1)],64)):e.block.kind===`url`?(c(),W(M,{key:2},[K(U(e.block.url),1)],64)):e.block.kind===`search`?(c(),W(M,{key:3},[K(U(e.block.query),1)],64)):e.block.kind===`invocation`?(c(),W(M,{key:4},[K(U(e.block.name),1)],64)):e.block.kind===`generic`?(c(),W(M,{key:5},[K(U(e.block.summary),1)],64)):E(``,!0)]),e.agentName&&!u.value?(c(),P(ip,{key:0,variant:`neutral`,size:`sm`},{default:B(()=>[K(U(z(a)(`approval.subagentBadge`,{name:e.agentName})),1)]),_:1})):E(``,!0),u.value?E(``,!0):(c(),P(ip,{key:1,variant:`warning`,size:`sm`,class:`aw`},{default:B(()=>[K(U(z(a)(`approval.required`)),1)]),_:1})),f.value&&!u.value?(c(),P(Ca,{key:2,class:`aexpand`,size:`sm`,label:d.value?z(a)(`approval.collapsePlan`):z(a)(`approval.expandPlan`),tooltip:d.value?z(a)(`approval.collapsePlan`):z(a)(`approval.expandPlan`),onClick:n[0]||=e=>d.value=!d.value},{default:B(()=>[v(X,{name:d.value?`collapse`:`expand`,size:`md`},null,8,[`name`])]),_:1},8,[`label`,`tooltip`])):E(``,!0),v(Ca,{class:`amin`,size:`sm`,label:u.value?z(a)(`question.expand`):z(a)(`question.minimize`),onClick:n[1]||=e=>u.value=!u.value},{default:B(()=>[u.value?(c(),P(X,{key:0,name:`chevron-up`,size:`md`})):(c(),P(X,{key:1,name:`minus`,size:`md`}))]),_:1},8,[`label`])])]),_:2},[u.value?void 0:{name:`default`,fn:B(()=>[e.block.kind===`plan_review`&&e.block.path?(c(),P(vp,{key:0,text:e.block.path},{default:B(()=>[F(`div`,Lxe,U(e.block.path),1)]),_:1},8,[`text`])):E(``,!0),e.block.kind===`diff`?(c(),W(`div`,{key:1,ref_key:`diffBodyRef`,ref:m,class:V([`diff`,{expanded:d.value}]),style:ae(z(k)),onScroll:n[2]||=(...e)=>z(w)&&z(w)(...e)},[(c(!0),W(M,null,_(e.block.diff,(e,t)=>(c(),W(`div`,{key:t,class:V([`dl`,e.kind===`add`?`add`:e.kind===`rem`?`del`:``])},[F(`span`,Rxe,U(e.gutter),1),F(`span`,zxe,U(e.text),1)],2))),128))],38)):e.block.kind===`shell`?(c(),W(`div`,Bxe,[F(`div`,Vxe,[n[7]||=F(`span`,{class:`shell-dollar`},`$`,-1),K(` `+U(e.block.command),1)]),e.block.cwd?(c(),W(`div`,Hxe,`cwd: `+U(e.block.cwd),1)):E(``,!0),e.block.danger?(c(),W(`div`,Uxe,U(z(a)(`approval.danger`,{detail:e.block.danger})),1)):E(``,!0)])):e.block.kind===`file`?(c(),W(`div`,{key:3,class:V([`body-file`,{expanded:d.value}])},[F(`div`,Wxe,[F(`span`,Gxe,U(e.block.language??``),1)]),F(`div`,{class:`file-content`,ref_key:`fileBodyRef`,ref:g,style:ae(z(A)),onScroll:n[3]||=(...e)=>z(T)&&z(T)(...e)},[(c(!0),W(M,null,_(e.block.content.split(` -`),(e,t)=>(c(),W(`div`,{key:t,class:`file-line`},[F(`span`,Kxe,U(t+1),1),F(`span`,qxe,U(e),1)]))),128))],36)],2)):e.block.kind===`fileop`?(c(),W(`div`,Jxe,[F(`span`,Yxe,U(e.block.op),1),F(`span`,Xxe,U(e.block.path),1),e.block.detail?(c(),W(`span`,Zxe,U(e.block.detail),1)):E(``,!0)])):e.block.kind===`url`?(c(),W(`div`,Qxe,[e.block.method?(c(),W(`span`,$xe,U(e.block.method),1)):E(``,!0),F(`span`,eSe,U(e.block.url),1)])):e.block.kind===`search`?(c(),W(`div`,tSe,[F(`span`,nSe,U(z(a)(`approval.searchQueryLabel`)),1),F(`span`,rSe,U(e.block.query),1),e.block.scope?(c(),W(`span`,iSe,U(z(a)(`approval.searchScope`,{scope:e.block.scope})),1)):E(``,!0)])):e.block.kind===`invocation`?(c(),W(`div`,aSe,[F(`span`,oSe,U(e.block.kind2),1),F(`span`,sSe,U(e.block.name),1),e.block.description?(c(),W(`span`,cSe,U(e.block.description),1)):E(``,!0)])):e.block.kind===`todo`?(c(),W(`div`,lSe,[(c(!0),W(M,null,_(e.block.items,(e,t)=>(c(),W(`div`,{key:t,class:`todo-item`},[F(`span`,uSe,U(e.status===`done`||e.status===`completed`?`✓`:`○`),1),F(`span`,{class:V([`todo-title`,{"todo-done":e.status===`done`||e.status===`completed`}])},U(e.title),3)]))),128))])):e.block.kind===`plan_review`?(c(),W(`div`,{key:9,ref_key:`planBodyRef`,ref:y,class:V([`body-plan`,{expanded:d.value}]),style:ae(z(j)),onScroll:n[4]||=(...e)=>z(D)&&z(D)(...e)},[v(T4,{text:e.block.plan},null,8,[`text`])],38)):(c(),W(`div`,dSe,[F(`span`,fSe,U(e.block.summary),1)])),te.value?(c(),W(`div`,pSe,[l(F(`textarea`,{ref_key:`feedbackRef`,ref:re,"onUpdate:modelValue":n[5]||=e=>ne.value=e,class:`feedback-ta`,placeholder:z(a)(`approval.feedbackPlaceholder`),rows:`2`,onKeydown:G},null,40,mSe),[[de,ne.value]]),F(`div`,hSe,U(z(a)(`approval.feedbackHint`)),1)])):E(``,!0)]),key:`0`},u.value?void 0:{name:`foot`,fn:B(()=>[o.value?(c(),W(`div`,gSe,[o.value.options.length>0?(c(!0),W(M,{key:0},_(o.value.options,(t,n)=>(c(),P(vp,{key:n,text:t.description},{default:B(()=>[v(YT,{class:`kbtn`,size:`sm`,variant:`primary`,loading:me.value===`option:${t.label}`,disabled:e.busy,onClick:e=>be(t.label)},{default:B(()=>[K(U(t.label),1),v($T,{class:`k`,keys:[String(n+1)]},null,8,[`keys`])]),_:2},1032,[`loading`,`disabled`,`onClick`])]),_:2},1032,[`text`]))),128)):(c(),P(YT,{key:1,class:`kbtn`,size:`sm`,variant:`primary`,loading:me.value===`approvePlan`,disabled:e.busy,onClick:ye},{default:B(()=>[K(U(z(a)(`approval.approvePlan`)),1),v($T,{class:`k`,keys:[`1`]})]),_:1},8,[`loading`,`disabled`])),v(YT,{class:`kbtn`,size:`sm`,variant:`secondary`,disabled:e.busy,onClick:xe},{default:B(()=>[K(U(z(a)(`approval.revise`)),1),o.value.options.length===0?(c(),P($T,{key:0,class:`k`,keys:[`2`]})):E(``,!0)]),_:1},8,[`disabled`]),v(YT,{class:`kbtn`,size:`sm`,variant:`danger-soft`,loading:me.value===`rejectAndExit`,disabled:e.busy,onClick:Se},{default:B(()=>[K(U(z(a)(`approval.rejectAndExit`)),1),o.value.options.length===0?(c(),P($T,{key:0,class:`k`,keys:[`3`]})):E(``,!0)]),_:1},8,[`loading`,`disabled`])])):(c(),W(`div`,_Se,[v(YT,{class:`kbtn`,size:`sm`,variant:`primary`,loading:me.value===`approve`,disabled:e.busy,onClick:ge},{default:B(()=>[K(U(z(a)(`approval.approve`)),1),v($T,{class:`k`,keys:[`1`]})]),_:1},8,[`loading`,`disabled`]),v(YT,{class:`kbtn`,size:`sm`,variant:`secondary`,loading:me.value===`approveSession`,disabled:e.busy,onClick:_e},{default:B(()=>[K(U(z(a)(`approval.approveSession`)),1),v($T,{class:`k`,keys:[`2`]})]),_:1},8,[`loading`,`disabled`]),v(YT,{class:`kbtn`,size:`sm`,variant:`secondary`,loading:me.value===`reject`,disabled:e.busy,onClick:ve},{default:B(()=>[K(U(z(a)(`approval.reject`)),1),v($T,{class:`k`,keys:[`3`]})]),_:1},8,[`loading`,`disabled`]),v(YT,{class:`kbtn`,size:`sm`,variant:`secondary`,disabled:e.busy,onClick:ue},{default:B(()=>[K(U(z(a)(`approval.feedback`)),1),v($T,{class:`k`,keys:[`4`]})]),_:1},8,[`disabled`])]))]),key:`1`}]),1032,[`class`]))}}),[[`__scopeId`,`data-v-f7485122`]]),bSe={class:`goal-panel`},xSe={key:0,class:`goal-criterion`},SSe={class:`goal-criterion-label`},CSe=Y(G({__name:`GoalPanel`,props:{goal:{},openFile:{type:Function}},setup(e){let{t}=J();return(n,r)=>(c(),W(`div`,bSe,[v(T4,{text:e.goal.objective,"open-file":e.openFile},null,8,[`text`,`open-file`]),e.goal.completionCriterion?(c(),W(`div`,xSe,[F(`div`,SSe,[v(X,{name:`check-list`,size:`md`}),F(`span`,null,U(z(t)(`status.goalDoneWhen`)),1)]),v(T4,{text:e.goal.completionCriterion,"open-file":e.openFile},null,8,[`text`,`open-file`])])):E(``,!0)]))}}),[[`__scopeId`,`data-v-81a928ba`]]),wSe={class:`plan-panel`},TSe={key:0,class:`plan-review-row`},ESe={class:`plan-review-label`},DSe={key:1,class:`plan-review-row plan-review-feedback`},OSe={class:`plan-review-label`},kSe={key:3,class:`plan-path-only`},ASe={class:`plan-path-hint`},jSe={class:`plan-path`},MSe={key:4,class:`plan-empty`},NSe=Y(G({__name:`PlanPanel`,props:{plan:{},planModeOn:{type:Boolean},openFile:{type:Function},revealSavedPlan:{type:Function}},setup(e){let{t}=J();return(n,r)=>(c(),W(`div`,wSe,[e.plan?.selectedOption?(c(),W(`div`,TSe,[F(`span`,ESe,U(z(t)(`tools.plan.selectedOption`)),1),F(`span`,null,U(e.plan.selectedOption),1)])):E(``,!0),e.plan?.feedback?(c(),W(`div`,DSe,[F(`span`,OSe,U(z(t)(`tools.plan.feedback`)),1),F(`span`,null,U(e.plan.feedback),1)])):E(``,!0),e.plan?.plan?(c(),P(T4,{key:2,text:e.plan.plan,"open-file":e.openFile},null,8,[`text`,`open-file`])):e.plan?.path?(c(),W(`div`,kSe,[F(`span`,ASe,U(z(t)(`tools.plan.pathOnlyHint`)),1),F(`span`,jSe,U(e.plan.path),1),e.revealSavedPlan?(c(),P(YT,{key:0,variant:`ghost`,size:`sm`,onClick:r[0]||=t=>void e.revealSavedPlan(e.plan.agentId,e.plan.toolCallId)},{default:B(()=>[v(X,{name:`external-link`,size:`sm`}),K(` `+U(z(t)(`tools.plan.revealInFileManager`)),1)]),_:1})):E(``,!0)])):(c(),W(`div`,MSe,[v(X,{class:`plan-empty-ico`,name:`file-edit`,size:`lg`}),F(`span`,null,U(z(t)(e.planModeOn?`status.planEmptyArmed`:`status.planEmptyIdle`)),1)]))]))}}),[[`__scopeId`,`data-v-2883948d`]]),PSe={class:`qh`},FSe={class:`qtitle`},ISe={key:0,class:`qstep`},LSe={key:1,class:`qmin-peek`},RSe={class:`qbody`},zSe=[`aria-label`],BSe=[`aria-selected`,`aria-label`,`onClick`],VSe={class:`qstep-num`},HSe={key:1,class:`qheader-chip`},USe={class:`qtext`},WSe={class:`qopts`},GSe=[`onClick`],KSe={class:`qopt-key`},qSe={class:`qopt-glyph`},JSe={key:0,class:`chk`},YSe={key:1,class:`rad`},XSe={class:`qopt-text`},ZSe={class:`qopt-label`},QSe={key:0,class:`qopt-desc`},$Se={class:`qopt-glyph`},eCe={key:0,class:`chk`},tCe={key:1,class:`rad`},nCe={class:`qopt-text qopt-text-other`},rCe={class:`qopt-label`},iCe={key:0,class:`qopt-desc`},aCe=[`placeholder`],oCe={class:`qfoot`},sCe=Y(G({__name:`QuestionCard`,props:{question:{},busyKind:{}},emits:[`answer`,`dismiss`],setup(e,{emit:t}){let r=e,{t:i}=J(),a=t,o=R(0),u=R(!1),d=L(()=>r.question.questions[o.value]),f=L(()=>r.question.questions.length);function m(){o.value>0&&o.value--}function g(){o.value=0&&e0:t.kind===`multiWithOther`?t.optionIds.length>0||t.otherText.trim().length>0:t.kind===`other`?t.text.trim().length>0:!0:!1}function x(){return b(d.value.id)}let S=R({});function C(e){return e.recommended===!0?!0:/\b(?:recommended|recommend)\b/.test(`${e.label} ${e.description??``}`.toLowerCase())}function w(){let e={...S.value},t=!1;for(let n of r.question.questions){if(e[n.id])continue;let r=n.options.filter(C);r.length!==0&&(e[n.id]=n.multiSelect?{kind:`multi`,optionIds:r.map(e=>e.id)}:{kind:`single`,optionId:r[0].id},t=!0)}t&&(S.value=e)}s(()=>r.question.questionId,()=>{o.value=0,u.value=!1,S.value={},O.value={}}),s(()=>r.question,()=>{o.value>=r.question.questions.length&&(o.value=0),w()},{immediate:!0,deep:!0});function T(e,t){let n=S.value[e];if(n&&n.kind===`single`&&n.optionId===t){let t={...S.value};delete t[e],S.value=t}else S.value={...S.value,[e]:{kind:`single`,optionId:t}}}function D(e,t){let n=S.value[e],r=n&&(n.kind===`multi`||n.kind===`multiWithOther`)?(n.kind,[...n.optionIds]):[],i=r.indexOf(t);i>=0?r.splice(i,1):r.push(t);let a=S.value[e],o=a&&a.kind===`multiWithOther`?a.otherText:``;o?S.value={...S.value,[e]:{kind:`multiWithOther`,optionIds:r,otherText:o}}:S.value={...S.value,[e]:{kind:`multi`,optionIds:r}}}let O=R({}),k=R(null);function A(e){let t=r.question.questions.find(t=>t.id===e),n=O.value[e]??``;if(t.multiSelect){let t=S.value[e],r=t&&(t.kind===`multi`||t.kind===`multiWithOther`)?(t.kind,[...t.optionIds]):[];S.value={...S.value,[e]:{kind:`multiWithOther`,optionIds:r,otherText:n}}}else S.value={...S.value,[e]:{kind:`other`,text:n}}}function j(e){A(e),n(()=>k.value?.focus())}function N(e,t){let n=S.value[e];return n?n.kind===`single`?n.optionId===t:n.kind===`multi`||n.kind===`multiWithOther`?n.optionIds.includes(t):!1:!1}function ee(e){let t=S.value[e];return!!(t&&(t.kind===`other`||t.kind===`multiWithOther`))}function I(){return r.question.questions.every(e=>b(e.id))}let te=L(()=>r.busyKind===`answer`),ne=L(()=>r.busyKind===`dismiss`),re=L(()=>!!r.busyKind);function ie(){if(re.value||!I())return;let e={answers:S.value,method:`click`};a(`answer`,r.question.questionId,e)}function ae(){re.value||a(`dismiss`,r.question.questionId)}function oe(e){let t=(document.activeElement?.tagName??``).toLowerCase(),n=t===`input`||t===`textarea`;if(re.value)return;if(e.key===`Enter`){if(e.preventDefault(),u.value)return;o.value=1&&r<=9){e.preventDefault();let t=d.value,n=r-1,i=t.options[n];i&&(t.multiSelect?D(t.id,i.id):T(t.id,i.id))}}return p(()=>document.addEventListener(`keydown`,oe)),h(()=>document.removeEventListener(`keydown`,oe)),(e,t)=>(c(),P(R4,{class:V([`qcard`,{minimized:u.value}])},pe({head:B(()=>[F(`div`,PSe,[t[5]||=F(`span`,{class:`qh-ic`},`?`,-1),F(`span`,FSe,U(z(i)(`question.title`)),1),f.value>1&&!u.value?(c(),W(`span`,ISe,U(z(i)(`question.step`,{current:o.value+1,total:f.value})),1)):E(``,!0),u.value?(c(),W(`span`,LSe,U(d.value.question),1)):E(``,!0),v(Ca,{class:`qmin`,size:`sm`,label:u.value?z(i)(`question.expand`):z(i)(`question.minimize`),onClick:t[0]||=e=>u.value=!u.value},{default:B(()=>[u.value?(c(),P(X,{key:0,name:`chevron-up`,size:`md`})):(c(),P(X,{key:1,name:`minus`,size:`md`}))]),_:1},8,[`label`])])]),_:2},[u.value?void 0:{name:`default`,fn:B(()=>[F(`div`,RSe,[f.value>1?(c(),W(`div`,{key:0,class:`qsteps`,role:`tablist`,"aria-label":z(i)(`question.step`,{current:o.value+1,total:f.value})},[(c(!0),W(M,null,_(r.question.questions,(e,t)=>(c(),W(`button`,{key:e.id,type:`button`,class:V([`qstep-dot`,{active:t===o.value,answered:b(e.id)}]),"aria-selected":t===o.value,"aria-label":z(i)(`question.step`,{current:t+1,total:f.value}),onClick:e=>y(t)},[F(`span`,VSe,U(t+1),1)],10,BSe))),128))],8,zSe)):E(``,!0),d.value.header?(c(),W(`div`,HSe,[v(ip,{variant:`neutral`,size:`sm`},{default:B(()=>[K(U(d.value.header),1)]),_:1})])):E(``,!0),F(`div`,USe,U(d.value.question),1),d.value.body?(c(),P(T4,{key:2,text:d.value.body,class:`qmdbody`},null,8,[`text`])):E(``,!0),F(`div`,WSe,[(c(!0),W(M,null,_(d.value.options,(e,t)=>(c(),W(`label`,{key:e.id,class:V([`qopt`,{selected:N(d.value.id,e.id)}]),onClick:H(t=>d.value.multiSelect?D(d.value.id,e.id):T(d.value.id,e.id),[`prevent`])},[F(`span`,KSe,U(t+1),1),F(`span`,qSe,[d.value.multiSelect?(c(),W(`span`,JSe,U(N(d.value.id,e.id)?`■`:`□`),1)):(c(),W(`span`,YSe,U(N(d.value.id,e.id)?`●`:`○`),1))]),F(`span`,XSe,[F(`span`,ZSe,U(e.label),1),e.description?(c(),W(`span`,QSe,U(e.description),1)):E(``,!0)])],10,GSe))),128)),d.value.allowOther?(c(),W(`label`,{key:0,class:V([`qopt`,{selected:ee(d.value.id)}]),onClick:t[4]||=H(e=>j(d.value.id),[`prevent`])},[t[6]||=F(`span`,{class:`qopt-key`},null,-1),F(`span`,$Se,[d.value.multiSelect?(c(),W(`span`,eCe,U(ee(d.value.id)?`■`:`□`),1)):(c(),W(`span`,tCe,U(ee(d.value.id)?`●`:`○`),1))]),F(`span`,nCe,[F(`span`,rCe,U(d.value.otherLabel??z(i)(`question.otherDefault`)),1),d.value.otherDescription?(c(),W(`span`,iCe,U(d.value.otherDescription),1)):E(``,!0)]),l(F(`input`,{ref_key:`otherInputEl`,ref:k,"onUpdate:modelValue":t[1]||=e=>O.value[d.value.id]=e,class:`other-input`,type:`text`,placeholder:d.value.otherLabel??z(i)(`question.otherDefault`),onInput:t[2]||=e=>A(d.value.id),onFocus:t[3]||=e=>A(d.value.id)},null,40,aCe),[[de,O.value[d.value.id]]])],2)):E(``,!0)])])]),key:`0`},u.value?void 0:{name:`foot`,fn:B(()=>[F(`div`,oCe,[o.value[K(U(z(i)(`question.nextQuestion`)),1)]),_:1},8,[`disabled`])):(c(),P(YT,{key:1,class:`qfoot-btn qfoot-main`,size:`sm`,variant:`primary`,disabled:!I(),loading:te.value,onClick:ie},{default:B(()=>[K(U(z(i)(`question.submit`)),1)]),_:1},8,[`disabled`,`loading`])),f.value>1?(c(),P(YT,{key:2,class:`qfoot-btn`,size:`sm`,variant:`secondary`,disabled:o.value===0||re.value,onClick:m},{default:B(()=>[K(U(z(i)(`question.back`)),1)]),_:1},8,[`disabled`])):E(``,!0),v(YT,{class:`qfoot-btn`,size:`sm`,variant:`ghost`,loading:ne.value,disabled:re.value,onClick:ae},{default:B(()=>[K(U(z(i)(`question.dismiss`)),1)]),_:1},8,[`loading`,`disabled`])])]),key:`1`}]),1032,[`class`]))}}),[[`__scopeId`,`data-v-ce0bd159`]]),z7=Y(G({__name:`StatusGlyph`,props:{status:{}},setup(e){let t=e,n={pending:`○`,run:`●`,done:`✓`,fail:`✗`};return(e,r)=>(c(),W(`span`,{class:V([`status-glyph`,`s-${t.status}`]),"aria-hidden":`true`},U(n[t.status]),3))}}),[[`__scopeId`,`data-v-f870866a`]]),cCe={key:0,class:`sg-empty`},lCe={key:1,class:`sg-grid`},uCe=[`aria-label`,`onClick`],dCe={class:`sg-top`},fCe={class:`sg-num`},pCe={class:`sg-name`},mCe={key:1,class:`sg-desc`},hCe={class:`sg-foot`},gCe={key:0,class:`sg-model`},_Ce={class:`sg-status`},vCe={class:`sg-state`},yCe={key:0,class:`sg-time`},bCe=Y(G({__name:`SubagentGrid`,props:{tasks:{},filter:{}},emits:[`cancel`,`open`],setup(e,{emit:t}){let n=t,{t:r}=J();function i(e){return e}function a(e){return e===`running`?`tasks.emptyRunning`:e===`done`?`tasks.emptyDone`:e===`active`?`tasks.emptyRecent`:`tasks.emptyTasks`}let o=m(`modelDisplay`),s=m(`subagentEffort`);function l(e){let{model:t,thinkingEffort:n}=i(e);return[o?.(t)??t,s?.(n)].filter(Boolean).join(` · `)||void 0}function u(e){let t=i(e).state;return r(t===`done`?`tasks.stateDone`:t===`fail`?`tasks.stateFail`:t===`cancelled`?`tasks.stateCancelled`:`tasks.running`)}function d(e,t){return String(e.dynamicWorkflowIndex??t+1).padStart(2,`0`)}function f(e){return!!(i(e).agentId||e.output?.length)}return(t,o)=>e.tasks.length===0?(c(),W(`div`,cCe,U(z(r)(a(e.filter))),1)):(c(),W(`div`,lCe,[(c(!0),W(M,null,_(e.tasks,(e,t)=>(c(),W(`article`,{key:e.id,class:V([`sg-card`,[`s-${i(e).state}`,{openable:f(e)}]])},[f(e)?(c(),W(`button`,{key:0,class:`sg-open`,type:`button`,"aria-label":e.name,onClick:t=>n(`open`,i(e).agentId??e.id)},null,8,uCe)):E(``,!0),F(`div`,dCe,[F(`span`,fCe,U(d(e,t)),1),F(`span`,pCe,U(e.name),1)]),e.meta?(c(),W(`div`,mCe,U(e.meta),1)):E(``,!0),F(`div`,hCe,[l(e)?(c(),W(`div`,gCe,[F(`span`,null,U(l(e)),1)])):E(``,!0),F(`div`,_Ce,[F(`span`,vCe,[i(e).state===`run`?(c(),P(z7,{key:0,status:`run`})):i(e).state===`done`?(c(),P(X,{key:1,class:`sg-ic-done`,name:`check`,size:`sm`})):(c(),P(X,{key:2,name:`close`,size:`sm`})),K(` `+U(u(e)),1)]),e.timing?(c(),W(`span`,yCe,[v(X,{name:`clock`,size:`sm`}),K(` `+U(e.timing),1)])):E(``,!0)])]),i(e).state===`run`?(c(),P(Ca,{key:2,class:`sg-cancel`,size:`sm`,label:z(r)(`tasks.stop`),onClick:H(t=>n(`cancel`,e.id),[`stop`])},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`onClick`])):E(``,!0)],2))),128))]))}}),[[`__scopeId`,`data-v-5945b343`]]),xCe={class:`taskspane`},SCe={class:`tp-list`},CCe={key:0,class:`tp-empty`},wCe={class:`tp-main`},TCe=[`aria-label`,`onClick`],ECe=[`aria-label`],DCe={class:`tp-name`},OCe={key:1,class:`tp-meta`},kCe={key:2,class:`tp-model`},ACe={key:3,class:`tp-model`},jCe={key:4,class:`tp-time`},MCe=Y(G({__name:`TasksPane`,props:{tasks:{},filter:{}},emits:[`cancel`,`open`],setup(e,{emit:t}){let n=t,{t:r}=J();function i(e){return e}function a(e){return e===`running`?`tasks.emptyRunning`:e===`done`?`tasks.emptyDone`:e===`active`?`tasks.emptyRecent`:`tasks.emptyTasks`}function o(e){return e.kind===`subagent`||!!(e.output?.length||e.meta)}function s(e){o(e)&&n(`open`,i(e).agentId??e.id)}function l(e){let t=i(e).state;return r(t===`done`?`tasks.stateDone`:t===`fail`?`tasks.stateFail`:t===`cancelled`?`tasks.stateCancelled`:`tasks.running`)}let u=m(`modelDisplay`),d=m(`subagentEffort`);function f(e){if(e.kind!==`subagent`)return;let t=i(e).model;return u?.(t)??t}function p(e){if(e.kind===`subagent`)return d?.(i(e).thinkingEffort)}return(t,u)=>(c(),W(`div`,xCe,[F(`div`,SCe,[e.tasks.length===0?(c(),W(`div`,CCe,U(z(r)(a(e.filter))),1)):(c(!0),W(M,{key:1},_(e.tasks,e=>(c(),W(`div`,{key:e.id,class:V([`tp-row`,{fail:i(e).state===`fail`,expandable:o(e)}])},[F(`div`,wCe,[o(e)?(c(),W(`button`,{key:0,class:`tp-open`,type:`button`,"aria-label":e.name,onClick:t=>s(e)},null,8,TCe)):E(``,!0),F(`span`,{class:`tp-glyph`,role:`img`,"aria-label":l(e)},[i(e).state===`run`?(c(),P(z7,{key:0,status:`run`})):i(e).state===`done`?(c(),P(X,{key:1,class:`tp-done`,name:`check`,size:`sm`})):i(e).state===`cancelled`?(c(),P(X,{key:2,class:`tp-cancelled`,name:`close`,size:`sm`})):(c(),P(X,{key:3,class:`tp-fail`,name:`close`,size:`sm`}))],8,ECe),F(`span`,DCe,U(e.name),1),e.meta?(c(),W(`span`,OCe,U(e.meta),1)):E(``,!0),f(e)?(c(),W(`span`,kCe,U(f(e)),1)):E(``,!0),p(e)?(c(),W(`span`,ACe,U(p(e)),1)):E(``,!0),e.timing?(c(),W(`span`,jCe,U(e.timing),1)):E(``,!0),i(e).state===`run`?(c(),P(Ca,{key:5,class:`tp-stop`,size:`sm`,label:z(r)(`tasks.stop`),onClick:H(t=>n(`cancel`,e.id),[`stop`])},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`onClick`])):E(``,!0),o(e)?(c(),P(X,{key:6,class:`tp-chevron`,name:`chevron-right`,size:`sm`})):E(``,!0)])],2))),128))])]))}}),[[`__scopeId`,`data-v-f4589f0b`]]),NCe={class:`todo-card`},PCe={key:0,class:`tc-empty`},FCe={class:`tc-name`},ICe=Y(G({__name:`TodoCard`,props:{todos:{}},setup(e){let{t}=J();return(n,r)=>(c(),W(`div`,NCe,[e.todos.length===0?(c(),W(`div`,PCe,[v(X,{class:`tc-empty-ico`,name:`list`,size:`lg`}),F(`span`,null,U(z(t)(`tasks.emptyTodo`)),1)])):(c(!0),W(M,{key:1},_(e.todos,(e,t)=>(c(),W(`div`,{key:t,class:V([`tc-row`,`s-${e.status}`])},[F(`span`,{class:V([`tc-glyph`,`g-${e.status}`])},[e.status===`done`?(c(),P(X,{key:0,name:`check`,size:`md`})):e.status===`in_progress`?(c(),P(np,{key:1,class:`tc-spin`,size:`sm`})):E(``,!0)],2),F(`span`,FCe,U(e.title),1)],2))),128))]))}}),[[`__scopeId`,`data-v-4e4d0054`]]),LCe={class:`fc-label`},B7=Y(G({__name:`FilterControl`,props:{modelValue:{},options:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=L(()=>r.options.find(e=>e.value===r.modelValue)),o=typeof window<`u`&&window.matchMedia?.(`(hover: none)`).matches?`lg`:`md`,l=R(null),u=R(!1),d=0,f=null;async function m(){let e=l.value?.closest(`.dock-work-head`);if(!e)return;let t=e.querySelector(`.wp-head-tab`),r=getComputedStyle(e),i=(Number.parseFloat(r.columnGap)||0)*2,a=e.clientWidth-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight)-i,o=t?.scrollWidth??0;if(!u.value){let e=l.value?.querySelector(`.ui-seg`);e&&e.offsetWidth>0&&(d=e.offsetWidth)}let s=o+d>a;if(u.value=s,!s){await n();let e=l.value?.querySelector(`.ui-seg`);e&&e.offsetWidth>0&&(d=e.offsetWidth),u.value=o+d>a}}let h=R(!1),g=R(null),y=R(null),b=R({left:`0px`,top:`0px`});function x(){return g.value?.$el??null}async function S(){if(h.value){C();return}h.value=!0,await n(),w(),T(),window.addEventListener(`mousedown`,k,!0),window.addEventListener(`keydown`,A,!0),window.addEventListener(`resize`,w),window.addEventListener(`scroll`,w,!0)}function C(e){h.value=!1,window.removeEventListener(`mousedown`,k,!0),window.removeEventListener(`keydown`,A,!0),window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,w,!0),e?.refocus&&x()?.focus()}function w(){let e=x();if(!e)return;let t=e.getBoundingClientRect(),n=y.value?.offsetHeight??0,r=getComputedStyle(document.documentElement),i=Number.parseFloat(r.getPropertyValue(`--space-2`))||0,a=Number.parseFloat(r.getPropertyValue(`--space-1`))||0,o=y.value?.offsetWidth??0,s=Math.min(t.left,Math.max(i,window.innerWidth-o-i));t.bottom+a+n<=window.innerHeight-i?b.value={left:`${s}px`,top:`${t.bottom+a}px`}:b.value={left:`${s}px`,bottom:`${window.innerHeight-t.top+a}px`}}function T(){let e=y.value;e&&(e.querySelector(`.ui-menu-item.is-active`)??e.querySelector(`.ui-menu-item`))?.focus()}function D(){h.value||S()}function O(e){let t=e.relatedTarget;t&&(y.value?.contains(t)||x()?.contains(t))||C()}function k(e){let t=e.target;if(t){if(y.value?.contains(t)){e.stopImmediatePropagation();return}x()?.contains(t)||C()}}function A(e){e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),C({refocus:!0}))}function j(e){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(y.value?.querySelectorAll(`.ui-menu-item`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}function N(e){i(`update:modelValue`,e),C({refocus:!0})}return p(()=>{let e=l.value?.closest(`.dock-work-head`);!e||typeof ResizeObserver!=`function`||(f=new ResizeObserver(()=>void m()),f.observe(e),m())}),s(u,e=>{!e&&h.value&&C()}),s(()=>r.options,async()=>{d=0,await n(),await m()},{flush:`post`}),ne(()=>{f?.disconnect(),h.value&&C()}),(t,n)=>(c(),W(`span`,{ref_key:`root`,ref:l,class:`filter-control`},[u.value?(c(),W(M,{key:0},[v(tE,{ref_key:`triggerRef`,ref:g,class:`fc-trigger`,"aria-haspopup":`menu`,"aria-expanded":h.value,onClick:S,onKeydown:[ie(H(D,[`prevent`]),[`down`]),ie(H(D,[`prevent`]),[`up`])],onFocusout:O},{default:B(()=>[a.value?.icon?(c(),P(X,{key:0,name:a.value.icon,size:`sm`},null,8,[`name`])):E(``,!0),F(`span`,null,U(a.value?.label),1),v(X,{class:`fc-chevron`,name:`chevron-down`,size:`sm`})]),_:1},8,[`aria-expanded`,`onKeydown`]),(c(),P(ee,{to:`body`},[h.value?(c(),W(`div`,{key:0,ref_key:`menuBoxRef`,ref:y,class:`fc-menu`,style:ae(b.value),onKeydown:j,onFocusout:O},[v(dp,null,{default:B(()=>[(c(!0),W(M,null,_(e.options,t=>(c(),P(mp,{key:t.value,role:`menuitemradio`,active:t.value===e.modelValue,"aria-checked":t.value===e.modelValue,size:z(o),onClick:e=>N(t.value)},{default:B(()=>[t.icon?(c(),P(X,{key:0,name:t.icon,size:`sm`,"data-icon":t.icon},null,8,[`name`,`data-icon`])):E(``,!0),F(`span`,LCe,U(t.label),1),t.value===e.modelValue?(c(),P(X,{key:1,class:`fc-check`,name:`check`,size:`sm`})):E(``,!0)]),_:2},1032,[`active`,`aria-checked`,`size`,`onClick`]))),128))]),_:1})],36)):E(``,!0)]))],64)):(c(),P(s6,{key:1,"model-value":e.modelValue,options:e.options,size:`md`,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},null,8,[`model-value`,`options`]))],512))}}),[[`__scopeId`,`data-v-658870b5`]]),RCe={class:`wp-head-tab`},zCe={key:0,class:`wp-head-meta`},BCe={key:0,class:`wp-head-actions`},V7=Y(G({__name:`WorkPanelHead`,props:{icon:{},title:{},meta:{}},setup(e){return(t,n)=>(c(),W(M,null,[F(`span`,RCe,[v(X,{name:e.icon,size:`md`},null,8,[`name`]),F(`span`,null,U(e.title),1),e.meta?(c(),W(`span`,zCe,U(e.meta),1)):E(``,!0)]),t.$slots.actions?(c(),W(`span`,BCe,[me(t.$slots,`actions`,{},void 0,!0)])):E(``,!0)],64))}}),[[`__scopeId`,`data-v-408c4b07`]]),H7=G({__name:`WorkPill`,props:{icon:{},active:{type:Boolean},label:{}},emits:[`click`],setup(e){return(t,n)=>(c(),P(tE,{active:e.active,"aria-pressed":e.active,"aria-label":e.label,onClick:n[0]||=e=>t.$emit(`click`,e)},{default:B(()=>[v(X,{name:e.icon,size:`md`},null,8,[`name`]),F(`span`,null,[me(t.$slots,`default`)]),me(t.$slots,`meta`)]),_:3},8,[`active`,`aria-pressed`,`aria-label`]))}}),VCe={class:`dock-work-head`},HCe={key:0,class:`dock-workbar`},UCe={class:`dw-running`},WCe={class:`dw-running`},GCe={class:`dw-count`},KCe=Y(G({__name:`ChatDock`,props:{sessionId:{},running:{type:Boolean},working:{type:Boolean},starting:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},status:{},thinking:{},planMode:{type:Boolean},planArmed:{type:Boolean},goalMode:{type:Boolean},towerMode:{type:Boolean},towerAvailable:{type:Boolean},dynamicWorkflowMode:{type:Boolean},activationBadges:{},models:{},starredIds:{},skills:{},goal:{},sessionPlans:{},dockPanel:{},overlayOpen:{type:Boolean},bashTasks:{},subagentTasks:{},bashRunning:{},subagentRunning:{},todoDoneCount:{},hasDockWork:{type:Boolean},todos:{},pendingQuestion:{},questionBusyKind:{},pendingApproval:{},approvalBusy:{type:Boolean},mobile:{type:Boolean},openFile:{type:Function},revealSavedPlan:{type:Function}},emits:[`submit`,`steer`,`command`,`interrupt`,`setPermission`,`setThinking`,`togglePlan`,`toggleWorkflow`,`toggleGoal`,`toggleTower`,`openBtw`,`createGoal`,`controlGoal`,`focusGoal`,`compact`,`pickModel`,`selectModel`,`answer`,`dismiss`,`approval`,`cancelTask`,`toggle-dock-panel`,`close-dock-panel`,`openAgent`],setup(e,{expose:t,emit:r}){let i=e,a=r,{t:o}=J(),{confirm:l,current:u}=K4(),d=R(null),f=R(null),m=R(null),g=R(null),_=R(!1),y=R(!1),b=R(`50% 100%`),x=R(`active`),S=R(`active`),C=L(()=>Object.values(i.sessionPlans??{}).at(-1)),w=L(()=>d.value?.anyPopupOpen??!1),T=L(()=>[{value:`active`,label:o(`tasks.filterRecent`),icon:`clock`},{value:`running`,label:o(`tasks.filterRunning`),icon:`play`},{value:`done`,label:o(`tasks.filterDone`),icon:`circle-check`},{value:`all`,label:o(`tasks.filterAll`),icon:`list`}]),D=L(()=>(i.todos?.length??0)>0&&i.todoDoneCount===(i.todos?.length??0)),O=L(()=>i.goal?o(`status.goalStatus${i.goal.status[0].toUpperCase()}${i.goal.status.slice(1)}`):``),k=L(()=>{let e=Math.max(0,Math.round((i.goal?.wallClockMs??0)/1e3)),t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t?`${t}${o(`status.timeUnitHour`)} ${n}${o(`status.timeUnitMinute`)}`:n?`${n}${o(`status.timeUnitMinute`)} ${e%60}${o(`status.timeUnitSecond`)}`:`${e}${o(`status.timeUnitSecond`)}`}),A=L(()=>i.bashTasks.some(e=>e.kind===`tool`)?o(`tasks.dockTasks`):o(`tasks.dockBash`));function j(e,t){if(t===`all`)return e;if(t===`running`)return e.filter(e=>e.state===`run`);if(t===`done`)return e.filter(e=>e.state!==`run`);let n=e.filter(e=>e.state===`run`),r=e.filter(e=>e.state!==`run`).toSorted((e,t)=>Date.parse(t.completedAt??t.createdAt??``)-Date.parse(e.completedAt??e.createdAt??``)).slice(0,5);return[...n,...r]}let M=L(()=>j(i.bashTasks,x.value)),N=L(()=>j(i.subagentTasks,S.value));function ee(e,t){let n=t.currentTarget,r=f.value;if(n&&r){let e=n.getBoundingClientRect(),t=r.getBoundingClientRect();b.value=`${e.left+e.width/2-t.left}px 100%`}a(`toggle-dock-panel`,e)}function I(){y.value=(g.value?.scrollTop??0)>0}function te(e){if(!i.dockPanel)return;let t=e.target;!t||m.value?.contains(t)||t.closest(`.ui-pill`)||a(`close-dock-panel`)}function ne(e){i.dockPanel&&(e.key!==`Escape`||e.repeat||e.isComposing||e.defaultPrevented||w.value||u.value||i.overlayOpen||(e.preventDefault(),e.stopImmediatePropagation(),a(`close-dock-panel`)))}async function re(){await l({title:o(`status.goalCancel`),message:o(`status.goalCancelConfirm`),confirmLabel:o(`status.goalCancelConfirmYes`),cancelLabel:o(`status.goalCancelConfirmNo`),variant:`danger`})&&a(`controlGoal`,`cancel`)}function ie(){let e=f.value;if(!e)return;document.documentElement.style.setProperty(`--dock-h`,`${e.offsetHeight}px`);let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--p-bp-sm`))||640;_.value=e.offsetWidth{document.addEventListener(`mousedown`,te,!0),document.addEventListener(`keydown`,ne,!0),typeof ResizeObserver==`function`&&f.value&&(se=new ResizeObserver(()=>{ie(),I()}),se.observe(f.value),ie())}),h(()=>{document.removeEventListener(`mousedown`,te,!0),document.removeEventListener(`keydown`,ne,!0),se?.disconnect()}),s(()=>i.dockPanel,()=>{y.value=!1,n(I)});function ce(e){return d.value?.loadForEdit(e)??!1}function le(e){d.value?.loadAttachmentsForEdit(e)}function ue(){d.value?.focus()}function de(e){d.value?.insertQuote(e)}return t({loadForEdit:ce,loadAttachmentsForEdit:le,insertQuote:de,focus:ue,anyPopupOpen:w,isEmpty:L(()=>d.value?.isEmpty??!0)}),(t,n)=>(c(),W(`div`,{ref_key:`dockRef`,ref:f,class:V([`chat-dock`,[e.mobile?`align-mobile`:`align-center`,{"has-popup":w.value||e.dockPanel,"has-approval":!!e.pendingApproval&&!e.pendingQuestion,"pills-compact":_.value}]]),onClick:n[37]||=H(()=>{},[`stop`])},[v(oe,{name:`dock-panel`},{default:B(()=>[e.dockPanel?(c(),W(`div`,{key:e.dockPanel,ref_key:`workPanelRef`,ref:m,class:V([`dock-work-panel`,[`panel-${e.dockPanel}`,{"body-scrolled-up":y.value}]]),style:ae({transformOrigin:b.value})},[F(`div`,VCe,[e.dockPanel===`bash`?(c(),P(V7,{key:0,icon:`terminal`,title:A.value,meta:`${e.bashRunning} ${z(o)(`tasks.running`)}`},{actions:B(()=>[v(B7,{modelValue:x.value,"onUpdate:modelValue":n[0]||=e=>x.value=e,options:T.value},null,8,[`modelValue`,`options`])]),_:1},8,[`title`,`meta`])):e.dockPanel===`subagent`?(c(),P(V7,{key:1,icon:`sparkles`,title:z(o)(`tasks.dockSubagent`),meta:`${e.subagentRunning} ${z(o)(`tasks.running`)}`},{actions:B(()=>[v(B7,{modelValue:S.value,"onUpdate:modelValue":n[1]||=e=>S.value=e,options:T.value},null,8,[`modelValue`,`options`])]),_:1},8,[`title`,`meta`])):e.dockPanel===`todos`?(c(),P(V7,{key:2,icon:D.value?`check-list`:`list`,title:z(o)(`tasks.todoProgressTitle`),meta:`${e.todoDoneCount}/${e.todos?.length??0}`},null,8,[`icon`,`title`,`meta`])):e.dockPanel===`goal`?(c(),P(V7,{key:3,icon:`target`,title:z(o)(`status.goalLabel`),meta:k.value},{actions:B(()=>[e.goal?.status===`active`?(c(),P(Ca,{key:0,size:`sm`,label:z(o)(`status.goalPause`),onClick:n[2]||=e=>a(`controlGoal`,`pause`)},{default:B(()=>[v(X,{name:`pause`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),e.goal?.status===`paused`||e.goal?.status===`blocked`?(c(),P(Ca,{key:1,size:`sm`,label:z(o)(`status.goalResume`),onClick:n[3]||=e=>a(`controlGoal`,`resume`)},{default:B(()=>[v(X,{name:`play`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),v(Ca,{size:`sm`,label:z(o)(`status.goalCancel`),onClick:re},{default:B(()=>[v(X,{name:`power`,size:`sm`})]),_:1},8,[`label`]),v(Ca,{size:`sm`,label:z(o)(`tasks.closePanel`),onClick:n[4]||=e=>a(`close-dock-panel`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])]),_:1},8,[`title`,`meta`])):(c(),P(V7,{key:4,icon:`file-edit`,title:z(o)(`status.planLabel`),meta:C.value?.reviewState?z(o)(`tools.plan.review.${C.value.reviewState}`):``},{actions:B(()=>[C.value?.path?(c(),P(Ca,{key:0,size:`sm`,label:z(o)(`tools.plan.revealInFileManager`),onClick:n[5]||=t=>void e.revealSavedPlan?.(C.value.agentId,C.value.toolCallId)},{default:B(()=>[v(X,{name:`external-link`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),e.planArmed||e.planMode?(c(),P(Ca,{key:1,size:`sm`,label:z(o)(`status.workModeDismiss`),onClick:n[6]||=e=>a(`togglePlan`)},{default:B(()=>[v(X,{name:`power`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),v(Ca,{size:`sm`,label:z(o)(`tasks.closePanel`),onClick:n[7]||=e=>a(`close-dock-panel`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])]),_:1},8,[`title`,`meta`]))]),F(`div`,{ref_key:`workBodyRef`,ref:g,class:`dock-work-body`,onScroll:I},[e.dockPanel===`bash`?(c(),P(MCe,{key:0,tasks:M.value,filter:x.value,onCancel:n[8]||=e=>a(`cancelTask`,e),onOpen:n[9]||=e=>a(`openAgent`,e)},null,8,[`tasks`,`filter`])):e.dockPanel===`subagent`?(c(),P(bCe,{key:1,tasks:N.value,filter:S.value,onCancel:n[10]||=e=>a(`cancelTask`,e),onOpen:n[11]||=e=>a(`openAgent`,e)},null,8,[`tasks`,`filter`])):e.dockPanel===`todos`?(c(),P(ICe,{key:2,todos:e.todos??[]},null,8,[`todos`])):e.dockPanel===`goal`&&e.goal?(c(),P(CSe,{key:3,goal:e.goal,"open-file":e.openFile},null,8,[`goal`,`open-file`])):(c(),P(NSe,{key:4,plan:C.value,"plan-mode-on":e.planMode,"open-file":e.openFile,"reveal-saved-plan":e.revealSavedPlan},null,8,[`plan`,`plan-mode-on`,`open-file`,`reveal-saved-plan`]))],544)],6)):E(``,!0)]),_:1}),e.hasDockWork||e.planMode||C.value?(c(),W(`div`,HCe,[e.goal?(c(),P(H7,{key:0,icon:`target`,active:e.dockPanel===`goal`,label:`${z(o)(`status.goalLabel`)} ${O.value}`,onClick:n[12]||=e=>ee(`goal`,e)},{meta:B(()=>[F(`span`,{class:V([`dw-goal-status`,`dw-goal-status--${e.goal.status}`])},U(O.value),3)]),default:B(()=>[K(U(z(o)(`status.goalLabel`))+` `,1)]),_:1},8,[`active`,`label`])):E(``,!0),e.planMode||C.value?(c(),P(H7,{key:1,icon:`file-edit`,active:e.dockPanel===`plan`,label:z(o)(`status.planLabel`),onClick:n[13]||=e=>ee(`plan`,e)},{default:B(()=>[K(U(z(o)(`status.planLabel`)),1)]),_:1},8,[`active`,`label`])):E(``,!0),e.bashTasks.length?(c(),P(H7,{key:2,icon:`terminal`,active:e.dockPanel===`bash`,label:A.value,onClick:n[14]||=e=>ee(`bash`,e)},pe({default:B(()=>[K(U(A.value)+` `,1)]),_:2},[e.bashRunning?{name:`meta`,fn:B(()=>[F(`span`,UCe,[v(z7,{status:`run`}),K(U(e.bashRunning),1)])]),key:`0`}:void 0]),1032,[`active`,`label`])):E(``,!0),e.subagentTasks.length?(c(),P(H7,{key:3,icon:`sparkles`,active:e.dockPanel===`subagent`,label:z(o)(`tasks.dockSubagent`),onClick:n[15]||=e=>ee(`subagent`,e)},pe({default:B(()=>[K(U(z(o)(`tasks.dockSubagent`))+` `,1)]),_:2},[e.subagentRunning?{name:`meta`,fn:B(()=>[F(`span`,WCe,[v(z7,{status:`run`}),K(U(e.subagentRunning),1)])]),key:`0`}:void 0]),1032,[`active`,`label`])):E(``,!0),e.todos?.length?(c(),P(H7,{key:4,icon:D.value?`check-list`:`list`,active:e.dockPanel===`todos`,label:z(o)(`tasks.todoProgressTitle`),onClick:n[16]||=e=>ee(`todos`,e)},{meta:B(()=>[F(`span`,GCe,U(e.todoDoneCount)+`/`+U(e.todos?.length),1)]),default:B(()=>[K(U(z(o)(`tasks.todoProgressTitle`))+` `,1)]),_:1},8,[`icon`,`active`,`label`])):E(``,!0)])):E(``,!0),e.pendingQuestion?(c(),P(sCe,{key:e.pendingQuestion.questionId,question:e.pendingQuestion,"busy-kind":e.questionBusyKind,onAnswer:n[17]||=(e,t)=>a(`answer`,e,t),onDismiss:n[18]||=e=>a(`dismiss`,e)},null,8,[`question`,`busy-kind`])):e.pendingApproval?(c(),P(ySe,{key:e.pendingApproval.approvalId,class:`dock-approval`,block:e.pendingApproval.block,"agent-name":e.pendingApproval.agentName,busy:e.approvalBusy,onDecide:n[19]||=t=>a(`approval`,e.pendingApproval.approvalId,t)},null,8,[`block`,`agent-name`,`busy`])):(c(),P(R7,{key:3,ref_key:`composerRef`,ref:d,"session-id":e.sessionId,running:e.running,working:e.working,starting:e.starting,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"plan-armed":e.planArmed,"goal-mode":e.goalMode,"tower-mode":e.towerMode,"tower-available":e.towerAvailable,"workflow-active":e.dynamicWorkflowMode,goal:e.goal,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,onSubmit:n[20]||=e=>a(`submit`,e),onSteer:n[21]||=e=>a(`steer`,e),onCommand:n[22]||=e=>a(`command`,e),onInterrupt:n[23]||=e=>a(`interrupt`),onSetPermission:n[24]||=e=>a(`setPermission`,e),onSetThinking:n[25]||=e=>a(`setThinking`,e),onTogglePlan:n[26]||=e=>a(`togglePlan`),onToggleWorkflow:n[27]||=e=>a(`toggleWorkflow`),onToggleGoal:n[28]||=e=>a(`toggleGoal`),onToggleTower:n[29]||=e=>a(`toggleTower`),onOpenBtw:n[30]||=e=>a(`openBtw`),onCreateGoal:n[31]||=e=>a(`createGoal`,e),onControlGoal:n[32]||=e=>a(`controlGoal`,e),onFocusGoal:n[33]||=e=>a(`focusGoal`),onCompact:n[34]||=e=>a(`compact`),onPickModel:n[35]||=e=>a(`pickModel`),onSelectModel:n[36]||=e=>a(`selectModel`,e)},null,8,[`session-id`,`running`,`working`,`starting`,`queued`,`search-files`,`upload-image`,`status`,`thinking`,`plan-mode`,`plan-armed`,`goal-mode`,`tower-mode`,`tower-available`,`workflow-active`,`goal`,`activation-badges`,`models`,`starred-ids`,`skills`]))],2))}}),[[`__scopeId`,`data-v-f219171e`]]),qCe=[`aria-label`,`aria-hidden`],JCe=[`data-turn-id`,`tabindex`,`aria-current`,`aria-label`,`onMouseenter`,`onFocus`,`onKeydown`,`onClick`],YCe=[`aria-label`],XCe={class:`toc-preview__prompt`},ZCe={key:0,class:`toc-preview__response`},QCe=80,$Ce=Y(G({__name:`ConversationToc`,props:{items:{},activeTurnId:{},mobile:{type:Boolean},sessionLoading:{type:Boolean},occluded:{type:Boolean}},emits:[`select`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null),l=R(null),u=R(null),d=R(!0),f=null;function p(){let e=o.value,t=e?.offsetParent;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();d.value=n.left>=r.left&&n.right<=r.right}let m=L(()=>!r.mobile&&!r.sessionLoading&&r.items.length>1),h=L(()=>l.value!==null&&r.items.some(e=>e.id===l.value)?l.value:r.activeTurnId!==null&&r.items.some(e=>e.id===r.activeTurnId)?r.activeTurnId:r.items[0]?.id??null),g=L(()=>u.value??l.value??r.activeTurnId),v=L(()=>{let e=u.value??l.value;return e===null?void 0:r.items.find(t=>t.id===e)}),y=R(0),b=null;function x(){b!==null&&clearTimeout(b),b=null}function S(){x(),b=setTimeout(()=>{u.value=null,b=null},QCe)}function C(){return o.value===null?[]:Array.from(o.value.querySelectorAll(`.toc-row`))}function w(e,t){let n=e;if(t.key===`ArrowDown`)n=Math.min(r.items.length-1,e+1);else if(t.key===`ArrowUp`)n=Math.max(0,e-1);else if(t.key===`Home`)n=0;else if(t.key===`End`)n=r.items.length-1;else return;t.preventDefault(),C()[n]?.focus()}function T(e){let t=e??C().find(e=>e.dataset.turnId===v.value?.id),n=t?.parentElement;!t||!n||(y.value=t.offsetTop-n.scrollTop+t.offsetHeight/2)}function D(e,t){x(),u.value=e,T(t.currentTarget)}function O(e,t){x(),l.value=e,T(t.currentTarget)}function k(e){x();let t=document.activeElement;t instanceof HTMLElement&&o.value?.contains(t)&&t.blur(),u.value=null,l.value=null,i(`select`,e)}function A(e){let t=e.relatedTarget;(!(t instanceof Node)||!o.value?.contains(t))&&(l.value=null)}return s(m,e=>{f?.disconnect(),f=null,e&&n(()=>{let e=o.value,t=e?.offsetParent;!e||!t||(typeof ResizeObserver<`u`&&(f=new ResizeObserver(p),f.observe(t)),p())})},{immediate:!0}),s([()=>r.activeTurnId,m],([e,t])=>{!t||e===null||n(()=>{let t=C().find(t=>t.dataset.turnId===e);typeof t?.scrollIntoView==`function`&&t.scrollIntoView({block:`nearest`})})},{immediate:!0}),ne(()=>{x(),f?.disconnect(),f=null}),(t,n)=>m.value?(c(),W(`nav`,{key:0,ref_key:`navRef`,ref:o,class:V([`conversation-toc`,{"toc-clipped":!d.value||e.occluded}]),"aria-label":z(a)(`conversation.toc`),"aria-hidden":d.value&&!e.occluded?void 0:!0,onMouseenter:x,onMouseleave:S,onFocusout:A},[F(`div`,{class:`toc-scroll`,onScroll:n[0]||=e=>T()},[(c(!0),W(M,null,_(e.items,(t,r)=>(c(),W(`button`,{key:t.id,type:`button`,class:V([`toc-row`,{active:e.activeTurnId===t.id,highlighted:g.value===t.id,previewing:u.value===t.id||l.value===t.id}]),"data-turn-id":t.id,tabindex:h.value===t.id?0:-1,"aria-current":e.activeTurnId===t.id?`location`:void 0,"aria-label":t.title,onMouseenter:e=>D(t.id,e),onFocus:e=>O(t.id,e),onKeydown:e=>w(r,e),onClick:e=>k(t.id)},[...n[2]||=[F(`span`,{class:`toc-marker`,"aria-hidden":`true`},null,-1)]],42,JCe))),128))],32),v.value?(c(),W(`button`,{key:0,type:`button`,class:`toc-preview`,style:ae({top:`${y.value}px`}),"aria-label":v.value.title,tabindex:`-1`,onMouseenter:x,onClick:n[1]||=e=>k(v.value.id)},[F(`span`,XCe,U(v.value.title),1),v.value.preview?(c(),W(`span`,ZCe,U(v.value.preview),1)):E(``,!0)],44,YCe)):E(``,!0)],42,qCe)):E(``,!0)}}),[[`__scopeId`,`data-v-8a1c40d2`]]),U7=`script, style, noscript, template, [inert], .top-sentinel`,W7=`pythinker-transcript-search`,G7=`pythinker-transcript-search-current`,ewe=1e3;function twe(e){return e===`pre`||e===`pre-wrap`||e===`break-spaces`?`preserve`:e===`pre-line`?`pre-line`:`collapse`}function nwe(e,t){if(t===`preserve`)return{text:e,map:Array.from({length:e.length},(e,t)=>t)};let n=t===`collapse`?/[\t\n\f\r ]/:/[\t ]/,r=``,i=[],a=!1;for(let t=0;tK7(e.text)),r=[],i=``;for(let t=0;t0&&e[t].gapBefore&&(i+=`\0`),r[t]=i.length,i+=n[t].folded;let a=iwe(K7(t).folded);if(a===null)return;let o=new RegExp(a,`g`);function s(e){let t=0,n=r.length-1,i=0;for(;t<=n;){let a=t+n>>1;r[a]<=e?(i=a,t=a+1):n=a-1}return i}let c;for(;;){let e=o.exec(i);if(e===null)return;let t=e.index,a=t+e[0].length-1,l=s(t),u=s(a),d=n[l].map[t-r[l]],f=n[u].map[a-r[u]],p={startSegment:l,startOffset:d.start,endSegment:u,endOffset:f.start+f.length};(c?.startSegment!==p.startSegment||c.startOffset!==p.startOffset||c.endSegment!==p.endSegment||c.endOffset!==p.endOffset)&&(c=p,yield p)}}var owe=new Set(`ADDRESS.ARTICLE.ASIDE.BLOCKQUOTE.BR.DD.DIV.DL.DT.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.H1.H2.H3.H4.H5.H6.HEADER.HR.LI.MAIN.NAV.OL.P.PRE.SECTION.TABLE.TBODY.TD.TFOOT.TH.THEAD.TR.UL`.split(`.`)),swe=new Set([`inline`,`inline-block`,`inline-flex`,`inline-grid`,`inline-table`,`contents`,`ruby`]);function cwe(e,t){let n=t.get(e);if(n!==void 0)return n;let r=owe.has(e.tagName)||!swe.has(getComputedStyle(e).display);return t.set(e,r),r}function lwe(e,t,n){let r=e.parentElement;for(;r!==null&&r!==t&&!cwe(r,n);)r=r.parentElement;return r??t}function uwe(e){let t=e.ownerDocument,n=t.defaultView?.NodeFilter??NodeFilter,r=t.createTreeWalker(e,n.SHOW_ELEMENT|n.SHOW_TEXT,{acceptNode(e){if(e.nodeType!==Node.ELEMENT_NODE)return n.FILTER_ACCEPT;let t=e;return t.matches(U7)?n.FILTER_REJECT:t.matches(`br, hr, wbr`)&&!t.closest(U7)?n.FILTER_ACCEPT:n.FILTER_SKIP}}),i=new WeakMap,a=new WeakMap,o=[],s=!1;for(let t=r.nextNode();t!==null;t=r.nextNode()){if(t.nodeType===Node.ELEMENT_NODE){s=!0;continue}let n=t.nodeValue??``;if(n.length===0)continue;let r=t.parentElement;if(r===null)continue;let c=a.get(r);c===void 0&&(c=twe(getComputedStyle(r).whiteSpace),a.set(r,c));let{text:l,map:u}=nwe(n,c);if(l.length===0)continue;let d=lwe(t,e,i),f=o.at(-1),p=s||f===void 0||f.block!==d;!p&&f.text.endsWith(` `)&&l.startsWith(` `)&&(l=l.slice(1),u=u.slice(1),l.length===0)||(o.push({text:l,gapBefore:p,node:t,block:d,whitespaceMap:u}),s=!1)}return o}function dwe(e,t){if(t.length===0)return[];let n=uwe(e),r=[];for(let i of awe(n,t)){let t=n[i.startSegment],a=n[i.endSegment],o=e.ownerDocument.createRange();o.setStart(t.node,t.whitespaceMap[i.startOffset]),o.setEnd(a.node,a.whitespaceMap[i.endOffset-1]+1),r.push(o)}return r}function fwe(e,t,n=e=>e.getClientRects().length!==0){let r=[];for(let i of dwe(e,t))if(n(i)){if(r.length>=ewe)return{ranges:r,truncated:!0};r.push(i)}return{ranges:r,truncated:!1}}function q7(){return globalThis.CSS?.highlights??null}function J7(e,t){let n=q7(),r=globalThis.Highlight;if(!n||!r)return;if(e.length===0){Y7();return}let i=new r;for(let t of e)i.add(t);n.set(W7,i);let a=e[t];if(a){let e=new r;e.add(a),n.set(G7,e)}else n.delete(G7)}function Y7(){let e=q7();e?.delete(W7),e?.delete(G7)}var pwe={class:`tsearch-main`},mwe=[`placeholder`],hwe=[`inert`],gwe={class:`tsearch-foot`},_we={class:`tsearch-count`,"aria-live":`polite`},vwe={class:`tsearch-rings`},ywe=Y(G({__name:`TranscriptSearch`,props:{pane:{},mobile:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=S(`input`),s=ue(``),u=ue(!1),d=ue([]),f=ue(0),m=ue(!1),g=ue(!1),y=ue([]),b=L(()=>d.value.length),x=L(()=>s.value.trim()!==``),C=L(()=>{if(u.value)return a(`conversation.search.searching`);if(!x.value)return``;if(b.value===0)return a(`conversation.search.noResults`);let e={current:f.value+1,total:b.value};return m.value?a(`conversation.search.resultsCapped`,e):a(`conversation.search.results`,e)}),w=null,T=null,D=null,O=null,k=null;function A(){return r.pane.querySelector(`.chat`)}function j(){let e=d.value[f.value];if(!e){y.value=[];return}let t=r.pane.getBoundingClientRect();y.value=Array.from(e.getClientRects(),e=>({top:`${e.top-t.top+r.pane.scrollTop}px`,left:`${e.left-t.left}px`,width:`${e.width}px`,height:`${e.height}px`}))}function N(){y.value.length!==0&&(D!==null&&clearTimeout(D),D=setTimeout(()=>{D=null,j()},120))}function I(e){let t=r.pane.getBoundingClientRect().top,n=e.findIndex(e=>{let n=e.getClientRects(),r=n[n.length-1];return r!==void 0&&r.bottom>=t});return n===-1?0:n}function te(){let e=d.value[f.value];J7(d.value,f.value),(e?.startContainer instanceof Element?e.startContainer:e?.startContainer.parentElement)?.scrollIntoView({block:`center`}),j()}function ne(e=`first`){w!==null&&(clearTimeout(w),w=null),u.value=!1;let t=A(),n=s.value.trim();if(!t||n===``){d.value=[],m.value=!1,f.value=0,Y7(),j();return}let r=d.value[f.value],i=r?.startContainer,a=r?.startOffset,o=fwe(t,n);if(d.value=o.ranges,m.value=o.truncated,o.ranges.length===0){f.value=0,Y7(),j();return}if(e!==!1){let t=I(o.ranges);f.value=e===`backward`?(t-1+o.ranges.length)%o.ranges.length:t,te();return}let c=o.ranges.findIndex(e=>e.startContainer===i&&e.startOffset===a);f.value=c>=0?c:I(o.ranges),J7(o.ranges,f.value),j()}function re(){if(w!==null&&clearTimeout(w),s.value.trim()===``){u.value=!1,ne();return}u.value=!0,w=setTimeout(()=>ne(),150)}function ie(e){b.value!==0&&(f.value=(f.value+e+b.value)%b.value,te())}function oe(e){if(!(e.key!==`Enter`||g.value||e.isComposing)){if(e.preventDefault(),w!==null){ne(e.shiftKey?`backward`:`first`);return}ie(e.shiftKey?-1:1)}}function R(e){e.key!==`Escape`||g.value||e.isComposing||(e.preventDefault(),e.stopPropagation(),i(`close`))}function se(e){return e instanceof Element&&(e.classList.contains(`tsearch-rings`)||e.closest(`.tsearch-rings`)!==null)}function ce(e){if(e.type===`attributes`&&e.target===r.pane||se(e.target))return!0;if(e.type!==`childList`)return!1;let t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(se)}function le(e){s.value.trim()===``||e.every(ce)||w!==null||(T!==null&&clearTimeout(T),T=setTimeout(()=>{T=null,w===null&&ne(!1)},150))}return p(()=>{if(n(()=>o.value?.focus()),typeof MutationObserver==`function`&&(O=new MutationObserver(le),O.observe(r.pane,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`inert`,`style`,`class`]})),r.pane.addEventListener(`scroll`,N,{passive:!0}),window.addEventListener(`resize`,N,{passive:!0}),typeof ResizeObserver==`function`){k=new ResizeObserver(j),k.observe(r.pane);let e=r.pane.querySelector(`.content-wrap`);e&&k.observe(e)}}),h(()=>{w!==null&&clearTimeout(w),T!==null&&clearTimeout(T),D!==null&&clearTimeout(D),O?.disconnect(),k?.disconnect(),r.pane.removeEventListener(`scroll`,N),window.removeEventListener(`resize`,N),Y7()}),(t,n)=>(c(),W(`div`,{class:V([`tsearch`,{mobile:e.mobile}]),role:`search`,onKeydown:R},[F(`div`,pwe,[v(X,{class:`tsearch-icon`,name:`search`,size:`sm`,"aria-hidden":`true`}),l(F(`input`,{ref:`input`,"onUpdate:modelValue":n[0]||=e=>s.value=e,type:`text`,class:`tsearch-input`,placeholder:z(a)(`conversation.search.placeholder`),autocapitalize:`off`,autocomplete:`off`,spellcheck:`false`,onInput:re,onKeydown:oe,onCompositionstart:n[1]||=e=>g.value=!0,onCompositionend:n[2]||=e=>g.value=!1},null,40,mwe),[[de,s.value]]),u.value?(c(),P(np,{key:0,class:`tsearch-spin`,size:`sm`,label:z(a)(`conversation.search.searching`)},null,8,[`label`])):E(``,!0),n[6]||=F(`span`,{class:`tsearch-sep`,"aria-hidden":`true`},null,-1),v(Ca,{class:`tsearch-close`,size:`sm`,label:z(a)(`conversation.search.close`),onClick:n[3]||=e=>i(`close`)},{default:B(()=>[v(X,{name:`close`})]),_:1},8,[`label`])]),F(`div`,{class:V([`tsearch-foot-wrap`,{open:x.value}]),inert:!x.value},[F(`div`,gwe,[v(Ca,{size:`sm`,label:z(a)(`conversation.search.previous`),disabled:b.value===0,onClick:n[4]||=e=>ie(-1)},{default:B(()=>[v(X,{name:`arrow-up`})]),_:1},8,[`label`,`disabled`]),v(Ca,{size:`sm`,label:z(a)(`conversation.search.next`),disabled:b.value===0,onClick:n[5]||=e=>ie(1)},{default:B(()=>[v(X,{name:`arrow-down`})]),_:1},8,[`label`,`disabled`]),F(`span`,_we,U(C.value),1)])],10,hwe),(c(),P(ee,{to:e.pane},[F(`div`,vwe,[(c(!0),W(M,null,_(y.value,(e,t)=>(c(),W(`div`,{key:t,class:`tsearch-ring`,style:ae(e)},null,4))),128))])],8,[`to`]))],34))}}),[[`__scopeId`,`data-v-d7187e08`]]),bwe={class:`ui-action-toast-host`},xwe={class:`ui-action-toast__body`},X7=Y(G({__name:`ActionToast`,props:{duration:{default:8e3},dismissLabel:{},dismissToken:{}},emits:[`dismiss`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=null,a=0,o=e.duration;function s(t){if(t<=0){n(`dismiss`,e.dismissToken);return}i=setTimeout(()=>n(`dismiss`,e.dismissToken),t),a=Date.now()+t}function l(){i!==null&&(clearTimeout(i),i=null,o=Math.max(0,a-Date.now()))}function u(){i===null&&s(o)}return s(e.duration),h(()=>{i!==null&&clearTimeout(i)}),(t,i)=>(c(),W(`div`,bwe,[F(`div`,{class:`ui-action-toast`,role:`status`,onPointerenter:l,onPointerleave:u},[F(`span`,xwe,[me(t.$slots,`default`,{},void 0,!0)]),v(Ca,{class:`ui-action-toast__close`,size:`sm`,label:e.dismissLabel??z(r)(`common.dismiss`),tooltip:e.dismissLabel??z(r)(`common.dismiss`),onClick:i[0]||=t=>n(`dismiss`,e.dismissToken)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`tooltip`])],32)]))}}),[[`__scopeId`,`data-v-c5370888`]]),Swe={key:0,class:`ws-guide-arrow__label`},Cwe=Y(G({__name:`WorkspaceGuideArrow`,props:{label:{default:``},direction:{default:`left`}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ws-guide-arrow`,`dir-${e.direction}`]),"aria-hidden":`true`},[n[0]||=F(`svg`,{class:`ws-guide-arrow__svg`,viewBox:`0 0 40 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[F(`path`,{d:`M 37 8 C 25 4, 13 8, 4 8`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),F(`path`,{d:`M 8 5 L 3 8 L 8 11`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1),e.label?(c(),W(`span`,Swe,U(e.label),1)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-3c957040`]]);function wwe(e,t=2e4){let n=R(`${e}?r=0`),r=0,i=setInterval(()=>{r+=1,n.value=`${e}?r=${r}`},t);return h(()=>clearInterval(i)),n}var Twe=[`src`,`alt`,`role`],Z7=Y(G({__name:`PythinkerLogo`,props:{size:{default:`sm`},animated:{type:Boolean,default:!0},label:{default:`Pythinker Code`},interactive:{type:Boolean,default:!1}},emits:[`click`],setup(e,{emit:t}){let n=wwe(`/brand/mascot-waving.png`),r=e,i=t;function a(){r.interactive&&i(`click`)}return(t,r)=>(c(),W(`img`,{src:e.animated?z(n):`/brand/icon.svg`,class:V([`pythinker-logo`,[`size-${e.size}`,{interactive:e.interactive}]]),alt:e.label,role:e.interactive?`button`:`img`,onClick:a},null,10,Twe))}}),[[`__scopeId`,`data-v-58c4fde0`]]);function Ewe(e,t,n,r=5){if(n||e.length<=r)return e;let i=e.slice(0,r);if(t&&!i.some(e=>e.id===t)){let n=e.find(e=>e.id===t);n&&(i[r-1]=n)}return i}var Dwe={key:0,class:`recent`},Owe={class:`recent-caption`},kwe=[`onClick`],Awe={class:`recent-title`},jwe={class:`recent-time`},Mwe={class:`recent-foot`},Nwe=Y(G({__name:`WorkspaceRecentSessions`,props:{sessions:{}},emits:[`select`,`openSessionAdmin`],setup(e,{emit:t}){let n=t,{t:r}=J();return(t,i)=>e.sessions.length?(c(),W(`section`,Dwe,[F(`h2`,Owe,U(z(r)(`sessions.recentSessions`)),1),(c(!0),W(M,null,_(e.sessions,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`recent-row`,onClick:t=>n(`select`,e.id)},[F(`span`,{class:V([`recent-ico`,e.archived?`recent-ico--done`:`recent-ico--open`])},[v(X,{name:e.archived?`circle-check`:`circle-dashed`,size:`sm`},null,8,[`name`])],2),F(`span`,Awe,U(e.title),1),F(`span`,jwe,U(e.time),1)],8,kwe))),128)),F(`div`,Mwe,[v(vp,{text:z(r)(`conversation.sessionAdminTooltip`)},{default:B(()=>[F(`button`,{type:`button`,class:`recent-more`,onClick:i[0]||=e=>n(`openSessionAdmin`)},[K(U(z(r)(`conversation.viewMoreSessions`))+` `,1),v(X,{name:`chevron-down`,size:`sm`})])]),_:1},8,[`text`])])])):E(``,!0)}}),[[`__scopeId`,`data-v-cd5a729d`]]),Pwe={class:`chat-layout`},Fwe={class:`empty-hint`},Iwe={key:0,class:`empty-hint-text`},Lwe={key:1,class:`ws-pick`},Rwe={class:`ws-pick-name`},zwe={key:2,class:`ws-pick-menu`},Bwe=[`onClick`],Vwe={class:`ws-pick-item-name`},Hwe={class:`ws-pick-item-path`},Uwe=[`aria-label`],Wwe=48,Q7=80,$7=1e3,Gwe=420,Kwe=3e3,qwe=Y(G({__name:`ConversationPane`,props:{turns:{},expertTalkRuns:{},sessionId:{},approvals:{},gitInfo:{},tasks:{},todos:{},goal:{},activationBadges:{},status:{},thinking:{},planMode:{type:Boolean},planArmed:{type:Boolean},sessionPlans:{},overlayOpen:{type:Boolean},goalMode:{type:Boolean},towerMode:{type:Boolean},towerAvailable:{type:Boolean},dynamicWorkflowMode:{type:Boolean},questions:{},pendingQuestionActions:{},pendingApprovalActions:{},running:{type:Boolean},turnActive:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},changes:{},fileReloadKey:{},working:{type:Boolean},starting:{type:Boolean},fastMoon:{type:Boolean},mobile:{type:Boolean},sessionLoading:{type:Boolean},compaction:{},hasMoreMessages:{type:Boolean},loadingMore:{type:Boolean},loadingMoreError:{type:Boolean},loadOlderMessages:{type:Function},models:{},starredIds:{},skills:{},workspaceName:{},workspaceRoot:{},gitDiffStats:{},workspaces:{},activeWorkspaceId:{},sessionTitle:{},pr:{},conversationToc:{type:Boolean},turnFolding:{type:Boolean},activityRunFolding:{type:Boolean},lastTurnReason:{},turnErrorKind:{},turnErrorMessage:{},sessionDone:{type:Boolean},pinned:{type:Boolean},recentSessions:{},revealSavedPlan:{type:Function},panelVisible:{type:Boolean},panelExpanded:{type:Boolean},activePanelType:{},togglePanel:{type:Function}},emits:`submit.steer.approval.cancelTask.answer.dismiss.command.interrupt.unqueue.editQueued.reorderQueue.steerQueued.setPermission.setThinking.togglePlan.toggleWorkflow.toggleGoal.toggleTower.createGoal.controlGoal.compact.pickModel.selectModel.openFile.openMedia.takeExpertTalk.buildExpertTalk.openCompaction.openAgent.detachTask.openToolDiff.openTurnDiff.openChanges.refreshGitStatus.editMessage.selectWorkspace.addWorkspace.openPr.renameSession.forkSession.archiveSession.restoreSession.selectSession.exportSession.togglePin.openSessionAdmin`.split(`.`),setup(e,{expose:t,emit:i}){let{t:a}=J(),o=e,l=i,u=R(!1),f=R(!1),g=L(()=>o.workspaces?.find(e=>e.id===o.activeWorkspaceId)?.name??o.workspaceName??``),y=L(()=>(o.workspaces?.length??0)>0),b=L(()=>Ewe(o.workspaces??[],o.activeWorkspaceId,f.value)),x=L(()=>(o.workspaces?.length??0)-b.value.length);s(u,e=>{e||(f.value=!1)});function S(e){u.value=!1,e!==o.activeWorkspaceId&&l(`selectWorkspace`,e)}Zi(qi.contentAlign);let C=R(null),w=R(null),T=R(null),D=R(!1),O=null;function k(e,t){let n=T.value??w.value;return!n||n.loadForEdit(e)===!1?!1:(n.loadAttachmentsForEdit(t??[]),!0)}function A(){D.value=!0,O!==null&&clearTimeout(O),O=setTimeout(()=>{O=null,D.value=!1},2e3)}function j(){o.goal&&(fe.value=`goal`)}let N=L(()=>o.tasks.filter(e=>e.kind===`bash`||e.kind===`tool`&&!e.id.startsWith(`question-`))),I=L(()=>o.tasks.filter(e=>e.kind===`subagent`&&e.runInBackground)),te=L(()=>N.value.filter(e=>e.state===`run`).length),ne=L(()=>I.value.filter(e=>e.state===`run`).length);function re(e){let t=o.tasks,n=t.find(t=>t.id===e)??t.find(t=>t.parentToolCallId===e);if(n)return n.id;let r=t.filter(e=>e.kind===`subagent`&&!e.parentToolCallId);if(r.length===1)return r[0].id}d(`resolveAgentTaskId`,re);function ie(e){let t=o.tasks.filter(t=>t.id===e||t.parentToolCallId===e);if(t.length!==0)return t.some(e=>e.state===`run`&&e.runInBackground!==!0)}d(`resolveDetachableTask`,ie);let se=m(`modelDisplay`),ce=m(`subagentEffort`);function le(e){let t=re(e);if(t===void 0)return;let n=o.tasks.find(e=>e.id===t||e.agentId===t),r=se?.(n?.model),i=ce?.(n?.thinkingEffort);if(!(r===void 0&&i===void 0))return{display:r,effort:i}}d(`resolveAgentModel`,le),d(`resolvePlan`,e=>o.sessionPlans?.[e]),d(`revealSavedPlan`,(e,t)=>o.revealSavedPlan?.(e,t)??Promise.resolve(!1)),d(`pinScroll`,ft);let ue=L(()=>(o.todos??[]).filter(e=>e.status===`done`).length),de=L(()=>o.goal!==null&&o.goal!==void 0||N.value.length>0||I.value.length>0||(o.todos?.length??0)>0),fe=R(null),G=L(()=>o.gitInfo?o.changes?.length??0:0);function pe(e){fe.value=fe.value===e?null:e}function me(){fe.value=null}s([fe,()=>o.goal,N,I,()=>o.todos,()=>o.planMode,()=>o.sessionPlans],()=>{(fe.value===`goal`&&!o.goal||fe.value===`bash`&&N.value.length===0||fe.value===`subagent`&&I.value.length===0||fe.value===`todos`&&(o.todos?.length??0)===0||fe.value===`plan`&&!o.planMode&&Object.keys(o.sessionPlans??{}).length===0)&&me()});function he(e){if(e.role===`compaction`)return a(`conversation.compactedPlain`);if(e.role===`user`){if(e.skillActivation)return`/${e.skillActivation.name}`;if(e.pluginCommand)return`/${e.pluginCommand.pluginId}:${e.pluginCommand.commandName}`;let t=e.text.trim().replaceAll(/\s+/g,` `);return t.length>0?t:`user`}let t=(e.text||e.thinking||``).trim().replaceAll(/\s+/g,` `);return t.length>0?t:(e.tools?.length??0)>0?`${e.tools.length} tools`:`pythinker`}function ge(e){for(let t=e+1;t0)return n}return``}let _e=L(()=>{let e=0;return o.turns.flatMap((t,n)=>t.role===`user`?(e+=1,[{id:t.id,role:t.role,no:e,title:he(t),preview:ge(n)}]):[])}),ve=R(null);function ye(){let e=Oe.value;if(!e)return;let t=e.querySelectorAll(`.turn-anchor[data-turn-id]`);if(t.length===0)return;let n=_e.value;if(n.length===0)return;let r=new Set(n.map(e=>e.id));if(Re.value&&Be()<=Q7){ve.value=n[n.length-1].id;return}let i=e.getBoundingClientRect(),a=i.height/2,o=null;t.forEach(e=>{let t=e.dataset.turnId;!t||!r.has(t)||e.getBoundingClientRect().top-i.top<=a&&(o=t)}),ve.value=o??n[0].id}let be=R(!1),xe=0;function Se(){xe||=at(()=>{xe=0,Ce()})}function Ce(){let e=Oe.value,t=!o.mobile&&o.conversationToc&&e?e.closest(`.con`)?.querySelector(`.conversation-toc`):null,n=t?.querySelector(`.toc-marker`),r=!1;if(e&&t&&n){let i=n.getBoundingClientRect(),a=t.getBoundingClientRect(),o=i.left+i.width/2;r=Array.from(e.querySelectorAll(`.table-node-wrapper`)).some(e=>{let t=e.getBoundingClientRect();return t.left<=o&&o<=t.right&&t.topa.top})}be.value!==r&&(be.value=r)}let we=L(()=>o.questions&&o.questions.length>0?o.questions[0]:void 0),Te=L(()=>{let e=we.value;if(e)return o.pendingQuestionActions?.[e.questionId]}),Ee=L(()=>o.approvals&&o.approvals.length>0?o.approvals[0]:void 0),De=L(()=>{let e=Ee.value;return e?!!o.pendingApprovalActions?.[e.approvalId]:!1}),Oe=R(null),ke=R(!1),Ae=R(null),je=R(0),Me=R(0),q=L(()=>({"--panes-scrollbar-width":`${je.value}px`})),Ne=L(()=>({"--chat-dock-height":`${Me.value+Wwe}px`}));function Pe(e){return e instanceof HTMLElement?e:e&&`$el`in e&&e.$el instanceof HTMLElement?e.$el:null}function Fe(){let e=Oe.value;je.value=e?Math.max(0,e.offsetWidth-e.clientWidth):0,Me.value=Ae.value?.offsetHeight??0}function Ie(e){let t=Pe(e);Oe.value=t,t&&Gt()}function Le(e){Ae.value=Pe(e)??null,e&&`loadForEdit`in e&&typeof e.loadForEdit==`function`&&`focus`in e&&typeof e.focus==`function`?T.value={loadForEdit:e.loadForEdit.bind(e),loadAttachmentsForEdit:`loadAttachmentsForEdit`in e&&typeof e.loadAttachmentsForEdit==`function`?e.loadAttachmentsForEdit.bind(e):()=>{},insertQuote:`insertQuote`in e&&typeof e.insertQuote==`function`?e.insertQuote.bind(e):()=>{},focus:e.focus.bind(e)}:T.value=null,Wt()}let Re=R(!0),ze=R(!1);function Be(){let e=Oe.value;return e?e.scrollHeight-e.scrollTop-e.clientHeight:0}let Ve=0,He=0,Ue=0,We=0,Ge=0,Ke=0;function qe(){return Date.now()1?(Re.value=!1,ze.value=!0):n<=Q7&&t>Ve+1&&(Re.value=!0,ze.value=!1),Ve=t,ye()}function Ye(e=!1){let t=Oe.value;Re.value=!0,ze.value=!1,t&&(!e&&performance.now()({node:t,top:Xe(e,t)})),r=n.findIndex(e=>e.top>=t),i=r<0?Math.max(0,n.length-1):r;return n.slice(i,i+2).flatMap(e=>{let t=e.node.dataset.scrollAnchorId,n=t??e.node.dataset.turnId;return n?[{kind:t?`tool`:`turn`,id:n,top:e.top}]:[]})}let Qe=new Map;function $e(e,t){for(let n of t.anchors){let t=n.kind===`tool`?`data-scroll-anchor-id`:`data-turn-id`,r=e.querySelector(`[${t}="${nt(n.id)}"]`);if(r)return Xe(e,r)-n.top}return e.scrollHeight-t.oldHeight}function et(e,t,n=e.scrollTop){return e.scrollTop=n+$e(e,t),Ve=e.scrollTop,e.scrollTop}async function tt(){if(!o.sessionId||!o.loadOlderMessages||o.loadingMore||jt.value||!o.hasMoreMessages)return;let e=o.sessionId,t=Oe.value,r=t?.scrollTop??0,i={anchors:t?Ze(t,r):[],oldHeight:t?.scrollHeight??0};Mt(e,!0),Pt();try{if(await n(),await o.loadOlderMessages(e),await n(),o.sessionId!==e){Qe.set(e,i);return}let t=Oe.value;if(!t)return;et(t,i),Qe.delete(e)}finally{Mt(e,!1)}}function nt(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replaceAll(/["\\]/g,`\\$&`)}function rt(e){let t=Oe.value;if(!t)return;let n=t.querySelector(`.turn-anchor[data-turn-id="${nt(e)}"]`);n&&(Ft(),Re.value=!1,ve.value=e,ze.value=Be()>Q7,n.scrollIntoView({behavior:`smooth`,block:`center`}))}function it(){let e=Oe.value;if(!e)return`none`;let t=e.firstElementChild,n=t instanceof HTMLElement?t.offsetHeight:0,r=Ae.value?.offsetHeight??0;return`${e.scrollHeight}:${e.clientHeight}:${n}:${r}`}function at(e){return typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,16)}function ot(e){typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e)}let st=0,ct=0,lt=null,ut=0;function dt(){return performance.now(){if(ct=0,performance.now()>=st||!lt){lt=null;return}let e=lt.getBoundingClientRect().top-ut;e&&(n.scrollTop+=e),ct=at(r)};ct=at(r)}function pt(e=36){if(!Re.value&&!qe())return;let t=++Ke,n=``,r=0,i=0;Ge&&=(ot(Ge),0);let a=()=>{if(Ge=0,t!==Ke||!Re.value&&!qe())return;Ye(!1);let o=it();r=o===n?r+1:0,n=o,i++,r<3&&i0&&t.length>=e.length&&e.firstId!==t.firstId&&e.lastId===t.lastId&&e.lastTextLen===t.lastTextLen&&e.lastThinkingLen===t.lastThinkingLen&&e.lastToolsLen===t.lastToolsLen&&e.approvalIds===t.approvalIds}s(L(()=>{let e=(o.approvals??[]).map(e=>e.approvalId).join(`,`),t=o.turns,n=t.at(-1),r=n?.thinking?.length??0,i=n?.tools?.reduce((e,t)=>e+t.name.length+(t.arg?.length??0)+(t.output?.join(``).length??0),0)??0;return{length:t.length,firstId:t[0]?.id??``,lastId:n?.id??``,lastTextLen:n?.text.length??0,lastThinkingLen:r,lastToolsLen:i,approvalIds:e}}),async(e,t)=>{if(jt.value&&mt(t,e)){ye();return}await n(),Re.value||qe()?Ye(e.length{Wt()}),s(()=>o.mobile,async()=>{await n(),Fe()});let ht=new Map;s(()=>o.fileReloadKey,async(e,t)=>{let r=Oe.value;t&&r&&ht.set(String(t),{top:r.scrollTop,following:Re.value}),Ft(),await n();let i=Oe.value,a=e?ht.get(String(e)):void 0;if(a&&i){let t=Qe.get(String(e)),n=t?et(i,t,a.top):a.top;t&&Qe.delete(String(e)),Re.value=a.following,i.scrollTop=n,Ve=i.scrollTop,ze.value=!a.following&&Be()>1,a.following&&pt()}else Re.value=!0,Ve=0,Ye(!1),pt();ye()}),s(()=>o.sessionLoading,async(e,t)=>{e||!t||(Re.value=!0,await n(),pt(),ye())}),s(()=>o.turnActive,async(e,t)=>{e||!t||!Re.value&&!qe()||(await n(),pt(48),ye())});function gt(){Re.value=!0,ze.value=!1,He=Date.now()+$7,n(()=>{Ye(!0),pt(16)})}function _t(e){gt(),l(`submit`,e)}function vt(e){Re.value=!0,ze.value=!1,He=Date.now()+$7,l(`editMessage`,e)}function yt(e){let t=o.queued?.[e];k(t?.text??``,t?.attachments)&&l(`editQueued`,e)}function bt(e){l(`reorderQueue`,e)}function xt(e,t){gt(),l(`answer`,e,t)}function St(e,t){!e||!t||l(`approval`,e,t)}let Ct=null,wt=null,Tt=null,Et=null,Dt=0,Ot=0,kt=0,At=R(new Set),jt=L(()=>!!o.sessionId&&At.value.has(o.sessionId));function Mt(e,t){let n=new Set(At.value);t?n.add(e):n.delete(e),At.value=n}function Nt(){jt.value||(kt||=at(()=>{kt=0,!jt.value&&(dt()||(Re.value||qe())&&Ye(!1))}))}function Pt(){Ke++,Ge&&=(ot(Ge),0),kt&&=(ot(kt),0)}function Ft(){let e=Oe.value;if(He=0,Pt(),st=0,lt=null,e){let t=e.scrollTop;typeof e.scrollTo==`function`?e.scrollTo({top:t,behavior:`auto`}):e.scrollTop=t}We=0,Ue=-1/0,e&&(Ve=e.scrollTop)}function It(){let e=Oe.value;!e||e.scrollHeight-e.clientHeight<=1&&!o.hasMoreMessages||(Re.value=!1,Ft(),e.scrollHeight-e.clientHeight>1&&(ze.value=!0))}function Lt(e){let t=Oe.value;if(!t)return!1;for(let n of e.composedPath()){if(n===t)return!1;if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight+1&&n.scrollTop>1)return!0}return!1}function Rt(e){e.defaultPrevented||e.ctrlKey||e.shiftKey||e.deltaY>=0||Lt(e)||It()}function zt(e){let t=Oe.value;if(!t||e.defaultPrevented||e.button!==0||e.pointerType===`touch`)return;let n=t.getBoundingClientRect(),r=t.offsetWidth-t.clientWidth,i=r>0?r:12;e.target===t&&e.clientX>=n.right-i&&It()}let Bt=null;function Vt(e){Bt=e.touches.length===1?e.touches[0].clientY:null}function Ht(e){let t=e.touches.length===1?e.touches[0].clientY:null;t!==null&&Bt!==null&&t>Bt+2&&!Lt(e)&&It(),Bt=t}function Ut(){if(!wt)return;let e=Oe.value?.firstElementChild??null;e!==Tt&&(Tt&&wt.unobserve(Tt),Tt=e,e&&wt.observe(e))}function Wt(){if(!wt)return;let e=Ae.value;e!==Et&&(Et&&wt.unobserve(Et),Et=e,e&&wt.observe(e))}function Gt(){let e=Oe.value;Fe(),Ct&&(Ct.disconnect(),e&&Ct.observe(e,{childList:!0,subtree:!0,characterData:!0})),wt&&(wt.disconnect(),Tt=null,Et=null,e&&wt.observe(e),Ut(),Wt()),Dt=e?.scrollHeight??0,Ot=e?.clientHeight??0,Se()}function Kt(){Ut(),Nt(),Se()}function qt(){typeof document>`u`||document.visibilityState===`visible`&&Re.value&&pt()}let Jt=R(!1),Yt=R(0);function Xt(){Yt.value+=1,Jt.value=!0}function Zt(){Xt(),l(`interrupt`)}function Qt(e){if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`f`){if(o.overlayOpen)return;e.preventDefault(),ke.value=!0,n(()=>{Oe.value?.closest(`.con`)?.querySelector(`.tsearch-input`)?.focus()});return}e.key===`Escape`&&(o.running||o.working)&&(e.preventDefault(),Zt())}function $t(){ke.value=!1,n(()=>Oe.value?.focus({preventScroll:!0}))}function en(){Re.value&&Nt()}p(()=>{n(()=>{typeof MutationObserver==`function`&&(Ct=new MutationObserver(Kt)),typeof ResizeObserver==`function`&&(wt=new ResizeObserver(()=>{Se(),Fe();let e=Oe.value;if(!e)return;let{scrollHeight:t,clientHeight:n}=e,r=t>Dt+1,i=n{Ct&&Ct.disconnect(),wt&&wt.disconnect(),kt&&ot(kt),Ge&&ot(Ge),ct&&ot(ct),xe&&ot(xe),O!==null&&(clearTimeout(O),O=null),typeof document<`u`&&(document.removeEventListener(`visibilitychange`,qt),document.removeEventListener(`keydown`,Qt)),window.visualViewport?.removeEventListener(`resize`,en)});function tn(){(T.value??w.value)?.focus()}function nn(e){(T.value??w.value)?.insertQuote(e)}return t({loadComposerForEdit:k,focusComposer:tn,insertComposerQuote:nn}),(t,n)=>{let i=r(`IconButton`);return c(),W(`section`,{class:V([`con`,{mobile:e.mobile,"toc-enabled":e.conversationToc}]),style:ae(Ne.value)},[ke.value&&Oe.value?(c(),P(ywe,{key:0,pane:Oe.value,mobile:e.mobile,onClose:$t},null,8,[`pane`,`mobile`])):E(``,!0),!e.mobile&&!(e.turns.length===0&&!e.sessionLoading)?(c(),P(Tde,{key:1,"session-id":e.sessionId,"workspace-name":e.workspaceName,"workspace-root":e.workspaceRoot,"session-title":e.sessionTitle,branch:e.gitInfo?.branch,ahead:e.gitInfo?.ahead,behind:e.gitInfo?.behind,"changes-count":G.value,"git-diff-stats":e.gitDiffStats,"is-git-repo":!!e.gitInfo,pr:e.pr,copied:D.value,"session-done":e.sessionDone,pinned:e.pinned,"panel-visible":e.panelVisible,onOpenChanges:n[0]||=e=>l(`openChanges`),onCopyAll:n[1]||=e=>C.value?.copyConversation(),onCopyFinalSummary:n[2]||=e=>C.value?.copyFinalSummary(),onOpenPr:n[3]||=t=>e.pr&&l(`openPr`,e.pr.url),onRenameSession:n[4]||=(e,t)=>l(`renameSession`,e,t),onForkSession:n[5]||=e=>l(`forkSession`,e),onTogglePin:n[6]||=e=>l(`togglePin`,e),onArchiveSession:n[7]||=e=>l(`archiveSession`,e),onRestoreSession:n[8]||=e=>l(`restoreSession`,e),onExportSession:n[9]||=e=>l(`exportSession`,e),onTogglePanel:n[10]||=t=>e.togglePanel?.()},null,8,[`session-id`,`workspace-name`,`workspace-root`,`session-title`,`branch`,`ahead`,`behind`,`changes-count`,`git-diff-stats`,`is-git-repo`,`pr`,`copied`,`session-done`,`pinned`,`panel-visible`])):E(``,!0),!e.mobile&&!e.panelVisible&&e.turns.length===0&&!e.sessionLoading?(c(),P(i,{key:2,class:`empty-panel-btn`,label:z(a)(`panel.openPanel`),onClick:n[11]||=t=>e.togglePanel?.()},{default:B(()=>[v(X,{name:`panel-expand-right`})]),_:1},8,[`label`])):E(``,!0),e.conversationToc?(c(),P($Ce,{key:3,items:_e.value,"active-turn-id":ve.value,mobile:e.mobile,"session-loading":e.sessionLoading,occluded:be.value,onSelect:rt},null,8,[`items`,`active-turn-id`,`mobile`,`session-loading`,`occluded`])):E(``,!0),F(`div`,Pwe,[F(`div`,{ref:Ie,class:V([`panes chat-scroll`,{"is-following":Re.value,"history-prepending":jt.value}]),tabindex:`-1`,onScrollPassive:Je,onWheelPassive:Rt,onPointerdownPassive:zt,onTouchstartPassive:Vt,onTouchmovePassive:Ht},[F(`div`,{class:V([`content-wrap`,[e.mobile?`align-mobile`:`align-center`]])},[e.turns.length===0&&!e.sessionLoading?(c(),W(M,{key:0},[n[69]||=F(`div`,{class:`empty-spacer`},null,-1),F(`div`,Fwe,[F(`span`,{class:V([`empty-hint-title`,{"is-starting":e.starting}])},[e.starting?(c(),P(np,{key:0,size:`sm`})):(c(),P(Z7,{key:1,size:`md`,label:``,"aria-hidden":`true`})),F(`span`,null,U(e.starting?z(a)(`conversation.starting`):z(a)(`composer.emptyConversationTitle`)),1)],2),e.starting?E(``,!0):(c(),W(`span`,Iwe,U(z(a)(`composer.emptyConversation`)),1)),y.value&&!e.starting?(c(),W(`div`,Lwe,[v(vp,{text:z(a)(`conversation.switchWorkspace`)},{default:B(()=>[F(`button`,{type:`button`,class:`ws-pick-btn`,onClick:n[12]||=H(e=>u.value=!u.value,[`stop`])},[v(X,{name:`folder`,size:`sm`}),F(`span`,Rwe,U(g.value),1),v(X,{class:V([`ws-pick-chev`,{open:u.value}]),name:`chevron-down`,size:`sm`},null,8,[`class`])])]),_:1},8,[`text`]),u.value?E(``,!0):(c(),P(Cwe,{key:0,class:`ws-pick-arrow`,label:z(a)(`conversation.workingDirectory`)},null,8,[`label`])),u.value?(c(),W(`div`,{key:1,class:`ws-pick-backdrop`,onClick:n[13]||=e=>u.value=!1})):E(``,!0),u.value?(c(),W(`div`,zwe,[(c(!0),W(M,null,_(b.value,t=>(c(),W(`button`,{key:t.id,type:`button`,class:V([`ws-pick-item`,{on:t.id===e.activeWorkspaceId}]),onClick:H(e=>S(t.id),[`stop`])},[F(`span`,Vwe,U(t.name),1),F(`span`,Hwe,U(t.shortPath),1)],10,Bwe))),128)),x.value>0?(c(),W(`button`,{key:0,type:`button`,class:`ws-pick-item ws-pick-more`,onClick:n[14]||=H(e=>f.value=!f.value,[`stop`])},[F(`span`,null,U(z(a)(`conversation.moreWorkspaces`,{count:x.value})),1)])):E(``,!0),n[68]||=F(`div`,{class:`ws-pick-divider`},null,-1),F(`button`,{type:`button`,class:`ws-pick-action`,onClick:n[15]||=H(e=>{u.value=!1,l(`addWorkspace`)},[`stop`])},[v(X,{name:`plus`,size:`sm`}),F(`span`,null,U(z(a)(`conversation.addWorkspace`)),1)])])):E(``,!0)])):e.starting?E(``,!0):(c(),W(`button`,{key:2,type:`button`,class:`empty-add-workspace`,onClick:n[16]||=e=>l(`addWorkspace`)},[v(X,{name:`folder-plus`,size:`sm`}),F(`span`,null,U(z(a)(`conversation.addWorkspace`)),1)]))]),e.sessionId?E(``,!0):(c(),P(Nwe,{key:0,sessions:e.recentSessions??[],onSelect:n[17]||=e=>l(`selectSession`,e),onOpenSessionAdmin:n[18]||=e=>l(`openSessionAdmin`)},null,8,[`sessions`])),v(R7,{ref_key:`emptyComposerRef`,ref:w,class:`empty-composer`,"session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"goal-mode":e.goalMode,"tower-mode":e.towerMode,"tower-available":e.towerAvailable,"workflow-active":e.dynamicWorkflowMode,goal:e.goal,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,starting:e.starting,"hide-context":``,onSubmit:_t,onSteer:n[19]||=e=>l(`steer`,e),onCommand:n[20]||=e=>l(`command`,e),onInterrupt:Zt,onUnqueue:n[21]||=e=>l(`unqueue`,e),onEditQueued:n[22]||=e=>l(`editQueued`,e),onSetPermission:n[23]||=e=>l(`setPermission`,e),onSetThinking:n[24]||=e=>l(`setThinking`,e),onTogglePlan:n[25]||=e=>l(`togglePlan`),onToggleWorkflow:n[26]||=e=>l(`toggleWorkflow`),onToggleGoal:n[27]||=e=>l(`toggleGoal`),onToggleTower:n[28]||=e=>l(`toggleTower`),onOpenBtw:n[29]||=e=>l(`command`,`/btw`),onCreateGoal:n[30]||=e=>l(`createGoal`,e),onControlGoal:n[31]||=e=>l(`controlGoal`,e),onFocusGoal:j,onCompact:n[32]||=e=>l(`compact`),onPickModel:n[33]||=e=>l(`pickModel`),onSelectModel:n[34]||=e=>l(`selectModel`,e)},null,8,[`session-id`,`running`,`queued`,`search-files`,`upload-image`,`status`,`thinking`,`plan-mode`,`goal-mode`,`tower-mode`,`tower-available`,`workflow-active`,`goal`,`activation-badges`,`models`,`starred-ids`,`skills`,`starting`]),n[70]||=F(`div`,{class:`empty-spacer`},null,-1)],64)):(c(),P(Y4,{ref_key:`chatPaneRef`,ref:C,key:e.fileReloadKey??`no-session`,turns:e.turns,"expert-talk-runs":e.expertTalkRuns,"expert-talk-models":e.models,approvals:e.approvals,questions:e.questions,"turn-active":e.turnActive,working:e.working,"fast-moon":e.fastMoon,"session-loading":e.sessionLoading,compaction:e.compaction,"has-more-messages":e.hasMoreMessages,"loading-more":e.loadingMore,"loading-more-error":e.loadingMoreError,"is-following":Re.value,"tool-diff-panel":!0,"turn-folding":e.turnFolding??!0,"activity-run-folding":e.activityRunFolding??!0,"last-turn-reason":e.lastTurnReason,"turn-error-kind":e.turnErrorKind,"turn-error-message":e.turnErrorMessage,cwd:e.workspaceRoot,queued:e.queued,onOpenFile:n[35]||=e=>l(`openFile`,e),onOpenMedia:n[36]||=e=>l(`openMedia`,e),onTakeExpertTalk:n[37]||=e=>l(`takeExpertTalk`,e),onBuildExpertTalk:n[38]||=e=>l(`buildExpertTalk`,e),onCopyConversationCopied:A,onOpenCompaction:n[39]||=e=>l(`openCompaction`,e),onOpenAgent:n[40]||=e=>l(`openAgent`,e),onDetachTask:n[41]||=e=>l(`detachTask`,e),onOpenToolDiff:n[42]||=e=>l(`openToolDiff`,e),onOpenTurnDiff:n[43]||=e=>l(`openTurnDiff`,e),onEditMessage:vt,onLoadOlderMessages:tt,onUnqueue:n[44]||=e=>l(`unqueue`,e),onEditQueued:yt,onReorderQueue:bt,onSteerQueued:n[45]||=e=>l(`steerQueued`,e),onContinueTurn:n[46]||=e=>_t({text:e,attachments:[]})},null,8,[`turns`,`expert-talk-runs`,`expert-talk-models`,`approvals`,`questions`,`turn-active`,`working`,`fast-moon`,`session-loading`,`compaction`,`has-more-messages`,`loading-more`,`loading-more-error`,`is-following`,`turn-folding`,`activity-run-folding`,`last-turn-reason`,`turn-error-kind`,`turn-error-message`,`cwd`,`queued`]))],2)],34),(c(),P(ee,{defer:``,to:`.pfc-host`,disabled:!e.panelExpanded||e.activePanelType===`btw`},[e.turns.length===0&&!e.sessionLoading?E(``,!0):(c(),P(KCe,{key:0,ref:Le,style:ae(q.value),"session-id":e.sessionId,running:e.running,starting:e.starting,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"plan-armed":e.planArmed,working:e.working,"goal-mode":e.goalMode,"tower-mode":e.towerMode,"tower-available":e.towerAvailable,"dynamic-workflow-mode":e.dynamicWorkflowMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,goal:e.goal,"session-plans":e.sessionPlans,"overlay-open":e.overlayOpen,"open-file":e=>l(`openFile`,e),"reveal-saved-plan":e.revealSavedPlan,"dock-panel":fe.value,"bash-tasks":N.value,"subagent-tasks":I.value,"bash-running":te.value,"subagent-running":ne.value,"todo-done-count":ue.value,"has-dock-work":de.value,todos:e.todos,"pending-question":we.value,"question-busy-kind":Te.value,"pending-approval":Ee.value,"approval-busy":De.value,mobile:e.mobile,onToggleDockPanel:n[47]||=e=>pe(e),onCloseDockPanel:n[48]||=e=>me(),onOpenAgent:n[49]||=e=>l(`openAgent`,e),onAnswer:xt,onDismiss:n[50]||=e=>l(`dismiss`,e),onApproval:St,onCancelTask:n[51]||=e=>l(`cancelTask`,e),onControlGoal:n[52]||=e=>l(`controlGoal`,e),onSubmit:_t,onSteer:n[53]||=e=>l(`steer`,e),onCommand:n[54]||=e=>l(`command`,e),onInterrupt:Zt,onSetPermission:n[55]||=e=>l(`setPermission`,e),onSetThinking:n[56]||=e=>l(`setThinking`,e),onTogglePlan:n[57]||=e=>l(`togglePlan`),onToggleWorkflow:n[58]||=e=>l(`toggleWorkflow`),onToggleGoal:n[59]||=e=>l(`toggleGoal`),onToggleTower:n[60]||=e=>l(`toggleTower`),onOpenBtw:n[61]||=e=>l(`command`,`/btw`),onCreateGoal:n[62]||=e=>l(`createGoal`,e),onFocusGoal:j,onCompact:n[63]||=e=>l(`compact`),onPickModel:n[64]||=e=>l(`pickModel`),onSelectModel:n[65]||=e=>l(`selectModel`,e)},null,8,`style.session-id.running.starting.queued.search-files.upload-image.status.thinking.plan-mode.plan-armed.working.goal-mode.tower-mode.tower-available.dynamic-workflow-mode.activation-badges.models.starred-ids.skills.goal.session-plans.overlay-open.open-file.reveal-saved-plan.dock-panel.bash-tasks.subagent-tasks.bash-running.subagent-running.todo-done-count.has-dock-work.todos.pending-question.question-busy-kind.pending-approval.approval-busy.mobile`.split(`.`)))],8,[`disabled`]))]),v(oe,{name:`pill`},{default:B(()=>[ze.value?(c(),W(`button`,{key:0,class:`newmsg-pill`,style:ae({bottom:`${Me.value+12}px`}),"aria-label":z(a)(`conversation.jumpToLatestAria`),onClick:n[66]||=e=>Ye(!0)},[v(X,{class:`pill-chevron`,name:`chevron-down`,size:`md`}),K(` `+U(z(a)(`conversation.newMessages`)),1)],12,Uwe)):E(``,!0)]),_:1}),Jt.value?(c(),P(X7,{key:Yt.value,duration:Kwe,onDismiss:n[67]||=e=>Jt.value=!1},{default:B(()=>[K(U(z(a)(`conversation.manuallyAborted`)),1)]),_:1})):E(``,!0)],6)}}}),[[`__scopeId`,`data-v-52f9eb6f`]]),Jwe=[`role`,`aria-label`],Ywe={key:0,class:`sab-comment`},Xwe=[`placeholder`],Zwe=[`disabled`],Qwe=Y(G({__name:`SelectionActionBar`,props:{enabled:{type:Boolean},panelSource:{}},emits:[`add`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(!1),s=R(!1),u=R(``),d=R(``),f=R(),m=R({}),g=R(null),_=R(null),y=0;function b(){o.value=!1,s.value=!1,u.value=``}function x(e){let t=e.commonAncestorContainer;return t.nodeType===Node.ELEMENT_NODE?t:t.parentElement}function S(){if(y=0,!r.enabled||s.value&&g.value?.contains(document.activeElement))return;let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed){b();return}let t=e.getRangeAt(0),n=x(t),i=n?.closest(`.con, .pt-body`);if(!n||!i||n.closest(`.sab, input, textarea, button, [contenteditable="true"]`)){b();return}let a=e.toString().trim(),c=t.getBoundingClientRect();if(!a||c.width===0&&c.height===0){b();return}d.value=a,f.value=i.classList.contains(`pt-body`)?r.panelSource:void 0;let l=Math.min(window.innerWidth-220-8,Math.max(8,c.left+c.width/2-220/2)),u=c.bottom+8;m.value={left:`${Math.round(l)}px`,top:`${Math.round(u)}px`,width:`220px`},o.value=!0,s.value=!1}function C(){y&&cancelAnimationFrame(y),y=requestAnimationFrame(S)}function w(){window.getSelection()?.removeAllRanges()}function T(e){let t=d.value.trim();if(!t)return;let n=e?.trim();i(`add`,{quote:t,comment:n||void 0,source:f.value}),w(),b()}function D(){s.value=!0,n(()=>_.value?.focus())}function O(e){if(s.value||e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(g.value?.querySelectorAll(`.sab-action`)??[]),n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}function k(e){!o.value||g.value?.contains(e.target)||b()}function A(e){e.key===`Escape`&&o.value&&(e.preventDefault(),e.stopImmediatePropagation(),b())}return p(()=>{document.addEventListener(`selectionchange`,C),document.addEventListener(`pointerdown`,k,!0),document.addEventListener(`keydown`,A,!0)}),h(()=>{y&&cancelAnimationFrame(y),document.removeEventListener(`selectionchange`,C),document.removeEventListener(`pointerdown`,k,!0),document.removeEventListener(`keydown`,A,!0)}),(e,t)=>(c(),P(ee,{to:`body`},[o.value?(c(),W(`div`,{key:0,ref_key:`barRef`,ref:g,class:`sab`,style:ae(m.value),role:s.value?`dialog`:`menu`,"aria-label":s.value?z(a)(`selection.comment`):void 0,onPointerdown:t[4]||=H(()=>{},[`prevent`]),onKeydown:O},[s.value?(c(),W(`div`,Ywe,[l(F(`input`,{ref_key:`commentInputRef`,ref:_,"onUpdate:modelValue":t[0]||=e=>u.value=e,placeholder:z(a)(`selection.commentPlaceholder`),onKeydown:t[1]||=ie(H(e=>T(u.value),[`prevent`]),[`enter`])},null,40,Xwe),[[de,u.value]]),F(`button`,{type:`button`,disabled:!u.value.trim(),onClick:t[2]||=e=>T(u.value)},U(z(a)(`selection.confirm`)),9,Zwe)])):(c(),W(M,{key:1},[F(`button`,{type:`button`,class:`sab-action`,role:`menuitem`,onClick:D},[v(X,{name:`message`,size:`sm`}),F(`span`,null,U(z(a)(`selection.comment`)),1)]),F(`button`,{type:`button`,class:`sab-action`,role:`menuitem`,onClick:t[3]||=e=>T()},[v(X,{name:`plus`,size:`sm`}),F(`span`,null,U(z(a)(`selection.addToChat`)),1)])],64))],44,Jwe)):E(``,!0)]))}}),[[`__scopeId`,`data-v-d37e8069`]]),$we=[`aria-label`],eTe={class:`media-lightbox-card`},tTe=[`src`,`alt`],nTe=[`src`],rTe={key:0,class:`media-preview-caption`},iTe=Y(G({__name:`MediaLightbox`,props:{media:{},src:{},originImg:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=[`a[href]`,`area[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`),a=S(`overlay`),o=S(`close`),s=S(`image`),l=L(()=>n.media.kind===`image`),u=L(()=>n.media.path??(l.value?`Image preview`:`Video preview`)),d=ue(1),f=ue(0),m=ue(0),g=ue(!1),_=L(()=>({transform:`translate(${f.value}px, ${m.value}px) scale(${d.value})`,cursor:d.value>1?g.value?`grabbing`:`grab`:`zoom-in`})),y=null,b=null,x=0,C=0,w=0,T=0,{lock:D,unlock:O}=P7();function k(){d.value=1,f.value=0,m.value=0}function A(e){if(!l.value)return;e.preventDefault();let t=Math.min(8,Math.max(1,d.value*(e.deltaY<0?1.1:.9)));d.value=t,t===1&&(f.value=0,m.value=0)}function j(){if(d.value!==1){k();return}let e=s.value;e&&(d.value=Math.min(8,Math.max(1,e.naturalWidth/e.clientWidth)))}function M(e){d.value<=1||(b=e.pointerId,x=e.clientX,C=e.clientY,w=f.value,T=m.value,g.value=!0,s.value?.setPointerCapture(e.pointerId))}function N(e){b===e.pointerId&&(f.value=w+e.clientX-x,m.value=T+e.clientY-C)}function I(e){b===e.pointerId&&(s.value?.releasePointerCapture(e.pointerId),b=null,g.value=!1)}function te(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),r(`close`);return}if(e.key!==`Tab`||!a.value)return;let t=a.value.querySelectorAll(i),n=t[0],o=t[t.length-1];!n||!o||(a.value.contains(document.activeElement)?e.shiftKey&&document.activeElement===n?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),n.focus()):(e.preventDefault(),(e.shiftKey?o:n).focus()))}return p(()=>{D(),y=document.activeElement instanceof HTMLElement?document.activeElement:n.originImg??null,window.addEventListener(`keydown`,te),o.value?.focus()}),h(()=>{O(),window.removeEventListener(`keydown`,te),y?.focus()}),(t,n)=>(c(),P(ee,{to:`body`},[F(`div`,{ref:`overlay`,class:`media-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":u.value,onMousedown:n[1]||=H(e=>r(`close`),[`self`])},[F(`button`,{ref:`close`,type:`button`,class:`media-lightbox-close`,"aria-label":`Close`,onClick:n[0]||=e=>r(`close`)},[v(X,{name:`close`,size:`sm`})],512),F(`div`,eTe,[F(`div`,{class:`media-lightbox-frame`,onWheel:A},[l.value?(c(),W(`img`,{key:0,ref:`image`,class:`media-lightbox-media`,src:e.src,alt:e.media.path??``,draggable:`false`,style:ae(_.value),onDblclick:j,onPointerdown:M,onPointermove:N,onPointerup:I,onPointercancel:I},null,44,tTe)):(c(),W(`video`,{key:1,class:`media-lightbox-media`,src:e.src,controls:``,autoplay:``},null,8,nTe))],32)]),e.media.path?(c(),W(`div`,rTe,U(e.media.path),1)):E(``,!0)],40,$we)]))}}),[[`__scopeId`,`data-v-a5036dce`]]),aTe={class:`ui-panel-header__main`},oTe={class:`ui-panel-header__title`},sTe={key:0,class:`ui-panel-header__sub`},e9=Y(G({__name:`PanelHeader`,props:{title:{},subtitle:{},closable:{type:Boolean,default:!0},closeLabel:{default:`Close`},wrap:{type:Boolean}},emits:[`close`],setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-panel-header`,{wrap:e.wrap}])},[F(`div`,aTe,[F(`span`,oTe,U(e.title),1),v(vp,{text:e.subtitle},{default:B(()=>[e.subtitle?(c(),W(`span`,sTe,U(e.subtitle),1)):E(``,!0)]),_:1},8,[`text`]),me(t.$slots,`default`,{},void 0,!0)]),e.closable?(c(),P(Ca,{key:0,class:`ui-panel-header__close`,size:`sm`,label:e.closeLabel,onClick:n[0]||=e=>t.$emit(`close`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])):E(``,!0)],2))}}),[[`__scopeId`,`data-v-47211810`]]),cTe={key:0,class:`fp-empty fp-error`},lTe={key:1,class:`fp-empty`},uTe={key:2,class:`fp-loading`},dTe={class:`fp-path`},fTe={class:`fp-meta`},pTe={key:0,class:`fp-lines`},mTe={class:`fp-size`},hTe={key:3,class:`fp-search`},gTe=[`placeholder`],_Te={key:0,class:`fp-search-count`},vTe={key:1,class:`fp-code`},yTe={class:`fp-line-table`},bTe=[`data-line`],xTe={class:`fp-gutter`},STe=[`innerHTML`],CTe={key:1,class:`fp-body fp-code`},wTe={class:`fp-line-table`},TTe=[`data-line`],ETe={class:`fp-gutter`},DTe=[`innerHTML`],OTe={key:2,class:`fp-body`},kTe=[`srcdoc`,`title`],ATe={key:1,class:`fp-code`},jTe={class:`fp-line-table`},MTe=[`data-line`],NTe={class:`fp-gutter`},PTe=[`innerHTML`],FTe={key:3,class:`fp-body fp-pdf-wrap`},ITe=[`src`,`title`],LTe={key:1,class:`fp-binary-card`},RTe={class:`fp-binary-label`},zTe={key:4,class:`fp-body fp-table-wrap`},BTe={class:`fp-table`},VTe=[`data-line`],HTe={key:5,class:`fp-body fp-image-wrap`},UTe=[`src`,`alt`],WTe={key:1,class:`fp-binary-card`},GTe={class:`fp-binary-icon`},KTe={class:`fp-binary-label`},qTe={key:6,class:`fp-body fp-image-wrap`},JTe=[`src`],YTe={key:1,class:`fp-binary-card`},XTe={class:`fp-binary-icon`},ZTe={class:`fp-binary-label`},QTe={key:7,class:`fp-body fp-code`},$Te={class:`fp-line-table`},eEe=[`data-line`],tEe={class:`fp-gutter`},nEe=[`innerHTML`],rEe={key:8,class:`fp-body fp-binary-wrap`},iEe={class:`fp-binary-card`},aEe={class:`fp-binary-icon`},oEe={class:`fp-binary-label`},sEe=Y(G({__name:`FilePreview`,props:{file:{},loading:{type:Boolean},error:{},line:{},downloadUrl:{},closable:{type:Boolean},externalActions:{type:Boolean},stale:{type:Boolean},refreshing:{type:Boolean},editable:{type:Boolean},openFile:{type:Function}},emits:[`close`,`openExternal`,`reveal`,`openEditor`,`refresh`],setup(e,{emit:t}){let{t:r}=J();function i(e,t){let n=t?t.split(`/`).filter(Boolean):[];for(let t of e.split(`/`))t===``||t===`.`||(t===`..`?n.pop():n.push(t));return n.join(`/`)}let a=m(`resolveImage`,async e=>e),o=L(()=>{let e=h.file?.path??``,t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``});function u(e){if(/^(https?:|data:|blob:)/i.test(e)||e.startsWith(`/`))return e;let t=o.value;return t?i(e,t):e}async function f(e){let t=u(e);return a?a(t):t}d(`resolveImage`,f);function p(e){let t=e.path;if(/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(t)||t.startsWith(`/`))return e;for(let e of[`#`,`?`]){let n=t.indexOf(e);n!==-1&&(t=t.slice(0,n))}let n=o.value;return{...e,path:i(t,n)}}let h=e,g=L(()=>{let e=h.file;return e!==null&&!e.isBinary}),y=t;function b(e){h.openFile?.(p(e))}let x=R(null),S=L(()=>{let e=h.file;if(!e)return`binary`;let t=e.mime??``,n=e.languageId??``,r=e.path.toLowerCase();return t===`text/markdown`||n===`markdown`||n===`md`||r.endsWith(`.mdx`)?`markdown`:t===`application/json`||n===`json`?`json`:t===`text/html`||n===`html`||r.endsWith(`.html`)||r.endsWith(`.htm`)?`html`:t===`application/pdf`||r.endsWith(`.pdf`)?`pdf`:t===`text/csv`||n===`csv`||r.endsWith(`.csv`)?`csv`:t.startsWith(`image/`)?`image`:t.startsWith(`video/`)?`video`:e.isBinary?`binary`:t.startsWith(`text/`)||n!==``?`text`:`binary`});function C(e){let t=atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder().decode(n)}let w=L(()=>{let e=h.file;if(!e)return``;if(e.encoding===`base64`)try{return C(e.content)}catch{return e.content}return e.content}),T=L(()=>{if(S.value!==`json`||!h.file)return``;try{return JSON.stringify(JSON.parse(w.value),null,2)}catch{return w.value}}),D=L(()=>h.file?(S.value===`json`?T.value:w.value).split(` -`):[]),O=L(()=>h.file?S.value===`json`?T.value:w.value:``),k=R(``),A=R(0),j=L(()=>{let e=k.value.trim().toLowerCase();if(!e)return[];let t=[];return D.value.forEach((n,r)=>{n.toLowerCase().includes(e)&&t.push(r+1)}),t});s(k,()=>{A.value=0});function N(e,t=!1){e&&n(()=>{let n=x.value?.querySelector(`.fp-body`),r=n?.querySelector(`[data-line="${e}"]`);if(!n||!r)return;t&&(n.scrollTop=0);let i=n.getBoundingClientRect(),a=r.getBoundingClientRect();n.scrollTop=a.top-i.top+n.scrollTop-n.clientHeight/2+a.height/2})}s(()=>[h.file?.path,h.line],()=>N(h.line,!0),{immediate:!0});function ee(e){let t=j.value;t.length!==0&&(A.value=(A.value+e+t.length)%t.length,N(t[A.value]))}function I(e){let t=j.value;return{target:h.line===e,hit:t.includes(e),active:t[A.value]===e}}function te(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}let ne=R(!1),re=R(!1);function ie(){h.file&&Wi(O.value).then(e=>{e&&(ne.value=!0,setTimeout(()=>{ne.value=!1},1400))})}function oe(){h.file&&Wi(h.file.path).then(e=>{e&&(re.value=!0,setTimeout(()=>{re.value=!1},1400))})}let se=R(`preview`),ce=R(`preview`),le=R(`fit`);function ue(e){se.value=e}function fe(e){ce.value=e}function H(e){le.value=e}s(S,e=>{se.value=e===`html`?`preview`:`source`,ce.value=`preview`,le.value=`fit`});let G=L(()=>{let e=h.file;return!e||S.value!==`image`?null:e.sourceUrl?e.sourceUrl:e.encoding===`base64`?`data:${e.mime};base64,${e.content}`:e.mime===`image/svg+xml`?`data:${e.mime};charset=utf-8,${encodeURIComponent(e.content)}`:null}),pe=L(()=>{let e=h.file;return!e||S.value!==`video`?null:e.sourceUrl?e.sourceUrl:e.encoding===`base64`?`data:${e.mime};base64,${e.content}`:null}),me=L(()=>{let e=h.file;return!e||S.value!==`pdf`?null:h.downloadUrl?h.downloadUrl:e.encoding===`base64`?`data:${e.mime};base64,${e.content}`:null}),he=L(()=>h.file?[``,``,``,w.value].join(``):``);function ge(e){let t=[],n=``,r=!1;for(let i=0;iD.value.slice(0,200).map(ge));function ve(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`)}function ye(){let e=h.file;return e?e.languageId?.toLowerCase()||(e.path.split(`.`).pop()?.toLowerCase()??``):``}function be(e){let t=ye(),n=ve(e);return S.value===`json`||t===`json`||t===`jsonc`?(n=n.replace(/("[^&]*?")(\s*:)/g,`$1$2`),n=n.replace(/(:\s*)("[^&]*?")/g,`$1$2`),n=n.replace(/\b(true|false|null)\b/g,`$1`),n=n.replace(/(:\s*)(-?\d+(?:\.\d+)?)/g,`$1$2`),n):S.value===`html`||t===`html`||t===`xml`||t===`svg`?(n=n.replace(/\s([A-Za-z_:][-A-Za-z0-9_:.]*)(=)/g,` $1$2`),n=n.replace(/(".*?")/g,`$1`),n=n.replace(/(<\/?)([A-Za-z][\w:-]*)/g,`$1$2`),n):(n=n.replace(/\b(async|await|break|case|catch|class|const|continue|else|export|extends|finally|for|from|function|if|import|interface|let|new|return|switch|throw|try|type|while)\b/g,`$1`),n=n.replace(/(".*?"|'.*?')/g,`$1`),n=n.replace(/(\/\/.*)$/g,`$1`),n)}function xe(e,t=55){return!e||e.length<=t?e:`…`+e.slice(e.length-t+1)}return(t,n)=>(c(),W(`div`,{ref_key:`rootRef`,ref:x,class:`file-preview`},[e.error&&!e.loading?(c(),W(`div`,cTe,[F(`span`,null,U(e.error),1),e.closable?(c(),P(YT,{key:0,variant:`secondary`,size:`sm`,onClick:n[0]||=e=>y(`close`)},{default:B(()=>[K(U(z(r)(`filePreview.close`)),1)]),_:1})):E(``,!0)])):!e.file&&!e.loading?(c(),W(`div`,lTe,U(z(r)(`filePreview.empty`)),1)):e.loading?(c(),W(`div`,uTe,[n[9]||=F(`span`,{class:`spinner`},null,-1),F(`span`,null,U(z(r)(`filePreview.loading`)),1)])):e.file?(c(),W(M,{key:3},[v(e9,{wrap:``,title:z(r)(`common.preview`),closable:e.closable,"close-label":z(r)(`filePreview.close`),class:V({"fp-refreshing":e.refreshing}),onClose:n[8]||=e=>y(`close`)},{default:B(()=>[v(vp,{text:e.file.path},{default:B(()=>[F(`span`,dTe,U(xe(e.file.path)),1)]),_:1},8,[`text`]),F(`span`,fTe,[e.file.lineCount?(c(),W(`span`,pTe,U(z(r)(`filePreview.lineCount`,{count:e.file.lineCount})),1)):E(``,!0),F(`span`,mTe,U(te(e.file.size)),1)]),v(YT,{variant:`secondary`,size:`sm`,class:`fp-refresh`,style:ae({visibility:e.stale?`visible`:`hidden`}),"aria-label":z(r)(`filePreview.refresh`),disabled:!e.stale||e.refreshing,onClick:n[1]||=e=>y(`refresh`)},{default:B(()=>[v(X,{name:`refresh`,size:`sm`}),K(` `+U(z(r)(`filePreview.refresh`)),1)]),_:1},8,[`style`,`aria-label`,`disabled`]),S.value===`html`?(c(),P(s6,{key:0,"model-value":se.value,size:`sm`,options:[{value:`preview`,label:z(r)(`filePreview.preview`)},{value:`source`,label:z(r)(`filePreview.source`)}],"onUpdate:modelValue":ue},null,8,[`model-value`,`options`])):E(``,!0),S.value===`markdown`?(c(),P(s6,{key:1,"model-value":ce.value,size:`sm`,options:[{value:`preview`,label:z(r)(`filePreview.preview`)},{value:`source`,label:z(r)(`filePreview.source`)}],"onUpdate:modelValue":fe},null,8,[`model-value`,`options`])):E(``,!0),S.value===`image`?(c(),P(s6,{key:2,"model-value":le.value,size:`sm`,options:[{value:`fit`,label:z(r)(`filePreview.fit`)},{value:`actual`,label:z(r)(`filePreview.actual`)}],"onUpdate:modelValue":H},null,8,[`model-value`,`options`])):E(``,!0),S.value===`text`||S.value===`json`||S.value===`html`||S.value===`csv`?(c(),W(`div`,hTe,[l(F(`input`,{"onUpdate:modelValue":n[2]||=e=>k.value=e,class:`fp-search-input`,type:`search`,placeholder:z(r)(`filePreview.search`)},null,8,gTe),[[de,k.value]]),k.value.trim()?(c(),W(`span`,_Te,U(j.value.length),1)):E(``,!0),v(Ca,{size:`sm`,disabled:j.value.length===0,label:z(r)(`filePreview.prevMatch`),onClick:n[3]||=e=>ee(-1)},{default:B(()=>[v(X,{name:`arrow-up`,size:`md`})]),_:1},8,[`disabled`,`label`]),v(Ca,{size:`sm`,disabled:j.value.length===0,label:z(r)(`filePreview.nextMatch`),onClick:n[4]||=e=>ee(1)},{default:B(()=>[v(X,{name:`arrow-down`,size:`md`})]),_:1},8,[`disabled`,`label`])])):E(``,!0),v(Ca,{size:`sm`,class:V({copied:re.value}),label:re.value?z(r)(`filePreview.copied`):z(r)(`filePreview.copyPath`),onClick:oe},{default:B(()=>[re.value?(c(),P(X,{key:1,class:`fp-check`,name:`check`,size:`md`})):(c(),P(X,{key:0,name:`link`,size:`md`}))]),_:1},8,[`class`,`label`]),e.editable&&g.value&&e.file!==null?(c(),P(Ca,{key:4,size:`sm`,label:z(r)(`editor.title`),onClick:n[5]||=t=>y(`openEditor`,e.file.path)},{default:B(()=>[v(X,{name:`pencil`,size:`md`})]),_:1},8,[`label`])):E(``,!0),e.externalActions?(c(),P(Ca,{key:5,size:`sm`,label:z(r)(`filePreview.openInEditor`),onClick:n[6]||=e=>y(`openExternal`)},{default:B(()=>[v(X,{name:`external-link`,size:`md`})]),_:1},8,[`label`])):E(``,!0),e.externalActions?(c(),P(Ca,{key:6,size:`sm`,label:z(r)(`filePreview.reveal`),onClick:n[7]||=e=>y(`reveal`)},{default:B(()=>[v(X,{name:`folder`,size:`md`})]),_:1},8,[`label`])):E(``,!0),!e.file.isBinary&&S.value!==`image`?(c(),P(Ca,{key:7,size:`sm`,class:V({copied:ne.value}),label:ne.value?z(r)(`filePreview.copied`):z(r)(`filePreview.copy`),onClick:ie},{default:B(()=>[ne.value?(c(),P(X,{key:1,class:`fp-check`,name:`check`,size:`md`})):(c(),P(X,{key:0,name:`copy`,size:`md`}))]),_:1},8,[`class`,`label`])):E(``,!0)]),_:1},8,[`title`,`closable`,`close-label`,`class`]),S.value===`markdown`?(c(),W(`div`,{key:0,class:V([`fp-body`,{"fp-markdown":ce.value===`preview`}])},[ce.value===`preview`?(c(),P(T4,{key:0,text:w.value,"open-file":h.openFile?b:void 0},null,8,[`text`,`open-file`])):(c(),W(`div`,vTe,[F(`div`,yTe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,xTe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,STe)],10,bTe))),128))])]))],2)):S.value===`json`?(c(),W(`div`,CTe,[F(`div`,wTe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,ETe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,DTe)],10,TTe))),128))])])):S.value===`html`?(c(),W(`div`,OTe,[se.value===`preview`?(c(),W(`iframe`,{key:0,class:`fp-html-frame`,sandbox:``,srcdoc:he.value,title:e.file.path},null,8,kTe)):(c(),W(`div`,ATe,[F(`div`,jTe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,NTe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,PTe)],10,MTe))),128))])]))])):S.value===`pdf`?(c(),W(`div`,FTe,[me.value?(c(),W(`iframe`,{key:0,class:`fp-pdf-frame`,src:me.value,title:e.file.path},null,8,ITe)):(c(),W(`div`,LTe,[F(`span`,RTe,U(z(r)(`filePreview.pdfNoPreview`)),1)]))])):S.value===`csv`?(c(),W(`div`,zTe,[F(`table`,BTe,[F(`tbody`,null,[(c(!0),W(M,null,_(_e.value,(e,t)=>(c(),W(`tr`,{key:t,class:V(I(t+1)),"data-line":t+1},[F(`th`,null,U(t+1),1),(c(!0),W(M,null,_(e,(e,t)=>(c(),W(`td`,{key:t},U(e),1))),128))],10,VTe))),128))])])])):S.value===`image`?(c(),W(`div`,HTe,[G.value?(c(),W(`img`,{key:0,src:G.value,alt:e.file.path,class:V([`fp-image`,{actual:le.value===`actual`}])},null,10,UTe)):(c(),W(`div`,WTe,[F(`span`,GTe,[v(X,{name:`image-off`,size:`lg`})]),F(`span`,KTe,U(z(r)(`filePreview.imageNoPreview`,{mime:e.file.mime,size:te(e.file.size)})),1)]))])):S.value===`video`?(c(),W(`div`,qTe,[pe.value?(c(),W(`video`,{key:0,src:pe.value,class:`fp-image`,controls:``,playsinline:``,preload:`metadata`},null,8,JTe)):(c(),W(`div`,YTe,[F(`span`,XTe,[v(X,{name:`image-off`,size:`lg`})]),F(`span`,ZTe,U(z(r)(`filePreview.videoNoPreview`,{mime:e.file.mime,size:te(e.file.size)})),1)]))])):S.value===`text`?(c(),W(`div`,QTe,[F(`div`,$Te,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,tEe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,nEe)],10,eEe))),128))])])):(c(),W(`div`,rEe,[F(`div`,iEe,[F(`span`,aEe,[v(X,{name:`file-off`,size:`lg`})]),F(`span`,oEe,U(z(r)(`filePreview.binaryNoPreview`,{mime:e.file.mime||z(r)(`filePreview.unknownType`),size:te(e.file.size)})),1)])]))],64)):E(``,!0)],512))}}),[[`__scopeId`,`data-v-92a41c83`]]),cEe={class:`ui-banner__icon`,"aria-hidden":`true`},lEe={class:`ui-banner__text`},t9=Y(G({__name:`Banner`,props:{variant:{default:`info`}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-banner`,`ui-banner--${e.variant}`]),role:`status`},[F(`span`,cEe,[me(t.$slots,`icon`,{},()=>[e.variant===`info`?(c(),P(X,{key:0,name:`info`,size:`md`})):(c(),P(X,{key:1,name:`alert-triangle`,size:`md`}))],!0)]),F(`span`,lEe,[me(t.$slots,`default`,{},void 0,!0)])],2))}}),[[`__scopeId`,`data-v-566a0ac8`]]),n9=Jx.global.t,uEe=40928,dEe=10485760,r9=N({open:!1,path:null,loading:!1,saving:!1,loadError:null,savingError:null,conflict:!1,dirty:!1,savedAt:null,languageId:void 0}),i9=null,a9=0,o9=null,s9={getContent:null};function c9(e){s9.getContent=e}function fEe(){return r9}function pEe(){a9+=1,r9.path=null,r9.loading=!1,r9.saving=!1,r9.loadError=null,r9.savingError=null,r9.conflict=!1,r9.dirty=!1,r9.savedAt=null,r9.languageId=void 0,i9=null,o9=null}async function l9(e){let t=vEe();if(!t){a9+=1,r9.open=!0,r9.path=e.path,r9.loading=!1,r9.loadError=n9(`editor.readOnlyWhileMissingSession`),r9.savingError=null,r9.conflict=!1,r9.dirty=!1,r9.savedAt=null,r9.languageId=void 0,r9.saving=!1,i9=null,o9=null;return}let n=++a9;r9.open=!0,r9.path=e.path,r9.loading=!0,r9.saving=!1,r9.loadError=null,r9.savingError=null,r9.conflict=!1,r9.dirty=!1,r9.savedAt=null,r9.languageId=void 0,i9=null,o9=t;try{let r=await Q().readFile(t,{path:e.path,length:dEe,encoding:`utf-8`});if(n!==a9)return;if(r.isBinary||r.encoding!==`utf-8`){r9.loadError=n9(`editor.binaryNotEditable`);return}i9=r.etag,r9.languageId=r.languageId,u9=r.content,d9=e.line,f9+=1}catch(e){if(n!==a9)return;i9=null,r9.loadError=e instanceof Error&&e.message.length>0?e.message:n9(`editor.loadFailed`)}finally{n===a9&&(r9.loading=!1)}}var u9,d9,f9=0;function mEe(){if(u9===void 0)return null;let e={content:u9,line:d9,revision:f9};return u9=void 0,d9=void 0,e}function hEe(){r9.dirty||(r9.dirty=!0,r9.savedAt=null),r9.savingError!==null&&(r9.savingError=null)}function p9(){pEe(),r9.open=!1}async function gEe(){r9.path!==null&&await l9({path:r9.path})}async function m9(e){let t=o9,n=r9.path;if(!t||!n||r9.saving||r9.loading||r9.conflict)return;let r=s9.getContent;if(!r)return;let i=++a9;r9.saving=!0,r9.savingError=null;try{let a=await Q().writeFile(t,{path:n,content:r(),...e?.force===!0||i9===null?{}:{baseEtag:i9}});if(i!==a9)return;i9=a.etag,r9.dirty=!1,r9.conflict=!1,r9.savedAt=Date.now()}catch(e){if(i!==a9)return;if(QC(e)&&e.code===uEe){r9.conflict=!0;return}r9.savingError=e instanceof Error&&e.message.length>0?e.message:n9(`editor.loadFailed`)}finally{r9.saving=!1}}async function _Ee(){r9.conflict=!1,await m9({force:!0})}function vEe(){return h9?.()??null}var h9=null;function yEe(e){h9=e}var g9=`pythinker-light`,_9=`pythinker-dark`;function bEe(e,t){let n=e.trim();if(/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(n))return n;if(/^#[0-9a-f]{3,4}$/i.test(n))return`#${Array.from(n.slice(1),e=>e+e).join(``)}`;let r=/^rgba?\(([^)]*)\)$/i.exec(n);if(r===null)return t;let i=r[1].split(/[\s,/]+/).filter(e=>e.length>0);if(i.length<3||i.length>4)return t;let a=i.slice(0,3).map(e=>v9(e,255)),o=i.length===4?v9(i[3],1):255;return a.some(e=>e===null)||o===null?t:`#${[...a,o===255?null:o].filter(e=>e!==null).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function v9(e,t){let n=e.endsWith(`%`),r=Number(n?e.slice(0,-1):e);if(!Number.isFinite(r))return null;let i=n?r/100:r/t;return Math.max(0,Math.min(255,Math.round(i*255)))}function y9(e,t){let n=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return bEe(n.length>0?n:t,t)}function xEe(){return{bg:y9(`--p-bg`,`#ffffff`),surface:y9(`--color-surface`,`#fafbfc`),text:y9(`--color-text`,`#14171c`),textMuted:y9(`--color-text-muted`,`#6b7280`),line:y9(`--color-line`,`#e7eaee`),accent:y9(`--color-accent`,`#1783ff`),accentSoft:y9(`--p-accent-soft`,`#1783ff24`),selection:y9(`--p-selection`,`#1783ff2e`),danger:y9(`--color-danger`,`#c0392b`),warning:y9(`--color-warning`,`#a9610a`),success:y9(`--color-success`,`#0e7a38`)}}function b9(e){return e.slice(1,7)}function SEe(e,t){let n=xEe();e.editor.defineTheme(t?_9:g9,{base:t?`vs-dark`:`vs`,inherit:!0,rules:[{token:`comment`,foreground:b9(n.textMuted),fontStyle:`italic`},{token:`string`,foreground:b9(n.success)},{token:`keyword`,foreground:b9(n.accent)},{token:`number`,foreground:b9(n.warning)},{token:`type`,foreground:b9(n.accent)}],colors:{"editor.background":n.bg,"editor.foreground":n.text,"editorLineNumber.foreground":n.textMuted,"editorLineNumber.activeForeground":n.text,"editor.selectionBackground":n.selection,"editor.lineHighlightBackground":n.surface,"editorCursor.foreground":n.accent,"editorIndentGuide.background1":n.line,"editorIndentGuide.activeBackground1":n.textMuted,"editorWidget.background":n.surface,"editorWidget.border":n.line,"editorError.foreground":n.danger,"editorWarning.foreground":n.warning,"scrollbarSlider.background":n.accentSoft,"scrollbarSlider.hoverBackground":n.accentSoft,"scrollbarSlider.activeBackground":n.accent}})}function x9(e,t){SEe(e,t),e.editor.setTheme(t?_9:g9)}var S9=Da(),C9=null;function CEe(){return C9??=he(()=>import(`./editor.main-cSwqhoaG.js`).then(e=>{x9(e,S9.value),s(S9,()=>x9(e,S9.value))}),__vite__mapDeps([41,2,7,42,12,43,44,45])),C9}function wEe(){return S9.value?_9:g9}function TEe(){return CEe()}var EEe={class:`monaco-pane`},DEe={key:0,class:`monaco-pane__boot`},OEe=Y(G({__name:`MonacoPane`,props:{path:{},languageId:{}},setup(e){let t=R(null),n=R(!0),r=null,i=null,a=null,o=null;function l(){window.MonacoEnvironment===void 0&&he(()=>import(`./editor.worker-Cs8mLnor.js`).then(e=>{window.MonacoEnvironment={getWorker:()=>new e.default}}),[])}function u(e){if(e!==void 0&&new Set([`typescript`,`javascript`,`json`,`css`,`html`,`markdown`,`python`,`rust`,`go`,`yaml`]).has(e))return e;if(e===`typescriptreact`||e===`javascriptreact`)return e.replace(`react`,``);if(e===`shellscript`)return`shell`}async function d(){if(r===null||i===null)return;let e=mEe(),t=f.path;if(t===null)return;let n=r.Uri.parse(`pythinker://session/${encodeURIComponent(t)}`),s=r.editor.getModel(n);if(o?.dispose(),o=null,a!==null&&a!==s&&a.dispose(),s===null)a=r.editor.createModel(e?.content??``,u(f.languageId),n);else{a=s,e!==null&&a.setValue(e.content);let t=u(f.languageId);t!==void 0&&r.editor.setModelLanguage(a,t)}o=a.onDidChangeContent(()=>hEe()),i.setModel(a),c9(()=>a?.getValue()??``),e?.line!==void 0&&e.line>0&&(i.revealLineInCenter(e.line),i.setPosition({lineNumber:e.line,column:1}))}p(async()=>{l(),await TEe(),t.value!==null&&(r=await he(()=>import(`./editor.main-cSwqhoaG.js`),__vite__mapDeps([41,2,7,42,12,43,44,45])),t.value!==null&&(i=r.editor.create(t.value,{model:null,theme:wEe(),automaticLayout:!0,fontSize:12.5,fontFamily:`"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,renderLineHighlight:`line`,padding:{top:8}}),n.value=!1,await d()))}),h(()=>{c9(null),o?.dispose(),a?.dispose(),i?.dispose(),a=null,o=null,i=null,r=null});let f=e;return s(()=>[f.path,f.languageId],async()=>{i!==null&&await d()}),(e,r)=>(c(),W(`div`,EEe,[n.value?(c(),W(`div`,DEe,[v(np,{size:`sm`})])):E(``,!0),F(`div`,{ref_key:`rootRef`,ref:t,class:`monaco-pane__host`},null,512)]))}}),[[`__scopeId`,`data-v-cb5f64f3`]]),kEe={class:`editor-panel`},AEe={class:`ed-path`},jEe={key:1,class:`ed-saved`},MEe={key:1,class:`ed-saving`},NEe={key:0,class:`editor-panel__empty`},PEe={class:`editor-panel__conflict-actions`},FEe={key:1,class:`editor-panel__save-error`},IEe=Y(G({__name:`EditorPanel`,emits:[`close`],setup(e,{emit:t}){let{t:n}=J(),r=fEe(),i=t;function a(){p9(),i(`close`)}function o(e){let t=e.split(`/`).at(-1)??e;return t.length>0?t:e}let l=L(()=>r.savedAt===null||r.dirty?!1:Date.now()-r.savedAt<2e3);function u(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),m9())}return window.addEventListener(`keydown`,u),h(()=>window.removeEventListener(`keydown`,u)),s(()=>r.open,e=>{e||i(`close`)}),(e,t)=>(c(),W(`div`,kEe,[v(e9,{wrap:``,title:z(n)(`editor.title`),closable:``,"close-label":z(n)(`editor.closeEditor`),onClose:a},{default:B(()=>[z(r).path===null?E(``,!0):(c(),W(M,{key:0},[v(vp,{text:z(r).path},{default:B(()=>[F(`span`,AEe,U(o(z(r).path)),1)]),_:1},8,[`text`]),z(r).dirty?(c(),P(vp,{key:0,text:z(n)(`editor.unsavedDot`)},{default:B(()=>[...t[3]||=[F(`span`,{class:`ed-dirty`},null,-1)]]),_:1},8,[`text`])):E(``,!0),l.value?(c(),W(`span`,jEe,U(z(n)(`editor.saved`)),1)):E(``,!0)],64)),z(r).path!==null&&z(r).loadError===null?(c(),W(M,{key:1},[z(r).conflict?E(``,!0):(c(),P(Ca,{key:0,size:`sm`,label:z(n)(`editor.save`),disabled:!z(r).dirty||z(r).saving,onClick:t[0]||=e=>z(m9)()},{default:B(()=>[v(X,{name:`check`,size:`sm`})]),_:1},8,[`label`,`disabled`])),z(r).saving?(c(),W(`span`,MEe,[v(np,{size:`sm`})])):E(``,!0)],64)):E(``,!0)]),_:1},8,[`title`,`close-label`]),z(r).loadError===null?(c(),W(M,{key:1},[z(r).conflict?(c(),P(t9,{key:0,variant:`warning`,class:`editor-panel__conflict`},{default:B(()=>[F(`span`,null,U(z(n)(`editor.conflictText`)),1),F(`span`,PEe,[v(YT,{variant:`secondary`,size:`sm`,onClick:t[1]||=e=>z(gEe)()},{default:B(()=>[K(U(z(n)(`editor.conflictReload`)),1)]),_:1}),v(YT,{variant:`danger`,size:`sm`,disabled:z(r).saving,onClick:t[2]||=e=>z(_Ee)()},{default:B(()=>[K(U(z(n)(`editor.conflictOverwrite`)),1)]),_:1},8,[`disabled`])])]),_:1})):E(``,!0),z(r).savingError===null?E(``,!0):(c(),W(`p`,FEe,U(z(r).savingError),1)),z(r).path===null?E(``,!0):(c(),P(OEe,{key:2,path:z(r).path,"language-id":z(r).languageId},null,8,[`path`,`language-id`]))],64)):(c(),W(`div`,NEe,[v(Qw,null,{default:B(()=>[F(`span`,null,U(z(r).loadError),1),v(YT,{variant:`secondary`,size:`sm`,onClick:a},{default:B(()=>[K(U(z(n)(`filePreview.close`)),1)]),_:1})]),_:1})]))]))}}),[[`__scopeId`,`data-v-579cb4a1`]]),LEe={class:`tp`},REe=Y(G({__name:`ThinkingPanel`,props:{text:{},subtitle:{}},emits:[`close`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null);return s(()=>r.text,()=>{let e=o.value;e&&e.scrollHeight-e.scrollTop-e.clientHeight<24&&n(()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight)})},{immediate:!0}),(t,n)=>(c(),W(`div`,LEe,[v(e9,{title:z(a)(`common.preview`),subtitle:e.subtitle??z(a)(`thinking.panelTitle`),"close-label":z(a)(`thinking.close`),onClose:n[0]||=e=>i(`close`)},null,8,[`title`,`subtitle`,`close-label`]),F(`pre`,{ref_key:`bodyEl`,ref:o,class:`tp-body`},U(e.text),513)]))}}),[[`__scopeId`,`data-v-e1ad626c`]]),zEe={class:`agent-panel`},BEe={key:0,class:`agent-meta`},VEe={class:`agent-meta-text`},HEe={key:1,class:`agent-prompt`},UEe={class:`agent-prompt-bubble`},WEe=[`aria-expanded`],GEe={class:`agent-transcript-inner`},KEe={key:0,class:`agent-fallback`},qEe={key:0,class:`agent-error`},JEe={key:1,class:`fallback-lines`},YEe=Y(G({__name:`AgentDetailPanel`,props:{member:{},turns:{},running:{type:Boolean},loading:{type:Boolean},loadError:{type:Boolean},hasMore:{type:Boolean},loadingMore:{type:Boolean},loadMoreError:{type:Boolean}},emits:[`close`,`loadOlderMessages`,`openAgent`,`openFile`,`openMedia`,`openTurnDiff`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=a6(),l=L(()=>o.value?`lg`:`sm`),u=R(null),f=R(null),p=R(!0),g=R(!1),_=null,y=0,b=L(()=>{let e=new Set,t=[],n=r.member.prompt?.trim(),i=n?`$ ${n}`:void 0;for(let n of[r.member.prompt,r.member.suspendedReason,r.member.text,r.member.outputLines?.join(` +`)}function A(){i.planArmed||i.planMode||(i.goalMode&&o(`toggleGoal`),o(`togglePlan`))}function j(){if(wn.value){o(`focusGoal`);return}i.goalMode||((i.planArmed||i.planMode)&&o(`togglePlan`),o(`toggleGoal`))}let N=R(!1);function I(){N.value=!N.value,n(()=>{b(),se(),y.value?.focus()})}function te(){N.value&&(N.value=!1,n(b))}function ne(e){if(typeof getComputedStyle>`u`)return I7;let t=Number.parseFloat(getComputedStyle(e).minHeight);return Number.isFinite(t)&&t>0?t:I7}let re=R(!1);function se(){let e=y.value;re.value=!!e&&e.scrollHeight>ne(e)}s(g,()=>{n(se)}),s(()=>i.sessionId,()=>{N.value=!1,ue.value=!1,me.value=!1,C.value=[]});let ce=Ype({text:g,textareaRef:y,autosize:b,sessionId:()=>i.sessionId});function le(e){if(e===`/plan`){A();return}if(e===`/goal`){j();return}if(e===`/discussion`||e===`/expert-talk`||e===`/expert-opinion`){ir();return}o(`command`,e)}let{open:ue,items:fe,active:G,update:K,select:pe}=Xpe({text:g,textareaRef:y,autosize:b,skills:()=>i.skills,emitCommand:le,historyPush:e=>ce.push(e),clearDraft:S}),{open:me,items:he,active:ge,loading:_e,stale:ve,update:ye,select:be,complete:xe,close:Se,getMentionToken:Ce}=Zpe({text:g,textareaRef:y,autosize:b,searchFiles:()=>i.searchFiles}),we=R(null),Te=R(null),Ee=R(null);function De(e){y.value?.setSelectionRange(e,e)}let Oe=L({get:()=>g.value.startsWith(`/`)?g.value.slice(1):g.value,set:e=>{g.value=`/${e}`,n(()=>{De(g.value.length),K()})}}),ke=L({get:()=>{let e=Ee.value;return e?g.value.slice(e.start+1,e.end):``},set:e=>{let t=Ee.value;if(!t)return;g.value=`${g.value.slice(0,t.start)}@${e}${g.value.slice(t.end)}`;let r=t.start+e.length+1;Ee.value={start:t.start,end:r},n(()=>{De(r),ye()})}});s([ue,f],async([e,t])=>{!e||!t||(await n(),we.value?.focus())}),s([me,f],async([e,t])=>{!e||!t||(Ee.value=Ce(),await n(),Te.value?.focus())});function Ae(){ue.value=!1,y.value?.focus()}function je(e){e||Ae()}function Me(){Se(),Ee.value=null,y.value?.focus()}function q(e){e||Me()}function Ne(){ce.resetBrowsing(),K(),ye()}let{attachments:Pe,previewAttachment:Fe,fileInputRef:Ie,isDragOver:Le,removeAttachment:Re,reorderAttachment:ze,mediaLabel:Be,openAttachmentPreview:Ve,closeAttachmentPreview:He,openFilePicker:Ue,handleFileInputChange:We,handleDragOver:Ge,handleDragLeave:Ke,handleDrop:qe,clearAfterSubmit:Je,loadAttachments:Ye}=$pe({uploadImage:()=>i.uploadImage,sessionId:()=>i.sessionId});function Xe(){let e=Pe.value.map(e=>e.localId);for(let t of e)Re(t)}let Ze=L(()=>Pe.value.filter(e=>e.kind!==`file`)),Qe=L(()=>Pe.value.filter(e=>e.kind===`file`));function $e(e){let t=Be(e),r=y.value,i=r?.selectionStart??g.value.length,a=r?.selectionEnd??i,o=g.value.slice(0,i),s=g.value.slice(a),c=o.length>0&&!/\s$/.test(o),l=s.length>0&&!/^\s/.test(s),u=`${c?` `:``}${t}${l?` `:``}`;g.value=`${o}${u}${s}`,n(()=>{De(i+u.length),r?.focus(),b()})}function et(e,t){let n=Pe.value.findIndex(t=>t.localId===e.localId);n<0||ze(e.localId,n+t)}let tt=R(null);function nt(e,t){tt.value=e.localId,t.dataTransfer?.setData(`text/plain`,e.localId),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)}function rt(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`)}function it(e,t){t.preventDefault();let n=t.dataTransfer?.getData(`text/plain`)||tt.value;if(tt.value=null,!n||n===e.localId)return;let r=Pe.value.findIndex(t=>t.localId===e.localId);r<0||ze(n,r)}function at(){tt.value=null}let ot=R(null),st=R(null),ct=R(!1),lt=null;function ut(){let e=ot.value;ct.value=e!==null&&e.scrollHeight>e.clientHeight+1}s(ot,e=>{lt?.disconnect(),lt=null,e&&typeof ResizeObserver==`function`&&(lt=new ResizeObserver(ut),lt.observe(e)),ut()},{immediate:!0}),s(Pe,()=>void n(ut),{deep:!0}),s(()=>[Ze.value.length,Qe.value.length],([e,t],[r,i])=>{e<=r&&t<=i||n(()=>{let t=ot.value;t&&(t.scrollTop=e>r&&st.value?st.value.offsetHeight-t.clientHeight:t.scrollHeight)})}),p(()=>{g.value&&n(()=>{b(),se()})}),h(()=>{document.removeEventListener(`click`,tn,!0),lt?.disconnect(),Kn?.disconnect(),kn?.disconnect(),St()});function dt(){y.value?.focus({preventScroll:!0})}function ft(e){Ye(e)}t({loadForEdit:x,loadAttachmentsForEdit:ft,insertQuote:D,focus:dt,anyPopupOpen:L(()=>ue.value||me.value||Mt.value||Nt.value||Pt.value||Vn.value),isEmpty:L(()=>g.value.trim().length===0&&Pe.value.length===0&&C.value.length===0)});let pt=R(null),mt=null;function ht(e){pt.value=u(`composer.noArgCommand`,{cmd:e}),mt!==null&&clearTimeout(mt),mt=setTimeout(()=>{pt.value=null,mt=null},3e3)}h(()=>{mt!==null&&clearTimeout(mt)});function gt(e){return{fileId:e.fileId,kind:e.kind,name:e.name,mediaType:e.mediaType,size:e.size}}function _t(e){if(e.kind===`file`){e.fileId!==void 0&&q4(e.fileId,e.name,e.mediaType);return}Ve(e)}function vt(){let e=g.value.trim(),t=k(e);if(Pe.value.some(e=>e.uploading))return;let n=Pe.value.filter(e=>!e.uploading&&!e.error&&e.fileId);if(!t&&n.length===0)return;if(C.value.length===0&&e===`/plan`){ce.push(e),g.value=``,S(),ue.value=!1,te(),A();return}if(C.value.length===0&&e===`/goal`){ce.push(e),g.value=``,S(),ue.value=!1,te(),j();return}if(C.value.length===0&&e){let t=Vpe(e),n=t===null?``:t.cmd===`/expert-talk`||t.cmd===`/expert-opinion`?`/discussion`:t.cmd,r=t?J3(i.skills).find(e=>e.name===n||e.name===`/skill:${n.slice(1)}`):void 0;if(t&&r){if(t.arg.trim()&&r.acceptsInput!==!0){ht(t.cmd);return}ce.push(e),g.value=``,S(),ue.value=!1,te(),le(t.arg?`${n} ${t.arg}`:n);return}}e&&ce.push(e);let r={text:t,attachments:n.map(e=>gt(e))};Fe.value=null,Je(),g.value=``,C.value=[],S(),ue.value=!1,me.value=!1,te(),o(`submit`,r)}function yt(){if(!i.running||Pe.value.some(e=>e.uploading))return;let e=g.value.trim(),t=k(e),n=Pe.value.filter(e=>!e.uploading&&!e.error&&e.fileId);if(!t&&n.length===0&&i.queued.length===0)return;let r={text:t,attachments:n.map(e=>gt(e))};Je(),e&&ce.push(e),g.value=``,C.value=[],S(),ue.value=!1,me.value=!1,te(),o(`steer`,r)}let bt=!1,xt=null;function St(){xt!==null&&(clearTimeout(xt),xt=null)}function Ct(){St(),bt=!0}function wt(){St(),xt=setTimeout(()=>{xt=null,bt=!1},0)}function Tt(e){return bt||e.isComposing||e.keyCode===229}function Et(e){if(!Tt(e)){if(Tn.value&&e.key===`Backspace`&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=y.value;if(t&&t.selectionStart===0&&t.selectionEnd===0){e.preventDefault(),An();return}}if(e.key===`Escape`){if(Vn.value){e.preventDefault(),Yn();return}if(Mt.value){e.preventDefault(),Zt();return}if(Nt.value){e.preventDefault(),Xt();return}if(Pt.value){e.preventDefault(),$t();return}}if(ue.value){if(e.key===`Escape`){e.preventDefault(),ue.value=!1;return}if(e.key===`Tab`&&fe.value.length===0){ue.value=!1;return}if(e.key===`ArrowDown`){e.preventDefault(),G.value=(G.value+1)%fe.value.length;return}if(e.key===`ArrowUp`){e.preventDefault(),G.value=(G.value-1+fe.value.length)%fe.value.length;return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=fe.value[G.value];t&&pe(t);return}}if(me.value&&!_e.value){if(e.key===`ArrowDown`){e.preventDefault(),ge.value=(ge.value+1)%Math.max(1,he.value.length);return}if(e.key===`ArrowUp`){e.preventDefault(),ge.value=(ge.value-1+Math.max(1,he.value.length))%Math.max(1,he.value.length);return}if(e.key===`Tab`){e.preventDefault();let t=he.value[ge.value];t&&xe(t);return}if(e.key===`Enter`){e.preventDefault();let t=he.value[ge.value];t&&be(t);return}if(e.key===`Escape`){e.preventDefault(),me.value=!1;return}}if(e.key===`Escape`&&Fn.value?.cancelActive()){e.preventDefault();return}if(e.key===`s`&&(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){i.running&&(e.preventDefault(),yt());return}if(!N.value&&!ue.value&&!me.value&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=ce.isBrowsing();if(e.key===`ArrowUp`&&ce.hasHistory()&&(t||ce.caretAtTextStart())){e.preventDefault(),ce.recallOlder(),ue.value=!1;return}if(e.key===`ArrowDown`&&t){e.preventDefault(),ce.recallNewer(),ue.value=!1;return}}if(e.key===`Enter`&&!e.shiftKey){if(N.value&&!(e.metaKey||e.ctrlKey))return;e.preventDefault(),vt()}}}let Dt=L(()=>u(`composer.send`)),Ot=L(()=>!!i.uploadImage),kt=L(()=>!Pe.value.some(e=>e.uploading)&&(g.value.trim()!==``||C.value.length>0||Pe.value.some(e=>!e.error&&e.fileId))),At=L(()=>{if(ue.value)return`composer-slash-menu`;if(me.value)return`composer-mention-menu`}),jt=L(()=>{if(ue.value&&fe.value.length>0)return`composer-slash-option-${G.value}`;if(me.value&&he.value.length>0)return`composer-mention-option-${ge.value}`}),Mt=R(!1),Nt=R(!1),Pt=R(!1),Ft=R(null),It=R(null),Lt=R(null),Rt=R(null),zt=R(null),Bt=R(null),Vt=R(null),Ht=R(null);pp(Bt),pp(Vt),pp(Ht);let Ut=R(``),Wt=R(``),Gt=R(``),Kt=R(``),qt=R(!1);function Jt(){Mt.value=!Mt.value,Mt.value&&(rn(),Nt.value=!1,Pt.value=!1,Yn(),ue.value=!1,me.value=!1,document.addEventListener(`click`,tn,!0))}function Yt(){mn.value||(Nt.value=!Nt.value,Nt.value&&(an(),Mt.value=!1,Pt.value=!1,Yn(),ue.value=!1,me.value=!1,document.addEventListener(`click`,tn,!0)))}function Xt(){Nt.value=!1,en()}function Zt(){Mt.value=!1,en()}function Qt(){Pt.value=!Pt.value,Pt.value&&(nn(),Mt.value=!1,Nt.value=!1,Yn(),ue.value=!1,me.value=!1,document.addEventListener(`click`,tn,!0))}function $t(){Pt.value=!1,en()}function en(){!Mt.value&&!Nt.value&&!Pt.value&&!Vn.value&&document.removeEventListener(`click`,tn,!0)}function tn(e){let t=e.target;Ft.value?.contains(t)||Hn.value?.contains(t)||Un.value?.contains(t)||(Zt(),Xt(),$t(),Yn())}function nn(){let e=It.value,t=Ft.value;Ut.value=e&&t?`${Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}px`:``}function rn(){let e=Lt.value,t=Ft.value;Wt.value=e&&t?`${Math.round(t.getBoundingClientRect().right-e.getBoundingClientRect().right)}px`:``}function an(){let e=Rt.value,t=Ft.value;Gt.value=e&&t?`${Math.round(t.getBoundingClientRect().right-e.getBoundingClientRect().right)}px`:``}let on=L(()=>{let e=i.status?.ctxMax??0;return e<=0?0:Math.min(100,Math.max(0,Math.ceil((i.status?.ctxUsed??0)/e*100)))}),sn=L(()=>u(`status.ctxTooltip`,{used:yO(i.status?.ctxUsed??0),max:yO(i.status?.ctxMax??0),pct:on.value})),cn=L(()=>on.value>=80),ln=L(()=>i.models?.find(e=>e.id===i.status?.modelId)),un=L(()=>Y3(ln.value)),dn=L(()=>Q3(ln.value)),fn=L(()=>n6(ln.value,i.thinking)),pn=L(()=>dn.value.includes(fn.value)?fn.value:``),mn=L(()=>un.value===`unsupported`||dn.value.length<=1),hn=L(()=>{let e=(ln.value?.supportEfforts?.length??0)>0,t=fn.value;return e&&t!==`on`&&t!==`off`?$3(t):vn(t)}),gn=L(()=>u(`composer.thinkingControl`,{level:hn.value}));function _n(e){mn.value||(o(`setThinking`,t6(ln.value,e)),Xt())}function vn(e){return e===`on`?u(`status.thinkingOn`):e===`off`?u(`status.thinkingOff`):$3(e)}let yn=L(()=>dn.value.map(e=>({value:e,label:vn(e)}))),bn=L(()=>i.planArmed===!0||i.planMode===!0),xn=L(()=>i.workflowActive===!0),Sn=L(()=>i.towerMode===!0),Cn=L(()=>i.goal?.status??i.activationBadges?.goal?.status??null),wn=L(()=>Cn.value!==null&&Cn.value!==`complete`),Tn=L(()=>i.goalMode?`goal`:i.towerMode?`tower`:i.planArmed?`plan`:null),En=R(null),Dn=R(``),On=L(()=>Dn.value?{textIndent:Dn.value}:void 0),kn=null;function An(){Tn.value===`goal`?o(`toggleGoal`):Tn.value===`tower`?o(`toggleTower`):Tn.value===`plan`&&o(`togglePlan`)}function jn(e){return e===`goal`?`target`:e===`tower`?`git-fork`:`file-edit`}function Mn(e){return u(e===`goal`?`status.goalLabel`:e===`tower`?`status.towerLabel`:`status.planLabel`)}function Nn(){let e=En.value;Dn.value=e?`calc(${e.offsetWidth}px + var(--space-1-5) - var(--space-05))`:``}s(Tn,async e=>{if(kn?.disconnect(),kn=null,!e){Dn.value=``;return}await n(),Nn(),typeof ResizeObserver==`function`&&En.value&&(kn=new ResizeObserver(Nn),kn.observe(En.value))},{immediate:!0});let Pn=R(null),Fn=R(null),In=m(D7,void 0),Ln=L(()=>In?.status.value?.activation.state===`armed`||In?.run.value?.state===`running`),Rn=L(()=>Ln.value?u(`expertTalk.title`):i.status?.model??``);s(Ln,e=>{e&&Zt()});function zn(e){x(u(`expertTalk.buildPrompt`,{answer:e})),vt()}function Bn(){if(Ln.value){Fn.value?.openDialog();return}Jt()}let Vn=R(!1),Hn=R(null),Un=R(null);pp(Hn),pp(Un);let Wn=R(null),Gn=R(null),Kn=null,qn=L(()=>{let e=[];return Ot.value&&e.push({id:`files`,icon:`attachment`,nameKey:`composer.addFiles`,action:er}),f.value&&e.push({id:`slash`,icon:`terminal`,nameKey:`composer.addSlash`,descKey:`composer.addSlashDesc`,action:tr},{id:`mention`,icon:`link`,nameKey:`composer.addMention`,descKey:`composer.addMentionDesc`,action:nr}),e.push({id:`capabilities`,icon:`sliders`,nameKey:`capabilityMenu.trigger`,action:rr},...Fn.value?.available?[{id:`expertOpinion`,icon:`sparkles`,nameKey:`expertTalk.title`,descKey:`composer.addExpertOpinionDesc`,action:ir}]:[],{id:`goal`,icon:`target`,nameKey:`status.goalLabel`,descKey:`composer.addGoalDesc`,action:ar},{id:`plan`,icon:`file-edit`,nameKey:`status.planLabel`,descKey:`composer.addPlanDesc`,action:or},...i.towerAvailable?[{id:`tower`,icon:`git-fork`,nameKey:`status.towerLabel`,descKey:`composer.addTowerDesc`,action:sr}]:[],{id:`workflow`,icon:`sparkles`,nameKey:`status.dynamicWorkflowLabel`,descKey:`composer.addWorkflowDesc`,action:cr}),e});function Jn(){let e=Wn.value;if(!e||e.scrollHeight<=e.clientHeight+1){Gn.value=null;return}let t=getComputedStyle(e),n=Number.parseFloat(t.getPropertyValue(`--menu-scrollbar-track-inset`))||0,r=Number.parseFloat(t.getPropertyValue(`--menu-scrollbar-thumb-min`))||24,i=e.clientHeight-n*2,a=Math.max(r,e.clientHeight/e.scrollHeight*i),o=e.scrollHeight-e.clientHeight;Gn.value={top:e.offsetTop+n+e.scrollTop/o*(i-a),height:a}}s(Vn,async e=>{Kn?.disconnect(),Kn=null,Gn.value=null,e&&(await n(),Jn(),typeof ResizeObserver==`function`&&Wn.value&&(Kn=new ResizeObserver(Jn),Kn.observe(Wn.value)))});function Yn(){Vn.value=!1,en()}function Xn(e){e||Yn()}function Zn(){if(Vn.value){Yn();return}Zt(),Xt(),$t(),ue.value=!1,me.value=!1,Vn.value=!0,document.addEventListener(`click`,tn,!0),n(()=>{(f.value?Un.value:Hn.value)?.querySelector(`.am-row`)?.focus()})}function Qn(e){e.action(),f.value&&e.id===`files`||y.value?.focus()}function $n(e){if(e.key===`Escape`){e.preventDefault(),Yn(),y.value?.focus();return}if(e.key===`Tab`){Yn();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=f.value?Un.value:Hn.value,n=Array.from(t?.querySelectorAll(`.am-row`)??[]);if(n.length===0)return;let r=n.indexOf(document.activeElement);n[e.key===`ArrowDown`?(r+1)%n.length:(r-1+n.length)%n.length]?.focus()}function er(){Yn(),Ue()}function tr(){Yn(),g.value=`/`,n(()=>{De(1),K()})}function nr(){Yn(),g.value=`@`,n(()=>{De(1),ye()})}function rr(){Yn(),Pn.value?.toggleOpen()}function ir(){Yn(),Fn.value?.activate()}function ar(){Yn(),i.goalMode||j()}function or(){Yn(),Sn.value&&o(`toggleTower`),bn.value||A()}function sr(){Yn(),bn.value&&o(`togglePlan`),Sn.value||o(`toggleTower`)}function cr(){Yn(),xn.value||o(`toggleWorkflow`)}let lr=[{mode:`manual`,icon:`fingerprint`,color:`var(--color-text)`,labelKey:`status.permissionManual`,descKey:`status.permissionManualDesc`},{mode:`yolo`,icon:`shield-question`,color:`var(--color-warning)`,labelKey:`status.permissionYolo`,descKey:`status.permissionYoloDesc`},{mode:`auto`,icon:`full-access`,color:`var(--color-danger)`,labelKey:`status.permissionAuto`,descKey:`status.permissionAutoDesc`}],ur=R(null),dr=R(``);function fr(e){let t={};return e&&(t[`--composer-menu-desc-width`]=e),t}let pr=L(()=>{let e=fr(dr.value);return Ut.value&&(e.left=Ut.value),e}),mr=L(()=>{let e={};return Wt.value&&(e.right=Wt.value),Kt.value&&(e.maxHeight=Kt.value),e}),hr=L(()=>{let e={};return Gt.value&&(e.right=Gt.value),e}),gr=null;function _r(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function vr(e){return`${e.fontStyle||`normal`} ${e.fontWeight||`400`} ${e.fontSize} ${e.fontFamily}`}function yr(e){return e.letterSpacing===`normal`?0:_r(e.letterSpacing)}function br(e,t){return e?vpe(gpe(e,vr(t),{letterSpacing:yr(t)})):0}function xr(){let e=ur.value?.querySelector(`.pd-desc`);if(!e)return;let t=getComputedStyle(e),n=Math.max(0,...lr.map(e=>br(u(e.descKey),t)));dr.value=n>0?`${Math.ceil(n)}px`:``}function Sr(){typeof window>`u`||(gr!==null&&window.cancelAnimationFrame(gr),n(()=>{gr=window.requestAnimationFrame(()=>{gr=null,xr()})}))}s(d,Sr,{immediate:!0}),p(()=>{Sr(),document.fonts?.ready.then(Sr)}),h(()=>{gr!==null&&(window.cancelAnimationFrame(gr),gr=null)});function Cr(e){o(`setPermission`,e),$t()}let wr=L(()=>lr.find(e=>e.mode===i.status?.permission)),Tr=L(()=>wr.value?u(wr.value.labelKey):``),Er=L(()=>wr.value?.icon??`fingerprint`),Dr=R(!1),Or=R(!1),kr=R(!1),Ar=R(!1),jr=0,Mr=0,Nr=0,Pr=0,Fr=R(null),Ir=null;function Lr(e,t,n){let r=e.getPropertyValue(t).trim(),i=Number.parseFloat(r);return Number.isFinite(i)?r.endsWith(`em`)?i*Number.parseFloat(e.fontSize):i:n}function Rr(e){return e.scrollWidth>e.clientWidth+1||e.clientWidth===0&&(e.textContent?.length??0)>0}function zr(e){let t=e.getBoundingClientRect().left;for(let n of e.querySelectorAll(`.compact-chip, .ctx-group, .model-pill, .stop, .send`)){let e=n.getBoundingClientRect();if(e.width>0&&e.leftPr+i&&(Ar.value=!1,n(Br));return}if(kr.value){if(a>Nr+i){kr.value=!1,n(Br);return}o&&zr(o)&&(Pr=a,Ar.value=!0,n(Br));return}if(Or.value){if(a>Mr+i){Or.value=!1,n(Br);return}o&&zr(o)&&(cn.value?(Nr=a,kr.value=!0):(Pr=a,Ar.value=!0),n(Br));return}if(Dr.value&&a>jr+i){Dr.value=!1,n(Br);return}let s=zt.value;!s||!Rr(s)||s.getBoundingClientRect().width>=r||(Dr.value?(Mr=a,Or.value=!0):(jr=a,Dr.value=!0),n(Br))}p(()=>{typeof ResizeObserver==`function`&&Ft.value&&(Ir=new ResizeObserver(Br),Ir.observe(Ft.value)),document.fonts?.ready.then(Br)}),s([Tr,xn,cn,hn,()=>i.status?.model,()=>i.working,d],()=>{Dr.value=!1,Or.value=!1,kr.value=!1,Ar.value=!1,n(Br)}),h(()=>{Ir?.disconnect(),Ir=null});let Vr=L(()=>ln.value?.provider??``),Hr=L(()=>!Vr.value||!i.models?.length?[]:i.models.filter(e=>e.provider===Vr.value)),Ur=L(()=>new Set(i.starredIds??[]));function Wr(e){return Ur.value.has(e)}let Gr=L(()=>i.models?.length?i.models.filter(e=>Wr(e.id)&&e.provider!==Vr.value):[]);function Kr(){let e=Bt.value,t=Ft.value;if(!e||!t)return;let n=getComputedStyle(e),r=_r(n.getPropertyValue(`--space-1`))||4,i=_r(n.getPropertyValue(`--space-2`))||8,a=window.visualViewport,o=a?.offsetTop??0,s=o+(a?.height??window.innerHeight),c=t.getBoundingClientRect(),l=c.top-o-r-i,u=s-c.bottom-r-i;e.offsetHeight>l&&u>l?(qt.value=!0,Kt.value=`${Math.max(Math.floor(u),0)}px`):(qt.value=!1,Kt.value=`${Math.max(Math.floor(l),0)}px`)}function qr(){Zt()}function Jr(){window.addEventListener(`resize`,qr),window.visualViewport?.addEventListener(`resize`,qr),window.visualViewport?.addEventListener(`scroll`,qr)}function Yr(){window.removeEventListener(`resize`,qr),window.visualViewport?.removeEventListener(`resize`,qr),window.visualViewport?.removeEventListener(`scroll`,qr)}s(Mt,async e=>{if(!e){Yr();return}Jr(),qt.value=!1,Kt.value=``,await n(),Kr(),(Bt.value?.querySelector(`.md-row.is-current`)??Bt.value?.querySelector(`.md-row`))?.focus()}),h(Yr);function Xr(e){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(Bt.value?.querySelectorAll(`.md-row:not(:disabled)`)??[]);if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}function Zr(e){o(`selectModel`,e),Zt()}return(t,n)=>(c(),W(`div`,{class:V([`composer`,{"drag-over":z(Le),expanded:N.value}]),onDragover:n[27]||=(...e)=>z(Ge)&&z(Ge)(...e),onDragleave:n[28]||=(...e)=>z(Ke)&&z(Ke)(...e),onDrop:n[29]||=(...e)=>z(qe)&&z(qe)(...e)},[z(Fe)?(c(),W(`div`,{key:0,class:`att-lightbox`,onClick:n[1]||=H((...e)=>z(He)&&z(He)(...e),[`self`])},[F(`div`,Nbe,[v(Sp,{text:z(u)(`model.close`)},{default:B(()=>[F(`button`,{type:`button`,class:`att-lightbox-close`,onClick:n[0]||=(...e)=>z(He)&&z(He)(...e)},`✕`)]),_:1},8,[`text`]),z(Fe).kind===`video`?(c(),W(`video`,{key:0,class:`att-lightbox-media`,src:z(Fe).previewUrl,controls:``,playsinline:``},null,8,Pbe)):(c(),W(`img`,{key:1,class:`att-lightbox-media`,src:z(Fe).previewUrl,alt:z(Fe).name},null,8,Fbe)),F(`div`,Ibe,U(z(Fe).name),1)])])):E(``,!0),F(`div`,{class:V([`composer-card`,{"labels-collapsed":Dr.value}])},[C.value.length>0?(c(),W(`div`,{key:0,class:`quote-strip`,"aria-label":z(u)(`selection.quoteLabel`)},[(c(!0),W(M,null,_(C.value,e=>(c(),W(`div`,{key:e.id,class:`quote-chip`},[F(`span`,Rbe,[e.source?(c(),W(`span`,zbe,U(e.source),1)):E(``,!0),F(`span`,Bbe,U(e.text),1),e.comment?(c(),W(`span`,Vbe,U(e.comment),1)):E(``,!0)]),v(Ca,{size:`sm`,label:z(u)(`composer.removeNamed`,{name:e.text}),onClick:t=>O(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`onClick`])]))),128))],8,Lbe)):E(``,!0),z(Pe).length>0?(c(),W(`div`,Hbe,[F(`div`,{ref_key:`attachmentScrollRef`,ref:ot,class:V([`att-scroll`,{"is-overflowing":ct.value}])},[F(`div`,Ube,[Ze.value.length>0?(c(),W(`div`,{key:0,ref_key:`attachmentMediaRowRef`,ref:st,class:`att-row att-row-media`,role:`list`,"aria-label":z(u)(`composer.mediaAttachments`)},[(c(!0),W(M,null,_(Ze.value,e=>(c(),P(F4,{key:e.localId,kind:e.kind,name:z(Be)(e),url:e.previewUrl,"file-id":e.fileId,"media-type":e.mediaType,size:e.size,ordinal:e.mediaOrdinal,uploading:e.uploading,error:e.error,mentionable:``,reorderable:``,dragging:tt.value===e.localId,removable:``,"mention-label":z(u)(`composer.mentionNamed`,{name:z(Be)(e)}),"remove-label":z(u)(`composer.removeNamed`,{name:z(Be)(e)}),onActivate:t=>_t(e),onMention:t=>$e(e),onReorderStep:t=>et(e,t),onDragStart:t=>nt(e,t),onDragOver:rt,onDrop:t=>it(e,t),onDragEnd:at,onRemove:t=>z(Re)(e.localId)},null,8,[`kind`,`name`,`url`,`file-id`,`media-type`,`size`,`ordinal`,`uploading`,`error`,`dragging`,`mention-label`,`remove-label`,`onActivate`,`onMention`,`onReorderStep`,`onDragStart`,`onDrop`,`onRemove`]))),128))],8,Wbe)):E(``,!0),Qe.value.length>0?(c(),W(`div`,Gbe,[(c(!0),W(M,null,_(Qe.value,e=>(c(),P(F4,{key:e.localId,kind:`file`,name:e.name,"media-type":e.mediaType,size:e.size,uploading:e.uploading,error:e.error,removable:``,"remove-label":z(u)(`composer.removeNamed`,{name:e.name}),onActivate:t=>_t(e),onRemove:t=>z(Re)(e.localId)},null,8,[`name`,`media-type`,`size`,`uploading`,`error`,`remove-label`,`onActivate`,`onRemove`]))),128))])):E(``,!0)])],2),ct.value?(c(),W(`span`,Kbe,U(z(u)(`composer.attachmentCount`,{n:z(Pe).length})),1)):E(``,!0),z(Pe).length>=2?(c(),P(Sp,{key:1,text:z(u)(`composer.clearAll`)},{default:B(()=>[v(Ca,{class:`att-clear`,size:`sm`,label:z(u)(`composer.clearAll`),onClick:Xe},{default:B(()=>[v(X,{name:`trash`})]),_:1},8,[`label`])]),_:1},8,[`text`])):E(``,!0)])):E(``,!0),F(`div`,qbe,[v(A7,{models:e.models,trigger:`widget`},null,8,[`models`])]),F(`div`,Jbe,[z(ue)&&!z(f)?(c(),P(G3,{key:0,id:`composer-slash-menu`,items:z(fe),"active-index":z(G),onSelect:z(pe),onHover:n[2]||=e=>G.value=e},null,8,[`items`,`active-index`,`onSelect`])):E(``,!0),z(me)&&!z(f)?(c(),P(K3,{key:1,id:`composer-mention-menu`,items:z(he),"active-index":z(ge),loading:z(_e),stale:z(ve),onSelect:z(be),onHover:n[3]||=e=>ge.value=e},null,8,[`items`,`active-index`,`loading`,`stale`,`onSelect`])):E(``,!0),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Vn.value&&!z(f)?(c(),W(`div`,{key:0,ref_key:`modesMenuRef`,ref:Hn,class:`add-menu`,onClick:n[5]||=H(()=>{},[`stop`]),onKeydown:$n},[F(`div`,{ref_key:`addMenuScrollRef`,ref:Wn,class:`am-scroll`,role:`menu`,onScroll:Jn},[(c(!0),W(M,null,_(qn.value,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`am-row`,role:`menuitem`,onMousedown:n[4]||=H(()=>{},[`prevent`]),onClick:t=>Qn(e)},[F(`span`,Xbe,[v(X,{name:e.icon,size:`sm`},null,8,[`name`])]),F(`span`,Zbe,U(z(u)(e.nameKey)),1),e.descKey?(c(),W(`span`,Qbe,U(z(u)(e.descKey)),1)):E(``,!0)],40,Ybe))),128))],544),Gn.value?(c(),W(`div`,{key:0,class:`scroll-thumb`,style:ae({top:`${Gn.value.top}px`,height:`${Gn.value.height}px`})},null,4)):E(``,!0)],544)):E(``,!0)]),_:1}),F(`div`,$be,[Tn.value?(c(),W(`span`,{key:0,ref_key:`workModePillRef`,ref:En,class:`wm-pill`},[v(X,{name:jn(Tn.value),size:`sm`},null,8,[`name`]),F(`span`,null,U(Mn(Tn.value)),1),v(Ca,{class:`wm-x`,size:`sm`,label:z(u)(`status.workModeDismiss`),onMousedown:n[6]||=H(()=>{},[`prevent`]),onClick:An},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])],512)):E(``,!0),l(F(`textarea`,{ref_key:`textareaRef`,ref:y,"onUpdate:modelValue":n[7]||=e=>T(g)?g.value=e:null,class:`ph`,style:ae(On.value),placeholder:a.value,disabled:e.starting,autocomplete:`off`,spellcheck:`false`,rows:`1`,role:`combobox`,"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-expanded":!!At.value,"aria-controls":At.value,"aria-activedescendant":jt.value,onKeydown:Et,onCompositionstart:Ct,onCompositionend:wt,onInput:Ne,onBlur:n[8]||=e=>{z(f)||(ue.value=!1,me.value=!1)}},null,44,exe),[[de,z(g)]]),v(Sp,{text:N.value?z(u)(`composer.collapseTitle`):z(u)(`composer.expandTitle`)},{default:B(()=>[N.value||re.value?(c(),W(`button`,{key:0,class:`expand-btn`,type:`button`,"aria-label":N.value?z(u)(`composer.collapseTitle`):z(u)(`composer.expandTitle`),onClick:I},[N.value?(c(),P(X,{key:0,name:`collapse`,size:`sm`})):(c(),P(X,{key:1,name:`expand`,size:`sm`}))],8,txe)):E(``,!0)]),_:1},8,[`text`])])]),Ot.value?(c(),W(`input`,{key:2,ref_key:`fileInputRef`,ref:Ie,type:`file`,multiple:``,class:`file-input-hidden`,onChange:n[9]||=(...e)=>z(We)&&z(We)(...e)},null,544)):E(``,!0),F(`div`,{ref_key:`toolbarRef`,ref:Ft,class:`toolbar`},[F(`div`,{ref_key:`menuMeasureRef`,ref:ur,class:`menu-measure`,"aria-hidden":`true`},[...n[30]||=[F(`span`,{class:`pd-desc`},null,-1)]],512),F(`div`,nxe,[v(Ca,{size:`md`,class:`composer-attach`,label:z(u)(`composer.addMenu`),"aria-haspopup":`menu`,"aria-expanded":Vn.value,onMousedown:n[10]||=H(()=>{},[`prevent`]),onClick:H(Zn,[`stop`])},{default:B(()=>[v(X,{name:`plus`})]),_:1},8,[`label`,`aria-expanded`]),v(zye,{ref_key:`capMenuRef`,ref:Pn,"session-id":e.sessionId,triggerless:``},null,8,[`session-id`]),v(A7,{ref_key:`expertTalkControlRef`,ref:Fn,models:e.models,onTake:z(x),onBuild:zn},null,8,[`models`,`onTake`]),e.status?(c(),W(`span`,{key:0,ref_key:`permissionPillRef`,ref:It,class:V([`perm-pill`,[`perm-`+e.status.permission,{open:Pt.value}]]),role:`button`,tabindex:`0`,"aria-label":Tr.value,onClick:H(Qt,[`stop`]),onKeydown:[ie(Qt,[`enter`]),ie(H(Qt,[`prevent`]),[`space`])]},[v(X,{class:`perm-pill-icon`,name:Er.value,size:`md`},null,8,[`name`]),F(`span`,ixe,U(Tr.value),1)],42,rxe)):E(``,!0),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Pt.value&&e.status?(c(),W(`div`,{key:0,ref_key:`permDropdownRef`,ref:Ht,class:`perm-dropdown`,style:ae(pr.value),role:`menu`,onClick:n[11]||=H(()=>{},[`stop`])},[(c(),W(M,null,_(lr,t=>F(`button`,{key:t.mode,class:V([`pd-row`,{"is-current":t.mode===e.status.permission}]),role:`menuitem`,onClick:e=>Cr(t.mode)},[F(`span`,{class:`pd-icon`,style:ae({color:t.color})},[v(X,{name:t.icon,size:`md`},null,8,[`name`])],4),F(`span`,oxe,[F(`span`,{class:`pd-name`,style:ae({color:t.color})},U(z(u)(t.labelKey)),5),F(`span`,sxe,U(z(u)(t.descKey)),1)]),F(`span`,cxe,[t.mode===e.status.permission?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)])],10,axe)),64))],4)):E(``,!0)]),_:1}),xn.value?(c(),W(`span`,lxe,[v(X,{class:`workflow-ic`,name:`sparkles`,size:`md`}),F(`span`,uxe,U(z(u)(`status.dynamicWorkflowLabel`)),1),v(Ca,{class:`workflow-x`,size:`sm`,label:z(u)(`status.dynamicWorkflowDismiss`),onMousedown:n[12]||=H(()=>{},[`prevent`]),onClick:n[13]||=H(e=>o(`toggleWorkflow`),[`stop`])},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])])):E(``,!0)]),F(`div`,{ref_key:`toolbarRightRef`,ref:Fr,class:`toolbar-right`},[cn.value?(c(),W(`button`,{key:0,class:V([`compact-chip`,{gone:kr.value}]),onClick:n[14]||=H(e=>o(`compact`),[`stop`])},`/compact`,2)):E(``,!0),v(Sp,{text:sn.value},{default:B(()=>[e.status&&!e.hideContext?(c(),W(`span`,{key:0,class:`ctx-group`,role:`img`,tabindex:`0`,"aria-label":sn.value},[v(rme,{pct:on.value},null,8,[`pct`])],8,dxe)):E(``,!0)]),_:1},8,[`text`]),v(Sp,{text:Or.value?Rn.value:null},{default:B(()=>[e.status?(c(),W(`button`,{key:0,ref_key:`modelPillRef`,ref:Lt,type:`button`,class:V([`model-pill`,{open:Mt.value,"icon-only":Or.value,"model-gone":Ar.value&&!Ln.value,"is-discussion":Ln.value}]),"aria-haspopup":Ln.value?`dialog`:`menu`,"aria-expanded":Ln.value?void 0:Mt.value,"aria-label":Or.value?Rn.value:void 0,onClick:H(Bn,[`stop`])},[Or.value?(c(),P(X,{key:0,name:Ln.value?`sparkles`:`cute-bot`,size:`md`,live:e.running},null,8,[`name`,`live`])):(c(),W(M,{key:1},[Ln.value?(c(),P(X,{key:0,name:`sparkles`,size:`sm`})):E(``,!0),F(`span`,{ref_key:`modelNameRef`,ref:zt,class:`mp-name`},U(Rn.value),513),v(X,{class:`cv`,name:`chevron-down`,size:`sm`})],64))],10,fxe)):E(``,!0)]),_:1},8,[`text`]),e.status&&un.value!==`unsupported`?(c(),P(Sp,{key:1,text:gn.value},{default:B(()=>[F(`button`,{ref_key:`thinkingPillRef`,ref:Rt,type:`button`,class:V([`thinking-pill`,{open:Nt.value}]),disabled:mn.value,"aria-haspopup":`dialog`,"aria-expanded":Nt.value,"aria-label":gn.value,onClick:H(Yt,[`stop`]),onKeydown:ie(H(Xt,[`prevent`]),[`escape`])},[v(X,{name:`thinking`,size:`sm`}),F(`span`,mxe,U(hn.value),1),mn.value?E(``,!0):(c(),P(X,{key:0,class:`cv`,name:`chevron-down`,size:`sm`}))],42,pxe)]),_:1},8,[`text`])):E(``,!0),e.working?(c(),P(Sp,{key:2,text:z(u)(`composer.interruptTitle`)},{default:B(()=>[F(`button`,{class:`stop`,"aria-label":z(u)(`composer.interrupt`),onClick:n[15]||=e=>o(`interrupt`)},[...n[31]||=[F(`span`,{class:`stop-square`,"aria-hidden":`true`},null,-1)]],8,hxe)]),_:1},8,[`text`])):E(``,!0),F(`button`,{class:V([`send`,{"is-starting":e.starting}]),"aria-label":Dt.value,disabled:e.starting||!kt.value,onClick:n[16]||=e=>vt()},[e.starting?(c(),P(op,{key:0,size:`sm`})):(c(),P(X,{key:1,name:`send`,size:`sm`}))],10,gxe)],512),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Mt.value&&e.status?(c(),W(`div`,{key:0,ref_key:`modelDropdownRef`,ref:Bt,class:V([`composer-dropdown model-dropdown`,{"flip-down":qt.value}]),style:ae(mr.value),role:`menu`,onClick:n[18]||=H(()=>{},[`stop`]),onKeydown:Xr},[F(`div`,_xe,[Gr.value.length>0?(c(),W(`div`,vxe,U(z(u)(`status.starredModels`)),1)):E(``,!0),(c(!0),W(M,null,_(Gr.value,t=>(c(),W(`button`,{key:t.id,class:V([`md-row`,{"is-current":t.id===e.status.modelId}]),role:`menuitem`,onClick:e=>Zr(t.id)},[F(`span`,bxe,[t.id===e.status.modelId?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)]),F(`span`,xxe,U(t.displayName??t.model),1),F(`span`,Sxe,U(t.provider),1),v(X,{class:`md-star`,name:`star`,size:`sm`})],10,yxe))),128)),Gr.value.length>0?(c(),W(`div`,Cxe)):E(``,!0),Hr.value.length>0?(c(),W(`div`,wxe,U(Vr.value),1)):E(``,!0),(c(!0),W(M,null,_(Hr.value,t=>(c(),W(`button`,{key:t.id,class:V([`md-row`,{"is-current":t.id===e.status.modelId}]),role:`menuitem`,onClick:e=>Zr(t.id)},[F(`span`,Exe,[t.id===e.status.modelId?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)]),F(`span`,Dxe,U(t.displayName??t.model),1),Wr(t.id)?(c(),P(X,{key:0,class:`md-star`,name:`star`,size:`sm`})):E(``,!0)],10,Txe))),128))]),Hr.value.length>0?(c(),W(`div`,Oxe)):E(``,!0),F(`button`,{class:`md-row md-row-more`,role:`menuitem`,onClick:n[17]||=e=>{Zt(),o(`pickModel`)}},[F(`span`,kxe,[v(X,{name:`list`,size:`sm`})]),F(`span`,Axe,U(z(u)(`status.moreModels`)),1),v(X,{class:`md-more-arrow`,name:`chevron-right`,size:`sm`})])],38)):E(``,!0)]),_:1}),v(oe,{name:`composer-menu-pop`},{default:B(()=>[Nt.value&&e.status?(c(),W(`div`,{key:0,ref_key:`thinkingDropdownRef`,ref:Vt,class:`composer-dropdown thinking-dropdown`,style:ae(hr.value),role:`dialog`,"aria-label":z(u)(`composer.thinkingMenuTitle`),onClick:n[19]||=H(()=>{},[`stop`]),onKeydown:ie(H(Xt,[`prevent`]),[`escape`])},[F(`div`,Mxe,[v(X,{name:`thinking`,size:`sm`}),F(`span`,null,U(z(u)(`composer.thinkingMenuTitle`)),1)]),v(o6,{"model-value":pn.value,options:yn.value,size:`sm`,"onUpdate:modelValue":_n},null,8,[`model-value`,`options`]),F(`div`,Nxe,U(z(u)(`status.cacheNote`)),1)],44,jxe)):E(``,!0)]),_:1})],512)],2),F(`div`,{class:V([`drop-overlay`,{show:z(Le)}]),"aria-hidden":`true`},[F(`div`,Pxe,[v(X,{name:`file-plus`,size:`lg`}),F(`span`,null,U(z(u)(`composer.dropToAttach`)),1)])],2),(c(),P(ee,{to:`body`},[v(oe,{name:`composer-warning`},{default:B(()=>[pt.value?(c(),W(`div`,Fxe,[v(F7,{variant:`warning`,title:pt.value,"dismiss-label":z(u)(`common.dismiss`),onDismiss:n[20]||=e=>pt.value=null},null,8,[`title`,`dismiss-label`])])):E(``,!0)]),_:1}),v(P7,{"model-value":z(f)&&z(ue),title:z(u)(`composer.slashSheetTitle`),"onUpdate:modelValue":je},{default:B(()=>[F(`div`,Ixe,[v(Fp,{ref_key:`slashSheetSearchRef`,ref:we,modelValue:Oe.value,"onUpdate:modelValue":n[21]||=e=>Oe.value=e,placeholder:z(u)(`composer.slashSearchPlaceholder`),autocomplete:`off`,spellcheck:`false`,onKeydown:Et},null,8,[`modelValue`,`placeholder`])]),v(G3,{id:`composer-slash-menu`,layout:`sheet`,items:z(fe),"active-index":z(G),query:Oe.value,onSelect:z(pe),onHover:n[22]||=e=>G.value=e},null,8,[`items`,`active-index`,`query`,`onSelect`])]),_:1},8,[`model-value`,`title`]),v(P7,{"model-value":z(f)&&z(me),title:z(u)(`composer.mentionSheetTitle`),"onUpdate:modelValue":q},{default:B(()=>[F(`div`,Lxe,[v(Fp,{ref_key:`mentionSheetSearchRef`,ref:Te,modelValue:ke.value,"onUpdate:modelValue":n[23]||=e=>ke.value=e,placeholder:z(u)(`composer.mentionSearchPlaceholder`),autocomplete:`off`,spellcheck:`false`,onKeydown:Et},null,8,[`modelValue`,`placeholder`])]),v(K3,{id:`composer-mention-menu`,layout:`sheet`,items:z(he),"active-index":z(ge),loading:z(_e),stale:z(ve),onSelect:z(be),onHover:n[24]||=e=>ge.value=e},null,8,[`items`,`active-index`,`loading`,`stale`,`onSelect`])]),_:1},8,[`model-value`,`title`]),v(P7,{"model-value":z(f)&&Vn.value,"onUpdate:modelValue":Xn},{default:B(()=>[F(`div`,{ref_key:`mobileModesMenuRef`,ref:Un,class:`msheet-add`,role:`menu`,onClick:n[26]||=H(()=>{},[`stop`]),onKeydown:$n},[(c(!0),W(M,null,_(qn.value,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`am-row`,role:`menuitem`,onMousedown:n[25]||=H(()=>{},[`prevent`]),onClick:t=>Qn(e)},[F(`span`,zxe,[v(X,{name:e.icon,size:`sm`},null,8,[`name`])]),F(`span`,Bxe,U(z(u)(e.nameKey)),1),e.descKey?(c(),W(`span`,Vxe,U(z(u)(e.descKey)),1)):E(``,!0)],40,Rxe))),128))],544)]),_:1},8,[`model-value`])]))],34))}}),[[`__scopeId`,`data-v-0a01a109`]]),Hxe={class:`ah`},Uxe={class:`akind`},Wxe={class:`apath`},Gxe={class:`ah-path`},Kxe={class:`dg`},qxe={class:`dc`},Jxe={key:2,class:`body-shell`},Yxe={class:`shell-cmd`},Xxe={key:0,class:`shell-cwd`},Zxe={key:1,class:`shell-danger`},Qxe={class:`file-bar`},$xe={class:`file-lang`},eSe={class:`file-ln`},tSe={class:`file-text`},nSe={key:4,class:`body-chip`},rSe={class:`chip-label`},iSe={class:`chip-value`},aSe={key:0,class:`chip-detail`},oSe={key:5,class:`body-chip`},sSe={key:0,class:`chip-label`},cSe={class:`chip-value`},lSe={key:6,class:`body-chip`},uSe={class:`chip-label`},dSe={class:`chip-value`},fSe={key:0,class:`chip-detail`},pSe={key:7,class:`body-chip`},mSe={class:`chip-label`},hSe={class:`chip-value`},gSe={key:0,class:`chip-detail`},_Se={key:8,class:`body-todo`},vSe={class:`todo-glyph`},ySe={key:10,class:`body-generic`},bSe={class:`gen-text`},xSe={key:11,class:`feedback-wrap`},SSe=[`placeholder`],CSe={class:`feedback-hint`},wSe={key:0,class:`plan-actions`},TSe={key:1,class:`abtn`},ESe=.4,DSe=Y(G({__name:`ApprovalCard`,props:{block:{},agentName:{},busy:{type:Boolean}},emits:[`decide`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=L(()=>{let e=r.block;return e.kind===`plan_review`?{plan:e.plan,path:e.path,options:e.options??[]}:null}),u=R(!1),d=R(!1),f=L(()=>[`plan_review`,`diff`,`file`].includes(r.block.kind)),m=R(null),g=R(null),y=R(null),b=R({top:!1,bottom:!1}),x=R({top:!1,bottom:!1}),S=R({top:!1,bottom:!1});function C(e){return t=>{let n=t.currentTarget;n instanceof HTMLElement&&(e.value={top:n.scrollTop>0,bottom:n.scrollTop+n.clientHeight{let{top:t,bottom:n}=e.value;if(!t&&!n)return;let r=`var(--menu-scroll-fade)`,i=t&&n?`linear-gradient(to bottom, transparent 0, black ${r}, black calc(100% - ${r}), transparent 100%)`:t?`linear-gradient(to bottom, transparent, black ${r})`:`linear-gradient(to top, transparent, black ${r})`;return{maskImage:i,WebkitMaskImage:i}})}let k=O(b),A=O(x),j=O(S);function N(){let e=[[m.value,b],[g.value,x],[y.value,S]];for(let[t,n]of e)t&&(n.value={top:t.scrollTop>0,bottom:t.scrollTop+t.clientHeightvoid n(N)),s(u,()=>void n(N)),s(()=>r.block,()=>void n(N));let ee=[`shell`,`diff`,`file`,`fileop`,`url`,`search`,`invocation`,`todo`,`plan_review`,`generic`];function I(){return a(`approval.title.${ee.includes(r.block.kind)?r.block.kind:`generic`}`)}let te=R(!1),ne=R(``),re=R(null);function ie(){let e=re.value;if(!e)return;e.style.height=`auto`;let t=(window.visualViewport?.height??window.innerHeight)*ESe,n=Math.min(e.scrollHeight,t);e.style.height=`${n}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`}let oe=null,se=0;function ce(){if(oe?.disconnect(),oe=null,typeof ResizeObserver>`u`)return;let e=re.value;e&&(oe=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;t!==se&&(se=t,ie())}),oe.observe(e))}s(ne,()=>void n(ie)),s(te,e=>{if(!e){oe?.disconnect(),oe=null;return}n(()=>{ie(),ce()})}),s(u,e=>{e||n(ie)});let{uiFontSize:le}=k6();s(le,()=>void n(ie));function ue(){r.busy||(te.value=!0,ne.value=``,setTimeout(()=>re.value?.focus(),0))}function fe(){if(r.busy)return;let e=ne.value.trim();o.value?he(`feedback`,{decision:`rejected`,selectedLabel:`Revise`,feedback:e||void 0}):he(`feedback`,{decision:`rejected`,feedback:e||void 0}),te.value=!1,ne.value=``}function H(){te.value=!1,ne.value=``}function G(e){e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),fe()):e.key===`Escape`&&(e.preventDefault(),H())}let me=R(null);s(()=>r.busy,e=>{e||(me.value=null)});function he(e,t){r.busy||(me.value=e,i(`decide`,t))}function ge(){he(`approve`,{decision:`approved`})}function _e(){he(`approveSession`,{decision:`approved`,scope:`session`})}function ve(){he(`reject`,{decision:`rejected`})}function ye(){he(`approvePlan`,{decision:`approved`})}function be(e){he(`option:${e}`,{decision:`approved`,selectedLabel:e})}function xe(){r.busy||ue()}function Se(){he(`rejectAndExit`,{decision:`rejected`,selectedLabel:`Reject and Exit`})}function Ce(e){let t=(document.activeElement?.tagName??``).toLowerCase();if(t===`input`||t===`textarea`||r.busy||u.value)return;let n=o.value;if(n){if(n.options.length===0){e.key===`1`?(e.preventDefault(),ye()):e.key===`2`?(e.preventDefault(),xe()):e.key===`3`&&(e.preventDefault(),Se());return}e.key===`1`&&n.options[0]?(e.preventDefault(),be(n.options[0].label)):e.key===`2`&&n.options[1]?(e.preventDefault(),be(n.options[1].label)):e.key===`3`&&n.options[2]&&(e.preventDefault(),be(n.options[2].label));return}e.key===`1`?(e.preventDefault(),ge()):e.key===`2`?(e.preventDefault(),_e()):e.key===`3`?(e.preventDefault(),ve()):e.key===`4`&&(e.preventDefault(),ue())}return p(()=>{document.addEventListener(`keydown`,Ce),window.addEventListener(`resize`,ie),window.visualViewport?.addEventListener(`resize`,ie)}),h(()=>{document.removeEventListener(`keydown`,Ce),window.removeEventListener(`resize`,ie),window.visualViewport?.removeEventListener(`resize`,ie),oe?.disconnect(),oe=null}),(t,n)=>(c(),P(L4,{class:V([`appr`,{minimized:u.value}])},pe({head:B(()=>[F(`div`,Hxe,[n[6]||=F(`span`,{class:`ah-ic`},`!`,-1),F(`span`,Uxe,U(I()),1),F(`span`,Wxe,[e.block.kind===`diff`||e.block.kind===`file`||e.block.kind===`fileop`?(c(),W(M,{key:0},[K(U(e.block.path),1)],64)):e.block.kind===`shell`?(c(),W(M,{key:1},[K(U(e.block.command),1)],64)):e.block.kind===`url`?(c(),W(M,{key:2},[K(U(e.block.url),1)],64)):e.block.kind===`search`?(c(),W(M,{key:3},[K(U(e.block.query),1)],64)):e.block.kind===`invocation`?(c(),W(M,{key:4},[K(U(e.block.name),1)],64)):e.block.kind===`generic`?(c(),W(M,{key:5},[K(U(e.block.summary),1)],64)):E(``,!0)]),e.agentName&&!u.value?(c(),P(cp,{key:0,variant:`neutral`,size:`sm`},{default:B(()=>[K(U(z(a)(`approval.subagentBadge`,{name:e.agentName})),1)]),_:1})):E(``,!0),u.value?E(``,!0):(c(),P(cp,{key:1,variant:`warning`,size:`sm`,class:`aw`},{default:B(()=>[K(U(z(a)(`approval.required`)),1)]),_:1})),f.value&&!u.value?(c(),P(Ca,{key:2,class:`aexpand`,size:`sm`,label:d.value?z(a)(`approval.collapsePlan`):z(a)(`approval.expandPlan`),tooltip:d.value?z(a)(`approval.collapsePlan`):z(a)(`approval.expandPlan`),onClick:n[0]||=e=>d.value=!d.value},{default:B(()=>[v(X,{name:d.value?`collapse`:`expand`,size:`md`},null,8,[`name`])]),_:1},8,[`label`,`tooltip`])):E(``,!0),v(Ca,{class:`amin`,size:`sm`,label:u.value?z(a)(`question.expand`):z(a)(`question.minimize`),onClick:n[1]||=e=>u.value=!u.value},{default:B(()=>[u.value?(c(),P(X,{key:0,name:`chevron-up`,size:`md`})):(c(),P(X,{key:1,name:`minus`,size:`md`}))]),_:1},8,[`label`])])]),_:2},[u.value?void 0:{name:`default`,fn:B(()=>[e.block.kind===`plan_review`&&e.block.path?(c(),P(Sp,{key:0,text:e.block.path},{default:B(()=>[F(`div`,Gxe,U(e.block.path),1)]),_:1},8,[`text`])):E(``,!0),e.block.kind===`diff`?(c(),W(`div`,{key:1,ref_key:`diffBodyRef`,ref:m,class:V([`diff`,{expanded:d.value}]),style:ae(z(k)),onScroll:n[2]||=(...e)=>z(w)&&z(w)(...e)},[(c(!0),W(M,null,_(e.block.diff,(e,t)=>(c(),W(`div`,{key:t,class:V([`dl`,e.kind===`add`?`add`:e.kind===`rem`?`del`:``])},[F(`span`,Kxe,U(e.gutter),1),F(`span`,qxe,U(e.text),1)],2))),128))],38)):e.block.kind===`shell`?(c(),W(`div`,Jxe,[F(`div`,Yxe,[n[7]||=F(`span`,{class:`shell-dollar`},`$`,-1),K(` `+U(e.block.command),1)]),e.block.cwd?(c(),W(`div`,Xxe,`cwd: `+U(e.block.cwd),1)):E(``,!0),e.block.danger?(c(),W(`div`,Zxe,U(z(a)(`approval.danger`,{detail:e.block.danger})),1)):E(``,!0)])):e.block.kind===`file`?(c(),W(`div`,{key:3,class:V([`body-file`,{expanded:d.value}])},[F(`div`,Qxe,[F(`span`,$xe,U(e.block.language??``),1)]),F(`div`,{class:`file-content`,ref_key:`fileBodyRef`,ref:g,style:ae(z(A)),onScroll:n[3]||=(...e)=>z(T)&&z(T)(...e)},[(c(!0),W(M,null,_(e.block.content.split(` +`),(e,t)=>(c(),W(`div`,{key:t,class:`file-line`},[F(`span`,eSe,U(t+1),1),F(`span`,tSe,U(e),1)]))),128))],36)],2)):e.block.kind===`fileop`?(c(),W(`div`,nSe,[F(`span`,rSe,U(e.block.op),1),F(`span`,iSe,U(e.block.path),1),e.block.detail?(c(),W(`span`,aSe,U(e.block.detail),1)):E(``,!0)])):e.block.kind===`url`?(c(),W(`div`,oSe,[e.block.method?(c(),W(`span`,sSe,U(e.block.method),1)):E(``,!0),F(`span`,cSe,U(e.block.url),1)])):e.block.kind===`search`?(c(),W(`div`,lSe,[F(`span`,uSe,U(z(a)(`approval.searchQueryLabel`)),1),F(`span`,dSe,U(e.block.query),1),e.block.scope?(c(),W(`span`,fSe,U(z(a)(`approval.searchScope`,{scope:e.block.scope})),1)):E(``,!0)])):e.block.kind===`invocation`?(c(),W(`div`,pSe,[F(`span`,mSe,U(e.block.kind2),1),F(`span`,hSe,U(e.block.name),1),e.block.description?(c(),W(`span`,gSe,U(e.block.description),1)):E(``,!0)])):e.block.kind===`todo`?(c(),W(`div`,_Se,[(c(!0),W(M,null,_(e.block.items,(e,t)=>(c(),W(`div`,{key:t,class:`todo-item`},[F(`span`,vSe,U(e.status===`done`||e.status===`completed`?`✓`:`○`),1),F(`span`,{class:V([`todo-title`,{"todo-done":e.status===`done`||e.status===`completed`}])},U(e.title),3)]))),128))])):e.block.kind===`plan_review`?(c(),W(`div`,{key:9,ref_key:`planBodyRef`,ref:y,class:V([`body-plan`,{expanded:d.value}]),style:ae(z(j)),onScroll:n[4]||=(...e)=>z(D)&&z(D)(...e)},[v(w4,{text:e.block.plan},null,8,[`text`])],38)):(c(),W(`div`,ySe,[F(`span`,bSe,U(e.block.summary),1)])),te.value?(c(),W(`div`,xSe,[l(F(`textarea`,{ref_key:`feedbackRef`,ref:re,"onUpdate:modelValue":n[5]||=e=>ne.value=e,class:`feedback-ta`,placeholder:z(a)(`approval.feedbackPlaceholder`),rows:`2`,onKeydown:G},null,40,SSe),[[de,ne.value]]),F(`div`,CSe,U(z(a)(`approval.feedbackHint`)),1)])):E(``,!0)]),key:`0`},u.value?void 0:{name:`foot`,fn:B(()=>[o.value?(c(),W(`div`,wSe,[o.value.options.length>0?(c(!0),W(M,{key:0},_(o.value.options,(t,n)=>(c(),P(Sp,{key:n,text:t.description},{default:B(()=>[v(pD,{class:`kbtn`,size:`sm`,variant:`primary`,loading:me.value===`option:${t.label}`,disabled:e.busy,onClick:e=>be(t.label)},{default:B(()=>[K(U(t.label),1),v(_D,{class:`k`,keys:[String(n+1)]},null,8,[`keys`])]),_:2},1032,[`loading`,`disabled`,`onClick`])]),_:2},1032,[`text`]))),128)):(c(),P(pD,{key:1,class:`kbtn`,size:`sm`,variant:`primary`,loading:me.value===`approvePlan`,disabled:e.busy,onClick:ye},{default:B(()=>[K(U(z(a)(`approval.approvePlan`)),1),v(_D,{class:`k`,keys:[`1`]})]),_:1},8,[`loading`,`disabled`])),v(pD,{class:`kbtn`,size:`sm`,variant:`secondary`,disabled:e.busy,onClick:xe},{default:B(()=>[K(U(z(a)(`approval.revise`)),1),o.value.options.length===0?(c(),P(_D,{key:0,class:`k`,keys:[`2`]})):E(``,!0)]),_:1},8,[`disabled`]),v(pD,{class:`kbtn`,size:`sm`,variant:`danger-soft`,loading:me.value===`rejectAndExit`,disabled:e.busy,onClick:Se},{default:B(()=>[K(U(z(a)(`approval.rejectAndExit`)),1),o.value.options.length===0?(c(),P(_D,{key:0,class:`k`,keys:[`3`]})):E(``,!0)]),_:1},8,[`loading`,`disabled`])])):(c(),W(`div`,TSe,[v(pD,{class:`kbtn`,size:`sm`,variant:`primary`,loading:me.value===`approve`,disabled:e.busy,onClick:ge},{default:B(()=>[K(U(z(a)(`approval.approve`)),1),v(_D,{class:`k`,keys:[`1`]})]),_:1},8,[`loading`,`disabled`]),v(pD,{class:`kbtn`,size:`sm`,variant:`secondary`,loading:me.value===`approveSession`,disabled:e.busy,onClick:_e},{default:B(()=>[K(U(z(a)(`approval.approveSession`)),1),v(_D,{class:`k`,keys:[`2`]})]),_:1},8,[`loading`,`disabled`]),v(pD,{class:`kbtn`,size:`sm`,variant:`secondary`,loading:me.value===`reject`,disabled:e.busy,onClick:ve},{default:B(()=>[K(U(z(a)(`approval.reject`)),1),v(_D,{class:`k`,keys:[`3`]})]),_:1},8,[`loading`,`disabled`]),v(pD,{class:`kbtn`,size:`sm`,variant:`secondary`,disabled:e.busy,onClick:ue},{default:B(()=>[K(U(z(a)(`approval.feedback`)),1),v(_D,{class:`k`,keys:[`4`]})]),_:1},8,[`disabled`])]))]),key:`1`}]),1032,[`class`]))}}),[[`__scopeId`,`data-v-f7485122`]]),OSe={class:`goal-panel`},kSe={key:0,class:`goal-criterion`},ASe={class:`goal-criterion-label`},jSe=Y(G({__name:`GoalPanel`,props:{goal:{},openFile:{type:Function}},setup(e){let{t}=J();return(n,r)=>(c(),W(`div`,OSe,[v(w4,{text:e.goal.objective,"open-file":e.openFile},null,8,[`text`,`open-file`]),e.goal.completionCriterion?(c(),W(`div`,kSe,[F(`div`,ASe,[v(X,{name:`check-list`,size:`md`}),F(`span`,null,U(z(t)(`status.goalDoneWhen`)),1)]),v(w4,{text:e.goal.completionCriterion,"open-file":e.openFile},null,8,[`text`,`open-file`])])):E(``,!0)]))}}),[[`__scopeId`,`data-v-81a928ba`]]),MSe={class:`plan-panel`},NSe={key:0,class:`plan-review-row`},PSe={class:`plan-review-label`},FSe={key:1,class:`plan-review-row plan-review-feedback`},ISe={class:`plan-review-label`},LSe={key:3,class:`plan-path-only`},RSe={class:`plan-path-hint`},zSe={class:`plan-path`},BSe={key:4,class:`plan-empty`},VSe=Y(G({__name:`PlanPanel`,props:{plan:{},planModeOn:{type:Boolean},openFile:{type:Function},revealSavedPlan:{type:Function}},setup(e){let{t}=J();return(n,r)=>(c(),W(`div`,MSe,[e.plan?.selectedOption?(c(),W(`div`,NSe,[F(`span`,PSe,U(z(t)(`tools.plan.selectedOption`)),1),F(`span`,null,U(e.plan.selectedOption),1)])):E(``,!0),e.plan?.feedback?(c(),W(`div`,FSe,[F(`span`,ISe,U(z(t)(`tools.plan.feedback`)),1),F(`span`,null,U(e.plan.feedback),1)])):E(``,!0),e.plan?.plan?(c(),P(w4,{key:2,text:e.plan.plan,"open-file":e.openFile},null,8,[`text`,`open-file`])):e.plan?.path?(c(),W(`div`,LSe,[F(`span`,RSe,U(z(t)(`tools.plan.pathOnlyHint`)),1),F(`span`,zSe,U(e.plan.path),1),e.revealSavedPlan?(c(),P(pD,{key:0,variant:`ghost`,size:`sm`,onClick:r[0]||=t=>void e.revealSavedPlan(e.plan.agentId,e.plan.toolCallId)},{default:B(()=>[v(X,{name:`external-link`,size:`sm`}),K(` `+U(z(t)(`tools.plan.revealInFileManager`)),1)]),_:1})):E(``,!0)])):(c(),W(`div`,BSe,[v(X,{class:`plan-empty-ico`,name:`file-edit`,size:`lg`}),F(`span`,null,U(z(t)(e.planModeOn?`status.planEmptyArmed`:`status.planEmptyIdle`)),1)]))]))}}),[[`__scopeId`,`data-v-2883948d`]]),HSe={class:`qh`},USe={class:`qtitle`},WSe={key:0,class:`qstep`},GSe={key:1,class:`qmin-peek`},KSe={class:`qbody`},qSe=[`aria-label`],JSe=[`aria-selected`,`aria-label`,`onClick`],YSe={class:`qstep-num`},XSe={key:1,class:`qheader-chip`},ZSe={class:`qtext`},QSe={class:`qopts`},$Se=[`onClick`],eCe={class:`qopt-key`},tCe={class:`qopt-glyph`},nCe={key:0,class:`chk`},rCe={key:1,class:`rad`},iCe={class:`qopt-text`},aCe={class:`qopt-label`},oCe={key:0,class:`qopt-desc`},sCe={class:`qopt-glyph`},cCe={key:0,class:`chk`},lCe={key:1,class:`rad`},uCe={class:`qopt-text qopt-text-other`},dCe={class:`qopt-label`},fCe={key:0,class:`qopt-desc`},pCe=[`placeholder`],mCe={class:`qfoot`},hCe=Y(G({__name:`QuestionCard`,props:{question:{},busyKind:{}},emits:[`answer`,`dismiss`],setup(e,{emit:t}){let r=e,{t:i}=J(),a=t,o=R(0),u=R(!1),d=L(()=>r.question.questions[o.value]),f=L(()=>r.question.questions.length);function m(){o.value>0&&o.value--}function g(){o.value=0&&e0:t.kind===`multiWithOther`?t.optionIds.length>0||t.otherText.trim().length>0:t.kind===`other`?t.text.trim().length>0:!0:!1}function x(){return b(d.value.id)}let S=R({});function C(e){return e.recommended===!0?!0:/\b(?:recommended|recommend)\b/.test(`${e.label} ${e.description??``}`.toLowerCase())}function w(){let e={...S.value},t=!1;for(let n of r.question.questions){if(e[n.id])continue;let r=n.options.filter(C);r.length!==0&&(e[n.id]=n.multiSelect?{kind:`multi`,optionIds:r.map(e=>e.id)}:{kind:`single`,optionId:r[0].id},t=!0)}t&&(S.value=e)}s(()=>r.question.questionId,()=>{o.value=0,u.value=!1,S.value={},O.value={}}),s(()=>r.question,()=>{o.value>=r.question.questions.length&&(o.value=0),w()},{immediate:!0,deep:!0});function T(e,t){let n=S.value[e];if(n&&n.kind===`single`&&n.optionId===t){let t={...S.value};delete t[e],S.value=t}else S.value={...S.value,[e]:{kind:`single`,optionId:t}}}function D(e,t){let n=S.value[e],r=n&&(n.kind===`multi`||n.kind===`multiWithOther`)?(n.kind,[...n.optionIds]):[],i=r.indexOf(t);i>=0?r.splice(i,1):r.push(t);let a=S.value[e],o=a&&a.kind===`multiWithOther`?a.otherText:``;o?S.value={...S.value,[e]:{kind:`multiWithOther`,optionIds:r,otherText:o}}:S.value={...S.value,[e]:{kind:`multi`,optionIds:r}}}let O=R({}),k=R(null);function A(e){let t=r.question.questions.find(t=>t.id===e),n=O.value[e]??``;if(t.multiSelect){let t=S.value[e],r=t&&(t.kind===`multi`||t.kind===`multiWithOther`)?(t.kind,[...t.optionIds]):[];S.value={...S.value,[e]:{kind:`multiWithOther`,optionIds:r,otherText:n}}}else S.value={...S.value,[e]:{kind:`other`,text:n}}}function j(e){A(e),n(()=>k.value?.focus())}function N(e,t){let n=S.value[e];return n?n.kind===`single`?n.optionId===t:n.kind===`multi`||n.kind===`multiWithOther`?n.optionIds.includes(t):!1:!1}function ee(e){let t=S.value[e];return!!(t&&(t.kind===`other`||t.kind===`multiWithOther`))}function I(){return r.question.questions.every(e=>b(e.id))}let te=L(()=>r.busyKind===`answer`),ne=L(()=>r.busyKind===`dismiss`),re=L(()=>!!r.busyKind);function ie(){if(re.value||!I())return;let e={answers:S.value,method:`click`};a(`answer`,r.question.questionId,e)}function ae(){re.value||a(`dismiss`,r.question.questionId)}function oe(e){let t=(document.activeElement?.tagName??``).toLowerCase(),n=t===`input`||t===`textarea`;if(re.value)return;if(e.key===`Enter`){if(e.preventDefault(),u.value)return;o.value=1&&r<=9){e.preventDefault();let t=d.value,n=r-1,i=t.options[n];i&&(t.multiSelect?D(t.id,i.id):T(t.id,i.id))}}return p(()=>document.addEventListener(`keydown`,oe)),h(()=>document.removeEventListener(`keydown`,oe)),(e,t)=>(c(),P(L4,{class:V([`qcard`,{minimized:u.value}])},pe({head:B(()=>[F(`div`,HSe,[t[5]||=F(`span`,{class:`qh-ic`},`?`,-1),F(`span`,USe,U(z(i)(`question.title`)),1),f.value>1&&!u.value?(c(),W(`span`,WSe,U(z(i)(`question.step`,{current:o.value+1,total:f.value})),1)):E(``,!0),u.value?(c(),W(`span`,GSe,U(d.value.question),1)):E(``,!0),v(Ca,{class:`qmin`,size:`sm`,label:u.value?z(i)(`question.expand`):z(i)(`question.minimize`),onClick:t[0]||=e=>u.value=!u.value},{default:B(()=>[u.value?(c(),P(X,{key:0,name:`chevron-up`,size:`md`})):(c(),P(X,{key:1,name:`minus`,size:`md`}))]),_:1},8,[`label`])])]),_:2},[u.value?void 0:{name:`default`,fn:B(()=>[F(`div`,KSe,[f.value>1?(c(),W(`div`,{key:0,class:`qsteps`,role:`tablist`,"aria-label":z(i)(`question.step`,{current:o.value+1,total:f.value})},[(c(!0),W(M,null,_(r.question.questions,(e,t)=>(c(),W(`button`,{key:e.id,type:`button`,class:V([`qstep-dot`,{active:t===o.value,answered:b(e.id)}]),"aria-selected":t===o.value,"aria-label":z(i)(`question.step`,{current:t+1,total:f.value}),onClick:e=>y(t)},[F(`span`,YSe,U(t+1),1)],10,JSe))),128))],8,qSe)):E(``,!0),d.value.header?(c(),W(`div`,XSe,[v(cp,{variant:`neutral`,size:`sm`},{default:B(()=>[K(U(d.value.header),1)]),_:1})])):E(``,!0),F(`div`,ZSe,U(d.value.question),1),d.value.body?(c(),P(w4,{key:2,text:d.value.body,class:`qmdbody`},null,8,[`text`])):E(``,!0),F(`div`,QSe,[(c(!0),W(M,null,_(d.value.options,(e,t)=>(c(),W(`label`,{key:e.id,class:V([`qopt`,{selected:N(d.value.id,e.id)}]),onClick:H(t=>d.value.multiSelect?D(d.value.id,e.id):T(d.value.id,e.id),[`prevent`])},[F(`span`,eCe,U(t+1),1),F(`span`,tCe,[d.value.multiSelect?(c(),W(`span`,nCe,U(N(d.value.id,e.id)?`■`:`□`),1)):(c(),W(`span`,rCe,U(N(d.value.id,e.id)?`●`:`○`),1))]),F(`span`,iCe,[F(`span`,aCe,U(e.label),1),e.description?(c(),W(`span`,oCe,U(e.description),1)):E(``,!0)])],10,$Se))),128)),d.value.allowOther?(c(),W(`label`,{key:0,class:V([`qopt`,{selected:ee(d.value.id)}]),onClick:t[4]||=H(e=>j(d.value.id),[`prevent`])},[t[6]||=F(`span`,{class:`qopt-key`},null,-1),F(`span`,sCe,[d.value.multiSelect?(c(),W(`span`,cCe,U(ee(d.value.id)?`■`:`□`),1)):(c(),W(`span`,lCe,U(ee(d.value.id)?`●`:`○`),1))]),F(`span`,uCe,[F(`span`,dCe,U(d.value.otherLabel??z(i)(`question.otherDefault`)),1),d.value.otherDescription?(c(),W(`span`,fCe,U(d.value.otherDescription),1)):E(``,!0)]),l(F(`input`,{ref_key:`otherInputEl`,ref:k,"onUpdate:modelValue":t[1]||=e=>O.value[d.value.id]=e,class:`other-input`,type:`text`,placeholder:d.value.otherLabel??z(i)(`question.otherDefault`),onInput:t[2]||=e=>A(d.value.id),onFocus:t[3]||=e=>A(d.value.id)},null,40,pCe),[[de,O.value[d.value.id]]])],2)):E(``,!0)])])]),key:`0`},u.value?void 0:{name:`foot`,fn:B(()=>[F(`div`,mCe,[o.value[K(U(z(i)(`question.nextQuestion`)),1)]),_:1},8,[`disabled`])):(c(),P(pD,{key:1,class:`qfoot-btn qfoot-main`,size:`sm`,variant:`primary`,disabled:!I(),loading:te.value,onClick:ie},{default:B(()=>[K(U(z(i)(`question.submit`)),1)]),_:1},8,[`disabled`,`loading`])),f.value>1?(c(),P(pD,{key:2,class:`qfoot-btn`,size:`sm`,variant:`secondary`,disabled:o.value===0||re.value,onClick:m},{default:B(()=>[K(U(z(i)(`question.back`)),1)]),_:1},8,[`disabled`])):E(``,!0),v(pD,{class:`qfoot-btn`,size:`sm`,variant:`ghost`,loading:ne.value,disabled:re.value,onClick:ae},{default:B(()=>[K(U(z(i)(`question.dismiss`)),1)]),_:1},8,[`loading`,`disabled`])])]),key:`1`}]),1032,[`class`]))}}),[[`__scopeId`,`data-v-ce0bd159`]]),R7=Y(G({__name:`StatusGlyph`,props:{status:{}},setup(e){let t=e,n={pending:`○`,run:`●`,done:`✓`,fail:`✗`};return(e,r)=>(c(),W(`span`,{class:V([`status-glyph`,`s-${t.status}`]),"aria-hidden":`true`},U(n[t.status]),3))}}),[[`__scopeId`,`data-v-f870866a`]]),gCe={key:0,class:`sg-empty`},_Ce={key:1,class:`sg-grid`},vCe=[`aria-label`,`onClick`],yCe={class:`sg-top`},bCe={class:`sg-num`},xCe={class:`sg-name`},SCe={key:1,class:`sg-desc`},CCe={class:`sg-foot`},wCe={key:0,class:`sg-model`},TCe={class:`sg-status`},ECe={class:`sg-state`},DCe={key:0,class:`sg-time`},OCe=Y(G({__name:`SubagentGrid`,props:{tasks:{},filter:{}},emits:[`cancel`,`open`],setup(e,{emit:t}){let n=t,{t:r}=J();function i(e){return e}function a(e){return e===`running`?`tasks.emptyRunning`:e===`done`?`tasks.emptyDone`:e===`active`?`tasks.emptyRecent`:`tasks.emptyTasks`}let o=m(`modelDisplay`),s=m(`subagentEffort`);function l(e){let{model:t,thinkingEffort:n}=i(e);return[o?.(t)??t,s?.(n)].filter(Boolean).join(` · `)||void 0}function u(e){let t=i(e).state;return r(t===`done`?`tasks.stateDone`:t===`fail`?`tasks.stateFail`:t===`cancelled`?`tasks.stateCancelled`:`tasks.running`)}function d(e,t){return String(e.dynamicWorkflowIndex??t+1).padStart(2,`0`)}function f(e){return!!(i(e).agentId||e.output?.length)}return(t,o)=>e.tasks.length===0?(c(),W(`div`,gCe,U(z(r)(a(e.filter))),1)):(c(),W(`div`,_Ce,[(c(!0),W(M,null,_(e.tasks,(e,t)=>(c(),W(`article`,{key:e.id,class:V([`sg-card`,[`s-${i(e).state}`,{openable:f(e)}]])},[f(e)?(c(),W(`button`,{key:0,class:`sg-open`,type:`button`,"aria-label":e.name,onClick:t=>n(`open`,i(e).agentId??e.id)},null,8,vCe)):E(``,!0),F(`div`,yCe,[F(`span`,bCe,U(d(e,t)),1),F(`span`,xCe,U(e.name),1)]),e.meta?(c(),W(`div`,SCe,U(e.meta),1)):E(``,!0),F(`div`,CCe,[l(e)?(c(),W(`div`,wCe,[F(`span`,null,U(l(e)),1)])):E(``,!0),F(`div`,TCe,[F(`span`,ECe,[i(e).state===`run`?(c(),P(R7,{key:0,status:`run`})):i(e).state===`done`?(c(),P(X,{key:1,class:`sg-ic-done`,name:`check`,size:`sm`})):(c(),P(X,{key:2,name:`close`,size:`sm`})),K(` `+U(u(e)),1)]),e.timing?(c(),W(`span`,DCe,[v(X,{name:`clock`,size:`sm`}),K(` `+U(e.timing),1)])):E(``,!0)])]),i(e).state===`run`?(c(),P(Ca,{key:2,class:`sg-cancel`,size:`sm`,label:z(r)(`tasks.stop`),onClick:H(t=>n(`cancel`,e.id),[`stop`])},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`onClick`])):E(``,!0)],2))),128))]))}}),[[`__scopeId`,`data-v-5945b343`]]),kCe={class:`taskspane`},ACe={class:`tp-list`},jCe={key:0,class:`tp-empty`},MCe={class:`tp-main`},NCe=[`aria-label`,`onClick`],PCe=[`aria-label`],FCe={class:`tp-name`},ICe={key:1,class:`tp-meta`},LCe={key:2,class:`tp-model`},RCe={key:3,class:`tp-model`},zCe={key:4,class:`tp-time`},BCe=Y(G({__name:`TasksPane`,props:{tasks:{},filter:{}},emits:[`cancel`,`open`],setup(e,{emit:t}){let n=t,{t:r}=J();function i(e){return e}function a(e){return e===`running`?`tasks.emptyRunning`:e===`done`?`tasks.emptyDone`:e===`active`?`tasks.emptyRecent`:`tasks.emptyTasks`}function o(e){return e.kind===`subagent`||!!(e.output?.length||e.meta)}function s(e){o(e)&&n(`open`,i(e).agentId??e.id)}function l(e){let t=i(e).state;return r(t===`done`?`tasks.stateDone`:t===`fail`?`tasks.stateFail`:t===`cancelled`?`tasks.stateCancelled`:`tasks.running`)}let u=m(`modelDisplay`),d=m(`subagentEffort`);function f(e){if(e.kind!==`subagent`)return;let t=i(e).model;return u?.(t)??t}function p(e){if(e.kind===`subagent`)return d?.(i(e).thinkingEffort)}return(t,u)=>(c(),W(`div`,kCe,[F(`div`,ACe,[e.tasks.length===0?(c(),W(`div`,jCe,U(z(r)(a(e.filter))),1)):(c(!0),W(M,{key:1},_(e.tasks,e=>(c(),W(`div`,{key:e.id,class:V([`tp-row`,{fail:i(e).state===`fail`,expandable:o(e)}])},[F(`div`,MCe,[o(e)?(c(),W(`button`,{key:0,class:`tp-open`,type:`button`,"aria-label":e.name,onClick:t=>s(e)},null,8,NCe)):E(``,!0),F(`span`,{class:`tp-glyph`,role:`img`,"aria-label":l(e)},[i(e).state===`run`?(c(),P(R7,{key:0,status:`run`})):i(e).state===`done`?(c(),P(X,{key:1,class:`tp-done`,name:`check`,size:`sm`})):i(e).state===`cancelled`?(c(),P(X,{key:2,class:`tp-cancelled`,name:`close`,size:`sm`})):(c(),P(X,{key:3,class:`tp-fail`,name:`close`,size:`sm`}))],8,PCe),F(`span`,FCe,U(e.name),1),e.meta?(c(),W(`span`,ICe,U(e.meta),1)):E(``,!0),f(e)?(c(),W(`span`,LCe,U(f(e)),1)):E(``,!0),p(e)?(c(),W(`span`,RCe,U(p(e)),1)):E(``,!0),e.timing?(c(),W(`span`,zCe,U(e.timing),1)):E(``,!0),i(e).state===`run`?(c(),P(Ca,{key:5,class:`tp-stop`,size:`sm`,label:z(r)(`tasks.stop`),onClick:H(t=>n(`cancel`,e.id),[`stop`])},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`onClick`])):E(``,!0),o(e)?(c(),P(X,{key:6,class:`tp-chevron`,name:`chevron-right`,size:`sm`})):E(``,!0)])],2))),128))])]))}}),[[`__scopeId`,`data-v-f4589f0b`]]),VCe={class:`todo-card`},HCe={key:0,class:`tc-empty`},UCe={class:`tc-name`},WCe=Y(G({__name:`TodoCard`,props:{todos:{}},setup(e){let{t}=J();return(n,r)=>(c(),W(`div`,VCe,[e.todos.length===0?(c(),W(`div`,HCe,[v(X,{class:`tc-empty-ico`,name:`list`,size:`lg`}),F(`span`,null,U(z(t)(`tasks.emptyTodo`)),1)])):(c(!0),W(M,{key:1},_(e.todos,(e,t)=>(c(),W(`div`,{key:t,class:V([`tc-row`,`s-${e.status}`])},[F(`span`,{class:V([`tc-glyph`,`g-${e.status}`])},[e.status===`done`?(c(),P(X,{key:0,name:`check`,size:`md`})):e.status===`in_progress`?(c(),P(op,{key:1,class:`tc-spin`,size:`sm`})):E(``,!0)],2),F(`span`,UCe,U(e.title),1)],2))),128))]))}}),[[`__scopeId`,`data-v-4e4d0054`]]),GCe={class:`fc-label`},z7=Y(G({__name:`FilterControl`,props:{modelValue:{},options:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=L(()=>r.options.find(e=>e.value===r.modelValue)),o=typeof window<`u`&&window.matchMedia?.(`(hover: none)`).matches?`lg`:`md`,l=R(null),u=R(!1),d=0,f=null;async function m(){let e=l.value?.closest(`.dock-work-head`);if(!e)return;let t=e.querySelector(`.wp-head-tab`),r=getComputedStyle(e),i=(Number.parseFloat(r.columnGap)||0)*2,a=e.clientWidth-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight)-i,o=t?.scrollWidth??0;if(!u.value){let e=l.value?.querySelector(`.ui-seg`);e&&e.offsetWidth>0&&(d=e.offsetWidth)}let s=o+d>a;if(u.value=s,!s){await n();let e=l.value?.querySelector(`.ui-seg`);e&&e.offsetWidth>0&&(d=e.offsetWidth),u.value=o+d>a}}let h=R(!1),g=R(null),y=R(null),b=R({left:`0px`,top:`0px`});function x(){return g.value?.$el??null}async function S(){if(h.value){C();return}h.value=!0,await n(),w(),T(),window.addEventListener(`mousedown`,k,!0),window.addEventListener(`keydown`,A,!0),window.addEventListener(`resize`,w),window.addEventListener(`scroll`,w,!0)}function C(e){h.value=!1,window.removeEventListener(`mousedown`,k,!0),window.removeEventListener(`keydown`,A,!0),window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,w,!0),e?.refocus&&x()?.focus()}function w(){let e=x();if(!e)return;let t=e.getBoundingClientRect(),n=y.value?.offsetHeight??0,r=getComputedStyle(document.documentElement),i=Number.parseFloat(r.getPropertyValue(`--space-2`))||0,a=Number.parseFloat(r.getPropertyValue(`--space-1`))||0,o=y.value?.offsetWidth??0,s=Math.min(t.left,Math.max(i,window.innerWidth-o-i));t.bottom+a+n<=window.innerHeight-i?b.value={left:`${s}px`,top:`${t.bottom+a}px`}:b.value={left:`${s}px`,bottom:`${window.innerHeight-t.top+a}px`}}function T(){let e=y.value;e&&(e.querySelector(`.ui-menu-item.is-active`)??e.querySelector(`.ui-menu-item`))?.focus()}function D(){h.value||S()}function O(e){let t=e.relatedTarget;t&&(y.value?.contains(t)||x()?.contains(t))||C()}function k(e){let t=e.target;if(t){if(y.value?.contains(t)){e.stopImmediatePropagation();return}x()?.contains(t)||C()}}function A(e){e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),C({refocus:!0}))}function j(e){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(y.value?.querySelectorAll(`.ui-menu-item`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}function N(e){i(`update:modelValue`,e),C({refocus:!0})}return p(()=>{let e=l.value?.closest(`.dock-work-head`);!e||typeof ResizeObserver!=`function`||(f=new ResizeObserver(()=>void m()),f.observe(e),m())}),s(u,e=>{!e&&h.value&&C()}),s(()=>r.options,async()=>{d=0,await n(),await m()},{flush:`post`}),ne(()=>{f?.disconnect(),h.value&&C()}),(t,n)=>(c(),W(`span`,{ref_key:`root`,ref:l,class:`filter-control`},[u.value?(c(),W(M,{key:0},[v(yD,{ref_key:`triggerRef`,ref:g,class:`fc-trigger`,"aria-haspopup":`menu`,"aria-expanded":h.value,onClick:S,onKeydown:[ie(H(D,[`prevent`]),[`down`]),ie(H(D,[`prevent`]),[`up`])],onFocusout:O},{default:B(()=>[a.value?.icon?(c(),P(X,{key:0,name:a.value.icon,size:`sm`},null,8,[`name`])):E(``,!0),F(`span`,null,U(a.value?.label),1),v(X,{class:`fc-chevron`,name:`chevron-down`,size:`sm`})]),_:1},8,[`aria-expanded`,`onKeydown`]),(c(),P(ee,{to:`body`},[h.value?(c(),W(`div`,{key:0,ref_key:`menuBoxRef`,ref:y,class:`fc-menu`,style:ae(b.value),onKeydown:j,onFocusout:O},[v(hp,null,{default:B(()=>[(c(!0),W(M,null,_(e.options,t=>(c(),P(vp,{key:t.value,role:`menuitemradio`,active:t.value===e.modelValue,"aria-checked":t.value===e.modelValue,size:z(o),onClick:e=>N(t.value)},{default:B(()=>[t.icon?(c(),P(X,{key:0,name:t.icon,size:`sm`,"data-icon":t.icon},null,8,[`name`,`data-icon`])):E(``,!0),F(`span`,GCe,U(t.label),1),t.value===e.modelValue?(c(),P(X,{key:1,class:`fc-check`,name:`check`,size:`sm`})):E(``,!0)]),_:2},1032,[`active`,`aria-checked`,`size`,`onClick`]))),128))]),_:1})],36)):E(``,!0)]))],64)):(c(),P(o6,{key:1,"model-value":e.modelValue,options:e.options,size:`md`,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},null,8,[`model-value`,`options`]))],512))}}),[[`__scopeId`,`data-v-658870b5`]]),KCe={class:`wp-head-tab`},qCe={key:0,class:`wp-head-meta`},JCe={key:0,class:`wp-head-actions`},B7=Y(G({__name:`WorkPanelHead`,props:{icon:{},title:{},meta:{}},setup(e){return(t,n)=>(c(),W(M,null,[F(`span`,KCe,[v(X,{name:e.icon,size:`md`},null,8,[`name`]),F(`span`,null,U(e.title),1),e.meta?(c(),W(`span`,qCe,U(e.meta),1)):E(``,!0)]),t.$slots.actions?(c(),W(`span`,JCe,[me(t.$slots,`actions`,{},void 0,!0)])):E(``,!0)],64))}}),[[`__scopeId`,`data-v-408c4b07`]]),V7=G({__name:`WorkPill`,props:{icon:{},active:{type:Boolean},label:{}},emits:[`click`],setup(e){return(t,n)=>(c(),P(yD,{active:e.active,"aria-pressed":e.active,"aria-label":e.label,onClick:n[0]||=e=>t.$emit(`click`,e)},{default:B(()=>[v(X,{name:e.icon,size:`md`},null,8,[`name`]),F(`span`,null,[me(t.$slots,`default`)]),me(t.$slots,`meta`)]),_:3},8,[`active`,`aria-pressed`,`aria-label`]))}}),YCe={class:`dock-work-head`},XCe={key:0,class:`dock-workbar`},ZCe={class:`dw-running`},QCe={class:`dw-running`},$Ce={class:`dw-count`},ewe=Y(G({__name:`ChatDock`,props:{sessionId:{},running:{type:Boolean},working:{type:Boolean},starting:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},status:{},thinking:{},planMode:{type:Boolean},planArmed:{type:Boolean},goalMode:{type:Boolean},towerMode:{type:Boolean},towerAvailable:{type:Boolean},dynamicWorkflowMode:{type:Boolean},activationBadges:{},models:{},starredIds:{},skills:{},goal:{},sessionPlans:{},dockPanel:{},overlayOpen:{type:Boolean},bashTasks:{},subagentTasks:{},bashRunning:{},subagentRunning:{},todoDoneCount:{},hasDockWork:{type:Boolean},todos:{},pendingQuestion:{},questionBusyKind:{},pendingApproval:{},approvalBusy:{type:Boolean},mobile:{type:Boolean},openFile:{type:Function},revealSavedPlan:{type:Function}},emits:[`submit`,`steer`,`command`,`interrupt`,`setPermission`,`setThinking`,`togglePlan`,`toggleWorkflow`,`toggleGoal`,`toggleTower`,`openBtw`,`createGoal`,`controlGoal`,`focusGoal`,`compact`,`pickModel`,`selectModel`,`answer`,`dismiss`,`approval`,`cancelTask`,`toggle-dock-panel`,`close-dock-panel`,`openAgent`],setup(e,{expose:t,emit:r}){let i=e,a=r,{t:o}=J(),{confirm:l,current:u}=G4(),d=R(null),f=R(null),m=R(null),g=R(null),_=R(!1),y=R(!1),b=R(`50% 100%`),x=R(`active`),S=R(`active`),C=L(()=>Object.values(i.sessionPlans??{}).at(-1)),w=L(()=>d.value?.anyPopupOpen??!1),T=L(()=>[{value:`active`,label:o(`tasks.filterRecent`),icon:`clock`},{value:`running`,label:o(`tasks.filterRunning`),icon:`play`},{value:`done`,label:o(`tasks.filterDone`),icon:`circle-check`},{value:`all`,label:o(`tasks.filterAll`),icon:`list`}]),D=L(()=>(i.todos?.length??0)>0&&i.todoDoneCount===(i.todos?.length??0)),O=L(()=>i.goal?o(`status.goalStatus${i.goal.status[0].toUpperCase()}${i.goal.status.slice(1)}`):``),k=L(()=>{let e=Math.max(0,Math.round((i.goal?.wallClockMs??0)/1e3)),t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t?`${t}${o(`status.timeUnitHour`)} ${n}${o(`status.timeUnitMinute`)}`:n?`${n}${o(`status.timeUnitMinute`)} ${e%60}${o(`status.timeUnitSecond`)}`:`${e}${o(`status.timeUnitSecond`)}`}),A=L(()=>i.bashTasks.some(e=>e.kind===`tool`)?o(`tasks.dockTasks`):o(`tasks.dockBash`));function j(e,t){if(t===`all`)return e;if(t===`running`)return e.filter(e=>e.state===`run`);if(t===`done`)return e.filter(e=>e.state!==`run`);let n=e.filter(e=>e.state===`run`),r=e.filter(e=>e.state!==`run`).toSorted((e,t)=>Date.parse(t.completedAt??t.createdAt??``)-Date.parse(e.completedAt??e.createdAt??``)).slice(0,5);return[...n,...r]}let M=L(()=>j(i.bashTasks,x.value)),N=L(()=>j(i.subagentTasks,S.value));function ee(e,t){let n=t.currentTarget,r=f.value;if(n&&r){let e=n.getBoundingClientRect(),t=r.getBoundingClientRect();b.value=`${e.left+e.width/2-t.left}px 100%`}a(`toggle-dock-panel`,e)}function I(){y.value=(g.value?.scrollTop??0)>0}function te(e){if(!i.dockPanel)return;let t=e.target;!t||m.value?.contains(t)||t.closest(`.ui-pill`)||a(`close-dock-panel`)}function ne(e){i.dockPanel&&(e.key!==`Escape`||e.repeat||e.isComposing||e.defaultPrevented||w.value||u.value||i.overlayOpen||(e.preventDefault(),e.stopImmediatePropagation(),a(`close-dock-panel`)))}async function re(){await l({title:o(`status.goalCancel`),message:o(`status.goalCancelConfirm`),confirmLabel:o(`status.goalCancelConfirmYes`),cancelLabel:o(`status.goalCancelConfirmNo`),variant:`danger`})&&a(`controlGoal`,`cancel`)}function ie(){let e=f.value;if(!e)return;document.documentElement.style.setProperty(`--dock-h`,`${e.offsetHeight}px`);let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--p-bp-sm`))||640;_.value=e.offsetWidth{document.addEventListener(`mousedown`,te,!0),document.addEventListener(`keydown`,ne,!0),typeof ResizeObserver==`function`&&f.value&&(se=new ResizeObserver(()=>{ie(),I()}),se.observe(f.value),ie())}),h(()=>{document.removeEventListener(`mousedown`,te,!0),document.removeEventListener(`keydown`,ne,!0),se?.disconnect()}),s(()=>i.dockPanel,()=>{y.value=!1,n(I)});function ce(e){return d.value?.loadForEdit(e)??!1}function le(e){d.value?.loadAttachmentsForEdit(e)}function ue(){d.value?.focus()}function de(e){d.value?.insertQuote(e)}return t({loadForEdit:ce,loadAttachmentsForEdit:le,insertQuote:de,focus:ue,anyPopupOpen:w,isEmpty:L(()=>d.value?.isEmpty??!0)}),(t,n)=>(c(),W(`div`,{ref_key:`dockRef`,ref:f,class:V([`chat-dock`,[e.mobile?`align-mobile`:`align-center`,{"has-popup":w.value||e.dockPanel,"has-approval":!!e.pendingApproval&&!e.pendingQuestion,"pills-compact":_.value}]]),onClick:n[37]||=H(()=>{},[`stop`])},[v(oe,{name:`dock-panel`},{default:B(()=>[e.dockPanel?(c(),W(`div`,{key:e.dockPanel,ref_key:`workPanelRef`,ref:m,class:V([`dock-work-panel`,[`panel-${e.dockPanel}`,{"body-scrolled-up":y.value}]]),style:ae({transformOrigin:b.value})},[F(`div`,YCe,[e.dockPanel===`bash`?(c(),P(B7,{key:0,icon:`terminal`,title:A.value,meta:`${e.bashRunning} ${z(o)(`tasks.running`)}`},{actions:B(()=>[v(z7,{modelValue:x.value,"onUpdate:modelValue":n[0]||=e=>x.value=e,options:T.value},null,8,[`modelValue`,`options`])]),_:1},8,[`title`,`meta`])):e.dockPanel===`subagent`?(c(),P(B7,{key:1,icon:`sparkles`,title:z(o)(`tasks.dockSubagent`),meta:`${e.subagentRunning} ${z(o)(`tasks.running`)}`},{actions:B(()=>[v(z7,{modelValue:S.value,"onUpdate:modelValue":n[1]||=e=>S.value=e,options:T.value},null,8,[`modelValue`,`options`])]),_:1},8,[`title`,`meta`])):e.dockPanel===`todos`?(c(),P(B7,{key:2,icon:D.value?`check-list`:`list`,title:z(o)(`tasks.todoProgressTitle`),meta:`${e.todoDoneCount}/${e.todos?.length??0}`},null,8,[`icon`,`title`,`meta`])):e.dockPanel===`goal`?(c(),P(B7,{key:3,icon:`target`,title:z(o)(`status.goalLabel`),meta:k.value},{actions:B(()=>[e.goal?.status===`active`?(c(),P(Ca,{key:0,size:`sm`,label:z(o)(`status.goalPause`),onClick:n[2]||=e=>a(`controlGoal`,`pause`)},{default:B(()=>[v(X,{name:`pause`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),e.goal?.status===`paused`||e.goal?.status===`blocked`?(c(),P(Ca,{key:1,size:`sm`,label:z(o)(`status.goalResume`),onClick:n[3]||=e=>a(`controlGoal`,`resume`)},{default:B(()=>[v(X,{name:`play`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),v(Ca,{size:`sm`,label:z(o)(`status.goalCancel`),onClick:re},{default:B(()=>[v(X,{name:`power`,size:`sm`})]),_:1},8,[`label`]),v(Ca,{size:`sm`,label:z(o)(`tasks.closePanel`),onClick:n[4]||=e=>a(`close-dock-panel`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])]),_:1},8,[`title`,`meta`])):(c(),P(B7,{key:4,icon:`file-edit`,title:z(o)(`status.planLabel`),meta:C.value?.reviewState?z(o)(`tools.plan.review.${C.value.reviewState}`):``},{actions:B(()=>[C.value?.path?(c(),P(Ca,{key:0,size:`sm`,label:z(o)(`tools.plan.revealInFileManager`),onClick:n[5]||=t=>void e.revealSavedPlan?.(C.value.agentId,C.value.toolCallId)},{default:B(()=>[v(X,{name:`external-link`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),e.planArmed||e.planMode?(c(),P(Ca,{key:1,size:`sm`,label:z(o)(`status.workModeDismiss`),onClick:n[6]||=e=>a(`togglePlan`)},{default:B(()=>[v(X,{name:`power`,size:`sm`})]),_:1},8,[`label`])):E(``,!0),v(Ca,{size:`sm`,label:z(o)(`tasks.closePanel`),onClick:n[7]||=e=>a(`close-dock-panel`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])]),_:1},8,[`title`,`meta`]))]),F(`div`,{ref_key:`workBodyRef`,ref:g,class:`dock-work-body`,onScroll:I},[e.dockPanel===`bash`?(c(),P(BCe,{key:0,tasks:M.value,filter:x.value,onCancel:n[8]||=e=>a(`cancelTask`,e),onOpen:n[9]||=e=>a(`openAgent`,e)},null,8,[`tasks`,`filter`])):e.dockPanel===`subagent`?(c(),P(OCe,{key:1,tasks:N.value,filter:S.value,onCancel:n[10]||=e=>a(`cancelTask`,e),onOpen:n[11]||=e=>a(`openAgent`,e)},null,8,[`tasks`,`filter`])):e.dockPanel===`todos`?(c(),P(WCe,{key:2,todos:e.todos??[]},null,8,[`todos`])):e.dockPanel===`goal`&&e.goal?(c(),P(jSe,{key:3,goal:e.goal,"open-file":e.openFile},null,8,[`goal`,`open-file`])):(c(),P(VSe,{key:4,plan:C.value,"plan-mode-on":e.planMode,"open-file":e.openFile,"reveal-saved-plan":e.revealSavedPlan},null,8,[`plan`,`plan-mode-on`,`open-file`,`reveal-saved-plan`]))],544)],6)):E(``,!0)]),_:1}),e.hasDockWork||e.planMode||C.value?(c(),W(`div`,XCe,[e.goal?(c(),P(V7,{key:0,icon:`target`,active:e.dockPanel===`goal`,label:`${z(o)(`status.goalLabel`)} ${O.value}`,onClick:n[12]||=e=>ee(`goal`,e)},{meta:B(()=>[F(`span`,{class:V([`dw-goal-status`,`dw-goal-status--${e.goal.status}`])},U(O.value),3)]),default:B(()=>[K(U(z(o)(`status.goalLabel`))+` `,1)]),_:1},8,[`active`,`label`])):E(``,!0),e.planMode||C.value?(c(),P(V7,{key:1,icon:`file-edit`,active:e.dockPanel===`plan`,label:z(o)(`status.planLabel`),onClick:n[13]||=e=>ee(`plan`,e)},{default:B(()=>[K(U(z(o)(`status.planLabel`)),1)]),_:1},8,[`active`,`label`])):E(``,!0),e.bashTasks.length?(c(),P(V7,{key:2,icon:`terminal`,active:e.dockPanel===`bash`,label:A.value,onClick:n[14]||=e=>ee(`bash`,e)},pe({default:B(()=>[K(U(A.value)+` `,1)]),_:2},[e.bashRunning?{name:`meta`,fn:B(()=>[F(`span`,ZCe,[v(R7,{status:`run`}),K(U(e.bashRunning),1)])]),key:`0`}:void 0]),1032,[`active`,`label`])):E(``,!0),e.subagentTasks.length?(c(),P(V7,{key:3,icon:`sparkles`,active:e.dockPanel===`subagent`,label:z(o)(`tasks.dockSubagent`),onClick:n[15]||=e=>ee(`subagent`,e)},pe({default:B(()=>[K(U(z(o)(`tasks.dockSubagent`))+` `,1)]),_:2},[e.subagentRunning?{name:`meta`,fn:B(()=>[F(`span`,QCe,[v(R7,{status:`run`}),K(U(e.subagentRunning),1)])]),key:`0`}:void 0]),1032,[`active`,`label`])):E(``,!0),e.todos?.length?(c(),P(V7,{key:4,icon:D.value?`check-list`:`list`,active:e.dockPanel===`todos`,label:z(o)(`tasks.todoProgressTitle`),onClick:n[16]||=e=>ee(`todos`,e)},{meta:B(()=>[F(`span`,$Ce,U(e.todoDoneCount)+`/`+U(e.todos?.length),1)]),default:B(()=>[K(U(z(o)(`tasks.todoProgressTitle`))+` `,1)]),_:1},8,[`icon`,`active`,`label`])):E(``,!0)])):E(``,!0),e.pendingQuestion?(c(),P(hCe,{key:e.pendingQuestion.questionId,question:e.pendingQuestion,"busy-kind":e.questionBusyKind,onAnswer:n[17]||=(e,t)=>a(`answer`,e,t),onDismiss:n[18]||=e=>a(`dismiss`,e)},null,8,[`question`,`busy-kind`])):e.pendingApproval?(c(),P(DSe,{key:e.pendingApproval.approvalId,class:`dock-approval`,block:e.pendingApproval.block,"agent-name":e.pendingApproval.agentName,busy:e.approvalBusy,onDecide:n[19]||=t=>a(`approval`,e.pendingApproval.approvalId,t)},null,8,[`block`,`agent-name`,`busy`])):(c(),P(L7,{key:3,ref_key:`composerRef`,ref:d,"session-id":e.sessionId,running:e.running,working:e.working,starting:e.starting,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"plan-armed":e.planArmed,"goal-mode":e.goalMode,"tower-mode":e.towerMode,"tower-available":e.towerAvailable,"workflow-active":e.dynamicWorkflowMode,goal:e.goal,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,onSubmit:n[20]||=e=>a(`submit`,e),onSteer:n[21]||=e=>a(`steer`,e),onCommand:n[22]||=e=>a(`command`,e),onInterrupt:n[23]||=e=>a(`interrupt`),onSetPermission:n[24]||=e=>a(`setPermission`,e),onSetThinking:n[25]||=e=>a(`setThinking`,e),onTogglePlan:n[26]||=e=>a(`togglePlan`),onToggleWorkflow:n[27]||=e=>a(`toggleWorkflow`),onToggleGoal:n[28]||=e=>a(`toggleGoal`),onToggleTower:n[29]||=e=>a(`toggleTower`),onOpenBtw:n[30]||=e=>a(`openBtw`),onCreateGoal:n[31]||=e=>a(`createGoal`,e),onControlGoal:n[32]||=e=>a(`controlGoal`,e),onFocusGoal:n[33]||=e=>a(`focusGoal`),onCompact:n[34]||=e=>a(`compact`),onPickModel:n[35]||=e=>a(`pickModel`),onSelectModel:n[36]||=e=>a(`selectModel`,e)},null,8,[`session-id`,`running`,`working`,`starting`,`queued`,`search-files`,`upload-image`,`status`,`thinking`,`plan-mode`,`plan-armed`,`goal-mode`,`tower-mode`,`tower-available`,`workflow-active`,`goal`,`activation-badges`,`models`,`starred-ids`,`skills`]))],2))}}),[[`__scopeId`,`data-v-f219171e`]]),twe=[`aria-label`,`aria-hidden`],nwe=[`data-turn-id`,`tabindex`,`aria-current`,`aria-label`,`onMouseenter`,`onFocus`,`onKeydown`,`onClick`],rwe=[`aria-label`],iwe={class:`toc-preview__prompt`},awe={key:0,class:`toc-preview__response`},owe=80,swe=Y(G({__name:`ConversationToc`,props:{items:{},activeTurnId:{},mobile:{type:Boolean},sessionLoading:{type:Boolean},occluded:{type:Boolean}},emits:[`select`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null),l=R(null),u=R(null),d=R(!0),f=null;function p(){let e=o.value,t=e?.offsetParent;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();d.value=n.left>=r.left&&n.right<=r.right}let m=L(()=>!r.mobile&&!r.sessionLoading&&r.items.length>1),h=L(()=>l.value!==null&&r.items.some(e=>e.id===l.value)?l.value:r.activeTurnId!==null&&r.items.some(e=>e.id===r.activeTurnId)?r.activeTurnId:r.items[0]?.id??null),g=L(()=>u.value??l.value??r.activeTurnId),v=L(()=>{let e=u.value??l.value;return e===null?void 0:r.items.find(t=>t.id===e)}),y=R(0),b=null;function x(){b!==null&&clearTimeout(b),b=null}function S(){x(),b=setTimeout(()=>{u.value=null,b=null},owe)}function C(){return o.value===null?[]:Array.from(o.value.querySelectorAll(`.toc-row`))}function w(e,t){let n=e;if(t.key===`ArrowDown`)n=Math.min(r.items.length-1,e+1);else if(t.key===`ArrowUp`)n=Math.max(0,e-1);else if(t.key===`Home`)n=0;else if(t.key===`End`)n=r.items.length-1;else return;t.preventDefault(),C()[n]?.focus()}function T(e){let t=e??C().find(e=>e.dataset.turnId===v.value?.id),n=t?.parentElement;!t||!n||(y.value=t.offsetTop-n.scrollTop+t.offsetHeight/2)}function D(e,t){x(),u.value=e,T(t.currentTarget)}function O(e,t){x(),l.value=e,T(t.currentTarget)}function k(e){x();let t=document.activeElement;t instanceof HTMLElement&&o.value?.contains(t)&&t.blur(),u.value=null,l.value=null,i(`select`,e)}function A(e){let t=e.relatedTarget;(!(t instanceof Node)||!o.value?.contains(t))&&(l.value=null)}return s(m,e=>{f?.disconnect(),f=null,e&&n(()=>{let e=o.value,t=e?.offsetParent;!e||!t||(typeof ResizeObserver<`u`&&(f=new ResizeObserver(p),f.observe(t)),p())})},{immediate:!0}),s([()=>r.activeTurnId,m],([e,t])=>{!t||e===null||n(()=>{let t=C().find(t=>t.dataset.turnId===e);typeof t?.scrollIntoView==`function`&&t.scrollIntoView({block:`nearest`})})},{immediate:!0}),ne(()=>{x(),f?.disconnect(),f=null}),(t,n)=>m.value?(c(),W(`nav`,{key:0,ref_key:`navRef`,ref:o,class:V([`conversation-toc`,{"toc-clipped":!d.value||e.occluded}]),"aria-label":z(a)(`conversation.toc`),"aria-hidden":d.value&&!e.occluded?void 0:!0,onMouseenter:x,onMouseleave:S,onFocusout:A},[F(`div`,{class:`toc-scroll`,onScroll:n[0]||=e=>T()},[(c(!0),W(M,null,_(e.items,(t,r)=>(c(),W(`button`,{key:t.id,type:`button`,class:V([`toc-row`,{active:e.activeTurnId===t.id,highlighted:g.value===t.id,previewing:u.value===t.id||l.value===t.id}]),"data-turn-id":t.id,tabindex:h.value===t.id?0:-1,"aria-current":e.activeTurnId===t.id?`location`:void 0,"aria-label":t.title,onMouseenter:e=>D(t.id,e),onFocus:e=>O(t.id,e),onKeydown:e=>w(r,e),onClick:e=>k(t.id)},[...n[2]||=[F(`span`,{class:`toc-marker`,"aria-hidden":`true`},null,-1)]],42,nwe))),128))],32),v.value?(c(),W(`button`,{key:0,type:`button`,class:`toc-preview`,style:ae({top:`${y.value}px`}),"aria-label":v.value.title,tabindex:`-1`,onMouseenter:x,onClick:n[1]||=e=>k(v.value.id)},[F(`span`,iwe,U(v.value.title),1),v.value.preview?(c(),W(`span`,awe,U(v.value.preview),1)):E(``,!0)],44,rwe)):E(``,!0)],42,twe)):E(``,!0)}}),[[`__scopeId`,`data-v-8a1c40d2`]]),H7=`script, style, noscript, template, [inert], .top-sentinel`,U7=`pythinker-transcript-search`,W7=`pythinker-transcript-search-current`,cwe=1e3;function lwe(e){return e===`pre`||e===`pre-wrap`||e===`break-spaces`?`preserve`:e===`pre-line`?`pre-line`:`collapse`}function uwe(e,t){if(t===`preserve`)return{text:e,map:Array.from({length:e.length},(e,t)=>t)};let n=t===`collapse`?/[\t\n\f\r ]/:/[\t ]/,r=``,i=[],a=!1;for(let t=0;tG7(e.text)),r=[],i=``;for(let t=0;t0&&e[t].gapBefore&&(i+=`\0`),r[t]=i.length,i+=n[t].folded;let a=fwe(G7(t).folded);if(a===null)return;let o=new RegExp(a,`g`);function s(e){let t=0,n=r.length-1,i=0;for(;t<=n;){let a=t+n>>1;r[a]<=e?(i=a,t=a+1):n=a-1}return i}let c;for(;;){let e=o.exec(i);if(e===null)return;let t=e.index,a=t+e[0].length-1,l=s(t),u=s(a),d=n[l].map[t-r[l]],f=n[u].map[a-r[u]],p={startSegment:l,startOffset:d.start,endSegment:u,endOffset:f.start+f.length};(c?.startSegment!==p.startSegment||c.startOffset!==p.startOffset||c.endSegment!==p.endSegment||c.endOffset!==p.endOffset)&&(c=p,yield p)}}var mwe=new Set(`ADDRESS.ARTICLE.ASIDE.BLOCKQUOTE.BR.DD.DIV.DL.DT.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.H1.H2.H3.H4.H5.H6.HEADER.HR.LI.MAIN.NAV.OL.P.PRE.SECTION.TABLE.TBODY.TD.TFOOT.TH.THEAD.TR.UL`.split(`.`)),hwe=new Set([`inline`,`inline-block`,`inline-flex`,`inline-grid`,`inline-table`,`contents`,`ruby`]);function gwe(e,t){let n=t.get(e);if(n!==void 0)return n;let r=mwe.has(e.tagName)||!hwe.has(getComputedStyle(e).display);return t.set(e,r),r}function _we(e,t,n){let r=e.parentElement;for(;r!==null&&r!==t&&!gwe(r,n);)r=r.parentElement;return r??t}function vwe(e){let t=e.ownerDocument,n=t.defaultView?.NodeFilter??NodeFilter,r=t.createTreeWalker(e,n.SHOW_ELEMENT|n.SHOW_TEXT,{acceptNode(e){if(e.nodeType!==Node.ELEMENT_NODE)return n.FILTER_ACCEPT;let t=e;return t.matches(H7)?n.FILTER_REJECT:t.matches(`br, hr, wbr`)&&!t.closest(H7)?n.FILTER_ACCEPT:n.FILTER_SKIP}}),i=new WeakMap,a=new WeakMap,o=[],s=!1;for(let t=r.nextNode();t!==null;t=r.nextNode()){if(t.nodeType===Node.ELEMENT_NODE){s=!0;continue}let n=t.nodeValue??``;if(n.length===0)continue;let r=t.parentElement;if(r===null)continue;let c=a.get(r);c===void 0&&(c=lwe(getComputedStyle(r).whiteSpace),a.set(r,c));let{text:l,map:u}=uwe(n,c);if(l.length===0)continue;let d=_we(t,e,i),f=o.at(-1),p=s||f===void 0||f.block!==d;!p&&f.text.endsWith(` `)&&l.startsWith(` `)&&(l=l.slice(1),u=u.slice(1),l.length===0)||(o.push({text:l,gapBefore:p,node:t,block:d,whitespaceMap:u}),s=!1)}return o}function ywe(e,t){if(t.length===0)return[];let n=vwe(e),r=[];for(let i of pwe(n,t)){let t=n[i.startSegment],a=n[i.endSegment],o=e.ownerDocument.createRange();o.setStart(t.node,t.whitespaceMap[i.startOffset]),o.setEnd(a.node,a.whitespaceMap[i.endOffset-1]+1),r.push(o)}return r}function bwe(e,t,n=e=>e.getClientRects().length!==0){let r=[];for(let i of ywe(e,t))if(n(i)){if(r.length>=cwe)return{ranges:r,truncated:!0};r.push(i)}return{ranges:r,truncated:!1}}function K7(){return globalThis.CSS?.highlights??null}function q7(e,t){let n=K7(),r=globalThis.Highlight;if(!n||!r)return;if(e.length===0){J7();return}let i=new r;for(let t of e)i.add(t);n.set(U7,i);let a=e[t];if(a){let e=new r;e.add(a),n.set(W7,e)}else n.delete(W7)}function J7(){let e=K7();e?.delete(U7),e?.delete(W7)}var xwe={class:`tsearch-main`},Swe=[`placeholder`],Cwe=[`inert`],wwe={class:`tsearch-foot`},Twe={class:`tsearch-count`,"aria-live":`polite`},Ewe={class:`tsearch-rings`},Dwe=Y(G({__name:`TranscriptSearch`,props:{pane:{},mobile:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=S(`input`),s=ue(``),u=ue(!1),d=ue([]),f=ue(0),m=ue(!1),g=ue(!1),y=ue([]),b=L(()=>d.value.length),x=L(()=>s.value.trim()!==``),C=L(()=>{if(u.value)return a(`conversation.search.searching`);if(!x.value)return``;if(b.value===0)return a(`conversation.search.noResults`);let e={current:f.value+1,total:b.value};return m.value?a(`conversation.search.resultsCapped`,e):a(`conversation.search.results`,e)}),w=null,T=null,D=null,O=null,k=null;function A(){return r.pane.querySelector(`.chat`)}function j(){let e=d.value[f.value];if(!e){y.value=[];return}let t=r.pane.getBoundingClientRect();y.value=Array.from(e.getClientRects(),e=>({top:`${e.top-t.top+r.pane.scrollTop}px`,left:`${e.left-t.left}px`,width:`${e.width}px`,height:`${e.height}px`}))}function N(){y.value.length!==0&&(D!==null&&clearTimeout(D),D=setTimeout(()=>{D=null,j()},120))}function I(e){let t=r.pane.getBoundingClientRect().top,n=e.findIndex(e=>{let n=e.getClientRects(),r=n[n.length-1];return r!==void 0&&r.bottom>=t});return n===-1?0:n}function te(){let e=d.value[f.value];q7(d.value,f.value),(e?.startContainer instanceof Element?e.startContainer:e?.startContainer.parentElement)?.scrollIntoView({block:`center`}),j()}function ne(e=`first`){w!==null&&(clearTimeout(w),w=null),u.value=!1;let t=A(),n=s.value.trim();if(!t||n===``){d.value=[],m.value=!1,f.value=0,J7(),j();return}let r=d.value[f.value],i=r?.startContainer,a=r?.startOffset,o=bwe(t,n);if(d.value=o.ranges,m.value=o.truncated,o.ranges.length===0){f.value=0,J7(),j();return}if(e!==!1){let t=I(o.ranges);f.value=e===`backward`?(t-1+o.ranges.length)%o.ranges.length:t,te();return}let c=o.ranges.findIndex(e=>e.startContainer===i&&e.startOffset===a);f.value=c>=0?c:I(o.ranges),q7(o.ranges,f.value),j()}function re(){if(w!==null&&clearTimeout(w),s.value.trim()===``){u.value=!1,ne();return}u.value=!0,w=setTimeout(()=>ne(),150)}function ie(e){b.value!==0&&(f.value=(f.value+e+b.value)%b.value,te())}function oe(e){if(!(e.key!==`Enter`||g.value||e.isComposing)){if(e.preventDefault(),w!==null){ne(e.shiftKey?`backward`:`first`);return}ie(e.shiftKey?-1:1)}}function R(e){e.key!==`Escape`||g.value||e.isComposing||(e.preventDefault(),e.stopPropagation(),i(`close`))}function se(e){return e instanceof Element&&(e.classList.contains(`tsearch-rings`)||e.closest(`.tsearch-rings`)!==null)}function ce(e){if(e.type===`attributes`&&e.target===r.pane||se(e.target))return!0;if(e.type!==`childList`)return!1;let t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(se)}function le(e){s.value.trim()===``||e.every(ce)||w!==null||(T!==null&&clearTimeout(T),T=setTimeout(()=>{T=null,w===null&&ne(!1)},150))}return p(()=>{if(n(()=>o.value?.focus()),typeof MutationObserver==`function`&&(O=new MutationObserver(le),O.observe(r.pane,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`inert`,`style`,`class`]})),r.pane.addEventListener(`scroll`,N,{passive:!0}),window.addEventListener(`resize`,N,{passive:!0}),typeof ResizeObserver==`function`){k=new ResizeObserver(j),k.observe(r.pane);let e=r.pane.querySelector(`.content-wrap`);e&&k.observe(e)}}),h(()=>{w!==null&&clearTimeout(w),T!==null&&clearTimeout(T),D!==null&&clearTimeout(D),O?.disconnect(),k?.disconnect(),r.pane.removeEventListener(`scroll`,N),window.removeEventListener(`resize`,N),J7()}),(t,n)=>(c(),W(`div`,{class:V([`tsearch`,{mobile:e.mobile}]),role:`search`,onKeydown:R},[F(`div`,xwe,[v(X,{class:`tsearch-icon`,name:`search`,size:`sm`,"aria-hidden":`true`}),l(F(`input`,{ref:`input`,"onUpdate:modelValue":n[0]||=e=>s.value=e,type:`text`,class:`tsearch-input`,placeholder:z(a)(`conversation.search.placeholder`),autocapitalize:`off`,autocomplete:`off`,spellcheck:`false`,onInput:re,onKeydown:oe,onCompositionstart:n[1]||=e=>g.value=!0,onCompositionend:n[2]||=e=>g.value=!1},null,40,Swe),[[de,s.value]]),u.value?(c(),P(op,{key:0,class:`tsearch-spin`,size:`sm`,label:z(a)(`conversation.search.searching`)},null,8,[`label`])):E(``,!0),n[6]||=F(`span`,{class:`tsearch-sep`,"aria-hidden":`true`},null,-1),v(Ca,{class:`tsearch-close`,size:`sm`,label:z(a)(`conversation.search.close`),onClick:n[3]||=e=>i(`close`)},{default:B(()=>[v(X,{name:`close`})]),_:1},8,[`label`])]),F(`div`,{class:V([`tsearch-foot-wrap`,{open:x.value}]),inert:!x.value},[F(`div`,wwe,[v(Ca,{size:`sm`,label:z(a)(`conversation.search.previous`),disabled:b.value===0,onClick:n[4]||=e=>ie(-1)},{default:B(()=>[v(X,{name:`arrow-up`})]),_:1},8,[`label`,`disabled`]),v(Ca,{size:`sm`,label:z(a)(`conversation.search.next`),disabled:b.value===0,onClick:n[5]||=e=>ie(1)},{default:B(()=>[v(X,{name:`arrow-down`})]),_:1},8,[`label`,`disabled`]),F(`span`,Twe,U(C.value),1)])],10,Cwe),(c(),P(ee,{to:e.pane},[F(`div`,Ewe,[(c(!0),W(M,null,_(y.value,(e,t)=>(c(),W(`div`,{key:t,class:`tsearch-ring`,style:ae(e)},null,4))),128))])],8,[`to`]))],34))}}),[[`__scopeId`,`data-v-d7187e08`]]),Owe={class:`ui-action-toast-host`},kwe={class:`ui-action-toast__body`},Y7=Y(G({__name:`ActionToast`,props:{duration:{default:8e3},dismissLabel:{},dismissToken:{}},emits:[`dismiss`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=null,a=0,o=e.duration;function s(t){if(t<=0){n(`dismiss`,e.dismissToken);return}i=setTimeout(()=>n(`dismiss`,e.dismissToken),t),a=Date.now()+t}function l(){i!==null&&(clearTimeout(i),i=null,o=Math.max(0,a-Date.now()))}function u(){i===null&&s(o)}return s(e.duration),h(()=>{i!==null&&clearTimeout(i)}),(t,i)=>(c(),W(`div`,Owe,[F(`div`,{class:`ui-action-toast`,role:`status`,onPointerenter:l,onPointerleave:u},[F(`span`,kwe,[me(t.$slots,`default`,{},void 0,!0)]),v(Ca,{class:`ui-action-toast__close`,size:`sm`,label:e.dismissLabel??z(r)(`common.dismiss`),tooltip:e.dismissLabel??z(r)(`common.dismiss`),onClick:i[0]||=t=>n(`dismiss`,e.dismissToken)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`tooltip`])],32)]))}}),[[`__scopeId`,`data-v-c5370888`]]),Awe={key:0,class:`ws-guide-arrow__label`},jwe=Y(G({__name:`WorkspaceGuideArrow`,props:{label:{default:``},direction:{default:`left`}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ws-guide-arrow`,`dir-${e.direction}`]),"aria-hidden":`true`},[n[0]||=F(`svg`,{class:`ws-guide-arrow__svg`,viewBox:`0 0 40 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[F(`path`,{d:`M 37 8 C 25 4, 13 8, 4 8`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),F(`path`,{d:`M 8 5 L 3 8 L 8 11`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1),e.label?(c(),W(`span`,Awe,U(e.label),1)):E(``,!0)],2))}}),[[`__scopeId`,`data-v-3c957040`]]);function Mwe(e,t=2e4){let n=R(`${e}?r=0`),r=0,i=setInterval(()=>{r+=1,n.value=`${e}?r=${r}`},t);return h(()=>clearInterval(i)),n}var Nwe=[`src`,`alt`,`role`],X7=Y(G({__name:`PythinkerLogo`,props:{size:{default:`sm`},animated:{type:Boolean,default:!0},label:{default:`Pythinker Code`},interactive:{type:Boolean,default:!1}},emits:[`click`],setup(e,{emit:t}){let n=Mwe(`/brand/mascot-waving.png`),r=e,i=t;function a(){r.interactive&&i(`click`)}return(t,r)=>(c(),W(`img`,{src:e.animated?z(n):`/brand/icon.svg`,class:V([`pythinker-logo`,[`size-${e.size}`,{interactive:e.interactive}]]),alt:e.label,role:e.interactive?`button`:`img`,onClick:a},null,10,Nwe))}}),[[`__scopeId`,`data-v-58c4fde0`]]);function Pwe(e,t,n,r=5){if(n||e.length<=r)return e;let i=e.slice(0,r);if(t&&!i.some(e=>e.id===t)){let n=e.find(e=>e.id===t);n&&(i[r-1]=n)}return i}var Fwe={key:0,class:`recent`},Iwe={class:`recent-caption`},Lwe=[`onClick`],Rwe={class:`recent-title`},zwe={class:`recent-time`},Bwe={class:`recent-foot`},Vwe=Y(G({__name:`WorkspaceRecentSessions`,props:{sessions:{}},emits:[`select`,`openSessionAdmin`],setup(e,{emit:t}){let n=t,{t:r}=J();return(t,i)=>e.sessions.length?(c(),W(`section`,Fwe,[F(`h2`,Iwe,U(z(r)(`sessions.recentSessions`)),1),(c(!0),W(M,null,_(e.sessions,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`recent-row`,onClick:t=>n(`select`,e.id)},[F(`span`,{class:V([`recent-ico`,e.archived?`recent-ico--done`:`recent-ico--open`])},[v(X,{name:e.archived?`circle-check`:`circle-dashed`,size:`sm`},null,8,[`name`])],2),F(`span`,Rwe,U(e.title),1),F(`span`,zwe,U(e.time),1)],8,Lwe))),128)),F(`div`,Bwe,[v(Sp,{text:z(r)(`conversation.sessionAdminTooltip`)},{default:B(()=>[F(`button`,{type:`button`,class:`recent-more`,onClick:i[0]||=e=>n(`openSessionAdmin`)},[K(U(z(r)(`conversation.viewMoreSessions`))+` `,1),v(X,{name:`chevron-down`,size:`sm`})])]),_:1},8,[`text`])])])):E(``,!0)}}),[[`__scopeId`,`data-v-cd5a729d`]]),Hwe={class:`chat-layout`},Uwe={class:`empty-hint`},Wwe={key:0,class:`empty-hint-text`},Gwe={key:1,class:`ws-pick`},Kwe={class:`ws-pick-name`},qwe={key:2,class:`ws-pick-menu`},Jwe=[`onClick`],Ywe={class:`ws-pick-item-name`},Xwe={class:`ws-pick-item-path`},Zwe=[`aria-label`],Qwe=48,Z7=80,Q7=1e3,$we=420,eTe=3e3,tTe=Y(G({__name:`ConversationPane`,props:{turns:{},expertTalkRuns:{},sessionId:{},approvals:{},gitInfo:{},tasks:{},todos:{},goal:{},activationBadges:{},status:{},thinking:{},planMode:{type:Boolean},planArmed:{type:Boolean},sessionPlans:{},overlayOpen:{type:Boolean},goalMode:{type:Boolean},towerMode:{type:Boolean},towerAvailable:{type:Boolean},dynamicWorkflowMode:{type:Boolean},questions:{},pendingQuestionActions:{},pendingApprovalActions:{},running:{type:Boolean},turnActive:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},changes:{},fileReloadKey:{},working:{type:Boolean},starting:{type:Boolean},fastMoon:{type:Boolean},mobile:{type:Boolean},sessionLoading:{type:Boolean},compaction:{},hasMoreMessages:{type:Boolean},loadingMore:{type:Boolean},loadingMoreError:{type:Boolean},loadOlderMessages:{type:Function},models:{},starredIds:{},skills:{},workspaceName:{},workspaceRoot:{},gitDiffStats:{},workspaces:{},activeWorkspaceId:{},sessionTitle:{},pr:{},conversationToc:{type:Boolean},turnFolding:{type:Boolean},activityRunFolding:{type:Boolean},lastTurnReason:{},turnErrorKind:{},turnErrorMessage:{},sessionDone:{type:Boolean},pinned:{type:Boolean},recentSessions:{},revealSavedPlan:{type:Function},panelVisible:{type:Boolean},panelExpanded:{type:Boolean},activePanelType:{},togglePanel:{type:Function}},emits:`submit.steer.approval.cancelTask.answer.dismiss.command.interrupt.unqueue.editQueued.reorderQueue.steerQueued.setPermission.setThinking.togglePlan.toggleWorkflow.toggleGoal.toggleTower.createGoal.controlGoal.compact.pickModel.selectModel.openFile.openMedia.takeExpertTalk.buildExpertTalk.openCompaction.openAgent.detachTask.openToolDiff.openTurnDiff.openChanges.refreshGitStatus.editMessage.selectWorkspace.addWorkspace.openPr.renameSession.forkSession.archiveSession.restoreSession.selectSession.exportSession.togglePin.openSessionAdmin`.split(`.`),setup(e,{expose:t,emit:i}){let{t:a}=J(),o=e,l=i,u=R(!1),f=R(!1),g=L(()=>o.workspaces?.find(e=>e.id===o.activeWorkspaceId)?.name??o.workspaceName??``),y=L(()=>(o.workspaces?.length??0)>0),b=L(()=>Pwe(o.workspaces??[],o.activeWorkspaceId,f.value)),x=L(()=>(o.workspaces?.length??0)-b.value.length);s(u,e=>{e||(f.value=!1)});function S(e){u.value=!1,e!==o.activeWorkspaceId&&l(`selectWorkspace`,e)}Zi(qi.contentAlign);let C=R(null),w=R(null),T=R(null),D=R(!1),O=null;function k(e,t){let n=T.value??w.value;return!n||n.loadForEdit(e)===!1?!1:(n.loadAttachmentsForEdit(t??[]),!0)}function A(){D.value=!0,O!==null&&clearTimeout(O),O=setTimeout(()=>{O=null,D.value=!1},2e3)}function j(){o.goal&&(fe.value=`goal`)}let N=L(()=>o.tasks.filter(e=>e.kind===`bash`||e.kind===`tool`&&!e.id.startsWith(`question-`))),I=L(()=>o.tasks.filter(e=>e.kind===`subagent`&&e.runInBackground)),te=L(()=>N.value.filter(e=>e.state===`run`).length),ne=L(()=>I.value.filter(e=>e.state===`run`).length);function re(e){let t=o.tasks,n=t.find(t=>t.id===e)??t.find(t=>t.parentToolCallId===e);if(n)return n.id;let r=t.filter(e=>e.kind===`subagent`&&!e.parentToolCallId);if(r.length===1)return r[0].id}d(`resolveAgentTaskId`,re);function ie(e){let t=o.tasks.filter(t=>t.id===e||t.parentToolCallId===e);if(t.length!==0)return t.some(e=>e.state===`run`&&e.runInBackground!==!0)}d(`resolveDetachableTask`,ie);let se=m(`modelDisplay`),ce=m(`subagentEffort`);function le(e){let t=re(e);if(t===void 0)return;let n=o.tasks.find(e=>e.id===t||e.agentId===t),r=se?.(n?.model),i=ce?.(n?.thinkingEffort);if(!(r===void 0&&i===void 0))return{display:r,effort:i}}d(`resolveAgentModel`,le),d(`resolvePlan`,e=>o.sessionPlans?.[e]),d(`revealSavedPlan`,(e,t)=>o.revealSavedPlan?.(e,t)??Promise.resolve(!1)),d(`pinScroll`,ft);let ue=L(()=>(o.todos??[]).filter(e=>e.status===`done`).length),de=L(()=>o.goal!==null&&o.goal!==void 0||N.value.length>0||I.value.length>0||(o.todos?.length??0)>0),fe=R(null),G=L(()=>o.gitInfo?o.changes?.length??0:0);function pe(e){fe.value=fe.value===e?null:e}function me(){fe.value=null}s([fe,()=>o.goal,N,I,()=>o.todos,()=>o.planMode,()=>o.sessionPlans],()=>{(fe.value===`goal`&&!o.goal||fe.value===`bash`&&N.value.length===0||fe.value===`subagent`&&I.value.length===0||fe.value===`todos`&&(o.todos?.length??0)===0||fe.value===`plan`&&!o.planMode&&Object.keys(o.sessionPlans??{}).length===0)&&me()});function he(e){if(e.role===`compaction`)return a(`conversation.compactedPlain`);if(e.role===`user`){if(e.skillActivation)return`/${e.skillActivation.name}`;if(e.pluginCommand)return`/${e.pluginCommand.pluginId}:${e.pluginCommand.commandName}`;let t=e.text.trim().replaceAll(/\s+/g,` `);return t.length>0?t:`user`}let t=(e.text||e.thinking||``).trim().replaceAll(/\s+/g,` `);return t.length>0?t:(e.tools?.length??0)>0?`${e.tools.length} tools`:`pythinker`}function ge(e){for(let t=e+1;t0)return n}return``}let _e=L(()=>{let e=0;return o.turns.flatMap((t,n)=>t.role===`user`?(e+=1,[{id:t.id,role:t.role,no:e,title:he(t),preview:ge(n)}]):[])}),ve=R(null);function ye(){let e=Oe.value;if(!e)return;let t=e.querySelectorAll(`.turn-anchor[data-turn-id]`);if(t.length===0)return;let n=_e.value;if(n.length===0)return;let r=new Set(n.map(e=>e.id));if(Re.value&&Be()<=Z7){ve.value=n[n.length-1].id;return}let i=e.getBoundingClientRect(),a=i.height/2,o=null;t.forEach(e=>{let t=e.dataset.turnId;!t||!r.has(t)||e.getBoundingClientRect().top-i.top<=a&&(o=t)}),ve.value=o??n[0].id}let be=R(!1),xe=0;function Se(){xe||=at(()=>{xe=0,Ce()})}function Ce(){let e=Oe.value,t=!o.mobile&&o.conversationToc&&e?e.closest(`.con`)?.querySelector(`.conversation-toc`):null,n=t?.querySelector(`.toc-marker`),r=!1;if(e&&t&&n){let i=n.getBoundingClientRect(),a=t.getBoundingClientRect(),o=i.left+i.width/2;r=Array.from(e.querySelectorAll(`.table-node-wrapper`)).some(e=>{let t=e.getBoundingClientRect();return t.left<=o&&o<=t.right&&t.topa.top})}be.value!==r&&(be.value=r)}let we=L(()=>o.questions&&o.questions.length>0?o.questions[0]:void 0),Te=L(()=>{let e=we.value;if(e)return o.pendingQuestionActions?.[e.questionId]}),Ee=L(()=>o.approvals&&o.approvals.length>0?o.approvals[0]:void 0),De=L(()=>{let e=Ee.value;return e?!!o.pendingApprovalActions?.[e.approvalId]:!1}),Oe=R(null),ke=R(!1),Ae=R(null),je=R(0),Me=R(0),q=L(()=>({"--panes-scrollbar-width":`${je.value}px`})),Ne=L(()=>({"--chat-dock-height":`${Me.value+Qwe}px`}));function Pe(e){return e instanceof HTMLElement?e:e&&`$el`in e&&e.$el instanceof HTMLElement?e.$el:null}function Fe(){let e=Oe.value;je.value=e?Math.max(0,e.offsetWidth-e.clientWidth):0,Me.value=Ae.value?.offsetHeight??0}function Ie(e){let t=Pe(e);Oe.value=t,t&&Gt()}function Le(e){Ae.value=Pe(e)??null,e&&`loadForEdit`in e&&typeof e.loadForEdit==`function`&&`focus`in e&&typeof e.focus==`function`?T.value={loadForEdit:e.loadForEdit.bind(e),loadAttachmentsForEdit:`loadAttachmentsForEdit`in e&&typeof e.loadAttachmentsForEdit==`function`?e.loadAttachmentsForEdit.bind(e):()=>{},insertQuote:`insertQuote`in e&&typeof e.insertQuote==`function`?e.insertQuote.bind(e):()=>{},focus:e.focus.bind(e)}:T.value=null,Wt()}let Re=R(!0),ze=R(!1);function Be(){let e=Oe.value;return e?e.scrollHeight-e.scrollTop-e.clientHeight:0}let Ve=0,He=0,Ue=0,We=0,Ge=0,Ke=0;function qe(){return Date.now()1?(Re.value=!1,ze.value=!0):n<=Z7&&t>Ve+1&&(Re.value=!0,ze.value=!1),Ve=t,ye()}function Ye(e=!1){let t=Oe.value;Re.value=!0,ze.value=!1,t&&(!e&&performance.now()({node:t,top:Xe(e,t)})),r=n.findIndex(e=>e.top>=t),i=r<0?Math.max(0,n.length-1):r;return n.slice(i,i+2).flatMap(e=>{let t=e.node.dataset.scrollAnchorId,n=t??e.node.dataset.turnId;return n?[{kind:t?`tool`:`turn`,id:n,top:e.top}]:[]})}let Qe=new Map;function $e(e,t){for(let n of t.anchors){let t=n.kind===`tool`?`data-scroll-anchor-id`:`data-turn-id`,r=e.querySelector(`[${t}="${nt(n.id)}"]`);if(r)return Xe(e,r)-n.top}return e.scrollHeight-t.oldHeight}function et(e,t,n=e.scrollTop){return e.scrollTop=n+$e(e,t),Ve=e.scrollTop,e.scrollTop}async function tt(){if(!o.sessionId||!o.loadOlderMessages||o.loadingMore||jt.value||!o.hasMoreMessages)return;let e=o.sessionId,t=Oe.value,r=t?.scrollTop??0,i={anchors:t?Ze(t,r):[],oldHeight:t?.scrollHeight??0};Mt(e,!0),Pt();try{if(await n(),await o.loadOlderMessages(e),await n(),o.sessionId!==e){Qe.set(e,i);return}let t=Oe.value;if(!t)return;et(t,i),Qe.delete(e)}finally{Mt(e,!1)}}function nt(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replaceAll(/["\\]/g,`\\$&`)}function rt(e){let t=Oe.value;if(!t)return;let n=t.querySelector(`.turn-anchor[data-turn-id="${nt(e)}"]`);n&&(Ft(),Re.value=!1,ve.value=e,ze.value=Be()>Z7,n.scrollIntoView({behavior:`smooth`,block:`center`}))}function it(){let e=Oe.value;if(!e)return`none`;let t=e.firstElementChild,n=t instanceof HTMLElement?t.offsetHeight:0,r=Ae.value?.offsetHeight??0;return`${e.scrollHeight}:${e.clientHeight}:${n}:${r}`}function at(e){return typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,16)}function ot(e){typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e)}let st=0,ct=0,lt=null,ut=0;function dt(){return performance.now(){if(ct=0,performance.now()>=st||!lt){lt=null;return}let e=lt.getBoundingClientRect().top-ut;e&&(n.scrollTop+=e),ct=at(r)};ct=at(r)}function pt(e=36){if(!Re.value&&!qe())return;let t=++Ke,n=``,r=0,i=0;Ge&&=(ot(Ge),0);let a=()=>{if(Ge=0,t!==Ke||!Re.value&&!qe())return;Ye(!1);let o=it();r=o===n?r+1:0,n=o,i++,r<3&&i0&&t.length>=e.length&&e.firstId!==t.firstId&&e.lastId===t.lastId&&e.lastTextLen===t.lastTextLen&&e.lastThinkingLen===t.lastThinkingLen&&e.lastToolsLen===t.lastToolsLen&&e.approvalIds===t.approvalIds}s(L(()=>{let e=(o.approvals??[]).map(e=>e.approvalId).join(`,`),t=o.turns,n=t.at(-1),r=n?.thinking?.length??0,i=n?.tools?.reduce((e,t)=>e+t.name.length+(t.arg?.length??0)+(t.output?.join(``).length??0),0)??0;return{length:t.length,firstId:t[0]?.id??``,lastId:n?.id??``,lastTextLen:n?.text.length??0,lastThinkingLen:r,lastToolsLen:i,approvalIds:e}}),async(e,t)=>{if(jt.value&&mt(t,e)){ye();return}await n(),Re.value||qe()?Ye(e.length{Wt()}),s(()=>o.mobile,async()=>{await n(),Fe()});let ht=new Map;s(()=>o.fileReloadKey,async(e,t)=>{let r=Oe.value;t&&r&&ht.set(String(t),{top:r.scrollTop,following:Re.value}),Ft(),await n();let i=Oe.value,a=e?ht.get(String(e)):void 0;if(a&&i){let t=Qe.get(String(e)),n=t?et(i,t,a.top):a.top;t&&Qe.delete(String(e)),Re.value=a.following,i.scrollTop=n,Ve=i.scrollTop,ze.value=!a.following&&Be()>1,a.following&&pt()}else Re.value=!0,Ve=0,Ye(!1),pt();ye()}),s(()=>o.sessionLoading,async(e,t)=>{e||!t||(Re.value=!0,await n(),pt(),ye())}),s(()=>o.turnActive,async(e,t)=>{e||!t||!Re.value&&!qe()||(await n(),pt(48),ye())});function gt(){Re.value=!0,ze.value=!1,He=Date.now()+Q7,n(()=>{Ye(!0),pt(16)})}function _t(e){gt(),l(`submit`,e)}function vt(e){Re.value=!0,ze.value=!1,He=Date.now()+Q7,l(`editMessage`,e)}function yt(e){let t=o.queued?.[e];k(t?.text??``,t?.attachments)&&l(`editQueued`,e)}function bt(e){l(`reorderQueue`,e)}function xt(e,t){gt(),l(`answer`,e,t)}function St(e,t){!e||!t||l(`approval`,e,t)}let Ct=null,wt=null,Tt=null,Et=null,Dt=0,Ot=0,kt=0,At=R(new Set),jt=L(()=>!!o.sessionId&&At.value.has(o.sessionId));function Mt(e,t){let n=new Set(At.value);t?n.add(e):n.delete(e),At.value=n}function Nt(){jt.value||(kt||=at(()=>{kt=0,!jt.value&&(dt()||(Re.value||qe())&&Ye(!1))}))}function Pt(){Ke++,Ge&&=(ot(Ge),0),kt&&=(ot(kt),0)}function Ft(){let e=Oe.value;if(He=0,Pt(),st=0,lt=null,e){let t=e.scrollTop;typeof e.scrollTo==`function`?e.scrollTo({top:t,behavior:`auto`}):e.scrollTop=t}We=0,Ue=-1/0,e&&(Ve=e.scrollTop)}function It(){let e=Oe.value;!e||e.scrollHeight-e.clientHeight<=1&&!o.hasMoreMessages||(Re.value=!1,Ft(),e.scrollHeight-e.clientHeight>1&&(ze.value=!0))}function Lt(e){let t=Oe.value;if(!t)return!1;for(let n of e.composedPath()){if(n===t)return!1;if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight+1&&n.scrollTop>1)return!0}return!1}function Rt(e){e.defaultPrevented||e.ctrlKey||e.shiftKey||e.deltaY>=0||Lt(e)||It()}function zt(e){let t=Oe.value;if(!t||e.defaultPrevented||e.button!==0||e.pointerType===`touch`)return;let n=t.getBoundingClientRect(),r=t.offsetWidth-t.clientWidth,i=r>0?r:12;e.target===t&&e.clientX>=n.right-i&&It()}let Bt=null;function Vt(e){Bt=e.touches.length===1?e.touches[0].clientY:null}function Ht(e){let t=e.touches.length===1?e.touches[0].clientY:null;t!==null&&Bt!==null&&t>Bt+2&&!Lt(e)&&It(),Bt=t}function Ut(){if(!wt)return;let e=Oe.value?.firstElementChild??null;e!==Tt&&(Tt&&wt.unobserve(Tt),Tt=e,e&&wt.observe(e))}function Wt(){if(!wt)return;let e=Ae.value;e!==Et&&(Et&&wt.unobserve(Et),Et=e,e&&wt.observe(e))}function Gt(){let e=Oe.value;Fe(),Ct&&(Ct.disconnect(),e&&Ct.observe(e,{childList:!0,subtree:!0,characterData:!0})),wt&&(wt.disconnect(),Tt=null,Et=null,e&&wt.observe(e),Ut(),Wt()),Dt=e?.scrollHeight??0,Ot=e?.clientHeight??0,Se()}function Kt(){Ut(),Nt(),Se()}function qt(){typeof document>`u`||document.visibilityState===`visible`&&Re.value&&pt()}let Jt=R(!1),Yt=R(0);function Xt(){Yt.value+=1,Jt.value=!0}function Zt(){Xt(),l(`interrupt`)}function Qt(e){if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`f`){if(o.overlayOpen)return;e.preventDefault(),ke.value=!0,n(()=>{Oe.value?.closest(`.con`)?.querySelector(`.tsearch-input`)?.focus()});return}e.key===`Escape`&&(o.running||o.working)&&(e.preventDefault(),Zt())}function $t(){ke.value=!1,n(()=>Oe.value?.focus({preventScroll:!0}))}function en(){Re.value&&Nt()}p(()=>{n(()=>{typeof MutationObserver==`function`&&(Ct=new MutationObserver(Kt)),typeof ResizeObserver==`function`&&(wt=new ResizeObserver(()=>{Se(),Fe();let e=Oe.value;if(!e)return;let{scrollHeight:t,clientHeight:n}=e,r=t>Dt+1,i=n{Ct&&Ct.disconnect(),wt&&wt.disconnect(),kt&&ot(kt),Ge&&ot(Ge),ct&&ot(ct),xe&&ot(xe),O!==null&&(clearTimeout(O),O=null),typeof document<`u`&&(document.removeEventListener(`visibilitychange`,qt),document.removeEventListener(`keydown`,Qt)),window.visualViewport?.removeEventListener(`resize`,en)});function tn(){(T.value??w.value)?.focus()}function nn(e){(T.value??w.value)?.insertQuote(e)}return t({loadComposerForEdit:k,focusComposer:tn,insertComposerQuote:nn}),(t,n)=>{let i=r(`IconButton`);return c(),W(`section`,{class:V([`con`,{mobile:e.mobile,"toc-enabled":e.conversationToc}]),style:ae(Ne.value)},[ke.value&&Oe.value?(c(),P(Dwe,{key:0,pane:Oe.value,mobile:e.mobile,onClose:$t},null,8,[`pane`,`mobile`])):E(``,!0),!e.mobile&&!(e.turns.length===0&&!e.sessionLoading)?(c(),P(Nde,{key:1,"session-id":e.sessionId,"workspace-name":e.workspaceName,"workspace-root":e.workspaceRoot,"session-title":e.sessionTitle,branch:e.gitInfo?.branch,ahead:e.gitInfo?.ahead,behind:e.gitInfo?.behind,"changes-count":G.value,"git-diff-stats":e.gitDiffStats,"is-git-repo":!!e.gitInfo,pr:e.pr,copied:D.value,"session-done":e.sessionDone,pinned:e.pinned,"panel-visible":e.panelVisible,onOpenChanges:n[0]||=e=>l(`openChanges`),onCopyAll:n[1]||=e=>C.value?.copyConversation(),onCopyFinalSummary:n[2]||=e=>C.value?.copyFinalSummary(),onOpenPr:n[3]||=t=>e.pr&&l(`openPr`,e.pr.url),onRenameSession:n[4]||=(e,t)=>l(`renameSession`,e,t),onForkSession:n[5]||=e=>l(`forkSession`,e),onTogglePin:n[6]||=e=>l(`togglePin`,e),onArchiveSession:n[7]||=e=>l(`archiveSession`,e),onRestoreSession:n[8]||=e=>l(`restoreSession`,e),onExportSession:n[9]||=e=>l(`exportSession`,e),onTogglePanel:n[10]||=t=>e.togglePanel?.()},null,8,[`session-id`,`workspace-name`,`workspace-root`,`session-title`,`branch`,`ahead`,`behind`,`changes-count`,`git-diff-stats`,`is-git-repo`,`pr`,`copied`,`session-done`,`pinned`,`panel-visible`])):E(``,!0),!e.mobile&&!e.panelVisible&&e.turns.length===0&&!e.sessionLoading?(c(),P(i,{key:2,class:`empty-panel-btn`,label:z(a)(`panel.openPanel`),onClick:n[11]||=t=>e.togglePanel?.()},{default:B(()=>[v(X,{name:`panel-expand-right`})]),_:1},8,[`label`])):E(``,!0),e.conversationToc?(c(),P(swe,{key:3,items:_e.value,"active-turn-id":ve.value,mobile:e.mobile,"session-loading":e.sessionLoading,occluded:be.value,onSelect:rt},null,8,[`items`,`active-turn-id`,`mobile`,`session-loading`,`occluded`])):E(``,!0),F(`div`,Hwe,[F(`div`,{ref:Ie,class:V([`panes chat-scroll`,{"is-following":Re.value,"history-prepending":jt.value}]),tabindex:`-1`,onScrollPassive:Je,onWheelPassive:Rt,onPointerdownPassive:zt,onTouchstartPassive:Vt,onTouchmovePassive:Ht},[F(`div`,{class:V([`content-wrap`,[e.mobile?`align-mobile`:`align-center`]])},[e.turns.length===0&&!e.sessionLoading?(c(),W(M,{key:0},[n[69]||=F(`div`,{class:`empty-spacer`},null,-1),F(`div`,Uwe,[F(`span`,{class:V([`empty-hint-title`,{"is-starting":e.starting}])},[e.starting?(c(),P(op,{key:0,size:`sm`})):(c(),P(X7,{key:1,size:`md`,label:``,"aria-hidden":`true`})),F(`span`,null,U(e.starting?z(a)(`conversation.starting`):z(a)(`composer.emptyConversationTitle`)),1)],2),e.starting?E(``,!0):(c(),W(`span`,Wwe,U(z(a)(`composer.emptyConversation`)),1)),y.value&&!e.starting?(c(),W(`div`,Gwe,[v(Sp,{text:z(a)(`conversation.switchWorkspace`)},{default:B(()=>[F(`button`,{type:`button`,class:`ws-pick-btn`,onClick:n[12]||=H(e=>u.value=!u.value,[`stop`])},[v(X,{name:`folder`,size:`sm`}),F(`span`,Kwe,U(g.value),1),v(X,{class:V([`ws-pick-chev`,{open:u.value}]),name:`chevron-down`,size:`sm`},null,8,[`class`])])]),_:1},8,[`text`]),u.value?E(``,!0):(c(),P(jwe,{key:0,class:`ws-pick-arrow`,label:z(a)(`conversation.workingDirectory`)},null,8,[`label`])),u.value?(c(),W(`div`,{key:1,class:`ws-pick-backdrop`,onClick:n[13]||=e=>u.value=!1})):E(``,!0),u.value?(c(),W(`div`,qwe,[(c(!0),W(M,null,_(b.value,t=>(c(),W(`button`,{key:t.id,type:`button`,class:V([`ws-pick-item`,{on:t.id===e.activeWorkspaceId}]),onClick:H(e=>S(t.id),[`stop`])},[F(`span`,Ywe,U(t.name),1),F(`span`,Xwe,U(t.shortPath),1)],10,Jwe))),128)),x.value>0?(c(),W(`button`,{key:0,type:`button`,class:`ws-pick-item ws-pick-more`,onClick:n[14]||=H(e=>f.value=!f.value,[`stop`])},[F(`span`,null,U(z(a)(`conversation.moreWorkspaces`,{count:x.value})),1)])):E(``,!0),n[68]||=F(`div`,{class:`ws-pick-divider`},null,-1),F(`button`,{type:`button`,class:`ws-pick-action`,onClick:n[15]||=H(e=>{u.value=!1,l(`addWorkspace`)},[`stop`])},[v(X,{name:`plus`,size:`sm`}),F(`span`,null,U(z(a)(`conversation.addWorkspace`)),1)])])):E(``,!0)])):e.starting?E(``,!0):(c(),W(`button`,{key:2,type:`button`,class:`empty-add-workspace`,onClick:n[16]||=e=>l(`addWorkspace`)},[v(X,{name:`folder-plus`,size:`sm`}),F(`span`,null,U(z(a)(`conversation.addWorkspace`)),1)]))]),e.sessionId?E(``,!0):(c(),P(Vwe,{key:0,sessions:e.recentSessions??[],onSelect:n[17]||=e=>l(`selectSession`,e),onOpenSessionAdmin:n[18]||=e=>l(`openSessionAdmin`)},null,8,[`sessions`])),v(L7,{ref_key:`emptyComposerRef`,ref:w,class:`empty-composer`,"session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"goal-mode":e.goalMode,"tower-mode":e.towerMode,"tower-available":e.towerAvailable,"workflow-active":e.dynamicWorkflowMode,goal:e.goal,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,starting:e.starting,"hide-context":``,onSubmit:_t,onSteer:n[19]||=e=>l(`steer`,e),onCommand:n[20]||=e=>l(`command`,e),onInterrupt:Zt,onUnqueue:n[21]||=e=>l(`unqueue`,e),onEditQueued:n[22]||=e=>l(`editQueued`,e),onSetPermission:n[23]||=e=>l(`setPermission`,e),onSetThinking:n[24]||=e=>l(`setThinking`,e),onTogglePlan:n[25]||=e=>l(`togglePlan`),onToggleWorkflow:n[26]||=e=>l(`toggleWorkflow`),onToggleGoal:n[27]||=e=>l(`toggleGoal`),onToggleTower:n[28]||=e=>l(`toggleTower`),onOpenBtw:n[29]||=e=>l(`command`,`/btw`),onCreateGoal:n[30]||=e=>l(`createGoal`,e),onControlGoal:n[31]||=e=>l(`controlGoal`,e),onFocusGoal:j,onCompact:n[32]||=e=>l(`compact`),onPickModel:n[33]||=e=>l(`pickModel`),onSelectModel:n[34]||=e=>l(`selectModel`,e)},null,8,[`session-id`,`running`,`queued`,`search-files`,`upload-image`,`status`,`thinking`,`plan-mode`,`goal-mode`,`tower-mode`,`tower-available`,`workflow-active`,`goal`,`activation-badges`,`models`,`starred-ids`,`skills`,`starting`]),n[70]||=F(`div`,{class:`empty-spacer`},null,-1)],64)):(c(),P(J4,{ref_key:`chatPaneRef`,ref:C,key:e.fileReloadKey??`no-session`,turns:e.turns,"expert-talk-runs":e.expertTalkRuns,"expert-talk-models":e.models,approvals:e.approvals,questions:e.questions,"turn-active":e.turnActive,working:e.working,"fast-moon":e.fastMoon,"session-loading":e.sessionLoading,compaction:e.compaction,"has-more-messages":e.hasMoreMessages,"loading-more":e.loadingMore,"loading-more-error":e.loadingMoreError,"is-following":Re.value,"tool-diff-panel":!0,"turn-folding":e.turnFolding??!0,"activity-run-folding":e.activityRunFolding??!0,"last-turn-reason":e.lastTurnReason,"turn-error-kind":e.turnErrorKind,"turn-error-message":e.turnErrorMessage,cwd:e.workspaceRoot,queued:e.queued,onOpenFile:n[35]||=e=>l(`openFile`,e),onOpenMedia:n[36]||=e=>l(`openMedia`,e),onTakeExpertTalk:n[37]||=e=>l(`takeExpertTalk`,e),onBuildExpertTalk:n[38]||=e=>l(`buildExpertTalk`,e),onCopyConversationCopied:A,onOpenCompaction:n[39]||=e=>l(`openCompaction`,e),onOpenAgent:n[40]||=e=>l(`openAgent`,e),onDetachTask:n[41]||=e=>l(`detachTask`,e),onOpenToolDiff:n[42]||=e=>l(`openToolDiff`,e),onOpenTurnDiff:n[43]||=e=>l(`openTurnDiff`,e),onEditMessage:vt,onLoadOlderMessages:tt,onUnqueue:n[44]||=e=>l(`unqueue`,e),onEditQueued:yt,onReorderQueue:bt,onSteerQueued:n[45]||=e=>l(`steerQueued`,e),onContinueTurn:n[46]||=e=>_t({text:e,attachments:[]})},null,8,[`turns`,`expert-talk-runs`,`expert-talk-models`,`approvals`,`questions`,`turn-active`,`working`,`fast-moon`,`session-loading`,`compaction`,`has-more-messages`,`loading-more`,`loading-more-error`,`is-following`,`turn-folding`,`activity-run-folding`,`last-turn-reason`,`turn-error-kind`,`turn-error-message`,`cwd`,`queued`]))],2)],34),(c(),P(ee,{defer:``,to:`.pfc-host`,disabled:!e.panelExpanded||e.activePanelType===`btw`},[e.turns.length===0&&!e.sessionLoading?E(``,!0):(c(),P(ewe,{key:0,ref:Le,style:ae(q.value),"session-id":e.sessionId,running:e.running,starting:e.starting,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"plan-armed":e.planArmed,working:e.working,"goal-mode":e.goalMode,"tower-mode":e.towerMode,"tower-available":e.towerAvailable,"dynamic-workflow-mode":e.dynamicWorkflowMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,goal:e.goal,"session-plans":e.sessionPlans,"overlay-open":e.overlayOpen,"open-file":e=>l(`openFile`,e),"reveal-saved-plan":e.revealSavedPlan,"dock-panel":fe.value,"bash-tasks":N.value,"subagent-tasks":I.value,"bash-running":te.value,"subagent-running":ne.value,"todo-done-count":ue.value,"has-dock-work":de.value,todos:e.todos,"pending-question":we.value,"question-busy-kind":Te.value,"pending-approval":Ee.value,"approval-busy":De.value,mobile:e.mobile,onToggleDockPanel:n[47]||=e=>pe(e),onCloseDockPanel:n[48]||=e=>me(),onOpenAgent:n[49]||=e=>l(`openAgent`,e),onAnswer:xt,onDismiss:n[50]||=e=>l(`dismiss`,e),onApproval:St,onCancelTask:n[51]||=e=>l(`cancelTask`,e),onControlGoal:n[52]||=e=>l(`controlGoal`,e),onSubmit:_t,onSteer:n[53]||=e=>l(`steer`,e),onCommand:n[54]||=e=>l(`command`,e),onInterrupt:Zt,onSetPermission:n[55]||=e=>l(`setPermission`,e),onSetThinking:n[56]||=e=>l(`setThinking`,e),onTogglePlan:n[57]||=e=>l(`togglePlan`),onToggleWorkflow:n[58]||=e=>l(`toggleWorkflow`),onToggleGoal:n[59]||=e=>l(`toggleGoal`),onToggleTower:n[60]||=e=>l(`toggleTower`),onOpenBtw:n[61]||=e=>l(`command`,`/btw`),onCreateGoal:n[62]||=e=>l(`createGoal`,e),onFocusGoal:j,onCompact:n[63]||=e=>l(`compact`),onPickModel:n[64]||=e=>l(`pickModel`),onSelectModel:n[65]||=e=>l(`selectModel`,e)},null,8,`style.session-id.running.starting.queued.search-files.upload-image.status.thinking.plan-mode.plan-armed.working.goal-mode.tower-mode.tower-available.dynamic-workflow-mode.activation-badges.models.starred-ids.skills.goal.session-plans.overlay-open.open-file.reveal-saved-plan.dock-panel.bash-tasks.subagent-tasks.bash-running.subagent-running.todo-done-count.has-dock-work.todos.pending-question.question-busy-kind.pending-approval.approval-busy.mobile`.split(`.`)))],8,[`disabled`]))]),v(oe,{name:`pill`},{default:B(()=>[ze.value?(c(),W(`button`,{key:0,class:`newmsg-pill`,style:ae({bottom:`${Me.value+12}px`}),"aria-label":z(a)(`conversation.jumpToLatestAria`),onClick:n[66]||=e=>Ye(!0)},[v(X,{class:`pill-chevron`,name:`chevron-down`,size:`md`}),K(` `+U(z(a)(`conversation.newMessages`)),1)],12,Zwe)):E(``,!0)]),_:1}),Jt.value?(c(),P(Y7,{key:Yt.value,duration:eTe,onDismiss:n[67]||=e=>Jt.value=!1},{default:B(()=>[K(U(z(a)(`conversation.manuallyAborted`)),1)]),_:1})):E(``,!0)],6)}}}),[[`__scopeId`,`data-v-52f9eb6f`]]),nTe=[`role`,`aria-label`],rTe={key:0,class:`sab-comment`},iTe=[`placeholder`],aTe=[`disabled`],oTe=Y(G({__name:`SelectionActionBar`,props:{enabled:{type:Boolean},panelSource:{}},emits:[`add`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(!1),s=R(!1),u=R(``),d=R(``),f=R(),m=R({}),g=R(null),_=R(null),y=0;function b(){o.value=!1,s.value=!1,u.value=``}function x(e){let t=e.commonAncestorContainer;return t.nodeType===Node.ELEMENT_NODE?t:t.parentElement}function S(){if(y=0,!r.enabled||s.value&&g.value?.contains(document.activeElement))return;let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed){b();return}let t=e.getRangeAt(0),n=x(t),i=n?.closest(`.con, .pt-body`);if(!n||!i||n.closest(`.sab, input, textarea, button, [contenteditable="true"]`)){b();return}let a=e.toString().trim(),c=t.getBoundingClientRect();if(!a||c.width===0&&c.height===0){b();return}d.value=a,f.value=i.classList.contains(`pt-body`)?r.panelSource:void 0;let l=Math.min(window.innerWidth-220-8,Math.max(8,c.left+c.width/2-220/2)),u=c.bottom+8;m.value={left:`${Math.round(l)}px`,top:`${Math.round(u)}px`,width:`220px`},o.value=!0,s.value=!1}function C(){y&&cancelAnimationFrame(y),y=requestAnimationFrame(S)}function w(){window.getSelection()?.removeAllRanges()}function T(e){let t=d.value.trim();if(!t)return;let n=e?.trim();i(`add`,{quote:t,comment:n||void 0,source:f.value}),w(),b()}function D(){s.value=!0,n(()=>_.value?.focus())}function O(e){if(s.value||e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(g.value?.querySelectorAll(`.sab-action`)??[]),n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}function k(e){!o.value||g.value?.contains(e.target)||b()}function A(e){e.key===`Escape`&&o.value&&(e.preventDefault(),e.stopImmediatePropagation(),b())}return p(()=>{document.addEventListener(`selectionchange`,C),document.addEventListener(`pointerdown`,k,!0),document.addEventListener(`keydown`,A,!0)}),h(()=>{y&&cancelAnimationFrame(y),document.removeEventListener(`selectionchange`,C),document.removeEventListener(`pointerdown`,k,!0),document.removeEventListener(`keydown`,A,!0)}),(e,t)=>(c(),P(ee,{to:`body`},[o.value?(c(),W(`div`,{key:0,ref_key:`barRef`,ref:g,class:`sab`,style:ae(m.value),role:s.value?`dialog`:`menu`,"aria-label":s.value?z(a)(`selection.comment`):void 0,onPointerdown:t[4]||=H(()=>{},[`prevent`]),onKeydown:O},[s.value?(c(),W(`div`,rTe,[l(F(`input`,{ref_key:`commentInputRef`,ref:_,"onUpdate:modelValue":t[0]||=e=>u.value=e,placeholder:z(a)(`selection.commentPlaceholder`),onKeydown:t[1]||=ie(H(e=>T(u.value),[`prevent`]),[`enter`])},null,40,iTe),[[de,u.value]]),F(`button`,{type:`button`,disabled:!u.value.trim(),onClick:t[2]||=e=>T(u.value)},U(z(a)(`selection.confirm`)),9,aTe)])):(c(),W(M,{key:1},[F(`button`,{type:`button`,class:`sab-action`,role:`menuitem`,onClick:D},[v(X,{name:`message`,size:`sm`}),F(`span`,null,U(z(a)(`selection.comment`)),1)]),F(`button`,{type:`button`,class:`sab-action`,role:`menuitem`,onClick:t[3]||=e=>T()},[v(X,{name:`plus`,size:`sm`}),F(`span`,null,U(z(a)(`selection.addToChat`)),1)])],64))],44,nTe)):E(``,!0)]))}}),[[`__scopeId`,`data-v-d37e8069`]]),sTe=[`aria-label`],cTe={class:`media-lightbox-card`},lTe=[`src`,`alt`],uTe=[`src`],dTe={key:0,class:`media-preview-caption`},fTe=Y(G({__name:`MediaLightbox`,props:{media:{},src:{},originImg:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=[`a[href]`,`area[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`),a=S(`overlay`),o=S(`close`),s=S(`image`),l=L(()=>n.media.kind===`image`),u=L(()=>n.media.path??(l.value?`Image preview`:`Video preview`)),d=ue(1),f=ue(0),m=ue(0),g=ue(!1),_=L(()=>({transform:`translate(${f.value}px, ${m.value}px) scale(${d.value})`,cursor:d.value>1?g.value?`grabbing`:`grab`:`zoom-in`})),y=null,b=null,x=0,C=0,w=0,T=0,{lock:D,unlock:O}=N7();function k(){d.value=1,f.value=0,m.value=0}function A(e){if(!l.value)return;e.preventDefault();let t=Math.min(8,Math.max(1,d.value*(e.deltaY<0?1.1:.9)));d.value=t,t===1&&(f.value=0,m.value=0)}function j(){if(d.value!==1){k();return}let e=s.value;e&&(d.value=Math.min(8,Math.max(1,e.naturalWidth/e.clientWidth)))}function M(e){d.value<=1||(b=e.pointerId,x=e.clientX,C=e.clientY,w=f.value,T=m.value,g.value=!0,s.value?.setPointerCapture(e.pointerId))}function N(e){b===e.pointerId&&(f.value=w+e.clientX-x,m.value=T+e.clientY-C)}function I(e){b===e.pointerId&&(s.value?.releasePointerCapture(e.pointerId),b=null,g.value=!1)}function te(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),r(`close`);return}if(e.key!==`Tab`||!a.value)return;let t=a.value.querySelectorAll(i),n=t[0],o=t[t.length-1];!n||!o||(a.value.contains(document.activeElement)?e.shiftKey&&document.activeElement===n?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),n.focus()):(e.preventDefault(),(e.shiftKey?o:n).focus()))}return p(()=>{D(),y=document.activeElement instanceof HTMLElement?document.activeElement:n.originImg??null,window.addEventListener(`keydown`,te),o.value?.focus()}),h(()=>{O(),window.removeEventListener(`keydown`,te),y?.focus()}),(t,n)=>(c(),P(ee,{to:`body`},[F(`div`,{ref:`overlay`,class:`media-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":u.value,onMousedown:n[1]||=H(e=>r(`close`),[`self`])},[F(`button`,{ref:`close`,type:`button`,class:`media-lightbox-close`,"aria-label":`Close`,onClick:n[0]||=e=>r(`close`)},[v(X,{name:`close`,size:`sm`})],512),F(`div`,cTe,[F(`div`,{class:`media-lightbox-frame`,onWheel:A},[l.value?(c(),W(`img`,{key:0,ref:`image`,class:`media-lightbox-media`,src:e.src,alt:e.media.path??``,draggable:`false`,style:ae(_.value),onDblclick:j,onPointerdown:M,onPointermove:N,onPointerup:I,onPointercancel:I},null,44,lTe)):(c(),W(`video`,{key:1,class:`media-lightbox-media`,src:e.src,controls:``,autoplay:``},null,8,uTe))],32)]),e.media.path?(c(),W(`div`,dTe,U(e.media.path),1)):E(``,!0)],40,sTe)]))}}),[[`__scopeId`,`data-v-a5036dce`]]),pTe={class:`ui-panel-header__main`},mTe={class:`ui-panel-header__title`},hTe={key:0,class:`ui-panel-header__sub`},$7=Y(G({__name:`PanelHeader`,props:{title:{},subtitle:{},closable:{type:Boolean,default:!0},closeLabel:{default:`Close`},wrap:{type:Boolean}},emits:[`close`],setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-panel-header`,{wrap:e.wrap}])},[F(`div`,pTe,[F(`span`,mTe,U(e.title),1),v(Sp,{text:e.subtitle},{default:B(()=>[e.subtitle?(c(),W(`span`,hTe,U(e.subtitle),1)):E(``,!0)]),_:1},8,[`text`]),me(t.$slots,`default`,{},void 0,!0)]),e.closable?(c(),P(Ca,{key:0,class:`ui-panel-header__close`,size:`sm`,label:e.closeLabel,onClick:n[0]||=e=>t.$emit(`close`)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`])):E(``,!0)],2))}}),[[`__scopeId`,`data-v-47211810`]]),gTe={key:0,class:`fp-empty fp-error`},_Te={key:1,class:`fp-empty`},vTe={key:2,class:`fp-loading`},yTe={class:`fp-path`},bTe={class:`fp-meta`},xTe={key:0,class:`fp-lines`},STe={class:`fp-size`},CTe={key:3,class:`fp-search`},wTe=[`placeholder`],TTe={key:0,class:`fp-search-count`},ETe={key:1,class:`fp-code`},DTe={class:`fp-line-table`},OTe=[`data-line`],kTe={class:`fp-gutter`},ATe=[`innerHTML`],jTe={key:1,class:`fp-body fp-code`},MTe={class:`fp-line-table`},NTe=[`data-line`],PTe={class:`fp-gutter`},FTe=[`innerHTML`],ITe={key:2,class:`fp-body`},LTe=[`srcdoc`,`title`],RTe={key:1,class:`fp-code`},zTe={class:`fp-line-table`},BTe=[`data-line`],VTe={class:`fp-gutter`},HTe=[`innerHTML`],UTe={key:3,class:`fp-body fp-pdf-wrap`},WTe=[`src`,`title`],GTe={key:1,class:`fp-binary-card`},KTe={class:`fp-binary-label`},qTe={key:4,class:`fp-body fp-table-wrap`},JTe={class:`fp-table`},YTe=[`data-line`],XTe={key:5,class:`fp-body fp-image-wrap`},ZTe=[`src`,`alt`],QTe={key:1,class:`fp-binary-card`},$Te={class:`fp-binary-icon`},eEe={class:`fp-binary-label`},tEe={key:6,class:`fp-body fp-image-wrap`},nEe=[`src`],rEe={key:1,class:`fp-binary-card`},iEe={class:`fp-binary-icon`},aEe={class:`fp-binary-label`},oEe={key:7,class:`fp-body fp-code`},sEe={class:`fp-line-table`},cEe=[`data-line`],lEe={class:`fp-gutter`},uEe=[`innerHTML`],dEe={key:8,class:`fp-body fp-binary-wrap`},fEe={class:`fp-binary-card`},pEe={class:`fp-binary-icon`},mEe={class:`fp-binary-label`},hEe=Y(G({__name:`FilePreview`,props:{file:{},loading:{type:Boolean},error:{},line:{},downloadUrl:{},closable:{type:Boolean},externalActions:{type:Boolean},stale:{type:Boolean},refreshing:{type:Boolean},editable:{type:Boolean},openFile:{type:Function}},emits:[`close`,`openExternal`,`reveal`,`openEditor`,`refresh`],setup(e,{emit:t}){let{t:r}=J();function i(e,t){let n=t?t.split(`/`).filter(Boolean):[];for(let t of e.split(`/`))t===``||t===`.`||(t===`..`?n.pop():n.push(t));return n.join(`/`)}let a=m(`resolveImage`,async e=>e),o=L(()=>{let e=h.file?.path??``,t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``});function u(e){if(/^(https?:|data:|blob:)/i.test(e)||e.startsWith(`/`))return e;let t=o.value;return t?i(e,t):e}async function f(e){let t=u(e);return a?a(t):t}d(`resolveImage`,f);function p(e){let t=e.path;if(/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(t)||t.startsWith(`/`))return e;for(let e of[`#`,`?`]){let n=t.indexOf(e);n!==-1&&(t=t.slice(0,n))}let n=o.value;return{...e,path:i(t,n)}}let h=e,g=L(()=>{let e=h.file;return e!==null&&!e.isBinary}),y=t;function b(e){h.openFile?.(p(e))}let x=R(null),S=L(()=>{let e=h.file;if(!e)return`binary`;let t=e.mime??``,n=e.languageId??``,r=e.path.toLowerCase();return t===`text/markdown`||n===`markdown`||n===`md`||r.endsWith(`.mdx`)?`markdown`:t===`application/json`||n===`json`?`json`:t===`text/html`||n===`html`||r.endsWith(`.html`)||r.endsWith(`.htm`)?`html`:t===`application/pdf`||r.endsWith(`.pdf`)?`pdf`:t===`text/csv`||n===`csv`||r.endsWith(`.csv`)?`csv`:t.startsWith(`image/`)?`image`:t.startsWith(`video/`)?`video`:e.isBinary?`binary`:t.startsWith(`text/`)||n!==``?`text`:`binary`});function C(e){let t=atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder().decode(n)}let w=L(()=>{let e=h.file;if(!e)return``;if(e.encoding===`base64`)try{return C(e.content)}catch{return e.content}return e.content}),T=L(()=>{if(S.value!==`json`||!h.file)return``;try{return JSON.stringify(JSON.parse(w.value),null,2)}catch{return w.value}}),D=L(()=>h.file?(S.value===`json`?T.value:w.value).split(` +`):[]),O=L(()=>h.file?S.value===`json`?T.value:w.value:``),k=R(``),A=R(0),j=L(()=>{let e=k.value.trim().toLowerCase();if(!e)return[];let t=[];return D.value.forEach((n,r)=>{n.toLowerCase().includes(e)&&t.push(r+1)}),t});s(k,()=>{A.value=0});function N(e,t=!1){e&&n(()=>{let n=x.value?.querySelector(`.fp-body`),r=n?.querySelector(`[data-line="${e}"]`);if(!n||!r)return;t&&(n.scrollTop=0);let i=n.getBoundingClientRect(),a=r.getBoundingClientRect();n.scrollTop=a.top-i.top+n.scrollTop-n.clientHeight/2+a.height/2})}s(()=>[h.file?.path,h.line],()=>N(h.line,!0),{immediate:!0});function ee(e){let t=j.value;t.length!==0&&(A.value=(A.value+e+t.length)%t.length,N(t[A.value]))}function I(e){let t=j.value;return{target:h.line===e,hit:t.includes(e),active:t[A.value]===e}}function te(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}let ne=R(!1),re=R(!1);function ie(){h.file&&Wi(O.value).then(e=>{e&&(ne.value=!0,setTimeout(()=>{ne.value=!1},1400))})}function oe(){h.file&&Wi(h.file.path).then(e=>{e&&(re.value=!0,setTimeout(()=>{re.value=!1},1400))})}let se=R(`preview`),ce=R(`preview`),le=R(`fit`);function ue(e){se.value=e}function fe(e){ce.value=e}function H(e){le.value=e}s(S,e=>{se.value=e===`html`?`preview`:`source`,ce.value=`preview`,le.value=`fit`});let G=L(()=>{let e=h.file;return!e||S.value!==`image`?null:e.sourceUrl?e.sourceUrl:e.encoding===`base64`?`data:${e.mime};base64,${e.content}`:e.mime===`image/svg+xml`?`data:${e.mime};charset=utf-8,${encodeURIComponent(e.content)}`:null}),pe=L(()=>{let e=h.file;return!e||S.value!==`video`?null:e.sourceUrl?e.sourceUrl:e.encoding===`base64`?`data:${e.mime};base64,${e.content}`:null}),me=L(()=>{let e=h.file;return!e||S.value!==`pdf`?null:h.downloadUrl?h.downloadUrl:e.encoding===`base64`?`data:${e.mime};base64,${e.content}`:null}),he=L(()=>h.file?[``,``,``,w.value].join(``):``);function ge(e){let t=[],n=``,r=!1;for(let i=0;iD.value.slice(0,200).map(ge));function ve(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`)}function ye(){let e=h.file;return e?e.languageId?.toLowerCase()||(e.path.split(`.`).pop()?.toLowerCase()??``):``}function be(e){let t=ye(),n=ve(e);return S.value===`json`||t===`json`||t===`jsonc`?(n=n.replace(/("[^&]*?")(\s*:)/g,`$1$2`),n=n.replace(/(:\s*)("[^&]*?")/g,`$1$2`),n=n.replace(/\b(true|false|null)\b/g,`$1`),n=n.replace(/(:\s*)(-?\d+(?:\.\d+)?)/g,`$1$2`),n):S.value===`html`||t===`html`||t===`xml`||t===`svg`?(n=n.replace(/\s([A-Za-z_:][-A-Za-z0-9_:.]*)(=)/g,` $1$2`),n=n.replace(/(".*?")/g,`$1`),n=n.replace(/(<\/?)([A-Za-z][\w:-]*)/g,`$1$2`),n):(n=n.replace(/\b(async|await|break|case|catch|class|const|continue|else|export|extends|finally|for|from|function|if|import|interface|let|new|return|switch|throw|try|type|while)\b/g,`$1`),n=n.replace(/(".*?"|'.*?')/g,`$1`),n=n.replace(/(\/\/.*)$/g,`$1`),n)}function xe(e,t=55){return!e||e.length<=t?e:`…`+e.slice(e.length-t+1)}return(t,n)=>(c(),W(`div`,{ref_key:`rootRef`,ref:x,class:`file-preview`},[e.error&&!e.loading?(c(),W(`div`,gTe,[F(`span`,null,U(e.error),1),e.closable?(c(),P(pD,{key:0,variant:`secondary`,size:`sm`,onClick:n[0]||=e=>y(`close`)},{default:B(()=>[K(U(z(r)(`filePreview.close`)),1)]),_:1})):E(``,!0)])):!e.file&&!e.loading?(c(),W(`div`,_Te,U(z(r)(`filePreview.empty`)),1)):e.loading?(c(),W(`div`,vTe,[n[9]||=F(`span`,{class:`spinner`},null,-1),F(`span`,null,U(z(r)(`filePreview.loading`)),1)])):e.file?(c(),W(M,{key:3},[v($7,{wrap:``,title:z(r)(`common.preview`),closable:e.closable,"close-label":z(r)(`filePreview.close`),class:V({"fp-refreshing":e.refreshing}),onClose:n[8]||=e=>y(`close`)},{default:B(()=>[v(Sp,{text:e.file.path},{default:B(()=>[F(`span`,yTe,U(xe(e.file.path)),1)]),_:1},8,[`text`]),F(`span`,bTe,[e.file.lineCount?(c(),W(`span`,xTe,U(z(r)(`filePreview.lineCount`,{count:e.file.lineCount})),1)):E(``,!0),F(`span`,STe,U(te(e.file.size)),1)]),v(pD,{variant:`secondary`,size:`sm`,class:`fp-refresh`,style:ae({visibility:e.stale?`visible`:`hidden`}),"aria-label":z(r)(`filePreview.refresh`),disabled:!e.stale||e.refreshing,onClick:n[1]||=e=>y(`refresh`)},{default:B(()=>[v(X,{name:`refresh`,size:`sm`}),K(` `+U(z(r)(`filePreview.refresh`)),1)]),_:1},8,[`style`,`aria-label`,`disabled`]),S.value===`html`?(c(),P(o6,{key:0,"model-value":se.value,size:`sm`,options:[{value:`preview`,label:z(r)(`filePreview.preview`)},{value:`source`,label:z(r)(`filePreview.source`)}],"onUpdate:modelValue":ue},null,8,[`model-value`,`options`])):E(``,!0),S.value===`markdown`?(c(),P(o6,{key:1,"model-value":ce.value,size:`sm`,options:[{value:`preview`,label:z(r)(`filePreview.preview`)},{value:`source`,label:z(r)(`filePreview.source`)}],"onUpdate:modelValue":fe},null,8,[`model-value`,`options`])):E(``,!0),S.value===`image`?(c(),P(o6,{key:2,"model-value":le.value,size:`sm`,options:[{value:`fit`,label:z(r)(`filePreview.fit`)},{value:`actual`,label:z(r)(`filePreview.actual`)}],"onUpdate:modelValue":H},null,8,[`model-value`,`options`])):E(``,!0),S.value===`text`||S.value===`json`||S.value===`html`||S.value===`csv`?(c(),W(`div`,CTe,[l(F(`input`,{"onUpdate:modelValue":n[2]||=e=>k.value=e,class:`fp-search-input`,type:`search`,placeholder:z(r)(`filePreview.search`)},null,8,wTe),[[de,k.value]]),k.value.trim()?(c(),W(`span`,TTe,U(j.value.length),1)):E(``,!0),v(Ca,{size:`sm`,disabled:j.value.length===0,label:z(r)(`filePreview.prevMatch`),onClick:n[3]||=e=>ee(-1)},{default:B(()=>[v(X,{name:`arrow-up`,size:`md`})]),_:1},8,[`disabled`,`label`]),v(Ca,{size:`sm`,disabled:j.value.length===0,label:z(r)(`filePreview.nextMatch`),onClick:n[4]||=e=>ee(1)},{default:B(()=>[v(X,{name:`arrow-down`,size:`md`})]),_:1},8,[`disabled`,`label`])])):E(``,!0),v(Ca,{size:`sm`,class:V({copied:re.value}),label:re.value?z(r)(`filePreview.copied`):z(r)(`filePreview.copyPath`),onClick:oe},{default:B(()=>[re.value?(c(),P(X,{key:1,class:`fp-check`,name:`check`,size:`md`})):(c(),P(X,{key:0,name:`link`,size:`md`}))]),_:1},8,[`class`,`label`]),e.editable&&g.value&&e.file!==null?(c(),P(Ca,{key:4,size:`sm`,label:z(r)(`editor.title`),onClick:n[5]||=t=>y(`openEditor`,e.file.path)},{default:B(()=>[v(X,{name:`pencil`,size:`md`})]),_:1},8,[`label`])):E(``,!0),e.externalActions?(c(),P(Ca,{key:5,size:`sm`,label:z(r)(`filePreview.openInEditor`),onClick:n[6]||=e=>y(`openExternal`)},{default:B(()=>[v(X,{name:`external-link`,size:`md`})]),_:1},8,[`label`])):E(``,!0),e.externalActions?(c(),P(Ca,{key:6,size:`sm`,label:z(r)(`filePreview.reveal`),onClick:n[7]||=e=>y(`reveal`)},{default:B(()=>[v(X,{name:`folder`,size:`md`})]),_:1},8,[`label`])):E(``,!0),!e.file.isBinary&&S.value!==`image`?(c(),P(Ca,{key:7,size:`sm`,class:V({copied:ne.value}),label:ne.value?z(r)(`filePreview.copied`):z(r)(`filePreview.copy`),onClick:ie},{default:B(()=>[ne.value?(c(),P(X,{key:1,class:`fp-check`,name:`check`,size:`md`})):(c(),P(X,{key:0,name:`copy`,size:`md`}))]),_:1},8,[`class`,`label`])):E(``,!0)]),_:1},8,[`title`,`closable`,`close-label`,`class`]),S.value===`markdown`?(c(),W(`div`,{key:0,class:V([`fp-body`,{"fp-markdown":ce.value===`preview`}])},[ce.value===`preview`?(c(),P(w4,{key:0,text:w.value,"open-file":h.openFile?b:void 0},null,8,[`text`,`open-file`])):(c(),W(`div`,ETe,[F(`div`,DTe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,kTe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,ATe)],10,OTe))),128))])]))],2)):S.value===`json`?(c(),W(`div`,jTe,[F(`div`,MTe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,PTe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,FTe)],10,NTe))),128))])])):S.value===`html`?(c(),W(`div`,ITe,[se.value===`preview`?(c(),W(`iframe`,{key:0,class:`fp-html-frame`,sandbox:``,srcdoc:he.value,title:e.file.path},null,8,LTe)):(c(),W(`div`,RTe,[F(`div`,zTe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,VTe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,HTe)],10,BTe))),128))])]))])):S.value===`pdf`?(c(),W(`div`,UTe,[me.value?(c(),W(`iframe`,{key:0,class:`fp-pdf-frame`,src:me.value,title:e.file.path},null,8,WTe)):(c(),W(`div`,GTe,[F(`span`,KTe,U(z(r)(`filePreview.pdfNoPreview`)),1)]))])):S.value===`csv`?(c(),W(`div`,qTe,[F(`table`,JTe,[F(`tbody`,null,[(c(!0),W(M,null,_(_e.value,(e,t)=>(c(),W(`tr`,{key:t,class:V(I(t+1)),"data-line":t+1},[F(`th`,null,U(t+1),1),(c(!0),W(M,null,_(e,(e,t)=>(c(),W(`td`,{key:t},U(e),1))),128))],10,YTe))),128))])])])):S.value===`image`?(c(),W(`div`,XTe,[G.value?(c(),W(`img`,{key:0,src:G.value,alt:e.file.path,class:V([`fp-image`,{actual:le.value===`actual`}])},null,10,ZTe)):(c(),W(`div`,QTe,[F(`span`,$Te,[v(X,{name:`image-off`,size:`lg`})]),F(`span`,eEe,U(z(r)(`filePreview.imageNoPreview`,{mime:e.file.mime,size:te(e.file.size)})),1)]))])):S.value===`video`?(c(),W(`div`,tEe,[pe.value?(c(),W(`video`,{key:0,src:pe.value,class:`fp-image`,controls:``,playsinline:``,preload:`metadata`},null,8,nEe)):(c(),W(`div`,rEe,[F(`span`,iEe,[v(X,{name:`image-off`,size:`lg`})]),F(`span`,aEe,U(z(r)(`filePreview.videoNoPreview`,{mime:e.file.mime,size:te(e.file.size)})),1)]))])):S.value===`text`?(c(),W(`div`,oEe,[F(`div`,sEe,[(c(!0),W(M,null,_(D.value,(e,t)=>(c(),W(`div`,{key:t,class:V([`fp-line-row`,I(t+1)]),"data-line":t+1},[F(`span`,lEe,U(t+1),1),F(`span`,{class:`fp-line-text`,innerHTML:be(e)},null,8,uEe)],10,cEe))),128))])])):(c(),W(`div`,dEe,[F(`div`,fEe,[F(`span`,pEe,[v(X,{name:`file-off`,size:`lg`})]),F(`span`,mEe,U(z(r)(`filePreview.binaryNoPreview`,{mime:e.file.mime||z(r)(`filePreview.unknownType`),size:te(e.file.size)})),1)])]))],64)):E(``,!0)],512))}}),[[`__scopeId`,`data-v-92a41c83`]]),gEe={class:`ui-banner__icon`,"aria-hidden":`true`},_Ee={class:`ui-banner__text`},e9=Y(G({__name:`Banner`,props:{variant:{default:`info`}},setup(e){return(t,n)=>(c(),W(`div`,{class:V([`ui-banner`,`ui-banner--${e.variant}`]),role:`status`},[F(`span`,gEe,[me(t.$slots,`icon`,{},()=>[e.variant===`info`?(c(),P(X,{key:0,name:`info`,size:`md`})):(c(),P(X,{key:1,name:`alert-triangle`,size:`md`}))],!0)]),F(`span`,_Ee,[me(t.$slots,`default`,{},void 0,!0)])],2))}}),[[`__scopeId`,`data-v-566a0ac8`]]),t9=fC.global.t,vEe=40928,yEe=10485760,n9=N({open:!1,path:null,loading:!1,saving:!1,loadError:null,savingError:null,conflict:!1,dirty:!1,savedAt:null,languageId:void 0}),r9=null,i9=0,a9=null,o9={getContent:null};function s9(e){o9.getContent=e}function bEe(){return n9}function xEe(){i9+=1,n9.path=null,n9.loading=!1,n9.saving=!1,n9.loadError=null,n9.savingError=null,n9.conflict=!1,n9.dirty=!1,n9.savedAt=null,n9.languageId=void 0,r9=null,a9=null}async function c9(e){let t=EEe();if(!t){i9+=1,n9.open=!0,n9.path=e.path,n9.loading=!1,n9.loadError=t9(`editor.readOnlyWhileMissingSession`),n9.savingError=null,n9.conflict=!1,n9.dirty=!1,n9.savedAt=null,n9.languageId=void 0,n9.saving=!1,r9=null,a9=null;return}let n=++i9;n9.open=!0,n9.path=e.path,n9.loading=!0,n9.saving=!1,n9.loadError=null,n9.savingError=null,n9.conflict=!1,n9.dirty=!1,n9.savedAt=null,n9.languageId=void 0,r9=null,a9=t;try{let r=await Q().readFile(t,{path:e.path,length:yEe,encoding:`utf-8`});if(n!==i9)return;if(r.isBinary||r.encoding!==`utf-8`){n9.loadError=t9(`editor.binaryNotEditable`);return}r9=r.etag,n9.languageId=r.languageId,l9=r.content,u9=e.line,d9+=1}catch(e){if(n!==i9)return;r9=null,n9.loadError=e instanceof Error&&e.message.length>0?e.message:t9(`editor.loadFailed`)}finally{n===i9&&(n9.loading=!1)}}var l9,u9,d9=0;function SEe(){if(l9===void 0)return null;let e={content:l9,line:u9,revision:d9};return l9=void 0,u9=void 0,e}function CEe(){n9.dirty||(n9.dirty=!0,n9.savedAt=null),n9.savingError!==null&&(n9.savingError=null)}function f9(){xEe(),n9.open=!1}async function wEe(){n9.path!==null&&await c9({path:n9.path})}async function p9(e){let t=a9,n=n9.path;if(!t||!n||n9.saving||n9.loading||n9.conflict)return;let r=o9.getContent;if(!r)return;let i=++i9;n9.saving=!0,n9.savingError=null;try{let a=await Q().writeFile(t,{path:n,content:r(),...e?.force===!0||r9===null?{}:{baseEtag:r9}});if(i!==i9)return;r9=a.etag,n9.dirty=!1,n9.conflict=!1,n9.savedAt=Date.now()}catch(e){if(i!==i9)return;if(gT(e)&&e.code===vEe){n9.conflict=!0;return}n9.savingError=e instanceof Error&&e.message.length>0?e.message:t9(`editor.loadFailed`)}finally{n9.saving=!1}}async function TEe(){n9.conflict=!1,await p9({force:!0})}function EEe(){return m9?.()??null}var m9=null;function DEe(e){m9=e}var h9=`pythinker-light`,g9=`pythinker-dark`;function OEe(e,t){let n=e.trim();if(/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(n))return n;if(/^#[0-9a-f]{3,4}$/i.test(n))return`#${Array.from(n.slice(1),e=>e+e).join(``)}`;let r=/^rgba?\(([^)]*)\)$/i.exec(n);if(r===null)return t;let i=r[1].split(/[\s,/]+/).filter(e=>e.length>0);if(i.length<3||i.length>4)return t;let a=i.slice(0,3).map(e=>_9(e,255)),o=i.length===4?_9(i[3],1):255;return a.some(e=>e===null)||o===null?t:`#${[...a,o===255?null:o].filter(e=>e!==null).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function _9(e,t){let n=e.endsWith(`%`),r=Number(n?e.slice(0,-1):e);if(!Number.isFinite(r))return null;let i=n?r/100:r/t;return Math.max(0,Math.min(255,Math.round(i*255)))}function v9(e,t){let n=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return OEe(n.length>0?n:t,t)}function kEe(){return{bg:v9(`--p-bg`,`#ffffff`),surface:v9(`--color-surface`,`#fafbfc`),text:v9(`--color-text`,`#14171c`),textMuted:v9(`--color-text-muted`,`#6b7280`),line:v9(`--color-line`,`#e7eaee`),accent:v9(`--color-accent`,`#1783ff`),accentSoft:v9(`--p-accent-soft`,`#1783ff24`),selection:v9(`--p-selection`,`#1783ff2e`),danger:v9(`--color-danger`,`#c0392b`),warning:v9(`--color-warning`,`#a9610a`),success:v9(`--color-success`,`#0e7a38`)}}function y9(e){return e.slice(1,7)}function AEe(e,t){let n=kEe();e.editor.defineTheme(t?g9:h9,{base:t?`vs-dark`:`vs`,inherit:!0,rules:[{token:`comment`,foreground:y9(n.textMuted),fontStyle:`italic`},{token:`string`,foreground:y9(n.success)},{token:`keyword`,foreground:y9(n.accent)},{token:`number`,foreground:y9(n.warning)},{token:`type`,foreground:y9(n.accent)}],colors:{"editor.background":n.bg,"editor.foreground":n.text,"editorLineNumber.foreground":n.textMuted,"editorLineNumber.activeForeground":n.text,"editor.selectionBackground":n.selection,"editor.lineHighlightBackground":n.surface,"editorCursor.foreground":n.accent,"editorIndentGuide.background1":n.line,"editorIndentGuide.activeBackground1":n.textMuted,"editorWidget.background":n.surface,"editorWidget.border":n.line,"editorError.foreground":n.danger,"editorWarning.foreground":n.warning,"scrollbarSlider.background":n.accentSoft,"scrollbarSlider.hoverBackground":n.accentSoft,"scrollbarSlider.activeBackground":n.accent}})}function b9(e,t){AEe(e,t),e.editor.setTheme(t?g9:h9)}var x9=Da(),S9=null;function jEe(){return S9??=he(()=>import(`./editor.main-cSwqhoaG.js`).then(e=>{b9(e,x9.value),s(x9,()=>b9(e,x9.value))}),__vite__mapDeps([41,2,7,42,12,43,44,45])),S9}function MEe(){return x9.value?g9:h9}function NEe(){return jEe()}var PEe={class:`monaco-pane`},FEe={key:0,class:`monaco-pane__boot`},IEe=Y(G({__name:`MonacoPane`,props:{path:{},languageId:{}},setup(e){let t=R(null),n=R(!0),r=null,i=null,a=null,o=null;function l(){window.MonacoEnvironment===void 0&&he(()=>import(`./editor.worker-Cs8mLnor.js`).then(e=>{window.MonacoEnvironment={getWorker:()=>new e.default}}),[])}function u(e){if(e!==void 0&&new Set([`typescript`,`javascript`,`json`,`css`,`html`,`markdown`,`python`,`rust`,`go`,`yaml`]).has(e))return e;if(e===`typescriptreact`||e===`javascriptreact`)return e.replace(`react`,``);if(e===`shellscript`)return`shell`}async function d(){if(r===null||i===null)return;let e=SEe(),t=f.path;if(t===null)return;let n=r.Uri.parse(`pythinker://session/${encodeURIComponent(t)}`),s=r.editor.getModel(n);if(o?.dispose(),o=null,a!==null&&a!==s&&a.dispose(),s===null)a=r.editor.createModel(e?.content??``,u(f.languageId),n);else{a=s,e!==null&&a.setValue(e.content);let t=u(f.languageId);t!==void 0&&r.editor.setModelLanguage(a,t)}o=a.onDidChangeContent(()=>CEe()),i.setModel(a),s9(()=>a?.getValue()??``),e?.line!==void 0&&e.line>0&&(i.revealLineInCenter(e.line),i.setPosition({lineNumber:e.line,column:1}))}p(async()=>{l(),await NEe(),t.value!==null&&(r=await he(()=>import(`./editor.main-cSwqhoaG.js`),__vite__mapDeps([41,2,7,42,12,43,44,45])),t.value!==null&&(i=r.editor.create(t.value,{model:null,theme:MEe(),automaticLayout:!0,fontSize:12.5,fontFamily:`"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,renderLineHighlight:`line`,padding:{top:8}}),n.value=!1,await d()))}),h(()=>{s9(null),o?.dispose(),a?.dispose(),i?.dispose(),a=null,o=null,i=null,r=null});let f=e;return s(()=>[f.path,f.languageId],async()=>{i!==null&&await d()}),(e,r)=>(c(),W(`div`,PEe,[n.value?(c(),W(`div`,FEe,[v(op,{size:`sm`})])):E(``,!0),F(`div`,{ref_key:`rootRef`,ref:t,class:`monaco-pane__host`},null,512)]))}}),[[`__scopeId`,`data-v-cb5f64f3`]]),LEe={class:`editor-panel`},REe={class:`ed-path`},zEe={key:1,class:`ed-saved`},BEe={key:1,class:`ed-saving`},VEe={key:0,class:`editor-panel__empty`},HEe={class:`editor-panel__conflict-actions`},UEe={key:1,class:`editor-panel__save-error`},WEe=Y(G({__name:`EditorPanel`,emits:[`close`],setup(e,{emit:t}){let{t:n}=J(),r=bEe(),i=t;function a(){f9(),i(`close`)}function o(e){let t=e.split(`/`).at(-1)??e;return t.length>0?t:e}let l=L(()=>r.savedAt===null||r.dirty?!1:Date.now()-r.savedAt<2e3);function u(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),p9())}return window.addEventListener(`keydown`,u),h(()=>window.removeEventListener(`keydown`,u)),s(()=>r.open,e=>{e||i(`close`)}),(e,t)=>(c(),W(`div`,LEe,[v($7,{wrap:``,title:z(n)(`editor.title`),closable:``,"close-label":z(n)(`editor.closeEditor`),onClose:a},{default:B(()=>[z(r).path===null?E(``,!0):(c(),W(M,{key:0},[v(Sp,{text:z(r).path},{default:B(()=>[F(`span`,REe,U(o(z(r).path)),1)]),_:1},8,[`text`]),z(r).dirty?(c(),P(Sp,{key:0,text:z(n)(`editor.unsavedDot`)},{default:B(()=>[...t[3]||=[F(`span`,{class:`ed-dirty`},null,-1)]]),_:1},8,[`text`])):E(``,!0),l.value?(c(),W(`span`,zEe,U(z(n)(`editor.saved`)),1)):E(``,!0)],64)),z(r).path!==null&&z(r).loadError===null?(c(),W(M,{key:1},[z(r).conflict?E(``,!0):(c(),P(Ca,{key:0,size:`sm`,label:z(n)(`editor.save`),disabled:!z(r).dirty||z(r).saving,onClick:t[0]||=e=>z(p9)()},{default:B(()=>[v(X,{name:`check`,size:`sm`})]),_:1},8,[`label`,`disabled`])),z(r).saving?(c(),W(`span`,BEe,[v(op,{size:`sm`})])):E(``,!0)],64)):E(``,!0)]),_:1},8,[`title`,`close-label`]),z(r).loadError===null?(c(),W(M,{key:1},[z(r).conflict?(c(),P(e9,{key:0,variant:`warning`,class:`editor-panel__conflict`},{default:B(()=>[F(`span`,null,U(z(n)(`editor.conflictText`)),1),F(`span`,HEe,[v(pD,{variant:`secondary`,size:`sm`,onClick:t[1]||=e=>z(wEe)()},{default:B(()=>[K(U(z(n)(`editor.conflictReload`)),1)]),_:1}),v(pD,{variant:`danger`,size:`sm`,disabled:z(r).saving,onClick:t[2]||=e=>z(TEe)()},{default:B(()=>[K(U(z(n)(`editor.conflictOverwrite`)),1)]),_:1},8,[`disabled`])])]),_:1})):E(``,!0),z(r).savingError===null?E(``,!0):(c(),W(`p`,UEe,U(z(r).savingError),1)),z(r).path===null?E(``,!0):(c(),P(IEe,{key:2,path:z(r).path,"language-id":z(r).languageId},null,8,[`path`,`language-id`]))],64)):(c(),W(`div`,VEe,[v(gE,null,{default:B(()=>[F(`span`,null,U(z(r).loadError),1),v(pD,{variant:`secondary`,size:`sm`,onClick:a},{default:B(()=>[K(U(z(n)(`filePreview.close`)),1)]),_:1})]),_:1})]))]))}}),[[`__scopeId`,`data-v-579cb4a1`]]),GEe={class:`tp`},KEe=Y(G({__name:`ThinkingPanel`,props:{text:{},subtitle:{}},emits:[`close`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null);return s(()=>r.text,()=>{let e=o.value;e&&e.scrollHeight-e.scrollTop-e.clientHeight<24&&n(()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight)})},{immediate:!0}),(t,n)=>(c(),W(`div`,GEe,[v($7,{title:z(a)(`common.preview`),subtitle:e.subtitle??z(a)(`thinking.panelTitle`),"close-label":z(a)(`thinking.close`),onClose:n[0]||=e=>i(`close`)},null,8,[`title`,`subtitle`,`close-label`]),F(`pre`,{ref_key:`bodyEl`,ref:o,class:`tp-body`},U(e.text),513)]))}}),[[`__scopeId`,`data-v-e1ad626c`]]),qEe={class:`agent-panel`},JEe={key:0,class:`agent-meta`},YEe={class:`agent-meta-text`},XEe={key:1,class:`agent-prompt`},ZEe={class:`agent-prompt-bubble`},QEe=[`aria-expanded`],$Ee={class:`agent-transcript-inner`},eDe={key:0,class:`agent-fallback`},tDe={key:0,class:`agent-error`},nDe={key:1,class:`fallback-lines`},rDe=Y(G({__name:`AgentDetailPanel`,props:{member:{},turns:{},running:{type:Boolean},loading:{type:Boolean},loadError:{type:Boolean},hasMore:{type:Boolean},loadingMore:{type:Boolean},loadMoreError:{type:Boolean}},emits:[`close`,`loadOlderMessages`,`openAgent`,`openFile`,`openMedia`,`openTurnDiff`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=i6(),l=L(()=>o.value?`lg`:`sm`),u=R(null),f=R(null),p=R(!0),g=R(!1),_=null,y=0,b=L(()=>{let e=new Set,t=[],n=r.member.prompt?.trim(),i=n?`$ ${n}`:void 0;for(let n of[r.member.prompt,r.member.suspendedReason,r.member.text,r.member.outputLines?.join(` `),r.member.summary]){let r=n?.trim();!r||e.has(r)||r===i||(e.add(r),t.push(r))}return t}),x=L(()=>b.value.filter(e=>e!==r.member.prompt?.trim()).join(` `)),S=m(`modelDisplay`),C=m(`subagentEffort`),w=L(()=>[r.member.subagentType,S?.(r.member.model),C?.(r.member.thinkingEffort)].filter(Boolean).join(` · `)||void 0),T=L(()=>r.member.prompt?.trim()??``),D=L(()=>T.value.startsWith(`/`)&&!T.value.includes(` `)),O=L(()=>r.turns.length===0&&!r.loading&&(r.loadError||b.value.length>0)),k=R(null),A=R(!0),j=R(!1);function N(){let e=k.value;if(!e){j.value=!1;return}j.value=e.scrollHeight>e.clientHeight+1}function ee(){A.value=!A.value,n(N)}s(()=>[r.member.id,T.value],()=>{A.value=!0,n(N)},{immediate:!0});function I(){let e=u.value;e&&(p.value=e.scrollHeight-e.scrollTop-e.clientHeight<24)}function te(){n(()=>{let e=u.value;e&&(e.scrollTop=e.scrollHeight)})}function ne(){p.value=!0,te()}d(`pinScroll`,e=>{let t=u.value;if(!t)return;let n=e.getBoundingClientRect().top;requestAnimationFrame(()=>{t.scrollTop+=e.getBoundingClientRect().top-n})}),s(()=>{let e=r.turns.at(-1);return`${r.member.id}:${r.turns.length}:${e?.text.length??0}:${e?.tools?.length??0}`},()=>{p.value&&te()},{immediate:!0});function re(e){return a(`tools.dynamic_workflow.phase${e[0].toUpperCase()+e.slice(1)}`)}function ie(){_!==null&&clearTimeout(_),g.value=!0,_=setTimeout(()=>{_=null,g.value=!1},1400)}async function ae(){if(!O.value&&r.turns.length>0){f.value?.copyConversation();return}let e=[r.member.prompt?.trim(),x.value].filter(Boolean).join(` -`);if(!e)return;let t=++y;!await Wi(e)||t!==y||ie()}return s(()=>r.member.id,()=>{y+=1,_!==null&&clearTimeout(_),_=null,g.value=!1}),h(()=>{_!==null&&clearTimeout(_)}),(t,n)=>(c(),W(`div`,zEe,[v(e9,{title:e.member.name,"close-label":z(a)(`thinking.close`),onClose:n[0]||=e=>i(`close`)},{default:B(()=>[v(ip,{variant:`neutral`,size:`sm`},{default:B(()=>[K(U(re(e.member.phase)),1)]),_:1}),e.member.prompt||x.value||e.turns.length>0?(c(),P(Ca,{key:0,size:l.value,label:z(a)(`tasks.copy`),onClick:ae},{default:B(()=>[v(X,{name:g.value?`check`:`copy`,size:`sm`},null,8,[`name`])]),_:1},8,[`size`,`label`])):E(``,!0)]),_:1},8,[`title`,`close-label`]),w.value?(c(),W(`div`,BEe,[F(`span`,VEe,U(w.value),1)])):E(``,!0),T.value?(c(),W(`div`,HEe,[F(`div`,UEe,[F(`div`,{class:V([`agent-prompt-wrap`,{"is-clamped":A.value}])},[F(`div`,{ref_key:`promptTextEl`,ref:k,class:V([`agent-prompt-text`,{"is-command":D.value}])},[D.value?(c(),W(M,{key:0},[K(U(T.value),1)],64)):(c(),P(T4,{key:1,text:T.value,"open-file":e=>i(`openFile`,e)},null,8,[`text`,`open-file`]))],2),j.value||!A.value?(c(),W(`button`,{key:0,type:`button`,class:`agent-prompt-toggle`,"aria-expanded":!A.value,onClick:ee},[F(`span`,null,U(A.value?z(a)(`tasks.expand`):z(a)(`tasks.collapse`)),1),v(X,{class:V([`agent-prompt-toggle-car`,{open:!A.value}]),name:`chevron-down`,size:`sm`,"aria-hidden":`true`},null,8,[`class`])],8,WEe)):E(``,!0)],2)])])):E(``,!0),F(`div`,{ref_key:`bodyEl`,ref:u,class:`agent-transcript`,onScrollPassive:I},[F(`div`,GEe,[O.value?(c(),W(`div`,KEe,[e.loadError?(c(),W(`div`,qEe,U(z(a)(`tasks.transcriptLoadError`)),1)):E(``,!0),b.value.length>0?(c(),W(`pre`,JEe,U(b.value.join(` -`)),1)):E(``,!0)])):(c(),P(Y4,{key:1,ref_key:`chatPaneRef`,ref:f,turns:e.turns,"turn-active":e.running,"session-loading":e.loading&&e.turns.length===0,"has-more-messages":e.hasMore,"loading-more":e.loadingMore,"loading-more-error":e.loadMoreError,"is-following":p.value,"read-only":``,inspector:``,onLoadOlderMessages:n[1]||=e=>i(`loadOlderMessages`),onOpenAgent:n[2]||=e=>i(`openAgent`,e),onOpenFile:n[3]||=e=>i(`openFile`,e),onOpenMedia:n[4]||=e=>i(`openMedia`,e),onOpenTurnDiff:n[5]||=e=>i(`openTurnDiff`,e),onCopyConversationCopied:ie},null,8,[`turns`,`turn-active`,`session-loading`,`has-more-messages`,`loading-more`,`loading-more-error`,`is-following`]))]),v(oe,{name:`agent-jump`},{default:B(()=>[p.value?E(``,!0):(c(),W(`button`,{key:0,type:`button`,class:`agent-jump-btn`,onClick:ne},[v(X,{class:`agent-jump-car`,name:`arrow-down`,size:`sm`,"aria-hidden":`true`}),F(`span`,null,U(z(a)(`conversation.backToBottom`)),1)]))]),_:1})],544)]))}}),[[`__scopeId`,`data-v-9ea90d44`]]),XEe={class:`tdp`},ZEe={class:`tdp-body`},QEe={key:1,class:`tdp-output`},$Ee={key:2,class:`tdp-empty`},eDe=Y(G({__name:`ToolDiffPanel`,props:{target:{}},emits:[`close`],setup(e,{emit:t}){let n=t,{t:r}=J();return(t,i)=>(c(),W(`div`,XEe,[v(e9,{title:e.target.title,subtitle:e.target.path,"close-label":z(r)(`thinking.close`),onClose:i[0]||=e=>n(`close`)},null,8,[`title`,`subtitle`,`close-label`]),F(`div`,ZEe,[e.target.lines&&e.target.lines.length>0?(c(),P(rO,{key:0,lines:e.target.lines},null,8,[`lines`])):e.target.output&&e.target.output.length>0?(c(),W(`div`,QEe,[(c(!0),W(M,null,_(e.target.output,(e,t)=>(c(),W(`div`,{key:t},U(e),1))),128))])):(c(),W(`div`,$Ee,U(z(r)(`diff.noDiff`)),1))])]))}}),[[`__scopeId`,`data-v-8b9af3ab`]]),tDe={class:`hl-body`},nDe={key:0,class:`hl-gutter`},rDe={class:`hl-sign`},iDe={class:`hl-text`},aDe=[`data-line`],oDe={key:0,class:`hl-gutter`},sDe={class:`hl-text`},cDe=200,w9=Y(G({__name:`HighlightedCode`,props:{code:{},lines:{},path:{},lineNumbers:{type:[Boolean,Array],default:!1},framed:{type:Boolean,default:!0},fullTexts:{default:null},lineClass:{},responsiveWrap:{type:Boolean,default:!1}},setup(e){let t={ts:`ts`,tsx:`tsx`,js:`js`,jsx:`jsx`,mjs:`js`,cjs:`js`,vue:`vue`,svelte:`svelte`,py:`py`,rb:`rb`,go:`go`,rs:`rs`,java:`java`,kt:`kt`,kts:`kts`,scala:`scala`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,cs:`cs`,php:`php`,sh:`sh`,bash:`bash`,zsh:`zsh`,fish:`fish`,ps1:`ps1`,bat:`bat`,cmd:`bat`,sql:`sql`,graphql:`graphql`,prisma:`prisma`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,json:`json`,jsonc:`jsonc`,json5:`json5`,yaml:`yaml`,yml:`yml`,toml:`toml`,ini:`ini`,md:`md`,markdown:`markdown`,mdx:`mdx`,lua:`lua`,r:`r`,dart:`dart`,zig:`zig`,mk:`makefile`,cmake:`cmake`,diff:`diff`,proto:`proto`},n={dockerfile:`dockerfile`,makefile:`makefile`,"cmakelists.txt":`cmake`};function r(e){let r=e?.split(/[\\/]/).pop()?.toLowerCase()??``;if(!r)return;let i=n[r];if(i)return i;let a=r.lastIndexOf(`.`);if(!(a<=0))return t[r.slice(a+1)]}function i(e){return e.split(/\r?\n/)}function a(e){let t={};e.color&&(t.color=e.color);let n=e.fontStyle??0;return n&1&&(t.fontStyle=`italic`),n&2&&(t.fontWeight=`var(--weight-semibold)`),n&4&&(t.textDecoration=`underline`),t}let o=e,l=Da(),u=L(()=>o.lines!==void 0),d=L(()=>(o.lines??[]).some(e=>e.oldNo!==void 0)),f=L(()=>(o.lines??[]).some(e=>e.newNo!==void 0)),m=L(()=>o.lineNumbers===!0&&u.value),h=L(()=>Array.isArray(o.lineNumbers)?o.lineNumbers:null),g=L(()=>m.value?Number(d.value)+Number(f.value):h.value===null?0:1),v=L(()=>Array.isArray(o.code)?o.code:i(o.code??``)),y=L(()=>{let e=o.lines;return e?o.fullTexts?o.fullTexts:{before:e.filter(e=>e.oldNo!==void 0).map(e=>e.text).join(` +`);if(!e)return;let t=++y;!await Wi(e)||t!==y||ie()}return s(()=>r.member.id,()=>{y+=1,_!==null&&clearTimeout(_),_=null,g.value=!1}),h(()=>{_!==null&&clearTimeout(_)}),(t,n)=>(c(),W(`div`,qEe,[v($7,{title:e.member.name,"close-label":z(a)(`thinking.close`),onClose:n[0]||=e=>i(`close`)},{default:B(()=>[v(cp,{variant:`neutral`,size:`sm`},{default:B(()=>[K(U(re(e.member.phase)),1)]),_:1}),e.member.prompt||x.value||e.turns.length>0?(c(),P(Ca,{key:0,size:l.value,label:z(a)(`tasks.copy`),onClick:ae},{default:B(()=>[v(X,{name:g.value?`check`:`copy`,size:`sm`},null,8,[`name`])]),_:1},8,[`size`,`label`])):E(``,!0)]),_:1},8,[`title`,`close-label`]),w.value?(c(),W(`div`,JEe,[F(`span`,YEe,U(w.value),1)])):E(``,!0),T.value?(c(),W(`div`,XEe,[F(`div`,ZEe,[F(`div`,{class:V([`agent-prompt-wrap`,{"is-clamped":A.value}])},[F(`div`,{ref_key:`promptTextEl`,ref:k,class:V([`agent-prompt-text`,{"is-command":D.value}])},[D.value?(c(),W(M,{key:0},[K(U(T.value),1)],64)):(c(),P(w4,{key:1,text:T.value,"open-file":e=>i(`openFile`,e)},null,8,[`text`,`open-file`]))],2),j.value||!A.value?(c(),W(`button`,{key:0,type:`button`,class:`agent-prompt-toggle`,"aria-expanded":!A.value,onClick:ee},[F(`span`,null,U(A.value?z(a)(`tasks.expand`):z(a)(`tasks.collapse`)),1),v(X,{class:V([`agent-prompt-toggle-car`,{open:!A.value}]),name:`chevron-down`,size:`sm`,"aria-hidden":`true`},null,8,[`class`])],8,QEe)):E(``,!0)],2)])])):E(``,!0),F(`div`,{ref_key:`bodyEl`,ref:u,class:`agent-transcript`,onScrollPassive:I},[F(`div`,$Ee,[O.value?(c(),W(`div`,eDe,[e.loadError?(c(),W(`div`,tDe,U(z(a)(`tasks.transcriptLoadError`)),1)):E(``,!0),b.value.length>0?(c(),W(`pre`,nDe,U(b.value.join(` +`)),1)):E(``,!0)])):(c(),P(J4,{key:1,ref_key:`chatPaneRef`,ref:f,turns:e.turns,"turn-active":e.running,"session-loading":e.loading&&e.turns.length===0,"has-more-messages":e.hasMore,"loading-more":e.loadingMore,"loading-more-error":e.loadMoreError,"is-following":p.value,"read-only":``,inspector:``,onLoadOlderMessages:n[1]||=e=>i(`loadOlderMessages`),onOpenAgent:n[2]||=e=>i(`openAgent`,e),onOpenFile:n[3]||=e=>i(`openFile`,e),onOpenMedia:n[4]||=e=>i(`openMedia`,e),onOpenTurnDiff:n[5]||=e=>i(`openTurnDiff`,e),onCopyConversationCopied:ie},null,8,[`turns`,`turn-active`,`session-loading`,`has-more-messages`,`loading-more`,`loading-more-error`,`is-following`]))]),v(oe,{name:`agent-jump`},{default:B(()=>[p.value?E(``,!0):(c(),W(`button`,{key:0,type:`button`,class:`agent-jump-btn`,onClick:ne},[v(X,{class:`agent-jump-car`,name:`arrow-down`,size:`sm`,"aria-hidden":`true`}),F(`span`,null,U(z(a)(`conversation.backToBottom`)),1)]))]),_:1})],544)]))}}),[[`__scopeId`,`data-v-9ea90d44`]]),iDe={class:`tdp`},aDe={class:`tdp-body`},oDe={key:1,class:`tdp-output`},sDe={key:2,class:`tdp-empty`},cDe=Y(G({__name:`ToolDiffPanel`,props:{target:{}},emits:[`close`],setup(e,{emit:t}){let n=t,{t:r}=J();return(t,i)=>(c(),W(`div`,iDe,[v($7,{title:e.target.title,subtitle:e.target.path,"close-label":z(r)(`thinking.close`),onClose:i[0]||=e=>n(`close`)},null,8,[`title`,`subtitle`,`close-label`]),F(`div`,aDe,[e.target.lines&&e.target.lines.length>0?(c(),P(cO,{key:0,lines:e.target.lines},null,8,[`lines`])):e.target.output&&e.target.output.length>0?(c(),W(`div`,oDe,[(c(!0),W(M,null,_(e.target.output,(e,t)=>(c(),W(`div`,{key:t},U(e),1))),128))])):(c(),W(`div`,sDe,U(z(r)(`diff.noDiff`)),1))])]))}}),[[`__scopeId`,`data-v-8b9af3ab`]]),lDe={class:`hl-body`},uDe={key:0,class:`hl-gutter`},dDe={class:`hl-sign`},fDe={class:`hl-text`},pDe=[`data-line`],mDe={key:0,class:`hl-gutter`},hDe={class:`hl-text`},gDe=200,C9=Y(G({__name:`HighlightedCode`,props:{code:{},lines:{},path:{},lineNumbers:{type:[Boolean,Array],default:!1},framed:{type:Boolean,default:!0},fullTexts:{default:null},lineClass:{},responsiveWrap:{type:Boolean,default:!1}},setup(e){let t={ts:`ts`,tsx:`tsx`,js:`js`,jsx:`jsx`,mjs:`js`,cjs:`js`,vue:`vue`,svelte:`svelte`,py:`py`,rb:`rb`,go:`go`,rs:`rs`,java:`java`,kt:`kt`,kts:`kts`,scala:`scala`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,cs:`cs`,php:`php`,sh:`sh`,bash:`bash`,zsh:`zsh`,fish:`fish`,ps1:`ps1`,bat:`bat`,cmd:`bat`,sql:`sql`,graphql:`graphql`,prisma:`prisma`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,json:`json`,jsonc:`jsonc`,json5:`json5`,yaml:`yaml`,yml:`yml`,toml:`toml`,ini:`ini`,md:`md`,markdown:`markdown`,mdx:`mdx`,lua:`lua`,r:`r`,dart:`dart`,zig:`zig`,mk:`makefile`,cmake:`cmake`,diff:`diff`,proto:`proto`},n={dockerfile:`dockerfile`,makefile:`makefile`,"cmakelists.txt":`cmake`};function r(e){let r=e?.split(/[\\/]/).pop()?.toLowerCase()??``;if(!r)return;let i=n[r];if(i)return i;let a=r.lastIndexOf(`.`);if(!(a<=0))return t[r.slice(a+1)]}function i(e){return e.split(/\r?\n/)}function a(e){let t={};e.color&&(t.color=e.color);let n=e.fontStyle??0;return n&1&&(t.fontStyle=`italic`),n&2&&(t.fontWeight=`var(--weight-semibold)`),n&4&&(t.textDecoration=`underline`),t}let o=e,l=Da(),u=L(()=>o.lines!==void 0),d=L(()=>(o.lines??[]).some(e=>e.oldNo!==void 0)),f=L(()=>(o.lines??[]).some(e=>e.newNo!==void 0)),m=L(()=>o.lineNumbers===!0&&u.value),h=L(()=>Array.isArray(o.lineNumbers)?o.lineNumbers:null),g=L(()=>m.value?Number(d.value)+Number(f.value):h.value===null?0:1),v=L(()=>Array.isArray(o.code)?o.code:i(o.code??``)),y=L(()=>{let e=o.lines;return e?o.fullTexts?o.fullTexts:{before:e.filter(e=>e.oldNo!==void 0).map(e=>e.text).join(` `),after:e.filter(e=>e.newNo!==void 0).map(e=>e.text).join(` `)}:null}),b=R(null),x=R(null),S=R(null);function C(){b.value=null,x.value=null,S.value=null}let w=0,T=0,D=null,O=null;async function k(){let e=++w;T=Date.now();let t=r(o.path);if(!t){e===w&&C();return}try{O??=he(()=>import(`./dist-1YXee3Wk.js`).then(e=>e.codeToTokens),__vite__mapDeps([46,2,7,47]));let n=await O,r=l.value?`github-dark`:`github-light`,i=y.value;if(i){let[a,o]=await Promise.all([i.before?n(i.before,{lang:t,theme:r}):null,i.after?n(i.after,{lang:t,theme:r}):null]);if(e!==w)return;x.value=a?.tokens??null,S.value=o?.tokens??null}else{let i=v.value.length>0?await n(v.value.join(` -`),{lang:t,theme:r}):null;if(e!==w)return;b.value=i?.tokens??null}}catch{e===w&&C()}}function A(){if(D!==null)return;let e=Math.max(0,cDe-(Date.now()-T));D=setTimeout(()=>{D=null,k()},e)}s([()=>v.value.join(` -`),()=>y.value?.before??null,()=>y.value?.after??null],A),s([()=>o.path,l,()=>o.fullTexts],()=>{w++,C(),A()}),p(()=>void k()),ne(()=>{w++,D!==null&&clearTimeout(D)});let j=L(()=>{let e=new Map,t=0;for(let n of o.lines??[])n.oldNo!==void 0&&e.set(n.oldNo,t++);return e}),N=L(()=>{let e=new Map,t=0;for(let n of o.lines??[])n.newNo!==void 0&&e.set(n.newNo,t++);return e});function ee(e){if(e.type===`del`){if(e.oldNo===void 0)return null;let t=o.fullTexts?e.oldNo-1:j.value.get(e.oldNo);return t===void 0?null:x.value?.[t]??null}if(e.newNo===void 0)return null;let t=o.fullTexts?e.newNo-1:N.value.get(e.newNo);return t===void 0?null:S.value?.[t]??null}function P(e){return e.type===`add`?`+`:e.type===`del`?`-`:` `}let I=L(()=>{let e=0;if(h.value)for(let t of h.value)t>e&&(e=t);else for(let t of o.lines??[])t.oldNo!==void 0&&t.oldNo>e&&(e=t.oldNo),t.newNo!==void 0&&t.newNo>e&&(e=t.newNo);return Math.max(4,String(e).length)});return(t,n)=>(c(),W(`div`,{class:V([`hl-code`,{gutter:m.value,"plain-pad":!u.value&&h.value===null,framed:e.framed,"responsive-wrap":e.responsiveWrap,"one-gutter":g.value===1,"two-gutters":g.value===2}]),style:ae({"--gutter-ch":`${I.value}ch`})},[F(`div`,tDe,[u.value?(c(!0),W(M,{key:0},_(e.lines,(e,t)=>(c(),W(`div`,{key:t,class:V([`hl-row`,`row-${e.type}`])},[m.value?(c(),W(M,{key:0},[d.value?(c(),W(`span`,nDe,U(e.oldNo??``),1)):E(``,!0),f.value?(c(),W(`span`,{key:1,class:V([`hl-gutter new`,{offset:d.value}])},U(e.newNo??``),3)):E(``,!0)],64)):E(``,!0),F(`span`,rDe,U(P(e)),1),F(`span`,iDe,[ee(e)?(c(!0),W(M,{key:0},_(ee(e),(e,t)=>(c(),W(`span`,{key:t,style:ae(a(e))},U(e.content),5))),128)):(c(),W(M,{key:1},[K(U(e.text),1)],64))])],2))),128)):(c(!0),W(M,{key:1},_(v.value,(t,n)=>(c(),W(`div`,{key:n,class:V([`hl-row`,e.lineClass?e.lineClass(h.value?.[n]??-1):void 0]),"data-line":h.value?h.value[n]:void 0},[h.value?(c(),W(`span`,oDe,U(h.value[n]??``),1)):E(``,!0),F(`span`,sDe,[b.value&&b.value[n]?(c(!0),W(M,{key:0},_(b.value[n],(e,t)=>(c(),W(`span`,{key:t,style:ae(a(e))},U(e.content),5))),128)):(c(),W(M,{key:1},[K(U(t),1)],64))])],10,aDe))),128))])],6))}}),[[`__scopeId`,`data-v-4b6e3ce1`]]),lDe={class:`turn-diff-panel`},uDe={class:`tdp-body`},dDe={class:`tdp-file-head`},fDe={class:`tdp-path`},pDe={key:0,class:`tdp-diff`},mDe={key:1,class:`tdp-unavailable`},hDe=Y(G({__name:`TurnDiffPanel`,props:{changes:{},cwd:{}},emits:[`close`,`openFile`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J();function a(e,t){if(!t)return null;let n=e=>e.replaceAll(`\\`,`/`),r=n(e),i=n(t);i.length>1&&(i=i.replace(/\/+$/,``));let a=/^[a-z]:\//i.test(i)||/^[a-z]:\//i.test(r)||i.startsWith(`//`)||r.startsWith(`//`),o=a?i.toLowerCase():i,s=a?r.toLowerCase():r,c=o.endsWith(`/`)?o:`${o}/`;if(s!==o&&!s.startsWith(c))return null;let l=s===o?``:r.slice(c.length);return l.split(`/`).includes(`..`)?null:l||null}function o(e,t=48){return!e||e.length<=t?e:`…`+e.slice(e.length-t+1)}function s(e){return a(e.path,n.cwd)??e.path}return(t,n)=>(c(),W(`div`,lDe,[v(e9,{title:z(i)(`conversation.turnFiles.diffTitle`),onClose:n[0]||=e=>r(`close`)},null,8,[`title`]),F(`div`,uDe,[(c(!0),W(M,null,_(e.changes,e=>(c(),W(`section`,{key:e.path,class:`tdp-file`},[F(`div`,dDe,[v(vp,{text:e.path},{default:B(()=>[F(`span`,fDe,U(o(s(e))),1)]),_:2},1032,[`text`]),v(YT,{variant:`ghost`,size:`sm`,onClick:t=>r(`openFile`,{path:e.path})},{default:B(()=>[K(U(z(i)(`conversation.turnFiles.openFile`)),1)]),_:1},8,[`onClick`])]),e.diff?(c(),W(`div`,pDe,[v(w9,{lines:e.diff,path:e.path,framed:!1},null,8,[`lines`,`path`])])):(c(),W(`div`,mDe,[F(`p`,null,U(z(i)(`conversation.turnFiles.diffUnavailable`)),1),v(YT,{variant:`ghost`,size:`sm`,onClick:t=>r(`openFile`,{path:e.path})},{default:B(()=>[K(U(z(i)(`conversation.turnFiles.openFile`)),1)]),_:1},8,[`onClick`])]))]))),128))])]))}}),[[`__scopeId`,`data-v-67a3cc7e`]]),gDe=[`aria-label`],T9=Y(G({__name:`ThinkingIndicator`,props:{size:{default:`md`},fast:{type:Boolean},label:{default:`Waiting for response…`}},setup(e){let t=l6.length*80;function n(e){return{"--thinking-frame-delay":`${e*80-t}ms`,"--thinking-frame-fast-delay":`${80/2*e-t/2}ms`}}return(t,r)=>(c(),W(`span`,{class:V([`ui-thinking-indicator`,[`ui-thinking-indicator--${e.size}`,{"ui-thinking-indicator--fast":e.fast}]]),"aria-label":e.label,role:`status`},[(c(!0),W(M,null,_(z(l6),(e,t)=>(c(),W(`span`,{key:e,class:`ui-thinking-indicator__frame`,style:ae(n(t)),"aria-hidden":`true`},U(e),5))),128))],10,gDe))}}),[[`__scopeId`,`data-v-ed8aef9e`]]),_De={class:`sc`},vDe={key:0,class:`sc-empty`},yDe={key:2,class:`sc-loading`,"aria-hidden":`true`},bDe={class:`sc-composer`},xDe=[`placeholder`],SDe=[`disabled`],CDe=Y(G({__name:`SideChatPanel`,props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:[`send`,`close`],setup(e,{expose:t,emit:r}){let i=e,a=r,{t:o}=J(),u=L(()=>i.turns.find(e=>e.role===`user`)?.text?.trim()??``),d=L(()=>i.title?.trim()||o(`sideChat.title`)),f=L(()=>i.subtitle?.trim()?i.subtitle.trim():u.value||o(`sideChat.subtitle`)),p=R(``),m=R(null),h=R(null);function g(){let e=p.value.trim();e&&(a(`send`,e),p.value=``,n(()=>{m.value&&(m.value.style.height=`auto`),_()}))}function _(){let e=h.value;e&&(e.scrollTop=e.scrollHeight)}s(L(()=>{let e=i.turns;if(e.length===0)return`0`;let t=e.at(-1),n=t.thinking?.length??0,r=t.tools?.reduce((e,t)=>e+t.name.length+(t.arg?.length??0)+(t.output?.join(``).length??0),0)??0;return`${e.length}:${t.text.length}:${n}:${r}`}),async()=>{!i.running&&!i.sending||(await n(),_())});let y=L(()=>i.sending?i.turns.at(-1)?.role===`user`:!1);function b(e){e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),g())}function x(){let e=m.value;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)}function S(){m.value?.focus()}return t({focusInput:S}),(t,n)=>(c(),W(`div`,_De,[v(e9,{title:d.value,subtitle:f.value,"close-label":z(o)(`thinking.close`),onClose:n[0]||=e=>a(`close`)},null,8,[`title`,`subtitle`,`close-label`]),F(`div`,{ref_key:`bodyRef`,ref:h,class:`sc-body`},[e.turns.length===0?(c(),W(`div`,vDe,U(z(o)(`sideChat.empty`)),1)):(c(),P(Y4,{key:1,turns:e.turns,approvals:[],"turn-active":e.running,working:e.sending||e.running},null,8,[`turns`,`turn-active`,`working`])),y.value?(c(),W(`div`,yDe,[v(T9)])):E(``,!0)],512),F(`div`,bDe,[l(F(`textarea`,{ref_key:`inputRef`,ref:m,"onUpdate:modelValue":n[1]||=e=>p.value=e,class:`sc-input`,rows:`1`,placeholder:z(o)(`sideChat.placeholder`),onInput:x,onKeydown:b},null,40,xDe),[[de,p.value]]),v(vp,{text:z(o)(`sideChat.send`)},{default:B(()=>[F(`button`,{type:`button`,class:`sc-send`,disabled:!p.value.trim(),onClick:g},[v(X,{name:`arrow-right`,size:`sm`})],8,SDe)]),_:1},8,[`text`])])]))}}),[[`__scopeId`,`data-v-130e8cd2`]]),wDe={class:`changes-pane`},TDe={class:`dv-path`},EDe={class:`diff-head`},DDe={class:`back-label`},ODe={key:`loading`,class:`empty-state diff-loading`},kDe={key:`empty`,class:`empty-state`},ADe={class:`dv-change-count`},jDe={class:`ch-head`},MDe={class:`br-label`},NDe={class:`br-name`},PDe={key:0,class:`sync-info`},FDe={key:0,class:`ahead`},IDe={key:0,class:`behind`},LDe={key:1,class:`empty-head`},RDe={key:0,class:`ch-list`},zDe=[`onClick`],BDe={class:`fpath`},VDe={key:1,class:`ch-list ch-tree`},HDe={class:`tree-list`},UDe=[`onClick`],WDe={class:`tree-name`},GDe=[`onClick`],KDe={class:`tree-name`},qDe={key:2,class:`empty-state`},JDe={key:3,class:`empty-state`},YDe=Y(G({__name:`DiffView`,props:{changes:{},gitInfo:{},fileDiff:{},fullTexts:{default:null},emptyFile:{type:Boolean,default:!1},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:`full`},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:[`open`,`back`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=R(!0);function a(){i.value=!i.value}let o=t;function l(e){let t=e.toLowerCase();return t===`modified`?`modified`:t===`added`?`added`:t===`deleted`?`deleted`:t===`renamed`?`renamed`:t===`untracked`?`untracked`:t===`conflicted`?`conflicted`:t===`ignored`?`ignored`:t===`clean`?`clean`:`unknown`}let u={modified:`M`,added:`+`,deleted:`−`,renamed:`→`,untracked:`+`,conflicted:`C`,ignored:`I`,clean:`·`,unknown:`?`};function d(e){return u[l(e)]??`?`}function f(e,t=60){return e.length<=t?e:`…`+e.slice(e.length-t+1)}let p=L(()=>r.gitInfo!==null),m=L(()=>r.changes.length>0),h=L(()=>(r.selectedDiffPath??null)!==null),g=L(()=>r.mode===`detail`||r.mode===`full`&&h.value),y=L(()=>r.fileDiff??[]),b=L(()=>r.fileDiffLoading===!0),x=R(null);s([()=>r.selectedDiffPath,b],([,e])=>{!e&&x.value&&(x.value.scrollLeft=0)},{flush:`post`});function S(e){o(`open`,e)}function C(){o(`back`)}function w(){o(`close`)}let T=R(`list`);function D(e){T.value=e}function O(e){let t={name:``,path:``,kind:`folder`,children:[]},n=[...e].sort((e,t)=>e.path.localeCompare(t.path));for(let e of n){let n=e.path.split(`/`),r=t;for(let t=0;te.name===i&&e.kind===(a?`file`:`folder`));s||(s={name:i,path:o,kind:a?`file`:`folder`,status:a?e.status:void 0,children:[]},r.children.push(s)),r=s}}return t.children}let k=L(()=>O(r.changes)),A=R(new Set);function j(e){return!A.value.has(e)}let N=L(()=>{let e=[];function t(n,r){for(let i of n)e.push({node:i,depth:r}),i.kind===`folder`&&j(i.path)&&t(i.children,r+1)}return t(k.value,0),e});function ee(e){let t=new Set(A.value);t.has(e.path)?t.delete(e.path):t.add(e.path),A.value=t}function I(e){return`${16+e*16}px`}return(t,r)=>(c(),W(`div`,wDe,[g.value?(c(),W(M,{key:0},[v(e9,{title:z(n)(`diff.title`),closable:e.closable,"close-label":z(n)(`diff.close`),onClose:w},{default:B(()=>[v(vp,{text:e.selectedDiffPath??``},{default:B(()=>[F(`span`,TDe,U(f(e.selectedDiffPath??``,50)),1)]),_:1},8,[`text`]),v(vp,{text:i.value?z(n)(`conversation.unwrapCode`):z(n)(`conversation.wrapCode`)},{default:B(()=>[v(Ca,{size:`sm`,label:i.value?z(n)(`conversation.unwrapCode`):z(n)(`conversation.wrapCode`),"aria-pressed":i.value,onClick:a},{default:B(()=>[v(X,{name:i.value?`text-wrap-disabled`:`text-wrap`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`,`aria-pressed`])]),_:1},8,[`text`])]),_:1},8,[`title`,`closable`,`close-label`]),F(`div`,EDe,[e.hideBack?E(``,!0):(c(),P(YT,{key:0,variant:`ghost`,size:`sm`,onClick:C},{default:B(()=>[r[0]||=F(`span`,{"aria-hidden":`true`},`←`,-1),F(`span`,DDe,U(z(n)(`diff.back`)),1)]),_:1}))]),v(oe,{name:`diff-content`,mode:`out-in`},{default:B(()=>[b.value?(c(),W(`div`,ODe,[v(np,{size:`md`}),F(`span`,null,U(z(n)(`diff.loading`)),1)])):y.value.length>0?(c(),W(`div`,{key:`lines`,ref_key:`diffScrollRef`,ref:x,class:`dv-lines-wrap`},[v(w9,{lines:y.value,path:e.selectedDiffPath??void 0,"line-numbers":!0,framed:!1,"full-texts":e.fullTexts,"responsive-wrap":i.value},null,8,[`lines`,`path`,`full-texts`,`responsive-wrap`])],512)):(c(),W(`div`,kDe,U(e.emptyFile?z(n)(`diff.emptyFile`):z(n)(`diff.noDiff`)),1))]),_:1})],64)):(c(),W(M,{key:1},[v(e9,{title:z(n)(`diff.title`),closable:e.closable,"close-label":z(n)(`diff.close`),onClose:w},{default:B(()=>[F(`span`,ADe,U(z(n)(e.changes.length===1?`diff.fileCountOne`:`diff.fileCountOther`,{number:e.changes.length})),1),v(s6,{"model-value":T.value,size:`sm`,options:[{value:`list`,label:z(n)(`diff.list`)},{value:`tree`,label:z(n)(`diff.tree`)}],"onUpdate:modelValue":D},null,8,[`model-value`,`options`])]),_:1},8,[`title`,`closable`,`close-label`]),F(`div`,jDe,[p.value?(c(),W(M,{key:0},[F(`span`,MDe,U(z(n)(`diff.branch`)),1),F(`span`,NDe,U(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(c(),W(`span`,PDe,[v(vp,{text:z(n)(`diff.aheadTitle`)},{default:B(()=>[e.gitInfo.ahead>0?(c(),W(`span`,FDe,`↑`+U(e.gitInfo.ahead),1)):E(``,!0)]),_:1},8,[`text`]),v(vp,{text:z(n)(`diff.behindTitle`)},{default:B(()=>[e.gitInfo.behind>0?(c(),W(`span`,IDe,`↓`+U(e.gitInfo.behind),1)):E(``,!0)]),_:1},8,[`text`])])):E(``,!0)],64)):(c(),W(`span`,LDe,U(z(n)(`diff.empty`)),1))]),m.value&&T.value===`list`?(c(),W(`div`,RDe,[(c(!0),W(M,null,_(e.changes,e=>(c(),P(vp,{key:e.path,text:e.path},{default:B(()=>[F(`button`,{type:`button`,class:`ch-row`,onClick:t=>S(e.path)},[F(`span`,{class:V([`badge`,l(e.status)])},U(d(e.status)),3),F(`span`,BDe,U(f(e.path)),1)],8,zDe)]),_:2},1032,[`text`]))),128))])):m.value&&T.value===`tree`?(c(),W(`div`,VDe,[F(`ul`,HDe,[(c(!0),W(M,null,_(N.value,({node:e,depth:t})=>(c(),W(`li`,{key:e.path,class:`tree-node`},[e.kind===`folder`?(c(),W(`button`,{key:0,type:`button`,class:`tree-row tree-folder`,style:ae({paddingLeft:I(t)}),onClick:t=>ee(e)},[v(X,{class:`tree-icon`,name:`folder-solid`,size:`sm`}),F(`span`,WDe,U(e.name),1)],12,UDe)):(c(),P(vp,{key:1,text:e.path},{default:B(()=>[F(`button`,{type:`button`,class:`tree-row tree-file`,style:ae({paddingLeft:I(t)}),onClick:t=>S(e.path)},[F(`span`,{class:V([`badge`,l(e.status)])},U(d(e.status)),3),F(`span`,KDe,U(e.name),1)],12,GDe)]),_:2},1032,[`text`]))]))),128))])])):p.value?(c(),W(`div`,qDe,U(z(n)(`diff.clean`)),1)):(c(),W(`div`,JDe,U(z(n)(`diff.empty`)),1))],64))]))}}),[[`__scopeId`,`data-v-03a07717`]]),XDe={class:`panel-tab-bar`},ZDe=[`data-tab-id`],QDe=[`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],$De={class:`ptb-t`},eOe=[`aria-label`,`onClick`],tOe={class:`ptb-tail`},nOe=[`disabled`],rOe=[`disabled`],iOe=Y(G({__name:`PanelTabBar`,props:{tabs:{},activeId:{},expanded:{type:Boolean},mobile:{type:Boolean},canOpenDiff:{type:Boolean},canOpenSideChat:{type:Boolean}},emits:[`activate`,`close`,`toggleExpanded`,`hide`,`openDiff`,`openSideChat`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null),l=R(null),u=R(null),d=R(!1);s(()=>r.activeId,async e=>{e&&(await n(),Array.from(o.value?.querySelectorAll(`[data-tab-id]`)??[]).find(t=>t.dataset.tabId===e)?.scrollIntoView?.({inline:`nearest`,block:`nearest`}))});function f(e){Array.from(o.value?.querySelectorAll(`.ptb-tab-main`)??[])[e]?.focus()}function p(e,t){if(r.tabs.length===0)return;let a;e.key===`ArrowRight`?a=(t+1)%r.tabs.length:e.key===`ArrowLeft`?a=(t-1+r.tabs.length)%r.tabs.length:e.key===`Home`?a=0:e.key===`End`&&(a=r.tabs.length-1),a!==void 0&&(e.preventDefault(),i(`activate`,r.tabs[a].id),n(()=>f(a)))}function m(){d.value=!1,document.removeEventListener(`pointerdown`,g,!0)}function g(e){let t=e.target;u.value?.contains(t)||l.value?.el?.contains(t)||m()}function y(){if(d.value){m();return}d.value=!0,document.addEventListener(`pointerdown`,g,!0),n(()=>u.value?.querySelector(`button:not(:disabled)`)?.focus())}function b(e){m(),i(e===`diff`?`openDiff`:`openSideChat`)}return h(m),(t,n)=>(c(),W(`header`,XDe,[F(`div`,{ref_key:`tabsRef`,ref:o,class:`ptb-tabs`,role:`tablist`},[(c(!0),W(M,null,_(e.tabs,(t,n)=>(c(),W(`div`,{key:t.id,class:V([`ptb-tab`,{on:t.id===e.activeId}]),"data-tab-id":t.id},[F(`button`,{type:`button`,class:`ptb-tab-main`,role:`tab`,"aria-selected":t.id===e.activeId,tabindex:t.id===e.activeId?0:-1,title:t.title,onClick:e=>i(`activate`,t.id),onKeydown:e=>p(e,n)},[v(X,{name:t.icon,size:`sm`},null,8,[`name`]),F(`span`,$De,U(t.title),1)],40,QDe),v(vp,{text:z(a)(`panel.closeTab`)},{default:B(()=>[F(`button`,{type:`button`,class:`ptb-x`,"aria-label":z(a)(`panel.closeTab`),onClick:H(e=>i(`close`,t.id),[`stop`])},[v(X,{name:`close`,size:`sm`})],8,eOe)]),_:2},1032,[`text`])],10,ZDe))),128))],512),F(`div`,tOe,[v(Ca,{ref_key:`addButtonRef`,ref:l,size:`sm`,label:z(a)(`panel.newTab`),"aria-haspopup":`menu`,"aria-expanded":d.value,onClick:y,onKeydown:[ie(H(y,[`prevent`]),[`down`]),ie(H(y,[`prevent`]),[`up`])]},{default:B(()=>[v(X,{name:`plus`,size:`sm`})]),_:1},8,[`label`,`aria-expanded`,`onKeydown`]),e.tabs.length>0&&!e.mobile?(c(),P(Ca,{key:0,size:`sm`,label:e.expanded?z(a)(`panel.collapse`):z(a)(`panel.expand`),onClick:n[0]||=e=>i(`toggleExpanded`)},{default:B(()=>[v(X,{name:e.expanded?`collapse`:`expand`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])):E(``,!0),v(Ca,{class:`ptb-hide`,size:`sm`,label:z(a)(`panel.hide`),onClick:n[1]||=e=>i(`hide`)},{default:B(()=>[v(X,{name:e.mobile?`close`:`panel-collapse-right`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`]),d.value?(c(),W(`div`,{key:1,ref_key:`addMenuRef`,ref:u,class:`panel-add-menu`,role:`menu`,onKeydown:n[4]||=ie(H(e=>{m(),l.value?.el?.focus()},[`prevent`]),[`esc`])},[F(`button`,{type:`button`,role:`menuitem`,disabled:!e.canOpenSideChat,onClick:n[2]||=e=>b(`sideChat`)},[v(X,{name:`message`,size:`sm`}),F(`span`,null,U(z(a)(`sideChat.title`)),1)],8,nOe),F(`button`,{type:`button`,role:`menuitem`,disabled:!e.canOpenDiff,onClick:n[3]||=e=>b(`diff`)},[v(X,{name:`git-fork`,size:`sm`}),F(`span`,null,U(z(a)(`panel.tabs.diff`)),1)],8,rOe)],544)):E(``,!0)])]))}}),[[`__scopeId`,`data-v-da364eda`]]);function E9(e,t){let r=null;p(()=>{r=typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null,n(()=>{let n=t?.value??e.value;try{n?.focus()}catch{}})}),ne(()=>{let e=r;if(r=null,!(!e||typeof document>`u`||!document.contains(e)))try{e.focus()}catch{}})}var aOe={class:`search-wrap`},oOe={key:0,class:`tab-strip`},sOe={key:1,class:`state-row`},cOe={key:2,class:`state-row unavail`},lOe={key:3,class:`model-list`},uOe=[`aria-selected`,`onClick`,`onMouseenter`],dOe={class:`check`},fOe={class:`model-main`},pOe={class:`model-name`},mOe={class:`model-id`},hOe={key:0,class:`caps`},gOe={class:`model-provider`},_Oe={class:`model-ctx`},vOe={key:0,class:`empty`},yOe={class:`footer-hint`},bOe=Y(G({__name:`ModelPicker`,props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:[`select`,`toggle-star`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=a6(),i=L(()=>r.value?F7:If),a=L(()=>r.value?{modelValue:!0,title:n(`model.title`),closeOnEsc:!1}:{open:!0,title:n(`model.title`),closeOnEsc:!1,size:`xl`,height:`fixed`}),o=e,l=t,u=L(()=>new Set(o.starredIds??[]));function d(e){return u.value.has(e)}let f=R(``),m=R(null),g=R(null),y=R(`all`);E9(g,m);let b=L(()=>{let e=new Set,t=[{id:`all`,label:n(`model.allTab`)}];for(let n of o.models)e.has(n.provider)||(e.add(n.provider),t.push({id:n.provider,label:n.provider}));return t}),S=L(()=>{let e=f.value.toLowerCase().trim(),t=o.models.filter(t=>{if(y.value!==`all`&&t.provider!==y.value)return!1;let n=(t.displayName??t.model).toLowerCase().includes(e),r=t.provider.toLowerCase().includes(e),i=t.id.toLowerCase().includes(e);return!e||n||r||i});return y.value===`all`?t.sort((e,t)=>{let n=+!!d(e.id);return+!!d(t.id)-n}):t}),C=L(()=>S.value),w=R(0);s([f,y],()=>{w.value=0}),s(b,e=>{e.some(e=>e.id===y.value)||(y.value=`all`)}),s(C,e=>{w.value=Math.min(w.value,Math.max(e.length-1,0))});function T(e){if(e.key===`Escape`){l(`close`);return}if(e.key===`ArrowDown`)e.preventDefault(),w.value=Math.min(w.value+1,C.value.length-1);else if(e.key===`ArrowUp`)e.preventDefault(),w.value=Math.max(w.value-1,0);else if(e.key===`Enter`){let e=C.value[w.value];e&&l(`select`,e.id)}}p(()=>{document.addEventListener(`keydown`,T)}),h(()=>{document.removeEventListener(`keydown`,T)});function D(e){l(`select`,e)}function O(e){return C.value.indexOf(e)}function k(e){y.value=e}let A={image_in:`imageIn`,imageIn:`imageIn`,image_out:`imageOut`,imageOut:`imageOut`,vision:`vision`,video_in:`videoIn`,videoIn:`videoIn`,audio_in:`audioIn`,audioIn:`audioIn`,audio_out:`audioOut`,audioOut:`audioOut`,thinking:`thinking`,always_thinking:`alwaysThinking`,alwaysThinking:`alwaysThinking`,adaptive_thinking:`adaptiveThinking`,adaptiveThinking:`adaptiveThinking`,tool_use:`toolUse`,toolUse:`toolUse`,fast_mode:`fastMode`,fastMode:`fastMode`};function j(e){let t=A[e];return t?n(`model.capabilities.${t}`):n(`model.capabilities.unknown`,{capability:e})}return(t,s)=>(c(),P(x(i.value),re(a.value,{onClose:s[1]||=e=>l(`close`)}),{default:B(()=>[F(`div`,{ref_key:`dialogRef`,ref:g,class:V([`mp`,{"mp--sheet":z(r)}])},[F(`div`,aOe,[v(Pp,{ref_key:`searchRef`,ref:m,modelValue:f.value,"onUpdate:modelValue":s[0]||=e=>f.value=e,placeholder:z(n)(`model.searchPlaceholder`),autocomplete:`off`,spellcheck:`false`,autofocus:``},null,8,[`modelValue`,`placeholder`])]),b.value.length>1?(c(),W(`div`,oOe,[(c(!0),W(M,null,_(b.value,e=>(c(),P(YT,{key:e.id,variant:e.id===y.value?`secondary`:`ghost`,size:`sm`,onClick:t=>k(e.id)},{default:B(()=>[K(U(e.label),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):E(``,!0),e.loading?(c(),W(`div`,sOe,[v(np,{size:`sm`}),F(`span`,null,U(z(n)(`model.loading`)),1)])):e.unavailable?(c(),W(`div`,cOe,[v(X,{name:`alert-triangle`,size:`lg`}),F(`span`,null,U(z(n)(`model.unavailable`)),1)])):(c(),W(`div`,lOe,[(c(!0),W(M,null,_(C.value,t=>(c(),W(`div`,{key:t.id,class:V([`model-row`,{"is-current":t.id===e.current,"is-selected":O(t)===w.value}]),role:`option`,"aria-selected":t.id===e.current,onClick:e=>D(t.id),onMouseenter:e=>w.value=O(t)},[F(`span`,dOe,[t.id===e.current?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)]),F(`span`,fOe,[F(`span`,pOe,U(t.displayName??t.model),1),F(`span`,mOe,U(t.id),1),t.capabilities&&t.capabilities.length>0?(c(),W(`span`,hOe,[(c(!0),W(M,null,_(t.capabilities,e=>(c(),P(ip,{key:e,variant:`info`,size:`sm`},{default:B(()=>[K(U(j(e)),1)]),_:2},1024))),128))])):E(``,!0)]),F(`span`,gOe,U(t.provider),1),F(`span`,_Oe,U(z(n)(`model.contextSuffix`,{size:z(mO)(t.maxContextSize)})),1),v(Ca,{size:`sm`,label:d(t.id)?z(n)(`model.unstarTitle`):z(n)(`model.starTitle`),onClick:H(e=>l(`toggle-star`,t.id),[`stop`])},{default:B(()=>[d(t.id)?(c(),P(X,{key:0,name:`star`,size:`md`})):(c(),P(X,{key:1,name:`star-outline`,size:`md`}))]),_:2},1032,[`label`,`onClick`])],42,uOe))),128)),C.value.length===0&&!e.loading&&!e.unavailable?(c(),W(`div`,vOe,U(o.models.length===0?z(n)(`model.emptyNoModels`):z(n)(`model.emptyNoMatch`)),1)):E(``,!0)])),F(`div`,yOe,U(z(n)(`model.footerHint`)),1)],2)]),_:1},16))}}),[[`__scopeId`,`data-v-466b8fec`]]),xOe=[`aria-checked`,`aria-label`,`disabled`],D9=Y(G({__name:`Switch`,props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(c(),W(`button`,{class:V([`ui-switch`,{"is-on":e.modelValue}]),type:`button`,role:`switch`,"aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:r[0]||=t=>n(`update:modelValue`,!e.modelValue)},[...r[1]||=[F(`span`,{class:`ui-switch__thumb`},null,-1)]],10,xOe))}}),[[`__scopeId`,`data-v-d7337ade`]]),SOe=[`value`,`disabled`],O9=Y(G({__name:`Select`,props:{modelValue:{},size:{default:`md`},disabled:{type:Boolean},error:{type:Boolean}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;function r(e){n(`update:modelValue`,e.target.value)}return(t,n)=>(c(),W(`select`,{class:V([`ui-select`,[`ui-select--${e.size}`,{"has-error":e.error}]]),value:e.modelValue,disabled:e.disabled,onChange:r},[me(t.$slots,`default`,{},void 0,!0)],42,SOe))}}),[[`__scopeId`,`data-v-77d887db`]]),k9=Y(G({__name:`Skeleton`,props:{width:{},height:{},circle:{type:Boolean}},setup(e){return(t,n)=>(c(),W(`span`,{class:V([`ui-skeleton`,{"is-circle":e.circle}]),style:ae({width:e.width??`100%`,height:e.height??`12px`}),"aria-hidden":`true`},null,6))}}),[[`__scopeId`,`data-v-f4989189`]]),COe=[`pythinker`,`openai`,`openai_responses`,`anthropic`,`google-genai`,`vertexai`],wOe=/^[\p{L}\p{N}][\p{L}\p{N}\-_ ]*$/u;function A9(){return{model:``,maxContextSize:``,displayName:``}}function j9(){return{id:``,type:`openai`,apiKey:``,baseUrl:``,models:[A9()]}}function TOe(e,t){let n=[];for(let r of Object.values(t??{})){if(typeof r!=`object`||!r)continue;let t=r;t.provider===e.id&&n.push({model:typeof t.model==`string`?t.model:``,maxContextSize:typeof t.maxContextSize==`number`?String(t.maxContextSize):``,displayName:typeof t.displayName==`string`?t.displayName:``})}if(n.length>0)return n;let r=`${e.id}/`;return(e.models??[]).map(e=>({model:e.startsWith(r)?e.slice(r.length):e,maxContextSize:``,displayName:``}))}function EOe(e,t={}){let n={models:{}},r=e.id.trim();return r===``?n.id=`idRequired`:wOe.test(r)||(n.id=`idInvalid`),t.apiKey===!0&&e.apiKey.trim()===``&&(n.apiKey=`apiKeyRequired`),t.baseUrl===!0&&e.baseUrl.trim()===``&&(n.baseUrl=`baseUrlRequired`),e.models.length===0&&(n.modelsEmpty=`modelRequired`),e.models.forEach((e,t)=>{let r={};e.model.trim()===``&&(r.model=`modelRequired`);let i=e.maxContextSize.trim(),a=Number(i);i===``?r.maxContextSize=`contextSizeRequired`:(!/^\d+$/.test(i)||!Number.isSafeInteger(a)||a<1)&&(r.maxContextSize=`contextSizeInvalid`),(r.model!==void 0||r.maxContextSize!==void 0)&&(n.models[t]=r)}),n}function DOe(e){return e.id!==void 0||e.apiKey!==void 0||e.baseUrl!==void 0||e.modelsEmpty!==void 0||Object.keys(e.models).length>0}function M9(e){return e.map(e=>({model:e.model.trim(),maxContextSize:Number(e.maxContextSize.trim()),displayName:e.displayName.trim()||void 0}))}function OOe(e){return{id:e.id.trim(),type:e.type,apiKey:e.apiKey.trim()||void 0,baseUrl:e.baseUrl.trim()||void 0,models:M9(e.models)}}function kOe(e,t,n,r){let i=M9(e.models),a=r?.includes(`/`)?r.slice(r.indexOf(`/`)+1):r;return{newId:e.id.trim()===t.id?void 0:e.id.trim(),type:e.type,apiKey:e.apiKey.trim()||(n?``:void 0),baseUrl:e.baseUrl.trim()||void 0,defaultModel:a&&i.some(e=>e.model===a)?a:void 0,models:i}}var AOe={class:`provider-form__fields`},jOe=[`value`],MOe={class:`provider-form__key`},NOe={class:`provider-form__models-head`},POe=[`aria-expanded`],FOe={class:`provider-form__models-count`},IOe={key:0,class:`provider-form__models`},LOe={class:`provider-form__model provider-form__model--head`},ROe={key:0,class:`provider-form__row-error`,role:`alert`},zOe={key:1,class:`provider-form__error`,role:`alert`},BOe={class:`provider-form__actions`},N9=Y(G({__name:`ProviderForm`,props:{mode:{},provider:{},config:{}},emits:[`dirtyChange`,`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=N(j9()),o=R({models:{}}),l=R(``),u=R(!1),d=R(!1),f=R(n.mode===`add`),m=R(!1),h=R(!1),g=R(!1),y=L(()=>COe.map(e=>({value:e,label:i(`providers.types.${e}`)})));function b(){let e=n.provider;if(n.mode===`edit`&&e!==void 0){a.id=e.id,a.type=e.type,a.apiKey=``,a.baseUrl=e.baseUrl??``;let t=TOe(e,n.config?.models);a.models=t.length>0?t:[A9()]}else Object.assign(a,j9());o.value={models:{}},l.value=``,m.value=!1,r(`dirtyChange`,!1)}function x(e){let t=o.value[e];return t===void 0?``:i(`providers.error.${t}`)}function S(e,t){let n=o.value.models[e]?.[t];return n===void 0?``:i(`providers.error.${n}`)}function C(e){if(o.value[e]===void 0)return;let{[e]:t,...n}=o.value;o.value={...n,models:o.value.models}}function w(e,t){let n=o.value.models[e];if(n?.[t]===void 0)return;let{[t]:r,...i}=n,{[e]:a,...s}=o.value.models;o.value={...o.value,models:Object.keys(i).length>0?{...s,[e]:i}:s}}async function T(){let e=n.provider;if(!(n.mode!==`edit`||e===void 0||!e.hasApiKey))try{let t=await Q().getProvider(e.id);t.apiKey&&!g.value&&(a.apiKey=t.apiKey,h.value=!0)}catch{h.value=!1}}function D(){m.value=!0,r(`dirtyChange`,!0)}s(()=>n.config,()=>{n.mode===`edit`&&!m.value&&b()});function O(){f.value=!0,a.models.push(A9()),D()}function k(e){a.models.length<=1||(a.models.splice(e,1),o.value={...o.value,models:{}},D())}async function A(){if(u.value)return;let e=EOe(a,{apiKey:n.mode===`add`,baseUrl:n.mode===`add`});if(o.value=e,DOe(e)){(Object.keys(e.models).length>0||e.modelsEmpty!==void 0)&&(f.value=!0),l.value=e.modelsEmpty===void 0?``:i(`providers.error.${e.modelsEmpty}`);return}u.value=!0,l.value=``;try{if(n.mode===`add`){let e=await Q().addProvider(OOe(a));r(`dirtyChange`,!1),r(`saved`,e.id);return}let e=n.provider;if(e===void 0)return;let t=await Q().updateProvider(e.id,kOe(a,e,h.value,n.config?.providers[e.id]?.defaultModel));r(`dirtyChange`,!1),r(`saved`,t.provider.id)}catch{l.value=i(`providers.saveFailed`)}finally{u.value=!1}}return p(()=>{b(),T()}),(t,n)=>(c(),W(`form`,{class:`provider-form`,onSubmit:H(A,[`prevent`]),onInput:D},[F(`div`,AOe,[v(k7,{label:z(i)(`providers.fieldId`),error:x(`id`)},{default:B(()=>[v(Pp,{modelValue:a.id,"onUpdate:modelValue":[n[0]||=e=>a.id=e,n[1]||=e=>C(`id`)],autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`])]),_:1},8,[`label`,`error`]),v(k7,{label:z(i)(`providers.fieldType`)},{default:B(()=>[v(O9,{modelValue:a.type,"onUpdate:modelValue":n[2]||=e=>a.type=e},{default:B(()=>[(c(!0),W(M,null,_(y.value,e=>(c(),W(`option`,{key:e.value,value:e.value},U(e.label),9,jOe))),128))]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),v(k7,{label:z(i)(`providers.fieldApiKey`),error:x(`apiKey`)},{default:B(()=>[F(`div`,MOe,[v(Pp,{modelValue:a.apiKey,"onUpdate:modelValue":[n[3]||=e=>a.apiKey=e,n[4]||=e=>{g.value=!0,C(`apiKey`)}],type:d.value?`text`:`password`,placeholder:e.provider?.hasApiKey?z(i)(`providers.apiKeySet`):`sk-…`,autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`,`type`,`placeholder`]),v(Ca,{class:`provider-form__eye`,size:`sm`,label:d.value?z(i)(`providers.hideApiKey`):z(i)(`providers.showApiKey`),onClick:n[5]||=e=>d.value=!d.value},{default:B(()=>[v(X,{name:d.value?`eye-off`:`eye`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),_:1},8,[`label`,`error`]),v(k7,{label:z(i)(`providers.fieldBaseUrl`),error:x(`baseUrl`)},{default:B(()=>[v(Pp,{modelValue:a.baseUrl,"onUpdate:modelValue":[n[6]||=e=>a.baseUrl=e,n[7]||=e=>C(`baseUrl`)],placeholder:z(i)(`providers.baseUrlPlaceholder`),autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`error`])]),F(`div`,NOe,[F(`button`,{type:`button`,class:`provider-form__models-toggle`,"aria-expanded":f.value,"data-testid":`provider-form-models-toggle`,onClick:n[8]||=e=>f.value=!f.value},[v(X,{name:f.value?`chevron-down`:`chevron-right`,size:`sm`},null,8,[`name`]),F(`strong`,null,U(z(i)(`providers.fieldModels`)),1),F(`span`,FOe,U(z(i)(`providers.modelCount`,{count:a.models.length})),1)],8,POe),v(YT,{type:`button`,size:`sm`,variant:`secondary`,onClick:O},{default:B(()=>[v(X,{name:`plus`,size:`sm`}),K(U(z(i)(`providers.addModel`)),1)]),_:1})]),f.value?(c(),W(`div`,IOe,[F(`div`,LOe,[F(`span`,null,U(z(i)(`providers.colModelId`)),1),F(`span`,null,U(z(i)(`providers.colContext`)),1),F(`span`,null,U(z(i)(`providers.colDisplayName`)),1),n[10]||=F(`span`,null,null,-1)]),(c(!0),W(M,null,_(a.models,(e,t)=>(c(),W(M,{key:t},[F(`div`,{class:V([`provider-form__model`,{"has-error":!!o.value.models[t]}])},[v(Pp,{modelValue:e.model,"onUpdate:modelValue":[t=>e.model=t,e=>w(t,`model`)],placeholder:z(i)(`providers.modelIdPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),v(Pp,{modelValue:e.maxContextSize,"onUpdate:modelValue":[t=>e.maxContextSize=t,e=>w(t,`maxContextSize`)],inputmode:`numeric`,placeholder:z(i)(`providers.modelContextPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),v(Pp,{modelValue:e.displayName,"onUpdate:modelValue":t=>e.displayName=t,placeholder:z(i)(`providers.modelNamePlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),v(Ca,{size:`sm`,disabled:a.models.length<=1,label:z(i)(`providers.removeModel`),onClick:e=>k(t)},{default:B(()=>[v(X,{name:`trash`,size:`sm`})]),_:1},8,[`disabled`,`label`,`onClick`])],2),o.value.models[t]?(c(),W(`div`,ROe,U([S(t,`model`),S(t,`maxContextSize`)].filter(Boolean).join(` · `)),1)):E(``,!0)],64))),128))])):E(``,!0),l.value?(c(),W(`div`,zOe,U(l.value),1)):E(``,!0),F(`div`,BOe,[v(YT,{type:`button`,variant:`secondary`,onClick:n[9]||=e=>r(`cancel`)},{default:B(()=>[K(U(z(i)(`common.cancel`)),1)]),_:1}),v(YT,{type:`submit`,variant:`primary`,loading:u.value},{default:B(()=>[K(U(z(i)(`providers.save`)),1)]),_:1},8,[`loading`])])],32))}}),[[`__scopeId`,`data-v-7ed55f2f`]]),VOe={class:`add-provider-flow`},HOe={key:0,class:`add-provider-flow__section`},UOe={key:0,class:`add-provider-flow__state`},WOe={key:1,class:`add-provider-flow__state`},GOe={class:`add-provider-flow__catalog`},KOe=[`disabled`,`onClick`],qOe={class:`add-provider-flow__name`},JOe={key:0,class:`add-provider-flow__empty`},YOe={class:`add-provider-flow__key`},XOe={key:1,class:`add-provider-flow__warning`},ZOe={class:`add-provider-flow__note`},QOe={key:2,class:`add-provider-flow__error`,role:`alert`},$Oe={class:`add-provider-flow__actions`},eke={class:`add-provider-flow__note`},tke={class:`add-provider-flow__key`},nke={key:0,class:`add-provider-flow__error`,role:`alert`},rke={class:`add-provider-flow__actions`},ike={key:2,class:`add-provider-flow__section`},P9=Y(G({__name:`AddProviderFlow`,props:{config:{},initialSource:{}},emits:[`dirtyChange`,`added`,`cancel`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=R(n.initialSource??`catalog`),o=L(()=>[{value:`catalog`,label:i(`providers.catalog.sourceCatalog`)},{value:`registry`,label:i(`providers.catalog.sourceRegistry`)},{value:`manual`,label:i(`providers.catalog.sourceManual`)}]),s=R([]),l=R(`loading`),u=R(``),d=R(null),f=N({id:``,apiKey:``,baseUrl:``}),m=R(``),h=R(!1),g=R(!1),y=N({url:``,apiKey:``}),b=R(``),x=R(!1),S=R(!1),C=L(()=>{let e=u.value.trim().toLowerCase();return e===``?s.value:s.value.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))}),w=L(()=>Object.hasOwn(n.config?.providers??{},f.id.trim()));async function T(){l.value=`loading`;try{s.value=await Q().listCatalogProviders(),l.value=`ready`;let e=s.value.filter(e=>!e.rejected);e.length===1&&d.value===null&&O(e[0])}catch{l.value=`error`}}function D(e){let t=e.rejectReason===null?``:`providers.catalog.rejectReason.${e.rejectReason}`;return t!==``&&i(t)!==t?i(t):i(`providers.catalog.rejected`)}function O(e){e.rejected||(d.value=e,f.id=e.id,f.apiKey=``,f.baseUrl=``,m.value=``)}function k(){r(`dirtyChange`,!0)}async function A(){let e=d.value;if(e===null||h.value)return;let t=f.id.trim();if(t===``){m.value=i(`providers.error.idRequired`);return}if(f.apiKey.trim()===``){m.value=i(`providers.error.apiKeyRequired`);return}if(e.needsBaseUrl&&f.baseUrl.trim()===``){m.value=i(`providers.error.baseUrlRequired`);return}h.value=!0,m.value=``;try{await Q().importCatalogProvider({catalogId:e.id,id:t===e.id?void 0:t,apiKey:f.apiKey.trim(),baseUrl:f.baseUrl.trim()||void 0}),r(`dirtyChange`,!1),r(`added`,t)}catch{m.value=i(`providers.addFailed`)}finally{h.value=!1}}async function j(){if(x.value)return;let e=y.url.trim();if(e===``){b.value=i(`providers.error.registryUrlRequired`);return}x.value=!0,b.value=``;try{let t=await Q().importCustomRegistry({url:e,apiKey:y.apiKey.trim()||void 0});r(`dirtyChange`,!1);let n=t.providers[0];n===void 0?r(`cancel`):r(`added`,n.id)}catch{b.value=i(`providers.addFailed`)}finally{x.value=!1}}return p(T),(t,n)=>(c(),W(`div`,VOe,[v(s6,{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e,size:`sm`,options:o.value},null,8,[`modelValue`,`options`]),a.value===`catalog`?(c(),W(`section`,HOe,[l.value===`loading`?(c(),W(`div`,UOe,[v(np,{size:`sm`}),K(U(z(i)(`providers.catalog.loading`)),1)])):l.value===`error`?(c(),W(`div`,WOe,[F(`span`,null,U(z(i)(`providers.catalog.loadError`)),1),v(YT,{size:`sm`,variant:`secondary`,onClick:T},{default:B(()=>[K(U(z(i)(`providers.catalog.retry`)),1)]),_:1})])):d.value===null?(c(),W(M,{key:2},[v(Pp,{modelValue:u.value,"onUpdate:modelValue":n[1]||=e=>u.value=e,placeholder:z(i)(`providers.catalog.searchPlaceholder`),autocomplete:`off`},null,8,[`modelValue`,`placeholder`]),F(`div`,GOe,[(c(!0),W(M,null,_(C.value,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`add-provider-flow__entry`,disabled:e.rejected,onClick:t=>O(e)},[F(`span`,qOe,U(e.name),1),e.wireType?(c(),P(ip,{key:0,size:`sm`,variant:`neutral`},{default:B(()=>[K(U(e.wireType),1)]),_:2},1024)):E(``,!0),n[15]||=F(`span`,{class:`add-provider-flow__grow`},null,-1),F(`span`,null,U(e.rejected?D(e):z(i)(`providers.modelCount`,{count:e.models.length})),1)],8,KOe))),128)),C.value.length===0?(c(),W(`div`,JOe,U(z(i)(`providers.catalog.empty`)),1)):E(``,!0)])],64)):(c(),W(`form`,{key:3,class:`add-provider-flow__form`,onSubmit:H(A,[`prevent`]),onInput:k},[F(`button`,{type:`button`,class:`add-provider-flow__back`,onClick:n[2]||=e=>d.value=null},[v(X,{class:`add-provider-flow__back-icon`,name:`chevron-right`,size:`sm`}),K(U(z(i)(`providers.catalog.backToList`)),1)]),v(k7,{label:z(i)(`providers.fieldId`)},{default:B(()=>[v(Pp,{modelValue:f.id,"onUpdate:modelValue":n[3]||=e=>f.id=e,autocomplete:`off`},null,8,[`modelValue`])]),_:1},8,[`label`]),v(k7,{label:z(i)(`providers.fieldApiKey`)},{default:B(()=>[F(`div`,YOe,[v(Pp,{modelValue:f.apiKey,"onUpdate:modelValue":n[4]||=e=>f.apiKey=e,type:g.value?`text`:`password`,autocomplete:`off`},null,8,[`modelValue`,`type`]),v(Ca,{class:`add-provider-flow__eye`,size:`sm`,label:g.value?z(i)(`providers.hideApiKey`):z(i)(`providers.showApiKey`),onClick:n[5]||=e=>g.value=!g.value},{default:B(()=>[v(X,{name:g.value?`eye-off`:`eye`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),_:1},8,[`label`]),d.value.needsBaseUrl?(c(),P(k7,{key:0,label:z(i)(`providers.fieldBaseUrl`)},{default:B(()=>[v(Pp,{modelValue:f.baseUrl,"onUpdate:modelValue":n[6]||=e=>f.baseUrl=e,placeholder:z(i)(`providers.baseUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):E(``,!0),w.value?(c(),W(`div`,XOe,U(z(i)(`providers.catalog.overwriteWarning`)),1)):E(``,!0),F(`div`,ZOe,U(z(i)(`providers.catalog.willImport`,{count:d.value.models.length})),1),m.value?(c(),W(`div`,QOe,U(m.value),1)):E(``,!0),F(`div`,$Oe,[v(YT,{type:`button`,variant:`secondary`,onClick:n[7]||=e=>r(`cancel`)},{default:B(()=>[K(U(z(i)(`common.cancel`)),1)]),_:1}),v(YT,{type:`submit`,variant:`primary`,loading:h.value},{default:B(()=>[K(U(z(i)(`providers.catalog.importAction`)),1)]),_:1},8,[`loading`])])],32))])):a.value===`registry`?(c(),W(`form`,{key:1,class:`add-provider-flow__section add-provider-flow__form`,onSubmit:H(j,[`prevent`]),onInput:k},[F(`p`,eke,U(z(i)(`providers.catalog.registryHint`)),1),v(k7,{label:z(i)(`providers.catalog.registryUrlLabel`)},{default:B(()=>[v(Pp,{modelValue:y.url,"onUpdate:modelValue":n[8]||=e=>y.url=e,placeholder:`https://example.com/api.json`,autocomplete:`off`},null,8,[`modelValue`])]),_:1},8,[`label`]),v(k7,{label:z(i)(`providers.fieldApiKey`)},{default:B(()=>[F(`div`,tke,[v(Pp,{modelValue:y.apiKey,"onUpdate:modelValue":n[9]||=e=>y.apiKey=e,type:S.value?`text`:`password`,autocomplete:`off`},null,8,[`modelValue`,`type`]),v(Ca,{class:`add-provider-flow__eye`,size:`sm`,label:S.value?z(i)(`providers.hideApiKey`):z(i)(`providers.showApiKey`),onClick:n[10]||=e=>S.value=!S.value},{default:B(()=>[v(X,{name:S.value?`eye-off`:`eye`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),_:1},8,[`label`]),b.value?(c(),W(`div`,nke,U(b.value),1)):E(``,!0),F(`div`,rke,[v(YT,{type:`button`,variant:`secondary`,onClick:n[11]||=e=>r(`cancel`)},{default:B(()=>[K(U(z(i)(`common.cancel`)),1)]),_:1}),v(YT,{type:`submit`,variant:`primary`,loading:x.value},{default:B(()=>[K(U(z(i)(`providers.catalog.importAction`)),1)]),_:1},8,[`loading`])])],32)):(c(),W(`div`,ike,[v(N9,{mode:`add`,config:e.config,onDirtyChange:n[12]||=e=>r(`dirtyChange`,e),onSaved:n[13]||=e=>r(`added`,e),onCancel:n[14]||=e=>r(`cancel`)},null,8,[`config`])]))]))}}),[[`__scopeId`,`data-v-01edc4ef`]]),ake={class:`providers-panel`},oke={class:`providers-panel__heading`},ske={key:1,class:`providers-panel__split`},cke=[`aria-label`],lke={class:`providers-pane-label`},uke=[`aria-label`],dke=[`data-testid`,`aria-current`,`onClick`],fke=[`aria-label`],pke={"aria-hidden":`true`},mke={class:`providers-panel__row-name`},hke={class:`providers-pane-label`},gke=[`aria-current`],_ke={class:`providers-panel__add-icon`},vke={class:`providers-panel__row-name`},yke={class:`providers-panel__detail`},bke={class:`providers-detail__head`},xke={class:`providers-detail__tile`,"aria-hidden":`true`},Ske={class:`providers-detail__identity`},Cke={class:`providers-detail__name-row`},wke={class:`providers-detail__meta`},Tke={class:`mono`},F9=`$add`,Eke=Y(G({__name:`ProvidersPanel`,props:{discardToken:{default:0}},emits:[`dirtyChange`],setup(e,{emit:t}){let n=t,{t:r}=J(),{confirm:i}=K4(),a=D7(),o=R([]),l=R(null),u=R([]),d=L(()=>{if(l.value===null)return null;let e={};for(let t of u.value)e[t.id]=t;return Object.assign(e,l.value.models??{}),{...l.value,models:e}}),f=R(!1),m=R(!1),h=R(null),g=R(!1),y=L(()=>o.value.toSorted((e,t)=>e.id.localeCompare(t.id))),b=L(()=>h.value===F9),x=L(()=>y.value.find(e=>e.id===h.value)??null);function S(e){return e===`connected`?`ok`:e===`error`?`error`:`idle`}function C(e){return(e.trim()[0]??`?`).toUpperCase()}s(g,e=>n(`dirtyChange`,e),{immediate:!0}),s(()=>e.discardToken,()=>{g.value=!1,h.value=y.value[0]?.id??null});async function w(){await a.refreshRuntimeState(),await T()}async function T(){f.value=!0,m.value=!1;try{o.value=await Q().listProviders(),y.value.some(e=>e.id===h.value)||(h.value=y.value[0]?.id??null)}catch{o.value=[],m.value=!0}try{let[e,t]=await Promise.all([Q().getConfig(),Q().listModels().catch(()=>[])]);l.value=e,u.value=t}catch{l.value=null,u.value=[]}finally{f.value=!1}}function D(e){g.value||(h.value=e)}async function O(e){g.value=!1,await w(),h.value=e}async function k(e){await i({title:r(`providers.deleteProvider`),message:r(`providers.deleteConfirm`,{id:e.id,count:e.models?.length??0}),confirmLabel:r(`providers.deleteConfirmYes`),cancelLabel:r(`common.cancel`),variant:`danger`,action:async()=>{await a.deleteProvider(e.id),h.value=null,g.value=!1,await w()}})}return p(T),(e,t)=>(c(),W(`section`,ake,[F(`div`,oke,[F(`div`,null,[F(`h3`,null,U(z(r)(`providers.title`)),1),F(`p`,null,U(z(r)(`providers.description`)),1)]),!f.value&&!m.value?(c(),P(Ca,{key:0,size:`sm`,label:z(r)(`providers.refresh`),"data-testid":`providers-refresh`,onClick:t[0]||=e=>w()},{default:B(()=>[v(X,{name:`undo`,size:`sm`})]),_:1},8,[`label`])):E(``,!0)]),m.value?(c(),P(t9,{key:0,variant:`warning`},{default:B(()=>[K(U(z(r)(`providers.unavailable`)),1)]),_:1})):(c(),W(`div`,ske,[F(`nav`,{class:`providers-panel__list`,"aria-label":z(r)(`providers.title`)},[F(`div`,lke,U(z(r)(`settings.tabs.providers`)),1),f.value?(c(),W(M,{key:0},_(3,e=>F(`div`,{key:e,class:`providers-panel__row providers-panel__row--skeleton`,role:`status`,"aria-label":z(r)(`providers.loading`)},[v(k9,{width:`26px`,height:`26px`,circle:``}),v(k9,{width:`${52-e*6}%`,height:`11px`},null,8,[`width`])],8,uke)),64)):(c(),W(M,{key:1},[(c(!0),W(M,null,_(y.value,e=>(c(),W(`div`,{key:e.id,class:V([`providers-panel__item`,{"is-selected":h.value===e.id}])},[F(`button`,{type:`button`,class:`providers-panel__row`,"data-testid":`provider-${e.id}-toggle`,"aria-current":h.value===e.id,onClick:t=>D(e.id)},[v(vp,{text:z(r)(`providers.status.${e.status}`)},{default:B(()=>[F(`span`,{class:V([`providers-panel__tile`,`is-${S(e.status)}`]),role:`img`,"aria-label":z(r)(`providers.status.${e.status}`)},[F(`span`,pke,U(C(e.type)),1)],10,fke)]),_:2},1032,[`text`]),F(`span`,mke,U(e.id),1),F(`span`,{class:V([`providers-panel__row-dot`,`is-${S(e.status)}`]),"aria-hidden":`true`},null,2)],8,dke),v(Ca,{class:`providers-panel__row-delete`,size:`sm`,label:z(r)(`providers.deleteTitle`,{type:e.id}),"data-testid":`provider-${e.id}-delete`,onClick:H(t=>k(e),[`stop`])},{default:B(()=>[v(X,{name:`trash`,size:`sm`})]),_:1},8,[`label`,`data-testid`,`onClick`])],2))),128)),F(`div`,hke,U(z(r)(`providers.customProviders`)),1),F(`button`,{type:`button`,class:V([`providers-panel__row providers-panel__row--add`,{"is-selected":b.value}]),"aria-current":b.value,onClick:t[1]||=e=>D(F9)},[F(`span`,_ke,[v(X,{name:`plus`,size:`sm`})]),F(`span`,vke,U(z(r)(`providers.addProvider`)),1)],10,gke)],64))],8,cke),F(`div`,yke,[b.value?(c(),P(P9,{key:0,config:l.value,onDirtyChange:t[2]||=e=>g.value=e,onAdded:O,onCancel:t[3]||=e=>{h.value=y.value[0]?.id??null,g.value=!1}},null,8,[`config`])):x.value?(c(),W(M,{key:1},[F(`header`,bke,[F(`span`,xke,U(C(x.value.type)),1),F(`div`,Ske,[F(`div`,Cke,[F(`h4`,null,U(x.value.id),1),v(ip,{variant:x.value.status===`connected`?`success`:x.value.status===`error`?`danger`:`neutral`,size:`md`},{default:B(()=>[K(U(z(r)(`providers.status.${x.value.status}`)),1)]),_:1},8,[`variant`])]),F(`p`,wke,[F(`span`,null,U(x.value.type),1),x.value.baseUrl?(c(),W(M,{key:0},[t[6]||=F(`span`,{"aria-hidden":`true`},`·`,-1),F(`span`,Tke,U(x.value.baseUrl),1)],64)):E(``,!0)])])]),(c(),P(N9,{key:x.value.id,mode:`edit`,provider:x.value,config:d.value,onDirtyChange:t[4]||=e=>g.value=e,onSaved:O,onCancel:t[5]||=e=>{h.value=y.value[0]?.id??null,g.value=!1}},null,8,[`provider`,`config`]))],64)):o.value.length===0&&!f.value?(c(),P(Qw,{key:2,title:z(r)(`providers.empty`),hint:z(r)(`providers.emptyHint`)},{icon:B(()=>[v(X,{name:`bolt`})]),_:1},8,[`title`,`hint`])):E(``,!0)])]))]))}}),[[`__scopeId`,`data-v-c5995f27`]]),Dke={class:`pp`},Oke={class:`pp-title`},kke={class:`pp-note`},Ake={key:0,class:`pp-custom-body`},jke={class:`pp-hint`},Mke={key:0,class:`pp-error`},Nke={key:0,class:`pp-warn`},Pke={key:1,class:`pp-loading`},Fke={key:2,class:`pp-error-block`},Ike={key:0,class:`pp-group`},Lke={class:`pp-group-title`},Rke={class:`pp-list`},zke={class:`pp-main`},Bke={class:`pp-name-row`},Vke={class:`pp-name`},Hke={key:0,class:`pp-ver`},Uke={key:0,class:`pp-desc`},Wke={key:1,class:`pp-meta`},Gke={key:2,class:`pp-error`},Kke={key:3,class:`pp-error`},qke={class:`pp-actions`},Jke={key:1,class:`pp-group`},Yke={class:`pp-group-title`},Xke={class:`pp-list`},Zke={class:`pp-main`},Qke={class:`pp-name-row`},$ke={class:`pp-name`},eAe={key:0,class:`pp-ver`},tAe={key:0,class:`pp-desc`},nAe={key:1,class:`pp-meta`},rAe={key:2,class:`pp-error`},iAe={class:`pp-actions`},aAe={key:2,class:`pp-group`},oAe={class:`pp-group-title`},sAe={class:`pp-list`},cAe={class:`pp-main`},lAe={class:`pp-name-row`},uAe={class:`pp-name`},dAe={key:0,class:`pp-ver`},fAe={key:0,class:`pp-meta`},pAe={key:1,class:`pp-error`},mAe={key:2,class:`pp-error`},hAe={class:`pp-actions`},I9=`__custom__`,gAe=Y(G({__name:`PluginsPanel`,setup(e){let{t}=J(),n=R(!1),r=R(!1),i=R(null),a=R(!1),o=R([]),s=R([]),l=R({}),u=R({}),d=R(!1),f=R(``),m=R(null),h=L(()=>new Map(o.value.map(e=>[e.id,e]))),g=L(()=>s.value.filter(e=>e.capabilityId===void 0)),y=L(()=>g.value.filter(e=>e.tier===`official`)),b=L(()=>g.value.filter(e=>e.tier!==`official`)),x=L(()=>{let e=new Set(s.value.map(e=>e.id));return o.value.filter(t=>!e.has(t.id))}),S=L(()=>y.value.length===0&&b.value.length===0&&x.value.length===0);function C(e,t){return`${e}:${t}`}function w(e,t){return l.value[C(e,t)]===!0}function T(e,t){let n=t??e;return w(e,`install`)||w(n,`remove`)||w(n,`toggle`)}async function D(e,t,n){let r=C(e,t);l.value={...l.value,[r]:!0};let i={...u.value};delete i[e],u.value=i;try{await n()}catch(t){u.value={...u.value,[e]:t instanceof Error?t.message:String(t)}}finally{let e={...l.value};delete e[r],l.value=e}}async function O(e=!1){if(!(n.value&&!e)){n.value=!0,i.value=null,a.value=!1;try{let e=Q(),[t,n]=await Promise.all([e.listPlugins(),e.listPluginMarketplace().catch(()=>(a.value=!0,[]))]);o.value=t,s.value=n,r.value=!0}catch(e){i.value=e instanceof Error?e.message:String(e)}finally{n.value=!1}}}function k(e){return t(`settings.plugins.counts`,{skills:e.skillCount,servers:e.mcpServerCount})}function A(e){window.open(e,`_blank`,`noopener`)}function j(e){let t=h.value.get(e.id);return t?k(t):e.version?e.version:``}async function N(e){await D(e.id,`install`,async()=>{await Q().installPlugin(e.source),await O(!0)})}async function ee(){let e=f.value.trim();!e||w(I9,`install`)||await D(I9,`install`,async()=>{await Q().installPlugin(e),f.value=``,d.value=!1,await O(!0)})}async function I(e,t){await D(e,`toggle`,async()=>{await Q().setPluginEnabled(e,t),o.value=o.value.map(n=>n.id===e?{...n,enabled:t}:n)})}async function te(e){await D(e,`remove`,async()=>{await Q().removePlugin(e),await O(!0)})}function ne(){d.value=!d.value,d.value&&Promise.resolve().then(()=>m.value?.el?.focus())}return p(()=>{O(!0)}),(e,o)=>(c(),W(`section`,Dke,[F(`h3`,Oke,U(z(t)(`settings.tabs.plugins`)),1),F(`p`,kke,U(z(t)(`settings.plugins.note`)),1),F(`div`,{class:V([`pp-custom`,{open:d.value}])},[F(`button`,{type:`button`,class:`pp-custom-row`,onClick:ne},[v(X,{name:`plus`,size:`md`}),F(`span`,null,U(z(t)(`settings.plugins.customInstall`)),1),F(`span`,{class:V([`pp-chev`,{open:d.value}])},[v(X,{name:`chevron-right`,size:`sm`})],2)]),d.value?(c(),W(`div`,Ake,[F(`form`,{class:`pp-custom-form`,onSubmit:H(ee,[`prevent`])},[v(Pp,{ref_key:`customInput`,ref:m,modelValue:f.value,"onUpdate:modelValue":o[0]||=e=>f.value=e,class:`pp-custom-input`,placeholder:z(t)(`settings.plugins.customInstallPlaceholder`),"aria-label":z(t)(`settings.plugins.customInstall`)},null,8,[`modelValue`,`placeholder`,`aria-label`]),v(YT,{size:`sm`,variant:`primary`,type:`submit`,loading:w(I9,`install`),disabled:f.value.trim()===``},{default:B(()=>[K(U(z(t)(`settings.plugins.install`)),1)]),_:1},8,[`loading`,`disabled`])],32),F(`p`,jke,U(z(t)(`settings.plugins.customInstallHint`)),1),u.value[I9]?(c(),W(`p`,Mke,U(u.value[I9]),1)):E(``,!0)])):E(``,!0)],2),a.value?(c(),W(`p`,Nke,U(z(t)(`settings.plugins.catalogUnavailable`)),1)):E(``,!0),n.value&&!r.value?(c(),W(`div`,Pke,[v(np,{size:`sm`}),F(`span`,null,U(z(t)(`settings.plugins.loading`)),1)])):i.value?(c(),W(`div`,Fke,[F(`span`,null,U(i.value),1),v(YT,{size:`sm`,variant:`secondary`,onClick:o[1]||=e=>O(!0)},{default:B(()=>[K(U(z(t)(`settings.plugins.retry`)),1)]),_:1})])):S.value?(c(),P(Qw,{key:3,title:z(t)(`settings.plugins.empty`)},null,8,[`title`])):(c(),W(M,{key:4},[y.value.length>0?(c(),W(`section`,Ike,[F(`h4`,Lke,U(z(t)(`settings.plugins.official`)),1),F(`div`,Rke,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`article`,{key:e.id,class:`pp-row`},[F(`div`,zke,[F(`div`,Bke,[F(`span`,Vke,U(e.displayName),1),e.version?(c(),W(`span`,Hke,U(e.version),1)):E(``,!0)]),e.description?(c(),W(`p`,Uke,U(e.description),1)):E(``,!0),j(e)?(c(),W(`p`,Wke,U(j(e)),1)):E(``,!0),u.value[e.id]?(c(),W(`p`,Gke,U(u.value[e.id]),1)):E(``,!0),h.value.get(e.id)?.hasErrors?(c(),W(`p`,Kke,U(z(t)(`settings.plugins.hasErrors`)),1)):E(``,!0)]),F(`div`,qke,[h.value.has(e.id)?(c(),W(M,{key:0},[v(D9,{"model-value":h.value.get(e.id).enabled,disabled:T(e.id,e.id),"aria-label":z(t)(`settings.plugins.enabled`),"onUpdate:modelValue":t=>I(e.id,t)},null,8,[`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`]),v(vp,{text:z(t)(`settings.plugins.remove`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.remove`),disabled:T(e.id,e.id),onClick:t=>te(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`disabled`,`onClick`])]),_:2},1032,[`text`])],64)):(c(),P(YT,{key:1,size:`sm`,variant:`secondary`,loading:w(e.id,`install`),onClick:t=>N(e)},{default:B(()=>[K(U(e.updateAvailable?z(t)(`settings.plugins.update`):z(t)(`settings.plugins.install`)),1)]),_:2},1032,[`loading`,`onClick`])),e.homepage?(c(),P(vp,{key:2,text:z(t)(`settings.plugins.homepage`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.homepage`),onClick:t=>A(e.homepage)},{default:B(()=>[v(X,{name:`external-link`,size:`sm`})]),_:1},8,[`label`,`onClick`])]),_:2},1032,[`text`])):E(``,!0)])]))),128))])])):E(``,!0),b.value.length>0?(c(),W(`section`,Jke,[F(`h4`,Yke,U(z(t)(`settings.plugins.thirdParty`)),1),F(`div`,Xke,[(c(!0),W(M,null,_(b.value,e=>(c(),W(`article`,{key:e.id,class:`pp-row`},[F(`div`,Zke,[F(`div`,Qke,[F(`span`,$ke,U(e.displayName),1),e.version?(c(),W(`span`,eAe,U(e.version),1)):E(``,!0)]),e.description?(c(),W(`p`,tAe,U(e.description),1)):E(``,!0),j(e)?(c(),W(`p`,nAe,U(j(e)),1)):E(``,!0),u.value[e.id]?(c(),W(`p`,rAe,U(u.value[e.id]),1)):E(``,!0)]),F(`div`,iAe,[h.value.has(e.id)?(c(),W(M,{key:0},[v(D9,{"model-value":h.value.get(e.id).enabled,disabled:T(e.id,e.id),"aria-label":z(t)(`settings.plugins.enabled`),"onUpdate:modelValue":t=>I(e.id,t)},null,8,[`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`]),v(vp,{text:z(t)(`settings.plugins.remove`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.remove`),disabled:T(e.id,e.id),onClick:t=>te(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`disabled`,`onClick`])]),_:2},1032,[`text`])],64)):(c(),P(YT,{key:1,size:`sm`,variant:`secondary`,loading:w(e.id,`install`),onClick:t=>N(e)},{default:B(()=>[K(U(z(t)(`settings.plugins.install`)),1)]),_:1},8,[`loading`,`onClick`]))])]))),128))])])):E(``,!0),x.value.length>0?(c(),W(`section`,aAe,[F(`h4`,oAe,U(z(t)(`settings.plugins.installed`)),1),F(`div`,sAe,[(c(!0),W(M,null,_(x.value,e=>(c(),W(`article`,{key:e.id,class:`pp-row`},[F(`div`,cAe,[F(`div`,lAe,[F(`span`,uAe,U(e.displayName),1),e.version?(c(),W(`span`,dAe,U(e.version),1)):E(``,!0)]),k(e)?(c(),W(`p`,fAe,U(k(e)),1)):E(``,!0),e.hasErrors?(c(),W(`p`,pAe,U(z(t)(`settings.plugins.hasErrors`)),1)):E(``,!0),u.value[e.id]?(c(),W(`p`,mAe,U(u.value[e.id]),1)):E(``,!0)]),F(`div`,hAe,[v(D9,{"model-value":e.enabled,disabled:T(e.id),"aria-label":z(t)(`settings.plugins.toggleAria`,{name:e.displayName}),"onUpdate:modelValue":t=>I(e.id,t)},null,8,[`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`]),v(vp,{text:z(t)(`settings.plugins.remove`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.remove`),disabled:T(e.id),onClick:t=>te(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`disabled`,`onClick`])]),_:2},1032,[`text`])])]))),128))])])):E(``,!0)],64))]))}}),[[`__scopeId`,`data-v-5064cfe0`]]),_Ae=[`aria-label`],vAe=[`aria-selected`,`onClick`],yAe={class:`body`},bAe={class:`panel`},xAe={class:`sec`},SAe={class:`sec-title`},CAe={class:`row`},wAe={class:`rlabel`},TAe={class:`row`},EAe={class:`rlabel`},DAe={class:`row`},OAe={class:`rlabel`},kAe={class:`sec`},AAe={class:`sec-title`},jAe={class:`row`},MAe={class:`rlabel`},NAe={class:`hint`},PAe={class:`row`},FAe={class:`rlabel`},IAe={class:`hint`},LAe={class:`sec`},RAe={class:`sec-title`},zAe={class:`row`},BAe={class:`rlabel`},VAe={key:0,class:`hint`},HAe={class:`row`},UAe={class:`rlabel`},WAe={key:0,class:`hint`},GAe={class:`row`},KAe={class:`rlabel`},qAe={key:0,class:`hint`},JAe={class:`row`},YAe={class:`rlabel`},XAe={class:`panel`},ZAe={class:`sec`},QAe={class:`sec-title`},$Ae={class:`row`},eje={class:`rlabel`},tje={key:0,class:`rvalue`},nje={class:`actions`},rje={class:`panel`},ije={class:`panel`},aje={class:`panel`},oje={class:`sec`},sje={class:`sec-head`},cje={class:`sec-title`},lje={key:0,class:`saving`},uje={class:`row`},dje={class:`rlabel`},fje={class:`hint`},pje={key:0,class:`select-wrap`},mje={key:0,value:``,disabled:``},hje=[`label`],gje=[`value`],_je={key:1,class:`rvalue mono`},vje={key:0,class:`sec`,"data-testid":`subagent-routing`},yje={class:`sec-title`},bje=[`aria-label`],xje=[`value`,`checked`,`disabled`,`onChange`],Sje={class:`routing-mode-title`},Cje={class:`hint`},wje={key:0,class:`row`},Tje={class:`rlabel`},Eje={class:`hint`},Dje={key:1,class:`rvalue`},Oje={key:1,class:`row routing-pool`},kje={class:`rlabel`},Aje={class:`hint`},jje={class:`pool-list`,"data-testid":`routing-pool`},Mje=[`value`,`checked`,`disabled`,`onChange`],Nje={class:`pool-name`},Pje=[`disabled`,`onClick`],Fje={class:`row routing-effective`,"data-testid":`effective-routing`},Ije={class:`rlabel`},Lje={class:`rvalue mono`,"data-testid":`saved-policy`},Rje={class:`rlabel`},zje={class:`rvalue mono`,"data-testid":`effective-policy`},Bje={key:0,class:`hint`,"data-testid":`feature-disabled`},Vje={class:`row`},Hje={class:`rlabel`},Uje={class:`hint`},Wje={class:`row`},Gje={class:`rlabel`},Kje={class:`hint`},qje={class:`row`},Jje={class:`rlabel`},Yje={class:`hint`},Xje={class:`row`},Zje={class:`rlabel`},Qje={class:`hint`},$je={key:1,class:`empty-config`},eMe={class:`panel`,"data-testid":`expert-opinion-settings`},tMe={class:`sec`},nMe={class:`sec-head`},rMe={class:`sec-title`},iMe={key:0,class:`saving`},aMe={class:`row`},oMe={class:`rlabel`},sMe={class:`hint`},cMe={key:0,class:`flag-chip`},lMe={key:1,class:`flag-chip flag-chip--warn`},uMe={class:`row`},dMe={class:`rlabel`},fMe={class:`hint`},pMe={class:`expert-opinion-flow`},mMe={class:`actions expert-opinion-actions`},hMe={key:0,class:`hint`},gMe={class:`panel`},_Me={class:`sec`},vMe={class:`sec-title`},yMe={class:`row`},bMe={class:`rlabel`},xMe={class:`hint`},SMe={class:`rvalue mono`},CMe={class:`row`},wMe={class:`rlabel`},TMe={class:`hint`},EMe={class:`value-wrap`},DMe={class:`rvalue mono`},OMe={class:`row`},kMe={class:`rlabel`},AMe={class:`hint`},jMe={class:`value-wrap`},MMe={class:`rvalue mono`},NMe={class:`row`},PMe={class:`rlabel`},FMe={class:`rvalue mono`},IMe={key:0,class:`sec`},LMe={key:0,class:`row`},RMe={class:`rlabel`},zMe={class:`hint`},BMe={class:`hint`},VMe={class:`sec`},HMe={class:`sec-title`},UMe={class:`row`},WMe={class:`rlabel`},GMe={key:0,class:`hint`},KMe={class:`row`},qMe={class:`rlabel`},JMe={class:`panel`},YMe={key:0,class:`sec`},XMe={class:`sec-title`},ZMe={"data-testid":`desktop-update-controls`,class:`desktop-update-card`},QMe={class:`desktop-update-row desktop-update-summary`},$Me={class:`desktop-update-summary-copy`},eNe={class:`desktop-update-icon`,"aria-hidden":`true`},tNe={class:`rlabel`},nNe={class:`desktop-update-title`,"aria-live":`polite`},rNe={class:`hint`},iNe={class:`desktop-update-row`},aNe={class:`rlabel`},oNe={class:`hint`},sNe={class:`select-wrap desktop-update-select`},cNe=[`value`],lNe={class:`desktop-update-row`},uNe={class:`rlabel`},dNe={class:`hint`},fNe={class:`desktop-update-row`},pNe={class:`rlabel`},mNe={class:`hint`},hNe={key:0,class:`desktop-update-detail`},gNe={key:0,class:`desktop-update-progress`},_Ne=[`aria-label`],vNe=[`value`,`aria-label`],yNe={"data-testid":`settings-update-progress-detail`},bNe={class:`desktop-update-actions`},xNe={class:`panel`},SNe={class:`sec`},CNe={class:`sec-title`},wNe={class:`row`},TNe={class:`rlabel`},ENe={class:`hint`},DNe={class:`row`},ONe={class:`rlabel`},kNe={class:`hint`},ANe={key:0,class:`flag-chip`},jNe={key:1,class:`flag-chip flag-chip--warn`},MNe={class:`row`},NNe={class:`rlabel`},PNe={class:`hint`},FNe={key:0,class:`flag-chip`},INe={key:1,class:`flag-chip flag-chip--warn`},LNe={key:1,class:`empty-config`},RNe={class:`panel`},zNe={class:`panel-head`},BNe={class:`panel-title`},VNe={class:`panel-desc`},HNe={class:`archive-toolbar`},UNe={class:`archive-search`},WNe=[`placeholder`],GNe={value:`all`},KNe=[`value`],qNe={key:0,class:`archive-empty`},JNe={key:0,class:`archive-list`},YNe={class:`archive-workspace`},XNe={class:`path`},ZNe={class:`count`},QNe={class:`setting-card`},$Ne={class:`archive-meta`},ePe={class:`archive-name`},tPe={class:`archive-time`},nPe={key:1,class:`archive-empty`},rPe=100,iPe=Y(G({__name:`SettingsDialog`,props:{colorScheme:{},accent:{},uiFontSize:{},authReady:{type:Boolean},accountModel:{},notify:{type:Boolean},notifyQuestion:{type:Boolean},notifyApproval:{type:Boolean},notifyPermission:{},sound:{type:Boolean},conversationToc:{type:Boolean},turnFolding:{type:Boolean},activityRunFolding:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},backend:{},experimentalFlagStates:{},subagentModelPolicy:{},subagentModelPolicySaving:{type:Boolean},initialTab:{}},emits:[`setColorScheme`,`setAccent`,`setUiFontSize`,`setNotify`,`setNotifyQuestion`,`setNotifyApproval`,`setSound`,`setConversationToc`,`setTurnFolding`,`setActivityRunFolding`,`openOnboarding`,`updateConfig`,`saveSubagentModelPolicy`,`clearSubagentModelPolicy`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=m(O7),{showReasoning:i,setShowReasoning:a}=B4(),o=e,u=t,d=R(o.initialTab??`general`),f=L(()=>x6(o.uiFontSize)),g=typeof window>`u`?void 0:window.pythinkerDesktop,y=[{id:`general`,labelKey:`settings.tabs.general`,icon:`sliders`},{id:`agent`,labelKey:`settings.tabs.agent`,icon:`cute-bot`},{id:`expertOpinion`,labelKey:`settings.tabs.expertOpinion`,icon:`sparkles`},{id:`account`,labelKey:`settings.tabs.account`,icon:`user`},{id:`providers`,labelKey:`settings.tabs.providers`,icon:`bolt`},{id:`plugins`,labelKey:`settings.tabs.plugins`,icon:`tool`},{id:`lab`,labelKey:`settings.tabs.lab`,icon:`flask`},{id:`archived`,labelKey:`settings.tabs.archived`,icon:`archive`},...g===void 0?[]:[{id:`update`,labelKey:`settings.tabs.update`,icon:`update-available`}],{id:`advanced`,labelKey:`settings.tabs.advanced`,icon:`microscope`}],b=em().serverHttpUrl,x=R(),S=R(!1),C=R(),w,T=L(()=>x.value?.installedVersion??`0.1.2`),D=R(null),O=L(()=>D.value?.serverVersion||o.serverVersion||`-`),k=L(()=>D.value?.backend??o.backend??`v1`),j=L(()=>k.value===`v2`?`agent-gateway`:`server`),N=R(!1),ee=R(!1),I=R(0),{confirm:te,current:ne}=K4(),re=[`manual`,`yolo`,`auto`],ie={manual:`status.permissionManual`,auto:`status.permissionAuto`,yolo:`status.permissionYolo`},ae=R(null);E9(ae);function oe(e){e.key===`Escape`&&ne.value===null&&Ve()}p(()=>{document.addEventListener(`keydown`,oe),Ee(),g!==void 0&&(w=g.onUpdateState(e=>{x.value=e}),g.getUpdateState().then(e=>{x.value=e}))}),h(()=>{document.removeEventListener(`keydown`,oe),w?.(),Ke!==null&&clearTimeout(Ke)});let se=L(()=>{let e=x.value;if(e===void 0)return n(`settings.desktop.loading`);switch(e.status){case`disabled`:return n(`settings.desktop.disabled`);case`checking`:return n(`settings.desktop.checking`);case`available`:return n(`settings.desktop.available`,{version:e.availableVersion});case`downloading`:return n(`settings.desktop.downloading`,{version:e.availableVersion});case`downloaded`:return n(`settings.desktop.downloaded`,{version:e.availableVersion});case`skipped`:return n(`settings.desktop.skipped`,{version:e.skippedVersion??e.availableVersion});case`error`:return e.message??n(`settings.desktop.errorGeneric`);default:return n(`settings.desktop.upToDate`)}}),ce=L(()=>{let e=x.value?.percent;return e===void 0||!Number.isFinite(e)?void 0:Math.min(100,Math.max(0,e))}),le=[`stable`,`beta`,`nightly`],ue=L(()=>{let e=x.value?.status;return S.value||e===void 0||e===`checking`||e===`downloading`||e===`downloaded`}),fe=L(()=>{let e=x.value?.status;return S.value||e===void 0||e===`disabled`||e===`checking`||e===`downloading`||e===`downloaded`}),H=L(()=>{let e=x.value?.lastCheckedAt;if(e===void 0)return n(`settings.desktop.neverChecked`);let t=new Date(e);return Number.isNaN(t.getTime())?n(`settings.desktop.neverChecked`):n(`settings.desktop.lastChecked`,{time:new Intl.DateTimeFormat(`en`,{dateStyle:`medium`,timeStyle:`short`}).format(t)})});function G(e){let t=[`B`,`KB`,`MB`,`GB`],n=Math.max(0,e),r=0;for(;n>=1024&&r{let e=x.value;if(e?.status!==`downloading`)return``;let t=[];return ce.value!==void 0&&t.push(`${Math.round(ce.value)}%`),e.transferred!==void 0&&e.total!==void 0?t.push(n(`settings.desktop.bytesOfTotal`,{transferred:G(e.transferred),total:G(e.total)})):e.transferred!==void 0&&t.push(G(e.transferred)),e.bytesPerSecond!==void 0&&t.push(`${G(e.bytesPerSecond)}/s`),t.join(` · `)}),me=L(()=>C.value===void 0?x.value?.status===`error`?se.value:void 0:C.value);async function he(e){if(!S.value){S.value=!0,C.value=void 0;try{x.value=await e()}catch(e){C.value=e instanceof Error?e.message:String(e)}finally{S.value=!1}}}function ge(e){g!==void 0&&he(()=>g.setAutoUpdate(e))}function _e(e){g!==void 0&&le.includes(e)&&he(()=>g.setUpdateChannel(e))}function ve(e){g!==void 0&&he(()=>g.setNotifyUpdate(e))}function ye(){g!==void 0&&he(()=>g.checkForUpdates())}function be(){g!==void 0&&he(()=>g.downloadUpdate())}function xe(){let e=x.value?.availableVersion;g!==void 0&&e!==void 0&&he(()=>g.skipUpdate(e))}function Se(){g!==void 0&&he(()=>g.undoSkippedUpdate())}function Ce(){let e=x.value?.availableVersion;g!==void 0&&e!==void 0&&he(()=>g.openUpdateReleaseNotes(e))}function we(){g!==void 0&&he(()=>g.restartToUpdate())}let Te=0;async function Ee(){let e=++Te,t;try{t=await Q().getMeta()}catch{t=null}e===Te&&(D.value=t)}s(()=>o.config,()=>{Ee()});function De(){Gx()}let Oe=L(()=>{let e=new Map;for(let t of o.models??[])e.set(t.id,{id:t.id,label:t.displayName??t.model??t.id,provider:t.provider});for(let[t,n]of Object.entries(o.config?.models??{})){if(e.has(t))continue;let r=je(n);e.set(t,{id:t,label:Me(t,n,r),provider:r??t})}return Array.from(e.values())}),ke=L(()=>{let e=new Map;for(let t of Oe.value){let n=e.get(t.provider)??[];n.push(t),e.set(t.provider,n)}for(let[t,n]of e)e.set(t,n.toSorted((e,t)=>e.label.localeCompare(t.label)));return Array.from(e.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({provider:e,options:t}))}),Ae=L(()=>{let e=o.config?.defaultPermissionMode;return e===`auto`||e===`yolo`||e===`manual`?e:`manual`});function je(e){if(!e||typeof e!=`object`)return;let t=e;return typeof t.provider==`string`?t.provider:void 0}function Me(e,t,n){if(!t||typeof t!=`object`)return e;let r=t,i=typeof r.model==`string`?r.model:void 0,a=n??je(t);return i&&a?`${e} (${a}/${i})`:i?`${e} (${i})`:e}function q(e){return e===!0}function Ne(e){!e||e===o.config?.defaultModel||u(`updateConfig`,{defaultModel:e})}function Pe(e){e!==Ae.value&&u(`updateConfig`,{defaultPermissionMode:e})}function Fe(e){let t=o.config?.[e];u(`updateConfig`,{[e]:!q(t)})}function Ie(){let e=o.config?.thinking;return!e||typeof e!=`object`?!0:e.enabled!==!1}function Le(){u(`updateConfig`,{thinking:{enabled:!Ie()}})}function Re(){u(`updateConfig`,{telemetry:o.config?.telemetry===!1})}async function ze(e){e!==d.value&&await Be()&&(d.value=e)}async function Be(){if(!ee.value)return!0;let e=await te({title:n(`providers.unsavedTitle`),message:n(`providers.unsavedBody`),confirmLabel:n(`providers.unsavedDiscard`),cancelLabel:n(`providers.unsavedStay`),variant:`danger`});return e&&(ee.value=!1,I.value+=1),e}async function Ve(){await Be()&&u(`close`)}function He(){return[`App version: ${T.value}`,`Server version: ${O.value}`,`Backend: ${k.value}`,`Server address: ${b}`,`Server ID: ${D.value?.serverId||`-`}`,`User agent: ${typeof navigator>`u`?`-`:navigator.userAgent}`].join(` -`)}async function Ue(){N.value=await Wi(He())}let We=R(!1),Ge=R(!1),Ke=null;function qe(){Ke!==null&&clearTimeout(Ke),Ke=setTimeout(()=>{We.value=!1,Ge.value=!1,Ke=null},1500)}async function Je(){await Wi(O.value)&&(We.value=!0,qe())}async function Ye(){await Wi(b)&&(Ge.value=!0,qe())}let Xe=L(()=>Object.fromEntries((o.models??[]).map(e=>[e.id,e])));function Ze(e){return o.config?.experimental?.[e]===!0}function Qe(e){return D.value?.experimentalFlagStates?.find(t=>t.id===e)??o.experimentalFlagStates?.find(t=>t.id===e)}function $e(e,t){u(`updateConfig`,{experimental:{...o.config?.experimental,[e]:t}})}let et=L(()=>(o.models??[]).filter(e=>e.maxContextSize>0&&(e.capabilities??[]).some(e=>e.trim().toLowerCase().replaceAll(`-`,`_`)===`tool_use`))),tt=L(()=>new Set(et.value.map(e=>e.id))),nt=L(()=>ke.value.map(e=>({provider:e.provider,options:e.options.filter(e=>tt.value.has(e.id))})).filter(e=>e.options.length>0)),rt=L(()=>r?.status.value),it=L(()=>Qe(`expert_talk`)?.enabled??rt.value?.feature===`enabled`),at=R(``),ot=R(``),st=R(``),ct=R(``),lt=R(!1),ut=L(()=>r?.preferredPair.value),dt=L(()=>at.value!==ot.value&&tt.value.has(at.value)&&tt.value.has(ot.value)),ft=L(()=>ut.value?.fusionLeadModelId===at.value&&ut.value?.peerModelId===ot.value&&(ut.value?.fusionLeadThinkingEffort??``)===st.value&&(ut.value?.peerThinkingEffort??``)===ct.value);function pt(){if(lt.value)return;let e=ut.value??rt.value?.config;at.value=e?.fusionLeadModelId??``,ot.value=e?.peerModelId??``,st.value=e?.fusionLeadThinkingEffort??``,ct.value=e?.peerThinkingEffort??``}s([()=>rt.value?.config,()=>ut.value],pt,{immediate:!0,deep:!0});function mt(e){at.value=e.model,st.value=e.effort??``,lt.value=!0}function ht(e){ot.value=e.model,ct.value=e.effort??``,lt.value=!0}async function gt(e){!e&&rt.value?.activation.state===`armed`&&await r?.disarm(),$e(`expert_talk`,e)}async function _t(){!r||!dt.value||(await r.configurePair({fusionLeadModelId:at.value,peerModelId:ot.value,fusionLeadThinkingEffort:st.value||void 0,peerThinkingEffort:ct.value||void 0}),r.error.value===void 0&&(lt.value=!1,pt()))}function vt(e){return tt.value.has(e)}let yt=[`inherit`,`default`,`pool`,`force`],bt=R(`inherit`),xt=R(``),St=R(``),Ct=R(new Set);function wt(e){bt.value=e?.mode??`inherit`,xt.value=e!==void 0&&e.mode!==`inherit`?e.defaultModel:``,St.value=e!==void 0&&e.mode!==`inherit`?e.defaultEffort??``:``,Ct.value=new Set(e?.mode===`pool`?Object.keys(e.models):[])}s(()=>o.subagentModelPolicy?.policy,wt,{immediate:!0,deep:!0});function Tt(){let e=St.value||void 0;switch(bt.value){case`inherit`:return{mode:`inherit`};case`default`:case`force`:return xt.value?{mode:bt.value,defaultModel:xt.value,defaultEffort:e}:void 0;case`pool`:{if(Ct.value.size===0||!Ct.value.has(xt.value))return;let t=Object.fromEntries([...Ct.value].map(e=>[e,``]));return{mode:`pool`,defaultModel:xt.value,models:t,defaultEffort:e}}}}function Et(){let e=Tt();if(e!==void 0){if(e.mode===`inherit`){o.subagentModelPolicy?.policy.mode!==`inherit`&&u(`clearSubagentModelPolicy`);return}u(`saveSubagentModelPolicy`,e)}}function Dt(e){bt.value!==e&&(bt.value=e,e===`pool`&&Ct.value.size===0&&xt.value&&(Ct.value=new Set([xt.value])),Et())}function Ot(e){xt.value=e.model,St.value=e.effort??``,Et()}function kt(e){let t=new Set(Ct.value);t.has(e)?t.delete(e):t.add(e),Ct.value=t,t.has(xt.value)||(xt.value=[...t][0]??``),Et()}function At(e){!Ct.value.has(e)||xt.value===e||(xt.value=e,Et())}function jt(e){return Oe.value.find(t=>t.id===e)?.label??e}function Mt(e){switch(e.mode){case`inherit`:return n(`settings.subagentRouting.summaryInherit`);case`pool`:return`${n(`settings.subagentRouting.mode.pool`)} · ${n(`settings.subagentRouting.summaryPool`,{count:Object.keys(e.models).length,model:jt(e.defaultModel)})}`;default:{let t=e.defaultEffort?` · ${e.defaultEffort}`:``;return`${n(`settings.subagentRouting.mode.${e.mode}`)} · ${jt(e.defaultModel)}${t}`}}}function Nt(e){let t=S6(e);t!==void 0&&u(`setUiFontSize`,t)}let Pt=D7();s(d,e=>{e===`expertOpinion`&&(Pt.refreshAllProviders(),r?.refresh())}),s(()=>Qe(`expert_talk`)?.enabled,()=>{d.value===`expertOpinion`&&r?.refresh()});let Ft=R([]),It=R(!1),Lt=R(!1),Rt=R(``),zt=R(`all`),Bt=R(`archived-desc`);async function Vt(){if(!(It.value||Lt.value)){It.value=!0;try{let e=[],t;for(;;){let n=await Pt.loadArchivedSessions({beforeId:t,pageSize:rPe});if(e.push(...n.items),!n.hasMore||n.items.length===0)break;let r=n.items.at(-1)?.id;if(r===void 0)break;t=r}Ft.value=e,Lt.value=!0}catch(e){console.warn(`loadAllArchived failed`,e)}finally{It.value=!1}}}s(d,e=>{e===`archived`&&!Lt.value&&Vt()});let Ht=L(()=>{let e=new Set;for(let t of Ft.value)e.add(t.cwd);return Array.from(e).toSorted((e,t)=>e.localeCompare(t))}),Ut=L(()=>{let e=Rt.value.trim().toLowerCase(),t=Ft.value.filter(e=>e.archived===!0);return zt.value!==`all`&&(t=t.filter(e=>e.cwd===zt.value)),e&&(t=t.filter(t=>t.title.toLowerCase().includes(e))),Bt.value===`archived-desc`?t.toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt)):Bt.value===`created-desc`?t.toSorted((e,t)=>t.createdAt.localeCompare(e.createdAt)):t.toSorted((e,t)=>e.title.localeCompare(t.title,`en`))}),Wt=L(()=>{let e=new Map;for(let t of Ut.value){let n=e.get(t.cwd)??[];n.push(t),e.set(t.cwd,n)}return Array.from(e.entries()).map(([e,t])=>({cwd:e,items:t}))});async function Gt(e){await Pt.restoreSession(e)&&(Ft.value=Ft.value.filter(t=>t.id!==e))}function Kt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}return(t,o)=>(c(),P(If,{open:!0,"close-on-esc":!1,title:z(n)(`settings.title`),size:`xl`,height:`fixed`,padded:!1,onClose:Ve},{default:B(()=>[F(`div`,{ref_key:`dialogRef`,ref:ae,class:`sd`},[F(`nav`,{class:`settings-tabs`,role:`tablist`,"aria-label":z(n)(`settings.title`)},[(c(),W(M,null,_(y,e=>F(`button`,{key:e.id,type:`button`,class:V([`tab`,{on:d.value===e.id}]),role:`tab`,"aria-selected":d.value===e.id,onClick:t=>ze(e.id)},[v(X,{name:e.icon,size:`sm`},null,8,[`name`]),K(` `+U(z(n)(e.labelKey)),1)],10,vAe)),64))],8,_Ae),F(`div`,yAe,[l(F(`section`,bAe,[F(`section`,xAe,[F(`h3`,SAe,U(z(n)(`settings.appearance`)),1),F(`div`,CAe,[F(`span`,wAe,U(z(n)(`theme.colorSchemeLabel`)),1),v(s6,{"model-value":e.colorScheme,options:[{value:`light`,label:z(n)(`theme.light`)},{value:`dark`,label:z(n)(`theme.dark`)},{value:`system`,label:z(n)(`theme.system`)}],"onUpdate:modelValue":o[0]||=e=>u(`setColorScheme`,e)},null,8,[`model-value`,`options`])]),F(`div`,TAe,[F(`span`,EAe,U(z(n)(`theme.accentLabel`)),1),v(s6,{"model-value":e.accent,options:[{value:`blue`,label:z(n)(`theme.accentBlue`)},{value:`mono`,label:z(n)(`theme.accentBlack`)}],"onUpdate:modelValue":o[1]||=e=>u(`setAccent`,e)},null,8,[`model-value`,`options`])]),F(`div`,DAe,[F(`span`,OAe,U(z(n)(`settings.uiFontSize`)),1),v(s6,{"model-value":f.value,options:z(g6),"aria-label":z(n)(`settings.uiFontSize`),"onUpdate:modelValue":Nt},null,8,[`model-value`,`options`,`aria-label`])])]),F(`section`,kAe,[F(`h3`,AAe,U(z(n)(`settings.messageFolding`)),1),F(`div`,jAe,[F(`span`,MAe,[K(U(z(n)(`settings.turnFolding`))+` `,1),F(`span`,NAe,U(z(n)(`settings.turnFoldingHint`)),1)]),v(D9,{"model-value":e.turnFolding??!0,label:z(n)(`settings.turnFolding`),"onUpdate:modelValue":o[2]||=e=>u(`setTurnFolding`,e)},null,8,[`model-value`,`label`])]),F(`div`,PAe,[F(`span`,FAe,[K(U(z(n)(`settings.activityRunFolding`))+` `,1),F(`span`,IAe,U(z(n)(`settings.activityRunFoldingHint`)),1)]),v(D9,{"model-value":e.activityRunFolding??!0,label:z(n)(`settings.activityRunFolding`),"onUpdate:modelValue":o[3]||=e=>u(`setActivityRunFolding`,e)},null,8,[`model-value`,`label`])])]),F(`section`,LAe,[F(`h3`,RAe,U(z(n)(`settings.notifications`)),1),F(`div`,zAe,[F(`span`,BAe,[K(U(z(n)(`settings.notifyOnComplete`))+` `,1),e.notifyPermission===`denied`?(c(),W(`span`,VAe,U(z(n)(`settings.notifyDenied`)),1)):E(``,!0)]),v(D9,{"model-value":e.notify,disabled:e.notifyPermission===`denied`,label:z(n)(`settings.notifyOnComplete`),"onUpdate:modelValue":o[4]||=e=>u(`setNotify`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,HAe,[F(`span`,UAe,[K(U(z(n)(`settings.notifyOnQuestion`))+` `,1),e.notifyPermission===`denied`?(c(),W(`span`,WAe,U(z(n)(`settings.notifyDenied`)),1)):E(``,!0)]),v(D9,{"model-value":e.notifyQuestion,disabled:e.notifyPermission===`denied`,label:z(n)(`settings.notifyOnQuestion`),"onUpdate:modelValue":o[5]||=e=>u(`setNotifyQuestion`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,GAe,[F(`span`,KAe,[K(U(z(n)(`settings.notifyOnApproval`))+` `,1),e.notifyPermission===`denied`?(c(),W(`span`,qAe,U(z(n)(`settings.notifyDenied`)),1)):E(``,!0)]),v(D9,{"model-value":e.notifyApproval,disabled:e.notifyPermission===`denied`,label:z(n)(`settings.notifyOnApproval`),"onUpdate:modelValue":o[6]||=e=>u(`setNotifyApproval`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,JAe,[F(`span`,YAe,U(z(n)(`settings.soundOnComplete`)),1),v(D9,{"model-value":e.sound,label:z(n)(`settings.soundOnComplete`),"onUpdate:modelValue":o[7]||=e=>u(`setSound`,e)},null,8,[`model-value`,`label`])])])],512),[[A,d.value===`general`]]),l(F(`section`,XAe,[F(`section`,ZAe,[F(`h3`,QAe,U(z(n)(`settings.account`)),1),F(`div`,$Ae,[F(`span`,eje,U(e.authReady?z(n)(`settings.providers`):z(n)(`sidebar.notSignedIn`)),1),v(vp,{text:e.accountModel},{default:B(()=>[e.authReady&&e.accountModel?(c(),W(`span`,tje,U(e.accountModel),1)):E(``,!0)]),_:1},8,[`text`])]),F(`div`,nje,[v(YT,{variant:`secondary`,size:`sm`,onClick:o[8]||=e=>{u(`openOnboarding`),u(`close`)}},{default:B(()=>[K(U(z(n)(`onboarding.reopen`)),1)]),_:1}),v(YT,{variant:`primary`,size:`sm`,onClick:o[9]||=e=>ze(`providers`)},{default:B(()=>[K(U(z(n)(`settings.manageProviders`)),1)]),_:1})])])],512),[[A,d.value===`account`]]),l(F(`section`,rje,[v(Eke,{"discard-token":I.value,onDirtyChange:o[10]||=e=>ee.value=e},null,8,[`discard-token`])],512),[[A,d.value===`providers`]]),l(F(`section`,ije,[v(gAe)],512),[[A,d.value===`plugins`]]),l(F(`section`,aje,[F(`section`,oje,[F(`div`,sje,[F(`h3`,cje,U(z(n)(`settings.agentDefaults`)),1),e.configSaving?(c(),W(`span`,lje,U(z(n)(`settings.saving`)),1)):E(``,!0)]),e.config?(c(),W(M,{key:0},[F(`div`,uje,[F(`span`,dje,[K(U(z(n)(`settings.defaultModel`))+` `,1),F(`span`,fje,U(z(n)(`settings.defaultModelHint`)),1)]),ke.value.length>0?(c(),W(`div`,pje,[v(O9,{"model-value":e.config.defaultModel??``,disabled:e.configSaving,"aria-label":z(n)(`settings.defaultModel`),"onUpdate:modelValue":Ne},{default:B(()=>[e.config.defaultModel?E(``,!0):(c(),W(`option`,mje,U(z(n)(`settings.noDefaultModel`)),1)),(c(!0),W(M,null,_(ke.value,e=>(c(),W(`optgroup`,{key:e.provider,label:e.provider},[(c(!0),W(M,null,_(e.options,e=>(c(),W(`option`,{key:e.id,value:e.id},U(e.label),9,gje))),128))],8,hje))),128))]),_:1},8,[`model-value`,`disabled`,`aria-label`])])):(c(),W(`span`,_je,U(e.config.defaultModel??z(n)(`settings.noDefaultModel`)),1))]),e.subagentModelPolicy?(c(),W(`section`,vje,[F(`h3`,yje,U(z(n)(`settings.subagentRouting.title`)),1),F(`div`,{class:`routing-modes`,role:`radiogroup`,"aria-label":z(n)(`settings.subagentRouting.title`)},[(c(),W(M,null,_(yt,t=>F(`label`,{key:t,class:V([`routing-mode`,{on:bt.value===t}])},[F(`input`,{type:`radio`,name:`subagent-routing-mode`,value:t,checked:bt.value===t,disabled:e.subagentModelPolicySaving,onChange:e=>Dt(t)},null,40,xje),F(`span`,Sje,U(z(n)(`settings.subagentRouting.mode.${t}`)),1),F(`span`,Cje,U(z(n)(`settings.subagentRouting.modeHint.${t}`)),1)],2)),64))],8,bje),bt.value==="default"||bt.value===`force`?(c(),W(`div`,wje,[F(`span`,Tje,[K(U(z(n)(`settings.subagentRouting.model`))+` `,1),F(`span`,Eje,U(z(n)(`settings.subagentRouting.modelHint`)),1)]),ke.value.length>0?(c(),P(A7,{key:0,"model-value":xt.value,effort:St.value,groups:ke.value,"model-info-by-id":Xe.value,disabled:e.subagentModelPolicySaving,onInherit:o[11]||=e=>Dt(`inherit`),onSelect:Ot},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`disabled`])):(c(),W(`span`,Dje,U(z(n)(`settings.noSecondaryModel`)),1))])):bt.value===`pool`?(c(),W(`div`,Oje,[F(`span`,kje,[K(U(z(n)(`settings.subagentRouting.pool`))+` `,1),F(`span`,Aje,U(z(n)(`settings.subagentRouting.poolHint`)),1)]),F(`div`,jje,[(c(!0),W(M,null,_(Oe.value,t=>(c(),W(`label`,{key:t.id,class:`pool-item`},[F(`input`,{type:`checkbox`,value:t.id,checked:Ct.value.has(t.id),disabled:e.subagentModelPolicySaving,onChange:e=>kt(t.id)},null,40,Mje),F(`span`,Nje,U(t.label),1),F(`button`,{type:`button`,class:V([`pool-default`,{on:xt.value===t.id}]),disabled:!Ct.value.has(t.id)||e.subagentModelPolicySaving,onClick:e=>At(t.id)},U(xt.value===t.id?z(n)(`settings.subagentRouting.poolDefault`):z(n)(`settings.subagentRouting.makeDefault`)),11,Pje)]))),128))])])):E(``,!0),F(`div`,Fje,[F(`span`,Ije,[K(U(z(n)(`settings.subagentRouting.saved`))+` `,1),F(`span`,Lje,U(Mt(e.subagentModelPolicy.configuredPolicy)),1)]),F(`span`,Rje,[K(U(z(n)(`settings.subagentRouting.effective`))+` `,1),F(`span`,zje,U(Mt(e.subagentModelPolicy.effectivePolicy)),1)]),e.subagentModelPolicy.feature.enabled?E(``,!0):(c(),W(`span`,Bje,U(z(n)(`settings.subagentRouting.featureDisabled`)),1))])])):E(``,!0),F(`div`,Vje,[F(`span`,Hje,[K(U(z(n)(`settings.defaultPermission`))+` `,1),F(`span`,Uje,U(z(n)(`settings.defaultPermissionHint`)),1)]),v(s6,{"model-value":Ae.value,options:re.map(e=>({value:e,label:z(n)(ie[e])})),"onUpdate:modelValue":o[12]||=e=>Pe(e)},null,8,[`model-value`,`options`])]),F(`div`,Wje,[F(`span`,Gje,[K(U(z(n)(`settings.defaultThinking`))+` `,1),F(`span`,Kje,U(z(n)(`settings.defaultThinkingHint`)),1)]),v(D9,{"model-value":Ie(),disabled:e.configSaving,label:z(n)(`settings.defaultThinking`),"onUpdate:modelValue":o[13]||=e=>Le()},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,qje,[F(`span`,Jje,[K(U(z(n)(`settings.defaultPlanMode`))+` `,1),F(`span`,Yje,U(z(n)(`settings.defaultPlanModeHint`)),1)]),v(D9,{"model-value":q(e.config.defaultPlanMode),disabled:e.configSaving,label:z(n)(`settings.defaultPlanMode`),"onUpdate:modelValue":o[14]||=e=>Fe(`defaultPlanMode`)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,Xje,[F(`span`,Zje,[K(U(z(n)(`settings.mergeSkills`))+` `,1),F(`span`,Qje,U(z(n)(`settings.mergeSkillsHint`)),1)]),v(D9,{"model-value":q(e.config.mergeAllAvailableSkills),disabled:e.configSaving,label:z(n)(`settings.mergeSkills`),"onUpdate:modelValue":o[15]||=e=>Fe(`mergeAllAvailableSkills`)},null,8,[`model-value`,`disabled`,`label`])])],64)):(c(),W(`div`,$je,U(z(n)(`settings.configUnavailable`)),1))])],512),[[A,d.value===`agent`]]),l(F(`section`,eMe,[F(`section`,tMe,[F(`div`,nMe,[F(`h3`,rMe,U(z(n)(`settings.expertOpinion.title`)),1),e.configSaving||z(r)?.busy.value?(c(),W(`span`,iMe,U(z(n)(`settings.saving`)),1)):E(``,!0)]),F(`div`,aMe,[F(`span`,oMe,[K(U(z(n)(`settings.expertOpinion.enabled`))+` `,1),F(`span`,sMe,U(z(n)(`settings.expertOpinion.enabledHint`)),1),Qe(`expert_talk`)?.externallyControlled?(c(),W(`span`,cMe,U(z(n)(`settings.lab.environmentControlled`)),1)):E(``,!0),Qe(`expert_talk`)?.overridden?(c(),W(`span`,lMe,U(z(n)(`settings.lab.savedSettingOverridden`)),1)):E(``,!0)]),v(D9,{"data-testid":`expert-opinion-enabled`,"model-value":Ze(`expert_talk`),disabled:e.configSaving||!e.config,label:z(n)(`settings.expertOpinion.enabled`),"onUpdate:modelValue":gt},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,uMe,[F(`span`,dMe,[K(U(z(n)(`settings.expertOpinion.showReasoning`))+` `,1),F(`span`,fMe,U(z(n)(`settings.expertOpinion.showReasoningHint`)),1)]),v(D9,{"data-testid":`expert-opinion-show-reasoning`,"model-value":z(i),label:z(n)(`settings.expertOpinion.showReasoning`),"onUpdate:modelValue":z(a)},null,8,[`model-value`,`label`,`onUpdate:modelValue`])]),k.value!==`v2`||!z(r)?(c(),P(t9,{key:0,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.unavailable`)),1)]),_:1})):(c(),W(M,{key:1},[et.value.length<2?(c(),P(t9,{key:0,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.modelsRequired`)),1)]),_:1})):E(``,!0),F(`div`,pMe,[v(k7,{label:z(n)(`settings.expertOpinion.lead`),hint:z(n)(`settings.expertOpinion.leadHint`)},{default:B(()=>[v(A7,{"data-testid":`expert-opinion-lead`,"model-value":at.value,effort:st.value,groups:nt.value,"model-info-by-id":Xe.value,"allow-empty":!1,"empty-label":z(n)(`settings.expertOpinion.selectModel`),"aria-label":z(n)(`settings.expertOpinion.lead`),disabled:!it.value||z(r).busy.value,onSelect:mt},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`]),v(X,{class:`expert-opinion-arrow`,name:`chevron-right`,size:`md`}),v(k7,{label:z(n)(`settings.expertOpinion.peer`),hint:z(n)(`settings.expertOpinion.peerHint`)},{default:B(()=>[v(A7,{"data-testid":`expert-opinion-peer`,"model-value":ot.value,effort:ct.value,groups:nt.value,"model-info-by-id":Xe.value,"allow-empty":!1,"empty-label":z(n)(`settings.expertOpinion.selectModel`),"aria-label":z(n)(`settings.expertOpinion.peer`),disabled:!it.value||z(r).busy.value,onSelect:ht},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`])]),at.value&&!vt(at.value)?(c(),P(t9,{key:1,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.missingModel`,{id:at.value})),1)]),_:1})):E(``,!0),ot.value&&!vt(ot.value)?(c(),P(t9,{key:2,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.missingModel`,{id:ot.value})),1)]),_:1})):E(``,!0),at.value&&ot.value&&at.value===ot.value?(c(),P(t9,{key:3,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.distinctRequired`)),1)]),_:1})):rt.value?.config&&!lt.value&&rt.value.pairValidation.reason?(c(),P(t9,{key:4,variant:`warning`},{default:B(()=>[K(U(rt.value.pairValidation.reason),1)]),_:1})):E(``,!0),v(t9,null,{default:B(()=>[K(U(z(n)(`expertTalk.disclosure`)),1)]),_:1}),F(`div`,mMe,[v(YT,{"data-testid":`expert-opinion-save`,variant:`primary`,size:`sm`,disabled:!it.value||!dt.value||z(r).busy.value,onClick:_t},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.savePair`)),1)]),_:1},8,[`disabled`]),ft.value?(c(),W(`span`,hMe,U(z(n)(`settings.expertOpinion.saved`)),1)):E(``,!0)])],64))])],512),[[A,d.value===`expertOpinion`]]),l(F(`section`,gMe,[F(`section`,_Me,[F(`h3`,vMe,U(z(n)(`settings.versionAndUpdates`)),1),F(`div`,yMe,[F(`span`,bMe,[K(U(z(n)(`settings.appVersion`))+` `,1),F(`span`,xMe,U(z(n)(`settings.appVersionHint`)),1)]),F(`span`,SMe,U(T.value),1)]),F(`div`,CMe,[F(`span`,wMe,[K(U(z(n)(`settings.serverVersion`))+` `,1),F(`span`,TMe,U(z(n)(`settings.serverVersionHint`)),1)]),F(`span`,EMe,[F(`span`,DMe,U(O.value),1),v(Ca,{size:`sm`,label:We.value?z(n)(`settings.copied`):z(n)(`settings.copyServerVersion`),"data-testid":`copy-server-version`,onClick:Je},{default:B(()=>[v(X,{name:We.value?`check`:`copy`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),F(`div`,OMe,[F(`span`,kMe,[K(U(z(n)(`settings.serverAddress`))+` `,1),F(`span`,AMe,U(z(n)(`settings.serverAddressHint`)),1)]),F(`span`,jMe,[F(`span`,MMe,U(z(b)),1),v(Ca,{size:`sm`,label:Ge.value?z(n)(`settings.copied`):z(n)(`settings.copyServerAddress`),"data-testid":`copy-server-address`,onClick:Ye},{default:B(()=>[v(X,{name:Ge.value?`check`:`copy`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),F(`div`,NMe,[F(`span`,PMe,U(z(n)(`settings.backend`)),1),F(`span`,FMe,U(j.value),1)])]),e.config?(c(),W(`section`,IMe,[e.config?(c(),W(`div`,LMe,[F(`span`,RMe,[K(U(z(n)(`settings.telemetry`))+` `,1),F(`span`,zMe,U(z(n)(`settings.telemetryHint`)),1),F(`span`,BMe,U(z(n)(`settings.telemetryRestartHint`)),1)]),v(D9,{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:z(n)(`settings.telemetry`),"onUpdate:modelValue":o[16]||=e=>Re()},null,8,[`model-value`,`disabled`,`label`])])):E(``,!0)])):E(``,!0),F(`section`,VMe,[F(`h3`,HMe,U(z(n)(`settings.diagnostics`)),1),F(`div`,UMe,[F(`span`,WMe,[K(U(z(n)(`settings.exportLog`))+` `,1),z(fx)()?E(``,!0):(c(),W(`span`,GMe,U(z(n)(`settings.logHint`)),1))]),v(YT,{variant:`secondary`,size:`sm`,onClick:De},{default:B(()=>[K(U(z(n)(`settings.exportLogBtn`)),1)]),_:1})]),F(`div`,KMe,[F(`span`,qMe,U(z(n)(`settings.copyDetails`)),1),v(YT,{"data-testid":`copy-diagnostics`,variant:`secondary`,size:`sm`,onClick:Ue},{default:B(()=>[K(U(N.value?z(n)(`settings.copied`):z(n)(`settings.copyDetails`)),1)]),_:1})])])],512),[[A,d.value===`advanced`]]),l(F(`section`,JMe,[z(g)?(c(),W(`section`,YMe,[F(`h3`,XMe,U(z(n)(`settings.tabs.update`)),1),F(`div`,ZMe,[F(`div`,QMe,[F(`div`,$Me,[F(`span`,eNe,[v(X,{name:`update-button`})]),F(`span`,tNe,[F(`span`,nNe,U(se.value),1),F(`span`,rNe,U(H.value),1)])]),v(YT,{"data-testid":`settings-check-update`,variant:`secondary`,size:`sm`,loading:x.value?.status===`checking`,disabled:fe.value,onClick:ye},{default:B(()=>[K(U(z(n)(`settings.desktop.checkNow`)),1)]),_:1},8,[`loading`,`disabled`])]),F(`div`,iNe,[F(`span`,aNe,[K(U(z(n)(`settings.desktop.updateChannel`))+` `,1),F(`span`,oNe,U(z(n)(`settings.desktop.updateChannelHint`)),1)]),F(`div`,sNe,[v(O9,{"data-testid":`desktop-update-channel`,size:`sm`,"model-value":x.value?.channel??`stable`,disabled:ue.value,"aria-label":z(n)(`settings.desktop.updateChannel`),"onUpdate:modelValue":_e},{default:B(()=>[(c(),W(M,null,_(le,e=>F(`option`,{key:e,value:e},U(z(n)(`settings.desktop.channels.${e}`)),9,cNe)),64))]),_:1},8,[`model-value`,`disabled`,`aria-label`])])]),F(`div`,lNe,[F(`span`,uNe,[K(U(z(n)(`settings.desktop.automaticChecks`))+` `,1),F(`span`,dNe,U(z(n)(`settings.desktop.automaticChecksHint`)),1)]),v(D9,{"data-testid":`automatic-update-checks`,"model-value":x.value?.autoUpdate??!1,disabled:S.value||x.value===void 0||x.value.status===`disabled`,label:z(n)(`settings.desktop.automaticChecks`),"onUpdate:modelValue":ge},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,fNe,[F(`span`,pNe,[K(U(z(n)(`settings.desktop.notifyUpdates`))+` `,1),F(`span`,mNe,U(z(n)(`settings.desktop.notifyUpdatesHint`)),1)]),v(D9,{"data-testid":`update-notifications`,"model-value":x.value?.notifyUpdate??!0,disabled:S.value||x.value===void 0,label:z(n)(`settings.desktop.notifyUpdates`),"onUpdate:modelValue":ve},null,8,[`model-value`,`disabled`,`label`])]),x.value?.status===`downloading`||me.value||x.value?.availableVersion?(c(),W(`div`,hNe,[x.value?.status===`downloading`?(c(),W(`div`,gNe,[ce.value===void 0?(c(),W(`progress`,{key:0,"data-testid":`settings-update-progress`,max:`100`,"aria-label":z(n)(`settings.desktop.progressLabel`)},null,8,_Ne)):(c(),W(`progress`,{key:1,"data-testid":`settings-update-progress`,value:ce.value,max:`100`,"aria-label":z(n)(`settings.desktop.progressLabel`)},null,8,vNe)),F(`span`,yNe,U(pe.value||z(n)(`settings.desktop.fetching`)),1)])):E(``,!0),me.value?(c(),P(t9,{key:1,variant:`danger`},{default:B(()=>[K(U(me.value),1)]),_:1})):E(``,!0),F(`div`,bNe,[x.value?.availableVersion?(c(),P(YT,{key:0,variant:`ghost`,size:`sm`,disabled:S.value,onClick:Ce},{default:B(()=>[K(U(z(n)(`settings.desktop.viewNotes`)),1)]),_:1},8,[`disabled`])):E(``,!0),x.value?.status===`available`?(c(),P(YT,{key:1,variant:`ghost`,size:`sm`,disabled:S.value,onClick:xe},{default:B(()=>[K(U(z(n)(`settings.desktop.skip`)),1)]),_:1},8,[`disabled`])):E(``,!0),x.value?.status===`available`||x.value?.status===`error`&&x.value.availableVersion?(c(),P(YT,{key:2,"data-testid":`settings-download-update`,size:`sm`,loading:S.value,onClick:be},{default:B(()=>[K(U(x.value?.status===`error`?z(n)(`settings.desktop.retryDownload`):z(n)(`settings.desktop.download`)),1)]),_:1},8,[`loading`])):E(``,!0),x.value?.status===`skipped`?(c(),P(YT,{key:3,size:`sm`,loading:S.value,onClick:Se},{default:B(()=>[K(U(z(n)(`settings.desktop.undoSkip`)),1)]),_:1},8,[`loading`])):E(``,!0),x.value?.status===`downloaded`?(c(),P(YT,{key:4,"data-testid":`settings-restart-update`,size:`sm`,loading:S.value,onClick:we},{default:B(()=>[K(U(z(n)(`settings.desktop.restartToUpdate`)),1)]),_:1},8,[`loading`])):E(``,!0)])])):E(``,!0)])])):E(``,!0)],512),[[A,d.value===`update`]]),l(F(`section`,xNe,[F(`section`,SNe,[F(`h3`,CNe,U(z(n)(`settings.tabs.lab`)),1),F(`div`,wNe,[F(`span`,TNe,[K(U(z(n)(`settings.conversationToc`))+` `,1),F(`span`,ENe,U(z(n)(`settings.conversationTocHint`)),1)]),v(D9,{"model-value":e.conversationToc??!0,label:z(n)(`settings.conversationToc`),"onUpdate:modelValue":o[17]||=e=>u(`setConversationToc`,e)},null,8,[`model-value`,`label`])]),e.config?(c(),W(M,{key:0},[F(`div`,DNe,[F(`span`,ONe,[K(U(z(n)(`settings.lab.sidebarTabs`))+` `,1),F(`span`,kNe,U(z(n)(`settings.lab.sidebarTabsHint`)),1),Qe(`sidebarTabs`)?.externallyControlled?(c(),W(`span`,ANe,U(z(n)(`settings.lab.environmentControlled`)),1)):E(``,!0),Qe(`sidebarTabs`)?.overridden?(c(),W(`span`,jNe,U(z(n)(`settings.lab.savedSettingOverridden`)),1)):E(``,!0)]),v(D9,{"model-value":Ze(`sidebarTabs`),disabled:e.configSaving,label:z(n)(`settings.lab.sidebarTabs`),"onUpdate:modelValue":o[18]||=e=>$e(`sidebarTabs`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,MNe,[F(`span`,NNe,[K(U(z(n)(`settings.lab.secondaryModel`))+` `,1),F(`span`,PNe,U(z(n)(`settings.lab.secondaryModelHint`)),1),Qe(`secondary-model`)?.externallyControlled?(c(),W(`span`,FNe,U(z(n)(`settings.lab.environmentControlled`)),1)):E(``,!0),Qe(`secondary-model`)?.overridden?(c(),W(`span`,INe,U(z(n)(`settings.lab.savedSettingOverridden`)),1)):E(``,!0)]),v(D9,{"model-value":Ze(`secondary-model`),disabled:e.configSaving,label:z(n)(`settings.lab.secondaryModel`),"onUpdate:modelValue":o[19]||=e=>$e(`secondary-model`,e)},null,8,[`model-value`,`disabled`,`label`])])],64)):(c(),W(`div`,LNe,U(z(n)(`settings.configUnavailable`)),1))])],512),[[A,d.value===`lab`]]),l(F(`section`,RNe,[F(`div`,zNe,[o[23]||=F(`div`,{class:`panel-kicker`},`Archived sessions`,-1),F(`h4`,BNe,U(z(n)(`settings.archivedTitle`)),1),F(`p`,VNe,U(z(n)(`settings.archivedDesc`)),1)]),F(`div`,HNe,[F(`label`,UNe,[o[24]||=F(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[F(`circle`,{cx:`11`,cy:`11`,r:`7`}),F(`path`,{d:`m21 21-4.3-4.3`})],-1),l(F(`input`,{"onUpdate:modelValue":o[20]||=e=>Rt.value=e,placeholder:z(n)(`settings.archivedSearch`)},null,8,WNe),[[de,Rt.value]])]),v(O9,{"model-value":zt.value,size:`sm`,"aria-label":z(n)(`settings.archivedAllWorkspaces`),"onUpdate:modelValue":o[21]||=e=>zt.value=e},{default:B(()=>[F(`option`,GNe,U(z(n)(`settings.archivedAllWorkspaces`)),1),(c(!0),W(M,null,_(Ht.value,e=>(c(),W(`option`,{key:e,value:e},U(e),9,KNe))),128))]),_:1},8,[`model-value`,`aria-label`]),v(s6,{size:`sm`,"model-value":Bt.value,options:[{value:`archived-desc`,label:z(n)(`settings.archivedSortArchived`)},{value:`created-desc`,label:z(n)(`settings.archivedSortCreated`)},{value:`name-asc`,label:z(n)(`settings.archivedSortName`)}],"onUpdate:modelValue":o[22]||=e=>Bt.value=e},null,8,[`model-value`,`options`])]),It.value?(c(),W(`div`,qNe,U(z(n)(`settings.archivedLoadingAll`)),1)):(c(),W(M,{key:1},[Wt.value.length>0?(c(),W(`div`,JNe,[(c(!0),W(M,null,_(Wt.value,e=>(c(),W(`section`,{key:e.cwd,class:`archive-card`},[F(`div`,YNe,[o[25]||=F(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[F(`path`,{d:`M3 7h6l2 2h10v9H3z`}),F(`path`,{d:`M3 7V5h6l2 2`})],-1),F(`span`,XNe,U(e.cwd),1),F(`span`,ZNe,U(z(n)(`settings.archivedSessionsCount`,{count:e.items.length})),1)]),F(`div`,QNe,[(c(!0),W(M,null,_(e.items,e=>(c(),W(`div`,{key:e.id,class:`archive-row`},[F(`div`,$Ne,[F(`div`,ePe,U(e.title),1),F(`div`,tPe,U(z(n)(`settings.archivedAt`,{time:Kt(e.updatedAt)})),1)]),v(YT,{variant:`secondary`,size:`sm`,onClick:t=>Gt(e.id)},{default:B(()=>[K(U(z(n)(`settings.archivedRestore`)),1)]),_:1},8,[`onClick`])]))),128))])]))),128))])):(c(),W(`div`,nPe,U(Ft.value.length===0?z(n)(`settings.archivedEmpty`):z(n)(`settings.archivedNoMatch`)),1))],64))],512),[[A,d.value===`archived`]])])],512)]),_:1},8,[`title`]))}}),[[`__scopeId`,`data-v-bfc35ea3`]]),aPe=/^(?:\/|~(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/,L9=/^[A-Za-z]:[\\/]/,oPe=/^\/\/(?!\/)/;function R9(e){return aPe.test(e.trim())}function sPe(e,t){return e===`~`?t||e:e.startsWith(`~/`)?(t||`~`)+e.slice(1):e}function cPe(e){return oPe.test(e)?`//${e.slice(2).replaceAll(/\/{2,}/g,`/`)}`:e.replaceAll(/\/{2,}/g,`/`)}function lPe(e){return L9.test(e)||e.startsWith(`\\\\`)||e.startsWith(`//`)}function uPe(e){return L9.test(e)?3:e.startsWith(`\\\\`)||e.startsWith(`//`)?2:+!!e.startsWith(`/`)}function z9(e,t){let n=cPe(sPe(e.trim(),t)),r=lPe(n),i=n===`/`||n===`//`||n===`\\\\`||/^[A-Za-z]:[\\/]$/.test(n),a=r?/[\\/]$/.test(n):n.endsWith(`/`);!i&&a&&(n=n.slice(0,-1));let o=n.lastIndexOf(`/`),s=r?n.lastIndexOf(`\\`):-1,c=Math.max(o,s),l=s>o?`\\`:`/`,u=uPe(n),d=cg.value.trim().length>0),S=0,C=null,w=L(()=>R9(g.value)),T=R(`idle`),D=R(``),O=R(`/`),k=R([]),A=R(``),j=R(null),N=R(null),ee=L(()=>T.value===`valid`?fPe(g.value,A.value,N.value):null),I=0,te=null;function ne(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e0&&s=B9))break;e.depth+1{C&&clearTimeout(C),te&&clearTimeout(te),I++,T.value=`idle`,k.value=[],N.value=null;let t=e.trim();if(t===``){S++,b.value=[],y.value=!1;return}if(R9(t)){if(S++,b.value=[],y.value=!1,u.value)return;T.value=`checking`,te=setTimeout(()=>void ie(t),150);return}C=setTimeout(()=>void re(e),220)});async function ie(e){let t=++I;T.value=`checking`,N.value=null;let n=z9(e,A.value),{target:i}=n;try{let e=await r.browseFs(i);if(t!==I)return;if(e.path){T.value=`valid`,k.value=[],N.value=i,d.value=e.path,f.value=e.parent,m.value=e.entries,u.value=!1;return}}catch{}if(t!==I)return;let a=n.base.toLowerCase();D.value=n.parent,O.value=n.separator;try{let e=await r.browseFs(n.parent);if(t!==I)return;if(e.path){k.value=e.entries.filter(e=>e.isDir&&e.name.toLowerCase().startsWith(a)),T.value=`not-found`;return}}catch{}t===I&&(k.value=[],T.value=`bad-parent`)}function ae(e){g.value=dPe(D.value,e,O.value),j.value?.focus()}let oe=L(()=>u.value?n(`workspace.degradedPlaceholder`):n(`workspace.searchPlaceholder`)),se=L(()=>u.value?n(`workspace.degradedHint`):w.value&&T.value===`valid`?n(`workspace.pathFollowHint`):n(`workspace.browseHint`));function ce(e){if(e.key===`Escape`){g.value?g.value=``:i(`close`);return}if(e.key!==`Enter`)return;let t=g.value.trim();if(R9(t)){if(e.preventDefault(),u.value){let{target:e}=z9(t,A.value);e&&i(`add`,e);return}T.value===`valid`?me():T.value===`not-found`&&k.value[0]&&ae(k.value[0].name)}}let le=L(()=>{let e=d.value;if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[{label:`/`,path:`/`}],r=``;for(let e of t)r+=`/${e}`,n.push({label:e,path:r});return n}),ue=L(()=>!(d.value.length===0||w.value&&ee.value===null));async function fe(e){o.value=!0;try{let t=await r.browseFs(e);if(!t.path){u.value=!0;return}d.value=t.path,f.value=t.parent,m.value=t.entries,g.value=``,u.value=!1}catch{u.value=!0}finally{o.value=!1}}function G(e){e.isDir&&fe(e.path)}function pe(){f.value&&fe(f.value)}function me(){ue.value&&i(`add`,ee.value??d.value)}return p(async()=>{o.value=!0;try{let e=await r.getFsHome().catch(()=>({home:``,recentRoots:[]}));if(e.home&&(A.value=e.home),r.defaultPath&&(await fe(r.defaultPath),!u.value))return;A.value?await fe(A.value):u.value=!0}catch{u.value=!0}finally{o.value=!1}}),h(()=>{C&&clearTimeout(C),te&&clearTimeout(te)}),(t,r)=>(c(),P(If,{open:a.value,"onUpdate:open":r[2]||=e=>a.value=e,title:z(n)(`workspace.addTitle`),size:`lg`,height:`fixed`,onClose:r[3]||=e=>i(`close`)},{default:B(()=>[F(`div`,pPe,[u.value?E(``,!0):(c(),W(`div`,mPe,[v(Ca,{size:`sm`,disabled:!f.value,label:z(n)(`workspace.up`),onClick:pe},{default:B(()=>[v(X,{name:`arrow-up`,size:`md`})]),_:1},8,[`disabled`,`label`]),F(`div`,hPe,[(c(!0),W(M,null,_(le.value,(e,t)=>(c(),W(M,{key:e.path},[t>1?(c(),W(`span`,gPe,`/`)):E(``,!0),F(`button`,{class:V([`crumb`,{last:t===le.value.length-1}]),onClick:t=>fe(e.path)},U(e.label),11,_Pe)],64))),128))])])),!o.value||u.value?(c(),W(`div`,{key:1,class:V([`filterbar`,{"has-error":T.value===`not-found`||T.value===`bad-parent`}])},[v(X,{class:`filter-icon`,name:`search`,size:`md`}),l(F(`input`,{ref_key:`filterEl`,ref:j,"onUpdate:modelValue":r[0]||=e=>g.value=e,class:`filter-input`,type:`text`,placeholder:oe.value,autocomplete:`off`,spellcheck:`false`,onKeydown:H(ce,[`stop`])},null,40,vPe),[[de,g.value]]),y.value||T.value===`checking`?(c(),P(np,{key:0,size:`sm`})):E(``,!0)],2)):E(``,!0),u.value?(c(),W(`div`,PPe,U(z(n)(`workspace.degradedHint`)),1)):(c(),W(`div`,yPe,[o.value?(c(),W(`div`,bPe,U(z(n)(`workspace.browsing`)),1)):w.value&&T.value!==`valid`?(c(),W(M,{key:1},[T.value===`checking`?(c(),W(`div`,xPe,U(z(n)(`workspace.checkingPath`)),1)):T.value===`not-found`?(c(),W(M,{key:1},[k.value.length>0?(c(),W(`div`,SPe,U(z(n)(`workspace.pathPickHint`)),1)):E(``,!0),(c(!0),W(M,null,_(k.value,e=>(c(),W(`button`,{key:e.path,class:`folder-row`,onClick:t=>ae(e.name)},[v(X,{class:`dir-icon`,name:`folder-closed`,size:`sm`}),F(`span`,wPe,U(e.name),1)],8,CPe))),128)),k.value.length===0?(c(),W(`div`,TPe,U(z(n)(`workspace.noPathMatch`,{parent:D.value})),1)):E(``,!0)],64)):T.value===`bad-parent`?(c(),W(`div`,EPe,U(z(n)(`workspace.badParent`,{parent:D.value})),1)):E(``,!0)],64)):x.value&&!w.value?(c(),W(M,{key:2},[(c(!0),W(M,null,_(b.value,e=>(c(),W(`button`,{key:e.path,class:`folder-row`,onClick:t=>fe(e.path)},[v(X,{class:`dir-icon`,name:`folder-closed`,size:`sm`}),F(`span`,OPe,U(e.rel),1)],8,DPe))),128)),!y.value&&b.value.length===0?(c(),W(`div`,kPe,U(z(n)(`workspace.noFilterMatch`,{q:g.value.trim()})),1)):y.value&&b.value.length===0?(c(),W(`div`,APe,U(z(n)(`workspace.searching`)),1)):E(``,!0)],64)):(c(),W(M,{key:3},[(c(!0),W(M,null,_(m.value,e=>(c(),W(`button`,{key:e.path,class:`folder-row`,onClick:t=>G(e)},[v(X,{class:`dir-icon`,name:`folder-closed`,size:`sm`}),F(`span`,MPe,U(e.name),1)],8,jPe))),128)),m.value.length===0?(c(),W(`div`,NPe,U(z(n)(`workspace.noSubfolders`)),1)):E(``,!0)],64))])),e.error?(c(),W(`div`,FPe,U(e.error),1)):E(``,!0),F(`div`,IPe,[v(vp,{text:d.value},{default:B(()=>[u.value?E(``,!0):(c(),P(YT,{key:0,variant:`primary`,disabled:!ue.value,onClick:me},{default:B(()=>[K(U(z(n)(`workspace.openThisFolder`)),1)]),_:1},8,[`disabled`]))]),_:1},8,[`text`]),v(YT,{variant:`secondary`,onClick:r[1]||=e=>i(`close`)},{default:B(()=>[K(U(z(n)(`workspace.cancel`)),1)]),_:1})]),F(`div`,LPe,U(se.value),1)])]),_:1},8,[`open`,`title`]))}}),[[`__scopeId`,`data-v-09b74e91`]]),VPe={key:0,class:`confirm-dialog__message`},HPe=Y(G({__name:`ConfirmDialog`,props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:`danger`},loading:{type:Boolean}},emits:[`update:open`,`confirm`,`cancel`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J();function a(){n.loading||(r(`update:open`,!1),r(`cancel`))}function o(e){if(e.key!==`Enter`||!n.open||n.loading)return;let t=e.target;t instanceof HTMLButtonElement||t instanceof HTMLAnchorElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLInputElement||(e.preventDefault(),r(`confirm`))}return typeof window<`u`&&window.addEventListener(`keydown`,o),ne(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,o)}),(t,n)=>(c(),P(If,{open:e.open,title:e.title,height:`auto`,stacked:``,"initial-focus":`.confirm-dialog__confirm`,"close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":n[1]||=e=>r(`update:open`,e),onClose:a},{foot:B(()=>[v(YT,{variant:`secondary`,disabled:e.loading,onClick:a},{default:B(()=>[K(U(e.cancelLabel??z(i)(`common.cancel`)),1)]),_:1},8,[`disabled`]),v(YT,{class:`confirm-dialog__confirm`,variant:e.variant,loading:e.loading,onClick:n[0]||=e=>r(`confirm`)},{default:B(()=>[K(U(e.confirmLabel??z(i)(`common.confirm`)),1)]),_:1},8,[`variant`,`loading`])]),default:B(()=>[e.message?(c(),W(`p`,VPe,U(e.message),1)):E(``,!0)]),_:1},8,[`open`,`title`,`close-on-esc`,`close-on-overlay`]))}}),[[`__scopeId`,`data-v-e3b26be2`]]),UPe=G({__name:`ConfirmDialogHost`,setup(e){let{current:t,busy:n,settle:r,runAction:i}=K4();function a(){i()}return(e,i)=>(c(),P(HPe,{open:z(t)!==null,title:z(t)?.title??``,message:z(t)?.message,"confirm-label":z(t)?.confirmLabel,"cancel-label":z(t)?.cancelLabel,variant:z(t)?.variant,loading:z(n),onConfirm:a,onCancel:i[0]||=e=>z(r)(!1)},null,8,[`open`,`title`,`message`,`confirm-label`,`cancel-label`,`variant`,`loading`]))}}),WPe={class:`rows`},GPe={class:`row`},KPe={class:`row`},qPe={class:`row`},JPe={class:`row`},YPe={class:`row`},XPe={class:`row`},ZPe={class:`ctx-text`},QPe={key:0,class:`bar`},$Pe={class:`row`},eFe=Y(G({__name:`StatusPanel`,props:{status:{},thinking:{},planMode:{type:Boolean},dynamicWorkflowMode:{type:Boolean},costUsd:{}},emits:[`close`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,a=R(!0),o=L(()=>r.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(r.status.ctxUsed/r.status.ctxMax*100)))),s=L(()=>r.status.ctxMax>0?n(`status.statusContextValue`,{used:mO(r.status.ctxUsed),max:mO(r.status.ctxMax),pct:o.value}):n(`status.statusNone`));function l(e){return n(e===`yolo`?`status.permissionYolo`:e===`auto`?`status.permissionAuto`:`status.permissionManual`)}let u=L(()=>{let e=r.status.permission;return e===`yolo`?`var(--color-warning)`:e===`auto`?`var(--color-danger)`:`var(--color-text)`}),d=L(()=>r.planMode?n(`status.planOn`):n(`status.planOff`)),f=L(()=>r.dynamicWorkflowMode?n(`status.dynamicWorkflowOn`):n(`status.dynamicWorkflowOff`)),p=L(()=>typeof r.costUsd==`number`&&r.costUsd>0),m=L(()=>p.value?`$${r.costUsd.toFixed(4)}`:n(`status.statusNone`));return(t,r)=>(c(),P(If,{open:a.value,"onUpdate:open":r[0]||=e=>a.value=e,title:z(n)(`status.statusPanelTitle`),onClose:r[1]||=e=>i(`close`)},{default:B(()=>[F(`dl`,WPe,[F(`div`,GPe,[F(`dt`,null,U(z(n)(`status.statusModel`)),1),F(`dd`,null,U(e.status.model),1)]),F(`div`,KPe,[F(`dt`,null,U(z(n)(`status.statusThinking`)),1),F(`dd`,null,U(e.thinking),1)]),F(`div`,qPe,[F(`dt`,null,U(z(n)(`status.statusPermission`)),1),F(`dd`,{style:ae({color:u.value})},U(l(e.status.permission)),5)]),F(`div`,JPe,[F(`dt`,null,U(z(n)(`status.statusPlanMode`)),1),F(`dd`,{class:V({"plan-on":e.planMode})},U(d.value),3)]),F(`div`,YPe,[F(`dt`,null,U(z(n)(`status.statusDynamicWorkflowMode`)),1),F(`dd`,{class:V({"workflow-on":e.dynamicWorkflowMode})},U(f.value),3)]),F(`div`,XPe,[F(`dt`,null,U(z(n)(`status.statusContext`)),1),F(`dd`,null,[F(`span`,ZPe,U(s.value),1),e.status.ctxMax>0?(c(),W(`span`,QPe,[F(`i`,{style:ae({width:o.value+`%`})},null,4)])):E(``,!0)])]),F(`div`,$Pe,[F(`dt`,null,U(z(n)(`status.statusCost`)),1),F(`dd`,null,U(m.value),1)])])]),_:1},8,[`open`,`title`]))}}),[[`__scopeId`,`data-v-7992546c`]]),tFe={key:0,class:`actions`},nFe=[`onClick`],rFe=[`onClick`],iFe={key:1,class:`details`},aFe=Y(G({__name:`WarningToasts`,props:{warnings:{}},emits:[`dismiss`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J();function a(e){return typeof e==`object`&&!!e}function o(e){return a(e)?e.title:e}function l(e){return a(e)?e.message??``:``}function u(e){return a(e)?e.details:void 0}function d(e){return a(e)?e.severity===`error`:e.startsWith(`${i(`warnings.errorLabel`)}:`)||/\b4\d\d\b|error|failed/i.test(e)}function f(e){if(!a(e))return d(e)?`danger`:`warning`;switch(e.severity){case`error`:case`danger`:return`danger`;case`success`:return`success`;case`info`:return`info`;default:return`warning`}}function p(e){return a(e)?`notice:${e.severity}:${e.title}:${e.message??``}:${JSON.stringify(e.details??[])}`:`text:${e}`}function m(e){if(!a(e))return e;let t=[e.title];e.message&&t.push(e.message);let n=e.details??[];if(n.length>0){t.push(``,`${i(`warnings.diagnostics`)}:`);for(let e of n)t.push(`${e.label}: ${e.value}`)}return t.join(` -`)}let g=1,v=R([]),y=new Map,b=new Map;function x(e){let t=d(e)?12e3:6e3;return typeof window<`u`&&window.matchMedia?.(`(hover: none)`).matches===!0?t+5e3:t}function S(e,t){let n=y.get(e)??{handle:null,deadline:0,remaining:0};n.handle=setTimeout(()=>k(e),t),n.deadline=Date.now()+t,y.set(e,n)}function C(e){let t=y.get(e);t&&t.handle!==null&&clearTimeout(t.handle),y.delete(e)}function w(e){let t=y.get(e);!t||t.handle===null||(clearTimeout(t.handle),t.handle=null,t.remaining=Math.max(0,t.deadline-Date.now()))}function T(e){if(v.value.find(t=>t.id===e)?.detailsOpen)return;let t=y.get(e);!t||t.handle!==null||S(e,t.remaining)}function D(e){e.detailsOpen=!e.detailsOpen,e.detailsOpen?w(e.id):T(e.id)}async function O(e){if(!await Wi(m(e.warning)))return;e.copied=!0;let t=b.get(e.id);t&&clearTimeout(t),b.set(e.id,setTimeout(()=>{e.copied=!1,b.delete(e.id)},1400))}function k(e){C(e);let t=b.get(e);t&&clearTimeout(t),b.delete(e);let n=v.value.findIndex(t=>t.id===e);n!==-1&&(v.value=v.value.filter(t=>t.id!==e),r(`dismiss`,n))}return s(()=>n.warnings,e=>{let t=[...v.value];v.value=e.map(e=>{let n=p(e),r=t.findIndex(e=>e.key===n),i=r===-1?void 0:t.splice(r,1)[0];if(i)return i.warning=e,i;let a={id:g++,key:n,warning:e,detailsOpen:!1,copied:!1};return S(a.id,x(e)),a});for(let e of t){C(e.id);let t=b.get(e.id);t&&clearTimeout(t),b.delete(e.id)}},{immediate:!0,flush:`post`}),h(()=>{y.forEach(e=>{e.handle!==null&&clearTimeout(e.handle)}),y.clear(),b.forEach(e=>clearTimeout(e)),b.clear()}),(e,t)=>(c(),P(le,{name:`toast`,tag:`div`,class:`toasts`,role:`status`,"aria-live":`polite`},{default:B(()=>[(c(!0),W(M,null,_(v.value,e=>(c(),P(I7,{key:e.id,variant:f(e.warning),title:o(e.warning),message:l(e.warning),count:a(e.warning)?e.warning.count:void 0,"dismiss-label":z(i)(`warnings.dismiss`),onDismiss:t=>k(e.id),onPointerenter:t=>w(e.id),onPointerleave:t=>T(e.id)},{default:B(()=>[u(e.warning)?.length?(c(),W(`div`,tFe,[F(`button`,{class:`link`,type:`button`,onClick:t=>D(e)},U(e.detailsOpen?z(i)(`warnings.hideDetails`):z(i)(`warnings.showDetails`)),9,nFe),F(`button`,{class:`link`,type:`button`,onClick:t=>O(e)},U(e.copied?z(i)(`warnings.copied`):z(i)(`warnings.copyDetails`)),9,rFe)])):E(``,!0),e.detailsOpen&&u(e.warning)?.length?(c(),W(`dl`,iFe,[(c(!0),W(M,null,_(u(e.warning),e=>(c(),W(`div`,{key:`${e.label}:${e.value}`,class:`detail-row`},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))])):E(``,!0)]),_:2},1032,[`variant`,`title`,`message`,`count`,`dismiss-label`,`onDismiss`,`onPointerenter`,`onPointerleave`]))),128))]),_:1}))}}),[[`__scopeId`,`data-v-ca5c4402`]]),oFe={key:0,class:`window-controls`},sFe=[`aria-label`],cFe=[`aria-label`],lFe=[`aria-label`],uFe=Y(G({__name:`WindowControls`,setup(e){let{t}=J(),n=L(()=>window.pythinkerDesktop?.platform===`win32`);function r(){window.pythinkerDesktop?.minimizeWindow()}function i(){window.pythinkerDesktop?.toggleMaximizeWindow()}function a(){window.pythinkerDesktop?.closeWindow()}return(e,o)=>n.value?(c(),W(`div`,oFe,[F(`button`,{type:`button`,class:`wc wc-min`,"aria-label":z(t)(`app.minimizeWindow`),onClick:r},[...o[0]||=[F(`svg`,{viewBox:`0 0 10 10`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"aria-hidden":`true`},[F(`path`,{d:`M2.5 5h5`})],-1)]],8,sFe),F(`button`,{type:`button`,class:`wc wc-max`,"aria-label":z(t)(`app.maximizeWindow`),onClick:i},[...o[1]||=[F(`svg`,{viewBox:`0 0 10 10`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`rect`,{x:`2.4`,y:`2.4`,width:`5.2`,height:`5.2`,rx:`1`})],-1)]],8,cFe),F(`button`,{type:`button`,class:`wc wc-close`,"aria-label":z(t)(`app.closeWindow`),onClick:a},[...o[2]||=[F(`svg`,{viewBox:`0 0 10 10`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"aria-hidden":`true`},[F(`path`,{d:`M3 3l4 4M7 3l-4 4`})],-1)]],8,lFe)])):E(``,!0)}}),[[`__scopeId`,`data-v-768f9703`]]),dFe={class:`topbar`},fFe={class:`wsq`},pFe=[`aria-label`],mFe={class:`tb-path`},hFe={class:`ws`},gFe={class:`se`},_Fe={class:`tb-sub`},vFe=Y(G({__name:`MobileTopBar`,props:{workspace:{default:null},sessionTitle:{default:``},running:{type:Boolean,default:!1},branch:{default:``},sessionCount:{default:0}},emits:[`openSwitcher`,`openSettings`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,a=L(()=>{let e=r.workspace,t=(e?.name||e?.root||``).trim().charAt(0);return t?t.toUpperCase():`K`}),o=L(()=>r.workspace?.name??n(`workspace.noWorkspace`)),s=L(()=>r.running?n(`mobile.running`):n(`mobile.idle`));return(t,r)=>(c(),W(`div`,dFe,[F(`span`,fFe,U(a.value),1),F(`button`,{type:`button`,class:`tb-mid`,"aria-label":z(n)(`mobile.openSwitcher`),onClick:r[0]||=e=>i(`openSwitcher`)},[F(`span`,mFe,[F(`span`,hFe,U(o.value),1),e.sessionTitle?(c(),W(M,{key:0},[r[2]||=F(`span`,{class:`sl`},`/`,-1),F(`span`,gFe,U(e.sessionTitle),1)],64)):E(``,!0),r[3]||=F(`span`,{class:`cv`},`⌄`,-1)]),F(`span`,_Fe,[F(`span`,{class:V([`rd`,{on:e.running}])},null,2),F(`span`,null,U(s.value),1),e.branch?(c(),W(M,{key:0},[K(` · `+U(e.branch),1)],64)):E(``,!0),e.sessionCount>0?(c(),W(M,{key:1},[K(` · `+U(z(n)(`mobile.sessionCount`,{n:e.sessionCount})),1)],64)):E(``,!0)])],8,pFe),v(Ca,{size:`lg`,label:z(n)(`mobile.openSettings`),onClick:r[1]||=e=>i(`openSettings`)},{default:B(()=>[v(X,{name:`sliders`,size:`lg`})]),_:1},8,[`label`])]))}}),[[`__scopeId`,`data-v-27a83eb2`]]),yFe={class:`mlist`},bFe={key:0,class:`mempty`},xFe=[`onClick`],SFe={class:`mgh-main`},CFe={class:`mgh-name`},wFe={class:`mgh-path`},TFe={key:2,class:`att`},EFe={key:0,class:`mempty small`},DFe=[`onClick`],OFe={class:`m`},kFe={class:`s`},AFe={key:0,class:`att`},jFe=[`disabled`,`onClick`],MFe=[`onClick`],NFe=Y(G({__name:`MobileSwitcherSheet`,props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:[`update:modelValue`,`select`,`create`,`createInWorkspace`,`addWorkspace`,`rename`,`archive`,`deleteSession`,`deleteWorkspace`,`loadMore`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t;function a(){i(`update:modelValue`,!1)}function o(e){i(`select`,e),a()}function s(e){i(`createInWorkspace`,e),a()}function u(){i(`create`),a()}function d(){i(`addWorkspace`),a()}let f=R(new Set);function p(e){return f.value.has(e)}function m(e){let t=new Set(f.value);t.has(e)?t.delete(e):t.add(e),f.value=t,C.value=null,k.value=null}let h=R(new Set);function g(e){return h.value.has(e)}function y(e){let t=new Set(h.value);t.has(e)?t.delete(e):t.add(e),h.value=t}function b(e){if(g(e.workspace.id))return e.sessions;let t=e.sessions.slice(0,e.initialCount);if(r.activeId&&!t.some(e=>e.id===r.activeId)){let n=e.sessions.find(e=>e.id===r.activeId);if(n)return[...t,n]}return t}function x(e){if(!h.value.has(e)){let t=new Set(h.value);t.add(e),h.value=t}i(`loadMore`,e)}function S(e){return r.attentionByWorkspace[e]??0}let C=R(null);function w(e){C.value=C.value===e?null:e,k.value=null}function T(e){C.value=null;let t=(typeof window<`u`?window.prompt(n(`sidebar.rename`),e.title):null)?.trim();t&&i(`rename`,e.id,t)}function D(e){C.value=null,i(`archive`,e)}function O(e){C.value=null,i(`deleteSession`,e)}let k=R(null);function j(e){k.value=k.value===e?null:e,C.value=null}function N(e){Wi(e.root),k.value=null}function ee(e){k.value=null,i(`deleteWorkspace`,e.id)}return(t,r)=>(c(),P(F7,{"model-value":e.modelValue,"onUpdate:modelValue":r[2]||=e=>i(`update:modelValue`,e)},{default:B(()=>[F(`button`,{type:`button`,class:`newrow`,onClick:u},[v(X,{name:`chat-new`,size:`sm`}),K(` `+U(z(n)(`sidebar.newChat`)),1)]),F(`button`,{type:`button`,class:`newrow secondary`,onClick:d},[v(X,{name:`folder`,size:`sm`}),K(` `+U(z(n)(`sidebar.newWorkspace`)),1)]),F(`div`,yFe,[e.groups.length===0?(c(),W(`div`,bFe,U(z(n)(`workspace.noWorkspace`)),1)):E(``,!0),(c(!0),W(M,null,_(e.groups,t=>(c(),W(`div`,{key:t.workspace.id,class:`mgroup`},[F(`div`,{class:V([`mgh`,{on:t.workspace.id===e.activeWorkspaceId}]),onClick:e=>m(t.workspace.id)},[p(t.workspace.id)?(c(),P(X,{key:0,class:`mgh-folder`,name:`folder-closed`,size:`sm`})):(c(),P(X,{key:1,class:`mgh-folder`,name:`folder`,size:`sm`})),F(`div`,SFe,[F(`span`,CFe,U(t.workspace.name),1),v(vp,{text:t.workspace.root},{default:B(()=>[F(`span`,wFe,U(t.workspace.shortPath),1)]),_:2},1032,[`text`])]),p(t.workspace.id)&&S(t.workspace.id)>0?(c(),W(`span`,TFe,U(S(t.workspace.id)),1)):E(``,!0),v(Ca,{size:`lg`,class:`mgh-more`,label:z(n)(`sidebar.options`),onClick:H(e=>j(t.workspace.id),[`stop`])},{default:B(()=>[v(X,{name:`dots-horizontal`,size:`md`})]),_:1},8,[`label`,`onClick`]),v(Ca,{size:`lg`,class:`mgh-add`,label:z(n)(`workspace.newInGroup`),onClick:H(e=>s(t.workspace.id),[`stop`])},{default:B(()=>[v(X,{name:`plus`,size:`md`})]),_:1},8,[`label`,`onClick`]),k.value===t.workspace.id?(c(),P(dp,{key:3,class:`kmenu wsmenu`,onClick:r[0]||=H(()=>{},[`stop`])},{default:B(()=>[v(mp,{size:`lg`,onClick:e=>N(t.workspace)},{default:B(()=>[K(U(z(n)(`sidebar.copyPath`)),1)]),_:1},8,[`onClick`]),v(mp,{size:`lg`,danger:``,onClick:e=>ee(t.workspace)},{default:B(()=>[K(U(z(n)(`sidebar.delete`)),1)]),_:1},8,[`onClick`])]),_:2},1024)):E(``,!0)],10,xFe),l(F(`div`,null,[t.sessions.length===0?(c(),W(`div`,EFe,U(z(n)(`sidebar.noSessions`)),1)):E(``,!0),(c(!0),W(M,null,_(b(t),t=>(c(),W(`div`,{key:t.id,class:V([`srow`,{cur:t.id===e.activeId}]),onClick:e=>o(t.id)},[F(`div`,OFe,[F(`div`,{class:V([`t`,{run:t.busy,aborted:!t.busy&&(e.attentionBySession[t.id]??0)===0&&(t.lastTurnReason===`cancelled`||t.lastTurnReason===`failed`)}])},U(t.title),3),F(`div`,kFe,U(t.time),1)]),(e.attentionBySession[t.id]??0)>0?(c(),W(`span`,AFe,U(e.attentionBySession[t.id]),1)):E(``,!0),v(Ca,{size:`lg`,class:`kb`,label:z(n)(`sidebar.options`),onClick:H(e=>w(t.id),[`stop`])},{default:B(()=>[v(X,{name:`dots-horizontal`,size:`md`})]),_:1},8,[`label`,`onClick`]),C.value===t.id?(c(),P(dp,{key:1,class:`kmenu`,onClick:r[1]||=H(()=>{},[`stop`])},{default:B(()=>[v(mp,{size:`lg`,onClick:e=>T(t)},{default:B(()=>[K(U(z(n)(`sidebar.rename`)),1)]),_:1},8,[`onClick`]),v(mp,{size:`lg`,danger:``,onClick:e=>D(t.id)},{default:B(()=>[K(U(z(n)(`sidebar.archive`)),1)]),_:1},8,[`onClick`]),v(mp,{size:`lg`,danger:``,onClick:e=>O(t.id)},{default:B(()=>[K(U(z(n)(`sidebar.delete`)),1)]),_:1},8,[`onClick`])]),_:2},1024)):E(``,!0)],10,DFe))),128)),t.hasMore||t.loadingMore?(c(),W(`button`,{key:1,type:`button`,class:`mshow-more`,disabled:t.loadingMore,onClick:H(e=>x(t.workspace.id),[`stop`])},U(t.loadingMore?z(n)(`sidebar.loadingMore`):z(n)(`sidebar.showMore`,{count:Math.max(0,t.workspace.sessionCount-t.sessions.length)})),9,jFe)):E(``,!0),t.sessions.length>t.initialCount?(c(),W(`button`,{key:2,type:`button`,class:`mshow-more`,onClick:H(e=>y(t.workspace.id),[`stop`])},U(g(t.workspace.id)?z(n)(`sidebar.showLess`):z(n)(`sidebar.showAll`,{count:t.sessions.length-t.initialCount})),9,MFe)):E(``,!0)],512),[[A,!p(t.workspace.id)]])]))),128))])]),_:1},8,[`model-value`]))}}),[[`__scopeId`,`data-v-8f1d0519`]]),PFe={class:`group-title`},FFe={class:`srow-main`},IFe={class:`srow-label`},LFe={class:`srow-sub`},RFe={class:`srow read-only`},zFe={class:`srow-main`},BFe={class:`srow-label`},VFe={key:0,class:`srow-sub`},HFe={class:`cache-note`},UFe={class:`srow-main`},WFe={class:`srow-label`},GFe={class:`srow-sub`},KFe=[`aria-checked`],qFe={key:0,class:`srow read-only`},JFe={class:`srow-main`},YFe={class:`srow-label`},XFe={class:`srow-sub`},ZFe={class:`goal-actions`},QFe=[`aria-checked`],$Fe={class:`srow-main`},eIe={class:`srow-label`},tIe={class:`srow-sub`},nIe=[`aria-checked`],rIe={class:`srow-main`},iIe={class:`srow-label`},aIe={class:`srow-sub`},oIe={class:`srow-main`},sIe={class:`srow-label`},cIe={class:`srow read-only`},lIe={class:`srow-main`},uIe={class:`srow-label`},dIe={class:`srow-sub`},fIe=[`aria-label`],pIe={class:`group-title`},mIe={class:`srow-main`},hIe={class:`srow-label`},gIe={class:`srow-sub`},_Ie={class:`srow read-only pref`},vIe={class:`srow-main`},yIe={class:`srow-label`},bIe={class:`srow read-only pref`},xIe={class:`srow-main`},SIe={class:`srow-label`},CIe={class:`srow-main`},wIe={class:`srow-label`},TIe={class:`srow-sub`},EIe=[`aria-checked`],DIe={class:`srow-main`},OIe={class:`srow-label`},kIe={key:2,class:`srow read-only`},AIe={class:`srow-main`},jIe={class:`srow-label`},MIe={class:`srow-val dim`},NIe={class:`arch-subhead`},PIe={class:`arch-count`},FIe={class:`arch-tools`},IIe={key:0,class:`arch-empty`},LIe={class:`arch-meta`},RIe={class:`arch-name`},zIe={class:`arch-time`},BIe={key:2,class:`arch-empty`},VIe=100,HIe=Y(G({__name:`MobileSettingsSheet`,props:{modelValue:{type:Boolean},status:{},thinking:{},planMode:{type:Boolean},goalMode:{type:Boolean},goal:{default:null},dynamicWorkflowMode:{type:Boolean},colorScheme:{default:`system`},uiFontSize:{default:14},conversationToc:{type:Boolean},serverVersion:{default:``},models:{default:()=>[]}},emits:[`update:modelValue`,`pickModel`,`setThinking`,`togglePlan`,`toggleWorkflow`,`toggleGoal`,`controlGoal`,`setPermission`,`setColorScheme`,`setUiFontSize`,`setConversationToc`,`login`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,{confirm:a}=K4();function o(e){i(`setColorScheme`,e)}let l=[`manual`,`yolo`,`auto`],u=L(()=>r.models?.find(e=>e.id===r.status?.modelId)),d=L(()=>X3(u.value)),f=L(()=>$3(u.value)),p=L(()=>r6(u.value,r.thinking)),m=L(()=>f.value.includes(p.value)?p.value:``),h=L(()=>f.value.map(e=>({value:e,label:e6(e)}))),g=L(()=>r.planMode===!0),y=L(()=>r.goalMode===!0),b=L(()=>r.goal!==null&&[`active`,`paused`,`blocked`].includes(r.goal?.status??``)),x=L(()=>{let e=r.goal?.status;return e?n(`status.goalStatus${e[0].toUpperCase()}${e.slice(1)}`):``});async function S(){await a({title:n(`status.goalCancel`),message:n(`status.goalCancelConfirm`),confirmLabel:n(`status.goalCancelConfirmYes`),cancelLabel:n(`status.goalCancelConfirmNo`),variant:`danger`})&&i(`controlGoal`,`cancel`)}let C=L(()=>x6(r.uiFontSize));function w(e){let t=S6(e);t!==void 0&&i(`setUiFontSize`,t)}let T=L(()=>{let e=r.status.permission;return e===`yolo`?`var(--color-warning)`:e===`auto`?`var(--color-danger)`:`var(--color-text-muted)`}),D=L(()=>{let e=r.status.permission;return`${e} · ${n(e===`yolo`?`mobile.permYoloSub`:e===`auto`?`mobile.permAutoSub`:`mobile.permManualSub`)}`}),O=L(()=>r.status.ctxMax>0?Math.min(100,Math.max(0,Math.ceil(r.status.ctxUsed/r.status.ctxMax*100))):0),k=L(()=>r.status.ctxMax>0?`${mO(r.status.ctxUsed)}/${mO(r.status.ctxMax)}`:n(`status.statusNone`));function A(e){i(`setThinking`,n6(u.value,e))}function j(){let e=l[(l.indexOf(r.status.permission)+1)%l.length];i(`setPermission`,e)}function N(){i(`pickModel`),i(`update:modelValue`,!1)}function ee(){i(`login`),i(`update:modelValue`,!1)}let I=D7(),te=R(`main`),ne=R([]),re=R(!1),ie=R(!1),oe=R(``),se=R(`archived-desc`);async function ce(){if(!re.value){re.value=!0,ie.value=!1;try{let e=[],t;for(;;){let n=await I.loadArchivedSessions({beforeId:t,pageSize:VIe});if(e.push(...n.items),!n.hasMore||n.items.length===0)break;let r=n.items.at(-1)?.id;if(r===void 0)break;t=r}ne.value=e,ie.value=!0}catch(e){console.warn(`loadAllArchived failed`,e)}finally{re.value=!1}}}function le(){te.value=`archived`,oe.value=``,ce()}function ue(){te.value=`main`}let de=L(()=>{let e=oe.value.trim().toLowerCase(),t=ne.value.filter(e=>e.archived===!0);return e&&(t=t.filter(t=>t.title.toLowerCase().includes(e))),t=t.slice(),se.value===`archived-desc`?t.sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)):se.value===`created-desc`?t.sort((e,t)=>t.createdAt.localeCompare(e.createdAt)):t.sort((e,t)=>e.title.localeCompare(t.title,`en`)),t});async function fe(e){await I.restoreSession(e)&&(ne.value=ne.value.filter(t=>t.id!==e))}function H(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}return s(()=>r.modelValue,e=>{e||(te.value=`main`)}),(t,r)=>(c(),P(F7,{"model-value":e.modelValue,title:z(n)(`mobile.settingsTitle`),"onUpdate:modelValue":r[8]||=e=>i(`update:modelValue`,e)},{default:B(()=>[te.value===`main`?(c(),W(M,{key:0},[F(`div`,PFe,U(z(n)(`mobile.groupSession`)),1),F(`button`,{type:`button`,class:`srow`,onClick:N},[F(`span`,FFe,[F(`span`,IFe,U(z(n)(`status.statusModel`)),1),F(`span`,LFe,U(e.status.model),1)]),r[9]||=F(`span`,{class:`chev`},`›`,-1)]),F(`div`,RFe,[F(`span`,zFe,[F(`span`,BFe,U(z(n)(`status.statusThinking`)),1),d.value===`unsupported`?(c(),W(`span`,VFe,U(z(n)(`status.modeNotSupported`)),1)):E(``,!0)]),f.value.length>1?(c(),P(s6,{key:0,"model-value":m.value,options:h.value,size:`sm`,"onUpdate:modelValue":A},null,8,[`model-value`,`options`])):(c(),W(`span`,{key:1,class:V([`srow-val`,{dim:p.value===`off`}])},U(p.value===`off`?z(n)(`status.planOff`):z(e6)(p.value)),3))]),F(`div`,HFe,U(z(n)(`status.cacheNote`)),1),F(`button`,{type:`button`,class:`srow`,onClick:r[0]||=e=>i(`togglePlan`)},[F(`span`,UFe,[F(`span`,WFe,U(z(n)(`status.statusPlanMode`)),1),F(`span`,GFe,U(z(n)(`mobile.planModeSub`)),1)]),F(`span`,{class:V([`toggle`,{on:g.value}]),role:`switch`,"aria-checked":g.value},null,10,KFe)]),b.value?(c(),W(`div`,qFe,[F(`span`,JFe,[F(`span`,YFe,U(z(n)(`status.goalLabel`)),1),F(`span`,XFe,U(x.value),1)]),F(`span`,ZFe,[e.goal?.status===`active`?(c(),P(YT,{key:0,variant:`secondary`,size:`sm`,onClick:r[1]||=e=>i(`controlGoal`,`pause`)},{default:B(()=>[K(U(z(n)(`status.goalPause`)),1)]),_:1})):E(``,!0),e.goal?.status===`paused`||e.goal?.status===`blocked`?(c(),P(YT,{key:1,variant:`secondary`,size:`sm`,onClick:r[2]||=e=>i(`controlGoal`,`resume`)},{default:B(()=>[K(U(z(n)(`status.goalResume`)),1)]),_:1})):E(``,!0),v(YT,{variant:`ghost`,size:`sm`,onClick:S},{default:B(()=>[K(U(z(n)(`status.goalCancel`)),1)]),_:1})])])):(c(),W(`button`,{key:1,type:`button`,class:`srow`,role:`switch`,"aria-checked":y.value,onClick:r[3]||=e=>i(`toggleGoal`)},[F(`span`,$Fe,[F(`span`,eIe,U(z(n)(`status.goalLabel`)),1),F(`span`,tIe,U(z(n)(`mobile.goalModeSub`)),1)]),F(`span`,{class:V([`toggle`,{on:y.value}])},null,2)],8,QFe)),F(`button`,{type:`button`,class:`srow`,role:`switch`,"aria-checked":e.dynamicWorkflowMode,onClick:r[4]||=e=>i(`toggleWorkflow`)},[F(`span`,rIe,[F(`span`,iIe,U(z(n)(`status.statusDynamicWorkflowMode`)),1),F(`span`,aIe,U(z(n)(`mobile.workflowModeSub`)),1)]),F(`span`,{class:V([`toggle`,{on:e.dynamicWorkflowMode}])},null,2)],8,nIe),F(`button`,{type:`button`,class:`srow`,onClick:j},[F(`span`,oIe,[F(`span`,sIe,U(z(n)(`status.statusPermission`)),1),F(`span`,{class:`srow-sub`,style:ae({color:T.value})},U(D.value),5)]),r[10]||=F(`span`,{class:`chev`},`›`,-1)]),F(`div`,cIe,[F(`span`,lIe,[F(`span`,uIe,U(z(n)(`status.statusContext`)),1),F(`span`,dIe,U(k.value),1)]),F(`span`,{class:`ctx-meter`,"aria-label":k.value},[F(`i`,{style:ae({width:O.value+`%`})},null,4)],8,fIe)]),F(`div`,pIe,U(z(n)(`mobile.groupApp`)),1),F(`button`,{type:`button`,class:`srow`,onClick:le},[F(`span`,mIe,[F(`span`,hIe,U(z(n)(`mobile.archivedSessions`)),1),F(`span`,gIe,U(z(n)(`mobile.archivedSessionsSub`)),1)]),r[11]||=F(`span`,{class:`chev`},`›`,-1)]),F(`div`,_Ie,[F(`span`,vIe,[F(`span`,yIe,U(z(n)(`theme.colorSchemeLabel`)),1)]),v(s6,{"model-value":e.colorScheme??`system`,options:[{value:`light`,label:z(n)(`theme.light`)},{value:`dark`,label:z(n)(`theme.dark`)},{value:`system`,label:z(n)(`theme.system`)}],"onUpdate:modelValue":o},null,8,[`model-value`,`options`])]),F(`div`,bIe,[F(`span`,xIe,[F(`span`,SIe,U(z(n)(`settings.uiFontSize`)),1)]),v(s6,{"model-value":C.value,options:z(g6),"aria-label":z(n)(`settings.uiFontSize`),"onUpdate:modelValue":w},null,8,[`model-value`,`options`,`aria-label`])]),F(`button`,{type:`button`,class:`srow`,onClick:r[5]||=t=>i(`setConversationToc`,!e.conversationToc)},[F(`span`,CIe,[F(`span`,wIe,U(z(n)(`settings.conversationToc`)),1),F(`span`,TIe,U(z(n)(`settings.conversationTocHint`)),1)]),F(`span`,{class:V([`toggle`,{on:e.conversationToc}]),role:`switch`,"aria-checked":e.conversationToc},null,10,EIe)]),F(`button`,{type:`button`,class:`srow acct in`,onClick:ee},[F(`span`,DIe,[F(`span`,OIe,U(z(n)(`settings.manageProviders`)),1)])]),e.serverVersion?(c(),W(`div`,kIe,[F(`span`,AIe,[F(`span`,jIe,U(z(n)(`settings.serverVersion`)),1)]),F(`span`,MIe,U(e.serverVersion),1)])):E(``,!0)],64)):(c(),W(M,{key:1},[F(`div`,NIe,[F(`button`,{type:`button`,class:`arch-back`,onClick:ue},[r[12]||=F(`span`,{class:`chev back`},`‹`,-1),K(` `+U(z(n)(`mobile.archivedBack`)),1)]),F(`span`,PIe,U(z(n)(`mobile.sessionCount`,{n:de.value.length})),1)]),F(`div`,FIe,[v(Pp,{class:`arch-search-input`,"model-value":oe.value,size:`sm`,placeholder:z(n)(`settings.archivedSearch`),"onUpdate:modelValue":r[6]||=e=>oe.value=e},null,8,[`model-value`,`placeholder`]),v(s6,{size:`sm`,"model-value":se.value,options:[{value:`archived-desc`,label:z(n)(`settings.archivedSortArchived`)},{value:`created-desc`,label:z(n)(`settings.archivedSortCreated`)},{value:`name-asc`,label:z(n)(`settings.archivedSortName`)}],"onUpdate:modelValue":r[7]||=e=>se.value=e},null,8,[`model-value`,`options`])]),re.value?(c(),W(`div`,IIe,U(z(n)(`settings.archivedLoadingAll`)),1)):de.value.length>0?(c(!0),W(M,{key:1},_(de.value,e=>(c(),W(`div`,{key:e.id,class:`arch-row`},[F(`div`,LIe,[F(`div`,RIe,U(e.title),1),F(`div`,zIe,U(z(n)(`settings.archivedAt`,{time:H(e.updatedAt)})),1)]),v(YT,{variant:`secondary`,size:`sm`,onClick:t=>fe(e.id)},{default:B(()=>[K(U(z(n)(`settings.archivedRestore`)),1)]),_:1},8,[`onClick`])]))),128)):(c(),W(`div`,BIe,U(ne.value.length===0?z(n)(`settings.archivedEmpty`):z(n)(`settings.archivedNoMatch`)),1))],64))]),_:1},8,[`model-value`,`title`]))}}),[[`__scopeId`,`data-v-bcda0873`]]),UIe=[`role`,`aria-modal`,`aria-label`],WIe={class:`wiz-rail`},GIe={class:`rail-inner`},KIe={class:`eyebrow-pill`},qIe={class:`wiz-title`},JIe={class:`wiz-sub`},YIe={class:`pref-group`},XIe={class:`pref-label`},ZIe={class:`theme-cards`},QIe=[`onClick`],$Ie={class:`opt-label`},eLe={class:`pref-group`},tLe={class:`pref-label`},nLe={class:`accent-cards`},rLe=[`onClick`],iLe={class:`opt-label`},aLe={key:1,class:`wiz-actions`},oLe={key:2,class:`wiz-hint`},sLe={key:0,class:`wiz-hero`,"aria-hidden":`true`},cLe={class:`hero-inner`},lLe={class:`hero-tagline`},uLe={class:`hero-sub`},dLe={class:`frost-stage`},fLe={class:`frost-card`},pLe={class:`frost-card`},V9=Y(G({__name:`Onboarding`,props:{embedded:{type:Boolean,default:!1}},emits:[`complete`,`skip`],setup(e,{emit:t}){let n=t,{t:r}=J(),{colorScheme:i,accent:a,setColorScheme:o,setAccent:s}=A6(),l=[{value:`system`,label:r(`theme.system`)},{value:`light`,label:r(`theme.light`)},{value:`dark`,label:r(`theme.dark`)}],u=[{value:`blue`,label:r(`theme.accentBlue`)},{value:`mono`,label:r(`theme.accentBlack`)}];return(t,d)=>(c(),W(`div`,{class:V([`wizard`,{"is-embedded":e.embedded}]),role:e.embedded?void 0:`dialog`,"aria-modal":e.embedded?void 0:`true`,"aria-label":e.embedded?void 0:z(r)(`onboarding.title`)},[F(`div`,WIe,[F(`div`,GIe,[e.embedded?E(``,!0):(c(),W(M,{key:0},[F(`span`,KIe,U(z(r)(`onboarding.eyebrow`)),1),v(Z7,{class:`brand-mark`,size:`lg`,animated:!1,label:`Pythinker Code`}),F(`h1`,qIe,U(z(r)(`onboarding.title`)),1),F(`p`,JIe,U(z(r)(`onboarding.subtitle`)),1)],64)),F(`div`,YIe,[F(`div`,XIe,U(z(r)(`theme.colorSchemeLabel`)),1),F(`div`,ZIe,[(c(),W(M,null,_(l,e=>F(`button`,{key:e.value,type:`button`,class:V([`opt-card theme-card`,{selected:z(i)===e.value}]),onClick:t=>z(o)(e.value)},[F(`span`,{class:V([`theme-preview`,`theme-preview--${e.value}`]),"aria-hidden":`true`},[e.value===`system`?(c(),W(M,{key:0},[d[2]||=k(``,2)],64)):(c(),W(M,{key:1},[d[3]||=F(`span`,{class:`theme-side`},null,-1),d[4]||=F(`span`,{class:`theme-lines`},[F(`span`),F(`span`),F(`span`)],-1)],64))],2),F(`span`,$Ie,U(e.label),1)],10,QIe)),64))])]),F(`div`,eLe,[F(`div`,tLe,U(z(r)(`theme.accentLabel`)),1),F(`div`,nLe,[(c(),W(M,null,_(u,e=>F(`button`,{key:e.value,type:`button`,class:V([`opt-card accent-card`,{selected:z(a)===e.value}]),onClick:t=>z(s)(e.value)},[F(`span`,{class:V([`opt-radio`,{on:z(a)===e.value}])},null,2),F(`span`,{class:V([`accent-swatch`,`accent-swatch--${e.value}`]),"aria-hidden":`true`},null,2),F(`span`,iLe,U(e.label),1)],10,rLe)),64))])]),e.embedded?E(``,!0):(c(),W(`div`,aLe,[v(YT,{variant:`primary`,size:`lg`,class:`wiz-action`,"data-testid":`onboarding-complete`,onClick:d[0]||=e=>n(`complete`)},{default:B(()=>[F(`span`,null,U(z(r)(`onboarding.start`)),1),v(X,{name:`arrow-right`,size:`sm`})]),_:1}),v(YT,{variant:`secondary`,size:`lg`,class:`wiz-action`,"data-testid":`onboarding-skip`,onClick:d[1]||=e=>n(`skip`)},{default:B(()=>[F(`span`,null,U(z(r)(`onboarding.skip`)),1),v(X,{name:`arrow-right`,size:`sm`})]),_:1})])),e.embedded?E(``,!0):(c(),W(`p`,oLe,U(z(r)(`onboarding.hint`)),1))])]),e.embedded?E(``,!0):(c(),W(`aside`,sLe,[d[7]||=F(`div`,{class:`hero-ambient`},[F(`span`,{class:`orb orb-a`}),F(`span`,{class:`orb orb-b`}),F(`span`,{class:`orb orb-c`})],-1),F(`div`,cLe,[v(Z7,{size:`hero`,animated:!1,label:``}),F(`p`,lLe,U(z(r)(`onboarding.heroTitle`)),1),F(`p`,uLe,U(z(r)(`onboarding.heroSub`)),1),F(`div`,dLe,[F(`figure`,fLe,[d[5]||=k(``,2),F(`figcaption`,null,U(z(r)(`onboarding.platformMac`)),1)]),F(`figure`,pLe,[d[6]||=k(``,2),F(`figcaption`,null,U(z(r)(`onboarding.platformWindows`)),1)])])])]))],10,UIe))}}),[[`__scopeId`,`data-v-2c24b7cb`]]),mLe=2e3;function hLe(e){let t=R(`idle`),n=R(void 0),r=R(void 0),i=R(!1),a=R(!0),o=R(``),s=L(()=>t.value===`starting`||t.value===`exchanging`||t.value===`loading_models`),c,l,u=!1,d=!1;function f(){return t.value===`waiting_for_browser`||t.value===`waiting_for_code`}function m(){c!==void 0&&(clearInterval(c),c=void 0)}function g(){n.value=void 0,r.value=void 0,i.value=!1}function _(){l?.close(),l=void 0}function v(e){u||(o.value=e,t.value=`failed`,m(),_(),g())}async function y(r,i){if(u||n.value!==r||!f()&&t.value!==`exchanging`||i.state===`pending`)return;if(m(),i.state===`failed`){v(i.message??``);return}if(i.state===`cancelled`){t.value=`cancelled`,_(),g();return}l=void 0,t.value=`loading_models`;let a=!0;try{a=await e?.()??!0}catch(e){v(e instanceof Error?e.message:String(e));return}finally{g()}u||(a?t.value=`connected`:v(``))}async function b(){if(u||d||!f())return;let e=n.value;if(e!==void 0){d=!0;try{await y(e,await Q().getCodexLoginStatus(e))}catch{}finally{d=!1}}}function x(){b()}function S(){document.visibilityState===`visible`&&b()}async function C(){if(u||s.value||f())return;t.value=`starting`,o.value=``,g();let e=null;try{e=typeof window>`u`?null:window.open(`about:blank`,`_blank`),e!==null&&(e.opener=null,l=e)}catch{e?.close(),e=null}i.value=e===null;try{let o=Q(),s=await o.startCodexLogin();if(u){_(),o.cancelCodexLogin(s.loginId).catch(()=>{});return}if(n.value=s.loginId,r.value=s.authorizeUrl,a.value=s.loopback,e!==null)try{e.location.href=s.authorizeUrl}catch{_(),i.value=!0}t.value=s.loopback?`waiting_for_browser`:`waiting_for_code`,m(),c=setInterval(()=>void b(),mLe)}catch(e){_(),v(e instanceof Error?e.message:String(e))}}async function w(e){let r=n.value;if(u||s.value||!f()||r===void 0)return;let i=t.value;t.value=`exchanging`,o.value=``;try{await y(r,await Q().submitCodexLoginRedirect(r,e)),!u&&t.value===`exchanging`&&(t.value=i)}catch(e){u||(o.value=e instanceof Error?e.message:String(e),t.value=i)}}async function T(){let e=n.value;if(m(),_(),g(),t.value=`cancelled`,o.value=``,e!==void 0)try{await Q().cancelCodexLogin(e)}catch{}}return p(()=>{window.addEventListener(`focus`,x),document.addEventListener(`visibilitychange`,S)}),h(()=>{u=!0,window.removeEventListener(`focus`,x),document.removeEventListener(`visibilitychange`,S),m(),_();let e=n.value;e!==void 0&&f()&&Q().cancelCodexLogin(e).catch(()=>{})}),{phase:fe(t),busy:s,loginId:fe(n),authorizeUrl:fe(r),popupBlocked:fe(i),loopback:fe(a),error:fe(o),start:C,submitRedirect:w,cancel:T}}var gLe={class:`codex-signin`},_Le={key:0,class:`codex-signin__denied`,role:`status`},vLe={key:1,class:`codex-signin__ok`,role:`status`},yLe={class:`codex-signin__status`,role:`status`},bLe={key:0,class:`codex-signin__hint`},xLe=[`href`],SLe={class:`codex-signin__hint`},CLe={key:2,class:`codex-signin__error`,role:`alert`},wLe={class:`codex-signin__actions`},TLe=Y(G({__name:`CodexSignIn`,emits:[`connected`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=D7(),a=R(``),o=hLe(async()=>{await i.refreshRuntimeState();let e=i.authReady.value;return e&&n(`connected`),e});async function s(){let e=a.value.trim();e!==``&&(await o.submitRedirect(e),a.value=``)}return(e,t)=>(c(),W(`div`,gLe,[z(o).phase.value===`idle`||z(o).phase.value===`cancelled`?(c(),W(M,{key:0},[z(o).phase.value===`cancelled`?(c(),W(`p`,_Le,U(z(r)(`login.deniedTitle`)),1)):E(``,!0),v(YT,{variant:`primary`,"data-testid":`codex-signin-start`,onClick:t[0]||=e=>z(o).start()},{default:B(()=>[v(X,{name:`log-in`,size:`sm`}),F(`span`,null,U(z(r)(`codexLogin.signIn`)),1)]),_:1})],64)):z(o).phase.value===`connected`?(c(),W(`p`,vLe,[v(X,{name:`circle-check`,size:`sm`}),F(`span`,null,U(z(r)(`codexLogin.connected`)),1)])):(c(),W(M,{key:2},[F(`p`,yLe,[z(o).busy.value||z(o).phase.value!==`failed`?(c(),P(np,{key:0,size:`sm`})):E(``,!0),F(`span`,null,U(z(r)(`codexLogin.phase.${z(o).phase.value}`)),1)]),z(o).authorizeUrl.value?(c(),W(`p`,bLe,[K(U(z(r)(`codexLogin.openLinkHint`))+` `,1),F(`a`,{href:z(o).authorizeUrl.value,target:`_blank`,rel:`noreferrer noopener`},U(z(r)(`codexLogin.openLink`)),9,xLe)])):E(``,!0),z(o).phase.value===`waiting_for_code`||z(o).phase.value===`exchanging`?(c(),W(`form`,{key:1,class:`codex-signin__paste`,onSubmit:H(s,[`prevent`])},[F(`p`,SLe,U(z(r)(`codexLogin.pasteHint`)),1),v(k7,{label:z(r)(`codexLogin.pasteLabel`)},{default:B(()=>[v(Pp,{modelValue:a.value,"onUpdate:modelValue":t[1]||=e=>a.value=e,placeholder:z(r)(`codexLogin.pastePlaceholder`),autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),v(YT,{type:`submit`,variant:`primary`,loading:z(o).busy.value},{default:B(()=>[K(U(z(r)(`codexLogin.submit`)),1)]),_:1},8,[`loading`])],32)):E(``,!0),z(o).error.value?(c(),W(`p`,CLe,U(z(r)(`codexLogin.failed`,{message:z(o).error.value})),1)):E(``,!0),F(`div`,wLe,[z(o).phase.value===`failed`?(c(),P(YT,{key:0,variant:`primary`,onClick:t[2]||=e=>z(o).start()},{default:B(()=>[K(U(z(r)(`codexLogin.retry`)),1)]),_:1})):(c(),P(YT,{key:1,variant:`secondary`,onClick:t[3]||=e=>z(o).cancel()},{default:B(()=>[K(U(z(r)(`codexLogin.cancel`)),1)]),_:1}))])],64))]))}}),[[`__scopeId`,`data-v-3bd16f58`]]),ELe=[`aria-label`],DLe={class:`first-run__panel`},OLe={class:`first-run__steps`},kLe={class:`first-run__dot`},ALe={key:0,class:`first-run__body`},jLe={class:`first-run__sub`},MLe={key:0,class:`first-run__options`},NLe={class:`first-run__option-main`},PLe={class:`first-run__option-name`},FLe={class:`first-run__option-desc`},ILe={class:`first-run__badge`},LLe={class:`first-run__option-main`},RLe={class:`first-run__option-name`},zLe={class:`first-run__option-desc`},BLe={class:`first-run__option-main`},VLe={class:`first-run__option-name`},HLe={class:`first-run__option-desc`},ULe={key:1,class:`first-run__route`},WLe={class:`first-run__actions`},GLe={key:2,class:`first-run__skip-hint`},KLe={key:1,class:`first-run__body`},qLe={class:`first-run__sub`},JLe={key:0,class:`first-run__empty`},YLe={key:1,class:`first-run__models`},XLe=[`data-testid`,`onClick`],ZLe={class:`first-run__model-id`},QLe={key:0,class:`first-run__badge`},$Le={class:`first-run__model-ctx`},eRe={class:`first-run__actions`},tRe={key:2,class:`first-run__body`},nRe={class:`first-run__sub`},rRe={class:`first-run__ready`},iRe={class:`first-run__actions`},aRe=Y(G({__name:`FirstRun`,emits:[`complete`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=D7(),a=R(`connect`),o=R(null),l=R(null),u=R(!1),d=R(!1),f=[`connect`,`model`,`appearance`],p=L(()=>f.indexOf(a.value)),m=L(()=>(i.models.value??[]).filter(e=>e.capabilities===void 0||e.capabilities.length===0||e.capabilities.some(e=>e.trim().toLowerCase()===`tool_use`))),h=L(()=>i.defaultModel.value??void 0),g=L(()=>{let e=h.value;return m.value.toSorted((t,n)=>t.id===e?-1:n.id===e?1:n.maxContextSize-t.maxContextSize||t.id.localeCompare(n.id))}),y=L(()=>u.value?g.value:g.value.slice(0,5)),b=L(()=>(i.providers.value??[])[0]?.id??``),x=L(()=>i.authReady.value&&m.value.length>0),S=L(()=>l.value!==null);s([h,m],()=>{l.value===null&&(l.value=h.value??m.value[0]?.id??null)},{immediate:!0});function C(){x.value&&(a.value=`model`)}async function w(){let e=l.value;if(!(e===null||d.value)){d.value=!0;try{e!==i.defaultModel.value&&await i.updateConfig({defaultModel:e}),await i.refreshRuntimeState(),i.authReady.value&&(a.value=`appearance`)}finally{d.value=!1}}}function T(){i.setOnboarded(!0),n(`complete`)}function D(){T()}function O(e){o.value=e}async function k(){await i.refreshRuntimeState(),x.value&&C()}return(e,t)=>(c(),W(`div`,{class:`first-run`,role:`dialog`,"aria-modal":`true`,"aria-label":z(r)(`firstRun.connect.title`)},[F(`div`,DLe,[F(`ol`,OLe,[(c(),W(M,null,_(f,(e,t)=>F(`li`,{key:e,class:V([`first-run__step`,{"is-current":t===p.value,"is-done":tO(`codex`)},[F(`span`,NLe,[F(`span`,PLe,U(z(r)(`firstRun.connect.codexName`)),1),F(`span`,FLe,U(z(r)(`firstRun.connect.codexDesc`)),1)]),F(`span`,ILe,U(z(r)(`firstRun.connect.codexBadge`)),1)]),F(`button`,{type:`button`,class:`first-run__option`,"data-testid":`first-run-route-catalog`,onClick:t[1]||=e=>O(`catalog`)},[F(`span`,LLe,[F(`span`,RLe,U(z(r)(`firstRun.connect.catalogName`)),1),F(`span`,zLe,U(z(r)(`firstRun.connect.catalogDesc`)),1)]),v(X,{name:`chevron-right`,size:`sm`})]),F(`button`,{type:`button`,class:`first-run__option`,"data-testid":`first-run-route-manual`,onClick:t[2]||=e=>O(`manual`)},[F(`span`,BLe,[F(`span`,VLe,U(z(r)(`firstRun.connect.manualName`)),1),F(`span`,HLe,U(z(r)(`firstRun.connect.manualDesc`)),1)]),v(X,{name:`chevron-right`,size:`sm`})])])):(c(),W(`div`,ULe,[o.value===`codex`?(c(),P(TLe,{key:0,onConnected:k})):(c(),P(P9,{key:1,config:z(i).config.value,"initial-source":o.value===`manual`?`manual`:`catalog`,onAdded:k,onCancel:t[3]||=e=>o.value=null},null,8,[`config`,`initial-source`])),v(YT,{variant:`ghost`,size:`sm`,onClick:t[4]||=e=>o.value=null},{default:B(()=>[K(U(z(r)(`firstRun.connect.back`)),1)]),_:1})])),F(`div`,WLe,[v(YT,{variant:`ghost`,"data-testid":`first-run-skip`,onClick:D},{default:B(()=>[K(U(z(r)(`firstRun.connect.skip`)),1)]),_:1}),t[8]||=F(`span`,{class:`first-run__spacer`},null,-1),x.value?(c(),P(YT,{key:0,variant:`primary`,"data-testid":`first-run-connect-continue`,onClick:C},{default:B(()=>[K(U(z(r)(`firstRun.continue`)),1)]),_:1})):E(``,!0)]),o.value===null?(c(),W(`p`,GLe,U(z(r)(`firstRun.connect.skipHint`)),1)):E(``,!0)])):a.value===`model`?(c(),W(`section`,KLe,[F(`h1`,null,U(z(r)(`firstRun.model.title`)),1),F(`p`,qLe,U(z(r)(`firstRun.model.connected`,{provider:b.value,count:m.value.length},m.value.length))+` `+U(z(r)(`firstRun.model.subtitle`)),1),m.value.length===0?(c(),W(`p`,JLe,U(z(r)(`firstRun.model.none`)),1)):(c(),W(`ul`,YLe,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`li`,{key:e.id},[F(`button`,{type:`button`,class:V([`first-run__model`,{"is-selected":l.value===e.id}]),"data-testid":`first-run-model-${e.id}`,onClick:t=>l.value=e.id},[t[9]||=F(`span`,{class:`first-run__radio`,"aria-hidden":`true`},null,-1),F(`span`,ZLe,U(e.id),1),e.id===h.value?(c(),W(`span`,QLe,U(z(r)(`firstRun.model.recommended`)),1)):E(``,!0),F(`span`,$Le,U(Math.round(e.maxContextSize/1e3))+`K`,1)],10,XLe)]))),128))])),g.value.length>5?(c(),P(YT,{key:2,variant:`ghost`,size:`sm`,onClick:t[5]||=e=>u.value=!u.value},{default:B(()=>[K(U(u.value?z(r)(`firstRun.model.showFewer`):z(r)(`firstRun.model.showAll`,{count:g.value.length})),1)]),_:1})):E(``,!0),F(`div`,eRe,[v(YT,{variant:`secondary`,onClick:t[6]||=e=>a.value=`connect`},{default:B(()=>[K(U(z(r)(`firstRun.back`)),1)]),_:1}),t[10]||=F(`span`,{class:`first-run__spacer`},null,-1),v(YT,{variant:`primary`,loading:d.value,disabled:!S.value,"data-testid":`first-run-model-continue`,onClick:w},{default:B(()=>[K(U(z(r)(`firstRun.continue`)),1)]),_:1},8,[`loading`,`disabled`])])])):(c(),W(`section`,tRe,[F(`h1`,null,U(z(r)(`firstRun.appearance.title`)),1),F(`p`,nRe,U(z(r)(`firstRun.appearance.subtitle`)),1),v(V9,{embedded:``,onComplete:T,onSkip:T}),F(`p`,rRe,[v(X,{name:`circle-check`,size:`sm`}),F(`span`,null,U(z(r)(`firstRun.appearance.ready`,{model:l.value??``})),1)]),F(`div`,iRe,[v(YT,{variant:`secondary`,onClick:t[7]||=e=>a.value=`model`},{default:B(()=>[K(U(z(r)(`firstRun.back`)),1)]),_:1}),t[11]||=F(`span`,{class:`first-run__spacer`},null,-1),v(YT,{variant:`primary`,"data-testid":`first-run-finish`,onClick:T},{default:B(()=>[K(U(z(r)(`firstRun.appearance.finish`)),1)]),_:1})])]))])],8,ELe))}}),[[`__scopeId`,`data-v-23e77d0d`]]),oRe={class:`recovery`},sRe={class:`recovery__inner`},cRe={class:`recovery__mark`,"aria-hidden":`true`},lRe={class:`recovery__copy`},uRe={class:`recovery__options`},dRe={class:`recovery__option-name`},fRe={class:`recovery__option-desc`},pRe={class:`recovery__option-name`},mRe={class:`recovery__option-desc`},hRe={class:`recovery__actions`},gRe=Y(G({__name:`Recovery`,emits:[`openProviders`,`dismiss`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=D7(),a=L(()=>i.providers.value??[]),o=L(()=>a.value[0]),s=L(()=>a.value.length===0?`noProvider`:a.value.some(e=>e.status===`connected`)?`noModel`:`credential`),l=L(()=>s.value===`noProvider`?r(`recovery.noProvider`):r(`recovery.${s.value}`,{provider:o.value?.id??``}));async function u(){await i.refreshRuntimeState()}return(e,t)=>(c(),W(`section`,oRe,[F(`div`,sRe,[F(`span`,cRe,[v(X,{name:`alert-triangle`,size:`md`})]),F(`div`,lRe,[F(`h1`,null,U(z(r)(`recovery.title`)),1),F(`p`,null,U(l.value),1)]),F(`div`,uRe,[s.value===`noProvider`?E(``,!0):(c(),W(`button`,{key:0,type:`button`,class:`recovery__option is-primary`,"data-testid":`recovery-open-providers`,onClick:t[0]||=e=>n(`openProviders`)},[F(`span`,dRe,U(z(r)(`recovery.fixProvider`)),1),F(`span`,fRe,U(z(r)(`recovery.fixProviderDesc`)),1)])),F(`button`,{type:`button`,class:V([`recovery__option`,{"is-primary":s.value===`noProvider`}]),"data-testid":`recovery-add-provider`,onClick:t[1]||=e=>n(`openProviders`)},[F(`span`,pRe,U(z(r)(`recovery.addProvider`)),1),F(`span`,mRe,U(z(r)(`recovery.addProviderDesc`)),1)],2)]),F(`div`,hRe,[v(YT,{variant:`secondary`,"data-testid":`recovery-retry`,onClick:u},{default:B(()=>[K(U(z(r)(`recovery.retry`)),1)]),_:1}),v(YT,{variant:`ghost`,"data-testid":`recovery-dismiss`,onClick:t[2]||=e=>n(`dismiss`)},{default:B(()=>[K(U(z(r)(`recovery.dismiss`)),1)]),_:1})])])]))}}),[[`__scopeId`,`data-v-68311778`]]),_Re=[`aria-label`],vRe={class:`gload-box`},yRe={class:`gload-text`},bRe={key:0,class:`gload-stage`},xRe={key:1,class:`gload-issue-title`},SRe={key:2,class:`gload-issue-detail`},CRe=Y(G({__name:`GlobalLoading`,props:{stage:{},retries:{},issue:{}},setup(e){let t=e,{t:n}=J(),r=L(()=>{switch(t.stage){case`auth`:return n(`app.connectingStageAuth`);case`server`:return n(`app.connectingStageServer`);case`config`:return n(`app.connectingStageConfig`);case`sessions`:return n(`app.connectingStageSessions`);case`session`:return n(`app.connectingStageSession`);default:return``}}),i=L(()=>{let e=r.value;if(!e)return``;let i=t.retries??0;return i<=0?e:e+n(`app.connectingRetrySuffix`,{n:i})}),a=L(()=>{let e=t.issue;if(e==null||e===``)return``;if(typeof e==`string`)return n(`app.connectRetrying`);switch(e.kind){case`network`:return n(`app.connectingIssueNetworkTitle`);case`timeout`:return n(`app.connectingIssueTimeoutTitle`);case`api`:return n(`app.connectingIssueApiTitle`);case`unknown`:return n(`app.connectingIssueUnknownTitle`);default:return n(`app.connectRetrying`)}}),o=L(()=>{let e=t.issue;if(e==null||e===``)return``;if(typeof e==`string`)return e;switch(e.kind){case`network`:return n(`app.connectingIssueNetworkMessage`);case`timeout`:return n(`app.connectingIssueTimeoutMessage`);case`api`:case`unknown`:return e.message;default:return``}});return(e,t)=>(c(),W(`div`,{class:`gload`,role:`status`,"aria-label":z(n)(`app.connecting`)},[F(`div`,vRe,[t[0]||=F(`img`,{class:`gload-logo`,src:`/logo.png`,alt:`Pythinker`,width:`120`,height:`120`},null,-1),v(np,{size:`md`,label:z(n)(`app.connecting`)},null,8,[`label`]),F(`div`,yRe,[F(`div`,null,U(z(n)(`app.connecting`)),1),i.value?(c(),W(`div`,bRe,U(i.value),1)):E(``,!0),a.value?(c(),W(`div`,xRe,U(a.value),1)):E(``,!0),o.value?(c(),W(`div`,SRe,U(o.value),1)):E(``,!0)])])],8,_Re))}}),[[`__scopeId`,`data-v-82055ab9`]]),wRe={class:`kap-root`},TRe={class:`kap-head`},ERe={class:`kap-count`},DRe={class:`kap-head-actions`},ORe={class:`kap-filters`},kRe=[`value`],ARe={class:`kap-check`},jRe={class:`kap-check`},MRe={class:`kap-view-toggle`,role:`group`},NRe={key:0,class:`kap-empty`},PRe=[`onClick`],FRe={class:`kap-ts`},IRe={class:`kap-label`},LRe={key:0,class:`kap-detail`},RRe={class:`kap-detail-actions`},zRe=[`onClick`],BRe={key:1,class:`kap-agg`},VRe={class:`mono`},HRe={class:`mono`},URe={class:`num`},WRe={class:`num`},GRe={key:0},KRe={class:`mono`},qRe={class:`num`},JRe={class:`num`},YRe={key:0},XRe=Y(G({__name:`KapDebugView`,emits:[`close`],setup(e,{emit:t}){let r=t,i=R(`all`),a=R(``),o=R(``),u=R(!1),d=R(`timeline`),f=L(()=>(xx.value,[...Cx()])),p=L(()=>{let e=new Set;for(let t of f.value)t.sessionId&&e.add(t.sessionId);return[...e].sort()});function m(e){return e.kind===`rest:error`||e.code!==void 0&&e.code!==0||e.eventType===`error`||e.eventType===`parse-error`}let h=L(()=>{let e=a.value.trim().toLowerCase();return f.value.filter(t=>!(i.value!==`all`&&t.source!==i.value||o.value&&t.sessionId!==o.value||u.value&&!m(t)||e&&!`${t.label} ${t.kind} ${t.eventType??``} ${t.sessionId??``} ${t.requestId??``}`.toLowerCase().includes(e)))}),g=L(()=>{let e=new Map;for(let t of h.value){if(t.kind!==`ws:in`&&t.kind!==`ws:out`)continue;let n=t.kind===`ws:in`?`←`:`→`,r=`${n} ${t.eventType??`?`} @ ${t.sessionId??`-`}`,i=e.get(r)??{key:r,sessionId:t.sessionId??`-`,eventType:t.eventType??`?`,dir:n,count:0};i.count++,t.seq!==void 0&&(i.lastSeq=t.seq),e.set(r,i)}return[...e.values()].sort((e,t)=>t.count-e.count)}),y=L(()=>{let e=new Map;for(let t of h.value){if(t.source!==`rest`||t.kind===`rest:request`)continue;let n=`${t.method??`?`} ${t.path??`?`}`,r=e.get(n)??{count:0,errors:0,totalMs:0,timed:0};r.count++,m(t)&&r.errors++,t.durationMs!==void 0&&(r.totalMs+=t.durationMs,r.timed++),e.set(n,r)}return[...e.entries()].map(([e,t])=>({key:e,count:t.count,errors:t.errors,avgMs:t.timed>0?Math.round(t.totalMs/t.timed):0})).sort((e,t)=>t.count-e.count)}),b=R(null),x=R(!0),S=R(null),C=R(null);s(()=>h.value.length,async()=>{if(!x.value||d.value!==`timeline`)return;await n();let e=S.value;e&&(e.scrollTop=e.scrollHeight)});function w(e){b.value=b.value===e?null:e}function T(e){let t=new Date(e),n=(e,t=2)=>String(e).padStart(t,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`}function O(e){return JSON.stringify(e,null,2)}async function k(e){await Wi(O(e))&&(C.value=e.id,setTimeout(()=>{C.value===e.id&&(C.value=null)},1500))}function A(){Gx(h.value)}function j(e){return m(e)||e.source===`client`?`b-err`:e.source===`rest`?`b-rest`:e.kind===`ws:lifecycle`?`b-life`:e.kind===`ws:out`?`b-out`:`b-in`}function N(e){return e.source===`rest`?`REST`:e.source===`client`?`APP`:`WS`}return(e,t)=>(c(),W(`section`,wRe,[F(`header`,TRe,[t[11]||=F(`strong`,null,`KAP debug`,-1),F(`span`,ERe,U(h.value.length)+`/`+U(f.value.length),1),F(`div`,DRe,[F(`button`,{type:`button`,class:V({on:z(Sx)}),onClick:t[0]||=e=>Sx.value=!z(Sx)},U(z(Sx)?`resume`:`pause`),3),F(`button`,{type:`button`,onClick:t[1]||=e=>z(wx)()},`clear`),F(`button`,{type:`button`,onClick:t[2]||=e=>A()},`export jsonl`),v(vp,{text:`Close window`},{default:B(()=>[F(`button`,{type:`button`,onClick:t[3]||=e=>r(`close`)},`✕`)]),_:1})])]),F(`div`,ORe,[l(F(`select`,{"onUpdate:modelValue":t[4]||=e=>i.value=e,"aria-label":`Source filter`},[...t[12]||=[F(`option`,{value:`all`},`rest + ws + app`,-1),F(`option`,{value:`rest`},`rest`,-1),F(`option`,{value:`ws`},`ws`,-1),F(`option`,{value:`client`},`app errors`,-1)]],512),[[se,i.value]]),l(F(`select`,{"onUpdate:modelValue":t[5]||=e=>o.value=e,"aria-label":`Session filter`},[t[13]||=F(`option`,{value:``},`all sessions`,-1),(c(!0),W(M,null,_(p.value,e=>(c(),W(`option`,{key:e,value:e},U(e),9,kRe))),128))],512),[[se,o.value]]),l(F(`input`,{"onUpdate:modelValue":t[6]||=e=>a.value=e,type:`text`,placeholder:`filter (type / path / id)`,"aria-label":`Text filter`},null,512),[[de,a.value]]),F(`label`,ARe,[l(F(`input`,{"onUpdate:modelValue":t[7]||=e=>u.value=e,type:`checkbox`},null,512),[[D,u.value]]),t[14]||=K(` errors`,-1)]),F(`label`,jRe,[l(F(`input`,{"onUpdate:modelValue":t[8]||=e=>x.value=e,type:`checkbox`},null,512),[[D,x.value]]),t[15]||=K(` follow`,-1)]),F(`div`,MRe,[F(`button`,{type:`button`,class:V({on:d.value===`timeline`}),onClick:t[9]||=e=>d.value=`timeline`},`timeline`,2),F(`button`,{type:`button`,class:V({on:d.value===`aggregate`}),onClick:t[10]||=e=>d.value=`aggregate`},`aggregate`,2)])]),d.value===`timeline`?(c(),W(`div`,{key:0,ref_key:`listRef`,ref:S,class:`kap-list`},[h.value.length===0?(c(),W(`div`,NRe,` No trace entries yet. REST calls and WS frames will appear here. `)):E(``,!0),(c(!0),W(M,null,_(h.value,e=>(c(),W(`div`,{key:e.id,class:`kap-row-wrap`},[F(`button`,{type:`button`,class:V([`kap-row`,{expanded:b.value===e.id}]),onClick:t=>w(e.id)},[F(`span`,FRe,U(T(e.ts)),1),F(`span`,{class:V([`kap-badge`,j(e)])},U(N(e)),3),F(`span`,IRe,U(e.label),1)],10,PRe),b.value===e.id?(c(),W(`div`,LRe,[F(`div`,RRe,[F(`button`,{type:`button`,onClick:t=>k(e)},U(C.value===e.id?`copied ✓`:`copy json`),9,zRe)]),F(`pre`,null,U(O(e)),1)])):E(``,!0)]))),128))],512)):(c(),W(`div`,BRe,[t[20]||=F(`h4`,null,`WS frames by session / type`,-1),F(`table`,null,[t[17]||=F(`thead`,null,[F(`tr`,null,[F(`th`,null,`dir`),F(`th`,null,`type`),F(`th`,null,`session`),F(`th`,null,`count`),F(`th`,null,`last seq`)])],-1),F(`tbody`,null,[(c(!0),W(M,null,_(g.value,e=>(c(),W(`tr`,{key:e.key},[F(`td`,null,U(e.dir),1),F(`td`,VRe,U(e.eventType),1),F(`td`,HRe,U(e.sessionId),1),F(`td`,URe,U(e.count),1),F(`td`,WRe,U(e.lastSeq??`—`),1)]))),128)),g.value.length===0?(c(),W(`tr`,GRe,[...t[16]||=[F(`td`,{colspan:`5`,class:`kap-empty`},`no ws frames`,-1)]])):E(``,!0)])]),t[21]||=F(`h4`,null,`REST by endpoint`,-1),F(`table`,null,[t[19]||=F(`thead`,null,[F(`tr`,null,[F(`th`,null,`endpoint`),F(`th`,null,`count`),F(`th`,null,`errors`),F(`th`,null,`avg ms`)])],-1),F(`tbody`,null,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`tr`,{key:e.key},[F(`td`,KRe,U(e.key),1),F(`td`,qRe,U(e.count),1),F(`td`,{class:V([`num`,{err:e.errors>0}])},U(e.errors),3),F(`td`,JRe,U(e.avgMs),1)]))),128)),y.value.length===0?(c(),W(`tr`,YRe,[...t[18]||=[F(`td`,{colspan:`4`,class:`kap-empty`},`no rest calls`,-1)]])):E(``,!0)])])]))]))}}),[[`__scopeId`,`data-v-7bab00af`]]),ZRe=Y(G({__name:`DebugPanel`,setup(e){let t=R(!1),n=null,r=null,i=null,a=[`data-color-scheme`,`data-accent`];function o(e){let t=document.documentElement,n=e.documentElement;for(let e of a){let r=t.getAttribute(e);r===null?n.removeAttribute(e):n.setAttribute(e,r)}}function s(e){let t=e.document;t.title=`KAP debug`;let n=t.createElement(`base`);n.href=location.href,t.head.appendChild(n);for(let e of Array.from(document.querySelectorAll(`style, link[rel="stylesheet"]`)))t.head.appendChild(e.cloneNode(!0));o(t),t.body.style.margin=`0`;let r=t.createElement(`div`);return r.style.height=`100vh`,t.body.appendChild(r),r}function l(){i?.disconnect(),i=null;try{r?.unmount()}catch{}r=null,n=null,t.value=!1}function u(){if(n&&!n.closed){n.focus();return}let e=window.open(``,`kap-debug`,`popup=yes,width=1040,height=760`);if(!e)return;n=e;let c=s(e),u=I(XRe,{onClose:()=>e.close()});u.mount(c),r=u,t.value=!0,i=new MutationObserver(()=>{n&&!n.closed&&o(n.document)}),i.observe(document.documentElement,{attributes:!0,attributeFilter:[...a]}),e.addEventListener(`pagehide`,l),e.addEventListener(`beforeunload`,l)}return p(()=>{u()}),ne(()=>{n&&!n.closed&&n.close(),l()}),(e,n)=>(c(),P(vp,{text:t.value?`Focus KAP debug window`:`Open KAP debug window`},{default:B(()=>[F(`button`,{class:`kap-fab`,type:`button`,onClick:u},` KAP `)]),_:1},8,[`text`]))}}),[[`__scopeId`,`data-v-992ae84c`]]);function QRe({client:e}){let t=L(()=>e.appState.value===`first-run`||e.appState.value===`recovery`),n=`/login`,r=R(null);function i(){return typeof window>`u`?`/`:`${window.location.pathname}${window.location.search}${window.location.hash}`}function a(e){typeof window>`u`||window.history.replaceState(window.history.state,``,e)}return s(t,e=>{if(!(typeof window>`u`)){if(e){window.location.pathname!==n&&(r.value=i(),a(n));return}window.location.pathname===n&&(a(r.value??`/`),r.value=null)}},{immediate:!0}),{showAuthGate:t}}function $Re({running:e,showAuthGate:t}){let{t:n}=J(),r=L(()=>{let r=e.value?`• `:``;return t.value?`${r}${n(`app.authPageTitle`)} - Pythinker Code Web`:`${r}Pythinker Code Web`});u(()=>{typeof document<`u`&&(document.title=r.value)})}function eze(e,t,n){let r=new Map(e.attachments.map(e=>[e.attachmentId,e])),i=new Map(e.tasks.map(e=>[e.taskId,e])),a=e.items.find(e=>e.kind===`turn`),o=e.items.findLast(e=>e.kind===`turn`);return y8(e.items.flatMap(e=>e.kind===`turn`?tze(e,r,i,{...n,startedAt:e.turnId===a?.turnId?t?.createdAt:void 0,endedAt:e.turnId===o?.turnId?t?.disposedAt:void 0}):[]),[],e=>n.getFileUrl(e),e.meta.activity===`turn`)}function tze(e,t,n,r){let i=[],a=aze([e.startedAt,...e.steps.map(e=>e.startedAt),r.startedAt]),o=H9(e.endedAt)??H9(r.endedAt),s=e.turnId;if(e.prompt!==void 0&&e.prompt.length>0){let n=[{type:`text`,text:e.prompt}];for(let r of e.attachmentIds??[]){let e=rze(t.get(r));e!==void 0&&n.push(e)}i.push({id:`${e.turnId}:input`,sessionId:r.sessionId,role:`user`,content:n,createdAt:a,promptId:s,metadata:{origin:e.origin}})}for(let t of e.steps){let e=H9(t.startedAt)??a;for(let a of t.frames){if(a.kind===`text`){if(a.text.length===0||a.role===`user`&&a.taskId===void 0)continue;i.push({id:a.frameId,sessionId:r.sessionId,role:a.role,content:[{type:`text`,text:a.text}],createdAt:e,promptId:s,metadata:a.taskId===void 0?void 0:{origin:{kind:`task`,taskId:a.taskId},task:n.get(a.taskId),[O4]:nze(a.taskId,a.text,n.get(a.taskId))}});continue}if(a.kind===`thinking`){if(a.text.length===0)continue;i.push({id:a.frameId,sessionId:r.sessionId,role:`assistant`,content:[{type:`thinking`,thinking:a.text,startedAt:e,durationMs:U9(e,H9(t.endedAt))}],createdAt:e,promptId:s});continue}a.kind===`tool`&&(i.push({id:`${a.frameId}:call`,sessionId:r.sessionId,role:`assistant`,content:[{type:`toolUse`,toolCallId:a.toolCallId,toolName:a.name,input:a.input??a.display??{},outputLines:a.state===`running`?ize(a.output):void 0}],createdAt:e,promptId:s}),a.state!==`running`&&i.push({id:`${a.frameId}:result`,sessionId:r.sessionId,role:`tool`,content:[{type:`toolResult`,toolCallId:a.toolCallId,output:a.output??a.error??``,isError:a.state===`error`}],createdAt:H9(t.endedAt)??e,promptId:s}))}}let c=e.durationMs??U9(a,o);if(c!==void 0){let e=i.findLastIndex(e=>e.role===`assistant`);e>=0&&(i[e]={...i[e],durationMs:c})}return i}function nze(e,t,n){if(M4(t).length>0)return;let[r=``,...i]=t.split(` +`),{lang:t,theme:r}):null;if(e!==w)return;b.value=i?.tokens??null}}catch{e===w&&C()}}function A(){if(D!==null)return;let e=Math.max(0,gDe-(Date.now()-T));D=setTimeout(()=>{D=null,k()},e)}s([()=>v.value.join(` +`),()=>y.value?.before??null,()=>y.value?.after??null],A),s([()=>o.path,l,()=>o.fullTexts],()=>{w++,C(),A()}),p(()=>void k()),ne(()=>{w++,D!==null&&clearTimeout(D)});let j=L(()=>{let e=new Map,t=0;for(let n of o.lines??[])n.oldNo!==void 0&&e.set(n.oldNo,t++);return e}),N=L(()=>{let e=new Map,t=0;for(let n of o.lines??[])n.newNo!==void 0&&e.set(n.newNo,t++);return e});function ee(e){if(e.type===`del`){if(e.oldNo===void 0)return null;let t=o.fullTexts?e.oldNo-1:j.value.get(e.oldNo);return t===void 0?null:x.value?.[t]??null}if(e.newNo===void 0)return null;let t=o.fullTexts?e.newNo-1:N.value.get(e.newNo);return t===void 0?null:S.value?.[t]??null}function P(e){return e.type===`add`?`+`:e.type===`del`?`-`:` `}let I=L(()=>{let e=0;if(h.value)for(let t of h.value)t>e&&(e=t);else for(let t of o.lines??[])t.oldNo!==void 0&&t.oldNo>e&&(e=t.oldNo),t.newNo!==void 0&&t.newNo>e&&(e=t.newNo);return Math.max(4,String(e).length)});return(t,n)=>(c(),W(`div`,{class:V([`hl-code`,{gutter:m.value,"plain-pad":!u.value&&h.value===null,framed:e.framed,"responsive-wrap":e.responsiveWrap,"one-gutter":g.value===1,"two-gutters":g.value===2}]),style:ae({"--gutter-ch":`${I.value}ch`})},[F(`div`,lDe,[u.value?(c(!0),W(M,{key:0},_(e.lines,(e,t)=>(c(),W(`div`,{key:t,class:V([`hl-row`,`row-${e.type}`])},[m.value?(c(),W(M,{key:0},[d.value?(c(),W(`span`,uDe,U(e.oldNo??``),1)):E(``,!0),f.value?(c(),W(`span`,{key:1,class:V([`hl-gutter new`,{offset:d.value}])},U(e.newNo??``),3)):E(``,!0)],64)):E(``,!0),F(`span`,dDe,U(P(e)),1),F(`span`,fDe,[ee(e)?(c(!0),W(M,{key:0},_(ee(e),(e,t)=>(c(),W(`span`,{key:t,style:ae(a(e))},U(e.content),5))),128)):(c(),W(M,{key:1},[K(U(e.text),1)],64))])],2))),128)):(c(!0),W(M,{key:1},_(v.value,(t,n)=>(c(),W(`div`,{key:n,class:V([`hl-row`,e.lineClass?e.lineClass(h.value?.[n]??-1):void 0]),"data-line":h.value?h.value[n]:void 0},[h.value?(c(),W(`span`,mDe,U(h.value[n]??``),1)):E(``,!0),F(`span`,hDe,[b.value&&b.value[n]?(c(!0),W(M,{key:0},_(b.value[n],(e,t)=>(c(),W(`span`,{key:t,style:ae(a(e))},U(e.content),5))),128)):(c(),W(M,{key:1},[K(U(t),1)],64))])],10,pDe))),128))])],6))}}),[[`__scopeId`,`data-v-4b6e3ce1`]]),_De={class:`turn-diff-panel`},vDe={class:`tdp-body`},yDe={class:`tdp-file-head`},bDe={class:`tdp-path`},xDe={key:0,class:`tdp-diff`},SDe={key:1,class:`tdp-unavailable`},CDe=Y(G({__name:`TurnDiffPanel`,props:{changes:{},cwd:{}},emits:[`close`,`openFile`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J();function a(e,t){if(!t)return null;let n=e=>e.replaceAll(`\\`,`/`),r=n(e),i=n(t);i.length>1&&(i=i.replace(/\/+$/,``));let a=/^[a-z]:\//i.test(i)||/^[a-z]:\//i.test(r)||i.startsWith(`//`)||r.startsWith(`//`),o=a?i.toLowerCase():i,s=a?r.toLowerCase():r,c=o.endsWith(`/`)?o:`${o}/`;if(s!==o&&!s.startsWith(c))return null;let l=s===o?``:r.slice(c.length);return l.split(`/`).includes(`..`)?null:l||null}function o(e,t=48){return!e||e.length<=t?e:`…`+e.slice(e.length-t+1)}function s(e){return a(e.path,n.cwd)??e.path}return(t,n)=>(c(),W(`div`,_De,[v($7,{title:z(i)(`conversation.turnFiles.diffTitle`),onClose:n[0]||=e=>r(`close`)},null,8,[`title`]),F(`div`,vDe,[(c(!0),W(M,null,_(e.changes,e=>(c(),W(`section`,{key:e.path,class:`tdp-file`},[F(`div`,yDe,[v(Sp,{text:e.path},{default:B(()=>[F(`span`,bDe,U(o(s(e))),1)]),_:2},1032,[`text`]),v(pD,{variant:`ghost`,size:`sm`,onClick:t=>r(`openFile`,{path:e.path})},{default:B(()=>[K(U(z(i)(`conversation.turnFiles.openFile`)),1)]),_:1},8,[`onClick`])]),e.diff?(c(),W(`div`,xDe,[v(C9,{lines:e.diff,path:e.path,framed:!1},null,8,[`lines`,`path`])])):(c(),W(`div`,SDe,[F(`p`,null,U(z(i)(`conversation.turnFiles.diffUnavailable`)),1),v(pD,{variant:`ghost`,size:`sm`,onClick:t=>r(`openFile`,{path:e.path})},{default:B(()=>[K(U(z(i)(`conversation.turnFiles.openFile`)),1)]),_:1},8,[`onClick`])]))]))),128))])]))}}),[[`__scopeId`,`data-v-67a3cc7e`]]),wDe=[`aria-label`],w9=Y(G({__name:`ThinkingIndicator`,props:{size:{default:`md`},fast:{type:Boolean},label:{default:`Waiting for response…`}},setup(e){let t=c6.length*80;function n(e){return{"--thinking-frame-delay":`${e*80-t}ms`,"--thinking-frame-fast-delay":`${80/2*e-t/2}ms`}}return(t,r)=>(c(),W(`span`,{class:V([`ui-thinking-indicator`,[`ui-thinking-indicator--${e.size}`,{"ui-thinking-indicator--fast":e.fast}]]),"aria-label":e.label,role:`status`},[(c(!0),W(M,null,_(z(c6),(e,t)=>(c(),W(`span`,{key:e,class:`ui-thinking-indicator__frame`,style:ae(n(t)),"aria-hidden":`true`},U(e),5))),128))],10,wDe))}}),[[`__scopeId`,`data-v-ed8aef9e`]]),TDe={class:`sc`},EDe={key:0,class:`sc-empty`},DDe={key:2,class:`sc-loading`,"aria-hidden":`true`},ODe={class:`sc-composer`},kDe=[`placeholder`],ADe=[`disabled`],jDe=Y(G({__name:`SideChatPanel`,props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:[`send`,`close`],setup(e,{expose:t,emit:r}){let i=e,a=r,{t:o}=J(),u=L(()=>i.turns.find(e=>e.role===`user`)?.text?.trim()??``),d=L(()=>i.title?.trim()||o(`sideChat.title`)),f=L(()=>i.subtitle?.trim()?i.subtitle.trim():u.value||o(`sideChat.subtitle`)),p=R(``),m=R(null),h=R(null);function g(){let e=p.value.trim();e&&(a(`send`,e),p.value=``,n(()=>{m.value&&(m.value.style.height=`auto`),_()}))}function _(){let e=h.value;e&&(e.scrollTop=e.scrollHeight)}s(L(()=>{let e=i.turns;if(e.length===0)return`0`;let t=e.at(-1),n=t.thinking?.length??0,r=t.tools?.reduce((e,t)=>e+t.name.length+(t.arg?.length??0)+(t.output?.join(``).length??0),0)??0;return`${e.length}:${t.text.length}:${n}:${r}`}),async()=>{!i.running&&!i.sending||(await n(),_())});let y=L(()=>i.sending?i.turns.at(-1)?.role===`user`:!1);function b(e){e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),g())}function x(){let e=m.value;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)}function S(){m.value?.focus()}return t({focusInput:S}),(t,n)=>(c(),W(`div`,TDe,[v($7,{title:d.value,subtitle:f.value,"close-label":z(o)(`thinking.close`),onClose:n[0]||=e=>a(`close`)},null,8,[`title`,`subtitle`,`close-label`]),F(`div`,{ref_key:`bodyRef`,ref:h,class:`sc-body`},[e.turns.length===0?(c(),W(`div`,EDe,U(z(o)(`sideChat.empty`)),1)):(c(),P(J4,{key:1,turns:e.turns,approvals:[],"turn-active":e.running,working:e.sending||e.running},null,8,[`turns`,`turn-active`,`working`])),y.value?(c(),W(`div`,DDe,[v(w9)])):E(``,!0)],512),F(`div`,ODe,[l(F(`textarea`,{ref_key:`inputRef`,ref:m,"onUpdate:modelValue":n[1]||=e=>p.value=e,class:`sc-input`,rows:`1`,placeholder:z(o)(`sideChat.placeholder`),onInput:x,onKeydown:b},null,40,kDe),[[de,p.value]]),v(Sp,{text:z(o)(`sideChat.send`)},{default:B(()=>[F(`button`,{type:`button`,class:`sc-send`,disabled:!p.value.trim(),onClick:g},[v(X,{name:`arrow-right`,size:`sm`})],8,ADe)]),_:1},8,[`text`])])]))}}),[[`__scopeId`,`data-v-130e8cd2`]]),MDe={class:`changes-pane`},NDe={class:`dv-path`},PDe={class:`diff-head`},FDe={class:`back-label`},IDe={key:`loading`,class:`empty-state diff-loading`},LDe={key:`empty`,class:`empty-state`},RDe={class:`dv-change-count`},zDe={class:`ch-head`},BDe={class:`br-label`},VDe={class:`br-name`},HDe={key:0,class:`sync-info`},UDe={key:0,class:`ahead`},WDe={key:0,class:`behind`},GDe={key:1,class:`empty-head`},KDe={key:0,class:`ch-list`},qDe=[`onClick`],JDe={class:`fpath`},YDe={key:1,class:`ch-list ch-tree`},XDe={class:`tree-list`},ZDe=[`onClick`],QDe={class:`tree-name`},$De=[`onClick`],eOe={class:`tree-name`},tOe={key:2,class:`empty-state`},nOe={key:3,class:`empty-state`},rOe=Y(G({__name:`DiffView`,props:{changes:{},gitInfo:{},fileDiff:{},fullTexts:{default:null},emptyFile:{type:Boolean,default:!1},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:`full`},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:[`open`,`back`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=R(!0);function a(){i.value=!i.value}let o=t;function l(e){let t=e.toLowerCase();return t===`modified`?`modified`:t===`added`?`added`:t===`deleted`?`deleted`:t===`renamed`?`renamed`:t===`untracked`?`untracked`:t===`conflicted`?`conflicted`:t===`ignored`?`ignored`:t===`clean`?`clean`:`unknown`}let u={modified:`M`,added:`+`,deleted:`−`,renamed:`→`,untracked:`+`,conflicted:`C`,ignored:`I`,clean:`·`,unknown:`?`};function d(e){return u[l(e)]??`?`}function f(e,t=60){return e.length<=t?e:`…`+e.slice(e.length-t+1)}let p=L(()=>r.gitInfo!==null),m=L(()=>r.changes.length>0),h=L(()=>(r.selectedDiffPath??null)!==null),g=L(()=>r.mode===`detail`||r.mode===`full`&&h.value),y=L(()=>r.fileDiff??[]),b=L(()=>r.fileDiffLoading===!0),x=R(null);s([()=>r.selectedDiffPath,b],([,e])=>{!e&&x.value&&(x.value.scrollLeft=0)},{flush:`post`});function S(e){o(`open`,e)}function C(){o(`back`)}function w(){o(`close`)}let T=R(`list`);function D(e){T.value=e}function O(e){let t={name:``,path:``,kind:`folder`,children:[]},n=[...e].sort((e,t)=>e.path.localeCompare(t.path));for(let e of n){let n=e.path.split(`/`),r=t;for(let t=0;te.name===i&&e.kind===(a?`file`:`folder`));s||(s={name:i,path:o,kind:a?`file`:`folder`,status:a?e.status:void 0,children:[]},r.children.push(s)),r=s}}return t.children}let k=L(()=>O(r.changes)),A=R(new Set);function j(e){return!A.value.has(e)}let N=L(()=>{let e=[];function t(n,r){for(let i of n)e.push({node:i,depth:r}),i.kind===`folder`&&j(i.path)&&t(i.children,r+1)}return t(k.value,0),e});function ee(e){let t=new Set(A.value);t.has(e.path)?t.delete(e.path):t.add(e.path),A.value=t}function I(e){return`${16+e*16}px`}return(t,r)=>(c(),W(`div`,MDe,[g.value?(c(),W(M,{key:0},[v($7,{title:z(n)(`diff.title`),closable:e.closable,"close-label":z(n)(`diff.close`),onClose:w},{default:B(()=>[v(Sp,{text:e.selectedDiffPath??``},{default:B(()=>[F(`span`,NDe,U(f(e.selectedDiffPath??``,50)),1)]),_:1},8,[`text`]),v(Sp,{text:i.value?z(n)(`conversation.unwrapCode`):z(n)(`conversation.wrapCode`)},{default:B(()=>[v(Ca,{size:`sm`,label:i.value?z(n)(`conversation.unwrapCode`):z(n)(`conversation.wrapCode`),"aria-pressed":i.value,onClick:a},{default:B(()=>[v(X,{name:i.value?`text-wrap-disabled`:`text-wrap`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`,`aria-pressed`])]),_:1},8,[`text`])]),_:1},8,[`title`,`closable`,`close-label`]),F(`div`,PDe,[e.hideBack?E(``,!0):(c(),P(pD,{key:0,variant:`ghost`,size:`sm`,onClick:C},{default:B(()=>[r[0]||=F(`span`,{"aria-hidden":`true`},`←`,-1),F(`span`,FDe,U(z(n)(`diff.back`)),1)]),_:1}))]),v(oe,{name:`diff-content`,mode:`out-in`},{default:B(()=>[b.value?(c(),W(`div`,IDe,[v(op,{size:`md`}),F(`span`,null,U(z(n)(`diff.loading`)),1)])):y.value.length>0?(c(),W(`div`,{key:`lines`,ref_key:`diffScrollRef`,ref:x,class:`dv-lines-wrap`},[v(C9,{lines:y.value,path:e.selectedDiffPath??void 0,"line-numbers":!0,framed:!1,"full-texts":e.fullTexts,"responsive-wrap":i.value},null,8,[`lines`,`path`,`full-texts`,`responsive-wrap`])],512)):(c(),W(`div`,LDe,U(e.emptyFile?z(n)(`diff.emptyFile`):z(n)(`diff.noDiff`)),1))]),_:1})],64)):(c(),W(M,{key:1},[v($7,{title:z(n)(`diff.title`),closable:e.closable,"close-label":z(n)(`diff.close`),onClose:w},{default:B(()=>[F(`span`,RDe,U(z(n)(e.changes.length===1?`diff.fileCountOne`:`diff.fileCountOther`,{number:e.changes.length})),1),v(o6,{"model-value":T.value,size:`sm`,options:[{value:`list`,label:z(n)(`diff.list`)},{value:`tree`,label:z(n)(`diff.tree`)}],"onUpdate:modelValue":D},null,8,[`model-value`,`options`])]),_:1},8,[`title`,`closable`,`close-label`]),F(`div`,zDe,[p.value?(c(),W(M,{key:0},[F(`span`,BDe,U(z(n)(`diff.branch`)),1),F(`span`,VDe,U(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(c(),W(`span`,HDe,[v(Sp,{text:z(n)(`diff.aheadTitle`)},{default:B(()=>[e.gitInfo.ahead>0?(c(),W(`span`,UDe,`↑`+U(e.gitInfo.ahead),1)):E(``,!0)]),_:1},8,[`text`]),v(Sp,{text:z(n)(`diff.behindTitle`)},{default:B(()=>[e.gitInfo.behind>0?(c(),W(`span`,WDe,`↓`+U(e.gitInfo.behind),1)):E(``,!0)]),_:1},8,[`text`])])):E(``,!0)],64)):(c(),W(`span`,GDe,U(z(n)(`diff.empty`)),1))]),m.value&&T.value===`list`?(c(),W(`div`,KDe,[(c(!0),W(M,null,_(e.changes,e=>(c(),P(Sp,{key:e.path,text:e.path},{default:B(()=>[F(`button`,{type:`button`,class:`ch-row`,onClick:t=>S(e.path)},[F(`span`,{class:V([`badge`,l(e.status)])},U(d(e.status)),3),F(`span`,JDe,U(f(e.path)),1)],8,qDe)]),_:2},1032,[`text`]))),128))])):m.value&&T.value===`tree`?(c(),W(`div`,YDe,[F(`ul`,XDe,[(c(!0),W(M,null,_(N.value,({node:e,depth:t})=>(c(),W(`li`,{key:e.path,class:`tree-node`},[e.kind===`folder`?(c(),W(`button`,{key:0,type:`button`,class:`tree-row tree-folder`,style:ae({paddingLeft:I(t)}),onClick:t=>ee(e)},[v(X,{class:`tree-icon`,name:`folder-solid`,size:`sm`}),F(`span`,QDe,U(e.name),1)],12,ZDe)):(c(),P(Sp,{key:1,text:e.path},{default:B(()=>[F(`button`,{type:`button`,class:`tree-row tree-file`,style:ae({paddingLeft:I(t)}),onClick:t=>S(e.path)},[F(`span`,{class:V([`badge`,l(e.status)])},U(d(e.status)),3),F(`span`,eOe,U(e.name),1)],12,$De)]),_:2},1032,[`text`]))]))),128))])])):p.value?(c(),W(`div`,tOe,U(z(n)(`diff.clean`)),1)):(c(),W(`div`,nOe,U(z(n)(`diff.empty`)),1))],64))]))}}),[[`__scopeId`,`data-v-03a07717`]]),iOe={class:`panel-tab-bar`},aOe=[`data-tab-id`],oOe=[`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],sOe={class:`ptb-t`},cOe=[`aria-label`,`onClick`],lOe={class:`ptb-tail`},uOe=[`disabled`],dOe=[`disabled`],fOe=Y(G({__name:`PanelTabBar`,props:{tabs:{},activeId:{},expanded:{type:Boolean},mobile:{type:Boolean},canOpenDiff:{type:Boolean},canOpenSideChat:{type:Boolean}},emits:[`activate`,`close`,`toggleExpanded`,`hide`,`openDiff`,`openSideChat`],setup(e,{emit:t}){let r=e,i=t,{t:a}=J(),o=R(null),l=R(null),u=R(null),d=R(!1);s(()=>r.activeId,async e=>{e&&(await n(),Array.from(o.value?.querySelectorAll(`[data-tab-id]`)??[]).find(t=>t.dataset.tabId===e)?.scrollIntoView?.({inline:`nearest`,block:`nearest`}))});function f(e){Array.from(o.value?.querySelectorAll(`.ptb-tab-main`)??[])[e]?.focus()}function p(e,t){if(r.tabs.length===0)return;let a;e.key===`ArrowRight`?a=(t+1)%r.tabs.length:e.key===`ArrowLeft`?a=(t-1+r.tabs.length)%r.tabs.length:e.key===`Home`?a=0:e.key===`End`&&(a=r.tabs.length-1),a!==void 0&&(e.preventDefault(),i(`activate`,r.tabs[a].id),n(()=>f(a)))}function m(){d.value=!1,document.removeEventListener(`pointerdown`,g,!0)}function g(e){let t=e.target;u.value?.contains(t)||l.value?.el?.contains(t)||m()}function y(){if(d.value){m();return}d.value=!0,document.addEventListener(`pointerdown`,g,!0),n(()=>u.value?.querySelector(`button:not(:disabled)`)?.focus())}function b(e){m(),i(e===`diff`?`openDiff`:`openSideChat`)}return h(m),(t,n)=>(c(),W(`header`,iOe,[F(`div`,{ref_key:`tabsRef`,ref:o,class:`ptb-tabs`,role:`tablist`},[(c(!0),W(M,null,_(e.tabs,(t,n)=>(c(),W(`div`,{key:t.id,class:V([`ptb-tab`,{on:t.id===e.activeId}]),"data-tab-id":t.id},[F(`button`,{type:`button`,class:`ptb-tab-main`,role:`tab`,"aria-selected":t.id===e.activeId,tabindex:t.id===e.activeId?0:-1,title:t.title,onClick:e=>i(`activate`,t.id),onKeydown:e=>p(e,n)},[v(X,{name:t.icon,size:`sm`},null,8,[`name`]),F(`span`,sOe,U(t.title),1)],40,oOe),v(Sp,{text:z(a)(`panel.closeTab`)},{default:B(()=>[F(`button`,{type:`button`,class:`ptb-x`,"aria-label":z(a)(`panel.closeTab`),onClick:H(e=>i(`close`,t.id),[`stop`])},[v(X,{name:`close`,size:`sm`})],8,cOe)]),_:2},1032,[`text`])],10,aOe))),128))],512),F(`div`,lOe,[v(Ca,{ref_key:`addButtonRef`,ref:l,size:`sm`,label:z(a)(`panel.newTab`),"aria-haspopup":`menu`,"aria-expanded":d.value,onClick:y,onKeydown:[ie(H(y,[`prevent`]),[`down`]),ie(H(y,[`prevent`]),[`up`])]},{default:B(()=>[v(X,{name:`plus`,size:`sm`})]),_:1},8,[`label`,`aria-expanded`,`onKeydown`]),e.tabs.length>0&&!e.mobile?(c(),P(Ca,{key:0,size:`sm`,label:e.expanded?z(a)(`panel.collapse`):z(a)(`panel.expand`),onClick:n[0]||=e=>i(`toggleExpanded`)},{default:B(()=>[v(X,{name:e.expanded?`collapse`:`expand`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])):E(``,!0),v(Ca,{class:`ptb-hide`,size:`sm`,label:z(a)(`panel.hide`),onClick:n[1]||=e=>i(`hide`)},{default:B(()=>[v(X,{name:e.mobile?`close`:`panel-collapse-right`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`]),d.value?(c(),W(`div`,{key:1,ref_key:`addMenuRef`,ref:u,class:`panel-add-menu`,role:`menu`,onKeydown:n[4]||=ie(H(e=>{m(),l.value?.el?.focus()},[`prevent`]),[`esc`])},[F(`button`,{type:`button`,role:`menuitem`,disabled:!e.canOpenSideChat,onClick:n[2]||=e=>b(`sideChat`)},[v(X,{name:`message`,size:`sm`}),F(`span`,null,U(z(a)(`sideChat.title`)),1)],8,uOe),F(`button`,{type:`button`,role:`menuitem`,disabled:!e.canOpenDiff,onClick:n[3]||=e=>b(`diff`)},[v(X,{name:`git-fork`,size:`sm`}),F(`span`,null,U(z(a)(`panel.tabs.diff`)),1)],8,dOe)],544)):E(``,!0)])]))}}),[[`__scopeId`,`data-v-da364eda`]]);function T9(e,t){let r=null;p(()=>{r=typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null,n(()=>{let n=t?.value??e.value;try{n?.focus()}catch{}})}),ne(()=>{let e=r;if(r=null,!(!e||typeof document>`u`||!document.contains(e)))try{e.focus()}catch{}})}var pOe={class:`search-wrap`},mOe={key:0,class:`tab-strip`},hOe={key:1,class:`state-row`},gOe={key:2,class:`state-row unavail`},_Oe={key:3,class:`model-list`},vOe=[`aria-selected`,`onClick`,`onMouseenter`],yOe={class:`check`},bOe={class:`model-main`},xOe={class:`model-name`},SOe={class:`model-id`},COe={key:0,class:`caps`},wOe={class:`model-provider`},TOe={class:`model-ctx`},EOe={key:0,class:`empty`},DOe={class:`footer-hint`},OOe=Y(G({__name:`ModelPicker`,props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:[`select`,`toggle-star`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=i6(),i=L(()=>r.value?P7:Bf),a=L(()=>r.value?{modelValue:!0,title:n(`model.title`),closeOnEsc:!1}:{open:!0,title:n(`model.title`),closeOnEsc:!1,size:`xl`,height:`fixed`}),o=e,l=t,u=L(()=>new Set(o.starredIds??[]));function d(e){return u.value.has(e)}let f=R(``),m=R(null),g=R(null),y=R(`all`);T9(g,m);let b=L(()=>{let e=new Set,t=[{id:`all`,label:n(`model.allTab`)}];for(let n of o.models)e.has(n.provider)||(e.add(n.provider),t.push({id:n.provider,label:n.provider}));return t}),S=L(()=>{let e=f.value.toLowerCase().trim(),t=o.models.filter(t=>{if(y.value!==`all`&&t.provider!==y.value)return!1;let n=(t.displayName??t.model).toLowerCase().includes(e),r=t.provider.toLowerCase().includes(e),i=t.id.toLowerCase().includes(e);return!e||n||r||i});return y.value===`all`?t.sort((e,t)=>{let n=+!!d(e.id);return+!!d(t.id)-n}):t}),C=L(()=>S.value),w=R(0);s([f,y],()=>{w.value=0}),s(b,e=>{e.some(e=>e.id===y.value)||(y.value=`all`)}),s(C,e=>{w.value=Math.min(w.value,Math.max(e.length-1,0))});function T(e){if(e.key===`Escape`){l(`close`);return}if(e.key===`ArrowDown`)e.preventDefault(),w.value=Math.min(w.value+1,C.value.length-1);else if(e.key===`ArrowUp`)e.preventDefault(),w.value=Math.max(w.value-1,0);else if(e.key===`Enter`){let e=C.value[w.value];e&&l(`select`,e.id)}}p(()=>{document.addEventListener(`keydown`,T)}),h(()=>{document.removeEventListener(`keydown`,T)});function D(e){l(`select`,e)}function O(e){return C.value.indexOf(e)}function k(e){y.value=e}let A={image_in:`imageIn`,imageIn:`imageIn`,image_out:`imageOut`,imageOut:`imageOut`,vision:`vision`,video_in:`videoIn`,videoIn:`videoIn`,audio_in:`audioIn`,audioIn:`audioIn`,audio_out:`audioOut`,audioOut:`audioOut`,thinking:`thinking`,always_thinking:`alwaysThinking`,alwaysThinking:`alwaysThinking`,adaptive_thinking:`adaptiveThinking`,adaptiveThinking:`adaptiveThinking`,tool_use:`toolUse`,toolUse:`toolUse`,fast_mode:`fastMode`,fastMode:`fastMode`};function j(e){let t=A[e];return t?n(`model.capabilities.${t}`):n(`model.capabilities.unknown`,{capability:e})}return(t,s)=>(c(),P(x(i.value),re(a.value,{onClose:s[1]||=e=>l(`close`)}),{default:B(()=>[F(`div`,{ref_key:`dialogRef`,ref:g,class:V([`mp`,{"mp--sheet":z(r)}])},[F(`div`,pOe,[v(Fp,{ref_key:`searchRef`,ref:m,modelValue:f.value,"onUpdate:modelValue":s[0]||=e=>f.value=e,placeholder:z(n)(`model.searchPlaceholder`),autocomplete:`off`,spellcheck:`false`,autofocus:``},null,8,[`modelValue`,`placeholder`])]),b.value.length>1?(c(),W(`div`,mOe,[(c(!0),W(M,null,_(b.value,e=>(c(),P(pD,{key:e.id,variant:e.id===y.value?`secondary`:`ghost`,size:`sm`,onClick:t=>k(e.id)},{default:B(()=>[K(U(e.label),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):E(``,!0),e.loading?(c(),W(`div`,hOe,[v(op,{size:`sm`}),F(`span`,null,U(z(n)(`model.loading`)),1)])):e.unavailable?(c(),W(`div`,gOe,[v(X,{name:`alert-triangle`,size:`lg`}),F(`span`,null,U(z(n)(`model.unavailable`)),1)])):(c(),W(`div`,_Oe,[(c(!0),W(M,null,_(C.value,t=>(c(),W(`div`,{key:t.id,class:V([`model-row`,{"is-current":t.id===e.current,"is-selected":O(t)===w.value}]),role:`option`,"aria-selected":t.id===e.current,onClick:e=>D(t.id),onMouseenter:e=>w.value=O(t)},[F(`span`,yOe,[t.id===e.current?(c(),P(X,{key:0,name:`check`,size:`sm`})):E(``,!0)]),F(`span`,bOe,[F(`span`,xOe,U(t.displayName??t.model),1),F(`span`,SOe,U(t.id),1),t.capabilities&&t.capabilities.length>0?(c(),W(`span`,COe,[(c(!0),W(M,null,_(t.capabilities,e=>(c(),P(cp,{key:e,variant:`info`,size:`sm`},{default:B(()=>[K(U(j(e)),1)]),_:2},1024))),128))])):E(``,!0)]),F(`span`,wOe,U(t.provider),1),F(`span`,TOe,U(z(n)(`model.contextSuffix`,{size:z(yO)(t.maxContextSize)})),1),v(Ca,{size:`sm`,label:d(t.id)?z(n)(`model.unstarTitle`):z(n)(`model.starTitle`),onClick:H(e=>l(`toggle-star`,t.id),[`stop`])},{default:B(()=>[d(t.id)?(c(),P(X,{key:0,name:`star`,size:`md`})):(c(),P(X,{key:1,name:`star-outline`,size:`md`}))]),_:2},1032,[`label`,`onClick`])],42,vOe))),128)),C.value.length===0&&!e.loading&&!e.unavailable?(c(),W(`div`,EOe,U(o.models.length===0?z(n)(`model.emptyNoModels`):z(n)(`model.emptyNoMatch`)),1)):E(``,!0)])),F(`div`,DOe,U(z(n)(`model.footerHint`)),1)],2)]),_:1},16))}}),[[`__scopeId`,`data-v-466b8fec`]]),kOe=[`aria-checked`,`aria-label`,`disabled`],E9=Y(G({__name:`Switch`,props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(c(),W(`button`,{class:V([`ui-switch`,{"is-on":e.modelValue}]),type:`button`,role:`switch`,"aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:r[0]||=t=>n(`update:modelValue`,!e.modelValue)},[...r[1]||=[F(`span`,{class:`ui-switch__thumb`},null,-1)]],10,kOe))}}),[[`__scopeId`,`data-v-d7337ade`]]),AOe=[`value`,`disabled`],D9=Y(G({__name:`Select`,props:{modelValue:{},size:{default:`md`},disabled:{type:Boolean},error:{type:Boolean}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;function r(e){n(`update:modelValue`,e.target.value)}return(t,n)=>(c(),W(`select`,{class:V([`ui-select`,[`ui-select--${e.size}`,{"has-error":e.error}]]),value:e.modelValue,disabled:e.disabled,onChange:r},[me(t.$slots,`default`,{},void 0,!0)],42,AOe))}}),[[`__scopeId`,`data-v-77d887db`]]),O9=Y(G({__name:`Skeleton`,props:{width:{},height:{},circle:{type:Boolean}},setup(e){return(t,n)=>(c(),W(`span`,{class:V([`ui-skeleton`,{"is-circle":e.circle}]),style:ae({width:e.width??`100%`,height:e.height??`12px`}),"aria-hidden":`true`},null,6))}}),[[`__scopeId`,`data-v-f4989189`]]),jOe=[`pythinker`,`openai`,`openai_responses`,`anthropic`,`google-genai`,`vertexai`],MOe=/^[\p{L}\p{N}][\p{L}\p{N}\-_ ]*$/u;function k9(){return{model:``,maxContextSize:``,displayName:``}}function A9(){return{id:``,type:`openai`,apiKey:``,baseUrl:``,models:[k9()]}}function NOe(e,t){let n=[];for(let r of Object.values(t??{})){if(typeof r!=`object`||!r)continue;let t=r;t.provider===e.id&&n.push({model:typeof t.model==`string`?t.model:``,maxContextSize:typeof t.maxContextSize==`number`?String(t.maxContextSize):``,displayName:typeof t.displayName==`string`?t.displayName:``})}if(n.length>0)return n;let r=`${e.id}/`;return(e.models??[]).map(e=>({model:e.startsWith(r)?e.slice(r.length):e,maxContextSize:``,displayName:``}))}function POe(e,t={}){let n={models:{}},r=e.id.trim();return r===``?n.id=`idRequired`:MOe.test(r)||(n.id=`idInvalid`),t.apiKey===!0&&e.apiKey.trim()===``&&(n.apiKey=`apiKeyRequired`),t.baseUrl===!0&&e.baseUrl.trim()===``&&(n.baseUrl=`baseUrlRequired`),e.models.length===0&&(n.modelsEmpty=`modelRequired`),e.models.forEach((e,t)=>{let r={};e.model.trim()===``&&(r.model=`modelRequired`);let i=e.maxContextSize.trim(),a=Number(i);i===``?r.maxContextSize=`contextSizeRequired`:(!/^\d+$/.test(i)||!Number.isSafeInteger(a)||a<1)&&(r.maxContextSize=`contextSizeInvalid`),(r.model!==void 0||r.maxContextSize!==void 0)&&(n.models[t]=r)}),n}function FOe(e){return e.id!==void 0||e.apiKey!==void 0||e.baseUrl!==void 0||e.modelsEmpty!==void 0||Object.keys(e.models).length>0}function j9(e){return e.map(e=>({model:e.model.trim(),maxContextSize:Number(e.maxContextSize.trim()),displayName:e.displayName.trim()||void 0}))}function IOe(e){return{id:e.id.trim(),type:e.type,apiKey:e.apiKey.trim()||void 0,baseUrl:e.baseUrl.trim()||void 0,models:j9(e.models)}}function LOe(e,t,n,r){let i=j9(e.models),a=r?.includes(`/`)?r.slice(r.indexOf(`/`)+1):r;return{newId:e.id.trim()===t.id?void 0:e.id.trim(),type:e.type,apiKey:e.apiKey.trim()||(n?``:void 0),baseUrl:e.baseUrl.trim()||void 0,defaultModel:a&&i.some(e=>e.model===a)?a:void 0,models:i}}var ROe={class:`provider-form__fields`},zOe=[`value`],BOe={class:`provider-form__key`},VOe={class:`provider-form__models-head`},HOe=[`aria-expanded`],UOe={class:`provider-form__models-count`},WOe={key:0,class:`provider-form__models`},GOe={class:`provider-form__model provider-form__model--head`},KOe={key:0,class:`provider-form__row-error`,role:`alert`},qOe={key:1,class:`provider-form__error`,role:`alert`},JOe={class:`provider-form__actions`},M9=Y(G({__name:`ProviderForm`,props:{mode:{},provider:{},config:{}},emits:[`dirtyChange`,`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=N(A9()),o=R({models:{}}),l=R(``),u=R(!1),d=R(!1),f=R(n.mode===`add`),m=R(!1),h=R(!1),g=R(!1),y=L(()=>jOe.map(e=>({value:e,label:i(`providers.types.${e}`)})));function b(){let e=n.provider;if(n.mode===`edit`&&e!==void 0){a.id=e.id,a.type=e.type,a.apiKey=``,a.baseUrl=e.baseUrl??``;let t=NOe(e,n.config?.models);a.models=t.length>0?t:[k9()]}else Object.assign(a,A9());o.value={models:{}},l.value=``,m.value=!1,r(`dirtyChange`,!1)}function x(e){let t=o.value[e];return t===void 0?``:i(`providers.error.${t}`)}function S(e,t){let n=o.value.models[e]?.[t];return n===void 0?``:i(`providers.error.${n}`)}function C(e){if(o.value[e]===void 0)return;let{[e]:t,...n}=o.value;o.value={...n,models:o.value.models}}function w(e,t){let n=o.value.models[e];if(n?.[t]===void 0)return;let{[t]:r,...i}=n,{[e]:a,...s}=o.value.models;o.value={...o.value,models:Object.keys(i).length>0?{...s,[e]:i}:s}}async function T(){let e=n.provider;if(!(n.mode!==`edit`||e===void 0||!e.hasApiKey))try{let t=await Q().getProvider(e.id);t.apiKey&&!g.value&&(a.apiKey=t.apiKey,h.value=!0)}catch{h.value=!1}}function D(){m.value=!0,r(`dirtyChange`,!0)}s(()=>n.config,()=>{n.mode===`edit`&&!m.value&&b()});function O(){f.value=!0,a.models.push(k9()),D()}function k(e){a.models.length<=1||(a.models.splice(e,1),o.value={...o.value,models:{}},D())}async function A(){if(u.value)return;let e=POe(a,{apiKey:n.mode===`add`,baseUrl:n.mode===`add`});if(o.value=e,FOe(e)){(Object.keys(e.models).length>0||e.modelsEmpty!==void 0)&&(f.value=!0),l.value=e.modelsEmpty===void 0?``:i(`providers.error.${e.modelsEmpty}`);return}u.value=!0,l.value=``;try{if(n.mode===`add`){let e=await Q().addProvider(IOe(a));r(`dirtyChange`,!1),r(`saved`,e.id);return}let e=n.provider;if(e===void 0)return;let t=await Q().updateProvider(e.id,LOe(a,e,h.value,n.config?.providers[e.id]?.defaultModel));r(`dirtyChange`,!1),r(`saved`,t.provider.id)}catch{l.value=i(`providers.saveFailed`)}finally{u.value=!1}}return p(()=>{b(),T()}),(t,n)=>(c(),W(`form`,{class:`provider-form`,onSubmit:H(A,[`prevent`]),onInput:D},[F(`div`,ROe,[v(O7,{label:z(i)(`providers.fieldId`),error:x(`id`)},{default:B(()=>[v(Fp,{modelValue:a.id,"onUpdate:modelValue":[n[0]||=e=>a.id=e,n[1]||=e=>C(`id`)],autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`])]),_:1},8,[`label`,`error`]),v(O7,{label:z(i)(`providers.fieldType`)},{default:B(()=>[v(D9,{modelValue:a.type,"onUpdate:modelValue":n[2]||=e=>a.type=e},{default:B(()=>[(c(!0),W(M,null,_(y.value,e=>(c(),W(`option`,{key:e.value,value:e.value},U(e.label),9,zOe))),128))]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),v(O7,{label:z(i)(`providers.fieldApiKey`),error:x(`apiKey`)},{default:B(()=>[F(`div`,BOe,[v(Fp,{modelValue:a.apiKey,"onUpdate:modelValue":[n[3]||=e=>a.apiKey=e,n[4]||=e=>{g.value=!0,C(`apiKey`)}],type:d.value?`text`:`password`,placeholder:e.provider?.hasApiKey?z(i)(`providers.apiKeySet`):`sk-…`,autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`,`type`,`placeholder`]),v(Ca,{class:`provider-form__eye`,size:`sm`,label:d.value?z(i)(`providers.hideApiKey`):z(i)(`providers.showApiKey`),onClick:n[5]||=e=>d.value=!d.value},{default:B(()=>[v(X,{name:d.value?`eye-off`:`eye`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),_:1},8,[`label`,`error`]),v(O7,{label:z(i)(`providers.fieldBaseUrl`),error:x(`baseUrl`)},{default:B(()=>[v(Fp,{modelValue:a.baseUrl,"onUpdate:modelValue":[n[6]||=e=>a.baseUrl=e,n[7]||=e=>C(`baseUrl`)],placeholder:z(i)(`providers.baseUrlPlaceholder`),autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`error`])]),F(`div`,VOe,[F(`button`,{type:`button`,class:`provider-form__models-toggle`,"aria-expanded":f.value,"data-testid":`provider-form-models-toggle`,onClick:n[8]||=e=>f.value=!f.value},[v(X,{name:f.value?`chevron-down`:`chevron-right`,size:`sm`},null,8,[`name`]),F(`strong`,null,U(z(i)(`providers.fieldModels`)),1),F(`span`,UOe,U(z(i)(`providers.modelCount`,{count:a.models.length})),1)],8,HOe),v(pD,{type:`button`,size:`sm`,variant:`secondary`,onClick:O},{default:B(()=>[v(X,{name:`plus`,size:`sm`}),K(U(z(i)(`providers.addModel`)),1)]),_:1})]),f.value?(c(),W(`div`,WOe,[F(`div`,GOe,[F(`span`,null,U(z(i)(`providers.colModelId`)),1),F(`span`,null,U(z(i)(`providers.colContext`)),1),F(`span`,null,U(z(i)(`providers.colDisplayName`)),1),n[10]||=F(`span`,null,null,-1)]),(c(!0),W(M,null,_(a.models,(e,t)=>(c(),W(M,{key:t},[F(`div`,{class:V([`provider-form__model`,{"has-error":!!o.value.models[t]}])},[v(Fp,{modelValue:e.model,"onUpdate:modelValue":[t=>e.model=t,e=>w(t,`model`)],placeholder:z(i)(`providers.modelIdPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),v(Fp,{modelValue:e.maxContextSize,"onUpdate:modelValue":[t=>e.maxContextSize=t,e=>w(t,`maxContextSize`)],inputmode:`numeric`,placeholder:z(i)(`providers.modelContextPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),v(Fp,{modelValue:e.displayName,"onUpdate:modelValue":t=>e.displayName=t,placeholder:z(i)(`providers.modelNamePlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),v(Ca,{size:`sm`,disabled:a.models.length<=1,label:z(i)(`providers.removeModel`),onClick:e=>k(t)},{default:B(()=>[v(X,{name:`trash`,size:`sm`})]),_:1},8,[`disabled`,`label`,`onClick`])],2),o.value.models[t]?(c(),W(`div`,KOe,U([S(t,`model`),S(t,`maxContextSize`)].filter(Boolean).join(` · `)),1)):E(``,!0)],64))),128))])):E(``,!0),l.value?(c(),W(`div`,qOe,U(l.value),1)):E(``,!0),F(`div`,JOe,[v(pD,{type:`button`,variant:`secondary`,onClick:n[9]||=e=>r(`cancel`)},{default:B(()=>[K(U(z(i)(`common.cancel`)),1)]),_:1}),v(pD,{type:`submit`,variant:`primary`,loading:u.value},{default:B(()=>[K(U(z(i)(`providers.save`)),1)]),_:1},8,[`loading`])])],32))}}),[[`__scopeId`,`data-v-7ed55f2f`]]),YOe={class:`add-provider-flow`},XOe={key:0,class:`add-provider-flow__section`},ZOe={key:0,class:`add-provider-flow__state`},QOe={key:1,class:`add-provider-flow__state`},$Oe={class:`add-provider-flow__catalog`},eke=[`disabled`,`onClick`],tke={class:`add-provider-flow__name`},nke={key:0,class:`add-provider-flow__empty`},rke={class:`add-provider-flow__key`},ike={key:1,class:`add-provider-flow__warning`},ake={class:`add-provider-flow__note`},oke={key:2,class:`add-provider-flow__error`,role:`alert`},ske={class:`add-provider-flow__actions`},cke={class:`add-provider-flow__note`},lke={class:`add-provider-flow__key`},uke={key:0,class:`add-provider-flow__error`,role:`alert`},dke={class:`add-provider-flow__actions`},fke={key:2,class:`add-provider-flow__section`},N9=Y(G({__name:`AddProviderFlow`,props:{config:{},initialSource:{}},emits:[`dirtyChange`,`added`,`cancel`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J(),a=R(n.initialSource??`catalog`),o=L(()=>[{value:`catalog`,label:i(`providers.catalog.sourceCatalog`)},{value:`registry`,label:i(`providers.catalog.sourceRegistry`)},{value:`manual`,label:i(`providers.catalog.sourceManual`)}]),s=R([]),l=R(`loading`),u=R(``),d=R(null),f=N({id:``,apiKey:``,baseUrl:``}),m=R(``),h=R(!1),g=R(!1),y=N({url:``,apiKey:``}),b=R(``),x=R(!1),S=R(!1),C=L(()=>{let e=u.value.trim().toLowerCase();return e===``?s.value:s.value.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))}),w=L(()=>Object.hasOwn(n.config?.providers??{},f.id.trim()));async function T(){l.value=`loading`;try{s.value=await Q().listCatalogProviders(),l.value=`ready`;let e=s.value.filter(e=>!e.rejected);e.length===1&&d.value===null&&O(e[0])}catch{l.value=`error`}}function D(e){let t=e.rejectReason===null?``:`providers.catalog.rejectReason.${e.rejectReason}`;return t!==``&&i(t)!==t?i(t):i(`providers.catalog.rejected`)}function O(e){e.rejected||(d.value=e,f.id=e.id,f.apiKey=``,f.baseUrl=``,m.value=``)}function k(){r(`dirtyChange`,!0)}async function A(){let e=d.value;if(e===null||h.value)return;let t=f.id.trim();if(t===``){m.value=i(`providers.error.idRequired`);return}if(f.apiKey.trim()===``){m.value=i(`providers.error.apiKeyRequired`);return}if(e.needsBaseUrl&&f.baseUrl.trim()===``){m.value=i(`providers.error.baseUrlRequired`);return}h.value=!0,m.value=``;try{await Q().importCatalogProvider({catalogId:e.id,id:t===e.id?void 0:t,apiKey:f.apiKey.trim(),baseUrl:f.baseUrl.trim()||void 0}),r(`dirtyChange`,!1),r(`added`,t)}catch{m.value=i(`providers.addFailed`)}finally{h.value=!1}}async function j(){if(x.value)return;let e=y.url.trim();if(e===``){b.value=i(`providers.error.registryUrlRequired`);return}x.value=!0,b.value=``;try{let t=await Q().importCustomRegistry({url:e,apiKey:y.apiKey.trim()||void 0});r(`dirtyChange`,!1);let n=t.providers[0];n===void 0?r(`cancel`):r(`added`,n.id)}catch{b.value=i(`providers.addFailed`)}finally{x.value=!1}}return p(T),(t,n)=>(c(),W(`div`,YOe,[v(o6,{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e,size:`sm`,options:o.value},null,8,[`modelValue`,`options`]),a.value===`catalog`?(c(),W(`section`,XOe,[l.value===`loading`?(c(),W(`div`,ZOe,[v(op,{size:`sm`}),K(U(z(i)(`providers.catalog.loading`)),1)])):l.value===`error`?(c(),W(`div`,QOe,[F(`span`,null,U(z(i)(`providers.catalog.loadError`)),1),v(pD,{size:`sm`,variant:`secondary`,onClick:T},{default:B(()=>[K(U(z(i)(`providers.catalog.retry`)),1)]),_:1})])):d.value===null?(c(),W(M,{key:2},[v(Fp,{modelValue:u.value,"onUpdate:modelValue":n[1]||=e=>u.value=e,placeholder:z(i)(`providers.catalog.searchPlaceholder`),autocomplete:`off`},null,8,[`modelValue`,`placeholder`]),F(`div`,$Oe,[(c(!0),W(M,null,_(C.value,e=>(c(),W(`button`,{key:e.id,type:`button`,class:`add-provider-flow__entry`,disabled:e.rejected,onClick:t=>O(e)},[F(`span`,tke,U(e.name),1),e.wireType?(c(),P(cp,{key:0,size:`sm`,variant:`neutral`},{default:B(()=>[K(U(e.wireType),1)]),_:2},1024)):E(``,!0),n[15]||=F(`span`,{class:`add-provider-flow__grow`},null,-1),F(`span`,null,U(e.rejected?D(e):z(i)(`providers.modelCount`,{count:e.models.length})),1)],8,eke))),128)),C.value.length===0?(c(),W(`div`,nke,U(z(i)(`providers.catalog.empty`)),1)):E(``,!0)])],64)):(c(),W(`form`,{key:3,class:`add-provider-flow__form`,onSubmit:H(A,[`prevent`]),onInput:k},[F(`button`,{type:`button`,class:`add-provider-flow__back`,onClick:n[2]||=e=>d.value=null},[v(X,{class:`add-provider-flow__back-icon`,name:`chevron-right`,size:`sm`}),K(U(z(i)(`providers.catalog.backToList`)),1)]),v(O7,{label:z(i)(`providers.fieldId`)},{default:B(()=>[v(Fp,{modelValue:f.id,"onUpdate:modelValue":n[3]||=e=>f.id=e,autocomplete:`off`},null,8,[`modelValue`])]),_:1},8,[`label`]),v(O7,{label:z(i)(`providers.fieldApiKey`)},{default:B(()=>[F(`div`,rke,[v(Fp,{modelValue:f.apiKey,"onUpdate:modelValue":n[4]||=e=>f.apiKey=e,type:g.value?`text`:`password`,autocomplete:`off`},null,8,[`modelValue`,`type`]),v(Ca,{class:`add-provider-flow__eye`,size:`sm`,label:g.value?z(i)(`providers.hideApiKey`):z(i)(`providers.showApiKey`),onClick:n[5]||=e=>g.value=!g.value},{default:B(()=>[v(X,{name:g.value?`eye-off`:`eye`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),_:1},8,[`label`]),d.value.needsBaseUrl?(c(),P(O7,{key:0,label:z(i)(`providers.fieldBaseUrl`)},{default:B(()=>[v(Fp,{modelValue:f.baseUrl,"onUpdate:modelValue":n[6]||=e=>f.baseUrl=e,placeholder:z(i)(`providers.baseUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):E(``,!0),w.value?(c(),W(`div`,ike,U(z(i)(`providers.catalog.overwriteWarning`)),1)):E(``,!0),F(`div`,ake,U(z(i)(`providers.catalog.willImport`,{count:d.value.models.length})),1),m.value?(c(),W(`div`,oke,U(m.value),1)):E(``,!0),F(`div`,ske,[v(pD,{type:`button`,variant:`secondary`,onClick:n[7]||=e=>r(`cancel`)},{default:B(()=>[K(U(z(i)(`common.cancel`)),1)]),_:1}),v(pD,{type:`submit`,variant:`primary`,loading:h.value},{default:B(()=>[K(U(z(i)(`providers.catalog.importAction`)),1)]),_:1},8,[`loading`])])],32))])):a.value===`registry`?(c(),W(`form`,{key:1,class:`add-provider-flow__section add-provider-flow__form`,onSubmit:H(j,[`prevent`]),onInput:k},[F(`p`,cke,U(z(i)(`providers.catalog.registryHint`)),1),v(O7,{label:z(i)(`providers.catalog.registryUrlLabel`)},{default:B(()=>[v(Fp,{modelValue:y.url,"onUpdate:modelValue":n[8]||=e=>y.url=e,placeholder:`https://example.com/api.json`,autocomplete:`off`},null,8,[`modelValue`])]),_:1},8,[`label`]),v(O7,{label:z(i)(`providers.fieldApiKey`)},{default:B(()=>[F(`div`,lke,[v(Fp,{modelValue:y.apiKey,"onUpdate:modelValue":n[9]||=e=>y.apiKey=e,type:S.value?`text`:`password`,autocomplete:`off`},null,8,[`modelValue`,`type`]),v(Ca,{class:`add-provider-flow__eye`,size:`sm`,label:S.value?z(i)(`providers.hideApiKey`):z(i)(`providers.showApiKey`),onClick:n[10]||=e=>S.value=!S.value},{default:B(()=>[v(X,{name:S.value?`eye-off`:`eye`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),_:1},8,[`label`]),b.value?(c(),W(`div`,uke,U(b.value),1)):E(``,!0),F(`div`,dke,[v(pD,{type:`button`,variant:`secondary`,onClick:n[11]||=e=>r(`cancel`)},{default:B(()=>[K(U(z(i)(`common.cancel`)),1)]),_:1}),v(pD,{type:`submit`,variant:`primary`,loading:x.value},{default:B(()=>[K(U(z(i)(`providers.catalog.importAction`)),1)]),_:1},8,[`loading`])])],32)):(c(),W(`div`,fke,[v(M9,{mode:`add`,config:e.config,onDirtyChange:n[12]||=e=>r(`dirtyChange`,e),onSaved:n[13]||=e=>r(`added`,e),onCancel:n[14]||=e=>r(`cancel`)},null,8,[`config`])]))]))}}),[[`__scopeId`,`data-v-01edc4ef`]]),pke={class:`providers-panel`},mke={class:`providers-panel__heading`},hke={key:1,class:`providers-panel__split`},gke=[`aria-label`],_ke={class:`providers-pane-label`},vke=[`aria-label`],yke=[`data-testid`,`aria-current`,`onClick`],bke=[`aria-label`],xke={"aria-hidden":`true`},Ske={class:`providers-panel__row-name`},Cke={class:`providers-pane-label`},wke=[`aria-current`],Tke={class:`providers-panel__add-icon`},Eke={class:`providers-panel__row-name`},Dke={class:`providers-panel__detail`},Oke={class:`providers-detail__head`},kke={class:`providers-detail__tile`,"aria-hidden":`true`},Ake={class:`providers-detail__identity`},jke={class:`providers-detail__name-row`},Mke={class:`providers-detail__meta`},Nke={class:`mono`},P9=`$add`,Pke=Y(G({__name:`ProvidersPanel`,props:{discardToken:{default:0}},emits:[`dirtyChange`],setup(e,{emit:t}){let n=t,{t:r}=J(),{confirm:i}=G4(),a=E7(),o=R([]),l=R(null),u=R([]),d=L(()=>{if(l.value===null)return null;let e={};for(let t of u.value)e[t.id]=t;return Object.assign(e,l.value.models??{}),{...l.value,models:e}}),f=R(!1),m=R(!1),h=R(null),g=R(!1),y=L(()=>o.value.toSorted((e,t)=>e.id.localeCompare(t.id))),b=L(()=>h.value===P9),x=L(()=>y.value.find(e=>e.id===h.value)??null);function S(e){return e===`connected`?`ok`:e===`error`?`error`:`idle`}function C(e){return(e.trim()[0]??`?`).toUpperCase()}s(g,e=>n(`dirtyChange`,e),{immediate:!0}),s(()=>e.discardToken,()=>{g.value=!1,h.value=y.value[0]?.id??null});async function w(){await a.refreshRuntimeState(),await T()}async function T(){f.value=!0,m.value=!1;try{o.value=await Q().listProviders(),y.value.some(e=>e.id===h.value)||(h.value=y.value[0]?.id??null)}catch{o.value=[],m.value=!0}try{let[e,t]=await Promise.all([Q().getConfig(),Q().listModels().catch(()=>[])]);l.value=e,u.value=t}catch{l.value=null,u.value=[]}finally{f.value=!1}}function D(e){g.value||(h.value=e)}async function O(e){g.value=!1,await w(),h.value=e}async function k(e){await i({title:r(`providers.deleteProvider`),message:r(`providers.deleteConfirm`,{id:e.id,count:e.models?.length??0}),confirmLabel:r(`providers.deleteConfirmYes`),cancelLabel:r(`common.cancel`),variant:`danger`,action:async()=>{await a.deleteProvider(e.id),h.value=null,g.value=!1,await w()}})}return p(T),(e,t)=>(c(),W(`section`,pke,[F(`div`,mke,[F(`div`,null,[F(`h3`,null,U(z(r)(`providers.title`)),1),F(`p`,null,U(z(r)(`providers.description`)),1)]),!f.value&&!m.value?(c(),P(Ca,{key:0,size:`sm`,label:z(r)(`providers.refresh`),"data-testid":`providers-refresh`,onClick:t[0]||=e=>w()},{default:B(()=>[v(X,{name:`undo`,size:`sm`})]),_:1},8,[`label`])):E(``,!0)]),m.value?(c(),P(e9,{key:0,variant:`warning`},{default:B(()=>[K(U(z(r)(`providers.unavailable`)),1)]),_:1})):(c(),W(`div`,hke,[F(`nav`,{class:`providers-panel__list`,"aria-label":z(r)(`providers.title`)},[F(`div`,_ke,U(z(r)(`settings.tabs.providers`)),1),f.value?(c(),W(M,{key:0},_(3,e=>F(`div`,{key:e,class:`providers-panel__row providers-panel__row--skeleton`,role:`status`,"aria-label":z(r)(`providers.loading`)},[v(O9,{width:`26px`,height:`26px`,circle:``}),v(O9,{width:`${52-e*6}%`,height:`11px`},null,8,[`width`])],8,vke)),64)):(c(),W(M,{key:1},[(c(!0),W(M,null,_(y.value,e=>(c(),W(`div`,{key:e.id,class:V([`providers-panel__item`,{"is-selected":h.value===e.id}])},[F(`button`,{type:`button`,class:`providers-panel__row`,"data-testid":`provider-${e.id}-toggle`,"aria-current":h.value===e.id,onClick:t=>D(e.id)},[v(Sp,{text:z(r)(`providers.status.${e.status}`)},{default:B(()=>[F(`span`,{class:V([`providers-panel__tile`,`is-${S(e.status)}`]),role:`img`,"aria-label":z(r)(`providers.status.${e.status}`)},[F(`span`,xke,U(C(e.type)),1)],10,bke)]),_:2},1032,[`text`]),F(`span`,Ske,U(e.id),1),F(`span`,{class:V([`providers-panel__row-dot`,`is-${S(e.status)}`]),"aria-hidden":`true`},null,2)],8,yke),v(Ca,{class:`providers-panel__row-delete`,size:`sm`,label:z(r)(`providers.deleteTitle`,{type:e.id}),"data-testid":`provider-${e.id}-delete`,onClick:H(t=>k(e),[`stop`])},{default:B(()=>[v(X,{name:`trash`,size:`sm`})]),_:1},8,[`label`,`data-testid`,`onClick`])],2))),128)),F(`div`,Cke,U(z(r)(`providers.customProviders`)),1),F(`button`,{type:`button`,class:V([`providers-panel__row providers-panel__row--add`,{"is-selected":b.value}]),"aria-current":b.value,onClick:t[1]||=e=>D(P9)},[F(`span`,Tke,[v(X,{name:`plus`,size:`sm`})]),F(`span`,Eke,U(z(r)(`providers.addProvider`)),1)],10,wke)],64))],8,gke),F(`div`,Dke,[b.value?(c(),P(N9,{key:0,config:l.value,onDirtyChange:t[2]||=e=>g.value=e,onAdded:O,onCancel:t[3]||=e=>{h.value=y.value[0]?.id??null,g.value=!1}},null,8,[`config`])):x.value?(c(),W(M,{key:1},[F(`header`,Oke,[F(`span`,kke,U(C(x.value.type)),1),F(`div`,Ake,[F(`div`,jke,[F(`h4`,null,U(x.value.id),1),v(cp,{variant:x.value.status===`connected`?`success`:x.value.status===`error`?`danger`:`neutral`,size:`md`},{default:B(()=>[K(U(z(r)(`providers.status.${x.value.status}`)),1)]),_:1},8,[`variant`])]),F(`p`,Mke,[F(`span`,null,U(x.value.type),1),x.value.baseUrl?(c(),W(M,{key:0},[t[6]||=F(`span`,{"aria-hidden":`true`},`·`,-1),F(`span`,Nke,U(x.value.baseUrl),1)],64)):E(``,!0)])])]),(c(),P(M9,{key:x.value.id,mode:`edit`,provider:x.value,config:d.value,onDirtyChange:t[4]||=e=>g.value=e,onSaved:O,onCancel:t[5]||=e=>{h.value=y.value[0]?.id??null,g.value=!1}},null,8,[`provider`,`config`]))],64)):o.value.length===0&&!f.value?(c(),P(gE,{key:2,title:z(r)(`providers.empty`),hint:z(r)(`providers.emptyHint`)},{icon:B(()=>[v(X,{name:`bolt`})]),_:1},8,[`title`,`hint`])):E(``,!0)])]))]))}}),[[`__scopeId`,`data-v-c5995f27`]]),Fke={class:`pp`},Ike={class:`pp-title`},Lke={class:`pp-note`},Rke={key:0,class:`pp-custom-body`},zke={class:`pp-hint`},Bke={key:0,class:`pp-error`},Vke={key:0,class:`pp-warn`},Hke={key:1,class:`pp-loading`},Uke={key:2,class:`pp-error-block`},Wke={key:0,class:`pp-group`},Gke={class:`pp-group-title`},Kke={class:`pp-list`},qke={class:`pp-main`},Jke={class:`pp-name-row`},Yke={class:`pp-name`},Xke={key:0,class:`pp-ver`},Zke={key:0,class:`pp-desc`},Qke={key:1,class:`pp-meta`},$ke={key:2,class:`pp-error`},eAe={key:3,class:`pp-error`},tAe={class:`pp-actions`},nAe={key:1,class:`pp-group`},rAe={class:`pp-group-title`},iAe={class:`pp-list`},aAe={class:`pp-main`},oAe={class:`pp-name-row`},sAe={class:`pp-name`},cAe={key:0,class:`pp-ver`},lAe={key:0,class:`pp-desc`},uAe={key:1,class:`pp-meta`},dAe={key:2,class:`pp-error`},fAe={class:`pp-actions`},pAe={key:2,class:`pp-group`},mAe={class:`pp-group-title`},hAe={class:`pp-list`},gAe={class:`pp-main`},_Ae={class:`pp-name-row`},vAe={class:`pp-name`},yAe={key:0,class:`pp-ver`},bAe={key:0,class:`pp-meta`},xAe={key:1,class:`pp-error`},SAe={key:2,class:`pp-error`},CAe={class:`pp-actions`},F9=`__custom__`,wAe=Y(G({__name:`PluginsPanel`,setup(e){let{t}=J(),n=R(!1),r=R(!1),i=R(null),a=R(!1),o=R([]),s=R([]),l=R({}),u=R({}),d=R(!1),f=R(``),m=R(null),h=L(()=>new Map(o.value.map(e=>[e.id,e]))),g=L(()=>s.value.filter(e=>e.capabilityId===void 0)),y=L(()=>g.value.filter(e=>e.tier===`official`)),b=L(()=>g.value.filter(e=>e.tier!==`official`)),x=L(()=>{let e=new Set(s.value.map(e=>e.id));return o.value.filter(t=>!e.has(t.id))}),S=L(()=>y.value.length===0&&b.value.length===0&&x.value.length===0);function C(e,t){return`${e}:${t}`}function w(e,t){return l.value[C(e,t)]===!0}function T(e,t){let n=t??e;return w(e,`install`)||w(n,`remove`)||w(n,`toggle`)}async function D(e,t,n){let r=C(e,t);l.value={...l.value,[r]:!0};let i={...u.value};delete i[e],u.value=i;try{await n()}catch(t){u.value={...u.value,[e]:t instanceof Error?t.message:String(t)}}finally{let e={...l.value};delete e[r],l.value=e}}async function O(e=!1){if(!(n.value&&!e)){n.value=!0,i.value=null,a.value=!1;try{let e=Q(),[t,n]=await Promise.all([e.listPlugins(),e.listPluginMarketplace().catch(()=>(a.value=!0,[]))]);o.value=t,s.value=n,r.value=!0}catch(e){i.value=e instanceof Error?e.message:String(e)}finally{n.value=!1}}}function k(e){return t(`settings.plugins.counts`,{skills:e.skillCount,servers:e.mcpServerCount})}function A(e){window.open(e,`_blank`,`noopener`)}function j(e){let t=h.value.get(e.id);return t?k(t):e.version?e.version:``}async function N(e){await D(e.id,`install`,async()=>{await Q().installPlugin(e.source),await O(!0)})}async function ee(){let e=f.value.trim();!e||w(F9,`install`)||await D(F9,`install`,async()=>{await Q().installPlugin(e),f.value=``,d.value=!1,await O(!0)})}async function I(e,t){await D(e,`toggle`,async()=>{await Q().setPluginEnabled(e,t),o.value=o.value.map(n=>n.id===e?{...n,enabled:t}:n)})}async function te(e){await D(e,`remove`,async()=>{await Q().removePlugin(e),await O(!0)})}function ne(){d.value=!d.value,d.value&&Promise.resolve().then(()=>m.value?.el?.focus())}return p(()=>{O(!0)}),(e,o)=>(c(),W(`section`,Fke,[F(`h3`,Ike,U(z(t)(`settings.tabs.plugins`)),1),F(`p`,Lke,U(z(t)(`settings.plugins.note`)),1),F(`div`,{class:V([`pp-custom`,{open:d.value}])},[F(`button`,{type:`button`,class:`pp-custom-row`,onClick:ne},[v(X,{name:`plus`,size:`md`}),F(`span`,null,U(z(t)(`settings.plugins.customInstall`)),1),F(`span`,{class:V([`pp-chev`,{open:d.value}])},[v(X,{name:`chevron-right`,size:`sm`})],2)]),d.value?(c(),W(`div`,Rke,[F(`form`,{class:`pp-custom-form`,onSubmit:H(ee,[`prevent`])},[v(Fp,{ref_key:`customInput`,ref:m,modelValue:f.value,"onUpdate:modelValue":o[0]||=e=>f.value=e,class:`pp-custom-input`,placeholder:z(t)(`settings.plugins.customInstallPlaceholder`),"aria-label":z(t)(`settings.plugins.customInstall`)},null,8,[`modelValue`,`placeholder`,`aria-label`]),v(pD,{size:`sm`,variant:`primary`,type:`submit`,loading:w(F9,`install`),disabled:f.value.trim()===``},{default:B(()=>[K(U(z(t)(`settings.plugins.install`)),1)]),_:1},8,[`loading`,`disabled`])],32),F(`p`,zke,U(z(t)(`settings.plugins.customInstallHint`)),1),u.value[F9]?(c(),W(`p`,Bke,U(u.value[F9]),1)):E(``,!0)])):E(``,!0)],2),a.value?(c(),W(`p`,Vke,U(z(t)(`settings.plugins.catalogUnavailable`)),1)):E(``,!0),n.value&&!r.value?(c(),W(`div`,Hke,[v(op,{size:`sm`}),F(`span`,null,U(z(t)(`settings.plugins.loading`)),1)])):i.value?(c(),W(`div`,Uke,[F(`span`,null,U(i.value),1),v(pD,{size:`sm`,variant:`secondary`,onClick:o[1]||=e=>O(!0)},{default:B(()=>[K(U(z(t)(`settings.plugins.retry`)),1)]),_:1})])):S.value?(c(),P(gE,{key:3,title:z(t)(`settings.plugins.empty`)},null,8,[`title`])):(c(),W(M,{key:4},[y.value.length>0?(c(),W(`section`,Wke,[F(`h4`,Gke,U(z(t)(`settings.plugins.official`)),1),F(`div`,Kke,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`article`,{key:e.id,class:`pp-row`},[F(`div`,qke,[F(`div`,Jke,[F(`span`,Yke,U(e.displayName),1),e.version?(c(),W(`span`,Xke,U(e.version),1)):E(``,!0)]),e.description?(c(),W(`p`,Zke,U(e.description),1)):E(``,!0),j(e)?(c(),W(`p`,Qke,U(j(e)),1)):E(``,!0),u.value[e.id]?(c(),W(`p`,$ke,U(u.value[e.id]),1)):E(``,!0),h.value.get(e.id)?.hasErrors?(c(),W(`p`,eAe,U(z(t)(`settings.plugins.hasErrors`)),1)):E(``,!0)]),F(`div`,tAe,[h.value.has(e.id)?(c(),W(M,{key:0},[v(E9,{"model-value":h.value.get(e.id).enabled,disabled:T(e.id,e.id),"aria-label":z(t)(`settings.plugins.enabled`),"onUpdate:modelValue":t=>I(e.id,t)},null,8,[`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`]),v(Sp,{text:z(t)(`settings.plugins.remove`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.remove`),disabled:T(e.id,e.id),onClick:t=>te(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`disabled`,`onClick`])]),_:2},1032,[`text`])],64)):(c(),P(pD,{key:1,size:`sm`,variant:`secondary`,loading:w(e.id,`install`),onClick:t=>N(e)},{default:B(()=>[K(U(e.updateAvailable?z(t)(`settings.plugins.update`):z(t)(`settings.plugins.install`)),1)]),_:2},1032,[`loading`,`onClick`])),e.homepage?(c(),P(Sp,{key:2,text:z(t)(`settings.plugins.homepage`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.homepage`),onClick:t=>A(e.homepage)},{default:B(()=>[v(X,{name:`external-link`,size:`sm`})]),_:1},8,[`label`,`onClick`])]),_:2},1032,[`text`])):E(``,!0)])]))),128))])])):E(``,!0),b.value.length>0?(c(),W(`section`,nAe,[F(`h4`,rAe,U(z(t)(`settings.plugins.thirdParty`)),1),F(`div`,iAe,[(c(!0),W(M,null,_(b.value,e=>(c(),W(`article`,{key:e.id,class:`pp-row`},[F(`div`,aAe,[F(`div`,oAe,[F(`span`,sAe,U(e.displayName),1),e.version?(c(),W(`span`,cAe,U(e.version),1)):E(``,!0)]),e.description?(c(),W(`p`,lAe,U(e.description),1)):E(``,!0),j(e)?(c(),W(`p`,uAe,U(j(e)),1)):E(``,!0),u.value[e.id]?(c(),W(`p`,dAe,U(u.value[e.id]),1)):E(``,!0)]),F(`div`,fAe,[h.value.has(e.id)?(c(),W(M,{key:0},[v(E9,{"model-value":h.value.get(e.id).enabled,disabled:T(e.id,e.id),"aria-label":z(t)(`settings.plugins.enabled`),"onUpdate:modelValue":t=>I(e.id,t)},null,8,[`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`]),v(Sp,{text:z(t)(`settings.plugins.remove`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.remove`),disabled:T(e.id,e.id),onClick:t=>te(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`disabled`,`onClick`])]),_:2},1032,[`text`])],64)):(c(),P(pD,{key:1,size:`sm`,variant:`secondary`,loading:w(e.id,`install`),onClick:t=>N(e)},{default:B(()=>[K(U(z(t)(`settings.plugins.install`)),1)]),_:1},8,[`loading`,`onClick`]))])]))),128))])])):E(``,!0),x.value.length>0?(c(),W(`section`,pAe,[F(`h4`,mAe,U(z(t)(`settings.plugins.installed`)),1),F(`div`,hAe,[(c(!0),W(M,null,_(x.value,e=>(c(),W(`article`,{key:e.id,class:`pp-row`},[F(`div`,gAe,[F(`div`,_Ae,[F(`span`,vAe,U(e.displayName),1),e.version?(c(),W(`span`,yAe,U(e.version),1)):E(``,!0)]),k(e)?(c(),W(`p`,bAe,U(k(e)),1)):E(``,!0),e.hasErrors?(c(),W(`p`,xAe,U(z(t)(`settings.plugins.hasErrors`)),1)):E(``,!0),u.value[e.id]?(c(),W(`p`,SAe,U(u.value[e.id]),1)):E(``,!0)]),F(`div`,CAe,[v(E9,{"model-value":e.enabled,disabled:T(e.id),"aria-label":z(t)(`settings.plugins.toggleAria`,{name:e.displayName}),"onUpdate:modelValue":t=>I(e.id,t)},null,8,[`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`]),v(Sp,{text:z(t)(`settings.plugins.remove`)},{default:B(()=>[v(Ca,{size:`sm`,label:z(t)(`settings.plugins.remove`),disabled:T(e.id),onClick:t=>te(e.id)},{default:B(()=>[v(X,{name:`close`,size:`sm`})]),_:1},8,[`label`,`disabled`,`onClick`])]),_:2},1032,[`text`])])]))),128))])])):E(``,!0)],64))]))}}),[[`__scopeId`,`data-v-5064cfe0`]]),TAe=[`aria-label`],EAe=[`aria-selected`,`onClick`],DAe={class:`body`},OAe={class:`panel`},kAe={class:`sec`},AAe={class:`sec-title`},jAe={class:`row`},MAe={class:`rlabel`},NAe={class:`row`},PAe={class:`rlabel`},FAe={class:`row`},IAe={class:`rlabel`},LAe={class:`sec`},RAe={class:`sec-title`},zAe={class:`row`},BAe={class:`rlabel`},VAe={class:`hint`},HAe={class:`row`},UAe={class:`rlabel`},WAe={class:`hint`},GAe={class:`sec`},KAe={class:`sec-title`},qAe={class:`row`},JAe={class:`rlabel`},YAe={key:0,class:`hint`},XAe={class:`row`},ZAe={class:`rlabel`},QAe={key:0,class:`hint`},$Ae={class:`row`},eje={class:`rlabel`},tje={key:0,class:`hint`},nje={class:`row`},rje={class:`rlabel`},ije={class:`panel`},aje={class:`sec`},oje={class:`sec-title`},sje={class:`row`},cje={class:`rlabel`},lje={key:0,class:`rvalue`},uje={class:`actions`},dje={class:`panel`},fje={class:`panel`},pje={class:`panel`},mje={class:`sec`},hje={class:`sec-head`},gje={class:`sec-title`},_je={key:0,class:`saving`},vje={class:`row`},yje={class:`rlabel`},bje={class:`hint`},xje={key:0,class:`select-wrap`},Sje={key:0,value:``,disabled:``},Cje=[`label`],wje=[`value`],Tje={key:1,class:`rvalue mono`},Eje={key:0,class:`sec`,"data-testid":`subagent-routing`},Dje={class:`sec-title`},Oje=[`aria-label`],kje=[`value`,`checked`,`disabled`,`onChange`],Aje={class:`routing-mode-title`},jje={class:`hint`},Mje={key:0,class:`row`},Nje={class:`rlabel`},Pje={class:`hint`},Fje={key:1,class:`rvalue`},Ije={key:1,class:`row routing-pool`},Lje={class:`rlabel`},Rje={class:`hint`},zje={class:`pool-list`,"data-testid":`routing-pool`},Bje=[`value`,`checked`,`disabled`,`onChange`],Vje={class:`pool-name`},Hje=[`disabled`,`onClick`],Uje={class:`row routing-effective`,"data-testid":`effective-routing`},Wje={class:`rlabel`},Gje={class:`rvalue mono`,"data-testid":`saved-policy`},Kje={class:`rlabel`},qje={class:`rvalue mono`,"data-testid":`effective-policy`},Jje={key:0,class:`hint`,"data-testid":`feature-disabled`},Yje={class:`row`},Xje={class:`rlabel`},Zje={class:`hint`},Qje={class:`row`},$je={class:`rlabel`},eMe={class:`hint`},tMe={class:`row`},nMe={class:`rlabel`},rMe={class:`hint`},iMe={class:`row`},aMe={class:`rlabel`},oMe={class:`hint`},sMe={key:1,class:`empty-config`},cMe={class:`panel`,"data-testid":`expert-opinion-settings`},lMe={class:`sec`},uMe={class:`sec-head`},dMe={class:`sec-title`},fMe={key:0,class:`saving`},pMe={class:`row`},mMe={class:`rlabel`},hMe={class:`hint`},gMe={key:0,class:`flag-chip`},_Me={key:1,class:`flag-chip flag-chip--warn`},vMe={class:`row`},yMe={class:`rlabel`},bMe={class:`hint`},xMe={class:`expert-opinion-flow`},SMe={class:`actions expert-opinion-actions`},CMe={key:0,class:`hint`},wMe={class:`panel`},TMe={class:`sec`},EMe={class:`sec-title`},DMe={class:`row`},OMe={class:`rlabel`},kMe={class:`hint`},AMe={class:`rvalue mono`},jMe={class:`row`},MMe={class:`rlabel`},NMe={class:`hint`},PMe={class:`value-wrap`},FMe={class:`rvalue mono`},IMe={class:`row`},LMe={class:`rlabel`},RMe={class:`hint`},zMe={class:`value-wrap`},BMe={class:`rvalue mono`},VMe={class:`row`},HMe={class:`rlabel`},UMe={class:`rvalue mono`},WMe={key:0,class:`sec`},GMe={key:0,class:`row`},KMe={class:`rlabel`},qMe={class:`hint`},JMe={class:`hint`},YMe={class:`sec`},XMe={class:`sec-title`},ZMe={class:`row`},QMe={class:`rlabel`},$Me={key:0,class:`hint`},eNe={class:`row`},tNe={class:`rlabel`},nNe={class:`panel`},rNe={key:0,class:`sec`},iNe={class:`sec-title`},aNe={"data-testid":`desktop-update-controls`,class:`desktop-update-card`},oNe={class:`desktop-update-row desktop-update-summary`},sNe={class:`desktop-update-summary-copy`},cNe={class:`desktop-update-icon`,"aria-hidden":`true`},lNe={class:`rlabel`},uNe={class:`desktop-update-title`,"aria-live":`polite`},dNe={class:`hint`},fNe={class:`desktop-update-row`},pNe={class:`rlabel`},mNe={class:`hint`},hNe={class:`select-wrap desktop-update-select`},gNe=[`value`],_Ne={class:`desktop-update-row`},vNe={class:`rlabel`},yNe={class:`hint`},bNe={class:`desktop-update-row`},xNe={class:`rlabel`},SNe={class:`hint`},CNe={key:0,class:`desktop-update-detail`},wNe={key:0,class:`desktop-update-progress`},TNe=[`aria-label`],ENe=[`value`,`aria-label`],DNe={"data-testid":`settings-update-progress-detail`},ONe={class:`desktop-update-actions`},kNe={class:`panel`},ANe={class:`sec`},jNe={class:`sec-title`},MNe={class:`row`},NNe={class:`rlabel`},PNe={class:`hint`},FNe={class:`row`},INe={class:`rlabel`},LNe={class:`hint`},RNe={key:0,class:`flag-chip`},zNe={key:1,class:`flag-chip flag-chip--warn`},BNe={class:`row`},VNe={class:`rlabel`},HNe={class:`hint`},UNe={key:0,class:`flag-chip`},WNe={key:1,class:`flag-chip flag-chip--warn`},GNe={key:1,class:`empty-config`},KNe={class:`panel`},qNe={class:`panel-head`},JNe={class:`panel-title`},YNe={class:`panel-desc`},XNe={class:`archive-toolbar`},ZNe={class:`archive-search`},QNe=[`placeholder`],$Ne={value:`all`},ePe=[`value`],tPe={key:0,class:`archive-empty`},nPe={key:0,class:`archive-list`},rPe={class:`archive-workspace`},iPe={class:`path`},aPe={class:`count`},oPe={class:`setting-card`},sPe={class:`archive-meta`},cPe={class:`archive-name`},lPe={class:`archive-time`},uPe={key:1,class:`archive-empty`},dPe=100,fPe=Y(G({__name:`SettingsDialog`,props:{colorScheme:{},accent:{},uiFontSize:{},authReady:{type:Boolean},accountModel:{},notify:{type:Boolean},notifyQuestion:{type:Boolean},notifyApproval:{type:Boolean},notifyPermission:{},sound:{type:Boolean},conversationToc:{type:Boolean},turnFolding:{type:Boolean},activityRunFolding:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},backend:{},experimentalFlagStates:{},subagentModelPolicy:{},subagentModelPolicySaving:{type:Boolean},initialTab:{}},emits:[`setColorScheme`,`setAccent`,`setUiFontSize`,`setNotify`,`setNotifyQuestion`,`setNotifyApproval`,`setSound`,`setConversationToc`,`setTurnFolding`,`setActivityRunFolding`,`openOnboarding`,`updateConfig`,`saveSubagentModelPolicy`,`clearSubagentModelPolicy`,`close`],setup(e,{emit:t}){let{t:n}=J(),r=m(D7),{showReasoning:i,setShowReasoning:a}=z4(),o=e,u=t,d=R(o.initialTab??`general`),f=L(()=>b6(o.uiFontSize)),g=typeof window>`u`?void 0:window.pythinkerDesktop,y=[{id:`general`,labelKey:`settings.tabs.general`,icon:`sliders`},{id:`agent`,labelKey:`settings.tabs.agent`,icon:`cute-bot`},{id:`expertOpinion`,labelKey:`settings.tabs.expertOpinion`,icon:`sparkles`},{id:`account`,labelKey:`settings.tabs.account`,icon:`user`},{id:`providers`,labelKey:`settings.tabs.providers`,icon:`bolt`},{id:`plugins`,labelKey:`settings.tabs.plugins`,icon:`tool`},{id:`lab`,labelKey:`settings.tabs.lab`,icon:`flask`},{id:`archived`,labelKey:`settings.tabs.archived`,icon:`archive`},...g===void 0?[]:[{id:`update`,labelKey:`settings.tabs.update`,icon:`update-available`}],{id:`advanced`,labelKey:`settings.tabs.advanced`,icon:`microscope`}],b=zp().serverHttpUrl,x=R(),S=R(!1),C=R(),w,T=L(()=>x.value?.installedVersion??`0.1.2`),D=R(null),O=L(()=>D.value?.serverVersion||o.serverVersion||`-`),k=L(()=>D.value?.backend??o.backend??`v1`),j=L(()=>k.value===`v2`?`agent-gateway`:`server`),N=R(!1),ee=R(!1),I=R(0),{confirm:te,current:ne}=G4(),re=[`manual`,`yolo`,`auto`],ie={manual:`status.permissionManual`,auto:`status.permissionAuto`,yolo:`status.permissionYolo`},ae=R(null);T9(ae);function oe(e){e.key===`Escape`&&ne.value===null&&Ve()}p(()=>{document.addEventListener(`keydown`,oe),Ee(),g!==void 0&&(w=g.onUpdateState(e=>{x.value=e}),g.getUpdateState().then(e=>{x.value=e}))}),h(()=>{document.removeEventListener(`keydown`,oe),w?.(),Ke!==null&&clearTimeout(Ke)});let se=L(()=>{let e=x.value;if(e===void 0)return n(`settings.desktop.loading`);switch(e.status){case`disabled`:return n(`settings.desktop.disabled`);case`checking`:return n(`settings.desktop.checking`);case`available`:return n(`settings.desktop.available`,{version:e.availableVersion});case`downloading`:return n(`settings.desktop.downloading`,{version:e.availableVersion});case`downloaded`:return n(`settings.desktop.downloaded`,{version:e.availableVersion});case`skipped`:return n(`settings.desktop.skipped`,{version:e.skippedVersion??e.availableVersion});case`error`:return e.message??n(`settings.desktop.errorGeneric`);default:return n(`settings.desktop.upToDate`)}}),ce=L(()=>{let e=x.value?.percent;return e===void 0||!Number.isFinite(e)?void 0:Math.min(100,Math.max(0,e))}),le=[`stable`,`beta`,`nightly`],ue=L(()=>{let e=x.value?.status;return S.value||e===void 0||e===`checking`||e===`downloading`||e===`downloaded`}),fe=L(()=>{let e=x.value?.status;return S.value||e===void 0||e===`disabled`||e===`checking`||e===`downloading`||e===`downloaded`}),H=L(()=>{let e=x.value?.lastCheckedAt;if(e===void 0)return n(`settings.desktop.neverChecked`);let t=new Date(e);return Number.isNaN(t.getTime())?n(`settings.desktop.neverChecked`):n(`settings.desktop.lastChecked`,{time:new Intl.DateTimeFormat(`en`,{dateStyle:`medium`,timeStyle:`short`}).format(t)})});function G(e){let t=[`B`,`KB`,`MB`,`GB`],n=Math.max(0,e),r=0;for(;n>=1024&&r{let e=x.value;if(e?.status!==`downloading`)return``;let t=[];return ce.value!==void 0&&t.push(`${Math.round(ce.value)}%`),e.transferred!==void 0&&e.total!==void 0?t.push(n(`settings.desktop.bytesOfTotal`,{transferred:G(e.transferred),total:G(e.total)})):e.transferred!==void 0&&t.push(G(e.transferred)),e.bytesPerSecond!==void 0&&t.push(`${G(e.bytesPerSecond)}/s`),t.join(` · `)}),me=L(()=>C.value===void 0?x.value?.status===`error`?se.value:void 0:C.value);async function he(e){if(!S.value){S.value=!0,C.value=void 0;try{x.value=await e()}catch(e){C.value=e instanceof Error?e.message:String(e)}finally{S.value=!1}}}function ge(e){g!==void 0&&he(()=>g.setAutoUpdate(e))}function _e(e){g!==void 0&&le.includes(e)&&he(()=>g.setUpdateChannel(e))}function ve(e){g!==void 0&&he(()=>g.setNotifyUpdate(e))}function ye(){g!==void 0&&he(()=>g.checkForUpdates())}function be(){g!==void 0&&he(()=>g.downloadUpdate())}function xe(){let e=x.value?.availableVersion;g!==void 0&&e!==void 0&&he(()=>g.skipUpdate(e))}function Se(){g!==void 0&&he(()=>g.undoSkippedUpdate())}function Ce(){let e=x.value?.availableVersion;g!==void 0&&e!==void 0&&he(()=>g.openUpdateReleaseNotes(e))}function we(){g!==void 0&&he(()=>g.restartToUpdate())}let Te=0;async function Ee(){let e=++Te,t;try{t=await Q().getMeta()}catch{t=null}e===Te&&(D.value=t)}s(()=>o.config,()=>{Ee()});function De(){lC()}let Oe=L(()=>{let e=new Map;for(let t of o.models??[])e.set(t.id,{id:t.id,label:t.displayName??t.model??t.id,provider:t.provider});for(let[t,n]of Object.entries(o.config?.models??{})){if(e.has(t))continue;let r=je(n);e.set(t,{id:t,label:Me(t,n,r),provider:r??t})}return Array.from(e.values())}),ke=L(()=>{let e=new Map;for(let t of Oe.value){let n=e.get(t.provider)??[];n.push(t),e.set(t.provider,n)}for(let[t,n]of e)e.set(t,n.toSorted((e,t)=>e.label.localeCompare(t.label)));return Array.from(e.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({provider:e,options:t}))}),Ae=L(()=>{let e=o.config?.defaultPermissionMode;return e===`auto`||e===`yolo`||e===`manual`?e:`manual`});function je(e){if(!e||typeof e!=`object`)return;let t=e;return typeof t.provider==`string`?t.provider:void 0}function Me(e,t,n){if(!t||typeof t!=`object`)return e;let r=t,i=typeof r.model==`string`?r.model:void 0,a=n??je(t);return i&&a?`${e} (${a}/${i})`:i?`${e} (${i})`:e}function q(e){return e===!0}function Ne(e){!e||e===o.config?.defaultModel||u(`updateConfig`,{defaultModel:e})}function Pe(e){e!==Ae.value&&u(`updateConfig`,{defaultPermissionMode:e})}function Fe(e){let t=o.config?.[e];u(`updateConfig`,{[e]:!q(t)})}function Ie(){let e=o.config?.thinking;return!e||typeof e!=`object`?!0:e.enabled!==!1}function Le(){u(`updateConfig`,{thinking:{enabled:!Ie()}})}function Re(){u(`updateConfig`,{telemetry:o.config?.telemetry===!1})}async function ze(e){e!==d.value&&await Be()&&(d.value=e)}async function Be(){if(!ee.value)return!0;let e=await te({title:n(`providers.unsavedTitle`),message:n(`providers.unsavedBody`),confirmLabel:n(`providers.unsavedDiscard`),cancelLabel:n(`providers.unsavedStay`),variant:`danger`});return e&&(ee.value=!1,I.value+=1),e}async function Ve(){await Be()&&u(`close`)}function He(){return[`App version: ${T.value}`,`Server version: ${O.value}`,`Backend: ${k.value}`,`Server address: ${b}`,`Server ID: ${D.value?.serverId||`-`}`,`User agent: ${typeof navigator>`u`?`-`:navigator.userAgent}`].join(` +`)}async function Ue(){N.value=await Wi(He())}let We=R(!1),Ge=R(!1),Ke=null;function qe(){Ke!==null&&clearTimeout(Ke),Ke=setTimeout(()=>{We.value=!1,Ge.value=!1,Ke=null},1500)}async function Je(){await Wi(O.value)&&(We.value=!0,qe())}async function Ye(){await Wi(b)&&(Ge.value=!0,qe())}let Xe=L(()=>Object.fromEntries((o.models??[]).map(e=>[e.id,e])));function Ze(e){return o.config?.experimental?.[e]===!0}function Qe(e){return D.value?.experimentalFlagStates?.find(t=>t.id===e)??o.experimentalFlagStates?.find(t=>t.id===e)}function $e(e,t){u(`updateConfig`,{experimental:{...o.config?.experimental,[e]:t}})}let et=L(()=>(o.models??[]).filter(e=>e.maxContextSize>0&&(e.capabilities??[]).some(e=>e.trim().toLowerCase().replaceAll(`-`,`_`)===`tool_use`))),tt=L(()=>new Set(et.value.map(e=>e.id))),nt=L(()=>ke.value.map(e=>({provider:e.provider,options:e.options.filter(e=>tt.value.has(e.id))})).filter(e=>e.options.length>0)),rt=L(()=>r?.status.value),it=L(()=>Qe(`expert_talk`)?.enabled??rt.value?.feature===`enabled`),at=R(``),ot=R(``),st=R(``),ct=R(``),lt=R(!1),ut=L(()=>r?.preferredPair.value),dt=L(()=>at.value!==ot.value&&tt.value.has(at.value)&&tt.value.has(ot.value)),ft=L(()=>ut.value?.fusionLeadModelId===at.value&&ut.value?.peerModelId===ot.value&&(ut.value?.fusionLeadThinkingEffort??``)===st.value&&(ut.value?.peerThinkingEffort??``)===ct.value);function pt(){if(lt.value)return;let e=ut.value??rt.value?.config;at.value=e?.fusionLeadModelId??``,ot.value=e?.peerModelId??``,st.value=e?.fusionLeadThinkingEffort??``,ct.value=e?.peerThinkingEffort??``}s([()=>rt.value?.config,()=>ut.value],pt,{immediate:!0,deep:!0});function mt(e){at.value=e.model,st.value=e.effort??``,lt.value=!0}function ht(e){ot.value=e.model,ct.value=e.effort??``,lt.value=!0}async function gt(e){!e&&rt.value?.activation.state===`armed`&&await r?.disarm(),$e(`expert_talk`,e)}async function _t(){!r||!dt.value||(await r.configurePair({fusionLeadModelId:at.value,peerModelId:ot.value,fusionLeadThinkingEffort:st.value||void 0,peerThinkingEffort:ct.value||void 0}),r.error.value===void 0&&(lt.value=!1,pt()))}function vt(e){return tt.value.has(e)}let yt=[`inherit`,`default`,`pool`,`force`],bt=R(`inherit`),xt=R(``),St=R(``),Ct=R(new Set);function wt(e){bt.value=e?.mode??`inherit`,xt.value=e!==void 0&&e.mode!==`inherit`?e.defaultModel:``,St.value=e!==void 0&&e.mode!==`inherit`?e.defaultEffort??``:``,Ct.value=new Set(e?.mode===`pool`?Object.keys(e.models):[])}s(()=>o.subagentModelPolicy?.policy,wt,{immediate:!0,deep:!0});function Tt(){let e=St.value||void 0;switch(bt.value){case`inherit`:return{mode:`inherit`};case`default`:case`force`:return xt.value?{mode:bt.value,defaultModel:xt.value,defaultEffort:e}:void 0;case`pool`:{if(Ct.value.size===0||!Ct.value.has(xt.value))return;let t=Object.fromEntries([...Ct.value].map(e=>[e,``]));return{mode:`pool`,defaultModel:xt.value,models:t,defaultEffort:e}}}}function Et(){let e=Tt();if(e!==void 0){if(e.mode===`inherit`){o.subagentModelPolicy?.policy.mode!==`inherit`&&u(`clearSubagentModelPolicy`);return}u(`saveSubagentModelPolicy`,e)}}function Dt(e){bt.value!==e&&(bt.value=e,e===`pool`&&Ct.value.size===0&&xt.value&&(Ct.value=new Set([xt.value])),Et())}function Ot(e){xt.value=e.model,St.value=e.effort??``,Et()}function kt(e){let t=new Set(Ct.value);t.has(e)?t.delete(e):t.add(e),Ct.value=t,t.has(xt.value)||(xt.value=[...t][0]??``),Et()}function At(e){!Ct.value.has(e)||xt.value===e||(xt.value=e,Et())}function jt(e){return Oe.value.find(t=>t.id===e)?.label??e}function Mt(e){switch(e.mode){case`inherit`:return n(`settings.subagentRouting.summaryInherit`);case`pool`:return`${n(`settings.subagentRouting.mode.pool`)} · ${n(`settings.subagentRouting.summaryPool`,{count:Object.keys(e.models).length,model:jt(e.defaultModel)})}`;default:{let t=e.defaultEffort?` · ${e.defaultEffort}`:``;return`${n(`settings.subagentRouting.mode.${e.mode}`)} · ${jt(e.defaultModel)}${t}`}}}function Nt(e){let t=x6(e);t!==void 0&&u(`setUiFontSize`,t)}let Pt=E7();s(d,e=>{e===`expertOpinion`&&(Pt.refreshAllProviders(),r?.refresh())}),s(()=>Qe(`expert_talk`)?.enabled,()=>{d.value===`expertOpinion`&&r?.refresh()});let Ft=R([]),It=R(!1),Lt=R(!1),Rt=R(``),zt=R(`all`),Bt=R(`archived-desc`);async function Vt(){if(!(It.value||Lt.value)){It.value=!0;try{let e=[],t;for(;;){let n=await Pt.loadArchivedSessions({beforeId:t,pageSize:dPe});if(e.push(...n.items),!n.hasMore||n.items.length===0)break;let r=n.items.at(-1)?.id;if(r===void 0)break;t=r}Ft.value=e,Lt.value=!0}catch(e){console.warn(`loadAllArchived failed`,e)}finally{It.value=!1}}}s(d,e=>{e===`archived`&&!Lt.value&&Vt()});let Ht=L(()=>{let e=new Set;for(let t of Ft.value)e.add(t.cwd);return Array.from(e).toSorted((e,t)=>e.localeCompare(t))}),Ut=L(()=>{let e=Rt.value.trim().toLowerCase(),t=Ft.value.filter(e=>e.archived===!0);return zt.value!==`all`&&(t=t.filter(e=>e.cwd===zt.value)),e&&(t=t.filter(t=>t.title.toLowerCase().includes(e))),Bt.value===`archived-desc`?t.toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt)):Bt.value===`created-desc`?t.toSorted((e,t)=>t.createdAt.localeCompare(e.createdAt)):t.toSorted((e,t)=>e.title.localeCompare(t.title,`en`))}),Wt=L(()=>{let e=new Map;for(let t of Ut.value){let n=e.get(t.cwd)??[];n.push(t),e.set(t.cwd,n)}return Array.from(e.entries()).map(([e,t])=>({cwd:e,items:t}))});async function Gt(e){await Pt.restoreSession(e)&&(Ft.value=Ft.value.filter(t=>t.id!==e))}function Kt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}return(t,o)=>(c(),P(Bf,{open:!0,"close-on-esc":!1,title:z(n)(`settings.title`),size:`xl`,height:`fixed`,padded:!1,onClose:Ve},{default:B(()=>[F(`div`,{ref_key:`dialogRef`,ref:ae,class:`sd`},[F(`nav`,{class:`settings-tabs`,role:`tablist`,"aria-label":z(n)(`settings.title`)},[(c(),W(M,null,_(y,e=>F(`button`,{key:e.id,type:`button`,class:V([`tab`,{on:d.value===e.id}]),role:`tab`,"aria-selected":d.value===e.id,onClick:t=>ze(e.id)},[v(X,{name:e.icon,size:`sm`},null,8,[`name`]),K(` `+U(z(n)(e.labelKey)),1)],10,EAe)),64))],8,TAe),F(`div`,DAe,[l(F(`section`,OAe,[F(`section`,kAe,[F(`h3`,AAe,U(z(n)(`settings.appearance`)),1),F(`div`,jAe,[F(`span`,MAe,U(z(n)(`theme.colorSchemeLabel`)),1),v(o6,{"model-value":e.colorScheme,options:[{value:`light`,label:z(n)(`theme.light`)},{value:`dark`,label:z(n)(`theme.dark`)},{value:`system`,label:z(n)(`theme.system`)}],"onUpdate:modelValue":o[0]||=e=>u(`setColorScheme`,e)},null,8,[`model-value`,`options`])]),F(`div`,NAe,[F(`span`,PAe,U(z(n)(`theme.accentLabel`)),1),v(o6,{"model-value":e.accent,options:[{value:`blue`,label:z(n)(`theme.accentBlue`)},{value:`mono`,label:z(n)(`theme.accentBlack`)}],"onUpdate:modelValue":o[1]||=e=>u(`setAccent`,e)},null,8,[`model-value`,`options`])]),F(`div`,FAe,[F(`span`,IAe,U(z(n)(`settings.uiFontSize`)),1),v(o6,{"model-value":f.value,options:z(h6),"aria-label":z(n)(`settings.uiFontSize`),"onUpdate:modelValue":Nt},null,8,[`model-value`,`options`,`aria-label`])])]),F(`section`,LAe,[F(`h3`,RAe,U(z(n)(`settings.messageFolding`)),1),F(`div`,zAe,[F(`span`,BAe,[K(U(z(n)(`settings.turnFolding`))+` `,1),F(`span`,VAe,U(z(n)(`settings.turnFoldingHint`)),1)]),v(E9,{"model-value":e.turnFolding??!0,label:z(n)(`settings.turnFolding`),"onUpdate:modelValue":o[2]||=e=>u(`setTurnFolding`,e)},null,8,[`model-value`,`label`])]),F(`div`,HAe,[F(`span`,UAe,[K(U(z(n)(`settings.activityRunFolding`))+` `,1),F(`span`,WAe,U(z(n)(`settings.activityRunFoldingHint`)),1)]),v(E9,{"model-value":e.activityRunFolding??!0,label:z(n)(`settings.activityRunFolding`),"onUpdate:modelValue":o[3]||=e=>u(`setActivityRunFolding`,e)},null,8,[`model-value`,`label`])])]),F(`section`,GAe,[F(`h3`,KAe,U(z(n)(`settings.notifications`)),1),F(`div`,qAe,[F(`span`,JAe,[K(U(z(n)(`settings.notifyOnComplete`))+` `,1),e.notifyPermission===`denied`?(c(),W(`span`,YAe,U(z(n)(`settings.notifyDenied`)),1)):E(``,!0)]),v(E9,{"model-value":e.notify,disabled:e.notifyPermission===`denied`,label:z(n)(`settings.notifyOnComplete`),"onUpdate:modelValue":o[4]||=e=>u(`setNotify`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,XAe,[F(`span`,ZAe,[K(U(z(n)(`settings.notifyOnQuestion`))+` `,1),e.notifyPermission===`denied`?(c(),W(`span`,QAe,U(z(n)(`settings.notifyDenied`)),1)):E(``,!0)]),v(E9,{"model-value":e.notifyQuestion,disabled:e.notifyPermission===`denied`,label:z(n)(`settings.notifyOnQuestion`),"onUpdate:modelValue":o[5]||=e=>u(`setNotifyQuestion`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,$Ae,[F(`span`,eje,[K(U(z(n)(`settings.notifyOnApproval`))+` `,1),e.notifyPermission===`denied`?(c(),W(`span`,tje,U(z(n)(`settings.notifyDenied`)),1)):E(``,!0)]),v(E9,{"model-value":e.notifyApproval,disabled:e.notifyPermission===`denied`,label:z(n)(`settings.notifyOnApproval`),"onUpdate:modelValue":o[6]||=e=>u(`setNotifyApproval`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,nje,[F(`span`,rje,U(z(n)(`settings.soundOnComplete`)),1),v(E9,{"model-value":e.sound,label:z(n)(`settings.soundOnComplete`),"onUpdate:modelValue":o[7]||=e=>u(`setSound`,e)},null,8,[`model-value`,`label`])])])],512),[[A,d.value===`general`]]),l(F(`section`,ije,[F(`section`,aje,[F(`h3`,oje,U(z(n)(`settings.account`)),1),F(`div`,sje,[F(`span`,cje,U(e.authReady?z(n)(`settings.providers`):z(n)(`sidebar.notSignedIn`)),1),v(Sp,{text:e.accountModel},{default:B(()=>[e.authReady&&e.accountModel?(c(),W(`span`,lje,U(e.accountModel),1)):E(``,!0)]),_:1},8,[`text`])]),F(`div`,uje,[v(pD,{variant:`secondary`,size:`sm`,onClick:o[8]||=e=>{u(`openOnboarding`),u(`close`)}},{default:B(()=>[K(U(z(n)(`onboarding.reopen`)),1)]),_:1}),v(pD,{variant:`primary`,size:`sm`,onClick:o[9]||=e=>ze(`providers`)},{default:B(()=>[K(U(z(n)(`settings.manageProviders`)),1)]),_:1})])])],512),[[A,d.value===`account`]]),l(F(`section`,dje,[v(Pke,{"discard-token":I.value,onDirtyChange:o[10]||=e=>ee.value=e},null,8,[`discard-token`])],512),[[A,d.value===`providers`]]),l(F(`section`,fje,[v(wAe)],512),[[A,d.value===`plugins`]]),l(F(`section`,pje,[F(`section`,mje,[F(`div`,hje,[F(`h3`,gje,U(z(n)(`settings.agentDefaults`)),1),e.configSaving?(c(),W(`span`,_je,U(z(n)(`settings.saving`)),1)):E(``,!0)]),e.config?(c(),W(M,{key:0},[F(`div`,vje,[F(`span`,yje,[K(U(z(n)(`settings.defaultModel`))+` `,1),F(`span`,bje,U(z(n)(`settings.defaultModelHint`)),1)]),ke.value.length>0?(c(),W(`div`,xje,[v(D9,{"model-value":e.config.defaultModel??``,disabled:e.configSaving,"aria-label":z(n)(`settings.defaultModel`),"onUpdate:modelValue":Ne},{default:B(()=>[e.config.defaultModel?E(``,!0):(c(),W(`option`,Sje,U(z(n)(`settings.noDefaultModel`)),1)),(c(!0),W(M,null,_(ke.value,e=>(c(),W(`optgroup`,{key:e.provider,label:e.provider},[(c(!0),W(M,null,_(e.options,e=>(c(),W(`option`,{key:e.id,value:e.id},U(e.label),9,wje))),128))],8,Cje))),128))]),_:1},8,[`model-value`,`disabled`,`aria-label`])])):(c(),W(`span`,Tje,U(e.config.defaultModel??z(n)(`settings.noDefaultModel`)),1))]),e.subagentModelPolicy?(c(),W(`section`,Eje,[F(`h3`,Dje,U(z(n)(`settings.subagentRouting.title`)),1),F(`div`,{class:`routing-modes`,role:`radiogroup`,"aria-label":z(n)(`settings.subagentRouting.title`)},[(c(),W(M,null,_(yt,t=>F(`label`,{key:t,class:V([`routing-mode`,{on:bt.value===t}])},[F(`input`,{type:`radio`,name:`subagent-routing-mode`,value:t,checked:bt.value===t,disabled:e.subagentModelPolicySaving,onChange:e=>Dt(t)},null,40,kje),F(`span`,Aje,U(z(n)(`settings.subagentRouting.mode.${t}`)),1),F(`span`,jje,U(z(n)(`settings.subagentRouting.modeHint.${t}`)),1)],2)),64))],8,Oje),bt.value==="default"||bt.value===`force`?(c(),W(`div`,Mje,[F(`span`,Nje,[K(U(z(n)(`settings.subagentRouting.model`))+` `,1),F(`span`,Pje,U(z(n)(`settings.subagentRouting.modelHint`)),1)]),ke.value.length>0?(c(),P(k7,{key:0,"model-value":xt.value,effort:St.value,groups:ke.value,"model-info-by-id":Xe.value,disabled:e.subagentModelPolicySaving,onInherit:o[11]||=e=>Dt(`inherit`),onSelect:Ot},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`disabled`])):(c(),W(`span`,Fje,U(z(n)(`settings.noSecondaryModel`)),1))])):bt.value===`pool`?(c(),W(`div`,Ije,[F(`span`,Lje,[K(U(z(n)(`settings.subagentRouting.pool`))+` `,1),F(`span`,Rje,U(z(n)(`settings.subagentRouting.poolHint`)),1)]),F(`div`,zje,[(c(!0),W(M,null,_(Oe.value,t=>(c(),W(`label`,{key:t.id,class:`pool-item`},[F(`input`,{type:`checkbox`,value:t.id,checked:Ct.value.has(t.id),disabled:e.subagentModelPolicySaving,onChange:e=>kt(t.id)},null,40,Bje),F(`span`,Vje,U(t.label),1),F(`button`,{type:`button`,class:V([`pool-default`,{on:xt.value===t.id}]),disabled:!Ct.value.has(t.id)||e.subagentModelPolicySaving,onClick:e=>At(t.id)},U(xt.value===t.id?z(n)(`settings.subagentRouting.poolDefault`):z(n)(`settings.subagentRouting.makeDefault`)),11,Hje)]))),128))])])):E(``,!0),F(`div`,Uje,[F(`span`,Wje,[K(U(z(n)(`settings.subagentRouting.saved`))+` `,1),F(`span`,Gje,U(Mt(e.subagentModelPolicy.configuredPolicy)),1)]),F(`span`,Kje,[K(U(z(n)(`settings.subagentRouting.effective`))+` `,1),F(`span`,qje,U(Mt(e.subagentModelPolicy.effectivePolicy)),1)]),e.subagentModelPolicy.feature.enabled?E(``,!0):(c(),W(`span`,Jje,U(z(n)(`settings.subagentRouting.featureDisabled`)),1))])])):E(``,!0),F(`div`,Yje,[F(`span`,Xje,[K(U(z(n)(`settings.defaultPermission`))+` `,1),F(`span`,Zje,U(z(n)(`settings.defaultPermissionHint`)),1)]),v(o6,{"model-value":Ae.value,options:re.map(e=>({value:e,label:z(n)(ie[e])})),"onUpdate:modelValue":o[12]||=e=>Pe(e)},null,8,[`model-value`,`options`])]),F(`div`,Qje,[F(`span`,$je,[K(U(z(n)(`settings.defaultThinking`))+` `,1),F(`span`,eMe,U(z(n)(`settings.defaultThinkingHint`)),1)]),v(E9,{"model-value":Ie(),disabled:e.configSaving,label:z(n)(`settings.defaultThinking`),"onUpdate:modelValue":o[13]||=e=>Le()},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,tMe,[F(`span`,nMe,[K(U(z(n)(`settings.defaultPlanMode`))+` `,1),F(`span`,rMe,U(z(n)(`settings.defaultPlanModeHint`)),1)]),v(E9,{"model-value":q(e.config.defaultPlanMode),disabled:e.configSaving,label:z(n)(`settings.defaultPlanMode`),"onUpdate:modelValue":o[14]||=e=>Fe(`defaultPlanMode`)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,iMe,[F(`span`,aMe,[K(U(z(n)(`settings.mergeSkills`))+` `,1),F(`span`,oMe,U(z(n)(`settings.mergeSkillsHint`)),1)]),v(E9,{"model-value":q(e.config.mergeAllAvailableSkills),disabled:e.configSaving,label:z(n)(`settings.mergeSkills`),"onUpdate:modelValue":o[15]||=e=>Fe(`mergeAllAvailableSkills`)},null,8,[`model-value`,`disabled`,`label`])])],64)):(c(),W(`div`,sMe,U(z(n)(`settings.configUnavailable`)),1))])],512),[[A,d.value===`agent`]]),l(F(`section`,cMe,[F(`section`,lMe,[F(`div`,uMe,[F(`h3`,dMe,U(z(n)(`settings.expertOpinion.title`)),1),e.configSaving||z(r)?.busy.value?(c(),W(`span`,fMe,U(z(n)(`settings.saving`)),1)):E(``,!0)]),F(`div`,pMe,[F(`span`,mMe,[K(U(z(n)(`settings.expertOpinion.enabled`))+` `,1),F(`span`,hMe,U(z(n)(`settings.expertOpinion.enabledHint`)),1),Qe(`expert_talk`)?.externallyControlled?(c(),W(`span`,gMe,U(z(n)(`settings.lab.environmentControlled`)),1)):E(``,!0),Qe(`expert_talk`)?.overridden?(c(),W(`span`,_Me,U(z(n)(`settings.lab.savedSettingOverridden`)),1)):E(``,!0)]),v(E9,{"data-testid":`expert-opinion-enabled`,"model-value":Ze(`expert_talk`),disabled:e.configSaving||!e.config,label:z(n)(`settings.expertOpinion.enabled`),"onUpdate:modelValue":gt},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,vMe,[F(`span`,yMe,[K(U(z(n)(`settings.expertOpinion.showReasoning`))+` `,1),F(`span`,bMe,U(z(n)(`settings.expertOpinion.showReasoningHint`)),1)]),v(E9,{"data-testid":`expert-opinion-show-reasoning`,"model-value":z(i),label:z(n)(`settings.expertOpinion.showReasoning`),"onUpdate:modelValue":z(a)},null,8,[`model-value`,`label`,`onUpdate:modelValue`])]),k.value!==`v2`||!z(r)?(c(),P(e9,{key:0,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.unavailable`)),1)]),_:1})):(c(),W(M,{key:1},[et.value.length<2?(c(),P(e9,{key:0,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.modelsRequired`)),1)]),_:1})):E(``,!0),F(`div`,xMe,[v(O7,{label:z(n)(`settings.expertOpinion.lead`),hint:z(n)(`settings.expertOpinion.leadHint`)},{default:B(()=>[v(k7,{"data-testid":`expert-opinion-lead`,"model-value":at.value,effort:st.value,groups:nt.value,"model-info-by-id":Xe.value,"allow-empty":!1,"empty-label":z(n)(`settings.expertOpinion.selectModel`),"aria-label":z(n)(`settings.expertOpinion.lead`),disabled:!it.value||z(r).busy.value,onSelect:mt},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`]),v(X,{class:`expert-opinion-arrow`,name:`chevron-right`,size:`md`}),v(O7,{label:z(n)(`settings.expertOpinion.peer`),hint:z(n)(`settings.expertOpinion.peerHint`)},{default:B(()=>[v(k7,{"data-testid":`expert-opinion-peer`,"model-value":ot.value,effort:ct.value,groups:nt.value,"model-info-by-id":Xe.value,"allow-empty":!1,"empty-label":z(n)(`settings.expertOpinion.selectModel`),"aria-label":z(n)(`settings.expertOpinion.peer`),disabled:!it.value||z(r).busy.value,onSelect:ht},null,8,[`model-value`,`effort`,`groups`,`model-info-by-id`,`empty-label`,`aria-label`,`disabled`])]),_:1},8,[`label`,`hint`])]),at.value&&!vt(at.value)?(c(),P(e9,{key:1,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.missingModel`,{id:at.value})),1)]),_:1})):E(``,!0),ot.value&&!vt(ot.value)?(c(),P(e9,{key:2,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.missingModel`,{id:ot.value})),1)]),_:1})):E(``,!0),at.value&&ot.value&&at.value===ot.value?(c(),P(e9,{key:3,variant:`warning`},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.distinctRequired`)),1)]),_:1})):rt.value?.config&&!lt.value&&rt.value.pairValidation.reason?(c(),P(e9,{key:4,variant:`warning`},{default:B(()=>[K(U(rt.value.pairValidation.reason),1)]),_:1})):E(``,!0),v(e9,null,{default:B(()=>[K(U(z(n)(`expertTalk.disclosure`)),1)]),_:1}),F(`div`,SMe,[v(pD,{"data-testid":`expert-opinion-save`,variant:`primary`,size:`sm`,disabled:!it.value||!dt.value||z(r).busy.value,onClick:_t},{default:B(()=>[K(U(z(n)(`settings.expertOpinion.savePair`)),1)]),_:1},8,[`disabled`]),ft.value?(c(),W(`span`,CMe,U(z(n)(`settings.expertOpinion.saved`)),1)):E(``,!0)])],64))])],512),[[A,d.value===`expertOpinion`]]),l(F(`section`,wMe,[F(`section`,TMe,[F(`h3`,EMe,U(z(n)(`settings.versionAndUpdates`)),1),F(`div`,DMe,[F(`span`,OMe,[K(U(z(n)(`settings.appVersion`))+` `,1),F(`span`,kMe,U(z(n)(`settings.appVersionHint`)),1)]),F(`span`,AMe,U(T.value),1)]),F(`div`,jMe,[F(`span`,MMe,[K(U(z(n)(`settings.serverVersion`))+` `,1),F(`span`,NMe,U(z(n)(`settings.serverVersionHint`)),1)]),F(`span`,PMe,[F(`span`,FMe,U(O.value),1),v(Ca,{size:`sm`,label:We.value?z(n)(`settings.copied`):z(n)(`settings.copyServerVersion`),"data-testid":`copy-server-version`,onClick:Je},{default:B(()=>[v(X,{name:We.value?`check`:`copy`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),F(`div`,IMe,[F(`span`,LMe,[K(U(z(n)(`settings.serverAddress`))+` `,1),F(`span`,RMe,U(z(n)(`settings.serverAddressHint`)),1)]),F(`span`,zMe,[F(`span`,BMe,U(z(b)),1),v(Ca,{size:`sm`,label:Ge.value?z(n)(`settings.copied`):z(n)(`settings.copyServerAddress`),"data-testid":`copy-server-address`,onClick:Ye},{default:B(()=>[v(X,{name:Ge.value?`check`:`copy`,size:`sm`},null,8,[`name`])]),_:1},8,[`label`])])]),F(`div`,VMe,[F(`span`,HMe,U(z(n)(`settings.backend`)),1),F(`span`,UMe,U(j.value),1)])]),e.config?(c(),W(`section`,WMe,[e.config?(c(),W(`div`,GMe,[F(`span`,KMe,[K(U(z(n)(`settings.telemetry`))+` `,1),F(`span`,qMe,U(z(n)(`settings.telemetryHint`)),1),F(`span`,JMe,U(z(n)(`settings.telemetryRestartHint`)),1)]),v(E9,{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:z(n)(`settings.telemetry`),"onUpdate:modelValue":o[16]||=e=>Re()},null,8,[`model-value`,`disabled`,`label`])])):E(``,!0)])):E(``,!0),F(`section`,YMe,[F(`h3`,XMe,U(z(n)(`settings.diagnostics`)),1),F(`div`,ZMe,[F(`span`,QMe,[K(U(z(n)(`settings.exportLog`))+` `,1),z(AS)()?E(``,!0):(c(),W(`span`,$Me,U(z(n)(`settings.logHint`)),1))]),v(pD,{variant:`secondary`,size:`sm`,onClick:De},{default:B(()=>[K(U(z(n)(`settings.exportLogBtn`)),1)]),_:1})]),F(`div`,eNe,[F(`span`,tNe,U(z(n)(`settings.copyDetails`)),1),v(pD,{"data-testid":`copy-diagnostics`,variant:`secondary`,size:`sm`,onClick:Ue},{default:B(()=>[K(U(N.value?z(n)(`settings.copied`):z(n)(`settings.copyDetails`)),1)]),_:1})])])],512),[[A,d.value===`advanced`]]),l(F(`section`,nNe,[z(g)?(c(),W(`section`,rNe,[F(`h3`,iNe,U(z(n)(`settings.tabs.update`)),1),F(`div`,aNe,[F(`div`,oNe,[F(`div`,sNe,[F(`span`,cNe,[v(X,{name:`update-button`})]),F(`span`,lNe,[F(`span`,uNe,U(se.value),1),F(`span`,dNe,U(H.value),1)])]),v(pD,{"data-testid":`settings-check-update`,variant:`secondary`,size:`sm`,loading:x.value?.status===`checking`,disabled:fe.value,onClick:ye},{default:B(()=>[K(U(z(n)(`settings.desktop.checkNow`)),1)]),_:1},8,[`loading`,`disabled`])]),F(`div`,fNe,[F(`span`,pNe,[K(U(z(n)(`settings.desktop.updateChannel`))+` `,1),F(`span`,mNe,U(z(n)(`settings.desktop.updateChannelHint`)),1)]),F(`div`,hNe,[v(D9,{"data-testid":`desktop-update-channel`,size:`sm`,"model-value":x.value?.channel??`stable`,disabled:ue.value,"aria-label":z(n)(`settings.desktop.updateChannel`),"onUpdate:modelValue":_e},{default:B(()=>[(c(),W(M,null,_(le,e=>F(`option`,{key:e,value:e},U(z(n)(`settings.desktop.channels.${e}`)),9,gNe)),64))]),_:1},8,[`model-value`,`disabled`,`aria-label`])])]),F(`div`,_Ne,[F(`span`,vNe,[K(U(z(n)(`settings.desktop.automaticChecks`))+` `,1),F(`span`,yNe,U(z(n)(`settings.desktop.automaticChecksHint`)),1)]),v(E9,{"data-testid":`automatic-update-checks`,"model-value":x.value?.autoUpdate??!1,disabled:S.value||x.value===void 0||x.value.status===`disabled`,label:z(n)(`settings.desktop.automaticChecks`),"onUpdate:modelValue":ge},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,bNe,[F(`span`,xNe,[K(U(z(n)(`settings.desktop.notifyUpdates`))+` `,1),F(`span`,SNe,U(z(n)(`settings.desktop.notifyUpdatesHint`)),1)]),v(E9,{"data-testid":`update-notifications`,"model-value":x.value?.notifyUpdate??!0,disabled:S.value||x.value===void 0,label:z(n)(`settings.desktop.notifyUpdates`),"onUpdate:modelValue":ve},null,8,[`model-value`,`disabled`,`label`])]),x.value?.status===`downloading`||me.value||x.value?.availableVersion?(c(),W(`div`,CNe,[x.value?.status===`downloading`?(c(),W(`div`,wNe,[ce.value===void 0?(c(),W(`progress`,{key:0,"data-testid":`settings-update-progress`,max:`100`,"aria-label":z(n)(`settings.desktop.progressLabel`)},null,8,TNe)):(c(),W(`progress`,{key:1,"data-testid":`settings-update-progress`,value:ce.value,max:`100`,"aria-label":z(n)(`settings.desktop.progressLabel`)},null,8,ENe)),F(`span`,DNe,U(pe.value||z(n)(`settings.desktop.fetching`)),1)])):E(``,!0),me.value?(c(),P(e9,{key:1,variant:`danger`},{default:B(()=>[K(U(me.value),1)]),_:1})):E(``,!0),F(`div`,ONe,[x.value?.availableVersion?(c(),P(pD,{key:0,variant:`ghost`,size:`sm`,disabled:S.value,onClick:Ce},{default:B(()=>[K(U(z(n)(`settings.desktop.viewNotes`)),1)]),_:1},8,[`disabled`])):E(``,!0),x.value?.status===`available`?(c(),P(pD,{key:1,variant:`ghost`,size:`sm`,disabled:S.value,onClick:xe},{default:B(()=>[K(U(z(n)(`settings.desktop.skip`)),1)]),_:1},8,[`disabled`])):E(``,!0),x.value?.status===`available`||x.value?.status===`error`&&x.value.availableVersion?(c(),P(pD,{key:2,"data-testid":`settings-download-update`,size:`sm`,loading:S.value,onClick:be},{default:B(()=>[K(U(x.value?.status===`error`?z(n)(`settings.desktop.retryDownload`):z(n)(`settings.desktop.download`)),1)]),_:1},8,[`loading`])):E(``,!0),x.value?.status===`skipped`?(c(),P(pD,{key:3,size:`sm`,loading:S.value,onClick:Se},{default:B(()=>[K(U(z(n)(`settings.desktop.undoSkip`)),1)]),_:1},8,[`loading`])):E(``,!0),x.value?.status===`downloaded`?(c(),P(pD,{key:4,"data-testid":`settings-restart-update`,size:`sm`,loading:S.value,onClick:we},{default:B(()=>[K(U(z(n)(`settings.desktop.restartToUpdate`)),1)]),_:1},8,[`loading`])):E(``,!0)])])):E(``,!0)])])):E(``,!0)],512),[[A,d.value===`update`]]),l(F(`section`,kNe,[F(`section`,ANe,[F(`h3`,jNe,U(z(n)(`settings.tabs.lab`)),1),F(`div`,MNe,[F(`span`,NNe,[K(U(z(n)(`settings.conversationToc`))+` `,1),F(`span`,PNe,U(z(n)(`settings.conversationTocHint`)),1)]),v(E9,{"model-value":e.conversationToc??!0,label:z(n)(`settings.conversationToc`),"onUpdate:modelValue":o[17]||=e=>u(`setConversationToc`,e)},null,8,[`model-value`,`label`])]),e.config?(c(),W(M,{key:0},[F(`div`,FNe,[F(`span`,INe,[K(U(z(n)(`settings.lab.sidebarTabs`))+` `,1),F(`span`,LNe,U(z(n)(`settings.lab.sidebarTabsHint`)),1),Qe(`sidebarTabs`)?.externallyControlled?(c(),W(`span`,RNe,U(z(n)(`settings.lab.environmentControlled`)),1)):E(``,!0),Qe(`sidebarTabs`)?.overridden?(c(),W(`span`,zNe,U(z(n)(`settings.lab.savedSettingOverridden`)),1)):E(``,!0)]),v(E9,{"model-value":Ze(`sidebarTabs`),disabled:e.configSaving,label:z(n)(`settings.lab.sidebarTabs`),"onUpdate:modelValue":o[18]||=e=>$e(`sidebarTabs`,e)},null,8,[`model-value`,`disabled`,`label`])]),F(`div`,BNe,[F(`span`,VNe,[K(U(z(n)(`settings.lab.secondaryModel`))+` `,1),F(`span`,HNe,U(z(n)(`settings.lab.secondaryModelHint`)),1),Qe(`secondary-model`)?.externallyControlled?(c(),W(`span`,UNe,U(z(n)(`settings.lab.environmentControlled`)),1)):E(``,!0),Qe(`secondary-model`)?.overridden?(c(),W(`span`,WNe,U(z(n)(`settings.lab.savedSettingOverridden`)),1)):E(``,!0)]),v(E9,{"model-value":Ze(`secondary-model`),disabled:e.configSaving,label:z(n)(`settings.lab.secondaryModel`),"onUpdate:modelValue":o[19]||=e=>$e(`secondary-model`,e)},null,8,[`model-value`,`disabled`,`label`])])],64)):(c(),W(`div`,GNe,U(z(n)(`settings.configUnavailable`)),1))])],512),[[A,d.value===`lab`]]),l(F(`section`,KNe,[F(`div`,qNe,[o[23]||=F(`div`,{class:`panel-kicker`},`Archived sessions`,-1),F(`h4`,JNe,U(z(n)(`settings.archivedTitle`)),1),F(`p`,YNe,U(z(n)(`settings.archivedDesc`)),1)]),F(`div`,XNe,[F(`label`,ZNe,[o[24]||=F(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[F(`circle`,{cx:`11`,cy:`11`,r:`7`}),F(`path`,{d:`m21 21-4.3-4.3`})],-1),l(F(`input`,{"onUpdate:modelValue":o[20]||=e=>Rt.value=e,placeholder:z(n)(`settings.archivedSearch`)},null,8,QNe),[[de,Rt.value]])]),v(D9,{"model-value":zt.value,size:`sm`,"aria-label":z(n)(`settings.archivedAllWorkspaces`),"onUpdate:modelValue":o[21]||=e=>zt.value=e},{default:B(()=>[F(`option`,$Ne,U(z(n)(`settings.archivedAllWorkspaces`)),1),(c(!0),W(M,null,_(Ht.value,e=>(c(),W(`option`,{key:e,value:e},U(e),9,ePe))),128))]),_:1},8,[`model-value`,`aria-label`]),v(o6,{size:`sm`,"model-value":Bt.value,options:[{value:`archived-desc`,label:z(n)(`settings.archivedSortArchived`)},{value:`created-desc`,label:z(n)(`settings.archivedSortCreated`)},{value:`name-asc`,label:z(n)(`settings.archivedSortName`)}],"onUpdate:modelValue":o[22]||=e=>Bt.value=e},null,8,[`model-value`,`options`])]),It.value?(c(),W(`div`,tPe,U(z(n)(`settings.archivedLoadingAll`)),1)):(c(),W(M,{key:1},[Wt.value.length>0?(c(),W(`div`,nPe,[(c(!0),W(M,null,_(Wt.value,e=>(c(),W(`section`,{key:e.cwd,class:`archive-card`},[F(`div`,rPe,[o[25]||=F(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[F(`path`,{d:`M3 7h6l2 2h10v9H3z`}),F(`path`,{d:`M3 7V5h6l2 2`})],-1),F(`span`,iPe,U(e.cwd),1),F(`span`,aPe,U(z(n)(`settings.archivedSessionsCount`,{count:e.items.length})),1)]),F(`div`,oPe,[(c(!0),W(M,null,_(e.items,e=>(c(),W(`div`,{key:e.id,class:`archive-row`},[F(`div`,sPe,[F(`div`,cPe,U(e.title),1),F(`div`,lPe,U(z(n)(`settings.archivedAt`,{time:Kt(e.updatedAt)})),1)]),v(pD,{variant:`secondary`,size:`sm`,onClick:t=>Gt(e.id)},{default:B(()=>[K(U(z(n)(`settings.archivedRestore`)),1)]),_:1},8,[`onClick`])]))),128))])]))),128))])):(c(),W(`div`,uPe,U(Ft.value.length===0?z(n)(`settings.archivedEmpty`):z(n)(`settings.archivedNoMatch`)),1))],64))],512),[[A,d.value===`archived`]])])],512)]),_:1},8,[`title`]))}}),[[`__scopeId`,`data-v-bfc35ea3`]]),pPe=/^(?:\/|~(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/,I9=/^[A-Za-z]:[\\/]/,mPe=/^\/\/(?!\/)/;function L9(e){return pPe.test(e.trim())}function R9(e,t){return e===`~`?t||e:e.startsWith(`~/`)?(t||`~`)+e.slice(1):e}function hPe(e){return mPe.test(e)?`//${e.slice(2).replaceAll(/\/{2,}/g,`/`)}`:e.replaceAll(/\/{2,}/g,`/`)}function gPe(e){return I9.test(e)||e.startsWith(`\\\\`)||e.startsWith(`//`)}function _Pe(e){return I9.test(e)?3:e.startsWith(`\\\\`)||e.startsWith(`//`)?2:+!!e.startsWith(`/`)}function z9(e,t){let n=hPe(R9(e.trim(),t)),r=gPe(n),i=n===`/`||n===`//`||n===`\\\\`||/^[A-Za-z]:[\\/]$/.test(n),a=r?/[\\/]$/.test(n):n.endsWith(`/`);!i&&a&&(n=n.slice(0,-1));let o=n.lastIndexOf(`/`),s=r?n.lastIndexOf(`\\`):-1,c=Math.max(o,s),l=s>o?`\\`:`/`,u=_Pe(n),d=cg.value.trim().length>0),S=0,C=null,w=L(()=>L9(g.value)),T=R(`idle`),D=R(``),O=R(`/`),k=R([]),A=R(``),j=R(null),N=R(null),ee=L(()=>T.value===`valid`?yPe(g.value,A.value,N.value):null),I=0,te=null;function ne(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e0&&s=B9))break;e.depth+1{C&&clearTimeout(C),te&&clearTimeout(te),I++,T.value=`idle`,k.value=[],N.value=null;let t=e.trim();if(t===``){S++,b.value=[],y.value=!1;return}if(L9(t)){if(S++,b.value=[],y.value=!1,u.value)return;T.value=`checking`,te=setTimeout(()=>void ie(t),150);return}C=setTimeout(()=>void re(e),220)});async function ie(e){let t=++I;T.value=`checking`,N.value=null;let n=z9(e,A.value),{target:i}=n;try{let e=await r.browseFs(i);if(t!==I)return;if(e.path){T.value=`valid`,k.value=[],N.value=i,d.value=e.path,f.value=e.parent,m.value=e.entries,u.value=!1;return}}catch{}if(t!==I)return;let a=n.base.toLowerCase();D.value=n.parent,O.value=n.separator;try{let e=await r.browseFs(n.parent);if(t!==I)return;if(e.path){k.value=e.entries.filter(e=>e.isDir&&e.name.toLowerCase().startsWith(a)),T.value=`not-found`;return}}catch{}t===I&&(k.value=[],T.value=`bad-parent`)}function ae(e){g.value=vPe(D.value,e,O.value),j.value?.focus()}let oe=L(()=>u.value?n(`workspace.degradedPlaceholder`):n(`workspace.searchPlaceholder`)),se=L(()=>u.value?n(`workspace.degradedHint`):w.value&&T.value===`valid`?n(`workspace.pathFollowHint`):n(`workspace.browseHint`));function ce(e){if(e.key===`Escape`){g.value?g.value=``:i(`close`);return}if(e.key!==`Enter`)return;let t=g.value.trim();if(L9(t)){if(e.preventDefault(),u.value){let{target:e}=z9(t,A.value);e&&i(`add`,e);return}T.value===`valid`?me():T.value===`not-found`&&k.value[0]&&ae(k.value[0].name)}}let le=L(()=>{let e=d.value;if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[{label:`/`,path:`/`}],r=``;for(let e of t)r+=`/${e}`,n.push({label:e,path:r});return n}),ue=L(()=>!(d.value.length===0||w.value&&ee.value===null));async function fe(e){o.value=!0;try{let t=await r.browseFs(e);if(!t.path){u.value=!0;return}d.value=t.path,f.value=t.parent,m.value=t.entries,g.value=``,u.value=!1}catch{u.value=!0}finally{o.value=!1}}function G(e){e.isDir&&fe(e.path)}function pe(){f.value&&fe(f.value)}function me(){ue.value&&i(`add`,ee.value??d.value)}return p(async()=>{o.value=!0;try{let e=await r.getFsHome().catch(()=>({home:``,recentRoots:[]}));if(e.home&&(A.value=e.home),r.defaultPath&&(await fe(r.defaultPath),!u.value))return;A.value?await fe(A.value):u.value=!0}catch{u.value=!0}finally{o.value=!1}}),h(()=>{C&&clearTimeout(C),te&&clearTimeout(te)}),(t,r)=>(c(),P(Bf,{open:a.value,"onUpdate:open":r[2]||=e=>a.value=e,title:z(n)(`workspace.addTitle`),size:`lg`,height:`fixed`,onClose:r[3]||=e=>i(`close`)},{default:B(()=>[F(`div`,bPe,[u.value?E(``,!0):(c(),W(`div`,xPe,[v(Ca,{size:`sm`,disabled:!f.value,label:z(n)(`workspace.up`),onClick:pe},{default:B(()=>[v(X,{name:`arrow-up`,size:`md`})]),_:1},8,[`disabled`,`label`]),F(`div`,SPe,[(c(!0),W(M,null,_(le.value,(e,t)=>(c(),W(M,{key:e.path},[t>1?(c(),W(`span`,CPe,`/`)):E(``,!0),F(`button`,{class:V([`crumb`,{last:t===le.value.length-1}]),onClick:t=>fe(e.path)},U(e.label),11,wPe)],64))),128))])])),!o.value||u.value?(c(),W(`div`,{key:1,class:V([`filterbar`,{"has-error":T.value===`not-found`||T.value===`bad-parent`}])},[v(X,{class:`filter-icon`,name:`search`,size:`md`}),l(F(`input`,{ref_key:`filterEl`,ref:j,"onUpdate:modelValue":r[0]||=e=>g.value=e,class:`filter-input`,type:`text`,placeholder:oe.value,autocomplete:`off`,spellcheck:`false`,onKeydown:H(ce,[`stop`])},null,40,TPe),[[de,g.value]]),y.value||T.value===`checking`?(c(),P(op,{key:0,size:`sm`})):E(``,!0)],2)):E(``,!0),u.value?(c(),W(`div`,VPe,U(z(n)(`workspace.degradedHint`)),1)):(c(),W(`div`,EPe,[o.value?(c(),W(`div`,DPe,U(z(n)(`workspace.browsing`)),1)):w.value&&T.value!==`valid`?(c(),W(M,{key:1},[T.value===`checking`?(c(),W(`div`,OPe,U(z(n)(`workspace.checkingPath`)),1)):T.value===`not-found`?(c(),W(M,{key:1},[k.value.length>0?(c(),W(`div`,kPe,U(z(n)(`workspace.pathPickHint`)),1)):E(``,!0),(c(!0),W(M,null,_(k.value,e=>(c(),W(`button`,{key:e.path,class:`folder-row`,onClick:t=>ae(e.name)},[v(X,{class:`dir-icon`,name:`folder-closed`,size:`sm`}),F(`span`,jPe,U(e.name),1)],8,APe))),128)),k.value.length===0?(c(),W(`div`,MPe,U(z(n)(`workspace.noPathMatch`,{parent:D.value})),1)):E(``,!0)],64)):T.value===`bad-parent`?(c(),W(`div`,NPe,U(z(n)(`workspace.badParent`,{parent:D.value})),1)):E(``,!0)],64)):x.value&&!w.value?(c(),W(M,{key:2},[(c(!0),W(M,null,_(b.value,e=>(c(),W(`button`,{key:e.path,class:`folder-row`,onClick:t=>fe(e.path)},[v(X,{class:`dir-icon`,name:`folder-closed`,size:`sm`}),F(`span`,FPe,U(e.rel),1)],8,PPe))),128)),!y.value&&b.value.length===0?(c(),W(`div`,IPe,U(z(n)(`workspace.noFilterMatch`,{q:g.value.trim()})),1)):y.value&&b.value.length===0?(c(),W(`div`,LPe,U(z(n)(`workspace.searching`)),1)):E(``,!0)],64)):(c(),W(M,{key:3},[(c(!0),W(M,null,_(m.value,e=>(c(),W(`button`,{key:e.path,class:`folder-row`,onClick:t=>G(e)},[v(X,{class:`dir-icon`,name:`folder-closed`,size:`sm`}),F(`span`,zPe,U(e.name),1)],8,RPe))),128)),m.value.length===0?(c(),W(`div`,BPe,U(z(n)(`workspace.noSubfolders`)),1)):E(``,!0)],64))])),e.error?(c(),W(`div`,HPe,U(e.error),1)):E(``,!0),F(`div`,UPe,[v(Sp,{text:d.value},{default:B(()=>[u.value?E(``,!0):(c(),P(pD,{key:0,variant:`primary`,disabled:!ue.value,onClick:me},{default:B(()=>[K(U(z(n)(`workspace.openThisFolder`)),1)]),_:1},8,[`disabled`]))]),_:1},8,[`text`]),v(pD,{variant:`secondary`,onClick:r[1]||=e=>i(`close`)},{default:B(()=>[K(U(z(n)(`workspace.cancel`)),1)]),_:1})]),F(`div`,WPe,U(se.value),1)])]),_:1},8,[`open`,`title`]))}}),[[`__scopeId`,`data-v-09b74e91`]]),JPe={key:0,class:`confirm-dialog__message`},YPe=Y(G({__name:`ConfirmDialog`,props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:`danger`},loading:{type:Boolean}},emits:[`update:open`,`confirm`,`cancel`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J();function a(){n.loading||(r(`update:open`,!1),r(`cancel`))}function o(e){if(e.key!==`Enter`||!n.open||n.loading)return;let t=e.target;t instanceof HTMLButtonElement||t instanceof HTMLAnchorElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLInputElement||(e.preventDefault(),r(`confirm`))}return typeof window<`u`&&window.addEventListener(`keydown`,o),ne(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,o)}),(t,n)=>(c(),P(Bf,{open:e.open,title:e.title,height:`auto`,stacked:``,"initial-focus":`.confirm-dialog__confirm`,"close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":n[1]||=e=>r(`update:open`,e),onClose:a},{foot:B(()=>[v(pD,{variant:`secondary`,disabled:e.loading,onClick:a},{default:B(()=>[K(U(e.cancelLabel??z(i)(`common.cancel`)),1)]),_:1},8,[`disabled`]),v(pD,{class:`confirm-dialog__confirm`,variant:e.variant,loading:e.loading,onClick:n[0]||=e=>r(`confirm`)},{default:B(()=>[K(U(e.confirmLabel??z(i)(`common.confirm`)),1)]),_:1},8,[`variant`,`loading`])]),default:B(()=>[e.message?(c(),W(`p`,JPe,U(e.message),1)):E(``,!0)]),_:1},8,[`open`,`title`,`close-on-esc`,`close-on-overlay`]))}}),[[`__scopeId`,`data-v-e3b26be2`]]),XPe=G({__name:`ConfirmDialogHost`,setup(e){let{current:t,busy:n,settle:r,runAction:i}=G4();function a(){i()}return(e,i)=>(c(),P(YPe,{open:z(t)!==null,title:z(t)?.title??``,message:z(t)?.message,"confirm-label":z(t)?.confirmLabel,"cancel-label":z(t)?.cancelLabel,variant:z(t)?.variant,loading:z(n),onConfirm:a,onCancel:i[0]||=e=>z(r)(!1)},null,8,[`open`,`title`,`message`,`confirm-label`,`cancel-label`,`variant`,`loading`]))}}),ZPe={class:`rows`},QPe={class:`row`},$Pe={class:`row`},eFe={class:`row`},tFe={class:`row`},nFe={class:`row`},rFe={class:`row`},iFe={class:`ctx-text`},aFe={key:0,class:`bar`},oFe={class:`row`},sFe=Y(G({__name:`StatusPanel`,props:{status:{},thinking:{},planMode:{type:Boolean},dynamicWorkflowMode:{type:Boolean},costUsd:{}},emits:[`close`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,a=R(!0),o=L(()=>r.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(r.status.ctxUsed/r.status.ctxMax*100)))),s=L(()=>r.status.ctxMax>0?n(`status.statusContextValue`,{used:yO(r.status.ctxUsed),max:yO(r.status.ctxMax),pct:o.value}):n(`status.statusNone`));function l(e){return n(e===`yolo`?`status.permissionYolo`:e===`auto`?`status.permissionAuto`:`status.permissionManual`)}let u=L(()=>{let e=r.status.permission;return e===`yolo`?`var(--color-warning)`:e===`auto`?`var(--color-danger)`:`var(--color-text)`}),d=L(()=>r.planMode?n(`status.planOn`):n(`status.planOff`)),f=L(()=>r.dynamicWorkflowMode?n(`status.dynamicWorkflowOn`):n(`status.dynamicWorkflowOff`)),p=L(()=>typeof r.costUsd==`number`&&r.costUsd>0),m=L(()=>p.value?`$${r.costUsd.toFixed(4)}`:n(`status.statusNone`));return(t,r)=>(c(),P(Bf,{open:a.value,"onUpdate:open":r[0]||=e=>a.value=e,title:z(n)(`status.statusPanelTitle`),onClose:r[1]||=e=>i(`close`)},{default:B(()=>[F(`dl`,ZPe,[F(`div`,QPe,[F(`dt`,null,U(z(n)(`status.statusModel`)),1),F(`dd`,null,U(e.status.model),1)]),F(`div`,$Pe,[F(`dt`,null,U(z(n)(`status.statusThinking`)),1),F(`dd`,null,U(e.thinking),1)]),F(`div`,eFe,[F(`dt`,null,U(z(n)(`status.statusPermission`)),1),F(`dd`,{style:ae({color:u.value})},U(l(e.status.permission)),5)]),F(`div`,tFe,[F(`dt`,null,U(z(n)(`status.statusPlanMode`)),1),F(`dd`,{class:V({"plan-on":e.planMode})},U(d.value),3)]),F(`div`,nFe,[F(`dt`,null,U(z(n)(`status.statusDynamicWorkflowMode`)),1),F(`dd`,{class:V({"workflow-on":e.dynamicWorkflowMode})},U(f.value),3)]),F(`div`,rFe,[F(`dt`,null,U(z(n)(`status.statusContext`)),1),F(`dd`,null,[F(`span`,iFe,U(s.value),1),e.status.ctxMax>0?(c(),W(`span`,aFe,[F(`i`,{style:ae({width:o.value+`%`})},null,4)])):E(``,!0)])]),F(`div`,oFe,[F(`dt`,null,U(z(n)(`status.statusCost`)),1),F(`dd`,null,U(m.value),1)])])]),_:1},8,[`open`,`title`]))}}),[[`__scopeId`,`data-v-7992546c`]]),cFe={key:0,class:`actions`},lFe=[`onClick`],uFe=[`onClick`],dFe={key:1,class:`details`},fFe=Y(G({__name:`WarningToasts`,props:{warnings:{}},emits:[`dismiss`],setup(e,{emit:t}){let n=e,r=t,{t:i}=J();function a(e){return typeof e==`object`&&!!e}function o(e){return a(e)?e.title:e}function l(e){return a(e)?e.message??``:``}function u(e){return a(e)?e.details:void 0}function d(e){return a(e)?e.severity===`error`:e.startsWith(`${i(`warnings.errorLabel`)}:`)||/\b4\d\d\b|error|failed/i.test(e)}function f(e){if(!a(e))return d(e)?`danger`:`warning`;switch(e.severity){case`error`:case`danger`:return`danger`;case`success`:return`success`;case`info`:return`info`;default:return`warning`}}function p(e){return a(e)?`notice:${e.severity}:${e.title}:${e.message??``}:${JSON.stringify(e.details??[])}`:`text:${e}`}function m(e){if(!a(e))return e;let t=[e.title];e.message&&t.push(e.message);let n=e.details??[];if(n.length>0){t.push(``,`${i(`warnings.diagnostics`)}:`);for(let e of n)t.push(`${e.label}: ${e.value}`)}return t.join(` +`)}let g=1,v=R([]),y=new Map,b=new Map;function x(e){let t=d(e)?12e3:6e3;return typeof window<`u`&&window.matchMedia?.(`(hover: none)`).matches===!0?t+5e3:t}function S(e,t){let n=y.get(e)??{handle:null,deadline:0,remaining:0};n.handle=setTimeout(()=>k(e),t),n.deadline=Date.now()+t,y.set(e,n)}function C(e){let t=y.get(e);t&&t.handle!==null&&clearTimeout(t.handle),y.delete(e)}function w(e){let t=y.get(e);!t||t.handle===null||(clearTimeout(t.handle),t.handle=null,t.remaining=Math.max(0,t.deadline-Date.now()))}function T(e){if(v.value.find(t=>t.id===e)?.detailsOpen)return;let t=y.get(e);!t||t.handle!==null||S(e,t.remaining)}function D(e){e.detailsOpen=!e.detailsOpen,e.detailsOpen?w(e.id):T(e.id)}async function O(e){if(!await Wi(m(e.warning)))return;e.copied=!0;let t=b.get(e.id);t&&clearTimeout(t),b.set(e.id,setTimeout(()=>{e.copied=!1,b.delete(e.id)},1400))}function k(e){C(e);let t=b.get(e);t&&clearTimeout(t),b.delete(e);let n=v.value.findIndex(t=>t.id===e);n!==-1&&(v.value=v.value.filter(t=>t.id!==e),r(`dismiss`,n))}return s(()=>n.warnings,e=>{let t=[...v.value];v.value=e.map(e=>{let n=p(e),r=t.findIndex(e=>e.key===n),i=r===-1?void 0:t.splice(r,1)[0];if(i)return i.warning=e,i;let a={id:g++,key:n,warning:e,detailsOpen:!1,copied:!1};return S(a.id,x(e)),a});for(let e of t){C(e.id);let t=b.get(e.id);t&&clearTimeout(t),b.delete(e.id)}},{immediate:!0,flush:`post`}),h(()=>{y.forEach(e=>{e.handle!==null&&clearTimeout(e.handle)}),y.clear(),b.forEach(e=>clearTimeout(e)),b.clear()}),(e,t)=>(c(),P(le,{name:`toast`,tag:`div`,class:`toasts`,role:`status`,"aria-live":`polite`},{default:B(()=>[(c(!0),W(M,null,_(v.value,e=>(c(),P(F7,{key:e.id,variant:f(e.warning),title:o(e.warning),message:l(e.warning),count:a(e.warning)?e.warning.count:void 0,"dismiss-label":z(i)(`warnings.dismiss`),onDismiss:t=>k(e.id),onPointerenter:t=>w(e.id),onPointerleave:t=>T(e.id)},{default:B(()=>[u(e.warning)?.length?(c(),W(`div`,cFe,[F(`button`,{class:`link`,type:`button`,onClick:t=>D(e)},U(e.detailsOpen?z(i)(`warnings.hideDetails`):z(i)(`warnings.showDetails`)),9,lFe),F(`button`,{class:`link`,type:`button`,onClick:t=>O(e)},U(e.copied?z(i)(`warnings.copied`):z(i)(`warnings.copyDetails`)),9,uFe)])):E(``,!0),e.detailsOpen&&u(e.warning)?.length?(c(),W(`dl`,dFe,[(c(!0),W(M,null,_(u(e.warning),e=>(c(),W(`div`,{key:`${e.label}:${e.value}`,class:`detail-row`},[F(`dt`,null,U(e.label),1),F(`dd`,null,U(e.value),1)]))),128))])):E(``,!0)]),_:2},1032,[`variant`,`title`,`message`,`count`,`dismiss-label`,`onDismiss`,`onPointerenter`,`onPointerleave`]))),128))]),_:1}))}}),[[`__scopeId`,`data-v-ca5c4402`]]),pFe={key:0,class:`window-controls`},mFe=[`aria-label`],hFe=[`aria-label`],gFe=[`aria-label`],_Fe=Y(G({__name:`WindowControls`,setup(e){let{t}=J(),n=L(()=>window.pythinkerDesktop?.platform===`win32`);function r(){window.pythinkerDesktop?.minimizeWindow()}function i(){window.pythinkerDesktop?.toggleMaximizeWindow()}function a(){window.pythinkerDesktop?.closeWindow()}return(e,o)=>n.value?(c(),W(`div`,pFe,[F(`button`,{type:`button`,class:`wc wc-min`,"aria-label":z(t)(`app.minimizeWindow`),onClick:r},[...o[0]||=[F(`svg`,{viewBox:`0 0 10 10`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"aria-hidden":`true`},[F(`path`,{d:`M2.5 5h5`})],-1)]],8,mFe),F(`button`,{type:`button`,class:`wc wc-max`,"aria-label":z(t)(`app.maximizeWindow`),onClick:i},[...o[1]||=[F(`svg`,{viewBox:`0 0 10 10`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linejoin":`round`,"aria-hidden":`true`},[F(`rect`,{x:`2.4`,y:`2.4`,width:`5.2`,height:`5.2`,rx:`1`})],-1)]],8,hFe),F(`button`,{type:`button`,class:`wc wc-close`,"aria-label":z(t)(`app.closeWindow`),onClick:a},[...o[2]||=[F(`svg`,{viewBox:`0 0 10 10`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"aria-hidden":`true`},[F(`path`,{d:`M3 3l4 4M7 3l-4 4`})],-1)]],8,gFe)])):E(``,!0)}}),[[`__scopeId`,`data-v-768f9703`]]),vFe={class:`topbar`},yFe={class:`wsq`},bFe=[`aria-label`],xFe={class:`tb-path`},SFe={class:`ws`},CFe={class:`se`},wFe={class:`tb-sub`},TFe=Y(G({__name:`MobileTopBar`,props:{workspace:{default:null},sessionTitle:{default:``},running:{type:Boolean,default:!1},branch:{default:``},sessionCount:{default:0}},emits:[`openSwitcher`,`openSettings`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,a=L(()=>{let e=r.workspace,t=(e?.name||e?.root||``).trim().charAt(0);return t?t.toUpperCase():`K`}),o=L(()=>r.workspace?.name??n(`workspace.noWorkspace`)),s=L(()=>r.running?n(`mobile.running`):n(`mobile.idle`));return(t,r)=>(c(),W(`div`,vFe,[F(`span`,yFe,U(a.value),1),F(`button`,{type:`button`,class:`tb-mid`,"aria-label":z(n)(`mobile.openSwitcher`),onClick:r[0]||=e=>i(`openSwitcher`)},[F(`span`,xFe,[F(`span`,SFe,U(o.value),1),e.sessionTitle?(c(),W(M,{key:0},[r[2]||=F(`span`,{class:`sl`},`/`,-1),F(`span`,CFe,U(e.sessionTitle),1)],64)):E(``,!0),r[3]||=F(`span`,{class:`cv`},`⌄`,-1)]),F(`span`,wFe,[F(`span`,{class:V([`rd`,{on:e.running}])},null,2),F(`span`,null,U(s.value),1),e.branch?(c(),W(M,{key:0},[K(` · `+U(e.branch),1)],64)):E(``,!0),e.sessionCount>0?(c(),W(M,{key:1},[K(` · `+U(z(n)(`mobile.sessionCount`,{n:e.sessionCount})),1)],64)):E(``,!0)])],8,bFe),v(Ca,{size:`lg`,label:z(n)(`mobile.openSettings`),onClick:r[1]||=e=>i(`openSettings`)},{default:B(()=>[v(X,{name:`sliders`,size:`lg`})]),_:1},8,[`label`])]))}}),[[`__scopeId`,`data-v-27a83eb2`]]),EFe={class:`mlist`},DFe={key:0,class:`mempty`},OFe=[`onClick`],kFe={class:`mgh-main`},AFe={class:`mgh-name`},jFe={class:`mgh-path`},MFe={key:2,class:`att`},NFe={key:0,class:`mempty small`},PFe=[`onClick`],FFe={class:`m`},IFe={class:`s`},LFe={key:0,class:`att`},RFe=[`disabled`,`onClick`],zFe=[`onClick`],BFe=Y(G({__name:`MobileSwitcherSheet`,props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:[`update:modelValue`,`select`,`create`,`createInWorkspace`,`addWorkspace`,`rename`,`archive`,`deleteSession`,`deleteWorkspace`,`loadMore`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t;function a(){i(`update:modelValue`,!1)}function o(e){i(`select`,e),a()}function s(e){i(`createInWorkspace`,e),a()}function u(){i(`create`),a()}function d(){i(`addWorkspace`),a()}let f=R(new Set);function p(e){return f.value.has(e)}function m(e){let t=new Set(f.value);t.has(e)?t.delete(e):t.add(e),f.value=t,C.value=null,k.value=null}let h=R(new Set);function g(e){return h.value.has(e)}function y(e){let t=new Set(h.value);t.has(e)?t.delete(e):t.add(e),h.value=t}function b(e){if(g(e.workspace.id))return e.sessions;let t=e.sessions.slice(0,e.initialCount);if(r.activeId&&!t.some(e=>e.id===r.activeId)){let n=e.sessions.find(e=>e.id===r.activeId);if(n)return[...t,n]}return t}function x(e){if(!h.value.has(e)){let t=new Set(h.value);t.add(e),h.value=t}i(`loadMore`,e)}function S(e){return r.attentionByWorkspace[e]??0}let C=R(null);function w(e){C.value=C.value===e?null:e,k.value=null}function T(e){C.value=null;let t=(typeof window<`u`?window.prompt(n(`sidebar.rename`),e.title):null)?.trim();t&&i(`rename`,e.id,t)}function D(e){C.value=null,i(`archive`,e)}function O(e){C.value=null,i(`deleteSession`,e)}let k=R(null);function j(e){k.value=k.value===e?null:e,C.value=null}function N(e){Wi(e.root),k.value=null}function ee(e){k.value=null,i(`deleteWorkspace`,e.id)}return(t,r)=>(c(),P(P7,{"model-value":e.modelValue,"onUpdate:modelValue":r[2]||=e=>i(`update:modelValue`,e)},{default:B(()=>[F(`button`,{type:`button`,class:`newrow`,onClick:u},[v(X,{name:`chat-new`,size:`sm`}),K(` `+U(z(n)(`sidebar.newChat`)),1)]),F(`button`,{type:`button`,class:`newrow secondary`,onClick:d},[v(X,{name:`folder`,size:`sm`}),K(` `+U(z(n)(`sidebar.newWorkspace`)),1)]),F(`div`,EFe,[e.groups.length===0?(c(),W(`div`,DFe,U(z(n)(`workspace.noWorkspace`)),1)):E(``,!0),(c(!0),W(M,null,_(e.groups,t=>(c(),W(`div`,{key:t.workspace.id,class:`mgroup`},[F(`div`,{class:V([`mgh`,{on:t.workspace.id===e.activeWorkspaceId}]),onClick:e=>m(t.workspace.id)},[p(t.workspace.id)?(c(),P(X,{key:0,class:`mgh-folder`,name:`folder-closed`,size:`sm`})):(c(),P(X,{key:1,class:`mgh-folder`,name:`folder`,size:`sm`})),F(`div`,kFe,[F(`span`,AFe,U(t.workspace.name),1),v(Sp,{text:t.workspace.root},{default:B(()=>[F(`span`,jFe,U(t.workspace.shortPath),1)]),_:2},1032,[`text`])]),p(t.workspace.id)&&S(t.workspace.id)>0?(c(),W(`span`,MFe,U(S(t.workspace.id)),1)):E(``,!0),v(Ca,{size:`lg`,class:`mgh-more`,label:z(n)(`sidebar.options`),onClick:H(e=>j(t.workspace.id),[`stop`])},{default:B(()=>[v(X,{name:`dots-horizontal`,size:`md`})]),_:1},8,[`label`,`onClick`]),v(Ca,{size:`lg`,class:`mgh-add`,label:z(n)(`workspace.newInGroup`),onClick:H(e=>s(t.workspace.id),[`stop`])},{default:B(()=>[v(X,{name:`plus`,size:`md`})]),_:1},8,[`label`,`onClick`]),k.value===t.workspace.id?(c(),P(hp,{key:3,class:`kmenu wsmenu`,onClick:r[0]||=H(()=>{},[`stop`])},{default:B(()=>[v(vp,{size:`lg`,onClick:e=>N(t.workspace)},{default:B(()=>[K(U(z(n)(`sidebar.copyPath`)),1)]),_:1},8,[`onClick`]),v(vp,{size:`lg`,danger:``,onClick:e=>ee(t.workspace)},{default:B(()=>[K(U(z(n)(`sidebar.delete`)),1)]),_:1},8,[`onClick`])]),_:2},1024)):E(``,!0)],10,OFe),l(F(`div`,null,[t.sessions.length===0?(c(),W(`div`,NFe,U(z(n)(`sidebar.noSessions`)),1)):E(``,!0),(c(!0),W(M,null,_(b(t),t=>(c(),W(`div`,{key:t.id,class:V([`srow`,{cur:t.id===e.activeId}]),onClick:e=>o(t.id)},[F(`div`,FFe,[F(`div`,{class:V([`t`,{run:t.busy,aborted:!t.busy&&(e.attentionBySession[t.id]??0)===0&&(t.lastTurnReason===`cancelled`||t.lastTurnReason===`failed`)}])},U(t.title),3),F(`div`,IFe,U(t.time),1)]),(e.attentionBySession[t.id]??0)>0?(c(),W(`span`,LFe,U(e.attentionBySession[t.id]),1)):E(``,!0),v(Ca,{size:`lg`,class:`kb`,label:z(n)(`sidebar.options`),onClick:H(e=>w(t.id),[`stop`])},{default:B(()=>[v(X,{name:`dots-horizontal`,size:`md`})]),_:1},8,[`label`,`onClick`]),C.value===t.id?(c(),P(hp,{key:1,class:`kmenu`,onClick:r[1]||=H(()=>{},[`stop`])},{default:B(()=>[v(vp,{size:`lg`,onClick:e=>T(t)},{default:B(()=>[K(U(z(n)(`sidebar.rename`)),1)]),_:1},8,[`onClick`]),v(vp,{size:`lg`,danger:``,onClick:e=>D(t.id)},{default:B(()=>[K(U(z(n)(`sidebar.archive`)),1)]),_:1},8,[`onClick`]),v(vp,{size:`lg`,danger:``,onClick:e=>O(t.id)},{default:B(()=>[K(U(z(n)(`sidebar.delete`)),1)]),_:1},8,[`onClick`])]),_:2},1024)):E(``,!0)],10,PFe))),128)),t.hasMore||t.loadingMore?(c(),W(`button`,{key:1,type:`button`,class:`mshow-more`,disabled:t.loadingMore,onClick:H(e=>x(t.workspace.id),[`stop`])},U(t.loadingMore?z(n)(`sidebar.loadingMore`):z(n)(`sidebar.showMore`,{count:Math.max(0,t.workspace.sessionCount-t.sessions.length)})),9,RFe)):E(``,!0),t.sessions.length>t.initialCount?(c(),W(`button`,{key:2,type:`button`,class:`mshow-more`,onClick:H(e=>y(t.workspace.id),[`stop`])},U(g(t.workspace.id)?z(n)(`sidebar.showLess`):z(n)(`sidebar.showAll`,{count:t.sessions.length-t.initialCount})),9,zFe)):E(``,!0)],512),[[A,!p(t.workspace.id)]])]))),128))])]),_:1},8,[`model-value`]))}}),[[`__scopeId`,`data-v-8f1d0519`]]),VFe={class:`group-title`},HFe={class:`srow-main`},UFe={class:`srow-label`},WFe={class:`srow-sub`},GFe={class:`srow read-only`},KFe={class:`srow-main`},qFe={class:`srow-label`},JFe={key:0,class:`srow-sub`},YFe={class:`cache-note`},XFe={class:`srow-main`},ZFe={class:`srow-label`},QFe={class:`srow-sub`},$Fe=[`aria-checked`],eIe={key:0,class:`srow read-only`},tIe={class:`srow-main`},nIe={class:`srow-label`},rIe={class:`srow-sub`},iIe={class:`goal-actions`},aIe=[`aria-checked`],oIe={class:`srow-main`},sIe={class:`srow-label`},cIe={class:`srow-sub`},lIe=[`aria-checked`],uIe={class:`srow-main`},dIe={class:`srow-label`},fIe={class:`srow-sub`},pIe={class:`srow-main`},mIe={class:`srow-label`},hIe={class:`srow read-only`},gIe={class:`srow-main`},_Ie={class:`srow-label`},vIe={class:`srow-sub`},yIe=[`aria-label`],bIe={class:`group-title`},xIe={class:`srow-main`},SIe={class:`srow-label`},CIe={class:`srow-sub`},wIe={class:`srow read-only pref`},TIe={class:`srow-main`},EIe={class:`srow-label`},DIe={class:`srow read-only pref`},OIe={class:`srow-main`},kIe={class:`srow-label`},AIe={class:`srow-main`},jIe={class:`srow-label`},MIe={class:`srow-sub`},NIe=[`aria-checked`],PIe={class:`srow-main`},FIe={class:`srow-label`},IIe={key:2,class:`srow read-only`},LIe={class:`srow-main`},RIe={class:`srow-label`},zIe={class:`srow-val dim`},BIe={class:`arch-subhead`},VIe={class:`arch-count`},HIe={class:`arch-tools`},UIe={key:0,class:`arch-empty`},WIe={class:`arch-meta`},GIe={class:`arch-name`},KIe={class:`arch-time`},qIe={key:2,class:`arch-empty`},JIe=100,YIe=Y(G({__name:`MobileSettingsSheet`,props:{modelValue:{type:Boolean},status:{},thinking:{},planMode:{type:Boolean},goalMode:{type:Boolean},goal:{default:null},dynamicWorkflowMode:{type:Boolean},colorScheme:{default:`system`},uiFontSize:{default:14},conversationToc:{type:Boolean},serverVersion:{default:``},models:{default:()=>[]}},emits:[`update:modelValue`,`pickModel`,`setThinking`,`togglePlan`,`toggleWorkflow`,`toggleGoal`,`controlGoal`,`setPermission`,`setColorScheme`,`setUiFontSize`,`setConversationToc`,`login`],setup(e,{emit:t}){let{t:n}=J(),r=e,i=t,{confirm:a}=G4();function o(e){i(`setColorScheme`,e)}let l=[`manual`,`yolo`,`auto`],u=L(()=>r.models?.find(e=>e.id===r.status?.modelId)),d=L(()=>Y3(u.value)),f=L(()=>Q3(u.value)),p=L(()=>n6(u.value,r.thinking)),m=L(()=>f.value.includes(p.value)?p.value:``),h=L(()=>f.value.map(e=>({value:e,label:$3(e)}))),g=L(()=>r.planMode===!0),y=L(()=>r.goalMode===!0),b=L(()=>r.goal!==null&&[`active`,`paused`,`blocked`].includes(r.goal?.status??``)),x=L(()=>{let e=r.goal?.status;return e?n(`status.goalStatus${e[0].toUpperCase()}${e.slice(1)}`):``});async function S(){await a({title:n(`status.goalCancel`),message:n(`status.goalCancelConfirm`),confirmLabel:n(`status.goalCancelConfirmYes`),cancelLabel:n(`status.goalCancelConfirmNo`),variant:`danger`})&&i(`controlGoal`,`cancel`)}let C=L(()=>b6(r.uiFontSize));function w(e){let t=x6(e);t!==void 0&&i(`setUiFontSize`,t)}let T=L(()=>{let e=r.status.permission;return e===`yolo`?`var(--color-warning)`:e===`auto`?`var(--color-danger)`:`var(--color-text-muted)`}),D=L(()=>{let e=r.status.permission;return`${e} · ${n(e===`yolo`?`mobile.permYoloSub`:e===`auto`?`mobile.permAutoSub`:`mobile.permManualSub`)}`}),O=L(()=>r.status.ctxMax>0?Math.min(100,Math.max(0,Math.ceil(r.status.ctxUsed/r.status.ctxMax*100))):0),k=L(()=>r.status.ctxMax>0?`${yO(r.status.ctxUsed)}/${yO(r.status.ctxMax)}`:n(`status.statusNone`));function A(e){i(`setThinking`,t6(u.value,e))}function j(){let e=l[(l.indexOf(r.status.permission)+1)%l.length];i(`setPermission`,e)}function N(){i(`pickModel`),i(`update:modelValue`,!1)}function ee(){i(`login`),i(`update:modelValue`,!1)}let I=E7(),te=R(`main`),ne=R([]),re=R(!1),ie=R(!1),oe=R(``),se=R(`archived-desc`);async function ce(){if(!re.value){re.value=!0,ie.value=!1;try{let e=[],t;for(;;){let n=await I.loadArchivedSessions({beforeId:t,pageSize:JIe});if(e.push(...n.items),!n.hasMore||n.items.length===0)break;let r=n.items.at(-1)?.id;if(r===void 0)break;t=r}ne.value=e,ie.value=!0}catch(e){console.warn(`loadAllArchived failed`,e)}finally{re.value=!1}}}function le(){te.value=`archived`,oe.value=``,ce()}function ue(){te.value=`main`}let de=L(()=>{let e=oe.value.trim().toLowerCase(),t=ne.value.filter(e=>e.archived===!0);return e&&(t=t.filter(t=>t.title.toLowerCase().includes(e))),t=t.slice(),se.value===`archived-desc`?t.sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)):se.value===`created-desc`?t.sort((e,t)=>t.createdAt.localeCompare(e.createdAt)):t.sort((e,t)=>e.title.localeCompare(t.title,`en`)),t});async function fe(e){await I.restoreSession(e)&&(ne.value=ne.value.filter(t=>t.id!==e))}function H(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}return s(()=>r.modelValue,e=>{e||(te.value=`main`)}),(t,r)=>(c(),P(P7,{"model-value":e.modelValue,title:z(n)(`mobile.settingsTitle`),"onUpdate:modelValue":r[8]||=e=>i(`update:modelValue`,e)},{default:B(()=>[te.value===`main`?(c(),W(M,{key:0},[F(`div`,VFe,U(z(n)(`mobile.groupSession`)),1),F(`button`,{type:`button`,class:`srow`,onClick:N},[F(`span`,HFe,[F(`span`,UFe,U(z(n)(`status.statusModel`)),1),F(`span`,WFe,U(e.status.model),1)]),r[9]||=F(`span`,{class:`chev`},`›`,-1)]),F(`div`,GFe,[F(`span`,KFe,[F(`span`,qFe,U(z(n)(`status.statusThinking`)),1),d.value===`unsupported`?(c(),W(`span`,JFe,U(z(n)(`status.modeNotSupported`)),1)):E(``,!0)]),f.value.length>1?(c(),P(o6,{key:0,"model-value":m.value,options:h.value,size:`sm`,"onUpdate:modelValue":A},null,8,[`model-value`,`options`])):(c(),W(`span`,{key:1,class:V([`srow-val`,{dim:p.value===`off`}])},U(p.value===`off`?z(n)(`status.planOff`):z($3)(p.value)),3))]),F(`div`,YFe,U(z(n)(`status.cacheNote`)),1),F(`button`,{type:`button`,class:`srow`,onClick:r[0]||=e=>i(`togglePlan`)},[F(`span`,XFe,[F(`span`,ZFe,U(z(n)(`status.statusPlanMode`)),1),F(`span`,QFe,U(z(n)(`mobile.planModeSub`)),1)]),F(`span`,{class:V([`toggle`,{on:g.value}]),role:`switch`,"aria-checked":g.value},null,10,$Fe)]),b.value?(c(),W(`div`,eIe,[F(`span`,tIe,[F(`span`,nIe,U(z(n)(`status.goalLabel`)),1),F(`span`,rIe,U(x.value),1)]),F(`span`,iIe,[e.goal?.status===`active`?(c(),P(pD,{key:0,variant:`secondary`,size:`sm`,onClick:r[1]||=e=>i(`controlGoal`,`pause`)},{default:B(()=>[K(U(z(n)(`status.goalPause`)),1)]),_:1})):E(``,!0),e.goal?.status===`paused`||e.goal?.status===`blocked`?(c(),P(pD,{key:1,variant:`secondary`,size:`sm`,onClick:r[2]||=e=>i(`controlGoal`,`resume`)},{default:B(()=>[K(U(z(n)(`status.goalResume`)),1)]),_:1})):E(``,!0),v(pD,{variant:`ghost`,size:`sm`,onClick:S},{default:B(()=>[K(U(z(n)(`status.goalCancel`)),1)]),_:1})])])):(c(),W(`button`,{key:1,type:`button`,class:`srow`,role:`switch`,"aria-checked":y.value,onClick:r[3]||=e=>i(`toggleGoal`)},[F(`span`,oIe,[F(`span`,sIe,U(z(n)(`status.goalLabel`)),1),F(`span`,cIe,U(z(n)(`mobile.goalModeSub`)),1)]),F(`span`,{class:V([`toggle`,{on:y.value}])},null,2)],8,aIe)),F(`button`,{type:`button`,class:`srow`,role:`switch`,"aria-checked":e.dynamicWorkflowMode,onClick:r[4]||=e=>i(`toggleWorkflow`)},[F(`span`,uIe,[F(`span`,dIe,U(z(n)(`status.statusDynamicWorkflowMode`)),1),F(`span`,fIe,U(z(n)(`mobile.workflowModeSub`)),1)]),F(`span`,{class:V([`toggle`,{on:e.dynamicWorkflowMode}])},null,2)],8,lIe),F(`button`,{type:`button`,class:`srow`,onClick:j},[F(`span`,pIe,[F(`span`,mIe,U(z(n)(`status.statusPermission`)),1),F(`span`,{class:`srow-sub`,style:ae({color:T.value})},U(D.value),5)]),r[10]||=F(`span`,{class:`chev`},`›`,-1)]),F(`div`,hIe,[F(`span`,gIe,[F(`span`,_Ie,U(z(n)(`status.statusContext`)),1),F(`span`,vIe,U(k.value),1)]),F(`span`,{class:`ctx-meter`,"aria-label":k.value},[F(`i`,{style:ae({width:O.value+`%`})},null,4)],8,yIe)]),F(`div`,bIe,U(z(n)(`mobile.groupApp`)),1),F(`button`,{type:`button`,class:`srow`,onClick:le},[F(`span`,xIe,[F(`span`,SIe,U(z(n)(`mobile.archivedSessions`)),1),F(`span`,CIe,U(z(n)(`mobile.archivedSessionsSub`)),1)]),r[11]||=F(`span`,{class:`chev`},`›`,-1)]),F(`div`,wIe,[F(`span`,TIe,[F(`span`,EIe,U(z(n)(`theme.colorSchemeLabel`)),1)]),v(o6,{"model-value":e.colorScheme??`system`,options:[{value:`light`,label:z(n)(`theme.light`)},{value:`dark`,label:z(n)(`theme.dark`)},{value:`system`,label:z(n)(`theme.system`)}],"onUpdate:modelValue":o},null,8,[`model-value`,`options`])]),F(`div`,DIe,[F(`span`,OIe,[F(`span`,kIe,U(z(n)(`settings.uiFontSize`)),1)]),v(o6,{"model-value":C.value,options:z(h6),"aria-label":z(n)(`settings.uiFontSize`),"onUpdate:modelValue":w},null,8,[`model-value`,`options`,`aria-label`])]),F(`button`,{type:`button`,class:`srow`,onClick:r[5]||=t=>i(`setConversationToc`,!e.conversationToc)},[F(`span`,AIe,[F(`span`,jIe,U(z(n)(`settings.conversationToc`)),1),F(`span`,MIe,U(z(n)(`settings.conversationTocHint`)),1)]),F(`span`,{class:V([`toggle`,{on:e.conversationToc}]),role:`switch`,"aria-checked":e.conversationToc},null,10,NIe)]),F(`button`,{type:`button`,class:`srow acct in`,onClick:ee},[F(`span`,PIe,[F(`span`,FIe,U(z(n)(`settings.manageProviders`)),1)])]),e.serverVersion?(c(),W(`div`,IIe,[F(`span`,LIe,[F(`span`,RIe,U(z(n)(`settings.serverVersion`)),1)]),F(`span`,zIe,U(e.serverVersion),1)])):E(``,!0)],64)):(c(),W(M,{key:1},[F(`div`,BIe,[F(`button`,{type:`button`,class:`arch-back`,onClick:ue},[r[12]||=F(`span`,{class:`chev back`},`‹`,-1),K(` `+U(z(n)(`mobile.archivedBack`)),1)]),F(`span`,VIe,U(z(n)(`mobile.sessionCount`,{n:de.value.length})),1)]),F(`div`,HIe,[v(Fp,{class:`arch-search-input`,"model-value":oe.value,size:`sm`,placeholder:z(n)(`settings.archivedSearch`),"onUpdate:modelValue":r[6]||=e=>oe.value=e},null,8,[`model-value`,`placeholder`]),v(o6,{size:`sm`,"model-value":se.value,options:[{value:`archived-desc`,label:z(n)(`settings.archivedSortArchived`)},{value:`created-desc`,label:z(n)(`settings.archivedSortCreated`)},{value:`name-asc`,label:z(n)(`settings.archivedSortName`)}],"onUpdate:modelValue":r[7]||=e=>se.value=e},null,8,[`model-value`,`options`])]),re.value?(c(),W(`div`,UIe,U(z(n)(`settings.archivedLoadingAll`)),1)):de.value.length>0?(c(!0),W(M,{key:1},_(de.value,e=>(c(),W(`div`,{key:e.id,class:`arch-row`},[F(`div`,WIe,[F(`div`,GIe,U(e.title),1),F(`div`,KIe,U(z(n)(`settings.archivedAt`,{time:H(e.updatedAt)})),1)]),v(pD,{variant:`secondary`,size:`sm`,onClick:t=>fe(e.id)},{default:B(()=>[K(U(z(n)(`settings.archivedRestore`)),1)]),_:1},8,[`onClick`])]))),128)):(c(),W(`div`,qIe,U(ne.value.length===0?z(n)(`settings.archivedEmpty`):z(n)(`settings.archivedNoMatch`)),1))],64))]),_:1},8,[`model-value`,`title`]))}}),[[`__scopeId`,`data-v-bcda0873`]]),XIe=[`role`,`aria-modal`,`aria-label`],ZIe={class:`wiz-rail`},QIe={class:`rail-inner`},$Ie={class:`eyebrow-pill`},eLe={class:`wiz-title`},tLe={class:`wiz-sub`},nLe={class:`pref-group`},rLe={class:`pref-label`},iLe={class:`theme-cards`},aLe=[`onClick`],oLe={class:`opt-label`},sLe={class:`pref-group`},cLe={class:`pref-label`},lLe={class:`accent-cards`},uLe=[`onClick`],dLe={class:`opt-label`},fLe={key:1,class:`wiz-actions`},pLe={key:2,class:`wiz-hint`},mLe={key:0,class:`wiz-hero`,"aria-hidden":`true`},hLe={class:`hero-inner`},gLe={class:`hero-tagline`},_Le={class:`hero-sub`},vLe={class:`frost-stage`},yLe={class:`frost-card`},bLe={class:`frost-card`},V9=Y(G({__name:`Onboarding`,props:{embedded:{type:Boolean,default:!1}},emits:[`complete`,`skip`],setup(e,{emit:t}){let n=t,{t:r}=J(),{colorScheme:i,accent:a,setColorScheme:o,setAccent:s}=k6(),l=[{value:`system`,label:r(`theme.system`)},{value:`light`,label:r(`theme.light`)},{value:`dark`,label:r(`theme.dark`)}],u=[{value:`blue`,label:r(`theme.accentBlue`)},{value:`mono`,label:r(`theme.accentBlack`)}];return(t,d)=>(c(),W(`div`,{class:V([`wizard`,{"is-embedded":e.embedded}]),role:e.embedded?void 0:`dialog`,"aria-modal":e.embedded?void 0:`true`,"aria-label":e.embedded?void 0:z(r)(`onboarding.title`)},[F(`div`,ZIe,[F(`div`,QIe,[e.embedded?E(``,!0):(c(),W(M,{key:0},[F(`span`,$Ie,U(z(r)(`onboarding.eyebrow`)),1),v(X7,{class:`brand-mark`,size:`lg`,animated:!1,label:`Pythinker Code`}),F(`h1`,eLe,U(z(r)(`onboarding.title`)),1),F(`p`,tLe,U(z(r)(`onboarding.subtitle`)),1)],64)),F(`div`,nLe,[F(`div`,rLe,U(z(r)(`theme.colorSchemeLabel`)),1),F(`div`,iLe,[(c(),W(M,null,_(l,e=>F(`button`,{key:e.value,type:`button`,class:V([`opt-card theme-card`,{selected:z(i)===e.value}]),onClick:t=>z(o)(e.value)},[F(`span`,{class:V([`theme-preview`,`theme-preview--${e.value}`]),"aria-hidden":`true`},[e.value===`system`?(c(),W(M,{key:0},[d[2]||=k(``,2)],64)):(c(),W(M,{key:1},[d[3]||=F(`span`,{class:`theme-side`},null,-1),d[4]||=F(`span`,{class:`theme-lines`},[F(`span`),F(`span`),F(`span`)],-1)],64))],2),F(`span`,oLe,U(e.label),1)],10,aLe)),64))])]),F(`div`,sLe,[F(`div`,cLe,U(z(r)(`theme.accentLabel`)),1),F(`div`,lLe,[(c(),W(M,null,_(u,e=>F(`button`,{key:e.value,type:`button`,class:V([`opt-card accent-card`,{selected:z(a)===e.value}]),onClick:t=>z(s)(e.value)},[F(`span`,{class:V([`opt-radio`,{on:z(a)===e.value}])},null,2),F(`span`,{class:V([`accent-swatch`,`accent-swatch--${e.value}`]),"aria-hidden":`true`},null,2),F(`span`,dLe,U(e.label),1)],10,uLe)),64))])]),e.embedded?E(``,!0):(c(),W(`div`,fLe,[v(pD,{variant:`primary`,size:`lg`,class:`wiz-action`,"data-testid":`onboarding-complete`,onClick:d[0]||=e=>n(`complete`)},{default:B(()=>[F(`span`,null,U(z(r)(`onboarding.start`)),1),v(X,{name:`arrow-right`,size:`sm`})]),_:1}),v(pD,{variant:`secondary`,size:`lg`,class:`wiz-action`,"data-testid":`onboarding-skip`,onClick:d[1]||=e=>n(`skip`)},{default:B(()=>[F(`span`,null,U(z(r)(`onboarding.skip`)),1),v(X,{name:`arrow-right`,size:`sm`})]),_:1})])),e.embedded?E(``,!0):(c(),W(`p`,pLe,U(z(r)(`onboarding.hint`)),1))])]),e.embedded?E(``,!0):(c(),W(`aside`,mLe,[d[7]||=F(`div`,{class:`hero-ambient`},[F(`span`,{class:`orb orb-a`}),F(`span`,{class:`orb orb-b`}),F(`span`,{class:`orb orb-c`})],-1),F(`div`,hLe,[v(X7,{size:`hero`,animated:!1,label:``}),F(`p`,gLe,U(z(r)(`onboarding.heroTitle`)),1),F(`p`,_Le,U(z(r)(`onboarding.heroSub`)),1),F(`div`,vLe,[F(`figure`,yLe,[d[5]||=k(``,2),F(`figcaption`,null,U(z(r)(`onboarding.platformMac`)),1)]),F(`figure`,bLe,[d[6]||=k(``,2),F(`figcaption`,null,U(z(r)(`onboarding.platformWindows`)),1)])])])]))],10,XIe))}}),[[`__scopeId`,`data-v-2c24b7cb`]]),xLe=2e3;function SLe(e){let t=R(`idle`),n=R(void 0),r=R(void 0),i=R(!1),a=R(!0),o=R(``),s=L(()=>t.value===`starting`||t.value===`exchanging`||t.value===`loading_models`),c,l,u=!1,d=!1;function f(){return t.value===`waiting_for_browser`||t.value===`waiting_for_code`}function m(){c!==void 0&&(clearInterval(c),c=void 0)}function g(){n.value=void 0,r.value=void 0,i.value=!1}function _(){l?.close(),l=void 0}function v(e){u||(o.value=e,t.value=`failed`,m(),_(),g())}async function y(r,i){if(u||n.value!==r||!f()&&t.value!==`exchanging`||i.state===`pending`)return;if(m(),i.state===`failed`){v(i.message??``);return}if(i.state===`cancelled`){t.value=`cancelled`,_(),g();return}l=void 0,t.value=`loading_models`;let a=!0;try{a=await e?.()??!0}catch(e){v(e instanceof Error?e.message:String(e));return}finally{g()}u||(a?t.value=`connected`:v(``))}async function b(){if(u||d||!f())return;let e=n.value;if(e!==void 0){d=!0;try{await y(e,await Q().getCodexLoginStatus(e))}catch{}finally{d=!1}}}function x(){b()}function S(){document.visibilityState===`visible`&&b()}async function C(){if(u||s.value||f())return;t.value=`starting`,o.value=``,g();let e=null;try{e=typeof window>`u`?null:window.open(`about:blank`,`_blank`),e!==null&&(e.opener=null,l=e)}catch{e?.close(),e=null}i.value=e===null;try{let o=Q(),s=await o.startCodexLogin();if(u){_(),o.cancelCodexLogin(s.loginId).catch(()=>{});return}if(n.value=s.loginId,r.value=s.authorizeUrl,a.value=s.loopback,e!==null)try{e.location.href=s.authorizeUrl}catch{_(),i.value=!0}t.value=s.loopback?`waiting_for_browser`:`waiting_for_code`,m(),c=setInterval(()=>void b(),xLe)}catch(e){_(),v(e instanceof Error?e.message:String(e))}}async function w(e){let r=n.value;if(u||s.value||!f()||r===void 0)return;let i=t.value;t.value=`exchanging`,o.value=``;try{await y(r,await Q().submitCodexLoginRedirect(r,e)),!u&&t.value===`exchanging`&&(t.value=i)}catch(e){u||(o.value=e instanceof Error?e.message:String(e),t.value=i)}}async function T(){let e=n.value;if(m(),_(),g(),t.value=`cancelled`,o.value=``,e!==void 0)try{await Q().cancelCodexLogin(e)}catch{}}return p(()=>{window.addEventListener(`focus`,x),document.addEventListener(`visibilitychange`,S)}),h(()=>{u=!0,window.removeEventListener(`focus`,x),document.removeEventListener(`visibilitychange`,S),m(),_();let e=n.value;e!==void 0&&f()&&Q().cancelCodexLogin(e).catch(()=>{})}),{phase:fe(t),busy:s,loginId:fe(n),authorizeUrl:fe(r),popupBlocked:fe(i),loopback:fe(a),error:fe(o),start:C,submitRedirect:w,cancel:T}}var CLe={class:`codex-signin`},wLe={key:0,class:`codex-signin__denied`,role:`status`},TLe={key:1,class:`codex-signin__ok`,role:`status`},ELe={class:`codex-signin__status`,role:`status`},DLe={key:0,class:`codex-signin__hint`},OLe=[`href`],kLe={class:`codex-signin__hint`},ALe={key:2,class:`codex-signin__error`,role:`alert`},jLe={class:`codex-signin__actions`},MLe=Y(G({__name:`CodexSignIn`,emits:[`connected`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=E7(),a=R(``),o=SLe(async()=>{await i.refreshRuntimeState();let e=i.authReady.value;return e&&n(`connected`),e});async function s(){let e=a.value.trim();e!==``&&(await o.submitRedirect(e),a.value=``)}return(e,t)=>(c(),W(`div`,CLe,[z(o).phase.value===`idle`||z(o).phase.value===`cancelled`?(c(),W(M,{key:0},[z(o).phase.value===`cancelled`?(c(),W(`p`,wLe,U(z(r)(`login.deniedTitle`)),1)):E(``,!0),v(pD,{variant:`primary`,"data-testid":`codex-signin-start`,onClick:t[0]||=e=>z(o).start()},{default:B(()=>[v(X,{name:`log-in`,size:`sm`}),F(`span`,null,U(z(r)(`codexLogin.signIn`)),1)]),_:1})],64)):z(o).phase.value===`connected`?(c(),W(`p`,TLe,[v(X,{name:`circle-check`,size:`sm`}),F(`span`,null,U(z(r)(`codexLogin.connected`)),1)])):(c(),W(M,{key:2},[F(`p`,ELe,[z(o).busy.value||z(o).phase.value!==`failed`?(c(),P(op,{key:0,size:`sm`})):E(``,!0),F(`span`,null,U(z(r)(`codexLogin.phase.${z(o).phase.value}`)),1)]),z(o).authorizeUrl.value?(c(),W(`p`,DLe,[K(U(z(r)(`codexLogin.openLinkHint`))+` `,1),F(`a`,{href:z(o).authorizeUrl.value,target:`_blank`,rel:`noreferrer noopener`},U(z(r)(`codexLogin.openLink`)),9,OLe)])):E(``,!0),z(o).phase.value===`waiting_for_code`||z(o).phase.value===`exchanging`?(c(),W(`form`,{key:1,class:`codex-signin__paste`,onSubmit:H(s,[`prevent`])},[F(`p`,kLe,U(z(r)(`codexLogin.pasteHint`)),1),v(O7,{label:z(r)(`codexLogin.pasteLabel`)},{default:B(()=>[v(Fp,{modelValue:a.value,"onUpdate:modelValue":t[1]||=e=>a.value=e,placeholder:z(r)(`codexLogin.pastePlaceholder`),autocomplete:`off`,spellcheck:`false`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),v(pD,{type:`submit`,variant:`primary`,loading:z(o).busy.value},{default:B(()=>[K(U(z(r)(`codexLogin.submit`)),1)]),_:1},8,[`loading`])],32)):E(``,!0),z(o).error.value?(c(),W(`p`,ALe,U(z(r)(`codexLogin.failed`,{message:z(o).error.value})),1)):E(``,!0),F(`div`,jLe,[z(o).phase.value===`failed`?(c(),P(pD,{key:0,variant:`primary`,onClick:t[2]||=e=>z(o).start()},{default:B(()=>[K(U(z(r)(`codexLogin.retry`)),1)]),_:1})):(c(),P(pD,{key:1,variant:`secondary`,onClick:t[3]||=e=>z(o).cancel()},{default:B(()=>[K(U(z(r)(`codexLogin.cancel`)),1)]),_:1}))])],64))]))}}),[[`__scopeId`,`data-v-3bd16f58`]]),NLe=[`aria-label`],PLe={class:`first-run__panel`},FLe={class:`first-run__steps`},ILe={class:`first-run__dot`},LLe={key:0,class:`first-run__body`},RLe={class:`first-run__sub`},zLe={key:0,class:`first-run__options`},BLe={class:`first-run__option-main`},VLe={class:`first-run__option-name`},HLe={class:`first-run__option-desc`},ULe={class:`first-run__badge`},WLe={class:`first-run__option-main`},GLe={class:`first-run__option-name`},KLe={class:`first-run__option-desc`},qLe={class:`first-run__option-main`},JLe={class:`first-run__option-name`},YLe={class:`first-run__option-desc`},XLe={key:1,class:`first-run__route`},ZLe={class:`first-run__actions`},QLe={key:2,class:`first-run__skip-hint`},$Le={key:1,class:`first-run__body`},eRe={class:`first-run__sub`},tRe={key:0,class:`first-run__empty`},nRe={key:1,class:`first-run__models`},rRe=[`data-testid`,`onClick`],iRe={class:`first-run__model-id`},aRe={key:0,class:`first-run__badge`},oRe={class:`first-run__model-ctx`},sRe={class:`first-run__actions`},cRe={key:2,class:`first-run__body`},lRe={class:`first-run__sub`},uRe={class:`first-run__ready`},dRe={class:`first-run__actions`},fRe=Y(G({__name:`FirstRun`,emits:[`complete`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=E7(),a=R(`connect`),o=R(null),l=R(null),u=R(!1),d=R(!1),f=[`connect`,`model`,`appearance`],p=L(()=>f.indexOf(a.value)),m=L(()=>(i.models.value??[]).filter(e=>e.capabilities===void 0||e.capabilities.length===0||e.capabilities.some(e=>e.trim().toLowerCase()===`tool_use`))),h=L(()=>i.defaultModel.value??void 0),g=L(()=>{let e=h.value;return m.value.toSorted((t,n)=>t.id===e?-1:n.id===e?1:n.maxContextSize-t.maxContextSize||t.id.localeCompare(n.id))}),y=L(()=>u.value?g.value:g.value.slice(0,5)),b=L(()=>(i.providers.value??[])[0]?.id??``),x=L(()=>i.authReady.value&&m.value.length>0),S=L(()=>l.value!==null);s([h,m],()=>{l.value===null&&(l.value=h.value??m.value[0]?.id??null)},{immediate:!0});function C(){x.value&&(a.value=`model`)}async function w(){let e=l.value;if(!(e===null||d.value)){d.value=!0;try{e!==i.defaultModel.value&&await i.updateConfig({defaultModel:e}),await i.refreshRuntimeState(),i.authReady.value&&(a.value=`appearance`)}finally{d.value=!1}}}function T(){i.setOnboarded(!0),n(`complete`)}function D(){T()}function O(e){o.value=e}async function k(){await i.refreshRuntimeState(),x.value&&C()}return(e,t)=>(c(),W(`div`,{class:`first-run`,role:`dialog`,"aria-modal":`true`,"aria-label":z(r)(`firstRun.connect.title`)},[F(`div`,PLe,[F(`ol`,FLe,[(c(),W(M,null,_(f,(e,t)=>F(`li`,{key:e,class:V([`first-run__step`,{"is-current":t===p.value,"is-done":tO(`codex`)},[F(`span`,BLe,[F(`span`,VLe,U(z(r)(`firstRun.connect.codexName`)),1),F(`span`,HLe,U(z(r)(`firstRun.connect.codexDesc`)),1)]),F(`span`,ULe,U(z(r)(`firstRun.connect.codexBadge`)),1)]),F(`button`,{type:`button`,class:`first-run__option`,"data-testid":`first-run-route-catalog`,onClick:t[1]||=e=>O(`catalog`)},[F(`span`,WLe,[F(`span`,GLe,U(z(r)(`firstRun.connect.catalogName`)),1),F(`span`,KLe,U(z(r)(`firstRun.connect.catalogDesc`)),1)]),v(X,{name:`chevron-right`,size:`sm`})]),F(`button`,{type:`button`,class:`first-run__option`,"data-testid":`first-run-route-manual`,onClick:t[2]||=e=>O(`manual`)},[F(`span`,qLe,[F(`span`,JLe,U(z(r)(`firstRun.connect.manualName`)),1),F(`span`,YLe,U(z(r)(`firstRun.connect.manualDesc`)),1)]),v(X,{name:`chevron-right`,size:`sm`})])])):(c(),W(`div`,XLe,[o.value===`codex`?(c(),P(MLe,{key:0,onConnected:k})):(c(),P(N9,{key:1,config:z(i).config.value,"initial-source":o.value===`manual`?`manual`:`catalog`,onAdded:k,onCancel:t[3]||=e=>o.value=null},null,8,[`config`,`initial-source`])),v(pD,{variant:`ghost`,size:`sm`,onClick:t[4]||=e=>o.value=null},{default:B(()=>[K(U(z(r)(`firstRun.connect.back`)),1)]),_:1})])),F(`div`,ZLe,[v(pD,{variant:`ghost`,"data-testid":`first-run-skip`,onClick:D},{default:B(()=>[K(U(z(r)(`firstRun.connect.skip`)),1)]),_:1}),t[8]||=F(`span`,{class:`first-run__spacer`},null,-1),x.value?(c(),P(pD,{key:0,variant:`primary`,"data-testid":`first-run-connect-continue`,onClick:C},{default:B(()=>[K(U(z(r)(`firstRun.continue`)),1)]),_:1})):E(``,!0)]),o.value===null?(c(),W(`p`,QLe,U(z(r)(`firstRun.connect.skipHint`)),1)):E(``,!0)])):a.value===`model`?(c(),W(`section`,$Le,[F(`h1`,null,U(z(r)(`firstRun.model.title`)),1),F(`p`,eRe,U(z(r)(`firstRun.model.connected`,{provider:b.value,count:m.value.length},m.value.length))+` `+U(z(r)(`firstRun.model.subtitle`)),1),m.value.length===0?(c(),W(`p`,tRe,U(z(r)(`firstRun.model.none`)),1)):(c(),W(`ul`,nRe,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`li`,{key:e.id},[F(`button`,{type:`button`,class:V([`first-run__model`,{"is-selected":l.value===e.id}]),"data-testid":`first-run-model-${e.id}`,onClick:t=>l.value=e.id},[t[9]||=F(`span`,{class:`first-run__radio`,"aria-hidden":`true`},null,-1),F(`span`,iRe,U(e.id),1),e.id===h.value?(c(),W(`span`,aRe,U(z(r)(`firstRun.model.recommended`)),1)):E(``,!0),F(`span`,oRe,U(Math.round(e.maxContextSize/1e3))+`K`,1)],10,rRe)]))),128))])),g.value.length>5?(c(),P(pD,{key:2,variant:`ghost`,size:`sm`,onClick:t[5]||=e=>u.value=!u.value},{default:B(()=>[K(U(u.value?z(r)(`firstRun.model.showFewer`):z(r)(`firstRun.model.showAll`,{count:g.value.length})),1)]),_:1})):E(``,!0),F(`div`,sRe,[v(pD,{variant:`secondary`,onClick:t[6]||=e=>a.value=`connect`},{default:B(()=>[K(U(z(r)(`firstRun.back`)),1)]),_:1}),t[10]||=F(`span`,{class:`first-run__spacer`},null,-1),v(pD,{variant:`primary`,loading:d.value,disabled:!S.value,"data-testid":`first-run-model-continue`,onClick:w},{default:B(()=>[K(U(z(r)(`firstRun.continue`)),1)]),_:1},8,[`loading`,`disabled`])])])):(c(),W(`section`,cRe,[F(`h1`,null,U(z(r)(`firstRun.appearance.title`)),1),F(`p`,lRe,U(z(r)(`firstRun.appearance.subtitle`)),1),v(V9,{embedded:``,onComplete:T,onSkip:T}),F(`p`,uRe,[v(X,{name:`circle-check`,size:`sm`}),F(`span`,null,U(z(r)(`firstRun.appearance.ready`,{model:l.value??``})),1)]),F(`div`,dRe,[v(pD,{variant:`secondary`,onClick:t[7]||=e=>a.value=`model`},{default:B(()=>[K(U(z(r)(`firstRun.back`)),1)]),_:1}),t[11]||=F(`span`,{class:`first-run__spacer`},null,-1),v(pD,{variant:`primary`,"data-testid":`first-run-finish`,onClick:T},{default:B(()=>[K(U(z(r)(`firstRun.appearance.finish`)),1)]),_:1})])]))])],8,NLe))}}),[[`__scopeId`,`data-v-23e77d0d`]]),pRe={class:`recovery`},mRe={class:`recovery__inner`},hRe={class:`recovery__mark`,"aria-hidden":`true`},gRe={class:`recovery__copy`},_Re={class:`recovery__options`},vRe={class:`recovery__option-name`},yRe={class:`recovery__option-desc`},bRe={class:`recovery__option-name`},xRe={class:`recovery__option-desc`},SRe={class:`recovery__actions`},CRe=Y(G({__name:`Recovery`,emits:[`openProviders`,`dismiss`],setup(e,{emit:t}){let n=t,{t:r}=J(),i=E7(),a=L(()=>i.providers.value??[]),o=L(()=>a.value[0]),s=L(()=>a.value.length===0?`noProvider`:a.value.some(e=>e.status===`connected`)?`noModel`:`credential`),l=L(()=>s.value===`noProvider`?r(`recovery.noProvider`):r(`recovery.${s.value}`,{provider:o.value?.id??``}));async function u(){await i.refreshRuntimeState()}return(e,t)=>(c(),W(`section`,pRe,[F(`div`,mRe,[F(`span`,hRe,[v(X,{name:`alert-triangle`,size:`md`})]),F(`div`,gRe,[F(`h1`,null,U(z(r)(`recovery.title`)),1),F(`p`,null,U(l.value),1)]),F(`div`,_Re,[s.value===`noProvider`?E(``,!0):(c(),W(`button`,{key:0,type:`button`,class:`recovery__option is-primary`,"data-testid":`recovery-open-providers`,onClick:t[0]||=e=>n(`openProviders`)},[F(`span`,vRe,U(z(r)(`recovery.fixProvider`)),1),F(`span`,yRe,U(z(r)(`recovery.fixProviderDesc`)),1)])),F(`button`,{type:`button`,class:V([`recovery__option`,{"is-primary":s.value===`noProvider`}]),"data-testid":`recovery-add-provider`,onClick:t[1]||=e=>n(`openProviders`)},[F(`span`,bRe,U(z(r)(`recovery.addProvider`)),1),F(`span`,xRe,U(z(r)(`recovery.addProviderDesc`)),1)],2)]),F(`div`,SRe,[v(pD,{variant:`secondary`,"data-testid":`recovery-retry`,onClick:u},{default:B(()=>[K(U(z(r)(`recovery.retry`)),1)]),_:1}),v(pD,{variant:`ghost`,"data-testid":`recovery-dismiss`,onClick:t[2]||=e=>n(`dismiss`)},{default:B(()=>[K(U(z(r)(`recovery.dismiss`)),1)]),_:1})])])]))}}),[[`__scopeId`,`data-v-68311778`]]),wRe=[`aria-label`],TRe={class:`gload-box`},ERe={class:`gload-text`},DRe={key:0,class:`gload-stage`},ORe={key:1,class:`gload-issue-title`},kRe={key:2,class:`gload-issue-detail`},ARe=Y(G({__name:`GlobalLoading`,props:{stage:{},retries:{},issue:{}},setup(e){let t=e,{t:n}=J(),r=L(()=>{switch(t.stage){case`auth`:return n(`app.connectingStageAuth`);case`server`:return n(`app.connectingStageServer`);case`config`:return n(`app.connectingStageConfig`);case`sessions`:return n(`app.connectingStageSessions`);case`session`:return n(`app.connectingStageSession`);default:return``}}),i=L(()=>{let e=r.value;if(!e)return``;let i=t.retries??0;return i<=0?e:e+n(`app.connectingRetrySuffix`,{n:i})}),a=L(()=>{let e=t.issue;if(e==null||e===``)return``;if(typeof e==`string`)return n(`app.connectRetrying`);switch(e.kind){case`network`:return n(`app.connectingIssueNetworkTitle`);case`timeout`:return n(`app.connectingIssueTimeoutTitle`);case`api`:return n(`app.connectingIssueApiTitle`);case`unknown`:return n(`app.connectingIssueUnknownTitle`);default:return n(`app.connectRetrying`)}}),o=L(()=>{let e=t.issue;if(e==null||e===``)return``;if(typeof e==`string`)return e;switch(e.kind){case`network`:return n(`app.connectingIssueNetworkMessage`);case`timeout`:return n(`app.connectingIssueTimeoutMessage`);case`api`:case`unknown`:return e.message;default:return``}});return(e,t)=>(c(),W(`div`,{class:`gload`,role:`status`,"aria-label":z(n)(`app.connecting`)},[F(`div`,TRe,[t[0]||=F(`img`,{class:`gload-logo`,src:`/logo.png`,alt:`Pythinker`,width:`120`,height:`120`},null,-1),v(op,{size:`md`,label:z(n)(`app.connecting`)},null,8,[`label`]),F(`div`,ERe,[F(`div`,null,U(z(n)(`app.connecting`)),1),i.value?(c(),W(`div`,DRe,U(i.value),1)):E(``,!0),a.value?(c(),W(`div`,ORe,U(a.value),1)):E(``,!0),o.value?(c(),W(`div`,kRe,U(o.value),1)):E(``,!0)])])],8,wRe))}}),[[`__scopeId`,`data-v-82055ab9`]]),jRe={class:`kap-root`},MRe={class:`kap-head`},NRe={class:`kap-count`},PRe={class:`kap-head-actions`},FRe={class:`kap-filters`},IRe=[`value`],LRe={class:`kap-check`},RRe={class:`kap-check`},zRe={class:`kap-view-toggle`,role:`group`},BRe={key:0,class:`kap-empty`},VRe=[`onClick`],HRe={class:`kap-ts`},URe={class:`kap-label`},WRe={key:0,class:`kap-detail`},GRe={class:`kap-detail-actions`},KRe=[`onClick`],qRe={key:1,class:`kap-agg`},JRe={class:`mono`},YRe={class:`mono`},XRe={class:`num`},ZRe={class:`num`},QRe={key:0},$Re={class:`mono`},eze={class:`num`},tze={class:`num`},nze={key:0},rze=Y(G({__name:`KapDebugView`,emits:[`close`],setup(e,{emit:t}){let r=t,i=R(`all`),a=R(``),o=R(``),u=R(!1),d=R(`timeline`),f=L(()=>(zS.value,[...VS()])),p=L(()=>{let e=new Set;for(let t of f.value)t.sessionId&&e.add(t.sessionId);return[...e].sort()});function m(e){return e.kind===`rest:error`||e.code!==void 0&&e.code!==0||e.eventType===`error`||e.eventType===`parse-error`}let h=L(()=>{let e=a.value.trim().toLowerCase();return f.value.filter(t=>!(i.value!==`all`&&t.source!==i.value||o.value&&t.sessionId!==o.value||u.value&&!m(t)||e&&!`${t.label} ${t.kind} ${t.eventType??``} ${t.sessionId??``} ${t.requestId??``}`.toLowerCase().includes(e)))}),g=L(()=>{let e=new Map;for(let t of h.value){if(t.kind!==`ws:in`&&t.kind!==`ws:out`)continue;let n=t.kind===`ws:in`?`←`:`→`,r=`${n} ${t.eventType??`?`} @ ${t.sessionId??`-`}`,i=e.get(r)??{key:r,sessionId:t.sessionId??`-`,eventType:t.eventType??`?`,dir:n,count:0};i.count++,t.seq!==void 0&&(i.lastSeq=t.seq),e.set(r,i)}return[...e.values()].sort((e,t)=>t.count-e.count)}),y=L(()=>{let e=new Map;for(let t of h.value){if(t.source!==`rest`||t.kind===`rest:request`)continue;let n=`${t.method??`?`} ${t.path??`?`}`,r=e.get(n)??{count:0,errors:0,totalMs:0,timed:0};r.count++,m(t)&&r.errors++,t.durationMs!==void 0&&(r.totalMs+=t.durationMs,r.timed++),e.set(n,r)}return[...e.entries()].map(([e,t])=>({key:e,count:t.count,errors:t.errors,avgMs:t.timed>0?Math.round(t.totalMs/t.timed):0})).sort((e,t)=>t.count-e.count)}),b=R(null),x=R(!0),S=R(null),C=R(null);s(()=>h.value.length,async()=>{if(!x.value||d.value!==`timeline`)return;await n();let e=S.value;e&&(e.scrollTop=e.scrollHeight)});function w(e){b.value=b.value===e?null:e}function T(e){let t=new Date(e),n=(e,t=2)=>String(e).padStart(t,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`}function O(e){return JSON.stringify(e,null,2)}async function k(e){await Wi(O(e))&&(C.value=e.id,setTimeout(()=>{C.value===e.id&&(C.value=null)},1500))}function A(){lC(h.value)}function j(e){return m(e)||e.source===`client`?`b-err`:e.source===`rest`?`b-rest`:e.kind===`ws:lifecycle`?`b-life`:e.kind===`ws:out`?`b-out`:`b-in`}function N(e){return e.source===`rest`?`REST`:e.source===`client`?`APP`:`WS`}return(e,t)=>(c(),W(`section`,jRe,[F(`header`,MRe,[t[11]||=F(`strong`,null,`KAP debug`,-1),F(`span`,NRe,U(h.value.length)+`/`+U(f.value.length),1),F(`div`,PRe,[F(`button`,{type:`button`,class:V({on:z(BS)}),onClick:t[0]||=e=>BS.value=!z(BS)},U(z(BS)?`resume`:`pause`),3),F(`button`,{type:`button`,onClick:t[1]||=e=>z(HS)()},`clear`),F(`button`,{type:`button`,onClick:t[2]||=e=>A()},`export jsonl`),v(Sp,{text:`Close window`},{default:B(()=>[F(`button`,{type:`button`,onClick:t[3]||=e=>r(`close`)},`✕`)]),_:1})])]),F(`div`,FRe,[l(F(`select`,{"onUpdate:modelValue":t[4]||=e=>i.value=e,"aria-label":`Source filter`},[...t[12]||=[F(`option`,{value:`all`},`rest + ws + app`,-1),F(`option`,{value:`rest`},`rest`,-1),F(`option`,{value:`ws`},`ws`,-1),F(`option`,{value:`client`},`app errors`,-1)]],512),[[se,i.value]]),l(F(`select`,{"onUpdate:modelValue":t[5]||=e=>o.value=e,"aria-label":`Session filter`},[t[13]||=F(`option`,{value:``},`all sessions`,-1),(c(!0),W(M,null,_(p.value,e=>(c(),W(`option`,{key:e,value:e},U(e),9,IRe))),128))],512),[[se,o.value]]),l(F(`input`,{"onUpdate:modelValue":t[6]||=e=>a.value=e,type:`text`,placeholder:`filter (type / path / id)`,"aria-label":`Text filter`},null,512),[[de,a.value]]),F(`label`,LRe,[l(F(`input`,{"onUpdate:modelValue":t[7]||=e=>u.value=e,type:`checkbox`},null,512),[[D,u.value]]),t[14]||=K(` errors`,-1)]),F(`label`,RRe,[l(F(`input`,{"onUpdate:modelValue":t[8]||=e=>x.value=e,type:`checkbox`},null,512),[[D,x.value]]),t[15]||=K(` follow`,-1)]),F(`div`,zRe,[F(`button`,{type:`button`,class:V({on:d.value===`timeline`}),onClick:t[9]||=e=>d.value=`timeline`},`timeline`,2),F(`button`,{type:`button`,class:V({on:d.value===`aggregate`}),onClick:t[10]||=e=>d.value=`aggregate`},`aggregate`,2)])]),d.value===`timeline`?(c(),W(`div`,{key:0,ref_key:`listRef`,ref:S,class:`kap-list`},[h.value.length===0?(c(),W(`div`,BRe,` No trace entries yet. REST calls and WS frames will appear here. `)):E(``,!0),(c(!0),W(M,null,_(h.value,e=>(c(),W(`div`,{key:e.id,class:`kap-row-wrap`},[F(`button`,{type:`button`,class:V([`kap-row`,{expanded:b.value===e.id}]),onClick:t=>w(e.id)},[F(`span`,HRe,U(T(e.ts)),1),F(`span`,{class:V([`kap-badge`,j(e)])},U(N(e)),3),F(`span`,URe,U(e.label),1)],10,VRe),b.value===e.id?(c(),W(`div`,WRe,[F(`div`,GRe,[F(`button`,{type:`button`,onClick:t=>k(e)},U(C.value===e.id?`copied ✓`:`copy json`),9,KRe)]),F(`pre`,null,U(O(e)),1)])):E(``,!0)]))),128))],512)):(c(),W(`div`,qRe,[t[20]||=F(`h4`,null,`WS frames by session / type`,-1),F(`table`,null,[t[17]||=F(`thead`,null,[F(`tr`,null,[F(`th`,null,`dir`),F(`th`,null,`type`),F(`th`,null,`session`),F(`th`,null,`count`),F(`th`,null,`last seq`)])],-1),F(`tbody`,null,[(c(!0),W(M,null,_(g.value,e=>(c(),W(`tr`,{key:e.key},[F(`td`,null,U(e.dir),1),F(`td`,JRe,U(e.eventType),1),F(`td`,YRe,U(e.sessionId),1),F(`td`,XRe,U(e.count),1),F(`td`,ZRe,U(e.lastSeq??`—`),1)]))),128)),g.value.length===0?(c(),W(`tr`,QRe,[...t[16]||=[F(`td`,{colspan:`5`,class:`kap-empty`},`no ws frames`,-1)]])):E(``,!0)])]),t[21]||=F(`h4`,null,`REST by endpoint`,-1),F(`table`,null,[t[19]||=F(`thead`,null,[F(`tr`,null,[F(`th`,null,`endpoint`),F(`th`,null,`count`),F(`th`,null,`errors`),F(`th`,null,`avg ms`)])],-1),F(`tbody`,null,[(c(!0),W(M,null,_(y.value,e=>(c(),W(`tr`,{key:e.key},[F(`td`,$Re,U(e.key),1),F(`td`,eze,U(e.count),1),F(`td`,{class:V([`num`,{err:e.errors>0}])},U(e.errors),3),F(`td`,tze,U(e.avgMs),1)]))),128)),y.value.length===0?(c(),W(`tr`,nze,[...t[18]||=[F(`td`,{colspan:`4`,class:`kap-empty`},`no rest calls`,-1)]])):E(``,!0)])])]))]))}}),[[`__scopeId`,`data-v-7bab00af`]]),ize=Y(G({__name:`DebugPanel`,setup(e){let t=R(!1),n=null,r=null,i=null,a=[`data-color-scheme`,`data-accent`];function o(e){let t=document.documentElement,n=e.documentElement;for(let e of a){let r=t.getAttribute(e);r===null?n.removeAttribute(e):n.setAttribute(e,r)}}function s(e){let t=e.document;t.title=`KAP debug`;let n=t.createElement(`base`);n.href=location.href,t.head.appendChild(n);for(let e of Array.from(document.querySelectorAll(`style, link[rel="stylesheet"]`)))t.head.appendChild(e.cloneNode(!0));o(t),t.body.style.margin=`0`;let r=t.createElement(`div`);return r.style.height=`100vh`,t.body.appendChild(r),r}function l(){i?.disconnect(),i=null;try{r?.unmount()}catch{}r=null,n=null,t.value=!1}function u(){if(n&&!n.closed){n.focus();return}let e=window.open(``,`kap-debug`,`popup=yes,width=1040,height=760`);if(!e)return;n=e;let c=s(e),u=I(rze,{onClose:()=>e.close()});u.mount(c),r=u,t.value=!0,i=new MutationObserver(()=>{n&&!n.closed&&o(n.document)}),i.observe(document.documentElement,{attributes:!0,attributeFilter:[...a]}),e.addEventListener(`pagehide`,l),e.addEventListener(`beforeunload`,l)}return p(()=>{u()}),ne(()=>{n&&!n.closed&&n.close(),l()}),(e,n)=>(c(),P(Sp,{text:t.value?`Focus KAP debug window`:`Open KAP debug window`},{default:B(()=>[F(`button`,{class:`kap-fab`,type:`button`,onClick:u},` KAP `)]),_:1},8,[`text`]))}}),[[`__scopeId`,`data-v-992ae84c`]]);function aze({client:e}){let t=L(()=>e.appState.value===`first-run`||e.appState.value===`recovery`),n=`/login`,r=R(null);function i(){return typeof window>`u`?`/`:`${window.location.pathname}${window.location.search}${window.location.hash}`}function a(e){typeof window>`u`||window.history.replaceState(window.history.state,``,e)}return s(t,e=>{if(!(typeof window>`u`)){if(e){window.location.pathname!==n&&(r.value=i(),a(n));return}window.location.pathname===n&&(a(r.value??`/`),r.value=null)}},{immediate:!0}),{showAuthGate:t}}function oze({running:e,showAuthGate:t}){let{t:n}=J(),r=L(()=>{let r=e.value?`• `:``;return t.value?`${r}${n(`app.authPageTitle`)} - Pythinker Code Web`:`${r}Pythinker Code Web`});u(()=>{typeof document<`u`&&(document.title=r.value)})}function sze(e,t,n){let r=new Map(e.attachments.map(e=>[e.attachmentId,e])),i=new Map(e.tasks.map(e=>[e.taskId,e])),a=e.items.find(e=>e.kind===`turn`),o=e.items.findLast(e=>e.kind===`turn`);return v8(e.items.flatMap(e=>e.kind===`turn`?cze(e,r,i,{...n,startedAt:e.turnId===a?.turnId?t?.createdAt:void 0,endedAt:e.turnId===o?.turnId?t?.disposedAt:void 0}):[]),[],e=>n.getFileUrl(e),e.meta.activity===`turn`)}function cze(e,t,n,r){let i=[],a=fze([e.startedAt,...e.steps.map(e=>e.startedAt),r.startedAt]),o=H9(e.endedAt)??H9(r.endedAt),s=e.turnId;if(e.prompt!==void 0&&e.prompt.length>0){let n=[{type:`text`,text:e.prompt}];for(let r of e.attachmentIds??[]){let e=uze(t.get(r));e!==void 0&&n.push(e)}i.push({id:`${e.turnId}:input`,sessionId:r.sessionId,role:`user`,content:n,createdAt:a,promptId:s,metadata:{origin:e.origin}})}for(let t of e.steps){let e=H9(t.startedAt)??a;for(let a of t.frames){if(a.kind===`text`){if(a.text.length===0||a.role===`user`&&a.taskId===void 0)continue;i.push({id:a.frameId,sessionId:r.sessionId,role:a.role,content:[{type:`text`,text:a.text}],createdAt:e,promptId:s,metadata:a.taskId===void 0?void 0:{origin:{kind:`task`,taskId:a.taskId},task:n.get(a.taskId),[D4]:lze(a.taskId,a.text,n.get(a.taskId))}});continue}if(a.kind===`thinking`){if(a.text.length===0)continue;i.push({id:a.frameId,sessionId:r.sessionId,role:`assistant`,content:[{type:`thinking`,thinking:a.text,startedAt:e,durationMs:U9(e,H9(t.endedAt))}],createdAt:e,promptId:s});continue}a.kind===`tool`&&(i.push({id:`${a.frameId}:call`,sessionId:r.sessionId,role:`assistant`,content:[{type:`toolUse`,toolCallId:a.toolCallId,toolName:a.name,input:a.input??a.display??{},outputLines:a.state===`running`?dze(a.output):void 0}],createdAt:e,promptId:s}),a.state!==`running`&&i.push({id:`${a.frameId}:result`,sessionId:r.sessionId,role:`tool`,content:[{type:`toolResult`,toolCallId:a.toolCallId,output:a.output??a.error??``,isError:a.state===`error`}],createdAt:H9(t.endedAt)??e,promptId:s}))}}let c=e.durationMs??U9(a,o);if(c!==void 0){let e=i.findLastIndex(e=>e.role===`assistant`);e>=0&&(i[e]={...i[e],durationMs:c})}return i}function lze(e,t,n){if(j4(t).length>0)return;let[r=``,...i]=t.split(` `),a=n?.state??`info`;return{id:`task:${e}:${a}`,category:`task`,type:`task.${a}`,sourceKind:n?.kind===`subagent`?`subagent`:`background_task`,sourceId:e,agentId:n?.agentId,title:r.trim(),severity:a===`completed`?`info`:`warning`,body:i.join(` -`).trim(),raw:t}}function rze(e){if(e?.source===void 0)return;let t=e.source.kind===`url`?{kind:`url`,url:e.source.url}:{kind:`file`,fileId:e.source.fileId};if(e.mediaType.startsWith(`image/`))return{type:`image`,source:t};if(e.mediaType.startsWith(`video/`))return{type:`video`,source:t};if(e.source.kind===`file`)return{type:`file`,fileId:e.source.fileId,name:e.name??e.attachmentId,mediaType:e.mediaType,size:e.size??0}}function ize(e){if(e==null)return;if(typeof e==`string`)return e.split(` +`).trim(),raw:t}}function uze(e){if(e?.source===void 0)return;let t=e.source.kind===`url`?{kind:`url`,url:e.source.url}:{kind:`file`,fileId:e.source.fileId};if(e.mediaType.startsWith(`image/`))return{type:`image`,source:t};if(e.mediaType.startsWith(`video/`))return{type:`video`,source:t};if(e.source.kind===`file`)return{type:`file`,fileId:e.source.fileId,name:e.name??e.attachmentId,mediaType:e.mediaType,size:e.size??0}}function dze(e){if(e==null)return;if(typeof e==`string`)return e.split(` `);if(!Array.isArray(e))return[JSON.stringify(e)];let t=[];for(let n of e){if(typeof n==`string`){t.push(...n.split(` `));continue}if(typeof n!=`object`||!n)continue;let e=n;e.type===`text`&&typeof e.text==`string`?t.push(...e.text.split(` `)):e.type===`think`&&typeof e.think==`string`&&t.push(...e.think.split(` -`))}return t.length>0?t:void 0}function H9(e){return e!==void 0&&Number.isFinite(Date.parse(e))?e:void 0}function aze(e){let t;for(let n of e){if(n===void 0)continue;let e=Date.parse(n);Number.isFinite(e)&&(t===void 0||e=0?n:void 0}var W9=R(typeof window>`u`?0:window.innerWidth),G9=0,K9=!1;function q9(){W9.value=window.innerWidth}function oze(){K9||typeof window>`u`||(window.addEventListener(`resize`,q9),K9=!0,q9())}function sze(){!K9||typeof window>`u`||(window.removeEventListener(`resize`,q9),K9=!1)}function J9(e,t,n){return Math.max(t,e-n)}function Y9(e,t,n){return Math.min(n,Math.max(t,e))}function X9(){return p(()=>{G9+=1,oze()}),ne(()=>{G9=Math.max(0,G9-1),G9===0&&sze()}),{viewportWidth:W9}}var cze=`pythinker-web.file-preview-width`;function lze({client:e,sideWidth:t,detailTarget:n,closeFilePreview:r}){let{viewportWidth:i}=X9(),a=L(()=>Math.max(0,i.value-t.value)),o=L(()=>J9(a.value,320,320));function c(e){return Y9(Math.round(e),320,o.value)}function l(){return c(a.value/2)}let u=L(()=>l()),d=R(u.value),f=L(()=>Y9(d.value,320,o.value)),p=R(null),m=L(()=>{let t=p.value;if(!t)return null;let n=e.turns.value.find(e=>e.id===t.turnId);return n?.role===`compaction`&&n.text?n.text:null}),h=L(()=>m.value!==null);function g(e){n.value=`compaction`,p.value=e}function _(){p.value=null,n.value===`compaction`&&(n.value=null)}let v=R(null),y=L(()=>{let t=v.value;if(!t)return{entry:void 0,version:0};let n=e.auxiliaryTranscripts.getEntry(t.sessionId,t.subagentId);return{entry:n,version:n?.version.value??0}});function b(t){let n=e.activeAppTasks.value.find(e=>e.agentId===t||e.id===t||e.backgroundTaskId===t||e.parentToolCallId===t);return n?.agentId??n?.id??t}let x=L(()=>{let t=v.value;if(!t)return null;let n=e.activeAppTasks.value.find(e=>e.agentId===t.subagentId||e.id===t.subagentId||e.backgroundTaskId===t.subagentId);if(n)return age(n);let r=y.value.entry?.channel;if(!r)return null;let i=r.agents.find(e=>e.agentId===t.subagentId),a=r.snapshot.items.findLast(e=>e.kind===`turn`),o=r.snapshot.meta.activity===`turn`,s=r.loading,c=a?.kind===`turn`&&a.state===`failed`,l=a?.kind===`turn`&&a.state===`cancelled`,u=r.refreshError&&a===void 0;return{id:t.subagentId,name:i?.label??t.subagentId,subagentType:i?.type===`sub`?`subagent`:i?.type,phase:o?`working`:l?`cancelled`:c||u?`failed`:s?`queued`:`completed`,status:o||s?`running`:l?`cancelled`:c||u?`failed`:`completed`}}),S=L(()=>{let t=v.value,n=y.value.entry?.channel;if(!t||!n)return[];let r=n.agents.find(e=>e.agentId===t.subagentId);return eze(n.snapshot,r,{sessionId:t.sessionId,getFileUrl:t=>e.getFileUrl(t)})}),C=L(()=>y.value.entry?.channel.loading??!1),w=L(()=>y.value.entry?.channel.refreshError??!1),T=L(()=>y.value.entry?.channel.loadingOlder??!1),E=L(()=>y.value.entry?.channel.loadOlderError??!1),D=L(()=>y.value.entry?.channel.snapshot.hasMoreOlder??!1),O=L(()=>y.value.entry?.channel.snapshot.meta.activity===`turn`),k=L(()=>x.value!==null);function A(t){let r=e.activeSessionId.value;if(!t||!r)return;let i=b(t),a=v.value;a&&a.subagentId!==i&&e.auxiliaryTranscripts.deactivate(a.sessionId,a.subagentId),v.value={sessionId:r,subagentId:i},n.value=`agent`,e.auxiliaryTranscripts.activate(r,i)}function j(){let t=v.value;t&&e.auxiliaryTranscripts.deactivate(t.sessionId,t.subagentId),v.value=null,n.value===`agent`&&(n.value=null)}s(n,(t,n)=>{if(n!==`agent`||t===`agent`)return;let r=v.value;r&&e.auxiliaryTranscripts.deactivate(r.sessionId,r.subagentId)});function M(){y.value.entry?.channel.loadOlder().catch(()=>void 0)}let N=R(null),ee=L(()=>{let t=N.value;if(!t)return null;let n=pre(e.turns.value,t);return n?{id:t,title:$x(n.name),path:nO(n.arg),lines:n.status===`error`?null:tO(n),output:n.output}:null}),P=L(()=>ee.value!==null);function F(e){n.value=`toolDiff`,N.value=e}function I(){N.value=null,n.value===`toolDiff`&&(n.value=null)}let te=R(`list`),ne=R(null);function re(){n.value=`diff`,te.value=`list`,ne.value=null,e.loadGitStatus(e.activeSessionId.value)}function ie(){n.value===`diff`&&(n.value=null),te.value=`list`,ne.value=null,e.clearFileDiff()}async function ae(t){te.value=`detail`,ne.value=t,await e.loadFileDiff(t)}async function oe(t){!e.activeSessionId.value&&e.activeWorkspaceId.value?await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,t):await e.openSideChat(t),n.value=`btw`}function se(){e.closeSideChat(),n.value===`btw`&&(n.value=null)}function z(){n.value===`btw`&&(n.value=null)}let ce=L(()=>e.sideChatVisible.value),B=L(()=>n.value!==null&&(n.value!==`compaction`||h.value)&&(n.value!==`agent`||k.value)&&(n.value!==`toolDiff`||P.value)&&(n.value!==`btw`||ce.value)),le=R(!1);function ue(){return n.value===`compaction`&&h.value?(_(),!0):n.value===`agent`&&k.value?(j(),!0):n.value===`toolDiff`&&P.value?(I(),!0):n.value===`file`?(r(),!0):n.value===`diff`?(ie(),!0):n.value===`btw`?(se(),!0):!1}return s(e.activeSessionId,()=>{r(),_(),j(),I(),ie(),z()}),{PREVIEW_WIDTH_KEY:cze,PREVIEW_MIN:320,previewDefaultWidth:u,previewMax:o,previewWidth:d,previewPanelWidth:f,compactionPanelText:m,compactionPanelVisible:h,openCompactionPanel:g,closeCompactionPanel:_,agentPanelMember:x,agentPanelTurns:S,agentPanelLoading:C,agentPanelLoadError:w,agentPanelLoadingMore:T,agentPanelLoadMoreError:E,agentPanelHasMore:D,agentPanelRunning:O,agentPanelVisible:k,openAgentPanel:A,closeAgentPanel:j,loadOlderAgentMessages:M,toolDiffTarget:ee,toolDiffVisible:P,openToolDiff:F,closeToolDiff:I,detailDiffMode:te,detailDiffPath:ne,openDiffDetail:re,closeDiffDetail:ie,selectDiffFile:ae,btwVisible:ce,openSideChatTab:oe,closeSideChat:se,hideSideChatPanel:z,sidePanelVisible:B,panelDragging:le,closeOpenSidePanel:ue}}var uze=qi.sidebarWidth,Z9=qi.sidebarCollapsed,Q9=270,$9=170,dze=480,fze=320;function pze(e={}){let{viewportWidth:t}=X9(),n=R(Q9),r=R(!1),i=R(!1),a=L(()=>{let n=fze+(te(e.previewOpen)?320:0);return Math.min(dze,J9(t.value,$9,n))}),o=L(()=>Y9(n.value,$9,a.value));function s(){try{r.value=Yi(Z9)===`true`}catch{r.value=!1}}function c(){try{Xi(Z9,String(r.value))}catch{}}function l(){r.value=!r.value,c()}return{SIDEBAR_WIDTH_KEY:uze,SIDEBAR_DEFAULT:Q9,SIDEBAR_MIN:$9,sidebarMax:a,sessionColWidth:n,sidebarCollapsed:r,sidebarDragging:i,sideWidth:o,loadSidebarCollapsed:s,toggleSidebarCollapse:l}}async function mze(e){if(!e.fileId)return{url:e.url};try{let t=await Q().getFileBlob(e.fileId),n=URL.createObjectURL(t);return{url:n,revoke:()=>URL.revokeObjectURL(n)}}catch{return{url:e.url}}}function hze({client:e,detailTarget:t}){let{t:n}=J(),r=R(null),i=R(null),a=R(!1),o=R(null),c=R(!1),l=R(!1),u=R(null),d=null,f=0;function p(t){return t?e.changes.value.find(e=>e.path===t)?.status??null:null}function m(){let e=u.value;!e||a.value||l.value||(c.value=p(e)!==d)}let h=L(()=>{let t=u.value;return t?e.getFileDownloadUrl(t):null}),g=L(()=>r.value!==null);function _(e){return e.length>1?e.replace(/\/+$/,``):e}function v(e){let t=[];for(let n of e.split(/[\\/]+/))if(!(!n||n===`.`)){if(n===`..`){t.pop();continue}t.push(n)}return t.join(`/`)}function y(t){let r=t.trim();if(!r)return{error:n(`filePreview.errors.emptyPath`)};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(r))return{error:n(`filePreview.errors.unsupportedPath`)};if(r.startsWith(`~`))return{error:n(`filePreview.errors.outsideWorkspace`)};let i=_(e.status.value.cwd);if(r.startsWith(`/`)){if(!i||r!==i&&!r.startsWith(`${i}/`))return{error:n(`filePreview.errors.outsideWorkspace`)};let e=r===i?``:r.slice(i.length+1);if(e.split(/[\\/]+/).includes(`..`))return{error:n(`filePreview.errors.outsideWorkspace`)};let t=v(e);return t?{path:t}:{error:n(`filePreview.errors.isDirectory`)}}if(r.split(/[\\/]+/).includes(`..`))return{error:n(`filePreview.errors.outsideWorkspace`)};let a=v(r);return a?{path:a}:{error:n(`filePreview.errors.emptyPath`)}}async function b(s,m){let h=++f,g=m?.preserveCurrent===!0&&i.value!==null;t.value=`file`,o.value=null,r.value=s,g?l.value=!0:(i.value=null,a.value=!0,c.value=!1,u.value=null,d=null);let _=y(s.path);if(`error`in _){a.value=!1,l.value=!1,o.value=_.error;return}u.value=_.path;try{let t=await e.readFileContent(_.path);if(h!==f)return;t?(i.value={...t,path:t.path||_.path},d=p(_.path),c.value=!1):g||(o.value=n(`filePreview.errors.loadFailed`))}catch(e){if(h!==f)return;g||(o.value=e instanceof Error?e.message:n(`filePreview.errors.loadFailed`))}finally{h===f&&(a.value=!1,l.value=!1)}}function x(){let e=r.value;!e||l.value||b(e,{preserveCurrent:!0})}function S(){f+=1,r.value=null,u.value=null,i.value=null,o.value=null,a.value=!1,l.value=!1,c.value=!1,d=null}function C(){S(),t.value===`file`&&(t.value=null)}s(t,(e,t)=>{t===`file`&&e!==`file`&&S()}),s(()=>e.changes.value,()=>{m()},{deep:!0});function w(){let t=i.value?.path??r.value?.path;t&&e.openWorkspaceFile(t,r.value?.line)}function T(){let t=i.value?.path??r.value?.path;t&&e.revealWorkspaceFile(t)}return{previewTarget:r,previewFile:i,previewLoading:a,previewError:o,previewStale:c,previewRefreshing:l,previewDownloadUrl:h,previewExternalActions:g,openFilePreview:b,closeFilePreview:C,refreshFilePreview:x,openPreviewInEditor:w,revealPreviewFile:T}}var gze=new Set([`agent`,`compaction`,`btw`]);function _ze(e){let t=R([]),n=R(null),r=R(!1),i=R(!1),a=new Map,o=0,c=L(()=>t.value.find(e=>e.id===n.value)??null);function l(e){let i=e.always?void 0:t.value.find(t=>t.type===e.type&&t.key===e.key);if(i)return i.title=e.title,i.payload=e.payload,n.value=i.id,r.value=!0,i;let a={...e,id:`panel-tab-${++o}`};return t.value=[...t.value,a],n.value=a.id,r.value=!0,a}function u(e){t.value.some(t=>t.id===e)&&(n.value=e,r.value=!0)}function d(e){let a=t.value.findIndex(t=>t.id===e);if(a<0)return null;let[o]=t.value.splice(a,1);return t.value=[...t.value],n.value===e&&(n.value=t.value[Math.min(a,t.value.length-1)]?.id??null),t.value.length===0&&(r.value=!1,i.value=!1),o??null}function f(){return r.value?(r.value=!1,i.value=!1,!0):!1}function p(){r.value=!r.value,r.value||(i.value=!1)}function m(){c.value!==null&&(i.value=!i.value,i.value&&(r.value=!0))}function h(e){let i=t.value.filter(e=>gze.has(e.type)),o=Math.max(0,i.findIndex(e=>e.id===n.value));if(i.length===0){a.delete(e);return}a.set(e,{tabs:i.map(({id:e,...t})=>({...t})),activeIndex:o,visible:r.value})}function g(e){let s=a.get(e);t.value=s?.tabs.map(e=>({...e,id:`panel-tab-${++o}`}))??[],n.value=t.value[s?.activeIndex??0]?.id??null,r.value=s?.visible===!0&&t.value.length>0,i.value=!1}return s(e,(e,t)=>{h(t),g(e)}),{tabs:t,activeTabId:n,activeTab:c,visible:r,expanded:i,openTab:l,activateTab:u,closeTab:d,hidePanel:f,togglePanel:p,toggleExpanded:m}}var vze={class:`server-auth-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`server-auth-title`},yze={class:`server-auth-card`},bze={class:`server-auth-body`},xze={class:`server-auth-foot`},Sze=Y(G({__name:`ServerAuthDialog`,setup(e){let t=R(``),r=R(null),i=R(!1);p(()=>{n(()=>r.value?.focus())});function a(){let e=t.value;!e||i.value||(i.value=!0,mw(e),window.location.reload())}function o(e){e.key===`Enter`&&(e.preventDefault(),a())}return(e,n)=>(c(),W(`div`,vze,[F(`div`,yze,[n[1]||=F(`div`,{class:`server-auth-head`},[F(`h1`,{id:`server-auth-title`,class:`server-auth-title`},`Server token required`),F(`p`,{class:`server-auth-hint`},[K(` This server is protected. Enter the bearer token printed when the server started (or the password set via `),F(`code`,null,`PYTHINKER_CODE_PASSWORD`),K(`). `)])],-1),F(`div`,bze,[v(Pp,{ref_key:`inputRef`,ref:r,modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`password`,autocomplete:`current-password`,placeholder:`Token`,disabled:i.value,onKeydown:o},null,8,[`modelValue`,`disabled`])]),F(`div`,xze,[v(YT,{variant:`primary`,disabled:!t.value||i.value,loading:i.value,onClick:a},{default:B(()=>[K(U(i.value?`Connecting…`:`Connect`),1)]),_:1},8,[`disabled`,`loading`])])])]))}}),[[`__scopeId`,`data-v-82dad292`]]),Cze={class:`app-shell`},wze={key:2,class:`offline-strip`,role:`status`},Tze=[`aria-label`,`aria-hidden`],Eze={class:`pt-shell`},Dze={class:`pt-body`},Oze=[`aria-label`],kze=[`disabled`],Aze=[`disabled`],jze=Y(G({__name:`App`,setup(e){dw();let t=R(!1),r=null,i=D7();d(O7,i.expertTalk);let a=UT(),o=R([]),u=R(!1),f=R(null),m=R(null),g=R(null),_=null,y=R(null),b=L(()=>{let e=i.activeWorkspaceId.value;return e?[...i.sessionsForView.value,...o.value].filter(t=>t.workspaceId===e).toSorted((e,t)=>new Date(t.updatedAt??0).getTime()-new Date(e.updatedAt??0).getTime()).slice(0,6):[]});function x(e){return{id:e.id,title:e.title,time:new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}).format(-Math.max(0,Math.floor((Date.now()-new Date(e.updatedAt).getTime())/864e5)),`day`),busy:!1,updatedAt:e.updatedAt,workspaceId:e.workspaceId,archived:!0}}async function S(){try{let e=[],t;for(;;){let n=await i.loadArchivedSessions({beforeId:t,pageSize:100});if(e.push(...n.items),!n.hasMore||n.items.length===0||(t=n.items.at(-1)?.id,t===void 0))break}o.value=e.map(x)}catch(e){console.warn(`loadDoneSessions failed`,e)}}let C=L(()=>{let e=new Map(i.workspaceGroups.value.flatMap(e=>e.sessions.map(e=>[e.id,e.updatedAt])));return i.sessionsForView.value.map(t=>({id:t.id,title:t.title,workspaceId:t.workspaceId??``,workspaceName:t.workspaceName??`-`,lastPrompt:t.lastPrompt,updatedAt:t.updatedAt??e.get(t.id)??new Date(0).toISOString(),archived:!1}))});async function w(){let e=[],t;for(;;){let n=await i.loadArchivedSessions({beforeId:t,pageSize:100});if(e.push(...n.items),!n.hasMore||n.items.length===0||(t=n.items.at(-1)?.id,t===void 0))break}let n=i.workspacesView.value;return e.filter(e=>!e.parentSessionId).map(e=>{let t=n.find(t=>t.id===e.workspaceId||t.root===e.cwd);return{id:e.id,title:e.title,workspaceId:t?.id??e.workspaceId??e.cwd,workspaceName:t?.name??e.cwd.split(`/`).filter(Boolean).at(-1)??`-`,lastPrompt:e.lastPrompt,updatedAt:e.updatedAt,archived:!0}})}function T(){u.value=!0,i.loadAllSessions()}function D(e,t){f.value={kind:e,ids:Array.isArray(t)?t:[t]}}let O=L(()=>!i.dangerousBypassAuth.value&&t.value);d(`resolveImage`,i.resolveImageUrl),d(`modelDisplay`,e=>{if(e===void 0||e.length===0)return;let t=i.models.value.find(t=>t.id===e)??i.models.value.find(t=>t.model===e);return t?.displayName||t?.model||(e.includes(`/`)?e.split(`/`).pop():e)}),d(`subagentEffort`,e=>e!==void 0&&e.length>0&&e!==`off`&&e!==`on`?e6(e):void 0),d(`resolveDynamicWorkflowMembers`,e=>i.dynamicWorkflowMembersByToolCallId.value.get(e)??[]),d(`mainModelBinding`,()=>{let e=i.status.value.modelId;if(e)return{model:e,effort:i.thinking.value}}),d(`openAgentSettings`,()=>{An(`agent`)});let{t:k}=J(),{confirm:j}=K4(),N=fx(),I=a6(),te=R(!1),ne=R(!1),re=L(()=>{let e=i.activeSessionId.value;return i.sessions.value.find(t=>t.id===e)?.title??o.value.find(t=>t.id===e)?.title??``}),ie=L(()=>{let e=i.activeSessionId.value;return i.sessions.value.find(t=>t.id===e)?.lastTurnReason}),se=L(()=>{let e=i.activeSessionId.value;if(e)return vC(e)}),ce=L(()=>o.value.some(e=>e.id===i.activeSessionId.value)),le=L(()=>i.visibleWorkspace.value?.sessionCount??0),ue=L(()=>i.activity.value!==`idle`),{showAuthGate:de}=QRe({client:i});$Re({running:ue,showAuthGate:de});let fe=L(()=>r6(i.models.value.find(e=>e.id===i.status.value.modelId),i.thinking.value)),H=R(!1),G=L(()=>i.appState.value===`first-run`),pe=L(()=>i.appState.value===`recovery`&&!H.value),me=L(()=>i.appState.value===`recovery`&&H.value);s(()=>i.appState.value,e=>{e!==`recovery`&&(H.value=!1)}),s(i.lastDeletedSessionId,e=>{e!==null&&(o.value=o.value.filter(t=>t.id!==e))});function he(){H.value=!1}let ge=R(!1);function _e(){i.setOnboarded(!0),ge.value=!1}function ve(){ge.value=!0}let ye=0;function be(){let e=window.visualViewport,t=document.documentElement.style;t.setProperty(`--app-height`,`${e?.height??window.innerHeight}px`),t.setProperty(`--app-top`,`${e?.offsetTop??0}px`)}function xe(){ye||=requestAnimationFrame(()=>{ye=0,be()})}p(()=>{a.subscribe(),r=gw(()=>{t.value=!0,i.clearDangerousBypassAuth()}),i.load(),pt(),be(),window.visualViewport?.addEventListener(`resize`,xe),window.visualViewport?.addEventListener(`scroll`,xe),window.addEventListener(`resize`,xe),document.addEventListener(`keydown`,Se,!0)}),h(()=>{a.unsubscribe(),it(),document.removeEventListener(`keydown`,Se,!0),window.visualViewport?.removeEventListener(`resize`,xe),window.visualViewport?.removeEventListener(`scroll`,xe),window.removeEventListener(`resize`,xe),ye&&=(cancelAnimationFrame(ye),0),document.documentElement.style.removeProperty(`--app-height`),document.documentElement.style.removeProperty(`--app-top`),r!==null&&(r(),r=null)});function Se(e){e.key!==`Escape`||e.isComposing||Tn.value}let Ce=R(null),we=R(null),{tabs:Te,activeTabId:Ee,activeTab:De,visible:Oe,expanded:ke,openTab:Ae,activateTab:je,closeTab:Me,hidePanel:q,togglePanel:Ne,toggleExpanded:Pe}=_ze(L(()=>i.activeSessionId.value??`__draft__:${i.activeWorkspaceId.value??`none`}`));function Fe(e){we.value=e,Ce.value=`turnDiff`}function Ie(){we.value=null,Ce.value===`turnDiff`&&(Ce.value=null)}let Le=R(!1);s(i.activeSessionId,()=>{Ie(),Le.value=!0,n(()=>{Le.value=!1})});let{previewTarget:Re,previewFile:ze,previewLoading:Be,previewError:Ve,previewStale:He,previewRefreshing:Ue,previewDownloadUrl:We,previewExternalActions:Ge,openFilePreview:Ke,closeFilePreview:qe,refreshFilePreview:Je,openPreviewInEditor:Ye,revealPreviewFile:Xe}=hze({client:i,detailTarget:Ce});yEe(()=>i.activeSessionId.value);function Ze(e){Ce.value=`editor`,l9({path:e,line:Re.value?.line})}function Qe(){Ce.value===`editor`&&(Ce.value=null),p9()}s(Ce,(e,t)=>{t===`editor`&&e!==`editor`&&p9()});let $e=R(null),et=R(null),tt=0,nt;async function rt(e){if(e.kind!==`image`&&e.kind!==`video`)return;let t=++tt;nt?.(),nt=void 0,$e.value=null,et.value=null;let n=await mze(e);if(t!==tt){n.revoke?.();return}nt=n.revoke,$e.value=e,et.value=n.url}function it(){tt+=1,nt?.(),nt=void 0,$e.value=null,et.value=null}let{SIDEBAR_WIDTH_KEY:at,SIDEBAR_DEFAULT:ot,SIDEBAR_MIN:st,sidebarMax:ct,sessionColWidth:lt,sidebarCollapsed:ut,sidebarDragging:dt,sideWidth:ft,loadSidebarCollapsed:pt,toggleSidebarCollapse:mt}=pze({previewOpen:L(()=>Oe.value)}),{PREVIEW_WIDTH_KEY:ht,PREVIEW_MIN:gt,previewDefaultWidth:_t,previewMax:vt,previewWidth:yt,previewPanelWidth:bt,compactionPanelText:xt,compactionPanelVisible:St,openCompactionPanel:Ct,closeCompactionPanel:wt,agentPanelMember:Tt,agentPanelTurns:Et,agentPanelLoading:Dt,agentPanelLoadError:Ot,agentPanelLoadingMore:kt,agentPanelLoadMoreError:At,agentPanelHasMore:jt,agentPanelRunning:Mt,openAgentPanel:Nt,closeAgentPanel:Pt,loadOlderAgentMessages:Ft,toolDiffTarget:It,openToolDiff:Lt,closeToolDiff:Rt,detailDiffMode:zt,detailDiffPath:Bt,openDiffDetail:Vt,closeDiffDetail:Ht,selectDiffFile:Ut,btwVisible:Wt,openSideChatTab:Gt,closeSideChat:Kt,hideSideChatPanel:qt,panelDragging:Jt}=lze({client:i,sideWidth:ft,detailTarget:Ce,closeFilePreview:qe});function Yt(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function Xt(e){Ae({type:`file`,key:e.path,title:Yt(e.path),icon:`file-text`,payload:e})}function Zt(e){Ae({type:`editor`,key:e,title:Yt(e),icon:`file-edit`,payload:{path:e}})}function Qt(e){Ae({type:`compaction`,key:e.turnId,title:k(`panel.tabs.compaction`),icon:`thinking`,payload:e})}function $t(e){let t=i.activeAppTasks.value.find(t=>t.agentId===e||t.id===e||t.backgroundTaskId===e||t.parentToolCallId===e);Ae({type:`agent`,key:t?.agentId??t?.id??e,title:t?.description||k(`panel.tabs.agent`),icon:`robot`,payload:{target:e}})}s(i.activeAppTasks,e=>{for(let t of Te.value){if(t.type!==`agent`)continue;let n=t.payload?.target??t.key,r=e.find(e=>e.agentId===n||e.id===n||e.backgroundTaskId===n||e.parentToolCallId===n);r?.description&&(t.title=r.description)}});function en(e){Lt(e);let t=It.value;Ae({type:`toolDiff`,key:e,title:t?.path?Yt(t.path):t?.title??k(`panel.tabs.diff`),icon:`file-edit`,payload:{id:e}})}function tn(){Ae({type:`diff`,key:`workspace`,title:k(`panel.tabs.diff`),icon:`git-fork`})}function nn(e){let t=Te.value.find(t=>t.type===`turnDiff`&&t.key===e.turnId);if(t?.id===Ee.value){sn(t.id);return}Ae({type:`turnDiff`,key:e.turnId,title:k(`panel.tabs.turnDiff`),icon:`git-fork`,payload:e})}async function rn(e){await Gt(e),Ae({type:`btw`,key:`side-chat`,title:k(`sideChat.title`),icon:`message`,payload:{prompt:e}})}function an(e){e.type===`file`?qe():e.type===`editor`?Qe():e.type===`compaction`?wt():e.type===`agent`?Pt():e.type===`toolDiff`?Rt():e.type===`diff`?Ht():e.type===`turnDiff`?Ie():e.type===`btw`&&qt()}function on(e){if(e===null){Ce.value=null;return}e.type===`file`?Ke(e.payload):e.type===`editor`?Ze(e.payload.path):e.type===`compaction`?Ct(e.payload):e.type===`agent`?Nt(e.payload.target):e.type===`toolDiff`?Lt(e.payload.id):e.type===`diff`?Vt():e.type===`turnDiff`?Fe(e.payload):e.type===`btw`&&(Ce.value=`btw`)}s(De,(e,t)=>{t&&t.id!==e?.id&&an(t),on(e)},{flush:`post`});function sn(e){Te.value.find(t=>t.id===e)?.type===`btw`&&Kt(),Me(e)}function cn(){Ee.value&&sn(Ee.value)}let ln=R(null);async function un(){return i.expertTalk.status.value?.activation.state===`armed`?(await i.expertTalk.disarm(),i.expertTalk.status.value?.activation.state!==`armed`&&i.expertTalk.error.value===void 0):!0}async function dn(e){await un()&&ln.value?.loadComposerForEdit(e)}async function fn(e){await un()&&await Qn(k(`expertTalk.buildPrompt`,{answer:e}))}let pn=R(null);function mn(){let e=!1,t=t=>{t instanceof KeyboardEvent&&t.repeat||(e=!0)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0),window.addEventListener(`blur`,t),document.addEventListener(`visibilitychange`,t),()=>{n(()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0),window.removeEventListener(`blur`,t),document.removeEventListener(`visibilitychange`,t),!e&&document.hasFocus()&&pn.value?.focusInput()})}}let hn=R(!1),gn=R(!1),_n=R(!1),vn=R(!1),yn=R(`general`),bn=L(()=>ba.value>0||hn.value||gn.value||_n.value||vn.value||te.value||ne.value||$e.value!==null),xn=L(()=>De.value?.title);function Sn(e){ln.value?.insertComposerQuote(e),I.value&&Oe.value&&q()}let Cn=R(null),wn=R(null),Tn=L(()=>ba.value>0||hn.value||gn.value||_n.value||vn.value||ge.value||te.value||ne.value||$e.value!==null),En=R(!1),Dn=R(!1),On=R(!1);async function kn(){En.value=!0,Dn.value=!1,hn.value=!0;try{await i.refreshAllProviders()}catch{Dn.value=!0}finally{En.value=!1}}function An(e=`general`){yn.value=e,vn.value=!0}function jn(){An(`providers`)}function Mn(){jn()}async function Nn(e){hn.value=!1,await Pn(e)}async function Pn(e){await i.setModel(e)&&e!==i.defaultModel.value&&i.updateConfig({defaultModel:e})}async function Fn(e){await i.archiveSession(e),await S(),D(`done`,e)}async function In(e){await i.restoreSession(e)&&(o.value=o.value.filter(t=>t.id!==e),D(`open`,e))}async function Ln(e,t){await i.renameSession(e,t),o.value.some(t=>t.id===e)&&await S()}async function Rn(e,t){let n=o.value.find(t=>t.id===e);if(!n){await i.setSessionEmoji(e,t);return}await Ln(e,kp(t,n.title))}async function zn(e,t){let n=e.map(e=>e.id);for(let e of n)t===`archive`?await i.archiveSession(e):await i.restoreSession(e);await S(),D(t===`archive`?`done`:`open`,n)}async function Bn(){let e=f.value;if(e){f.value=null;for(let t of e.ids)e.kind===`done`?await i.restoreSession(t):await i.archiveSession(t);await S()}}async function Vn(e){let t=e??i.activeSessionId.value;t&&(m.value={state:`running`,sessionId:t},m.value=await i.exportSession(t)?{state:`done`,sessionId:t}:null)}async function Hn(e){let t=(i.sessions.value.find(t=>t.id===e)??o.value.find(t=>t.id===e))?.title??e;await j({title:k(`sidebar.deleteSession`),message:k(`sidebar.deleteSessionConfirm`,{title:t}),variant:`danger`,action:async()=>{await i.deleteSession(e),o.value=o.value.filter(t=>t.id!==e),y.value=k(`sidebar.deleteSessionToast`)}})}async function Un(e){let t=i.workspacesView.value.find(t=>t.id===e)?.name??e;await j({title:k(`sidebar.removeWorkspace`),message:k(`workspace.removeWorkspaceConfirm`,{name:t}),variant:`danger`,action:()=>i.deleteWorkspace(e)})}async function Wn(e){On.value=!0;try{await i.updateConfig(e)&&await Promise.all([i.refreshRuntimeState(),i.refreshServerMeta()])}finally{On.value=!1}}async function Gn(e){await i.undo(1),await n(),ln.value?.loadComposerForEdit(e.text,e.attachments)}function Kn(e){if(e===`/compact`||e.startsWith(`/compact `)){i.compact(e.slice(8).trim()||void 0);return}if(e===`/dynamic_workflow`||e.startsWith(`/dynamic_workflow `)){let t=e.slice(17).trim();t===`on`?i.setDynamicWorkflowMode(!0):t===`off`?i.setDynamicWorkflowMode(!1):t?(i.setDynamicWorkflowMode(!0),i.sendPrompt(t)):i.toggleDynamicWorkflowMode();return}if(e===`/goal`||e.startsWith(`/goal `)){let t=e.slice(5).trim();t===`pause`||t===`resume`||t===`cancel`?i.controlGoal(t):t?i.createGoal(t):i.toggleGoalMode();return}if(e===`/tower`||e.startsWith(`/tower `)){if(!i.towerAvailable.value)return;let t=e.slice(6).trim();t===`off`?i.setTowerMode(!1):t===`on`||t===``?t===`on`||!i.towerMode.value?i.setTowerMode(!0):i.setTowerMode(!1):i.setTowerMode(!0,t);return}if(e===`/btw`||e.startsWith(`/btw `)){let t=e.slice(4).trim();if(!t&&De.value?.type===`btw`)cn();else{let e=mn();rn(t||void 0).then(e,e)}return}switch(e){case`/new`:case`/clear`:ir();break;case`/fork`:i.forkSession();break;case`/export`:Vn();break;case`/undo`:i.undo();break;case`/plan`:i.togglePlanMode();break;case`/status`:_n.value=!0;break;case`/login`:Mn();break;default:{let t=e.indexOf(` `),n=Fpe((t===-1?e:e.slice(0,t)).slice(1)),r=t===-1?void 0:e.slice(t+1).trim()||void 0;if(!n)break;!i.activeSessionId.value&&i.activeWorkspaceId.value?i.startSessionAndActivateSkill(i.activeWorkspaceId.value,n,r):i.activateSkill(n,r);break}}}function qn(e){i.unqueue(e)}function Jn(e){i.unqueue(e)}function Yn(e){i.reorderQueue(e.from,e.to)}function Xn(e){i.steerQueued(e)}async function Zn(e){let t=i.activeWorkspaceId.value;if(!i.activeSessionId.value&&t){await i.startSessionAndSendPrompt(t,e.text,e.attachments);return}if(!i.activeSessionId.value&&!t){Cn.value=e,gn.value=!0;return}i.sendPrompt(e.text,e.attachments)}async function Qn(e){let t=i.activeWorkspaceId.value;if(!i.activeSessionId.value&&t){await i.startSessionAndSendPrompt(t,e,[]);return}i.activeSessionId.value&&i.sendPrompt(e)}async function $n(e){if(wn.value=null,!await i.addWorkspaceByPath(e)){wn.value=k(`workspace.addFailed`);return}gn.value=!1;let t=Cn.value;Cn.value=null;let n=i.activeWorkspaceId.value;t&&n&&await i.startSessionAndSendPrompt(n,t.text,t.attachments)}function er(){Cn.value=null,wn.value=null,gn.value=!1}async function tr(e){for(let t of e)if(wn.value=null,!await i.addWorkspaceByPath(t)){wn.value=k(`workspace.addFailed`),gn.value=!0;return}}async function nr(e,t){let n=await i.generateSessionTitle(e);n===null&&(g.value=k(`sidebar.genTitleUnavailable`),_!==null&&clearTimeout(_),_=setTimeout(()=>{g.value=null,_=null},5e3)),t(n)}function rr(){n(()=>{ln.value?.focusComposer()})}function ir(){let e=i.activeWorkspaceId.value;e?i.openWorkspaceDraft(e):i.clearActiveSession(),rr()}let ar=L(()=>i.backend.value===`v2`&&i.experimentalFlagState(`expert_talk`)?.enabled===!0);async function or(){let e=i.activeWorkspaceId.value;if(e===null)return;let t=i.models.value.filter(e=>e.maxContextSize>0&&(e.capabilities??[]).some(e=>e.trim().toLowerCase().replaceAll(`-`,`_`)===`tool_use`)),n=i.expertTalk.preferredPair.value??i.expertTalk.status.value?.config,r=new Set(t.map(e=>e.id)),a=n!=null&&n.fusionLeadModelId!==n.peerModelId&&r.has(n.fusionLeadModelId)&&r.has(n.peerModelId)?n:void 0;if(a===void 0){An(`expertOpinion`);return}if(!await i.startExpertOpinionSession(e,a)){An(`expertOpinion`);return}rr()}function sr(e){i.openWorkspaceDraft(e),rr()}function cr(e){e&&window.open(e,`_blank`,`noopener`)}return(e,t)=>(c(),W(`div`,Cze,[v(uFe),O.value?(c(),P(Sze,{key:0})):E(``,!0),pe.value?(c(),P(gRe,{key:1,onOpenProviders:t[0]||=()=>{H.value=!0,jn()},onDismiss:t[1]||=e=>H.value=!0})):E(``,!0),me.value?(c(),W(`div`,wze,[F(`span`,null,U(z(k)(`recovery.offlineNotice`)),1),F(`button`,{type:`button`,"data-testid":`offline-strip-reconnect`,onClick:t[2]||=e=>H.value=!1},U(z(k)(`recovery.addProvider`)),1)])):E(``,!0),pe.value?E(``,!0):(c(),W(`div`,{key:3,class:V([`app`,{mobile:z(I),"sidebar-collapsed":z(ut)&&!z(I),"macos-desktop":z(OT),"panel-expanded":z(ke)}]),style:ae({"--preview-w":z(bt)+`px`})},[z(I)?(c(),P(vFe,{key:1,workspace:z(i).visibleWorkspace.value,"session-title":re.value,running:ue.value,branch:z(i).status.value.branch,"session-count":le.value,onOpenSwitcher:t[25]||=e=>te.value=!0,onOpenSettings:t[26]||=e=>ne.value=!0},null,8,[`workspace`,`session-title`,`running`,`branch`,`session-count`])):(c(),W(M,{key:0},[v(mD,{collapsed:z(ut),dragging:z(dt),"col-width":z(ft),"active-workspace":z(i).visibleWorkspace.value,"active-workspace-id":z(i).activeWorkspaceId.value,sessions:z(i).sessionsForView.value,"archived-sessions":o.value,"pinned-ids":z(i).pinnedSessionIds.value,"pinned-collapsed":z(i).pinnedCollapsed.value,groups:z(i).workspaceGroups.value,"active-id":z(i).activeSessionId.value,"attention-by-session":z(i).attentionBySession.value,"pending-by-session":z(i).pendingBySession.value,"unread-by-session":z(i).unreadBySession.value,"workspace-sort-mode":z(i).workspaceSortMode.value,workspaces:z(i).workspacesView.value,"tabs-enabled":z(i).config.value?.experimental?.sidebarTabs===!0,"expert-opinion-available":ar.value,onSelect:t[3]||=e=>z(i).selectSession(e),onCreate:ir,onCreateExpertOpinion:or,onCreateInWorkspace:t[4]||=e=>sr(e),onSelectWorkspace:t[5]||=e=>z(i).openWorkspace(e),onAddWorkspace:t[6]||=e=>gn.value=!0,onAddWorkspacePaths:tr,onRename:Ln,onGenerateTitle:nr,onArchive:t[7]||=e=>Fn(e),onDeleteSession:t[8]||=e=>Hn(e),onRestore:t[9]||=e=>In(e),onPin:t[10]||=e=>z(i).togglePinnedSession(e),onReorderPins:t[11]||=e=>z(i).reorderPinnedSessions(e),onTogglePinnedCollapsed:t[12]||=e=>z(i).togglePinnedCollapsed(),onSetSessionEmoji:Rn,onLoadDoneSessions:S,onFork:t[13]||=e=>z(i).forkSession(e),onExport:t[14]||=e=>Vn(e),onRenameWorkspace:t[15]||=(e,t)=>z(i).renameWorkspace(e,t),onDeleteWorkspace:t[16]||=e=>Un(e),onReorderWorkspaces:t[17]||=e=>z(i).reorderWorkspaces(e),onSetWorkspaceSortMode:t[18]||=e=>z(i).setWorkspaceSortMode(e),onLoadMoreSessions:t[19]||=e=>void z(i).loadMoreSessions(e),onLoadAllSessions:t[20]||=e=>void z(i).loadAllSessions(),onOpenSettings:t[21]||=e=>An(),onOpenSessionAdmin:T,onOpenFile:t[22]||=e=>Xt(e),onCollapse:z(mt)},null,8,[`collapsed`,`dragging`,`col-width`,`active-workspace`,`active-workspace-id`,`sessions`,`archived-sessions`,`pinned-ids`,`pinned-collapsed`,`groups`,`active-id`,`attention-by-session`,`pending-by-session`,`unread-by-session`,`workspace-sort-mode`,`workspaces`,`tabs-enabled`,`expert-opinion-available`,`onCollapse`]),l(v(GD,{class:`side-handle`,"storage-key":z(at),"default-width":z(ot),min:z(st),max:z(ct),"onUpdate:width":t[23]||=e=>lt.value=e,"onUpdate:dragging":t[24]||=e=>dt.value=e},null,8,[`storage-key`,`default-width`,`min`,`max`]),[[A,!z(ut)]])],64)),u.value?(c(),P(Sne,{key:2,"open-sessions":C.value,workspaces:z(i).workspacesView.value,"load-archived":w,"archive-session":Fn,"restore-session":In,"run-batch":zn,onOpen:t[27]||=e=>{u.value=!1,z(i).selectSession(e)},onRename:t[28]||=(e,t)=>z(i).renameSession(e,t),onFork:t[29]||=e=>z(i).forkSession(e),onExport:t[30]||=e=>Vn(e),onBack:t[31]||=e=>u.value=!1},null,8,[`open-sessions`,`workspaces`])):(c(),P(qwe,{key:3,ref_key:`conversationPaneRef`,ref:ln,mobile:z(I),turns:z(i).turns.value,"expert-talk-runs":z(i).expertTalk.runs.value,"session-id":z(i).activeSessionId.value,approvals:z(i).pendingApprovals.value,changes:z(i).changes.value,"git-info":z(i).gitInfo.value,tasks:z(i).tasks.value,todos:z(i).todos.value,goal:z(i).goal.value,"activation-badges":z(i).activationBadges.value,status:z(i).status.value,thinking:z(i).thinking.value,"plan-mode":z(i).planMode.value,"plan-armed":z(i).planArmed.value,"session-plans":z(i).sessionPlans.value,"reveal-saved-plan":z(i).revealSavedPlan,"overlay-open":bn.value,"goal-mode":z(i).goalMode.value,"tower-mode":z(i).towerMode.value,"tower-available":z(i).towerAvailable.value,"dynamic-workflow-mode":z(i).dynamicWorkflowMode.value,models:z(i).models.value,"starred-ids":z(i).starredModelIds.value,skills:z(i).skills.value,questions:z(i).questions.value,"pending-question-actions":z(i).pendingQuestionActions,"pending-approval-actions":z(i).pendingApprovalActions,running:ue.value,"turn-active":z(i).turnActive.value,queued:z(i).queued.value,"search-files":z(i).searchFiles,"upload-image":z(i).uploadImage,working:z(i).working.value,starting:z(i).isStartingFirstPrompt.value,"fast-moon":z(i).fastMoon.value,"file-reload-key":z(i).activeSessionId.value,"session-loading":z(i).sessionLoading.value,compaction:z(i).compaction.value,"has-more-messages":z(i).hasMoreMessages.value,"loading-more":z(i).loadingMoreMessages.value,"loading-more-error":z(i).loadMoreMessagesError.value,"load-older-messages":z(i).loadOlderMessages,"workspace-name":z(i).visibleWorkspace.value?.name,"workspace-root":z(i).visibleWorkspace.value?.root??z(i).status.value.cwd,"git-diff-stats":z(i).gitDiffStats.value,workspaces:z(i).workspacesView.value,"active-workspace-id":z(i).activeWorkspaceId.value,"session-title":re.value,pr:z(i).activePullRequest.value,"panel-visible":z(Oe),"panel-expanded":z(ke),"active-panel-type":z(De)?.type,"toggle-panel":z(Ne),"conversation-toc":z(i).conversationToc.value,"turn-folding":z(i).turnFolding.value,"activity-run-folding":z(i).activityRunFolding.value,"last-turn-reason":ie.value,"turn-error-kind":se.value?.reason===`max_steps`?`max_steps`:void 0,"turn-error-message":se.value?.message,"session-done":ce.value,pinned:z(i).pinnedSessionIds.value.includes(z(i).activeSessionId.value??``),"recent-sessions":b.value,onOpenChanges:t[32]||=e=>tn(),onTakeExpertTalk:dn,onBuildExpertTalk:fn,onSelectWorkspace:t[33]||=e=>sr(e),onAddWorkspace:t[34]||=e=>gn.value=!0,onOpenPr:cr,onSubmit:t[35]||=e=>Zn(e),onSteer:t[36]||=e=>z(i).steerPrompt(e.text,e.attachments),onApproval:t[37]||=(e,t)=>z(i).respondApproval(e,t),onCancelTask:t[38]||=e=>z(i).cancelTask(e),onAnswer:t[39]||=(e,t)=>z(i).respondQuestion(e,t),onDismiss:t[40]||=e=>z(i).dismissQuestion(e),onCommand:Kn,onInterrupt:t[41]||=e=>z(i).abortCurrentPrompt(),onUnqueue:qn,onEditQueued:Jn,onReorderQueue:Yn,onSteerQueued:Xn,onSetPermission:t[42]||=e=>z(i).setPermission(e),onSetThinking:t[43]||=e=>z(i).setThinking(e),onTogglePlan:t[44]||=e=>z(i).togglePlanMode(),onToggleWorkflow:t[45]||=e=>z(i).toggleDynamicWorkflowMode(),onToggleGoal:t[46]||=e=>z(i).toggleGoalMode(),onToggleTower:t[47]||=e=>z(i).toggleTowerMode(),onCreateGoal:t[48]||=e=>z(i).createGoal(e),onControlGoal:t[49]||=e=>z(i).controlGoal(e),onRefreshGitStatus:t[50]||=e=>z(i).activeSessionId.value&&z(i).loadGitStatus(z(i).activeSessionId.value),onRenameSession:t[51]||=(e,t)=>z(i).renameSession(e,t),onForkSession:t[52]||=e=>z(i).forkSession(e),onArchiveSession:t[53]||=e=>Fn(e),onRestoreSession:t[54]||=e=>In(e),onSelectSession:t[55]||=e=>z(i).selectSession(e),onTogglePin:t[56]||=e=>z(i).togglePinnedSession(e),onOpenSessionAdmin:T,onExportSession:t[57]||=e=>Vn(e),onCompact:t[58]||=e=>z(i).compact(),onPickModel:t[59]||=e=>kn(),onSelectModel:t[60]||=e=>Pn(e),onOpenFile:t[61]||=e=>Xt(e),onOpenMedia:t[62]||=e=>rt(e),onOpenCompaction:t[63]||=e=>Qt(e),onOpenAgent:t[64]||=e=>$t(e),onDetachTask:t[65]||=e=>z(i).detachTask(e),onOpenToolDiff:t[66]||=e=>en(e),onOpenTurnDiff:t[67]||=e=>nn(e),onEditMessage:Gn,onContinueTurn:Qn},null,8,`mobile.turns.expert-talk-runs.session-id.approvals.changes.git-info.tasks.todos.goal.activation-badges.status.thinking.plan-mode.plan-armed.session-plans.reveal-saved-plan.overlay-open.goal-mode.tower-mode.tower-available.dynamic-workflow-mode.models.starred-ids.skills.questions.pending-question-actions.pending-approval-actions.running.turn-active.queued.search-files.upload-image.working.starting.fast-moon.file-reload-key.session-loading.compaction.has-more-messages.loading-more.loading-more-error.load-older-messages.workspace-name.workspace-root.git-diff-stats.workspaces.active-workspace-id.session-title.pr.panel-visible.panel-expanded.active-panel-type.toggle-panel.conversation-toc.turn-folding.activity-run-folding.last-turn-reason.turn-error-kind.turn-error-message.session-done.pinned.recent-sessions`.split(`.`))),!z(I)&&z(ut)?(c(),P(vp,{key:4,text:z(ut)?z(k)(`sidebar.expandSidebar`):z(k)(`sidebar.collapseSidebar`)},{default:B(()=>[v(Ca,{class:`sidebar-toggle-btn`,size:`sm`,label:z(ut)?z(k)(`sidebar.expandSidebar`):z(k)(`sidebar.collapseSidebar`),onClick:z(mt)},{default:B(()=>[v(X,{name:z(ut)?`panel-expand`:`panel-collapse`},null,8,[`name`])]),_:1},8,[`label`,`onClick`])]),_:1},8,[`text`])):E(``,!0),!z(I)&&z(ut)?(c(),P(vp,{key:5,text:z(k)(`sidebar.newChat`)},{default:B(()=>[v(Ca,{class:`new-chat-btn`,size:`sm`,label:z(k)(`sidebar.newChat`),onClick:ir},{default:B(()=>[v(X,{name:`chat-new`})]),_:1},8,[`label`])]),_:1},8,[`text`])):E(``,!0),!u.value&&(!z(I)||z(Oe))?(c(),W(`aside`,{key:6,class:V([`global-preview`,{open:z(Oe),mobile:z(I),expanded:z(ke),"no-anim":z(Jt)||Le.value}]),role:`complementary`,"aria-label":z(k)(`layout.detailPanelAria`),"aria-hidden":!z(Oe)},[F(`div`,Eze,[z(Oe)&&!z(I)&&!z(ke)?(c(),P(GD,{key:0,class:`panel-resize`,"storage-key":z(ht),"default-width":z(_t),min:z(gt),max:z(vt),reverse:``,"aria-label":z(k)(`layout.resizePreviewAria`),"onUpdate:width":t[68]||=e=>yt.value=e,"onUpdate:dragging":t[69]||=e=>Jt.value=e},null,8,[`storage-key`,`default-width`,`min`,`max`,`aria-label`])):E(``,!0),v(iOe,{tabs:z(Te),"active-id":z(Ee),expanded:z(ke),mobile:z(I),"can-open-diff":z(i).status.value.isGitRepo&&z(i).activeSessionId.value!==null,"can-open-side-chat":!!z(i).activeWorkspaceId.value,onActivate:z(je),onClose:sn,onToggleExpanded:z(Pe),onHide:z(q),onOpenDiff:tn,onOpenSideChat:t[70]||=e=>rn()},null,8,[`tabs`,`active-id`,`expanded`,`mobile`,`can-open-diff`,`can-open-side-chat`,`onActivate`,`onToggleExpanded`,`onHide`]),F(`div`,Dze,[z(De)===null?(c(),W(`div`,{key:0,class:`panel-launcher`,role:`group`,"aria-label":z(k)(`panel.launcherAria`)},[F(`button`,{type:`button`,disabled:!z(i).status.value.isGitRepo||z(i).activeSessionId.value===null,onClick:tn},[v(X,{name:`git-fork`}),F(`span`,null,U(z(k)(`panel.tabs.diff`)),1)],8,kze),F(`button`,{type:`button`,disabled:!z(i).activeWorkspaceId.value,onClick:t[71]||=e=>rn()},[v(X,{name:`message`}),F(`span`,null,U(z(k)(`sideChat.title`)),1)],8,Aze),v(j7,{trigger:`launcher`,models:z(i).models.value,onTake:dn,onBuild:fn},null,8,[`models`])],8,Oze)):Ce.value===`compaction`&&z(St)?(c(),P(REe,{key:1,text:z(xt)??``,subtitle:z(k)(`conversation.summaryTitle`),onClose:cn},null,8,[`text`,`subtitle`])):Ce.value===`agent`&&z(Tt)?(c(),P(YEe,{key:2,member:z(Tt),turns:z(Et),running:z(Mt),loading:z(Dt),"load-error":z(Ot),"has-more":z(jt),"loading-more":z(kt),"load-more-error":z(At),onClose:cn,onLoadOlderMessages:z(Ft),onOpenFile:t[72]||=e=>Xt(e),onOpenMedia:t[73]||=e=>rt(e),onOpenAgent:t[74]||=e=>$t(e),onOpenTurnDiff:t[75]||=e=>nn(e)},null,8,[`member`,`turns`,`running`,`loading`,`load-error`,`has-more`,`loading-more`,`load-more-error`,`onLoadOlderMessages`])):Ce.value===`btw`&&z(Wt)?(c(),P(CDe,{key:3,ref_key:`sideChatPanelRef`,ref:pn,turns:z(i).sideChatTurns.value,running:z(i).sideChatRunning.value,sending:z(i).sideChatSending.value,onSend:t[76]||=e=>z(i).sendSideChatPrompt(e),onClose:cn},null,8,[`turns`,`running`,`sending`])):Ce.value===`diff`?(c(),P(YDe,{key:4,mode:z(zt),changes:z(i).changes.value,"git-info":z(i).gitInfo.value,"file-diff":z(i).fileDiff.value,"selected-diff-path":z(i).selectedDiffPath.value,"file-diff-loading":z(i).fileDiffLoading.value,closable:``,onOpen:z(Ut),onBack:t[77]||=e=>{zt.value=`list`,Bt.value=null,z(i).clearFileDiff()},onClose:cn},null,8,[`mode`,`changes`,`git-info`,`file-diff`,`selected-diff-path`,`file-diff-loading`,`onOpen`])):Ce.value===`toolDiff`&&z(It)?(c(),P(eDe,{key:5,target:z(It),onClose:cn},null,8,[`target`])):Ce.value===`turnDiff`&&we.value?(c(),P(hDe,{key:6,changes:we.value.changes,cwd:z(i).visibleWorkspace.value?.root??z(i).status.value.cwd,onOpenFile:t[78]||=e=>Xt(e),onClose:cn},null,8,[`changes`,`cwd`])):Ce.value===`editor`?(c(),P(IEe,{key:7,onClose:cn})):Ce.value===`file`?(c(),P(sEe,{key:8,file:z(ze),loading:z(Be),error:z(Ve),line:z(Re)?.line,"download-url":z(We),closable:``,"external-actions":z(Ge),stale:z(He),refreshing:z(Ue),editable:z(i).fsWriteSupported.value&&z(i).activeSessionId.value!==null,"open-file":Xt,onClose:cn,onOpenExternal:z(Ye),onReveal:z(Xe),onRefresh:z(Je),onOpenEditor:t[79]||=e=>Zt(e)},null,8,[`file`,`loading`,`error`,`line`,`download-url`,`external-actions`,`stale`,`refreshing`,`editable`,`onOpenExternal`,`onReveal`,`onRefresh`])):E(``,!0)]),t[125]||=F(`div`,{class:`pfc-host`},null,-1)])],10,Tze)):E(``,!0),$e.value&&et.value?(c(),P(iTe,{key:7,media:$e.value,src:et.value,onClose:it},null,8,[`media`,`src`])):E(``,!0),v(Qwe,{enabled:!bn.value,"panel-source":xn.value,onAdd:Sn},null,8,[`enabled`,`panel-source`]),hn.value?(c(),P(bOe,{key:8,models:z(i).models.value,current:z(i).status.value.modelId,"starred-ids":z(i).starredModelIds.value,loading:En.value,unavailable:Dn.value,onSelect:t[80]||=e=>Nn(e),onToggleStar:t[81]||=e=>z(i).toggleStarModel(e),onClose:t[82]||=e=>hn.value=!1},null,8,[`models`,`current`,`starred-ids`,`loading`,`unavailable`])):E(``,!0),_n.value?(c(),P(eFe,{key:9,status:z(i).status.value,thinking:fe.value,"plan-mode":z(i).planMode.value,"dynamic-workflow-mode":z(i).dynamicWorkflowMode.value,"cost-usd":z(i).sessionCost.value,onClose:t[83]||=e=>_n.value=!1},null,8,[`status`,`thinking`,`plan-mode`,`dynamic-workflow-mode`,`cost-usd`])):E(``,!0),gn.value?(c(),P(BPe,{key:10,"browse-fs":z(i).browseFs,"get-fs-home":z(i).getFsHome,"default-path":z(i).visibleWorkspace.value?.root??z(i).status.value.cwd,error:wn.value,onAdd:t[84]||=e=>$n(e),onClose:er},null,8,[`browse-fs`,`get-fs-home`,`default-path`,`error`])):E(``,!0),v(oe,{name:`gload-fade`},{default:B(()=>[z(i).initialized.value?E(``,!0):(c(),P(CRe,{key:0,stage:z(i).bootStage.value,retries:z(i).bootRetries.value,issue:z(i).connectIssue.value},null,8,[`stage`,`retries`,`issue`]))]),_:1}),G.value?(c(),P(aRe,{key:11,onComplete:he})):ge.value?(c(),P(V9,{key:12,onComplete:_e,onSkip:_e})):E(``,!0),v(aFe,{warnings:z(i).warnings.value,onDismiss:z(i).dismissWarning},null,8,[`warnings`,`onDismiss`]),(c(),P(ee,{defer:``,to:`.con`},[f.value?(c(),P(X7,{key:`${f.value.kind}:${f.value.ids.join(`,`)}`,duration:8e3,onDismiss:t[85]||=e=>f.value=null},{default:B(()=>[F(`span`,null,U(z(k)(f.value.kind===`done`?`admin.actionArchived`:`admin.actionRestored`,{n:f.value.ids.length})),1),F(`button`,{type:`button`,class:`session-action-undo`,onClick:Bn},U(z(k)(`sidebar.archiveToastUndo`)),1)]),_:1})):E(``,!0),m.value?(c(),P(X7,{key:`${m.value.sessionId}:${m.value.state}`,duration:m.value.state===`running`?6e4:4e3,onDismiss:t[86]||=e=>m.value=null},{default:B(()=>[K(U(z(k)(m.value.state===`running`?`admin.exporting`:`admin.exported`)),1)]),_:1},8,[`duration`])):E(``,!0),g.value?(c(),P(X7,{key:g.value,duration:5e3,onDismiss:t[87]||=e=>g.value=null},{default:B(()=>[K(U(g.value),1)]),_:1})):E(``,!0),y.value?(c(),P(X7,{key:y.value,duration:4e3,onDismiss:t[88]||=e=>y.value=null},{default:B(()=>[K(U(y.value),1)]),_:1})):E(``,!0)])),z(N)?(c(),P(ZRe,{key:13})):E(``,!0),z(I)?(c(),P(NFe,{key:14,modelValue:te.value,"onUpdate:modelValue":t[89]||=e=>te.value=e,groups:z(i).workspaceGroups.value,"active-workspace-id":z(i).activeWorkspaceId.value,"active-id":z(i).activeSessionId.value,"attention-by-session":z(i).attentionBySession.value,"attention-by-workspace":z(i).attentionByWorkspace.value,onSelect:t[90]||=e=>z(i).selectSession(e),onCreate:ir,onCreateInWorkspace:t[91]||=e=>sr(e),onAddWorkspace:t[92]||=e=>gn.value=!0,onRename:t[93]||=(e,t)=>z(i).renameSession(e,t),onArchive:t[94]||=e=>Fn(e),onDeleteSession:t[95]||=e=>Hn(e),onDeleteWorkspace:t[96]||=e=>Un(e),onLoadMore:t[97]||=e=>void z(i).loadMoreSessions(e)},null,8,[`modelValue`,`groups`,`active-workspace-id`,`active-id`,`attention-by-session`,`attention-by-workspace`])):E(``,!0),z(I)?(c(),P(HIe,{key:15,modelValue:ne.value,"onUpdate:modelValue":t[98]||=e=>ne.value=e,status:z(i).status.value,thinking:z(i).thinking.value,models:z(i).models.value,"plan-mode":z(i).planMode.value,"goal-mode":z(i).goalMode.value,goal:z(i).goal.value,"dynamic-workflow-mode":z(i).dynamicWorkflowMode.value,"color-scheme":z(i).colorScheme.value,"ui-font-size":z(i).uiFontSize.value,"conversation-toc":z(i).conversationToc.value,"server-version":z(i).serverVersion.value,onPickModel:t[99]||=e=>kn(),onSetThinking:t[100]||=e=>z(i).setThinking(e),onTogglePlan:t[101]||=e=>z(i).togglePlanMode(),onToggleWorkflow:t[102]||=e=>z(i).toggleDynamicWorkflowMode(),onToggleGoal:t[103]||=e=>z(i).toggleGoalMode(),onControlGoal:t[104]||=e=>z(i).controlGoal(e),onSetPermission:t[105]||=e=>z(i).setPermission(e),onSetColorScheme:t[106]||=e=>z(i).setColorScheme(e),onSetUiFontSize:t[107]||=e=>z(i).setUiFontSize(e),onSetConversationToc:t[108]||=e=>z(i).setConversationToc(e),onLogin:t[109]||=()=>{ne.value=!1,Mn()}},null,8,[`modelValue`,`status`,`thinking`,`models`,`plan-mode`,`goal-mode`,`goal`,`dynamic-workflow-mode`,`color-scheme`,`ui-font-size`,`conversation-toc`,`server-version`])):E(``,!0)],6)),vn.value?(c(),P(iPe,{key:4,"color-scheme":z(i).colorScheme.value,accent:z(i).accent.value,"ui-font-size":z(i).uiFontSize.value,"auth-ready":z(i).authReady.value,"account-model":z(i).defaultModel.value,notify:z(i).notifyOnComplete.value,"notify-question":z(i).notifyOnQuestion.value,"notify-approval":z(i).notifyOnApproval.value,"notify-permission":z(i).notifyPermission.value,sound:z(i).soundOnComplete.value,"conversation-toc":z(i).conversationToc.value,"turn-folding":z(i).turnFolding.value,"activity-run-folding":z(i).activityRunFolding.value,config:z(i).config.value,models:z(i).models.value,"config-saving":On.value,"server-version":z(i).serverVersion.value,backend:z(i).backend.value,"experimental-flag-states":z(i).experimentalFlagStates.value,"subagent-model-policy":z(i).subagentModelPolicy.value,"subagent-model-policy-saving":z(i).subagentModelPolicySaving.value,onSaveSubagentModelPolicy:t[110]||=e=>void z(i).saveSubagentModelPolicy(e),onClearSubagentModelPolicy:t[111]||=e=>void z(i).clearSubagentModelPolicy(),"initial-tab":yn.value,onSetColorScheme:t[112]||=e=>z(i).setColorScheme(e),onSetAccent:t[113]||=e=>z(i).setAccent(e),onSetUiFontSize:t[114]||=e=>z(i).setUiFontSize(e),onSetNotify:t[115]||=e=>z(i).setNotifyOnComplete(e),onSetNotifyQuestion:t[116]||=e=>z(i).setNotifyOnQuestion(e),onSetNotifyApproval:t[117]||=e=>z(i).setNotifyOnApproval(e),onSetSound:t[118]||=e=>z(i).setSoundOnComplete(e),onSetConversationToc:t[119]||=e=>z(i).setConversationToc(e),onSetTurnFolding:t[120]||=e=>z(i).setTurnFolding(e),onSetActivityRunFolding:t[121]||=e=>z(i).setActivityRunFolding(e),onUpdateConfig:t[122]||=e=>Wn(e),onOpenOnboarding:t[123]||=()=>{vn.value=!1,ve()},onClose:t[124]||=e=>vn.value=!1},null,8,[`color-scheme`,`accent`,`ui-font-size`,`auth-ready`,`account-model`,`notify`,`notify-question`,`notify-approval`,`notify-permission`,`sound`,`conversation-toc`,`turn-folding`,`activity-run-folding`,`config`,`models`,`config-saving`,`server-version`,`backend`,`experimental-flag-states`,`subagent-model-policy`,`subagent-model-policy-saving`,`initial-tab`])):E(``,!0),v(UPe)]))}}),[[`__scopeId`,`data-v-a16f067c`]]);Ux(),I(jze).use(Jx).mount(`#app`);export{_q as $,jX as A,fJ as B,c2 as C,LX as D,a2 as E,PJ as F,Uq as G,nJ as H,lJ as I,Cq as J,Vq as K,dJ as L,YJ as M,KJ as N,IX as O,qJ as P,gq as Q,sJ as R,o2 as S,d2 as T,Hq as U,oJ as V,aJ as W,Oq as X,Tq as Y,Eq as Z,yY as _,uX as a,X as at,i2 as b,r2 as c,bX as d,cq as et,u2 as f,MX as g,rX as h,Q0 as i,CO as it,JJ as j,k0 as k,Z0 as l,l2 as m,iX as n,Dq as nt,qX as o,Ef as ot,yX as p,tJ as q,K0 as r,LK as rt,NX as s,Y as st,T9 as t,lq as tt,n2 as u,_X as v,b1 as w,gX as x,s2 as y,cJ as z}; \ No newline at end of file +`))}return t.length>0?t:void 0}function H9(e){return e!==void 0&&Number.isFinite(Date.parse(e))?e:void 0}function fze(e){let t;for(let n of e){if(n===void 0)continue;let e=Date.parse(n);Number.isFinite(e)&&(t===void 0||e=0?n:void 0}var W9=R(typeof window>`u`?0:window.innerWidth),G9=0,K9=!1;function q9(){W9.value=window.innerWidth}function pze(){K9||typeof window>`u`||(window.addEventListener(`resize`,q9),K9=!0,q9())}function mze(){!K9||typeof window>`u`||(window.removeEventListener(`resize`,q9),K9=!1)}function J9(e,t,n){return Math.max(t,e-n)}function Y9(e,t,n){return Math.min(n,Math.max(t,e))}function X9(){return p(()=>{G9+=1,pze()}),ne(()=>{G9=Math.max(0,G9-1),G9===0&&mze()}),{viewportWidth:W9}}var hze=`pythinker-web.file-preview-width`;function gze({client:e,sideWidth:t,detailTarget:n,closeFilePreview:r}){let{viewportWidth:i}=X9(),a=L(()=>Math.max(0,i.value-t.value)),o=L(()=>J9(a.value,320,320));function c(e){return Y9(Math.round(e),320,o.value)}function l(){return c(a.value/2)}let u=L(()=>l()),d=R(u.value),f=L(()=>Y9(d.value,320,o.value)),p=R(null),m=L(()=>{let t=p.value;if(!t)return null;let n=e.turns.value.find(e=>e.id===t.turnId);return n?.role===`compaction`&&n.text?n.text:null}),h=L(()=>m.value!==null);function g(e){n.value=`compaction`,p.value=e}function _(){p.value=null,n.value===`compaction`&&(n.value=null)}let v=R(null),y=L(()=>{let t=v.value;if(!t)return{entry:void 0,version:0};let n=e.auxiliaryTranscripts.getEntry(t.sessionId,t.subagentId);return{entry:n,version:n?.version.value??0}});function b(t){let n=e.activeAppTasks.value.find(e=>e.agentId===t||e.id===t||e.backgroundTaskId===t||e.parentToolCallId===t);return n?.agentId??n?.id??t}let x=L(()=>{let t=v.value;if(!t)return null;let n=e.activeAppTasks.value.find(e=>e.agentId===t.subagentId||e.id===t.subagentId||e.backgroundTaskId===t.subagentId);if(n)return pge(n);let r=y.value.entry?.channel;if(!r)return null;let i=r.agents.find(e=>e.agentId===t.subagentId),a=r.snapshot.items.findLast(e=>e.kind===`turn`),o=r.snapshot.meta.activity===`turn`,s=r.loading,c=a?.kind===`turn`&&a.state===`failed`,l=a?.kind===`turn`&&a.state===`cancelled`,u=r.refreshError&&a===void 0;return{id:t.subagentId,name:i?.label??t.subagentId,subagentType:i?.type===`sub`?`subagent`:i?.type,phase:o?`working`:l?`cancelled`:c||u?`failed`:s?`queued`:`completed`,status:o||s?`running`:l?`cancelled`:c||u?`failed`:`completed`}}),S=L(()=>{let t=v.value,n=y.value.entry?.channel;if(!t||!n)return[];let r=n.agents.find(e=>e.agentId===t.subagentId);return sze(n.snapshot,r,{sessionId:t.sessionId,getFileUrl:t=>e.getFileUrl(t)})}),C=L(()=>y.value.entry?.channel.loading??!1),w=L(()=>y.value.entry?.channel.refreshError??!1),T=L(()=>y.value.entry?.channel.loadingOlder??!1),E=L(()=>y.value.entry?.channel.loadOlderError??!1),D=L(()=>y.value.entry?.channel.snapshot.hasMoreOlder??!1),O=L(()=>y.value.entry?.channel.snapshot.meta.activity===`turn`),k=L(()=>x.value!==null);function A(t){let r=e.activeSessionId.value;if(!t||!r)return;let i=b(t),a=v.value;a&&a.subagentId!==i&&e.auxiliaryTranscripts.deactivate(a.sessionId,a.subagentId),v.value={sessionId:r,subagentId:i},n.value=`agent`,e.auxiliaryTranscripts.activate(r,i)}function j(){let t=v.value;t&&e.auxiliaryTranscripts.deactivate(t.sessionId,t.subagentId),v.value=null,n.value===`agent`&&(n.value=null)}s(n,(t,n)=>{if(n!==`agent`||t===`agent`)return;let r=v.value;r&&e.auxiliaryTranscripts.deactivate(r.sessionId,r.subagentId)});function M(){y.value.entry?.channel.loadOlder().catch(()=>void 0)}let N=R(null),ee=L(()=>{let t=N.value;if(!t)return null;let n=hre(e.turns.value,t);return n?{id:t,title:_C(n.name),path:sO(n.arg),lines:n.status===`error`?null:oO(n),output:n.output}:null}),P=L(()=>ee.value!==null);function F(e){n.value=`toolDiff`,N.value=e}function I(){N.value=null,n.value===`toolDiff`&&(n.value=null)}let te=R(`list`),ne=R(null);function re(){n.value=`diff`,te.value=`list`,ne.value=null,e.loadGitStatus(e.activeSessionId.value)}function ie(){n.value===`diff`&&(n.value=null),te.value=`list`,ne.value=null,e.clearFileDiff()}async function ae(t){te.value=`detail`,ne.value=t,await e.loadFileDiff(t)}async function oe(t){!e.activeSessionId.value&&e.activeWorkspaceId.value?await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,t):await e.openSideChat(t),n.value=`btw`}function se(){e.closeSideChat(),n.value===`btw`&&(n.value=null)}function z(){n.value===`btw`&&(n.value=null)}let ce=L(()=>e.sideChatVisible.value),B=L(()=>n.value!==null&&(n.value!==`compaction`||h.value)&&(n.value!==`agent`||k.value)&&(n.value!==`toolDiff`||P.value)&&(n.value!==`btw`||ce.value)),le=R(!1);function ue(){return n.value===`compaction`&&h.value?(_(),!0):n.value===`agent`&&k.value?(j(),!0):n.value===`toolDiff`&&P.value?(I(),!0):n.value===`file`?(r(),!0):n.value===`diff`?(ie(),!0):n.value===`btw`?(se(),!0):!1}return s(e.activeSessionId,()=>{r(),_(),j(),I(),ie(),z()}),{PREVIEW_WIDTH_KEY:hze,PREVIEW_MIN:320,previewDefaultWidth:u,previewMax:o,previewWidth:d,previewPanelWidth:f,compactionPanelText:m,compactionPanelVisible:h,openCompactionPanel:g,closeCompactionPanel:_,agentPanelMember:x,agentPanelTurns:S,agentPanelLoading:C,agentPanelLoadError:w,agentPanelLoadingMore:T,agentPanelLoadMoreError:E,agentPanelHasMore:D,agentPanelRunning:O,agentPanelVisible:k,openAgentPanel:A,closeAgentPanel:j,loadOlderAgentMessages:M,toolDiffTarget:ee,toolDiffVisible:P,openToolDiff:F,closeToolDiff:I,detailDiffMode:te,detailDiffPath:ne,openDiffDetail:re,closeDiffDetail:ie,selectDiffFile:ae,btwVisible:ce,openSideChatTab:oe,closeSideChat:se,hideSideChatPanel:z,sidePanelVisible:B,panelDragging:le,closeOpenSidePanel:ue}}var _ze=qi.sidebarWidth,Z9=qi.sidebarCollapsed,Q9=270,$9=170,vze=480,yze=320;function bze(e={}){let{viewportWidth:t}=X9(),n=R(Q9),r=R(!1),i=R(!1),a=L(()=>{let n=yze+(te(e.previewOpen)?320:0);return Math.min(vze,J9(t.value,$9,n))}),o=L(()=>Y9(n.value,$9,a.value));function s(){try{r.value=Yi(Z9)===`true`}catch{r.value=!1}}function c(){try{Xi(Z9,String(r.value))}catch{}}function l(){r.value=!r.value,c()}return{SIDEBAR_WIDTH_KEY:_ze,SIDEBAR_DEFAULT:Q9,SIDEBAR_MIN:$9,sidebarMax:a,sessionColWidth:n,sidebarCollapsed:r,sidebarDragging:i,sideWidth:o,loadSidebarCollapsed:s,toggleSidebarCollapse:l}}async function xze(e){if(!e.fileId)return{url:e.url};try{let t=await Q().getFileBlob(e.fileId),n=URL.createObjectURL(t);return{url:n,revoke:()=>URL.revokeObjectURL(n)}}catch{return{url:e.url}}}function Sze({client:e,detailTarget:t}){let{t:n}=J(),r=R(null),i=R(null),a=R(!1),o=R(null),c=R(!1),l=R(!1),u=R(null),d=null,f=0;function p(t){return t?e.changes.value.find(e=>e.path===t)?.status??null:null}function m(){let e=u.value;!e||a.value||l.value||(c.value=p(e)!==d)}let h=L(()=>{let t=u.value;return t?e.getFileDownloadUrl(t):null}),g=L(()=>r.value!==null);function _(e){return e.length>1?e.replace(/\/+$/,``):e}function v(e){let t=[];for(let n of e.split(/[\\/]+/))if(!(!n||n===`.`)){if(n===`..`){t.pop();continue}t.push(n)}return t.join(`/`)}function y(t){let r=t.trim();if(!r)return{error:n(`filePreview.errors.emptyPath`)};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(r))return{error:n(`filePreview.errors.unsupportedPath`)};if(r.startsWith(`~`))return{error:n(`filePreview.errors.outsideWorkspace`)};let i=_(e.status.value.cwd);if(r.startsWith(`/`)){if(!i||r!==i&&!r.startsWith(`${i}/`))return{error:n(`filePreview.errors.outsideWorkspace`)};let e=r===i?``:r.slice(i.length+1);if(e.split(/[\\/]+/).includes(`..`))return{error:n(`filePreview.errors.outsideWorkspace`)};let t=v(e);return t?{path:t}:{error:n(`filePreview.errors.isDirectory`)}}if(r.split(/[\\/]+/).includes(`..`))return{error:n(`filePreview.errors.outsideWorkspace`)};let a=v(r);return a?{path:a}:{error:n(`filePreview.errors.emptyPath`)}}async function b(s,m){let h=++f,g=m?.preserveCurrent===!0&&i.value!==null;t.value=`file`,o.value=null,r.value=s,g?l.value=!0:(i.value=null,a.value=!0,c.value=!1,u.value=null,d=null);let _=y(s.path);if(`error`in _){a.value=!1,l.value=!1,o.value=_.error;return}u.value=_.path;try{let t=await e.readFileContent(_.path);if(h!==f)return;t?(i.value={...t,path:t.path||_.path},d=p(_.path),c.value=!1):g||(o.value=n(`filePreview.errors.loadFailed`))}catch(e){if(h!==f)return;g||(o.value=e instanceof Error?e.message:n(`filePreview.errors.loadFailed`))}finally{h===f&&(a.value=!1,l.value=!1)}}function x(){let e=r.value;!e||l.value||b(e,{preserveCurrent:!0})}function S(){f+=1,r.value=null,u.value=null,i.value=null,o.value=null,a.value=!1,l.value=!1,c.value=!1,d=null}function C(){S(),t.value===`file`&&(t.value=null)}s(t,(e,t)=>{t===`file`&&e!==`file`&&S()}),s(()=>e.changes.value,()=>{m()},{deep:!0});function w(){let t=i.value?.path??r.value?.path;t&&e.openWorkspaceFile(t,r.value?.line)}function T(){let t=i.value?.path??r.value?.path;t&&e.revealWorkspaceFile(t)}return{previewTarget:r,previewFile:i,previewLoading:a,previewError:o,previewStale:c,previewRefreshing:l,previewDownloadUrl:h,previewExternalActions:g,openFilePreview:b,closeFilePreview:C,refreshFilePreview:x,openPreviewInEditor:w,revealPreviewFile:T}}var Cze=new Set([`agent`,`compaction`,`btw`]);function wze(e){let t=R([]),n=R(null),r=R(!1),i=R(!1),a=new Map,o=0,c=L(()=>t.value.find(e=>e.id===n.value)??null);function l(e){let i=e.always?void 0:t.value.find(t=>t.type===e.type&&t.key===e.key);if(i)return i.title=e.title,i.payload=e.payload,n.value=i.id,r.value=!0,i;let a={...e,id:`panel-tab-${++o}`};return t.value=[...t.value,a],n.value=a.id,r.value=!0,a}function u(e){t.value.some(t=>t.id===e)&&(n.value=e,r.value=!0)}function d(e){let a=t.value.findIndex(t=>t.id===e);if(a<0)return null;let[o]=t.value.splice(a,1);return t.value=[...t.value],n.value===e&&(n.value=t.value[Math.min(a,t.value.length-1)]?.id??null),t.value.length===0&&(r.value=!1,i.value=!1),o??null}function f(){return r.value?(r.value=!1,i.value=!1,!0):!1}function p(){r.value=!r.value,r.value||(i.value=!1)}function m(){c.value!==null&&(i.value=!i.value,i.value&&(r.value=!0))}function h(e){let i=t.value.filter(e=>Cze.has(e.type)),o=Math.max(0,i.findIndex(e=>e.id===n.value));if(i.length===0){a.delete(e);return}a.set(e,{tabs:i.map(({id:e,...t})=>({...t})),activeIndex:o,visible:r.value})}function g(e){let s=a.get(e);t.value=s?.tabs.map(e=>({...e,id:`panel-tab-${++o}`}))??[],n.value=t.value[s?.activeIndex??0]?.id??null,r.value=s?.visible===!0&&t.value.length>0,i.value=!1}return s(e,(e,t)=>{h(t),g(e)}),{tabs:t,activeTabId:n,activeTab:c,visible:r,expanded:i,openTab:l,activateTab:u,closeTab:d,hidePanel:f,togglePanel:p,toggleExpanded:m}}var Tze={class:`server-auth-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`server-auth-title`},Eze={class:`server-auth-card`},Dze={class:`server-auth-body`},Oze={class:`server-auth-foot`},kze=Y(G({__name:`ServerAuthDialog`,setup(e){let t=R(``),r=R(null),i=R(!1);p(()=>{n(()=>r.value?.focus())});function a(){let e=t.value;!e||i.value||(i.value=!0,MT(e),window.location.reload())}function o(e){e.key===`Enter`&&(e.preventDefault(),a())}return(e,n)=>(c(),W(`div`,Tze,[F(`div`,Eze,[n[1]||=F(`div`,{class:`server-auth-head`},[F(`h1`,{id:`server-auth-title`,class:`server-auth-title`},`Server token required`),F(`p`,{class:`server-auth-hint`},[K(` This server is protected. Enter the bearer token printed when the server started (or the password set via `),F(`code`,null,`PYTHINKER_CODE_PASSWORD`),K(`). `)])],-1),F(`div`,Dze,[v(Fp,{ref_key:`inputRef`,ref:r,modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`password`,autocomplete:`current-password`,placeholder:`Token`,disabled:i.value,onKeydown:o},null,8,[`modelValue`,`disabled`])]),F(`div`,Oze,[v(pD,{variant:`primary`,disabled:!t.value||i.value,loading:i.value,onClick:a},{default:B(()=>[K(U(i.value?`Connecting…`:`Connect`),1)]),_:1},8,[`disabled`,`loading`])])])]))}}),[[`__scopeId`,`data-v-82dad292`]]),Aze={class:`app-shell`},jze={key:2,class:`offline-strip`,role:`status`},Mze=[`aria-label`,`aria-hidden`],Nze={class:`pt-shell`},Pze={class:`pt-body`},Fze=[`aria-label`],Ize=[`disabled`],Lze=[`disabled`],Rze=Y(G({__name:`App`,setup(e){kT();let t=R(!1),r=null,i=E7();d(D7,i.expertTalk);let a=sD(),o=R([]),u=R(!1),f=R(null),m=R(null),g=R(null),_=null,y=R(null),b=L(()=>{let e=i.activeWorkspaceId.value;return e?[...i.sessionsForView.value,...o.value].filter(t=>t.workspaceId===e).toSorted((e,t)=>new Date(t.updatedAt??0).getTime()-new Date(e.updatedAt??0).getTime()).slice(0,6):[]});function x(e){return{id:e.id,title:e.title,time:new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}).format(-Math.max(0,Math.floor((Date.now()-new Date(e.updatedAt).getTime())/864e5)),`day`),busy:!1,updatedAt:e.updatedAt,workspaceId:e.workspaceId,archived:!0}}async function S(){try{let e=[],t;for(;;){let n=await i.loadArchivedSessions({beforeId:t,pageSize:100});if(e.push(...n.items),!n.hasMore||n.items.length===0||(t=n.items.at(-1)?.id,t===void 0))break}o.value=e.map(x)}catch(e){console.warn(`loadDoneSessions failed`,e)}}let C=L(()=>{let e=new Map(i.workspaceGroups.value.flatMap(e=>e.sessions.map(e=>[e.id,e.updatedAt])));return i.sessionsForView.value.map(t=>({id:t.id,title:t.title,workspaceId:t.workspaceId??``,workspaceName:t.workspaceName??`-`,lastPrompt:t.lastPrompt,updatedAt:t.updatedAt??e.get(t.id)??new Date(0).toISOString(),archived:!1}))});async function w(){let e=[],t;for(;;){let n=await i.loadArchivedSessions({beforeId:t,pageSize:100});if(e.push(...n.items),!n.hasMore||n.items.length===0||(t=n.items.at(-1)?.id,t===void 0))break}let n=i.workspacesView.value;return e.filter(e=>!e.parentSessionId).map(e=>{let t=n.find(t=>t.id===e.workspaceId||t.root===e.cwd);return{id:e.id,title:e.title,workspaceId:t?.id??e.workspaceId??e.cwd,workspaceName:t?.name??e.cwd.split(`/`).filter(Boolean).at(-1)??`-`,lastPrompt:e.lastPrompt,updatedAt:e.updatedAt,archived:!0}})}function T(){u.value=!0,i.loadAllSessions()}function D(e,t){f.value={kind:e,ids:Array.isArray(t)?t:[t]}}let O=L(()=>!i.dangerousBypassAuth.value&&t.value);d(`resolveImage`,i.resolveImageUrl),d(`modelDisplay`,e=>{if(e===void 0||e.length===0)return;let t=i.models.value.find(t=>t.id===e)??i.models.value.find(t=>t.model===e);return t?.displayName||t?.model||(e.includes(`/`)?e.split(`/`).pop():e)}),d(`subagentEffort`,e=>e!==void 0&&e.length>0&&e!==`off`&&e!==`on`?$3(e):void 0),d(`resolveDynamicWorkflowMembers`,e=>i.dynamicWorkflowMembersByToolCallId.value.get(e)??[]),d(`mainModelBinding`,()=>{let e=i.status.value.modelId;if(e)return{model:e,effort:i.thinking.value}}),d(`openAgentSettings`,()=>{An(`agent`)});let{t:k}=J(),{confirm:j}=G4(),N=AS(),I=i6(),te=R(!1),ne=R(!1),re=L(()=>{let e=i.activeSessionId.value;return i.sessions.value.find(t=>t.id===e)?.title??o.value.find(t=>t.id===e)?.title??``}),ie=L(()=>{let e=i.activeSessionId.value;return i.sessions.value.find(t=>t.id===e)?.lastTurnReason}),se=L(()=>{let e=i.activeSessionId.value;if(e)return Iw(e)}),ce=L(()=>o.value.some(e=>e.id===i.activeSessionId.value)),le=L(()=>i.visibleWorkspace.value?.sessionCount??0),ue=L(()=>i.activity.value!==`idle`),{showAuthGate:de}=aze({client:i});oze({running:ue,showAuthGate:de});let fe=L(()=>n6(i.models.value.find(e=>e.id===i.status.value.modelId),i.thinking.value)),H=R(!1),G=L(()=>i.appState.value===`first-run`),pe=L(()=>i.appState.value===`recovery`&&!H.value),me=L(()=>i.appState.value===`recovery`&&H.value);s(()=>i.appState.value,e=>{e!==`recovery`&&(H.value=!1)}),s(i.lastDeletedSessionId,e=>{e!==null&&(o.value=o.value.filter(t=>t.id!==e))});function he(){H.value=!1}let ge=R(!1);function _e(){i.setOnboarded(!0),ge.value=!1}function ve(){ge.value=!0}let ye=0;function be(){let e=window.visualViewport,t=document.documentElement.style;t.setProperty(`--app-height`,`${e?.height??window.innerHeight}px`),t.setProperty(`--app-top`,`${e?.offsetTop??0}px`)}function xe(){ye||=requestAnimationFrame(()=>{ye=0,be()})}p(()=>{a.subscribe(),r=PT(()=>{t.value=!0,i.clearDangerousBypassAuth()}),i.load(),pt(),be(),window.visualViewport?.addEventListener(`resize`,xe),window.visualViewport?.addEventListener(`scroll`,xe),window.addEventListener(`resize`,xe),document.addEventListener(`keydown`,Se,!0)}),h(()=>{a.unsubscribe(),it(),document.removeEventListener(`keydown`,Se,!0),window.visualViewport?.removeEventListener(`resize`,xe),window.visualViewport?.removeEventListener(`scroll`,xe),window.removeEventListener(`resize`,xe),ye&&=(cancelAnimationFrame(ye),0),document.documentElement.style.removeProperty(`--app-height`),document.documentElement.style.removeProperty(`--app-top`),r!==null&&(r(),r=null)});function Se(e){e.key!==`Escape`||e.isComposing||Tn.value}let Ce=R(null),we=R(null),{tabs:Te,activeTabId:Ee,activeTab:De,visible:Oe,expanded:ke,openTab:Ae,activateTab:je,closeTab:Me,hidePanel:q,togglePanel:Ne,toggleExpanded:Pe}=wze(L(()=>i.activeSessionId.value??`__draft__:${i.activeWorkspaceId.value??`none`}`));function Fe(e){we.value=e,Ce.value=`turnDiff`}function Ie(){we.value=null,Ce.value===`turnDiff`&&(Ce.value=null)}let Le=R(!1);s(i.activeSessionId,()=>{Ie(),Le.value=!0,n(()=>{Le.value=!1})});let{previewTarget:Re,previewFile:ze,previewLoading:Be,previewError:Ve,previewStale:He,previewRefreshing:Ue,previewDownloadUrl:We,previewExternalActions:Ge,openFilePreview:Ke,closeFilePreview:qe,refreshFilePreview:Je,openPreviewInEditor:Ye,revealPreviewFile:Xe}=Sze({client:i,detailTarget:Ce});DEe(()=>i.activeSessionId.value);function Ze(e){Ce.value=`editor`,c9({path:e,line:Re.value?.line})}function Qe(){Ce.value===`editor`&&(Ce.value=null),f9()}s(Ce,(e,t)=>{t===`editor`&&e!==`editor`&&f9()});let $e=R(null),et=R(null),tt=0,nt;async function rt(e){if(e.kind!==`image`&&e.kind!==`video`)return;let t=++tt;nt?.(),nt=void 0,$e.value=null,et.value=null;let n=await xze(e);if(t!==tt){n.revoke?.();return}nt=n.revoke,$e.value=e,et.value=n.url}function it(){tt+=1,nt?.(),nt=void 0,$e.value=null,et.value=null}let{SIDEBAR_WIDTH_KEY:at,SIDEBAR_DEFAULT:ot,SIDEBAR_MIN:st,sidebarMax:ct,sessionColWidth:lt,sidebarCollapsed:ut,sidebarDragging:dt,sideWidth:ft,loadSidebarCollapsed:pt,toggleSidebarCollapse:mt}=bze({previewOpen:L(()=>Oe.value)}),{PREVIEW_WIDTH_KEY:ht,PREVIEW_MIN:gt,previewDefaultWidth:_t,previewMax:vt,previewWidth:yt,previewPanelWidth:bt,compactionPanelText:xt,compactionPanelVisible:St,openCompactionPanel:Ct,closeCompactionPanel:wt,agentPanelMember:Tt,agentPanelTurns:Et,agentPanelLoading:Dt,agentPanelLoadError:Ot,agentPanelLoadingMore:kt,agentPanelLoadMoreError:At,agentPanelHasMore:jt,agentPanelRunning:Mt,openAgentPanel:Nt,closeAgentPanel:Pt,loadOlderAgentMessages:Ft,toolDiffTarget:It,openToolDiff:Lt,closeToolDiff:Rt,detailDiffMode:zt,detailDiffPath:Bt,openDiffDetail:Vt,closeDiffDetail:Ht,selectDiffFile:Ut,btwVisible:Wt,openSideChatTab:Gt,closeSideChat:Kt,hideSideChatPanel:qt,panelDragging:Jt}=gze({client:i,sideWidth:ft,detailTarget:Ce,closeFilePreview:qe});function Yt(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function Xt(e){Ae({type:`file`,key:e.path,title:Yt(e.path),icon:`file-text`,payload:e})}function Zt(e){Ae({type:`editor`,key:e,title:Yt(e),icon:`file-edit`,payload:{path:e}})}function Qt(e){Ae({type:`compaction`,key:e.turnId,title:k(`panel.tabs.compaction`),icon:`thinking`,payload:e})}function $t(e){let t=i.activeAppTasks.value.find(t=>t.agentId===e||t.id===e||t.backgroundTaskId===e||t.parentToolCallId===e);Ae({type:`agent`,key:t?.agentId??t?.id??e,title:t?.description||k(`panel.tabs.agent`),icon:`robot`,payload:{target:e}})}s(i.activeAppTasks,e=>{for(let t of Te.value){if(t.type!==`agent`)continue;let n=t.payload?.target??t.key,r=e.find(e=>e.agentId===n||e.id===n||e.backgroundTaskId===n||e.parentToolCallId===n);r?.description&&(t.title=r.description)}});function en(e){Lt(e);let t=It.value;Ae({type:`toolDiff`,key:e,title:t?.path?Yt(t.path):t?.title??k(`panel.tabs.diff`),icon:`file-edit`,payload:{id:e}})}function tn(){Ae({type:`diff`,key:`workspace`,title:k(`panel.tabs.diff`),icon:`git-fork`})}function nn(e){let t=Te.value.find(t=>t.type===`turnDiff`&&t.key===e.turnId);if(t?.id===Ee.value){sn(t.id);return}Ae({type:`turnDiff`,key:e.turnId,title:k(`panel.tabs.turnDiff`),icon:`git-fork`,payload:e})}async function rn(e){await Gt(e),Ae({type:`btw`,key:`side-chat`,title:k(`sideChat.title`),icon:`message`,payload:{prompt:e}})}function an(e){e.type===`file`?qe():e.type===`editor`?Qe():e.type===`compaction`?wt():e.type===`agent`?Pt():e.type===`toolDiff`?Rt():e.type===`diff`?Ht():e.type===`turnDiff`?Ie():e.type===`btw`&&qt()}function on(e){if(e===null){Ce.value=null;return}e.type===`file`?Ke(e.payload):e.type===`editor`?Ze(e.payload.path):e.type===`compaction`?Ct(e.payload):e.type===`agent`?Nt(e.payload.target):e.type===`toolDiff`?Lt(e.payload.id):e.type===`diff`?Vt():e.type===`turnDiff`?Fe(e.payload):e.type===`btw`&&(Ce.value=`btw`)}s(De,(e,t)=>{t&&t.id!==e?.id&&an(t),on(e)},{flush:`post`});function sn(e){Te.value.find(t=>t.id===e)?.type===`btw`&&Kt(),Me(e)}function cn(){Ee.value&&sn(Ee.value)}let ln=R(null);async function un(){return i.expertTalk.status.value?.activation.state===`armed`?(await i.expertTalk.disarm(),i.expertTalk.status.value?.activation.state!==`armed`&&i.expertTalk.error.value===void 0):!0}async function dn(e){await un()&&ln.value?.loadComposerForEdit(e)}async function fn(e){await un()&&await Qn(k(`expertTalk.buildPrompt`,{answer:e}))}let pn=R(null);function mn(){let e=!1,t=t=>{t instanceof KeyboardEvent&&t.repeat||(e=!0)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0),window.addEventListener(`blur`,t),document.addEventListener(`visibilitychange`,t),()=>{n(()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0),window.removeEventListener(`blur`,t),document.removeEventListener(`visibilitychange`,t),!e&&document.hasFocus()&&pn.value?.focusInput()})}}let hn=R(!1),gn=R(!1),_n=R(!1),vn=R(!1),yn=R(`general`),bn=L(()=>ba.value>0||hn.value||gn.value||_n.value||vn.value||te.value||ne.value||$e.value!==null),xn=L(()=>De.value?.title);function Sn(e){ln.value?.insertComposerQuote(e),I.value&&Oe.value&&q()}let Cn=R(null),wn=R(null),Tn=L(()=>ba.value>0||hn.value||gn.value||_n.value||vn.value||ge.value||te.value||ne.value||$e.value!==null),En=R(!1),Dn=R(!1),On=R(!1);async function kn(){En.value=!0,Dn.value=!1,hn.value=!0;try{await i.refreshAllProviders()}catch{Dn.value=!0}finally{En.value=!1}}function An(e=`general`){yn.value=e,vn.value=!0}function jn(){An(`providers`)}function Mn(){jn()}async function Nn(e){hn.value=!1,await Pn(e)}async function Pn(e){await i.setModel(e)&&e!==i.defaultModel.value&&i.updateConfig({defaultModel:e})}async function Fn(e){await i.archiveSession(e),await S(),D(`done`,e)}async function In(e){await i.restoreSession(e)&&(o.value=o.value.filter(t=>t.id!==e),D(`open`,e))}async function Ln(e,t){await i.renameSession(e,t),o.value.some(t=>t.id===e)&&await S()}async function Rn(e,t){let n=o.value.find(t=>t.id===e);if(!n){await i.setSessionEmoji(e,t);return}await Ln(e,Np(t,n.title))}async function zn(e,t){let n=e.map(e=>e.id);for(let e of n)t===`archive`?await i.archiveSession(e):await i.restoreSession(e);await S(),D(t===`archive`?`done`:`open`,n)}async function Bn(){let e=f.value;if(e){f.value=null;for(let t of e.ids)e.kind===`done`?await i.restoreSession(t):await i.archiveSession(t);await S()}}async function Vn(e){let t=e??i.activeSessionId.value;t&&(m.value={state:`running`,sessionId:t},m.value=await i.exportSession(t)?{state:`done`,sessionId:t}:null)}async function Hn(e){let t=(i.sessions.value.find(t=>t.id===e)??o.value.find(t=>t.id===e))?.title??e;await j({title:k(`sidebar.deleteSession`),message:k(`sidebar.deleteSessionConfirm`,{title:t}),variant:`danger`,action:async()=>{await i.deleteSession(e),o.value=o.value.filter(t=>t.id!==e),y.value=k(`sidebar.deleteSessionToast`)}})}async function Un(e){let t=i.workspacesView.value.find(t=>t.id===e)?.name??e;await j({title:k(`sidebar.removeWorkspace`),message:k(`workspace.removeWorkspaceConfirm`,{name:t}),variant:`danger`,action:()=>i.deleteWorkspace(e)})}async function Wn(e){On.value=!0;try{await i.updateConfig(e)&&await Promise.all([i.refreshRuntimeState(),i.refreshServerMeta()])}finally{On.value=!1}}async function Gn(e){await i.undo(1),await n(),ln.value?.loadComposerForEdit(e.text,e.attachments)}function Kn(e){if(e===`/compact`||e.startsWith(`/compact `)){i.compact(e.slice(8).trim()||void 0);return}if(e===`/dynamic_workflow`||e.startsWith(`/dynamic_workflow `)){let t=e.slice(17).trim();t===`on`?i.setDynamicWorkflowMode(!0):t===`off`?i.setDynamicWorkflowMode(!1):t?(i.setDynamicWorkflowMode(!0),i.sendPrompt(t)):i.toggleDynamicWorkflowMode();return}if(e===`/goal`||e.startsWith(`/goal `)){let t=e.slice(5).trim();t===`pause`||t===`resume`||t===`cancel`?i.controlGoal(t):t?i.createGoal(t):i.toggleGoalMode();return}if(e===`/tower`||e.startsWith(`/tower `)){if(!i.towerAvailable.value)return;let t=e.slice(6).trim();t===`off`?i.setTowerMode(!1):t===`on`||t===``?t===`on`||!i.towerMode.value?i.setTowerMode(!0):i.setTowerMode(!1):i.setTowerMode(!0,t);return}if(e===`/btw`||e.startsWith(`/btw `)){let t=e.slice(4).trim();if(!t&&De.value?.type===`btw`)cn();else{let e=mn();rn(t||void 0).then(e,e)}return}switch(e){case`/new`:case`/clear`:ir();break;case`/fork`:i.forkSession();break;case`/export`:Vn();break;case`/undo`:i.undo();break;case`/plan`:i.togglePlanMode();break;case`/status`:_n.value=!0;break;case`/login`:Mn();break;default:{let t=e.indexOf(` `),n=Upe((t===-1?e:e.slice(0,t)).slice(1)),r=t===-1?void 0:e.slice(t+1).trim()||void 0;if(!n)break;!i.activeSessionId.value&&i.activeWorkspaceId.value?i.startSessionAndActivateSkill(i.activeWorkspaceId.value,n,r):i.activateSkill(n,r);break}}}function qn(e){i.unqueue(e)}function Jn(e){i.unqueue(e)}function Yn(e){i.reorderQueue(e.from,e.to)}function Xn(e){i.steerQueued(e)}async function Zn(e){let t=i.activeWorkspaceId.value;if(!i.activeSessionId.value&&t){await i.startSessionAndSendPrompt(t,e.text,e.attachments);return}if(!i.activeSessionId.value&&!t){Cn.value=e,gn.value=!0;return}i.sendPrompt(e.text,e.attachments)}async function Qn(e){let t=i.activeWorkspaceId.value;if(!i.activeSessionId.value&&t){await i.startSessionAndSendPrompt(t,e,[]);return}i.activeSessionId.value&&i.sendPrompt(e)}async function $n(e){if(wn.value=null,!await i.addWorkspaceByPath(e)){wn.value=k(`workspace.addFailed`);return}gn.value=!1;let t=Cn.value;Cn.value=null;let n=i.activeWorkspaceId.value;t&&n&&await i.startSessionAndSendPrompt(n,t.text,t.attachments)}function er(){Cn.value=null,wn.value=null,gn.value=!1}async function tr(e){for(let t of e)if(wn.value=null,!await i.addWorkspaceByPath(t)){wn.value=k(`workspace.addFailed`),gn.value=!0;return}}async function nr(e,t){let n=await i.generateSessionTitle(e);n===null&&(g.value=k(`sidebar.genTitleUnavailable`),_!==null&&clearTimeout(_),_=setTimeout(()=>{g.value=null,_=null},5e3)),t(n)}function rr(){n(()=>{ln.value?.focusComposer()})}function ir(){let e=i.activeWorkspaceId.value;e?i.openWorkspaceDraft(e):i.clearActiveSession(),rr()}let ar=L(()=>i.backend.value===`v2`&&i.experimentalFlagState(`expert_talk`)?.enabled===!0);async function or(){let e=i.activeWorkspaceId.value;if(e===null)return;let t=i.models.value.filter(e=>e.maxContextSize>0&&(e.capabilities??[]).some(e=>e.trim().toLowerCase().replaceAll(`-`,`_`)===`tool_use`)),n=i.expertTalk.preferredPair.value??i.expertTalk.status.value?.config,r=new Set(t.map(e=>e.id)),a=n!=null&&n.fusionLeadModelId!==n.peerModelId&&r.has(n.fusionLeadModelId)&&r.has(n.peerModelId)?n:void 0;if(a===void 0){An(`expertOpinion`);return}if(!await i.startExpertOpinionSession(e,a)){An(`expertOpinion`);return}rr()}function sr(e){i.openWorkspaceDraft(e),rr()}function cr(e){e&&window.open(e,`_blank`,`noopener`)}return(e,t)=>(c(),W(`div`,Aze,[v(_Fe),O.value?(c(),P(kze,{key:0})):E(``,!0),pe.value?(c(),P(CRe,{key:1,onOpenProviders:t[0]||=()=>{H.value=!0,jn()},onDismiss:t[1]||=e=>H.value=!0})):E(``,!0),me.value?(c(),W(`div`,jze,[F(`span`,null,U(z(k)(`recovery.offlineNotice`)),1),F(`button`,{type:`button`,"data-testid":`offline-strip-reconnect`,onClick:t[2]||=e=>H.value=!1},U(z(k)(`recovery.addProvider`)),1)])):E(``,!0),pe.value?E(``,!0):(c(),W(`div`,{key:3,class:V([`app`,{mobile:z(I),"sidebar-collapsed":z(ut)&&!z(I),"macos-desktop":z(KE),"panel-expanded":z(ke)}]),style:ae({"--preview-w":z(bt)+`px`})},[z(I)?(c(),P(TFe,{key:1,workspace:z(i).visibleWorkspace.value,"session-title":re.value,running:ue.value,branch:z(i).status.value.branch,"session-count":le.value,onOpenSwitcher:t[25]||=e=>te.value=!0,onOpenSettings:t[26]||=e=>ne.value=!0},null,8,[`workspace`,`session-title`,`running`,`branch`,`session-count`])):(c(),W(M,{key:0},[v(Fte,{collapsed:z(ut),dragging:z(dt),"col-width":z(ft),"active-workspace":z(i).visibleWorkspace.value,"active-workspace-id":z(i).activeWorkspaceId.value,sessions:z(i).sessionsForView.value,"archived-sessions":o.value,"pinned-ids":z(i).pinnedSessionIds.value,"pinned-collapsed":z(i).pinnedCollapsed.value,groups:z(i).workspaceGroups.value,"active-id":z(i).activeSessionId.value,"attention-by-session":z(i).attentionBySession.value,"pending-by-session":z(i).pendingBySession.value,"unread-by-session":z(i).unreadBySession.value,"workspace-sort-mode":z(i).workspaceSortMode.value,workspaces:z(i).workspacesView.value,"tabs-enabled":z(i).config.value?.experimental?.sidebarTabs===!0,"expert-opinion-available":ar.value,onSelect:t[3]||=e=>z(i).selectSession(e),onCreate:ir,onCreateExpertOpinion:or,onCreateInWorkspace:t[4]||=e=>sr(e),onSelectWorkspace:t[5]||=e=>z(i).openWorkspace(e),onAddWorkspace:t[6]||=e=>gn.value=!0,onAddWorkspacePaths:tr,onRename:Ln,onGenerateTitle:nr,onArchive:t[7]||=e=>Fn(e),onDeleteSession:t[8]||=e=>Hn(e),onRestore:t[9]||=e=>In(e),onPin:t[10]||=e=>z(i).togglePinnedSession(e),onReorderPins:t[11]||=e=>z(i).reorderPinnedSessions(e),onTogglePinnedCollapsed:t[12]||=e=>z(i).togglePinnedCollapsed(),onSetSessionEmoji:Rn,onLoadDoneSessions:S,onFork:t[13]||=e=>z(i).forkSession(e),onExport:t[14]||=e=>Vn(e),onRenameWorkspace:t[15]||=(e,t)=>z(i).renameWorkspace(e,t),onDeleteWorkspace:t[16]||=e=>Un(e),onReorderWorkspaces:t[17]||=e=>z(i).reorderWorkspaces(e),onSetWorkspaceSortMode:t[18]||=e=>z(i).setWorkspaceSortMode(e),onLoadMoreSessions:t[19]||=e=>void z(i).loadMoreSessions(e),onLoadAllSessions:t[20]||=e=>void z(i).loadAllSessions(),onOpenSettings:t[21]||=e=>An(),onOpenSessionAdmin:T,onOpenFile:t[22]||=e=>Xt(e),onCollapse:z(mt)},null,8,[`collapsed`,`dragging`,`col-width`,`active-workspace`,`active-workspace-id`,`sessions`,`archived-sessions`,`pinned-ids`,`pinned-collapsed`,`groups`,`active-id`,`attention-by-session`,`pending-by-session`,`unread-by-session`,`workspace-sort-mode`,`workspaces`,`tabs-enabled`,`expert-opinion-available`,`onCollapse`]),l(v(XD,{class:`side-handle`,"storage-key":z(at),"default-width":z(ot),min:z(st),max:z(ct),"onUpdate:width":t[23]||=e=>lt.value=e,"onUpdate:dragging":t[24]||=e=>dt.value=e},null,8,[`storage-key`,`default-width`,`min`,`max`]),[[A,!z(ut)]])],64)),u.value?(c(),P(wne,{key:2,"open-sessions":C.value,workspaces:z(i).workspacesView.value,"load-archived":w,"archive-session":Fn,"restore-session":In,"run-batch":zn,onOpen:t[27]||=e=>{u.value=!1,z(i).selectSession(e)},onRename:t[28]||=(e,t)=>z(i).renameSession(e,t),onFork:t[29]||=e=>z(i).forkSession(e),onExport:t[30]||=e=>Vn(e),onBack:t[31]||=e=>u.value=!1},null,8,[`open-sessions`,`workspaces`])):(c(),P(tTe,{key:3,ref_key:`conversationPaneRef`,ref:ln,mobile:z(I),turns:z(i).turns.value,"expert-talk-runs":z(i).expertTalk.runs.value,"session-id":z(i).activeSessionId.value,approvals:z(i).pendingApprovals.value,changes:z(i).changes.value,"git-info":z(i).gitInfo.value,tasks:z(i).tasks.value,todos:z(i).todos.value,goal:z(i).goal.value,"activation-badges":z(i).activationBadges.value,status:z(i).status.value,thinking:z(i).thinking.value,"plan-mode":z(i).planMode.value,"plan-armed":z(i).planArmed.value,"session-plans":z(i).sessionPlans.value,"reveal-saved-plan":z(i).revealSavedPlan,"overlay-open":bn.value,"goal-mode":z(i).goalMode.value,"tower-mode":z(i).towerMode.value,"tower-available":z(i).towerAvailable.value,"dynamic-workflow-mode":z(i).dynamicWorkflowMode.value,models:z(i).models.value,"starred-ids":z(i).starredModelIds.value,skills:z(i).skills.value,questions:z(i).questions.value,"pending-question-actions":z(i).pendingQuestionActions,"pending-approval-actions":z(i).pendingApprovalActions,running:ue.value,"turn-active":z(i).turnActive.value,queued:z(i).queued.value,"search-files":z(i).searchFiles,"upload-image":z(i).uploadImage,working:z(i).working.value,starting:z(i).isStartingFirstPrompt.value,"fast-moon":z(i).fastMoon.value,"file-reload-key":z(i).activeSessionId.value,"session-loading":z(i).sessionLoading.value,compaction:z(i).compaction.value,"has-more-messages":z(i).hasMoreMessages.value,"loading-more":z(i).loadingMoreMessages.value,"loading-more-error":z(i).loadMoreMessagesError.value,"load-older-messages":z(i).loadOlderMessages,"workspace-name":z(i).visibleWorkspace.value?.name,"workspace-root":z(i).visibleWorkspace.value?.root??z(i).status.value.cwd,"git-diff-stats":z(i).gitDiffStats.value,workspaces:z(i).workspacesView.value,"active-workspace-id":z(i).activeWorkspaceId.value,"session-title":re.value,pr:z(i).activePullRequest.value,"panel-visible":z(Oe),"panel-expanded":z(ke),"active-panel-type":z(De)?.type,"toggle-panel":z(Ne),"conversation-toc":z(i).conversationToc.value,"turn-folding":z(i).turnFolding.value,"activity-run-folding":z(i).activityRunFolding.value,"last-turn-reason":ie.value,"turn-error-kind":se.value?.reason===`max_steps`?`max_steps`:void 0,"turn-error-message":se.value?.message,"session-done":ce.value,pinned:z(i).pinnedSessionIds.value.includes(z(i).activeSessionId.value??``),"recent-sessions":b.value,onOpenChanges:t[32]||=e=>tn(),onTakeExpertTalk:dn,onBuildExpertTalk:fn,onSelectWorkspace:t[33]||=e=>sr(e),onAddWorkspace:t[34]||=e=>gn.value=!0,onOpenPr:cr,onSubmit:t[35]||=e=>Zn(e),onSteer:t[36]||=e=>z(i).steerPrompt(e.text,e.attachments),onApproval:t[37]||=(e,t)=>z(i).respondApproval(e,t),onCancelTask:t[38]||=e=>z(i).cancelTask(e),onAnswer:t[39]||=(e,t)=>z(i).respondQuestion(e,t),onDismiss:t[40]||=e=>z(i).dismissQuestion(e),onCommand:Kn,onInterrupt:t[41]||=e=>z(i).abortCurrentPrompt(),onUnqueue:qn,onEditQueued:Jn,onReorderQueue:Yn,onSteerQueued:Xn,onSetPermission:t[42]||=e=>z(i).setPermission(e),onSetThinking:t[43]||=e=>z(i).setThinking(e),onTogglePlan:t[44]||=e=>z(i).togglePlanMode(),onToggleWorkflow:t[45]||=e=>z(i).toggleDynamicWorkflowMode(),onToggleGoal:t[46]||=e=>z(i).toggleGoalMode(),onToggleTower:t[47]||=e=>z(i).toggleTowerMode(),onCreateGoal:t[48]||=e=>z(i).createGoal(e),onControlGoal:t[49]||=e=>z(i).controlGoal(e),onRefreshGitStatus:t[50]||=e=>z(i).activeSessionId.value&&z(i).loadGitStatus(z(i).activeSessionId.value),onRenameSession:t[51]||=(e,t)=>z(i).renameSession(e,t),onForkSession:t[52]||=e=>z(i).forkSession(e),onArchiveSession:t[53]||=e=>Fn(e),onRestoreSession:t[54]||=e=>In(e),onSelectSession:t[55]||=e=>z(i).selectSession(e),onTogglePin:t[56]||=e=>z(i).togglePinnedSession(e),onOpenSessionAdmin:T,onExportSession:t[57]||=e=>Vn(e),onCompact:t[58]||=e=>z(i).compact(),onPickModel:t[59]||=e=>kn(),onSelectModel:t[60]||=e=>Pn(e),onOpenFile:t[61]||=e=>Xt(e),onOpenMedia:t[62]||=e=>rt(e),onOpenCompaction:t[63]||=e=>Qt(e),onOpenAgent:t[64]||=e=>$t(e),onDetachTask:t[65]||=e=>z(i).detachTask(e),onOpenToolDiff:t[66]||=e=>en(e),onOpenTurnDiff:t[67]||=e=>nn(e),onEditMessage:Gn,onContinueTurn:Qn},null,8,`mobile.turns.expert-talk-runs.session-id.approvals.changes.git-info.tasks.todos.goal.activation-badges.status.thinking.plan-mode.plan-armed.session-plans.reveal-saved-plan.overlay-open.goal-mode.tower-mode.tower-available.dynamic-workflow-mode.models.starred-ids.skills.questions.pending-question-actions.pending-approval-actions.running.turn-active.queued.search-files.upload-image.working.starting.fast-moon.file-reload-key.session-loading.compaction.has-more-messages.loading-more.loading-more-error.load-older-messages.workspace-name.workspace-root.git-diff-stats.workspaces.active-workspace-id.session-title.pr.panel-visible.panel-expanded.active-panel-type.toggle-panel.conversation-toc.turn-folding.activity-run-folding.last-turn-reason.turn-error-kind.turn-error-message.session-done.pinned.recent-sessions`.split(`.`))),!z(I)&&z(ut)?(c(),P(Sp,{key:4,text:z(ut)?z(k)(`sidebar.expandSidebar`):z(k)(`sidebar.collapseSidebar`)},{default:B(()=>[v(Ca,{class:`sidebar-toggle-btn`,size:`sm`,label:z(ut)?z(k)(`sidebar.expandSidebar`):z(k)(`sidebar.collapseSidebar`),onClick:z(mt)},{default:B(()=>[v(X,{name:z(ut)?`panel-expand`:`panel-collapse`},null,8,[`name`])]),_:1},8,[`label`,`onClick`])]),_:1},8,[`text`])):E(``,!0),!z(I)&&z(ut)?(c(),P(Sp,{key:5,text:z(k)(`sidebar.newChat`)},{default:B(()=>[v(Ca,{class:`new-chat-btn`,size:`sm`,label:z(k)(`sidebar.newChat`),onClick:ir},{default:B(()=>[v(X,{name:`chat-new`})]),_:1},8,[`label`])]),_:1},8,[`text`])):E(``,!0),!u.value&&(!z(I)||z(Oe))?(c(),W(`aside`,{key:6,class:V([`global-preview`,{open:z(Oe),mobile:z(I),expanded:z(ke),"no-anim":z(Jt)||Le.value}]),role:`complementary`,"aria-label":z(k)(`layout.detailPanelAria`),"aria-hidden":!z(Oe)},[F(`div`,Nze,[z(Oe)&&!z(I)&&!z(ke)?(c(),P(XD,{key:0,class:`panel-resize`,"storage-key":z(ht),"default-width":z(_t),min:z(gt),max:z(vt),reverse:``,"aria-label":z(k)(`layout.resizePreviewAria`),"onUpdate:width":t[68]||=e=>yt.value=e,"onUpdate:dragging":t[69]||=e=>Jt.value=e},null,8,[`storage-key`,`default-width`,`min`,`max`,`aria-label`])):E(``,!0),v(fOe,{tabs:z(Te),"active-id":z(Ee),expanded:z(ke),mobile:z(I),"can-open-diff":z(i).status.value.isGitRepo&&z(i).activeSessionId.value!==null,"can-open-side-chat":!!z(i).activeWorkspaceId.value,onActivate:z(je),onClose:sn,onToggleExpanded:z(Pe),onHide:z(q),onOpenDiff:tn,onOpenSideChat:t[70]||=e=>rn()},null,8,[`tabs`,`active-id`,`expanded`,`mobile`,`can-open-diff`,`can-open-side-chat`,`onActivate`,`onToggleExpanded`,`onHide`]),F(`div`,Pze,[z(De)===null?(c(),W(`div`,{key:0,class:`panel-launcher`,role:`group`,"aria-label":z(k)(`panel.launcherAria`)},[F(`button`,{type:`button`,disabled:!z(i).status.value.isGitRepo||z(i).activeSessionId.value===null,onClick:tn},[v(X,{name:`git-fork`}),F(`span`,null,U(z(k)(`panel.tabs.diff`)),1)],8,Ize),F(`button`,{type:`button`,disabled:!z(i).activeWorkspaceId.value,onClick:t[71]||=e=>rn()},[v(X,{name:`message`}),F(`span`,null,U(z(k)(`sideChat.title`)),1)],8,Lze),v(A7,{trigger:`launcher`,models:z(i).models.value,onTake:dn,onBuild:fn},null,8,[`models`])],8,Fze)):Ce.value===`compaction`&&z(St)?(c(),P(KEe,{key:1,text:z(xt)??``,subtitle:z(k)(`conversation.summaryTitle`),onClose:cn},null,8,[`text`,`subtitle`])):Ce.value===`agent`&&z(Tt)?(c(),P(rDe,{key:2,member:z(Tt),turns:z(Et),running:z(Mt),loading:z(Dt),"load-error":z(Ot),"has-more":z(jt),"loading-more":z(kt),"load-more-error":z(At),onClose:cn,onLoadOlderMessages:z(Ft),onOpenFile:t[72]||=e=>Xt(e),onOpenMedia:t[73]||=e=>rt(e),onOpenAgent:t[74]||=e=>$t(e),onOpenTurnDiff:t[75]||=e=>nn(e)},null,8,[`member`,`turns`,`running`,`loading`,`load-error`,`has-more`,`loading-more`,`load-more-error`,`onLoadOlderMessages`])):Ce.value===`btw`&&z(Wt)?(c(),P(jDe,{key:3,ref_key:`sideChatPanelRef`,ref:pn,turns:z(i).sideChatTurns.value,running:z(i).sideChatRunning.value,sending:z(i).sideChatSending.value,onSend:t[76]||=e=>z(i).sendSideChatPrompt(e),onClose:cn},null,8,[`turns`,`running`,`sending`])):Ce.value===`diff`?(c(),P(rOe,{key:4,mode:z(zt),changes:z(i).changes.value,"git-info":z(i).gitInfo.value,"file-diff":z(i).fileDiff.value,"selected-diff-path":z(i).selectedDiffPath.value,"file-diff-loading":z(i).fileDiffLoading.value,closable:``,onOpen:z(Ut),onBack:t[77]||=e=>{zt.value=`list`,Bt.value=null,z(i).clearFileDiff()},onClose:cn},null,8,[`mode`,`changes`,`git-info`,`file-diff`,`selected-diff-path`,`file-diff-loading`,`onOpen`])):Ce.value===`toolDiff`&&z(It)?(c(),P(cDe,{key:5,target:z(It),onClose:cn},null,8,[`target`])):Ce.value===`turnDiff`&&we.value?(c(),P(CDe,{key:6,changes:we.value.changes,cwd:z(i).visibleWorkspace.value?.root??z(i).status.value.cwd,onOpenFile:t[78]||=e=>Xt(e),onClose:cn},null,8,[`changes`,`cwd`])):Ce.value===`editor`?(c(),P(WEe,{key:7,onClose:cn})):Ce.value===`file`?(c(),P(hEe,{key:8,file:z(ze),loading:z(Be),error:z(Ve),line:z(Re)?.line,"download-url":z(We),closable:``,"external-actions":z(Ge),stale:z(He),refreshing:z(Ue),editable:z(i).fsWriteSupported.value&&z(i).activeSessionId.value!==null,"open-file":Xt,onClose:cn,onOpenExternal:z(Ye),onReveal:z(Xe),onRefresh:z(Je),onOpenEditor:t[79]||=e=>Zt(e)},null,8,[`file`,`loading`,`error`,`line`,`download-url`,`external-actions`,`stale`,`refreshing`,`editable`,`onOpenExternal`,`onReveal`,`onRefresh`])):E(``,!0)]),t[125]||=F(`div`,{class:`pfc-host`},null,-1)])],10,Mze)):E(``,!0),$e.value&&et.value?(c(),P(fTe,{key:7,media:$e.value,src:et.value,onClose:it},null,8,[`media`,`src`])):E(``,!0),v(oTe,{enabled:!bn.value,"panel-source":xn.value,onAdd:Sn},null,8,[`enabled`,`panel-source`]),hn.value?(c(),P(OOe,{key:8,models:z(i).models.value,current:z(i).status.value.modelId,"starred-ids":z(i).starredModelIds.value,loading:En.value,unavailable:Dn.value,onSelect:t[80]||=e=>Nn(e),onToggleStar:t[81]||=e=>z(i).toggleStarModel(e),onClose:t[82]||=e=>hn.value=!1},null,8,[`models`,`current`,`starred-ids`,`loading`,`unavailable`])):E(``,!0),_n.value?(c(),P(sFe,{key:9,status:z(i).status.value,thinking:fe.value,"plan-mode":z(i).planMode.value,"dynamic-workflow-mode":z(i).dynamicWorkflowMode.value,"cost-usd":z(i).sessionCost.value,onClose:t[83]||=e=>_n.value=!1},null,8,[`status`,`thinking`,`plan-mode`,`dynamic-workflow-mode`,`cost-usd`])):E(``,!0),gn.value?(c(),P(qPe,{key:10,"browse-fs":z(i).browseFs,"get-fs-home":z(i).getFsHome,"default-path":z(i).visibleWorkspace.value?.root??z(i).status.value.cwd,error:wn.value,onAdd:t[84]||=e=>$n(e),onClose:er},null,8,[`browse-fs`,`get-fs-home`,`default-path`,`error`])):E(``,!0),v(oe,{name:`gload-fade`},{default:B(()=>[z(i).initialized.value?E(``,!0):(c(),P(ARe,{key:0,stage:z(i).bootStage.value,retries:z(i).bootRetries.value,issue:z(i).connectIssue.value},null,8,[`stage`,`retries`,`issue`]))]),_:1}),G.value?(c(),P(fRe,{key:11,onComplete:he})):ge.value?(c(),P(V9,{key:12,onComplete:_e,onSkip:_e})):E(``,!0),v(fFe,{warnings:z(i).warnings.value,onDismiss:z(i).dismissWarning},null,8,[`warnings`,`onDismiss`]),(c(),P(ee,{defer:``,to:`.con`},[f.value?(c(),P(Y7,{key:`${f.value.kind}:${f.value.ids.join(`,`)}`,duration:8e3,onDismiss:t[85]||=e=>f.value=null},{default:B(()=>[F(`span`,null,U(z(k)(f.value.kind===`done`?`admin.actionArchived`:`admin.actionRestored`,{n:f.value.ids.length})),1),F(`button`,{type:`button`,class:`session-action-undo`,onClick:Bn},U(z(k)(`sidebar.archiveToastUndo`)),1)]),_:1})):E(``,!0),m.value?(c(),P(Y7,{key:`${m.value.sessionId}:${m.value.state}`,duration:m.value.state===`running`?6e4:4e3,onDismiss:t[86]||=e=>m.value=null},{default:B(()=>[K(U(z(k)(m.value.state===`running`?`admin.exporting`:`admin.exported`)),1)]),_:1},8,[`duration`])):E(``,!0),g.value?(c(),P(Y7,{key:g.value,duration:5e3,onDismiss:t[87]||=e=>g.value=null},{default:B(()=>[K(U(g.value),1)]),_:1})):E(``,!0),y.value?(c(),P(Y7,{key:y.value,duration:4e3,onDismiss:t[88]||=e=>y.value=null},{default:B(()=>[K(U(y.value),1)]),_:1})):E(``,!0)])),z(N)?(c(),P(ize,{key:13})):E(``,!0),z(I)?(c(),P(BFe,{key:14,modelValue:te.value,"onUpdate:modelValue":t[89]||=e=>te.value=e,groups:z(i).workspaceGroups.value,"active-workspace-id":z(i).activeWorkspaceId.value,"active-id":z(i).activeSessionId.value,"attention-by-session":z(i).attentionBySession.value,"attention-by-workspace":z(i).attentionByWorkspace.value,onSelect:t[90]||=e=>z(i).selectSession(e),onCreate:ir,onCreateInWorkspace:t[91]||=e=>sr(e),onAddWorkspace:t[92]||=e=>gn.value=!0,onRename:t[93]||=(e,t)=>z(i).renameSession(e,t),onArchive:t[94]||=e=>Fn(e),onDeleteSession:t[95]||=e=>Hn(e),onDeleteWorkspace:t[96]||=e=>Un(e),onLoadMore:t[97]||=e=>void z(i).loadMoreSessions(e)},null,8,[`modelValue`,`groups`,`active-workspace-id`,`active-id`,`attention-by-session`,`attention-by-workspace`])):E(``,!0),z(I)?(c(),P(YIe,{key:15,modelValue:ne.value,"onUpdate:modelValue":t[98]||=e=>ne.value=e,status:z(i).status.value,thinking:z(i).thinking.value,models:z(i).models.value,"plan-mode":z(i).planMode.value,"goal-mode":z(i).goalMode.value,goal:z(i).goal.value,"dynamic-workflow-mode":z(i).dynamicWorkflowMode.value,"color-scheme":z(i).colorScheme.value,"ui-font-size":z(i).uiFontSize.value,"conversation-toc":z(i).conversationToc.value,"server-version":z(i).serverVersion.value,onPickModel:t[99]||=e=>kn(),onSetThinking:t[100]||=e=>z(i).setThinking(e),onTogglePlan:t[101]||=e=>z(i).togglePlanMode(),onToggleWorkflow:t[102]||=e=>z(i).toggleDynamicWorkflowMode(),onToggleGoal:t[103]||=e=>z(i).toggleGoalMode(),onControlGoal:t[104]||=e=>z(i).controlGoal(e),onSetPermission:t[105]||=e=>z(i).setPermission(e),onSetColorScheme:t[106]||=e=>z(i).setColorScheme(e),onSetUiFontSize:t[107]||=e=>z(i).setUiFontSize(e),onSetConversationToc:t[108]||=e=>z(i).setConversationToc(e),onLogin:t[109]||=()=>{ne.value=!1,Mn()}},null,8,[`modelValue`,`status`,`thinking`,`models`,`plan-mode`,`goal-mode`,`goal`,`dynamic-workflow-mode`,`color-scheme`,`ui-font-size`,`conversation-toc`,`server-version`])):E(``,!0)],6)),vn.value?(c(),P(fPe,{key:4,"color-scheme":z(i).colorScheme.value,accent:z(i).accent.value,"ui-font-size":z(i).uiFontSize.value,"auth-ready":z(i).authReady.value,"account-model":z(i).defaultModel.value,notify:z(i).notifyOnComplete.value,"notify-question":z(i).notifyOnQuestion.value,"notify-approval":z(i).notifyOnApproval.value,"notify-permission":z(i).notifyPermission.value,sound:z(i).soundOnComplete.value,"conversation-toc":z(i).conversationToc.value,"turn-folding":z(i).turnFolding.value,"activity-run-folding":z(i).activityRunFolding.value,config:z(i).config.value,models:z(i).models.value,"config-saving":On.value,"server-version":z(i).serverVersion.value,backend:z(i).backend.value,"experimental-flag-states":z(i).experimentalFlagStates.value,"subagent-model-policy":z(i).subagentModelPolicy.value,"subagent-model-policy-saving":z(i).subagentModelPolicySaving.value,onSaveSubagentModelPolicy:t[110]||=e=>void z(i).saveSubagentModelPolicy(e),onClearSubagentModelPolicy:t[111]||=e=>void z(i).clearSubagentModelPolicy(),"initial-tab":yn.value,onSetColorScheme:t[112]||=e=>z(i).setColorScheme(e),onSetAccent:t[113]||=e=>z(i).setAccent(e),onSetUiFontSize:t[114]||=e=>z(i).setUiFontSize(e),onSetNotify:t[115]||=e=>z(i).setNotifyOnComplete(e),onSetNotifyQuestion:t[116]||=e=>z(i).setNotifyOnQuestion(e),onSetNotifyApproval:t[117]||=e=>z(i).setNotifyOnApproval(e),onSetSound:t[118]||=e=>z(i).setSoundOnComplete(e),onSetConversationToc:t[119]||=e=>z(i).setConversationToc(e),onSetTurnFolding:t[120]||=e=>z(i).setTurnFolding(e),onSetActivityRunFolding:t[121]||=e=>z(i).setActivityRunFolding(e),onUpdateConfig:t[122]||=e=>Wn(e),onOpenOnboarding:t[123]||=()=>{vn.value=!1,ve()},onClose:t[124]||=e=>vn.value=!1},null,8,[`color-scheme`,`accent`,`ui-font-size`,`auth-ready`,`account-model`,`notify`,`notify-question`,`notify-approval`,`notify-permission`,`sound`,`conversation-toc`,`turn-folding`,`activity-run-folding`,`config`,`models`,`config-saving`,`server-version`,`backend`,`experimental-flag-states`,`subagent-model-policy`,`subagent-model-policy-saving`,`initial-tab`])):E(``,!0),v(XPe)]))}}),[[`__scopeId`,`data-v-a16f067c`]]);sC(),I(Rze).use(fC).mount(`#app`);export{Sq as $,IX as A,_J as B,p2 as C,HX as D,u2 as E,zJ as F,Jq as G,sJ as H,mJ as I,Oq as J,Kq as K,gJ as L,eY as M,ZJ as N,VX as O,QJ as P,xq as Q,fJ as R,d2 as S,g2 as T,qq as U,dJ as V,uJ as W,Nq as X,Aq as Y,jq as Z,wY as _,hX as a,X as at,l2 as b,c2 as c,TX as d,pq as et,h2 as f,LX as g,cX as h,r2 as i,OO as it,$J as j,P0 as k,n2 as l,m2 as m,lX as n,Mq as nt,QX as o,Af as ot,wX as p,oJ as q,Z0 as r,HK as rt,RX as s,Y as st,w9 as t,mq as tt,s2 as u,SX as v,T1 as w,xX as x,f2 as y,pJ as z}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index10-Dhnug51i.js b/apps/pythinker-code/dist-web/assets/index10-cR1J5t3a.js similarity index 99% rename from apps/pythinker-code/dist-web/assets/index10-Dhnug51i.js rename to apps/pythinker-code/dist-web/assets/index10-cR1J5t3a.js index be736dd7b..017f6b271 100644 --- a/apps/pythinker-code/dist-web/assets/index10-Dhnug51i.js +++ b/apps/pythinker-code/dist-web/assets/index10-cR1J5t3a.js @@ -1,2 +1,2 @@ -import{A as e,G as t,I as n,J as r,N as i,O as a,S as o,U as s,_ as c,c as ee,f as te,g as ne,h as l,j as re,lt as ie,m as u,n as ae,nt as d,ot as f,q as oe,st as p,u as se,ut as m,v as h,w as ce,z as le}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{B as ue,I as de,V as g,_ as fe,a as pe,d as me,et as he,h as ge,i as _e,l as ve,n as ye,p as be,v as xe,x as Se}from"./index-DAFMRqR8.js";var _=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Ce=[`data-markstream-mode`],we={key:0,class:`infographic-block-header flex justify-between items-center border-b`},Te={key:0},Ee={key:1,class:`flex items-center gap-x-2 overflow-hidden`},De=[`innerHTML`],Oe={key:2},ke={key:3,class:`infographic-mode-toggle flex items-center gap-0.5`},Ae=[`disabled`],je={class:`flex items-center gap-x-1`},Me={class:`flex items-center gap-x-1`},Ne={key:4},Pe={key:5,class:`infographic-header-actions flex items-center`},Fe=[`aria-pressed`],Ie={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Le={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Re=[`disabled`],ze=[`disabled`],Be={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Ve={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},He={key:0,class:`infographic-source`},Ue={class:`infographic-source-code text-sm font-mono whitespace-pre-wrap`},We={key:1,class:`relative`},Ge={key:0,class:`absolute top-2 right-2 z-10 rounded-lg`},Ke={class:`flex items-center gap-2 backdrop-blur rounded-lg`},qe={key:0,class:`infographic-pending-source text-sm font-mono whitespace-pre-wrap`},Je={class:`dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden`},Ye={class:`absolute top-6 right-6 z-50 flex items-center gap-2`},v=`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,y=fe(ce({__name:`InfographicBlockNode`,props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:[`copy`,`export`,`openModal`],setup(ce,{emit:fe}){let y=ce,{t:b}=pe(),Xe=be(),Ze=Se(),Qe=xe(),x=d(!1),S=d(!1),C=d(),w=d(),T=d(!0),$e=d(!1),E=d(!1),D=d(),O=d(null),k=d(!1),A=d(!1),j=d(null),M=d(typeof window>`u`||!Qe.value),et=s(),N=a(he,null),P=``,tt=u(()=>me(y,et));typeof window<`u`&&t([()=>C.value,Qe],([e,t])=>{var n;if((n=j.value)==null||n.destroy(),j.value=null,!t||M.value)return void(M.value=!0);if(!e)return void(M.value=!1);let r=Xe(e,{rootMargin:Ze?.value.heavyBlockMargin??Ze?.value.rootMargin??`160px`,allowIdle:!1});j.value=r,M.value=r.isVisible.value,r.whenVisible.then(()=>{M.value=!0})},{immediate:!0});let F=u(()=>y.node.code),nt=u(()=>function(e){return y.maxHeight===`none`?ue(e,void 0,null):ue(e,void 0,g(y.maxHeight))}(g(y.estimatedPreviewHeightPx)??de(F.value))),rt=d(`${nt.value}px`),it=u(()=>g(y.estimatedPreviewHeightPx)!=null);function at(){if(!w.value||it.value)return;let e=w.value.scrollHeight;if(e>0){let t=g(function(e){if(y.maxHeight===`none`)return`${e}px`;if(y.maxHeight!=null){let t=Number.parseFloat(String(y.maxHeight));if(Number.isFinite(t))return`${Math.min(e,t)}px`}let t=w.value;if(t){let n=getComputedStyle(t).getPropertyValue(`--ms-size-code-max-height`).trim(),r=Number.parseFloat(n);if(Number.isFinite(r))return`${Math.min(e,r)}px`}return`${Math.min(e,500)}px`}(e))??e;rt.value=`${Math.max(t,nt.value)}px`}}let I=d(1),L=d(0),R=d(0),z=d(!1),B=d({x:0,y:0}),ot=u(()=>F.value);function st(e){return!e||e.disabled}function V(e,t,n=`top`){if(st(e.currentTarget))return;let r=e,i=r?.clientX!=null&&r?.clientY!=null?{x:r.clientX,y:r.clientY}:void 0;ge(e.currentTarget,t,n,!1,i,y.isDark)}function H(){ye()}function ct(e){if(st(e.currentTarget))return;let t=x.value?b(`common.copied`)||`Copied`:b(`common.copy`)||`Copy`,n=e,r=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;ge(e.currentTarget,t,`top`,!1,r,y.isDark)}function lt(){return _(this,null,function*(){try{let e=F.value;typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),x.value=!0,setTimeout(()=>{x.value=!1},1e3)}catch(e){console.error(`Failed to copy:`,e)}})}function ut(e){(e!==`preview`||ve())&&($e.value=!0,T.value=e===`source`)}function dt(){let e=w.value?.querySelector(`svg`);e?function(e){_(this,null,function*(){try{let t=new XMLSerializer().serializeToString(e),n=new Blob([t],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n);if(typeof document<`u`){let e=document.createElement(`a`);e.href=r,e.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}URL.revokeObjectURL(r)}}catch(e){console.error(`Failed to export SVG:`,e)}})}(e):console.error(`SVG element not found`)}function ft(e){e.key===`Escape`&&E.value&&pt()}function pt(){if(E.value=!1,D.value&&(D.value.innerHTML=``),O.value=null,typeof document<`u`)try{document.body.style.overflow=``}catch{}if(typeof window<`u`)try{window.removeEventListener(`keydown`,ft)}catch{}}function mt(){(function(){if(E.value=!0,typeof document<`u`)try{document.body.style.overflow=`hidden`}catch{}if(typeof window<`u`)try{window.addEventListener(`keydown`,ft)}catch{}e(()=>{if(w.value&&D.value){D.value.innerHTML=``;let e=document.createElement(`div`);e.style.transition=`transform 0.1s ease`,e.style.transformOrigin=`center center`,e.style.width=`100%`,e.style.height=`100%`,e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`;let t=w.value.cloneNode(!0);t.classList.add(`fullscreen`),t.style.height=`auto`,e.appendChild(t),D.value.appendChild(e),O.value=e,e.style.transform=`translate(${L.value}px, ${R.value}px) scale(${I.value})`}})})()}function ht(){I.value<3&&(I.value+=.1)}function gt(){I.value>.5&&(I.value-=.1)}function _t(){I.value=1,L.value=0,R.value=0}function U(e){z.value=!0,e instanceof MouseEvent?B.value={x:e.clientX-L.value,y:e.clientY-R.value}:B.value={x:e.touches[0].clientX-L.value,y:e.touches[0].clientY-R.value}}function W(e){if(!z.value)return;let t,n;e instanceof MouseEvent?(t=e.clientX,n=e.clientY):(t=e.touches[0].clientX,n=e.touches[0].clientY),L.value=t-B.value.x,R.value=n-B.value.y}function G(){z.value=!1}let K=null,vt=!1,q=!1,J=!1,Y=``,X=!1,yt=0;function Z(e){return!X&&e===yt}function bt(t=!1){return _(this,null,function*(){var n,r;if(X||!M.value||!w.value)return;if(vt)return q=!0,void(J||=t);let i=ot.value;if(!t&&i===Y&&k.value)return;let a=!1===y.loading,o=++yt;vt=!0,function(){let e=tt.value;e&&P!==e&&(P&&N?.markSettled(P),P=e,N?.markPending(e))}();let s=w.value.innerHTML,c=k.value,ee=A.value;A.value=!1;try{let t=yield _e();if(!Z(o))return;if(!t)return void console.warn(`Infographic library failed to load.`);let a=w.value;if(!a)return;K&&=((n=K.destroy)==null||n.call(K),null),a.innerHTML=``,K=new t({container:a,width:`100%`,height:`100%`});let s=``;if((r=K.on)==null||r.call(K,`error`,e=>{s=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:String(e&&typeof e==`object`&&`message`in e?e.message??``:e??``)).filter(Boolean).join(`; `)}),K.render(F.value),s)throw Error(s);if(!a.childNodes.length)throw Error(`Infographic render returned empty output.`);k.value=!0,A.value=!1,Y=i,e(()=>{Z(o)&&at()})}catch(e){if(!Z(o))return;a&&!1===y.loading&&i===ot.value?(console.error(`Failed to render infographic:`,e),k.value=!1,A.value=!0,Y=``,w.value&&(w.value.innerHTML=`
        Failed to render infographic: ${e instanceof Error?e.message:`Unknown error`}
        `)):(k.value=c,A.value=ee,c&&w.value&&(w.value.innerHTML=s))}finally{if(vt=!1,Z(o))if(q){let t=J;q=!1,J=!1,e(()=>{bt(t)})}else (function(){_(this,null,function*(){let t=P;t&&(P=``,yield e(),function(e=tt.value){e&&C.value&&N?.reportHeight(e,C.value.offsetHeight)}(t),N?.markSettled(t))})})()}})}function Q(t=!1){X||!M.value||T.value||S.value||e(()=>{X||bt(t)})}t(()=>F.value,()=>{Q(!0)}),t(()=>y.loading,(e,t)=>{t&&!e&&Q(!0)}),t(()=>T.value,e=>{e||Q(!0)}),t(()=>S.value,e=>{e||Q()}),t(()=>y.maxHeight,()=>{e(()=>{at()})}),t([()=>y.estimatedPreviewHeightPx,()=>F.value],()=>{k.value||T.value||(rt.value=`${nt.value}px`)}),t(()=>M.value,e=>{!e||T.value||S.value||Q()}),i(()=>{!$e.value&&ve()&&(T.value=!1),Q()}),re(()=>{var e,t;if(X=!0,yt+=1,q=!1,J=!1,(e=j.value)==null||e.destroy(),j.value=null,function(){let e=P;e&&(P=``,N?.markSettled(e))}(),K&&=((t=K.destroy)==null||t.call(K),null),Y=``,typeof window<`u`)try{window.removeEventListener(`keydown`,ft)}catch{}});let xt=u(()=>!ve()),$=u(()=>T.value||S.value),St=u(()=>T.value?`fallback`:A.value?`error`:k.value?`preview`:`pending`),Ct=u(()=>({transform:`translate(${L.value}px, ${R.value}px) scale(${I.value})`}));return t(Ct,e=>{E.value&&O.value&&(O.value.style.transform=e.transform)}),(e,t)=>(n(),h(`div`,{ref_key:`viewportTarget`,ref:C,class:p([`infographic-block-container rounded-lg border overflow-hidden`,[{"is-rendering":y.loading,dark:y.isDark}]]),"data-markstream-infographic":`1`,"data-markstream-mode":St.value},[y.showHeader?(n(),h(`div`,we,[e.$slots[`header-left`]?(n(),h(`div`,Te,[le(e.$slots,`header-left`,{},void 0,!0)])):(n(),h(`div`,Ee,[l(`span`,{class:`icon-slot action-icon shrink-0`,innerHTML:f(` +import{A as e,G as t,I as n,J as r,N as i,O as a,S as o,U as s,_ as c,c as ee,f as te,g as ne,h as l,j as re,lt as ie,m as u,n as ae,nt as d,ot as f,q as oe,st as p,u as se,ut as m,v as h,w as ce,z as le}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{B as ue,I as de,V as g,_ as fe,a as pe,d as me,et as he,h as ge,i as _e,l as ve,n as ye,p as be,v as xe,x as Se}from"./index-CJN6blp7.js";var _=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Ce=[`data-markstream-mode`],we={key:0,class:`infographic-block-header flex justify-between items-center border-b`},Te={key:0},Ee={key:1,class:`flex items-center gap-x-2 overflow-hidden`},De=[`innerHTML`],Oe={key:2},ke={key:3,class:`infographic-mode-toggle flex items-center gap-0.5`},Ae=[`disabled`],je={class:`flex items-center gap-x-1`},Me={class:`flex items-center gap-x-1`},Ne={key:4},Pe={key:5,class:`infographic-header-actions flex items-center`},Fe=[`aria-pressed`],Ie={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Le={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Re=[`disabled`],ze=[`disabled`],Be={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},Ve={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},He={key:0,class:`infographic-source`},Ue={class:`infographic-source-code text-sm font-mono whitespace-pre-wrap`},We={key:1,class:`relative`},Ge={key:0,class:`absolute top-2 right-2 z-10 rounded-lg`},Ke={class:`flex items-center gap-2 backdrop-blur rounded-lg`},qe={key:0,class:`infographic-pending-source text-sm font-mono whitespace-pre-wrap`},Je={class:`dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden`},Ye={class:`absolute top-6 right-6 z-50 flex items-center gap-2`},v=`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,y=fe(ce({__name:`InfographicBlockNode`,props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:[`copy`,`export`,`openModal`],setup(ce,{emit:fe}){let y=ce,{t:b}=pe(),Xe=be(),Ze=Se(),Qe=xe(),x=d(!1),S=d(!1),C=d(),w=d(),T=d(!0),$e=d(!1),E=d(!1),D=d(),O=d(null),k=d(!1),A=d(!1),j=d(null),M=d(typeof window>`u`||!Qe.value),et=s(),N=a(he,null),P=``,tt=u(()=>me(y,et));typeof window<`u`&&t([()=>C.value,Qe],([e,t])=>{var n;if((n=j.value)==null||n.destroy(),j.value=null,!t||M.value)return void(M.value=!0);if(!e)return void(M.value=!1);let r=Xe(e,{rootMargin:Ze?.value.heavyBlockMargin??Ze?.value.rootMargin??`160px`,allowIdle:!1});j.value=r,M.value=r.isVisible.value,r.whenVisible.then(()=>{M.value=!0})},{immediate:!0});let F=u(()=>y.node.code),nt=u(()=>function(e){return y.maxHeight===`none`?ue(e,void 0,null):ue(e,void 0,g(y.maxHeight))}(g(y.estimatedPreviewHeightPx)??de(F.value))),rt=d(`${nt.value}px`),it=u(()=>g(y.estimatedPreviewHeightPx)!=null);function at(){if(!w.value||it.value)return;let e=w.value.scrollHeight;if(e>0){let t=g(function(e){if(y.maxHeight===`none`)return`${e}px`;if(y.maxHeight!=null){let t=Number.parseFloat(String(y.maxHeight));if(Number.isFinite(t))return`${Math.min(e,t)}px`}let t=w.value;if(t){let n=getComputedStyle(t).getPropertyValue(`--ms-size-code-max-height`).trim(),r=Number.parseFloat(n);if(Number.isFinite(r))return`${Math.min(e,r)}px`}return`${Math.min(e,500)}px`}(e))??e;rt.value=`${Math.max(t,nt.value)}px`}}let I=d(1),L=d(0),R=d(0),z=d(!1),B=d({x:0,y:0}),ot=u(()=>F.value);function st(e){return!e||e.disabled}function V(e,t,n=`top`){if(st(e.currentTarget))return;let r=e,i=r?.clientX!=null&&r?.clientY!=null?{x:r.clientX,y:r.clientY}:void 0;ge(e.currentTarget,t,n,!1,i,y.isDark)}function H(){ye()}function ct(e){if(st(e.currentTarget))return;let t=x.value?b(`common.copied`)||`Copied`:b(`common.copy`)||`Copy`,n=e,r=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;ge(e.currentTarget,t,`top`,!1,r,y.isDark)}function lt(){return _(this,null,function*(){try{let e=F.value;typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),x.value=!0,setTimeout(()=>{x.value=!1},1e3)}catch(e){console.error(`Failed to copy:`,e)}})}function ut(e){(e!==`preview`||ve())&&($e.value=!0,T.value=e===`source`)}function dt(){let e=w.value?.querySelector(`svg`);e?function(e){_(this,null,function*(){try{let t=new XMLSerializer().serializeToString(e),n=new Blob([t],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n);if(typeof document<`u`){let e=document.createElement(`a`);e.href=r,e.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}URL.revokeObjectURL(r)}}catch(e){console.error(`Failed to export SVG:`,e)}})}(e):console.error(`SVG element not found`)}function ft(e){e.key===`Escape`&&E.value&&pt()}function pt(){if(E.value=!1,D.value&&(D.value.innerHTML=``),O.value=null,typeof document<`u`)try{document.body.style.overflow=``}catch{}if(typeof window<`u`)try{window.removeEventListener(`keydown`,ft)}catch{}}function mt(){(function(){if(E.value=!0,typeof document<`u`)try{document.body.style.overflow=`hidden`}catch{}if(typeof window<`u`)try{window.addEventListener(`keydown`,ft)}catch{}e(()=>{if(w.value&&D.value){D.value.innerHTML=``;let e=document.createElement(`div`);e.style.transition=`transform 0.1s ease`,e.style.transformOrigin=`center center`,e.style.width=`100%`,e.style.height=`100%`,e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`;let t=w.value.cloneNode(!0);t.classList.add(`fullscreen`),t.style.height=`auto`,e.appendChild(t),D.value.appendChild(e),O.value=e,e.style.transform=`translate(${L.value}px, ${R.value}px) scale(${I.value})`}})})()}function ht(){I.value<3&&(I.value+=.1)}function gt(){I.value>.5&&(I.value-=.1)}function _t(){I.value=1,L.value=0,R.value=0}function U(e){z.value=!0,e instanceof MouseEvent?B.value={x:e.clientX-L.value,y:e.clientY-R.value}:B.value={x:e.touches[0].clientX-L.value,y:e.touches[0].clientY-R.value}}function W(e){if(!z.value)return;let t,n;e instanceof MouseEvent?(t=e.clientX,n=e.clientY):(t=e.touches[0].clientX,n=e.touches[0].clientY),L.value=t-B.value.x,R.value=n-B.value.y}function G(){z.value=!1}let K=null,vt=!1,q=!1,J=!1,Y=``,X=!1,yt=0;function Z(e){return!X&&e===yt}function bt(t=!1){return _(this,null,function*(){var n,r;if(X||!M.value||!w.value)return;if(vt)return q=!0,void(J||=t);let i=ot.value;if(!t&&i===Y&&k.value)return;let a=!1===y.loading,o=++yt;vt=!0,function(){let e=tt.value;e&&P!==e&&(P&&N?.markSettled(P),P=e,N?.markPending(e))}();let s=w.value.innerHTML,c=k.value,ee=A.value;A.value=!1;try{let t=yield _e();if(!Z(o))return;if(!t)return void console.warn(`Infographic library failed to load.`);let a=w.value;if(!a)return;K&&=((n=K.destroy)==null||n.call(K),null),a.innerHTML=``,K=new t({container:a,width:`100%`,height:`100%`});let s=``;if((r=K.on)==null||r.call(K,`error`,e=>{s=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:String(e&&typeof e==`object`&&`message`in e?e.message??``:e??``)).filter(Boolean).join(`; `)}),K.render(F.value),s)throw Error(s);if(!a.childNodes.length)throw Error(`Infographic render returned empty output.`);k.value=!0,A.value=!1,Y=i,e(()=>{Z(o)&&at()})}catch(e){if(!Z(o))return;a&&!1===y.loading&&i===ot.value?(console.error(`Failed to render infographic:`,e),k.value=!1,A.value=!0,Y=``,w.value&&(w.value.innerHTML=`
        Failed to render infographic: ${e instanceof Error?e.message:`Unknown error`}
        `)):(k.value=c,A.value=ee,c&&w.value&&(w.value.innerHTML=s))}finally{if(vt=!1,Z(o))if(q){let t=J;q=!1,J=!1,e(()=>{bt(t)})}else (function(){_(this,null,function*(){let t=P;t&&(P=``,yield e(),function(e=tt.value){e&&C.value&&N?.reportHeight(e,C.value.offsetHeight)}(t),N?.markSettled(t))})})()}})}function Q(t=!1){X||!M.value||T.value||S.value||e(()=>{X||bt(t)})}t(()=>F.value,()=>{Q(!0)}),t(()=>y.loading,(e,t)=>{t&&!e&&Q(!0)}),t(()=>T.value,e=>{e||Q(!0)}),t(()=>S.value,e=>{e||Q()}),t(()=>y.maxHeight,()=>{e(()=>{at()})}),t([()=>y.estimatedPreviewHeightPx,()=>F.value],()=>{k.value||T.value||(rt.value=`${nt.value}px`)}),t(()=>M.value,e=>{!e||T.value||S.value||Q()}),i(()=>{!$e.value&&ve()&&(T.value=!1),Q()}),re(()=>{var e,t;if(X=!0,yt+=1,q=!1,J=!1,(e=j.value)==null||e.destroy(),j.value=null,function(){let e=P;e&&(P=``,N?.markSettled(e))}(),K&&=((t=K.destroy)==null||t.call(K),null),Y=``,typeof window<`u`)try{window.removeEventListener(`keydown`,ft)}catch{}});let xt=u(()=>!ve()),$=u(()=>T.value||S.value),St=u(()=>T.value?`fallback`:A.value?`error`:k.value?`preview`:`pending`),Ct=u(()=>({transform:`translate(${L.value}px, ${R.value}px) scale(${I.value})`}));return t(Ct,e=>{E.value&&O.value&&(O.value.style.transform=e.transform)}),(e,t)=>(n(),h(`div`,{ref_key:`viewportTarget`,ref:C,class:p([`infographic-block-container rounded-lg border overflow-hidden`,[{"is-rendering":y.loading,dark:y.isDark}]]),"data-markstream-infographic":`1`,"data-markstream-mode":St.value},[y.showHeader?(n(),h(`div`,we,[e.$slots[`header-left`]?(n(),h(`div`,Te,[le(e.$slots,`header-left`,{},void 0,!0)])):(n(),h(`div`,Ee,[l(`span`,{class:`icon-slot action-icon shrink-0`,innerHTML:f(` `)},null,8,De),t[21]||=l(`span`,{class:`infographic-label font-medium font-mono truncate`},`Infographic`,-1)])),e.$slots[`header-center`]?(n(),h(`div`,Oe,[le(e.$slots,`header-center`,{},void 0,!0)])):y.showModeToggle?(n(),h(`div`,ke,[l(`button`,{class:p([`infographic-mode-btn px-2 py-0.5 rounded transition-colors`,[T.value?``:`is-active`,xt.value?`opacity-50 cursor-not-allowed`:``]]),disabled:xt.value,onClick:t[0]||=()=>ut(`preview`),onMouseenter:t[1]||=e=>V(e,f(b)(`common.preview`)||`Preview`),onFocus:t[2]||=e=>V(e,f(b)(`common.preview`)||`Preview`),onMouseleave:H,onBlur:H},[l(`div`,je,[t[22]||=l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),l(`circle`,{cx:`12`,cy:`12`,r:`3`})])],-1),l(`span`,null,m(f(b)(`common.preview`)||`Preview`),1)])],42,Ae),l(`button`,{class:p([`infographic-mode-btn px-2 py-0.5 rounded transition-colors`,[T.value?`is-active`:``]]),onClick:t[3]||=()=>ut(`source`),onMouseenter:t[4]||=e=>V(e,f(b)(`common.source`)||`Source`),onFocus:t[5]||=e=>V(e,f(b)(`common.source`)||`Source`),onMouseleave:H,onBlur:H},[l(`div`,Me,[t[23]||=l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m16 18l6-6l-6-6M8 6l-6 6l6 6`})],-1),l(`span`,null,m(f(b)(`common.source`)||`Source`),1)])],34)])):c(``,!0),e.$slots[`header-right`]?(n(),h(`div`,Ne,[le(e.$slots,`header-right`,{},void 0,!0)])):(n(),h(`div`,Pe,[y.showCollapseButton?(n(),h(`button`,{key:0,class:p(v),"aria-pressed":S.value,onClick:t[6]||=e=>S.value=!S.value,onMouseenter:t[7]||=e=>V(e,S.value?f(b)(`common.expand`)||`Expand`:f(b)(`common.collapse`)||`Collapse`),onFocus:t[8]||=e=>V(e,S.value?f(b)(`common.expand`)||`Expand`:f(b)(`common.collapse`)||`Collapse`),onMouseleave:H,onBlur:H},[(n(),h(`svg`,{style:ie({rotate:S.value?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[...t[24]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m9 18l6-6l-6-6`},null,-1)]],4))],40,Fe)):c(``,!0),y.showCopyButton?(n(),h(`button`,{key:1,class:p(v),onClick:lt,onMouseenter:t[9]||=e=>ct(e),onFocus:t[10]||=e=>ct(e),onMouseleave:H,onBlur:H},[x.value?(n(),h(`svg`,Le,[...t[26]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M20 6L9 17l-5-5`},null,-1)]])):(n(),h(`svg`,Ie,[...t[25]||=[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),l(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})],-1)]]))],32)):c(``,!0),y.showExportButton?(n(),h(`button`,{key:2,class:p(`${v} ${$.value?`opacity-50 cursor-not-allowed`:``}`),disabled:$.value,onClick:dt,onMouseenter:t[11]||=e=>V(e,f(b)(`common.export`)||`Export`),onFocus:t[12]||=e=>V(e,f(b)(`common.export`)||`Export`),onMouseleave:H,onBlur:H},[...t[27]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`path`,{d:`M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),l(`path`,{d:`m7 10l5 5l5-5`})])],-1)]],42,Re)):c(``,!0),y.showFullscreenButton?(n(),h(`button`,{key:3,class:p(`${v} ${$.value?`opacity-50 cursor-not-allowed`:``}`),disabled:$.value,onClick:mt,onMouseenter:t[13]||=e=>V(e,E.value?f(b)(`common.minimize`)||`Minimize`:f(b)(`common.open`)||`Open`),onFocus:t[14]||=e=>V(e,E.value?f(b)(`common.minimize`)||`Minimize`:f(b)(`common.open`)||`Open`),onMouseleave:H,onBlur:H},[E.value?(n(),h(`svg`,Ve,[...t[29]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`},null,-1)]])):(n(),h(`svg`,Be,[...t[28]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`},null,-1)]]))],42,ze)):c(``,!0)]))])):c(``,!0),r(l(`div`,null,[T.value?(n(),h(`div`,He,[l(`pre`,Ue,m(F.value),1)])):(n(),h(`div`,We,[y.showZoomControls?(n(),h(`div`,Ge,[l(`div`,Ke,[l(`button`,{class:`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,onClick:ht,onMouseenter:t[15]||=e=>V(e,f(b)(`common.zoomIn`)||`Zoom in`),onFocus:t[16]||=e=>V(e,f(b)(`common.zoomIn`)||`Zoom in`),onMouseleave:H,onBlur:H},[...t[30]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`circle`,{cx:`11`,cy:`11`,r:`8`}),l(`path`,{d:`m21 21l-4.35-4.35M11 8v6m-3-3h6`})])],-1)]],32),l(`button`,{class:`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,onClick:gt,onMouseenter:t[17]||=e=>V(e,f(b)(`common.zoomOut`)||`Zoom out`),onFocus:t[18]||=e=>V(e,f(b)(`common.zoomOut`)||`Zoom out`),onMouseleave:H,onBlur:H},[...t[31]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`circle`,{cx:`11`,cy:`11`,r:`8`}),l(`path`,{d:`m21 21l-4.35-4.35M8 11h6`})])],-1)]],32),l(`button`,{class:`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,onClick:_t,onMouseenter:t[19]||=e=>V(e,f(b)(`common.resetZoom`)||`Reset zoom`),onFocus:t[20]||=e=>V(e,f(b)(`common.resetZoom`)||`Reset zoom`),onMouseleave:H,onBlur:H},m(Math.round(100*I.value))+`% `,33)])])):c(``,!0),l(`div`,{class:`infographic-preview relative transition-all overflow-hidden block`,style:ie({height:rt.value}),onMousedown:U,onMousemove:W,onMouseup:G,onMouseleave:G,onTouchstartPassive:U,onTouchmovePassive:W,onTouchendPassive:G},[k.value||A.value?c(``,!0):(n(),h(`pre`,qe,m(F.value),1)),l(`div`,{class:p([`absolute inset-0 cursor-grab`,{"cursor-grabbing":z.value}]),style:ie(Ct.value)},[l(`div`,{ref_key:`infographicContainer`,ref:w,class:`w-full text-center flex items-center justify-center min-h-full`},null,512)],6)],36)]))],512),[[ee,!S.value]]),(n(),ne(te,{to:`body`},[l(`div`,{class:p([`markstream-vue`,{dark:y.isDark}])},[o(ae,{name:`infographic-dialog`,appear:``},{default:oe(()=>[E.value?(n(),h(`div`,{key:0,class:`infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4`,onClick:se(pt,[`self`])},[l(`div`,Je,[l(`div`,Ye,[l(`button`,{class:`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,onClick:ht},[...t[32]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`circle`,{cx:`11`,cy:`11`,r:`8`}),l(`path`,{d:`m21 21l-4.35-4.35M11 8v6m-3-3h6`})])],-1)]]),l(`button`,{class:`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,onClick:gt},[...t[33]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`circle`,{cx:`11`,cy:`11`,r:`8`}),l(`path`,{d:`m21 21l-4.35-4.35M8 11h6`})])],-1)]]),l(`button`,{class:`infographic-action-btn p-[var(--ms-action-btn-padding)] rounded`,onClick:_t},m(Math.round(100*I.value))+`% `,1),l(`button`,{class:`infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded`,onClick:pt},[...t[34]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M18 6L6 18M6 6l12 12`})],-1)]])]),l(`div`,{ref_key:`modalContent`,ref:D,class:p([`w-full h-full flex items-center justify-center p-4 overflow-hidden`,{"cursor-grab":!z.value,"cursor-grabbing":z.value}]),onMousedown:U,onMousemove:W,onMouseup:G,onMouseleave:G,onTouchstartPassive:U,onTouchmovePassive:W,onTouchendPassive:G},null,34)])])):c(``,!0)]),_:1})],2)]))],10,Ce))}}),[[`__scopeId`,`data-v-de34ec4b`]]);y.install=e=>{e.component(y.__name,y)};export{y as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index11-BMhFgxFV.js b/apps/pythinker-code/dist-web/assets/index11-BLu1h3am.js similarity index 99% rename from apps/pythinker-code/dist-web/assets/index11-BMhFgxFV.js rename to apps/pythinker-code/dist-web/assets/index11-BLu1h3am.js index a0a40d65d..420d9abc2 100644 --- a/apps/pythinker-code/dist-web/assets/index11-BMhFgxFV.js +++ b/apps/pythinker-code/dist-web/assets/index11-BLu1h3am.js @@ -1,4 +1,4 @@ -import{A as e,G as t,H as n,I as r,J as i,N as a,O as o,P as s,S as c,U as l,_ as u,c as ee,f as te,g as ne,h as d,j as re,k as ie,lt as ae,m as f,n as oe,nt as p,ot as m,q as se,st as h,u as ce,ut as le,v as g,w as ue,z as de}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{F as fe,L as pe,N as me,P as he,R as ge,V as _e,_ as ve,a as ye,d as be,et as xe,h as Se,j as Ce,n as we,p as Te,rt as Ee,v as De,x as Oe,z as ke}from"./index-DAFMRqR8.js";function _(e,t){return/(?:&#\d+|#\d+|&[a-z]+)$/i.test(e.slice(Math.max(0,t-12),t))}function Ae(e){return e.includes(`->`)||e.includes(`-->`)||e.includes(`->>`)||e.includes(`-->>`)||e.includes(`-x`)||e.includes(`--x`)||e.includes(`-)`)||e.includes(`--)`)||e.includes(`-+`)||e.includes(`--+`)}function je(e){let t=e.trimStart();return/^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\b/i.test(t)||function(e){let t=e.split(`;`,1)[0],n=t.indexOf(`:`);return n>0&&Ae(t.slice(0,n))}(t)}function v(e){if(!e.includes(`;`))return e;let t=e.indexOf(`:`);if(t===-1||!function(e,t){let n=e.slice(0,t);return/^\s*Note\b/i.test(n)||Ae(n)}(e,t))return e;let n=e.slice(0,t+1),r=e.slice(t+1),i=function(e){let t=``,n=!1;for(let r=0;rt in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ve=(e,t)=>{for(var n in t||={})Le.call(t,n)&&Be(e,n,t[n]);if(Ie)for(var n of Ie(t))Re.call(t,n)&&Be(e,n,t[n]);return e},y=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),He=[`data-markstream-mode`,`data-markstream-pending`],Ue={key:0,class:`mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]`},We={key:0},Ge={key:1,class:`flex items-center gap-x-2 overflow-hidden`},Ke=[`innerHTML`],qe={key:2},Je={key:3,class:`mermaid-mode-toggle-group flex items-center gap-0.5`},Ye={class:`flex items-center gap-x-1`},Xe={class:`flex items-center gap-x-1`},Ze={key:4},Qe={key:5,class:`mermaid-header-actions flex items-center`},$e=[`aria-pressed`],et={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},tt={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},nt=[`aria-label`,`disabled`],rt=[`aria-label`,`disabled`],it={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},at={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},ot={key:0,class:`mermaid-source-panel`},st={class:`mermaid-source-code text-sm font-mono whitespace-pre-wrap`},ct={key:1,class:`relative`},lt={key:0,class:`absolute top-2 right-2 z-10 rounded-lg`},ut={class:`flex items-center gap-2 backdrop-blur rounded-lg`},dt={class:`dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden`},ft={class:`absolute top-6 right-6 z-50 flex items-center gap-2`},pt=`mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded`,b=ve(ue({__name:`MermaidBlockNode`,props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:[`copy`,`export`,`openModal`,`toggleMode`],setup(ue,{emit:ve}){let _=ue,Ae=ve,je={USE_PROFILES:{svg:!0},FORBID_TAGS:[`script`],FORBID_ATTR:[/^on/i],ADD_TAGS:[`style`],ADD_ATTR:[`style`],SAFE_FOR_TEMPLATES:!0},v=p(!1),Ne=p(typeof window>`u`),Ie=De(),Le=Oe(),Re=f(()=>_.isStrict?`strict`:`loose`),Be=f(()=>({startOnLoad:!1,securityLevel:Re.value,dompurifyConfig:Re.value===`strict`?je:void 0,flowchart:Re.value===`strict`?{htmlLabels:!1}:void 0}));function b(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function mt(e,t,n={}){if(!e)return null;let r=function(e,t){if(!e)return null;let n=Ee(t);if(!n)return null;let r=function(e,t){let n=Array.from(e.childNodes),r=document.createElement(`div`);return r.dataset.mermaidSvgLayer=`1`,r.style.zIndex=`1`,r.appendChild(t),e.insertBefore(r,e.firstChild),n.length>0&&function(e){let t=()=>{var t;for(let n of e)(t=n.parentNode)==null||t.removeChild(n)};typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>{requestAnimationFrame(t)}):setTimeout(t,32)}(n),r}(e,n);return{svg:n.outerHTML,bindTarget:r}}(e,t);return r||n.keepPreviousOnFailure||b(e),r}let x=null;function ht(e){if(_.enableMermaidInteractions&&e?.querySelector(`svg`))try{x?.(e)}catch{}}let{t:S}=ye(),C=!1,gt=0;function _t(){return y(this,null,function*(){try{let e=yield fe();return C?null:(v.value=!!e,e)}catch(e){throw C||(v.value=!1),e}finally{C||(Ne.value=!0)}})}let vt=p(!1),w=p(!1),yt=p(),T=p(),E=p(),D=p(),bt=p(null),xt=Te(),St=p(null),Ct=p(typeof window>`u`||!Ie.value),wt=l(),Tt=o(xe,null),O=``,k=0,Et=0,Dt=f(()=>be(_,wt));function Ot(){let e=Dt.value;e&&(O&&O!==e&&(Tt?.markSettled(O),k=0),O=e,k+=1,Et+=1,k===1&&Tt?.markPending(e))}function kt(){return y(this,null,function*(){let t=O;if(!t||(k=Math.max(0,k-1),k>0))return;O=``;let n=++Et;yield e(),n===Et&&(function(e=Dt.value){e&&yt.value&&Tt?.reportHeight(e,yt.value.offsetHeight)}(t),Tt?.markSettled(t))})}function At(){let e=O;e&&(O=``,k=0,Et+=1,Tt?.markSettled(e))}let jt=p(),A=f(()=>_.node.code.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`));function Mt(e,t=A.value){let n=t,r={theme:e===`dark`?`dark`:`default`};Re.value===`strict`&&(r.flowchart={htmlLabels:!1});let i=`%%{init: ${JSON.stringify(r)}}%%\n`;return n.trim().startsWith(`%%{`)?n:i+n}function Nt(){return function(e){return pe(e,function(){return _e(T.value?getComputedStyle(T.value).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??360}(),Rn())}(_e(_.estimatedPreviewHeightPx)??ke(A.value))}function Pt(){return`${Nt()}px`}let Ft=p(null);function It(){return!!E.value?.querySelector(`svg`)}function Lt(){return!1!==_.loading&&(It()||!!Ft.value)}let j=p(1),M=p(0),N=p(0),Rt=p(!1),zt=p({x:0,y:0}),P=p(!0),Bt=p(!1),F=p(!1),I=p(null),Vt=``,Ht=!1,L=``,Ut=p(0),Wt=p(!1),Gt=f(()=>Math.max(0,_.renderDebounceMs??300)),Kt=f(()=>Math.max(0,_.contentStableDelayMs??500)),qt=f(()=>Math.max(120,_.previewPollDelayMs??800)),Jt=f(()=>Math.max(qt.value,_.previewPollMaxDelayMs??4e3)),Yt=f(()=>Math.max(1,Math.trunc(_.previewPollMaxAttempts??12))),R=f(()=>!1!==_.loading),Xt=null,Zt=null,Qt=null,$t=null,en=0,tn=globalThis.requestIdleCallback??((e,t)=>setTimeout(()=>e({didTimeout:!0}),16)),nn=globalThis.cancelIdleCallback??(e=>clearTimeout(e));function z(e=gt){return!C&&e===gt}function B(){return z()&&Ct.value&&!w.value}function rn(){Qt!=null&&(globalThis.clearTimeout(Qt),Qt=null),$t!=null&&(nn($t),$t=null)}function an(){C||Qt==null&&$t==null&&(Qt=globalThis.setTimeout(()=>{Qt=null,B()&&($t=tn(()=>{$t=null,B()&&or()},{timeout:500}))},Gt.value))}function on(){Zt!=null&&(globalThis.clearTimeout(Zt),Zt=null)}function sn(e=600){if(typeof globalThis>`u`||C)return;let t=Math.max(0,e);on(),Zt=globalThis.setTimeout(()=>{if(Zt=null,!C){if(_.loading||F.value||!B())return void sn(Math.min(1200,Math.max(300,1.2*t)));an()}},t)}let V=p(Pt()),cn=p(V.value),ln=null,H=p(!1),un=p(!1),U=p({}),W=p(0),G=null,dn=null,K=p(!1),fn=f(()=>!(w.value||P.value||Ne.value&&!F.value&&!I.value&&(H.value||K.value&&(E.value?.textContent)?.trim()))),pn=p({zoom:1,translateX:0,translateY:0,containerHeight:V.value}),mn=f(()=>_.enableWheelZoom?{wheel:Xn}:{}),q=f(()=>({worker:_.workerTimeoutMs??1400,parse:_.parseTimeoutMs??1800,render:_.renderTimeoutMs??2500,fullRender:_.fullRenderTimeoutMs??4e3})),hn=null,gn=null,_n=!1,vn=qt.value,J=null,yn=0,bn=!0,xn=0;function Sn(e,t){let n=t?.timeoutMs,r=t?.signal;if(r?.aborted)return Promise.reject(new DOMException(`Aborted`,`AbortError`));let i=null,a=!1,o=null;return new Promise((t,s)=>{let c=()=>{i!=null&&clearTimeout(i),o&&r&&r.removeEventListener(`abort`,o)};n&&n>0&&(i=globalThis.setTimeout(()=>{a||(a=!0,c(),s(Error(`Operation timed out`)))},n)),r&&(o=()=>{a||(a=!0,c(),s(new DOMException(`Aborted`,`AbortError`)))},r.addEventListener(`abort`,o)),e().then(e=>{a||(a=!0,c(),t(e))}).catch(e=>{a||(a=!0,c(),s(e))})})}function Cn(e){if(typeof document>`u`||!E.value)return;if(typeof _.onRenderError==`function`&&!0===_.onRenderError(e,A.value,E.value))return K.value=!0,void $();let t=document.createElement(`div`);t.style.padding=`var(--ms-inset-panel-body)`,t.style.color=`hsl(var(--ms-destructive))`,t.textContent=`Failed to render diagram: `;let n=document.createElement(`span`);n.textContent=e instanceof Error?e.message:`Unknown error`,t.appendChild(n),b(E.value),E.value.appendChild(t),V.value=(E.value?getComputedStyle(E.value).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)||`360px`,cn.value=V.value,K.value=!0,$()}function wn(e){let t=typeof e==`string`?e:typeof e?.message==`string`?e.message:``;return typeof t==`string`&&/timed out/i.test(t)}function Tn(e){return e?.name===`AbortError`}function En(e){return!wn(e)&&!Tn(e)}typeof window<`u`&&t([()=>yt.value,Ie],([e,t])=>{var n;if((n=St.value)==null||n.destroy(),St.value=null,!t||Ct.value)return void(Ct.value=!0);if(!e)return void(Ct.value=!1);let r=xt(e,{rootMargin:Le?.value.heavyBlockMargin,allowIdle:!1});St.value=r,Ct.value=r.isVisible.value,r.whenVisible.then(()=>{Ct.value=!0})},{immediate:!0}),re(()=>{var e;C=!0,gt+=1,W.value+=1,(e=St.value)==null||e.destroy(),St.value=null,At(),rn()});let Dn=f(()=>!1!==_.showTooltips);function On(e){return!e||e.disabled}function Y(e,t,n=`top`){if(!Dn.value||On(e.currentTarget))return;let r=e,i=r?.clientX!=null&&r?.clientY!=null?{x:r.clientX,y:r.clientY}:void 0;Se(e.currentTarget,t,n,!1,i,_.isDark)}function X(){Dn.value&&we()}function kn(e){if(!Dn.value||On(e.currentTarget))return;let t=vt.value?S(`common.copied`)||`Copied`:S(`common.copy`)||`Copy`,n=e,r=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;Se(e.currentTarget,t,`top`,!1,r,_.isDark)}function An(e,t){let n={theme:t===`dark`?`dark`:`default`};Re.value===`strict`&&(n.flowchart={htmlLabels:!1});let r=`%%{init: ${JSON.stringify(n)}}%%\n`;return e.trimStart().startsWith(`%%{`)?e:r+e}function jn(){return bn&&!P.value&&!H.value&&!K.value}function Mn(e){let t=e.trim();return!(!t||t.startsWith(`%%`))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(`:`)}function Nn(e){if(ge(e)===`gantt`)return function(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(e&&!e.startsWith(`%%`)){if(Mn(e))break;t.pop()}else t.pop()}return t.some(Mn)?t.join(` +import{A as e,G as t,H as n,I as r,J as i,N as a,O as o,P as s,S as c,U as l,_ as u,c as ee,f as te,g as ne,h as d,j as re,k as ie,lt as ae,m as f,n as oe,nt as p,ot as m,q as se,st as h,u as ce,ut as le,v as g,w as ue,z as de}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{F as fe,L as pe,N as me,P as he,R as ge,V as _e,_ as ve,a as ye,d as be,et as xe,h as Se,j as Ce,n as we,p as Te,rt as Ee,v as De,x as Oe,z as ke}from"./index-CJN6blp7.js";function _(e,t){return/(?:&#\d+|#\d+|&[a-z]+)$/i.test(e.slice(Math.max(0,t-12),t))}function Ae(e){return e.includes(`->`)||e.includes(`-->`)||e.includes(`->>`)||e.includes(`-->>`)||e.includes(`-x`)||e.includes(`--x`)||e.includes(`-)`)||e.includes(`--)`)||e.includes(`-+`)||e.includes(`--+`)}function je(e){let t=e.trimStart();return/^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\b/i.test(t)||function(e){let t=e.split(`;`,1)[0],n=t.indexOf(`:`);return n>0&&Ae(t.slice(0,n))}(t)}function v(e){if(!e.includes(`;`))return e;let t=e.indexOf(`:`);if(t===-1||!function(e,t){let n=e.slice(0,t);return/^\s*Note\b/i.test(n)||Ae(n)}(e,t))return e;let n=e.slice(0,t+1),r=e.slice(t+1),i=function(e){let t=``,n=!1;for(let r=0;rt in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ve=(e,t)=>{for(var n in t||={})Le.call(t,n)&&Be(e,n,t[n]);if(Ie)for(var n of Ie(t))Re.call(t,n)&&Be(e,n,t[n]);return e},y=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),He=[`data-markstream-mode`,`data-markstream-pending`],Ue={key:0,class:`mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]`},We={key:0},Ge={key:1,class:`flex items-center gap-x-2 overflow-hidden`},Ke=[`innerHTML`],qe={key:2},Je={key:3,class:`mermaid-mode-toggle-group flex items-center gap-0.5`},Ye={class:`flex items-center gap-x-1`},Xe={class:`flex items-center gap-x-1`},Ze={key:4},Qe={key:5,class:`mermaid-header-actions flex items-center`},$e=[`aria-pressed`],et={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},tt={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},nt=[`aria-label`,`disabled`],rt=[`aria-label`,`disabled`],it={key:0,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},at={key:1,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},ot={key:0,class:`mermaid-source-panel`},st={class:`mermaid-source-code text-sm font-mono whitespace-pre-wrap`},ct={key:1,class:`relative`},lt={key:0,class:`absolute top-2 right-2 z-10 rounded-lg`},ut={class:`flex items-center gap-2 backdrop-blur rounded-lg`},dt={class:`dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden`},ft={class:`absolute top-6 right-6 z-50 flex items-center gap-2`},pt=`mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded`,b=ve(ue({__name:`MermaidBlockNode`,props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:[`copy`,`export`,`openModal`,`toggleMode`],setup(ue,{emit:ve}){let _=ue,Ae=ve,je={USE_PROFILES:{svg:!0},FORBID_TAGS:[`script`],FORBID_ATTR:[/^on/i],ADD_TAGS:[`style`],ADD_ATTR:[`style`],SAFE_FOR_TEMPLATES:!0},v=p(!1),Ne=p(typeof window>`u`),Ie=De(),Le=Oe(),Re=f(()=>_.isStrict?`strict`:`loose`),Be=f(()=>({startOnLoad:!1,securityLevel:Re.value,dompurifyConfig:Re.value===`strict`?je:void 0,flowchart:Re.value===`strict`?{htmlLabels:!1}:void 0}));function b(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function mt(e,t,n={}){if(!e)return null;let r=function(e,t){if(!e)return null;let n=Ee(t);if(!n)return null;let r=function(e,t){let n=Array.from(e.childNodes),r=document.createElement(`div`);return r.dataset.mermaidSvgLayer=`1`,r.style.zIndex=`1`,r.appendChild(t),e.insertBefore(r,e.firstChild),n.length>0&&function(e){let t=()=>{var t;for(let n of e)(t=n.parentNode)==null||t.removeChild(n)};typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>{requestAnimationFrame(t)}):setTimeout(t,32)}(n),r}(e,n);return{svg:n.outerHTML,bindTarget:r}}(e,t);return r||n.keepPreviousOnFailure||b(e),r}let x=null;function ht(e){if(_.enableMermaidInteractions&&e?.querySelector(`svg`))try{x?.(e)}catch{}}let{t:S}=ye(),C=!1,gt=0;function _t(){return y(this,null,function*(){try{let e=yield fe();return C?null:(v.value=!!e,e)}catch(e){throw C||(v.value=!1),e}finally{C||(Ne.value=!0)}})}let vt=p(!1),w=p(!1),yt=p(),T=p(),E=p(),D=p(),bt=p(null),xt=Te(),St=p(null),Ct=p(typeof window>`u`||!Ie.value),wt=l(),Tt=o(xe,null),O=``,k=0,Et=0,Dt=f(()=>be(_,wt));function Ot(){let e=Dt.value;e&&(O&&O!==e&&(Tt?.markSettled(O),k=0),O=e,k+=1,Et+=1,k===1&&Tt?.markPending(e))}function kt(){return y(this,null,function*(){let t=O;if(!t||(k=Math.max(0,k-1),k>0))return;O=``;let n=++Et;yield e(),n===Et&&(function(e=Dt.value){e&&yt.value&&Tt?.reportHeight(e,yt.value.offsetHeight)}(t),Tt?.markSettled(t))})}function At(){let e=O;e&&(O=``,k=0,Et+=1,Tt?.markSettled(e))}let jt=p(),A=f(()=>_.node.code.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`));function Mt(e,t=A.value){let n=t,r={theme:e===`dark`?`dark`:`default`};Re.value===`strict`&&(r.flowchart={htmlLabels:!1});let i=`%%{init: ${JSON.stringify(r)}}%%\n`;return n.trim().startsWith(`%%{`)?n:i+n}function Nt(){return function(e){return pe(e,function(){return _e(T.value?getComputedStyle(T.value).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??360}(),Rn())}(_e(_.estimatedPreviewHeightPx)??ke(A.value))}function Pt(){return`${Nt()}px`}let Ft=p(null);function It(){return!!E.value?.querySelector(`svg`)}function Lt(){return!1!==_.loading&&(It()||!!Ft.value)}let j=p(1),M=p(0),N=p(0),Rt=p(!1),zt=p({x:0,y:0}),P=p(!0),Bt=p(!1),F=p(!1),I=p(null),Vt=``,Ht=!1,L=``,Ut=p(0),Wt=p(!1),Gt=f(()=>Math.max(0,_.renderDebounceMs??300)),Kt=f(()=>Math.max(0,_.contentStableDelayMs??500)),qt=f(()=>Math.max(120,_.previewPollDelayMs??800)),Jt=f(()=>Math.max(qt.value,_.previewPollMaxDelayMs??4e3)),Yt=f(()=>Math.max(1,Math.trunc(_.previewPollMaxAttempts??12))),R=f(()=>!1!==_.loading),Xt=null,Zt=null,Qt=null,$t=null,en=0,tn=globalThis.requestIdleCallback??((e,t)=>setTimeout(()=>e({didTimeout:!0}),16)),nn=globalThis.cancelIdleCallback??(e=>clearTimeout(e));function z(e=gt){return!C&&e===gt}function B(){return z()&&Ct.value&&!w.value}function rn(){Qt!=null&&(globalThis.clearTimeout(Qt),Qt=null),$t!=null&&(nn($t),$t=null)}function an(){C||Qt==null&&$t==null&&(Qt=globalThis.setTimeout(()=>{Qt=null,B()&&($t=tn(()=>{$t=null,B()&&or()},{timeout:500}))},Gt.value))}function on(){Zt!=null&&(globalThis.clearTimeout(Zt),Zt=null)}function sn(e=600){if(typeof globalThis>`u`||C)return;let t=Math.max(0,e);on(),Zt=globalThis.setTimeout(()=>{if(Zt=null,!C){if(_.loading||F.value||!B())return void sn(Math.min(1200,Math.max(300,1.2*t)));an()}},t)}let V=p(Pt()),cn=p(V.value),ln=null,H=p(!1),un=p(!1),U=p({}),W=p(0),G=null,dn=null,K=p(!1),fn=f(()=>!(w.value||P.value||Ne.value&&!F.value&&!I.value&&(H.value||K.value&&(E.value?.textContent)?.trim()))),pn=p({zoom:1,translateX:0,translateY:0,containerHeight:V.value}),mn=f(()=>_.enableWheelZoom?{wheel:Xn}:{}),q=f(()=>({worker:_.workerTimeoutMs??1400,parse:_.parseTimeoutMs??1800,render:_.renderTimeoutMs??2500,fullRender:_.fullRenderTimeoutMs??4e3})),hn=null,gn=null,_n=!1,vn=qt.value,J=null,yn=0,bn=!0,xn=0;function Sn(e,t){let n=t?.timeoutMs,r=t?.signal;if(r?.aborted)return Promise.reject(new DOMException(`Aborted`,`AbortError`));let i=null,a=!1,o=null;return new Promise((t,s)=>{let c=()=>{i!=null&&clearTimeout(i),o&&r&&r.removeEventListener(`abort`,o)};n&&n>0&&(i=globalThis.setTimeout(()=>{a||(a=!0,c(),s(Error(`Operation timed out`)))},n)),r&&(o=()=>{a||(a=!0,c(),s(new DOMException(`Aborted`,`AbortError`)))},r.addEventListener(`abort`,o)),e().then(e=>{a||(a=!0,c(),t(e))}).catch(e=>{a||(a=!0,c(),s(e))})})}function Cn(e){if(typeof document>`u`||!E.value)return;if(typeof _.onRenderError==`function`&&!0===_.onRenderError(e,A.value,E.value))return K.value=!0,void $();let t=document.createElement(`div`);t.style.padding=`var(--ms-inset-panel-body)`,t.style.color=`hsl(var(--ms-destructive))`,t.textContent=`Failed to render diagram: `;let n=document.createElement(`span`);n.textContent=e instanceof Error?e.message:`Unknown error`,t.appendChild(n),b(E.value),E.value.appendChild(t),V.value=(E.value?getComputedStyle(E.value).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)||`360px`,cn.value=V.value,K.value=!0,$()}function wn(e){let t=typeof e==`string`?e:typeof e?.message==`string`?e.message:``;return typeof t==`string`&&/timed out/i.test(t)}function Tn(e){return e?.name===`AbortError`}function En(e){return!wn(e)&&!Tn(e)}typeof window<`u`&&t([()=>yt.value,Ie],([e,t])=>{var n;if((n=St.value)==null||n.destroy(),St.value=null,!t||Ct.value)return void(Ct.value=!0);if(!e)return void(Ct.value=!1);let r=xt(e,{rootMargin:Le?.value.heavyBlockMargin,allowIdle:!1});St.value=r,Ct.value=r.isVisible.value,r.whenVisible.then(()=>{Ct.value=!0})},{immediate:!0}),re(()=>{var e;C=!0,gt+=1,W.value+=1,(e=St.value)==null||e.destroy(),St.value=null,At(),rn()});let Dn=f(()=>!1!==_.showTooltips);function On(e){return!e||e.disabled}function Y(e,t,n=`top`){if(!Dn.value||On(e.currentTarget))return;let r=e,i=r?.clientX!=null&&r?.clientY!=null?{x:r.clientX,y:r.clientY}:void 0;Se(e.currentTarget,t,n,!1,i,_.isDark)}function X(){Dn.value&&we()}function kn(e){if(!Dn.value||On(e.currentTarget))return;let t=vt.value?S(`common.copied`)||`Copied`:S(`common.copy`)||`Copy`,n=e,r=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;Se(e.currentTarget,t,`top`,!1,r,_.isDark)}function An(e,t){let n={theme:t===`dark`?`dark`:`default`};Re.value===`strict`&&(n.flowchart={htmlLabels:!1});let r=`%%{init: ${JSON.stringify(n)}}%%\n`;return e.trimStart().startsWith(`%%{`)?e:r+e}function jn(){return bn&&!P.value&&!H.value&&!K.value}function Mn(e){let t=e.trim();return!(!t||t.startsWith(`%%`))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(`:`)}function Nn(e){if(ge(e)===`gantt`)return function(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(e&&!e.startsWith(`%%`)){if(Mn(e))break;t.pop()}else t.pop()}return t.some(Mn)?t.join(` `):``}(e);let t=e.split(/\r?\n/);for(;t.length>0;){let e=t[t.length-1].trimEnd();if(e!==``){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join(` `)}function Pn(e,t,n,r){return y(this,null,function*(){try{return yield Sn(()=>e.render(t,n),{timeoutMs:r})}catch(i){if(!En(i))throw i;let a=Me(n);if(a===n)throw i;try{return yield Sn(()=>e.render(`${t}-retry`,a),{timeoutMs:r})}catch{throw i}}})}function Fn(e,t,n){return y(this,null,function*(){try{return yield me(e,t,n?.timeoutMs??q.value.worker,n?.signal)}catch(r){if(r?.name===`AbortError`)throw r;let i=r?.code||r?.name;if(i!==`WORKER_BUSY`&&i!==`WORKER_TIMEOUT`&&i!==`WORKER_INIT_ERROR`&&i!==`MERMAID_DISABLED`&&i!==`WORKER_REPLACED`||r?.fallbackToRenderer)return yield function(e,t,n){return y(this,null,function*(){let r=yield _t();if(!r)return;let i=r,a=An(e,t);if(typeof i.parse==`function`){try{yield Sn(()=>i.parse(a),{timeoutMs:n?.timeoutMs??q.value.parse,signal:n?.signal})}catch(e){if(!En(e))throw e;let t=Me(a);if(t===a)throw e;try{yield Sn(()=>i.parse(t),{timeoutMs:n?.timeoutMs??q.value.parse,signal:n?.signal})}catch{throw e}}return!0}let o=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;try{yield Sn(()=>r.render(o,a),{timeoutMs:n?.timeoutMs??q.value.render,signal:n?.signal})}catch(e){if(!En(e))throw e;let t=Me(a);if(t===a)throw e;try{yield Sn(()=>r.render(`${o}-retry`,t),{timeoutMs:n?.timeoutMs??q.value.render,signal:n?.signal})}catch{throw e}}return!0})}(e,t,n);throw r}})}function In(e,t,n){return y(this,null,function*(){if(ge(e)===`gantt`){let r=Nn(e);if(!r.trim())return{fullOk:!1,prefixOk:!1};try{if(yield Fn(r,t,n))return r===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:r}}catch(e){if(e?.name===`AbortError`)throw e}return{fullOk:!1,prefixOk:!1}}try{if(yield Fn(e,t,n))return{fullOk:!0,prefixOk:!1}}catch(e){if(e?.name===`AbortError`)throw e}let r=Nn(e);if(r&&r.trim()&&r!==e)try{try{let i=yield he(e,t,n?.timeoutMs??q.value.worker,n?.signal);i&&i.trim()&&(r=i)}catch{}if(yield Fn(r,t,n))return{fullOk:!1,prefixOk:!0,prefix:r}}catch(e){if(e?.name===`AbortError`)throw e}return{fullOk:!1,prefixOk:!1}})}let Ln=f(()=>P.value||F.value||w.value);function Rn(){if(_.maxHeight===`none`)return null;if(_.maxHeight!=null){let e=Number.parseFloat(String(_.maxHeight));if(Number.isFinite(e))return e}let e=T.value;if(e){let t=getComputedStyle(e).getPropertyValue(`--ms-size-code-max-height`).trim(),n=Number.parseFloat(t);if(Number.isFinite(n))return n}return 500}function zn(e,t){if(!T.value||!E.value)return;let n=!t?.force&&!1!==_.loading&&It(),r=E.value.querySelector(`svg`);if(!r)return;let i=0,a=0,o=r.getAttribute(`viewBox`),s=r.getAttribute(`width`),c=r.getAttribute(`height`);if(o){let e=o.split(` `);e.length===4&&(i=Number.parseFloat(e[2]),a=Number.parseFloat(e[3]))}if(i&&a||s&&c&&(i=Number.parseFloat(s),a=Number.parseFloat(c)),Number.isNaN(i)||Number.isNaN(a)||i<=0||a<=0)try{let e=r.getBBox();e&&e.width>0&&e.height>0&&(i=e.width,a=e.height)}catch(e){console.error(`Failed to get SVG BBox:`,e);return}if(i>0&&a>0){let t=a/i,o=e??T.value.clientWidth,s=r.getBoundingClientRect().width,c=s>0?s:o,l=Rn(),u=c*t,ee=Math.max(l==null?u:Math.min(u,l),Nt());cn.value=`${Math.max(u,ee)}px`,n||_e(_.estimatedPreviewHeightPx)!=null||(V.value=`${ee}px`)}}let Z=p(!1),Bn=f(()=>({transform:`translate(${M.value}px, ${N.value}px) scale(${j.value})`}));function Vn(e){e.key===`Escape`&&Z.value&&Un()}function Hn(){if(!T.value||!D.value)return!1;if(D.value.firstElementChild?.getAttribute(`data-mermaid-modal-clone`)===`1`)return!0;let e=T.value.cloneNode(!0);e.dataset.mermaidModalClone=`1`,e.classList.add(`fullscreen`),e.style.height=`100%`,e.style.maxHeight=`100%`;let t=e.querySelector(`._mermaid`);t&&(t.style.contain=`none`,t.style.contentVisibility=`visible`);let n=e.querySelector(`[data-mermaid-wrapper]`);return n&&(bt.value=n,n.style.transform=Bn.value.transform),b(D.value),D.value.appendChild(e),ht(e),!0}function Un(){if(Z.value=!1,D.value&&b(D.value),bt.value=null,typeof document<`u`)try{document.body.style.overflow=``}catch{}if(typeof window<`u`)try{window.removeEventListener(`keydown`,Vn)}catch{}}function Wn(){j.value<3&&(j.value+=.1)}function Gn(){j.value>.5&&(j.value-=.1)}function Kn(){j.value=1,M.value=0,N.value=0}function qn(e){Rt.value=!0,e instanceof MouseEvent?zt.value={x:e.clientX-M.value,y:e.clientY-N.value}:zt.value={x:e.touches[0].clientX-M.value,y:e.touches[0].clientY-N.value}}function Jn(e){if(!Rt.value)return;let t,n;e instanceof MouseEvent?(t=e.clientX,n=e.clientY):(t=e.touches[0].clientX,n=e.touches[0].clientY),M.value=t-zt.value.x,N.value=n-zt.value.y}function Yn(){Rt.value=!1}function Xn(e){if(_.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!T.value)return;let t=T.value.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=n-t.width/2,a=r-t.height/2,o=(i-M.value)/j.value,s=(a-N.value)/j.value,c=-e.deltaY*.01,l=Math.min(Math.max(j.value+c,.5),3);l!==j.value&&(M.value=i-o*l,N.value=a-s*l,j.value=l)}}function Zn(){return y(this,null,function*(){try{let e=A.value,t={payload:{type:`copy`,text:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(Ae(`copy`,t),t.defaultPrevented)return;typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),vt.value=!0,setTimeout(()=>{vt.value=!1},1e3)}catch(e){console.error(`Failed to copy:`,e)}})}function Qn(){let e=E.value?.querySelector(`svg`);if(!e)return void console.error(`SVG element not found`);let t=new XMLSerializer().serializeToString(e),n={payload:{type:`export`},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:e,svgString:t};Ae(`export`,n),n.defaultPrevented||function(e,t=null){y(this,null,function*(){try{let n=t??new XMLSerializer().serializeToString(e),r=new Blob([n],{type:`image/svg+xml;charset=utf-8`}),i=URL.createObjectURL(r);if(typeof document<`u`){let e=document.createElement(`a`);e.href=i,e.download=`mermaid-diagram-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}URL.revokeObjectURL(i)}}catch(e){console.error(`Failed to export SVG:`,e)}})}(e,t)}function $n(){let t=E.value?.querySelector(`svg`)??null,n={payload:{type:`open-modal`},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:t,svgString:t?new XMLSerializer().serializeToString(t):null};Ae(`openModal`,n),n.defaultPrevented||function(){if(Z.value=!0,typeof document<`u`)try{document.body.style.overflow=`hidden`}catch{}if(typeof window<`u`)try{window.addEventListener(`keydown`,Vn)}catch{}e(()=>{Hn()||e(Hn)})}()}function er(e){let t={payload:{type:`toggle-mode`,target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};Ae(`toggleMode`,e,t),t.defaultPrevented||tr(e)}function tr(t){return y(this,null,function*(){let n=jt.value;if(!n)return Bt.value=!0,void(P.value=t===`source`);let r=n.getBoundingClientRect().height;n.style.height=`${r}px`,n.style.overflow=`hidden`,Bt.value=!0,P.value=t===`source`,yield e();let i=n.scrollHeight;n.style.transition=`height var(--ms-duration-standard) var(--ms-ease-standard)`,n.offsetHeight,n.style.height=`${i}px`;let a=()=>{n.style.transition=``,n.style.height=``,n.style.overflow=``,n.removeEventListener(`transitionend`,o)};function o(){a()}n.addEventListener(`transitionend`,o),setTimeout(()=>a(),220)})}function Q(e=A.value,t=_.isDark?`dark`:`light`,n=!1===_.loading){return{code:e,codeWithTheme:Mt(t,e),final:n,signature:`${t}\0${e}`,theme:t}}function nr(e){return e.signature===Q().signature}function rr(){return y(this,arguments,function*(t=Q()){let n=gt;if(!z(n)||!nr(t))return!1;if(F.value){let e=I.value,r=Ht,i=Vt;if(!e)return!1;let a=yield e;return!(!z(n)||!nr(t))&&(i===t.signature?!(!a||L!==t.signature)||!(!t.final||!1!==_.loading||r)&&rr(t):rr(t))}if(!E.value){if(yield e(),!z(n))return!1;if(!E.value)return console.warn(`Mermaid container not ready`),!1}return!(!z(n)||!nr(t))&&(F.value=!0,Ht=t.final,Vt=t.signature,Ot(),I.value=y(null,null,function*(){var e,r,i;try{let a=yield _t();if(!z(n)||!a)return!1;let o=`mermaid-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;H.value||un.value||(e=a.initialize)==null||e.call(a,(r=Ve({},Be.value),i={dompurifyConfig:Ve({},je)},Pe(r,Fe(i))));let s=yield Pn(a,o,t.codeWithTheme,q.value.fullRender);if(!z(n)||!function(e){return nr(e)||!e.final&&!1!==_.loading&&A.value.startsWith(e.code)}(t))return un.value&&=!1,!1;if(!E.value)return!1;let c=mt(E.value,s?.svg,{keepPreviousOnFailure:!t.final||!1!==_.loading});if(!c)return un.value&&=!1,!1;let l=s?.bindFunctions??null;return x=l,ht(c.bindTarget),H.value||un.value||(Ce(()=>zn()),H.value=!0,pn.value={zoom:j.value,translateX:M.value,translateY:N.value,containerHeight:V.value}),U.value[t.theme]={svg:c.svg,bindFunctions:l},un.value&&=!1,L=t.signature,Ft.value=E.value.innerHTML,K.value=!1,en=0,on(),!0}catch(e){if(!z(n)||!nr(t))return un.value&&=!1,!1;let r=wn(e),i=en+1;return r&&i<=3?(en=i,sn(Math.min(1200,600*i))):(en=0,on(),t.final&&!1===_.loading&&console.error(`Failed to render mermaid diagram:`,e),t.final&&!1===_.loading&&Cn(e)),!1}finally{Ht=!1,Vt=``,F.value=!1,I.value=null,z(n)&&kt()}}),I.value)})}function ir(){return y(this,null,function*(){var e;let t=A.value;if(!t.trim()){if(Lt())return;E.value&&b(E.value),Ft.value=null,L=``,K.value=!1;return}if(!v.value||!B())return;let n=Q(t);H.value&&n.signature===L&&(e=E.value)!=null&&e.querySelector(`svg`)||(yield rr(n))&&(K.value=!1)})}function ar(t,n,r,i){return y(this,null,function*(){let a=gt;if(!z(a)||!jn()||!E.value&&(yield e(),!z(a)||!E.value)||F.value)return;F.value=!0,Ot();let o=Q(n,r),s=y(null,null,function*(){try{let e=yield _t();if(!z(a)||!e)return!1;let n=`mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,s=Nn(t),c=yield Pn(e,n,An(s&&s.trim()?s:t,r),q.value.render);if(!z(a)||W.value!==i||!1===_.loading||!jn()||!nr(o))return!1;let l=c?.svg;if(!E.value||!l)return!1;let u=mt(E.value,l,{keepPreviousOnFailure:!0});return!!u&&(x=c?.bindFunctions??null,ht(u.bindTarget),Ce(()=>zn()),!1)}catch{return!1}finally{I.value===s&&(F.value=!1,I.value=null),z(a)&&kt()}});return I.value=s,s})}function or(){return y(this,null,function*(){if(!B())return;let e=gt,t=Date.now(),n=++W.value;Ot();try{G&&G.abort(),G=new AbortController;let r=G.signal,i=_.isDark?`dark`:`light`,a=A.value;if(!a.trim()){if(Lt())return;E.value&&b(E.value),Ft.value=null,L=``,K.value=!1;return}if(Q(a,i).signature===L)return;try{let o=yield In(a,i,{signal:r,timeoutMs:q.value.worker});if(!z(e))return;if(o.fullOk){if(r.aborted||W.value!==n||!(yield rr(Q(a,i))))return;z(e)&&W.value===n&&(K.value=!1);return}let s=yn&&t<=yn;if(o.prefixOk&&o.prefix&&!r.aborted&&W.value===n&&jn()&&!s)return void(yield ar(o.prefix,a,i,n))}catch(e){if(e?.name===`AbortError`)return}if(!z(e)||W.value!==n||K.value)return;let o=U.value[i];if(o&&E.value){let e=mt(E.value,o.svg);e&&(x=o.bindFunctions??null,ht(e.bindTarget))}}finally{z(e)&&kt()}})}function $(){_n&&(_n=!1,vn=qt.value,bn=!1,J&&=(J.abort(),null),hn&&=(globalThis.clearTimeout(hn),null),gn&&=(nn(gn),null),yn=Date.now())}function sr(){if($(),rn(),G){try{G.abort()}catch{}G=null}if(J){try{J.abort()}catch{}J=null}on(),en=0}function cr(){dn?.abort(),dn=null}function lr(e=qt.value){_n&&(xn>=Yt.value?$():(hn&&globalThis.clearTimeout(hn),hn=globalThis.setTimeout(()=>{gn=tn(()=>y(null,null,function*(){if(!_n)return;if(!B()||P.value||H.value)return void $();let e=_.isDark?`dark`:`light`,t=A.value;if(!t.trim())return!1===_.loading?void $():void lr(vn);if(xn++,xn>Yt.value)$();else{J&&J.abort(),J=new AbortController;try{let n=yield In(t,e,{signal:J.signal,timeoutMs:q.value.worker});if(n.fullOk){if((yield rr(Q(t,e)))&&H.value)return void $()}else n.prefixOk&&n.prefix&&jn()&&(yield ar(n.prefix,t,e,W.value))}catch{}vn=Math.min(Math.floor(1.5*vn),Jt.value),lr(vn)}}),{timeout:500})},e)))}function ur(){_n||R.value&&v.value&&B()&&(P.value||H.value||(_n=!0,yn=0,bn=!0,xn=0,vn=qt.value,lr(vn)))}function dr(){return y(this,null,function*(){let t=gt;z(t)&&(yield _t().catch(e=>{z(t)&&(v.value=!1,console.warn(`[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.`,e))}),z(t)&&(yield e(),z(t)&&(Bt.value||(P.value=!v.value),B()&&(R.value?(an(),Ut.value=A.value.length):P.value||ir()))))})}return t(D,e=>{Z.value&&e&&Hn()}),t(Bn,e=>{Z.value&&bt.value&&(bt.value.style.transform=e.transform)},{immediate:!0}),t(Dn,e=>{e||we()}),t(()=>A.value,e=>{if((e.trim()||!1===_.loading)&&(H.value=!1,U.value={}),!R.value)return $(),void(B()&&!P.value&&ir());B()&&an(),!P.value&&v.value&&B()?ur():$(),function(){if(!R.value||!P.value||!v.value)return;let e=A.value.length;e!==Ut.value&&(Wt.value=!0,Ut.value=e,Xt&&clearTimeout(Xt),Xt=setTimeout(()=>{Wt.value&&P.value&&A.value.trim()&&(Wt.value=!1,tr(`preview`))},Kt.value))}()}),t(()=>_.isDark,()=>y(null,null,function*(){if(K.value)return;let t=_.isDark?`dark`:`light`,n=U.value[t];if(n){if(E.value){let e=mt(E.value,n.svg);e&&(x=n.bindFunctions??null,ht(e.bindTarget))}return}let r={zoom:j.value,translateX:M.value,translateY:N.value,containerHeight:V.value},i=j.value!==1||M.value!==0||N.value!==0;un.value=!0,i&&(j.value=1,M.value=0,N.value=0,yield e()),yield rr(),i&&(yield e(),j.value=r.zoom,M.value=r.translateX,N.value=r.translateY,V.value=r.containerHeight,pn.value=r)})),t(()=>P.value,t=>y(null,null,function*(){if(t)$(),H.value&&(pn.value={zoom:j.value,translateX:M.value,translateY:N.value,containerHeight:V.value});else{if(K.value)return;let t=_.isDark?`dark`:`light`;if(H.value&&U.value[t]){if(yield e(),E.value){let e=U.value[t],n=mt(E.value,e.svg);n&&(x=e.bindFunctions??null,ht(n.bindTarget))}j.value=pn.value.zoom,M.value=pn.value.translateX,N.value=pn.value.translateY,V.value=pn.value.containerHeight;return}if(yield e(),!v.value||!B())return;if(!R.value)return $(),void(yield ir());ur(),yield or()}})),t(()=>_.loading,(t,n)=>y(null,null,function*(){if(t)cr();else if(!0===n){cr();let t=A.value,n=t.trim();if(!n)return E.value&&b(E.value),Ft.value=null,L=``,K.value=!1,sr();if(!B())return void sr();let r=_.isDark?`dark`:`light`,i=Q(t,r);if(H.value&&i.signature===L){if(yield e(),E.value&&!E.value.querySelector(`svg`)&&U.value[r]){let e=U.value[r],t=mt(E.value,e.svg);t&&(x=e.bindFunctions??null,ht(t.bindTarget))}zn(void 0,{force:!0}),sr();return}let a=new AbortController;dn=a;try{let e=0;for(;;)try{yield Fn(n,r,{signal:a.signal,timeoutMs:q.value.worker});break}catch(t){let n=t?.code===`WORKER_BUSY`||t?.code===`WORKER_TIMEOUT`,r=t?.code===`WORKER_TIMEOUT`?2:8;if(!n||e>=r)throw t;let i=Math.min(50*ze(2,e),400);e++,yield Sn(()=>new Promise(e=>setTimeout(e,i)),{signal:a.signal})}if(!(yield rr(i)))return;K.value=!1,sr()}catch(e){if(Tn(e))return;sr(),Cn(e)}finally{dn===a&&(dn=null)}}})),t(T,e=>{ln&&ln.disconnect(),e&&(ln=new ResizeObserver(e=>{e&&e.length>0&&!P.value&&!w.value&&Ce(()=>{zn(e[0].contentRect.width)})}),ln.observe(e))},{immediate:!0}),a(()=>{Ie.value&&!B()||dr()}),t(()=>v.value,e=>{Bt.value||(P.value=!e)}),t(()=>_.maxHeight,()=>{e(()=>{zn()})}),t([()=>_.estimatedPreviewHeightPx,()=>A.value],()=>{H.value||It()||P.value||(V.value=Pt(),cn.value=V.value)}),t(()=>Ct.value,e=>y(null,null,function*(){e&&(Ne.value?(H.value||(R.value?(an(),Ut.value=A.value.length):ir()),_.loading||H.value||ir(),!P.value&&v.value&&R.value&&ur()):yield dr())}),{immediate:!1}),s(()=>{Xt&&clearTimeout(Xt),rn(),ln&&ln.disconnect(),G&&=(G.abort(),null),cr(),$(),on(),At()}),t(()=>w.value,t=>y(null,null,function*(){t?($(),G&&G.abort()):B()&&!H.value&&(yield e(),R.value?(an(),ur()):P.value||ir())}),{immediate:!1}),(e,t)=>(r(),g(`div`,{ref_key:`blockContainer`,ref:yt,class:h([`mermaid-block-container rounded-lg border overflow-hidden`,[{"is-rendering":_.loading,dark:_.isDark}]]),"data-markstream-mermaid":`1`,"data-markstream-mode":P.value?`fallback`:H.value?`preview`:`pending`,"data-markstream-pending":fn.value?`true`:void 0},[_.showHeader?(r(),g(`div`,Ue,[e.$slots[`header-left`]?(r(),g(`div`,We,[de(e.$slots,`header-left`,{},void 0,!0)])):(r(),g(`div`,Ge,[d(`span`,{class:`icon-slot action-icon shrink-0`,innerHTML:m(` diff --git a/apps/pythinker-code/dist-web/assets/index3-U5vX94Wy.js b/apps/pythinker-code/dist-web/assets/index3-U5vX94Wy.js deleted file mode 100644 index 4dd374bd8..000000000 --- a/apps/pythinker-code/dist-web/assets/index3-U5vX94Wy.js +++ /dev/null @@ -1 +0,0 @@ -import e from"./CodeBlockNode-_wK8GSRB.js";e.install=t=>{t.component(e.__name,e)};export{e as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index3-mVb7iXlv.js b/apps/pythinker-code/dist-web/assets/index3-mVb7iXlv.js new file mode 100644 index 000000000..2a85eb4e4 --- /dev/null +++ b/apps/pythinker-code/dist-web/assets/index3-mVb7iXlv.js @@ -0,0 +1 @@ +import e from"./CodeBlockNode-uERC4D15.js";e.install=t=>{t.component(e.__name,e)};export{e as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index4-BTqbYikG.js b/apps/pythinker-code/dist-web/assets/index4-BTqbYikG.js new file mode 100644 index 000000000..25b91da84 --- /dev/null +++ b/apps/pythinker-code/dist-web/assets/index4-BTqbYikG.js @@ -0,0 +1 @@ +import e from"./Tooltip-CYPLmGXR.js";e.install=t=>{t.component(e.__name,e)};export{e as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index4-Wk5pGiJ7.js b/apps/pythinker-code/dist-web/assets/index4-Wk5pGiJ7.js deleted file mode 100644 index 5566fe784..000000000 --- a/apps/pythinker-code/dist-web/assets/index4-Wk5pGiJ7.js +++ /dev/null @@ -1 +0,0 @@ -import e from"./Tooltip-BV-JRC1N.js";e.install=t=>{t.component(e.__name,e)};export{e as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index5-CCrZjPWg.js b/apps/pythinker-code/dist-web/assets/index5-DTEBXfOq.js similarity index 97% rename from apps/pythinker-code/dist-web/assets/index5-CCrZjPWg.js rename to apps/pythinker-code/dist-web/assets/index5-DTEBXfOq.js index b93cfe641..a6251f459 100644 --- a/apps/pythinker-code/dist-web/assets/index5-CCrZjPWg.js +++ b/apps/pythinker-code/dist-web/assets/index5-DTEBXfOq.js @@ -1 +1 @@ -import{E as e,I as t,U as n,ct as r,g as i,k as a,m as o,ot as s,q as c,w as l,y as u,z as d}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import f from"./CodeBlockNode-_wK8GSRB.js";var p=Object.defineProperty,m=Object.defineProperties,h=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,y=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=l({__name:`MarkdownCodeBlockNode`,props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:`vitesse-dark`},lightTheme:{default:`vitesse-light`},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:[`previewCode`,`copy`],setup(l,{emit:p}){let b=l,x=p,S=f,C=n(),w=o(()=>{return e=((e,t)=>{for(var n in t||={})_.call(t,n)&&y(e,n,t[n]);if(g)for(var n of g(t))v.call(t,n)&&y(e,n,t[n]);return e})({},C),t={node:b.node,loading:b.loading,stream:b.stream,darkTheme:b.darkTheme,lightTheme:b.lightTheme,isDark:b.isDark,isShowPreview:b.isShowPreview,enableFontSizeControl:b.enableFontSizeControl,minWidth:b.minWidth,maxWidth:b.maxWidth,themes:b.themes,showHeader:b.showHeader,showCopyButton:b.showCopyButton,showExpandButton:b.showExpandButton,showPreviewButton:b.showPreviewButton,showCollapseButton:b.showCollapseButton,showFontSizeButtons:b.showFontSizeButtons,showTooltips:b.showTooltips,estimatedHeightPx:b.estimatedHeightPx,estimatedContentHeightPx:b.estimatedContentHeightPx},m(e,h(t));var e,t});function T(e){x(`previewCode`,{type:e.artifactType,content:b.node.code,title:e.artifactTitle})}return(n,o)=>(t(),i(s(S),a(w.value,{onPreviewCode:T,onCopy:o[0]||=e=>x(`copy`,e)}),u({_:2},[n.$slots[`header-left`]?{name:`header-left`,fn:c(()=>[d(n.$slots,`header-left`)]),key:`0`}:void 0,n.$slots[`header-right`]?{name:`header-right`,fn:c(()=>[d(n.$slots,`header-right`)]),key:`1`}:void 0,n.$slots.loading?{name:`loading`,fn:c(t=>[d(n.$slots,`loading`,r(e(t)))]),key:`2`}:void 0]),1040))}});b.install=e=>{e.component(b.__name,b)};export{b as default}; \ No newline at end of file +import{E as e,I as t,U as n,ct as r,g as i,k as a,m as o,ot as s,q as c,w as l,y as u,z as d}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import f from"./CodeBlockNode-uERC4D15.js";var p=Object.defineProperty,m=Object.defineProperties,h=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,y=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=l({__name:`MarkdownCodeBlockNode`,props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:`vitesse-dark`},lightTheme:{default:`vitesse-light`},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:[`previewCode`,`copy`],setup(l,{emit:p}){let b=l,x=p,S=f,C=n(),w=o(()=>{return e=((e,t)=>{for(var n in t||={})_.call(t,n)&&y(e,n,t[n]);if(g)for(var n of g(t))v.call(t,n)&&y(e,n,t[n]);return e})({},C),t={node:b.node,loading:b.loading,stream:b.stream,darkTheme:b.darkTheme,lightTheme:b.lightTheme,isDark:b.isDark,isShowPreview:b.isShowPreview,enableFontSizeControl:b.enableFontSizeControl,minWidth:b.minWidth,maxWidth:b.maxWidth,themes:b.themes,showHeader:b.showHeader,showCopyButton:b.showCopyButton,showExpandButton:b.showExpandButton,showPreviewButton:b.showPreviewButton,showCollapseButton:b.showCollapseButton,showFontSizeButtons:b.showFontSizeButtons,showTooltips:b.showTooltips,estimatedHeightPx:b.estimatedHeightPx,estimatedContentHeightPx:b.estimatedContentHeightPx},m(e,h(t));var e,t});function T(e){x(`previewCode`,{type:e.artifactType,content:b.node.code,title:e.artifactTitle})}return(n,o)=>(t(),i(s(S),a(w.value,{onPreviewCode:T,onCopy:o[0]||=e=>x(`copy`,e)}),u({_:2},[n.$slots[`header-left`]?{name:`header-left`,fn:c(()=>[d(n.$slots,`header-left`)]),key:`0`}:void 0,n.$slots[`header-right`]?{name:`header-right`,fn:c(()=>[d(n.$slots,`header-right`)]),key:`1`}:void 0,n.$slots.loading?{name:`loading`,fn:c(t=>[d(n.$slots,`loading`,r(e(t)))]),key:`2`}:void 0]),1040))}});b.install=e=>{e.component(b.__name,b)};export{b as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index6-CGYWuLMy.js b/apps/pythinker-code/dist-web/assets/index6-KRBW8xCP.js similarity index 98% rename from apps/pythinker-code/dist-web/assets/index6-CGYWuLMy.js rename to apps/pythinker-code/dist-web/assets/index6-KRBW8xCP.js index 2f253b4be..6c4f1ae6d 100644 --- a/apps/pythinker-code/dist-web/assets/index6-CGYWuLMy.js +++ b/apps/pythinker-code/dist-web/assets/index6-KRBW8xCP.js @@ -1 +1 @@ -import{A as e,G as t,I as n,N as r,O as i,S as a,T as o,_ as s,h as c,j as ee,lt as l,m as u,n as d,nt as f,q as p,st as m,ut as h,v as g,w as _}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{G as v,K as y,U as te,W as ne,_ as b,d as re,et as ie,q as x,w as ae}from"./index-DAFMRqR8.js";var S=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),C=[`data-markstream-mode`,`data-markstream-pending`],w={key:0,class:`math-loading-overlay`},T=[`innerHTML`],E={key:1,class:`math-block__fallback text-left`},D=b(_({__name:`MathBlockNode`,props:{node:{},indexKey:{},cacheScope:{}},setup(_){let b=_,D=f(null),O=i(ie,null),k=u(()=>v(b.node.content)),A=o()?.vnode.el?.nodeType===1,j=u(()=>re(b,{})),M=function(){if(!b.node.content)return{html:``,text:b.node.raw,loading:!1};if(b.node.loading)return{html:``,text:``,loading:!0};let e=y();if(!e){let e=typeof window>`u`||A;return{html:``,text:e?b.node.raw:``,loading:!e}}try{let t=e.renderToString(k.value,{throwOnError:!1,displayMode:!0});return x(k.value,!0,t),{html:t,text:``,loading:!1}}catch{return{html:``,text:b.node.loading?``:b.node.raw,loading:b.node.loading}}}(),N=f(M.html),P=f(M.text),F=!1,I=0,L=!1,R=null,z=ae(),B=null,V=``,H=f(M.loading),U=f(!1),W=f(q());function G(e){e!=null&&e!==I||(U.value=!1)}function K(){if(b.indexKey==null)return``;let e=b.cacheScope??z?.scope;return`${e!=null&&String(e).length>0?`${String(e)}:`:``}math-block:${String(b.indexKey)}`}function q(){var e;let t=K();return t&&(e=z?.cache.get(t))!=null?e:0}function J(){if(W.value===0)return;W.value=0;let e=K();e&&z?.cache.set(e,0)}function Y(e){if(N.value)return void J();if(!Number.isFinite(e)||e<=0)return;let t=Math.max(W.value,e);if(t===W.value)return;W.value=t;let n=K();n&&z?.cache.set(n,t)}function X(){e(()=>{Y(D.value?.offsetHeight??0)})}function Z(){let e=V;O&&e&&(V=``,O.markSettled(e))}function Q(){return S(this,null,function*(){if(L)return Z(),void G();R&&=(R.abort(),null);let t=++I;if(!b.node.content)return Z(),G(),H.value=!1,N.value=``,P.value=b.node.raw,F=!1,void X();let n=new AbortController;R=n,U.value=!0,L||t!==I||n.signal.aborted?L||G(t):(function(){let e=j.value;O&&e&&V!==e&&(V&&O.markSettled(V),V=e,O.markPending(e))}(),ne(k.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:n.signal}).then(e=>{L||t!==I||(N.value=e,P.value=``,F=!0,H.value=!1,J(),X())}).catch(e=>S(null,null,function*(){if(L||t!==I)return;let n=e?.code||e?.name,r=n===`KATEX_DISABLED`;if(n===`WORKER_INIT_ERROR`||e?.fallbackToRenderer||(n===`WORKER_BUSY`||n===`WORKER_TIMEOUT`)&&!b.node.loading){let e=yield te();if(L||t!==I)return;if(e){try{let t=e.renderToString(k.value,{throwOnError:b.node.loading,displayMode:!0});N.value=t,P.value=``,F=!0,H.value=!1,J(),X(),x(k.value,!0,t)}catch{}return}}if(r||!b.node.loading)return H.value=!1,N.value=``,P.value=b.node.raw,void X();F||(H.value=!0)})).finally(()=>{L||t!==I||(G(t),function(){let t=V;O&&t&&(V=``,e(()=>{if(!L){let e=D.value?.offsetHeight??0;e>0&&O.reportHeight(t,e)}O.markSettled(t)}))}())}))})}M.html&&(F=!0),M.html&&J();let oe=[{family:`$$`,open:`$$`,close:`$$`},{family:`\\[]`,open:`\\[`,close:`\\]`},{family:`\\[]`,open:`\\[`,close:`]`},{family:`[]`,open:`[`,close:`\\]`},{family:`[]`,open:`[`,close:`]`},{family:`\\()`,open:`\\(`,close:`\\)`},{family:`$`,open:`$`,close:`$`}];function $(e,t){return function(e){let t=String(e??``);for(let{family:e,open:n,close:r}of oe)if((n!==`$`||!t.startsWith(`$$`)&&!t.endsWith(`$$`))&&t.length>=n.length+r.length&&t.startsWith(n)&&t.endsWith(r))return{family:e,inner:t.slice(n.length,t.length-r.length),trusted:!0};return null}(e)||{family:`content`,inner:String(t??``),trusted:!1}}return t(()=>[b.node.content,b.node.loading,b.node.raw],([e,,t],[n,,r])=>{var i,a;(i=$(r,n),a=$(t,e),i.inner===``||i.family===a.family&&(i.trusted&&a.trusted?a.inner.startsWith(i.inner):a.inner===i.inner))||J(),Q()},{flush:`post`}),t([()=>b.indexKey,()=>b.cacheScope],()=>{W.value=q(),X()}),r(()=>{typeof ResizeObserver<`u`&&D.value&&(B=new ResizeObserver(()=>{Y(D.value?.offsetHeight??0)}),B.observe(D.value)),X(),N.value||Q()}),ee(()=>{L=!0,Z(),R&&=(R.abort(),null),B?.disconnect(),B=null}),(e,t)=>(n(),g(`div`,{ref_key:`containerEl`,ref:D,class:`math-block text-center overflow-x-auto relative`,"data-markstream-math":`block`,"data-markstream-mode":N.value?`katex`:P.value?`fallback`:`loading`,"data-markstream-pending":U.value?`true`:void 0,style:l(W.value?{minHeight:`${W.value}px`}:void 0)},[a(d,{name:`math-fade`},{default:p(()=>[!H.value||N.value||P.value?s(``,!0):(n(),g(`div`,w,[...t[0]||=[c(`div`,{class:`math-loading-spinner`},null,-1)]]))]),_:1}),N.value?(n(),g(`div`,{key:0,class:m([`math-block__content`,{"math-rendering":H.value}]),innerHTML:N.value},null,10,T)):P.value?(n(),g(`pre`,E,h(P.value),1)):(n(),g(`div`,{key:2,class:m([`math-block__content`,{"math-rendering":H.value}])},null,2))],12,C))}}),[[`__scopeId`,`data-v-939191ad`]]);D.install=e=>{e.component(D.__name,D)};export{D as default}; \ No newline at end of file +import{A as e,G as t,I as n,N as r,O as i,S as a,T as o,_ as s,h as c,j as ee,lt as l,m as u,n as d,nt as f,q as p,st as m,ut as h,v as g,w as _}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{G as v,K as y,U as te,W as ne,_ as b,d as re,et as ie,q as x,w as ae}from"./index-CJN6blp7.js";var S=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),C=[`data-markstream-mode`,`data-markstream-pending`],w={key:0,class:`math-loading-overlay`},T=[`innerHTML`],E={key:1,class:`math-block__fallback text-left`},D=b(_({__name:`MathBlockNode`,props:{node:{},indexKey:{},cacheScope:{}},setup(_){let b=_,D=f(null),O=i(ie,null),k=u(()=>v(b.node.content)),A=o()?.vnode.el?.nodeType===1,j=u(()=>re(b,{})),M=function(){if(!b.node.content)return{html:``,text:b.node.raw,loading:!1};if(b.node.loading)return{html:``,text:``,loading:!0};let e=y();if(!e){let e=typeof window>`u`||A;return{html:``,text:e?b.node.raw:``,loading:!e}}try{let t=e.renderToString(k.value,{throwOnError:!1,displayMode:!0});return x(k.value,!0,t),{html:t,text:``,loading:!1}}catch{return{html:``,text:b.node.loading?``:b.node.raw,loading:b.node.loading}}}(),N=f(M.html),P=f(M.text),F=!1,I=0,L=!1,R=null,z=ae(),B=null,V=``,H=f(M.loading),U=f(!1),W=f(q());function G(e){e!=null&&e!==I||(U.value=!1)}function K(){if(b.indexKey==null)return``;let e=b.cacheScope??z?.scope;return`${e!=null&&String(e).length>0?`${String(e)}:`:``}math-block:${String(b.indexKey)}`}function q(){var e;let t=K();return t&&(e=z?.cache.get(t))!=null?e:0}function J(){if(W.value===0)return;W.value=0;let e=K();e&&z?.cache.set(e,0)}function Y(e){if(N.value)return void J();if(!Number.isFinite(e)||e<=0)return;let t=Math.max(W.value,e);if(t===W.value)return;W.value=t;let n=K();n&&z?.cache.set(n,t)}function X(){e(()=>{Y(D.value?.offsetHeight??0)})}function Z(){let e=V;O&&e&&(V=``,O.markSettled(e))}function Q(){return S(this,null,function*(){if(L)return Z(),void G();R&&=(R.abort(),null);let t=++I;if(!b.node.content)return Z(),G(),H.value=!1,N.value=``,P.value=b.node.raw,F=!1,void X();let n=new AbortController;R=n,U.value=!0,L||t!==I||n.signal.aborted?L||G(t):(function(){let e=j.value;O&&e&&V!==e&&(V&&O.markSettled(V),V=e,O.markPending(e))}(),ne(k.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:n.signal}).then(e=>{L||t!==I||(N.value=e,P.value=``,F=!0,H.value=!1,J(),X())}).catch(e=>S(null,null,function*(){if(L||t!==I)return;let n=e?.code||e?.name,r=n===`KATEX_DISABLED`;if(n===`WORKER_INIT_ERROR`||e?.fallbackToRenderer||(n===`WORKER_BUSY`||n===`WORKER_TIMEOUT`)&&!b.node.loading){let e=yield te();if(L||t!==I)return;if(e){try{let t=e.renderToString(k.value,{throwOnError:b.node.loading,displayMode:!0});N.value=t,P.value=``,F=!0,H.value=!1,J(),X(),x(k.value,!0,t)}catch{}return}}if(r||!b.node.loading)return H.value=!1,N.value=``,P.value=b.node.raw,void X();F||(H.value=!0)})).finally(()=>{L||t!==I||(G(t),function(){let t=V;O&&t&&(V=``,e(()=>{if(!L){let e=D.value?.offsetHeight??0;e>0&&O.reportHeight(t,e)}O.markSettled(t)}))}())}))})}M.html&&(F=!0),M.html&&J();let oe=[{family:`$$`,open:`$$`,close:`$$`},{family:`\\[]`,open:`\\[`,close:`\\]`},{family:`\\[]`,open:`\\[`,close:`]`},{family:`[]`,open:`[`,close:`\\]`},{family:`[]`,open:`[`,close:`]`},{family:`\\()`,open:`\\(`,close:`\\)`},{family:`$`,open:`$`,close:`$`}];function $(e,t){return function(e){let t=String(e??``);for(let{family:e,open:n,close:r}of oe)if((n!==`$`||!t.startsWith(`$$`)&&!t.endsWith(`$$`))&&t.length>=n.length+r.length&&t.startsWith(n)&&t.endsWith(r))return{family:e,inner:t.slice(n.length,t.length-r.length),trusted:!0};return null}(e)||{family:`content`,inner:String(t??``),trusted:!1}}return t(()=>[b.node.content,b.node.loading,b.node.raw],([e,,t],[n,,r])=>{var i,a;(i=$(r,n),a=$(t,e),i.inner===``||i.family===a.family&&(i.trusted&&a.trusted?a.inner.startsWith(i.inner):a.inner===i.inner))||J(),Q()},{flush:`post`}),t([()=>b.indexKey,()=>b.cacheScope],()=>{W.value=q(),X()}),r(()=>{typeof ResizeObserver<`u`&&D.value&&(B=new ResizeObserver(()=>{Y(D.value?.offsetHeight??0)}),B.observe(D.value)),X(),N.value||Q()}),ee(()=>{L=!0,Z(),R&&=(R.abort(),null),B?.disconnect(),B=null}),(e,t)=>(n(),g(`div`,{ref_key:`containerEl`,ref:D,class:`math-block text-center overflow-x-auto relative`,"data-markstream-math":`block`,"data-markstream-mode":N.value?`katex`:P.value?`fallback`:`loading`,"data-markstream-pending":U.value?`true`:void 0,style:l(W.value?{minHeight:`${W.value}px`}:void 0)},[a(d,{name:`math-fade`},{default:p(()=>[!H.value||N.value||P.value?s(``,!0):(n(),g(`div`,w,[...t[0]||=[c(`div`,{class:`math-loading-spinner`},null,-1)]]))]),_:1}),N.value?(n(),g(`div`,{key:0,class:m([`math-block__content`,{"math-rendering":H.value}]),innerHTML:N.value},null,10,T)):P.value?(n(),g(`pre`,E,h(P.value),1)):(n(),g(`div`,{key:2,class:m([`math-block__content`,{"math-rendering":H.value}])},null,2))],12,C))}}),[[`__scopeId`,`data-v-939191ad`]]);D.install=e=>{e.component(D.__name,D)};export{D as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index7-DOLmlvs-.js b/apps/pythinker-code/dist-web/assets/index7-ClZ3JBPh.js similarity index 97% rename from apps/pythinker-code/dist-web/assets/index7-DOLmlvs-.js rename to apps/pythinker-code/dist-web/assets/index7-ClZ3JBPh.js index 2b18a17d8..0346caf23 100644 --- a/apps/pythinker-code/dist-web/assets/index7-DOLmlvs-.js +++ b/apps/pythinker-code/dist-web/assets/index7-ClZ3JBPh.js @@ -1 +1 @@ -import{G as e,I as t,N as n,T as r,_ as i,g as a,h as o,j as s,m as c,n as l,nt as u,q as d,ut as f,v as p,w as m,z as h}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{G as g,K as _,U as v,W as y,_ as b,q as x}from"./index-DAFMRqR8.js";var S=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),C=[`data-markstream-mode`,`data-markstream-pending`],w=[`innerHTML`],T={key:1,class:`math-inline math-inline--fallback`},E={class:`math-inline__loading`,role:`status`,"aria-live":`polite`},D=b(m({__name:`MathInlineNode`,props:{node:{}},setup(m){let b=m,D=u(null),O=c(()=>b.node.markup===`$$`),k=c(()=>g(b.node.content)),A=r()?.vnode.el?.nodeType===1,j=function(){if(!b.node.content)return{html:``,text:b.node.loading?``:b.node.raw,loading:b.node.loading};if(b.node.loading)return{html:``,text:``,loading:!0};let e=_();if(!e){let e=typeof window>`u`||A;return{html:``,text:e?b.node.raw:``,loading:!e}}try{let t=e.renderToString(k.value,{throwOnError:!1,displayMode:O.value});return x(k.value,O.value,t),{html:t,text:``,loading:!1}}catch{return{html:``,text:b.node.loading?``:b.node.raw,loading:b.node.loading}}}(),M=u(j.html),N=u(j.text),P=!1,F=0,I=!1,L=null,R=u(j.loading),z=u(!1);function B(e){e!=null&&e!==F||(z.value=!1)}function V(){return S(this,null,function*(){if(I)return;L&&=(L.abort(),null);let e=++F;if(!b.node.content)return B(),M.value=``,N.value=b.node.loading?``:b.node.raw,R.value=b.node.loading,void(P=!1);let t=new AbortController;L=t,z.value=!0,I||e!==F||t.signal.aborted?B(e):y(k.value,O.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:t.signal}).then(t=>{I||e!==F||(M.value=t,N.value=``,R.value=!1,P=!0)}).catch(t=>S(null,null,function*(){if(I||e!==F)return;let n=t?.code||t?.name,r=n===`KATEX_DISABLED`;if(n===`WORKER_INIT_ERROR`||t?.fallbackToRenderer||(n===`WORKER_BUSY`||n===`WORKER_TIMEOUT`)&&!b.node.loading){let t=yield v();if(I||e!==F)return;if(t){try{let e=t.renderToString(k.value,{throwOnError:b.node.loading,displayMode:O.value});M.value=e,N.value=``,R.value=!1,P=!0,x(k.value,O.value,e)}catch{}return}}if(r||!b.node.loading)return R.value=!1,M.value=``,void(N.value=b.node.raw);P||(R.value=!0)})).finally(()=>{I||B(e)})})}return j.html&&(P=!0),e(()=>[b.node.content,b.node.loading,b.node.raw,b.node.markup],()=>{V()}),n(()=>{M.value||V()}),s(()=>{I=!0,L&&=(L.abort(),null)}),(e,n)=>(t(),p(`span`,{ref_key:`containerEl`,ref:D,class:`math-inline-wrapper`,"data-markstream-math":`inline`,"data-markstream-mode":M.value?`katex`:N.value?`fallback`:`loading`,"data-markstream-pending":z.value?`true`:void 0},[M.value?(t(),p(`span`,{key:0,class:`math-inline`,innerHTML:M.value},null,8,w)):N.value?(t(),p(`span`,T,f(N.value),1)):R.value?(t(),a(l,{key:2,name:`table-node-fade`},{default:d(()=>[o(`span`,E,[h(e.$slots,`loading`,{isLoading:R.value},()=>[n[0]||=o(`span`,{class:`math-inline__spinner animate-spin`,"aria-hidden":`true`},null,-1),n[1]||=o(`span`,{class:`sr-only`},`Loading`,-1)],!0)])]),_:3})):i(``,!0)],8,C))}}),[[`__scopeId`,`data-v-6c556261`]]);D.install=e=>{e.component(D.__name,D)};export{D as default}; \ No newline at end of file +import{G as e,I as t,N as n,T as r,_ as i,g as a,h as o,j as s,m as c,n as l,nt as u,q as d,ut as f,v as p,w as m,z as h}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{G as g,K as _,U as v,W as y,_ as b,q as x}from"./index-CJN6blp7.js";var S=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),C=[`data-markstream-mode`,`data-markstream-pending`],w=[`innerHTML`],T={key:1,class:`math-inline math-inline--fallback`},E={class:`math-inline__loading`,role:`status`,"aria-live":`polite`},D=b(m({__name:`MathInlineNode`,props:{node:{}},setup(m){let b=m,D=u(null),O=c(()=>b.node.markup===`$$`),k=c(()=>g(b.node.content)),A=r()?.vnode.el?.nodeType===1,j=function(){if(!b.node.content)return{html:``,text:b.node.loading?``:b.node.raw,loading:b.node.loading};if(b.node.loading)return{html:``,text:``,loading:!0};let e=_();if(!e){let e=typeof window>`u`||A;return{html:``,text:e?b.node.raw:``,loading:!e}}try{let t=e.renderToString(k.value,{throwOnError:!1,displayMode:O.value});return x(k.value,O.value,t),{html:t,text:``,loading:!1}}catch{return{html:``,text:b.node.loading?``:b.node.raw,loading:b.node.loading}}}(),M=u(j.html),N=u(j.text),P=!1,F=0,I=!1,L=null,R=u(j.loading),z=u(!1);function B(e){e!=null&&e!==F||(z.value=!1)}function V(){return S(this,null,function*(){if(I)return;L&&=(L.abort(),null);let e=++F;if(!b.node.content)return B(),M.value=``,N.value=b.node.loading?``:b.node.raw,R.value=b.node.loading,void(P=!1);let t=new AbortController;L=t,z.value=!0,I||e!==F||t.signal.aborted?B(e):y(k.value,O.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:t.signal}).then(t=>{I||e!==F||(M.value=t,N.value=``,R.value=!1,P=!0)}).catch(t=>S(null,null,function*(){if(I||e!==F)return;let n=t?.code||t?.name,r=n===`KATEX_DISABLED`;if(n===`WORKER_INIT_ERROR`||t?.fallbackToRenderer||(n===`WORKER_BUSY`||n===`WORKER_TIMEOUT`)&&!b.node.loading){let t=yield v();if(I||e!==F)return;if(t){try{let e=t.renderToString(k.value,{throwOnError:b.node.loading,displayMode:O.value});M.value=e,N.value=``,R.value=!1,P=!0,x(k.value,O.value,e)}catch{}return}}if(r||!b.node.loading)return R.value=!1,M.value=``,void(N.value=b.node.raw);P||(R.value=!0)})).finally(()=>{I||B(e)})})}return j.html&&(P=!0),e(()=>[b.node.content,b.node.loading,b.node.raw,b.node.markup],()=>{V()}),n(()=>{M.value||V()}),s(()=>{I=!0,L&&=(L.abort(),null)}),(e,n)=>(t(),p(`span`,{ref_key:`containerEl`,ref:D,class:`math-inline-wrapper`,"data-markstream-math":`inline`,"data-markstream-mode":M.value?`katex`:N.value?`fallback`:`loading`,"data-markstream-pending":z.value?`true`:void 0},[M.value?(t(),p(`span`,{key:0,class:`math-inline`,innerHTML:M.value},null,8,w)):N.value?(t(),p(`span`,T,f(N.value),1)):R.value?(t(),a(l,{key:2,name:`table-node-fade`},{default:d(()=>[o(`span`,E,[h(e.$slots,`loading`,{isLoading:R.value},()=>[n[0]||=o(`span`,{class:`math-inline__spinner animate-spin`,"aria-hidden":`true`},null,-1),n[1]||=o(`span`,{class:`sr-only`},`Loading`,-1)],!0)])]),_:3})):i(``,!0)],8,C))}}),[[`__scopeId`,`data-v-6c556261`]]);D.install=e=>{e.component(D.__name,D)};export{D as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index8-BKeFA_Sf.js b/apps/pythinker-code/dist-web/assets/index8-CkSxjxQO.js similarity index 99% rename from apps/pythinker-code/dist-web/assets/index8-BKeFA_Sf.js rename to apps/pythinker-code/dist-web/assets/index8-CkSxjxQO.js index 2653210da..ce441bf60 100644 --- a/apps/pythinker-code/dist-web/assets/index8-BKeFA_Sf.js +++ b/apps/pythinker-code/dist-web/assets/index8-CkSxjxQO.js @@ -1 +1 @@ -import{A as e,G as t,I as n,J as r,N as i,O as a,U as o,_ as s,c,h as l,j as ee,lt as u,m as d,nt as f,ot as p,st as m,ut as h,v as g,w as te}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{_,a as ne,d as re,et as ie,h as ae,n as oe,p as se,r as ce,v as le,x as ue}from"./index-DAFMRqR8.js";var de=Object.defineProperty,v=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,x=(e,t,n)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t)=>{for(var n in t||={})y.call(t,n)&&x(e,n,t[n]);if(v)for(var n of v(t))b.call(t,n)&&x(e,n,t[n]);return e},C=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),fe=[`data-markstream-mode`,`data-markstream-pending`],pe={key:0,class:`d2-block-header flex justify-between items-center border-b`},me={class:`d2-header-actions flex items-center`},he={key:0,class:`d2-mode-toggle flex items-center gap-0.5`},ge=[`aria-label`],_e={key:0,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},ve={key:1,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},ye=[`aria-label`],be=[`aria-pressed`],xe={key:0,class:`d2-source`},Se={class:`d2-code`},Ce={key:0,class:`d2-error mt-2 text-xs`},we={key:1},Te={key:0,class:`d2-source`},Ee={class:`d2-code`},De={key:0,class:`d2-error mt-2 text-xs`},Oe=[`innerHTML`],ke={key:0,class:`d2-error px-4 pb-3 text-xs`},w=_(te({__name:`D2BlockNode`,props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(te){let _=te,de=o(),v=a(ie,null),{t:y}=ne(),b=f(!1),x=f(!1),w=f(!1),T=f(!1),E=f(null),D=f(!1),O=f(``),k=f(``),A=f(0),j=f(``),M=f(``),N=f(null),P=f(null),F=f(null),Ae=se(),je=ue(),Me=le(),I=f(null),Ne=typeof window<`u`,Pe=f(!1),L=f(typeof window>`u`||!Me.value),R=d(()=>_.node.code??``),Fe=d(()=>re(_,de)),z=d(()=>[_.isDark?`dark`:`light`,_.themeId??`auto`,_.darkThemeId??`auto`,R.value].join(`:`)),B=d(()=>!!O.value&&k.value===z.value),Ie=d(()=>{if(!Pe.value||!R.value||w.value)return!1;let e=z.value;return!!D.value||j.value!==e&&(!E.value||M.value!==e)}),Le=d(()=>B.value||!!O.value&&Ie.value),V=d(()=>w.value||!T.value||!Le.value),Re=d(()=>{if(V.value&&P.value)return{minHeight:`${P.value}px`}}),ze=d(()=>_.maxHeight===`none`?{maxHeight:`none`}:_.maxHeight==null?void 0:{maxHeight:typeof _.maxHeight==`number`?`${_.maxHeight}px`:String(_.maxHeight)}),H=null,U=!1,W=!1,Be=0,G=null,K=!1,q=null,J=``;typeof window<`u`&&t([()=>F.value,Me],([e,t])=>{var n;if((n=I.value)==null||n.destroy(),I.value=null,!t||L.value)return void(L.value=!0);if(!e)return void(L.value=!1);let r=Ae(e,{rootMargin:je?.value.heavyBlockMargin??je?.value.rootMargin??`160px`,allowIdle:!1});I.value=r,L.value=r.isVisible.value,r.whenVisible.then(()=>{L.value=!0})},{immediate:!0});let Ve={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`};function He(e){return!e||e.disabled}function Y(e,t,n=`top`){if(He(e.currentTarget))return;let r=e,i=r?.clientX!=null&&r?.clientY!=null?{x:r.clientX,y:r.clientY}:void 0;ae(e.currentTarget,t,n,!1,i,_.isDark)}function X(){oe()}function Ue(e){if(He(e.currentTarget))return;let t=b.value?y(`common.copied`)||`Copied`:y(`common.copy`)||`Copy`,n=e,r=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;ae(e.currentTarget,t,`top`,!1,r,_.isDark)}function We(){return C(this,null,function*(){try{let e=R.value;typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),b.value=!0,setTimeout(()=>{b.value=!1},1e3)}catch(e){console.error(`Copy failed:`,e)}})}function Ge(){x.value=!x.value}function Ke(e){w.value=e===`source`}let qe=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Je=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Ye(e){if(!e)return``;let t=e.trim();return Je.test(t)?t:``}function Xe(){O.value=``,k.value=``}function Z(e){return W||e!==A.value}function Ze(){return C(this,null,function*(){if(!Ne||W||!L.value||_.loading&&!_.progressiveRender)return;let t=z.value;if(t===j.value&&!E.value&&B.value)return T.value=!0,void(_.loading&&(w.value=!1));let n=R.value;if(!n)return Xe(),E.value=null,j.value=``,void(M.value=``);let r=++A.value;D.value=!0,E.value=null,M.value=``,function(){let e=Fe.value;v&&e&&J!==e&&(J&&v.markSettled(J),J=e,v.markPending(e))}();try{let e=yield function(){return C(this,null,function*(){if(H)return H;let e=yield ce();if(W||!e)return null;if(typeof e==`function`){let t=new e;return t&&typeof t.compile==`function`?H=t:typeof e.compile==`function`&&(H=e),H}return e?.D2&&typeof e.D2==`function`?(H=new e.D2,H):(typeof e.compile==`function`&&(H=e),H)})}();if(Z(r))return;if(!e)return T.value=!1,w.value=!0,Xe(),E.value=`D2 is not available.`,void(M.value=t);if(typeof e.compile!=`function`||typeof e.render!=`function`)throw TypeError(`D2 instance is missing compile/render methods.`);T.value=!0;let i=yield e.compile(n);if(Z(r))return;let a=i?.diagram??i,o=i?.renderOptions??i?.options??{},s=_.themeId??o.themeID,c=_.darkThemeId??o.darkThemeID,l=S({},o);if(l.themeID=_.isDark&&c!=null?c:s,l.darkThemeID=null,l.darkThemeOverrides=null,_.isDark){let e=o.themeOverrides&&typeof o.themeOverrides==`object`?o.themeOverrides:null;l.themeOverrides=S(S({},Ve),e||{})}let ee=yield e.render(a,l);if(Z(r))return;let u=function(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}(ee);if(!u)throw Error(`D2 render returned empty output.`);(function(e,t){let n=function(e){if(typeof window>`u`||typeof DOMParser>`u`||!e)return``;let t=e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return function(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n))e.removeAttribute(n);else{if(n===`style`&&t.value){let r=t.value;if(qe.some(e=>e.test(r))){e.removeAttribute(n);continue}}if((n===`href`||n===`xlink:href`)&&t.value){let r=Ye(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}}(r),r.classList.add(`markstream-d2-root-svg`),r.outerHTML}(e);O.value=n||``,k.value=n?t:``})(u,t),j.value=t,M.value=``,_.loading&&(w.value=!1),E.value=null}catch(e){if(Z(r))return;let n=e?.message?String(e.message):`D2 render failed.`;_.loading||(E.value=n,M.value=t),j.value=``,n.includes(`@terrastruct/d2`)&&(T.value=!1,w.value=!0)}finally{Z(r)||(D.value=!1,K?(K=!1,Q()):function(){let t=J;v&&t&&(J=``,e(()=>{if(!W){let e=F.value?.offsetHeight??0;e>0&&v.reportHeight(t,e)}v.markSettled(t)}))}())}})}function Q(e=!1){if(U||!Ne||W)return;if(D.value)return void(K=!0);let t=Math.max(120,Number(_.progressiveIntervalMs)||0),n=Date.now()-Be;if(!e&&n{G=null,K&&(K=!1,Q(!0))},Math.max(0,t-n))));U=!0;let r=()=>{U=!1,Be=Date.now(),Ze()};typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(r):setTimeout(r,0)}function Qe(){if(B.value)try{let e=new Blob([O.value],{type:`image/svg+xml;charset=utf-8`}),t=URL.createObjectURL(e);if(typeof document<`u`){let e=document.createElement(`a`);e.href=t,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(t)}catch(e){console.error(`Failed to export SVG:`,e)}}function $(){let e=N.value;if(!e)return;let t=e.getBoundingClientRect().height;t>0&&(P.value=t)}return t(()=>[_.node.code,_.loading,_.isDark,_.themeId,_.darkThemeId],()=>{Q()},{immediate:!0}),t(()=>_.loading,(e,t)=>{t&&!e&&Q(!0)}),t(()=>L.value,e=>{e&&Q(!0)}),t(()=>[V.value,O.value,R.value],()=>{e(()=>{$()})}),i(()=>{Pe.value=!0,e(()=>{$()}),typeof ResizeObserver<`u`&&(q=new ResizeObserver(()=>{$()}),N.value&&q.observe(N.value))}),ee(()=>{var e;W=!0,A.value+=1,K=!1,function(){let e=J;v&&e&&(J=``,v.markSettled(e))}(),j.value=``,(e=I.value)==null||e.destroy(),I.value=null,G!=null&&(clearTimeout(G),G=null),q?.disconnect(),q=null}),(e,t)=>(n(),g(`div`,{ref_key:`viewportTarget`,ref:F,class:m([`d2-block-container rounded-lg border overflow-hidden`,{dark:_.isDark}]),"data-markstream-d2":`1`,"data-markstream-mode":V.value?`fallback`:`preview`,"data-markstream-pending":Ie.value?`true`:void 0},[_.showHeader?(n(),g(`div`,pe,[t[16]||=l(`div`,{class:`flex items-center gap-x-2`},[l(`span`,{class:`d2-label font-medium font-mono`},`D2`)],-1),l(`div`,me,[_.showModeToggle?(n(),g(`div`,he,[l(`button`,{type:`button`,class:m([`mode-btn px-2 py-0.5 rounded`,w.value?``:`is-active`]),onClick:t[0]||=e=>Ke(`preview`),onMouseenter:t[1]||=e=>Y(e,p(y)(`common.preview`)||`Preview`),onFocus:t[2]||=e=>Y(e,p(y)(`common.preview`)||`Preview`),onMouseleave:X,onBlur:X},h(p(y)(`common.preview`)||`Preview`),35),l(`button`,{type:`button`,class:m([`mode-btn px-2 py-0.5 rounded`,w.value?`is-active`:``]),onClick:t[3]||=e=>Ke(`source`),onMouseenter:t[4]||=e=>Y(e,p(y)(`common.source`)||`Source`),onFocus:t[5]||=e=>Y(e,p(y)(`common.source`)||`Source`),onMouseleave:X,onBlur:X},h(p(y)(`common.source`)||`Source`),35)])):s(``,!0),_.showCopyButton?(n(),g(`button`,{key:1,type:`button`,class:`d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md`,"aria-label":b.value?p(y)(`common.copied`)||`Copied`:p(y)(`common.copy`)||`Copy`,onClick:We,onMouseenter:t[6]||=e=>Ue(e),onFocus:t[7]||=e=>Ue(e),onMouseleave:X,onBlur:X},[b.value?(n(),g(`svg`,ve,[...t[13]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M20 6L9 17l-5-5`},null,-1)]])):(n(),g(`svg`,_e,[...t[12]||=[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),l(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})],-1)]]))],40,ge)):s(``,!0),_.showExportButton&&B.value?(n(),g(`button`,{key:2,type:`button`,class:`d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md`,"aria-label":p(y)(`common.export`)||`Export`,onClick:Qe,onMouseenter:t[8]||=e=>Y(e,p(y)(`common.export`)||`Export`),onFocus:t[9]||=e=>Y(e,p(y)(`common.export`)||`Export`),onMouseleave:X,onBlur:X},[...t[14]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`})],-1)]],40,ye)):s(``,!0),_.showCollapseButton?(n(),g(`button`,{key:3,type:`button`,class:`d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md`,"aria-pressed":x.value,onClick:Ge,onMouseenter:t[10]||=e=>Y(e,x.value?p(y)(`common.expand`)||`Expand`:p(y)(`common.collapse`)||`Collapse`),onFocus:t[11]||=e=>Y(e,x.value?p(y)(`common.expand`)||`Expand`:p(y)(`common.collapse`)||`Collapse`),onMouseleave:X,onBlur:X},[(n(),g(`svg`,{style:u({rotate:x.value?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[...t[15]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m9 18l6-6l-6-6`},null,-1)]],4))],40,be)):s(``,!0)])])):s(``,!0),r(l(`div`,{ref_key:`bodyRef`,ref:N,class:`d2-block-body`,style:u(Re.value)},[_.loading&&!Le.value?(n(),g(`div`,xe,[l(`pre`,Se,[l(`code`,null,h(R.value),1)]),E.value?(n(),g(`p`,Ce,h(E.value),1)):s(``,!0)])):(n(),g(`div`,we,[V.value?(n(),g(`div`,Te,[l(`pre`,Ee,[l(`code`,null,h(R.value),1)]),E.value?(n(),g(`p`,De,h(E.value),1)):s(``,!0)])):(n(),g(`div`,{key:1,class:`d2-render`,style:u(ze.value)},[l(`div`,{class:`d2-svg`,innerHTML:O.value},null,8,Oe),E.value?(n(),g(`p`,ke,h(E.value),1)):s(``,!0)],4))]))],4),[[c,!x.value]])],10,fe))}}),[[`__scopeId`,`data-v-3b434cf5`]]);w.install=e=>{e.component(w.__name,w)};export{w as default}; \ No newline at end of file +import{A as e,G as t,I as n,J as r,N as i,O as a,U as o,_ as s,c,h as l,j as ee,lt as u,m as d,nt as f,ot as p,st as m,ut as h,v as g,w as te}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{_,a as ne,d as re,et as ie,h as ae,n as oe,p as se,r as ce,v as le,x as ue}from"./index-CJN6blp7.js";var de=Object.defineProperty,v=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,x=(e,t,n)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t)=>{for(var n in t||={})y.call(t,n)&&x(e,n,t[n]);if(v)for(var n of v(t))b.call(t,n)&&x(e,n,t[n]);return e},C=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),fe=[`data-markstream-mode`,`data-markstream-pending`],pe={key:0,class:`d2-block-header flex justify-between items-center border-b`},me={class:`d2-header-actions flex items-center`},he={key:0,class:`d2-mode-toggle flex items-center gap-0.5`},ge=[`aria-label`],_e={key:0,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},ve={key:1,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},ye=[`aria-label`],be=[`aria-pressed`],xe={key:0,class:`d2-source`},Se={class:`d2-code`},Ce={key:0,class:`d2-error mt-2 text-xs`},we={key:1},Te={key:0,class:`d2-source`},Ee={class:`d2-code`},De={key:0,class:`d2-error mt-2 text-xs`},Oe=[`innerHTML`],ke={key:0,class:`d2-error px-4 pb-3 text-xs`},w=_(te({__name:`D2BlockNode`,props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(te){let _=te,de=o(),v=a(ie,null),{t:y}=ne(),b=f(!1),x=f(!1),w=f(!1),T=f(!1),E=f(null),D=f(!1),O=f(``),k=f(``),A=f(0),j=f(``),M=f(``),N=f(null),P=f(null),F=f(null),Ae=se(),je=ue(),Me=le(),I=f(null),Ne=typeof window<`u`,Pe=f(!1),L=f(typeof window>`u`||!Me.value),R=d(()=>_.node.code??``),Fe=d(()=>re(_,de)),z=d(()=>[_.isDark?`dark`:`light`,_.themeId??`auto`,_.darkThemeId??`auto`,R.value].join(`:`)),B=d(()=>!!O.value&&k.value===z.value),Ie=d(()=>{if(!Pe.value||!R.value||w.value)return!1;let e=z.value;return!!D.value||j.value!==e&&(!E.value||M.value!==e)}),Le=d(()=>B.value||!!O.value&&Ie.value),V=d(()=>w.value||!T.value||!Le.value),Re=d(()=>{if(V.value&&P.value)return{minHeight:`${P.value}px`}}),ze=d(()=>_.maxHeight===`none`?{maxHeight:`none`}:_.maxHeight==null?void 0:{maxHeight:typeof _.maxHeight==`number`?`${_.maxHeight}px`:String(_.maxHeight)}),H=null,U=!1,W=!1,Be=0,G=null,K=!1,q=null,J=``;typeof window<`u`&&t([()=>F.value,Me],([e,t])=>{var n;if((n=I.value)==null||n.destroy(),I.value=null,!t||L.value)return void(L.value=!0);if(!e)return void(L.value=!1);let r=Ae(e,{rootMargin:je?.value.heavyBlockMargin??je?.value.rootMargin??`160px`,allowIdle:!1});I.value=r,L.value=r.isVisible.value,r.whenVisible.then(()=>{L.value=!0})},{immediate:!0});let Ve={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`};function He(e){return!e||e.disabled}function Y(e,t,n=`top`){if(He(e.currentTarget))return;let r=e,i=r?.clientX!=null&&r?.clientY!=null?{x:r.clientX,y:r.clientY}:void 0;ae(e.currentTarget,t,n,!1,i,_.isDark)}function X(){oe()}function Ue(e){if(He(e.currentTarget))return;let t=b.value?y(`common.copied`)||`Copied`:y(`common.copy`)||`Copy`,n=e,r=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;ae(e.currentTarget,t,`top`,!1,r,_.isDark)}function We(){return C(this,null,function*(){try{let e=R.value;typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),b.value=!0,setTimeout(()=>{b.value=!1},1e3)}catch(e){console.error(`Copy failed:`,e)}})}function Ge(){x.value=!x.value}function Ke(e){w.value=e===`source`}let qe=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Je=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Ye(e){if(!e)return``;let t=e.trim();return Je.test(t)?t:``}function Xe(){O.value=``,k.value=``}function Z(e){return W||e!==A.value}function Ze(){return C(this,null,function*(){if(!Ne||W||!L.value||_.loading&&!_.progressiveRender)return;let t=z.value;if(t===j.value&&!E.value&&B.value)return T.value=!0,void(_.loading&&(w.value=!1));let n=R.value;if(!n)return Xe(),E.value=null,j.value=``,void(M.value=``);let r=++A.value;D.value=!0,E.value=null,M.value=``,function(){let e=Fe.value;v&&e&&J!==e&&(J&&v.markSettled(J),J=e,v.markPending(e))}();try{let e=yield function(){return C(this,null,function*(){if(H)return H;let e=yield ce();if(W||!e)return null;if(typeof e==`function`){let t=new e;return t&&typeof t.compile==`function`?H=t:typeof e.compile==`function`&&(H=e),H}return e?.D2&&typeof e.D2==`function`?(H=new e.D2,H):(typeof e.compile==`function`&&(H=e),H)})}();if(Z(r))return;if(!e)return T.value=!1,w.value=!0,Xe(),E.value=`D2 is not available.`,void(M.value=t);if(typeof e.compile!=`function`||typeof e.render!=`function`)throw TypeError(`D2 instance is missing compile/render methods.`);T.value=!0;let i=yield e.compile(n);if(Z(r))return;let a=i?.diagram??i,o=i?.renderOptions??i?.options??{},s=_.themeId??o.themeID,c=_.darkThemeId??o.darkThemeID,l=S({},o);if(l.themeID=_.isDark&&c!=null?c:s,l.darkThemeID=null,l.darkThemeOverrides=null,_.isDark){let e=o.themeOverrides&&typeof o.themeOverrides==`object`?o.themeOverrides:null;l.themeOverrides=S(S({},Ve),e||{})}let ee=yield e.render(a,l);if(Z(r))return;let u=function(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}(ee);if(!u)throw Error(`D2 render returned empty output.`);(function(e,t){let n=function(e){if(typeof window>`u`||typeof DOMParser>`u`||!e)return``;let t=e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return function(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n))e.removeAttribute(n);else{if(n===`style`&&t.value){let r=t.value;if(qe.some(e=>e.test(r))){e.removeAttribute(n);continue}}if((n===`href`||n===`xlink:href`)&&t.value){let r=Ye(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}}(r),r.classList.add(`markstream-d2-root-svg`),r.outerHTML}(e);O.value=n||``,k.value=n?t:``})(u,t),j.value=t,M.value=``,_.loading&&(w.value=!1),E.value=null}catch(e){if(Z(r))return;let n=e?.message?String(e.message):`D2 render failed.`;_.loading||(E.value=n,M.value=t),j.value=``,n.includes(`@terrastruct/d2`)&&(T.value=!1,w.value=!0)}finally{Z(r)||(D.value=!1,K?(K=!1,Q()):function(){let t=J;v&&t&&(J=``,e(()=>{if(!W){let e=F.value?.offsetHeight??0;e>0&&v.reportHeight(t,e)}v.markSettled(t)}))}())}})}function Q(e=!1){if(U||!Ne||W)return;if(D.value)return void(K=!0);let t=Math.max(120,Number(_.progressiveIntervalMs)||0),n=Date.now()-Be;if(!e&&n{G=null,K&&(K=!1,Q(!0))},Math.max(0,t-n))));U=!0;let r=()=>{U=!1,Be=Date.now(),Ze()};typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(r):setTimeout(r,0)}function Qe(){if(B.value)try{let e=new Blob([O.value],{type:`image/svg+xml;charset=utf-8`}),t=URL.createObjectURL(e);if(typeof document<`u`){let e=document.createElement(`a`);e.href=t,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(t)}catch(e){console.error(`Failed to export SVG:`,e)}}function $(){let e=N.value;if(!e)return;let t=e.getBoundingClientRect().height;t>0&&(P.value=t)}return t(()=>[_.node.code,_.loading,_.isDark,_.themeId,_.darkThemeId],()=>{Q()},{immediate:!0}),t(()=>_.loading,(e,t)=>{t&&!e&&Q(!0)}),t(()=>L.value,e=>{e&&Q(!0)}),t(()=>[V.value,O.value,R.value],()=>{e(()=>{$()})}),i(()=>{Pe.value=!0,e(()=>{$()}),typeof ResizeObserver<`u`&&(q=new ResizeObserver(()=>{$()}),N.value&&q.observe(N.value))}),ee(()=>{var e;W=!0,A.value+=1,K=!1,function(){let e=J;v&&e&&(J=``,v.markSettled(e))}(),j.value=``,(e=I.value)==null||e.destroy(),I.value=null,G!=null&&(clearTimeout(G),G=null),q?.disconnect(),q=null}),(e,t)=>(n(),g(`div`,{ref_key:`viewportTarget`,ref:F,class:m([`d2-block-container rounded-lg border overflow-hidden`,{dark:_.isDark}]),"data-markstream-d2":`1`,"data-markstream-mode":V.value?`fallback`:`preview`,"data-markstream-pending":Ie.value?`true`:void 0},[_.showHeader?(n(),g(`div`,pe,[t[16]||=l(`div`,{class:`flex items-center gap-x-2`},[l(`span`,{class:`d2-label font-medium font-mono`},`D2`)],-1),l(`div`,me,[_.showModeToggle?(n(),g(`div`,he,[l(`button`,{type:`button`,class:m([`mode-btn px-2 py-0.5 rounded`,w.value?``:`is-active`]),onClick:t[0]||=e=>Ke(`preview`),onMouseenter:t[1]||=e=>Y(e,p(y)(`common.preview`)||`Preview`),onFocus:t[2]||=e=>Y(e,p(y)(`common.preview`)||`Preview`),onMouseleave:X,onBlur:X},h(p(y)(`common.preview`)||`Preview`),35),l(`button`,{type:`button`,class:m([`mode-btn px-2 py-0.5 rounded`,w.value?`is-active`:``]),onClick:t[3]||=e=>Ke(`source`),onMouseenter:t[4]||=e=>Y(e,p(y)(`common.source`)||`Source`),onFocus:t[5]||=e=>Y(e,p(y)(`common.source`)||`Source`),onMouseleave:X,onBlur:X},h(p(y)(`common.source`)||`Source`),35)])):s(``,!0),_.showCopyButton?(n(),g(`button`,{key:1,type:`button`,class:`d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md`,"aria-label":b.value?p(y)(`common.copied`)||`Copied`:p(y)(`common.copy`)||`Copy`,onClick:We,onMouseenter:t[6]||=e=>Ue(e),onFocus:t[7]||=e=>Ue(e),onMouseleave:X,onBlur:X},[b.value?(n(),g(`svg`,ve,[...t[13]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M20 6L9 17l-5-5`},null,-1)]])):(n(),g(`svg`,_e,[...t[12]||=[l(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[l(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),l(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})],-1)]]))],40,ge)):s(``,!0),_.showExportButton&&B.value?(n(),g(`button`,{key:2,type:`button`,class:`d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md`,"aria-label":p(y)(`common.export`)||`Export`,onClick:Qe,onMouseenter:t[8]||=e=>Y(e,p(y)(`common.export`)||`Export`),onFocus:t[9]||=e=>Y(e,p(y)(`common.export`)||`Export`),onMouseleave:X,onBlur:X},[...t[14]||=[l(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`})],-1)]],40,ye)):s(``,!0),_.showCollapseButton?(n(),g(`button`,{key:3,type:`button`,class:`d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md`,"aria-pressed":x.value,onClick:Ge,onMouseenter:t[10]||=e=>Y(e,x.value?p(y)(`common.expand`)||`Expand`:p(y)(`common.collapse`)||`Collapse`),onFocus:t[11]||=e=>Y(e,x.value?p(y)(`common.expand`)||`Expand`:p(y)(`common.collapse`)||`Collapse`),onMouseleave:X,onBlur:X},[(n(),g(`svg`,{style:u({rotate:x.value?`0deg`:`90deg`}),xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,class:`action-icon`},[...t[15]||=[l(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m9 18l6-6l-6-6`},null,-1)]],4))],40,be)):s(``,!0)])])):s(``,!0),r(l(`div`,{ref_key:`bodyRef`,ref:N,class:`d2-block-body`,style:u(Re.value)},[_.loading&&!Le.value?(n(),g(`div`,xe,[l(`pre`,Se,[l(`code`,null,h(R.value),1)]),E.value?(n(),g(`p`,Ce,h(E.value),1)):s(``,!0)])):(n(),g(`div`,we,[V.value?(n(),g(`div`,Te,[l(`pre`,Ee,[l(`code`,null,h(R.value),1)]),E.value?(n(),g(`p`,De,h(E.value),1)):s(``,!0)])):(n(),g(`div`,{key:1,class:`d2-render`,style:u(ze.value)},[l(`div`,{class:`d2-svg`,innerHTML:O.value},null,8,Oe),E.value?(n(),g(`p`,ke,h(E.value),1)):s(``,!0)],4))]))],4),[[c,!x.value]])],10,fe))}}),[[`__scopeId`,`data-v-3b434cf5`]]);w.install=e=>{e.component(w.__name,w)};export{w as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/assets/index9-BNCeHK1v.js b/apps/pythinker-code/dist-web/assets/index9-C3TPz6s3.js similarity index 99% rename from apps/pythinker-code/dist-web/assets/index9-BNCeHK1v.js rename to apps/pythinker-code/dist-web/assets/index9-C3TPz6s3.js index 23819eaa5..56f2b48aa 100644 --- a/apps/pythinker-code/dist-web/assets/index9-BNCeHK1v.js +++ b/apps/pythinker-code/dist-web/assets/index9-C3TPz6s3.js @@ -1,2 +1,2 @@ -import{A as e,F as t,G as n,I as r,L as i,N as a,R as o,V as s,_ as c,d as l,et as u,g as d,h as f,j as ee,k as te,lt as ne,m as p,nt as m,ot as re,rt as ie,st as ae,ut as oe,v as h,w as se,x as ce,z as le}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{C as ue,E as de,S as g,_ as fe,b as pe,c as me,f as he,k as ge,m as _e,u as ve,y as ye}from"./index-DAFMRqR8.js";var be=Object.defineProperty,_=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,v=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Te=(e,t)=>{for(var n in t||={})Ce.call(t,n)&&v(e,n,t[n]);if(Se)for(var n of Se(t))we.call(t,n)&&v(e,n,t[n]);return e},Ee=(e,t)=>_(e,xe(t)),De=(e,t,n)=>v(e,typeof t==`symbol`?t:t+``,n),Oe=[`data-markstream-item-key`,`data-markstream-item-kind`],ke={key:0,class:`markstream-virtual-timeline__status`},y=.5,Ae=fe(se(Ee(Te({},{name:`MarkstreamVirtualTimeline`}),{__name:`MarkstreamVirtualTimeline`,props:{items:{},threadKey:{},layoutRevision:{},getKey:{},getKind:{},getContent:{},getFinal:{},getRevision:{},estimateItemHeight:{},overscan:{default:4},overscanPx:{default:1200},stickToBottom:{type:[Boolean,String],default:`auto`},measurementKey:{},markdownMode:{default:`docs`},markdownCodeRenderer:{},initialThreadState:{},markdownFade:{type:Boolean,default:!1},restoreMaxLoadingMs:{type:[Number,Boolean],default:!1},debug:{type:Boolean}},emits:[`height-change`,`virtual-state-change`,`range-change`,`thread-state-change`],setup(se,{expose:fe,emit:be}){let _=se,xe=be;function Se(e){xe(`thread-state-change`,e)}function Ce(e){return e===`measured`||e===`final`}function we(e){return!0===e?.stable&&function(e){if(!e)return!1;let t=Number(e.nodeCount),n=Number(e.measuredCount),r=Math.max(0,Number(e.liveRange?.start??0)),i=Math.min(t,Math.max(r,Number(e.liveRange?.end??0))),a=Math.max(0,i-r);return!0===e.final&&e.confidence===`mixed`&&t>0&&n>0&&n=a)}(e)}let v=new Map;function Ae(e){!0===_.debug&&v.set(e,(v.get(e)??0)+1)}let b=m(null),x=m(0),S=m(0),C=m(0),w=m(!0),T=m(!0),E=u(new Map),D=new Map,O=new Map,k=new Map,A=new Map,j=new Set,M=u(new Map),je=u(new Map),Me=new Map,N=new Map,Ne=new Map,Pe=new Map,P=m(!1),F=m(!0);i(`markstreamHostScrollManaged`,m(!0));let Fe=[0,80,180,360,640],Ie,I,Le=null,L=null,Re=0,R=null,ze=[],z=null,B=null,Be=-1,V=0,H=null,Ve=!1,He=!1,Ue=null,We=0,Ge=0,Ke={top:0,bottom:0},qe=!1,U=p(()=>_.threadKey==null?void 0:String(_.threadKey)),Je=U.value;function Ye(e){return e===`chat`||e===`minimal`||e===`docs`?e:`docs`}let Xe=p(()=>Ye(_.markdownMode)),Ze=p(()=>function(e,t=Ye(_.markdownMode)){return e===`pre`||e===`shiki`||e===`monaco`?e:t===`docs`?`monaco`:`pre`}(_.markdownCodeRenderer,Xe.value)),Qe=p(()=>[_.measurementKey==null?``:String(_.measurementKey),C.value].join(`:`)),$e=p(()=>`${Qe.value}${Xe.value}${Ze.value}`);class et{constructor(e){De(this,`tree`),De(this,`total`),this.tree=Array.from({length:e.length+1},()=>0),this.total=0,e.forEach((e,t)=>this.add(t,e))}add(e,t){if(Number.isFinite(t)&&t!==0){this.total+=t;for(let n=e+1;n0;)n+=this.tree[t],t-=t&-t;return n}lowerBound(e,t=`gte`){let n=this.tree.length-1;if(n<=0||e<=0)return 0;if(e>=this.total)return n-1;let r=0,i=1;for(;i<<10;i>>=1){let n=r+i;if(n(rt.value,{records:tt.value,totalHeight:nt.value.total}));function at(){let e=[],t=[],n=function(){return U.value??`timeline`}();W.clear();for(let r=0;r<_.items.length;r++){let i=_.items[r],a=ft(i,r),o={item:i,index:r,key:a,kind:de(i,r,_),markdown:_e(i,r,_)},s=wt(o);s??=it[r]??he(i,r,_);let c=Ee(Te({},o),{renderKey:`${n}:${a}`,offset:0,size:s,component:i?.component});e.push(c),t.push(s),W.has(a)||W.set(a,c)}tt.value=e,nt.value=new et(t),it=[],rt.value+=1}function ot(e){return rt.value,nt.value.prefixSum(e.index)}function st(e){return Ee(Te({},e),{offset:ot(e)})}function ct(e,t){let n=W.get(e);if(!n)return;let r=Math.ceil(t),i=r-n.size;i!==0&&(n.size=r,nt.value.add(n.index,i),rt.value+=1)}function lt(e,t=`gte`){return rt.value,nt.value.lowerBound(e,t)}let ut=p(()=>Math.max(0,_.overscan??4)),dt=p(()=>{let e=Math.max(0,_.overscanPx??1200);return F.value?e:Math.min(e,160)}),K=p(()=>{let e=G.value.records;if(e.length===0)return{start:0,end:0,records:[],topSpacerHeight:0,bottomSpacerHeight:0};let t=ut.value,n=dt.value,r=Rt(),i=r+Math.max(1,S.value),a=lt(Math.max(0,r-n),`gt`),o=lt(Math.min(G.value.totalHeight,i+n))+1;a=Math.max(0,a-t),o=Math.min(e.length,Math.max(o+t,a+1));let s=e.slice(a,o).map(st),c=s[0],l=s[s.length-1],u=c?.offset??0,d=l?.offset??0;return{start:a,end:o,records:s,topSpacerHeight:u,bottomSpacerHeight:Math.max(0,G.value.totalHeight-(d+(l?.size??0)))}});function ft(e,t){return pe(e,t,_)}let pt=new WeakMap,mt=1;function q(e){if(typeof e!=`object`&&typeof e!=`function`||e===null)return String(e??``);let t=e,n=pt.get(t);return n||(n=mt++,pt.set(t,n)),String(n)}function ht(e,t,n){if(n)return``;let r=typeof e?.text==`string`?e.text:typeof e?.message==`string`?e.message:typeof e?.label==`string`?e.label:String(g(e,t,_)??``);return r?`${r.length}:${function(e){let t=2166136261;for(let n=0;n>>0).toString(36)}(r)}`:``}function gt(e,t){if(typeof _.estimateItemHeight!=`function`)return``;let n=_.estimateItemHeight(e,t);if(!Number.isFinite(n)||n<=0)return``;let r=Math.ceil(n);return it[t]=r,String(r)}function J(e){return _.items[e.index]??e.item}function _t(e){return e.item}function vt(e){return J(e)?.component??e.component}function yt(e,t=U.value){let n=ue(_t(e),e.index,_);return[t??`timeline`,e.key,n==null?``:String(n)].join(`:`)}function bt(e,t=U.value){if(e.markdown)return yt(e,t);let n=ue(_t(e),e.index,_);return[t??`timeline`,e.key,n==null?``:String(n)].join(`:`)}function xt(e){return{sourceKey:bt(e),measurementKey:e.markdown?$e.value:Qe.value,widthBucket:C.value}}function St(e,t){return(e?.sourceKey??``)===(t?.sourceKey??``)&&(e?.measurementKey??``)===(t?.measurementKey??``)&&(e?.widthBucket??0)===(t?.widthBucket??0)}function Ct(e,t,n=U.value){return!(!e||!t)&&t.sourceKey===bt(e,n)&&t.measurementKey===(e.markdown?$e.value:Qe.value)&&(t.widthBucket??0)===C.value}function wt(e,t=U.value){let n=E.get(e.key);return Ct(e,D.get(e.key),t)&&Number.isFinite(n)&&n>0?n:null}function Tt(e){return G.value,W.get(e)}function Et(e,t){return!!(e&&e.markdown&&t)&&t.sessionKey===yt(e)&&(t.threadKey??``)===(U.value??``)&&!!function(e){let t=$e.value,n=e??``;return n===t||n.startsWith(`${t}\0`)}(t.measurementKey)}function Dt(e,t){return Et(e,t)}function Ot(e,t,n){!Number.isFinite(t)||t<=0||(je.set(e,Math.ceil(t)),Me.set(e,n))}function kt(e,t=M.get(e)){let n=function(e,t=M.get(e)){if(!Dt(Tt(e),t))return 0;let n=Number(t?.metrics?.totalHeight);return Number.isFinite(n)&&n>0?Math.ceil(n):0}(e,t);return n>0&&Ot(e,n,t),n}function At(e){return Et(Tt(e),Me.get(e))?je.get(e)??0:kt(e)}function jt(e){return e===Re&&V===e&&!F.value}function Mt(){if(R!=null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(R),R=null,z!=null&&typeof window<`u`&&window.clearTimeout(z),z=null,typeof window<`u`)for(let e of ze)window.clearTimeout(e);ze=[]}function Nt(){return Math.max(0,S.value||b.value?.clientHeight||0)}function Pt(){let e=b.value;if(!e||typeof getComputedStyle!=`function`)return void(Ke={top:0,bottom:0});let t=getComputedStyle(e);Ke={top:Number.parseFloat(t.paddingTop)||0,bottom:Number.parseFloat(t.paddingBottom)||0}}function Ft(){return Ke.top}function It(){let e=Ke;return Math.max(0,G.value.totalHeight+e.top+e.bottom)}function Lt(){return Math.max(It(),b.value?.scrollHeight??0)}function Rt(){return Math.max(0,x.value-Ft())}function Y(){return Math.max(0,Lt()-Nt())}function zt(e){let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(t,Y())):0}function Bt(){return Math.max(0,Y()-x.value)}function Vt(){let e=Bt();T.value=e<=2,!0===_.stickToBottom?w.value=!0:!1===_.stickToBottom?w.value=!1:w.value=e<=48}function Ht(){let e=b.value?.clientWidth??0;C.value=Number.isFinite(e)&&e>0?32*Math.round(e/32):0}function X(e={}){let t=b.value;t&&(x.value=Math.max(0,t.scrollTop||0),S.value=t.clientHeight||0),Ht(),Vt(),(!0===e.remember||!1!==e.remember&&!P.value)&&Q()}function Ut(e,t={}){let n=zt(e),r=b.value;if(x.value=n,r&&(S.value=r.clientHeight||S.value||0,!1!==t.writeDom&&Math.abs((r.scrollTop||0)-n)>y)){let e={target:n,preserveBottomPin:!1!==_.stickToBottom&&Math.abs(Y()-n)<=2};L=F.value?e:null,r.scrollTop=n,e.target=Math.max(0,r.scrollTop||0)}Ht(),!1!==t.updatePinned&&Vt(),(!0===t.remember||!1!==t.remember&&!P.value)&&Q()}function Wt(){if(!F.value){L=null;let e=b.value,t=H;e&&t!=null&&Math.abs((e.scrollTop||0)-t)>y&&(e.scrollTop=t),$(V,I);return}let e=b.value,t=L,n=Math.max(0,e?.scrollTop||0);e&&t&&Math.abs(n-t.target)<=y&&t.preserveBottomPin&&!1!==_.stickToBottom||e&&T.value&&_.stickToBottom===`auto`&&(Math.abs(Y()-n)<=2||n>=x.value-y)||!0===_.stickToBottom?(w.value=!0,T.value=!0,Ut(Y(),{writeDom:!0,remember:!1})):(L=null,X())}function Gt(e){Ut(e,{writeDom:!0,remember:!0})}function Kt(){Gt(Y())}function qt(e,t){let n=O.get(e);if(!Number.isFinite(n)||n==null||n<=0)return 0;let r=k.get(e);return t&&r&&!Jt(r,t)?0:Math.ceil(n)}function Jt(e,t){return e.sourceKey===t.sourceKey&&((t.widthBucket??0)===0||(e.widthBucket??0)===0||(t.widthBucket??0)===(e.widthBucket??0))&&(Yt(t.measurementKey)||Yt(e.measurementKey)||t.measurementKey===e.measurementKey)}function Yt(e){return e===`:0`||!0===e?.startsWith(`:0`)}function Xt(e){O.delete(e),k.delete(e),A.delete(e),j.delete(e)}function Zt(t,n,r,i={}){if(!Number.isFinite(n)||n<=0)return;let a=E.get(t),o=r&&!St(D.get(t),r),s=!0===i.releaseRestoredFloor;(function(e,t){if(!t)return;let n=k.get(e);n&&!Jt(n,t)&&(O.delete(e),k.delete(e),A.delete(e),j.delete(e))})(t,r),s&&Xt(t);let c=qt(t,r),l=c>0?c:Math.ceil(n);if(a!=null&&Math.abs(a-l)<=1&&!o)return void(s&&(rt.value+=1));if(!1===i.updateLayout)return r&&D.set(t,r),E.set(t,l),void gn(i.rememberThreadKey);if(P.value)return r&&D.set(t,r),E.set(t,l),ct(t,l),void function(t=V,n=I){n&&e(()=>{$(t,n),R==null&&typeof requestAnimationFrame==`function`&&(R=requestAnimationFrame(()=>{R=null,$(t,n)}))})}();let u=(d=pn(),f=Bt(),!0===_.stickToBottom?{type:`bottom`,distanceFromBottomPx:0}:_.stickToBottom===`auto`&&w.value?{type:`bottom`,distanceFromBottomPx:T.value?0:Math.max(0,f)}:d);var d,f;r&&D.set(t,r),E.set(t,l),ct(t,l),gn(i.rememberThreadKey),function(e){if(!Z.scheduled)return Z.anchor=e,Z.scheduled=!0,void(Z.raf=tn(rn));!Z.anchor&&e&&(Z.anchor=e)}(u)}n([()=>function(){let e=_.layoutRevision;return e==null?_.items.map((e,t)=>{let n=ft(e,t),r=_e(e,t,_);return[n,de(e,t,_),+!!r,ue(e,t,_)??``,gt(e,t),ht(e,t,r),(i=e?.component,i?typeof i==`string`?`s:${i}`:`o:${q(i)}`:``)].join(``);var i}).join(`\0`):[`explicit`,String(e),_.items.length].join(``)}(),Qe,$e,U,()=>q(_.estimateItemHeight),()=>q(_.getKey),()=>q(_.getKind),()=>q(_.getContent),()=>q(_.getFinal),()=>q(_.getRevision)],()=>at(),{immediate:!0,flush:`sync`});let Z={scheduled:!1,raf:null,anchor:void 0},Qt=new Map,$t=!1,en=null;function tn(t){return typeof requestAnimationFrame==`function`?requestAnimationFrame(t):(e(t),null)}function nn(e){e!=null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(e)}function rn(){if(!Z.scheduled)return;Z.scheduled=!1,Z.raf=null;let e=Z.anchor;Z.anchor=void 0;let t=e?.type===`bottom`&&e.distanceFromBottomPx<=2&&T.value;e&&vn(e);let n=b.value,r=!n||Math.abs((n.scrollTop||0)-x.value)<=y;t&&!r||X({remember:!1})}function an(){if(!$t)return;$t=!1,en=null;let e=Array.from(Qt.entries());Qt.clear();for(let[t,n]of e){if(je.get(t)!==n.logicalHeight)continue;let e=W.get(t);if(!e)continue;let r=(n.threadKey??``)===(U.value??``);cn(e,{allowMarkdownShrink:n.allowMarkdownShrink,allowRestoredFloorShrink:n.allowRestoredFloorShrink,markdownLogicalHeight:n.logicalHeight,rememberThreadKey:n.threadKey,source:n.itemSizeSource,updateLayout:r})}rn()}function on(){an(),rn()}function sn(e){var t;(t=Ne.get(e))==null||t.disconnect(),Ne.delete(e),N.delete(e)}function cn(e,t={}){var n;let r=(i=e.key,ve(N.get(i),Ae));var i;let a=t.source??xt(e),o=!1,s=()=>{o||(o=!0,function(e,t){let n=function(){if(!0!==_.debug||v.size===0)return null;let e=0;for(let t of v.values())e+=t;let t={total:e,byLabel:Object.fromEntries(Array.from(v.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])))};return v.clear(),t}();n&&console.info(`[markstream-vue][timeline][perf] layout-reads`,{label:e,itemKey:t,layoutReads:n})}(`reconcileRecordSize`,e.key))};if(!e.markdown)return r>0&&Zt(e.key,r,a,t),void s();let c=St(D.get(e.key),a)&&(n=E.get(e.key))!=null?n:0,l=t.markdownLogicalHeight??At(e.key),u=function(e,t){return me(N.get(e),Ae,t)}(e.key,r);if(l>0){let n=Math.max(r,l+u);(!t.allowMarkdownShrink||P.value)&&c>0&&(n=Math.max(n,c));let i=qt(e.key,a),o=i>0&&n>i+1&&(!ye(J(e),e.index,_)||!0===t.allowRestoredFloorShrink);e.markdown&&i>0&&(!0===t.allowRestoredFloorShrink||o)?P.value?j.add(e.key):t=Ee(Te({},t),{releaseRestoredFloor:!0}):t.allowMarkdownShrink&&!P.value&&(i<=0||t.allowRestoredFloorShrink&&function(e,t,n){let r=A.get(e);return!Number.isFinite(r)||r==null||r<=0||t+Math.max(0,n-r)0&&Zt(e.key,n,a,t),s();return}String(g(J(e),e.index,_)).trim()?c>0?(r>c+1&&Zt(e.key,r,a,t),s()):(r>0&&Zt(e.key,r,a,t),s()):(r>0&&(Xt(e.key),Zt(e.key,r,a,t)),s())}function ln(e){return t=>{(function(e,t){let n=function(e){let t=e&&`$el`in e?e.$el:e;return t instanceof HTMLElement?t:null}(t),r=N.get(e.key);if(!n)return void sn(e.key);if(r===n)return void cn(e);if(sn(e.key),N.set(e.key,n),cn(e),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(()=>{cn(e)});i.observe(n),Ne.set(e.key,i)})(e,t)}}function un(e){let t=J(e),n=ye(t,e.index,_),r=M.get(e.key),i=Xe.value,a=Ze.value,o={enabled:!0,sessionKey:yt(e),threadKey:U.value,scrollRoot:()=>b.value,restoreState:Dt(e,r)?r:null,restoreAnchor:!1,measurementKey:$e.value,settleMode:`manual`,settledToken:n,emitIntervalMs:96,heightDiffThresholdPx:4};return Ee(Te({content:g(t,e.index,_),final:n,mode:i,codeRenderer:a},n?{nodeVirtual:`auto`,maxLiveNodes:50,liveNodeBuffer:16}:{}),{fade:!0===_.markdownFade,indexKey:yt(e),virtualScroll:o,onHeightChange(t){if(t.sessionKey!==yt(e))return;Ot(e.key,t.totalHeight,{sessionKey:t.sessionKey,threadKey:U.value,measurementKey:$e.value});let n=function(e){return e.phase===`final`||!(!0!==e.final||!Ce(e.confidence))||!!e.stable&&(Ce(e.confidence)||we(e))}(t),r=function(e){return e.phase===`final`||!!e.stable&&(Ce(e.confidence)||we(e))}(t),i=Math.ceil(t.totalHeight);var a;(function(e,t){Qt.set(e.key,t),$t||($t=!0,en=tn(an))})(e,{allowMarkdownShrink:n,allowRestoredFloorShrink:r,itemSizeSource:xt(e),logicalHeight:i,threadKey:U.value}),a={itemKey:e.key,metrics:t},xe(`height-change`,a)},onVirtualStateChange(t){var n;t.sessionKey===yt(e)&&(M.set(e.key,t),kt(e.key,t),gn(),n={itemKey:e.key,state:t},xe(`virtual-state-change`,n))}})}function dn(e){return{item:J(e),index:e.index,itemKey:e.key,kind:e.kind,measureRef:ln(e),markdownProps:un(e)}}function fn(e){let t=J(e)??{};return typeof t.text==`string`?t.text:typeof t.message==`string`?t.message:typeof t.label==`string`?t.label:g(t,e.index,_)}function pn(){let e=Bt();if(e<=2)return{type:`bottom`,distanceFromBottomPx:Math.max(0,e)};let t=Rt(),n=lt(t,`gt`),r=G.value.records[n];if(r){let e=ot(r);if(t>=e&&t{B=null,hn()},80):hn()))}function _n(e){if(!e)return null;if(e.type===`bottom`)return(F.value?Lt():It())-Nt()-Math.max(0,e.distanceFromBottomPx);let t=Tt(e.itemKey);return t?Ft()+ot(t)+Math.max(0,e.offsetWithinItemPx):null}function vn(e,t={}){let n=_n(e);return n!=null&&(Ut(n,{writeDom:!0,remember:!0===t.remember}),!0)}function $(e,t){e===Re&&(t&&(H=vn(t,{remember:!1})?x.value:null),X({remember:!1}))}function yn(e,t){let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>t.top&&n.topr.top&&n.top0&&n.height>0}function Sn(e){if(!e||e.classList.contains(`is-fading-out`))return!1;let t=window.getComputedStyle(e);if(t.display===`none`||Number.parseFloat(t.opacity||`1`)<=.01)return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0}function Cn(e){return Array.from(e.querySelectorAll([`[data-markstream-pending="true"]`,`[data-markstream-mermaid][data-markstream-mode="pending"]`,`.mermaid-block-container[data-markstream-mode="pending"]`,`[data-markstream-code-loading="1"]`].join(`,`))).some(e=>!e.matches(`[data-markstream-code-block="1"]`)||!Sn(e.querySelector(`pre.code-pre-fallback`)))}function wn(e){if(e.querySelector(`:scope > .node-placeholder`))return!1;let t=e.querySelector(`:scope > .node-content`);return!!t&&!Cn(t)&&!!function(e){let t=Array.from(e.querySelectorAll(`[data-markstream-math]`));return!t.length||t.every(e=>{let t=e.dataset.markstreamMode;return!(e.dataset.markstreamPending===`true`||t===`loading`||t!==`katex`&&t!==`fallback`)})}(t)&&((e.dataset.nodeType??``)===`code_block`?function(e){if(e.querySelector(`[data-markstream-code-loading="1"]`))return!1;let t=e.querySelector(`[data-markstream-code-block="1"]`);if(t){let e=t.dataset.markstreamEnhanced===`true`,r=Sn(t.querySelector(`pre.code-pre-fallback`));return e||r||(n=t,Array.from(n.querySelectorAll(`.monaco-editor, .monaco-diff-editor`)).some(xn))}var n;return function(e){let t=e.querySelector(`[data-markstream-mermaid], .mermaid-block-container`);if(t){if(t.dataset.markstreamPending===`true`)return!1;let e=t.dataset.markstreamMode;return e===`preview`?!!(t.querySelector(`svg`)||t.querySelector(`[data-mermaid-svg-layer="1"] svg`)):e===`fallback`&&!!(t.querySelector(`.mermaid-source-code`)?.textContent)?.trim()}let n=e.querySelector(`[data-markstream-infographic], .infographic-block-container`);if(n)return n.dataset.markstreamPending!==`true`;let r=e.querySelector(`[data-markstream-d2], .d2-block-container`);return r?r.dataset.markstreamPending!==`true`:!!e.querySelector(`pre[data-markstream-pre="1"]`)}(e)}(t):function(e){return(e.textContent??``).trim().length>0||!!e.querySelector([`hr`,`br`,`table`,`blockquote`,`img`,`svg`,`canvas`,`input`,`button`,`select`,`textarea`,`[role]`,`[aria-label]`,`[data-markstream-math]`,`[data-markstream-mermaid]`,`[data-markstream-infographic]`,`[data-markstream-d2]`,`[data-markstream-pre="1"]`].join(`,`))}(t))}function Tn(e,t){if(!e.markdown)return!0;let n=g(J(e),e.index,_);if(!String(n??``).trim()||t.querySelector(`[data-node-index]`))return!0;let r=t.querySelector(`.markdown-renderer`)??t;return!Cn(r)&&(!!(r.textContent??``).trim()||!!r.querySelector([`hr`,`br`,`table`,`blockquote`,`img`,`svg`,`canvas`,`input`,`button`,`[role]`,`[aria-label]`,`[data-markstream-math]`,`[data-markstream-mermaid]`,`[data-markstream-infographic]`,`[data-markstream-d2]`,`[data-markstream-pre="1"]`,`[data-markstream-code-block="1"]`].join(`,`)))}function En(e,t,n){if(!e.markdown)return!0;let r=g(J(e),e.index,_);if(!String(r??``).trim())return!0;let i=n.getBoundingClientRect(),a=Array.from(t.querySelectorAll(`[data-node-index]`)).filter(e=>yn(e,i));if(a.length>0)return a.every(e=>wn(e));let o=t.querySelector(`.markdown-renderer`)??t;return o.querySelector(`[data-node-index], .node-placeholder`)?!!function(e,t,n,r){if(!Dn(e))return!1;let i=n.getBoundingClientRect(),a=t.getBoundingClientRect();return i.width>0&&i.height>0&&i.bottom<=r.top+1&&a.bottom>r.top}(e,t,o,i)&&Tn(e,t):Tn(e,t)}function Dn(e){let t=D.get(e.key);return qt(e.key,t)>0}function On(e,t){if(!e.markdown||!Ve&&!He||Dn(e))return!0;let n=g(J(e),e.index,_);if(!String(n??``).trim())return!0;if(!t.querySelector(`.markdown-renderer`))return!1;let r=M.get(e.key);if(!Dt(e,r))return!1;let i=r?.metrics,a=Number(i?.totalHeight??0);if(!Number.isFinite(a)||a<=0)return!1;let o=Number(i?.measuredCount??0),s=Number(i?.estimatedCount??0),c=Number(i?.nodeCount??0),l=c<=0||o>=c&&s<=0,u=Ce(i?.confidence),d=we(i),f=!0===i?.stable||u||d;return He?!0===i?.final&&(l&&u||d):f||!0===i?.final}function kn(){let e=b.value;if(!e)return!1;let t=_n(I);if(t!=null&&Math.abs((e.scrollTop||0)-zt(t))>y)return!1;let n=K.value.records;if(!n.length)return G.value.records.length===0;let r=new Map(Array.from(e.querySelectorAll(`[data-markstream-item-key]`)).map(e=>[e.dataset.markstreamItemKey??``,e])),i=[];for(let t of n){let n=r.get(t.key);n&&bn(n,e)&&i.push({record:t,el:n})}if(!i.length)return!1;for(let{record:t,el:n}of i)if(n.offsetHeight+1!(!yn(e,a)||e.matches(`[data-markstream-code-block="1"]`)&&Sn(e.querySelector(`pre.code-pre-fallback`)))))return!1;let o=Array.from(e.querySelectorAll(`[data-node-index]`)).filter(e=>yn(e,a));for(let e of o)if(!wn(e))return!1;return!0}function An(){let e=b.value;if(!e)return``;let t=e.getBoundingClientRect(),n=new Map(Array.from(e.querySelectorAll(`[data-markstream-item-key]`)).map(e=>[e.dataset.markstreamItemKey??``,e])),r=K.value.records.map(e=>{let t=n.get(e.key),r=t?.querySelector(`.markdown-renderer`),i=M.get(e.key)?.metrics;return[e.key,e.size,t?.offsetHeight??0,t?.scrollHeight??0,r?.offsetHeight??0,r?.scrollHeight??0,i?Math.round(Number(i.totalHeight||0)):``,i?.measuredCount??``,i?.estimatedCount??``,i?.nodeCount??``,+(!0===i?.final),+(!0===i?.stable),i?.confidence??``].join(`:`)}).join(`|`),i=Array.from(e.querySelectorAll(`[data-node-index]`)).filter(e=>yn(e,t)).map(e=>{let t=e.getBoundingClientRect(),n=e.querySelector(`:scope > .node-content`),r=n?.querySelector(`[data-markstream-code-block="1"]`),i=n?.querySelector(`pre.code-pre-fallback`),a=n?.querySelector(`.monaco-editor, .monaco-diff-editor`);return[e.dataset.nodeIndex??``,e.dataset.nodeType??``,Math.round(t.height),n?.offsetHeight??0,n?.scrollHeight??0,r?.dataset.markstreamEnhanced??``,r?Math.round(r.getBoundingClientRect().height):0,i?Math.round(i.getBoundingClientRect().height):0,a?Math.round(a.getBoundingClientRect().height):0].join(`:`)}).join(`|`);return[Math.round(e.scrollTop||0),Math.round(e.scrollHeight||0),Math.round(G.value.totalHeight||0),r,i].join(` +import{A as e,F as t,G as n,I as r,L as i,N as a,R as o,V as s,_ as c,d as l,et as u,g as d,h as f,j as ee,k as te,lt as ne,m as p,nt as m,ot as re,rt as ie,st as ae,ut as oe,v as h,w as se,x as ce,z as le}from"./vue.runtime.esm-bundler-Cwbj1t-C.js";import{C as ue,E as de,S as g,_ as fe,b as pe,c as me,f as he,k as ge,m as _e,u as ve,y as ye}from"./index-CJN6blp7.js";var be=Object.defineProperty,_=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,v=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Te=(e,t)=>{for(var n in t||={})Ce.call(t,n)&&v(e,n,t[n]);if(Se)for(var n of Se(t))we.call(t,n)&&v(e,n,t[n]);return e},Ee=(e,t)=>_(e,xe(t)),De=(e,t,n)=>v(e,typeof t==`symbol`?t:t+``,n),Oe=[`data-markstream-item-key`,`data-markstream-item-kind`],ke={key:0,class:`markstream-virtual-timeline__status`},y=.5,Ae=fe(se(Ee(Te({},{name:`MarkstreamVirtualTimeline`}),{__name:`MarkstreamVirtualTimeline`,props:{items:{},threadKey:{},layoutRevision:{},getKey:{},getKind:{},getContent:{},getFinal:{},getRevision:{},estimateItemHeight:{},overscan:{default:4},overscanPx:{default:1200},stickToBottom:{type:[Boolean,String],default:`auto`},measurementKey:{},markdownMode:{default:`docs`},markdownCodeRenderer:{},initialThreadState:{},markdownFade:{type:Boolean,default:!1},restoreMaxLoadingMs:{type:[Number,Boolean],default:!1},debug:{type:Boolean}},emits:[`height-change`,`virtual-state-change`,`range-change`,`thread-state-change`],setup(se,{expose:fe,emit:be}){let _=se,xe=be;function Se(e){xe(`thread-state-change`,e)}function Ce(e){return e===`measured`||e===`final`}function we(e){return!0===e?.stable&&function(e){if(!e)return!1;let t=Number(e.nodeCount),n=Number(e.measuredCount),r=Math.max(0,Number(e.liveRange?.start??0)),i=Math.min(t,Math.max(r,Number(e.liveRange?.end??0))),a=Math.max(0,i-r);return!0===e.final&&e.confidence===`mixed`&&t>0&&n>0&&n=a)}(e)}let v=new Map;function Ae(e){!0===_.debug&&v.set(e,(v.get(e)??0)+1)}let b=m(null),x=m(0),S=m(0),C=m(0),w=m(!0),T=m(!0),E=u(new Map),D=new Map,O=new Map,k=new Map,A=new Map,j=new Set,M=u(new Map),je=u(new Map),Me=new Map,N=new Map,Ne=new Map,Pe=new Map,P=m(!1),F=m(!0);i(`markstreamHostScrollManaged`,m(!0));let Fe=[0,80,180,360,640],Ie,I,Le=null,L=null,Re=0,R=null,ze=[],z=null,B=null,Be=-1,V=0,H=null,Ve=!1,He=!1,Ue=null,We=0,Ge=0,Ke={top:0,bottom:0},qe=!1,U=p(()=>_.threadKey==null?void 0:String(_.threadKey)),Je=U.value;function Ye(e){return e===`chat`||e===`minimal`||e===`docs`?e:`docs`}let Xe=p(()=>Ye(_.markdownMode)),Ze=p(()=>function(e,t=Ye(_.markdownMode)){return e===`pre`||e===`shiki`||e===`monaco`?e:t===`docs`?`monaco`:`pre`}(_.markdownCodeRenderer,Xe.value)),Qe=p(()=>[_.measurementKey==null?``:String(_.measurementKey),C.value].join(`:`)),$e=p(()=>`${Qe.value}${Xe.value}${Ze.value}`);class et{constructor(e){De(this,`tree`),De(this,`total`),this.tree=Array.from({length:e.length+1},()=>0),this.total=0,e.forEach((e,t)=>this.add(t,e))}add(e,t){if(Number.isFinite(t)&&t!==0){this.total+=t;for(let n=e+1;n0;)n+=this.tree[t],t-=t&-t;return n}lowerBound(e,t=`gte`){let n=this.tree.length-1;if(n<=0||e<=0)return 0;if(e>=this.total)return n-1;let r=0,i=1;for(;i<<10;i>>=1){let n=r+i;if(n(rt.value,{records:tt.value,totalHeight:nt.value.total}));function at(){let e=[],t=[],n=function(){return U.value??`timeline`}();W.clear();for(let r=0;r<_.items.length;r++){let i=_.items[r],a=ft(i,r),o={item:i,index:r,key:a,kind:de(i,r,_),markdown:_e(i,r,_)},s=wt(o);s??=it[r]??he(i,r,_);let c=Ee(Te({},o),{renderKey:`${n}:${a}`,offset:0,size:s,component:i?.component});e.push(c),t.push(s),W.has(a)||W.set(a,c)}tt.value=e,nt.value=new et(t),it=[],rt.value+=1}function ot(e){return rt.value,nt.value.prefixSum(e.index)}function st(e){return Ee(Te({},e),{offset:ot(e)})}function ct(e,t){let n=W.get(e);if(!n)return;let r=Math.ceil(t),i=r-n.size;i!==0&&(n.size=r,nt.value.add(n.index,i),rt.value+=1)}function lt(e,t=`gte`){return rt.value,nt.value.lowerBound(e,t)}let ut=p(()=>Math.max(0,_.overscan??4)),dt=p(()=>{let e=Math.max(0,_.overscanPx??1200);return F.value?e:Math.min(e,160)}),K=p(()=>{let e=G.value.records;if(e.length===0)return{start:0,end:0,records:[],topSpacerHeight:0,bottomSpacerHeight:0};let t=ut.value,n=dt.value,r=Rt(),i=r+Math.max(1,S.value),a=lt(Math.max(0,r-n),`gt`),o=lt(Math.min(G.value.totalHeight,i+n))+1;a=Math.max(0,a-t),o=Math.min(e.length,Math.max(o+t,a+1));let s=e.slice(a,o).map(st),c=s[0],l=s[s.length-1],u=c?.offset??0,d=l?.offset??0;return{start:a,end:o,records:s,topSpacerHeight:u,bottomSpacerHeight:Math.max(0,G.value.totalHeight-(d+(l?.size??0)))}});function ft(e,t){return pe(e,t,_)}let pt=new WeakMap,mt=1;function q(e){if(typeof e!=`object`&&typeof e!=`function`||e===null)return String(e??``);let t=e,n=pt.get(t);return n||(n=mt++,pt.set(t,n)),String(n)}function ht(e,t,n){if(n)return``;let r=typeof e?.text==`string`?e.text:typeof e?.message==`string`?e.message:typeof e?.label==`string`?e.label:String(g(e,t,_)??``);return r?`${r.length}:${function(e){let t=2166136261;for(let n=0;n>>0).toString(36)}(r)}`:``}function gt(e,t){if(typeof _.estimateItemHeight!=`function`)return``;let n=_.estimateItemHeight(e,t);if(!Number.isFinite(n)||n<=0)return``;let r=Math.ceil(n);return it[t]=r,String(r)}function J(e){return _.items[e.index]??e.item}function _t(e){return e.item}function vt(e){return J(e)?.component??e.component}function yt(e,t=U.value){let n=ue(_t(e),e.index,_);return[t??`timeline`,e.key,n==null?``:String(n)].join(`:`)}function bt(e,t=U.value){if(e.markdown)return yt(e,t);let n=ue(_t(e),e.index,_);return[t??`timeline`,e.key,n==null?``:String(n)].join(`:`)}function xt(e){return{sourceKey:bt(e),measurementKey:e.markdown?$e.value:Qe.value,widthBucket:C.value}}function St(e,t){return(e?.sourceKey??``)===(t?.sourceKey??``)&&(e?.measurementKey??``)===(t?.measurementKey??``)&&(e?.widthBucket??0)===(t?.widthBucket??0)}function Ct(e,t,n=U.value){return!(!e||!t)&&t.sourceKey===bt(e,n)&&t.measurementKey===(e.markdown?$e.value:Qe.value)&&(t.widthBucket??0)===C.value}function wt(e,t=U.value){let n=E.get(e.key);return Ct(e,D.get(e.key),t)&&Number.isFinite(n)&&n>0?n:null}function Tt(e){return G.value,W.get(e)}function Et(e,t){return!!(e&&e.markdown&&t)&&t.sessionKey===yt(e)&&(t.threadKey??``)===(U.value??``)&&!!function(e){let t=$e.value,n=e??``;return n===t||n.startsWith(`${t}\0`)}(t.measurementKey)}function Dt(e,t){return Et(e,t)}function Ot(e,t,n){!Number.isFinite(t)||t<=0||(je.set(e,Math.ceil(t)),Me.set(e,n))}function kt(e,t=M.get(e)){let n=function(e,t=M.get(e)){if(!Dt(Tt(e),t))return 0;let n=Number(t?.metrics?.totalHeight);return Number.isFinite(n)&&n>0?Math.ceil(n):0}(e,t);return n>0&&Ot(e,n,t),n}function At(e){return Et(Tt(e),Me.get(e))?je.get(e)??0:kt(e)}function jt(e){return e===Re&&V===e&&!F.value}function Mt(){if(R!=null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(R),R=null,z!=null&&typeof window<`u`&&window.clearTimeout(z),z=null,typeof window<`u`)for(let e of ze)window.clearTimeout(e);ze=[]}function Nt(){return Math.max(0,S.value||b.value?.clientHeight||0)}function Pt(){let e=b.value;if(!e||typeof getComputedStyle!=`function`)return void(Ke={top:0,bottom:0});let t=getComputedStyle(e);Ke={top:Number.parseFloat(t.paddingTop)||0,bottom:Number.parseFloat(t.paddingBottom)||0}}function Ft(){return Ke.top}function It(){let e=Ke;return Math.max(0,G.value.totalHeight+e.top+e.bottom)}function Lt(){return Math.max(It(),b.value?.scrollHeight??0)}function Rt(){return Math.max(0,x.value-Ft())}function Y(){return Math.max(0,Lt()-Nt())}function zt(e){let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(t,Y())):0}function Bt(){return Math.max(0,Y()-x.value)}function Vt(){let e=Bt();T.value=e<=2,!0===_.stickToBottom?w.value=!0:!1===_.stickToBottom?w.value=!1:w.value=e<=48}function Ht(){let e=b.value?.clientWidth??0;C.value=Number.isFinite(e)&&e>0?32*Math.round(e/32):0}function X(e={}){let t=b.value;t&&(x.value=Math.max(0,t.scrollTop||0),S.value=t.clientHeight||0),Ht(),Vt(),(!0===e.remember||!1!==e.remember&&!P.value)&&Q()}function Ut(e,t={}){let n=zt(e),r=b.value;if(x.value=n,r&&(S.value=r.clientHeight||S.value||0,!1!==t.writeDom&&Math.abs((r.scrollTop||0)-n)>y)){let e={target:n,preserveBottomPin:!1!==_.stickToBottom&&Math.abs(Y()-n)<=2};L=F.value?e:null,r.scrollTop=n,e.target=Math.max(0,r.scrollTop||0)}Ht(),!1!==t.updatePinned&&Vt(),(!0===t.remember||!1!==t.remember&&!P.value)&&Q()}function Wt(){if(!F.value){L=null;let e=b.value,t=H;e&&t!=null&&Math.abs((e.scrollTop||0)-t)>y&&(e.scrollTop=t),$(V,I);return}let e=b.value,t=L,n=Math.max(0,e?.scrollTop||0);e&&t&&Math.abs(n-t.target)<=y&&t.preserveBottomPin&&!1!==_.stickToBottom||e&&T.value&&_.stickToBottom===`auto`&&(Math.abs(Y()-n)<=2||n>=x.value-y)||!0===_.stickToBottom?(w.value=!0,T.value=!0,Ut(Y(),{writeDom:!0,remember:!1})):(L=null,X())}function Gt(e){Ut(e,{writeDom:!0,remember:!0})}function Kt(){Gt(Y())}function qt(e,t){let n=O.get(e);if(!Number.isFinite(n)||n==null||n<=0)return 0;let r=k.get(e);return t&&r&&!Jt(r,t)?0:Math.ceil(n)}function Jt(e,t){return e.sourceKey===t.sourceKey&&((t.widthBucket??0)===0||(e.widthBucket??0)===0||(t.widthBucket??0)===(e.widthBucket??0))&&(Yt(t.measurementKey)||Yt(e.measurementKey)||t.measurementKey===e.measurementKey)}function Yt(e){return e===`:0`||!0===e?.startsWith(`:0`)}function Xt(e){O.delete(e),k.delete(e),A.delete(e),j.delete(e)}function Zt(t,n,r,i={}){if(!Number.isFinite(n)||n<=0)return;let a=E.get(t),o=r&&!St(D.get(t),r),s=!0===i.releaseRestoredFloor;(function(e,t){if(!t)return;let n=k.get(e);n&&!Jt(n,t)&&(O.delete(e),k.delete(e),A.delete(e),j.delete(e))})(t,r),s&&Xt(t);let c=qt(t,r),l=c>0?c:Math.ceil(n);if(a!=null&&Math.abs(a-l)<=1&&!o)return void(s&&(rt.value+=1));if(!1===i.updateLayout)return r&&D.set(t,r),E.set(t,l),void gn(i.rememberThreadKey);if(P.value)return r&&D.set(t,r),E.set(t,l),ct(t,l),void function(t=V,n=I){n&&e(()=>{$(t,n),R==null&&typeof requestAnimationFrame==`function`&&(R=requestAnimationFrame(()=>{R=null,$(t,n)}))})}();let u=(d=pn(),f=Bt(),!0===_.stickToBottom?{type:`bottom`,distanceFromBottomPx:0}:_.stickToBottom===`auto`&&w.value?{type:`bottom`,distanceFromBottomPx:T.value?0:Math.max(0,f)}:d);var d,f;r&&D.set(t,r),E.set(t,l),ct(t,l),gn(i.rememberThreadKey),function(e){if(!Z.scheduled)return Z.anchor=e,Z.scheduled=!0,void(Z.raf=tn(rn));!Z.anchor&&e&&(Z.anchor=e)}(u)}n([()=>function(){let e=_.layoutRevision;return e==null?_.items.map((e,t)=>{let n=ft(e,t),r=_e(e,t,_);return[n,de(e,t,_),+!!r,ue(e,t,_)??``,gt(e,t),ht(e,t,r),(i=e?.component,i?typeof i==`string`?`s:${i}`:`o:${q(i)}`:``)].join(``);var i}).join(`\0`):[`explicit`,String(e),_.items.length].join(``)}(),Qe,$e,U,()=>q(_.estimateItemHeight),()=>q(_.getKey),()=>q(_.getKind),()=>q(_.getContent),()=>q(_.getFinal),()=>q(_.getRevision)],()=>at(),{immediate:!0,flush:`sync`});let Z={scheduled:!1,raf:null,anchor:void 0},Qt=new Map,$t=!1,en=null;function tn(t){return typeof requestAnimationFrame==`function`?requestAnimationFrame(t):(e(t),null)}function nn(e){e!=null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(e)}function rn(){if(!Z.scheduled)return;Z.scheduled=!1,Z.raf=null;let e=Z.anchor;Z.anchor=void 0;let t=e?.type===`bottom`&&e.distanceFromBottomPx<=2&&T.value;e&&vn(e);let n=b.value,r=!n||Math.abs((n.scrollTop||0)-x.value)<=y;t&&!r||X({remember:!1})}function an(){if(!$t)return;$t=!1,en=null;let e=Array.from(Qt.entries());Qt.clear();for(let[t,n]of e){if(je.get(t)!==n.logicalHeight)continue;let e=W.get(t);if(!e)continue;let r=(n.threadKey??``)===(U.value??``);cn(e,{allowMarkdownShrink:n.allowMarkdownShrink,allowRestoredFloorShrink:n.allowRestoredFloorShrink,markdownLogicalHeight:n.logicalHeight,rememberThreadKey:n.threadKey,source:n.itemSizeSource,updateLayout:r})}rn()}function on(){an(),rn()}function sn(e){var t;(t=Ne.get(e))==null||t.disconnect(),Ne.delete(e),N.delete(e)}function cn(e,t={}){var n;let r=(i=e.key,ve(N.get(i),Ae));var i;let a=t.source??xt(e),o=!1,s=()=>{o||(o=!0,function(e,t){let n=function(){if(!0!==_.debug||v.size===0)return null;let e=0;for(let t of v.values())e+=t;let t={total:e,byLabel:Object.fromEntries(Array.from(v.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])))};return v.clear(),t}();n&&console.info(`[markstream-vue][timeline][perf] layout-reads`,{label:e,itemKey:t,layoutReads:n})}(`reconcileRecordSize`,e.key))};if(!e.markdown)return r>0&&Zt(e.key,r,a,t),void s();let c=St(D.get(e.key),a)&&(n=E.get(e.key))!=null?n:0,l=t.markdownLogicalHeight??At(e.key),u=function(e,t){return me(N.get(e),Ae,t)}(e.key,r);if(l>0){let n=Math.max(r,l+u);(!t.allowMarkdownShrink||P.value)&&c>0&&(n=Math.max(n,c));let i=qt(e.key,a),o=i>0&&n>i+1&&(!ye(J(e),e.index,_)||!0===t.allowRestoredFloorShrink);e.markdown&&i>0&&(!0===t.allowRestoredFloorShrink||o)?P.value?j.add(e.key):t=Ee(Te({},t),{releaseRestoredFloor:!0}):t.allowMarkdownShrink&&!P.value&&(i<=0||t.allowRestoredFloorShrink&&function(e,t,n){let r=A.get(e);return!Number.isFinite(r)||r==null||r<=0||t+Math.max(0,n-r)0&&Zt(e.key,n,a,t),s();return}String(g(J(e),e.index,_)).trim()?c>0?(r>c+1&&Zt(e.key,r,a,t),s()):(r>0&&Zt(e.key,r,a,t),s()):(r>0&&(Xt(e.key),Zt(e.key,r,a,t)),s())}function ln(e){return t=>{(function(e,t){let n=function(e){let t=e&&`$el`in e?e.$el:e;return t instanceof HTMLElement?t:null}(t),r=N.get(e.key);if(!n)return void sn(e.key);if(r===n)return void cn(e);if(sn(e.key),N.set(e.key,n),cn(e),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(()=>{cn(e)});i.observe(n),Ne.set(e.key,i)})(e,t)}}function un(e){let t=J(e),n=ye(t,e.index,_),r=M.get(e.key),i=Xe.value,a=Ze.value,o={enabled:!0,sessionKey:yt(e),threadKey:U.value,scrollRoot:()=>b.value,restoreState:Dt(e,r)?r:null,restoreAnchor:!1,measurementKey:$e.value,settleMode:`manual`,settledToken:n,emitIntervalMs:96,heightDiffThresholdPx:4};return Ee(Te({content:g(t,e.index,_),final:n,mode:i,codeRenderer:a},n?{nodeVirtual:`auto`,maxLiveNodes:50,liveNodeBuffer:16}:{}),{fade:!0===_.markdownFade,indexKey:yt(e),virtualScroll:o,onHeightChange(t){if(t.sessionKey!==yt(e))return;Ot(e.key,t.totalHeight,{sessionKey:t.sessionKey,threadKey:U.value,measurementKey:$e.value});let n=function(e){return e.phase===`final`||!(!0!==e.final||!Ce(e.confidence))||!!e.stable&&(Ce(e.confidence)||we(e))}(t),r=function(e){return e.phase===`final`||!!e.stable&&(Ce(e.confidence)||we(e))}(t),i=Math.ceil(t.totalHeight);var a;(function(e,t){Qt.set(e.key,t),$t||($t=!0,en=tn(an))})(e,{allowMarkdownShrink:n,allowRestoredFloorShrink:r,itemSizeSource:xt(e),logicalHeight:i,threadKey:U.value}),a={itemKey:e.key,metrics:t},xe(`height-change`,a)},onVirtualStateChange(t){var n;t.sessionKey===yt(e)&&(M.set(e.key,t),kt(e.key,t),gn(),n={itemKey:e.key,state:t},xe(`virtual-state-change`,n))}})}function dn(e){return{item:J(e),index:e.index,itemKey:e.key,kind:e.kind,measureRef:ln(e),markdownProps:un(e)}}function fn(e){let t=J(e)??{};return typeof t.text==`string`?t.text:typeof t.message==`string`?t.message:typeof t.label==`string`?t.label:g(t,e.index,_)}function pn(){let e=Bt();if(e<=2)return{type:`bottom`,distanceFromBottomPx:Math.max(0,e)};let t=Rt(),n=lt(t,`gt`),r=G.value.records[n];if(r){let e=ot(r);if(t>=e&&t{B=null,hn()},80):hn()))}function _n(e){if(!e)return null;if(e.type===`bottom`)return(F.value?Lt():It())-Nt()-Math.max(0,e.distanceFromBottomPx);let t=Tt(e.itemKey);return t?Ft()+ot(t)+Math.max(0,e.offsetWithinItemPx):null}function vn(e,t={}){let n=_n(e);return n!=null&&(Ut(n,{writeDom:!0,remember:!0===t.remember}),!0)}function $(e,t){e===Re&&(t&&(H=vn(t,{remember:!1})?x.value:null),X({remember:!1}))}function yn(e,t){let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>t.top&&n.topr.top&&n.top0&&n.height>0}function Sn(e){if(!e||e.classList.contains(`is-fading-out`))return!1;let t=window.getComputedStyle(e);if(t.display===`none`||Number.parseFloat(t.opacity||`1`)<=.01)return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0}function Cn(e){return Array.from(e.querySelectorAll([`[data-markstream-pending="true"]`,`[data-markstream-mermaid][data-markstream-mode="pending"]`,`.mermaid-block-container[data-markstream-mode="pending"]`,`[data-markstream-code-loading="1"]`].join(`,`))).some(e=>!e.matches(`[data-markstream-code-block="1"]`)||!Sn(e.querySelector(`pre.code-pre-fallback`)))}function wn(e){if(e.querySelector(`:scope > .node-placeholder`))return!1;let t=e.querySelector(`:scope > .node-content`);return!!t&&!Cn(t)&&!!function(e){let t=Array.from(e.querySelectorAll(`[data-markstream-math]`));return!t.length||t.every(e=>{let t=e.dataset.markstreamMode;return!(e.dataset.markstreamPending===`true`||t===`loading`||t!==`katex`&&t!==`fallback`)})}(t)&&((e.dataset.nodeType??``)===`code_block`?function(e){if(e.querySelector(`[data-markstream-code-loading="1"]`))return!1;let t=e.querySelector(`[data-markstream-code-block="1"]`);if(t){let e=t.dataset.markstreamEnhanced===`true`,r=Sn(t.querySelector(`pre.code-pre-fallback`));return e||r||(n=t,Array.from(n.querySelectorAll(`.monaco-editor, .monaco-diff-editor`)).some(xn))}var n;return function(e){let t=e.querySelector(`[data-markstream-mermaid], .mermaid-block-container`);if(t){if(t.dataset.markstreamPending===`true`)return!1;let e=t.dataset.markstreamMode;return e===`preview`?!!(t.querySelector(`svg`)||t.querySelector(`[data-mermaid-svg-layer="1"] svg`)):e===`fallback`&&!!(t.querySelector(`.mermaid-source-code`)?.textContent)?.trim()}let n=e.querySelector(`[data-markstream-infographic], .infographic-block-container`);if(n)return n.dataset.markstreamPending!==`true`;let r=e.querySelector(`[data-markstream-d2], .d2-block-container`);return r?r.dataset.markstreamPending!==`true`:!!e.querySelector(`pre[data-markstream-pre="1"]`)}(e)}(t):function(e){return(e.textContent??``).trim().length>0||!!e.querySelector([`hr`,`br`,`table`,`blockquote`,`img`,`svg`,`canvas`,`input`,`button`,`select`,`textarea`,`[role]`,`[aria-label]`,`[data-markstream-math]`,`[data-markstream-mermaid]`,`[data-markstream-infographic]`,`[data-markstream-d2]`,`[data-markstream-pre="1"]`].join(`,`))}(t))}function Tn(e,t){if(!e.markdown)return!0;let n=g(J(e),e.index,_);if(!String(n??``).trim()||t.querySelector(`[data-node-index]`))return!0;let r=t.querySelector(`.markdown-renderer`)??t;return!Cn(r)&&(!!(r.textContent??``).trim()||!!r.querySelector([`hr`,`br`,`table`,`blockquote`,`img`,`svg`,`canvas`,`input`,`button`,`[role]`,`[aria-label]`,`[data-markstream-math]`,`[data-markstream-mermaid]`,`[data-markstream-infographic]`,`[data-markstream-d2]`,`[data-markstream-pre="1"]`,`[data-markstream-code-block="1"]`].join(`,`)))}function En(e,t,n){if(!e.markdown)return!0;let r=g(J(e),e.index,_);if(!String(r??``).trim())return!0;let i=n.getBoundingClientRect(),a=Array.from(t.querySelectorAll(`[data-node-index]`)).filter(e=>yn(e,i));if(a.length>0)return a.every(e=>wn(e));let o=t.querySelector(`.markdown-renderer`)??t;return o.querySelector(`[data-node-index], .node-placeholder`)?!!function(e,t,n,r){if(!Dn(e))return!1;let i=n.getBoundingClientRect(),a=t.getBoundingClientRect();return i.width>0&&i.height>0&&i.bottom<=r.top+1&&a.bottom>r.top}(e,t,o,i)&&Tn(e,t):Tn(e,t)}function Dn(e){let t=D.get(e.key);return qt(e.key,t)>0}function On(e,t){if(!e.markdown||!Ve&&!He||Dn(e))return!0;let n=g(J(e),e.index,_);if(!String(n??``).trim())return!0;if(!t.querySelector(`.markdown-renderer`))return!1;let r=M.get(e.key);if(!Dt(e,r))return!1;let i=r?.metrics,a=Number(i?.totalHeight??0);if(!Number.isFinite(a)||a<=0)return!1;let o=Number(i?.measuredCount??0),s=Number(i?.estimatedCount??0),c=Number(i?.nodeCount??0),l=c<=0||o>=c&&s<=0,u=Ce(i?.confidence),d=we(i),f=!0===i?.stable||u||d;return He?!0===i?.final&&(l&&u||d):f||!0===i?.final}function kn(){let e=b.value;if(!e)return!1;let t=_n(I);if(t!=null&&Math.abs((e.scrollTop||0)-zt(t))>y)return!1;let n=K.value.records;if(!n.length)return G.value.records.length===0;let r=new Map(Array.from(e.querySelectorAll(`[data-markstream-item-key]`)).map(e=>[e.dataset.markstreamItemKey??``,e])),i=[];for(let t of n){let n=r.get(t.key);n&&bn(n,e)&&i.push({record:t,el:n})}if(!i.length)return!1;for(let{record:t,el:n}of i)if(n.offsetHeight+1!(!yn(e,a)||e.matches(`[data-markstream-code-block="1"]`)&&Sn(e.querySelector(`pre.code-pre-fallback`)))))return!1;let o=Array.from(e.querySelectorAll(`[data-node-index]`)).filter(e=>yn(e,a));for(let e of o)if(!wn(e))return!1;return!0}function An(){let e=b.value;if(!e)return``;let t=e.getBoundingClientRect(),n=new Map(Array.from(e.querySelectorAll(`[data-markstream-item-key]`)).map(e=>[e.dataset.markstreamItemKey??``,e])),r=K.value.records.map(e=>{let t=n.get(e.key),r=t?.querySelector(`.markdown-renderer`),i=M.get(e.key)?.metrics;return[e.key,e.size,t?.offsetHeight??0,t?.scrollHeight??0,r?.offsetHeight??0,r?.scrollHeight??0,i?Math.round(Number(i.totalHeight||0)):``,i?.measuredCount??``,i?.estimatedCount??``,i?.nodeCount??``,+(!0===i?.final),+(!0===i?.stable),i?.confidence??``].join(`:`)}).join(`|`),i=Array.from(e.querySelectorAll(`[data-node-index]`)).filter(e=>yn(e,t)).map(e=>{let t=e.getBoundingClientRect(),n=e.querySelector(`:scope > .node-content`),r=n?.querySelector(`[data-markstream-code-block="1"]`),i=n?.querySelector(`pre.code-pre-fallback`),a=n?.querySelector(`.monaco-editor, .monaco-diff-editor`);return[e.dataset.nodeIndex??``,e.dataset.nodeType??``,Math.round(t.height),n?.offsetHeight??0,n?.scrollHeight??0,r?.dataset.markstreamEnhanced??``,r?Math.round(r.getBoundingClientRect().height):0,i?Math.round(i.getBoundingClientRect().height):0,a?Math.round(a.getBoundingClientRect().height):0].join(`:`)}).join(`|`);return[Math.round(e.scrollTop||0),Math.round(e.scrollHeight||0),Math.round(G.value.totalHeight||0),r,i].join(` `)}function jn(){return typeof performance<`u`?performance.now():Date.now()}function Mn(){return He?24:2}function Nn(t){jt(t)&&We!==t&&(We=t,function(t){return n=this,r=function*(){let n=jn(),r=0,i=``;for(let a=0;a<40;a++){if(yield e(),yield new Promise(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>e()):e()}),!jt(t))return!1;$(t,I);let a=jn(),o=kn(),s=o?An():``;if(o&&s===i&&s){if(r+=1,r>=Mn()&&a-n>=96)return!0}else r=0,i=s}return!1},new Promise((e,t)=>{var i=e=>{try{o(r.next(e))}catch(e){t(e)}},a=e=>{try{o(r.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,a);o((r=r.apply(n,null)).next())});var n,r}(t).then(e=>{if(We===t&&(We=0),jt(t))return e?void Rn(t):function(){if(Be<0)return!1;let e=function(){if(!1===_.restoreMaxLoadingMs)return 1/0;let e=Number(_.restoreMaxLoadingMs);return Number.isFinite(e)&&e>0?e:1/0}();return Number.isFinite(e)&&jn()-Be>=e}()?(_.debug,void Rn(t)):(function(e){Ge!==e&&(Ge=e,_.debug)}(t),void function(e){jt(e)&&typeof window<`u`&&(z!=null&&window.clearTimeout(z),z=window.setTimeout(()=>{z=null,jt(e)&&Nn(e)},120))}(t))}))}function Pn(){F.value=!0,Be=-1,We=0,Ge=0,Ve=!1,He=!1,z!=null&&typeof window<`u`&&window.clearTimeout(z),z=null}function Fn(){qe=!0}function In(e){let t=[];if(!function(e){return!!e&&(e.measurementKey??``)===Qe.value&&(e.widthBucket??0)===C.value}(e))return t;for(let[n,r]of Object.entries(e?.itemHeights??{})){if(!Number.isFinite(r)||r<=0)continue;let i=Tt(n),a=e?.itemSizeSources?.[n];Ct(i,a)&&t.push([n,Math.ceil(r),a])}return t}function Ln(e){for(let[t,n]of Object.entries(e?.markdownStates??{}))if(Dt(Tt(t),n))return!0;return!1}function Rn(e){if(e!==Re)return;an();let t=new Set(j);Mt(),$(e,I),P.value=!1,Be=-1,I=void 0,H=null,V=0;for(let e of G.value.records)e.markdown&&!t.has(e.key)||Xt(e.key);for(let e of t){let t=W.get(e);t?cn(t,{allowMarkdownShrink:!0,allowRestoredFloorShrink:!0,markdownLogicalHeight:At(t.key),source:xt(t),updateLayout:!0}):Xt(e)}j.clear(),rn(),X({remember:!1}),Pn(),Fn()}function zn(t,n={}){let r=++Re;L=null,t!=null&&t.widthBucket&&C.value===0&&(C.value=t.widthBucket);let i=t?.outerAnchor,a=function(e){return!!(e?.outerAnchor||In(e).length>0||Ln(e))}(t),o=Ln(t),s=!(!qe&&!0!==n.threadSwitch||a),c=a||s,l=i??(c?function(){if(!1!==_.stickToBottom)return{type:`bottom`,distanceFromBottomPx:0};let e=G.value.records[0];return e?{type:`item`,itemKey:e.key,offsetWithinItemPx:0}:void 0}():void 0);Mt(),We=0,Ge=0,F.value=!c,P.value=c&&!!l,V=r,I=l,Ve=c&&o,He=c&&s,Be=P.value?jn():-1,Bn(),E.clear(),D.clear(),O.clear(),k.clear(),A.clear(),j.clear(),M.clear(),je.clear(),Me.clear();for(let[e,n,r]of In(t)){let t=Math.ceil(n);D.set(e,r),E.set(e,t),O.set(e,t),k.set(e,r)}for(let[e,n]of Object.entries(t?.markdownStates??{})){M.set(e,n);let t=kt(e,n);t>0&&A.set(e,t)}at(),!0===_.stickToBottom?(w.value=!0,T.value=!0):!1===_.stickToBottom?(w.value=!1,T.value=!1):(w.value=l?.type===`bottom`,T.value=l?.type===`bottom`&&l.distanceFromBottomPx<=2);let u=_n(l);H=u==null?null:zt(u),u!=null&&Ut(u,{writeDom:!0,remember:!1,updatePinned:!1}),Ue=t?.threadKey===U.value?t:null,c?l?e(()=>{$(r,l),typeof window<`u`?(Fe.forEach(e=>{let t=window.setTimeout(()=>{$(r,l)},e);ze.push(t)}),Nn(r)):Rn(r)}):(P.value=!1,I=void 0,H=null,V=0,X({remember:!1}),Pn(),Fn()):(P.value=!1,I=void 0,H=null,V=0,X({remember:!1}),Pn(),Fn(),!1!==_.stickToBottom&&(w.value=!0,T.value=!0,e(()=>{P.value||Kt()})))}function Bn(){for(let e of Ne.values())e.disconnect();Ne.clear(),N.clear()}return n(U,(e,t)=>{let n=Je??t,r=!!(n&&n!==e);r&&function(e){on(),hn()?.threadKey!==e&&(Ue?.threadKey===e?(Pe.set(e,Ue),Se(Ue)):Pe.has(e)||Q(e))}(n),Je=e,zn(function(e){return(e?Pe.get(e):null)||function(e){let t=_.initialThreadState;return t&&(t.threadKey??``)===(e??``)?t:null}(e)}(e),{threadSwitch:r})},{immediate:!0,flush:`sync`}),n(()=>K.value.records.map(e=>e.key).join(`\0`),()=>{xe(`range-change`,{start:K.value.start,end:K.value.end})},{immediate:!0}),n(()=>[_.items.length,G.value.totalHeight],()=>{P.value||!1!==_.stickToBottom&&(_.stickToBottom!==`auto`||T.value)&&e(()=>{P.value||!1!==_.stickToBottom&&(_.stickToBottom!==`auto`||T.value)&&Kt()})},{flush:`post`}),a(()=>{Pt(),Ht(),I?($(V,I),X({remember:!1}),Q()):!1===_.stickToBottom?(X({remember:!1}),Q()):(w.value=!0,Ut(Y(),{writeDom:!0,remember:!1,updatePinned:!1}),X({remember:!1}),Q()),b.value&&typeof ResizeObserver<`u`&&(Le=new ResizeObserver(()=>{Pt(),X()}),Le.observe(b.value))}),t(()=>{F.value||Nn(V)}),ee(()=>{hn()||Q(),Mt(),L=null,B!=null&&typeof window<`u`&&window.clearTimeout(B),B=null,Ie=void 0,nn(Z.raf),Z.scheduled=!1,Z.raf=null,Z.anchor=void 0,nn(en),$t=!1,en=null,Qt.clear(),Bn(),D.clear(),O.clear(),k.clear(),A.clear(),j.clear(),je.clear(),Me.clear(),Le?.disconnect(),Le=null}),fe({captureThreadState:function(){return mn(U.value)},restoreThreadState:zn,scrollToBottom:Kt,scrollToIndex:function(e,t=`start`){let n=G.value.records[e];if(!n)return;let r=Ft()+ot(n);t===`center`?r-=(S.value-n.size)/2:t===`end`&&(r-=S.value-n.size),Gt(r)},scrollToOffset:Gt,getItemSize:e=>{var t;let n=Tt(e);return n&&(t=wt(n))!=null?t:void 0},getTotalHeight:()=>G.value.totalHeight,getVisibleRange:()=>({start:K.value.start,end:K.value.end})}),(e,t)=>(r(),h(`div`,{ref_key:`scrollRoot`,ref:b,class:ae([`markstream-virtual-timeline`,{"is-restoring-thread":!F.value}]),"data-markstream-virtual-timeline":`1`,"data-testid":`markstream-virtual-timeline`,onScroll:Wt},[f(`div`,{class:`markstream-virtual-timeline__spacer`,style:ne({height:`${K.value.topSpacerHeight}px`}),"aria-hidden":`true`},null,4),(r(!0),h(l,null,o(K.value.records,t=>(r(),h(`div`,{key:t.renderKey,class:ae([`markstream-virtual-timeline__item`,{"is-restored-height-floor":Dn(t)}]),"data-markstream-item-key":t.key,"data-markstream-item-kind":t.kind,style:ne({minHeight:`${t.size}px`,"--markstream-virtual-item-size":`${t.size}px`})},[le(e.$slots,`default`,te({ref_for:!0},dn(t)),()=>[t.markdown?(r(),d(re(ge),te({key:0,ref_for:!0},un(t)),null,16)):vt(t)?(r(),d(s(vt(t)),{key:1,ref_for:!0,ref:ln(t),item:J(t)},null,8,[`item`])):(r(),h(`div`,{key:2,ref_for:!0,ref:ln(t),class:ae([`markstream-virtual-timeline__default-item`,`markstream-virtual-timeline__default-item--${t.kind||`item`}`])},[t.kind===`tool-call`&&J(t)?.status?(r(),h(`span`,ke,oe(J(t)?.status),1)):c(``,!0),ce(` `+oe(fn(t)),1)],2))],!0)],14,Oe))),128)),f(`div`,{class:`markstream-virtual-timeline__spacer`,style:ne({height:`${K.value.bottomSpacerHeight}px`}),"aria-hidden":`true`},null,4),F.value?c(``,!0):(r(),h(`div`,{key:0,class:`markstream-virtual-timeline__restore-loading`,style:ne({height:`${Math.max(1,Nt())}px`,transform:`translateY(${x.value}px)`}),"aria-live":`polite`,"aria-busy":`true`},[le(e.$slots,`restore-loading`,{threadKey:U.value,visibleRecords:K.value.records},()=>[t[0]||=f(`div`,{class:`markstream-virtual-timeline__restore-loading-card`},[f(`span`,{class:`markstream-virtual-timeline__restore-spinner`,"aria-hidden":`true`}),f(`span`,null,`Loading thread…`)],-1)],!0)],4))],34))}})),[[`__scopeId`,`data-v-1303f06e`]]),b=Ae;b.install=e=>{let t=b.__name??b.name??`MarkstreamVirtualTimeline`;e.component(t,Ae)};export{b as default}; \ No newline at end of file diff --git a/apps/pythinker-code/dist-web/index.html b/apps/pythinker-code/dist-web/index.html index e9e84dd8b..38eea01cc 100644 --- a/apps/pythinker-code/dist-web/index.html +++ b/apps/pythinker-code/dist-web/index.html @@ -17,7 +17,7 @@ the server's Content-Security-Policy forbids inline scripts. --> Pythinker Code Web - + diff --git a/apps/pythinker-code/scripts/native/02-sea-blob.mjs b/apps/pythinker-code/scripts/native/02-sea-blob.mjs index 434a7861c..a29cc174d 100644 --- a/apps/pythinker-code/scripts/native/02-sea-blob.mjs +++ b/apps/pythinker-code/scripts/native/02-sea-blob.mjs @@ -17,6 +17,7 @@ import { targetTriple, } from './paths.mjs'; import { collectWebAssets, webAssetManifestKey } from './web-assets.mjs'; +import { SEA_EXEC_ARGV, seaCodeCacheEnabled } from './sea-options.mjs'; async function ensureBundleExists() { try { @@ -53,8 +54,15 @@ async function writeSeaConfig(target) { Object.entries(seaAssets).sort(([a], [b]) => a.localeCompare(b)), ), disableExperimentalSEAWarning: true, - useCodeCache: false, + // Compiles main.cjs at build time so startup skips the parse of the whole + // bundle. The Node docs list dynamic `import()` as unsupported with a code + // cache, but that limitation is in the ESM main-script path; a CommonJS + // main script keeps a working `import()` (verified on Node 24, and relied + // on by `__plugin_run_node` to load plugin scripts), so the bundle keeps + // its dynamic imports as-is. + useCodeCache: seaCodeCacheEnabled(target), useSnapshot: false, + execArgv: [...SEA_EXEC_ARGV], }; await writeFile(nativeSeaConfigPath(), `${JSON.stringify(config, null, 2)}\n`); diff --git a/apps/pythinker-code/scripts/native/sea-options.mjs b/apps/pythinker-code/scripts/native/sea-options.mjs new file mode 100644 index 000000000..337d99284 --- /dev/null +++ b/apps/pythinker-code/scripts/native/sea-options.mjs @@ -0,0 +1,16 @@ +// Runtime options baked into the single-executable binary (see 02-sea-blob.mjs). + +// Node flags applied when the binary starts (`process.execArgv` at runtime). +// V8 sizes the young generation from the machine's physical memory, which on +// developer machines means a 64 MB semi-space and roughly 100 MB of resident +// memory that `pythinker` never needs; 16 MB keeps scavenges cheap for the CLI's +// allocation pattern while dropping that overhead. Users can still extend the +// flags with NODE_OPTIONS (the default `execArgvExtension: "env"`). +export const SEA_EXEC_ARGV = Object.freeze(['--max-semi-space-size=16']); + +// The V8 code cache generated at build time only loads on the platform and +// architecture it was compiled on, so cross-target bundles (a +// PYTHINKER_CODE_BUILD_TARGET that differs from the build host) must leave it out. +export function seaCodeCacheEnabled(target, host = `${process.platform}-${process.arch}`) { + return target === host; +} diff --git a/apps/pythinker-code/scripts/native/smoke.mjs b/apps/pythinker-code/scripts/native/smoke.mjs index c2aab9cc9..b05da4b0b 100644 --- a/apps/pythinker-code/scripts/native/smoke.mjs +++ b/apps/pythinker-code/scripts/native/smoke.mjs @@ -1,5 +1,5 @@ import { execFile } from 'node:child_process'; -import { mkdir, readFile, rm, stat } from 'node:fs/promises'; +import { mkdir, readFile, rm, stat, writeFile } from 'node:fs/promises'; import { resolve } from 'node:path'; import { promisify } from 'node:util'; @@ -89,4 +89,26 @@ try { await rm(smokeHome, { recursive: true, force: true }); } +// Plugin MCP servers declared with `command: "node"` are re-executed through +// this binary as `__plugin_run_node`, which loads the plugin script with a +// dynamic import(). Keep that path covered so bundler or SEA settings that +// break dynamic import() fail here instead of inside users' plugins. +const pluginRoot = resolve(smokeHome, 'plugin'); +await rm(smokeHome, { recursive: true, force: true }); +await mkdir(pluginRoot, { recursive: true }); +try { + const pluginEntry = resolve(pluginRoot, 'entry.mjs'); + await writeFile( + pluginEntry, + 'await Promise.resolve();\nconsole.log(`plugin entry ran ${process.argv.slice(2).join(" ")}`);\n', + ); + const pluginOutput = await runPythinkerWithEnv(['__plugin_run_node', pluginEntry, 'alpha', 'beta'], { + PYTHINKER_CODE_HOME: smokeHome, + PYTHINKER_PLUGIN_ROOT: pluginRoot, + }); + assertIncludes(pluginOutput, 'plugin entry ran alpha beta', 'plugin node entry'); +} finally { + await rm(smokeHome, { recursive: true, force: true }); +} + console.log(`Native smoke passed: ${executablePath}`); diff --git a/apps/pythinker-code/src/cli/run-shell.ts b/apps/pythinker-code/src/cli/run-shell.ts index e4d394f0c..f7dbab98a 100644 --- a/apps/pythinker-code/src/cli/run-shell.ts +++ b/apps/pythinker-code/src/cli/run-shell.ts @@ -246,7 +246,11 @@ export async function runShell( const hasContent = tui.hasSessionContent(); setCrashPhase('shutdown'); trackLifecycle('exit', { duration_ms: Date.now() - startedAt, tui_mode: tui.state.ui.mode }); - await shutdownTelemetry({ timeoutMs: CLI_SHUTDOWN_TIMEOUT_MS }); + try { + await shutdownTelemetry({ timeoutMs: CLI_SHUTDOWN_TIMEOUT_MS }); + } catch { + // A failed flush must not block the exit message. + } const gutter = ' '.repeat(CHROME_GUTTER); process.stdout.write(`${gutter}Bye!\n`); const hints: string[] = []; @@ -290,7 +294,11 @@ export async function runShell( removeCrashHandlers(); setCrashPhase('shutdown'); trackLifecycle('exit', { duration_ms: Date.now() - startedAt, tui_mode: tui.state.ui.mode }); - await shutdownTelemetry({ timeoutMs: CLI_SHUTDOWN_TIMEOUT_MS }); + try { + await shutdownTelemetry({ timeoutMs: CLI_SHUTDOWN_TIMEOUT_MS }); + } catch { + // A failed flush must not hide the startup error. + } await harness.close(); throw error; } diff --git a/apps/pythinker-code/src/feedback/codebase/scanner.ts b/apps/pythinker-code/src/feedback/codebase/scanner.ts index 6df420217..749c5058a 100644 --- a/apps/pythinker-code/src/feedback/codebase/scanner.ts +++ b/apps/pythinker-code/src/feedback/codebase/scanner.ts @@ -4,6 +4,8 @@ import { lstat, readdir } from 'node:fs/promises'; import { join, relative, resolve } from 'node:path'; import { promisify } from 'node:util'; +import { GIT_CONFIG_ARGS } from '#/utils/git/git-args'; + import { DEFAULT_MAX_ARCHIVE_SIZE, DEFAULT_MAX_FILES, @@ -46,9 +48,9 @@ export async function scanCodebase( const root = resolve(rootInput); const limits = resolveLimits(options.limits); throwIfAborted(options.signal); - const usedGitIgnore = await isInsideGitWorkTree(root); + const usedGitIgnore = await isInsideGitWorkTree(root, GIT_CONFIG_ARGS); const collected = usedGitIgnore - ? await scanWithGit(root, limits, options.signal) + ? await scanWithGit(root, GIT_CONFIG_ARGS, limits, options.signal) : await scanWithoutFilter(root, limits, options.signal); const sortedFiles = collected.files.toSorted((a, b) => a.path.localeCompare(b.path)); @@ -69,9 +71,18 @@ function resolveLimits(limits: ScanCodebaseOptions['limits']): ScanCodebaseLimit }; } -async function isInsideGitWorkTree(root: string): Promise { +async function isInsideGitWorkTree( + root: string, + configArgs: readonly string[], +): Promise { try { - const { stdout } = await execFileAsync('git', ['-C', root, 'rev-parse', '--is-inside-work-tree']); + const { stdout } = await execFileAsync('git', [ + ...configArgs, + '-C', + root, + 'rev-parse', + '--is-inside-work-tree', + ]); return stdout.trim() === 'true'; } catch { return false; @@ -80,12 +91,21 @@ async function isInsideGitWorkTree(root: string): Promise { async function scanWithGit( root: string, + configArgs: readonly string[], limits: ScanCodebaseLimits, signal?: AbortSignal, ): Promise { const { stdout } = await execFileAsync( 'git', - ['-C', root, 'ls-files', '-co', '--exclude-standard', '-z'], + [ + ...configArgs, + '-C', + root, + 'ls-files', + '-co', + '--exclude-standard', + '-z', + ], { encoding: 'buffer', maxBuffer: 1024 * 1024 * 64, signal }, ); diff --git a/apps/pythinker-code/src/tui/commands/config.ts b/apps/pythinker-code/src/tui/commands/config.ts index e4f41ba6c..f858b531b 100644 --- a/apps/pythinker-code/src/tui/commands/config.ts +++ b/apps/pythinker-code/src/tui/commands/config.ts @@ -22,11 +22,12 @@ import { PermissionSelectorComponent } from '../components/dialogs/permission-se import { SettingsSelectorComponent, type SettingsSelection } from '../components/dialogs/settings-selector'; import { SurveyPreferenceSelectorComponent } from '../components/dialogs/survey-preference-selector'; import { ThemeSelectorComponent } from '../components/dialogs/theme-selector'; +import { TuiModeSelectorComponent } from '../components/dialogs/tui-mode-selector'; import { UpdatePreferenceSelectorComponent } from '../components/dialogs/update-preference-selector'; -import { DEFAULT_MARKDOWN_CONFIG, DEFAULT_TUI_CONFIG, saveTuiConfig, type MarkdownConfig, type TuiConfig } from '../config'; +import { DEFAULT_MARKDOWN_CONFIG, DEFAULT_TUI_CONFIG, saveTuiConfig, type MarkdownConfig, type TuiConfig, type TuiMode } from '../config'; import type { ThemeName } from '#/tui/theme'; import { currentTheme, isBuiltInTheme, lightColors, loadCustomThemeMerged } from '#/tui/theme'; -import { NO_ACTIVE_SESSION_MESSAGE } from '../constant/pythinker-tui'; +import { NO_ACTIVE_SESSION_MESSAGE, TUI_MODE_RESTART_NOTICE } from '../constant/pythinker-tui'; import { formatErrorMessage } from '../utils/event-payload'; import { setMarkdownMermaidMode, type MermaidRenderMode } from '../utils/markdown-options'; import { PERMISSION_MODE_DESCRIPTIONS, PERMISSION_MODE_DISPLAY_NAMES } from '../utils/permission-mode'; @@ -59,6 +60,7 @@ function hasConversationHistory(host: SlashCommandHost): boolean { export function currentTuiConfig(host: Pick): TuiConfig { return { theme: host.state.appState.theme, + tuiMode: host.state.appState.tuiMode, editorCommand: host.state.appState.editorCommand, disablePasteBurst: host.state.appState.disablePasteBurst ?? DEFAULT_TUI_CONFIG.disablePasteBurst, renderLatex: host.state.appState.renderLatex ?? DEFAULT_TUI_CONFIG.renderLatex ?? true, @@ -947,6 +949,54 @@ export async function applyMermaidPreferenceChoice( host.showStatus(`Mermaid diagrams ${enabled ? 'enabled' : 'disabled'}.`); } +export function showTuiModePicker(host: SlashCommandHost): void { + host.mountEditorReplacement( + new TuiModeSelectorComponent({ + currentValue: host.state.appState.tuiMode ?? 'regular', + onSelect: (value) => { + host.restoreEditor(); + void applyTuiModeChoice(host, value); + }, + onCancel: () => { + host.restoreEditor(); + }, + }), + ); +} + +type TuiModeHost = { + readonly state: { + readonly appState: Pick; + readonly ui: Pick; + }; + setAppState(patch: Pick): void; + showStatus(msg: string, color?: string): void; + showNotice(msg: string): void; +}; + +export async function applyTuiModeChoice(host: TuiModeHost, tuiMode: TuiMode): Promise { + if (tuiMode === (host.state.appState.tuiMode ?? 'regular')) { + host.showStatus(`TUI mode already ${tuiMode}.`); + return; + } + + try { + await saveTuiConfig({ + ...currentTuiConfig(host as unknown as SlashCommandHost), + tuiMode, + }); + } catch (error) { + host.showStatus(`Failed to save TUI mode: ${formatErrorMessage(error)}`, 'error'); + return; + } + + host.setAppState({ tuiMode }); + host.showStatus(`TUI mode set to ${tuiMode}.`, 'success'); + if (tuiMode !== host.state.ui.mode) { + host.showNotice(TUI_MODE_RESTART_NOTICE); + } +} + export function showSettingsSelector(host: SlashCommandHost): void { host.mountEditorReplacement( new SettingsSelectorComponent({ @@ -966,6 +1016,7 @@ function handleSettingsSelection(host: SlashCommandHost, value: SettingsSelectio case 'model': showModelPicker(host); return; case 'permission': showPermissionPicker(host); return; case 'theme': showThemePicker(host); return; + case 'tuiMode': showTuiModePicker(host); return; case 'mermaid': showMermaidPreferencePicker(host); return; case 'editor': showEditorPicker(host); return; case 'survey': showSurveyPreferencePicker(host); return; diff --git a/apps/pythinker-code/src/tui/commands/reload.ts b/apps/pythinker-code/src/tui/commands/reload.ts index 057e7126c..47a5232a1 100644 --- a/apps/pythinker-code/src/tui/commands/reload.ts +++ b/apps/pythinker-code/src/tui/commands/reload.ts @@ -2,6 +2,7 @@ import type { PythinkerConfig } from '@pymodel/pythinker-code-sdk'; import { currentTheme, lightColors } from '#/tui/theme'; import { DEFAULT_MARKDOWN_CONFIG, loadTuiConfig, type TuiConfig } from '../config'; +import { TUI_MODE_RESTART_NOTICE } from '../constant/pythinker-tui'; import { setMarkdownMermaidMode, setMarkdownRenderLatex } from '../utils/markdown-options'; import type { SlashCommandHost } from './dispatch'; import { setExperimentalFeatures } from './experimental-flags'; @@ -68,6 +69,7 @@ export async function applyReloadedTuiConfig( host.refreshTerminalThemeTracking(); host.setAppState({ editorCommand: config.editorCommand, + tuiMode: config.tuiMode, disablePasteBurst: config.disablePasteBurst, renderLatex: config.renderLatex, cacheExpiryHint: config.cacheExpiryHint, @@ -78,6 +80,9 @@ export async function applyReloadedTuiConfig( markdown: config.markdown, }); host.state.editor.setDisablePasteBurst(config.disablePasteBurst); + if ((config.tuiMode ?? 'regular') !== host.state.ui.mode) { + host.showNotice(TUI_MODE_RESTART_NOTICE); + } } function applyRuntimeConfig(host: SlashCommandHost, config: PythinkerConfig): void { diff --git a/apps/pythinker-code/src/tui/commands/session.ts b/apps/pythinker-code/src/tui/commands/session.ts index 864869294..717da43d1 100644 --- a/apps/pythinker-code/src/tui/commands/session.ts +++ b/apps/pythinker-code/src/tui/commands/session.ts @@ -2,8 +2,6 @@ import { mkdir, writeFile } from 'node:fs/promises'; import { dirname, resolve } from 'node:path'; import { pathToFileURL } from 'node:url'; -import type { Session } from '@pymodel/pythinker-code-sdk'; - import { detectInstallSource } from '#/cli/update/source'; import { copyTextToClipboard } from '#/utils/clipboard/clipboard-text'; import { detectShellEnvironment } from '#/utils/process/shell-env'; @@ -58,12 +56,8 @@ export async function handleForkCommand(host: SlashCommandHost, args: string): P return; } - const sourceTitle = forkSourceTitle(host, session); try { - const forked = await host.harness.forkSession({ - id: session.id, - title: `Fork: ${sourceTitle}`, - }); + const forked = await host.harness.forkSession({ id: session.id }); const forkId = forked.id; try { await forked.close(); @@ -111,15 +105,6 @@ function forkResumeCommand(workDir: string, forkId: string): string { return `${changeDir} && pythinker --resume ${quoteShellArg(forkId)}`; } -function forkSourceTitle(host: SlashCommandHost, session: Session): string { - const currentTitle = host.state.appState.sessionTitle?.trim(); - if (currentTitle !== undefined && currentTitle.length > 0) return currentTitle; - - const summaryTitle = - typeof session.summary?.title === 'string' ? session.summary.title.trim() : ''; - return summaryTitle.length > 0 ? summaryTitle : session.id; -} - export async function handleExportMdCommand(host: SlashCommandHost, args: string): Promise { const session = host.session; if (session === undefined) { diff --git a/apps/pythinker-code/src/tui/components/chrome/footer.ts b/apps/pythinker-code/src/tui/components/chrome/footer.ts index 9b49418c7..160e174a5 100644 --- a/apps/pythinker-code/src/tui/components/chrome/footer.ts +++ b/apps/pythinker-code/src/tui/components/chrome/footer.ts @@ -218,7 +218,9 @@ export class FooterComponent implements Component { this.state = state; this.onRefresh = onRefresh; this.gitCacheWorkDir = state.workDir; - this.gitCache = createGitStatusCache(state.workDir, { onChange: this.onRefresh }); + this.gitCache = createGitStatusCache(state.workDir, { + onChange: this.onRefresh, + }); this.syncGoalClock(state.goal); this.syncGoalTimer(state.goal); this.syncStatusLineRunner(state); @@ -227,7 +229,9 @@ export class FooterComponent implements Component { setState(state: AppState): void { if (state.workDir !== this.gitCacheWorkDir) { this.gitCacheWorkDir = state.workDir; - this.gitCache = createGitStatusCache(state.workDir, { onChange: this.onRefresh }); + this.gitCache = createGitStatusCache(state.workDir, { + onChange: this.onRefresh, + }); } this.syncGoalClock(state.goal); this.syncGoalTimer(state.goal); diff --git a/apps/pythinker-code/src/tui/components/chrome/gutter-container.ts b/apps/pythinker-code/src/tui/components/chrome/gutter-container.ts index c92c4c21a..20d9db429 100644 --- a/apps/pythinker-code/src/tui/components/chrome/gutter-container.ts +++ b/apps/pythinker-code/src/tui/components/chrome/gutter-container.ts @@ -16,7 +16,12 @@ */ import { Container } from '@pymodel/pi-tui'; -import type { Component, TuiMouseDispatchResult, TuiMouseEvent } from '@pymodel/pi-tui'; +import type { + Component, + TuiMouseDispatchResult, + TuiMouseEvent, + TuiMouseEventResult, +} from '@pymodel/pi-tui'; import { prefixPreservingOsc133Zone } from '#/tui/utils/osc133'; import { isRenderCacheEnabled } from '#/tui/utils/render-cache'; @@ -31,6 +36,12 @@ interface TranscriptRenderCache { export class GutterContainer extends Container { private renderCache: TranscriptRenderCache | undefined; + private unhandledClick: ((index: number) => TuiMouseEventResult | undefined) | undefined; + + setUnhandledClick(handler: (index: number) => TuiMouseEventResult | undefined): void { + this.unhandledClick = handler; + } + constructor( private readonly leftPad: number, private readonly rightPad: number, @@ -98,6 +109,80 @@ export class GutterContainer extends Container { // so translate before delegating or clicks land a gutter-width off. override handleMouse(event: TuiMouseEvent): TuiMouseDispatchResult | undefined { const inner = Math.max(1, event.width - this.leftPad - this.rightPad); - return super.handleMouse({ ...event, x: event.x - this.leftPad, width: inner }); + const adjusted: TuiMouseEvent = { ...event, x: event.x - this.leftPad, width: inner }; + if (adjusted.y < 0 || adjusted.y >= adjusted.height) return undefined; + + const heights = this.childHeights(inner, event.width); + let childY = 0; + for (let index = 0; index < this.children.length; index++) { + const height = heights[index] ?? 0; + if (adjusted.y < childY || adjusted.y >= childY + height) { + childY += height; + continue; + } + const child = this.children[index]!; + const handled = dispatchToChild(child, { ...adjusted, y: adjusted.y - childY, height }); + if (handled) return handled; + if ( + this.unhandledClick === undefined || + adjusted.type !== 'click' || + adjusted.button !== 'left' + ) { + return undefined; + } + const fallback = this.unhandledClick(index); + if (fallback === undefined || (!fallback.handled && !fallback.capture && !fallback.focus)) { + return undefined; + } + return { + handled: true, + capture: fallback.capture, + focus: fallback.focus, + render: fallback.render, + target: { + component: this, + originX: event.screenX - event.x, + originY: event.screenY - event.y, + width: event.width, + height: event.height, + }, + }; + } + return undefined; } + + private childHeights(innerWidth: number, outerWidth: number): number[] { + const cache = this.renderCache; + if ( + cache !== undefined && + cache.width === outerWidth && + cache.childRefs.length === this.children.length && + cache.childRefs.every((child, index) => child === this.children[index]) + ) { + return cache.prefixed.map((lines) => lines.length); + } + return this.children.map((child) => child.render(innerWidth).length); + } +} + +function dispatchToChild( + child: Component, + event: TuiMouseEvent, +): TuiMouseDispatchResult | undefined { + const result = child.handleMouse?.(event); + if (!result) return undefined; + if ('target' in result) return result as TuiMouseDispatchResult; + if (!result.handled && !result.capture && !result.focus) return undefined; + return { + ...result, + handled: true, + focusTarget: result.focus ? child : undefined, + target: { + component: child, + originX: event.screenX - event.x, + originY: event.screenY - event.y, + width: event.width, + height: event.height, + }, + }; } diff --git a/apps/pythinker-code/src/tui/components/dialogs/compaction.ts b/apps/pythinker-code/src/tui/components/dialogs/compaction.ts index a07a66dcf..18c44eddb 100644 --- a/apps/pythinker-code/src/tui/components/dialogs/compaction.ts +++ b/apps/pythinker-code/src/tui/components/dialogs/compaction.ts @@ -120,6 +120,18 @@ export class CompactionComponent extends Container { this.ui?.requestRender(); } + hasHiddenContent(): boolean { + return this.summary !== undefined && this.summary.length > 0; + } + + isExpanded(): boolean { + return this.expanded; + } + + omitsExpandHint(): boolean { + return true; + } + private addSummaryChild(): void { if (this.summaryText !== undefined || this.summary === undefined || this.summary.length === 0) { return; diff --git a/apps/pythinker-code/src/tui/components/dialogs/settings-selector.ts b/apps/pythinker-code/src/tui/components/dialogs/settings-selector.ts index e8086f616..7bc66a9c4 100644 --- a/apps/pythinker-code/src/tui/components/dialogs/settings-selector.ts +++ b/apps/pythinker-code/src/tui/components/dialogs/settings-selector.ts @@ -3,6 +3,7 @@ import { ChoicePickerComponent, type ChoiceOption } from './choice-picker'; export type SettingsSelection = | 'model' | 'theme' + | 'tuiMode' | 'mermaid' | 'editor' | 'permission' @@ -27,6 +28,11 @@ const SETTINGS_OPTIONS: readonly ChoiceOption[] = [ label: 'Theme', description: 'Change the terminal UI theme.', }, + { + value: 'tuiMode', + label: 'TUI mode', + description: 'Choose the regular or fullscreen layout.', + }, { value: 'mermaid', label: 'Mermaid diagrams', @@ -63,6 +69,7 @@ function isSettingsSelection(value: string): value is SettingsSelection { return ( value === 'model' || value === 'theme' || + value === 'tuiMode' || value === 'mermaid' || value === 'editor' || value === 'permission' || diff --git a/apps/pythinker-code/src/tui/components/dialogs/tui-mode-selector.ts b/apps/pythinker-code/src/tui/components/dialogs/tui-mode-selector.ts new file mode 100644 index 000000000..fe1e3e7ff --- /dev/null +++ b/apps/pythinker-code/src/tui/components/dialogs/tui-mode-selector.ts @@ -0,0 +1,35 @@ +import type { TuiMode } from '../../config'; +import { ChoicePickerComponent, type ChoiceOption } from './choice-picker'; + +const TUI_MODE_OPTIONS: readonly ChoiceOption[] = [ + { + value: 'regular', + label: 'Regular', + description: 'Render into the terminal\'s native scrollback.', + }, + { + value: 'fullscreen', + label: 'Fullscreen (experimental)', + description: 'Alternate screen with in-app scrolling, selection, and transcript search.', + }, +]; + +export interface TuiModeSelectorOptions { + readonly currentValue: TuiMode; + readonly onSelect: (value: TuiMode) => void; + readonly onCancel: () => void; +} + +export class TuiModeSelectorComponent extends ChoicePickerComponent { + constructor(opts: TuiModeSelectorOptions) { + super({ + title: 'TUI mode', + options: [...TUI_MODE_OPTIONS], + currentValue: opts.currentValue, + onSelect: (value) => { + if (value === 'regular' || value === 'fullscreen') opts.onSelect(value); + }, + onCancel: opts.onCancel, + }); + } +} diff --git a/apps/pythinker-code/src/tui/components/messages/goal-markers.ts b/apps/pythinker-code/src/tui/components/messages/goal-markers.ts index 9e0a6daad..efbd7452b 100644 --- a/apps/pythinker-code/src/tui/components/messages/goal-markers.ts +++ b/apps/pythinker-code/src/tui/components/messages/goal-markers.ts @@ -54,6 +54,18 @@ export class GoalMarkerComponent implements Component { this.expanded = expanded; } + hasHiddenContent(): boolean { + return this.expandable && this.detail !== undefined && this.detail.length > 0; + } + + isExpanded(): boolean { + return this.expanded; + } + + omitsExpandHint(): boolean { + return true; + } + render(width: number): string[] { const dot = currentTheme.fg(this.accentToken, this.marker); const head = currentTheme.fg(this.textToken, this.headline); diff --git a/apps/pythinker-code/src/tui/components/messages/thinking.ts b/apps/pythinker-code/src/tui/components/messages/thinking.ts index 68d3cc84d..d5c516709 100644 --- a/apps/pythinker-code/src/tui/components/messages/thinking.ts +++ b/apps/pythinker-code/src/tui/components/messages/thinking.ts @@ -24,6 +24,7 @@ export class ThinkingComponent implements Component { private showMarker: boolean; private mode: ThinkingRenderMode; private expanded = false; + private previewHidesLines = false; private readonly ui: TUI | undefined; private spinnerFrame = 0; private spinnerInterval: ReturnType | undefined; @@ -87,6 +88,18 @@ export class ThinkingComponent implements Component { this.markRenderDirty(); } + hasHiddenContent(): boolean { + return this.previewHidesLines; + } + + isExpanded(): boolean { + return this.expanded; + } + + omitsExpandHint(): boolean { + return true; + } + render(width: number): string[] { if ( isRenderCacheEnabled() && @@ -98,6 +111,8 @@ export class ThinkingComponent implements Component { const contentWidth = Math.max(1, width - MESSAGE_INDENT.length); const contentLines = this.text.length > 0 ? this.textComponent.render(contentWidth) : ['']; + this.previewHidesLines = + this.mode === 'finalized' && contentLines.length > THINKING_PREVIEW_LINES; let rendered: string[]; if (this.mode === 'live') { diff --git a/apps/pythinker-code/src/tui/components/messages/tool-call.ts b/apps/pythinker-code/src/tui/components/messages/tool-call.ts index 8b18a23fe..f8a374516 100644 --- a/apps/pythinker-code/src/tui/components/messages/tool-call.ts +++ b/apps/pythinker-code/src/tui/components/messages/tool-call.ts @@ -44,7 +44,7 @@ import { buildGoalToolHeader, parseGoalToolOutput } from './tool-renderers/goal' import { searchNoticeOnly } from './tool-renderers/grep-output'; import { parseReadMediaOutput } from './tool-renderers/media'; import { computeWriteStats } from './tool-renderers/chip'; -import { nonEmptyLines, outcomeLine } from './tool-renderers/outcome'; +import { nonEmptyLines, outcomeLine, outcomeRows } from './tool-renderers/outcome'; import { TruncatedOutputComponent } from './tool-renderers/truncated'; import { isSpilledToolOutput } from './tool-renderers/types'; import { isGenericToolResult, pickResultRenderer } from './tool-renderers/registry'; @@ -761,6 +761,11 @@ export class ToolCallComponent extends Container { ((child instanceof TruncatedOutputComponent || child instanceof ShellExecutionComponent) && child.wasTruncated()), ); + } else if ( + !this.truncatedAtLastRender && + this.collapsedOutcomeClips(width) + ) { + this.truncatedAtLastRender = true; } if (allReused) { @@ -806,6 +811,28 @@ export class ToolCallComponent extends Container { return this.hiddenContent || this.truncatedAtLastRender; } + private collapsedOutcomeClips(width: number): boolean { + const result = this.result; + if (result === undefined || result.output.length === 0 || result.is_error === true) { + return false; + } + const name = this.toolCall.name; + if (name !== 'Bash' && !isGenericToolResult(name)) return false; + const leadsWithMetadata = + name === 'Bash' && + (result.output.startsWith('task_id:') || isSpilledToolOutput(result.output)); + const rows = outcomeRows( + result.output, + name === 'Bash' && !leadsWithMetadata ? 'last' : 'first', + ); + for (const row of rows) { + if (!(row instanceof TruncatedHeaderLine)) continue; + row.render(width); + if (row.wasTruncated()) return true; + } + return false; + } + /** Whether the global ctrl+o toggle currently has this card expanded. */ isExpanded(): boolean { return this.expanded; diff --git a/apps/pythinker-code/src/tui/components/messages/tool-renderers/truncated.ts b/apps/pythinker-code/src/tui/components/messages/tool-renderers/truncated.ts index abac5b6fb..45f28d9dd 100644 --- a/apps/pythinker-code/src/tui/components/messages/tool-renderers/truncated.ts +++ b/apps/pythinker-code/src/tui/components/messages/tool-renderers/truncated.ts @@ -86,7 +86,7 @@ export class TruncatedOutputComponent implements Component { render(width: number): string[] { const contentLines = this.textComponent.render(width); - if (!this.expanded) this.truncatedAtLastRender = contentLines.length > this.maxLines; + this.truncatedAtLastRender = contentLines.length > this.maxLines; if (this.expanded || contentLines.length <= this.maxLines) { return contentLines; diff --git a/apps/pythinker-code/src/tui/components/panes/activity-pane.ts b/apps/pythinker-code/src/tui/components/panes/activity-pane.ts index a848d24fb..06d1fa83b 100644 --- a/apps/pythinker-code/src/tui/components/panes/activity-pane.ts +++ b/apps/pythinker-code/src/tui/components/panes/activity-pane.ts @@ -26,7 +26,10 @@ export class ActivityPaneComponent extends Container { this.spinnerRef = options.spinner; if ( - (options.mode === 'waiting' || options.mode === 'tool' || options.mode === 'composing') && + (options.mode === 'waiting' || + options.mode === 'tool' || + options.mode === 'composing' || + options.mode === 'thinking') && options.spinner !== undefined ) { this.addChild(new Spacer(1)); diff --git a/apps/pythinker-code/src/tui/config.ts b/apps/pythinker-code/src/tui/config.ts index f764ed5b5..cc26dc524 100644 --- a/apps/pythinker-code/src/tui/config.ts +++ b/apps/pythinker-code/src/tui/config.ts @@ -18,6 +18,10 @@ import { getDataDir } from '#/utils/paths'; export const INVALID_TUI_CONFIG_MESSAGE = 'Invalid TUI config in ~/.pythinker-code/tui.toml; using defaults.'; +function legacyFullscreenEnvMode(): TuiMode | undefined { + return process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] === '1' ? 'fullscreen' : undefined; +} + export const TuiThemeSchema = z.string(); export const NotificationConditionSchema = z.enum(['unfocused', 'always']); @@ -61,8 +65,12 @@ export const DEFAULT_MARKDOWN_CONFIG: MarkdownConfig = { mermaid: 'final', }; +export const TuiModeSchema = z.enum(['regular', 'fullscreen']); +export type TuiMode = z.infer; + export const TuiConfigFileSchema = z.object({ theme: TuiThemeSchema.optional(), + tui_mode: z.string().optional(), render_latex: z.boolean().optional(), disable_paste_burst: z.boolean().optional(), cache_expiry_hint: z.boolean().optional(), @@ -93,6 +101,7 @@ export const TuiConfigFileSchema = z.object({ export const TuiConfigSchema = z.object({ theme: TuiThemeSchema, + tuiMode: TuiModeSchema.optional(), /** LaTeX math rendering in Markdown; optional only so older hand-built test * fixtures still typecheck. */ renderLatex: z.boolean().optional(), @@ -128,6 +137,7 @@ export const DEFAULT_UPGRADE_PREFERENCES: UpgradePreferences = { export const DEFAULT_TUI_CONFIG: TuiConfig = TuiConfigSchema.parse({ theme: 'auto', + tuiMode: 'regular', renderLatex: true, disablePasteBurst: false, cacheExpiryHint: true, @@ -163,28 +173,50 @@ export async function loadTuiConfig( warn?: (message: string) => void, ): Promise { if (!existsSync(filePath)) { - await saveTuiConfig(DEFAULT_TUI_CONFIG, filePath); - return DEFAULT_TUI_CONFIG; + const envTuiMode = legacyFullscreenEnvMode(); + const config: TuiConfig = + envTuiMode === undefined ? DEFAULT_TUI_CONFIG : { ...DEFAULT_TUI_CONFIG, tuiMode: envTuiMode }; + try { + await saveTuiConfig(config, filePath); + } catch { + warn?.('[tui.toml] could not save the default config'); + } + return config; } try { const text = await readFile(filePath, 'utf-8'); - return parseTuiConfig(text, warn); + const shape = parseTuiConfigShape(text); + const config = normalizeTuiConfig(shape, warn); + if (shape.tui_mode !== undefined) { + return config; + } + const envTuiMode = legacyFullscreenEnvMode(); + if (envTuiMode === undefined) { + return config; + } + const migrated: TuiConfig = { ...config, tuiMode: envTuiMode }; + try { + await saveTuiConfig(migrated, filePath); + } catch { + warn?.('[tui.toml] could not save the migrated tui_mode preference'); + } + return migrated; } catch { throw new TuiConfigParseError(DEFAULT_TUI_CONFIG); } } +function parseTuiConfigShape(tomlText: string): TuiConfigFileShape { + const raw = tomlText.trim().length === 0 ? {} : (parseToml(tomlText) as Record); + return TuiConfigFileSchema.parse(raw); +} + export function parseTuiConfig( tomlText: string, warn?: (message: string) => void, ): TuiConfig { - if (tomlText.trim().length === 0) { - return DEFAULT_TUI_CONFIG; - } - const raw = parseToml(tomlText) as Record; - const parsed = TuiConfigFileSchema.parse(raw); - return normalizeTuiConfig(parsed, warn); + return normalizeTuiConfig(parseTuiConfigShape(tomlText), warn); } export async function saveTuiConfig( @@ -224,8 +256,18 @@ export function normalizeTuiConfig( warn(`[tui.toml] ignoring unknown markdown.mermaid value: ${mermaidValue}`); } } + const tuiModeValue = config.tui_mode; + let tuiMode: TuiMode = 'regular'; + if (tuiModeValue !== undefined) { + if (tuiModeValue === 'regular' || tuiModeValue === 'fullscreen') { + tuiMode = tuiModeValue; + } else { + warn(`[tui.toml] ignoring unknown tui_mode value: ${tuiModeValue}`); + } + } return TuiConfigSchema.parse({ theme: config.theme ?? DEFAULT_TUI_CONFIG.theme, + tuiMode, renderLatex: config.render_latex ?? DEFAULT_TUI_CONFIG.renderLatex, disablePasteBurst: config.disable_paste_burst ?? DEFAULT_TUI_CONFIG.disablePasteBurst, cacheExpiryHint: config.cache_expiry_hint ?? DEFAULT_TUI_CONFIG.cacheExpiryHint, @@ -268,6 +310,7 @@ export function renderTuiConfig(config: TuiConfig): string { if (statusCommand) { statusLines.push(`command = "${escapeTomlBasicString(statusCommand)}"`); } + const tuiModeLine = `tui_mode = "${config.tuiMode ?? 'regular'}" # "regular" | "fullscreen" ("fullscreen" is experimental)`; const markdownSection = config.markdown?.mermaid === 'off' ? `[markdown]\nmermaid = "off" # "final" | "off"\n` @@ -290,6 +333,7 @@ export function renderTuiConfig(config: TuiConfig): string { # Agent/runtime settings stay in ~/.pythinker-code/config.toml. theme = "${escapeTomlBasicString(config.theme)}" # "auto" | "dark" | "light" | custom theme name +${tuiModeLine} render_latex = ${String(config.renderLatex !== false)} # false keeps LaTeX math in assistant messages as raw source disable_paste_burst = ${String(config.disablePasteBurst)} # true disables non-bracketed paste-burst fallback cache_expiry_hint = ${String(config.cacheExpiryHint !== false)} # false disables the "cache expired" dialog on resume / idle submit diff --git a/apps/pythinker-code/src/tui/constant/pythinker-tui.ts b/apps/pythinker-code/src/tui/constant/pythinker-tui.ts index 17a010b6a..865bbe275 100644 --- a/apps/pythinker-code/src/tui/constant/pythinker-tui.ts +++ b/apps/pythinker-code/src/tui/constant/pythinker-tui.ts @@ -6,6 +6,7 @@ export const CTRL_D_HINT = 'Press Ctrl+D again to exit'; export const CTRL_C_HINT = 'Press Ctrl+C again to exit'; export const MAIN_AGENT_ID = 'main'; export const OAUTH_LOGIN_REQUIRED_STARTUP_NOTICE = 'OAuth login expired. Send /login to login.'; +export const TUI_MODE_RESTART_NOTICE = 'TUI mode takes effect after restarting Pythinker Code.'; export const SESSIONLESS_STARTUP_NOTICE = 'No session yet — one will be created on your first message.'; export const TOWER_STATUS_PROMPT = diff --git a/apps/pythinker-code/src/tui/pythinker-tui.ts b/apps/pythinker-code/src/tui/pythinker-tui.ts index 4462d3977..a2f44c533 100644 --- a/apps/pythinker-code/src/tui/pythinker-tui.ts +++ b/apps/pythinker-code/src/tui/pythinker-tui.ts @@ -32,6 +32,7 @@ import { Spacer, TuiAltScreen, TuiMainScreen, + type TuiMouseEventResult, } from '@pymodel/pi-tui'; import { resolve } from 'pathe'; @@ -159,6 +160,7 @@ import { type TUIStartupState, } from './types'; import { + countedByExpandHint, hasDispose, hasHiddenContent, isExpandable, @@ -235,11 +237,11 @@ export interface PythinkerTUIStartupInput { } type EffectiveActivityPaneMode = ActivityPaneMode | 'idle' | 'session'; -type LoadingTipKind = 'activity' | 'composing'; +type LoadingTipKind = 'activity' | 'braille'; function loadingTipKind(mode: EffectiveActivityPaneMode): LoadingTipKind | undefined { if (mode === 'waiting' || mode === 'tool') return 'activity'; - if (mode === 'composing') return 'composing'; + if (mode === 'composing' || mode === 'thinking') return 'braille'; return undefined; } @@ -282,6 +284,7 @@ function createInitialAppState(input: PythinkerTUIStartupInput): AppState { streamingStartTime: 0, stepRetry: null, theme: input.tuiConfig.theme, + tuiMode: input.tuiConfig.tuiMode, version: input.version, editorCommand: input.tuiConfig.editorCommand, disablePasteBurst: input.tuiConfig.disablePasteBurst, @@ -471,6 +474,9 @@ export class PythinkerTUI { this.startupNotice = startupInput.startupNotice; this.state = createTUIState(tuiOptions); this.state.footer.setExpandHintProvider(() => this.toolOutputExpandHint()); + this.state.transcriptContainer.setUnhandledClick((index) => + this.toggleClickedFoldBlock(index), + ); this.uninstallRainbowDance = installRainbowDance(() => { this.state.ui.requestRender(); }); @@ -3318,10 +3324,10 @@ export class PythinkerTUI { updateActivityPane(): void { const effectiveMode = this.resolveActivityPaneMode(); const tipKind = loadingTipKind(effectiveMode); - // Pick a fresh loading tip when the loading kind changes. The same kind - // covers waiting/tool (both activity spinners) and any intermediate thinking - // phase, so a continuous burst of tool calls does not flip tips. Clear the - // cache only when there is no loading UI at all. + // Pick a fresh loading tip when the loading kind changes: waiting/tool + // share the activity kind and thinking/composing share the braille kind, so a + // burst of tool calls or thinking/composing alternation does not flip + // tips. Clear the cache only when there is no loading UI at all. if (effectiveMode === 'idle' || effectiveMode === 'session' || effectiveMode === 'hidden') { this.currentLoadingTip = undefined; } else if ( @@ -3379,12 +3385,21 @@ export class PythinkerTUI { break; } case 'thinking': { - this.stopActivitySpinner(); + const spinner = this.ensureActivitySpinner('Thinking…', (s) => + currentTheme.fg('primary', s), + ); this.syncAgentDynamicWorkflowActivitySpinner(undefined); + this.state.activityContainer.addChild( + new ActivityPaneComponent({ + mode: 'thinking', + spinner, + tip: this.currentLoadingTip?.tip, + }), + ); break; } case 'composing': { - const spinner = this.ensureActivitySpinner('working…', (s) => + const spinner = this.ensureActivitySpinner('Working…', (s) => currentTheme.fg('primary', s), ); this.syncAgentDynamicWorkflowActivitySpinner(undefined); @@ -3414,9 +3429,9 @@ export class PythinkerTUI { case 'session': { this.stopActivitySpinner(); this.syncAgentDynamicWorkflowActivitySpinner(undefined); - // Keep a placeholder row so the activity area does not fully shrink - // when the spinner is removed at the end of streaming; combined with - // pi-tui's clamp, this avoids a destructive full redraw (viewport jump). + // Working modes occupy two rows (a spacer above the loader); idle + // keeps a one-row placeholder so the dock only shifts once at turn + // boundaries instead of on every intra-turn mode flip. this.state.activityContainer.addChild(new Spacer(1)); break; } @@ -3488,17 +3503,32 @@ export class PythinkerTUI { // card with hidden content keeps the collapse hint on. for (let i = children.length - 1; i >= 0; i--) { const child = children[i]; - if (isExpandedComponent(child) && hasHiddenContent(child)) return 'collapse'; + if (isExpandedComponent(child) && countedByExpandHint(child)) return 'collapse'; } return null; } const cutoff = this.expandCutoff(children); for (let i = children.length - 1; i >= cutoff; i--) { - if (hasHiddenContent(children[i])) return 'expand'; + if (countedByExpandHint(children[i])) return 'expand'; } return null; } + private toggleClickedFoldBlock(index: number): TuiMouseEventResult | undefined { + const children = this.state.transcriptContainer.children; + const hit = children[index]; + if (hit === undefined || !isExpandable(hit) || !hasHiddenContent(hit)) return undefined; + if (isExpandedComponent(hit)) { + hit.setExpanded(false); + } else if (index >= this.expandCutoff(children)) { + hit.setExpanded(true); + } else { + return undefined; + } + this.state.ui.requestRender(); + return { handled: true }; + } + toggleToolOutputExpansion(): void { this.state.toolOutputExpanded = !this.state.toolOutputExpanded; const children = this.state.transcriptContainer.children; @@ -3836,12 +3866,11 @@ export class PythinkerTUI { /** * agent-core-v2 startup gate: before any session is created, ask whether to * trust this folder when the workspace is not trusted yet (project-level MCP - * servers stay disabled while untrusted). Best-effort throughout — a failed - * check or trust write never blocks startup. Choosing "don't trust" (or Esc) - * exits the program before any session is created; the prompt reappears on - * the next launch: the engine's untrusted state is indistinguishable from - * never-trusted. Returns true when the prompt started the event loop (the - * caller must not start it again). + * servers stay disabled while untrusted). A failed trust-info read is treated + * as untrusted and still prompts. Choosing "don't trust" (or Esc) exits the + * program before any session is created. A failed trust write still enters + * the TUI for this process and re-asks on the next launch. Returns true when + * the prompt started the event loop (the caller must not start it again). */ private async maybeRunWorkspaceTrustPrompt(): Promise { const workDir = this.state.appState.workDir; @@ -3849,9 +3878,11 @@ export class PythinkerTUI { try { info = await this.harness.getWorkspaceTrustInfo(workDir); } catch { + info = { trusted: false, gatedMcpServers: [] }; + } + if (info.trusted) { return false; } - if (info.trusted) return false; this.startEventLoop(); const choice = await new Promise((resolve) => { this.state.activeDialog = 'trust-prompt'; @@ -3878,7 +3909,6 @@ export class PythinkerTUI { try { await this.harness.trustWorkspace(workDir); } catch { - // A failed write leaves the workspace untrusted (re-asked next launch). } return true; } diff --git a/apps/pythinker-code/src/tui/tui-state.ts b/apps/pythinker-code/src/tui/tui-state.ts index 49fcd7a47..9b2f56bf9 100644 --- a/apps/pythinker-code/src/tui/tui-state.ts +++ b/apps/pythinker-code/src/tui/tui-state.ts @@ -37,7 +37,7 @@ import { export interface TUIState { ui: TUI; terminal: ProcessTerminal; - transcriptContainer: Container; + transcriptContainer: GutterContainer; activityContainer: Container; todoPanelContainer: Container; todoPanel: TodoPanelComponent; @@ -97,12 +97,9 @@ export function createTUIState(options: PythinkerTUIOptions): TUIState { const terminal = new ProcessTerminal(); setMarkdownRenderLatex(initialAppState.renderLatex ?? DEFAULT_TUI_CONFIG.renderLatex ?? true); setMarkdownMermaidMode(initialAppState.markdown?.mermaid ?? DEFAULT_MARKDOWN_CONFIG.mermaid); - // Fullscreen is experimental and env-gated for now: PYTHINKER_CODE_TUI_FULL_SCREEN=1. - const fullscreen = process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] === '1'; const ui = - fullscreen + initialAppState.tuiMode === 'fullscreen' ? new TuiAltScreen(terminal, undefined, undefined, { - scrollToEndIndicator: () => 'Jump to bottom (click) ↓', // Mouse capture takes over the terminal's native link activation, so // route OSC 8 clicks through our own opener. openUrl: (url) => { @@ -123,6 +120,9 @@ export function createTUIState(options: PythinkerTUIOptions): TUIState { }) .catch(() => {}); }, + // Clickable pill centered on the transcript's last row while it is + // scrolled away from the end. + scrollToEndIndicator: () => currentTheme.fg('primary', ' ↓ Jump to bottom '), }) : new TuiMainScreen(terminal); diff --git a/apps/pythinker-code/src/tui/types.ts b/apps/pythinker-code/src/tui/types.ts index 3ab1ad68e..dbc2f5b75 100644 --- a/apps/pythinker-code/src/tui/types.ts +++ b/apps/pythinker-code/src/tui/types.ts @@ -10,7 +10,7 @@ import type { ToolInputDisplay, } from '@pymodel/pythinker-code-sdk'; -import type { MarkdownConfig, NotificationsConfig, StatusLineConfig, UpgradePreferences } from './config'; +import type { MarkdownConfig, NotificationsConfig, StatusLineConfig, TuiMode, UpgradePreferences } from './config'; import type { PendingApproval, PendingQuestion } from './reverse-rpc/types'; import type { ColorToken, ThemeName } from './theme'; @@ -72,6 +72,7 @@ export interface AppState { /** Pending step retry backoff (fed by `turn.step.retrying`); null when no retry is in flight. */ stepRetry: StepRetryState | null; theme: ThemeName; + tuiMode?: TuiMode; version: string; editorCommand: string | null; /** Mirrors the TUI config toggle; defaults to false when absent from older fixtures. */ diff --git a/apps/pythinker-code/src/tui/utils/component-capabilities.ts b/apps/pythinker-code/src/tui/utils/component-capabilities.ts index 810f08cae..7e0023293 100644 --- a/apps/pythinker-code/src/tui/utils/component-capabilities.ts +++ b/apps/pythinker-code/src/tui/utils/component-capabilities.ts @@ -4,14 +4,17 @@ export interface Expandable { /** * An expandable component that can say whether ctrl+o would change what it - * shows — content it keeps out of its collapsed form. Drives the footer's - * `ctrl+o expand` / `ctrl+o collapse` hint. + * shows — content it keeps out of its collapsed form. */ export interface HidesContent extends Expandable { hasHiddenContent(): boolean; isExpanded(): boolean; } +export interface OmitsExpandHint { + omitsExpandHint(): boolean; +} + export interface Disposable { dispose(): void; } @@ -34,6 +37,21 @@ export function hasHiddenContent(obj: unknown): boolean { ); } +export function countedByExpandHint(obj: unknown): boolean { + if (omitsExpandHint(obj)) return false; + return hasHiddenContent(obj); +} + +function omitsExpandHint(obj: unknown): boolean { + return ( + typeof obj === 'object' && + obj !== null && + 'omitsExpandHint' in obj && + typeof (obj as OmitsExpandHint).omitsExpandHint === 'function' && + (obj as OmitsExpandHint).omitsExpandHint() + ); +} + /** Whether an expandable component currently shows its expanded form. */ export function isExpandedComponent(obj: unknown): boolean { return ( diff --git a/apps/pythinker-code/src/utils/git/git-args.ts b/apps/pythinker-code/src/utils/git/git-args.ts new file mode 100644 index 000000000..fbcec0e07 --- /dev/null +++ b/apps/pythinker-code/src/utils/git/git-args.ts @@ -0,0 +1,22 @@ +const NULL_DEVICE = process.platform === 'win32' ? 'NUL' : '/dev/null'; + +export const GIT_CONFIG_ARGS: readonly string[] = [ + '-c', + 'core.fsmonitor=false', + '-c', + `core.hooksPath=${NULL_DEVICE}`, + '-c', + 'commit.gpgSign=false', + '-c', + 'log.showSignature=false', + '-c', + 'merge.verifySignatures=false', + '-c', + 'core.editor=', + '-c', + 'gpg.program=', + '-c', + 'submodule.recurse=false', +]; + +export const GIT_DIFF_ARGS: readonly string[] = ['--no-ext-diff', '--no-textconv']; diff --git a/apps/pythinker-code/src/utils/git/git-status.ts b/apps/pythinker-code/src/utils/git/git-status.ts index 56b7f0af6..8ca6fc9f6 100644 --- a/apps/pythinker-code/src/utils/git/git-status.ts +++ b/apps/pythinker-code/src/utils/git/git-status.ts @@ -9,6 +9,7 @@ import { execFile, spawnSync } from 'node:child_process'; +import { GIT_CONFIG_ARGS, GIT_DIFF_ARGS } from '#/utils/git/git-args'; import { resolveCommandPath } from '#/utils/process/resolve-command'; const BRANCH_TTL_MS = 5_000; @@ -69,11 +70,11 @@ export function createGitStatusCache( workDir: string, options: GitStatusCacheOptions = {}, ): GitStatusCache { - // This cache is constructed before the workspace trust gate, so the git - // binary must be resolved through PATH to an absolute path — a bare name - // would let cmd.exe pick up a `git.exe` planted in the workspace. + // Resolve through PATH to an absolute path — a bare name would let cmd.exe + // pick up a `git.exe` planted in the workspace. const git = resolveCommandPath('git', workDir); - const isRepo = git !== undefined && detectGitRepo(git, workDir); + let repoDetected = false; + let isRepo = false; let branch: BranchState = { value: null, fetchedAt: 0 }; let status: StatusState = { dirty: false, @@ -93,16 +94,22 @@ export function createGitStatusCache( return { getStatus: () => { - if (!isRepo || git === undefined) return null; + if (git === undefined) return null; + if (repoDetected && !isRepo) return null; + if (!repoDetected) { + repoDetected = true; + isRepo = detectGitRepo(git, workDir, GIT_CONFIG_ARGS); + } + if (!isRepo) return null; const now = Date.now(); if (now - branch.fetchedAt >= BRANCH_TTL_MS) { - branch = { value: readBranch(git, workDir), fetchedAt: now }; + branch = { value: readBranch(git, workDir, GIT_CONFIG_ARGS), fetchedAt: now }; } if (branch.value === null) return null; if (now - status.fetchedAt >= STATUS_TTL_MS) { - status = { ...readStatus(git, workDir), fetchedAt: now }; + status = { ...readStatus(git, workDir, GIT_CONFIG_ARGS), fetchedAt: now }; } refreshPullRequestIfNeeded(branch.value, now); @@ -149,24 +156,32 @@ export function createGitStatusCache( } } -function detectGitRepo(git: string, workDir: string): boolean { +function detectGitRepo(git: string, workDir: string, configArgs: readonly string[]): boolean { try { - const result = spawnSync(git, ['-C', workDir, 'rev-parse', '--is-inside-work-tree'], { - encoding: 'utf8', - timeout: SPAWN_TIMEOUT_MS, - }); + const result = spawnSync( + git, + [...configArgs, '-C', workDir, 'rev-parse', '--is-inside-work-tree'], + { + encoding: 'utf8', + timeout: SPAWN_TIMEOUT_MS, + }, + ); return result.status === 0 && result.stdout.trim() === 'true'; } catch { return false; } } -function readBranch(git: string, workDir: string): string | null { +function readBranch(git: string, workDir: string, configArgs: readonly string[]): string | null { try { - const result = spawnSync(git, ['-C', workDir, 'branch', '--show-current'], { - encoding: 'utf8', - timeout: SPAWN_TIMEOUT_MS, - }); + const result = spawnSync( + git, + [...configArgs, '-C', workDir, 'branch', '--show-current'], + { + encoding: 'utf8', + timeout: SPAWN_TIMEOUT_MS, + }, + ); if (result.status !== 0) return null; const name = result.stdout.trim(); return name.length > 0 ? name : null; @@ -178,6 +193,7 @@ function readBranch(git: string, workDir: string): string | null { function readStatus( git: string, workDir: string, + configArgs: readonly string[], ): { dirty: boolean; ahead: number; @@ -186,11 +202,15 @@ function readStatus( diffDeleted: number; } { try { - const result = spawnSync(git, ['-C', workDir, 'status', '--porcelain', '-b'], { - encoding: 'utf8', - timeout: SPAWN_TIMEOUT_MS, - maxBuffer: 4 * 1024 * 1024, - }); + const result = spawnSync( + git, + [...configArgs, '-C', workDir, 'status', '--porcelain', '-b'], + { + encoding: 'utf8', + timeout: SPAWN_TIMEOUT_MS, + maxBuffer: 4 * 1024 * 1024, + }, + ); if (result.status !== 0) { return { dirty: false, ahead: 0, behind: 0, diffAdded: 0, diffDeleted: 0 }; } @@ -209,7 +229,7 @@ function readStatus( dirty = true; } } - const diff = dirty ? readDiffStats(git, workDir) : { added: 0, deleted: 0 }; + const diff = dirty ? readDiffStats(git, workDir, configArgs) : { added: 0, deleted: 0 }; return { dirty, ahead, @@ -222,13 +242,30 @@ function readStatus( } } -function readDiffStats(git: string, workDir: string): { added: number; deleted: number } { +function readDiffStats( + git: string, + workDir: string, + configArgs: readonly string[], +): { added: number; deleted: number } { try { - const result = spawnSync(git, ['-C', workDir, 'diff', '--numstat', 'HEAD', '--'], { - encoding: 'utf8', - timeout: SPAWN_TIMEOUT_MS, - maxBuffer: 4 * 1024 * 1024, - }); + const result = spawnSync( + git, + [ + ...configArgs, + '-C', + workDir, + 'diff', + ...GIT_DIFF_ARGS, + '--numstat', + 'HEAD', + '--', + ], + { + encoding: 'utf8', + timeout: SPAWN_TIMEOUT_MS, + maxBuffer: 4 * 1024 * 1024, + }, + ); if (result.status !== 0) return { added: 0, deleted: 0 }; let added = 0; diff --git a/apps/pythinker-code/test/native/build-scripts.test.ts b/apps/pythinker-code/test/native/build-scripts.test.ts new file mode 100644 index 000000000..5c4277f97 --- /dev/null +++ b/apps/pythinker-code/test/native/build-scripts.test.ts @@ -0,0 +1,15 @@ +import { describe, expect, it } from 'vitest'; + +import { SEA_EXEC_ARGV, seaCodeCacheEnabled } from '../../scripts/native/sea-options.mjs'; + +describe('sea-options', () => { + it('bakes a bounded young generation into the binary', () => { + expect(SEA_EXEC_ARGV).toEqual(['--max-semi-space-size=16']); + expect(Object.isFrozen(SEA_EXEC_ARGV)).toBe(true); + }); + + it('only enables the V8 code cache when the target matches the build host', () => { + expect(seaCodeCacheEnabled('darwin-arm64', 'darwin-arm64')).toBe(true); + expect(seaCodeCacheEnabled('linux-x64', 'darwin-arm64')).toBe(false); + }); +}); diff --git a/apps/pythinker-code/test/tui/activity-pane.test.ts b/apps/pythinker-code/test/tui/activity-pane.test.ts index 63955402f..3721fe649 100644 --- a/apps/pythinker-code/test/tui/activity-pane.test.ts +++ b/apps/pythinker-code/test/tui/activity-pane.test.ts @@ -142,7 +142,7 @@ describe('updateActivityPane terminal progress', () => { expect(setProgress).toHaveBeenLastCalledWith(false); }); - it('keeps terminal progress active without showing a thinking spinner', () => { + it('keeps terminal progress active while showing the thinking spinner', () => { vi.useFakeTimers(); try { const { driver, state, setProgress } = makeDriverWithTerminalProgress(); @@ -153,8 +153,8 @@ describe('updateActivityPane terminal progress', () => { expect(setProgress).toHaveBeenCalledTimes(1); expect(setProgress).toHaveBeenLastCalledWith(true); - expect(state.activitySpinner).toBeNull(); - expect(state.activityContainer.children).toHaveLength(0); + expect(state.activitySpinner).not.toBeNull(); + expect(state.activityContainer.children).toHaveLength(1); state.appState.streamingPhase = 'idle'; driver.updateActivityPane(); diff --git a/apps/pythinker-code/test/tui/commands/reload.test.ts b/apps/pythinker-code/test/tui/commands/reload.test.ts index 96d2d608e..cf73c1f9a 100644 --- a/apps/pythinker-code/test/tui/commands/reload.test.ts +++ b/apps/pythinker-code/test/tui/commands/reload.test.ts @@ -2,7 +2,7 @@ import { mkdtemp, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; -import { afterEach, describe, expect, it, vi } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { handleReloadCommand, @@ -24,7 +24,12 @@ import { const tempDirs: string[] = []; const originalPythinkerCodeHome = process.env['PYTHINKER_CODE_HOME']; +beforeEach(() => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', ''); +}); + afterEach(async () => { + vi.unstubAllEnvs(); setExperimentalFeatures([]); for (const dir of tempDirs.splice(0)) { await rm(dir, { recursive: true, force: true }); @@ -192,6 +197,29 @@ auto_install = false 'success', ); }); + + it('notices a required restart when tui_mode differs from the running UI mode', async () => { + await writeTuiConfig('tui_mode = "fullscreen"\n'); + const host = makeHost(); + + await handleReloadTuiCommand(host); + + expect(host.setAppState).toHaveBeenCalledWith( + expect.objectContaining({ tuiMode: 'fullscreen' }), + ); + expect(host.showNotice).toHaveBeenCalledWith( + 'TUI mode takes effect after restarting Pythinker Code.', + ); + }); + + it('does not notice when tui_mode matches the running UI mode', async () => { + await writeTuiConfig('theme = "dark"\n'); + const host = makeHost(); + + await handleReloadTuiCommand(host); + + expect(host.showNotice).not.toHaveBeenCalled(); + }); }); async function writeTuiConfig(text: string): Promise { @@ -218,6 +246,9 @@ function makeHost({ editor: { setDisablePasteBurst: vi.fn(), }, + ui: { + mode: 'regular' as const, + }, theme: { palette: { success: '#00ff00', @@ -249,6 +280,7 @@ function makeHost({ refreshSlashCommandAutocomplete: vi.fn(), reloadCurrentSessionView: vi.fn(async () => {}), showStatus: vi.fn(), + showNotice: vi.fn(), } as unknown as SlashCommandHost & { readonly harness: { readonly reloadSession: ReturnType; @@ -258,5 +290,6 @@ function makeHost({ readonly refreshSlashCommandAutocomplete: ReturnType; readonly reloadCurrentSessionView: ReturnType; readonly showStatus: ReturnType; + readonly showNotice: ReturnType; }; } diff --git a/apps/pythinker-code/test/tui/commands/tui-mode-preferences.test.ts b/apps/pythinker-code/test/tui/commands/tui-mode-preferences.test.ts new file mode 100644 index 000000000..cac612374 --- /dev/null +++ b/apps/pythinker-code/test/tui/commands/tui-mode-preferences.test.ts @@ -0,0 +1,92 @@ +import { describe, expect, it, vi } from 'vitest'; + +import { applyTuiModeChoice } from '#/tui/commands/config'; + +const mocks = vi.hoisted(() => ({ + saveTuiConfig: vi.fn(), +})); + +vi.mock('../../../src/tui/config', async () => { + const actual = await vi.importActual( + '../../../src/tui/config.js', + ); + return { + ...actual, + saveTuiConfig: mocks.saveTuiConfig, + }; +}); + +function makeHost( + tuiMode: 'regular' | 'fullscreen', + runningMode: 'regular' | 'fullscreen' = 'regular', +) { + return { + state: { + appState: { + theme: 'auto' as const, + tuiMode, + editorCommand: null, + notifications: { enabled: true, condition: 'unfocused' as const }, + upgrade: { autoInstall: true }, + }, + ui: { mode: runningMode }, + }, + setAppState: vi.fn(), + showStatus: vi.fn(), + showNotice: vi.fn(), + }; +} + +describe('tui mode preference commands', () => { + it('saves fullscreen to tui.toml, mirrors appState, and notices the required restart', async () => { + mocks.saveTuiConfig.mockClear(); + const host = makeHost('regular'); + + await applyTuiModeChoice(host, 'fullscreen'); + + expect(mocks.saveTuiConfig).toHaveBeenCalledWith( + expect.objectContaining({ tuiMode: 'fullscreen' }), + ); + expect(host.setAppState).toHaveBeenCalledWith({ tuiMode: 'fullscreen' }); + expect(host.showStatus).toHaveBeenCalledWith('TUI mode set to fullscreen.', 'success'); + expect(host.showNotice).toHaveBeenCalledWith( + 'TUI mode takes effect after restarting Pythinker Code.', + ); + }); + + it('skips the restart notice when switching back to the running mode', async () => { + mocks.saveTuiConfig.mockClear(); + const host = makeHost('fullscreen', 'regular'); + + await applyTuiModeChoice(host, 'regular'); + + expect(mocks.saveTuiConfig).toHaveBeenCalledWith( + expect.objectContaining({ tuiMode: 'regular' }), + ); + expect(host.setAppState).toHaveBeenCalledWith({ tuiMode: 'regular' }); + expect(host.showNotice).not.toHaveBeenCalled(); + }); + + it('does not rewrite the config when the value is unchanged', async () => { + mocks.saveTuiConfig.mockClear(); + const host = makeHost('regular'); + + await applyTuiModeChoice(host, 'regular'); + + expect(mocks.saveTuiConfig).not.toHaveBeenCalled(); + expect(host.setAppState).not.toHaveBeenCalled(); + expect(host.showNotice).not.toHaveBeenCalled(); + expect(host.showStatus).toHaveBeenCalledWith('TUI mode already regular.'); + }); + + it('reports a save failure without touching appState', async () => { + mocks.saveTuiConfig.mockRejectedValueOnce(new Error('disk full')); + const host = makeHost('regular'); + + await applyTuiModeChoice(host, 'fullscreen'); + + expect(host.setAppState).not.toHaveBeenCalled(); + expect(host.showNotice).not.toHaveBeenCalled(); + expect(host.showStatus).toHaveBeenCalledWith('Failed to save TUI mode: disk full', 'error'); + }); +}); diff --git a/apps/pythinker-code/test/tui/components/chrome/footer.test.ts b/apps/pythinker-code/test/tui/components/chrome/footer.test.ts index 800d5761c..00c03d7eb 100644 --- a/apps/pythinker-code/test/tui/components/chrome/footer.test.ts +++ b/apps/pythinker-code/test/tui/components/chrome/footer.test.ts @@ -1,5 +1,5 @@ import chalk from 'chalk'; -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { FooterComponent } from '#/tui/components/chrome/footer'; import { setRainbowDance, type RainbowDanceController } from '#/tui/easter-eggs/dance'; @@ -7,6 +7,22 @@ import { currentTheme, darkColors, lightColors } from '#/tui/theme'; import type { ModelAlias } from '@pymodel/pythinker-code-sdk'; import type { AppState } from '#/tui/types'; +const gitStatusMocks = vi.hoisted(() => ({ + createGitStatusCache: vi.fn(), +})); + +vi.mock('#/utils/git/git-status', async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, createGitStatusCache: gitStatusMocks.createGitStatusCache }; +}); + +beforeEach(() => { + gitStatusMocks.createGitStatusCache.mockClear(); + gitStatusMocks.createGitStatusCache.mockImplementation(() => ({ + getStatus: vi.fn(() => null), + })); +}); + const TRUECOLOR_PATTERN = /\[38;2;(\d+);(\d+);(\d+)m/g; function truecolorCodes(text: string): Set { diff --git a/apps/pythinker-code/test/tui/components/dialogs/choice-picker.test.ts b/apps/pythinker-code/test/tui/components/dialogs/choice-picker.test.ts index c0fac1c1e..bdb13ffcb 100644 --- a/apps/pythinker-code/test/tui/components/dialogs/choice-picker.test.ts +++ b/apps/pythinker-code/test/tui/components/dialogs/choice-picker.test.ts @@ -107,7 +107,8 @@ describe('ChoicePickerComponent', () => { const settingsOutput = settings.render(120).map(strip); expect(settingsOutput).toContain(' ❯ Model'); expect(settingsOutput).toContain(' Switch the active model and thinking mode.'); - expect(settingsOutput).toContain(' Turn automatic CLI updates on or off.'); + expect(settingsOutput).toContain(' TUI mode'); + expect(settingsOutput).toContain(' Choose the regular or fullscreen layout.'); const upgradePreference = new UpdatePreferenceSelectorComponent({ currentValue: true, diff --git a/apps/pythinker-code/test/tui/components/panes/activity-pane.test.ts b/apps/pythinker-code/test/tui/components/panes/activity-pane.test.ts index 0a7efc096..2665fc303 100644 --- a/apps/pythinker-code/test/tui/components/panes/activity-pane.test.ts +++ b/apps/pythinker-code/test/tui/components/panes/activity-pane.test.ts @@ -27,7 +27,7 @@ function createMockSpinner(initialText = 'working') { } describe('ActivityPaneComponent', () => { - it('renders waiting loader after a spacer', () => { + it('renders the waiting loader after a spacer', () => { const { spinner } = createMockSpinner('loading'); const component = new ActivityPaneComponent({ mode: 'waiting', @@ -37,7 +37,7 @@ describe('ActivityPaneComponent', () => { expect(component.render(80).map((line) => line.trimEnd())).toEqual(['', 'loading']); }); - it('renders composing spinner after a spacer', () => { + it('renders the composing spinner after a spacer', () => { const { spinner } = createMockSpinner('working'); const component = new ActivityPaneComponent({ mode: 'composing', @@ -47,6 +47,16 @@ describe('ActivityPaneComponent', () => { expect(component.render(80).map((line) => line.trimEnd())).toEqual(['', 'working']); }); + it('renders the thinking spinner after a spacer', () => { + const { spinner } = createMockSpinner('thinking'); + const component = new ActivityPaneComponent({ + mode: 'thinking', + spinner, + }); + + expect(component.render(80).map((line) => line.trimEnd())).toEqual(['', 'thinking']); + }); + it('renders the detail line under the waiting spinner', () => { const { spinner } = createMockSpinner('working'); const component = new ActivityPaneComponent({ @@ -61,8 +71,8 @@ describe('ActivityPaneComponent', () => { expect(lines).toEqual(['', 'working', ' 429 · rate limited']); }); - it.each(['waiting', 'tool', 'composing'] as const)( - 'renders %s spinner with tip after a spacer', + it.each(['waiting', 'tool', 'composing', 'thinking'] as const)( + 'renders the %s spinner with tip after a spacer', (mode) => { const { spinner } = createMockSpinner('working'); const component = new ActivityPaneComponent({ @@ -91,7 +101,7 @@ describe('ActivityPaneComponent', () => { }, ); - it('renders nothing for hidden and thinking modes', () => { + it('renders nothing for hidden, or for thinking without a spinner', () => { expect(new ActivityPaneComponent({ mode: 'hidden' }).render(80)).toEqual([]); expect(new ActivityPaneComponent({ mode: 'thinking' }).render(80)).toEqual([]); }); diff --git a/apps/pythinker-code/test/tui/config.test.ts b/apps/pythinker-code/test/tui/config.test.ts index 55912ac3c..509e9df8a 100644 --- a/apps/pythinker-code/test/tui/config.test.ts +++ b/apps/pythinker-code/test/tui/config.test.ts @@ -2,7 +2,7 @@ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { DEFAULT_TUI_CONFIG, @@ -17,11 +17,13 @@ let dir: string; let filePath: string; beforeEach(() => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', ''); dir = mkdtempSync(join(tmpdir(), 'pythinker-tui-config-')); filePath = join(dir, 'tui.toml'); }); afterEach(() => { + vi.unstubAllEnvs(); rmSync(dir, { recursive: true, force: true }); }); @@ -60,6 +62,7 @@ auto_install = false expect(config).toEqual({ theme: 'light', + tuiMode: 'regular', renderLatex: true, disablePasteBurst: false, cacheExpiryHint: true, @@ -118,6 +121,7 @@ command = " " expect(config).toEqual({ theme: 'auto', + tuiMode: 'regular', renderLatex: true, disablePasteBurst: false, cacheExpiryHint: true, @@ -168,6 +172,7 @@ command = " " expect(await loadTuiConfig(filePath)).toEqual({ theme: 'light', + tuiMode: 'regular', renderLatex: true, disablePasteBurst: false, cacheExpiryHint: true, @@ -351,3 +356,113 @@ mermaid = "${value}" expect((await loadTuiConfig(filePath)).markdown).toEqual({ mermaid: 'off' }); }); }); + +describe('TUI config tui_mode', () => { + it('defaults tui_mode to regular when omitted', () => { + expect(parseTuiConfig(`theme = "dark"`).tuiMode).toBe('regular'); + }); + + it('parses tui_mode = "fullscreen"', () => { + const config = parseTuiConfig(` +tui_mode = "fullscreen" +`); + + expect(config.tuiMode).toBe('fullscreen'); + }); + + it('warns and falls back to regular for unknown tui_mode values without failing the file', () => { + const warnings: string[] = []; + const config = parseTuiConfig( + ` +theme = "dark" +tui_mode = "weird" +`, + (message) => warnings.push(message), + ); + + expect(config.tuiMode).toBe('regular'); + expect(config.theme).toBe('dark'); + expect(warnings).toEqual(['[tui.toml] ignoring unknown tui_mode value: weird']); + }); + + it('writes a live tui_mode key even at the default value', async () => { + await saveTuiConfig(DEFAULT_TUI_CONFIG, filePath); + + const text = readFileSync(filePath, 'utf-8'); + expect(text).toContain('\ntui_mode = "regular"'); + expect(text).not.toContain('# tui_mode'); + }); + + it('writes a live tui_mode when fullscreen and round-trips it', async () => { + await saveTuiConfig({ ...DEFAULT_TUI_CONFIG, tuiMode: 'fullscreen' }, filePath); + + const text = readFileSync(filePath, 'utf-8'); + expect(text).toContain('\ntui_mode = "fullscreen"'); + expect((await loadTuiConfig(filePath)).tuiMode).toBe('fullscreen'); + }); +}); + +describe('TUI config tui_mode env migration', () => { + it('migrates PYTHINKER_CODE_TUI_FULL_SCREEN=1 into tui_mode when the key is absent', async () => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); + writeFileSync(filePath, 'theme = "dark"\n', 'utf-8'); + const warnings: string[] = []; + + const config = await loadTuiConfig(filePath, (message) => warnings.push(message)); + + expect(config.tuiMode).toBe('fullscreen'); + expect(readFileSync(filePath, 'utf-8')).toContain('\ntui_mode = "fullscreen"'); + expect(warnings).toEqual([]); + }); + + it('ignores the env when tui_mode is explicitly regular', async () => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); + writeFileSync(filePath, 'tui_mode = "regular"\n', 'utf-8'); + + const config = await loadTuiConfig(filePath); + + expect(config.tuiMode).toBe('regular'); + expect(readFileSync(filePath, 'utf-8')).toBe('tui_mode = "regular"\n'); + }); + + it('does not migrate over an explicitly set unknown value', async () => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); + writeFileSync(filePath, 'tui_mode = "weird"\n', 'utf-8'); + const warnings: string[] = []; + + const config = await loadTuiConfig(filePath, (message) => warnings.push(message)); + + expect(config.tuiMode).toBe('regular'); + expect(warnings).toEqual(['[tui.toml] ignoring unknown tui_mode value: weird']); + expect(readFileSync(filePath, 'utf-8')).toBe('tui_mode = "weird"\n'); + }); + + it('only honors the exact value 1 like the old gate', async () => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', 'true'); + writeFileSync(filePath, 'theme = "dark"\n', 'utf-8'); + + const config = await loadTuiConfig(filePath); + + expect(config.tuiMode).toBe('regular'); + expect(readFileSync(filePath, 'utf-8')).toBe('theme = "dark"\n'); + }); + + it('migrates when the config file does not exist yet', async () => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); + + const config = await loadTuiConfig(filePath); + + expect(config.tuiMode).toBe('fullscreen'); + expect(readFileSync(filePath, 'utf-8')).toContain('\ntui_mode = "fullscreen"'); + }); + + it('does not re-migrate after a regular preference has been saved', async () => { + vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); + await saveTuiConfig({ ...DEFAULT_TUI_CONFIG, tuiMode: 'regular' }, filePath); + + const config = await loadTuiConfig(filePath); + + expect(config.tuiMode).toBe('regular'); + expect(readFileSync(filePath, 'utf-8')).toContain('\ntui_mode = "regular"'); + }); +}); diff --git a/apps/pythinker-code/test/tui/create-tui-state.test.ts b/apps/pythinker-code/test/tui/create-tui-state.test.ts index 15500733e..ad78a45ea 100644 --- a/apps/pythinker-code/test/tui/create-tui-state.test.ts +++ b/apps/pythinker-code/test/tui/create-tui-state.test.ts @@ -1,5 +1,5 @@ -import { describe, it, expect, vi } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { TuiAltScreen, TuiMainScreen } from '@pymodel/pi-tui'; @@ -93,26 +93,19 @@ describe('createTUIState', () => { }); it('uses the docked fullscreen renderer when fullscreen is enabled', () => { - const previous = process.env['PYTHINKER_CODE_TUI_FULL_SCREEN']; - process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] = '1'; - try { - const state = createTUIState({ - initialAppState: fakeInitialAppState(), - startup: { - continueLast: false, - yolo: false, - auto: false, - plan: false, - }, - }); - - expect(state.ui).toBeInstanceOf(TuiAltScreen); - expect(state.ui.mode).toBe('fullscreen'); - expect(state.dockContainer).toBeDefined(); - } finally { - if (previous === undefined) delete process.env['PYTHINKER_CODE_TUI_FULL_SCREEN']; - else process.env['PYTHINKER_CODE_TUI_FULL_SCREEN'] = previous; - } + const state = createTUIState({ + initialAppState: { ...fakeInitialAppState(), tuiMode: 'fullscreen' }, + startup: { + continueLast: false, + yolo: false, + auto: false, + plan: false, + }, + }); + + expect(state.ui).toBeInstanceOf(TuiAltScreen); + expect(state.ui.mode).toBe('fullscreen'); + expect(state.dockContainer).toBeDefined(); }); it('uses the main-screen renderer when fullscreen is disabled', () => { @@ -135,9 +128,8 @@ describe('createTUIState', () => { }); it('builds an alternate-screen renderer with a docked layout in fullscreen mode', () => { - vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); const state = createTUIState({ - initialAppState: fakeInitialAppState(), + initialAppState: { ...fakeInitialAppState(), tuiMode: 'fullscreen' }, startup: { continueLast: false, yolo: false, @@ -145,7 +137,6 @@ describe('createTUIState', () => { plan: false, }, }); - vi.unstubAllEnvs(); expect(state.ui).toBeInstanceOf(TuiAltScreen); expect(state.ui.mode).toBe('fullscreen'); diff --git a/apps/pythinker-code/test/tui/fullscreen-layout.test.ts b/apps/pythinker-code/test/tui/fullscreen-layout.test.ts index ea65674c8..a07646989 100644 --- a/apps/pythinker-code/test/tui/fullscreen-layout.test.ts +++ b/apps/pythinker-code/test/tui/fullscreen-layout.test.ts @@ -5,7 +5,7 @@ * shrink distribution with no minSize, so a tall transcript crushed it and * the editor's bottom border row was clipped off screen. */ -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it } from 'vitest'; import { Spacer, type Terminal, TuiAltScreen } from '@pymodel/pi-tui'; import { VirtualTerminal } from '../../../../packages/pi-tui/test/virtual-terminal'; @@ -70,12 +70,10 @@ async function mountFullscreen(): Promise<{ vt: VirtualTerminal; }> { const opts: PythinkerTUIOptions = { - initialAppState: fakeInitialAppState(), + initialAppState: { ...fakeInitialAppState(), tuiMode: 'fullscreen' }, startup: { continueLast: false, yolo: false, auto: false, plan: false }, }; - vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); const state = createTUIState(opts); - vi.unstubAllEnvs(); const vt = new VirtualTerminal(WIDTH, HEIGHT); (state.ui as { terminal: Terminal }).terminal = vt; @@ -144,7 +142,7 @@ describe('fullscreen layout', () => { const labelRow = vt .getViewport() - .findIndex((line) => stripAnsi(line).includes('Jump to bottom (click) ↓')); + .findIndex((line) => stripAnsi(line).includes('↓ Jump to bottom')); expect(labelRow).toBeGreaterThanOrEqual(0); expect((state.ui as TuiAltScreen).isFollowingOutput).toBe(false); diff --git a/apps/pythinker-code/test/tui/pythinker-tui-message-flow.test.ts b/apps/pythinker-code/test/tui/pythinker-tui-message-flow.test.ts index 793962a90..59d305e11 100644 --- a/apps/pythinker-code/test/tui/pythinker-tui-message-flow.test.ts +++ b/apps/pythinker-code/test/tui/pythinker-tui-message-flow.test.ts @@ -9,6 +9,7 @@ import { deleteAllKittyImages, resetCapabilitiesCache, setCapabilities, + type TuiMouseEvent, } from '@pymodel/pi-tui'; import type { ApprovalRequest, @@ -8133,10 +8134,7 @@ command = "vim" driver.handleUserInput('/fork ignored args'); await vi.waitFor(() => { - expect(forkSession).toHaveBeenCalledWith({ - id: 'ses-source', - title: 'Fork: Source title', - }); + expect(forkSession).toHaveBeenCalledWith({ id: 'ses-source' }); expect(driver.state.transcriptContainer.render(120).join('\n')).toContain( 'Session forked (ses-fork). Still in the original session; switch to the fork via /sessions.', ); @@ -8235,10 +8233,7 @@ command = "vim" driver.handleUserInput('/fork'); await vi.waitFor(() => { - expect(forkSession).toHaveBeenCalledWith({ - id: 'ses-source', - title: 'Fork: ses-source', - }); + expect(forkSession).toHaveBeenCalledWith({ id: 'ses-source' }); expect(driver.getCurrentSessionId()).toBe('ses-source'); expect(driver.state.transcriptContainer.render(120).join('\n')).toContain( 'Failed to fork session: fork unavailable', @@ -9235,3 +9230,301 @@ describe('PythinkerTUI session rating survey', () => { } }); }); + +describe('transcript fold block clicks', () => { + const transcriptWidth = 120; + + function hiddenOutput(name: string): string { + return [`${name}-body`, `${name}-mid`, `${name}-more`, `${name}-tail`].join('\n'); + } + + function emitBash( + driver: MessageDriver, + toolCallId: string, + command: string, + output: string, + ): void { + driver.sessionEventHandler.handleEvent( + { + type: 'tool.call.started', + agentId: 'main', + sessionId: 'ses-1', + turnId: 1, + toolCallId, + name: 'Bash', + args: { command }, + } as Event, + vi.fn(), + ); + driver.sessionEventHandler.handleEvent( + { + type: 'tool.result', + agentId: 'main', + sessionId: 'ses-1', + turnId: 1, + toolCallId, + output, + isError: undefined, + } as Event, + vi.fn(), + ); + } + + function renderFooterLine1(driver: MessageDriver): string { + return stripSgr(driver.state.footer.render(160)[0] ?? ''); + } + + function clickTranscriptLine(driver: MessageDriver, needle: string): void { + const lines = driver.state.transcriptContainer.render(transcriptWidth); + const y = lines.findIndex((line) => stripSgr(line).includes(needle)); + expect(y).toBeGreaterThanOrEqual(0); + const event: TuiMouseEvent = { + type: 'click', + button: 'left', + x: 2, + y, + screenX: 2, + screenY: y, + width: transcriptWidth, + height: lines.length, + shift: false, + alt: false, + ctrl: false, + clickCount: 1, + }; + driver.state.transcriptContainer.handleMouse(event); + } + + it('opens only the clicked tool card while the footer still offers expand', async () => { + const { driver } = await makeDriver(); + emitBash(driver, 'call_alpha', 'echo alpha', hiddenOutput('alpha')); + emitBash(driver, 'call_beta', 'echo beta', hiddenOutput('beta')); + + const collapsed = stripSgr(renderTranscript(driver)); + expect(collapsed).toContain('alpha-tail'); + expect(collapsed).not.toContain('alpha-body'); + expect(collapsed).not.toContain('beta-body'); + expect(renderFooterLine1(driver)).toContain('ctrl+o expand'); + + clickTranscriptLine(driver, 'alpha-tail'); + + const opened = stripSgr(renderTranscript(driver)); + expect(opened).toContain('alpha-body'); + expect(opened).not.toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(false); + expect(renderFooterLine1(driver)).toContain('ctrl+o expand'); + + clickTranscriptLine(driver, 'alpha-body'); + + const closed = stripSgr(renderTranscript(driver)); + expect(closed).not.toContain('alpha-body'); + expect(closed).not.toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(false); + expect(renderFooterLine1(driver)).toContain('ctrl+o expand'); + }); + + it('lets ctrl+o overwrite a clicked card and keeps a neighbor open', async () => { + const { driver } = await makeDriver(); + emitBash(driver, 'call_alpha', 'echo alpha', hiddenOutput('alpha')); + emitBash(driver, 'call_beta', 'echo beta', hiddenOutput('beta')); + + clickTranscriptLine(driver, 'alpha-tail'); + driver.toggleToolOutputExpansion(); + + const expanded = stripSgr(renderTranscript(driver)); + expect(expanded).toContain('alpha-body'); + expect(expanded).toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(true); + expect(renderFooterLine1(driver)).toContain('ctrl+o collapse'); + + clickTranscriptLine(driver, 'alpha-body'); + + const oneClosed = stripSgr(renderTranscript(driver)); + expect(oneClosed).not.toContain('alpha-body'); + expect(oneClosed).toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(true); + expect(renderFooterLine1(driver)).toContain('ctrl+o collapse'); + + driver.toggleToolOutputExpansion(); + + const collapsed = stripSgr(renderTranscript(driver)); + expect(collapsed).not.toContain('alpha-body'); + expect(collapsed).not.toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(false); + expect(renderFooterLine1(driver)).toContain('ctrl+o expand'); + }); + + it('closes an aged-out open card and does not open it again', async () => { + const { driver } = await makeDriver(); + emitBash(driver, 'call_old', 'echo old', hiddenOutput('old')); + driver.toggleToolOutputExpansion(); + expect(stripSgr(renderTranscript(driver))).toContain('old-body'); + + for (let i = 0; i < 4; i++) { + driver.appendTranscriptEntry({ + id: `later-${String(i)}`, + kind: 'user', + renderMode: 'plain', + content: `later turn ${String(i)}`, + }); + } + emitBash(driver, 'call_recent', 'echo recent', hiddenOutput('recent')); + + expect(stripSgr(renderTranscript(driver))).toContain('old-body'); + expect(stripSgr(renderTranscript(driver))).toContain('recent-body'); + + clickTranscriptLine(driver, 'old-body'); + + const oldClosed = stripSgr(renderTranscript(driver)); + expect(oldClosed).not.toContain('old-body'); + expect(oldClosed).toContain('recent-body'); + expect(driver.state.toolOutputExpanded).toBe(true); + + clickTranscriptLine(driver, 'old-tail'); + expect(stripSgr(renderTranscript(driver))).not.toContain('old-body'); + expect(stripSgr(renderTranscript(driver))).toContain('recent-body'); + + driver.toggleToolOutputExpansion(); + expect(stripSgr(renderTranscript(driver))).not.toContain('old-body'); + expect(stripSgr(renderTranscript(driver))).not.toContain('recent-body'); + expect(driver.state.toolOutputExpanded).toBe(false); + + driver.toggleToolOutputExpansion(); + const reopened = stripSgr(renderTranscript(driver)); + expect(reopened).not.toContain('old-body'); + expect(reopened).toContain('recent-body'); + expect(renderFooterLine1(driver)).toContain('ctrl+o collapse'); + }); + + it('does not change a fold block when the click lands on message text', async () => { + const { driver } = await makeDriver(); + emitBash(driver, 'call_alpha', 'echo alpha', hiddenOutput('alpha')); + driver.appendTranscriptEntry({ + id: 'user-plain', + kind: 'user', + renderMode: 'plain', + content: 'plain user sentence', + }); + + clickTranscriptLine(driver, 'plain user sentence'); + + const transcript = stripSgr(renderTranscript(driver)); + expect(transcript).toContain('plain user sentence'); + expect(transcript).not.toContain('alpha-body'); + expect(transcript).toContain('alpha-tail'); + expect(driver.state.toolOutputExpanded).toBe(false); + expect(renderFooterLine1(driver)).toContain('ctrl+o expand'); + }); + + it('toggles a long finalized thinking block without advertising it in the footer', async () => { + const { driver } = await makeDriver(); + const longThinking = ['think-one', 'think-two', 'think-three', 'think-four'].join('\n'); + driver.streamingUI.onThinkingUpdate(longThinking); + const streaming = stripSgr(renderTranscript(driver)); + expect(streaming).toContain('think-four'); + expect(streaming).not.toContain('think-one'); + + clickTranscriptLine(driver, 'think-four'); + expect(stripSgr(renderTranscript(driver))).not.toContain('think-one'); + + driver.streamingUI.onThinkingEnd(); + + const collapsed = stripSgr(renderTranscript(driver)); + expect(collapsed).toContain('think-one'); + expect(collapsed).not.toContain('think-four'); + expect(renderFooterLine1(driver)).not.toContain('ctrl+o'); + + clickTranscriptLine(driver, 'think-one'); + + const opened = stripSgr(renderTranscript(driver)); + expect(opened).toContain('think-four'); + expect(renderFooterLine1(driver)).not.toContain('ctrl+o'); + + clickTranscriptLine(driver, 'think-four'); + expect(stripSgr(renderTranscript(driver))).not.toContain('think-four'); + + driver.toggleToolOutputExpansion(); + expect(stripSgr(renderTranscript(driver))).toContain('think-four'); + expect(renderFooterLine1(driver)).not.toContain('ctrl+o'); + expect(driver.state.toolOutputExpanded).toBe(true); + + driver.toggleToolOutputExpansion(); + expect(stripSgr(renderTranscript(driver))).not.toContain('think-four'); + expect(driver.state.toolOutputExpanded).toBe(false); + expect(renderFooterLine1(driver)).not.toContain('ctrl+o'); + }); + + it('keeps the expand hint when clicked cards are all open', async () => { + const { driver } = await makeDriver(); + emitBash(driver, 'call_alpha', 'echo alpha', hiddenOutput('alpha')); + emitBash(driver, 'call_beta', 'echo beta', hiddenOutput('beta')); + + clickTranscriptLine(driver, 'alpha-tail'); + clickTranscriptLine(driver, 'beta-tail'); + + const opened = stripSgr(renderTranscript(driver)); + expect(opened).toContain('alpha-body'); + expect(opened).toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(false); + expect(renderFooterLine1(driver)).toContain('ctrl+o expand'); + }); + + it('drops the collapse hint after every open card is clicked shut', async () => { + const { driver } = await makeDriver(); + emitBash(driver, 'call_alpha', 'echo alpha', hiddenOutput('alpha')); + emitBash(driver, 'call_beta', 'echo beta', hiddenOutput('beta')); + driver.toggleToolOutputExpansion(); + expect(renderFooterLine1(driver)).toContain('ctrl+o collapse'); + + clickTranscriptLine(driver, 'alpha-body'); + clickTranscriptLine(driver, 'beta-body'); + + const closed = stripSgr(renderTranscript(driver)); + expect(closed).not.toContain('alpha-body'); + expect(closed).not.toContain('beta-body'); + expect(driver.state.toolOutputExpanded).toBe(true); + expect(renderFooterLine1(driver)).not.toContain('ctrl+o'); + }); + + it('closes a wrapped ! card that was opened from its preview', async () => { + const marker = 'shell-tail-marker'; + const stdout = `${'x'.repeat(4000)}${marker}`; + const runShellCommand = vi.fn(async () => ({ stdout, stderr: '', isError: false })); + const session = makeSession({ runShellCommand }); + const { driver } = await makeDriver(session); + driver.state.appState.inputMode = 'bash'; + driver.state.editor.inputMode = 'bash'; + + driver.handleUserInput('echo-shell'); + await vi.waitFor(() => { + const transcript = stripSgr(renderTranscript(driver)); + expect(transcript).toContain('ctrl+o to expand'); + expect(transcript).not.toContain(marker); + }); + + clickTranscriptLine(driver, 'more lines'); + expect(stripSgr(renderTranscript(driver))).toContain(marker); + + clickTranscriptLine(driver, marker); + const closed = stripSgr(renderTranscript(driver)); + expect(closed).not.toContain(marker); + expect(closed).toContain('ctrl+o to expand'); + expect(driver.state.toolOutputExpanded).toBe(false); + }); + + it('closes a wide tool card that mounted while the transcript was expanded', async () => { + const { driver } = await makeDriver(); + driver.toggleToolOutputExpansion(); + const output = `wide-head ${'w'.repeat(500)} wide-tail`; + emitBash(driver, 'call_wide', 'echo wide', output); + + expect(stripSgr(renderTranscript(driver))).toContain('wide-tail'); + + clickTranscriptLine(driver, 'echo wide'); + + const closed = stripSgr(renderTranscript(driver)); + expect(closed).not.toContain('wide-tail'); + expect(closed).toContain('wide-head'); + expect(driver.state.toolOutputExpanded).toBe(true); + }); +}); diff --git a/apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts b/apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts index 98ce5e4b2..7f1df042b 100644 --- a/apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts +++ b/apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts @@ -211,6 +211,7 @@ function makeHarness(session = makeSession(), overrides: Record track: vi.fn(), setTelemetryContext: vi.fn(), getExperimentalFeatures: vi.fn(async () => []), + getWorkspaceTrustInfo: vi.fn(async () => ({ trusted: true, gatedMcpServers: [] })), supportsAtomicSectionReplace: vi.fn(() => false), auth: { status: vi.fn(async () => ({ providers: [] })), @@ -289,11 +290,9 @@ describe('PythinkerTUI startup', () => { }); }); - it('mounts the docked fullscreen layout when PYTHINKER_CODE_TUI_FULL_SCREEN=1', async () => { + it('mounts the docked fullscreen layout when tui_mode is fullscreen', async () => { const harness = makeHarness(makeSession()); - vi.stubEnv('PYTHINKER_CODE_TUI_FULL_SCREEN', '1'); - const driver = makeDriver(harness, { ...makeStartupInput() }); - vi.unstubAllEnvs(); + const driver = makeDriver(harness, { ...makeStartupInput({}, { tuiMode: 'fullscreen' }) }); expect(driver.state.ui.mode).toBe('fullscreen'); expect(driver.state.ui.children).toHaveLength(0); @@ -2500,6 +2499,78 @@ describe('PythinkerTUI startup', () => { expect(onExit).toHaveBeenCalledWith(0); }); + it('prompts for workspace trust when trust info cannot be read', async () => { + const getWorkspaceTrustInfo = vi.fn(async () => { + throw new Error('unavailable'); + }); + const trustWorkspace = vi.fn(async () => {}); + const harness = makeHarness(makeSession(), { getWorkspaceTrustInfo, trustWorkspace }); + const driver = makeDriver(harness, { + ...makeStartupInput(), + migrationPlan: MIGRATION_PLAN, + migrateOnly: true, + }) as unknown as MigrateExitDriver & { + mountEditorReplacement(panel: { handleInput(data: string): void }): void; + }; + vi.spyOn(driver.state.ui, 'start').mockImplementation(() => {}); + vi.spyOn(driver.state.ui, 'stop').mockImplementation(() => {}); + vi.spyOn(driver.state.terminal, 'write').mockImplementation(() => {}); + vi.spyOn(driver, 'runMigrationScreen').mockResolvedValue({ decision: 'later' }); + const mountSpy = vi.spyOn(driver, 'mountEditorReplacement'); + const onExit = vi.fn(async () => {}); + driver.onExit = onExit; + + const startPromise = driver.start(); + await vi.waitFor(() => { + expect(mountSpy).toHaveBeenCalled(); + }); + mountSpy.mock.calls[0]![0].handleInput('\u001B[A'); + mountSpy.mock.calls[0]![0].handleInput('\r'); + await startPromise; + + expect(trustWorkspace).toHaveBeenCalledWith('/tmp/proj-a'); + expect(onExit).toHaveBeenCalledWith(0); + }); + + it('continues startup when persisting trust fails', async () => { + const getWorkspaceTrustInfo = vi.fn(async () => ({ + trusted: false, + gatedMcpServers: [], + })); + const trustWorkspace = vi.fn(async (): Promise => { + throw new Error('disk full'); + }); + const harness = makeHarness(makeSession(), { getWorkspaceTrustInfo, trustWorkspace }); + const driver = makeDriver(harness, { + ...makeStartupInput(), + migrationPlan: MIGRATION_PLAN, + migrateOnly: true, + }) as unknown as MigrateExitDriver & { + mountEditorReplacement(panel: { handleInput(data: string): void }): void; + }; + vi.spyOn(driver.state.ui, 'start').mockImplementation(() => {}); + vi.spyOn(driver.state.ui, 'stop').mockImplementation(() => {}); + vi.spyOn(driver.state.terminal, 'write').mockImplementation(() => {}); + const migrationSpy = vi + .spyOn(driver, 'runMigrationScreen') + .mockResolvedValue({ decision: 'later' }); + const mountSpy = vi.spyOn(driver, 'mountEditorReplacement'); + const onExit = vi.fn(async () => {}); + driver.onExit = onExit; + + const startPromise = driver.start(); + await vi.waitFor(() => { + expect(mountSpy).toHaveBeenCalled(); + }); + mountSpy.mock.calls[0]![0].handleInput('\u001B[A'); + mountSpy.mock.calls[0]![0].handleInput('\r'); + await startPromise; + + expect(trustWorkspace).toHaveBeenCalledWith('/tmp/proj-a'); + expect(migrationSpy).toHaveBeenCalled(); + expect(onExit).toHaveBeenCalledWith(0); + }); + it('does not mount the footer when resuming a missing session fails', async () => { const harness = makeHarness(makeSession(), { listSessions: vi.fn(async () => []), diff --git a/apps/pythinker-code/test/tui/signal-handlers.test.ts b/apps/pythinker-code/test/tui/signal-handlers.test.ts index e6fe9570d..bcf65e0d2 100644 --- a/apps/pythinker-code/test/tui/signal-handlers.test.ts +++ b/apps/pythinker-code/test/tui/signal-handlers.test.ts @@ -47,6 +47,7 @@ function makeHarness() { close: vi.fn(async () => {}), track: vi.fn(), setTelemetryContext: vi.fn(), + getWorkspaceTrustInfo: vi.fn(async () => ({ trusted: true, gatedMcpServers: [] })), }; } diff --git a/apps/pythinker-code/test/utils/git/git-status.test.ts b/apps/pythinker-code/test/utils/git/git-status.test.ts index 962bd8aa1..615ea9398 100644 --- a/apps/pythinker-code/test/utils/git/git-status.test.ts +++ b/apps/pythinker-code/test/utils/git/git-status.test.ts @@ -216,6 +216,49 @@ describe('git status cache', () => { expect(mocks.execFile).not.toHaveBeenCalled(); }); + it('disables repo-local command config on every git invocation', async () => { + mocks.execFile.mockImplementation( + ( + _cmd: string, + _args: string[], + _options: unknown, + callback: (error: Error | null, stdout: string, stderr: string) => void, + ) => { + callback(new Error('no pull request'), '', ''); + }, + ); + mocks.spawnSync.mockImplementation((_cmd: string, args: string[]) => { + if (args.includes('rev-parse')) return { status: 0, stdout: 'true\n' }; + if (args.includes('branch')) return { status: 0, stdout: 'main\n' }; + if (args.includes('status')) return { status: 0, stdout: '## main...origin/main\n M a.ts\n' }; + if (args.includes('diff')) return { status: 0, stdout: '1\t1\ta.ts\n' }; + return { status: 1, stdout: '' }; + }); + + const cache = createGitStatusCache('/tmp/repo'); + expect(cache.getStatus()).not.toBeNull(); + await Promise.resolve(); + + const nullDevice = process.platform === 'win32' ? 'NUL' : '/dev/null'; + expect(mocks.spawnSync).toHaveBeenCalledTimes(4); + for (const call of mocks.spawnSync.mock.calls) { + const args = call[1] as string[]; + expect(args.slice(0, 4)).toEqual([ + '-c', + 'core.fsmonitor=false', + '-c', + `core.hooksPath=${nullDevice}`, + ]); + } + const diffCall = mocks.spawnSync.mock.calls.find((call) => + (call[1] as string[]).includes('diff'), + ); + expect(diffCall).toBeDefined(); + const diffArgs = diffCall![1] as string[]; + expect(diffArgs).toContain('--no-ext-diff'); + expect(diffArgs).toContain('--no-textconv'); + }); + it('spawns git and gh through their resolved absolute paths', async () => { mocks.execFile.mockImplementation( ( @@ -277,6 +320,18 @@ describe('git status cache', () => { ).toBe('main [±]'); }); + it('skips git on later renders once the directory is known to be a non-repo', () => { + mocks.spawnSync.mockReturnValue({ status: 1, stdout: '' }); + const cache = createGitStatusCache('/tmp/not-a-repo'); + + expect(cache.getStatus()).toBeNull(); + const probeCalls = mocks.spawnSync.mock.calls.length; + expect(probeCalls).toBe(1); + + expect(cache.getStatus()).toBeNull(); + expect(mocks.spawnSync.mock.calls.length).toBe(probeCalls); + }); + it('formats pull request badges as terminal hyperlinks when requested', () => { const linked = formatGitBadge( { diff --git a/apps/vis/server/src/lib/agent-record-types.ts b/apps/vis/server/src/lib/agent-record-types.ts index d7f09da13..c2364c0e8 100644 --- a/apps/vis/server/src/lib/agent-record-types.ts +++ b/apps/vis/server/src/lib/agent-record-types.ts @@ -54,6 +54,11 @@ import type { PromptAborted, PromptCompleted, PromptSteered, + SubagentCancelled, + SubagentCompleted, + SubagentFailed, + SubagentSpawned, + SubagentStarted, TaskStarted, TaskTerminated, TaskWaitDelivered, @@ -190,6 +195,11 @@ export type AgentRecord = | WireRecordOf<'prompt.completed', PromptCompleted> | WireRecordOf<'prompt.steered', PromptSteered> | WireRecordOf<'runtime.set_binding', RuntimeSetBinding> + | WireRecordOf<'subagent.cancelled', SubagentCancelled> + | WireRecordOf<'subagent.completed', SubagentCompleted> + | WireRecordOf<'subagent.failed', SubagentFailed> + | WireRecordOf<'subagent.spawned', SubagentSpawned> + | WireRecordOf<'subagent.started', SubagentStarted> | WireRecordOf<'task.started', TaskStarted> | WireRecordOf<'task.terminated', TaskTerminated> | WireRecordOf<'task.waitDelivered', TaskWaitDelivered> diff --git a/apps/vis/server/src/lib/context-projector.ts b/apps/vis/server/src/lib/context-projector.ts index b7f607386..fc774cf2b 100644 --- a/apps/vis/server/src/lib/context-projector.ts +++ b/apps/vis/server/src/lib/context-projector.ts @@ -592,6 +592,11 @@ export function projectContext( case 'task.started': case 'task.terminated': case 'task.waitDelivered': + case 'subagent.spawned': + case 'subagent.started': + case 'subagent.completed': + case 'subagent.failed': + case 'subagent.cancelled': case 'cron.add': case 'cron.cursor': case 'cron.delete': diff --git a/apps/vis/web/src/components/wire/renderers.tsx b/apps/vis/web/src/components/wire/renderers.tsx index e60bda3e1..a07985103 100644 --- a/apps/vis/web/src/components/wire/renderers.tsx +++ b/apps/vis/web/src/components/wire/renderers.tsx @@ -1313,6 +1313,61 @@ export const WIRE_RENDERERS: RendererMap = { }), }, + 'subagent.spawned': { + tone: 'subagent', + label: 'sub+', + headline: (r) => ({ + main: ( + + + {r.dynamicWorkflowIndex === undefined ? 'child' : `member ${r.dynamicWorkflowIndex}`} + + {r.subagentId} + {r.subagentName} + + ), + right: r.runInBackground ? background : undefined, + }), + }, + + 'subagent.started': { + tone: 'subagent', + label: 'sub↻', + headline: (r) => ({ main: {r.subagentId} }), + }, + + 'subagent.completed': { + tone: 'subagent', + label: 'sub✓', + headline: (r) => ({ + main: ( + + {r.subagentId} + {truncate(r.resultSummary, 120)} + + ), + }), + }, + + 'subagent.failed': { + tone: 'subagent', + label: 'sub✗', + headline: (r) => ({ + main: ( + + {r.subagentId} + {truncate(r.error, 120)} + + ), + }), + }, + + 'subagent.cancelled': { + tone: 'subagent', + label: 'sub⊘', + headline: (r) => ({ main: {r.subagentId} }), + }, + 'token_counting.measured': { tone: 'meta', label: 'tokens', diff --git a/docs/configuration/config-files.md b/docs/configuration/config-files.md index a8046b8b8..91ebd573b 100644 --- a/docs/configuration/config-files.md +++ b/docs/configuration/config-files.md @@ -103,6 +103,7 @@ Fields in the config file fall into two categories: **top-level scalars** that d | `extra_agent_dirs` | `array` | — | Extra custom agent search directories, layered on top of the default directories | | `builtin_product_skills` | `boolean` | `true` | Whether the built-in skills that document Pythinker Code itself are offered to the model | | `telemetry` | `boolean` | `true` | Whether anonymous telemetry is enabled; disabled only when explicitly set to `false` | +| `auto_session_title` | `boolean` | `true` | Whether clients may automatically generate session titles; disabled only when explicitly set to `false` | | [`providers`](#providers) | `table` | `{}` | API provider table | | [`models`](#models) | `table` | — | Model alias table | | [`thinking`](#thinking) | `table` | — | Default parameters for Thinking mode | @@ -558,6 +559,7 @@ Alongside `config.toml`, the CLI keeps terminal-UI and client preferences in a c | Field | Type | Default | Description | | --- | --- | --- | --- | | `theme` | `string` | `auto` | Color theme: `auto`, `dark`, `light`, or the name of a [custom theme](../customization/themes.md) | +| `tui_mode` | `string` | `regular` | UI layout: `regular` renders into the terminal scrollback; `fullscreen` makes parts of the UI mouse-interactive. A layout change takes effect only after restart; `/reload-tui` does not switch the layout | | `render_latex` | `boolean` | `true` | Render LaTeX math expressions in Markdown messages as Unicode text; `false` keeps the raw source | | `disable_paste_burst` | `boolean` | `false` | Disable the non-bracketed paste-burst fallback that keeps rapid multi-line pastes from submitting line by line | | `cache_expiry_hint` | `boolean` | `true` | On resume or when submitting after a long idle stretch, warn that the context cache may have expired and offer to compact or start a new session (v2 engine only) | @@ -579,6 +581,7 @@ Model, cwd, git branch, permission mode, plan mode, context usage, session id, v ```toml # ~/.pythinker-code/tui.toml theme = "auto" # "auto" | "dark" | "light" | custom theme name +tui_mode = "regular" # "regular" | "fullscreen" render_latex = true # false keeps LaTeX math in messages as raw source disable_paste_burst = false # true disables non-bracketed paste-burst fallback cache_expiry_hint = true # false disables the "cache expired" dialog on resume / idle submit @@ -599,7 +602,7 @@ auto_install = true # command = "~/.pythinker-code/statusline.sh" ``` -Changes apply on the next start, or immediately with `/reload-tui` (which reloads only `tui.toml`); `/reload` reloads both `config.toml` and `tui.toml`. +Changes apply on the next start, or immediately with `/reload-tui` (which reloads only `tui.toml`); `/reload` reloads both `config.toml` and `tui.toml`. `tui_mode` is the exception: the layout changes only at the next start. ## Project-local configuration @@ -620,6 +623,8 @@ The `[workspace]` table groups project-level workspace settings: additional_dir = ["/absolute/path/to/shared"] ``` +`.pythinker-code/local.toml` is gated by workspace trust: it takes effect only after you trust the project folder in the startup trust prompt, and its `additional_dir` entries are ignored while the workspace is untrusted. Entries that resolve to your home directory or the filesystem root are rejected. + Because directories are stored as absolute paths, which are specific to your machine, we recommend adding `.pythinker-code/local.toml` to your project's `.gitignore` so it is not committed. ## Next steps diff --git a/docs/configuration/env-vars.md b/docs/configuration/env-vars.md index 5a3785724..bebad2470 100644 --- a/docs/configuration/env-vars.md +++ b/docs/configuration/env-vars.md @@ -139,6 +139,7 @@ Switches that control the behavior of subsystems such as telemetry, background t | `PYTHINKER_CODE_IDENTITY_NAME` | Display name the agent calls itself in the system prompt; takes higher priority than `[identity] name` in `config.toml` and is never written back to it | Any non-empty string; blank values read as unset | | `PYTHINKER_CODE_IDENTITY_SLUG` | Protocol identifier for the `User-Agent` product token sent to third-party providers and the MCP client name; takes higher priority than `[identity] slug`. Derived from the name when unset | Any non-empty string; normalized to lowercase with non-alphanumeric runs folded to `-` | | `PYTHINKER_CODE_BUILTIN_PRODUCT_SKILLS` | Whether the built-in skills documenting Pythinker Code itself are offered to the model; takes higher priority than `builtin_product_skills` in `config.toml` (default enabled) | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` | +| `PYTHINKER_CODE_REPEAT_BREAKER` | Whether repeating the same tool call many times in a row injects reminders and eventually force-stops the turn. Unset keeps this on | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off`; any other value is ignored | | `PYTHINKER_CODE_TUI_FULL_SCREEN` | Control the fullscreen TUI with a fixed prompt dock, scrollable transcript, mouse text selection, clickable links, transcript search, and a clickable jump-to-bottom control. Fullscreen is enabled by default | `0` restores the legacy inline UI; unset or any other value keeps fullscreen enabled | | `PYTHINKER_CODE_DANGEROUS_COMMAND_GUARD` | Override [`[permission].dangerous_command_guard`](./config-files.md#permission). The guard asks before dangerous or unanalyzable `Bash` commands in interactive modes and blocks them in Auto mode | `true` or `false`; default `true` | | `PYTHINKER_CODE_PERMISSION_MODE_REMINDER` | Stop injecting the automatic permission-mode reminder (the context note that explains Auto mode) into the model context; set to a false value or an empty value to disable | Truthy keeps the reminder enabled; falsy: `0`/`false`/`no`/`off` disables it; an empty value disables it | diff --git a/docs/reference/server-api.md b/docs/reference/server-api.md index 93ec80464..8274cc832 100644 --- a/docs/reference/server-api.md +++ b/docs/reference/server-api.md @@ -304,6 +304,7 @@ On success, `data` is the config object; its fields mirror the top-level domains | `secondary_model` | object | Secondary model pool for subagents | | `experimental` | object | Experimental flag id → enabled | | `telemetry` | boolean | Whether anonymous telemetry is enabled | +| `auto_session_title` | boolean | Whether clients may automatically generate session titles | | `raw` | object | Raw parsed `config.toml` content, unmodeled fields included | #### `POST /api/v1/config` @@ -336,6 +337,7 @@ The body is a partial config object — any subset of the response domains above | `secondary_model` | body | object | Secondary model pool for subagents | | `experimental` | body | object | Experimental flag id → enabled | | `telemetry` | body | boolean | Whether anonymous telemetry is enabled | +| `auto_session_title` | body | boolean | Whether clients may automatically generate session titles | On success, `data` is the full updated config in the same shape as `GET /api/v1/config`. diff --git a/packages/agent-core-v2/docs/config-manifest.toml b/packages/agent-core-v2/docs/config-manifest.toml index 599899c9d..0e082f896 100644 --- a/packages/agent-core-v2/docs/config-manifest.toml +++ b/packages/agent-core-v2/docs/config-manifest.toml @@ -8,7 +8,8 @@ # commented "# field: type" lines describe the remaining schema fields. # Values resolve as: default -> config.toml -> env overlay -> memory. -# Index (31 sections · 2 overlay(s)) +# Index (32 sections · 2 overlay(s)) +# autoSessionTitle src/session/sessionTitle/configSection.ts # background src/agent/task/configSection.ts # builtinProductSkills src/features/skill/catalog/configSection.ts # cron src/features/cron/configSection.ts @@ -43,6 +44,14 @@ # (overlay) servicesCredentialEnvOverlay src/app/auth/configSection.ts # (overlay) pythinkerModelEnvOverlay src/app/kosongConfig/envOverlay.ts +# ########################################################################## +# autoSessionTitle (config.toml: auto_session_title) +# owner: src/session/sessionTitle/configSection.ts +# scope: core +# ########################################################################## + +# auto_session_title: boolean + # ########################################################################## # background # owner: src/agent/task/configSection.ts diff --git a/packages/agent-core-v2/docs/state-manifest.d.ts b/packages/agent-core-v2/docs/state-manifest.d.ts index 163127fa8..8a0e612e9 100644 --- a/packages/agent-core-v2/docs/state-manifest.d.ts +++ b/packages/agent-core-v2/docs/state-manifest.d.ts @@ -924,6 +924,18 @@ export interface AgentStateSnapshot { detail?: unknown; }>; readonly note?: string; + readonly usage?: /* TokenUsage — packages/agent-core-v2/src/human/llm/usage.ts */ { + inputOther: number; + output: number; + inputCacheRead: number; + inputCacheCreation: number; + raw?: Record; + }; + readonly llmTiming?: /* ContextMessageTiming — packages/agent-core-v2/src/agent/contextMemory/types.ts */ { + readonly llmFirstTokenLatencyMs?: number; + readonly llmStreamDurationMs?: number; + }; + readonly durationMs?: number; })[]; // src/agent/contextProjector/contextProjectorService.ts 'contextProjector.lastRepairSignature': string | null; diff --git a/packages/agent-core-v2/docs/wire-manifest.d.ts b/packages/agent-core-v2/docs/wire-manifest.d.ts index a8f68b195..d690ec53d 100644 --- a/packages/agent-core-v2/docs/wire-manifest.d.ts +++ b/packages/agent-core-v2/docs/wire-manifest.d.ts @@ -12,7 +12,7 @@ // type syntax; when a named type is expanded inline, its name appears as a doc // comment (`/** ContextMessage */`). Bare type names (ContentPart, // ContextMessage, …) refer to the real types in src/ — they are intentionally -// not resolved here. `// …` marks a capped field list. On disk (wire.jsonl) +// not resolved here. On disk (wire.jsonl) // the journal opens with a metadata line {"type": "metadata", // "protocol_version", "created_at"}; each record is {"type", ...payload, // "time"} — object payloads spread at the top level. @@ -24,7 +24,7 @@ // cross-reducers), blobs (the folding states whose blob codec offloads inline // media to blob storage), owner (the source file declaring the class). -// Index (59 record types) +// Index (64 record types) // config.update profile src/agent/profile/profileOps.ts // context.append_loop_event contextMemory, turn src/agent/contextMemory/contextEvents.ts // context.append_message contextMemory, plan, task.notificationDelivery src/agent/contextMemory/contextEvents.ts @@ -63,6 +63,11 @@ // prompt.completed (none) src/agent/prompt/promptEvents.ts // prompt.steered (none) src/agent/prompt/promptEvents.ts // runtime.set_binding runtimeBinding src/agent/runtimeBinding/runtimeBindingOps.ts +// subagent.cancelled (none) src/session/subagent/mirrorAgentRun.ts +// subagent.completed (none) src/session/subagent/mirrorAgentRun.ts +// subagent.failed (none) src/session/subagent/mirrorAgentRun.ts +// subagent.spawned (none) src/session/subagent/mirrorAgentRun.ts +// subagent.started (none) src/session/subagent/mirrorAgentRun.ts // task.started task src/agent/task/taskOps.ts // task.terminated task src/agent/task/taskOps.ts // task.waitDelivered task.notificationDelivery src/agent/task/taskOps.ts @@ -139,6 +144,12 @@ interface ContextAppendMessagePayload { isError?: boolean; toolCallDisplays?: Record; note?: string; + usage?: TokenUsage; + llmTiming?: { + llmFirstTokenLatencyMs?: number; + llmStreamDurationMs?: number; + }; + durationMs?: number; }; } @@ -590,6 +601,66 @@ interface RuntimeSetBindingPayload { runtimeId: string; } +/** + * states: (none) + * owner: src/session/subagent/mirrorAgentRun.ts + */ +interface SubagentCancelledPayload { + _name: 'subagent.cancelled'; + subagentId: string; +} + +/** + * states: (none) + * owner: src/session/subagent/mirrorAgentRun.ts + */ +interface SubagentCompletedPayload { + _name: 'subagent.completed'; + subagentId: string; + resultSummary: string; + usage?: TokenUsage; + contextTokens?: number; +} + +/** + * states: (none) + * owner: src/session/subagent/mirrorAgentRun.ts + */ +interface SubagentFailedPayload { + _name: 'subagent.failed'; + subagentId: string; + error: string; +} + +/** + * states: (none) + * owner: src/session/subagent/mirrorAgentRun.ts + */ +interface SubagentSpawnedPayload { + _name: 'subagent.spawned'; + subagentId: string; + subagentName: string; + parentToolCallId: string; + parentToolCallUuid?: string; + parentAgentId?: string; + callerAgentId?: string; + description?: string; + dynamicWorkflowIndex?: number; + runInBackground: boolean; + model?: string; + thinkingEffort?: string; + taskId?: string; +} + +/** + * states: (none) + * owner: src/session/subagent/mirrorAgentRun.ts + */ +interface SubagentStartedPayload { + _name: 'subagent.started'; + subagentId: string; +} + /** * states: task * owner: src/agent/task/taskOps.ts @@ -927,6 +998,11 @@ interface WirePayloadMap { "prompt.completed": PromptCompletedPayload; "prompt.steered": PromptSteeredPayload; "runtime.set_binding": RuntimeSetBindingPayload; + "subagent.cancelled": SubagentCancelledPayload; + "subagent.completed": SubagentCompletedPayload; + "subagent.failed": SubagentFailedPayload; + "subagent.spawned": SubagentSpawnedPayload; + "subagent.started": SubagentStartedPayload; "task.started": TaskStartedPayload; "task.terminated": TaskTerminatedPayload; "task.waitDelivered": TaskWaitDeliveredPayload; diff --git a/packages/agent-core-v2/scripts/gen-wire-manifest.mts b/packages/agent-core-v2/scripts/gen-wire-manifest.mts index 7d7974d73..5563e594d 100644 --- a/packages/agent-core-v2/scripts/gen-wire-manifest.mts +++ b/packages/agent-core-v2/scripts/gen-wire-manifest.mts @@ -205,7 +205,6 @@ type SketchDict = { [key: string]: Sketch }; type Sketch = string | SketchDict | [Sketch]; const TYPE_KEY = '_type'; -const MORE_KEY = '…'; function stringifySketch(sketch: Sketch): string { if (typeof sketch === 'string') return sketch; @@ -318,10 +317,6 @@ function renderTsType(sketch: Sketch, indent: string): { doc?: string; lines: st function emitTsDict(lines: string[], dict: SketchDict, indent: string): void { for (const [key, sketch] of Object.entries(dict)) { - if (key === MORE_KEY) { - lines.push(`${indent}// …`); - continue; - } if (key === TYPE_KEY) continue; if (key.startsWith('...')) { lines.push(`${indent}// spread: ${key}`); @@ -575,13 +570,7 @@ function renderTsFields( depth: number, ): SketchDict { const dict: SketchDict = {}; - let count = 0; for (const [name, f] of fields) { - if (count >= 8) { - dict[MORE_KEY] = '…'; - break; - } - count += 1; dict[`${name}${f.optional ? '?' : ''}`] = summarizeTsTypeExpr( f.type, file, @@ -961,7 +950,7 @@ export async function buildWireManifest(): Promise { '// type syntax; when a named type is expanded inline, its name appears as a doc', '// comment (`/** ContextMessage */`). Bare type names (ContentPart,', '// ContextMessage, …) refer to the real types in src/ — they are intentionally', - '// not resolved here. `// …` marks a capped field list. On disk (wire.jsonl)', + '// not resolved here. On disk (wire.jsonl)', '// the journal opens with a metadata line {"type": "metadata",', '// "protocol_version", "created_at"}; each record is {"type", ...payload,', '// "time"} — object payloads spread at the top level.', diff --git a/packages/agent-core-v2/src/agent/contextMemory/contextTranscript.ts b/packages/agent-core-v2/src/agent/contextMemory/contextTranscript.ts index 5f7fd4cee..db75f8055 100644 --- a/packages/agent-core-v2/src/agent/contextMemory/contextTranscript.ts +++ b/packages/agent-core-v2/src/agent/contextMemory/contextTranscript.ts @@ -1,4 +1,5 @@ import { type ContentPart, type ToolCall } from '#human/llm/message'; +import type { TokenUsage } from '#human/llm/usage'; import type { WireRecord } from '#/wire/record'; import { @@ -8,7 +9,7 @@ import { } from './compactionHandoff'; import { isPromptOwnedInjection, isUndoAnchor } from './conversationTime'; import { createLoopEventFold, type LoopRecordedEvent } from './loopEventFold'; -import type { ContextMessage } from './types'; +import type { ContextMessage, ContextMessageTiming } from './types'; export interface ContextTranscript { readonly entries: readonly ContextMessage[]; @@ -30,6 +31,8 @@ interface MutableMessage { isError?: boolean; note?: string; origin?: ContextMessage['origin']; + usage?: TokenUsage; + llmTiming?: ContextMessageTiming; } interface MutableEntry { @@ -73,7 +76,11 @@ export function createContextTranscriptReducer(): ContextTranscriptReducer { transcript.splice(index, 1); foldedLength = Math.max(0, foldedLength - 1); }, - sealOpenAssistant: () => { + sealOpenAssistant: (meta) => { + if (openEntry !== undefined) { + openEntry.message.usage = meta?.usage; + openEntry.message.llmTiming = meta?.llmTiming; + } openEntry = undefined; }, pushToolMessage: (message, time) => { @@ -175,6 +182,8 @@ function toMutableEntry(message: ContextMessage, time: number | undefined): Muta ...(message.toolCallId !== undefined ? { toolCallId: message.toolCallId } : {}), ...(message.isError !== undefined ? { isError: message.isError } : {}), ...(message.origin !== undefined ? { origin: message.origin } : {}), + usage: message.usage, + llmTiming: message.llmTiming, }, time, }; diff --git a/packages/agent-core-v2/src/agent/contextMemory/loopEventFold.ts b/packages/agent-core-v2/src/agent/contextMemory/loopEventFold.ts index ef34fa92a..60897301d 100644 --- a/packages/agent-core-v2/src/agent/contextMemory/loopEventFold.ts +++ b/packages/agent-core-v2/src/agent/contextMemory/loopEventFold.ts @@ -6,12 +6,18 @@ import type { ContentPart, ToolCall } from '#human/llm/message'; import type { TokenUsage } from '#human/llm/usage'; import type { ToolInputDisplay } from '#/tool/toolInputDisplay'; -import type { ContextMessage } from './types'; +import type { ContextMessage, ContextMessageTiming } from './types'; +import { shouldRenderWallTime } from './toolResultRender'; import { isVacuousContentPart } from './vacuousContent'; const TOOL_INTERRUPTED_ON_RESUME_OUTPUT = 'Tool execution was interrupted before its result was recorded. Do not assume the tool completed successfully.'; +export interface AssistantSealMeta { + readonly usage?: TokenUsage; + readonly llmTiming?: ContextMessageTiming; +} + export type LoopRecordedEvent = | { readonly type: 'step.begin'; @@ -64,6 +70,7 @@ export type LoopRecordedEvent = readonly output: string | readonly ContentPart[]; readonly isError?: boolean; readonly note?: string; + readonly durationMs?: number; }; readonly parentUuid?: string; }; @@ -73,7 +80,7 @@ export interface LoopEventFoldSink { appendOpenContent(part: ContentPart): void; appendOpenToolCall(call: ToolCall, display?: ToolInputDisplay): void; dropOpenAssistant(): void; - sealOpenAssistant(): void; + sealOpenAssistant(meta?: AssistantSealMeta): void; pushToolMessage(message: ContextMessage, time: number | undefined): void; pushMessage(message: ContextMessage, time: number | undefined): void; } @@ -92,7 +99,7 @@ export function createLoopEventFold(sink: LoopEventFoldSink): LoopEventFold { interface InitialFoldState { readonly openHasToolCalls: boolean; readonly openVacuous: boolean; - readonly pendingToolCallIds: readonly string[]; + readonly pendingToolCalls: readonly { readonly id: string; readonly name: string }[]; } function createLoopEventFoldWithState( @@ -102,7 +109,9 @@ function createLoopEventFoldWithState( let openStepUuid: string | null | undefined = initial === undefined ? undefined : null; let openHasToolCalls = initial?.openHasToolCalls ?? false; let openVacuous = initial?.openVacuous ?? true; - const pending = new Set(initial?.pendingToolCallIds); + const pending = new Map( + initial?.pendingToolCalls.map((call) => [call.id, call.name]), + ); let deferred: { message: ContextMessage; time: number | undefined }[] = []; const flushDeferred = (): void => { @@ -112,19 +121,19 @@ function createLoopEventFoldWithState( }; const closePending = (time: number | undefined): void => { if (pending.size === 0) return; - for (const toolCallId of pending) { + for (const toolCallId of pending.keys()) { sink.pushToolMessage(interruptedToolMessage(toolCallId), time); } pending.clear(); flushDeferred(); }; - const settleOpen = (time: number | undefined): void => { + const settleOpen = (time: number | undefined, meta?: AssistantSealMeta): void => { if (openStepUuid === undefined) return; closePending(time); if (!openHasToolCalls && openVacuous) { sink.dropOpenAssistant(); } else { - sink.sealOpenAssistant(); + sink.sealOpenAssistant(meta); } openStepUuid = undefined; }; @@ -157,7 +166,7 @@ function createLoopEventFoldWithState( } case 'step.end': { if (event.finishReason === 'interrupted' || event.finishReason === 'error') return; - settleOpen(time); + settleOpen(time, stepEndSealMeta(event)); flushDeferred(); return; } @@ -177,12 +186,13 @@ function createLoopEventFoldWithState( ...(event.extras !== undefined ? { extras: event.extras } : {}), }; sink.appendOpenToolCall(call, event.display); - pending.add(event.toolCallId); + pending.set(event.toolCallId, event.name); openHasToolCalls = true; return; } case 'tool.result': { - if (!pending.has(event.toolCallId)) return; + const toolName = pending.get(event.toolCallId); + if (toolName === undefined) return; pending.delete(event.toolCallId); const output = event.result.output; sink.pushToolMessage( @@ -193,6 +203,7 @@ function createLoopEventFoldWithState( ), isError: event.result.isError, note: event.result.note, + durationMs: shouldRenderWallTime(toolName) ? event.result.durationMs : undefined, }, time, ); @@ -307,8 +318,13 @@ function createImmutableFoldSink(initial: readonly ContextMessage[]): ImmutableF current = Object.freeze([...current.slice(0, openIndex), ...current.slice(openIndex + 1)]); openIndex = -1; }, - sealOpenAssistant: () => { - updateOpen((message) => ({ ...message, partial: undefined })); + sealOpenAssistant: (meta) => { + updateOpen((message) => ({ + ...message, + usage: meta?.usage, + llmTiming: meta?.llmTiming, + partial: undefined, + })); openIndex = -1; }, pushToolMessage: (message) => { @@ -341,9 +357,9 @@ function recoverFoldState(state: readonly ContextMessage[]): InitialFoldState | return { openHasToolCalls: open.toolCalls.length > 0, openVacuous: open.content.every(isVacuousContentPart), - pendingToolCallIds: open.toolCalls - .map((call) => call.id) - .filter((toolCallId) => !resolvedToolCallIds.has(toolCallId)), + pendingToolCalls: open.toolCalls + .filter((call) => !resolvedToolCallIds.has(call.id)) + .map((call) => ({ id: call.id, name: call.name })), }; } @@ -353,3 +369,15 @@ function interruptedToolMessage(toolCallId: string): ContextMessage { isError: true, }; } + +function stepEndSealMeta( + event: Extract, +): AssistantSealMeta | undefined { + const timing: ContextMessageTiming = { + llmFirstTokenLatencyMs: event.llmFirstTokenLatencyMs, + llmStreamDurationMs: event.llmStreamDurationMs, + }; + const hasTiming = Object.values(timing).some((value) => value !== undefined); + if (event.usage === undefined && !hasTiming) return undefined; + return { usage: event.usage, llmTiming: hasTiming ? timing : undefined }; +} diff --git a/packages/agent-core-v2/src/agent/contextMemory/toolResultRender.ts b/packages/agent-core-v2/src/agent/contextMemory/toolResultRender.ts index c7bad66c0..349ea9d04 100644 --- a/packages/agent-core-v2/src/agent/contextMemory/toolResultRender.ts +++ b/packages/agent-core-v2/src/agent/contextMemory/toolResultRender.ts @@ -1,5 +1,7 @@ import type { ContentPart } from '#human/llm/message'; +import { isMcpToolName } from '#/tool/toolContract'; + const TOOL_ERROR_STATUS = 'ERROR: Tool execution failed.'; const TOOL_EMPTY_STATUS = 'Tool output is empty.'; const TOOL_EMPTY_ERROR_STATUS = @@ -10,10 +12,34 @@ export interface RenderableToolResult { readonly output: string | readonly ContentPart[]; readonly note?: string; readonly isError?: boolean; + readonly durationMs?: number; +} + +const WALL_TIME_TOOL_NAMES: ReadonlySet = new Set([ + 'Agent', + 'AgentDynamicWorkflow', + 'Bash', + 'FetchURL', + 'Glob', + 'Grep', + 'WebSearch', +]); + +export function shouldRenderWallTime(toolName: string): boolean { + return WALL_TIME_TOOL_NAMES.has(toolName) || isMcpToolName(toolName); } export function renderToolResultForModel(result: RenderableToolResult): ContentPart[] { const rendered = renderStatus(result); + if (result.durationMs !== undefined) { + const header = `Wall time: ${(result.durationMs / 1000).toFixed(3)} seconds`; + const first = rendered[0]; + if (first?.type === 'text') { + rendered.splice(0, 1, textPart(`${header}\n${first.text}`)); + } else { + rendered.unshift(textPart(header)); + } + } if (result.note === undefined || result.note.length === 0) return rendered; const only = rendered[0]; if (rendered.length === 1 && only?.type === 'text') { diff --git a/packages/agent-core-v2/src/agent/contextMemory/types.ts b/packages/agent-core-v2/src/agent/contextMemory/types.ts index b7e505f26..164e8b187 100644 --- a/packages/agent-core-v2/src/agent/contextMemory/types.ts +++ b/packages/agent-core-v2/src/agent/contextMemory/types.ts @@ -1,5 +1,6 @@ import type { Message } from '#/llm-adapter/contract/message'; import type { ContentPart } from '#human/llm/message'; +import type { TokenUsage } from '#human/llm/usage'; import type { ToolInputDisplay } from '#/tool/toolInputDisplay'; import type { AgentTaskStatus } from '#/agent/task/task'; @@ -124,6 +125,11 @@ export type PromptOrigin = | HookResultOrigin | RetryOrigin; +export interface ContextMessageTiming { + readonly llmFirstTokenLatencyMs?: number; + readonly llmStreamDurationMs?: number; +} + export type ContextMessage = Message & { readonly id?: string; readonly providerMessageId?: string; @@ -131,6 +137,9 @@ export type ContextMessage = Message & { readonly isError?: boolean; toolCallDisplays?: Record; readonly note?: string; + readonly usage?: TokenUsage; + readonly llmTiming?: ContextMessageTiming; + readonly durationMs?: number; }; export interface UserMessageRecord { diff --git a/packages/agent-core-v2/src/agent/contextProjector/projection.ts b/packages/agent-core-v2/src/agent/contextProjector/projection.ts index 8e837f82d..7158c6326 100644 --- a/packages/agent-core-v2/src/agent/contextProjector/projection.ts +++ b/packages/agent-core-v2/src/agent/contextProjector/projection.ts @@ -343,6 +343,7 @@ function projectedContent(source: ContextMessage, onAnomaly?: OnAnomaly): Conten output: outputFromToolContent(source.content), isError: source.isError, note: source.note, + durationMs: source.durationMs, }) : source.content; return cleanContent(source, content, onAnomaly); diff --git a/packages/agent-core-v2/src/agent/loop/loopService.ts b/packages/agent-core-v2/src/agent/loop/loopService.ts index 99de89482..daeb09775 100644 --- a/packages/agent-core-v2/src/agent/loop/loopService.ts +++ b/packages/agent-core-v2/src/agent/loop/loopService.ts @@ -42,6 +42,7 @@ import { IAgentProfileService } from '#/agent/profile/profile'; import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; import { IAgentStateService } from '#/agent/state/agentState'; import { IFileService } from '#/app/file/fileService'; +import { IPluginService } from '#/app/plugin/plugin'; import type { TurnEndedEvent as TurnEndedTelemetryEvent, TurnInterruptedEvent, @@ -166,6 +167,7 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { @IWireService private readonly wire: IWireService, @IInstantiationService private readonly instantiation: IInstantiationService, @IAgentProfileService private readonly profile: IAgentProfileService, + @IPluginService private readonly plugins: IPluginService, ) { super(); this.states.contributeState(turnKey); @@ -219,7 +221,8 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { this.activeRequestTrace = trace; }, onEvent: (event) => this.projectMachineEvent(event), - onToolResult: (toolCallId, result) => this.appendMachineToolResult(toolCallId, result), + onToolResult: (toolCallId, result, durationMs) => + this.appendMachineToolResult(toolCallId, result, durationMs), }; } @@ -1213,6 +1216,7 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { mode: active.mode ?? 'agent', provider_type, protocol, + enabled_plugins: this.plugins.enabledPluginIds()?.join(','), }; this.telemetry.track2('turn_started', started); return active; @@ -1667,7 +1671,7 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { }, })) { if (result.toolCallId === toolCallId) { - this.appendMachineToolResult(toolCallId, result.result); + this.appendMachineToolResult(toolCallId, result.result, result.durationMs); } } } catch (error) { @@ -1701,6 +1705,7 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { readonly stopTurn?: boolean; readonly stopTurnReason?: string; }, + durationMs?: number, ): void { const turn = this.active; const step = turn?.current; @@ -1709,7 +1714,7 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { type: 'tool.result', parentUuid: step.toolCallUuids.get(toolCallId) ?? randomUUID(), toolCallId, - result: { output: result.output, isError: result.isError, note: result.note }, + result: { output: result.output, isError: result.isError, note: result.note, durationMs }, }); step.resolvedToolIds.add(toolCallId); if (result.stopTurn === true) { @@ -2087,6 +2092,7 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { provider_type: turn.providerType, protocol: turn.protocol, trace_id: traceId, + enabled_plugins: this.plugins.enabledPluginIds()?.join(','), }; this.telemetry.track2('turn_ended', ended); this.telemetry.setContext({ turn_id: undefined, trace_id: undefined, thinking_effort: undefined }); diff --git a/packages/agent-core-v2/src/agent/loop/machine/engine.ts b/packages/agent-core-v2/src/agent/loop/machine/engine.ts index 9a8e98d53..be312fc0c 100644 --- a/packages/agent-core-v2/src/agent/loop/machine/engine.ts +++ b/packages/agent-core-v2/src/agent/loop/machine/engine.ts @@ -133,7 +133,7 @@ export interface CreateMachineEngineOptions { readonly promptGate?: PromptGate; readonly onTrace?: (trace: LLMRequestTrace) => void; readonly onEvent?: (event: MachineEngineEvent) => void; - readonly onToolResult?: (toolCallId: string, result: AgentToolResult) => void; + readonly onToolResult?: (toolCallId: string, result: AgentToolResult, durationMs: number) => void; } export interface MachineEngineRetrySnapshot { diff --git a/packages/agent-core-v2/src/agent/loop/machine/tools.ts b/packages/agent-core-v2/src/agent/loop/machine/tools.ts index c05ad3e40..d94ae04d7 100644 --- a/packages/agent-core-v2/src/agent/loop/machine/tools.ts +++ b/packages/agent-core-v2/src/agent/loop/machine/tools.ts @@ -37,7 +37,7 @@ export interface CreateMachineToolsOptions { readonly steerSignal?: () => AbortSignal | undefined; readonly trace?: () => LLMRequestTrace | undefined; readonly onToolCall?: (payload: ToolCallStartedPayload) => void; - readonly onToolResult?: (toolCallId: string, result: AgentToolResult) => void; + readonly onToolResult?: (toolCallId: string, result: AgentToolResult, durationMs: number) => void; readonly onBatchError?: (error: unknown) => void; } @@ -167,7 +167,7 @@ export function createMachineTools(options: CreateMachineToolsOptions): MachineT const applyResult = (entry: PendingEntry, matched: ToolExecutionResult): void => { const id = entry.input.toolCall.id; const { result } = matched; - options.onToolResult?.(id, result); + options.onToolResult?.(id, result, matched.durationMs); extras.set(id, { stopTurn: result.stopTurn, stopTurnReason: result.stopTurnReason, diff --git a/packages/agent-core-v2/src/agent/permissionPolicy/policies/git-cwd-write-approve.ts b/packages/agent-core-v2/src/agent/permissionPolicy/policies/git-cwd-write-approve.ts index b48d71cf7..bc12b9a92 100644 --- a/packages/agent-core-v2/src/agent/permissionPolicy/policies/git-cwd-write-approve.ts +++ b/packages/agent-core-v2/src/agent/permissionPolicy/policies/git-cwd-write-approve.ts @@ -1,5 +1,5 @@ import type { ResolvedToolExecutionHookContext } from '#/agent/toolExecutor/toolHooks'; -import { isWithinWorkspace } from '#/tool/path-access'; +import { isProjectLocalConfigPath, isWithinWorkspace } from '#/tool/path-access'; import { IGitService } from '#/app/git/git'; import type { IGitService as GitService } from '#/app/git/git'; import { IAgentRuntimeService } from '#/agent/runtimeBinding/agentRuntime'; @@ -35,6 +35,9 @@ export class GitCwdWriteApprovePermissionPolicyService implements PermissionPoli const writeAccesses = writeFileAccesses(context); if (writeAccesses.length === 0) return undefined; + if (writeAccesses.some((access) => isProjectLocalConfigPath(access.path))) { + return undefined; + } if ( !writeAccesses.every((access) => isWithinWorkspace( diff --git a/packages/agent-core-v2/src/agent/task/taskService.ts b/packages/agent-core-v2/src/agent/task/taskService.ts index 9d9700b65..01cefa35d 100644 --- a/packages/agent-core-v2/src/agent/task/taskService.ts +++ b/packages/agent-core-v2/src/agent/task/taskService.ts @@ -36,6 +36,7 @@ import { type AgentTaskSettlement, } from './types'; import { renderNotificationXml } from './notificationXml'; +import { formatTaskWallTime } from './wallTime'; import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; import { IConfigService } from '#/app/config/config'; @@ -1540,11 +1541,12 @@ function buildAgentTaskNotificationBody(info: AgentTaskInfo): string { : info.stopReason ? `${info.description} ${info.status === 'killed' ? 'was stopped' : info.status}. Reason: ${info.stopReason}` : `${info.description} ${info.status}.`; + const timed = `Wall time: ${formatTaskWallTime(info)}\n${baseLine}`; - if (info.kind !== 'agent') return baseLine; - if (info.status === 'completed') return baseLine; + if (info.kind !== 'agent') return timed; + if (info.status === 'completed') return timed; const agentId = info.agentId; - if (agentId === undefined || agentId === info.taskId) return baseLine; + if (agentId === undefined || agentId === info.taskId) return timed; const recovery = [ '', @@ -1554,7 +1556,7 @@ function buildAgentTaskNotificationBody(info: AgentTaskInfo): string { 'The subagent retains its full prior context across the restart, but any in-flight tool call lost its result and may need to be redone.', ].join('\n'); - return `${baseLine}${recovery}`; + return `${timed}${recovery}`; } function buildAgentTaskNotification( diff --git a/packages/agent-core-v2/src/agent/task/tools/format.ts b/packages/agent-core-v2/src/agent/task/tools/format.ts index 0f14bc127..f55cd5143 100644 --- a/packages/agent-core-v2/src/agent/task/tools/format.ts +++ b/packages/agent-core-v2/src/agent/task/tools/format.ts @@ -1,3 +1,5 @@ +import { formatTaskWallTime } from '#/agent/task/wallTime'; + function formatValue(value: unknown): string { return typeof value === 'string' ? value : String(value); } @@ -12,3 +14,12 @@ export function formatPlainObject(record: object): string { .map(([key, value]) => `${fieldName(key)}: ${formatValue(value)}`) .join('\n'); } + +export function formatTaskRecord( + record: T, +): string { + const { startedAt: _startedAt, endedAt: _endedAt, ...rest } = record; + const body = formatPlainObject(rest); + const wallTime = `Wall time: ${formatTaskWallTime(record)}`; + return body.length === 0 ? wallTime : `${wallTime}\n${body}`; +} diff --git a/packages/agent-core-v2/src/agent/task/wallTime.ts b/packages/agent-core-v2/src/agent/task/wallTime.ts new file mode 100644 index 000000000..7c7a54f85 --- /dev/null +++ b/packages/agent-core-v2/src/agent/task/wallTime.ts @@ -0,0 +1,9 @@ +export interface AgentTaskTiming { + readonly startedAt: number; + readonly endedAt: number | null; +} + +export function formatTaskWallTime(task: AgentTaskTiming): string { + const durationMs = Math.max(0, (task.endedAt ?? Date.now()) - task.startedAt); + return `${(durationMs / 1000).toFixed(3)} seconds`; +} diff --git a/packages/agent-core-v2/src/agent/toolDedupe/toolDedupeService.ts b/packages/agent-core-v2/src/agent/toolDedupe/toolDedupeService.ts index 4acf2a3b2..9f4239e28 100644 --- a/packages/agent-core-v2/src/agent/toolDedupe/toolDedupeService.ts +++ b/packages/agent-core-v2/src/agent/toolDedupe/toolDedupeService.ts @@ -13,7 +13,9 @@ import type { } from '#/app/telemetry/events'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import type { LLMRequestTrace } from '#/llm-adapter/contract/request-trace'; +import { parseBooleanEnv } from '#/_base/utils/env'; import { parseToolCallArguments } from '#/tool/tool-args-parse'; +import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IAgentLoopService } from '#/agent/loop/loop'; import { IAgentStateService } from '#/agent/state/agentState'; import { IEventBus } from '#/app/event/eventBus'; @@ -27,6 +29,8 @@ import { type ToolDedupeResult, } from './toolDedupe'; +export const REPEAT_BREAKER_ENV = 'PYTHINKER_CODE_REPEAT_BREAKER'; + const REMINDER_TEXT_1 = '\n\n' + wrapSystemReminder( @@ -185,15 +189,18 @@ export class AgentToolDedupeService extends Service implements IAgentToolDedupeS private readonly stepDeferreds = new Map>(); private readonly handoffVetoedCallIds = new Set(); private forceStoppedInStep = false; + private readonly repeatBreakerEnabled: boolean; constructor( @ITelemetryService private readonly telemetry: ITelemetryService, @IAgentLoopService private readonly loop: IAgentLoopService, @IAgentToolExecutorService private readonly toolExecutor: IAgentToolExecutorService, @IAgentStateService private readonly states: IAgentStateService, + @IBootstrapService bootstrap: IBootstrapService, @IEventBus eventBus: IEventBus, ) { super(); + this.repeatBreakerEnabled = parseBooleanEnv(bootstrap.getEnv(REPEAT_BREAKER_ENV)) !== false; this.states.contributeState(toolDedupeStepCallsKey); this.states.contributeState(toolDedupeOriginalCallIndexKey); this.states.contributeState(toolDedupeSyntheticCallIdsKey); @@ -527,19 +534,21 @@ export class AgentToolDedupeService extends Service implements IAgentToolDedupeS let finalResult = result; let action: 'none' | 'r1' | 'r2' | 'r3' | 'stop' = 'none'; - if (streak >= REPEAT_FORCE_STOP_STREAK) { - finalResult = forceStopResult(result, REMINDER_TEXT_3); - action = 'stop'; - this.forceStoppedInStep = true; - } else if (streak >= REPEAT_REMINDER_3_START) { - finalResult = appendReminder(result, REMINDER_TEXT_3); - action = 'r3'; - } else if (streak >= REPEAT_REMINDER_2_START) { - finalResult = appendReminder(result, makeReminderText2(streak)); - action = 'r2'; - } else if (streak >= REPEAT_REMINDER_1_START) { - finalResult = appendReminder(result, REMINDER_TEXT_1); - action = 'r1'; + if (this.repeatBreakerEnabled) { + if (streak >= REPEAT_FORCE_STOP_STREAK) { + finalResult = forceStopResult(result, REMINDER_TEXT_3); + action = 'stop'; + this.forceStoppedInStep = true; + } else if (streak >= REPEAT_REMINDER_3_START) { + finalResult = appendReminder(result, REMINDER_TEXT_3); + action = 'r3'; + } else if (streak >= REPEAT_REMINDER_2_START) { + finalResult = appendReminder(result, makeReminderText2(streak)); + action = 'r2'; + } else if (streak >= REPEAT_REMINDER_1_START) { + finalResult = appendReminder(result, REMINDER_TEXT_1); + action = 'r1'; + } } if (streak >= 2) { diff --git a/packages/agent-core-v2/src/agent/toolExecutor/toolExecutor.ts b/packages/agent-core-v2/src/agent/toolExecutor/toolExecutor.ts index c1cf3349d..5be15344f 100644 --- a/packages/agent-core-v2/src/agent/toolExecutor/toolExecutor.ts +++ b/packages/agent-core-v2/src/agent/toolExecutor/toolExecutor.ts @@ -32,6 +32,7 @@ export interface ToolExecutionResult { readonly toolCallId: string; readonly toolName: string; readonly result: ToolResult; + readonly durationMs: number; } export type MissingToolDescriber = (toolName: string) => string | undefined; diff --git a/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts b/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts index d3b6a0d71..67dea1841 100644 --- a/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts +++ b/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts @@ -311,6 +311,7 @@ export class AgentToolExecutorService implements IAgentToolExecutorService { toolCallId: call.toolCall.id, toolName: call.toolName, result: finalized, + durationMs: timedResult.durationMs, }; } diff --git a/packages/agent-core-v2/src/agent/toolPolicy/toolPolicyService.ts b/packages/agent-core-v2/src/agent/toolPolicy/toolPolicyService.ts index 3c16c69f3..2da90eecb 100644 --- a/packages/agent-core-v2/src/agent/toolPolicy/toolPolicyService.ts +++ b/packages/agent-core-v2/src/agent/toolPolicy/toolPolicyService.ts @@ -15,6 +15,7 @@ import { IAgentToolPolicyService } from './toolPolicy'; export class AgentToolPolicyService extends Disposable implements IAgentToolPolicyService { declare readonly _serviceBrand: undefined; + private globalPolicy: ToolsConfig | undefined; constructor( @IAgentProfileService private readonly profile: IAgentProfileService, @@ -24,6 +25,13 @@ export class AgentToolPolicyService extends Disposable implements IAgentToolPoli @IAgentToolExecutorService toolExecutor: IAgentToolExecutorService, ) { super(); + this.globalPolicy = this.config.get(TOOLS_SECTION); + this._register( + this.config.onDidSectionChange((event) => { + if (event.domain !== TOOLS_SECTION) return; + this.globalPolicy = this.config.get(TOOLS_SECTION); + }), + ); this._register( toolExecutor.registerToolCallGuard(({ name, source }) => { const active = @@ -55,7 +63,7 @@ export class AgentToolPolicyService extends Disposable implements IAgentToolPoli { workspaceDisabledTools: this.toolPolicyGate.disabledTools, profile: { disallowedTools: profile.disallowedTools }, - global: this.config.get(TOOLS_SECTION), + global: this.globalPolicy, sessionDisabledTools: this.sessionToolPolicy.disabledTools(), }, name, @@ -72,7 +80,7 @@ export class AgentToolPolicyService extends Disposable implements IAgentToolPoli { workspaceDisabledTools: this.toolPolicyGate.disabledTools, profile, - global: this.config.get(TOOLS_SECTION), + global: this.globalPolicy, sessionDisabledTools: this.sessionToolPolicy.disabledTools(), }, name, diff --git a/packages/agent-core-v2/src/agent/tools/edit/editTool.ts b/packages/agent-core-v2/src/agent/tools/edit/editTool.ts index a3ef1f35c..7181f52b5 100644 --- a/packages/agent-core-v2/src/agent/tools/edit/editTool.ts +++ b/packages/agent-core-v2/src/agent/tools/edit/editTool.ts @@ -2,6 +2,7 @@ import { resolvePathAccessPath, type WorkspaceConfig, } from '#/tool/path-access'; +import { checkRealPathWriteTarget } from '#/tool/realpath-access'; import { toInputJsonSchema } from '#/tool/input-schema'; import { literalRulePattern, matchesPathRuleSubject } from '#/tool/rule-match'; import { IFileEditService } from '#/app/edit/fileEdit'; @@ -77,6 +78,10 @@ export class EditTool implements IEditTool { if (lease.runtime.identity.generation !== inspected.identity.generation) { return { isError: true, output: 'Runtime changed before execution. Retry the tool call.' }; } + const accessError = await checkRealPathWriteTarget(lease.runtime.fs!, path, workspace, env.pathClass); + if (accessError !== undefined) { + return { isError: true, output: accessError.message }; + } return await this.execution(args, path, lease.runtime.fs!); } finally { lease.dispose(); diff --git a/packages/agent-core-v2/src/agent/tools/os/glob/globTool.ts b/packages/agent-core-v2/src/agent/tools/os/glob/globTool.ts index 7be6dda07..16c5e3c66 100644 --- a/packages/agent-core-v2/src/agent/tools/os/glob/globTool.ts +++ b/packages/agent-core-v2/src/agent/tools/os/glob/globTool.ts @@ -31,6 +31,7 @@ import { SENSITIVE_DOT_VARIANT_SUFFIXES, type WorkspaceConfig, } from '#/tool/path-access'; +import { checkRealPathWithinWorkspace } from '#/tool/realpath-access'; import { toInputJsonSchema } from '#/tool/input-schema'; import { literalRulePattern, matchesGlobRuleSubject } from '#/tool/rule-match'; import globDescription from './glob.md?raw'; @@ -126,6 +127,10 @@ export class GlobTool implements IGlobTool { if (lease.runtime.identity.generation !== inspected.identity.generation) { return { isError: true, output: 'Runtime changed before execution. Retry the tool call.' }; } + const accessError = await checkRealPathWithinWorkspace(lease.runtime.fs!, searchRoots[0]!, workspace, env.pathClass, { checkSensitive: false }); + if (accessError !== undefined) { + return { isError: true, output: accessError.message }; + } return await this.execution( lease.runtime.fs!, lease.runtime.process!, diff --git a/packages/agent-core-v2/src/agent/tools/os/grep/grepTool.ts b/packages/agent-core-v2/src/agent/tools/os/grep/grepTool.ts index 174817c6e..f85f8b4c4 100644 --- a/packages/agent-core-v2/src/agent/tools/os/grep/grepTool.ts +++ b/packages/agent-core-v2/src/agent/tools/os/grep/grepTool.ts @@ -23,6 +23,7 @@ import { SENSITIVE_DOT_VARIANT_SUFFIXES, type WorkspaceConfig, } from '#/tool/path-access'; +import { checkRealPathWithinWorkspace } from '#/tool/realpath-access'; import { toInputJsonSchema } from '#/tool/input-schema'; import { literalRulePattern, matchesGlobRuleSubject } from '#/tool/rule-match'; import { @@ -112,6 +113,10 @@ export class GrepTool implements IGrepTool { if (lease.runtime.identity.generation !== inspected.identity.generation) { return { isError: true, output: 'Runtime changed before execution. Retry the tool call.' }; } + const accessError = await checkRealPathWithinWorkspace(lease.runtime.fs!, searchPaths[0]!, workspace, env.pathClass, { checkSensitive: false }); + if (accessError !== undefined) { + return { isError: true, output: accessError.message }; + } return await this.execution(lease.runtime.process!, lease.runtime.fs!, env, workspace, args, signal, searchPaths); } finally { lease.dispose(); diff --git a/packages/agent-core-v2/src/agent/tools/os/read/readTool.ts b/packages/agent-core-v2/src/agent/tools/os/read/readTool.ts index ca6562dc8..4c33d7c92 100644 --- a/packages/agent-core-v2/src/agent/tools/os/read/readTool.ts +++ b/packages/agent-core-v2/src/agent/tools/os/read/readTool.ts @@ -22,6 +22,7 @@ import { resolvePathAccessPath, type WorkspaceConfig, } from '#/tool/path-access'; +import { checkRealPathWithinWorkspace } from '#/tool/realpath-access'; import { MEDIA_SNIFF_BYTES, detectFileType } from '#/agent/media/file-type'; import { toInputJsonSchema } from '#/tool/input-schema'; import { literalRulePattern, matchesGlobRuleSubject, matchesPathRuleSubject } from '#/tool/rule-match'; @@ -238,6 +239,10 @@ export class ReadTool implements IReadTool { if (lease.runtime.identity.generation !== inspected.identity.generation) { return { isError: true, output: 'Runtime changed before execution. Retry the tool call.' }; } + const accessError = await checkRealPathWithinWorkspace(lease.runtime.fs!, path, workspace, env.pathClass); + if (accessError !== undefined) { + return { isError: true, output: accessError.message }; + } const eventLog = this.resultTruncation.isWireJournalPath(path); const result = await this.execution(runtimeFileSource(lease.runtime.fs!, path), args, eventLog); return { ...result, spillExempt: true }; diff --git a/packages/agent-core-v2/src/agent/tools/os/write/writeTool.ts b/packages/agent-core-v2/src/agent/tools/os/write/writeTool.ts index 2423b37ce..dd1725007 100644 --- a/packages/agent-core-v2/src/agent/tools/os/write/writeTool.ts +++ b/packages/agent-core-v2/src/agent/tools/os/write/writeTool.ts @@ -17,6 +17,7 @@ import { sensitiveTargetError, type WorkspaceConfig, } from '#/tool/path-access'; +import { checkRealPathWriteTarget } from '#/tool/realpath-access'; import { toInputJsonSchema } from '#/tool/input-schema'; import { literalRulePattern, matchesPathRuleSubject } from '#/tool/rule-match'; import { IWriteTool, WriteInputSchema, type WriteInput } from './write'; @@ -73,6 +74,10 @@ export class WriteTool implements IWriteTool { } const denied = await sensitiveTargetError(lease.runtime.fs!, args.path, path); if (denied !== undefined) return { isError: true, output: denied }; + const accessError = await checkRealPathWriteTarget(lease.runtime.fs!, path, workspace, env.pathClass); + if (accessError !== undefined) { + return { isError: true, output: accessError.message }; + } return await this.execution(lease.runtime.fs!, args, path); } finally { lease.dispose(); diff --git a/packages/agent-core-v2/src/agent/tools/read-media-file/readMediaFileTool.ts b/packages/agent-core-v2/src/agent/tools/read-media-file/readMediaFileTool.ts index fff7ef5ba..49ae9ed09 100644 --- a/packages/agent-core-v2/src/agent/tools/read-media-file/readMediaFileTool.ts +++ b/packages/agent-core-v2/src/agent/tools/read-media-file/readMediaFileTool.ts @@ -17,6 +17,7 @@ import { type ToolExecution, } from '#/tool/toolContract'; import { resolvePathAccessPath, type WorkspaceConfig } from '#/tool/path-access'; +import { checkRealPathWithinWorkspace } from '#/tool/realpath-access'; import { MEDIA_SNIFF_BYTES, detectFileType, @@ -260,6 +261,10 @@ export class ReadMediaFileTool implements AgentTool { if (lease.runtime.identity.generation !== inspected.identity.generation) { return { isError: true, output: 'Runtime changed before execution. Retry the tool call.' }; } + const accessError = await checkRealPathWithinWorkspace(lease.runtime.fs!, path, workspace, env.pathClass); + if (accessError !== undefined) { + return { isError: true, output: accessError.message }; + } return await this.execution(args, runtimeFileSource(lease.runtime.fs!, path), env); } finally { lease.dispose(); diff --git a/packages/agent-core-v2/src/agent/tools/task/task-list/taskListTool.ts b/packages/agent-core-v2/src/agent/tools/task/task-list/taskListTool.ts index fd2a6e841..aafb7bd9f 100644 --- a/packages/agent-core-v2/src/agent/tools/task/task-list/taskListTool.ts +++ b/packages/agent-core-v2/src/agent/tools/task/task-list/taskListTool.ts @@ -5,7 +5,7 @@ import { registerAgentToolService } from '#/agent/toolRegistry/toolContribution' import { IAgentTaskService } from '#/agent/task/task'; import type { AgentTaskInfo } from '#/agent/task/task'; -import { formatPlainObject } from '#/agent/task/tools/format'; +import { formatTaskRecord } from '#/agent/task/tools/format'; import { ITaskListTool, TaskListInputSchema, type TaskListInput } from './task-list'; import TASK_LIST_DESCRIPTION from './task-list.md?raw'; @@ -13,7 +13,7 @@ export function formatTaskList(tasks: readonly AgentTaskInfo[], activeOnly: bool const label = activeOnly ? 'active_background_tasks' : 'background_tasks'; const header = `${label}: ${String(tasks.length)}`; if (tasks.length === 0) return `${header}\nNo background tasks found.`; - return `${header}\n${tasks.map((task) => formatPlainObject(task)).join('\n---\n')}`; + return `${header}\n${tasks.map((task) => formatTaskRecord(task)).join('\n---\n')}`; } export class TaskListTool implements ITaskListTool { diff --git a/packages/agent-core-v2/src/agent/tools/task/task-output/taskOutputTool.ts b/packages/agent-core-v2/src/agent/tools/task/task-output/taskOutputTool.ts index ebf691ff4..0421444f9 100644 --- a/packages/agent-core-v2/src/agent/tools/task/task-output/taskOutputTool.ts +++ b/packages/agent-core-v2/src/agent/tools/task/task-output/taskOutputTool.ts @@ -9,7 +9,7 @@ import type { AgentTaskOutputSnapshot, } from '#/agent/task/task'; import { type AgentTaskStatus, TERMINAL_STATUSES } from '#/agent/task/types'; -import { formatPlainObject } from '#/agent/task/tools/format'; +import { formatTaskRecord } from '#/agent/task/tools/format'; import { ITaskOutputTool, TaskOutputInputSchema, type TaskOutputInput } from './task-output'; import TASK_OUTPUT_DESCRIPTION from './task-output.md?raw'; @@ -72,7 +72,7 @@ export class TaskOutputTool implements ITaskOutputTool { const output = await this.tasks.getOutputSnapshot(args.task_id, OUTPUT_PREVIEW_BYTES); const lines = [ - formatPlainObject({ + formatTaskRecord({ retrievalStatus: retrievalStatus(current.status), ...current, outputPath: output.outputPath, diff --git a/packages/agent-core-v2/src/agent/tools/task/task-stop/taskStopTool.ts b/packages/agent-core-v2/src/agent/tools/task/task-stop/taskStopTool.ts index 40f873c65..fe474384a 100644 --- a/packages/agent-core-v2/src/agent/tools/task/task-stop/taskStopTool.ts +++ b/packages/agent-core-v2/src/agent/tools/task/task-stop/taskStopTool.ts @@ -5,6 +5,7 @@ import { registerAgentToolService } from '#/agent/toolRegistry/toolContribution' import { IAgentTaskService } from '#/agent/task/task'; import { TERMINAL_STATUSES } from '#/agent/task/types'; +import { formatTaskWallTime } from '#/agent/task/wallTime'; import { ITaskStopTool, TaskStopInputSchema, type TaskStopInput } from './task-stop'; import TASK_STOP_DESCRIPTION from './task-stop.md?raw'; @@ -36,6 +37,7 @@ export class TaskStopTool implements ITaskStopTool { if (TERMINAL_STATUSES.has(info.status)) { return { output: + `Wall time: ${formatTaskWallTime(info)}\n` + `task_id: ${info.taskId}\n` + `status: ${info.status}\n` + `reason: ${terminalStopReason(info.stopReason)}`, @@ -51,6 +53,7 @@ export class TaskStopTool implements ITaskStopTool { return { output: + `Wall time: ${formatTaskWallTime(result)}\n` + `task_id: ${result.taskId}\n` + `status: ${result.status}\n` + `reason: ${result.stopReason ?? reason}`, diff --git a/packages/agent-core-v2/src/agent/tools/task/task-wait/taskWaitTool.ts b/packages/agent-core-v2/src/agent/tools/task/task-wait/taskWaitTool.ts index 9856173d3..81d570d91 100644 --- a/packages/agent-core-v2/src/agent/tools/task/task-wait/taskWaitTool.ts +++ b/packages/agent-core-v2/src/agent/tools/task/task-wait/taskWaitTool.ts @@ -11,7 +11,7 @@ import { registerAgentToolService } from '#/agent/toolRegistry/toolContribution' import { IAgentTaskService } from '#/agent/task/task'; import type { AgentTaskInfo, AgentTaskOutputSnapshot } from '#/agent/task/task'; import { TERMINAL_STATUSES } from '#/agent/task/types'; -import { formatPlainObject } from '#/agent/task/tools/format'; +import { formatPlainObject, formatTaskRecord } from '#/agent/task/tools/format'; import { formatTaskList } from '#/agent/tools/task/task-list/taskListTool'; import { IFlagService } from '#/app/flag/flag'; import { ITelemetryService } from '#/app/telemetry/telemetry'; @@ -303,7 +303,7 @@ export class WaitForTool implements IWaitForTool { lines.push( '', '[completed_during_wait]', - extras.map((extra) => formatPlainObject(extra)).join('\n---\n'), + extras.map((extra) => formatTaskRecord(extra)).join('\n---\n'), 'Use TaskOutput with one of the task_id values above to read the full output.', ); } @@ -317,7 +317,7 @@ export class WaitForTool implements IWaitForTool { private async formatFinishedTask(info: AgentTaskInfo): Promise { const output = await this.tasks.getOutputSnapshot(info.taskId, OUTPUT_PREVIEW_BYTES); const lines = [ - formatPlainObject({ + formatTaskRecord({ ...info, outputPath: output.outputPath, terminalReason: terminalReason(info), diff --git a/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts b/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts index aef8a3a4e..d56b3dbed 100644 --- a/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts +++ b/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts @@ -1,4 +1,5 @@ import type { ILogger } from '#/_base/log/log'; +import type { IGitService } from '#/app/git/git'; import type { IHostProcessService } from '#/os/interface/hostProcess'; export const DEFAULT_AGENT_PROFILE_NAME = 'agent'; @@ -7,6 +8,7 @@ export interface AgentProfilePromptPrefixContext { readonly cwd: string; readonly process: IHostProcessService; readonly log?: ILogger; + readonly git?: IGitService; } export interface AgentProfileContext { diff --git a/packages/agent-core-v2/src/app/config/configService.ts b/packages/agent-core-v2/src/app/config/configService.ts index 57432c803..4c3905a44 100644 --- a/packages/agent-core-v2/src/app/config/configService.ts +++ b/packages/agent-core-v2/src/app/config/configService.ts @@ -138,6 +138,38 @@ export function applySectionEnv( return target; } +function collectEnvNames(bindings: AnyEnvBindings, into: string[]): void { + if (isEnvBinding(bindings)) { + if (typeof bindings === 'string') { + into.push(bindings); + return; + } + into.push(bindings.env); + if (bindings.deprecatedEnv !== undefined) into.push(bindings.deprecatedEnv); + return; + } + for (const child of Object.values(bindings)) { + if (child !== undefined) collectEnvNames(child, into); + } +} + +function sameEnvValues( + a: readonly (string | undefined)[], + b: readonly (string | undefined)[], +): boolean { + if (a.length !== b.length) return false; + for (let i = 0; i < a.length; i += 1) { + if (a[i] !== b[i]) return false; + } + return true; +} + +interface EnvSectionResolution { + readonly base: unknown; + readonly envValues: readonly (string | undefined)[]; + readonly value: unknown; +} + function isSameSection( existing: ConfigSection, schema: ConfigSchema, @@ -319,6 +351,8 @@ export class ConfigService extends Disposable implements IConfigService { private lastDiagnosticsSnapshot = '[]'; private readonly configKey: string; private tainted = false; + private readonly envNamesBySection = new WeakMap(); + private readonly envSectionResolutions = new WeakMap(); constructor( @IConfigRegistry private readonly registry: IConfigRegistry, @@ -677,12 +711,32 @@ export class ConfigService extends Disposable implements IConfigService { return validated; } + private sectionEnvNames(section: ConfigSection): readonly string[] { + const cached = this.envNamesBySection.get(section); + if (cached !== undefined) return cached; + const names: string[] = []; + if (section.env !== undefined) collectEnvNames(section.env, names); + this.envNamesBySection.set(section, names); + return names; + } + private applySectionEnvBindings(effective: ResolvedConfig, reportErrors: boolean): void { const getEnv = (name: string): string | undefined => this.bootstrap.getEnv(name); for (const section of this.registry.listSections()) { if (section.env === undefined) continue; + const base = effective[section.domain]; + const envValues = this.sectionEnvNames(section).map(getEnv); + const resolved = this.envSectionResolutions.get(section); + if ( + !reportErrors && + resolved !== undefined && + resolved.base === base && + sameEnvValues(resolved.envValues, envValues) + ) { + effective[section.domain] = resolved.value; + continue; + } try { - const base = effective[section.domain]; const onDeprecatedEnv: OnDeprecatedEnv | undefined = reportErrors ? (oldName, newName) => { this.pushDiagnostic({ @@ -693,8 +747,11 @@ export class ConfigService extends Disposable implements IConfigService { } : undefined; const next = applySectionEnv(base, section.env, getEnv, onDeprecatedEnv); - effective[section.domain] = this.registry.validate(section.domain, next); + const value = this.registry.validate(section.domain, next); + effective[section.domain] = value; + this.envSectionResolutions.set(section, { base, envValues, value }); } catch (error) { + this.envSectionResolutions.delete(section); if (reportErrors) { this.pushDiagnostic({ domain: section.domain, diff --git a/packages/agent-core-v2/src/app/git/git.ts b/packages/agent-core-v2/src/app/git/git.ts index c4291df5d..1dc81eff9 100644 --- a/packages/agent-core-v2/src/app/git/git.ts +++ b/packages/agent-core-v2/src/app/git/git.ts @@ -53,12 +53,24 @@ export const fsDiffResponseSchema = z.object({ }); export type FsDiffResponse = z.infer; +export interface RunGitOptions { + readonly timeoutMs?: number; + readonly env?: Record; +} + +export interface RunGitResult { + readonly exitCode: number; + readonly stdout: string; + readonly stderr: string; +} + export interface IGitService { readonly _serviceBrand: undefined; status(cwd: string, pathFilter?: ReadonlySet): Promise; diff(cwd: string, relPath: string, absPath: string): Promise; findWorkTree(cwd: string): Promise; + runGit(cwd: string, args: readonly string[], options?: RunGitOptions): Promise; } export const IGitService: ServiceIdentifier = diff --git a/packages/agent-core-v2/src/app/git/gitService.ts b/packages/agent-core-v2/src/app/git/gitService.ts index 512b5c4d9..7ff37b028 100644 --- a/packages/agent-core-v2/src/app/git/gitService.ts +++ b/packages/agent-core-v2/src/app/git/gitService.ts @@ -1,6 +1,13 @@ -import type { FsDiffResponse, FsGitStatusResponse, FsPullRequest } from './git'; +import type { + FsDiffResponse, + FsGitStatusResponse, + FsPullRequest, + RunGitOptions, + RunGitResult, +} from './git'; import { LifecycleScope } from '#/app/scopes'; import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; +import { GIT_DIFF_ARGS, hardenedGitConfigArgs } from '#/app/git/hardening'; import { ErrorCodes, Error2 } from '#/errors'; import { IHostFileSystem } from '#/os/interface/hostFileSystem'; import { IRuntimeResolver, IWorkspaceInstanceManager } from '#/workspace/workspaceInstance/workspaceInstanceManager'; @@ -11,6 +18,7 @@ import { findGitWorkTree, type GitWorkTree } from './workTree'; const DIFF_MAX_BYTES = 1_048_576; +const CONFIG_PROBE_TIMEOUT_MS = 5_000; const PR_SPAWN_TIMEOUT_MS = 5_000; const PULL_REQUEST_TTL_MS = 60_000; @@ -47,7 +55,11 @@ export class GitService implements IGitService { if (dirty) { const head = await this.runCommand('git', ['rev-parse', '--verify', '--quiet', 'HEAD'], cwd); if (head.exitCode === 0) { - const numstat = await this.runCommand('git', ['diff', '--no-color', '--numstat', 'HEAD', '--'], cwd); + const numstat = await this.runCommand( + 'git', + ['diff', '--no-color', ...GIT_DIFF_ARGS, '--numstat', 'HEAD', '--'], + cwd, + ); if (numstat.exitCode === 0) { const stats = parseNumstat(numstat.stdout); result.additions = stats.additions; @@ -79,7 +91,7 @@ export class GitService implements IGitService { if (untracked || !hasHead) { const res = await this.runCommand( 'git', - ['diff', '--no-color', '--no-index', '--', '/dev/null', relPath], + ['diff', '--no-color', ...GIT_DIFF_ARGS, '--no-index', '--', '/dev/null', relPath], cwd, ); if (res.exitCode !== 0 && res.exitCode !== 1) { @@ -87,7 +99,11 @@ export class GitService implements IGitService { } diffStdout = res.stdout; } else { - const res = await this.runCommand('git', ['diff', '--no-color', 'HEAD', '--', relPath], cwd); + const res = await this.runCommand( + 'git', + ['diff', '--no-color', ...GIT_DIFF_ARGS, 'HEAD', '--', relPath], + cwd, + ); if (res.exitCode !== 0) { throw this.gitUnavailable(cwd, res.stderr.trim() || `git diff exit ${res.exitCode}`); } @@ -117,6 +133,30 @@ export class GitService implements IGitService { return findGitWorkTree(this.fs, cwd); } + async runGit( + cwd: string, + args: readonly string[], + options: RunGitOptions = {}, + ): Promise { + try { + const configArgs = await hardenedGitConfigArgs(cwd, (probeArgs) => + this.spawnAndCollect('git', probeArgs, cwd, { + timeoutMs: CONFIG_PROBE_TIMEOUT_MS, + }), + ); + if (configArgs === null) { + return { exitCode: -1, stdout: '', stderr: 'git config probe failed' }; + } + return await this.spawnAndCollect('git', [...configArgs, ...args], cwd, options); + } catch (error) { + return { + exitCode: -1, + stdout: '', + stderr: error instanceof Error ? error.message : String(error), + }; + } + } + private async readPullRequest(cwd: string): Promise { const cached = this.pullRequestCache.get(cwd); const now = Date.now(); @@ -142,8 +182,20 @@ export class GitService implements IGitService { cmd: string, args: readonly string[], cwd: string, - options: RunOptions = {}, - ): Promise { + options: RunGitOptions = {}, + ): Promise { + if (cmd === 'git') { + return this.runGit(cwd, args, options); + } + return this.spawnAndCollect(cmd, args, cwd, options); + } + + private async spawnAndCollect( + cmd: string, + args: readonly string[], + cwd: string, + options: RunGitOptions, + ): Promise { const workspaceId = this.resolveWorkspaceId(cwd); const lease = this.resolver.acquire({ workspaceId, runtimeId: 'local' }, ['process']); const spawned = await lease.runtime.process! @@ -211,17 +263,6 @@ export class GitService implements IGitService { } } -interface RunResult { - readonly exitCode: number; - readonly stdout: string; - readonly stderr: string; -} - -interface RunOptions { - readonly timeoutMs?: number; - readonly env?: Record; -} - async function collect(stream: AsyncIterable): Promise { const decoder = new TextDecoder(); let out = ''; diff --git a/packages/agent-core-v2/src/app/git/hardening.ts b/packages/agent-core-v2/src/app/git/hardening.ts new file mode 100644 index 000000000..8b3a06722 --- /dev/null +++ b/packages/agent-core-v2/src/app/git/hardening.ts @@ -0,0 +1,264 @@ +import { open, readFile, realpath } from 'node:fs/promises'; +import { dirname, isAbsolute, join, normalize, resolve } from 'node:path'; + +const NULL_DEVICE = process.platform === 'win32' ? 'NUL' : '/dev/null'; + +export const GIT_CONFIG_ARGS: readonly string[] = [ + '-c', + 'core.fsmonitor=false', + '-c', + `core.hooksPath=${NULL_DEVICE}`, + '-c', + 'commit.gpgSign=false', + '-c', + 'log.showSignature=false', + '-c', + 'merge.verifySignatures=false', + '-c', + 'core.editor=', + '-c', + 'gpg.program=', + '-c', + 'submodule.recurse=false', +]; + +export const GIT_DIFF_ARGS: readonly string[] = ['--no-ext-diff', '--no-textconv']; + +export const INCLUDE_SECTION_RE = /^\s*\[\s*include(?:\.|\s|\]|if)/im; + +export function parseGitDirPointer(content: string): string | undefined { + const stripped = content.codePointAt(0) === 0xfeff ? content.slice(1) : content; + const line = stripped.trimStart().split(/\r?\n/, 1)[0]?.trim(); + if (line === undefined || !line.startsWith('gitdir:')) return undefined; + const rawPath = line.slice('gitdir:'.length).trim(); + return rawPath.length > 0 ? rawPath : undefined; +} + +export function resolveConfigPaths(gitDir: string, commondirContent: string | undefined): string[] { + const configPaths = [join(gitDir, 'config'), join(gitDir, 'config.worktree')]; + const commonDir = commondirContent?.trim(); + if (commonDir !== undefined && commonDir.length > 0) { + configPaths.push(join(resolve(gitDir, commonDir), 'config')); + } + return configPaths; +} + +export function buildDriverOverrides(outputs: readonly string[]): readonly string[] | null { + const filterDrivers = new Set(); + const mergeDrivers = new Set(); + for (const output of outputs) { + for (const line of output.split('\n')) { + const filter = /^filter\.(.+)\.(?:clean|process|smudge)$/.exec(line); + const filterDriver = filter?.[1]; + if (filterDriver !== undefined) { + if (filterDriver.includes('=')) return null; + filterDrivers.add(filterDriver); + } + const merge = /^merge\.(.+)\.driver$/.exec(line); + const mergeDriver = merge?.[1]; + if (mergeDriver !== undefined) { + if (mergeDriver.includes('=')) return null; + mergeDrivers.add(mergeDriver); + } + } + } + const args: string[] = []; + for (const driver of filterDrivers) { + args.push( + '-c', + `filter.${driver}.clean=`, + '-c', + `filter.${driver}.process=`, + '-c', + `filter.${driver}.smudge=`, + ); + } + for (const driver of mergeDrivers) { + args.push('-c', `merge.${driver}.driver=`); + } + return args; +} + +export function isCoreWorktreeSafe( + raw: string, + resolvedGitDir: string, + workTreeRoot: string, +): boolean { + const configured = isAbsolute(raw) ? normalize(raw) : resolve(resolvedGitDir, raw); + if (process.platform === 'win32') { + return normalize(configured).toLowerCase() === normalize(workTreeRoot).toLowerCase(); + } + return normalize(configured) === normalize(workTreeRoot); +} + +export interface GitProbeResult { + readonly exitCode: number; + readonly stdout: string; +} + +export type GitProbe = (args: readonly string[]) => Promise; + +interface FilterArgsCacheEntry { + readonly stamp: string | null; + readonly args: readonly string[]; +} + +const filterArgsCache = new Map(); + +export async function hardenedGitConfigArgs( + cwd: string, + probe: GitProbe, +): Promise { + const gitDir = await findGitDir(cwd); + const stamp = await gitConfigStamp(cwd, gitDir); + const cached = filterArgsCache.get(cwd); + if (stamp !== null && cached?.stamp === stamp) return cached.args; + if (!(await coreWorktreeSafe(cwd, probe, gitDir))) return null; + const filterArgs = await probeFilterArgs(cwd, probe); + if (filterArgs === null) return null; + const args = [...GIT_CONFIG_ARGS, ...filterArgs]; + filterArgsCache.set(cwd, { stamp, args }); + return args; +} + +async function coreWorktreeSafe( + cwd: string, + probe: GitProbe, + gitDir: string | null, +): Promise { + if (gitDir === null) return true; + let resolvedGitDir: string; + let workTreeRoot: string; + try { + const realGitPath = await realpath(gitDir); + workTreeRoot = await realpath(dirname(gitDir)); + const opened = await readGitPath(realGitPath); + if (opened.directory) { + resolvedGitDir = realGitPath; + } else { + const pointer = parseGitDirPointer(opened.text); + if (pointer === undefined) return true; + resolvedGitDir = resolve(dirname(realGitPath), pointer); + } + } catch { + return false; + } + const results = await Promise.all( + ['--local', '--worktree'].map((scope) => + probe([ + ...GIT_CONFIG_ARGS, + '-C', + cwd, + 'config', + scope, + '--includes', + '--get', + 'core.worktree', + ]).catch(() => null), + ), + ); + for (const result of results) { + if (result === null || result.exitCode < 0) return false; + if (result.exitCode !== 0) continue; + const raw = result.stdout.trim(); + if (raw === '' || isCoreWorktreeSafe(raw, resolvedGitDir, workTreeRoot)) continue; + return false; + } + return true; +} + +async function probeFilterArgs(cwd: string, probe: GitProbe): Promise { + const results = await Promise.all( + ['--local', '--worktree'].map((scope) => + probe([ + ...GIT_CONFIG_ARGS, + '-C', + cwd, + 'config', + scope, + '--includes', + '--get-regexp', + '--name-only', + '^(filter|merge)\\.', + ]).catch(() => null), + ), + ); + const outputs: string[] = []; + for (const result of results) { + if (result === null || result.exitCode < 0) return null; + if (result.exitCode !== 0) continue; + outputs.push(result.stdout); + } + return buildDriverOverrides(outputs); +} + +async function gitConfigStamp(cwd: string, found: string | null): Promise { + try { + if (found === null) return null; + let gitDir = found; + const opened = await readGitPath(gitDir); + if (!opened.directory) { + const pointer = parseGitDirPointer(opened.text); + if (pointer === undefined) return null; + gitDir = resolve(dirname(found), pointer); + } + const commondir = await readFile(join(gitDir, 'commondir'), 'utf8').catch(() => undefined); + const configPaths = resolveConfigPaths(gitDir, commondir); + const reads = await Promise.all(configPaths.map(readConfigStamp)); + for (const read of reads) { + if (read.content !== null && INCLUDE_SECTION_RE.test(read.content)) return null; + } + return reads.map((read) => read.stamp).join('|'); + } catch { + return null; + } +} + +async function findGitDir(start: string): Promise { + let dir = start; + for (;;) { + const candidate = join(dir, '.git'); + try { + const handle = await open(candidate, 'r'); + await handle.close(); + return candidate; + } catch { + } + const parent = dirname(dir); + if (parent === dir) return null; + dir = parent; + } +} + +interface GitPathRead { + readonly directory: boolean; + readonly text: string; +} + +async function readGitPath(path: string): Promise { + const handle = await open(path, 'r'); + try { + const info = await handle.stat(); + if (info.isDirectory()) return { directory: true, text: '' }; + return { directory: false, text: await handle.readFile('utf8') }; + } finally { + await handle.close(); + } +} + +async function readConfigStamp(path: string): Promise<{ readonly stamp: string; readonly content: string | null }> { + try { + const handle = await open(path, 'r'); + try { + const info = await handle.stat(); + return { + stamp: `${path}:${String(info.mtimeMs)}:${String(info.size)}`, + content: await handle.readFile('utf8'), + }; + } finally { + await handle.close(); + } + } catch { + return { stamp: `${path}:missing`, content: null }; + } +} diff --git a/packages/agent-core-v2/src/app/plugin/plugin.ts b/packages/agent-core-v2/src/app/plugin/plugin.ts index 7d362c9bd..5f99d1dd0 100644 --- a/packages/agent-core-v2/src/app/plugin/plugin.ts +++ b/packages/agent-core-v2/src/app/plugin/plugin.ts @@ -61,6 +61,7 @@ export interface IPluginService { mcpServerEntries(): Promise; enabledHooks(): Promise; hasLoadedSnapshot(): boolean; + enabledPluginIds(): readonly string[] | undefined; readonly onDidReload: Event; readonly onDidMutate: Event; } diff --git a/packages/agent-core-v2/src/app/plugin/pluginService.ts b/packages/agent-core-v2/src/app/plugin/pluginService.ts index 19595bbfe..e21fe3c80 100644 --- a/packages/agent-core-v2/src/app/plugin/pluginService.ts +++ b/packages/agent-core-v2/src/app/plugin/pluginService.ts @@ -4,6 +4,8 @@ import { Service } from '#/_base/di/service'; import { AsyncEmitter, Emitter, type Event } from '#/_base/event'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { LifecycleScope } from '#/app/scopes'; +import type { PluginToggleEvent } from '#/app/telemetry/events'; +import { ITelemetryService } from '#/app/telemetry/telemetry'; import { ISkillDiscovery } from '#/features/skill/catalog/skillDiscovery'; import type { SkillRoot } from '#/features/skill/catalog/types'; import { BugIndicatingError, Error2, PluginErrors } from '#/errors'; @@ -20,6 +22,7 @@ import { type SetPluginEnabledInput, type SetPluginMcpServerEnabledInput, } from './plugin'; +import { normalizePluginId } from './types'; import type { EnabledPluginSessionStart, EnabledPluginSystemPrompt, @@ -66,6 +69,7 @@ export class PluginService extends Service implements IPluginService { @IBootstrapService bootstrap: IBootstrapService, @ISkillDiscovery discovery: ISkillDiscovery, @IProviderService private readonly providers: IProviderService, + @ITelemetryService private readonly telemetry: ITelemetryService, ) { super(); this.homeDir = bootstrap.homeDir; @@ -94,10 +98,17 @@ export class PluginService extends Service implements IPluginService { setPluginEnabled(input: SetPluginEnabledInput): Promise { return this.runNotifiedMutation(async () => { - await this.manager.setEnabled(input.id, input.enabled); + const id = normalizePluginId(input.id); + await this.manager.setEnabled(id, input.enabled); const notification = await this.reloadAndNotify({ - mutation: { kind: input.enabled ? 'enable' : 'disable', id: input.id }, + mutation: { kind: input.enabled ? 'enable' : 'disable', id }, }); + const event: PluginToggleEvent = { + plugin_id: id, + enabled: input.enabled, + enabled_plugins: this.enabledPluginIds()?.join(','), + }; + this.telemetry.track2('plugin_toggle', event); return { result: undefined, notification }; }); } @@ -221,6 +232,15 @@ export class PluginService extends Service implements IPluginService { return this.snapshotLoaded; } + enabledPluginIds(): readonly string[] | undefined { + if (!this.snapshotLoaded) return undefined; + return this.manager + .summaries() + .filter((plugin) => plugin.enabled && plugin.state === 'ok') + .map((plugin) => plugin.id) + .toSorted(); + } + private runSerializedOperation(operation: () => Promise): Promise { void this.startInitialLoad(); return this.enqueueMutation(async () => { diff --git a/packages/agent-core-v2/src/app/projectLocalConfig/projectLocalConfig.ts b/packages/agent-core-v2/src/app/projectLocalConfig/projectLocalConfig.ts index 5a566760d..1f39e6114 100644 --- a/packages/agent-core-v2/src/app/projectLocalConfig/projectLocalConfig.ts +++ b/packages/agent-core-v2/src/app/projectLocalConfig/projectLocalConfig.ts @@ -1,14 +1,18 @@ import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; -export interface ProjectAdditionalDirsLoadResult { +export interface ProjectAdditionalDirsLocation { readonly projectRoot: string; readonly configPath: string; +} + +export interface ProjectAdditionalDirsLoadResult extends ProjectAdditionalDirsLocation { readonly additionalDirs: readonly string[]; } export interface IProjectLocalConfigService { readonly _serviceBrand: undefined; + locateAdditionalDirsConfig(workDir: string): Promise; readAdditionalDirs(workDir: string): Promise; resolveAdditionalDirs(baseDir: string, additionalDirs: readonly string[]): Promise; appendAdditionalDir( diff --git a/packages/agent-core-v2/src/app/telemetry/events.ts b/packages/agent-core-v2/src/app/telemetry/events.ts index ceea08072..d428eccf5 100644 --- a/packages/agent-core-v2/src/app/telemetry/events.ts +++ b/packages/agent-core-v2/src/app/telemetry/events.ts @@ -58,6 +58,7 @@ export interface TurnStartedEvent { provider_type?: string; protocol?: string; thinking_effort?: string; + enabled_plugins?: string; } export interface TurnInterruptedEvent { @@ -81,6 +82,7 @@ export interface TurnEndedEvent { protocol?: string; thinking_effort?: string; trace_id?: string; + enabled_plugins?: string; } export interface PromptCacheProbeEvent { @@ -224,6 +226,12 @@ export interface RemoteControlToggleEvent { outcome: 'ok' | 'already_running' | 'rejected' | 'error'; } +export interface PluginToggleEvent { + plugin_id: string; + enabled: boolean; + enabled_plugins?: string; +} + export interface CompactionFinishedEvent { turn_id?: number; source: 'manual' | 'auto'; @@ -607,6 +615,8 @@ export const telemetryEventDefinitions = { provider_type: 'Provider protocol type', protocol: 'Request protocol', thinking_effort: 'Effective thinking effort the turn runs with', + enabled_plugins: + 'Comma-separated sorted ids of enabled, loaded plugins when the turn starts; empty string for a known empty set, absent when no plugin snapshot is available', }, }), turn_interrupted: defineAgentTelemetryEvent({ @@ -638,6 +648,8 @@ export const telemetryEventDefinitions = { thinking_effort: 'Effective thinking effort the turn ran with', trace_id: 'Trace id of the most recent LLM request in this turn; absent for non-Pythinker protocols', + enabled_plugins: + 'Comma-separated sorted ids of enabled, loaded plugins when the turn ends; empty string for a known empty set, absent when no plugin snapshot is available', }, }), prompt_cache_probe: defineAgentTelemetryEvent({ @@ -837,6 +849,16 @@ export const telemetryEventDefinitions = { outcome: 'How the request resolved', }, }), + plugin_toggle: defineTelemetryEvent({ + owner: 'pythinker-code', + comment: 'An installed plugin is enabled or disabled.', + properties: { + plugin_id: 'Id of the toggled plugin', + enabled: 'Whether the plugin is enabled after the toggle', + enabled_plugins: + 'Comma-separated sorted ids of enabled, loaded plugins after the toggle commits; empty string for a known empty set', + }, + }), compaction_finished: defineAgentTelemetryEvent({ owner: 'pythinker-code', comment: 'Context compaction completes.', diff --git a/packages/agent-core-v2/src/app/telemetry/telemetryService.ts b/packages/agent-core-v2/src/app/telemetry/telemetryService.ts index 94fd9e7f3..0a0d477e2 100644 --- a/packages/agent-core-v2/src/app/telemetry/telemetryService.ts +++ b/packages/agent-core-v2/src/app/telemetry/telemetryService.ts @@ -164,8 +164,8 @@ export class TelemetryService for (const appender of this.appenders) { try { appender.track(record); - } catch (err) { - onUnexpectedError(err); + } catch (error) { + onUnexpectedError(error); } } } diff --git a/packages/agent-core-v2/src/features/dateChange/dateChangeService.ts b/packages/agent-core-v2/src/features/dateChange/dateChangeService.ts index 4078263ce..d52e17741 100644 --- a/packages/agent-core-v2/src/features/dateChange/dateChangeService.ts +++ b/packages/agent-core-v2/src/features/dateChange/dateChangeService.ts @@ -38,15 +38,27 @@ interface DateChangeDiscloseEvent { readonly seed: DateDisclosure; } +let cachedLocalDateFormat: { readonly timeZone: string; readonly format: Intl.DateTimeFormat } | undefined; + +function localDateFormat(timeZone: string): Intl.DateTimeFormat { + if (cachedLocalDateFormat?.timeZone !== timeZone) { + cachedLocalDateFormat = { + timeZone, + format: new Intl.DateTimeFormat('en-US', { + timeZone, + year: 'numeric', + month: '2-digit', + day: '2-digit', + }), + }; + } + return cachedLocalDateFormat.format; +} + function currentDateDisclosure(clock: IHostClock): Omit { const date = clock.now(); const timeZone = clock.timeZone(); - const parts = new Intl.DateTimeFormat('en-US', { - timeZone, - year: 'numeric', - month: '2-digit', - day: '2-digit', - }).formatToParts(date); + const parts = localDateFormat(timeZone).formatToParts(date); const part = (type: Intl.DateTimeFormatPartTypes): string => parts.find((candidate) => candidate.type === type)?.value ?? ''; return { diff --git a/packages/agent-core-v2/src/features/tower/injection/tower-mode-full-reminder.md b/packages/agent-core-v2/src/features/tower/injection/tower-mode-full-reminder.md index 041683be2..e4d1ec395 100644 --- a/packages/agent-core-v2/src/features/tower/injection/tower-mode-full-reminder.md +++ b/packages/agent-core-v2/src/features/tower/injection/tower-mode-full-reminder.md @@ -1,44 +1,38 @@ -Tower mode is active. You are the control tower for this repository — you plan missions, spawn worker and reviewer agents, route information, merge branches, and keep the human informed. You never write product code yourself. This supersedes any other instructions you have received. +Tower mode is active. You are the control tower for this repository — you plan missions, spawn worker and reviewer agents, route information, merge branches, and keep the human informed. This supersedes any other instructions you have received. Tower runs several agents on one repository at the same time without them stepping on each other. Three roles: - **The human** — owns the objective. May speak, launch, or redirect work **at any time**; nothing in this mode waits for the human. -- **The tower** — **you**, the main agent. Exactly one. You never write product code: you plan missions, spawn workers and reviewers, route information, merge branches, and keep the human informed. +- **The tower** — **you**, the main agent. Exactly one. You plan missions, spawn workers and reviewers, route information, merge branches, and keep the human informed. - **Workers and reviewers** — subagents you spawn with `TowerSpawn`. Each worker owns one mission in its own git worktree; reviewers audit branches. -**The protocol is enforced by tools, not by instructions.** All comms artifacts — inbox messages, findings, reviews, mission files, `MISSIONS.md`, the activity log — are produced by the `Tower*` tools. Workers and reviewers carry `TowerSend`, `TowerInbox`, `TowerFinding`, `TowerReview`, `TowerMission`, and `TowerStatus`; the tower additionally gets `TowerInit`, `TowerPlan`, `TowerSpawn`, `TowerMerge`, and `TowerTeardown`. File naming, frontmatter, recipient validity, review rounds, the merge gate, and the activity-log format are code. **Never create or edit files under `.tower/` by hand** (yours or via Bash): if a tool refuses, read the error — it tells you the correct next step. When something looks wrong, read `.tower/comms/log/activity.log` first; every action of every participant is there. +**The protocol is enforced by tools, not by instructions.** All comms artifacts — inbox messages, findings, reviews, mission files, `MISSIONS.md`, the activity log — are produced by the `Tower*` tools; never create or edit files under `.tower/` by hand. If a tool refuses, read the error — it tells you the correct next step. When something looks wrong, read `.tower/comms/log/activity.log` first; every action of every participant is there. Working principles: -1. **Clarify up front. Never block on the human mid-run.** Use `AskUserQuestion` to pin down requirements with the human before you plan and spawn, while ambiguity is still cheap — that is the phase where asking beats deciding. Once the fleet is running, make the reasonable call yourself: record the decision (it lands in the activity log), inform the human in passing, proceed. The return channel is your normal chat reply (the human reads it when they come back) plus `activity.log` — say what you decided and why, in the open. Escalations are reported, not asked — unless every remaining thread is blocked, keep the others moving. Workers and reviewers cannot ask the human at all (their profile has no `AskUserQuestion`); they escalate to you with `TowerSend`. The single mid-run exception is creating git history over a non-empty directory (below): there, ask when asking is possible (not under auto permission mode) and take the safe default when it is not. -2. **Agents negotiate internally.** Workers talk to each other through `TowerSend` directly — questions, review requests, broadcasts (`to: "all"`). You are the coordinator and the only merger, not a content relay: you relay wake-ups (resume an idle agent with `Agent(resume=..., run_in_background=true, prompt=...)` pointing at what it should read), triage findings, untangle conflicts, and merge. +1. **Clarify up front. Never block on the human mid-run.** Use `AskUserQuestion` to pin down requirements before you plan and spawn, while ambiguity is still cheap. Once the fleet is running, make the reasonable call yourself, record it (it lands in the activity log), inform the human in passing, and proceed — escalations are reported, not asked, and unless every remaining thread is blocked, keep the others moving. Workers and reviewers cannot ask the human at all; they escalate to you with `TowerSend`. +2. **Agents negotiate internally.** Workers talk to each other through `TowerSend` directly — questions, review requests, broadcasts (`to: "all"`). You relay wake-ups, triage findings, untangle conflicts, and merge; you are not a content relay. 3. **Scope isolation is real.** `TowerPlan` rejects overlapping scopes, and `TowerMerge` refuses branches that changed files outside their mission scope. Plan scopes carefully; if a mission legitimately needs more, you widen it with `TowerMission` (scope patch — only you can, and it is logged). -## Prepare (only when the directory is not a tower-ready git repo) - -`TowerInit` requires a git repository with at least one commit. If the session working directory is not inside one, the engine bootstraps it for you: `git init`, then an initial commit on the base branch — an empty directory gets `git commit --allow-empty -m "tower: init"`; a non-empty directory gets every present file committed as a dirty-base snapshot (`tower: snapshot of uncommitted base checkout changes (base )` — the same semantics as starting a tower over an uncommitted checkout). If the directory holds secrets or large files that must not enter history, move them out or add a `.gitignore` BEFORE starting the tower — the snapshot commits everything present. - ## Tower workflow -1. **Init** — `TowerInit`. It creates `.tower/` and records the base branch — when the human enabled tower mode with `/tower `, the workspace and base branch are already set up, so `TowerInit` just confirms them. Workers and reviewers never prompt for tool approvals — they are pinned to the auto permission mode at spawn, whatever the session's mode. Your own orchestration calls still follow the session mode, so if it would interrupt you with constant prompts, tell the human once that a more autonomous mode fits tower better — then proceed regardless. When `TowerInit` reports carried-over open missions from a previous session, settle them **before planning**: continue the ones that belong to the current objective with fresh workers, and abandon the unrelated ones (`TowerMission status=abandoned`) — missions that are neither merged nor abandoned keep their scopes reserved, so `TowerPlan` rejects any new mission overlapping them. -2. **Plan** — break the objective into 2–4 missions and call `TowerPlan` with each mission's title, **disjoint** scope globs (picomatch: `**` crosses directories), tasks, and dependencies. Titles must be **printable ASCII English** — any non-ASCII character is rejected and forces a re-plan. Give every title a unique identifier word (a business code, a module name, a ticket id). Write tasks as **verifiable** items a reviewer can map to the diff, and when the human's own words carry intent your paraphrase could lose, copy the key sentences into the mission's `context` **verbatim** — when in doubt, include it. `context` supplements your paraphrase (never replaces it, never holds the full conversation history) and is the one channel that carries the human's voice to both worker and reviewer. Mark read-only investigation missions `kind: "survey"`: a survey's scope is informational (it reserves nothing, so surveys and builds may overlap the same paths), the worker must not change code, and it closes with a zero-diff `TowerMerge` — no reviewer needed. Shared files (lockfiles, central configs) belong to exactly one build mission or to your own integration work. Post the plan to the human in one compact message and launch immediately — their words are plan changes, never a gate. -3. **Spawn** — one `TowerSpawn` per mission (`kind: "worker"`, background, code-built briefing), and **spawn every dependency-unblocked mission right away**: fire the `TowerSpawn` calls back to back, never trickle them out one at a time and never wait for one worker before launching the next — the fleet exists to run in parallel. The tool refuses duplicate names — resume the existing agent with the `Agent` tool instead, always in the background (`run_in_background=true`). Workers commit on their branch; their completion wakes you. Once the batch is running, **end your turn**: completions and inbox traffic arrive as notifications, so never poll `TowerInbox`/`TowerStatus` in a loop and never sit synchronously waiting on a worker. Workers use the configured secondary model when `[secondary_model]` provides one; otherwise they inherit your model. Reviewers always bind your primary model — review quality is not where you save. The resolved model is shown in the spawn output and the `spawn` line of `activity.log`. +1. **Init** — `TowerInit` creates `.tower/` and records the base branch (already set up when the human enabled tower mode with `/tower `). If the working directory is not yet a git repo, the engine bootstraps one and commits everything present — warn the human to move secrets or large files out BEFORE you init. Settle carried-over open missions **before planning**: continue the ones that belong to the current objective with fresh workers, and abandon the unrelated ones (`TowerMission status=abandoned`) — open missions keep their scopes reserved, so `TowerPlan` rejects any new mission overlapping them. +2. **Plan** — split the objective by **functional boundary and workload**: one coherent slice per mission, small enough to review in one pass; split anything that smells multi-hour into smaller missions wired with `deps`. Prefer more, smaller missions — there is no fixed count. Then call `TowerPlan` with each mission's title, **disjoint** scope globs (picomatch: `**` crosses directories), tasks, and dependencies. Titles must be **printable ASCII English** — any non-ASCII character is rejected and forces a re-plan. Give every title a unique identifier word (a business code, a module name, a ticket id). Write tasks as **verifiable** items a reviewer can map to the diff, and when the human's own words carry intent your paraphrase could lose, copy the key sentences into the mission's `context` **verbatim** — when in doubt, include it. `context` supplements your paraphrase (never replaces it, never holds the full conversation history) and is the one channel that carries the human's voice to both worker and reviewer. Mark read-only investigation missions `kind: "survey"`: a survey's scope is informational (it reserves nothing, so surveys and builds may overlap the same paths), the worker must not change code, and it closes with a zero-diff `TowerMerge` — no reviewer needed. Shared files (lockfiles, central configs) belong to exactly one build mission or to your own integration work. Post the plan to the human in one compact message and launch immediately — their words are plan changes, never a gate. +3. **Spawn** — one `TowerSpawn` per mission (`kind: "worker"`, background, code-built briefing), and **spawn every dependency-unblocked mission right away**: fire the `TowerSpawn` calls back to back, never trickle them out one at a time and never wait for one worker before launching the next — the fleet exists to run in parallel. The tool refuses duplicate names — resume the existing agent with the `Agent` tool instead, always in the background (`run_in_background=true`). Workers commit on their branch; their completion wakes you. Once the batch is running, **end your turn**: completions and inbox traffic arrive as notifications, so never poll `TowerInbox`/`TowerStatus` in a loop and never sit synchronously waiting on a worker. 4. **Supervise** — on every wake (worker completion, human message): `TowerInbox` and `TowerStatus`, then act: - Review request → first reconcile the worker's report against the mission tasks **item by item** (a silently dropped task means the mission is not done — send it back), then `TowerSpawn` a reviewer (`kind: "reviewer"`, `review_target` the branch) — the briefing hands the reviewer the mission text and the worker's report, so the review verifies intent, not only code health. Do not review mission code yourself. Survey missions skip review — close them with `TowerMerge` once their summary lands. - - Review verdict not clean → resume the author (`Agent(resume=..., run_in_background=true, prompt=...)`) pointing at the review file; the author fixes, pushes, and requests re-review. Round cap: at 5 rounds, or when two consecutive rounds report the same findings, stop the loop, inform the human, and redirect (reassign, split, descope). + - Review verdict not clean → the store flips the mission from 🟢 completed back to 🔵 active on its own (only ✅ merged is final); resume the author pointing at the review file — the author fixes and requests re-review. Round cap: at 5 rounds, or when two consecutive rounds report the same findings, stop the loop, inform the human, and redirect (reassign, split, descope). - Blocker → answer or reassign if you can; if it genuinely needs the human, inform them and keep the rest moving. - Finding → triage: assign to a mission, plan a new one, or backlog — the disposition is your call; tell the human. - Completion report with a suspicious diff (🟢 claimed, zero changed files) → investigate before accepting. -5. **Merge** — `TowerMerge(branch)` in Dependency Flow order. The gate refuses when there is no clean review for the current tip, dependencies are unmerged, or files escaped the scope — the error message is your next step. After a merge, the result lists branches that now conflict: tell those workers (resume with `run_in_background=true`) to rebase onto the new base, resolve, push, and request re-review; their moved tip makes the gate demand a fresh clean review. -6. **Teardown promptly** — when `TowerStatus` shows every mission ✅ merged and no unactioned inbox items remain, call `TowerTeardown` **right away** and report the final summary (missions, merges, review rounds, findings and their disposition). Do not wait for the human to ask: branches and `.tower/comms/` (including the activity log) are kept and dirty worktrees are protected by the tool — only disk is freed. Teardown does **not** exit tower mode — you remain the tower, ready to `TowerInit` the next objective, until the human turns the mode off with `/tower off`. A `/tower teardown` from the human is the same instruction at any earlier point. +5. **Merge** — `TowerMerge(branch)` in Dependency Flow order; never `git merge` by hand, never merge around a refusal. The gate refuses when there is no clean review for the current tip, dependencies are unmerged, or files escaped the scope. After a merge, the result lists branches that now conflict: tell those workers to rebase onto the new base, resolve, and request re-review; their moved tip makes the gate demand a fresh clean review. +6. **Teardown promptly** — when `TowerStatus` shows every mission ✅ merged and no unactioned inbox items remain, summarize what every worker produced (per mission: what was built, the branch and its merge outcome, anything left undone) and call `TowerTeardown` **right away** — never tear down without that summary. Branches and `.tower/comms/` are kept and dirty worktrees are protected — only disk is freed. Teardown does **not** exit tower mode — you remain the tower, ready for the next objective, until the human turns the mode off with `/tower off`. A `/tower teardown` from the human is the same instruction at any earlier point. ## Hard rules for the tower - Exactly one tower. If a worker starts assigning work or merging, correct it on your next resume. - Never write product code yourself; integration fixes at merge time are yours, everything else goes to a worker. -- Mission tracking lives in the tower protocol (`TowerPlan`/`TowerMission`/`TowerStatus`, `MISSIONS.md`), never in `TodoList` — it is code-denied in tower mode because todo semantics (one task in progress at a time) would serialize the fleet. -- Workers negotiate through `TowerSend`; you relay wake-ups and step in for conflicts, caps, findings, and merges. +- Mission tracking lives in the tower protocol (`TowerPlan`/`TowerMission`/`TowerStatus`, `MISSIONS.md`), never in `TodoList` — it is code-denied in tower mode because todo semantics would serialize the fleet. +- Parallel work runs through the tower fleet (`TowerSpawn` per mission), never `AgentDynamicWorkflow` — it is code-denied while tower mode is active because dynamic_workflow and tower modes are mutually exclusive. - Every resume of a roster agent is a background call — `Agent(resume=..., run_in_background=true, prompt="...")`, never foreground: you never need a worker's return value inline (its output flows back through the tower protocol files and its completion wakes you), while a foreground resume blocks your whole turn and jams the fleet. The one exception: if your tool set lacks background execution (the Agent tool rejects `run_in_background=true` when TaskList, TaskOutput, or TaskStop is inactive), a foreground resume is the only form the tool accepts — use it there rather than leaving the agent unrecovered. -- Never hand-edit `.tower/` files. The tools are the protocol. -- You perform every merge, through `TowerMerge` — never `git merge` by hand, never merge around a refusal. -- Before `TowerTeardown`, summarize what every worker produced for the human — per mission: what was built, the branch and its merge outcome, and anything left undone. Never tear down without that summary. +- You perform every merge, through `TowerMerge`. diff --git a/packages/agent-core-v2/src/features/tower/protocol/git.ts b/packages/agent-core-v2/src/features/tower/protocol/git.ts index fa18c0fb5..5c5eca398 100644 --- a/packages/agent-core-v2/src/features/tower/protocol/git.ts +++ b/packages/agent-core-v2/src/features/tower/protocol/git.ts @@ -2,7 +2,10 @@ import { execFile } from 'node:child_process'; import { realpath } from 'node:fs/promises'; import { isAbsolute, join, relative, resolve } from 'node:path'; +import { GIT_DIFF_ARGS, hardenedGitConfigArgs, type GitProbeResult } from '#/app/git/hardening'; + const GIT_TIMEOUT_MS = 60_000; +const CONFIG_PROBE_TIMEOUT_MS = 5_000; export class GitError extends Error { constructor( @@ -23,10 +26,16 @@ export async function git( args: readonly string[], options: GitOptions = {}, ): Promise { + const configArgs = await hardenedGitConfigArgs(cwd, (probeArgs) => + probeGitConfig(cwd, probeArgs), + ); + if (configArgs === null) { + throw new GitError(args, 'git config probe failed'); + } return new Promise((resolve, reject) => { execFile( 'git', - [...args], + [...configArgs, ...args], { cwd, timeout: GIT_TIMEOUT_MS, @@ -44,6 +53,27 @@ export async function git( }); } +function probeGitConfig(cwd: string, args: readonly string[]): Promise { + return new Promise((resolve) => { + execFile( + 'git', + [...args], + { cwd, timeout: CONFIG_PROBE_TIMEOUT_MS, maxBuffer: 16 * 1024 * 1024 }, + (error, stdout) => { + if (error === null) { + resolve({ exitCode: 0, stdout }); + return; + } + const code: unknown = (error as { code?: unknown }).code; + resolve({ + exitCode: typeof code === 'number' ? code : -1, + stdout: typeof stdout === 'string' ? stdout : '', + }); + }, + ); + }); +} + export async function tryGit(cwd: string, args: readonly string[]): Promise { try { return await git(cwd, args); @@ -168,6 +198,6 @@ export async function diffNameOnly( base: string, ref: string, ): Promise { - const out = await git(cwd, ['diff', '--name-only', `${base}...${ref}`]); + const out = await git(cwd, ['diff', ...GIT_DIFF_ARGS, '--name-only', `${base}...${ref}`]); return out.length === 0 ? [] : out.split('\n').filter((line) => line.trim().length > 0); } diff --git a/packages/agent-core-v2/src/features/tower/protocol/store.ts b/packages/agent-core-v2/src/features/tower/protocol/store.ts index 80950ed37..6995bc844 100644 --- a/packages/agent-core-v2/src/features/tower/protocol/store.ts +++ b/packages/agent-core-v2/src/features/tower/protocol/store.ts @@ -67,6 +67,8 @@ export class TowerProtocolError extends Error { } } +export const MAX_REVIEW_ROUNDS = 5; + export interface TowerInitResult { readonly base: string; readonly created: boolean; @@ -122,6 +124,7 @@ export interface TowerMissionPatch { readonly blocker?: string; readonly clearBlockers?: boolean; readonly taskDone?: string; + readonly taskDrop?: { readonly text: string; readonly reason?: string }; readonly owner?: string; readonly scope?: readonly string[]; readonly spawnBase?: string; @@ -179,8 +182,19 @@ export async function assertLocalBaseBranch(repoRoot: string, base: string): Pro } export class TowerStore { + private mutation: Promise = Promise.resolve(); + constructor(readonly repoRoot: string) {} + private exclusive(work: () => Promise): Promise { + const run = this.mutation.then(work, work); + this.mutation = run.then( + () => undefined, + () => undefined, + ); + return run; + } + async isInitialized(): Promise { try { await readFile(this.abs(STATE_FILE), 'utf8'); @@ -211,6 +225,7 @@ export class TowerStore { } async init(sessionId?: string, base?: string): Promise { + return this.exclusive(async () => { await this.ensureRepository(base); if (!(await hasAnyCommit(this.repoRoot))) { throw new TowerProtocolError( @@ -263,9 +278,11 @@ export class TowerStore { await this.renderMissionsIndex(state); await this.appendLog(TOWER_NAME, 'init', { mode: state.mode, base: resolvedBase }, MISSIONS_INDEX); return { base: resolvedBase, created: true, retiredAgents: [], checkout, openMissions: [] }; + }); } async rebase(base: string): Promise { + return this.exclusive(async () => { const state = await this.load(); if (state.base === base) return; const open = state.missions.filter(isOpenMission); @@ -278,6 +295,7 @@ export class TowerStore { const from = state.base; await this.save({ ...state, base }); await this.appendLog(TOWER_NAME, 'rebase', { from, to: base }); + }); } private async checkedOutBranch(): Promise { @@ -307,6 +325,7 @@ export class TowerStore { } async adopt(sessionId: string): Promise { + return this.exclusive(async () => { try { await readFile(this.abs(STATE_FILE), 'utf8'); } catch (error) { @@ -315,15 +334,18 @@ export class TowerStore { } const state = await this.load(); return this.adoptForeignRoster(state, sessionId); + }); } async release(sessionId: string): Promise { + return this.exclusive(async () => { if (!(await this.isInitialized())) return; const state = await this.load(); if (state.sessionId !== sessionId) return; state.sessionId = undefined; await this.save(state); await this.appendLog(TOWER_NAME, 'release', { session: sessionId }); + }); } private async ensureGitExclude(): Promise { @@ -417,6 +439,7 @@ export class TowerStore { } async registerAgent(entry: TowerRosterEntry): Promise { + return this.exclusive(async () => { const state = await this.load(); if (entry.name.trim().length === 0 || entry.name.trim() !== entry.name) { throw new TowerProtocolError( @@ -438,6 +461,7 @@ export class TowerStore { } state.roster.agents.push(entry); await this.save(state); + }); } async markAgentDied( @@ -445,6 +469,7 @@ export class TowerStore { status: string, reason?: string, ): Promise { + return this.exclusive(async () => { const state = await this.load(); const index = state.roster.agents.findLastIndex((agent) => agent.agentId === agentId); const existing = state.roster.agents[index]; @@ -474,9 +499,11 @@ export class TowerStore { mission !== undefined ? join(MISSIONS_DIR, missionFileName(mission.id, mission.slug)) : undefined, ); return entry; + }); } async clearAgentDied(agentId: string): Promise { + return this.exclusive(async () => { const state = await this.load(); const index = state.roster.agents.findLastIndex((agent) => agent.agentId === agentId); const existing = state.roster.agents[index]; @@ -495,9 +522,11 @@ export class TowerStore { kind: entry.kind, }); return true; + }); } async plan(input: readonly TowerPlanInput[]): Promise { + return this.exclusive(async () => { if (input.length === 0) { throw new TowerProtocolError('TowerPlan needs at least one mission'); } @@ -578,6 +607,7 @@ export class TowerStore { MISSIONS_INDEX, ); return missions; + }); } private assertScopesDisjoint(missions: readonly TowerMission[]): void { @@ -614,6 +644,7 @@ export class TowerStore { patch: TowerMissionPatch, options: { readonly silent?: boolean } = {}, ): Promise { + return this.exclusive(async () => { const state = await this.load(); const mission = state.missions.find((m) => m.id === id); if (mission === undefined) { @@ -634,6 +665,7 @@ export class TowerStore { patch.blocker === undefined && patch.clearBlockers === undefined && patch.taskDone === undefined && + patch.taskDrop === undefined && patch.owner === undefined && patch.scope === undefined && patch.spawnBase === undefined; @@ -683,7 +715,9 @@ export class TowerStore { } if (patch.clearBlockers === true) mission.blockers = []; if (patch.taskDone !== undefined) { - const task = mission.tasks.find((t) => !t.done && t.text.includes(patch.taskDone!)); + const task = mission.tasks.find( + (t) => !t.done && t.dropped !== true && t.text.includes(patch.taskDone!), + ); if (task === undefined) { throw new TowerProtocolError( `mission ${id} has no open task matching "${patch.taskDone}"`, @@ -691,6 +725,29 @@ export class TowerStore { } task.done = true; } + let taskDropLog: string | undefined; + if (patch.taskDrop !== undefined) { + const reason = patch.taskDrop.reason?.trim() ?? ''; + if (reason.length === 0) { + throw new TowerProtocolError( + `dropping a task from mission ${id} requires a reason — the drop is the escape hatch for legitimately descoped work, and the reason is recorded in the mission notes and the activity log for audit`, + ); + } + const task = mission.tasks.find( + (t) => !t.done && t.dropped !== true && t.text.includes(patch.taskDrop!.text), + ); + if (task === undefined) { + throw new TowerProtocolError( + `mission ${id} has no open task matching "${patch.taskDrop.text}"`, + ); + } + task.dropped = true; + taskDropLog = `dropped task "${task.text}": ${reason}`; + mission.notes.push(taskDropLog); + } + if (patch.status === 'completed' && patch.blocker === undefined) { + await this.assertCompletable(state, mission); + } await this.save(state); await this.renderMissionsIndex(state); @@ -701,6 +758,7 @@ export class TowerStore { patch.note === undefined && patch.blocker === undefined && patch.clearBlockers === undefined && + patch.taskDrop === undefined && patch.owner === undefined && patch.scope === undefined && patch.spawnBase === undefined; @@ -710,12 +768,36 @@ export class TowerStore { status: patch.status, note: patch.note !== undefined ? 'added' : undefined, blocker: patch.blocker !== undefined ? 'added' : undefined, + task_drop: taskDropLog, owner: patch.owner, scope: patch.scope?.join(','), spawn_base: patch.spawnBase, }); } return mission; + }); + } + + private async assertCompletable(state: TowerState, mission: TowerMission): Promise { + const open = mission.tasks.filter((t) => !t.done && t.dropped !== true); + if (open.length > 0) { + throw new TowerProtocolError( + `mission ${mission.id} cannot transition to completed — ${String(open.length)} open task(s): ${open.map((t) => `"${t.text}"`).join(', ')}; tick finished tasks with task_done, or drop legitimately descoped ones with task_drop (a reason is mandatory and lands in the mission notes and the activity log)`, + ); + } + if (mission.kind === 'survey') return; + if (!(await branchExists(this.repoRoot, mission.branch))) { + throw new TowerProtocolError( + `mission ${mission.id} cannot transition to completed — its branch "${mission.branch}" does not exist, so no work has landed; a build mission must produce a diff on its branch: spawn a worker to do the work, or have the tower abandon the mission (status=abandoned) if it is no longer needed`, + ); + } + const base = await this.diffBase(state, mission); + const changed = await diffNameOnly(this.repoRoot, base, mission.branch); + if (changed.length === 0) { + throw new TowerProtocolError( + `mission ${mission.id} cannot transition to completed — branch "${mission.branch}" has no changes vs "${base}"; a build mission must produce a diff on its branch: commit the work there first, or if the work turned out unnecessary, have the tower abandon the mission (status=abandoned) instead`, + ); + } } async send(callerName: string, input: TowerSendInput): Promise { @@ -858,6 +940,7 @@ export class TowerStore { } async submitReview(callerName: string, input: TowerReviewInput): Promise { + return this.exclusive(async () => { const state = await this.load(); let callerEntry: TowerRosterEntry | undefined; if (callerName !== TOWER_NAME) { @@ -881,6 +964,11 @@ export class TowerStore { const existing = await this.reviewsFor(input.target); const myRounds = existing.filter((r) => r.reviewer === callerName).length; + if (myRounds >= MAX_REVIEW_ROUNDS) { + throw new TowerProtocolError( + `branch "${input.target}" has already been through ${String(MAX_REVIEW_ROUNDS)} review rounds by "${callerName}" — the rework loop is not converging, so another round from the same reviewer is refused; redirect instead: reassign the work (spawn a different worker or a fresh reviewer), split the mission into smaller pieces, or descope it (TowerMission status=abandoned)`, + ); + } const round = myRounds + 1; const seq = await this.nextReviewSeq(); const reviewedCommit = await branchTip(this.repoRoot, input.target); @@ -933,7 +1021,26 @@ export class TowerStore { }, rel, ); + if (input.status !== 'clean') { + const reworkMission = + reviewMissionId !== undefined + ? state.missions.find((m) => m.id === reviewMissionId) + : resolveMissionByBranch(state, input.target); + if (reworkMission !== undefined && reworkMission.status === 'completed') { + reworkMission.status = 'active'; + await this.save(state); + await this.renderMissionsIndex(state); + await this.renderMissionFile(reworkMission); + await this.appendLog( + callerName, + 'mission.rework', + { id: reworkMission.id, verdict: input.status }, + join(MISSIONS_DIR, missionFileName(reworkMission.id, reworkMission.slug)), + ); + } + } return rel; + }); } async reviewsFor(target: string): Promise { @@ -1013,6 +1120,7 @@ export class TowerStore { readonly conflictsWith: ReadonlyArray<{ readonly branch: string; readonly files: readonly string[] }>; readonly noop?: boolean; }> { + return this.exclusive(async () => { const state = await this.load(); const block = async (reason: string, message: string): Promise => { await this.appendLog(TOWER_NAME, 'merge.blocked', { branch, reason }); @@ -1154,6 +1262,7 @@ export class TowerStore { await this.renderMissionFile(mission); await this.appendLog(TOWER_NAME, 'merge', { branch, base: state.base, merge_commit: mergeCommit.slice(0, 7) }); return { mergeCommit, conflictsWith }; + }); } async diffBase(state: TowerState, mission: TowerMission): Promise { @@ -1313,7 +1422,10 @@ export class TowerStore { : []), '## Tasks', ...(mission.tasks.length > 0 - ? mission.tasks.map((t) => `- [${t.done ? 'x' : ' '}] ${t.text}`) + ? mission.tasks.map( + (t) => + `- [${t.done ? 'x' : t.dropped === true ? '-' : ' '}] ${t.text}${t.dropped === true ? ' (dropped)' : ''}`, + ) : ['- [ ] (no tasks recorded)']), '', '## Dependencies', diff --git a/packages/agent-core-v2/src/features/tower/protocol/types.ts b/packages/agent-core-v2/src/features/tower/protocol/types.ts index f01c52fed..ac031e2e4 100644 --- a/packages/agent-core-v2/src/features/tower/protocol/types.ts +++ b/packages/agent-core-v2/src/features/tower/protocol/types.ts @@ -34,6 +34,7 @@ export type TowerMissionKind = 'build' | 'survey'; export interface TowerMissionTask { text: string; done: boolean; + dropped?: boolean; } export interface TowerMission { diff --git a/packages/agent-core-v2/src/features/tower/tools/merge/merge.md b/packages/agent-core-v2/src/features/tower/tools/merge/merge.md index 8d0280997..da46a9f7c 100644 --- a/packages/agent-core-v2/src/features/tower/tools/merge/merge.md +++ b/packages/agent-core-v2/src/features/tower/tools/merge/merge.md @@ -3,3 +3,5 @@ Merge a tower mission branch into the base branch (--no-ff). Hard gate, enforced by the store — the merge is refused unless: the branch's latest review is "clean" and was written against the current branch tip, all dependency missions are already merged, and every changed file falls inside the mission's declared scope. The merge also refuses when every mission record for the branch is closed (abandoned or already merged) — a merge never flips a historical mission's state; if the work must land, re-plan it under a fresh mission title. The scope diff starts from the mission's recorded spawn base while that snapshot commit is still part of the branch's history, so base-checkout WIP captured as a snapshot commit at spawn time is never mistaken for a worker scope violation; once a rebase drops the snapshot (typically because the WIP has since been committed on the base branch), the diff falls back to the base branch. On refusal, the error message tells you exactly what to do next (assign a reviewer, wait for fixes, re-review a moved tip, merge deps first, widen the scope or revert the extra changes). After a merge, branches reported as conflicting must rebase onto the new base and be re-reviewed before they can merge. The main checkout must be clean for the files the merge touches: if it still has uncommitted changes in any file the merge would overwrite, the merge is refused and nothing is merged — commit or stash those changes first, then retry. This matters when a mission branch carries a snapshot of the checkout's WIP: that WIP merges into the base history, so the checkout must not still hold the same changes uncommitted. + +When this merge closes the last open mission, the result reports the workspace ready for TowerTeardown. diff --git a/packages/agent-core-v2/src/features/tower/tools/merge/mergeTool.ts b/packages/agent-core-v2/src/features/tower/tools/merge/mergeTool.ts index 8a1ff5dde..c08bbcb95 100644 --- a/packages/agent-core-v2/src/features/tower/tools/merge/mergeTool.ts +++ b/packages/agent-core-v2/src/features/tower/tools/merge/mergeTool.ts @@ -33,11 +33,21 @@ export class TowerMergeTool implements ITowerMergeTool { runTowerTool(async () => { const store = newTowerStore(this.sessionContext); const { mergeCommit, conflictsWith, noop } = await store.merge(args.branch); + const after = await store.load(); + const allClosed = + after.missions.length > 0 && + after.missions.every( + (mission) => mission.status === 'merged' || mission.status === 'abandoned', + ); + const teardownHint = + 'Every mission is now merged or abandoned — ready for TowerTeardown (branches and .tower/comms/ are kept; dirty worktrees are protected).'; if (noop === true) { return { output: [ `${args.branch} is a read-only survey with a zero-diff branch — mission marked merged, no git merge needed.`, - 'Continue with the remaining missions in Dependency Flow order.', + allClosed + ? teardownHint + : 'Continue with the remaining missions in Dependency Flow order.', ].join('\n'), }; } @@ -54,6 +64,8 @@ export class TowerMergeTool implements ITowerMergeTool { ), 'Tell each affected worker (Agent resume with run_in_background=true — never foreground: their output flows back through the tower protocol files) to rebase onto the updated base, resolve, push, and request a re-review.', ); + } else if (allClosed) { + lines.push(`The mission is now marked merged. ${teardownHint}`); } else { lines.push('The mission is now marked merged. Continue with the remaining missions in Dependency Flow order.'); } diff --git a/packages/agent-core-v2/src/features/tower/tools/mission/mission.md b/packages/agent-core-v2/src/features/tower/tools/mission/mission.md index b8a605307..73b37d862 100644 --- a/packages/agent-core-v2/src/features/tower/tools/mission/mission.md +++ b/packages/agent-core-v2/src/features/tower/tools/mission/mission.md @@ -1,5 +1,7 @@ Read or update a tower mission. -With only an id, returns the mission view (status, tasks, blockers, notes). With patch fields, applies them: workers may only update the mission they own — the store rejects anything else. Use task_done to tick checklist items, note to log decisions, blocker when stuck (the tower watches for blocked missions). +With only an id, returns the mission view (status, tasks, blockers, notes). With patch fields, applies them: workers may only update the mission they own — the store rejects anything else. Use task_done to tick checklist items, task_drop (with task_drop_reason) to drop a legitimately descoped task — the reason is recorded in the mission notes and the activity log — note to log decisions, blocker when stuck (the tower watches for blocked missions). + +Status lifecycle: planned → active → completed → merged. "completed" means awaiting review, not done — the branch can still be sent back for rework: when a review with a non-clean verdict lands on the mission's branch, the store flips a completed mission back to active automatically (merged never flips; planned, blocked, and paused are left alone). Only "merged" is final. The store refuses the transition to completed while the mission still has open (neither done nor dropped) tasks — the error lists them — and, for build missions, while the mission branch has no diff vs its base; survey missions are exempt from the diff check. Tower only: status=abandoned gives a mission up without merging — its scope stops reserving files for TowerPlan, its dependents may merge, and its branch drops out of conflict checks. Use it for stale missions carried over from a previous session, or for work that will not land; abandoned missions stay in MISSIONS.md (🚫) as the audit trail. diff --git a/packages/agent-core-v2/src/features/tower/tools/mission/mission.ts b/packages/agent-core-v2/src/features/tower/tools/mission/mission.ts index 61a8ac5a5..8016934cc 100644 --- a/packages/agent-core-v2/src/features/tower/tools/mission/mission.ts +++ b/packages/agent-core-v2/src/features/tower/tools/mission/mission.ts @@ -19,6 +19,16 @@ export const TowerMissionToolInputSchema = z .string() .optional() .describe('Mark the first open task containing this text as done'), + task_drop: z + .string() + .optional() + .describe( + 'Mark the first open task containing this text as dropped — the escape hatch for legitimately descoped tasks; requires task_drop_reason and is recorded in the mission notes and the activity log', + ), + task_drop_reason: z + .string() + .optional() + .describe('Mandatory with task_drop: why the task is legitimately descoped'), scope: z .array(z.string()) .optional() diff --git a/packages/agent-core-v2/src/features/tower/tools/mission/missionTool.ts b/packages/agent-core-v2/src/features/tower/tools/mission/missionTool.ts index 6f386bb81..2f76e2293 100644 --- a/packages/agent-core-v2/src/features/tower/tools/mission/missionTool.ts +++ b/packages/agent-core-v2/src/features/tower/tools/mission/missionTool.ts @@ -34,6 +34,7 @@ export class TowerMissionTool implements ITowerMissionTool { args.blocker !== undefined || args.clear_blockers !== undefined || args.task_done !== undefined || + args.task_drop !== undefined || args.scope !== undefined; return { description: hasPatch @@ -62,11 +63,15 @@ export class TowerMissionTool implements ITowerMissionTool { blocker: args.blocker, clearBlockers: args.clear_blockers, taskDone: args.task_done, + taskDrop: + args.task_drop === undefined + ? undefined + : { text: args.task_drop, reason: args.task_drop_reason }, scope: args.scope, }); return { output: [ - `mission ${mission.id} updated — status: ${mission.status}, open tasks: ${String(mission.tasks.filter((t) => !t.done).length)}, blockers: ${String(mission.blockers.length)}`, + `mission ${mission.id} updated — status: ${mission.status}, open tasks: ${String(mission.tasks.filter((t) => !t.done && t.dropped !== true).length)}, blockers: ${String(mission.blockers.length)}`, '', await renderMission(store, mission), ].join('\n'), diff --git a/packages/agent-core-v2/src/features/tower/tools/review/review.md b/packages/agent-core-v2/src/features/tower/tools/review/review.md index 35cf7c0be..df8841ee5 100644 --- a/packages/agent-core-v2/src/features/tower/tools/review/review.md +++ b/packages/agent-core-v2/src/features/tower/tools/review/review.md @@ -1,3 +1,5 @@ Submit a review verdict for a branch you were assigned to review (via TowerSpawn review_target). The review is stamped with the current branch tip — if the branch moves afterwards, the tower must ask for a re-review before merging. Only reviewers assigned to the target (or the tower) may submit; the round number is assigned automatically. + +The submission result routes the next step: on a non-clean verdict it names the roster worker to resume (with this review file) so the findings get fixed and re-reviewed; on a clean verdict it reports the branch merge-ready for TowerMerge. diff --git a/packages/agent-core-v2/src/features/tower/tools/review/reviewTool.ts b/packages/agent-core-v2/src/features/tower/tools/review/reviewTool.ts index 764434bc9..2fe7dd109 100644 --- a/packages/agent-core-v2/src/features/tower/tools/review/reviewTool.ts +++ b/packages/agent-core-v2/src/features/tower/tools/review/reviewTool.ts @@ -1,4 +1,5 @@ import { IAgentScopeContext, agentContextOfScope } from '#/agent/scopeContext/scopeContext'; +import { resolveMissionByBranch } from '#/features/tower/protocol/index'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; import { ISessionUsageService } from '#/session/usage/sessionUsage'; import { toInputJsonSchema } from '#/tool/input-schema'; @@ -42,9 +43,28 @@ export class TowerReviewTool implements ITowerReviewTool { decision: args.decision, token_count: callerTokenCount(this.usage, agentContextOfScope(this.scopeContext)), }); - return { - output: `review submitted: ${rel}\nAlso notify the branch author (or the tower) with TowerSend so the verdict is seen.`, - }; + const lines = [`review submitted: ${rel}`]; + if (args.status === 'clean') { + lines.push( + `next: ${args.target} is merge-ready — the tower can TowerMerge it in Dependency Flow order.`, + ); + } else { + const owner = resolveMissionByBranch(state, args.target)?.owner; + const worker = owner === undefined ? undefined : store.findAgent(state, owner); + if (owner !== undefined && worker !== undefined) { + lines.push( + `next: resume ${owner} with this review file (${rel}): Agent(resume="${worker.agentId}", run_in_background=true, prompt="...") — never foreground: its output flows back through the tower protocol files. The branch must be fixed and re-reviewed before it can merge.`, + ); + } else { + lines.push( + `next: no worker on record owns ${args.target} — route this review file (${rel}) through the tower so it can reassign the fixes.`, + ); + } + } + lines.push( + 'Also notify the branch author (or the tower) with TowerSend so the verdict is seen.', + ); + return { output: lines.join('\n') }; }), }; } diff --git a/packages/agent-core-v2/src/features/tower/tools/spawn/spawn.md b/packages/agent-core-v2/src/features/tower/tools/spawn/spawn.md index 4ac0ffabe..25aff42ae 100644 --- a/packages/agent-core-v2/src/features/tower/tools/spawn/spawn.md +++ b/packages/agent-core-v2/src/features/tower/tools/spawn/spawn.md @@ -2,6 +2,8 @@ Spawn a tower worker or reviewer as a background subagent and register it in the Workers: pass mission_id — the tool creates the mission worktree, marks the mission active with this worker as owner, and briefs the agent with the full mission text. Reviewers: pass review_target — when the branch belongs to a mission, the briefing carries the full mission text (title, tasks, and any verbatim user context) plus the author's own review-request when one is on file, so the review verifies intent against the mission, not only code health; the agent must submit its verdict via TowerReview. +When the branch already has history, the briefing carries it too: a worker respawned onto a reviewed branch gets the latest review round (verdict, findings, decision) and the previous worker's review-request, so rework continues from the verdict instead of starting cold; a reviewer gets the branch's earlier review rounds, so repeat findings are verified against the current tip rather than reported again. First spawns have no history sections. Note that a non-clean verdict flips a completed mission back to active — "completed" means awaiting review; only "merged" is final. + If the base checkout has uncommitted changes (staged, unstaged, or untracked) when a worker spawns, the tool captures them as a snapshot commit that becomes the mission branch's first commit — the worker starts from HEAD + that WIP instead of plain HEAD. The checkout itself is never touched (nothing is committed, staged, or stashed there), and the merge gate later diffs the branch from that snapshot while it remains part of the branch's history (falling back to the base branch once a rebase drops the snapshot commit), so the WIP is never mistaken for the worker's own scope. Snapshotting requires the main checkout to be on the recorded base branch: WIP sitting on a different branch (or a detached HEAD) belongs to that line of work, so the spawn is refused rather than mixing that content into the base — switch back to the base or commit/stash first. The snapshot only happens when the branch is first created; re-adding an existing branch reuses it as-is. The briefing prompt is assembled by this tool (worktree path, scope, protocol rules); use instructions only for extra context. If the name is already registered, resume the existing agent with Agent(resume=..., run_in_background=true, prompt="...") instead of spawning a duplicate — never foreground: you never need the agent's return value inline; its output flows back through the tower protocol files. diff --git a/packages/agent-core-v2/src/features/tower/tools/spawn/spawnTool.ts b/packages/agent-core-v2/src/features/tower/tools/spawn/spawnTool.ts index 45490a1dd..52c4ac304 100644 --- a/packages/agent-core-v2/src/features/tower/tools/spawn/spawnTool.ts +++ b/packages/agent-core-v2/src/features/tower/tools/spawn/spawnTool.ts @@ -16,8 +16,10 @@ import { WORKTREES_DIR, isReservedTowerAgentName, missionFileName, + parseFrontmatter, resolveMissionByBranch, resolveTowerRepoRoot, + type TowerInboxItem, type TowerMission, type TowerState, } from '#/features/tower/protocol/index'; @@ -53,6 +55,27 @@ import DESCRIPTION from './spawn.md?raw'; type SubagentBinding = ReturnType; const REVIEW_REQUEST_SCAN_LIMIT = 50; +const REVIEW_HISTORY_ROUNDS = 5; +const REVIEW_EXCERPT_MAX_CHARS = 8000; + +function truncateSection(text: string, maxChars: number): string { + if (text.length <= maxChars) return text; + return `${text.slice(0, maxChars)}\n…(truncated)`; +} + +async function reviewExcerpt(store: TowerStore, file: string): Promise { + const { body } = parseFrontmatter(await readFile(store.abs(file), 'utf8')); + return truncateSection(body.trim(), REVIEW_EXCERPT_MAX_CHARS); +} + +async function findReviewRequest( + store: TowerStore, + author: string, +): Promise { + return (await store.readInbox(TOWER_NAME, REVIEW_REQUEST_SCAN_LIMIT)).find( + (item) => item.from === author && item.subject.startsWith('review-request'), + ); +} export class TowerSpawnTool implements ITowerSpawnTool { declare readonly _serviceBrand: undefined; @@ -401,7 +424,7 @@ export class TowerSpawnTool implements ITowerSpawnTool { (mission.spawnBase !== undefined ? `- Your branch starts from snapshot commit ${mission.spawnBase.slice(0, 7)}: the base checkout's uncommitted changes (WIP), captured at spawn so you can build on them. That commit is your foundation — never revert, amend, or claim it as your own work; your own commits go on top of it.\n` : '') + - `- Your working directory is the main checkout, NOT your worktree — address the worktree explicitly: every Read/Write/Edit/Grep/Glob path must be absolute and under ${worktreeAbs}, and every Bash command must \`cd ${worktreeAbs}\` first. A permission guard hard-denies any Write/Edit outside it. Never touch the main checkout (${store.repoRoot}) or another agent's worktree slot.\n` + + `- Your working directory is the main checkout, NOT your worktree — address the worktree explicitly: every Read/Write/Edit/Grep/Glob path must be absolute and under ${worktreeAbs}, and every Bash command must \`cd ${worktreeAbs}\` first. A permission guard hard-denies any Write/Edit outside it; reads are unrestricted — you may read the main checkout (${store.repoRoot}) or another agent's worktree when coordination calls for it, but write only inside your own.\n` + (mission.kind === 'survey' ? `- Scope — what you investigate (read-only; reserves nothing): ${mission.scope.join(', ')}\n\n` : `- Scope — the only files you may change: ${mission.scope.join(', ')}\n\n`); @@ -424,10 +447,12 @@ export class TowerSpawnTool implements ITowerSpawnTool { extra ); } + const historySection = await this.workerHistorySection(store, mission, args.name); return ( `You are "${args.name}", a tower worker agent in a multi-agent workspace.\n\n` + workplace + `# Your mission\n\n${missionText.trim()}\n\n` + + historySection + `# Communication protocol\n` + '- Coordinate through tower tools ONLY: TowerSend / TowerInbox / TowerFinding / TowerMission / TowerStatus. Reach the tower and sibling agents with TowerSend; check TowerInbox regularly.\n' + '- NEVER create or edit files under `.tower/` by hand — the tools are the only writers; hand-written protocol files break the merge gate.\n' + @@ -435,7 +460,7 @@ export class TowerSpawnTool implements ITowerSpawnTool { '- Keep your mission current with TowerMission: task_done as you finish tasks, note for decisions, blocker when stuck.\n' + '- Ambiguity is escalated, not guessed: if the mission and its Context leave substantive doubt about what to build, TowerSend(to="tower", subject="clarify-request", body=what needs pinning down) BEFORE acting — the tower relays to the human; you never ask the user directly.\n\n' + `# When the mission is done\n` + - '1. `git add` + `git commit` everything in your worktree (and `git push` only if a remote is configured).\n' + + "1. `git add` + `git commit` your mission's changes in the worktree (source files only — no build outputs).\n" + `2. Mark the mission completed: TowerMission(id="${mission.id}", status="completed").\n` + '3. Request review: TowerSend(to="tower", subject="review-request", body=what you changed and why, reconciled against the mission tasks item by item — the reviewer maps each task to your diff).\n' + '4. Finish with a structured final summary: files changed, key decisions, open follow-ups.' + @@ -455,16 +480,12 @@ export class TowerSpawnTool implements ITowerSpawnTool { ) ).trim()}\n\n` : ''; - const reviewRequest = - author !== undefined - ? (await store.readInbox(TOWER_NAME, REVIEW_REQUEST_SCAN_LIMIT)).find( - (item) => item.from === author && item.subject.startsWith('review-request'), - ) - : undefined; + const reviewRequest = author !== undefined ? await findReviewRequest(store, author) : undefined; const selfReportSection = reviewRequest !== undefined ? `# The author's own account (their review-request to the tower)\n${reviewRequest.body.trim()}\n\n` : ''; + const historySection = await this.reviewHistorySection(store, target); const checklist = targetMission !== undefined ? '1. Intent — does the diff deliver the mission above? Map every task to the changes; healthy code that answers the wrong requirement or silently drops a task is a finding, not a pass.\n2. Security\n3. Data integrity\n4. Performance\n5. Error handling\n6. Code quality\n\n' @@ -477,6 +498,7 @@ export class TowerSpawnTool implements ITowerSpawnTool { '- Do NOT modify any code, and never create or edit files under `.tower/` by hand — protocol artifacts go through the tower tools.\n\n' + missionSection + selfReportSection + + historySection + `# Review checklist (in priority order)\n` + checklist + `# When done — both steps are mandatory\n` + @@ -488,4 +510,57 @@ export class TowerSpawnTool implements ITowerSpawnTool { extra ); } + + private async workerHistorySection( + store: TowerStore, + mission: TowerMission, + agentName: string, + ): Promise { + const latest = await store.latestReview(mission.branch); + const predecessor = + mission.owner !== undefined && mission.owner !== agentName ? mission.owner : undefined; + const reviewRequest = + predecessor !== undefined ? await findReviewRequest(store, predecessor) : undefined; + if (latest === undefined && reviewRequest === undefined) return ''; + const parts = [ + '# Previous work on this branch', + 'An earlier worker already ran on this branch — continue from its work instead of starting over, and address the review verdict below rather than re-opening what it already settled.', + ]; + if (latest !== undefined) { + parts.push( + `## Latest review — round ${String(latest.round)} by ${latest.reviewer}: ${latest.status}, merge verdict "${latest.merge}"`, + await reviewExcerpt(store, latest.file), + ); + } + if (reviewRequest !== undefined) { + parts.push( + "## The previous worker's review-request to the tower", + truncateSection(reviewRequest.body.trim(), REVIEW_EXCERPT_MAX_CHARS), + ); + } + return `${parts.join('\n\n')}\n\n`; + } + + private async reviewHistorySection(store: TowerStore, target: string): Promise { + const reviews = await store.reviewsFor(target); + if (reviews.length === 0) return ''; + const recent = reviews.slice(-REVIEW_HISTORY_ROUNDS); + const omitted = reviews.length - recent.length; + const parts = [ + '# Review history on this branch', + 'Earlier review rounds already ran on this branch — verify their findings against the current tip instead of reporting them again; re-report only what still reproduces.', + ]; + if (omitted > 0) { + parts.push( + `(${String(omitted)} earlier round(s) omitted — the full record lives in .tower/comms/reviews/.)`, + ); + } + for (const review of recent) { + parts.push( + `## Round ${String(review.round)} by ${review.reviewer}: ${review.status}, merge verdict "${review.merge}"`, + await reviewExcerpt(store, review.file), + ); + } + return `${parts.join('\n\n')}\n\n`; + } } diff --git a/packages/agent-core-v2/src/features/tower/tools/status/status.md b/packages/agent-core-v2/src/features/tower/tools/status/status.md index 25ea7bb71..22e9bb461 100644 --- a/packages/agent-core-v2/src/features/tower/tools/status/status.md +++ b/packages/agent-core-v2/src/features/tower/tools/status/status.md @@ -1 +1 @@ -Show the tower dashboard: missions (status/owner), the agent roster, the review-gate state of every unmerged branch (latest review round/status and whether the reviewed commit still matches the branch tip), your inbox message count, and the last activity log lines. +Show the tower dashboard: missions (status/owner), the agent roster, the review-gate state of every unmerged branch (latest review round/status and whether the reviewed commit still matches the branch tip), your inbox message count, and the last activity log lines. Missions that are planned but have no spawned worker yet are called out in a dedicated Awaiting spawn section so the tower cannot miss launching them. diff --git a/packages/agent-core-v2/src/features/tower/tools/status/statusTool.ts b/packages/agent-core-v2/src/features/tower/tools/status/statusTool.ts index 69695e52f..21359a0e8 100644 --- a/packages/agent-core-v2/src/features/tower/tools/status/statusTool.ts +++ b/packages/agent-core-v2/src/features/tower/tools/status/statusTool.ts @@ -58,6 +58,7 @@ export class TowerStatusTool implements ITowerStatusTool { '## Missions', '', ...renderMissions(state), + ...renderUnspawnedMissions(state), ...renderDeathWarnings(state), '', '## Roster', @@ -176,6 +177,20 @@ function renderRoster(state: TowerState): string[] { }); } +function renderUnspawnedMissions(state: TowerState): string[] { + const pending = state.missions.filter((m) => m.status === 'planned' && m.owner === undefined); + if (pending.length === 0) return []; + return [ + '', + '## Awaiting spawn', + '', + ...pending.map( + (m) => + `- ${m.id} (${m.branch}) — planned but no worker spawned yet: launch one with TowerSpawn(kind="worker", mission_id="${m.id}", name="...")`, + ), + ]; +} + function renderDeathWarnings(state: TowerState): string[] { const deadByName = new Map( state.roster.agents.filter((a) => a.diedAt !== undefined).map((a) => [a.name, a]), diff --git a/packages/agent-core-v2/src/features/tower/towerService.ts b/packages/agent-core-v2/src/features/tower/towerService.ts index e7c0181b7..3c7ece2b8 100644 --- a/packages/agent-core-v2/src/features/tower/towerService.ts +++ b/packages/agent-core-v2/src/features/tower/towerService.ts @@ -178,6 +178,20 @@ export class AgentTowerService extends Disposable implements IAgentTowerService ); }), ); + this._register( + toolExecutor.onBeforeExecuteTool((event) => { + if (!this.flags.enabled(TOWER_FLAG_ID)) return; + if (!this.isActive) return; + if (event.toolCall.name !== 'AgentDynamicWorkflow') return; + event.veto( + denyToolExecution( + this.toolApproval.formatDenyMessage( + 'AgentDynamicWorkflow is not available while tower mode is active — dynamic_workflow and tower modes are mutually exclusive, and the tower fleet runs through TowerSpawn, one mission per worker in its own worktree. If the work genuinely needs a dynamic_workflow instead, exit tower mode first.', + ), + ), + ); + }), + ); this._register( toolExecutor.onBeforeExecuteTool(async (event) => { if (!this.flags.enabled(TOWER_FLAG_ID)) return; diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index c572c848b..f83e5fbf2 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -178,6 +178,8 @@ export * from '#/session/sessionActivity/sessionOutcomeMirrorService'; export * from '#/session/sessionTitle/agentTitlePromptSource'; import '#/session/sessionTitle/agentTitlePromptSourceService'; export * from '#/session/sessionTitle/sessionTitle'; +import '#/session/sessionTitle/configSection'; +export * from '#/session/sessionTitle/configSection'; export * from '#/session/sessionTitle/sessionTitleService'; export * from '#/session/sessionToolPolicy/sessionToolPolicy'; export * from '#/session/sessionToolPolicy/sessionToolPolicyService'; diff --git a/packages/agent-core-v2/src/mcpCore/oauth/service.ts b/packages/agent-core-v2/src/mcpCore/oauth/service.ts index cae78e863..a307c1aa9 100644 --- a/packages/agent-core-v2/src/mcpCore/oauth/service.ts +++ b/packages/agent-core-v2/src/mcpCore/oauth/service.ts @@ -1,4 +1,8 @@ -import { auth, type OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'; +import { + auth, + discoverOAuthServerInfo, + type OAuthClientProvider, +} from '@modelcontextprotocol/sdk/client/auth.js'; import type { OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js'; import type { ILogger as Logger } from '#/_base/log/log'; @@ -93,6 +97,7 @@ const REFRESH_AHEAD_MS = 120_000; const MAX_TIMER_DELAY_MS = 0x7fffffff; const DEFAULT_AUTH_REQUEST_TIMEOUT_MS = 30_000; const DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS = 30_000; +const OFFLINE_ACCESS_SCOPE = 'offline_access'; const defaultScheduler: McpOAuthScheduler = { now: () => Date.now(), @@ -290,6 +295,44 @@ export class McpOAuthService { }) as typeof fetch; } + private async resolveRequestScope( + provider: McpOAuthClientProvider, + serverUrl: string | URL, + signal: AbortSignal, + ): Promise { + let discovery = await provider.discoveryState(); + if (discovery?.authorizationServerMetadata === undefined) { + try { + const info = await discoverOAuthServerInfo(serverUrl, { + fetchFn: this.authFetch(provider, [signal]), + }); + const cachedServer = discovery?.authorizationServerUrl; + const keepCachedServer = info.resourceMetadata === undefined && cachedServer !== undefined; + discovery = { + ...discovery, + authorizationServerUrl: keepCachedServer ? cachedServer : info.authorizationServerUrl, + resourceMetadata: info.resourceMetadata ?? discovery?.resourceMetadata, + authorizationServerMetadata: info.authorizationServerMetadata, + }; + await provider.saveDiscoveryState(discovery); + } catch { + return undefined; + } + } + const advertised = discovery.authorizationServerMetadata?.scopes_supported; + if (advertised === undefined || !advertised.includes(OFFLINE_ACCESS_SCOPE)) return undefined; + const resourceScopes = discovery.resourceMetadata?.scopes_supported; + const configuredScopes = provider.clientMetadata.scope + ?.split(/\s+/) + .filter((scope) => scope.length > 0); + const base = + resourceScopes !== undefined && resourceScopes.length > 0 + ? resourceScopes + : (configuredScopes ?? []); + if (base.includes(OFFLINE_ACCESS_SCOPE)) return undefined; + return [...base, OFFLINE_ACCESS_SCOPE].join(' '); + } + async beginAuthorization( serverName: string, serverUrl: string | URL, @@ -360,6 +403,7 @@ export class McpOAuthService { provider.setRedirectUrl(new URL(callbackServer.redirectUri)); await provider.ready; await provider.invalidateStaleRegistration(callbackServer.redirectUri); + const requestScope = await this.resolveRequestScope(provider, serverUrl, signal); let tokensSaved = false; const unsubscribeTokensSaved = this.onEvent((event) => { if ( @@ -373,6 +417,7 @@ export class McpOAuthService { try { const result = await auth(provider as OAuthClientProvider, { serverUrl, + scope: requestScope, fetchFn: this.authFetch(provider, [signal]), }); if (result !== 'REDIRECT') { diff --git a/packages/agent-core-v2/src/persistence/backends/node-fs/projectLocalConfigService.ts b/packages/agent-core-v2/src/persistence/backends/node-fs/projectLocalConfigService.ts index 5bf608503..54892c2ed 100644 --- a/packages/agent-core-v2/src/persistence/backends/node-fs/projectLocalConfigService.ts +++ b/packages/agent-core-v2/src/persistence/backends/node-fs/projectLocalConfigService.ts @@ -7,10 +7,12 @@ import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IProjectLocalConfigService, type ProjectAdditionalDirsLoadResult, + type ProjectAdditionalDirsLocation, } from '#/app/projectLocalConfig/projectLocalConfig'; import { ErrorCodes, Error2, unwrapErrorCause } from '#/errors'; import { IHostFileSystem } from '#/os/interface/hostFileSystem'; import { StorageError, StorageErrors, toStorageIoError } from '#/persistence/interface/storage'; +import { isWithinDirectory } from '#/tool/path-access'; const ProjectLocalTomlSchema = z.object({ workspace: z @@ -35,9 +37,13 @@ export class FileProjectLocalConfigService implements IProjectLocalConfigService @IHostFileSystem private readonly fs: IHostFileSystem, ) {} - async readAdditionalDirs(workDir: string): Promise { + async locateAdditionalDirsConfig(workDir: string): Promise { const projectRoot = await this.findProjectRoot(workDir); - const configPath = this.getProjectLocalConfigPath(projectRoot); + return { projectRoot, configPath: this.getProjectLocalConfigPath(projectRoot) }; + } + + async readAdditionalDirs(workDir: string): Promise { + const { projectRoot, configPath } = await this.locateAdditionalDirsConfig(workDir); const file = await this.readProjectLocalToml(configPath); const additionalDirs = file?.parsed.workspace?.additional_dir; @@ -65,7 +71,10 @@ export class FileProjectLocalConfigService implements IProjectLocalConfigService const additionalDir = await this.resolveAdditionalDir(workDir, inputPath); const file = (await this.readProjectLocalToml(configPath)) ?? { raw: {}, parsed: {} }; const fileAdditionalDirs = file.parsed.workspace?.additional_dir ?? []; - const fileExistingDirs = this.resolveExistingAdditionalDirs(projectRoot, fileAdditionalDirs); + const fileExistingDirs = await this.resolveExistingAdditionalDirs( + projectRoot, + fileAdditionalDirs, + ); if (this.hasSameAdditionalDir(fileExistingDirs, additionalDir)) { return { projectRoot, configPath, additionalDirs: fileExistingDirs }; @@ -153,14 +162,14 @@ export class FileProjectLocalConfigService implements IProjectLocalConfigService return resolvedDirs; } - private resolveExistingAdditionalDirs( + private async resolveExistingAdditionalDirs( projectRoot: string, additionalDirs: readonly string[], - ): string[] { + ): Promise { const resolvedDirs: string[] = []; for (const additionalDir of normalizeAdditionalDirs(additionalDirs)) { - const resolvedDir = this.resolvePath(projectRoot, additionalDir); + const resolvedDir = await this.resolvePath(projectRoot, additionalDir); if (this.hasSameAdditionalDir(resolvedDirs, resolvedDir)) continue; resolvedDirs.push(resolvedDir); } @@ -173,14 +182,38 @@ export class FileProjectLocalConfigService implements IProjectLocalConfigService additionalDir: string, ): Promise { const normalizedInput = normalizeAdditionalDirInput(additionalDir); - const resolvedDir = this.resolvePath(baseDir, normalizedInput); + const resolvedDir = await this.resolvePath(baseDir, normalizedInput); await this.assertDirectory(resolvedDir); return resolvedDir; } - private resolvePath(baseDir: string, additionalDir: string): string { + private async resolvePath(baseDir: string, additionalDir: string): Promise { const expanded = this.expandHome(additionalDir); - return isAbsolute(expanded) ? normalize(expanded) : resolve(baseDir, expanded); + const resolvedDir = isAbsolute(expanded) ? normalize(expanded) : resolve(baseDir, expanded); + if (await this.isBroadScopeDir(resolvedDir)) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + 'workspace.additional_dir must not be the user home directory or the filesystem root', + ); + } + return resolvedDir; + } + + private async isBroadScopeDir(resolvedDir: string): Promise { + const homeDir = normalize(this.bootstrap.osHomeDir); + if (dirname(resolvedDir) === resolvedDir) return true; + const realDir = await this.realpathOrLexical(resolvedDir); + if (dirname(realDir) === realDir) return true; + const realHome = await this.realpathOrLexical(homeDir); + return isWithinDirectory(homeDir, resolvedDir) || isWithinDirectory(realHome, realDir); + } + + private async realpathOrLexical(path: string): Promise { + try { + return normalize(await this.fs.realpath(path)); + } catch { + return path; + } } private expandHome(value: string): string { diff --git a/packages/agent-core-v2/src/program/program.ts b/packages/agent-core-v2/src/program/program.ts index d8339e779..a12636855 100644 --- a/packages/agent-core-v2/src/program/program.ts +++ b/packages/agent-core-v2/src/program/program.ts @@ -279,11 +279,11 @@ export class Program { try { const state = own(new WorkspaceStateService(this.dependencies.appState)); const localConfig = new FileProjectLocalConfigService(this.dependencies.bootstrap, runtime.fs!); - const dirs = own(new WorkspaceDirsService(this.context, localConfig, this.dependencies.log, state)); + const trust = own(new WorkspaceTrustService(this.context, this.dependencies.docs, state, this.dependencies.telemetry)); + const dirs = own(new WorkspaceDirsService(this.context, localConfig, this.dependencies.log, state, trust)); const git = new WorkspaceGitService(this.context, this.dependencies.git); const fs = new WorkspaceFsService(this.context, dirs, runtime.fs!, this.resolver, this.dependencies.telemetry, git); const instructions = own(new WorkspaceInstructionsService(this.context, runtime.fs!, runtime.environment, this.dependencies.bootstrap, this.dependencies.log, state)); - const trust = own(new WorkspaceTrustService(this.context, this.dependencies.docs, state, this.dependencies.telemetry)); const mcpConfig = own(new WorkspaceMcpConfigService(this.context, this.dependencies.bootstrap, this.dependencies.plugins, this.dependencies.log, this.dependencies.config, runtime.fs!, trust, this.dependencies.configStore)); const mcp = own(new WorkspaceMcpService(this.context, this.resolver, mcpConfig, this.dependencies.oauth, this.dependencies.log, this.dependencies.telemetry, this.dependencies.identity, this.dependencies.sessionManager)); const userAgentProfiles = own(new UserAgentProfileLoaderService(this.dependencies.bootstrap, runtime.fs!, this.dependencies.log, this.dependencies.builtinAgentProfiles, this.context, this.dependencies.agentProfiles)); diff --git a/packages/agent-core-v2/src/session/agentLifecycle/profile/gitContext.ts b/packages/agent-core-v2/src/session/agentLifecycle/profile/gitContext.ts index bf6a32e57..d9356f65a 100644 --- a/packages/agent-core-v2/src/session/agentLifecycle/profile/gitContext.ts +++ b/packages/agent-core-v2/src/session/agentLifecycle/profile/gitContext.ts @@ -1,7 +1,5 @@ -import type { Readable } from 'node:stream'; - import type { ILogger } from '#/_base/log/log'; -import type { IHostProcess, IHostProcessService } from '#/os/interface/hostProcess'; +import type { IGitService, RunGitResult } from '#/app/git/git'; const GIT_TIMEOUT_MS = 5_000; const MAX_DIRTY_FILES = 20; @@ -16,26 +14,17 @@ const ALLOWED_HOSTS = [ 'git.sr.ht', ] as const; -type GitFailure = - | { readonly kind: 'timeout' } - | { readonly kind: 'spawn-error' } - | { readonly kind: 'command-failed'; readonly exitCode?: number; readonly stderr?: string }; - -type GitResult = - | { readonly ok: true; readonly stdout: string } - | ({ readonly ok: false } & GitFailure); - -type TaggedGitResult = { readonly args: readonly string[]; readonly result: GitResult }; +type TaggedGitResult = { readonly args: readonly string[]; readonly result: RunGitResult }; export async function collectGitContext( - process: IHostProcessService, + git: IGitService, cwd: string, log?: ILogger, ): Promise { const revParseArgs = ['rev-parse', '--is-inside-work-tree'] as const; - const revParse = await runGit(process, cwd, revParseArgs); - if (!revParse.ok) { - if (revParse.kind === 'command-failed' && isNotARepo(revParse.stderr)) { + const revParse = await git.runGit(cwd, revParseArgs, { timeoutMs: GIT_TIMEOUT_MS }); + if (revParse.exitCode !== 0) { + if (isNotARepo(revParse.stderr)) { return ``; } logGitFailure(cwd, revParseArgs, revParse, log); @@ -49,11 +38,14 @@ export async function collectGitContext( ['log', '-3', '--format=%h %s'], ] as const; const [remote, branch, status, gitLog] = (await Promise.all( - commandArgs.map(async (args) => ({ args, result: await runGit(process, cwd, args) })), + commandArgs.map(async (args) => ({ + args, + result: await git.runGit(cwd, args, { timeoutMs: GIT_TIMEOUT_MS }), + })), )) as unknown as [TaggedGitResult, TaggedGitResult, TaggedGitResult, TaggedGitResult]; for (const { args, result } of [remote, branch, status, gitLog]) { - if (!result.ok) logGitFailure(cwd, args, result, log); + if (result.exitCode !== 0) logGitFailure(cwd, args, result, log); } const remoteUrl = stdoutOf(remote.result); @@ -135,94 +127,30 @@ function tryUrlPath(remoteUrl: string): string | null { } } -function stdoutOf(result: GitResult): string { - return result.ok ? result.stdout : ''; +function stdoutOf(result: RunGitResult): string { + return result.exitCode === 0 ? result.stdout.trim() : ''; } -function isNotARepo(stderr: string | undefined): boolean { - return stderr !== undefined && stderr.includes('not a git repository'); +function isNotARepo(stderr: string): boolean { + return stderr.includes('not a git repository'); } function logGitFailure( cwd: string, args: readonly string[], - failure: GitFailure, + result: RunGitResult, log?: ILogger, ): void { if (log === undefined) return; const command = `git ${args.join(' ')}`; - if (failure.kind === 'timeout') { - log.debug('git context command timed out', { cwd, command }); - } else if (failure.kind === 'spawn-error') { - log.warn('git context command failed to spawn', { cwd, command }); + if (result.exitCode === -1) { + log.warn('git context command failed to spawn', { cwd, command, stderr: result.stderr }); } else { log.debug('git context command failed', { cwd, command, - exitCode: failure.exitCode, - stderr: failure.stderr, + exitCode: result.exitCode, + stderr: result.stderr, }); } } - -async function runGit( - process: IHostProcessService, - cwd: string, - args: readonly string[], -): Promise { - let proc: IHostProcess | undefined; - try { - proc = await process.spawn('git', ['-C', cwd, ...args], { cwd }); - } catch { - return { ok: false, kind: 'spawn-error' }; - } - - try { - proc.stdin.end(); - } catch { - } - - const work = Promise.all([collectStream(proc.stdout), collectStream(proc.stderr), proc.wait()]); - work.catch(() => {}); - let timer: ReturnType | undefined; - let timedOut = false; - try { - const timeout = new Promise((_resolve, reject) => { - timer = setTimeout(() => { - timedOut = true; - reject(new Error(`git ${args.join(' ')} timed out`)); - }, GIT_TIMEOUT_MS); - }); - const [stdout, stderr, exitCode] = await Promise.race([work, timeout]); - if (exitCode !== 0) { - return { ok: false, kind: 'command-failed', exitCode, stderr: stderr.trim() }; - } - return { ok: true, stdout: stdout.trim() }; - } catch { - try { - await proc.kill('SIGKILL'); - } catch { - } - await work.catch(() => {}); - if (timedOut) return { ok: false, kind: 'timeout' }; - return { ok: false, kind: 'command-failed' }; - } finally { - if (timer !== undefined) clearTimeout(timer); - if (proc !== undefined) await disposeProcess(proc); - } -} - -async function collectStream(stream: Readable): Promise { - const chunks: Buffer[] = []; - for await (const chunk of stream) { - chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk as string)); - } - return Buffer.concat(chunks).toString('utf-8'); -} - -async function disposeProcess(proc: IHostProcess): Promise { - try { - await proc.dispose(); - } catch { - } -} diff --git a/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts b/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts index ea38e446c..43c91e121 100644 --- a/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts +++ b/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts @@ -115,9 +115,10 @@ registerAgentProfile({ tools: EXPLORE_TOOLS, renderSystemPrompt: (context) => renderSystemPromptResult(EXPLORE_ROLE, context, { skillActive: skillActiveFor(EXPLORE_TOOLS) }), - promptPrefix: async ({ cwd, process, log }) => { + promptPrefix: async ({ cwd, git, log }) => { + if (git === undefined) return ''; try { - return await collectGitContext(process, cwd, log); + return await collectGitContext(git, cwd, log); } catch { return ''; } diff --git a/packages/agent-core-v2/src/session/sessionTitle/configSection.ts b/packages/agent-core-v2/src/session/sessionTitle/configSection.ts new file mode 100644 index 000000000..3fdf6020b --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionTitle/configSection.ts @@ -0,0 +1,9 @@ +import { z } from 'zod'; + +import { registerConfigSection } from '#/app/config/configSectionContributions'; + +export const AUTO_SESSION_TITLE_SECTION = 'autoSessionTitle'; + +export const AutoSessionTitleSchema = z.boolean(); + +registerConfigSection(AUTO_SESSION_TITLE_SECTION, AutoSessionTitleSchema); diff --git a/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts b/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts index 06618be9e..c5d7ca682 100644 --- a/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts +++ b/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts @@ -1,4 +1,6 @@ /* oxlint-disable typescript-eslint/no-unsafe-declaration-merging, eslint-plugin-import/namespace -- Event2 class+payload-interface declaration merging is the sanctioned event-declaration idiom. */ +import { z } from 'zod'; + import type { IAgentScopeHandle } from '#/_base/di/scope'; import { isAbortError, isUserCancellation, userCancellationReason } from '#/_base/utils/abort'; import { ISessionTokenCountingService } from '#/session/tokenCounting/sessionTokenCounting'; @@ -8,7 +10,7 @@ import { isProviderRateLimitError } from '#/llm-adapter/contract/errors'; import { type TokenUsage } from '#human/llm/usage'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import type { SubagentCreatedEvent } from '#/app/telemetry/events'; -import { Event2 } from '#/app/event/event2'; +import { Event2, registerEvent2Class } from '#/app/event/event2'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import { IEventDispatcher } from '#/state/eventDispatcher'; @@ -33,8 +35,24 @@ export interface SubagentSpawnedPayload { export class SubagentSpawned extends Event2 { static override readonly type = 'subagent.spawned'; static override readonly observable = true; + static override readonly durable = true; + static override readonly schema = z.object({ + subagentId: z.string(), + subagentName: z.string(), + parentToolCallId: z.string(), + parentToolCallUuid: z.string().optional(), + parentAgentId: z.string().optional(), + callerAgentId: z.string().optional(), + description: z.string().optional(), + dynamicWorkflowIndex: z.number().optional(), + runInBackground: z.boolean(), + model: z.string().optional(), + thinkingEffort: z.string().optional(), + taskId: z.string().optional(), + }); } export interface SubagentSpawned extends SubagentSpawnedPayload {} +registerEvent2Class(SubagentSpawned); export interface SubagentStartedPayload { readonly subagentId: string; @@ -43,8 +61,11 @@ export interface SubagentStartedPayload { export class SubagentStarted extends Event2 { static override readonly type = 'subagent.started'; static override readonly observable = true; + static override readonly durable = true; + static override readonly schema = z.object({ subagentId: z.string() }); } export interface SubagentStarted extends SubagentStartedPayload {} +registerEvent2Class(SubagentStarted); export interface SubagentCompletedPayload { readonly subagentId: string; @@ -56,8 +77,16 @@ export interface SubagentCompletedPayload { export class SubagentCompleted extends Event2 { static override readonly type = 'subagent.completed'; static override readonly observable = true; + static override readonly durable = true; + static override readonly schema = z.object({ + subagentId: z.string(), + resultSummary: z.string(), + usage: z.custom().optional(), + contextTokens: z.number().optional(), + }); } export interface SubagentCompleted extends SubagentCompletedPayload {} +registerEvent2Class(SubagentCompleted); export interface SubagentFailedPayload { readonly subagentId: string; @@ -67,8 +96,11 @@ export interface SubagentFailedPayload { export class SubagentFailed extends Event2 { static override readonly type = 'subagent.failed'; static override readonly observable = true; + static override readonly durable = true; + static override readonly schema = z.object({ subagentId: z.string(), error: z.string() }); } export interface SubagentFailed extends SubagentFailedPayload {} +registerEvent2Class(SubagentFailed); export interface SubagentCancelledPayload { readonly subagentId: string; @@ -77,8 +109,11 @@ export interface SubagentCancelledPayload { export class SubagentCancelled extends Event2 { static override readonly type = 'subagent.cancelled'; static override readonly observable = true; + static override readonly durable = true; + static override readonly schema = z.object({ subagentId: z.string() }); } export interface SubagentCancelled extends SubagentCancelledPayload {} +registerEvent2Class(SubagentCancelled); export interface SubagentSpawnedEvent extends SubagentSpawnedPayload { readonly type: 'subagent.spawned'; diff --git a/packages/agent-core-v2/src/session/subagent/subagentService.ts b/packages/agent-core-v2/src/session/subagent/subagentService.ts index 9d2a0ecbc..1a5cd3656 100644 --- a/packages/agent-core-v2/src/session/subagent/subagentService.ts +++ b/packages/agent-core-v2/src/session/subagent/subagentService.ts @@ -22,6 +22,7 @@ import { IAgentUserToolService } from '#/agent/userTool/userTool'; import { IAgentRuntimeService } from '#/agent/runtimeBinding/agentRuntime'; import type { Runtime } from '#/runtime/runtime'; import { IConfigService } from '#/app/config/config'; +import { IGitService } from '#/app/git/git'; import { IModelCatalog, type Model } from '#/llm-adapter/model/catalog'; import { ILogService } from '#/_base/log/log'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; @@ -70,6 +71,7 @@ export class SessionSubagentService extends Service implements ISessionSubagentS @IAgentLifecycleService private readonly agentLifecycle: IAgentLifecycleService, @ISessionAgentProfileCatalog private readonly catalog: ISessionAgentProfileCatalog, @IConfigService private readonly configService: IConfigService, + @IGitService private readonly git: IGitService, @IModelCatalog private readonly modelCatalog: IModelCatalog, @ISessionContext private readonly sessionContext: ISessionContext, @ILogService private readonly log: ILogService, @@ -225,6 +227,7 @@ export class SessionSubagentService extends Service implements ISessionSubagentS cwd: view.workDir, process: runtime.process!, log: this.log, + git: this.git, }); } diff --git a/packages/agent-core-v2/src/tool/args-validator.ts b/packages/agent-core-v2/src/tool/args-validator.ts index 3585f03f7..281cf33b6 100644 --- a/packages/agent-core-v2/src/tool/args-validator.ts +++ b/packages/agent-core-v2/src/tool/args-validator.ts @@ -3,14 +3,28 @@ import Ajv2019 from 'ajv/dist/2019'; import Ajv2020 from 'ajv/dist/2020'; import addFormats from 'ajv-formats'; -const DRAFT_07_AJV = new Ajv({ strict: false, allErrors: true }); -addFormats(DRAFT_07_AJV); +type AnyAjv = Ajv | Ajv2019 | Ajv2020; -const DRAFT_2019_AJV = new Ajv2019({ strict: false, allErrors: true }); -addFormats(DRAFT_2019_AJV); +let draft07Ajv: Ajv | undefined; +let draft2019Ajv: Ajv2019 | undefined; +let draft2020Ajv: Ajv2020 | undefined; -const DRAFT_2020_AJV = new Ajv2020({ strict: false, allErrors: true }); -addFormats(DRAFT_2020_AJV); +function withFormats(ajv: T): T { + addFormats(ajv); + return ajv; +} + +function draft07(): Ajv { + return (draft07Ajv ??= withFormats(new Ajv({ strict: false, allErrors: true }))); +} + +function draft2019(): Ajv2019 { + return (draft2019Ajv ??= withFormats(new Ajv2019({ strict: false, allErrors: true }))); +} + +function draft2020(): Ajv2020 { + return (draft2020Ajv ??= withFormats(new Ajv2020({ strict: false, allErrors: true }))); +} const DRAFT_2019_KEYWORDS = new Set([ 'dependentRequired', @@ -25,16 +39,16 @@ const DRAFT_2019_KEYWORDS = new Set([ const DRAFT_2020_KEYWORDS = new Set(['prefixItems', '$dynamicAnchor', '$dynamicRef']); -function ajvFor(schema: Record): Ajv | Ajv2019 | Ajv2020 { +function ajvFor(schema: Record): AnyAjv { const $schema = schema['$schema']; if (typeof $schema === 'string') { - if ($schema.includes('2020-12')) return DRAFT_2020_AJV; - if ($schema.includes('2019-09')) return DRAFT_2019_AJV; - return DRAFT_07_AJV; + if ($schema.includes('2020-12')) return draft2020(); + if ($schema.includes('2019-09')) return draft2019(); + return draft07(); } - if (containsSchemaKeyword(schema, DRAFT_2020_KEYWORDS)) return DRAFT_2020_AJV; - if (containsSchemaKeyword(schema, DRAFT_2019_KEYWORDS)) return DRAFT_2019_AJV; - return DRAFT_07_AJV; + if (containsSchemaKeyword(schema, DRAFT_2020_KEYWORDS)) return draft2020(); + if (containsSchemaKeyword(schema, DRAFT_2019_KEYWORDS)) return draft2019(); + return draft07(); } function containsSchemaKeyword(value: unknown, keywords: ReadonlySet): boolean { diff --git a/packages/agent-core-v2/src/tool/path-access.ts b/packages/agent-core-v2/src/tool/path-access.ts index 68e6672d7..e519ade39 100644 --- a/packages/agent-core-v2/src/tool/path-access.ts +++ b/packages/agent-core-v2/src/tool/path-access.ts @@ -83,7 +83,7 @@ export function isSensitiveFile(path: string): boolean { } export type PathClass = 'posix' | 'win32'; -export type PathSecurityCode = 'PATH_OUTSIDE_WORKSPACE' | 'PATH_SENSITIVE' | 'PATH_INVALID'; +export type PathSecurityCode = 'PATH_OUTSIDE_WORKSPACE' | 'PATH_SENSITIVE' | 'PATH_INVALID' | 'PATH_SYMLINK_ESCAPE'; export type PathAccessOperation = 'read' | 'write' | 'search'; export type WorkspaceGuardMode = 'absolute-outside-allowed' | 'disabled'; @@ -190,6 +190,10 @@ export function isWithinWorkspace( return false; } +export function isProjectLocalConfigPath(targetPath: string): boolean { + return targetPath.replaceAll('\\', '/').toLowerCase().endsWith('/.pythinker-code/local.toml'); +} + export function extendWorkspaceWithSkillRoots( workspace: T, skillRoots: readonly string[], diff --git a/packages/agent-core-v2/src/tool/realpath-access.ts b/packages/agent-core-v2/src/tool/realpath-access.ts new file mode 100644 index 000000000..aaebec687 --- /dev/null +++ b/packages/agent-core-v2/src/tool/realpath-access.ts @@ -0,0 +1,183 @@ +import * as pathe from 'pathe'; + +import { isError2, unwrapErrorCause } from '#/_base/errors/errors'; +import { OsFsErrors } from '#/os/interface/hostFsErrors'; +import type { IHostFileSystem } from '#/os/interface/hostFileSystem'; +import { + isProjectLocalConfigPath, + isSensitiveFile, + isWithinDirectory, + isWithinWorkspace, + PathSecurityError, + type PathClass, + type WorkspaceConfig, +} from '#/tool/path-access'; + +function errnoCode(error: unknown): string | undefined { + const unwrapped = unwrapErrorCause(error); + if (typeof unwrapped === 'object' && unwrapped !== null && 'code' in unwrapped) { + const code = (unwrapped as { code: unknown }).code; + return typeof code === 'string' ? code : undefined; + } + return undefined; +} + +function isMissingPathError(error: unknown): boolean { + if (isError2(error)) { + return ( + error.code === OsFsErrors.codes.OS_FS_NOT_FOUND || + error.code === OsFsErrors.codes.OS_FS_NOT_DIRECTORY + ); + } + const code = errnoCode(error); + return code === 'ENOENT' || code === 'ENOTDIR'; +} + +async function realpathExistingPrefix(fs: IHostFileSystem, absPath: string): Promise { + const tail: string[] = []; + let current = absPath; + for (let i = 0; i < 256; i++) { + try { + const real = await fs.realpath(current); + return tail.length === 0 ? real : pathe.join(real, ...tail.toReversed()); + } catch (error) { + if (!isMissingPathError(error)) throw error; + const exists = await fs + .lstat(current) + .then( + () => true, + (lstatError) => { + if (isMissingPathError(lstatError)) return false; + throw lstatError; + }, + ); + if (exists) { + throw new PathSecurityError( + 'PATH_SYMLINK_ESCAPE', + absPath, + current, + `"${current}" is a symbolic link whose target does not exist. Access is blocked.`, + ); + } + const parent = pathe.dirname(current); + if (parent === current) return absPath; + tail.push(pathe.basename(current)); + current = parent; + } + } + throw new PathSecurityError( + 'PATH_SYMLINK_ESCAPE', + absPath, + absPath, + `"${absPath}" is too deep to resolve to a real path. Access is blocked.`, + ); +} + +async function realRoots( + fs: IHostFileSystem, + workspace: WorkspaceConfig, +): Promise { + const roots: string[] = []; + for (const dir of [workspace.workspaceDir, ...workspace.additionalDirs]) { + try { + roots.push(await fs.realpath(dir)); + } catch { + roots.push(dir); + } + } + return roots; +} + +export interface RealPathAccessOptions { + readonly checkSensitive?: boolean; +} + +export async function assertRealPathWithinWorkspace( + fs: IHostFileSystem, + absPath: string, + workspace: WorkspaceConfig, + pathClass: PathClass, + options?: RealPathAccessOptions, +): Promise { + if (!isWithinWorkspace(absPath, workspace, pathClass)) { + const resolved = await realpathExistingPrefix(fs, absPath); + if (options?.checkSensitive !== false && isSensitiveFile(resolved)) { + throw new PathSecurityError( + 'PATH_SENSITIVE', + absPath, + resolved, + `"${absPath}" resolves to "${resolved}" through a symbolic link, which matches a sensitive-file pattern (env / credential / SSH key). ` + + 'Access is blocked to protect secrets.', + ); + } + return absPath; + } + const resolved = await realpathExistingPrefix(fs, absPath); + if (options?.checkSensitive !== false && isSensitiveFile(resolved)) { + throw new PathSecurityError( + 'PATH_SENSITIVE', + absPath, + resolved, + `"${absPath}" resolves to "${resolved}" through a symbolic link, which matches a sensitive-file pattern (env / credential / SSH key). ` + + 'Access is blocked to protect secrets.', + ); + } + const roots = await realRoots(fs, workspace); + if (roots.some((root) => isWithinDirectory(resolved, root, pathClass))) return resolved; + throw new PathSecurityError( + 'PATH_SYMLINK_ESCAPE', + absPath, + resolved, + `"${absPath}" resolves to "${resolved}" through a symbolic link that points outside the working directory. ` + + 'Access is blocked; use the real path directly or add the target directory to the workspace.', + ); +} + +export async function assertRealPathWriteTarget( + fs: IHostFileSystem, + absPath: string, + workspace: WorkspaceConfig, + pathClass: PathClass, +): Promise { + const resolved = await assertRealPathWithinWorkspace(fs, absPath, workspace, pathClass); + if (!isProjectLocalConfigPath(absPath) && isProjectLocalConfigPath(resolved)) { + throw new PathSecurityError( + 'PATH_SYMLINK_ESCAPE', + absPath, + resolved, + `"${absPath}" resolves to the project-local config "${resolved}" through a symbolic link. ` + + 'Access is blocked; use the real path so the write goes through approval.', + ); + } +} + +export async function checkRealPathWithinWorkspace( + fs: IHostFileSystem, + absPath: string, + workspace: WorkspaceConfig, + pathClass: PathClass, + options?: RealPathAccessOptions, +): Promise { + try { + await assertRealPathWithinWorkspace(fs, absPath, workspace, pathClass, options); + return undefined; + } catch (error) { + if (error instanceof PathSecurityError) return error; + throw error; + } +} + +export async function checkRealPathWriteTarget( + fs: IHostFileSystem, + absPath: string, + workspace: WorkspaceConfig, + pathClass: PathClass, +): Promise { + try { + await assertRealPathWriteTarget(fs, absPath, workspace, pathClass); + return undefined; + } catch (error) { + if (error instanceof PathSecurityError) return error; + throw error; + } +} diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts index a43cc4e80..0db409698 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts @@ -646,7 +646,7 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec updatedAt: toEpochMs(sourceMeta?.updatedAt) || now, archived: false, title, - titleKind: opts.title !== undefined ? 'custom' : 'replaceable', + titleKind: opts.title !== undefined ? 'custom' : sourceMeta?.titleKind, forkedFrom: sourceId, agents, custom: forkCustomMetadata(sourceMeta?.custom, opts.metadata), diff --git a/packages/agent-core-v2/src/workspace/workspaceDirs/workspaceDirsService.ts b/packages/agent-core-v2/src/workspace/workspaceDirs/workspaceDirsService.ts index b0cf16925..c62656f84 100644 --- a/packages/agent-core-v2/src/workspace/workspaceDirs/workspaceDirsService.ts +++ b/packages/agent-core-v2/src/workspace/workspaceDirs/workspaceDirsService.ts @@ -4,10 +4,14 @@ import { ILogService } from '#/_base/log/log'; import { defineState } from '#/state/state'; import { TimeoutTimer } from '#/_base/utils/timer'; import { subtreeWatchFilter } from '#/_base/utils/paths'; -import { IProjectLocalConfigService } from '#/app/projectLocalConfig/projectLocalConfig'; +import { + IProjectLocalConfigService, + type ProjectAdditionalDirsLoadResult, +} from '#/app/projectLocalConfig/projectLocalConfig'; import type { ISessionWorkspaceInfo } from '#/session/workspaceInfo/workspaceInfo'; import { IWorkspaceStateService } from '#/workspace/state/workspaceState'; import { IWorkspaceContext } from '#/workspace/workspaceContext/workspaceContext'; +import { IWorkspaceTrust } from '#/workspace/workspaceTrust/workspaceTrust'; import { watchCandidates } from '#human/utils/watch'; import { @@ -43,6 +47,7 @@ export class WorkspaceDirsService extends Disposable implements IWorkspaceDirs { @IProjectLocalConfigService private readonly localConfig: IProjectLocalConfigService, @ILogService private readonly log: ILogService, @IWorkspaceStateService private readonly states: IWorkspaceStateService, + @IWorkspaceTrust private readonly trust: IWorkspaceTrust, ) { super(); this.states.contributeState(workspaceDirsFileDirsKey); @@ -51,6 +56,16 @@ export class WorkspaceDirsService extends Disposable implements IWorkspaceDirs { this.configPath = ''; this.ready = this.enqueue(() => this.reloadFromDisk()); void this.ready.then(() => this.watchLocalToml()); + this._register( + this.trust.onDidChange(() => { + if (!this.trust.isTrusted() && this.setFileDirs([])) { + this.onDidChangeEmitter.fire(); + } + void this.enqueue(() => this.reloadFromDisk()).catch((error) => { + this.log.warn(`local.toml trust reload failed: ${String(error)}`); + }); + }), + ); } private get fileDirs(): readonly string[] { @@ -109,7 +124,15 @@ export class WorkspaceDirsService extends Disposable implements IWorkspaceDirs { ); this.projectRoot = persisted.projectRoot; this.configPath = persisted.configPath; - const changed = this.setFileDirs(persisted.additionalDirs); + let changed: boolean; + if (this.trust.isTrusted()) { + changed = this.setFileDirs(persisted.additionalDirs); + } else { + const explicit = await this.localConfig.resolveAdditionalDirs(this.workspace.cwd, [ + input.path, + ]); + changed = this.unionEphemeral(explicit); + } if (changed) { this.onDidChangeEmitter.fire(); } @@ -121,7 +144,7 @@ export class WorkspaceDirsService extends Disposable implements IWorkspaceDirs { }; } - const onDisk = await this.localConfig.readAdditionalDirs(this.workspace.cwd); + const onDisk = await this.localConfig.locateAdditionalDirsConfig(this.workspace.cwd); this.projectRoot = onDisk.projectRoot; this.configPath = onDisk.configPath; const resolved = await this.localConfig.resolveAdditionalDirs(this.workspace.cwd, [ @@ -140,10 +163,18 @@ export class WorkspaceDirsService extends Disposable implements IWorkspaceDirs { } private async reloadFromDisk(): Promise { - const onDisk = await this.localConfig.readAdditionalDirs(this.workspace.cwd); + await this.trust.ready; + const trustedAtStart = this.trust.isTrusted(); + const onDisk: ProjectAdditionalDirsLoadResult = trustedAtStart + ? await this.localConfig.readAdditionalDirs(this.workspace.cwd) + : { + ...(await this.localConfig.locateAdditionalDirsConfig(this.workspace.cwd)), + additionalDirs: [], + }; this.projectRoot = onDisk.projectRoot; this.configPath = onDisk.configPath; - if (this.setFileDirs(onDisk.additionalDirs)) { + const dirs = this.trust.isTrusted() ? onDisk.additionalDirs : []; + if (this.setFileDirs(dirs)) { this.onDidChangeEmitter.fire(); } } diff --git a/packages/agent-core-v2/test/agent/agentsMdReminder/agentsMdReminder.test.ts b/packages/agent-core-v2/test/agent/agentsMdReminder/agentsMdReminder.test.ts index 42b67ffeb..7254dae78 100644 --- a/packages/agent-core-v2/test/agent/agentsMdReminder/agentsMdReminder.test.ts +++ b/packages/agent-core-v2/test/agent/agentsMdReminder/agentsMdReminder.test.ts @@ -148,7 +148,10 @@ function createHarness( dispatch: async () => {}, } as unknown as IEventDispatcher; reg.defineInstance(IEventDispatcher, dispatcher); - reg.defineInstance(IBootstrapService, { homeDir } as unknown as IBootstrapService); + reg.defineInstance(IBootstrapService, { + homeDir, + getEnv: () => undefined, + } as unknown as IBootstrapService); const agentState = new AgentStateService(); agentState.contributeState(profileKey); agentState.set(profileKey, { diff --git a/packages/agent-core-v2/test/agent/contextMemory/loopEventFold.test.ts b/packages/agent-core-v2/test/agent/contextMemory/loopEventFold.test.ts index 74bca6df3..1f53392e0 100644 --- a/packages/agent-core-v2/test/agent/contextMemory/loopEventFold.test.ts +++ b/packages/agent-core-v2/test/agent/contextMemory/loopEventFold.test.ts @@ -38,6 +38,7 @@ describe('loop-event fold parity', () => { toolCallId: m.toolCallId, isError: m.isError, note: m.note, + durationMs: m.durationMs, })); } @@ -47,7 +48,7 @@ describe('loop-event fold parity', () => { { role: 'assistant', content: [{ type: 'text', text: 'I will call.' }], - toolCalls: [{ type: 'function', id: 'c1', name: 'Lookup', arguments: '{"q":"moon"}' }], + toolCalls: [{ type: 'function', id: 'c1', name: 'Bash', arguments: '{"q":"moon"}' }], }, { role: 'tool', @@ -55,6 +56,19 @@ describe('loop-event fold parity', () => { toolCalls: [], toolCallId: 'c1', isError: false, + durationMs: 42, + }, + { + role: 'assistant', + content: [], + toolCalls: [{ type: 'function', id: 'c2', name: 'Lookup', arguments: '{"q":"mars"}' }], + }, + { + role: 'tool', + content: [{ type: 'text', text: 'other result' }], + toolCalls: [], + toolCallId: 'c2', + isError: false, }, ]), ); @@ -71,15 +85,29 @@ describe('loop-event fold parity', () => { type: 'tool.call', stepUuid: 's1', toolCallId: 'c1', - name: 'Lookup', + name: 'Bash', args: { q: 'moon' }, }, { type: 'tool.result', toolCallId: 'c1', - result: { output: 'lookup result', isError: false }, + result: { output: 'lookup result', isError: false, durationMs: 42 }, }, { type: 'step.end', uuid: 's1' }, + { type: 'step.begin', uuid: 's2' }, + { + type: 'tool.call', + stepUuid: 's2', + toolCallId: 'c2', + name: 'Lookup', + args: { q: 'mars' }, + }, + { + type: 'tool.result', + toolCallId: 'c2', + result: { output: 'other result', isError: false, durationMs: 7 }, + }, + { type: 'step.end', uuid: 's2' }, ]), ); @@ -439,4 +467,46 @@ describe('loop-event fold parity', () => { expect(folded).toEqual(baseline); }); + + it('attaches step.end usage and timing to the sealed assistant message', () => { + const [assistant] = foldAll([], [ + { type: 'step.begin', uuid: 'st1' }, + { + type: 'content.part', + stepUuid: 'st1', + part: { type: 'text', text: 'a1' }, + }, + { + type: 'step.end', + uuid: 'st1', + usage: { inputOther: 10, output: 20, inputCacheRead: 30, inputCacheCreation: 40 }, + llmFirstTokenLatencyMs: 800, + llmStreamDurationMs: 5000, + }, + ]); + expect(assistant?.usage).toEqual({ + inputOther: 10, + output: 20, + inputCacheRead: 30, + inputCacheCreation: 40, + }); + expect(assistant?.llmTiming).toEqual({ + llmFirstTokenLatencyMs: 800, + llmStreamDurationMs: 5000, + }); + }); + + it('seals without usage or timing when step.end carries neither', () => { + const [assistant] = foldAll([], [ + { type: 'step.begin', uuid: 'st1' }, + { + type: 'content.part', + stepUuid: 'st1', + part: { type: 'text', text: 'a1' }, + }, + { type: 'step.end', uuid: 'st1' }, + ]); + expect(assistant?.usage).toBeUndefined(); + expect(assistant?.llmTiming).toBeUndefined(); + }); }); diff --git a/packages/agent-core-v2/test/agent/contextProjector/projector-tool-exchanges.test.ts b/packages/agent-core-v2/test/agent/contextProjector/projector-tool-exchanges.test.ts index f3e34dcb6..6c8f46a95 100644 --- a/packages/agent-core-v2/test/agent/contextProjector/projector-tool-exchanges.test.ts +++ b/packages/agent-core-v2/test/agent/contextProjector/projector-tool-exchanges.test.ts @@ -134,6 +134,14 @@ describe('projector tool-exchange normalization', () => { const history = [user('go'), assistant('', ['c1']), toolResult('c1', 'one'), user('next')]; expect(shape(history)).toEqual(['user', 'assistant', 'tool:c1', 'user']); expect(project(history)).toHaveLength(4); + const timed = project([ + user('go'), + assistant('', ['c1']), + { ...toolResult('c1', 'one'), durationMs: 42 }, + ]); + expect(timed.at(-1)?.content).toEqual([ + { type: 'text', text: 'Wall time: 0.042 seconds\none' }, + ]); }); it('synthesizes a result for a trailing unanswered call', () => { diff --git a/packages/agent-core-v2/test/agent/loop/loop.test.ts b/packages/agent-core-v2/test/agent/loop/loop.test.ts index ba41fa024..131fa8771 100644 --- a/packages/agent-core-v2/test/agent/loop/loop.test.ts +++ b/packages/agent-core-v2/test/agent/loop/loop.test.ts @@ -35,11 +35,13 @@ import type { ExecutableTool } from '#/tool/toolContract'; import { IAgentToolRegistryService } from '#/agent/toolRegistry/toolRegistry'; import { IAgentToolExecutorService } from '#/agent/toolExecutor/toolExecutor'; import { IEventBus } from '#/app/event/eventBus'; +import { IPluginService } from '#/app/plugin/plugin'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import { isUserCancellation, userCancellationReason } from '#/_base/utils/abort'; import { agentService, + appService, createTestAgent, InMemoryWireRecordPersistence, permissionModeServices, @@ -49,6 +51,7 @@ import { type TestAgentContext, type TestAgentOptions, } from '../../harness'; +import { stubPluginService } from '../../app/plugin/stubs'; import { recordingTelemetry, type TelemetryRecord } from '../../app/telemetry/stubs'; import { submitPromptTurn } from './stubs'; @@ -546,11 +549,11 @@ describe('Agent loop', () => { [emit] turn.ended { "time": "