fourth-spark 0.10.16 → 0.10.17
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/drizzle/meta/0007_snapshot.json +1 -1
- package/drizzle/meta/_journal.json +2 -2
- package/package.json +1 -1
- package/public/assets/{index-B-UQQb3P.js → index-JfzQSLb0.js} +2 -2
- package/public/assets/{web-bk_3jx2V.js → web-BUhORaxp.js} +1 -1
- package/public/index.html +1 -1
- /package/drizzle/{0007_harsh_talisman.sql → 0007_careless_sir_ram.sql} +0 -0
package/package.json
CHANGED
|
@@ -457,7 +457,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
|
|
|
457
457
|
*
|
|
458
458
|
* This source code is licensed under the ISC license.
|
|
459
459
|
* See the LICENSE file in the root directory of this source tree.
|
|
460
|
-
*/const v5=[["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"}]],Wc=Re("zap",v5);function ky(e){var t,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=ky(e[t]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function ae(){for(var e,t,a=0,r="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=ky(e))&&(r&&(r+=" "),r+=t);return r}const Nx=e=>{let t;const a=new Set,r=(h,b)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const y=t;t=b??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(N=>N(t,y))}},o=()=>t,f={setState:r,getState:o,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=t=e(r,o,f);return f},S5=(e=>e?Nx(e):Nx),A5=e=>e;function C5(e,t=A5){const a=ac.useSyncExternalStore(e.subscribe,ac.useCallback(()=>t(e.getState()),[e,t]),ac.useCallback(()=>t(e.getInitialState()),[e,t]));return ac.useDebugValue(a),a}const Tx=e=>{const t=S5(e),a=r=>C5(t,r);return Object.assign(a,t),a},es=(e=>e?Tx(e):Tx),_m="fs-theme";function Ry(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function _x(e){return e==="system"?Ry():e}function vx(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const rh=es((e,t)=>({preference:localStorage.getItem(_m)??"system",resolved:_x(localStorage.getItem(_m)??"system"),cycle(){const a=["system","light","dark"],r=a[(a.indexOf(t().preference)+1)%a.length],o=_x(r);localStorage.setItem(_m,r),vx(r),e({preference:r,resolved:o})},init(){vx(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{const{preference:o}=t();if(o==="system"){const u=Ry();e({resolved:u})}};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)}})),Ac="fourth-spark-server-url";function Oy(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function Iy(){return localStorage.getItem(Ac)??""}function w5(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(Ac,t):localStorage.removeItem(Ac)}function ih(){return localStorage.getItem(Ac)??""}class Ss extends Error{constructor(a,r){super(a);ln(this,"status");this.name="ApiError",this.status=r}}async function Se(e,t){let a;try{a=await fetch(Iy()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(o){throw new Ss(o instanceof Error?o.message:"Network request failed",0)}if(!a.ok){const o=await a.text().catch(()=>"");throw new Ss(o.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const r=await a.text();if(r)return JSON.parse(r)}function sa(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const r of[...t,"data","items"])if(Array.isArray(a[r]))return a[r]}return[]}async function k5(){return sa(await Se("/api/repos"),"repos")}async function R5(e,t,a,r){return Se("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:r})})}async function O5(e){return Se("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function I5(e){await Se(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function M5(e){await Se(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function D5(e){await Se(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function L5(e){return Se(`/api/repos/${encodeURIComponent(e)}/branches`)}async function j5(e,t){return Se(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function B5(e){return Se(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ge(e){return`/api/repos/${encodeURIComponent(e)}`}async function P5(e){return sa(await Se(`${Ge(e)}/workspaces`),"workspaces")}async function U5(e,t){await Se(`${Ge(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function H5(e){return Se(`${Ge(e)}/workspaces/cleanup`,{method:"POST"})}async function F5(e,t){await Se(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function z5(e,t){await Se(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function $5(e){return sa(await Se(`${Ge(e)}/sessions`),"sessions")}async function q5(e,t,a,r,o,u,c,f){return Se(`${Ge(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:r,variant:o,issueId:u,customAgentId:c,files:f})})}async function Y5(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function G5(e,t,a,r,o,u,c){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:r,model:o,variant:u,files:c})})}async function K5(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function V5(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function X5(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}async function Q5(e,t,a){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({messageID:a})})}function Sx(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const r=Array.isArray(t.parts)?t.parts:void 0;return{...a,...r?{parts:r}:{}}}return t}async function Ax(e,t,a){const r=new URLSearchParams;a!=null&&a.limit&&r.set("limit",String(a.limit)),a!=null&&a.before&&r.set("before",a.before);const o=r.toString(),u=`${Ge(e)}/sessions/${encodeURIComponent(t)}/messages${o?`?${o}`:""}`,c=await Se(u);if(Array.isArray(c)){const h=c.map(Sx);return{messages:h,total:h.length,hasMore:!1}}const f=c,m=Array.isArray(f.messages)?f.messages:[];return{messages:m.map(Sx),total:f.total??m.length,hasMore:f.hasMore??!1}}async function W5(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/status`)}async function Z5(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`)}async function J5(e,t){return Se(`${Ge(e)}/sessions/snapshot/${encodeURIComponent(t)}`)}async function My(e){return Se(`${Ge(e)}/sessions/all-links`)}async function eC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:r})})}async function tC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:r})})}async function Dy(){return sa(await Se("/api/custom-agents"))}async function nC(e){return Se("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function aC(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Ly(e){await Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Cx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function sC(e){return Se("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function jy(e,t){const a=new URLSearchParams;t!=null&&t.category&&a.set("category",t.category),t!=null&&t.includeSuperseded&&a.set("includeSuperseded","true");const r=a.toString();return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories${r?`?${r}`:""}`)}async function rC(e,t,a){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(a)})}async function iC(e,t){await Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"DELETE"})}async function lC(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/extract`,{method:"POST",body:JSON.stringify({sessionIds:t})})}async function wx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/stats`)}async function oC(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/consolidate`,{method:"POST"})}async function Qh(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/sessions`)}async function By(e){return sa(await Se(`${Ge(e)}/custom-agents`))}async function uC(e,t){return Se(`${Ge(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Ro(e){return sa(await Se(`${Ge(e)}/models`))}async function Py(){return sa(await Se("/api/prompt-fragments"))}async function cC(e){return Se("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function dC(e,t){return Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function fC(e){await Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function kx(e){return sa(await Se(`${Ge(e)}/tags`))}async function Rx(e,t){return sa(await Se(`${Ge(e)}/milestones`))}async function Ox(e,t="open"){return sa(await Se(`${Ge(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function mC(e,t="all"){return Se(`${Ge(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function hC(e,t,a){return Se(`${Ge(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function pC(e,t,a){await Se(`${Ge(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function Uy(e,t,a){return Se(`${Ge(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function gC(e,t){return sa(await Se(`${Ge(e)}/issues/${t}/pulls`))}async function Ix(e,t="open"){return sa(await Se(`${Ge(e)}/pulls?state=${encodeURIComponent(t)}`))}async function bC(e,t="all"){return Se(`${Ge(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function xC(e,t){return Se(`${Ge(e)}/pulls/${t}`)}async function EC(e,t){await Se(`${Ge(e)}/pulls/${t}/merge`,{method:"POST"})}async function Wh(e,t){return sa(await Se(`${Ge(e)}/pulls/${t}/issues`))}async function yC(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function NC(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function TC(e,t){return Se(`${Ge(e)}/pulls/${t}/comments`)}async function _C(e,t){return Se(`${Ge(e)}/issues/${t}/comments`)}async function Mx(e,t,a){return Se(`${Ge(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function vC(e,t,a){return Se(`${Ge(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function Dx(e,t){return Se(`${Ge(e)}/issues/${t}/draft`)}async function SC(e,t,a){return Se(`${Ge(e)}/issues/polish-create`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Lx(e){return Se(`${Ge(e)}/issues/draft-create`)}async function AC(e){await Se(`${Ge(e)}/issues/draft-create`,{method:"DELETE"})}async function CC(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function wC(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function kC(){return Se("/api/agents-md")}async function RC(e){await Se("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function OC(e){return Se(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function IC(e,t){await Se(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function MC(e){return`${Iy()}${Ge(e)}/events`}async function DC(e){return Se(`${Ge(e)}/sessions/status`)}async function Oo(){return Se("/api/settings")}async function lh(e,t){await Se(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function oh(){return Se("/api/cloud/status")}async function LC(){return Se("/api/cloud/reload",{method:"POST"})}async function jC(e){try{return(await Se("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function BC(){return sa(await Se("/api/git-hosts"),"gitHosts")}async function PC(e,t,a,r="gitea"){return Se("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:r})})}async function UC(e){await Se(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Hy(){return Se("/api/usage")}async function Fy(e){return Se("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function HC(e,t="ios"){await Se("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ar="fs-active-repo",Pe=es((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ar),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await k5(),r=t().activeRepoId,o=r&&a.some(c=>c.id===r);e({repos:a,loading:!1,activeRepoId:o?r:a.length>0?a[0].id:null});const u=t().activeRepoId;u?localStorage.setItem(ar,u):localStorage.removeItem(ar)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ar,a):localStorage.removeItem(ar)},addRepo:async(a,r,o,u)=>{try{const c=await R5(a,r,o,u);return e(f=>({repos:[...f.repos,c],activeRepoId:c.id})),localStorage.setItem(ar,c.id),c}catch(c){return e({loadError:c instanceof Error?c.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await I5(a)}catch{}e(r=>{const o=r.repos.filter(c=>c.id!==a),u=r.activeRepoId===a?o.length>0?o[0].id:null:r.activeRepoId;return u?localStorage.setItem(ar,u):localStorage.removeItem(ar),{repos:o,activeRepoId:u}})},updateRepoBranch:(a,r)=>{e(o=>({repos:o.repos.map(u=>u.id===a?{...u,branch:r}:u)}))}})),zn=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},jx="fs-nav-collapsed",Bx="fs-session-panel-collapsed",Cc=es(e=>({navCollapsed:localStorage.getItem(jx)==="true",sessionPanelCollapsed:localStorage.getItem(Bx)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(jx,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(Bx,String(a)),{sessionPanelCollapsed:a}})}})),zy=[{segment:"run",icon:Vh,label:"运行面板",global:!1},{segment:"dev/issues",icon:i3,label:"研发",global:!1,matchPrefix:"dev"},{segment:"agents",icon:BA,label:"Agents",global:!1}];function $y(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function qy(e,t,a){if(!e.matchPrefix)return!1;const r=e.global?`/${e.matchPrefix}`:a?`/${encodeURIComponent(a)}/${e.matchPrefix}`:null;return r?t===r||t.startsWith(`${r}/`):!1}function FC(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function zC({repos:e,activeRepoId:t,onRepoChange:a}){const r=Sn(),[o,u]=T.useState(!1),c=T.useRef(null),f=e.find(h=>h.id===t),m=T.useCallback(()=>u(!1),[]);return T.useEffect(()=>{if(!o)return;const h=b=>{c.current&&!c.current.contains(b.target)&&m()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o,m]),i.jsxs("div",{ref:c,className:"relative",children:[i.jsxs("button",{type:"button",onClick:()=>u(h=>!h),className:"flex max-w-[140px] items-center gap-1 rounded-md border border-line bg-base px-2 py-1 text-xs text-fg-2 transition-colors hover:border-blue-500 sm:max-w-[200px]",children:[i.jsx(yy,{className:"h-3 w-3 shrink-0 text-fg-4"}),i.jsxs("span",{className:"truncate",children:[i.jsx("span",{className:"sm:hidden",children:f?FC(f.name):""}),i.jsx("span",{className:"hidden sm:inline",children:(f==null?void 0:f.name)??""})]}),i.jsx(ba,{className:ae("h-3 w-3 shrink-0 text-fg-4 transition-transform",o&&"rotate-180")})]}),o&&i.jsxs("div",{className:"absolute left-0 top-full z-50 mt-1 w-64 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[i.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:e.map(h=>i.jsxs("button",{type:"button",onClick:()=>{a(h.id),m()},className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",h.id===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[h.id===t?i.jsx(In,{className:"h-3 w-3 shrink-0"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:h.name})]},h.id))}),i.jsx("div",{className:"border-t border-line",children:i.jsxs("button",{type:"button",onClick:()=>{r("/repos"),m()},className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:[i.jsx(Xh,{className:"h-3 w-3 shrink-0"}),i.jsx("span",{children:"管理仓库"})]})})]})]})}function $C({repoId:e,currentBranch:t}){const a=Pe(v=>v.updateRepoBranch),[r,o]=T.useState(!1),[u,c]=T.useState(null),[f,m]=T.useState(!1),[h,b]=T.useState(null),[g,y]=T.useState(null),N=T.useRef(null),S=T.useCallback(()=>{o(!1),y(null)},[]);T.useEffect(()=>{if(!r)return;const v=D=>{N.current&&!N.current.contains(D.target)&&S()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r,S]);const A=async()=>{if(r){S();return}o(!0),m(!0),y(null);try{c(await L5(e))}catch{y("加载分支失败")}finally{m(!1)}},C=async v=>{if(!(v===t||h)){b(v),y(null);try{const D=await j5(e,v);a(e,D.branch),S()}catch(D){y(D instanceof Error?D.message:"切换失败")}finally{b(null)}}};return t?i.jsxs("div",{ref:N,className:"relative",children:[i.jsxs("button",{type:"button",onClick:A,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:[i.jsx(ko,{className:"h-3 w-3"}),t,i.jsx(ba,{className:ae("h-3 w-3 transition-transform",r&&"rotate-180")})]}),r&&i.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?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx(un,{className:"h-4 w-4 animate-spin text-fg-4"})}):u?i.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[u.local.map(v=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(v),className:ae("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?i.jsx(In,{className:"h-3 w-3 shrink-0"}):h===v?i.jsx(un,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:v})]},v)),u.remote.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mx-3 my-1 border-t border-line"}),i.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),u.remote.map(v=>i.jsxs("button",{type:"button",disabled:h!==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:[h===v?i.jsx(un,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:v})]},`remote-${v}`))]})]}):null,g&&i.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:g})]})]}):null}function qC(){const[e,t]=T.useState(null);return T.useEffect(()=>{const a=()=>fetch("/api/health").then(u=>u.json()).then(u=>{u.latestVersion&&u.latestVersion!=="0.10.16"&&t(u.latestVersion)}).catch(()=>{});a();const r=setInterval(a,30*6e4),o=()=>a();return window.addEventListener("focus",o),()=>{clearInterval(r),window.removeEventListener("focus",o)}},[]),e}function YC(){const e=Sn(),t=vn(),a=Pe(g=>g.repos),r=Pe(g=>g.activeRepoId),o=Pe(g=>g.setActiveRepo),u=rh(g=>g.preference),c=rh(g=>g.cycle),f=u==="light"?h5:u==="dark"?V3:G3,m=a.find(g=>g.id===r),h=qC(),b=g=>{var A;if(!g)return;o(g);const y=a.find(C=>C.id===g);if(!y)return;const N=t.pathname.match(/\/dev\/(issues|pulls)/);if(N){e(`/${encodeURIComponent(y.name)}/dev/${N[1]}`);return}const S=((A=t.pathname.match(/\/(run|agents|issues|pulls)/))==null?void 0:A[1])??"run";e(`/${encodeURIComponent(y.name)}/${S}`)};return i.jsxs("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:[i.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(Wc,{className:"h-5 w-5 text-blue-500"}),i.jsx("span",{className:"hidden text-sm font-bold tracking-tight text-fg sm:inline",children:"Fourth Spark"}),i.jsxs("span",{className:"hidden rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4 sm:inline",children:["v","0.10.16"]}),h&&i.jsxs("span",{className:"hidden text-[10px] text-amber-500 sm:inline",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(zC,{repos:a,activeRepoId:r,onRepoChange:b}),m&&r&&i.jsx($C,{repoId:r,currentBranch:m.branch})]}),i.jsx("button",{type:"button",onClick:()=>e("/settings"),"aria-label":"设置",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:i.jsx(Xh,{className:"h-4 w-4"})}),i.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:i.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:i.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"})})}),i.jsx("button",{type:"button",onClick:c,"aria-label":`主题: ${u}`,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:i.jsx(f,{className:"h-4 w-4"})})]})]}),h&&i.jsx("div",{className:"border-t border-line px-4 py-1.5 sm:hidden",children:i.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})})]})}function GC(){const e=Pe(zn),t=Cc(o=>o.navCollapsed),a=Cc(o=>o.toggleNav),r=vn();return i.jsxs("nav",{className:ae("hidden shrink-0 flex-col border-r border-line bg-surface py-2 transition-[width] duration-200 ease-in-out md:flex",t?"w-14":"w-48"),children:[i.jsx("div",{className:"flex flex-1 flex-col",children:zy.map(o=>{const u=qy(o,r.pathname,e);return i.jsxs(vc,{to:$y(o.segment,o.global,e),title:t?o.label:void 0,className:({isActive:c})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",c||u?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[i.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:o.label})]},o.segment)})}),i.jsxs(vc,{to:"/settings",title:t?"设置":void 0,className:({isActive:o})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",o?"bg-blue-500/10 font-medium text-blue-600":"text-fg-4 hover:bg-elevated hover:text-fg-2"),children:[i.jsx(Xh,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:"设置"})]}),i.jsx("button",{type:"button",onClick:a,title:t?"展开导航":"收起导航",className:"mx-2 flex items-center justify-center rounded-md py-2 text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:t?i.jsx(XA,{className:"h-4 w-4"}):i.jsx(KA,{className:"h-4 w-4"})})]})}function KC(){const e=Pe(zn),t=vn();return i.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:i.jsx("div",{className:"flex h-14 items-center justify-around",children:zy.map(a=>{const r=qy(a,t.pathname,e);return i.jsx(vc,{to:$y(a.segment,a.global,e),"aria-label":a.label,className:({isActive:o})=>ae("flex h-10 w-10 items-center justify-center rounded-md transition-colors",o||r?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:i.jsx(a.icon,{className:"h-5 w-5 shrink-0"})},a.segment)})})})}function VC(){return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[i.jsx(YC,{}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx(GC,{}),i.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:i.jsx(US,{})})]}),i.jsx(KC,{})]})}let XC=0;const Gt=es(e=>({toasts:[],addToast:(t,a="info",r,o)=>{const u=(o==null?void 0:o.id)??`toast-${++XC}-${Date.now()}`;e(c=>c.toasts.some(f=>f.id===u)?c:{toasts:[...c.toasts,{id:u,message:t,variant:a,sessionId:r,persistent:o==null?void 0:o.persistent}]}),o!=null&&o.persistent||setTimeout(()=>{e(c=>({toasts:c.toasts.filter(f=>f.id!==u)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(r=>r.id!==t)}))}}));function QC({onClose:e}){const[t,a]=T.useState(""),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState("opencode"),[h,b]=T.useState(!1),[g,y]=T.useState(""),N=Pe(D=>D.addRepo),S=r.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,A=async D=>{const R=D.trim();if(R){b(!0),y("");try{const L=await O5(R);L.name&&!r.trim()&&o(L.name),L.gitUrl&&!u.trim()&&c(L.gitUrl)}catch(L){const I=L instanceof Error?L.message:"无法解析路径";try{const H=JSON.parse(I);y(H.error??I)}catch{y(I)}}b(!1)}},C=T.useRef(A);C.current=A,T.useEffect(()=>{const D=t.trim();if(!D)return;const R=setTimeout(()=>{C.current(D)},500);return()=>clearTimeout(R)},[t]);const v=async()=>{if(!S)return;y(""),await N(r.trim(),u.trim(),t.trim(),f)&&e()};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:D=>D.stopPropagation(),children:[i.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[i.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),i.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(mt,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),i.jsx("input",{id:"m-path",value:t,onChange:D=>a(D.target.value),onBlur:D=>void A(D.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"}),i.jsx("span",{className:"text-[11px] text-fg-5",children:h?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),i.jsx("input",{id:"m-name",value:r,onChange:D=>o(D.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"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),i.jsx("input",{id:"m-git",value:u,onChange:D=>c(D.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"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-fg-3",children:"运行时"}),i.jsx("div",{className:"flex gap-2",children:[{value:"opencode",label:"OpenCode"},{value:"claude-code",label:"Claude Code"}].map(D=>i.jsx("button",{type:"button",onClick:()=>m(D.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===D.value?"border-blue-500 bg-blue-500/10 text-blue-600":"border-line bg-base text-fg-4 hover:bg-elevated hover:text-fg-2"}`,children:D.label},D.value))}),i.jsx("span",{className:"text-[11px] text-fg-5",children:f==="claude-code"?"需要本地安装 Claude Code CLI":"需要本地安装 OpenCode CLI"})]}),g&&i.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:g}),i.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[i.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:"取消"}),i.jsx("button",{type:"button",onClick:v,disabled:!S,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 WC({repoId:e,repoName:t,onClose:a}){const[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(!0),[h,b]=T.useState(!1),[g,y]=T.useState(null);T.useEffect(()=>{OC(e).then(A=>{o(A.content),c(A.content),m(!1)}).catch(A=>{y(A instanceof Error?A.message:String(A)),m(!1)})},[e]);const N=async()=>{b(!0),y(null);try{await IC(e,r),c(r)}catch(A){y(A instanceof Error?A.message:String(A))}b(!1)},S=r!==u;return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:i.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:A=>A.stopPropagation(),children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),i.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),i.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(mt,{className:"h-4 w-4"})})]}),g&&i.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:[i.jsx(_n,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 break-words",children:g})]}),f?i.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[i.jsx(un,{className:"h-5 w-5 fs-spin"}),i.jsx("p",{className:"text-xs",children:"加载中…"})]}):i.jsx("textarea",{value:r,onChange:A=>o(A.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
|
|
460
|
+
*/const v5=[["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"}]],Wc=Re("zap",v5);function ky(e){var t,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=ky(e[t]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function ae(){for(var e,t,a=0,r="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=ky(e))&&(r&&(r+=" "),r+=t);return r}const Nx=e=>{let t;const a=new Set,r=(h,b)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const y=t;t=b??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(N=>N(t,y))}},o=()=>t,f={setState:r,getState:o,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=t=e(r,o,f);return f},S5=(e=>e?Nx(e):Nx),A5=e=>e;function C5(e,t=A5){const a=ac.useSyncExternalStore(e.subscribe,ac.useCallback(()=>t(e.getState()),[e,t]),ac.useCallback(()=>t(e.getInitialState()),[e,t]));return ac.useDebugValue(a),a}const Tx=e=>{const t=S5(e),a=r=>C5(t,r);return Object.assign(a,t),a},es=(e=>e?Tx(e):Tx),_m="fs-theme";function Ry(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function _x(e){return e==="system"?Ry():e}function vx(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const rh=es((e,t)=>({preference:localStorage.getItem(_m)??"system",resolved:_x(localStorage.getItem(_m)??"system"),cycle(){const a=["system","light","dark"],r=a[(a.indexOf(t().preference)+1)%a.length],o=_x(r);localStorage.setItem(_m,r),vx(r),e({preference:r,resolved:o})},init(){vx(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{const{preference:o}=t();if(o==="system"){const u=Ry();e({resolved:u})}};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)}})),Ac="fourth-spark-server-url";function Oy(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function Iy(){return localStorage.getItem(Ac)??""}function w5(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(Ac,t):localStorage.removeItem(Ac)}function ih(){return localStorage.getItem(Ac)??""}class Ss extends Error{constructor(a,r){super(a);ln(this,"status");this.name="ApiError",this.status=r}}async function Se(e,t){let a;try{a=await fetch(Iy()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(o){throw new Ss(o instanceof Error?o.message:"Network request failed",0)}if(!a.ok){const o=await a.text().catch(()=>"");throw new Ss(o.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const r=await a.text();if(r)return JSON.parse(r)}function sa(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const r of[...t,"data","items"])if(Array.isArray(a[r]))return a[r]}return[]}async function k5(){return sa(await Se("/api/repos"),"repos")}async function R5(e,t,a,r){return Se("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:r})})}async function O5(e){return Se("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function I5(e){await Se(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function M5(e){await Se(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function D5(e){await Se(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function L5(e){return Se(`/api/repos/${encodeURIComponent(e)}/branches`)}async function j5(e,t){return Se(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function B5(e){return Se(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ge(e){return`/api/repos/${encodeURIComponent(e)}`}async function P5(e){return sa(await Se(`${Ge(e)}/workspaces`),"workspaces")}async function U5(e,t){await Se(`${Ge(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function H5(e){return Se(`${Ge(e)}/workspaces/cleanup`,{method:"POST"})}async function F5(e,t){await Se(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function z5(e,t){await Se(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function $5(e){return sa(await Se(`${Ge(e)}/sessions`),"sessions")}async function q5(e,t,a,r,o,u,c,f){return Se(`${Ge(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:r,variant:o,issueId:u,customAgentId:c,files:f})})}async function Y5(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function G5(e,t,a,r,o,u,c){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:r,model:o,variant:u,files:c})})}async function K5(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function V5(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function X5(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}async function Q5(e,t,a){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({messageID:a})})}function Sx(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const r=Array.isArray(t.parts)?t.parts:void 0;return{...a,...r?{parts:r}:{}}}return t}async function Ax(e,t,a){const r=new URLSearchParams;a!=null&&a.limit&&r.set("limit",String(a.limit)),a!=null&&a.before&&r.set("before",a.before);const o=r.toString(),u=`${Ge(e)}/sessions/${encodeURIComponent(t)}/messages${o?`?${o}`:""}`,c=await Se(u);if(Array.isArray(c)){const h=c.map(Sx);return{messages:h,total:h.length,hasMore:!1}}const f=c,m=Array.isArray(f.messages)?f.messages:[];return{messages:m.map(Sx),total:f.total??m.length,hasMore:f.hasMore??!1}}async function W5(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/status`)}async function Z5(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`)}async function J5(e,t){return Se(`${Ge(e)}/sessions/snapshot/${encodeURIComponent(t)}`)}async function My(e){return Se(`${Ge(e)}/sessions/all-links`)}async function eC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:r})})}async function tC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:r})})}async function Dy(){return sa(await Se("/api/custom-agents"))}async function nC(e){return Se("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function aC(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Ly(e){await Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Cx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function sC(e){return Se("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function jy(e,t){const a=new URLSearchParams;t!=null&&t.category&&a.set("category",t.category),t!=null&&t.includeSuperseded&&a.set("includeSuperseded","true");const r=a.toString();return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories${r?`?${r}`:""}`)}async function rC(e,t,a){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(a)})}async function iC(e,t){await Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"DELETE"})}async function lC(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/extract`,{method:"POST",body:JSON.stringify({sessionIds:t})})}async function wx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/stats`)}async function oC(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/consolidate`,{method:"POST"})}async function Qh(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/sessions`)}async function By(e){return sa(await Se(`${Ge(e)}/custom-agents`))}async function uC(e,t){return Se(`${Ge(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Ro(e){return sa(await Se(`${Ge(e)}/models`))}async function Py(){return sa(await Se("/api/prompt-fragments"))}async function cC(e){return Se("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function dC(e,t){return Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function fC(e){await Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function kx(e){return sa(await Se(`${Ge(e)}/tags`))}async function Rx(e,t){return sa(await Se(`${Ge(e)}/milestones`))}async function Ox(e,t="open"){return sa(await Se(`${Ge(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function mC(e,t="all"){return Se(`${Ge(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function hC(e,t,a){return Se(`${Ge(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function pC(e,t,a){await Se(`${Ge(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function Uy(e,t,a){return Se(`${Ge(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function gC(e,t){return sa(await Se(`${Ge(e)}/issues/${t}/pulls`))}async function Ix(e,t="open"){return sa(await Se(`${Ge(e)}/pulls?state=${encodeURIComponent(t)}`))}async function bC(e,t="all"){return Se(`${Ge(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function xC(e,t){return Se(`${Ge(e)}/pulls/${t}`)}async function EC(e,t){await Se(`${Ge(e)}/pulls/${t}/merge`,{method:"POST"})}async function Wh(e,t){return sa(await Se(`${Ge(e)}/pulls/${t}/issues`))}async function yC(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function NC(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function TC(e,t){return Se(`${Ge(e)}/pulls/${t}/comments`)}async function _C(e,t){return Se(`${Ge(e)}/issues/${t}/comments`)}async function Mx(e,t,a){return Se(`${Ge(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function vC(e,t,a){return Se(`${Ge(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function Dx(e,t){return Se(`${Ge(e)}/issues/${t}/draft`)}async function SC(e,t,a){return Se(`${Ge(e)}/issues/polish-create`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Lx(e){return Se(`${Ge(e)}/issues/draft-create`)}async function AC(e){await Se(`${Ge(e)}/issues/draft-create`,{method:"DELETE"})}async function CC(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function wC(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function kC(){return Se("/api/agents-md")}async function RC(e){await Se("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function OC(e){return Se(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function IC(e,t){await Se(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function MC(e){return`${Iy()}${Ge(e)}/events`}async function DC(e){return Se(`${Ge(e)}/sessions/status`)}async function Oo(){return Se("/api/settings")}async function lh(e,t){await Se(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function oh(){return Se("/api/cloud/status")}async function LC(){return Se("/api/cloud/reload",{method:"POST"})}async function jC(e){try{return(await Se("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function BC(){return sa(await Se("/api/git-hosts"),"gitHosts")}async function PC(e,t,a,r="gitea"){return Se("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:r})})}async function UC(e){await Se(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Hy(){return Se("/api/usage")}async function Fy(e){return Se("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function HC(e,t="ios"){await Se("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ar="fs-active-repo",Pe=es((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ar),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await k5(),r=t().activeRepoId,o=r&&a.some(c=>c.id===r);e({repos:a,loading:!1,activeRepoId:o?r:a.length>0?a[0].id:null});const u=t().activeRepoId;u?localStorage.setItem(ar,u):localStorage.removeItem(ar)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ar,a):localStorage.removeItem(ar)},addRepo:async(a,r,o,u)=>{try{const c=await R5(a,r,o,u);return e(f=>({repos:[...f.repos,c],activeRepoId:c.id})),localStorage.setItem(ar,c.id),c}catch(c){return e({loadError:c instanceof Error?c.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await I5(a)}catch{}e(r=>{const o=r.repos.filter(c=>c.id!==a),u=r.activeRepoId===a?o.length>0?o[0].id:null:r.activeRepoId;return u?localStorage.setItem(ar,u):localStorage.removeItem(ar),{repos:o,activeRepoId:u}})},updateRepoBranch:(a,r)=>{e(o=>({repos:o.repos.map(u=>u.id===a?{...u,branch:r}:u)}))}})),zn=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},jx="fs-nav-collapsed",Bx="fs-session-panel-collapsed",Cc=es(e=>({navCollapsed:localStorage.getItem(jx)==="true",sessionPanelCollapsed:localStorage.getItem(Bx)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(jx,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(Bx,String(a)),{sessionPanelCollapsed:a}})}})),zy=[{segment:"run",icon:Vh,label:"运行面板",global:!1},{segment:"dev/issues",icon:i3,label:"研发",global:!1,matchPrefix:"dev"},{segment:"agents",icon:BA,label:"Agents",global:!1}];function $y(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function qy(e,t,a){if(!e.matchPrefix)return!1;const r=e.global?`/${e.matchPrefix}`:a?`/${encodeURIComponent(a)}/${e.matchPrefix}`:null;return r?t===r||t.startsWith(`${r}/`):!1}function FC(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function zC({repos:e,activeRepoId:t,onRepoChange:a}){const r=Sn(),[o,u]=T.useState(!1),c=T.useRef(null),f=e.find(h=>h.id===t),m=T.useCallback(()=>u(!1),[]);return T.useEffect(()=>{if(!o)return;const h=b=>{c.current&&!c.current.contains(b.target)&&m()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o,m]),i.jsxs("div",{ref:c,className:"relative",children:[i.jsxs("button",{type:"button",onClick:()=>u(h=>!h),className:"flex max-w-[140px] items-center gap-1 rounded-md border border-line bg-base px-2 py-1 text-xs text-fg-2 transition-colors hover:border-blue-500 sm:max-w-[200px]",children:[i.jsx(yy,{className:"h-3 w-3 shrink-0 text-fg-4"}),i.jsxs("span",{className:"truncate",children:[i.jsx("span",{className:"sm:hidden",children:f?FC(f.name):""}),i.jsx("span",{className:"hidden sm:inline",children:(f==null?void 0:f.name)??""})]}),i.jsx(ba,{className:ae("h-3 w-3 shrink-0 text-fg-4 transition-transform",o&&"rotate-180")})]}),o&&i.jsxs("div",{className:"absolute left-0 top-full z-50 mt-1 w-64 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[i.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:e.map(h=>i.jsxs("button",{type:"button",onClick:()=>{a(h.id),m()},className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",h.id===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[h.id===t?i.jsx(In,{className:"h-3 w-3 shrink-0"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:h.name})]},h.id))}),i.jsx("div",{className:"border-t border-line",children:i.jsxs("button",{type:"button",onClick:()=>{r("/repos"),m()},className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:[i.jsx(Xh,{className:"h-3 w-3 shrink-0"}),i.jsx("span",{children:"管理仓库"})]})})]})]})}function $C({repoId:e,currentBranch:t}){const a=Pe(v=>v.updateRepoBranch),[r,o]=T.useState(!1),[u,c]=T.useState(null),[f,m]=T.useState(!1),[h,b]=T.useState(null),[g,y]=T.useState(null),N=T.useRef(null),S=T.useCallback(()=>{o(!1),y(null)},[]);T.useEffect(()=>{if(!r)return;const v=D=>{N.current&&!N.current.contains(D.target)&&S()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r,S]);const A=async()=>{if(r){S();return}o(!0),m(!0),y(null);try{c(await L5(e))}catch{y("加载分支失败")}finally{m(!1)}},C=async v=>{if(!(v===t||h)){b(v),y(null);try{const D=await j5(e,v);a(e,D.branch),S()}catch(D){y(D instanceof Error?D.message:"切换失败")}finally{b(null)}}};return t?i.jsxs("div",{ref:N,className:"relative",children:[i.jsxs("button",{type:"button",onClick:A,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:[i.jsx(ko,{className:"h-3 w-3"}),t,i.jsx(ba,{className:ae("h-3 w-3 transition-transform",r&&"rotate-180")})]}),r&&i.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?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx(un,{className:"h-4 w-4 animate-spin text-fg-4"})}):u?i.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[u.local.map(v=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(v),className:ae("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?i.jsx(In,{className:"h-3 w-3 shrink-0"}):h===v?i.jsx(un,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:v})]},v)),u.remote.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mx-3 my-1 border-t border-line"}),i.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),u.remote.map(v=>i.jsxs("button",{type:"button",disabled:h!==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:[h===v?i.jsx(un,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:v})]},`remote-${v}`))]})]}):null,g&&i.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:g})]})]}):null}function qC(){const[e,t]=T.useState(null);return T.useEffect(()=>{const a=()=>fetch("/api/health").then(u=>u.json()).then(u=>{u.latestVersion&&u.latestVersion!=="0.10.17"&&t(u.latestVersion)}).catch(()=>{});a();const r=setInterval(a,30*6e4),o=()=>a();return window.addEventListener("focus",o),()=>{clearInterval(r),window.removeEventListener("focus",o)}},[]),e}function YC(){const e=Sn(),t=vn(),a=Pe(g=>g.repos),r=Pe(g=>g.activeRepoId),o=Pe(g=>g.setActiveRepo),u=rh(g=>g.preference),c=rh(g=>g.cycle),f=u==="light"?h5:u==="dark"?V3:G3,m=a.find(g=>g.id===r),h=qC(),b=g=>{var A;if(!g)return;o(g);const y=a.find(C=>C.id===g);if(!y)return;const N=t.pathname.match(/\/dev\/(issues|pulls)/);if(N){e(`/${encodeURIComponent(y.name)}/dev/${N[1]}`);return}const S=((A=t.pathname.match(/\/(run|agents|issues|pulls)/))==null?void 0:A[1])??"run";e(`/${encodeURIComponent(y.name)}/${S}`)};return i.jsxs("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:[i.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(Wc,{className:"h-5 w-5 text-blue-500"}),i.jsx("span",{className:"hidden text-sm font-bold tracking-tight text-fg sm:inline",children:"Fourth Spark"}),i.jsxs("span",{className:"hidden rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4 sm:inline",children:["v","0.10.17"]}),h&&i.jsxs("span",{className:"hidden text-[10px] text-amber-500 sm:inline",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(zC,{repos:a,activeRepoId:r,onRepoChange:b}),m&&r&&i.jsx($C,{repoId:r,currentBranch:m.branch})]}),i.jsx("button",{type:"button",onClick:()=>e("/settings"),"aria-label":"设置",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:i.jsx(Xh,{className:"h-4 w-4"})}),i.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:i.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:i.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"})})}),i.jsx("button",{type:"button",onClick:c,"aria-label":`主题: ${u}`,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:i.jsx(f,{className:"h-4 w-4"})})]})]}),h&&i.jsx("div",{className:"border-t border-line px-4 py-1.5 sm:hidden",children:i.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})})]})}function GC(){const e=Pe(zn),t=Cc(o=>o.navCollapsed),a=Cc(o=>o.toggleNav),r=vn();return i.jsxs("nav",{className:ae("hidden shrink-0 flex-col border-r border-line bg-surface py-2 transition-[width] duration-200 ease-in-out md:flex",t?"w-14":"w-48"),children:[i.jsx("div",{className:"flex flex-1 flex-col",children:zy.map(o=>{const u=qy(o,r.pathname,e);return i.jsxs(vc,{to:$y(o.segment,o.global,e),title:t?o.label:void 0,className:({isActive:c})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",c||u?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[i.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:o.label})]},o.segment)})}),i.jsxs(vc,{to:"/settings",title:t?"设置":void 0,className:({isActive:o})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",o?"bg-blue-500/10 font-medium text-blue-600":"text-fg-4 hover:bg-elevated hover:text-fg-2"),children:[i.jsx(Xh,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:"设置"})]}),i.jsx("button",{type:"button",onClick:a,title:t?"展开导航":"收起导航",className:"mx-2 flex items-center justify-center rounded-md py-2 text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:t?i.jsx(XA,{className:"h-4 w-4"}):i.jsx(KA,{className:"h-4 w-4"})})]})}function KC(){const e=Pe(zn),t=vn();return i.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:i.jsx("div",{className:"flex h-14 items-center justify-around",children:zy.map(a=>{const r=qy(a,t.pathname,e);return i.jsx(vc,{to:$y(a.segment,a.global,e),"aria-label":a.label,className:({isActive:o})=>ae("flex h-10 w-10 items-center justify-center rounded-md transition-colors",o||r?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:i.jsx(a.icon,{className:"h-5 w-5 shrink-0"})},a.segment)})})})}function VC(){return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[i.jsx(YC,{}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx(GC,{}),i.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:i.jsx(US,{})})]}),i.jsx(KC,{})]})}let XC=0;const Gt=es(e=>({toasts:[],addToast:(t,a="info",r,o)=>{const u=(o==null?void 0:o.id)??`toast-${++XC}-${Date.now()}`;e(c=>c.toasts.some(f=>f.id===u)?c:{toasts:[...c.toasts,{id:u,message:t,variant:a,sessionId:r,persistent:o==null?void 0:o.persistent}]}),o!=null&&o.persistent||setTimeout(()=>{e(c=>({toasts:c.toasts.filter(f=>f.id!==u)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(r=>r.id!==t)}))}}));function QC({onClose:e}){const[t,a]=T.useState(""),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState("opencode"),[h,b]=T.useState(!1),[g,y]=T.useState(""),N=Pe(D=>D.addRepo),S=r.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,A=async D=>{const R=D.trim();if(R){b(!0),y("");try{const L=await O5(R);L.name&&!r.trim()&&o(L.name),L.gitUrl&&!u.trim()&&c(L.gitUrl)}catch(L){const I=L instanceof Error?L.message:"无法解析路径";try{const H=JSON.parse(I);y(H.error??I)}catch{y(I)}}b(!1)}},C=T.useRef(A);C.current=A,T.useEffect(()=>{const D=t.trim();if(!D)return;const R=setTimeout(()=>{C.current(D)},500);return()=>clearTimeout(R)},[t]);const v=async()=>{if(!S)return;y(""),await N(r.trim(),u.trim(),t.trim(),f)&&e()};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:D=>D.stopPropagation(),children:[i.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[i.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),i.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(mt,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),i.jsx("input",{id:"m-path",value:t,onChange:D=>a(D.target.value),onBlur:D=>void A(D.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"}),i.jsx("span",{className:"text-[11px] text-fg-5",children:h?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),i.jsx("input",{id:"m-name",value:r,onChange:D=>o(D.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"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),i.jsx("input",{id:"m-git",value:u,onChange:D=>c(D.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"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-fg-3",children:"运行时"}),i.jsx("div",{className:"flex gap-2",children:[{value:"opencode",label:"OpenCode"},{value:"claude-code",label:"Claude Code"}].map(D=>i.jsx("button",{type:"button",onClick:()=>m(D.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===D.value?"border-blue-500 bg-blue-500/10 text-blue-600":"border-line bg-base text-fg-4 hover:bg-elevated hover:text-fg-2"}`,children:D.label},D.value))}),i.jsx("span",{className:"text-[11px] text-fg-5",children:f==="claude-code"?"需要本地安装 Claude Code CLI":"需要本地安装 OpenCode CLI"})]}),g&&i.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:g}),i.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[i.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:"取消"}),i.jsx("button",{type:"button",onClick:v,disabled:!S,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 WC({repoId:e,repoName:t,onClose:a}){const[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(!0),[h,b]=T.useState(!1),[g,y]=T.useState(null);T.useEffect(()=>{OC(e).then(A=>{o(A.content),c(A.content),m(!1)}).catch(A=>{y(A instanceof Error?A.message:String(A)),m(!1)})},[e]);const N=async()=>{b(!0),y(null);try{await IC(e,r),c(r)}catch(A){y(A instanceof Error?A.message:String(A))}b(!1)},S=r!==u;return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:i.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:A=>A.stopPropagation(),children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),i.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),i.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(mt,{className:"h-4 w-4"})})]}),g&&i.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:[i.jsx(_n,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 break-words",children:g})]}),f?i.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[i.jsx(un,{className:"h-5 w-5 fs-spin"}),i.jsx("p",{className:"text-xs",children:"加载中…"})]}):i.jsx("textarea",{value:r,onChange:A=>o(A.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
|
|
461
461
|
|
|
462
462
|
在此编写该仓库的 Agent 指令…`}),i.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[i.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:"关闭"}),i.jsxs("button",{type:"button",onClick:()=>void N(),disabled:h||!S,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:[i.jsx(Qc,{className:"h-3.5 w-3.5"}),h?"保存中…":"保存"]})]})]})})}const uh=1024,ch=uh*1024,Px=ch*1024;function Ux(e){return!e||e<=0?"0 B":e<uh?`${e} B`:e<ch?`${(e/uh).toFixed(1)} KB`:e<Px?`${(e/ch).toFixed(1)} MB`:`${(e/Px).toFixed(2)} GB`}const vm="ws/";function ZC({repoId:e}){const[t,a]=T.useState(!1),[r,o]=T.useState(null),[u,c]=T.useState(!1),[f,m]=T.useState(null),[h,b]=T.useState(null),[g,y]=T.useState(!1),N=async()=>{c(!0),m(null);try{const D=await P5(e);o(D)}catch(D){m(D instanceof Ss?D.message:"加载失败")}c(!1)};T.useEffect(()=>{t&&r===null&&N()},[t]);const S=async D=>{b(D);try{await U5(e,D),await N()}catch(R){m(R instanceof Ss?R.message:"删除失败")}b(null)},A=async()=>{y(!0);try{await H5(e),await N()}catch(D){m(D instanceof Ss?D.message:"清理失败")}y(!1)},C=(r==null?void 0:r.length)??0,v=(r==null?void 0:r.reduce((D,R)=>D+(R.diskUsage||0),0))??0;return i.jsxs("div",{className:"mt-3 border-t border-line pt-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>a(D=>!D),className:"flex min-w-0 flex-1 items-center gap-1.5 text-left text-xs font-medium text-fg-3 transition-colors hover:text-fg-2",children:[t?i.jsx(YA,{className:"h-3 w-3 shrink-0"}):i.jsx(ba,{className:"h-3 w-3 shrink-0"}),i.jsx(ko,{className:"h-3 w-3 shrink-0 text-fg-5"}),i.jsx("span",{children:"工作空间"}),r!==null&&i.jsxs("span",{className:"text-fg-5",children:["(",C,") · ",Ux(v)]})]}),t&&C>0&&i.jsxs("button",{type:"button",onClick:()=>void A(),disabled:g,className:"flex h-6 shrink-0 items-center gap-1 rounded border border-line px-2 text-xs text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2 disabled:opacity-50",children:[g?i.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):null,"清理已合并"]})]}),t&&i.jsxs("div",{className:"mt-2",children:[f&&i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2 rounded border border-red-500/30 bg-red-500/5 px-2 py-1 text-xs text-red-600",children:[i.jsx("span",{className:"truncate",children:f}),i.jsx("button",{type:"button",onClick:()=>m(null),className:"shrink-0 rounded p-0.5 transition-colors hover:bg-red-500/10",children:i.jsx(mt,{className:"h-3 w-3"})})]}),u&&r===null?i.jsx("div",{className:"flex justify-center py-3",children:i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-fg-5 border-t-transparent"})}):C===0?i.jsx("p",{className:"py-2 text-center text-xs text-fg-5",children:"暂无工作空间"}):i.jsx("ul",{className:"space-y-1",children:r==null?void 0:r.map(D=>{const R=D.branch.startsWith(vm),L=R?D.branch.slice(vm.length):D.branch,I=D.status==="active"?"bg-emerald-500/10 text-emerald-600":D.status==="idle"?"bg-amber-500/10 text-amber-600":"bg-fg-6/30 text-fg-4",H=D.status==="active"?"活跃":D.status==="idle"?"空闲":D.status==="merged"?"已合并":D.status==="stale"?"陈旧":D.status,$=D.status!=="active";return i.jsxs("li",{className:"flex items-center gap-2 rounded-md border border-line bg-elevated/40 px-2 py-1.5 text-xs",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[D.running&&D.port&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",title:`运行中 :${D.port}`}),i.jsxs("span",{className:"min-w-0 truncate font-mono",children:[R&&i.jsx("span",{className:"text-fg-5",children:vm}),i.jsx("span",{className:"text-fg-2",children:L})]})]}),i.jsx("span",{className:ae("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium",I),children:H}),i.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 text-fg-5",children:[i.jsx(C3,{className:"h-2.5 w-2.5"}),Ux(D.diskUsage)]}),i.jsx("button",{type:"button",onClick:()=>void S(D.id),disabled:!$||h===D.id,title:$?"删除工作空间":"活跃工作空间无法删除",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-fg-5 transition-colors hover:bg-red-500/10 hover:text-red-500 disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-fg-5",children:h===D.id?i.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i.jsx(Cs,{className:"h-3 w-3"})})]},D.id)})})]})]})}function Yy(){const e=Pe(I=>I.repos),t=Pe(I=>I.activeRepoId),a=Pe(I=>I.setActiveRepo),r=Pe(I=>I.removeRepo),o=Pe(I=>I.loadRepos),[u,c]=T.useState(!1),[f,m]=T.useState(null),[h,b]=T.useState(null),[g,y]=T.useState(null),N=Gt(I=>I.addToast),[S,A]=T.useState(null),[C,v]=T.useState(null),D=T.useRef(null);T.useEffect(()=>{if(!C)return;const I=H=>{D.current&&!D.current.contains(H.target)&&v(null)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[C]);const R=async(I,H)=>{b(I);try{H?await D5(I):await M5(I),await o()}catch{}b(null)},L=async I=>{y(I);try{const H=await B5(I);await o();const $=H.alreadyUpToDate?"info":"success";N(H.summary,$,void 0,{persistent:!0})}catch(H){let $="拉取失败";if(H instanceof Ss)try{$=JSON.parse(H.message).error??H.message}catch{$=H.message}N($,"error",void 0,{persistent:!0})}y(null)};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-lg font-semibold text-fg",children:"仓库管理"}),i.jsx("p",{className:"mt-0.5 text-sm text-fg-4",children:"管理代码仓库,每个仓库对应一个独立的 Agent 运行环境"})]}),i.jsxs("button",{type:"button",onClick:()=>c(!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:[i.jsx(Ma,{className:"h-4 w-4"}),i.jsx("span",{className:"hidden md:inline",children:"添加仓库"})]})]}),e.length===0?i.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed border-line-hard py-16 text-center",children:[i.jsx("div",{className:"rounded-full bg-elevated p-3",children:i.jsx(Ma,{className:"h-6 w-6 text-fg-4"})}),i.jsx("p",{className:"text-sm font-medium text-fg-3",children:"暂无代码仓库"}),i.jsx("p",{className:"text-xs text-fg-5",children:"添加一个本地仓库开始使用"}),i.jsx("button",{type:"button",onClick:()=>c(!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:"添加仓库"})]}):i.jsx(i.Fragment,{children:i.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:e.map(I=>{const H=I.id===t;return i.jsxs("div",{className:ae("rounded-xl border p-4 transition-colors",H?"border-blue-500/40 bg-blue-500/5":"border-line"),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>a(I.id),className:"flex min-w-0 items-center gap-2 text-left",children:[H?i.jsx(Yr,{className:"h-4 w-4 shrink-0 text-blue-500"}):i.jsx(e3,{className:"h-4 w-4 shrink-0 text-fg-5"}),i.jsx("span",{className:ae("truncate font-medium",H?"text-fg":"text-fg-2"),children:I.name})]}),i.jsxs("span",{className:ae("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",I.running?"bg-emerald-500/10 text-emerald-600":"bg-fg-6/30 text-fg-4"),children:[i.jsx("span",{className:ae("h-1.5 w-1.5 rounded-full",I.running?"bg-emerald-500":"bg-fg-5")}),I.running?"运行中":"已停止"]})]}),i.jsxs("dl",{className:"mt-3 space-y-1 font-mono text-xs text-fg-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("dt",{className:"shrink-0 text-fg-5",children:"Git"}),i.jsx("dd",{className:"min-w-0 truncate",children:I.gitUrl})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("dt",{className:"shrink-0 text-fg-5",children:"路径"}),i.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx("span",{className:"truncate",children:I.localPath}),i.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(I.localPath),title:"复制路径",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:i.jsx(Sc,{className:"h-3 w-3"})})]})]}),I.running&&I.port&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("dt",{className:"shrink-0 text-fg-5",children:"直连"}),i.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsxs("a",{href:`http://127.0.0.1:${I.port}`,target:"_blank",rel:"noopener noreferrer",className:"truncate text-blue-500 hover:underline",children:["127.0.0.1:",I.port]}),i.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(`http://127.0.0.1:${I.port}`),title:"复制链接",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:i.jsx(Sc,{className:"h-3 w-3"})})]})]})]}),i.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void L(I.id),disabled:g===I.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:g===I.id?i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i.jsxs(i.Fragment,{children:[i.jsx(kA,{className:"h-3 w-3"}),"拉取"]})}),i.jsx("button",{type:"button",onClick:()=>void R(I.id,I.running),disabled:h===I.id,className:ae("flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border text-xs font-medium transition-colors disabled:opacity-50",I.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:h===I.id?i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):I.running?i.jsxs(i.Fragment,{children:[i.jsx(sh,{className:"h-3 w-3 fill-current"}),"停止"]}):i.jsxs(i.Fragment,{children:[i.jsx(Vh,{className:"h-3 w-3 fill-current"}),"启动"]})}),i.jsxs("div",{className:"relative",ref:C===I.id?D:void 0,children:[i.jsx("button",{type:"button",onClick:()=>v(C===I.id?null:I.id),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 hover:text-fg-2",children:i.jsx($h,{className:"h-4 w-4"})}),C===I.id&&i.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 min-w-[160px] overflow-hidden rounded-lg border border-line bg-elevated shadow-lg",children:[i.jsx("button",{type:"button",className:ae("flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-base/60",I.runtimeType==="claude-code"?"text-orange-500":"text-sky-500"),onClick:async()=>{v(null);const $=I.runtimeType==="claude-code"?"opencode":"claude-code";await z5(I.id,$),o()},children:I.runtimeType==="claude-code"?"Claude → OpenCode":"OpenCode → Claude"}),i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-base/60",onClick:async()=>{v(null),await F5(I.id,!I.worktreeEnabled),o()},children:[i.jsx(ko,{className:"h-3 w-3"}),i.jsx("span",{children:"Worktree"}),i.jsx("span",{className:ae("ml-auto text-[10px]",I.worktreeEnabled?"text-violet-500":"text-fg-5"),children:I.worktreeEnabled?"已开启":"已关闭"})]}),i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-base/60",onClick:()=>{v(null),A({id:I.id,name:I.name})},children:[i.jsx(Xc,{className:"h-3 w-3"}),"配置"]}),i.jsx("div",{className:"my-0.5 border-t border-line"}),i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-red-500 transition-colors hover:bg-red-500/10",onClick:()=>{v(null),m(I.id)},children:[i.jsx(Cs,{className:"h-3 w-3"}),"删除仓库"]})]})]})]}),f===I.id&&i.jsxs("div",{className:"mt-2 flex items-center justify-between rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2",children:[i.jsx("span",{className:"text-xs text-red-500",children:"确认删除此仓库?"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>{r(I.id),m(null)},className:"flex h-6 items-center gap-1 rounded border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10",children:[i.jsx(In,{className:"h-3 w-3"}),"确认"]}),i.jsx("button",{type:"button",onClick:()=>m(null),className:"flex h-6 items-center gap-1 rounded border border-line px-2 text-xs text-fg-4 transition-colors hover:bg-elevated",children:"取消"})]})]}),I.worktreeEnabled&&i.jsx(ZC,{repoId:I.id})]},I.id)})})}),i.jsxs("p",{className:"mt-3 text-xs text-fg-5",children:[e.length," 个仓库"]}),u&&i.jsx(QC,{onClose:()=>c(!1)}),S&&i.jsx(WC,{repoId:S.id,repoName:S.name,onClose:()=>A(null)})]})}function JC(){return i.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:i.jsx("div",{className:"mx-auto max-w-4xl",children:i.jsx(Yy,{})})})}const ew=new Set(["tool","tool-use","tool_use","tool-call","tool_call","tool-result","tool_result"]),tw=new Set(["thinking","reasoning","reason"]),nw=new Set(["text","output_text","message"]),aw=new Set(["file","image"]);function wc(e){var a;const t=((a=e.type)==null?void 0:a.toLowerCase())??"";return ew.has(t)||e.toolName!=null||e.tool!=null?"tool":aw.has(t)?"file":tw.has(t)?"thinking":nw.has(t)||e.content!=null||e.text!=null?"text":"other"}function kc(e){return e.content??e.text??""}function Gy(e){return e.toolName??e.tool??"tool"}function Zc(e){var t;return e.input??((t=e.state)==null?void 0:t.input)}function Zh(e){var t;return e.output??((t=e.state)==null?void 0:t.output)}function Jh(e){var a,r,o;const t=(r=(a=e.state)==null?void 0:a.status)==null?void 0:r.toLowerCase();return t==="completed"||t==="done"||t==="success"?"completed":t==="error"||t==="failed"||((o=e.state)==null?void 0:o.error)!=null?"error":t==="pending"||t==="queued"?"pending":t==="running"||t==="in_progress"?"running":Zh(e)!=null?"completed":"running"}function Hx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function $r(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 Ky(e){return e.filter(t=>$r(t.status)==="completed").length}function yo(e){const t=Gy(e).toLowerCase();return t==="question"||t==="mcp_question"}function sw(e){const t=Zc(e);if(!t||typeof t!="object")return null;const a=t;return Array.isArray(a.questions)?a.questions:null}function Rc(e){if(!yo(e))return!1;const t=Jh(e);return t==="pending"||t==="running"}const rw=/\bses_[a-zA-Z0-9]+/;function iw(e){var o;const t=Zc(e);if(t&&typeof t=="object"){const u=t;if(typeof u.task_id=="string"&&u.task_id.startsWith("ses_"))return u.task_id}const a=(o=e.state)==null?void 0:o.metadata;if(a){const u=a.session_id??a.sessionId;if(typeof u=="string"&&u.startsWith("ses_"))return u}const r=Zh(e);if(typeof r=="string"){const u=rw.exec(r);if(u)return u[0]}if(r&&typeof r=="object"){const u=r,c=u.session_id??u.sessionId??u.task_id;if(typeof c=="string"&&c.startsWith("ses_"))return c}return null}const lw=es(()=>({agents:[],loaded:!1}));function Vy(e){return`question-${e}`}function Sm(e,t){const a=t.find(o=>o.id===e),r=(a==null?void 0:a.title)||e.slice(-8);Gt.getState().addToast(`${r} — 等待回复`,"warning",e,{id:Vy(e),persistent:!0})}function ow(e){var t;for(const a of e)if((t=a.parts)!=null&&t.some(r=>yo(r)&&Rc(r)))return!0;return!1}const No=[],To=[],Fx=[],Ir={};function zx(e){return e.id??e.callID}function Rn(){return Pe.getState().activeRepoId}async function $x(e,t){const a=Rn();if(a)try{const[r,o]=await Promise.all([Z5(a,e),My(a).catch(()=>null)]);t(u=>{const c={sessionLinks:{...u.sessionLinks,[e]:r}};return o&&(c.allSessionLinks=o),c})}catch{}}const qx=20,Oe=es((e,t)=>({sessions:[],activeSessionId:null,messages:{},messagesMeta:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},sessionFilter:"active",loadingSessions:!1,loadError:null,sendError:null,setSessionFilter:a=>e({sessionFilter:a}),toggleSessionComplete:async a=>{const r=Rn();if(!r)return;const o=t().sessions.find(c=>c.id===a);if(!o)return;const u=o.completedAt?null:Date.now();e(c=>({sessions:c.sessions.map(f=>f.id===a?{...f,completedAt:u??void 0}:f)}));try{await wC(r,a,u)}catch{await t().loadSessions()}},loadSessions:async()=>{const a=Rn();if(!a){e({sessions:[],loadingSessions:!1});return}e({loadingSessions:!0,loadError:null});try{const[r,o]=await Promise.all([$5(a),My(a).catch(()=>null)]),u={sessions:r,loadingSessions:!1};o&&(u.allSessionLinks=o),e(u)}catch(r){e({loadingSessions:!1,loadError:r instanceof Error?r.message:"Failed to load sessions"})}},createSession:async(a,r,o,u,c,f,m)=>{const h=Rn();if(!h)return null;e({sendError:null});try{const b=await q5(h,a,r,o,u,c,f,m);return e(g=>({sessions:[b,...g.sessions.filter(y=>y.id!==b.id)],activeSessionId:b.id,messages:{...g.messages,[b.id]:[]}})),t().setSessionStatus(b.id,"busy"),c&&Gt.getState().addToast("已自动分配为处理人","success"),b}catch(b){return e({sendError:b instanceof Error?b.message:"Failed to create session"}),null}},setActiveSession:async a=>{Rn()&&(e({activeSessionId:a,sendError:null}),await t().refreshSessionData(a))},refreshSessionData:async a=>{var b,g;const r=Rn();if(!r)return;const u=!t().messages[a]||t().messages[a].length===0?{limit:qx}:void 0,[c,f]=await Promise.allSettled([J5(r,a),Ax(r,a,u)]),m=c.status==="fulfilled"?c.value:null,h=(g=(b=m==null?void 0:m.session)==null?void 0:b.revert)==null?void 0:g.messageID;e(y=>{const N={};if(m&&(m.status&&(N.sessionStatuses={...y.sessionStatuses,[a]:m.status.type}),m.todos&&(N.todos={...y.todos,[a]:m.todos}),m.links&&(N.sessionLinks={...y.sessionLinks,[a]:m.links}),m.session&&(N.sessions=y.sessions.map(S=>S.id===a?{...S,...m.session}:S))),f.status==="fulfilled"){let S=f.value.messages;if(h){const C=S.findIndex(v=>v.id===h);C>=0&&(S=S.slice(0,C+1))}const A=y.messages[a]??[];S.length>=A.length&&(N.messages={...y.messages,[a]:S}),N.messagesMeta={...y.messagesMeta,[a]:{total:Math.max(f.value.total,A.length),hasMore:f.value.hasMore,loading:!1}}}return N}),f.status==="fulfilled"&&ow(f.value.messages)&&Sm(a,t().sessions)},loadMoreMessages:async a=>{var f;const r=Rn();if(!r)return;const o=t().messagesMeta[a];if(!(o!=null&&o.hasMore)||o.loading)return;const c=(f=(t().messages[a]??[])[0])==null?void 0:f.id;e(m=>({messagesMeta:{...m.messagesMeta,[a]:{...o,loading:!0}}}));try{const m=await Ax(r,a,{limit:qx,before:c});e(h=>{const b=h.messages[a]??[];return{messages:{...h.messages,[a]:[...m.messages,...b]},messagesMeta:{...h.messagesMeta,[a]:{total:m.total,hasMore:m.hasMore,loading:!1}}}})}catch{e(m=>({messagesMeta:{...m.messagesMeta,[a]:{...o,loading:!1}}}))}},addLink:async(a,r,o)=>{const u=Rn();if(!u)return!1;try{return await eC(u,a,r,o),await $x(a,e),!0}catch{return!1}},removeLink:async(a,r,o)=>{const u=Rn();if(!u)return!1;try{return await tC(u,a,r,o),await $x(a,e),!0}catch{return!1}},deleteSession:async a=>{const r=Rn();if(r)try{await Y5(r,a)}catch{}delete Ir[a],e(o=>{const{[a]:u,...c}=o.messages,{[a]:f,...m}=o.messagesMeta,{[a]:h,...b}=o.todos,{[a]:g,...y}=o.sessionStatuses,{[a]:N,...S}=o.errorReasons,{[a]:A,...C}=o.queuedMessageIds,{[a]:v,...D}=o.sessionLinks,{[a]:R,...L}=o.allSessionLinks;return{sessions:o.sessions.filter(I=>I.id!==a),messages:c,messagesMeta:m,todos:b,sessionStatuses:y,errorReasons:S,queuedMessageIds:C,sessionLinks:D,allSessionLinks:L,activeSessionId:o.activeSessionId===a?null:o.activeSessionId}})},sendMessage:async(a,r,o,u)=>{const c=Rn(),f=t().activeSessionId;if(!c||!f)return!1;const m=t().sessions.find(b=>b.id===f),h=t().sessionStatuses[f]==="busy";e({sendError:null}),m!=null&&m.completedAt&&e(b=>({sessions:b.sessions.map(g=>g.id===f?{...g,completedAt:void 0}:g)})),h||t().setSessionStatus(f,"busy");try{const b=lw.getState(),g=m!=null&&m.agent&&b.loaded&&b.agents.some(y=>y.name===m.agent||y.id===m.agent)?m.agent:void 0;return await G5(c,f,a,g,r,o,u),h&&(Ir[f]=(Ir[f]||0)+1),!0}catch(b){return e({sendError:b instanceof Error?b.message:"Failed to send message"}),h||t().setSessionStatus(f,"idle"),!1}},replyQuestion:async a=>{const r=Rn(),o=t().activeSessionId;if(!(!r||!o))try{await V5(r,o,a)}catch(u){e({sendError:u instanceof Error?u.message:"Failed to reply to question"})}},rejectQuestion:async()=>{const a=Rn(),r=t().activeSessionId;if(!(!a||!r))try{await X5(a,r)}catch{}},abortSession:async()=>{const a=Rn(),r=t().activeSessionId;if(!(!a||!r)){try{await K5(a,r)}catch{}t().setSessionStatus(r,"idle")}},clearSessions:()=>{for(const a of Object.keys(Ir))delete Ir[a];e({sessions:[],activeSessionId:null,messages:{},messagesMeta:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},loadError:null,sendError:null})},updateMessage:(a,r)=>{var o;e(u=>{const c=u.messages[a]??[],f=c.findIndex(g=>g.id===r.id);let m,h=u.queuedMessageIds,b=u.messagesMeta;if(f>=0){const g={...c[f],...r};(!r.parts||r.parts.length===0)&&c[f].parts&&(g.parts=c[f].parts),m=[...c],m[f]=g}else{m=[...c,r];const g=b[a];g&&(b={...b,[a]:{...g,total:g.total+1}});const y=Ir[a]||0;if(r.role==="user"&&y>0){const N=[...h[a]??[]];N.push(r.id),h={...h,[a]:N},Ir[a]=y-1}else if(r.role==="assistant"){const N=h[a];N&&N.length>0&&(h={...h,[a]:N.slice(1)})}}return{messages:{...u.messages,[a]:m},messagesMeta:b,queuedMessageIds:h}}),(o=r.parts)!=null&&o.some(u=>yo(u)&&Rc(u))&&Sm(a,t().sessions)},updateMessagePart:(a,r,o)=>{e(u=>{const c=u.messages[a]??[],f=c.findIndex(S=>S.id===r),m=f>=0?c[f]:{id:r,role:"assistant"},h=m.parts?[...m.parts]:[],b=zx(o),g=b!=null?h.findIndex(S=>zx(S)===b):-1;g>=0?h[g]={...h[g],...o}:h.push(o);const y={...m,parts:h},N=f>=0?[...c]:[...c,y];return f>=0&&(N[f]=y),{messages:{...u.messages,[a]:N}}}),yo(o)&&Rc(o)&&Sm(a,t().sessions)},appendMessagePartDelta:(a,r,o,u)=>{e(c=>{const f=c.messages[a]??[],m=f.findIndex(S=>S.id===r),h=m>=0?f[m]:{id:r,role:"assistant"},b=h.parts?[...h.parts]:[],g=b.findIndex(S=>S.id===o);if(g>=0){const S=b[g],A=kc(S)+u;b[g]=S.content!=null?{...S,content:A}:{...S,text:A}}else b.push({id:o,type:"text",text:u});const y={...h,parts:b},N=m>=0?[...f]:[...f,y];return m>=0&&(N[m]=y),{messages:{...c.messages,[a]:N}}})},updateTodos:(a,r)=>{e(o=>({todos:{...o.todos,[a]:r}}))},updateSessionInfo:a=>{e(r=>r.sessions.some(u=>u.id===a.id)?{sessions:r.sessions.map(u=>u.id===a.id?{...u,...a}:u)}:{sessions:[a,...r.sessions]})},setSessionStatus:(a,r,o)=>{const u=t().sessionStatuses[a];if(u!==r){const c=t().sessions.find(m=>m.id===a),f=(c==null?void 0:c.title)||a.slice(-8);if(r==="idle"&&u!==void 0&&u!=="idle")Gt.getState().removeToast(Vy(a)),Gt.getState().addToast(`${f} — 完成`,"success",a);else if(r==="busy"&&(u===void 0||u==="idle"))Gt.getState().addToast(`${f} — 开始运行`,"info",a);else if(r==="retry")Gt.getState().addToast(`${f} — 进入重试`,"warning",a);else if(r==="error"){const m=o?`${f} — 错误: ${o}`:`${f} — 发生错误`;Gt.getState().addToast(m,"error",a)}}e(c=>{const f=o?{...c.errorReasons,[a]:o}:r!=="error"?(()=>{const{[a]:m,...h}=c.errorReasons;return h})():c.errorReasons;return{sessionStatuses:{...c.sessionStatuses,[a]:r},errorReasons:f}})},bulkSetStatuses:a=>{e({sessionStatuses:{...t().sessionStatuses,...a}})},renameSession:async(a,r)=>{const o=Rn();if(o){e(u=>({sessions:u.sessions.map(c=>c.id===a?{...c,title:r}:c)}));try{await CC(o,a,r)}catch{await t().loadSessions()}}},revertToMessage:async(a,r)=>{const o=Rn();if(!o)return!1;try{return await Q5(o,a,r),await t().refreshSessionData(a),!0}catch{return!1}}})),Ve=es((e,t)=>({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,syncing:!1,selectedIssueId:null,viewingIssueId:null,viewingTreeRootId:null,matchingParentId:null,matchingCandidateId:null,clearIssues:()=>e({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,selectedIssueId:null,viewingIssueId:null,viewingTreeRootId:null,matchingParentId:null,matchingCandidateId:null}),setSelectedIssue:a=>e({selectedIssueId:a}),setViewingIssue:(a,r)=>e({viewingIssueId:a,viewingTreeRootId:r??null}),enterMatchMode:a=>e({matchingParentId:a,matchingCandidateId:null}),exitMatchMode:()=>{e({matchingParentId:null,matchingCandidateId:null})},linkChild:async(a,r)=>{var u;const o=Pe.getState().activeRepoId;if(!o)return!1;try{await pC(o,a,r);const c=(u=t().issues.find(f=>f.number===a))==null?void 0:u.id;return c&&e(f=>({issues:f.issues.map(m=>m.number===r?{...m,parentId:c}:m),matchingCandidateId:null})),!0}catch{return!1}},updateIssueState:async(a,r)=>{const o=Pe.getState().activeRepoId;if(!o)return!1;try{const u=await Uy(o,a,{state:r});return e(c=>({issues:c.issues.map(f=>f.number===a?{...f,state:u.state}:f)})),!0}catch{return!1}},loadIssues:async()=>{const a=Pe.getState().activeRepoId;if(!a){e({issues:[],loaded:!0});return}try{const r=await Ox(a,"all");e({issues:r,loaded:!0})}catch{e({loaded:!0})}},syncIssues:async()=>{const a=Pe.getState().activeRepoId;if(a){e({syncing:!0});try{await mC(a,"open");const[r,o,u]=await Promise.all([Ox(a,"all"),kx(a),Rx(a)]);e({issues:r,tags:o,milestones:u,syncing:!1})}catch(r){e({syncing:!1});let o="同步 Issue 失败";if(r instanceof Ss)try{const u=JSON.parse(r.message);u.error&&(o=u.error)}catch{r.message&&(o=r.message)}Gt.getState().addToast(o,"error")}}},createIssue:async(a,r)=>{const o=Pe.getState().activeRepoId;if(!o)return null;try{const u=await hC(o,a,r);return e(c=>({issues:[u,...c.issues]})),u}catch{return null}},loadTags:async()=>{const a=Pe.getState().activeRepoId;if(!a){e({tags:[]});return}try{const r=await kx(a);e({tags:r})}catch{}},cycleTagFilter:a=>{e(r=>{const o=new Map(r.tagFilterMode),u=o.get(a);return u?u==="include"?o.set(a,"exclude"):o.delete(a):o.set(a,"include"),{tagFilterMode:o}})},clearTagFilter:()=>e({tagFilterMode:new Map}),loadMilestones:async()=>{const a=Pe.getState().activeRepoId;if(!a){e({milestones:[]});return}try{const r=await Rx(a);e({milestones:r})}catch{}},setMilestoneFilter:a=>e({selectedMilestoneId:a})})),xc=es(e=>({drafts:{},setDraft:(t,a)=>e(r=>{if(!a.trim()){const{[t]:o,...u}=r.drafts;return{drafts:u}}return{drafts:{...r.drafts,[t]:a}}}),clearDraft:t=>e(a=>{const{[t]:r,...o}=a.drafts;return{drafts:o}})}));function Yx(e){const t=[],a=String(e||"");let r=a.indexOf(","),o=0,u=!1;for(;!u;){r===-1&&(r=a.length,u=!0);const c=a.slice(o,r).trim();(c||!u)&&t.push(c),o=r+1,r=a.indexOf(",",o)}return t}function Xy(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const uw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dw={};function Gx(e,t){return(dw.jsx?cw:uw).test(e)}const fw=/[ \t\n\f\r]/g;function mw(e){return typeof e=="object"?e.type==="text"?Kx(e.value):!1:Kx(e)}function Kx(e){return e.replace(fw,"")===""}class Io{constructor(t,a,r){this.normal=a,this.property=t,r&&(this.space=r)}}Io.prototype.normal={};Io.prototype.property={};Io.prototype.space=void 0;function Qy(e,t){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Io(a,r,t)}function _o(e){return e.toLowerCase()}class ra{constructor(t,a){this.attribute=a,this.property=t}}ra.prototype.attribute="";ra.prototype.booleanish=!1;ra.prototype.boolean=!1;ra.prototype.commaOrSpaceSeparated=!1;ra.prototype.commaSeparated=!1;ra.prototype.defined=!1;ra.prototype.mustUseProperty=!1;ra.prototype.number=!1;ra.prototype.overloadedBoolean=!1;ra.prototype.property="";ra.prototype.spaceSeparated=!1;ra.prototype.space=void 0;let hw=0;const Xe=Gr(),on=Gr(),dh=Gr(),ve=Gr(),Rt=Gr(),Ur=Gr(),ga=Gr();function Gr(){return 2**++hw}const fh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:on,commaOrSpaceSeparated:ga,commaSeparated:Ur,number:ve,overloadedBoolean:dh,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Am=Object.keys(fh);class ep extends ra{constructor(t,a,r,o){let u=-1;if(super(t,a),Vx(this,"space",o),typeof r=="number")for(;++u<Am.length;){const c=Am[u];Vx(this,Am[u],(r&fh[c])===fh[c])}}}ep.prototype.defined=!0;function Vx(e,t,a){a&&(e[t]=a)}function Zi(e){const t={},a={};for(const[r,o]of Object.entries(e.properties)){const u=new ep(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(u.mustUseProperty=!0),t[r]=u,a[_o(r)]=r,a[_o(u.attribute)]=r}return new Io(t,a,e.space)}const Wy=Zi({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Rt,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:ve,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Rt,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:on,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Zy(e,t){return t in e?e[t]:t}function Jy(e,t){return Zy(e,t.toLowerCase())}const pw=Zi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ur,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alpha:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:Rt,autoFocus:Xe,autoPlay:Xe,blocking:Rt,capture:null,charSet:null,checked:Xe,cite:null,className:Rt,closedBy:null,colorSpace:null,cols:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:on,controls:Xe,controlsList:Rt,coords:ve|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:dh,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:ve,hidden:dh,high:ve,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Xe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,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:Xe,optimum:ve,pattern:null,ping:Rt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:Rt,required:Xe,reversed:Xe,rows:ve,rowSpan:ve,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootCustomElementRegistry:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shadowRootSerializable:Xe,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:on,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Xe,disablePictureInPicture:Xe,disableRemotePlayback:Xe,exportParts:Ur,part:Rt,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:Jy}),gw=Zi({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:ga,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:Rt,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:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,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:Ur,g2:Ur,glyphName:Ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:ga,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ga,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ga,rev:ga,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ga,requiredFeatures:ga,requiredFonts:ga,requiredFormats:ga,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:ga,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ga,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ga,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Zy}),eN=Zi({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()}}),tN=Zi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jy}),nN=Zi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),bw={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"},xw=/[A-Z]/g,Xx=/-[a-z]/g,Ew=/^data[-\w.:]+$/i;function Jc(e,t){const a=_o(t);let r=t,o=ra;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&Ew.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(Xx,Nw);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!Xx.test(u)){let c=u.replace(xw,yw);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=ep}return new o(r,t)}function yw(e){return"-"+e.toLowerCase()}function Nw(e){return e.charAt(1).toUpperCase()}const Mo=Qy([Wy,pw,eN,tN,nN],"html"),ur=Qy([Wy,gw,eN,tN,nN],"svg");function Qx(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function aN(e){return e.join(" ").trim()}var Di={},Cm,Wx;function Tw(){if(Wx)return Cm;Wx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
463
463
|
`,h="/",b="*",g="",y="comment",N="declaration";function S(C,v){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];v=v||{};var D=1,R=1;function L(te){var G=te.match(t);G&&(D+=G.length);var q=te.lastIndexOf(m);R=~q?te.length-q:R+te.length}function I(){var te={line:D,column:R};return function(G){return G.position=new H(te),K(),G}}function H(te){this.start=te,this.end={line:D,column:R},this.source=v.source}H.prototype.content=C;function $(te){var G=new Error(v.source+":"+D+":"+R+": "+te);if(G.reason=te,G.filename=v.source,G.line=D,G.column=R,G.source=C,!v.silent)throw G}function W(te){var G=te.exec(C);if(G){var q=G[0];return L(q),C=C.slice(q.length),G}}function K(){W(a)}function B(te){var G;for(te=te||[];G=ne();)G!==!1&&te.push(G);return te}function ne(){var te=I();if(!(h!=C.charAt(0)||b!=C.charAt(1))){for(var G=2;g!=C.charAt(G)&&(b!=C.charAt(G)||h!=C.charAt(G+1));)++G;if(G+=2,g===C.charAt(G-1))return $("End of comment missing");var q=C.slice(2,G-2);return R+=2,L(q),C=C.slice(G),R+=2,te({type:y,comment:q})}}function ie(){var te=I(),G=W(r);if(G){if(ne(),!W(o))return $("property missing ':'");var q=W(u),M=te({type:N,property:A(G[0].replace(e,g)),value:q?A(q[0].replace(e,g)):g});return W(c),M}}function be(){var te=[];B(te);for(var G;G=ie();)G!==!1&&(te.push(G),B(te));return te}return K(),be()}function A(C){return C?C.replace(f,g):g}return Cm=S,Cm}var Zx;function _w(){if(Zx)return Di;Zx=1;var e=Di&&Di.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Di,"__esModule",{value:!0}),Di.default=a;const t=e(Tw());function a(r,o){let u=null;if(!r||typeof r!="string")return u;const c=(0,t.default)(r),f=typeof o=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:b}=m;f?o(h,b,m):b&&(u=u||{},u[h]=b)}),u}return Di}var Jl={},Jx;function vw(){if(Jx)return Jl;Jx=1,Object.defineProperty(Jl,"__esModule",{value:!0}),Jl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||a.test(h)||e.test(h)},c=function(h,b){return b.toUpperCase()},f=function(h,b){return"".concat(b,"-")},m=function(h,b){return b===void 0&&(b={}),u(h)?h:(h=h.toLowerCase(),b.reactCompat?h=h.replace(o,f):h=h.replace(r,f),h.replace(t,c))};return Jl.camelCase=m,Jl}var eo,e1;function Sw(){if(e1)return eo;e1=1;var e=eo&&eo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(_w()),a=vw();function r(o,u){var c={};return!o||typeof o!="string"||(0,t.default)(o,function(f,m){f&&m&&(c[(0,a.camelCase)(f,u)]=m)}),c}return r.default=r,eo=r,eo}var Aw=Sw();const Cw=zc(Aw),ed=sN("end"),ts=sN("start");function sN(e){return t;function t(a){const r=a&&a.position&&a.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ww(e){const t=ts(e),a=ed(e);if(t&&a)return{start:t,end:a}}function oo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?t1(e.position):"start"in e||"end"in e?t1(e):"line"in e||"column"in e?mh(e):""}function mh(e){return n1(e&&e.line)+":"+n1(e&&e.column)}function t1(e){return mh(e&&e.start)+"-"+mh(e&&e.end)}function n1(e){return e&&typeof e=="number"?e:1}class Mn extends Error{constructor(t,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let o="",u={},c=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof t=="string"?o=t:!u.cause&&t&&(c=!0,o=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof r=="string"){const m=r.indexOf(":");m===-1?u.ruleId=r:(u.source=r.slice(0,m),u.ruleId=r.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=oo(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Mn.prototype.file="";Mn.prototype.name="";Mn.prototype.reason="";Mn.prototype.message="";Mn.prototype.stack="";Mn.prototype.column=void 0;Mn.prototype.line=void 0;Mn.prototype.ancestors=void 0;Mn.prototype.cause=void 0;Mn.prototype.fatal=void 0;Mn.prototype.place=void 0;Mn.prototype.ruleId=void 0;Mn.prototype.source=void 0;const tp={}.hasOwnProperty,kw=new Map,Rw=/[A-Z]/g,Ow=new Set(["table","tbody","thead","tfoot","tr"]),Iw=new Set(["td","th"]),rN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Mw(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Fw(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");r=Hw(a,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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"?ur:Mo,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=iN(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function iN(e,t,a){if(t.type==="element")return Dw(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Lw(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Bw(e,t,a);if(t.type==="mdxjsEsm")return jw(e,t);if(t.type==="root")return Pw(e,t,a);if(t.type==="text")return Uw(e,t)}function Dw(e,t,a){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ur,e.schema=o),e.ancestors.push(t);const u=oN(e,t.tagName,!1),c=zw(e,t);let f=ap(e,t);return Ow.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!mw(m):!0})),lN(e,c,u,t),np(c,f),e.ancestors.pop(),e.schema=r,e.create(t,u,c,a)}function Lw(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}vo(e,t.position)}function jw(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vo(e,t.position)}function Bw(e,t,a){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ur,e.schema=o),e.ancestors.push(t);const u=t.name===null?e.Fragment:oN(e,t.name,!0),c=$w(e,t),f=ap(e,t);return lN(e,c,u,t),np(c,f),e.ancestors.pop(),e.schema=r,e.create(t,u,c,a)}function Pw(e,t,a){const r={};return np(r,ap(e,t)),e.create(t,e.Fragment,r,a)}function Uw(e,t){return t.value}function lN(e,t,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=r)}function np(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function Hw(e,t,a){return r;function r(o,u,c,f){const h=Array.isArray(c.children)?a:t;return f?h(u,c,f):h(u,c)}}function Fw(e,t){return a;function a(r,o,u,c){const f=Array.isArray(u.children),m=ts(r);return t(o,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function zw(e,t){const a={};let r,o;for(o in t.properties)if(o!=="children"&&tp.call(t.properties,o)){const u=qw(e,o,t.properties[o]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&Iw.has(t.tagName)?r=f:a[c]=f}}if(r){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function $w(e,t){const a={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const u=r.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else vo(e,t.position);else{const o=r.name;let u;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const f=r.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else vo(e,t.position);else u=r.value===null?!0:r.value;a[o]=u}return a}function ap(e,t){const a=[];let r=-1;const o=e.passKeys?new Map:kw;for(;++r<t.children.length;){const u=t.children[r];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=o.get(m)||0;c=m+"-"+h,o.set(m,h+1)}}const f=iN(e,u,c);f!==void 0&&a.push(f)}return a}function qw(e,t,a){const r=Jc(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=r.commaSeparated?Xy(a):aN(a)),r.property==="style"){let o=typeof a=="object"?a:Yw(e,String(a));return e.stylePropertyNameCase==="css"&&(o=Gw(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?bw[r.property]||r.property:r.attribute,a]}}function Yw(e,t){try{return Cw(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const r=a,o=new Mn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=rN+"#cannot-parse-style-attribute",o}}function oN(e,t,a){let r;if(!a)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let u=-1,c;for(;++u<o.length;){const f=Gx(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}r=c}else r=Gx(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return tp.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);vo(e)}function vo(e,t){const a=new Mn("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=rN+"#cannot-handle-mdx-estrees-without-createevaluater",a}function Gw(e){const t={};let a;for(a in e)tp.call(e,a)&&(t[Kw(a)]=e[a]);return t}function Kw(e){let t=e.replace(Rw,Vw);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Vw(e){return"-"+e.toLowerCase()}const wm={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"]},Xw={};function sp(e,t){const a=Xw,r=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return uN(e,r,o)}function uN(e,t,a){if(Qw(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 a1(e.children,t,a)}return Array.isArray(e)?a1(e,t,a):""}function a1(e,t,a){const r=[];let o=-1;for(;++o<e.length;)r[o]=uN(e[o],t,a);return r.join("")}function Qw(e){return!!(e&&typeof e=="object")}const s1=document.createElement("i");function rp(e){const t="&"+e+";";s1.innerHTML=t;const a=s1.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===t?!1:a}function xa(e,t,a,r){const o=e.length;let u=0,c;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,a=a>0?a:0,r.length<1e4)c=Array.from(r),c.unshift(t,a),e.splice(...c);else for(a&&e.splice(t,a);u<r.length;)c=r.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function Ra(e,t){return e.length>0?(xa(e,e.length,0,t),e):t}const r1={}.hasOwnProperty;function cN(e){const t={};let a=-1;for(;++a<e.length;)Ww(t,e[a]);return t}function Ww(e,t){let a;for(a in t){const o=(r1.call(e,a)?e[a]:void 0)||(e[a]={}),u=t[a];let c;if(u)for(c in u){r1.call(o,c)||(o[c]=[]);const f=u[c];Zw(o[c],Array.isArray(f)?f:f?[f]:[])}}}function Zw(e,t){let a=-1;const r=[];for(;++a<t.length;)(t[a].add==="after"?e:r).push(t[a]);xa(e,0,0,r)}function dN(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 Fa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=cr(/[A-Za-z]/),On=cr(/[\dA-Za-z]/),Jw=cr(/[#-'*+\--9=?A-Z^-~]/);function Oc(e){return e!==null&&(e<32||e===127)}const hh=cr(/\d/),ek=cr(/[\dA-Fa-f]/),tk=cr(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Ot(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const td=cr(new RegExp("\\p{P}|\\p{S}","u")),qr=cr(/\s/);function cr(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Ji(e){const t=[];let a=-1,r=0,o=0;for(;++a<e.length;){const u=e.charCodeAt(a);let c="";if(u===37&&On(e.charCodeAt(a+1))&&On(e.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(a+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),o=1):c="�"}else c=String.fromCharCode(u);c&&(t.push(e.slice(r,a),encodeURIComponent(c)),r=a+o+1,c=""),o&&(a+=o,o=0)}return t.join("")+e.slice(r)}function ht(e,t,a,r){const o=r?r-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return it(m)?(e.enter(a),f(m)):t(m)}function f(m){return it(m)&&u++<o?(e.consume(m),f):(e.exit(a),t(m))}}const nk={tokenize:ak};function ak(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let a;return t;function r(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ht(e,t,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=m),a=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const sk={tokenize:rk},i1={tokenize:ik};function rk(e){const t=this,a=[];let r=0,o,u,c;return f;function f(R){if(r<a.length){const L=a[r];return t.containerState=L[1],e.attempt(L[0].continuation,m,h)(R)}return h(R)}function m(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&D();const L=t.events.length;let I=L,H;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){H=t.events[I][1].end;break}v(r);let $=L;for(;$<t.events.length;)t.events[$][1].end={...H},$++;return xa(t.events,I+1,0,t.events.slice(L)),t.events.length=$,h(R)}return f(R)}function h(R){if(r===a.length){if(!o)return y(R);if(o.currentConstruct&&o.currentConstruct.concrete)return S(R);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(i1,b,g)(R)}function b(R){return o&&D(),v(r),y(R)}function g(R){return t.parser.lazy[t.now().line]=r!==a.length,c=t.now().offset,S(R)}function y(R){return t.containerState={},e.attempt(i1,N,S)(R)}function N(R){return r++,a.push([t.currentConstruct,t.containerState]),y(R)}function S(R){if(R===null){o&&D(),v(0),e.consume(R);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),A(R)}function A(R){if(R===null){C(e.exit("chunkFlow"),!0),v(0),e.consume(R);return}return Fe(R)?(e.consume(R),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(R),A)}function C(R,L){const I=t.sliceStream(R);if(L&&I.push(null),R.previous=u,u&&(u.next=R),u=R,o.defineSkip(R.start),o.write(I),t.parser.lazy[R.start.line]){let H=o.events.length;for(;H--;)if(o.events[H][1].start.offset<c&&(!o.events[H][1].end||o.events[H][1].end.offset>c))return;const $=t.events.length;let W=$,K,B;for(;W--;)if(t.events[W][0]==="exit"&&t.events[W][1].type==="chunkFlow"){if(K){B=t.events[W][1].end;break}K=!0}for(v(r),H=$;H<t.events.length;)t.events[H][1].end={...B},H++;xa(t.events,W+1,0,t.events.slice($)),t.events.length=H}}function v(R){let L=a.length;for(;L-- >R;){const I=a[L];t.containerState=I[1],I[0].exit.call(t,e)}a.length=R}function D(){o.write([null]),u=void 0,o=void 0,t.containerState._closeFlow=void 0}}function ik(e,t,a){return ht(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $i(e){if(e===null||Ot(e)||qr(e))return 1;if(td(e))return 2}function nd(e,t,a){const r=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!r.includes(u)&&(t=u(t,a),r.push(u))}return t}const ph={name:"attention",resolveAll:lk,tokenize:ok};function lk(e,t){let a=-1,r,o,u,c,f,m,h,b;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(r=a;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[r][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;m=e[r][1].end.offset-e[r][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const g={...e[r][1].end},y={...e[a][1].start};l1(g,-m),l1(y,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:y},u={type:m>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[a][1].start}},o={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[r][1].end={...c.start},e[a][1].start={...f.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=Ra(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Ra(h,[["enter",o,t],["enter",c,t],["exit",c,t],["enter",u,t]]),h=Ra(h,nd(t.parser.constructs.insideSpan.null,e.slice(r+1,a),t)),h=Ra(h,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",o,t]]),e[a][1].end.offset-e[a][1].start.offset?(b=2,h=Ra(h,[["enter",e[a][1],t],["exit",e[a][1],t]])):b=0,xa(e,r-1,a-r+3,h),a=r+h.length-b-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function ok(e,t){const a=this.parser.constructs.attentionMarkers.null,r=this.previous,o=$i(r);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const h=e.exit("attentionSequence"),b=$i(m),g=!b||b===2&&o||a.includes(m),y=!o||o===2&&b||a.includes(r);return h._open=!!(u===42?g:g&&(o||!y)),h._close=!!(u===42?y:y&&(b||!g)),t(m)}}function l1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const uk={name:"autolink",tokenize:ck};function ck(e,t,a){let r=0;return o;function o(N){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(N),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(N){return Fn(N)?(e.consume(N),c):N===64?a(N):h(N)}function c(N){return N===43||N===45||N===46||On(N)?(r=1,f(N)):h(N)}function f(N){return N===58?(e.consume(N),r=0,m):(N===43||N===45||N===46||On(N))&&r++<32?(e.consume(N),f):(r=0,h(N))}function m(N){return N===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(N),e.exit("autolinkMarker"),e.exit("autolink"),t):N===null||N===32||N===60||Oc(N)?a(N):(e.consume(N),m)}function h(N){return N===64?(e.consume(N),b):Jw(N)?(e.consume(N),h):a(N)}function b(N){return On(N)?g(N):a(N)}function g(N){return N===46?(e.consume(N),r=0,b):N===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(N),e.exit("autolinkMarker"),e.exit("autolink"),t):y(N)}function y(N){if((N===45||On(N))&&r++<63){const S=N===45?y:g;return e.consume(N),S}return a(N)}}const Do={partial:!0,tokenize:dk};function dk(e,t,a){return r;function r(u){return it(u)?ht(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Fe(u)?t(u):a(u)}}const fN={continuation:{tokenize:mk},exit:hk,name:"blockQuote",tokenize:fk};function fk(e,t,a){const r=this;return o;function o(c){if(c===62){const f=r.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return a(c)}function u(c){return it(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function mk(e,t,a){const r=this;return o;function o(c){return it(c)?ht(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(fN,t,a)(c)}}function hk(e){e.exit("blockQuote")}const mN={name:"characterEscape",tokenize:pk};function pk(e,t,a){return r;function r(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return tk(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(u)}}const hN={name:"characterReference",tokenize:gk};function gk(e,t,a){const r=this;let o=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,c=On,b(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=ek,b):(e.enter("characterReferenceValue"),u=7,c=hh,b(g))}function b(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===On&&!rp(r.sliceSerialize(y))?a(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&o++<u?(e.consume(g),b):a(g)}}const o1={partial:!0,tokenize:xk},u1={concrete:!0,name:"codeFenced",tokenize:bk};function bk(e,t,a){const r=this,o={partial:!0,tokenize:I};let u=0,c=0,f;return m;function m(H){return h(H)}function h(H){const $=r.events[r.events.length-1];return u=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,f=H,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(H)}function b(H){return H===f?(c++,e.consume(H),b):c<3?a(H):(e.exit("codeFencedFenceSequence"),it(H)?ht(e,g,"whitespace")(H):g(H))}function g(H){return H===null||Fe(H)?(e.exit("codeFencedFence"),r.interrupt?t(H):e.check(o1,A,L)(H)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(H))}function y(H){return H===null||Fe(H)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(H)):it(H)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ht(e,N,"whitespace")(H)):H===96&&H===f?a(H):(e.consume(H),y)}function N(H){return H===null||Fe(H)?g(H):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(H))}function S(H){return H===null||Fe(H)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(H)):H===96&&H===f?a(H):(e.consume(H),S)}function A(H){return e.attempt(o,L,C)(H)}function C(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),v}function v(H){return u>0&&it(H)?ht(e,D,"linePrefix",u+1)(H):D(H)}function D(H){return H===null||Fe(H)?e.check(o1,A,L)(H):(e.enter("codeFlowValue"),R(H))}function R(H){return H===null||Fe(H)?(e.exit("codeFlowValue"),D(H)):(e.consume(H),R)}function L(H){return e.exit("codeFenced"),t(H)}function I(H,$,W){let K=0;return B;function B(G){return H.enter("lineEnding"),H.consume(G),H.exit("lineEnding"),ne}function ne(G){return H.enter("codeFencedFence"),it(G)?ht(H,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):ie(G)}function ie(G){return G===f?(H.enter("codeFencedFenceSequence"),be(G)):W(G)}function be(G){return G===f?(K++,H.consume(G),be):K>=c?(H.exit("codeFencedFenceSequence"),it(G)?ht(H,te,"whitespace")(G):te(G)):W(G)}function te(G){return G===null||Fe(G)?(H.exit("codeFencedFence"),$(G)):W(G)}}}function xk(e,t,a){const r=this;return o;function o(c){return c===null?a(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return r.parser.lazy[r.now().line]?a(c):t(c)}}const km={name:"codeIndented",tokenize:yk},Ek={partial:!0,tokenize:Nk};function yk(e,t,a){const r=this;return o;function o(h){return e.enter("codeIndented"),ht(e,u,"linePrefix",5)(h)}function u(h){const b=r.events[r.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(h):a(h)}function c(h){return h===null?m(h):Fe(h)?e.attempt(Ek,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Fe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function Nk(e,t,a){const r=this;return o;function o(c){return r.parser.lazy[r.now().line]?a(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):ht(e,u,"linePrefix",5)(c)}function u(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Fe(c)?o(c):a(c)}}const Tk={name:"codeText",previous:vk,resolve:_k,tokenize:Sk};function _k(e){let t=e.length-4,a=3,r,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=a;++r<t;)if(e[r][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(r=a-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function vk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Sk(e,t,a){let r=0,o,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),r++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?a(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),o=0,b(g)):Fe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Fe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function b(g){return g===96?(e.consume(g),o++,b):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",h(g))}}class Ak{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 r=a??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,a,r){const o=a||0;this.setCursor(Math.trunc(t));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&to(this.left,r),u.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),to(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),to(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);to(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);to(this.left,a.reverse())}}}function to(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 pN(e){const t={};let a=-1,r,o,u,c,f,m,h;const b=new Ak(e);for(;++a<b.length;){for(;a in t;)a=t[a];if(r=b.get(a),a&&r[1].type==="chunkFlow"&&b.get(a-1)[1].type==="listItemPrefix"&&(m=r[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Ck(b,a)),a=t[a],h=!0);else if(r[1]._container){for(u=a,o=void 0;u--;)if(c=b.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(o&&(b.get(o)[1].type="lineEndingBlank"),c[1].type="lineEnding",o=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;o&&(r[1].end={...b.get(o)[1].start},f=b.slice(o,a),f.unshift(r),b.splice(o,a-o+1,f))}}return xa(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!h}function Ck(e,t){const a=e.get(t)[1],r=e.get(t)[2];let o=t-1;const u=[];let c=a._tokenizer;c||(c=r.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let b,g,y=-1,N=a,S=0,A=0;const C=[A];for(;N;){for(;e.get(++o)[1]!==N;);u.push(o),N._tokenizer||(b=r.sliceStream(N),N.next||b.push(null),g&&c.defineSkip(N.start),N._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),N._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=N,N=N.next}for(N=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&&(A=y+1,C.push(A),N._tokenizer=void 0,N.previous=void 0,N=N.next);for(c.events=[],N?(N._tokenizer=void 0,N.previous=void 0):C.pop(),y=C.length;y--;){const v=f.slice(C[y],C[y+1]),D=u.pop();m.push([D,D+v.length-1]),e.splice(D,2,v)}for(m.reverse(),y=-1;++y<m.length;)h[S+m[y][0]]=S+m[y][1],S+=m[y][1]-m[y][0]-1;return h}const wk={resolve:Rk,tokenize:Ok},kk={partial:!0,tokenize:Ik};function Rk(e){return pN(e),e}function Ok(e,t){let a;return r;function r(f){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):Fe(f)?e.check(kk,c,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function Ik(e,t,a){const r=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ht(e,u,"linePrefix")}function u(c){if(c===null||Fe(c))return a(c);const f=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(r.parser.constructs.flow,a,t)(c)}}function gN(e,t,a,r,o,u,c,f,m){const h=m||Number.POSITIVE_INFINITY;let b=0;return g;function g(v){return v===60?(e.enter(r),e.enter(o),e.enter(u),e.consume(v),e.exit(u),y):v===null||v===32||v===41||Oc(v)?a(v):(e.enter(r),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),A(v))}function y(v){return v===62?(e.enter(u),e.consume(v),e.exit(u),e.exit(o),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),N(v))}function N(v){return v===62?(e.exit("chunkString"),e.exit(f),y(v)):v===null||v===60||Fe(v)?a(v):(e.consume(v),v===92?S:N)}function S(v){return v===60||v===62||v===92?(e.consume(v),N):N(v)}function A(v){return!b&&(v===null||v===41||Ot(v))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(r),t(v)):b<h&&v===40?(e.consume(v),b++,A):v===41?(e.consume(v),b--,A):v===null||v===32||v===40||Oc(v)?a(v):(e.consume(v),v===92?C:A)}function C(v){return v===40||v===41||v===92?(e.consume(v),A):A(v)}}function bN(e,t,a,r,o,u){const c=this;let f=0,m;return h;function h(N){return e.enter(r),e.enter(o),e.consume(N),e.exit(o),e.enter(u),b}function b(N){return f>999||N===null||N===91||N===93&&!m||N===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?a(N):N===93?(e.exit(u),e.enter(o),e.consume(N),e.exit(o),e.exit(r),t):Fe(N)?(e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(N))}function g(N){return N===null||N===91||N===93||Fe(N)||f++>999?(e.exit("chunkString"),b(N)):(e.consume(N),m||(m=!it(N)),N===92?y:g)}function y(N){return N===91||N===92||N===93?(e.consume(N),f++,g):g(N)}}function xN(e,t,a,r,o,u){let c;return f;function f(y){return y===34||y===39||y===40?(e.enter(r),e.enter(o),e.consume(y),e.exit(o),c=y===40?41:y,m):a(y)}function m(y){return y===c?(e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):(e.enter(u),h(y))}function h(y){return y===c?(e.exit(u),m(c)):y===null?a(y):Fe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ht(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(y))}function b(y){return y===c||y===null||Fe(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?g:b)}function g(y){return y===c||y===92?(e.consume(y),b):b(y)}}function uo(e,t){let a;return r;function r(o){return Fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,r):it(o)?ht(e,r,a?"linePrefix":"lineSuffix")(o):t(o)}}const Mk={name:"definition",tokenize:Lk},Dk={partial:!0,tokenize:jk};function Lk(e,t,a){const r=this;let o;return u;function u(N){return e.enter("definition"),c(N)}function c(N){return bN.call(r,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(N)}function f(N){return o=Fa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),m):a(N)}function m(N){return Ot(N)?uo(e,h)(N):h(N)}function h(N){return gN(e,b,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(N)}function b(N){return e.attempt(Dk,g,g)(N)}function g(N){return it(N)?ht(e,y,"whitespace")(N):y(N)}function y(N){return N===null||Fe(N)?(e.exit("definition"),r.parser.defined.push(o),t(N)):a(N)}}function jk(e,t,a){return r;function r(f){return Ot(f)?uo(e,o)(f):a(f)}function o(f){return xN(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return it(f)?ht(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):a(f)}}const Bk={name:"hardBreakEscape",tokenize:Pk};function Pk(e,t,a){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return Fe(u)?(e.exit("hardBreakEscape"),t(u)):a(u)}}const Uk={name:"headingAtx",resolve:Hk,tokenize:Fk};function Hk(e,t){let a=e.length-2,r=3,o,u;return e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},u={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"},xa(e,r,a-r+1,[["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t]])),e}function Fk(e,t,a){let r=0;return o;function o(b){return e.enter("atxHeading"),u(b)}function u(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&r++<6?(e.consume(b),c):b===null||Ot(b)?(e.exit("atxHeadingSequence"),f(b)):a(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),m(b)):b===null||Fe(b)?(e.exit("atxHeading"),t(b)):it(b)?ht(e,f,"whitespace")(b):(e.enter("atxHeadingText"),h(b))}function m(b){return b===35?(e.consume(b),m):(e.exit("atxHeadingSequence"),f(b))}function h(b){return b===null||b===35||Ot(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),h)}}const zk=["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"],c1=["pre","script","style","textarea"],$k={concrete:!0,name:"htmlFlow",resolveTo:Gk,tokenize:Kk},qk={partial:!0,tokenize:Xk},Yk={partial:!0,tokenize:Vk};function Gk(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 Kk(e,t,a){const r=this;let o,u,c,f,m;return h;function h(w){return b(w)}function b(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),g}function g(w){return w===33?(e.consume(w),y):w===47?(e.consume(w),u=!0,A):w===63?(e.consume(w),o=3,r.interrupt?t:k):Fn(w)?(e.consume(w),c=String.fromCharCode(w),C):a(w)}function y(w){return w===45?(e.consume(w),o=2,N):w===91?(e.consume(w),o=5,f=0,S):Fn(w)?(e.consume(w),o=4,r.interrupt?t:k):a(w)}function N(w){return w===45?(e.consume(w),r.interrupt?t:k):a(w)}function S(w){const de="CDATA[";return w===de.charCodeAt(f++)?(e.consume(w),f===de.length?r.interrupt?t:ie:S):a(w)}function A(w){return Fn(w)?(e.consume(w),c=String.fromCharCode(w),C):a(w)}function C(w){if(w===null||w===47||w===62||Ot(w)){const de=w===47,Ne=c.toLowerCase();return!de&&!u&&c1.includes(Ne)?(o=1,r.interrupt?t(w):ie(w)):zk.includes(c.toLowerCase())?(o=6,de?(e.consume(w),v):r.interrupt?t(w):ie(w)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(w):u?D(w):R(w))}return w===45||On(w)?(e.consume(w),c+=String.fromCharCode(w),C):a(w)}function v(w){return w===62?(e.consume(w),r.interrupt?t:ie):a(w)}function D(w){return it(w)?(e.consume(w),D):B(w)}function R(w){return w===47?(e.consume(w),B):w===58||w===95||Fn(w)?(e.consume(w),L):it(w)?(e.consume(w),R):B(w)}function L(w){return w===45||w===46||w===58||w===95||On(w)?(e.consume(w),L):I(w)}function I(w){return w===61?(e.consume(w),H):it(w)?(e.consume(w),I):R(w)}function H(w){return w===null||w===60||w===61||w===62||w===96?a(w):w===34||w===39?(e.consume(w),m=w,$):it(w)?(e.consume(w),H):W(w)}function $(w){return w===m?(e.consume(w),m=null,K):w===null||Fe(w)?a(w):(e.consume(w),$)}function W(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||Ot(w)?I(w):(e.consume(w),W)}function K(w){return w===47||w===62||it(w)?R(w):a(w)}function B(w){return w===62?(e.consume(w),ne):a(w)}function ne(w){return w===null||Fe(w)?ie(w):it(w)?(e.consume(w),ne):a(w)}function ie(w){return w===45&&o===2?(e.consume(w),q):w===60&&o===1?(e.consume(w),M):w===62&&o===4?(e.consume(w),P):w===63&&o===3?(e.consume(w),k):w===93&&o===5?(e.consume(w),Z):Fe(w)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(qk,J,be)(w)):w===null||Fe(w)?(e.exit("htmlFlowData"),be(w)):(e.consume(w),ie)}function be(w){return e.check(Yk,te,J)(w)}function te(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),G}function G(w){return w===null||Fe(w)?be(w):(e.enter("htmlFlowData"),ie(w))}function q(w){return w===45?(e.consume(w),k):ie(w)}function M(w){return w===47?(e.consume(w),c="",F):ie(w)}function F(w){if(w===62){const de=c.toLowerCase();return c1.includes(de)?(e.consume(w),P):ie(w)}return Fn(w)&&c.length<8?(e.consume(w),c+=String.fromCharCode(w),F):ie(w)}function Z(w){return w===93?(e.consume(w),k):ie(w)}function k(w){return w===62?(e.consume(w),P):w===45&&o===2?(e.consume(w),k):ie(w)}function P(w){return w===null||Fe(w)?(e.exit("htmlFlowData"),J(w)):(e.consume(w),P)}function J(w){return e.exit("htmlFlow"),t(w)}}function Vk(e,t,a){const r=this;return o;function o(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):a(c)}function u(c){return r.parser.lazy[r.now().line]?a(c):t(c)}}function Xk(e,t,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Do,t,a)}}const Qk={name:"htmlText",tokenize:Wk};function Wk(e,t,a){const r=this;let o,u,c;return f;function f(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),m}function m(k){return k===33?(e.consume(k),h):k===47?(e.consume(k),I):k===63?(e.consume(k),R):Fn(k)?(e.consume(k),W):a(k)}function h(k){return k===45?(e.consume(k),b):k===91?(e.consume(k),u=0,S):Fn(k)?(e.consume(k),D):a(k)}function b(k){return k===45?(e.consume(k),N):a(k)}function g(k){return k===null?a(k):k===45?(e.consume(k),y):Fe(k)?(c=g,M(k)):(e.consume(k),g)}function y(k){return k===45?(e.consume(k),N):g(k)}function N(k){return k===62?q(k):k===45?y(k):g(k)}function S(k){const P="CDATA[";return k===P.charCodeAt(u++)?(e.consume(k),u===P.length?A:S):a(k)}function A(k){return k===null?a(k):k===93?(e.consume(k),C):Fe(k)?(c=A,M(k)):(e.consume(k),A)}function C(k){return k===93?(e.consume(k),v):A(k)}function v(k){return k===62?q(k):k===93?(e.consume(k),v):A(k)}function D(k){return k===null||k===62?q(k):Fe(k)?(c=D,M(k)):(e.consume(k),D)}function R(k){return k===null?a(k):k===63?(e.consume(k),L):Fe(k)?(c=R,M(k)):(e.consume(k),R)}function L(k){return k===62?q(k):R(k)}function I(k){return Fn(k)?(e.consume(k),H):a(k)}function H(k){return k===45||On(k)?(e.consume(k),H):$(k)}function $(k){return Fe(k)?(c=$,M(k)):it(k)?(e.consume(k),$):q(k)}function W(k){return k===45||On(k)?(e.consume(k),W):k===47||k===62||Ot(k)?K(k):a(k)}function K(k){return k===47?(e.consume(k),q):k===58||k===95||Fn(k)?(e.consume(k),B):Fe(k)?(c=K,M(k)):it(k)?(e.consume(k),K):q(k)}function B(k){return k===45||k===46||k===58||k===95||On(k)?(e.consume(k),B):ne(k)}function ne(k){return k===61?(e.consume(k),ie):Fe(k)?(c=ne,M(k)):it(k)?(e.consume(k),ne):K(k)}function ie(k){return k===null||k===60||k===61||k===62||k===96?a(k):k===34||k===39?(e.consume(k),o=k,be):Fe(k)?(c=ie,M(k)):it(k)?(e.consume(k),ie):(e.consume(k),te)}function be(k){return k===o?(e.consume(k),o=void 0,G):k===null?a(k):Fe(k)?(c=be,M(k)):(e.consume(k),be)}function te(k){return k===null||k===34||k===39||k===60||k===61||k===96?a(k):k===47||k===62||Ot(k)?K(k):(e.consume(k),te)}function G(k){return k===47||k===62||Ot(k)?K(k):a(k)}function q(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):a(k)}function M(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),F}function F(k){return it(k)?ht(e,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):Z(k)}function Z(k){return e.enter("htmlTextData"),c(k)}}const ip={name:"labelEnd",resolveAll:tR,resolveTo:nR,tokenize:aR},Zk={tokenize:sR},Jk={tokenize:rR},eR={tokenize:iR};function tR(e){let t=-1;const a=[];for(;++t<e.length;){const r=e[t][1];if(a.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==a.length&&xa(e,0,e.length,a),e}function nR(e,t){let a=e.length,r=0,o,u,c,f;for(;a--;)if(o=e[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(c){if(e[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(c=a);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},b={type:"labelText",start:{...e[u+r+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=Ra(f,e.slice(u+1,u+r+3)),f=Ra(f,[["enter",b,t]]),f=Ra(f,nd(t.parser.constructs.insideSpan.null,e.slice(u+r+4,c-3),t)),f=Ra(f,[["exit",b,t],e[c-2],e[c-1],["exit",h,t]]),f=Ra(f,e.slice(c+1)),f=Ra(f,[["exit",m,t]]),xa(e,u,e.length,f),e}function aR(e,t,a){const r=this;let o=r.events.length,u,c;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){u=r.events[o][1];break}return f;function f(y){return u?u._inactive?g(y):(c=r.parser.defined.includes(Fa(r.sliceSerialize({start:u.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),m):a(y)}function m(y){return y===40?e.attempt(Zk,b,c?b:g)(y):y===91?e.attempt(Jk,b,c?h:g)(y):c?b(y):g(y)}function h(y){return e.attempt(eR,b,g)(y)}function b(y){return t(y)}function g(y){return u._balanced=!0,a(y)}}function sR(e,t,a){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return Ot(g)?uo(e,u)(g):u(g)}function u(g){return g===41?b(g):gN(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Ot(g)?uo(e,m)(g):b(g)}function f(g){return a(g)}function m(g){return g===34||g===39||g===40?xN(e,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function h(g){return Ot(g)?uo(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):a(g)}}function rR(e,t,a){const r=this;return o;function o(f){return bN.call(r,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return r.parser.defined.includes(Fa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):a(f)}function c(f){return a(f)}}function iR(e,t,a){return r;function r(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):a(u)}}const lR={name:"labelStartImage",resolveAll:ip.resolveAll,tokenize:oR};function oR(e,t,a){const r=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):a(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(f):t(f)}}const uR={name:"labelStartLink",resolveAll:ip.resolveAll,tokenize:cR};function cR(e,t,a){const r=this;return o;function o(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(c):t(c)}}const Rm={name:"lineEnding",tokenize:dR};function dR(e,t){return a;function a(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ht(e,t,"linePrefix")}}const Ec={name:"thematicBreak",tokenize:fR};function fR(e,t,a){let r=0,o;return u;function u(h){return e.enter("thematicBreak"),c(h)}function c(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),m(h)):r>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):a(h)}function m(h){return h===o?(e.consume(h),r++,m):(e.exit("thematicBreakSequence"),it(h)?ht(e,f,"whitespace")(h):f(h))}}const aa={continuation:{tokenize:gR},exit:xR,name:"list",tokenize:pR},mR={partial:!0,tokenize:ER},hR={partial:!0,tokenize:bR};function pR(e,t,a){const r=this,o=r.events[r.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return f;function f(N){const S=r.containerState.type||(N===42||N===43||N===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||N===r.containerState.marker:hh(N)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),N===42||N===45?e.check(Ec,a,h)(N):h(N);if(!r.interrupt||N===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(N)}return a(N)}function m(N){return hh(N)&&++c<10?(e.consume(N),m):(!r.interrupt||c<2)&&(r.containerState.marker?N===r.containerState.marker:N===41||N===46)?(e.exit("listItemValue"),h(N)):a(N)}function h(N){return e.enter("listItemMarker"),e.consume(N),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||N,e.check(Do,r.interrupt?a:b,e.attempt(mR,y,g))}function b(N){return r.containerState.initialBlankLine=!0,u++,y(N)}function g(N){return it(N)?(e.enter("listItemPrefixWhitespace"),e.consume(N),e.exit("listItemPrefixWhitespace"),y):a(N)}function y(N){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(N)}}function gR(e,t,a){const r=this;return r.containerState._closeFlow=void 0,e.check(Do,o,u);function o(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ht(e,t,"listItemIndent",r.containerState.size+1)(f)}function u(f){return r.containerState.furtherBlankLines||!it(f)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(f)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hR,t,c)(f))}function c(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,ht(e,e.attempt(aa,t,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function bR(e,t,a){const r=this;return ht(e,o,"listItemIndent",r.containerState.size+1);function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(u):a(u)}}function xR(e){e.exit(this.containerState.type)}function ER(e,t,a){const r=this;return ht(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const c=r.events[r.events.length-1];return!it(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):a(u)}}const d1={name:"setextUnderline",resolveTo:yR,tokenize:NR};function yR(e,t){let a=e.length,r,o,u;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){r=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!u&&e[a][1].type==="definition"&&(u=a);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",c,t]),e.splice(u+1,0,["exit",e[r][1],t]),e[r][1].end={...e[u][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function NR(e,t,a){const r=this;let o;return u;function u(h){let b=r.events.length,g;for(;b--;)if(r.events[b][1].type!=="lineEnding"&&r.events[b][1].type!=="linePrefix"&&r.events[b][1].type!=="content"){g=r.events[b][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),o=h,c(h)):a(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),it(h)?ht(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):a(h)}}const TR={tokenize:_R};function _R(e){const t=this,a=e.attempt(Do,r,e.attempt(this.parser.constructs.flowInitial,o,ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(wk,o)),"linePrefix")));return a;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const vR={resolveAll:yN()},SR=EN("string"),AR=EN("text");function EN(e){return{resolveAll:yN(e==="text"?CR:void 0),tokenize:t};function t(a){const r=this,o=this.parser.constructs[e],u=a.attempt(o,c,f);return c;function c(b){return h(b)?u(b):f(b)}function f(b){if(b===null){a.consume(b);return}return a.enter("data"),a.consume(b),m}function m(b){return h(b)?(a.exit("data"),u(b)):(a.consume(b),m)}function h(b){if(b===null)return!0;const g=o[b];let y=-1;if(g)for(;++y<g.length;){const N=g[y];if(!N.previous||N.previous.call(r,r.previous))return!0}return!1}}}function yN(e){return t;function t(a,r){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(a,r):a}}function CR(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 r=e[a-1][1],o=t.sliceStream(r);let u=o.length,c=-1,f=0,m;for(;u--;){const h=o[u];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){u++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(f=0),f){const h={type:a===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:r.start._bufferIndex+c,_index:r.start._index+u,line:r.end.line,column:r.end.column-f,offset:r.end.offset-f},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(e.splice(a,0,["enter",h,t],["exit",h,t]),a+=2)}a++}return e}const wR={42:aa,43:aa,45:aa,48:aa,49:aa,50:aa,51:aa,52:aa,53:aa,54:aa,55:aa,56:aa,57:aa,62:fN},kR={91:Mk},RR={[-2]:km,[-1]:km,32:km},OR={35:Uk,42:Ec,45:[d1,Ec],60:$k,61:d1,95:Ec,96:u1,126:u1},IR={38:hN,92:mN},MR={[-5]:Rm,[-4]:Rm,[-3]:Rm,33:lR,38:hN,42:ph,60:[uk,Qk],91:uR,92:[Bk,mN],93:ip,95:ph,96:Tk},DR={null:[ph,vR]},LR={null:[42,95]},jR={null:[]},BR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:LR,contentInitial:kR,disable:jR,document:wR,flow:OR,flowInitial:RR,insideSpan:DR,string:IR,text:MR},Symbol.toStringTag,{value:"Module"}));function PR(e,t,a){let r={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let c=[],f=[];const m={attempt:$(I),check:$(H),consume:D,enter:R,exit:L,interrupt:$(H,{interrupt:!0})},h={code:null,containerState:{},defineSkip:A,events:[],now:S,parser:e,previous:null,sliceSerialize:y,sliceStream:N,write:g};let b=t.tokenize.call(h,m);return t.resolveAll&&u.push(t),h;function g(ne){return c=Ra(c,ne),C(),c[c.length-1]!==null?[]:(W(t,0),h.events=nd(u,h.events,h),h.events)}function y(ne,ie){return HR(N(ne),ie)}function N(ne){return UR(c,ne)}function S(){const{_bufferIndex:ne,_index:ie,line:be,column:te,offset:G}=r;return{_bufferIndex:ne,_index:ie,line:be,column:te,offset:G}}function A(ne){o[ne.line]=ne.column,B()}function C(){let ne;for(;r._index<c.length;){const ie=c[r._index];if(typeof ie=="string")for(ne=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ne&&r._bufferIndex<ie.length;)v(ie.charCodeAt(r._bufferIndex));else v(ie)}}function v(ne){b=b(ne)}function D(ne){Fe(ne)?(r.line++,r.column=1,r.offset+=ne===-3?2:1,B()):ne!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=ne}function R(ne,ie){const be=ie||{};return be.type=ne,be.start=S(),h.events.push(["enter",be,h]),f.push(be),be}function L(ne){const ie=f.pop();return ie.end=S(),h.events.push(["exit",ie,h]),ie}function I(ne,ie){W(ne,ie.from)}function H(ne,ie){ie.restore()}function $(ne,ie){return be;function be(te,G,q){let M,F,Z,k;return Array.isArray(te)?J(te):"tokenize"in te?J([te]):P(te);function P(j){return he;function he(ke){const De=ke!==null&&j[ke],lt=ke!==null&&j.null,Bt=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(lt)?lt:lt?[lt]:[]];return J(Bt)(ke)}}function J(j){return M=j,F=0,j.length===0?q:w(j[F])}function w(j){return he;function he(ke){return k=K(),Z=j,j.partial||(h.currentConstruct=j),j.name&&h.parser.constructs.disable.null.includes(j.name)?Ne():j.tokenize.call(ie?Object.assign(Object.create(h),ie):h,m,de,Ne)(ke)}}function de(j){return ne(Z,k),G}function Ne(j){return k.restore(),++F<M.length?w(M[F]):q}}}function W(ne,ie){ne.resolveAll&&!u.includes(ne)&&u.push(ne),ne.resolve&&xa(h.events,ie,h.events.length-ie,ne.resolve(h.events.slice(ie),h)),ne.resolveTo&&(h.events=ne.resolveTo(h.events,h))}function K(){const ne=S(),ie=h.previous,be=h.currentConstruct,te=h.events.length,G=Array.from(f);return{from:te,restore:q};function q(){r=ne,h.previous=ie,h.currentConstruct=be,h.events.length=te,f=G,B()}}function B(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function UR(e,t){const a=t.start._index,r=t.start._bufferIndex,o=t.end._index,u=t.end._bufferIndex;let c;if(a===o)c=[e[a].slice(r,u)];else{if(c=e.slice(a,o),r>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(r):c.shift()}u>0&&c.push(e[o].slice(0,u))}return c}function HR(e,t){let a=-1;const r=[];let o;for(;++a<e.length;){const u=e[a];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
@@ -490,7 +490,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
|
|
|
490
490
|
`))}function m(N,S,A,C){const v=A.enter("tableCell"),D=A.enter("phrasing"),R=A.containerPhrasing(N,{...C,before:u,after:u});return D(),v(),R}function h(N,S){return tI(N,{align:S,alignDelimiters:r,padding:a,stringLength:o})}function b(N,S,A){const C=N.children;let v=-1;const D=[],R=S.enter("table");for(;++v<C.length;)D[v]=g(C[v],S,A);return R(),D}function g(N,S,A){const C=N.children;let v=-1;const D=[],R=S.enter("tableRow");for(;++v<C.length;)D[v]=m(C[v],N,S,A);return R(),D}function y(N,S,A){let C=KN.inlineCode(N,S,A);return A.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function zI(){return{exit:{taskListCheckValueChecked:L1,taskListCheckValueUnchecked:L1,paragraph:qI}}}function $I(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:YI}}}function L1(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function qI(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const r=a.children[0];if(r&&r.type==="text"){const o=t.children;let u=-1,c;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){c=f;break}}c===a&&(r.value=r.value.slice(1),r.value.length===0?a.children.shift():a.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,a.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function YI(e,t,a,r){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=a.createTracker(r);u&&f.move(c);let m=KN.listItem(e,t,a,{...r,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(b){return b+c}}function GI(){return[vO(),YO(),XO(),LI(),zI()]}function KI(e){return{extensions:[SO(),GO(e),QO(),FI(e),$I()]}}const VI={tokenize:e6,partial:!0},VN={tokenize:t6,partial:!0},XN={tokenize:n6,partial:!0},QN={tokenize:a6,partial:!0},XI={tokenize:s6,partial:!0},WN={name:"wwwAutolink",tokenize:ZI,previous:JN},ZN={name:"protocolAutolink",tokenize:JI,previous:eT},ws={name:"emailAutolink",tokenize:WI,previous:tT},ns={};function QI(){return{text:ns}}let Mr=48;for(;Mr<123;)ns[Mr]=ws,Mr++,Mr===58?Mr=65:Mr===91&&(Mr=97);ns[43]=ws;ns[45]=ws;ns[46]=ws;ns[95]=ws;ns[72]=[ws,ZN];ns[104]=[ws,ZN];ns[87]=[ws,WN];ns[119]=[ws,WN];function WI(e,t,a){const r=this;let o,u;return c;function c(g){return!yh(g)||!tT.call(r,r.previous)||hp(r.events)?a(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return yh(g)?(e.consume(g),f):g===64?(e.consume(g),m):a(g)}function m(g){return g===46?e.check(XI,b,h)(g):g===45||g===95||On(g)?(u=!0,e.consume(g),m):b(g)}function h(g){return e.consume(g),o=!0,m}function b(g){return u&&o&&Fn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):a(g)}}function ZI(e,t,a){const r=this;return o;function o(c){return c!==87&&c!==119||!JN.call(r,r.previous)||hp(r.events)?a(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(VI,e.attempt(VN,e.attempt(XN,u),a),a)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function JI(e,t,a){const r=this;let o="",u=!1;return c;function c(g){return(g===72||g===104)&&eT.call(r,r.previous)&&!hp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),f):a(g)}function f(g){if(Fn(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const y=o.toLowerCase();if(y==="http"||y==="https")return e.consume(g),m}return a(g)}function m(g){return g===47?(e.consume(g),u?h:(u=!0,m)):a(g)}function h(g){return g===null||Oc(g)||Ot(g)||qr(g)||td(g)?a(g):e.attempt(VN,e.attempt(XN,b),a)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function e6(e,t,a){let r=0;return o;function o(c){return(c===87||c===119)&&r<3?(r++,e.consume(c),o):c===46&&r===3?(e.consume(c),u):a(c)}function u(c){return c===null?a(c):t(c)}}function t6(e,t,a){let r,o,u;return c;function c(h){return h===46||h===95?e.check(QN,m,f)(h):h===null||Ot(h)||qr(h)||h!==45&&td(h)?m(h):(u=!0,e.consume(h),c)}function f(h){return h===95?r=!0:(o=r,r=void 0),e.consume(h),c}function m(h){return o||r||!u?a(h):t(h)}}function n6(e,t){let a=0,r=0;return o;function o(c){return c===40?(a++,e.consume(c),o):c===41&&r<a?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(QN,t,u)(c):c===null||Ot(c)||qr(c)?t(c):(e.consume(c),o)}function u(c){return c===41&&r++,e.consume(c),o}}function a6(e,t,a){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||Ot(f)||qr(f)?t(f):a(f)}function o(f){return f===null||f===40||f===91||Ot(f)||qr(f)?t(f):r(f)}function u(f){return Fn(f)?c(f):a(f)}function c(f){return f===59?(e.consume(f),r):Fn(f)?(e.consume(f),c):a(f)}}function s6(e,t,a){return r;function r(u){return e.consume(u),o}function o(u){return On(u)?a(u):t(u)}}function JN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ot(e)}function eT(e){return!Fn(e)}function tT(e){return!(e===47||yh(e))}function yh(e){return e===43||e===45||e===46||e===95||On(e)}function hp(e){let t=e.length,a=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){a=!0;break}if(r._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const r6={tokenize:m6,partial:!0};function i6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:c6,continuation:{tokenize:d6},exit:f6}},text:{91:{name:"gfmFootnoteCall",tokenize:u6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:l6,resolveTo:o6}}}}function l6(e,t,a){const r=this;let o=r.events.length;const u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;o--;){const m=r.events[o][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return a(m);const h=Fa(r.sliceSerialize({start:c.end,end:r.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?a(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function o6(e,t){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...f),e}function u6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?a(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(u>999||g===93&&!c||g===null||g===91||Ot(g))return a(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return o.includes(Fa(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(g)}return Ot(g)||(c=!0),u++,e.consume(g),g===92?b:h}function b(g){return g===91||g===92||g===93?(e.consume(g),u++,h):h(g)}}function c6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):a(S)}function b(S){if(c>999||S===93&&!f||S===null||S===91||Ot(S))return a(S);if(S===93){e.exit("chunkString");const A=e.exit("gfmFootnoteDefinitionLabelString");return u=Fa(r.sliceSerialize(A)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Ot(S)||(f=!0),c++,e.consume(S),S===92?g:b}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,b):b(S)}function y(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),o.includes(u)||o.push(u),ht(e,N,"gfmFootnoteDefinitionWhitespace")):a(S)}function N(S){return t(S)}}function d6(e,t,a){return e.check(Do,t,e.attempt(r6,t,a))}function f6(e){e.exit("gfmFootnoteDefinition")}function m6(e,t,a){const r=this;return ht(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):a(u)}}function h6(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},y=[["enter",b,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],N=f.parser.constructs.insideSpan.null;N&&xa(y,y.length,0,nd(N,c.slice(h+1,m),f)),xa(y,y.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",b,f]]),xa(c,h-1,m-h+3,y),m=h+y.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const h=this.previous,b=this.events;let g=0;return y;function y(S){return h===126&&b[b.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),N(S))}function N(S){const A=$i(h);if(S===126)return g>1?m(S):(c.consume(S),g++,N);if(g<2&&!a)return m(S);const C=c.exit("strikethroughSequenceTemporary"),v=$i(S);return C._open=!v||v===2&&!!A,C._close=!A||A===2&&!!v,f(S)}}}class p6{constructor(){this.map=[]}add(t,a,r){g6(this,t,a,r)}consume(t){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const u of o)t.push(u);o=r.pop()}this.map.length=0}}function g6(e,t,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=a,e.map[o][2].push(...r);return}o+=1}e.map.push([t,a,r])}}function b6(e,t){let a=!1;const r=[];for(;t<e.length;){const o=e[t];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const u=r.length-1;r[u]=r[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);t+=1}return r}function x6(){return{flow:{null:{name:"table",tokenize:E6,resolveAll:y6}}}}function E6(e,t,a){const r=this;let o=0,u=0,c;return f;function f(B){let ne=r.events.length-1;for(;ne>-1;){const te=r.events[ne][1].type;if(te==="lineEnding"||te==="linePrefix")ne--;else break}const ie=ne>-1?r.events[ne][1].type:null,be=ie==="tableHead"||ie==="tableRow"?H:m;return be===H&&r.parser.lazy[r.now().line]?a(B):be(B)}function m(B){return e.enter("tableHead"),e.enter("tableRow"),h(B)}function h(B){return B===124||(c=!0,u+=1),b(B)}function b(B){return B===null?a(B):Fe(B)?u>1?(u=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),N):a(B):it(B)?ht(e,b,"whitespace")(B):(u+=1,c&&(c=!1,o+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(B)))}function g(B){return B===null||B===124||Ot(B)?(e.exit("data"),b(B)):(e.consume(B),B===92?y:g)}function y(B){return B===92||B===124?(e.consume(B),g):g(B)}function N(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(B):(e.enter("tableDelimiterRow"),c=!1,it(B)?ht(e,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):S(B))}function S(B){return B===45||B===58?C(B):B===124?(c=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),A):I(B)}function A(B){return it(B)?ht(e,C,"whitespace")(B):C(B)}function C(B){return B===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),v):B===45?(u+=1,v(B)):B===null||Fe(B)?L(B):I(B)}function v(B){return B===45?(e.enter("tableDelimiterFiller"),D(B)):I(B)}function D(B){return B===45?(e.consume(B),D):B===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(B))}function R(B){return it(B)?ht(e,L,"whitespace")(B):L(B)}function L(B){return B===124?S(B):B===null||Fe(B)?!c||o!==u?I(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):I(B)}function I(B){return a(B)}function H(B){return e.enter("tableRow"),$(B)}function $(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),$):B===null||Fe(B)?(e.exit("tableRow"),t(B)):it(B)?ht(e,$,"whitespace")(B):(e.enter("data"),W(B))}function W(B){return B===null||B===124||Ot(B)?(e.exit("data"),$(B)):(e.consume(B),B===92?K:W)}function K(B){return B===92||B===124?(e.consume(B),W):W(B)}}function y6(e,t){let a=-1,r=!0,o=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,b,g;const y=new p6;for(;++a<e.length;){const N=e[a],S=N[1];N[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(j1(y,t,m,h,b),b=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},y.add(a,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(r=!0,g=void 0,u=[0,0,0,0],c=[0,a+1,0,0],f&&(f=!1,b={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},y.add(a,0,[["enter",b,t]])),o=S.type==="tableDelimiterRow"?2:b?3:1):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=oc(y,t,u,o,void 0,g),u=[0,0,0,0]),c[2]=a)):S.type==="tableCellDivider"&&(r?r=!1:(u[1]!==0&&(c[0]=c[1],g=oc(y,t,u,o,void 0,g)),u=c,c=[u[1],a,0,0])):S.type==="tableHead"?(f=!0,m=a):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=a,u[1]!==0?(c[0]=c[1],g=oc(y,t,u,o,a,g)):c[1]!==0&&(g=oc(y,t,c,o,a,g)),o=0):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=a)}for(m!==0&&j1(y,t,m,h,b),y.consume(t.events),a=-1;++a<t.events.length;){const N=t.events[a];N[0]==="enter"&&N[1].type==="table"&&(N[1]._align=b6(t.events,a))}return e}function oc(e,t,a,r,o,u){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";a[0]!==0&&(u.end=Object.assign({},ji(t.events,a[0])),e.add(a[0],0,[["exit",u,t]]));const m=ji(t.events,a[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(a[1],0,[["enter",u,t]]),a[2]!==0){const h=ji(t.events,a[2]),b=ji(t.events,a[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},b)};if(e.add(a[2],0,[["enter",g,t]]),r!==2){const y=t.events[a[2]],N=t.events[a[3]];if(y[1].end=Object.assign({},N[1].end),y[1].type="chunkText",y[1].contentType="text",a[3]>a[2]+1){const S=a[2]+1,A=a[3]-a[2]-1;e.add(S,A,[])}}e.add(a[3]+1,0,[["exit",g,t]])}return o!==void 0&&(u.end=Object.assign({},ji(t.events,o)),e.add(o,0,[["exit",u,t]]),u=void 0),u}function j1(e,t,a,r,o){const u=[],c=ji(t.events,a);o&&(o.end=Object.assign({},c),u.push(["exit",o,t])),r.end=Object.assign({},c),u.push(["exit",r,t]),e.add(a+1,0,u)}function ji(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const N6={name:"tasklistCheck",tokenize:_6};function T6(){return{text:{91:N6}}}function _6(e,t,a){const r=this;return o;function o(m){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Ot(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):a(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):a(m)}function f(m){return Fe(m)?t(m):it(m)?e.check({tokenize:v6},t,a)(m):a(m)}}function v6(e,t,a){return ht(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function S6(e){return cN([QI(),i6(),h6(e),x6(),T6()])}const A6={};function Gi(e){const t=this,a=e||A6,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(S6(a)),u.push(GI()),c.push(KI(a))}const C6=5*1024*1024,B1=10,nT=["image/png","image/jpeg","image/gif","image/webp"],w6=5,k6=500;let P1=0;function aT(e){return e.split(`
|
|
491
491
|
`).length>w6||e.length>k6}function R6(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function O6(e){return new Promise((t,a)=>{const r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>a(r.error),r.readAsDataURL(e)})}function I6({url:e,label:t,onClose:a}){return T.useEffect(()=>{const r=o=>{o.key==="Escape"&&(o.preventDefault(),a())};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[a]),i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex cursor-zoom-out items-center justify-center bg-black/80 p-8 backdrop-blur-sm",children:i.jsx("img",{src:e,alt:t,className:"max-h-full max-w-full object-contain"})})}function sT({url:e,label:t,className:a}){const[r,o]=T.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>o(!0),"aria-label":`预览 ${t}`,className:"block cursor-zoom-in rounded-md transition-opacity duration-150 hover:opacity-80",children:i.jsx("img",{src:e,alt:t,className:ae("rounded-md border border-line",a)})}),r&&i.jsx(I6,{url:e,label:t,onClose:()=>o(!1)})]})}function rT(e=!0){const[t,a]=T.useState([]),[r,o]=T.useState([]),[u,c]=T.useState(null);T.useEffect(()=>{c(null),e||a([])},[e]);const f=async A=>{const C=[],v=[],D=t.length;let R=B1-D;for(const L of A){if(R<=0){v.push(`最多 ${B1} 张图片`);break}if(!nT.includes(L.type)){v.push(`${L.name||"文件"}:格式不支持`);continue}if(L.size>C6){v.push(`${L.name}:超过 5MB`);continue}C.push({_id:`att-${++P1}`,mime:L.type,url:await O6(L),filename:L.name}),R--}C.length>0&&a(L=>[...L,...C]),c(v.length>0?v.join(";"):null)},m=A=>{const C=Array.from(A.clipboardData.files);if(C.length!==0){if(A.preventDefault(),!e){c("当前模型不支持图片");return}f(C)}},h=A=>{const C=++P1,v=A.split(`
|
|
492
492
|
`).length,D=new TextEncoder().encode(A).byteLength,R=`[粘贴文本 #${C} · ${v}行]`,L={_id:`fold-${C}`,text:A,lineCount:v,byteSize:D,placeholder:R};return o(I=>[...I,L]),L},b=A=>{let C=A;for(const v of r)C=C.replace(v.placeholder,v.text);return C},g=A=>a(C=>C.filter(v=>v._id!==A)),y=A=>o(C=>C.filter(v=>v._id!==A)),N=T.useCallback(()=>{a([]),o([]),c(null)},[]),S=t.map(({mime:A,url:C,filename:v})=>({mime:A,url:C,filename:v}));return{attachments:t,foldedTexts:r,promptFiles:S,error:u,setError:c,addFiles:f,onPaste:m,addFoldedText:h,expandFoldedTexts:b,remove:g,removeFoldedText:y,clear:N}}function M6({text:e,label:t,onClose:a}){T.useEffect(()=>{const u=c=>{c.key==="Escape"&&(c.preventDefault(),a())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[a]);const r=e.split(`
|
|
493
|
-
`),o=String(r.length).length;return i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm md:p-8",children:i.jsxs("div",{onClick:u=>u.stopPropagation(),className:"flex max-h-full w-full max-w-4xl flex-col overflow-hidden rounded-lg border border-line bg-term",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-line px-4 py-2",children:[i.jsx("span",{className:"font-mono text-xs text-fg-3",children:t}),i.jsx("button",{type:"button",onClick:a,className:"text-fg-5 hover:text-fg-2",children:i.jsx(mt,{className:"h-4 w-4"})})]}),i.jsx("pre",{className:"overflow-auto p-4 font-mono text-xs leading-relaxed text-fg-2",children:r.map((u,c)=>i.jsxs("div",{children:[i.jsx("span",{className:"mr-3 inline-block select-none text-right text-fg-6",style:{width:`${o}ch`},children:c+1}),u]},c))})]})})}function D6({fold:e,index:t,onRemove:a}){const[r,o]=T.useState(!1),u=`粘贴文本 #${t} · ${e.lineCount}行 · ${R6(e.byteSize)}`;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"group relative flex items-center gap-1.5 rounded-md border border-line bg-elevated/50 px-2.5 py-1.5",children:[i.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex items-center gap-1.5 font-mono text-xs text-fg-3 transition-colors hover:text-fg",children:[i.jsx(Xc,{className:"h-3.5 w-3.5 shrink-0 text-fg-5"}),i.jsx("span",{children:u})]}),i.jsx("button",{type:"button",onClick:a,"aria-label":"移除粘贴文本",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-fg-5 transition-colors hover:text-fg-2",children:i.jsx(mt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]}),r&&i.jsx(M6,{text:e.text,label:u,onClose:()=>o(!1)})]})}function iT({onFiles:e,disabled:t,allowed:a}){const r=T.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:r,type:"file",accept:nT.join(","),multiple:!0,hidden:!0,onChange:o=>{e(Array.from(o.target.files??[])),o.target.value=""}}),i.jsx("button",{type:"button",onClick:()=>{var o;return(o=r.current)==null?void 0:o.click()},disabled:t||!a,"aria-label":"Attach image",title:a?"附加图片":"当前模型不支持图片",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-fg-5 transition-colors duration-150 hover:text-fg-3 disabled:cursor-not-allowed disabled:text-fg-6/40",children:i.jsx(k3,{className:"h-4 w-4"})})]})}function lT({attachments:e,foldedTexts:t,error:a,onRemove:r,onRemoveFoldedText:o,className:u}){const c=e.length>0||(t??[]).length>0;return!c&&!a?null:i.jsxs("div",{className:u,children:[c&&i.jsxs("div",{className:"mb-2 flex flex-wrap gap-2",children:[e.map(f=>i.jsxs("div",{className:"group relative",children:[i.jsx(sT,{url:f.url,label:f.filename??"attachment",className:"h-16 w-16 object-cover"}),i.jsx("button",{type:"button",onClick:()=>r(f._id),"aria-label":"Remove attachment",className:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-line bg-term text-fg-4 opacity-0 transition-opacity duration-150 hover:text-fg-2 group-hover:opacity-100",children:i.jsx(mt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]},f._id)),(t??[]).map((f,m)=>i.jsx(D6,{fold:f,index:m+1,onRemove:()=>o==null?void 0:o(f._id)},f._id))]}),a&&i.jsx("div",{className:"mb-2 font-mono text-[11px] text-red-400",children:a})]})}function oT({isListening:e,disabled:t,onStart:a,onStop:r}){const o=T.useRef(!1),u=f=>{if(t)return;f.preventDefault(),o.current=!0,a();const m=()=>{document.removeEventListener("touchend",m),document.removeEventListener("touchcancel",m),o.current=!1,r()};document.addEventListener("touchend",m,{once:!0}),document.addEventListener("touchcancel",m,{once:!0})},c=()=>{if(t||o.current)return;a();const f=()=>{document.removeEventListener("mouseup",f),r()};document.addEventListener("mouseup",f,{once:!0})};return i.jsx("button",{type:"button",disabled:t,onTouchStart:u,onMouseDown:c,onContextMenu:f=>f.preventDefault(),"aria-label":"按住说话",title:"按住说话",style:{WebkitTouchCallout:"none"},className:ae("flex shrink-0 select-none touch-none items-center justify-center transition-colors duration-150 disabled:cursor-not-allowed disabled:text-fg-6/40","order-first self-stretch w-12 rounded-xl sm:order-none sm:self-auto sm:h-7 sm:w-7 sm:rounded-md",e?"bg-red-500/15 text-red-400 hover:bg-red-500/25":"text-fg-5 hover:text-fg-3"),children:i.jsx(H3,{className:ae("h-6 w-6 sm:h-4 sm:w-4",e&&"animate-pulse")})})}const L6=[.85,1.25,.65,1.4,.75,1.15,.95],$m=4,U1=24;function j6(e){const t=Math.floor(e/60).toString().padStart(2,"0"),a=Math.floor(e%60).toString().padStart(2,"0");return`${t}:${a}`}function B6({volumeLevel:e}){const t=Math.min(Math.max(e,0),1);return i.jsx("div",{className:"flex h-6 items-center gap-1","aria-hidden":"true",children:L6.map((a,r)=>{const o=$m+t*a*(U1-$m),u=Math.max($m,Math.min(U1,o));return i.jsx("span",{className:"w-1 rounded-full bg-red-400 transition-[height] duration-150 ease-out",style:{height:`${u}px`}},r)})})}function uT({phase:e,transcript:t,interimTranscript:a,editText:r,onEditTextChange:o,onTextareaKeyDown:u,textareaRef:c,wrapperClassName:f}){if(e==="idle")return null;const m=t.length>0||a.length>0;return i.jsx("div",{className:f,children:i.jsxs("div",{className:"max-h-[40vh] overflow-y-auto px-4 py-4",children:[e==="recording"&&i.jsx("div",{className:"text-xl leading-relaxed",children:m?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-fg",children:t}),a&&i.jsx("span",{className:"text-fg-4",children:a})]}):i.jsx("span",{className:"italic text-fg-5",children:"正在聆听…"})}),e==="recognizing"&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(un,{className:"h-5 w-5 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-sm text-emerald-400",children:"识别中…"}),a&&i.jsx("span",{className:"truncate text-base text-fg-4",children:a})]}),e==="done"&&i.jsx("textarea",{ref:c,value:r,onChange:h=>o(h.target.value),onKeyDown:u,rows:2,placeholder:"识别结果(可编辑)",className:"w-full resize-none bg-transparent text-xl leading-relaxed text-fg placeholder:text-fg-5 focus:outline-none"})]})})}function cT({phase:e,volumeLevel:t,elapsed:a,editText:r,error:o,onCancel:u,onConfirm:c,idleHint:f,className:m}){return e==="idle"?i.jsx("div",{className:m,children:o?i.jsx("span",{className:"font-mono text-[10px] text-red-400",children:o}):f?i.jsx("span",{className:"font-mono text-[10px] text-fg-6",children:f}):null}):e==="done"?i.jsxs("div",{className:m,children:[i.jsx("span",{className:"hidden font-mono text-[10px] text-fg-6 sm:inline",children:"⌘/Ctrl+⏎ 发送 · Esc 取消"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:u,className:"rounded-md border border-line px-3 py-1 text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),i.jsxs("button",{type:"button",onClick:c,disabled:r.trim().length===0,"aria-label":"发送",className:"flex items-center gap-1.5 rounded-md bg-emerald-600 px-3 py-1 text-xs font-medium text-white transition-colors hover:bg-emerald-500 disabled:cursor-not-allowed disabled:bg-fg-6/30 disabled:text-fg-5",children:[i.jsx(Eo,{className:"h-3.5 w-3.5",strokeWidth:2.5}),i.jsx("span",{children:"发送"})]})]})]}):i.jsx("div",{className:m,children:e==="recording"?i.jsxs(i.Fragment,{children:[i.jsx(B6,{volumeLevel:t}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] font-medium text-red-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-red-400"}),"录音中"]}),i.jsx("span",{className:"font-mono text-[11px] tabular-nums text-fg-4",children:j6(a)})]}):i.jsxs(i.Fragment,{children:[i.jsx(un,{className:"h-4 w-4 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-[11px] text-emerald-400",children:"识别中…"})]})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Ki;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Ki||(Ki={}));class qm extends Error{constructor(t,a,r){super(t),this.message=t,this.code=a,this.data=r}}const P6=e=>{var t,a;return e!=null&&e.androidBridge?"android":!((a=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||a===void 0)&&a.bridge?"ios":"web"},U6=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},r=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:P6(e),u=()=>o()!=="web",c=g=>{const y=h.get(g);return!!(y!=null&&y.platforms.has(o())||f(g))},f=g=>{var y;return(y=a.PluginHeaders)===null||y===void 0?void 0:y.find(N=>N.name===g)},m=g=>e.console.error(g),h=new Map,b=(g,y={})=>{const N=h.get(g);if(N)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),N.proxy;const S=o(),A=f(g);let C;const v=async()=>(!C&&S in y?C=typeof y[S]=="function"?C=await y[S]():C=y[S]:t!==null&&!C&&"web"in y&&(C=typeof y.web=="function"?C=await y.web():C=y.web),C),D=(W,K)=>{var B,ne;if(A){const ie=A==null?void 0:A.methods.find(be=>K===be.name);if(ie)return ie.rtype==="promise"?be=>a.nativePromise(g,K.toString(),be):(be,te)=>a.nativeCallback(g,K.toString(),be,te);if(W)return(B=W[K])===null||B===void 0?void 0:B.bind(W)}else{if(W)return(ne=W[K])===null||ne===void 0?void 0:ne.bind(W);throw new qm(`"${g}" plugin is not implemented on ${S}`,Ki.Unimplemented)}},R=W=>{let K;const B=(...ne)=>{const ie=v().then(be=>{const te=D(be,W);if(te){const G=te(...ne);return K=G==null?void 0:G.remove,G}else throw new qm(`"${g}.${W}()" is not implemented on ${S}`,Ki.Unimplemented)});return W==="addListener"&&(ie.remove=async()=>K()),ie};return B.toString=()=>`${W.toString()}() { [capacitor code] }`,Object.defineProperty(B,"name",{value:W,writable:!1,configurable:!1}),B},L=R("addListener"),I=R("removeListener"),H=(W,K)=>{const B=L({eventName:W},K),ne=async()=>{const be=await B;I({eventName:W,callbackId:be},K)},ie=new Promise(be=>B.then(()=>be({remove:ne})));return ie.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ne()},ie},$=new Proxy({},{get(W,K){switch(K){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return A?H:L;case"removeListener":return I;default:return R(K)}}});return r[g]=$,h.set(g,{name:g,proxy:$,platforms:new Set([...Object.keys(y),...A?[S]:[]])}),$};return a.convertFileSrc||(a.convertFileSrc=g=>g),a.getPlatform=o,a.handleError=m,a.isNativePlatform=u,a.isPluginAvailable=c,a.registerPlugin=b,a.Exception=qm,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},H6=e=>e.Capacitor=U6(e),Dc=H6(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Po=Dc.registerPlugin;class pp{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,a){let r=!1;this.listeners[t]||(this.listeners[t]=[],r=!0),this.listeners[t].push(a);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),r&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,a);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,a,r){const o=this.listeners[t];if(!o){if(r){let u=this.retainedEventArguments[t];u||(u=[]),u.push(a),this.retainedEventArguments[t]=u}return}o.forEach(u=>u(a))}hasListeners(t){var a;return!!(!((a=this.listeners[t])===null||a===void 0)&&a.length)}registerWindowListener(t,a){this.windowListeners[a]={registered:!1,windowEventName:t,pluginEventName:a,handler:r=>{this.notifyListeners(a,r)}}}unimplemented(t="not implemented"){return new Dc.Exception(t,Ki.Unimplemented)}unavailable(t="not available"){return new Dc.Exception(t,Ki.Unavailable)}async removeListener(t,a){const r=this.listeners[t];if(!r)return;const o=r.indexOf(a);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const a=this.retainedEventArguments[t];a&&(delete this.retainedEventArguments[t],a.forEach(r=>{this.notifyListeners(t,r)}))}}const H1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),F1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class F6 extends pp{async getCookies(){const t=document.cookie,a={};return t.split(";").forEach(r=>{if(r.length<=0)return;let[o,u]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=F1(o).trim(),u=F1(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=H1(t.key),r=H1(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${a}=${r||""}${o}; path=${u}; ${c};`}catch(a){return Promise.reject(a)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(a){return Promise.reject(a)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const a of t)document.cookie=a.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}Po("CapacitorCookies",{web:()=>new F6});const z6=async e=>new Promise((t,a)=>{const r=new FileReader;r.onload=()=>{const o=r.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},r.onerror=o=>a(o),r.readAsDataURL(e)}),$6=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,c)=>(o[u]=e[t[c]],o),{})},q6=(e,t=!0)=>e?Object.entries(e).reduce((r,o)=>{const[u,c]=o;let f,m;return Array.isArray(c)?(m="",c.forEach(h=>{f=t?encodeURIComponent(h):h,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=t?encodeURIComponent(c):c,m=`${u}=${f}`),`${r}&${m}`},"").substr(1):null,Y6=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=$6(e.headers)["content-type"]||"";if(typeof e.data=="string")a.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);a.body=u.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,m)=>{u.append(m,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);a.body=u;const c=new Headers(a.headers);c.delete("content-type"),a.headers=c}else(o.includes("application/json")||typeof e.data=="object")&&(a.body=JSON.stringify(e.data));return a};class G6 extends pp{async request(t){const a=Y6(t,t.webFetchExtra),r=q6(t.params,t.shouldEncodeUrlParams),o=r?`${t.url}?${r}`:t.url,u=await fetch(o,a),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let m,h;switch(f){case"arraybuffer":case"blob":h=await u.blob(),m=await z6(h);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const b={};return u.headers.forEach((g,y)=>{b[y]=g}),{data:m,headers:b,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}Po("CapacitorHttp",{web:()=>new G6});var z1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(z1||(z1={}));var $1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})($1||($1={}));class K6 extends pp{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}Po("SystemBars",{web:()=>new K6});const V6="modulepreload",X6=function(e){return"/"+e},q1={},Q6=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let c=function(h){return Promise.all(h.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=c(a.map(h=>{if(h=X6(h),h in q1)return;q1[h]=!0;const b=h.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const y=document.createElement("link");if(y.rel=b?"stylesheet":V6,b||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),b)return new Promise((N,S)=>{y.addEventListener("load",N),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return o.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},Li=Po("SpeechRecognition",{web:()=>Q6(()=>import("./web-bk_3jx2V.js"),[]).then(e=>new e.SpeechRecognitionWeb)});function W6(e,t){const a=e.length,r=new ArrayBuffer(44+a*2),o=new DataView(r),u=(c,f)=>{for(let m=0;m<f.length;m++)o.setUint8(c+m,f.charCodeAt(m))};u(0,"RIFF"),o.setUint32(4,36+a*2,!0),u(8,"WAVE"),u(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,t*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),u(36,"data"),o.setUint32(40,a*2,!0);for(let c=0;c<a;c++){const f=Math.max(-1,Math.min(1,e[c]));o.setInt16(44+c*2,f<0?f*32768:f*32767,!0)}return new Blob([r],{type:"audio/wav"})}const Nh=Dc.isNativePlatform(),Ym=!Nh&&typeof window<"u"?window.SpeechRecognition??window.webkitSpeechRecognition:void 0,Gm=16e3;function Z6(e="zh-CN"){const[t,a]=T.useState(!1),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(null),[h,b]=T.useState(0),[g,y]=T.useState("idle"),N=T.useRef(null),S=T.useRef(!1),A=T.useRef([]),C=T.useRef(!1),v=T.useRef(null),D=T.useRef(!1),R=T.useRef(""),L=T.useRef(null),I=T.useRef(null),H=T.useRef(null),$=T.useRef([]),W=T.useRef(!1),K=!0,B=T.useCallback(async()=>{var w,de,Ne;(w=H.current)==null||w.disconnect(),(de=I.current)==null||de.getTracks().forEach(j=>j.stop()),await((Ne=L.current)==null?void 0:Ne.close().catch(()=>{}));const M=$.current;if($.current=[],H.current=null,I.current=null,L.current=null,M.length===0||W.current){a(!1),y("idle");return}c("识别中…"),y("recognizing");const F=M.reduce((j,he)=>j+he.length,0),Z=new Float32Array(F);let k=0;for(const j of M)Z.set(j,k),k+=j.length;const P=W6(Z,Gm),J=new FormData;J.append("audio",P,"recording.wav");try{const j=await fetch("/api/transcribe",{method:"POST",body:J});if(W.current)return;if(j.ok){const{text:he}=await j.json();he?(o(he),y("done")):y("idle")}else{const he=await j.json().catch(()=>({error:`HTTP ${j.status}`}));m(he.error??`HTTP ${j.status}`),y("idle")}}catch(j){m(`语音识别失败:${j instanceof Error?j.message:String(j)}`),y("idle")}finally{c(""),a(!1)}},[]),ne=T.useCallback(async()=>{if(S.current=!0,v.current&&(clearTimeout(v.current),v.current=null),Nh){await Li.stop().catch(()=>{});for(const M of A.current)await M.remove().catch(()=>{});A.current=[],a(!1),c("")}else N.current?N.current.stop():L.current?await B():(a(!1),y("idle"))},[B]),ie=T.useCallback(async()=>{var k;W.current=!1,o(""),c(""),m(null),y("idle");const{available:M}=await Li.available();if(!M){m("当前设备不支持语音识别");return}if((await Li.requestPermissions()).speechRecognition!=="granted"){m("请允许语音识别权限");return}const Z=[];Z.push(await Li.addListener("partialResults",P=>{c(P.matches[0]??"")})),Z.push(await Li.addListener("listeningState",P=>{const J=P.status==="started";a(J),J&&y("recording"),J||c("")})),A.current=Z;try{const P=await Li.start({language:e,partialResults:!0,maxResults:1});(k=P.matches)!=null&&k.length&&o(J=>J+P.matches.join(""))}catch(P){m(`语音识别错误:${P instanceof Error?P.message:String(P)}`);for(const J of Z)await J.remove().catch(()=>{});A.current=[]}},[e]),be=T.useCallback(()=>{if(!Ym)return!1;W.current=!1,o(""),c(""),R.current="",m(null),y("idle"),S.current=!1;const M=new Ym;M.lang=e,M.continuous=!0,M.interimResults=!0,M.maxAlternatives=1,M.onstart=()=>{a(!0),y("recording"),C.current=!1,v.current=setTimeout(()=>{!C.current&&!S.current&&(D.current=!0,S.current=!0,M.stop(),m("语音识别服务不可用(Chrome/Edge 需连接 Google 服务器),下次将使用服务端识别"))},5e3)},M.onresult=F=>{C.current=!0,v.current&&(clearTimeout(v.current),v.current=null);let Z="",k="";for(let P=F.resultIndex;P<F.results.length;P++){const J=F.results[P][0].transcript;F.results[P].isFinal?Z+=J:k+=J}Z&&o(P=>P+Z),c(k),R.current=k},M.onerror=F=>{switch(F.error!=="no-speech"&&F.error!=="aborted"&&(S.current=!0),F.error){case"not-allowed":m("请允许麦克风权限");break;case"network":m("网络错误,请检查连接");break;case"no-speech":case"aborted":return;default:m(`语音识别错误:${F.error}`)}},M.onend=()=>{if(S.current&&R.current&&o(F=>F+R.current),c(""),R.current="",!S.current)try{M.start();return}catch{}a(!1),N.current=null},N.current=M;try{return M.start(),!0}catch{return!1}},[e]),te=T.useCallback(async()=>{W.current=!1,o(""),c(""),m(null),y("idle");try{const P=await fetch("/api/transcribe/status"),{available:J}=await P.json();if(!J){m("语音识别服务未就绪,请稍后重试");return}}catch{m("无法连接语音识别服务");return}let M;try{M=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:Gm,channelCount:1}})}catch{m("请允许麦克风权限");return}const F=new AudioContext({sampleRate:Gm}),Z=F.createMediaStreamSource(M),k=F.createScriptProcessor(4096,1,1);$.current=[],k.onaudioprocess=P=>{$.current.push(new Float32Array(P.inputBuffer.getChannelData(0)))},Z.connect(k),k.connect(F.destination),L.current=F,I.current=M,H.current=k,a(!0),y("recording")},[]),G=T.useCallback(()=>{Nh?ie():Ym&&!D.current&&be()||te()},[ie,be,te]);T.useEffect(()=>{if(!t){b(0);return}if(N.current)return;let M=!1,F=null,Z=null,k=0;return(async()=>{try{if(F=await navigator.mediaDevices.getUserMedia({audio:!0}),M){F.getTracks().forEach(j=>j.stop());return}Z=new AudioContext;const P=Z.createMediaStreamSource(F),J=Z.createAnalyser();J.fftSize=256,P.connect(J);const w=new Uint8Array(J.frequencyBinCount);let de=0;const Ne=()=>{if(M)return;J.getByteFrequencyData(w);const j=performance.now();if(j-de>80){let he=0;for(let ke=0;ke<w.length;ke++)he+=w[ke];b(he/(w.length*255)),de=j}k=requestAnimationFrame(Ne)};k=requestAnimationFrame(Ne)}catch{}})(),()=>{M=!0,cancelAnimationFrame(k),F==null||F.getTracks().forEach(P=>P.stop()),Z==null||Z.close().catch(()=>{}),b(0)}},[t]),T.useEffect(()=>{!t&&g==="recording"&&y(r?"done":"idle")},[t,g,r]),T.useEffect(()=>()=>{var M,F,Z,k;S.current=!0,(M=N.current)==null||M.stop(),(F=H.current)==null||F.disconnect(),(Z=I.current)==null||Z.getTracks().forEach(P=>P.stop()),(k=L.current)==null||k.close().catch(()=>{});for(const P of A.current)P.remove().catch(()=>{})},[]);const q=T.useCallback(()=>{W.current=!0,o(""),c(""),R.current="",y("idle")},[]);return{isSupported:K,isListening:t,phase:g,transcript:r,interimTranscript:u,error:f,volumeLevel:h,start:G,stop:ne,resetTranscript:q}}const J6=240,eM=1e3;function dT(e){const t=Z6(),[a,r]=T.useState(""),[o,u]=T.useState(0),c=T.useRef(null),f=T.useRef(null),m=T.useRef(0);T.useEffect(()=>(t.phase==="recording"?(m.current=Date.now(),u(0),f.current=setInterval(()=>{u(Math.floor((Date.now()-m.current)/1e3))},eM)):f.current&&(clearInterval(f.current),f.current=null),()=>{f.current&&(clearInterval(f.current),f.current=null)}),[t.phase]),T.useEffect(()=>{t.phase==="done"&&(r(t.transcript),requestAnimationFrame(()=>{const y=c.current;y&&(y.focus(),y.setSelectionRange(y.value.length,y.value.length))}))},[t.phase,t.transcript]),T.useLayoutEffect(()=>{if(t.phase!=="done")return;const y=c.current;y&&(y.style.height="auto",y.style.height=`${Math.min(y.scrollHeight,J6)}px`)},[t.phase,a]);const h=T.useCallback(()=>{t.stop(),t.resetTranscript(),r("")},[t]),b=T.useCallback(async()=>{const y=a.trim();if(!y){h();return}await e(y)!==!1&&(t.resetTranscript(),r(""))},[a,e,h,t]);T.useEffect(()=>{if(t.phase==="idle")return;const y=N=>{if(N.key==="Escape"&&t.phase!=="recognizing"){N.preventDefault(),h();return}if(t.phase==="done"&&N.key==="Enter"&&(N.metaKey||N.ctrlKey)){if(N.isComposing)return;N.preventDefault(),b()}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t.phase,h,b]);const g=T.useCallback(y=>{y.nativeEvent.isComposing||y.keyCode===229||y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),b())},[b]);return{stt:t,editText:a,setEditText:r,elapsed:o,textareaRef:c,cancel:h,confirm:b,handleTextareaKeyDown:g}}const or=es(e=>({agents:[],loaded:!1,loadAgents:async()=>{const t=Pe.getState().activeRepoId;try{const a=t?await By(t):await Dy();e({agents:a,loaded:!0})}catch{e({loaded:!0})}}}));function tM(e){if(typeof e!="string")return e;const t=e.trim();if(t)try{return JSON.parse(t)}catch{return t}}function gn(e){return e&&typeof e=="object"?e:null}function Kr(e){const t=gn(e);return t&&"properties"in t?t.properties:e}function nM(e){const t=gn(e);return typeof(t==null?void 0:t.type)=="string"?t.type:void 0}function aM(e){const t=gn(Kr(e));if(!t)return null;const a=gn(t.info);if(a&&typeof a.id=="string"){const o=Array.isArray(t.parts)?t.parts:void 0;return{...a,...o?{parts:o}:{}}}if(typeof t.id=="string"&&typeof t.role=="string")return t;const r=gn(t.message);return r&&typeof r.id=="string"?r:null}function sM(e){const t=gn(Kr(e));if(!t)return{};const a=gn(t.part)??t;return typeof a.type!="string"?{}:{messageId:typeof a.messageID=="string"&&a.messageID||typeof a.messageId=="string"&&a.messageId||typeof t.messageID=="string"&&t.messageID||typeof t.messageId=="string"&&t.messageId||void 0,part:a}}function rM(e){const t=gn(Kr(e));if(!t||t.field!=="text")return null;const a=typeof t.messageID=="string"?t.messageID:null,r=typeof t.partID=="string"?t.partID:null,o=typeof t.delta=="string"?t.delta:null;return!a||!r||o===null?null:{messageId:a,partId:r,delta:o}}function iM(e){const t=Kr(e);if(Array.isArray(t))return t;const a=gn(t);return a&&Array.isArray(a.todos)?a.todos:[]}function Xa(e){return typeof e=="number"?e:0}function lM(e){const t=gn(Kr(e));if(!t||typeof t.id!="string")return null;const a={id:t.id};typeof t.title=="string"&&(a.title=t.title),typeof t.agent=="string"&&(a.agent=t.agent),typeof t.cost=="number"&&(a.cost=t.cost);const r=typeof t.parentID=="string"?t.parentID:typeof t.parent_id=="string"?t.parent_id:void 0;r&&(a.parentID=r);const o=gn(t.tokens),u=typeof t.tokens_input=="number"||typeof t.tokens_output=="number";if(o||u){const f=o?gn(o.cache):null;a.tokens={input:Xa(o==null?void 0:o.input)||Xa(t.tokens_input),output:Xa(o==null?void 0:o.output)||Xa(t.tokens_output),reasoning:Xa(o==null?void 0:o.reasoning)||Xa(t.tokens_reasoning),cache:{read:Xa(f==null?void 0:f.read)||Xa(t.tokens_cache_read),write:Xa(f==null?void 0:f.write)||Xa(t.tokens_cache_write)}}}const c=gn(t.model);return c&&(a.model={providerID:typeof c.providerID=="string"?c.providerID:void 0,modelID:typeof c.modelID=="string"?c.modelID:void 0,variant:typeof c.variant=="string"?c.variant:void 0}),a}function oM(e){const t=gn(Kr(e));if(!t)return null;if(typeof t.message=="string")return t.message;const a=gn(t.error);if(a){const r=gn(a.data);if(typeof(r==null?void 0:r.message)=="string")return`${a.name??"Error"}: ${r.message}`;if(typeof a.message=="string")return`${a.name??"Error"}: ${a.message}`;if(typeof a.name=="string")return String(a.name)}return typeof t.reason=="string"?t.reason:null}function uM(e){const t=Kr(e);if(typeof t=="string")return t;const a=gn(t);if(typeof(a==null?void 0:a.status)=="string")return a.status;const r=gn(a==null?void 0:a.status);return typeof(r==null?void 0:r.type)=="string"?r.type:typeof(a==null?void 0:a.type)=="string"?a.type:null}function cM(e,t,a,r){switch(e==="message"||e===""?nM(t)??e:e){case"message.updated":{const u=aM(t);u&&r.updateMessage(a,u);break}case"session.updated":{const u=lM(t);u&&r.updateSessionInfo(u);break}case"message.part.updated":{const{messageId:u,part:c}=sM(t);c&&u&&r.updateMessagePart(a,u,c);break}case"message.part.delta":{const u=rM(t);u&&r.appendMessagePartDelta(a,u.messageId,u.partId,u.delta);break}case"todo.updated":{r.updateTodos(a,iM(t));break}case"session.status":{const u=uM(t);u&&r.setSessionStatus(a,u);break}case"session.idle":{r.setSessionStatus(a,"idle");break}case"session.error":{const u=oM(t);r.setSessionStatus(a,"error",u??void 0);break}}}const dM=600*1e3;class fM{constructor(t,a){ln(this,"sessionId");ln(this,"idleTimer",null);ln(this,"active",!1);ln(this,"alive",!0);ln(this,"callbacks");this.sessionId=t,this.callbacks=a,this.resetIdleTimer()}dispatch(t,a){if(!this.alive)return;this.resetIdleTimer();const r=Oe.getState();cM(t,a,this.sessionId,r)}activate(){this.active=!0,this.clearIdleTimer()}deactivate(){this.active=!1,this.resetIdleTimer()}refreshOnIdle(){Oe.getState().refreshSessionData(this.sessionId)}stop(){this.alive=!1,this.clearIdleTimer()}resetIdleTimer(){this.clearIdleTimer(),!this.active&&(this.idleTimer=setTimeout(()=>{this.callbacks.onWorkerIdle(this.sessionId)},dM))}clearIdleTimer(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}}const mM=1e3,hM=3e4;class pM{constructor(t,a){ln(this,"source",null);ln(this,"reconnectTimer",null);ln(this,"attempts",0);ln(this,"disposed",!1);ln(this,"repoId");ln(this,"onEvent");this.repoId=t,this.onEvent=a}start(){this.connect()}stop(){var t;this.disposed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.source)==null||t.close(),this.source=null}connect(){if(this.disposed)return;const t=MC(this.repoId),a=new EventSource(t);this.source=a,a.onopen=()=>{this.attempts=0},a.onmessage=o=>{this.handleRaw("message",o)};const r=["message.updated","message.part.updated","message.part.delta","message.removed","todo.updated","session.status","session.idle","session.error","session.updated"];for(const o of r)a.addEventListener(o,u=>{this.handleRaw(o,u)});a.onerror=()=>{if(!(this.disposed||!this.source)&&this.source.readyState===EventSource.CLOSED){this.source.close(),this.source=null;const o=Math.min(mM*2**this.attempts,hM);this.attempts++,this.reconnectTimer=setTimeout(()=>this.connect(),o)}}}handleRaw(t,a){if(!(a instanceof MessageEvent))return;const r=tM(a.data);if(r===void 0)return;const o=this.extractSessionId(r);if(!o)return;let u=t;if(t==="message"||t===""){const c=r&&typeof r=="object"?r:null;typeof(c==null?void 0:c.type)=="string"&&(u=c.type)}this.onEvent(o,u,r)}extractSessionId(t){if(!t||typeof t!="object")return null;const a=t;if(a.properties&&typeof a.properties=="object"){const r=a.properties;if(typeof r.sessionID=="string")return r.sessionID;if(typeof r.id=="string")return r.id}return typeof a.sessionID=="string"?a.sessionID:typeof a.sessionId=="string"?a.sessionId:null}}const gM=6e4;class bM{constructor(t){ln(this,"timer",null);ln(this,"paused",!1);ln(this,"callbacks");this.callbacks=t}start(){this.tick(),this.timer=setInterval(()=>{this.paused||this.tick()},gM)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null)}pause(){this.paused=!0}resume(){this.paused=!1,this.tick()}tick(){const t=Pe.getState().activeRepoId;t&&(Oe.getState().loadSessions(),DC(t).then(a=>{const r={};for(const[o,u]of Object.entries(a))r[o]=u.type??"idle";Oe.getState().bulkSetStatuses(r);for(const[o,u]of Object.entries(r))(u==="busy"||u==="retry")&&this.callbacks.ensureWorker(o)}).catch(()=>{}))}}class xM{constructor(){ln(this,"workers",new Map);ln(this,"dispatcher",null);ln(this,"supervisor",null);ln(this,"visibilityHandler",null)}start(t){this.stop();const a={onWorkerIdle:r=>this.removeWorker(r)};this.dispatcher=new pM(t,(r,o,u)=>{const c=this.ensureWorker(r,a);if(o==="session.idle"||o==="session.status"){const f=Oe.getState().sessionStatuses[r];c.dispatch(o,u);const m=Oe.getState().sessionStatuses[r];f&&f!=="idle"&&m==="idle"&&c.refreshOnIdle()}else c.dispatch(o,u)}),this.dispatcher.start(),this.supervisor=new bM({ensureWorker:r=>this.ensureWorker(r,a)}),this.supervisor.start(),this.visibilityHandler=()=>{var r,o;document.hidden?(r=this.supervisor)==null||r.pause():(o=this.supervisor)==null||o.resume()},document.addEventListener("visibilitychange",this.visibilityHandler)}stop(){var t,a;(t=this.dispatcher)==null||t.stop(),this.dispatcher=null,(a=this.supervisor)==null||a.stop(),this.supervisor=null;for(const r of this.workers.values())r.stop();this.workers.clear(),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null)}activateSession(t){for(const o of this.workers.values())o.sessionId!==t&&o.deactivate();if(!t)return;const a={onWorkerIdle:o=>this.removeWorker(o)};this.ensureWorker(t,a).activate(),Oe.getState().refreshSessionData(t)}deactivateSession(t){var a;(a=this.workers.get(t))==null||a.deactivate()}ensureWorker(t,a){let r=this.workers.get(t);return r||(r=new fM(t,a),this.workers.set(t,r)),r}removeWorker(t){const a=Oe.getState().activeSessionId;if(t===a)return;const r=this.workers.get(t);r&&(r.stop(),this.workers.delete(t))}}const Lc=new xM,Y1=(function(e,t,a){const r=Lo(a);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Vr=(function(e){if(e==null)return NM;if(typeof e=="string")return yM(e);if(typeof e=="object")return EM(e);if(typeof e=="function")return gp(e);throw new Error("Expected function, string, or array as `test`")});function EM(e){const t=[];let a=-1;for(;++a<e.length;)t[a]=Vr(e[a]);return gp(r);function r(...o){let u=-1;for(;++u<t.length;)if(t[u].apply(this,o))return!0;return!1}}function yM(e){return gp(t);function t(a){return a.tagName===e}}function gp(e){return t;function t(a,r,o){return!!(TM(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function NM(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function TM(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const G1=/\n/g,K1=/[\t ]+/g,Th=Vr("br"),V1=Vr(RM),_M=Vr("p"),X1=Vr("tr"),vM=Vr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",kM,OM]),fT=Vr(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function SM(e,t){const a=t||{},r="children"in e?e.children:[],o=fT(e),u=pT(e,{whitespace:a.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...hT(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...mT(r[f],e,{whitespace:u,breakBefore:f?void 0:o,breakAfter:f<r.length-1?Th(r[f+1]):o}));const m=[];let h;for(f=-1;++f<c.length;){const b=c[f];typeof b=="number"?h!==void 0&&b>h&&(h=b):b&&(h!==void 0&&h>-1&&m.push(`
|
|
493
|
+
`),o=String(r.length).length;return i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm md:p-8",children:i.jsxs("div",{onClick:u=>u.stopPropagation(),className:"flex max-h-full w-full max-w-4xl flex-col overflow-hidden rounded-lg border border-line bg-term",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-line px-4 py-2",children:[i.jsx("span",{className:"font-mono text-xs text-fg-3",children:t}),i.jsx("button",{type:"button",onClick:a,className:"text-fg-5 hover:text-fg-2",children:i.jsx(mt,{className:"h-4 w-4"})})]}),i.jsx("pre",{className:"overflow-auto p-4 font-mono text-xs leading-relaxed text-fg-2",children:r.map((u,c)=>i.jsxs("div",{children:[i.jsx("span",{className:"mr-3 inline-block select-none text-right text-fg-6",style:{width:`${o}ch`},children:c+1}),u]},c))})]})})}function D6({fold:e,index:t,onRemove:a}){const[r,o]=T.useState(!1),u=`粘贴文本 #${t} · ${e.lineCount}行 · ${R6(e.byteSize)}`;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"group relative flex items-center gap-1.5 rounded-md border border-line bg-elevated/50 px-2.5 py-1.5",children:[i.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex items-center gap-1.5 font-mono text-xs text-fg-3 transition-colors hover:text-fg",children:[i.jsx(Xc,{className:"h-3.5 w-3.5 shrink-0 text-fg-5"}),i.jsx("span",{children:u})]}),i.jsx("button",{type:"button",onClick:a,"aria-label":"移除粘贴文本",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-fg-5 transition-colors hover:text-fg-2",children:i.jsx(mt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]}),r&&i.jsx(M6,{text:e.text,label:u,onClose:()=>o(!1)})]})}function iT({onFiles:e,disabled:t,allowed:a}){const r=T.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:r,type:"file",accept:nT.join(","),multiple:!0,hidden:!0,onChange:o=>{e(Array.from(o.target.files??[])),o.target.value=""}}),i.jsx("button",{type:"button",onClick:()=>{var o;return(o=r.current)==null?void 0:o.click()},disabled:t||!a,"aria-label":"Attach image",title:a?"附加图片":"当前模型不支持图片",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-fg-5 transition-colors duration-150 hover:text-fg-3 disabled:cursor-not-allowed disabled:text-fg-6/40",children:i.jsx(k3,{className:"h-4 w-4"})})]})}function lT({attachments:e,foldedTexts:t,error:a,onRemove:r,onRemoveFoldedText:o,className:u}){const c=e.length>0||(t??[]).length>0;return!c&&!a?null:i.jsxs("div",{className:u,children:[c&&i.jsxs("div",{className:"mb-2 flex flex-wrap gap-2",children:[e.map(f=>i.jsxs("div",{className:"group relative",children:[i.jsx(sT,{url:f.url,label:f.filename??"attachment",className:"h-16 w-16 object-cover"}),i.jsx("button",{type:"button",onClick:()=>r(f._id),"aria-label":"Remove attachment",className:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-line bg-term text-fg-4 opacity-0 transition-opacity duration-150 hover:text-fg-2 group-hover:opacity-100",children:i.jsx(mt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]},f._id)),(t??[]).map((f,m)=>i.jsx(D6,{fold:f,index:m+1,onRemove:()=>o==null?void 0:o(f._id)},f._id))]}),a&&i.jsx("div",{className:"mb-2 font-mono text-[11px] text-red-400",children:a})]})}function oT({isListening:e,disabled:t,onStart:a,onStop:r}){const o=T.useRef(!1),u=f=>{if(t)return;f.preventDefault(),o.current=!0,a();const m=()=>{document.removeEventListener("touchend",m),document.removeEventListener("touchcancel",m),o.current=!1,r()};document.addEventListener("touchend",m,{once:!0}),document.addEventListener("touchcancel",m,{once:!0})},c=()=>{if(t||o.current)return;a();const f=()=>{document.removeEventListener("mouseup",f),r()};document.addEventListener("mouseup",f,{once:!0})};return i.jsx("button",{type:"button",disabled:t,onTouchStart:u,onMouseDown:c,onContextMenu:f=>f.preventDefault(),"aria-label":"按住说话",title:"按住说话",style:{WebkitTouchCallout:"none"},className:ae("flex shrink-0 select-none touch-none items-center justify-center transition-colors duration-150 disabled:cursor-not-allowed disabled:text-fg-6/40","order-first self-stretch w-12 rounded-xl sm:order-none sm:self-auto sm:h-7 sm:w-7 sm:rounded-md",e?"bg-red-500/15 text-red-400 hover:bg-red-500/25":"text-fg-5 hover:text-fg-3"),children:i.jsx(H3,{className:ae("h-6 w-6 sm:h-4 sm:w-4",e&&"animate-pulse")})})}const L6=[.85,1.25,.65,1.4,.75,1.15,.95],$m=4,U1=24;function j6(e){const t=Math.floor(e/60).toString().padStart(2,"0"),a=Math.floor(e%60).toString().padStart(2,"0");return`${t}:${a}`}function B6({volumeLevel:e}){const t=Math.min(Math.max(e,0),1);return i.jsx("div",{className:"flex h-6 items-center gap-1","aria-hidden":"true",children:L6.map((a,r)=>{const o=$m+t*a*(U1-$m),u=Math.max($m,Math.min(U1,o));return i.jsx("span",{className:"w-1 rounded-full bg-red-400 transition-[height] duration-150 ease-out",style:{height:`${u}px`}},r)})})}function uT({phase:e,transcript:t,interimTranscript:a,editText:r,onEditTextChange:o,onTextareaKeyDown:u,textareaRef:c,wrapperClassName:f}){if(e==="idle")return null;const m=t.length>0||a.length>0;return i.jsx("div",{className:f,children:i.jsxs("div",{className:"max-h-[40vh] overflow-y-auto px-4 py-4",children:[e==="recording"&&i.jsx("div",{className:"text-xl leading-relaxed",children:m?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-fg",children:t}),a&&i.jsx("span",{className:"text-fg-4",children:a})]}):i.jsx("span",{className:"italic text-fg-5",children:"正在聆听…"})}),e==="recognizing"&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(un,{className:"h-5 w-5 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-sm text-emerald-400",children:"识别中…"}),a&&i.jsx("span",{className:"truncate text-base text-fg-4",children:a})]}),e==="done"&&i.jsx("textarea",{ref:c,value:r,onChange:h=>o(h.target.value),onKeyDown:u,rows:2,placeholder:"识别结果(可编辑)",className:"w-full resize-none bg-transparent text-xl leading-relaxed text-fg placeholder:text-fg-5 focus:outline-none"})]})})}function cT({phase:e,volumeLevel:t,elapsed:a,editText:r,error:o,onCancel:u,onConfirm:c,idleHint:f,className:m}){return e==="idle"?i.jsx("div",{className:m,children:o?i.jsx("span",{className:"font-mono text-[10px] text-red-400",children:o}):f?i.jsx("span",{className:"font-mono text-[10px] text-fg-6",children:f}):null}):e==="done"?i.jsxs("div",{className:m,children:[i.jsx("span",{className:"hidden font-mono text-[10px] text-fg-6 sm:inline",children:"⌘/Ctrl+⏎ 发送 · Esc 取消"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:u,className:"rounded-md border border-line px-3 py-1 text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),i.jsxs("button",{type:"button",onClick:c,disabled:r.trim().length===0,"aria-label":"发送",className:"flex items-center gap-1.5 rounded-md bg-emerald-600 px-3 py-1 text-xs font-medium text-white transition-colors hover:bg-emerald-500 disabled:cursor-not-allowed disabled:bg-fg-6/30 disabled:text-fg-5",children:[i.jsx(Eo,{className:"h-3.5 w-3.5",strokeWidth:2.5}),i.jsx("span",{children:"发送"})]})]})]}):i.jsx("div",{className:m,children:e==="recording"?i.jsxs(i.Fragment,{children:[i.jsx(B6,{volumeLevel:t}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] font-medium text-red-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-red-400"}),"录音中"]}),i.jsx("span",{className:"font-mono text-[11px] tabular-nums text-fg-4",children:j6(a)})]}):i.jsxs(i.Fragment,{children:[i.jsx(un,{className:"h-4 w-4 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-[11px] text-emerald-400",children:"识别中…"})]})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Ki;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Ki||(Ki={}));class qm extends Error{constructor(t,a,r){super(t),this.message=t,this.code=a,this.data=r}}const P6=e=>{var t,a;return e!=null&&e.androidBridge?"android":!((a=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||a===void 0)&&a.bridge?"ios":"web"},U6=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},r=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:P6(e),u=()=>o()!=="web",c=g=>{const y=h.get(g);return!!(y!=null&&y.platforms.has(o())||f(g))},f=g=>{var y;return(y=a.PluginHeaders)===null||y===void 0?void 0:y.find(N=>N.name===g)},m=g=>e.console.error(g),h=new Map,b=(g,y={})=>{const N=h.get(g);if(N)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),N.proxy;const S=o(),A=f(g);let C;const v=async()=>(!C&&S in y?C=typeof y[S]=="function"?C=await y[S]():C=y[S]:t!==null&&!C&&"web"in y&&(C=typeof y.web=="function"?C=await y.web():C=y.web),C),D=(W,K)=>{var B,ne;if(A){const ie=A==null?void 0:A.methods.find(be=>K===be.name);if(ie)return ie.rtype==="promise"?be=>a.nativePromise(g,K.toString(),be):(be,te)=>a.nativeCallback(g,K.toString(),be,te);if(W)return(B=W[K])===null||B===void 0?void 0:B.bind(W)}else{if(W)return(ne=W[K])===null||ne===void 0?void 0:ne.bind(W);throw new qm(`"${g}" plugin is not implemented on ${S}`,Ki.Unimplemented)}},R=W=>{let K;const B=(...ne)=>{const ie=v().then(be=>{const te=D(be,W);if(te){const G=te(...ne);return K=G==null?void 0:G.remove,G}else throw new qm(`"${g}.${W}()" is not implemented on ${S}`,Ki.Unimplemented)});return W==="addListener"&&(ie.remove=async()=>K()),ie};return B.toString=()=>`${W.toString()}() { [capacitor code] }`,Object.defineProperty(B,"name",{value:W,writable:!1,configurable:!1}),B},L=R("addListener"),I=R("removeListener"),H=(W,K)=>{const B=L({eventName:W},K),ne=async()=>{const be=await B;I({eventName:W,callbackId:be},K)},ie=new Promise(be=>B.then(()=>be({remove:ne})));return ie.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ne()},ie},$=new Proxy({},{get(W,K){switch(K){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return A?H:L;case"removeListener":return I;default:return R(K)}}});return r[g]=$,h.set(g,{name:g,proxy:$,platforms:new Set([...Object.keys(y),...A?[S]:[]])}),$};return a.convertFileSrc||(a.convertFileSrc=g=>g),a.getPlatform=o,a.handleError=m,a.isNativePlatform=u,a.isPluginAvailable=c,a.registerPlugin=b,a.Exception=qm,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},H6=e=>e.Capacitor=U6(e),Dc=H6(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Po=Dc.registerPlugin;class pp{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,a){let r=!1;this.listeners[t]||(this.listeners[t]=[],r=!0),this.listeners[t].push(a);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),r&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,a);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,a,r){const o=this.listeners[t];if(!o){if(r){let u=this.retainedEventArguments[t];u||(u=[]),u.push(a),this.retainedEventArguments[t]=u}return}o.forEach(u=>u(a))}hasListeners(t){var a;return!!(!((a=this.listeners[t])===null||a===void 0)&&a.length)}registerWindowListener(t,a){this.windowListeners[a]={registered:!1,windowEventName:t,pluginEventName:a,handler:r=>{this.notifyListeners(a,r)}}}unimplemented(t="not implemented"){return new Dc.Exception(t,Ki.Unimplemented)}unavailable(t="not available"){return new Dc.Exception(t,Ki.Unavailable)}async removeListener(t,a){const r=this.listeners[t];if(!r)return;const o=r.indexOf(a);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const a=this.retainedEventArguments[t];a&&(delete this.retainedEventArguments[t],a.forEach(r=>{this.notifyListeners(t,r)}))}}const H1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),F1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class F6 extends pp{async getCookies(){const t=document.cookie,a={};return t.split(";").forEach(r=>{if(r.length<=0)return;let[o,u]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=F1(o).trim(),u=F1(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=H1(t.key),r=H1(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${a}=${r||""}${o}; path=${u}; ${c};`}catch(a){return Promise.reject(a)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(a){return Promise.reject(a)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const a of t)document.cookie=a.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}Po("CapacitorCookies",{web:()=>new F6});const z6=async e=>new Promise((t,a)=>{const r=new FileReader;r.onload=()=>{const o=r.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},r.onerror=o=>a(o),r.readAsDataURL(e)}),$6=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,c)=>(o[u]=e[t[c]],o),{})},q6=(e,t=!0)=>e?Object.entries(e).reduce((r,o)=>{const[u,c]=o;let f,m;return Array.isArray(c)?(m="",c.forEach(h=>{f=t?encodeURIComponent(h):h,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=t?encodeURIComponent(c):c,m=`${u}=${f}`),`${r}&${m}`},"").substr(1):null,Y6=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=$6(e.headers)["content-type"]||"";if(typeof e.data=="string")a.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);a.body=u.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,m)=>{u.append(m,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);a.body=u;const c=new Headers(a.headers);c.delete("content-type"),a.headers=c}else(o.includes("application/json")||typeof e.data=="object")&&(a.body=JSON.stringify(e.data));return a};class G6 extends pp{async request(t){const a=Y6(t,t.webFetchExtra),r=q6(t.params,t.shouldEncodeUrlParams),o=r?`${t.url}?${r}`:t.url,u=await fetch(o,a),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let m,h;switch(f){case"arraybuffer":case"blob":h=await u.blob(),m=await z6(h);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const b={};return u.headers.forEach((g,y)=>{b[y]=g}),{data:m,headers:b,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}Po("CapacitorHttp",{web:()=>new G6});var z1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(z1||(z1={}));var $1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})($1||($1={}));class K6 extends pp{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}Po("SystemBars",{web:()=>new K6});const V6="modulepreload",X6=function(e){return"/"+e},q1={},Q6=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let c=function(h){return Promise.all(h.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=c(a.map(h=>{if(h=X6(h),h in q1)return;q1[h]=!0;const b=h.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const y=document.createElement("link");if(y.rel=b?"stylesheet":V6,b||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),b)return new Promise((N,S)=>{y.addEventListener("load",N),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return o.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},Li=Po("SpeechRecognition",{web:()=>Q6(()=>import("./web-BUhORaxp.js"),[]).then(e=>new e.SpeechRecognitionWeb)});function W6(e,t){const a=e.length,r=new ArrayBuffer(44+a*2),o=new DataView(r),u=(c,f)=>{for(let m=0;m<f.length;m++)o.setUint8(c+m,f.charCodeAt(m))};u(0,"RIFF"),o.setUint32(4,36+a*2,!0),u(8,"WAVE"),u(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,t*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),u(36,"data"),o.setUint32(40,a*2,!0);for(let c=0;c<a;c++){const f=Math.max(-1,Math.min(1,e[c]));o.setInt16(44+c*2,f<0?f*32768:f*32767,!0)}return new Blob([r],{type:"audio/wav"})}const Nh=Dc.isNativePlatform(),Ym=!Nh&&typeof window<"u"?window.SpeechRecognition??window.webkitSpeechRecognition:void 0,Gm=16e3;function Z6(e="zh-CN"){const[t,a]=T.useState(!1),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(null),[h,b]=T.useState(0),[g,y]=T.useState("idle"),N=T.useRef(null),S=T.useRef(!1),A=T.useRef([]),C=T.useRef(!1),v=T.useRef(null),D=T.useRef(!1),R=T.useRef(""),L=T.useRef(null),I=T.useRef(null),H=T.useRef(null),$=T.useRef([]),W=T.useRef(!1),K=!0,B=T.useCallback(async()=>{var w,de,Ne;(w=H.current)==null||w.disconnect(),(de=I.current)==null||de.getTracks().forEach(j=>j.stop()),await((Ne=L.current)==null?void 0:Ne.close().catch(()=>{}));const M=$.current;if($.current=[],H.current=null,I.current=null,L.current=null,M.length===0||W.current){a(!1),y("idle");return}c("识别中…"),y("recognizing");const F=M.reduce((j,he)=>j+he.length,0),Z=new Float32Array(F);let k=0;for(const j of M)Z.set(j,k),k+=j.length;const P=W6(Z,Gm),J=new FormData;J.append("audio",P,"recording.wav");try{const j=await fetch("/api/transcribe",{method:"POST",body:J});if(W.current)return;if(j.ok){const{text:he}=await j.json();he?(o(he),y("done")):y("idle")}else{const he=await j.json().catch(()=>({error:`HTTP ${j.status}`}));m(he.error??`HTTP ${j.status}`),y("idle")}}catch(j){m(`语音识别失败:${j instanceof Error?j.message:String(j)}`),y("idle")}finally{c(""),a(!1)}},[]),ne=T.useCallback(async()=>{if(S.current=!0,v.current&&(clearTimeout(v.current),v.current=null),Nh){await Li.stop().catch(()=>{});for(const M of A.current)await M.remove().catch(()=>{});A.current=[],a(!1),c("")}else N.current?N.current.stop():L.current?await B():(a(!1),y("idle"))},[B]),ie=T.useCallback(async()=>{var k;W.current=!1,o(""),c(""),m(null),y("idle");const{available:M}=await Li.available();if(!M){m("当前设备不支持语音识别");return}if((await Li.requestPermissions()).speechRecognition!=="granted"){m("请允许语音识别权限");return}const Z=[];Z.push(await Li.addListener("partialResults",P=>{c(P.matches[0]??"")})),Z.push(await Li.addListener("listeningState",P=>{const J=P.status==="started";a(J),J&&y("recording"),J||c("")})),A.current=Z;try{const P=await Li.start({language:e,partialResults:!0,maxResults:1});(k=P.matches)!=null&&k.length&&o(J=>J+P.matches.join(""))}catch(P){m(`语音识别错误:${P instanceof Error?P.message:String(P)}`);for(const J of Z)await J.remove().catch(()=>{});A.current=[]}},[e]),be=T.useCallback(()=>{if(!Ym)return!1;W.current=!1,o(""),c(""),R.current="",m(null),y("idle"),S.current=!1;const M=new Ym;M.lang=e,M.continuous=!0,M.interimResults=!0,M.maxAlternatives=1,M.onstart=()=>{a(!0),y("recording"),C.current=!1,v.current=setTimeout(()=>{!C.current&&!S.current&&(D.current=!0,S.current=!0,M.stop(),m("语音识别服务不可用(Chrome/Edge 需连接 Google 服务器),下次将使用服务端识别"))},5e3)},M.onresult=F=>{C.current=!0,v.current&&(clearTimeout(v.current),v.current=null);let Z="",k="";for(let P=F.resultIndex;P<F.results.length;P++){const J=F.results[P][0].transcript;F.results[P].isFinal?Z+=J:k+=J}Z&&o(P=>P+Z),c(k),R.current=k},M.onerror=F=>{switch(F.error!=="no-speech"&&F.error!=="aborted"&&(S.current=!0),F.error){case"not-allowed":m("请允许麦克风权限");break;case"network":m("网络错误,请检查连接");break;case"no-speech":case"aborted":return;default:m(`语音识别错误:${F.error}`)}},M.onend=()=>{if(S.current&&R.current&&o(F=>F+R.current),c(""),R.current="",!S.current)try{M.start();return}catch{}a(!1),N.current=null},N.current=M;try{return M.start(),!0}catch{return!1}},[e]),te=T.useCallback(async()=>{W.current=!1,o(""),c(""),m(null),y("idle");try{const P=await fetch("/api/transcribe/status"),{available:J}=await P.json();if(!J){m("语音识别服务未就绪,请稍后重试");return}}catch{m("无法连接语音识别服务");return}let M;try{M=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:Gm,channelCount:1}})}catch{m("请允许麦克风权限");return}const F=new AudioContext({sampleRate:Gm}),Z=F.createMediaStreamSource(M),k=F.createScriptProcessor(4096,1,1);$.current=[],k.onaudioprocess=P=>{$.current.push(new Float32Array(P.inputBuffer.getChannelData(0)))},Z.connect(k),k.connect(F.destination),L.current=F,I.current=M,H.current=k,a(!0),y("recording")},[]),G=T.useCallback(()=>{Nh?ie():Ym&&!D.current&&be()||te()},[ie,be,te]);T.useEffect(()=>{if(!t){b(0);return}if(N.current)return;let M=!1,F=null,Z=null,k=0;return(async()=>{try{if(F=await navigator.mediaDevices.getUserMedia({audio:!0}),M){F.getTracks().forEach(j=>j.stop());return}Z=new AudioContext;const P=Z.createMediaStreamSource(F),J=Z.createAnalyser();J.fftSize=256,P.connect(J);const w=new Uint8Array(J.frequencyBinCount);let de=0;const Ne=()=>{if(M)return;J.getByteFrequencyData(w);const j=performance.now();if(j-de>80){let he=0;for(let ke=0;ke<w.length;ke++)he+=w[ke];b(he/(w.length*255)),de=j}k=requestAnimationFrame(Ne)};k=requestAnimationFrame(Ne)}catch{}})(),()=>{M=!0,cancelAnimationFrame(k),F==null||F.getTracks().forEach(P=>P.stop()),Z==null||Z.close().catch(()=>{}),b(0)}},[t]),T.useEffect(()=>{!t&&g==="recording"&&y(r?"done":"idle")},[t,g,r]),T.useEffect(()=>()=>{var M,F,Z,k;S.current=!0,(M=N.current)==null||M.stop(),(F=H.current)==null||F.disconnect(),(Z=I.current)==null||Z.getTracks().forEach(P=>P.stop()),(k=L.current)==null||k.close().catch(()=>{});for(const P of A.current)P.remove().catch(()=>{})},[]);const q=T.useCallback(()=>{W.current=!0,o(""),c(""),R.current="",y("idle")},[]);return{isSupported:K,isListening:t,phase:g,transcript:r,interimTranscript:u,error:f,volumeLevel:h,start:G,stop:ne,resetTranscript:q}}const J6=240,eM=1e3;function dT(e){const t=Z6(),[a,r]=T.useState(""),[o,u]=T.useState(0),c=T.useRef(null),f=T.useRef(null),m=T.useRef(0);T.useEffect(()=>(t.phase==="recording"?(m.current=Date.now(),u(0),f.current=setInterval(()=>{u(Math.floor((Date.now()-m.current)/1e3))},eM)):f.current&&(clearInterval(f.current),f.current=null),()=>{f.current&&(clearInterval(f.current),f.current=null)}),[t.phase]),T.useEffect(()=>{t.phase==="done"&&(r(t.transcript),requestAnimationFrame(()=>{const y=c.current;y&&(y.focus(),y.setSelectionRange(y.value.length,y.value.length))}))},[t.phase,t.transcript]),T.useLayoutEffect(()=>{if(t.phase!=="done")return;const y=c.current;y&&(y.style.height="auto",y.style.height=`${Math.min(y.scrollHeight,J6)}px`)},[t.phase,a]);const h=T.useCallback(()=>{t.stop(),t.resetTranscript(),r("")},[t]),b=T.useCallback(async()=>{const y=a.trim();if(!y){h();return}await e(y)!==!1&&(t.resetTranscript(),r(""))},[a,e,h,t]);T.useEffect(()=>{if(t.phase==="idle")return;const y=N=>{if(N.key==="Escape"&&t.phase!=="recognizing"){N.preventDefault(),h();return}if(t.phase==="done"&&N.key==="Enter"&&(N.metaKey||N.ctrlKey)){if(N.isComposing)return;N.preventDefault(),b()}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t.phase,h,b]);const g=T.useCallback(y=>{y.nativeEvent.isComposing||y.keyCode===229||y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),b())},[b]);return{stt:t,editText:a,setEditText:r,elapsed:o,textareaRef:c,cancel:h,confirm:b,handleTextareaKeyDown:g}}const or=es(e=>({agents:[],loaded:!1,loadAgents:async()=>{const t=Pe.getState().activeRepoId;try{const a=t?await By(t):await Dy();e({agents:a,loaded:!0})}catch{e({loaded:!0})}}}));function tM(e){if(typeof e!="string")return e;const t=e.trim();if(t)try{return JSON.parse(t)}catch{return t}}function gn(e){return e&&typeof e=="object"?e:null}function Kr(e){const t=gn(e);return t&&"properties"in t?t.properties:e}function nM(e){const t=gn(e);return typeof(t==null?void 0:t.type)=="string"?t.type:void 0}function aM(e){const t=gn(Kr(e));if(!t)return null;const a=gn(t.info);if(a&&typeof a.id=="string"){const o=Array.isArray(t.parts)?t.parts:void 0;return{...a,...o?{parts:o}:{}}}if(typeof t.id=="string"&&typeof t.role=="string")return t;const r=gn(t.message);return r&&typeof r.id=="string"?r:null}function sM(e){const t=gn(Kr(e));if(!t)return{};const a=gn(t.part)??t;return typeof a.type!="string"?{}:{messageId:typeof a.messageID=="string"&&a.messageID||typeof a.messageId=="string"&&a.messageId||typeof t.messageID=="string"&&t.messageID||typeof t.messageId=="string"&&t.messageId||void 0,part:a}}function rM(e){const t=gn(Kr(e));if(!t||t.field!=="text")return null;const a=typeof t.messageID=="string"?t.messageID:null,r=typeof t.partID=="string"?t.partID:null,o=typeof t.delta=="string"?t.delta:null;return!a||!r||o===null?null:{messageId:a,partId:r,delta:o}}function iM(e){const t=Kr(e);if(Array.isArray(t))return t;const a=gn(t);return a&&Array.isArray(a.todos)?a.todos:[]}function Xa(e){return typeof e=="number"?e:0}function lM(e){const t=gn(Kr(e));if(!t||typeof t.id!="string")return null;const a={id:t.id};typeof t.title=="string"&&(a.title=t.title),typeof t.agent=="string"&&(a.agent=t.agent),typeof t.cost=="number"&&(a.cost=t.cost);const r=typeof t.parentID=="string"?t.parentID:typeof t.parent_id=="string"?t.parent_id:void 0;r&&(a.parentID=r);const o=gn(t.tokens),u=typeof t.tokens_input=="number"||typeof t.tokens_output=="number";if(o||u){const f=o?gn(o.cache):null;a.tokens={input:Xa(o==null?void 0:o.input)||Xa(t.tokens_input),output:Xa(o==null?void 0:o.output)||Xa(t.tokens_output),reasoning:Xa(o==null?void 0:o.reasoning)||Xa(t.tokens_reasoning),cache:{read:Xa(f==null?void 0:f.read)||Xa(t.tokens_cache_read),write:Xa(f==null?void 0:f.write)||Xa(t.tokens_cache_write)}}}const c=gn(t.model);return c&&(a.model={providerID:typeof c.providerID=="string"?c.providerID:void 0,modelID:typeof c.modelID=="string"?c.modelID:void 0,variant:typeof c.variant=="string"?c.variant:void 0}),a}function oM(e){const t=gn(Kr(e));if(!t)return null;if(typeof t.message=="string")return t.message;const a=gn(t.error);if(a){const r=gn(a.data);if(typeof(r==null?void 0:r.message)=="string")return`${a.name??"Error"}: ${r.message}`;if(typeof a.message=="string")return`${a.name??"Error"}: ${a.message}`;if(typeof a.name=="string")return String(a.name)}return typeof t.reason=="string"?t.reason:null}function uM(e){const t=Kr(e);if(typeof t=="string")return t;const a=gn(t);if(typeof(a==null?void 0:a.status)=="string")return a.status;const r=gn(a==null?void 0:a.status);return typeof(r==null?void 0:r.type)=="string"?r.type:typeof(a==null?void 0:a.type)=="string"?a.type:null}function cM(e,t,a,r){switch(e==="message"||e===""?nM(t)??e:e){case"message.updated":{const u=aM(t);u&&r.updateMessage(a,u);break}case"session.updated":{const u=lM(t);u&&r.updateSessionInfo(u);break}case"message.part.updated":{const{messageId:u,part:c}=sM(t);c&&u&&r.updateMessagePart(a,u,c);break}case"message.part.delta":{const u=rM(t);u&&r.appendMessagePartDelta(a,u.messageId,u.partId,u.delta);break}case"todo.updated":{r.updateTodos(a,iM(t));break}case"session.status":{const u=uM(t);u&&r.setSessionStatus(a,u);break}case"session.idle":{r.setSessionStatus(a,"idle");break}case"session.error":{const u=oM(t);r.setSessionStatus(a,"error",u??void 0);break}}}const dM=600*1e3;class fM{constructor(t,a){ln(this,"sessionId");ln(this,"idleTimer",null);ln(this,"active",!1);ln(this,"alive",!0);ln(this,"callbacks");this.sessionId=t,this.callbacks=a,this.resetIdleTimer()}dispatch(t,a){if(!this.alive)return;this.resetIdleTimer();const r=Oe.getState();cM(t,a,this.sessionId,r)}activate(){this.active=!0,this.clearIdleTimer()}deactivate(){this.active=!1,this.resetIdleTimer()}refreshOnIdle(){Oe.getState().refreshSessionData(this.sessionId)}stop(){this.alive=!1,this.clearIdleTimer()}resetIdleTimer(){this.clearIdleTimer(),!this.active&&(this.idleTimer=setTimeout(()=>{this.callbacks.onWorkerIdle(this.sessionId)},dM))}clearIdleTimer(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}}const mM=1e3,hM=3e4;class pM{constructor(t,a){ln(this,"source",null);ln(this,"reconnectTimer",null);ln(this,"attempts",0);ln(this,"disposed",!1);ln(this,"repoId");ln(this,"onEvent");this.repoId=t,this.onEvent=a}start(){this.connect()}stop(){var t;this.disposed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.source)==null||t.close(),this.source=null}connect(){if(this.disposed)return;const t=MC(this.repoId),a=new EventSource(t);this.source=a,a.onopen=()=>{this.attempts=0},a.onmessage=o=>{this.handleRaw("message",o)};const r=["message.updated","message.part.updated","message.part.delta","message.removed","todo.updated","session.status","session.idle","session.error","session.updated"];for(const o of r)a.addEventListener(o,u=>{this.handleRaw(o,u)});a.onerror=()=>{if(!(this.disposed||!this.source)&&this.source.readyState===EventSource.CLOSED){this.source.close(),this.source=null;const o=Math.min(mM*2**this.attempts,hM);this.attempts++,this.reconnectTimer=setTimeout(()=>this.connect(),o)}}}handleRaw(t,a){if(!(a instanceof MessageEvent))return;const r=tM(a.data);if(r===void 0)return;const o=this.extractSessionId(r);if(!o)return;let u=t;if(t==="message"||t===""){const c=r&&typeof r=="object"?r:null;typeof(c==null?void 0:c.type)=="string"&&(u=c.type)}this.onEvent(o,u,r)}extractSessionId(t){if(!t||typeof t!="object")return null;const a=t;if(a.properties&&typeof a.properties=="object"){const r=a.properties;if(typeof r.sessionID=="string")return r.sessionID;if(typeof r.id=="string")return r.id}return typeof a.sessionID=="string"?a.sessionID:typeof a.sessionId=="string"?a.sessionId:null}}const gM=6e4;class bM{constructor(t){ln(this,"timer",null);ln(this,"paused",!1);ln(this,"callbacks");this.callbacks=t}start(){this.tick(),this.timer=setInterval(()=>{this.paused||this.tick()},gM)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null)}pause(){this.paused=!0}resume(){this.paused=!1,this.tick()}tick(){const t=Pe.getState().activeRepoId;t&&(Oe.getState().loadSessions(),DC(t).then(a=>{const r={};for(const[o,u]of Object.entries(a))r[o]=u.type??"idle";Oe.getState().bulkSetStatuses(r);for(const[o,u]of Object.entries(r))(u==="busy"||u==="retry")&&this.callbacks.ensureWorker(o)}).catch(()=>{}))}}class xM{constructor(){ln(this,"workers",new Map);ln(this,"dispatcher",null);ln(this,"supervisor",null);ln(this,"visibilityHandler",null)}start(t){this.stop();const a={onWorkerIdle:r=>this.removeWorker(r)};this.dispatcher=new pM(t,(r,o,u)=>{const c=this.ensureWorker(r,a);if(o==="session.idle"||o==="session.status"){const f=Oe.getState().sessionStatuses[r];c.dispatch(o,u);const m=Oe.getState().sessionStatuses[r];f&&f!=="idle"&&m==="idle"&&c.refreshOnIdle()}else c.dispatch(o,u)}),this.dispatcher.start(),this.supervisor=new bM({ensureWorker:r=>this.ensureWorker(r,a)}),this.supervisor.start(),this.visibilityHandler=()=>{var r,o;document.hidden?(r=this.supervisor)==null||r.pause():(o=this.supervisor)==null||o.resume()},document.addEventListener("visibilitychange",this.visibilityHandler)}stop(){var t,a;(t=this.dispatcher)==null||t.stop(),this.dispatcher=null,(a=this.supervisor)==null||a.stop(),this.supervisor=null;for(const r of this.workers.values())r.stop();this.workers.clear(),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null)}activateSession(t){for(const o of this.workers.values())o.sessionId!==t&&o.deactivate();if(!t)return;const a={onWorkerIdle:o=>this.removeWorker(o)};this.ensureWorker(t,a).activate(),Oe.getState().refreshSessionData(t)}deactivateSession(t){var a;(a=this.workers.get(t))==null||a.deactivate()}ensureWorker(t,a){let r=this.workers.get(t);return r||(r=new fM(t,a),this.workers.set(t,r)),r}removeWorker(t){const a=Oe.getState().activeSessionId;if(t===a)return;const r=this.workers.get(t);r&&(r.stop(),this.workers.delete(t))}}const Lc=new xM,Y1=(function(e,t,a){const r=Lo(a);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Vr=(function(e){if(e==null)return NM;if(typeof e=="string")return yM(e);if(typeof e=="object")return EM(e);if(typeof e=="function")return gp(e);throw new Error("Expected function, string, or array as `test`")});function EM(e){const t=[];let a=-1;for(;++a<e.length;)t[a]=Vr(e[a]);return gp(r);function r(...o){let u=-1;for(;++u<t.length;)if(t[u].apply(this,o))return!0;return!1}}function yM(e){return gp(t);function t(a){return a.tagName===e}}function gp(e){return t;function t(a,r,o){return!!(TM(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function NM(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function TM(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const G1=/\n/g,K1=/[\t ]+/g,Th=Vr("br"),V1=Vr(RM),_M=Vr("p"),X1=Vr("tr"),vM=Vr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",kM,OM]),fT=Vr(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function SM(e,t){const a=t||{},r="children"in e?e.children:[],o=fT(e),u=pT(e,{whitespace:a.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...hT(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...mT(r[f],e,{whitespace:u,breakBefore:f?void 0:o,breakAfter:f<r.length-1?Th(r[f+1]):o}));const m=[];let h;for(f=-1;++f<c.length;){const b=c[f];typeof b=="number"?h!==void 0&&b>h&&(h=b):b&&(h!==void 0&&h>-1&&m.push(`
|
|
494
494
|
`.repeat(h)||" "),h=-1,m.push(b))}return m.join("")}function mT(e,t,a){return e.type==="element"?AM(e,t,a):e.type==="text"?a.whitespace==="normal"?hT(e,a):CM(e):[]}function AM(e,t,a){const r=pT(e,a),o=e.children||[];let u=-1,c=[];if(vM(e))return c;let f,m;for(Th(e)||X1(e)&&Y1(t,e,X1)?m=`
|
|
495
495
|
`:_M(e)?(f=2,m=2):fT(e)&&(f=1,m=1);++u<o.length;)c=c.concat(mT(o[u],e,{whitespace:r,breakBefore:u?void 0:f,breakAfter:u<o.length-1?Th(o[u+1]):m}));return V1(e)&&Y1(t,e,V1)&&c.push(" "),f&&c.unshift(f),m&&c.push(m),c}function hT(e,t){const a=String(e.value),r=[],o=[];let u=0;for(;u<=a.length;){G1.lastIndex=u;const m=G1.exec(a),h=m&&"index"in m?m.index:a.length;r.push(wM(a.slice(u,h).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?t.breakBefore:!0,h===a.length?t.breakAfter:!0)),u=h+1}let c=-1,f;for(;++c<r.length;)r[c].charCodeAt(r[c].length-1)===8203||c<r.length-1&&r[c+1].charCodeAt(0)===8203?(o.push(r[c]),f=void 0):r[c]?(typeof f=="number"&&o.push(f),o.push(r[c]),f=0):(c===0||c===r.length-1)&&o.push(0);return o}function CM(e){return[String(e.value)]}function wM(e,t,a){const r=[];let o=0,u;for(;o<e.length;){K1.lastIndex=o;const c=K1.exec(e);u=c?c.index:e.length,!o&&!u&&c&&!t&&r.push(""),o!==u&&r.push(e.slice(o,u)),o=c?u+c[0].length:u}return o!==u&&!a&&r.push(""),r.join(" ")}function pT(e,t){if(e.type==="element"){const a=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return a.wrap?"pre-wrap":"pre";case"td":case"th":return a.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function kM(e){return!!(e.properties||{}).hidden}function RM(e){return e.tagName==="td"||e.tagName==="th"}function OM(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function IM(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",c="(?!struct)("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},h={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},b={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(h,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},N=t.optional(o)+e.IDENT_RE+"\\s*\\(",S=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],A=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],v=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],L={type:A,keyword:S,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},I={className:"function.dispatch",relevance:0,keywords:{_hint:v},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},H=[I,g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],$={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:H.concat([{begin:/\(/,end:/\)/,keywords:L,contains:H.concat(["self"]),relevance:0}]),relevance:0},W={className:"function",begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:L,relevance:0},{begin:N,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[h,b]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,h,b,f]}]},f,a,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:L,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat($,W,I,H,[g,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:L,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:L},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function MM(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},a=IM(e),r=a.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,a.name="Arduino",a.aliases=["ino"],a.supersetOf="cpp",a}function DM(e){const t=e.regex,a={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[a]}]};Object.assign(a,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},u=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},f={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,a,o]};o.contains.push(f);const m={match:/\\"/},h={className:"string",begin:/'/,end:/'/},b={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,a]},y=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],N=e.SHEBANG({binary:`(${y.join("|")})`,relevance:10}),S={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},A=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],v={match:/(\/[a-z._-]+)+/},D=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],R=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],L=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],I=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:A,literal:C,built_in:[...D,...R,"set","shopt",...L,...I]},contains:[N,e.SHEBANG(),S,g,u,c,v,f,m,h,b,a]}}function LM(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",c="("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},h={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},b={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(h,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},N=t.optional(o)+e.IDENT_RE+"\\s*\\(",C={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},v=[g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:C,contains:v.concat([{begin:/\(/,end:/\)/,keywords:C,contains:v.concat(["self"]),relevance:0}]),relevance:0},R={begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:C,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:C,relevance:0},{begin:N,returnBegin:!0,contains:[e.inherit(y,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,h,b,f]}]},f,a,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C",aliases:["h"],keywords:C,disableAutodetect:!0,illegal:"</",contains:[].concat(D,R,v,[g,{begin:e.IDENT_RE+"::",keywords:C},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:g,strings:h,keywords:C}}}function jM(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",c="(?!struct)("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},h={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},b={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(h,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},N=t.optional(o)+e.IDENT_RE+"\\s*\\(",S=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],A=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],v=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],L={type:A,keyword:S,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},I={className:"function.dispatch",relevance:0,keywords:{_hint:v},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},H=[I,g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],$={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:H.concat([{begin:/\(/,end:/\)/,keywords:L,contains:H.concat(["self"]),relevance:0}]),relevance:0},W={className:"function",begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:L,relevance:0},{begin:N,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[h,b]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,h,b,f]}]},f,a,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:L,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat($,W,I,H,[g,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:L,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:L},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function BM(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],a=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],o=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],c={keyword:o.concat(u),built_in:t,literal:r},f=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),m={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},b={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},g=e.inherit(b,{illegal:/\n/}),y={className:"subst",begin:/\{/,end:/\}/,keywords:c},N=e.inherit(y,{illegal:/\n/}),S={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,N]},A={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]},C=e.inherit(A,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},N]});y.contains=[A,S,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,e.C_BLOCK_COMMENT_MODE],N.contains=[C,S,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const v={variants:[h,A,S,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},D={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},R=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",L={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:c,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},v,m,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},f,D,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,D,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+R+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:c,contains:[{beginKeywords:a.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,D],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,relevance:0,contains:[v,m,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},L]}}const PM=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),UM=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],HM=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],FM=[...UM,...HM],zM=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),$M=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),qM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),YM=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function GM(e){const t=e.regex,a=PM(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",u=/@-?\w[\w]*(-\w+)*/,c="[a-zA-Z-][a-zA-Z0-9_-]*",f=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[a.BLOCK_COMMENT,r,a.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+c,relevance:0},a.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+$M.join("|")+")"},{begin:":(:)?("+qM.join("|")+")"}]},a.CSS_VARIABLE,{className:"attribute",begin:"\\b("+YM.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[a.BLOCK_COMMENT,a.HEXCOLOR,a.IMPORTANT,a.CSS_NUMBER_MODE,...f,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...f,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},a.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:u},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:zM.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...f,a.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+FM.join("|")+")\\b"}]}}function KM(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function VM(e){const u={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:u,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,illegal:/["']/}]}]}}function XM(e){const t=e.regex,a=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(a,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function QM(e){const t=e.regex,a={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const o={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},u={className:"literal",begin:/\bon|off|true|false|yes|no\b/},c={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},f={begin:/\[/,end:/\]/,contains:[r,u,o,c,a,"self"],relevance:0},m=/[A-Za-z0-9_-]+/,h=/"(\\"|[^"])*"/,b=/'[^']*'/,g=t.either(m,h,b),y=t.concat(g,"(\\s*\\.\\s*",g,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:y,className:"attr",starts:{end:/$/,contains:[r,f,u,o,c,a]}}]}}var Bi="[0-9](_*[0-9])*",uc=`\\.(${Bi})`,cc="[0-9a-fA-F](_*[0-9a-fA-F])*",Q1={className:"number",variants:[{begin:`(\\b(${Bi})((${uc})|\\.)?|(${uc}))[eE][+-]?(${Bi})[fFdD]?\\b`},{begin:`\\b(${Bi})((${uc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${uc})[fFdD]?\\b`},{begin:`\\b(${Bi})[fFdD]\\b`},{begin:`\\b0[xX]((${cc})\\.?|(${cc})?\\.(${cc}))[pP][+-]?(${Bi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${cc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function gT(e,t,a){return a===-1?"":e.replace(t,r=>gT(e,t,a-1))}function WM(e){const t=e.regex,a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=a+gT("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),m={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},h={className:"meta",begin:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},b={className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:m,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:m,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[h,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Q1,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Q1,h]}}const W1="[A-Za-z$_][0-9A-Za-z$_]*",ZM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],JM=["true","false","null","undefined","NaN","Infinity"],bT=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],xT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ET=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],eD=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],tD=[].concat(ET,bT,xT);function nD(e){const t=e.regex,a=(F,{after:Z})=>{const k="</"+F[0].slice(1);return F.input.indexOf(k,Z)!==-1},r=W1,o={begin:"<>",end:"</>"},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,Z)=>{const k=F[0].length+F.index,P=F.input[k];if(P==="<"||P===","){Z.ignoreMatch();return}P===">"&&(a(F,{after:k})||Z.ignoreMatch());let J;const w=F.input.substring(k);if(J=w.match(/^\s*=/)){Z.ignoreMatch();return}if((J=w.match(/^\s+extends\s+/))&&J.index===0){Z.ignoreMatch();return}}},f={$pattern:W1,keyword:ZM,literal:JM,built_in:tD,"variable.language":eD},m="[0-9](_?[0-9])*",h=`\\.(${m})`,b="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${b})((${h})|\\.)?|(${h}))[eE][+-]?(${m})\\b`},{begin:`\\b(${b})\\b((${h})\\b|\\.)?|(${h})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:f,contains:[]},N={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},S={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},A={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},D={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,S,A,C,{match:/\$\d+/},g];y.contains=R.concat({begin:/\{/,end:/\}/,keywords:f,contains:["self"].concat(R)});const L=[].concat(D,y.contains),I=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:f,contains:["self"].concat(L)}]),H={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:I},$={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},W={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...bT,...xT]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},B={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[H],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ie(F){return t.concat("(?!",F.join("|"),")")}const be={match:t.concat(/\b/,ie([...ET,"super","import"].map(F=>`${F}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},te={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},H]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[H]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:f,exports:{PARAMS_CONTAINS:I,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,S,A,C,D,{match:/\$\d+/},g,W,{scope:"attr",match:r+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[D,e.REGEXP_MODE,{className:"function",begin:q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:I}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:u},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},B,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[H,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},te,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[H]},be,ne,$,G,{match:/\$[(.]/}]}}function aD(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},a={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,a,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Pi="[0-9](_*[0-9])*",dc=`\\.(${Pi})`,fc="[0-9a-fA-F](_*[0-9a-fA-F])*",sD={className:"number",variants:[{begin:`(\\b(${Pi})((${dc})|\\.)?|(${dc}))[eE][+-]?(${Pi})[fFdD]?\\b`},{begin:`\\b(${Pi})((${dc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${dc})[fFdD]?\\b`},{begin:`\\b(${Pi})[fFdD]\\b`},{begin:`\\b0[xX]((${fc})\\.?|(${fc})?\\.(${fc}))[pP][+-]?(${Pi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${fc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function rD(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},a={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},u={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},c={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[u,o]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,u,o]}]};o.contains.push(c);const f={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},m={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(c,{className:"string"}),"self"]}]},h=sD,b=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),g={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},y=g;return y.variants[1].contains=[g],g.variants[1].contains=[y],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,b,a,r,f,m,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[g,e.C_LINE_COMMENT_MODE,b],relevance:0},e.C_LINE_COMMENT_MODE,b,f,m,c,e.C_NUMBER_MODE]},b]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},f,m]},c,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
496
496
|
`},h]}}const iD=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),lD=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],oD=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],uD=[...lD,...oD],cD=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),yT=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),NT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),dD=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),fD=yT.concat(NT).sort().reverse();function mD(e){const t=iD(e),a=fD,r="and or not only",o="[\\w-]+",u="("+o+"|@\\{"+o+"\\})",c=[],f=[],m=function(R){return{className:"string",begin:"~?"+R+".*?"+R}},h=function(R,L,I){return{className:R,begin:L,relevance:I}},b={$pattern:/[a-z-]+/,keyword:r,attribute:cD.join(" ")},g={begin:"\\(",end:"\\)",contains:f,keywords:b,relevance:0};f.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m("'"),m('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,g,h("variable","@@?"+o,10),h("variable","@\\{"+o+"\\}"),h("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const y=f.concat({begin:/\{/,end:/\}/,contains:c}),N={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(f)},S={begin:u+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+dD.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:f}}]},A={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:b,returnEnd:!0,contains:f,relevance:0}},C={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:y}},v={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:u,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,N,h("keyword","all\\b"),h("variable","@\\{"+o+"\\}"),{begin:"\\b("+uD.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,h("selector-tag",u,0),h("selector-id","#"+u),h("selector-class","\\."+u,0),h("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+yT.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+NT.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:y},{begin:"!important"},t.FUNCTION_DISPATCH]},D={begin:o+`:(:)?(${a.join("|")})`,returnBegin:!0,contains:[v]};return c.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,A,C,D,S,v,N,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:c}}function hD(e){const t="\\[=*\\[",a="\\]=*\\]",r={begin:t,end:a,contains:["self"]},o=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,a,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:o}].concat(o)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:a,contains:[r],relevance:5}])}}function pD(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,a]},o={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},u={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},c={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,a,r,o,u,c]}}function gD(e){const t=e.regex,a={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},u={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},f=/[A-Za-z][A-Za-z0-9+.-]*/,m={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,f,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},h={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},b={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(h,{contains:[]}),y=e.inherit(b,{contains:[]});h.contains.push(y),b.contains.push(g);let N=[a,m];return[h,b,g,y].forEach(v=>{v.contains=v.contains.concat(N)}),N=N.concat(h,b),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:N},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:N}]}]},a,u,h,b,{className:"quote",begin:"^>\\s+",contains:N,end:"$"},o,r,m,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function bD(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},a=/[a-zA-Z@][a-zA-Z0-9_]*/,f={"variable.language":["this","super"],$pattern:a,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},m={$pattern:a,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:f,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+m.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:m,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function xD(e){const t=e.regex,a=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:a.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},c={begin:/->\{/,end:/\}/},f={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},m={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[f]},h={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},b=[e.BACKSLASH_ESCAPE,u,m],g=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],y=(A,C,v="\\1")=>{const D=v==="\\1"?v:t.concat(v,C);return t.concat(t.concat("(?:",A,")"),C,/(?:\\.|[^\\\/])*?/,D,/(?:\\.|[^\\\/])*?/,v,r)},N=(A,C,v)=>t.concat(t.concat("(?:",A,")"),C,/(?:\\.|[^\\\/])*?/,v,r),S=[m,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),c,{className:"string",contains:b,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},h,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:y("s|tr|y",t.either(...g,{capture:!0}))},{begin:y("s|tr|y","\\(","\\)")},{begin:y("s|tr|y","\\[","\\]")},{begin:y("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:N("(?:m|qr)?",/\//,/\//)},{begin:N("m|qr",t.either(...g,{capture:!0}),/\1/)},{begin:N("m|qr",/\(/,/\)/)},{begin:N("m|qr",/\[/,/\]/)},{begin:N("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,f]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,f,h]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=S,c.contains=S,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:S}}function ED(e){const t=e.regex,a=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,a),o=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,a),u=t.concat(/[A-Z]+/,a),c={scope:"variable",match:"\\$+"+r},f={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},m={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},h=e.inherit(e.APOS_STRING_MODE,{illegal:null}),b=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(m)}),g={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(m),"on:begin":(te,G)=>{G.data._beginMatch=te[1]||te[2]},"on:end":(te,G)=>{G.data._beginMatch!==te[1]&&G.ignoreMatch()}},y=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),N=`[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as e}from"./index-
|
|
1
|
+
import{W as e}from"./index-JfzQSLb0.js";class t extends e{available(){throw this.unimplemented("Method not implemented on web.")}start(o){throw this.unimplemented("Method not implemented on web.")}stop(){throw this.unimplemented("Method not implemented on web.")}getSupportedLanguages(){throw this.unimplemented("Method not implemented on web.")}hasPermission(){throw this.unimplemented("Method not implemented on web.")}isListening(){throw this.unimplemented("Method not implemented on web.")}requestPermission(){throw this.unimplemented("Method not implemented on web.")}checkPermissions(){throw this.unimplemented("Method not implemented on web.")}requestPermissions(){throw this.unimplemented("Method not implemented on web.")}}const m=new t;export{m as SpeechRecognition,t as SpeechRecognitionWeb};
|
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-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-JfzQSLb0.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-CJmjzuIJ.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
File without changes
|