@tt-a1i/hive 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/src/server/terminal-input-profile.js +10 -0
- package/package.json +1 -1
- package/web/dist/assets/{AddWorkerDialog-C86CwNgQ.js → AddWorkerDialog-CbV75qUX.js} +2 -2
- package/web/dist/assets/{AddWorkspaceFlow-Bm2Jz34D.js → AddWorkspaceFlow-CwV-7wPx.js} +1 -1
- package/web/dist/assets/{FirstRunWizard-XzBoEpA5.js → FirstRunWizard-a6PWIK3x.js} +1 -1
- package/web/dist/assets/{MarketplaceDrawer-BFfGT8hH.js → MarketplaceDrawer-Dd8WIA8T.js} +1 -1
- package/web/dist/assets/{TaskGraphDrawer-_uVH_0C1.js → TaskGraphDrawer-Bk5WFIk_.js} +1 -1
- package/web/dist/assets/{WhatsNewDialog-DkJHmkMs.js → WhatsNewDialog-C2VZaip0.js} +1 -1
- package/web/dist/assets/{WorkerModal-BtMJEOG9.js → WorkerModal-DucW-9YT.js} +1 -1
- package/web/dist/assets/{WorkflowsDrawer-CiIdHS6_.js → WorkflowsDrawer-Bjf4olbR.js} +1 -1
- package/web/dist/assets/{WorkspaceMemoryDrawer-C6sNocl_.js → WorkspaceMemoryDrawer-DglCy_5f.js} +1 -1
- package/web/dist/assets/{WorkspaceTaskDrawer-CyhhEB1Z.js → WorkspaceTaskDrawer-BIWwISvA.js} +1 -1
- package/web/dist/assets/{index-K-GG8UwR.js → index-BV2k9Dts.js} +5 -5
- package/web/dist/assets/{search-BtRkkEmS.js → search-Bk2HQvO7.js} +1 -1
- package/web/dist/assets/{square-terminal-lEeQUWb3.js → square-terminal-D93m9hfY.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/sw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable user-facing changes will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 2.0.2 - 2026-06-10
|
|
6
|
+
|
|
7
|
+
Windows Codex terminal scrolling fix.
|
|
8
|
+
|
|
9
|
+
- Fixes Codex terminal scrolling for Windows installs whose saved launch
|
|
10
|
+
command still points at `node.exe ...\@openai\codex\bin\codex.js`, so Hive
|
|
11
|
+
now applies the Codex-specific wheel/PageUp/PageDown input profile instead of
|
|
12
|
+
treating the session like a plain shell.
|
|
13
|
+
|
|
5
14
|
## 2.0.1 - 2026-06-09
|
|
6
15
|
|
|
7
16
|
Team memory, worker-card polish, and release-channel cleanup.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { normalizeExecutableToken } from './startup-command-parser.js';
|
|
2
|
+
const isCodexNpmEntrypoint = (arg) => {
|
|
3
|
+
if (!arg)
|
|
4
|
+
return false;
|
|
5
|
+
const normalized = arg.replace(/\\/gu, '/');
|
|
6
|
+
return /(?:^|\/)@openai\/codex\/bin\/codex\.js$/iu.test(normalized);
|
|
7
|
+
};
|
|
2
8
|
export const resolveTerminalInputProfile = (config) => {
|
|
3
9
|
if (!config)
|
|
4
10
|
return 'default';
|
|
@@ -8,10 +14,14 @@ export const resolveTerminalInputProfile = (config) => {
|
|
|
8
14
|
return 'grok';
|
|
9
15
|
if (config.commandPresetId === 'opencode')
|
|
10
16
|
return 'opencode';
|
|
17
|
+
if (config.sessionIdCapture?.source === 'codex_session_jsonl_dir')
|
|
18
|
+
return 'codex';
|
|
11
19
|
const executable = normalizeExecutableToken(config.interactiveCommand) ?? normalizeExecutableToken(config.command);
|
|
12
20
|
if (executable === 'codex')
|
|
13
21
|
return 'codex';
|
|
14
22
|
if (executable === 'grok')
|
|
15
23
|
return 'grok';
|
|
24
|
+
if (isCodexNpmEntrypoint(config.args?.[0]))
|
|
25
|
+
return 'codex';
|
|
16
26
|
return executable === 'opencode' ? 'opencode' : 'default';
|
|
17
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tt-a1i/hive",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Browser-native hive-mind for CLI coding agents — Claude Code, Codex, OpenCode, Gemini, Hermes, Cursor, and Grok collaborate as real PTY processes via a team protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.30.3",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarketplaceDrawer-
|
|
2
|
-
import{c as z,j as e,u as j,r as d,C as M,x as L,t as U,J as Y,Q as Z,ac as ee,ad as te,e as ae,i as re,R as se,P as ne,O as oe,k as le,m as ie,$ as de,z as ce,X as me,T as xe,ae as ue}from"./index-K-GG8UwR.js";import{S as pe}from"./search-BtRkkEmS.js";import{S as he}from"./square-terminal-lEeQUWb3.js";const fe=[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M15 10H9",key:"o6yqo3"}],["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],be=z("bookmark-plus",fe);const ge=[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]],ve=z("dices",ge);const ke=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],je=z("store",ke),ye=[{value:"coder"},{value:"reviewer"},{value:"tester"},{value:"custom",dashed:!0}],I=t=>`role.${t}`,S=({children:t})=>e.jsx("span",{className:"text-sm font-medium text-sec",children:t}),Ne=({active:t,spec:a,onSelect:n})=>{const{t:s}=j();return e.jsxs("button",{type:"button",onClick:n,"aria-pressed":t,"data-testid":`role-card-${a.value}`,className:`selectable-card${a.dashed?" selectable-card--dashed":""} flex items-center gap-3 px-3 py-2`,children:[e.jsx(ee,{role:a.value,size:20}),e.jsx("span",{className:"flex-1 text-left text-base font-medium text-pri",children:s(I(a.value))}),t?e.jsx(L,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]})},Ce=({onRoleChange:t,workerRole:a})=>{const{t:n}=j();return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:n("addWorker.role")}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(s=>e.jsx(Ne,{active:a===s.value,spec:s,onSelect:()=>t(s.value)},s.value))})]})},we=({customTemplates:t,disabledReason:a,onDeleteTemplate:n,onSelect:s,selectedTemplateId:c})=>{const{t:o}=j(),[b,x]=d.useState(!1),[m,u]=d.useState(""),[g,k]=d.useState(null),y=d.useRef(null),N=d.useMemo(()=>t.find(r=>r.id===c)??null,[t,c]),v=d.useMemo(()=>{const r=m.trim().toLowerCase();return r?t.filter(p=>p.name.toLowerCase().includes(r)||p.description.toLowerCase().includes(r)):t},[t,m]);return d.useEffect(()=>{if(!b)return;const r=h=>{h.key==="Escape"&&x(!1)},p=h=>{const l=y.current;l&&!l.contains(h.target)&&x(!1)};return document.addEventListener("keydown",r),document.addEventListener("pointerdown",p),()=>{document.removeEventListener("keydown",r),document.removeEventListener("pointerdown",p)}},[b]),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:o("addWorker.template")}),e.jsxs("div",{ref:y,className:"relative",children:[e.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":b,"data-testid":"role-template-picker-trigger",onClick:()=>x(r=>!r),className:"flex w-full items-center justify-between gap-2 rounded border px-3 py-2 text-left text-sm transition-colors hover:bg-3",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-pri",children:N?N.name:o("addWorker.templatePickPlaceholder")}),e.jsx(M,{size:14,className:"shrink-0 text-ter","aria-hidden":!0})]}),b?e.jsxs("div",{role:"listbox","aria-label":o("addWorker.template"),"data-testid":"role-template-picker-menu",className:"elev-2 absolute left-0 right-0 top-full z-30 mt-1 flex max-h-72 flex-col overflow-hidden rounded border",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b px-2 py-1.5",style:{borderColor:"var(--border)"},children:[e.jsx(pe,{size:14,className:"text-ter","aria-hidden":!0}),e.jsx("input",{value:m,onChange:r=>u(r.currentTarget.value),placeholder:o("addWorker.templateSearchPlaceholder"),"data-testid":"role-template-search-input",className:"w-full bg-transparent text-sm text-pri outline-none placeholder:text-ter",spellCheck:!1})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:t.length===0?e.jsx("div",{"data-testid":"role-template-empty-state",className:"px-3 py-3 text-center text-sm text-ter",children:o("addWorker.templateEmpty")}):v.length===0?e.jsx("div",{className:"px-3 py-3 text-center text-sm text-ter",children:o("addWorker.templateNoMatch")}):v.map(r=>{const p=r.id===c;return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",role:"option","aria-selected":p,"data-testid":`role-template-option-${r.id}`,onClick:()=>{s(r.id),x(!1),u("")},className:"flex w-full items-center gap-2 px-3 py-1.5 pr-9 text-left text-sm text-pri hover:bg-3",style:p?{background:"var(--bg-3)"}:void 0,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),p?e.jsx(L,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]}),e.jsx("button",{type:"button","aria-label":o("addWorker.templateDeleteAria",{name:r.name}),"data-testid":`role-template-delete-${r.id}`,disabled:!!a,title:a??void 0,onClick:h=>{h.preventDefault(),h.stopPropagation(),!a&&k(r)},className:"absolute right-1 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri",children:e.jsx(U,{size:14,"aria-hidden":!0})})]},r.id)})}),c!==null?e.jsx("button",{type:"button","data-testid":"role-template-clear",onClick:()=>{s(null),x(!1),u("")},className:"border-t px-3 py-1.5 text-left text-sm text-ter transition-colors hover:bg-3 hover:text-pri",style:{borderColor:"var(--border)"},children:o("addWorker.templateClear")}):null]}):null]}),e.jsx(Y,{open:g!==null,onOpenChange:r=>{r||k(null)},title:o("addWorker.templateDeleteTitle"),description:g?o("addWorker.templateDeleteConfirm",{name:g.name}):"",confirmLabel:o("addWorker.templateDeleteConfirmLabel"),confirmKind:"danger",onConfirm:()=>{if(!g||a)return;const r=g.id;k(null),n(r)}})]})},We=({canSaveAsTemplate:t,modified:a,onChange:n,onReset:s,onSaveAsTemplate:c,roleDescription:o,templateBusy:b,workerRole:x,writeDisabledReason:m})=>{const{t:u,language:g}=j(),[k,y]=d.useState(!1),[N,v]=d.useState(!1),[r,p]=d.useState("");d.useEffect(()=>{(x==="custom"||a)&&y(!0)},[a,x]),d.useEffect(()=>{t||(v(!1),p(""))},[t]);const h=g==="zh"?"点击展开":"Click to expand";return e.jsxs("details",{open:k,onToggle:l=>y(l.currentTarget.open),className:"group flex flex-col gap-2",children:[e.jsxs("summary",{className:"flex cursor-pointer select-none items-center justify-between gap-2 list-none rounded-lg p-2 -mx-2 hover:bg-3/50 transition-colors group/summary",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded bg-3 border border-bright/30 text-ter transition-colors group-hover/summary:text-pri group-hover/summary:border-accent/40",children:e.jsx(M,{size:12,"aria-hidden":!0,className:"-rotate-90 transition-transform duration-150 group-open:rotate-0"})}),e.jsx("span",{className:"text-sm font-semibold text-pri transition-colors group-hover/summary:text-accent",children:u("addWorker.roleInstructions")}),a?e.jsxs("span",{className:"text-xs text-ter",children:["· ",u("addWorker.modifiedFrom",{role:u(I(x))})]}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[k?null:e.jsx("span",{className:"text-[10px] text-ter font-semibold tracking-wider uppercase opacity-60 group-hover/summary:opacity-100 group-hover/summary:text-accent transition-all pr-1",children:h}),t&&!N?e.jsxs("button",{type:"button","data-testid":"role-template-save",disabled:!!m,title:m??void 0,onClick:l=>{l.preventDefault(),l.stopPropagation(),v(!0)},className:"flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium transition-colors hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",style:{color:"var(--accent)",background:"color-mix(in oklab, var(--accent) 14%, transparent)"},children:[e.jsx(be,{size:12,"aria-hidden":!0}),u("addWorker.saveAsTemplate")]}):null,a?e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-ter transition-colors hover:bg-3 hover:text-sec",onClick:l=>{l.preventDefault(),l.stopPropagation(),s()},children:[e.jsx(Z,{size:12,"aria-hidden":!0}),u("addWorker.reset")]}):null]})]}),e.jsx("textarea",{"aria-label":"Role instructions",id:"add-worker-role-instructions",value:o,rows:5,onChange:l=>n(l.currentTarget.value),placeholder:x==="custom"?u("addWorker.customPlaceholder"):void 0,title:u("addWorker.roleInstructionsTitle"),className:"input mono resize-y text-sm",style:{minHeight:150},"data-testid":"role-instructions-textarea"}),t&&N?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{autoFocus:!0,value:r,onChange:l=>p(l.currentTarget.value),placeholder:u("addWorker.templateNamePlaceholder"),"data-testid":"role-template-save-name",className:"input flex-1 text-sm"}),e.jsx("button",{type:"button",disabled:b||!r.trim()||!!m,title:m??void 0,"data-testid":"role-template-save-confirm",onClick:async()=>{if(m)return;const l=r.trim();if(l)try{await c(l),v(!1),p("")}catch{}},className:"icon-btn icon-btn--primary text-xs",children:u("addWorker.templateSaveConfirm")}),e.jsx("button",{type:"button","data-testid":"role-template-save-cancel",onClick:()=>{v(!1),p("")},className:"icon-btn text-xs",children:u("common.cancel")})]}):null]})},D=({active:t,command:a,displayName:n,logoPresetId:s,notFound:c=!1,testId:o,onSelect:b})=>{const{t:x}=j(),m=e.jsx("span",{className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded border border-border bg-surface-1 text-ter","data-testid":`${o}-generic-icon`,"aria-hidden":!0,children:e.jsx(he,{size:13})});return e.jsxs("button",{type:"button",onClick:b,"aria-pressed":t,"data-testid":o,className:"selectable-card flex items-center justify-between gap-3 px-3 py-2",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(te,{commandPresetId:s,fallback:m,size:22}),e.jsxs("span",{className:"flex min-w-0 flex-col items-start gap-0.5",children:[e.jsx("span",{className:"truncate text-base font-medium text-pri",children:n}),e.jsxs("span",{className:"mono truncate text-xs text-ter",children:[a,c?` · ${x("addWorker.agentNotFound")}`:""]})]})]}),t?e.jsx(L,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]})},Se=({active:t,preset:a,onSelect:n})=>e.jsx(D,{active:t,command:a.command,displayName:a.displayName,logoPresetId:a.id,notFound:a.available===!1,testId:`agent-radio-${a.id}`,onSelect:n}),ze=({commandPresetId:t,commandPresets:a,onPresetChange:n})=>{const{t:s}=j();return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:s("addWorker.agentCli")}),a.length===0?e.jsx("div",{className:"text-sm text-ter",children:s("addWorker.loadingPresets")}):e.jsxs("div",{className:"grid grid-cols-2 gap-2 max-md:grid-cols-1",children:[a.map(c=>e.jsx(Se,{active:t===c.id,preset:c,onSelect:()=>n(c.id)},c.id)),e.jsx(D,{active:t==="",command:s("addWorker.genericCommand"),displayName:s("addWorker.genericAgent"),testId:"agent-radio-generic",onSelect:()=>n("")})]})]})},Me=({onChange:t,value:a})=>{const{t:n,language:s}=j(),[c,o]=d.useState(!1),b=a.trim(),x=s==="zh"?"点击展开":"Click to expand";return e.jsxs("details",{onToggle:m=>o(m.currentTarget.open),className:"group flex flex-col gap-2",children:[e.jsxs("summary",{className:"flex cursor-pointer select-none items-center justify-between gap-2 list-none rounded-lg p-2 -mx-2 hover:bg-3/50 transition-colors group/summary",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-3 border border-bright/30 text-ter transition-colors group-hover/summary:text-pri group-hover/summary:border-accent/40",children:e.jsx(M,{size:12,"aria-hidden":!0,className:"-rotate-90 transition-transform duration-150 group-open:rotate-0"})}),e.jsx("span",{className:"text-sm font-semibold text-pri transition-colors group-hover/summary:text-accent",children:n("addWorker.startupCommand")}),b?e.jsxs("span",{className:"truncate text-xs text-ter",children:["· ",n("addWorker.startupOverrides")]}):null]}),c?null:e.jsx("span",{className:"text-[10px] text-ter font-semibold tracking-wider uppercase opacity-60 group-hover/summary:opacity-100 group-hover/summary:text-accent transition-all pr-1",children:x})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded border bg-2 p-3",style:{borderColor:"var(--border)"},children:[e.jsx("input",{"aria-label":"Startup command",value:a,onChange:m=>t(m.currentTarget.value),placeholder:"qwen --model qwen3-coder",className:"input mono text-sm",spellCheck:!1}),e.jsx("p",{className:"text-sm leading-5 text-ter",children:n("addWorker.startupHelp",{example:"claude --resume <session-id>"})})]})]})},Le=d.lazy(()=>ue(()=>import("./MarketplaceDrawer-BFfGT8hH.js"),__vite__mapDeps([0,1,2,3])).then(t=>({default:t.MarketplaceDrawer}))),_e=({commandPresets:t,commandPresetId:a,creating:n=!1,customTemplates:s,onApplyMarketplaceImport:c,onClose:o,onDeleteTemplate:b,onNameChange:x,onPresetChange:m,onRandomName:u,onRoleDescriptionChange:g,onRoleDescriptionReset:k,onRoleChange:y,onSaveAsTemplate:N,onStartupCommandChange:v,onSubmit:r,onTemplateChange:p,roleDescription:h,roleDescriptionDefault:l,selectedTemplateId:P,startupCommand:E,templateBusy:B,workerName:O,workerRole:W,writeDisabledReason:w})=>{const{t:i}=j(),_=ae(),C=re(),[q,$]=d.useState(!1),[H,K]=d.useState(!1),V=d.useMemo(()=>new Set(s.map(f=>f.name)),[s]),Q=f=>{c(f),_.show({kind:"success",message:i("marketplace.imported",{name:f.name})})},J=f=>{f||o()},X=h!==l,A=t.find(f=>f.id===a),T=E.trim(),G=()=>w||(O.trim()?!a&&!T?i("addWorker.pickCliOrStartup"):A?.available===!1&&!T?i("addWorker.unavailable",{name:A.displayName}):h.trim()?null:i("addWorker.emptyInstructions"):i("addWorker.enterName")),R=f=>{const F=G();if(F){f.preventDefault(),_.show({kind:"warning",message:F});return}r(f)};return e.jsxs(se,{open:!0,onOpenChange:J,children:[e.jsxs(ne,{children:[e.jsx(oe,{"data-testid":"add-worker-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4 max-md:items-end max-md:p-0",children:e.jsx(le,{"data-testid":"add-worker-content","data-mobile":C||void 0,className:`${C?"dialog-slide-up add-worker-sheet":"dialog-scale-pop"} elev-2 pointer-events-auto flex max-h-[calc(100vh-32px)] w-[560px] max-w-full flex-col overflow-hidden rounded-lg border pointer-coarse:max-h-[85dvh] max-md:w-full max-md:rounded-b-none max-md:rounded-t-xl`,style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)",...C?{height:"85dvh"}:{}},children:e.jsxs("form",{onSubmit:R,"aria-label":i("addWorker.title"),className:"flex min-h-0 flex-1 flex-col overflow-hidden max-h-full",children:[e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-3 border-b px-5 py-4 max-md:px-4",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[e.jsx(ie,{className:"text-lg font-semibold text-pri",children:i("addWorker.title")}),e.jsx(de,{className:"text-sm text-ter",children:i("addWorker.description",{command:"team send"})})]}),C?e.jsx(ce,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":i("common.closeDialog"),"data-testid":"add-worker-close",className:"-mr-1 flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-sec",style:{background:"var(--bg-2)"},children:e.jsx(me,{size:18,"aria-hidden":!0})})}):null]}),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col gap-4 overflow-y-auto px-5 py-4 max-md:gap-5 max-md:px-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:i("addWorker.name")}),e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{autoFocus:!C,value:O,onChange:f=>x(f.target.value),placeholder:i("addWorker.namePlaceholder"),className:"input w-full pr-24",style:{borderRadius:"10px"}}),e.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",children:e.jsx(xe,{label:i("addWorker.randomTooltip"),children:e.jsxs("button",{type:"button","aria-label":i("addWorker.randomAria"),className:"flex h-7 items-center gap-1.5 rounded-lg border border-bright/10 bg-3 px-2.5 text-xs font-semibold text-sec hover:text-pri hover:bg-4 active:scale-95 transition-all outline-none",onClick:u,"data-testid":"random-worker-name",children:[e.jsx(ve,{size:13,"aria-hidden":!0}),e.jsx("span",{children:i("addWorker.random")})]})})})]})]}),e.jsx(Ce,{workerRole:W,onRoleChange:y}),e.jsxs("button",{type:"button",onClick:()=>{K(!0),$(!0)},"data-testid":"open-marketplace",className:"marketplace-browse-btn flex cursor-pointer items-center gap-2 self-start rounded-lg border px-3 py-2 text-xs font-semibold text-sec outline-none transition-all duration-200 hover:text-pri hover:-translate-y-0.5 active:scale-98 shadow-sm hover:shadow-md",style:{background:"linear-gradient(to bottom, var(--bg-1), var(--bg-0))",borderColor:"var(--border-bright)","--tw-ring-color":"color-mix(in oklab, var(--accent) 45%, transparent)"},children:[e.jsx(je,{size:14,"aria-hidden":!0,className:"text-accent"}),e.jsx("span",{children:i("marketplace.openFromAddWorker")})]}),W==="custom"?e.jsx(we,{customTemplates:s,disabledReason:w,onDeleteTemplate:b,onSelect:p,selectedTemplateId:P}):null,e.jsx(We,{canSaveAsTemplate:W==="custom"&&!P&&h.trim().length>0,modified:X,onChange:g,onReset:k,onSaveAsTemplate:N,roleDescription:h,templateBusy:B,workerRole:W,writeDisabledReason:w}),e.jsx(ze,{commandPresetId:a,commandPresets:t,onPresetChange:m}),e.jsx(Me,{value:E,onChange:v})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t px-5 py-3 max-md:px-4 max-md:pb-[max(12px,env(safe-area-inset-bottom))]",style:{borderColor:"var(--border)",background:"var(--bg-2)"},children:[e.jsx("button",{type:"button",onClick:o,className:`icon-btn border border-bright/20 rounded-lg hover:bg-3 hover:text-pri transition-all active:scale-95 ${C?"flex-1":""}`,"data-testid":"add-worker-cancel",children:i("addWorker.cancel")}),e.jsx("button",{type:"submit",disabled:n||!!w,title:w??void 0,className:`icon-btn icon-btn--primary rounded-lg font-bold shadow-md hover:shadow-lg transition-all active:scale-[0.97] hover:-translate-y-0.5 ${C?"flex-[2]":""}`,"data-testid":"add-worker-submit",children:i(n?"addWorker.creating":"addWorker.create")})]})]})})})]}),H?e.jsx(d.Suspense,{fallback:null,children:e.jsx(Le,{open:q,onClose:()=>$(!1),onImport:Q,importedNames:V})}):null]})};export{_e as AddWorkerDialog};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarketplaceDrawer-Dd8WIA8T.js","assets/index-BV2k9Dts.js","assets/index-BAiLYajK.css","assets/search-Bk2HQvO7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as z,j as e,u as j,r as d,C as M,x as L,t as U,J as Y,Q as Z,ac as ee,ad as te,e as ae,i as re,R as se,P as ne,O as oe,k as le,m as ie,$ as de,z as ce,X as me,T as xe,ae as ue}from"./index-BV2k9Dts.js";import{S as pe}from"./search-Bk2HQvO7.js";import{S as he}from"./square-terminal-D93m9hfY.js";const fe=[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M15 10H9",key:"o6yqo3"}],["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],be=z("bookmark-plus",fe);const ge=[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]],ve=z("dices",ge);const ke=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],je=z("store",ke),ye=[{value:"coder"},{value:"reviewer"},{value:"tester"},{value:"custom",dashed:!0}],I=t=>`role.${t}`,S=({children:t})=>e.jsx("span",{className:"text-sm font-medium text-sec",children:t}),Ne=({active:t,spec:a,onSelect:n})=>{const{t:s}=j();return e.jsxs("button",{type:"button",onClick:n,"aria-pressed":t,"data-testid":`role-card-${a.value}`,className:`selectable-card${a.dashed?" selectable-card--dashed":""} flex items-center gap-3 px-3 py-2`,children:[e.jsx(ee,{role:a.value,size:20}),e.jsx("span",{className:"flex-1 text-left text-base font-medium text-pri",children:s(I(a.value))}),t?e.jsx(L,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]})},Ce=({onRoleChange:t,workerRole:a})=>{const{t:n}=j();return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:n("addWorker.role")}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(s=>e.jsx(Ne,{active:a===s.value,spec:s,onSelect:()=>t(s.value)},s.value))})]})},we=({customTemplates:t,disabledReason:a,onDeleteTemplate:n,onSelect:s,selectedTemplateId:c})=>{const{t:o}=j(),[b,x]=d.useState(!1),[m,u]=d.useState(""),[g,k]=d.useState(null),y=d.useRef(null),N=d.useMemo(()=>t.find(r=>r.id===c)??null,[t,c]),v=d.useMemo(()=>{const r=m.trim().toLowerCase();return r?t.filter(p=>p.name.toLowerCase().includes(r)||p.description.toLowerCase().includes(r)):t},[t,m]);return d.useEffect(()=>{if(!b)return;const r=h=>{h.key==="Escape"&&x(!1)},p=h=>{const l=y.current;l&&!l.contains(h.target)&&x(!1)};return document.addEventListener("keydown",r),document.addEventListener("pointerdown",p),()=>{document.removeEventListener("keydown",r),document.removeEventListener("pointerdown",p)}},[b]),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:o("addWorker.template")}),e.jsxs("div",{ref:y,className:"relative",children:[e.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":b,"data-testid":"role-template-picker-trigger",onClick:()=>x(r=>!r),className:"flex w-full items-center justify-between gap-2 rounded border px-3 py-2 text-left text-sm transition-colors hover:bg-3",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-pri",children:N?N.name:o("addWorker.templatePickPlaceholder")}),e.jsx(M,{size:14,className:"shrink-0 text-ter","aria-hidden":!0})]}),b?e.jsxs("div",{role:"listbox","aria-label":o("addWorker.template"),"data-testid":"role-template-picker-menu",className:"elev-2 absolute left-0 right-0 top-full z-30 mt-1 flex max-h-72 flex-col overflow-hidden rounded border",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b px-2 py-1.5",style:{borderColor:"var(--border)"},children:[e.jsx(pe,{size:14,className:"text-ter","aria-hidden":!0}),e.jsx("input",{value:m,onChange:r=>u(r.currentTarget.value),placeholder:o("addWorker.templateSearchPlaceholder"),"data-testid":"role-template-search-input",className:"w-full bg-transparent text-sm text-pri outline-none placeholder:text-ter",spellCheck:!1})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:t.length===0?e.jsx("div",{"data-testid":"role-template-empty-state",className:"px-3 py-3 text-center text-sm text-ter",children:o("addWorker.templateEmpty")}):v.length===0?e.jsx("div",{className:"px-3 py-3 text-center text-sm text-ter",children:o("addWorker.templateNoMatch")}):v.map(r=>{const p=r.id===c;return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",role:"option","aria-selected":p,"data-testid":`role-template-option-${r.id}`,onClick:()=>{s(r.id),x(!1),u("")},className:"flex w-full items-center gap-2 px-3 py-1.5 pr-9 text-left text-sm text-pri hover:bg-3",style:p?{background:"var(--bg-3)"}:void 0,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),p?e.jsx(L,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]}),e.jsx("button",{type:"button","aria-label":o("addWorker.templateDeleteAria",{name:r.name}),"data-testid":`role-template-delete-${r.id}`,disabled:!!a,title:a??void 0,onClick:h=>{h.preventDefault(),h.stopPropagation(),!a&&k(r)},className:"absolute right-1 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri",children:e.jsx(U,{size:14,"aria-hidden":!0})})]},r.id)})}),c!==null?e.jsx("button",{type:"button","data-testid":"role-template-clear",onClick:()=>{s(null),x(!1),u("")},className:"border-t px-3 py-1.5 text-left text-sm text-ter transition-colors hover:bg-3 hover:text-pri",style:{borderColor:"var(--border)"},children:o("addWorker.templateClear")}):null]}):null]}),e.jsx(Y,{open:g!==null,onOpenChange:r=>{r||k(null)},title:o("addWorker.templateDeleteTitle"),description:g?o("addWorker.templateDeleteConfirm",{name:g.name}):"",confirmLabel:o("addWorker.templateDeleteConfirmLabel"),confirmKind:"danger",onConfirm:()=>{if(!g||a)return;const r=g.id;k(null),n(r)}})]})},We=({canSaveAsTemplate:t,modified:a,onChange:n,onReset:s,onSaveAsTemplate:c,roleDescription:o,templateBusy:b,workerRole:x,writeDisabledReason:m})=>{const{t:u,language:g}=j(),[k,y]=d.useState(!1),[N,v]=d.useState(!1),[r,p]=d.useState("");d.useEffect(()=>{(x==="custom"||a)&&y(!0)},[a,x]),d.useEffect(()=>{t||(v(!1),p(""))},[t]);const h=g==="zh"?"点击展开":"Click to expand";return e.jsxs("details",{open:k,onToggle:l=>y(l.currentTarget.open),className:"group flex flex-col gap-2",children:[e.jsxs("summary",{className:"flex cursor-pointer select-none items-center justify-between gap-2 list-none rounded-lg p-2 -mx-2 hover:bg-3/50 transition-colors group/summary",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded bg-3 border border-bright/30 text-ter transition-colors group-hover/summary:text-pri group-hover/summary:border-accent/40",children:e.jsx(M,{size:12,"aria-hidden":!0,className:"-rotate-90 transition-transform duration-150 group-open:rotate-0"})}),e.jsx("span",{className:"text-sm font-semibold text-pri transition-colors group-hover/summary:text-accent",children:u("addWorker.roleInstructions")}),a?e.jsxs("span",{className:"text-xs text-ter",children:["· ",u("addWorker.modifiedFrom",{role:u(I(x))})]}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[k?null:e.jsx("span",{className:"text-[10px] text-ter font-semibold tracking-wider uppercase opacity-60 group-hover/summary:opacity-100 group-hover/summary:text-accent transition-all pr-1",children:h}),t&&!N?e.jsxs("button",{type:"button","data-testid":"role-template-save",disabled:!!m,title:m??void 0,onClick:l=>{l.preventDefault(),l.stopPropagation(),v(!0)},className:"flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium transition-colors hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",style:{color:"var(--accent)",background:"color-mix(in oklab, var(--accent) 14%, transparent)"},children:[e.jsx(be,{size:12,"aria-hidden":!0}),u("addWorker.saveAsTemplate")]}):null,a?e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-ter transition-colors hover:bg-3 hover:text-sec",onClick:l=>{l.preventDefault(),l.stopPropagation(),s()},children:[e.jsx(Z,{size:12,"aria-hidden":!0}),u("addWorker.reset")]}):null]})]}),e.jsx("textarea",{"aria-label":"Role instructions",id:"add-worker-role-instructions",value:o,rows:5,onChange:l=>n(l.currentTarget.value),placeholder:x==="custom"?u("addWorker.customPlaceholder"):void 0,title:u("addWorker.roleInstructionsTitle"),className:"input mono resize-y text-sm",style:{minHeight:150},"data-testid":"role-instructions-textarea"}),t&&N?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{autoFocus:!0,value:r,onChange:l=>p(l.currentTarget.value),placeholder:u("addWorker.templateNamePlaceholder"),"data-testid":"role-template-save-name",className:"input flex-1 text-sm"}),e.jsx("button",{type:"button",disabled:b||!r.trim()||!!m,title:m??void 0,"data-testid":"role-template-save-confirm",onClick:async()=>{if(m)return;const l=r.trim();if(l)try{await c(l),v(!1),p("")}catch{}},className:"icon-btn icon-btn--primary text-xs",children:u("addWorker.templateSaveConfirm")}),e.jsx("button",{type:"button","data-testid":"role-template-save-cancel",onClick:()=>{v(!1),p("")},className:"icon-btn text-xs",children:u("common.cancel")})]}):null]})},D=({active:t,command:a,displayName:n,logoPresetId:s,notFound:c=!1,testId:o,onSelect:b})=>{const{t:x}=j(),m=e.jsx("span",{className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded border border-border bg-surface-1 text-ter","data-testid":`${o}-generic-icon`,"aria-hidden":!0,children:e.jsx(he,{size:13})});return e.jsxs("button",{type:"button",onClick:b,"aria-pressed":t,"data-testid":o,className:"selectable-card flex items-center justify-between gap-3 px-3 py-2",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(te,{commandPresetId:s,fallback:m,size:22}),e.jsxs("span",{className:"flex min-w-0 flex-col items-start gap-0.5",children:[e.jsx("span",{className:"truncate text-base font-medium text-pri",children:n}),e.jsxs("span",{className:"mono truncate text-xs text-ter",children:[a,c?` · ${x("addWorker.agentNotFound")}`:""]})]})]}),t?e.jsx(L,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]})},Se=({active:t,preset:a,onSelect:n})=>e.jsx(D,{active:t,command:a.command,displayName:a.displayName,logoPresetId:a.id,notFound:a.available===!1,testId:`agent-radio-${a.id}`,onSelect:n}),ze=({commandPresetId:t,commandPresets:a,onPresetChange:n})=>{const{t:s}=j();return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:s("addWorker.agentCli")}),a.length===0?e.jsx("div",{className:"text-sm text-ter",children:s("addWorker.loadingPresets")}):e.jsxs("div",{className:"grid grid-cols-2 gap-2 max-md:grid-cols-1",children:[a.map(c=>e.jsx(Se,{active:t===c.id,preset:c,onSelect:()=>n(c.id)},c.id)),e.jsx(D,{active:t==="",command:s("addWorker.genericCommand"),displayName:s("addWorker.genericAgent"),testId:"agent-radio-generic",onSelect:()=>n("")})]})]})},Me=({onChange:t,value:a})=>{const{t:n,language:s}=j(),[c,o]=d.useState(!1),b=a.trim(),x=s==="zh"?"点击展开":"Click to expand";return e.jsxs("details",{onToggle:m=>o(m.currentTarget.open),className:"group flex flex-col gap-2",children:[e.jsxs("summary",{className:"flex cursor-pointer select-none items-center justify-between gap-2 list-none rounded-lg p-2 -mx-2 hover:bg-3/50 transition-colors group/summary",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-3 border border-bright/30 text-ter transition-colors group-hover/summary:text-pri group-hover/summary:border-accent/40",children:e.jsx(M,{size:12,"aria-hidden":!0,className:"-rotate-90 transition-transform duration-150 group-open:rotate-0"})}),e.jsx("span",{className:"text-sm font-semibold text-pri transition-colors group-hover/summary:text-accent",children:n("addWorker.startupCommand")}),b?e.jsxs("span",{className:"truncate text-xs text-ter",children:["· ",n("addWorker.startupOverrides")]}):null]}),c?null:e.jsx("span",{className:"text-[10px] text-ter font-semibold tracking-wider uppercase opacity-60 group-hover/summary:opacity-100 group-hover/summary:text-accent transition-all pr-1",children:x})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded border bg-2 p-3",style:{borderColor:"var(--border)"},children:[e.jsx("input",{"aria-label":"Startup command",value:a,onChange:m=>t(m.currentTarget.value),placeholder:"qwen --model qwen3-coder",className:"input mono text-sm",spellCheck:!1}),e.jsx("p",{className:"text-sm leading-5 text-ter",children:n("addWorker.startupHelp",{example:"claude --resume <session-id>"})})]})]})},Le=d.lazy(()=>ue(()=>import("./MarketplaceDrawer-Dd8WIA8T.js"),__vite__mapDeps([0,1,2,3])).then(t=>({default:t.MarketplaceDrawer}))),_e=({commandPresets:t,commandPresetId:a,creating:n=!1,customTemplates:s,onApplyMarketplaceImport:c,onClose:o,onDeleteTemplate:b,onNameChange:x,onPresetChange:m,onRandomName:u,onRoleDescriptionChange:g,onRoleDescriptionReset:k,onRoleChange:y,onSaveAsTemplate:N,onStartupCommandChange:v,onSubmit:r,onTemplateChange:p,roleDescription:h,roleDescriptionDefault:l,selectedTemplateId:P,startupCommand:E,templateBusy:B,workerName:O,workerRole:W,writeDisabledReason:w})=>{const{t:i}=j(),_=ae(),C=re(),[q,$]=d.useState(!1),[H,K]=d.useState(!1),V=d.useMemo(()=>new Set(s.map(f=>f.name)),[s]),Q=f=>{c(f),_.show({kind:"success",message:i("marketplace.imported",{name:f.name})})},J=f=>{f||o()},X=h!==l,A=t.find(f=>f.id===a),T=E.trim(),G=()=>w||(O.trim()?!a&&!T?i("addWorker.pickCliOrStartup"):A?.available===!1&&!T?i("addWorker.unavailable",{name:A.displayName}):h.trim()?null:i("addWorker.emptyInstructions"):i("addWorker.enterName")),R=f=>{const F=G();if(F){f.preventDefault(),_.show({kind:"warning",message:F});return}r(f)};return e.jsxs(se,{open:!0,onOpenChange:J,children:[e.jsxs(ne,{children:[e.jsx(oe,{"data-testid":"add-worker-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4 max-md:items-end max-md:p-0",children:e.jsx(le,{"data-testid":"add-worker-content","data-mobile":C||void 0,className:`${C?"dialog-slide-up add-worker-sheet":"dialog-scale-pop"} elev-2 pointer-events-auto flex max-h-[calc(100vh-32px)] w-[560px] max-w-full flex-col overflow-hidden rounded-lg border pointer-coarse:max-h-[85dvh] max-md:w-full max-md:rounded-b-none max-md:rounded-t-xl`,style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)",...C?{height:"85dvh"}:{}},children:e.jsxs("form",{onSubmit:R,"aria-label":i("addWorker.title"),className:"flex min-h-0 flex-1 flex-col overflow-hidden max-h-full",children:[e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-3 border-b px-5 py-4 max-md:px-4",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[e.jsx(ie,{className:"text-lg font-semibold text-pri",children:i("addWorker.title")}),e.jsx(de,{className:"text-sm text-ter",children:i("addWorker.description",{command:"team send"})})]}),C?e.jsx(ce,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":i("common.closeDialog"),"data-testid":"add-worker-close",className:"-mr-1 flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-sec",style:{background:"var(--bg-2)"},children:e.jsx(me,{size:18,"aria-hidden":!0})})}):null]}),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col gap-4 overflow-y-auto px-5 py-4 max-md:gap-5 max-md:px-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:i("addWorker.name")}),e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{autoFocus:!C,value:O,onChange:f=>x(f.target.value),placeholder:i("addWorker.namePlaceholder"),className:"input w-full pr-24",style:{borderRadius:"10px"}}),e.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",children:e.jsx(xe,{label:i("addWorker.randomTooltip"),children:e.jsxs("button",{type:"button","aria-label":i("addWorker.randomAria"),className:"flex h-7 items-center gap-1.5 rounded-lg border border-bright/10 bg-3 px-2.5 text-xs font-semibold text-sec hover:text-pri hover:bg-4 active:scale-95 transition-all outline-none",onClick:u,"data-testid":"random-worker-name",children:[e.jsx(ve,{size:13,"aria-hidden":!0}),e.jsx("span",{children:i("addWorker.random")})]})})})]})]}),e.jsx(Ce,{workerRole:W,onRoleChange:y}),e.jsxs("button",{type:"button",onClick:()=>{K(!0),$(!0)},"data-testid":"open-marketplace",className:"marketplace-browse-btn flex cursor-pointer items-center gap-2 self-start rounded-lg border px-3 py-2 text-xs font-semibold text-sec outline-none transition-all duration-200 hover:text-pri hover:-translate-y-0.5 active:scale-98 shadow-sm hover:shadow-md",style:{background:"linear-gradient(to bottom, var(--bg-1), var(--bg-0))",borderColor:"var(--border-bright)","--tw-ring-color":"color-mix(in oklab, var(--accent) 45%, transparent)"},children:[e.jsx(je,{size:14,"aria-hidden":!0,className:"text-accent"}),e.jsx("span",{children:i("marketplace.openFromAddWorker")})]}),W==="custom"?e.jsx(we,{customTemplates:s,disabledReason:w,onDeleteTemplate:b,onSelect:p,selectedTemplateId:P}):null,e.jsx(We,{canSaveAsTemplate:W==="custom"&&!P&&h.trim().length>0,modified:X,onChange:g,onReset:k,onSaveAsTemplate:N,roleDescription:h,templateBusy:B,workerRole:W,writeDisabledReason:w}),e.jsx(ze,{commandPresetId:a,commandPresets:t,onPresetChange:m}),e.jsx(Me,{value:E,onChange:v})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t px-5 py-3 max-md:px-4 max-md:pb-[max(12px,env(safe-area-inset-bottom))]",style:{borderColor:"var(--border)",background:"var(--bg-2)"},children:[e.jsx("button",{type:"button",onClick:o,className:`icon-btn border border-bright/20 rounded-lg hover:bg-3 hover:text-pri transition-all active:scale-95 ${C?"flex-1":""}`,"data-testid":"add-worker-cancel",children:i("addWorker.cancel")}),e.jsx("button",{type:"submit",disabled:n||!!w,title:w??void 0,className:`icon-btn icon-btn--primary rounded-lg font-bold shadow-md hover:shadow-lg transition-all active:scale-[0.97] hover:-translate-y-0.5 ${C?"flex-[2]":""}`,"data-testid":"add-worker-submit",children:i(n?"addWorker.creating":"addWorker.create")})]})]})})})]}),H?e.jsx(d.Suspense,{fallback:null,children:e.jsx(Le,{open:q,onClose:()=>$(!1),onImport:Q,importedNames:V})}):null]})};export{_e as AddWorkerDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as I,u as R,r as c,j as e,C as W,x as oe,_ as pe,R as H,P as Z,O as G,k as K,m as X,$ as te,b as B,a0 as Ne,a1 as Ce,i as _e,z as Pe,X as Se,a2 as ue,a3 as Ee,a4 as ze,a5 as Re}from"./index-K-GG8UwR.js";const $e=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Me=I("arrow-up",$e);const De=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],Le=I("folder-search",De);const Ie=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Y=I("folder",Ie);const Ae=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],me=I("git-branch",Ae);const Oe=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],Fe=I("hard-drive",Oe);const Be=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],J=I("sliders-vertical",Be),xe=t=>{const s=t.trim();if(s.length<2)return s;const n=s[0],r=s[s.length-1];return(n==='"'||n==="'")&&n===r?s.slice(1,-1):s},We={claude:"/cli-icons/claude.png",codex:"/cli-icons/codex.png",opencode:"/cli-icons/opencode.svg",gemini:"/cli-icons/gemini.png",hermes:"/cli-icons/hermes.png",qwen:"/cli-icons/qwen.png",agy:"/cli-icons/agy.png",cursor:"/cli-icons/cursor.ico",grok:"/cli-icons/grok.ico"},ce=({id:t,className:s})=>{const[n,r]=c.useState(!1),l=We[t];return l&&!n?e.jsx("img",{src:l,alt:"",onError:()=>r(!0),className:`${s} object-contain rounded-xs ${t==="opencode"?"bg-[#ebebeb] p-[1px]":""}`}):e.jsx(pe,{size:14,className:s})},he=({error:t,onChange:s,presets:n,value:r})=>{const{t:l}=R(),[i,o]=c.useState(!1),u=c.useRef(null),h=n.find(p=>p.id===r),a=r==="",g=h?[h.command,...h.args].join(" ").trim():l(a?"workspace.preset.genericPreview":"workspace.preset.loading"),d=h?.displayName??(a?l("workspace.preset.generic"):"Claude Code (CC)"),k=n.length===0&&!a;return c.useEffect(()=>{if(!i)return;const p=x=>{u.current?.contains(x.target)||o(!1)},m=x=>{x.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[i]),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:l("workspace.preset.label")}),e.jsxs("div",{ref:u,className:"cli-select group relative",children:[e.jsx(ce,{id:r,className:"cli-select__leading w-3.5 h-3.5"}),e.jsx("button",{type:"button","aria-haspopup":"listbox","aria-expanded":i,"aria-disabled":k||void 0,className:"cli-select__field cli-select__field--button text-left","data-testid":"workspace-command-preset","data-value":r,disabled:k,onClick:()=>o(p=>!p),children:d}),e.jsx(W,{size:14,"aria-hidden":!0,className:"cli-select__trailing"}),i&&n.length>0?e.jsxs("div",{role:"listbox","aria-label":l("workspace.preset.optionsAria"),className:"cli-select__menu","data-testid":"workspace-command-preset-menu",children:[n.map(p=>{const m=p.id===r,x=p.available===!1;return e.jsxs("button",{type:"button",role:"option","aria-selected":m,"data-testid":`workspace-command-preset-option-${p.id}`,className:"cli-select__option",onClick:()=>{s(p.id),o(!1)},children:[e.jsx(oe,{size:12,"aria-hidden":!0,className:"cli-select__check",style:{opacity:m?1:0}}),e.jsx(ce,{id:p.id,className:"w-3.5 h-3.5 text-ter shrink-0"}),e.jsxs("span",{children:[p.displayName,x?l("workspace.preset.notFoundSuffix"):""]})]},p.id)}),e.jsxs("button",{type:"button",role:"option","aria-selected":a,"data-testid":"workspace-command-preset-option-generic",className:"cli-select__option",onClick:()=>{s(""),o(!1)},children:[e.jsx(oe,{size:12,"aria-hidden":!0,className:"cli-select__check",style:{opacity:a?1:0}}),e.jsx(pe,{size:14,className:"text-ter shrink-0"}),e.jsx("span",{children:l("workspace.preset.generic")})]})]}):null]}),e.jsxs("div",{className:"mono flex items-center gap-1.5 truncate text-xs text-ter",title:g,children:[e.jsx("span",{className:"text-sec",children:"$"}),e.jsx("span",{className:"truncate",children:g})]}),t?e.jsx("span",{className:"text-xs",style:{color:"var(--status-red)"},children:t}):null]})},V=t=>(t.split(/[\\/]/).filter(Boolean).pop()??"").replace(/:$/u,""),U=({children:t})=>e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:t}),Te=({probe:t,pasteFallbackDefault:s=!1,commandPresetError:n,commandPresetId:r,commandPresets:l,onCancel:i,onCommandPresetChange:o,onCreate:u,onOpenServerBrowse:h})=>{const{t:a}=R(),g=t?.path??"",d=t?.suggested_name??V(g),[k,p]=c.useState(d),[m,x]=c.useState(""),[w,C]=c.useState(s),[N,_]=c.useState(!1),[E,b]=c.useState("");c.useEffect(()=>{p(t?.suggested_name??V(t?.path??""))},[t?.path,t?.suggested_name]);const j=xe(m),f=V(j),P=w&&j.length>0?j:t?.path??"",S=E.trim(),A=l.find(y=>y.id===r),z=l.length===0&&!n,O=!r&&S.length===0,D=A?.available===!1&&S.length===0,Q=O?a("workspace.preset.genericRequiresStartup"):D?a("workspace.preset.notInstalled",{name:A.displayName}):null,F=k.trim().length>0&&P.length>0&&!z&&!O&&!D,ee=()=>{F&&u({commandPresetId:r||null,name:k.trim(),path:P,...S?{startupCommand:S}:{}})};return c.useEffect(()=>{w&&j.length>0&&p(f)},[w,j,f]),e.jsx(H,{open:!0,onOpenChange:y=>!y&&i(),children:e.jsxs(Z,{children:[e.jsx(G,{"data-testid":"confirm-workspace-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(K,{"data-testid":"confirm-workspace-dialog",className:"dialog-scale-pop elev-2 pointer-events-auto flex w-[480px] max-w-full flex-col rounded-lg border",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex items-center gap-3 border-b px-5 py-4",style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:e.jsx(Y,{size:18,"aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(X,{className:"text-lg font-semibold text-pri",children:a("workspace.confirm.title")}),e.jsx(te,{className:"text-xs text-ter",children:a("workspace.confirm.description")})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(U,{children:a("workspace.field.path")}),e.jsx("input",{type:"hidden",value:t?.path??"","data-testid":"confirm-workspace-path",readOnly:!0}),e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border p-3 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("span",{className:"block truncate font-mono text-sm text-pri",title:t?.path??"",children:t?.path||a("workspace.field.pathEmptyPlaceholder")})}),t?.is_git_repository?e.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium",style:{background:"color-mix(in oklab, var(--status-blue) 12%, transparent)",color:"var(--status-blue)",border:"1px solid color-mix(in oklab, var(--status-blue) 25%, transparent)"},"data-testid":"confirm-workspace-git-badge",children:[e.jsx(me,{size:12,"aria-hidden":!0}),e.jsx("span",{className:"truncate max-w-[90px]",children:t.current_branch??a("workspace.git.detached")})]}):null]}),t?.ok&&!t?.is_git_repository&&e.jsx("span",{className:"text-xs text-ter pl-1",children:a("workspace.git.none")})]}),e.jsxs("label",{className:"flex flex-col gap-2",children:[e.jsx(U,{children:a("workspace.field.name")}),e.jsx("input",{value:k,onChange:y=>p(y.target.value),placeholder:V(t?.path??"")||a("workspace.field.nameDefaultPlaceholder"),className:"input","data-testid":"confirm-workspace-name"})]}),e.jsx(he,{error:n??Q,onChange:o,presets:l,value:r}),e.jsxs("div",{className:"mt-2 rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>_(y=>!y),className:"flex w-full items-center justify-between px-3.5 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer","data-testid":"confirm-workspace-startup-toggle",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.startup")]}),N?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),N?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3.5 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx(U,{children:a("workspace.field.startup")}),e.jsx("input",{type:"text",value:E,onChange:y=>b(y.target.value),placeholder:a("workspace.field.startupPlaceholder"),className:"input mono text-sm","data-testid":"confirm-workspace-startup-command"}),e.jsx("span",{className:"text-[11px] text-ter normal-case tracking-normal leading-relaxed",children:a("workspace.startup.hint")})]}):null]}),e.jsxs("div",{className:"rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>C(y=>!y),className:"flex w-full items-center justify-between px-3.5 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer","data-testid":"confirm-workspace-paste-toggle",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.pastePath")]}),w?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),w?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3.5 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx(U,{children:a("workspace.field.absolutePath")}),e.jsx("input",{type:"text",value:m,onChange:y=>x(y.target.value),placeholder:a("workspace.field.absolutePathPlaceholder"),className:"input mono text-sm","data-testid":"confirm-workspace-paste-path"})]}):null]}),e.jsxs("button",{type:"button",onClick:h,className:"flex items-center justify-between w-full rounded-lg border border-dashed px-3.5 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 hover:text-pri transition-all cursor-pointer",style:{borderColor:"var(--border)"},"data-testid":"confirm-workspace-browse-toggle",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Y,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.browse")]}),e.jsx(B,{size:14,"aria-hidden":!0})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t px-5 py-3",style:{borderColor:"var(--border)"},children:[e.jsx("button",{type:"button",onClick:i,className:"icon-btn",children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:ee,disabled:!F,"data-testid":"confirm-workspace-create",className:"icon-btn icon-btn--primary",children:a("workspace.confirm.create")})]})]})})]})})},L="hive://windows-drives",qe=({entries:t,error:s,loading:n,onNavigate:r,onSelect:l,selected:i})=>{const{t:o}=R();return e.jsx("div",{className:"scroll-y min-h-[200px] flex-1 border-t border-b",style:{borderColor:"var(--border)"},"data-testid":"fs-entry-list",children:n?e.jsx("p",{className:"p-4 text-center text-xs text-ter",children:o("common.loading")}):s?e.jsx("p",{className:"p-4 text-center text-xs",style:{color:"var(--status-red)"},"data-testid":"fs-browse-error",children:s}):t.length===0?e.jsx("p",{className:"p-4 text-center text-xs text-ter",children:o("workspace.browse.empty")}):e.jsx("ul",{children:t.map(u=>{const h=i===u.path;return e.jsxs("li",{className:"flex items-center gap-0",children:[e.jsxs("button",{type:"button","data-testid":`fs-entry-${u.name}`,onClick:()=>l(u.path),onDoubleClick:()=>r(u.path),className:"flex flex-1 items-center gap-2 px-3 py-2 text-left text-xs hover:bg-3",style:h?{background:"var(--bg-3)",color:"var(--text-primary)"}:{color:"var(--text-primary)"},children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center text-sec",children:u.is_git_repository?e.jsx(me,{size:14}):e.jsx(Y,{size:14})}),e.jsx("span",{className:"mono flex-1 truncate",children:u.name}),u.is_git_repository?e.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:"var(--accent)"},children:o("workspace.browse.gitBadge")}):null]}),e.jsx("button",{type:"button","data-testid":`fs-entry-open-${u.name}`,onClick:()=>r(u.path),"aria-label":o("workspace.browse.openAria",{name:u.name}),className:"px-3 py-2 text-xs text-ter hover:text-pri",children:"→"})]},u.path)})})})},Ve=({probe:t,suggestedName:s,onSuggestedNameChange:n})=>{const{t:r}=R(),l=!!t&&t.ok&&t.is_dir;return e.jsxs("div",{className:"flex flex-col gap-2 rounded border p-3 text-xs",style:{background:"var(--bg-1)",borderColor:"var(--border)"},"data-testid":"fs-selection-preview",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-ter uppercase tracking-wider text-xs",children:r("workspace.browse.selected")}),t?.is_git_repository?e.jsx("span",{className:"role-badge role-badge--coder","data-testid":"fs-preview-git-badge",children:r("workspace.git.short",{branch:t.current_branch??r("workspace.git.detached")})}):l?e.jsx("span",{className:"text-ter text-xs",children:r("workspace.git.noneShort")}):null]}),e.jsx("span",{className:"mono truncate text-pri","data-testid":"fs-preview-path",children:t?.path??"—"}),e.jsxs("label",{className:"mt-1 flex flex-col gap-1 text-ter",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider",children:r("workspace.field.name")}),e.jsx("input",{type:"text",value:s,onChange:i=>n(i.target.value),disabled:!l,autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"mono rounded border px-2 py-1 text-sm text-pri disabled:opacity-50 max-md:text-base",style:{background:"var(--bg-0)",borderColor:"var(--border)"},"data-testid":"fs-preview-name-input"})]})]})},fe=t=>{const s=t.lastIndexOf("\\"),n=t.lastIndexOf("/");return s>=0&&s>n?"\\":n>=0?"/":/^[A-Za-z]:/u.test(t)?"\\":"/"},Ue=(t,s)=>{if(t===L)return s;const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean),l=r[r.length-1];return l?`~ (${l})`:t},T=t=>t.replace(/[\\/]+$/u,"")||t,le=t=>/^[A-Za-z]:($|[\\/])/u.test(t),ie=t=>/^\\\\[^\\/]+[\\/][^\\/]+/u.test(t),be=(t,s)=>le(t)&&le(s)||ie(t)&&ie(s),He=t=>{const s=/^(?:\\\\|\/\/)(?<server>[^\\/]+)[\\/](?<share>[^\\/]+)[\\/]*(?<rest>.*)$/u.exec(t);if(!s?.groups)return null;const{server:n,share:r,rest:l}=s.groups,i=`\\\\${n}\\${r}\\`;return{label:`\\\\${n}\\${r}`,rest:l,root:i}},Ze=(t,s)=>{const n=T(t),r=T(s);return be(n,r)?n.toLowerCase()===r.toLowerCase():n===r},Ge=(t,s)=>{const n=T(t),r=T(s);if(r==="/"||r==="\\")return n.startsWith(r);const l=be(n,r),i=l?n.toLowerCase():n,o=l?r.toLowerCase():r;if(i===o)return!0;if(!i.startsWith(o))return!1;const u=i[o.length];return u==="/"||u==="\\"},Ke=(t,s,n="This PC")=>{if(!s||!t)return[];const r=[{label:Ue(s,n),path:s}];if(Ze(t,s))return r;if(s===L){const a=He(t);if(a){r.push({label:a.label,path:a.root});const x=a.rest.split(/[\\/]/).filter(Boolean);let w=a.root.replace(/[\\/]+$/,"");for(const C of x)w=`${w}\\${C}`,r.push({label:C,path:w});return r}const g=/^(?<drive>[A-Za-z]:)[\\/]*(?<rest>.*)$/u.exec(t),d=g?.groups?.drive;if(!d)return r;const k=`${d}\\`;r.push({label:d,path:k});const p=(g.groups?.rest??"").split(/[\\/]/).filter(Boolean);let m=k.replace(/[\\/]+$/,"");for(const x of p)m=`${m}\\${x}`,r.push({label:x,path:m});return r}const l=T(s),i=Ge(t,l)?t.slice(l.length).replace(/^[\\/]+/,""):"";if(!i)return r;const o=fe(l),u=i.split(/[\\/]/).filter(Boolean);let h=l;for(const a of u)h=`${h}${o}${a}`,r.push({label:a,path:h});return r},de={current_path:"",entries:[],error:null,ok:!1,parent_path:null,root_path:""},Xe=t=>{const[s,n]=c.useState(de),[r,l]=c.useState(!1),[i,o]=c.useState(null),[u,h]=c.useState(null),a=c.useRef(0),g=c.useRef(0),d=c.useCallback(()=>{g.current++,o(null),h(null)},[]),k=c.useCallback(async m=>{const x=++a.current;l(!0);try{const w=await Ne(m);if(a.current!==x)return;n(w),w.ok?o(w.current_path):d()}catch{}finally{a.current===x&&l(!1)}},[d]);c.useEffect(()=>{if(!t){a.current++,n(de),d();return}k("")},[d,t,k]),c.useEffect(()=>{if(!i){h(null);return}const m=++g.current;Ce(i).then(x=>{g.current===m&&h(x)}).catch(x=>{console.debug("[hive] discarded:fsBrowser.probe (likely stale token)",x)})},[i]);const p=c.useCallback(m=>{o(m)},[]);return{browse:s,loading:r,navigate:k,probe:u,selectEntry:p,selected:i}},Ye=t=>(t.split(/[\\/]/).filter(Boolean).pop()??"").replace(/:$/u,""),ge=({commandPresetError:t,commandPresetId:s,commandPresets:n,onClose:r,onCommandPresetChange:l,onCreate:i,open:o,initialAdvanced:u=!1,manualHint:h})=>{const{t:a}=R(),g=_e(),{browse:d,loading:k,navigate:p,probe:m,selectEntry:x,selected:w}=Xe(o),[C,N]=c.useState(""),[_,E]=c.useState(u),[b,j]=c.useState(""),[f,P]=c.useState(!1),[S,A]=c.useState(""),z=xe(b),O=Ye(z);if(c.useEffect(()=>{o||(N(""),E(u),j(""),P(!1),A(""))},[o,u]),c.useEffect(()=>{m?.suggested_name&&N(m.suggested_name)},[m?.suggested_name]),c.useEffect(()=>{_&&z.length>0&&N(O)},[_,O,z]),!o)return null;const D=a("workspace.browse.drivesRoot"),Q=d.root_path===L?D:d.root_path,F=Ke(d.current_path,d.root_path,D),ee=d.root_path===L&&d.current_path!==L,y=fe(d.current_path||d.root_path),se=n.find(v=>v.id===s),q=S.trim(),ke=n.length===0&&!t,re=!s&&q.length===0,ae=se?.available===!1&&q.length===0,ve=re?a("workspace.preset.genericRequiresStartup"):ae?a("workspace.preset.notInstalled",{name:se.displayName}):null,we=C.trim().length>0&&(m?.is_dir===!0||_&&z.length>0)&&!ke&&!re&&!ae,je=()=>{const v=_&&z.length>0?z:m?.path??"";v&&i({commandPresetId:s||null,name:C.trim(),path:v,...q?{startupCommand:q}:{}})};return e.jsx(H,{open:!0,onOpenChange:v=>!v&&r(),children:e.jsxs(Z,{children:[e.jsx(G,{"data-testid":"server-browse-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center max-md:items-end max-md:p-0 p-4",children:e.jsxs(K,{"data-testid":"add-workspace-dialog","data-mobile":g||void 0,className:`${g?"dialog-slide-up":"dialog-scale-pop"} elev-2 pointer-events-auto flex w-[760px] max-w-[calc(100vw-32px)] flex-col rounded-lg border max-md:w-full max-md:max-w-full max-md:rounded-b-none max-md:rounded-t-xl`,style:{height:g?"85dvh":"min(600px, calc(100vh - 64px))",background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-5 py-4",style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:e.jsx(Y,{size:18,"aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(X,{className:"text-lg font-semibold text-pri",children:a("workspace.browse.title")}),e.jsx(te,{className:"mono truncate text-xs text-ter","data-testid":"fs-root-path",children:d.root_path?a("workspace.browse.root",{path:Q}):a("workspace.browse.rootLoading")})]}),e.jsx(Pe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":a("common.closeDialog"),className:"flex h-7 w-7 items-center justify-center rounded text-sec hover:bg-3 hover:text-pri",children:e.jsx(Se,{size:14,"aria-hidden":!0})})})]}),e.jsxs("nav",{className:"flex shrink-0 items-center gap-1 border-b px-4 py-2 text-xs",style:{borderColor:"var(--border)"},"aria-label":a("workspace.browse.breadcrumb"),"data-testid":"fs-breadcrumb",children:[e.jsxs("button",{type:"button",onClick:()=>d.parent_path?p(d.parent_path):null,disabled:!d.parent_path,"aria-label":a("workspace.browse.parentAria"),className:"flex items-center gap-1 rounded px-2 py-0.5 text-sec hover:bg-3 hover:text-pri disabled:opacity-40",children:[e.jsx(Me,{size:12,"aria-hidden":!0})," ",a("workspace.browse.up")]}),ee?e.jsxs("button",{type:"button",onClick:()=>p(L),"aria-label":a("workspace.browse.drivesAria"),"data-testid":"fs-browse-drives",className:"flex items-center gap-1 rounded px-2 py-0.5 text-sec hover:bg-3 hover:text-pri",children:[e.jsx(Fe,{size:12,"aria-hidden":!0})," ",D]}):null,e.jsx("div",{className:"mx-2 h-4 w-px",style:{background:"var(--border)"}}),F.map((v,ne)=>{const ye=ne===F.length-1;return e.jsxs("span",{className:"flex items-center gap-0.5",children:[ne>0?e.jsx("span",{className:"text-ter",children:y}):null,ye?e.jsx("span",{className:"px-1 py-0.5 font-medium text-pri",children:v.label}):e.jsx("button",{type:"button",onClick:()=>p(v.path),className:"rounded px-1 py-0.5 text-sec hover:bg-3 hover:text-pri",children:v.label})]},v.path)})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 max-md:flex-col",children:[e.jsx("div",{className:"flex min-h-0 flex-1 flex-col max-md:min-h-[40%]",children:e.jsx(qe,{entries:d.entries,error:d.ok?null:d.error,loading:k,onNavigate:p,onSelect:x,selected:w})}),e.jsxs("div",{className:"flex w-[280px] shrink-0 flex-col gap-3 border-l p-4 max-md:w-full max-md:border-l-0 max-md:border-t max-md:max-h-[45%] max-md:overflow-y-auto",style:{borderColor:"var(--border)"},children:[e.jsx(Ve,{onSuggestedNameChange:N,probe:m,suggestedName:C}),e.jsx(he,{error:t??ve,onChange:l,presets:n,value:s}),e.jsxs("div",{className:"rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>P(v=>!v),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.startup")]}),f?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),f?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:a("workspace.field.startup")}),e.jsx("input",{type:"text",value:S,onChange:v=>A(v.target.value),placeholder:a("workspace.field.startupPlaceholder"),className:"input mono text-sm max-md:text-base",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"text","data-testid":"fs-startup-command"}),e.jsx("span",{className:"text-xs normal-case tracking-normal text-ter leading-relaxed",children:a("workspace.startup.hintShort")})]}):null]}),e.jsxs("div",{className:"rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>E(v=>!v),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.pastePath")]}),_?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),_?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:a("workspace.field.absolutePath")}),h?e.jsx("span",{"data-testid":"fs-manual-hint",className:"text-xs normal-case tracking-normal text-ter leading-relaxed",children:h}):null,e.jsx("input",{type:"text",value:b,onChange:v=>j(v.target.value),placeholder:a("workspace.field.absolutePathPlaceholder"),className:"input mono text-sm max-md:text-base",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url","data-testid":"fs-manual-path"})]}):null]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t px-5 py-3",style:{borderColor:"var(--border)"},children:[e.jsx("button",{type:"button",onClick:r,className:"icon-btn",children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:je,disabled:!we,"data-testid":"add-workspace-create",className:"icon-btn icon-btn--primary",children:a("workspace.confirm.create")})]})]})})]})})},$="claude",Je=t=>t.some(s=>s.id===$&&s.available)?$:t.find(s=>s.available)?.id??t[0]?.id??$,Qe=(t=typeof navigator>"u"?void 0:navigator)=>{if(!t)return!1;const s=[t.userAgentData?.platform,t.platform,t.userAgent].filter(n=>typeof n=="string"&&n.length>0).join(" ");return/\bWindows?\b|\bWin(?:32|64|CE)\b|Windows NT/i.test(s)},et=({trigger:t,onClose:s,onCreate:n})=>{const{t:r}=R(),l=c.useRef(r);c.useEffect(()=>{l.current=r},[r]);const[i,o]=c.useState({kind:"idle"}),[u,h]=c.useState([]),[a,g]=c.useState($),[d,k]=c.useState(null),p=c.useRef({error:null,id:$,presets:[]}),m=c.useRef(s);c.useEffect(()=>{m.current=s},[s]),c.useEffect(()=>{if(t===0)return;let b=!1;k(null);const j=ue().then(f=>{if(b)return;const P=f.some(S=>S.id===p.current.id&&S.available)?p.current.id:Je(f);p.current={error:null,id:P,presets:f},h(f),g(P)}).catch(()=>{if(b)return;const f=l.current("workspace.preset.loadFailed");p.current={error:f,id:$,presets:[]},h([]),g($),k(f)});return Qe()?(o({kind:"browse"}),()=>{b=!0}):(o({kind:"picking"}),Ee().then(async f=>{if(await j,!b){if(f.canceled){if(f.error){o({kind:"error",message:f.error});return}o({kind:"idle"}),m.current();return}if(!f.supported){o({kind:"confirm",probe:null,pasteDefault:!0});return}if(!f.probe?.ok||!f.probe.is_dir){o({kind:"error",message:f.error??l.current("workspace.error.outsideSandbox")});return}o({kind:"confirm",probe:f.probe,pasteDefault:!1})}}).catch(f=>{if(b)return;const P=f instanceof Error?f.message:l.current("workspace.error.pickerFailed");o({kind:"error",message:P})}),()=>{b=!0})},[t]);const x=()=>{o({kind:"idle"}),s()},w=b=>{Promise.resolve(n(b)).then(()=>o({kind:"idle"})).catch(j=>{const f=j instanceof Error?j.message:r("workspace.error.createFailed");o({kind:"error",title:r("workspace.error.createTitle"),message:f})})},C=b=>{p.current={...p.current,id:b},g(b)},N=u.length>0||d?u:p.current.presets,_=a===""?"":N.length>0&&!N.some(b=>b.id===a&&b.available)?p.current.id:a,E=d??p.current.error;if(i.kind==="idle")return null;if(i.kind==="picking"){const b=()=>o({kind:"idle"});return e.jsx(H,{open:!0,onOpenChange:j=>!j&&b(),children:e.jsxs(Z,{children:[e.jsx(G,{className:"app-overlay fixed inset-0 z-40"}),e.jsxs(K,{"data-testid":"add-workspace-picking","aria-describedby":void 0,className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx(X,{className:"sr-only",children:r("workspace.picking.title")}),e.jsxs("div",{"data-testid":"add-workspace-picking-panel",className:"dialog-scale-pop elev-2 flex items-center gap-3 rounded-lg border px-5 py-4",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsx(Le,{size:18,"aria-hidden":!0,className:"animate-pulse",style:{color:"var(--accent)"}}),e.jsx("span",{className:"text-sm text-pri",children:r("workspace.picking.message")})]})]})]})})}return i.kind==="error"?e.jsx(H,{open:!0,onOpenChange:b=>!b&&x(),children:e.jsxs(Z,{children:[e.jsx(G,{className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(K,{"data-testid":"add-workspace-error",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--status-red) 14%, transparent)",color:"var(--status-red)"},children:e.jsx(ze,{size:18,"aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(X,{className:"text-lg font-semibold text-pri",children:i.title??r("workspace.error.pickerFailed")}),e.jsx(te,{className:"mt-1.5 break-words text-sm text-ter",children:i.message})]})]}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:x,className:"icon-btn",children:r("common.close")}),e.jsx("button",{type:"button",onClick:()=>o({kind:"confirm",probe:null,pasteDefault:!0}),className:"icon-btn icon-btn--primary",children:r("workspace.error.pastePathInstead")})]})]})})]})}):i.kind==="browse"?e.jsx(ge,{commandPresetError:E,commandPresetId:_,commandPresets:N,onClose:x,onCommandPresetChange:C,onCreate:w,open:!0}):e.jsx(Te,{commandPresetError:E,commandPresetId:_,commandPresets:N,pasteFallbackDefault:i.pasteDefault,probe:i.probe,onCancel:x,onCommandPresetChange:C,onCreate:w,onOpenServerBrowse:()=>o({kind:"browse"})})},M="claude",tt=t=>t.some(s=>s.id===M&&s.available)?M:t.find(s=>s.available)?.id??t[0]?.id??M,st=t=>{const{t:s}=R(),n=c.useRef(s);c.useEffect(()=>{n.current=s},[s]);const[r,l]=c.useState([]),[i,o]=c.useState(M),[u,h]=c.useState(null),a=c.useRef(M);return c.useEffect(()=>{if(!t)return;let d=!1;return h(null),ue().then(k=>{if(d)return;const m=k.some(x=>x.id===a.current&&x.available)?a.current:tt(k);a.current=m,l(k),o(m)}).catch(()=>{d||(a.current=M,l([]),o(M),h(n.current("workspace.preset.loadFailed")))}),()=>{d=!0}},[t]),{commandPresets:r,commandPresetId:i,commandPresetError:u,onCommandPresetChange:d=>{a.current=d,o(d)}}},rt=({trigger:t,onClose:s,onCreate:n})=>{const{t:r}=R(),[l,i]=c.useState(!1),o=c.useRef(0);c.useEffect(()=>{t>0&&t!==o.current&&i(!0)},[t]);const u=st(l),h=()=>{o.current=t,i(!1),s()},a=g=>{Promise.resolve(n(g)).then(()=>{o.current=t,i(!1)})};return l?e.jsx(ge,{open:!0,initialAdvanced:!0,manualHint:r("workspace.add.manualHint"),commandPresetError:u.commandPresetError,commandPresetId:u.commandPresetId,commandPresets:u.commandPresets,onClose:h,onCommandPresetChange:u.onCommandPresetChange,onCreate:a}):null},nt=({trigger:t,onClose:s,onCreate:n})=>{const{mode:r}=Re();return r==="mobile"?e.jsx(rt,{trigger:t,onClose:s,onCreate:n}):e.jsx(et,{trigger:t,onClose:s,onCreate:n})};export{nt as AddWorkspaceFlow};
|
|
1
|
+
import{c as I,u as R,r as c,j as e,C as W,x as oe,_ as pe,R as H,P as Z,O as G,k as K,m as X,$ as te,b as B,a0 as Ne,a1 as Ce,i as _e,z as Pe,X as Se,a2 as ue,a3 as Ee,a4 as ze,a5 as Re}from"./index-BV2k9Dts.js";const $e=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Me=I("arrow-up",$e);const De=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],Le=I("folder-search",De);const Ie=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Y=I("folder",Ie);const Ae=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],me=I("git-branch",Ae);const Oe=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],Fe=I("hard-drive",Oe);const Be=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],J=I("sliders-vertical",Be),xe=t=>{const s=t.trim();if(s.length<2)return s;const n=s[0],r=s[s.length-1];return(n==='"'||n==="'")&&n===r?s.slice(1,-1):s},We={claude:"/cli-icons/claude.png",codex:"/cli-icons/codex.png",opencode:"/cli-icons/opencode.svg",gemini:"/cli-icons/gemini.png",hermes:"/cli-icons/hermes.png",qwen:"/cli-icons/qwen.png",agy:"/cli-icons/agy.png",cursor:"/cli-icons/cursor.ico",grok:"/cli-icons/grok.ico"},ce=({id:t,className:s})=>{const[n,r]=c.useState(!1),l=We[t];return l&&!n?e.jsx("img",{src:l,alt:"",onError:()=>r(!0),className:`${s} object-contain rounded-xs ${t==="opencode"?"bg-[#ebebeb] p-[1px]":""}`}):e.jsx(pe,{size:14,className:s})},he=({error:t,onChange:s,presets:n,value:r})=>{const{t:l}=R(),[i,o]=c.useState(!1),u=c.useRef(null),h=n.find(p=>p.id===r),a=r==="",g=h?[h.command,...h.args].join(" ").trim():l(a?"workspace.preset.genericPreview":"workspace.preset.loading"),d=h?.displayName??(a?l("workspace.preset.generic"):"Claude Code (CC)"),k=n.length===0&&!a;return c.useEffect(()=>{if(!i)return;const p=x=>{u.current?.contains(x.target)||o(!1)},m=x=>{x.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[i]),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:l("workspace.preset.label")}),e.jsxs("div",{ref:u,className:"cli-select group relative",children:[e.jsx(ce,{id:r,className:"cli-select__leading w-3.5 h-3.5"}),e.jsx("button",{type:"button","aria-haspopup":"listbox","aria-expanded":i,"aria-disabled":k||void 0,className:"cli-select__field cli-select__field--button text-left","data-testid":"workspace-command-preset","data-value":r,disabled:k,onClick:()=>o(p=>!p),children:d}),e.jsx(W,{size:14,"aria-hidden":!0,className:"cli-select__trailing"}),i&&n.length>0?e.jsxs("div",{role:"listbox","aria-label":l("workspace.preset.optionsAria"),className:"cli-select__menu","data-testid":"workspace-command-preset-menu",children:[n.map(p=>{const m=p.id===r,x=p.available===!1;return e.jsxs("button",{type:"button",role:"option","aria-selected":m,"data-testid":`workspace-command-preset-option-${p.id}`,className:"cli-select__option",onClick:()=>{s(p.id),o(!1)},children:[e.jsx(oe,{size:12,"aria-hidden":!0,className:"cli-select__check",style:{opacity:m?1:0}}),e.jsx(ce,{id:p.id,className:"w-3.5 h-3.5 text-ter shrink-0"}),e.jsxs("span",{children:[p.displayName,x?l("workspace.preset.notFoundSuffix"):""]})]},p.id)}),e.jsxs("button",{type:"button",role:"option","aria-selected":a,"data-testid":"workspace-command-preset-option-generic",className:"cli-select__option",onClick:()=>{s(""),o(!1)},children:[e.jsx(oe,{size:12,"aria-hidden":!0,className:"cli-select__check",style:{opacity:a?1:0}}),e.jsx(pe,{size:14,className:"text-ter shrink-0"}),e.jsx("span",{children:l("workspace.preset.generic")})]})]}):null]}),e.jsxs("div",{className:"mono flex items-center gap-1.5 truncate text-xs text-ter",title:g,children:[e.jsx("span",{className:"text-sec",children:"$"}),e.jsx("span",{className:"truncate",children:g})]}),t?e.jsx("span",{className:"text-xs",style:{color:"var(--status-red)"},children:t}):null]})},V=t=>(t.split(/[\\/]/).filter(Boolean).pop()??"").replace(/:$/u,""),U=({children:t})=>e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:t}),Te=({probe:t,pasteFallbackDefault:s=!1,commandPresetError:n,commandPresetId:r,commandPresets:l,onCancel:i,onCommandPresetChange:o,onCreate:u,onOpenServerBrowse:h})=>{const{t:a}=R(),g=t?.path??"",d=t?.suggested_name??V(g),[k,p]=c.useState(d),[m,x]=c.useState(""),[w,C]=c.useState(s),[N,_]=c.useState(!1),[E,b]=c.useState("");c.useEffect(()=>{p(t?.suggested_name??V(t?.path??""))},[t?.path,t?.suggested_name]);const j=xe(m),f=V(j),P=w&&j.length>0?j:t?.path??"",S=E.trim(),A=l.find(y=>y.id===r),z=l.length===0&&!n,O=!r&&S.length===0,D=A?.available===!1&&S.length===0,Q=O?a("workspace.preset.genericRequiresStartup"):D?a("workspace.preset.notInstalled",{name:A.displayName}):null,F=k.trim().length>0&&P.length>0&&!z&&!O&&!D,ee=()=>{F&&u({commandPresetId:r||null,name:k.trim(),path:P,...S?{startupCommand:S}:{}})};return c.useEffect(()=>{w&&j.length>0&&p(f)},[w,j,f]),e.jsx(H,{open:!0,onOpenChange:y=>!y&&i(),children:e.jsxs(Z,{children:[e.jsx(G,{"data-testid":"confirm-workspace-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(K,{"data-testid":"confirm-workspace-dialog",className:"dialog-scale-pop elev-2 pointer-events-auto flex w-[480px] max-w-full flex-col rounded-lg border",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex items-center gap-3 border-b px-5 py-4",style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:e.jsx(Y,{size:18,"aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(X,{className:"text-lg font-semibold text-pri",children:a("workspace.confirm.title")}),e.jsx(te,{className:"text-xs text-ter",children:a("workspace.confirm.description")})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(U,{children:a("workspace.field.path")}),e.jsx("input",{type:"hidden",value:t?.path??"","data-testid":"confirm-workspace-path",readOnly:!0}),e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border p-3 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("span",{className:"block truncate font-mono text-sm text-pri",title:t?.path??"",children:t?.path||a("workspace.field.pathEmptyPlaceholder")})}),t?.is_git_repository?e.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium",style:{background:"color-mix(in oklab, var(--status-blue) 12%, transparent)",color:"var(--status-blue)",border:"1px solid color-mix(in oklab, var(--status-blue) 25%, transparent)"},"data-testid":"confirm-workspace-git-badge",children:[e.jsx(me,{size:12,"aria-hidden":!0}),e.jsx("span",{className:"truncate max-w-[90px]",children:t.current_branch??a("workspace.git.detached")})]}):null]}),t?.ok&&!t?.is_git_repository&&e.jsx("span",{className:"text-xs text-ter pl-1",children:a("workspace.git.none")})]}),e.jsxs("label",{className:"flex flex-col gap-2",children:[e.jsx(U,{children:a("workspace.field.name")}),e.jsx("input",{value:k,onChange:y=>p(y.target.value),placeholder:V(t?.path??"")||a("workspace.field.nameDefaultPlaceholder"),className:"input","data-testid":"confirm-workspace-name"})]}),e.jsx(he,{error:n??Q,onChange:o,presets:l,value:r}),e.jsxs("div",{className:"mt-2 rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>_(y=>!y),className:"flex w-full items-center justify-between px-3.5 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer","data-testid":"confirm-workspace-startup-toggle",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.startup")]}),N?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),N?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3.5 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx(U,{children:a("workspace.field.startup")}),e.jsx("input",{type:"text",value:E,onChange:y=>b(y.target.value),placeholder:a("workspace.field.startupPlaceholder"),className:"input mono text-sm","data-testid":"confirm-workspace-startup-command"}),e.jsx("span",{className:"text-[11px] text-ter normal-case tracking-normal leading-relaxed",children:a("workspace.startup.hint")})]}):null]}),e.jsxs("div",{className:"rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>C(y=>!y),className:"flex w-full items-center justify-between px-3.5 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer","data-testid":"confirm-workspace-paste-toggle",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.pastePath")]}),w?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),w?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3.5 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx(U,{children:a("workspace.field.absolutePath")}),e.jsx("input",{type:"text",value:m,onChange:y=>x(y.target.value),placeholder:a("workspace.field.absolutePathPlaceholder"),className:"input mono text-sm","data-testid":"confirm-workspace-paste-path"})]}):null]}),e.jsxs("button",{type:"button",onClick:h,className:"flex items-center justify-between w-full rounded-lg border border-dashed px-3.5 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 hover:text-pri transition-all cursor-pointer",style:{borderColor:"var(--border)"},"data-testid":"confirm-workspace-browse-toggle",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Y,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.browse")]}),e.jsx(B,{size:14,"aria-hidden":!0})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t px-5 py-3",style:{borderColor:"var(--border)"},children:[e.jsx("button",{type:"button",onClick:i,className:"icon-btn",children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:ee,disabled:!F,"data-testid":"confirm-workspace-create",className:"icon-btn icon-btn--primary",children:a("workspace.confirm.create")})]})]})})]})})},L="hive://windows-drives",qe=({entries:t,error:s,loading:n,onNavigate:r,onSelect:l,selected:i})=>{const{t:o}=R();return e.jsx("div",{className:"scroll-y min-h-[200px] flex-1 border-t border-b",style:{borderColor:"var(--border)"},"data-testid":"fs-entry-list",children:n?e.jsx("p",{className:"p-4 text-center text-xs text-ter",children:o("common.loading")}):s?e.jsx("p",{className:"p-4 text-center text-xs",style:{color:"var(--status-red)"},"data-testid":"fs-browse-error",children:s}):t.length===0?e.jsx("p",{className:"p-4 text-center text-xs text-ter",children:o("workspace.browse.empty")}):e.jsx("ul",{children:t.map(u=>{const h=i===u.path;return e.jsxs("li",{className:"flex items-center gap-0",children:[e.jsxs("button",{type:"button","data-testid":`fs-entry-${u.name}`,onClick:()=>l(u.path),onDoubleClick:()=>r(u.path),className:"flex flex-1 items-center gap-2 px-3 py-2 text-left text-xs hover:bg-3",style:h?{background:"var(--bg-3)",color:"var(--text-primary)"}:{color:"var(--text-primary)"},children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center text-sec",children:u.is_git_repository?e.jsx(me,{size:14}):e.jsx(Y,{size:14})}),e.jsx("span",{className:"mono flex-1 truncate",children:u.name}),u.is_git_repository?e.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:"var(--accent)"},children:o("workspace.browse.gitBadge")}):null]}),e.jsx("button",{type:"button","data-testid":`fs-entry-open-${u.name}`,onClick:()=>r(u.path),"aria-label":o("workspace.browse.openAria",{name:u.name}),className:"px-3 py-2 text-xs text-ter hover:text-pri",children:"→"})]},u.path)})})})},Ve=({probe:t,suggestedName:s,onSuggestedNameChange:n})=>{const{t:r}=R(),l=!!t&&t.ok&&t.is_dir;return e.jsxs("div",{className:"flex flex-col gap-2 rounded border p-3 text-xs",style:{background:"var(--bg-1)",borderColor:"var(--border)"},"data-testid":"fs-selection-preview",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-ter uppercase tracking-wider text-xs",children:r("workspace.browse.selected")}),t?.is_git_repository?e.jsx("span",{className:"role-badge role-badge--coder","data-testid":"fs-preview-git-badge",children:r("workspace.git.short",{branch:t.current_branch??r("workspace.git.detached")})}):l?e.jsx("span",{className:"text-ter text-xs",children:r("workspace.git.noneShort")}):null]}),e.jsx("span",{className:"mono truncate text-pri","data-testid":"fs-preview-path",children:t?.path??"—"}),e.jsxs("label",{className:"mt-1 flex flex-col gap-1 text-ter",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider",children:r("workspace.field.name")}),e.jsx("input",{type:"text",value:s,onChange:i=>n(i.target.value),disabled:!l,autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"mono rounded border px-2 py-1 text-sm text-pri disabled:opacity-50 max-md:text-base",style:{background:"var(--bg-0)",borderColor:"var(--border)"},"data-testid":"fs-preview-name-input"})]})]})},fe=t=>{const s=t.lastIndexOf("\\"),n=t.lastIndexOf("/");return s>=0&&s>n?"\\":n>=0?"/":/^[A-Za-z]:/u.test(t)?"\\":"/"},Ue=(t,s)=>{if(t===L)return s;const r=t.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean),l=r[r.length-1];return l?`~ (${l})`:t},T=t=>t.replace(/[\\/]+$/u,"")||t,le=t=>/^[A-Za-z]:($|[\\/])/u.test(t),ie=t=>/^\\\\[^\\/]+[\\/][^\\/]+/u.test(t),be=(t,s)=>le(t)&&le(s)||ie(t)&&ie(s),He=t=>{const s=/^(?:\\\\|\/\/)(?<server>[^\\/]+)[\\/](?<share>[^\\/]+)[\\/]*(?<rest>.*)$/u.exec(t);if(!s?.groups)return null;const{server:n,share:r,rest:l}=s.groups,i=`\\\\${n}\\${r}\\`;return{label:`\\\\${n}\\${r}`,rest:l,root:i}},Ze=(t,s)=>{const n=T(t),r=T(s);return be(n,r)?n.toLowerCase()===r.toLowerCase():n===r},Ge=(t,s)=>{const n=T(t),r=T(s);if(r==="/"||r==="\\")return n.startsWith(r);const l=be(n,r),i=l?n.toLowerCase():n,o=l?r.toLowerCase():r;if(i===o)return!0;if(!i.startsWith(o))return!1;const u=i[o.length];return u==="/"||u==="\\"},Ke=(t,s,n="This PC")=>{if(!s||!t)return[];const r=[{label:Ue(s,n),path:s}];if(Ze(t,s))return r;if(s===L){const a=He(t);if(a){r.push({label:a.label,path:a.root});const x=a.rest.split(/[\\/]/).filter(Boolean);let w=a.root.replace(/[\\/]+$/,"");for(const C of x)w=`${w}\\${C}`,r.push({label:C,path:w});return r}const g=/^(?<drive>[A-Za-z]:)[\\/]*(?<rest>.*)$/u.exec(t),d=g?.groups?.drive;if(!d)return r;const k=`${d}\\`;r.push({label:d,path:k});const p=(g.groups?.rest??"").split(/[\\/]/).filter(Boolean);let m=k.replace(/[\\/]+$/,"");for(const x of p)m=`${m}\\${x}`,r.push({label:x,path:m});return r}const l=T(s),i=Ge(t,l)?t.slice(l.length).replace(/^[\\/]+/,""):"";if(!i)return r;const o=fe(l),u=i.split(/[\\/]/).filter(Boolean);let h=l;for(const a of u)h=`${h}${o}${a}`,r.push({label:a,path:h});return r},de={current_path:"",entries:[],error:null,ok:!1,parent_path:null,root_path:""},Xe=t=>{const[s,n]=c.useState(de),[r,l]=c.useState(!1),[i,o]=c.useState(null),[u,h]=c.useState(null),a=c.useRef(0),g=c.useRef(0),d=c.useCallback(()=>{g.current++,o(null),h(null)},[]),k=c.useCallback(async m=>{const x=++a.current;l(!0);try{const w=await Ne(m);if(a.current!==x)return;n(w),w.ok?o(w.current_path):d()}catch{}finally{a.current===x&&l(!1)}},[d]);c.useEffect(()=>{if(!t){a.current++,n(de),d();return}k("")},[d,t,k]),c.useEffect(()=>{if(!i){h(null);return}const m=++g.current;Ce(i).then(x=>{g.current===m&&h(x)}).catch(x=>{console.debug("[hive] discarded:fsBrowser.probe (likely stale token)",x)})},[i]);const p=c.useCallback(m=>{o(m)},[]);return{browse:s,loading:r,navigate:k,probe:u,selectEntry:p,selected:i}},Ye=t=>(t.split(/[\\/]/).filter(Boolean).pop()??"").replace(/:$/u,""),ge=({commandPresetError:t,commandPresetId:s,commandPresets:n,onClose:r,onCommandPresetChange:l,onCreate:i,open:o,initialAdvanced:u=!1,manualHint:h})=>{const{t:a}=R(),g=_e(),{browse:d,loading:k,navigate:p,probe:m,selectEntry:x,selected:w}=Xe(o),[C,N]=c.useState(""),[_,E]=c.useState(u),[b,j]=c.useState(""),[f,P]=c.useState(!1),[S,A]=c.useState(""),z=xe(b),O=Ye(z);if(c.useEffect(()=>{o||(N(""),E(u),j(""),P(!1),A(""))},[o,u]),c.useEffect(()=>{m?.suggested_name&&N(m.suggested_name)},[m?.suggested_name]),c.useEffect(()=>{_&&z.length>0&&N(O)},[_,O,z]),!o)return null;const D=a("workspace.browse.drivesRoot"),Q=d.root_path===L?D:d.root_path,F=Ke(d.current_path,d.root_path,D),ee=d.root_path===L&&d.current_path!==L,y=fe(d.current_path||d.root_path),se=n.find(v=>v.id===s),q=S.trim(),ke=n.length===0&&!t,re=!s&&q.length===0,ae=se?.available===!1&&q.length===0,ve=re?a("workspace.preset.genericRequiresStartup"):ae?a("workspace.preset.notInstalled",{name:se.displayName}):null,we=C.trim().length>0&&(m?.is_dir===!0||_&&z.length>0)&&!ke&&!re&&!ae,je=()=>{const v=_&&z.length>0?z:m?.path??"";v&&i({commandPresetId:s||null,name:C.trim(),path:v,...q?{startupCommand:q}:{}})};return e.jsx(H,{open:!0,onOpenChange:v=>!v&&r(),children:e.jsxs(Z,{children:[e.jsx(G,{"data-testid":"server-browse-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center max-md:items-end max-md:p-0 p-4",children:e.jsxs(K,{"data-testid":"add-workspace-dialog","data-mobile":g||void 0,className:`${g?"dialog-slide-up":"dialog-scale-pop"} elev-2 pointer-events-auto flex w-[760px] max-w-[calc(100vw-32px)] flex-col rounded-lg border max-md:w-full max-md:max-w-full max-md:rounded-b-none max-md:rounded-t-xl`,style:{height:g?"85dvh":"min(600px, calc(100vh - 64px))",background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-5 py-4",style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:e.jsx(Y,{size:18,"aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(X,{className:"text-lg font-semibold text-pri",children:a("workspace.browse.title")}),e.jsx(te,{className:"mono truncate text-xs text-ter","data-testid":"fs-root-path",children:d.root_path?a("workspace.browse.root",{path:Q}):a("workspace.browse.rootLoading")})]}),e.jsx(Pe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":a("common.closeDialog"),className:"flex h-7 w-7 items-center justify-center rounded text-sec hover:bg-3 hover:text-pri",children:e.jsx(Se,{size:14,"aria-hidden":!0})})})]}),e.jsxs("nav",{className:"flex shrink-0 items-center gap-1 border-b px-4 py-2 text-xs",style:{borderColor:"var(--border)"},"aria-label":a("workspace.browse.breadcrumb"),"data-testid":"fs-breadcrumb",children:[e.jsxs("button",{type:"button",onClick:()=>d.parent_path?p(d.parent_path):null,disabled:!d.parent_path,"aria-label":a("workspace.browse.parentAria"),className:"flex items-center gap-1 rounded px-2 py-0.5 text-sec hover:bg-3 hover:text-pri disabled:opacity-40",children:[e.jsx(Me,{size:12,"aria-hidden":!0})," ",a("workspace.browse.up")]}),ee?e.jsxs("button",{type:"button",onClick:()=>p(L),"aria-label":a("workspace.browse.drivesAria"),"data-testid":"fs-browse-drives",className:"flex items-center gap-1 rounded px-2 py-0.5 text-sec hover:bg-3 hover:text-pri",children:[e.jsx(Fe,{size:12,"aria-hidden":!0})," ",D]}):null,e.jsx("div",{className:"mx-2 h-4 w-px",style:{background:"var(--border)"}}),F.map((v,ne)=>{const ye=ne===F.length-1;return e.jsxs("span",{className:"flex items-center gap-0.5",children:[ne>0?e.jsx("span",{className:"text-ter",children:y}):null,ye?e.jsx("span",{className:"px-1 py-0.5 font-medium text-pri",children:v.label}):e.jsx("button",{type:"button",onClick:()=>p(v.path),className:"rounded px-1 py-0.5 text-sec hover:bg-3 hover:text-pri",children:v.label})]},v.path)})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 max-md:flex-col",children:[e.jsx("div",{className:"flex min-h-0 flex-1 flex-col max-md:min-h-[40%]",children:e.jsx(qe,{entries:d.entries,error:d.ok?null:d.error,loading:k,onNavigate:p,onSelect:x,selected:w})}),e.jsxs("div",{className:"flex w-[280px] shrink-0 flex-col gap-3 border-l p-4 max-md:w-full max-md:border-l-0 max-md:border-t max-md:max-h-[45%] max-md:overflow-y-auto",style:{borderColor:"var(--border)"},children:[e.jsx(Ve,{onSuggestedNameChange:N,probe:m,suggestedName:C}),e.jsx(he,{error:t??ve,onChange:l,presets:n,value:s}),e.jsxs("div",{className:"rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>P(v=>!v),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.startup")]}),f?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),f?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:a("workspace.field.startup")}),e.jsx("input",{type:"text",value:S,onChange:v=>A(v.target.value),placeholder:a("workspace.field.startupPlaceholder"),className:"input mono text-sm max-md:text-base",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"text","data-testid":"fs-startup-command"}),e.jsx("span",{className:"text-xs normal-case tracking-normal text-ter leading-relaxed",children:a("workspace.startup.hintShort")})]}):null]}),e.jsxs("div",{className:"rounded-lg border overflow-hidden transition-all",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[e.jsxs("button",{type:"button",onClick:()=>E(v=>!v),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-sec hover:bg-3 transition-colors cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(J,{size:12,"aria-hidden":!0,className:"text-ter"}),a("workspace.advanced.pastePath")]}),_?e.jsx(W,{size:14,"aria-hidden":!0}):e.jsx(B,{size:14,"aria-hidden":!0})]}),_?e.jsxs("div",{className:"flex flex-col gap-2 border-t p-3 transition-all",style:{background:"var(--bg-2)",borderColor:"var(--border)"},children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ter",children:a("workspace.field.absolutePath")}),h?e.jsx("span",{"data-testid":"fs-manual-hint",className:"text-xs normal-case tracking-normal text-ter leading-relaxed",children:h}):null,e.jsx("input",{type:"text",value:b,onChange:v=>j(v.target.value),placeholder:a("workspace.field.absolutePathPlaceholder"),className:"input mono text-sm max-md:text-base",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url","data-testid":"fs-manual-path"})]}):null]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t px-5 py-3",style:{borderColor:"var(--border)"},children:[e.jsx("button",{type:"button",onClick:r,className:"icon-btn",children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:je,disabled:!we,"data-testid":"add-workspace-create",className:"icon-btn icon-btn--primary",children:a("workspace.confirm.create")})]})]})})]})})},$="claude",Je=t=>t.some(s=>s.id===$&&s.available)?$:t.find(s=>s.available)?.id??t[0]?.id??$,Qe=(t=typeof navigator>"u"?void 0:navigator)=>{if(!t)return!1;const s=[t.userAgentData?.platform,t.platform,t.userAgent].filter(n=>typeof n=="string"&&n.length>0).join(" ");return/\bWindows?\b|\bWin(?:32|64|CE)\b|Windows NT/i.test(s)},et=({trigger:t,onClose:s,onCreate:n})=>{const{t:r}=R(),l=c.useRef(r);c.useEffect(()=>{l.current=r},[r]);const[i,o]=c.useState({kind:"idle"}),[u,h]=c.useState([]),[a,g]=c.useState($),[d,k]=c.useState(null),p=c.useRef({error:null,id:$,presets:[]}),m=c.useRef(s);c.useEffect(()=>{m.current=s},[s]),c.useEffect(()=>{if(t===0)return;let b=!1;k(null);const j=ue().then(f=>{if(b)return;const P=f.some(S=>S.id===p.current.id&&S.available)?p.current.id:Je(f);p.current={error:null,id:P,presets:f},h(f),g(P)}).catch(()=>{if(b)return;const f=l.current("workspace.preset.loadFailed");p.current={error:f,id:$,presets:[]},h([]),g($),k(f)});return Qe()?(o({kind:"browse"}),()=>{b=!0}):(o({kind:"picking"}),Ee().then(async f=>{if(await j,!b){if(f.canceled){if(f.error){o({kind:"error",message:f.error});return}o({kind:"idle"}),m.current();return}if(!f.supported){o({kind:"confirm",probe:null,pasteDefault:!0});return}if(!f.probe?.ok||!f.probe.is_dir){o({kind:"error",message:f.error??l.current("workspace.error.outsideSandbox")});return}o({kind:"confirm",probe:f.probe,pasteDefault:!1})}}).catch(f=>{if(b)return;const P=f instanceof Error?f.message:l.current("workspace.error.pickerFailed");o({kind:"error",message:P})}),()=>{b=!0})},[t]);const x=()=>{o({kind:"idle"}),s()},w=b=>{Promise.resolve(n(b)).then(()=>o({kind:"idle"})).catch(j=>{const f=j instanceof Error?j.message:r("workspace.error.createFailed");o({kind:"error",title:r("workspace.error.createTitle"),message:f})})},C=b=>{p.current={...p.current,id:b},g(b)},N=u.length>0||d?u:p.current.presets,_=a===""?"":N.length>0&&!N.some(b=>b.id===a&&b.available)?p.current.id:a,E=d??p.current.error;if(i.kind==="idle")return null;if(i.kind==="picking"){const b=()=>o({kind:"idle"});return e.jsx(H,{open:!0,onOpenChange:j=>!j&&b(),children:e.jsxs(Z,{children:[e.jsx(G,{className:"app-overlay fixed inset-0 z-40"}),e.jsxs(K,{"data-testid":"add-workspace-picking","aria-describedby":void 0,className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx(X,{className:"sr-only",children:r("workspace.picking.title")}),e.jsxs("div",{"data-testid":"add-workspace-picking-panel",className:"dialog-scale-pop elev-2 flex items-center gap-3 rounded-lg border px-5 py-4",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsx(Le,{size:18,"aria-hidden":!0,className:"animate-pulse",style:{color:"var(--accent)"}}),e.jsx("span",{className:"text-sm text-pri",children:r("workspace.picking.message")})]})]})]})})}return i.kind==="error"?e.jsx(H,{open:!0,onOpenChange:b=>!b&&x(),children:e.jsxs(Z,{children:[e.jsx(G,{className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(K,{"data-testid":"add-workspace-error",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--status-red) 14%, transparent)",color:"var(--status-red)"},children:e.jsx(ze,{size:18,"aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(X,{className:"text-lg font-semibold text-pri",children:i.title??r("workspace.error.pickerFailed")}),e.jsx(te,{className:"mt-1.5 break-words text-sm text-ter",children:i.message})]})]}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:x,className:"icon-btn",children:r("common.close")}),e.jsx("button",{type:"button",onClick:()=>o({kind:"confirm",probe:null,pasteDefault:!0}),className:"icon-btn icon-btn--primary",children:r("workspace.error.pastePathInstead")})]})]})})]})}):i.kind==="browse"?e.jsx(ge,{commandPresetError:E,commandPresetId:_,commandPresets:N,onClose:x,onCommandPresetChange:C,onCreate:w,open:!0}):e.jsx(Te,{commandPresetError:E,commandPresetId:_,commandPresets:N,pasteFallbackDefault:i.pasteDefault,probe:i.probe,onCancel:x,onCommandPresetChange:C,onCreate:w,onOpenServerBrowse:()=>o({kind:"browse"})})},M="claude",tt=t=>t.some(s=>s.id===M&&s.available)?M:t.find(s=>s.available)?.id??t[0]?.id??M,st=t=>{const{t:s}=R(),n=c.useRef(s);c.useEffect(()=>{n.current=s},[s]);const[r,l]=c.useState([]),[i,o]=c.useState(M),[u,h]=c.useState(null),a=c.useRef(M);return c.useEffect(()=>{if(!t)return;let d=!1;return h(null),ue().then(k=>{if(d)return;const m=k.some(x=>x.id===a.current&&x.available)?a.current:tt(k);a.current=m,l(k),o(m)}).catch(()=>{d||(a.current=M,l([]),o(M),h(n.current("workspace.preset.loadFailed")))}),()=>{d=!0}},[t]),{commandPresets:r,commandPresetId:i,commandPresetError:u,onCommandPresetChange:d=>{a.current=d,o(d)}}},rt=({trigger:t,onClose:s,onCreate:n})=>{const{t:r}=R(),[l,i]=c.useState(!1),o=c.useRef(0);c.useEffect(()=>{t>0&&t!==o.current&&i(!0)},[t]);const u=st(l),h=()=>{o.current=t,i(!1),s()},a=g=>{Promise.resolve(n(g)).then(()=>{o.current=t,i(!1)})};return l?e.jsx(ge,{open:!0,initialAdvanced:!0,manualHint:r("workspace.add.manualHint"),commandPresetError:u.commandPresetError,commandPresetId:u.commandPresetId,commandPresets:u.commandPresets,onClose:h,onCommandPresetChange:u.onCommandPresetChange,onCreate:a}):null},nt=({trigger:t,onClose:s,onCreate:n})=>{const{mode:r}=Re();return r==="mobile"?e.jsx(rt,{trigger:t,onClose:s,onCreate:n}):e.jsx(et,{trigger:t,onClose:s,onCreate:n})};export{nt as AddWorkspaceFlow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as f,r as h,j as e,R as j,P as b,O as N,k as v,$ as g,m as c}from"./index-
|
|
1
|
+
import{u as f,r as h,j as e,R as j,P as b,O as N,k as v,$ as g,m as c}from"./index-BV2k9Dts.js";const y=({open:o,onClose:r,onAddWorkspace:d,onTryDemo:x})=>{const{t:s}=f(),[l,n]=h.useState(0),m=t=>{t||(n(0),r())},i=(t=!0)=>{n(0),r(t)},a=l===2;return e.jsx(j,{open:o,onOpenChange:m,children:e.jsxs(b,{children:[e.jsx(N,{className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(v,{"aria-label":s("firstRun.title"),className:"dialog-scale-pop elev-2 pointer-events-auto w-[480px] max-w-[calc(100vw-32px)] rounded-lg border p-6",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[e.jsx(g,{className:"sr-only",children:s("firstRun.step",{current:l+1,total:3})}),e.jsxs("div",{className:"min-h-[200px]",children:[l===0&&e.jsxs("div",{className:"flex flex-col items-center gap-4 py-4 text-center",children:[e.jsx("div",{"aria-hidden":!0,className:"flex h-14 w-14 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 15%, transparent)",color:"var(--accent)",border:"1px solid color-mix(in oklab, var(--accent) 30%, transparent)"},children:e.jsx("img",{alt:"",className:"h-10 w-10 object-contain","data-testid":"first-run-logo",draggable:!1,src:"/logo.png"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{className:"text-xl font-semibold text-pri",children:s("firstRun.title")}),e.jsx("p",{className:"text-sm text-sec",children:s("firstRun.desc")}),e.jsx("p",{className:"text-xs text-ter",children:s("firstRun.subtitle")})]})]}),l>0&&e.jsx(c,{className:"sr-only",children:s("firstRun.title")}),l===1&&e.jsxs("div",{className:"flex flex-col gap-4 py-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-pri",children:s("firstRun.howItWorks")}),e.jsx("ol",{className:"flex flex-col gap-3",children:[{n:1,title:s("firstRun.slide1Title"),desc:s("firstRun.slide1Desc")},{n:2,title:s("firstRun.slide2Title"),desc:s("firstRun.slide2Desc")},{n:3,title:s("firstRun.slide3Title"),desc:s("firstRun.slide3Desc")}].map(({n:t,title:u,desc:p})=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-medium",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-bright)",color:"var(--accent)"},children:t}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-pri",children:u}),e.jsx("div",{className:"text-xs text-sec",children:p})]})]},t))})]}),l===2&&e.jsxs("div",{className:"flex flex-col gap-3 py-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-pri",children:s("firstRun.getStarted")}),e.jsx("p",{className:"text-sm text-sec",children:s("firstRun.optionDesc")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{d(),i(!1)},className:"icon-btn icon-btn--primary w-full justify-center",children:s("firstRun.addWorkspace")}),e.jsx("button",{type:"button",onClick:()=>{x(),i(!0)},className:"icon-btn w-full justify-center",children:s("firstRun.tryDemo")}),e.jsx("button",{type:"button",onClick:()=>i(),className:"text-xs text-sec underline hover:text-pri mt-1",children:s("firstRun.skipForNow")})]})]})]}),e.jsxs("div",{className:"mt-5 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-ter",children:s("firstRun.step",{current:l+1,total:3})}),e.jsxs("div",{className:"flex items-center gap-2",children:[l>0&&!a&&e.jsx("button",{type:"button",onClick:()=>n(t=>t-1),className:"icon-btn",children:s("firstRun.back")}),!a&&e.jsx("button",{type:"button",onClick:()=>n(t=>t+1),className:"icon-btn icon-btn--primary",children:s("firstRun.next")}),e.jsx("button",{type:"button",onClick:()=>i(),className:"text-xs text-ter underline hover:text-sec",children:s("firstRun.skip")})]})]})]})})]})})};export{y as FirstRunWizard};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $n,r as R,u as at,j as h,aj as ur,ak as pr,i as hr,R as dr,P as fr,O as mr,k as gr,m as xr,$ as kr,z as br,X as Tr,al as wr}from"./index-
|
|
1
|
+
import{c as $n,r as R,u as at,j as h,aj as ur,ak as pr,i as hr,R as dr,P as fr,O as mr,k as gr,m as xr,$ as kr,z as br,X as Tr,al as wr}from"./index-BV2k9Dts.js";import{S as mn}from"./search-Bk2HQvO7.js";const yr=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],Ar=$n("bookmark",yr);const Sr=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],_r=$n("external-link",Sr),Er={academic:{en:"Academic",zh:"学术"},design:{en:"Design",zh:"设计"},engineering:{en:"Engineering",zh:"工程"},finance:{en:"Finance",zh:"金融"},"game-development":{en:"Game Development",zh:"游戏开发"},hr:{en:"HR",zh:"人力资源"},integrations:{en:"System Integrations",zh:"系统集成"},legal:{en:"Legal",zh:"法务"},marketing:{en:"Marketing",zh:"营销"},misc:{en:"Misc",zh:"其他"},"paid-media":{en:"Paid Ads",zh:"广告投放"},product:{en:"Product",zh:"产品"},"project-management":{en:"Project Management",zh:"项目管理"},sales:{en:"Sales",zh:"销售"},"spatial-computing":{en:"Spatial Computing",zh:"空间计算"},specialized:{en:"Industry Verticals",zh:"行业角色"},"supply-chain":{en:"Supply Chain",zh:"供应链"},support:{en:"Support",zh:"客户支持"},testing:{en:"Testing",zh:"测试"}},Rr=t=>t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Lt=(t,e)=>{const n=Er[t];return n?n[e]:Rr(t)},Nr=["engineering","testing","product","design","project-management","integrations","specialized","marketing","paid-media","sales","finance","legal","hr","supply-chain","support","academic","game-development","spatial-computing","misc"],vr=(t,e)=>{if(e!=="zh")return t;const n=new Map(Nr.map((s,r)=>[s,r]));return[...t].sort((s,r)=>{const a=n.get(s)??Number.POSITIVE_INFINITY,l=n.get(r)??Number.POSITIVE_INFINITY;return a!==l?a-l:s.localeCompare(r)})},Cr=({agent:t,selected:e,imported:n,onSelect:s})=>{const{t:r}=at(),a=R.useCallback(()=>s(t.path),[t.path,s]),l=t.vibe?.trim()?t.vibe:t.description,o=r("marketplace.importedBadge"),p=t.displayName??t.name,c=t.nameOverflows?p:void 0;return h.jsxs("button",{type:"button",onClick:a,"data-testid":"marketplace-agent-card","data-agent-path":t.path,"data-imported":n?"true":void 0,"data-selected":e?"true":void 0,className:"marketplace-card flex w-full cursor-pointer flex-col gap-2 rounded-xl border p-3.5 text-left outline-none transition-all duration-200 ease-out focus-visible:ring-2 focus-visible:ring-offset-0 active:scale-[0.98]",style:{"--tw-ring-color":"color-mix(in oklab, var(--accent) 55%, transparent)"},children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[h.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-bright bg-3 text-base shadow-sm",children:t.emoji||"🤖"}),h.jsx("div",{className:"flex min-w-0 flex-col",children:h.jsx("span",{className:"truncate text-sm font-semibold text-pri",title:c,children:p})})]}),n?h.jsxs("span",{role:"status","aria-label":o,title:o,"data-testid":"marketplace-agent-imported",className:"flex shrink-0 items-center gap-0.5 rounded-full px-1.5 py-0.5 text-[9px] font-semibold tracking-wide uppercase transition-colors",style:{background:e?"var(--accent)":"color-mix(in oklab, var(--accent) 15%, transparent)",color:e?"#ffffff":"var(--accent)",border:e?"none":"1px solid color-mix(in oklab, var(--accent) 25%, transparent)"},children:[h.jsx(Ar,{size:9,"aria-hidden":!0}),h.jsx("span",{className:"max-sm:hidden",children:o})]}):null]}),h.jsx("p",{className:"line-clamp-2 text-xs leading-normal text-sec mt-1",children:l})]})},Ir=R.memo(Cr);function gn(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=Array(e);n<e;n++)s[n]=t[n];return s}function Or(t){if(Array.isArray(t))return t}function Lr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var s,r,a,l,o=[],p=!0,c=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(p=(s=a.call(n)).done)&&(o.push(s.value),o.length!==e);p=!0);}catch(m){c=!0,r=m}finally{try{if(!p&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw r}}return o}}function Dr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mr(t,e){return Or(t)||Lr(t,e)||Pr(t,e)||Dr()}function Pr(t,e){if(t){if(typeof t=="string")return gn(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gn(t,e):void 0}}const Fn=Object.entries,xn=Object.setPrototypeOf,zr=Object.isFrozen,jr=Object.getPrototypeOf,$r=Object.getOwnPropertyDescriptor;let B=Object.freeze,Y=Object.seal,Ce=Object.create,Un=typeof Reflect<"u"&&Reflect,Nt=Un.apply,vt=Un.construct;B||(B=function(e){return e});Y||(Y=function(e){return e});Nt||(Nt=function(e,n){for(var s=arguments.length,r=new Array(s>2?s-2:0),a=2;a<s;a++)r[a-2]=arguments[a];return e.apply(n,r)});vt||(vt=function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return new e(...s)});const _e=L(Array.prototype.forEach),Fr=L(Array.prototype.lastIndexOf),kn=L(Array.prototype.pop),Ee=L(Array.prototype.push),Ur=L(Array.prototype.splice),H=Array.isArray,je=L(String.prototype.toLowerCase),yt=L(String.prototype.toString),bn=L(String.prototype.match),Re=L(String.prototype.replace),Tn=L(String.prototype.indexOf),Hr=L(String.prototype.trim),Br=L(Number.prototype.toString),Gr=L(Boolean.prototype.toString),wn=typeof BigInt>"u"?null:L(BigInt.prototype.toString),yn=typeof Symbol>"u"?null:L(Symbol.prototype.toString),N=L(Object.prototype.hasOwnProperty),Pe=L(Object.prototype.toString),F=L(RegExp.prototype.test),Ke=Wr(TypeError);function L(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return Nt(t,e,s)}}function Wr(t){return function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return vt(t,n)}}function b(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:je;if(xn&&xn(t,null),!H(e))return t;let s=e.length;for(;s--;){let r=e[s];if(typeof r=="string"){const a=n(r);a!==r&&(zr(e)||(e[s]=a),r=a)}t[r]=!0}return t}function qr(t){for(let e=0;e<t.length;e++)N(t,e)||(t[e]=null);return t}function W(t){const e=Ce(null);for(const s of Fn(t)){var n=Mr(s,2);const r=n[0],a=n[1];N(t,r)&&(H(a)?e[r]=qr(a):a&&typeof a=="object"&&a.constructor===Object?e[r]=W(a):e[r]=a)}return e}function Yr(t){switch(typeof t){case"string":return t;case"number":return Br(t);case"boolean":return Gr(t);case"bigint":return wn?wn(t):"0";case"symbol":return yn?yn(t):"Symbol()";case"undefined":return Pe(t);case"function":case"object":{if(t===null)return Pe(t);const e=t,n=de(e,"toString");if(typeof n=="function"){const s=n(e);return typeof s=="string"?s:Pe(s)}return Pe(t)}default:return Pe(t)}}function de(t,e){for(;t!==null;){const s=$r(t,e);if(s){if(s.get)return L(s.get);if(typeof s.value=="function")return L(s.value)}t=jr(t)}function n(){return null}return n}function Zr(t){try{return F(t,""),!0}catch{return!1}}const An=B(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),At=B(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),St=B(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Xr=B(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_t=B(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Vr=B(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Sn=B(["#text"]),_n=B(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Et=B(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),En=B(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Je=B(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qr=Y(/{{[\w\W]*|^[\w\W]*}}/g),Kr=Y(/<%[\w\W]*|^[\w\W]*%>/g),Jr=Y(/\${[\w\W]*/g),es=Y(/^data-[\-\w.\u00B7-\uFFFF]+$/),ts=Y(/^aria-[\-\w]+$/),Rn=Y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ns=Y(/^(?:\w+script|data):/i),rs=Y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ss=Y(/^html$/i),as=Y(/^[a-z][.\w]*(-[.\w]+)+$/i),Ne={element:1,text:3,progressingInstruction:7,comment:8,document:9},is=function(){return typeof window>"u"?null:window},ls=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let s=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(s=n.getAttribute(r));const a="dompurify"+(s?"#"+s:"");try{return e.createPolicy(a,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Nn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Hn(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:is();const e=x=>Hn(x);if(e.version="3.4.5",e.removed=[],!t||!t.document||t.document.nodeType!==Ne.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const s=n,r=s.currentScript,a=t.DocumentFragment,l=t.HTMLTemplateElement,o=t.Node,p=t.Element,c=t.NodeFilter,m=t.NamedNodeMap,d=m===void 0?t.NamedNodeMap||t.MozNamedAttrMap:m,k=t.HTMLFormElement,_=t.DOMParser,w=t.trustedTypes,P=p.prototype,q=de(P,"cloneNode"),xe=de(P,"remove"),ke=de(P,"nextSibling"),S=de(P,"childNodes"),te=de(P,"parentNode"),ne=o&&o.prototype?de(o.prototype,"nodeType"):null;if(typeof l=="function"){const x=n.createElement("template");x.content&&x.content.ownerDocument&&(n=x.content.ownerDocument)}let E,Q="";const ae=n,be=ae.implementation,Ue=ae.createNodeIterator,He=ae.createDocumentFragment,Be=ae.getElementsByTagName,Ge=s.importNode;let g=Nn();e.isSupported=typeof Fn=="function"&&typeof te=="function"&&be&&be.createHTMLDocument!==void 0;const v=Qr,ie=Kr,Te=Jr,Jn=es,er=ts,tr=ns,Bt=rs,nr=as;let Gt=Rn,z=null;const Wt=b({},[...An,...At,...St,..._t,...Sn]);let $=null;const qt=b({},[..._n,...Et,...En,...Je]);let C=Object.seal(Ce(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Oe=null,We=null;const le=Object.seal(Ce(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Yt=!0,ot=!0,Zt=!1,Xt=!0,oe=!1,Le=!0,pe=!1,ct=!1,ut=!1,we=!1,qe=!1,Ye=!1,Vt=!0,Qt=!1;const Kt="user-content-";let pt=!0,De=!1,ye={},K=null;const ht=b({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Jt=null;const en=b({},["audio","video","img","source","image","track"]);let dt=null;const tn=b({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ze="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",J="http://www.w3.org/1999/xhtml";let Ae=J,ft=!1,mt=null;const rr=b({},[Ze,Xe,J],yt);let gt=b({},["mi","mo","mn","ms","mtext"]),xt=b({},["annotation-xml"]);const sr=b({},["title","style","font","a","script"]);let Me=null;const ar=["application/xhtml+xml","text/html"],ir="text/html";let M=null,Se=null;const lr=n.createElement("form"),nn=function(i){return i instanceof RegExp||i instanceof Function},kt=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Se&&Se===i)return;(!i||typeof i!="object")&&(i={}),i=W(i),Me=ar.indexOf(i.PARSER_MEDIA_TYPE)===-1?ir:i.PARSER_MEDIA_TYPE,M=Me==="application/xhtml+xml"?yt:je,z=N(i,"ALLOWED_TAGS")&&H(i.ALLOWED_TAGS)?b({},i.ALLOWED_TAGS,M):Wt,$=N(i,"ALLOWED_ATTR")&&H(i.ALLOWED_ATTR)?b({},i.ALLOWED_ATTR,M):qt,mt=N(i,"ALLOWED_NAMESPACES")&&H(i.ALLOWED_NAMESPACES)?b({},i.ALLOWED_NAMESPACES,yt):rr,dt=N(i,"ADD_URI_SAFE_ATTR")&&H(i.ADD_URI_SAFE_ATTR)?b(W(tn),i.ADD_URI_SAFE_ATTR,M):tn,Jt=N(i,"ADD_DATA_URI_TAGS")&&H(i.ADD_DATA_URI_TAGS)?b(W(en),i.ADD_DATA_URI_TAGS,M):en,K=N(i,"FORBID_CONTENTS")&&H(i.FORBID_CONTENTS)?b({},i.FORBID_CONTENTS,M):ht,Oe=N(i,"FORBID_TAGS")&&H(i.FORBID_TAGS)?b({},i.FORBID_TAGS,M):W({}),We=N(i,"FORBID_ATTR")&&H(i.FORBID_ATTR)?b({},i.FORBID_ATTR,M):W({}),ye=N(i,"USE_PROFILES")?i.USE_PROFILES&&typeof i.USE_PROFILES=="object"?W(i.USE_PROFILES):i.USE_PROFILES:!1,Yt=i.ALLOW_ARIA_ATTR!==!1,ot=i.ALLOW_DATA_ATTR!==!1,Zt=i.ALLOW_UNKNOWN_PROTOCOLS||!1,Xt=i.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=i.SAFE_FOR_TEMPLATES||!1,Le=i.SAFE_FOR_XML!==!1,pe=i.WHOLE_DOCUMENT||!1,we=i.RETURN_DOM||!1,qe=i.RETURN_DOM_FRAGMENT||!1,Ye=i.RETURN_TRUSTED_TYPE||!1,ut=i.FORCE_BODY||!1,Vt=i.SANITIZE_DOM!==!1,Qt=i.SANITIZE_NAMED_PROPS||!1,pt=i.KEEP_CONTENT!==!1,De=i.IN_PLACE||!1,Gt=Zr(i.ALLOWED_URI_REGEXP)?i.ALLOWED_URI_REGEXP:Rn,Ae=typeof i.NAMESPACE=="string"?i.NAMESPACE:J,gt=N(i,"MATHML_TEXT_INTEGRATION_POINTS")&&i.MATHML_TEXT_INTEGRATION_POINTS&&typeof i.MATHML_TEXT_INTEGRATION_POINTS=="object"?W(i.MATHML_TEXT_INTEGRATION_POINTS):b({},["mi","mo","mn","ms","mtext"]),xt=N(i,"HTML_INTEGRATION_POINTS")&&i.HTML_INTEGRATION_POINTS&&typeof i.HTML_INTEGRATION_POINTS=="object"?W(i.HTML_INTEGRATION_POINTS):b({},["annotation-xml"]);const u=N(i,"CUSTOM_ELEMENT_HANDLING")&&i.CUSTOM_ELEMENT_HANDLING&&typeof i.CUSTOM_ELEMENT_HANDLING=="object"?W(i.CUSTOM_ELEMENT_HANDLING):Ce(null);if(C=Ce(null),N(u,"tagNameCheck")&&nn(u.tagNameCheck)&&(C.tagNameCheck=u.tagNameCheck),N(u,"attributeNameCheck")&&nn(u.attributeNameCheck)&&(C.attributeNameCheck=u.attributeNameCheck),N(u,"allowCustomizedBuiltInElements")&&typeof u.allowCustomizedBuiltInElements=="boolean"&&(C.allowCustomizedBuiltInElements=u.allowCustomizedBuiltInElements),oe&&(ot=!1),qe&&(we=!0),ye&&(z=b({},Sn),$=Ce(null),ye.html===!0&&(b(z,An),b($,_n)),ye.svg===!0&&(b(z,At),b($,Et),b($,Je)),ye.svgFilters===!0&&(b(z,St),b($,Et),b($,Je)),ye.mathMl===!0&&(b(z,_t),b($,En),b($,Je))),le.tagCheck=null,le.attributeCheck=null,N(i,"ADD_TAGS")&&(typeof i.ADD_TAGS=="function"?le.tagCheck=i.ADD_TAGS:H(i.ADD_TAGS)&&(z===Wt&&(z=W(z)),b(z,i.ADD_TAGS,M))),N(i,"ADD_ATTR")&&(typeof i.ADD_ATTR=="function"?le.attributeCheck=i.ADD_ATTR:H(i.ADD_ATTR)&&($===qt&&($=W($)),b($,i.ADD_ATTR,M))),N(i,"ADD_URI_SAFE_ATTR")&&H(i.ADD_URI_SAFE_ATTR)&&b(dt,i.ADD_URI_SAFE_ATTR,M),N(i,"FORBID_CONTENTS")&&H(i.FORBID_CONTENTS)&&(K===ht&&(K=W(K)),b(K,i.FORBID_CONTENTS,M)),N(i,"ADD_FORBID_CONTENTS")&&H(i.ADD_FORBID_CONTENTS)&&(K===ht&&(K=W(K)),b(K,i.ADD_FORBID_CONTENTS,M)),pt&&(z["#text"]=!0),pe&&b(z,["html","head","body"]),z.table&&(b(z,["tbody"]),delete Oe.tbody),i.TRUSTED_TYPES_POLICY){if(typeof i.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ke('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof i.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ke('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=i.TRUSTED_TYPES_POLICY,Q=E.createHTML("")}else E===void 0&&(E=ls(w,r)),E!==null&&typeof Q=="string"&&(Q=E.createHTML(""));B&&B(i),Se=i},rn=b({},[...At,...St,...Xr]),sn=b({},[..._t,...Vr]),or=function(i){let u=te(i);(!u||!u.tagName)&&(u={namespaceURI:Ae,tagName:"template"});const f=je(i.tagName),T=je(u.tagName);return mt[i.namespaceURI]?i.namespaceURI===Xe?u.namespaceURI===J?f==="svg":u.namespaceURI===Ze?f==="svg"&&(T==="annotation-xml"||gt[T]):!!rn[f]:i.namespaceURI===Ze?u.namespaceURI===J?f==="math":u.namespaceURI===Xe?f==="math"&&xt[T]:!!sn[f]:i.namespaceURI===J?u.namespaceURI===Xe&&!xt[T]||u.namespaceURI===Ze&&!gt[T]?!1:!sn[f]&&(sr[f]||!rn[f]):!!(Me==="application/xhtml+xml"&&mt[i.namespaceURI]):!1},Z=function(i){Ee(e.removed,{element:i});try{te(i).removeChild(i)}catch{xe(i)}},he=function(i,u){try{Ee(e.removed,{attribute:u.getAttributeNode(i),from:u})}catch{Ee(e.removed,{attribute:null,from:u})}if(u.removeAttribute(i),i==="is")if(we||qe)try{Z(u)}catch{}else try{u.setAttribute(i,"")}catch{}},an=function(i){let u=null,f=null;if(ut)i="<remove></remove>"+i;else{const O=bn(i,/^[\r\n\t ]+/);f=O&&O[0]}Me==="application/xhtml+xml"&&Ae===J&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");const T=E?E.createHTML(i):i;if(Ae===J)try{u=new _().parseFromString(T,Me)}catch{}if(!u||!u.documentElement){u=be.createDocument(Ae,"template",null);try{u.documentElement.innerHTML=ft?Q:T}catch{}}const I=u.body||u.documentElement;return i&&f&&I.insertBefore(n.createTextNode(f),I.childNodes[0]||null),Ae===J?Be.call(u,pe?"html":"body")[0]:pe?u.documentElement:I},ln=function(i){return Ue.call(i.ownerDocument||i,i,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},on=function(i){i.normalize();const u=Ue.call(i.ownerDocument||i,i,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let f=u.nextNode();for(;f;){let T=f.data;_e([v,ie,Te],I=>{T=Re(T,I," ")}),f.data=T,f=u.nextNode()}},bt=function(i){return i instanceof k&&(typeof i.nodeName!="string"||typeof i.textContent!="string"||typeof i.removeChild!="function"||!(i.attributes instanceof d)||typeof i.removeAttribute!="function"||typeof i.setAttribute!="function"||typeof i.namespaceURI!="string"||typeof i.insertBefore!="function"||typeof i.hasChildNodes!="function")},Ve=function(i){if(!ne||typeof i!="object"||i===null)return!1;try{return typeof ne(i)=="number"}catch{return!1}};function re(x,i,u){_e(x,f=>{f.call(e,i,u,Se)})}const cn=function(i){let u=null;if(re(g.beforeSanitizeElements,i,null),bt(i))return Z(i),!0;const f=M(i.nodeName);if(re(g.uponSanitizeElement,i,{tagName:f,allowedTags:z}),Le&&i.hasChildNodes()&&!Ve(i.firstElementChild)&&F(/<[/\w!]/g,i.innerHTML)&&F(/<[/\w!]/g,i.textContent)||Le&&i.namespaceURI===J&&f==="style"&&Ve(i.firstElementChild)||i.nodeType===Ne.progressingInstruction||Le&&i.nodeType===Ne.comment&&F(/<[/\w]/g,i.data))return Z(i),!0;if(Oe[f]||!(le.tagCheck instanceof Function&&le.tagCheck(f))&&!z[f]){if(!Oe[f]&&pn(f)&&(C.tagNameCheck instanceof RegExp&&F(C.tagNameCheck,f)||C.tagNameCheck instanceof Function&&C.tagNameCheck(f)))return!1;if(pt&&!K[f]){const T=te(i)||i.parentNode,I=S(i)||i.childNodes;if(I&&T){const O=I.length;for(let G=O-1;G>=0;--G){const ce=q(I[G],!0);T.insertBefore(ce,ke(i))}}}return Z(i),!0}return i instanceof p&&!or(i)||(f==="noscript"||f==="noembed"||f==="noframes")&&F(/<\/no(script|embed|frames)/i,i.innerHTML)?(Z(i),!0):(oe&&i.nodeType===Ne.text&&(u=i.textContent,_e([v,ie,Te],T=>{u=Re(u,T," ")}),i.textContent!==u&&(Ee(e.removed,{element:i.cloneNode()}),i.textContent=u)),re(g.afterSanitizeElements,i,null),!1)},un=function(i,u,f){if(We[u]||Vt&&(u==="id"||u==="name")&&(f in n||f in lr))return!1;const T=$[u]||le.attributeCheck instanceof Function&&le.attributeCheck(u,i);if(!(ot&&!We[u]&&F(Jn,u))){if(!(Yt&&F(er,u))){if(!T||We[u]){if(!(pn(i)&&(C.tagNameCheck instanceof RegExp&&F(C.tagNameCheck,i)||C.tagNameCheck instanceof Function&&C.tagNameCheck(i))&&(C.attributeNameCheck instanceof RegExp&&F(C.attributeNameCheck,u)||C.attributeNameCheck instanceof Function&&C.attributeNameCheck(u,i))||u==="is"&&C.allowCustomizedBuiltInElements&&(C.tagNameCheck instanceof RegExp&&F(C.tagNameCheck,f)||C.tagNameCheck instanceof Function&&C.tagNameCheck(f))))return!1}else if(!dt[u]){if(!F(Gt,Re(f,Bt,""))){if(!((u==="src"||u==="xlink:href"||u==="href")&&i!=="script"&&Tn(f,"data:")===0&&Jt[i])){if(!(Zt&&!F(tr,Re(f,Bt,"")))){if(f)return!1}}}}}}return!0},cr=b({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),pn=function(i){return!cr[je(i)]&&F(nr,i)},hn=function(i){re(g.beforeSanitizeAttributes,i,null);const u=i.attributes;if(!u||bt(i))return;const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let T=u.length;for(;T--;){const I=u[T],O=I.name,G=I.namespaceURI,ce=I.value,se=M(O),wt=ce;let j=O==="value"?wt:Hr(wt);if(f.attrName=se,f.attrValue=j,f.keepAttr=!0,f.forceKeepAttr=void 0,re(g.uponSanitizeAttribute,i,f),j=f.attrValue,Qt&&(se==="id"||se==="name")&&Tn(j,Kt)!==0&&(he(O,i),j=Kt+j),Le&&F(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,j)){he(O,i);continue}if(se==="attributename"&&bn(j,"href")){he(O,i);continue}if(f.forceKeepAttr)continue;if(!f.keepAttr){he(O,i);continue}if(!Xt&&F(/\/>/i,j)){he(O,i);continue}oe&&_e([v,ie,Te],fn=>{j=Re(j,fn," ")});const dn=M(i.nodeName);if(!un(dn,se,j)){he(O,i);continue}if(E&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!G)switch(w.getAttributeType(dn,se)){case"TrustedHTML":{j=E.createHTML(j);break}case"TrustedScriptURL":{j=E.createScriptURL(j);break}}if(j!==wt)try{G?i.setAttributeNS(G,O,j):i.setAttribute(O,j),bt(i)?Z(i):kn(e.removed)}catch{he(O,i)}}re(g.afterSanitizeAttributes,i,null)},Tt=function(i){let u=null;const f=ln(i);for(re(g.beforeSanitizeShadowDOM,i,null);u=f.nextNode();)re(g.uponSanitizeShadowNode,u,null),cn(u),hn(u),u.content instanceof a&&Tt(u.content);re(g.afterSanitizeShadowDOM,i,null)},Qe=function(i){if(i.nodeType===Ne.element&&i.shadowRoot instanceof a){const T=i.shadowRoot;Qe(T),Tt(T)}const u=i.childNodes;if(!u)return;const f=[];_e(u,T=>{Ee(f,T)});for(const T of f)Qe(T)};return e.sanitize=function(x){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=null,f=null,T=null,I=null;if(ft=!x,ft&&(x="<!-->"),typeof x!="string"&&!Ve(x)&&(x=Yr(x),typeof x!="string"))throw Ke("dirty is not a string, aborting");if(!e.isSupported)return x;if(ct||kt(i),e.removed=[],typeof x=="string"&&(De=!1),De){const ce=x.nodeName;if(typeof ce=="string"){const se=M(ce);if(!z[se]||Oe[se])throw Ke("root node is forbidden and cannot be sanitized in-place")}Qe(x)}else if(Ve(x))u=an("<!---->"),f=u.ownerDocument.importNode(x,!0),f.nodeType===Ne.element&&f.nodeName==="BODY"||f.nodeName==="HTML"?u=f:u.appendChild(f),Qe(f);else{if(!we&&!oe&&!pe&&x.indexOf("<")===-1)return E&&Ye?E.createHTML(x):x;if(u=an(x),!u)return we?null:Ye?Q:""}u&&ut&&Z(u.firstChild);const O=ln(De?x:u);for(;T=O.nextNode();)cn(T),hn(T),T.content instanceof a&&Tt(T.content);if(De)return oe&&on(x),x;if(we){if(oe&&on(u),qe)for(I=He.call(u.ownerDocument);u.firstChild;)I.appendChild(u.firstChild);else I=u;return($.shadowroot||$.shadowrootmode)&&(I=Ge.call(s,I,!0)),I}let G=pe?u.outerHTML:u.innerHTML;return pe&&z["!doctype"]&&u.ownerDocument&&u.ownerDocument.doctype&&u.ownerDocument.doctype.name&&F(ss,u.ownerDocument.doctype.name)&&(G="<!DOCTYPE "+u.ownerDocument.doctype.name+`>
|
|
3
3
|
`+G),oe&&_e([v,ie,Te],ce=>{G=Re(G,ce," ")}),E&&Ye?E.createHTML(G):G},e.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kt(x),ct=!0},e.clearConfig=function(){Se=null,ct=!1},e.isValidAttribute=function(x,i,u){Se||kt({});const f=M(x),T=M(i);return un(f,T,u)},e.addHook=function(x,i){typeof i=="function"&&Ee(g[x],i)},e.removeHook=function(x,i){if(i!==void 0){const u=Fr(g[x],i);return u===-1?void 0:Ur(g[x],u,1)[0]}return kn(g[x])},e.removeHooks=function(x){g[x]=[]},e.removeAllHooks=function(){g=Nn()},e}var D=Hn(),os=D;D.sanitize.bind(D);D.isSupported;D.addHook.bind(D);D.removeHook.bind(D);D.removeHooks.bind(D);D.removeAllHooks.bind(D);D.setConfig.bind(D);D.clearConfig.bind(D);D.isValidAttribute.bind(D);D.version;D.removed;function Dt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ge=Dt();function Bn(t){ge=t}var fe={exec:()=>null};function ve(t){let e=[];return n=>{let s=Math.max(0,Math.min(3,n-1)),r=e[s];return r||(r=t(s),e[s]=r),r}}function y(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(r,a)=>{let l=typeof a=="string"?a:a.source;return l=l.replace(U.caret,"$1"),n=n.replace(r,l),s},getRegex:()=>new RegExp(n,e)};return s}var cs=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),U={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ve(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ve(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:ve(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:ve(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:ve(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:ve(t=>new RegExp(`^ {0,${t}}>`))},us=/^(?:[ \t]*(?:\n|$))+/,ps=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,hs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Fe=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ds=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Mt=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Gn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wn=y(Gn).replace(/bull/g,Mt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),fs=y(Gn).replace(/bull/g,Mt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Pt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ms=/^[^\n]+/,zt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,gs=y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),xs=y(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mt).getRegex(),it="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",jt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ks=y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",jt).replace("tag",it).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qn=y(Pt).replace("hr",Fe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",it).getRegex(),bs=y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qn).getRegex(),$t={blockquote:bs,code:ps,def:gs,fences:hs,heading:ds,hr:Fe,html:ks,lheading:Wn,list:xs,newline:us,paragraph:qn,table:fe,text:ms},vn=y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Fe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",it).getRegex(),Ts={...$t,lheading:fs,table:vn,paragraph:y(Pt).replace("hr",Fe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vn).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",it).getRegex()},ws={...$t,html:y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",jt).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:fe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:y(Pt).replace("hr",Fe).replace("heading",` *#{1,6} *[^
|
|
4
4
|
]`).replace("lheading",Wn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ys=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,As=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Yn=/^( {2,}|\\)\n(?!\s*$)/,Ss=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ie=/[\p{P}\p{S}]/u,lt=/[\s\p{P}\p{S}]/u,Ft=/[^\s\p{P}\p{S}]/u,_s=y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,lt).getRegex(),Zn=/(?!~)[\p{P}\p{S}]/u,Es=/(?!~)[\s\p{P}\p{S}]/u,Rs=/(?:[^\s\p{P}\p{S}]|~)/u,Ns=y(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",cs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Xn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,vs=y(Xn,"u").replace(/punct/g,Ie).getRegex(),Cs=y(Xn,"u").replace(/punct/g,Zn).getRegex(),Vn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Is=y(Vn,"gu").replace(/notPunctSpace/g,Ft).replace(/punctSpace/g,lt).replace(/punct/g,Ie).getRegex(),Os=y(Vn,"gu").replace(/notPunctSpace/g,Rs).replace(/punctSpace/g,Es).replace(/punct/g,Zn).getRegex(),Ls=y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ft).replace(/punctSpace/g,lt).replace(/punct/g,Ie).getRegex(),Ds=y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ie).getRegex(),Ms="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ps=y(Ms,"gu").replace(/notPunctSpace/g,Ft).replace(/punctSpace/g,lt).replace(/punct/g,Ie).getRegex(),zs=y(/\\(punct)/,"gu").replace(/punct/g,Ie).getRegex(),js=y(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),$s=y(jt).replace("(?:-->|$)","-->").getRegex(),Fs=y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",$s).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),nt=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Us=y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",nt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Qn=y(/^!?\[(label)\]\[(ref)\]/).replace("label",nt).replace("ref",zt).getRegex(),Kn=y(/^!?\[(ref)\](?:\[\])?/).replace("ref",zt).getRegex(),Hs=y("reflink|nolink(?!\\()","g").replace("reflink",Qn).replace("nolink",Kn).getRegex(),Cn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ut={_backpedal:fe,anyPunctuation:zs,autolink:js,blockSkip:Ns,br:Yn,code:As,del:fe,delLDelim:fe,delRDelim:fe,emStrongLDelim:vs,emStrongRDelimAst:Is,emStrongRDelimUnd:Ls,escape:ys,link:Us,nolink:Kn,punctuation:_s,reflink:Qn,reflinkSearch:Hs,tag:Fs,text:Ss,url:fe},Bs={...Ut,link:y(/^!?\[(label)\]\((.*?)\)/).replace("label",nt).getRegex(),reflink:y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",nt).getRegex()},Ct={...Ut,emStrongRDelimAst:Os,emStrongLDelim:Cs,delLDelim:Ds,delRDelim:Ps,url:y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Cn).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:y(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Cn).getRegex()},Gs={...Ct,br:y(Yn).replace("{2,}","*").getRegex(),text:y(Ct.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},et={normal:$t,gfm:Ts,pedantic:ws},ze={normal:Ut,gfm:Ct,breaks:Gs,pedantic:Bs},Ws={"&":"&","<":"<",">":">",'"':""","'":"'"},In=t=>Ws[t];function ee(t,e){if(e){if(U.escapeTest.test(t))return t.replace(U.escapeReplace,In)}else if(U.escapeTestNoEncode.test(t))return t.replace(U.escapeReplaceNoEncode,In);return t}function On(t){try{t=encodeURI(t).replace(U.percentDecode,"%")}catch{return null}return t}function Ln(t,e){let n=t.replace(U.findPipe,(a,l,o)=>{let p=!1,c=l;for(;--c>=0&&o[c]==="\\";)p=!p;return p?"|":" |"}),s=n.split(U.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(U.slashPipe,"|");return s}function ue(t,e,n){let s=t.length;if(s===0)return"";let r=0;for(;r<s&&t.charAt(s-r-1)===e;)r++;return t.slice(0,s-r)}function Dn(t){let e=t.split(`
|