blade-code 0.10.10 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blade.js +2 -2
- package/dist/{chunk-d600wn06.js → chunk-1qz9qfzc.js} +1 -1
- package/dist/{chunk-mhne9y2k.js → chunk-230xac12.js} +1 -1
- package/dist/{chunk-gvc0qqk4.js → chunk-3wms95qc.js} +1 -1
- package/dist/chunk-4hawehmd.js +114 -0
- package/dist/{chunk-j42jswx0.js → chunk-4vjx9ft1.js} +1 -1
- package/dist/{chunk-ttncpgr6.js → chunk-5b7xhvd1.js} +1 -1
- package/dist/{chunk-hfv5gcqj.js → chunk-5df4x6ec.js} +1 -1
- package/dist/{chunk-nmmj1x0c.js → chunk-7ysw82r9.js} +1 -1
- package/dist/{chunk-zf183j2y.js → chunk-82tsyr4f.js} +1 -1
- package/dist/{chunk-6kwv8ph0.js → chunk-93pn0vhs.js} +1 -1
- package/dist/{chunk-hetayg68.js → chunk-ajg3q7e4.js} +1 -1
- package/dist/{chunk-egmwj6xg.js → chunk-amx33f28.js} +1 -1
- package/dist/{chunk-jw8gb53m.js → chunk-b692dgxx.js} +1 -1
- package/dist/{chunk-zyf1r2j3.js → chunk-brwths02.js} +1 -1
- package/dist/{chunk-rhw2zkq8.js → chunk-bzwa0td4.js} +1 -1
- package/dist/{chunk-hveqdgt6.js → chunk-cskpqe1m.js} +1 -1
- package/dist/chunk-efqa79kw.js +1 -0
- package/dist/{chunk-7mhkm3x7.js → chunk-fm913p7k.js} +1 -1
- package/dist/{chunk-y56s2qww.js → chunk-gqrrheb3.js} +1 -1
- package/dist/{chunk-b6gknm33.js → chunk-h6w3ggx9.js} +1 -1
- package/dist/{chunk-g1qpzyt3.js → chunk-h9k52syw.js} +1 -1
- package/dist/{chunk-wnqybbry.js → chunk-jvfzm6gn.js} +1 -1
- package/dist/{chunk-t9aggrv8.js → chunk-k1my44xn.js} +1 -1
- package/dist/chunk-kqgtrnm6.js +4 -0
- package/dist/{chunk-c7201g75.js → chunk-qdf7sb0k.js} +1 -1
- package/dist/{chunk-9e5z64ap.js → chunk-s6v7kg40.js} +1 -1
- package/dist/{chunk-7hjjjkj0.js → chunk-sa572750.js} +1 -1
- package/dist/{chunk-3n4m3pcy.js → chunk-sxcm8ryt.js} +1 -1
- package/dist/{chunk-3v0ay0sf.js → chunk-tgtj3bj1.js} +1 -1
- package/dist/{chunk-ggq4y248.js → chunk-wpjb7918.js} +35 -35
- package/dist/{chunk-cfwnbrrd.js → chunk-xe0z59h2.js} +1 -1
- package/dist/{chunk-fvy56ajf.js → chunk-xm9katxj.js} +1 -1
- package/dist/{chunk-bxp1w7sh.js → chunk-yg2bd4w2.js} +41 -41
- package/dist/{chunk-epek6vr2.js → chunk-z18bbtg9.js} +1 -1
- package/dist/{chunk-vdj00rsv.js → chunk-ze1hqsbs.js} +1 -1
- package/dist/web/assets/{ChatView-DdX4BvAo.js → ChatView-DG6MMrFK.js} +2 -2
- package/dist/web/assets/{CodeBlockHighlighter-DBw81YZa.js → CodeBlockHighlighter-Cf3DBUGk.js} +1 -1
- package/dist/web/assets/{FilePreview-Di-mSDMs.js → FilePreview-LvuYnyjv.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-CxSfwebU.js → MarkdownRenderer-CkSbe36j.js} +3 -3
- package/dist/web/assets/{SettingsModal-CoBMb8of.js → SettingsModal-DBsb7E9J.js} +1 -1
- package/dist/web/assets/{TaskSwitcher-BmS-DA4i.js → TaskSwitcher-Z0KWY8g9.js} +1 -1
- package/dist/web/assets/{TerminalPanel-BPruynbV.js → TerminalPanel-DVWTlxtd.js} +1 -1
- package/dist/web/assets/{index-Bx7HzeXs.js → index-DWtXGF3o.js} +26 -26
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunk-576pdgtm.js +0 -114
- package/dist/chunk-tkqrhxqr.js +0 -1
- package/dist/chunk-zepqp80m.js +0 -4
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-
|
|
2
|
-
var Jy=Object.defineProperty;var Qy=(e,t,n)=>t in e?Jy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ja=(e,t,n)=>Qy(e,typeof t!="symbol"?t+"":t,n);import{r as w,j as c,c as oo,d as Yy}from"./vendor-react-DG5dkZ_t.js";import{S as Xy,O as jf,P as Zy,C as Tf,a as eS,T as Af,D as Ef,R as tS,b as Pf,V as nS,c as rS,d as Nf,e as sS,f as oS,g as Of,h as iS,i as aS}from"./vendor-radix-DXRuAJHH.js";import{X as co,H as yu,L as lt,F as cS,R as Qi,A as $f,a as lo,D as Rf,b as lS,c as Oi,d as dS,e as uo,G as Zc,T as Mf,C as Ff,f as As,S as el,M as uS,g as fS,P as mS,h as Df,i as tl,j as _f,k as nl,l as pS,m as gS,n as hS,o as Lf,p as bS,q as kS,r as Uf,s as Su,t as xS,u as yS,v as Bf,w as SS,I as wS,x as wu,y as Ss,B as vS,z as IS,E as CS,W as vu,J as jS,K as TS,N as AS,O as ES,Q as PS,U as Iu,V as Cu}from"./vendor-icons-ICv1v-tf.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const NS="modulepreload",OS=function(e){return"/"+e},ju={},Io=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=OS(l),l in ju)return;ju[l]=!0;const d=l.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":NS,d||(p.as="script"),p.crossOrigin="",p.href=l,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};function Hf(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Hf(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function qf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Hf(e))&&(r&&(r+=" "),r+=t);return r}const Tu=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Au=qf,$S=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Au(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(d=>{const m=n==null?void 0:n[d],p=o==null?void 0:o[d];if(m===null)return null;const g=Tu(m)||Tu(p);return s[d][g]}),a=n&&Object.entries(n).reduce((d,m)=>{let[p,g]=m;return g===void 0||(d[p]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,m)=>{let{class:p,className:g,...x}=m;return Object.entries(x).every(b=>{let[y,j]=b;return Array.isArray(j)?j.includes({...o,...a}[y]):{...o,...a}[y]===j})?[...d,p,g]:d},[]);return Au(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},rl="-",RS=e=>{const t=FS(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(rl);return a[0]===""&&a.length!==1&&a.shift(),zf(a,t)||MS(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},zf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?zf(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(rl);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Eu=/^\[(.+)\]$/,MS=e=>{if(Eu.test(e)){const t=Eu.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},FS=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return _S(Object.entries(e.classGroups),n).forEach(([o,i])=>{pc(i,r,o,t)}),r},pc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Pu(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(DS(s)){pc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{pc(i,Pu(t,o),n,r)})})},Pu=(e,t)=>{let n=e;return t.split(rl).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},DS=e=>e.isThemeGetter,_S=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[n,s]}):e,LS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},Kf="!",US=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let d=0,m=0,p;for(let j=0;j<a.length;j++){let k=a[j];if(d===0){if(k===s&&(r||a.slice(j,j+o)===t)){l.push(a.slice(m,j)),m=j+o;continue}if(k==="/"){p=j;continue}}k==="["?d++:k==="]"&&d--}const g=l.length===0?a:a.substring(m),x=g.startsWith(Kf),b=x?g.substring(1):g,y=p&&p>m?p-m:void 0;return{modifiers:l,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:i}):i},BS=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},HS=e=>({cache:LS(e.cacheSize),parseClassName:US(e),...RS(e)}),qS=/\s+/,zS=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(qS);let a="";for(let l=i.length-1;l>=0;l-=1){const d=i[l],{modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(d);let b=!!x,y=r(b?g.substring(0,x):g);if(!y){if(!b){a=d+(a.length>0?" "+a:a);continue}if(y=r(g),!y){a=d+(a.length>0?" "+a:a);continue}b=!1}const j=BS(m).join(":"),k=p?j+Kf:j,A=k+y;if(o.includes(A))continue;o.push(A);const N=s(y,b);for(let $=0;$<N.length;++$){const Q=N[$];o.push(k+Q)}a=d+(a.length>0?" "+a:a)}return a};function KS(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Gf(t))&&(r&&(r+=" "),r+=n);return r}const Gf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Gf(e[r]))&&(n&&(n+=" "),n+=t);return n};function GS(e,...t){let n,r,s,o=i;function i(l){const d=t.reduce((m,p)=>p(m),e());return n=HS(d),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const m=zS(l,n);return s(l,m),m}return function(){return o(KS.apply(null,arguments))}}const Je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Vf=/^\[(?:([a-z-]+):)?(.+)\]$/i,VS=/^\d+\/\d+$/,WS=new Set(["px","full","screen"]),JS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,YS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,XS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kn=e=>js(e)||WS.has(e)||VS.test(e),ur=e=>Ps(e,"length",a0),js=e=>!!e&&!Number.isNaN(Number(e)),Qa=e=>Ps(e,"number",js),eo=e=>!!e&&Number.isInteger(Number(e)),e0=e=>e.endsWith("%")&&js(e.slice(0,-1)),le=e=>Vf.test(e),fr=e=>JS.test(e),t0=new Set(["length","size","percentage"]),n0=e=>Ps(e,t0,Wf),r0=e=>Ps(e,"position",Wf),s0=new Set(["image","url"]),o0=e=>Ps(e,s0,l0),i0=e=>Ps(e,"",c0),to=()=>!0,Ps=(e,t,n)=>{const r=Vf.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},a0=e=>QS.test(e)&&!YS.test(e),Wf=()=>!1,c0=e=>XS.test(e),l0=e=>ZS.test(e),d0=()=>{const e=Je("colors"),t=Je("spacing"),n=Je("blur"),r=Je("brightness"),s=Je("borderColor"),o=Je("borderRadius"),i=Je("borderSpacing"),a=Je("borderWidth"),l=Je("contrast"),d=Je("grayscale"),m=Je("hueRotate"),p=Je("invert"),g=Je("gap"),x=Je("gradientColorStops"),b=Je("gradientColorStopPositions"),y=Je("inset"),j=Je("margin"),k=Je("opacity"),A=Je("padding"),N=Je("saturate"),$=Je("scale"),Q=Je("sepia"),T=Je("skew"),C=Je("space"),O=Je("translate"),R=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",le,t],P=()=>[le,t],B=()=>["",Kn,ur],M=()=>["auto",js,le],fe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ve=()=>["solid","dashed","dotted","double","none"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],Fe=()=>["","0",le],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],me=()=>[js,le];return{cacheSize:500,separator:":",theme:{colors:[to],spacing:[Kn,ur],blur:["none","",fr,le],brightness:me(),borderColor:[e],borderRadius:["none","","full",fr,le],borderSpacing:P(),borderWidth:B(),contrast:me(),grayscale:Fe(),hueRotate:me(),invert:Fe(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[e0,ur],inset:X(),margin:X(),opacity:me(),padding:P(),saturate:me(),scale:me(),sepia:Fe(),skew:me(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[fr]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...fe(),le]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",eo,le]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",le]}],grow:[{grow:Fe()}],shrink:[{shrink:Fe()}],order:[{order:["first","last","none",eo,le]}],"grid-cols":[{"grid-cols":[to]}],"col-start-end":[{col:["auto",{span:["full",eo,le]},le]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[to]}],"row-start-end":[{row:["auto",{span:[eo,le]},le]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",le,t]}],"min-w":[{"min-w":[le,t,"min","max","fit"]}],"max-w":[{"max-w":[le,t,"none","full","min","max","fit","prose",{screen:[fr]},fr]}],h:[{h:[le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",fr,ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qa]}],"font-family":[{font:[to]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",le]}],"line-clamp":[{"line-clamp":["none",js,Qa]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Kn,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Kn,ur]}],"underline-offset":[{"underline-offset":["auto",Kn,le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...fe(),r0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",n0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},o0]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...ve(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:ve()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...ve()]}],"outline-offset":[{"outline-offset":[Kn,le]}],"outline-w":[{outline:[Kn,ur]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Kn,ur]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",fr,i0]}],"shadow-color":[{shadow:[to]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ke(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ke()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",fr,le]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[N]}],sepia:[{sepia:[Q]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",le]}],duration:[{duration:me()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:me()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[$]}],"scale-x":[{"scale-x":[$]}],"scale-y":[{"scale-y":[$]}],rotate:[{rotate:[eo,le]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Kn,ur,Qa]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},u0=GS(d0);function W(...e){return u0(qf(e))}const f0=$S("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),br=w.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?Xy:"button";return c.jsx(i,{className:W(f0({variant:t,size:n,className:e})),ref:o,...s})});br.displayName="Button";const sl=tS,m0=Zy,Jf=w.forwardRef(({className:e,...t},n)=>c.jsx(jf,{ref:n,className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Jf.displayName=jf.displayName;const Yi=w.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>c.jsxs(m0,{children:[c.jsx(Jf,{}),c.jsxs(Tf,{ref:s,"aria-modal":"true",className:W("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,!n&&c.jsxs(eS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[c.jsx(co,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yi.displayName=Tf.displayName;const ol=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ol.displayName="DialogHeader";const Qf=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qf.displayName="DialogFooter";const Xi=w.forwardRef(({className:e,...t},n)=>c.jsx(Af,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));Xi.displayName=Af.displayName;const Zi=w.forwardRef(({className:e,...t},n)=>c.jsx(Ef,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Zi.displayName=Ef.displayName;const p0={"app.restoring":"Restoring workspace…","layout.workspace.pathAria":"Workspace path","layout.workspace.empty":"No workspace","layout.action.rewind":"Rewind session","layout.action.filePreview":"File preview","layout.action.filePreviewToggle":"Toggle file preview","layout.action.openNavigation":"Open navigation","terminal.title":"Terminal","terminal.status.connected":"Terminal connected","terminal.status.disconnected":"Terminal disconnected","terminal.action.minimize":"Minimize terminal","terminal.action.restore":"Restore terminal","terminal.action.close":"Close terminal","sidebar.brand.badge":"WEB","sidebar.action.collapse":"Collapse sidebar","sidebar.action.expand":"Expand sidebar","sidebar.navigationAria":"Task navigation","sidebar.action.newTask":"New Task","sidebar.action.newTaskShort":"New task","sidebar.action.terminal":"Terminal","sidebar.action.terminalToggle":"Toggle terminal","sidebar.action.searchTasks":"Search tasks","sidebar.unreadTasks":"{count} unread tasks","sidebar.section.skills":"Skills","sidebar.section.mcp":"MCP","sidebar.section.settings":"Settings","sidebar.status.user":"User","sidebar.status.feedLive":"Task feed live","sidebar.status.feedOffline":"Task feed offline","sidebar.empty.title":"No tasks yet","sidebar.empty.hint":"Dispatch one from the home view","sidebar.group.running":"RUNNING","sidebar.group.queued":"QUEUED","sidebar.group.interrupted":"INTERRUPTED","sidebar.group.failed":"FAILED","sidebar.group.cancelled":"CANCELLED","sidebar.group.done":"DONE","sidebar.group.showMore":"Show {count} more","sidebar.group.showLess":"Show less","sidebar.view.project":"Projects","sidebar.view.status":"Status","sidebar.view.projectAria":"Group sessions by project","sidebar.view.statusAria":"Group sessions by status","sidebar.project.active":"active","sidebar.project.expand":"Expand {name}","sidebar.project.collapse":"Collapse {name}","sidebar.project.newTask":"New task in {name}","sidebar.project.reorder":"Reorder {name}, position {position} of {count}","sidebar.project.reorderHint":"Drag to reorder, or use Up and Down arrow keys","sidebar.project.reordered":"Moved {name} to position {position}","sidebar.project.projects":"Projects","sidebar.catalog.syncing":"Syncing task history…","sidebar.catalog.loaded":"{count} loaded","sidebar.catalog.incomplete":"Task history is incomplete","sidebar.catalog.retry":"Retry","projects.dialog.title":"Projects","projects.dialog.description":"Bind local folders to switch task context without restarting Blade.","projects.bind.placeholder":"/absolute/path/to/project","projects.bind.pathLabel":"Project path","projects.bind.action":"Bind","projects.bind.failed":"Failed to bind project","projects.pick.action":"Choose project folder","projects.pick.actionShort":"Choose","projects.pick.picking":"Choosing…","projects.pick.failed":"Failed to choose a project folder","projects.unbind.action":"Unbind project","projects.unavailable":"unavailable","sidebar.language.label":"Language","sidebar.language.aria":"Switch language","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"worktree","session.env.local":"local","session.action.select":"Select {title}","session.action.save":"Save {title}","session.action.cancel":"Cancel {title}","session.action.more":"More actions for {title}","session.action.fork":"Fork {title}","session.action.forkShort":"Fork","session.action.rename":"Rename {title}","session.action.renameShort":"Rename","session.action.archive":"Archive {title}","session.action.archiveShort":"Archive","session.action.export":"Export {title} as Markdown","session.action.exportShort":"Export Markdown","session.action.exportingShort":"Exporting…","session.action.delete":"Delete {title}","session.action.deleteShort":"Delete","session.action.stop":"Stop {title}","session.action.stopping":"Stopping {title}","session.action.retry":"Retry {title}","session.action.retrying":"Retrying {title}","session.reason.cancelledByUser":"Cancelled by user","session.title.codeReview":"Code Review","session.forkedFrom":"Forked from","session.retriedFrom":"Retried from","session.retryShort":"retry","session.queued":"#{position}/{depth} queued","archive.title":"Archive","archive.subtitle":"Stored safely outside the active task list","archive.open":"Open session archive","archive.refresh":"Refresh archived sessions","archive.retry":"Retry","archive.loading":"Loading archive…","archive.empty":"No archived sessions","archive.restore":"Restore {title}","archive.restoreShort":"Restore","archive.restoreAncestor":"Restore the archive root first","archive.inherited":"Archived with {id}","taskSwitcher.title":"Task switcher","taskSwitcher.description":"Search and open tasks across every project.","taskSwitcher.searchAria":"Search tasks","taskSwitcher.placeholder":"Search title, project, branch, status, or session ID…","taskSwitcher.results":"{count} results","taskSwitcher.recent":"Recent tasks","taskSwitcher.scope":"{count} tasks indexed","taskSwitcher.indexing":"Indexing tasks…","taskSwitcher.resultsAria":"Task search results","taskSwitcher.current":"Current","taskSwitcher.unread":"{count} unread","taskSwitcher.needsAction":"{count} need action","taskSwitcher.new":"New","taskSwitcher.empty":"No matching tasks","taskSwitcher.emptyHint":"Try a project, branch, status, or shorter phrase.","taskSwitcher.hint.navigate":"navigate","taskSwitcher.hint.open":"open","taskSwitcher.hint.toggle":"toggle","taskSwitcher.action.failed":"Task action failed","commandCenter.title":"Command center","commandCenter.description":"Search tasks or run workspace and application actions.","commandCenter.searchAria":"Search actions","commandCenter.placeholder":"Search actions, settings, or tools…","commandCenter.modeAria":"Command center mode","commandCenter.mode.tasks":"Tasks","commandCenter.mode.commands":"Actions","commandCenter.actions":"{count} actions","commandCenter.resultsAria":"Action search results","commandCenter.empty":"No matching actions","commandCenter.emptyHint":"Try a tool, panel, or setting name.","commandCenter.action.newTask":"New task","commandCenter.action.newTaskDescription":"Open a clean task composer","commandCenter.action.preview":"Toggle preview","commandCenter.action.previewDescription":"Review files, diffs, and run logs","commandCenter.action.terminal":"Toggle terminal","commandCenter.action.terminalDescription":"Open or close the workspace shell","commandCenter.action.settings":"Open settings","commandCenter.action.settingsDescription":"Configure appearance and behavior","commandCenter.action.models":"Configure models","commandCenter.action.modelsDescription":"Select providers and task models","commandCenter.action.shortcuts":"View keyboard shortcuts","commandCenter.action.shortcutsDescription":"Browse global and contextual keys","commandCenter.action.skills":"Manage skills","commandCenter.action.skillsDescription":"Discover and configure agent capabilities","commandCenter.action.mcp":"Manage MCP servers","commandCenter.action.mcpDescription":"Configure connected tools and servers","commandCenter.action.sidebar":"Toggle sidebar","commandCenter.action.sidebarDescription":"Show or hide project navigation","taskHome.eyebrow":"Task dispatcher · Ready","taskHome.feed.connecting":"Task dispatcher · Connecting","taskHome.feed.reconnecting":"Task dispatcher · Reconnecting","taskHome.feed.offline":"Task dispatcher · Offline","taskHome.feed.offlineDescription":"Live task updates are paused. Running tasks continue on the server.","taskHome.feed.retry":"Reconnect","taskHome.hero.prefix":"What should Blade build in","taskHome.hero.projectFallback":"current workspace","taskHome.hero.subtitle":"Dispatch a task and keep moving. Each task runs in its own worktree, persists state, and returns with a reviewable workspace when it's done.","taskHome.templates.title":"Templates","taskHome.templates.hint":"1–4 to prefill","taskHome.template.explore.title":"Explore","taskHome.template.explore.description":"Trace behavior and explain the system","taskHome.template.explore.hint":"Trace a call · map a module","taskHome.template.build.title":"Build","taskHome.template.build.description":"Implement a production-ready feature","taskHome.template.build.hint":"Ship a feature end-to-end","taskHome.template.review.title":"Review","taskHome.template.review.description":"Find correctness and regression risks","taskHome.template.review.hint":"Audit current changes","taskHome.review.attachmentsUnsupported":"Code review does not accept attachments","taskHome.review.outputSchemaUnsupported":"Code review uses its own structured report schema","taskHome.review.usage":"Usage: /review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"Read-only code review in progress","taskHome.review.stale":"Review target changed while the reviewer was running","taskHome.review.aborted":"Code review aborted","taskHome.review.interrupted":"Code review interrupted by process restart","taskHome.review.failed":"Code review failed","taskHome.review.startFailed":"Failed to start code review","taskHome.review.invalidTarget":"The selected review target is invalid or has no changes","taskHome.review.conflict":"This session already has active work","taskHome.template.fix.title":"Fix","taskHome.template.fix.description":"Diagnose and repair a concrete failure","taskHome.template.fix.hint":"Bisect · reproduce · patch","taskHome.context.isolationToggleTitle":"Toggle task isolation","taskHome.context.projectSelect":"Select target project","taskHome.context.isolation.worktree":"Isolated worktree","taskHome.context.isolation.local":"Local workspace","taskHome.context.branchFallback":"no branch","taskHome.context.preparing":"Preparing worktree","taskHome.setup.aria":"Task setup status","taskHome.setup.title":"Finish setup","taskHome.setup.description":"Keep drafting while Blade verifies the workspace and model.","taskHome.setup.workspace.title":"Workspace","taskHome.setup.workspace.loading":"Checking available workspaces…","taskHome.setup.workspace.ready":"{project} selected","taskHome.setup.workspace.required":"Choose an available project","taskHome.setup.workspace.empty":"No project","taskHome.setup.workspace.action":"Choose","taskHome.setup.workspace.retry":"Reload workspaces","taskHome.setup.model.title":"Model","taskHome.setup.model.loading":"Checking configuration…","taskHome.setup.model.ready":"Ready for this task","taskHome.setup.model.required":"Configure or select a model","taskHome.setup.model.action":"Configure","taskHome.setup.model.retry":"Retry","taskHome.composer.placeholder":"Describe the outcome, constraints, and verification you expect...","taskHome.error.dismiss":"Dismiss","taskHome.recent.title":"Recent tasks","taskHome.recent.total":"{count} total","taskHome.recent.partial":"{count} loaded · syncing","taskHome.recent.incomplete":"{count} loaded · history incomplete","taskSwitcher.indexingLoaded":"{count} loaded · syncing history","taskHome.footer.note":"Worktree isolation keeps parallel tasks from touching your active checkout","capacity.title":"{inFlight} running · {queued} queued · max {max}","capacity.suffix.running":" running","capacity.queued":"{queued} queued","recent.status.running":"running","recent.status.queued":"queued","recent.status.paused":"paused","recent.status.failed":"failed","recent.status.cancelled":"cancelled","recent.status.done":"done","recent.time.justNow":"just now","recent.time.minutes":"{n}m ago","recent.time.hours":"{n}h ago","recent.time.days":"{n}d ago","recent.session.fallbackShort":"Session {id}","recent.session.fallbackDated":"Session {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} unread task updates","attention.notification.completed":"Task completed","attention.notification.failed":"Task failed","attention.notification.interrupted":"Task interrupted","attention.notification.permission":"Approval required","attention.notification.question":"Answer required","attention.notification.elicitation":"MCP input required","interaction.permission.title":"Permission required: {tool}","interaction.permission.once":"Allow once","interaction.permission.session":"Allow for session","interaction.permission.project":"Allow for project","interaction.permission.deny":"Deny","interaction.permission.failed":"Failed to respond to permission","interaction.question.answered":"Questions answered","interaction.question.other":"Other","interaction.question.submit":"Submit answers","interaction.question.failed":"Failed to submit answers","interaction.elicitation.title":"MCP input requested","interaction.elicitation.submit":"Submit to MCP","interaction.elicitation.open":"Open external URL","interaction.elicitation.decline":"Decline","interaction.elicitation.cancel":"Cancel","interaction.elicitation.responded":"MCP request answered","interaction.elicitation.cancelled":"MCP request cancelled","interaction.elicitation.failed":"Failed to respond to MCP request","interaction.elicitation.warning":"Only continue if you trust this MCP server and understand the request.","interaction.bar.permissionTitle":"Agent needs approval","interaction.bar.permissionHint":"Review the pending tool request before this task can continue.","interaction.bar.questionTitle":"Agent needs your answer","interaction.bar.questionHint":"Answer the pending question before this task can continue.","interaction.bar.elicitationTitle":"MCP server needs your input","interaction.bar.elicitationHint":"Review the MCP request before this task can continue.","interaction.bar.review":"Review request","interaction.badge.permission":"Needs approval","interaction.badge.question":"Needs answer","interaction.badge.elicitation":"MCP input","artifact.env.isolated":"isolated","artifact.env.local":"local","artifact.review":"Review changes","artifact.commits":"{count} commits","artifact.apply":"Apply","artifact.retryApply":"Retry apply","artifact.applying":"Applying","artifact.applied":"Applied","artifact.discard":"Discard task changes","artifact.discarded":"Discarded","artifact.conflict":"The task changes could not be applied safely.","artifact.conflictHint":"The isolated changes are preserved. Review them, resolve the source project, then retry or discard.","artifact.discardDialog.title":"Discard isolated changes?","artifact.discardDialog.description":"Remove {count} changed files from the isolated task workspace for {project}.","artifact.discardDialog.warning":"This permanently removes the task worktree and branch. Your source project is not modified.","artifact.discardDialog.cancel":"Keep changes","artifact.discardDialog.confirm":"Discard changes","chat.list.empty.eyebrow":"Blade · Ready","chat.list.empty.title":"Start a conversation to begin","chat.list.empty.hint":"Ask a question, describe a change, or paste a stack trace.","chat.list.loading.eyebrow":"Conversation history","chat.list.loading.title":"Restoring conversation…","chat.list.loading.hint":"Loading messages, task state, and live updates. Larger conversations may take a moment.","chat.list.showEarlier":"Show {count} earlier messages","chat.list.showEarlierWithRemaining":"Show {count} earlier messages, {remaining} hidden","chat.list.jumpLatest":"Jump to latest","chat.turns.aria":"Jump to a previous message","chat.turns.label":"Turn {n}","chat.timeline.thinking":"Thought process","chat.timeline.tools.runningOne":"Running 1 command","chat.timeline.tools.running":"Running {count} commands","chat.timeline.tools.completedOne":"Executed 1 command","chat.timeline.tools.completed":"Executed {count} commands","chat.timeline.tools.completedOneWithError":"Executed 1 command · failed","chat.timeline.tools.completedWithErrors":"Executed {count} commands · {errors} failed","chat.error.dismiss":"Dismiss error","chat.error.queueFull":"The guidance queue is full. Wait for pending instructions to start, then retry.","chat.error.turnChanged":"The active turn changed before this message was accepted. Review and retry it.","chat.error.title.submission":"Message not sent.","chat.error.title.execution":"Run stopped.","chat.error.title.navigation":"Task not opened.","chat.error.title.generic":"Action failed.","chat.error.action.returnDraft":"Return to draft","chat.error.action.editResend":"Edit and resend","chat.error.action.retryTask":"Retry task","chat.error.action.retryingTask":"Retrying…","chat.error.action.checkModels":"Check model settings","task.failure.authentication":"Provider authentication failed. Check model credentials.","task.failure.permission":"Provider rejected this request. Check account and model permissions.","task.failure.rateLimit":"Provider rate limit or quota exceeded.","task.failure.timeout":"Provider request timed out.","task.failure.network":"Provider connection failed.","task.failure.modelUnavailable":"The selected model is unavailable.","task.failure.contextLimit":"The request exceeded the model context limit.","task.failure.unsupportedInput":"The selected model does not support this input.","task.failure.runtime":"Agent execution failed.","chat.connection.reconnecting":"Reconnecting live updates. The active run continues in the background.","chat.connection.offline":"Live updates are offline. Progress shown here may be stale.","chat.connection.retry":"Reconnect","chat.footer.disclaimer":"Blade can make mistakes. Please check important information.","chat.input.placeholder.default":"Type @ for files, / for commands...","chat.input.placeholder.steering":"Add guidance to steer the active turn...","chat.input.steering.status":"Active turn is steerable","chat.input.steering.queued":"Guidance accepted · {count} pending","chat.input.steering.enterHint":" · Enter sends guidance","chat.input.followUp.queued":"Follow-up accepted · {count} queued for the next turn","chat.input.steering.recoveredOne":"Recovered {count} queued instruction after restart","chat.input.steering.recoveredMany":"Recovered {count} queued instructions after restart","chat.input.attachment.add":"Attach images","chat.input.attachment.remove":"Remove","chat.input.attachment.countLimit":"You can attach up to {count} images.","chat.input.attachment.sizeLimit":"Images must stay under {size} total. Remove an image or choose smaller files.","chat.input.attachment.readFailed":"Blade could not read one of these images.","chat.input.attachment.usage":"{count}/{limit} images · {used} of {budget}","chat.input.attachment.modelUnsupported":"{model} does not support images. Choose a vision model or remove the images.","chat.input.attachment.modelRequired":"Choose a vision-capable model before attaching images.","chat.input.model.placeholder":"Select Model","chat.input.model.empty":"No models configured","chat.input.model.vision":"Vision","chat.input.model.change":"Change model","chat.input.model.locked":"Wait for the active turn to finish before switching models","chat.input.effort.label":"Effort {effort}","chat.input.effort.heading":"Reasoning effort","chat.input.effort.change":"Change reasoning effort","chat.input.effort.locked":"Wait for the active turn to finish before changing reasoning effort","chat.input.effort.option":"Use {effort} reasoning effort","chat.input.effort.autoHint":"near high","chat.input.serviceTier.label":"Speed {tier}","chat.input.serviceTier.heading":"Provider service tier","chat.input.serviceTier.change":"Change provider service tier","chat.input.serviceTier.locked":"Wait for the current turn to finish before changing service tier","chat.input.serviceTier.option":"Use {tier} service tier","chat.input.serviceTier.fastHint":"priority","chat.input.serviceTier.flexHint":"lower cost","chat.input.responseVerbosity.label":"Output {verbosity}","chat.input.responseVerbosity.heading":"Response verbosity","chat.input.responseVerbosity.change":"Change response verbosity","chat.input.responseVerbosity.locked":"Wait for the current turn to finish before changing response verbosity","chat.input.responseVerbosity.option":"Use {verbosity} response verbosity","chat.input.responseVerbosity.autoHint":"model default","chat.input.outputSchema.title":"Structured output","chat.input.outputSchema.description":"Require this turn to finish with an object that matches the JSON Schema.","chat.input.outputSchema.change":"Set structured output schema","chat.input.outputSchema.locked":"Wait for the current turn to finish before changing the output schema","chat.input.outputSchema.editor":"JSON Schema editor","chat.input.outputSchema.placeholder":"Paste a JSON Schema object","chat.input.outputSchema.example":"Use example","chat.input.outputSchema.clear":"Clear","chat.input.outputSchema.invalid":"Enter a valid JSON object. The server validates the complete schema.","chat.input.outputSchema.shellUnsupported":"Structured output cannot be combined with a shell command.","chat.structuredOutput.title":"Structured output","chat.structuredOutput.copy":"Copy structured output","chat.input.communicationStyle.label":"Style {style}","chat.input.communicationStyle.heading":"Communication style","chat.input.communicationStyle.change":"Change communication style","chat.input.communicationStyle.locked":"Wait for the current turn to finish before changing communication style","chat.input.communicationStyle.option":"Use {style} communication style","chat.input.communicationStyle.autoHint":"Blade default","chat.input.communicationStyle.pragmaticHint":"direct","chat.input.communicationStyle.friendlyHint":"warm","chat.input.communicationStyle.explanatoryHint":"explain choices","chat.notice.dismiss":"Dismiss notice","chat.input.mode.default":"Manual approval","chat.input.mode.default.desc":"Every important action needs your approval","chat.input.mode.autoEdit":"Auto approval","chat.input.mode.autoEdit.desc":"Let the AI review and approve important actions","chat.input.mode.yolo":"Full access","chat.input.mode.yolo.desc":"Run directly on your machine without asking","chat.input.mode.yolo.confirm.title":"Enable full access mode?","chat.input.mode.yolo.confirm.desc":"In this mode the agent will execute all actions — including file writes, shell commands, and network requests — without asking for permission. Only enable this if you trust the current context.","chat.input.mode.yolo.confirm.cancel":"Cancel","chat.input.mode.yolo.confirm.accept":"Enable","chat.input.mode.plan":"Plan","chat.input.mode.plan.desc":"Draft a plan first without making changes","chat.input.mode.aria":"Agent action approval","chat.input.action.stop":"Stop active turn","chat.input.action.stopping":"Stopping active turn","chat.input.action.steer":"Steer active turn","chat.input.action.send":"Send message","chat.input.action.submitting":"Submitting message","chat.review.title":"Code Review","chat.review.target":"Target","chat.review.target.uncommitted":"Uncommitted changes","chat.review.target.base":"Changes against {ref}","chat.review.target.commit":"Commit {ref}","chat.review.status":"Status","chat.review.status.completed":"Completed","chat.review.status.stale":"Stale","chat.review.status.failed":"Failed","chat.review.status.aborted":"Aborted","chat.review.status.interrupted":"Interrupted","chat.review.findings":"Findings","chat.review.noFindings":"No actionable findings","chat.review.confidence":"confidence {value}","chat.review.error":"Error","chat.subagent.resumedFromTitle":"Resumed from {id}","chat.subagent.resumedDepth":"resumed · depth {depth}","chat.subagent.loadingLogs":"Loading subagent logs...","chat.subagent.resumedAs":"Resumed as {id} · {status} · depth {depth}","chat.subagent.resume":"Resume","chat.subagent.resumeAria":"Resume subagent","chat.subagent.followUpAria":"Subagent follow-up","chat.subagent.followUpPlaceholder":"Describe the follow-up work","chat.subagent.cancel":"Cancel","chat.subagent.resumeAgent":"Resume agent","chat.subagent.resumeFailed":"Failed to resume subagent","chat.markdown.copyCode":"Copy code","chat.rewind.title":"Rewind session","chat.rewind.description":"Return to the point before a user message.","chat.rewind.loading":"Loading checkpoints","chat.rewind.empty":"Nothing to rewind to yet","chat.rewind.checkpointAria":"Rewind checkpoint","chat.rewind.userMessage":"User message","chat.rewind.fileCountOne":"{count} file","chat.rewind.fileCountMany":"{count} files","chat.rewind.restoreCode":"Restore code changes","chat.rewind.restoreCodeHint":"Revert files changed at and after this checkpoint.","chat.rewind.cancel":"Cancel","chat.rewind.confirm":"Rewind","chat.rewind.loadFailed":"Failed to load rewind checkpoints","chat.rewind.failed":"Rewind failed. Review the session error and try again.","status.context":"Context","status.tokenLimitTooltip":"Token limit is estimated. It updates when the model reports its context size.","status.phase.running":"Generating...","status.phase.compacting":"Compacting context...","status.phase.switchingModel":"Switching model...","status.phase.waitingPermission":"Waiting for permission...","status.phase.error":"Run failed","preview.title":"Preview","preview.action.resize":"Resize preview","preview.action.close":"Close preview","preview.action.retry":"Retry","preview.tab.diff":"Diff","preview.tab.files":"Files","preview.tab.logs":"Logs","preview.diff.loadingTitle":"Loading task diff…","preview.diff.loadingHint":"Reading the durable worktree artifact.","preview.diff.failedTitle":"Failed to load task diff","preview.diff.discardedTitle":"Changes discarded","preview.diff.discardedHint":"The isolated workspace was removed. The source project was not changed.","preview.diff.emptyTitle":"No patch yet","preview.diff.emptyHint":"Run a tool that changes files to see diffs here.","preview.diff.searchAria":"Search changed files","preview.diff.searchPlaceholder":"Filter changed files…","preview.diff.changedFiles":"{count} changed files","preview.diff.expandAll":"Expand all","preview.diff.collapseAll":"Collapse all","preview.diff.showMoreFiles":"Show {count} more files","preview.diff.showMoreLines":"Show {count} more lines","preview.diff.noMatches":"No matching changed files","preview.diff.patch":"Patch","preview.diff.line":"Line {line}","preview.files.loadingTitle":"Loading files…","preview.files.loadingHint":"Fetching workspace tree.","preview.files.failedTitle":"Failed to load files","preview.files.emptyTitle":"No files yet","preview.files.emptyHint":"Select a project to load its workspace tree.","preview.files.treeFailed":"Failed to load workspace tree","preview.files.searchAria":"Search workspace files","preview.files.searchPlaceholder":"Find a file…","preview.files.searchResultsAria":"File search results","preview.files.searchFailed":"Failed to search workspace files","preview.files.noMatches":"No matching files","preview.files.directoryLoading":"Loading folder…","preview.files.directoryEmpty":"Empty folder","preview.files.selectTitle":"Select a file to preview","preview.files.status.loading":"Loading…","preview.files.status.truncated":"Truncated","preview.files.status.ready":"Ready","preview.files.truncatedNotice":"Preview truncated to 200k characters.","preview.files.pickHint":"Pick a file from the tree to preview.","preview.files.contentFailed":"Failed to load file","preview.files.editorLoading":"Loading editor…","preview.logs.searchAria":"Search tool logs","preview.logs.searchPlaceholder":"Search tool, summary, or output…","preview.logs.filterAria":"Filter logs by status","preview.logs.filter.all":"All","preview.logs.filter.running":"Running","preview.logs.filter.error":"Failed","preview.logs.filter.success":"Success","preview.logs.noMatches":"No matching logs","preview.logs.noMatchesHint":"Try another phrase or status.","preview.logs.emptyTitle":"No logs yet","preview.logs.emptyHint":"Tool runs will appear here.","preview.logs.expand":"Expand","preview.logs.collapse":"Collapse","preview.logs.showMore":"Show {count} more logs","preview.logs.status.running":"Running","preview.logs.status.error":"Failed","preview.logs.status.success":"Success","goal.aria.section":"Goal controls","goal.status.active":"Goal running","goal.status.paused":"Goal paused","goal.status.blocked":"Goal blocked","goal.status.usageLimited":"Usage limited","goal.status.budgetLimited":"Budget reached","goal.status.complete":"Goal complete","goal.field.objective":"Goal objective","goal.action.edit":"Edit goal","goal.action.pause":"Pause goal","goal.action.resume":"Resume goal","goal.action.delete":"Delete goal","goal.action.expand":"Expand goal details","goal.action.collapse":"Collapse goal details","goal.action.cancel":"Cancel","goal.action.save":"Save","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"{n} continuation","goal.metrics.continuationMany":"{n} continuations","goal.dialog.title":"Delete this goal?","goal.dialog.description":"The goal state will be removed. Session history and workspace files are not affected.","settings.title":"Settings","settings.nav.aria":"Settings sections","settings.action.back":"Back","settings.category.settings":"Settings","settings.category.integrations":"Integrations","settings.tab.general":"General","settings.tab.trust":"Security","settings.tab.models":"Models","settings.tab.shortcuts":"Shortcuts","settings.tab.mcp":"MCP","settings.tab.skills":"Skills","settings.tab.plugins":"Plugins","settings.tab.hooks":"Hooks","settings.tab.schedules":"Scheduled Tasks","settings.common.retry":"Retry","settings.common.dismiss":"Dismiss","settings.common.cancel":"Cancel","settings.common.enable":"Enable","settings.general.loading":"Loading settings...","settings.general.loadError":"Failed to load settings","settings.general.saveError":"Failed to save settings","settings.general.responseLanguage":"Response Language","settings.general.responseLanguageHint":"AI will respond in this language","settings.general.autoSave":"Auto-save sessions","settings.general.communicationStyle":"Communication Style","settings.general.communicationStyleHint":"How the agent phrases its replies across every session","settings.appearance.heading":"Appearance","settings.appearance.theme":"Theme Preference","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.system":"System","settings.appearance.compactSidebar":"Compact sidebar","settings.appearance.codeTheme":"Code theme","settings.appearance.codeThemeHint":"Syntax highlighting colors","settings.notifications.heading":"Notifications","settings.notifications.buildFinished":"Build finished","settings.notifications.errorsOnly":"Errors only","settings.notifications.systemSounds":"System sounds","settings.notifications.blocked":"Browser notifications are blocked","settings.notifications.unavailable":"Browser notifications are unavailable","settings.notifications.enablePrompt":"Enable alerts while this tab is in the background","settings.privacy.heading":"Privacy","settings.privacy.telemetry":"Telemetry","settings.privacy.crash":"Crash reports","settings.models.description":"Configure API keys and model settings for different providers.","settings.models.loading":"Loading models...","settings.models.loadChannelsFailed":"Failed to load provider channels","settings.models.saveFailed":"Failed to save model","settings.models.deleteFailed":"Failed to delete model","settings.models.updateFailed":"Failed to update model","settings.models.updateChannelFailed":"Failed to update provider channel","settings.models.probeFailed":"Provider probe failed","settings.models.deleteChannelFailed":"Failed to delete provider channel","settings.models.empty":"No models configured yet","settings.models.add":"+ Add New Model","settings.models.missingCredential":"Missing credential","settings.models.configured":"Configured","settings.models.deleting":"Deleting...","settings.models.deleteModel":"Delete model","settings.models.deleteChannel":"Delete channel","settings.models.deleteModelAria":"Delete {name}","settings.models.deleteModelPrompt":"Delete {name} and its saved configuration?","settings.models.deleteChannelAria":"Delete channel {name}","settings.models.deleteChannelPrompt":"Delete channel {name}, its credential, and {count} configured model(s)? Fallback references will also be removed.","settings.models.editModelAria":"Edit {name}","settings.models.editChannelAria":"Edit channel {name}","settings.models.testChannelAria":"Test {name}","settings.models.deleteChannelActionAria":"Delete channel {name}","settings.models.modelCountOne":"{count} model","settings.models.modelCountMany":"{count} models","settings.models.defaultEndpoint":"default endpoint","settings.shortcuts.searchPlaceholder":"Search actions...","settings.shortcuts.scope.all":"All scopes","settings.shortcuts.scope.global":"Global","settings.shortcuts.scope.chat":"Chat","settings.shortcuts.scope.layout":"Layout","settings.shortcuts.reset":"Reset","settings.shortcuts.col.action":"Action","settings.shortcuts.col.shortcut":"Shortcut","settings.shortcuts.col.scope":"Scope","settings.shortcuts.empty":"No shortcuts found.","settings.shortcuts.action.searchTasks":"Search tasks","settings.shortcuts.action.openCommands":"Open command center","settings.shortcuts.action.newTask":"New task","settings.shortcuts.action.focusComposer":"Focus composer","settings.shortcuts.action.toggleSidebar":"Toggle sidebar","settings.common.reload":"Reload","settings.trust.state.notRequired":"No trust required","settings.trust.state.trusted":"Workspace trusted","settings.trust.state.review":"Review required","settings.trust.state.error":"Trust store error","settings.trust.selectSession":"Select a project session to review folder trust.","settings.trust.heading":"Workspace trust","settings.trust.inheritedFrom":" · inherited from {source}","settings.trust.reloadAria":"Reload workspace trust","settings.trust.revoke":"Revoke","settings.trust.trustWorkspace":"Trust workspace","settings.trust.restartNotice":"Restart Blade to reload project models, MCP, LSP, permissions, and plugins.","settings.trust.revokeAria":"Revoke workspace trust","settings.trust.confirmTrust":"Allow {count} project source(s) to configure models, MCP, LSP, permissions, environment, instructions, commands, skills, agents, or plugins?","settings.trust.confirmRevoke":"Block project-controlled executable configuration after restart?","settings.trust.saving":"Saving...","settings.trust.trustReviewed":"Trust reviewed workspace","settings.trust.revokeTrust":"Revoke trust","settings.trust.empty":"No project-controlled executable configuration was found.","settings.trust.loadFailed":"Failed to load workspace trust","settings.trust.updateFailed":"Failed to update workspace trust","settings.hooks.state.disabled":"Hooks disabled","settings.hooks.state.notRequired":"No external hooks","settings.hooks.state.review":"Review required","settings.hooks.state.trusted":"Trusted","settings.hooks.state.modified":"Changed since approval","settings.hooks.state.error":"Trust store error","settings.hooks.selectSession":"Select a project session to review its hooks.","settings.hooks.heading":"Hook trust","settings.hooks.reloadAria":"Reload hook trust","settings.hooks.revoke":"Revoke","settings.hooks.trustDigest":"Trust digest","settings.hooks.currentSession":"Current session execution","settings.hooks.session.open":"Open a session to control its hooks.","settings.hooks.session.loading":"Loading session state...","settings.hooks.session.disabled":"Disabled by workspace configuration.","settings.hooks.session.paused":"Paused only for this session.","settings.hooks.session.active":"Hooks may run for this session after trust checks.","settings.hooks.session.unavailable":"Disabled by this session runtime or host policy.","settings.hooks.session.enableAria":"Enable hooks for current session","settings.hooks.session.pauseAria":"Pause hooks for current session","settings.hooks.session.unavailableAria":"Hooks unavailable for current session","settings.hooks.confirmTrustAria":"Trust project hooks","settings.hooks.confirmRevokeAria":"Revoke project hook trust","settings.hooks.confirmTrust":"Run these {count} hooks with your user permissions until their configuration changes?","settings.hooks.confirmRevoke":"Stop all configured hooks for this project until explicitly trusted again?","settings.hooks.saving":"Saving...","settings.hooks.trustReviewed":"Trust reviewed hooks","settings.hooks.revokeTrust":"Revoke trust","settings.hooks.empty":"No configured command, HTTP, or prompt hooks.","settings.hooks.loadFailed":"Failed to load hook trust","settings.hooks.updateFailed":"Failed to update hook trust","settings.hooks.sessionUpdateFailed":"Failed to update session hooks","settings.plugins.selectProject":"Select a project to manage its plugins.","settings.plugins.heading":"Workspace plugins","settings.plugins.changesNote":"Changes apply to future session snapshots and persist in the selected scope.","settings.plugins.reloadAria":"Reload plugins","settings.plugins.sourcePolicy":"Source policy","settings.plugins.savePolicyAria":"Save plugin source policy","settings.plugins.saving":"Saving…","settings.plugins.saveForProject":"Save for project","settings.plugins.restrictAria":"Restrict plugin sources","settings.plugins.restrictAllowlists":"Restrict to allowlists","settings.plugins.requireShaAria":"Require full Git commit SHA","settings.plugins.requireSha":"Require full Git SHA","settings.plugins.environmentLocked":" · environment locked","settings.plugins.gitHostsAria":"Allowed plugin Git hosts","settings.plugins.marketplacesAria":"Allowed plugin Marketplaces","settings.plugins.localRootsAria":"Allowed local plugin roots","settings.plugins.emptyAllowlists":"Empty allowlists deny every plugin source.","settings.plugins.installHeading":"Install trusted plugin","settings.plugins.sourceAria":"Plugin source","settings.plugins.install":"Install","settings.plugins.trustSource":"I trust this source to activate Hooks, MCP servers, skills, and commands.","settings.plugins.activationScope":"Activation write scope","settings.plugins.activationScopeHint":"Higher-priority layers continue to determine the effective state.","settings.plugins.scopeAria":"Plugin activation scope","settings.plugins.scope.local":"Local","settings.plugins.scope.project":"Project","settings.plugins.scope.global":"Global","settings.plugins.scope.localDesc":"Only this checkout","settings.plugins.scope.projectDesc":"Shared project settings","settings.plugins.scope.globalDesc":"All projects","settings.plugins.scope.invocation":"Invocation","settings.plugins.scope.default":"Default","settings.plugins.layer.on":"on","settings.plugins.layer.off":"off","settings.plugins.capability.commands":"{count} commands","settings.plugins.capability.skills":"{count} skills","settings.plugins.capability.agents":"{count} agents","settings.plugins.capability.hooks":"{count} hooks","settings.plugins.capability.mcp":"{count} MCP","settings.plugins.noResources":"No declared resources","settings.plugins.effective":"effective: {scope}","settings.plugins.managed":"managed","settings.plugins.invocationScoped":"Invocation-scoped via --plugin-dir","settings.plugins.enableAria":"Enable {name}","settings.plugins.disableAria":"Disable {name}","settings.plugins.unavailableAria":"Unavailable {name}","settings.plugins.updateAria":"Update {name}","settings.plugins.uninstallAria":"Uninstall {name}","settings.plugins.confirmUpdate":"Confirm update","settings.plugins.update":"Update","settings.plugins.confirmRemove":"Confirm remove","settings.plugins.empty":"No plugins discovered for this project.","settings.plugins.marketplaces":"Marketplaces","settings.plugins.configuredCount":"{count} configured","settings.plugins.marketplaceSourceAria":"Marketplace source","settings.plugins.addMarketplaceAria":"Add marketplace","settings.plugins.add":"Add","settings.plugins.noDescription":"No description","settings.plugins.refreshMarketplaceAria":"Refresh marketplace {name}","settings.plugins.removeMarketplaceAria":"Remove marketplace {name}","settings.plugins.confirm":"Confirm","settings.plugins.installedSuffix":" · installed","settings.plugins.marketplaceEmpty":"Add a Marketplace to discover installable plugins.","settings.plugins.loadFailed":"Failed to load plugins","settings.plugins.actionFailed":"Plugin action failed","settings.plugins.updateFailed":"Failed to update plugin","settings.models.addModal.title":"Add Model","settings.models.addModal.close":"Close add model","settings.models.addModal.loadProvidersError":"Failed to load providers","settings.models.addModal.loadModelsError":"Failed to load models","settings.models.addModal.provider":"Provider","settings.models.addModal.loadingProviders":"Loading providers...","settings.models.addModal.selectProvider":"Select provider","settings.models.addModal.configuredSuffix":" - configured","settings.models.addModal.customOpenAI":"Custom OpenAI Endpoint","settings.models.addModal.customAnthropic":"Custom Anthropic Endpoint","settings.models.addModal.channelId":"Channel ID","settings.models.addModal.channelIdHint":"Stable config and credential identifier.","settings.models.addModal.channelName":"Channel name","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"Uses the Anthropic Messages protocol.","settings.models.addModal.openaiProtocol":"Uses the OpenAI Chat Completions protocol.","settings.models.addModal.modelId":"Model ID","settings.models.addModal.model":"Model","settings.models.addModal.loadingModels":"Loading models...","settings.models.addModal.selectModel":"Select model","settings.models.addModal.reasoningSuffix":" - reasoning","settings.models.addModal.visionSuffix":" - vision","settings.models.addModal.displayName":"Display name","settings.models.addModal.displayNamePlaceholder":"Optional alias","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API key","settings.models.addModal.apiKeyPlaceholder":"Stored separately in auth.json","settings.models.addModal.showApiKey":"Show API key","settings.models.addModal.hideApiKey":"Hide API key","settings.models.addModal.oauthNote":"This provider requires OAuth or ambient credentials. Configure it externally before selecting the model.","settings.models.addModal.saveModel":"Save Model","settings.models.addModal.saving":"Saving...","settings.models.addModal.channelIdError":'Channel ID must start with a lowercase letter and contain only lowercase letters, numbers, ".", "_" or "-"',"settings.models.addModal.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editModal.srTitle":"Edit Model","settings.models.editModal.title":"Edit Model Overrides","settings.models.editModal.close":"Close edit model","settings.models.editModal.displayName":"Display name","settings.models.editModal.replaceApiKey":"Replace provider API key","settings.models.editModal.replaceApiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editModal.baseUrlOverride":"Base URL override","settings.models.editModal.baseUrlPlaceholder":"Leave empty to use default endpoint","settings.models.editModal.streamIdleTimeout":"Stream idle timeout (ms)","settings.models.editModal.save":"Save","settings.models.editModal.saving":"Saving...","settings.models.editModal.streamIdleTimeoutError":"Stream idle timeout must be at least 1000ms","settings.models.editModal.credentialError":"Failed to update provider credential","settings.models.editProvider.title":"Edit Provider Channel","settings.models.editProvider.close":"Close edit provider","settings.models.editProvider.channelName":"Channel name","settings.models.editProvider.channelNameRequired":"Channel name is required","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"Provider Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editProvider.apiKeyEnv":"API key environment variable","settings.models.editProvider.apiKeyEnvPlaceholder":"Optional, for example TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"Replace API key","settings.models.editProvider.apiKeyAria":"Provider API key","settings.models.editProvider.apiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editProvider.save":"Save channel","settings.models.editProvider.saving":"Saving...","settings.style.auto":"Auto","settings.style.pragmatic":"Pragmatic","settings.style.friendly":"Friendly","settings.style.explanatory":"Explanatory","mcp.status.connected":"Connected","mcp.status.connecting":"Connecting...","mcp.status.reconnecting":"Recovering...","mcp.status.offline":"Offline","mcp.status.error":"Error","mcp.status.recoveringAttempt":"Recovering {attempt}/{max}","mcp.oauth.status.disabled":"Not configured","mcp.oauth.status.unavailable":"Unavailable in this runtime","mcp.oauth.status.unauthenticated":"Authorization required","mcp.oauth.status.authorizing":"Waiting for authorization...","mcp.oauth.status.authenticated":"Authorized","mcp.oauth.status.error":"Authorization failed","mcp.catalog.tag.official":"Official","mcp.catalog.tag.popular":"Popular","mcp.catalog.tag.community":"Community","mcp.action.refreshServers":"Refresh MCP servers","mcp.action.addServer":"Add server","mcp.action.close":"Close MCP","mcp.action.dismiss":"Dismiss","mcp.action.retry":"Retry","mcp.action.disconnect":"Disconnect","mcp.action.disconnecting":"Disconnecting...","mcp.action.stopRecovery":"Stop recovery","mcp.action.connect":"Connect","mcp.action.connecting":"Connecting...","mcp.action.authorizeFirst":"Authorize first","mcp.action.delete":"Delete","mcp.action.cancel":"Cancel","mcp.action.deleting":"Deleting...","mcp.action.deleteServer":"Delete server","mcp.tab.installed":"Installed ({count})","mcp.tab.catalog":"Catalog","mcp.servers.title":"Servers","mcp.servers.searchAria":"Search installed MCP servers","mcp.servers.searchPlaceholder":"Search servers...","mcp.servers.loading":"Loading servers...","mcp.servers.noMatch":"No servers match your search","mcp.servers.none":"No MCP servers configured","mcp.server.errorLabel":"Error: {error}","mcp.server.deleteAria":"Delete {name}","mcp.server.selectPrompt":"Select a server to view details","mcp.instructions.title":"Server instructions","mcp.instructions.detailsOmittedByPolicy":"[details omitted by runtime policy]","mcp.instructions.detailsOmitted":"Details omitted","mcp.instructions.truncated":"Truncated to the safe display budget","mcp.tasks.title":"Experimental MCP Tasks","mcp.tasks.summary":"{count} per Session · {interval}ms poll","mcp.tasks.disabledByDefault":"Disabled by default","mcp.tasks.enabled":"Enabled","mcp.tasks.disabled":"Disabled","mcp.oauth.signingOut":"Signing out...","mcp.oauth.signOut":"Sign out","mcp.oauth.continueAuthorization":"Continue authorization","mcp.oauth.resumeAuthorization":"Resume authorization","mcp.oauth.opening":"Opening...","mcp.oauth.authorize":"Authorize","mcp.delete.confirm":"Remove this server and its saved configuration?","mcp.tools.title":"Tools ({count})","mcp.tools.none":"No tools available","mcp.completion.title":"Argument completion","mcp.completion.connectPrompt":"Connect the server to request suggestions","mcp.completion.unsupported":"Server does not advertise MCP completions","mcp.completion.noTargets":"No completable prompt arguments or template variables","mcp.completion.targetAria":"MCP completion target","mcp.completion.partialAria":"MCP completion partial value","mcp.completion.partialPlaceholder":"Partial value","mcp.completion.completing":"Completing...","mcp.completion.complete":"Complete","mcp.completion.suggestionsAria":"MCP completion suggestions","mcp.completion.empty":"[empty]","mcp.completion.noSuggestions":"No suggestions","mcp.meta.truncatedSuffix":" · truncated","mcp.meta.detailsOmittedSuffix":" · details omitted","mcp.diagnostics.title":"Diagnostics","mcp.diagnostics.refreshAria":"Refresh {name} MCP logs","mcp.diagnostics.logsAria":"{name} MCP logs","mcp.log.levelAria":"MCP logging level","mcp.log.setting":"Setting...","mcp.log.loading":"Loading logs...","mcp.log.none":"No logs captured","mcp.catalog.searchAria":"Search MCP server catalog","mcp.catalog.searchPlaceholder":"Search MCP servers on npm (min 3 chars)...","mcp.catalog.retry":"Retry catalog","mcp.catalog.noDescription":"No description","mcp.catalog.byAuthor":"by {author}","mcp.catalog.installed":"Installed","mcp.catalog.installing":"Installing...","mcp.catalog.install":"Install","mcp.catalog.noPackages":"No packages found","mcp.catalog.noMore":"No more packages","mcp.catalog.packagesFound":"{count} packages found","mcp.catalog.browseGlama":"Browse more on Glama","mcp.error.connectFailed":"Failed to connect server","mcp.error.disconnectFailed":"Failed to disconnect server","mcp.error.deleteFailed":"Failed to delete server","mcp.error.loginFailed":"Failed to login MCP OAuth","mcp.error.logoutFailed":"Failed to logout MCP OAuth","mcp.error.loggingLevelFailed":"Failed to set MCP logging level","mcp.error.completionFailed":"MCP completion failed","mcp.add.title":"Add MCP Server","mcp.add.closeAria":"Close add MCP server","mcp.add.modeForm":"Form","mcp.add.jsonConfig":"JSON config","mcp.add.jsonConfigAria":"JSON configuration","mcp.add.serverName":"Server name","mcp.add.command":"Command","mcp.add.commandAria":"Server command","mcp.add.argsLabel":"Arguments (space separated)","mcp.add.argsAria":"Server arguments","mcp.add.invalidJson":"Enter valid JSON with a server name and transport.","mcp.add.nameCommandRequired":"Name and command are required.","mcp.add.adding":"Adding...","mcp.add.submit":"Add Server","mcp.install.title":"Install MCP Server","mcp.install.titleWithName":"Install {name}","mcp.install.closeAria":"Close MCP installation","mcp.install.args":"Arguments","mcp.install.commandPreview":"Command: npx {args}","mcp.install.nameRequired":"Server name is required.","skills.title":"Skills","skills.action.install":"Install skill","skills.action.installShort":"Install","skills.action.refreshAria":"Refresh skills","skills.action.closeAria":"Close skills","skills.action.dismiss":"Dismiss","skills.action.retry":"Retry","skills.action.cancel":"Cancel","skills.action.close":"Close","skills.action.hide":"Hide","skills.action.enable":"Enable","skills.action.disable":"Disable","skills.action.saving":"Saving...","skills.status.enabled":"Enabled","skills.status.disabled":"Disabled","skills.status.installed":"Installed","skills.noDescriptionShort":"No description","skills.noDescription":"No description available","skills.installed.title":"Installed","skills.installed.searchAria":"Search installed skills","skills.installed.searchPlaceholder":"Search skills...","skills.installed.loading":"Loading skills...","skills.installed.noMatch":"No skills match your search","skills.installed.empty":"No skills installed","skills.uninstall.managedHint":"Only Blade user skills can be uninstalled","skills.uninstall.managed":"Managed","skills.uninstall.action":"Uninstall","skills.uninstall.confirmAria":"Uninstall {name}","skills.uninstall.confirmPrompt":"Remove this skill from ~/.blade/skills?","skills.uninstall.inProgress":"Uninstalling...","skills.uninstall.confirm":"Uninstall skill","skills.details.title":"Details","skills.details.provider":"Provider","skills.details.location":"Location","skills.details.capabilities":"Capabilities","skills.details.allowedTools":"Allowed Tools ({count})","skills.detail.emptyState":"Select a skill to view details","skills.install.title":"Install Skill","skills.install.closeAria":"Close skill installation","skills.install.tab.catalog":"Catalog","skills.install.tab.repo":"Repo","skills.install.tab.local":"Local","skills.install.catalog.searchAria":"Search skill catalog","skills.install.catalog.searchPlaceholder":"Search catalog...","skills.install.catalog.loading":"Loading catalog...","skills.install.catalog.empty":"No skills found","skills.install.catalog.byAuthor":"by {author}","skills.install.catalog.tag.official":"Official","skills.install.catalog.tag.popular":"Popular","skills.install.catalog.tag.community":"Community","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"Skill repository URL","skills.install.repo.credentialsHint":"Uses Git credentials available to the Blade process","skills.install.local.label":"Local path","skills.install.local.inputAria":"Local skill path","skills.status.dialogTitle":"Install Status","skills.status.confirm.title":"Confirm Install","skills.status.confirm.prompt":"Install selected skill?","skills.status.installing.title":"Installing","skills.status.installing.description":"Downloading and verifying…","skills.status.failed.title":"Install Failed","skills.status.failed.fallback":"Installation failed.","skills.status.failed.hint":"Check access and try again.","skills.error.deleteFailed":"Failed to delete skill","skills.error.toggleFailed":"Failed to toggle skill","skills.error.installFailed":"Failed to install skill","schedule.title":"Scheduled Tasks","schedule.description":"Run headless task prompts automatically on a cron, interval, or one-time trigger.","schedule.new":"New schedule","schedule.newAria":"Create a new schedule","schedule.refresh":"Refresh","schedule.reloadAria":"Reload schedules","schedule.create":"Create","schedule.save":"Save","schedule.cancel":"Cancel","schedule.confirmDelete":"Confirm?","schedule.empty":"No schedules yet","schedule.enabled":"Enabled","schedule.disabled":"Disabled","schedule.never":"never","schedule.nextRun":"Next run","schedule.lastRun":"Last run","schedule.runCount":"{count} runs","schedule.trigger.kindAria":"Trigger type","schedule.trigger.cron":"Cron","schedule.trigger.interval":"Interval","schedule.trigger.once":"Once","schedule.field.title":"Title (optional)","schedule.field.cron":"Cron expression","schedule.field.interval":"Interval","schedule.field.runAt":"Run at","schedule.field.prompt":"Prompt","schedule.field.project":"Project path","schedule.field.model":"Model (optional)","schedule.field.permissionMode":"Permission mode","schedule.field.isolation":"Isolation","schedule.placeholder.title":"Nightly dependency audit","schedule.placeholder.cron":"0 9 * * 1 (min hour dom mon dow)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"Describe the task to run…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"e.g. anthropic/claude-sonnet","schedule.model.current":"Use current model","schedule.permission.default":"Default","schedule.permission.autoEdit":"Auto edit","schedule.permission.yolo":"Yolo","schedule.permission.plan":"Plan","schedule.isolation.local":"Local","schedule.isolation.worktree":"Worktree","schedule.cadence.cron":"cron: {expr}","schedule.cadence.interval":"every {interval}","schedule.cadence.once":"once at {time}","schedule.status.queued":"queued","schedule.status.running":"running","schedule.status.completed":"completed","schedule.status.failed":"failed","schedule.status.cancelled":"cancelled","schedule.status.interrupted":"interrupted","schedule.status.error":"error","schedule.status.never":"no runs yet","schedule.runNowAria":'Run "{title}" now',"schedule.editAria":'Edit "{title}"',"schedule.deleteAria":'Delete "{title}"',"schedule.enableAria":'Enable "{title}"',"schedule.disableAria":'Disable "{title}"',"schedule.error.promptRequired":"A prompt is required.","schedule.error.projectRequired":"A project path is required.","schedule.error.cronRequired":"A cron expression is required.","schedule.error.invalidInterval":"Enter an interval like 30m, 2h, or 1d.","schedule.error.runAtRequired":"Pick a valid run time.","schedule.error.loadFailed":"Failed to load scheduled tasks.","schedule.error.createFailed":"Failed to create scheduled task.","schedule.error.updateFailed":"Failed to update scheduled task.","schedule.error.deleteFailed":"Failed to delete scheduled task.","schedule.error.toggleFailed":"Failed to change scheduled task status.","schedule.error.runFailed":"Failed to run scheduled task."},g0={"app.restoring":"正在恢复工作区…","layout.workspace.pathAria":"工作区路径","layout.workspace.empty":"未选择工作区","layout.action.rewind":"回溯会话","layout.action.filePreview":"文件预览","layout.action.filePreviewToggle":"切换文件预览","layout.action.openNavigation":"打开导航","terminal.title":"终端","terminal.status.connected":"终端已连接","terminal.status.disconnected":"终端未连接","terminal.action.minimize":"最小化终端","terminal.action.restore":"恢复终端","terminal.action.close":"关闭终端","sidebar.brand.badge":"网页版","sidebar.action.collapse":"收起侧边栏","sidebar.action.expand":"展开侧边栏","sidebar.navigationAria":"任务导航","sidebar.action.newTask":"新建任务","sidebar.action.newTaskShort":"新建任务","sidebar.action.terminal":"终端","sidebar.action.terminalToggle":"切换终端","sidebar.action.searchTasks":"搜索任务","sidebar.unreadTasks":"{count} 个未读任务","sidebar.section.skills":"技能","sidebar.section.mcp":"MCP","sidebar.section.settings":"设置","sidebar.status.user":"用户","sidebar.status.feedLive":"任务通道已连接","sidebar.status.feedOffline":"任务通道未连接","sidebar.empty.title":"暂无任务","sidebar.empty.hint":"在主页派发新任务","sidebar.group.running":"进行中","sidebar.group.queued":"排队中","sidebar.group.interrupted":"已暂停","sidebar.group.failed":"已失败","sidebar.group.cancelled":"已取消","sidebar.group.done":"已完成","sidebar.group.showMore":"再显示 {count} 条","sidebar.group.showLess":"收起","sidebar.view.project":"项目","sidebar.view.status":"状态","sidebar.view.projectAria":"按项目分组会话","sidebar.view.statusAria":"按状态分组会话","sidebar.project.active":"当前","sidebar.project.expand":"展开 {name}","sidebar.project.collapse":"收起 {name}","sidebar.project.newTask":"在 {name} 中新建任务","sidebar.project.reorder":"调整 {name} 的顺序,当前位置 {position}/{count}","sidebar.project.reorderHint":"拖拽调整顺序,或使用上下方向键移动","sidebar.project.reordered":"已将 {name} 移到第 {position} 位","sidebar.project.projects":"项目","sidebar.catalog.syncing":"正在同步任务历史…","sidebar.catalog.loaded":"已载入 {count} 条","sidebar.catalog.incomplete":"任务历史未完整加载","sidebar.catalog.retry":"重试","projects.dialog.title":"项目","projects.dialog.description":"绑定本地目录,无需重启 Blade 即可切换任务上下文。","projects.bind.placeholder":"/项目的绝对路径","projects.bind.pathLabel":"项目路径","projects.bind.action":"绑定","projects.bind.failed":"项目绑定失败","projects.pick.action":"选择项目文件夹","projects.pick.actionShort":"选择","projects.pick.picking":"选择中…","projects.pick.failed":"无法选择项目文件夹","projects.unbind.action":"解除项目绑定","projects.unavailable":"目录不可用","sidebar.language.label":"语言","sidebar.language.aria":"切换语言","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"独立分支","session.env.local":"本地","session.action.select":"选择「{title}」","session.action.save":"保存「{title}」","session.action.cancel":"取消「{title}」","session.action.more":"「{title}」的更多操作","session.action.fork":"派生「{title}」","session.action.forkShort":"派生","session.action.rename":"重命名「{title}」","session.action.renameShort":"重命名","session.action.archive":"归档「{title}」","session.action.archiveShort":"归档","session.action.export":"将「{title}」导出为 Markdown","session.action.exportShort":"导出 Markdown","session.action.exportingShort":"正在导出…","session.action.delete":"删除「{title}」","session.action.deleteShort":"删除","session.action.stop":"停止「{title}」","session.action.stopping":"正在停止「{title}」","session.action.retry":"重试「{title}」","session.action.retrying":"正在重试「{title}」","session.reason.cancelledByUser":"已由用户取消","session.title.codeReview":"代码评审","session.forkedFrom":"派生自","session.retriedFrom":"重试自","session.retryShort":"重试","session.queued":"排队 #{position}/{depth}","archive.title":"归档","archive.subtitle":"安全保留,不占用当前任务列表","archive.open":"打开会话归档","archive.refresh":"刷新归档会话","archive.retry":"重试","archive.loading":"正在载入归档…","archive.empty":"暂无归档会话","archive.restore":"恢复「{title}」","archive.restoreShort":"恢复","archive.restoreAncestor":"请先恢复归档根会话","archive.inherited":"随 {id} 一同归档","taskSwitcher.title":"任务切换器","taskSwitcher.description":"跨项目搜索并打开任务。","taskSwitcher.searchAria":"搜索任务","taskSwitcher.placeholder":"搜索标题、项目、分支、状态或 Session ID…","taskSwitcher.results":"{count} 个结果","taskSwitcher.recent":"最近任务","taskSwitcher.scope":"已索引 {count} 个任务","taskSwitcher.indexing":"正在索引任务…","taskSwitcher.resultsAria":"任务搜索结果","taskSwitcher.current":"当前","taskSwitcher.unread":"{count} 个未读","taskSwitcher.needsAction":"{count} 个需要操作","taskSwitcher.new":"新","taskSwitcher.empty":"没有匹配的任务","taskSwitcher.emptyHint":"尝试项目、分支、状态或更短的关键词。","taskSwitcher.hint.navigate":"选择","taskSwitcher.hint.open":"打开","taskSwitcher.hint.toggle":"切换","taskSwitcher.action.failed":"任务操作失败","commandCenter.title":"命令中心","commandCenter.description":"搜索任务,或执行工作区与应用操作。","commandCenter.searchAria":"搜索操作","commandCenter.placeholder":"搜索操作、设置或工具…","commandCenter.modeAria":"命令中心模式","commandCenter.mode.tasks":"任务","commandCenter.mode.commands":"操作","commandCenter.actions":"{count} 个操作","commandCenter.resultsAria":"操作搜索结果","commandCenter.empty":"没有匹配的操作","commandCenter.emptyHint":"尝试工具、面板或设置名称。","commandCenter.action.newTask":"新建任务","commandCenter.action.newTaskDescription":"打开一个干净的任务编辑器","commandCenter.action.preview":"切换预览区","commandCenter.action.previewDescription":"审查文件、Diff 与运行日志","commandCenter.action.terminal":"切换终端","commandCenter.action.terminalDescription":"打开或关闭工作区 Shell","commandCenter.action.settings":"打开设置","commandCenter.action.settingsDescription":"配置外观与行为","commandCenter.action.models":"配置模型","commandCenter.action.modelsDescription":"选择 Provider 与任务模型","commandCenter.action.shortcuts":"查看键盘快捷键","commandCenter.action.shortcutsDescription":"浏览全局与上下文按键","commandCenter.action.skills":"管理 Skills","commandCenter.action.skillsDescription":"发现并配置 Agent 能力","commandCenter.action.mcp":"管理 MCP Server","commandCenter.action.mcpDescription":"配置已连接的工具与服务","commandCenter.action.sidebar":"切换侧边栏","commandCenter.action.sidebarDescription":"显示或隐藏项目导航","taskHome.eyebrow":"任务调度台 · 就绪","taskHome.feed.connecting":"任务调度台 · 正在连接","taskHome.feed.reconnecting":"任务调度台 · 正在重连","taskHome.feed.offline":"任务调度台 · 已离线","taskHome.feed.offlineDescription":"实时任务更新已暂停,服务端正在运行的任务不会停止。","taskHome.feed.retry":"重新连接","taskHome.hero.prefix":"要在这里让 Blade 做点什么:","taskHome.hero.projectFallback":"当前工作区","taskHome.hero.subtitle":"派发一个任务后即可继续手头的工作。每个任务在独立的 worktree 中运行、状态持久保存,完成时会以可复核的工作区形式返回。","taskHome.templates.title":"模板","taskHome.templates.hint":"按 1–4 快速填充","taskHome.template.explore.title":"探索","taskHome.template.explore.description":"追踪行为,梳理系统全貌","taskHome.template.explore.hint":"调用链 · 模块结构","taskHome.template.build.title":"开发","taskHome.template.build.description":"实现一个可上线的功能","taskHome.template.build.hint":"端到端交付特性","taskHome.template.review.title":"评审","taskHome.template.review.description":"找出正确性与回归风险","taskHome.template.review.hint":"审查当前改动","taskHome.review.attachmentsUnsupported":"代码评审不支持附件","taskHome.review.outputSchemaUnsupported":"代码评审使用内置结构化报告 Schema","taskHome.review.usage":"用法:/review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"只读代码评审正在进行","taskHome.review.stale":"评审期间目标已发生变化","taskHome.review.aborted":"代码评审已中止","taskHome.review.interrupted":"代码评审因进程重启而中断","taskHome.review.failed":"代码评审失败","taskHome.review.startFailed":"启动代码评审失败","taskHome.review.invalidTarget":"评审目标无效或没有可评审的改动","taskHome.review.conflict":"当前会话已有任务正在运行","taskHome.template.fix.title":"修复","taskHome.template.fix.description":"定位并修好一个具体故障","taskHome.template.fix.hint":"二分 · 复现 · 打补丁","taskHome.context.isolationToggleTitle":"切换任务隔离方式","taskHome.context.projectSelect":"选择目标项目","taskHome.context.isolation.worktree":"独立 worktree","taskHome.context.isolation.local":"本地工作区","taskHome.context.branchFallback":"无分支","taskHome.context.preparing":"正在准备 worktree","taskHome.setup.aria":"任务准备状态","taskHome.setup.title":"完成准备","taskHome.setup.description":"你可以继续编辑草稿,Blade 正在核对工作区和模型。","taskHome.setup.workspace.title":"工作区","taskHome.setup.workspace.loading":"正在检查可用工作区…","taskHome.setup.workspace.ready":"已选择 {project}","taskHome.setup.workspace.required":"选择一个可用项目","taskHome.setup.workspace.empty":"无项目","taskHome.setup.workspace.action":"选择","taskHome.setup.workspace.retry":"重新加载工作区","taskHome.setup.model.title":"模型","taskHome.setup.model.loading":"正在检查配置…","taskHome.setup.model.ready":"可用于当前任务","taskHome.setup.model.required":"配置或选择一个模型","taskHome.setup.model.action":"配置","taskHome.setup.model.retry":"重试","taskHome.composer.placeholder":"描述目标、约束以及你期望的验收方式……","taskHome.error.dismiss":"关闭","taskHome.recent.title":"最近任务","taskHome.recent.total":"共 {count} 条","taskHome.recent.partial":"已载入 {count} 条 · 继续同步","taskHome.recent.incomplete":"已载入 {count} 条 · 历史不完整","taskSwitcher.indexingLoaded":"已载入 {count} 条 · 正在同步历史","taskHome.footer.note":"独立 worktree 让并行任务不会干扰你当前的工作副本","capacity.title":"{inFlight} 进行中 · {queued} 排队 · 上限 {max}","capacity.suffix.running":" 进行中","capacity.queued":"排队 {queued}","recent.status.running":"进行中","recent.status.queued":"排队中","recent.status.paused":"已暂停","recent.status.failed":"已失败","recent.status.cancelled":"已取消","recent.status.done":"已完成","recent.time.justNow":"刚刚","recent.time.minutes":"{n} 分钟前","recent.time.hours":"{n} 小时前","recent.time.days":"{n} 天前","recent.session.fallbackShort":"会话 {id}","recent.session.fallbackDated":"会话 {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} 个未读任务更新","attention.notification.completed":"任务已完成","attention.notification.failed":"任务失败","attention.notification.interrupted":"任务已中断","attention.notification.permission":"需要审批","attention.notification.question":"需要回答","attention.notification.elicitation":"MCP 需要输入","interaction.permission.title":"需要授权:{tool}","interaction.permission.once":"仅本次允许","interaction.permission.session":"本会话允许","interaction.permission.project":"本项目允许","interaction.permission.deny":"拒绝","interaction.permission.failed":"授权响应失败","interaction.question.answered":"问题已回答","interaction.question.other":"其他","interaction.question.submit":"提交回答","interaction.question.failed":"回答提交失败","interaction.elicitation.title":"MCP 请求输入","interaction.elicitation.submit":"提交给 MCP","interaction.elicitation.open":"打开外部链接","interaction.elicitation.decline":"拒绝","interaction.elicitation.cancel":"取消","interaction.elicitation.responded":"已响应 MCP 请求","interaction.elicitation.cancelled":"MCP 请求已取消","interaction.elicitation.failed":"响应 MCP 请求失败","interaction.elicitation.warning":"仅在信任该 MCP 服务器并理解请求用途时继续。","interaction.bar.permissionTitle":"Agent 正在等待审批","interaction.bar.permissionHint":"请检查待处理的工具请求,审批后任务才会继续。","interaction.bar.questionTitle":"Agent 正在等待回答","interaction.bar.questionHint":"请回答待处理的问题,任务才能继续。","interaction.bar.elicitationTitle":"MCP 服务器正在等待输入","interaction.bar.elicitationHint":"请检查 MCP 请求,响应后任务才会继续。","interaction.bar.review":"查看请求","interaction.badge.permission":"需要审批","interaction.badge.question":"需要回答","interaction.badge.elicitation":"MCP 输入","artifact.env.isolated":"独立分支","artifact.env.local":"本地","artifact.review":"查看变更","artifact.commits":"{count} 次提交","artifact.apply":"应用","artifact.retryApply":"重新应用","artifact.applying":"应用中","artifact.applied":"已应用","artifact.discard":"丢弃任务变更","artifact.discarded":"已丢弃","artifact.conflict":"任务变更无法安全应用。","artifact.conflictHint":"隔离变更已保留。请查看变更、处理源项目状态,然后重试或丢弃。","artifact.discardDialog.title":"丢弃隔离变更?","artifact.discardDialog.description":"将删除 {project} 隔离任务工作区中的 {count} 个变更文件。","artifact.discardDialog.warning":"此操作会永久删除任务 worktree 和分支,不会修改源项目。","artifact.discardDialog.cancel":"保留变更","artifact.discardDialog.confirm":"丢弃变更","chat.list.empty.eyebrow":"Blade · 就绪","chat.list.empty.title":"发送一条消息开始对话","chat.list.empty.hint":"提问、描述改动,或者粘贴一段错误堆栈。","chat.list.loading.eyebrow":"历史对话","chat.list.loading.title":"正在恢复对话…","chat.list.loading.hint":"正在加载消息、任务状态和实时更新。对话较长时可能需要一点时间。","chat.list.showEarlier":"显示更早的 {count} 条消息","chat.list.showEarlierWithRemaining":"显示更早的 {count} 条消息,当前隐藏 {remaining} 条","chat.list.jumpLatest":"回到最新消息","chat.turns.aria":"跳转到之前的消息","chat.turns.label":"第 {n} 轮","chat.timeline.thinking":"思考过程","chat.timeline.tools.runningOne":"正在执行 1 条命令","chat.timeline.tools.running":"正在执行 {count} 条命令","chat.timeline.tools.completedOne":"已执行 1 条命令","chat.timeline.tools.completed":"已执行 {count} 条命令","chat.timeline.tools.completedOneWithError":"已执行 1 条命令 · 执行失败","chat.timeline.tools.completedWithErrors":"已执行 {count} 条命令 · {errors} 条失败","chat.error.dismiss":"关闭错误","chat.error.queueFull":"指令队列已满。请等待已有指令开始执行后重试。","chat.error.turnChanged":"当前轮次已发生变化,此消息尚未接收。请确认内容后重试。","chat.error.title.submission":"消息未发送。","chat.error.title.execution":"本轮运行已停止。","chat.error.title.navigation":"未能打开任务。","chat.error.title.generic":"操作失败。","chat.error.action.returnDraft":"返回草稿","chat.error.action.editResend":"编辑后重发","chat.error.action.retryTask":"重试任务","chat.error.action.retryingTask":"正在重试…","chat.error.action.checkModels":"检查模型设置","task.failure.authentication":"模型服务认证失败,请检查模型凭据。","task.failure.permission":"模型服务拒绝了请求,请检查账号和模型权限。","task.failure.rateLimit":"模型服务达到速率或额度限制。","task.failure.timeout":"模型服务请求超时。","task.failure.network":"无法连接模型服务。","task.failure.modelUnavailable":"当前选择的模型不可用。","task.failure.contextLimit":"请求超出模型上下文限制。","task.failure.unsupportedInput":"当前模型不支持此类输入。","task.failure.runtime":"Agent 运行失败。","chat.connection.reconnecting":"正在恢复实时更新,当前任务仍在后台继续运行。","chat.connection.offline":"实时更新已离线,当前显示的进度可能已经过期。","chat.connection.retry":"重新连接","chat.footer.disclaimer":"Blade 可能会出错,请核对重要信息。","chat.input.placeholder.default":"输入 @ 提及文件,/ 触发命令……","chat.input.placeholder.steering":"添加指令来引导当前轮次……","chat.input.steering.status":"当前轮次可被引导","chat.input.steering.queued":"引导指令已接收 · 待处理 {count} 条","chat.input.steering.enterHint":" · 回车下发指令","chat.input.followUp.queued":"后续指令已接收 · 下一轮排队 {count} 条","chat.input.steering.recoveredOne":"重启后已恢复 {count} 条排队指令","chat.input.steering.recoveredMany":"重启后已恢复 {count} 条排队指令","chat.input.attachment.add":"添加图片","chat.input.attachment.remove":"移除","chat.input.attachment.countLimit":"最多可添加 {count} 张图片。","chat.input.attachment.sizeLimit":"图片编码后总大小不能超过 {size},请移除图片或选择更小的文件。","chat.input.attachment.readFailed":"Blade 无法读取其中一张图片。","chat.input.attachment.usage":"{count}/{limit} 张图片 · 已用 {used} / {budget}","chat.input.attachment.modelUnsupported":"{model} 不支持图片输入,请选择视觉模型或移除图片。","chat.input.attachment.modelRequired":"请先选择支持图片输入的视觉模型。","chat.input.model.placeholder":"选择模型","chat.input.model.empty":"未配置模型","chat.input.model.vision":"视觉","chat.input.model.change":"切换模型","chat.input.model.locked":"请等待当前轮次结束后再切换模型","chat.input.effort.label":"推理 {effort}","chat.input.effort.heading":"推理强度","chat.input.effort.change":"切换推理强度","chat.input.effort.locked":"请等待当前轮次结束后再切换推理强度","chat.input.effort.option":"使用 {effort} 推理强度","chat.input.effort.autoHint":"接近 high","chat.input.serviceTier.label":"速度 {tier}","chat.input.serviceTier.heading":"Provider 服务等级","chat.input.serviceTier.change":"切换 Provider 服务等级","chat.input.serviceTier.locked":"请等待当前轮次结束后再切换服务等级","chat.input.serviceTier.option":"使用 {tier} 服务等级","chat.input.serviceTier.fastHint":"优先通道","chat.input.serviceTier.flexHint":"低成本","chat.input.responseVerbosity.label":"输出 {verbosity}","chat.input.responseVerbosity.heading":"响应详略","chat.input.responseVerbosity.change":"切换响应详略","chat.input.responseVerbosity.locked":"请等待当前轮次结束后再切换响应详略","chat.input.responseVerbosity.option":"使用 {verbosity} 响应详略","chat.input.responseVerbosity.autoHint":"模型默认","chat.input.outputSchema.title":"结构化输出","chat.input.outputSchema.description":"要求本轮最终返回符合该 JSON Schema 的对象。","chat.input.outputSchema.change":"设置结构化输出 Schema","chat.input.outputSchema.locked":"请等待当前轮次结束后再修改输出 Schema","chat.input.outputSchema.editor":"JSON Schema 编辑器","chat.input.outputSchema.placeholder":"粘贴 JSON Schema 对象","chat.input.outputSchema.example":"使用示例","chat.input.outputSchema.clear":"清除","chat.input.outputSchema.invalid":"请输入有效的 JSON 对象;完整 Schema 将由服务端校验。","chat.input.outputSchema.shellUnsupported":"结构化输出不能与 Shell 命令同时使用。","chat.structuredOutput.title":"结构化输出","chat.structuredOutput.copy":"复制结构化输出","chat.input.communicationStyle.label":"风格 {style}","chat.input.communicationStyle.heading":"沟通风格","chat.input.communicationStyle.change":"切换沟通风格","chat.input.communicationStyle.locked":"请等待当前轮次结束后再切换沟通风格","chat.input.communicationStyle.option":"使用 {style} 沟通风格","chat.input.communicationStyle.autoHint":"Blade 默认","chat.input.communicationStyle.pragmaticHint":"直接","chat.input.communicationStyle.friendlyHint":"协作","chat.input.communicationStyle.explanatoryHint":"解释取舍","chat.notice.dismiss":"关闭提示","chat.input.mode.default":"手动审批","chat.input.mode.default.desc":"每个重要操作都需要你的批准","chat.input.mode.autoEdit":"自动审批","chat.input.mode.autoEdit.desc":"让 AI 审核并批准重要操作","chat.input.mode.yolo":"完全访问","chat.input.mode.yolo.desc":"无需询问,直接在你的电脑上运行","chat.input.mode.yolo.confirm.title":"启用完全访问模式?","chat.input.mode.yolo.confirm.desc":"在此模式下,Agent 将直接执行所有操作(包括文件写入、Shell 命令和网络请求)而不请求许可。仅在你信任当前上下文时启用。","chat.input.mode.yolo.confirm.cancel":"取消","chat.input.mode.yolo.confirm.accept":"启用","chat.input.mode.plan":"计划","chat.input.mode.plan.desc":"先拟定计划,暂不做任何改动","chat.input.mode.aria":"Agent 操作审批","chat.input.action.stop":"停止当前轮次","chat.input.action.stopping":"正在停止当前轮次","chat.input.action.steer":"引导当前轮次","chat.input.action.send":"发送消息","chat.input.action.submitting":"正在提交消息","chat.review.title":"代码评审","chat.review.target":"目标","chat.review.target.uncommitted":"未提交改动","chat.review.target.base":"相对 {ref} 的改动","chat.review.target.commit":"提交 {ref}","chat.review.status":"状态","chat.review.status.completed":"已完成","chat.review.status.stale":"已过期","chat.review.status.failed":"失败","chat.review.status.aborted":"已中止","chat.review.status.interrupted":"已中断","chat.review.findings":"问题","chat.review.noFindings":"未发现可执行问题","chat.review.confidence":"置信度 {value}","chat.review.error":"错误","chat.subagent.resumedFromTitle":"从 {id} 恢复","chat.subagent.resumedDepth":"已恢复 · 层级 {depth}","chat.subagent.loadingLogs":"正在加载子智能体日志…","chat.subagent.resumedAs":"已恢复为 {id} · {status} · 层级 {depth}","chat.subagent.resume":"恢复","chat.subagent.resumeAria":"恢复子智能体","chat.subagent.followUpAria":"子智能体后续指令","chat.subagent.followUpPlaceholder":"描述需要继续处理的工作","chat.subagent.cancel":"取消","chat.subagent.resumeAgent":"恢复智能体","chat.subagent.resumeFailed":"恢复子智能体失败","chat.markdown.copyCode":"复制代码","chat.rewind.title":"回溯会话","chat.rewind.description":"返回到某条用户消息之前的节点。","chat.rewind.loading":"正在加载检查点","chat.rewind.empty":"暂无可回溯的检查点","chat.rewind.checkpointAria":"回溯检查点","chat.rewind.userMessage":"用户消息","chat.rewind.fileCountOne":"{count} 个文件","chat.rewind.fileCountMany":"{count} 个文件","chat.rewind.restoreCode":"恢复代码变更","chat.rewind.restoreCodeHint":"回滚此检查点及之后更改的文件。","chat.rewind.cancel":"取消","chat.rewind.confirm":"回溯","chat.rewind.loadFailed":"加载回溯检查点失败","chat.rewind.failed":"回溯失败。请检查会话错误后重试。","status.context":"上下文","status.tokenLimitTooltip":"此为估算的 token 上限,模型回报上下文尺寸后会自动更新。","status.phase.running":"生成中…","status.phase.compacting":"正在压缩上下文…","status.phase.switchingModel":"正在切换模型…","status.phase.waitingPermission":"等待授权…","status.phase.error":"运行失败","preview.title":"预览","preview.action.resize":"调整预览区宽度","preview.action.close":"关闭预览区","preview.action.retry":"重试","preview.tab.diff":"变更","preview.tab.files":"文件","preview.tab.logs":"日志","preview.diff.loadingTitle":"正在加载任务变更…","preview.diff.loadingHint":"正在读取持久化的 worktree 产物。","preview.diff.failedTitle":"任务变更加载失败","preview.diff.discardedTitle":"变更已丢弃","preview.diff.discardedHint":"隔离工作区已删除,源项目没有被修改。","preview.diff.emptyTitle":"暂无变更","preview.diff.emptyHint":"工具修改文件后,变更会显示在这里。","preview.diff.searchAria":"搜索变更文件","preview.diff.searchPlaceholder":"筛选变更文件…","preview.diff.changedFiles":"{count} 个变更文件","preview.diff.expandAll":"全部展开","preview.diff.collapseAll":"全部收起","preview.diff.showMoreFiles":"再显示 {count} 个文件","preview.diff.showMoreLines":"再显示 {count} 行","preview.diff.noMatches":"没有匹配的变更文件","preview.diff.patch":"补丁","preview.diff.line":"第 {line} 行","preview.files.loadingTitle":"正在加载文件…","preview.files.loadingHint":"正在获取工作区文件树。","preview.files.failedTitle":"文件加载失败","preview.files.emptyTitle":"暂无文件","preview.files.emptyHint":"选择项目后即可加载工作区文件树。","preview.files.treeFailed":"工作区文件树加载失败","preview.files.searchAria":"搜索工作区文件","preview.files.searchPlaceholder":"查找文件…","preview.files.searchResultsAria":"文件搜索结果","preview.files.searchFailed":"工作区文件搜索失败","preview.files.noMatches":"没有匹配的文件","preview.files.directoryLoading":"正在加载目录…","preview.files.directoryEmpty":"空目录","preview.files.selectTitle":"选择要预览的文件","preview.files.status.loading":"加载中…","preview.files.status.truncated":"已截断","preview.files.status.ready":"就绪","preview.files.truncatedNotice":"预览内容已截断至 20 万字符。","preview.files.pickHint":"从文件树中选择一个文件进行预览。","preview.files.contentFailed":"文件加载失败","preview.files.editorLoading":"正在加载编辑器…","preview.logs.searchAria":"搜索工具日志","preview.logs.searchPlaceholder":"搜索工具、摘要或输出…","preview.logs.filterAria":"按状态筛选日志","preview.logs.filter.all":"全部","preview.logs.filter.running":"进行中","preview.logs.filter.error":"失败","preview.logs.filter.success":"成功","preview.logs.noMatches":"没有匹配的日志","preview.logs.noMatchesHint":"尝试其他关键词或状态。","preview.logs.emptyTitle":"暂无日志","preview.logs.emptyHint":"工具运行记录会显示在这里。","preview.logs.expand":"展开","preview.logs.collapse":"收起","preview.logs.showMore":"再显示 {count} 条日志","preview.logs.status.running":"进行中","preview.logs.status.error":"失败","preview.logs.status.success":"成功","goal.aria.section":"目标控制条","goal.status.active":"目标进行中","goal.status.paused":"目标已暂停","goal.status.blocked":"目标已阻塞","goal.status.usageLimited":"用量受限","goal.status.budgetLimited":"预算已达上限","goal.status.complete":"目标已完成","goal.field.objective":"目标描述","goal.action.edit":"编辑目标","goal.action.pause":"暂停目标","goal.action.resume":"恢复目标","goal.action.delete":"删除目标","goal.action.expand":"展开目标详情","goal.action.collapse":"收起目标详情","goal.action.cancel":"取消","goal.action.save":"保存","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"续跑 {n} 次","goal.metrics.continuationMany":"续跑 {n} 次","goal.dialog.title":"删除此目标?","goal.dialog.description":"仅移除目标状态,会话历史与工作区文件不会受影响。","settings.title":"设置","settings.nav.aria":"设置分区","settings.action.back":"返回","settings.category.settings":"设置","settings.category.integrations":"集成","settings.tab.general":"通用","settings.tab.trust":"安全","settings.tab.models":"模型","settings.tab.shortcuts":"快捷键","settings.tab.mcp":"MCP","settings.tab.skills":"技能","settings.tab.plugins":"插件","settings.tab.hooks":"钩子","settings.tab.schedules":"定时任务","settings.common.retry":"重试","settings.common.dismiss":"忽略","settings.common.cancel":"取消","settings.common.enable":"启用","settings.general.loading":"正在加载设置…","settings.general.loadError":"加载设置失败","settings.general.saveError":"保存设置失败","settings.general.responseLanguage":"回复语言","settings.general.responseLanguageHint":"AI 将使用该语言回复","settings.general.autoSave":"自动保存会话","settings.general.communicationStyle":"沟通风格","settings.general.communicationStyleHint":"决定 Agent 在所有会话中的回复措辞","settings.appearance.heading":"外观","settings.appearance.theme":"主题偏好","settings.appearance.theme.dark":"深色","settings.appearance.theme.light":"浅色","settings.appearance.theme.system":"跟随系统","settings.appearance.compactSidebar":"紧凑侧边栏","settings.appearance.codeTheme":"代码主题","settings.appearance.codeThemeHint":"语法高亮配色","settings.notifications.heading":"通知","settings.notifications.buildFinished":"构建完成","settings.notifications.errorsOnly":"仅错误","settings.notifications.systemSounds":"系统提示音","settings.notifications.blocked":"浏览器通知已被拦截","settings.notifications.unavailable":"当前浏览器不支持通知","settings.notifications.enablePrompt":"在此标签页处于后台时接收提醒","settings.privacy.heading":"隐私","settings.privacy.telemetry":"遥测","settings.privacy.crash":"崩溃报告","settings.models.description":"为不同的服务商配置 API Key 与模型设置。","settings.models.loading":"正在加载模型…","settings.models.loadChannelsFailed":"加载服务商渠道失败","settings.models.saveFailed":"保存模型失败","settings.models.deleteFailed":"删除模型失败","settings.models.updateFailed":"更新模型失败","settings.models.updateChannelFailed":"更新服务商渠道失败","settings.models.probeFailed":"服务商渠道探测失败","settings.models.deleteChannelFailed":"删除服务商渠道失败","settings.models.empty":"尚未配置任何模型","settings.models.add":"+ 添加新模型","settings.models.missingCredential":"缺少凭据","settings.models.configured":"已配置","settings.models.deleting":"正在删除…","settings.models.deleteModel":"删除模型","settings.models.deleteChannel":"删除渠道","settings.models.deleteModelAria":"删除 {name}","settings.models.deleteModelPrompt":"删除 {name} 及其保存的配置?","settings.models.deleteChannelAria":"删除渠道 {name}","settings.models.deleteChannelPrompt":"删除渠道 {name}、其凭据以及 {count} 个已配置模型?相关的兜底引用也会一并移除。","settings.models.editModelAria":"编辑 {name}","settings.models.editChannelAria":"编辑渠道 {name}","settings.models.testChannelAria":"测试 {name}","settings.models.deleteChannelActionAria":"删除渠道 {name}","settings.models.modelCountOne":"{count} 个模型","settings.models.modelCountMany":"{count} 个模型","settings.models.defaultEndpoint":"默认端点","settings.shortcuts.searchPlaceholder":"搜索操作…","settings.shortcuts.scope.all":"全部范围","settings.shortcuts.scope.global":"全局","settings.shortcuts.scope.chat":"聊天","settings.shortcuts.scope.layout":"布局","settings.shortcuts.reset":"重置","settings.shortcuts.col.action":"操作","settings.shortcuts.col.shortcut":"快捷键","settings.shortcuts.col.scope":"范围","settings.shortcuts.empty":"未找到快捷键。","settings.shortcuts.action.searchTasks":"搜索任务","settings.shortcuts.action.openCommands":"打开命令中心","settings.shortcuts.action.newTask":"新建任务","settings.shortcuts.action.focusComposer":"聚焦输入框","settings.shortcuts.action.toggleSidebar":"切换侧边栏","settings.common.reload":"重新加载","settings.trust.state.notRequired":"无需信任","settings.trust.state.trusted":"工作区已信任","settings.trust.state.review":"需要审查","settings.trust.state.error":"信任存储错误","settings.trust.selectSession":"选择一个项目会话以查看文件夹信任。","settings.trust.heading":"工作区信任","settings.trust.inheritedFrom":" · 继承自 {source}","settings.trust.reloadAria":"重新加载工作区信任","settings.trust.revoke":"撤销","settings.trust.trustWorkspace":"信任工作区","settings.trust.restartNotice":"重启 Blade 以重新加载项目模型、MCP、LSP、权限和插件。","settings.trust.revokeAria":"撤销工作区信任","settings.trust.confirmTrust":"允许 {count} 个项目来源配置模型、MCP、LSP、权限、环境、指令、命令、技能、Agent 或插件?","settings.trust.confirmRevoke":"重启后阻止项目控制的可执行配置?","settings.trust.saving":"正在保存…","settings.trust.trustReviewed":"信任已审查的工作区","settings.trust.revokeTrust":"撤销信任","settings.trust.empty":"未找到项目控制的可执行配置。","settings.trust.loadFailed":"加载工作区信任失败","settings.trust.updateFailed":"更新工作区信任失败","settings.hooks.state.disabled":"钩子已禁用","settings.hooks.state.notRequired":"无外部钩子","settings.hooks.state.review":"需要审查","settings.hooks.state.trusted":"已信任","settings.hooks.state.modified":"批准后已变更","settings.hooks.state.error":"信任存储错误","settings.hooks.selectSession":"选择一个项目会话以查看其钩子。","settings.hooks.heading":"钩子信任","settings.hooks.reloadAria":"重新加载钩子信任","settings.hooks.revoke":"撤销","settings.hooks.trustDigest":"信任摘要","settings.hooks.currentSession":"当前会话执行","settings.hooks.session.open":"打开一个会话以控制其钩子。","settings.hooks.session.loading":"正在加载会话状态…","settings.hooks.session.disabled":"已被工作区配置禁用。","settings.hooks.session.paused":"仅在此会话中暂停。","settings.hooks.session.active":"通过信任检查后,钩子可在此会话运行。","settings.hooks.session.unavailable":"已被当前会话 runtime 或宿主策略禁用。","settings.hooks.session.enableAria":"为当前会话启用钩子","settings.hooks.session.pauseAria":"为当前会话暂停钩子","settings.hooks.session.unavailableAria":"当前会话无法使用钩子","settings.hooks.confirmTrustAria":"信任项目钩子","settings.hooks.confirmRevokeAria":"撤销项目钩子信任","settings.hooks.confirmTrust":"以你的用户权限运行这 {count} 个钩子,直到它们的配置发生变更?","settings.hooks.confirmRevoke":"停止此项目所有已配置的钩子,直到再次显式信任?","settings.hooks.saving":"正在保存…","settings.hooks.trustReviewed":"信任已审查的钩子","settings.hooks.revokeTrust":"撤销信任","settings.hooks.empty":"没有已配置的命令、HTTP 或提示词钩子。","settings.hooks.loadFailed":"加载钩子信任失败","settings.hooks.updateFailed":"更新钩子信任失败","settings.hooks.sessionUpdateFailed":"更新会话钩子失败","settings.plugins.selectProject":"选择一个项目以管理其插件。","settings.plugins.heading":"工作区插件","settings.plugins.changesNote":"更改将在后续会话快照生效并持久化到所选层级。","settings.plugins.reloadAria":"重新加载插件","settings.plugins.sourcePolicy":"来源策略","settings.plugins.savePolicyAria":"保存插件来源策略","settings.plugins.saving":"正在保存…","settings.plugins.saveForProject":"保存到项目","settings.plugins.restrictAria":"限制插件来源","settings.plugins.restrictAllowlists":"限制为允许列表","settings.plugins.requireShaAria":"要求完整 Git commit SHA","settings.plugins.requireSha":"要求完整 Git SHA","settings.plugins.environmentLocked":" · 环境已锁定","settings.plugins.gitHostsAria":"允许的插件 Git 主机","settings.plugins.marketplacesAria":"允许的插件市场","settings.plugins.localRootsAria":"允许的本地插件根目录","settings.plugins.emptyAllowlists":"空的允许列表将拒绝所有插件来源。","settings.plugins.installHeading":"安装可信插件","settings.plugins.sourceAria":"插件来源","settings.plugins.install":"安装","settings.plugins.trustSource":"我信任此来源可激活钩子、MCP 服务器、技能和命令。","settings.plugins.activationScope":"激活写入范围","settings.plugins.activationScopeHint":"更高优先级的层级仍将决定最终生效状态。","settings.plugins.scopeAria":"插件激活范围","settings.plugins.scope.local":"本地","settings.plugins.scope.project":"项目","settings.plugins.scope.global":"全局","settings.plugins.scope.localDesc":"仅当前检出","settings.plugins.scope.projectDesc":"共享的项目设置","settings.plugins.scope.globalDesc":"所有项目","settings.plugins.scope.invocation":"本次调用","settings.plugins.scope.default":"默认","settings.plugins.layer.on":"开","settings.plugins.layer.off":"关","settings.plugins.capability.commands":"{count} 个命令","settings.plugins.capability.skills":"{count} 个技能","settings.plugins.capability.agents":"{count} 个 Agent","settings.plugins.capability.hooks":"{count} 个钩子","settings.plugins.capability.mcp":"{count} 个 MCP","settings.plugins.noResources":"未声明任何资源","settings.plugins.effective":"生效范围:{scope}","settings.plugins.managed":"托管","settings.plugins.invocationScoped":"通过 --plugin-dir 限定为调用级","settings.plugins.enableAria":"启用 {name}","settings.plugins.disableAria":"停用 {name}","settings.plugins.unavailableAria":"{name} 不可用","settings.plugins.updateAria":"更新 {name}","settings.plugins.uninstallAria":"卸载 {name}","settings.plugins.confirmUpdate":"确认更新","settings.plugins.update":"更新","settings.plugins.confirmRemove":"确认移除","settings.plugins.empty":"未发现此项目的任何插件。","settings.plugins.marketplaces":"市场","settings.plugins.configuredCount":"{count} 个已配置","settings.plugins.marketplaceSourceAria":"市场来源","settings.plugins.addMarketplaceAria":"添加市场","settings.plugins.add":"添加","settings.plugins.noDescription":"无描述","settings.plugins.refreshMarketplaceAria":"刷新市场 {name}","settings.plugins.removeMarketplaceAria":"移除市场 {name}","settings.plugins.confirm":"确认","settings.plugins.installedSuffix":" · 已安装","settings.plugins.marketplaceEmpty":"添加市场以发现可安装的插件。","settings.plugins.loadFailed":"加载插件失败","settings.plugins.actionFailed":"插件操作失败","settings.plugins.updateFailed":"更新插件失败","settings.models.addModal.title":"添加模型","settings.models.addModal.close":"关闭添加模型","settings.models.addModal.loadProvidersError":"加载服务商失败","settings.models.addModal.loadModelsError":"加载模型失败","settings.models.addModal.provider":"服务商","settings.models.addModal.loadingProviders":"正在加载服务商…","settings.models.addModal.selectProvider":"选择服务商","settings.models.addModal.configuredSuffix":" - 已配置","settings.models.addModal.customOpenAI":"自定义 OpenAI 端点","settings.models.addModal.customAnthropic":"自定义 Anthropic 端点","settings.models.addModal.channelId":"渠道 ID","settings.models.addModal.channelIdHint":"稳定的配置与凭据标识符。","settings.models.addModal.channelName":"渠道名称","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"使用 Anthropic Messages 协议。","settings.models.addModal.openaiProtocol":"使用 OpenAI Chat Completions 协议。","settings.models.addModal.modelId":"模型 ID","settings.models.addModal.model":"模型","settings.models.addModal.loadingModels":"正在加载模型…","settings.models.addModal.selectModel":"选择模型","settings.models.addModal.reasoningSuffix":" - 推理","settings.models.addModal.visionSuffix":" - 视觉","settings.models.addModal.displayName":"显示名称","settings.models.addModal.displayNamePlaceholder":"可选别名","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API Key","settings.models.addModal.apiKeyPlaceholder":"单独存储在 auth.json 中","settings.models.addModal.showApiKey":"显示 API Key","settings.models.addModal.hideApiKey":"隐藏 API Key","settings.models.addModal.oauthNote":"该服务商需要 OAuth 或环境凭据,请在选择模型前在外部完成配置。","settings.models.addModal.saveModel":"保存模型","settings.models.addModal.saving":"正在保存…","settings.models.addModal.channelIdError":'渠道 ID 必须以小写字母开头,且只能包含小写字母、数字、"."、"_" 或 "-"。',"settings.models.addModal.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editModal.srTitle":"编辑模型","settings.models.editModal.title":"编辑模型覆盖项","settings.models.editModal.close":"关闭编辑模型","settings.models.editModal.displayName":"显示名称","settings.models.editModal.replaceApiKey":"替换服务商 API Key","settings.models.editModal.replaceApiKeyPlaceholder":"留空则保留当前凭据","settings.models.editModal.baseUrlOverride":"Base URL 覆盖","settings.models.editModal.baseUrlPlaceholder":"留空则使用默认端点","settings.models.editModal.streamIdleTimeout":"流空闲超时(ms)","settings.models.editModal.save":"保存","settings.models.editModal.saving":"正在保存…","settings.models.editModal.streamIdleTimeoutError":"流空闲超时必须至少为 1000ms。","settings.models.editModal.credentialError":"更新服务商凭据失败","settings.models.editProvider.title":"编辑服务商渠道","settings.models.editProvider.close":"关闭编辑服务商","settings.models.editProvider.channelName":"渠道名称","settings.models.editProvider.channelNameRequired":"渠道名称不能为空","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"服务商 Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editProvider.apiKeyEnv":"API Key 环境变量","settings.models.editProvider.apiKeyEnvPlaceholder":"可选,例如 TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"替换 API Key","settings.models.editProvider.apiKeyAria":"服务商 API Key","settings.models.editProvider.apiKeyPlaceholder":"留空则保留当前凭据","settings.models.editProvider.save":"保存渠道","settings.models.editProvider.saving":"正在保存…","settings.style.auto":"自动","settings.style.pragmatic":"务实","settings.style.friendly":"友好","settings.style.explanatory":"解释型","mcp.status.connected":"已连接","mcp.status.connecting":"连接中...","mcp.status.reconnecting":"恢复中...","mcp.status.offline":"离线","mcp.status.error":"错误","mcp.status.recoveringAttempt":"恢复中 {attempt}/{max}","mcp.oauth.status.disabled":"未配置","mcp.oauth.status.unavailable":"当前运行时不可用","mcp.oauth.status.unauthenticated":"需要授权","mcp.oauth.status.authorizing":"等待授权...","mcp.oauth.status.authenticated":"已授权","mcp.oauth.status.error":"授权失败","mcp.catalog.tag.official":"官方","mcp.catalog.tag.popular":"热门","mcp.catalog.tag.community":"社区","mcp.action.refreshServers":"刷新 MCP 服务器","mcp.action.addServer":"添加服务器","mcp.action.close":"关闭 MCP","mcp.action.dismiss":"忽略","mcp.action.retry":"重试","mcp.action.disconnect":"断开连接","mcp.action.disconnecting":"断开中...","mcp.action.stopRecovery":"停止恢复","mcp.action.connect":"连接","mcp.action.connecting":"连接中...","mcp.action.authorizeFirst":"请先授权","mcp.action.delete":"删除","mcp.action.cancel":"取消","mcp.action.deleting":"删除中...","mcp.action.deleteServer":"删除服务器","mcp.tab.installed":"已安装 ({count})","mcp.tab.catalog":"目录","mcp.servers.title":"服务器","mcp.servers.searchAria":"搜索已安装的 MCP 服务器","mcp.servers.searchPlaceholder":"搜索服务器...","mcp.servers.loading":"正在加载服务器...","mcp.servers.noMatch":"没有匹配的服务器","mcp.servers.none":"尚未配置 MCP 服务器","mcp.server.errorLabel":"错误:{error}","mcp.server.deleteAria":"删除 {name}","mcp.server.selectPrompt":"选择一个服务器以查看详情","mcp.instructions.title":"服务器说明","mcp.instructions.detailsOmittedByPolicy":"[详情已根据运行时策略省略]","mcp.instructions.detailsOmitted":"详情已省略","mcp.instructions.truncated":"已截断至安全显示上限","mcp.tasks.title":"实验性 MCP 任务","mcp.tasks.summary":"每会话 {count} 个 · {interval}ms 轮询","mcp.tasks.disabledByDefault":"默认禁用","mcp.tasks.enabled":"已启用","mcp.tasks.disabled":"已禁用","mcp.oauth.signingOut":"登出中...","mcp.oauth.signOut":"登出","mcp.oauth.continueAuthorization":"继续授权","mcp.oauth.resumeAuthorization":"恢复授权","mcp.oauth.opening":"打开中...","mcp.oauth.authorize":"授权","mcp.delete.confirm":"移除此服务器及其已保存的配置?","mcp.tools.title":"工具 ({count})","mcp.tools.none":"暂无可用工具","mcp.completion.title":"参数补全","mcp.completion.connectPrompt":"连接服务器后即可请求补全建议","mcp.completion.unsupported":"该服务器未声明支持 MCP 补全","mcp.completion.noTargets":"没有可补全的提示词参数或模板变量","mcp.completion.targetAria":"MCP 补全目标","mcp.completion.partialAria":"MCP 补全的部分值","mcp.completion.partialPlaceholder":"部分值","mcp.completion.completing":"补全中...","mcp.completion.complete":"补全","mcp.completion.suggestionsAria":"MCP 补全建议","mcp.completion.empty":"[空]","mcp.completion.noSuggestions":"暂无建议","mcp.meta.truncatedSuffix":" · 已截断","mcp.meta.detailsOmittedSuffix":" · 详情已省略","mcp.diagnostics.title":"诊断","mcp.diagnostics.refreshAria":"刷新 {name} 的 MCP 日志","mcp.diagnostics.logsAria":"{name} 的 MCP 日志","mcp.log.levelAria":"MCP 日志级别","mcp.log.setting":"设置中...","mcp.log.loading":"正在加载日志...","mcp.log.none":"未捕获到日志","mcp.catalog.searchAria":"搜索 MCP 服务器目录","mcp.catalog.searchPlaceholder":"在 npm 上搜索 MCP 服务器(至少 3 个字符)...","mcp.catalog.retry":"重试加载目录","mcp.catalog.noDescription":"暂无描述","mcp.catalog.byAuthor":"作者 {author}","mcp.catalog.installed":"已安装","mcp.catalog.installing":"安装中...","mcp.catalog.install":"安装","mcp.catalog.noPackages":"未找到任何包","mcp.catalog.noMore":"没有更多包了","mcp.catalog.packagesFound":"找到 {count} 个包","mcp.catalog.browseGlama":"在 Glama 上浏览更多","mcp.error.connectFailed":"连接服务器失败","mcp.error.disconnectFailed":"断开服务器失败","mcp.error.deleteFailed":"删除服务器失败","mcp.error.loginFailed":"MCP OAuth 登录失败","mcp.error.logoutFailed":"MCP OAuth 登出失败","mcp.error.loggingLevelFailed":"设置 MCP 日志级别失败","mcp.error.completionFailed":"MCP 补全失败","mcp.add.title":"添加 MCP 服务器","mcp.add.closeAria":"关闭添加 MCP 服务器","mcp.add.modeForm":"表单","mcp.add.jsonConfig":"JSON 配置","mcp.add.jsonConfigAria":"JSON 配置","mcp.add.serverName":"服务器名称","mcp.add.command":"命令","mcp.add.commandAria":"服务器命令","mcp.add.argsLabel":"参数(空格分隔)","mcp.add.argsAria":"服务器参数","mcp.add.invalidJson":"请输入包含服务器名称和传输方式的有效 JSON。","mcp.add.nameCommandRequired":"名称和命令为必填项。","mcp.add.adding":"添加中...","mcp.add.submit":"添加服务器","mcp.install.title":"安装 MCP 服务器","mcp.install.titleWithName":"安装 {name}","mcp.install.closeAria":"关闭 MCP 安装","mcp.install.args":"参数","mcp.install.commandPreview":"命令:npx {args}","mcp.install.nameRequired":"服务器名称为必填项。","skills.title":"技能","skills.action.install":"安装技能","skills.action.installShort":"安装","skills.action.refreshAria":"刷新技能","skills.action.closeAria":"关闭技能","skills.action.dismiss":"忽略","skills.action.retry":"重试","skills.action.cancel":"取消","skills.action.close":"关闭","skills.action.hide":"隐藏","skills.action.enable":"启用","skills.action.disable":"禁用","skills.action.saving":"保存中…","skills.status.enabled":"已启用","skills.status.disabled":"已禁用","skills.status.installed":"已安装","skills.noDescriptionShort":"暂无描述","skills.noDescription":"暂无可用描述","skills.installed.title":"已安装","skills.installed.searchAria":"搜索已安装的技能","skills.installed.searchPlaceholder":"搜索技能…","skills.installed.loading":"正在加载技能…","skills.installed.noMatch":"没有匹配的技能","skills.installed.empty":"尚未安装任何技能","skills.uninstall.managedHint":"仅可卸载 Blade 用户技能","skills.uninstall.managed":"受管理","skills.uninstall.action":"卸载","skills.uninstall.confirmAria":"卸载 {name}","skills.uninstall.confirmPrompt":"从 ~/.blade/skills 中移除此技能?","skills.uninstall.inProgress":"正在卸载…","skills.uninstall.confirm":"卸载技能","skills.details.title":"详情","skills.details.provider":"提供方","skills.details.location":"位置","skills.details.capabilities":"能力","skills.details.allowedTools":"允许的工具({count})","skills.detail.emptyState":"选择一个技能以查看详情","skills.install.title":"安装技能","skills.install.closeAria":"关闭技能安装","skills.install.tab.catalog":"目录","skills.install.tab.repo":"仓库","skills.install.tab.local":"本地","skills.install.catalog.searchAria":"搜索技能目录","skills.install.catalog.searchPlaceholder":"搜索目录…","skills.install.catalog.loading":"正在加载目录…","skills.install.catalog.empty":"未找到技能","skills.install.catalog.byAuthor":"作者:{author}","skills.install.catalog.tag.official":"官方","skills.install.catalog.tag.popular":"热门","skills.install.catalog.tag.community":"社区","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"技能仓库地址","skills.install.repo.credentialsHint":"使用 Blade 进程可用的 Git 凭据","skills.install.local.label":"本地路径","skills.install.local.inputAria":"本地技能路径","skills.status.dialogTitle":"安装状态","skills.status.confirm.title":"确认安装","skills.status.confirm.prompt":"安装所选技能?","skills.status.installing.title":"正在安装","skills.status.installing.description":"正在下载并校验…","skills.status.failed.title":"安装失败","skills.status.failed.fallback":"安装失败。","skills.status.failed.hint":"请检查访问权限后重试。","skills.error.deleteFailed":"删除技能失败","skills.error.toggleFailed":"切换技能状态失败","skills.error.installFailed":"安装技能失败","schedule.title":"定时任务","schedule.description":"按 cron、间隔或一次性触发器自动运行无界面任务提示词。","schedule.new":"新建定时任务","schedule.newAria":"创建新的定时任务","schedule.refresh":"刷新","schedule.reloadAria":"重新加载定时任务","schedule.create":"创建","schedule.save":"保存","schedule.cancel":"取消","schedule.confirmDelete":"确认?","schedule.empty":"暂无定时任务","schedule.enabled":"已启用","schedule.disabled":"已禁用","schedule.never":"从未","schedule.nextRun":"下次运行","schedule.lastRun":"上次运行","schedule.runCount":"已运行 {count} 次","schedule.trigger.kindAria":"触发器类型","schedule.trigger.cron":"Cron","schedule.trigger.interval":"间隔","schedule.trigger.once":"一次性","schedule.field.title":"标题(可选)","schedule.field.cron":"Cron 表达式","schedule.field.interval":"间隔","schedule.field.runAt":"运行时间","schedule.field.prompt":"提示词","schedule.field.project":"项目路径","schedule.field.model":"模型(可选)","schedule.field.permissionMode":"权限模式","schedule.field.isolation":"隔离方式","schedule.placeholder.title":"每晚依赖审查","schedule.placeholder.cron":"0 9 * * 1 (分 时 日 月 周)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"描述要运行的任务…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"例如 anthropic/claude-sonnet","schedule.model.current":"使用当前模型","schedule.permission.default":"默认","schedule.permission.autoEdit":"自动编辑","schedule.permission.yolo":"Yolo","schedule.permission.plan":"规划","schedule.isolation.local":"本地","schedule.isolation.worktree":"工作树","schedule.cadence.cron":"cron:{expr}","schedule.cadence.interval":"每 {interval}","schedule.cadence.once":"于 {time} 运行一次","schedule.status.queued":"排队中","schedule.status.running":"运行中","schedule.status.completed":"已完成","schedule.status.failed":"失败","schedule.status.cancelled":"已取消","schedule.status.interrupted":"已中断","schedule.status.error":"出错","schedule.status.never":"尚未运行","schedule.runNowAria":"立即运行“{title}”","schedule.editAria":"编辑“{title}”","schedule.deleteAria":"删除“{title}”","schedule.enableAria":"启用“{title}”","schedule.disableAria":"禁用“{title}”","schedule.error.promptRequired":"提示词不能为空。","schedule.error.projectRequired":"项目路径不能为空。","schedule.error.cronRequired":"Cron 表达式不能为空。","schedule.error.invalidInterval":"请输入类似 30m、2h 或 1d 的间隔。","schedule.error.runAtRequired":"请选择有效的运行时间。","schedule.error.loadFailed":"加载定时任务失败。","schedule.error.createFailed":"创建定时任务失败。","schedule.error.updateFailed":"更新定时任务失败。","schedule.error.deleteFailed":"删除定时任务失败。","schedule.error.toggleFailed":"切换定时任务状态失败。","schedule.error.runFailed":"运行定时任务失败。"},h0=["en","zh"],Ya={en:p0,zh:g0},Yf="blade-ui-locale",il=typeof window<"u"&&typeof document<"u";function b0(){var e,t;if(il){try{const r=(e=window.localStorage)==null?void 0:e.getItem(Yf);if(r==="en"||r==="zh")return r}catch{}return(typeof navigator<"u"&&(navigator.language||((t=navigator.languages)==null?void 0:t[0]))||"").toLowerCase().startsWith("zh")?"zh":"en"}return"en"}let Es=b0();const gc=new Set;function k0(){for(const e of gc)e()}function x0(e){var t;if(e!==Es){if(Es=e,il){try{(t=window.localStorage)==null||t.setItem(Yf,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}k0()}}function Xf(e){return gc.add(e),()=>gc.delete(e)}function y0(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s==null?n:String(s)}):e}function He(e,t){const r=(Ya[Es]??Ya.en)[e]??Ya.en[e];return y0(r,t)}function Ft(){return w.useSyncExternalStore(Xf,()=>Es,()=>"en"),He}function S0(){return{locale:w.useSyncExternalStore(Xf,()=>Es,()=>"en"),setLocale:x0}}il&&(document!=null&&document.documentElement)&&(document.documentElement.lang=Es==="zh"?"zh-CN":"en");function gt(e,t){return{...e,...t}}function Br(e,t,n){return e>=t&&e<=n}function w0(e){return e===8205}function v0(e){return Br(e,55296,56319)}function Nu(e){return Br(e,127462,127487)}function Zf(e){return Br(e,65024,65039)}function em(e){return Br(e,768,879)||Br(e,6832,6911)||Br(e,7616,7679)||Br(e,65056,65071)}function Ci(e){return e>65535?2:1}function Ou(e,t){for(;t<e.length;){const n=e.codePointAt(t);if(em(n)||Zf(n))t+=Ci(n);else break}return t}function al(e,t){const n=e.codePointAt(t);let r=t+Ci(n);for(r=Ou(e,r);r<e.length-1&&e[r]==="";){const s=e.codePointAt(r+1);r+=1+Ci(s),r=Ou(e,r)}return Nu(n)&&r<e.length&&Nu(e.codePointAt(r))&&(r+=Ci(e.codePointAt(r))),r}function tm(e){return v0(e)||em(e)||Zf(e)||w0(e)}function I0(e){let t=0,n=0;for(;n<e.length;)n=al(e,n),t++;return t}function C0(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=al(e,r),n++,n>=t)return!0;return!1}function j0(e,t){let n=0,r=0;for(;r<e.length;)if(r=al(e,r),n++,n>t)return!1;return!0}function T0(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(tm(e.charCodeAt(n)))return C0(e,t);if(n++,n>=t)return!0}return!1}function A0(e,t){let n=0;for(;n<e.length;){if(tm(e.charCodeAt(n)))return j0(e,t);if(n++,n>t)return!1}return!0}function H(e){return Array.isArray(e)}function tt(e){return h(typeof e,"bigint")}function ht(e){return h(typeof e,"boolean")}function ea(e){if($e(e)||!In(e))return!1;const t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function In(e){return h(typeof e,"function")}function cl(e){return Number.isInteger(e)}function Vt(e){return h(e,null)}function ye(e){return Number.isFinite(e)}function fn(e){return ne(e)&&!H(e)}function ne(e){return h(typeof e,"object")&&!Vt(e)}function ie(e){return h(typeof e,"string")}function ll(e){return h(typeof e,"symbol")}function $e(e){return h(e,void 0)}function h(e,t){return e===t}function Yr(e,t){return e>t}function Co(e,t){return e<t}function rr(e,t){return e<=t}function Ns(e,t){return e>=t}function nm(e,t){if(tt(e)||tt(t))return BigInt(e)%BigInt(t)===0n;const n=1e-10;if(!ye(e)||cl(e)&&1/t%1===0)return!0;const r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function rm(e){if(!ne(e))return!1;const t=globalThis.Object.getPrototypeOf(e);return Vt(t)?!1:h(typeof t.constructor,"function")&&!(h(t.constructor,globalThis.Object)||h(t.constructor.name,"Object"))}function Os(e){return tt(e)||ht(e)||Vt(e)||ye(e)||ie(e)||$e(e)}function E0(e){return I0(e)}function sm(e,t){return A0(e,t)}function om(e,t){return T0(e,t)}function dt(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function jt(e,t,n){let r=!0;for(let s=t;s<e.length;s++)n(e[s],s)||(r=!1);return r}function $s(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function im(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function dl(e,t){return e.reduce((n,r,s)=>t(r,s)?++n:n,0)}function Ie(e,t,n){return h(e.length,0)?n():t(e[0],e.slice(1))}function Jn(e){return h(e,"__proto__")||h(e,"constructor")||h(e,"prototype")}function E(e,t){return Jn(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ul(e){return D(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function nt(e){return Object.entries(e)}function D(e){return Object.getOwnPropertyNames(e)}function fl(e){return Object.getOwnPropertySymbols(e)}function ml(e){return Object.values(e)}function P0(e,t){if(!ne(t))return!1;const n=D(e);return h(n.length,D(t).length)&&n.every(r=>Xr(e[r],t[r]))}function N0(e,t){return H(t)&&h(e.length,t.length)&&e.every((n,r)=>Xr(e[r],t[r]))}function Xr(e,t){return H(e)?N0(e,t):ne(e)?P0(e,t):h(e,t)}const $i=Object.freeze(Object.defineProperty({__proto__:null,Counted:dl,Entries:nt,EntriesRegExp:ul,Every:dt,EveryAll:jt,GraphemeCount:E0,HasPropertyKey:E,IsArray:H,IsBigInt:tt,IsBoolean:ht,IsClassInstance:rm,IsConstructor:ea,IsDeepEqual:Xr,IsEqual:h,IsFunction:In,IsGreaterEqualThan:Ns,IsGreaterThan:Yr,IsInteger:cl,IsLessEqualThan:rr,IsLessThan:Co,IsMaxLength:sm,IsMinLength:om,IsMultipleOf:nm,IsNull:Vt,IsNumber:ye,IsObject:ne,IsObjectNotArray:fn,IsString:ie,IsSymbol:ll,IsUndefined:$e,IsUnsafePropertyKey:Jn,IsValueLike:Os,Keys:D,ShiftLeft:Ie,Some:$s,SomeAll:im,Symbols:fl,Values:ml},Symbol.toStringTag,{value:"Module"})),O0=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function $0(e){return O0.test(e)}function wt(e,t){return`(${e} && ${t})`}function qe(e,t){return`(${e} || ${t})`}function Nt(e){return`!(${e})`}function Ri(e){return`Array.isArray(${e})`}function am(e){return`typeof ${e} === "bigint"`}function R0(e){return`typeof ${e} === "boolean"`}function M0(e){return`Number.isInteger(${e})`}function F0(e){return`${e} === null`}function cm(e){return`Number.isFinite(${e})`}function lm(e){return wt(dm(e),Nt(Ri(e)))}function dm(e){return`typeof ${e} === "object" && ${e} !== null`}function um(e){return`typeof ${e} === "string"`}function D0(e){return`typeof ${e} === "symbol"`}function hc(e){return`${e} === undefined`}function _0(e){return`typeof ${e} === "function"`}function L0(e){return`Guard.IsConstructor(${e})`}function Gt(e,t){return`${e} === ${t}`}function fm(e,t){return`${e} > ${t}`}function pl(e,t){return`${e} < ${t}`}function Zr(e,t){return`${e} <= ${t}`}function jo(e,t){return`${e} >= ${t}`}function U0(e,t){return`Guard.IsMinLength(${e}, ${t})`}function B0(e,t){return`Guard.IsMaxLength(${e}, ${t})`}function Dn(e,t,n,r){return h(t,"0")?`${e}.every((${n[0]}, ${n[1]}) => ${r})`:`((value, callback) => { for(let index = ${t}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${e}, (${n[0]}, ${n[1]}) => ${r})`}function H0(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function q0(e,t,n){return`((value, callback) => { let result = false; for(let index = 0; index < value.length; index++) if (callback(value[index], index)) result = true; return result })(${e}, (${t[0]}, ${t[1]}) => ${n})`}function ta(e,t,n){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${n}) ? ++result : result, 0)`}function mm(e){return`Object.entries(${e})`}function es(e){return`Object.getOwnPropertyNames(${e})`}function Kr(e,t){return h(t,'"__proto__"')||h(t,'"constructor"')?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function pm(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function z0(e){return`[${e.join(", ")}]`}function xr(e,t){return`((${e.join(", ")}) => ${t})`}function Ke(e,t){return`${e}(${t.join(", ")})`}function gl(e,t){return`new ${e}(${t.join(", ")})`}function de(e,t){return`${e}${$0(t)?`.${t}`:`[${z(t)}]`}`}function z(e){if(!Os(e))throw Error("Unsupported Constant");return ie(e)?JSON.stringify(e):`${e}`}function K0(e,t,n){return`(${e} ? ${t} : ${n})`}function na(e){return`{ ${e.join("; ")}; }`}function Qn(e,t){return`const ${e} = ${t}`}function gm(e,t){return`if(${e}) { ${t} }`}function ra(e){return`return ${e}`}function It(e){return h(e.length,0)?"true":e.reduce((t,n)=>wt(t,n))}function hl(e){return h(e.length,0)?"false":e.reduce((t,n)=>qe(t,n))}function G0(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function V0(e){return e instanceof Boolean}function W0(e){return e instanceof Number}function J0(e){return e instanceof String}function To(e){return globalThis.ArrayBuffer.isView(e)}function hm(e){return e instanceof globalThis.RegExp}function bm(e){return e instanceof globalThis.Date}function km(e){return e instanceof globalThis.Set}function xm(e){return e instanceof globalThis.Map}function Q0(e){return E(e,"~kind")||E(e,"~unsafe")}function Y0(e){const t={},n=Object.getOwnPropertyDescriptors(e);for(const r of Object.keys(n)){if(Jn(r))continue;const s=n[r];E(s,"value")&&Object.defineProperty(t,r,{...s,value:Gr(s.value)})}return t}function X0(e){const t={};for(const n of D(e))Jn(n)||(t[n]=Gr(e[n]));for(const n of fl(e))t[n]=Gr(e[n]);return t}function Z0(e){return rm(e)?e:Q0(e)?Y0(e):X0(e)}function ew(e){return e.map(t=>Gr(t))}function tw(e){return e.slice()}function nw(e){return new RegExp(e.source,e.flags)}function rw(e){return new Map(Gr([...e.entries()]))}function sw(e){return new Set(Gr([...e.values()]))}function Gr(e){return To(e)?tw(e):hm(e)?nw(e):xm(e)?rw(e):km(e)?sw(e):H(e)?ew(e):ne(e)?Z0(e):e}function bl(e){return Gr(e)}const ow={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ao(){return ow}function iw(e,t){for(const n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function aw(e,t){return{...e,...t}}function he(e,t,n={}){const r=aw(t,n);return iw(r,e)}function Pn(e,t){const n={},r=Object.getOwnPropertyDescriptors(bl(e)),s=new Set(t);for(const o of Object.keys(r))s.has(o)||Object.defineProperty(n,o,r[o]);return n}function ue(e,t,n){const r=Ao(),s=bl(e);for(const o of Object.keys(t))Object.defineProperty(s,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(const o of Object.keys(n))Object.defineProperty(s,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return s}function we(e,t){return ne(e)&&E(e,"~kind")&&h(e["~kind"],t)}function Yt(e){return ne(e)}function je(e,t,n){return he({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function Ts(e){return we(e,"Deferred")}function cw(e){return ue(e,{"~readonly":!0},{})}function kl(e,t){return ue(cw(e),{},t)}function lw(e,t,n,r){const s=G(e,t,n);return kl(s,r)}function dw(e){return ue(e,{"~optional":!0},{})}function xl(e,t){return ue(dw(e),{},t)}function uw(e,t,n,r){const s=G(e,t,n);return xl(s,r)}function Cr(e,t){return he({"~kind":"Array"},{type:"array",items:e},t)}function ut(e){return we(e,"Array")}function yl(e){return Pn(e,["~kind","type","items"])}function Eo(e,t,n={}){return he({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function mn(e){return we(e,"Constructor")}function fw(e){return Pn(e,["~kind","type","parameters","instanceType"])}function Po(e,t,n={}){return he({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function pn(e){return we(e,"Function")}function mw(e){return Pn(e,["~kind","type","parameters","returnType"])}function dn(e,t){return he({"~kind":"Ref"},{$ref:e},t)}function kt(e){return we(e,"Ref")}function No(e,t){return he({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Sl(e){return we(e,"Generic")}function wl(e){return he({"~kind":"Any"},{},e)}function Nn(e){return we(e,"Any")}const pw="(?!)";function Tt(e){return he({"~kind":"Never"},{not:{}},e)}function Rs(e){return we(e,"Never")}function er(e,t={}){return je("AddOptional",[e],t)}function Mi(e,t={}){return xl(e,t)}function gw(e){return Mi(e)}function Xt(e){return Yt(e)&&E(e,"~optional")}function hw(e){return D(e).filter(t=>!Xt(e[t]))}function ym(e){return D(e)}function Sm(e){return ml(e)}function Ae(e,t={}){const n=hw(e),r=n.length>0?{required:n}:{};return he({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Le(e){return we(e,"Object")}function bw(e){return Pn(e,["~kind","type","properties","required"])}function Bt(e){return he({"~kind":"Unknown"},{},e)}function Cn(e){return we(e,"Unknown")}function Oo(e,t,n){const r=D(e).reduce((s,o)=>({...s,[o]:ue(e[o],{},{$id:o})}),{});return he({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function Ht(e){return we(e,"Cyclic")}function kw(e){return ue(e,{"~unsafe":null},{})}function wm(e){return fn(e)&&E(e,"~unsafe")&&Vt(e["~unsafe"])}function ct(e,t){var n;return((n=t[e.length])==null?void 0:n.call(t,...e))??(()=>{throw Error("Invalid Arguments")})()}function bc(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s,s],1:r=>[r,Bt(),Bt()]});return he({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Zt(e){return we(e,"Infer")}function Fi(e,t,n,r={}){return he({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function gn(e){return we(e,"Dependent")}function xw(e){return Pn(e,["~kind","if","then","else"])}function yw(e){return fn(e)}function Sw(e){return D(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function ww(e){return ie(e)||ye(e)}function vw(e,t){const n=yw(e)?Sw(e):e;return he({"~kind":"Enum"},{enum:n},t)}function hn(e){return we(e,"Enum")}function Fn(e,t={}){return he({"~kind":"Intersect"},{allOf:e},t)}function Ue(e){return we(e,"Intersect")}function Iw(e){return Pn(e,["~kind","allOf"])}let Xa;function Cw(){try{return Im("null")(),!0}catch{return!1}}function vm(){return $e(Xa)&&(Xa=Cw()),Xa&&Ao().useAcceleration}function Im(...e){return new globalThis.Function(...e)}function Ot(){throw new Error("Unreachable")}function jw(e){const t=new Set;let n=e;for(;n&&n!==Object.prototype;){for(const r of Reflect.ownKeys(n))r!=="constructor"&&typeof r!="symbol"&&t.add(r);n=Object.getPrototypeOf(n)}return[...t]}function Tw(e){return typeof e=="number"}var $t;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})($t||($t={}));let Is=BigInt("14695981039346656037");const[Aw,Ew]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Pw=Array.from({length:256}).map((e,t)=>BigInt(t)),Cm=new Float64Array(1),jm=new DataView(Cm.buffer),Tm=new Uint8Array(Cm.buffer);function xt(e){Is=Is^Pw[e],Is=Is*Aw%Ew}function Nw(e){xt($t.Array);for(const t of e)yr(t)}function Ow(e){xt($t.BigInt),jm.setBigInt64(0,e);for(const t of Tm)xt(t)}function $u(e){xt($t.Boolean),xt(e?1:0)}function $w(e){xt($t.Constructor),yr(e.toString())}function Rw(e){xt($t.Date),yr(e.getTime())}function Mw(e){xt($t.Function),yr(e.toString())}function Fw(e){xt($t.Null)}function Ru(e){xt($t.Number),jm.setFloat64(0,e,!0);for(const t of Tm)xt(t)}function Dw(e){xt($t.Object);for(const t of jw(e).sort())yr(t),yr(e[t])}function _w(e){xt($t.RegExp),kc(e.toString())}const Lw=new TextEncoder;function kc(e){xt($t.String);for(const t of Lw.encode(e))xt(t)}function Uw(e){xt($t.Symbol),yr(e.toString())}function Bw(e){xt($t.TypeArray);const t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)xt(t[n])}function Hw(e){return xt($t.Undefined)}function yr(e){return To(e)?Bw(e):bm(e)?Rw(e):hm(e)?_w(e):V0(e)?$u(e.valueOf()):J0(e)?kc(e.valueOf()):W0(e)?Ru(e.valueOf()):Tw(e)?Ru(e):H(e)?Nw(e):ht(e)?$u(e):tt(e)?Ow(e):ea(e)?$w(e):Vt(e)?Fw():ne(e)?Dw(e):ie(e)?kc(e):ll(e)?Uw(e):$e(e)?Hw():In(e)?Mw(e):Ot()}function Am(e){return Is=BigInt("14695981039346656037"),yr(e),Is}function sa(e){return Am(e).toString(16).padStart(16,"0")}const qw=Object.freeze(Object.defineProperty({__proto__:null,Hash:sa,HashCode:Am},Symbol.toStringTag,{value:"Module"}));function zw(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}let Kw=zw;function Gw(){return Kw}class Em{constructor(t,n){this.type=t,this.decode=n}Encode(t){const n=this.type,r=en(n)?i=>this.decode(n["~codec"].decode(i)):this.decode,s=en(n)?i=>n["~codec"].encode(t(i)):t,o={decode:r,encode:s};return ue(this.type,{"~codec":o},{})}}class Pm{constructor(t){this.type=t}Decode(t){return new Em(this.type,t)}}function vl(e){return new Pm(e)}function Vw(e,t){return vl(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Ww(e,t){return vl(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function en(e){return Yt(e)&&E(e,"~codec")&&ne(e["~codec"])&&E(e["~codec"],"encode")&&E(e["~codec"],"decode")}function Jw(e){return ud(e)}function Di(e){return Yt(e)&&E(e,"~immutable")}function tr(e,t={}){return je("AddReadonly",[e],t)}function _i(e,t={}){return kl(e,t)}function Qw(e){return _i(e)}function Li(e){return Yt(e)&&E(e,"~readonly")}function Yw(e,t){const n=Il(e)?[...e["~refine"],t]:[t];return ue(e,{"~refine":n},{})}function Xw(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,()=>"Refine Error"]});return Yw(t,{check:n,error:r})}function Zw(e){return fn(e)&&E(e,"check")&&E(e,"error")&&In(e.check)&&In(e.error)}function Il(e){return Yt(e)&&E(e,"~refine")&&H(e["~refine"])&&dt(e["~refine"],0,t=>Zw(t))}const ev="-?(?:0|[1-9][0-9]*)n";function Cl(e){return he({"~kind":"BigInt"},{type:"bigint"},e)}function ts(e){return we(e,"BigInt")}function Nm(e){return he({"~kind":"Boolean"},{type:"boolean"},e)}function jr(e){return we(e,"Boolean")}function xc(e){return he({"~kind":"Identifier"},{name:e})}function tv(e){return we(e,"Identifier")}const Om="-?(?:0|[1-9][0-9]*)";function oa(e){return he({"~kind":"Integer"},{type:"integer"},e)}function _n(e){return we(e,"Integer")}class nv extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function rv(e){return tt(e)?"bigint":ht(e)?"boolean":ye(e)?"number":ie(e)?"string":(()=>{throw new nv(e)})()}function Me(e,t){return he({"~kind":"Literal"},{type:rv(e),const:e},t)}function $m(e){return tt(e)||ht(e)||ye(e)||ie(e)}function sv(e){return We(e)&&tt(e.const)}function ov(e){return We(e)&&ht(e.const)}function Rm(e){return We(e)&&ye(e.const)}function Mm(e){return We(e)&&ie(e.const)}function We(e){return we(e,"Literal")}function jl(e){return he({"~kind":"Null"},{type:"null"},e)}function $o(e){return we(e,"Null")}const Fm="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Sr(e){return he({"~kind":"Number"},{type:"number"},e)}function nn(e){return we(e,"Number")}function Tl(e){return he({"~kind":"Symbol"},{type:"symbol"},e)}function Ro(e){return we(e,"Symbol")}function Mo(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,o],1:s=>[s,Bt(),Bt()]});return he({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function iv(e){return we(e,"Parameter")}const Dm=".*";function Ln(e){return he({"~kind":"String"},{type:"string"},e)}function On(e){return we(e,"String")}function Ve(e,t={}){return he({"~kind":"Union"},{anyOf:e},t)}function ae(e){return we(e,"Union")}function av(e){return Pn(e,["~kind","anyOf"])}function _m(e){const t=zT(e);return h(t.length,2)?t[0]:[]}function cv(e){return!0}function Lm(e){return Ie(e,(t,n)=>lv(t)?Lm(n):!1,()=>!0)}function Um(e){return h(e.length,0)?!1:Lm(e)}function lv(e){return ae(e)?Um(e.anyOf):We(e)?cv(e.const):!1}function Bm(e){return Um(e)}function Hm(e){return he({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function qm(e,t,n=[]){return Ie(e,(r,s)=>qm(s,t,[...n,`${r}${t}`]),()=>n)}function dv(e,t){return h(e.length,0)?[`${t}`]:qm(e,t)}function zm(e,t,n=[]){return Ie(t,(r,s)=>zm(e,s,[...n,...Km(e,r)]),()=>n)}function Km(e,t){return ae(t)?zm(e,t.anyOf):We(t)?dv(e,t.const):Ot()}function Gm(e,t){return Ie(t,(n,r)=>Gm(Km(e,n),r),()=>e)}function uv(e){return e.map(t=>Me(t))}function fv(e){const t=Gm([],e),n=uv(t);return Ve(n)}function mv(e){return h(e.length,0)?Ot():h(e.length,1)&&We(e[0])?e[0]:fv(e)}function Vm(e){const t=_m(e);return h(t.length,0)?Ln():Bm(t)?mv(t):Hm(e)}function Al(e){const t=Vm(e);return zt(t)?Ln():t}function wr(e,t){const n="object",r={[e]:t};return he({"~kind":"Record"},{type:n,patternProperties:r})}function pv(e){return wr(Wr,e)}function gv(e){return Ae({true:e,false:e})}function bn(e,t={}){const[n,r,s]=[e,e.length,!1];return he({"~kind":"Tuple"},{type:"array",additionalItems:s,items:n,minItems:r},t)}function st(e){return we(e,"Tuple")}function hv(e){return Pn(e,["~kind","type","items","minItems","additionalItems"])}function bv(e){return Pn(e,["~readonly"])}function Wm(e,t){return ue(bv(e),{},t)}function kv(e,t,n,r){const s=G(e,t,n);return Wm(s,r)}function xv(e,t={}){return je("RemoveReadonly",[e],t)}function yv(e,t={}){return Wm(e,t)}function Sv(e){return Pn(e,["~optional"])}function Jm(e,t){return ue(Sv(e),{},t)}function wv(e,t,n,r){const s=G(e,t,n);return Jm(s,r)}function vv(e,t={}){return je("RemoveOptional",[e],t)}function Qm(e,t={}){return Jm(e,t)}function Ym(e){return e.reduceRight((n,r,s)=>({[s]:r,...n}),{})}function Iv(e){const t=Ym(e.items);return Ae(t)}function Cv(e,t){return Li(e)?!!Li(t):!1}function jv(e,t){return Xt(e)?!!Xt(t):!1}function Tv(e,t){const n=Cv(e,t),r=jv(e,t),s=rn([e,t]),o=yv(Qm(s));return n&&r?_i(Mi(o)):n&&!r?_i(o):!n&&r?Mi(o):o}function Av(e,t,n){return n in e?n in t?Tv(e[n],t[n]):e[n]:n in t?t[n]:Tt()}function Ev(e,t){return[...new Set([...D(t),...D(e)])].reduce((r,s)=>({...r,[s]:Av(e,t,s)}),{})}function Mu(e){return Le(e)?e.properties:st(e)?Ym(e.items):Ot()}function Pv(e,t){const n=Mu(e),r=Mu(t),s=Ev(n,r);return Ae(s)}function Nv(e,t){const n=ga(e,t);return h(n,Xl)?e:h(n,Zl)||h(n,Yl)?t:Tt()}function Fu(e){return Le(e)||st(e)}function Ov(e,t){const n=ae(e),r=ae(t);return n||r}function $v(e,t){const n=Vr(e),r=Vr(t),s=Ov(n,r),o=Fu(n),i=Fu(r);return s?rn([n,r]):o&&i?Pv(n,r):o&&!i?n:!o&&i?r:Nv(n,r)}function Xm(e,t,n=[]){return Ie(t,(r,s)=>Xm(e,s,[...n,$v(e,r)]),()=>h(n.length,0)?[e]:n)}function Zm(e,t,n=[]){return Ie(e,(r,s)=>Zm(s,t,[...n,...Ui([r],t)]),()=>n)}function Ui(e,t=[]){return Ie(e,(n,r)=>ae(n)?Ui(r,Zm(n.anyOf,t)):Ui(r,Xm(n,t)),()=>t)}function Rv(e,t){const n=nr({},e,t);return Kt(n)?[]:[e]}function Mv(e,t){return e.reduce((n,r)=>[...n,...Rv(r,t)],[])}function ep(e,t){const n=Vr(e),r=ae(n)?n.anyOf:[n],s=Mv(r,t);return or(s)}function Ms(e,t,n){const r=Fn([e,t]),s=ep(n,e);return or([r,s])}function Tr(e){const t=e.map(n=>Me(n));return or(t)}function rn(e){const t=Ui(e),n=kg(t);return Fs(n)}function sr(e){const t=Al(e);return Vr(t)}function or(e){const t=kg(e);return Fs(t)}function Vr(e){return gn(e)?Ms(e.if,e.then,e.else):hn(e)?Tr(e.enum):Ue(e)?rn(e.allOf):zt(e)?sr(e.pattern):ae(e)?or(e.anyOf):e}function Fs(e){return h(e.length,1)?e[0]:h(e.length,0)?Tt():Ve(e)}function Fv(e,t){const n=Tr(e);return aa(n,t)}function Dv(e,t){return wr(Fo,t)}function _v(e,t){const n=rn(e);return aa(n,t)}function Lv(e,t){return ie(e)||ye(e)?Ae({[e]:t}):h(e,!1)?Ae({false:t}):h(e,!0)?Ae({true:t}):Ae({})}function Uv(e,t){return wr(ca,t)}function Bv(e,t){return E(e,"pattern")&&(ie(e.pattern)||e.pattern instanceof RegExp)?wr(e.pattern.toString(),t):wr(Wr,t)}function Hv(e,t){const n=_m(e);return Bm(n)?aa(sr(e),t):wr(e,t)}function qv(e){return ae(e)?ia(e.anyOf):[e]}function ia(e){return e.reduce((t,n)=>[...t,...qv(n)],[])}function zv(e){return e.some(t=>On(t)||nn(t)||_n(t))}function Kv(e,t){return h(zv(e),!0)?wr(Wr,t):void 0}function Gv(e,t){return e.reduce((n,r)=>We(r)&&(ie(r.const)||ye(r.const))?{...n,[r.const]:t}:n,{})}function Vv(e,t){const n=Gv(e,t);return Ae(n)}function Wv(e,t){const n=ia(e),r=Kv(n,t);return Yt(r)?r:Vv(n,t)}function aa(e,t){return Nn(e)?pv(t):jr(e)?gv(t):hn(e)?Fv(e.enum,t):_n(e)?Dv(e,t):Ue(e)?_v(e.allOf,t):We(e)?Lv(e.const,t):nn(e)?Uv(e,t):ae(e)?Wv(e.anyOf,t):On(e)?Bv(e,t):zt(e)?Hv(e.pattern,t):Ae({})}function tp(e,t,n){return Ye([e])?ue(aa(e,t),{},n):np(e,t,n)}function Jv(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return tp(o,i,s)}const Fo=`^${Om}$`,ca=`^${Fm}$`,Wr=`^${Dm}$`;function np(e,t,n={}){return je("Record",[e,t],n)}function El(e,t,n={}){return tp(e,t,n)}function Qv(e,t){return wr(e,t)}function yc(e){return h(e,Wr)?Ln():h(e,Fo)?oa():h(e,ca)?Sr():Vm(e)}function kn(e){return D(e.patternProperties)[0]}function la(e){const t=kn(e);return yc(t)}function qt(e){return e.patternProperties[kn(e)]}function At(e){return we(e,"Record")}function da(e){return he({"~kind":"Rest"},{type:"rest",items:e},{})}function ua(e){return we(e,"Rest")}function rp(e){return he({"~kind":"This"},{$ref:"#"},e)}function sp(e){return we(e,"This")}function Pl(e){return he({"~kind":"Undefined"},{type:"undefined"},e)}function Ds(e){return we(e,"Undefined")}function op(e){return he({"~kind":"Void"},{type:"void"},e)}function ns(e){return we(e,"Void")}function Yv(e,t){return h(e,"Array")?Cr(t[0]):h(e,"Capitalize")?vg(t[0]):h(e,"ConstructorParameters")?$g(t[0]):h(e,"Evaluate")?zN(t[0]):h(e,"Exclude")?Mg(t[0],t[1]):h(e,"Extract")?Fg(t[0],t[1]):h(e,"Index")?sd(t[0],t[1]):h(e,"InstanceType")?qg(t[0]):h(e,"Lowercase")?Ig(t[0]):h(e,"NonNullable")?Wg(t[0]):h(e,"Omit")?Qg(t[0],t[1]):h(e,"Parameters")?Zg(t[0]):h(e,"Partial")?th(t[0]):h(e,"Pick")?rh(t[0],t[1]):h(e,"Readonly")?oh(t[0]):h(e,"KeyOf")?cd(t[0]):h(e,"Record")?np(t[0],t[1]):h(e,"Required")?ch(t[0]):h(e,"ReturnType")?dh(t[0]):h(e,"Uncapitalize")?Cg(t[0]):h(e,"Uppercase")?jg(t[0]):Pc(dn(e),t)}function rs(){throw Error("Unreachable")}function ip(e,t=[]){return Ie(e,(n,r)=>ip(r,[...t,n[1]]),()=>t)}function ir(e){return h(e.length,3)?[e[0],...ip(e[1])]:[]}function Xv(e){return Mo(e[0],e[2],e[4])}function Zv(e){return Mo(e[0],e[2],e[2])}function eI(e){return Mo(e[0],Bt(),e[2])}function tI(e){return Mo(e,Bt(),Bt())}function nI(e){return ir(e)}function rI(e){return e[1]}function sI(e){return ir(e)}function oI(e){return e[1]}function iI(e){return Yv(e[0],e[1])}function aI(e){return null}function cI(e){return Ln()}function lI(e){return Sr()}function dI(e){return Nm()}function uI(e){return Pl()}function fI(e){return jl()}function mI(e){return oa()}function pI(e){return Cl()}function gI(e){return Bt()}function hI(e){return wl()}function bI(e){return Ae({})}function kI(e){return Tt()}function xI(e){return Tl()}function yI(e){return op()}function SI(e){return rp()}function wI(e){return Me(BigInt(e))}function vI(e){return Me(h(e,"true"))}function II(e){return Me(parseFloat(e))}function CI(e){return Me(e)}function jI(e){return e[1]}function TI(e){return Me(e)}function AI(e){return h(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function EI(e){return e[1]}function PI(e){return rg(e)}function NI(e){return h(e.length,6)?Fi(e[1],e[3],e[5]):Fi(e[1],e[3],Bt())}function OI(e){return e.length>0}function $I(e){return e.reduce((t,n)=>h(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function RI(e){return h(e.length,6)?[e[1],e[3],e[5]]:[]}function MI(e){return H(e)&&h(e.length,3)?e[1]:e}function FI(e){return h(e.length,2)?e[1]:[]}function Du(e,t){return t.reduce((n,r)=>{const s=r;return h(s.length,1)?sd(n,s[0]):h(s.length,0)?Cr(n):rs()},e)}function _u(e,t){return h(t.length,3)?Ng(e,t[0],t[1],t[2]):e}function DI(e,t){return H(t)&&h(t.length,0)?e:fh(e,t)}function _I(e){const[t,n,r,s,o]=e;return DI(_u(t?cd(Du(n,r)):Du(n,r),s),o)}function Nl(e,t){return h(t.length,3)?(()=>{const[n,r,s]=t,o=Nl(r,s);if(h(n,"&"))return Ue(o)?Fn([e,...o.allOf]):Fn([e,o]);if(h(n,"|"))return ae(o)?Ve([e,...o.anyOf]):Ve([e,o]);rs()})():e}function LI(e){const[t,n]=e;return Nl(t,n)}function UI(e){const[t,n]=e;return Nl(t,n)}function BI(e){return qN(e[1])}function HI(e){return e[1]}function qI(e){return No(e[0],e[2])}function zI(e){return h(e.length,4)?bc(e[1],e[3]):h(e.length,2)?bc(e[1],Bt()):rs()}function KI(e){return`${e}`}function GI(e){return _n(e[3])?Fo:nn(e[3])?ca:Ro(e[3])||On(e[3])?Wr:rs()}function VI(e){return e.length>0}function WI(e){return e.length>0}function JI(e){const[t,n,r,s,o]=e;return{[n]:t&&r?tr(er(o)):t&&!r?tr(o):!t&&r?er(o):o}}function QI(e){return ir(e)}function ap(e){return e.reduce((t,n)=>E(n,Fo)||E(n,ca)||E(n,Wr)?[t[0],gt(t[1],n)]:[gt(t[0],n),t[1]],[{},{}])}function YI(e){return ap(e[1])}function XI(e){const[t,n]=e,r=h(D(n).length,0)?{}:{patternProperties:n};return Ae(t,r)}function ZI(e){return h(e.length,5)?tr(er(e[4])):h(e.length,3)?e[2]:h(e.length,4)?h(e[2],"readonly")?tr(e[3]):er(e[3]):rs()}function eC(e){if(!H(e)||!h(e.length,3))return e;const[t,n,r]=e;return t&&r?tr(er(n)):t&&!r?tr(n):!t&&r?er(n):n}function tC(e){return h(e.length,2)?da(e[1]):h(e.length,1)?e[0]:rs()}function nC(e){return ir(e)}function rC(e){return bn(e[1])}function sC(e){return tr(er(e[4]))}function oC(e){return tr(e[3])}function iC(e){return er(e[3])}function aC(e){return e[2]}function cC(e){return h(e.length,2)?da(e[1]):h(e.length,1)?e[0]:rs()}function lC(e){return ir(e)}function dC(e){return Po(e[1],e[4])}function uC(e){return Eo(e[2],e[5])}function Lu(e,t){return h(e,"remove")?xv(t):h(e,"add")?tr(t):t}function fC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function Uu(e,t){return h(e,"remove")?vv(t):h(e,"add")?er(t):t}function mC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function pC(e){return h(e.length,2)?[e[1]]:[]}function gC(e){return H(e[6])&&h(e[6].length,1)?Nc(xc(e[3]),e[5],e[6][0],Lu(e[1],Uu(e[8],e[10]))):Nc(xc(e[3]),e[5],dn(e[3]),Lu(e[1],Uu(e[8],e[10])))}function hC(e){return dn(e)}function bC(e){return BigInt(e)}function kC(e){return parseFloat(e)}function xC(e){return h(e,"true")}function yC(e){return null}function SC(e){return{[e[0]]:e[2]}}function wC(e){return ir(e)}function vC(e){return e.reduce((t,n)=>gt(t,n),{})}function IC(e){return vC(e[1])}function CC(e){return ir(e)}function jC(e){return e[1]}function TC(e){return Cl()}function AC(e){return Ln()}function EC(e){return Sr()}function PC(e){return oa()}function NC(e){return Tt()}function OC(e){return Me(e)}function $C(e){return Ve(e[1])}function RC(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function MC(e){return[e[0],...e[1]]}function FC(e){return e[1]}function DC(e){return ir(e)}function _C(e){return h(e.length,2)?e[1]:[]}function LC(e){const t=e[2],n=e[3],[r,s]=e[4],o=h(D(s).length,0)?{}:{patternProperties:s};return{[e[1]]:No(t,Jl(n,r,o))}}function UC(e){const t=e[2],[n,r]=e[3],s=h(D(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Jl(t,n,s)}}function BC(e){return{[e[1]]:No(e[2],e[4])}}function HC(e){return{[e[1]]:e[3]}}function qC(e){return null}function zC(e){return ir(e)}function KC(e){return e[1]}function GC(e){const[t,n]=[e[0],e[1]];return KN(gt(t,ap(n)[0]))}function Ol(e){return h(e.length,2)}function Re(e,t,n){return Ol(e)?t(e[0],e[1]):n()}function VC(e,t){return h(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Rt(e,t){for(let n=0;n<e.length;n++){const r=VC(e[n],t);if(Ol(r))return r}return[]}function Sc(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}const WC=[...Sc(97,122),...Sc(65,90)],cp="0",lp=Sc(49,57),$l=[cp,...lp],JC=" ",Rl=`
|
|
3
|
-
`,Do="_",
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-DBsb7E9J.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-radix-DXRuAJHH.js","assets/vendor-icons-ICv1v-tf.js","assets/TaskSwitcher-Z0KWY8g9.js","assets/FilePreview-LvuYnyjv.js","assets/TerminalPanel-DVWTlxtd.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/ChatView-DG6MMrFK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Yy=Object.defineProperty;var Xy=(e,t,n)=>t in e?Yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ja=(e,t,n)=>Xy(e,typeof t!="symbol"?t+"":t,n);import{r as w,j as c,c as oo,d as Zy}from"./vendor-react-DG5dkZ_t.js";import{S as eS,O as Af,P as tS,C as Ef,a as nS,T as Pf,D as Nf,R as rS,b as Of,V as sS,c as oS,d as $f,e as iS,f as aS,g as Rf,h as cS,i as lS}from"./vendor-radix-DXRuAJHH.js";import{X as co,H as Su,L as lt,F as dS,R as Qi,A as Mf,a as lo,D as Ff,b as uS,c as Oi,d as fS,e as uo,G as el,T as Df,C as _f,f as As,S as tl,M as mS,g as pS,P as gS,h as Lf,i as nl,j as Uf,k as rl,l as hS,m as bS,n as kS,o as Bf,p as xS,q as yS,r as Hf,s as wu,t as SS,u as wS,v as qf,w as vS,I as IS,x as vu,y as Ss,B as CS,z as jS,E as TS,W as Iu,J as AS,K as ES,N as PS,O as NS,Q as OS,U as Cu,V as ju}from"./vendor-icons-ICv1v-tf.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const $S="modulepreload",RS=function(e){return"/"+e},Tu={},Io=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=RS(l),l in Tu)return;Tu[l]=!0;const d=l.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":$S,d||(p.as="script"),p.crossOrigin="",p.href=l,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};function zf(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=zf(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Kf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=zf(e))&&(r&&(r+=" "),r+=t);return r}const Au=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Eu=Kf,MS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Eu(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(d=>{const m=n==null?void 0:n[d],p=o==null?void 0:o[d];if(m===null)return null;const g=Au(m)||Au(p);return s[d][g]}),a=n&&Object.entries(n).reduce((d,m)=>{let[p,g]=m;return g===void 0||(d[p]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,m)=>{let{class:p,className:g,...x}=m;return Object.entries(x).every(b=>{let[y,j]=b;return Array.isArray(j)?j.includes({...o,...a}[y]):{...o,...a}[y]===j})?[...d,p,g]:d},[]);return Eu(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},sl="-",FS=e=>{const t=_S(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(sl);return a[0]===""&&a.length!==1&&a.shift(),Gf(a,t)||DS(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},Gf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Gf(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(sl);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Pu=/^\[(.+)\]$/,DS=e=>{if(Pu.test(e)){const t=Pu.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},_S=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return US(Object.entries(e.classGroups),n).forEach(([o,i])=>{gc(i,r,o,t)}),r},gc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Nu(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(LS(s)){gc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{gc(i,Nu(t,o),n,r)})})},Nu=(e,t)=>{let n=e;return t.split(sl).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},LS=e=>e.isThemeGetter,US=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[n,s]}):e,BS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},Vf="!",HS=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let d=0,m=0,p;for(let j=0;j<a.length;j++){let k=a[j];if(d===0){if(k===s&&(r||a.slice(j,j+o)===t)){l.push(a.slice(m,j)),m=j+o;continue}if(k==="/"){p=j;continue}}k==="["?d++:k==="]"&&d--}const g=l.length===0?a:a.substring(m),x=g.startsWith(Vf),b=x?g.substring(1):g,y=p&&p>m?p-m:void 0;return{modifiers:l,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:i}):i},qS=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},zS=e=>({cache:BS(e.cacheSize),parseClassName:HS(e),...FS(e)}),KS=/\s+/,GS=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(KS);let a="";for(let l=i.length-1;l>=0;l-=1){const d=i[l],{modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(d);let b=!!x,y=r(b?g.substring(0,x):g);if(!y){if(!b){a=d+(a.length>0?" "+a:a);continue}if(y=r(g),!y){a=d+(a.length>0?" "+a:a);continue}b=!1}const j=qS(m).join(":"),k=p?j+Vf:j,A=k+y;if(o.includes(A))continue;o.push(A);const N=s(y,b);for(let $=0;$<N.length;++$){const Q=N[$];o.push(k+Q)}a=d+(a.length>0?" "+a:a)}return a};function VS(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Wf(t))&&(r&&(r+=" "),r+=n);return r}const Wf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Wf(e[r]))&&(n&&(n+=" "),n+=t);return n};function WS(e,...t){let n,r,s,o=i;function i(l){const d=t.reduce((m,p)=>p(m),e());return n=zS(d),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const m=GS(l,n);return s(l,m),m}return function(){return o(VS.apply(null,arguments))}}const Je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Jf=/^\[(?:([a-z-]+):)?(.+)\]$/i,JS=/^\d+\/\d+$/,QS=new Set(["px","full","screen"]),YS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,e0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,t0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kn=e=>js(e)||QS.has(e)||JS.test(e),ur=e=>Ps(e,"length",l0),js=e=>!!e&&!Number.isNaN(Number(e)),Qa=e=>Ps(e,"number",js),eo=e=>!!e&&Number.isInteger(Number(e)),n0=e=>e.endsWith("%")&&js(e.slice(0,-1)),le=e=>Jf.test(e),fr=e=>YS.test(e),r0=new Set(["length","size","percentage"]),s0=e=>Ps(e,r0,Qf),o0=e=>Ps(e,"position",Qf),i0=new Set(["image","url"]),a0=e=>Ps(e,i0,u0),c0=e=>Ps(e,"",d0),to=()=>!0,Ps=(e,t,n)=>{const r=Jf.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},l0=e=>XS.test(e)&&!ZS.test(e),Qf=()=>!1,d0=e=>e0.test(e),u0=e=>t0.test(e),f0=()=>{const e=Je("colors"),t=Je("spacing"),n=Je("blur"),r=Je("brightness"),s=Je("borderColor"),o=Je("borderRadius"),i=Je("borderSpacing"),a=Je("borderWidth"),l=Je("contrast"),d=Je("grayscale"),m=Je("hueRotate"),p=Je("invert"),g=Je("gap"),x=Je("gradientColorStops"),b=Je("gradientColorStopPositions"),y=Je("inset"),j=Je("margin"),k=Je("opacity"),A=Je("padding"),N=Je("saturate"),$=Je("scale"),Q=Je("sepia"),T=Je("skew"),C=Je("space"),O=Je("translate"),R=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",le,t],P=()=>[le,t],B=()=>["",Kn,ur],M=()=>["auto",js,le],fe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ve=()=>["solid","dashed","dotted","double","none"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],Fe=()=>["","0",le],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],me=()=>[js,le];return{cacheSize:500,separator:":",theme:{colors:[to],spacing:[Kn,ur],blur:["none","",fr,le],brightness:me(),borderColor:[e],borderRadius:["none","","full",fr,le],borderSpacing:P(),borderWidth:B(),contrast:me(),grayscale:Fe(),hueRotate:me(),invert:Fe(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[n0,ur],inset:X(),margin:X(),opacity:me(),padding:P(),saturate:me(),scale:me(),sepia:Fe(),skew:me(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[fr]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...fe(),le]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",eo,le]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",le]}],grow:[{grow:Fe()}],shrink:[{shrink:Fe()}],order:[{order:["first","last","none",eo,le]}],"grid-cols":[{"grid-cols":[to]}],"col-start-end":[{col:["auto",{span:["full",eo,le]},le]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[to]}],"row-start-end":[{row:["auto",{span:[eo,le]},le]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",le,t]}],"min-w":[{"min-w":[le,t,"min","max","fit"]}],"max-w":[{"max-w":[le,t,"none","full","min","max","fit","prose",{screen:[fr]},fr]}],h:[{h:[le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",fr,ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qa]}],"font-family":[{font:[to]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",le]}],"line-clamp":[{"line-clamp":["none",js,Qa]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Kn,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Kn,ur]}],"underline-offset":[{"underline-offset":["auto",Kn,le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...fe(),o0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",s0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},a0]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...ve(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:ve()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...ve()]}],"outline-offset":[{"outline-offset":[Kn,le]}],"outline-w":[{outline:[Kn,ur]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Kn,ur]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",fr,c0]}],"shadow-color":[{shadow:[to]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ke(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ke()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",fr,le]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[N]}],sepia:[{sepia:[Q]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",le]}],duration:[{duration:me()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:me()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[$]}],"scale-x":[{"scale-x":[$]}],"scale-y":[{"scale-y":[$]}],rotate:[{rotate:[eo,le]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Kn,ur,Qa]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},m0=WS(f0);function W(...e){return m0(Kf(e))}const p0=MS("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),br=w.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?eS:"button";return c.jsx(i,{className:W(p0({variant:t,size:n,className:e})),ref:o,...s})});br.displayName="Button";const ol=rS,g0=tS,Yf=w.forwardRef(({className:e,...t},n)=>c.jsx(Af,{ref:n,className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Yf.displayName=Af.displayName;const Yi=w.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>c.jsxs(g0,{children:[c.jsx(Yf,{}),c.jsxs(Ef,{ref:s,"aria-modal":"true",className:W("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,!n&&c.jsxs(nS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[c.jsx(co,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yi.displayName=Ef.displayName;const il=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});il.displayName="DialogHeader";const Xf=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Xf.displayName="DialogFooter";const Xi=w.forwardRef(({className:e,...t},n)=>c.jsx(Pf,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));Xi.displayName=Pf.displayName;const Zi=w.forwardRef(({className:e,...t},n)=>c.jsx(Nf,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Zi.displayName=Nf.displayName;const h0={"app.restoring":"Restoring workspace…","layout.workspace.pathAria":"Workspace path","layout.workspace.empty":"No workspace","layout.action.rewind":"Rewind session","layout.action.filePreview":"File preview","layout.action.filePreviewToggle":"Toggle file preview","layout.action.openNavigation":"Open navigation","terminal.title":"Terminal","terminal.status.connected":"Terminal connected","terminal.status.disconnected":"Terminal disconnected","terminal.action.minimize":"Minimize terminal","terminal.action.restore":"Restore terminal","terminal.action.close":"Close terminal","sidebar.brand.badge":"WEB","sidebar.action.collapse":"Collapse sidebar","sidebar.action.expand":"Expand sidebar","sidebar.navigationAria":"Task navigation","sidebar.action.newTask":"New Task","sidebar.action.newTaskShort":"New task","sidebar.action.terminal":"Terminal","sidebar.action.terminalToggle":"Toggle terminal","sidebar.action.searchTasks":"Search tasks","sidebar.unreadTasks":"{count} unread tasks","sidebar.section.skills":"Skills","sidebar.section.mcp":"MCP","sidebar.section.settings":"Settings","sidebar.status.user":"User","sidebar.status.feedLive":"Task feed live","sidebar.status.feedOffline":"Task feed offline","sidebar.empty.title":"No tasks yet","sidebar.empty.hint":"Dispatch one from the home view","sidebar.group.running":"RUNNING","sidebar.group.queued":"QUEUED","sidebar.group.interrupted":"INTERRUPTED","sidebar.group.failed":"FAILED","sidebar.group.cancelled":"CANCELLED","sidebar.group.done":"DONE","sidebar.group.showMore":"Show {count} more","sidebar.group.showLess":"Show less","sidebar.view.project":"Projects","sidebar.view.status":"Status","sidebar.view.projectAria":"Group sessions by project","sidebar.view.statusAria":"Group sessions by status","sidebar.project.active":"active","sidebar.project.expand":"Expand {name}","sidebar.project.collapse":"Collapse {name}","sidebar.project.newTask":"New task in {name}","sidebar.project.reorder":"Reorder {name}, position {position} of {count}","sidebar.project.reorderHint":"Drag to reorder, or use Up and Down arrow keys","sidebar.project.reordered":"Moved {name} to position {position}","sidebar.project.projects":"Projects","sidebar.catalog.syncing":"Syncing task history…","sidebar.catalog.loaded":"{count} loaded","sidebar.catalog.incomplete":"Task history is incomplete","sidebar.catalog.retry":"Retry","projects.dialog.title":"Projects","projects.dialog.description":"Bind local folders to switch task context without restarting Blade.","projects.bind.placeholder":"/absolute/path/to/project","projects.bind.pathLabel":"Project path","projects.bind.action":"Bind","projects.bind.failed":"Failed to bind project","projects.pick.action":"Choose project folder","projects.pick.actionShort":"Choose","projects.pick.picking":"Choosing…","projects.pick.failed":"Failed to choose a project folder","projects.unbind.action":"Unbind project","projects.unavailable":"unavailable","sidebar.language.label":"Language","sidebar.language.aria":"Switch language","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"worktree","session.env.local":"local","session.action.select":"Select {title}","session.action.save":"Save {title}","session.action.cancel":"Cancel {title}","session.action.more":"More actions for {title}","session.action.fork":"Fork {title}","session.action.forkShort":"Fork","session.action.rename":"Rename {title}","session.action.renameShort":"Rename","session.action.archive":"Archive {title}","session.action.archiveShort":"Archive","session.action.export":"Export {title} as Markdown","session.action.exportShort":"Export Markdown","session.action.exportingShort":"Exporting…","session.action.delete":"Delete {title}","session.action.deleteShort":"Delete","session.action.stop":"Stop {title}","session.action.stopping":"Stopping {title}","session.action.retry":"Retry {title}","session.action.retrying":"Retrying {title}","session.reason.cancelledByUser":"Cancelled by user","session.title.codeReview":"Code Review","session.forkedFrom":"Forked from","session.retriedFrom":"Retried from","session.retryShort":"retry","session.queued":"#{position}/{depth} queued","archive.title":"Archive","archive.subtitle":"Stored safely outside the active task list","archive.open":"Open session archive","archive.refresh":"Refresh archived sessions","archive.retry":"Retry","archive.loading":"Loading archive…","archive.empty":"No archived sessions","archive.restore":"Restore {title}","archive.restoreShort":"Restore","archive.restoreAncestor":"Restore the archive root first","archive.inherited":"Archived with {id}","taskSwitcher.title":"Task switcher","taskSwitcher.description":"Search and open tasks across every project.","taskSwitcher.searchAria":"Search tasks","taskSwitcher.placeholder":"Search title, project, branch, status, or session ID…","taskSwitcher.results":"{count} results","taskSwitcher.recent":"Recent tasks","taskSwitcher.scope":"{count} tasks indexed","taskSwitcher.indexing":"Indexing tasks…","taskSwitcher.resultsAria":"Task search results","taskSwitcher.current":"Current","taskSwitcher.unread":"{count} unread","taskSwitcher.needsAction":"{count} need action","taskSwitcher.new":"New","taskSwitcher.empty":"No matching tasks","taskSwitcher.emptyHint":"Try a project, branch, status, or shorter phrase.","taskSwitcher.hint.navigate":"navigate","taskSwitcher.hint.open":"open","taskSwitcher.hint.toggle":"toggle","taskSwitcher.action.failed":"Task action failed","commandCenter.title":"Command center","commandCenter.description":"Search tasks or run workspace and application actions.","commandCenter.searchAria":"Search actions","commandCenter.placeholder":"Search actions, settings, or tools…","commandCenter.modeAria":"Command center mode","commandCenter.mode.tasks":"Tasks","commandCenter.mode.commands":"Actions","commandCenter.actions":"{count} actions","commandCenter.resultsAria":"Action search results","commandCenter.empty":"No matching actions","commandCenter.emptyHint":"Try a tool, panel, or setting name.","commandCenter.action.newTask":"New task","commandCenter.action.newTaskDescription":"Open a clean task composer","commandCenter.action.preview":"Toggle preview","commandCenter.action.previewDescription":"Review files, diffs, and run logs","commandCenter.action.terminal":"Toggle terminal","commandCenter.action.terminalDescription":"Open or close the workspace shell","commandCenter.action.settings":"Open settings","commandCenter.action.settingsDescription":"Configure appearance and behavior","commandCenter.action.models":"Configure models","commandCenter.action.modelsDescription":"Select providers and task models","commandCenter.action.shortcuts":"View keyboard shortcuts","commandCenter.action.shortcutsDescription":"Browse global and contextual keys","commandCenter.action.skills":"Manage skills","commandCenter.action.skillsDescription":"Discover and configure agent capabilities","commandCenter.action.mcp":"Manage MCP servers","commandCenter.action.mcpDescription":"Configure connected tools and servers","commandCenter.action.sidebar":"Toggle sidebar","commandCenter.action.sidebarDescription":"Show or hide project navigation","taskHome.eyebrow":"Task dispatcher · Ready","taskHome.feed.connecting":"Task dispatcher · Connecting","taskHome.feed.reconnecting":"Task dispatcher · Reconnecting","taskHome.feed.offline":"Task dispatcher · Offline","taskHome.feed.offlineDescription":"Live task updates are paused. Running tasks continue on the server.","taskHome.feed.retry":"Reconnect","taskHome.hero.prefix":"What should Blade build in","taskHome.hero.projectFallback":"current workspace","taskHome.hero.subtitle":"Dispatch a task and keep moving. Each task runs in its own worktree, persists state, and returns with a reviewable workspace when it's done.","taskHome.templates.title":"Templates","taskHome.templates.hint":"1–4 to prefill","taskHome.template.explore.title":"Explore","taskHome.template.explore.description":"Trace behavior and explain the system","taskHome.template.explore.hint":"Trace a call · map a module","taskHome.template.build.title":"Build","taskHome.template.build.description":"Implement a production-ready feature","taskHome.template.build.hint":"Ship a feature end-to-end","taskHome.template.review.title":"Review","taskHome.template.review.description":"Find correctness and regression risks","taskHome.template.review.hint":"Audit current changes","taskHome.review.attachmentsUnsupported":"Code review does not accept attachments","taskHome.review.outputSchemaUnsupported":"Code review uses its own structured report schema","taskHome.review.usage":"Usage: /review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"Read-only code review in progress","taskHome.review.stale":"Review target changed while the reviewer was running","taskHome.review.aborted":"Code review aborted","taskHome.review.interrupted":"Code review interrupted by process restart","taskHome.review.failed":"Code review failed","taskHome.review.startFailed":"Failed to start code review","taskHome.review.invalidTarget":"The selected review target is invalid or has no changes","taskHome.review.conflict":"This session already has active work","taskHome.template.fix.title":"Fix","taskHome.template.fix.description":"Diagnose and repair a concrete failure","taskHome.template.fix.hint":"Bisect · reproduce · patch","taskHome.context.isolationToggleTitle":"Toggle task isolation","taskHome.context.projectSelect":"Select target project","taskHome.context.isolation.worktree":"Isolated worktree","taskHome.context.isolation.local":"Local workspace","taskHome.context.branchFallback":"no branch","taskHome.context.preparing":"Preparing worktree","taskHome.setup.aria":"Task setup status","taskHome.setup.title":"Finish setup","taskHome.setup.description":"Keep drafting while Blade verifies the workspace and model.","taskHome.setup.workspace.title":"Workspace","taskHome.setup.workspace.loading":"Checking available workspaces…","taskHome.setup.workspace.ready":"{project} selected","taskHome.setup.workspace.required":"Choose an available project","taskHome.setup.workspace.empty":"No project","taskHome.setup.workspace.action":"Choose","taskHome.setup.workspace.retry":"Reload workspaces","taskHome.setup.model.title":"Model","taskHome.setup.model.loading":"Checking configuration…","taskHome.setup.model.ready":"Ready for this task","taskHome.setup.model.required":"Configure or select a model","taskHome.setup.model.action":"Configure","taskHome.setup.model.retry":"Retry","taskHome.composer.placeholder":"Describe the outcome, constraints, and verification you expect...","taskHome.error.dismiss":"Dismiss","taskHome.recent.title":"Recent tasks","taskHome.recent.total":"{count} total","taskHome.recent.partial":"{count} loaded · syncing","taskHome.recent.incomplete":"{count} loaded · history incomplete","taskSwitcher.indexingLoaded":"{count} loaded · syncing history","taskHome.footer.note":"Worktree isolation keeps parallel tasks from touching your active checkout","capacity.title":"{inFlight} running · {queued} queued · max {max}","capacity.suffix.running":" running","capacity.queued":"{queued} queued","recent.status.running":"running","recent.status.queued":"queued","recent.status.paused":"paused","recent.status.failed":"failed","recent.status.cancelled":"cancelled","recent.status.done":"done","recent.time.justNow":"just now","recent.time.minutes":"{n}m ago","recent.time.hours":"{n}h ago","recent.time.days":"{n}d ago","recent.session.fallbackShort":"Session {id}","recent.session.fallbackDated":"Session {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} unread task updates","attention.notification.completed":"Task completed","attention.notification.failed":"Task failed","attention.notification.interrupted":"Task interrupted","attention.notification.permission":"Approval required","attention.notification.question":"Answer required","attention.notification.elicitation":"MCP input required","interaction.permission.title":"Permission required: {tool}","interaction.permission.once":"Allow once","interaction.permission.session":"Allow for session","interaction.permission.project":"Allow for project","interaction.permission.deny":"Deny","interaction.permission.failed":"Failed to respond to permission","interaction.question.answered":"Questions answered","interaction.question.other":"Other","interaction.question.submit":"Submit answers","interaction.question.failed":"Failed to submit answers","interaction.elicitation.title":"MCP input requested","interaction.elicitation.submit":"Submit to MCP","interaction.elicitation.open":"Open external URL","interaction.elicitation.decline":"Decline","interaction.elicitation.cancel":"Cancel","interaction.elicitation.responded":"MCP request answered","interaction.elicitation.cancelled":"MCP request cancelled","interaction.elicitation.failed":"Failed to respond to MCP request","interaction.elicitation.warning":"Only continue if you trust this MCP server and understand the request.","interaction.bar.permissionTitle":"Agent needs approval","interaction.bar.permissionHint":"Review the pending tool request before this task can continue.","interaction.bar.questionTitle":"Agent needs your answer","interaction.bar.questionHint":"Answer the pending question before this task can continue.","interaction.bar.elicitationTitle":"MCP server needs your input","interaction.bar.elicitationHint":"Review the MCP request before this task can continue.","interaction.bar.review":"Review request","interaction.badge.permission":"Needs approval","interaction.badge.question":"Needs answer","interaction.badge.elicitation":"MCP input","artifact.env.isolated":"isolated","artifact.env.local":"local","artifact.review":"Review changes","artifact.commits":"{count} commits","artifact.apply":"Apply","artifact.retryApply":"Retry apply","artifact.applying":"Applying","artifact.applied":"Applied","artifact.discard":"Discard task changes","artifact.discarded":"Discarded","artifact.conflict":"The task changes could not be applied safely.","artifact.conflictHint":"The isolated changes are preserved. Review them, resolve the source project, then retry or discard.","artifact.discardDialog.title":"Discard isolated changes?","artifact.discardDialog.description":"Remove {count} changed files from the isolated task workspace for {project}.","artifact.discardDialog.warning":"This permanently removes the task worktree and branch. Your source project is not modified.","artifact.discardDialog.cancel":"Keep changes","artifact.discardDialog.confirm":"Discard changes","chat.list.empty.eyebrow":"Blade · Ready","chat.list.empty.title":"Start a conversation to begin","chat.list.empty.hint":"Ask a question, describe a change, or paste a stack trace.","chat.list.loading.eyebrow":"Conversation history","chat.list.loading.title":"Restoring conversation…","chat.list.loading.hint":"Loading messages, task state, and live updates. Larger conversations may take a moment.","chat.list.showEarlier":"Show {count} earlier messages","chat.list.showEarlierWithRemaining":"Show {count} earlier messages, {remaining} hidden","chat.list.jumpLatest":"Jump to latest","chat.turns.aria":"Jump to a previous message","chat.turns.label":"Turn {n}","chat.timeline.thinking":"Thought process","chat.timeline.tools.runningOne":"Running 1 command","chat.timeline.tools.running":"Running {count} commands","chat.timeline.tools.completedOne":"Executed 1 command","chat.timeline.tools.completed":"Executed {count} commands","chat.timeline.tools.completedOneWithError":"Executed 1 command · failed","chat.timeline.tools.completedWithErrors":"Executed {count} commands · {errors} failed","chat.error.dismiss":"Dismiss error","chat.error.queueFull":"The guidance queue is full. Wait for pending instructions to start, then retry.","chat.error.turnChanged":"The active turn changed before this message was accepted. Review and retry it.","chat.error.title.submission":"Message not sent.","chat.error.title.execution":"Run stopped.","chat.error.title.navigation":"Task not opened.","chat.error.title.generic":"Action failed.","chat.error.action.returnDraft":"Return to draft","chat.error.action.editResend":"Edit and resend","chat.error.action.retryTask":"Retry task","chat.error.action.retryingTask":"Retrying…","chat.error.action.checkModels":"Check model settings","task.failure.authentication":"Provider authentication failed. Check model credentials.","task.failure.permission":"Provider rejected this request. Check account and model permissions.","task.failure.rateLimit":"Provider rate limit or quota exceeded.","task.failure.timeout":"Provider request timed out.","task.failure.network":"Provider connection failed.","task.failure.modelUnavailable":"The selected model is unavailable.","task.failure.contextLimit":"The request exceeded the model context limit.","task.failure.unsupportedInput":"The selected model does not support this input.","task.failure.runtime":"Agent execution failed.","chat.connection.reconnecting":"Reconnecting live updates. The active run continues in the background.","chat.connection.offline":"Live updates are offline. Progress shown here may be stale.","chat.connection.retry":"Reconnect","chat.footer.disclaimer":"Blade can make mistakes. Please check important information.","chat.input.placeholder.default":"Type @ for files, / for commands...","chat.input.placeholder.steering":"Add guidance to steer the active turn...","chat.input.steering.status":"Active turn is steerable","chat.input.steering.queued":"Guidance accepted · {count} pending","chat.input.steering.enterHint":" · Enter sends guidance","chat.input.followUp.queued":"Follow-up accepted · {count} queued for the next turn","chat.input.steering.recoveredOne":"Recovered {count} queued instruction after restart","chat.input.steering.recoveredMany":"Recovered {count} queued instructions after restart","chat.input.attachment.add":"Attach images","chat.input.attachment.remove":"Remove","chat.input.attachment.countLimit":"You can attach up to {count} images.","chat.input.attachment.sizeLimit":"Images must stay under {size} total. Remove an image or choose smaller files.","chat.input.attachment.readFailed":"Blade could not read one of these images.","chat.input.attachment.usage":"{count}/{limit} images · {used} of {budget}","chat.input.attachment.modelUnsupported":"{model} does not support images. Choose a vision model or remove the images.","chat.input.attachment.modelRequired":"Choose a vision-capable model before attaching images.","chat.input.model.placeholder":"Select Model","chat.input.model.empty":"No models configured","chat.input.model.vision":"Vision","chat.input.model.change":"Change model","chat.input.model.locked":"Wait for the active turn to finish before switching models","chat.input.effort.label":"Effort {effort}","chat.input.effort.heading":"Reasoning effort","chat.input.effort.change":"Change reasoning effort","chat.input.effort.locked":"Wait for the active turn to finish before changing reasoning effort","chat.input.effort.option":"Use {effort} reasoning effort","chat.input.effort.autoHint":"near high","chat.input.serviceTier.label":"Speed {tier}","chat.input.serviceTier.heading":"Provider service tier","chat.input.serviceTier.change":"Change provider service tier","chat.input.serviceTier.locked":"Wait for the current turn to finish before changing service tier","chat.input.serviceTier.option":"Use {tier} service tier","chat.input.serviceTier.fastHint":"priority","chat.input.serviceTier.flexHint":"lower cost","chat.input.responseVerbosity.label":"Output {verbosity}","chat.input.responseVerbosity.heading":"Response verbosity","chat.input.responseVerbosity.change":"Change response verbosity","chat.input.responseVerbosity.locked":"Wait for the current turn to finish before changing response verbosity","chat.input.responseVerbosity.option":"Use {verbosity} response verbosity","chat.input.responseVerbosity.autoHint":"model default","chat.input.outputSchema.title":"Structured output","chat.input.outputSchema.description":"Require this turn to finish with an object that matches the JSON Schema.","chat.input.outputSchema.change":"Set structured output schema","chat.input.outputSchema.locked":"Wait for the current turn to finish before changing the output schema","chat.input.outputSchema.editor":"JSON Schema editor","chat.input.outputSchema.placeholder":"Paste a JSON Schema object","chat.input.outputSchema.example":"Use example","chat.input.outputSchema.clear":"Clear","chat.input.outputSchema.invalid":"Enter a valid JSON object. The server validates the complete schema.","chat.input.outputSchema.shellUnsupported":"Structured output cannot be combined with a shell command.","chat.structuredOutput.title":"Structured output","chat.structuredOutput.copy":"Copy structured output","chat.input.communicationStyle.label":"Style {style}","chat.input.communicationStyle.heading":"Communication style","chat.input.communicationStyle.change":"Change communication style","chat.input.communicationStyle.locked":"Wait for the current turn to finish before changing communication style","chat.input.communicationStyle.option":"Use {style} communication style","chat.input.communicationStyle.autoHint":"Blade default","chat.input.communicationStyle.pragmaticHint":"direct","chat.input.communicationStyle.friendlyHint":"warm","chat.input.communicationStyle.explanatoryHint":"explain choices","chat.notice.dismiss":"Dismiss notice","chat.input.mode.default":"Manual approval","chat.input.mode.default.desc":"Every important action needs your approval","chat.input.mode.autoEdit":"Auto approval","chat.input.mode.autoEdit.desc":"Let the AI review and approve important actions","chat.input.mode.yolo":"Full access","chat.input.mode.yolo.desc":"Run directly on your machine without asking","chat.input.mode.yolo.confirm.title":"Enable full access mode?","chat.input.mode.yolo.confirm.desc":"In this mode the agent will execute all actions — including file writes, shell commands, and network requests — without asking for permission. Only enable this if you trust the current context.","chat.input.mode.yolo.confirm.cancel":"Cancel","chat.input.mode.yolo.confirm.accept":"Enable","chat.input.mode.plan":"Plan","chat.input.mode.plan.desc":"Draft a plan first without making changes","chat.input.mode.aria":"Agent action approval","chat.input.action.stop":"Stop active turn","chat.input.action.stopping":"Stopping active turn","chat.input.action.steer":"Steer active turn","chat.input.action.send":"Send message","chat.input.action.submitting":"Submitting message","chat.review.title":"Code Review","chat.review.target":"Target","chat.review.target.uncommitted":"Uncommitted changes","chat.review.target.base":"Changes against {ref}","chat.review.target.commit":"Commit {ref}","chat.review.status":"Status","chat.review.status.completed":"Completed","chat.review.status.stale":"Stale","chat.review.status.failed":"Failed","chat.review.status.aborted":"Aborted","chat.review.status.interrupted":"Interrupted","chat.review.findings":"Findings","chat.review.noFindings":"No actionable findings","chat.review.confidence":"confidence {value}","chat.review.error":"Error","chat.subagent.resumedFromTitle":"Resumed from {id}","chat.subagent.resumedDepth":"resumed · depth {depth}","chat.subagent.loadingLogs":"Loading subagent logs...","chat.subagent.resumedAs":"Resumed as {id} · {status} · depth {depth}","chat.subagent.resume":"Resume","chat.subagent.resumeAria":"Resume subagent","chat.subagent.followUpAria":"Subagent follow-up","chat.subagent.followUpPlaceholder":"Describe the follow-up work","chat.subagent.cancel":"Cancel","chat.subagent.resumeAgent":"Resume agent","chat.subagent.resumeFailed":"Failed to resume subagent","chat.markdown.copyCode":"Copy code","chat.rewind.title":"Rewind session","chat.rewind.description":"Return to the point before a user message.","chat.rewind.loading":"Loading checkpoints","chat.rewind.empty":"Nothing to rewind to yet","chat.rewind.checkpointAria":"Rewind checkpoint","chat.rewind.userMessage":"User message","chat.rewind.fileCountOne":"{count} file","chat.rewind.fileCountMany":"{count} files","chat.rewind.restoreCode":"Restore code changes","chat.rewind.restoreCodeHint":"Revert files changed at and after this checkpoint.","chat.rewind.cancel":"Cancel","chat.rewind.confirm":"Rewind","chat.rewind.loadFailed":"Failed to load rewind checkpoints","chat.rewind.failed":"Rewind failed. Review the session error and try again.","status.context":"Context","status.tokenLimitTooltip":"Token limit is estimated. It updates when the model reports its context size.","status.phase.running":"Generating...","status.phase.compacting":"Compacting context...","status.phase.switchingModel":"Switching model...","status.phase.waitingPermission":"Waiting for permission...","status.phase.error":"Run failed","preview.title":"Preview","preview.action.resize":"Resize preview","preview.action.close":"Close preview","preview.action.retry":"Retry","preview.tab.diff":"Diff","preview.tab.files":"Files","preview.tab.logs":"Logs","preview.diff.loadingTitle":"Loading task diff…","preview.diff.loadingHint":"Reading the durable worktree artifact.","preview.diff.failedTitle":"Failed to load task diff","preview.diff.discardedTitle":"Changes discarded","preview.diff.discardedHint":"The isolated workspace was removed. The source project was not changed.","preview.diff.emptyTitle":"No patch yet","preview.diff.emptyHint":"Run a tool that changes files to see diffs here.","preview.diff.searchAria":"Search changed files","preview.diff.searchPlaceholder":"Filter changed files…","preview.diff.changedFiles":"{count} changed files","preview.diff.expandAll":"Expand all","preview.diff.collapseAll":"Collapse all","preview.diff.showMoreFiles":"Show {count} more files","preview.diff.showMoreLines":"Show {count} more lines","preview.diff.noMatches":"No matching changed files","preview.diff.patch":"Patch","preview.diff.line":"Line {line}","preview.files.loadingTitle":"Loading files…","preview.files.loadingHint":"Fetching workspace tree.","preview.files.failedTitle":"Failed to load files","preview.files.emptyTitle":"No files yet","preview.files.emptyHint":"Select a project to load its workspace tree.","preview.files.treeFailed":"Failed to load workspace tree","preview.files.searchAria":"Search workspace files","preview.files.searchPlaceholder":"Find a file…","preview.files.searchResultsAria":"File search results","preview.files.searchFailed":"Failed to search workspace files","preview.files.noMatches":"No matching files","preview.files.directoryLoading":"Loading folder…","preview.files.directoryEmpty":"Empty folder","preview.files.selectTitle":"Select a file to preview","preview.files.status.loading":"Loading…","preview.files.status.truncated":"Truncated","preview.files.status.ready":"Ready","preview.files.truncatedNotice":"Preview truncated to 200k characters.","preview.files.pickHint":"Pick a file from the tree to preview.","preview.files.contentFailed":"Failed to load file","preview.files.editorLoading":"Loading editor…","preview.logs.searchAria":"Search tool logs","preview.logs.searchPlaceholder":"Search tool, summary, or output…","preview.logs.filterAria":"Filter logs by status","preview.logs.filter.all":"All","preview.logs.filter.running":"Running","preview.logs.filter.error":"Failed","preview.logs.filter.success":"Success","preview.logs.noMatches":"No matching logs","preview.logs.noMatchesHint":"Try another phrase or status.","preview.logs.emptyTitle":"No logs yet","preview.logs.emptyHint":"Tool runs will appear here.","preview.logs.expand":"Expand","preview.logs.collapse":"Collapse","preview.logs.showMore":"Show {count} more logs","preview.logs.status.running":"Running","preview.logs.status.error":"Failed","preview.logs.status.success":"Success","goal.aria.section":"Goal controls","goal.status.active":"Goal running","goal.status.paused":"Goal paused","goal.status.blocked":"Goal blocked","goal.status.usageLimited":"Usage limited","goal.status.budgetLimited":"Budget reached","goal.status.complete":"Goal complete","goal.field.objective":"Goal objective","goal.action.edit":"Edit goal","goal.action.pause":"Pause goal","goal.action.resume":"Resume goal","goal.action.delete":"Delete goal","goal.action.expand":"Expand goal details","goal.action.collapse":"Collapse goal details","goal.action.cancel":"Cancel","goal.action.save":"Save","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"{n} continuation","goal.metrics.continuationMany":"{n} continuations","goal.dialog.title":"Delete this goal?","goal.dialog.description":"The goal state will be removed. Session history and workspace files are not affected.","settings.title":"Settings","settings.nav.aria":"Settings sections","settings.action.back":"Back","settings.category.settings":"Settings","settings.category.integrations":"Integrations","settings.tab.general":"General","settings.tab.trust":"Security","settings.tab.models":"Models","settings.tab.shortcuts":"Shortcuts","settings.tab.mcp":"MCP","settings.tab.skills":"Skills","settings.tab.plugins":"Plugins","settings.tab.hooks":"Hooks","settings.tab.schedules":"Scheduled Tasks","settings.common.retry":"Retry","settings.common.dismiss":"Dismiss","settings.common.cancel":"Cancel","settings.common.enable":"Enable","settings.general.loading":"Loading settings...","settings.general.loadError":"Failed to load settings","settings.general.saveError":"Failed to save settings","settings.general.responseLanguage":"Response Language","settings.general.responseLanguageHint":"AI will respond in this language","settings.general.autoSave":"Auto-save sessions","settings.general.communicationStyle":"Communication Style","settings.general.communicationStyleHint":"How the agent phrases its replies across every session","settings.appearance.heading":"Appearance","settings.appearance.theme":"Theme Preference","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.system":"System","settings.appearance.compactSidebar":"Compact sidebar","settings.appearance.codeTheme":"Code theme","settings.appearance.codeThemeHint":"Syntax highlighting colors","settings.notifications.heading":"Notifications","settings.notifications.buildFinished":"Build finished","settings.notifications.errorsOnly":"Errors only","settings.notifications.systemSounds":"System sounds","settings.notifications.blocked":"Browser notifications are blocked","settings.notifications.unavailable":"Browser notifications are unavailable","settings.notifications.enablePrompt":"Enable alerts while this tab is in the background","settings.privacy.heading":"Privacy","settings.privacy.telemetry":"Telemetry","settings.privacy.crash":"Crash reports","settings.models.description":"Configure API keys and model settings for different providers.","settings.models.loading":"Loading models...","settings.models.loadChannelsFailed":"Failed to load provider channels","settings.models.saveFailed":"Failed to save model","settings.models.deleteFailed":"Failed to delete model","settings.models.updateFailed":"Failed to update model","settings.models.updateChannelFailed":"Failed to update provider channel","settings.models.probeFailed":"Provider probe failed","settings.models.deleteChannelFailed":"Failed to delete provider channel","settings.models.empty":"No models configured yet","settings.models.add":"+ Add New Model","settings.models.missingCredential":"Missing credential","settings.models.configured":"Configured","settings.models.deleting":"Deleting...","settings.models.deleteModel":"Delete model","settings.models.deleteChannel":"Delete channel","settings.models.deleteModelAria":"Delete {name}","settings.models.deleteModelPrompt":"Delete {name} and its saved configuration?","settings.models.deleteChannelAria":"Delete channel {name}","settings.models.deleteChannelPrompt":"Delete channel {name}, its credential, and {count} configured model(s)? Fallback references will also be removed.","settings.models.editModelAria":"Edit {name}","settings.models.editChannelAria":"Edit channel {name}","settings.models.testChannelAria":"Test {name}","settings.models.deleteChannelActionAria":"Delete channel {name}","settings.models.modelCountOne":"{count} model","settings.models.modelCountMany":"{count} models","settings.models.defaultEndpoint":"default endpoint","settings.shortcuts.searchPlaceholder":"Search actions...","settings.shortcuts.scope.all":"All scopes","settings.shortcuts.scope.global":"Global","settings.shortcuts.scope.chat":"Chat","settings.shortcuts.scope.layout":"Layout","settings.shortcuts.reset":"Reset","settings.shortcuts.col.action":"Action","settings.shortcuts.col.shortcut":"Shortcut","settings.shortcuts.col.scope":"Scope","settings.shortcuts.empty":"No shortcuts found.","settings.shortcuts.action.searchTasks":"Search tasks","settings.shortcuts.action.openCommands":"Open command center","settings.shortcuts.action.newTask":"New task","settings.shortcuts.action.focusComposer":"Focus composer","settings.shortcuts.action.toggleSidebar":"Toggle sidebar","settings.common.reload":"Reload","settings.trust.state.notRequired":"No trust required","settings.trust.state.trusted":"Workspace trusted","settings.trust.state.review":"Review required","settings.trust.state.error":"Trust store error","settings.trust.selectSession":"Select a project session to review folder trust.","settings.trust.heading":"Workspace trust","settings.trust.inheritedFrom":" · inherited from {source}","settings.trust.reloadAria":"Reload workspace trust","settings.trust.revoke":"Revoke","settings.trust.trustWorkspace":"Trust workspace","settings.trust.restartNotice":"Restart Blade to reload project models, MCP, LSP, permissions, and plugins.","settings.trust.revokeAria":"Revoke workspace trust","settings.trust.confirmTrust":"Allow {count} project source(s) to configure models, MCP, LSP, permissions, environment, instructions, commands, skills, agents, or plugins?","settings.trust.confirmRevoke":"Block project-controlled executable configuration after restart?","settings.trust.saving":"Saving...","settings.trust.trustReviewed":"Trust reviewed workspace","settings.trust.revokeTrust":"Revoke trust","settings.trust.empty":"No project-controlled executable configuration was found.","settings.trust.loadFailed":"Failed to load workspace trust","settings.trust.updateFailed":"Failed to update workspace trust","settings.hooks.state.disabled":"Hooks disabled","settings.hooks.state.notRequired":"No external hooks","settings.hooks.state.review":"Review required","settings.hooks.state.trusted":"Trusted","settings.hooks.state.modified":"Changed since approval","settings.hooks.state.error":"Trust store error","settings.hooks.selectSession":"Select a project session to review its hooks.","settings.hooks.heading":"Hook trust","settings.hooks.reloadAria":"Reload hook trust","settings.hooks.revoke":"Revoke","settings.hooks.trustDigest":"Trust digest","settings.hooks.currentSession":"Current session execution","settings.hooks.session.open":"Open a session to control its hooks.","settings.hooks.session.loading":"Loading session state...","settings.hooks.session.disabled":"Disabled by workspace configuration.","settings.hooks.session.paused":"Paused only for this session.","settings.hooks.session.active":"Hooks may run for this session after trust checks.","settings.hooks.session.unavailable":"Disabled by this session runtime or host policy.","settings.hooks.session.enableAria":"Enable hooks for current session","settings.hooks.session.pauseAria":"Pause hooks for current session","settings.hooks.session.unavailableAria":"Hooks unavailable for current session","settings.hooks.confirmTrustAria":"Trust project hooks","settings.hooks.confirmRevokeAria":"Revoke project hook trust","settings.hooks.confirmTrust":"Run these {count} hooks with your user permissions until their configuration changes?","settings.hooks.confirmRevoke":"Stop all configured hooks for this project until explicitly trusted again?","settings.hooks.saving":"Saving...","settings.hooks.trustReviewed":"Trust reviewed hooks","settings.hooks.revokeTrust":"Revoke trust","settings.hooks.empty":"No configured command, HTTP, or prompt hooks.","settings.hooks.loadFailed":"Failed to load hook trust","settings.hooks.updateFailed":"Failed to update hook trust","settings.hooks.sessionUpdateFailed":"Failed to update session hooks","settings.plugins.selectProject":"Select a project to manage its plugins.","settings.plugins.heading":"Workspace plugins","settings.plugins.changesNote":"Changes apply to future session snapshots and persist in the selected scope.","settings.plugins.reloadAria":"Reload plugins","settings.plugins.sourcePolicy":"Source policy","settings.plugins.savePolicyAria":"Save plugin source policy","settings.plugins.saving":"Saving…","settings.plugins.saveForProject":"Save for project","settings.plugins.restrictAria":"Restrict plugin sources","settings.plugins.restrictAllowlists":"Restrict to allowlists","settings.plugins.requireShaAria":"Require full Git commit SHA","settings.plugins.requireSha":"Require full Git SHA","settings.plugins.environmentLocked":" · environment locked","settings.plugins.gitHostsAria":"Allowed plugin Git hosts","settings.plugins.marketplacesAria":"Allowed plugin Marketplaces","settings.plugins.localRootsAria":"Allowed local plugin roots","settings.plugins.emptyAllowlists":"Empty allowlists deny every plugin source.","settings.plugins.installHeading":"Install trusted plugin","settings.plugins.sourceAria":"Plugin source","settings.plugins.install":"Install","settings.plugins.trustSource":"I trust this source to activate Hooks, MCP servers, skills, and commands.","settings.plugins.activationScope":"Activation write scope","settings.plugins.activationScopeHint":"Higher-priority layers continue to determine the effective state.","settings.plugins.scopeAria":"Plugin activation scope","settings.plugins.scope.local":"Local","settings.plugins.scope.project":"Project","settings.plugins.scope.global":"Global","settings.plugins.scope.localDesc":"Only this checkout","settings.plugins.scope.projectDesc":"Shared project settings","settings.plugins.scope.globalDesc":"All projects","settings.plugins.scope.invocation":"Invocation","settings.plugins.scope.default":"Default","settings.plugins.layer.on":"on","settings.plugins.layer.off":"off","settings.plugins.capability.commands":"{count} commands","settings.plugins.capability.skills":"{count} skills","settings.plugins.capability.agents":"{count} agents","settings.plugins.capability.hooks":"{count} hooks","settings.plugins.capability.mcp":"{count} MCP","settings.plugins.noResources":"No declared resources","settings.plugins.effective":"effective: {scope}","settings.plugins.managed":"managed","settings.plugins.invocationScoped":"Invocation-scoped via --plugin-dir","settings.plugins.enableAria":"Enable {name}","settings.plugins.disableAria":"Disable {name}","settings.plugins.unavailableAria":"Unavailable {name}","settings.plugins.updateAria":"Update {name}","settings.plugins.uninstallAria":"Uninstall {name}","settings.plugins.confirmUpdate":"Confirm update","settings.plugins.update":"Update","settings.plugins.confirmRemove":"Confirm remove","settings.plugins.empty":"No plugins discovered for this project.","settings.plugins.marketplaces":"Marketplaces","settings.plugins.configuredCount":"{count} configured","settings.plugins.marketplaceSourceAria":"Marketplace source","settings.plugins.addMarketplaceAria":"Add marketplace","settings.plugins.add":"Add","settings.plugins.noDescription":"No description","settings.plugins.refreshMarketplaceAria":"Refresh marketplace {name}","settings.plugins.removeMarketplaceAria":"Remove marketplace {name}","settings.plugins.confirm":"Confirm","settings.plugins.installedSuffix":" · installed","settings.plugins.marketplaceEmpty":"Add a Marketplace to discover installable plugins.","settings.plugins.loadFailed":"Failed to load plugins","settings.plugins.actionFailed":"Plugin action failed","settings.plugins.updateFailed":"Failed to update plugin","settings.models.addModal.title":"Add Model","settings.models.addModal.close":"Close add model","settings.models.addModal.loadProvidersError":"Failed to load providers","settings.models.addModal.loadModelsError":"Failed to load models","settings.models.addModal.provider":"Provider","settings.models.addModal.loadingProviders":"Loading providers...","settings.models.addModal.selectProvider":"Select provider","settings.models.addModal.configuredSuffix":" - configured","settings.models.addModal.customOpenAI":"Custom OpenAI Endpoint","settings.models.addModal.customAnthropic":"Custom Anthropic Endpoint","settings.models.addModal.channelId":"Channel ID","settings.models.addModal.channelIdHint":"Stable config and credential identifier.","settings.models.addModal.channelName":"Channel name","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"Uses the Anthropic Messages protocol.","settings.models.addModal.openaiProtocol":"Uses the OpenAI Chat Completions protocol.","settings.models.addModal.modelId":"Model ID","settings.models.addModal.model":"Model","settings.models.addModal.loadingModels":"Loading models...","settings.models.addModal.selectModel":"Select model","settings.models.addModal.reasoningSuffix":" - reasoning","settings.models.addModal.visionSuffix":" - vision","settings.models.addModal.displayName":"Display name","settings.models.addModal.displayNamePlaceholder":"Optional alias","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API key","settings.models.addModal.apiKeyPlaceholder":"Stored separately in auth.json","settings.models.addModal.showApiKey":"Show API key","settings.models.addModal.hideApiKey":"Hide API key","settings.models.addModal.oauthNote":"This provider requires OAuth or ambient credentials. Configure it externally before selecting the model.","settings.models.addModal.saveModel":"Save Model","settings.models.addModal.saving":"Saving...","settings.models.addModal.channelIdError":'Channel ID must start with a lowercase letter and contain only lowercase letters, numbers, ".", "_" or "-"',"settings.models.addModal.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editModal.srTitle":"Edit Model","settings.models.editModal.title":"Edit Model Overrides","settings.models.editModal.close":"Close edit model","settings.models.editModal.displayName":"Display name","settings.models.editModal.replaceApiKey":"Replace provider API key","settings.models.editModal.replaceApiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editModal.baseUrlOverride":"Base URL override","settings.models.editModal.baseUrlPlaceholder":"Leave empty to use default endpoint","settings.models.editModal.streamIdleTimeout":"Stream idle timeout (ms)","settings.models.editModal.save":"Save","settings.models.editModal.saving":"Saving...","settings.models.editModal.streamIdleTimeoutError":"Stream idle timeout must be at least 1000ms","settings.models.editModal.credentialError":"Failed to update provider credential","settings.models.editProvider.title":"Edit Provider Channel","settings.models.editProvider.close":"Close edit provider","settings.models.editProvider.channelName":"Channel name","settings.models.editProvider.channelNameRequired":"Channel name is required","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"Provider Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editProvider.apiKeyEnv":"API key environment variable","settings.models.editProvider.apiKeyEnvPlaceholder":"Optional, for example TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"Replace API key","settings.models.editProvider.apiKeyAria":"Provider API key","settings.models.editProvider.apiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editProvider.save":"Save channel","settings.models.editProvider.saving":"Saving...","settings.style.auto":"Auto","settings.style.pragmatic":"Pragmatic","settings.style.friendly":"Friendly","settings.style.explanatory":"Explanatory","mcp.status.connected":"Connected","mcp.status.connecting":"Connecting...","mcp.status.reconnecting":"Recovering...","mcp.status.offline":"Offline","mcp.status.error":"Error","mcp.status.recoveringAttempt":"Recovering {attempt}/{max}","mcp.oauth.status.disabled":"Not configured","mcp.oauth.status.unavailable":"Unavailable in this runtime","mcp.oauth.status.unauthenticated":"Authorization required","mcp.oauth.status.authorizing":"Waiting for authorization...","mcp.oauth.status.authenticated":"Authorized","mcp.oauth.status.error":"Authorization failed","mcp.catalog.tag.official":"Official","mcp.catalog.tag.popular":"Popular","mcp.catalog.tag.community":"Community","mcp.action.refreshServers":"Refresh MCP servers","mcp.action.addServer":"Add server","mcp.action.close":"Close MCP","mcp.action.dismiss":"Dismiss","mcp.action.retry":"Retry","mcp.action.disconnect":"Disconnect","mcp.action.disconnecting":"Disconnecting...","mcp.action.stopRecovery":"Stop recovery","mcp.action.connect":"Connect","mcp.action.connecting":"Connecting...","mcp.action.authorizeFirst":"Authorize first","mcp.action.delete":"Delete","mcp.action.cancel":"Cancel","mcp.action.deleting":"Deleting...","mcp.action.deleteServer":"Delete server","mcp.tab.installed":"Installed ({count})","mcp.tab.catalog":"Catalog","mcp.servers.title":"Servers","mcp.servers.searchAria":"Search installed MCP servers","mcp.servers.searchPlaceholder":"Search servers...","mcp.servers.loading":"Loading servers...","mcp.servers.noMatch":"No servers match your search","mcp.servers.none":"No MCP servers configured","mcp.server.errorLabel":"Error: {error}","mcp.server.deleteAria":"Delete {name}","mcp.server.selectPrompt":"Select a server to view details","mcp.instructions.title":"Server instructions","mcp.instructions.detailsOmittedByPolicy":"[details omitted by runtime policy]","mcp.instructions.detailsOmitted":"Details omitted","mcp.instructions.truncated":"Truncated to the safe display budget","mcp.tasks.title":"Experimental MCP Tasks","mcp.tasks.summary":"{count} per Session · {interval}ms poll","mcp.tasks.disabledByDefault":"Disabled by default","mcp.tasks.enabled":"Enabled","mcp.tasks.disabled":"Disabled","mcp.oauth.signingOut":"Signing out...","mcp.oauth.signOut":"Sign out","mcp.oauth.continueAuthorization":"Continue authorization","mcp.oauth.resumeAuthorization":"Resume authorization","mcp.oauth.opening":"Opening...","mcp.oauth.authorize":"Authorize","mcp.delete.confirm":"Remove this server and its saved configuration?","mcp.tools.title":"Tools ({count})","mcp.tools.none":"No tools available","mcp.completion.title":"Argument completion","mcp.completion.connectPrompt":"Connect the server to request suggestions","mcp.completion.unsupported":"Server does not advertise MCP completions","mcp.completion.noTargets":"No completable prompt arguments or template variables","mcp.completion.targetAria":"MCP completion target","mcp.completion.partialAria":"MCP completion partial value","mcp.completion.partialPlaceholder":"Partial value","mcp.completion.completing":"Completing...","mcp.completion.complete":"Complete","mcp.completion.suggestionsAria":"MCP completion suggestions","mcp.completion.empty":"[empty]","mcp.completion.noSuggestions":"No suggestions","mcp.meta.truncatedSuffix":" · truncated","mcp.meta.detailsOmittedSuffix":" · details omitted","mcp.diagnostics.title":"Diagnostics","mcp.diagnostics.refreshAria":"Refresh {name} MCP logs","mcp.diagnostics.logsAria":"{name} MCP logs","mcp.log.levelAria":"MCP logging level","mcp.log.setting":"Setting...","mcp.log.loading":"Loading logs...","mcp.log.none":"No logs captured","mcp.catalog.searchAria":"Search MCP server catalog","mcp.catalog.searchPlaceholder":"Search MCP servers on npm (min 3 chars)...","mcp.catalog.retry":"Retry catalog","mcp.catalog.noDescription":"No description","mcp.catalog.byAuthor":"by {author}","mcp.catalog.installed":"Installed","mcp.catalog.installing":"Installing...","mcp.catalog.install":"Install","mcp.catalog.noPackages":"No packages found","mcp.catalog.noMore":"No more packages","mcp.catalog.packagesFound":"{count} packages found","mcp.catalog.browseGlama":"Browse more on Glama","mcp.error.connectFailed":"Failed to connect server","mcp.error.disconnectFailed":"Failed to disconnect server","mcp.error.deleteFailed":"Failed to delete server","mcp.error.loginFailed":"Failed to login MCP OAuth","mcp.error.logoutFailed":"Failed to logout MCP OAuth","mcp.error.loggingLevelFailed":"Failed to set MCP logging level","mcp.error.completionFailed":"MCP completion failed","mcp.add.title":"Add MCP Server","mcp.add.closeAria":"Close add MCP server","mcp.add.modeForm":"Form","mcp.add.jsonConfig":"JSON config","mcp.add.jsonConfigAria":"JSON configuration","mcp.add.serverName":"Server name","mcp.add.command":"Command","mcp.add.commandAria":"Server command","mcp.add.argsLabel":"Arguments (space separated)","mcp.add.argsAria":"Server arguments","mcp.add.invalidJson":"Enter valid JSON with a server name and transport.","mcp.add.nameCommandRequired":"Name and command are required.","mcp.add.adding":"Adding...","mcp.add.submit":"Add Server","mcp.install.title":"Install MCP Server","mcp.install.titleWithName":"Install {name}","mcp.install.closeAria":"Close MCP installation","mcp.install.args":"Arguments","mcp.install.commandPreview":"Command: npx {args}","mcp.install.nameRequired":"Server name is required.","skills.title":"Skills","skills.action.install":"Install skill","skills.action.installShort":"Install","skills.action.refreshAria":"Refresh skills","skills.action.closeAria":"Close skills","skills.action.dismiss":"Dismiss","skills.action.retry":"Retry","skills.action.cancel":"Cancel","skills.action.close":"Close","skills.action.hide":"Hide","skills.action.enable":"Enable","skills.action.disable":"Disable","skills.action.saving":"Saving...","skills.status.enabled":"Enabled","skills.status.disabled":"Disabled","skills.status.installed":"Installed","skills.noDescriptionShort":"No description","skills.noDescription":"No description available","skills.installed.title":"Installed","skills.installed.searchAria":"Search installed skills","skills.installed.searchPlaceholder":"Search skills...","skills.installed.loading":"Loading skills...","skills.installed.noMatch":"No skills match your search","skills.installed.empty":"No skills installed","skills.uninstall.managedHint":"Only Blade user skills can be uninstalled","skills.uninstall.managed":"Managed","skills.uninstall.action":"Uninstall","skills.uninstall.confirmAria":"Uninstall {name}","skills.uninstall.confirmPrompt":"Remove this skill from ~/.blade/skills?","skills.uninstall.inProgress":"Uninstalling...","skills.uninstall.confirm":"Uninstall skill","skills.details.title":"Details","skills.details.provider":"Provider","skills.details.location":"Location","skills.details.capabilities":"Capabilities","skills.details.allowedTools":"Allowed Tools ({count})","skills.detail.emptyState":"Select a skill to view details","skills.install.title":"Install Skill","skills.install.closeAria":"Close skill installation","skills.install.tab.catalog":"Catalog","skills.install.tab.repo":"Repo","skills.install.tab.local":"Local","skills.install.catalog.searchAria":"Search skill catalog","skills.install.catalog.searchPlaceholder":"Search catalog...","skills.install.catalog.loading":"Loading catalog...","skills.install.catalog.empty":"No skills found","skills.install.catalog.byAuthor":"by {author}","skills.install.catalog.tag.official":"Official","skills.install.catalog.tag.popular":"Popular","skills.install.catalog.tag.community":"Community","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"Skill repository URL","skills.install.repo.credentialsHint":"Uses Git credentials available to the Blade process","skills.install.local.label":"Local path","skills.install.local.inputAria":"Local skill path","skills.status.dialogTitle":"Install Status","skills.status.confirm.title":"Confirm Install","skills.status.confirm.prompt":"Install selected skill?","skills.status.installing.title":"Installing","skills.status.installing.description":"Downloading and verifying…","skills.status.failed.title":"Install Failed","skills.status.failed.fallback":"Installation failed.","skills.status.failed.hint":"Check access and try again.","skills.error.deleteFailed":"Failed to delete skill","skills.error.toggleFailed":"Failed to toggle skill","skills.error.installFailed":"Failed to install skill","schedule.title":"Scheduled Tasks","schedule.description":"Run headless task prompts automatically on a cron, interval, or one-time trigger.","schedule.new":"New schedule","schedule.newAria":"Create a new schedule","schedule.refresh":"Refresh","schedule.reloadAria":"Reload schedules","schedule.create":"Create","schedule.save":"Save","schedule.cancel":"Cancel","schedule.confirmDelete":"Confirm?","schedule.empty":"No schedules yet","schedule.enabled":"Enabled","schedule.disabled":"Disabled","schedule.never":"never","schedule.nextRun":"Next run","schedule.lastRun":"Last run","schedule.runCount":"{count} runs","schedule.trigger.kindAria":"Trigger type","schedule.trigger.cron":"Cron","schedule.trigger.interval":"Interval","schedule.trigger.once":"Once","schedule.field.title":"Title (optional)","schedule.field.cron":"Cron expression","schedule.field.interval":"Interval","schedule.field.runAt":"Run at","schedule.field.prompt":"Prompt","schedule.field.project":"Project path","schedule.field.model":"Model (optional)","schedule.field.permissionMode":"Permission mode","schedule.field.isolation":"Isolation","schedule.placeholder.title":"Nightly dependency audit","schedule.placeholder.cron":"0 9 * * 1 (min hour dom mon dow)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"Describe the task to run…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"e.g. anthropic/claude-sonnet","schedule.model.current":"Use current model","schedule.permission.default":"Default","schedule.permission.autoEdit":"Auto edit","schedule.permission.yolo":"Yolo","schedule.permission.plan":"Plan","schedule.isolation.local":"Local","schedule.isolation.worktree":"Worktree","schedule.cadence.cron":"cron: {expr}","schedule.cadence.interval":"every {interval}","schedule.cadence.once":"once at {time}","schedule.status.queued":"queued","schedule.status.running":"running","schedule.status.completed":"completed","schedule.status.failed":"failed","schedule.status.cancelled":"cancelled","schedule.status.interrupted":"interrupted","schedule.status.error":"error","schedule.status.never":"no runs yet","schedule.runNowAria":'Run "{title}" now',"schedule.editAria":'Edit "{title}"',"schedule.deleteAria":'Delete "{title}"',"schedule.enableAria":'Enable "{title}"',"schedule.disableAria":'Disable "{title}"',"schedule.error.promptRequired":"A prompt is required.","schedule.error.projectRequired":"A project path is required.","schedule.error.cronRequired":"A cron expression is required.","schedule.error.invalidInterval":"Enter an interval like 30m, 2h, or 1d.","schedule.error.runAtRequired":"Pick a valid run time.","schedule.error.loadFailed":"Failed to load scheduled tasks.","schedule.error.createFailed":"Failed to create scheduled task.","schedule.error.updateFailed":"Failed to update scheduled task.","schedule.error.deleteFailed":"Failed to delete scheduled task.","schedule.error.toggleFailed":"Failed to change scheduled task status.","schedule.error.runFailed":"Failed to run scheduled task."},b0={"app.restoring":"正在恢复工作区…","layout.workspace.pathAria":"工作区路径","layout.workspace.empty":"未选择工作区","layout.action.rewind":"回溯会话","layout.action.filePreview":"文件预览","layout.action.filePreviewToggle":"切换文件预览","layout.action.openNavigation":"打开导航","terminal.title":"终端","terminal.status.connected":"终端已连接","terminal.status.disconnected":"终端未连接","terminal.action.minimize":"最小化终端","terminal.action.restore":"恢复终端","terminal.action.close":"关闭终端","sidebar.brand.badge":"网页版","sidebar.action.collapse":"收起侧边栏","sidebar.action.expand":"展开侧边栏","sidebar.navigationAria":"任务导航","sidebar.action.newTask":"新建任务","sidebar.action.newTaskShort":"新建任务","sidebar.action.terminal":"终端","sidebar.action.terminalToggle":"切换终端","sidebar.action.searchTasks":"搜索任务","sidebar.unreadTasks":"{count} 个未读任务","sidebar.section.skills":"技能","sidebar.section.mcp":"MCP","sidebar.section.settings":"设置","sidebar.status.user":"用户","sidebar.status.feedLive":"任务通道已连接","sidebar.status.feedOffline":"任务通道未连接","sidebar.empty.title":"暂无任务","sidebar.empty.hint":"在主页派发新任务","sidebar.group.running":"进行中","sidebar.group.queued":"排队中","sidebar.group.interrupted":"已暂停","sidebar.group.failed":"已失败","sidebar.group.cancelled":"已取消","sidebar.group.done":"已完成","sidebar.group.showMore":"再显示 {count} 条","sidebar.group.showLess":"收起","sidebar.view.project":"项目","sidebar.view.status":"状态","sidebar.view.projectAria":"按项目分组会话","sidebar.view.statusAria":"按状态分组会话","sidebar.project.active":"当前","sidebar.project.expand":"展开 {name}","sidebar.project.collapse":"收起 {name}","sidebar.project.newTask":"在 {name} 中新建任务","sidebar.project.reorder":"调整 {name} 的顺序,当前位置 {position}/{count}","sidebar.project.reorderHint":"拖拽调整顺序,或使用上下方向键移动","sidebar.project.reordered":"已将 {name} 移到第 {position} 位","sidebar.project.projects":"项目","sidebar.catalog.syncing":"正在同步任务历史…","sidebar.catalog.loaded":"已载入 {count} 条","sidebar.catalog.incomplete":"任务历史未完整加载","sidebar.catalog.retry":"重试","projects.dialog.title":"项目","projects.dialog.description":"绑定本地目录,无需重启 Blade 即可切换任务上下文。","projects.bind.placeholder":"/项目的绝对路径","projects.bind.pathLabel":"项目路径","projects.bind.action":"绑定","projects.bind.failed":"项目绑定失败","projects.pick.action":"选择项目文件夹","projects.pick.actionShort":"选择","projects.pick.picking":"选择中…","projects.pick.failed":"无法选择项目文件夹","projects.unbind.action":"解除项目绑定","projects.unavailable":"目录不可用","sidebar.language.label":"语言","sidebar.language.aria":"切换语言","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"独立分支","session.env.local":"本地","session.action.select":"选择「{title}」","session.action.save":"保存「{title}」","session.action.cancel":"取消「{title}」","session.action.more":"「{title}」的更多操作","session.action.fork":"派生「{title}」","session.action.forkShort":"派生","session.action.rename":"重命名「{title}」","session.action.renameShort":"重命名","session.action.archive":"归档「{title}」","session.action.archiveShort":"归档","session.action.export":"将「{title}」导出为 Markdown","session.action.exportShort":"导出 Markdown","session.action.exportingShort":"正在导出…","session.action.delete":"删除「{title}」","session.action.deleteShort":"删除","session.action.stop":"停止「{title}」","session.action.stopping":"正在停止「{title}」","session.action.retry":"重试「{title}」","session.action.retrying":"正在重试「{title}」","session.reason.cancelledByUser":"已由用户取消","session.title.codeReview":"代码评审","session.forkedFrom":"派生自","session.retriedFrom":"重试自","session.retryShort":"重试","session.queued":"排队 #{position}/{depth}","archive.title":"归档","archive.subtitle":"安全保留,不占用当前任务列表","archive.open":"打开会话归档","archive.refresh":"刷新归档会话","archive.retry":"重试","archive.loading":"正在载入归档…","archive.empty":"暂无归档会话","archive.restore":"恢复「{title}」","archive.restoreShort":"恢复","archive.restoreAncestor":"请先恢复归档根会话","archive.inherited":"随 {id} 一同归档","taskSwitcher.title":"任务切换器","taskSwitcher.description":"跨项目搜索并打开任务。","taskSwitcher.searchAria":"搜索任务","taskSwitcher.placeholder":"搜索标题、项目、分支、状态或 Session ID…","taskSwitcher.results":"{count} 个结果","taskSwitcher.recent":"最近任务","taskSwitcher.scope":"已索引 {count} 个任务","taskSwitcher.indexing":"正在索引任务…","taskSwitcher.resultsAria":"任务搜索结果","taskSwitcher.current":"当前","taskSwitcher.unread":"{count} 个未读","taskSwitcher.needsAction":"{count} 个需要操作","taskSwitcher.new":"新","taskSwitcher.empty":"没有匹配的任务","taskSwitcher.emptyHint":"尝试项目、分支、状态或更短的关键词。","taskSwitcher.hint.navigate":"选择","taskSwitcher.hint.open":"打开","taskSwitcher.hint.toggle":"切换","taskSwitcher.action.failed":"任务操作失败","commandCenter.title":"命令中心","commandCenter.description":"搜索任务,或执行工作区与应用操作。","commandCenter.searchAria":"搜索操作","commandCenter.placeholder":"搜索操作、设置或工具…","commandCenter.modeAria":"命令中心模式","commandCenter.mode.tasks":"任务","commandCenter.mode.commands":"操作","commandCenter.actions":"{count} 个操作","commandCenter.resultsAria":"操作搜索结果","commandCenter.empty":"没有匹配的操作","commandCenter.emptyHint":"尝试工具、面板或设置名称。","commandCenter.action.newTask":"新建任务","commandCenter.action.newTaskDescription":"打开一个干净的任务编辑器","commandCenter.action.preview":"切换预览区","commandCenter.action.previewDescription":"审查文件、Diff 与运行日志","commandCenter.action.terminal":"切换终端","commandCenter.action.terminalDescription":"打开或关闭工作区 Shell","commandCenter.action.settings":"打开设置","commandCenter.action.settingsDescription":"配置外观与行为","commandCenter.action.models":"配置模型","commandCenter.action.modelsDescription":"选择 Provider 与任务模型","commandCenter.action.shortcuts":"查看键盘快捷键","commandCenter.action.shortcutsDescription":"浏览全局与上下文按键","commandCenter.action.skills":"管理 Skills","commandCenter.action.skillsDescription":"发现并配置 Agent 能力","commandCenter.action.mcp":"管理 MCP Server","commandCenter.action.mcpDescription":"配置已连接的工具与服务","commandCenter.action.sidebar":"切换侧边栏","commandCenter.action.sidebarDescription":"显示或隐藏项目导航","taskHome.eyebrow":"任务调度台 · 就绪","taskHome.feed.connecting":"任务调度台 · 正在连接","taskHome.feed.reconnecting":"任务调度台 · 正在重连","taskHome.feed.offline":"任务调度台 · 已离线","taskHome.feed.offlineDescription":"实时任务更新已暂停,服务端正在运行的任务不会停止。","taskHome.feed.retry":"重新连接","taskHome.hero.prefix":"要在这里让 Blade 做点什么:","taskHome.hero.projectFallback":"当前工作区","taskHome.hero.subtitle":"派发一个任务后即可继续手头的工作。每个任务在独立的 worktree 中运行、状态持久保存,完成时会以可复核的工作区形式返回。","taskHome.templates.title":"模板","taskHome.templates.hint":"按 1–4 快速填充","taskHome.template.explore.title":"探索","taskHome.template.explore.description":"追踪行为,梳理系统全貌","taskHome.template.explore.hint":"调用链 · 模块结构","taskHome.template.build.title":"开发","taskHome.template.build.description":"实现一个可上线的功能","taskHome.template.build.hint":"端到端交付特性","taskHome.template.review.title":"评审","taskHome.template.review.description":"找出正确性与回归风险","taskHome.template.review.hint":"审查当前改动","taskHome.review.attachmentsUnsupported":"代码评审不支持附件","taskHome.review.outputSchemaUnsupported":"代码评审使用内置结构化报告 Schema","taskHome.review.usage":"用法:/review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"只读代码评审正在进行","taskHome.review.stale":"评审期间目标已发生变化","taskHome.review.aborted":"代码评审已中止","taskHome.review.interrupted":"代码评审因进程重启而中断","taskHome.review.failed":"代码评审失败","taskHome.review.startFailed":"启动代码评审失败","taskHome.review.invalidTarget":"评审目标无效或没有可评审的改动","taskHome.review.conflict":"当前会话已有任务正在运行","taskHome.template.fix.title":"修复","taskHome.template.fix.description":"定位并修好一个具体故障","taskHome.template.fix.hint":"二分 · 复现 · 打补丁","taskHome.context.isolationToggleTitle":"切换任务隔离方式","taskHome.context.projectSelect":"选择目标项目","taskHome.context.isolation.worktree":"独立 worktree","taskHome.context.isolation.local":"本地工作区","taskHome.context.branchFallback":"无分支","taskHome.context.preparing":"正在准备 worktree","taskHome.setup.aria":"任务准备状态","taskHome.setup.title":"完成准备","taskHome.setup.description":"你可以继续编辑草稿,Blade 正在核对工作区和模型。","taskHome.setup.workspace.title":"工作区","taskHome.setup.workspace.loading":"正在检查可用工作区…","taskHome.setup.workspace.ready":"已选择 {project}","taskHome.setup.workspace.required":"选择一个可用项目","taskHome.setup.workspace.empty":"无项目","taskHome.setup.workspace.action":"选择","taskHome.setup.workspace.retry":"重新加载工作区","taskHome.setup.model.title":"模型","taskHome.setup.model.loading":"正在检查配置…","taskHome.setup.model.ready":"可用于当前任务","taskHome.setup.model.required":"配置或选择一个模型","taskHome.setup.model.action":"配置","taskHome.setup.model.retry":"重试","taskHome.composer.placeholder":"描述目标、约束以及你期望的验收方式……","taskHome.error.dismiss":"关闭","taskHome.recent.title":"最近任务","taskHome.recent.total":"共 {count} 条","taskHome.recent.partial":"已载入 {count} 条 · 继续同步","taskHome.recent.incomplete":"已载入 {count} 条 · 历史不完整","taskSwitcher.indexingLoaded":"已载入 {count} 条 · 正在同步历史","taskHome.footer.note":"独立 worktree 让并行任务不会干扰你当前的工作副本","capacity.title":"{inFlight} 进行中 · {queued} 排队 · 上限 {max}","capacity.suffix.running":" 进行中","capacity.queued":"排队 {queued}","recent.status.running":"进行中","recent.status.queued":"排队中","recent.status.paused":"已暂停","recent.status.failed":"已失败","recent.status.cancelled":"已取消","recent.status.done":"已完成","recent.time.justNow":"刚刚","recent.time.minutes":"{n} 分钟前","recent.time.hours":"{n} 小时前","recent.time.days":"{n} 天前","recent.session.fallbackShort":"会话 {id}","recent.session.fallbackDated":"会话 {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} 个未读任务更新","attention.notification.completed":"任务已完成","attention.notification.failed":"任务失败","attention.notification.interrupted":"任务已中断","attention.notification.permission":"需要审批","attention.notification.question":"需要回答","attention.notification.elicitation":"MCP 需要输入","interaction.permission.title":"需要授权:{tool}","interaction.permission.once":"仅本次允许","interaction.permission.session":"本会话允许","interaction.permission.project":"本项目允许","interaction.permission.deny":"拒绝","interaction.permission.failed":"授权响应失败","interaction.question.answered":"问题已回答","interaction.question.other":"其他","interaction.question.submit":"提交回答","interaction.question.failed":"回答提交失败","interaction.elicitation.title":"MCP 请求输入","interaction.elicitation.submit":"提交给 MCP","interaction.elicitation.open":"打开外部链接","interaction.elicitation.decline":"拒绝","interaction.elicitation.cancel":"取消","interaction.elicitation.responded":"已响应 MCP 请求","interaction.elicitation.cancelled":"MCP 请求已取消","interaction.elicitation.failed":"响应 MCP 请求失败","interaction.elicitation.warning":"仅在信任该 MCP 服务器并理解请求用途时继续。","interaction.bar.permissionTitle":"Agent 正在等待审批","interaction.bar.permissionHint":"请检查待处理的工具请求,审批后任务才会继续。","interaction.bar.questionTitle":"Agent 正在等待回答","interaction.bar.questionHint":"请回答待处理的问题,任务才能继续。","interaction.bar.elicitationTitle":"MCP 服务器正在等待输入","interaction.bar.elicitationHint":"请检查 MCP 请求,响应后任务才会继续。","interaction.bar.review":"查看请求","interaction.badge.permission":"需要审批","interaction.badge.question":"需要回答","interaction.badge.elicitation":"MCP 输入","artifact.env.isolated":"独立分支","artifact.env.local":"本地","artifact.review":"查看变更","artifact.commits":"{count} 次提交","artifact.apply":"应用","artifact.retryApply":"重新应用","artifact.applying":"应用中","artifact.applied":"已应用","artifact.discard":"丢弃任务变更","artifact.discarded":"已丢弃","artifact.conflict":"任务变更无法安全应用。","artifact.conflictHint":"隔离变更已保留。请查看变更、处理源项目状态,然后重试或丢弃。","artifact.discardDialog.title":"丢弃隔离变更?","artifact.discardDialog.description":"将删除 {project} 隔离任务工作区中的 {count} 个变更文件。","artifact.discardDialog.warning":"此操作会永久删除任务 worktree 和分支,不会修改源项目。","artifact.discardDialog.cancel":"保留变更","artifact.discardDialog.confirm":"丢弃变更","chat.list.empty.eyebrow":"Blade · 就绪","chat.list.empty.title":"发送一条消息开始对话","chat.list.empty.hint":"提问、描述改动,或者粘贴一段错误堆栈。","chat.list.loading.eyebrow":"历史对话","chat.list.loading.title":"正在恢复对话…","chat.list.loading.hint":"正在加载消息、任务状态和实时更新。对话较长时可能需要一点时间。","chat.list.showEarlier":"显示更早的 {count} 条消息","chat.list.showEarlierWithRemaining":"显示更早的 {count} 条消息,当前隐藏 {remaining} 条","chat.list.jumpLatest":"回到最新消息","chat.turns.aria":"跳转到之前的消息","chat.turns.label":"第 {n} 轮","chat.timeline.thinking":"思考过程","chat.timeline.tools.runningOne":"正在执行 1 条命令","chat.timeline.tools.running":"正在执行 {count} 条命令","chat.timeline.tools.completedOne":"已执行 1 条命令","chat.timeline.tools.completed":"已执行 {count} 条命令","chat.timeline.tools.completedOneWithError":"已执行 1 条命令 · 执行失败","chat.timeline.tools.completedWithErrors":"已执行 {count} 条命令 · {errors} 条失败","chat.error.dismiss":"关闭错误","chat.error.queueFull":"指令队列已满。请等待已有指令开始执行后重试。","chat.error.turnChanged":"当前轮次已发生变化,此消息尚未接收。请确认内容后重试。","chat.error.title.submission":"消息未发送。","chat.error.title.execution":"本轮运行已停止。","chat.error.title.navigation":"未能打开任务。","chat.error.title.generic":"操作失败。","chat.error.action.returnDraft":"返回草稿","chat.error.action.editResend":"编辑后重发","chat.error.action.retryTask":"重试任务","chat.error.action.retryingTask":"正在重试…","chat.error.action.checkModels":"检查模型设置","task.failure.authentication":"模型服务认证失败,请检查模型凭据。","task.failure.permission":"模型服务拒绝了请求,请检查账号和模型权限。","task.failure.rateLimit":"模型服务达到速率或额度限制。","task.failure.timeout":"模型服务请求超时。","task.failure.network":"无法连接模型服务。","task.failure.modelUnavailable":"当前选择的模型不可用。","task.failure.contextLimit":"请求超出模型上下文限制。","task.failure.unsupportedInput":"当前模型不支持此类输入。","task.failure.runtime":"Agent 运行失败。","chat.connection.reconnecting":"正在恢复实时更新,当前任务仍在后台继续运行。","chat.connection.offline":"实时更新已离线,当前显示的进度可能已经过期。","chat.connection.retry":"重新连接","chat.footer.disclaimer":"Blade 可能会出错,请核对重要信息。","chat.input.placeholder.default":"输入 @ 提及文件,/ 触发命令……","chat.input.placeholder.steering":"添加指令来引导当前轮次……","chat.input.steering.status":"当前轮次可被引导","chat.input.steering.queued":"引导指令已接收 · 待处理 {count} 条","chat.input.steering.enterHint":" · 回车下发指令","chat.input.followUp.queued":"后续指令已接收 · 下一轮排队 {count} 条","chat.input.steering.recoveredOne":"重启后已恢复 {count} 条排队指令","chat.input.steering.recoveredMany":"重启后已恢复 {count} 条排队指令","chat.input.attachment.add":"添加图片","chat.input.attachment.remove":"移除","chat.input.attachment.countLimit":"最多可添加 {count} 张图片。","chat.input.attachment.sizeLimit":"图片编码后总大小不能超过 {size},请移除图片或选择更小的文件。","chat.input.attachment.readFailed":"Blade 无法读取其中一张图片。","chat.input.attachment.usage":"{count}/{limit} 张图片 · 已用 {used} / {budget}","chat.input.attachment.modelUnsupported":"{model} 不支持图片输入,请选择视觉模型或移除图片。","chat.input.attachment.modelRequired":"请先选择支持图片输入的视觉模型。","chat.input.model.placeholder":"选择模型","chat.input.model.empty":"未配置模型","chat.input.model.vision":"视觉","chat.input.model.change":"切换模型","chat.input.model.locked":"请等待当前轮次结束后再切换模型","chat.input.effort.label":"推理 {effort}","chat.input.effort.heading":"推理强度","chat.input.effort.change":"切换推理强度","chat.input.effort.locked":"请等待当前轮次结束后再切换推理强度","chat.input.effort.option":"使用 {effort} 推理强度","chat.input.effort.autoHint":"接近 high","chat.input.serviceTier.label":"速度 {tier}","chat.input.serviceTier.heading":"Provider 服务等级","chat.input.serviceTier.change":"切换 Provider 服务等级","chat.input.serviceTier.locked":"请等待当前轮次结束后再切换服务等级","chat.input.serviceTier.option":"使用 {tier} 服务等级","chat.input.serviceTier.fastHint":"优先通道","chat.input.serviceTier.flexHint":"低成本","chat.input.responseVerbosity.label":"输出 {verbosity}","chat.input.responseVerbosity.heading":"响应详略","chat.input.responseVerbosity.change":"切换响应详略","chat.input.responseVerbosity.locked":"请等待当前轮次结束后再切换响应详略","chat.input.responseVerbosity.option":"使用 {verbosity} 响应详略","chat.input.responseVerbosity.autoHint":"模型默认","chat.input.outputSchema.title":"结构化输出","chat.input.outputSchema.description":"要求本轮最终返回符合该 JSON Schema 的对象。","chat.input.outputSchema.change":"设置结构化输出 Schema","chat.input.outputSchema.locked":"请等待当前轮次结束后再修改输出 Schema","chat.input.outputSchema.editor":"JSON Schema 编辑器","chat.input.outputSchema.placeholder":"粘贴 JSON Schema 对象","chat.input.outputSchema.example":"使用示例","chat.input.outputSchema.clear":"清除","chat.input.outputSchema.invalid":"请输入有效的 JSON 对象;完整 Schema 将由服务端校验。","chat.input.outputSchema.shellUnsupported":"结构化输出不能与 Shell 命令同时使用。","chat.structuredOutput.title":"结构化输出","chat.structuredOutput.copy":"复制结构化输出","chat.input.communicationStyle.label":"风格 {style}","chat.input.communicationStyle.heading":"沟通风格","chat.input.communicationStyle.change":"切换沟通风格","chat.input.communicationStyle.locked":"请等待当前轮次结束后再切换沟通风格","chat.input.communicationStyle.option":"使用 {style} 沟通风格","chat.input.communicationStyle.autoHint":"Blade 默认","chat.input.communicationStyle.pragmaticHint":"直接","chat.input.communicationStyle.friendlyHint":"协作","chat.input.communicationStyle.explanatoryHint":"解释取舍","chat.notice.dismiss":"关闭提示","chat.input.mode.default":"手动审批","chat.input.mode.default.desc":"每个重要操作都需要你的批准","chat.input.mode.autoEdit":"自动审批","chat.input.mode.autoEdit.desc":"让 AI 审核并批准重要操作","chat.input.mode.yolo":"完全访问","chat.input.mode.yolo.desc":"无需询问,直接在你的电脑上运行","chat.input.mode.yolo.confirm.title":"启用完全访问模式?","chat.input.mode.yolo.confirm.desc":"在此模式下,Agent 将直接执行所有操作(包括文件写入、Shell 命令和网络请求)而不请求许可。仅在你信任当前上下文时启用。","chat.input.mode.yolo.confirm.cancel":"取消","chat.input.mode.yolo.confirm.accept":"启用","chat.input.mode.plan":"计划","chat.input.mode.plan.desc":"先拟定计划,暂不做任何改动","chat.input.mode.aria":"Agent 操作审批","chat.input.action.stop":"停止当前轮次","chat.input.action.stopping":"正在停止当前轮次","chat.input.action.steer":"引导当前轮次","chat.input.action.send":"发送消息","chat.input.action.submitting":"正在提交消息","chat.review.title":"代码评审","chat.review.target":"目标","chat.review.target.uncommitted":"未提交改动","chat.review.target.base":"相对 {ref} 的改动","chat.review.target.commit":"提交 {ref}","chat.review.status":"状态","chat.review.status.completed":"已完成","chat.review.status.stale":"已过期","chat.review.status.failed":"失败","chat.review.status.aborted":"已中止","chat.review.status.interrupted":"已中断","chat.review.findings":"问题","chat.review.noFindings":"未发现可执行问题","chat.review.confidence":"置信度 {value}","chat.review.error":"错误","chat.subagent.resumedFromTitle":"从 {id} 恢复","chat.subagent.resumedDepth":"已恢复 · 层级 {depth}","chat.subagent.loadingLogs":"正在加载子智能体日志…","chat.subagent.resumedAs":"已恢复为 {id} · {status} · 层级 {depth}","chat.subagent.resume":"恢复","chat.subagent.resumeAria":"恢复子智能体","chat.subagent.followUpAria":"子智能体后续指令","chat.subagent.followUpPlaceholder":"描述需要继续处理的工作","chat.subagent.cancel":"取消","chat.subagent.resumeAgent":"恢复智能体","chat.subagent.resumeFailed":"恢复子智能体失败","chat.markdown.copyCode":"复制代码","chat.rewind.title":"回溯会话","chat.rewind.description":"返回到某条用户消息之前的节点。","chat.rewind.loading":"正在加载检查点","chat.rewind.empty":"暂无可回溯的检查点","chat.rewind.checkpointAria":"回溯检查点","chat.rewind.userMessage":"用户消息","chat.rewind.fileCountOne":"{count} 个文件","chat.rewind.fileCountMany":"{count} 个文件","chat.rewind.restoreCode":"恢复代码变更","chat.rewind.restoreCodeHint":"回滚此检查点及之后更改的文件。","chat.rewind.cancel":"取消","chat.rewind.confirm":"回溯","chat.rewind.loadFailed":"加载回溯检查点失败","chat.rewind.failed":"回溯失败。请检查会话错误后重试。","status.context":"上下文","status.tokenLimitTooltip":"此为估算的 token 上限,模型回报上下文尺寸后会自动更新。","status.phase.running":"生成中…","status.phase.compacting":"正在压缩上下文…","status.phase.switchingModel":"正在切换模型…","status.phase.waitingPermission":"等待授权…","status.phase.error":"运行失败","preview.title":"预览","preview.action.resize":"调整预览区宽度","preview.action.close":"关闭预览区","preview.action.retry":"重试","preview.tab.diff":"变更","preview.tab.files":"文件","preview.tab.logs":"日志","preview.diff.loadingTitle":"正在加载任务变更…","preview.diff.loadingHint":"正在读取持久化的 worktree 产物。","preview.diff.failedTitle":"任务变更加载失败","preview.diff.discardedTitle":"变更已丢弃","preview.diff.discardedHint":"隔离工作区已删除,源项目没有被修改。","preview.diff.emptyTitle":"暂无变更","preview.diff.emptyHint":"工具修改文件后,变更会显示在这里。","preview.diff.searchAria":"搜索变更文件","preview.diff.searchPlaceholder":"筛选变更文件…","preview.diff.changedFiles":"{count} 个变更文件","preview.diff.expandAll":"全部展开","preview.diff.collapseAll":"全部收起","preview.diff.showMoreFiles":"再显示 {count} 个文件","preview.diff.showMoreLines":"再显示 {count} 行","preview.diff.noMatches":"没有匹配的变更文件","preview.diff.patch":"补丁","preview.diff.line":"第 {line} 行","preview.files.loadingTitle":"正在加载文件…","preview.files.loadingHint":"正在获取工作区文件树。","preview.files.failedTitle":"文件加载失败","preview.files.emptyTitle":"暂无文件","preview.files.emptyHint":"选择项目后即可加载工作区文件树。","preview.files.treeFailed":"工作区文件树加载失败","preview.files.searchAria":"搜索工作区文件","preview.files.searchPlaceholder":"查找文件…","preview.files.searchResultsAria":"文件搜索结果","preview.files.searchFailed":"工作区文件搜索失败","preview.files.noMatches":"没有匹配的文件","preview.files.directoryLoading":"正在加载目录…","preview.files.directoryEmpty":"空目录","preview.files.selectTitle":"选择要预览的文件","preview.files.status.loading":"加载中…","preview.files.status.truncated":"已截断","preview.files.status.ready":"就绪","preview.files.truncatedNotice":"预览内容已截断至 20 万字符。","preview.files.pickHint":"从文件树中选择一个文件进行预览。","preview.files.contentFailed":"文件加载失败","preview.files.editorLoading":"正在加载编辑器…","preview.logs.searchAria":"搜索工具日志","preview.logs.searchPlaceholder":"搜索工具、摘要或输出…","preview.logs.filterAria":"按状态筛选日志","preview.logs.filter.all":"全部","preview.logs.filter.running":"进行中","preview.logs.filter.error":"失败","preview.logs.filter.success":"成功","preview.logs.noMatches":"没有匹配的日志","preview.logs.noMatchesHint":"尝试其他关键词或状态。","preview.logs.emptyTitle":"暂无日志","preview.logs.emptyHint":"工具运行记录会显示在这里。","preview.logs.expand":"展开","preview.logs.collapse":"收起","preview.logs.showMore":"再显示 {count} 条日志","preview.logs.status.running":"进行中","preview.logs.status.error":"失败","preview.logs.status.success":"成功","goal.aria.section":"目标控制条","goal.status.active":"目标进行中","goal.status.paused":"目标已暂停","goal.status.blocked":"目标已阻塞","goal.status.usageLimited":"用量受限","goal.status.budgetLimited":"预算已达上限","goal.status.complete":"目标已完成","goal.field.objective":"目标描述","goal.action.edit":"编辑目标","goal.action.pause":"暂停目标","goal.action.resume":"恢复目标","goal.action.delete":"删除目标","goal.action.expand":"展开目标详情","goal.action.collapse":"收起目标详情","goal.action.cancel":"取消","goal.action.save":"保存","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"续跑 {n} 次","goal.metrics.continuationMany":"续跑 {n} 次","goal.dialog.title":"删除此目标?","goal.dialog.description":"仅移除目标状态,会话历史与工作区文件不会受影响。","settings.title":"设置","settings.nav.aria":"设置分区","settings.action.back":"返回","settings.category.settings":"设置","settings.category.integrations":"集成","settings.tab.general":"通用","settings.tab.trust":"安全","settings.tab.models":"模型","settings.tab.shortcuts":"快捷键","settings.tab.mcp":"MCP","settings.tab.skills":"技能","settings.tab.plugins":"插件","settings.tab.hooks":"钩子","settings.tab.schedules":"定时任务","settings.common.retry":"重试","settings.common.dismiss":"忽略","settings.common.cancel":"取消","settings.common.enable":"启用","settings.general.loading":"正在加载设置…","settings.general.loadError":"加载设置失败","settings.general.saveError":"保存设置失败","settings.general.responseLanguage":"回复语言","settings.general.responseLanguageHint":"AI 将使用该语言回复","settings.general.autoSave":"自动保存会话","settings.general.communicationStyle":"沟通风格","settings.general.communicationStyleHint":"决定 Agent 在所有会话中的回复措辞","settings.appearance.heading":"外观","settings.appearance.theme":"主题偏好","settings.appearance.theme.dark":"深色","settings.appearance.theme.light":"浅色","settings.appearance.theme.system":"跟随系统","settings.appearance.compactSidebar":"紧凑侧边栏","settings.appearance.codeTheme":"代码主题","settings.appearance.codeThemeHint":"语法高亮配色","settings.notifications.heading":"通知","settings.notifications.buildFinished":"构建完成","settings.notifications.errorsOnly":"仅错误","settings.notifications.systemSounds":"系统提示音","settings.notifications.blocked":"浏览器通知已被拦截","settings.notifications.unavailable":"当前浏览器不支持通知","settings.notifications.enablePrompt":"在此标签页处于后台时接收提醒","settings.privacy.heading":"隐私","settings.privacy.telemetry":"遥测","settings.privacy.crash":"崩溃报告","settings.models.description":"为不同的服务商配置 API Key 与模型设置。","settings.models.loading":"正在加载模型…","settings.models.loadChannelsFailed":"加载服务商渠道失败","settings.models.saveFailed":"保存模型失败","settings.models.deleteFailed":"删除模型失败","settings.models.updateFailed":"更新模型失败","settings.models.updateChannelFailed":"更新服务商渠道失败","settings.models.probeFailed":"服务商渠道探测失败","settings.models.deleteChannelFailed":"删除服务商渠道失败","settings.models.empty":"尚未配置任何模型","settings.models.add":"+ 添加新模型","settings.models.missingCredential":"缺少凭据","settings.models.configured":"已配置","settings.models.deleting":"正在删除…","settings.models.deleteModel":"删除模型","settings.models.deleteChannel":"删除渠道","settings.models.deleteModelAria":"删除 {name}","settings.models.deleteModelPrompt":"删除 {name} 及其保存的配置?","settings.models.deleteChannelAria":"删除渠道 {name}","settings.models.deleteChannelPrompt":"删除渠道 {name}、其凭据以及 {count} 个已配置模型?相关的兜底引用也会一并移除。","settings.models.editModelAria":"编辑 {name}","settings.models.editChannelAria":"编辑渠道 {name}","settings.models.testChannelAria":"测试 {name}","settings.models.deleteChannelActionAria":"删除渠道 {name}","settings.models.modelCountOne":"{count} 个模型","settings.models.modelCountMany":"{count} 个模型","settings.models.defaultEndpoint":"默认端点","settings.shortcuts.searchPlaceholder":"搜索操作…","settings.shortcuts.scope.all":"全部范围","settings.shortcuts.scope.global":"全局","settings.shortcuts.scope.chat":"聊天","settings.shortcuts.scope.layout":"布局","settings.shortcuts.reset":"重置","settings.shortcuts.col.action":"操作","settings.shortcuts.col.shortcut":"快捷键","settings.shortcuts.col.scope":"范围","settings.shortcuts.empty":"未找到快捷键。","settings.shortcuts.action.searchTasks":"搜索任务","settings.shortcuts.action.openCommands":"打开命令中心","settings.shortcuts.action.newTask":"新建任务","settings.shortcuts.action.focusComposer":"聚焦输入框","settings.shortcuts.action.toggleSidebar":"切换侧边栏","settings.common.reload":"重新加载","settings.trust.state.notRequired":"无需信任","settings.trust.state.trusted":"工作区已信任","settings.trust.state.review":"需要审查","settings.trust.state.error":"信任存储错误","settings.trust.selectSession":"选择一个项目会话以查看文件夹信任。","settings.trust.heading":"工作区信任","settings.trust.inheritedFrom":" · 继承自 {source}","settings.trust.reloadAria":"重新加载工作区信任","settings.trust.revoke":"撤销","settings.trust.trustWorkspace":"信任工作区","settings.trust.restartNotice":"重启 Blade 以重新加载项目模型、MCP、LSP、权限和插件。","settings.trust.revokeAria":"撤销工作区信任","settings.trust.confirmTrust":"允许 {count} 个项目来源配置模型、MCP、LSP、权限、环境、指令、命令、技能、Agent 或插件?","settings.trust.confirmRevoke":"重启后阻止项目控制的可执行配置?","settings.trust.saving":"正在保存…","settings.trust.trustReviewed":"信任已审查的工作区","settings.trust.revokeTrust":"撤销信任","settings.trust.empty":"未找到项目控制的可执行配置。","settings.trust.loadFailed":"加载工作区信任失败","settings.trust.updateFailed":"更新工作区信任失败","settings.hooks.state.disabled":"钩子已禁用","settings.hooks.state.notRequired":"无外部钩子","settings.hooks.state.review":"需要审查","settings.hooks.state.trusted":"已信任","settings.hooks.state.modified":"批准后已变更","settings.hooks.state.error":"信任存储错误","settings.hooks.selectSession":"选择一个项目会话以查看其钩子。","settings.hooks.heading":"钩子信任","settings.hooks.reloadAria":"重新加载钩子信任","settings.hooks.revoke":"撤销","settings.hooks.trustDigest":"信任摘要","settings.hooks.currentSession":"当前会话执行","settings.hooks.session.open":"打开一个会话以控制其钩子。","settings.hooks.session.loading":"正在加载会话状态…","settings.hooks.session.disabled":"已被工作区配置禁用。","settings.hooks.session.paused":"仅在此会话中暂停。","settings.hooks.session.active":"通过信任检查后,钩子可在此会话运行。","settings.hooks.session.unavailable":"已被当前会话 runtime 或宿主策略禁用。","settings.hooks.session.enableAria":"为当前会话启用钩子","settings.hooks.session.pauseAria":"为当前会话暂停钩子","settings.hooks.session.unavailableAria":"当前会话无法使用钩子","settings.hooks.confirmTrustAria":"信任项目钩子","settings.hooks.confirmRevokeAria":"撤销项目钩子信任","settings.hooks.confirmTrust":"以你的用户权限运行这 {count} 个钩子,直到它们的配置发生变更?","settings.hooks.confirmRevoke":"停止此项目所有已配置的钩子,直到再次显式信任?","settings.hooks.saving":"正在保存…","settings.hooks.trustReviewed":"信任已审查的钩子","settings.hooks.revokeTrust":"撤销信任","settings.hooks.empty":"没有已配置的命令、HTTP 或提示词钩子。","settings.hooks.loadFailed":"加载钩子信任失败","settings.hooks.updateFailed":"更新钩子信任失败","settings.hooks.sessionUpdateFailed":"更新会话钩子失败","settings.plugins.selectProject":"选择一个项目以管理其插件。","settings.plugins.heading":"工作区插件","settings.plugins.changesNote":"更改将在后续会话快照生效并持久化到所选层级。","settings.plugins.reloadAria":"重新加载插件","settings.plugins.sourcePolicy":"来源策略","settings.plugins.savePolicyAria":"保存插件来源策略","settings.plugins.saving":"正在保存…","settings.plugins.saveForProject":"保存到项目","settings.plugins.restrictAria":"限制插件来源","settings.plugins.restrictAllowlists":"限制为允许列表","settings.plugins.requireShaAria":"要求完整 Git commit SHA","settings.plugins.requireSha":"要求完整 Git SHA","settings.plugins.environmentLocked":" · 环境已锁定","settings.plugins.gitHostsAria":"允许的插件 Git 主机","settings.plugins.marketplacesAria":"允许的插件市场","settings.plugins.localRootsAria":"允许的本地插件根目录","settings.plugins.emptyAllowlists":"空的允许列表将拒绝所有插件来源。","settings.plugins.installHeading":"安装可信插件","settings.plugins.sourceAria":"插件来源","settings.plugins.install":"安装","settings.plugins.trustSource":"我信任此来源可激活钩子、MCP 服务器、技能和命令。","settings.plugins.activationScope":"激活写入范围","settings.plugins.activationScopeHint":"更高优先级的层级仍将决定最终生效状态。","settings.plugins.scopeAria":"插件激活范围","settings.plugins.scope.local":"本地","settings.plugins.scope.project":"项目","settings.plugins.scope.global":"全局","settings.plugins.scope.localDesc":"仅当前检出","settings.plugins.scope.projectDesc":"共享的项目设置","settings.plugins.scope.globalDesc":"所有项目","settings.plugins.scope.invocation":"本次调用","settings.plugins.scope.default":"默认","settings.plugins.layer.on":"开","settings.plugins.layer.off":"关","settings.plugins.capability.commands":"{count} 个命令","settings.plugins.capability.skills":"{count} 个技能","settings.plugins.capability.agents":"{count} 个 Agent","settings.plugins.capability.hooks":"{count} 个钩子","settings.plugins.capability.mcp":"{count} 个 MCP","settings.plugins.noResources":"未声明任何资源","settings.plugins.effective":"生效范围:{scope}","settings.plugins.managed":"托管","settings.plugins.invocationScoped":"通过 --plugin-dir 限定为调用级","settings.plugins.enableAria":"启用 {name}","settings.plugins.disableAria":"停用 {name}","settings.plugins.unavailableAria":"{name} 不可用","settings.plugins.updateAria":"更新 {name}","settings.plugins.uninstallAria":"卸载 {name}","settings.plugins.confirmUpdate":"确认更新","settings.plugins.update":"更新","settings.plugins.confirmRemove":"确认移除","settings.plugins.empty":"未发现此项目的任何插件。","settings.plugins.marketplaces":"市场","settings.plugins.configuredCount":"{count} 个已配置","settings.plugins.marketplaceSourceAria":"市场来源","settings.plugins.addMarketplaceAria":"添加市场","settings.plugins.add":"添加","settings.plugins.noDescription":"无描述","settings.plugins.refreshMarketplaceAria":"刷新市场 {name}","settings.plugins.removeMarketplaceAria":"移除市场 {name}","settings.plugins.confirm":"确认","settings.plugins.installedSuffix":" · 已安装","settings.plugins.marketplaceEmpty":"添加市场以发现可安装的插件。","settings.plugins.loadFailed":"加载插件失败","settings.plugins.actionFailed":"插件操作失败","settings.plugins.updateFailed":"更新插件失败","settings.models.addModal.title":"添加模型","settings.models.addModal.close":"关闭添加模型","settings.models.addModal.loadProvidersError":"加载服务商失败","settings.models.addModal.loadModelsError":"加载模型失败","settings.models.addModal.provider":"服务商","settings.models.addModal.loadingProviders":"正在加载服务商…","settings.models.addModal.selectProvider":"选择服务商","settings.models.addModal.configuredSuffix":" - 已配置","settings.models.addModal.customOpenAI":"自定义 OpenAI 端点","settings.models.addModal.customAnthropic":"自定义 Anthropic 端点","settings.models.addModal.channelId":"渠道 ID","settings.models.addModal.channelIdHint":"稳定的配置与凭据标识符。","settings.models.addModal.channelName":"渠道名称","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"使用 Anthropic Messages 协议。","settings.models.addModal.openaiProtocol":"使用 OpenAI Chat Completions 协议。","settings.models.addModal.modelId":"模型 ID","settings.models.addModal.model":"模型","settings.models.addModal.loadingModels":"正在加载模型…","settings.models.addModal.selectModel":"选择模型","settings.models.addModal.reasoningSuffix":" - 推理","settings.models.addModal.visionSuffix":" - 视觉","settings.models.addModal.displayName":"显示名称","settings.models.addModal.displayNamePlaceholder":"可选别名","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API Key","settings.models.addModal.apiKeyPlaceholder":"单独存储在 auth.json 中","settings.models.addModal.showApiKey":"显示 API Key","settings.models.addModal.hideApiKey":"隐藏 API Key","settings.models.addModal.oauthNote":"该服务商需要 OAuth 或环境凭据,请在选择模型前在外部完成配置。","settings.models.addModal.saveModel":"保存模型","settings.models.addModal.saving":"正在保存…","settings.models.addModal.channelIdError":'渠道 ID 必须以小写字母开头,且只能包含小写字母、数字、"."、"_" 或 "-"。',"settings.models.addModal.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editModal.srTitle":"编辑模型","settings.models.editModal.title":"编辑模型覆盖项","settings.models.editModal.close":"关闭编辑模型","settings.models.editModal.displayName":"显示名称","settings.models.editModal.replaceApiKey":"替换服务商 API Key","settings.models.editModal.replaceApiKeyPlaceholder":"留空则保留当前凭据","settings.models.editModal.baseUrlOverride":"Base URL 覆盖","settings.models.editModal.baseUrlPlaceholder":"留空则使用默认端点","settings.models.editModal.streamIdleTimeout":"流空闲超时(ms)","settings.models.editModal.save":"保存","settings.models.editModal.saving":"正在保存…","settings.models.editModal.streamIdleTimeoutError":"流空闲超时必须至少为 1000ms。","settings.models.editModal.credentialError":"更新服务商凭据失败","settings.models.editProvider.title":"编辑服务商渠道","settings.models.editProvider.close":"关闭编辑服务商","settings.models.editProvider.channelName":"渠道名称","settings.models.editProvider.channelNameRequired":"渠道名称不能为空","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"服务商 Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editProvider.apiKeyEnv":"API Key 环境变量","settings.models.editProvider.apiKeyEnvPlaceholder":"可选,例如 TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"替换 API Key","settings.models.editProvider.apiKeyAria":"服务商 API Key","settings.models.editProvider.apiKeyPlaceholder":"留空则保留当前凭据","settings.models.editProvider.save":"保存渠道","settings.models.editProvider.saving":"正在保存…","settings.style.auto":"自动","settings.style.pragmatic":"务实","settings.style.friendly":"友好","settings.style.explanatory":"解释型","mcp.status.connected":"已连接","mcp.status.connecting":"连接中...","mcp.status.reconnecting":"恢复中...","mcp.status.offline":"离线","mcp.status.error":"错误","mcp.status.recoveringAttempt":"恢复中 {attempt}/{max}","mcp.oauth.status.disabled":"未配置","mcp.oauth.status.unavailable":"当前运行时不可用","mcp.oauth.status.unauthenticated":"需要授权","mcp.oauth.status.authorizing":"等待授权...","mcp.oauth.status.authenticated":"已授权","mcp.oauth.status.error":"授权失败","mcp.catalog.tag.official":"官方","mcp.catalog.tag.popular":"热门","mcp.catalog.tag.community":"社区","mcp.action.refreshServers":"刷新 MCP 服务器","mcp.action.addServer":"添加服务器","mcp.action.close":"关闭 MCP","mcp.action.dismiss":"忽略","mcp.action.retry":"重试","mcp.action.disconnect":"断开连接","mcp.action.disconnecting":"断开中...","mcp.action.stopRecovery":"停止恢复","mcp.action.connect":"连接","mcp.action.connecting":"连接中...","mcp.action.authorizeFirst":"请先授权","mcp.action.delete":"删除","mcp.action.cancel":"取消","mcp.action.deleting":"删除中...","mcp.action.deleteServer":"删除服务器","mcp.tab.installed":"已安装 ({count})","mcp.tab.catalog":"目录","mcp.servers.title":"服务器","mcp.servers.searchAria":"搜索已安装的 MCP 服务器","mcp.servers.searchPlaceholder":"搜索服务器...","mcp.servers.loading":"正在加载服务器...","mcp.servers.noMatch":"没有匹配的服务器","mcp.servers.none":"尚未配置 MCP 服务器","mcp.server.errorLabel":"错误:{error}","mcp.server.deleteAria":"删除 {name}","mcp.server.selectPrompt":"选择一个服务器以查看详情","mcp.instructions.title":"服务器说明","mcp.instructions.detailsOmittedByPolicy":"[详情已根据运行时策略省略]","mcp.instructions.detailsOmitted":"详情已省略","mcp.instructions.truncated":"已截断至安全显示上限","mcp.tasks.title":"实验性 MCP 任务","mcp.tasks.summary":"每会话 {count} 个 · {interval}ms 轮询","mcp.tasks.disabledByDefault":"默认禁用","mcp.tasks.enabled":"已启用","mcp.tasks.disabled":"已禁用","mcp.oauth.signingOut":"登出中...","mcp.oauth.signOut":"登出","mcp.oauth.continueAuthorization":"继续授权","mcp.oauth.resumeAuthorization":"恢复授权","mcp.oauth.opening":"打开中...","mcp.oauth.authorize":"授权","mcp.delete.confirm":"移除此服务器及其已保存的配置?","mcp.tools.title":"工具 ({count})","mcp.tools.none":"暂无可用工具","mcp.completion.title":"参数补全","mcp.completion.connectPrompt":"连接服务器后即可请求补全建议","mcp.completion.unsupported":"该服务器未声明支持 MCP 补全","mcp.completion.noTargets":"没有可补全的提示词参数或模板变量","mcp.completion.targetAria":"MCP 补全目标","mcp.completion.partialAria":"MCP 补全的部分值","mcp.completion.partialPlaceholder":"部分值","mcp.completion.completing":"补全中...","mcp.completion.complete":"补全","mcp.completion.suggestionsAria":"MCP 补全建议","mcp.completion.empty":"[空]","mcp.completion.noSuggestions":"暂无建议","mcp.meta.truncatedSuffix":" · 已截断","mcp.meta.detailsOmittedSuffix":" · 详情已省略","mcp.diagnostics.title":"诊断","mcp.diagnostics.refreshAria":"刷新 {name} 的 MCP 日志","mcp.diagnostics.logsAria":"{name} 的 MCP 日志","mcp.log.levelAria":"MCP 日志级别","mcp.log.setting":"设置中...","mcp.log.loading":"正在加载日志...","mcp.log.none":"未捕获到日志","mcp.catalog.searchAria":"搜索 MCP 服务器目录","mcp.catalog.searchPlaceholder":"在 npm 上搜索 MCP 服务器(至少 3 个字符)...","mcp.catalog.retry":"重试加载目录","mcp.catalog.noDescription":"暂无描述","mcp.catalog.byAuthor":"作者 {author}","mcp.catalog.installed":"已安装","mcp.catalog.installing":"安装中...","mcp.catalog.install":"安装","mcp.catalog.noPackages":"未找到任何包","mcp.catalog.noMore":"没有更多包了","mcp.catalog.packagesFound":"找到 {count} 个包","mcp.catalog.browseGlama":"在 Glama 上浏览更多","mcp.error.connectFailed":"连接服务器失败","mcp.error.disconnectFailed":"断开服务器失败","mcp.error.deleteFailed":"删除服务器失败","mcp.error.loginFailed":"MCP OAuth 登录失败","mcp.error.logoutFailed":"MCP OAuth 登出失败","mcp.error.loggingLevelFailed":"设置 MCP 日志级别失败","mcp.error.completionFailed":"MCP 补全失败","mcp.add.title":"添加 MCP 服务器","mcp.add.closeAria":"关闭添加 MCP 服务器","mcp.add.modeForm":"表单","mcp.add.jsonConfig":"JSON 配置","mcp.add.jsonConfigAria":"JSON 配置","mcp.add.serverName":"服务器名称","mcp.add.command":"命令","mcp.add.commandAria":"服务器命令","mcp.add.argsLabel":"参数(空格分隔)","mcp.add.argsAria":"服务器参数","mcp.add.invalidJson":"请输入包含服务器名称和传输方式的有效 JSON。","mcp.add.nameCommandRequired":"名称和命令为必填项。","mcp.add.adding":"添加中...","mcp.add.submit":"添加服务器","mcp.install.title":"安装 MCP 服务器","mcp.install.titleWithName":"安装 {name}","mcp.install.closeAria":"关闭 MCP 安装","mcp.install.args":"参数","mcp.install.commandPreview":"命令:npx {args}","mcp.install.nameRequired":"服务器名称为必填项。","skills.title":"技能","skills.action.install":"安装技能","skills.action.installShort":"安装","skills.action.refreshAria":"刷新技能","skills.action.closeAria":"关闭技能","skills.action.dismiss":"忽略","skills.action.retry":"重试","skills.action.cancel":"取消","skills.action.close":"关闭","skills.action.hide":"隐藏","skills.action.enable":"启用","skills.action.disable":"禁用","skills.action.saving":"保存中…","skills.status.enabled":"已启用","skills.status.disabled":"已禁用","skills.status.installed":"已安装","skills.noDescriptionShort":"暂无描述","skills.noDescription":"暂无可用描述","skills.installed.title":"已安装","skills.installed.searchAria":"搜索已安装的技能","skills.installed.searchPlaceholder":"搜索技能…","skills.installed.loading":"正在加载技能…","skills.installed.noMatch":"没有匹配的技能","skills.installed.empty":"尚未安装任何技能","skills.uninstall.managedHint":"仅可卸载 Blade 用户技能","skills.uninstall.managed":"受管理","skills.uninstall.action":"卸载","skills.uninstall.confirmAria":"卸载 {name}","skills.uninstall.confirmPrompt":"从 ~/.blade/skills 中移除此技能?","skills.uninstall.inProgress":"正在卸载…","skills.uninstall.confirm":"卸载技能","skills.details.title":"详情","skills.details.provider":"提供方","skills.details.location":"位置","skills.details.capabilities":"能力","skills.details.allowedTools":"允许的工具({count})","skills.detail.emptyState":"选择一个技能以查看详情","skills.install.title":"安装技能","skills.install.closeAria":"关闭技能安装","skills.install.tab.catalog":"目录","skills.install.tab.repo":"仓库","skills.install.tab.local":"本地","skills.install.catalog.searchAria":"搜索技能目录","skills.install.catalog.searchPlaceholder":"搜索目录…","skills.install.catalog.loading":"正在加载目录…","skills.install.catalog.empty":"未找到技能","skills.install.catalog.byAuthor":"作者:{author}","skills.install.catalog.tag.official":"官方","skills.install.catalog.tag.popular":"热门","skills.install.catalog.tag.community":"社区","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"技能仓库地址","skills.install.repo.credentialsHint":"使用 Blade 进程可用的 Git 凭据","skills.install.local.label":"本地路径","skills.install.local.inputAria":"本地技能路径","skills.status.dialogTitle":"安装状态","skills.status.confirm.title":"确认安装","skills.status.confirm.prompt":"安装所选技能?","skills.status.installing.title":"正在安装","skills.status.installing.description":"正在下载并校验…","skills.status.failed.title":"安装失败","skills.status.failed.fallback":"安装失败。","skills.status.failed.hint":"请检查访问权限后重试。","skills.error.deleteFailed":"删除技能失败","skills.error.toggleFailed":"切换技能状态失败","skills.error.installFailed":"安装技能失败","schedule.title":"定时任务","schedule.description":"按 cron、间隔或一次性触发器自动运行无界面任务提示词。","schedule.new":"新建定时任务","schedule.newAria":"创建新的定时任务","schedule.refresh":"刷新","schedule.reloadAria":"重新加载定时任务","schedule.create":"创建","schedule.save":"保存","schedule.cancel":"取消","schedule.confirmDelete":"确认?","schedule.empty":"暂无定时任务","schedule.enabled":"已启用","schedule.disabled":"已禁用","schedule.never":"从未","schedule.nextRun":"下次运行","schedule.lastRun":"上次运行","schedule.runCount":"已运行 {count} 次","schedule.trigger.kindAria":"触发器类型","schedule.trigger.cron":"Cron","schedule.trigger.interval":"间隔","schedule.trigger.once":"一次性","schedule.field.title":"标题(可选)","schedule.field.cron":"Cron 表达式","schedule.field.interval":"间隔","schedule.field.runAt":"运行时间","schedule.field.prompt":"提示词","schedule.field.project":"项目路径","schedule.field.model":"模型(可选)","schedule.field.permissionMode":"权限模式","schedule.field.isolation":"隔离方式","schedule.placeholder.title":"每晚依赖审查","schedule.placeholder.cron":"0 9 * * 1 (分 时 日 月 周)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"描述要运行的任务…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"例如 anthropic/claude-sonnet","schedule.model.current":"使用当前模型","schedule.permission.default":"默认","schedule.permission.autoEdit":"自动编辑","schedule.permission.yolo":"Yolo","schedule.permission.plan":"规划","schedule.isolation.local":"本地","schedule.isolation.worktree":"工作树","schedule.cadence.cron":"cron:{expr}","schedule.cadence.interval":"每 {interval}","schedule.cadence.once":"于 {time} 运行一次","schedule.status.queued":"排队中","schedule.status.running":"运行中","schedule.status.completed":"已完成","schedule.status.failed":"失败","schedule.status.cancelled":"已取消","schedule.status.interrupted":"已中断","schedule.status.error":"出错","schedule.status.never":"尚未运行","schedule.runNowAria":"立即运行“{title}”","schedule.editAria":"编辑“{title}”","schedule.deleteAria":"删除“{title}”","schedule.enableAria":"启用“{title}”","schedule.disableAria":"禁用“{title}”","schedule.error.promptRequired":"提示词不能为空。","schedule.error.projectRequired":"项目路径不能为空。","schedule.error.cronRequired":"Cron 表达式不能为空。","schedule.error.invalidInterval":"请输入类似 30m、2h 或 1d 的间隔。","schedule.error.runAtRequired":"请选择有效的运行时间。","schedule.error.loadFailed":"加载定时任务失败。","schedule.error.createFailed":"创建定时任务失败。","schedule.error.updateFailed":"更新定时任务失败。","schedule.error.deleteFailed":"删除定时任务失败。","schedule.error.toggleFailed":"切换定时任务状态失败。","schedule.error.runFailed":"运行定时任务失败。"},k0=["en","zh"],Ya={en:h0,zh:b0},Zf="blade-ui-locale",al=typeof window<"u"&&typeof document<"u";function x0(){var e,t;if(al){try{const r=(e=window.localStorage)==null?void 0:e.getItem(Zf);if(r==="en"||r==="zh")return r}catch{}return(typeof navigator<"u"&&(navigator.language||((t=navigator.languages)==null?void 0:t[0]))||"").toLowerCase().startsWith("zh")?"zh":"en"}return"en"}let Es=x0();const hc=new Set;function y0(){for(const e of hc)e()}function S0(e){var t;if(e!==Es){if(Es=e,al){try{(t=window.localStorage)==null||t.setItem(Zf,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}y0()}}function em(e){return hc.add(e),()=>hc.delete(e)}function w0(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s==null?n:String(s)}):e}function He(e,t){const r=(Ya[Es]??Ya.en)[e]??Ya.en[e];return w0(r,t)}function Ft(){return w.useSyncExternalStore(em,()=>Es,()=>"en"),He}function v0(){return{locale:w.useSyncExternalStore(em,()=>Es,()=>"en"),setLocale:S0}}al&&(document!=null&&document.documentElement)&&(document.documentElement.lang=Es==="zh"?"zh-CN":"en");function gt(e,t){return{...e,...t}}function Br(e,t,n){return e>=t&&e<=n}function I0(e){return e===8205}function C0(e){return Br(e,55296,56319)}function Ou(e){return Br(e,127462,127487)}function tm(e){return Br(e,65024,65039)}function nm(e){return Br(e,768,879)||Br(e,6832,6911)||Br(e,7616,7679)||Br(e,65056,65071)}function Ci(e){return e>65535?2:1}function $u(e,t){for(;t<e.length;){const n=e.codePointAt(t);if(nm(n)||tm(n))t+=Ci(n);else break}return t}function cl(e,t){const n=e.codePointAt(t);let r=t+Ci(n);for(r=$u(e,r);r<e.length-1&&e[r]==="";){const s=e.codePointAt(r+1);r+=1+Ci(s),r=$u(e,r)}return Ou(n)&&r<e.length&&Ou(e.codePointAt(r))&&(r+=Ci(e.codePointAt(r))),r}function rm(e){return C0(e)||nm(e)||tm(e)||I0(e)}function j0(e){let t=0,n=0;for(;n<e.length;)n=cl(e,n),t++;return t}function T0(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=cl(e,r),n++,n>=t)return!0;return!1}function A0(e,t){let n=0,r=0;for(;r<e.length;)if(r=cl(e,r),n++,n>t)return!1;return!0}function E0(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(rm(e.charCodeAt(n)))return T0(e,t);if(n++,n>=t)return!0}return!1}function P0(e,t){let n=0;for(;n<e.length;){if(rm(e.charCodeAt(n)))return A0(e,t);if(n++,n>t)return!1}return!0}function H(e){return Array.isArray(e)}function tt(e){return h(typeof e,"bigint")}function ht(e){return h(typeof e,"boolean")}function ea(e){if($e(e)||!In(e))return!1;const t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function In(e){return h(typeof e,"function")}function ll(e){return Number.isInteger(e)}function Vt(e){return h(e,null)}function ye(e){return Number.isFinite(e)}function fn(e){return ne(e)&&!H(e)}function ne(e){return h(typeof e,"object")&&!Vt(e)}function ie(e){return h(typeof e,"string")}function dl(e){return h(typeof e,"symbol")}function $e(e){return h(e,void 0)}function h(e,t){return e===t}function Yr(e,t){return e>t}function Co(e,t){return e<t}function rr(e,t){return e<=t}function Ns(e,t){return e>=t}function sm(e,t){if(tt(e)||tt(t))return BigInt(e)%BigInt(t)===0n;const n=1e-10;if(!ye(e)||ll(e)&&1/t%1===0)return!0;const r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function om(e){if(!ne(e))return!1;const t=globalThis.Object.getPrototypeOf(e);return Vt(t)?!1:h(typeof t.constructor,"function")&&!(h(t.constructor,globalThis.Object)||h(t.constructor.name,"Object"))}function Os(e){return tt(e)||ht(e)||Vt(e)||ye(e)||ie(e)||$e(e)}function N0(e){return j0(e)}function im(e,t){return P0(e,t)}function am(e,t){return E0(e,t)}function dt(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function jt(e,t,n){let r=!0;for(let s=t;s<e.length;s++)n(e[s],s)||(r=!1);return r}function $s(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function cm(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function ul(e,t){return e.reduce((n,r,s)=>t(r,s)?++n:n,0)}function Ie(e,t,n){return h(e.length,0)?n():t(e[0],e.slice(1))}function Jn(e){return h(e,"__proto__")||h(e,"constructor")||h(e,"prototype")}function E(e,t){return Jn(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function fl(e){return D(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function nt(e){return Object.entries(e)}function D(e){return Object.getOwnPropertyNames(e)}function ml(e){return Object.getOwnPropertySymbols(e)}function pl(e){return Object.values(e)}function O0(e,t){if(!ne(t))return!1;const n=D(e);return h(n.length,D(t).length)&&n.every(r=>Xr(e[r],t[r]))}function $0(e,t){return H(t)&&h(e.length,t.length)&&e.every((n,r)=>Xr(e[r],t[r]))}function Xr(e,t){return H(e)?$0(e,t):ne(e)?O0(e,t):h(e,t)}const $i=Object.freeze(Object.defineProperty({__proto__:null,Counted:ul,Entries:nt,EntriesRegExp:fl,Every:dt,EveryAll:jt,GraphemeCount:N0,HasPropertyKey:E,IsArray:H,IsBigInt:tt,IsBoolean:ht,IsClassInstance:om,IsConstructor:ea,IsDeepEqual:Xr,IsEqual:h,IsFunction:In,IsGreaterEqualThan:Ns,IsGreaterThan:Yr,IsInteger:ll,IsLessEqualThan:rr,IsLessThan:Co,IsMaxLength:im,IsMinLength:am,IsMultipleOf:sm,IsNull:Vt,IsNumber:ye,IsObject:ne,IsObjectNotArray:fn,IsString:ie,IsSymbol:dl,IsUndefined:$e,IsUnsafePropertyKey:Jn,IsValueLike:Os,Keys:D,ShiftLeft:Ie,Some:$s,SomeAll:cm,Symbols:ml,Values:pl},Symbol.toStringTag,{value:"Module"})),R0=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function M0(e){return R0.test(e)}function wt(e,t){return`(${e} && ${t})`}function qe(e,t){return`(${e} || ${t})`}function Nt(e){return`!(${e})`}function Ri(e){return`Array.isArray(${e})`}function lm(e){return`typeof ${e} === "bigint"`}function F0(e){return`typeof ${e} === "boolean"`}function D0(e){return`Number.isInteger(${e})`}function _0(e){return`${e} === null`}function dm(e){return`Number.isFinite(${e})`}function um(e){return wt(fm(e),Nt(Ri(e)))}function fm(e){return`typeof ${e} === "object" && ${e} !== null`}function mm(e){return`typeof ${e} === "string"`}function L0(e){return`typeof ${e} === "symbol"`}function bc(e){return`${e} === undefined`}function U0(e){return`typeof ${e} === "function"`}function B0(e){return`Guard.IsConstructor(${e})`}function Gt(e,t){return`${e} === ${t}`}function pm(e,t){return`${e} > ${t}`}function gl(e,t){return`${e} < ${t}`}function Zr(e,t){return`${e} <= ${t}`}function jo(e,t){return`${e} >= ${t}`}function H0(e,t){return`Guard.IsMinLength(${e}, ${t})`}function q0(e,t){return`Guard.IsMaxLength(${e}, ${t})`}function Dn(e,t,n,r){return h(t,"0")?`${e}.every((${n[0]}, ${n[1]}) => ${r})`:`((value, callback) => { for(let index = ${t}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${e}, (${n[0]}, ${n[1]}) => ${r})`}function z0(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function K0(e,t,n){return`((value, callback) => { let result = false; for(let index = 0; index < value.length; index++) if (callback(value[index], index)) result = true; return result })(${e}, (${t[0]}, ${t[1]}) => ${n})`}function ta(e,t,n){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${n}) ? ++result : result, 0)`}function gm(e){return`Object.entries(${e})`}function es(e){return`Object.getOwnPropertyNames(${e})`}function Kr(e,t){return h(t,'"__proto__"')||h(t,'"constructor"')?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function hm(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function G0(e){return`[${e.join(", ")}]`}function xr(e,t){return`((${e.join(", ")}) => ${t})`}function Ke(e,t){return`${e}(${t.join(", ")})`}function hl(e,t){return`new ${e}(${t.join(", ")})`}function de(e,t){return`${e}${M0(t)?`.${t}`:`[${z(t)}]`}`}function z(e){if(!Os(e))throw Error("Unsupported Constant");return ie(e)?JSON.stringify(e):`${e}`}function V0(e,t,n){return`(${e} ? ${t} : ${n})`}function na(e){return`{ ${e.join("; ")}; }`}function Qn(e,t){return`const ${e} = ${t}`}function bm(e,t){return`if(${e}) { ${t} }`}function ra(e){return`return ${e}`}function It(e){return h(e.length,0)?"true":e.reduce((t,n)=>wt(t,n))}function bl(e){return h(e.length,0)?"false":e.reduce((t,n)=>qe(t,n))}function W0(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function J0(e){return e instanceof Boolean}function Q0(e){return e instanceof Number}function Y0(e){return e instanceof String}function To(e){return globalThis.ArrayBuffer.isView(e)}function km(e){return e instanceof globalThis.RegExp}function xm(e){return e instanceof globalThis.Date}function ym(e){return e instanceof globalThis.Set}function Sm(e){return e instanceof globalThis.Map}function X0(e){return E(e,"~kind")||E(e,"~unsafe")}function Z0(e){const t={},n=Object.getOwnPropertyDescriptors(e);for(const r of Object.keys(n)){if(Jn(r))continue;const s=n[r];E(s,"value")&&Object.defineProperty(t,r,{...s,value:Gr(s.value)})}return t}function ew(e){const t={};for(const n of D(e))Jn(n)||(t[n]=Gr(e[n]));for(const n of ml(e))t[n]=Gr(e[n]);return t}function tw(e){return om(e)?e:X0(e)?Z0(e):ew(e)}function nw(e){return e.map(t=>Gr(t))}function rw(e){return e.slice()}function sw(e){return new RegExp(e.source,e.flags)}function ow(e){return new Map(Gr([...e.entries()]))}function iw(e){return new Set(Gr([...e.values()]))}function Gr(e){return To(e)?rw(e):km(e)?sw(e):Sm(e)?ow(e):ym(e)?iw(e):H(e)?nw(e):ne(e)?tw(e):e}function kl(e){return Gr(e)}const aw={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ao(){return aw}function cw(e,t){for(const n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function lw(e,t){return{...e,...t}}function he(e,t,n={}){const r=lw(t,n);return cw(r,e)}function Pn(e,t){const n={},r=Object.getOwnPropertyDescriptors(kl(e)),s=new Set(t);for(const o of Object.keys(r))s.has(o)||Object.defineProperty(n,o,r[o]);return n}function ue(e,t,n){const r=Ao(),s=kl(e);for(const o of Object.keys(t))Object.defineProperty(s,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(const o of Object.keys(n))Object.defineProperty(s,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return s}function we(e,t){return ne(e)&&E(e,"~kind")&&h(e["~kind"],t)}function Yt(e){return ne(e)}function je(e,t,n){return he({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function Ts(e){return we(e,"Deferred")}function dw(e){return ue(e,{"~readonly":!0},{})}function xl(e,t){return ue(dw(e),{},t)}function uw(e,t,n,r){const s=G(e,t,n);return xl(s,r)}function fw(e){return ue(e,{"~optional":!0},{})}function yl(e,t){return ue(fw(e),{},t)}function mw(e,t,n,r){const s=G(e,t,n);return yl(s,r)}function Cr(e,t){return he({"~kind":"Array"},{type:"array",items:e},t)}function ut(e){return we(e,"Array")}function Sl(e){return Pn(e,["~kind","type","items"])}function Eo(e,t,n={}){return he({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function mn(e){return we(e,"Constructor")}function pw(e){return Pn(e,["~kind","type","parameters","instanceType"])}function Po(e,t,n={}){return he({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function pn(e){return we(e,"Function")}function gw(e){return Pn(e,["~kind","type","parameters","returnType"])}function dn(e,t){return he({"~kind":"Ref"},{$ref:e},t)}function kt(e){return we(e,"Ref")}function No(e,t){return he({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function wl(e){return we(e,"Generic")}function vl(e){return he({"~kind":"Any"},{},e)}function Nn(e){return we(e,"Any")}const hw="(?!)";function Tt(e){return he({"~kind":"Never"},{not:{}},e)}function Rs(e){return we(e,"Never")}function er(e,t={}){return je("AddOptional",[e],t)}function Mi(e,t={}){return yl(e,t)}function bw(e){return Mi(e)}function Xt(e){return Yt(e)&&E(e,"~optional")}function kw(e){return D(e).filter(t=>!Xt(e[t]))}function wm(e){return D(e)}function vm(e){return pl(e)}function Ae(e,t={}){const n=kw(e),r=n.length>0?{required:n}:{};return he({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Le(e){return we(e,"Object")}function xw(e){return Pn(e,["~kind","type","properties","required"])}function Bt(e){return he({"~kind":"Unknown"},{},e)}function Cn(e){return we(e,"Unknown")}function Oo(e,t,n){const r=D(e).reduce((s,o)=>({...s,[o]:ue(e[o],{},{$id:o})}),{});return he({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function Ht(e){return we(e,"Cyclic")}function yw(e){return ue(e,{"~unsafe":null},{})}function Im(e){return fn(e)&&E(e,"~unsafe")&&Vt(e["~unsafe"])}function ct(e,t){var n;return((n=t[e.length])==null?void 0:n.call(t,...e))??(()=>{throw Error("Invalid Arguments")})()}function kc(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s,s],1:r=>[r,Bt(),Bt()]});return he({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Zt(e){return we(e,"Infer")}function Fi(e,t,n,r={}){return he({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function gn(e){return we(e,"Dependent")}function Sw(e){return Pn(e,["~kind","if","then","else"])}function ww(e){return fn(e)}function vw(e){return D(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Iw(e){return ie(e)||ye(e)}function Cw(e,t){const n=ww(e)?vw(e):e;return he({"~kind":"Enum"},{enum:n},t)}function hn(e){return we(e,"Enum")}function Fn(e,t={}){return he({"~kind":"Intersect"},{allOf:e},t)}function Ue(e){return we(e,"Intersect")}function jw(e){return Pn(e,["~kind","allOf"])}let Xa;function Tw(){try{return jm("null")(),!0}catch{return!1}}function Cm(){return $e(Xa)&&(Xa=Tw()),Xa&&Ao().useAcceleration}function jm(...e){return new globalThis.Function(...e)}function Ot(){throw new Error("Unreachable")}function Aw(e){const t=new Set;let n=e;for(;n&&n!==Object.prototype;){for(const r of Reflect.ownKeys(n))r!=="constructor"&&typeof r!="symbol"&&t.add(r);n=Object.getPrototypeOf(n)}return[...t]}function Ew(e){return typeof e=="number"}var $t;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})($t||($t={}));let Is=BigInt("14695981039346656037");const[Pw,Nw]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Ow=Array.from({length:256}).map((e,t)=>BigInt(t)),Tm=new Float64Array(1),Am=new DataView(Tm.buffer),Em=new Uint8Array(Tm.buffer);function xt(e){Is=Is^Ow[e],Is=Is*Pw%Nw}function $w(e){xt($t.Array);for(const t of e)yr(t)}function Rw(e){xt($t.BigInt),Am.setBigInt64(0,e);for(const t of Em)xt(t)}function Ru(e){xt($t.Boolean),xt(e?1:0)}function Mw(e){xt($t.Constructor),yr(e.toString())}function Fw(e){xt($t.Date),yr(e.getTime())}function Dw(e){xt($t.Function),yr(e.toString())}function _w(e){xt($t.Null)}function Mu(e){xt($t.Number),Am.setFloat64(0,e,!0);for(const t of Em)xt(t)}function Lw(e){xt($t.Object);for(const t of Aw(e).sort())yr(t),yr(e[t])}function Uw(e){xt($t.RegExp),xc(e.toString())}const Bw=new TextEncoder;function xc(e){xt($t.String);for(const t of Bw.encode(e))xt(t)}function Hw(e){xt($t.Symbol),yr(e.toString())}function qw(e){xt($t.TypeArray);const t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)xt(t[n])}function zw(e){return xt($t.Undefined)}function yr(e){return To(e)?qw(e):xm(e)?Fw(e):km(e)?Uw(e):J0(e)?Ru(e.valueOf()):Y0(e)?xc(e.valueOf()):Q0(e)?Mu(e.valueOf()):Ew(e)?Mu(e):H(e)?$w(e):ht(e)?Ru(e):tt(e)?Rw(e):ea(e)?Mw(e):Vt(e)?_w():ne(e)?Lw(e):ie(e)?xc(e):dl(e)?Hw(e):$e(e)?zw():In(e)?Dw(e):Ot()}function Pm(e){return Is=BigInt("14695981039346656037"),yr(e),Is}function sa(e){return Pm(e).toString(16).padStart(16,"0")}const Kw=Object.freeze(Object.defineProperty({__proto__:null,Hash:sa,HashCode:Pm},Symbol.toStringTag,{value:"Module"}));function Gw(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}let Vw=Gw;function Ww(){return Vw}class Nm{constructor(t,n){this.type=t,this.decode=n}Encode(t){const n=this.type,r=en(n)?i=>this.decode(n["~codec"].decode(i)):this.decode,s=en(n)?i=>n["~codec"].encode(t(i)):t,o={decode:r,encode:s};return ue(this.type,{"~codec":o},{})}}class Om{constructor(t){this.type=t}Decode(t){return new Nm(this.type,t)}}function Il(e){return new Om(e)}function Jw(e,t){return Il(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Qw(e,t){return Il(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function en(e){return Yt(e)&&E(e,"~codec")&&ne(e["~codec"])&&E(e["~codec"],"encode")&&E(e["~codec"],"decode")}function Yw(e){return fd(e)}function Di(e){return Yt(e)&&E(e,"~immutable")}function tr(e,t={}){return je("AddReadonly",[e],t)}function _i(e,t={}){return xl(e,t)}function Xw(e){return _i(e)}function Li(e){return Yt(e)&&E(e,"~readonly")}function Zw(e,t){const n=Cl(e)?[...e["~refine"],t]:[t];return ue(e,{"~refine":n},{})}function ev(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,()=>"Refine Error"]});return Zw(t,{check:n,error:r})}function tv(e){return fn(e)&&E(e,"check")&&E(e,"error")&&In(e.check)&&In(e.error)}function Cl(e){return Yt(e)&&E(e,"~refine")&&H(e["~refine"])&&dt(e["~refine"],0,t=>tv(t))}const nv="-?(?:0|[1-9][0-9]*)n";function jl(e){return he({"~kind":"BigInt"},{type:"bigint"},e)}function ts(e){return we(e,"BigInt")}function $m(e){return he({"~kind":"Boolean"},{type:"boolean"},e)}function jr(e){return we(e,"Boolean")}function yc(e){return he({"~kind":"Identifier"},{name:e})}function rv(e){return we(e,"Identifier")}const Rm="-?(?:0|[1-9][0-9]*)";function oa(e){return he({"~kind":"Integer"},{type:"integer"},e)}function _n(e){return we(e,"Integer")}class sv extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function ov(e){return tt(e)?"bigint":ht(e)?"boolean":ye(e)?"number":ie(e)?"string":(()=>{throw new sv(e)})()}function Me(e,t){return he({"~kind":"Literal"},{type:ov(e),const:e},t)}function Mm(e){return tt(e)||ht(e)||ye(e)||ie(e)}function iv(e){return We(e)&&tt(e.const)}function av(e){return We(e)&&ht(e.const)}function Fm(e){return We(e)&&ye(e.const)}function Dm(e){return We(e)&&ie(e.const)}function We(e){return we(e,"Literal")}function Tl(e){return he({"~kind":"Null"},{type:"null"},e)}function $o(e){return we(e,"Null")}const _m="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Sr(e){return he({"~kind":"Number"},{type:"number"},e)}function nn(e){return we(e,"Number")}function Al(e){return he({"~kind":"Symbol"},{type:"symbol"},e)}function Ro(e){return we(e,"Symbol")}function Mo(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,o],1:s=>[s,Bt(),Bt()]});return he({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function cv(e){return we(e,"Parameter")}const Lm=".*";function Ln(e){return he({"~kind":"String"},{type:"string"},e)}function On(e){return we(e,"String")}function Ve(e,t={}){return he({"~kind":"Union"},{anyOf:e},t)}function ae(e){return we(e,"Union")}function lv(e){return Pn(e,["~kind","anyOf"])}function Um(e){const t=GT(e);return h(t.length,2)?t[0]:[]}function dv(e){return!0}function Bm(e){return Ie(e,(t,n)=>uv(t)?Bm(n):!1,()=>!0)}function Hm(e){return h(e.length,0)?!1:Bm(e)}function uv(e){return ae(e)?Hm(e.anyOf):We(e)?dv(e.const):!1}function qm(e){return Hm(e)}function zm(e){return he({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Km(e,t,n=[]){return Ie(e,(r,s)=>Km(s,t,[...n,`${r}${t}`]),()=>n)}function fv(e,t){return h(e.length,0)?[`${t}`]:Km(e,t)}function Gm(e,t,n=[]){return Ie(t,(r,s)=>Gm(e,s,[...n,...Vm(e,r)]),()=>n)}function Vm(e,t){return ae(t)?Gm(e,t.anyOf):We(t)?fv(e,t.const):Ot()}function Wm(e,t){return Ie(t,(n,r)=>Wm(Vm(e,n),r),()=>e)}function mv(e){return e.map(t=>Me(t))}function pv(e){const t=Wm([],e),n=mv(t);return Ve(n)}function gv(e){return h(e.length,0)?Ot():h(e.length,1)&&We(e[0])?e[0]:pv(e)}function Jm(e){const t=Um(e);return h(t.length,0)?Ln():qm(t)?gv(t):zm(e)}function El(e){const t=Jm(e);return zt(t)?Ln():t}function wr(e,t){const n="object",r={[e]:t};return he({"~kind":"Record"},{type:n,patternProperties:r})}function hv(e){return wr(Wr,e)}function bv(e){return Ae({true:e,false:e})}function bn(e,t={}){const[n,r,s]=[e,e.length,!1];return he({"~kind":"Tuple"},{type:"array",additionalItems:s,items:n,minItems:r},t)}function st(e){return we(e,"Tuple")}function kv(e){return Pn(e,["~kind","type","items","minItems","additionalItems"])}function xv(e){return Pn(e,["~readonly"])}function Qm(e,t){return ue(xv(e),{},t)}function yv(e,t,n,r){const s=G(e,t,n);return Qm(s,r)}function Sv(e,t={}){return je("RemoveReadonly",[e],t)}function wv(e,t={}){return Qm(e,t)}function vv(e){return Pn(e,["~optional"])}function Ym(e,t){return ue(vv(e),{},t)}function Iv(e,t,n,r){const s=G(e,t,n);return Ym(s,r)}function Cv(e,t={}){return je("RemoveOptional",[e],t)}function Xm(e,t={}){return Ym(e,t)}function Zm(e){return e.reduceRight((n,r,s)=>({[s]:r,...n}),{})}function jv(e){const t=Zm(e.items);return Ae(t)}function Tv(e,t){return Li(e)?!!Li(t):!1}function Av(e,t){return Xt(e)?!!Xt(t):!1}function Ev(e,t){const n=Tv(e,t),r=Av(e,t),s=rn([e,t]),o=wv(Xm(s));return n&&r?_i(Mi(o)):n&&!r?_i(o):!n&&r?Mi(o):o}function Pv(e,t,n){return n in e?n in t?Ev(e[n],t[n]):e[n]:n in t?t[n]:Tt()}function Nv(e,t){return[...new Set([...D(t),...D(e)])].reduce((r,s)=>({...r,[s]:Pv(e,t,s)}),{})}function Fu(e){return Le(e)?e.properties:st(e)?Zm(e.items):Ot()}function Ov(e,t){const n=Fu(e),r=Fu(t),s=Nv(n,r);return Ae(s)}function $v(e,t){const n=ga(e,t);return h(n,Zl)?e:h(n,ed)||h(n,Xl)?t:Tt()}function Du(e){return Le(e)||st(e)}function Rv(e,t){const n=ae(e),r=ae(t);return n||r}function Mv(e,t){const n=Vr(e),r=Vr(t),s=Rv(n,r),o=Du(n),i=Du(r);return s?rn([n,r]):o&&i?Ov(n,r):o&&!i?n:!o&&i?r:$v(n,r)}function ep(e,t,n=[]){return Ie(t,(r,s)=>ep(e,s,[...n,Mv(e,r)]),()=>h(n.length,0)?[e]:n)}function tp(e,t,n=[]){return Ie(e,(r,s)=>tp(s,t,[...n,...Ui([r],t)]),()=>n)}function Ui(e,t=[]){return Ie(e,(n,r)=>ae(n)?Ui(r,tp(n.anyOf,t)):Ui(r,ep(n,t)),()=>t)}function Fv(e,t){const n=nr({},e,t);return Kt(n)?[]:[e]}function Dv(e,t){return e.reduce((n,r)=>[...n,...Fv(r,t)],[])}function np(e,t){const n=Vr(e),r=ae(n)?n.anyOf:[n],s=Dv(r,t);return or(s)}function Ms(e,t,n){const r=Fn([e,t]),s=np(n,e);return or([r,s])}function Tr(e){const t=e.map(n=>Me(n));return or(t)}function rn(e){const t=Ui(e),n=yg(t);return Fs(n)}function sr(e){const t=El(e);return Vr(t)}function or(e){const t=yg(e);return Fs(t)}function Vr(e){return gn(e)?Ms(e.if,e.then,e.else):hn(e)?Tr(e.enum):Ue(e)?rn(e.allOf):zt(e)?sr(e.pattern):ae(e)?or(e.anyOf):e}function Fs(e){return h(e.length,1)?e[0]:h(e.length,0)?Tt():Ve(e)}function _v(e,t){const n=Tr(e);return aa(n,t)}function Lv(e,t){return wr(Fo,t)}function Uv(e,t){const n=rn(e);return aa(n,t)}function Bv(e,t){return ie(e)||ye(e)?Ae({[e]:t}):h(e,!1)?Ae({false:t}):h(e,!0)?Ae({true:t}):Ae({})}function Hv(e,t){return wr(ca,t)}function qv(e,t){return E(e,"pattern")&&(ie(e.pattern)||e.pattern instanceof RegExp)?wr(e.pattern.toString(),t):wr(Wr,t)}function zv(e,t){const n=Um(e);return qm(n)?aa(sr(e),t):wr(e,t)}function Kv(e){return ae(e)?ia(e.anyOf):[e]}function ia(e){return e.reduce((t,n)=>[...t,...Kv(n)],[])}function Gv(e){return e.some(t=>On(t)||nn(t)||_n(t))}function Vv(e,t){return h(Gv(e),!0)?wr(Wr,t):void 0}function Wv(e,t){return e.reduce((n,r)=>We(r)&&(ie(r.const)||ye(r.const))?{...n,[r.const]:t}:n,{})}function Jv(e,t){const n=Wv(e,t);return Ae(n)}function Qv(e,t){const n=ia(e),r=Vv(n,t);return Yt(r)?r:Jv(n,t)}function aa(e,t){return Nn(e)?hv(t):jr(e)?bv(t):hn(e)?_v(e.enum,t):_n(e)?Lv(e,t):Ue(e)?Uv(e.allOf,t):We(e)?Bv(e.const,t):nn(e)?Hv(e,t):ae(e)?Qv(e.anyOf,t):On(e)?qv(e,t):zt(e)?zv(e.pattern,t):Ae({})}function rp(e,t,n){return Ye([e])?ue(aa(e,t),{},n):sp(e,t,n)}function Yv(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return rp(o,i,s)}const Fo=`^${Rm}$`,ca=`^${_m}$`,Wr=`^${Lm}$`;function sp(e,t,n={}){return je("Record",[e,t],n)}function Pl(e,t,n={}){return rp(e,t,n)}function Xv(e,t){return wr(e,t)}function Sc(e){return h(e,Wr)?Ln():h(e,Fo)?oa():h(e,ca)?Sr():Jm(e)}function kn(e){return D(e.patternProperties)[0]}function la(e){const t=kn(e);return Sc(t)}function qt(e){return e.patternProperties[kn(e)]}function At(e){return we(e,"Record")}function da(e){return he({"~kind":"Rest"},{type:"rest",items:e},{})}function ua(e){return we(e,"Rest")}function op(e){return he({"~kind":"This"},{$ref:"#"},e)}function ip(e){return we(e,"This")}function Nl(e){return he({"~kind":"Undefined"},{type:"undefined"},e)}function Ds(e){return we(e,"Undefined")}function ap(e){return he({"~kind":"Void"},{type:"void"},e)}function ns(e){return we(e,"Void")}function Zv(e,t){return h(e,"Array")?Cr(t[0]):h(e,"Capitalize")?Cg(t[0]):h(e,"ConstructorParameters")?Mg(t[0]):h(e,"Evaluate")?GN(t[0]):h(e,"Exclude")?Dg(t[0],t[1]):h(e,"Extract")?_g(t[0],t[1]):h(e,"Index")?od(t[0],t[1]):h(e,"InstanceType")?Kg(t[0]):h(e,"Lowercase")?jg(t[0]):h(e,"NonNullable")?Qg(t[0]):h(e,"Omit")?Xg(t[0],t[1]):h(e,"Parameters")?th(t[0]):h(e,"Partial")?rh(t[0]):h(e,"Pick")?oh(t[0],t[1]):h(e,"Readonly")?ah(t[0]):h(e,"KeyOf")?ld(t[0]):h(e,"Record")?sp(t[0],t[1]):h(e,"Required")?dh(t[0]):h(e,"ReturnType")?fh(t[0]):h(e,"Uncapitalize")?Tg(t[0]):h(e,"Uppercase")?Ag(t[0]):Nc(dn(e),t)}function rs(){throw Error("Unreachable")}function cp(e,t=[]){return Ie(e,(n,r)=>cp(r,[...t,n[1]]),()=>t)}function ir(e){return h(e.length,3)?[e[0],...cp(e[1])]:[]}function eI(e){return Mo(e[0],e[2],e[4])}function tI(e){return Mo(e[0],e[2],e[2])}function nI(e){return Mo(e[0],Bt(),e[2])}function rI(e){return Mo(e,Bt(),Bt())}function sI(e){return ir(e)}function oI(e){return e[1]}function iI(e){return ir(e)}function aI(e){return e[1]}function cI(e){return Zv(e[0],e[1])}function lI(e){return null}function dI(e){return Ln()}function uI(e){return Sr()}function fI(e){return $m()}function mI(e){return Nl()}function pI(e){return Tl()}function gI(e){return oa()}function hI(e){return jl()}function bI(e){return Bt()}function kI(e){return vl()}function xI(e){return Ae({})}function yI(e){return Tt()}function SI(e){return Al()}function wI(e){return ap()}function vI(e){return op()}function II(e){return Me(BigInt(e))}function CI(e){return Me(h(e,"true"))}function jI(e){return Me(parseFloat(e))}function TI(e){return Me(e)}function AI(e){return e[1]}function EI(e){return Me(e)}function PI(e){return h(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function NI(e){return e[1]}function OI(e){return og(e)}function $I(e){return h(e.length,6)?Fi(e[1],e[3],e[5]):Fi(e[1],e[3],Bt())}function RI(e){return e.length>0}function MI(e){return e.reduce((t,n)=>h(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function FI(e){return h(e.length,6)?[e[1],e[3],e[5]]:[]}function DI(e){return H(e)&&h(e.length,3)?e[1]:e}function _I(e){return h(e.length,2)?e[1]:[]}function _u(e,t){return t.reduce((n,r)=>{const s=r;return h(s.length,1)?od(n,s[0]):h(s.length,0)?Cr(n):rs()},e)}function Lu(e,t){return h(t.length,3)?$g(e,t[0],t[1],t[2]):e}function LI(e,t){return H(t)&&h(t.length,0)?e:ph(e,t)}function UI(e){const[t,n,r,s,o]=e;return LI(Lu(t?ld(_u(n,r)):_u(n,r),s),o)}function Ol(e,t){return h(t.length,3)?(()=>{const[n,r,s]=t,o=Ol(r,s);if(h(n,"&"))return Ue(o)?Fn([e,...o.allOf]):Fn([e,o]);if(h(n,"|"))return ae(o)?Ve([e,...o.anyOf]):Ve([e,o]);rs()})():e}function BI(e){const[t,n]=e;return Ol(t,n)}function HI(e){const[t,n]=e;return Ol(t,n)}function qI(e){return KN(e[1])}function zI(e){return e[1]}function KI(e){return No(e[0],e[2])}function GI(e){return h(e.length,4)?kc(e[1],e[3]):h(e.length,2)?kc(e[1],Bt()):rs()}function VI(e){return`${e}`}function WI(e){return _n(e[3])?Fo:nn(e[3])?ca:Ro(e[3])||On(e[3])?Wr:rs()}function JI(e){return e.length>0}function QI(e){return e.length>0}function YI(e){const[t,n,r,s,o]=e;return{[n]:t&&r?tr(er(o)):t&&!r?tr(o):!t&&r?er(o):o}}function XI(e){return ir(e)}function lp(e){return e.reduce((t,n)=>E(n,Fo)||E(n,ca)||E(n,Wr)?[t[0],gt(t[1],n)]:[gt(t[0],n),t[1]],[{},{}])}function ZI(e){return lp(e[1])}function eC(e){const[t,n]=e,r=h(D(n).length,0)?{}:{patternProperties:n};return Ae(t,r)}function tC(e){return h(e.length,5)?tr(er(e[4])):h(e.length,3)?e[2]:h(e.length,4)?h(e[2],"readonly")?tr(e[3]):er(e[3]):rs()}function nC(e){if(!H(e)||!h(e.length,3))return e;const[t,n,r]=e;return t&&r?tr(er(n)):t&&!r?tr(n):!t&&r?er(n):n}function rC(e){return h(e.length,2)?da(e[1]):h(e.length,1)?e[0]:rs()}function sC(e){return ir(e)}function oC(e){return bn(e[1])}function iC(e){return tr(er(e[4]))}function aC(e){return tr(e[3])}function cC(e){return er(e[3])}function lC(e){return e[2]}function dC(e){return h(e.length,2)?da(e[1]):h(e.length,1)?e[0]:rs()}function uC(e){return ir(e)}function fC(e){return Po(e[1],e[4])}function mC(e){return Eo(e[2],e[5])}function Uu(e,t){return h(e,"remove")?Sv(t):h(e,"add")?tr(t):t}function pC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function Bu(e,t){return h(e,"remove")?Cv(t):h(e,"add")?er(t):t}function gC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function hC(e){return h(e.length,2)?[e[1]]:[]}function bC(e){return H(e[6])&&h(e[6].length,1)?Oc(yc(e[3]),e[5],e[6][0],Uu(e[1],Bu(e[8],e[10]))):Oc(yc(e[3]),e[5],dn(e[3]),Uu(e[1],Bu(e[8],e[10])))}function kC(e){return dn(e)}function xC(e){return BigInt(e)}function yC(e){return parseFloat(e)}function SC(e){return h(e,"true")}function wC(e){return null}function vC(e){return{[e[0]]:e[2]}}function IC(e){return ir(e)}function CC(e){return e.reduce((t,n)=>gt(t,n),{})}function jC(e){return CC(e[1])}function TC(e){return ir(e)}function AC(e){return e[1]}function EC(e){return jl()}function PC(e){return Ln()}function NC(e){return Sr()}function OC(e){return oa()}function $C(e){return Tt()}function RC(e){return Me(e)}function MC(e){return Ve(e[1])}function FC(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function DC(e){return[e[0],...e[1]]}function _C(e){return e[1]}function LC(e){return ir(e)}function UC(e){return h(e.length,2)?e[1]:[]}function BC(e){const t=e[2],n=e[3],[r,s]=e[4],o=h(D(s).length,0)?{}:{patternProperties:s};return{[e[1]]:No(t,Ql(n,r,o))}}function HC(e){const t=e[2],[n,r]=e[3],s=h(D(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Ql(t,n,s)}}function qC(e){return{[e[1]]:No(e[2],e[4])}}function zC(e){return{[e[1]]:e[3]}}function KC(e){return null}function GC(e){return ir(e)}function VC(e){return e[1]}function WC(e){const[t,n]=[e[0],e[1]];return VN(gt(t,lp(n)[0]))}function $l(e){return h(e.length,2)}function Re(e,t,n){return $l(e)?t(e[0],e[1]):n()}function JC(e,t){return h(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Rt(e,t){for(let n=0;n<e.length;n++){const r=JC(e[n],t);if($l(r))return r}return[]}function wc(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}const QC=[...wc(97,122),...wc(65,90)],dp="0",up=wc(49,57),Rl=[dp,...up],YC=" ",Ml=`
|
|
3
|
+
`,Do="_",Fl=".",XC="$",fp="-",mp="//",pp="/*",ZC="*/";function gp(e){const t=e.indexOf(ZC);return h(t,-1)?"":e.slice(t+2)}function hp(e){const t=e.indexOf(Ml);return h(t,-1)?"":e.slice(t)}function ej(e){return e.replace(/^[ \t\r\f\v]+/,"")}function vc(e){const t=ej(e);return t.startsWith(pp)?vc(gp(t.slice(2))):t.startsWith(mp)?vc(hp(t.slice(2))):t}function jn(e){const t=e.trimStart();return t.startsWith(pp)?jn(gp(t.slice(2))):t.startsWith(mp)?jn(hp(t.slice(2))):t}function bp(e,t){return Re(Rt([e],t),(n,r)=>[n,r],()=>["",t])}function tj(e,t){return e.includes(t)}function Bi(e,t,n,r=""){return Re(Rt(e,n),(s,o)=>tj(t,s)?Bi(e,t,o,r):Bi(e,t,o,`${r}${s}`),()=>[r,n])}function nj(e){return Rt(up,e)}const rj=[...Rl,Do];function sj(e){return Bi(rj,[Do],e)}function oj(e){return Re(Rt([dp],e),(t,n)=>[t,n],()=>Re(nj(e),(t,n)=>Re(sj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[]))}function kp(e){return oj(jn(e))}function ij(e){return bp(fp,e)}function aj(e){return Re(ij(e),(t,n)=>Re(kp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function cj(e){return aj(jn(e))}function lj(e){return Re(cj(e),(t,n)=>Re(Rt(["n"],n),(r,s)=>[`${t}`,s],()=>[]),()=>[])}function xp(e){return lj(e)}function Za(e,t){return Rt([e],t)}function I(e,t){return h(e,"")?["",t]:e.startsWith(Ml)?Za(e,vc(t)):e.startsWith(YC)?Za(e,t):Za(e,jn(t))}const yp=[...QC,Do,XC];function dj(e){return Rt(yp,e)}const uj=[...yp,...Rl];function Sp(e,t=""){return Re(Rt(uj,e),(n,r)=>Sp(r,`${t}${n}`),()=>[t,e])}function fj(e){return Re(dj(e),(t,n)=>Re(Sp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function et(e){return fj(jn(e))}const mj=[...Rl,Do];function pj(e){return $l(Rt([Fl],e))}function wp(e){return Re(Bi(mj,[Do],e),(t,n)=>h(t,"")?[]:[t,n],()=>[])}function gj(e){return Re(Rt([Fl],e),(t,n)=>Re(wp(n),(r,s)=>[`0${t}${r}`,s],()=>[]),()=>[])}function hj(e){return Re(kp(e),(t,n)=>Re(Rt([Fl],n),(r,s)=>Re(wp(s),(o,i)=>[`${t}${r}${o}`,i],()=>[`${t}`,s]),()=>[`${t}`,n]),()=>[])}function bj(e){return pj(e)?gj(e):hj(e)}function kj(e){return bj(jn(e))}function xj(e){return bp(fp,e)}function yj(e){return Re(xj(e),(t,n)=>Re(kj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Dl(e){return yj(jn(e))}function Sj(e){return h(e,"")?[]:[e.slice(0,1),e.slice(1)]}function vp(e,t){return Ie(e,(n,r)=>t.startsWith(n)?!0:vp(r,t),()=>!1)}function _o(e,t,n=""){return Re(Sj(t),(r,s)=>vp(e,t)?[n,t]:_o(e,s,`${n}${r}`),()=>[])}function wj(e,t,n){return Re(Rt([e],n),(r,s)=>Re(_o([t],s),(o,i)=>Re(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function vj(e,t,n){return Re(Rt([e],n),(r,s)=>Re(_o([Ml,t],s),(o,i)=>Re(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function Ij(e,t,n,r){return n?wj(e,t,jn(r)):vj(e,t,jn(r))}function Cj(e,t){return Rt(e,t)}function jj(e,t){return Ij(e,e,!1,t)}function Tj(e,t){return Re(Cj(e,t),(n,r)=>jj(n,`${n}${r}`),()=>[])}function _l(e,t){return Tj(e,jn(t))}function Aj(e,t){return Re(_o(e,t),(n,r)=>h(n,"")?[]:[n,r],()=>[])}const u=(e,t,n=()=>[])=>e.length===2?t(e):n(),Ej=e=>u(u(et(e),([t,n])=>u(I("extends",n),([r,s])=>u(ge(s),([o,i])=>u(I("=",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[eI(t),n]),Pj=e=>u(u(et(e),([t,n])=>u(I("extends",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[tI(t),n]),Nj=e=>u(u(et(e),([t,n])=>u(I("=",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[nI(t),n]),Oj=e=>u(et(e),([t,n])=>[rI(t),n]),Ip=e=>u(u(Ej(e),([t,n])=>[t,n],()=>u(Pj(e),([t,n])=>[t,n],()=>u(Nj(e),([t,n])=>[t,n],()=>u(Oj(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Cp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(Ip(r),([s,o])=>[[n,s],o])),([n,r])=>Cp(r,[...t,n]),()=>[t,e]),$j=e=>u(u(u(Ip(e),([t,n])=>u(Cp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[sI(t),n]),Ll=e=>u(u(I("<",e),([t,n])=>u($j(n),([r,s])=>u(I(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[oI(t),n]),jp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(ge(r),([s,o])=>[[n,s],o])),([n,r])=>jp(r,[...t,n]),()=>[t,e]),Rj=e=>u(u(u(ge(e),([t,n])=>u(jp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[iI(t),n]),Mj=e=>u(u(I("<",e),([t,n])=>u(Rj(n),([r,s])=>u(I(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[aI(t),n]),Fj=e=>u(u(et(e),([t,n])=>u(Mj(n),([r,s])=>[[t,r],s])),([t,n])=>[cI(t),n]),Tp=e=>u(u(u(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[lI(),n]),Ap=e=>u(I("string",e),([t,n])=>[dI(),n]),Ep=e=>u(I("number",e),([t,n])=>[uI(),n]),Dj=e=>u(I("boolean",e),([t,n])=>[fI(),n]),_j=e=>u(I("undefined",e),([t,n])=>[mI(),n]),Lj=e=>u(I("null",e),([t,n])=>[pI(),n]),Pp=e=>u(I("integer",e),([t,n])=>[gI(),n]),Uj=e=>u(I("bigint",e),([t,n])=>[hI(),n]),Bj=e=>u(I("unknown",e),([t,n])=>[bI(),n]),Hj=e=>u(I("any",e),([t,n])=>[kI(),n]),qj=e=>u(I("object",e),([t,n])=>[xI(),n]),zj=e=>u(I("never",e),([t,n])=>[yI(),n]),Np=e=>u(I("symbol",e),([t,n])=>[SI(),n]),Kj=e=>u(I("void",e),([t,n])=>[wI(),n]),Gj=e=>u(I("this",e),([t,n])=>[vI(),n]),Vj=e=>u(u(I("${",e),([t,n])=>u(ge(n),([r,s])=>u(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[AI(t),n]),ec=e=>u(_o(["${","`"],e),([t,n])=>[EI(t),n]),Op=e=>u(u(u(ec(e),([t,n])=>u(Vj(n),([r,s])=>u(Op(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u(u(ec(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(ec(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[PI(t),n]),$p=e=>u(u(I("`",e),([t,n])=>u(Op(n),([r,s])=>u(I("`",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[NI(t),n]),Wj=e=>u($p(e),([t,n])=>[OI(t),n]),Jj=e=>u(u(u(I("if",e),([t,n])=>u(ge(n),([r,s])=>u(I("then",s),([o,i])=>u(ge(i),([a,l])=>u(I("else",l),([d,m])=>u(ge(m),([p,g])=>[[t,r,o,a,d,p],g])))))),([t,n])=>[t,n],()=>u(u(I("if",e),([t,n])=>u(ge(n),([r,s])=>u(I("then",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[$I(t),n]),Qj=e=>u(xp(e),([t,n])=>[II(t),n]),Yj=e=>u(u(I("true",e),([t,n])=>[t,n],()=>u(I("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[CI(t),n]),Xj=e=>u(Dl(e),([t,n])=>[jI(t),n]),Zj=e=>u(_l(["'",'"'],e),([t,n])=>[TI(t),n]),eT=e=>u(u(u(I("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[RI(t),n]),Rp=(e,t=[])=>u(u(u(I("[",e),([n,r])=>u(ge(r),([s,o])=>u(I("]",o),([i,a])=>[[n,s,i],a]))),([n,r])=>[n,r],()=>u(u(I("[",e),([n,r])=>u(I("]",r),([s,o])=>[[n,s],o])),([n,r])=>[n,r],()=>[])),([n,r])=>Rp(r,[...t,n]),()=>[t,e]),tT=e=>u(Rp(e),([t,n])=>[MI(t),n]),nT=e=>u(u(u(I("extends",e),([t,n])=>u(ge(n),([r,s])=>u(I("?",s),([o,i])=>u(ge(i),([a,l])=>u(I(":",l),([d,m])=>u(ge(m),([p,g])=>[[t,r,o,a,d,p],g])))))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[FI(t),n]),rT=e=>u(u(u(I("(",e),([t,n])=>u(ge(n),([r,s])=>u(I(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u(Ap(e),([t,n])=>[t,n],()=>u(Ep(e),([t,n])=>[t,n],()=>u(Dj(e),([t,n])=>[t,n],()=>u(_j(e),([t,n])=>[t,n],()=>u(Lj(e),([t,n])=>[t,n],()=>u(Pp(e),([t,n])=>[t,n],()=>u(Uj(e),([t,n])=>[t,n],()=>u(Bj(e),([t,n])=>[t,n],()=>u(Hj(e),([t,n])=>[t,n],()=>u(qj(e),([t,n])=>[t,n],()=>u(zj(e),([t,n])=>[t,n],()=>u(Np(e),([t,n])=>[t,n],()=>u(Kj(e),([t,n])=>[t,n],()=>u(Gj(e),([t,n])=>[t,n],()=>u(Qj(e),([t,n])=>[t,n],()=>u(Yj(e),([t,n])=>[t,n],()=>u(Xj(e),([t,n])=>[t,n],()=>u(Zj(e),([t,n])=>[t,n],()=>u(Wj(e),([t,n])=>[t,n],()=>u(Jj(e),([t,n])=>[t,n],()=>u(pT(e),([t,n])=>[t,n],()=>u(bT(e),([t,n])=>[t,n],()=>u(vT(e),([t,n])=>[t,n],()=>u(wT(e),([t,n])=>[t,n],()=>u(TT(e),([t,n])=>[t,n],()=>u(Fj(e),([t,n])=>[t,n],()=>u(AT(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[DI(t),n]),sT=e=>u(u(u(I("with",e),([t,n])=>u(Yp(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_I(t),n]),Mp=e=>u(u(eT(e),([t,n])=>u(rT(n),([r,s])=>u(tT(s),([o,i])=>u(nT(i),([a,l])=>u(sT(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[UI(t),n]),Fp=e=>u(u(u(I("&",e),([t,n])=>u(Mp(n),([r,s])=>u(Fp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Dp=e=>u(u(Mp(e),([t,n])=>u(Fp(n),([r,s])=>[[t,r],s])),([t,n])=>[BI(t),n]),_p=e=>u(u(u(I("|",e),([t,n])=>u(Dp(n),([r,s])=>u(_p(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),fa=e=>u(u(Dp(e),([t,n])=>u(_p(n),([r,s])=>[[t,r],s])),([t,n])=>[HI(t),n]),oT=e=>u(u(I("readonly",e),([t,n])=>u(fa(n),([r,s])=>[[t,r],s])),([t,n])=>[qI(t),n]),iT=e=>u(u(I("|",e),([t,n])=>u(fa(n),([r,s])=>[[t,r],s])),([t,n])=>[zI(t),n]),aT=e=>u(u(Ll(e),([t,n])=>u(I("=",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[KI(t),n]),cT=e=>u(u(u(I("infer",e),([t,n])=>u(et(n),([r,s])=>u(I("extends",s),([o,i])=>u(fa(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>u(u(I("infer",e),([t,n])=>u(et(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>[])),([t,n])=>[GI(t),n]),ge=e=>u(u(cT(e),([t,n])=>[t,n],()=>u(iT(e),([t,n])=>[t,n],()=>u(oT(e),([t,n])=>[t,n],()=>u(fa(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),lT=e=>u(Dl(e),([t,n])=>[VI(t),n]),dT=e=>u(et(e),([t,n])=>[t,n]),uT=e=>u(_l(["'",'"'],e),([t,n])=>[t,n]),fT=e=>u(u(I("[",e),([t,n])=>u(et(n),([r,s])=>u(I(":",s),([o,i])=>u(u(Pp(i),([a,l])=>[a,l],()=>u(Ep(i),([a,l])=>[a,l],()=>u(Ap(i),([a,l])=>[a,l],()=>u(Np(i),([a,l])=>[a,l],()=>[])))),([a,l])=>u(I("]",l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[WI(t),n]),Lp=e=>u(u(lT(e),([t,n])=>[t,n],()=>u(dT(e),([t,n])=>[t,n],()=>u(uT(e),([t,n])=>[t,n],()=>u(fT(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Up=e=>u(u(u(I("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[JI(t),n]),Bp=e=>u(u(u(I("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[QI(t),n]),Hp=e=>u(u(Up(e),([t,n])=>u(Lp(n),([r,s])=>u(Bp(s),([o,i])=>u(I(":",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[YI(t),n]),ma=e=>u(u(u(I(",",e),([t,n])=>u(I(`
|
|
4
4
|
`,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I(";",e),([t,n])=>u(I(`
|
|
5
5
|
`,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(I(`
|
|
6
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),
|
|
6
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),qp=(e,t=[])=>u(u(ma(e),([n,r])=>u(Hp(r),([s,o])=>[[n,s],o])),([n,r])=>qp(r,[...t,n]),()=>[t,e]),mT=e=>u(u(u(Hp(e),([t,n])=>u(qp(n),([r,s])=>u(u(ma(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[XI(t),n]),Ul=e=>u(u(I("{",e),([t,n])=>u(mT(n),([r,s])=>u(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[ZI(t),n]),pT=e=>u(Ul(e),([t,n])=>[eC(t),n]),gT=e=>u(u(u(et(e),([t,n])=>u(I("?",n),([r,s])=>u(I(":",s),([o,i])=>u(I("readonly",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[t,n],()=>u(u(et(e),([t,n])=>u(I(":",n),([r,s])=>u(I("readonly",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>u(u(et(e),([t,n])=>u(I("?",n),([r,s])=>u(I(":",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>u(u(et(e),([t,n])=>u(I(":",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[tC(t),n]),Hu=e=>u(u(gT(e),([t,n])=>[t,n],()=>u(u(Up(e),([t,n])=>u(ge(n),([r,s])=>u(Bp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])),([t,n])=>[nC(t),n]),zp=e=>u(u(u(I("...",e),([t,n])=>u(Hu(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(Hu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[rC(t),n]),Kp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(zp(r),([s,o])=>[[n,s],o])),([n,r])=>Kp(r,[...t,n]),()=>[t,e]),hT=e=>u(u(u(zp(e),([t,n])=>u(Kp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[sC(t),n]),bT=e=>u(u(I("[",e),([t,n])=>u(hT(n),([r,s])=>u(I("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[oC(t),n]),kT=e=>u(u(et(e),([t,n])=>u(I("?",n),([r,s])=>u(I(":",s),([o,i])=>u(I("readonly",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[iC(t),n]),xT=e=>u(u(et(e),([t,n])=>u(I(":",n),([r,s])=>u(I("readonly",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[aC(t),n]),yT=e=>u(u(et(e),([t,n])=>u(I("?",n),([r,s])=>u(I(":",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[cC(t),n]),ST=e=>u(u(et(e),([t,n])=>u(I(":",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[lC(t),n]),qu=e=>u(u(kT(e),([t,n])=>[t,n],()=>u(xT(e),([t,n])=>[t,n],()=>u(yT(e),([t,n])=>[t,n],()=>u(ST(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Gp=e=>u(u(u(I("...",e),([t,n])=>u(qu(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(qu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[dC(t),n]),Vp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(Gp(r),([s,o])=>[[n,s],o])),([n,r])=>Vp(r,[...t,n]),()=>[t,e]),Wp=e=>u(u(u(Gp(e),([t,n])=>u(Vp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[uC(t),n]),wT=e=>u(u(I("(",e),([t,n])=>u(Wp(n),([r,s])=>u(I(")",s),([o,i])=>u(I("=>",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[fC(t),n]),vT=e=>u(u(I("new",e),([t,n])=>u(I("(",n),([r,s])=>u(Wp(s),([o,i])=>u(I(")",i),([a,l])=>u(I("=>",l),([d,m])=>u(ge(m),([p,g])=>[[t,r,o,a,d,p],g])))))),([t,n])=>[mC(t),n]),IT=e=>u(u(u(I("+",e),([t,n])=>u(I("readonly",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I("-",e),([t,n])=>u(I("readonly",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[pC(t),n]),CT=e=>u(u(u(I("+",e),([t,n])=>u(I("?",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I("-",e),([t,n])=>u(I("?",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[gC(t),n]),jT=e=>u(u(u(I("as",e),([t,n])=>u(ge(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[hC(t),n]),TT=e=>u(u(I("{",e),([t,n])=>u(IT(n),([r,s])=>u(I("[",s),([o,i])=>u(et(i),([a,l])=>u(I("in",l),([d,m])=>u(ge(m),([p,g])=>u(jT(g),([x,b])=>u(I("]",b),([y,j])=>u(CT(j),([k,A])=>u(I(":",A),([N,$])=>u(ge($),([Q,T])=>u(Tp(T),([C,O])=>u(I("}",O),([R,K])=>[[t,r,o,a,d,p,x,y,k,N,Q,C,R],K]))))))))))))),([t,n])=>[bC(t),n]),AT=e=>u(et(e),([t,n])=>[kC(t),n]),ET=e=>u(xp(e),([t,n])=>[xC(t),n]),PT=e=>u(Dl(e),([t,n])=>[yC(t),n]),NT=e=>u(u(I("true",e),([t,n])=>[t,n],()=>u(I("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[SC(t),n]),OT=e=>u(_l(['"',"'"],e),([t,n])=>[t,n]),$T=e=>u(I("null",e),([t,n])=>[wC(),n]),RT=e=>u(I("undefined",e),([t,n])=>[void 0,n]),Jp=e=>u(u(Lp(e),([t,n])=>u(I(":",n),([r,s])=>u(Bl(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[vC(t),n]),Qp=(e,t=[])=>u(u(ma(e),([n,r])=>u(Jp(r),([s,o])=>[[n,s],o])),([n,r])=>Qp(r,[...t,n]),()=>[t,e]),MT=e=>u(u(u(Jp(e),([t,n])=>u(Qp(n),([r,s])=>u(u(ma(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[IC(t),n]),Yp=e=>u(u(I("{",e),([t,n])=>u(MT(n),([r,s])=>u(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[jC(t),n]),Xp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(Bl(r),([s,o])=>[[n,s],o])),([n,r])=>Xp(r,[...t,n]),()=>[t,e]),FT=e=>u(u(u(Bl(e),([t,n])=>u(Xp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[TC(t),n]),DT=e=>u(u(I("[",e),([t,n])=>u(FT(n),([r,s])=>u(I("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[AC(t),n]),Bl=e=>u(u(ET(e),([t,n])=>[t,n],()=>u(PT(e),([t,n])=>[t,n],()=>u(NT(e),([t,n])=>[t,n],()=>u(OT(e),([t,n])=>[t,n],()=>u($T(e),([t,n])=>[t,n],()=>u(RT(e),([t,n])=>[t,n],()=>u(Yp(e),([t,n])=>[t,n],()=>u(DT(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),_T=e=>u(I("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[EC(),n]),LT=e=>u(I(".*",e),([t,n])=>[PC(),n]),UT=e=>u(I("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[NC(),n]),BT=e=>u(I("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[OC(),n]),HT=e=>u(I("(?!)",e),([t,n])=>[$C(),n]),qT=e=>u(Aj(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[RC(t),n]),zT=e=>u(u(_T(e),([t,n])=>[t,n],()=>u(LT(e),([t,n])=>[t,n],()=>u(UT(e),([t,n])=>[t,n],()=>u(BT(e),([t,n])=>[t,n],()=>u(HT(e),([t,n])=>[t,n],()=>u(KT(e),([t,n])=>[t,n],()=>u(qT(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),KT=e=>u(u(I("(",e),([t,n])=>u(Hl(n),([r,s])=>u(I(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[MC(t),n]),Zp=e=>u(u(u(Ic(e),([t,n])=>u(I("|",n),([r,s])=>u(Zp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u(u(Ic(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[FC(t),n]),Ic=e=>u(u(zT(e),([t,n])=>u(Hl(n),([r,s])=>[[t,r],s])),([t,n])=>[DC(t),n]),Hl=e=>u(u(Zp(e),([t,n])=>[t,n],()=>u(Ic(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),GT=e=>u(u(I("^",e),([t,n])=>u(Hl(n),([r,s])=>u(I("$",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[_C(t),n]),eg=(e,t=[])=>u(u(I(",",e),([n,r])=>u(ge(r),([s,o])=>[[n,s],o])),([n,r])=>eg(r,[...t,n]),()=>[t,e]),VT=e=>u(u(u(ge(e),([t,n])=>u(eg(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[LC(t),n]),tg=e=>u(u(u(I("extends",e),([t,n])=>u(VT(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[UC(t),n]),WT=e=>u(u(I("interface",e),([t,n])=>u(et(n),([r,s])=>u(Ll(s),([o,i])=>u(tg(i),([a,l])=>u(Ul(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[BC(t),n]),JT=e=>u(u(I("interface",e),([t,n])=>u(et(n),([r,s])=>u(tg(s),([o,i])=>u(Ul(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[HC(t),n]),QT=e=>u(u(I("type",e),([t,n])=>u(et(n),([r,s])=>u(Ll(s),([o,i])=>u(I("=",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[qC(t),n]),YT=e=>u(u(I("type",e),([t,n])=>u(et(n),([r,s])=>u(I("=",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[zC(t),n]),XT=e=>u(u(u(I("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[KC(),n]),ng=e=>u(u(u(I(";",e),([t,n])=>u(I(`
|
|
7
7
|
`,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(I(`
|
|
8
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),tg=(e,t=[])=>u(u(eg(e),([n,r])=>u(Hl(r),([s,o])=>[[n,s],o])),([n,r])=>tg(r,[...t,n]),()=>[t,e]),YT=e=>u(u(u(Hl(e),([t,n])=>u(tg(n),([r,s])=>u(u(eg(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[zC(t),n]),Hl=e=>u(u(QT(e),([t,n])=>u(u(GT(n),([r,s])=>[r,s],()=>u(VT(n),([r,s])=>[r,s],()=>u(WT(n),([r,s])=>[r,s],()=>u(JT(n),([r,s])=>[r,s],()=>[])))),([r,s])=>u(Cp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[KC(t),n]),XT=e=>u(u(Hl(e),([t,n])=>u(YT(n),([r,s])=>[[t,r],s])),([t,n])=>[GC(t),n]),ZT=e=>u(u(XT(e),([t,n])=>[t,n],()=>u(oT(e),([t,n])=>[t,n],()=>u(ge(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function eA(e){const t=Np(`\`${e}\``);return h(t.length,2)?t[0]:Ot()}function tA(e){return e.join("|")}function nA(e){return e.slice(1,e.length-1)}function rA(e,t,n){return Ar(t,`${n}${e}`)}function sA(e,t){return Ar(e,`${t}${ev}`)}function oA(e,t){return Ar(e,`${t}${Om}`)}function iA(e,t){return Ar(e,`${t}${Fm}`)}function aA(e,t){return Lo(Ve([Me("false"),Me("true")]),e,t)}function cA(e,t){return Ar(e,`${t}${Dm}`)}function lA(e,t,n){return Ar(t,`${n}${nA(e)}`)}function dA(e,t,n){const r=ql(e,{});return Lo(r,t,n)}function uA(e,t,n){const r=Tr(e);return Lo(r,t,n)}function ng(e,t,n,r=[]){return Ie(e,(s,o)=>ng(o,t,n,[...r,Lo(s,[],"")]),()=>Ar(t,`${n}(${tA(r)})`))}function Lo(e,t,n){return hn(e)?uA(e.enum,t,n):_n(e)?oA(t,n):We(e)?rA(e.const,t,n):ts(e)?sA(t,n):jr(e)?aA(t,n):nn(e)?iA(t,n):On(e)?cA(t,n):zt(e)?lA(e.pattern,t,n):gA(e)?dA(e.parameters[0],t,n):ae(e)?ng(e.anyOf,t,n):pw}function Ar(e,t){return Ie(e,(n,r)=>Lo(n,r,t),()=>t)}function fA(e){return`^${Ar(e,"")}$`}function mA(e){const t=fA(e);return Hm(t)}function ql(e,t){return Ye(e)?ue(mA(e),{},t):rg(e,t)}function pA(e,t,n,r){const s=Wn(e,t,n);return ql(s,r)}function rg(e,t={}){return je("TemplateLiteral",[e],t)}function gA(e){return Yt(e)&&E(e,"action")&&h(e.action,"TemplateLiteral")}function sg(e){return ql(e,{})}function hA(e){const t=eA(e);return sg(t)}function bA(e,t={}){const n=ie(e)?hA(e):sg(e);return ue(n,{},t)}function zt(e){return we(e,"TemplateLiteral")}function og(e){return he({"~kind":"ExtendsUnion"},{inferred:e})}function zl(e){return ne(e)&&E(e,"~kind")&&E(e,"inferred")&&h(e["~kind"],"ExtendsUnion")&&ne(e.inferred)}function ee(e){return he({"~kind":"ExtendsTrue"},{inferred:e})}function Kl(e){return ne(e)&&E(e,"~kind")&&E(e,"inferred")&&h(e["~kind"],"ExtendsTrue")&&ne(e.inferred)}function xe(){return he({"~kind":"ExtendsFalse"},{})}function Ic(e){return ne(e)&&E(e,"~kind")&&h(e["~kind"],"ExtendsFalse")}function Kt(e){return zl(e)||Kl(e)}function St(e,t,n){return Kt(e)?t(e.inferred):n()}const kA=Object.freeze(Object.defineProperty({__proto__:null,ExtendsFalse:xe,ExtendsTrue:ee,ExtendsUnion:og,IsExtendsFalse:Ic,IsExtendsTrue:Kl,IsExtendsTrueLike:Kt,IsExtendsUnion:zl,Match:St},Symbol.toStringTag,{value:"Module"}));function xA(e,t,n,r){return St(Qe(e,n,r),s=>ee(gt(gt(e,s),{[t]:n})),()=>xe())}function yA(e,t){return ee(e)}function SA(e,t,n,r,s){return St(Qe(e,t,n),o=>St(Qe(o,t,r),i=>ee(i),()=>xe()),()=>St(Qe(e,t,s),o=>ee(o),()=>xe()))}function wA(e,t,n){const r=Tr(n);return Qe(e,t,r)}function ig(e,t,n){return Ie(n,(r,s)=>St(Qe(e,t,r),o=>ig(o,t,s),()=>xe()),()=>ee(e))}function vA(e,t,n){const r=sr(n);return Qe(e,t,r)}function ag(e,t,n){return Ie(n,(r,s)=>St(Qe(e,t,r),o=>ee(o),()=>ag(e,t,s)),()=>xe())}function yt(e,t,n){return Nn(n)?yA(e):gn(n)?SA(e,t,n.if,n.then,n.else):hn(n)?wA(e,t,n.enum):Zt(n)?xA(e,n.name,t,n.extends):Ue(n)?ig(e,t,n.allOf):zt(n)?vA(e,t,n.pattern):ae(n)?ag(e,t,n.anyOf):Cn(n)?ee(e):xe()}function IA(e,t,n){return Zt(n)?yt(e,t,n):Nn(n)||Cn(n)?ee(e):og(e)}function CA(e,t){const n=Di(e),r=Di(t);return n&&r||!n&&r?!0:!(n&&!r)}function jA(e,t,n,r){return ut(r)?CA(t,r)?Qe(e,n,r.items):xe():yt(e,t,r)}function TA(e,t,n){return ts(n)?ee(e):yt(e,t,n)}function AA(e,t,n){return jr(n)?ee(e):yt(e,t,n)}function EA(e,t,n,r,s){const o=Zt(r)?t:r,i=Zt(r)?r:t,a=Xt(t),l=Xt(r);return!a&&l?xe():St(Qe(e,o,i),d=>Gl(d,n,s),()=>xe())}function PA(e,t,n,r){return Ie(r,(s,o)=>EA(e,t,n,s,o),()=>Xt(t)?ee(e):xe())}function NA(e,t,n){return Ie(t,(r,s)=>PA(e,r,s,n),()=>ee(e))}function Gl(e,t,n){return NA(e,t,n)}function cg(e,t,n){return ns(n)?ee(e):Qe(e,t,n)}function OA(e,t,n,r){return Nn(r)||Cn(r)?ee(e):mn(r)?St(Gl(e,t,r.parameters),s=>cg(s,n,r.instanceType),()=>xe()):xe()}function $A(e,t,n,r,s){return St(Qe(e,t,s),()=>Qe(e,n,s),()=>Qe(e,r,s))}function RA(e,t,n){const r=Tr(t);return Qe(e,r,n)}function MA(e,t,n,r){return Nn(r)||Cn(r)?ee(e):pn(r)?St(Gl(e,t,r.parameters),s=>cg(s,n,r.returnType),()=>xe()):xe()}function FA(e,t,n){return _n(n)||nn(n)?ee(e):yt(e,t,n)}function DA(e,t,n){const r=rn(t);return Qe(e,r,n)}function pa(e,t,n){return t===n?ee(e):xe()}function _A(e,t,n){return We(n)?pa(e,t,n.const):ts(n)?ee(e):yt(e,Me(t),n)}function LA(e,t,n){return We(n)?pa(e,t,n.const):jr(n)?ee(e):yt(e,Me(t),n)}function UA(e,t,n){return We(n)?pa(e,t,n.const):nn(n)?ee(e):yt(e,Me(t),n)}function BA(e,t,n){return We(n)?pa(e,t,n.const):On(n)?ee(e):yt(e,Me(t),n)}function HA(e,t,n){return tt(t.const)?_A(e,t.const,n):ht(t.const)?LA(e,t.const,n):ye(t.const)?UA(e,t.const,n):ie(t.const)?BA(e,t.const,n):Ot()}function qA(e,t,n){return Zt(n)?yt(e,t,n):ee(e)}function zA(e,t,n){return $o(n)?ee(e):yt(e,t,n)}function KA(e,t,n){return nn(n)?ee(e):yt(e,t,n)}function GA(e,t,n){return Xt(t)?Xt(n)?ee(e):xe():ee(e)}function VA(e,t,n){return Zt(n)&&Rs(n.extends)?xe():St(Qe(e,t,n),r=>GA(r,t,n),()=>xe())}function WA(e,t){return e.reduce((n,r)=>r in t&&Kt(t[r])?{...n,...t[r].inferred}:Ot(),{})}function JA(e,t,n){const r={};for(const i of D(n))r[i]=i in t?VA({},t[i],n[i]):Xt(n[i])?Zt(n[i])?ee(gt(e,{[n[i].name]:n[i].extends})):ee(e):xe();const s=ml(r).every(i=>Kt(i)),o=s?WA(D(r),r):{};return s?ee(o):xe()}function QA(e,t,n){const r=JA(e,t,n);return Kt(r)?ee(gt(e,r.inferred)):xe()}function YA(e,t,n){return QA(e,t,n)}function XA(e,t){return D(t).reduce((n,r)=>({...n,[r]:E(e,r)?ae(n[r])?Ve([...n[r].anyOf,t[r]]):Ve([e[r],t[r]]):t[r]}),e)}function lg(e,t,n,r){return Ie(t,(s,o)=>St(Qe({},e[s],n),i=>lg(e,o,n,XA(r,i)),()=>xe()),()=>ee(r))}function ZA(e,t,n,r){const s=D(t);return lg(t,s,r,e)}function eE(e,t,n){return At(n)?ZA(e,t,kn(n),qt(n)):Le(n)?YA(e,t,n.properties):yt(e,Ae(t),n)}function tE(e,t){return h(D(t).length,0)?ee(e):xe()}function nE(e,t,n,r,s){return Qe(e,n,s)}function rE(e,t,n,r){return At(r)?nE(e,yc(t),n,yc(kn(r)),qt(r)):Le(r)?tE(e,r.properties):Nn(r)||Cn(r)?ee(e):xe()}function sE(e,t,n){return On(n)?ee(e):yt(e,t,n)}function oE(e,t,n){return Ro(n)?ee(e):yt(e,t,n)}function iE(e,t,n){const r=sr(t);return Qe(e,r,n)}function Cc(e,t){return he({"~kind":"Inferrable"},{name:e,type:t},{})}function Vl(e){return ne(e)&&E(e,"~kind")&&E(e,"name")&&E(e,"type")&&h(e["~kind"],"Inferrable")&&ie(e.name)&&ne(e.type)}function dg(e){return ua(e)?Zt(e.items)?ut(e.items.extends)?Cc(e.items.name,e.items.extends.items):Cn(e.items.extends)?Cc(e.items.name,e.items.extends):void 0:Ot():void 0}function ug(e){return Zt(e)?Cc(e.name,e.extends):void 0}function Wl(e,t,n=[]){return Ie(e,(r,s)=>St(Qe({},r,t),()=>Wl(s,t,[...n,r]),()=>{}),()=>n)}function aE(e,t,n,r){const s=Wl(n,r);return H(s)?ee(gt(e,{[t]:bn(s)})):xe()}function fg(e,t,n,r){const s=Wl(n,r);return H(s)?ee(gt(e,{[t]:Ve(s)})):xe()}function cE(e){return[...e].reverse()}function jc(e,t){return t?cE(e):e}function lE(e){const t=e.length>0?e[0]:void 0,n=Yt(t)?dg(t):void 0;return Yt(n)}function dE(e,t,n,r,s,o){return St(Qe(e,n,s),i=>mg(i,t,r,o),()=>xe())}function uE(e,t,n,r,s){const o=dg(r);return Vl(o)?aE(e,o.name,jc(n,t),o.type):Ie(n,(i,a)=>dE(e,t,i,a,r,s),()=>xe())}function fE(e,t,n,r){return Ie(r,(s,o)=>uE(e,t,n,s,o),()=>h(n.length,0)?ee(e):xe())}function mg(e,t,n,r){return fE(e,t,n,r)}function mE(e,t,n){const r=zo(e,Mt([],[]),n),s=lE(r);return mg(e,s,jc(t,s),jc(r,s))}function pg(e,t,n){const r=ug(n);return Vl(r)?fg(e,r.name,t,r.type):Ie(t,(s,o)=>St(Qe(e,s,n),i=>pg(i,o,n),()=>xe()),()=>ee(e))}function pE(e,t,n){const r=zo(e,Mt([],[]),t);return st(n)?mE(e,r,n.items):ut(n)?pg(e,r,n.items):yt(e,bn(r),n)}function gE(e,t,n){return ns(n)||Ds(n)?ee(e):yt(e,t,n)}function gg(e,t,n){return Ie(n,(r,s)=>St(Qe(e,t,r),o=>ee(o),()=>gg(e,t,s)),()=>xe())}function Tc(e,t,n){return Ie(t,(r,s)=>St(gg(e,r,n),o=>Tc(o,s,n),()=>xe()),()=>ee(e))}function hE(e,t,n){const r=ug(n);return Vl(r)?fg(e,r.name,t,r.type):ae(n)?Tc(e,t,n.anyOf):Tc(e,t,[n])}function bE(e,t,n){return Zt(n)?yt(e,t,n):Nn(n)||Cn(n)?ee(e):xe()}function kE(e,t,n){return ns(n)?ee(e):yt(e,t,n)}function Qe(e,t,n){return Nn(t)?IA(e,t,n):ut(t)?jA(e,t,t.items,n):ts(t)?TA(e,t,n):jr(t)?AA(e,t,n):mn(t)?OA(e,t.parameters,t.instanceType,n):gn(t)?$A(e,t.if,t.then,t.else,n):hn(t)?RA(e,t.enum,n):pn(t)?MA(e,t.parameters,t.returnType,n):_n(t)?FA(e,t,n):Ue(t)?DA(e,t.allOf,n):We(t)?HA(e,t,n):Rs(t)?qA(e,t,n):$o(t)?zA(e,t,n):nn(t)?KA(e,t,n):Le(t)?eE(e,t.properties,n):At(t)?rE(e,kn(t),qt(t),n):On(t)?sE(e,t,n):Ro(t)?oE(e,t,n):zt(t)?iE(e,t.pattern,n):st(t)?pE(e,t.items,n):Ds(t)?gE(e,t,n):ae(t)?hE(e,t.anyOf,n):Cn(t)?bE(e,t,n):ns(t)?kE(e,t,n):xe()}function xE(e,t){return rn([...e,Ae(t)])}function hg(e,t,n){return Ye(e)?ue(xE(e,t),{},n):Jl(e,t,n)}function yE(e,t,n,r,s){const o=Wn(e,t,n),i=ld(e,t,r);return hg(o,i,s)}function Jl(e,t,n={}){return je("Interface",[e,t],n)}function Ql(e){return Yt(e)&&E(e,"action")&&h(e.action,"Interface")}function SE(e,t,n={}){return hg(e,t,n)}function wE(e,t,n){return e.includes(n)?!0:bo([...e,n],t,t[n])}function qu(e,t,n){const r=Sm(n);return Ur(e,t,r)}function Ur(e,t,n){return Ie(n,(r,s)=>bo(e,t,r)?!0:Ur(e,t,s),()=>!1)}function bo(e,t,n){return kt(n)?wE(e,t,n.$ref):ut(n)?bo(e,t,n.items):mn(n)?Ur(e,t,[...n.parameters,n.instanceType]):pn(n)?Ur(e,t,[...n.parameters,n.returnType]):Ql(n)?qu(e,t,n.parameters[1]):Ue(n)?Ur(e,t,n.allOf):Le(n)?qu(e,t,n.properties):ae(n)?Ur(e,t,n.anyOf):st(n)?Ur(e,t,n.items):At(n)?bo(e,t,qt(n)):!1}function vE(e,t,n){return bo(e,t,n)}function IE(e,t){return t.reduce((n,r)=>vE([r],e,e[r])?[...n,r]:n,[])}function CE(e){const t=ym(e);return IE(e,t)}function jE(e,t,n){return n.includes(t)?n:t in e?ko(e,e[t],[...n,t]):Ot()}function zu(e,t,n){const r=Sm(t);return ws(e,r,n)}function ws(e,t,n){return t.reduce((r,s)=>ko(e,s,r),n)}function ko(e,t,n){return kt(t)?jE(e,t.$ref,n):ut(t)?ko(e,t.items,n):mn(t)?ws(e,[...t.parameters,t.instanceType],n):pn(t)?ws(e,[...t.parameters,t.returnType],n):Ql(t)?zu(e,t.parameters[1],n):Ue(t)?ws(e,t.allOf,n):Le(t)?zu(e,t.properties,n):ae(t)?ws(e,t.anyOf,n):st(t)?ws(e,t.items,n):At(t)?ko(e,qt(t),n):n}function TE(e,t,n){return ko(e,n,[t])}function AE(e){return wl()}function EE(e){return D(e).reduce((t,n)=>({...t,[n]:Hr(e[n])}),{})}function no(e){return e.reduce((t,n)=>[...t,Hr(n)],[])}function Hr(e){return kt(e)?AE(e.$ref):ut(e)?Cr(Hr(e.items),yl(e)):mn(e)?Eo(no(e.parameters),Hr(e.instanceType)):pn(e)?Po(no(e.parameters),Hr(e.returnType)):Ue(e)?Fn(no(e.allOf)):Le(e)?Ae(EE(e.properties)):At(e)?El(la(e),Hr(qt(e))):ae(e)?Ve(no(e.anyOf)):st(e)?bn(no(e.items)):e}function PE(e,t){return t in e?Hr(e[t]):Bt()}function NE(e){return PE(e.$defs,e.$ref)}function OE(e,t,n){const r=Wn(e,Mt([],[]),t),s=ld({},Mt([],[]),n);return rn([...r,Ae(s)])}function $E(e,t){return D(e).filter(r=>t.includes(r)).reduce((r,s)=>{const o=e[s],i=Ql(o)?OE(e,o.parameters[0],o.parameters[1]):o;return{...r,[s]:i}},{})}function RE(e,t,n){const r=TE(e,t,n),s=$E(e,r);return Oo(s,t)}function bg(e,t){return t in e?kt(e[t])?bg(e,e[t].$ref):e[t]:Tt()}function Uo(e,t){return bg(e,t)}function Ku(e){return Ht(e)?NE(e):wm(e)?Bt():e}function nr(e,t,n){const r=Ku(t),s=Ku(n);return Qe(e,r,s)}const Yl="equal",ME="disjoint",Xl="left-inside",Zl="right-inside";function ga(e,t){const n=[Cn(e)?xe():nr({},e,t),Cn(e)?ee({}):nr({},t,e)];return Kt(n[0])&&Kt(n[1])?Yl:Kt(n[0])&&Ic(n[1])?Xl:Ic(n[0])&&Kt(n[1])?Zl:ME}function FE(e,t){return t.filter(n=>ga(e,n)!==Zl)}function DE(e,t){const n=t.some(r=>{const s=ga(e,r);return h(s,Xl)||h(s,Yl)});return h(n,!1)}function _E(e,t){const n=Vr(e);return Nn(n)?[n]:DE(n,t)?[...FE(n,t),n]:t}function LE(e){return e.reduce((t,n)=>Le(n)?[...t,n]:Rs(n)?t:_E(n,t),[])}function kg(e){const t=LE(e);return ia(t)}function xg(e,t){return ue(Vr(e),{},t)}function UE(e,t,n,r){const s=G(e,t,n);return xg(s,r)}function io(e,t=[]){return Ts(e)&&h(e.action,"Conditional")?kt(e.parameters[0])?io(e.parameters[2],io(e.parameters[3],[...t,e.parameters[0].$ref])):io(e.parameters[2],io(e.parameters[3],t)):Ts(e)&&h(e.action,"Mapped")&&Ts(e.parameters[1])&&h(e.parameters[1].action,"KeyOf")&&kt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function BE(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function yg(e,t,n=[]){return Ie(e,(r,s)=>Ie(t,(o,i)=>yg(s,i,[...n,[o,r]]),()=>n),()=>n)}function HE(e){return zt(e)?sr(e.pattern):hn(e)?Tr(e.enum):e}function qE(e){const t=HE(e);return ae(t)?[...t.anyOf]:[t]}function zE(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Gu(e,t){return t.reduce((n,r)=>[...n,...zE(e,r)],[])}function Vu(e){return e.reduce((t,n)=>h(n[0],!0)?Gu(t,qE(n[1])):Gu(t,[n[1]]),[[]])}function KE(e,t,n){const r=io(n),s=BE(e,r),o=yg(t,s);return Ts(n)&&h(n.action,"Conditional")||Ts(n)&&h(n.action,"Mapped")?Vu(o):[t]}function GE(){return["(not-resolvable)",Tt()]}function VE(){return["(not-generic)",Tt()]}function WE(e,t,n){return[e,No(t,n)]}function JE(e,t,n){return t in e?Sg(e,t,e[t]):GE()}function Sg(e,t,n,r){return Sl(n)?WE(t,n.parameters,n.expression):kt(n)?JE(e,n.$ref):VE()}function QE(e,t,n){return Sg(e,"(anonymous)",t)}function YE(e,t,n){if(Zt(t)||td(t)||Kt(nr({},t,n)))return;const r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Wu(e,t,n,r,s){const o=G(e,t,s);return YE(n,o,r),gt(e,{[n]:o})}function XE(e,t,n,r,s){const o=G(e,t,n.extends),i=G(e,t,n.equals);return Ie(s,(a,l)=>Ac(Wu(e,t,n.name,o,a),t,r,l),()=>Ac(Wu(e,t,n.name,o,i),t,r,[]))}function Ac(e,t,n,r){return Ie(n,(s,o)=>XE(e,t,s,o,r),()=>e)}function ZE(e,t,n,r){return Ac(e,t,n,r)}let Ec=0,ed=0;function eP(){if(!Co(ed,Ao().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function tP(){eP(),ed++,Ec++}function nP(){Ec--,h(Ec,0)&&(ed=0)}function rP(e){return Yr(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function sP(e,t){return h(rP(e),t)}function oP(e,t,n,r,s,o){tP();try{const i=ZE(e,t,r,o),a=G(i,Mt([...t.callstack,n.$ref],t.visited),s);return G(i,Mt([],[]),a)}finally{nP()}}function iP(e,t,n,r,s,o){return o.reduce((i,a)=>{const l=oP(e,t,n,r,s,a);return[...i,l]},[])}function aP(e,t,n,r,s,o){const i=KE(r,o,s),a=iP(e,t,n,r,s,i);return h(a.length,1)?a[0]:or(a)}function wg(e,t,n,r){const s=Wn(e,t,r),o=QE(e,n),i=o[0],a=o[1];return Sl(a)?sP(t,i)?Pc(dn(i),s):aP(e,t,dn(i),a.parameters,a.expression,s):Pc(n,s)}function Pc(e,t){return he({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function cP(e,t){return wg({},Mt([],[]),e,t)}function td(e){return we(e,"Call")}function lP(e){return Pn(e,["~immutable"])}function dP(e,t){return ue(lP(e),{},t)}function uP(e,t,n,r){const s=G(e,t,n);return dP(s,r)}function fP(e,t){return e(t)}function mP(e,t){return ie(t)?Me(fP(e,t)):Me(t)}function pP(e,t){const n=sr(t);return _s(e,n)}function gP(e,t){const n=t.map(r=>_s(e,r));return Ve(n)}function _s(e,t){return We(t)?mP(e,t.const):zt(t)?pP(e,t.pattern):ae(t)?gP(e,t.anyOf):t}function vg(e,t={}){return je("Capitalize",[e],t)}function hP(e,t={}){return Tg(e,t)}function Ig(e,t={}){return je("Lowercase",[e],t)}function bP(e,t={}){return Ag(e,t)}function Cg(e,t={}){return je("Uncapitalize",[e],t)}function kP(e,t={}){return Eg(e,t)}function jg(e,t={}){return je("Uppercase",[e],t)}function xP(e,t={}){return Pg(e,t)}const yP=e=>e[0].toUpperCase()+e.slice(1),SP=e=>e.toLowerCase(),wP=e=>e[0].toLowerCase()+e.slice(1),vP=e=>e.toUpperCase();function Tg(e,t){return Ye([e])?ue(_s(yP,e),{},t):vg(e,t)}function Ag(e,t){return Ye([e])?ue(_s(SP,e),{},t):Ig(e,t)}function Eg(e,t){return Ye([e])?ue(_s(wP,e),{},t):Cg(e,t)}function Pg(e,t){return Ye([e])?ue(_s(vP,e),{},t):jg(e,t)}function IP(e,t,n,r){const s=G(e,t,n);return Tg(s,r)}function CP(e,t,n,r){const s=G(e,t,n);return Ag(s,r)}function jP(e,t,n,r){const s=G(e,t,n);return Eg(s,r)}function TP(e,t,n,r){const s=G(e,t,n);return Pg(s,r)}function Ng(e,t,n,r,s={}){return je("Conditional",[e,t,n,r],s)}function AP(e,t,n,r,s={}){return Og({},Mt([],[]),e,t,n,r,s)}function EP(e,t,n,r,s,o){const i=nr(e,n,r);return zl(i)?Ve([G(i.inferred,t,s),G(e,t,o)]):Kl(i)?G(i.inferred,t,s):G(e,t,o)}function Og(e,t,n,r,s,o,i){return Ye([n,r])?ue(EP(e,t,n,r,s,o),{},i):Ng(n,r,s,o,i)}function PP(e,t,n,r,s,o,i){const a=G(e,t,n),l=G(e,t,r);return Og(e,t,a,l,s,o,i)}function $g(e,t={}){return je("ConstructorParameters",[e],t)}function NP(e,t={}){return Rg(e,t)}function OP(e){const t=mn(e)?e.parameters:[],n=zo({},Mt([],[]),t);return bn(n)}function Rg(e,t){return Ye([e])?ue(OP(e),{},t):$g(e,t)}function $P(e,t,n,r){const s=G(e,t,n);return Rg(s,r)}function Mg(e,t,n={}){return je("Exclude",[e,t],n)}function RP(e,t,n={}){return nd(e,t,n)}function nd(e,t,n){return Ye([e,t])?ue(ep(e,t),{},n):Mg(e,t,n)}function MP(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return nd(o,i,s)}function Fg(e,t,n={}){return je("Extract",[e,t],n)}function FP(e,t,n={}){return Dg(e,t,n)}function DP(e,t){const n=nr({},e,t);return Kt(n)?[e]:[]}function _P(e,t){return e.reduce((n,r)=>[...n,...DP(r,t)],[])}function LP(e,t){const n=Vr(e),r=ae(n)?n.anyOf:[n],s=_P(r,t);return or(s)}function Dg(e,t,n){return Ye([e,t])?ue(LP(e,t),{},n):Fg(e,t,n)}function UP(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Dg(o,i,s)}function BP(e){return e.reduce((t,n)=>$m(n)?[...t,Me(n)]:t,[])}function rd(e){const t=BP(e);return Ve(t)}function sd(e,t,n={}){return je("Index",[e,t],n)}function HP(e,t,n={}){const r=H(t)?rd(t):t;return Hg(e,r,n)}function qP(e,t){const n=Uo(e,t);return ss(n)}function zP(e,t,n){const r=Ms(e,t,n);return ss(r)}function KP(e,t){const n=D(e).filter(m=>!E(t,m)),r=D(t).filter(m=>!E(e,m)),s=D(e).filter(m=>E(t,m)),o=n.reduce((m,p)=>({...m,[p]:e[p]}),{}),i=r.reduce((m,p)=>({...m,[p]:t[p]}),{}),a=s.reduce((m,p)=>({...m,[p]:rn([e[p],t[p]])}),{}),l=gt(o,i);return gt(l,a)}function GP(e){return e.reduce((t,n)=>KP(t,ss(n)),{})}function VP(e){const t=Iv(bn(e));return ss(t)}function WP(e,t){return D(e).filter(s=>s in t).reduce((s,o)=>({...s,[o]:or([e[o],t[o]])}),{})}function _g(e,t){return Ie(e,(n,r)=>_g(r,WP(t,ss(n))),()=>t)}function JP(e){return Ie(e,(t,n)=>_g(n,ss(t)),()=>Ot())}function ss(e){return Ht(e)?qP(e.$defs,e.$ref):gn(e)?zP(e.if,e.then,e.else):Ue(e)?GP(e.allOf):ae(e)?JP(e.anyOf):st(e)?VP(e.items):Le(e)?e.properties:{}}function od(e){const t=ss(e);return Ae(t)}const QP=new RegExp("^(?:0|[1-9][0-9]*)$");function id(e){const t=`${e}`;return QP.test(t)?parseInt(t):e}function YP(e){return Me(id(e))}function Ju(e){return e.map(t=>Lg(t))}function Lg(e){return Ue(e)?Fn(Ju(e.allOf)):ae(e)?Ve(Ju(e.anyOf)):We(e)?YP(e.const):e}function XP(e,t){const n=Lg(t),r=nr({},n,Sr());return Kt(r)?e:We(t)&&h(t.const,"length")?Sr():Tt()}function ZP(e,t){const n=Uo(e,t);return os(n)}function e1(e,t,n){const r=Ms(e,t,n);return os(r)}function t1(e){const t=Tr(e);return os(t)}function n1(e){const t=rn(e);return os(t)}function r1(e){return[`${e}`]}function s1(e){const t=sr(e);return os(t)}function o1(e){return e.reduce((t,n)=>[...t,...os(n)],[])}function os(e){return Ht(e)?ZP(e.$defs,e.$ref):gn(e)?e1(e.if,e.then,e.else):hn(e)?t1(e.enum):Ue(e)?n1(e.allOf):We(e)?r1(e.const):zt(e)?s1(e.pattern):ae(e)?o1(e.anyOf):[]}function ad(e){return os(e)}function ro(e,t){return t.map(n=>fo(e,n))}function fo(e,t){return ut(t)?Cr(fo(e,t.items)):mn(t)?Eo(ro(e,t.parameters),fo(e,t.instanceType)):pn(t)?Po(ro(e,t.parameters),fo(e,t.returnType)):st(t)?bn(ro(e,t.items)):ae(t)?Ve(ro(e,t.anyOf)):Ue(t)?Fn(ro(e,t.allOf)):sp(t)?Ae(e):t}function i1(e,t){return fo(e,t)}function a1(e,t){const n=t in e?e[t]:Tt();return i1(e,n)}function Ug(e,t){return t.reduce((n,r)=>[...n,a1(e,r)],[])}function c1(e,t){const n=ad(t),r=Ug(e,n);return or(r)}const l1=new RegExp(Fo);function d1(e){return e.filter(n=>l1.test(n))}function u1(e){const t=ym(e),n=d1(t),r=Ug(e,n);return or(r)}function f1(e,t){return nn(t)?u1(e):c1(e,t)}function m1(e){return Me(id(e))}function Qu(e){return e.map(t=>Bg(t))}function Bg(e){return Ue(e)?Fn(Qu(e.allOf)):ae(e)?Ve(Qu(e.anyOf)):We(e)?m1(e.const):e}function p1(e,t){return e.reduceRight((n,r,s)=>{const o=nr({},Me(s),t);return Kt(o)?[r,...n]:n},[])}function g1(e,t){const n=Bg(t),r=p1(e,n);return Fs(r)}function h1(e){return Fs(e)}function b1(e,t){return We(t)&&h(t.const,"length")?Me(e.length):nn(t)||_n(t)?h1(e):g1(e,t)}function k1(e,t){return ut(e)?XP(e.items,t):Le(e)?f1(e.properties,t):st(e)?b1(e.items,t):Tt()}function x1(e){return Ht(e)||gn(e)||Ue(e)||ae(e)?od(e):e}function Hg(e,t,n){return Ye([e,t])?ue(k1(x1(e),t),{},n):sd(e,t,n)}function y1(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Hg(o,i,s)}function qg(e,t={}){return je("InstanceType",[e],t)}function S1(e,t={}){return zg(e,t)}function w1(e){return mn(e)?e.instanceType:Tt()}function zg(e,t){return Ye([e])?ue(w1(e),{},t):qg(e,t)}function v1(e,t,n,r={}){const s=G(e,t,n);return zg(s,r)}function cd(e,t={}){return je("KeyOf",[e],t)}function I1(e,t={}){return Kg(e,t)}function C1(){return Ve([Sr(),Ln(),Tl()])}function j1(e){return Sr()}function T1(e){return e.reduce((n,r)=>$m(r)?[...n,Me(id(r))]:Ot(),[])}function A1(e){const t=D(e),n=T1(t);return Fs(n)}function E1(e){return la(e)}function P1(e){const t=e.map((n,r)=>Me(r));return Fs(t)}function N1(e){return Nn(e)?C1():ut(e)?j1(e.items):Le(e)?A1(e.properties):At(e)?E1(e):st(e)?P1(e.items):Tt()}function O1(e){return Ht(e)||gn(e)||Ue(e)||ae(e)?od(e):e}function Kg(e,t){return Ye([e])?ue(N1(O1(e)),{},t):cd(e,t)}function $1(e,t,n,r){const s=G(e,t,n);return Kg(s,r)}function Nc(e,t,n,r,s={}){return je("Mapped",[e,t,n,r],s)}function R1(e,t,n,r,s={}){return Gg({},Mt([],[]),e,t,n,r,s)}function M1(e){const t=sr(e);return ha(t)}function F1(e){return e.reduce((t,n)=>[...t,...ha(n)],[])}function D1(e){const t=Tr(e);return ha(t)}function _1(e){return ye(e)?[Me(`${e}`)]:[Me(e)]}function ha(e){return hn(e)?D1(e.enum):We(e)?_1(e.const):zt(e)?M1(e.pattern):ae(e)?F1(e.anyOf):[e]}function L1(e){return ha(e)}function U1(e){return zt(e)?sr(e.pattern):e}function B1(e,t,n,r,s,o){const i=gt(e,{[n.name]:r}),a=G(i,t,s),l=U1(a),d=G(i,t,o);return Rm(l)||Mm(l)?{[l.const]:d}:{}}function H1(e,t,n,r,s,o){return r.reduce((i,a)=>[...i,B1(e,t,n,a,s,o)],[])}function q1(e){return e.reduce((t,n)=>[...t,Ae(n)],[])}function z1(e,t,n,r,s,o){const i=L1(r),a=H1(e,t,n,i,s,o),l=q1(a);return rn(l)}function Gg(e,t,n,r,s,o,i){return Ye([r])?ue(z1(e,t,n,r,s,o),{},i):Nc(n,r,s,o,i)}function K1(e,t,n,r,s,o,i){const a=G(e,t,r);return Gg(e,t,n,a,s,o,i)}function G1(e,t,n){const r=gt(e,t);return D(t).filter(o=>n.includes(o)).reduce((o,i)=>({...o,[i]:RE(r,i,t[i])}),{})}function V1(e,t,n){const r=gt(e,t);return D(t).filter(o=>!n.includes(o)).reduce((o,i)=>({...o,[i]:G(r,Mt([],[]),t[i])}),{})}function W1(e,t,n){const r=CE(t),s=G1(e,t,r),o=V1(e,t,r),i={...s,...o};return ue(i,{},n)}function Vg(e,t,n,r){return W1(e,n,r)}function Wg(e,t={}){return je("NonNullable",[e],t)}function J1(e,t={}){return Jg(e,t)}function Q1(e){const t=Ve([jl(),Pl()]);return nd(e,t,{})}function Jg(e,t){return Ye([e])?ue(Q1(e),{},t):Wg(e,t)}function Y1(e,t,n,r){const s=G(e,t,n);return Jg(s,r)}function Qg(e,t,n={}){return je("Omit",[e,t],n)}function X1(e,t,n={}){const r=H(t)?rd(t):t;return Xg(e,r,n)}function Yg(e){const t=od(e);return Le(t)?t.properties:Ot()}function Z1(e,t){return D(e).reduce((r,s)=>t.includes(s)?r:{...r,[s]:e[s]},{})}function eN(e,t){const n=Yg(e),r=ad(t),s=Z1(n,r);return Ae(s)}function Xg(e,t,n){return Ye([e,t])?ue(eN(e,t),{},n):Qg(e,t,n)}function tN(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Xg(o,i,s)}function Zg(e,t={}){return je("Parameters",[e],t)}function nN(e,t={}){return eh(e,t)}function rN(e){const t=pn(e)?e.parameters:[],n=zo({},Mt([],[]),t);return bn(n)}function eh(e,t){return Ye([e])?ue(rN(e),{},t):Zg(e,t)}function sN(e,t,n,r){const s=G(e,t,n);return eh(s,r)}function th(e,t={}){return je("Partial",[e],t)}function oN(e,t={}){return nh(e,t)}function iN(e,t){const n=Uo(e,t),r=Bo(n);return Oo(gt(e,{[t]:r}),t)}function aN(e,t,n){const r=Ms(e,t,n);return Bo(r)}function cN(e){const t=rn(e);return Bo(t)}function lN(e){const t=e.map(n=>Bo(n));return Ve(t)}function dN(e){const t=D(e).reduce((r,s)=>({...r,[s]:Mi(e[s])}),{});return Ae(t)}function Bo(e){return Ht(e)?iN(e.$defs,e.$ref):gn(e)?aN(e.if,e.then,e.else):Ue(e)?cN(e.allOf):ae(e)?lN(e.anyOf):Le(e)?dN(e.properties):Ae({})}function nh(e,t){return Ye([e])?ue(Bo(e),{},t):th(e,t)}function uN(e,t,n,r){const s=G(e,t,n);return nh(s,r)}function rh(e,t,n={}){return je("Pick",[e,t],n)}function fN(e,t,n={}){const r=H(t)?rd(t):t;return sh(e,r,n)}function mN(e,t){return D(e).reduce((r,s)=>t.includes(s)?gt(r,{[s]:e[s]}):r,{})}function pN(e,t){const n=Yg(e),r=ad(t),s=mN(n,r);return Ae(s)}function sh(e,t,n){return Ye([e,t])?ue(pN(e,t),{},n):rh(e,t,n)}function gN(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return sh(o,i,s)}function oh(e,t={}){return je("ReadonlyObject",[e],t)}function ih(e,t={}){return ah(e,t)}const hN=ih;function bN(e){return ud(Cr(e))}function kN(e,t){const n=Uo(e,t),r=Ho(n);return Oo(gt(e,{[t]:r}),t)}function xN(e,t,n){const r=Ms(e,t,n);return Ho(r)}function yN(e){const t=rn(e);return Ho(t)}function SN(e){const t=D(e).reduce((r,s)=>({...r,[s]:_i(e[s])}),{});return Ae(t)}function wN(e){return ud(bn(e))}function vN(e){const t=e.map(n=>Ho(n));return Ve(t)}function Ho(e){return ut(e)?bN(e.items):Ht(e)?kN(e.$defs,e.$ref):gn(e)?xN(e.if,e.then,e.else):Ue(e)?yN(e.allOf):Le(e)?SN(e.properties):st(e)?wN(e.items):ae(e)?vN(e.anyOf):e}function ah(e,t){return Ye([e])?ue(Ho(e),{},t):oh(e)}function IN(e,t,n,r){const s=G(e,t,n);return ah(s,r)}function CN(e,t,n,r){return t.visited.includes(r)?n:r in e?G(e,Mt(t.callstack,[...t.visited,r]),e[r]):n}function jN(e,t){const n=Uo(e,t),r=qo(n);return Oo(gt(e,{[t]:r}),t)}function TN(e,t,n){const r=Ms(e,t,n);return qo(r)}function AN(e){const t=rn(e);return qo(t)}function EN(e){const t=e.map(n=>qo(n));return Ve(t)}function PN(e){const t=D(e).reduce((r,s)=>({...r,[s]:Qm(e[s])}),{});return Ae(t)}function qo(e){return Ht(e)?jN(e.$defs,e.$ref):gn(e)?TN(e.if,e.then,e.else):Ue(e)?AN(e.allOf):ae(e)?EN(e.anyOf):Le(e)?PN(e.properties):Ae({})}function ch(e,t={}){return je("Required",[e],t)}function NN(e,t={}){return lh(e,t)}function lh(e,t){return Ye([e])?ue(qo(e),{},t):ch(e,t)}function ON(e,t,n,r){const s=G(e,t,n);return lh(s,r)}function dh(e,t={}){return je("ReturnType",[e],t)}function $N(e,t={}){return uh(e,t)}function RN(e){return pn(e)?e.returnType:Tt()}function uh(e,t){return Ye([e])?ue(RN(e),{},t):dh(e,t)}function MN(e,t,n,r={}){const s=G(e,t,n);return uh(s,r)}function fh(e,t){return je("With",[e,t],{})}function mh(e,t){return ph(e,t)}function ph(e,t){return Ye([e])?ue(e,{},t):fh(e,t)}function FN(e,t,n,r){const s=G(e,t,n);return ph(s,r)}function DN(e){return ua(e)?st(e.items)?gh(e.items.items):Zt(e.items)?[e]:kt(e.items)?[e]:[Tt()]:[e]}function gh(e){return e.reduce((n,r)=>[...n,...DN(r)],[])}function Mt(e,t){return{callstack:e,visited:t}}function Ye(e){return Ie(e,(t,n)=>kt(t)?!1:Ye(n),()=>!0)}function ld(e,t,n){return D(n).reduce((r,s)=>({...r,[s]:G(e,t,n[s])}),{})}function zo(e,t,n){const r=Wn(e,t,n);return gh(r)}function Wn(e,t,n){return n.map(r=>G(e,t,r))}function _N(e,t){const n=Xt(e)?xl(t,{}):t,r=Li(e)?kl(n,{}):n;return Di(e)?dd(r,{}):r}function LN(e,t,n,r,s){return h(n,"AddImmutable")?HN(e,t,r[0],s):h(n,"RemoveImmutable")?uP(e,t,r[0],s):h(n,"AddReadonly")?lw(e,t,r[0],s):h(n,"RemoveReadonly")?kv(e,t,r[0],s):h(n,"AddOptional")?uw(e,t,r[0],s):h(n,"RemoveOptional")?wv(e,t,r[0],s):h(n,"Capitalize")?IP(e,t,r[0],s):h(n,"Conditional")?PP(e,t,r[0],r[1],r[2],r[3],s):h(n,"ConstructorParameters")?$P(e,t,r[0],s):h(n,"Evaluate")?UE(e,t,r[0],s):h(n,"Exclude")?MP(e,t,r[0],r[1],s):h(n,"Extract")?UP(e,t,r[0],r[1],s):h(n,"Index")?y1(e,t,r[0],r[1],s):h(n,"InstanceType")?v1(e,t,r[0],s):h(n,"Interface")?yE(e,t,r[0],r[1],s):h(n,"KeyOf")?$1(e,t,r[0],s):h(n,"Lowercase")?CP(e,t,r[0],s):h(n,"Mapped")?K1(e,t,r[0],r[1],r[2],r[3],s):h(n,"Module")?Vg(e,t,r[0],s):h(n,"NonNullable")?Y1(e,t,r[0],s):h(n,"Pick")?gN(e,t,r[0],r[1],s):h(n,"Parameters")?sN(e,t,r[0],s):h(n,"Partial")?uN(e,t,r[0],s):h(n,"Omit")?tN(e,t,r[0],r[1],s):h(n,"ReadonlyObject")?IN(e,t,r[0],s):h(n,"Record")?Jv(e,t,r[0],r[1],s):h(n,"Required")?ON(e,t,r[0],s):h(n,"ReturnType")?MN(e,t,r[0],s):h(n,"TemplateLiteral")?pA(e,t,r[0],s):h(n,"Uncapitalize")?jP(e,t,r[0],s):h(n,"Uppercase")?TP(e,t,r[0],s):h(n,"With")?FN(e,t,r[0],r[1]):je(n,r,s)}function UN(e,t,n){const r=kt(n)?CN(e,t,n,n.$ref):ut(n)?Cr(G(e,t,n.items),yl(n)):td(n)?wg(e,t,n.target,n.arguments):mn(n)?Eo(Wn(e,t,n.parameters),G(e,t,n.instanceType),fw(n)):pn(n)?Po(Wn(e,t,n.parameters),G(e,t,n.returnType),mw(n)):gn(n)?Fi(G(e,t,n.if),G(e,t,n.then),G(e,t,n.else),xw(n)):Ue(n)?Fn(Wn(e,t,n.allOf),Iw(n)):Le(n)?Ae(ld(e,t,n.properties),bw(n)):At(n)?Qv(kn(n),G(e,t,qt(n))):ua(n)?da(G(e,t,n.items)):st(n)?bn(zo(e,t,n.items),hv(n)):ae(n)?Ve(Wn(e,t,n.anyOf),av(n)):n;return _N(n,r)}function G(e,t,n){return Ts(n)?LN(e,t,n.action,n.parameters,n.options):UN(e,t,n)}function Ls(e,t){return G(e,Mt([],[]),t)}function BN(e){return ue(e,{"~immutable":!0},{})}function dd(e,t){return ue(BN(e),{},t)}function HN(e,t,n,r){const s=G(e,t,n);return dd(s,r)}function qN(e,t={}){return je("AddImmutable",[e],t)}function ud(e,t={}){return dd(e,t)}function zN(e,t={}){return je("Evaluate",[e],t)}function Un(e,t={}){return xg(e,t)}function KN(e,t={}){return je("Module",[e],t)}function GN(e,t={}){return Vg({},Mt([],[]),e,t)}function VN(e,t){const n=ga(e,t);return h(n,"right-inside")||h(n,"disjoint")?1:0}function hh(e,t,n=[]){return Ie(t,(r,s)=>h(VN(e,r),1)?hh(e,s,[...n,r]):[...n,e,...t],()=>[...n,e])}function bh(e,t=[]){return Ie(e,(n,r)=>bh(r,hh(n,t)),()=>t)}function WN(e){return bh(e)}function JN(...e){const[t,n,r]=ct(e,{2:(i,a)=>ie(i)?[{},i,a]:[i,a,{}],3:(i,a,l)=>[i,a,l],1:i=>[{},i,{}]}),s=ZT(n),o=H(s)&&h(s.length,2)?G(t,Mt([],[]),s[0]):Tt();return ue(o,{},r)}const f=Object.freeze(Object.defineProperty({__proto__:null,Any:wl,Array:Cr,BigInt:Cl,Boolean:Nm,Call:cP,Capitalize:hP,Codec:vl,Conditional:AP,Constructor:Eo,ConstructorParameters:NP,Cyclic:Oo,Decode:Vw,DecodeBuilder:Pm,Dependent:Fi,Encode:Ww,EncodeBuilder:Em,Enum:vw,Evaluate:Un,Exclude:RP,Extends:nr,ExtendsResult:kA,Extract:FP,Function:Po,Generic:No,Identifier:xc,Immutable:Jw,Index:HP,Infer:bc,InstanceType:S1,Instantiate:Ls,Integer:oa,Interface:SE,Intersect:Fn,IsAny:Nn,IsArray:ut,IsBigInt:ts,IsBoolean:jr,IsCall:td,IsCodec:en,IsConstructor:mn,IsCyclic:Ht,IsDependent:gn,IsEnum:hn,IsEnumValue:ww,IsFunction:pn,IsGeneric:Sl,IsIdentifier:tv,IsImmutable:Di,IsInfer:Zt,IsInteger:_n,IsIntersect:Ue,IsKind:we,IsLiteral:We,IsNever:Rs,IsNull:$o,IsNumber:nn,IsObject:Le,IsOptional:Xt,IsParameter:iv,IsReadonly:Li,IsRecord:At,IsRef:kt,IsRefine:Il,IsRest:ua,IsSchema:Yt,IsString:On,IsSymbol:Ro,IsTemplateLiteral:zt,IsThis:sp,IsTuple:st,IsUndefined:Ds,IsUnion:ae,IsUnknown:Cn,IsUnsafe:wm,IsVoid:ns,KeyOf:I1,Literal:Me,Lowercase:bP,Mapped:R1,Module:GN,Never:Tt,NonNullable:J1,Null:jl,Number:Sr,Object:Ae,Omit:X1,Optional:gw,Parameter:Mo,Parameters:nN,Partial:oN,Pick:fN,Readonly:Qw,ReadonlyObject:ih,ReadonlyType:hN,Record:El,RecordKey:la,RecordPattern:kn,RecordValue:qt,Ref:dn,Refine:Xw,Required:NN,Rest:da,ReturnType:$N,Script:JN,String:Ln,Symbol:Tl,TemplateLiteral:bA,This:rp,Tuple:bn,Uncapitalize:kP,Undefined:Pl,Union:Ve,Unknown:Bt,Unsafe:kw,Uppercase:xP,Void:op,With:mh},Symbol.toStringTag,{value:"Module"}));function ba(e){return E(e,"~refine")&&H(e["~refine"])&&dt(e["~refine"],0,t=>ne(t)&&E(t,"check")&&E(t,"error")&&In(t.check)&&In(t.error))}function tn(e){return ne(e)&&!H(e)}function Ko(e){return ht(e)}function _e(e){return tn(e)||Ko(e)}function Go(e){return E(e,"additionalItems")&&_e(e.additionalItems)}function ar(e){return E(e,"additionalProperties")&&_e(e.additionalProperties)}function ka(e){return E(e,"allOf")&&H(e.allOf)&&e.allOf.every(t=>_e(t))}function Hi(e){return E(e,"$anchor")&&ie(e.$anchor)}function xa(e){return E(e,"anyOf")&&H(e.anyOf)&&e.anyOf.every(t=>_e(t))}function ya(e){return E(e,"const")}function is(e){return E(e,"contains")&&_e(e.contains)}function QN(e){return E(e,"contentEncoding")&&ie(e.contentEncoding)}function YN(e){return E(e,"contentMediaType")&&ie(e.contentMediaType)}function Er(e){return E(e,"default")}function XN(e){return E(e,"$defs")&&ne(e.$defs)&&Object.values(e.$defs).every(t=>_e(t))}function Vo(e){return E(e,"dependencies")&&ne(e.dependencies)&&Object.values(e.dependencies).every(t=>_e(t)||H(t)&&t.every(n=>ie(n)))}function Wo(e){return E(e,"dependentRequired")&&ne(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>H(t)&&t.every(n=>ie(n)))}function Jo(e){return E(e,"dependentSchemas")&&ne(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>_e(t))}function Jr(e){return E(e,"$dynamicAnchor")&&ie(e.$dynamicAnchor)}function Sa(e){return E(e,"$dynamicRef")&&ie(e.$dynamicRef)}function wa(e){return E(e,"else")&&_e(e.else)}function va(e){return E(e,"enum")&&H(e.enum)}function Qo(e){return E(e,"exclusiveMaximum")&&(ye(e.exclusiveMaximum)||tt(e.exclusiveMaximum))}function Pr(e){return E(e,"exclusiveMinimum")&&(ye(e.exclusiveMinimum)||tt(e.exclusiveMinimum))}function Us(e){return E(e,"format")&&ie(e.format)}function vr(e){return E(e,"$id")&&ie(e.$id)}function Ia(e){return E(e,"if")&&_e(e.if)}function Nr(e){return E(e,"items")&&(_e(e.items)||H(e.items)&&e.items.every(t=>_e(t)))}function Ca(e){return Nr(e)&&H(e.items)}function ZN(e){return Nr(e)&&!H(e.items)}function Yo(e){return E(e,"maximum")&&(ye(e.maximum)||tt(e.maximum))}function Xo(e){return E(e,"maxContains")&&ye(e.maxContains)}function Bs(e){return E(e,"maxItems")&&ye(e.maxItems)}function Zo(e){return E(e,"maxLength")&&ye(e.maxLength)}function ei(e){return E(e,"maxProperties")&&ye(e.maxProperties)}function Or(e){return E(e,"minimum")&&(ye(e.minimum)||tt(e.minimum))}function as(e){return E(e,"minContains")&&ye(e.minContains)}function cs(e){return E(e,"minItems")&&ye(e.minItems)}function Hs(e){return E(e,"minLength")&&ye(e.minLength)}function qs(e){return E(e,"minProperties")&&ye(e.minProperties)}function ti(e){return E(e,"multipleOf")&&(ye(e.multipleOf)||tt(e.multipleOf))}function ja(e){return E(e,"not")&&_e(e.not)}function Ta(e){return E(e,"oneOf")&&H(e.oneOf)&&e.oneOf.every(t=>_e(t))}function zs(e){return E(e,"pattern")&&(ie(e.pattern)||e.pattern instanceof RegExp)}function ls(e){return E(e,"patternProperties")&&ne(e.patternProperties)&&Object.values(e.patternProperties).every(t=>_e(t))}function cr(e){return E(e,"prefixItems")&&H(e.prefixItems)&&e.prefixItems.every(t=>_e(t))}function ds(e){return E(e,"properties")&&ne(e.properties)&&Object.values(e.properties).every(t=>_e(t))}function ni(e){return E(e,"propertyNames")&&(ne(e.propertyNames)||_e(e.propertyNames))}function kh(e){return E(e,"$recursiveAnchor")&&ht(e.$recursiveAnchor)}function ji(e){return kh(e)&&h(e.$recursiveAnchor,!0)}function Aa(e){return E(e,"$recursiveRef")&&ie(e.$recursiveRef)}function Ea(e){return E(e,"$ref")&&ie(e.$ref)}function lr(e){return E(e,"required")&&H(e.required)&&e.required.every(t=>ie(t))}function Pa(e){return E(e,"then")&&_e(e.then)}function ri(e){return E(e,"type")&&(ie(e.type)||H(e.type)&&e.type.every(t=>ie(t)))}function Ir(e){return E(e,"uniqueItems")&&ht(e.uniqueItems)}function Ks(e){return E(e,"unevaluatedItems")&&_e(e.unevaluatedItems)}function Gs(e){return E(e,"unevaluatedProperties")&&_e(e.unevaluatedProperties)}function eO(e){return Ks(e)||Gs(e)||$s(D(e),t=>qi(e[t]))}function tO(e){return $s(e,t=>qi(t))}function qi(e){return H(e)?tO(e):ne(e)?eO(e):!1}function xh(e,t){return qi(t)||$s(D(e),n=>qi(e[n]))}class yh{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return Ke(de("context","Push"),[])}Pop(){return Ke(de("context","Pop"),[])}AddIndex(t){return Ke(de("context","AddIndex"),[t])}AddKey(t){return Ke(de("context","AddKey"),[t])}Merge(t){return Ke(de("context","Merge"),[t])}}class Bn{constructor(){const t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){const t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(const n of t)n.GetIndices().forEach(r=>this.GetIndices().add(r)),n.GetKeys().forEach(r=>this.GetKeys().add(r));return!0}}class fd extends Bn{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}}class Hn extends fd{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}}const zi={identifier:"External",variables:[]};function us(e){const t=`External[${zi.variables.length}]`;return zi.variables.push(e),t}function Sh(){zi.variables=[]}function wh(){return{...zi}}function vh(e,t,n,r){const s=us(n["~refine"].map(o=>o));return Dn(s,z(0),["refinement","_"],Ke(de("refinement","check"),[r]))}function Ih(e,t,n,r){return dt(n["~refine"],0,(s,o)=>s.check(r))}function Ch(e,t,n,r,s,o){return jt(s["~refine"],0,(i,a)=>i.check(o)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:r,params:{index:a,message:i.error(o)}}))}let nO=0;function at(){return`var_${nO++}`}function md(e){return Nr(e)&&H(e.items)}function rO(e,t,n,r){const[s,o]=[at(),at()],i=$n(e,t,n.additionalItems,s),a=pl(o,z(n.items.length)),l=t.AddIndex(o);return Dn(r,z(0),[s,o],qe(a,wt(i,l)))}function sO(e,t,n,r){const[s,o]=[at(),at()],i=$n(e,t,n.additionalItems,s),a=pl(o,z(n.items.length));return Dn(r,z(0),[s,o],qe(a,i))}function jh(e,t,n,r){return md(n)?t.UseUnevaluated()?rO(e,t,n,r):sO(e,t,n,r):z(!0)}function Th(e,t,n,r){return md(n)?dt(r,0,(o,i)=>Co(i,n.items.length)||$r(e,t,n.additionalItems,o)&&t.AddIndex(i)):!0}function Ah(e,t,n,r,s,o){return md(s)?dt(o,0,(a,l)=>{const d=`${n}/additionalItems`,m=`${r}/${l}`;return Co(l,s.items.length)||Rr(e,t,d,m,s.additionalItems,a)&&t.AddIndex(l)}):!0}function oO(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function pd(e){const t=[];return ls(e)&&t.push(...D(e.patternProperties)),ds(e)&&t.push(...D(e.properties).map(oO)),h(t.length,0)?"(?!)":`(${t.join("|")})`}function Eh(e,t,n){return lr(t)&&ds(t)&&!ls(t)&&h(t.additionalProperties,!1)&&h(D(t.properties).length,t.required.length)}function Ph(e,t,n){return Gt(de(Ke(de("Object","getOwnPropertyNames"),[n]),"length"),z(t.required.length))}function Nh(e,t,n,r){const[s,o]=[at(),at()],i=us(new RegExp(pd(n))),a=$n(e,t,n.additionalProperties,`${r}[${s}]`),l=Ke(de(i,"test"),[s]),d=t.AddKey(s),m=t.UseUnevaluated()?qe(l,wt(a,d)):qe(l,a);return Dn(es(r),z(0),[s,o],m)}function Oh(e,t,n,r){return Eh(t,n)?Ph(t,n,r):Nh(e,t,n,r)}function $h(e,t,n,r){const s=new RegExp(pd(n));return dt(D(r),0,(i,a)=>s.test(i)||$r(e,t,n.additionalProperties,r[i])&&t.AddKey(i))}function Rh(e,t,n,r,s,o){const i=new RegExp(pd(s)),a=[];return jt(D(o),0,(d,m)=>{const p=`${n}/additionalProperties`,g=`${r}/${d}`,x=new Hn,b=i.test(d)||Rr(e,x,p,g,s.additionalProperties,o[d])&&t.AddKey(d);return b||a.push(d),b})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:r,params:{additionalProperties:a}})}function si(e,t,n,r,s){const o=Qn("results","[]"),i=n.map((m,p)=>Qn(`context_${p}`,gl("CheckContext",[]))),a=n.map((m,p)=>Qn(`condition_${p}`,Ke(xr(["context"],ot(e,t,m,r)),[`context_${p}`]))),l=n.map((m,p)=>gm(`condition_${p}`,Ke(de("results","push"),[`context_${p}`]))),d=ra(wt(s,t.Merge("results")));return Ke(xr([],na([o,...i,...a,...l,d])),[])}function iO(e,t,n,r){return si(e,t,n.allOf,r,Gt(de("results","length"),z(n.allOf.length)))}function aO(e,t,n,r){return It(n.allOf.map(s=>ot(e,t,s,r)))}function Mh(e,t,n,r){return t.UseUnevaluated()?iO(e,t,n,r):aO(e,t,n,r)}function Fh(e,t,n,r){const s=n.allOf.reduce((o,i)=>{const a=new Bn;return it(e,a,i,r)?[...o,a]:o},[]);return h(s.length,n.allOf.length)&&t.Merge(s)}function Dh(e,t,n,r,s,o){const i=[],a=s.allOf.reduce((d,m,p)=>{const g=`${n}/allOf/${p}`,x=new Hn,b=Ct(e,x,g,r,m,o);return b||i.push(x),b?[...d,x]:d},[]),l=h(a.length,s.allOf.length)&&t.Merge(a);return l||i.forEach(d=>d.GetErrors().forEach(m=>t.AddError(m))),l}function cO(e,t,n,r){return si(e,t,n.anyOf,r,fm(de("results","length"),z(0)))}function lO(e,t,n,r){return hl(n.anyOf.map(s=>ot(e,t,s,r)))}function _h(e,t,n,r){return t.UseUnevaluated()?cO(e,t,n,r):lO(e,t,n,r)}function Lh(e,t,n,r){const s=n.anyOf.reduce((o,i)=>{const a=new Bn;return it(e,a,i,r)?[...o,a]:o},[]);return Yr(s.length,0)&&t.Merge(s)}function Uh(e,t,n,r,s,o){const i=[],a=s.anyOf.reduce((d,m,p)=>{const g=new Hn,x=`${n}/anyOf/${p}`,b=Ct(e,g,x,r,m,o);return b||i.push(g),b?[...d,g]:d},[]),l=Yr(a.length,0)&&t.Merge(a);return l||i.forEach(d=>d.GetErrors().forEach(m=>t.AddError(m))),l||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:r,params:{}})}function Bh(e,t,n,r){return z(!!n)}function gd(e,t,n,r){return n}function Hh(e,t,n,r,s,o){return gd(e,t,s)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:r,params:{}})}function qh(e,t,n,r){return Os(n.const)?Gt(r,z(n.const)):pm(r,us(n.const))}function hd(e,t,n,r){return Os(n.const)?h(r,n.const):Xr(r,n.const)}function zh(e,t,n,r,s,o){return hd(e,t,s,o)||t.AddError({keyword:"const",schemaPath:n,instancePath:r,params:{allowedValue:s.const}})}function Kh(e){return!(as(e)&&h(e.minContains,0))}function dO(e,t,n,r){const[s,o]=[at(),at()],i=Nt(Gt(de(r,"length"),z(0))),a=q0(r,[s,o],wt(ot(e,t,n.contains,s),t.AddIndex(o)));return wt(i,a)}function uO(e,t,n,r){const[s]=[at()],o=Nt(Gt(de(r,"length"),z(0))),i=H0(r,[s,"_"],ot(e,t,n.contains,s));return wt(o,i)}function Gh(e,t,n,r){return Kh(n)?t.UseUnevaluated()?dO(e,t,n,r):uO(e,t,n,r):z(!0)}function bd(e,t,n,r){return Kh(n)?!h(r.length,0)&&im(r,(s,o)=>it(e,t,n.contains,s)&&t.AddIndex(o)):!0}function Vh(e,t,n,r,s,o){return bd(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:1}})}function Wh(e,t,n,r){const s=Gt(de(es(r),"length"),z(0)),o=It(nt(n.dependencies).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=ot(e,t,a,r),m=p=>It(p.map(g=>Kr(r,z(g))));return qe(l,H(a)?m(a):d)}));return qe(s,o)}function Jh(e,t,n,r){const s=h(D(r).length,0),o=dt(nt(n.dependencies),0,([i,a])=>!E(r,i)||(H(a)?a.every(l=>E(r,l)):it(e,t,a,r)));return s||o}function Qh(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(nt(s.dependencies),0,([l,d])=>{const m=`${n}/dependencies/${l}`;return!E(o,l)||(H(d)?d.every(p=>E(o,p)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:r,params:{property:l,dependencies:d}})):Ct(e,t,m,r,d,o))});return i||a}function Yh(e,t,n,r){const s=Gt(de(es(r),"length"),z(0)),o=It(nt(n.dependentRequired).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=It(a.map(m=>Kr(r,z(m))));return qe(l,d)}));return qe(s,o)}function Xh(e,t,n,r){const s=h(D(r).length,0),o=dt(nt(n.dependentRequired),0,([i,a])=>!E(r,i)||a.every(l=>E(r,l)));return s||o}function Zh(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(nt(s.dependentRequired),0,([l,d])=>!E(o,l)||jt(d,0,m=>E(o,m)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:r,params:{property:l,dependencies:d}})));return i||a}function eb(e,t,n,r){const s=Gt(de(es(r),"length"),z(0)),o=It(nt(n.dependentSchemas).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=ot(e,t,a,r);return qe(l,d)}));return qe(s,o)}function tb(e,t,n,r){const s=h(D(r).length,0),o=dt(nt(n.dependentSchemas),0,([i,a])=>!E(r,i)||it(e,t,a,r));return s||o}function nb(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(nt(s.dependentSchemas),0,([l,d])=>{const m=`${n}/dependentSchemas/${l}`;return!E(o,l)||Ct(e,t,m,r,d,o)});return i||a}function fO(e,t,n,r){const s=e.DynamicRef(n)??!1;return Vs(e,t,s,r)}function mO(e,t,n,r){const s=e.DynamicRef(n)??!1;return _e(s)&&it(e,t,s,r)}function pO(e,t,n,r,s,o){const i=e.DynamicRef(s)??!1;return _e(i)&&Ct(e,t,"#",r,i,o)}function rb(e,t,n,r){return hl(n.enum.map(s=>{if(Os(s))return Gt(r,z(s));const o=us(s);return pm(r,o)}))}function kd(e,t,n,r){return $s(n.enum,s=>Os(s)?h(r,s):Xr(r,s))}function sb(e,t,n,r,s,o){return kd(e,t,s,o)||t.AddError({keyword:"enum",schemaPath:n,instancePath:r,params:{allowedValues:s.enum}})}function ob(e,t,n,r){return pl(r,z(n.exclusiveMaximum))}function xd(e,t,n,r){return Co(r,n.exclusiveMaximum)}function ib(e,t,n,r,s,o){return xd(e,t,s,o)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:r,params:{comparison:"<",limit:s.exclusiveMaximum}})}function ab(e,t,n,r){return fm(r,z(n.exclusiveMinimum))}function yd(e,t,n,r){return Yr(r,n.exclusiveMinimum)}function cb(e,t,n,r,s,o){return yd(e,t,s,o)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:r,params:{comparison:">",limit:s.exclusiveMinimum}})}const gO=[0,31,28,31,30,31,30,31,31,30,31,30,31],hO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function bO(e){return e%4===0&&(e%100!==0||e%400===0)}function Sd(e){const t=hO.exec(e);if(!t)return!1;const n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&bO(n)?29:gO[r])}const kO=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function wd(e,t=!0){const n=kO.exec(e);if(!n)return!1;const r=+n[1],s=+n[2],o=+n[3],i=n[4]==="-"?-1:1,a=+(n[5]||0),l=+(n[6]||0);if(a>23||l>59||t&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(r<=23&&s<=59&&o<60)return!0;const d=s-l*i,m=r-a*i-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}function lb(e,t=!0){const n=e.split(/T/i);return n.length===2&&Sd(n[0])&&wd(n[1],t)}const xO=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function db(e){return xO.test(e)}const yO=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;function ub(e){return yO.test(e)}const qr=36,Ti=1,Oc=26,SO=38,wO=700,vO=72,IO=128;function CO(e,t,n){e=n?Math.floor(e/wO):e>>1,e+=Math.floor(e/t);let r=0;for(;e>(qr-Ti)*Oc>>1;)e=Math.floor(e/(qr-Ti)),r+=qr;return r+Math.floor((qr-Ti+1)*e/(e+SO))}function jO(e){const t=[];let n=IO,r=0,s=vO;const o=e.lastIndexOf("-");if(o>0)for(let a=0;a<o;a++){const l=e.charCodeAt(a);if(l>=128)throw new Error("Invalid punycode: non-basic before delimiter");t.push(l)}let i=o<0?0:o+1;for(;i<e.length;){const a=r;let l=1,d=qr;for(;;){if(i>=e.length)throw new Error("Invalid punycode: unexpected end of input");const p=e.charCodeAt(i++);let g;if(p>=97&&p<=122)g=p-97;else if(p>=48&&p<=57)g=p-48+26;else if(p>=65&&p<=90)Ot();else throw new Error("Invalid punycode: bad digit character");r+=g*l;const x=d<=s?Ti:d>=s+Oc?Oc:d-s;if(g<x)break;l*=qr-x,d+=qr}const m=t.length+1;s=CO(r-a,m,a===0),n+=Math.floor(r/m),r%=m,t.splice(r,0,n),r++}return globalThis.String.fromCodePoint(...t)}function TO(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function AO(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function EO(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function PO(e){return TO(e)||AO(e)||EO(e)}const NO=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),OO=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function $O(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function RO(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function MO(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function FO(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function DO(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function _O(e){return e>=1632&&e<=1641}function LO(e){return e>=1776&&e<=1785}function Yu(e){return OO.has(e)}function fb(e){if(e.length===0)return Ot();const t=[...e].map(i=>i.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||PO(t[0]))return!1;let r=!1,s=!1,o=!1;for(let i=0;i<n;i++){const a=t[i];if(NO.has(a))return!1;(MO(a)||FO(a)||DO(a))&&(r=!0),_O(a)&&(s=!0),LO(a)&&(o=!0);const l=t[i-1],d=t[i+1];switch(a){case 183:if(l!==108||d!==108)return!1;break;case 885:if(d===void 0||!$O(d))return!1;break;case 1523:case 1524:if(l===void 0||!RO(l))return!1;break;case 8204:if(l===void 0||l<128&&!Yu(l))return!1;break;case 8205:if(l===void 0||!Yu(l))return!1;break}}return!(e.includes("・")&&!r||s&&o)}function UO(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function mb(e){return e.toLowerCase().startsWith("xn--")}function pb(e){try{const t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;const r=jO(t);return r?fb(r):!1}catch{return!1}}function BO(e){return e.length===0||e.length>63?!1:mb(e)?pb(e):fb(e)}function HO(e){return e.length===0||e.length>63?!1:mb(e)?pb(e):UO(e)}function gb(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(const t of e.split("."))if(!HO(t))return!1;return!0}const qO=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function hb(e){return qO.test(e)}function bb(e){if(e.length===0||e.includes(" "))return!1;const t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(const n of t.split("."))if(!BO(n))return!1;return!0}function kb(e,t,n){let r=0,s=0,o=0,i=0;for(let a=t;a<n;a++){const l=e.charCodeAt(a);if(l===46){if(o===0||s>255||i===48&&o>1)return!1;r++,s=0,o=0,i=0}else if(l>=48&&l<=57)o===0&&(i=l),s=s*10+(l-48),o++;else return!1}return r===3&&o>0&&s<=255&&!(i===48&&o>1)}function xb(e){return kb(e,0,e.length)}function zO(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function yb(e){const t=e.length;if(t===0)return!1;let n=0,r=!1,s=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;r=!0,s=2}for(;s<t;){let o=0;const i=s;for(;s<t&&zO(e.charCodeAt(s));)s++,o++;if(o===0)return!1;const a=e.charCodeAt(s);if(a===46){if(!kb(e,i,t))return!1;n+=2,s=t;break}if(o>4)return!1;if(n++,s===t)break;if(a!==58)return!1;if(s++,e.charCodeAt(s)===58){if(r||e.charCodeAt(s+1)===58)return!1;if(r=!0,s++,s===t)break}}return r?n<=7:n===8}function Xu(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Sb(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;const t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?Xu(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:Xu(e)}function wb(e){try{return new URL(e),!0}catch{return!1}}const KO=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function vb(e){return KO.test(e)}const GO=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function Ib(e){return GO.test(e)}function Cb(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}const VO=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function jb(e){return VO.test(e)}const WO=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function Tb(e){return WO.test(e)}const JO=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function Ab(e){return JO.test(e)}function Eb(e){return e>=97&&e<=122||e>=65&&e<=90}function Pb(e){return Eb(e)||e>=48&&e<=57}function yi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function QO(e){return Pb(e)||e===43||e===45||e===46}function $c(e){return Pb(e)||e===45||e===46||e===95||e===126}function Rc(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function YO(e){return $c(e)||Rc(e)||e===58||e===64}function Nb(e){const t=e.length;if(t===0||!Eb(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){const r=e.charCodeAt(n);if(r===58)break;if(!QO(r))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;const r=n;let s=-1;for(let o=n;o<t;o++){const i=e.charCodeAt(o);if(i===64){s=o;break}if(i===47||i===63||i===35)break}if(s!==-1){for(let o=r;o<s;o++){const i=e.charCodeAt(o);if(i===91||i===93)return!1;if(i===37){if(o+2>=s||!yi(e.charCodeAt(o+1))||!yi(e.charCodeAt(o+2)))return!1;o+=2}else if(!$c(i)&&!Rc(i)&&i!==58)return!1}n=s+1}if(e.charCodeAt(n)===91){for(n++;n<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){const o=e.charCodeAt(n);if(o===47||o===63||o===35||o===58)break;if(o<128&&!$c(o)&&!Rc(o))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<t;){const o=e.charCodeAt(n);if(o===47||o===63||o===35)break;if(o<48||o>57)return!1;n++}}for(;n<t;){const r=e.charCodeAt(n);if(r===37){if(n+2>=t||!yi(e.charCodeAt(n+1))||!yi(e.charCodeAt(n+2)))return!1;n+=2}else{if(r>127)return!1;if(!(YO(r)||r===47||r===63||r===35))return!1}n++}return!0}const XO=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function Ob(e){return XO.test(e)}const ZO=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function $b(e){return ZO.test(e)}const Be=new Map;function Rb(){Be.clear()}function e$(){return[...Be.entries()]}function t$(e,t){Be.set(e,t)}function n$(e){return Be.has(e)}function r$(e){return Be.get(e)}function Mb(e,t){var n;return((n=Be.get(e))==null?void 0:n(t))??!0}function Fb(){Rb(),Be.set("date-time",lb),Be.set("date",Sd),Be.set("duration",db),Be.set("email",ub),Be.set("hostname",gb),Be.set("idn-email",hb),Be.set("idn-hostname",bb),Be.set("ipv4",xb),Be.set("ipv6",yb),Be.set("iri-reference",Sb),Be.set("iri",wb),Be.set("json-pointer-uri-fragment",vb),Be.set("json-pointer",Ib),Be.set("regex",Cb),Be.set("relative-json-pointer",jb),Be.set("time",wd),Be.set("uri-reference",Tb),Be.set("uri-template",Ab),Be.set("uri",Nb),Be.set("url",Ob),Be.set("uuid",$b)}Fb();const s$=Object.freeze(Object.defineProperty({__proto__:null,Clear:Rb,Entries:e$,Get:r$,Has:n$,IsDate:Sd,IsDateTime:lb,IsDuration:db,IsEmail:ub,IsHostname:gb,IsIPv4:xb,IsIPv6:yb,IsIdnEmail:hb,IsIdnHostname:bb,IsIri:wb,IsIriReference:Sb,IsJsonPointer:Ib,IsJsonPointerUriFragment:vb,IsRegex:Cb,IsRelativeJsonPointer:jb,IsTime:wd,IsUri:Nb,IsUriReference:Tb,IsUriTemplate:Ab,IsUrl:Ob,IsUuid:$b,Reset:Fb,Set:t$,Test:Mb},Symbol.toStringTag,{value:"Module"}));function Db(e,t,n,r){return Ke(de("Format","Test"),[z(n.format),r])}function vd(e,t,n,r){return Mb(n.format,r)}function _b(e,t,n,r,s,o){return vd(e,t,s,o)||t.AddError({keyword:"format",schemaPath:n,instancePath:r,params:{format:s.format}})}function Lb(e,t,n,r){const s=Pa(n)?n.then:!0,o=wa(n)?n.else:!0;return K0(ot(e,t,n.if,r),ot(e,t,s,r),ot(e,t,o,r))}function Ub(e,t,n,r){const s=Pa(n)?n.then:!0,o=wa(n)?n.else:!0;return it(e,t,n.if,r)?it(e,t,s,r):it(e,t,o,r)}function Bb(e,t,n,r,s,o){const i=Pa(s)?s.then:!0,a=wa(s)?s.else:!0,l=new Hn,d=Ct(e,l,`${n}/if`,r,s.if,o)?Ct(e,l,`${n}/then`,r,i,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"then"}}):Ct(e,t,`${n}/else`,r,a,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"else"}});return d&&t.Merge([l]),d}function o$(e,t,n,r){return It(n.items.map((s,o)=>{const i=Zr(de(r,"length"),z(o)),a=$n(e,t,s,`${r}[${o}]`),l=t.AddIndex(z(o));return qe(i,wt(a,l))}))}function i$(e,t,n,r){return It(n.items.map((s,o)=>{const i=Zr(de(r,"length"),z(o)),a=$n(e,t,s,`${r}[${o}]`);return qe(i,a)}))}function a$(e,t,n,r){return t.UseUnevaluated()?o$(e,t,n,r):i$(e,t,n,r)}function c$(e,t,n,r){return dt(n.items,0,(s,o)=>rr(r.length,o)||$r(e,t,s,r[o])&&t.AddIndex(o))}function l$(e,t,n,r,s,o){return jt(s.items,0,(i,a)=>{const l=`${n}/items/${a}`,d=`${r}/${a}`;return rr(o.length,a)||Rr(e,t,l,d,i,o[a])&&t.AddIndex(a)})}function d$(e,t,n,r){const s=cr(n)?n.prefixItems.length:0,o=$n(e,t,n.items,"element"),i=t.AddIndex("index");return Dn(r,z(s),["element","index"],wt(o,i))}function u$(e,t,n,r){const s=cr(n)?n.prefixItems.length:0,o=$n(e,t,n.items,"element");return Dn(r,z(s),["element","index"],o)}function f$(e,t,n,r){return t.UseUnevaluated()?d$(e,t,n,r):u$(e,t,n,r)}function m$(e,t,n,r){const s=cr(n)?n.prefixItems.length:0;return dt(r,s,(o,i)=>$r(e,t,n.items,o)&&t.AddIndex(i))}function p$(e,t,n,r,s,o){const i=cr(s)?s.prefixItems.length:0;return jt(o,i,(a,l)=>{const d=`${n}/items`,m=`${r}/${l}`;return Rr(e,t,d,m,s.items,a)&&t.AddIndex(l)})}function Hb(e,t,n,r){return Ca(n)?a$(e,t,n,r):f$(e,t,n,r)}function qb(e,t,n,r){return Ca(n)?c$(e,t,n,r):m$(e,t,n,r)}function zb(e,t,n,r,s,o){return Ca(s)?l$(e,t,n,r,s,o):p$(e,t,n,r,s,o)}function Kb(e){return is(e)}function Gb(e,t,n,r){if(!Kb(n))return z(!0);const[s]=[at()],o=ta(r,[s,"_"],ot(e,t,n.contains,s));return Zr(o,z(n.maxContains))}function Id(e,t,n,r){if(!Kb(n))return!0;const s=dl(r,o=>it(e,t,n.contains,o));return rr(s,n.maxContains)}function Vb(e,t,n,r,s,o){const i=as(s)?s.minContains:1;return Id(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:i,maxContains:s.maxContains}})}function Wb(e,t,n,r){return Zr(r,z(n.maximum))}function Cd(e,t,n,r){return rr(r,n.maximum)}function Jb(e,t,n,r,s,o){return Cd(e,t,s,o)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:r,params:{comparison:"<=",limit:s.maximum}})}function Qb(e,t,n,r){return Zr(de(r,"length"),z(n.maxItems))}function jd(e,t,n,r){return rr(r.length,n.maxItems)}function Yb(e,t,n,r,s,o){return jd(e,t,s,o)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:r,params:{limit:s.maxItems}})}function Xb(e,t,n,r){return B0(r,z(n.maxLength))}function Td(e,t,n,r){return sm(r,n.maxLength)}function Zb(e,t,n,r,s,o){return Td(e,t,s,o)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:r,params:{limit:s.maxLength}})}function ek(e,t,n,r){return Zr(de(es(r),"length"),z(n.maxProperties))}function Ad(e,t,n,r){return rr(D(r).length,n.maxProperties)}function tk(e,t,n,r,s,o){return Ad(e,t,s,o)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:r,params:{limit:s.maxProperties}})}function nk(e){return is(e)}function g$(e,t,n,r){const[s,o]=[at(),at()],i=ta(r,[s,o],wt(ot(e,t,n.contains,s),t.AddIndex(o)));return jo(i,z(n.minContains))}function h$(e,t,n,r){const[s]=[at()],o=ta(r,[s,"_"],ot(e,t,n.contains,s));return jo(o,z(n.minContains))}function rk(e,t,n,r){return nk(n)?t.UseUnevaluated()?g$(e,t,n,r):h$(e,t,n,r):z(!0)}function Ed(e,t,n,r){if(!nk(n))return!0;const s=dl(r,(o,i)=>it(e,t,n.contains,o)&&t.AddIndex(i));return Ns(s,n.minContains)}function sk(e,t,n,r,s,o){return Ed(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:s.minContains}})}function ok(e,t,n,r){return jo(r,z(n.minimum))}function Pd(e,t,n,r){return Ns(r,n.minimum)}function ik(e,t,n,r,s,o){return Pd(e,t,s,o)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:r,params:{comparison:">=",limit:s.minimum}})}function ak(e,t,n,r){return jo(de(r,"length"),z(n.minItems))}function Nd(e,t,n,r){return Ns(r.length,n.minItems)}function ck(e,t,n,r,s,o){return Nd(e,t,s,o)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:r,params:{limit:s.minItems}})}function lk(e,t,n,r){return U0(r,z(n.minLength))}function Od(e,t,n,r){return om(r,n.minLength)}function dk(e,t,n,r,s,o){return Od(e,t,s,o)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:r,params:{limit:s.minLength}})}function uk(e,t,n,r){return jo(de(es(r),"length"),z(n.minProperties))}function $d(e,t,n,r){return Ns(D(r).length,n.minProperties)}function fk(e,t,n,r,s,o){return $d(e,t,s,o)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:r,params:{limit:s.minProperties}})}function mk(e,t,n,r){return G0(r,z(n.multipleOf))}function Rd(e,t,n,r){return nm(r,n.multipleOf)}function pk(e,t,n,r,s,o){return Rd(e,t,s,o)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:r,params:{multipleOf:s.multipleOf}})}function b$(e,t,n,r){return si(e,t,[n.not],r,Nt(Gt(de("results","length"),z(1))))}function k$(e,t,n,r){return Nt(ot(e,t,n.not,r))}function gk(e,t,n,r){return t.UseUnevaluated()?b$(e,t,n,r):k$(e,t,n,r)}function Md(e,t,n,r){const s=new Bn;return!it(e,s,n.not,r)&&t.Merge([s])}function hk(e,t,n,r,s,o){return Md(e,t,s,o)||t.AddError({keyword:"not",schemaPath:n,instancePath:r,params:{}})}function x$(e,t,n,r){return si(e,t,n.oneOf,r,Gt(de("results","length"),z(1)))}function y$(e,t,n,r){const[s]=[at()],o=z0(n.oneOf.map(a=>ot(e,t,a,r))),i=ta(o,[s,"_"],Gt(s,z(!0)));return Gt(i,z(1))}function bk(e,t,n,r){return t.UseUnevaluated()?x$(e,t,n,r):y$(e,t,n,r)}function kk(e,t,n,r){const s=n.oneOf.reduce((o,i)=>{const a=new Bn;return it(e,a,i,r)?[...o,a]:o},[]);return h(s.length,1)&&t.Merge(s)}function xk(e,t,n,r,s,o){const i=[],a=[],l=s.oneOf.reduce((m,p,g)=>{const x=new Hn,b=`${n}/oneOf/${g}`,y=Ct(e,x,b,r,p,o);return y&&a.push(g),y||i.push(x),y?[...m,x]:m},[]),d=h(l.length,1)&&t.Merge(l);return!d&&h(a.length,0)&&i.forEach(m=>m.GetErrors().forEach(p=>t.AddError(p))),d||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:r,params:{passingSchemas:a}})}function yk(e,t,n,r){const s=us(ie(n.pattern)?new RegExp(n.pattern,"u"):n.pattern);return Ke(de(s,"test"),[r])}function Fd(e,t,n,r){return(ie(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(r)}function Sk(e,t,n,r,s,o){return Fd(e,t,s,o)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:r,params:{pattern:s.pattern}})}function wk(e,t,n,r){return It(nt(n.patternProperties).map(([s,o])=>{const[i,a]=[at(),at()],l=us(new RegExp(s,"u")),d=Nt(Ke(de(l,"test"),[i])),m=$n(e,t,o,a),p=t.AddKey(i),g=t.UseUnevaluated()?qe(d,wt(m,p)):qe(d,m);return Dn(mm(r),z(0),[`[${i}, ${a}]`,"_"],g)}))}function vk(e,t,n,r){return dt(nt(n.patternProperties),0,([s,o])=>{const i=new RegExp(s,"u");return dt(nt(r),0,([a,l])=>!i.test(a)||$r(e,t,o,l)&&t.AddKey(a))})}function Ik(e,t,n,r,s,o){return jt(nt(s.patternProperties),0,([i,a])=>{const l=`${n}/patternProperties/${i}`,d=new RegExp(i,"u");return jt(nt(o),0,([m,p])=>{const g=`${r}/${m}`;return!d.test(m)||Rr(e,t,l,g,a,p)&&t.AddKey(m)})})}function Ck(e,t,n,r){return It(n.prefixItems.map((s,o)=>{const i=Zr(de(r,"length"),z(o)),a=$n(e,t,s,`${r}[${o}]`),l=t.AddIndex(z(o)),d=t.UseUnevaluated()?wt(a,l):a;return qe(i,d)}))}function jk(e,t,n,r){return h(r.length,0)||dt(n.prefixItems,0,(s,o)=>rr(r.length,o)||$r(e,t,s,r[o])&&t.AddIndex(o))}function Tk(e,t,n,r,s,o){return h(o.length,0)||jt(s.prefixItems,0,(i,a)=>{const l=`${n}/prefixItems/${a}`,d=`${r}/${a}`;return rr(o.length,a)||Rr(e,t,l,d,i,o[a])&&t.AddIndex(a)})}function Dd(e,t){return e.includes(t)||Ao().exactOptionalPropertyTypes}function S$(e,t){return hc(de(e,t))}function Ak(e,t){return $e(e[t])}function Ek(e,t,n,r){const s=lr(n)?n.required:[],o=nt(n.properties).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=$n(e,t,a,de(r,i)),m=t.AddKey(z(i)),p=t.UseUnevaluated()?wt(d,m):d,g=s.includes(i)?p:qe(l,p);return Dd(s,i)?g:qe(S$(r,i),g)});return It(o)}function Pk(e,t,n,r){const s=lr(n)?n.required:[];return dt(nt(n.properties),0,([i,a])=>{const l=!E(r,i)||$r(e,t,a,r[i])&&t.AddKey(i);return Dd(s,i)?l:Ak(r,i)||l})}function Nk(e,t,n,r,s,o){const i=lr(s)?s.required:[];return jt(nt(s.properties),0,([l,d])=>{const m=`${n}/properties/${l}`,p=`${r}/${l}`,g=()=>!E(o,l)||Rr(e,t,m,p,d,o[l])&&t.AddKey(l);return Dd(i,l)?g():Ak(o,l)||g()})}function Ok(e,t,n,r){const[s,o]=[at(),at()];return Dn(es(r),z(0),[s,o],ot(e,t,n.propertyNames,s))}function $k(e,t,n,r){return dt(D(r),0,(s,o)=>it(e,t,n.propertyNames,s))}function Rk(e,t,n,r,s,o){const i=[];return jt(D(o),0,(l,d)=>{const m=`${r}/${l}`,p=`${n}/propertyNames`,g=new Hn,x=Ct(e,g,p,m,s.propertyNames,l);return x||i.push(l),x})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:r,params:{propertyNames:i}})}function Mk(e,t,n,r){const s=e.RecursiveRef(n)??!1;return Vs(e,t,s,r)}function Fk(e,t,n,r){const s=e.RecursiveRef(n)??!1;return _e(s)&&it(e,t,s,r)}function Dk(e,t,n,r,s,o){const i=e.RecursiveRef(s)??!1;return _e(i)&&Ct(e,t,"#",r,i,o)}function w$(e,t,n,r){const s=xr(["context","value"],Vs(e,t,n,"value")),o=xr(["context","value"],na([Qn("nextContext",gl("CheckContext",[])),Qn("result",Ke(s,["nextContext","value"])),gm("result",t.Merge("[nextContext]")),ra("result")]));return Ke(o,["context",r])}function v$(e,t,n,r){return Vs(e,t,n,r)}function _k(e,t,n,r){const s=e.Ref(n)??!1;return t.UseUnevaluated()?w$(e,t,s,r):v$(e,t,s,r)}function Lk(e,t,n,r){const s=e.Ref(n)??!1,o=new Bn,i=_e(s)&&it(e,o,s,r);return i&&t.Merge([o]),i}function Uk(e,t,n,r,s,o){const i=e.Ref(s)??!1,a=new Hn,l=_e(i)&&Ct(e,a,"#",r,i,o);return l&&t.Merge([a]),l||a.GetErrors().forEach(d=>t.AddError(d)),l}function Bk(e,t,n,r){return It(n.required.map(s=>Kr(r,z(s))))}function Hk(e,t,n,r){return dt(n.required,0,s=>E(r,s))}function qk(e,t,n,r,s,o){const i=[];return jt(s.required,0,l=>{const d=E(o,l);return d||i.push(l),d})||t.AddError({keyword:"required",schemaPath:n,instancePath:r,params:{requiredProperties:i}})}function zk(e,t,n,r){return h(n,"object")?lm(r):h(n,"array")?Ri(r):h(n,"boolean")?R0(r):h(n,"integer")?M0(r):h(n,"number")?cm(r):h(n,"null")?F0(r):h(n,"string")?um(r):h(n,"bigint")?am(r):h(n,"constructor")?L0(r):h(n,"function")?_0(r):h(n,"symbol")?D0(r):h(n,"undefined")||h(n,"void")?hc(r):z(!0)}function _d(e,t,n,r,s){return h(n,"object")?fn(s):h(n,"array")?H(s):h(n,"boolean")?ht(s):h(n,"integer")?cl(s):h(n,"number")?ye(s):h(n,"null")?Vt(s):h(n,"string")?ie(s):h(n,"bigint")?tt(s):h(n,"constructor")?ea(s):h(n,"function")?In(s):h(n,"symbol")?ll(s):h(n,"undefined")||h(n,"void")?$e(s):!0}function I$(e,t,n,r){return hl(n.map(s=>zk(e,t,s,r)))}function Kk(e,t,n,r,s){return $s(n,o=>_d(e,t,o,r,s))}function Gk(e,t,n,r){return H(n.type)?I$(e,t,n.type,r):zk(e,t,n.type,r)}function Vk(e,t,n,r){return H(n.type)?Kk(e,t,n.type,n,r):_d(e,t,n.type,n,r)}function Wk(e,t,n,r,s,o){return(H(s.type)?Kk(e,t,s.type,s,o):_d(e,t,s.type,s,o))||t.AddError({keyword:"type",schemaPath:n,instancePath:r,params:{type:s.type}})}function Jk(e,t,n,r){const[s,o]=[at(),at()],i=Ke(de("context","GetIndices"),[]),a=Ke(de("indices","has"),[s]),l=ot(e,t,n.unevaluatedItems,o),d=Ke(de("context","AddIndex"),[s]),m=Dn(r,z(0),[o,s],wt(qe(a,l),d));return Ke(xr(["context"],na([Qn("indices",i),ra(m)])),["context"])}function Qk(e,t,n,r){const s=t.GetIndices();return dt(r,0,(o,i)=>(s.has(i)||it(e,t,n.unevaluatedItems,o))&&t.AddIndex(i))}function Yk(e,t,n,r,s,o){const i=t.GetIndices(),a=[];return jt(o,0,(d,m)=>{const p=new Hn,g=(i.has(m)||Ct(e,p,n,r,s.unevaluatedItems,d))&&t.AddIndex(m);return g||a.push(m),g})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:r,params:{unevaluatedItems:a}})}function Xk(e,t,n,r){const[s,o]=[at(),at()],i=Ke(de("context","GetKeys"),[]),a=Ke(de("keys","has"),[s]),l=Ke(de("context","AddKey"),[s]),d=ot(e,t,n.unevaluatedProperties,o),m=Dn(mm(r),z(0),[`[${s}, ${o}]`,"_"],qe(a,wt(d,l)));return Ke(xr(["context"],na([Qn("keys",i),ra(m)])),["context"])}function Zk(e,t,n,r){const s=t.GetKeys();return dt(nt(r),0,([o,i])=>s.has(o)||it(e,t,n.unevaluatedProperties,i)&&t.AddKey(o))}function ex(e,t,n,r,s,o){const i=t.GetKeys(),a=[];return jt(nt(o),0,([d,m])=>{const p=new Hn,g=i.has(d)||Ct(e,p,n,r,s.unevaluatedProperties,m)&&t.AddKey(d);return g||a.push(d),g})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:r,params:{unevaluatedProperties:a}})}function Ld(e){return!h(e.uniqueItems,!1)}function tx(e,t,n,r){if(!Ld(n))return z(!0);const s=de(gl("Set",[Ke(de(r,"map"),[de("Hashing","Hash")])]),"size"),o=de(r,"length");return Gt(s,o)}function nx(e,t,n,r){if(!Ld(n))return!0;const s=new Set(r.map(sa)).size,o=r.length;return h(s,o)}function rx(e,t,n,r,s,o){if(!Ld(s))return!0;const i=new Set,a=o.reduce((d,m,p)=>{const g=sa(m);return i.has(g)?[...d,p]:(i.add(g),d)},[]);return h(a.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:r,params:{duplicateItems:a}})}function xo(e,t){return ri(e)&&(H(e.type)&&Yr(e.type.length,0)&&dt(e.type,0,n=>h(n,t))||h(e.type,t))}function C$(e){return xo(e,"object")}function j$(e){return tn(e)&&(ar(e)||Vo(e)||Wo(e)||Jo(e)||ds(e)||ls(e)||ni(e)||qs(e)||ei(e)||lr(e)||Gs(e))}function T$(e){return xo(e,"array")}function A$(e){return tn(e)&&(Go(e)||Nr(e)||is(e)||Xo(e)||Bs(e)||as(e)||cs(e)||cr(e)||Ks(e)||Ir(e))}function E$(e){return xo(e,"string")}function P$(e){return tn(e)&&(Hs(e)||Zo(e)||Us(e)||zs(e))}function N$(e){return xo(e,"number")||xo(e,"bigint")}function O$(e){return tn(e)&&(Or(e)||Yo(e)||Qo(e)||Pr(e)||ti(e))}function $n(e,t,n,r){return t.UseUnevaluated()?wt(wt(t.Push(),ot(e,t,n,r)),t.Pop()):ot(e,t,n,r)}function ot(e,t,n,r){e.Push(n);const s=[];if(Ko(n))return Bh(e,t,n);if(ri(n)&&s.push(Gk(e,t,n,r)),j$(n)){const i=[];lr(n)&&i.push(Bk(e,t,n,r)),ar(n)&&i.push(Oh(e,t,n,r)),Vo(n)&&i.push(Wh(e,t,n,r)),Wo(n)&&i.push(Yh(e,t,n,r)),Jo(n)&&i.push(eb(e,t,n,r)),ls(n)&&i.push(wk(e,t,n,r)),ds(n)&&i.push(Ek(e,t,n,r)),ni(n)&&i.push(Ok(e,t,n,r)),qs(n)&&i.push(uk(e,t,n,r)),ei(n)&&i.push(ek(e,t,n,r));const a=It(i),l=qe(Nt(lm(r)),a);s.push(C$(n)?a:l)}if(A$(n)){const i=[];Go(n)&&i.push(jh(e,t,n,r)),is(n)&&i.push(Gh(e,t,n,r)),Nr(n)&&i.push(Hb(e,t,n,r)),Xo(n)&&i.push(Gb(e,t,n,r)),Bs(n)&&i.push(Qb(e,t,n,r)),as(n)&&i.push(rk(e,t,n,r)),cs(n)&&i.push(ak(e,t,n,r)),cr(n)&&i.push(Ck(e,t,n,r)),Ir(n)&&i.push(tx(e,t,n,r));const a=It(i),l=qe(Nt(Ri(r)),a);s.push(T$(n)?a:l)}if(P$(n)){const i=[];Zo(n)&&i.push(Xb(e,t,n,r)),Hs(n)&&i.push(lk(e,t,n,r)),Us(n)&&i.push(Db(e,t,n,r)),zs(n)&&i.push(yk(e,t,n,r));const a=It(i),l=qe(Nt(um(r)),a);s.push(E$(n)?a:l)}if(O$(n)){const i=[];Qo(n)&&i.push(ob(e,t,n,r)),Pr(n)&&i.push(ab(e,t,n,r)),Yo(n)&&i.push(Wb(e,t,n,r)),Or(n)&&i.push(ok(e,t,n,r)),ti(n)&&i.push(mk(e,t,n,r));const a=It(i),l=qe(Nt(qe(cm(r),am(r))),a);s.push(N$(n)?a:l)}Ea(n)&&s.push(_k(e,t,n,r)),Aa(n)&&s.push(Mk(e,t,n,r)),Sa(n)&&s.push(fO(e,t,n,r)),ya(n)&&s.push(qh(e,t,n,r)),va(n)&&s.push(rb(e,t,n,r)),Ia(n)&&s.push(Lb(e,t,n,r)),ja(n)&&s.push(gk(e,t,n,r)),ka(n)&&s.push(Mh(e,t,n,r)),xa(n)&&s.push(_h(e,t,n,r)),Ta(n)&&s.push(bk(e,t,n,r)),Ks(n)&&s.push(qe(Nt(Ri(r)),Jk(e,t,n,r))),Gs(n)&&s.push(qe(Nt(dm(r)),Xk(e,t,n,r))),ba(n)&&s.push(vh(e,t,n,r));const o=It(s);return e.Pop(n),o}function $r(e,t,n,r){return t.Push()&&it(e,t,n,r)&&t.Pop()}function it(e,t,n,r){e.Push(n);const s=Ko(n)?gd(e,t,n):(!ri(n)||Vk(e,t,n,r))&&(!(ne(r)&&!H(r))||(!lr(n)||Hk(e,t,n,r))&&(!ar(n)||$h(e,t,n,r))&&(!Vo(n)||Jh(e,t,n,r))&&(!Wo(n)||Xh(e,t,n,r))&&(!Jo(n)||tb(e,t,n,r))&&(!ls(n)||vk(e,t,n,r))&&(!ds(n)||Pk(e,t,n,r))&&(!ni(n)||$k(e,t,n,r))&&(!qs(n)||$d(e,t,n,r))&&(!ei(n)||Ad(e,t,n,r)))&&(!H(r)||(!Go(n)||Th(e,t,n,r))&&(!is(n)||bd(e,t,n,r))&&(!Nr(n)||qb(e,t,n,r))&&(!Xo(n)||Id(e,t,n,r))&&(!Bs(n)||jd(e,t,n,r))&&(!as(n)||Ed(e,t,n,r))&&(!cs(n)||Nd(e,t,n,r))&&(!cr(n)||jk(e,t,n,r))&&(!Ir(n)||nx(e,t,n,r)))&&(!ie(r)||(!Zo(n)||Td(e,t,n,r))&&(!Hs(n)||Od(e,t,n,r))&&(!Us(n)||vd(e,t,n,r))&&(!zs(n)||Fd(e,t,n,r)))&&(!(ye(r)||tt(r))||(!Qo(n)||xd(e,t,n,r))&&(!Pr(n)||yd(e,t,n,r))&&(!Yo(n)||Cd(e,t,n,r))&&(!Or(n)||Pd(e,t,n,r))&&(!ti(n)||Rd(e,t,n,r)))&&(!Ea(n)||Lk(e,t,n,r))&&(!Aa(n)||Fk(e,t,n,r))&&(!Sa(n)||mO(e,t,n,r))&&(!ya(n)||hd(e,t,n,r))&&(!va(n)||kd(e,t,n,r))&&(!Ia(n)||Ub(e,t,n,r))&&(!ja(n)||Md(e,t,n,r))&&(!ka(n)||Fh(e,t,n,r))&&(!xa(n)||Lh(e,t,n,r))&&(!Ta(n)||kk(e,t,n,r))&&(!Ks(n)||!H(r)||Qk(e,t,n,r))&&(!Gs(n)||!ne(r)||Zk(e,t,n,r))&&(!ba(n)||Ih(e,t,n,r));return e.Pop(n),s}function Rr(e,t,n,r,s,o){return t.Push()&&Ct(e,t,n,r,s,o)&&t.Pop()}function Ct(e,t,n,r,s,o){e.Push(s);const i=Ko(s)?Hh(e,t,n,r,s):!!(+(!ri(s)||Wk(e,t,n,r,s,o))&+(!(ne(o)&&!H(o))||!!(+(!lr(s)||qk(e,t,n,r,s,o))&+(!ar(s)||Rh(e,t,n,r,s,o))&+(!Vo(s)||Qh(e,t,n,r,s,o))&+(!Wo(s)||Zh(e,t,n,r,s,o))&+(!Jo(s)||nb(e,t,n,r,s,o))&+(!ls(s)||Ik(e,t,n,r,s,o))&+(!ds(s)||Nk(e,t,n,r,s,o))&+(!ni(s)||Rk(e,t,n,r,s,o))&+(!qs(s)||fk(e,t,n,r,s,o))&+(!ei(s)||tk(e,t,n,r,s,o))))&+(!H(o)||!!(+(!Go(s)||Ah(e,t,n,r,s,o))&+(!is(s)||Vh(e,t,n,r,s,o))&+(!Nr(s)||zb(e,t,n,r,s,o))&+(!Xo(s)||Vb(e,t,n,r,s,o))&+(!Bs(s)||Yb(e,t,n,r,s,o))&+(!as(s)||sk(e,t,n,r,s,o))&+(!cs(s)||ck(e,t,n,r,s,o))&+(!cr(s)||Tk(e,t,n,r,s,o))&+(!Ir(s)||rx(e,t,n,r,s,o))))&+(!ie(o)||!!(+(!Zo(s)||Zb(e,t,n,r,s,o))&+(!Hs(s)||dk(e,t,n,r,s,o))&+(!Us(s)||_b(e,t,n,r,s,o))&+(!zs(s)||Sk(e,t,n,r,s,o))))&+(!(ye(o)||tt(o))||!!(+(!Qo(s)||ib(e,t,n,r,s,o))&+(!Pr(s)||cb(e,t,n,r,s,o))&+(!Yo(s)||Jb(e,t,n,r,s,o))&+(!Or(s)||ik(e,t,n,r,s,o))&+(!ti(s)||pk(e,t,n,r,s,o))))&+(!Ea(s)||Uk(e,t,n,r,s,o))&+(!Aa(s)||Dk(e,t,n,r,s,o))&+(!Sa(s)||pO(e,t,n,r,s,o))&+(!ya(s)||zh(e,t,n,r,s,o))&+(!va(s)||sb(e,t,n,r,s,o))&+(!Ia(s)||Bb(e,t,n,r,s,o))&+(!ja(s)||hk(e,t,n,r,s,o))&+(!ka(s)||Dh(e,t,n,r,s,o))&+(!xa(s)||Uh(e,t,n,r,s,o))&+(!Ta(s)||xk(e,t,n,r,s,o))&+(!Ks(s)||!H(o)||Yk(e,t,n,r,s,o))&+(!Gs(s)||!ne(o)||ex(e,t,n,r,s,o)))&&(!ba(s)||Ch(e,t,n,r,s,o));return e.Pop(s),i}const sx=[0],Ai=new Map,mo=new Map;function $$(){return`${sx[0]++}`}function R$(e,t){Ai.has(e)||Ai.set(e,new Map);const n=Ai.get(e);if(n.has(t))return n.get(t);const r=$$();return n.set(t,r),r}function M$(e,t,n,r){return e.UseUnevaluated()?Ke(`check_${n}`,["context",r]):Ke(`check_${n}`,[r])}function F$(e,t,n,r){const s=ot(e,t,n,"value");return t.UseUnevaluated()?Qn(`check_${r}`,xr(["context","value"],s)):Qn(`check_${r}`,xr(["value"],s))}function ox(){sx[0]=0,Ai.clear(),mo.clear()}function ix(){return[...mo.values()]}function Vs(e,t,n,r){const s=R$(n,e.BaseURL().href),o=M$(t,n,s,r);return mo.has(s)||(mo.set(s,""),mo.set(s,F$(e,t,n,s))),o}function ax(e){if(e.length===0)throw Error("Cannot set root")}function cx(e){if(!ne(e))throw Error("Cannot set value")}function D$(e){if(Jn(e))throw Error("Pointer contains unsafe property key")}function lx(e){for(const t of e)D$(t)}function _$(e){return/^(0|[1-9]\d*)$/.test(e)}function dx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function L$(e,t){return ne(t)&&E(t,e)}function U$(e,t){return ne(t)&&!Jn(e)?t[e]:void 0}function Ud(e,t){return e.reduce((n,r)=>U$(r,n),t)}function oi(e){if(h(e.length,0))return[];const t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function B$(e,t){let n=e;return oi(t).every(r=>L$(r,n)?(n=n[r],!0):!1)}function ux(e,t){const n=oi(t);return Ud(n,e)}function Mc(e,t,n){const r=oi(t);ax(r),lx(r);const[s,o]=dx(r),i=Ud(s,e);return cx(i),i[o]=n,e}function fx(e,t){const n=oi(t);ax(n),lx(n);const[r,s]=dx(n),o=Ud(r,e);return cx(o),H(o)&&_$(s)?o.splice(+s,1):delete o[s],e}const mx=Object.freeze(Object.defineProperty({__proto__:null,Delete:fx,Get:ux,Has:B$,Indices:oi,Set:Mc},Symbol.toStringTag,{value:"Module"}));function H$(e,t,n){if(e.$id===n.hash)return e;const r=new URL(e.$id,t.href),s=new URL(n.href,t.href);if(h(r.pathname,s.pathname))return n.hash.startsWith("#")?px(e,t,n):e}function q$(e,t,n){const r=new URL(`#${e.$anchor}`,t.href),s=new URL(n.href,t.href);return h(r.href,s.href)?e:void 0}function z$(e,t,n){const r=new URL(`#${e.$dynamicAnchor}`,t.href),s=new URL(n.href,t.href);return h(r.href,s.href)?e:void 0}function px(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;const r=decodeURIComponent(n.hash.slice(1));if(r.startsWith("/"))return ux(e,r)}function K$(e,t,n){if(vr(e)){const r=H$(e,t,n);if(!$e(r))return r}if(Hi(e)){const r=q$(e,t,n);if(!$e(r))return r}if(Jr(e)){const r=z$(e,t,n);if(!$e(r))return r}return px(e,t,n)}function G$(e,t,n){return e.reduce((r,s)=>{const o=Bd(s,t,n);return $e(o)?r:o},void 0)}function V$(e,t,n){return D(e).reduce((r,s)=>{const o=Bd(e[s],t,n);return $e(o)?r:o},void 0)}function Bd(e,t,n){const r=tn(e)&&vr(e)?new URL(e.$id,t.href):t;if(tn(e)){const s=K$(e,r,n);if(!$e(s))return s}if(H(e))return G$(e,r,n);if(ne(e))return V$(e,r,n)}function Qr(e,t){const n=new URL("http://unknown/"),r=vr(e)?new URL(e.$id,n.href):n,s=new URL(t,r.href);return Bd(e,r,s)}function gx(e,t,n,r){const s=n.$dynamicRef.startsWith("#")?Qr(t,n.$dynamicRef):Qr(e,n.$dynamicRef);return $e(s)?void 0:!tn(s)||!Jr(s)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?s:r.find(a=>a.$dynamicAnchor===s.$dynamicAnchor)??s}const W$=Object.freeze(Object.defineProperty({__proto__:null,DynamicRef:gx,Ref:Qr},Symbol.toStringTag,{value:"Module"}));var Cs=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},gr,hx,bx,kx,xx;class ii{constructor(t,n){gr.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){tn(t)&&(vr(t)&&(this.ids.push(t),Cs(this,gr,"m",hx).call(this,t)),Hi(t)&&this.anchors.push(t),ji(t)&&this.recursiveAnchors.push(t),Jr(t)&&this.dynamicAnchors.push(t))}Pop(t){tn(t)&&(vr(t)&&(this.ids.pop(),Cs(this,gr,"m",bx).call(this,t)),Hi(t)&&this.anchors.pop(),ji(t)&&this.recursiveAnchors.pop(),Jr(t)&&this.dynamicAnchors.pop())}Ref(t){return Cs(this,gr,"m",kx).call(this,t)??Cs(this,gr,"m",xx).call(this,t)}RecursiveRef(t){return ji(this.Base())?Qr(this.recursiveAnchors[0],t.$recursiveRef):Qr(this.Base(),t.$recursiveRef)}DynamicRef(t){const n=this.schema;return gx(n,this.Base(),t,this.dynamicAnchors)}}gr=new WeakSet,hx=function e(t,n=!0){if(!tn(t))return;const r=t;if(!(!n&&vr(r))){!n&&Jr(r)&&this.dynamicAnchors.push(r);for(const s of D(r))Cs(this,gr,"m",e).call(this,r[s],!1)}},bx=function e(t,n=!0){if(!tn(t))return;const r=t;if(!(!n&&vr(r))){!n&&Jr(r)&&this.dynamicAnchors.pop();for(const s of D(r))Cs(this,gr,"m",e).call(this,r[s],!1)}},kx=function(t){return E(this.context,t.$ref)?this.context[t.$ref]:void 0},xx=function(t){const n=this.schema;return t.$ref.startsWith("#")?Qr(this.Base(),t.$ref):Qr(n,t.$ref)};function J$(e){const t=e.Functions().join(`;
|
|
9
|
-
`),n=e.UseUnevaluated()?["const context = new CheckContext({}, {})",`return ${e.Entry()}`]:[`return ${e.Entry()}`];return`${t}; return (value) => { ${n.join("; ")} }`}function Q$(e,t){return Im("CheckContext","Guard","Format","Hashing",e.External().identifier,t)(Bn,$i,s$,qw,e.External().variables)}function Y$(e){const t=new ii(e.Context(),e.Schema()),n=new Bn;return r=>it(t,n,e.Schema(),r)}function X$(e,t){return vm()?Q$(e,t):Y$(e)}class yx{constructor(t,n,r){this.isAccelerated=t,this.code=n,this.check=r}IsAccelerated(){return this.isAccelerated}Code(){return this.code}Check(t){return this.check(t)}}class Sx{constructor(t,n,r,s,o,i){this.context=t,this.schema=n,this.external=r,this.functions=s,this.entry=o,this.useUnevaluated=i}Context(){return this.context}Schema(){return this.schema}UseUnevaluated(){return this.useUnevaluated}External(){return this.external}Functions(){return this.functions}Entry(){return this.entry}Evaluate(){const t=J$(this),n=X$(this,t);return new yx(vm(),t,n)}}function wx(...e){const[t,n]=ct(e,{2:(l,d)=>[l,d],1:l=>[{},l]});Sh(),ox();const r=new ii(t,n),s=new yh(xh(t,n)),o=Vs(r,s,n,"value"),i=ix(),a=wh();return new Sx(t,n,a,i,o,s.UseUnevaluated())}function yo(...e){const[t,n,r]=ct(e,{3:(m,p,g)=>[m,p,g],2:(m,p)=>[{},m,p]}),s=Ao(),o=Gw(),i=[],a=new ii(t,n),l=new fd(m=>{if(!Ns(i.length,s.maxErrors))return i.push({...m,message:o(m)})});return[Ct(a,l,"#","",n,r),i]}function Hd(...e){const[t,n,r]=ct(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),s=new ii(t,n),o=new Bn;return it(s,o,n,r)}let qd=class{constructor(t,n,r){this.schema=t,this.value=n,this.errors=r}};function Z$(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});if(!Hd(t,n,r)){const[s,o]=yo(t,n,r);throw new qd(n,r,o)}return r}class vx{constructor(t,n){this.buildResult=wx(t,n),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Schema(){return this.buildResult.Schema()}Check(t){return this.evaluateResult.Check(t)}Parse(t){if(this.evaluateResult.Check(t))return t;const[n,r]=yo(this.buildResult.Context(),this.buildResult.Schema(),t);throw new qd(this.buildResult.Schema(),t,r)}Errors(t){return yo(this.buildResult.Context(),this.buildResult.Schema(),t)}}function eR(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return new vx(t,n)}const tR=Object.freeze(Object.defineProperty({__proto__:null,AccumulatedErrorContext:Hn,Build:wx,BuildAdditionalItems:jh,BuildAdditionalProperties:Oh,BuildAdditionalPropertiesFast:Ph,BuildAdditionalPropertiesStandard:Nh,BuildAllOf:Mh,BuildAnyOf:_h,BuildConst:qh,BuildContains:Gh,BuildContext:yh,BuildDependencies:Wh,BuildDependentRequired:Yh,BuildDependentSchemas:eb,BuildEnum:rb,BuildExclusiveMaximum:ob,BuildExclusiveMinimum:ab,BuildFormat:Db,BuildIf:Lb,BuildItems:Hb,BuildMaxContains:Gb,BuildMaxItems:Qb,BuildMaxLength:Xb,BuildMaxProperties:ek,BuildMaximum:Wb,BuildMinContains:rk,BuildMinItems:ak,BuildMinLength:lk,BuildMinProperties:uk,BuildMinimum:ok,BuildMultipleOf:mk,BuildNot:gk,BuildOneOf:bk,BuildPattern:yk,BuildPatternProperties:wk,BuildPrefixItems:Ck,BuildProperties:Ek,BuildPropertyNames:Ok,BuildRecursiveRef:Mk,BuildRef:_k,BuildRefine:vh,BuildRequired:Bk,BuildResult:Sx,BuildSchema:ot,BuildSchemaBoolean:Bh,BuildSchemaPushStack:$n,BuildType:Gk,BuildUnevaluatedItems:Jk,BuildUnevaluatedProperties:Xk,BuildUniqueItems:tx,CanAdditionalPropertiesFast:Eh,Check:Hd,CheckAdditionalItems:Th,CheckAdditionalProperties:$h,CheckAllOf:Fh,CheckAnyOf:Lh,CheckConst:hd,CheckContains:bd,CheckContext:Bn,CheckDependencies:Jh,CheckDependentRequired:Xh,CheckDependentSchemas:tb,CheckEnum:kd,CheckExclusiveMaximum:xd,CheckExclusiveMinimum:yd,CheckFormat:vd,CheckIf:Ub,CheckItems:qb,CheckMaxContains:Id,CheckMaxItems:jd,CheckMaxLength:Td,CheckMaxProperties:Ad,CheckMaximum:Cd,CheckMinContains:Ed,CheckMinItems:Nd,CheckMinLength:Od,CheckMinProperties:$d,CheckMinimum:Pd,CheckMultipleOf:Rd,CheckNot:Md,CheckOneOf:kk,CheckPattern:Fd,CheckPatternProperties:vk,CheckPrefixItems:jk,CheckProperties:Pk,CheckPropertyNames:$k,CheckRecursiveRef:Fk,CheckRef:Lk,CheckRefine:Ih,CheckRequired:Hk,CheckSchema:it,CheckSchemaBoolean:gd,CheckSchemaPushStack:$r,CheckType:Vk,CheckUnevaluatedItems:Qk,CheckUnevaluatedProperties:Zk,CheckUniqueItems:nx,Compile:eR,CreateFunction:Vs,CreateVariable:us,ErrorAdditionalItems:Ah,ErrorAdditionalProperties:Rh,ErrorAllOf:Dh,ErrorAnyOf:Uh,ErrorConst:zh,ErrorContains:Vh,ErrorContext:fd,ErrorDependencies:Qh,ErrorDependentRequired:Zh,ErrorDependentSchemas:nb,ErrorEnum:sb,ErrorExclusiveMaximum:ib,ErrorExclusiveMinimum:cb,ErrorFormat:_b,ErrorIf:Bb,ErrorItems:zb,ErrorMaxContains:Vb,ErrorMaxItems:Yb,ErrorMaxLength:Zb,ErrorMaxProperties:tk,ErrorMaximum:Jb,ErrorMinContains:sk,ErrorMinItems:ck,ErrorMinLength:dk,ErrorMinProperties:fk,ErrorMinimum:ik,ErrorMultipleOf:pk,ErrorNot:hk,ErrorOneOf:xk,ErrorPattern:Sk,ErrorPatternProperties:Ik,ErrorPrefixItems:Tk,ErrorProperties:Nk,ErrorPropertyNames:Rk,ErrorRecursiveRef:Dk,ErrorRef:Uk,ErrorRefine:Ch,ErrorRequired:qk,ErrorSchema:Ct,ErrorSchemaBoolean:Hh,ErrorSchemaPushStack:Rr,ErrorType:Wk,ErrorUnevaluatedItems:Yk,ErrorUnevaluatedProperties:ex,ErrorUniqueItems:rx,Errors:yo,EvaluateResult:yx,GetExternal:wh,GetFunctions:ix,HasUnevaluated:xh,IsAdditionalItems:Go,IsAdditionalProperties:ar,IsAllOf:ka,IsAnchor:Hi,IsAnyOf:xa,IsConst:ya,IsContains:is,IsContentEncoding:QN,IsContentMediaType:YN,IsDefault:Er,IsDefs:XN,IsDependencies:Vo,IsDependentRequired:Wo,IsDependentSchemas:Jo,IsDynamicAnchor:Jr,IsDynamicRef:Sa,IsElse:wa,IsEnum:va,IsExclusiveMaximum:Qo,IsExclusiveMinimum:Pr,IsFormat:Us,IsId:vr,IsIf:Ia,IsItems:Nr,IsItemsSized:Ca,IsItemsUnsized:ZN,IsMaxContains:Xo,IsMaxItems:Bs,IsMaxLength:Zo,IsMaxProperties:ei,IsMaximum:Yo,IsMinContains:as,IsMinItems:cs,IsMinLength:Hs,IsMinProperties:qs,IsMinimum:Or,IsMultipleOf:ti,IsNot:ja,IsOneOf:Ta,IsPattern:zs,IsPatternProperties:ls,IsPrefixItems:cr,IsProperties:ds,IsPropertyNames:ni,IsRecursiveAnchor:kh,IsRecursiveAnchorTrue:ji,IsRecursiveRef:Aa,IsRef:Ea,IsRefine:ba,IsRequired:lr,IsSchema:_e,IsSchemaBoolean:Ko,IsSchemaObject:tn,IsThen:Pa,IsType:ri,IsUnevaluatedItems:Ks,IsUnevaluatedProperties:Gs,IsUniqueItems:Ir,Parse:Z$,ParseError:qd,Pointer:mx,Reducer:si,ResetExternal:Sh,ResetFunctions:ox,Resolve:W$,Stack:ii,Validator:vx},Symbol.toStringTag,{value:"Module"}));function rt(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return Hd(t,n,r)}function ai(...e){const[t,n,r]=ct(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),[s,o]=yo(t,n,r);return o}class Na extends Error{constructor(t,n,r){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:r,value:n},writable:!1,configurable:!1,enumerable:!1})}}function Ix(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(!rt(t,n,r))throw new Na("Assert",r,ai(t,n,r))}function nR(e,t,n){return H(n)?n.map(r=>Tn(e,t.items,r)):n}function rR(e,t,n){return Tn({...e,...t.$defs},dn(t.$ref),n)}function sR(e,t){const n=E(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},r=Ls(e,t),s=Un(r);return Le(s)?mh(s,n):s}function oR(e,t,n){const r=sR(e,t);return Tn(e,r,n)}function Cx(e){return E(e,"additionalProperties")?e.additionalProperties:void 0}function iR(e,t,n){if(!ne(n)||H(n))return n;const r=Cx(t);for(const s of D(n)){if(E(t.properties,s)){n[s]=Tn(e,t.properties[s],n[s]);continue}if(ht(r)&&h(r,!0)||Yt(r)&&rt(e,r,n[s])){n[s]=Tn(e,r,n[s]);continue}delete n[s]}return n}function aR(e,t,n){if(!ne(n))return n;const r=Cx(t),[s,o]=[new RegExp(kn(t)),qt(t)];for(const i of D(n)){if(s.test(i)){n[i]=Tn(e,o,n[i]);continue}if(ht(r)&&h(r,!0)||Yt(r)&&rt(e,r,n[i])){n[i]=Tn(e,r,n[i]);continue}delete n[i]}return n}function cR(e,t,n){return E(e,t.$ref)?Tn(e,e[t.$ref],n):n}function lR(e,t,n){if(!H(n))return n;const r=Math.min(n.length,t.items.length);for(let s=0;s<r;s++)n[s]=Tn(e,t.items[s],n[s]);return Yr(n.length,r)?n.slice(0,r):n}function Ut(e){return bl(e)}function dR(e,t,n){for(const r of t.anyOf){const s=Tn(e,r,Ut(n));if(rt(e,r,s))return s}return n}function Tn(e,t,n){return ut(t)?nR(e,t,n):Ht(t)?rR(e,t,n):Ue(t)?oR(e,t,n):Le(t)?iR(e,t,n):At(t)?aR(e,t,n):kt(t)?cR(e,t,n):st(t)?lR(e,t,n):ae(t)?dR(e,t,n):n}function uR(e,t){for(const n of $i.Keys(e))$i.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function fR(e){const t={};for(const n of $i.Keys(e))t[n]=So(e[n]);return t}function mR(e){return Fc(WN(e))}function Fc(e){return e.map(t=>So(t))}function So(e){const t=ut(e)?Cr(So(e.items),yl(e)):Ue(e)?Fn(Fc(e.allOf)):ae(e)?Ve(mR(e.anyOf)):Le(e)?Ae(fR(e.properties)):At(e)?El(la(e),So(qt(e))):st(e)?bn(Fc(e.items)):e;return uR(e,t)}function zd(e){return So(e)}function ci(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=zd(n);return Tn(t,s,r)}function sn(e){return ne(e)&&E(e,"value")}function te(e){return{value:e}}function pR(e){return H(e)?te(e):te([e])}function gR(e){return h(e,!0)?te(BigInt(1)):te(BigInt(0))}const hR=/^-?(0|[1-9]\d*)n$/,bR=/^-?(0|[1-9]\d*)\.\d+$/,kR=/^-?(0|[1-9]\d*)$/;function xR(e){return hR.test(e)}function yR(e){return bR.test(e)}function SR(e){return kR.test(e)}function wR(e){const t=e.toLowerCase();return xR(e)?te(BigInt(e.slice(0,e.length-1))):yR(e)?te(BigInt(e.split(".")[0])):SR(e)?te(BigInt(e)):h(t,"false")?te(BigInt(0)):h(t,"true")?te(BigInt(1)):void 0}function Kd(e){return tt(e)?te(e):ht(e)?gR(e):ye(e)?te(BigInt(Math.trunc(e))):Vt(e)?te(BigInt(0)):ie(e)?wR(e):$e(e)?te(BigInt(0)):void 0}function vR(e){return h(e,BigInt(0))?te(!1):h(e,BigInt(1))?te(!0):void 0}function IR(e){return h(e,0)?te(!1):h(e,1)?te(!0):void 0}function CR(e){return h(e.toLowerCase(),"false")?te(!1):h(e.toLowerCase(),"true")?te(!0):h(e,"0")?te(!1):h(e,"1")?te(!0):void 0}function jx(e){return tt(e)?vR(e):ht(e)?te(e):ye(e)?IR(e):Vt(e)?te(!1):ie(e)?CR(e):$e(e)?te(!1):void 0}function jR(e){return h(e,BigInt(0))?te(null):void 0}function TR(e){return h(e,!1)?te(null):void 0}function AR(e){return h(e,0)?te(null):void 0}function ER(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?te(null):void 0}function PR(e){return tt(e)?jR(e):ht(e)?TR(e):ye(e)?AR(e):Vt(e)?te(null):ie(e)?ER(e):$e(e)?te(null):void 0}const Tx=BigInt(Number.MAX_SAFE_INTEGER),Ax=BigInt(Number.MIN_SAFE_INTEGER);function NR(e){return e<=Tx&&e>=Ax?te(Number(e)):void 0}function OR(e){return te(e?1:0)}function $R(e){const t=+e;if(ye(t))return te(t);const n=e.toLowerCase();if(h(n,"false"))return te(0);if(h(n,"true"))return te(1);const r=Kd(e);return sn(r)&&r.value<=Tx&&r.value>=Ax?te(Number(r.value)):void 0}function Gd(e){return tt(e)?NR(e):ht(e)?OR(e):ye(e)?te(e):Vt(e)?te(0):ie(e)?$R(e):$e(e)?te(0):void 0}function Ex(e){return tt(e)||ht(e)||ye(e)?te(e.toString()):Vt(e)?te("null"):ie(e)?te(e):$e(e)?te(""):void 0}function RR(e){return h(e,BigInt(0))?te(void 0):void 0}function MR(e){return h(e,!1)?te(void 0):void 0}function FR(e){return h(e,0)?te(void 0):void 0}function DR(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?te(void 0):void 0}function Px(e){return tt(e)?RR(e):ht(e)?MR(e):ye(e)?FR(e):Vt(e)?te(void 0):ie(e)?DR(e):$e(e)?te(e):void 0}function _R(e,t,n){return pR(n).value.map(s=>xn(e,t.items,s))}function LR(e,t,n){const r=Kd(n);return sn(r)?r.value:n}function UR(e,t,n){const r=jx(n);return sn(r)?r.value:n}function BR(e,t,n){return xn({...e,...t.$defs},dn(t.$ref),n)}function HR(e,t,n){return xn(e,Un(t),n)}function qR(e,t,n){const r=Gd(n);return sn(r)?Math.trunc(r.value):n}function zR(e,t,n){const r=Ls(e,t),s=Un(r);return xn(e,s,n)}function KR(e,t,n){const r=Kd(n);return sn(r)&&h(t.const,r.value)?r.value:n}function GR(e,t,n){const r=jx(n);return sn(r)&&h(t.const,r.value)?r.value:n}function VR(e,t,n){const r=Gd(n);return sn(r)&&h(t.const,r.value)?r.value:n}function WR(e,t,n){const r=Ex(n);return sn(r)&&h(t.const,r.value)?r.value:n}function JR(e,t,n){return h(t.const,n)?n:sv(t)?KR(e,t,n):ov(t)?GR(e,t,n):Rm(t)?VR(e,t,n):Mm(t)?WR(e,t,n):Ot()}function QR(e,t,n){const r=PR(n);return sn(r)?r.value:n}function YR(e,t,n){const r=Gd(n);return sn(r)?r.value:n}function Nx(e,t,n,r){const s=D(r);for(const[o,i]of t)for(const a of s)o.test(a)||(r[a]=xn(e,n,r[a]));return r}function Vd(e,t,n){return Xt(e)&&$e(n[t])}function XR(e,t,n){const r=ul(t.properties),s=D(n);for(const[o,i]of r)for(const a of s)!o.test(a)||Vd(i,a,n)||(n[a]=xn(e,i,n[a]));return E(t,"additionalProperties")&&ne(t.additionalProperties)?Nx(e,r,t.additionalProperties,n):n}function ZR(e,t,n){return fn(n)?XR(e,t,n):n}function eM(e,t,n){const r=ul(t.patternProperties),s=D(n);for(const[o,i]of r)for(const a of s)o.test(a)&&(n[a]=xn(e,i,n[a]));return E(t,"additionalProperties")&&ne(t.additionalProperties)?Nx(e,r,t.additionalProperties,n):n}function tM(e,t,n){return fn(n)?eM(e,t,n):n}function nM(e,t,n){return E(e,t.$ref)?xn(e,e[t.$ref],n):n}function rM(e,t,n){const r=Ex(n);return sn(r)?r.value:n}function sM(e,t,n){return xn(e,Un(t),n)}function oM(e,t,n){if(!H(n))return n;for(let r=0;r<Math.min(t.items.length,n.length);r++)n[r]=xn(e,t.items[r],n[r]);return n}function iM(e,t,n){const r=Px(n);return sn(r)?r.value:n}function aM(e,t,n){if(t.anyOf.some(i=>rt(e,i,n)))return n;const o=t.anyOf.map(i=>xn(e,i,Ut(n))).find(i=>rt(e,t,i));return $e(o)?n:o}function cM(e,t,n){const r=Px(n);return sn(r)?void 0:n}function xn(e,t,n){return ut(t)?_R(e,t,n):ts(t)?LR(e,t,n):jr(t)?UR(e,t,n):Ht(t)?BR(e,t,n):hn(t)?HR(e,t,n):_n(t)?qR(e,t,n):Ue(t)?zR(e,t,n):We(t)?JR(e,t,n):$o(t)?QR(e,t,n):nn(t)?YR(e,t,n):Le(t)?ZR(e,t,n):At(t)?tM(e,t,n):kt(t)?nM(e,t,n):On(t)?rM(e,t,n):zt(t)?sM(e,t,n):st(t)?oM(e,t,n):Ds(t)?iM(e,t,n):ae(t)?aM(e,t,n):ns(t)?cM(e,t,n):n}function Oa(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return xn(t,n,r)}function lM(e,t,n){if(!H(n))return n;for(let r=0;r<n.length;r++)n[r]=An(e,t.items,n[r]);return n}function dM(e,t,n){return An({...e,...t.$defs},dn(t.$ref),n)}function uM(e,t){return $e(t)?In(e.default)?e.default():Ut(e.default):t}function fM(e,t,n){const r=Ls(e,t),s=Un(r);return An(e,s,n)}function mM(e,t,n){if(!ne(n))return n;const r=D(t.properties);for(const s of r){const o=An(e,t.properties[s],n[s]);$e(o)&&(Xt(t.properties[s])||!E(t.properties[s],"default"))||(n[s]=o)}if(!ar(t)||ht(t.additionalProperties))return n;for(const s of D(n))r.includes(s)||(n[s]=An(e,t.additionalProperties,n[s]));return n}function pM(e,t,n){if(!ne(n))return n;const[r,s]=[new RegExp(kn(t)),qt(t)];for(const o of D(n))r.test(o)&&Er(s)&&(n[o]=An(e,s,n[o]));if(!ar(t))return n;for(const o of D(n))r.test(o)||(n[o]=An(e,t.additionalProperties,n[o]));return n}function gM(e,t,n){return E(e,t.$ref)?An(e,e[t.$ref],n):n}function hM(e,t,n){if(!H(n))return n;const[r,s]=[t.items,Math.max(t.items.length,n.length)];for(let o=0;o<s;o++)o<r.length&&(n[o]=An(e,r[o],n[o]));return n}function bM(e,t,n){for(const r of t.anyOf){const s=An(e,r,Ut(n));if(rt(e,r,s))return s}return n}function An(e,t,n){const r=Er(t)?uM(t,n):n;return ut(t)?lM(e,t,r):Ht(t)?dM(e,t,r):Ue(t)?fM(e,t,r):Le(t)?mM(e,t,r):At(t)?pM(e,t,r):kt(t)?gM(e,t,r):st(t)?hM(e,t,r):ae(t)?bM(e,t,r):r}function Wd(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return An(t,n,r)}function Ox(e){return(...t)=>{const[n,r,s]=ct(t,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return e.reduce((o,i)=>i(n,r,o),s)}}function kM(e,t,n){return t["~codec"].decode(n)}function xM(e,t,n){return t["~codec"].encode(n)}function vt(e,t,n,r){return en(n)?h(e,"Decode")?kM(t,n,r):xM(t,n,r):r}function yM(e,t,n,r){if(!H(r))return r;for(let s=0;s<r.length;s++)r[s]=Dt(e,t,n.items,r[s]);return vt(e,t,n,r)}function SM(e,t,n,r){const s=vt(e,t,n,r);if(!H(s))return s;for(let o=0;o<s.length;o++)s[o]=Dt(e,t,n.items,s[o]);return s}function wM(e,t,n,r){return h(e,"Decode")?yM(e,t,n,r):SM(e,t,n,r)}function vM(e,t,n,r){return r=Dt(e,{...t,...n.$defs},dn(n.$ref),r),vt(e,t,n,r)}function $x(e){return e.reduce((t,n)=>({...t,...n}),{})}function Rx(e,t){for(const n of t)if(!Xr(e,n))return n;return e}function IM(e,t,n,r){if(h(n.allOf.length,0))return vt(e,t,n,r);const s=n.allOf.map(a=>Dt(e,t,a,ci(a,Ut(r)))),i=s.every(a=>ne(a))?$x(s):Rx(r,s);return vt(e,t,n,i)}function CM(e,t,n,r){if(h(n.allOf.length,0))return vt(e,t,n,r);const s=vt(e,t,n,r),o=n.allOf.map(a=>Dt(e,t,a,ci(a,Ut(s))));return o.every(a=>ne(a))?$x(o):Rx(s,o)}function jM(e,t,n,r){return h(e,"Decode")?IM(e,t,n,r):CM(e,t,n,r)}function TM(e,t,n,r){if(!fn(r))return r;for(const s of D(n.properties))!E(r,s)||Vd(n.properties[s],s,r)||(r[s]=Dt(e,t,n.properties[s],r[s]));return vt(e,t,n,r)}function AM(e,t,n,r){const s=vt(e,t,n,r);if(!fn(s))return s;for(const o of D(n.properties))!E(s,o)||Vd(n.properties[o],o,s)||(s[o]=Dt(e,t,n.properties[o],s[o]));return s}function EM(e,t,n,r){return h(e,"Decode")?TM(e,t,n,r):AM(e,t,n,r)}function PM(e,t,n,r){if(!fn(r))return r;const s=new RegExp(kn(n));for(const o of D(r))s.test(o)&&(r[o]=Dt(e,t,qt(n),r[o]));return vt(e,t,n,r)}function NM(e,t,n,r){const s=vt(e,t,n,r);if(!fn(s))return s;const o=new RegExp(kn(n));for(const i of D(s))o.test(i)&&(s[i]=Dt(e,t,qt(n),s[i]));return s}function OM(e,t,n,r){return h(e,"Decode")?PM(e,t,n,r):NM(e,t,n,r)}function Zu(e,t,n,r){return E(t,n.$ref)?Dt(e,t,t[n.$ref],r):r}function $M(e,t,n,r){return h(e,"Decode")?vt(e,t,n,Zu(e,t,n,r)):Zu(e,t,n,vt(e,t,n,r))}function RM(e,t,n,r){if(!H(r))return r;for(let s=0;s<Math.min(n.items.length,r.length);s++)r[s]=Dt(e,t,n.items[s],r[s]);return vt(e,t,n,r)}function MM(e,t,n,r){const s=vt(e,t,n,r);if(!H(s))return r;for(let o=0;o<Math.min(n.items.length,s.length);o++)s[o]=Dt(e,t,n.items[o],s[o]);return s}function FM(e,t,n,r){return h(e,"Decode")?RM(e,t,n,r):MM(e,t,n,r)}function DM(e,t,n,r){for(const s of n.anyOf){if(!rt(t,s,r))continue;const o=Dt(e,t,s,r);return vt(e,t,n,o)}return r}function _M(e,t,n,r){const s=vt(e,t,n,r);for(const o of n.anyOf){const i=Dt(e,t,o,Ut(s));if(rt(t,o,i))return i}return s}function LM(e,t,n,r){return h(e,"Decode")?DM(e,t,n,r):_M(e,t,n,r)}function Dt(e,t,n,r){return ut(n)?wM(e,t,n,r):Ht(n)?vM(e,t,n,r):Ue(n)?jM(e,t,n,r):Le(n)?EM(e,t,n,r):At(n)?OM(e,t,n,r):kt(n)?$M(e,t,n,r):st(n)?FM(e,t,n,r):ae(n)?LM(e,t,n,r):vt(e,t,n,r)}class UM extends Na{constructor(t,n){super("Decode",t,n)}}function BM(e,t,n){if(!rt(e,t,n))throw new UM(n,ai(e,t,n));return n}function HM(e,t,n){const r=zd(t);return Dt("Decode",e,r,n)}const qM=Ox([(e,t,n)=>Ut(n),(e,t,n)=>Wd(e,t,n),(e,t,n)=>Oa(e,t,n),(e,t,n)=>ci(e,t,n),(e,t,n)=>BM(e,t,n),(e,t,n)=>HM(e,t,n)]);function zM(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return qM(t,n,r)}class KM extends Na{constructor(t,n){super("Encode",t,n)}}function GM(e,t,n){if(!rt(e,t,n))throw new KM(n,ai(e,t,n));return n}function VM(e,t,n){const r=zd(t);return Dt("Encode",e,r,n)}const WM=Ox([(e,t,n)=>Ut(n),(e,t,n)=>VM(e,t,n),(e,t,n)=>Wd(e,t,n),(e,t,n)=>Oa(e,t,n),(e,t,n)=>ci(e,t,n),(e,t,n)=>GM(e,t,n)]);function JM(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return WM(t,n,r)}function QM(e,t){return en(t)||Mr(e,t.items)}function YM(e,t){return en(t)||Mx({...e,...t.$defs},dn(t.$ref))}function XM(e,t){return en(t)||t.allOf.some(n=>Mr(e,n))}function ZM(e,t){return en(t)||D(t.properties).some(n=>Mr(e,t.properties[n]))}function eF(e,t){return en(t)||Mr(e,qt(t))}function Mx(e,t){return Dc.has(t.$ref)?!1:(Dc.add(t.$ref),en(t)||E(e,t.$ref)&&Mr(e,e[t.$ref]))}function tF(e,t){return en(t)||t.items.some(n=>Mr(e,n))}function nF(e,t){return en(t)||t.anyOf.some(n=>Mr(e,n))}function Mr(e,t){return ut(t)?QM(e,t):Ht(t)?YM(e,t):Ue(t)?XM(e,t):Le(t)?ZM(e,t):At(t)?eF(e,t):kt(t)?Mx(e,t):st(t)?tF(e,t):ae(t)?nF(e,t):en(t)}const Dc=new Set;function rF(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return Dc.clear(),Mr(t,n)}class li extends Error{constructor(t,n){super(n),this.type=t}}function sF(e,t){return In(t.default)?t.default(t):ne(t.default)?Ut(t.default):t.default}function oF(e,t){if(Ir(t)&&!Er(t))throw new li(t,"Arrays with uniqueItems constraints must specify a default annotation");const n=cs(t)?t.minItems:0;return Array.from({length:n},()=>yn(e,t.items))}function iF(e,t){return Pr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Or(t)?BigInt(t.minimum):BigInt(0)}function aF(e,t){return!1}function cF(e,t){const n=yn(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function lF(e,t){return yn({...e,...t.$defs},dn(t.$ref))}function dF(e,t){return yn(e,Un(t))}function uF(e,t){const n=yn(e,t.returnType);return()=>n}function fF(e,t){return Pr(t)&&ye(t.exclusiveMinimum)?t.exclusiveMinimum+1:Or(t)?t.minimum:0}function mF(e,t){const n=Ls(e,t),r=Un(n);return yn(e,r)}function pF(e,t){return t.const}function gF(e,t){throw new li(t,"Cannot create TNever types")}function hF(e,t){return null}function bF(e,t){return Pr(t)&&ye(t.exclusiveMinimum)?t.exclusiveMinimum+1:Or(t)?t.minimum:0}function kF(e,t){return($e(t.required)?[]:t.required).reduce((r,s)=>({...r,[s]:yn(e,t.properties[s])}),{})}function xF(e,t){if(qs(t)&&!Er(t))throw new li(t,"Record with the minProperties constraint must have a default annotation");return{}}function yF(e,t){return E(e,t.$ref)?yn(e,e[t.$ref]):(()=>{throw new li(t,"Unable to deref Ref")})()}function SF(e,t){if((zs(t)||Us(t))&&!Er(t))throw Error("Strings with format or pattern constraints must specify default");const r=Hs(t)?t.minLength:0;return"".padEnd(r)}function wF(e,t){return Symbol()}function vF(e,t){const n=Al(t.pattern);if(On(n))throw new li(t,"Unable to create TemplateLiteral due to infinite type expansion");return yn(e,n)}function IF(e,t){return Array.from({length:t.minItems},(n,r)=>yn(e,t.items[r]))}function CF(e,t){if(h(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return yn(e,t.anyOf[0])}function yn(e,t){return Er(t)?sF(e,t):ut(t)?oF(e,t):ts(t)?iF(e,t):jr(t)?aF():mn(t)?cF(e,t):Ht(t)?lF(e,t):hn(t)?dF(e,t):pn(t)?uF(e,t):_n(t)?fF(e,t):Ue(t)?mF(e,t):We(t)?pF(e,t):Rs(t)?gF(e,t):$o(t)?hF():nn(t)?bF(e,t):Le(t)?kF(e,t):At(t)?xF(e,t):kt(t)?yF(e,t):On(t)?SF(e,t):Ro(t)?wF():zt(t)?vF(e,t):st(t)?IF(e,t):Ds(t)?void 0:ae(t)?CF(e,t):ns(t)?void 0:void 0}function En(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return yn(t,n)}function Fx(e,t){return Xr(e,t)}function Dx(e){return sa(e)}class jF extends Na{constructor(t,n){super("Parse",t,n)}}function TF(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(rt(t,n,r))return r;throw new jF(r,ai(t,n,r))}function $a(e,t){return{type:"update",path:e,value:t}}function _x(e,t){return{type:"insert",path:e,value:t}}function Lx(e){return{type:"delete",path:e}}function ef(e){if(!(ne(e)&&h(fl(e).length,0)))throw new Error("Cannot create diffs for objects with symbols keys")}function*AF(e,t,n){if(!ne(n)||H(n))return yield $a(e,n);ef(t),ef(n);const r=D(t),s=D(n);for(const o of s)E(t,o)||Jn(o)||(yield _x(`${e}/${o}`,n[o]));for(const o of r)E(n,o)&&(Jn(o)||Fx(t,n)||(yield*Ra(`${e}/${o}`,t[o],n[o])));for(const o of r)E(n,o)||Jn(o)||(yield Lx(`${e}/${o}`))}function*EF(e,t,n){if(!H(n))return yield $a(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*Ra(`${e}/${r}`,t[r],n[r]);for(let r=0;r<n.length;r++)r<t.length||(yield _x(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield Lx(`${e}/${r}`))}function*PF(e,t,n){const r=globalThis.Object.getPrototypeOf(t).constructor.name,s=globalThis.Object.getPrototypeOf(n).constructor.name;if(To(n)&&h(t.length,n.length)&&h(r,s))for(let i=0;i<Math.min(t.length,n.length);i++)yield*Ra(`${e}/${i}`,t[i],n[i]);else return yield $a(e,n)}function*NF(e,t,n){t!==n&&(yield $a(e,n))}function*Ra(e,t,n){return To(t)?yield*PF(e,t,n):H(t)?yield*EF(e,t,n):ne(t)?yield*AF(e,t,n):yield*NF(e,t,n)}function OF(e,t){return[...Ra("",e,t)]}const $F=Ae({type:Me("insert"),path:Ln(),value:Bt()}),RF=Object({type:Me("update"),path:Ln(),value:Bt()}),MF=Ae({type:Me("delete"),path:Ln()});Ve([$F,RF,MF]);function FF(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function DF(e){return e.length===0}function _F(e,t){if(FF(t))return Ut(t[0].value);if(DF(t))return Ut(e);const n=Ut(e);for(const r of t)switch(r.type){case"insert":{Mc(n,r.path,r.value);break}case"update":{Mc(n,r.path,r.value);break}case"delete":{fx(n,r.path);break}}return n}class Ma extends Error{constructor(t,n,r,s){super(s),this.context=t,this.type=n,this.value=r}}function LF(e){const[t,n]=[new Set,[]];for(const r of e){const s=Dx(r);t.has(s)||(t.add(s),n.push(r))}return n}function UF(e,t,n){if(rt(e,t,n))return n;const r=H(n)?n:En(e,t),s=cs(t)&&r.length<t.minItems?[...r,...Array.from({length:t.minItems-r.length},()=>En(e,t))]:r,i=(Bs(t)&&s.length>t.maxItems?s.slice(0,t.maxItems):s).map(l=>un(e,t.items,l));if(!Ir(t)||Ir(t)&&!h(t.uniqueItems,!0))return i;const a=LF(i);if(!rt(e,t,a))throw new Ma(e,t,n,"Failed to repair Array due to uniqueItems constraint");return a}function BF(e,t,n){return un(e,Un(t),n)}function HF(e,t,n){const r=Ls(e,t),s=Un(r);return un(e,s,n)}function qF(e,t,n){if(rt(e,t,n))return n;if(!fn(n))return En(e,t);const r=new Set($e(t.required)?[]:t.required),s={};for(const[i,a]of nt(t.properties))!r.has(i)&&$e(n[i])||(s[i]=i in n?un(e,a,n[i]):En(e,a));const o=D(t.properties);if(ar(t)&&ne(t.additionalProperties))for(const i of D(n))o.includes(i)||(s[i]=un(e,t.additionalProperties,n[i]));return s}function zF(e,t,n){if(rt(e,t,n))return n;if(Vt(n)||!ne(n)||H(n))return En(e,t);const r=new RegExp(kn(t)),s=qt(t),o=new Set,i={};for(const[a,l]of nt(n))r.test(a)&&(i[a]=un(e,s,l),o.add(a));if(ar(t))for(const a of D(n))o.has(a)||(i[a]=un(e,t.additionalProperties,n[a]));return i}function KF(e,t,n){return E(e,t.$ref)?un(e,e[t.$ref],n):(()=>{throw new Ma(e,t,n,"Unable to de-reference target type")})()}function GF(e,t,n){const r=Al(t.pattern);return un(e,r,n)}function VF(e,t,n){return rt(e,t,n)?n:H(n)?t.items.map((r,s)=>un(e,r,n[s])):En(e,t)}function Ux(e,t,n){return kt(t)?E(e,t.$ref)?Ux(e,e[t.$ref]):(()=>{throw new Error("Unable to Deref target")})():t}function WF(e,t,n){if(!(Le(t)&&ne(n)))return 0;const r=D(n);return nt(t.properties).reduce((o,[i,a])=>{const l=We(a)&&h(a.const,n[i])?100:0,d=rt(e,a,n[i])?10:0,m=r.includes(i)?1:0;return o+(l+d+m)},0)}function JF(e,t,n){const r=t.anyOf.map(i=>Ux(e,i));let[s,o]=[r[0],0];for(const i of r){const a=WF(e,i,n);a>o&&(s=i,o=a)}return s}function QF(e,t,n){const r=Ve(ia(t.anyOf)),s=JF(e,r,n);return un(e,s,n)}function YF(e,t,n){return rt(e,t,n)?Ut(n):Er(t)?En(e,t):QF(e,t,n)}function XF(e,t,n){if(rt(e,t,n))return n;const r=Oa(e,t,n);return rt(e,t,r)?r:En(e,t)}function ZF(e,t,n){if(bm(n)||xm(n)||km(n)||To(n)||ea(n)||In(n))throw new Ma(e,t,n,"Value is not repairable")}function eD(e,t,n){if(mn(t)||pn(t)||Rs(t))throw new Ma(e,t,n,"Type is not repairable")}function tD(e,t,n){return $e(n)&&!Ds(t)?En(e,t):n}function nD(e,t,n){return Il(t)?rt(e,t,n)?n:En(e,t):n}function un(e,t,n){ZF(e,t,n),eD(e,t,n);const r=tD(e,t,n),s=ut(t)?UF(e,t,r):hn(t)?BF(e,t,r):Ue(t)?HF(e,t,r):Le(t)?qF(e,t,r):At(t)?zF(e,t,r):kt(t)?KF(e,t,r):zt(t)?GF(e,t,r):st(t)?VF(e,t,r):ae(t)?YF(e,t,r):XF(e,t,r);return nD(e,t,s)}function rD(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=un(t,n,r);return Ix(t,n,s),s}const tc=Object.freeze(Object.defineProperty({__proto__:null,Assert:Ix,Check:rt,Clean:ci,Clone:Ut,Convert:Oa,Create:En,Decode:zM,Default:Wd,Diff:OF,Encode:JM,Equal:Fx,Errors:ai,HasCodec:rF,Hash:Dx,Parse:TF,Patch:_F,Pointer:mx,Repair:rD},Symbol.toStringTag,{value:"Module"}));class tf extends Error{constructor(t){super(t.map(n=>`${n.path.length>0?n.path.join("."):"root"}: ${n.message}`).join("; ")),this.issues=t,this.name="SchemaValidationError"}}function sD(e){return e?e.split("/").slice(1).map(t=>t.replace(/~1/g,"/").replace(/~0/g,"~")).map(t=>/^(0|[1-9]\d*)$/.test(t)?Number(t):t):[]}function oD(e,t){let n=e;for(const r of t){if(n===null||typeof n!="object")return;n=n[r]}return n}function nf(e,t){const[,n]=tR.Errors(e,t);return n.map(r=>{const s=sD(r.instancePath);return{code:r.keyword,path:s,message:r.message,value:oD(t,s)}})}function Bx(e,t){const n=tc.Default(e,tc.Clone(t)),r=nf(e,n);if(r.length>0)return{success:!1,error:new tf(r)};const s=tc.Clean(e,n),o=nf(e,s);return o.length>0?{success:!1,error:new tf(o)}:{success:!0,data:s}}function mr(e,t){const n=Bx(e,t);if(!n.success)throw n.error;return n.data}function J(e){return Object.defineProperties(e,{parse:{value:t=>mr(e,t),enumerable:!1},safeParse:{value:t=>Bx(e,t),enumerable:!1}}),e}function Yn(e,t){return f.Optional({...e,default:t})}function be(e,t={}){return f.Unsafe({type:"string",enum:[...e],...t})}const zr=20,po=5*1024*1024,iD=32e3,fs=J(be(["default","autoEdit","yolo","plan"])),hr={DEFAULT:"default",AUTO_EDIT:"autoEdit",YOLO:"yolo",PLAN:"plan"},Jd=J(be(["user","assistant","system","tool"])),aD=J(f.Union([f.Object({type:f.Literal("text"),text:f.String()}),f.Object({type:f.Literal("image_url"),image_url:f.Object({url:f.String()})})])),Hx=f.Union([f.String(),f.Array(aD)]);J(f.Object({id:f.String(),role:Jd,content:Hx,timestamp:f.Number(),metadata:f.Optional(f.Record(f.String(),f.Unknown())),thinkingContent:f.Optional(f.String()),tool_call_id:f.Optional(f.String()),name:f.Optional(f.String()),tool_calls:f.Optional(f.Unknown())}));const cD=J(be(["queued","running","completed","failed","cancelled","interrupted"])),di=J(be(["local","worktree"])),lD=J(be(["applied","discarded","conflicted"])),dD=J(f.Object({status:lD,updatedAt:f.String(),sourceCommit:f.Optional(f.String()),changedFiles:f.Optional(f.Integer({minimum:0})),message:f.Optional(f.String())})),uD=J(f.Object({changedFiles:f.Integer({minimum:0}),additions:f.Integer({minimum:0}),deletions:f.Integer({minimum:0}),commits:f.Integer({minimum:0})})),fD=J(f.Object({path:f.String({minLength:1}),patch:f.String({maxLength:2*1024*1024}),additions:f.Integer({minimum:0}),deletions:f.Integer({minimum:0}),binary:f.Boolean(),truncated:f.Boolean()})),mD=J(f.Object({sessionId:f.String(),projectPath:f.String(),baseCommit:f.String(),files:f.Array(fD,{maxItems:100}),truncated:f.Boolean()})),pD=f.Union([f.String(),f.Number(),f.Boolean(),f.Array(f.String())]),gD=J(f.Object({name:f.String(),type:be(["string","number","integer","boolean","select","multi-select"]),title:f.String(),description:f.Optional(f.String()),required:f.Boolean(),defaultValue:f.Optional(pD),options:f.Optional(f.Array(f.Object({value:f.String(),label:f.String()}))),format:f.Optional(be(["date","uri","email","date-time"])),minimum:f.Optional(f.Number()),maximum:f.Optional(f.Number()),minLength:f.Optional(f.Number()),maxLength:f.Optional(f.Number()),minItems:f.Optional(f.Number()),maxItems:f.Optional(f.Number())}));J(f.Object({serverName:f.String(),mode:be(["form","url"]),message:f.String(),fields:f.Optional(f.Array(gD)),requestedSchema:f.Optional(f.Record(f.String(),f.Unknown())),url:f.Optional(f.String()),domain:f.Optional(f.String()),elicitationId:f.Optional(f.String())}));const hD=J(f.Object({type:be(["permission","question","elicitation"]),requestId:f.String()})),bD=J(f.Object({code:be(["authentication","permission","rate_limit","timeout","network","model_unavailable","context_limit","unsupported_input","runtime"]),message:f.String({minLength:1,maxLength:500}),retryable:f.Boolean()})),Ws=J(be(["auto","off","minimal","low","medium","high","xhigh","max"])),Js=J(be(["auto","standard","fast","flex"])),Qs=J(be(["auto","low","medium","high"])),Fr=J(f.Union([be(["auto","pragmatic","friendly","explanatory"]),f.String({minLength:7,maxLength:300,pattern:"^(?:(?:user|project):[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3}|plugin:[a-z0-9][a-z0-9._-]{0,63}:[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3})$"})])),Xn=J(f.Object({sessionId:f.String(),projectPath:f.String(),title:f.Optional(f.String()),gitBranch:f.Optional(f.String()),rootId:f.String(),parentId:f.Optional(f.String()),relationType:f.Optional(be(["subagent","fork"])),resumedFrom:f.Optional(f.String()),rootAgentId:f.Optional(f.String()),resumeDepth:f.Optional(f.Integer({minimum:0})),taskStatus:Yn(cD,"completed"),taskStatusReason:f.Optional(f.String()),taskFailure:f.Optional(bD),taskStartedAt:f.Optional(f.String()),taskCompletedAt:f.Optional(f.String()),taskPromptSummary:f.Optional(f.String()),taskModelId:f.Optional(f.String()),selectedModelId:f.Optional(f.String()),permissionMode:f.Optional(fs),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),communicationStyleDigest:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"})),projectInstructionsDigest:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"})),taskRetryAvailable:f.Optional(f.Boolean()),taskRetriedFrom:f.Optional(f.Object({sessionId:f.String(),projectPath:f.String()})),taskDelivery:f.Optional(dD),taskIsolation:f.Optional(di),taskSourceProjectPath:f.Optional(f.String()),taskWorktreePath:f.Optional(f.String()),taskWorktreeBranch:f.Optional(f.String()),taskBaseCommit:f.Optional(f.String()),taskDiffStat:f.Optional(uD),taskQueuePosition:f.Optional(f.Integer({minimum:1})),taskQueueDepth:f.Optional(f.Integer({minimum:0})),taskConcurrencyLimit:f.Optional(f.Integer({minimum:1})),archivedAt:f.Optional(f.String()),archivedBySessionId:f.Optional(f.String()),pendingInteraction:f.Optional(hD),messageCount:f.Number(),firstMessageTime:f.String(),lastMessageTime:f.String(),hasErrors:f.Boolean()})),kD=J(f.Object({sessions:f.Array(Xn),nextCursor:f.Optional(f.String())})),xD=J(f.Object({session:Xn,archivedSessionIds:f.Array(f.String())})),yD=J(f.Object({session:Xn,restoredSessionIds:f.Array(f.String())}));J(f.Object({version:f.Literal(1),sessionId:f.String(),goalId:f.String(),objective:f.String(),status:be(["active","verifying","paused","blocked","usage_limited","budget_limited","complete"]),tokenBudget:f.Optional(f.Number()),tokensUsed:f.Number(),timeUsedSeconds:f.Number(),continuationCount:f.Number(),statusReason:f.Optional(f.String()),completionVerification:f.Optional(f.Object({attempt:f.Integer({minimum:1}),status:be(["pending","pass","fail","partial"]),requestedAt:f.String(),completedAt:f.Optional(f.String()),verifierSessionId:f.Optional(f.String()),summary:f.Optional(f.String()),evidenceSha256:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"}))})),createdAt:f.String(),updatedAt:f.String()}));const Qd=J(f.Object({role:Jd,content:Hx,metadata:f.Optional(f.Unknown()),reasoningContent:f.Optional(f.String()),thinkingContent:f.Optional(f.String()),tool_call_id:f.Optional(f.String()),name:f.Optional(f.String()),tool_calls:f.Optional(f.Unknown())})),SD=J(f.Object({session:Xn,messages:f.Array(Qd)})),qx=J(be(["conversation","code","both"])),zx=J(f.Object({messageId:f.String(),preview:f.String(),createdAt:f.String(),fileCount:f.Integer({minimum:0})}));J(f.Object({targetMessageId:f.String({minLength:1}),mode:Yn(qx,"conversation")}));const wD=J(f.Object({checkpoint:zx,mode:qx,removedTurns:f.Integer({minimum:1}),restoredFiles:f.Array(f.String()),messages:f.Array(Qd)})),vD=be(["running","completed","failed","cancelled"]),_c=J(f.Object({id:f.String(),subagentType:f.String(),description:f.String(),status:vD,rootAgentId:f.String(),resumedFrom:f.Optional(f.String()),resumeDepth:f.Integer({minimum:0}),createdAt:f.Number(),lastActiveAt:f.Number(),completedAt:f.Optional(f.Number()),result:f.Optional(f.Object({success:f.Boolean(),message:f.String(),error:f.Optional(f.String()),verificationCommands:f.Optional(f.Array(f.String())),verificationVerdict:f.Optional(be(["pass","fail","partial"])),modifiedFiles:f.Optional(f.Array(f.String()))})),stats:f.Optional(f.Object({tokens:f.Optional(f.Number()),toolCalls:f.Optional(f.Number()),duration:f.Optional(f.Number())}))}));J(f.Object({prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"})}));const ID=J(f.Object({source:_c,session:_c})),Kx=J(f.Object({sessionId:f.String(),projectPath:f.String()})),Gx=J(f.Object({path:f.String(),name:f.String(),gitBranch:f.Optional(f.String()),available:f.Boolean(),isCurrent:f.Boolean(),boundAt:f.String()})),CD=J(f.Union([f.Object({cancelled:f.Literal(!0)}),f.Object({cancelled:f.Literal(!1),path:f.String({minLength:1})})])),rf=J(f.Object({type:f.String(),seq:f.Optional(f.Number()),properties:f.Record(f.String(),f.Unknown())})),Vx=f.Object({type:be(["file","image","url"]),path:f.Optional(f.String()),url:f.Optional(f.String()),content:f.Optional(f.String({maxLength:po})),mimeType:f.Optional(f.String()),name:f.Optional(f.String())}),Wx=f.Record(f.String(),f.Unknown());J(f.Object({prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),title:f.Optional(f.String({minLength:1,maxLength:200})),projectPath:f.Optional(f.String()),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:Yn(di,"worktree"),permissionMode:Yn(fs,"default"),attachments:f.Optional(f.Array(Vx,{maxItems:zr})),outputSchema:f.Optional(Wx)}));const sf=J(f.Object({session:Xn,runId:f.String(),messageId:f.String(),status:be(["queued","running"]),queuePosition:f.Optional(f.Integer({minimum:1})),queueDepth:f.Optional(f.Integer({minimum:0})),maxConcurrentTasks:f.Optional(f.Integer({minimum:1}))}));J(f.Object({action:be(["apply","discard"])}));const Yd=J(f.Object({kind:be(["cron","interval","once"]),cron:f.Optional(f.String({minLength:1,maxLength:120})),intervalMs:f.Optional(f.Integer({minimum:6e4})),runAt:f.Optional(f.String({minLength:1,maxLength:40})),timezone:f.Optional(f.String({minLength:1,maxLength:80}))})),jD=J(f.Object({modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:Yn(di,"worktree"),permissionMode:Yn(fs,"default")})),vs=J(f.Object({id:f.String(),title:f.Optional(f.String({minLength:1,maxLength:200})),prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),projectPath:f.String({minLength:1}),trigger:Yd,dispatch:jD,enabled:f.Boolean(),createdAt:f.String(),updatedAt:f.String(),nextRunAt:f.Union([f.String(),f.Null()]),expiresAt:f.Union([f.String(),f.Null()]),lastRunAt:f.Optional(f.String()),lastRunSessionId:f.Optional(f.String()),lastStatus:f.Optional(be(["queued","running","completed","failed","cancelled","interrupted","error"])),lastError:f.Optional(f.String()),runCount:f.Integer({minimum:0})}));J(f.Object({title:f.Optional(f.String({minLength:1,maxLength:200})),prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),projectPath:f.String({minLength:1}),trigger:Yd,modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:Yn(di,"worktree"),permissionMode:Yn(fs,"default"),enabled:Yn(f.Boolean(),!0)}));J(f.Object({title:f.Optional(f.String({minLength:1,maxLength:200})),prompt:f.Optional(f.String({minLength:1,maxLength:32e3,pattern:"\\S"})),trigger:f.Optional(Yd),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:f.Optional(di),permissionMode:f.Optional(fs),enabled:f.Optional(f.Boolean())}));const TD=J(f.Object({schedules:f.Array(vs)}));J(f.Object({content:f.String({maxLength:iD}),projectPath:f.Optional(f.String()),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),permissionMode:f.Optional(fs),attachments:f.Optional(f.Array(Vx,{maxItems:zr})),outputSchema:f.Optional(Wx)}));const AD=be(["completed","failed","aborted","timed_out","spawn_error"]),ED=J(f.Object({version:f.Literal(1),command:f.String(),status:AD,exitCode:f.Union([f.Integer(),f.Null()]),durationMs:f.Number({minimum:0}),stdout:f.String(),stderr:f.String(),stdoutOmittedBytes:f.Integer({minimum:0}),stderrOmittedBytes:f.Integer({minimum:0}),binaryOutput:f.Boolean(),truncated:f.Boolean()}));J(f.Object({command:f.String({minLength:1,maxLength:32*1024,pattern:"^(?![\\s\\S]*\\u0000)(?=[\\s\\S]*\\S)[\\s\\S]*$"}),projectPath:f.Optional(f.String())}));const PD=J(f.Object({executionId:f.String(),messageId:f.String(),record:ED,auxiliary:f.Boolean(),delivery:f.Optional(be(["current_turn","next_turn"])),queued:f.Optional(f.Integer({minimum:0}))}));J(f.Object({projectPath:f.String(),kind:be(["uncommitted","base","commit"]),ref:f.Optional(f.String({maxLength:200})),instructions:f.Optional(f.String({maxLength:4e3})),modelId:f.Optional(f.String({minLength:1,maxLength:200}))}));const ND=J(f.Object({reviewId:f.String(),status:f.Literal("running")}));J(f.Object({messageId:f.String(),role:Jd,content:f.String(),timestamp:f.String()}));J(f.Object({approved:f.Boolean(),remember:f.Optional(f.Boolean()),scope:f.Optional(be(["once","session","project"])),targetMode:f.Optional(fs),feedback:f.Optional(f.String()),answers:f.Optional(f.Record(f.String(),f.Union([f.String(),f.Array(f.String())]))),elicitation:f.Optional(f.Object({action:be(["accept","decline","cancel"]),content:f.Optional(f.Record(f.String(),f.Union([f.String({maxLength:4e3}),f.Number(),f.Boolean(),f.Array(f.String({maxLength:1e3}),{maxItems:100})]),{maxProperties:32}))}))}));const OD=J(f.Object({id:Fr,name:f.String({minLength:1,maxLength:80}),description:f.String({minLength:1,maxLength:256}),source:be(["built-in","user","project","plugin"]),contentSha256:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"}))}));J(f.Object({id:f.String(),displayName:f.Optional(f.String()),provider:f.String(),model:f.String(),contextWindow:f.Optional(f.Number()),maxTokens:f.Optional(f.Number()),reasoning:f.Optional(f.Boolean()),supportedReasoningEfforts:f.Optional(f.Array(be(["off","minimal","low","medium","high","xhigh","max"]))),supportedServiceTiers:f.Optional(f.Array(be(["standard","fast","flex"]))),supportedResponseVerbosities:f.Optional(f.Array(be(["low","medium","high"]))),communicationStyles:f.Optional(f.Array(OD,{maxItems:36})),input:f.Optional(f.Array(be(["text","image"]))),overrides:f.Optional(f.Object({baseUrl:f.Optional(f.String()),temperature:f.Optional(f.Number()),maxOutputTokens:f.Optional(f.Number()),timeout:f.Optional(f.Number()),streamIdleTimeout:f.Optional(f.Number({minimum:1e3}))}))}));J(be(["vs-dark","vs-light","hc-black"]));const $D=J(be(["light","dark","system"])),RD=J(f.Object({language:f.String(),theme:f.String(),uiTheme:$D,autoSaveSessions:f.Boolean(),notifyBuild:f.Boolean(),notifyErrors:f.Boolean(),notifySounds:f.Boolean(),privacyTelemetry:f.Boolean(),privacyCrash:f.Boolean(),communicationStyle:f.Optional(Fr)}));J(f.Partial(RD));async function pr(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>{});if(!n.ok){const s=r,o=s!=null&&s.error&&typeof s.error=="object"&&!Array.isArray(s.error)?s.error:void 0,i=typeof(s==null?void 0:s.error)=="string"?s.error:typeof(o==null?void 0:o.message)=="string"?o.message:typeof(s==null?void 0:s.message)=="string"?s.message:n.statusText||`Request failed (${n.status})`;throw new Error(i)}return r}const se="",of=1e4,MD=f.Array(Xn),FD=f.Array(Gx),DD=f.Array(Qd),_D=f.Array(zx),LD=f.Array(_c),UD=f.Object({cwd:f.String(),gitBranch:f.Optional(f.String()),taskAdmission:f.Optional(f.Object({inFlight:f.Integer({minimum:0}),queued:f.Integer({minimum:0}),maxConcurrent:f.Integer({minimum:1}),maxQueued:f.Integer({minimum:1})}))}),BD=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),HD=()=>{const e=new Date,t=String(e.getFullYear()).slice(-2),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`Session ${t}-${n}-${r} ${s}:${o}`};function qD(e){const t=Kx.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function pt(e,t){const n=qD(t);return`${e}${e.includes("?")?"&":"?"}${n}`}function af(e){return{"x-blade-directory":Kx.parse(e).projectPath}}const nc=(e,t,n)=>({id:`history-${t}-${n}`,role:e.role,content:BD(e.content),timestamp:n,metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,tool_call_id:e.tool_call_id,name:e.name,tool_calls:e.tool_calls,thinkingContent:e.thinkingContent??e.reasoningContent}),re={listProjects:async()=>{const e=await fetch(`${se}/projects`);if(!e.ok)throw new Error("Failed to load projects");return mr(FD,await e.json())},bindProject:async e=>{var n;const t=await fetch(`${se}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to bind project")}return Gx.parse(await t.json())},pickProjectDirectory:async()=>mr(CD,await pr(`${se}/projects/pick`,{method:"POST"})),unbindProject:async e=>{if(!(await fetch(`${se}/projects?path=${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to unbind project")},listSessions:async()=>{const e=await fetch(`${se}/sessions`);if(!e.ok)throw new Error("Failed to load sessions");return mr(MD,await e.json())},listSessionPage:async(e,t=50,n=!1)=>{const r=new URLSearchParams({limit:String(t)});e&&r.set("cursor",e),n&&r.set("archived","true");const s=await fetch(`${se}/sessions/catalog?${r.toString()}`);if(!s.ok)throw new Error("Failed to load session catalog");return kD.parse(await s.json())},getSession:async e=>Xn.parse(await pr(pt(`${se}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{const n=await fetch(`${se}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,title:t||HD()})});if(!n.ok)throw new Error("Failed to create session");return Xn.parse(await n.json())},startCodeReview:async(e,t)=>{var r,s;const n=await fetch(`${se}/sessions/${e.sessionId}/review`,{method:"POST",headers:{"Content-Type":"application/json",...af(e)},body:JSON.stringify({projectPath:e.projectPath,...t})});if(!n.ok){const o=await n.json().catch(()=>{}),i=((r=o==null?void 0:o.error)==null?void 0:r.code)==="CONFLICT"?He("taskHome.review.conflict"):((s=o==null?void 0:o.error)==null?void 0:s.code)==="BAD_REQUEST"?He("taskHome.review.invalidTarget"):He("taskHome.review.startFailed");throw new Error(i)}return ND.parse(await n.json())},getWorkspaceInfo:async()=>mr(UD,await pr(`${se}/global/info`)),createTask:async e=>{var n;const t=await fetch(`${se}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to dispatch task")}return sf.parse(await t.json())},retryTask:async e=>{var n;const t=await fetch(pt(`${se}/tasks/${e.sessionId}/retry`,e),{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to retry task")}return sf.parse(await t.json())},deliverTask:async(e,t)=>{var r;const n=await fetch(pt(`${se}/tasks/${e.sessionId}/delivery`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t})});if(!n.ok){const s=await n.json().catch(()=>{});throw new Error(((r=s==null?void 0:s.error)==null?void 0:r.message)||"Failed to deliver task changes")}return Xn.parse(await n.json())},getTaskDiff:async e=>{var n;const t=await fetch(pt(`${se}/tasks/${e.sessionId}/diff`,e));if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to load task diff")}return mD.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(pt(`${se}/sessions/${e.sessionId}`,e),{method:"DELETE"})).ok)throw new Error("Failed to delete session")},archiveSession:async e=>xD.parse(await pr(pt(`${se}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>yD.parse(await pr(pt(`${se}/sessions/${e.sessionId}/unarchive`,e),{method:"POST"})),exportSessionMarkdown:async(e,t=!1)=>{var d,m;const n=pt(`${se}/sessions/${e.sessionId}/export`,e),r=t?`${n}&includeReasoning=true`:n,s=await fetch(r);if(!s.ok){const p=await s.json().catch(()=>{});throw new Error(((d=p==null?void 0:p.error)==null?void 0:d.message)||"Failed to export session")}const o=s.headers.get("content-disposition")??"",i=((m=/filename="([A-Za-z0-9._-]+)"/.exec(o))==null?void 0:m[1])??`blade-session-${e.sessionId.slice(0,12)}.md`,a=s.headers.get("x-blade-content-sha256")??"";if(!/^[a-f0-9]{64}$/.test(a))throw new Error("Session export is missing its integrity hash");const l=p=>{const g=s.headers.get(p);if(g===null)throw new Error(`Session export is missing its ${p} header`);const x=Number(g);if(!Number.isInteger(x)||x<0)throw new Error(`Session export has an invalid ${p} header`);return x};return{filename:i,markdown:await s.text(),contentSha256:a,messageCount:l("x-blade-export-messages"),activityCount:l("x-blade-export-activities"),redactionCount:l("x-blade-export-redactions")}},updateSession:async(e,t)=>{if(!(await fetch(`${se}/sessions/${e.sessionId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,projectPath:e.projectPath})})).ok)throw new Error("Failed to update session")},getMessages:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw new Error("Failed to load messages");const n=mr(DD,await t.json()),r=Date.now();return n.map((s,o)=>nc(s,o,r))},sendMessage:async(e,t,n)=>{var s;const r=await fetch(`${se}/sessions/${e.sessionId}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,permissionMode:n,projectPath:e.projectPath})});if(!r.ok){const o=await r.json().catch(()=>{}),i=((s=o==null?void 0:o.error)==null?void 0:s.message)??(o==null?void 0:o.reason);throw new Error(i||"Failed to send message")}return r.json()},executeUserShellCommand:async(e,t)=>PD.parse(await pr(`${se}/sessions/${e.sessionId}/shell`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t,projectPath:e.projectPath})})),abortSession:async e=>{var n;const t=await fetch(pt(`${se}/sessions/${e.sessionId}/abort`,e),{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to stop task")}},getGoal:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e));if(!t.ok)throw new Error("Failed to load goal");return(await t.json()).goal},createGoal:async(e,t,n,r)=>{const s=await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({objective:t,tokenBudget:n,permissionMode:r})});if(!s.ok)throw new Error("Failed to create goal");return s.json()},updateGoal:async(e,t)=>{const n=await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to update goal");return n.json()},clearGoal:async e=>{if(!(await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e),{method:"DELETE"})).ok)throw new Error("Failed to clear goal")},listRewindCheckpoints:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw new Error("Failed to load rewind checkpoints");const n=await t.json();return mr(_D,n.checkpoints)},rewindSession:async(e,t,n)=>{const r=await fetch(pt(`${se}/sessions/${e.sessionId}/rewind`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetMessageId:t,mode:n})});if(!r.ok)throw new Error("Failed to rewind session");const s=wD.parse(await r.json()),o=Date.now();return{...s,messages:s.messages.map((i,a)=>nc(i,a,o))}},listSubagents:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw new Error("Failed to load subagents");const n=await t.json();return mr(LD,n.subagents)},resumeSubagent:async(e,t,n)=>{const r=await fetch(pt(`${se}/sessions/${e.sessionId}/subagents/${encodeURIComponent(t)}/resume`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:n})});if(!r.ok){const s=await r.json().catch(()=>{});throw new Error((s==null?void 0:s.message)||"Failed to resume subagent")}return ID.parse(await r.json())},forkSession:async e=>{const t=await fetch(`${se}/sessions/${e.sessionId}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!t.ok)throw new Error("Failed to fork session");const n=SD.parse(await t.json()),r=Date.now();return{session:n.session,messages:n.messages.map((s,o)=>nc(s,o,r))}},openEventSubscription:async(e,t,n)=>{const r=(n==null?void 0:n.maxRetries)??5,s=n==null?void 0:n.onConnectionChange,o=n==null?void 0:n.onConnectionStateChange;let i=null,a=0,l=null,d=Date.now(),m=null,p=null,g=!1,x=!1,b=0,y,j,k=!1;const A=new Promise((P,B)=>{y=P,j=B}),N=()=>{m&&(clearInterval(m),m=null)},$=()=>{p&&(clearTimeout(p),p=null)},Q=()=>{i==null||i.close(),i=null},T=()=>{l&&(clearTimeout(l),l=null),N(),$(),Q()},C=()=>{k||(k=!0,$(),y())},O=P=>{k||(k=!0,T(),j(P))},R=()=>{if(g||a>=r){a>=r&&(console.error(`SSE max retries (${r}) reached, giving up`),o==null||o("offline"));return}a++,o==null||o("reconnecting");const P=Math.min(1e3*Math.pow(2,a-1),3e4);console.log(`SSE reconnecting in ${P}ms (attempt ${a}/${r})`),l=setTimeout(()=>{X().catch(B=>{console.error("SSE reconnect failed",B),s==null||s(!1),R()})},P)},K=()=>{a=0,d=Date.now(),s==null||s(!0),o==null||o("connected"),N(),m=setInterval(()=>{Date.now()-d>45e3&&(console.warn("SSE heartbeat timeout, reconnecting..."),N(),Q(),s==null||s(!1),o==null||o("reconnecting"),R())},15e3),x||(x=!0,C())},X=async()=>{if(g)return;Q();const P=pt(`${se}/sessions/${e.sessionId}/events`,e),B=b>0?`${P}${P.includes("?")?"&":"?"}lastEventId=${b}`:P;i=new EventSource(B),x||($(),p=setTimeout(()=>{o==null||o("offline"),O(new Error("Timed out waiting for event subscription readiness"))},of)),i.onmessage=M=>{try{const fe=JSON.parse(M.data);typeof fe.seq=="number"&&fe.seq>b&&(b=fe.seq);const ve=rf.parse(fe);if(d=Date.now(),ve.type==="connected"){ve.properties.sessionId===e.sessionId&&ve.properties.projectPath===e.projectPath&&(typeof ve.properties.status=="string"&&t({type:"session.status",properties:ve.properties}),K());return}if(ve.type==="heartbeat")return;t(ve)}catch(fe){console.error("Failed to parse SSE event:",M.data,fe)}},i.onerror=()=>{if(!g){if(N(),Q(),!x){o==null||o("offline"),O(new Error("Failed to open event subscription"));return}console.error("SSE connection error"),s==null||s(!1),R()}}};return o==null||o("connecting"),X().catch(P=>{o==null||o("offline"),O(P instanceof Error?P:new Error("Failed to open event subscription"))}),await A,()=>{g=!0,l&&(clearTimeout(l),l=null),T(),s==null||s(!1)}},openTaskEventSubscription:async(e,t)=>{const n=t==null?void 0:t.onConnectionChange,r=t==null?void 0:t.onConnectionStateChange,s=new EventSource(`${se}/events`);let o=!1,i=!1,a,l,d;const m=new Promise((g,x)=>{l=g,d=x}),p=()=>{o||(o=!0,a!==void 0&&(clearTimeout(a),a=void 0),s.close(),n==null||n(!1),r==null||r("offline"))};return r==null||r("connecting"),a=setTimeout(()=>{i||o||(p(),d(new Error("Timed out waiting for global task events")))},of),s.onmessage=g=>{try{const x=rf.parse(JSON.parse(g.data));if(x.type==="connected"){i||(i=!0,a!==void 0&&(clearTimeout(a),a=void 0),l()),n==null||n(!0),r==null||r("connected");return}if(x.type==="heartbeat")return;e(x)}catch(x){console.error("Failed to parse global task event:",g.data,x)}},s.onerror=()=>{n==null||n(!1),r==null||r(i?"reconnecting":"offline"),!i&&!o&&(p(),d(new Error("Failed to open global task events")))},await m,p},respondPermission:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${se}/permissions/${t}?${r.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to permission")}},respondToConfirmation:async(e,t,n)=>{if(!(await fetch(pt(`${se}/sessions/${e.sessionId}/confirmation/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:n})})).ok)throw new Error("Failed to respond to confirmation")},respondToQuestion:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${se}/permissions/${t}?${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:!0,answers:n})});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to question")}},respondToElicitation:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${se}/permissions/${t}?${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:n.action==="accept",elicitation:n})});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to MCP elicitation")}},getGitInfo:async e=>{const t=await fetch(`${se}/suggestions/git-info`,{headers:af(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()},listSchedules:async()=>{var n;const e=await fetch(`${se}/schedules`);if(!e.ok){const r=await e.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.loadFailed"))}return TD.parse(await e.json()).schedules},createSchedule:async e=>{var n;const t=await fetch(`${se}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.createFailed"))}return vs.parse(await t.json())},updateSchedule:async(e,t)=>{var r;const n=await fetch(`${se}/schedules/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>{});throw new Error(((r=s==null?void 0:s.error)==null?void 0:r.message)||He("schedule.error.updateFailed"))}return vs.parse(await n.json())},deleteSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.deleteFailed"))}},enableSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}/enable`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.toggleFailed"))}return vs.parse(await t.json())},disableSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}/disable`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.toggleFailed"))}return vs.parse(await t.json())},runSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}/run`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.runFailed"))}return vs.parse(await t.json())}},cf=e=>{let t;const n=new Set,r=(d,m)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const g=t;t=m??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,g))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(r,s,a);return a},zD=e=>e?cf(e):cf,KD=e=>e;function GD(e,t=KD){const n=oo.useSyncExternalStore(e.subscribe,oo.useCallback(()=>t(e.getState()),[e,t]),oo.useCallback(()=>t(e.getInitialState()),[e,t]));return oo.useDebugValue(n),n}const lf=e=>{const t=zD(e),n=r=>GD(t,r);return Object.assign(n,t),n},ui=e=>e?lf(e):lf;function Lt(){return{timeline:[],textBefore:"",toolCalls:[],textAfter:"",thinkingContent:"",tasks:[],subagent:null,subagents:[],confirmation:null,question:null,elicitation:null}}function Zn(e){return e?e.subagents&&e.subagents.length>0?e.subagents:e.subagent?[e.subagent]:[]:[]}function wo(e,t,n){const r=(n?t.find(s=>s.id===n||s.sessionId===n):void 0)??t[t.length-1]??null;return{...e,subagents:t,subagent:r}}function Lc(e,t){const n=[...Zn(e)];let r=n.findIndex(i=>i.id===t.id||!!(i.sessionId&&t.sessionId&&i.sessionId===t.sessionId));if(r===-1&&t.sessionId&&(r=n.findIndex(i=>!i.sessionId&&i.status==="running"&&i.type===t.type&&i.description===t.description)),r===-1)return n.push(t),wo(e,n,t.id);const s=n[r],o={...s,...t,id:s.id};return n[r]=o,wo(e,n,o.id)}function Xd(e,t){return`${t}-${e.length}`}function Uc(e,t){if(!t)return e;const n=[...Fa(e)],r=n[n.length-1];return(r==null?void 0:r.type)==="text"?n[n.length-1]={...r,content:r.content+t}:n.push({id:Xd(n,"text"),type:"text",content:t}),{...e,timeline:n}}function Jx(e,t){if(!t)return e;const n=[...Fa(e)],r=n[n.length-1];return(r==null?void 0:r.type)==="thinking"?n[n.length-1]={...r,content:r.content+t}:n.push({id:Xd(n,"thinking"),type:"thinking",content:t}),{...e,timeline:n}}function Bc(e,t){const n=e.toolCalls.some(i=>i.toolCallId===t.toolCallId),r=n?e.toolCalls:[...e.toolCalls,t];if(n)return{...e,toolCalls:r};const s=[...Fa(e)],o=s[s.length-1];return(o==null?void 0:o.type)==="tool_group"?s[s.length-1]={...o,toolCallIds:[...o.toolCallIds,t.toolCallId]}:s.push({id:Xd(s,"tool_group"),type:"tool_group",toolCallIds:[t.toolCallId]}),{...e,timeline:s,toolCalls:r}}function Fa(e){if(e.timeline&&e.timeline.length>0)return e.timeline;const t=[];return e.thinkingContent&&t.push({id:"legacy-thinking",type:"thinking",content:e.thinkingContent}),e.textBefore&&t.push({id:"legacy-text-before",type:"text",content:e.textBefore}),e.toolCalls.length>0&&t.push({id:"legacy-tool-group",type:"tool_group",toolCallIds:e.toolCalls.map(n=>n.toolCallId)}),e.textAfter&&t.push({id:"legacy-text-after",type:"text",content:e.textAfter}),t}function VD(e){return Fa(e).filter(t=>t.type==="text").map(t=>t.content).filter(Boolean).join(`
|
|
8
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),rg=(e,t=[])=>u(u(ng(e),([n,r])=>u(ql(r),([s,o])=>[[n,s],o])),([n,r])=>rg(r,[...t,n]),()=>[t,e]),ZT=e=>u(u(u(ql(e),([t,n])=>u(rg(n),([r,s])=>u(u(ng(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[GC(t),n]),ql=e=>u(u(XT(e),([t,n])=>u(u(WT(n),([r,s])=>[r,s],()=>u(JT(n),([r,s])=>[r,s],()=>u(QT(n),([r,s])=>[r,s],()=>u(YT(n),([r,s])=>[r,s],()=>[])))),([r,s])=>u(Tp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[VC(t),n]),eA=e=>u(u(ql(e),([t,n])=>u(ZT(n),([r,s])=>[[t,r],s])),([t,n])=>[WC(t),n]),tA=e=>u(u(eA(e),([t,n])=>[t,n],()=>u(aT(e),([t,n])=>[t,n],()=>u(ge(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function nA(e){const t=$p(`\`${e}\``);return h(t.length,2)?t[0]:Ot()}function rA(e){return e.join("|")}function sA(e){return e.slice(1,e.length-1)}function oA(e,t,n){return Ar(t,`${n}${e}`)}function iA(e,t){return Ar(e,`${t}${nv}`)}function aA(e,t){return Ar(e,`${t}${Rm}`)}function cA(e,t){return Ar(e,`${t}${_m}`)}function lA(e,t){return Lo(Ve([Me("false"),Me("true")]),e,t)}function dA(e,t){return Ar(e,`${t}${Lm}`)}function uA(e,t,n){return Ar(t,`${n}${sA(e)}`)}function fA(e,t,n){const r=zl(e,{});return Lo(r,t,n)}function mA(e,t,n){const r=Tr(e);return Lo(r,t,n)}function sg(e,t,n,r=[]){return Ie(e,(s,o)=>sg(o,t,n,[...r,Lo(s,[],"")]),()=>Ar(t,`${n}(${rA(r)})`))}function Lo(e,t,n){return hn(e)?mA(e.enum,t,n):_n(e)?aA(t,n):We(e)?oA(e.const,t,n):ts(e)?iA(t,n):jr(e)?lA(t,n):nn(e)?cA(t,n):On(e)?dA(t,n):zt(e)?uA(e.pattern,t,n):bA(e)?fA(e.parameters[0],t,n):ae(e)?sg(e.anyOf,t,n):hw}function Ar(e,t){return Ie(e,(n,r)=>Lo(n,r,t),()=>t)}function pA(e){return`^${Ar(e,"")}$`}function gA(e){const t=pA(e);return zm(t)}function zl(e,t){return Ye(e)?ue(gA(e),{},t):og(e,t)}function hA(e,t,n,r){const s=Wn(e,t,n);return zl(s,r)}function og(e,t={}){return je("TemplateLiteral",[e],t)}function bA(e){return Yt(e)&&E(e,"action")&&h(e.action,"TemplateLiteral")}function ig(e){return zl(e,{})}function kA(e){const t=nA(e);return ig(t)}function xA(e,t={}){const n=ie(e)?kA(e):ig(e);return ue(n,{},t)}function zt(e){return we(e,"TemplateLiteral")}function ag(e){return he({"~kind":"ExtendsUnion"},{inferred:e})}function Kl(e){return ne(e)&&E(e,"~kind")&&E(e,"inferred")&&h(e["~kind"],"ExtendsUnion")&&ne(e.inferred)}function ee(e){return he({"~kind":"ExtendsTrue"},{inferred:e})}function Gl(e){return ne(e)&&E(e,"~kind")&&E(e,"inferred")&&h(e["~kind"],"ExtendsTrue")&&ne(e.inferred)}function xe(){return he({"~kind":"ExtendsFalse"},{})}function Cc(e){return ne(e)&&E(e,"~kind")&&h(e["~kind"],"ExtendsFalse")}function Kt(e){return Kl(e)||Gl(e)}function St(e,t,n){return Kt(e)?t(e.inferred):n()}const yA=Object.freeze(Object.defineProperty({__proto__:null,ExtendsFalse:xe,ExtendsTrue:ee,ExtendsUnion:ag,IsExtendsFalse:Cc,IsExtendsTrue:Gl,IsExtendsTrueLike:Kt,IsExtendsUnion:Kl,Match:St},Symbol.toStringTag,{value:"Module"}));function SA(e,t,n,r){return St(Qe(e,n,r),s=>ee(gt(gt(e,s),{[t]:n})),()=>xe())}function wA(e,t){return ee(e)}function vA(e,t,n,r,s){return St(Qe(e,t,n),o=>St(Qe(o,t,r),i=>ee(i),()=>xe()),()=>St(Qe(e,t,s),o=>ee(o),()=>xe()))}function IA(e,t,n){const r=Tr(n);return Qe(e,t,r)}function cg(e,t,n){return Ie(n,(r,s)=>St(Qe(e,t,r),o=>cg(o,t,s),()=>xe()),()=>ee(e))}function CA(e,t,n){const r=sr(n);return Qe(e,t,r)}function lg(e,t,n){return Ie(n,(r,s)=>St(Qe(e,t,r),o=>ee(o),()=>lg(e,t,s)),()=>xe())}function yt(e,t,n){return Nn(n)?wA(e):gn(n)?vA(e,t,n.if,n.then,n.else):hn(n)?IA(e,t,n.enum):Zt(n)?SA(e,n.name,t,n.extends):Ue(n)?cg(e,t,n.allOf):zt(n)?CA(e,t,n.pattern):ae(n)?lg(e,t,n.anyOf):Cn(n)?ee(e):xe()}function jA(e,t,n){return Zt(n)?yt(e,t,n):Nn(n)||Cn(n)?ee(e):ag(e)}function TA(e,t){const n=Di(e),r=Di(t);return n&&r||!n&&r?!0:!(n&&!r)}function AA(e,t,n,r){return ut(r)?TA(t,r)?Qe(e,n,r.items):xe():yt(e,t,r)}function EA(e,t,n){return ts(n)?ee(e):yt(e,t,n)}function PA(e,t,n){return jr(n)?ee(e):yt(e,t,n)}function NA(e,t,n,r,s){const o=Zt(r)?t:r,i=Zt(r)?r:t,a=Xt(t),l=Xt(r);return!a&&l?xe():St(Qe(e,o,i),d=>Vl(d,n,s),()=>xe())}function OA(e,t,n,r){return Ie(r,(s,o)=>NA(e,t,n,s,o),()=>Xt(t)?ee(e):xe())}function $A(e,t,n){return Ie(t,(r,s)=>OA(e,r,s,n),()=>ee(e))}function Vl(e,t,n){return $A(e,t,n)}function dg(e,t,n){return ns(n)?ee(e):Qe(e,t,n)}function RA(e,t,n,r){return Nn(r)||Cn(r)?ee(e):mn(r)?St(Vl(e,t,r.parameters),s=>dg(s,n,r.instanceType),()=>xe()):xe()}function MA(e,t,n,r,s){return St(Qe(e,t,s),()=>Qe(e,n,s),()=>Qe(e,r,s))}function FA(e,t,n){const r=Tr(t);return Qe(e,r,n)}function DA(e,t,n,r){return Nn(r)||Cn(r)?ee(e):pn(r)?St(Vl(e,t,r.parameters),s=>dg(s,n,r.returnType),()=>xe()):xe()}function _A(e,t,n){return _n(n)||nn(n)?ee(e):yt(e,t,n)}function LA(e,t,n){const r=rn(t);return Qe(e,r,n)}function pa(e,t,n){return t===n?ee(e):xe()}function UA(e,t,n){return We(n)?pa(e,t,n.const):ts(n)?ee(e):yt(e,Me(t),n)}function BA(e,t,n){return We(n)?pa(e,t,n.const):jr(n)?ee(e):yt(e,Me(t),n)}function HA(e,t,n){return We(n)?pa(e,t,n.const):nn(n)?ee(e):yt(e,Me(t),n)}function qA(e,t,n){return We(n)?pa(e,t,n.const):On(n)?ee(e):yt(e,Me(t),n)}function zA(e,t,n){return tt(t.const)?UA(e,t.const,n):ht(t.const)?BA(e,t.const,n):ye(t.const)?HA(e,t.const,n):ie(t.const)?qA(e,t.const,n):Ot()}function KA(e,t,n){return Zt(n)?yt(e,t,n):ee(e)}function GA(e,t,n){return $o(n)?ee(e):yt(e,t,n)}function VA(e,t,n){return nn(n)?ee(e):yt(e,t,n)}function WA(e,t,n){return Xt(t)?Xt(n)?ee(e):xe():ee(e)}function JA(e,t,n){return Zt(n)&&Rs(n.extends)?xe():St(Qe(e,t,n),r=>WA(r,t,n),()=>xe())}function QA(e,t){return e.reduce((n,r)=>r in t&&Kt(t[r])?{...n,...t[r].inferred}:Ot(),{})}function YA(e,t,n){const r={};for(const i of D(n))r[i]=i in t?JA({},t[i],n[i]):Xt(n[i])?Zt(n[i])?ee(gt(e,{[n[i].name]:n[i].extends})):ee(e):xe();const s=pl(r).every(i=>Kt(i)),o=s?QA(D(r),r):{};return s?ee(o):xe()}function XA(e,t,n){const r=YA(e,t,n);return Kt(r)?ee(gt(e,r.inferred)):xe()}function ZA(e,t,n){return XA(e,t,n)}function eE(e,t){return D(t).reduce((n,r)=>({...n,[r]:E(e,r)?ae(n[r])?Ve([...n[r].anyOf,t[r]]):Ve([e[r],t[r]]):t[r]}),e)}function ug(e,t,n,r){return Ie(t,(s,o)=>St(Qe({},e[s],n),i=>ug(e,o,n,eE(r,i)),()=>xe()),()=>ee(r))}function tE(e,t,n,r){const s=D(t);return ug(t,s,r,e)}function nE(e,t,n){return At(n)?tE(e,t,kn(n),qt(n)):Le(n)?ZA(e,t,n.properties):yt(e,Ae(t),n)}function rE(e,t){return h(D(t).length,0)?ee(e):xe()}function sE(e,t,n,r,s){return Qe(e,n,s)}function oE(e,t,n,r){return At(r)?sE(e,Sc(t),n,Sc(kn(r)),qt(r)):Le(r)?rE(e,r.properties):Nn(r)||Cn(r)?ee(e):xe()}function iE(e,t,n){return On(n)?ee(e):yt(e,t,n)}function aE(e,t,n){return Ro(n)?ee(e):yt(e,t,n)}function cE(e,t,n){const r=sr(t);return Qe(e,r,n)}function jc(e,t){return he({"~kind":"Inferrable"},{name:e,type:t},{})}function Wl(e){return ne(e)&&E(e,"~kind")&&E(e,"name")&&E(e,"type")&&h(e["~kind"],"Inferrable")&&ie(e.name)&&ne(e.type)}function fg(e){return ua(e)?Zt(e.items)?ut(e.items.extends)?jc(e.items.name,e.items.extends.items):Cn(e.items.extends)?jc(e.items.name,e.items.extends):void 0:Ot():void 0}function mg(e){return Zt(e)?jc(e.name,e.extends):void 0}function Jl(e,t,n=[]){return Ie(e,(r,s)=>St(Qe({},r,t),()=>Jl(s,t,[...n,r]),()=>{}),()=>n)}function lE(e,t,n,r){const s=Jl(n,r);return H(s)?ee(gt(e,{[t]:bn(s)})):xe()}function pg(e,t,n,r){const s=Jl(n,r);return H(s)?ee(gt(e,{[t]:Ve(s)})):xe()}function dE(e){return[...e].reverse()}function Tc(e,t){return t?dE(e):e}function uE(e){const t=e.length>0?e[0]:void 0,n=Yt(t)?fg(t):void 0;return Yt(n)}function fE(e,t,n,r,s,o){return St(Qe(e,n,s),i=>gg(i,t,r,o),()=>xe())}function mE(e,t,n,r,s){const o=fg(r);return Wl(o)?lE(e,o.name,Tc(n,t),o.type):Ie(n,(i,a)=>fE(e,t,i,a,r,s),()=>xe())}function pE(e,t,n,r){return Ie(r,(s,o)=>mE(e,t,n,s,o),()=>h(n.length,0)?ee(e):xe())}function gg(e,t,n,r){return pE(e,t,n,r)}function gE(e,t,n){const r=zo(e,Mt([],[]),n),s=uE(r);return gg(e,s,Tc(t,s),Tc(r,s))}function hg(e,t,n){const r=mg(n);return Wl(r)?pg(e,r.name,t,r.type):Ie(t,(s,o)=>St(Qe(e,s,n),i=>hg(i,o,n),()=>xe()),()=>ee(e))}function hE(e,t,n){const r=zo(e,Mt([],[]),t);return st(n)?gE(e,r,n.items):ut(n)?hg(e,r,n.items):yt(e,bn(r),n)}function bE(e,t,n){return ns(n)||Ds(n)?ee(e):yt(e,t,n)}function bg(e,t,n){return Ie(n,(r,s)=>St(Qe(e,t,r),o=>ee(o),()=>bg(e,t,s)),()=>xe())}function Ac(e,t,n){return Ie(t,(r,s)=>St(bg(e,r,n),o=>Ac(o,s,n),()=>xe()),()=>ee(e))}function kE(e,t,n){const r=mg(n);return Wl(r)?pg(e,r.name,t,r.type):ae(n)?Ac(e,t,n.anyOf):Ac(e,t,[n])}function xE(e,t,n){return Zt(n)?yt(e,t,n):Nn(n)||Cn(n)?ee(e):xe()}function yE(e,t,n){return ns(n)?ee(e):yt(e,t,n)}function Qe(e,t,n){return Nn(t)?jA(e,t,n):ut(t)?AA(e,t,t.items,n):ts(t)?EA(e,t,n):jr(t)?PA(e,t,n):mn(t)?RA(e,t.parameters,t.instanceType,n):gn(t)?MA(e,t.if,t.then,t.else,n):hn(t)?FA(e,t.enum,n):pn(t)?DA(e,t.parameters,t.returnType,n):_n(t)?_A(e,t,n):Ue(t)?LA(e,t.allOf,n):We(t)?zA(e,t,n):Rs(t)?KA(e,t,n):$o(t)?GA(e,t,n):nn(t)?VA(e,t,n):Le(t)?nE(e,t.properties,n):At(t)?oE(e,kn(t),qt(t),n):On(t)?iE(e,t,n):Ro(t)?aE(e,t,n):zt(t)?cE(e,t.pattern,n):st(t)?hE(e,t.items,n):Ds(t)?bE(e,t,n):ae(t)?kE(e,t.anyOf,n):Cn(t)?xE(e,t,n):ns(t)?yE(e,t,n):xe()}function SE(e,t){return rn([...e,Ae(t)])}function kg(e,t,n){return Ye(e)?ue(SE(e,t),{},n):Ql(e,t,n)}function wE(e,t,n,r,s){const o=Wn(e,t,n),i=dd(e,t,r);return kg(o,i,s)}function Ql(e,t,n={}){return je("Interface",[e,t],n)}function Yl(e){return Yt(e)&&E(e,"action")&&h(e.action,"Interface")}function vE(e,t,n={}){return kg(e,t,n)}function IE(e,t,n){return e.includes(n)?!0:bo([...e,n],t,t[n])}function zu(e,t,n){const r=vm(n);return Ur(e,t,r)}function Ur(e,t,n){return Ie(n,(r,s)=>bo(e,t,r)?!0:Ur(e,t,s),()=>!1)}function bo(e,t,n){return kt(n)?IE(e,t,n.$ref):ut(n)?bo(e,t,n.items):mn(n)?Ur(e,t,[...n.parameters,n.instanceType]):pn(n)?Ur(e,t,[...n.parameters,n.returnType]):Yl(n)?zu(e,t,n.parameters[1]):Ue(n)?Ur(e,t,n.allOf):Le(n)?zu(e,t,n.properties):ae(n)?Ur(e,t,n.anyOf):st(n)?Ur(e,t,n.items):At(n)?bo(e,t,qt(n)):!1}function CE(e,t,n){return bo(e,t,n)}function jE(e,t){return t.reduce((n,r)=>CE([r],e,e[r])?[...n,r]:n,[])}function TE(e){const t=wm(e);return jE(e,t)}function AE(e,t,n){return n.includes(t)?n:t in e?ko(e,e[t],[...n,t]):Ot()}function Ku(e,t,n){const r=vm(t);return ws(e,r,n)}function ws(e,t,n){return t.reduce((r,s)=>ko(e,s,r),n)}function ko(e,t,n){return kt(t)?AE(e,t.$ref,n):ut(t)?ko(e,t.items,n):mn(t)?ws(e,[...t.parameters,t.instanceType],n):pn(t)?ws(e,[...t.parameters,t.returnType],n):Yl(t)?Ku(e,t.parameters[1],n):Ue(t)?ws(e,t.allOf,n):Le(t)?Ku(e,t.properties,n):ae(t)?ws(e,t.anyOf,n):st(t)?ws(e,t.items,n):At(t)?ko(e,qt(t),n):n}function EE(e,t,n){return ko(e,n,[t])}function PE(e){return vl()}function NE(e){return D(e).reduce((t,n)=>({...t,[n]:Hr(e[n])}),{})}function no(e){return e.reduce((t,n)=>[...t,Hr(n)],[])}function Hr(e){return kt(e)?PE(e.$ref):ut(e)?Cr(Hr(e.items),Sl(e)):mn(e)?Eo(no(e.parameters),Hr(e.instanceType)):pn(e)?Po(no(e.parameters),Hr(e.returnType)):Ue(e)?Fn(no(e.allOf)):Le(e)?Ae(NE(e.properties)):At(e)?Pl(la(e),Hr(qt(e))):ae(e)?Ve(no(e.anyOf)):st(e)?bn(no(e.items)):e}function OE(e,t){return t in e?Hr(e[t]):Bt()}function $E(e){return OE(e.$defs,e.$ref)}function RE(e,t,n){const r=Wn(e,Mt([],[]),t),s=dd({},Mt([],[]),n);return rn([...r,Ae(s)])}function ME(e,t){return D(e).filter(r=>t.includes(r)).reduce((r,s)=>{const o=e[s],i=Yl(o)?RE(e,o.parameters[0],o.parameters[1]):o;return{...r,[s]:i}},{})}function FE(e,t,n){const r=EE(e,t,n),s=ME(e,r);return Oo(s,t)}function xg(e,t){return t in e?kt(e[t])?xg(e,e[t].$ref):e[t]:Tt()}function Uo(e,t){return xg(e,t)}function Gu(e){return Ht(e)?$E(e):Im(e)?Bt():e}function nr(e,t,n){const r=Gu(t),s=Gu(n);return Qe(e,r,s)}const Xl="equal",DE="disjoint",Zl="left-inside",ed="right-inside";function ga(e,t){const n=[Cn(e)?xe():nr({},e,t),Cn(e)?ee({}):nr({},t,e)];return Kt(n[0])&&Kt(n[1])?Xl:Kt(n[0])&&Cc(n[1])?Zl:Cc(n[0])&&Kt(n[1])?ed:DE}function _E(e,t){return t.filter(n=>ga(e,n)!==ed)}function LE(e,t){const n=t.some(r=>{const s=ga(e,r);return h(s,Zl)||h(s,Xl)});return h(n,!1)}function UE(e,t){const n=Vr(e);return Nn(n)?[n]:LE(n,t)?[..._E(n,t),n]:t}function BE(e){return e.reduce((t,n)=>Le(n)?[...t,n]:Rs(n)?t:UE(n,t),[])}function yg(e){const t=BE(e);return ia(t)}function Sg(e,t){return ue(Vr(e),{},t)}function HE(e,t,n,r){const s=G(e,t,n);return Sg(s,r)}function io(e,t=[]){return Ts(e)&&h(e.action,"Conditional")?kt(e.parameters[0])?io(e.parameters[2],io(e.parameters[3],[...t,e.parameters[0].$ref])):io(e.parameters[2],io(e.parameters[3],t)):Ts(e)&&h(e.action,"Mapped")&&Ts(e.parameters[1])&&h(e.parameters[1].action,"KeyOf")&&kt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function qE(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function wg(e,t,n=[]){return Ie(e,(r,s)=>Ie(t,(o,i)=>wg(s,i,[...n,[o,r]]),()=>n),()=>n)}function zE(e){return zt(e)?sr(e.pattern):hn(e)?Tr(e.enum):e}function KE(e){const t=zE(e);return ae(t)?[...t.anyOf]:[t]}function GE(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Vu(e,t){return t.reduce((n,r)=>[...n,...GE(e,r)],[])}function Wu(e){return e.reduce((t,n)=>h(n[0],!0)?Vu(t,KE(n[1])):Vu(t,[n[1]]),[[]])}function VE(e,t,n){const r=io(n),s=qE(e,r),o=wg(t,s);return Ts(n)&&h(n.action,"Conditional")||Ts(n)&&h(n.action,"Mapped")?Wu(o):[t]}function WE(){return["(not-resolvable)",Tt()]}function JE(){return["(not-generic)",Tt()]}function QE(e,t,n){return[e,No(t,n)]}function YE(e,t,n){return t in e?vg(e,t,e[t]):WE()}function vg(e,t,n,r){return wl(n)?QE(t,n.parameters,n.expression):kt(n)?YE(e,n.$ref):JE()}function XE(e,t,n){return vg(e,"(anonymous)",t)}function ZE(e,t,n){if(Zt(t)||nd(t)||Kt(nr({},t,n)))return;const r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Ju(e,t,n,r,s){const o=G(e,t,s);return ZE(n,o,r),gt(e,{[n]:o})}function eP(e,t,n,r,s){const o=G(e,t,n.extends),i=G(e,t,n.equals);return Ie(s,(a,l)=>Ec(Ju(e,t,n.name,o,a),t,r,l),()=>Ec(Ju(e,t,n.name,o,i),t,r,[]))}function Ec(e,t,n,r){return Ie(n,(s,o)=>eP(e,t,s,o,r),()=>e)}function tP(e,t,n,r){return Ec(e,t,n,r)}let Pc=0,td=0;function nP(){if(!Co(td,Ao().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function rP(){nP(),td++,Pc++}function sP(){Pc--,h(Pc,0)&&(td=0)}function oP(e){return Yr(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function iP(e,t){return h(oP(e),t)}function aP(e,t,n,r,s,o){rP();try{const i=tP(e,t,r,o),a=G(i,Mt([...t.callstack,n.$ref],t.visited),s);return G(i,Mt([],[]),a)}finally{sP()}}function cP(e,t,n,r,s,o){return o.reduce((i,a)=>{const l=aP(e,t,n,r,s,a);return[...i,l]},[])}function lP(e,t,n,r,s,o){const i=VE(r,o,s),a=cP(e,t,n,r,s,i);return h(a.length,1)?a[0]:or(a)}function Ig(e,t,n,r){const s=Wn(e,t,r),o=XE(e,n),i=o[0],a=o[1];return wl(a)?iP(t,i)?Nc(dn(i),s):lP(e,t,dn(i),a.parameters,a.expression,s):Nc(n,s)}function Nc(e,t){return he({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function dP(e,t){return Ig({},Mt([],[]),e,t)}function nd(e){return we(e,"Call")}function uP(e){return Pn(e,["~immutable"])}function fP(e,t){return ue(uP(e),{},t)}function mP(e,t,n,r){const s=G(e,t,n);return fP(s,r)}function pP(e,t){return e(t)}function gP(e,t){return ie(t)?Me(pP(e,t)):Me(t)}function hP(e,t){const n=sr(t);return _s(e,n)}function bP(e,t){const n=t.map(r=>_s(e,r));return Ve(n)}function _s(e,t){return We(t)?gP(e,t.const):zt(t)?hP(e,t.pattern):ae(t)?bP(e,t.anyOf):t}function Cg(e,t={}){return je("Capitalize",[e],t)}function kP(e,t={}){return Eg(e,t)}function jg(e,t={}){return je("Lowercase",[e],t)}function xP(e,t={}){return Pg(e,t)}function Tg(e,t={}){return je("Uncapitalize",[e],t)}function yP(e,t={}){return Ng(e,t)}function Ag(e,t={}){return je("Uppercase",[e],t)}function SP(e,t={}){return Og(e,t)}const wP=e=>e[0].toUpperCase()+e.slice(1),vP=e=>e.toLowerCase(),IP=e=>e[0].toLowerCase()+e.slice(1),CP=e=>e.toUpperCase();function Eg(e,t){return Ye([e])?ue(_s(wP,e),{},t):Cg(e,t)}function Pg(e,t){return Ye([e])?ue(_s(vP,e),{},t):jg(e,t)}function Ng(e,t){return Ye([e])?ue(_s(IP,e),{},t):Tg(e,t)}function Og(e,t){return Ye([e])?ue(_s(CP,e),{},t):Ag(e,t)}function jP(e,t,n,r){const s=G(e,t,n);return Eg(s,r)}function TP(e,t,n,r){const s=G(e,t,n);return Pg(s,r)}function AP(e,t,n,r){const s=G(e,t,n);return Ng(s,r)}function EP(e,t,n,r){const s=G(e,t,n);return Og(s,r)}function $g(e,t,n,r,s={}){return je("Conditional",[e,t,n,r],s)}function PP(e,t,n,r,s={}){return Rg({},Mt([],[]),e,t,n,r,s)}function NP(e,t,n,r,s,o){const i=nr(e,n,r);return Kl(i)?Ve([G(i.inferred,t,s),G(e,t,o)]):Gl(i)?G(i.inferred,t,s):G(e,t,o)}function Rg(e,t,n,r,s,o,i){return Ye([n,r])?ue(NP(e,t,n,r,s,o),{},i):$g(n,r,s,o,i)}function OP(e,t,n,r,s,o,i){const a=G(e,t,n),l=G(e,t,r);return Rg(e,t,a,l,s,o,i)}function Mg(e,t={}){return je("ConstructorParameters",[e],t)}function $P(e,t={}){return Fg(e,t)}function RP(e){const t=mn(e)?e.parameters:[],n=zo({},Mt([],[]),t);return bn(n)}function Fg(e,t){return Ye([e])?ue(RP(e),{},t):Mg(e,t)}function MP(e,t,n,r){const s=G(e,t,n);return Fg(s,r)}function Dg(e,t,n={}){return je("Exclude",[e,t],n)}function FP(e,t,n={}){return rd(e,t,n)}function rd(e,t,n){return Ye([e,t])?ue(np(e,t),{},n):Dg(e,t,n)}function DP(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return rd(o,i,s)}function _g(e,t,n={}){return je("Extract",[e,t],n)}function _P(e,t,n={}){return Lg(e,t,n)}function LP(e,t){const n=nr({},e,t);return Kt(n)?[e]:[]}function UP(e,t){return e.reduce((n,r)=>[...n,...LP(r,t)],[])}function BP(e,t){const n=Vr(e),r=ae(n)?n.anyOf:[n],s=UP(r,t);return or(s)}function Lg(e,t,n){return Ye([e,t])?ue(BP(e,t),{},n):_g(e,t,n)}function HP(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Lg(o,i,s)}function qP(e){return e.reduce((t,n)=>Mm(n)?[...t,Me(n)]:t,[])}function sd(e){const t=qP(e);return Ve(t)}function od(e,t,n={}){return je("Index",[e,t],n)}function zP(e,t,n={}){const r=H(t)?sd(t):t;return zg(e,r,n)}function KP(e,t){const n=Uo(e,t);return ss(n)}function GP(e,t,n){const r=Ms(e,t,n);return ss(r)}function VP(e,t){const n=D(e).filter(m=>!E(t,m)),r=D(t).filter(m=>!E(e,m)),s=D(e).filter(m=>E(t,m)),o=n.reduce((m,p)=>({...m,[p]:e[p]}),{}),i=r.reduce((m,p)=>({...m,[p]:t[p]}),{}),a=s.reduce((m,p)=>({...m,[p]:rn([e[p],t[p]])}),{}),l=gt(o,i);return gt(l,a)}function WP(e){return e.reduce((t,n)=>VP(t,ss(n)),{})}function JP(e){const t=jv(bn(e));return ss(t)}function QP(e,t){return D(e).filter(s=>s in t).reduce((s,o)=>({...s,[o]:or([e[o],t[o]])}),{})}function Ug(e,t){return Ie(e,(n,r)=>Ug(r,QP(t,ss(n))),()=>t)}function YP(e){return Ie(e,(t,n)=>Ug(n,ss(t)),()=>Ot())}function ss(e){return Ht(e)?KP(e.$defs,e.$ref):gn(e)?GP(e.if,e.then,e.else):Ue(e)?WP(e.allOf):ae(e)?YP(e.anyOf):st(e)?JP(e.items):Le(e)?e.properties:{}}function id(e){const t=ss(e);return Ae(t)}const XP=new RegExp("^(?:0|[1-9][0-9]*)$");function ad(e){const t=`${e}`;return XP.test(t)?parseInt(t):e}function ZP(e){return Me(ad(e))}function Qu(e){return e.map(t=>Bg(t))}function Bg(e){return Ue(e)?Fn(Qu(e.allOf)):ae(e)?Ve(Qu(e.anyOf)):We(e)?ZP(e.const):e}function e1(e,t){const n=Bg(t),r=nr({},n,Sr());return Kt(r)?e:We(t)&&h(t.const,"length")?Sr():Tt()}function t1(e,t){const n=Uo(e,t);return os(n)}function n1(e,t,n){const r=Ms(e,t,n);return os(r)}function r1(e){const t=Tr(e);return os(t)}function s1(e){const t=rn(e);return os(t)}function o1(e){return[`${e}`]}function i1(e){const t=sr(e);return os(t)}function a1(e){return e.reduce((t,n)=>[...t,...os(n)],[])}function os(e){return Ht(e)?t1(e.$defs,e.$ref):gn(e)?n1(e.if,e.then,e.else):hn(e)?r1(e.enum):Ue(e)?s1(e.allOf):We(e)?o1(e.const):zt(e)?i1(e.pattern):ae(e)?a1(e.anyOf):[]}function cd(e){return os(e)}function ro(e,t){return t.map(n=>fo(e,n))}function fo(e,t){return ut(t)?Cr(fo(e,t.items)):mn(t)?Eo(ro(e,t.parameters),fo(e,t.instanceType)):pn(t)?Po(ro(e,t.parameters),fo(e,t.returnType)):st(t)?bn(ro(e,t.items)):ae(t)?Ve(ro(e,t.anyOf)):Ue(t)?Fn(ro(e,t.allOf)):ip(t)?Ae(e):t}function c1(e,t){return fo(e,t)}function l1(e,t){const n=t in e?e[t]:Tt();return c1(e,n)}function Hg(e,t){return t.reduce((n,r)=>[...n,l1(e,r)],[])}function d1(e,t){const n=cd(t),r=Hg(e,n);return or(r)}const u1=new RegExp(Fo);function f1(e){return e.filter(n=>u1.test(n))}function m1(e){const t=wm(e),n=f1(t),r=Hg(e,n);return or(r)}function p1(e,t){return nn(t)?m1(e):d1(e,t)}function g1(e){return Me(ad(e))}function Yu(e){return e.map(t=>qg(t))}function qg(e){return Ue(e)?Fn(Yu(e.allOf)):ae(e)?Ve(Yu(e.anyOf)):We(e)?g1(e.const):e}function h1(e,t){return e.reduceRight((n,r,s)=>{const o=nr({},Me(s),t);return Kt(o)?[r,...n]:n},[])}function b1(e,t){const n=qg(t),r=h1(e,n);return Fs(r)}function k1(e){return Fs(e)}function x1(e,t){return We(t)&&h(t.const,"length")?Me(e.length):nn(t)||_n(t)?k1(e):b1(e,t)}function y1(e,t){return ut(e)?e1(e.items,t):Le(e)?p1(e.properties,t):st(e)?x1(e.items,t):Tt()}function S1(e){return Ht(e)||gn(e)||Ue(e)||ae(e)?id(e):e}function zg(e,t,n){return Ye([e,t])?ue(y1(S1(e),t),{},n):od(e,t,n)}function w1(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return zg(o,i,s)}function Kg(e,t={}){return je("InstanceType",[e],t)}function v1(e,t={}){return Gg(e,t)}function I1(e){return mn(e)?e.instanceType:Tt()}function Gg(e,t){return Ye([e])?ue(I1(e),{},t):Kg(e,t)}function C1(e,t,n,r={}){const s=G(e,t,n);return Gg(s,r)}function ld(e,t={}){return je("KeyOf",[e],t)}function j1(e,t={}){return Vg(e,t)}function T1(){return Ve([Sr(),Ln(),Al()])}function A1(e){return Sr()}function E1(e){return e.reduce((n,r)=>Mm(r)?[...n,Me(ad(r))]:Ot(),[])}function P1(e){const t=D(e),n=E1(t);return Fs(n)}function N1(e){return la(e)}function O1(e){const t=e.map((n,r)=>Me(r));return Fs(t)}function $1(e){return Nn(e)?T1():ut(e)?A1(e.items):Le(e)?P1(e.properties):At(e)?N1(e):st(e)?O1(e.items):Tt()}function R1(e){return Ht(e)||gn(e)||Ue(e)||ae(e)?id(e):e}function Vg(e,t){return Ye([e])?ue($1(R1(e)),{},t):ld(e,t)}function M1(e,t,n,r){const s=G(e,t,n);return Vg(s,r)}function Oc(e,t,n,r,s={}){return je("Mapped",[e,t,n,r],s)}function F1(e,t,n,r,s={}){return Wg({},Mt([],[]),e,t,n,r,s)}function D1(e){const t=sr(e);return ha(t)}function _1(e){return e.reduce((t,n)=>[...t,...ha(n)],[])}function L1(e){const t=Tr(e);return ha(t)}function U1(e){return ye(e)?[Me(`${e}`)]:[Me(e)]}function ha(e){return hn(e)?L1(e.enum):We(e)?U1(e.const):zt(e)?D1(e.pattern):ae(e)?_1(e.anyOf):[e]}function B1(e){return ha(e)}function H1(e){return zt(e)?sr(e.pattern):e}function q1(e,t,n,r,s,o){const i=gt(e,{[n.name]:r}),a=G(i,t,s),l=H1(a),d=G(i,t,o);return Fm(l)||Dm(l)?{[l.const]:d}:{}}function z1(e,t,n,r,s,o){return r.reduce((i,a)=>[...i,q1(e,t,n,a,s,o)],[])}function K1(e){return e.reduce((t,n)=>[...t,Ae(n)],[])}function G1(e,t,n,r,s,o){const i=B1(r),a=z1(e,t,n,i,s,o),l=K1(a);return rn(l)}function Wg(e,t,n,r,s,o,i){return Ye([r])?ue(G1(e,t,n,r,s,o),{},i):Oc(n,r,s,o,i)}function V1(e,t,n,r,s,o,i){const a=G(e,t,r);return Wg(e,t,n,a,s,o,i)}function W1(e,t,n){const r=gt(e,t);return D(t).filter(o=>n.includes(o)).reduce((o,i)=>({...o,[i]:FE(r,i,t[i])}),{})}function J1(e,t,n){const r=gt(e,t);return D(t).filter(o=>!n.includes(o)).reduce((o,i)=>({...o,[i]:G(r,Mt([],[]),t[i])}),{})}function Q1(e,t,n){const r=TE(t),s=W1(e,t,r),o=J1(e,t,r),i={...s,...o};return ue(i,{},n)}function Jg(e,t,n,r){return Q1(e,n,r)}function Qg(e,t={}){return je("NonNullable",[e],t)}function Y1(e,t={}){return Yg(e,t)}function X1(e){const t=Ve([Tl(),Nl()]);return rd(e,t,{})}function Yg(e,t){return Ye([e])?ue(X1(e),{},t):Qg(e,t)}function Z1(e,t,n,r){const s=G(e,t,n);return Yg(s,r)}function Xg(e,t,n={}){return je("Omit",[e,t],n)}function eN(e,t,n={}){const r=H(t)?sd(t):t;return eh(e,r,n)}function Zg(e){const t=id(e);return Le(t)?t.properties:Ot()}function tN(e,t){return D(e).reduce((r,s)=>t.includes(s)?r:{...r,[s]:e[s]},{})}function nN(e,t){const n=Zg(e),r=cd(t),s=tN(n,r);return Ae(s)}function eh(e,t,n){return Ye([e,t])?ue(nN(e,t),{},n):Xg(e,t,n)}function rN(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return eh(o,i,s)}function th(e,t={}){return je("Parameters",[e],t)}function sN(e,t={}){return nh(e,t)}function oN(e){const t=pn(e)?e.parameters:[],n=zo({},Mt([],[]),t);return bn(n)}function nh(e,t){return Ye([e])?ue(oN(e),{},t):th(e,t)}function iN(e,t,n,r){const s=G(e,t,n);return nh(s,r)}function rh(e,t={}){return je("Partial",[e],t)}function aN(e,t={}){return sh(e,t)}function cN(e,t){const n=Uo(e,t),r=Bo(n);return Oo(gt(e,{[t]:r}),t)}function lN(e,t,n){const r=Ms(e,t,n);return Bo(r)}function dN(e){const t=rn(e);return Bo(t)}function uN(e){const t=e.map(n=>Bo(n));return Ve(t)}function fN(e){const t=D(e).reduce((r,s)=>({...r,[s]:Mi(e[s])}),{});return Ae(t)}function Bo(e){return Ht(e)?cN(e.$defs,e.$ref):gn(e)?lN(e.if,e.then,e.else):Ue(e)?dN(e.allOf):ae(e)?uN(e.anyOf):Le(e)?fN(e.properties):Ae({})}function sh(e,t){return Ye([e])?ue(Bo(e),{},t):rh(e,t)}function mN(e,t,n,r){const s=G(e,t,n);return sh(s,r)}function oh(e,t,n={}){return je("Pick",[e,t],n)}function pN(e,t,n={}){const r=H(t)?sd(t):t;return ih(e,r,n)}function gN(e,t){return D(e).reduce((r,s)=>t.includes(s)?gt(r,{[s]:e[s]}):r,{})}function hN(e,t){const n=Zg(e),r=cd(t),s=gN(n,r);return Ae(s)}function ih(e,t,n){return Ye([e,t])?ue(hN(e,t),{},n):oh(e,t,n)}function bN(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return ih(o,i,s)}function ah(e,t={}){return je("ReadonlyObject",[e],t)}function ch(e,t={}){return lh(e,t)}const kN=ch;function xN(e){return fd(Cr(e))}function yN(e,t){const n=Uo(e,t),r=Ho(n);return Oo(gt(e,{[t]:r}),t)}function SN(e,t,n){const r=Ms(e,t,n);return Ho(r)}function wN(e){const t=rn(e);return Ho(t)}function vN(e){const t=D(e).reduce((r,s)=>({...r,[s]:_i(e[s])}),{});return Ae(t)}function IN(e){return fd(bn(e))}function CN(e){const t=e.map(n=>Ho(n));return Ve(t)}function Ho(e){return ut(e)?xN(e.items):Ht(e)?yN(e.$defs,e.$ref):gn(e)?SN(e.if,e.then,e.else):Ue(e)?wN(e.allOf):Le(e)?vN(e.properties):st(e)?IN(e.items):ae(e)?CN(e.anyOf):e}function lh(e,t){return Ye([e])?ue(Ho(e),{},t):ah(e)}function jN(e,t,n,r){const s=G(e,t,n);return lh(s,r)}function TN(e,t,n,r){return t.visited.includes(r)?n:r in e?G(e,Mt(t.callstack,[...t.visited,r]),e[r]):n}function AN(e,t){const n=Uo(e,t),r=qo(n);return Oo(gt(e,{[t]:r}),t)}function EN(e,t,n){const r=Ms(e,t,n);return qo(r)}function PN(e){const t=rn(e);return qo(t)}function NN(e){const t=e.map(n=>qo(n));return Ve(t)}function ON(e){const t=D(e).reduce((r,s)=>({...r,[s]:Xm(e[s])}),{});return Ae(t)}function qo(e){return Ht(e)?AN(e.$defs,e.$ref):gn(e)?EN(e.if,e.then,e.else):Ue(e)?PN(e.allOf):ae(e)?NN(e.anyOf):Le(e)?ON(e.properties):Ae({})}function dh(e,t={}){return je("Required",[e],t)}function $N(e,t={}){return uh(e,t)}function uh(e,t){return Ye([e])?ue(qo(e),{},t):dh(e,t)}function RN(e,t,n,r){const s=G(e,t,n);return uh(s,r)}function fh(e,t={}){return je("ReturnType",[e],t)}function MN(e,t={}){return mh(e,t)}function FN(e){return pn(e)?e.returnType:Tt()}function mh(e,t){return Ye([e])?ue(FN(e),{},t):fh(e,t)}function DN(e,t,n,r={}){const s=G(e,t,n);return mh(s,r)}function ph(e,t){return je("With",[e,t],{})}function gh(e,t){return hh(e,t)}function hh(e,t){return Ye([e])?ue(e,{},t):ph(e,t)}function _N(e,t,n,r){const s=G(e,t,n);return hh(s,r)}function LN(e){return ua(e)?st(e.items)?bh(e.items.items):Zt(e.items)?[e]:kt(e.items)?[e]:[Tt()]:[e]}function bh(e){return e.reduce((n,r)=>[...n,...LN(r)],[])}function Mt(e,t){return{callstack:e,visited:t}}function Ye(e){return Ie(e,(t,n)=>kt(t)?!1:Ye(n),()=>!0)}function dd(e,t,n){return D(n).reduce((r,s)=>({...r,[s]:G(e,t,n[s])}),{})}function zo(e,t,n){const r=Wn(e,t,n);return bh(r)}function Wn(e,t,n){return n.map(r=>G(e,t,r))}function UN(e,t){const n=Xt(e)?yl(t,{}):t,r=Li(e)?xl(n,{}):n;return Di(e)?ud(r,{}):r}function BN(e,t,n,r,s){return h(n,"AddImmutable")?zN(e,t,r[0],s):h(n,"RemoveImmutable")?mP(e,t,r[0],s):h(n,"AddReadonly")?uw(e,t,r[0],s):h(n,"RemoveReadonly")?yv(e,t,r[0],s):h(n,"AddOptional")?mw(e,t,r[0],s):h(n,"RemoveOptional")?Iv(e,t,r[0],s):h(n,"Capitalize")?jP(e,t,r[0],s):h(n,"Conditional")?OP(e,t,r[0],r[1],r[2],r[3],s):h(n,"ConstructorParameters")?MP(e,t,r[0],s):h(n,"Evaluate")?HE(e,t,r[0],s):h(n,"Exclude")?DP(e,t,r[0],r[1],s):h(n,"Extract")?HP(e,t,r[0],r[1],s):h(n,"Index")?w1(e,t,r[0],r[1],s):h(n,"InstanceType")?C1(e,t,r[0],s):h(n,"Interface")?wE(e,t,r[0],r[1],s):h(n,"KeyOf")?M1(e,t,r[0],s):h(n,"Lowercase")?TP(e,t,r[0],s):h(n,"Mapped")?V1(e,t,r[0],r[1],r[2],r[3],s):h(n,"Module")?Jg(e,t,r[0],s):h(n,"NonNullable")?Z1(e,t,r[0],s):h(n,"Pick")?bN(e,t,r[0],r[1],s):h(n,"Parameters")?iN(e,t,r[0],s):h(n,"Partial")?mN(e,t,r[0],s):h(n,"Omit")?rN(e,t,r[0],r[1],s):h(n,"ReadonlyObject")?jN(e,t,r[0],s):h(n,"Record")?Yv(e,t,r[0],r[1],s):h(n,"Required")?RN(e,t,r[0],s):h(n,"ReturnType")?DN(e,t,r[0],s):h(n,"TemplateLiteral")?hA(e,t,r[0],s):h(n,"Uncapitalize")?AP(e,t,r[0],s):h(n,"Uppercase")?EP(e,t,r[0],s):h(n,"With")?_N(e,t,r[0],r[1]):je(n,r,s)}function HN(e,t,n){const r=kt(n)?TN(e,t,n,n.$ref):ut(n)?Cr(G(e,t,n.items),Sl(n)):nd(n)?Ig(e,t,n.target,n.arguments):mn(n)?Eo(Wn(e,t,n.parameters),G(e,t,n.instanceType),pw(n)):pn(n)?Po(Wn(e,t,n.parameters),G(e,t,n.returnType),gw(n)):gn(n)?Fi(G(e,t,n.if),G(e,t,n.then),G(e,t,n.else),Sw(n)):Ue(n)?Fn(Wn(e,t,n.allOf),jw(n)):Le(n)?Ae(dd(e,t,n.properties),xw(n)):At(n)?Xv(kn(n),G(e,t,qt(n))):ua(n)?da(G(e,t,n.items)):st(n)?bn(zo(e,t,n.items),kv(n)):ae(n)?Ve(Wn(e,t,n.anyOf),lv(n)):n;return UN(n,r)}function G(e,t,n){return Ts(n)?BN(e,t,n.action,n.parameters,n.options):HN(e,t,n)}function Ls(e,t){return G(e,Mt([],[]),t)}function qN(e){return ue(e,{"~immutable":!0},{})}function ud(e,t){return ue(qN(e),{},t)}function zN(e,t,n,r){const s=G(e,t,n);return ud(s,r)}function KN(e,t={}){return je("AddImmutable",[e],t)}function fd(e,t={}){return ud(e,t)}function GN(e,t={}){return je("Evaluate",[e],t)}function Un(e,t={}){return Sg(e,t)}function VN(e,t={}){return je("Module",[e],t)}function WN(e,t={}){return Jg({},Mt([],[]),e,t)}function JN(e,t){const n=ga(e,t);return h(n,"right-inside")||h(n,"disjoint")?1:0}function kh(e,t,n=[]){return Ie(t,(r,s)=>h(JN(e,r),1)?kh(e,s,[...n,r]):[...n,e,...t],()=>[...n,e])}function xh(e,t=[]){return Ie(e,(n,r)=>xh(r,kh(n,t)),()=>t)}function QN(e){return xh(e)}function YN(...e){const[t,n,r]=ct(e,{2:(i,a)=>ie(i)?[{},i,a]:[i,a,{}],3:(i,a,l)=>[i,a,l],1:i=>[{},i,{}]}),s=tA(n),o=H(s)&&h(s.length,2)?G(t,Mt([],[]),s[0]):Tt();return ue(o,{},r)}const f=Object.freeze(Object.defineProperty({__proto__:null,Any:vl,Array:Cr,BigInt:jl,Boolean:$m,Call:dP,Capitalize:kP,Codec:Il,Conditional:PP,Constructor:Eo,ConstructorParameters:$P,Cyclic:Oo,Decode:Jw,DecodeBuilder:Om,Dependent:Fi,Encode:Qw,EncodeBuilder:Nm,Enum:Cw,Evaluate:Un,Exclude:FP,Extends:nr,ExtendsResult:yA,Extract:_P,Function:Po,Generic:No,Identifier:yc,Immutable:Yw,Index:zP,Infer:kc,InstanceType:v1,Instantiate:Ls,Integer:oa,Interface:vE,Intersect:Fn,IsAny:Nn,IsArray:ut,IsBigInt:ts,IsBoolean:jr,IsCall:nd,IsCodec:en,IsConstructor:mn,IsCyclic:Ht,IsDependent:gn,IsEnum:hn,IsEnumValue:Iw,IsFunction:pn,IsGeneric:wl,IsIdentifier:rv,IsImmutable:Di,IsInfer:Zt,IsInteger:_n,IsIntersect:Ue,IsKind:we,IsLiteral:We,IsNever:Rs,IsNull:$o,IsNumber:nn,IsObject:Le,IsOptional:Xt,IsParameter:cv,IsReadonly:Li,IsRecord:At,IsRef:kt,IsRefine:Cl,IsRest:ua,IsSchema:Yt,IsString:On,IsSymbol:Ro,IsTemplateLiteral:zt,IsThis:ip,IsTuple:st,IsUndefined:Ds,IsUnion:ae,IsUnknown:Cn,IsUnsafe:Im,IsVoid:ns,KeyOf:j1,Literal:Me,Lowercase:xP,Mapped:F1,Module:WN,Never:Tt,NonNullable:Y1,Null:Tl,Number:Sr,Object:Ae,Omit:eN,Optional:bw,Parameter:Mo,Parameters:sN,Partial:aN,Pick:pN,Readonly:Xw,ReadonlyObject:ch,ReadonlyType:kN,Record:Pl,RecordKey:la,RecordPattern:kn,RecordValue:qt,Ref:dn,Refine:ev,Required:$N,Rest:da,ReturnType:MN,Script:YN,String:Ln,Symbol:Al,TemplateLiteral:xA,This:op,Tuple:bn,Uncapitalize:yP,Undefined:Nl,Union:Ve,Unknown:Bt,Unsafe:yw,Uppercase:SP,Void:ap,With:gh},Symbol.toStringTag,{value:"Module"}));function ba(e){return E(e,"~refine")&&H(e["~refine"])&&dt(e["~refine"],0,t=>ne(t)&&E(t,"check")&&E(t,"error")&&In(t.check)&&In(t.error))}function tn(e){return ne(e)&&!H(e)}function Ko(e){return ht(e)}function _e(e){return tn(e)||Ko(e)}function Go(e){return E(e,"additionalItems")&&_e(e.additionalItems)}function ar(e){return E(e,"additionalProperties")&&_e(e.additionalProperties)}function ka(e){return E(e,"allOf")&&H(e.allOf)&&e.allOf.every(t=>_e(t))}function Hi(e){return E(e,"$anchor")&&ie(e.$anchor)}function xa(e){return E(e,"anyOf")&&H(e.anyOf)&&e.anyOf.every(t=>_e(t))}function ya(e){return E(e,"const")}function is(e){return E(e,"contains")&&_e(e.contains)}function XN(e){return E(e,"contentEncoding")&&ie(e.contentEncoding)}function ZN(e){return E(e,"contentMediaType")&&ie(e.contentMediaType)}function Er(e){return E(e,"default")}function eO(e){return E(e,"$defs")&&ne(e.$defs)&&Object.values(e.$defs).every(t=>_e(t))}function Vo(e){return E(e,"dependencies")&&ne(e.dependencies)&&Object.values(e.dependencies).every(t=>_e(t)||H(t)&&t.every(n=>ie(n)))}function Wo(e){return E(e,"dependentRequired")&&ne(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>H(t)&&t.every(n=>ie(n)))}function Jo(e){return E(e,"dependentSchemas")&&ne(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>_e(t))}function Jr(e){return E(e,"$dynamicAnchor")&&ie(e.$dynamicAnchor)}function Sa(e){return E(e,"$dynamicRef")&&ie(e.$dynamicRef)}function wa(e){return E(e,"else")&&_e(e.else)}function va(e){return E(e,"enum")&&H(e.enum)}function Qo(e){return E(e,"exclusiveMaximum")&&(ye(e.exclusiveMaximum)||tt(e.exclusiveMaximum))}function Pr(e){return E(e,"exclusiveMinimum")&&(ye(e.exclusiveMinimum)||tt(e.exclusiveMinimum))}function Us(e){return E(e,"format")&&ie(e.format)}function vr(e){return E(e,"$id")&&ie(e.$id)}function Ia(e){return E(e,"if")&&_e(e.if)}function Nr(e){return E(e,"items")&&(_e(e.items)||H(e.items)&&e.items.every(t=>_e(t)))}function Ca(e){return Nr(e)&&H(e.items)}function tO(e){return Nr(e)&&!H(e.items)}function Yo(e){return E(e,"maximum")&&(ye(e.maximum)||tt(e.maximum))}function Xo(e){return E(e,"maxContains")&&ye(e.maxContains)}function Bs(e){return E(e,"maxItems")&&ye(e.maxItems)}function Zo(e){return E(e,"maxLength")&&ye(e.maxLength)}function ei(e){return E(e,"maxProperties")&&ye(e.maxProperties)}function Or(e){return E(e,"minimum")&&(ye(e.minimum)||tt(e.minimum))}function as(e){return E(e,"minContains")&&ye(e.minContains)}function cs(e){return E(e,"minItems")&&ye(e.minItems)}function Hs(e){return E(e,"minLength")&&ye(e.minLength)}function qs(e){return E(e,"minProperties")&&ye(e.minProperties)}function ti(e){return E(e,"multipleOf")&&(ye(e.multipleOf)||tt(e.multipleOf))}function ja(e){return E(e,"not")&&_e(e.not)}function Ta(e){return E(e,"oneOf")&&H(e.oneOf)&&e.oneOf.every(t=>_e(t))}function zs(e){return E(e,"pattern")&&(ie(e.pattern)||e.pattern instanceof RegExp)}function ls(e){return E(e,"patternProperties")&&ne(e.patternProperties)&&Object.values(e.patternProperties).every(t=>_e(t))}function cr(e){return E(e,"prefixItems")&&H(e.prefixItems)&&e.prefixItems.every(t=>_e(t))}function ds(e){return E(e,"properties")&&ne(e.properties)&&Object.values(e.properties).every(t=>_e(t))}function ni(e){return E(e,"propertyNames")&&(ne(e.propertyNames)||_e(e.propertyNames))}function yh(e){return E(e,"$recursiveAnchor")&&ht(e.$recursiveAnchor)}function ji(e){return yh(e)&&h(e.$recursiveAnchor,!0)}function Aa(e){return E(e,"$recursiveRef")&&ie(e.$recursiveRef)}function Ea(e){return E(e,"$ref")&&ie(e.$ref)}function lr(e){return E(e,"required")&&H(e.required)&&e.required.every(t=>ie(t))}function Pa(e){return E(e,"then")&&_e(e.then)}function ri(e){return E(e,"type")&&(ie(e.type)||H(e.type)&&e.type.every(t=>ie(t)))}function Ir(e){return E(e,"uniqueItems")&&ht(e.uniqueItems)}function Ks(e){return E(e,"unevaluatedItems")&&_e(e.unevaluatedItems)}function Gs(e){return E(e,"unevaluatedProperties")&&_e(e.unevaluatedProperties)}function nO(e){return Ks(e)||Gs(e)||$s(D(e),t=>qi(e[t]))}function rO(e){return $s(e,t=>qi(t))}function qi(e){return H(e)?rO(e):ne(e)?nO(e):!1}function Sh(e,t){return qi(t)||$s(D(e),n=>qi(e[n]))}class wh{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return Ke(de("context","Push"),[])}Pop(){return Ke(de("context","Pop"),[])}AddIndex(t){return Ke(de("context","AddIndex"),[t])}AddKey(t){return Ke(de("context","AddKey"),[t])}Merge(t){return Ke(de("context","Merge"),[t])}}class Bn{constructor(){const t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){const t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(const n of t)n.GetIndices().forEach(r=>this.GetIndices().add(r)),n.GetKeys().forEach(r=>this.GetKeys().add(r));return!0}}class md extends Bn{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}}class Hn extends md{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}}const zi={identifier:"External",variables:[]};function us(e){const t=`External[${zi.variables.length}]`;return zi.variables.push(e),t}function vh(){zi.variables=[]}function Ih(){return{...zi}}function Ch(e,t,n,r){const s=us(n["~refine"].map(o=>o));return Dn(s,z(0),["refinement","_"],Ke(de("refinement","check"),[r]))}function jh(e,t,n,r){return dt(n["~refine"],0,(s,o)=>s.check(r))}function Th(e,t,n,r,s,o){return jt(s["~refine"],0,(i,a)=>i.check(o)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:r,params:{index:a,message:i.error(o)}}))}let sO=0;function at(){return`var_${sO++}`}function pd(e){return Nr(e)&&H(e.items)}function oO(e,t,n,r){const[s,o]=[at(),at()],i=$n(e,t,n.additionalItems,s),a=gl(o,z(n.items.length)),l=t.AddIndex(o);return Dn(r,z(0),[s,o],qe(a,wt(i,l)))}function iO(e,t,n,r){const[s,o]=[at(),at()],i=$n(e,t,n.additionalItems,s),a=gl(o,z(n.items.length));return Dn(r,z(0),[s,o],qe(a,i))}function Ah(e,t,n,r){return pd(n)?t.UseUnevaluated()?oO(e,t,n,r):iO(e,t,n,r):z(!0)}function Eh(e,t,n,r){return pd(n)?dt(r,0,(o,i)=>Co(i,n.items.length)||$r(e,t,n.additionalItems,o)&&t.AddIndex(i)):!0}function Ph(e,t,n,r,s,o){return pd(s)?dt(o,0,(a,l)=>{const d=`${n}/additionalItems`,m=`${r}/${l}`;return Co(l,s.items.length)||Rr(e,t,d,m,s.additionalItems,a)&&t.AddIndex(l)}):!0}function aO(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function gd(e){const t=[];return ls(e)&&t.push(...D(e.patternProperties)),ds(e)&&t.push(...D(e.properties).map(aO)),h(t.length,0)?"(?!)":`(${t.join("|")})`}function Nh(e,t,n){return lr(t)&&ds(t)&&!ls(t)&&h(t.additionalProperties,!1)&&h(D(t.properties).length,t.required.length)}function Oh(e,t,n){return Gt(de(Ke(de("Object","getOwnPropertyNames"),[n]),"length"),z(t.required.length))}function $h(e,t,n,r){const[s,o]=[at(),at()],i=us(new RegExp(gd(n))),a=$n(e,t,n.additionalProperties,`${r}[${s}]`),l=Ke(de(i,"test"),[s]),d=t.AddKey(s),m=t.UseUnevaluated()?qe(l,wt(a,d)):qe(l,a);return Dn(es(r),z(0),[s,o],m)}function Rh(e,t,n,r){return Nh(t,n)?Oh(t,n,r):$h(e,t,n,r)}function Mh(e,t,n,r){const s=new RegExp(gd(n));return dt(D(r),0,(i,a)=>s.test(i)||$r(e,t,n.additionalProperties,r[i])&&t.AddKey(i))}function Fh(e,t,n,r,s,o){const i=new RegExp(gd(s)),a=[];return jt(D(o),0,(d,m)=>{const p=`${n}/additionalProperties`,g=`${r}/${d}`,x=new Hn,b=i.test(d)||Rr(e,x,p,g,s.additionalProperties,o[d])&&t.AddKey(d);return b||a.push(d),b})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:r,params:{additionalProperties:a}})}function si(e,t,n,r,s){const o=Qn("results","[]"),i=n.map((m,p)=>Qn(`context_${p}`,hl("CheckContext",[]))),a=n.map((m,p)=>Qn(`condition_${p}`,Ke(xr(["context"],ot(e,t,m,r)),[`context_${p}`]))),l=n.map((m,p)=>bm(`condition_${p}`,Ke(de("results","push"),[`context_${p}`]))),d=ra(wt(s,t.Merge("results")));return Ke(xr([],na([o,...i,...a,...l,d])),[])}function cO(e,t,n,r){return si(e,t,n.allOf,r,Gt(de("results","length"),z(n.allOf.length)))}function lO(e,t,n,r){return It(n.allOf.map(s=>ot(e,t,s,r)))}function Dh(e,t,n,r){return t.UseUnevaluated()?cO(e,t,n,r):lO(e,t,n,r)}function _h(e,t,n,r){const s=n.allOf.reduce((o,i)=>{const a=new Bn;return it(e,a,i,r)?[...o,a]:o},[]);return h(s.length,n.allOf.length)&&t.Merge(s)}function Lh(e,t,n,r,s,o){const i=[],a=s.allOf.reduce((d,m,p)=>{const g=`${n}/allOf/${p}`,x=new Hn,b=Ct(e,x,g,r,m,o);return b||i.push(x),b?[...d,x]:d},[]),l=h(a.length,s.allOf.length)&&t.Merge(a);return l||i.forEach(d=>d.GetErrors().forEach(m=>t.AddError(m))),l}function dO(e,t,n,r){return si(e,t,n.anyOf,r,pm(de("results","length"),z(0)))}function uO(e,t,n,r){return bl(n.anyOf.map(s=>ot(e,t,s,r)))}function Uh(e,t,n,r){return t.UseUnevaluated()?dO(e,t,n,r):uO(e,t,n,r)}function Bh(e,t,n,r){const s=n.anyOf.reduce((o,i)=>{const a=new Bn;return it(e,a,i,r)?[...o,a]:o},[]);return Yr(s.length,0)&&t.Merge(s)}function Hh(e,t,n,r,s,o){const i=[],a=s.anyOf.reduce((d,m,p)=>{const g=new Hn,x=`${n}/anyOf/${p}`,b=Ct(e,g,x,r,m,o);return b||i.push(g),b?[...d,g]:d},[]),l=Yr(a.length,0)&&t.Merge(a);return l||i.forEach(d=>d.GetErrors().forEach(m=>t.AddError(m))),l||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:r,params:{}})}function qh(e,t,n,r){return z(!!n)}function hd(e,t,n,r){return n}function zh(e,t,n,r,s,o){return hd(e,t,s)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:r,params:{}})}function Kh(e,t,n,r){return Os(n.const)?Gt(r,z(n.const)):hm(r,us(n.const))}function bd(e,t,n,r){return Os(n.const)?h(r,n.const):Xr(r,n.const)}function Gh(e,t,n,r,s,o){return bd(e,t,s,o)||t.AddError({keyword:"const",schemaPath:n,instancePath:r,params:{allowedValue:s.const}})}function Vh(e){return!(as(e)&&h(e.minContains,0))}function fO(e,t,n,r){const[s,o]=[at(),at()],i=Nt(Gt(de(r,"length"),z(0))),a=K0(r,[s,o],wt(ot(e,t,n.contains,s),t.AddIndex(o)));return wt(i,a)}function mO(e,t,n,r){const[s]=[at()],o=Nt(Gt(de(r,"length"),z(0))),i=z0(r,[s,"_"],ot(e,t,n.contains,s));return wt(o,i)}function Wh(e,t,n,r){return Vh(n)?t.UseUnevaluated()?fO(e,t,n,r):mO(e,t,n,r):z(!0)}function kd(e,t,n,r){return Vh(n)?!h(r.length,0)&&cm(r,(s,o)=>it(e,t,n.contains,s)&&t.AddIndex(o)):!0}function Jh(e,t,n,r,s,o){return kd(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:1}})}function Qh(e,t,n,r){const s=Gt(de(es(r),"length"),z(0)),o=It(nt(n.dependencies).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=ot(e,t,a,r),m=p=>It(p.map(g=>Kr(r,z(g))));return qe(l,H(a)?m(a):d)}));return qe(s,o)}function Yh(e,t,n,r){const s=h(D(r).length,0),o=dt(nt(n.dependencies),0,([i,a])=>!E(r,i)||(H(a)?a.every(l=>E(r,l)):it(e,t,a,r)));return s||o}function Xh(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(nt(s.dependencies),0,([l,d])=>{const m=`${n}/dependencies/${l}`;return!E(o,l)||(H(d)?d.every(p=>E(o,p)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:r,params:{property:l,dependencies:d}})):Ct(e,t,m,r,d,o))});return i||a}function Zh(e,t,n,r){const s=Gt(de(es(r),"length"),z(0)),o=It(nt(n.dependentRequired).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=It(a.map(m=>Kr(r,z(m))));return qe(l,d)}));return qe(s,o)}function eb(e,t,n,r){const s=h(D(r).length,0),o=dt(nt(n.dependentRequired),0,([i,a])=>!E(r,i)||a.every(l=>E(r,l)));return s||o}function tb(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(nt(s.dependentRequired),0,([l,d])=>!E(o,l)||jt(d,0,m=>E(o,m)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:r,params:{property:l,dependencies:d}})));return i||a}function nb(e,t,n,r){const s=Gt(de(es(r),"length"),z(0)),o=It(nt(n.dependentSchemas).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=ot(e,t,a,r);return qe(l,d)}));return qe(s,o)}function rb(e,t,n,r){const s=h(D(r).length,0),o=dt(nt(n.dependentSchemas),0,([i,a])=>!E(r,i)||it(e,t,a,r));return s||o}function sb(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(nt(s.dependentSchemas),0,([l,d])=>{const m=`${n}/dependentSchemas/${l}`;return!E(o,l)||Ct(e,t,m,r,d,o)});return i||a}function pO(e,t,n,r){const s=e.DynamicRef(n)??!1;return Vs(e,t,s,r)}function gO(e,t,n,r){const s=e.DynamicRef(n)??!1;return _e(s)&&it(e,t,s,r)}function hO(e,t,n,r,s,o){const i=e.DynamicRef(s)??!1;return _e(i)&&Ct(e,t,"#",r,i,o)}function ob(e,t,n,r){return bl(n.enum.map(s=>{if(Os(s))return Gt(r,z(s));const o=us(s);return hm(r,o)}))}function xd(e,t,n,r){return $s(n.enum,s=>Os(s)?h(r,s):Xr(r,s))}function ib(e,t,n,r,s,o){return xd(e,t,s,o)||t.AddError({keyword:"enum",schemaPath:n,instancePath:r,params:{allowedValues:s.enum}})}function ab(e,t,n,r){return gl(r,z(n.exclusiveMaximum))}function yd(e,t,n,r){return Co(r,n.exclusiveMaximum)}function cb(e,t,n,r,s,o){return yd(e,t,s,o)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:r,params:{comparison:"<",limit:s.exclusiveMaximum}})}function lb(e,t,n,r){return pm(r,z(n.exclusiveMinimum))}function Sd(e,t,n,r){return Yr(r,n.exclusiveMinimum)}function db(e,t,n,r,s,o){return Sd(e,t,s,o)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:r,params:{comparison:">",limit:s.exclusiveMinimum}})}const bO=[0,31,28,31,30,31,30,31,31,30,31,30,31],kO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function xO(e){return e%4===0&&(e%100!==0||e%400===0)}function wd(e){const t=kO.exec(e);if(!t)return!1;const n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&xO(n)?29:bO[r])}const yO=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function vd(e,t=!0){const n=yO.exec(e);if(!n)return!1;const r=+n[1],s=+n[2],o=+n[3],i=n[4]==="-"?-1:1,a=+(n[5]||0),l=+(n[6]||0);if(a>23||l>59||t&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(r<=23&&s<=59&&o<60)return!0;const d=s-l*i,m=r-a*i-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}function ub(e,t=!0){const n=e.split(/T/i);return n.length===2&&wd(n[0])&&vd(n[1],t)}const SO=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function fb(e){return SO.test(e)}const wO=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;function mb(e){return wO.test(e)}const qr=36,Ti=1,$c=26,vO=38,IO=700,CO=72,jO=128;function TO(e,t,n){e=n?Math.floor(e/IO):e>>1,e+=Math.floor(e/t);let r=0;for(;e>(qr-Ti)*$c>>1;)e=Math.floor(e/(qr-Ti)),r+=qr;return r+Math.floor((qr-Ti+1)*e/(e+vO))}function AO(e){const t=[];let n=jO,r=0,s=CO;const o=e.lastIndexOf("-");if(o>0)for(let a=0;a<o;a++){const l=e.charCodeAt(a);if(l>=128)throw new Error("Invalid punycode: non-basic before delimiter");t.push(l)}let i=o<0?0:o+1;for(;i<e.length;){const a=r;let l=1,d=qr;for(;;){if(i>=e.length)throw new Error("Invalid punycode: unexpected end of input");const p=e.charCodeAt(i++);let g;if(p>=97&&p<=122)g=p-97;else if(p>=48&&p<=57)g=p-48+26;else if(p>=65&&p<=90)Ot();else throw new Error("Invalid punycode: bad digit character");r+=g*l;const x=d<=s?Ti:d>=s+$c?$c:d-s;if(g<x)break;l*=qr-x,d+=qr}const m=t.length+1;s=TO(r-a,m,a===0),n+=Math.floor(r/m),r%=m,t.splice(r,0,n),r++}return globalThis.String.fromCodePoint(...t)}function EO(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function PO(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function NO(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function OO(e){return EO(e)||PO(e)||NO(e)}const $O=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),RO=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function MO(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function FO(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function DO(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function _O(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function LO(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function UO(e){return e>=1632&&e<=1641}function BO(e){return e>=1776&&e<=1785}function Xu(e){return RO.has(e)}function pb(e){if(e.length===0)return Ot();const t=[...e].map(i=>i.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||OO(t[0]))return!1;let r=!1,s=!1,o=!1;for(let i=0;i<n;i++){const a=t[i];if($O.has(a))return!1;(DO(a)||_O(a)||LO(a))&&(r=!0),UO(a)&&(s=!0),BO(a)&&(o=!0);const l=t[i-1],d=t[i+1];switch(a){case 183:if(l!==108||d!==108)return!1;break;case 885:if(d===void 0||!MO(d))return!1;break;case 1523:case 1524:if(l===void 0||!FO(l))return!1;break;case 8204:if(l===void 0||l<128&&!Xu(l))return!1;break;case 8205:if(l===void 0||!Xu(l))return!1;break}}return!(e.includes("・")&&!r||s&&o)}function HO(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function gb(e){return e.toLowerCase().startsWith("xn--")}function hb(e){try{const t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;const r=AO(t);return r?pb(r):!1}catch{return!1}}function qO(e){return e.length===0||e.length>63?!1:gb(e)?hb(e):pb(e)}function zO(e){return e.length===0||e.length>63?!1:gb(e)?hb(e):HO(e)}function bb(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(const t of e.split("."))if(!zO(t))return!1;return!0}const KO=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function kb(e){return KO.test(e)}function xb(e){if(e.length===0||e.includes(" "))return!1;const t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(const n of t.split("."))if(!qO(n))return!1;return!0}function yb(e,t,n){let r=0,s=0,o=0,i=0;for(let a=t;a<n;a++){const l=e.charCodeAt(a);if(l===46){if(o===0||s>255||i===48&&o>1)return!1;r++,s=0,o=0,i=0}else if(l>=48&&l<=57)o===0&&(i=l),s=s*10+(l-48),o++;else return!1}return r===3&&o>0&&s<=255&&!(i===48&&o>1)}function Sb(e){return yb(e,0,e.length)}function GO(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function wb(e){const t=e.length;if(t===0)return!1;let n=0,r=!1,s=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;r=!0,s=2}for(;s<t;){let o=0;const i=s;for(;s<t&&GO(e.charCodeAt(s));)s++,o++;if(o===0)return!1;const a=e.charCodeAt(s);if(a===46){if(!yb(e,i,t))return!1;n+=2,s=t;break}if(o>4)return!1;if(n++,s===t)break;if(a!==58)return!1;if(s++,e.charCodeAt(s)===58){if(r||e.charCodeAt(s+1)===58)return!1;if(r=!0,s++,s===t)break}}return r?n<=7:n===8}function Zu(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function vb(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;const t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?Zu(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:Zu(e)}function Ib(e){try{return new URL(e),!0}catch{return!1}}const VO=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Cb(e){return VO.test(e)}const WO=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function jb(e){return WO.test(e)}function Tb(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}const JO=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Ab(e){return JO.test(e)}const QO=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function Eb(e){return QO.test(e)}const YO=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function Pb(e){return YO.test(e)}function Nb(e){return e>=97&&e<=122||e>=65&&e<=90}function Ob(e){return Nb(e)||e>=48&&e<=57}function yi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function XO(e){return Ob(e)||e===43||e===45||e===46}function Rc(e){return Ob(e)||e===45||e===46||e===95||e===126}function Mc(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function ZO(e){return Rc(e)||Mc(e)||e===58||e===64}function $b(e){const t=e.length;if(t===0||!Nb(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){const r=e.charCodeAt(n);if(r===58)break;if(!XO(r))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;const r=n;let s=-1;for(let o=n;o<t;o++){const i=e.charCodeAt(o);if(i===64){s=o;break}if(i===47||i===63||i===35)break}if(s!==-1){for(let o=r;o<s;o++){const i=e.charCodeAt(o);if(i===91||i===93)return!1;if(i===37){if(o+2>=s||!yi(e.charCodeAt(o+1))||!yi(e.charCodeAt(o+2)))return!1;o+=2}else if(!Rc(i)&&!Mc(i)&&i!==58)return!1}n=s+1}if(e.charCodeAt(n)===91){for(n++;n<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){const o=e.charCodeAt(n);if(o===47||o===63||o===35||o===58)break;if(o<128&&!Rc(o)&&!Mc(o))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<t;){const o=e.charCodeAt(n);if(o===47||o===63||o===35)break;if(o<48||o>57)return!1;n++}}for(;n<t;){const r=e.charCodeAt(n);if(r===37){if(n+2>=t||!yi(e.charCodeAt(n+1))||!yi(e.charCodeAt(n+2)))return!1;n+=2}else{if(r>127)return!1;if(!(ZO(r)||r===47||r===63||r===35))return!1}n++}return!0}const e$=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function Rb(e){return e$.test(e)}const t$=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Mb(e){return t$.test(e)}const Be=new Map;function Fb(){Be.clear()}function n$(){return[...Be.entries()]}function r$(e,t){Be.set(e,t)}function s$(e){return Be.has(e)}function o$(e){return Be.get(e)}function Db(e,t){var n;return((n=Be.get(e))==null?void 0:n(t))??!0}function _b(){Fb(),Be.set("date-time",ub),Be.set("date",wd),Be.set("duration",fb),Be.set("email",mb),Be.set("hostname",bb),Be.set("idn-email",kb),Be.set("idn-hostname",xb),Be.set("ipv4",Sb),Be.set("ipv6",wb),Be.set("iri-reference",vb),Be.set("iri",Ib),Be.set("json-pointer-uri-fragment",Cb),Be.set("json-pointer",jb),Be.set("regex",Tb),Be.set("relative-json-pointer",Ab),Be.set("time",vd),Be.set("uri-reference",Eb),Be.set("uri-template",Pb),Be.set("uri",$b),Be.set("url",Rb),Be.set("uuid",Mb)}_b();const i$=Object.freeze(Object.defineProperty({__proto__:null,Clear:Fb,Entries:n$,Get:o$,Has:s$,IsDate:wd,IsDateTime:ub,IsDuration:fb,IsEmail:mb,IsHostname:bb,IsIPv4:Sb,IsIPv6:wb,IsIdnEmail:kb,IsIdnHostname:xb,IsIri:Ib,IsIriReference:vb,IsJsonPointer:jb,IsJsonPointerUriFragment:Cb,IsRegex:Tb,IsRelativeJsonPointer:Ab,IsTime:vd,IsUri:$b,IsUriReference:Eb,IsUriTemplate:Pb,IsUrl:Rb,IsUuid:Mb,Reset:_b,Set:r$,Test:Db},Symbol.toStringTag,{value:"Module"}));function Lb(e,t,n,r){return Ke(de("Format","Test"),[z(n.format),r])}function Id(e,t,n,r){return Db(n.format,r)}function Ub(e,t,n,r,s,o){return Id(e,t,s,o)||t.AddError({keyword:"format",schemaPath:n,instancePath:r,params:{format:s.format}})}function Bb(e,t,n,r){const s=Pa(n)?n.then:!0,o=wa(n)?n.else:!0;return V0(ot(e,t,n.if,r),ot(e,t,s,r),ot(e,t,o,r))}function Hb(e,t,n,r){const s=Pa(n)?n.then:!0,o=wa(n)?n.else:!0;return it(e,t,n.if,r)?it(e,t,s,r):it(e,t,o,r)}function qb(e,t,n,r,s,o){const i=Pa(s)?s.then:!0,a=wa(s)?s.else:!0,l=new Hn,d=Ct(e,l,`${n}/if`,r,s.if,o)?Ct(e,l,`${n}/then`,r,i,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"then"}}):Ct(e,t,`${n}/else`,r,a,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"else"}});return d&&t.Merge([l]),d}function a$(e,t,n,r){return It(n.items.map((s,o)=>{const i=Zr(de(r,"length"),z(o)),a=$n(e,t,s,`${r}[${o}]`),l=t.AddIndex(z(o));return qe(i,wt(a,l))}))}function c$(e,t,n,r){return It(n.items.map((s,o)=>{const i=Zr(de(r,"length"),z(o)),a=$n(e,t,s,`${r}[${o}]`);return qe(i,a)}))}function l$(e,t,n,r){return t.UseUnevaluated()?a$(e,t,n,r):c$(e,t,n,r)}function d$(e,t,n,r){return dt(n.items,0,(s,o)=>rr(r.length,o)||$r(e,t,s,r[o])&&t.AddIndex(o))}function u$(e,t,n,r,s,o){return jt(s.items,0,(i,a)=>{const l=`${n}/items/${a}`,d=`${r}/${a}`;return rr(o.length,a)||Rr(e,t,l,d,i,o[a])&&t.AddIndex(a)})}function f$(e,t,n,r){const s=cr(n)?n.prefixItems.length:0,o=$n(e,t,n.items,"element"),i=t.AddIndex("index");return Dn(r,z(s),["element","index"],wt(o,i))}function m$(e,t,n,r){const s=cr(n)?n.prefixItems.length:0,o=$n(e,t,n.items,"element");return Dn(r,z(s),["element","index"],o)}function p$(e,t,n,r){return t.UseUnevaluated()?f$(e,t,n,r):m$(e,t,n,r)}function g$(e,t,n,r){const s=cr(n)?n.prefixItems.length:0;return dt(r,s,(o,i)=>$r(e,t,n.items,o)&&t.AddIndex(i))}function h$(e,t,n,r,s,o){const i=cr(s)?s.prefixItems.length:0;return jt(o,i,(a,l)=>{const d=`${n}/items`,m=`${r}/${l}`;return Rr(e,t,d,m,s.items,a)&&t.AddIndex(l)})}function zb(e,t,n,r){return Ca(n)?l$(e,t,n,r):p$(e,t,n,r)}function Kb(e,t,n,r){return Ca(n)?d$(e,t,n,r):g$(e,t,n,r)}function Gb(e,t,n,r,s,o){return Ca(s)?u$(e,t,n,r,s,o):h$(e,t,n,r,s,o)}function Vb(e){return is(e)}function Wb(e,t,n,r){if(!Vb(n))return z(!0);const[s]=[at()],o=ta(r,[s,"_"],ot(e,t,n.contains,s));return Zr(o,z(n.maxContains))}function Cd(e,t,n,r){if(!Vb(n))return!0;const s=ul(r,o=>it(e,t,n.contains,o));return rr(s,n.maxContains)}function Jb(e,t,n,r,s,o){const i=as(s)?s.minContains:1;return Cd(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:i,maxContains:s.maxContains}})}function Qb(e,t,n,r){return Zr(r,z(n.maximum))}function jd(e,t,n,r){return rr(r,n.maximum)}function Yb(e,t,n,r,s,o){return jd(e,t,s,o)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:r,params:{comparison:"<=",limit:s.maximum}})}function Xb(e,t,n,r){return Zr(de(r,"length"),z(n.maxItems))}function Td(e,t,n,r){return rr(r.length,n.maxItems)}function Zb(e,t,n,r,s,o){return Td(e,t,s,o)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:r,params:{limit:s.maxItems}})}function ek(e,t,n,r){return q0(r,z(n.maxLength))}function Ad(e,t,n,r){return im(r,n.maxLength)}function tk(e,t,n,r,s,o){return Ad(e,t,s,o)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:r,params:{limit:s.maxLength}})}function nk(e,t,n,r){return Zr(de(es(r),"length"),z(n.maxProperties))}function Ed(e,t,n,r){return rr(D(r).length,n.maxProperties)}function rk(e,t,n,r,s,o){return Ed(e,t,s,o)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:r,params:{limit:s.maxProperties}})}function sk(e){return is(e)}function b$(e,t,n,r){const[s,o]=[at(),at()],i=ta(r,[s,o],wt(ot(e,t,n.contains,s),t.AddIndex(o)));return jo(i,z(n.minContains))}function k$(e,t,n,r){const[s]=[at()],o=ta(r,[s,"_"],ot(e,t,n.contains,s));return jo(o,z(n.minContains))}function ok(e,t,n,r){return sk(n)?t.UseUnevaluated()?b$(e,t,n,r):k$(e,t,n,r):z(!0)}function Pd(e,t,n,r){if(!sk(n))return!0;const s=ul(r,(o,i)=>it(e,t,n.contains,o)&&t.AddIndex(i));return Ns(s,n.minContains)}function ik(e,t,n,r,s,o){return Pd(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:s.minContains}})}function ak(e,t,n,r){return jo(r,z(n.minimum))}function Nd(e,t,n,r){return Ns(r,n.minimum)}function ck(e,t,n,r,s,o){return Nd(e,t,s,o)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:r,params:{comparison:">=",limit:s.minimum}})}function lk(e,t,n,r){return jo(de(r,"length"),z(n.minItems))}function Od(e,t,n,r){return Ns(r.length,n.minItems)}function dk(e,t,n,r,s,o){return Od(e,t,s,o)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:r,params:{limit:s.minItems}})}function uk(e,t,n,r){return H0(r,z(n.minLength))}function $d(e,t,n,r){return am(r,n.minLength)}function fk(e,t,n,r,s,o){return $d(e,t,s,o)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:r,params:{limit:s.minLength}})}function mk(e,t,n,r){return jo(de(es(r),"length"),z(n.minProperties))}function Rd(e,t,n,r){return Ns(D(r).length,n.minProperties)}function pk(e,t,n,r,s,o){return Rd(e,t,s,o)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:r,params:{limit:s.minProperties}})}function gk(e,t,n,r){return W0(r,z(n.multipleOf))}function Md(e,t,n,r){return sm(r,n.multipleOf)}function hk(e,t,n,r,s,o){return Md(e,t,s,o)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:r,params:{multipleOf:s.multipleOf}})}function x$(e,t,n,r){return si(e,t,[n.not],r,Nt(Gt(de("results","length"),z(1))))}function y$(e,t,n,r){return Nt(ot(e,t,n.not,r))}function bk(e,t,n,r){return t.UseUnevaluated()?x$(e,t,n,r):y$(e,t,n,r)}function Fd(e,t,n,r){const s=new Bn;return!it(e,s,n.not,r)&&t.Merge([s])}function kk(e,t,n,r,s,o){return Fd(e,t,s,o)||t.AddError({keyword:"not",schemaPath:n,instancePath:r,params:{}})}function S$(e,t,n,r){return si(e,t,n.oneOf,r,Gt(de("results","length"),z(1)))}function w$(e,t,n,r){const[s]=[at()],o=G0(n.oneOf.map(a=>ot(e,t,a,r))),i=ta(o,[s,"_"],Gt(s,z(!0)));return Gt(i,z(1))}function xk(e,t,n,r){return t.UseUnevaluated()?S$(e,t,n,r):w$(e,t,n,r)}function yk(e,t,n,r){const s=n.oneOf.reduce((o,i)=>{const a=new Bn;return it(e,a,i,r)?[...o,a]:o},[]);return h(s.length,1)&&t.Merge(s)}function Sk(e,t,n,r,s,o){const i=[],a=[],l=s.oneOf.reduce((m,p,g)=>{const x=new Hn,b=`${n}/oneOf/${g}`,y=Ct(e,x,b,r,p,o);return y&&a.push(g),y||i.push(x),y?[...m,x]:m},[]),d=h(l.length,1)&&t.Merge(l);return!d&&h(a.length,0)&&i.forEach(m=>m.GetErrors().forEach(p=>t.AddError(p))),d||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:r,params:{passingSchemas:a}})}function wk(e,t,n,r){const s=us(ie(n.pattern)?new RegExp(n.pattern,"u"):n.pattern);return Ke(de(s,"test"),[r])}function Dd(e,t,n,r){return(ie(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(r)}function vk(e,t,n,r,s,o){return Dd(e,t,s,o)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:r,params:{pattern:s.pattern}})}function Ik(e,t,n,r){return It(nt(n.patternProperties).map(([s,o])=>{const[i,a]=[at(),at()],l=us(new RegExp(s,"u")),d=Nt(Ke(de(l,"test"),[i])),m=$n(e,t,o,a),p=t.AddKey(i),g=t.UseUnevaluated()?qe(d,wt(m,p)):qe(d,m);return Dn(gm(r),z(0),[`[${i}, ${a}]`,"_"],g)}))}function Ck(e,t,n,r){return dt(nt(n.patternProperties),0,([s,o])=>{const i=new RegExp(s,"u");return dt(nt(r),0,([a,l])=>!i.test(a)||$r(e,t,o,l)&&t.AddKey(a))})}function jk(e,t,n,r,s,o){return jt(nt(s.patternProperties),0,([i,a])=>{const l=`${n}/patternProperties/${i}`,d=new RegExp(i,"u");return jt(nt(o),0,([m,p])=>{const g=`${r}/${m}`;return!d.test(m)||Rr(e,t,l,g,a,p)&&t.AddKey(m)})})}function Tk(e,t,n,r){return It(n.prefixItems.map((s,o)=>{const i=Zr(de(r,"length"),z(o)),a=$n(e,t,s,`${r}[${o}]`),l=t.AddIndex(z(o)),d=t.UseUnevaluated()?wt(a,l):a;return qe(i,d)}))}function Ak(e,t,n,r){return h(r.length,0)||dt(n.prefixItems,0,(s,o)=>rr(r.length,o)||$r(e,t,s,r[o])&&t.AddIndex(o))}function Ek(e,t,n,r,s,o){return h(o.length,0)||jt(s.prefixItems,0,(i,a)=>{const l=`${n}/prefixItems/${a}`,d=`${r}/${a}`;return rr(o.length,a)||Rr(e,t,l,d,i,o[a])&&t.AddIndex(a)})}function _d(e,t){return e.includes(t)||Ao().exactOptionalPropertyTypes}function v$(e,t){return bc(de(e,t))}function Pk(e,t){return $e(e[t])}function Nk(e,t,n,r){const s=lr(n)?n.required:[],o=nt(n.properties).map(([i,a])=>{const l=Nt(Kr(r,z(i))),d=$n(e,t,a,de(r,i)),m=t.AddKey(z(i)),p=t.UseUnevaluated()?wt(d,m):d,g=s.includes(i)?p:qe(l,p);return _d(s,i)?g:qe(v$(r,i),g)});return It(o)}function Ok(e,t,n,r){const s=lr(n)?n.required:[];return dt(nt(n.properties),0,([i,a])=>{const l=!E(r,i)||$r(e,t,a,r[i])&&t.AddKey(i);return _d(s,i)?l:Pk(r,i)||l})}function $k(e,t,n,r,s,o){const i=lr(s)?s.required:[];return jt(nt(s.properties),0,([l,d])=>{const m=`${n}/properties/${l}`,p=`${r}/${l}`,g=()=>!E(o,l)||Rr(e,t,m,p,d,o[l])&&t.AddKey(l);return _d(i,l)?g():Pk(o,l)||g()})}function Rk(e,t,n,r){const[s,o]=[at(),at()];return Dn(es(r),z(0),[s,o],ot(e,t,n.propertyNames,s))}function Mk(e,t,n,r){return dt(D(r),0,(s,o)=>it(e,t,n.propertyNames,s))}function Fk(e,t,n,r,s,o){const i=[];return jt(D(o),0,(l,d)=>{const m=`${r}/${l}`,p=`${n}/propertyNames`,g=new Hn,x=Ct(e,g,p,m,s.propertyNames,l);return x||i.push(l),x})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:r,params:{propertyNames:i}})}function Dk(e,t,n,r){const s=e.RecursiveRef(n)??!1;return Vs(e,t,s,r)}function _k(e,t,n,r){const s=e.RecursiveRef(n)??!1;return _e(s)&&it(e,t,s,r)}function Lk(e,t,n,r,s,o){const i=e.RecursiveRef(s)??!1;return _e(i)&&Ct(e,t,"#",r,i,o)}function I$(e,t,n,r){const s=xr(["context","value"],Vs(e,t,n,"value")),o=xr(["context","value"],na([Qn("nextContext",hl("CheckContext",[])),Qn("result",Ke(s,["nextContext","value"])),bm("result",t.Merge("[nextContext]")),ra("result")]));return Ke(o,["context",r])}function C$(e,t,n,r){return Vs(e,t,n,r)}function Uk(e,t,n,r){const s=e.Ref(n)??!1;return t.UseUnevaluated()?I$(e,t,s,r):C$(e,t,s,r)}function Bk(e,t,n,r){const s=e.Ref(n)??!1,o=new Bn,i=_e(s)&&it(e,o,s,r);return i&&t.Merge([o]),i}function Hk(e,t,n,r,s,o){const i=e.Ref(s)??!1,a=new Hn,l=_e(i)&&Ct(e,a,"#",r,i,o);return l&&t.Merge([a]),l||a.GetErrors().forEach(d=>t.AddError(d)),l}function qk(e,t,n,r){return It(n.required.map(s=>Kr(r,z(s))))}function zk(e,t,n,r){return dt(n.required,0,s=>E(r,s))}function Kk(e,t,n,r,s,o){const i=[];return jt(s.required,0,l=>{const d=E(o,l);return d||i.push(l),d})||t.AddError({keyword:"required",schemaPath:n,instancePath:r,params:{requiredProperties:i}})}function Gk(e,t,n,r){return h(n,"object")?um(r):h(n,"array")?Ri(r):h(n,"boolean")?F0(r):h(n,"integer")?D0(r):h(n,"number")?dm(r):h(n,"null")?_0(r):h(n,"string")?mm(r):h(n,"bigint")?lm(r):h(n,"constructor")?B0(r):h(n,"function")?U0(r):h(n,"symbol")?L0(r):h(n,"undefined")||h(n,"void")?bc(r):z(!0)}function Ld(e,t,n,r,s){return h(n,"object")?fn(s):h(n,"array")?H(s):h(n,"boolean")?ht(s):h(n,"integer")?ll(s):h(n,"number")?ye(s):h(n,"null")?Vt(s):h(n,"string")?ie(s):h(n,"bigint")?tt(s):h(n,"constructor")?ea(s):h(n,"function")?In(s):h(n,"symbol")?dl(s):h(n,"undefined")||h(n,"void")?$e(s):!0}function j$(e,t,n,r){return bl(n.map(s=>Gk(e,t,s,r)))}function Vk(e,t,n,r,s){return $s(n,o=>Ld(e,t,o,r,s))}function Wk(e,t,n,r){return H(n.type)?j$(e,t,n.type,r):Gk(e,t,n.type,r)}function Jk(e,t,n,r){return H(n.type)?Vk(e,t,n.type,n,r):Ld(e,t,n.type,n,r)}function Qk(e,t,n,r,s,o){return(H(s.type)?Vk(e,t,s.type,s,o):Ld(e,t,s.type,s,o))||t.AddError({keyword:"type",schemaPath:n,instancePath:r,params:{type:s.type}})}function Yk(e,t,n,r){const[s,o]=[at(),at()],i=Ke(de("context","GetIndices"),[]),a=Ke(de("indices","has"),[s]),l=ot(e,t,n.unevaluatedItems,o),d=Ke(de("context","AddIndex"),[s]),m=Dn(r,z(0),[o,s],wt(qe(a,l),d));return Ke(xr(["context"],na([Qn("indices",i),ra(m)])),["context"])}function Xk(e,t,n,r){const s=t.GetIndices();return dt(r,0,(o,i)=>(s.has(i)||it(e,t,n.unevaluatedItems,o))&&t.AddIndex(i))}function Zk(e,t,n,r,s,o){const i=t.GetIndices(),a=[];return jt(o,0,(d,m)=>{const p=new Hn,g=(i.has(m)||Ct(e,p,n,r,s.unevaluatedItems,d))&&t.AddIndex(m);return g||a.push(m),g})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:r,params:{unevaluatedItems:a}})}function ex(e,t,n,r){const[s,o]=[at(),at()],i=Ke(de("context","GetKeys"),[]),a=Ke(de("keys","has"),[s]),l=Ke(de("context","AddKey"),[s]),d=ot(e,t,n.unevaluatedProperties,o),m=Dn(gm(r),z(0),[`[${s}, ${o}]`,"_"],qe(a,wt(d,l)));return Ke(xr(["context"],na([Qn("keys",i),ra(m)])),["context"])}function tx(e,t,n,r){const s=t.GetKeys();return dt(nt(r),0,([o,i])=>s.has(o)||it(e,t,n.unevaluatedProperties,i)&&t.AddKey(o))}function nx(e,t,n,r,s,o){const i=t.GetKeys(),a=[];return jt(nt(o),0,([d,m])=>{const p=new Hn,g=i.has(d)||Ct(e,p,n,r,s.unevaluatedProperties,m)&&t.AddKey(d);return g||a.push(d),g})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:r,params:{unevaluatedProperties:a}})}function Ud(e){return!h(e.uniqueItems,!1)}function rx(e,t,n,r){if(!Ud(n))return z(!0);const s=de(hl("Set",[Ke(de(r,"map"),[de("Hashing","Hash")])]),"size"),o=de(r,"length");return Gt(s,o)}function sx(e,t,n,r){if(!Ud(n))return!0;const s=new Set(r.map(sa)).size,o=r.length;return h(s,o)}function ox(e,t,n,r,s,o){if(!Ud(s))return!0;const i=new Set,a=o.reduce((d,m,p)=>{const g=sa(m);return i.has(g)?[...d,p]:(i.add(g),d)},[]);return h(a.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:r,params:{duplicateItems:a}})}function xo(e,t){return ri(e)&&(H(e.type)&&Yr(e.type.length,0)&&dt(e.type,0,n=>h(n,t))||h(e.type,t))}function T$(e){return xo(e,"object")}function A$(e){return tn(e)&&(ar(e)||Vo(e)||Wo(e)||Jo(e)||ds(e)||ls(e)||ni(e)||qs(e)||ei(e)||lr(e)||Gs(e))}function E$(e){return xo(e,"array")}function P$(e){return tn(e)&&(Go(e)||Nr(e)||is(e)||Xo(e)||Bs(e)||as(e)||cs(e)||cr(e)||Ks(e)||Ir(e))}function N$(e){return xo(e,"string")}function O$(e){return tn(e)&&(Hs(e)||Zo(e)||Us(e)||zs(e))}function $$(e){return xo(e,"number")||xo(e,"bigint")}function R$(e){return tn(e)&&(Or(e)||Yo(e)||Qo(e)||Pr(e)||ti(e))}function $n(e,t,n,r){return t.UseUnevaluated()?wt(wt(t.Push(),ot(e,t,n,r)),t.Pop()):ot(e,t,n,r)}function ot(e,t,n,r){e.Push(n);const s=[];if(Ko(n))return qh(e,t,n);if(ri(n)&&s.push(Wk(e,t,n,r)),A$(n)){const i=[];lr(n)&&i.push(qk(e,t,n,r)),ar(n)&&i.push(Rh(e,t,n,r)),Vo(n)&&i.push(Qh(e,t,n,r)),Wo(n)&&i.push(Zh(e,t,n,r)),Jo(n)&&i.push(nb(e,t,n,r)),ls(n)&&i.push(Ik(e,t,n,r)),ds(n)&&i.push(Nk(e,t,n,r)),ni(n)&&i.push(Rk(e,t,n,r)),qs(n)&&i.push(mk(e,t,n,r)),ei(n)&&i.push(nk(e,t,n,r));const a=It(i),l=qe(Nt(um(r)),a);s.push(T$(n)?a:l)}if(P$(n)){const i=[];Go(n)&&i.push(Ah(e,t,n,r)),is(n)&&i.push(Wh(e,t,n,r)),Nr(n)&&i.push(zb(e,t,n,r)),Xo(n)&&i.push(Wb(e,t,n,r)),Bs(n)&&i.push(Xb(e,t,n,r)),as(n)&&i.push(ok(e,t,n,r)),cs(n)&&i.push(lk(e,t,n,r)),cr(n)&&i.push(Tk(e,t,n,r)),Ir(n)&&i.push(rx(e,t,n,r));const a=It(i),l=qe(Nt(Ri(r)),a);s.push(E$(n)?a:l)}if(O$(n)){const i=[];Zo(n)&&i.push(ek(e,t,n,r)),Hs(n)&&i.push(uk(e,t,n,r)),Us(n)&&i.push(Lb(e,t,n,r)),zs(n)&&i.push(wk(e,t,n,r));const a=It(i),l=qe(Nt(mm(r)),a);s.push(N$(n)?a:l)}if(R$(n)){const i=[];Qo(n)&&i.push(ab(e,t,n,r)),Pr(n)&&i.push(lb(e,t,n,r)),Yo(n)&&i.push(Qb(e,t,n,r)),Or(n)&&i.push(ak(e,t,n,r)),ti(n)&&i.push(gk(e,t,n,r));const a=It(i),l=qe(Nt(qe(dm(r),lm(r))),a);s.push($$(n)?a:l)}Ea(n)&&s.push(Uk(e,t,n,r)),Aa(n)&&s.push(Dk(e,t,n,r)),Sa(n)&&s.push(pO(e,t,n,r)),ya(n)&&s.push(Kh(e,t,n,r)),va(n)&&s.push(ob(e,t,n,r)),Ia(n)&&s.push(Bb(e,t,n,r)),ja(n)&&s.push(bk(e,t,n,r)),ka(n)&&s.push(Dh(e,t,n,r)),xa(n)&&s.push(Uh(e,t,n,r)),Ta(n)&&s.push(xk(e,t,n,r)),Ks(n)&&s.push(qe(Nt(Ri(r)),Yk(e,t,n,r))),Gs(n)&&s.push(qe(Nt(fm(r)),ex(e,t,n,r))),ba(n)&&s.push(Ch(e,t,n,r));const o=It(s);return e.Pop(n),o}function $r(e,t,n,r){return t.Push()&&it(e,t,n,r)&&t.Pop()}function it(e,t,n,r){e.Push(n);const s=Ko(n)?hd(e,t,n):(!ri(n)||Jk(e,t,n,r))&&(!(ne(r)&&!H(r))||(!lr(n)||zk(e,t,n,r))&&(!ar(n)||Mh(e,t,n,r))&&(!Vo(n)||Yh(e,t,n,r))&&(!Wo(n)||eb(e,t,n,r))&&(!Jo(n)||rb(e,t,n,r))&&(!ls(n)||Ck(e,t,n,r))&&(!ds(n)||Ok(e,t,n,r))&&(!ni(n)||Mk(e,t,n,r))&&(!qs(n)||Rd(e,t,n,r))&&(!ei(n)||Ed(e,t,n,r)))&&(!H(r)||(!Go(n)||Eh(e,t,n,r))&&(!is(n)||kd(e,t,n,r))&&(!Nr(n)||Kb(e,t,n,r))&&(!Xo(n)||Cd(e,t,n,r))&&(!Bs(n)||Td(e,t,n,r))&&(!as(n)||Pd(e,t,n,r))&&(!cs(n)||Od(e,t,n,r))&&(!cr(n)||Ak(e,t,n,r))&&(!Ir(n)||sx(e,t,n,r)))&&(!ie(r)||(!Zo(n)||Ad(e,t,n,r))&&(!Hs(n)||$d(e,t,n,r))&&(!Us(n)||Id(e,t,n,r))&&(!zs(n)||Dd(e,t,n,r)))&&(!(ye(r)||tt(r))||(!Qo(n)||yd(e,t,n,r))&&(!Pr(n)||Sd(e,t,n,r))&&(!Yo(n)||jd(e,t,n,r))&&(!Or(n)||Nd(e,t,n,r))&&(!ti(n)||Md(e,t,n,r)))&&(!Ea(n)||Bk(e,t,n,r))&&(!Aa(n)||_k(e,t,n,r))&&(!Sa(n)||gO(e,t,n,r))&&(!ya(n)||bd(e,t,n,r))&&(!va(n)||xd(e,t,n,r))&&(!Ia(n)||Hb(e,t,n,r))&&(!ja(n)||Fd(e,t,n,r))&&(!ka(n)||_h(e,t,n,r))&&(!xa(n)||Bh(e,t,n,r))&&(!Ta(n)||yk(e,t,n,r))&&(!Ks(n)||!H(r)||Xk(e,t,n,r))&&(!Gs(n)||!ne(r)||tx(e,t,n,r))&&(!ba(n)||jh(e,t,n,r));return e.Pop(n),s}function Rr(e,t,n,r,s,o){return t.Push()&&Ct(e,t,n,r,s,o)&&t.Pop()}function Ct(e,t,n,r,s,o){e.Push(s);const i=Ko(s)?zh(e,t,n,r,s):!!(+(!ri(s)||Qk(e,t,n,r,s,o))&+(!(ne(o)&&!H(o))||!!(+(!lr(s)||Kk(e,t,n,r,s,o))&+(!ar(s)||Fh(e,t,n,r,s,o))&+(!Vo(s)||Xh(e,t,n,r,s,o))&+(!Wo(s)||tb(e,t,n,r,s,o))&+(!Jo(s)||sb(e,t,n,r,s,o))&+(!ls(s)||jk(e,t,n,r,s,o))&+(!ds(s)||$k(e,t,n,r,s,o))&+(!ni(s)||Fk(e,t,n,r,s,o))&+(!qs(s)||pk(e,t,n,r,s,o))&+(!ei(s)||rk(e,t,n,r,s,o))))&+(!H(o)||!!(+(!Go(s)||Ph(e,t,n,r,s,o))&+(!is(s)||Jh(e,t,n,r,s,o))&+(!Nr(s)||Gb(e,t,n,r,s,o))&+(!Xo(s)||Jb(e,t,n,r,s,o))&+(!Bs(s)||Zb(e,t,n,r,s,o))&+(!as(s)||ik(e,t,n,r,s,o))&+(!cs(s)||dk(e,t,n,r,s,o))&+(!cr(s)||Ek(e,t,n,r,s,o))&+(!Ir(s)||ox(e,t,n,r,s,o))))&+(!ie(o)||!!(+(!Zo(s)||tk(e,t,n,r,s,o))&+(!Hs(s)||fk(e,t,n,r,s,o))&+(!Us(s)||Ub(e,t,n,r,s,o))&+(!zs(s)||vk(e,t,n,r,s,o))))&+(!(ye(o)||tt(o))||!!(+(!Qo(s)||cb(e,t,n,r,s,o))&+(!Pr(s)||db(e,t,n,r,s,o))&+(!Yo(s)||Yb(e,t,n,r,s,o))&+(!Or(s)||ck(e,t,n,r,s,o))&+(!ti(s)||hk(e,t,n,r,s,o))))&+(!Ea(s)||Hk(e,t,n,r,s,o))&+(!Aa(s)||Lk(e,t,n,r,s,o))&+(!Sa(s)||hO(e,t,n,r,s,o))&+(!ya(s)||Gh(e,t,n,r,s,o))&+(!va(s)||ib(e,t,n,r,s,o))&+(!Ia(s)||qb(e,t,n,r,s,o))&+(!ja(s)||kk(e,t,n,r,s,o))&+(!ka(s)||Lh(e,t,n,r,s,o))&+(!xa(s)||Hh(e,t,n,r,s,o))&+(!Ta(s)||Sk(e,t,n,r,s,o))&+(!Ks(s)||!H(o)||Zk(e,t,n,r,s,o))&+(!Gs(s)||!ne(o)||nx(e,t,n,r,s,o)))&&(!ba(s)||Th(e,t,n,r,s,o));return e.Pop(s),i}const ix=[0],Ai=new Map,mo=new Map;function M$(){return`${ix[0]++}`}function F$(e,t){Ai.has(e)||Ai.set(e,new Map);const n=Ai.get(e);if(n.has(t))return n.get(t);const r=M$();return n.set(t,r),r}function D$(e,t,n,r){return e.UseUnevaluated()?Ke(`check_${n}`,["context",r]):Ke(`check_${n}`,[r])}function _$(e,t,n,r){const s=ot(e,t,n,"value");return t.UseUnevaluated()?Qn(`check_${r}`,xr(["context","value"],s)):Qn(`check_${r}`,xr(["value"],s))}function ax(){ix[0]=0,Ai.clear(),mo.clear()}function cx(){return[...mo.values()]}function Vs(e,t,n,r){const s=F$(n,e.BaseURL().href),o=D$(t,n,s,r);return mo.has(s)||(mo.set(s,""),mo.set(s,_$(e,t,n,s))),o}function lx(e){if(e.length===0)throw Error("Cannot set root")}function dx(e){if(!ne(e))throw Error("Cannot set value")}function L$(e){if(Jn(e))throw Error("Pointer contains unsafe property key")}function ux(e){for(const t of e)L$(t)}function U$(e){return/^(0|[1-9]\d*)$/.test(e)}function fx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function B$(e,t){return ne(t)&&E(t,e)}function H$(e,t){return ne(t)&&!Jn(e)?t[e]:void 0}function Bd(e,t){return e.reduce((n,r)=>H$(r,n),t)}function oi(e){if(h(e.length,0))return[];const t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function q$(e,t){let n=e;return oi(t).every(r=>B$(r,n)?(n=n[r],!0):!1)}function mx(e,t){const n=oi(t);return Bd(n,e)}function Fc(e,t,n){const r=oi(t);lx(r),ux(r);const[s,o]=fx(r),i=Bd(s,e);return dx(i),i[o]=n,e}function px(e,t){const n=oi(t);lx(n),ux(n);const[r,s]=fx(n),o=Bd(r,e);return dx(o),H(o)&&U$(s)?o.splice(+s,1):delete o[s],e}const gx=Object.freeze(Object.defineProperty({__proto__:null,Delete:px,Get:mx,Has:q$,Indices:oi,Set:Fc},Symbol.toStringTag,{value:"Module"}));function z$(e,t,n){if(e.$id===n.hash)return e;const r=new URL(e.$id,t.href),s=new URL(n.href,t.href);if(h(r.pathname,s.pathname))return n.hash.startsWith("#")?hx(e,t,n):e}function K$(e,t,n){const r=new URL(`#${e.$anchor}`,t.href),s=new URL(n.href,t.href);return h(r.href,s.href)?e:void 0}function G$(e,t,n){const r=new URL(`#${e.$dynamicAnchor}`,t.href),s=new URL(n.href,t.href);return h(r.href,s.href)?e:void 0}function hx(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;const r=decodeURIComponent(n.hash.slice(1));if(r.startsWith("/"))return mx(e,r)}function V$(e,t,n){if(vr(e)){const r=z$(e,t,n);if(!$e(r))return r}if(Hi(e)){const r=K$(e,t,n);if(!$e(r))return r}if(Jr(e)){const r=G$(e,t,n);if(!$e(r))return r}return hx(e,t,n)}function W$(e,t,n){return e.reduce((r,s)=>{const o=Hd(s,t,n);return $e(o)?r:o},void 0)}function J$(e,t,n){return D(e).reduce((r,s)=>{const o=Hd(e[s],t,n);return $e(o)?r:o},void 0)}function Hd(e,t,n){const r=tn(e)&&vr(e)?new URL(e.$id,t.href):t;if(tn(e)){const s=V$(e,r,n);if(!$e(s))return s}if(H(e))return W$(e,r,n);if(ne(e))return J$(e,r,n)}function Qr(e,t){const n=new URL("http://unknown/"),r=vr(e)?new URL(e.$id,n.href):n,s=new URL(t,r.href);return Hd(e,r,s)}function bx(e,t,n,r){const s=n.$dynamicRef.startsWith("#")?Qr(t,n.$dynamicRef):Qr(e,n.$dynamicRef);return $e(s)?void 0:!tn(s)||!Jr(s)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?s:r.find(a=>a.$dynamicAnchor===s.$dynamicAnchor)??s}const Q$=Object.freeze(Object.defineProperty({__proto__:null,DynamicRef:bx,Ref:Qr},Symbol.toStringTag,{value:"Module"}));var Cs=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},gr,kx,xx,yx,Sx;class ii{constructor(t,n){gr.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){tn(t)&&(vr(t)&&(this.ids.push(t),Cs(this,gr,"m",kx).call(this,t)),Hi(t)&&this.anchors.push(t),ji(t)&&this.recursiveAnchors.push(t),Jr(t)&&this.dynamicAnchors.push(t))}Pop(t){tn(t)&&(vr(t)&&(this.ids.pop(),Cs(this,gr,"m",xx).call(this,t)),Hi(t)&&this.anchors.pop(),ji(t)&&this.recursiveAnchors.pop(),Jr(t)&&this.dynamicAnchors.pop())}Ref(t){return Cs(this,gr,"m",yx).call(this,t)??Cs(this,gr,"m",Sx).call(this,t)}RecursiveRef(t){return ji(this.Base())?Qr(this.recursiveAnchors[0],t.$recursiveRef):Qr(this.Base(),t.$recursiveRef)}DynamicRef(t){const n=this.schema;return bx(n,this.Base(),t,this.dynamicAnchors)}}gr=new WeakSet,kx=function e(t,n=!0){if(!tn(t))return;const r=t;if(!(!n&&vr(r))){!n&&Jr(r)&&this.dynamicAnchors.push(r);for(const s of D(r))Cs(this,gr,"m",e).call(this,r[s],!1)}},xx=function e(t,n=!0){if(!tn(t))return;const r=t;if(!(!n&&vr(r))){!n&&Jr(r)&&this.dynamicAnchors.pop();for(const s of D(r))Cs(this,gr,"m",e).call(this,r[s],!1)}},yx=function(t){return E(this.context,t.$ref)?this.context[t.$ref]:void 0},Sx=function(t){const n=this.schema;return t.$ref.startsWith("#")?Qr(this.Base(),t.$ref):Qr(n,t.$ref)};function Y$(e){const t=e.Functions().join(`;
|
|
9
|
+
`),n=e.UseUnevaluated()?["const context = new CheckContext({}, {})",`return ${e.Entry()}`]:[`return ${e.Entry()}`];return`${t}; return (value) => { ${n.join("; ")} }`}function X$(e,t){return jm("CheckContext","Guard","Format","Hashing",e.External().identifier,t)(Bn,$i,i$,Kw,e.External().variables)}function Z$(e){const t=new ii(e.Context(),e.Schema()),n=new Bn;return r=>it(t,n,e.Schema(),r)}function eR(e,t){return Cm()?X$(e,t):Z$(e)}class wx{constructor(t,n,r){this.isAccelerated=t,this.code=n,this.check=r}IsAccelerated(){return this.isAccelerated}Code(){return this.code}Check(t){return this.check(t)}}class vx{constructor(t,n,r,s,o,i){this.context=t,this.schema=n,this.external=r,this.functions=s,this.entry=o,this.useUnevaluated=i}Context(){return this.context}Schema(){return this.schema}UseUnevaluated(){return this.useUnevaluated}External(){return this.external}Functions(){return this.functions}Entry(){return this.entry}Evaluate(){const t=Y$(this),n=eR(this,t);return new wx(Cm(),t,n)}}function Ix(...e){const[t,n]=ct(e,{2:(l,d)=>[l,d],1:l=>[{},l]});vh(),ax();const r=new ii(t,n),s=new wh(Sh(t,n)),o=Vs(r,s,n,"value"),i=cx(),a=Ih();return new vx(t,n,a,i,o,s.UseUnevaluated())}function yo(...e){const[t,n,r]=ct(e,{3:(m,p,g)=>[m,p,g],2:(m,p)=>[{},m,p]}),s=Ao(),o=Ww(),i=[],a=new ii(t,n),l=new md(m=>{if(!Ns(i.length,s.maxErrors))return i.push({...m,message:o(m)})});return[Ct(a,l,"#","",n,r),i]}function qd(...e){const[t,n,r]=ct(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),s=new ii(t,n),o=new Bn;return it(s,o,n,r)}let zd=class{constructor(t,n,r){this.schema=t,this.value=n,this.errors=r}};function tR(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});if(!qd(t,n,r)){const[s,o]=yo(t,n,r);throw new zd(n,r,o)}return r}class Cx{constructor(t,n){this.buildResult=Ix(t,n),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Schema(){return this.buildResult.Schema()}Check(t){return this.evaluateResult.Check(t)}Parse(t){if(this.evaluateResult.Check(t))return t;const[n,r]=yo(this.buildResult.Context(),this.buildResult.Schema(),t);throw new zd(this.buildResult.Schema(),t,r)}Errors(t){return yo(this.buildResult.Context(),this.buildResult.Schema(),t)}}function nR(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return new Cx(t,n)}const rR=Object.freeze(Object.defineProperty({__proto__:null,AccumulatedErrorContext:Hn,Build:Ix,BuildAdditionalItems:Ah,BuildAdditionalProperties:Rh,BuildAdditionalPropertiesFast:Oh,BuildAdditionalPropertiesStandard:$h,BuildAllOf:Dh,BuildAnyOf:Uh,BuildConst:Kh,BuildContains:Wh,BuildContext:wh,BuildDependencies:Qh,BuildDependentRequired:Zh,BuildDependentSchemas:nb,BuildEnum:ob,BuildExclusiveMaximum:ab,BuildExclusiveMinimum:lb,BuildFormat:Lb,BuildIf:Bb,BuildItems:zb,BuildMaxContains:Wb,BuildMaxItems:Xb,BuildMaxLength:ek,BuildMaxProperties:nk,BuildMaximum:Qb,BuildMinContains:ok,BuildMinItems:lk,BuildMinLength:uk,BuildMinProperties:mk,BuildMinimum:ak,BuildMultipleOf:gk,BuildNot:bk,BuildOneOf:xk,BuildPattern:wk,BuildPatternProperties:Ik,BuildPrefixItems:Tk,BuildProperties:Nk,BuildPropertyNames:Rk,BuildRecursiveRef:Dk,BuildRef:Uk,BuildRefine:Ch,BuildRequired:qk,BuildResult:vx,BuildSchema:ot,BuildSchemaBoolean:qh,BuildSchemaPushStack:$n,BuildType:Wk,BuildUnevaluatedItems:Yk,BuildUnevaluatedProperties:ex,BuildUniqueItems:rx,CanAdditionalPropertiesFast:Nh,Check:qd,CheckAdditionalItems:Eh,CheckAdditionalProperties:Mh,CheckAllOf:_h,CheckAnyOf:Bh,CheckConst:bd,CheckContains:kd,CheckContext:Bn,CheckDependencies:Yh,CheckDependentRequired:eb,CheckDependentSchemas:rb,CheckEnum:xd,CheckExclusiveMaximum:yd,CheckExclusiveMinimum:Sd,CheckFormat:Id,CheckIf:Hb,CheckItems:Kb,CheckMaxContains:Cd,CheckMaxItems:Td,CheckMaxLength:Ad,CheckMaxProperties:Ed,CheckMaximum:jd,CheckMinContains:Pd,CheckMinItems:Od,CheckMinLength:$d,CheckMinProperties:Rd,CheckMinimum:Nd,CheckMultipleOf:Md,CheckNot:Fd,CheckOneOf:yk,CheckPattern:Dd,CheckPatternProperties:Ck,CheckPrefixItems:Ak,CheckProperties:Ok,CheckPropertyNames:Mk,CheckRecursiveRef:_k,CheckRef:Bk,CheckRefine:jh,CheckRequired:zk,CheckSchema:it,CheckSchemaBoolean:hd,CheckSchemaPushStack:$r,CheckType:Jk,CheckUnevaluatedItems:Xk,CheckUnevaluatedProperties:tx,CheckUniqueItems:sx,Compile:nR,CreateFunction:Vs,CreateVariable:us,ErrorAdditionalItems:Ph,ErrorAdditionalProperties:Fh,ErrorAllOf:Lh,ErrorAnyOf:Hh,ErrorConst:Gh,ErrorContains:Jh,ErrorContext:md,ErrorDependencies:Xh,ErrorDependentRequired:tb,ErrorDependentSchemas:sb,ErrorEnum:ib,ErrorExclusiveMaximum:cb,ErrorExclusiveMinimum:db,ErrorFormat:Ub,ErrorIf:qb,ErrorItems:Gb,ErrorMaxContains:Jb,ErrorMaxItems:Zb,ErrorMaxLength:tk,ErrorMaxProperties:rk,ErrorMaximum:Yb,ErrorMinContains:ik,ErrorMinItems:dk,ErrorMinLength:fk,ErrorMinProperties:pk,ErrorMinimum:ck,ErrorMultipleOf:hk,ErrorNot:kk,ErrorOneOf:Sk,ErrorPattern:vk,ErrorPatternProperties:jk,ErrorPrefixItems:Ek,ErrorProperties:$k,ErrorPropertyNames:Fk,ErrorRecursiveRef:Lk,ErrorRef:Hk,ErrorRefine:Th,ErrorRequired:Kk,ErrorSchema:Ct,ErrorSchemaBoolean:zh,ErrorSchemaPushStack:Rr,ErrorType:Qk,ErrorUnevaluatedItems:Zk,ErrorUnevaluatedProperties:nx,ErrorUniqueItems:ox,Errors:yo,EvaluateResult:wx,GetExternal:Ih,GetFunctions:cx,HasUnevaluated:Sh,IsAdditionalItems:Go,IsAdditionalProperties:ar,IsAllOf:ka,IsAnchor:Hi,IsAnyOf:xa,IsConst:ya,IsContains:is,IsContentEncoding:XN,IsContentMediaType:ZN,IsDefault:Er,IsDefs:eO,IsDependencies:Vo,IsDependentRequired:Wo,IsDependentSchemas:Jo,IsDynamicAnchor:Jr,IsDynamicRef:Sa,IsElse:wa,IsEnum:va,IsExclusiveMaximum:Qo,IsExclusiveMinimum:Pr,IsFormat:Us,IsId:vr,IsIf:Ia,IsItems:Nr,IsItemsSized:Ca,IsItemsUnsized:tO,IsMaxContains:Xo,IsMaxItems:Bs,IsMaxLength:Zo,IsMaxProperties:ei,IsMaximum:Yo,IsMinContains:as,IsMinItems:cs,IsMinLength:Hs,IsMinProperties:qs,IsMinimum:Or,IsMultipleOf:ti,IsNot:ja,IsOneOf:Ta,IsPattern:zs,IsPatternProperties:ls,IsPrefixItems:cr,IsProperties:ds,IsPropertyNames:ni,IsRecursiveAnchor:yh,IsRecursiveAnchorTrue:ji,IsRecursiveRef:Aa,IsRef:Ea,IsRefine:ba,IsRequired:lr,IsSchema:_e,IsSchemaBoolean:Ko,IsSchemaObject:tn,IsThen:Pa,IsType:ri,IsUnevaluatedItems:Ks,IsUnevaluatedProperties:Gs,IsUniqueItems:Ir,Parse:tR,ParseError:zd,Pointer:gx,Reducer:si,ResetExternal:vh,ResetFunctions:ax,Resolve:Q$,Stack:ii,Validator:Cx},Symbol.toStringTag,{value:"Module"}));function rt(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return qd(t,n,r)}function ai(...e){const[t,n,r]=ct(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),[s,o]=yo(t,n,r);return o}class Na extends Error{constructor(t,n,r){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:r,value:n},writable:!1,configurable:!1,enumerable:!1})}}function jx(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(!rt(t,n,r))throw new Na("Assert",r,ai(t,n,r))}function sR(e,t,n){return H(n)?n.map(r=>Tn(e,t.items,r)):n}function oR(e,t,n){return Tn({...e,...t.$defs},dn(t.$ref),n)}function iR(e,t){const n=E(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},r=Ls(e,t),s=Un(r);return Le(s)?gh(s,n):s}function aR(e,t,n){const r=iR(e,t);return Tn(e,r,n)}function Tx(e){return E(e,"additionalProperties")?e.additionalProperties:void 0}function cR(e,t,n){if(!ne(n)||H(n))return n;const r=Tx(t);for(const s of D(n)){if(E(t.properties,s)){n[s]=Tn(e,t.properties[s],n[s]);continue}if(ht(r)&&h(r,!0)||Yt(r)&&rt(e,r,n[s])){n[s]=Tn(e,r,n[s]);continue}delete n[s]}return n}function lR(e,t,n){if(!ne(n))return n;const r=Tx(t),[s,o]=[new RegExp(kn(t)),qt(t)];for(const i of D(n)){if(s.test(i)){n[i]=Tn(e,o,n[i]);continue}if(ht(r)&&h(r,!0)||Yt(r)&&rt(e,r,n[i])){n[i]=Tn(e,r,n[i]);continue}delete n[i]}return n}function dR(e,t,n){return E(e,t.$ref)?Tn(e,e[t.$ref],n):n}function uR(e,t,n){if(!H(n))return n;const r=Math.min(n.length,t.items.length);for(let s=0;s<r;s++)n[s]=Tn(e,t.items[s],n[s]);return Yr(n.length,r)?n.slice(0,r):n}function Ut(e){return kl(e)}function fR(e,t,n){for(const r of t.anyOf){const s=Tn(e,r,Ut(n));if(rt(e,r,s))return s}return n}function Tn(e,t,n){return ut(t)?sR(e,t,n):Ht(t)?oR(e,t,n):Ue(t)?aR(e,t,n):Le(t)?cR(e,t,n):At(t)?lR(e,t,n):kt(t)?dR(e,t,n):st(t)?uR(e,t,n):ae(t)?fR(e,t,n):n}function mR(e,t){for(const n of $i.Keys(e))$i.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function pR(e){const t={};for(const n of $i.Keys(e))t[n]=So(e[n]);return t}function gR(e){return Dc(QN(e))}function Dc(e){return e.map(t=>So(t))}function So(e){const t=ut(e)?Cr(So(e.items),Sl(e)):Ue(e)?Fn(Dc(e.allOf)):ae(e)?Ve(gR(e.anyOf)):Le(e)?Ae(pR(e.properties)):At(e)?Pl(la(e),So(qt(e))):st(e)?bn(Dc(e.items)):e;return mR(e,t)}function Kd(e){return So(e)}function ci(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=Kd(n);return Tn(t,s,r)}function sn(e){return ne(e)&&E(e,"value")}function te(e){return{value:e}}function hR(e){return H(e)?te(e):te([e])}function bR(e){return h(e,!0)?te(BigInt(1)):te(BigInt(0))}const kR=/^-?(0|[1-9]\d*)n$/,xR=/^-?(0|[1-9]\d*)\.\d+$/,yR=/^-?(0|[1-9]\d*)$/;function SR(e){return kR.test(e)}function wR(e){return xR.test(e)}function vR(e){return yR.test(e)}function IR(e){const t=e.toLowerCase();return SR(e)?te(BigInt(e.slice(0,e.length-1))):wR(e)?te(BigInt(e.split(".")[0])):vR(e)?te(BigInt(e)):h(t,"false")?te(BigInt(0)):h(t,"true")?te(BigInt(1)):void 0}function Gd(e){return tt(e)?te(e):ht(e)?bR(e):ye(e)?te(BigInt(Math.trunc(e))):Vt(e)?te(BigInt(0)):ie(e)?IR(e):$e(e)?te(BigInt(0)):void 0}function CR(e){return h(e,BigInt(0))?te(!1):h(e,BigInt(1))?te(!0):void 0}function jR(e){return h(e,0)?te(!1):h(e,1)?te(!0):void 0}function TR(e){return h(e.toLowerCase(),"false")?te(!1):h(e.toLowerCase(),"true")?te(!0):h(e,"0")?te(!1):h(e,"1")?te(!0):void 0}function Ax(e){return tt(e)?CR(e):ht(e)?te(e):ye(e)?jR(e):Vt(e)?te(!1):ie(e)?TR(e):$e(e)?te(!1):void 0}function AR(e){return h(e,BigInt(0))?te(null):void 0}function ER(e){return h(e,!1)?te(null):void 0}function PR(e){return h(e,0)?te(null):void 0}function NR(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?te(null):void 0}function OR(e){return tt(e)?AR(e):ht(e)?ER(e):ye(e)?PR(e):Vt(e)?te(null):ie(e)?NR(e):$e(e)?te(null):void 0}const Ex=BigInt(Number.MAX_SAFE_INTEGER),Px=BigInt(Number.MIN_SAFE_INTEGER);function $R(e){return e<=Ex&&e>=Px?te(Number(e)):void 0}function RR(e){return te(e?1:0)}function MR(e){const t=+e;if(ye(t))return te(t);const n=e.toLowerCase();if(h(n,"false"))return te(0);if(h(n,"true"))return te(1);const r=Gd(e);return sn(r)&&r.value<=Ex&&r.value>=Px?te(Number(r.value)):void 0}function Vd(e){return tt(e)?$R(e):ht(e)?RR(e):ye(e)?te(e):Vt(e)?te(0):ie(e)?MR(e):$e(e)?te(0):void 0}function Nx(e){return tt(e)||ht(e)||ye(e)?te(e.toString()):Vt(e)?te("null"):ie(e)?te(e):$e(e)?te(""):void 0}function FR(e){return h(e,BigInt(0))?te(void 0):void 0}function DR(e){return h(e,!1)?te(void 0):void 0}function _R(e){return h(e,0)?te(void 0):void 0}function LR(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?te(void 0):void 0}function Ox(e){return tt(e)?FR(e):ht(e)?DR(e):ye(e)?_R(e):Vt(e)?te(void 0):ie(e)?LR(e):$e(e)?te(e):void 0}function UR(e,t,n){return hR(n).value.map(s=>xn(e,t.items,s))}function BR(e,t,n){const r=Gd(n);return sn(r)?r.value:n}function HR(e,t,n){const r=Ax(n);return sn(r)?r.value:n}function qR(e,t,n){return xn({...e,...t.$defs},dn(t.$ref),n)}function zR(e,t,n){return xn(e,Un(t),n)}function KR(e,t,n){const r=Vd(n);return sn(r)?Math.trunc(r.value):n}function GR(e,t,n){const r=Ls(e,t),s=Un(r);return xn(e,s,n)}function VR(e,t,n){const r=Gd(n);return sn(r)&&h(t.const,r.value)?r.value:n}function WR(e,t,n){const r=Ax(n);return sn(r)&&h(t.const,r.value)?r.value:n}function JR(e,t,n){const r=Vd(n);return sn(r)&&h(t.const,r.value)?r.value:n}function QR(e,t,n){const r=Nx(n);return sn(r)&&h(t.const,r.value)?r.value:n}function YR(e,t,n){return h(t.const,n)?n:iv(t)?VR(e,t,n):av(t)?WR(e,t,n):Fm(t)?JR(e,t,n):Dm(t)?QR(e,t,n):Ot()}function XR(e,t,n){const r=OR(n);return sn(r)?r.value:n}function ZR(e,t,n){const r=Vd(n);return sn(r)?r.value:n}function $x(e,t,n,r){const s=D(r);for(const[o,i]of t)for(const a of s)o.test(a)||(r[a]=xn(e,n,r[a]));return r}function Wd(e,t,n){return Xt(e)&&$e(n[t])}function eM(e,t,n){const r=fl(t.properties),s=D(n);for(const[o,i]of r)for(const a of s)!o.test(a)||Wd(i,a,n)||(n[a]=xn(e,i,n[a]));return E(t,"additionalProperties")&&ne(t.additionalProperties)?$x(e,r,t.additionalProperties,n):n}function tM(e,t,n){return fn(n)?eM(e,t,n):n}function nM(e,t,n){const r=fl(t.patternProperties),s=D(n);for(const[o,i]of r)for(const a of s)o.test(a)&&(n[a]=xn(e,i,n[a]));return E(t,"additionalProperties")&&ne(t.additionalProperties)?$x(e,r,t.additionalProperties,n):n}function rM(e,t,n){return fn(n)?nM(e,t,n):n}function sM(e,t,n){return E(e,t.$ref)?xn(e,e[t.$ref],n):n}function oM(e,t,n){const r=Nx(n);return sn(r)?r.value:n}function iM(e,t,n){return xn(e,Un(t),n)}function aM(e,t,n){if(!H(n))return n;for(let r=0;r<Math.min(t.items.length,n.length);r++)n[r]=xn(e,t.items[r],n[r]);return n}function cM(e,t,n){const r=Ox(n);return sn(r)?r.value:n}function lM(e,t,n){if(t.anyOf.some(i=>rt(e,i,n)))return n;const o=t.anyOf.map(i=>xn(e,i,Ut(n))).find(i=>rt(e,t,i));return $e(o)?n:o}function dM(e,t,n){const r=Ox(n);return sn(r)?void 0:n}function xn(e,t,n){return ut(t)?UR(e,t,n):ts(t)?BR(e,t,n):jr(t)?HR(e,t,n):Ht(t)?qR(e,t,n):hn(t)?zR(e,t,n):_n(t)?KR(e,t,n):Ue(t)?GR(e,t,n):We(t)?YR(e,t,n):$o(t)?XR(e,t,n):nn(t)?ZR(e,t,n):Le(t)?tM(e,t,n):At(t)?rM(e,t,n):kt(t)?sM(e,t,n):On(t)?oM(e,t,n):zt(t)?iM(e,t,n):st(t)?aM(e,t,n):Ds(t)?cM(e,t,n):ae(t)?lM(e,t,n):ns(t)?dM(e,t,n):n}function Oa(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return xn(t,n,r)}function uM(e,t,n){if(!H(n))return n;for(let r=0;r<n.length;r++)n[r]=An(e,t.items,n[r]);return n}function fM(e,t,n){return An({...e,...t.$defs},dn(t.$ref),n)}function mM(e,t){return $e(t)?In(e.default)?e.default():Ut(e.default):t}function pM(e,t,n){const r=Ls(e,t),s=Un(r);return An(e,s,n)}function gM(e,t,n){if(!ne(n))return n;const r=D(t.properties);for(const s of r){const o=An(e,t.properties[s],n[s]);$e(o)&&(Xt(t.properties[s])||!E(t.properties[s],"default"))||(n[s]=o)}if(!ar(t)||ht(t.additionalProperties))return n;for(const s of D(n))r.includes(s)||(n[s]=An(e,t.additionalProperties,n[s]));return n}function hM(e,t,n){if(!ne(n))return n;const[r,s]=[new RegExp(kn(t)),qt(t)];for(const o of D(n))r.test(o)&&Er(s)&&(n[o]=An(e,s,n[o]));if(!ar(t))return n;for(const o of D(n))r.test(o)||(n[o]=An(e,t.additionalProperties,n[o]));return n}function bM(e,t,n){return E(e,t.$ref)?An(e,e[t.$ref],n):n}function kM(e,t,n){if(!H(n))return n;const[r,s]=[t.items,Math.max(t.items.length,n.length)];for(let o=0;o<s;o++)o<r.length&&(n[o]=An(e,r[o],n[o]));return n}function xM(e,t,n){for(const r of t.anyOf){const s=An(e,r,Ut(n));if(rt(e,r,s))return s}return n}function An(e,t,n){const r=Er(t)?mM(t,n):n;return ut(t)?uM(e,t,r):Ht(t)?fM(e,t,r):Ue(t)?pM(e,t,r):Le(t)?gM(e,t,r):At(t)?hM(e,t,r):kt(t)?bM(e,t,r):st(t)?kM(e,t,r):ae(t)?xM(e,t,r):r}function Jd(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return An(t,n,r)}function Rx(e){return(...t)=>{const[n,r,s]=ct(t,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return e.reduce((o,i)=>i(n,r,o),s)}}function yM(e,t,n){return t["~codec"].decode(n)}function SM(e,t,n){return t["~codec"].encode(n)}function vt(e,t,n,r){return en(n)?h(e,"Decode")?yM(t,n,r):SM(t,n,r):r}function wM(e,t,n,r){if(!H(r))return r;for(let s=0;s<r.length;s++)r[s]=Dt(e,t,n.items,r[s]);return vt(e,t,n,r)}function vM(e,t,n,r){const s=vt(e,t,n,r);if(!H(s))return s;for(let o=0;o<s.length;o++)s[o]=Dt(e,t,n.items,s[o]);return s}function IM(e,t,n,r){return h(e,"Decode")?wM(e,t,n,r):vM(e,t,n,r)}function CM(e,t,n,r){return r=Dt(e,{...t,...n.$defs},dn(n.$ref),r),vt(e,t,n,r)}function Mx(e){return e.reduce((t,n)=>({...t,...n}),{})}function Fx(e,t){for(const n of t)if(!Xr(e,n))return n;return e}function jM(e,t,n,r){if(h(n.allOf.length,0))return vt(e,t,n,r);const s=n.allOf.map(a=>Dt(e,t,a,ci(a,Ut(r)))),i=s.every(a=>ne(a))?Mx(s):Fx(r,s);return vt(e,t,n,i)}function TM(e,t,n,r){if(h(n.allOf.length,0))return vt(e,t,n,r);const s=vt(e,t,n,r),o=n.allOf.map(a=>Dt(e,t,a,ci(a,Ut(s))));return o.every(a=>ne(a))?Mx(o):Fx(s,o)}function AM(e,t,n,r){return h(e,"Decode")?jM(e,t,n,r):TM(e,t,n,r)}function EM(e,t,n,r){if(!fn(r))return r;for(const s of D(n.properties))!E(r,s)||Wd(n.properties[s],s,r)||(r[s]=Dt(e,t,n.properties[s],r[s]));return vt(e,t,n,r)}function PM(e,t,n,r){const s=vt(e,t,n,r);if(!fn(s))return s;for(const o of D(n.properties))!E(s,o)||Wd(n.properties[o],o,s)||(s[o]=Dt(e,t,n.properties[o],s[o]));return s}function NM(e,t,n,r){return h(e,"Decode")?EM(e,t,n,r):PM(e,t,n,r)}function OM(e,t,n,r){if(!fn(r))return r;const s=new RegExp(kn(n));for(const o of D(r))s.test(o)&&(r[o]=Dt(e,t,qt(n),r[o]));return vt(e,t,n,r)}function $M(e,t,n,r){const s=vt(e,t,n,r);if(!fn(s))return s;const o=new RegExp(kn(n));for(const i of D(s))o.test(i)&&(s[i]=Dt(e,t,qt(n),s[i]));return s}function RM(e,t,n,r){return h(e,"Decode")?OM(e,t,n,r):$M(e,t,n,r)}function ef(e,t,n,r){return E(t,n.$ref)?Dt(e,t,t[n.$ref],r):r}function MM(e,t,n,r){return h(e,"Decode")?vt(e,t,n,ef(e,t,n,r)):ef(e,t,n,vt(e,t,n,r))}function FM(e,t,n,r){if(!H(r))return r;for(let s=0;s<Math.min(n.items.length,r.length);s++)r[s]=Dt(e,t,n.items[s],r[s]);return vt(e,t,n,r)}function DM(e,t,n,r){const s=vt(e,t,n,r);if(!H(s))return r;for(let o=0;o<Math.min(n.items.length,s.length);o++)s[o]=Dt(e,t,n.items[o],s[o]);return s}function _M(e,t,n,r){return h(e,"Decode")?FM(e,t,n,r):DM(e,t,n,r)}function LM(e,t,n,r){for(const s of n.anyOf){if(!rt(t,s,r))continue;const o=Dt(e,t,s,r);return vt(e,t,n,o)}return r}function UM(e,t,n,r){const s=vt(e,t,n,r);for(const o of n.anyOf){const i=Dt(e,t,o,Ut(s));if(rt(t,o,i))return i}return s}function BM(e,t,n,r){return h(e,"Decode")?LM(e,t,n,r):UM(e,t,n,r)}function Dt(e,t,n,r){return ut(n)?IM(e,t,n,r):Ht(n)?CM(e,t,n,r):Ue(n)?AM(e,t,n,r):Le(n)?NM(e,t,n,r):At(n)?RM(e,t,n,r):kt(n)?MM(e,t,n,r):st(n)?_M(e,t,n,r):ae(n)?BM(e,t,n,r):vt(e,t,n,r)}class HM extends Na{constructor(t,n){super("Decode",t,n)}}function qM(e,t,n){if(!rt(e,t,n))throw new HM(n,ai(e,t,n));return n}function zM(e,t,n){const r=Kd(t);return Dt("Decode",e,r,n)}const KM=Rx([(e,t,n)=>Ut(n),(e,t,n)=>Jd(e,t,n),(e,t,n)=>Oa(e,t,n),(e,t,n)=>ci(e,t,n),(e,t,n)=>qM(e,t,n),(e,t,n)=>zM(e,t,n)]);function GM(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return KM(t,n,r)}class VM extends Na{constructor(t,n){super("Encode",t,n)}}function WM(e,t,n){if(!rt(e,t,n))throw new VM(n,ai(e,t,n));return n}function JM(e,t,n){const r=Kd(t);return Dt("Encode",e,r,n)}const QM=Rx([(e,t,n)=>Ut(n),(e,t,n)=>JM(e,t,n),(e,t,n)=>Jd(e,t,n),(e,t,n)=>Oa(e,t,n),(e,t,n)=>ci(e,t,n),(e,t,n)=>WM(e,t,n)]);function YM(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return QM(t,n,r)}function XM(e,t){return en(t)||Mr(e,t.items)}function ZM(e,t){return en(t)||Dx({...e,...t.$defs},dn(t.$ref))}function eF(e,t){return en(t)||t.allOf.some(n=>Mr(e,n))}function tF(e,t){return en(t)||D(t.properties).some(n=>Mr(e,t.properties[n]))}function nF(e,t){return en(t)||Mr(e,qt(t))}function Dx(e,t){return _c.has(t.$ref)?!1:(_c.add(t.$ref),en(t)||E(e,t.$ref)&&Mr(e,e[t.$ref]))}function rF(e,t){return en(t)||t.items.some(n=>Mr(e,n))}function sF(e,t){return en(t)||t.anyOf.some(n=>Mr(e,n))}function Mr(e,t){return ut(t)?XM(e,t):Ht(t)?ZM(e,t):Ue(t)?eF(e,t):Le(t)?tF(e,t):At(t)?nF(e,t):kt(t)?Dx(e,t):st(t)?rF(e,t):ae(t)?sF(e,t):en(t)}const _c=new Set;function oF(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return _c.clear(),Mr(t,n)}class li extends Error{constructor(t,n){super(n),this.type=t}}function iF(e,t){return In(t.default)?t.default(t):ne(t.default)?Ut(t.default):t.default}function aF(e,t){if(Ir(t)&&!Er(t))throw new li(t,"Arrays with uniqueItems constraints must specify a default annotation");const n=cs(t)?t.minItems:0;return Array.from({length:n},()=>yn(e,t.items))}function cF(e,t){return Pr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Or(t)?BigInt(t.minimum):BigInt(0)}function lF(e,t){return!1}function dF(e,t){const n=yn(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function uF(e,t){return yn({...e,...t.$defs},dn(t.$ref))}function fF(e,t){return yn(e,Un(t))}function mF(e,t){const n=yn(e,t.returnType);return()=>n}function pF(e,t){return Pr(t)&&ye(t.exclusiveMinimum)?t.exclusiveMinimum+1:Or(t)?t.minimum:0}function gF(e,t){const n=Ls(e,t),r=Un(n);return yn(e,r)}function hF(e,t){return t.const}function bF(e,t){throw new li(t,"Cannot create TNever types")}function kF(e,t){return null}function xF(e,t){return Pr(t)&&ye(t.exclusiveMinimum)?t.exclusiveMinimum+1:Or(t)?t.minimum:0}function yF(e,t){return($e(t.required)?[]:t.required).reduce((r,s)=>({...r,[s]:yn(e,t.properties[s])}),{})}function SF(e,t){if(qs(t)&&!Er(t))throw new li(t,"Record with the minProperties constraint must have a default annotation");return{}}function wF(e,t){return E(e,t.$ref)?yn(e,e[t.$ref]):(()=>{throw new li(t,"Unable to deref Ref")})()}function vF(e,t){if((zs(t)||Us(t))&&!Er(t))throw Error("Strings with format or pattern constraints must specify default");const r=Hs(t)?t.minLength:0;return"".padEnd(r)}function IF(e,t){return Symbol()}function CF(e,t){const n=El(t.pattern);if(On(n))throw new li(t,"Unable to create TemplateLiteral due to infinite type expansion");return yn(e,n)}function jF(e,t){return Array.from({length:t.minItems},(n,r)=>yn(e,t.items[r]))}function TF(e,t){if(h(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return yn(e,t.anyOf[0])}function yn(e,t){return Er(t)?iF(e,t):ut(t)?aF(e,t):ts(t)?cF(e,t):jr(t)?lF():mn(t)?dF(e,t):Ht(t)?uF(e,t):hn(t)?fF(e,t):pn(t)?mF(e,t):_n(t)?pF(e,t):Ue(t)?gF(e,t):We(t)?hF(e,t):Rs(t)?bF(e,t):$o(t)?kF():nn(t)?xF(e,t):Le(t)?yF(e,t):At(t)?SF(e,t):kt(t)?wF(e,t):On(t)?vF(e,t):Ro(t)?IF():zt(t)?CF(e,t):st(t)?jF(e,t):Ds(t)?void 0:ae(t)?TF(e,t):ns(t)?void 0:void 0}function En(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return yn(t,n)}function _x(e,t){return Xr(e,t)}function Lx(e){return sa(e)}class AF extends Na{constructor(t,n){super("Parse",t,n)}}function EF(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(rt(t,n,r))return r;throw new AF(r,ai(t,n,r))}function $a(e,t){return{type:"update",path:e,value:t}}function Ux(e,t){return{type:"insert",path:e,value:t}}function Bx(e){return{type:"delete",path:e}}function tf(e){if(!(ne(e)&&h(ml(e).length,0)))throw new Error("Cannot create diffs for objects with symbols keys")}function*PF(e,t,n){if(!ne(n)||H(n))return yield $a(e,n);tf(t),tf(n);const r=D(t),s=D(n);for(const o of s)E(t,o)||Jn(o)||(yield Ux(`${e}/${o}`,n[o]));for(const o of r)E(n,o)&&(Jn(o)||_x(t,n)||(yield*Ra(`${e}/${o}`,t[o],n[o])));for(const o of r)E(n,o)||Jn(o)||(yield Bx(`${e}/${o}`))}function*NF(e,t,n){if(!H(n))return yield $a(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*Ra(`${e}/${r}`,t[r],n[r]);for(let r=0;r<n.length;r++)r<t.length||(yield Ux(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield Bx(`${e}/${r}`))}function*OF(e,t,n){const r=globalThis.Object.getPrototypeOf(t).constructor.name,s=globalThis.Object.getPrototypeOf(n).constructor.name;if(To(n)&&h(t.length,n.length)&&h(r,s))for(let i=0;i<Math.min(t.length,n.length);i++)yield*Ra(`${e}/${i}`,t[i],n[i]);else return yield $a(e,n)}function*$F(e,t,n){t!==n&&(yield $a(e,n))}function*Ra(e,t,n){return To(t)?yield*OF(e,t,n):H(t)?yield*NF(e,t,n):ne(t)?yield*PF(e,t,n):yield*$F(e,t,n)}function RF(e,t){return[...Ra("",e,t)]}const MF=Ae({type:Me("insert"),path:Ln(),value:Bt()}),FF=Object({type:Me("update"),path:Ln(),value:Bt()}),DF=Ae({type:Me("delete"),path:Ln()});Ve([MF,FF,DF]);function _F(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function LF(e){return e.length===0}function UF(e,t){if(_F(t))return Ut(t[0].value);if(LF(t))return Ut(e);const n=Ut(e);for(const r of t)switch(r.type){case"insert":{Fc(n,r.path,r.value);break}case"update":{Fc(n,r.path,r.value);break}case"delete":{px(n,r.path);break}}return n}class Ma extends Error{constructor(t,n,r,s){super(s),this.context=t,this.type=n,this.value=r}}function BF(e){const[t,n]=[new Set,[]];for(const r of e){const s=Lx(r);t.has(s)||(t.add(s),n.push(r))}return n}function HF(e,t,n){if(rt(e,t,n))return n;const r=H(n)?n:En(e,t),s=cs(t)&&r.length<t.minItems?[...r,...Array.from({length:t.minItems-r.length},()=>En(e,t))]:r,i=(Bs(t)&&s.length>t.maxItems?s.slice(0,t.maxItems):s).map(l=>un(e,t.items,l));if(!Ir(t)||Ir(t)&&!h(t.uniqueItems,!0))return i;const a=BF(i);if(!rt(e,t,a))throw new Ma(e,t,n,"Failed to repair Array due to uniqueItems constraint");return a}function qF(e,t,n){return un(e,Un(t),n)}function zF(e,t,n){const r=Ls(e,t),s=Un(r);return un(e,s,n)}function KF(e,t,n){if(rt(e,t,n))return n;if(!fn(n))return En(e,t);const r=new Set($e(t.required)?[]:t.required),s={};for(const[i,a]of nt(t.properties))!r.has(i)&&$e(n[i])||(s[i]=i in n?un(e,a,n[i]):En(e,a));const o=D(t.properties);if(ar(t)&&ne(t.additionalProperties))for(const i of D(n))o.includes(i)||(s[i]=un(e,t.additionalProperties,n[i]));return s}function GF(e,t,n){if(rt(e,t,n))return n;if(Vt(n)||!ne(n)||H(n))return En(e,t);const r=new RegExp(kn(t)),s=qt(t),o=new Set,i={};for(const[a,l]of nt(n))r.test(a)&&(i[a]=un(e,s,l),o.add(a));if(ar(t))for(const a of D(n))o.has(a)||(i[a]=un(e,t.additionalProperties,n[a]));return i}function VF(e,t,n){return E(e,t.$ref)?un(e,e[t.$ref],n):(()=>{throw new Ma(e,t,n,"Unable to de-reference target type")})()}function WF(e,t,n){const r=El(t.pattern);return un(e,r,n)}function JF(e,t,n){return rt(e,t,n)?n:H(n)?t.items.map((r,s)=>un(e,r,n[s])):En(e,t)}function Hx(e,t,n){return kt(t)?E(e,t.$ref)?Hx(e,e[t.$ref]):(()=>{throw new Error("Unable to Deref target")})():t}function QF(e,t,n){if(!(Le(t)&&ne(n)))return 0;const r=D(n);return nt(t.properties).reduce((o,[i,a])=>{const l=We(a)&&h(a.const,n[i])?100:0,d=rt(e,a,n[i])?10:0,m=r.includes(i)?1:0;return o+(l+d+m)},0)}function YF(e,t,n){const r=t.anyOf.map(i=>Hx(e,i));let[s,o]=[r[0],0];for(const i of r){const a=QF(e,i,n);a>o&&(s=i,o=a)}return s}function XF(e,t,n){const r=Ve(ia(t.anyOf)),s=YF(e,r,n);return un(e,s,n)}function ZF(e,t,n){return rt(e,t,n)?Ut(n):Er(t)?En(e,t):XF(e,t,n)}function eD(e,t,n){if(rt(e,t,n))return n;const r=Oa(e,t,n);return rt(e,t,r)?r:En(e,t)}function tD(e,t,n){if(xm(n)||Sm(n)||ym(n)||To(n)||ea(n)||In(n))throw new Ma(e,t,n,"Value is not repairable")}function nD(e,t,n){if(mn(t)||pn(t)||Rs(t))throw new Ma(e,t,n,"Type is not repairable")}function rD(e,t,n){return $e(n)&&!Ds(t)?En(e,t):n}function sD(e,t,n){return Cl(t)?rt(e,t,n)?n:En(e,t):n}function un(e,t,n){tD(e,t,n),nD(e,t,n);const r=rD(e,t,n),s=ut(t)?HF(e,t,r):hn(t)?qF(e,t,r):Ue(t)?zF(e,t,r):Le(t)?KF(e,t,r):At(t)?GF(e,t,r):kt(t)?VF(e,t,r):zt(t)?WF(e,t,r):st(t)?JF(e,t,r):ae(t)?ZF(e,t,r):eD(e,t,r);return sD(e,t,s)}function oD(...e){const[t,n,r]=ct(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=un(t,n,r);return jx(t,n,s),s}const tc=Object.freeze(Object.defineProperty({__proto__:null,Assert:jx,Check:rt,Clean:ci,Clone:Ut,Convert:Oa,Create:En,Decode:GM,Default:Jd,Diff:RF,Encode:YM,Equal:_x,Errors:ai,HasCodec:oF,Hash:Lx,Parse:EF,Patch:UF,Pointer:gx,Repair:oD},Symbol.toStringTag,{value:"Module"}));class nf extends Error{constructor(t){super(t.map(n=>`${n.path.length>0?n.path.join("."):"root"}: ${n.message}`).join("; ")),this.issues=t,this.name="SchemaValidationError"}}function iD(e){return e?e.split("/").slice(1).map(t=>t.replace(/~1/g,"/").replace(/~0/g,"~")).map(t=>/^(0|[1-9]\d*)$/.test(t)?Number(t):t):[]}function aD(e,t){let n=e;for(const r of t){if(n===null||typeof n!="object")return;n=n[r]}return n}function rf(e,t){const[,n]=rR.Errors(e,t);return n.map(r=>{const s=iD(r.instancePath);return{code:r.keyword,path:s,message:r.message,value:aD(t,s)}})}function qx(e,t){const n=tc.Default(e,tc.Clone(t)),r=rf(e,n);if(r.length>0)return{success:!1,error:new nf(r)};const s=tc.Clean(e,n),o=rf(e,s);return o.length>0?{success:!1,error:new nf(o)}:{success:!0,data:s}}function mr(e,t){const n=qx(e,t);if(!n.success)throw n.error;return n.data}function J(e){return Object.defineProperties(e,{parse:{value:t=>mr(e,t),enumerable:!1},safeParse:{value:t=>qx(e,t),enumerable:!1}}),e}function Yn(e,t){return f.Optional({...e,default:t})}function be(e,t={}){return f.Unsafe({type:"string",enum:[...e],...t})}const zr=20,po=5*1024*1024,cD=32e3,fs=J(be(["default","autoEdit","yolo","plan"])),hr={DEFAULT:"default",AUTO_EDIT:"autoEdit",YOLO:"yolo",PLAN:"plan"},Qd=J(be(["user","assistant","system","tool"])),lD=J(f.Union([f.Object({type:f.Literal("text"),text:f.String()}),f.Object({type:f.Literal("image_url"),image_url:f.Object({url:f.String()})})])),zx=f.Union([f.String(),f.Array(lD)]);J(f.Object({id:f.String(),role:Qd,content:zx,timestamp:f.Number(),metadata:f.Optional(f.Record(f.String(),f.Unknown())),thinkingContent:f.Optional(f.String()),tool_call_id:f.Optional(f.String()),name:f.Optional(f.String()),tool_calls:f.Optional(f.Unknown())}));const dD=J(be(["queued","running","completed","failed","cancelled","interrupted"])),di=J(be(["local","worktree"])),uD=J(be(["applied","discarded","conflicted"])),fD=J(f.Object({status:uD,updatedAt:f.String(),sourceCommit:f.Optional(f.String()),changedFiles:f.Optional(f.Integer({minimum:0})),message:f.Optional(f.String())})),mD=J(f.Object({changedFiles:f.Integer({minimum:0}),additions:f.Integer({minimum:0}),deletions:f.Integer({minimum:0}),commits:f.Integer({minimum:0})})),pD=J(f.Object({path:f.String({minLength:1}),patch:f.String({maxLength:2*1024*1024}),additions:f.Integer({minimum:0}),deletions:f.Integer({minimum:0}),binary:f.Boolean(),truncated:f.Boolean()})),gD=J(f.Object({sessionId:f.String(),projectPath:f.String(),baseCommit:f.String(),files:f.Array(pD,{maxItems:100}),truncated:f.Boolean()})),hD=f.Union([f.String(),f.Number(),f.Boolean(),f.Array(f.String())]),bD=J(f.Object({name:f.String(),type:be(["string","number","integer","boolean","select","multi-select"]),title:f.String(),description:f.Optional(f.String()),required:f.Boolean(),defaultValue:f.Optional(hD),options:f.Optional(f.Array(f.Object({value:f.String(),label:f.String()}))),format:f.Optional(be(["date","uri","email","date-time"])),minimum:f.Optional(f.Number()),maximum:f.Optional(f.Number()),minLength:f.Optional(f.Number()),maxLength:f.Optional(f.Number()),minItems:f.Optional(f.Number()),maxItems:f.Optional(f.Number())}));J(f.Object({serverName:f.String(),mode:be(["form","url"]),message:f.String(),fields:f.Optional(f.Array(bD)),requestedSchema:f.Optional(f.Record(f.String(),f.Unknown())),url:f.Optional(f.String()),domain:f.Optional(f.String()),elicitationId:f.Optional(f.String())}));const kD=J(f.Object({type:be(["permission","question","elicitation"]),requestId:f.String()})),xD=J(f.Object({code:be(["authentication","permission","rate_limit","timeout","network","model_unavailable","context_limit","unsupported_input","runtime"]),message:f.String({minLength:1,maxLength:500}),retryable:f.Boolean()})),Ws=J(be(["auto","off","minimal","low","medium","high","xhigh","max"])),Js=J(be(["auto","standard","fast","flex"])),Qs=J(be(["auto","low","medium","high"])),Fr=J(f.Union([be(["auto","pragmatic","friendly","explanatory"]),f.String({minLength:7,maxLength:300,pattern:"^(?:(?:user|project):[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3}|plugin:[a-z0-9][a-z0-9._-]{0,63}:[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3})$"})])),Xn=J(f.Object({sessionId:f.String(),projectPath:f.String(),title:f.Optional(f.String()),gitBranch:f.Optional(f.String()),rootId:f.String(),parentId:f.Optional(f.String()),relationType:f.Optional(be(["subagent","fork"])),resumedFrom:f.Optional(f.String()),rootAgentId:f.Optional(f.String()),resumeDepth:f.Optional(f.Integer({minimum:0})),taskStatus:Yn(dD,"completed"),taskStatusReason:f.Optional(f.String()),taskFailure:f.Optional(xD),taskStartedAt:f.Optional(f.String()),taskCompletedAt:f.Optional(f.String()),taskPromptSummary:f.Optional(f.String()),taskModelId:f.Optional(f.String()),selectedModelId:f.Optional(f.String()),permissionMode:f.Optional(fs),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),communicationStyleDigest:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"})),projectInstructionsDigest:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"})),taskRetryAvailable:f.Optional(f.Boolean()),taskRetriedFrom:f.Optional(f.Object({sessionId:f.String(),projectPath:f.String()})),taskDelivery:f.Optional(fD),taskIsolation:f.Optional(di),taskSourceProjectPath:f.Optional(f.String()),taskWorktreePath:f.Optional(f.String()),taskWorktreeBranch:f.Optional(f.String()),taskBaseCommit:f.Optional(f.String()),taskDiffStat:f.Optional(mD),taskQueuePosition:f.Optional(f.Integer({minimum:1})),taskQueueDepth:f.Optional(f.Integer({minimum:0})),taskConcurrencyLimit:f.Optional(f.Integer({minimum:1})),archivedAt:f.Optional(f.String()),archivedBySessionId:f.Optional(f.String()),pendingInteraction:f.Optional(kD),messageCount:f.Number(),firstMessageTime:f.String(),lastMessageTime:f.String(),hasErrors:f.Boolean()})),yD=J(f.Object({sessions:f.Array(Xn),nextCursor:f.Optional(f.String())})),SD=J(f.Object({session:Xn,archivedSessionIds:f.Array(f.String())})),wD=J(f.Object({session:Xn,restoredSessionIds:f.Array(f.String())}));J(f.Object({version:f.Literal(1),sessionId:f.String(),goalId:f.String(),objective:f.String(),status:be(["active","verifying","paused","blocked","usage_limited","budget_limited","complete"]),tokenBudget:f.Optional(f.Number()),tokensUsed:f.Number(),timeUsedSeconds:f.Number(),continuationCount:f.Number(),statusReason:f.Optional(f.String()),completionVerification:f.Optional(f.Object({attempt:f.Integer({minimum:1}),status:be(["pending","pass","fail","partial"]),requestedAt:f.String(),completedAt:f.Optional(f.String()),verifierSessionId:f.Optional(f.String()),summary:f.Optional(f.String()),evidenceSha256:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"}))})),createdAt:f.String(),updatedAt:f.String()}));const Yd=J(f.Object({role:Qd,content:zx,metadata:f.Optional(f.Unknown()),reasoningContent:f.Optional(f.String()),thinkingContent:f.Optional(f.String()),tool_call_id:f.Optional(f.String()),name:f.Optional(f.String()),tool_calls:f.Optional(f.Unknown())})),vD=J(f.Object({session:Xn,messages:f.Array(Yd)})),Kx=J(be(["conversation","code","both"])),Gx=J(f.Object({messageId:f.String(),preview:f.String(),createdAt:f.String(),fileCount:f.Integer({minimum:0})}));J(f.Object({targetMessageId:f.String({minLength:1}),mode:Yn(Kx,"conversation")}));const ID=J(f.Object({checkpoint:Gx,mode:Kx,removedTurns:f.Integer({minimum:1}),restoredFiles:f.Array(f.String()),messages:f.Array(Yd)})),CD=be(["running","completed","failed","cancelled"]),Lc=J(f.Object({id:f.String(),subagentType:f.String(),description:f.String(),status:CD,rootAgentId:f.String(),resumedFrom:f.Optional(f.String()),resumeDepth:f.Integer({minimum:0}),createdAt:f.Number(),lastActiveAt:f.Number(),completedAt:f.Optional(f.Number()),result:f.Optional(f.Object({success:f.Boolean(),message:f.String(),error:f.Optional(f.String()),verificationCommands:f.Optional(f.Array(f.String())),verificationVerdict:f.Optional(be(["pass","fail","partial"])),modifiedFiles:f.Optional(f.Array(f.String()))})),stats:f.Optional(f.Object({tokens:f.Optional(f.Number()),toolCalls:f.Optional(f.Number()),duration:f.Optional(f.Number())}))}));J(f.Object({prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"})}));const jD=J(f.Object({source:Lc,session:Lc})),Vx=J(f.Object({sessionId:f.String(),projectPath:f.String()})),Wx=J(f.Object({path:f.String(),name:f.String(),gitBranch:f.Optional(f.String()),available:f.Boolean(),isCurrent:f.Boolean(),boundAt:f.String()})),TD=J(f.Union([f.Object({cancelled:f.Literal(!0)}),f.Object({cancelled:f.Literal(!1),path:f.String({minLength:1})})])),sf=J(f.Object({type:f.String(),seq:f.Optional(f.Number()),properties:f.Record(f.String(),f.Unknown())})),Jx=f.Object({type:be(["file","image","url"]),path:f.Optional(f.String()),url:f.Optional(f.String()),content:f.Optional(f.String({maxLength:po})),mimeType:f.Optional(f.String()),name:f.Optional(f.String())}),Qx=f.Record(f.String(),f.Unknown());J(f.Object({prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),title:f.Optional(f.String({minLength:1,maxLength:200})),projectPath:f.Optional(f.String()),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:Yn(di,"worktree"),permissionMode:Yn(fs,"default"),attachments:f.Optional(f.Array(Jx,{maxItems:zr})),outputSchema:f.Optional(Qx)}));const of=J(f.Object({session:Xn,runId:f.String(),messageId:f.String(),status:be(["queued","running"]),queuePosition:f.Optional(f.Integer({minimum:1})),queueDepth:f.Optional(f.Integer({minimum:0})),maxConcurrentTasks:f.Optional(f.Integer({minimum:1}))}));J(f.Object({action:be(["apply","discard"])}));const Xd=J(f.Object({kind:be(["cron","interval","once"]),cron:f.Optional(f.String({minLength:1,maxLength:120})),intervalMs:f.Optional(f.Integer({minimum:6e4})),runAt:f.Optional(f.String({minLength:1,maxLength:40})),timezone:f.Optional(f.String({minLength:1,maxLength:80}))})),AD=J(f.Object({modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:Yn(di,"worktree"),permissionMode:Yn(fs,"default")})),vs=J(f.Object({id:f.String(),title:f.Optional(f.String({minLength:1,maxLength:200})),prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),projectPath:f.String({minLength:1}),trigger:Xd,dispatch:AD,enabled:f.Boolean(),createdAt:f.String(),updatedAt:f.String(),nextRunAt:f.Union([f.String(),f.Null()]),expiresAt:f.Union([f.String(),f.Null()]),lastRunAt:f.Optional(f.String()),lastRunSessionId:f.Optional(f.String()),lastStatus:f.Optional(be(["queued","running","completed","failed","cancelled","interrupted","error"])),lastError:f.Optional(f.String()),runCount:f.Integer({minimum:0})}));J(f.Object({title:f.Optional(f.String({minLength:1,maxLength:200})),prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),projectPath:f.String({minLength:1}),trigger:Xd,modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:Yn(di,"worktree"),permissionMode:Yn(fs,"default"),enabled:Yn(f.Boolean(),!0)}));J(f.Object({title:f.Optional(f.String({minLength:1,maxLength:200})),prompt:f.Optional(f.String({minLength:1,maxLength:32e3,pattern:"\\S"})),trigger:f.Optional(Xd),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),isolation:f.Optional(di),permissionMode:f.Optional(fs),enabled:f.Optional(f.Boolean())}));const ED=J(f.Object({schedules:f.Array(vs)}));J(f.Object({content:f.String({maxLength:cD}),projectPath:f.Optional(f.String()),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(Ws),serviceTier:f.Optional(Js),responseVerbosity:f.Optional(Qs),communicationStyle:f.Optional(Fr),permissionMode:f.Optional(fs),attachments:f.Optional(f.Array(Jx,{maxItems:zr})),outputSchema:f.Optional(Qx)}));const PD=be(["completed","failed","aborted","timed_out","spawn_error"]),ND=J(f.Object({version:f.Literal(1),command:f.String(),status:PD,exitCode:f.Union([f.Integer(),f.Null()]),durationMs:f.Number({minimum:0}),stdout:f.String(),stderr:f.String(),stdoutOmittedBytes:f.Integer({minimum:0}),stderrOmittedBytes:f.Integer({minimum:0}),binaryOutput:f.Boolean(),truncated:f.Boolean()}));J(f.Object({command:f.String({minLength:1,maxLength:32*1024,pattern:"^(?![\\s\\S]*\\u0000)(?=[\\s\\S]*\\S)[\\s\\S]*$"}),projectPath:f.Optional(f.String())}));const OD=J(f.Object({executionId:f.String(),messageId:f.String(),record:ND,auxiliary:f.Boolean(),delivery:f.Optional(be(["current_turn","next_turn"])),queued:f.Optional(f.Integer({minimum:0}))}));J(f.Object({projectPath:f.String(),kind:be(["uncommitted","base","commit"]),ref:f.Optional(f.String({maxLength:200})),instructions:f.Optional(f.String({maxLength:4e3})),modelId:f.Optional(f.String({minLength:1,maxLength:200}))}));const $D=J(f.Object({reviewId:f.String(),status:f.Literal("running")}));J(f.Object({messageId:f.String(),role:Qd,content:f.String(),timestamp:f.String()}));J(f.Object({approved:f.Boolean(),remember:f.Optional(f.Boolean()),scope:f.Optional(be(["once","session","project"])),targetMode:f.Optional(fs),feedback:f.Optional(f.String()),answers:f.Optional(f.Record(f.String(),f.Union([f.String(),f.Array(f.String())]))),elicitation:f.Optional(f.Object({action:be(["accept","decline","cancel"]),content:f.Optional(f.Record(f.String(),f.Union([f.String({maxLength:4e3}),f.Number(),f.Boolean(),f.Array(f.String({maxLength:1e3}),{maxItems:100})]),{maxProperties:32}))}))}));const RD=J(f.Object({id:Fr,name:f.String({minLength:1,maxLength:80}),description:f.String({minLength:1,maxLength:256}),source:be(["built-in","user","project","plugin"]),contentSha256:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"}))}));J(f.Object({id:f.String(),displayName:f.Optional(f.String()),provider:f.String(),model:f.String(),contextWindow:f.Optional(f.Number()),maxTokens:f.Optional(f.Number()),reasoning:f.Optional(f.Boolean()),supportedReasoningEfforts:f.Optional(f.Array(be(["off","minimal","low","medium","high","xhigh","max"]))),supportedServiceTiers:f.Optional(f.Array(be(["standard","fast","flex"]))),supportedResponseVerbosities:f.Optional(f.Array(be(["low","medium","high"]))),communicationStyles:f.Optional(f.Array(RD,{maxItems:36})),input:f.Optional(f.Array(be(["text","image"]))),overrides:f.Optional(f.Object({baseUrl:f.Optional(f.String()),temperature:f.Optional(f.Number()),maxOutputTokens:f.Optional(f.Number()),timeout:f.Optional(f.Number()),streamIdleTimeout:f.Optional(f.Number({minimum:1e3}))}))}));J(be(["vs-dark","vs-light","hc-black"]));const MD=J(be(["light","dark","system"])),FD=J(f.Object({language:f.String(),theme:f.String(),uiTheme:MD,autoSaveSessions:f.Boolean(),notifyBuild:f.Boolean(),notifyErrors:f.Boolean(),notifySounds:f.Boolean(),privacyTelemetry:f.Boolean(),privacyCrash:f.Boolean(),communicationStyle:f.Optional(Fr)}));J(f.Partial(FD));async function pr(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>{});if(!n.ok){const s=r,o=s!=null&&s.error&&typeof s.error=="object"&&!Array.isArray(s.error)?s.error:void 0,i=typeof(s==null?void 0:s.error)=="string"?s.error:typeof(o==null?void 0:o.message)=="string"?o.message:typeof(s==null?void 0:s.message)=="string"?s.message:n.statusText||`Request failed (${n.status})`;throw new Error(i)}return r}const se="",af=1e4,DD=f.Array(Xn),_D=f.Array(Wx),LD=f.Array(Yd),UD=f.Array(Gx),BD=f.Array(Lc),HD=f.Object({cwd:f.String(),gitBranch:f.Optional(f.String()),taskAdmission:f.Optional(f.Object({inFlight:f.Integer({minimum:0}),queued:f.Integer({minimum:0}),maxConcurrent:f.Integer({minimum:1}),maxQueued:f.Integer({minimum:1})}))}),qD=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),zD=()=>{const e=new Date,t=String(e.getFullYear()).slice(-2),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`Session ${t}-${n}-${r} ${s}:${o}`};function KD(e){const t=Vx.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function pt(e,t){const n=KD(t);return`${e}${e.includes("?")?"&":"?"}${n}`}function cf(e){return{"x-blade-directory":Vx.parse(e).projectPath}}const nc=(e,t,n)=>({id:`history-${t}-${n}`,role:e.role,content:qD(e.content),timestamp:n,metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,tool_call_id:e.tool_call_id,name:e.name,tool_calls:e.tool_calls,thinkingContent:e.thinkingContent??e.reasoningContent}),re={listProjects:async()=>{const e=await fetch(`${se}/projects`);if(!e.ok)throw new Error("Failed to load projects");return mr(_D,await e.json())},bindProject:async e=>{var n;const t=await fetch(`${se}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to bind project")}return Wx.parse(await t.json())},pickProjectDirectory:async()=>mr(TD,await pr(`${se}/projects/pick`,{method:"POST"})),unbindProject:async e=>{if(!(await fetch(`${se}/projects?path=${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to unbind project")},listSessions:async()=>{const e=await fetch(`${se}/sessions`);if(!e.ok)throw new Error("Failed to load sessions");return mr(DD,await e.json())},listSessionPage:async(e,t=50,n=!1)=>{const r=new URLSearchParams({limit:String(t)});e&&r.set("cursor",e),n&&r.set("archived","true");const s=await fetch(`${se}/sessions/catalog?${r.toString()}`);if(!s.ok)throw new Error("Failed to load session catalog");return yD.parse(await s.json())},getSession:async e=>Xn.parse(await pr(pt(`${se}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{const n=await fetch(`${se}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,title:t||zD()})});if(!n.ok)throw new Error("Failed to create session");return Xn.parse(await n.json())},startCodeReview:async(e,t)=>{var r,s;const n=await fetch(`${se}/sessions/${e.sessionId}/review`,{method:"POST",headers:{"Content-Type":"application/json",...cf(e)},body:JSON.stringify({projectPath:e.projectPath,...t})});if(!n.ok){const o=await n.json().catch(()=>{}),i=((r=o==null?void 0:o.error)==null?void 0:r.code)==="CONFLICT"?He("taskHome.review.conflict"):((s=o==null?void 0:o.error)==null?void 0:s.code)==="BAD_REQUEST"?He("taskHome.review.invalidTarget"):He("taskHome.review.startFailed");throw new Error(i)}return $D.parse(await n.json())},getWorkspaceInfo:async()=>mr(HD,await pr(`${se}/global/info`)),createTask:async e=>{var n;const t=await fetch(`${se}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to dispatch task")}return of.parse(await t.json())},retryTask:async e=>{var n;const t=await fetch(pt(`${se}/tasks/${e.sessionId}/retry`,e),{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to retry task")}return of.parse(await t.json())},deliverTask:async(e,t)=>{var r;const n=await fetch(pt(`${se}/tasks/${e.sessionId}/delivery`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t})});if(!n.ok){const s=await n.json().catch(()=>{});throw new Error(((r=s==null?void 0:s.error)==null?void 0:r.message)||"Failed to deliver task changes")}return Xn.parse(await n.json())},getTaskDiff:async e=>{var n;const t=await fetch(pt(`${se}/tasks/${e.sessionId}/diff`,e));if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to load task diff")}return gD.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(pt(`${se}/sessions/${e.sessionId}`,e),{method:"DELETE"})).ok)throw new Error("Failed to delete session")},archiveSession:async e=>SD.parse(await pr(pt(`${se}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>wD.parse(await pr(pt(`${se}/sessions/${e.sessionId}/unarchive`,e),{method:"POST"})),exportSessionMarkdown:async(e,t=!1)=>{var d,m;const n=pt(`${se}/sessions/${e.sessionId}/export`,e),r=t?`${n}&includeReasoning=true`:n,s=await fetch(r);if(!s.ok){const p=await s.json().catch(()=>{});throw new Error(((d=p==null?void 0:p.error)==null?void 0:d.message)||"Failed to export session")}const o=s.headers.get("content-disposition")??"",i=((m=/filename="([A-Za-z0-9._-]+)"/.exec(o))==null?void 0:m[1])??`blade-session-${e.sessionId.slice(0,12)}.md`,a=s.headers.get("x-blade-content-sha256")??"";if(!/^[a-f0-9]{64}$/.test(a))throw new Error("Session export is missing its integrity hash");const l=p=>{const g=s.headers.get(p);if(g===null)throw new Error(`Session export is missing its ${p} header`);const x=Number(g);if(!Number.isInteger(x)||x<0)throw new Error(`Session export has an invalid ${p} header`);return x};return{filename:i,markdown:await s.text(),contentSha256:a,messageCount:l("x-blade-export-messages"),activityCount:l("x-blade-export-activities"),redactionCount:l("x-blade-export-redactions")}},updateSession:async(e,t)=>{if(!(await fetch(`${se}/sessions/${e.sessionId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,projectPath:e.projectPath})})).ok)throw new Error("Failed to update session")},getMessages:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw new Error("Failed to load messages");const n=mr(LD,await t.json()),r=Date.now();return n.map((s,o)=>nc(s,o,r))},sendMessage:async(e,t,n)=>{var s;const r=await fetch(`${se}/sessions/${e.sessionId}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,permissionMode:n,projectPath:e.projectPath})});if(!r.ok){const o=await r.json().catch(()=>{}),i=((s=o==null?void 0:o.error)==null?void 0:s.message)??(o==null?void 0:o.reason);throw new Error(i||"Failed to send message")}return r.json()},executeUserShellCommand:async(e,t)=>OD.parse(await pr(`${se}/sessions/${e.sessionId}/shell`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t,projectPath:e.projectPath})})),abortSession:async e=>{var n;const t=await fetch(pt(`${se}/sessions/${e.sessionId}/abort`,e),{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to stop task")}},getGoal:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e));if(!t.ok)throw new Error("Failed to load goal");return(await t.json()).goal},createGoal:async(e,t,n,r)=>{const s=await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({objective:t,tokenBudget:n,permissionMode:r})});if(!s.ok)throw new Error("Failed to create goal");return s.json()},updateGoal:async(e,t)=>{const n=await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to update goal");return n.json()},clearGoal:async e=>{if(!(await fetch(pt(`${se}/sessions/${e.sessionId}/goal`,e),{method:"DELETE"})).ok)throw new Error("Failed to clear goal")},listRewindCheckpoints:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw new Error("Failed to load rewind checkpoints");const n=await t.json();return mr(UD,n.checkpoints)},rewindSession:async(e,t,n)=>{const r=await fetch(pt(`${se}/sessions/${e.sessionId}/rewind`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetMessageId:t,mode:n})});if(!r.ok)throw new Error("Failed to rewind session");const s=ID.parse(await r.json()),o=Date.now();return{...s,messages:s.messages.map((i,a)=>nc(i,a,o))}},listSubagents:async e=>{const t=await fetch(pt(`${se}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw new Error("Failed to load subagents");const n=await t.json();return mr(BD,n.subagents)},resumeSubagent:async(e,t,n)=>{const r=await fetch(pt(`${se}/sessions/${e.sessionId}/subagents/${encodeURIComponent(t)}/resume`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:n})});if(!r.ok){const s=await r.json().catch(()=>{});throw new Error((s==null?void 0:s.message)||"Failed to resume subagent")}return jD.parse(await r.json())},forkSession:async e=>{const t=await fetch(`${se}/sessions/${e.sessionId}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!t.ok)throw new Error("Failed to fork session");const n=vD.parse(await t.json()),r=Date.now();return{session:n.session,messages:n.messages.map((s,o)=>nc(s,o,r))}},openEventSubscription:async(e,t,n)=>{const r=(n==null?void 0:n.maxRetries)??5,s=n==null?void 0:n.onConnectionChange,o=n==null?void 0:n.onConnectionStateChange;let i=null,a=0,l=null,d=Date.now(),m=null,p=null,g=!1,x=!1,b=0,y,j,k=!1;const A=new Promise((P,B)=>{y=P,j=B}),N=()=>{m&&(clearInterval(m),m=null)},$=()=>{p&&(clearTimeout(p),p=null)},Q=()=>{i==null||i.close(),i=null},T=()=>{l&&(clearTimeout(l),l=null),N(),$(),Q()},C=()=>{k||(k=!0,$(),y())},O=P=>{k||(k=!0,T(),j(P))},R=()=>{if(g||a>=r){a>=r&&(console.error(`SSE max retries (${r}) reached, giving up`),o==null||o("offline"));return}a++,o==null||o("reconnecting");const P=Math.min(1e3*Math.pow(2,a-1),3e4);console.log(`SSE reconnecting in ${P}ms (attempt ${a}/${r})`),l=setTimeout(()=>{X().catch(B=>{console.error("SSE reconnect failed",B),s==null||s(!1),R()})},P)},K=()=>{a=0,d=Date.now(),s==null||s(!0),o==null||o("connected"),N(),m=setInterval(()=>{Date.now()-d>45e3&&(console.warn("SSE heartbeat timeout, reconnecting..."),N(),Q(),s==null||s(!1),o==null||o("reconnecting"),R())},15e3),x||(x=!0,C())},X=async()=>{if(g)return;Q();const P=pt(`${se}/sessions/${e.sessionId}/events`,e),B=b>0?`${P}${P.includes("?")?"&":"?"}lastEventId=${b}`:P;i=new EventSource(B),x||($(),p=setTimeout(()=>{o==null||o("offline"),O(new Error("Timed out waiting for event subscription readiness"))},af)),i.onmessage=M=>{try{const fe=JSON.parse(M.data);typeof fe.seq=="number"&&fe.seq>b&&(b=fe.seq);const ve=sf.parse(fe);if(d=Date.now(),ve.type==="connected"){ve.properties.sessionId===e.sessionId&&ve.properties.projectPath===e.projectPath&&(typeof ve.properties.status=="string"&&t({type:"session.status",properties:ve.properties}),K());return}if(ve.type==="heartbeat")return;t(ve)}catch(fe){console.error("Failed to parse SSE event:",M.data,fe)}},i.onerror=()=>{if(!g){if(N(),Q(),!x){o==null||o("offline"),O(new Error("Failed to open event subscription"));return}console.error("SSE connection error"),s==null||s(!1),R()}}};return o==null||o("connecting"),X().catch(P=>{o==null||o("offline"),O(P instanceof Error?P:new Error("Failed to open event subscription"))}),await A,()=>{g=!0,l&&(clearTimeout(l),l=null),T(),s==null||s(!1)}},openTaskEventSubscription:async(e,t)=>{const n=t==null?void 0:t.onConnectionChange,r=t==null?void 0:t.onConnectionStateChange,s=new EventSource(`${se}/events`);let o=!1,i=!1,a,l,d;const m=new Promise((g,x)=>{l=g,d=x}),p=()=>{o||(o=!0,a!==void 0&&(clearTimeout(a),a=void 0),s.close(),n==null||n(!1),r==null||r("offline"))};return r==null||r("connecting"),a=setTimeout(()=>{i||o||(p(),d(new Error("Timed out waiting for global task events")))},af),s.onmessage=g=>{try{const x=sf.parse(JSON.parse(g.data));if(x.type==="connected"){i||(i=!0,a!==void 0&&(clearTimeout(a),a=void 0),l()),n==null||n(!0),r==null||r("connected");return}if(x.type==="heartbeat")return;e(x)}catch(x){console.error("Failed to parse global task event:",g.data,x)}},s.onerror=()=>{n==null||n(!1),r==null||r(i?"reconnecting":"offline"),!i&&!o&&(p(),d(new Error("Failed to open global task events")))},await m,p},respondPermission:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${se}/permissions/${t}?${r.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to permission")}},respondToConfirmation:async(e,t,n)=>{if(!(await fetch(pt(`${se}/sessions/${e.sessionId}/confirmation/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:n})})).ok)throw new Error("Failed to respond to confirmation")},respondToQuestion:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${se}/permissions/${t}?${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:!0,answers:n})});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to question")}},respondToElicitation:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${se}/permissions/${t}?${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:n.action==="accept",elicitation:n})});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to MCP elicitation")}},getGitInfo:async e=>{const t=await fetch(`${se}/suggestions/git-info`,{headers:cf(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()},listSchedules:async()=>{var n;const e=await fetch(`${se}/schedules`);if(!e.ok){const r=await e.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.loadFailed"))}return ED.parse(await e.json()).schedules},createSchedule:async e=>{var n;const t=await fetch(`${se}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.createFailed"))}return vs.parse(await t.json())},updateSchedule:async(e,t)=>{var r;const n=await fetch(`${se}/schedules/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>{});throw new Error(((r=s==null?void 0:s.error)==null?void 0:r.message)||He("schedule.error.updateFailed"))}return vs.parse(await n.json())},deleteSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.deleteFailed"))}},enableSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}/enable`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.toggleFailed"))}return vs.parse(await t.json())},disableSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}/disable`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.toggleFailed"))}return vs.parse(await t.json())},runSchedule:async e=>{var n;const t=await fetch(`${se}/schedules/${encodeURIComponent(e)}/run`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||He("schedule.error.runFailed"))}return vs.parse(await t.json())}},lf=e=>{let t;const n=new Set,r=(d,m)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const g=t;t=m??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,g))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(r,s,a);return a},GD=e=>e?lf(e):lf,VD=e=>e;function WD(e,t=VD){const n=oo.useSyncExternalStore(e.subscribe,oo.useCallback(()=>t(e.getState()),[e,t]),oo.useCallback(()=>t(e.getInitialState()),[e,t]));return oo.useDebugValue(n),n}const df=e=>{const t=GD(e),n=r=>WD(t,r);return Object.assign(n,t),n},ui=e=>e?df(e):df;function Lt(){return{timeline:[],textBefore:"",toolCalls:[],textAfter:"",thinkingContent:"",tasks:[],subagent:null,subagents:[],confirmation:null,question:null,elicitation:null}}function Zn(e){return e?e.subagents&&e.subagents.length>0?e.subagents:e.subagent?[e.subagent]:[]:[]}function wo(e,t,n){const r=(n?t.find(s=>s.id===n||s.sessionId===n):void 0)??t[t.length-1]??null;return{...e,subagents:t,subagent:r}}function Uc(e,t){const n=[...Zn(e)];let r=n.findIndex(i=>i.id===t.id||!!(i.sessionId&&t.sessionId&&i.sessionId===t.sessionId));if(r===-1&&t.sessionId&&(r=n.findIndex(i=>!i.sessionId&&i.status==="running"&&i.type===t.type&&i.description===t.description)),r===-1)return n.push(t),wo(e,n,t.id);const s=n[r],o={...s,...t,id:s.id};return n[r]=o,wo(e,n,o.id)}function Zd(e,t){return`${t}-${e.length}`}function Bc(e,t){if(!t)return e;const n=[...Fa(e)],r=n[n.length-1];return(r==null?void 0:r.type)==="text"?n[n.length-1]={...r,content:r.content+t}:n.push({id:Zd(n,"text"),type:"text",content:t}),{...e,timeline:n}}function Yx(e,t){if(!t)return e;const n=[...Fa(e)],r=n[n.length-1];return(r==null?void 0:r.type)==="thinking"?n[n.length-1]={...r,content:r.content+t}:n.push({id:Zd(n,"thinking"),type:"thinking",content:t}),{...e,timeline:n}}function Hc(e,t){const n=e.toolCalls.some(i=>i.toolCallId===t.toolCallId),r=n?e.toolCalls:[...e.toolCalls,t];if(n)return{...e,toolCalls:r};const s=[...Fa(e)],o=s[s.length-1];return(o==null?void 0:o.type)==="tool_group"?s[s.length-1]={...o,toolCallIds:[...o.toolCallIds,t.toolCallId]}:s.push({id:Zd(s,"tool_group"),type:"tool_group",toolCallIds:[t.toolCallId]}),{...e,timeline:s,toolCalls:r}}function Fa(e){if(e.timeline&&e.timeline.length>0)return e.timeline;const t=[];return e.thinkingContent&&t.push({id:"legacy-thinking",type:"thinking",content:e.thinkingContent}),e.textBefore&&t.push({id:"legacy-text-before",type:"text",content:e.textBefore}),e.toolCalls.length>0&&t.push({id:"legacy-tool-group",type:"tool_group",toolCallIds:e.toolCalls.map(n=>n.toolCallId)}),e.textAfter&&t.push({id:"legacy-text-after",type:"text",content:e.textAfter}),t}function JD(e){return Fa(e).filter(t=>t.type==="text").map(t=>t.content).filter(Boolean).join(`
|
|
10
10
|
|
|
11
|
-
`)}const
|
|
12
|
-
`)}function Pi(e){var r,s,o;const t=[];let n=null;for(const i of e)if(i.role!=="system"){if(i.role==="user")n&&(t.push(n),n=null),t.push({id:i.id,role:i.role,content:i.content,timestamp:i.timestamp||Date.now(),metadata:i.metadata});else if(i.role==="assistant"){n&&t.push(n);const a=i.metadata;let l=Lt();i.thinkingContent&&(l=Jx(l,i.thinkingContent),l.thinkingContent=i.thinkingContent);const d=so(i.content);d&&(l=Uc(l,d),l.textBefore=d);const m=c2(i.id,a);if(i.tool_calls&&Array.isArray(i.tool_calls))for(const p of i.tool_calls){const g=((r=p.function)==null?void 0:r.name)||"Unknown",x=Zx((s=p.function)==null?void 0:s.arguments);if(g==="Task"){let y={};try{y=JSON.parse(x)}catch{}const j=typeof y.subagent_type=="string"?y.subagent_type:"subagent",k=typeof y.description=="string"?y.description:j;l=Lc(l,{id:Da({explicitId:p.id,sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,messageId:i.id,agentType:j,description:k}),type:j,description:k,status:"running",startTime:Date.now(),sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,resumedFrom:typeof y.resume_from=="string"?y.resume_from:typeof y.resume=="string"?y.resume:void 0});continue}const b={toolCallId:Kc({explicitId:p.id,messageId:i.id,toolName:g,argumentsValue:(o=p.function)==null?void 0:o.arguments}),toolName:g,arguments:x,status:"running",startTime:Date.now()};l=Bc(l,b)}for(const p of m)l=Lc(l,p);n={id:i.id,role:"assistant",content:so(i.content),timestamp:i.timestamp||Date.now(),metadata:a,agentContent:l}}else if(i.role==="tool"&&n&&n.agentContent){const a=i,l=i.metadata,d=a.tool_call_id||(l==null?void 0:l.toolCallId),m=a.name||(l==null?void 0:l.toolName)||"Tool",p=l!=null&&l.metadata&&typeof l.metadata=="object"&&!Array.isArray(l.metadata)?l.metadata:void 0,g=l!=null&&l.independentVerification&&typeof l.independentVerification=="object"&&!Array.isArray(l.independentVerification)?l.independentVerification:void 0,x=typeof(l==null?void 0:l.error)=="string"&&l.error.length>0,b=Zn(n.agentContent),y=b.findIndex(k=>k.id===d);if(y>=0){const k=b[y],A=typeof(p==null?void 0:p.subagentStatus)=="string"?eu(p.subagentStatus):x?"failed":"completed";b[y]={...k,sessionId:typeof(p==null?void 0:p.subagentSessionId)=="string"?p.subagentSessionId:k.sessionId,type:typeof(p==null?void 0:p.subagentType)=="string"?p.subagentType:k.type,status:A,resumedFrom:typeof(p==null?void 0:p.subagentResumedFrom)=="string"?p.subagentResumedFrom:k.resumedFrom,rootAgentId:typeof(p==null?void 0:p.subagentRootId)=="string"?p.subagentRootId:k.rootAgentId,resumeDepth:typeof(p==null?void 0:p.subagentResumeDepth)=="number"?p.subagentResumeDepth:k.resumeDepth,verificationVerdict:(p==null?void 0:p.verificationVerdict)==="pass"||(p==null?void 0:p.verificationVerdict)==="fail"||(p==null?void 0:p.verificationVerdict)==="partial"?p.verificationVerdict:(g==null?void 0:g.verificationVerdict)==="pass"||(g==null?void 0:g.verificationVerdict)==="fail"||(g==null?void 0:g.verificationVerdict)==="partial"?g.verificationVerdict:k.verificationVerdict},n.agentContent=wo(n.agentContent,b,k.id);continue}const j=n.agentContent.toolCalls.find(k=>k.toolCallId===d);j?(j.output=so(i.content),j.status=x?"error":"success",j.metadata=p,j.summary=typeof(p==null?void 0:p.summary)=="string"?p.summary:j.summary,(!j.toolName||j.toolName==="Unknown")&&(j.toolName=m)):n.agentContent=Bc(n.agentContent,{toolCallId:Kc({explicitId:d,messageId:n.id,toolName:m,output:so(i.content)}),toolName:m,output:so(i.content),status:x?"error":"success",startTime:Date.now(),metadata:p,summary:typeof(p==null?void 0:p.summary)=="string"?p.summary:void 0})}}return n&&t.push(n),t}const l2=e=>{var n;const t=[];e.content.trim()&&t.push({type:"text",text:e.content});for(const r of e.attachments??[])r.type==="image"&&t.push({type:"image_url",image_url:{url:r.content}});return t.length===0?e.content:t.length===1&&((n=t[0])==null?void 0:n.type)==="text"?t[0].text:t},Si=()=>({eventUnsubscribe:null,sessionEventConnectionState:"idle",isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),mf=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)}),d2=(e,t)=>{let n=0,r=0,s=0;const o=()=>(n+=1,n),i=l=>l===n,a=l=>{try{l()}catch(d){console.warn("Failed to clean up stale event subscription",d)}};return{sessions:[],archivedSessions:[],currentSessionId:null,currentSessionRef:null,forkingSessionRef:null,isTemporarySession:!1,isLoading:!1,catalogLoadState:"idle",catalogError:null,archivedCatalogLoadState:"idle",archivedCatalogError:null,error:null,errorContext:null,goal:null,setSessions:l=>e({sessions:l}),addSession:l=>e(d=>({sessions:vn(d.sessions,l)})),removeSession:l=>{const d=t();d.markTaskRead(l);const m=oe(d.currentSessionRef,l),p=oe(d.forkingSessionRef,l);(m||p)&&o(),m&&d.unsubscribeFromEvents(),e(g=>({sessions:df(g.sessions,l),currentSessionId:m?null:g.currentSessionId,currentSessionRef:m?null:g.currentSessionRef,messages:m?[]:g.messages,goal:m?null:g.goal,forkingSessionRef:p?null:g.forkingSessionRef,...m?Si():{}}))},setCurrentSession:l=>{o(),e({currentSessionId:(l==null?void 0:l.sessionId)??null,currentSessionRef:l,isTemporarySession:!1})},setTemporarySession:l=>e({isTemporarySession:l}),setLoading:l=>e({isLoading:l}),setError:l=>e({error:l,errorContext:null}),getNavigationVersion:()=>n,clearError:()=>e({error:null,errorContext:null}),setGoal:l=>e({goal:l}),startTemporarySession:l=>{o(),t().unsubscribeFromEvents(),Pt.getState().resetMode(),l&&t().selectProject(l),e({currentSessionId:oc,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,tokenUsage:{...ao},error:null,errorContext:null,...Si()})},loadSessions:async()=>{const l=++r,d=new Set(t().sessions.map(p=>ze(pe(p)))),m=new Set;e({catalogLoadState:"loading",catalogError:null});try{let p,g=!0;do{const y=await re.listSessionPage(p);if(l!==r)return;for(const j of y.sessions)m.add(ze(pe(j)));if(e(j=>{const k=new Set(y.sessions.map(N=>ze(pe(N))));return{sessions:g?[...y.sessions,...j.sessions.filter(N=>!k.has(ze(pe(N))))]:y.sessions.reduce((N,$)=>vn(N,$),j.sessions),catalogLoadState:y.nextCursor?"hydrating":"ready"}}),g=!1,p=y.nextCursor,p&&(await mf(),l!==r))return}while(p);if(l!==r)return;const x=t().sessions.filter(y=>{const j=ze(pe(y));return m.has(j)||!d.has(j)}),b=uf(t().unreadTaskKeys,x);go(b),e({sessions:x,unreadTaskKeys:b,catalogLoadState:"ready",catalogError:null})}catch(p){if(l!==r)return;e({catalogLoadState:"error",catalogError:p.message})}},loadArchivedSessions:async()=>{const l=++s;e({archivedCatalogLoadState:"loading",archivedCatalogError:null});try{let d;const m=[];do{const p=await re.listSessionPage(d,50,!0);if(l!==s)return;for(const g of p.sessions){const x=m.findIndex(b=>oe(pe(b),pe(g)));x===-1?m.push(g):m[x]=g}d=p.nextCursor,d&&(e({archivedCatalogLoadState:"hydrating"}),await mf())}while(d);if(l!==s)return;e({archivedSessions:m,archivedCatalogLoadState:"ready",archivedCatalogError:null})}catch(d){if(l!==s)return;e({archivedCatalogLoadState:"error",archivedCatalogError:d.message})}},selectSession:async l=>{var m;const d=o();e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});try{const p=Zd(t().sessions,l),[g,x,b]=await Promise.all([re.getMessages(l),re.getGoal(l).catch(()=>null),p?Promise.resolve(p):re.getSession(l)]);if(!i(d))return;const y=Pi(g),j=[];let k=!1;const A=await t().prepareEventSubscription(l,$=>{k?t().handleEvent($):j.push($)});if(!i(d)){a(A);return}const N=fi(b,t().selectedProjectPath??((m=t().taskWorkspaceInfo)==null?void 0:m.cwd)??null);t().boundProjects.some($=>$.available&&$.path===N)&&t().selectProject(N),Pt.getState().setMode(b.permissionMode??qc),e($=>{var Q;return{currentSessionId:l.sessionId,currentSessionRef:l,isTemporarySession:!1,messages:y,goal:x,isLoading:!1,tokenUsage:{...ao},isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,error:b.taskStatus==="failed"?((Q=b.taskFailure)==null?void 0:Q.message)??null:null,errorContext:b.taskStatus==="failed"&&b.taskFailure?{kind:"execution",sessionRef:l,failureCode:b.taskFailure.code}:null,sessions:vn($.sessions,b)}}),t().markTaskRead(l),k=!0,t().replaceEventSubscription(A);for(const $ of j)t().handleEvent($)}catch(p){if(!i(d))return;e({error:p.message,errorContext:{kind:"navigation",sessionRef:l},isLoading:!1})}},archiveSession:async l=>{var d;try{const m=await re.archiveSession(l),p=new Set(m.archivedSessionIds),g=t(),x=((d=g.currentSessionRef)==null?void 0:d.projectPath)===l.projectPath&&p.has(g.currentSessionRef.sessionId);x&&(o(),g.unsubscribeFromEvents()),e(b=>{const y=b.sessions.filter(k=>k.projectPath!==l.projectPath||!p.has(k.sessionId)),j=uf(b.unreadTaskKeys,y);return go(j),{sessions:y,archivedSessions:vn(b.archivedSessions,m.session),unreadTaskKeys:j,currentSessionId:x?null:b.currentSessionId,currentSessionRef:x?null:b.currentSessionRef,messages:x?[]:b.messages,goal:x?null:b.goal,...x?Si():{}}}),await t().loadArchivedSessions()}catch(m){e({error:m.message,errorContext:{kind:"task_action",sessionRef:l}})}},unarchiveSession:async l=>{try{const d=await re.unarchiveSession(l),m=new Set(d.restoredSessionIds);e(p=>({archivedSessions:p.archivedSessions.filter(g=>g.projectPath!==l.projectPath||!m.has(g.sessionId)),sessions:vn(p.sessions,d.session)})),await Promise.all([t().loadSessions(),t().loadArchivedSessions()])}catch(d){e({error:d.message,errorContext:{kind:"task_action",sessionRef:l}})}},deleteSession:async l=>{const d=t(),m=oe(d.currentSessionRef,l),p=oe(d.forkingSessionRef,l),g=m||p?o():null,x=m?g:null;p&&e({forkingSessionRef:null});try{await re.deleteSession(l),t().markTaskRead(l);const b=t(),y=oe(b.currentSessionRef,l)&&(x===null||i(x));y&&(o(),b.unsubscribeFromEvents()),e(j=>({sessions:df(j.sessions,l),currentSessionId:y?null:j.currentSessionId,currentSessionRef:y?null:j.currentSessionRef,messages:y?[]:j.messages,goal:y?null:j.goal,...y?Si():{}}))}catch(b){if(x!==null&&(!i(x)||!oe(t().currentSessionRef,l)))return;e({error:b.message})}},updateSession:async(l,d)=>{try{await re.updateSession(l,d),e(m=>({sessions:m.sessions.map(p=>p.sessionId===l.sessionId&&p.projectPath===l.projectPath?{...p,title:d}:p)}))}catch(m){e({error:m.message})}},forkSession:async l=>{const d=o(),m=pe(l);e({forkingSessionRef:m,isLoading:!1,error:null});let p=null;try{const g=await re.forkSession(l),x=pe(g.session),b=Pi(g.messages);if(e(y=>({sessions:vn(y.sessions,g.session)})),!i(d))return;if(p=await t().prepareEventSubscription(x),!i(d)){a(p),p=null;return}e({currentSessionId:x.sessionId,currentSessionRef:x,isTemporarySession:!1,messages:b,goal:null,tokenUsage:{...ao},error:null,forkingSessionRef:null}),t().replaceEventSubscription(p),p=null}catch(g){if(p&&a(p),!i(d))return;e({error:g.message,forkingSessionRef:null})}},rewindSession:async(l,d)=>{const{currentSessionRef:m,isTemporarySession:p,isStreaming:g}=t();if(!m||p)return e({error:"No persisted session is available for rewind"}),!1;if(g)return e({error:"Stop the active run before rewinding"}),!1;const x=n;try{const b=await re.rewindSession(m,l,d);if(!i(x)||!oe(t().currentSessionRef,m))return!1;const y=Pi(b.messages);return e(j=>({messages:y,tokenUsage:{...ao},error:null,currentRunId:null,agentPhase:"idle",pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,sessions:j.sessions.map(k=>k.sessionId===m.sessionId&&k.projectPath===m.projectPath?{...k,messageCount:y.length}:k)})),!0}catch(b){return!i(x)||!oe(t().currentSessionRef,m)||e({error:b.message}),!1}},sendMessage:async l=>{var O,R,K,X;const{currentSessionId:d,currentSessionRef:m,isTemporarySession:p,isStreaming:g,addSession:x,addMessage:b}=t(),y=n,j=m,k={isStreaming:g,agentPhase:t().agentPhase,currentRunId:t().currentRunId};let A=m,N=d,$=j,Q=null,T=null;const C=()=>i(y)&&oe(t().currentSessionRef,$);if(p||!N||N===oc)try{const P=QD(l.content),B=await re.createSession(t().selectedProjectPath??((O=t().taskWorkspaceInfo)==null?void 0:O.cwd)??void 0,P||void 0);if(x(B),!C())return!1;A=pe(B),N=B.sessionId,e({currentSessionId:B.sessionId,currentSessionRef:A,isTemporarySession:!1}),$=A}catch(P){return C()&&e({error:P.message}),!1}if(!A||!N||N===oc)return C()&&e({error:"Failed to create session"}),!1;try{if(!g){if(Q=await t().prepareEventSubscription(A),!C())return a(Q),Q=null,!1;t().replaceEventSubscription(Q),Q=null}if(!C())return!1;const P=l.content.trim();if(P.startsWith("!")){if((((R=l.attachments)==null?void 0:R.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const Pe=P.slice(1).trim();if(!Pe)throw new Error("User shell command cannot be empty");g||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const U=await re.executeUserShellCommand(A,Pe);return C()?(U.auxiliary||e({isStreaming:!1,agentPhase:"idle"}),U.delivery&&e({pendingSteeringCount:U.queued??0,pendingInputDelivery:U.delivery==="current_turn"?"current_turn":"next_turn"}),!0):!1}if((((K=l.attachments)==null?void 0:K.length)??0)===0&&(P==="/goal"||P.startsWith("/goal "))){T=`goal-command-${Date.now()}`,b({id:T,role:"user",content:P,timestamp:Date.now()});const Pe=P.slice(5).trim().split(/\s+/).filter(Boolean),U=(X=Pe[0])==null?void 0:X.toLowerCase();if(!U||U==="status"){const _=await re.getGoal(A);return C()&&e({goal:_}),C()}if(U==="clear")return await re.clearGoal(A),C()&&e({goal:null}),C();let Z;if(U==="pause")Z=await re.updateGoal(A,{action:"pause"});else if(U==="resume")Z=await re.updateGoal(A,{action:"resume"});else if(U==="edit"){const _=Pe.slice(1).join(" ").trim();if(!_)throw new Error("Usage: /goal edit <objective>");Z=await re.updateGoal(A,{action:"edit",objective:_})}else{const _=Pe.lastIndexOf("--budget");let Ge;if(_>=0){const on=Pe[_+1];if(!on||!/^[1-9]\d*$/.test(on))throw new Error("--budget requires a positive integer");Ge=Number(on),Pe.splice(_,2)}const Ne=Pe.join(" ").trim();if(!Ne)throw new Error("Usage: /goal <objective>");const{currentMode:Oe}=Pt.getState();Z=await re.createGoal(A,Ne,Ge,Oe)}return C()?(e({goal:Z.goal,...Z.runId?{currentRunId:Z.runId,isStreaming:!0,agentPhase:"running"}:{}}),!0):!1}T=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,b({id:T,role:"user",content:l2(l),timestamp:Date.now()}),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:g?t().recoveredSteeringCount:0});const{currentMode:B,currentModelId:M}=Pt.getState(),{modelId:fe,...ve}=l,ke=fe??M??void 0,ce=l.reasoningEffort,Fe=l.serviceTier,F=l.responseVerbosity,me=l.communicationStyle,Se=ke&&!g?{...ve,modelId:ke}:ve,Ee=await re.sendMessage(A,Se,B);return C()?(e({currentRunId:Ee.runId,pendingSteeringCount:Ee.status==="steering_queued"||Ee.status==="follow_up_queued"?Math.max(0,Ee.queued??1):t().pendingSteeringCount,pendingInputDelivery:Ee.status==="steering_queued"?"current_turn":Ee.status==="follow_up_queued"?"next_turn":t().pendingInputDelivery,sessions:(ke||ce||Fe||F||me)&&!g?t().sessions.map(Pe=>Pe.sessionId===A.sessionId&&Pe.projectPath===A.projectPath?{...Pe,...ke?{selectedModelId:ke}:{},...ce?{reasoningEffort:ce}:{},...Fe?{serviceTier:Fe}:{},...F?{responseVerbosity:F}:{},...me?{communicationStyle:me}:{}}:Pe):t().sessions}),!0):!1}catch(P){return Q&&a(Q),C()?T&&!t().messages.some(B=>B.id===T)?!0:(e(B=>({error:P.message,errorContext:{kind:"submission",sessionRef:A},messages:T?B.messages.filter(M=>M.id!==T):B.messages,...k})),!1):!1}},abortSession:async()=>{const{currentSessionRef:l,isStopping:d}=t();if(!l||d)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await re.abortSession(l),oe(t().currentSessionRef,l)?(t().unsubscribeFromEvents(),e({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),!0):!1}catch(m){return oe(t().currentSessionRef,l)&&e({isStopping:!1,error:m instanceof Error?m.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:l}}),!1}},pauseGoal:async()=>{const{currentSessionRef:l,isTemporarySession:d}=t();if(!l||d){e({error:"No persisted session is available for this goal"});return}try{const m=await re.updateGoal(l,{action:"pause"});if(!oe(t().currentSessionRef,l))return;e({goal:m.goal,error:null})}catch(m){if(!oe(t().currentSessionRef,l))return;e({error:m.message})}},resumeGoal:async()=>{const{currentSessionRef:l,isTemporarySession:d}=t();if(!l||d){e({error:"No persisted session is available for this goal"});return}try{const m=await re.updateGoal(l,{action:"resume"});if(!oe(t().currentSessionRef,l))return;e({goal:m.goal,error:null,...m.runId?{currentRunId:m.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(m){if(!oe(t().currentSessionRef,l))return;e({error:m.message})}},editGoal:async l=>{const{currentSessionRef:d,isTemporarySession:m}=t();if(!d||m){e({error:"No persisted session is available for this goal"});return}try{const p=await re.updateGoal(d,{action:"edit",objective:l});if(!oe(t().currentSessionRef,d))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!oe(t().currentSessionRef,d))return;e({error:p.message})}},clearGoal:async()=>{const{currentSessionRef:l,isTemporarySession:d}=t();if(!l||d){e({error:"No persisted session is available for this goal"});return}try{if(await re.clearGoal(l),!oe(t().currentSessionRef,l))return;e({goal:null,error:null})}catch(m){if(!oe(t().currentSessionRef,l))return;e({error:m.message})}}}},ey={authentication:"task.failure.authentication",permission:"task.failure.permission",rate_limit:"task.failure.rateLimit",timeout:"task.failure.timeout",network:"task.failure.network",model_unavailable:"task.failure.modelUnavailable",context_limit:"task.failure.contextLimit",unsupported_input:"task.failure.unsupportedInput",runtime:"task.failure.runtime"},u2={authentication:!1,permission:!1,rate_limit:!0,timeout:!0,network:!0,model_unavailable:!0,context_limit:!1,unsupported_input:!1,runtime:!0};function ty(e){if(typeof e=="string"&&Object.keys(ey).includes(e))return e}function ny(e){return ey[e]}function f2(e){return u2[e]}const m2={flushTimeout:80};class p2{constructor(t){Ja(this,"config");Ja(this,"channels",new Map);this.config={...m2,...t}}append(t,n,r){let s=this.channels.get(t);s||(s={buffer:"",timer:null,flushFn:null},this.channels.set(t,s)),s.buffer+=n,s.flushFn=r,s.timer||(s.timer=setTimeout(()=>{this.flushChannel(t)},this.config.flushTimeout))}flushChannel(t){const n=this.channels.get(t);if(!n||!n.buffer)return;const r=n.buffer,s=n.flushFn;n.buffer="",n.timer&&(clearTimeout(n.timer),n.timer=null),s==null||s(r)}drainAll(){for(const[t]of this.channels)this.flushChannel(t);this.channels.clear()}drainAllExcept(t){for(const[n]of this.channels)n!==t&&this.flushChannel(n);for(const[n,r]of this.channels)n!==t&&!r.buffer&&this.channels.delete(n)}reset(){for(const[,t]of this.channels)t.timer&&clearTimeout(t.timer);this.channels.clear()}}const wn=new p2,bt=(e,t,n)=>{if(t)for(const r of e){const s=Zn(r.agentContent).find(o=>o.id===t||o.sessionId===t);if(s)return{messageId:r.id,subagent:s}}if(n){const r=e.find(i=>i.id===n),s=Zn(r==null?void 0:r.agentContent),o=s.find(i=>i.status==="running")??s[s.length-1];if(o)return{messageId:n,subagent:o}}for(const r of[...e].reverse()){const s=Zn(r.agentContent),o=s.find(i=>i.status==="running")??s[s.length-1];if(o)return{messageId:r.id,subagent:o}}},Wt=(e,t,n)=>{const{currentAssistantMessageId:r,messages:s,addMessage:o,startAgentResponse:i}=e();if(r&&!r.startsWith("call_")&&s.some(m=>m.id===r&&m.role==="assistant"))return r;if(n){const m=s.find(p=>p.id===n&&p.role==="assistant");if(m)return i(m.id),m.id}const a=s[s.length-1];if((a==null?void 0:a.role)==="assistant")return a.id;const l=n||`assistant-${Date.now()}`,d={id:l,role:"assistant",content:"",timestamp:Date.now(),agentContent:Lt()};return o(d),i(l),t(m=>({messages:m.messages.map(p=>p.id===l?{...p,agentContent:{...p.agentContent||Lt()}}:p)})),l},g2=(e,t,n)=>{const{currentSessionId:r,addMessage:s,startAgentResponse:o,messages:i,updateMessage:a}=t();if(e.sessionId!==r)return;const l=e.messageId,d=e.role||"assistant",m=i.find(g=>g.id===l),p={id:l,role:d,content:e.content||"",timestamp:Date.now(),agentContent:d==="assistant"?Lt():void 0};m?a(l,{role:d,content:p.content,agentContent:d==="assistant"?{...m.agentContent||Lt()}:void 0}):s(p),d==="assistant"&&o(l)},h2=(e,t,n)=>{const{currentSessionId:r,appendDelta:s,currentAssistantMessageId:o,hasToolCalls:i,addMessage:a,startAgentResponse:l}=t();if(e.sessionId!==r)return;const d=e.messageId,m=e.delta;if(!o){const g={id:d,role:"assistant",content:"",timestamp:Date.now(),agentContent:Lt()};a(g),l(d),t().appendDelta(d,m,"before");return}s(o,m,i?"after":"before")},b2=(e,t)=>{const{currentSessionId:n,updateMessage:r,messages:s}=t();if(e.sessionId!==n)return;const o=e.messageId,i=s.find(a=>a.id===o);i!=null&&i.agentContent&&r(o,{content:VD(i.agentContent)})},k2=(e,t,n)=>{var l;const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.output;if(!s||typeof s!="object"||Array.isArray(s))return;const o=Wt(t,n,e.messageId);if(!o)return;const i=t().messages.find(d=>d.id===o);if(!i)return;const a=JSON.stringify(s,null,2);t().updateMessage(o,{content:a,metadata:{...i.metadata,structuredOutput:{output:s,schemaDigest:e.schemaDigest}},agentContent:i.agentContent?{...i.agentContent,textBefore:"",textAfter:"",timeline:(l=i.agentContent.timeline)==null?void 0:l.filter(d=>d.type!=="text")}:void 0})},x2=(e,t,n)=>{const{currentSessionId:r,appendThinking:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId);o&&s(o,e.delta)},y2=()=>{},ry=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s,setHasToolCalls:o,setSubagent:i}=t();if(e.sessionId!==r)return;const a=Wt(t,n,e.messageId||e.toolCallId);if(!a)return;o(!0);const l=e.toolName||"Unknown",d=e.arguments;let m,p="",g,x;if(l==="Task")try{const y=JSON.parse(d);m=y.subagent_type,p=y.description||y.query||m||"",g=y.subagent_session_id,x=y.resume_from||y.resume}catch{}if(m){i(a,{id:Da({explicitId:e.toolCallId,sessionId:g,messageId:a,agentType:m,description:p}),type:m,description:p,status:"running",startTime:Date.now(),sessionId:g,resumedFrom:x,output:"",thinking:""});return}const b={toolCallId:Kc({explicitId:e.toolCallId,messageId:a,toolName:l,argumentsValue:d,toolKind:e.toolKind}),toolName:l,arguments:d,toolKind:e.toolKind,status:"running",startTime:Date.now()};s(a,b)},sy=(e,t)=>{const{currentSessionId:n,updateToolCall:r,messages:s}=t();if(e.sessionId!==n)return;const o=e.toolCallId;if(!o)return;const i=s.find(a=>{var l;return(l=a.agentContent)==null?void 0:l.toolCalls.some(d=>d.toolCallId===o)});i&&r(i.id,o,{summary:e.message,progress:typeof e.progress=="number"?e.progress:void 0,progressTotal:typeof e.total=="number"?e.total:void 0,progressMessage:e.message})},oy=(e,t,n)=>{var O;const{currentSessionId:r,updateToolCall:s,updateSubagent:o,messages:i}=t();if(e.sessionId!==r)return;const a=e.toolCallId;if(!a)return;const l=i.find(R=>{var K;return(K=R.agentContent)==null?void 0:K.toolCalls.some(X=>X.toolCallId===a)}),d=i.find(R=>Zn(R.agentContent).some(K=>K.id===a)),m=e.messageId||(l==null?void 0:l.id)||(d==null?void 0:d.id)||((O=[...i].reverse().find(R=>R.role==="assistant"))==null?void 0:O.id);if(!m)return;const p=e.output,g=e.summary||(p&&p.trim()?p.trim().split(`
|
|
13
|
-
`)[0].slice(0,120):e.success?"执行成功":"执行失败");s(m,a,{status:e.success?"success":"error",summary:g,output:p,metadata:e.metadata});const x=i.find(R=>R.id===m),b=Zn(x==null?void 0:x.agentContent).find(R=>R.id===a),y=e.metadata,j=y&&typeof y.subagentSessionId=="string"?y.subagentSessionId:void 0,k=y&&typeof y.subagentStatus=="string"?y.subagentStatus:void 0,A=y&&typeof y.subagentType=="string"?y.subagentType:void 0,N=y&&typeof y.subagentSummary=="string"?y.subagentSummary:void 0,$=y&&typeof y.subagentResumedFrom=="string"?y.subagentResumedFrom:void 0,Q=y&&typeof y.subagentRootId=="string"?y.subagentRootId:void 0,T=y&&typeof y.subagentResumeDepth=="number"?y.subagentResumeDepth:void 0,C=(y==null?void 0:y.verificationVerdict)==="pass"||(y==null?void 0:y.verificationVerdict)==="fail"||(y==null?void 0:y.verificationVerdict)==="partial"?y.verificationVerdict:void 0;b&&o(m,b.id,{sessionId:b.sessionId||j,type:A||b.type,status:k?
|
|
14
|
-
`)})},
|
|
15
|
-
`)})},
|
|
16
|
-
`)})},
|
|
17
|
-
`)})},
|
|
18
|
-
`)})},
|
|
19
|
-
`)};if((b=(x=t().messages.find(y=>y.id===d))==null?void 0:x.agentContent)==null?void 0:b.toolCalls.some(y=>y.toolCallId===l)){o(d,l,p);return}s(d,{toolCallId:l,toolName:"MCP Task",arguments:JSON.stringify({taskId:i,serverName:e.serverName,toolName:e.toolName}),toolKind:"readonly",status:p.status,startTime:Number(e.createdAt)||Date.now(),summary:p.summary,output:p.output})},
|
|
20
|
-
`)})},
|
|
21
|
-
${l}`,metadata:{...i.metadata,userShellExecution:{...a,output:l,streamTruncated:e.streamTruncated===!0}}})}
|
|
11
|
+
`)}const QD=(e,t)=>({messages:[],setMessages:n=>e({messages:n}),addMessage:n=>e(r=>({messages:[...r.messages,n]})),updateMessage:(n,r)=>e(s=>({messages:s.messages.map(o=>o.id===n?{...o,...r}:o)})),appendDelta:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent||Lt();return s==="before"?{...i,agentContent:{...Bc(a,r),textBefore:a.textBefore+r}}:{...i,agentContent:{...Bc(a,r),textAfter:a.textAfter+r}}})})),appendToolCall:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:Hc(i,r)}})})),updateToolCall:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent;return a?{...i,agentContent:{...a,toolCalls:a.toolCalls.map(l=>l.toolCallId===r?{...l,...s}:l)}}:i})})),appendThinking:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:{...Yx(i,r),thinkingContent:i.thinkingContent+r}}})})),setConfirmation:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:{...i,confirmation:r}}})})),setQuestion:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:{...i,question:r}}})})),setElicitation:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:{...i,elicitation:r}}})})),setSubagent:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:r?Uc(i,r):wo(i,[])}})})),updateSubagent:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent||Lt(),l=[...Zn(a)],d=l.findIndex(g=>g.id===r||g.sessionId===r);if(d===-1)return i;const m=l[d],p=typeof s=="function"?s(m):s;return l[d]={...m,...p,id:m.id},{...i,agentContent:wo(a,l,l[d].id)}})})),setTasks:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Lt();return{...o,agentContent:{...i,tasks:r}}})})),replaceTemp:(n,r)=>e(s=>{const o=s.messages.findIndex(a=>a.content===n&&a.role==="user");if(o===-1)return s;const i=[...s.messages];return i[o]=r,{messages:i}})}),rc=60,YD=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function XD(e){let t=e;for(const l of YD)t=t.replace(l," ");t=t.replace(/^\s*\/[a-zA-Z][\w-]*\s+/,"");const n=t.replace(/\s+/g," ").trim();if(!n)return"";const r=n.match(/^(.+?)(?:[.!?]\s|[。!?](?=\S|$)|$)/);let s=r&&r[1].length>=6?r[1]:n;if(s=s.trim().replace(/[\s.。!!??,,;;::-]+$/,""),s.length<=rc)return s;const o=s.slice(0,rc),i=o.lastIndexOf(" ");return`${(i>rc*.6?o.slice(0,i):o).trimEnd()}…`}const Ei="/.blade/worktrees/",ZD=/-[a-f0-9]{8,}$/i,e2=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function t2(e){const t=e.indexOf(Ei);if(t<0)return null;const n=e.slice(t+Ei.length).split("/")[0];return n?`${e.slice(0,t+Ei.length)}${n}`:null}function n2(e){if(!e.includes("/tmp/")&&!e.includes("/T/"))return null;const t=e.split("/"),n=t.at(-1),r=n==null?void 0:n.match(e2);return r!=null&&r[1]?(t[t.length-1]=r[1],t.join("/")):null}function qc(e){const t=e.split("/").filter(Boolean).at(-1)||e;return e.includes(Ei)?t.replace(ZD,""):t}function fi(e,t=null){const n=e.taskSourceProjectPath,r=n2(n||e.projectPath);if(r)return r;if(n)return n;const s=t2(e.projectPath);if(!s)return e.projectPath;const o=qc(s);return t&&o===qc(t)?t:s}function r2(e,t,n=null){return t?e.filter(r=>fi(r,n)===t):e}const zc=hr.AUTO_EDIT;let sc=0;const Pt=ui((e,t)=>({currentModelId:null,currentMode:zc,configuredModels:[],availableModels:[],isLoading:!1,hasLoaded:!1,loadedWorkspacePath:null,error:null,loadModels:async n=>{const r=n??null;if(t().isLoading&&t().loadedWorkspacePath===r)return;const s=++sc;e({isLoading:!0,hasLoaded:!1,loadedWorkspacePath:r,error:null});try{const o=await pr("/models",n?{headers:{"x-blade-directory":n}}:void 0);if(s!==sc||t().loadedWorkspacePath!==r)return;const i=o.current;e({currentModelId:(i==null?void 0:i.id)||null,configuredModels:o.configured||[],availableModels:o.available||[],isLoading:!1,hasLoaded:!0})}catch(o){if(s!==sc||t().loadedWorkspacePath!==r)return;e({error:o instanceof Error?o.message:"Failed to load models",isLoading:!1,hasLoaded:!0})}},setCurrentModel:async(n,r)=>{if(e({error:null}),r){e({currentModelId:n});return}try{await pr("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:{currentModelId:n},options:{scope:"global"}})}),e({currentModelId:n})}catch(s){throw e({error:s instanceof Error?s.message:"Failed to set model"}),s}},setMode:n=>e({currentMode:n}),resetMode:()=>e({currentMode:zc})})),oc="__temp__",ao={inputTokens:0,outputTokens:0,totalTokens:0,maxContextTokens:0,isDefaultMaxTokens:!0,totalInputTokens:0,totalOutputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0};function pe(e){return{sessionId:e.sessionId,projectPath:e.projectPath}}function ze(e){return JSON.stringify([e.projectPath,e.sessionId])}function oe(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function eu(e,t){return e.find(n=>oe(pe(n),t))}function vn(e,t){const n=pe(t),r=e.findIndex(o=>oe(pe(o),n));if(r===-1)return[...e,t];const s=[...e];return s[r]=t,s}function uf(e,t){return e.filter(n=>!oe(pe(n),t))}const Xx="blade.tasks.unread",Ki="blade:open-session";function Zx(e){return e==="completed"||e==="failed"||e==="interrupted"}function s2(e,t,n){return!Zx(t)||n?!1:e!==t&&!(e==="completed"||e==="failed"||e==="interrupted"||e==="cancelled")}function o2(e=typeof localStorage>"u"?null:localStorage){if(!e)return[];try{const t=JSON.parse(e.getItem(Xx)??"[]");return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"))]:[]}catch{return[]}}function go(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(Xx,JSON.stringify([...new Set(e)]))}catch{}}function ff(e,t){const n=new Set(t.map(r=>ze({sessionId:r.sessionId,projectPath:r.projectPath})));return e.filter(r=>n.has(r))}function mf(e){if(typeof document>"u"||document.visibilityState!=="hidden"||typeof Notification>"u"||Notification.permission!=="granted")return!1;const t=new Notification(e.title,{body:e.body,icon:"/favicon.svg",tag:`blade-task-${ze(e.ref)}`});return t.onclick=()=>e.onOpen(e.ref),!0}function i2(e){if(typeof window>"u")return!1;const t=window.AudioContext??window.webkitAudioContext;if(!t)return!1;try{const n=new t,r=n.createOscillator(),s=n.createGain();return r.type="sine",r.frequency.value=e==="completed"?660:330,s.gain.setValueAtTime(1e-4,n.currentTime),s.gain.exponentialRampToValueAtTime(.045,n.currentTime+.015),s.gain.exponentialRampToValueAtTime(1e-4,n.currentTime+.18),r.connect(s),s.connect(n.destination),r.start(),r.stop(n.currentTime+.2),r.onended=()=>void n.close(),!0}catch{return!1}}const a2=2166136261,c2=16777619;function Kc(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>Kc(t)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${JSON.stringify(n)}:${Kc(r)}`).join(",")}}`:JSON.stringify(e)}function ey(e){let t=a2>>>0;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,c2);return(t>>>0).toString(16)}function ty(e){return typeof e=="string"?e:Kc(e??{})}function tu(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function Gc({explicitId:e,messageId:t,toolName:n,argumentsValue:r,toolKind:s,output:o}){if(e)return e;const i=[t||"unknown-message",n||"Unknown",ty(r),s||"",o||""].join("|");return`tool-${ey(i)}`}function Da({explicitId:e,sessionId:t,messageId:n,agentType:r,description:s,summary:o}){if(e)return e;if(t)return t;const i=[n||"unknown-message",r||"subagent",s||"",o||""].join("|");return`subagent-${ey(i)}`}const l2=(e,t)=>!t||typeof t!="object"?null:{id:Da({explicitId:typeof t.subagentId=="string"?t.subagentId:void 0,sessionId:t.childSessionId,messageId:e,agentType:t.agentType,description:t.description,summary:t.summary}),type:t.agentType||"subagent",description:t.description||t.summary||"",status:tu(t.status),startTime:Date.now(),sessionId:t.childSessionId,resumedFrom:t.resumedFrom,rootAgentId:t.rootAgentId,resumeDepth:typeof t.resumeDepth=="number"?t.resumeDepth:void 0,verificationVerdict:t.verificationVerdict==="pass"||t.verificationVerdict==="fail"||t.verificationVerdict==="partial"?t.verificationVerdict:void 0},d2=(e,t)=>!t||typeof t!="object"?[]:(Array.isArray(t.subtaskRefs)?t.subtaskRefs:t.subtaskRef&&typeof t.subtaskRef=="object"?[t.subtaskRef]:[]).map(r=>l2(e,r)).filter(r=>r!==null);function so(e){return typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
12
|
+
`)}function Pi(e){var r,s,o;const t=[];let n=null;for(const i of e)if(i.role!=="system"){if(i.role==="user")n&&(t.push(n),n=null),t.push({id:i.id,role:i.role,content:i.content,timestamp:i.timestamp||Date.now(),metadata:i.metadata});else if(i.role==="assistant"){n&&t.push(n);const a=i.metadata;let l=Lt();i.thinkingContent&&(l=Yx(l,i.thinkingContent),l.thinkingContent=i.thinkingContent);const d=so(i.content);d&&(l=Bc(l,d),l.textBefore=d);const m=d2(i.id,a);if(i.tool_calls&&Array.isArray(i.tool_calls))for(const p of i.tool_calls){const g=((r=p.function)==null?void 0:r.name)||"Unknown",x=ty((s=p.function)==null?void 0:s.arguments);if(g==="Task"){let y={};try{y=JSON.parse(x)}catch{}const j=typeof y.subagent_type=="string"?y.subagent_type:"subagent",k=typeof y.description=="string"?y.description:j;l=Uc(l,{id:Da({explicitId:p.id,sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,messageId:i.id,agentType:j,description:k}),type:j,description:k,status:"running",startTime:Date.now(),sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,resumedFrom:typeof y.resume_from=="string"?y.resume_from:typeof y.resume=="string"?y.resume:void 0});continue}const b={toolCallId:Gc({explicitId:p.id,messageId:i.id,toolName:g,argumentsValue:(o=p.function)==null?void 0:o.arguments}),toolName:g,arguments:x,status:"running",startTime:Date.now()};l=Hc(l,b)}for(const p of m)l=Uc(l,p);n={id:i.id,role:"assistant",content:so(i.content),timestamp:i.timestamp||Date.now(),metadata:a,agentContent:l}}else if(i.role==="tool"&&n&&n.agentContent){const a=i,l=i.metadata,d=a.tool_call_id||(l==null?void 0:l.toolCallId),m=a.name||(l==null?void 0:l.toolName)||"Tool",p=l!=null&&l.metadata&&typeof l.metadata=="object"&&!Array.isArray(l.metadata)?l.metadata:void 0,g=l!=null&&l.independentVerification&&typeof l.independentVerification=="object"&&!Array.isArray(l.independentVerification)?l.independentVerification:void 0,x=typeof(l==null?void 0:l.error)=="string"&&l.error.length>0,b=Zn(n.agentContent),y=b.findIndex(k=>k.id===d);if(y>=0){const k=b[y],A=typeof(p==null?void 0:p.subagentStatus)=="string"?tu(p.subagentStatus):x?"failed":"completed";b[y]={...k,sessionId:typeof(p==null?void 0:p.subagentSessionId)=="string"?p.subagentSessionId:k.sessionId,type:typeof(p==null?void 0:p.subagentType)=="string"?p.subagentType:k.type,status:A,resumedFrom:typeof(p==null?void 0:p.subagentResumedFrom)=="string"?p.subagentResumedFrom:k.resumedFrom,rootAgentId:typeof(p==null?void 0:p.subagentRootId)=="string"?p.subagentRootId:k.rootAgentId,resumeDepth:typeof(p==null?void 0:p.subagentResumeDepth)=="number"?p.subagentResumeDepth:k.resumeDepth,verificationVerdict:(p==null?void 0:p.verificationVerdict)==="pass"||(p==null?void 0:p.verificationVerdict)==="fail"||(p==null?void 0:p.verificationVerdict)==="partial"?p.verificationVerdict:(g==null?void 0:g.verificationVerdict)==="pass"||(g==null?void 0:g.verificationVerdict)==="fail"||(g==null?void 0:g.verificationVerdict)==="partial"?g.verificationVerdict:k.verificationVerdict},n.agentContent=wo(n.agentContent,b,k.id);continue}const j=n.agentContent.toolCalls.find(k=>k.toolCallId===d);j?(j.output=so(i.content),j.status=x?"error":"success",j.metadata=p,j.summary=typeof(p==null?void 0:p.summary)=="string"?p.summary:j.summary,(!j.toolName||j.toolName==="Unknown")&&(j.toolName=m)):n.agentContent=Hc(n.agentContent,{toolCallId:Gc({explicitId:d,messageId:n.id,toolName:m,output:so(i.content)}),toolName:m,output:so(i.content),status:x?"error":"success",startTime:Date.now(),metadata:p,summary:typeof(p==null?void 0:p.summary)=="string"?p.summary:void 0})}}return n&&t.push(n),t}const u2=e=>{var n;const t=[];e.content.trim()&&t.push({type:"text",text:e.content});for(const r of e.attachments??[])r.type==="image"&&t.push({type:"image_url",image_url:{url:r.content}});return t.length===0?e.content:t.length===1&&((n=t[0])==null?void 0:n.type)==="text"?t[0].text:t},Si=()=>({eventUnsubscribe:null,sessionEventConnectionState:"idle",isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),pf=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)}),f2=(e,t)=>{let n=0,r=0,s=0;const o=()=>(n+=1,n),i=l=>l===n,a=l=>{try{l()}catch(d){console.warn("Failed to clean up stale event subscription",d)}};return{sessions:[],archivedSessions:[],currentSessionId:null,currentSessionRef:null,forkingSessionRef:null,isTemporarySession:!1,isLoading:!1,catalogLoadState:"idle",catalogError:null,archivedCatalogLoadState:"idle",archivedCatalogError:null,error:null,errorContext:null,goal:null,setSessions:l=>e({sessions:l}),addSession:l=>e(d=>({sessions:vn(d.sessions,l)})),removeSession:l=>{const d=t();d.markTaskRead(l);const m=oe(d.currentSessionRef,l),p=oe(d.forkingSessionRef,l);(m||p)&&o(),m&&d.unsubscribeFromEvents(),e(g=>({sessions:uf(g.sessions,l),currentSessionId:m?null:g.currentSessionId,currentSessionRef:m?null:g.currentSessionRef,messages:m?[]:g.messages,goal:m?null:g.goal,forkingSessionRef:p?null:g.forkingSessionRef,...m?Si():{}}))},setCurrentSession:l=>{o(),e({currentSessionId:(l==null?void 0:l.sessionId)??null,currentSessionRef:l,isTemporarySession:!1})},setTemporarySession:l=>e({isTemporarySession:l}),setLoading:l=>e({isLoading:l}),setError:l=>e({error:l,errorContext:null}),getNavigationVersion:()=>n,clearError:()=>e({error:null,errorContext:null}),setGoal:l=>e({goal:l}),startTemporarySession:l=>{o(),t().unsubscribeFromEvents(),Pt.getState().resetMode(),l&&t().selectProject(l),e({currentSessionId:oc,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,tokenUsage:{...ao},error:null,errorContext:null,...Si()})},loadSessions:async()=>{const l=++r,d=new Set(t().sessions.map(p=>ze(pe(p)))),m=new Set;e({catalogLoadState:"loading",catalogError:null});try{let p,g=!0;do{const y=await re.listSessionPage(p);if(l!==r)return;for(const j of y.sessions)m.add(ze(pe(j)));if(e(j=>{const k=new Set(y.sessions.map(N=>ze(pe(N))));return{sessions:g?[...y.sessions,...j.sessions.filter(N=>!k.has(ze(pe(N))))]:y.sessions.reduce((N,$)=>vn(N,$),j.sessions),catalogLoadState:y.nextCursor?"hydrating":"ready"}}),g=!1,p=y.nextCursor,p&&(await pf(),l!==r))return}while(p);if(l!==r)return;const x=t().sessions.filter(y=>{const j=ze(pe(y));return m.has(j)||!d.has(j)}),b=ff(t().unreadTaskKeys,x);go(b),e({sessions:x,unreadTaskKeys:b,catalogLoadState:"ready",catalogError:null})}catch(p){if(l!==r)return;e({catalogLoadState:"error",catalogError:p.message})}},loadArchivedSessions:async()=>{const l=++s;e({archivedCatalogLoadState:"loading",archivedCatalogError:null});try{let d;const m=[];do{const p=await re.listSessionPage(d,50,!0);if(l!==s)return;for(const g of p.sessions){const x=m.findIndex(b=>oe(pe(b),pe(g)));x===-1?m.push(g):m[x]=g}d=p.nextCursor,d&&(e({archivedCatalogLoadState:"hydrating"}),await pf())}while(d);if(l!==s)return;e({archivedSessions:m,archivedCatalogLoadState:"ready",archivedCatalogError:null})}catch(d){if(l!==s)return;e({archivedCatalogLoadState:"error",archivedCatalogError:d.message})}},selectSession:async l=>{var m;const d=o();e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});try{const p=eu(t().sessions,l),[g,x,b]=await Promise.all([re.getMessages(l),re.getGoal(l).catch(()=>null),p?Promise.resolve(p):re.getSession(l)]);if(!i(d))return;const y=Pi(g),j=[];let k=!1;const A=await t().prepareEventSubscription(l,$=>{k?t().handleEvent($):j.push($)});if(!i(d)){a(A);return}const N=fi(b,t().selectedProjectPath??((m=t().taskWorkspaceInfo)==null?void 0:m.cwd)??null);t().boundProjects.some($=>$.available&&$.path===N)&&t().selectProject(N),Pt.getState().setMode(b.permissionMode??zc),e($=>{var Q;return{currentSessionId:l.sessionId,currentSessionRef:l,isTemporarySession:!1,messages:y,goal:x,isLoading:!1,tokenUsage:{...ao},isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,error:b.taskStatus==="failed"?((Q=b.taskFailure)==null?void 0:Q.message)??null:null,errorContext:b.taskStatus==="failed"&&b.taskFailure?{kind:"execution",sessionRef:l,failureCode:b.taskFailure.code}:null,sessions:vn($.sessions,b)}}),t().markTaskRead(l),k=!0,t().replaceEventSubscription(A);for(const $ of j)t().handleEvent($)}catch(p){if(!i(d))return;e({error:p.message,errorContext:{kind:"navigation",sessionRef:l},isLoading:!1})}},archiveSession:async l=>{var d;try{const m=await re.archiveSession(l),p=new Set(m.archivedSessionIds),g=t(),x=((d=g.currentSessionRef)==null?void 0:d.projectPath)===l.projectPath&&p.has(g.currentSessionRef.sessionId);x&&(o(),g.unsubscribeFromEvents()),e(b=>{const y=b.sessions.filter(k=>k.projectPath!==l.projectPath||!p.has(k.sessionId)),j=ff(b.unreadTaskKeys,y);return go(j),{sessions:y,archivedSessions:vn(b.archivedSessions,m.session),unreadTaskKeys:j,currentSessionId:x?null:b.currentSessionId,currentSessionRef:x?null:b.currentSessionRef,messages:x?[]:b.messages,goal:x?null:b.goal,...x?Si():{}}}),await t().loadArchivedSessions()}catch(m){e({error:m.message,errorContext:{kind:"task_action",sessionRef:l}})}},unarchiveSession:async l=>{try{const d=await re.unarchiveSession(l),m=new Set(d.restoredSessionIds);e(p=>({archivedSessions:p.archivedSessions.filter(g=>g.projectPath!==l.projectPath||!m.has(g.sessionId)),sessions:vn(p.sessions,d.session)})),await Promise.all([t().loadSessions(),t().loadArchivedSessions()])}catch(d){e({error:d.message,errorContext:{kind:"task_action",sessionRef:l}})}},deleteSession:async l=>{const d=t(),m=oe(d.currentSessionRef,l),p=oe(d.forkingSessionRef,l),g=m||p?o():null,x=m?g:null;p&&e({forkingSessionRef:null});try{await re.deleteSession(l),t().markTaskRead(l);const b=t(),y=oe(b.currentSessionRef,l)&&(x===null||i(x));y&&(o(),b.unsubscribeFromEvents()),e(j=>({sessions:uf(j.sessions,l),currentSessionId:y?null:j.currentSessionId,currentSessionRef:y?null:j.currentSessionRef,messages:y?[]:j.messages,goal:y?null:j.goal,...y?Si():{}}))}catch(b){if(x!==null&&(!i(x)||!oe(t().currentSessionRef,l)))return;e({error:b.message})}},updateSession:async(l,d)=>{try{await re.updateSession(l,d),e(m=>({sessions:m.sessions.map(p=>p.sessionId===l.sessionId&&p.projectPath===l.projectPath?{...p,title:d}:p)}))}catch(m){e({error:m.message})}},forkSession:async l=>{const d=o(),m=pe(l);e({forkingSessionRef:m,isLoading:!1,error:null});let p=null;try{const g=await re.forkSession(l),x=pe(g.session),b=Pi(g.messages);if(e(y=>({sessions:vn(y.sessions,g.session)})),!i(d))return;if(p=await t().prepareEventSubscription(x),!i(d)){a(p),p=null;return}e({currentSessionId:x.sessionId,currentSessionRef:x,isTemporarySession:!1,messages:b,goal:null,tokenUsage:{...ao},error:null,forkingSessionRef:null}),t().replaceEventSubscription(p),p=null}catch(g){if(p&&a(p),!i(d))return;e({error:g.message,forkingSessionRef:null})}},rewindSession:async(l,d)=>{const{currentSessionRef:m,isTemporarySession:p,isStreaming:g}=t();if(!m||p)return e({error:"No persisted session is available for rewind"}),!1;if(g)return e({error:"Stop the active run before rewinding"}),!1;const x=n;try{const b=await re.rewindSession(m,l,d);if(!i(x)||!oe(t().currentSessionRef,m))return!1;const y=Pi(b.messages);return e(j=>({messages:y,tokenUsage:{...ao},error:null,currentRunId:null,agentPhase:"idle",pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,sessions:j.sessions.map(k=>k.sessionId===m.sessionId&&k.projectPath===m.projectPath?{...k,messageCount:y.length}:k)})),!0}catch(b){return!i(x)||!oe(t().currentSessionRef,m)||e({error:b.message}),!1}},sendMessage:async l=>{var O,R,K,X;const{currentSessionId:d,currentSessionRef:m,isTemporarySession:p,isStreaming:g,addSession:x,addMessage:b}=t(),y=n,j=m,k={isStreaming:g,agentPhase:t().agentPhase,currentRunId:t().currentRunId};let A=m,N=d,$=j,Q=null,T=null;const C=()=>i(y)&&oe(t().currentSessionRef,$);if(p||!N||N===oc)try{const P=XD(l.content),B=await re.createSession(t().selectedProjectPath??((O=t().taskWorkspaceInfo)==null?void 0:O.cwd)??void 0,P||void 0);if(x(B),!C())return!1;A=pe(B),N=B.sessionId,e({currentSessionId:B.sessionId,currentSessionRef:A,isTemporarySession:!1}),$=A}catch(P){return C()&&e({error:P.message}),!1}if(!A||!N||N===oc)return C()&&e({error:"Failed to create session"}),!1;try{if(!g){if(Q=await t().prepareEventSubscription(A),!C())return a(Q),Q=null,!1;t().replaceEventSubscription(Q),Q=null}if(!C())return!1;const P=l.content.trim();if(P.startsWith("!")){if((((R=l.attachments)==null?void 0:R.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const Pe=P.slice(1).trim();if(!Pe)throw new Error("User shell command cannot be empty");g||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const U=await re.executeUserShellCommand(A,Pe);return C()?(U.auxiliary||e({isStreaming:!1,agentPhase:"idle"}),U.delivery&&e({pendingSteeringCount:U.queued??0,pendingInputDelivery:U.delivery==="current_turn"?"current_turn":"next_turn"}),!0):!1}if((((K=l.attachments)==null?void 0:K.length)??0)===0&&(P==="/goal"||P.startsWith("/goal "))){T=`goal-command-${Date.now()}`,b({id:T,role:"user",content:P,timestamp:Date.now()});const Pe=P.slice(5).trim().split(/\s+/).filter(Boolean),U=(X=Pe[0])==null?void 0:X.toLowerCase();if(!U||U==="status"){const _=await re.getGoal(A);return C()&&e({goal:_}),C()}if(U==="clear")return await re.clearGoal(A),C()&&e({goal:null}),C();let Z;if(U==="pause")Z=await re.updateGoal(A,{action:"pause"});else if(U==="resume")Z=await re.updateGoal(A,{action:"resume"});else if(U==="edit"){const _=Pe.slice(1).join(" ").trim();if(!_)throw new Error("Usage: /goal edit <objective>");Z=await re.updateGoal(A,{action:"edit",objective:_})}else{const _=Pe.lastIndexOf("--budget");let Ge;if(_>=0){const on=Pe[_+1];if(!on||!/^[1-9]\d*$/.test(on))throw new Error("--budget requires a positive integer");Ge=Number(on),Pe.splice(_,2)}const Ne=Pe.join(" ").trim();if(!Ne)throw new Error("Usage: /goal <objective>");const{currentMode:Oe}=Pt.getState();Z=await re.createGoal(A,Ne,Ge,Oe)}return C()?(e({goal:Z.goal,...Z.runId?{currentRunId:Z.runId,isStreaming:!0,agentPhase:"running"}:{}}),!0):!1}T=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,b({id:T,role:"user",content:u2(l),timestamp:Date.now()}),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:g?t().recoveredSteeringCount:0});const{currentMode:B,currentModelId:M}=Pt.getState(),{modelId:fe,...ve}=l,ke=fe??M??void 0,ce=l.reasoningEffort,Fe=l.serviceTier,F=l.responseVerbosity,me=l.communicationStyle,Se=ke&&!g?{...ve,modelId:ke}:ve,Ee=await re.sendMessage(A,Se,B);return C()?(e({currentRunId:Ee.runId,pendingSteeringCount:Ee.status==="steering_queued"||Ee.status==="follow_up_queued"?Math.max(0,Ee.queued??1):t().pendingSteeringCount,pendingInputDelivery:Ee.status==="steering_queued"?"current_turn":Ee.status==="follow_up_queued"?"next_turn":t().pendingInputDelivery,sessions:(ke||ce||Fe||F||me)&&!g?t().sessions.map(Pe=>Pe.sessionId===A.sessionId&&Pe.projectPath===A.projectPath?{...Pe,...ke?{selectedModelId:ke}:{},...ce?{reasoningEffort:ce}:{},...Fe?{serviceTier:Fe}:{},...F?{responseVerbosity:F}:{},...me?{communicationStyle:me}:{}}:Pe):t().sessions}),!0):!1}catch(P){return Q&&a(Q),C()?T&&!t().messages.some(B=>B.id===T)?!0:(e(B=>({error:P.message,errorContext:{kind:"submission",sessionRef:A},messages:T?B.messages.filter(M=>M.id!==T):B.messages,...k})),!1):!1}},abortSession:async()=>{const{currentSessionRef:l,isStopping:d}=t();if(!l||d)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await re.abortSession(l),oe(t().currentSessionRef,l)?(t().unsubscribeFromEvents(),e({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),!0):!1}catch(m){return oe(t().currentSessionRef,l)&&e({isStopping:!1,error:m instanceof Error?m.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:l}}),!1}},pauseGoal:async()=>{const{currentSessionRef:l,isTemporarySession:d}=t();if(!l||d){e({error:"No persisted session is available for this goal"});return}try{const m=await re.updateGoal(l,{action:"pause"});if(!oe(t().currentSessionRef,l))return;e({goal:m.goal,error:null})}catch(m){if(!oe(t().currentSessionRef,l))return;e({error:m.message})}},resumeGoal:async()=>{const{currentSessionRef:l,isTemporarySession:d}=t();if(!l||d){e({error:"No persisted session is available for this goal"});return}try{const m=await re.updateGoal(l,{action:"resume"});if(!oe(t().currentSessionRef,l))return;e({goal:m.goal,error:null,...m.runId?{currentRunId:m.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(m){if(!oe(t().currentSessionRef,l))return;e({error:m.message})}},editGoal:async l=>{const{currentSessionRef:d,isTemporarySession:m}=t();if(!d||m){e({error:"No persisted session is available for this goal"});return}try{const p=await re.updateGoal(d,{action:"edit",objective:l});if(!oe(t().currentSessionRef,d))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!oe(t().currentSessionRef,d))return;e({error:p.message})}},clearGoal:async()=>{const{currentSessionRef:l,isTemporarySession:d}=t();if(!l||d){e({error:"No persisted session is available for this goal"});return}try{if(await re.clearGoal(l),!oe(t().currentSessionRef,l))return;e({goal:null,error:null})}catch(m){if(!oe(t().currentSessionRef,l))return;e({error:m.message})}}}},ny={authentication:"task.failure.authentication",permission:"task.failure.permission",rate_limit:"task.failure.rateLimit",timeout:"task.failure.timeout",network:"task.failure.network",model_unavailable:"task.failure.modelUnavailable",context_limit:"task.failure.contextLimit",unsupported_input:"task.failure.unsupportedInput",runtime:"task.failure.runtime"},m2={authentication:!1,permission:!1,rate_limit:!0,timeout:!0,network:!0,model_unavailable:!0,context_limit:!1,unsupported_input:!1,runtime:!0};function ry(e){if(typeof e=="string"&&Object.keys(ny).includes(e))return e}function sy(e){return ny[e]}function p2(e){return m2[e]}const g2={flushTimeout:80};class h2{constructor(t){Ja(this,"config");Ja(this,"channels",new Map);this.config={...g2,...t}}append(t,n,r){let s=this.channels.get(t);s||(s={buffer:"",timer:null,flushFn:null},this.channels.set(t,s)),s.buffer+=n,s.flushFn=r,s.timer||(s.timer=setTimeout(()=>{this.flushChannel(t)},this.config.flushTimeout))}flushChannel(t){const n=this.channels.get(t);if(!n||!n.buffer)return;const r=n.buffer,s=n.flushFn;n.buffer="",n.timer&&(clearTimeout(n.timer),n.timer=null),s==null||s(r)}drainAll(){for(const[t]of this.channels)this.flushChannel(t);this.channels.clear()}drainAllExcept(t){for(const[n]of this.channels)n!==t&&this.flushChannel(n);for(const[n,r]of this.channels)n!==t&&!r.buffer&&this.channels.delete(n)}reset(){for(const[,t]of this.channels)t.timer&&clearTimeout(t.timer);this.channels.clear()}}const wn=new h2,bt=(e,t,n)=>{if(t)for(const r of e){const s=Zn(r.agentContent).find(o=>o.id===t||o.sessionId===t);if(s)return{messageId:r.id,subagent:s}}if(n){const r=e.find(i=>i.id===n),s=Zn(r==null?void 0:r.agentContent),o=s.find(i=>i.status==="running")??s[s.length-1];if(o)return{messageId:n,subagent:o}}for(const r of[...e].reverse()){const s=Zn(r.agentContent),o=s.find(i=>i.status==="running")??s[s.length-1];if(o)return{messageId:r.id,subagent:o}}},Wt=(e,t,n)=>{const{currentAssistantMessageId:r,messages:s,addMessage:o,startAgentResponse:i}=e();if(r&&!r.startsWith("call_")&&s.some(m=>m.id===r&&m.role==="assistant"))return r;if(n){const m=s.find(p=>p.id===n&&p.role==="assistant");if(m)return i(m.id),m.id}const a=s[s.length-1];if((a==null?void 0:a.role)==="assistant")return a.id;const l=n||`assistant-${Date.now()}`,d={id:l,role:"assistant",content:"",timestamp:Date.now(),agentContent:Lt()};return o(d),i(l),t(m=>({messages:m.messages.map(p=>p.id===l?{...p,agentContent:{...p.agentContent||Lt()}}:p)})),l},b2=(e,t,n)=>{const{currentSessionId:r,addMessage:s,startAgentResponse:o,messages:i,updateMessage:a}=t();if(e.sessionId!==r)return;const l=e.messageId,d=e.role||"assistant",m=i.find(g=>g.id===l),p={id:l,role:d,content:e.content||"",timestamp:Date.now(),agentContent:d==="assistant"?Lt():void 0};m?a(l,{role:d,content:p.content,agentContent:d==="assistant"?{...m.agentContent||Lt()}:void 0}):s(p),d==="assistant"&&o(l)},k2=(e,t,n)=>{const{currentSessionId:r,appendDelta:s,currentAssistantMessageId:o,hasToolCalls:i,addMessage:a,startAgentResponse:l}=t();if(e.sessionId!==r)return;const d=e.messageId,m=e.delta;if(!o){const g={id:d,role:"assistant",content:"",timestamp:Date.now(),agentContent:Lt()};a(g),l(d),t().appendDelta(d,m,"before");return}s(o,m,i?"after":"before")},x2=(e,t)=>{const{currentSessionId:n,updateMessage:r,messages:s}=t();if(e.sessionId!==n)return;const o=e.messageId,i=s.find(a=>a.id===o);i!=null&&i.agentContent&&r(o,{content:JD(i.agentContent)})},y2=(e,t,n)=>{var l;const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.output;if(!s||typeof s!="object"||Array.isArray(s))return;const o=Wt(t,n,e.messageId);if(!o)return;const i=t().messages.find(d=>d.id===o);if(!i)return;const a=JSON.stringify(s,null,2);t().updateMessage(o,{content:a,metadata:{...i.metadata,structuredOutput:{output:s,schemaDigest:e.schemaDigest}},agentContent:i.agentContent?{...i.agentContent,textBefore:"",textAfter:"",timeline:(l=i.agentContent.timeline)==null?void 0:l.filter(d=>d.type!=="text")}:void 0})},S2=(e,t,n)=>{const{currentSessionId:r,appendThinking:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId);o&&s(o,e.delta)},w2=()=>{},oy=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s,setHasToolCalls:o,setSubagent:i}=t();if(e.sessionId!==r)return;const a=Wt(t,n,e.messageId||e.toolCallId);if(!a)return;o(!0);const l=e.toolName||"Unknown",d=e.arguments;let m,p="",g,x;if(l==="Task")try{const y=JSON.parse(d);m=y.subagent_type,p=y.description||y.query||m||"",g=y.subagent_session_id,x=y.resume_from||y.resume}catch{}if(m){i(a,{id:Da({explicitId:e.toolCallId,sessionId:g,messageId:a,agentType:m,description:p}),type:m,description:p,status:"running",startTime:Date.now(),sessionId:g,resumedFrom:x,output:"",thinking:""});return}const b={toolCallId:Gc({explicitId:e.toolCallId,messageId:a,toolName:l,argumentsValue:d,toolKind:e.toolKind}),toolName:l,arguments:d,toolKind:e.toolKind,status:"running",startTime:Date.now()};s(a,b)},iy=(e,t)=>{const{currentSessionId:n,updateToolCall:r,messages:s}=t();if(e.sessionId!==n)return;const o=e.toolCallId;if(!o)return;const i=s.find(a=>{var l;return(l=a.agentContent)==null?void 0:l.toolCalls.some(d=>d.toolCallId===o)});i&&r(i.id,o,{summary:e.message,progress:typeof e.progress=="number"?e.progress:void 0,progressTotal:typeof e.total=="number"?e.total:void 0,progressMessage:e.message})},ay=(e,t,n)=>{var O;const{currentSessionId:r,updateToolCall:s,updateSubagent:o,messages:i}=t();if(e.sessionId!==r)return;const a=e.toolCallId;if(!a)return;const l=i.find(R=>{var K;return(K=R.agentContent)==null?void 0:K.toolCalls.some(X=>X.toolCallId===a)}),d=i.find(R=>Zn(R.agentContent).some(K=>K.id===a)),m=e.messageId||(l==null?void 0:l.id)||(d==null?void 0:d.id)||((O=[...i].reverse().find(R=>R.role==="assistant"))==null?void 0:O.id);if(!m)return;const p=e.output,g=e.summary||(p&&p.trim()?p.trim().split(`
|
|
13
|
+
`)[0].slice(0,120):e.success?"执行成功":"执行失败");s(m,a,{status:e.success?"success":"error",summary:g,output:p,metadata:e.metadata});const x=i.find(R=>R.id===m),b=Zn(x==null?void 0:x.agentContent).find(R=>R.id===a),y=e.metadata,j=y&&typeof y.subagentSessionId=="string"?y.subagentSessionId:void 0,k=y&&typeof y.subagentStatus=="string"?y.subagentStatus:void 0,A=y&&typeof y.subagentType=="string"?y.subagentType:void 0,N=y&&typeof y.subagentSummary=="string"?y.subagentSummary:void 0,$=y&&typeof y.subagentResumedFrom=="string"?y.subagentResumedFrom:void 0,Q=y&&typeof y.subagentRootId=="string"?y.subagentRootId:void 0,T=y&&typeof y.subagentResumeDepth=="number"?y.subagentResumeDepth:void 0,C=(y==null?void 0:y.verificationVerdict)==="pass"||(y==null?void 0:y.verificationVerdict)==="fail"||(y==null?void 0:y.verificationVerdict)==="partial"?y.verificationVerdict:void 0;b&&o(m,b.id,{sessionId:b.sessionId||j,type:A||b.type,status:k?tu(k):e.success?"completed":"failed",resumedFrom:$||b.resumedFrom,rootAgentId:Q||b.rootAgentId,resumeDepth:T??b.resumeDepth,verificationVerdict:C??b.verificationVerdict}),j&&k&&n(R=>({messages:R.messages.map(K=>{if(K.id!==m)return K;const X=K.metadata??{},P=Array.isArray(X.subtaskRefs)?X.subtaskRefs:[],B=P.findIndex(ke=>ke.childSessionId===j||ke.subagentId===a),M=B>=0?P[B]:X.subtaskRef??{},fe={...M,subagentId:a,childSessionId:j,agentType:A||(typeof(M==null?void 0:M.agentType)=="string"?M.agentType:"subagent"),status:k,summary:N||(typeof(M==null?void 0:M.summary)=="string"?M.summary:""),resumedFrom:$||(typeof(M==null?void 0:M.resumedFrom)=="string"?M.resumedFrom:void 0),rootAgentId:Q||(typeof(M==null?void 0:M.rootAgentId)=="string"?M.rootAgentId:j),resumeDepth:T??(typeof(M==null?void 0:M.resumeDepth)=="number"?M.resumeDepth:0),verificationVerdict:C||(typeof(M==null?void 0:M.verificationVerdict)=="string"?M.verificationVerdict:void 0)},ve=[...P];return B>=0?ve[B]=fe:ve.push(fe),{...K,metadata:{...X,subtaskRef:fe,subtaskRefs:ve}}})}))},v2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-catalog-${String(e.revision)}`);if(!o)return;const i=Array.isArray(e.added)?e.added.map(String):[],a=Array.isArray(e.removed)?e.removed.map(String):[],l=Array.isArray(e.updated)?e.updated.map(String):[],d=`MCP catalog r${String(e.revision)}: +${i.length} -${a.length} ~${l.length}`;s(o,{toolCallId:`mcp-catalog:${String(e.revision)}`,toolName:"MCP Catalog",arguments:JSON.stringify({serverName:e.serverName,added:i,removed:a,updated:l}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:d,output:[i.length>0?`Added: ${i.join(", ")}`:"",a.length>0?`Removed: ${a.join(", ")}`:"",l.length>0?`Updated: ${l.join(", ")}`:""].filter(Boolean).join(`
|
|
14
|
+
`)})},I2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-content-${String(e.revision)}`);if(!o)return;const i=Array.isArray(e.added)?e.added.map(String):[],a=Array.isArray(e.removed)?e.removed.map(String):[],l=Array.isArray(e.updated)?e.updated.map(String):[],d=`MCP ${String(e.contentKind)} r${String(e.revision)}: +${i.length} -${a.length} ~${l.length}`;s(o,{toolCallId:`mcp-content:${String(e.revision)}`,toolName:"MCP Content",arguments:JSON.stringify({serverName:e.serverName,contentKind:e.contentKind,added:i,removed:a,updated:l}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:d,output:[i.length>0?`Added: ${i.join(", ")}`:"",a.length>0?`Removed: ${a.join(", ")}`:"",l.length>0?`Updated: ${l.join(", ")}`:""].filter(Boolean).join(`
|
|
15
|
+
`)})},C2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-resource-${String(e.revision)}`);o&&s(o,{toolCallId:`mcp-resource:${String(e.revision)}`,toolName:"MCP Resource",arguments:JSON.stringify({serverName:e.serverName,uri:e.uri}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP resource updated: ${String(e.uri)}`,output:`${String(e.serverName)} · revision ${String(e.revision)}`})},j2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-connection-${String(e.revision)}`);if(!o)return;const i=String(e.phase),a=`MCP ${String(e.serverName)} ${i}`+(i==="reconnecting"?` (${String(e.attempt)}/${String(e.maxAttempts)})`:"");s(o,{toolCallId:`mcp-connection:${String(e.revision)}`,toolName:"MCP Connection",arguments:JSON.stringify({serverName:e.serverName,phase:i,reason:e.reason,attempt:e.attempt,maxAttempts:e.maxAttempts}),toolKind:"readonly",status:i==="failed"?"error":"success",startTime:Date.now(),summary:a,output:[`Reason: ${String(e.reason)}`,e.error?`Error: ${String(e.error)}`:""].filter(Boolean).join(`
|
|
16
|
+
`)})},T2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-log-${String(e.revision)}`);if(!o)return;const i=String(e.level),a=typeof e.logger=="string"?e.logger:void 0,l=`MCP ${i} · ${String(e.serverName)}`+(a?` · ${a}`:"");s(o,{toolCallId:`mcp-log:${String(e.revision)}`,toolName:"MCP Log",arguments:JSON.stringify({serverName:e.serverName,level:i,logger:a}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:l,output:[String(e.message),`SHA-256: ${String(e.dataSha256)}`,e.truncated===!0?"Truncated":"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
|
|
17
|
+
`)})},A2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=String(e.serverName),i=String(e.action),a=Wt(t,n,e.messageId||`mcp-instructions-${String(e.revision)}-${o}`);if(!a)return;const l=`MCP instructions ${i}: ${o}`+(e.truncated===!0?" (truncated)":"");s(a,{toolCallId:`mcp-instructions:${String(e.revision)}:${o}:${i}`,toolName:"MCP Instructions",arguments:JSON.stringify({serverName:o,action:i,reason:e.reason}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:l,output:[typeof e.text=="string"?e.text:"",e.sha256?`SHA-256: ${String(e.sha256)}`:"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
|
|
18
|
+
`)})},E2=(e,t,n)=>{var x,b;const{currentSessionId:r,appendToolCall:s,updateToolCall:o}=t();if(e.sessionId!==r)return;const i=String(e.taskId),a=String(e.status),l=`mcp-task:${i}`,d=Wt(t,n,e.messageId||`mcp-task-${i}`);if(!d)return;const m=`MCP task ${a}: ${i} · ${String(e.serverName)}/${String(e.toolName)}`,p={status:a==="failed"||a==="cancelled"?"error":a==="completed"?"success":"running",summary:m,output:[typeof e.statusMessage=="string"?e.statusMessage:"",e.hasResult===!0?"Result available via TaskOutput":"",typeof e.error=="string"?`Error: ${e.error}`:""].filter(Boolean).join(`
|
|
19
|
+
`)};if((b=(x=t().messages.find(y=>y.id===d))==null?void 0:x.agentContent)==null?void 0:b.toolCalls.some(y=>y.toolCallId===l)){o(d,l,p);return}s(d,{toolCallId:l,toolName:"MCP Task",arguments:JSON.stringify({taskId:i,serverName:e.serverName,toolName:e.toolName}),toolKind:"readonly",status:p.status,startTime:Number(e.createdAt)||Date.now(),summary:p.summary,output:p.output})},P2=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Array.isArray(e.files)?e.files.filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)):[],i=Wt(t,n,e.messageId||`project-rules-${Date.now()}`);if(!i)return;const a=e.blockedWrite===!0,l=`Project rules loaded: ${o.length}`+(a?" (write retry required)":"");s(i,{toolCallId:`project-rules:${o.map(d=>String(d.id)).join(",")}`,toolName:"Project Rules",arguments:JSON.stringify({triggerPaths:e.triggerPaths,blockedWrite:a}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:l,output:o.map(d=>`${String(d.relativePath)} ${String(d.source)} SHA-256: ${String(d.contentSha256)}`).join(`
|
|
20
|
+
`)})},nu=e=>`user-shell-${e}`,N2=(e,t,n)=>{const{currentSessionId:r,addMessage:s,messages:o,updateMessage:i}=t();if(e.sessionId!==r||typeof e.executionId!="string"||typeof e.command!="string")return;const a=nu(e.executionId),l={id:a,role:"user",content:`! ${e.command}`,timestamp:Date.now(),metadata:{userShellExecution:{executionId:e.executionId,command:e.command,status:"running",output:""}}};o.some(d=>d.id===a)?i(a,l):s(l),e.auxiliary!==!0&&n({isStreaming:!0,agentPhase:"running",error:null,errorContext:null})},O2=(e,t)=>{var d;const{currentSessionId:n,messages:r,updateMessage:s}=t();if(e.sessionId!==n||typeof e.executionId!="string"||typeof e.chunk!="string")return;const o=nu(e.executionId),i=r.find(m=>m.id===o);if(!i)return;const a=(d=i.metadata)!=null&&d.userShellExecution&&typeof i.metadata.userShellExecution=="object"?i.metadata.userShellExecution:{},l=`${typeof a.output=="string"?a.output:""}${e.chunk}`;s(o,{content:`! ${String(a.command??"")}
|
|
21
|
+
${l}`,metadata:{...i.metadata,userShellExecution:{...a,output:l,streamTruncated:e.streamTruncated===!0}}})},$2=(e,t,n)=>{const{currentSessionId:r,messages:s,addMessage:o,updateMessage:i}=t();if(e.sessionId!==r||typeof e.executionId!="string"||!e.record||typeof e.record!="object"||Array.isArray(e.record))return;const a=e.record,l=typeof a.command=="string"?a.command:"",d=typeof a.stdout=="string"?a.stdout:"",m=typeof a.stderr=="string"?a.stderr:"",p=[d,m?`stderr:
|
|
22
22
|
${m}`:""].filter(Boolean).join(`
|
|
23
|
-
`),g=
|
|
24
|
-
`),metadata:{userShellCommand:a}};s.some(b=>b.id===g)?i(g,x):o({id:g,...x,timestamp:Date.now()}),e.auxiliary!==!0&&n({isStreaming:!1,isStopping:!1,agentPhase:"idle"}),(e.delivery==="current_turn"||e.delivery==="next_turn")&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):0,pendingInputDelivery:e.delivery==="current_turn"?"current_turn":"next_turn"})},
|
|
25
|
-
`)[0].slice(0,120):p?"执行成功":"执行失败");o(d.messageId,d.subagent.id,b=>({sessionId:b.sessionId||l,currentTool:b.currentTool===a?void 0:b.currentTool,toolCalls:(b.toolCalls||[]).map(y=>y.toolCallId===i?{...y,status:g,summary:x,output:m,metadata:e.metadata}:y)}))},
|
|
26
|
-
`)}]}))},
|
|
27
|
-
`)}]}))},
|
|
28
|
-
`)}]}))},
|
|
29
|
-
`)}]}))},
|
|
30
|
-
`)}]}))},Q2=(e,t,n)=>{const{currentSessionId:r,setConfirmation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||"",i=Wt(t,n,o?`assistant-permission-${o}`:void 0);if(!i)return;const a=e.details,l=e.toolName||(a==null?void 0:a.toolName)||"Tool";s(i,{toolCallId:o,toolName:l,description:e.description,diff:(a==null?void 0:a.details)||(a==null?void 0:a.diff)||"",allowRemember:(a==null?void 0:a.type)!=="mcpSampling",status:"pending"}),n(d=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:d.sessions.map(m=>m.sessionId===e.sessionId&&m.projectPath===e.projectPath?{...m,pendingInteraction:{type:"permission",requestId:o}}:m)}))},Y2=(e,t,n)=>{var x,b;const{currentSessionId:r,currentSessionRef:s,messages:o,setConfirmation:i,setElicitation:a}=t();if(e.sessionId!==r)return;const l=e.requestId,d=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.confirmation)==null?void 0:k.toolCallId)===l}),m=(x=d==null?void 0:d.agentContent)==null?void 0:x.confirmation;d&&(m==null?void 0:m.status)==="pending"&&i(d.id,{...m,status:"denied"});const p=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.elicitation)==null?void 0:k.toolCallId)===l}),g=(b=p==null?void 0:p.agentContent)==null?void 0:b.elicitation;p&&(g==null?void 0:g.status)==="pending"&&a(p.id,{...g,status:"cancelled"}),n({agentPhase:"running",error:"Permission request timed out",errorContext:{kind:"interaction",...s?{sessionRef:s}:{}}})},X2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running"})},Z2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},e5=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},t5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},n5=(e,t,n)=>{const{currentSessionId:r,setQuestion:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-question-${o}`:void 0);i&&(s(i,{toolCallId:o,questions:e.questions,status:"pending"}),n(a=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:a.sessions.map(l=>l.sessionId===e.sessionId&&l.projectPath===e.projectPath?{...l,pendingInteraction:{type:"question",requestId:o}}:l)})))},r5=(e,t,n)=>{const{currentSessionId:r,setElicitation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-elicitation-${o}`:void 0),a=e.elicitation;!i||!a||(s(i,{toolCallId:o,details:a,status:"pending"}),n(l=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:l.sessions.map(d=>d.sessionId===e.sessionId&&d.projectPath===e.projectPath?{...d,pendingInteraction:{type:"elicitation",requestId:o}}:d)})))},s5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.requestId;n(o=>({agentPhase:"running",sessions:o.sessions.map(i=>{var a;return i.sessionId===e.sessionId&&i.projectPath===e.projectPath&&((a=i.pendingInteraction)==null?void 0:a.requestId)===s?{...i,pendingInteraction:void 0}:i})}))},o5=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},i5=(e,t,n)=>{const{currentSessionId:r,currentSessionRef:s,endAgentResponse:o}=t();if(e.sessionId!==r)return;const i=e.taskFailure&&typeof e.taskFailure=="object"&&!Array.isArray(e.taskFailure)?e.taskFailure:void 0,a=ty(i==null?void 0:i.code);n({agentPhase:"error",error:e.error||"An error occurred",errorContext:{kind:"execution",...s?{sessionRef:s}:{},...a?{failureCode:a}:{}}}),o()},a5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId===r)if(e.status==="idle")n({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0});else if(e.status==="queued"||e.status==="running"||e.status==="waiting_permission"){const s=typeof e.queued=="number"?Math.max(0,e.queued):0;n({isStreaming:!0,agentPhase:e.status==="waiting_permission"?"waiting_permission":"running",currentRunId:typeof e.runId=="string"?e.runId:t().currentRunId,pendingSteeringCount:s,pendingInputDelivery:s>0&&(e.pendingInputDelivery==="current_turn"||e.pendingInputDelivery==="next_turn")?e.pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})}else e.status==="error"&&n({isStreaming:!1,isStopping:!1,agentPhase:"error",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},c5=(e,t,n)=>{const{currentSessionId:r,endAgentResponse:s,messages:o,updateSubagent:i}=t();if(e.sessionId===r){n(a=>({isStreaming:!1,agentPhase:"idle",messages:a.messages.map(l=>{var m;const d=(m=l.agentContent)==null?void 0:m.elicitation;return(d==null?void 0:d.status)!=="pending"||!l.agentContent?l:{...l,agentContent:{...l.agentContent,elicitation:{...d,status:"cancelled"}}}})}));for(const a of o)for(const l of Zn(a.agentContent))l.status==="running"&&i(a.id,l.id,{status:"failed"});s()}},l5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},d5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},u5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({pendingSteeringCount:r,pendingInputDelivery:r>0?t().pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},f5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({agentPhase:"running",pendingSteeringCount:r,pendingInputDelivery:r>0?"current_turn":null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},m5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},p5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},g5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},h5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId||!Array.isArray(e.messages))return;const r=Date.now(),s=e.messages.flatMap((o,i)=>{if(typeof o!="object"||o===null)return[];const a=o;return!["user","assistant","system","tool"].includes(String(a.role))||!Array.isArray(a.content)&&typeof a.content!="string"?[]:[{id:`rewind-${i}-${r}`,role:a.role,content:a.content,timestamp:r+i,metadata:typeof a.metadata=="object"&&a.metadata!==null?a.metadata:void 0,thinkingContent:typeof a.thinkingContent=="string"?a.thinkingContent:typeof a.reasoningContent=="string"?a.reasoningContent:void 0,tool_call_id:typeof a.tool_call_id=="string"?a.tool_call_id:void 0,name:typeof a.name=="string"?a.name:void 0,tool_calls:a.tool_calls}]});n({messages:Pi(s),isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1})},b5=(e,t,n)=>{const r=t().currentSessionRef;if(!r||e.sessionId!==r.sessionId||e.projectPath!==r.projectPath)return;const s=e.status,o=s==="completed"||s==="stale"?"completed":s==="aborted"?"cancelled":s==="interrupted"?"interrupted":"failed";n(i=>({sessions:i.sessions.map(a=>a.sessionId===r.sessionId&&a.projectPath===r.projectPath?{...a,taskStatus:o,taskStatusReason:void 0,taskFailure:void 0,taskCompletedAt:new Date().toISOString()}:a)})),t().selectSession(r)},k5=(e,t,n)=>{ry({...e,messageId:`review-${String(e.reviewId??"active")}`,arguments:"{}"},t,n)},x5=(e,t,n)=>{sy(e,t)},y5=(e,t,n)=>{oy(e,t,n)},wi={"message.created":g2,"message.delta":h2,"message.complete":b2,"structured.output":k2,"thinking.delta":x2,"thinking.completed":y2,"tool.start":ry,"tool.progress":sy,"tool.result":oy,"mcp.catalog.changed":S2,"mcp.content.changed":w2,"mcp.resource.updated":v2,"mcp.connection.changed":I2,"mcp.log":C2,"mcp.instructions.changed":j2,"mcp.task.changed":T2,"project.rules.loaded":A2,"user.shell.started":E2,"user.shell.output":P2,"user.shell.completed":N2,"token.usage":O2,"task.updated":$2,"subagent.start":R2,"subagent.update":M2,"subagent.delta":F2,"subagent.thinking.delta":D2,"subagent.tool.start":L2,"subagent.tool.progress":B2,"subagent.tool.result":U2,"subagent.mcp.catalog.changed":H2,"subagent.mcp.content.changed":q2,"subagent.mcp.resource.updated":z2,"subagent.mcp.connection.changed":K2,"subagent.mcp.log":G2,"subagent.mcp.instructions.changed":V2,"subagent.mcp.task.changed":W2,"subagent.project.rules.loaded":J2,"subagent.complete":_2,"permission.asked":Q2,"permission.timeout":Y2,"turn.started":X2,"compaction.started":Z2,"compaction.completed":e5,"model.fallback":t5,"question.required":n5,"elicitation.required":r5,"interaction.resolved":s5,"session.completed":o5,"session.error":i5,"session.status":a5,"run.cancelled":c5,"steering.queued":l5,"follow_up.queued":d5,"follow_up.started":f5,"steering.applied":u5,"goal.updated":m5,"goal.cleared":p5,"goal.continuation.started":g5,"session.rewound":h5,"review.tool.started":k5,"review.tool.progress":x5,"review.tool.completed":y5,"review.completed":b5},S5=new Set(["message.delta","thinking.delta","subagent.delta","subagent.thinking.delta"]),w5=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled"]),pf=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(S5.has(n.type)||console.log("[SSE Event]",n.type,n.properties),w5.has(n.type)){wn.drainAll();const i=wi[n.type];i&&i(n.properties,e,t);return}if(n.type==="tool.start"&&wn.drainAll(),n.type==="message.delta"){const{currentSessionId:i,currentAssistantMessageId:a,hasToolCalls:l}=e();if(s.sessionId!==i)return;const d=s.messageId||a,m=s.delta;if(!a){const x=wi["message.delta"];x&&x(s,e,t);return}const p=l?"after":"before",g=`content:${d}:${p}`;wn.drainAllExcept(g),wn.append(g,m,x=>{const{appendDelta:b}=e();d&&b(d,x,p)});return}if(n.type==="thinking.delta"){const{currentSessionId:i,currentAssistantMessageId:a}=e();if(s.sessionId!==i)return;if(!a){const p=wi["thinking.delta"];p&&p(s,e,t);return}const l=s.delta,d=s.messageId||a,m=`thinking:${d}`;wn.drainAllExcept(m),wn.append(m,l,p=>{const{appendThinking:g}=e();d&&g(d,p)});return}if(n.type==="subagent.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,output:(A.output||"")+x}))});return}if(n.type==="subagent.thinking.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent-thinking:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,thinking:(A.thinking||"")+x}))});return}const o=wi[n.type];o&&o(n.properties,e,t)},v5=(e,t)=>{const n=new WeakMap;let r=null;return{isStreaming:!1,isStopping:!1,agentPhase:"idle",sessionEventConnectionState:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:s=>e({isStreaming:s}),setAgentPhase:s=>e({agentPhase:s}),setRunId:s=>e({currentRunId:s}),prepareEventSubscription:async(s,o)=>{const i=o??pf(t,e);let a=null,l="connecting";return a=await re.openEventSubscription(s,i,{onConnectionStateChange:d=>{l=d,a&&r===a&&e({sessionEventConnectionState:d})}}),n.set(a,l),a},replaceEventSubscription:s=>{const o=t().eventUnsubscribe;if(r=s,e({eventUnsubscribe:s,sessionEventConnectionState:s?n.get(s)??"connected":"idle"}),wn.reset(),o&&o!==s)try{o()}catch(i){console.warn("Failed to clean up previous event subscription",i)}},setCurrentAssistantMessageId:s=>e({currentAssistantMessageId:s}),setHasToolCalls:s=>e({hasToolCalls:s}),startAgentResponse:s=>{e({currentAssistantMessageId:s,hasToolCalls:!1,isStreaming:!0,agentPhase:"running"})},endAgentResponse:()=>{wn.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async s=>{const o=await t().prepareEventSubscription(s);t().replaceEventSubscription(o)},reconnectSessionEvents:async()=>{const s=t().currentSessionRef;if(s){t().unsubscribeFromEvents(),e({sessionEventConnectionState:"connecting"});try{await t().subscribeToEvents(s)}catch(o){throw e({sessionEventConnectionState:"offline"}),o}}},unsubscribeFromEvents:()=>{const{eventUnsubscribe:s}=t();r=null,e({eventUnsubscribe:null,sessionEventConnectionState:"idle"});try{s==null||s()}catch(o){console.warn("Failed to clean up event subscription",o)}finally{wn.reset()}},handleEvent:s=>{pf(t,e)(s)}}};function I5(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function nu(e,t){var r;const n=(r=e.taskStatusReason)==null?void 0:r.trim();if(I5(e)){if(e.taskStatus==="running")return t("taskHome.review.running");if(n!=null&&n.startsWith("Code review stale:"))return t("taskHome.review.stale");if(n==="Code review aborted")return t("taskHome.review.aborted");if(n==="Code review interrupted by process restart")return t("taskHome.review.interrupted");if(e.taskStatus==="failed")return t("taskHome.review.failed")}return e.taskFailure?t(ny(e.taskFailure.code)):n==="user-cancel"?t("session.reason.cancelledByUser"):n||void 0}let ic=0;function vi(e,t){const n=e.findIndex(s=>s.id===t.id);if(n===-1)return[...e,t];const r=e.slice();return r[n]=t,r}const C5=ui(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{const t=++ic;e({isLoading:!0,error:null});try{const n=await re.listSchedules();if(t!==ic)return;e({schedules:n,isLoading:!1,hasLoaded:!0})}catch(n){if(t!==ic)return;e({error:n instanceof Error?n.message:He("schedule.error.loadFailed"),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{const n=await re.createSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.createFailed")}),n}},updateSchedule:async(t,n)=>{e({error:null});try{const r=await re.updateSchedule(t,n);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.updateFailed")}),r}},deleteSchedule:async t=>{e({error:null});try{await re.deleteSchedule(t),e(n=>({schedules:n.schedules.filter(r=>r.id!==t)}))}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.deleteFailed")}),n}},toggleSchedule:async(t,n)=>{e({error:null});try{const r=n?await re.enableSchedule(t):await re.disableSchedule(t);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.toggleFailed")}),r}},runSchedule:async t=>{e({error:null});try{const n=await re.runSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.runFailed")}),n}}})),j5=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",Ni=e=>{if(typeof document>"u")return;const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const r=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(r)}else t.classList.add(e)},ln={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,communicationStyle:"auto"},vo=ui((e,t)=>({...ln,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error(He("settings.general.loadError"));const r=await n.json(),s=r.uiTheme??ln.uiTheme;e({language:r.language??ln.language,theme:r.theme??ln.theme,uiTheme:s,autoSaveSessions:r.autoSaveSessions??ln.autoSaveSessions,notifyBuild:r.notifyBuild??ln.notifyBuild,notifyErrors:r.notifyErrors??ln.notifyErrors,notifySounds:r.notifySounds??ln.notifySounds,privacyTelemetry:r.privacyTelemetry??ln.privacyTelemetry,privacyCrash:r.privacyCrash??ln.privacyCrash,communicationStyle:r.communicationStyle??ln.communicationStyle,isLoading:!1}),Ni(s)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&Ni(n.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n,options:{scope:"global"}})})).ok)throw new Error(He("settings.general.saveError"))}catch(s){e({language:r.language,theme:r.theme,uiTheme:r.uiTheme,autoSaveSessions:r.autoSaveSessions,notifyBuild:r.notifyBuild,notifyErrors:r.notifyErrors,notifySounds:r.notifySounds,privacyTelemetry:r.privacyTelemetry,privacyCrash:r.privacyCrash,communicationStyle:r.communicationStyle,error:s.message}),n.uiTheme&&Ni(r.uiTheme)}}}));Ni(ln.uiTheme);const Y_=()=>vo(e=>j5(e.uiTheme)),iy="blade.projects.selected";function gf(){return typeof localStorage>"u"?null:localStorage.getItem(iy)}function Ii(e){typeof localStorage<"u"&&localStorage.setItem(iy,e)}const T5=new Set(["queued","running","completed","failed","cancelled","interrupted"]),ac=new Set(["default","autoEdit","yolo","plan"]),hf=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),bf=new Set(["auto","standard","fast","flex"]),kf=new Set(["auto","low","medium","high"]),xf=new Set(["auto","pragmatic","friendly","explanatory"]);function A5(e){return typeof e=="string"&&T5.has(e)}function E5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!["changedFiles","additions","deletions","commits"].some(r=>typeof t[r]!="number"||!Number.isInteger(t[r])||t[r]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function yf(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=ty(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:He(ny(n)),retryable:f2(n)}}function P5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!(!["applied","discarded","conflicted"].includes(String(t.status))||typeof t.updatedAt!="string"))return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit=="string"?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles=="number"&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message=="string"?{message:t.message}:{}}}function xs(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}const N5=(e,t)=>{let n=null,r=!1,s=!1,o=0;const i=new Map,a=d=>{const m=ze(d),p=++o;i.set(m,p),re.getSession(d).then(g=>{i.get(m)===p&&e(x=>({sessions:vn(x.sessions,g)}))}).catch(()=>{i.get(m)===p&&t().loadSessions()}).finally(()=>{i.get(m)===p&&i.delete(m)})},l=d=>{const m=ze(d),p=++o;i.set(m,p),queueMicrotask(()=>{i.get(m)===p&&i.delete(m)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:gf(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:r2(),handleTaskEvent:d=>{if(d.type==="session.created"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C});return}if(d.type==="session.deleted"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O);return}if(d.type==="session.archived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O),t().loadArchivedSessions();return}if(d.type==="session.unarchived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C}),t().loadArchivedSessions();return}if(d.type==="session.updated"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.title,R=d.properties.selectedModelId,K=d.properties.permissionMode,X=d.properties.reasoningEffort,P=d.properties.serviceTier,B=d.properties.responseVerbosity,M=d.properties.communicationStyle;if(typeof T!="string"||typeof C!="string"||!(typeof O=="string"&&O.trim()||typeof R=="string"&&R.trim()||ac.has(K)||hf.has(X)||bf.has(P)||kf.has(B)||xf.has(M)))return;const fe={sessionId:T,projectPath:C};if(oe(t().currentSessionRef,fe)&&ac.has(K)&&Pt.getState().setMode(K),!t().sessions.some(ke=>oe(pe(ke),fe))){a(fe);return}e(ke=>({sessions:ke.sessions.map(ce=>oe({sessionId:ce.sessionId,projectPath:ce.projectPath},fe)?{...ce,...typeof O=="string"&&O.trim()?{title:O}:{},...typeof R=="string"&&R.trim()?{selectedModelId:R}:{},...ac.has(K)?{permissionMode:K}:{},...hf.has(X)?{reasoningEffort:X}:{},...bf.has(P)?{serviceTier:P}:{},...kf.has(B)?{responseVerbosity:B}:{},...xf.has(M)?{communicationStyle:M}:{}}:ce)}));return}if(d.type==="task.delivery"){const T=d.properties.sessionId,C=d.properties.projectPath,O=P5(d.properties.taskDelivery);if(typeof T!="string"||typeof C!="string"||!O)return;const R={sessionId:T,projectPath:C},K=d.properties.taskWorktreeRemoved===!0;e(X=>({sessions:X.sessions.map(P=>oe(pe(P),R)?{...P,taskDelivery:O,...K?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:P.lastMessageTime}:P)}));return}if(d.type==="interaction.pending"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.interactionType,R=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||O!=="permission"&&O!=="question"&&O!=="elicitation"||typeof R!="string"||!R)return;const K={sessionId:T,projectPath:C},X=t().sessions.find(B=>oe(pe(B),K));if(!X){t().loadSessions();return}if(e(B=>({sessions:B.sessions.map(M=>oe(pe(M),K)?{...M,pendingInteraction:{type:O,requestId:R}}:M)})),!(typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,K))&&vo.getState().notifyErrors){const M=X.title??X.sessionId??T;ff({ref:K,title:`Blade · ${He(O==="question"?"attention.notification.question":O==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:M,onOpen:fe=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:fe})))}})}return}if(d.type==="interaction.resolved"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||typeof O!="string")return;const R={sessionId:T,projectPath:C};e(K=>({sessions:K.sessions.map(X=>{var P;return oe(pe(X),R)&&((P=X.pendingInteraction)==null?void 0:P.requestId)===O?{...X,pendingInteraction:void 0}:X})}));return}if(d.type==="schedule.fired"){C5.getState().loadSchedules();return}if(d.type!=="task.status")return;const m=d.properties.sessionId,p=d.properties.projectPath,g=d.properties.taskStatus;if(typeof m!="string"||typeof p!="string"||!A5(g))return;const x={sessionId:m,projectPath:p},b=xs(d.properties.taskInFlight,0),y=xs(d.properties.taskQueueDepth,0),j=xs(d.properties.taskConcurrencyLimit,1);b!==void 0&&y!==void 0&&j!==void 0&&e(T=>{var C;return{taskWorkspaceInfo:T.taskWorkspaceInfo?{...T.taskWorkspaceInfo,taskAdmission:{inFlight:b,queued:y,maxConcurrent:j,maxQueued:((C=T.taskWorkspaceInfo.taskAdmission)==null?void 0:C.maxQueued)??100}}:null}});const k=t().sessions.find(T=>oe(pe(T),x)),A=typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,x),N=n2(k==null?void 0:k.taskStatus,g,A),$=ze(x),Q=!t().unreadTaskKeys.includes($);if(N&&Q){e(O=>{const R=[...O.unreadTaskKeys,$];return go(R),{unreadTaskKeys:R}});const T=vo.getState();if(T.notifySounds&&Yx(g)&&s2(g),g==="completed"?T.notifyBuild:T.notifyErrors){const O=He(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),R=yf(d.properties.taskFailure),K=k?nu({...k,taskStatus:g,taskFailure:R??k.taskFailure,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:k.taskStatusReason,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:k.taskPromptSummary},He):(R==null?void 0:R.message)??(typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0),X=(k==null?void 0:k.title)??(k==null?void 0:k.sessionId)??m;ff({ref:x,title:`Blade · ${O}`,body:K?`${X} · ${K}`:X,onOpen:P=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:P})))}})}}if(!k){a(x);return}e(T=>({sessions:T.sessions.map(C=>oe({sessionId:C.sessionId,projectPath:C.projectPath},x)?{...C,taskStatus:g,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0,taskFailure:g==="failed"?yf(d.properties.taskFailure)??C.taskFailure:void 0,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:C.taskPromptSummary,taskStartedAt:typeof d.properties.taskStartedAt=="string"?d.properties.taskStartedAt:g==="queued"?void 0:C.taskStartedAt,taskCompletedAt:typeof d.properties.taskCompletedAt=="string"?d.properties.taskCompletedAt:g==="queued"||g==="running"?void 0:C.taskCompletedAt,taskDiffStat:E5(d.properties.taskDiffStat)??C.taskDiffStat,taskQueuePosition:g==="queued"?xs(d.properties.taskQueuePosition,1)??C.taskQueuePosition:void 0,taskQueueDepth:g==="queued"?xs(d.properties.taskQueueDepth,0)??C.taskQueueDepth:void 0,taskConcurrencyLimit:xs(d.properties.taskConcurrencyLimit,1)??C.taskConcurrencyLimit,lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:C.lastMessageTime}:C)}))},subscribeToTaskEvents:async()=>{if(r=!0,!t().taskEventUnsubscribe){if(n)return n;e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),n=(async()=>{try{const d=await re.openTaskEventSubscription(m=>t().handleTaskEvent(m),{onConnectionChange:m=>{e({taskEventsConnected:m})},onConnectionStateChange:m=>{r&&(m==="reconnecting"||m==="offline")&&(s=!0),e({taskEventsConnected:m==="connected",taskEventConnectionState:m}),m==="connected"&&s&&(s=!1,Promise.all([t().loadSessions(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Pt.getState().loadModels()]))}});if(!r||t().taskEventUnsubscribe){d();return}e({taskEventUnsubscribe:d})}catch(d){throw s=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),d}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{s=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var d,m;r=!1,(m=(d=t()).taskEventUnsubscribe)==null||m.call(d),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const d=await re.getWorkspaceInfo();e({taskWorkspaceInfo:d,isTaskWorkspaceLoading:!1})}catch(d){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:d instanceof Error?d.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const d=await re.listProjects(),m=gf(),p=d.find(g=>g.available&&g.path===m)??d.find(g=>g.isCurrent)??d.find(g=>g.available);p&&Ii(p.path),e({boundProjects:d,selectedProjectPath:(p==null?void 0:p.path)??null})}catch(d){e({error:d instanceof Error?d.message:"Failed to load projects"})}},bindProject:async d=>{e({isBindingProject:!0,error:null});try{const m=await re.bindProject(d);Ii(m.path),e(p=>({boundProjects:[...p.boundProjects.filter(g=>g.path!==m.path),m].sort((g,x)=>g.isCurrent!==x.isCurrent?g.isCurrent?-1:1:g.name.localeCompare(x.name)),selectedProjectPath:m.path,isBindingProject:!1}))}catch(m){throw e({isBindingProject:!1,error:m instanceof Error?m.message:"Failed to bind project"}),m}},unbindProject:async d=>{try{await re.unbindProject(d),e(m=>{const p=m.boundProjects.filter(x=>x.path!==d||x.isCurrent),g=m.selectedProjectPath===d?p.find(x=>x.isCurrent)??p.find(x=>x.available):void 0;return g&&Ii(g.path),{boundProjects:p,...g?{selectedProjectPath:g.path}:{}}})}catch(m){throw e({error:m instanceof Error?m.message:"Failed to unbind project"}),m}},selectProject:d=>{Ii(d),e({selectedProjectPath:d})},markTaskRead:d=>{const m=ze(d);e(p=>{const g=p.unreadTaskKeys.filter(x=>x!==m);return go(g),{unreadTaskKeys:g}})},clearUnreadTasks:()=>{go([]),e({unreadTaskKeys:[]})},cancelTask:async d=>{const m=ze(d);if(!t().cancellingTaskKeys.includes(m)){e(p=>({cancellingTaskKeys:[...p.cancellingTaskKeys,m],error:null,errorContext:null}));try{await re.abortSession(d);const p=oe(t().currentSessionRef,d);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(x=>oe(pe(x),d)?{...x,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:x.taskCompletedAt??new Date().toISOString()}:x),...p?{isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(p){throw e({error:p instanceof Error?p.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:d}}),p}finally{e(p=>({cancellingTaskKeys:p.cancellingTaskKeys.filter(g=>g!==m)}))}}},retryTask:async d=>{const m=ze(d);if(t().retryingTaskKeys.includes(m))return;const p=t().getNavigationVersion(),g=t().selectedProjectPath,x=()=>t().getNavigationVersion()===p&&t().selectedProjectPath===g;e(b=>({retryingTaskKeys:[...b.retryingTaskKeys,m],error:null,errorContext:null}));try{const b=await re.retryTask(d);e(y=>({sessions:vn(y.sessions,b.session)})),t().markTaskRead(d),x()&&await t().selectSession(pe(b.session))}catch(b){throw x()&&e({error:b instanceof Error?b.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:d}}),b}finally{e(b=>({retryingTaskKeys:b.retryingTaskKeys.filter(y=>y!==m)}))}},deliverTask:async(d,m)=>{const p=ze(d);if(!t().taskDeliveryActions[p]){e(g=>({taskDeliveryActions:{...g.taskDeliveryActions,[p]:m},error:null,errorContext:null}));try{const g=await re.deliverTask(d,m);e(x=>({sessions:vn(x.sessions,g)})),t().markTaskRead(d)}catch(g){throw e({error:g instanceof Error?g.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:d}}),g}finally{e(g=>{const{[p]:x,...b}=g.taskDeliveryActions;return{taskDeliveryActions:b}})}}},dispatchTask:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});try{const b=await re.createTask({...d,projectPath:g});e(y=>({sessions:vn(y.sessions,b.session),isDispatchingTask:!1})),x()&&await t().selectSession(pe(b.session))}catch(b){throw e({isDispatchingTask:!1,...x()?{error:b instanceof Error?b.message:"Failed to dispatch task"}:{}}),b}},startCodeReview:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});let b,y=!1;try{b=await re.createSession(g,"Code Review");const j=pe(b);await re.startCodeReview(j,{kind:d.kind,...d.ref?{ref:d.ref}:{},...d.instructions?{instructions:d.instructions}:{},...d.modelId?{modelId:d.modelId}:{}}),y=!0;const k={...b,taskStatus:"running",taskStatusReason:He("taskHome.review.running"),taskPromptSummary:`/review ${d.kind}${d.ref?` ${d.ref}`:""}`};e(A=>({sessions:vn(A.sessions,k),isDispatchingTask:!1})),x()&&await t().selectSession(j)}catch(j){throw b&&!y&&await re.deleteSession(pe(b)).catch(()=>{}),e({isDispatchingTask:!1,...x()?{error:j instanceof Error?j.message:He("taskHome.review.startFailed")}:{}}),j}}}},O5=e=>({tokenUsage:ao,updateTokenUsage:t=>e(n=>{const{costUsd:r,...s}=t;return{tokenUsage:{...n.tokenUsage,...s,totalInputTokens:n.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:n.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:n.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:n.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:n.tokenUsage.estimatedCostUsd+Math.max(0,r??0)}}}),resetContextUsage:()=>e(t=>({tokenUsage:{...t.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,n=!1)=>e(r=>({tokenUsage:{...r.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:n}}))}),L=ui()((...e)=>({...d2(...e),...N5(...e),...WD(...e),...v5(...e),...O5(...e)}));function $5(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function R5({open:e,onOpenChange:t}){const n=Ft(),r=L(T=>T.currentSessionRef),s=L(T=>T.isStreaming),o=L(T=>T.isTemporarySession),i=L(T=>T.rewindSession),[a,l]=w.useState([]),[d,m]=w.useState(null),[p,g]=w.useState(!1),[x,b]=w.useState(!1),[y,j]=w.useState(!1),[k,A]=w.useState(null);w.useEffect(()=>{if(!e||!r)return;let T=!1;return b(!0),A(null),l([]),m(null),g(!1),re.listRewindCheckpoints(r).then(C=>{var O;T||(l(C),m(((O=C[0])==null?void 0:O.messageId)??null))}).catch(C=>{T||A(C instanceof Error?C.message:n("chat.rewind.loadFailed"))}).finally(()=>{T||b(!1)}),()=>{T=!0}},[r,e]);const N=w.useMemo(()=>a.find(T=>T.messageId===d)??null,[a,d]),$=!!N&&!x&&!y&&!s&&!o,Q=async()=>{if(!N||!$)return;j(!0),A(null);const T=await i(N.messageId,p?"both":"conversation");j(!1),T?t(!1):A(n("chat.rewind.failed"))};return c.jsx(sl,{open:e,onOpenChange:t,children:c.jsxs(Yi,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[c.jsx(ol,{className:"border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300",children:c.jsx(yu,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx(Xi,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:n("chat.rewind.title")}),c.jsx(Zi,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:n("chat.rewind.description")})]})]})}),c.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[x&&c.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-xs font-mono",children:n("chat.rewind.loading")})]}),!x&&k&&c.jsx("div",{role:"alert",className:"rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:k}),!x&&!k&&a.length===0&&c.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[c.jsx(yu,{className:"mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600"}),c.jsx("p",{className:"text-sm text-[#4B5563] dark:text-zinc-300",children:n("chat.rewind.empty")})]}),!x&&a.length>0&&c.jsx("div",{role:"radiogroup","aria-label":n("chat.rewind.checkpointAria"),className:"max-h-[310px] space-y-1 overflow-y-auto",children:a.map(T=>{const C=T.messageId===d;return c.jsxs("button",{type:"button",role:"radio","aria-checked":C,onClick:()=>m(T.messageId),className:W("w-full rounded-md border px-4 py-3 text-left transition-colors",C?"border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50":"border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900"),children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsx("p",{className:"line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100",children:T.preview||n("chat.rewind.userMessage")}),c.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:$5(T.createdAt)})]}),c.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500",children:[c.jsx("span",{children:T.messageId.slice(0,10)}),T.fileCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(cS,{className:"h-3 w-3"}),T.fileCount===1?n("chat.rewind.fileCountOne",{count:T.fileCount}):n("chat.rewind.fileCountMany",{count:T.fileCount})]})]})]},T.messageId)})})]}),c.jsx("div",{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:c.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[c.jsx("input",{type:"checkbox",checked:p,disabled:!N||N.fileCount===0,onChange:T=>g(T.target.checked),className:"mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40"}),c.jsxs("span",{children:[c.jsx("span",{className:"block text-[12px] font-medium text-[#374151] dark:text-zinc-200",children:n("chat.rewind.restoreCode")}),c.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:n("chat.rewind.restoreCodeHint")})]})]})}),c.jsxs(Qf,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[c.jsx(br,{variant:"ghost",onClick:()=>t(!1),disabled:y,children:n("chat.rewind.cancel")}),c.jsxs(br,{onClick:()=>void Q(),disabled:!$,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[y?c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Qi,{className:"mr-2 h-4 w-4"}),n("chat.rewind.confirm")]})]})]})})}function ay({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=Ft(),i=Math.max(1,n),a=Array.from({length:Math.min(i,12)}),l=Math.min(e,i);return c.jsxs("div",{className:W("inline-flex items-center gap-2 font-mono",r?"text-[10.5px]":"text-[11px]",s),title:o("capacity.title",{inFlight:e,queued:t,max:n}),children:[c.jsx("span",{className:W("inline-flex items-center gap-[3px] rounded-sm",r?"px-0":"px-0.5"),children:a.map((d,m)=>{const p=m<l;return c.jsx("span",{className:W("block",r?"h-2.5 w-[3px] rounded-[1px]":"h-3 w-[3px] rounded-[1px]",p?"bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]":"bg-[hsl(var(--deck-border-strong))]/60")},m)})}),c.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-ink-muted))]",children:[c.jsx("span",{className:"text-[hsl(var(--deck-ink))]",children:e}),c.jsx("span",{className:"mx-[2px] opacity-40",children:"/"}),c.jsx("span",{children:n}),c.jsx("span",{className:"opacity-60",children:o("capacity.suffix.running")})]}),t>0&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-amber-500"}),o("capacity.queued",{queued:t})]})]})}function Sf(){const e=document.querySelector("textarea[data-blade-composer]:not(:disabled)");if(!e)return!1;e.focus();const t=e.value.length;return e.setSelectionRange(t,t),!0}const cy=[{id:"searchTasks",key:"k",primaryModifier:!0,scope:"Global"},{id:"openCommands",key:"p",primaryModifier:!0,shiftKey:!0,scope:"Global"},{id:"newTask",key:"n",primaryModifier:!1,scope:"Global"},{id:"focusComposer",key:"/",primaryModifier:!1,scope:"Chat"},{id:"toggleSidebar",key:"b",primaryModifier:!0,scope:"Layout"}];function M5(e){const t=e.key.toLocaleLowerCase();return cy.find(n=>{if(n.key!==t||e.altKey||e.shiftKey!==!!n.shiftKey)return!1;const r=e.metaKey||e.ctrlKey;return n.primaryModifier?r:!r})??null}function F5(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function D5(e){var r;const t=typeof navigator>"u"?null:navigator,n=((r=t==null?void 0:t.userAgentData)==null?void 0:r.platform)??(t==null?void 0:t.platform)??"";return/mac|iphone|ipad|ipod/i.test(n)}function _5(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=D5();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function Gc(e,t){const n=cy.find(r=>r.id===e);return n?_5(n).join(""):""}const ly="blade.sidebar.view",dy="blade.preview.width",cc=640,L5=360,U5=960,B5=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(ly);return e==="status"||e==="project"?e:"project"},uy=e=>Math.min(U5,Math.max(L5,Math.round(e))),H5=()=>{if(typeof localStorage>"u")return cc;const e=localStorage.getItem(dy);if(!e)return cc;const t=Number(e);return Number.isFinite(t)?uy(t):cc},kr=ui(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:B5(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(ly,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:H5(),setPreviewWidth:t=>{const n=uy(t);typeof localStorage<"u"&&localStorage.setItem(dy,String(n)),e({previewWidth:n})},previewTab:"diff",setPreviewTab:t=>e({previewTab:t}),previewTargetPath:null,previewRequestId:0,openFilePreview:t=>e(n=>({isFilePreviewOpen:!0,previewTab:(t==null?void 0:t.tab)??n.previewTab,previewTargetPath:(t==null?void 0:t.targetPath)??null,previewRequestId:n.previewRequestId+1})),isSettingsOpen:!1,settingsSection:"general",toggleSettings:()=>e(t=>({isSettingsOpen:!t.isSettingsOpen,...t.isSettingsOpen?{}:{settingsSection:"general"}})),openSettings:(t="general")=>e({isSettingsOpen:!0,settingsSection:t}),isTerminalOpen:!1,toggleTerminal:()=>e(t=>({isTerminalOpen:!t.isTerminalOpen})),isTaskSwitcherOpen:!1,taskSwitcherMode:"tasks",setTaskSwitcherOpen:(t,n)=>e(r=>({isTaskSwitcherOpen:t,taskSwitcherMode:n??r.taskSwitcherMode})),setTaskSwitcherMode:t=>e({taskSwitcherMode:t})}));function q5(){const e=kr(r=>r.setTaskSwitcherOpen),t=kr(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);w.useEffect(()=>{const r=s=>{if(s.repeat)return;const o=M5(s);if(!o)return;const i=kr.getState(),a=i.isTaskSwitcherOpen,l=F5(s.target),d=!!document.querySelector('[role="dialog"]');if(o.id==="searchTasks"||o.id==="openCommands"){if(d&&!a)return;s.preventDefault();const m=o.id==="searchTasks"?"tasks":"commands",p=a&&i.taskSwitcherMode===m;e(!p,m);return}if(!(l||d)){if(o.id==="newTask"){s.preventDefault(),n(),requestAnimationFrame(()=>Sf());return}if(o.id==="focusComposer"){Sf()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const ru=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Pf,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(nS,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(fy,{}),c.jsx(rS,{})]}));ru.displayName=Pf.displayName;const fy=w.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(Nf,{ref:r,orientation:t,className:W("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:c.jsx(sS,{className:"relative flex-1 rounded-full bg-border"})}));fy.displayName=Nf.displayName;function ho(e,t){var s;const n=(s=e.title)==null?void 0:s.trim();if(n==="Code Review")return t("session.title.codeReview");if(n)return n;const r=e.firstMessageTime||e.lastMessageTime;if(r){const o=new Date(r);if(!Number.isNaN(o.getTime()))return t("recent.session.fallbackDated",{y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),d:String(o.getDate()).padStart(2,"0"),hh:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0")})}return t("recent.session.fallbackShort",{id:e.sessionId.slice(0,6)})}async function my(e,t=!1){const n=await re.exportSessionMarkdown(e,t),r=new Blob([n.markdown],{type:"text/markdown;charset=utf-8"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=n.filename,o.hidden=!0,document.body.appendChild(o);try{o.click()}finally{o.remove(),await new Promise(i=>{window.setTimeout(()=>{URL.revokeObjectURL(s),i()},0)})}return n}const Gn=iS,Vn=aS,Mn=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(oS,{children:c.jsx(Of,{ref:s,align:t,sideOffset:n,className:W("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));Mn.displayName=Of.displayName;function z5(){const e=Ft(),t=L(b=>b.archivedSessions),n=L(b=>b.archivedCatalogLoadState),r=L(b=>b.archivedCatalogError),s=L(b=>b.loadArchivedSessions),o=L(b=>b.unarchiveSession),i=L(b=>b.setError),[a,l]=w.useState(!1),[d,m]=w.useState(null),[p,g]=w.useState(null),x=b=>{l(b),b&&s()};return c.jsxs(Gn,{open:a,onOpenChange:x,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",className:"flex h-8 w-full items-center justify-between rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]","aria-label":e("archive.open"),children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx($f,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),e("archive.title")]}),t.length>0&&c.jsx("span",{className:"rounded-sm bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t.length})]})}),c.jsxs(Mn,{role:"dialog","aria-label":e("archive.title"),side:"right",align:"end",sideOffset:8,className:"w-[340px] overflow-hidden p-0",children:[c.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-[hsl(var(--deck-hairline))] px-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.08em] text-[hsl(var(--deck-ink))]",children:e("archive.title")}),c.jsx("div",{className:"text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.subtitle")})]}),c.jsx("button",{type:"button",onClick:()=>void s(),"aria-label":e("archive.refresh"),className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:W("h-3 w-3",(n==="loading"||n==="hydrating")&&"animate-spin")})})]}),r?c.jsxs("div",{className:"px-3 py-4 text-[11px] text-red-600 dark:text-red-400",children:[c.jsx("div",{children:r}),c.jsx("button",{type:"button",onClick:()=>void s(),className:"mt-2 font-mono text-[10px] text-[hsl(var(--deck-accent))] focus-visible:outline-none focus-visible:underline",children:e("archive.retry")})]}):t.length===0&&(n==="loading"||n==="hydrating")?c.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 animate-spin"}),e("archive.loading")]}):t.length===0?c.jsx("div",{className:"flex h-24 items-center justify-center px-6 text-center text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.empty")}):c.jsx(ru,{className:"max-h-[340px]",children:c.jsx("div",{className:"divide-y divide-[hsl(var(--deck-hairline))]",children:t.map(b=>{var N;const y=pe(b),j=ze(y),k=d===j,A=b.projectPath.split("/").filter(Boolean).at(-1)??b.projectPath;return c.jsxs("div",{className:"flex min-h-[58px] items-center gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate font-mono text-[11.5px] text-[hsl(var(--deck-ink))]",children:ho(b,e)}),c.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:A}),b.archivedAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":!0,children:"·"}),c.jsx("span",{children:new Date(b.archivedAt).toLocaleString()})]})]}),b.archivedBySessionId!==b.sessionId&&c.jsx("div",{className:"mt-0.5 truncate text-[9px] text-[hsl(var(--deck-accent))]",children:e("archive.inherited",{id:((N=b.archivedBySessionId)==null?void 0:N.slice(0,8))??""})})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[c.jsx("button",{type:"button",disabled:p!==null,onClick:async()=>{g(j);try{await my(y)}catch($){i($ instanceof Error?$.message:"Session export failed")}finally{g(null)}},"aria-label":e("session.action.export",{title:ho(b,e)}),title:e("session.action.exportShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-35",children:p===j?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Rf,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",disabled:k||b.archivedBySessionId!==b.sessionId,onClick:async()=>{m(j);try{await o(y)}finally{m(null)}},"aria-label":e("archive.restore",{title:ho(b,e)}),title:b.archivedBySessionId!==b.sessionId?e("archive.restoreAncestor"):e("archive.restoreShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-35",children:k?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(lS,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function su({className:e,size:t=28,pulse:n=!0}){return c.jsxs("span",{className:W("inline-flex relative justify-center items-center","text-[hsl(var(--deck-ink))]",e),style:{width:t,height:t},"aria-hidden":"true",children:[c.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M16 3 L28 16 L16 29 L4 16 Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),c.jsx("path",{d:"M16 8 L24 16 L16 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.55"}),c.jsx("path",{d:"M16 3 L20 7",stroke:"hsl(var(--deck-accent))",strokeWidth:"2",strokeLinecap:"round"})]}),n&&c.jsx("span",{className:"absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full",style:{background:"hsl(var(--deck-accent-glow))",boxShadow:"0 0 6px hsl(var(--deck-accent-glow) / 0.9)"}})]})}const wf={en:"sidebar.language.en",zh:"sidebar.language.zh"};function py({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=S0(),s=Ft();if(t==="compact"){const o=n==="en"?"zh":"en";return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-label":s("sidebar.language.aria"),title:s("sidebar.language.label"),className:W("flex justify-center items-center w-10 h-10 font-mono font-medium rounded-md transition-colors text-[11px] text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",e),children:s(wf[n])})}return c.jsx("div",{role:"group","aria-label":s("sidebar.language.aria"),className:W("inline-flex h-8 items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-[2px] font-mono text-[11px]",e),children:h0.map(o=>{const i=o===n;return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":i,className:W("flex justify-center items-center px-2 h-full transition-colors min-w-[28px] rounded-[4px]",i?"bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:s(wf[o])},o)})})}const K5="[data-mobile-navigation-trigger]";function X_(e){return gy(K5,e)}function gy(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function hy({open:e,onOpenChange:t}){const n=Ft(),{boundProjects:r,selectedProjectPath:s,isBindingProject:o,loadBoundProjects:i,bindProject:a,unbindProject:l,selectProject:d,startTemporarySession:m}=L(),[p,g]=w.useState(""),[x,b]=w.useState(null),[y,j]=w.useState(!1),k=w.useRef(0);w.useEffect(()=>{if(e){i();return}k.current+=1,j(!1)},[i,e]);const A=async T=>{await a(T),g(""),m(),t(!1)},N=async T=>{if(T.preventDefault(),!(!p.trim()||o||y)){b(null);try{await A(p.trim())}catch(C){b(C instanceof Error?C.message:n("projects.bind.failed"))}}},$=async()=>{if(y||o)return;const T=++k.current;b(null),j(!0);try{const C=await re.pickProjectDirectory();if(T!==k.current||C.cancelled)return;g(C.path),await A(C.path)}catch(C){if(T!==k.current)return;b(C instanceof Error?C.message:n("projects.pick.failed"))}finally{T===k.current&&j(!1)}},Q=T=>{d(T),m(),t(!1)};return e?c.jsx(sl,{open:e,onOpenChange:t,children:c.jsxs(Yi,{onCloseAutoFocus:T=>gy("[data-project-setup-trigger]",T),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[c.jsxs(ol,{children:[c.jsxs(Xi,{className:"flex items-center gap-2 font-mono text-[16px]",children:[c.jsx(Oi,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),n("projects.dialog.title")]}),c.jsx(Zi,{className:"text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("projects.dialog.description")})]}),c.jsxs("form",{onSubmit:N,className:"flex gap-2",children:[c.jsx("input",{value:p,onChange:T=>g(T.target.value),disabled:o,placeholder:n("projects.bind.placeholder"),"aria-label":n("projects.bind.pathLabel"),className:"h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]"}),c.jsxs("button",{type:"button",onClick:()=>void $(),disabled:y||o,title:n("projects.pick.action"),"aria-label":n("projects.pick.action"),className:"inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))] disabled:cursor-wait disabled:opacity-50",children:[y?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(dS,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"hidden sm:inline",children:n(y?"projects.pick.picking":"projects.pick.actionShort")})]}),c.jsxs("button",{type:"submit",disabled:!p.trim()||o||y,className:"inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40",children:[o?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Oi,{className:"h-3.5 w-3.5"}),n("projects.bind.action")]})]}),x&&c.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:x}),c.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:r.map(T=>{const C=T.path===s;return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border px-3 py-2",C?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]":"border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsx(uo,{className:W("h-4 w-4 shrink-0",C?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsxs("button",{type:"button",disabled:!T.available,onClick:()=>Q(T.path),className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx("span",{className:"block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:T.name}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[T.gitBranch&&c.jsxs(c.Fragment,{children:[c.jsx(Zc,{className:"h-2.5 w-2.5"}),c.jsx("span",{children:T.gitBranch}),c.jsx("span",{children:"·"})]}),c.jsx("span",{className:"truncate",children:T.path}),!T.available&&c.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",n("projects.unavailable")]})]})]}),!T.isCurrent&&c.jsx("button",{type:"button",onClick:()=>void l(T.path).catch(()=>{}),title:n("projects.unbind.action"),"aria-label":n("projects.unbind.action"),className:"rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30",children:c.jsx(Mf,{className:"h-3.5 w-3.5"})})]},T.path)})})]})}):null}const G5={running:"bg-blue-500 dark:bg-blue-400 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",queued:"bg-amber-400 dark:bg-amber-300",interrupted:"bg-orange-500 dark:bg-orange-400",failed:"bg-red-500 dark:bg-red-400",cancelled:"bg-zinc-400 dark:bg-zinc-500",completed:"bg-[hsl(var(--deck-accent))]"};function V5({session:e,isActive:t,isForking:n,isUnread:r,anyForking:s,isEditing:o,editingTitle:i,title:a,context:l,isCancelling:d,isRetrying:m,isExporting:p,onSelect:g,onCancelTask:x,onRetryTask:b,onFork:y,onArchive:j,onExport:k,onStartRename:A,onDelete:N,onEditingTitleChange:$,onSaveRename:Q,onCancelRename:T}){const C=Ft(),[O,R]=w.useState(!1),K=w.useRef(null),X=w.useRef(null);return o?c.jsxs("div",{className:"flex h-9 w-full items-center gap-2 bg-[hsl(var(--deck-surface))] px-3",children:[c.jsx("input",{type:"text",value:i,onChange:P=>$(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Q(),P.key==="Escape"&&T()},autoFocus:!0,className:"flex-1 rounded bg-[hsl(var(--deck-canvas))] px-2 py-1 font-mono text-[13px] text-[hsl(var(--deck-ink))] outline-none focus:ring-1 focus:ring-[hsl(var(--deck-accent))]"}),c.jsx("button",{"aria-label":C("session.action.save",{title:a}),onClick:Q,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(Ff,{className:"w-3 h-3"})}),c.jsx("button",{"aria-label":C("session.action.cancel",{title:a}),onClick:T,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(co,{className:"w-3 h-3"})})]}):c.jsxs("div",{className:W("flex relative items-center w-full transition-colors group min-h-[54px]",t?"bg-[hsl(var(--deck-surface))]":"hover:bg-[hsl(var(--deck-surface))]/60"),children:[t&&c.jsx("span",{className:"absolute left-0 top-1/2 h-6 w-[2px] -translate-y-1/2 rounded-r bg-[hsl(var(--deck-accent))]"}),c.jsxs("button",{type:"button","aria-label":C("session.action.select",{title:a}),"aria-current":t?"true":void 0,"aria-busy":n?"true":void 0,onClick:g,className:"flex min-h-[54px] min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-4 pr-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",e.pendingInteraction?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":G5[e.taskStatus]),title:e.pendingInteraction?C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"):e.taskStatus}),c.jsxs("span",{className:"flex-1 min-w-0 font-mono",children:[c.jsxs("span",{className:W("flex gap-2 items-center text-left truncate text-[12px]",t?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:[c.jsx("span",{className:"truncate",children:a}),r&&c.jsx("span",{title:C("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),e.pendingInteraction&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-amber-100 px-1.5 py-0.5 text-[8.5px] text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"),children:[c.jsx(As,{className:"h-2.5 w-2.5"}),C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission")]}),e.relationType==="fork"&&e.parentId&&c.jsxs("span",{title:`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,"aria-label":`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:[C("session.forkedFrom")," ",e.parentId.slice(0,6)]}),e.taskRetriedFrom&&c.jsx("span",{title:`${C("session.retriedFrom")} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:C("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 truncate text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:l.project}),c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate",children:l.environment}),l.queue&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"text-amber-700 truncate dark:text-amber-400",children:l.queue})]}),l.diff&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate text-[hsl(var(--deck-accent))]",children:l.diff})]})]}),l.reason&&c.jsx("span",{title:l.reason,className:"mt-0.5 block truncate text-[9.5px] text-red-600 dark:text-red-400",children:l.reason})]}),n&&c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]}),c.jsxs("div",{className:W("flex items-center gap-0.5 pr-2 transition-opacity group-focus-within:opacity-100",e.taskStatus==="running"||e.taskStatus==="queued"||e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")?"opacity-100":"opacity-50 group-hover:opacity-100"),children:[(e.taskStatus==="running"||e.taskStatus==="queued")&&c.jsx("button",{type:"button","aria-label":C(d?"session.action.stopping":"session.action.stop",{title:a}),disabled:d,onClick:P=>{P.stopPropagation(),x()},className:"flex h-6 w-6 items-center justify-center rounded text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:d?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(el,{className:"h-3 w-3"})}),e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")&&c.jsx("button",{ref:K,type:"button","aria-label":C(m?"session.action.retrying":"session.action.retry",{title:a}),disabled:m,onClick:P=>{P.stopPropagation(),b()},className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:m?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(Qi,{className:"h-3 w-3"})}),c.jsxs(Gn,{open:O,onOpenChange:R,children:[c.jsx(Vn,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":C("session.action.more",{title:a}),"aria-expanded":O,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-canvas))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(uS,{className:"h-3.5 w-3.5"})})}),c.jsxs(Mn,{ref:X,role:"menu","aria-label":C("session.action.more",{title:a}),side:"right",align:"start",sideOffset:6,className:"w-40 p-1",onOpenAutoFocus:P=>{var B,M;P.preventDefault(),(M=(B=X.current)==null?void 0:B.querySelector('[role="menuitem"]:not([disabled])'))==null||M.focus()},onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),R(!1),window.setTimeout(()=>{var B;return(B=K.current)==null?void 0:B.focus()},0))},children:[c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.fork",{title:a}),disabled:s,onClick:P=>{P.stopPropagation(),y(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45",children:[c.jsx(fS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.forkShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.rename",{title:a}),onClick:P=>{A(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none",children:[c.jsx(mS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.renameShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.archive",{title:a}),disabled:e.taskStatus==="running"||e.taskStatus==="queued",onClick:P=>{P.stopPropagation(),j(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-35",children:[c.jsx($f,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.archiveShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.export",{title:a}),disabled:p,onClick:P=>{P.stopPropagation(),k(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-wait disabled:opacity-45",children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):c.jsx(Rf,{className:"h-3 w-3","aria-hidden":!0}),C(p?"session.action.exportingShort":"session.action.exportShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.delete",{title:a}),onClick:P=>{N(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-red-600 transition-colors hover:bg-red-500/10 focus-visible:bg-red-500/10 focus-visible:outline-none dark:text-red-400",children:[c.jsx(Mf,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.deleteShort")]})]})]})]})]})}function W5({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const d=Ft(),m=[{icon:Df,action:s,labelKey:"sidebar.section.settings"}];return c.jsxs("div",{className:W("flex flex-col gap-2 items-center py-5 h-screen border-r w-[64px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",l),children:[c.jsx("button",{onClick:e,className:"rounded-md p-1 transition-colors hover:bg-[hsl(var(--deck-surface))]","aria-label":d("sidebar.action.expand"),children:c.jsx(su,{size:28})}),c.jsx("button",{onClick:t,"aria-label":d("sidebar.action.newTaskShort"),title:d("sidebar.action.newTaskShort"),className:"mt-6 flex h-10 w-10 items-center justify-center rounded-md bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/85",children:c.jsx(tl,{className:"h-4 w-4 stroke-[2.5]"})}),c.jsx("button",{onClick:r,"aria-label":d("sidebar.action.terminalToggle"),title:d("sidebar.action.terminal"),className:W("flex h-10 w-10 items-center justify-center rounded-md border transition-colors",o?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-transparent text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]"),children:c.jsx(_f,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":d("sidebar.action.searchTasks"),title:`${d("sidebar.action.searchTasks")} (${Gc("searchTasks")})`,className:"relative flex h-10 w-10 items-center justify-center rounded-md border border-transparent text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(nl,{className:"h-4 w-4"}),a>0&&c.jsx("span",{"aria-label":d("sidebar.unreadTasks",{count:a}),className:"absolute right-0.5 top-0.5 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-[hsl(var(--deck-accent))] px-1 font-mono text-[8px] font-semibold text-white",children:a>99?"99+":a})]}),c.jsx("div",{className:"flex-1"}),c.jsx("div",{className:"my-2 h-px w-6 bg-[hsl(var(--deck-hairline))]"}),m.map(({icon:p,action:g,labelKey:x})=>c.jsx("button",{"data-settings-trigger":!0,onClick:g,"aria-label":d(x),title:d(x),className:"flex h-10 w-10 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(p,{className:"w-4 h-4"})},x)),c.jsx(py,{variant:"compact"}),c.jsx("div",{className:"mt-1",children:c.jsx("div",{role:"status","aria-label":d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline"),className:W("h-2 w-2 rounded-full",i?"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60"),title:d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline")})})]})}const by="blade.sidebar.project-order.v1";function mi(e){const t=new Set,n=[];for(const r of e)typeof r!="string"||!r||t.has(r)||(t.add(r),n.push(r));return n}function J5(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(by)??"[]");return Array.isArray(e)?mi(e):[]}catch{return[]}}function Q5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(by,JSON.stringify(mi(e)))}catch{}}function Y5(e,t){const n=new Map(mi(t).map((s,o)=>[s,o])),r=n.size;return e.map((s,o)=>({project:s,rank:n.get(s.path)??r+o})).sort((s,o)=>s.rank-o.rank).map(({project:s})=>s)}function X5(e,t,n){const r=mi(e),s=r.indexOf(t),o=r.indexOf(n);if(s<0||o<0||s===o)return r;const[i]=r.splice(s,1);return r.splice(o,0,i),r}function Z5(e,t,n){const r=mi(e),s=r.indexOf(t),o=s+n;return s<0||o<0||o>=r.length||([r[s],r[o]]=[r[o],r[s]]),r}function e_({name:e,path:t,count:n,countIsPartial:r=!1,isActive:s,hasRunning:o,unreadCount:i,collapsed:a,onToggle:l,onSelect:d,onCreateTask:m,reorderPosition:p,reorderCount:g,isDragging:x=!1,onDragStart:b,onDragEnd:y,onReorderKeyDown:j}){const k=Ft();return c.jsxs("div",{className:W("group/proj flex w-full items-center gap-2 px-5 pb-1.5 pt-3 text-left transition-colors","hover:bg-[hsl(var(--deck-surface))]/40"),children:[c.jsx("button",{type:"button",draggable:!0,"data-project-drag-handle":t,onDragStart:b,onDragEnd:y,onKeyDown:j,"aria-label":k("sidebar.project.reorder",{name:e,position:p,count:g}),title:k("sidebar.project.reorderHint"),className:W("-ml-2 flex h-6 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-45 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink-muted))] hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] active:cursor-grabbing group-hover/proj:opacity-100",x&&"cursor-grabbing opacity-100 text-[hsl(var(--deck-accent))]"),children:c.jsx(pS,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:l,"aria-expanded":!a,"aria-label":k(a?"sidebar.project.expand":"sidebar.project.collapse",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(gS,{className:W("h-3 w-3 text-[hsl(var(--deck-ink-faint))] transition-transform duration-150",!a&&"rotate-90")})}),c.jsxs("button",{type:"button",onClick:d??l,title:t,"aria-current":s?"true":void 0,className:"flex min-h-6 min-w-0 flex-1 items-center gap-2 rounded-sm text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(uo,{className:W("h-3.5 w-3.5 shrink-0",s?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsx("span",{className:W("flex-1 truncate font-mono text-[11.5px] font-medium tracking-[-0.01em]",s?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:e}),o&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse dark:bg-blue-400","aria-hidden":!0}),i>0&&c.jsx("span",{"aria-label":k("sidebar.unreadTasks",{count:i}),className:"shrink-0 rounded-full bg-[hsl(var(--deck-accent))] px-1.5 py-0.5 font-mono text-[8px] font-semibold text-white",children:i}),c.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[n.toString().padStart(2,"0"),r?"+":""]})]}),m&&c.jsx("button",{type:"button",onClick:m,title:k("sidebar.project.newTask",{name:e}),"aria-label":k("sidebar.project.newTask",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-0 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-accent))] focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] group-hover/proj:opacity-100",children:c.jsx(tl,{className:"h-3.5 w-3.5"})})]})}function Vc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function vf(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function ou(e,t){return vf(e)-vf(t)||Vc(t)-Vc(e)}const t_=["running","queued","interrupted","failed","cancelled","completed"],n_={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},ys=e=>e.length>1?e.replace(/\/+$/,""):e;function ky(e){const t=new Map;for(const n of e){if(!n)continue;const r=ze(pe(n));t.has(r)||t.set(r,n)}return Array.from(t.values())}function r_(e){const t=ky(e),n=[];for(const r of t_){const s=t.filter(o=>o.taskStatus===r).sort(ou);s.length>0&&n.push({code:n_[r],status:r,sessions:s})}return n}function s_(e,t,n=[]){const r=ky(e),s=new Map,o=n.map(ys),i=new Map(o.map((d,m)=>[d,m]));for(const d of o)s.set(d,[]);for(const d of r){const m=fi(d,t),p=s.get(m);p?p.push(d):s.set(m,[d])}const a=t?ys(t):null,l=Array.from(s.entries()).map(([d,m])=>{const p=[...m].sort(ou),g=m.reduce((x,b)=>Math.max(x,Vc(b)),0);return{path:d,name:Hc(d),isActive:a?ys(d)===a:!1,isBound:i.has(ys(d)),hasRunning:m.some(x=>x.taskStatus==="running"),lastActivity:g,sessions:p}});return l.sort((d,m)=>d.isBound!==m.isBound?d.isBound?-1:1:d.isBound&&m.isBound?(i.get(ys(d.path))??Number.MAX_SAFE_INTEGER)-(i.get(ys(m.path))??Number.MAX_SAFE_INTEGER):m.lastActivity-d.lastActivity),l}const If=12,o_={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},i_={RUNNING:"text-blue-700 dark:text-blue-400",QUEUED:"text-amber-700 dark:text-amber-400",INTERRUPTED:"text-orange-700 dark:text-orange-400",FAILED:"text-red-700 dark:text-red-400",CANCELLED:"text-[hsl(var(--deck-ink-faint))]",DONE:"text-[hsl(var(--deck-accent))]"};function a_({view:e,sessions:t,activeProjectPath:n,boundProjects:r,currentSessionRef:s,unreadTaskKeys:o,catalogLoadState:i,catalogError:a,onSelectProject:l,onCreateTask:d,onRetryCatalog:m,renderRow:p}){const g=Ft(),[x,b]=w.useState({}),[y,j]=w.useState({}),[k,A]=w.useState(J5),[N,$]=w.useState(null),[Q,T]=w.useState(null),[C,O]=w.useState(""),R=i==="loading"||i==="hydrating",K=R||i==="error",X=w.useMemo(()=>e==="status"?r_(t):[],[t,e]),P=w.useMemo(()=>e==="project"?s_(t,n,r.map(F=>F.path)):[],[n,r,t,e]),B=w.useMemo(()=>Y5(P,k),[P,k]),M=(F,me)=>{const Se=y[F]??!1,Ee=Se?me:me.filter((Z,_)=>{if(_<If)return!0;const Ge=pe(Z);return!!Z.pendingInteraction||o.includes(ze(Ge))||!!(s&&oe(Ge,s))}),Pe=me.length-Ee.length,U=Se?me.length>If:Pe>0;return c.jsxs(c.Fragment,{children:[Ee.map(p),U&&c.jsx("button",{type:"button",onClick:()=>j(Z=>({...Z,[F]:!Se})),className:"mx-4 my-1 rounded-md px-3 py-1.5 text-left font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:Se?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:Pe})})]})},fe=R?c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-[hsl(var(--deck-surface))]/55 px-3 py-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.syncing")}),c.jsx("span",{className:"tabular-nums shrink-0",children:g("sidebar.catalog.loaded",{count:t.length})})]}):i==="error"?c.jsxs("div",{role:"alert",title:a??void 0,className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-amber-50/80 px-3 py-2 font-mono text-[9.5px] text-amber-800 dark:bg-amber-950/35 dark:text-amber-300",children:[c.jsx(As,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.incomplete")}),c.jsxs("button",{type:"button",onClick:m,className:"inline-flex min-h-6 shrink-0 items-center gap-1 rounded px-1.5 font-medium hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"h-2.5 w-2.5"}),g("sidebar.catalog.retry")]})]}):null;if(e==="status")return c.jsxs("div",{className:"flex flex-col",children:[fe,X.map((F,me)=>c.jsxs("div",{children:[c.jsxs("div",{className:W("flex items-center justify-between px-5 pb-2 pt-3 font-mono text-[10px] tracking-[0.16em]",i_[F.code]??"text-[hsl(var(--deck-ink-faint))]",me===0&&"pt-2"),children:[c.jsx("span",{children:g(o_[F.code])}),c.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:[F.sessions.length.toString().padStart(2,"0"),K?"+":""]})]}),M(`status:${F.code}`,F.sessions)]},F.code))]});const ve=B.some(F=>F.isActive),ke=F=>!!(s&&F.sessions.some(me=>oe(pe(me),s))),ce=(F,me)=>{if(F.join("\0")===B.map(Ee=>Ee.path).join("\0"))return;A(F),Q5(F);const Se=B.find(Ee=>Ee.path===me);O(g("sidebar.project.reordered",{name:(Se==null?void 0:Se.name)??me,position:F.indexOf(me)+1}))},Fe=(F,me)=>{const Se=F.sessions.filter(_=>o.includes(ze(pe(_)))).length,Ee=ke(F),Pe=Se>0,U=F.sessions.some(_=>!!_.pendingInteraction),Z=x[F.path]??(ve&&!F.isActive&&!(Ee||F.hasRunning||Pe||U));return c.jsxs("div",{"data-project-group":F.path,onDragEnter:_=>{!N||N===F.path||(_.preventDefault(),T(F.path))},onDragOver:_=>{!N||N===F.path||(_.preventDefault(),_.dataTransfer.dropEffect="move")},onDrop:_=>{_.preventDefault();const Ge=N||_.dataTransfer.getData("text/plain");Ge&&Ge!==F.path&&ce(X5(B.map(Ne=>Ne.path),Ge,F.path),Ge),$(null),T(null)},className:W("relative transition-colors",Q===F.path&&N!==F.path&&"bg-[hsl(var(--deck-accent-soft))]/55 before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-[hsl(var(--deck-accent))]"),children:[c.jsx(e_,{name:F.name,path:F.path,count:F.sessions.length,countIsPartial:K,isActive:F.isActive,hasRunning:F.hasRunning,unreadCount:Se,collapsed:Z,onSelect:()=>l(F.path),onCreateTask:()=>d(F.path),reorderPosition:me+1,reorderCount:B.length,isDragging:N===F.path,onDragStart:_=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",F.path),$(F.path)},onDragEnd:()=>{$(null),T(null)},onReorderKeyDown:_=>{if(_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;_.preventDefault();const Ge=Z5(B.map(Ne=>Ne.path),F.path,_.key==="ArrowUp"?-1:1);ce(Ge,F.path)},onToggle:()=>b(_=>({..._,[F.path]:!Z}))}),!Z&&M(`project:${F.path}`,F.sessions)]},F.path)};return c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"sr-only","aria-live":"polite",children:C}),fe,B.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-5 pb-0.5 pt-2 font-mono text-[9px] uppercase tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:g("sidebar.project.projects")}),B.map(Fe)]})]})}function c_({className:e,onNavigate:t}){const n=Ft(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:d,setTaskSwitcherOpen:m}=kr(),p=L(S=>S.sessions),g=L(S=>S.catalogLoadState),x=L(S=>S.catalogError),b=L(S=>S.currentSessionRef),y=L(S=>S.forkingSessionRef),j=L(S=>S.selectSession),k=L(S=>S.startTemporarySession),A=L(S=>S.deleteSession),N=L(S=>S.archiveSession),$=L(S=>S.forkSession),Q=L(S=>S.updateSession),T=L(S=>S.loadSessions),C=L(S=>S.setError),O=L(S=>S.taskEventsConnected),R=L(S=>S.taskWorkspaceInfo),K=L(S=>S.boundProjects),X=L(S=>S.selectedProjectPath),P=L(S=>S.bindProject),B=L(S=>S.selectProject),M=L(S=>S.cancelTask),fe=L(S=>S.cancellingTaskKeys),ve=L(S=>S.retryTask),ke=L(S=>S.retryingTaskKeys),ce=L(S=>S.unreadTaskKeys),[Fe,F]=w.useState(null),[me,Se]=w.useState(""),[Ee,Pe]=w.useState(null),[U,Z]=w.useState(!1),_=X??(R==null?void 0:R.cwd)??null,Ge=S=>ho(S,n),Ne=S=>{const Y=S.taskSourceProjectPath||S.projectPath,De=Y.split("/").filter(Boolean).at(-1)||Y,mt=S.taskIsolation==="worktree"?S.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),zn=S.taskDiffStat?`+${S.taskDiffStat.additions} −${S.taskDiffStat.deletions}`:void 0,ms=S.taskStatus==="queued"&&S.taskQueuePosition?n("session.queued",{position:S.taskQueuePosition,depth:S.taskQueueDepth??S.taskQueuePosition}):void 0,ps=nu(S,n);return{project:De,environment:mt,diff:zn,queue:ms,reason:ps}},Oe=()=>{k(_??void 0),t==null||t()},on=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Sn=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Xe=S=>{S(),t==null||t()},qn=async(S,Y)=>{S.stopPropagation(),await A(pe(Y))},ft=async S=>{const Y=pe(S),De=ze(Y);if(!Ee){Pe(De);try{await my(Y)}catch(mt){C(mt instanceof Error?mt.message:"Session export failed")}finally{Pe(null)}}},an=(S,Y)=>{S.stopPropagation(),F(ze(pe(Y))),Se(Ge(Y))},Rn=async S=>{if(!me.trim()){F(null);return}try{await Q(pe(S),me.trim()),F(null),await T()}catch(Y){console.error("Failed to rename session:",Y)}},_t=()=>{F(null),Se("")};return o?c.jsxs("div",{className:W("flex flex-col h-screen border-r w-[260px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",e),children:[c.jsxs("div",{className:"flex flex-col gap-6 px-5 pt-5 pb-5",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(su,{size:26}),c.jsx("span",{className:"font-mono text-[15px] font-semibold tracking-[-0.01em] text-[hsl(var(--deck-ink))]",children:"Blade"}),c.jsx("span",{className:"ml-1 rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.brand.badge")})]}),c.jsx("button",{onClick:s,"aria-label":n("sidebar.action.collapse"),className:"flex h-8 w-8 items-center justify-center rounded transition-colors hover:bg-[hsl(var(--deck-surface))]",children:c.jsx(hS,{className:"h-3 w-3 text-[hsl(var(--deck-ink-muted))]"})})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsxs("button",{onClick:Oe,className:"flex h-9 w-full items-center justify-between rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[13px] font-medium text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/88",children:[c.jsxs("span",{className:"flex gap-2 items-center",children:[c.jsx(tl,{className:"h-3.5 w-3.5 stroke-[2.5]"}),n("sidebar.action.newTask")]}),c.jsx("span",{className:"rounded-sm bg-white/10 px-1.5 py-[1px] font-mono text-[10px] text-white/80",children:Gc("newTask")})]}),c.jsxs("button",{onClick:()=>Xe(a),className:W("flex h-9 w-full items-center gap-2 rounded-md border px-3 font-mono text-[12.5px] transition-colors",i?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))] hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]"),children:[c.jsx(_f,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Xe(()=>m(!0)),className:"flex h-9 w-full items-center justify-between rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(nl,{className:"h-3.5 w-3.5"}),n("sidebar.action.searchTasks")]}),c.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-1.5 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:ce.length>0?ce.length:Gc("searchTasks")})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("div",{className:"flex flex-1 items-center gap-0.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0.5",children:["project","status"].map(S=>c.jsx("button",{type:"button",onClick:()=>d(S),"aria-pressed":l===S,"aria-label":n(S==="project"?"sidebar.view.projectAria":"sidebar.view.statusAria"),className:W("flex-1 rounded-[5px] py-1 font-mono text-[11px] tracking-[0.02em] transition-colors",l===S?"bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] shadow-sm":"text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:n(S==="project"?"sidebar.view.project":"sidebar.view.status")},S))}),c.jsx("button",{type:"button",onClick:()=>Z(!0),title:n("projects.bind.action"),"aria-label":n("projects.bind.action"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-accent))]",children:c.jsx(Oi,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(ru,{className:"flex-1 px-0",children:c.jsxs("div",{className:"flex flex-col",children:[(p.length>0||K.length>0||g==="loading"||g==="hydrating"||g==="error")&&c.jsx(a_,{view:l,sessions:p,activeProjectPath:_,boundProjects:K,currentSessionRef:b,unreadTaskKeys:ce,catalogLoadState:g,catalogError:x,onRetryCatalog:T,onSelectProject:S=>void on(S).catch(()=>{}),onCreateTask:S=>void Sn(S).catch(()=>{}),renderRow:S=>{const Y=pe(S),De=ze(Y),mt=oe(Y,b),zn=Fe===De,ms=oe(Y,y),ps=!!y;return c.jsx(V5,{session:S,sessionRef:Y,isActive:mt,isForking:ms,isUnread:ce.includes(ze(Y)),anyForking:ps,isEditing:zn,editingTitle:me,title:Ge(S),context:Ne(S),isCancelling:fe.includes(ze(Y)),isRetrying:ke.includes(ze(Y)),isExporting:Ee===De,onSelect:()=>(t==null||t(),j(Y)),onCancelTask:()=>{M(Y).catch(()=>{})},onRetryTask:()=>{ve(Y).catch(()=>{})},onFork:()=>void $(S),onArchive:()=>void N(Y),onExport:()=>void ft(S),onStartRename:gs=>an(gs,S),onDelete:gs=>qn(gs,S),onEditingTitleChange:Se,onSaveRename:()=>Rn(S),onCancelRename:_t},De)}}),p.length===0&&c.jsx("div",{className:"px-5 mt-6",children:c.jsxs("div",{className:"rounded-md border border-dashed border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/60 px-4 py-6 text-center",children:[c.jsx("div",{className:"mx-auto mb-2 inline-flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))]",children:c.jsx(Lf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"})}),c.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("sidebar.empty.title")}),c.jsx("div",{className:"mt-1 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.empty.hint")})]})})]})}),c.jsxs("div",{className:"flex flex-col gap-3 px-5 pt-3 pb-5",children:[c.jsxs("div",{className:"flex flex-col gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-3",children:[c.jsx(z5,{}),[{icon:Df,action:()=>Xe(r),labelKey:"sidebar.section.settings"}].map(({icon:S,action:Y,labelKey:De})=>c.jsxs("button",{"data-settings-trigger":!0,onClick:Y,className:"flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(S,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),n(De)]},De))]}),c.jsxs("div",{className:"flex gap-2 justify-between items-center",children:[c.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.language.label")}),c.jsx(py,{})]}),c.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2",children:[c.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-[hsl(var(--deck-canvas-veil))]",children:c.jsx("div",{className:"h-2 w-2 rounded-full bg-[hsl(var(--deck-ink))]"})}),c.jsxs("div",{className:"flex flex-1 flex-col gap-[1px]",children:[c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:n("sidebar.status.user")}),c.jsxs("span",{className:W("flex gap-1 items-center font-mono text-[10px]",O?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",O?"bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60")}),n(O?"sidebar.status.feedLive":"sidebar.status.feedOffline")]})]})]})]}),c.jsx(hy,{open:U,onOpenChange:Z})]}):c.jsx(W5,{className:e,onExpand:s,onNewChat:Oe,onOpenTaskSwitcher:()=>Xe(()=>m(!0)),onToggleTerminal:()=>Xe(a),onToggleSettings:()=>Xe(r),isTerminalOpen:i,taskEventsConnected:O,unreadCount:ce.length})}const l_=w.lazy(()=>Io(()=>import("./SettingsModal-CoBMb8of.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),xy=()=>Io(()=>import("./TaskSwitcher-BmS-DA4i.js"),__vite__mapDeps([4,1,3,2])).then(e=>({default:e.TaskSwitcher})),d_=w.lazy(xy),u_=w.lazy(()=>Io(()=>import("./FilePreview-Di-mSDMs.js"),__vite__mapDeps([5,1,3,2])).then(e=>({default:e.FilePreview}))),f_=w.lazy(()=>Io(()=>import("./TerminalPanel-BPruynbV.js"),__vite__mapDeps([6,1,7,8,3,2])).then(e=>({default:e.TerminalPanel}))),lc=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},m_=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function p_({children:e}){var Ee,Pe;const t=Ft();q5();const{isSidebarOpen:n,isFilePreviewOpen:r,isSettingsOpen:s,isTerminalOpen:o,isTaskSwitcherOpen:i,toggleFilePreview:a,openFilePreview:l,previewRequestId:d,setSidebarOpen:m}=kr();w.useEffect(()=>{const U=window.setTimeout(()=>{xy()},1500);return()=>window.clearTimeout(U)},[]);const p=L(U=>U.currentSessionId),g=L(U=>U.currentSessionRef),x=L(U=>U.sessions),b=L(U=>U.isStreaming),y=L(U=>U.isTemporarySession),j=L(U=>U.taskWorkspaceInfo),k=L(U=>U.boundProjects),A=L(U=>U.selectedProjectPath),[N,$]=w.useState(null),[Q,T]=w.useState(!1),[C,O]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[R,K]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),X=w.useRef(null),P=w.useRef(null),B=w.useRef(null),M=w.useMemo(()=>x.find(U=>oe({sessionId:U.sessionId,projectPath:U.projectPath},g)),[g,x]),fe=(M==null?void 0:M.taskIsolation)==="worktree"&&M.taskSourceProjectPath&&(((Ee=M.taskDelivery)==null?void 0:Ee.status)==="applied"||((Pe=M.taskDelivery)==null?void 0:Pe.status)==="discarded")?M.taskSourceProjectPath:g==null?void 0:g.projectPath;w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 900px)"),Z=()=>{U.matches&&m(!1)};return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[m]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 639px)"),Z=()=>O(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 1023px)"),Z=()=>K(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(!C||!n)return;const U=requestAnimationFrame(()=>{var Z,_;(_=(Z=X.current)==null?void 0:Z.querySelector("button"))==null||_.focus()});return()=>{var Z;cancelAnimationFrame(U),(Z=P.current)==null||Z.focus({preventScroll:!0})}},[C,n]);const ve=U=>{var Ne;if(!C||!n)return;if(U.key==="Escape"){U.preventDefault(),m(!1);return}if(U.key!=="Tab")return;const Z=Array.from(((Ne=X.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(Z.length===0)return;const _=Z[0],Ge=Z[Z.length-1];U.shiftKey&&document.activeElement===_?(U.preventDefault(),Ge==null||Ge.focus()):!U.shiftKey&&document.activeElement===Ge&&(U.preventDefault(),_==null||_.focus())},ke=w.useMemo(()=>!p||y?A?lc(A):null:M!=null&&M.projectPath?lc(M.taskSourceProjectPath||M.projectPath):null,[p,M,y,A]),ce=w.useMemo(()=>ke?m_(ke):[],[ke]);w.useEffect(()=>{var Z;if(!g){$(((Z=k.find(_=>_.path===A))==null?void 0:Z.gitBranch)??null);return}(async()=>{try{const _=await re.getGitInfo({sessionId:g.sessionId,projectPath:fe??g.projectPath});$(_.branch)}catch{$(null)}})()},[k,g,fe,A]);const Fe=j==null?void 0:j.taskAdmission,F=fe??A??(j==null?void 0:j.cwd)??null,me=g?ze(g):`project:${A??"none"}`,Se=r&&R;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[C&&n&&!Se&&c.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>m(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),c.jsx("div",{ref:X,role:C&&n&&!Se?"dialog":void 0,"aria-modal":C&&n&&!Se?!0:void 0,"aria-label":C&&n&&!Se?t("sidebar.navigationAria"):void 0,"aria-hidden":Se||C&&!n?!0:void 0,inert:Se||C&&!n?!0:void 0,onKeyDown:ve,className:W("overflow-hidden",n?"w-[260px]":"w-[64px]",C?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",C&&!n&&"-translate-x-full"),children:c.jsx("div",{className:W("transition-all duration-300 ease-in-out",n?"w-[260px]":"w-[64px]"),children:c.jsx(c_,{onNavigate:()=>{C&&m(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":Se||void 0,inert:Se||void 0,className:"relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6",children:[C&&c.jsx(br,{ref:P,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>m(!0),"aria-label":t("layout.action.openNavigation"),title:t("layout.action.openNavigation"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(bS,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ce.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:ke??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:ce.map((U,Z)=>{const _=Z===ce.length-1,Ge=Z===0&&U==="~";return c.jsxs("span",{className:"flex items-center min-w-0",children:[Z>0&&c.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),Z===0&&!Ge&&c.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),c.jsx("span",{className:W("truncate",_?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:U})]},Z)})}):c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?lc(j.cwd):t("layout.workspace.empty")}),N&&c.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(Zc,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),N]})]}),c.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[Fe&&c.jsx("span",{className:"hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex",children:c.jsx(ay,{inFlight:Fe.inFlight,queued:Fe.queued,maxConcurrent:Fe.maxConcurrent,compact:!0})}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx(br,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:!g||y||b,onClick:()=>T(!0),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35",children:c.jsx(Qi,{className:"w-4 h-4"})}),c.jsx(br,{ref:B,variant:"ghost",size:"icon",onClick:()=>{if(r){a();return}l((!g||y)&&d===0?{tab:"files"}:void 0)},title:t("layout.action.filePreview"),"aria-label":t("layout.action.filePreviewToggle"),className:W("h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",r&&"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] hover:text-[hsl(var(--deck-accent))]"),children:c.jsx(kS,{className:"w-4 h-4"})})]})]})]}),c.jsxs("main",{className:"flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]",children:[c.jsx("div",{"data-preview-background":"content","aria-hidden":Se||void 0,inert:Se||void 0,className:"flex relative flex-col flex-1 min-w-0",children:s?c.jsx(w.Suspense,{fallback:null,children:c.jsx(l_,{})}):e}),r&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(u_,{returnFocusElement:B.current},me)})]})]}),o&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(f_,{workspacePath:F},F??"default-workspace")}),i&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(d_,{})}),c.jsx(R5,{open:Q,onOpenChange:T})]})}const dc="BladeCode";function g_(){const e=Ft(),t=L(i=>i.unreadTaskKeys),n=L(i=>i.sessions),r=L(i=>i.selectSession),s=L(i=>i.selectProject),o=w.useMemo(()=>{const i=new Set(t);for(const a of n)a.pendingInteraction&&i.add(ze(pe(a)));return i.size},[n,t]);return w.useEffect(()=>(document.title=o>0?`(${o}) ${dc}`:dc,()=>{document.title=dc}),[o]),w.useEffect(()=>{const i=a=>{var g;const l=a.detail;if(!(l!=null&&l.sessionId)||!l.projectPath)return;const d=L.getState(),m=Zd(d.sessions,l),p=m?fi(m,d.selectedProjectPath??((g=d.taskWorkspaceInfo)==null?void 0:g.cwd)??null):l.projectPath;d.boundProjects.some(x=>x.available&&x.path===p)&&s(p),r(l)};return window.addEventListener(Ki,i),()=>window.removeEventListener(Ki,i)},[s,r]),c.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const Wc=w.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:W("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Wc.displayName="Textarea";const h_=(e,t)=>{const n=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(const r of n){const s=r[1],o=r.index+(r[0].length-s.length),i=o+s.length;if(t>=o&&t<=i){let a=s.slice(1),l=!1;return a.startsWith('"')&&(l=!0,a=a.slice(1),a.endsWith('"')&&(a=a.slice(0,-1))),{hasQuery:!0,query:a,startIndex:o,endIndex:i,quoted:l}}}return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}},b_=(e,t,n={})=>{const{debounceDelay:r=200,maxSuggestions:s=15,workspacePath:o}=n,[i,a]=w.useState([]),[l,d]=w.useState(0),[m,p]=w.useState(!1),g=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:h_(e,t),[e,t]);w.useEffect(()=>{if(!g.hasQuery){a([]),p(!1);return}let y=!1;p(!0);const k=setTimeout(async()=>{try{const A=await fetch(`/suggestions/files?q=${encodeURIComponent(g.query)}&limit=${s}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!A.ok)throw new Error("Failed to fetch suggestions");const N=await A.json();y||a(N)}catch(A){console.error("Failed to fetch file suggestions:",A),y||a([])}finally{y||p(!1)}},r);return()=>{y=!0,clearTimeout(k)}},[g.hasQuery,g.query,r,s,o]),w.useEffect(()=>{d(0)},[i]);const x=w.useCallback(()=>{d(y=>(y+1)%Math.max(i.length,1))},[i.length]),b=w.useCallback(()=>{d(y=>(y-1+i.length)%Math.max(i.length,1))},[i.length]);return{...g,suggestions:i,selectedIndex:l,loading:m,setSelectedIndex:d,selectNext:x,selectPrevious:b}},k_=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,x_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=k_(n,t.quoted),s=e.slice(0,t.startIndex),o=e.slice(t.endIndex),i=s+r+" "+o,a=t.startIndex+r.length+1;return{newInput:i,newCursorPos:a}};function y_(){const[e,t]=w.useState([]),[n,r]=w.useState(-1),s=w.useRef(""),o=w.useCallback(d=>{d.trim()&&(t(m=>m[m.length-1]===d?m:[...m,d]),r(-1),s.current="")},[]),i=w.useCallback(d=>{if(e.length===0)return null;n===-1&&(s.current=d);const m=n===-1?e.length-1:Math.max(0,n-1);return r(m),e[m]??null},[e,n]),a=w.useCallback(()=>{if(n===-1)return null;const d=n+1;return d>=e.length?(r(-1),s.current):(r(d),e[d]??null)},[e,n]),l=w.useCallback(()=>{r(-1),s.current=""},[]);return{addToHistory:o,getPrevious:i,getNext:a,reset:l,historyIndex:n}}const S_=(e,t)=>{if(!e.startsWith("/"))return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1};const n=e.indexOf(" "),r=n===-1?e.length:n;return t<=r?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}},w_=(e,t,n={})=>{const{debounceDelay:r=150,workspacePath:s}=n,[o,i]=w.useState([]),[a,l]=w.useState(0),[d,m]=w.useState(!1),p=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:S_(e,t),[e,t]);w.useEffect(()=>{if(!p.hasQuery){i([]),m(!1);return}let b=!1;m(!0);const j=setTimeout(async()=>{try{const k=await fetch(`/suggestions/commands?q=${encodeURIComponent(p.query)}`,s?{headers:{"x-blade-directory":s}}:void 0);if(!k.ok)throw new Error("Failed to fetch suggestions");const A=await k.json();b||i(A)}catch(k){console.error("Failed to fetch command suggestions:",k),b||i([])}finally{b||m(!1)}},r);return()=>{b=!0,clearTimeout(j)}},[p.hasQuery,p.query,r,s]),w.useEffect(()=>{l(0)},[o]);const g=w.useCallback(()=>{l(b=>(b+1)%Math.max(o.length,1))},[o.length]),x=w.useCallback(()=>{l(b=>(b-1+o.length)%Math.max(o.length,1))},[o.length]);return{...p,suggestions:o,selectedIndex:a,loading:d,setSelectedIndex:l,selectNext:g,selectPrevious:x}},v_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=e.slice(t.endIndex),s=n.command+" "+r.trimStart(),o=n.command.length+1;return{newInput:s,newCursorPos:o}},I_="blade.composer.draft.",Gi=new Map,yy=1;function Vi(){return typeof sessionStorage>"u"?null:sessionStorage}function Wi(e){return`${I_}${e}`}function C_(e){var n;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=Gi.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const r=((n=Vi())==null?void 0:n.getItem(Wi(e)))??"";if(!r)return{content:"",attachments:[],outputSchema:void 0};try{const s=JSON.parse(r);if(s.version===yy&&typeof s.content=="string"&&(s.outputSchema===void 0||typeof s.outputSchema=="string"))return{content:s.content,attachments:[],outputSchema:s.outputSchema}}catch{}return{content:r,attachments:[],outputSchema:void 0}}catch{return{content:"",attachments:[],outputSchema:void 0}}}function cn(e,t){var s,o;if(!e)return;const n=Gi.get(e),r=t.outputSchema??(n==null?void 0:n.outputSchema);if(!t.content&&t.attachments.length===0&&!r){Sy(e);return}Gi.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:r});try{t.content||r?(s=Vi())==null||s.setItem(Wi(e),JSON.stringify({version:yy,content:t.content,...r?{outputSchema:r}:{}})):(o=Vi())==null||o.removeItem(Wi(e))}catch{}}function Sy(e){var t;if(e){Gi.delete(e);try{(t=Vi())==null||t.removeItem(Wi(e))}catch{}}}function Jc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function j_(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function T_(e,t){const r=Jc(e)+t.reduce((s,o)=>s+j_(o),0);return e.length+t.length>zr?{accepted:!1,reason:"count",estimatedBytes:r}:r>po?{accepted:!1,reason:"bytes",estimatedBytes:r}:{accepted:!0,estimatedBytes:r}}const A_=e=>typeof e=="object"&&"command"in e,Cf=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:s,onHover:o,visible:i})=>{const a=w.useRef(null),l=w.useRef(null);if(w.useEffect(()=>{if(l.current&&a.current){const m=a.current,p=l.current,g=m.getBoundingClientRect(),x=p.getBoundingClientRect();x.bottom>g.bottom?m.scrollTop+=x.bottom-g.bottom+4:x.top<g.top&&(m.scrollTop-=g.top-x.top+4)}},[n]),!i||t.length===0&&!r)return null;const d=e==="command"?Uf:Su;return c.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50",children:c.jsxs("div",{className:"mx-4 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700 rounded-lg shadow-xl overflow-hidden",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#6B7280] dark:text-zinc-400",children:[c.jsx(d,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:e==="command"?"Commands":"Files"}),r&&c.jsx(lt,{className:"h-3 w-3 animate-spin ml-auto"})]}),c.jsx("div",{ref:a,className:"max-h-64 overflow-y-auto py-1",children:t.length===0&&r?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"Loading..."}):t.length===0?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"No matches found"}):t.map((m,p)=>{const g=p===n,x=A_(m);return c.jsx("button",{ref:g?l:null,className:W("w-full text-left px-3 py-2 flex items-start gap-3 transition-colors",g?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] hover:bg-[#F3F4F6] hover:text-[#111827] dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300"),onClick:()=>s(p),onMouseEnter:()=>o(p),children:x?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm text-blue-600 dark:text-blue-400",children:m.command}),m.argumentHint&&c.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono",children:m.argumentHint})]}),c.jsx("p",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate",children:m.description})]})}):c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(Su,{className:"h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500"}),c.jsx("span",{className:"font-mono text-sm truncate",children:m})]})},x?m.command:m)})}),c.jsxs("div",{className:"px-3 py-1.5 border-t border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#9CA3AF] dark:text-zinc-500 flex items-center gap-4",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"↑↓"})," ","Navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Tab"})," ","Select"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Esc"})," ","Close"]})]})]})})},uc=[{value:hr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:xS},{value:hr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:yS},{value:hr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:Bf,tone:"danger"},{value:hr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:SS}],E_=["off"],P_=["standard"],N_=[];function fc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function O_({onSend:e,onAbort:t,disabled:n,submitDisabled:r=!1,shellSubmitDisabled:s=!1,isStreaming:o,isStopping:i=!1,pendingSteeringCount:a=0,pendingInputDelivery:l=null,recoveredSteeringCount:d=0,variant:m="chat",draft:p,draftAttachments:g,draftRevision:x,draftKey:b,placeholder:y,workspacePath:j}){var ku;const k=Ft(),A=w.useRef(C_(b)),[N,$]=w.useState(A.current.content),[Q,T]=w.useState(A.current.attachments),C=w.useRef(N),O=w.useRef(Q),[R,K]=w.useState(A.current.outputSchema??""),X=w.useRef(R),[P,B]=w.useState(!1),[M,fe]=w.useState(null),[ve,ke]=w.useState(void 0),[ce,Fe]=w.useState(!1),[F,me]=w.useState(!1),[Se,Ee]=w.useState(!1),[Pe,U]=w.useState(!1),[Z,_]=w.useState(!1),[Ge,Ne]=w.useState(!1),[Oe,on]=w.useState(!1),[Sn,Xe]=w.useState(null),[qn,ft]=w.useState(null),an=N.trimStart().startsWith("!"),Rn=an?s:r,_t=w.useRef(null),S=w.useRef(!1),Y=w.useRef(null),De=w.useRef(null),{currentModelId:mt,configuredModels:zn,hasLoaded:ms,loadedWorkspacePath:ps,loadModels:gs,setCurrentModel:wy,currentMode:_a,setMode:iu}=Pt(),au=kr(v=>v.isSettingsOpen),vy=vo(v=>v.communicationStyle),cu=L(v=>v.setMaxContextTokens),Ce=L(v=>v.currentSessionRef),lu=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.selectedModelId}),Iy=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.reasoningEffort}),Cy=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.serviceTier}),jy=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.responseVerbosity}),[Ty,du]=w.useState(null),[Ay,La]=w.useState(null),[Ey,Ua]=w.useState(null),[Py,Ba]=w.useState(null),Ny=zn.some(v=>v.id===lu),hs=Ce?Ty??(Ny?lu:mt):mt,Ze=zn.find(v=>v.id===hs),Ha=(Ze==null?void 0:Ze.supportedReasoningEfforts)??E_,uu=["auto",...Ha],Dr=Ay??Iy??"off",pi=(Ze==null?void 0:Ze.supportedServiceTiers)??P_,Oy=["auto",...pi],_r=Ey??Cy??"auto",gi=(Ze==null?void 0:Ze.supportedResponseVerbosities)??N_,$y=["auto",...gi],Lr=Py??jy??"auto",fu=vy??"auto",Ry=uu.length>1,My=pi.some(v=>v!=="standard"),Fy=gi.length>0,mu=(Ze==null?void 0:Ze.displayName)||(Ze==null?void 0:Ze.model)||hs||k("chat.input.model.placeholder"),dr=((ku=Ze==null?void 0:Ze.input)==null?void 0:ku.includes("image"))===!0,Ys=Ze?k("chat.input.attachment.modelUnsupported",{model:mu}):k("chat.input.attachment.modelRequired"),hi=Q.length>0&&!dr,Jt=w_(N,ve,{workspacePath:j}),Qt=b_(N,ve,{workspacePath:j}),bs=y_(),Xs=Jt.hasQuery&&Jt.suggestions.length>0,bi=Qt.hasQuery&&Qt.suggestions.length>0,Dy=Xs||bi;w.useEffect(()=>{!au&&(!ms||ps!==(j??null))&&gs(j??void 0)},[au,gs,ps,ms,j]),w.useEffect(()=>{o&&(Fe(!1),me(!1),Ee(!1),U(!1),B(!1))},[o]),w.useEffect(()=>{du(null),La(null),Ua(null),Ba(null)},[Ce==null?void 0:Ce.projectPath,Ce==null?void 0:Ce.sessionId]),w.useEffect(()=>{Dr!=="auto"&&!Ha.includes(Dr)&&La("auto")},[Dr,Ha]),w.useEffect(()=>{_r!=="auto"&&!pi.includes(_r)&&Ua("auto")},[_r,pi]),w.useEffect(()=>{Lr!=="auto"&&!gi.includes(Lr)&&Ba("auto")},[Lr,gi]),w.useEffect(()=>{ft(null)},[hs]),w.useEffect(()=>{if(p!==void 0){const v=g??O.current;C.current=p,O.current=v,$(p),T(v),Xe(null),ft(null),ke(p.length),cn(b,{content:p,attachments:v}),requestAnimationFrame(()=>{var V;return(V=Y.current)==null?void 0:V.focus()})}},[p,g,b,x]),w.useEffect(()=>()=>{cn(b,{content:C.current,attachments:O.current,outputSchema:X.current})},[b]),w.useEffect(()=>{if(!Ze)return;const v=!!Ze.contextWindow;cu(Ze.contextWindow||0,!v)},[Ze,cu]),w.useEffect(()=>{dr&&Xe(v=>v!==_t.current?v:(_t.current=null,null))},[dr]);const qa=w.useCallback(async()=>{if(!N.trim()&&Q.length===0||n||Rn||hi||S.current)return;let v;if(R.trim()){if(an){fe(k("chat.input.outputSchema.shellUnsupported")),B(!0);return}try{const q=JSON.parse(R);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("schema root must be an object");v=q}catch{fe(k("chat.input.outputSchema.invalid")),B(!0);return}}N.trim()&&bs.addToHistory(N),S.current=!0,on(!0);const V=b;try{if(await e({content:N,modelId:hs??void 0,reasoningEffort:Dr,serviceTier:_r,responseVerbosity:Lr,communicationStyle:fu,attachments:Q,...v?{outputSchema:v}:{}})===!1)return;Sy(V),C.current="",O.current=[],X.current="",$(""),T([]),K(""),fe(null),Xe(null),ft(null),_t.current=null,ke(void 0)}catch{}finally{S.current=!1,on(!1)}},[Q,hi,b,N,an,n,hs,Dr,Lr,fu,_r,Rn,e,R,bs,k]),_y=w.useCallback(v=>{Xe(null),ft(null),_t.current=null,T(V=>{const q=V.filter(Te=>Te.id!==v);return O.current=q,cn(b,{content:C.current,attachments:q}),q})},[b]),pu=w.useCallback(v=>new Promise((V,q)=>{const Te=new FileReader;Te.onload=()=>{if(typeof Te.result!="string"){q(new Error("Failed to read image"));return}V({id:typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:v.name,mimeType:v.type,dataUrl:Te.result})},Te.onerror=()=>q(Te.error??new Error("Failed to read image")),Te.readAsDataURL(v)}),[]),ki=w.useCallback(async v=>{if(v.length===0)return;if(!dr){_t.current=Ys,ft(null),Xe(Ys);return}const V=T_(O.current,v),q=Te=>Te==="count"?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.sizeLimit",{size:fc(po)});if(!V.accepted){_t.current=null,ft(null),Xe(q(V.reason??"bytes"));return}try{const Te=await Promise.all(v.map(ks=>pu(ks))),Et=new Set(O.current.map(ks=>ks.dataUrl)),xu=Te.filter(ks=>Et.has(ks.dataUrl)?!1:(Et.add(ks.dataUrl),!0));if(xu.length===0){Xe(null),ft(null),_t.current=null;return}const xi=[...O.current,...xu];if(Jc(xi)>po){_t.current=null,ft(null),Xe(q("bytes"));return}O.current=xi,T(xi),Xe(null),ft(null),_t.current=null,cn(b,{content:C.current,attachments:xi})}catch{_t.current=null,ft(null),Xe(k("chat.input.attachment.readFailed"))}},[b,Ys,dr,pu,k]),Ly=w.useCallback(async v=>{const V=Array.from(v.target.files??[]).filter(q=>q.type.startsWith("image/"));await ki(V),v.target.value=""},[ki]),Uy=w.useCallback(async v=>{const V=Array.from(v.clipboardData.items).filter(q=>q.type.startsWith("image/")).map(q=>q.getAsFile()).filter(q=>q!==null);V.length!==0&&(v.preventDefault(),await ki(V))},[ki]),za=w.useCallback(v=>{const V=Jt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=v_(N,Jt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[b,N,Jt]),Ka=w.useCallback(v=>{const V=Qt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=x_(N,Qt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[Qt,b,N]),By=w.useCallback(v=>{if(Xs){if(v.key==="ArrowDown"){v.preventDefault(),Jt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Jt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),za(Jt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(bi){if(v.key==="ArrowDown"){v.preventDefault(),Qt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Qt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Ka(Qt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),qa();return}if(v.key==="ArrowUp"&&!v.shiftKey){const V=v.target,q=V.selectionStart===0&&V.selectionEnd===0,Te=!N.includes(`
|
|
23
|
+
`),g=nu(e.executionId),x={role:"user",content:[`! ${l}`,p||"(no output)"].join(`
|
|
24
|
+
`),metadata:{userShellCommand:a}};s.some(b=>b.id===g)?i(g,x):o({id:g,...x,timestamp:Date.now()}),e.auxiliary!==!0&&n({isStreaming:!1,isStopping:!1,agentPhase:"idle"}),(e.delivery==="current_turn"||e.delivery==="next_turn")&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):0,pendingInputDelivery:e.delivery==="current_turn"?"current_turn":"next_turn"})},R2=(e,t)=>{const{currentSessionId:n,updateTokenUsage:r,setMaxContextTokens:s}=t();e.sessionId===n&&(r({inputTokens:e.inputTokens,outputTokens:e.outputTokens,totalTokens:e.totalTokens,cacheReadTokens:e.cacheReadTokens??0,cacheWriteTokens:e.cacheWriteTokens??0,costUsd:e.costUsd}),e.maxContextTokens&&s(e.maxContextTokens,!1))},M2=(e,t)=>{const{currentSessionId:n,setTasks:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o=e.tasks||[];r(s,o)},F2=(e,t)=>{const{currentSessionId:n,setSubagent:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o={id:Da({explicitId:e.subagentId,sessionId:e.subagentSessionId,messageId:s,agentType:e.type,description:e.description}),type:e.type||"unknown",description:e.description||"",status:"running",startTime:Date.now(),sessionId:e.subagentSessionId,resumedFrom:e.resumedFrom,rootAgentId:e.rootAgentId,resumeDepth:typeof e.resumeDepth=="number"?e.resumeDepth:void 0};r(s,o)},D2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.subagentSessionId,a=bt(s,i,r);a&&o(a.messageId,a.subagent.id,{sessionId:a.subagent.sessionId||i,currentTool:e.toolName})},_2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.delta;if(!i)return;const a=e.subagentSessionId,l=bt(s,a,r);l&&o(l.messageId,l.subagent.id,d=>({sessionId:d.sessionId||a,output:(d.output||"")+i}))},L2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.delta;if(!i)return;const a=e.subagentSessionId,l=bt(s,a,r);l&&o(l.messageId,l.subagent.id,d=>({sessionId:d.sessionId||a,thinking:(d.thinking||"")+i}))},U2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.subagentSessionId,a=bt(s,i,r);a&&o(a.messageId,a.subagent.id,{sessionId:a.subagent.sessionId||i,status:e.success?"completed":"failed",currentTool:void 0,verificationVerdict:e.verificationVerdict==="pass"||e.verificationVerdict==="fail"||e.verificationVerdict==="partial"?e.verificationVerdict:a.subagent.verificationVerdict})},B2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.toolCallId,a=e.toolName;if(!i||!a)return;const l=e.subagentSessionId,d=bt(s,l,r);if(!d)return;const m={toolCallId:i,toolName:a,arguments:e.arguments,toolKind:e.toolKind,status:"running",startTime:Date.now()};o(d.messageId,d.subagent.id,p=>{const g=p.toolCalls||[];return{sessionId:p.sessionId||l,currentTool:a,toolCalls:g.some(x=>x.toolCallId===i)?g:[...g,m]}})},H2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.toolCallId;if(!i)return;const a=e.toolName,l=e.subagentSessionId,d=bt(s,l,r);if(!d)return;const m=e.output,p=e.success===!0,g=p?"success":"error",x=e.summary||(m&&m.trim()?m.trim().split(`
|
|
25
|
+
`)[0].slice(0,120):p?"执行成功":"执行失败");o(d.messageId,d.subagent.id,b=>({sessionId:b.sessionId||l,currentTool:b.currentTool===a?void 0:b.currentTool,toolCalls:(b.toolCalls||[]).map(y=>y.toolCallId===i?{...y,status:g,summary:x,output:m,metadata:e.metadata}:y)}))},q2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.toolCallId;if(!i)return;const a=bt(s,e.subagentSessionId,r);a&&o(a.messageId,a.subagent.id,l=>({toolCalls:(l.toolCalls||[]).map(d=>d.toolCallId===i?{...d,summary:e.message,progress:typeof e.progress=="number"?e.progress:void 0,progressTotal:typeof e.total=="number"?e.total:void 0,progressMessage:e.message}:d)}))},z2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.added)?e.added.map(String):[],l=Array.isArray(e.removed)?e.removed.map(String):[],d=Array.isArray(e.updated)?e.updated.map(String):[],m=`mcp-catalog:${String(e.revision)}`;o(i.messageId,i.subagent.id,p=>({toolCalls:[...(p.toolCalls||[]).filter(g=>g.toolCallId!==m),{toolCallId:m,toolName:"MCP Catalog",arguments:JSON.stringify({serverName:e.serverName,added:a,removed:l,updated:d}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP catalog r${String(e.revision)}: +${a.length} -${l.length} ~${d.length}`,output:[a.length>0?`Added: ${a.join(", ")}`:"",l.length>0?`Removed: ${l.join(", ")}`:"",d.length>0?`Updated: ${d.join(", ")}`:""].filter(Boolean).join(`
|
|
26
|
+
`)}]}))},K2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.added)?e.added.map(String):[],l=Array.isArray(e.removed)?e.removed.map(String):[],d=Array.isArray(e.updated)?e.updated.map(String):[],m=`mcp-content:${String(e.revision)}`;o(i.messageId,i.subagent.id,p=>({toolCalls:[...(p.toolCalls||[]).filter(g=>g.toolCallId!==m),{toolCallId:m,toolName:"MCP Content",arguments:JSON.stringify({serverName:e.serverName,contentKind:e.contentKind,added:a,removed:l,updated:d}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP ${String(e.contentKind)} r${String(e.revision)}: +${a.length} -${l.length} ~${d.length}`}]}))},G2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=`mcp-resource:${String(e.revision)}`;o(i.messageId,i.subagent.id,l=>({toolCalls:[...(l.toolCalls||[]).filter(d=>d.toolCallId!==a),{toolCallId:a,toolName:"MCP Resource",arguments:JSON.stringify({serverName:e.serverName,uri:e.uri}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP resource updated: ${String(e.uri)}`}]}))},V2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.phase),l=`mcp-connection:${String(e.revision)}`;o(i.messageId,i.subagent.id,d=>({toolCalls:[...(d.toolCalls||[]).filter(m=>m.toolCallId!==l),{toolCallId:l,toolName:"MCP Connection",arguments:JSON.stringify({serverName:e.serverName,phase:a,reason:e.reason,attempt:e.attempt,maxAttempts:e.maxAttempts}),toolKind:"readonly",status:a==="failed"?"error":"success",startTime:Date.now(),summary:`MCP ${String(e.serverName)} ${a}`+(a==="reconnecting"?` (${String(e.attempt)}/${String(e.maxAttempts)})`:""),output:e.error?`Error: ${String(e.error)}`:void 0}]}))},W2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.level),l=typeof e.logger=="string"?e.logger:void 0,d=`mcp-log:${String(e.revision)}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==d),{toolCallId:d,toolName:"MCP Log",arguments:JSON.stringify({serverName:e.serverName,level:a,logger:l}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP ${a} · ${String(e.serverName)}`+(l?` · ${l}`:""),output:[String(e.message),`SHA-256: ${String(e.dataSha256)}`,e.truncated===!0?"Truncated":"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
|
|
27
|
+
`)}]}))},J2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.serverName),l=String(e.action),d=`mcp-instructions:${String(e.revision)}:${a}:${l}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==d),{toolCallId:d,toolName:"MCP Instructions",arguments:JSON.stringify({serverName:a,action:l,reason:e.reason}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP instructions ${l}: ${a}`+(e.truncated===!0?" (truncated)":""),output:[typeof e.text=="string"?e.text:"",e.sha256?`SHA-256: ${String(e.sha256)}`:"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
|
|
28
|
+
`)}]}))},Q2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.taskId),l=String(e.status),d=`mcp-task:${a}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==d),{toolCallId:d,toolName:"MCP Task",arguments:JSON.stringify({taskId:a,serverName:e.serverName,toolName:e.toolName}),toolKind:"readonly",status:l==="failed"||l==="cancelled"?"error":l==="completed"?"success":"running",startTime:Number(e.createdAt)||Date.now(),summary:`MCP task ${l}: ${a} · ${String(e.serverName)}/${String(e.toolName)}`,output:[typeof e.statusMessage=="string"?e.statusMessage:"",e.hasResult===!0?"Result available via TaskOutput":"",typeof e.error=="string"?`Error: ${e.error}`:""].filter(Boolean).join(`
|
|
29
|
+
`)}]}))},Y2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.files)?e.files.filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)):[],l=`project-rules:${a.map(d=>String(d.id)).join(",")}`;o(i.messageId,i.subagent.id,d=>({toolCalls:[...(d.toolCalls||[]).filter(m=>m.toolCallId!==l),{toolCallId:l,toolName:"Project Rules",arguments:JSON.stringify({triggerPaths:e.triggerPaths,blockedWrite:e.blockedWrite}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`Project rules loaded: ${a.length}`,output:a.map(m=>`${String(m.relativePath)} ${String(m.source)} SHA-256: ${String(m.contentSha256)}`).join(`
|
|
30
|
+
`)}]}))},X2=(e,t,n)=>{const{currentSessionId:r,setConfirmation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||"",i=Wt(t,n,o?`assistant-permission-${o}`:void 0);if(!i)return;const a=e.details,l=e.toolName||(a==null?void 0:a.toolName)||"Tool";s(i,{toolCallId:o,toolName:l,description:e.description,diff:(a==null?void 0:a.details)||(a==null?void 0:a.diff)||"",allowRemember:(a==null?void 0:a.type)!=="mcpSampling",status:"pending"}),n(d=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:d.sessions.map(m=>m.sessionId===e.sessionId&&m.projectPath===e.projectPath?{...m,pendingInteraction:{type:"permission",requestId:o}}:m)}))},Z2=(e,t,n)=>{var x,b;const{currentSessionId:r,currentSessionRef:s,messages:o,setConfirmation:i,setElicitation:a}=t();if(e.sessionId!==r)return;const l=e.requestId,d=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.confirmation)==null?void 0:k.toolCallId)===l}),m=(x=d==null?void 0:d.agentContent)==null?void 0:x.confirmation;d&&(m==null?void 0:m.status)==="pending"&&i(d.id,{...m,status:"denied"});const p=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.elicitation)==null?void 0:k.toolCallId)===l}),g=(b=p==null?void 0:p.agentContent)==null?void 0:b.elicitation;p&&(g==null?void 0:g.status)==="pending"&&a(p.id,{...g,status:"cancelled"}),n({agentPhase:"running",error:"Permission request timed out",errorContext:{kind:"interaction",...s?{sessionRef:s}:{}}})},gf=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running",isStreaming:!0})},e5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},t5=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},n5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},r5=(e,t,n)=>{const{currentSessionId:r,setQuestion:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-question-${o}`:void 0);i&&(s(i,{toolCallId:o,questions:e.questions,status:"pending"}),n(a=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:a.sessions.map(l=>l.sessionId===e.sessionId&&l.projectPath===e.projectPath?{...l,pendingInteraction:{type:"question",requestId:o}}:l)})))},s5=(e,t,n)=>{const{currentSessionId:r,setElicitation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-elicitation-${o}`:void 0),a=e.elicitation;!i||!a||(s(i,{toolCallId:o,details:a,status:"pending"}),n(l=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:l.sessions.map(d=>d.sessionId===e.sessionId&&d.projectPath===e.projectPath?{...d,pendingInteraction:{type:"elicitation",requestId:o}}:d)})))},o5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.requestId;n(o=>({agentPhase:"running",sessions:o.sessions.map(i=>{var a;return i.sessionId===e.sessionId&&i.projectPath===e.projectPath&&((a=i.pendingInteraction)==null?void 0:a.requestId)===s?{...i,pendingInteraction:void 0}:i})}))},ic=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},i5=(e,t,n)=>{const{currentSessionId:r,currentSessionRef:s,endAgentResponse:o}=t();if(e.sessionId!==r)return;const i=e.taskFailure&&typeof e.taskFailure=="object"&&!Array.isArray(e.taskFailure)?e.taskFailure:void 0,a=ry(i==null?void 0:i.code);n({agentPhase:"error",error:e.error||"An error occurred",errorContext:{kind:"execution",...s?{sessionRef:s}:{},...a?{failureCode:a}:{}}}),o()},a5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId===r)if(e.status==="idle")n({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0});else if(e.status==="queued"||e.status==="running"||e.status==="waiting_permission"){const s=typeof e.queued=="number"?Math.max(0,e.queued):0;n({isStreaming:!0,agentPhase:e.status==="waiting_permission"?"waiting_permission":"running",currentRunId:typeof e.runId=="string"?e.runId:t().currentRunId,pendingSteeringCount:s,pendingInputDelivery:s>0&&(e.pendingInputDelivery==="current_turn"||e.pendingInputDelivery==="next_turn")?e.pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})}else e.status==="error"&&n({isStreaming:!1,isStopping:!1,agentPhase:"error",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},c5=(e,t,n)=>{const{currentSessionId:r,endAgentResponse:s,messages:o,updateSubagent:i}=t();if(e.sessionId===r){n(a=>({isStreaming:!1,agentPhase:"idle",messages:a.messages.map(l=>{var m;const d=(m=l.agentContent)==null?void 0:m.elicitation;return(d==null?void 0:d.status)!=="pending"||!l.agentContent?l:{...l,agentContent:{...l.agentContent,elicitation:{...d,status:"cancelled"}}}})}));for(const a of o)for(const l of Zn(a.agentContent))l.status==="running"&&i(a.id,l.id,{status:"failed"});s()}},l5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},d5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},u5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({pendingSteeringCount:r,pendingInputDelivery:r>0?t().pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},f5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({agentPhase:"running",pendingSteeringCount:r,pendingInputDelivery:r>0?"current_turn":null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},m5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},p5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},g5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},h5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId||!Array.isArray(e.messages))return;const r=Date.now(),s=e.messages.flatMap((o,i)=>{if(typeof o!="object"||o===null)return[];const a=o;return!["user","assistant","system","tool"].includes(String(a.role))||!Array.isArray(a.content)&&typeof a.content!="string"?[]:[{id:`rewind-${i}-${r}`,role:a.role,content:a.content,timestamp:r+i,metadata:typeof a.metadata=="object"&&a.metadata!==null?a.metadata:void 0,thinkingContent:typeof a.thinkingContent=="string"?a.thinkingContent:typeof a.reasoningContent=="string"?a.reasoningContent:void 0,tool_call_id:typeof a.tool_call_id=="string"?a.tool_call_id:void 0,name:typeof a.name=="string"?a.name:void 0,tool_calls:a.tool_calls}]});n({messages:Pi(s),isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1})},b5=(e,t,n)=>{const r=t().currentSessionRef;if(!r||e.sessionId!==r.sessionId||e.projectPath!==r.projectPath)return;const s=e.status,o=s==="completed"||s==="stale"?"completed":s==="aborted"?"cancelled":s==="interrupted"?"interrupted":"failed";n(i=>({sessions:i.sessions.map(a=>a.sessionId===r.sessionId&&a.projectPath===r.projectPath?{...a,taskStatus:o,taskStatusReason:void 0,taskFailure:void 0,taskCompletedAt:new Date().toISOString()}:a)})),t().selectSession(r)},k5=(e,t,n)=>{oy({...e,messageId:`review-${String(e.reviewId??"active")}`,arguments:"{}"},t,n)},x5=(e,t,n)=>{iy(e,t)},y5=(e,t,n)=>{ay(e,t,n)},wi={"message.created":b2,"message.delta":k2,"message.complete":x2,"structured.output":y2,"thinking.delta":S2,"thinking.completed":w2,"tool.start":oy,"tool.progress":iy,"tool.result":ay,"mcp.catalog.changed":v2,"mcp.content.changed":I2,"mcp.resource.updated":C2,"mcp.connection.changed":j2,"mcp.log":T2,"mcp.instructions.changed":A2,"mcp.task.changed":E2,"project.rules.loaded":P2,"user.shell.started":N2,"user.shell.output":O2,"user.shell.completed":$2,"token.usage":R2,"task.updated":M2,"subagent.start":F2,"subagent.update":D2,"subagent.delta":_2,"subagent.thinking.delta":L2,"subagent.tool.start":B2,"subagent.tool.progress":q2,"subagent.tool.result":H2,"subagent.mcp.catalog.changed":z2,"subagent.mcp.content.changed":K2,"subagent.mcp.resource.updated":G2,"subagent.mcp.connection.changed":V2,"subagent.mcp.log":W2,"subagent.mcp.instructions.changed":J2,"subagent.mcp.task.changed":Q2,"subagent.project.rules.loaded":Y2,"subagent.complete":U2,"permission.asked":X2,"permission.timeout":Z2,"turn.started":gf,"committed.turn_started":gf,"committed.turn_completed":ic,"committed.turn_aborted":ic,"compaction.started":e5,"compaction.completed":t5,"model.fallback":n5,"question.required":r5,"elicitation.required":s5,"interaction.resolved":o5,"session.completed":ic,"session.error":i5,"session.status":a5,"run.cancelled":c5,"steering.queued":l5,"follow_up.queued":d5,"follow_up.started":f5,"steering.applied":u5,"goal.updated":m5,"goal.cleared":p5,"goal.continuation.started":g5,"session.rewound":h5,"review.tool.started":k5,"review.tool.progress":x5,"review.tool.completed":y5,"review.completed":b5},S5=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled","committed.turn_completed","committed.turn_aborted"]),hf=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(S5.has(n.type)){wn.drainAll();const i=wi[n.type];i&&i(n.properties,e,t);return}if(n.type==="tool.start"&&wn.drainAll(),n.type==="message.delta"){const{currentSessionId:i,currentAssistantMessageId:a,hasToolCalls:l}=e();if(s.sessionId!==i)return;const d=s.messageId||a,m=s.delta;if(!a){const x=wi["message.delta"];x&&x(s,e,t);return}const p=l?"after":"before",g=`content:${d}:${p}`;wn.drainAllExcept(g),wn.append(g,m,x=>{const{appendDelta:b}=e();d&&b(d,x,p)});return}if(n.type==="thinking.delta"){const{currentSessionId:i,currentAssistantMessageId:a}=e();if(s.sessionId!==i)return;if(!a){const p=wi["thinking.delta"];p&&p(s,e,t);return}const l=s.delta,d=s.messageId||a,m=`thinking:${d}`;wn.drainAllExcept(m),wn.append(m,l,p=>{const{appendThinking:g}=e();d&&g(d,p)});return}if(n.type==="subagent.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,output:(A.output||"")+x}))});return}if(n.type==="subagent.thinking.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent-thinking:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,thinking:(A.thinking||"")+x}))});return}const o=wi[n.type];o&&o(n.properties,e,t)},w5=(e,t)=>{const n=new WeakMap;let r=null;return{isStreaming:!1,isStopping:!1,agentPhase:"idle",sessionEventConnectionState:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:s=>e({isStreaming:s}),setAgentPhase:s=>e({agentPhase:s}),setRunId:s=>e({currentRunId:s}),prepareEventSubscription:async(s,o)=>{const i=o??hf(t,e);let a=null,l="connecting";return a=await re.openEventSubscription(s,i,{onConnectionStateChange:d=>{l=d,a&&r===a&&e({sessionEventConnectionState:d})}}),n.set(a,l),a},replaceEventSubscription:s=>{const o=t().eventUnsubscribe;if(r=s,e({eventUnsubscribe:s,sessionEventConnectionState:s?n.get(s)??"connected":"idle"}),wn.reset(),o&&o!==s)try{o()}catch(i){console.warn("Failed to clean up previous event subscription",i)}},setCurrentAssistantMessageId:s=>e({currentAssistantMessageId:s}),setHasToolCalls:s=>e({hasToolCalls:s}),startAgentResponse:s=>{e({currentAssistantMessageId:s,hasToolCalls:!1,isStreaming:!0,agentPhase:"running"})},endAgentResponse:()=>{wn.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async s=>{const o=await t().prepareEventSubscription(s);t().replaceEventSubscription(o)},reconnectSessionEvents:async()=>{const s=t().currentSessionRef;if(s){t().unsubscribeFromEvents(),e({sessionEventConnectionState:"connecting"});try{await t().subscribeToEvents(s)}catch(o){throw e({sessionEventConnectionState:"offline"}),o}}},unsubscribeFromEvents:()=>{const{eventUnsubscribe:s}=t();r=null,e({eventUnsubscribe:null,sessionEventConnectionState:"idle"});try{s==null||s()}catch(o){console.warn("Failed to clean up event subscription",o)}finally{wn.reset()}},handleEvent:s=>{hf(t,e)(s)}}};function v5(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function ru(e,t){var r;const n=(r=e.taskStatusReason)==null?void 0:r.trim();if(v5(e)){if(e.taskStatus==="running")return t("taskHome.review.running");if(n!=null&&n.startsWith("Code review stale:"))return t("taskHome.review.stale");if(n==="Code review aborted")return t("taskHome.review.aborted");if(n==="Code review interrupted by process restart")return t("taskHome.review.interrupted");if(e.taskStatus==="failed")return t("taskHome.review.failed")}return e.taskFailure?t(sy(e.taskFailure.code)):n==="user-cancel"?t("session.reason.cancelledByUser"):n||void 0}let ac=0;function vi(e,t){const n=e.findIndex(s=>s.id===t.id);if(n===-1)return[...e,t];const r=e.slice();return r[n]=t,r}const I5=ui(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{const t=++ac;e({isLoading:!0,error:null});try{const n=await re.listSchedules();if(t!==ac)return;e({schedules:n,isLoading:!1,hasLoaded:!0})}catch(n){if(t!==ac)return;e({error:n instanceof Error?n.message:He("schedule.error.loadFailed"),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{const n=await re.createSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.createFailed")}),n}},updateSchedule:async(t,n)=>{e({error:null});try{const r=await re.updateSchedule(t,n);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.updateFailed")}),r}},deleteSchedule:async t=>{e({error:null});try{await re.deleteSchedule(t),e(n=>({schedules:n.schedules.filter(r=>r.id!==t)}))}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.deleteFailed")}),n}},toggleSchedule:async(t,n)=>{e({error:null});try{const r=n?await re.enableSchedule(t):await re.disableSchedule(t);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.toggleFailed")}),r}},runSchedule:async t=>{e({error:null});try{const n=await re.runSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.runFailed")}),n}}})),C5=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",Ni=e=>{if(typeof document>"u")return;const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const r=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(r)}else t.classList.add(e)},ln={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,communicationStyle:"auto"},vo=ui((e,t)=>({...ln,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error(He("settings.general.loadError"));const r=await n.json(),s=r.uiTheme??ln.uiTheme;e({language:r.language??ln.language,theme:r.theme??ln.theme,uiTheme:s,autoSaveSessions:r.autoSaveSessions??ln.autoSaveSessions,notifyBuild:r.notifyBuild??ln.notifyBuild,notifyErrors:r.notifyErrors??ln.notifyErrors,notifySounds:r.notifySounds??ln.notifySounds,privacyTelemetry:r.privacyTelemetry??ln.privacyTelemetry,privacyCrash:r.privacyCrash??ln.privacyCrash,communicationStyle:r.communicationStyle??ln.communicationStyle,isLoading:!1}),Ni(s)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&Ni(n.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n,options:{scope:"global"}})})).ok)throw new Error(He("settings.general.saveError"))}catch(s){e({language:r.language,theme:r.theme,uiTheme:r.uiTheme,autoSaveSessions:r.autoSaveSessions,notifyBuild:r.notifyBuild,notifyErrors:r.notifyErrors,notifySounds:r.notifySounds,privacyTelemetry:r.privacyTelemetry,privacyCrash:r.privacyCrash,communicationStyle:r.communicationStyle,error:s.message}),n.uiTheme&&Ni(r.uiTheme)}}}));Ni(ln.uiTheme);const Q_=()=>vo(e=>C5(e.uiTheme)),cy="blade.projects.selected";function bf(){return typeof localStorage>"u"?null:localStorage.getItem(cy)}function Ii(e){typeof localStorage<"u"&&localStorage.setItem(cy,e)}const j5=new Set(["queued","running","completed","failed","cancelled","interrupted"]),cc=new Set(["default","autoEdit","yolo","plan"]),kf=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),xf=new Set(["auto","standard","fast","flex"]),yf=new Set(["auto","low","medium","high"]),Sf=new Set(["auto","pragmatic","friendly","explanatory"]);function T5(e){return typeof e=="string"&&j5.has(e)}function A5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!["changedFiles","additions","deletions","commits"].some(r=>typeof t[r]!="number"||!Number.isInteger(t[r])||t[r]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function wf(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=ry(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:He(sy(n)),retryable:p2(n)}}function E5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!(!["applied","discarded","conflicted"].includes(String(t.status))||typeof t.updatedAt!="string"))return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit=="string"?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles=="number"&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message=="string"?{message:t.message}:{}}}function xs(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}const P5=(e,t)=>{let n=null,r=!1,s=!1,o=0;const i=new Map,a=d=>{const m=ze(d),p=++o;i.set(m,p),re.getSession(d).then(g=>{i.get(m)===p&&e(x=>({sessions:vn(x.sessions,g)}))}).catch(()=>{i.get(m)===p&&t().loadSessions()}).finally(()=>{i.get(m)===p&&i.delete(m)})},l=d=>{const m=ze(d),p=++o;i.set(m,p),queueMicrotask(()=>{i.get(m)===p&&i.delete(m)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:bf(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:o2(),handleTaskEvent:d=>{if(d.type==="session.created"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C});return}if(d.type==="session.deleted"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O);return}if(d.type==="session.archived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O),t().loadArchivedSessions();return}if(d.type==="session.unarchived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C}),t().loadArchivedSessions();return}if(d.type==="session.updated"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.title,R=d.properties.selectedModelId,K=d.properties.permissionMode,X=d.properties.reasoningEffort,P=d.properties.serviceTier,B=d.properties.responseVerbosity,M=d.properties.communicationStyle;if(typeof T!="string"||typeof C!="string"||!(typeof O=="string"&&O.trim()||typeof R=="string"&&R.trim()||cc.has(K)||kf.has(X)||xf.has(P)||yf.has(B)||Sf.has(M)))return;const fe={sessionId:T,projectPath:C};if(oe(t().currentSessionRef,fe)&&cc.has(K)&&Pt.getState().setMode(K),!t().sessions.some(ke=>oe(pe(ke),fe))){a(fe);return}e(ke=>({sessions:ke.sessions.map(ce=>oe({sessionId:ce.sessionId,projectPath:ce.projectPath},fe)?{...ce,...typeof O=="string"&&O.trim()?{title:O}:{},...typeof R=="string"&&R.trim()?{selectedModelId:R}:{},...cc.has(K)?{permissionMode:K}:{},...kf.has(X)?{reasoningEffort:X}:{},...xf.has(P)?{serviceTier:P}:{},...yf.has(B)?{responseVerbosity:B}:{},...Sf.has(M)?{communicationStyle:M}:{}}:ce)}));return}if(d.type==="task.delivery"){const T=d.properties.sessionId,C=d.properties.projectPath,O=E5(d.properties.taskDelivery);if(typeof T!="string"||typeof C!="string"||!O)return;const R={sessionId:T,projectPath:C},K=d.properties.taskWorktreeRemoved===!0;e(X=>({sessions:X.sessions.map(P=>oe(pe(P),R)?{...P,taskDelivery:O,...K?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:P.lastMessageTime}:P)}));return}if(d.type==="interaction.pending"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.interactionType,R=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||O!=="permission"&&O!=="question"&&O!=="elicitation"||typeof R!="string"||!R)return;const K={sessionId:T,projectPath:C},X=t().sessions.find(B=>oe(pe(B),K));if(!X){t().loadSessions();return}if(e(B=>({sessions:B.sessions.map(M=>oe(pe(M),K)?{...M,pendingInteraction:{type:O,requestId:R}}:M)})),!(typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,K))&&vo.getState().notifyErrors){const M=X.title??X.sessionId??T;mf({ref:K,title:`Blade · ${He(O==="question"?"attention.notification.question":O==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:M,onOpen:fe=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:fe})))}})}return}if(d.type==="interaction.resolved"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||typeof O!="string")return;const R={sessionId:T,projectPath:C};e(K=>({sessions:K.sessions.map(X=>{var P;return oe(pe(X),R)&&((P=X.pendingInteraction)==null?void 0:P.requestId)===O?{...X,pendingInteraction:void 0}:X})}));return}if(d.type==="schedule.fired"){I5.getState().loadSchedules();return}if(d.type!=="task.status")return;const m=d.properties.sessionId,p=d.properties.projectPath,g=d.properties.taskStatus;if(typeof m!="string"||typeof p!="string"||!T5(g))return;const x={sessionId:m,projectPath:p},b=xs(d.properties.taskInFlight,0),y=xs(d.properties.taskQueueDepth,0),j=xs(d.properties.taskConcurrencyLimit,1);b!==void 0&&y!==void 0&&j!==void 0&&e(T=>{var C;return{taskWorkspaceInfo:T.taskWorkspaceInfo?{...T.taskWorkspaceInfo,taskAdmission:{inFlight:b,queued:y,maxConcurrent:j,maxQueued:((C=T.taskWorkspaceInfo.taskAdmission)==null?void 0:C.maxQueued)??100}}:null}});const k=t().sessions.find(T=>oe(pe(T),x)),A=typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,x),N=s2(k==null?void 0:k.taskStatus,g,A),$=ze(x),Q=!t().unreadTaskKeys.includes($);if(N&&Q){e(O=>{const R=[...O.unreadTaskKeys,$];return go(R),{unreadTaskKeys:R}});const T=vo.getState();if(T.notifySounds&&Zx(g)&&i2(g),g==="completed"?T.notifyBuild:T.notifyErrors){const O=He(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),R=wf(d.properties.taskFailure),K=k?ru({...k,taskStatus:g,taskFailure:R??k.taskFailure,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:k.taskStatusReason,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:k.taskPromptSummary},He):(R==null?void 0:R.message)??(typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0),X=(k==null?void 0:k.title)??(k==null?void 0:k.sessionId)??m;mf({ref:x,title:`Blade · ${O}`,body:K?`${X} · ${K}`:X,onOpen:P=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:P})))}})}}if(!k){a(x);return}e(T=>({sessions:T.sessions.map(C=>oe({sessionId:C.sessionId,projectPath:C.projectPath},x)?{...C,taskStatus:g,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0,taskFailure:g==="failed"?wf(d.properties.taskFailure)??C.taskFailure:void 0,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:C.taskPromptSummary,taskStartedAt:typeof d.properties.taskStartedAt=="string"?d.properties.taskStartedAt:g==="queued"?void 0:C.taskStartedAt,taskCompletedAt:typeof d.properties.taskCompletedAt=="string"?d.properties.taskCompletedAt:g==="queued"||g==="running"?void 0:C.taskCompletedAt,taskDiffStat:A5(d.properties.taskDiffStat)??C.taskDiffStat,taskQueuePosition:g==="queued"?xs(d.properties.taskQueuePosition,1)??C.taskQueuePosition:void 0,taskQueueDepth:g==="queued"?xs(d.properties.taskQueueDepth,0)??C.taskQueueDepth:void 0,taskConcurrencyLimit:xs(d.properties.taskConcurrencyLimit,1)??C.taskConcurrencyLimit,lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:C.lastMessageTime}:C)}))},subscribeToTaskEvents:async()=>{if(r=!0,!t().taskEventUnsubscribe){if(n)return n;e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),n=(async()=>{try{const d=await re.openTaskEventSubscription(m=>t().handleTaskEvent(m),{onConnectionChange:m=>{e({taskEventsConnected:m})},onConnectionStateChange:m=>{r&&(m==="reconnecting"||m==="offline")&&(s=!0),e({taskEventsConnected:m==="connected",taskEventConnectionState:m}),m==="connected"&&s&&(s=!1,Promise.all([t().loadSessions(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Pt.getState().loadModels()]))}});if(!r||t().taskEventUnsubscribe){d();return}e({taskEventUnsubscribe:d})}catch(d){throw s=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),d}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{s=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var d,m;r=!1,(m=(d=t()).taskEventUnsubscribe)==null||m.call(d),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const d=await re.getWorkspaceInfo();e({taskWorkspaceInfo:d,isTaskWorkspaceLoading:!1})}catch(d){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:d instanceof Error?d.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const d=await re.listProjects(),m=bf(),p=d.find(g=>g.available&&g.path===m)??d.find(g=>g.isCurrent)??d.find(g=>g.available);p&&Ii(p.path),e({boundProjects:d,selectedProjectPath:(p==null?void 0:p.path)??null})}catch(d){e({error:d instanceof Error?d.message:"Failed to load projects"})}},bindProject:async d=>{e({isBindingProject:!0,error:null});try{const m=await re.bindProject(d);Ii(m.path),e(p=>({boundProjects:[...p.boundProjects.filter(g=>g.path!==m.path),m].sort((g,x)=>g.isCurrent!==x.isCurrent?g.isCurrent?-1:1:g.name.localeCompare(x.name)),selectedProjectPath:m.path,isBindingProject:!1}))}catch(m){throw e({isBindingProject:!1,error:m instanceof Error?m.message:"Failed to bind project"}),m}},unbindProject:async d=>{try{await re.unbindProject(d),e(m=>{const p=m.boundProjects.filter(x=>x.path!==d||x.isCurrent),g=m.selectedProjectPath===d?p.find(x=>x.isCurrent)??p.find(x=>x.available):void 0;return g&&Ii(g.path),{boundProjects:p,...g?{selectedProjectPath:g.path}:{}}})}catch(m){throw e({error:m instanceof Error?m.message:"Failed to unbind project"}),m}},selectProject:d=>{Ii(d),e({selectedProjectPath:d})},markTaskRead:d=>{const m=ze(d);e(p=>{const g=p.unreadTaskKeys.filter(x=>x!==m);return go(g),{unreadTaskKeys:g}})},clearUnreadTasks:()=>{go([]),e({unreadTaskKeys:[]})},cancelTask:async d=>{const m=ze(d);if(!t().cancellingTaskKeys.includes(m)){e(p=>({cancellingTaskKeys:[...p.cancellingTaskKeys,m],error:null,errorContext:null}));try{await re.abortSession(d);const p=oe(t().currentSessionRef,d);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(x=>oe(pe(x),d)?{...x,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:x.taskCompletedAt??new Date().toISOString()}:x),...p?{isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(p){throw e({error:p instanceof Error?p.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:d}}),p}finally{e(p=>({cancellingTaskKeys:p.cancellingTaskKeys.filter(g=>g!==m)}))}}},retryTask:async d=>{const m=ze(d);if(t().retryingTaskKeys.includes(m))return;const p=t().getNavigationVersion(),g=t().selectedProjectPath,x=()=>t().getNavigationVersion()===p&&t().selectedProjectPath===g;e(b=>({retryingTaskKeys:[...b.retryingTaskKeys,m],error:null,errorContext:null}));try{const b=await re.retryTask(d);e(y=>({sessions:vn(y.sessions,b.session)})),t().markTaskRead(d),x()&&await t().selectSession(pe(b.session))}catch(b){throw x()&&e({error:b instanceof Error?b.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:d}}),b}finally{e(b=>({retryingTaskKeys:b.retryingTaskKeys.filter(y=>y!==m)}))}},deliverTask:async(d,m)=>{const p=ze(d);if(!t().taskDeliveryActions[p]){e(g=>({taskDeliveryActions:{...g.taskDeliveryActions,[p]:m},error:null,errorContext:null}));try{const g=await re.deliverTask(d,m);e(x=>({sessions:vn(x.sessions,g)})),t().markTaskRead(d)}catch(g){throw e({error:g instanceof Error?g.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:d}}),g}finally{e(g=>{const{[p]:x,...b}=g.taskDeliveryActions;return{taskDeliveryActions:b}})}}},dispatchTask:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});try{const b=await re.createTask({...d,projectPath:g});e(y=>({sessions:vn(y.sessions,b.session),isDispatchingTask:!1})),x()&&await t().selectSession(pe(b.session))}catch(b){throw e({isDispatchingTask:!1,...x()?{error:b instanceof Error?b.message:"Failed to dispatch task"}:{}}),b}},startCodeReview:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});let b,y=!1;try{b=await re.createSession(g,"Code Review");const j=pe(b);await re.startCodeReview(j,{kind:d.kind,...d.ref?{ref:d.ref}:{},...d.instructions?{instructions:d.instructions}:{},...d.modelId?{modelId:d.modelId}:{}}),y=!0;const k={...b,taskStatus:"running",taskStatusReason:He("taskHome.review.running"),taskPromptSummary:`/review ${d.kind}${d.ref?` ${d.ref}`:""}`};e(A=>({sessions:vn(A.sessions,k),isDispatchingTask:!1})),x()&&await t().selectSession(j)}catch(j){throw b&&!y&&await re.deleteSession(pe(b)).catch(()=>{}),e({isDispatchingTask:!1,...x()?{error:j instanceof Error?j.message:He("taskHome.review.startFailed")}:{}}),j}}}},N5=e=>({tokenUsage:ao,updateTokenUsage:t=>e(n=>{const{costUsd:r,...s}=t;return{tokenUsage:{...n.tokenUsage,...s,totalInputTokens:n.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:n.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:n.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:n.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:n.tokenUsage.estimatedCostUsd+Math.max(0,r??0)}}}),resetContextUsage:()=>e(t=>({tokenUsage:{...t.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,n=!1)=>e(r=>({tokenUsage:{...r.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:n}}))}),L=ui()((...e)=>({...f2(...e),...P5(...e),...QD(...e),...w5(...e),...N5(...e)}));function O5(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function $5({open:e,onOpenChange:t}){const n=Ft(),r=L(T=>T.currentSessionRef),s=L(T=>T.isStreaming),o=L(T=>T.isTemporarySession),i=L(T=>T.rewindSession),[a,l]=w.useState([]),[d,m]=w.useState(null),[p,g]=w.useState(!1),[x,b]=w.useState(!1),[y,j]=w.useState(!1),[k,A]=w.useState(null);w.useEffect(()=>{if(!e||!r)return;let T=!1;return b(!0),A(null),l([]),m(null),g(!1),re.listRewindCheckpoints(r).then(C=>{var O;T||(l(C),m(((O=C[0])==null?void 0:O.messageId)??null))}).catch(C=>{T||A(C instanceof Error?C.message:n("chat.rewind.loadFailed"))}).finally(()=>{T||b(!1)}),()=>{T=!0}},[r,e]);const N=w.useMemo(()=>a.find(T=>T.messageId===d)??null,[a,d]),$=!!N&&!x&&!y&&!s&&!o,Q=async()=>{if(!N||!$)return;j(!0),A(null);const T=await i(N.messageId,p?"both":"conversation");j(!1),T?t(!1):A(n("chat.rewind.failed"))};return c.jsx(ol,{open:e,onOpenChange:t,children:c.jsxs(Yi,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[c.jsx(il,{className:"border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300",children:c.jsx(Su,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx(Xi,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:n("chat.rewind.title")}),c.jsx(Zi,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:n("chat.rewind.description")})]})]})}),c.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[x&&c.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-xs font-mono",children:n("chat.rewind.loading")})]}),!x&&k&&c.jsx("div",{role:"alert",className:"rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:k}),!x&&!k&&a.length===0&&c.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[c.jsx(Su,{className:"mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600"}),c.jsx("p",{className:"text-sm text-[#4B5563] dark:text-zinc-300",children:n("chat.rewind.empty")})]}),!x&&a.length>0&&c.jsx("div",{role:"radiogroup","aria-label":n("chat.rewind.checkpointAria"),className:"max-h-[310px] space-y-1 overflow-y-auto",children:a.map(T=>{const C=T.messageId===d;return c.jsxs("button",{type:"button",role:"radio","aria-checked":C,onClick:()=>m(T.messageId),className:W("w-full rounded-md border px-4 py-3 text-left transition-colors",C?"border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50":"border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900"),children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsx("p",{className:"line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100",children:T.preview||n("chat.rewind.userMessage")}),c.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:O5(T.createdAt)})]}),c.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500",children:[c.jsx("span",{children:T.messageId.slice(0,10)}),T.fileCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(dS,{className:"h-3 w-3"}),T.fileCount===1?n("chat.rewind.fileCountOne",{count:T.fileCount}):n("chat.rewind.fileCountMany",{count:T.fileCount})]})]})]},T.messageId)})})]}),c.jsx("div",{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:c.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[c.jsx("input",{type:"checkbox",checked:p,disabled:!N||N.fileCount===0,onChange:T=>g(T.target.checked),className:"mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40"}),c.jsxs("span",{children:[c.jsx("span",{className:"block text-[12px] font-medium text-[#374151] dark:text-zinc-200",children:n("chat.rewind.restoreCode")}),c.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:n("chat.rewind.restoreCodeHint")})]})]})}),c.jsxs(Xf,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[c.jsx(br,{variant:"ghost",onClick:()=>t(!1),disabled:y,children:n("chat.rewind.cancel")}),c.jsxs(br,{onClick:()=>void Q(),disabled:!$,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[y?c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Qi,{className:"mr-2 h-4 w-4"}),n("chat.rewind.confirm")]})]})]})})}function ly({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=Ft(),i=Math.max(1,n),a=Array.from({length:Math.min(i,12)}),l=Math.min(e,i);return c.jsxs("div",{className:W("inline-flex items-center gap-2 font-mono",r?"text-[10.5px]":"text-[11px]",s),title:o("capacity.title",{inFlight:e,queued:t,max:n}),children:[c.jsx("span",{className:W("inline-flex items-center gap-[3px] rounded-sm",r?"px-0":"px-0.5"),children:a.map((d,m)=>{const p=m<l;return c.jsx("span",{className:W("block",r?"h-2.5 w-[3px] rounded-[1px]":"h-3 w-[3px] rounded-[1px]",p?"bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]":"bg-[hsl(var(--deck-border-strong))]/60")},m)})}),c.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-ink-muted))]",children:[c.jsx("span",{className:"text-[hsl(var(--deck-ink))]",children:e}),c.jsx("span",{className:"mx-[2px] opacity-40",children:"/"}),c.jsx("span",{children:n}),c.jsx("span",{className:"opacity-60",children:o("capacity.suffix.running")})]}),t>0&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-amber-500"}),o("capacity.queued",{queued:t})]})]})}function vf(){const e=document.querySelector("textarea[data-blade-composer]:not(:disabled)");if(!e)return!1;e.focus();const t=e.value.length;return e.setSelectionRange(t,t),!0}const dy=[{id:"searchTasks",key:"k",primaryModifier:!0,scope:"Global"},{id:"openCommands",key:"p",primaryModifier:!0,shiftKey:!0,scope:"Global"},{id:"newTask",key:"n",primaryModifier:!1,scope:"Global"},{id:"focusComposer",key:"/",primaryModifier:!1,scope:"Chat"},{id:"toggleSidebar",key:"b",primaryModifier:!0,scope:"Layout"}];function R5(e){const t=e.key.toLocaleLowerCase();return dy.find(n=>{if(n.key!==t||e.altKey||e.shiftKey!==!!n.shiftKey)return!1;const r=e.metaKey||e.ctrlKey;return n.primaryModifier?r:!r})??null}function M5(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function F5(e){var r;const t=typeof navigator>"u"?null:navigator,n=((r=t==null?void 0:t.userAgentData)==null?void 0:r.platform)??(t==null?void 0:t.platform)??"";return/mac|iphone|ipad|ipod/i.test(n)}function D5(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=F5();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function Vc(e,t){const n=dy.find(r=>r.id===e);return n?D5(n).join(""):""}const uy="blade.sidebar.view",fy="blade.preview.width",lc=640,_5=360,L5=960,U5=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(uy);return e==="status"||e==="project"?e:"project"},my=e=>Math.min(L5,Math.max(_5,Math.round(e))),B5=()=>{if(typeof localStorage>"u")return lc;const e=localStorage.getItem(fy);if(!e)return lc;const t=Number(e);return Number.isFinite(t)?my(t):lc},kr=ui(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:U5(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(uy,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:B5(),setPreviewWidth:t=>{const n=my(t);typeof localStorage<"u"&&localStorage.setItem(fy,String(n)),e({previewWidth:n})},previewTab:"diff",setPreviewTab:t=>e({previewTab:t}),previewTargetPath:null,previewRequestId:0,openFilePreview:t=>e(n=>({isFilePreviewOpen:!0,previewTab:(t==null?void 0:t.tab)??n.previewTab,previewTargetPath:(t==null?void 0:t.targetPath)??null,previewRequestId:n.previewRequestId+1})),isSettingsOpen:!1,settingsSection:"general",toggleSettings:()=>e(t=>({isSettingsOpen:!t.isSettingsOpen,...t.isSettingsOpen?{}:{settingsSection:"general"}})),openSettings:(t="general")=>e({isSettingsOpen:!0,settingsSection:t}),isTerminalOpen:!1,toggleTerminal:()=>e(t=>({isTerminalOpen:!t.isTerminalOpen})),isTaskSwitcherOpen:!1,taskSwitcherMode:"tasks",setTaskSwitcherOpen:(t,n)=>e(r=>({isTaskSwitcherOpen:t,taskSwitcherMode:n??r.taskSwitcherMode})),setTaskSwitcherMode:t=>e({taskSwitcherMode:t})}));function H5(){const e=kr(r=>r.setTaskSwitcherOpen),t=kr(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);w.useEffect(()=>{const r=s=>{if(s.repeat)return;const o=R5(s);if(!o)return;const i=kr.getState(),a=i.isTaskSwitcherOpen,l=M5(s.target),d=!!document.querySelector('[role="dialog"]');if(o.id==="searchTasks"||o.id==="openCommands"){if(d&&!a)return;s.preventDefault();const m=o.id==="searchTasks"?"tasks":"commands",p=a&&i.taskSwitcherMode===m;e(!p,m);return}if(!(l||d)){if(o.id==="newTask"){s.preventDefault(),n(),requestAnimationFrame(()=>vf());return}if(o.id==="focusComposer"){vf()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const su=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Of,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(sS,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(py,{}),c.jsx(oS,{})]}));su.displayName=Of.displayName;const py=w.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx($f,{ref:r,orientation:t,className:W("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:c.jsx(iS,{className:"relative flex-1 rounded-full bg-border"})}));py.displayName=$f.displayName;function ho(e,t){var s;const n=(s=e.title)==null?void 0:s.trim();if(n==="Code Review")return t("session.title.codeReview");if(n)return n;const r=e.firstMessageTime||e.lastMessageTime;if(r){const o=new Date(r);if(!Number.isNaN(o.getTime()))return t("recent.session.fallbackDated",{y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),d:String(o.getDate()).padStart(2,"0"),hh:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0")})}return t("recent.session.fallbackShort",{id:e.sessionId.slice(0,6)})}async function gy(e,t=!1){const n=await re.exportSessionMarkdown(e,t),r=new Blob([n.markdown],{type:"text/markdown;charset=utf-8"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=n.filename,o.hidden=!0,document.body.appendChild(o);try{o.click()}finally{o.remove(),await new Promise(i=>{window.setTimeout(()=>{URL.revokeObjectURL(s),i()},0)})}return n}const Gn=cS,Vn=lS,Mn=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(aS,{children:c.jsx(Rf,{ref:s,align:t,sideOffset:n,className:W("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));Mn.displayName=Rf.displayName;function q5(){const e=Ft(),t=L(b=>b.archivedSessions),n=L(b=>b.archivedCatalogLoadState),r=L(b=>b.archivedCatalogError),s=L(b=>b.loadArchivedSessions),o=L(b=>b.unarchiveSession),i=L(b=>b.setError),[a,l]=w.useState(!1),[d,m]=w.useState(null),[p,g]=w.useState(null),x=b=>{l(b),b&&s()};return c.jsxs(Gn,{open:a,onOpenChange:x,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",className:"flex h-8 w-full items-center justify-between rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]","aria-label":e("archive.open"),children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(Mf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),e("archive.title")]}),t.length>0&&c.jsx("span",{className:"rounded-sm bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t.length})]})}),c.jsxs(Mn,{role:"dialog","aria-label":e("archive.title"),side:"right",align:"end",sideOffset:8,className:"w-[340px] overflow-hidden p-0",children:[c.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-[hsl(var(--deck-hairline))] px-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.08em] text-[hsl(var(--deck-ink))]",children:e("archive.title")}),c.jsx("div",{className:"text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.subtitle")})]}),c.jsx("button",{type:"button",onClick:()=>void s(),"aria-label":e("archive.refresh"),className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:W("h-3 w-3",(n==="loading"||n==="hydrating")&&"animate-spin")})})]}),r?c.jsxs("div",{className:"px-3 py-4 text-[11px] text-red-600 dark:text-red-400",children:[c.jsx("div",{children:r}),c.jsx("button",{type:"button",onClick:()=>void s(),className:"mt-2 font-mono text-[10px] text-[hsl(var(--deck-accent))] focus-visible:outline-none focus-visible:underline",children:e("archive.retry")})]}):t.length===0&&(n==="loading"||n==="hydrating")?c.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 animate-spin"}),e("archive.loading")]}):t.length===0?c.jsx("div",{className:"flex h-24 items-center justify-center px-6 text-center text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.empty")}):c.jsx(su,{className:"max-h-[340px]",children:c.jsx("div",{className:"divide-y divide-[hsl(var(--deck-hairline))]",children:t.map(b=>{var N;const y=pe(b),j=ze(y),k=d===j,A=b.projectPath.split("/").filter(Boolean).at(-1)??b.projectPath;return c.jsxs("div",{className:"flex min-h-[58px] items-center gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate font-mono text-[11.5px] text-[hsl(var(--deck-ink))]",children:ho(b,e)}),c.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:A}),b.archivedAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":!0,children:"·"}),c.jsx("span",{children:new Date(b.archivedAt).toLocaleString()})]})]}),b.archivedBySessionId!==b.sessionId&&c.jsx("div",{className:"mt-0.5 truncate text-[9px] text-[hsl(var(--deck-accent))]",children:e("archive.inherited",{id:((N=b.archivedBySessionId)==null?void 0:N.slice(0,8))??""})})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[c.jsx("button",{type:"button",disabled:p!==null,onClick:async()=>{g(j);try{await gy(y)}catch($){i($ instanceof Error?$.message:"Session export failed")}finally{g(null)}},"aria-label":e("session.action.export",{title:ho(b,e)}),title:e("session.action.exportShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-35",children:p===j?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ff,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",disabled:k||b.archivedBySessionId!==b.sessionId,onClick:async()=>{m(j);try{await o(y)}finally{m(null)}},"aria-label":e("archive.restore",{title:ho(b,e)}),title:b.archivedBySessionId!==b.sessionId?e("archive.restoreAncestor"):e("archive.restoreShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-35",children:k?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(uS,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function ou({className:e,size:t=28,pulse:n=!0}){return c.jsxs("span",{className:W("inline-flex relative justify-center items-center","text-[hsl(var(--deck-ink))]",e),style:{width:t,height:t},"aria-hidden":"true",children:[c.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M16 3 L28 16 L16 29 L4 16 Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),c.jsx("path",{d:"M16 8 L24 16 L16 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.55"}),c.jsx("path",{d:"M16 3 L20 7",stroke:"hsl(var(--deck-accent))",strokeWidth:"2",strokeLinecap:"round"})]}),n&&c.jsx("span",{className:"absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full",style:{background:"hsl(var(--deck-accent-glow))",boxShadow:"0 0 6px hsl(var(--deck-accent-glow) / 0.9)"}})]})}const If={en:"sidebar.language.en",zh:"sidebar.language.zh"};function hy({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=v0(),s=Ft();if(t==="compact"){const o=n==="en"?"zh":"en";return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-label":s("sidebar.language.aria"),title:s("sidebar.language.label"),className:W("flex justify-center items-center w-10 h-10 font-mono font-medium rounded-md transition-colors text-[11px] text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",e),children:s(If[n])})}return c.jsx("div",{role:"group","aria-label":s("sidebar.language.aria"),className:W("inline-flex h-8 items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-[2px] font-mono text-[11px]",e),children:k0.map(o=>{const i=o===n;return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":i,className:W("flex justify-center items-center px-2 h-full transition-colors min-w-[28px] rounded-[4px]",i?"bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:s(If[o])},o)})})}const z5="[data-mobile-navigation-trigger]";function Y_(e){return by(z5,e)}function by(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function ky({open:e,onOpenChange:t}){const n=Ft(),{boundProjects:r,selectedProjectPath:s,isBindingProject:o,loadBoundProjects:i,bindProject:a,unbindProject:l,selectProject:d,startTemporarySession:m}=L(),[p,g]=w.useState(""),[x,b]=w.useState(null),[y,j]=w.useState(!1),k=w.useRef(0);w.useEffect(()=>{if(e){i();return}k.current+=1,j(!1)},[i,e]);const A=async T=>{await a(T),g(""),m(),t(!1)},N=async T=>{if(T.preventDefault(),!(!p.trim()||o||y)){b(null);try{await A(p.trim())}catch(C){b(C instanceof Error?C.message:n("projects.bind.failed"))}}},$=async()=>{if(y||o)return;const T=++k.current;b(null),j(!0);try{const C=await re.pickProjectDirectory();if(T!==k.current||C.cancelled)return;g(C.path),await A(C.path)}catch(C){if(T!==k.current)return;b(C instanceof Error?C.message:n("projects.pick.failed"))}finally{T===k.current&&j(!1)}},Q=T=>{d(T),m(),t(!1)};return e?c.jsx(ol,{open:e,onOpenChange:t,children:c.jsxs(Yi,{onCloseAutoFocus:T=>by("[data-project-setup-trigger]",T),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[c.jsxs(il,{children:[c.jsxs(Xi,{className:"flex items-center gap-2 font-mono text-[16px]",children:[c.jsx(Oi,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),n("projects.dialog.title")]}),c.jsx(Zi,{className:"text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("projects.dialog.description")})]}),c.jsxs("form",{onSubmit:N,className:"flex gap-2",children:[c.jsx("input",{value:p,onChange:T=>g(T.target.value),disabled:o,placeholder:n("projects.bind.placeholder"),"aria-label":n("projects.bind.pathLabel"),className:"h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]"}),c.jsxs("button",{type:"button",onClick:()=>void $(),disabled:y||o,title:n("projects.pick.action"),"aria-label":n("projects.pick.action"),className:"inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))] disabled:cursor-wait disabled:opacity-50",children:[y?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(fS,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"hidden sm:inline",children:n(y?"projects.pick.picking":"projects.pick.actionShort")})]}),c.jsxs("button",{type:"submit",disabled:!p.trim()||o||y,className:"inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40",children:[o?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Oi,{className:"h-3.5 w-3.5"}),n("projects.bind.action")]})]}),x&&c.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:x}),c.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:r.map(T=>{const C=T.path===s;return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border px-3 py-2",C?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]":"border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsx(uo,{className:W("h-4 w-4 shrink-0",C?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsxs("button",{type:"button",disabled:!T.available,onClick:()=>Q(T.path),className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx("span",{className:"block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:T.name}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[T.gitBranch&&c.jsxs(c.Fragment,{children:[c.jsx(el,{className:"h-2.5 w-2.5"}),c.jsx("span",{children:T.gitBranch}),c.jsx("span",{children:"·"})]}),c.jsx("span",{className:"truncate",children:T.path}),!T.available&&c.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",n("projects.unavailable")]})]})]}),!T.isCurrent&&c.jsx("button",{type:"button",onClick:()=>void l(T.path).catch(()=>{}),title:n("projects.unbind.action"),"aria-label":n("projects.unbind.action"),className:"rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30",children:c.jsx(Df,{className:"h-3.5 w-3.5"})})]},T.path)})})]})}):null}const K5={running:"bg-blue-500 dark:bg-blue-400 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",queued:"bg-amber-400 dark:bg-amber-300",interrupted:"bg-orange-500 dark:bg-orange-400",failed:"bg-red-500 dark:bg-red-400",cancelled:"bg-zinc-400 dark:bg-zinc-500",completed:"bg-[hsl(var(--deck-accent))]"};function G5({session:e,isActive:t,isForking:n,isUnread:r,anyForking:s,isEditing:o,editingTitle:i,title:a,context:l,isCancelling:d,isRetrying:m,isExporting:p,onSelect:g,onCancelTask:x,onRetryTask:b,onFork:y,onArchive:j,onExport:k,onStartRename:A,onDelete:N,onEditingTitleChange:$,onSaveRename:Q,onCancelRename:T}){const C=Ft(),[O,R]=w.useState(!1),K=w.useRef(null),X=w.useRef(null);return o?c.jsxs("div",{className:"flex h-9 w-full items-center gap-2 bg-[hsl(var(--deck-surface))] px-3",children:[c.jsx("input",{type:"text",value:i,onChange:P=>$(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Q(),P.key==="Escape"&&T()},autoFocus:!0,className:"flex-1 rounded bg-[hsl(var(--deck-canvas))] px-2 py-1 font-mono text-[13px] text-[hsl(var(--deck-ink))] outline-none focus:ring-1 focus:ring-[hsl(var(--deck-accent))]"}),c.jsx("button",{"aria-label":C("session.action.save",{title:a}),onClick:Q,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(_f,{className:"w-3 h-3"})}),c.jsx("button",{"aria-label":C("session.action.cancel",{title:a}),onClick:T,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(co,{className:"w-3 h-3"})})]}):c.jsxs("div",{className:W("flex relative items-center w-full transition-colors group min-h-[54px]",t?"bg-[hsl(var(--deck-surface))]":"hover:bg-[hsl(var(--deck-surface))]/60"),children:[t&&c.jsx("span",{className:"absolute left-0 top-1/2 h-6 w-[2px] -translate-y-1/2 rounded-r bg-[hsl(var(--deck-accent))]"}),c.jsxs("button",{type:"button","aria-label":C("session.action.select",{title:a}),"aria-current":t?"true":void 0,"aria-busy":n?"true":void 0,onClick:g,className:"flex min-h-[54px] min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-4 pr-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",e.pendingInteraction?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":K5[e.taskStatus]),title:e.pendingInteraction?C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"):e.taskStatus}),c.jsxs("span",{className:"flex-1 min-w-0 font-mono",children:[c.jsxs("span",{className:W("flex gap-2 items-center text-left truncate text-[12px]",t?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:[c.jsx("span",{className:"truncate",children:a}),r&&c.jsx("span",{title:C("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),e.pendingInteraction&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-amber-100 px-1.5 py-0.5 text-[8.5px] text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"),children:[c.jsx(As,{className:"h-2.5 w-2.5"}),C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission")]}),e.relationType==="fork"&&e.parentId&&c.jsxs("span",{title:`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,"aria-label":`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:[C("session.forkedFrom")," ",e.parentId.slice(0,6)]}),e.taskRetriedFrom&&c.jsx("span",{title:`${C("session.retriedFrom")} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:C("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 truncate text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:l.project}),c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate",children:l.environment}),l.queue&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"text-amber-700 truncate dark:text-amber-400",children:l.queue})]}),l.diff&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate text-[hsl(var(--deck-accent))]",children:l.diff})]})]}),l.reason&&c.jsx("span",{title:l.reason,className:"mt-0.5 block truncate text-[9.5px] text-red-600 dark:text-red-400",children:l.reason})]}),n&&c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]}),c.jsxs("div",{className:W("flex items-center gap-0.5 pr-2 transition-opacity group-focus-within:opacity-100",e.taskStatus==="running"||e.taskStatus==="queued"||e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")?"opacity-100":"opacity-50 group-hover:opacity-100"),children:[(e.taskStatus==="running"||e.taskStatus==="queued")&&c.jsx("button",{type:"button","aria-label":C(d?"session.action.stopping":"session.action.stop",{title:a}),disabled:d,onClick:P=>{P.stopPropagation(),x()},className:"flex h-6 w-6 items-center justify-center rounded text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:d?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(tl,{className:"h-3 w-3"})}),e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")&&c.jsx("button",{ref:K,type:"button","aria-label":C(m?"session.action.retrying":"session.action.retry",{title:a}),disabled:m,onClick:P=>{P.stopPropagation(),b()},className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:m?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(Qi,{className:"h-3 w-3"})}),c.jsxs(Gn,{open:O,onOpenChange:R,children:[c.jsx(Vn,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":C("session.action.more",{title:a}),"aria-expanded":O,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-canvas))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(mS,{className:"h-3.5 w-3.5"})})}),c.jsxs(Mn,{ref:X,role:"menu","aria-label":C("session.action.more",{title:a}),side:"right",align:"start",sideOffset:6,className:"w-40 p-1",onOpenAutoFocus:P=>{var B,M;P.preventDefault(),(M=(B=X.current)==null?void 0:B.querySelector('[role="menuitem"]:not([disabled])'))==null||M.focus()},onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),R(!1),window.setTimeout(()=>{var B;return(B=K.current)==null?void 0:B.focus()},0))},children:[c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.fork",{title:a}),disabled:s,onClick:P=>{P.stopPropagation(),y(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45",children:[c.jsx(pS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.forkShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.rename",{title:a}),onClick:P=>{A(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none",children:[c.jsx(gS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.renameShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.archive",{title:a}),disabled:e.taskStatus==="running"||e.taskStatus==="queued",onClick:P=>{P.stopPropagation(),j(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-35",children:[c.jsx(Mf,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.archiveShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.export",{title:a}),disabled:p,onClick:P=>{P.stopPropagation(),k(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-wait disabled:opacity-45",children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):c.jsx(Ff,{className:"h-3 w-3","aria-hidden":!0}),C(p?"session.action.exportingShort":"session.action.exportShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.delete",{title:a}),onClick:P=>{N(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-red-600 transition-colors hover:bg-red-500/10 focus-visible:bg-red-500/10 focus-visible:outline-none dark:text-red-400",children:[c.jsx(Df,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.deleteShort")]})]})]})]})]})}function V5({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const d=Ft(),m=[{icon:Lf,action:s,labelKey:"sidebar.section.settings"}];return c.jsxs("div",{className:W("flex flex-col gap-2 items-center py-5 h-screen border-r w-[64px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",l),children:[c.jsx("button",{onClick:e,className:"rounded-md p-1 transition-colors hover:bg-[hsl(var(--deck-surface))]","aria-label":d("sidebar.action.expand"),children:c.jsx(ou,{size:28})}),c.jsx("button",{onClick:t,"aria-label":d("sidebar.action.newTaskShort"),title:d("sidebar.action.newTaskShort"),className:"mt-6 flex h-10 w-10 items-center justify-center rounded-md bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/85",children:c.jsx(nl,{className:"h-4 w-4 stroke-[2.5]"})}),c.jsx("button",{onClick:r,"aria-label":d("sidebar.action.terminalToggle"),title:d("sidebar.action.terminal"),className:W("flex h-10 w-10 items-center justify-center rounded-md border transition-colors",o?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-transparent text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]"),children:c.jsx(Uf,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":d("sidebar.action.searchTasks"),title:`${d("sidebar.action.searchTasks")} (${Vc("searchTasks")})`,className:"relative flex h-10 w-10 items-center justify-center rounded-md border border-transparent text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(rl,{className:"h-4 w-4"}),a>0&&c.jsx("span",{"aria-label":d("sidebar.unreadTasks",{count:a}),className:"absolute right-0.5 top-0.5 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-[hsl(var(--deck-accent))] px-1 font-mono text-[8px] font-semibold text-white",children:a>99?"99+":a})]}),c.jsx("div",{className:"flex-1"}),c.jsx("div",{className:"my-2 h-px w-6 bg-[hsl(var(--deck-hairline))]"}),m.map(({icon:p,action:g,labelKey:x})=>c.jsx("button",{"data-settings-trigger":!0,onClick:g,"aria-label":d(x),title:d(x),className:"flex h-10 w-10 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(p,{className:"w-4 h-4"})},x)),c.jsx(hy,{variant:"compact"}),c.jsx("div",{className:"mt-1",children:c.jsx("div",{role:"status","aria-label":d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline"),className:W("h-2 w-2 rounded-full",i?"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60"),title:d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline")})})]})}const xy="blade.sidebar.project-order.v1";function mi(e){const t=new Set,n=[];for(const r of e)typeof r!="string"||!r||t.has(r)||(t.add(r),n.push(r));return n}function W5(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(xy)??"[]");return Array.isArray(e)?mi(e):[]}catch{return[]}}function J5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xy,JSON.stringify(mi(e)))}catch{}}function Q5(e,t){const n=new Map(mi(t).map((s,o)=>[s,o])),r=n.size;return e.map((s,o)=>({project:s,rank:n.get(s.path)??r+o})).sort((s,o)=>s.rank-o.rank).map(({project:s})=>s)}function Y5(e,t,n){const r=mi(e),s=r.indexOf(t),o=r.indexOf(n);if(s<0||o<0||s===o)return r;const[i]=r.splice(s,1);return r.splice(o,0,i),r}function X5(e,t,n){const r=mi(e),s=r.indexOf(t),o=s+n;return s<0||o<0||o>=r.length||([r[s],r[o]]=[r[o],r[s]]),r}function Z5({name:e,path:t,count:n,countIsPartial:r=!1,isActive:s,hasRunning:o,unreadCount:i,collapsed:a,onToggle:l,onSelect:d,onCreateTask:m,reorderPosition:p,reorderCount:g,isDragging:x=!1,onDragStart:b,onDragEnd:y,onReorderKeyDown:j}){const k=Ft();return c.jsxs("div",{className:W("group/proj flex w-full items-center gap-2 px-5 pb-1.5 pt-3 text-left transition-colors","hover:bg-[hsl(var(--deck-surface))]/40"),children:[c.jsx("button",{type:"button",draggable:!0,"data-project-drag-handle":t,onDragStart:b,onDragEnd:y,onKeyDown:j,"aria-label":k("sidebar.project.reorder",{name:e,position:p,count:g}),title:k("sidebar.project.reorderHint"),className:W("-ml-2 flex h-6 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-45 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink-muted))] hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] active:cursor-grabbing group-hover/proj:opacity-100",x&&"cursor-grabbing opacity-100 text-[hsl(var(--deck-accent))]"),children:c.jsx(hS,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:l,"aria-expanded":!a,"aria-label":k(a?"sidebar.project.expand":"sidebar.project.collapse",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(bS,{className:W("h-3 w-3 text-[hsl(var(--deck-ink-faint))] transition-transform duration-150",!a&&"rotate-90")})}),c.jsxs("button",{type:"button",onClick:d??l,title:t,"aria-current":s?"true":void 0,className:"flex min-h-6 min-w-0 flex-1 items-center gap-2 rounded-sm text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(uo,{className:W("h-3.5 w-3.5 shrink-0",s?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsx("span",{className:W("flex-1 truncate font-mono text-[11.5px] font-medium tracking-[-0.01em]",s?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:e}),o&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse dark:bg-blue-400","aria-hidden":!0}),i>0&&c.jsx("span",{"aria-label":k("sidebar.unreadTasks",{count:i}),className:"shrink-0 rounded-full bg-[hsl(var(--deck-accent))] px-1.5 py-0.5 font-mono text-[8px] font-semibold text-white",children:i}),c.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[n.toString().padStart(2,"0"),r?"+":""]})]}),m&&c.jsx("button",{type:"button",onClick:m,title:k("sidebar.project.newTask",{name:e}),"aria-label":k("sidebar.project.newTask",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-0 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-accent))] focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] group-hover/proj:opacity-100",children:c.jsx(nl,{className:"h-3.5 w-3.5"})})]})}function Wc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function Cf(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function iu(e,t){return Cf(e)-Cf(t)||Wc(t)-Wc(e)}const e_=["running","queued","interrupted","failed","cancelled","completed"],t_={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},ys=e=>e.length>1?e.replace(/\/+$/,""):e;function yy(e){const t=new Map;for(const n of e){if(!n)continue;const r=ze(pe(n));t.has(r)||t.set(r,n)}return Array.from(t.values())}function n_(e){const t=yy(e),n=[];for(const r of e_){const s=t.filter(o=>o.taskStatus===r).sort(iu);s.length>0&&n.push({code:t_[r],status:r,sessions:s})}return n}function r_(e,t,n=[]){const r=yy(e),s=new Map,o=n.map(ys),i=new Map(o.map((d,m)=>[d,m]));for(const d of o)s.set(d,[]);for(const d of r){const m=fi(d,t),p=s.get(m);p?p.push(d):s.set(m,[d])}const a=t?ys(t):null,l=Array.from(s.entries()).map(([d,m])=>{const p=[...m].sort(iu),g=m.reduce((x,b)=>Math.max(x,Wc(b)),0);return{path:d,name:qc(d),isActive:a?ys(d)===a:!1,isBound:i.has(ys(d)),hasRunning:m.some(x=>x.taskStatus==="running"),lastActivity:g,sessions:p}});return l.sort((d,m)=>d.isBound!==m.isBound?d.isBound?-1:1:d.isBound&&m.isBound?(i.get(ys(d.path))??Number.MAX_SAFE_INTEGER)-(i.get(ys(m.path))??Number.MAX_SAFE_INTEGER):m.lastActivity-d.lastActivity),l}const jf=12,s_={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},o_={RUNNING:"text-blue-700 dark:text-blue-400",QUEUED:"text-amber-700 dark:text-amber-400",INTERRUPTED:"text-orange-700 dark:text-orange-400",FAILED:"text-red-700 dark:text-red-400",CANCELLED:"text-[hsl(var(--deck-ink-faint))]",DONE:"text-[hsl(var(--deck-accent))]"};function i_({view:e,sessions:t,activeProjectPath:n,boundProjects:r,currentSessionRef:s,unreadTaskKeys:o,catalogLoadState:i,catalogError:a,onSelectProject:l,onCreateTask:d,onRetryCatalog:m,renderRow:p}){const g=Ft(),[x,b]=w.useState({}),[y,j]=w.useState({}),[k,A]=w.useState(W5),[N,$]=w.useState(null),[Q,T]=w.useState(null),[C,O]=w.useState(""),R=i==="loading"||i==="hydrating",K=R||i==="error",X=w.useMemo(()=>e==="status"?n_(t):[],[t,e]),P=w.useMemo(()=>e==="project"?r_(t,n,r.map(F=>F.path)):[],[n,r,t,e]),B=w.useMemo(()=>Q5(P,k),[P,k]),M=(F,me)=>{const Se=y[F]??!1,Ee=Se?me:me.filter((Z,_)=>{if(_<jf)return!0;const Ge=pe(Z);return!!Z.pendingInteraction||o.includes(ze(Ge))||!!(s&&oe(Ge,s))}),Pe=me.length-Ee.length,U=Se?me.length>jf:Pe>0;return c.jsxs(c.Fragment,{children:[Ee.map(p),U&&c.jsx("button",{type:"button",onClick:()=>j(Z=>({...Z,[F]:!Se})),className:"mx-4 my-1 rounded-md px-3 py-1.5 text-left font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:Se?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:Pe})})]})},fe=R?c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-[hsl(var(--deck-surface))]/55 px-3 py-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.syncing")}),c.jsx("span",{className:"tabular-nums shrink-0",children:g("sidebar.catalog.loaded",{count:t.length})})]}):i==="error"?c.jsxs("div",{role:"alert",title:a??void 0,className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-amber-50/80 px-3 py-2 font-mono text-[9.5px] text-amber-800 dark:bg-amber-950/35 dark:text-amber-300",children:[c.jsx(As,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.incomplete")}),c.jsxs("button",{type:"button",onClick:m,className:"inline-flex min-h-6 shrink-0 items-center gap-1 rounded px-1.5 font-medium hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"h-2.5 w-2.5"}),g("sidebar.catalog.retry")]})]}):null;if(e==="status")return c.jsxs("div",{className:"flex flex-col",children:[fe,X.map((F,me)=>c.jsxs("div",{children:[c.jsxs("div",{className:W("flex items-center justify-between px-5 pb-2 pt-3 font-mono text-[10px] tracking-[0.16em]",o_[F.code]??"text-[hsl(var(--deck-ink-faint))]",me===0&&"pt-2"),children:[c.jsx("span",{children:g(s_[F.code])}),c.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:[F.sessions.length.toString().padStart(2,"0"),K?"+":""]})]}),M(`status:${F.code}`,F.sessions)]},F.code))]});const ve=B.some(F=>F.isActive),ke=F=>!!(s&&F.sessions.some(me=>oe(pe(me),s))),ce=(F,me)=>{if(F.join("\0")===B.map(Ee=>Ee.path).join("\0"))return;A(F),J5(F);const Se=B.find(Ee=>Ee.path===me);O(g("sidebar.project.reordered",{name:(Se==null?void 0:Se.name)??me,position:F.indexOf(me)+1}))},Fe=(F,me)=>{const Se=F.sessions.filter(_=>o.includes(ze(pe(_)))).length,Ee=ke(F),Pe=Se>0,U=F.sessions.some(_=>!!_.pendingInteraction),Z=x[F.path]??(ve&&!F.isActive&&!(Ee||F.hasRunning||Pe||U));return c.jsxs("div",{"data-project-group":F.path,onDragEnter:_=>{!N||N===F.path||(_.preventDefault(),T(F.path))},onDragOver:_=>{!N||N===F.path||(_.preventDefault(),_.dataTransfer.dropEffect="move")},onDrop:_=>{_.preventDefault();const Ge=N||_.dataTransfer.getData("text/plain");Ge&&Ge!==F.path&&ce(Y5(B.map(Ne=>Ne.path),Ge,F.path),Ge),$(null),T(null)},className:W("relative transition-colors",Q===F.path&&N!==F.path&&"bg-[hsl(var(--deck-accent-soft))]/55 before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-[hsl(var(--deck-accent))]"),children:[c.jsx(Z5,{name:F.name,path:F.path,count:F.sessions.length,countIsPartial:K,isActive:F.isActive,hasRunning:F.hasRunning,unreadCount:Se,collapsed:Z,onSelect:()=>l(F.path),onCreateTask:()=>d(F.path),reorderPosition:me+1,reorderCount:B.length,isDragging:N===F.path,onDragStart:_=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",F.path),$(F.path)},onDragEnd:()=>{$(null),T(null)},onReorderKeyDown:_=>{if(_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;_.preventDefault();const Ge=X5(B.map(Ne=>Ne.path),F.path,_.key==="ArrowUp"?-1:1);ce(Ge,F.path)},onToggle:()=>b(_=>({..._,[F.path]:!Z}))}),!Z&&M(`project:${F.path}`,F.sessions)]},F.path)};return c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"sr-only","aria-live":"polite",children:C}),fe,B.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-5 pb-0.5 pt-2 font-mono text-[9px] uppercase tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:g("sidebar.project.projects")}),B.map(Fe)]})]})}function a_({className:e,onNavigate:t}){const n=Ft(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:d,setTaskSwitcherOpen:m}=kr(),p=L(S=>S.sessions),g=L(S=>S.catalogLoadState),x=L(S=>S.catalogError),b=L(S=>S.currentSessionRef),y=L(S=>S.forkingSessionRef),j=L(S=>S.selectSession),k=L(S=>S.startTemporarySession),A=L(S=>S.deleteSession),N=L(S=>S.archiveSession),$=L(S=>S.forkSession),Q=L(S=>S.updateSession),T=L(S=>S.loadSessions),C=L(S=>S.setError),O=L(S=>S.taskEventsConnected),R=L(S=>S.taskWorkspaceInfo),K=L(S=>S.boundProjects),X=L(S=>S.selectedProjectPath),P=L(S=>S.bindProject),B=L(S=>S.selectProject),M=L(S=>S.cancelTask),fe=L(S=>S.cancellingTaskKeys),ve=L(S=>S.retryTask),ke=L(S=>S.retryingTaskKeys),ce=L(S=>S.unreadTaskKeys),[Fe,F]=w.useState(null),[me,Se]=w.useState(""),[Ee,Pe]=w.useState(null),[U,Z]=w.useState(!1),_=X??(R==null?void 0:R.cwd)??null,Ge=S=>ho(S,n),Ne=S=>{const Y=S.taskSourceProjectPath||S.projectPath,De=Y.split("/").filter(Boolean).at(-1)||Y,mt=S.taskIsolation==="worktree"?S.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),zn=S.taskDiffStat?`+${S.taskDiffStat.additions} −${S.taskDiffStat.deletions}`:void 0,ms=S.taskStatus==="queued"&&S.taskQueuePosition?n("session.queued",{position:S.taskQueuePosition,depth:S.taskQueueDepth??S.taskQueuePosition}):void 0,ps=ru(S,n);return{project:De,environment:mt,diff:zn,queue:ms,reason:ps}},Oe=()=>{k(_??void 0),t==null||t()},on=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Sn=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Xe=S=>{S(),t==null||t()},qn=async(S,Y)=>{S.stopPropagation(),await A(pe(Y))},ft=async S=>{const Y=pe(S),De=ze(Y);if(!Ee){Pe(De);try{await gy(Y)}catch(mt){C(mt instanceof Error?mt.message:"Session export failed")}finally{Pe(null)}}},an=(S,Y)=>{S.stopPropagation(),F(ze(pe(Y))),Se(Ge(Y))},Rn=async S=>{if(!me.trim()){F(null);return}try{await Q(pe(S),me.trim()),F(null),await T()}catch(Y){console.error("Failed to rename session:",Y)}},_t=()=>{F(null),Se("")};return o?c.jsxs("div",{className:W("flex flex-col h-screen border-r w-[260px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",e),children:[c.jsxs("div",{className:"flex flex-col gap-6 px-5 pt-5 pb-5",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(ou,{size:26}),c.jsx("span",{className:"font-mono text-[15px] font-semibold tracking-[-0.01em] text-[hsl(var(--deck-ink))]",children:"Blade"}),c.jsx("span",{className:"ml-1 rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.brand.badge")})]}),c.jsx("button",{onClick:s,"aria-label":n("sidebar.action.collapse"),className:"flex h-8 w-8 items-center justify-center rounded transition-colors hover:bg-[hsl(var(--deck-surface))]",children:c.jsx(kS,{className:"h-3 w-3 text-[hsl(var(--deck-ink-muted))]"})})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsxs("button",{onClick:Oe,className:"flex h-9 w-full items-center justify-between rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[13px] font-medium text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/88",children:[c.jsxs("span",{className:"flex gap-2 items-center",children:[c.jsx(nl,{className:"h-3.5 w-3.5 stroke-[2.5]"}),n("sidebar.action.newTask")]}),c.jsx("span",{className:"rounded-sm bg-white/10 px-1.5 py-[1px] font-mono text-[10px] text-white/80",children:Vc("newTask")})]}),c.jsxs("button",{onClick:()=>Xe(a),className:W("flex h-9 w-full items-center gap-2 rounded-md border px-3 font-mono text-[12.5px] transition-colors",i?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))] hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]"),children:[c.jsx(Uf,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Xe(()=>m(!0)),className:"flex h-9 w-full items-center justify-between rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(rl,{className:"h-3.5 w-3.5"}),n("sidebar.action.searchTasks")]}),c.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-1.5 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:ce.length>0?ce.length:Vc("searchTasks")})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("div",{className:"flex flex-1 items-center gap-0.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0.5",children:["project","status"].map(S=>c.jsx("button",{type:"button",onClick:()=>d(S),"aria-pressed":l===S,"aria-label":n(S==="project"?"sidebar.view.projectAria":"sidebar.view.statusAria"),className:W("flex-1 rounded-[5px] py-1 font-mono text-[11px] tracking-[0.02em] transition-colors",l===S?"bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] shadow-sm":"text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:n(S==="project"?"sidebar.view.project":"sidebar.view.status")},S))}),c.jsx("button",{type:"button",onClick:()=>Z(!0),title:n("projects.bind.action"),"aria-label":n("projects.bind.action"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-accent))]",children:c.jsx(Oi,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(su,{className:"flex-1 px-0",children:c.jsxs("div",{className:"flex flex-col",children:[(p.length>0||K.length>0||g==="loading"||g==="hydrating"||g==="error")&&c.jsx(i_,{view:l,sessions:p,activeProjectPath:_,boundProjects:K,currentSessionRef:b,unreadTaskKeys:ce,catalogLoadState:g,catalogError:x,onRetryCatalog:T,onSelectProject:S=>void on(S).catch(()=>{}),onCreateTask:S=>void Sn(S).catch(()=>{}),renderRow:S=>{const Y=pe(S),De=ze(Y),mt=oe(Y,b),zn=Fe===De,ms=oe(Y,y),ps=!!y;return c.jsx(G5,{session:S,sessionRef:Y,isActive:mt,isForking:ms,isUnread:ce.includes(ze(Y)),anyForking:ps,isEditing:zn,editingTitle:me,title:Ge(S),context:Ne(S),isCancelling:fe.includes(ze(Y)),isRetrying:ke.includes(ze(Y)),isExporting:Ee===De,onSelect:()=>(t==null||t(),j(Y)),onCancelTask:()=>{M(Y).catch(()=>{})},onRetryTask:()=>{ve(Y).catch(()=>{})},onFork:()=>void $(S),onArchive:()=>void N(Y),onExport:()=>void ft(S),onStartRename:gs=>an(gs,S),onDelete:gs=>qn(gs,S),onEditingTitleChange:Se,onSaveRename:()=>Rn(S),onCancelRename:_t},De)}}),p.length===0&&c.jsx("div",{className:"px-5 mt-6",children:c.jsxs("div",{className:"rounded-md border border-dashed border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/60 px-4 py-6 text-center",children:[c.jsx("div",{className:"mx-auto mb-2 inline-flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))]",children:c.jsx(Bf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"})}),c.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("sidebar.empty.title")}),c.jsx("div",{className:"mt-1 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.empty.hint")})]})})]})}),c.jsxs("div",{className:"flex flex-col gap-3 px-5 pt-3 pb-5",children:[c.jsxs("div",{className:"flex flex-col gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-3",children:[c.jsx(q5,{}),[{icon:Lf,action:()=>Xe(r),labelKey:"sidebar.section.settings"}].map(({icon:S,action:Y,labelKey:De})=>c.jsxs("button",{"data-settings-trigger":!0,onClick:Y,className:"flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(S,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),n(De)]},De))]}),c.jsxs("div",{className:"flex gap-2 justify-between items-center",children:[c.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.language.label")}),c.jsx(hy,{})]}),c.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2",children:[c.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-[hsl(var(--deck-canvas-veil))]",children:c.jsx("div",{className:"h-2 w-2 rounded-full bg-[hsl(var(--deck-ink))]"})}),c.jsxs("div",{className:"flex flex-1 flex-col gap-[1px]",children:[c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:n("sidebar.status.user")}),c.jsxs("span",{className:W("flex gap-1 items-center font-mono text-[10px]",O?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",O?"bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60")}),n(O?"sidebar.status.feedLive":"sidebar.status.feedOffline")]})]})]})]}),c.jsx(ky,{open:U,onOpenChange:Z})]}):c.jsx(V5,{className:e,onExpand:s,onNewChat:Oe,onOpenTaskSwitcher:()=>Xe(()=>m(!0)),onToggleTerminal:()=>Xe(a),onToggleSettings:()=>Xe(r),isTerminalOpen:i,taskEventsConnected:O,unreadCount:ce.length})}const c_=w.lazy(()=>Io(()=>import("./SettingsModal-DBsb7E9J.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),Sy=()=>Io(()=>import("./TaskSwitcher-Z0KWY8g9.js"),__vite__mapDeps([4,1,3,2])).then(e=>({default:e.TaskSwitcher})),l_=w.lazy(Sy),d_=w.lazy(()=>Io(()=>import("./FilePreview-LvuYnyjv.js"),__vite__mapDeps([5,1,3,2])).then(e=>({default:e.FilePreview}))),u_=w.lazy(()=>Io(()=>import("./TerminalPanel-DVWTlxtd.js"),__vite__mapDeps([6,1,7,8,3,2])).then(e=>({default:e.TerminalPanel}))),dc=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},f_=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function m_({children:e}){var Ee,Pe;const t=Ft();H5();const{isSidebarOpen:n,isFilePreviewOpen:r,isSettingsOpen:s,isTerminalOpen:o,isTaskSwitcherOpen:i,toggleFilePreview:a,openFilePreview:l,previewRequestId:d,setSidebarOpen:m}=kr();w.useEffect(()=>{const U=window.setTimeout(()=>{Sy()},1500);return()=>window.clearTimeout(U)},[]);const p=L(U=>U.currentSessionId),g=L(U=>U.currentSessionRef),x=L(U=>U.sessions),b=L(U=>U.isStreaming),y=L(U=>U.isTemporarySession),j=L(U=>U.taskWorkspaceInfo),k=L(U=>U.boundProjects),A=L(U=>U.selectedProjectPath),[N,$]=w.useState(null),[Q,T]=w.useState(!1),[C,O]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[R,K]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),X=w.useRef(null),P=w.useRef(null),B=w.useRef(null),M=w.useMemo(()=>x.find(U=>oe({sessionId:U.sessionId,projectPath:U.projectPath},g)),[g,x]),fe=(M==null?void 0:M.taskIsolation)==="worktree"&&M.taskSourceProjectPath&&(((Ee=M.taskDelivery)==null?void 0:Ee.status)==="applied"||((Pe=M.taskDelivery)==null?void 0:Pe.status)==="discarded")?M.taskSourceProjectPath:g==null?void 0:g.projectPath;w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 900px)"),Z=()=>{U.matches&&m(!1)};return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[m]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 639px)"),Z=()=>O(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 1023px)"),Z=()=>K(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(!C||!n)return;const U=requestAnimationFrame(()=>{var Z,_;(_=(Z=X.current)==null?void 0:Z.querySelector("button"))==null||_.focus()});return()=>{var Z;cancelAnimationFrame(U),(Z=P.current)==null||Z.focus({preventScroll:!0})}},[C,n]);const ve=U=>{var Ne;if(!C||!n)return;if(U.key==="Escape"){U.preventDefault(),m(!1);return}if(U.key!=="Tab")return;const Z=Array.from(((Ne=X.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(Z.length===0)return;const _=Z[0],Ge=Z[Z.length-1];U.shiftKey&&document.activeElement===_?(U.preventDefault(),Ge==null||Ge.focus()):!U.shiftKey&&document.activeElement===Ge&&(U.preventDefault(),_==null||_.focus())},ke=w.useMemo(()=>!p||y?A?dc(A):null:M!=null&&M.projectPath?dc(M.taskSourceProjectPath||M.projectPath):null,[p,M,y,A]),ce=w.useMemo(()=>ke?f_(ke):[],[ke]);w.useEffect(()=>{var Z;if(!g){$(((Z=k.find(_=>_.path===A))==null?void 0:Z.gitBranch)??null);return}(async()=>{try{const _=await re.getGitInfo({sessionId:g.sessionId,projectPath:fe??g.projectPath});$(_.branch)}catch{$(null)}})()},[k,g,fe,A]);const Fe=j==null?void 0:j.taskAdmission,F=fe??A??(j==null?void 0:j.cwd)??null,me=g?ze(g):`project:${A??"none"}`,Se=r&&R;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[C&&n&&!Se&&c.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>m(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),c.jsx("div",{ref:X,role:C&&n&&!Se?"dialog":void 0,"aria-modal":C&&n&&!Se?!0:void 0,"aria-label":C&&n&&!Se?t("sidebar.navigationAria"):void 0,"aria-hidden":Se||C&&!n?!0:void 0,inert:Se||C&&!n?!0:void 0,onKeyDown:ve,className:W("overflow-hidden",n?"w-[260px]":"w-[64px]",C?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",C&&!n&&"-translate-x-full"),children:c.jsx("div",{className:W("transition-all duration-300 ease-in-out",n?"w-[260px]":"w-[64px]"),children:c.jsx(a_,{onNavigate:()=>{C&&m(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":Se||void 0,inert:Se||void 0,className:"relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6",children:[C&&c.jsx(br,{ref:P,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>m(!0),"aria-label":t("layout.action.openNavigation"),title:t("layout.action.openNavigation"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(xS,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ce.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:ke??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:ce.map((U,Z)=>{const _=Z===ce.length-1,Ge=Z===0&&U==="~";return c.jsxs("span",{className:"flex items-center min-w-0",children:[Z>0&&c.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),Z===0&&!Ge&&c.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),c.jsx("span",{className:W("truncate",_?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:U})]},Z)})}):c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?dc(j.cwd):t("layout.workspace.empty")}),N&&c.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(el,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),N]})]}),c.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[Fe&&c.jsx("span",{className:"hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex",children:c.jsx(ly,{inFlight:Fe.inFlight,queued:Fe.queued,maxConcurrent:Fe.maxConcurrent,compact:!0})}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx(br,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:!g||y||b,onClick:()=>T(!0),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35",children:c.jsx(Qi,{className:"w-4 h-4"})}),c.jsx(br,{ref:B,variant:"ghost",size:"icon",onClick:()=>{if(r){a();return}l((!g||y)&&d===0?{tab:"files"}:void 0)},title:t("layout.action.filePreview"),"aria-label":t("layout.action.filePreviewToggle"),className:W("h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",r&&"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] hover:text-[hsl(var(--deck-accent))]"),children:c.jsx(yS,{className:"w-4 h-4"})})]})]})]}),c.jsxs("main",{className:"flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]",children:[c.jsx("div",{"data-preview-background":"content","aria-hidden":Se||void 0,inert:Se||void 0,className:"flex relative flex-col flex-1 min-w-0",children:s?c.jsx(w.Suspense,{fallback:null,children:c.jsx(c_,{})}):e}),r&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(d_,{returnFocusElement:B.current},me)})]})]}),o&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(u_,{workspacePath:F},F??"default-workspace")}),i&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(l_,{})}),c.jsx($5,{open:Q,onOpenChange:T})]})}const uc="BladeCode";function p_(){const e=Ft(),t=L(i=>i.unreadTaskKeys),n=L(i=>i.sessions),r=L(i=>i.selectSession),s=L(i=>i.selectProject),o=w.useMemo(()=>{const i=new Set(t);for(const a of n)a.pendingInteraction&&i.add(ze(pe(a)));return i.size},[n,t]);return w.useEffect(()=>(document.title=o>0?`(${o}) ${uc}`:uc,()=>{document.title=uc}),[o]),w.useEffect(()=>{const i=a=>{var g;const l=a.detail;if(!(l!=null&&l.sessionId)||!l.projectPath)return;const d=L.getState(),m=eu(d.sessions,l),p=m?fi(m,d.selectedProjectPath??((g=d.taskWorkspaceInfo)==null?void 0:g.cwd)??null):l.projectPath;d.boundProjects.some(x=>x.available&&x.path===p)&&s(p),r(l)};return window.addEventListener(Ki,i),()=>window.removeEventListener(Ki,i)},[s,r]),c.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const Jc=w.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:W("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Jc.displayName="Textarea";const g_=(e,t)=>{const n=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(const r of n){const s=r[1],o=r.index+(r[0].length-s.length),i=o+s.length;if(t>=o&&t<=i){let a=s.slice(1),l=!1;return a.startsWith('"')&&(l=!0,a=a.slice(1),a.endsWith('"')&&(a=a.slice(0,-1))),{hasQuery:!0,query:a,startIndex:o,endIndex:i,quoted:l}}}return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}},h_=(e,t,n={})=>{const{debounceDelay:r=200,maxSuggestions:s=15,workspacePath:o}=n,[i,a]=w.useState([]),[l,d]=w.useState(0),[m,p]=w.useState(!1),g=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:g_(e,t),[e,t]);w.useEffect(()=>{if(!g.hasQuery){a([]),p(!1);return}let y=!1;p(!0);const k=setTimeout(async()=>{try{const A=await fetch(`/suggestions/files?q=${encodeURIComponent(g.query)}&limit=${s}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!A.ok)throw new Error("Failed to fetch suggestions");const N=await A.json();y||a(N)}catch(A){console.error("Failed to fetch file suggestions:",A),y||a([])}finally{y||p(!1)}},r);return()=>{y=!0,clearTimeout(k)}},[g.hasQuery,g.query,r,s,o]),w.useEffect(()=>{d(0)},[i]);const x=w.useCallback(()=>{d(y=>(y+1)%Math.max(i.length,1))},[i.length]),b=w.useCallback(()=>{d(y=>(y-1+i.length)%Math.max(i.length,1))},[i.length]);return{...g,suggestions:i,selectedIndex:l,loading:m,setSelectedIndex:d,selectNext:x,selectPrevious:b}},b_=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,k_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=b_(n,t.quoted),s=e.slice(0,t.startIndex),o=e.slice(t.endIndex),i=s+r+" "+o,a=t.startIndex+r.length+1;return{newInput:i,newCursorPos:a}};function x_(){const[e,t]=w.useState([]),[n,r]=w.useState(-1),s=w.useRef(""),o=w.useCallback(d=>{d.trim()&&(t(m=>m[m.length-1]===d?m:[...m,d]),r(-1),s.current="")},[]),i=w.useCallback(d=>{if(e.length===0)return null;n===-1&&(s.current=d);const m=n===-1?e.length-1:Math.max(0,n-1);return r(m),e[m]??null},[e,n]),a=w.useCallback(()=>{if(n===-1)return null;const d=n+1;return d>=e.length?(r(-1),s.current):(r(d),e[d]??null)},[e,n]),l=w.useCallback(()=>{r(-1),s.current=""},[]);return{addToHistory:o,getPrevious:i,getNext:a,reset:l,historyIndex:n}}const y_=(e,t)=>{if(!e.startsWith("/"))return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1};const n=e.indexOf(" "),r=n===-1?e.length:n;return t<=r?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}},S_=(e,t,n={})=>{const{debounceDelay:r=150,workspacePath:s}=n,[o,i]=w.useState([]),[a,l]=w.useState(0),[d,m]=w.useState(!1),p=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:y_(e,t),[e,t]);w.useEffect(()=>{if(!p.hasQuery){i([]),m(!1);return}let b=!1;m(!0);const j=setTimeout(async()=>{try{const k=await fetch(`/suggestions/commands?q=${encodeURIComponent(p.query)}`,s?{headers:{"x-blade-directory":s}}:void 0);if(!k.ok)throw new Error("Failed to fetch suggestions");const A=await k.json();b||i(A)}catch(k){console.error("Failed to fetch command suggestions:",k),b||i([])}finally{b||m(!1)}},r);return()=>{b=!0,clearTimeout(j)}},[p.hasQuery,p.query,r,s]),w.useEffect(()=>{l(0)},[o]);const g=w.useCallback(()=>{l(b=>(b+1)%Math.max(o.length,1))},[o.length]),x=w.useCallback(()=>{l(b=>(b-1+o.length)%Math.max(o.length,1))},[o.length]);return{...p,suggestions:o,selectedIndex:a,loading:d,setSelectedIndex:l,selectNext:g,selectPrevious:x}},w_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=e.slice(t.endIndex),s=n.command+" "+r.trimStart(),o=n.command.length+1;return{newInput:s,newCursorPos:o}},v_="blade.composer.draft.",Gi=new Map,wy=1;function Vi(){return typeof sessionStorage>"u"?null:sessionStorage}function Wi(e){return`${v_}${e}`}function I_(e){var n;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=Gi.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const r=((n=Vi())==null?void 0:n.getItem(Wi(e)))??"";if(!r)return{content:"",attachments:[],outputSchema:void 0};try{const s=JSON.parse(r);if(s.version===wy&&typeof s.content=="string"&&(s.outputSchema===void 0||typeof s.outputSchema=="string"))return{content:s.content,attachments:[],outputSchema:s.outputSchema}}catch{}return{content:r,attachments:[],outputSchema:void 0}}catch{return{content:"",attachments:[],outputSchema:void 0}}}function cn(e,t){var s,o;if(!e)return;const n=Gi.get(e),r=t.outputSchema??(n==null?void 0:n.outputSchema);if(!t.content&&t.attachments.length===0&&!r){vy(e);return}Gi.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:r});try{t.content||r?(s=Vi())==null||s.setItem(Wi(e),JSON.stringify({version:wy,content:t.content,...r?{outputSchema:r}:{}})):(o=Vi())==null||o.removeItem(Wi(e))}catch{}}function vy(e){var t;if(e){Gi.delete(e);try{(t=Vi())==null||t.removeItem(Wi(e))}catch{}}}function Qc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function C_(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function j_(e,t){const r=Qc(e)+t.reduce((s,o)=>s+C_(o),0);return e.length+t.length>zr?{accepted:!1,reason:"count",estimatedBytes:r}:r>po?{accepted:!1,reason:"bytes",estimatedBytes:r}:{accepted:!0,estimatedBytes:r}}const T_=e=>typeof e=="object"&&"command"in e,Tf=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:s,onHover:o,visible:i})=>{const a=w.useRef(null),l=w.useRef(null);if(w.useEffect(()=>{if(l.current&&a.current){const m=a.current,p=l.current,g=m.getBoundingClientRect(),x=p.getBoundingClientRect();x.bottom>g.bottom?m.scrollTop+=x.bottom-g.bottom+4:x.top<g.top&&(m.scrollTop-=g.top-x.top+4)}},[n]),!i||t.length===0&&!r)return null;const d=e==="command"?Hf:wu;return c.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50",children:c.jsxs("div",{className:"mx-4 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700 rounded-lg shadow-xl overflow-hidden",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#6B7280] dark:text-zinc-400",children:[c.jsx(d,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:e==="command"?"Commands":"Files"}),r&&c.jsx(lt,{className:"h-3 w-3 animate-spin ml-auto"})]}),c.jsx("div",{ref:a,className:"max-h-64 overflow-y-auto py-1",children:t.length===0&&r?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"Loading..."}):t.length===0?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"No matches found"}):t.map((m,p)=>{const g=p===n,x=T_(m);return c.jsx("button",{ref:g?l:null,className:W("w-full text-left px-3 py-2 flex items-start gap-3 transition-colors",g?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] hover:bg-[#F3F4F6] hover:text-[#111827] dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300"),onClick:()=>s(p),onMouseEnter:()=>o(p),children:x?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm text-blue-600 dark:text-blue-400",children:m.command}),m.argumentHint&&c.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono",children:m.argumentHint})]}),c.jsx("p",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate",children:m.description})]})}):c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(wu,{className:"h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500"}),c.jsx("span",{className:"font-mono text-sm truncate",children:m})]})},x?m.command:m)})}),c.jsxs("div",{className:"px-3 py-1.5 border-t border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#9CA3AF] dark:text-zinc-500 flex items-center gap-4",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"↑↓"})," ","Navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Tab"})," ","Select"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Esc"})," ","Close"]})]})]})})},fc=[{value:hr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:SS},{value:hr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:wS},{value:hr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:qf,tone:"danger"},{value:hr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:vS}],A_=["off"],E_=["standard"],P_=[];function mc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function N_({onSend:e,onAbort:t,disabled:n,submitDisabled:r=!1,shellSubmitDisabled:s=!1,isStreaming:o,isStopping:i=!1,pendingSteeringCount:a=0,pendingInputDelivery:l=null,recoveredSteeringCount:d=0,variant:m="chat",draft:p,draftAttachments:g,draftRevision:x,draftKey:b,placeholder:y,workspacePath:j}){var xu;const k=Ft(),A=w.useRef(I_(b)),[N,$]=w.useState(A.current.content),[Q,T]=w.useState(A.current.attachments),C=w.useRef(N),O=w.useRef(Q),[R,K]=w.useState(A.current.outputSchema??""),X=w.useRef(R),[P,B]=w.useState(!1),[M,fe]=w.useState(null),[ve,ke]=w.useState(void 0),[ce,Fe]=w.useState(!1),[F,me]=w.useState(!1),[Se,Ee]=w.useState(!1),[Pe,U]=w.useState(!1),[Z,_]=w.useState(!1),[Ge,Ne]=w.useState(!1),[Oe,on]=w.useState(!1),[Sn,Xe]=w.useState(null),[qn,ft]=w.useState(null),an=N.trimStart().startsWith("!"),Rn=an?s:r,_t=w.useRef(null),S=w.useRef(!1),Y=w.useRef(null),De=w.useRef(null),{currentModelId:mt,configuredModels:zn,hasLoaded:ms,loadedWorkspacePath:ps,loadModels:gs,setCurrentModel:Iy,currentMode:_a,setMode:au}=Pt(),cu=kr(v=>v.isSettingsOpen),Cy=vo(v=>v.communicationStyle),lu=L(v=>v.setMaxContextTokens),Ce=L(v=>v.currentSessionRef),du=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.selectedModelId}),jy=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.reasoningEffort}),Ty=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.serviceTier}),Ay=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.responseVerbosity}),[Ey,uu]=w.useState(null),[Py,La]=w.useState(null),[Ny,Ua]=w.useState(null),[Oy,Ba]=w.useState(null),$y=zn.some(v=>v.id===du),hs=Ce?Ey??($y?du:mt):mt,Ze=zn.find(v=>v.id===hs),Ha=(Ze==null?void 0:Ze.supportedReasoningEfforts)??A_,fu=["auto",...Ha],Dr=Py??jy??"off",pi=(Ze==null?void 0:Ze.supportedServiceTiers)??E_,Ry=["auto",...pi],_r=Ny??Ty??"auto",gi=(Ze==null?void 0:Ze.supportedResponseVerbosities)??P_,My=["auto",...gi],Lr=Oy??Ay??"auto",mu=Cy??"auto",Fy=fu.length>1,Dy=pi.some(v=>v!=="standard"),_y=gi.length>0,pu=(Ze==null?void 0:Ze.displayName)||(Ze==null?void 0:Ze.model)||hs||k("chat.input.model.placeholder"),dr=((xu=Ze==null?void 0:Ze.input)==null?void 0:xu.includes("image"))===!0,Ys=Ze?k("chat.input.attachment.modelUnsupported",{model:pu}):k("chat.input.attachment.modelRequired"),hi=Q.length>0&&!dr,Jt=S_(N,ve,{workspacePath:j}),Qt=h_(N,ve,{workspacePath:j}),bs=x_(),Xs=Jt.hasQuery&&Jt.suggestions.length>0,bi=Qt.hasQuery&&Qt.suggestions.length>0,Ly=Xs||bi;w.useEffect(()=>{!cu&&(!ms||ps!==(j??null))&&gs(j??void 0)},[cu,gs,ps,ms,j]),w.useEffect(()=>{o&&(Fe(!1),me(!1),Ee(!1),U(!1),B(!1))},[o]),w.useEffect(()=>{uu(null),La(null),Ua(null),Ba(null)},[Ce==null?void 0:Ce.projectPath,Ce==null?void 0:Ce.sessionId]),w.useEffect(()=>{Dr!=="auto"&&!Ha.includes(Dr)&&La("auto")},[Dr,Ha]),w.useEffect(()=>{_r!=="auto"&&!pi.includes(_r)&&Ua("auto")},[_r,pi]),w.useEffect(()=>{Lr!=="auto"&&!gi.includes(Lr)&&Ba("auto")},[Lr,gi]),w.useEffect(()=>{ft(null)},[hs]),w.useEffect(()=>{if(p!==void 0){const v=g??O.current;C.current=p,O.current=v,$(p),T(v),Xe(null),ft(null),ke(p.length),cn(b,{content:p,attachments:v}),requestAnimationFrame(()=>{var V;return(V=Y.current)==null?void 0:V.focus()})}},[p,g,b,x]),w.useEffect(()=>()=>{cn(b,{content:C.current,attachments:O.current,outputSchema:X.current})},[b]),w.useEffect(()=>{if(!Ze)return;const v=!!Ze.contextWindow;lu(Ze.contextWindow||0,!v)},[Ze,lu]),w.useEffect(()=>{dr&&Xe(v=>v!==_t.current?v:(_t.current=null,null))},[dr]);const qa=w.useCallback(async()=>{if(!N.trim()&&Q.length===0||n||Rn||hi||S.current)return;let v;if(R.trim()){if(an){fe(k("chat.input.outputSchema.shellUnsupported")),B(!0);return}try{const q=JSON.parse(R);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("schema root must be an object");v=q}catch{fe(k("chat.input.outputSchema.invalid")),B(!0);return}}N.trim()&&bs.addToHistory(N),S.current=!0,on(!0);const V=b;try{if(await e({content:N,modelId:hs??void 0,reasoningEffort:Dr,serviceTier:_r,responseVerbosity:Lr,communicationStyle:mu,attachments:Q,...v?{outputSchema:v}:{}})===!1)return;vy(V),C.current="",O.current=[],X.current="",$(""),T([]),K(""),fe(null),Xe(null),ft(null),_t.current=null,ke(void 0)}catch{}finally{S.current=!1,on(!1)}},[Q,hi,b,N,an,n,hs,Dr,Lr,mu,_r,Rn,e,R,bs,k]),Uy=w.useCallback(v=>{Xe(null),ft(null),_t.current=null,T(V=>{const q=V.filter(Te=>Te.id!==v);return O.current=q,cn(b,{content:C.current,attachments:q}),q})},[b]),gu=w.useCallback(v=>new Promise((V,q)=>{const Te=new FileReader;Te.onload=()=>{if(typeof Te.result!="string"){q(new Error("Failed to read image"));return}V({id:typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:v.name,mimeType:v.type,dataUrl:Te.result})},Te.onerror=()=>q(Te.error??new Error("Failed to read image")),Te.readAsDataURL(v)}),[]),ki=w.useCallback(async v=>{if(v.length===0)return;if(!dr){_t.current=Ys,ft(null),Xe(Ys);return}const V=j_(O.current,v),q=Te=>Te==="count"?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.sizeLimit",{size:mc(po)});if(!V.accepted){_t.current=null,ft(null),Xe(q(V.reason??"bytes"));return}try{const Te=await Promise.all(v.map(ks=>gu(ks))),Et=new Set(O.current.map(ks=>ks.dataUrl)),yu=Te.filter(ks=>Et.has(ks.dataUrl)?!1:(Et.add(ks.dataUrl),!0));if(yu.length===0){Xe(null),ft(null),_t.current=null;return}const xi=[...O.current,...yu];if(Qc(xi)>po){_t.current=null,ft(null),Xe(q("bytes"));return}O.current=xi,T(xi),Xe(null),ft(null),_t.current=null,cn(b,{content:C.current,attachments:xi})}catch{_t.current=null,ft(null),Xe(k("chat.input.attachment.readFailed"))}},[b,Ys,dr,gu,k]),By=w.useCallback(async v=>{const V=Array.from(v.target.files??[]).filter(q=>q.type.startsWith("image/"));await ki(V),v.target.value=""},[ki]),Hy=w.useCallback(async v=>{const V=Array.from(v.clipboardData.items).filter(q=>q.type.startsWith("image/")).map(q=>q.getAsFile()).filter(q=>q!==null);V.length!==0&&(v.preventDefault(),await ki(V))},[ki]),za=w.useCallback(v=>{const V=Jt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=w_(N,Jt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[b,N,Jt]),Ka=w.useCallback(v=>{const V=Qt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=k_(N,Qt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[Qt,b,N]),qy=w.useCallback(v=>{if(Xs){if(v.key==="ArrowDown"){v.preventDefault(),Jt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Jt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),za(Jt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(bi){if(v.key==="ArrowDown"){v.preventDefault(),Qt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Qt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Ka(Qt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),qa();return}if(v.key==="ArrowUp"&&!v.shiftKey){const V=v.target,q=V.selectionStart===0&&V.selectionEnd===0,Te=!N.includes(`
|
|
31
31
|
`);if(q||Te){const Et=bs.getPrevious(N);Et!==null&&(v.preventDefault(),C.current=Et,$(Et),cn(b,{content:Et,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&Y.current.setSelectionRange(Et.length,Et.length)}))}return}if(v.key==="ArrowDown"&&!v.shiftKey){const V=v.target,q=V.selectionStart===N.length&&V.selectionEnd===N.length,Te=!N.includes(`
|
|
32
|
-
`);if((q||Te)&&bs.historyIndex!==-1){const Et=bs.getNext();Et!==null&&(v.preventDefault(),C.current=Et,$(Et),cn(b,{content:Et,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&Y.current.setSelectionRange(Et.length,Et.length)}))}}},[Xs,bi,Jt,Qt,za,Ka,qa,b,N,bs]),Hy=w.useCallback(v=>{const V=v.target.value;C.current=V,$(V),ke(v.target.selectionStart),cn(b,{content:V,attachments:O.current})},[b]),gu=w.useCallback(v=>{const V=v.target;ke(V.selectionStart)},[]);w.useEffect(()=>{Y.current&&(Y.current.style.height="inherit",Y.current.style.height=`${Math.min(Y.current.scrollHeight,200)}px`)},[N]);const Ga=uc.find(v=>v.value===_a)??uc[1],qy=k(Ga.labelKey),zy=Ga.icon,Ky=!!N.trim()||Q.length>0,hu=Q.length>=zr,Gy=Jc(Q),Va=Sn||(hi?Ys:null),bu=Va?null:qn,Wa=!!n||Oe,Vy=Wa||hu||!dr,Zs=dr?hu?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.add"):Ys,Wy=()=>{Wa||(ft(Zs),!dr&&!o&&zn.some(v=>{var V;return(V=v.input)==null?void 0:V.includes("image")})&&Fe(!0))};return c.jsxs("div",{className:m==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[c.jsxs("div",{className:m==="task"?"w-full":"px-4 w-full md:px-6",children:[c.jsxs("div",{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${m==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]"}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]"}`}`,children:[c.jsx(Cf,{type:"command",suggestions:Jt.suggestions,selectedIndex:Jt.selectedIndex,loading:Jt.loading,onSelect:za,onHover:Jt.setSelectedIndex,visible:Xs}),c.jsx(Cf,{type:"file",suggestions:Qt.suggestions,selectedIndex:Qt.selectedIndex,loading:Qt.loading,onSelect:Ka,onHover:Qt.setSelectedIndex,visible:bi&&!Xs}),c.jsx(Wc,{ref:Y,"data-blade-composer":!0,value:N,onChange:Hy,onKeyDown:By,onPaste:Uy,onSelect:gu,onClick:gu,placeholder:y??k(o?"chat.input.placeholder.steering":"chat.input.placeholder.default"),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${m==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:n||Oe,"aria-busy":Oe}),an&&c.jsx("div",{className:"px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400",children:"$ user shell · runs in this Session workspace"}),o&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400",children:a>0&&l==="next_turn"?k("chat.input.followUp.queued",{count:a}):a>0?k("chat.input.steering.queued",{count:a}):c.jsxs(c.Fragment,{children:[k("chat.input.steering.status"),k("chat.input.steering.enterHint")]})}),d>0&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:d===1?k("chat.input.steering.recoveredOne",{count:d}):k("chat.input.steering.recoveredMany",{count:d})}),Va&&c.jsxs("div",{role:"alert",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx(As,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:Va}),Sn&&c.jsx("button",{type:"button","aria-label":k("chat.error.dismiss"),onClick:()=>{Xe(null),_t.current=null},className:"flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950",children:c.jsx(co,{className:"w-3 h-3"})})]}),bu&&c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(wS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:bu}),c.jsx("button",{type:"button","aria-label":k("chat.notice.dismiss"),onClick:()=>ft(null),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(co,{className:"w-3 h-3"})})]}),Q.length>0&&c.jsxs("div",{className:"px-4 pb-2",children:[c.jsx("div",{className:"mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:k("chat.input.attachment.usage",{count:Q.length,limit:zr,used:fc(Gy),budget:fc(po)})}),c.jsx("div",{className:"flex flex-wrap gap-2",children:Q.map(v=>c.jsxs("div",{title:v.name,className:"relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900",children:[c.jsx("img",{src:v.dataUrl,alt:v.name,className:"object-cover w-20 h-20"}),c.jsx("button",{type:"button","aria-label":`${k("chat.input.attachment.remove")} ${v.name}`,title:`${k("chat.input.attachment.remove")} ${v.name}`,onClick:()=>_y(v.id),className:"flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:c.jsx(co,{className:"w-3 h-3"})})]},v.id))})]}),c.jsxs("div",{className:"flex justify-between items-center px-3 py-2 mt-auto",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[Vy?c.jsx("button",{type:"button",disabled:Wa,"aria-disabled":"true","aria-label":Zs,title:Zs,onClick:Wy,className:"flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500",children:c.jsx(wu,{className:"w-4 h-4"})}):c.jsxs("label",{title:Zs,className:"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300",children:[c.jsx("input",{ref:De,type:"file",accept:"image/*",multiple:!0,"aria-label":Zs,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:Ly}),c.jsx(wu,{className:"w-4 h-4"})]}),c.jsxs(Gn,{open:ce,onOpenChange:v=>{!o&&!Oe&&Fe(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,title:k(o?"chat.input.model.locked":"chat.input.model.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[mu,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsx(Mn,{className:"w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:c.jsx("div",{className:"overflow-y-auto max-h-72",children:zn.length===0?c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:k("chat.input.model.empty")}):Object.entries(zn.reduce((v,V)=>{const q=V.provider||"unknown";return v[q]||(v[q]=[]),v[q].push(V),v},{})).map(([v,V])=>c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize",children:v.replace(/-/g," ")}),V.map(q=>{var Te;return c.jsx("button",{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${q.id===hs?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(ft(null),Ce){du(q.id),Fe(!1);return}wy(q.id,j??void 0).then(()=>Fe(!1)).catch(()=>{})},children:c.jsxs("span",{className:"flex gap-2 items-center min-w-0",children:[c.jsx("span",{className:"flex-1 min-w-0 truncate",children:q.displayName||q.model}),((Te=q.input)==null?void 0:Te.includes("image"))&&c.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]",children:k("chat.input.model.vision")})]})},q.id)})]},v))})})]}),Ry&&c.jsxs(Gn,{open:F,onOpenChange:v=>{!o&&!Oe&&me(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.effort.change"),title:k(o?"chat.input.effort.locked":"chat.input.effort.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.effort.label",{effort:Dr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:uu.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.effort.option",{effort:v}),onClick:()=>{La(v),me(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Dr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.autoHint")})]},v))})]})]}),My&&c.jsxs(Gn,{open:Se,onOpenChange:v=>{!o&&!Oe&&Ee(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.serviceTier.change"),title:k(o?"chat.input.serviceTier.locked":"chat.input.serviceTier.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.serviceTier.label",{tier:_r}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:Oy.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.serviceTier.option",{tier:v}),onClick:()=>{Ua(v),Ee(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${_r===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="fast"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.fastHint")}),v==="flex"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.flexHint")})]},v))})]})]}),Fy&&c.jsxs(Gn,{open:Pe,onOpenChange:v=>{!o&&!Oe&&U(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.responseVerbosity.change"),title:k(o?"chat.input.responseVerbosity.locked":"chat.input.responseVerbosity.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.responseVerbosity.label",{verbosity:Lr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:$y.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.responseVerbosity.option",{verbosity:v}),onClick:()=>{Ba(v),U(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Lr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.autoHint")})]},v))})]})]}),c.jsxs(Gn,{open:P,onOpenChange:v=>{!o&&!Oe&&B(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.outputSchema.change"),title:k(o?"chat.input.outputSchema.locked":"chat.input.outputSchema.change"),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${R.trim()?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(vS,{className:"h-3.5 w-3.5"}),R.trim()&&"JSON"]})}),c.jsxs(Mn,{className:"w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsxs("div",{className:"border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800",children:[c.jsx("div",{className:"font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100",children:k("chat.input.outputSchema.title")}),c.jsx("div",{className:"mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500",children:k("chat.input.outputSchema.description")})]}),c.jsxs("div",{className:"p-3",children:[c.jsx(Wc,{value:R,onChange:v=>{const V=v.target.value;X.current=V,K(V),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:V})},spellCheck:!1,"aria-label":k("chat.input.outputSchema.editor"),"aria-invalid":!!M,placeholder:k("chat.input.outputSchema.placeholder"),className:"min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]"}),M&&c.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400",children:[c.jsx(As,{className:"h-3.5 w-3.5"}),M]}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[c.jsx("button",{type:"button",onClick:()=>{const v=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);X.current=v,K(v),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:v})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]",children:k("chat.input.outputSchema.example")}),c.jsx("button",{type:"button",onClick:()=>{X.current="",K(""),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:""})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.outputSchema.clear")})]})]})]})]}),c.jsxs(Gn,{open:Z,onOpenChange:_,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${Ga.tone==="danger"?"text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(zy,{className:"h-3.5 w-3.5"}),qy,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:[c.jsx("div",{className:"px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500",children:k("chat.input.mode.aria")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:uc.map(v=>{const V=v.icon,q=_a===v.value,Te=v.tone==="danger";return c.jsxs("button",{type:"button","aria-pressed":q,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${q?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{v.value===hr.YOLO&&_a!==hr.YOLO?(_(!1),Ne(!0)):(iu(v.value),_(!1))},children:[c.jsx(V,{className:`mt-0.5 h-4 w-4 shrink-0 ${Te?"text-amber-500":q?"text-[#111827] dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:`block text-[13px] font-medium leading-tight ${Te?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:k(v.labelKey)}),c.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:k(v.descriptionKey)})]}),q&&c.jsx(Ff,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},v.value)})})]})]})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[o&&c.jsx(br,{size:"icon",onClick:()=>{t==null||t()},disabled:i,title:k(i?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":k(i?"chat.input.action.stopping":"chat.input.action.stop"),className:"w-8 h-8 text-white bg-red-500 hover:bg-red-600",children:i?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(el,{className:"w-3 h-3"})}),c.jsx(br,{size:"icon",onClick:qa,disabled:!Ky||n||Rn||hi||Oe||Dy,title:k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),className:"h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600",children:Oe?c.jsx(lt,{className:"w-4 h-4 animate-spin"}):c.jsx(IS,{className:"w-4 h-4"})})]})]})]}),m==="chat"&&c.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:k("chat.footer.disclaimer")})]}),c.jsx(sl,{open:Ge,onOpenChange:Ne,children:c.jsx(Yi,{className:"gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]","aria-describedby":"yolo-confirm-desc",hideCloseButton:!0,children:c.jsxs("div",{className:"flex flex-col gap-4 p-5",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-950/40",children:c.jsx(Bf,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),c.jsx(Xi,{className:"font-mono text-sm font-semibold",children:k("chat.input.mode.yolo.confirm.title")})]}),c.jsx(Zi,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:k("chat.input.mode.yolo.confirm.desc")}),c.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[c.jsx("button",{type:"button",onClick:()=>Ne(!1),className:"h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.mode.yolo.confirm.cancel")}),c.jsx("button",{type:"button",onClick:()=>{iu(hr.YOLO),Ne(!1)},className:"h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700",children:k("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}const $_={running:{dot:"bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",labelKey:"recent.status.running",text:"text-blue-700 dark:text-blue-400"},queued:{dot:"bg-amber-400",labelKey:"recent.status.queued",text:"text-amber-700 dark:text-amber-400"},interrupted:{dot:"bg-orange-500",labelKey:"recent.status.paused",text:"text-orange-700 dark:text-orange-400"},failed:{dot:"bg-red-500",labelKey:"recent.status.failed",text:"text-red-700 dark:text-red-400"},cancelled:{dot:"bg-zinc-400",labelKey:"recent.status.cancelled",text:"text-zinc-500"},completed:{dot:"bg-[hsl(var(--deck-accent))]",labelKey:"recent.status.done",text:"text-[hsl(var(--deck-accent))]"}};function R_(e,t){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=Date.now()-n.getTime(),s=Math.floor(r/6e4);if(s<1)return t("recent.time.justNow");if(s<60)return t("recent.time.minutes",{n:s});const o=Math.floor(s/60);if(o<24)return t("recent.time.hours",{n:o});const i=Math.floor(o/24);return t("recent.time.days",{n:i})}function M_(e){return e.split("/").filter(Boolean).at(-1)||e}function F_({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const d=Ft(),m=[...e].sort(ou).slice(0,4),p=a==="loading"||a==="hydrating";return m.length===0?!p&&a!=="error"?null:c.jsxs("div",{role:a==="error"?"alert":"status",className:W("mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",l),children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]"}):c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),d(p?"sidebar.catalog.syncing":"sidebar.catalog.incomplete")]}):c.jsxs("div",{className:W("mt-7",l),children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:d("taskHome.recent.title")}),c.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:d(p?"taskHome.recent.partial":a==="error"?"taskHome.recent.incomplete":"taskHome.recent.total",{count:e.length})})]}),c.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:m.map(g=>{const x=$_[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=M_(g.taskSourceProjectPath||g.projectPath),j=ho(g,d),k=ze(pe(g)),A=g.taskStatus==="running"||g.taskStatus==="queued",N=n.includes(k),$=r.includes(k),Q=!!g.taskRetryAvailable&&(g.taskStatus==="failed"||g.taskStatus==="interrupted"||g.taskStatus==="cancelled"),T=s.includes(k),C=nu(g,d);return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors","hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsxs("button",{type:"button",onClick:()=>t(g),className:"flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",b?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":x.dot)}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]",children:[c.jsx("span",{className:"truncate",children:j}),T&&c.jsx("span",{title:d("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),g.taskRetriedFrom&&c.jsx("span",{title:`${d("session.retriedFrom")} ${g.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:d("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:y}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:W("shrink-0",b?"text-amber-700 dark:text-amber-400":x.text),children:d(b??x.labelKey)}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:"shrink-0",children:R_(g.lastMessageTime||g.firstMessageTime,d)})]}),C&&c.jsx("span",{title:C,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:C})]}),c.jsx(CS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),A&&c.jsx("button",{type:"button","aria-label":d(N?"session.action.stopping":"session.action.stop",{title:j}),disabled:N,onClick:()=>o(g),className:"rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:N?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(el,{className:"h-3.5 w-3.5"})}),Q&&c.jsx("button",{type:"button","aria-label":d($?"session.action.retrying":"session.action.retry",{title:j}),disabled:$,onClick:()=>i(g),className:"rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:$?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Qi,{className:"h-3.5 w-3.5"})})]},k)})})]})}function D_({index:e,title:t,description:n,icon:r,hint:s,onClick:o}){const i=String(e+1).padStart(2,"0"),a=`⌘${e+1}`;return c.jsxs("button",{type:"button",onClick:o,className:W("group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]","hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]","dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]"),children:[c.jsx("span",{"aria-hidden":"true",className:W("pointer-events-none absolute right-3 top-3 h-2 w-2","border-r border-t border-[hsl(var(--deck-border-strong))]","transition-colors group-hover:border-[hsl(var(--deck-accent))]")}),c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsx("span",{className:W("inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]","group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]"),children:c.jsx(r,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]"})}),c.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:i})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:t}),c.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]",children:n}),c.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[c.jsx("span",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100",children:s}),c.jsx("span",{className:"deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:a})]})]})]})}const mc=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:nl,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:jS,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:TS,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:AS,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function __(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function L_(){const e=Ft(),{taskWorkspaceInfo:t,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:s,sessions:o,boundProjects:i,selectedProjectPath:a,error:l,selectProject:d,dispatchTask:m,startCodeReview:p,sendMessage:g,startTemporarySession:x,selectSession:b,cancelTask:y,cancellingTaskKeys:j,retryTask:k,retryingTaskKeys:A,unreadTaskKeys:N,taskEventConnectionState:$,catalogLoadState:Q,reconnectTaskEvents:T,clearError:C,loadTaskWorkspaceInfo:O,loadBoundProjects:R}=L(),K=kr(S=>S.openSettings),X=kr(S=>S.isSettingsOpen),P=Pt(S=>S.currentMode),B=Pt(S=>S.currentModelId),M=Pt(S=>S.configuredModels),fe=Pt(S=>S.isLoading),ve=Pt(S=>S.hasLoaded),ke=Pt(S=>S.loadedWorkspacePath),ce=Pt(S=>S.error),Fe=Pt(S=>S.loadModels),[F,me]=w.useState("worktree"),[Se,Ee]=w.useState(),[Pe,U]=w.useState(!1),Z=e($==="connected"?"taskHome.eyebrow":$==="reconnecting"?"taskHome.feed.reconnecting":$==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),_=w.useMemo(()=>i.find(S=>S.path===a)??i.find(S=>S.isCurrent),[i,a]),Ge=w.useMemo(()=>t2(o,a,(t==null?void 0:t.cwd)??null),[a,o,t==null?void 0:t.cwd]),Ne=(_!=null&&_.available?_.path:void 0)??(t==null?void 0:t.cwd),Oe=`task:${Ne??"unavailable"}`;w.useEffect(()=>{!X&&Ne&&(!ve||ke!==Ne)&&Fe(Ne)},[X,Fe,ke,ve,Ne]);const on=!(_!=null&&_.available)&&n,Sn=_!=null&&_.available?null:r,Xe=!!(Ne&&!on&&!Sn),qn=!!(B&&M.some(S=>S.id===B)),ft=!ve||fe,an=Xe&&qn&&!ft&&ce===null,Rn=w.useMemo(()=>({project:__(e,(_==null?void 0:_.path)??(t==null?void 0:t.cwd)),branch:(_==null?void 0:_.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[_,t,e]),_t=w.useCallback(async S=>{const Y=S.content.trim();if(Y==="/review"||Y.startsWith("/review ")){if(S.attachments.length>0)throw new Error(e("taskHome.review.attachmentsUnsupported"));if(S.outputSchema)throw new Error(e("taskHome.review.outputSchemaUnsupported"));const De=Y.split(/\s+/),mt=De[1]||"uncommitted";if(mt!=="uncommitted"&&mt!=="base"&&mt!=="commit"||mt==="uncommitted"&&De.length!==2&&De.length!==1||(mt==="base"||mt==="commit")&&De.length!==3)throw new Error(e("taskHome.review.usage"));await p({projectPath:Ne,kind:mt,...De[2]?{ref:De[2]}:{},modelId:S.modelId??B??void 0});return}if(S.content.trimStart().startsWith("!")){x(Ne),await g({content:S.content,attachments:[]});return}await m({prompt:S.content,projectPath:Ne,isolation:F,permissionMode:P,modelId:S.modelId??B??void 0,reasoningEffort:S.reasoningEffort,serviceTier:S.serviceTier,responseVerbosity:S.responseVerbosity,communicationStyle:S.communicationStyle,...S.outputSchema?{outputSchema:S.outputSchema}:{},attachments:S.attachments.map(De=>({type:"image",content:De.dataUrl,mimeType:De.mimeType,name:De.name}))})},[P,B,m,F,g,p,x,Ne,e]);return w.useEffect(()=>{const S=Y=>{if(!(Y.metaKey||Y.ctrlKey))return;const De=Number.parseInt(Y.key,10);if(Number.isNaN(De)||De<1||De>mc.length)return;const mt=mc[De-1];mt&&(Y.preventDefault(),Ee({key:Oe,content:mt.prompt}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Oe]),c.jsx("main",{className:"deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]",children:c.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10",children:[c.jsxs("div",{className:"flex gap-4 items-start mb-6",children:[c.jsx(su,{size:36,className:"hidden mt-1 sm:inline-flex"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:W("deck-eyebrow flex items-center gap-2",$==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[$==="offline"?c.jsx(vu,{className:"w-3 h-3"}):c.jsx("span",{className:"deck-pulse-dot"}),Z]}),c.jsxs("h1",{className:"mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]",children:[e("taskHome.hero.prefix")," ",c.jsx("span",{className:"whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]",children:Rn.project}),c.jsx("span",{className:"text-[hsl(var(--deck-ink-muted))]",children:"?"})]}),c.jsx("p",{className:"mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]",children:e("taskHome.hero.subtitle")})]})]}),c.jsxs("div",{className:"mb-4",children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.templates.title")}),c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Uf,{className:"w-3 h-3"}),c.jsx("span",{children:e("taskHome.templates.hint")})]})]}),c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:mc.map((S,Y)=>c.jsx(D_,{index:Y,title:e(S.titleKey),description:e(S.descriptionKey),icon:S.icon,hint:e(S.hintKey),onClick:()=>Ee({key:Oe,content:S.prompt})},S.key))})]}),c.jsxs("div",{className:"rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]",children:[c.jsxs("div",{className:"flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50",children:[c.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[c.jsxs(Gn,{children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button","aria-label":e("taskHome.context.projectSelect"),disabled:i.length===0,className:"group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50",children:[c.jsx(uo,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"font-medium truncate",children:(_==null?void 0:_.name)??Rn.project}),c.jsx(Ss,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),c.jsx(Mn,{align:"start",sideOffset:4,className:"w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl",children:c.jsxs("div",{className:"flex flex-col",children:[i.map(S=>c.jsxs("button",{type:"button",disabled:!S.available,onClick:()=>{d(S.path)},className:W("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",S.path===a?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",!S.available&&"opacity-40"),children:[c.jsx(uo,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0 truncate",children:S.name}),S.path===a&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},S.path)),i.length===0&&c.jsx("span",{className:"px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.workspace.empty")})]})})]}),c.jsxs("button",{type:"button","aria-pressed":F==="worktree",onClick:()=>me(S=>S==="worktree"?"local":"worktree"),className:W("flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors",F==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[F==="worktree"?c.jsx(ES,{className:"w-3 h-3"}):c.jsx(PS,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:e(F==="worktree"?"taskHome.context.isolation.worktree":"taskHome.context.isolation.local")})]}),c.jsxs("span",{className:"flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(Zc,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:Rn.branch})]})]}),c.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&c.jsx(ay,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),s&&c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]",children:[c.jsx(lt,{className:"w-3 h-3 animate-spin"}),c.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!an&&c.jsxs("section",{"aria-label":e("taskHome.setup.aria"),className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3",children:[c.jsxs("div",{className:"mb-2.5",children:[c.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.title")}),c.jsx("p",{className:"mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.description")})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex justify-center items-center w-7 h-7 rounded-md border shrink-0",Xe?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":Sn?"text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:on?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):Xe?c.jsx(Iu,{className:"h-3.5 w-3.5"}):Sn?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(uo,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.workspace.title")}),c.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:on?e("taskHome.setup.workspace.loading"):Sn||(Xe?e("taskHome.setup.workspace.ready",{project:Rn.project}):e("taskHome.setup.workspace.required"))})]}),!Xe&&c.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[Sn&&c.jsx("button",{type:"button",onClick:()=>{Promise.all([O(),R()])},"aria-label":e("taskHome.setup.workspace.retry"),title:e("taskHome.setup.workspace.retry"),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:"h-3.5 w-3.5"})}),c.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>U(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(Oi,{className:"w-3 h-3"}),e("taskHome.setup.workspace.action")]})]})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",qn&&!ce?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":ce?"border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:ft?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):qn&&!ce?c.jsx(Iu,{className:"h-3.5 w-3.5"}):ce?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(Cu,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.model.title")}),c.jsx("span",{title:ce??void 0,className:W("mt-0.5 block truncate text-[10.5px]",ce?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:ft?e("taskHome.setup.model.loading"):ce||e(qn?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!ft&&(!qn||ce)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{ce?Fe(Ne):K("models")},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[ce?c.jsx(lo,{className:"w-3 h-3"}):c.jsx(Cu,{className:"w-3 h-3"}),e(ce?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(O_,{variant:"task",draft:(Se==null?void 0:Se.key)===Oe?Se.content:void 0,draftKey:Oe,placeholder:e("taskHome.composer.placeholder"),onSend:async S=>{try{return await _t(S),Ee(void 0),!0}catch{return!1}},disabled:s,submitDisabled:!an,shellSubmitDisabled:!an,workspacePath:Ne},Oe)})]}),$==="offline"&&c.jsxs("div",{role:"alert",className:"flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200",children:[c.jsx(vu,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 text-[12px]",children:e("taskHome.feed.offlineDescription")}),c.jsxs("button",{type:"button",onClick:()=>void T().catch(()=>{}),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"w-3 h-3"}),e("taskHome.feed.retry")]})]}),l&&c.jsxs("div",{role:"alert",className:"flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx("span",{children:l}),c.jsx("button",{type:"button",onClick:C,className:"underline",children:e("taskHome.error.dismiss")})]}),c.jsx(F_,{sessions:Ge,catalogLoadState:Q,cancellingTaskKeys:j,retryingTaskKeys:A,unreadTaskKeys:N,onSelect:S=>{b(pe(S))},onCancel:S=>{y(pe(S)).catch(()=>{})},onRetry:S=>{k(pe(S)).catch(()=>{})}}),c.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Lf,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(hy,{open:Pe,onOpenChange:U})]})})}const Qc="blade.sessions.last",Ji="session",Yc="project",Xc="workspace";function U_(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.sessionId=="string"&&t.sessionId.trim()&&typeof t.projectPath=="string"&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function B_(e){var o,i,a;const t=new URLSearchParams(e),n=((o=t.get(Ji))==null?void 0:o.trim())||null,r=((i=t.get(Yc))==null?void 0:i.trim())||null,s=((a=t.get(Xc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Ji)}}function H_(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(Qc);return t?U_(JSON.parse(t)):null}catch{return null}}function q_(e,t,n={}){const r=n.href??(typeof window>"u"?"http://localhost/":window.location.href),s=new URL(r),o=n.displayProjectPath??(e==null?void 0:e.projectPath)??t,i=(e==null?void 0:e.projectPath)??null;e?s.searchParams.set(Ji,e.sessionId):s.searchParams.delete(Ji),o?s.searchParams.set(Yc,o):s.searchParams.delete(Yc),i&&o&&i!==o?s.searchParams.set(Xc,i):s.searchParams.delete(Xc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(Qc,JSON.stringify(e)):a==null||a.removeItem(Qc)}catch{}const l=`${s.pathname}${s.search}${s.hash}`,d=n.replaceState??(typeof window>"u"?void 0:m=>window.history.replaceState(null,"",m));return d==null||d(l),l}const z_=w.lazy(()=>Io(()=>import("./ChatView-DdX4BvAo.js"),__vite__mapDeps([9,1,3,2])).then(e=>({default:e.ChatView})));function K_(){const e=Ft(),[t,n]=w.useState(!1),r=L(A=>A.subscribeToTaskEvents),s=L(A=>A.unsubscribeFromTaskEvents),o=L(A=>A.currentSessionRef),i=L(A=>A.isTemporarySession),a=L(A=>A.loadTaskWorkspaceInfo),l=L(A=>A.loadBoundProjects),d=L(A=>A.loadSessions),m=L(A=>A.selectSession),p=L(A=>A.selectProject),g=L(A=>A.startTemporarySession),x=L(A=>A.setError),b=L(A=>A.sessions),y=L(A=>A.selectedProjectPath),j=Pt(A=>A.loadModels),k=vo(A=>A.loadSettings);return w.useEffect(()=>(r().catch(A=>{console.error("Failed to subscribe to task events",A)}),s),[r,s]),w.useEffect(()=>{let A=!1;return(async()=>{var X;d(),k(),j();const $=B_(window.location.search),Q=H_(),T=$.hasSessionParam?$.sessionRef:$.projectPath?null:Q,C=Promise.all([a(),l()]),O=!T&&!$.projectPath;if(O&&(g(),n(!0)),await C,A)return;const R=L.getState(),K=$.projectPath?(X=R.boundProjects.find(P=>P.path===$.projectPath&&P.available))==null?void 0:X.path:null;if(K&&p(K),!(T&&(await m(T),A))){if(!T||!oe(L.getState().currentSessionRef,T)){const P=T?L.getState().error:null;g(),P&&x(P)}O||n(!0)}})(),()=>{A=!0}},[l,j,d,k,a,p,m,x,g]),w.useEffect(()=>{if(!t)return;const A=o?Zd(b,o):void 0;q_(o,y,{displayProjectPath:A?fi(A,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(g_,{}),c.jsx(p_,{children:t?!o||i?c.jsx(L_,{}):c.jsx(w.Suspense,{fallback:c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:c.jsx(z_,{})}):c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")})})]})}Yy.createRoot(document.getElementById("root")).render(c.jsx(oo.StrictMode,{children:c.jsx(K_,{})}));export{Pt as A,su as B,O_ as C,sl as D,C5 as E,vo as F,_5 as G,ou as H,ho as I,fi as J,cy as K,Hc as L,He as M,Gc as N,X_ as O,Gn as P,af as Q,br as R,ru as S,Y_ as T,Io as _,L as a,kr as b,pe as c,ze as d,Yi as e,ol as f,Xi as g,Zi as h,Qf as i,W as j,re as k,VD as l,Zn as m,Fa as n,Pi as o,S0 as p,Zd as q,f2 as r,oe as s,ny as t,Ft as u,Sf as v,pr as w,gy as x,Vn as y,Mn as z};
|
|
32
|
+
`);if((q||Te)&&bs.historyIndex!==-1){const Et=bs.getNext();Et!==null&&(v.preventDefault(),C.current=Et,$(Et),cn(b,{content:Et,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&Y.current.setSelectionRange(Et.length,Et.length)}))}}},[Xs,bi,Jt,Qt,za,Ka,qa,b,N,bs]),zy=w.useCallback(v=>{const V=v.target.value;C.current=V,$(V),ke(v.target.selectionStart),cn(b,{content:V,attachments:O.current})},[b]),hu=w.useCallback(v=>{const V=v.target;ke(V.selectionStart)},[]);w.useEffect(()=>{Y.current&&(Y.current.style.height="inherit",Y.current.style.height=`${Math.min(Y.current.scrollHeight,200)}px`)},[N]);const Ga=fc.find(v=>v.value===_a)??fc[1],Ky=k(Ga.labelKey),Gy=Ga.icon,Vy=!!N.trim()||Q.length>0,bu=Q.length>=zr,Wy=Qc(Q),Va=Sn||(hi?Ys:null),ku=Va?null:qn,Wa=!!n||Oe,Jy=Wa||bu||!dr,Zs=dr?bu?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.add"):Ys,Qy=()=>{Wa||(ft(Zs),!dr&&!o&&zn.some(v=>{var V;return(V=v.input)==null?void 0:V.includes("image")})&&Fe(!0))};return c.jsxs("div",{className:m==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[c.jsxs("div",{className:m==="task"?"w-full":"px-4 w-full md:px-6",children:[c.jsxs("div",{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${m==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]"}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]"}`}`,children:[c.jsx(Tf,{type:"command",suggestions:Jt.suggestions,selectedIndex:Jt.selectedIndex,loading:Jt.loading,onSelect:za,onHover:Jt.setSelectedIndex,visible:Xs}),c.jsx(Tf,{type:"file",suggestions:Qt.suggestions,selectedIndex:Qt.selectedIndex,loading:Qt.loading,onSelect:Ka,onHover:Qt.setSelectedIndex,visible:bi&&!Xs}),c.jsx(Jc,{ref:Y,"data-blade-composer":!0,value:N,onChange:zy,onKeyDown:qy,onPaste:Hy,onSelect:hu,onClick:hu,placeholder:y??k(o?"chat.input.placeholder.steering":"chat.input.placeholder.default"),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${m==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:n||Oe,"aria-busy":Oe}),an&&c.jsx("div",{className:"px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400",children:"$ user shell · runs in this Session workspace"}),o&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400",children:a>0&&l==="next_turn"?k("chat.input.followUp.queued",{count:a}):a>0?k("chat.input.steering.queued",{count:a}):c.jsxs(c.Fragment,{children:[k("chat.input.steering.status"),k("chat.input.steering.enterHint")]})}),d>0&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:d===1?k("chat.input.steering.recoveredOne",{count:d}):k("chat.input.steering.recoveredMany",{count:d})}),Va&&c.jsxs("div",{role:"alert",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx(As,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:Va}),Sn&&c.jsx("button",{type:"button","aria-label":k("chat.error.dismiss"),onClick:()=>{Xe(null),_t.current=null},className:"flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950",children:c.jsx(co,{className:"w-3 h-3"})})]}),ku&&c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(IS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:ku}),c.jsx("button",{type:"button","aria-label":k("chat.notice.dismiss"),onClick:()=>ft(null),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(co,{className:"w-3 h-3"})})]}),Q.length>0&&c.jsxs("div",{className:"px-4 pb-2",children:[c.jsx("div",{className:"mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:k("chat.input.attachment.usage",{count:Q.length,limit:zr,used:mc(Wy),budget:mc(po)})}),c.jsx("div",{className:"flex flex-wrap gap-2",children:Q.map(v=>c.jsxs("div",{title:v.name,className:"relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900",children:[c.jsx("img",{src:v.dataUrl,alt:v.name,className:"object-cover w-20 h-20"}),c.jsx("button",{type:"button","aria-label":`${k("chat.input.attachment.remove")} ${v.name}`,title:`${k("chat.input.attachment.remove")} ${v.name}`,onClick:()=>Uy(v.id),className:"flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:c.jsx(co,{className:"w-3 h-3"})})]},v.id))})]}),c.jsxs("div",{className:"flex justify-between items-center px-3 py-2 mt-auto",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[Jy?c.jsx("button",{type:"button",disabled:Wa,"aria-disabled":"true","aria-label":Zs,title:Zs,onClick:Qy,className:"flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500",children:c.jsx(vu,{className:"w-4 h-4"})}):c.jsxs("label",{title:Zs,className:"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300",children:[c.jsx("input",{ref:De,type:"file",accept:"image/*",multiple:!0,"aria-label":Zs,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:By}),c.jsx(vu,{className:"w-4 h-4"})]}),c.jsxs(Gn,{open:ce,onOpenChange:v=>{!o&&!Oe&&Fe(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,title:k(o?"chat.input.model.locked":"chat.input.model.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[pu,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsx(Mn,{className:"w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:c.jsx("div",{className:"overflow-y-auto max-h-72",children:zn.length===0?c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:k("chat.input.model.empty")}):Object.entries(zn.reduce((v,V)=>{const q=V.provider||"unknown";return v[q]||(v[q]=[]),v[q].push(V),v},{})).map(([v,V])=>c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize",children:v.replace(/-/g," ")}),V.map(q=>{var Te;return c.jsx("button",{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${q.id===hs?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(ft(null),Ce){uu(q.id),Fe(!1);return}Iy(q.id,j??void 0).then(()=>Fe(!1)).catch(()=>{})},children:c.jsxs("span",{className:"flex gap-2 items-center min-w-0",children:[c.jsx("span",{className:"flex-1 min-w-0 truncate",children:q.displayName||q.model}),((Te=q.input)==null?void 0:Te.includes("image"))&&c.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]",children:k("chat.input.model.vision")})]})},q.id)})]},v))})})]}),Fy&&c.jsxs(Gn,{open:F,onOpenChange:v=>{!o&&!Oe&&me(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.effort.change"),title:k(o?"chat.input.effort.locked":"chat.input.effort.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.effort.label",{effort:Dr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fu.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.effort.option",{effort:v}),onClick:()=>{La(v),me(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Dr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.autoHint")})]},v))})]})]}),Dy&&c.jsxs(Gn,{open:Se,onOpenChange:v=>{!o&&!Oe&&Ee(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.serviceTier.change"),title:k(o?"chat.input.serviceTier.locked":"chat.input.serviceTier.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.serviceTier.label",{tier:_r}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:Ry.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.serviceTier.option",{tier:v}),onClick:()=>{Ua(v),Ee(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${_r===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="fast"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.fastHint")}),v==="flex"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.flexHint")})]},v))})]})]}),_y&&c.jsxs(Gn,{open:Pe,onOpenChange:v=>{!o&&!Oe&&U(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.responseVerbosity.change"),title:k(o?"chat.input.responseVerbosity.locked":"chat.input.responseVerbosity.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.responseVerbosity.label",{verbosity:Lr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:My.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.responseVerbosity.option",{verbosity:v}),onClick:()=>{Ba(v),U(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Lr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.autoHint")})]},v))})]})]}),c.jsxs(Gn,{open:P,onOpenChange:v=>{!o&&!Oe&&B(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.outputSchema.change"),title:k(o?"chat.input.outputSchema.locked":"chat.input.outputSchema.change"),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${R.trim()?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(CS,{className:"h-3.5 w-3.5"}),R.trim()&&"JSON"]})}),c.jsxs(Mn,{className:"w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsxs("div",{className:"border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800",children:[c.jsx("div",{className:"font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100",children:k("chat.input.outputSchema.title")}),c.jsx("div",{className:"mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500",children:k("chat.input.outputSchema.description")})]}),c.jsxs("div",{className:"p-3",children:[c.jsx(Jc,{value:R,onChange:v=>{const V=v.target.value;X.current=V,K(V),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:V})},spellCheck:!1,"aria-label":k("chat.input.outputSchema.editor"),"aria-invalid":!!M,placeholder:k("chat.input.outputSchema.placeholder"),className:"min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]"}),M&&c.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400",children:[c.jsx(As,{className:"h-3.5 w-3.5"}),M]}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[c.jsx("button",{type:"button",onClick:()=>{const v=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);X.current=v,K(v),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:v})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]",children:k("chat.input.outputSchema.example")}),c.jsx("button",{type:"button",onClick:()=>{X.current="",K(""),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:""})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.outputSchema.clear")})]})]})]})]}),c.jsxs(Gn,{open:Z,onOpenChange:_,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${Ga.tone==="danger"?"text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(Gy,{className:"h-3.5 w-3.5"}),Ky,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:[c.jsx("div",{className:"px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500",children:k("chat.input.mode.aria")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fc.map(v=>{const V=v.icon,q=_a===v.value,Te=v.tone==="danger";return c.jsxs("button",{type:"button","aria-pressed":q,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${q?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{v.value===hr.YOLO&&_a!==hr.YOLO?(_(!1),Ne(!0)):(au(v.value),_(!1))},children:[c.jsx(V,{className:`mt-0.5 h-4 w-4 shrink-0 ${Te?"text-amber-500":q?"text-[#111827] dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:`block text-[13px] font-medium leading-tight ${Te?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:k(v.labelKey)}),c.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:k(v.descriptionKey)})]}),q&&c.jsx(_f,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},v.value)})})]})]})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[o&&c.jsx(br,{size:"icon",onClick:()=>{t==null||t()},disabled:i,title:k(i?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":k(i?"chat.input.action.stopping":"chat.input.action.stop"),className:"w-8 h-8 text-white bg-red-500 hover:bg-red-600",children:i?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tl,{className:"w-3 h-3"})}),c.jsx(br,{size:"icon",onClick:qa,disabled:!Vy||n||Rn||hi||Oe||Ly,title:k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),className:"h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600",children:Oe?c.jsx(lt,{className:"w-4 h-4 animate-spin"}):c.jsx(jS,{className:"w-4 h-4"})})]})]})]}),m==="chat"&&c.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:k("chat.footer.disclaimer")})]}),c.jsx(ol,{open:Ge,onOpenChange:Ne,children:c.jsx(Yi,{className:"gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]","aria-describedby":"yolo-confirm-desc",hideCloseButton:!0,children:c.jsxs("div",{className:"flex flex-col gap-4 p-5",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-950/40",children:c.jsx(qf,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),c.jsx(Xi,{className:"font-mono text-sm font-semibold",children:k("chat.input.mode.yolo.confirm.title")})]}),c.jsx(Zi,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:k("chat.input.mode.yolo.confirm.desc")}),c.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[c.jsx("button",{type:"button",onClick:()=>Ne(!1),className:"h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.mode.yolo.confirm.cancel")}),c.jsx("button",{type:"button",onClick:()=>{au(hr.YOLO),Ne(!1)},className:"h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700",children:k("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}const O_={running:{dot:"bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",labelKey:"recent.status.running",text:"text-blue-700 dark:text-blue-400"},queued:{dot:"bg-amber-400",labelKey:"recent.status.queued",text:"text-amber-700 dark:text-amber-400"},interrupted:{dot:"bg-orange-500",labelKey:"recent.status.paused",text:"text-orange-700 dark:text-orange-400"},failed:{dot:"bg-red-500",labelKey:"recent.status.failed",text:"text-red-700 dark:text-red-400"},cancelled:{dot:"bg-zinc-400",labelKey:"recent.status.cancelled",text:"text-zinc-500"},completed:{dot:"bg-[hsl(var(--deck-accent))]",labelKey:"recent.status.done",text:"text-[hsl(var(--deck-accent))]"}};function $_(e,t){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=Date.now()-n.getTime(),s=Math.floor(r/6e4);if(s<1)return t("recent.time.justNow");if(s<60)return t("recent.time.minutes",{n:s});const o=Math.floor(s/60);if(o<24)return t("recent.time.hours",{n:o});const i=Math.floor(o/24);return t("recent.time.days",{n:i})}function R_(e){return e.split("/").filter(Boolean).at(-1)||e}function M_({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const d=Ft(),m=[...e].sort(iu).slice(0,4),p=a==="loading"||a==="hydrating";return m.length===0?!p&&a!=="error"?null:c.jsxs("div",{role:a==="error"?"alert":"status",className:W("mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",l),children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]"}):c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),d(p?"sidebar.catalog.syncing":"sidebar.catalog.incomplete")]}):c.jsxs("div",{className:W("mt-7",l),children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:d("taskHome.recent.title")}),c.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:d(p?"taskHome.recent.partial":a==="error"?"taskHome.recent.incomplete":"taskHome.recent.total",{count:e.length})})]}),c.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:m.map(g=>{const x=O_[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=R_(g.taskSourceProjectPath||g.projectPath),j=ho(g,d),k=ze(pe(g)),A=g.taskStatus==="running"||g.taskStatus==="queued",N=n.includes(k),$=r.includes(k),Q=!!g.taskRetryAvailable&&(g.taskStatus==="failed"||g.taskStatus==="interrupted"||g.taskStatus==="cancelled"),T=s.includes(k),C=ru(g,d);return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors","hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsxs("button",{type:"button",onClick:()=>t(g),className:"flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",b?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":x.dot)}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]",children:[c.jsx("span",{className:"truncate",children:j}),T&&c.jsx("span",{title:d("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),g.taskRetriedFrom&&c.jsx("span",{title:`${d("session.retriedFrom")} ${g.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:d("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:y}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:W("shrink-0",b?"text-amber-700 dark:text-amber-400":x.text),children:d(b??x.labelKey)}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:"shrink-0",children:$_(g.lastMessageTime||g.firstMessageTime,d)})]}),C&&c.jsx("span",{title:C,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:C})]}),c.jsx(TS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),A&&c.jsx("button",{type:"button","aria-label":d(N?"session.action.stopping":"session.action.stop",{title:j}),disabled:N,onClick:()=>o(g),className:"rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:N?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tl,{className:"h-3.5 w-3.5"})}),Q&&c.jsx("button",{type:"button","aria-label":d($?"session.action.retrying":"session.action.retry",{title:j}),disabled:$,onClick:()=>i(g),className:"rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:$?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Qi,{className:"h-3.5 w-3.5"})})]},k)})})]})}function F_({index:e,title:t,description:n,icon:r,hint:s,onClick:o}){const i=String(e+1).padStart(2,"0"),a=`⌘${e+1}`;return c.jsxs("button",{type:"button",onClick:o,className:W("group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]","hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]","dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]"),children:[c.jsx("span",{"aria-hidden":"true",className:W("pointer-events-none absolute right-3 top-3 h-2 w-2","border-r border-t border-[hsl(var(--deck-border-strong))]","transition-colors group-hover:border-[hsl(var(--deck-accent))]")}),c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsx("span",{className:W("inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]","group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]"),children:c.jsx(r,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]"})}),c.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:i})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:t}),c.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]",children:n}),c.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[c.jsx("span",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100",children:s}),c.jsx("span",{className:"deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:a})]})]})]})}const pc=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:rl,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:AS,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:ES,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:PS,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function D_(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function __(){const e=Ft(),{taskWorkspaceInfo:t,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:s,sessions:o,boundProjects:i,selectedProjectPath:a,error:l,selectProject:d,dispatchTask:m,startCodeReview:p,sendMessage:g,startTemporarySession:x,selectSession:b,cancelTask:y,cancellingTaskKeys:j,retryTask:k,retryingTaskKeys:A,unreadTaskKeys:N,taskEventConnectionState:$,catalogLoadState:Q,reconnectTaskEvents:T,clearError:C,loadTaskWorkspaceInfo:O,loadBoundProjects:R}=L(),K=kr(S=>S.openSettings),X=kr(S=>S.isSettingsOpen),P=Pt(S=>S.currentMode),B=Pt(S=>S.currentModelId),M=Pt(S=>S.configuredModels),fe=Pt(S=>S.isLoading),ve=Pt(S=>S.hasLoaded),ke=Pt(S=>S.loadedWorkspacePath),ce=Pt(S=>S.error),Fe=Pt(S=>S.loadModels),[F,me]=w.useState("worktree"),[Se,Ee]=w.useState(),[Pe,U]=w.useState(!1),Z=e($==="connected"?"taskHome.eyebrow":$==="reconnecting"?"taskHome.feed.reconnecting":$==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),_=w.useMemo(()=>i.find(S=>S.path===a)??i.find(S=>S.isCurrent),[i,a]),Ge=w.useMemo(()=>r2(o,a,(t==null?void 0:t.cwd)??null),[a,o,t==null?void 0:t.cwd]),Ne=(_!=null&&_.available?_.path:void 0)??(t==null?void 0:t.cwd),Oe=`task:${Ne??"unavailable"}`;w.useEffect(()=>{!X&&Ne&&(!ve||ke!==Ne)&&Fe(Ne)},[X,Fe,ke,ve,Ne]);const on=!(_!=null&&_.available)&&n,Sn=_!=null&&_.available?null:r,Xe=!!(Ne&&!on&&!Sn),qn=!!(B&&M.some(S=>S.id===B)),ft=!ve||fe,an=Xe&&qn&&!ft&&ce===null,Rn=w.useMemo(()=>({project:D_(e,(_==null?void 0:_.path)??(t==null?void 0:t.cwd)),branch:(_==null?void 0:_.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[_,t,e]),_t=w.useCallback(async S=>{const Y=S.content.trim();if(Y==="/review"||Y.startsWith("/review ")){if(S.attachments.length>0)throw new Error(e("taskHome.review.attachmentsUnsupported"));if(S.outputSchema)throw new Error(e("taskHome.review.outputSchemaUnsupported"));const De=Y.split(/\s+/),mt=De[1]||"uncommitted";if(mt!=="uncommitted"&&mt!=="base"&&mt!=="commit"||mt==="uncommitted"&&De.length!==2&&De.length!==1||(mt==="base"||mt==="commit")&&De.length!==3)throw new Error(e("taskHome.review.usage"));await p({projectPath:Ne,kind:mt,...De[2]?{ref:De[2]}:{},modelId:S.modelId??B??void 0});return}if(S.content.trimStart().startsWith("!")){x(Ne),await g({content:S.content,attachments:[]});return}await m({prompt:S.content,projectPath:Ne,isolation:F,permissionMode:P,modelId:S.modelId??B??void 0,reasoningEffort:S.reasoningEffort,serviceTier:S.serviceTier,responseVerbosity:S.responseVerbosity,communicationStyle:S.communicationStyle,...S.outputSchema?{outputSchema:S.outputSchema}:{},attachments:S.attachments.map(De=>({type:"image",content:De.dataUrl,mimeType:De.mimeType,name:De.name}))})},[P,B,m,F,g,p,x,Ne,e]);return w.useEffect(()=>{const S=Y=>{if(!(Y.metaKey||Y.ctrlKey))return;const De=Number.parseInt(Y.key,10);if(Number.isNaN(De)||De<1||De>pc.length)return;const mt=pc[De-1];mt&&(Y.preventDefault(),Ee({key:Oe,content:mt.prompt}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Oe]),c.jsx("main",{className:"deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]",children:c.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10",children:[c.jsxs("div",{className:"flex gap-4 items-start mb-6",children:[c.jsx(ou,{size:36,className:"hidden mt-1 sm:inline-flex"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:W("deck-eyebrow flex items-center gap-2",$==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[$==="offline"?c.jsx(Iu,{className:"w-3 h-3"}):c.jsx("span",{className:"deck-pulse-dot"}),Z]}),c.jsxs("h1",{className:"mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]",children:[e("taskHome.hero.prefix")," ",c.jsx("span",{className:"whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]",children:Rn.project}),c.jsx("span",{className:"text-[hsl(var(--deck-ink-muted))]",children:"?"})]}),c.jsx("p",{className:"mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]",children:e("taskHome.hero.subtitle")})]})]}),c.jsxs("div",{className:"mb-4",children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.templates.title")}),c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Hf,{className:"w-3 h-3"}),c.jsx("span",{children:e("taskHome.templates.hint")})]})]}),c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:pc.map((S,Y)=>c.jsx(F_,{index:Y,title:e(S.titleKey),description:e(S.descriptionKey),icon:S.icon,hint:e(S.hintKey),onClick:()=>Ee({key:Oe,content:S.prompt})},S.key))})]}),c.jsxs("div",{className:"rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]",children:[c.jsxs("div",{className:"flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50",children:[c.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[c.jsxs(Gn,{children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button","aria-label":e("taskHome.context.projectSelect"),disabled:i.length===0,className:"group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50",children:[c.jsx(uo,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"font-medium truncate",children:(_==null?void 0:_.name)??Rn.project}),c.jsx(Ss,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),c.jsx(Mn,{align:"start",sideOffset:4,className:"w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl",children:c.jsxs("div",{className:"flex flex-col",children:[i.map(S=>c.jsxs("button",{type:"button",disabled:!S.available,onClick:()=>{d(S.path)},className:W("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",S.path===a?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",!S.available&&"opacity-40"),children:[c.jsx(uo,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0 truncate",children:S.name}),S.path===a&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},S.path)),i.length===0&&c.jsx("span",{className:"px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.workspace.empty")})]})})]}),c.jsxs("button",{type:"button","aria-pressed":F==="worktree",onClick:()=>me(S=>S==="worktree"?"local":"worktree"),className:W("flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors",F==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[F==="worktree"?c.jsx(NS,{className:"w-3 h-3"}):c.jsx(OS,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:e(F==="worktree"?"taskHome.context.isolation.worktree":"taskHome.context.isolation.local")})]}),c.jsxs("span",{className:"flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(el,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:Rn.branch})]})]}),c.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&c.jsx(ly,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),s&&c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]",children:[c.jsx(lt,{className:"w-3 h-3 animate-spin"}),c.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!an&&c.jsxs("section",{"aria-label":e("taskHome.setup.aria"),className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3",children:[c.jsxs("div",{className:"mb-2.5",children:[c.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.title")}),c.jsx("p",{className:"mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.description")})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex justify-center items-center w-7 h-7 rounded-md border shrink-0",Xe?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":Sn?"text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:on?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):Xe?c.jsx(Cu,{className:"h-3.5 w-3.5"}):Sn?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(uo,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.workspace.title")}),c.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:on?e("taskHome.setup.workspace.loading"):Sn||(Xe?e("taskHome.setup.workspace.ready",{project:Rn.project}):e("taskHome.setup.workspace.required"))})]}),!Xe&&c.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[Sn&&c.jsx("button",{type:"button",onClick:()=>{Promise.all([O(),R()])},"aria-label":e("taskHome.setup.workspace.retry"),title:e("taskHome.setup.workspace.retry"),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:"h-3.5 w-3.5"})}),c.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>U(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(Oi,{className:"w-3 h-3"}),e("taskHome.setup.workspace.action")]})]})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",qn&&!ce?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":ce?"border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:ft?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):qn&&!ce?c.jsx(Cu,{className:"h-3.5 w-3.5"}):ce?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(ju,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.model.title")}),c.jsx("span",{title:ce??void 0,className:W("mt-0.5 block truncate text-[10.5px]",ce?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:ft?e("taskHome.setup.model.loading"):ce||e(qn?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!ft&&(!qn||ce)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{ce?Fe(Ne):K("models")},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[ce?c.jsx(lo,{className:"w-3 h-3"}):c.jsx(ju,{className:"w-3 h-3"}),e(ce?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(N_,{variant:"task",draft:(Se==null?void 0:Se.key)===Oe?Se.content:void 0,draftKey:Oe,placeholder:e("taskHome.composer.placeholder"),onSend:async S=>{try{return await _t(S),Ee(void 0),!0}catch{return!1}},disabled:s,submitDisabled:!an,shellSubmitDisabled:!an,workspacePath:Ne},Oe)})]}),$==="offline"&&c.jsxs("div",{role:"alert",className:"flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200",children:[c.jsx(Iu,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 text-[12px]",children:e("taskHome.feed.offlineDescription")}),c.jsxs("button",{type:"button",onClick:()=>void T().catch(()=>{}),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"w-3 h-3"}),e("taskHome.feed.retry")]})]}),l&&c.jsxs("div",{role:"alert",className:"flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx("span",{children:l}),c.jsx("button",{type:"button",onClick:C,className:"underline",children:e("taskHome.error.dismiss")})]}),c.jsx(M_,{sessions:Ge,catalogLoadState:Q,cancellingTaskKeys:j,retryingTaskKeys:A,unreadTaskKeys:N,onSelect:S=>{b(pe(S))},onCancel:S=>{y(pe(S)).catch(()=>{})},onRetry:S=>{k(pe(S)).catch(()=>{})}}),c.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Bf,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(ky,{open:Pe,onOpenChange:U})]})})}const Yc="blade.sessions.last",Ji="session",Xc="project",Zc="workspace";function L_(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.sessionId=="string"&&t.sessionId.trim()&&typeof t.projectPath=="string"&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function U_(e){var o,i,a;const t=new URLSearchParams(e),n=((o=t.get(Ji))==null?void 0:o.trim())||null,r=((i=t.get(Xc))==null?void 0:i.trim())||null,s=((a=t.get(Zc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Ji)}}function B_(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(Yc);return t?L_(JSON.parse(t)):null}catch{return null}}function H_(e,t,n={}){const r=n.href??(typeof window>"u"?"http://localhost/":window.location.href),s=new URL(r),o=n.displayProjectPath??(e==null?void 0:e.projectPath)??t,i=(e==null?void 0:e.projectPath)??null;e?s.searchParams.set(Ji,e.sessionId):s.searchParams.delete(Ji),o?s.searchParams.set(Xc,o):s.searchParams.delete(Xc),i&&o&&i!==o?s.searchParams.set(Zc,i):s.searchParams.delete(Zc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(Yc,JSON.stringify(e)):a==null||a.removeItem(Yc)}catch{}const l=`${s.pathname}${s.search}${s.hash}`,d=n.replaceState??(typeof window>"u"?void 0:m=>window.history.replaceState(null,"",m));return d==null||d(l),l}const q_=w.lazy(()=>Io(()=>import("./ChatView-DG6MMrFK.js"),__vite__mapDeps([9,1,3,2])).then(e=>({default:e.ChatView})));function z_(){const e=Ft(),[t,n]=w.useState(!1),r=L(A=>A.subscribeToTaskEvents),s=L(A=>A.unsubscribeFromTaskEvents),o=L(A=>A.currentSessionRef),i=L(A=>A.isTemporarySession),a=L(A=>A.loadTaskWorkspaceInfo),l=L(A=>A.loadBoundProjects),d=L(A=>A.loadSessions),m=L(A=>A.selectSession),p=L(A=>A.selectProject),g=L(A=>A.startTemporarySession),x=L(A=>A.setError),b=L(A=>A.sessions),y=L(A=>A.selectedProjectPath),j=Pt(A=>A.loadModels),k=vo(A=>A.loadSettings);return w.useEffect(()=>(r().catch(A=>{console.error("Failed to subscribe to task events",A)}),s),[r,s]),w.useEffect(()=>{let A=!1;return(async()=>{var X;d(),k(),j();const $=U_(window.location.search),Q=B_(),T=$.hasSessionParam?$.sessionRef:$.projectPath?null:Q,C=Promise.all([a(),l()]),O=!T&&!$.projectPath;if(O&&(g(),n(!0)),await C,A)return;const R=L.getState(),K=$.projectPath?(X=R.boundProjects.find(P=>P.path===$.projectPath&&P.available))==null?void 0:X.path:null;if(K&&p(K),!(T&&(await m(T),A))){if(!T||!oe(L.getState().currentSessionRef,T)){const P=T?L.getState().error:null;g(),P&&x(P)}O||n(!0)}})(),()=>{A=!0}},[l,j,d,k,a,p,m,x,g]),w.useEffect(()=>{if(!t)return;const A=o?eu(b,o):void 0;H_(o,y,{displayProjectPath:A?fi(A,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(p_,{}),c.jsx(m_,{children:t?!o||i?c.jsx(__,{}):c.jsx(w.Suspense,{fallback:c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:c.jsx(q_,{})}):c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")})})]})}Zy.createRoot(document.getElementById("root")).render(c.jsx(oo.StrictMode,{children:c.jsx(z_,{})}));export{Pt as A,ou as B,N_ as C,ol as D,I5 as E,vo as F,D5 as G,iu as H,ho as I,fi as J,dy as K,qc as L,He as M,Vc as N,Y_ as O,Gn as P,cf as Q,br as R,su as S,Q_ as T,Io as _,L as a,kr as b,pe as c,ze as d,Yi as e,il as f,Xi as g,Zi as h,Xf as i,W as j,re as k,JD as l,Zn as m,Fa as n,Pi as o,v0 as p,eu as q,p2 as r,oe as s,sy as t,Ft as u,vf as v,pr as w,by as x,Vn as y,Mn as z};
|