fourth-spark 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Fourth Spark
2
+
3
+ AI Agent Platform — 基于 [OpenCode](https://opencode.ai/) 的多仓库 Agent 管理平台。
4
+
5
+ 浏览器中与 AI Agent 实时对话,管理多个 Git 仓库,集成 GitHub / Gitea / GitLab。
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ npm install -g fourth-spark
11
+ ```
12
+
13
+ 安装时自动下载对应平台的编译二进制(macOS/Linux/Windows,x64/arm64)。
14
+
15
+ ## 前置依赖
16
+
17
+ - [Docker](https://docs.docker.com/get-docker/) — 用于运行 PostgreSQL
18
+ - [OpenCode](https://opencode.ai/) CLI — `opencode serve`
19
+
20
+ ## 使用
21
+
22
+ ```bash
23
+ # 启动(自动拉起 PostgreSQL + 后台运行 server)
24
+ fourth-spark start
25
+
26
+ # 查看运行状态
27
+ fourth-spark status
28
+
29
+ # 停止所有服务
30
+ fourth-spark stop
31
+ ```
32
+
33
+ 启动后访问 **http://localhost:3000**。
34
+
35
+ ## 所有命令
36
+
37
+ | 命令 | 说明 |
38
+ |------|------|
39
+ | `fourth-spark` | 前台启动 server(Ctrl-C 停止) |
40
+ | `fourth-spark start` | 后台启动(PostgreSQL + server) |
41
+ | `fourth-spark stop` | 停止所有服务 |
42
+ | `fourth-spark status` | 查看运行状态 |
43
+ | `fourth-spark upgrade` | 检查并更新到最新版本 |
44
+ | `fourth-spark --version` | 查看版本号 |
45
+
46
+ ## 更新
47
+
48
+ ```bash
49
+ # 自我更新(下载最新二进制并替换)
50
+ fourth-spark upgrade
51
+
52
+ # 或通过 npm
53
+ npm update -g fourth-spark
54
+ ```
55
+
56
+ ## 文档
57
+
58
+ 完整文档、架构说明和开发指南见 [GitHub](https://github.com/kinminghao/fourth-spark)。
59
+
60
+ ## License
61
+
62
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourth-spark",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "AI Agent Platform — multi-repo agent management based on OpenCode",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,7 +15,8 @@
15
15
  "public/",
16
16
  "drizzle/",
17
17
  "docker-compose.yml",
18
- "postinstall.js"
18
+ "postinstall.js",
19
+ "README.md"
19
20
  ],
20
21
  "scripts": {
21
22
  "postinstall": "node postinstall.js"
@@ -397,7 +397,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
397
397
  *
398
398
  * This source code is licensed under the ISC license.
399
399
  * See the LICENSE file in the root directory of this source tree.
400
- */const VA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],IE=Oe("zap",VA);function ME(e){var t,a,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(a=ME(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function me(){for(var e,t,a=0,s="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=ME(e))&&(s&&(s+=" "),s+=t);return s}const Gb=e=>{let t;const a=new Set,s=(m,x)=>{const b=typeof m=="function"?m(t):m;if(!Object.is(b,t)){const y=t;t=x??(typeof b!="object"||b===null)?b:Object.assign({},t,b),a.forEach(T=>T(t,y))}},l=()=>t,f={setState:s,getState:l,getInitialState:()=>h,subscribe:m=>(a.add(m),()=>a.delete(m))},h=t=e(s,l,f);return f},QA=(e=>e?Gb(e):Gb),XA=e=>e;function ZA(e,t=XA){const a=$u.useSyncExternalStore(e.subscribe,$u.useCallback(()=>t(e.getState()),[e,t]),$u.useCallback(()=>t(e.getInitialState()),[e,t]));return $u.useDebugValue(a),a}const Kb=e=>{const t=QA(e),a=s=>ZA(t,s);return Object.assign(a,t),a},Fs=(e=>e?Kb(e):Kb),im="fs-theme";function DE(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Vb(e){return e==="system"?DE():e}function Qb(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Um=Fs((e,t)=>({preference:localStorage.getItem(im)??"system",resolved:Vb(localStorage.getItem(im)??"system"),setPreference(a){const s=Vb(a);localStorage.setItem(im,a),Qb(a),e({preference:a,resolved:s})},cycle(){const a=["system","light","dark"],s=a[(a.indexOf(t().preference)+1)%a.length];t().setPreference(s)},init(){Qb(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{const{preference:l}=t();if(l==="system"){const o=DE();e({resolved:o})}};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)}})),hc="fourth-spark-server-url";function LE(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function jE(){return localStorage.getItem(hc)??""}function WA(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(hc,t):localStorage.removeItem(hc)}function Hm(){return localStorage.getItem(hc)??""}class Us extends Error{constructor(a,s){super(a);rn(this,"status");this.name="ApiError",this.status=s}}async function Ce(e,t){let a;try{a=await fetch(jE()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(l){throw new Us(l instanceof Error?l.message:"Network request failed",0)}if(!a.ok){const l=await a.text().catch(()=>"");throw new Us(l.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const s=await a.text();if(s)return JSON.parse(s)}function Mn(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const s of[...t,"data","items"])if(Array.isArray(a[s]))return a[s]}return[]}async function JA(){return Mn(await Ce("/api/repos"),"repos")}async function e3(e,t,a){return Ce("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a})})}async function t3(e){return Ce("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function n3(e){await Ce(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function a3(e){await Ce(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function r3(e){await Ce(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function s3(e){return Ce(`/api/repos/${encodeURIComponent(e)}/branches`)}async function i3(e,t){return Ce(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function l3(e){return Ce(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function We(e){return`/api/repos/${encodeURIComponent(e)}`}async function o3(e){return Mn(await Ce(`${We(e)}/sessions`),"sessions")}async function u3(e,t,a,s,l,o,d){return Ce(`${We(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:s,variant:l,issueId:o,customAgentId:d})})}async function c3(e,t){return Ce(`${We(e)}/sessions/${encodeURIComponent(t)}`)}async function d3(e,t){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function f3(e,t,a,s,l){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:s,model:l})})}async function m3(e,t){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}function h3(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const s=Array.isArray(t.parts)?t.parts:void 0;return{...a,...s?{parts:s}:{}}}return t}async function p3(e,t){return Mn(await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/messages`),"messages").map(h3)}async function g3(e,t){return Mn(await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/todos`),"todos")}async function BE(e,t){return Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/status`)}async function Xb(e,t){return Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/links`)}async function Zb(e){return Ce(`${We(e)}/sessions/all-links`)}async function b3(e,t,a,s){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:s})})}async function x3(e,t,a,s){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:s})})}async function PE(){return Mn(await Ce("/api/custom-agents"))}async function UE(e){return Ce("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function HE(e,t){return Ce(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function FE(e){await Ce(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Wb(e){return Ce(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function E3(e){return Ce("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function y3(e){return Mn(await Ce(`${We(e)}/custom-agents`))}async function T3(e,t){return Ce(`${We(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function yh(e){return Mn(await Ce(`${We(e)}/models`))}async function _3(){return Mn(await Ce("/api/prompt-fragments"))}async function N3(e){return Ce("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function S3(e,t){return Ce(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function v3(e){await Ce(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Jb(e){return Mn(await Ce(`${We(e)}/tags`))}async function ex(e,t){return Mn(await Ce(`${We(e)}/milestones`))}async function tx(e,t="open"){return Mn(await Ce(`${We(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function A3(e,t="all"){return Ce(`${We(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function C3(e,t,a){return Ce(`${We(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function w3(e,t,a){await Ce(`${We(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function zE(e,t,a){return Ce(`${We(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function nx(e,t){return Mn(await Ce(`${We(e)}/issues/${t}/pulls`))}async function k3(e,t,a,s=!1){await Ce(`${We(e)}/issues/${t}/pulls/${a}/merge`,{method:"POST",body:JSON.stringify({closeIssue:s})})}async function ax(e,t="open"){return Mn(await Ce(`${We(e)}/pulls?state=${encodeURIComponent(t)}`))}async function R3(e,t="all"){return Ce(`${We(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function O3(e,t){await Ce(`${We(e)}/pulls/${t}/merge`,{method:"POST"})}async function qE(e,t){return Mn(await Ce(`${We(e)}/pulls/${t}/issues`))}async function I3(e,t,a){await Ce(`${We(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function M3(e,t,a){await Ce(`${We(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function D3(e,t){return Ce(`${We(e)}/pulls/${t}/comments`)}async function L3(e,t){return Ce(`${We(e)}/issues/${t}/comments`)}async function rx(e,t,a){return Ce(`${We(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function j3(e,t,a){return Ce(`${We(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function sx(e,t){return Ce(`${We(e)}/issues/${t}/draft`)}async function B3(e,t,a){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function P3(){return Ce("/api/agents-md")}async function U3(e){await Ce("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function H3(e){return Ce(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function F3(e,t){await Ce(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function z3(e){return`${jE()}${We(e)}/events`}async function q3(e){return Ce(`${We(e)}/sessions/status`)}async function Th(){return Ce("/api/settings")}async function Y3(e,t){await Ce(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function $3(){return Mn(await Ce("/api/git-hosts"),"gitHosts")}async function G3(e,t,a,s="gitea"){return Ce("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:s})})}async function K3(e){await Ce(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function V3(){return Ce("/api/usage")}async function Q3(e){return Ce("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function X3(e,t="ios"){await Ce("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ts="fs-active-repo",qe=Fs((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ts),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await JA(),s=t().activeRepoId,l=s&&a.some(d=>d.id===s);e({repos:a,loading:!1,activeRepoId:l?s:a.length>0?a[0].id:null});const o=t().activeRepoId;o?localStorage.setItem(ts,o):localStorage.removeItem(ts)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ts,a):localStorage.removeItem(ts)},addRepo:async(a,s,l)=>{try{const o=await e3(a,s,l);return e(d=>({repos:[...d.repos,o],activeRepoId:o.id})),localStorage.setItem(ts,o.id),o}catch(o){return e({loadError:o instanceof Error?o.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await n3(a)}catch{}e(s=>{const l=s.repos.filter(d=>d.id!==a),o=s.activeRepoId===a?l.length>0?l[0].id:null:s.activeRepoId;return o?localStorage.setItem(ts,o):localStorage.removeItem(ts),{repos:l,activeRepoId:o}})},updateRepoBranch:(a,s)=>{e(l=>({repos:l.repos.map(o=>o.id===a?{...o,branch:s}:o)}))}})),Da=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},YE=[{segment:"repos",icon:Sv,label:"仓库管理",global:!0},{segment:"run",icon:Lc,label:"运行面板",global:!1},{segment:"issues",icon:co,label:"Issues",global:!1},{segment:"pulls",icon:fo,label:"PRs",global:!1},{segment:"settings",icon:IA,label:"设置",global:!0}];function $E(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function Z3({repoId:e,currentBranch:t}){const a=qe(v=>v.updateRepoBranch),[s,l]=A.useState(!1),[o,d]=A.useState(null),[f,h]=A.useState(!1),[m,x]=A.useState(null),[b,y]=A.useState(null),T=A.useRef(null),N=A.useCallback(()=>{l(!1),y(null)},[]);A.useEffect(()=>{if(!s)return;const v=M=>{T.current&&!T.current.contains(M.target)&&N()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s,N]);const S=async()=>{if(s){N();return}l(!0),h(!0),y(null);try{d(await s3(e))}catch{y("加载分支失败")}finally{h(!1)}},C=async v=>{if(!(v===t||m)){x(v),y(null);try{const M=await i3(e,v);a(e,M.branch),N()}catch(M){y(M instanceof Error?M.message:"切换失败")}finally{x(null)}}};return t?c.jsxs("div",{ref:T,className:"relative",children:[c.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 rounded-md bg-elevated px-2 py-1 text-xs text-fg-3 transition-colors hover:bg-blue-500/10 hover:text-blue-600",children:[c.jsx(Ic,{className:"h-3 w-3"}),t,c.jsx(ss,{className:me("h-3 w-3 transition-transform",s&&"rotate-180")})]}),s&&c.jsxs("div",{className:"absolute right-0 top-full z-50 mt-1 w-56 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[f?c.jsx("div",{className:"flex items-center justify-center py-4",children:c.jsx(_r,{className:"h-4 w-4 animate-spin text-fg-4"})}):o?c.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[o.local.map(v=>c.jsxs("button",{type:"button",disabled:m!==null,onClick:()=>C(v),className:me("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",v===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[v===t?c.jsx(Ia,{className:"h-3 w-3 shrink-0"}):m===v?c.jsx(_r,{className:"h-3 w-3 shrink-0 animate-spin"}):c.jsx("span",{className:"h-3 w-3 shrink-0"}),c.jsx("span",{className:"truncate",children:v})]},v)),o.remote.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mx-3 my-1 border-t border-line"}),c.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),o.remote.map(v=>c.jsxs("button",{type:"button",disabled:m!==null,onClick:()=>C(v),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-fg-2 transition-colors hover:bg-elevated",children:[m===v?c.jsx(_r,{className:"h-3 w-3 shrink-0 animate-spin"}):c.jsx("span",{className:"h-3 w-3 shrink-0"}),c.jsx("span",{className:"truncate",children:v})]},`remote-${v}`))]})]}):null,b&&c.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:b})]})]}):null}function W3(){const[e,t]=A.useState(null);return A.useEffect(()=>{fetch("/api/health").then(a=>a.json()).then(a=>{a.latestVersion&&a.latestVersion!=="0.6.2"&&t(a.latestVersion)}).catch(()=>{})},[]),e}function J3(){const e=Na(),t=oa(),a=qe(b=>b.repos),s=qe(b=>b.activeRepoId),l=qe(b=>b.setActiveRepo),o=Um(b=>b.preference),d=Um(b=>b.cycle),f=o==="light"?jA:o==="dark"?EA:bA,h=a.find(b=>b.id===s),m=W3(),x=b=>{var N;if(!b)return;l(b);const y=a.find(S=>S.id===b);if(!y)return;const T=((N=t.pathname.match(/\/(run|issues|pulls)/))==null?void 0:N[1])??"run";e(`/${encodeURIComponent(y.name)}/${T}`)};return c.jsx("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:c.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(IE,{className:"h-5 w-5 text-blue-500"}),c.jsx("span",{className:"text-sm font-bold tracking-tight text-fg",children:"Fourth Spark"}),c.jsxs("span",{className:"rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4",children:["v","0.6.2"]}),m&&c.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",m," 可用,运行 ",c.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("select",{value:s??"",onChange:b=>x(b.target.value),className:"rounded-md border border-line bg-base px-2.5 py-1 text-xs text-fg-2 focus:border-blue-500 focus:outline-none",children:a.map(b=>c.jsx("option",{value:b.id,children:b.name},b.id))}),h&&s&&c.jsx(Z3,{repoId:s,currentBranch:h.branch})]}),c.jsx("a",{href:"https://github.com/kinminghao/fourth-spark",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:c.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:c.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}),c.jsx("button",{type:"button",onClick:d,"aria-label":`主题: ${o}`,className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:c.jsx(f,{className:"h-4 w-4"})})]})]})})}function eC(){const e=qe(Da);return c.jsx("nav",{className:"hidden w-48 shrink-0 flex-col border-r border-line bg-surface py-2 md:flex",children:YE.map(t=>c.jsxs(gh,{to:$E(t.segment,t.global,e),className:({isActive:a})=>me("mx-2 flex items-center gap-2.5 rounded-md px-3 py-2 text-sm transition-colors",a?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[c.jsx(t.icon,{className:"h-4 w-4 shrink-0"}),t.label]},t.segment))})}function tC(){const e=qe(Da);return c.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-30 border-t border-line bg-surface pb-[var(--safe-bottom)] md:hidden",children:c.jsx("div",{className:"flex h-14 items-center justify-around",children:YE.map(t=>c.jsx(gh,{to:$E(t.segment,t.global,e),"aria-label":t.label,className:({isActive:a})=>me("flex h-10 w-10 items-center justify-center rounded-md transition-colors",a?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:c.jsx(t.icon,{className:"h-5 w-5 shrink-0"})},t.segment))})})}function nC(){return c.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[c.jsx(J3,{}),c.jsxs("div",{className:"flex min-h-0 flex-1",children:[c.jsx(eC,{}),c.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:c.jsx(NS,{})})]}),c.jsx(tC,{})]})}function aC({onClose:e}){const[t,a]=A.useState(""),[s,l]=A.useState(""),[o,d]=A.useState(""),[f,h]=A.useState(!1),[m,x]=A.useState(""),b=qe(C=>C.addRepo),y=s.trim()!==""&&o.trim()!==""&&t.trim()!==""&&!f,T=async C=>{const v=C.trim();if(v){h(!0),x("");try{const M=await t3(v);M.name&&!s.trim()&&l(M.name),M.gitUrl&&!o.trim()&&d(M.gitUrl)}catch(M){const k=M instanceof Error?M.message:"无法解析路径";try{const D=JSON.parse(k);x(D.error??k)}catch{x(k)}}h(!1)}},N=A.useRef(T);N.current=T,A.useEffect(()=>{const C=t.trim();if(!C)return;const v=setTimeout(()=>{N.current(C)},500);return()=>clearTimeout(v)},[t]);const S=async()=>{if(!y)return;x(""),await b(s.trim(),o.trim(),t.trim())&&e()};return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:c.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:C=>C.stopPropagation(),children:[c.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[c.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),c.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:c.jsx(Tt,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),c.jsx("input",{id:"m-path",value:t,onChange:C=>a(C.target.value),onBlur:C=>void T(C.target.value),placeholder:"/Users/you/code/repo",autoFocus:!0,className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"}),c.jsx("span",{className:"text-[11px] text-fg-5",children:f?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),c.jsx("input",{id:"m-name",value:s,onChange:C=>l(C.target.value),placeholder:"my-project",className:"w-full rounded-lg border border-line bg-base px-3 py-2 text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),c.jsx("input",{id:"m-git",value:o,onChange:C=>d(C.target.value),placeholder:"https://github.com/org/repo.git",className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-xs text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),m&&c.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:m}),c.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:e,className:"rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),c.jsx("button",{type:"button",onClick:S,disabled:!y,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:cursor-not-allowed disabled:bg-fg-6 disabled:text-fg-4",children:"添加仓库"})]})]})]})})}function rC({repoId:e,repoName:t,onClose:a}){const[s,l]=A.useState(""),[o,d]=A.useState(""),[f,h]=A.useState(!0),[m,x]=A.useState(!1),[b,y]=A.useState(null);A.useEffect(()=>{H3(e).then(S=>{l(S.content),d(S.content),h(!1)}).catch(S=>{y(S instanceof Error?S.message:String(S)),h(!1)})},[e]);const T=async()=>{x(!0),y(null);try{await F3(e,s),d(s)}catch(S){y(S instanceof Error?S.message:String(S))}x(!1)},N=s!==o;return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:c.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[c.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),c.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),c.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:c.jsx(Tt,{className:"h-4 w-4"})})]}),b&&c.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg bg-red-500/10 px-3 py-2 text-xs text-red-400",children:[c.jsx(ia,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:b})]}),f?c.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[c.jsx(_r,{className:"h-5 w-5 fs-spin"}),c.jsx("p",{className:"text-xs",children:"加载中…"})]}):c.jsx("textarea",{value:s,onChange:S=>l(S.target.value),spellCheck:!1,className:"h-96 w-full resize-y rounded-lg border border-line bg-base px-4 py-3 font-mono text-sm leading-relaxed text-fg placeholder:text-fg-6 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20",placeholder:`# AGENTS.md
400
+ */const VA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],IE=Oe("zap",VA);function ME(e){var t,a,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(a=ME(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function me(){for(var e,t,a=0,s="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=ME(e))&&(s&&(s+=" "),s+=t);return s}const Gb=e=>{let t;const a=new Set,s=(m,x)=>{const b=typeof m=="function"?m(t):m;if(!Object.is(b,t)){const y=t;t=x??(typeof b!="object"||b===null)?b:Object.assign({},t,b),a.forEach(T=>T(t,y))}},l=()=>t,f={setState:s,getState:l,getInitialState:()=>h,subscribe:m=>(a.add(m),()=>a.delete(m))},h=t=e(s,l,f);return f},QA=(e=>e?Gb(e):Gb),XA=e=>e;function ZA(e,t=XA){const a=$u.useSyncExternalStore(e.subscribe,$u.useCallback(()=>t(e.getState()),[e,t]),$u.useCallback(()=>t(e.getInitialState()),[e,t]));return $u.useDebugValue(a),a}const Kb=e=>{const t=QA(e),a=s=>ZA(t,s);return Object.assign(a,t),a},Fs=(e=>e?Kb(e):Kb),im="fs-theme";function DE(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Vb(e){return e==="system"?DE():e}function Qb(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Um=Fs((e,t)=>({preference:localStorage.getItem(im)??"system",resolved:Vb(localStorage.getItem(im)??"system"),setPreference(a){const s=Vb(a);localStorage.setItem(im,a),Qb(a),e({preference:a,resolved:s})},cycle(){const a=["system","light","dark"],s=a[(a.indexOf(t().preference)+1)%a.length];t().setPreference(s)},init(){Qb(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{const{preference:l}=t();if(l==="system"){const o=DE();e({resolved:o})}};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)}})),hc="fourth-spark-server-url";function LE(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function jE(){return localStorage.getItem(hc)??""}function WA(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(hc,t):localStorage.removeItem(hc)}function Hm(){return localStorage.getItem(hc)??""}class Us extends Error{constructor(a,s){super(a);rn(this,"status");this.name="ApiError",this.status=s}}async function Ce(e,t){let a;try{a=await fetch(jE()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(l){throw new Us(l instanceof Error?l.message:"Network request failed",0)}if(!a.ok){const l=await a.text().catch(()=>"");throw new Us(l.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const s=await a.text();if(s)return JSON.parse(s)}function Mn(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const s of[...t,"data","items"])if(Array.isArray(a[s]))return a[s]}return[]}async function JA(){return Mn(await Ce("/api/repos"),"repos")}async function e3(e,t,a){return Ce("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a})})}async function t3(e){return Ce("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function n3(e){await Ce(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function a3(e){await Ce(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function r3(e){await Ce(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function s3(e){return Ce(`/api/repos/${encodeURIComponent(e)}/branches`)}async function i3(e,t){return Ce(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function l3(e){return Ce(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function We(e){return`/api/repos/${encodeURIComponent(e)}`}async function o3(e){return Mn(await Ce(`${We(e)}/sessions`),"sessions")}async function u3(e,t,a,s,l,o,d){return Ce(`${We(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:s,variant:l,issueId:o,customAgentId:d})})}async function c3(e,t){return Ce(`${We(e)}/sessions/${encodeURIComponent(t)}`)}async function d3(e,t){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function f3(e,t,a,s,l){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:s,model:l})})}async function m3(e,t){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}function h3(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const s=Array.isArray(t.parts)?t.parts:void 0;return{...a,...s?{parts:s}:{}}}return t}async function p3(e,t){return Mn(await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/messages`),"messages").map(h3)}async function g3(e,t){return Mn(await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/todos`),"todos")}async function BE(e,t){return Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/status`)}async function Xb(e,t){return Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/links`)}async function Zb(e){return Ce(`${We(e)}/sessions/all-links`)}async function b3(e,t,a,s){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:s})})}async function x3(e,t,a,s){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:s})})}async function PE(){return Mn(await Ce("/api/custom-agents"))}async function UE(e){return Ce("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function HE(e,t){return Ce(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function FE(e){await Ce(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Wb(e){return Ce(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function E3(e){return Ce("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function y3(e){return Mn(await Ce(`${We(e)}/custom-agents`))}async function T3(e,t){return Ce(`${We(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function yh(e){return Mn(await Ce(`${We(e)}/models`))}async function _3(){return Mn(await Ce("/api/prompt-fragments"))}async function N3(e){return Ce("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function S3(e,t){return Ce(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function v3(e){await Ce(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Jb(e){return Mn(await Ce(`${We(e)}/tags`))}async function ex(e,t){return Mn(await Ce(`${We(e)}/milestones`))}async function tx(e,t="open"){return Mn(await Ce(`${We(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function A3(e,t="all"){return Ce(`${We(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function C3(e,t,a){return Ce(`${We(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function w3(e,t,a){await Ce(`${We(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function zE(e,t,a){return Ce(`${We(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function nx(e,t){return Mn(await Ce(`${We(e)}/issues/${t}/pulls`))}async function k3(e,t,a,s=!1){await Ce(`${We(e)}/issues/${t}/pulls/${a}/merge`,{method:"POST",body:JSON.stringify({closeIssue:s})})}async function ax(e,t="open"){return Mn(await Ce(`${We(e)}/pulls?state=${encodeURIComponent(t)}`))}async function R3(e,t="all"){return Ce(`${We(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function O3(e,t){await Ce(`${We(e)}/pulls/${t}/merge`,{method:"POST"})}async function qE(e,t){return Mn(await Ce(`${We(e)}/pulls/${t}/issues`))}async function I3(e,t,a){await Ce(`${We(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function M3(e,t,a){await Ce(`${We(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function D3(e,t){return Ce(`${We(e)}/pulls/${t}/comments`)}async function L3(e,t){return Ce(`${We(e)}/issues/${t}/comments`)}async function rx(e,t,a){return Ce(`${We(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function j3(e,t,a){return Ce(`${We(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function sx(e,t){return Ce(`${We(e)}/issues/${t}/draft`)}async function B3(e,t,a){await Ce(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function P3(){return Ce("/api/agents-md")}async function U3(e){await Ce("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function H3(e){return Ce(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function F3(e,t){await Ce(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function z3(e){return`${jE()}${We(e)}/events`}async function q3(e){return Ce(`${We(e)}/sessions/status`)}async function Th(){return Ce("/api/settings")}async function Y3(e,t){await Ce(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function $3(){return Mn(await Ce("/api/git-hosts"),"gitHosts")}async function G3(e,t,a,s="gitea"){return Ce("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:s})})}async function K3(e){await Ce(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function V3(){return Ce("/api/usage")}async function Q3(e){return Ce("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function X3(e,t="ios"){await Ce("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ts="fs-active-repo",qe=Fs((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ts),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await JA(),s=t().activeRepoId,l=s&&a.some(d=>d.id===s);e({repos:a,loading:!1,activeRepoId:l?s:a.length>0?a[0].id:null});const o=t().activeRepoId;o?localStorage.setItem(ts,o):localStorage.removeItem(ts)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ts,a):localStorage.removeItem(ts)},addRepo:async(a,s,l)=>{try{const o=await e3(a,s,l);return e(d=>({repos:[...d.repos,o],activeRepoId:o.id})),localStorage.setItem(ts,o.id),o}catch(o){return e({loadError:o instanceof Error?o.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await n3(a)}catch{}e(s=>{const l=s.repos.filter(d=>d.id!==a),o=s.activeRepoId===a?l.length>0?l[0].id:null:s.activeRepoId;return o?localStorage.setItem(ts,o):localStorage.removeItem(ts),{repos:l,activeRepoId:o}})},updateRepoBranch:(a,s)=>{e(l=>({repos:l.repos.map(o=>o.id===a?{...o,branch:s}:o)}))}})),Da=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},YE=[{segment:"repos",icon:Sv,label:"仓库管理",global:!0},{segment:"run",icon:Lc,label:"运行面板",global:!1},{segment:"issues",icon:co,label:"Issues",global:!1},{segment:"pulls",icon:fo,label:"PRs",global:!1},{segment:"settings",icon:IA,label:"设置",global:!0}];function $E(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function Z3({repoId:e,currentBranch:t}){const a=qe(v=>v.updateRepoBranch),[s,l]=A.useState(!1),[o,d]=A.useState(null),[f,h]=A.useState(!1),[m,x]=A.useState(null),[b,y]=A.useState(null),T=A.useRef(null),N=A.useCallback(()=>{l(!1),y(null)},[]);A.useEffect(()=>{if(!s)return;const v=M=>{T.current&&!T.current.contains(M.target)&&N()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s,N]);const S=async()=>{if(s){N();return}l(!0),h(!0),y(null);try{d(await s3(e))}catch{y("加载分支失败")}finally{h(!1)}},C=async v=>{if(!(v===t||m)){x(v),y(null);try{const M=await i3(e,v);a(e,M.branch),N()}catch(M){y(M instanceof Error?M.message:"切换失败")}finally{x(null)}}};return t?c.jsxs("div",{ref:T,className:"relative",children:[c.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 rounded-md bg-elevated px-2 py-1 text-xs text-fg-3 transition-colors hover:bg-blue-500/10 hover:text-blue-600",children:[c.jsx(Ic,{className:"h-3 w-3"}),t,c.jsx(ss,{className:me("h-3 w-3 transition-transform",s&&"rotate-180")})]}),s&&c.jsxs("div",{className:"absolute right-0 top-full z-50 mt-1 w-56 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[f?c.jsx("div",{className:"flex items-center justify-center py-4",children:c.jsx(_r,{className:"h-4 w-4 animate-spin text-fg-4"})}):o?c.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[o.local.map(v=>c.jsxs("button",{type:"button",disabled:m!==null,onClick:()=>C(v),className:me("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",v===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[v===t?c.jsx(Ia,{className:"h-3 w-3 shrink-0"}):m===v?c.jsx(_r,{className:"h-3 w-3 shrink-0 animate-spin"}):c.jsx("span",{className:"h-3 w-3 shrink-0"}),c.jsx("span",{className:"truncate",children:v})]},v)),o.remote.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mx-3 my-1 border-t border-line"}),c.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),o.remote.map(v=>c.jsxs("button",{type:"button",disabled:m!==null,onClick:()=>C(v),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-fg-2 transition-colors hover:bg-elevated",children:[m===v?c.jsx(_r,{className:"h-3 w-3 shrink-0 animate-spin"}):c.jsx("span",{className:"h-3 w-3 shrink-0"}),c.jsx("span",{className:"truncate",children:v})]},`remote-${v}`))]})]}):null,b&&c.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:b})]})]}):null}function W3(){const[e,t]=A.useState(null);return A.useEffect(()=>{const a=()=>fetch("/api/health").then(o=>o.json()).then(o=>{o.latestVersion&&o.latestVersion!=="0.6.3"&&t(o.latestVersion)}).catch(()=>{});a();const s=setInterval(a,30*6e4),l=()=>a();return window.addEventListener("focus",l),()=>{clearInterval(s),window.removeEventListener("focus",l)}},[]),e}function J3(){const e=Na(),t=oa(),a=qe(b=>b.repos),s=qe(b=>b.activeRepoId),l=qe(b=>b.setActiveRepo),o=Um(b=>b.preference),d=Um(b=>b.cycle),f=o==="light"?jA:o==="dark"?EA:bA,h=a.find(b=>b.id===s),m=W3(),x=b=>{var N;if(!b)return;l(b);const y=a.find(S=>S.id===b);if(!y)return;const T=((N=t.pathname.match(/\/(run|issues|pulls)/))==null?void 0:N[1])??"run";e(`/${encodeURIComponent(y.name)}/${T}`)};return c.jsx("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:c.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(IE,{className:"h-5 w-5 text-blue-500"}),c.jsx("span",{className:"text-sm font-bold tracking-tight text-fg",children:"Fourth Spark"}),c.jsxs("span",{className:"rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4",children:["v","0.6.3"]}),m&&c.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",m," 可用,运行 ",c.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("select",{value:s??"",onChange:b=>x(b.target.value),className:"rounded-md border border-line bg-base px-2.5 py-1 text-xs text-fg-2 focus:border-blue-500 focus:outline-none",children:a.map(b=>c.jsx("option",{value:b.id,children:b.name},b.id))}),h&&s&&c.jsx(Z3,{repoId:s,currentBranch:h.branch})]}),c.jsx("a",{href:"https://github.com/kinminghao/fourth-spark",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:c.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:c.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}),c.jsx("button",{type:"button",onClick:d,"aria-label":`主题: ${o}`,className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:c.jsx(f,{className:"h-4 w-4"})})]})]})})}function eC(){const e=qe(Da);return c.jsx("nav",{className:"hidden w-48 shrink-0 flex-col border-r border-line bg-surface py-2 md:flex",children:YE.map(t=>c.jsxs(gh,{to:$E(t.segment,t.global,e),className:({isActive:a})=>me("mx-2 flex items-center gap-2.5 rounded-md px-3 py-2 text-sm transition-colors",a?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[c.jsx(t.icon,{className:"h-4 w-4 shrink-0"}),t.label]},t.segment))})}function tC(){const e=qe(Da);return c.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-30 border-t border-line bg-surface pb-[var(--safe-bottom)] md:hidden",children:c.jsx("div",{className:"flex h-14 items-center justify-around",children:YE.map(t=>c.jsx(gh,{to:$E(t.segment,t.global,e),"aria-label":t.label,className:({isActive:a})=>me("flex h-10 w-10 items-center justify-center rounded-md transition-colors",a?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:c.jsx(t.icon,{className:"h-5 w-5 shrink-0"})},t.segment))})})}function nC(){return c.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[c.jsx(J3,{}),c.jsxs("div",{className:"flex min-h-0 flex-1",children:[c.jsx(eC,{}),c.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:c.jsx(NS,{})})]}),c.jsx(tC,{})]})}function aC({onClose:e}){const[t,a]=A.useState(""),[s,l]=A.useState(""),[o,d]=A.useState(""),[f,h]=A.useState(!1),[m,x]=A.useState(""),b=qe(C=>C.addRepo),y=s.trim()!==""&&o.trim()!==""&&t.trim()!==""&&!f,T=async C=>{const v=C.trim();if(v){h(!0),x("");try{const M=await t3(v);M.name&&!s.trim()&&l(M.name),M.gitUrl&&!o.trim()&&d(M.gitUrl)}catch(M){const k=M instanceof Error?M.message:"无法解析路径";try{const D=JSON.parse(k);x(D.error??k)}catch{x(k)}}h(!1)}},N=A.useRef(T);N.current=T,A.useEffect(()=>{const C=t.trim();if(!C)return;const v=setTimeout(()=>{N.current(C)},500);return()=>clearTimeout(v)},[t]);const S=async()=>{if(!y)return;x(""),await b(s.trim(),o.trim(),t.trim())&&e()};return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:c.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:C=>C.stopPropagation(),children:[c.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[c.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),c.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:c.jsx(Tt,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),c.jsx("input",{id:"m-path",value:t,onChange:C=>a(C.target.value),onBlur:C=>void T(C.target.value),placeholder:"/Users/you/code/repo",autoFocus:!0,className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"}),c.jsx("span",{className:"text-[11px] text-fg-5",children:f?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),c.jsx("input",{id:"m-name",value:s,onChange:C=>l(C.target.value),placeholder:"my-project",className:"w-full rounded-lg border border-line bg-base px-3 py-2 text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),c.jsx("input",{id:"m-git",value:o,onChange:C=>d(C.target.value),placeholder:"https://github.com/org/repo.git",className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-xs text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),m&&c.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:m}),c.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:e,className:"rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),c.jsx("button",{type:"button",onClick:S,disabled:!y,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:cursor-not-allowed disabled:bg-fg-6 disabled:text-fg-4",children:"添加仓库"})]})]})]})})}function rC({repoId:e,repoName:t,onClose:a}){const[s,l]=A.useState(""),[o,d]=A.useState(""),[f,h]=A.useState(!0),[m,x]=A.useState(!1),[b,y]=A.useState(null);A.useEffect(()=>{H3(e).then(S=>{l(S.content),d(S.content),h(!1)}).catch(S=>{y(S instanceof Error?S.message:String(S)),h(!1)})},[e]);const T=async()=>{x(!0),y(null);try{await F3(e,s),d(s)}catch(S){y(S instanceof Error?S.message:String(S))}x(!1)},N=s!==o;return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:c.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[c.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),c.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),c.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:c.jsx(Tt,{className:"h-4 w-4"})})]}),b&&c.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg bg-red-500/10 px-3 py-2 text-xs text-red-400",children:[c.jsx(ia,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:b})]}),f?c.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[c.jsx(_r,{className:"h-5 w-5 fs-spin"}),c.jsx("p",{className:"text-xs",children:"加载中…"})]}):c.jsx("textarea",{value:s,onChange:S=>l(S.target.value),spellCheck:!1,className:"h-96 w-full resize-y rounded-lg border border-line bg-base px-4 py-3 font-mono text-sm leading-relaxed text-fg placeholder:text-fg-6 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20",placeholder:`# AGENTS.md
401
401
 
402
402
  在此编写该仓库的 Agent 指令…`}),c.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:a,className:"rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"关闭"}),c.jsxs("button",{type:"button",onClick:()=>void T(),disabled:m||!N,className:"flex items-center gap-1.5 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:opacity-40",children:[c.jsx(Eh,{className:"h-3.5 w-3.5"}),m?"保存中…":"保存"]})]})]})})}function sC(){const e=qe(k=>k.repos),t=qe(k=>k.activeRepoId),a=qe(k=>k.setActiveRepo),s=qe(k=>k.removeRepo),l=qe(k=>k.loadRepos),[o,d]=A.useState(!1),[f,h]=A.useState(null),[m,x]=A.useState(null),[b,y]=A.useState(null),[T,N]=A.useState(null),[S,C]=A.useState(null),v=async(k,D)=>{x(k);try{D?await r3(k):await a3(k),await l()}catch{}x(null)},M=async k=>{y(k),N(null);try{await l3(k),await l()}catch(D){let $="拉取失败";if(D instanceof Us)try{$=JSON.parse(D.message).error??D.message}catch{$=D.message}N($)}y(null)};return c.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[c.jsxs("div",{className:"mx-auto max-w-4xl",children:[c.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"text-lg font-semibold text-fg",children:"仓库管理"}),c.jsx("p",{className:"mt-0.5 text-sm text-fg-4",children:"管理代码仓库,每个仓库对应一个独立的 Agent 运行环境"})]}),c.jsxs("button",{type:"button",onClick:()=>d(!0),className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 md:px-4",children:[c.jsx(Sr,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden md:inline",children:"添加仓库"})]})]}),T&&c.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/5 px-4 py-2.5 text-sm text-red-600",children:[c.jsx("span",{children:T}),c.jsx("button",{type:"button",onClick:()=>N(null),className:"shrink-0 rounded p-0.5 transition-colors hover:bg-red-500/10",children:c.jsx(Tt,{className:"h-3.5 w-3.5"})})]}),e.length===0?c.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed border-line-hard py-16 text-center",children:[c.jsx("div",{className:"rounded-full bg-elevated p-3",children:c.jsx(Sr,{className:"h-6 w-6 text-fg-4"})}),c.jsx("p",{className:"text-sm font-medium text-fg-3",children:"暂无代码仓库"}),c.jsx("p",{className:"text-xs text-fg-5",children:"添加一个本地仓库开始使用"}),c.jsx("button",{type:"button",onClick:()=>d(!0),className:"mt-2 rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"添加仓库"})]}):c.jsx(c.Fragment,{children:c.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:e.map(k=>{const D=k.id===t;return c.jsxs("div",{className:me("rounded-xl border p-4 transition-colors",D?"border-blue-500/40 bg-blue-500/5":"border-line"),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>a(k.id),className:"flex min-w-0 items-center gap-2 text-left",children:[D?c.jsx(co,{className:"h-4 w-4 shrink-0 text-blue-500"}):c.jsx(Dv,{className:"h-4 w-4 shrink-0 text-fg-5"}),c.jsx("span",{className:me("truncate font-medium",D?"text-fg":"text-fg-2"),children:k.name})]}),c.jsxs("span",{className:me("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",k.running?"bg-emerald-500/10 text-emerald-600":"bg-fg-6/30 text-fg-4"),children:[c.jsx("span",{className:me("h-1.5 w-1.5 rounded-full",k.running?"bg-emerald-500":"bg-fg-5")}),k.running?"运行中":"已停止"]})]}),c.jsxs("dl",{className:"mt-3 space-y-1 font-mono text-xs text-fg-4",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("dt",{className:"shrink-0 text-fg-5",children:"Git"}),c.jsx("dd",{className:"min-w-0 truncate",children:k.gitUrl})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("dt",{className:"shrink-0 text-fg-5",children:"路径"}),c.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[c.jsx("span",{className:"truncate",children:k.localPath}),c.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(k.localPath),title:"复制路径",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:c.jsx(dc,{className:"h-3 w-3"})})]})]}),k.running&&k.port&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"shrink-0 text-fg-5",children:"直连"}),c.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[c.jsxs("a",{href:`http://127.0.0.1:${k.port}`,target:"_blank",rel:"noopener noreferrer",className:"truncate text-blue-500 hover:underline",children:["127.0.0.1:",k.port]}),c.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(`http://127.0.0.1:${k.port}`),title:"复制链接",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:c.jsx(dc,{className:"h-3 w-3"})})]})]})]}),c.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>C({id:k.id,name:k.name}),className:"flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-md border border-line px-2.5 text-xs font-medium text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:[c.jsx(AE,{className:"h-3 w-3"}),"配置"]}),c.jsx("button",{type:"button",onClick:()=>void M(k.id),disabled:b===k.id,className:"flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-md border border-blue-500/30 px-2.5 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-500/10 disabled:opacity-50",children:b===k.id?c.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):c.jsxs(c.Fragment,{children:[c.jsx(mv,{className:"h-3 w-3"}),"拉取"]})}),c.jsx("button",{type:"button",onClick:()=>void v(k.id,k.running),disabled:m===k.id,className:me("flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border text-xs font-medium transition-colors disabled:opacity-50",k.running?"border-amber-500/30 text-amber-600 hover:bg-amber-500/10":"border-emerald-500/30 text-emerald-600 hover:bg-emerald-500/10"),children:m===k.id?c.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):k.running?c.jsxs(c.Fragment,{children:[c.jsx(kE,{className:"h-3 w-3 fill-current"}),"停止"]}):c.jsxs(c.Fragment,{children:[c.jsx(Lc,{className:"h-3 w-3 fill-current"}),"启动"]})}),f===k.id?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>{s(k.id),h(null)},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-red-500/30 text-red-500 transition-colors hover:bg-red-500/10",children:c.jsx(Ia,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:()=>h(null),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line text-fg-4 transition-colors hover:bg-elevated",children:c.jsx(Tt,{className:"h-3.5 w-3.5"})})]}):c.jsx("button",{type:"button",onClick:()=>h(k.id),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line text-fg-5 transition-colors hover:bg-red-500/10 hover:text-red-500",children:c.jsx(Li,{className:"h-3.5 w-3.5"})})]})]},k.id)})})}),c.jsxs("p",{className:"mt-3 text-xs text-fg-5",children:[e.length," 个仓库"]})]}),o&&c.jsx(aC,{onClose:()=>d(!1)}),S&&c.jsx(rC,{repoId:S.id,repoName:S.name,onClose:()=>C(null)})]})}const iC=new Set(["tool","tool-use","tool_use","tool-call","tool_call","tool-result","tool_result"]),lC=new Set(["thinking","reasoning","reason"]),oC=new Set(["text","output_text","message"]);function _h(e){var a;const t=((a=e.type)==null?void 0:a.toLowerCase())??"";return iC.has(t)||e.toolName!=null||e.tool!=null?"tool":lC.has(t)?"thinking":oC.has(t)||e.content!=null||e.text!=null?"text":"other"}function pc(e){return e.content??e.text??""}function GE(e){return e.toolName??e.tool??"tool"}function jc(e){var t;return e.input??((t=e.state)==null?void 0:t.input)}function Nh(e){var t;return e.output??((t=e.state)==null?void 0:t.output)}function Sh(e){var a,s,l;const t=(s=(a=e.state)==null?void 0:a.status)==null?void 0:s.toLowerCase();return t==="completed"||t==="done"||t==="success"?"completed":t==="error"||t==="failed"||((l=e.state)==null?void 0:l.error)!=null?"error":t==="pending"||t==="queued"?"pending":t==="running"||t==="in_progress"?"running":Nh(e)!=null?"completed":"running"}function ix(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ji(e){const t=e==null?void 0:e.toLowerCase();return t==="in_progress"||t==="in-progress"||t==="active"?"in_progress":t==="completed"||t==="done"||t==="complete"?"completed":t==="cancelled"||t==="canceled"?"cancelled":"pending"}function uC(e){return e.filter(t=>ji(t.status)==="completed").length}function mo(e){const t=GE(e).toLowerCase();return t==="question"||t==="mcp_question"}function cC(e){const t=jc(e);if(!t||typeof t!="object")return null;const a=t;return Array.isArray(a.questions)?a.questions:null}function gc(e){if(!mo(e))return!1;const t=Sh(e);return t==="pending"||t==="running"}const dC=/\bses_[a-zA-Z0-9]+/;function fC(e){var l;const t=jc(e);if(t&&typeof t=="object"){const o=t;if(typeof o.task_id=="string"&&o.task_id.startsWith("ses_"))return o.task_id}const a=(l=e.state)==null?void 0:l.metadata;if(a){const o=a.session_id??a.sessionId;if(typeof o=="string"&&o.startsWith("ses_"))return o}const s=Nh(e);if(typeof s=="string"){const o=dC.exec(s);if(o)return o[0]}if(s&&typeof s=="object"){const o=s,d=o.session_id??o.sessionId??o.task_id;if(typeof d=="string"&&d.startsWith("ses_"))return d}return null}let mC=0;const Yt=Fs(e=>({toasts:[],addToast:(t,a="info",s,l)=>{const o=(l==null?void 0:l.id)??`toast-${++mC}-${Date.now()}`;e(d=>d.toasts.some(f=>f.id===o)?d:{toasts:[...d.toasts,{id:o,message:t,variant:a,sessionId:s,persistent:l==null?void 0:l.persistent}]}),l!=null&&l.persistent||setTimeout(()=>{e(d=>({toasts:d.toasts.filter(f=>f.id!==o)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(s=>s.id!==t)}))}}));function KE(e){return`question-${e}`}function lm(e,t){const a=t.find(l=>l.id===e),s=(a==null?void 0:a.title)||e.slice(-8);Yt.getState().addToast(`${s} — 等待回复`,"warning",e,{id:KE(e),persistent:!0})}function hC(e){var t;for(const a of e)if((t=a.parts)!=null&&t.some(s=>mo(s)&&gc(s)))return!0;return!1}const ho=[],bc=[];function lx(e){return e.id??e.callID}function ka(){return qe.getState().activeRepoId}const Ue=Fs((e,t)=>({sessions:[],activeSessionId:null,messages:{},todos:{},sessionStatuses:{},errorReasons:{},sessionLinks:{},allSessionLinks:{},loadingSessions:!1,loadError:null,sendError:null,loadSessions:async()=>{const a=ka();if(!a){e({sessions:[],loadingSessions:!1});return}e({loadingSessions:!0,loadError:null});try{const[s,l]=await Promise.all([o3(a),Zb(a).catch(()=>null)]),o={sessions:s,loadingSessions:!1};l&&(o.allSessionLinks=l),e(o)}catch(s){e({loadingSessions:!1,loadError:s instanceof Error?s.message:"Failed to load sessions"})}},createSession:async(a,s,l,o,d,f)=>{const h=ka();if(!h)return null;e({sendError:null});try{const m=await u3(h,a,s,l,o,d,f);return e(x=>({sessions:[m,...x.sessions.filter(b=>b.id!==m.id)],activeSessionId:m.id,messages:{...x.messages,[m.id]:[]}})),t().setSessionStatus(m.id,"busy"),m}catch(m){return e({sendError:m instanceof Error?m.message:"Failed to create session"}),null}},setActiveSession:async a=>{ka()&&(e({activeSessionId:a,sendError:null}),await t().refreshSessionData(a))},refreshSessionData:async a=>{const s=ka();if(!s)return;const[l,o,d,f,h]=await Promise.allSettled([p3(s,a),g3(s,a),BE(s,a),c3(s,a),Xb(s,a)]);e(m=>{const x={};if(l.status==="fulfilled"&&(x.messages={...m.messages,[a]:l.value}),o.status==="fulfilled"&&(x.todos={...m.todos,[a]:o.value}),d.status==="fulfilled"&&(x.sessionStatuses={...m.sessionStatuses,[a]:d.value.type}),f.status==="fulfilled"){const b=f.value;x.sessions=m.sessions.map(y=>y.id===a?{...y,...b}:y)}return h.status==="fulfilled"&&(x.sessionLinks={...m.sessionLinks,[a]:h.value}),x}),l.status==="fulfilled"&&hC(l.value)&&lm(a,t().sessions)},refreshSessionLinks:async a=>{const s=ka();if(s)try{const[l,o]=await Promise.all([Xb(s,a),Zb(s).catch(()=>null)]);e(d=>{const f={sessionLinks:{...d.sessionLinks,[a]:l}};return o&&(f.allSessionLinks=o),f})}catch{}},addLink:async(a,s,l)=>{const o=ka();if(!o)return!1;try{return await b3(o,a,s,l),await t().refreshSessionLinks(a),!0}catch{return!1}},removeLink:async(a,s,l)=>{const o=ka();if(!o)return!1;try{return await x3(o,a,s,l),await t().refreshSessionLinks(a),!0}catch{return!1}},deleteSession:async a=>{const s=ka();if(s)try{await d3(s,a)}catch{}e(l=>{const{[a]:o,...d}=l.messages,{[a]:f,...h}=l.todos,{[a]:m,...x}=l.sessionStatuses,{[a]:b,...y}=l.errorReasons,{[a]:T,...N}=l.sessionLinks,{[a]:S,...C}=l.allSessionLinks;return{sessions:l.sessions.filter(v=>v.id!==a),messages:d,todos:h,sessionStatuses:x,errorReasons:y,sessionLinks:N,allSessionLinks:C,activeSessionId:l.activeSessionId===a?null:l.activeSessionId}})},sendMessage:async(a,s)=>{const l=ka(),o=t().activeSessionId;if(!l||!o)return;const d=t().sessions.find(f=>f.id===o);e({sendError:null}),t().setSessionStatus(o,"busy");try{await f3(l,o,a,d==null?void 0:d.agent,s)}catch(f){e({sendError:f instanceof Error?f.message:"Failed to send message"}),t().setSessionStatus(o,"idle")}},abortSession:async()=>{const a=ka(),s=t().activeSessionId;if(!(!a||!s)){try{await m3(a,s)}catch{}t().setSessionStatus(s,"idle")}},clearSessions:()=>{e({sessions:[],activeSessionId:null,messages:{},todos:{},sessionStatuses:{},errorReasons:{},sessionLinks:{},allSessionLinks:{},loadError:null,sendError:null})},updateMessage:(a,s)=>{var l;e(o=>{const d=o.messages[a]??[],f=d.findIndex(m=>m.id===s.id);let h;if(f>=0){const m={...d[f],...s};(!s.parts||s.parts.length===0)&&d[f].parts&&(m.parts=d[f].parts),h=[...d],h[f]=m}else h=[...d,s];return{messages:{...o.messages,[a]:h}}}),(l=s.parts)!=null&&l.some(o=>mo(o)&&gc(o))&&lm(a,t().sessions)},updateMessagePart:(a,s,l)=>{e(o=>{const d=o.messages[a]??[],f=d.findIndex(N=>N.id===s),h=f>=0?d[f]:{id:s,role:"assistant"},m=h.parts?[...h.parts]:[],x=lx(l),b=x!=null?m.findIndex(N=>lx(N)===x):-1;b>=0?m[b]={...m[b],...l}:m.push(l);const y={...h,parts:m},T=f>=0?[...d]:[...d,y];return f>=0&&(T[f]=y),{messages:{...o.messages,[a]:T}}}),mo(l)&&gc(l)&&lm(a,t().sessions)},appendMessagePartDelta:(a,s,l,o)=>{e(d=>{const f=d.messages[a]??[],h=f.findIndex(N=>N.id===s),m=h>=0?f[h]:{id:s,role:"assistant"},x=m.parts?[...m.parts]:[],b=x.findIndex(N=>N.id===l);if(b>=0){const N=x[b],S=pc(N)+o;x[b]=N.content!=null?{...N,content:S}:{...N,text:S}}else x.push({id:l,type:"text",text:o});const y={...m,parts:x},T=h>=0?[...f]:[...f,y];return h>=0&&(T[h]=y),{messages:{...d.messages,[a]:T}}})},updateTodos:(a,s)=>{e(l=>({todos:{...l.todos,[a]:s}}))},updateSessionInfo:a=>{e(s=>s.sessions.some(o=>o.id===a.id)?{sessions:s.sessions.map(o=>o.id===a.id?{...o,...a}:o)}:{sessions:[a,...s.sessions]})},setSessionStatus:(a,s,l)=>{const o=t().sessionStatuses[a];if(o!==s){const d=t().sessions.find(h=>h.id===a),f=(d==null?void 0:d.title)||a.slice(-8);if(s==="idle"&&o!==void 0&&o!=="idle")Yt.getState().removeToast(KE(a)),Yt.getState().addToast(`${f} — 完成`,"success",a);else if(s==="busy"&&(o===void 0||o==="idle"))Yt.getState().addToast(`${f} — 开始运行`,"info",a);else if(s==="retry")Yt.getState().addToast(`${f} — 进入重试`,"warning",a);else if(s==="error"){const h=l?`${f} — 错误: ${l}`:`${f} — 发生错误`;Yt.getState().addToast(h,"error",a)}}e(d=>{const f=l?{...d.errorReasons,[a]:l}:s!=="error"?(()=>{const{[a]:h,...m}=d.errorReasons;return m})():d.errorReasons;return{sessionStatuses:{...d.sessionStatuses,[a]:s},errorReasons:f}})},bulkSetStatuses:a=>{e({sessionStatuses:{...t().sessionStatuses,...a}})},renameSession:async(a,s)=>{const l=ka();if(l){e(o=>({sessions:o.sessions.map(d=>d.id===a?{...d,title:s}:d)}));try{await B3(l,a,s)}catch{await t().loadSessions()}}}})),Pe=Fs((e,t)=>({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,syncing:!1,selectedIssueId:null,previewIssueId:null,matchingParentId:null,matchingCandidateId:null,pendingDraft:null,clearIssues:()=>e({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,selectedIssueId:null,previewIssueId:null,matchingParentId:null,matchingCandidateId:null,pendingDraft:null}),setSelectedIssue:a=>e({selectedIssueId:a}),setPreviewIssue:a=>e({previewIssueId:a}),setPendingDraft:a=>e({pendingDraft:a}),enterMatchMode:a=>e({matchingParentId:a,matchingCandidateId:null,previewIssueId:null}),exitMatchMode:()=>{const a=t().matchingParentId;e({matchingParentId:null,matchingCandidateId:null,previewIssueId:a})},setMatchCandidate:a=>e({matchingCandidateId:a}),linkChild:async(a,s)=>{var o;const l=qe.getState().activeRepoId;if(!l)return!1;try{await w3(l,a,s);const d=(o=t().issues.find(f=>f.number===a))==null?void 0:o.id;return d&&e(f=>({issues:f.issues.map(h=>h.number===s?{...h,parentId:d}:h),matchingCandidateId:null})),!0}catch{return!1}},updateIssueState:async(a,s)=>{const l=qe.getState().activeRepoId;if(!l)return!1;try{const o=await zE(l,a,{state:s});return e(d=>({issues:d.issues.map(f=>f.number===a?{...f,state:o.state}:f)})),!0}catch{return!1}},loadIssues:async()=>{const a=qe.getState().activeRepoId;if(!a){e({issues:[],loaded:!0});return}try{const s=await tx(a,"all");e({issues:s,loaded:!0})}catch{e({loaded:!0})}},syncIssues:async()=>{const a=qe.getState().activeRepoId;if(a){e({syncing:!0});try{await A3(a);const[s,l,o]=await Promise.all([tx(a,"all"),Jb(a),ex(a)]);e({issues:s,tags:l,milestones:o,syncing:!1})}catch(s){e({syncing:!1});let l="同步 Issue 失败";if(s instanceof Us)try{const o=JSON.parse(s.message);o.error&&(l=o.error)}catch{s.message&&(l=s.message)}Yt.getState().addToast(l,"error")}}},createIssue:async(a,s)=>{const l=qe.getState().activeRepoId;if(!l)return null;try{const o=await C3(l,a,s);return e(d=>({issues:[o,...d.issues]})),o}catch{return null}},loadTags:async()=>{const a=qe.getState().activeRepoId;if(!a){e({tags:[]});return}try{const s=await Jb(a);e({tags:s})}catch{}},cycleTagFilter:a=>{e(s=>{const l=new Map(s.tagFilterMode),o=l.get(a);return o?o==="include"?l.set(a,"exclude"):l.delete(a):l.set(a,"include"),{tagFilterMode:l}})},clearTagFilter:()=>e({tagFilterMode:new Map}),loadMilestones:async()=>{const a=qe.getState().activeRepoId;if(!a){e({milestones:[]});return}try{const s=await ex(a);e({milestones:s})}catch{}},setMilestoneFilter:a=>e({selectedMilestoneId:a})}));function ox(e){const t=[],a=String(e||"");let s=a.indexOf(","),l=0,o=!1;for(;!o;){s===-1&&(s=a.length,o=!0);const d=a.slice(l,s).trim();(d||!o)&&t.push(d),l=s+1,s=a.indexOf(",",l)}return t}function VE(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const pC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bC={};function ux(e,t){return(bC.jsx?gC:pC).test(e)}const xC=/[ \t\n\f\r]/g;function EC(e){return typeof e=="object"?e.type==="text"?cx(e.value):!1:cx(e)}function cx(e){return e.replace(xC,"")===""}class To{constructor(t,a,s){this.normal=a,this.property=t,s&&(this.space=s)}}To.prototype.normal={};To.prototype.property={};To.prototype.space=void 0;function QE(e,t){const a={},s={};for(const l of e)Object.assign(a,l.property),Object.assign(s,l.normal);return new To(a,s,t)}function po(e){return e.toLowerCase()}class Kn{constructor(t,a){this.attribute=a,this.property=t}}Kn.prototype.attribute="";Kn.prototype.booleanish=!1;Kn.prototype.boolean=!1;Kn.prototype.commaOrSpaceSeparated=!1;Kn.prototype.commaSeparated=!1;Kn.prototype.defined=!1;Kn.prototype.mustUseProperty=!1;Kn.prototype.number=!1;Kn.prototype.overloadedBoolean=!1;Kn.prototype.property="";Kn.prototype.spaceSeparated=!1;Kn.prototype.space=void 0;let yC=0;const Ke=zs(),sn=zs(),Fm=zs(),ye=zs(),kt=zs(),js=zs(),ra=zs();function zs(){return 2**++yC}const zm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:sn,commaOrSpaceSeparated:ra,commaSeparated:js,number:ye,overloadedBoolean:Fm,spaceSeparated:kt},Symbol.toStringTag,{value:"Module"})),om=Object.keys(zm);class vh extends Kn{constructor(t,a,s,l){let o=-1;if(super(t,a),dx(this,"space",l),typeof s=="number")for(;++o<om.length;){const d=om[o];dx(this,om[o],(s&zm[d])===zm[d])}}}vh.prototype.defined=!0;function dx(e,t,a){a&&(e[t]=a)}function Yi(e){const t={},a={};for(const[s,l]of Object.entries(e.properties)){const o=new vh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,a[po(s)]=s,a[po(o.attribute)]=s}return new To(t,a,e.space)}const XE=Yi({properties:{ariaActiveDescendant:null,ariaAtomic:sn,ariaAutoComplete:null,ariaBusy:sn,ariaChecked:sn,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:kt,ariaCurrent:null,ariaDescribedBy:kt,ariaDetails:null,ariaDisabled:sn,ariaDropEffect:kt,ariaErrorMessage:null,ariaExpanded:sn,ariaFlowTo:kt,ariaGrabbed:sn,ariaHasPopup:null,ariaHidden:sn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kt,ariaLevel:ye,ariaLive:null,ariaModal:sn,ariaMultiLine:sn,ariaMultiSelectable:sn,ariaOrientation:null,ariaOwns:kt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:sn,ariaReadOnly:sn,ariaRelevant:null,ariaRequired:sn,ariaRoleDescription:kt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:sn,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ZE(e,t){return t in e?e[t]:t}function WE(e,t){return ZE(e,t.toLowerCase())}const TC=Yi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:js,acceptCharset:kt,accessKey:kt,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alpha:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:kt,autoFocus:Ke,autoPlay:Ke,blocking:kt,capture:null,charSet:null,checked:Ke,cite:null,className:kt,closedBy:null,colorSpace:null,cols:ye,colSpan:ye,command:null,commandFor:null,content:null,contentEditable:sn,controls:Ke,controlsList:kt,coords:ye|js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:Fm,draggable:sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:kt,height:ye,hidden:Fm,high:ye,href:null,hrefLang:null,htmlFor:kt,httpEquiv:kt,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:kt,itemRef:kt,itemScope:Ke,itemType:kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ke,optimum:ye,pattern:null,ping:kt,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:kt,required:Ke,reversed:Ke,rows:ye,rowSpan:ye,sandbox:kt,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootCustomElementRegistry:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shadowRootSerializable:Ke,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:sn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Ke,useMap:null,value:sn,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:sn,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ke,disablePictureInPicture:Ke,disableRemotePlayback:Ke,exportParts:js,part:kt,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:WE}),_C=Yi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ra,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:kt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:js,g2:js,glyphName:js,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:ra,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ra,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ra,rev:ra,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ra,requiredFeatures:ra,requiredFonts:ra,requiredFormats:ra,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:ra,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ra,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ra,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ZE}),JE=Yi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ey=Yi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:WE}),ty=Yi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),NC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},SC=/[A-Z]/g,fx=/-[a-z]/g,vC=/^data[-\w.:]+$/i;function Bc(e,t){const a=po(t);let s=t,l=Kn;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&vC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(fx,CC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!fx.test(o)){let d=o.replace(SC,AC);d.charAt(0)!=="-"&&(d="-"+d),t="data"+d}}l=vh}return new l(s,t)}function AC(e){return"-"+e.toLowerCase()}function CC(e){return e.charAt(1).toUpperCase()}const _o=QE([XE,TC,JE,ey,ty],"html"),us=QE([XE,_C,JE,ey,ty],"svg");function mx(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function ny(e){return e.join(" ").trim()}var ki={},um,hx;function wC(){if(hx)return um;hx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
403
403
  `,m="/",x="*",b="",y="comment",T="declaration";function N(C,v){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];v=v||{};var M=1,k=1;function D(Z){var J=Z.match(t);J&&(M+=J.length);var V=Z.lastIndexOf(h);k=~V?Z.length-V:k+Z.length}function $(){var Z={line:M,column:k};return function(J){return J.position=new L(Z),fe(),J}}function L(Z){this.start=Z,this.end={line:M,column:k},this.source=v.source}L.prototype.content=C;function Y(Z){var J=new Error(v.source+":"+M+":"+k+": "+Z);if(J.reason=Z,J.filename=v.source,J.line=M,J.column=k,J.source=C,!v.silent)throw J}function re(Z){var J=Z.exec(C);if(J){var V=J[0];return D(V),C=C.slice(V.length),J}}function fe(){re(a)}function U(Z){var J;for(Z=Z||[];J=H();)J!==!1&&Z.push(J);return Z}function H(){var Z=$();if(!(m!=C.charAt(0)||x!=C.charAt(1))){for(var J=2;b!=C.charAt(J)&&(x!=C.charAt(J)||m!=C.charAt(J+1));)++J;if(J+=2,b===C.charAt(J-1))return Y("End of comment missing");var V=C.slice(2,J-2);return k+=2,D(V),C=C.slice(J),k+=2,Z({type:y,comment:V})}}function ae(){var Z=$(),J=re(s);if(J){if(H(),!re(l))return Y("property missing ':'");var V=re(o),G=Z({type:T,property:S(J[0].replace(e,b)),value:V?S(V[0].replace(e,b)):b});return re(d),G}}function se(){var Z=[];U(Z);for(var J;J=ae();)J!==!1&&(Z.push(J),U(Z));return Z}return fe(),se()}function S(C){return C?C.replace(f,b):b}return um=N,um}var px;function kC(){if(px)return ki;px=1;var e=ki&&ki.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ki,"__esModule",{value:!0}),ki.default=a;const t=e(wC());function a(s,l){let o=null;if(!s||typeof s!="string")return o;const d=(0,t.default)(s),f=typeof l=="function";return d.forEach(h=>{if(h.type!=="declaration")return;const{property:m,value:x}=h;f?l(m,x,h):x&&(o=o||{},o[m]=x)}),o}return ki}var $l={},gx;function RC(){if(gx)return $l;gx=1,Object.defineProperty($l,"__esModule",{value:!0}),$l.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(m){return!m||a.test(m)||e.test(m)},d=function(m,x){return x.toUpperCase()},f=function(m,x){return"".concat(x,"-")},h=function(m,x){return x===void 0&&(x={}),o(m)?m:(m=m.toLowerCase(),x.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,d))};return $l.camelCase=h,$l}var Gl,bx;function OC(){if(bx)return Gl;bx=1;var e=Gl&&Gl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(kC()),a=RC();function s(l,o){var d={};return!l||typeof l!="string"||(0,t.default)(l,function(f,h){f&&h&&(d[(0,a.camelCase)(f,o)]=h)}),d}return s.default=s,Gl=s,Gl}var IC=OC();const MC=Cc(IC),Pc=ay("end"),Qa=ay("start");function ay(e){return t;function t(a){const s=a&&a.position&&a.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function DC(e){const t=Qa(e),a=Pc(e);if(t&&a)return{start:t,end:a}}function eo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xx(e.position):"start"in e||"end"in e?xx(e):"line"in e||"column"in e?qm(e):""}function qm(e){return Ex(e&&e.line)+":"+Ex(e&&e.column)}function xx(e){return qm(e&&e.start)+"-"+qm(e&&e.end)}function Ex(e){return e&&typeof e=="number"?e:1}class vn extends Error{constructor(t,a,s){super(),typeof a=="string"&&(s=a,a=void 0);let l="",o={},d=!1;if(a&&("line"in a&&"column"in a?o={place:a}:"start"in a&&"end"in a?o={place:a}:"type"in a?o={ancestors:[a],place:a.position}:o={...a}),typeof t=="string"?l=t:!o.cause&&t&&(d=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const h=s.indexOf(":");h===-1?o.ruleId=s:(o.source=s.slice(0,h),o.ruleId=s.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=eo(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=d&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vn.prototype.file="";vn.prototype.name="";vn.prototype.reason="";vn.prototype.message="";vn.prototype.stack="";vn.prototype.column=void 0;vn.prototype.line=void 0;vn.prototype.ancestors=void 0;vn.prototype.cause=void 0;vn.prototype.fatal=void 0;vn.prototype.place=void 0;vn.prototype.ruleId=void 0;vn.prototype.source=void 0;const Ah={}.hasOwnProperty,LC=new Map,jC=/[A-Z]/g,BC=new Set(["table","tbody","thead","tfoot","tr"]),PC=new Set(["td","th"]),ry="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function UC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=KC(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=GC(a,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?us:_o,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=sy(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function sy(e,t,a){if(t.type==="element")return HC(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return FC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qC(e,t,a);if(t.type==="mdxjsEsm")return zC(e,t);if(t.type==="root")return YC(e,t,a);if(t.type==="text")return $C(e,t)}function HC(e,t,a){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=us,e.schema=l),e.ancestors.push(t);const o=ly(e,t.tagName,!1),d=VC(e,t);let f=wh(e,t);return BC.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!EC(h):!0})),iy(e,d,o,t),Ch(d,f),e.ancestors.pop(),e.schema=s,e.create(t,o,d,a)}function FC(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}go(e,t.position)}function zC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);go(e,t.position)}function qC(e,t,a){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=us,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:ly(e,t.name,!0),d=QC(e,t),f=wh(e,t);return iy(e,d,o,t),Ch(d,f),e.ancestors.pop(),e.schema=s,e.create(t,o,d,a)}function YC(e,t,a){const s={};return Ch(s,wh(e,t)),e.create(t,e.Fragment,s,a)}function $C(e,t){return t.value}function iy(e,t,a,s){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=s)}function Ch(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function GC(e,t,a){return s;function s(l,o,d,f){const m=Array.isArray(d.children)?a:t;return f?m(o,d,f):m(o,d)}}function KC(e,t){return a;function a(s,l,o,d){const f=Array.isArray(o.children),h=Qa(s);return t(l,o,d,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function VC(e,t){const a={};let s,l;for(l in t.properties)if(l!=="children"&&Ah.call(t.properties,l)){const o=XC(e,l,t.properties[l]);if(o){const[d,f]=o;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&PC.has(t.tagName)?s=f:a[d]=f}}if(s){const o=a.style||(a.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return a}function QC(e,t){const a={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const d=o.expression;d.type;const f=d.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else go(e,t.position);else{const l=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else go(e,t.position);else o=s.value===null?!0:s.value;a[l]=o}return a}function wh(e,t){const a=[];let s=-1;const l=e.passKeys?new Map:LC;for(;++s<t.children.length;){const o=t.children[s];let d;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const m=l.get(h)||0;d=h+"-"+m,l.set(h,m+1)}}const f=sy(e,o,d);f!==void 0&&a.push(f)}return a}function XC(e,t,a){const s=Bc(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=s.commaSeparated?VE(a):ny(a)),s.property==="style"){let l=typeof a=="object"?a:ZC(e,String(a));return e.stylePropertyNameCase==="css"&&(l=WC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?NC[s.property]||s.property:s.attribute,a]}}function ZC(e,t){try{return MC(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const s=a,l=new vn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=ry+"#cannot-parse-style-attribute",l}}function ly(e,t,a){let s;if(!a)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,d;for(;++o<l.length;){const f=ux(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=d}else s=ux(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Ah.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);go(e)}function go(e,t){const a=new vn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=ry+"#cannot-handle-mdx-estrees-without-createevaluater",a}function WC(e){const t={};let a;for(a in e)Ah.call(e,a)&&(t[JC(a)]=e[a]);return t}function JC(e){let t=e.replace(jC,ew);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ew(e){return"-"+e.toLowerCase()}const cm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},tw={};function kh(e,t){const a=tw,s=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,l=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return oy(e,s,l)}function oy(e,t,a){if(nw(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yx(e.children,t,a)}return Array.isArray(e)?yx(e,t,a):""}function yx(e,t,a){const s=[];let l=-1;for(;++l<e.length;)s[l]=oy(e[l],t,a);return s.join("")}function nw(e){return!!(e&&typeof e=="object")}const Tx=document.createElement("i");function Rh(e){const t="&"+e+";";Tx.innerHTML=t;const a=Tx.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===t?!1:a}function sa(e,t,a,s){const l=e.length;let o=0,d;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,a=a>0?a:0,s.length<1e4)d=Array.from(s),d.unshift(t,a),e.splice(...d);else for(a&&e.splice(t,a);o<s.length;)d=s.slice(o,o+1e4),d.unshift(t,0),e.splice(...d),o+=1e4,t+=1e4}function ya(e,t){return e.length>0?(sa(e,e.length,0,t),e):t}const _x={}.hasOwnProperty;function uy(e){const t={};let a=-1;for(;++a<e.length;)aw(t,e[a]);return t}function aw(e,t){let a;for(a in t){const l=(_x.call(e,a)?e[a]:void 0)||(e[a]={}),o=t[a];let d;if(o)for(d in o){_x.call(l,d)||(l[d]=[]);const f=o[d];rw(l[d],Array.isArray(f)?f:f?[f]:[])}}}function rw(e,t){let a=-1;const s=[];for(;++a<t.length;)(t[a].add==="after"?e:s).push(t[a]);sa(e,0,0,s)}function cy(e,t){const a=Number.parseInt(e,t);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Oa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const In=cs(/[A-Za-z]/),Sn=cs(/[\dA-Za-z]/),sw=cs(/[#-'*+\--9=?A-Z^-~]/);function xc(e){return e!==null&&(e<32||e===127)}const Ym=cs(/\d/),iw=cs(/[\dA-Fa-f]/),lw=cs(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Rt(e){return e!==null&&(e<0||e===32)}function rt(e){return e===-2||e===-1||e===32}const Uc=cs(new RegExp("\\p{P}|\\p{S}","u")),Hs=cs(/\s/);function cs(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function $i(e){const t=[];let a=-1,s=0,l=0;for(;++a<e.length;){const o=e.charCodeAt(a);let d="";if(o===37&&Sn(e.charCodeAt(a+1))&&Sn(e.charCodeAt(a+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(d=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(a+1);o<56320&&f>56319&&f<57344?(d=String.fromCharCode(o,f),l=1):d="�"}else d=String.fromCharCode(o);d&&(t.push(e.slice(s,a),encodeURIComponent(d)),s=a+l+1,d=""),l&&(a+=l,l=0)}return t.join("")+e.slice(s)}function ct(e,t,a,s){const l=s?s-1:Number.POSITIVE_INFINITY;let o=0;return d;function d(h){return rt(h)?(e.enter(a),f(h)):t(h)}function f(h){return rt(h)&&o++<l?(e.consume(h),f):(e.exit(a),t(h))}}const ow={tokenize:uw};function uw(e){const t=e.attempt(this.parser.constructs.contentInitial,s,l);let a;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ct(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),o(f)}function o(f){const h=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=h),a=h,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return He(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),d)}}const cw={tokenize:dw},Nx={tokenize:fw};function dw(e){const t=this,a=[];let s=0,l,o,d;return f;function f(k){if(s<a.length){const D=a[s];return t.containerState=D[1],e.attempt(D[0].continuation,h,m)(k)}return m(k)}function h(k){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&M();const D=t.events.length;let $=D,L;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){L=t.events[$][1].end;break}v(s);let Y=D;for(;Y<t.events.length;)t.events[Y][1].end={...L},Y++;return sa(t.events,$+1,0,t.events.slice(D)),t.events.length=Y,m(k)}return f(k)}function m(k){if(s===a.length){if(!l)return y(k);if(l.currentConstruct&&l.currentConstruct.concrete)return N(k);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nx,x,b)(k)}function x(k){return l&&M(),v(s),y(k)}function b(k){return t.parser.lazy[t.now().line]=s!==a.length,d=t.now().offset,N(k)}function y(k){return t.containerState={},e.attempt(Nx,T,N)(k)}function T(k){return s++,a.push([t.currentConstruct,t.containerState]),y(k)}function N(k){if(k===null){l&&M(),v(0),e.consume(k);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),S(k)}function S(k){if(k===null){C(e.exit("chunkFlow"),!0),v(0),e.consume(k);return}return He(k)?(e.consume(k),C(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(k),S)}function C(k,D){const $=t.sliceStream(k);if(D&&$.push(null),k.previous=o,o&&(o.next=k),o=k,l.defineSkip(k.start),l.write($),t.parser.lazy[k.start.line]){let L=l.events.length;for(;L--;)if(l.events[L][1].start.offset<d&&(!l.events[L][1].end||l.events[L][1].end.offset>d))return;const Y=t.events.length;let re=Y,fe,U;for(;re--;)if(t.events[re][0]==="exit"&&t.events[re][1].type==="chunkFlow"){if(fe){U=t.events[re][1].end;break}fe=!0}for(v(s),L=Y;L<t.events.length;)t.events[L][1].end={...U},L++;sa(t.events,re+1,0,t.events.slice(Y)),t.events.length=L}}function v(k){let D=a.length;for(;D-- >k;){const $=a[D];t.containerState=$[1],$[0].exit.call(t,e)}a.length=k}function M(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function fw(e,t,a){return ct(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Bi(e){if(e===null||Rt(e)||Hs(e))return 1;if(Uc(e))return 2}function Hc(e,t,a){const s=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!s.includes(o)&&(t=o(t,a),s.push(o))}return t}const $m={name:"attention",resolveAll:mw,tokenize:hw};function mw(e,t){let a=-1,s,l,o,d,f,h,m,x;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(s=a;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[s][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;h=e[s][1].end.offset-e[s][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const b={...e[s][1].end},y={...e[a][1].start};Sx(b,-h),Sx(y,h),d={type:h>1?"strongSequence":"emphasisSequence",start:b,end:{...e[s][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:y},o={type:h>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[a][1].start}},l={type:h>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[s][1].end={...d.start},e[a][1].start={...f.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=ya(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=ya(m,[["enter",l,t],["enter",d,t],["exit",d,t],["enter",o,t]]),m=ya(m,Hc(t.parser.constructs.insideSpan.null,e.slice(s+1,a),t)),m=ya(m,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[a][1].end.offset-e[a][1].start.offset?(x=2,m=ya(m,[["enter",e[a][1],t],["exit",e[a][1],t]])):x=0,sa(e,s-1,a-s+3,m),a=s+m.length-x-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function hw(e,t){const a=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Bi(s);let o;return d;function d(h){return o=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===o)return e.consume(h),f;const m=e.exit("attentionSequence"),x=Bi(h),b=!x||x===2&&l||a.includes(h),y=!l||l===2&&x||a.includes(s);return m._open=!!(o===42?b:b&&(l||!y)),m._close=!!(o===42?y:y&&(x||!b)),t(h)}}function Sx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pw={name:"autolink",tokenize:gw};function gw(e,t,a){let s=0;return l;function l(T){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(T){return In(T)?(e.consume(T),d):T===64?a(T):m(T)}function d(T){return T===43||T===45||T===46||Sn(T)?(s=1,f(T)):m(T)}function f(T){return T===58?(e.consume(T),s=0,h):(T===43||T===45||T===46||Sn(T))&&s++<32?(e.consume(T),f):(s=0,m(T))}function h(T){return T===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.exit("autolink"),t):T===null||T===32||T===60||xc(T)?a(T):(e.consume(T),h)}function m(T){return T===64?(e.consume(T),x):sw(T)?(e.consume(T),m):a(T)}function x(T){return Sn(T)?b(T):a(T)}function b(T){return T===46?(e.consume(T),s=0,x):T===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.exit("autolink"),t):y(T)}function y(T){if((T===45||Sn(T))&&s++<63){const N=T===45?y:b;return e.consume(T),N}return a(T)}}const No={partial:!0,tokenize:bw};function bw(e,t,a){return s;function s(o){return rt(o)?ct(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||He(o)?t(o):a(o)}}const dy={continuation:{tokenize:Ew},exit:yw,name:"blockQuote",tokenize:xw};function xw(e,t,a){const s=this;return l;function l(d){if(d===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),o}return a(d)}function o(d){return rt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(d))}}function Ew(e,t,a){const s=this;return l;function l(d){return rt(d)?ct(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):o(d)}function o(d){return e.attempt(dy,t,a)(d)}}function yw(e){e.exit("blockQuote")}const fy={name:"characterEscape",tokenize:Tw};function Tw(e,t,a){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return lw(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(o)}}const my={name:"characterReference",tokenize:_w};function _w(e,t,a){const s=this;let l=0,o,d;return f;function f(b){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),h}function h(b){return b===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(b),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),o=31,d=Sn,x(b))}function m(b){return b===88||b===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(b),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,d=iw,x):(e.enter("characterReferenceValue"),o=7,d=Ym,x(b))}function x(b){if(b===59&&l){const y=e.exit("characterReferenceValue");return d===Sn&&!Rh(s.sliceSerialize(y))?a(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return d(b)&&l++<o?(e.consume(b),x):a(b)}}const vx={partial:!0,tokenize:Sw},Ax={concrete:!0,name:"codeFenced",tokenize:Nw};function Nw(e,t,a){const s=this,l={partial:!0,tokenize:$};let o=0,d=0,f;return h;function h(L){return m(L)}function m(L){const Y=s.events[s.events.length-1];return o=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(L)}function x(L){return L===f?(d++,e.consume(L),x):d<3?a(L):(e.exit("codeFencedFenceSequence"),rt(L)?ct(e,b,"whitespace")(L):b(L))}function b(L){return L===null||He(L)?(e.exit("codeFencedFence"),s.interrupt?t(L):e.check(vx,S,D)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(L))}function y(L){return L===null||He(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),b(L)):rt(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ct(e,T,"whitespace")(L)):L===96&&L===f?a(L):(e.consume(L),y)}function T(L){return L===null||He(L)?b(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),N(L))}function N(L){return L===null||He(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),b(L)):L===96&&L===f?a(L):(e.consume(L),N)}function S(L){return e.attempt(l,D,C)(L)}function C(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v}function v(L){return o>0&&rt(L)?ct(e,M,"linePrefix",o+1)(L):M(L)}function M(L){return L===null||He(L)?e.check(vx,S,D)(L):(e.enter("codeFlowValue"),k(L))}function k(L){return L===null||He(L)?(e.exit("codeFlowValue"),M(L)):(e.consume(L),k)}function D(L){return e.exit("codeFenced"),t(L)}function $(L,Y,re){let fe=0;return U;function U(J){return L.enter("lineEnding"),L.consume(J),L.exit("lineEnding"),H}function H(J){return L.enter("codeFencedFence"),rt(J)?ct(L,ae,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):ae(J)}function ae(J){return J===f?(L.enter("codeFencedFenceSequence"),se(J)):re(J)}function se(J){return J===f?(fe++,L.consume(J),se):fe>=d?(L.exit("codeFencedFenceSequence"),rt(J)?ct(L,Z,"whitespace")(J):Z(J)):re(J)}function Z(J){return J===null||He(J)?(L.exit("codeFencedFence"),Y(J)):re(J)}}}function Sw(e,t,a){const s=this;return l;function l(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o)}function o(d){return s.parser.lazy[s.now().line]?a(d):t(d)}}const dm={name:"codeIndented",tokenize:Aw},vw={partial:!0,tokenize:Cw};function Aw(e,t,a){const s=this;return l;function l(m){return e.enter("codeIndented"),ct(e,o,"linePrefix",5)(m)}function o(m){const x=s.events[s.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?d(m):a(m)}function d(m){return m===null?h(m):He(m)?e.attempt(vw,d,h)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||He(m)?(e.exit("codeFlowValue"),d(m)):(e.consume(m),f)}function h(m){return e.exit("codeIndented"),t(m)}}function Cw(e,t,a){const s=this;return l;function l(d){return s.parser.lazy[s.now().line]?a(d):He(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):ct(e,o,"linePrefix",5)(d)}function o(d){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(d):He(d)?l(d):a(d)}}const ww={name:"codeText",previous:Rw,resolve:kw,tokenize:Ow};function kw(e){let t=e.length-4,a=3,s,l;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=a;++s<t;)if(e[s][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(s=a-1,t++;++s<=t;)l===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(l=s):(s===t||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),t-=s-l-2,s=l+2),l=void 0);return e}function Rw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ow(e,t,a){let s=0,l,o;return d;function d(b){return e.enter("codeText"),e.enter("codeTextSequence"),f(b)}function f(b){return b===96?(e.consume(b),s++,f):(e.exit("codeTextSequence"),h(b))}function h(b){return b===null?a(b):b===32?(e.enter("space"),e.consume(b),e.exit("space"),h):b===96?(o=e.enter("codeTextSequence"),l=0,x(b)):He(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(b))}function m(b){return b===null||b===32||b===96||He(b)?(e.exit("codeTextData"),h(b)):(e.consume(b),m)}function x(b){return b===96?(e.consume(b),l++,x):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(b)):(o.type="codeTextData",m(b))}}class Iw{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,a){const s=a??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,a,s){const l=a||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Kl(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Kl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Kl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const a=this.left.splice(t,Number.POSITIVE_INFINITY);Kl(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Kl(this.left,a.reverse())}}}function Kl(e,t){let a=0;if(t.length<1e4)e.push(...t);else for(;a<t.length;)e.push(...t.slice(a,a+1e4)),a+=1e4}function hy(e){const t={};let a=-1,s,l,o,d,f,h,m;const x=new Iw(e);for(;++a<x.length;){for(;a in t;)a=t[a];if(s=x.get(a),a&&s[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(h=s[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,Mw(x,a)),a=t[a],m=!0);else if(s[1]._container){for(o=a,l=void 0;o--;)if(d=x.get(o),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(l&&(x.get(l)[1].type="lineEndingBlank"),d[1].type="lineEnding",l=o);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;l&&(s[1].end={...x.get(l)[1].start},f=x.slice(l,a),f.unshift(s),x.splice(l,a-l+1,f))}}return sa(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!m}function Mw(e,t){const a=e.get(t)[1],s=e.get(t)[2];let l=t-1;const o=[];let d=a._tokenizer;d||(d=s.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,h=[],m={};let x,b,y=-1,T=a,N=0,S=0;const C=[S];for(;T;){for(;e.get(++l)[1]!==T;);o.push(l),T._tokenizer||(x=s.sliceStream(T),T.next||x.push(null),b&&d.defineSkip(T.start),T._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),T._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),b=T,T=T.next}for(T=a;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(S=y+1,C.push(S),T._tokenizer=void 0,T.previous=void 0,T=T.next);for(d.events=[],T?(T._tokenizer=void 0,T.previous=void 0):C.pop(),y=C.length;y--;){const v=f.slice(C[y],C[y+1]),M=o.pop();h.push([M,M+v.length-1]),e.splice(M,2,v)}for(h.reverse(),y=-1;++y<h.length;)m[N+h[y][0]]=N+h[y][1],N+=h[y][1]-h[y][0]-1;return m}const Dw={resolve:jw,tokenize:Bw},Lw={partial:!0,tokenize:Pw};function jw(e){return hy(e),e}function Bw(e,t){let a;return s;function s(f){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?o(f):He(f)?e.check(Lw,d,o)(f):(e.consume(f),l)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function d(f){return e.consume(f),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,l}}function Pw(e,t,a){const s=this;return l;function l(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),ct(e,o,"linePrefix")}function o(d){if(d===null||He(d))return a(d);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(d):e.interrupt(s.parser.constructs.flow,a,t)(d)}}function py(e,t,a,s,l,o,d,f,h){const m=h||Number.POSITIVE_INFINITY;let x=0;return b;function b(v){return v===60?(e.enter(s),e.enter(l),e.enter(o),e.consume(v),e.exit(o),y):v===null||v===32||v===41||xc(v)?a(v):(e.enter(s),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),S(v))}function y(v){return v===62?(e.enter(o),e.consume(v),e.exit(o),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),T(v))}function T(v){return v===62?(e.exit("chunkString"),e.exit(f),y(v)):v===null||v===60||He(v)?a(v):(e.consume(v),v===92?N:T)}function N(v){return v===60||v===62||v===92?(e.consume(v),T):T(v)}function S(v){return!x&&(v===null||v===41||Rt(v))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(s),t(v)):x<m&&v===40?(e.consume(v),x++,S):v===41?(e.consume(v),x--,S):v===null||v===32||v===40||xc(v)?a(v):(e.consume(v),v===92?C:S)}function C(v){return v===40||v===41||v===92?(e.consume(v),S):S(v)}}function gy(e,t,a,s,l,o){const d=this;let f=0,h;return m;function m(T){return e.enter(s),e.enter(l),e.consume(T),e.exit(l),e.enter(o),x}function x(T){return f>999||T===null||T===91||T===93&&!h||T===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?a(T):T===93?(e.exit(o),e.enter(l),e.consume(T),e.exit(l),e.exit(s),t):He(T)?(e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||T===91||T===93||He(T)||f++>999?(e.exit("chunkString"),x(T)):(e.consume(T),h||(h=!rt(T)),T===92?y:b)}function y(T){return T===91||T===92||T===93?(e.consume(T),f++,b):b(T)}}function by(e,t,a,s,l,o){let d;return f;function f(y){return y===34||y===39||y===40?(e.enter(s),e.enter(l),e.consume(y),e.exit(l),d=y===40?41:y,h):a(y)}function h(y){return y===d?(e.enter(l),e.consume(y),e.exit(l),e.exit(s),t):(e.enter(o),m(y))}function m(y){return y===d?(e.exit(o),h(d)):y===null?a(y):He(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ct(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===d||y===null||He(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?b:x)}function b(y){return y===d||y===92?(e.consume(y),x):x(y)}}function to(e,t){let a;return s;function s(l){return He(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a=!0,s):rt(l)?ct(e,s,a?"linePrefix":"lineSuffix")(l):t(l)}}const Uw={name:"definition",tokenize:Fw},Hw={partial:!0,tokenize:zw};function Fw(e,t,a){const s=this;let l;return o;function o(T){return e.enter("definition"),d(T)}function d(T){return gy.call(s,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(T)}function f(T){return l=Oa(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),T===58?(e.enter("definitionMarker"),e.consume(T),e.exit("definitionMarker"),h):a(T)}function h(T){return Rt(T)?to(e,m)(T):m(T)}function m(T){return py(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(T)}function x(T){return e.attempt(Hw,b,b)(T)}function b(T){return rt(T)?ct(e,y,"whitespace")(T):y(T)}function y(T){return T===null||He(T)?(e.exit("definition"),s.parser.defined.push(l),t(T)):a(T)}}function zw(e,t,a){return s;function s(f){return Rt(f)?to(e,l)(f):a(f)}function l(f){return by(e,o,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return rt(f)?ct(e,d,"whitespace")(f):d(f)}function d(f){return f===null||He(f)?t(f):a(f)}}const qw={name:"hardBreakEscape",tokenize:Yw};function Yw(e,t,a){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):a(o)}}const $w={name:"headingAtx",resolve:Gw,tokenize:Kw};function Gw(e,t){let a=e.length-2,s=3,l,o;return e[s][1].type==="whitespace"&&(s+=2),a-2>s&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(s===a-1||a-4>s&&e[a-2][1].type==="whitespace")&&(a-=s+1===a?2:4),a>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[a][1].end},o={type:"chunkText",start:e[s][1].start,end:e[a][1].end,contentType:"text"},sa(e,s,a-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function Kw(e,t,a){let s=0;return l;function l(x){return e.enter("atxHeading"),o(x)}function o(x){return e.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&s++<6?(e.consume(x),d):x===null||Rt(x)?(e.exit("atxHeadingSequence"),f(x)):a(x)}function f(x){return x===35?(e.enter("atxHeadingSequence"),h(x)):x===null||He(x)?(e.exit("atxHeading"),t(x)):rt(x)?ct(e,f,"whitespace")(x):(e.enter("atxHeadingText"),m(x))}function h(x){return x===35?(e.consume(x),h):(e.exit("atxHeadingSequence"),f(x))}function m(x){return x===null||x===35||Rt(x)?(e.exit("atxHeadingText"),f(x)):(e.consume(x),m)}}const Vw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Cx=["pre","script","style","textarea"],Qw={concrete:!0,name:"htmlFlow",resolveTo:Ww,tokenize:Jw},Xw={partial:!0,tokenize:tk},Zw={partial:!0,tokenize:ek};function Ww(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Jw(e,t,a){const s=this;let l,o,d,f,h;return m;function m(O){return x(O)}function x(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),b}function b(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),o=!0,S):O===63?(e.consume(O),l=3,s.interrupt?t:B):In(O)?(e.consume(O),d=String.fromCharCode(O),C):a(O)}function y(O){return O===45?(e.consume(O),l=2,T):O===91?(e.consume(O),l=5,f=0,N):In(O)?(e.consume(O),l=4,s.interrupt?t:B):a(O)}function T(O){return O===45?(e.consume(O),s.interrupt?t:B):a(O)}function N(O){const ge="CDATA[";return O===ge.charCodeAt(f++)?(e.consume(O),f===ge.length?s.interrupt?t:ae:N):a(O)}function S(O){return In(O)?(e.consume(O),d=String.fromCharCode(O),C):a(O)}function C(O){if(O===null||O===47||O===62||Rt(O)){const ge=O===47,ve=d.toLowerCase();return!ge&&!o&&Cx.includes(ve)?(l=1,s.interrupt?t(O):ae(O)):Vw.includes(d.toLowerCase())?(l=6,ge?(e.consume(O),v):s.interrupt?t(O):ae(O)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?a(O):o?M(O):k(O))}return O===45||Sn(O)?(e.consume(O),d+=String.fromCharCode(O),C):a(O)}function v(O){return O===62?(e.consume(O),s.interrupt?t:ae):a(O)}function M(O){return rt(O)?(e.consume(O),M):U(O)}function k(O){return O===47?(e.consume(O),U):O===58||O===95||In(O)?(e.consume(O),D):rt(O)?(e.consume(O),k):U(O)}function D(O){return O===45||O===46||O===58||O===95||Sn(O)?(e.consume(O),D):$(O)}function $(O){return O===61?(e.consume(O),L):rt(O)?(e.consume(O),$):k(O)}function L(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(e.consume(O),h=O,Y):rt(O)?(e.consume(O),L):re(O)}function Y(O){return O===h?(e.consume(O),h=null,fe):O===null||He(O)?a(O):(e.consume(O),Y)}function re(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Rt(O)?$(O):(e.consume(O),re)}function fe(O){return O===47||O===62||rt(O)?k(O):a(O)}function U(O){return O===62?(e.consume(O),H):a(O)}function H(O){return O===null||He(O)?ae(O):rt(O)?(e.consume(O),H):a(O)}function ae(O){return O===45&&l===2?(e.consume(O),V):O===60&&l===1?(e.consume(O),G):O===62&&l===4?(e.consume(O),R):O===63&&l===3?(e.consume(O),B):O===93&&l===5?(e.consume(O),ke):He(O)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(Xw,X,se)(O)):O===null||He(O)?(e.exit("htmlFlowData"),se(O)):(e.consume(O),ae)}function se(O){return e.check(Zw,Z,X)(O)}function Z(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),J}function J(O){return O===null||He(O)?se(O):(e.enter("htmlFlowData"),ae(O))}function V(O){return O===45?(e.consume(O),B):ae(O)}function G(O){return O===47?(e.consume(O),d="",pe):ae(O)}function pe(O){if(O===62){const ge=d.toLowerCase();return Cx.includes(ge)?(e.consume(O),R):ae(O)}return In(O)&&d.length<8?(e.consume(O),d+=String.fromCharCode(O),pe):ae(O)}function ke(O){return O===93?(e.consume(O),B):ae(O)}function B(O){return O===62?(e.consume(O),R):O===45&&l===2?(e.consume(O),B):ae(O)}function R(O){return O===null||He(O)?(e.exit("htmlFlowData"),X(O)):(e.consume(O),R)}function X(O){return e.exit("htmlFlow"),t(O)}}function ek(e,t,a){const s=this;return l;function l(d){return He(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):a(d)}function o(d){return s.parser.lazy[s.now().line]?a(d):t(d)}}function tk(e,t,a){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(No,t,a)}}const nk={name:"htmlText",tokenize:ak};function ak(e,t,a){const s=this;let l,o,d;return f;function f(B){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),$):B===63?(e.consume(B),k):In(B)?(e.consume(B),re):a(B)}function m(B){return B===45?(e.consume(B),x):B===91?(e.consume(B),o=0,N):In(B)?(e.consume(B),M):a(B)}function x(B){return B===45?(e.consume(B),T):a(B)}function b(B){return B===null?a(B):B===45?(e.consume(B),y):He(B)?(d=b,G(B)):(e.consume(B),b)}function y(B){return B===45?(e.consume(B),T):b(B)}function T(B){return B===62?V(B):B===45?y(B):b(B)}function N(B){const R="CDATA[";return B===R.charCodeAt(o++)?(e.consume(B),o===R.length?S:N):a(B)}function S(B){return B===null?a(B):B===93?(e.consume(B),C):He(B)?(d=S,G(B)):(e.consume(B),S)}function C(B){return B===93?(e.consume(B),v):S(B)}function v(B){return B===62?V(B):B===93?(e.consume(B),v):S(B)}function M(B){return B===null||B===62?V(B):He(B)?(d=M,G(B)):(e.consume(B),M)}function k(B){return B===null?a(B):B===63?(e.consume(B),D):He(B)?(d=k,G(B)):(e.consume(B),k)}function D(B){return B===62?V(B):k(B)}function $(B){return In(B)?(e.consume(B),L):a(B)}function L(B){return B===45||Sn(B)?(e.consume(B),L):Y(B)}function Y(B){return He(B)?(d=Y,G(B)):rt(B)?(e.consume(B),Y):V(B)}function re(B){return B===45||Sn(B)?(e.consume(B),re):B===47||B===62||Rt(B)?fe(B):a(B)}function fe(B){return B===47?(e.consume(B),V):B===58||B===95||In(B)?(e.consume(B),U):He(B)?(d=fe,G(B)):rt(B)?(e.consume(B),fe):V(B)}function U(B){return B===45||B===46||B===58||B===95||Sn(B)?(e.consume(B),U):H(B)}function H(B){return B===61?(e.consume(B),ae):He(B)?(d=H,G(B)):rt(B)?(e.consume(B),H):fe(B)}function ae(B){return B===null||B===60||B===61||B===62||B===96?a(B):B===34||B===39?(e.consume(B),l=B,se):He(B)?(d=ae,G(B)):rt(B)?(e.consume(B),ae):(e.consume(B),Z)}function se(B){return B===l?(e.consume(B),l=void 0,J):B===null?a(B):He(B)?(d=se,G(B)):(e.consume(B),se)}function Z(B){return B===null||B===34||B===39||B===60||B===61||B===96?a(B):B===47||B===62||Rt(B)?fe(B):(e.consume(B),Z)}function J(B){return B===47||B===62||Rt(B)?fe(B):a(B)}function V(B){return B===62?(e.consume(B),e.exit("htmlTextData"),e.exit("htmlText"),t):a(B)}function G(B){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),pe}function pe(B){return rt(B)?ct(e,ke,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):ke(B)}function ke(B){return e.enter("htmlTextData"),d(B)}}const Oh={name:"labelEnd",resolveAll:lk,resolveTo:ok,tokenize:uk},rk={tokenize:ck},sk={tokenize:dk},ik={tokenize:fk};function lk(e){let t=-1;const a=[];for(;++t<e.length;){const s=e[t][1];if(a.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",t+=l}}return e.length!==a.length&&sa(e,0,e.length,a),e}function ok(e,t){let a=e.length,s=0,l,o,d,f;for(;a--;)if(l=e[a][1],o){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[a][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(d){if(e[a][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(o=a,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(d=a);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[o][1].start},end:{...e[d][1].end}},x={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",h,t],["enter",m,t]],f=ya(f,e.slice(o+1,o+s+3)),f=ya(f,[["enter",x,t]]),f=ya(f,Hc(t.parser.constructs.insideSpan.null,e.slice(o+s+4,d-3),t)),f=ya(f,[["exit",x,t],e[d-2],e[d-1],["exit",m,t]]),f=ya(f,e.slice(d+1)),f=ya(f,[["exit",h,t]]),sa(e,o,e.length,f),e}function uk(e,t,a){const s=this;let l=s.events.length,o,d;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){o=s.events[l][1];break}return f;function f(y){return o?o._inactive?b(y):(d=s.parser.defined.includes(Oa(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):a(y)}function h(y){return y===40?e.attempt(rk,x,d?x:b)(y):y===91?e.attempt(sk,x,d?m:b)(y):d?x(y):b(y)}function m(y){return e.attempt(ik,x,b)(y)}function x(y){return t(y)}function b(y){return o._balanced=!0,a(y)}}function ck(e,t,a){return s;function s(b){return e.enter("resource"),e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),l}function l(b){return Rt(b)?to(e,o)(b):o(b)}function o(b){return b===41?x(b):py(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return Rt(b)?to(e,h)(b):x(b)}function f(b){return a(b)}function h(b){return b===34||b===39||b===40?by(e,m,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):x(b)}function m(b){return Rt(b)?to(e,x)(b):x(b)}function x(b){return b===41?(e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),e.exit("resource"),t):a(b)}}function dk(e,t,a){const s=this;return l;function l(f){return gy.call(s,e,o,d,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Oa(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):a(f)}function d(f){return a(f)}}function fk(e,t,a){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):a(o)}}const mk={name:"labelStartImage",resolveAll:Oh.resolveAll,tokenize:hk};function hk(e,t,a){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):a(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?a(f):t(f)}}const pk={name:"labelStartLink",resolveAll:Oh.resolveAll,tokenize:gk};function gk(e,t,a){const s=this;return l;function l(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),o}function o(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?a(d):t(d)}}const fm={name:"lineEnding",tokenize:bk};function bk(e,t){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ct(e,t,"linePrefix")}}const ic={name:"thematicBreak",tokenize:xk};function xk(e,t,a){let s=0,l;return o;function o(m){return e.enter("thematicBreak"),d(m)}function d(m){return l=m,f(m)}function f(m){return m===l?(e.enter("thematicBreakSequence"),h(m)):s>=3&&(m===null||He(m))?(e.exit("thematicBreak"),t(m)):a(m)}function h(m){return m===l?(e.consume(m),s++,h):(e.exit("thematicBreakSequence"),rt(m)?ct(e,f,"whitespace")(m):f(m))}}const $n={continuation:{tokenize:_k},exit:Sk,name:"list",tokenize:Tk},Ek={partial:!0,tokenize:vk},yk={partial:!0,tokenize:Nk};function Tk(e,t,a){const s=this,l=s.events[s.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,d=0;return f;function f(T){const N=s.containerState.type||(T===42||T===43||T===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!s.containerState.marker||T===s.containerState.marker:Ym(T)){if(s.containerState.type||(s.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),T===42||T===45?e.check(ic,a,m)(T):m(T);if(!s.interrupt||T===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(T)}return a(T)}function h(T){return Ym(T)&&++d<10?(e.consume(T),h):(!s.interrupt||d<2)&&(s.containerState.marker?T===s.containerState.marker:T===41||T===46)?(e.exit("listItemValue"),m(T)):a(T)}function m(T){return e.enter("listItemMarker"),e.consume(T),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||T,e.check(No,s.interrupt?a:x,e.attempt(Ek,y,b))}function x(T){return s.containerState.initialBlankLine=!0,o++,y(T)}function b(T){return rt(T)?(e.enter("listItemPrefixWhitespace"),e.consume(T),e.exit("listItemPrefixWhitespace"),y):a(T)}function y(T){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(T)}}function _k(e,t,a){const s=this;return s.containerState._closeFlow=void 0,e.check(No,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ct(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!rt(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,d(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(yk,t,d)(f))}function d(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ct(e,e.attempt($n,t,a),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Nk(e,t,a){const s=this;return ct(e,l,"listItemIndent",s.containerState.size+1);function l(o){const d=s.events[s.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===s.containerState.size?t(o):a(o)}}function Sk(e){e.exit(this.containerState.type)}function vk(e,t,a){const s=this;return ct(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const d=s.events[s.events.length-1];return!rt(o)&&d&&d[1].type==="listItemPrefixWhitespace"?t(o):a(o)}}const wx={name:"setextUnderline",resolveTo:Ak,tokenize:Ck};function Ak(e,t){let a=e.length,s,l,o;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){s=a;break}e[a][1].type==="paragraph"&&(l=a)}else e[a][1].type==="content"&&e.splice(a,1),!o&&e[a][1].type==="definition"&&(o=a);const d={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",d,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=d,e.push(["exit",d,t]),e}function Ck(e,t,a){const s=this;let l;return o;function o(m){let x=s.events.length,b;for(;x--;)if(s.events[x][1].type!=="lineEnding"&&s.events[x][1].type!=="linePrefix"&&s.events[x][1].type!=="content"){b=s.events[x][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||b)?(e.enter("setextHeadingLine"),l=m,d(m)):a(m)}function d(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===l?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),rt(m)?ct(e,h,"lineSuffix")(m):h(m))}function h(m){return m===null||He(m)?(e.exit("setextHeadingLine"),t(m)):a(m)}}const wk={tokenize:kk};function kk(e){const t=this,a=e.attempt(No,s,e.attempt(this.parser.constructs.flowInitial,l,ct(e,e.attempt(this.parser.constructs.flow,l,e.attempt(Dw,l)),"linePrefix")));return a;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const Rk={resolveAll:Ey()},Ok=xy("string"),Ik=xy("text");function xy(e){return{resolveAll:Ey(e==="text"?Mk:void 0),tokenize:t};function t(a){const s=this,l=this.parser.constructs[e],o=a.attempt(l,d,f);return d;function d(x){return m(x)?o(x):f(x)}function f(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),h}function h(x){return m(x)?(a.exit("data"),o(x)):(a.consume(x),h)}function m(x){if(x===null)return!0;const b=l[x];let y=-1;if(b)for(;++y<b.length;){const T=b[y];if(!T.previous||T.previous.call(s,s.previous))return!0}return!1}}}function Ey(e){return t;function t(a,s){let l=-1,o;for(;++l<=a.length;)o===void 0?a[l]&&a[l][1].type==="data"&&(o=l,l++):(!a[l]||a[l][1].type!=="data")&&(l!==o+2&&(a[o][1].end=a[l-1][1].end,a.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(a,s):a}}function Mk(e,t){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){const s=e[a-1][1],l=t.sliceStream(s);let o=l.length,d=-1,f=0,h;for(;o--;){const m=l[o];if(typeof m=="string"){for(d=m.length;m.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(m===-2)h=!0,f++;else if(m!==-1){o++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(f=0),f){const m={type:a===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?d:s.start._bufferIndex+d,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(a,0,["enter",m,t],["exit",m,t]),a+=2)}a++}return e}const Dk={42:$n,43:$n,45:$n,48:$n,49:$n,50:$n,51:$n,52:$n,53:$n,54:$n,55:$n,56:$n,57:$n,62:dy},Lk={91:Uw},jk={[-2]:dm,[-1]:dm,32:dm},Bk={35:$w,42:ic,45:[wx,ic],60:Qw,61:wx,95:ic,96:Ax,126:Ax},Pk={38:my,92:fy},Uk={[-5]:fm,[-4]:fm,[-3]:fm,33:mk,38:my,42:$m,60:[pw,nk],91:pk,92:[qw,fy],93:Oh,95:$m,96:ww},Hk={null:[$m,Rk]},Fk={null:[42,95]},zk={null:[]},qk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fk,contentInitial:Lk,disable:zk,document:Dk,flow:Bk,flowInitial:jk,insideSpan:Hk,string:Pk,text:Uk},Symbol.toStringTag,{value:"Module"}));function Yk(e,t,a){let s={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const l={},o=[];let d=[],f=[];const h={attempt:Y($),check:Y(L),consume:M,enter:k,exit:D,interrupt:Y(L,{interrupt:!0})},m={code:null,containerState:{},defineSkip:S,events:[],now:N,parser:e,previous:null,sliceSerialize:y,sliceStream:T,write:b};let x=t.tokenize.call(m,h);return t.resolveAll&&o.push(t),m;function b(H){return d=ya(d,H),C(),d[d.length-1]!==null?[]:(re(t,0),m.events=Hc(o,m.events,m),m.events)}function y(H,ae){return Gk(T(H),ae)}function T(H){return $k(d,H)}function N(){const{_bufferIndex:H,_index:ae,line:se,column:Z,offset:J}=s;return{_bufferIndex:H,_index:ae,line:se,column:Z,offset:J}}function S(H){l[H.line]=H.column,U()}function C(){let H;for(;s._index<d.length;){const ae=d[s._index];if(typeof ae=="string")for(H=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===H&&s._bufferIndex<ae.length;)v(ae.charCodeAt(s._bufferIndex));else v(ae)}}function v(H){x=x(H)}function M(H){He(H)?(s.line++,s.column=1,s.offset+=H===-3?2:1,U()):H!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===d[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=H}function k(H,ae){const se=ae||{};return se.type=H,se.start=N(),m.events.push(["enter",se,m]),f.push(se),se}function D(H){const ae=f.pop();return ae.end=N(),m.events.push(["exit",ae,m]),ae}function $(H,ae){re(H,ae.from)}function L(H,ae){ae.restore()}function Y(H,ae){return se;function se(Z,J,V){let G,pe,ke,B;return Array.isArray(Z)?X(Z):"tokenize"in Z?X([Z]):R(Z);function R(Ae){return $e;function $e(dt){const ut=dt!==null&&Ae[dt],Ft=dt!==null&&Ae.null,yn=[...Array.isArray(ut)?ut:ut?[ut]:[],...Array.isArray(Ft)?Ft:Ft?[Ft]:[]];return X(yn)(dt)}}function X(Ae){return G=Ae,pe=0,Ae.length===0?V:O(Ae[pe])}function O(Ae){return $e;function $e(dt){return B=fe(),ke=Ae,Ae.partial||(m.currentConstruct=Ae),Ae.name&&m.parser.constructs.disable.null.includes(Ae.name)?ve():Ae.tokenize.call(ae?Object.assign(Object.create(m),ae):m,h,ge,ve)(dt)}}function ge(Ae){return H(ke,B),J}function ve(Ae){return B.restore(),++pe<G.length?O(G[pe]):V}}}function re(H,ae){H.resolveAll&&!o.includes(H)&&o.push(H),H.resolve&&sa(m.events,ae,m.events.length-ae,H.resolve(m.events.slice(ae),m)),H.resolveTo&&(m.events=H.resolveTo(m.events,m))}function fe(){const H=N(),ae=m.previous,se=m.currentConstruct,Z=m.events.length,J=Array.from(f);return{from:Z,restore:V};function V(){s=H,m.previous=ae,m.currentConstruct=se,m.events.length=Z,f=J,U()}}function U(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function $k(e,t){const a=t.start._index,s=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let d;if(a===l)d=[e[a].slice(s,o)];else{if(d=e.slice(a,l),s>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(s):d.shift()}o>0&&d.push(e[l].slice(0,o))}return d}function Gk(e,t){let a=-1;const s=[];let l;for(;++a<e.length;){const o=e[a];let d;if(typeof o=="string")d=o;else switch(o){case-5:{d="\r";break}case-4:{d=`
package/public/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
6
6
  <title>Fourth Spark</title>
7
- <script type="module" crossorigin src="/assets/index-CAQlAJ6l.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-5BnXM5yA.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Db25v8QM.css">
9
9
  </head>
10
10
  <body>