blade-code 0.10.4 → 0.10.5

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.
Files changed (53) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/chunk-069zpw09.js +6 -0
  3. package/dist/{chunk-xq8vf15n.js → chunk-19kg7yvw.js} +1 -1
  4. package/dist/{chunk-9kwt0w46.js → chunk-1m5r6mp2.js} +1 -1
  5. package/dist/{chunk-jbnrscvz.js → chunk-1q21sxhx.js} +1 -1
  6. package/dist/{chunk-kkd7mm55.js → chunk-1r6szcrj.js} +1 -1
  7. package/dist/{chunk-nr53mq0k.js → chunk-1vx4sf1y.js} +1 -1
  8. package/dist/{chunk-d7xb0vp1.js → chunk-1x4fpe47.js} +1 -1
  9. package/dist/{chunk-d4zw0xxe.js → chunk-2nkd1kjx.js} +1 -1
  10. package/dist/chunk-417wefq7.js +99 -0
  11. package/dist/{chunk-5t0vs4hz.js → chunk-51wtvmzn.js} +2 -2
  12. package/dist/{chunk-a7a74pza.js → chunk-62881c2s.js} +93 -93
  13. package/dist/{chunk-ffp3ypbb.js → chunk-6eragc74.js} +1 -1
  14. package/dist/{chunk-n2s54h1r.js → chunk-7jy60gnx.js} +1 -1
  15. package/dist/{chunk-1ndryz4h.js → chunk-am8dtvff.js} +1 -1
  16. package/dist/chunk-c5tds5v0.js +9 -0
  17. package/dist/{chunk-f647z66n.js → chunk-f6mszdsd.js} +1 -1
  18. package/dist/{chunk-rv80ak15.js → chunk-fz1vyc15.js} +1 -1
  19. package/dist/chunk-hh85pk77.js +160 -0
  20. package/dist/{chunk-ve9cke2g.js → chunk-njyvrtje.js} +2 -2
  21. package/dist/{chunk-wdbmbk6h.js → chunk-nz78b5c5.js} +1 -1
  22. package/dist/chunk-r1764q6f.js +1 -0
  23. package/dist/chunk-r6mwyg3h.js +3 -0
  24. package/dist/{chunk-csr5vppa.js → chunk-rh7v814a.js} +1 -1
  25. package/dist/chunk-rzzt21ef.js +22 -0
  26. package/dist/{chunk-mxqpg4gy.js → chunk-s645azsm.js} +1 -1
  27. package/dist/{chunk-b9v7waxf.js → chunk-sanhjqpd.js} +1 -1
  28. package/dist/{chunk-tx8f345j.js → chunk-tjnfhm9v.js} +1 -1
  29. package/dist/{chunk-pehpndk9.js → chunk-v0ygsjry.js} +1 -1
  30. package/dist/{chunk-age5tc86.js → chunk-vntzy7bc.js} +1 -1
  31. package/dist/{chunk-vxymgh8e.js → chunk-vpj0sv73.js} +1 -1
  32. package/dist/{chunk-90fnvvcf.js → chunk-xv0maezy.js} +1 -1
  33. package/dist/{chunk-fx87s3mb.js → chunk-yc53wz4r.js} +1 -1
  34. package/dist/web/assets/{ChatView-iK7ff8qU.js → ChatView-Y-6k-ayR.js} +2 -2
  35. package/dist/web/assets/{CodeBlockHighlighter-BoJp_Xb0.js → CodeBlockHighlighter-CFW6qjnA.js} +1 -1
  36. package/dist/web/assets/{FilePreview-Bi1HWOvY.js → FilePreview-CR_XetY0.js} +1 -1
  37. package/dist/web/assets/{MarkdownRenderer-DMW1pg5N.js → MarkdownRenderer-CVrxJswQ.js} +3 -3
  38. package/dist/web/assets/{McpModal-CHUqitJ6.js → McpModal-BO-85gll.js} +1 -1
  39. package/dist/web/assets/{SettingsModal-zsS9O6SW.js → SettingsModal-CW87OnxI.js} +1 -1
  40. package/dist/web/assets/{SkillsModal-C2oTDXoy.js → SkillsModal-Q8ZFPhys.js} +1 -1
  41. package/dist/web/assets/{TaskSwitcher-CncVasNA.js → TaskSwitcher-BzH-0QXr.js} +1 -1
  42. package/dist/web/assets/{TerminalPanel-CBi2mUxx.js → TerminalPanel-DTqvx8yB.js} +1 -1
  43. package/dist/web/assets/index-ClOgGy-I.js +32 -0
  44. package/dist/web/index.html +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-5ze48kg7.js +0 -22
  47. package/dist/chunk-d5a66cgn.js +0 -160
  48. package/dist/chunk-scq3ns6v.js +0 -99
  49. package/dist/chunk-v8kp3ep9.js +0 -6
  50. package/dist/chunk-xkzy5wbm.js +0 -9
  51. package/dist/chunk-ys8bp9jm.js +0 -1
  52. package/dist/chunk-zswrw5f9.js +0 -3
  53. package/dist/web/assets/index-DvDtvgA4.js +0 -32
@@ -1,32 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-zsS9O6SW.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-icons-D_AkWmWB.js","assets/vendor-radix-DBy9B2DN.js","assets/McpModal-CHUqitJ6.js","assets/useRequest-BvqVDnKl.js","assets/SkillsModal-C2oTDXoy.js","assets/TaskSwitcher-CncVasNA.js","assets/FilePreview-Bi1HWOvY.js","assets/TerminalPanel-CBi2mUxx.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/ChatView-iK7ff8qU.js"])))=>i.map(i=>d[i]);
2
- var Ay=Object.defineProperty;var Py=(e,t,n)=>t in e?Ay(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ua=(e,t,n)=>Py(e,typeof t!="symbol"?t+"":t,n);import{r as S,j as c,c as Xs,d as Ny}from"./vendor-react-DG5dkZ_t.js";import{S as $y,O as ff,P as Ry,C as mf,a as My,T as pf,D as gf,R as Oy,b as hf,V as Fy,c as _y,d as bf,e as Dy,f as Ly,g as xf,h as Uy,i as By}from"./vendor-radix-DBy9B2DN.js";import{X as to,H as ad,L as ct,F as qy,R as Bi,A as kf,a as no,D as yf,b as Hy,c as vi,d as Ky,e as ro,G as Uc,T as Sf,C as wf,f as lo,S as Bc,M as zy,g as Gy,P as Vy,h as vf,i as qc,j as If,k as Hc,l as Wy,m as Jy,n as Qy,o as jf,p as Yy,q as Xy,r as Cf,s as cd,t as Zy,u as e0,v as Tf,w as t0,I as n0,x as ld,y as hs,z as r0,B as s0,W as ud,E as o0,J as i0,K as a0,N as c0,O as l0,Q as dd,U as fd}from"./vendor-icons-D_AkWmWB.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 u0="modulepreload",d0=function(e){return"/"+e},md={},Vr=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=d0(l),l in md)return;md[l]=!0;const u=l.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":u0,u||(p.as="script"),p.crossOrigin="",p.href=l,a&&p.setAttribute("nonce",a),document.head.appendChild(p),u)return new Promise((g,k)=>{p.addEventListener("load",g),p.addEventListener("error",()=>k(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 Ef(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=Ef(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Af(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Ef(e))&&(r&&(r+=" "),r+=t);return r}const pd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,gd=Af,f0=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return gd(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(u=>{const f=n==null?void 0:n[u],p=o==null?void 0:o[u];if(f===null)return null;const g=pd(f)||pd(p);return s[u][g]}),a=n&&Object.entries(n).reduce((u,f)=>{let[p,g]=f;return g===void 0||(u[p]=g),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,f)=>{let{class:p,className:g,...k}=f;return Object.entries(k).every(b=>{let[y,j]=b;return Array.isArray(j)?j.includes({...o,...a}[y]):{...o,...a}[y]===j})?[...u,p,g]:u},[]);return gd(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},Kc="-",m0=e=>{const t=g0(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Kc);return a[0]===""&&a.length!==1&&a.shift(),Pf(a,t)||p0(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},Pf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Pf(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(Kc);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},hd=/^\[(.+)\]$/,p0=e=>{if(hd.test(e)){const t=hd.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},g0=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return b0(Object.entries(e.classGroups),n).forEach(([o,i])=>{rc(i,r,o,t)}),r},rc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:bd(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(h0(s)){rc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{rc(i,bd(t,o),n,r)})})},bd=(e,t)=>{let n=e;return t.split(Kc).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},h0=e=>e.isThemeGetter,b0=(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,x0=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)}}},Nf="!",k0=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let u=0,f=0,p;for(let j=0;j<a.length;j++){let x=a[j];if(u===0){if(x===s&&(r||a.slice(j,j+o)===t)){l.push(a.slice(f,j)),f=j+o;continue}if(x==="/"){p=j;continue}}x==="["?u++:x==="]"&&u--}const g=l.length===0?a:a.substring(f),k=g.startsWith(Nf),b=k?g.substring(1):g,y=p&&p>f?p-f:void 0;return{modifiers:l,hasImportantModifier:k,baseClassName:b,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:i}):i},y0=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},S0=e=>({cache:x0(e.cacheSize),parseClassName:k0(e),...m0(e)}),w0=/\s+/,v0=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(w0);let a="";for(let l=i.length-1;l>=0;l-=1){const u=i[l],{modifiers:f,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:k}=n(u);let b=!!k,y=r(b?g.substring(0,k):g);if(!y){if(!b){a=u+(a.length>0?" "+a:a);continue}if(y=r(g),!y){a=u+(a.length>0?" "+a:a);continue}b=!1}const j=y0(f).join(":"),x=p?j+Nf:j,I=x+y;if(o.includes(I))continue;o.push(I);const N=s(y,b);for(let F=0;F<N.length;++F){const M=N[F];o.push(x+M)}a=u+(a.length>0?" "+a:a)}return a};function I0(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=$f(t))&&(r&&(r+=" "),r+=n);return r}const $f=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=$f(e[r]))&&(n&&(n+=" "),n+=t);return n};function j0(e,...t){let n,r,s,o=i;function i(l){const u=t.reduce((f,p)=>p(f),e());return n=S0(u),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const u=r(l);if(u)return u;const f=v0(l,n);return s(l,f),f}return function(){return o(I0.apply(null,arguments))}}const Je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Rf=/^\[(?:([a-z-]+):)?(.+)\]$/i,C0=/^\d+\/\d+$/,T0=new Set(["px","full","screen"]),E0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,A0=/\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$/,P0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,N0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dn=e=>Ss(e)||T0.has(e)||C0.test(e),or=e=>Is(e,"length",U0),Ss=e=>!!e&&!Number.isNaN(Number(e)),Ba=e=>Is(e,"number",Ss),Vs=e=>!!e&&Number.isInteger(Number(e)),R0=e=>e.endsWith("%")&&Ss(e.slice(0,-1)),ae=e=>Rf.test(e),ir=e=>E0.test(e),M0=new Set(["length","size","percentage"]),O0=e=>Is(e,M0,Mf),F0=e=>Is(e,"position",Mf),_0=new Set(["image","url"]),D0=e=>Is(e,_0,q0),L0=e=>Is(e,"",B0),Ws=()=>!0,Is=(e,t,n)=>{const r=Rf.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},U0=e=>A0.test(e)&&!P0.test(e),Mf=()=>!1,B0=e=>N0.test(e),q0=e=>$0.test(e),H0=()=>{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"),u=Je("grayscale"),f=Je("hueRotate"),p=Je("invert"),g=Je("gap"),k=Je("gradientColorStops"),b=Je("gradientColorStopPositions"),y=Je("inset"),j=Je("margin"),x=Je("opacity"),I=Je("padding"),N=Je("saturate"),F=Je("scale"),M=Je("sepia"),R=Je("skew"),P=Je("space"),$=Je("translate"),A=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],Z=()=>["auto",ae,t],E=()=>[ae,t],q=()=>["",Dn,or],K=()=>["auto",Ss,ae],me=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],X=()=>["solid","dashed","dotted","double","none"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Pe=()=>["start","end","center","between","around","evenly","stretch"],Ee=()=>["","0",ae],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],se=()=>[Ss,ae];return{cacheSize:500,separator:":",theme:{colors:[Ws],spacing:[Dn,or],blur:["none","",ir,ae],brightness:se(),borderColor:[e],borderRadius:["none","","full",ir,ae],borderSpacing:E(),borderWidth:q(),contrast:se(),grayscale:Ee(),hueRotate:se(),invert:Ee(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[R0,or],inset:Z(),margin:Z(),opacity:se(),padding:E(),saturate:se(),scale:se(),sepia:Ee(),skew:se(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",ae]}],container:["container"],columns:[{columns:[ir]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"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:[...me(),ae]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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",Vs,ae]}],basis:[{basis:Z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ae]}],grow:[{grow:Ee()}],shrink:[{shrink:Ee()}],order:[{order:["first","last","none",Vs,ae]}],"grid-cols":[{"grid-cols":[Ws]}],"col-start-end":[{col:["auto",{span:["full",Vs,ae]},ae]}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":[Ws]}],"row-start-end":[{row:["auto",{span:[Vs,ae]},ae]}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ae]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ae]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...Pe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Pe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Pe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],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":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ae,t]}],"min-w":[{"min-w":[ae,t,"min","max","fit"]}],"max-w":[{"max-w":[ae,t,"none","full","min","max","fit","prose",{screen:[ir]},ir]}],h:[{h:[ae,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ae,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ae,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ae,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ir,or]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ba]}],"font-family":[{font:[Ws]}],"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",ae]}],"line-clamp":[{"line-clamp":["none",Ss,Ba]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Dn,ae]}],"list-image":[{"list-image":["none",ae]}],"list-style-type":[{list:["none","disc","decimal",ae]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Dn,or]}],"underline-offset":[{"underline-offset":["auto",Dn,ae]}],"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:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae]}],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",ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...me(),F0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",O0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},D0]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],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":[x]}],"border-style":[{border:[...X(),"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":[x]}],"divide-style":[{divide:X()}],"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:["",...X()]}],"outline-offset":[{"outline-offset":[Dn,ae]}],"outline-w":[{outline:[Dn,or]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Dn,or]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ir,L0]}],"shadow-color":[{shadow:[Ws]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":pe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ir,ae]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[p]}],saturate:[{saturate:[N]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"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",ae]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",ae]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ae]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[Vs,ae]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ae]}],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",ae]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",ae]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Dn,or,Ba]}],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"]}}},K0=j0(H0);function W(...e){return K0(Af(e))}const z0=f0("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"}}),mr=S.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?$y:"button";return c.jsx(i,{className:W(z0({variant:t,size:n,className:e})),ref:o,...s})});mr.displayName="Button";const zc=Oy,G0=Ry,Of=S.forwardRef(({className:e,...t},n)=>c.jsx(ff,{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}));Of.displayName=ff.displayName;const qi=S.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>c.jsxs(G0,{children:[c.jsx(Of,{}),c.jsxs(mf,{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(My,{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(to,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qi.displayName=mf.displayName;const Gc=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Gc.displayName="DialogHeader";const Ff=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ff.displayName="DialogFooter";const Hi=S.forwardRef(({className:e,...t},n)=>c.jsx(pf,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));Hi.displayName=pf.displayName;const Ki=S.forwardRef(({className:e,...t},n)=>c.jsx(gf,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Ki.displayName=gf.displayName;function ft(e,t){return{...e,...t}}function _r(e,t,n){return e>=t&&e<=n}function V0(e){return e===8205}function W0(e){return _r(e,55296,56319)}function xd(e){return _r(e,127462,127487)}function _f(e){return _r(e,65024,65039)}function Df(e){return _r(e,768,879)||_r(e,6832,6911)||_r(e,7616,7679)||_r(e,65056,65071)}function hi(e){return e>65535?2:1}function kd(e,t){for(;t<e.length;){const n=e.codePointAt(t);if(Df(n)||_f(n))t+=hi(n);else break}return t}function Vc(e,t){const n=e.codePointAt(t);let r=t+hi(n);for(r=kd(e,r);r<e.length-1&&e[r]==="‍";){const s=e.codePointAt(r+1);r+=1+hi(s),r=kd(e,r)}return xd(n)&&r<e.length&&xd(e.codePointAt(r))&&(r+=hi(e.codePointAt(r))),r}function Lf(e){return W0(e)||Df(e)||_f(e)||V0(e)}function J0(e){let t=0,n=0;for(;n<e.length;)n=Vc(e,n),t++;return t}function Q0(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Vc(e,r),n++,n>=t)return!0;return!1}function Y0(e,t){let n=0,r=0;for(;r<e.length;)if(r=Vc(e,r),n++,n>t)return!1;return!0}function X0(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Lf(e.charCodeAt(n)))return Q0(e,t);if(n++,n>=t)return!0}return!1}function Z0(e,t){let n=0;for(;n<e.length;){if(Lf(e.charCodeAt(n)))return Y0(e,t);if(n++,n>t)return!1}return!0}function z(e){return Array.isArray(e)}function et(e){return h(typeof e,"bigint")}function mt(e){return h(typeof e,"boolean")}function zi(e){if(Oe(e)||!kn(e))return!1;const t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function kn(e){return h(typeof e,"function")}function Wc(e){return Number.isInteger(e)}function Kt(e){return h(e,null)}function ve(e){return Number.isFinite(e)}function cn(e){return re(e)&&!z(e)}function re(e){return h(typeof e,"object")&&!Kt(e)}function oe(e){return h(typeof e,"string")}function Jc(e){return h(typeof e,"symbol")}function Oe(e){return h(e,void 0)}function h(e,t){return e===t}function Wr(e,t){return e>t}function xo(e,t){return e<t}function Jn(e,t){return e<=t}function js(e,t){return e>=t}function Uf(e,t){if(et(e)||et(t))return BigInt(e)%BigInt(t)===0n;const n=1e-10;if(!ve(e)||Wc(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 Bf(e){if(!re(e))return!1;const t=globalThis.Object.getPrototypeOf(e);return Kt(t)?!1:h(typeof t.constructor,"function")&&!(h(t.constructor,globalThis.Object)||h(t.constructor.name,"Object"))}function Cs(e){return et(e)||mt(e)||Kt(e)||ve(e)||oe(e)||Oe(e)}function eS(e){return J0(e)}function qf(e,t){return Z0(e,t)}function Hf(e,t){return X0(e,t)}function lt(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 Ts(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function Kf(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function Qc(e,t){return e.reduce((n,r,s)=>t(r,s)?++n:n,0)}function Te(e,t,n){return h(e.length,0)?n():t(e[0],e.slice(1))}function qn(e){return h(e,"__proto__")||h(e,"constructor")||h(e,"prototype")}function C(e,t){return qn(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Yc(e){return D(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tt(e){return Object.entries(e)}function D(e){return Object.getOwnPropertyNames(e)}function Xc(e){return Object.getOwnPropertySymbols(e)}function Zc(e){return Object.values(e)}function tS(e,t){if(!re(t))return!1;const n=D(e);return h(n.length,D(t).length)&&n.every(r=>Jr(e[r],t[r]))}function nS(e,t){return z(t)&&h(e.length,t.length)&&e.every((n,r)=>Jr(e[r],t[r]))}function Jr(e,t){return z(e)?nS(e,t):re(e)?tS(e,t):h(e,t)}const Ii=Object.freeze(Object.defineProperty({__proto__:null,Counted:Qc,Entries:tt,EntriesRegExp:Yc,Every:lt,EveryAll:jt,GraphemeCount:eS,HasPropertyKey:C,IsArray:z,IsBigInt:et,IsBoolean:mt,IsClassInstance:Bf,IsConstructor:zi,IsDeepEqual:Jr,IsEqual:h,IsFunction:kn,IsGreaterEqualThan:js,IsGreaterThan:Wr,IsInteger:Wc,IsLessEqualThan:Jn,IsLessThan:xo,IsMaxLength:qf,IsMinLength:Hf,IsMultipleOf:Uf,IsNull:Kt,IsNumber:ve,IsObject:re,IsObjectNotArray:cn,IsString:oe,IsSymbol:Jc,IsUndefined:Oe,IsUnsafePropertyKey:qn,IsValueLike:Cs,Keys:D,ShiftLeft:Te,Some:Ts,SomeAll:Kf,Symbols:Xc,Values:Zc},Symbol.toStringTag,{value:"Module"})),rS=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function sS(e){return rS.test(e)}function yt(e,t){return`(${e} && ${t})`}function He(e,t){return`(${e} || ${t})`}function At(e){return`!(${e})`}function ji(e){return`Array.isArray(${e})`}function zf(e){return`typeof ${e} === "bigint"`}function oS(e){return`typeof ${e} === "boolean"`}function iS(e){return`Number.isInteger(${e})`}function aS(e){return`${e} === null`}function Gf(e){return`Number.isFinite(${e})`}function Vf(e){return yt(Wf(e),At(ji(e)))}function Wf(e){return`typeof ${e} === "object" && ${e} !== null`}function Jf(e){return`typeof ${e} === "string"`}function cS(e){return`typeof ${e} === "symbol"`}function sc(e){return`${e} === undefined`}function lS(e){return`typeof ${e} === "function"`}function uS(e){return`Guard.IsConstructor(${e})`}function Ht(e,t){return`${e} === ${t}`}function Qf(e,t){return`${e} > ${t}`}function el(e,t){return`${e} < ${t}`}function Qr(e,t){return`${e} <= ${t}`}function ko(e,t){return`${e} >= ${t}`}function dS(e,t){return`Guard.IsMinLength(${e}, ${t})`}function fS(e,t){return`Guard.IsMaxLength(${e}, ${t})`}function Nn(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 mS(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function pS(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 Gi(e,t,n){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${n}) ? ++result : result, 0)`}function Yf(e){return`Object.entries(${e})`}function Yr(e){return`Object.getOwnPropertyNames(${e})`}function Br(e,t){return h(t,'"__proto__"')||h(t,'"constructor"')?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function Xf(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function gS(e){return`[${e.join(", ")}]`}function gr(e,t){return`((${e.join(", ")}) => ${t})`}function ze(e,t){return`${e}(${t.join(", ")})`}function tl(e,t){return`new ${e}(${t.join(", ")})`}function le(e,t){return`${e}${sS(t)?`.${t}`:`[${G(t)}]`}`}function G(e){if(!Cs(e))throw Error("Unsupported Constant");return oe(e)?JSON.stringify(e):`${e}`}function hS(e,t,n){return`(${e} ? ${t} : ${n})`}function Vi(e){return`{ ${e.join("; ")}; }`}function Hn(e,t){return`const ${e} = ${t}`}function Zf(e,t){return`if(${e}) { ${t} }`}function Wi(e){return`return ${e}`}function vt(e){return h(e.length,0)?"true":e.reduce((t,n)=>yt(t,n))}function nl(e){return h(e.length,0)?"false":e.reduce((t,n)=>He(t,n))}function bS(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function xS(e){return e instanceof Boolean}function kS(e){return e instanceof Number}function yS(e){return e instanceof String}function yo(e){return globalThis.ArrayBuffer.isView(e)}function em(e){return e instanceof globalThis.RegExp}function tm(e){return e instanceof globalThis.Date}function nm(e){return e instanceof globalThis.Set}function rm(e){return e instanceof globalThis.Map}function SS(e){return C(e,"~kind")||C(e,"~unsafe")}function wS(e){const t={},n=Object.getOwnPropertyDescriptors(e);for(const r of Object.keys(n)){if(qn(r))continue;const s=n[r];C(s,"value")&&Object.defineProperty(t,r,{...s,value:qr(s.value)})}return t}function vS(e){const t={};for(const n of D(e))qn(n)||(t[n]=qr(e[n]));for(const n of Xc(e))t[n]=qr(e[n]);return t}function IS(e){return Bf(e)?e:SS(e)?wS(e):vS(e)}function jS(e){return e.map(t=>qr(t))}function CS(e){return e.slice()}function TS(e){return new RegExp(e.source,e.flags)}function ES(e){return new Map(qr([...e.entries()]))}function AS(e){return new Set(qr([...e.values()]))}function qr(e){return yo(e)?CS(e):em(e)?TS(e):rm(e)?ES(e):nm(e)?AS(e):z(e)?jS(e):re(e)?IS(e):e}function rl(e){return qr(e)}const PS={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function So(){return PS}function NS(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 $S(e,t){return{...e,...t}}function ye(e,t,n={}){const r=$S(t,n);return NS(r,e)}function jn(e,t){const n={},r=Object.getOwnPropertyDescriptors(rl(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=So(),s=rl(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 Ie(e,t){return re(e)&&C(e,"~kind")&&h(e["~kind"],t)}function Wt(e){return re(e)}function Ae(e,t,n){return ye({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ws(e){return Ie(e,"Deferred")}function RS(e){return ue(e,{"~readonly":!0},{})}function sl(e,t){return ue(RS(e),{},t)}function MS(e,t,n,r){const s=V(e,t,n);return sl(s,r)}function OS(e){return ue(e,{"~optional":!0},{})}function ol(e,t){return ue(OS(e),{},t)}function FS(e,t,n,r){const s=V(e,t,n);return ol(s,r)}function Sr(e,t){return ye({"~kind":"Array"},{type:"array",items:e},t)}function ut(e){return Ie(e,"Array")}function il(e){return jn(e,["~kind","type","items"])}function wo(e,t,n={}){return ye({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ln(e){return Ie(e,"Constructor")}function _S(e){return jn(e,["~kind","type","parameters","instanceType"])}function vo(e,t,n={}){return ye({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function un(e){return Ie(e,"Function")}function DS(e){return jn(e,["~kind","type","parameters","returnType"])}function on(e,t){return ye({"~kind":"Ref"},{$ref:e},t)}function ht(e){return Ie(e,"Ref")}function Io(e,t){return ye({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function al(e){return Ie(e,"Generic")}function cl(e){return ye({"~kind":"Any"},{},e)}function Cn(e){return Ie(e,"Any")}const LS="(?!)";function Ct(e){return ye({"~kind":"Never"},{not:{}},e)}function Es(e){return Ie(e,"Never")}function Gn(e,t={}){return Ae("AddOptional",[e],t)}function Ci(e,t={}){return ol(e,t)}function US(e){return Ci(e)}function Jt(e){return Wt(e)&&C(e,"~optional")}function BS(e){return D(e).filter(t=>!Jt(e[t]))}function sm(e){return D(e)}function om(e){return Zc(e)}function $e(e,t={}){const n=BS(e),r=n.length>0?{required:n}:{};return ye({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Le(e){return Ie(e,"Object")}function qS(e){return jn(e,["~kind","type","properties","required"])}function _t(e){return ye({"~kind":"Unknown"},{},e)}function yn(e){return Ie(e,"Unknown")}function jo(e,t,n){const r=D(e).reduce((s,o)=>({...s,[o]:ue(e[o],{},{$id:o})}),{});return ye({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function Dt(e){return Ie(e,"Cyclic")}function HS(e){return ue(e,{"~unsafe":null},{})}function im(e){return cn(e)&&C(e,"~unsafe")&&Kt(e["~unsafe"])}function at(e,t){var n;return((n=t[e.length])==null?void 0:n.call(t,...e))??(()=>{throw Error("Invalid Arguments")})()}function oc(...e){const[t,n]=at(e,{2:(r,s)=>[r,s,s],1:r=>[r,_t(),_t()]});return ye({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Qt(e){return Ie(e,"Infer")}function Ti(e,t,n,r={}){return ye({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function dn(e){return Ie(e,"Dependent")}function KS(e){return jn(e,["~kind","if","then","else"])}function zS(e){return cn(e)}function GS(e){return D(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function VS(e){return oe(e)||ve(e)}function WS(e,t){const n=zS(e)?GS(e):e;return ye({"~kind":"Enum"},{enum:n},t)}function fn(e){return Ie(e,"Enum")}function Pn(e,t={}){return ye({"~kind":"Intersect"},{allOf:e},t)}function Ue(e){return Ie(e,"Intersect")}function JS(e){return jn(e,["~kind","allOf"])}let qa;function QS(){try{return cm("null")(),!0}catch{return!1}}function am(){return Oe(qa)&&(qa=QS()),qa&&So().useAcceleration}function cm(...e){return new globalThis.Function(...e)}function Pt(){throw new Error("Unreachable")}function YS(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 XS(e){return typeof e=="number"}var Nt;(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"})(Nt||(Nt={}));let xs=BigInt("14695981039346656037");const[ZS,ew]=[BigInt("1099511628211"),BigInt("18446744073709551616")],tw=Array.from({length:256}).map((e,t)=>BigInt(t)),lm=new Float64Array(1),um=new DataView(lm.buffer),dm=new Uint8Array(lm.buffer);function bt(e){xs=xs^tw[e],xs=xs*ZS%ew}function nw(e){bt(Nt.Array);for(const t of e)hr(t)}function rw(e){bt(Nt.BigInt),um.setBigInt64(0,e);for(const t of dm)bt(t)}function yd(e){bt(Nt.Boolean),bt(e?1:0)}function sw(e){bt(Nt.Constructor),hr(e.toString())}function ow(e){bt(Nt.Date),hr(e.getTime())}function iw(e){bt(Nt.Function),hr(e.toString())}function aw(e){bt(Nt.Null)}function Sd(e){bt(Nt.Number),um.setFloat64(0,e,!0);for(const t of dm)bt(t)}function cw(e){bt(Nt.Object);for(const t of YS(e).sort())hr(t),hr(e[t])}function lw(e){bt(Nt.RegExp),ic(e.toString())}const uw=new TextEncoder;function ic(e){bt(Nt.String);for(const t of uw.encode(e))bt(t)}function dw(e){bt(Nt.Symbol),hr(e.toString())}function fw(e){bt(Nt.TypeArray);const t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)bt(t[n])}function mw(e){return bt(Nt.Undefined)}function hr(e){return yo(e)?fw(e):tm(e)?ow(e):em(e)?lw(e):xS(e)?yd(e.valueOf()):yS(e)?ic(e.valueOf()):kS(e)?Sd(e.valueOf()):XS(e)?Sd(e):z(e)?nw(e):mt(e)?yd(e):et(e)?rw(e):zi(e)?sw(e):Kt(e)?aw():re(e)?cw(e):oe(e)?ic(e):Jc(e)?dw(e):Oe(e)?mw():kn(e)?iw(e):Pt()}function fm(e){return xs=BigInt("14695981039346656037"),hr(e),xs}function Ji(e){return fm(e).toString(16).padStart(16,"0")}const pw=Object.freeze(Object.defineProperty({__proto__:null,Hash:Ji,HashCode:fm},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 hw=gw;function bw(){return hw}class mm{constructor(t,n){this.type=t,this.decode=n}Encode(t){const n=this.type,r=Yt(n)?i=>this.decode(n["~codec"].decode(i)):this.decode,s=Yt(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 mm(this.type,t)}}function ll(e){return new pm(e)}function xw(e,t){return ll(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function kw(e,t){return ll(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Yt(e){return Wt(e)&&C(e,"~codec")&&re(e["~codec"])&&C(e["~codec"],"encode")&&C(e["~codec"],"decode")}function yw(e){return Yl(e)}function Ei(e){return Wt(e)&&C(e,"~immutable")}function Vn(e,t={}){return Ae("AddReadonly",[e],t)}function Ai(e,t={}){return sl(e,t)}function Sw(e){return Ai(e)}function Pi(e){return Wt(e)&&C(e,"~readonly")}function ww(e,t){const n=ul(e)?[...e["~refine"],t]:[t];return ue(e,{"~refine":n},{})}function vw(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,()=>"Refine Error"]});return ww(t,{check:n,error:r})}function Iw(e){return cn(e)&&C(e,"check")&&C(e,"error")&&kn(e.check)&&kn(e.error)}function ul(e){return Wt(e)&&C(e,"~refine")&&z(e["~refine"])&&lt(e["~refine"],0,t=>Iw(t))}const jw="-?(?:0|[1-9][0-9]*)n";function dl(e){return ye({"~kind":"BigInt"},{type:"bigint"},e)}function Xr(e){return Ie(e,"BigInt")}function gm(e){return ye({"~kind":"Boolean"},{type:"boolean"},e)}function wr(e){return Ie(e,"Boolean")}function ac(e){return ye({"~kind":"Identifier"},{name:e})}function Cw(e){return Ie(e,"Identifier")}const hm="-?(?:0|[1-9][0-9]*)";function Qi(e){return ye({"~kind":"Integer"},{type:"integer"},e)}function $n(e){return Ie(e,"Integer")}class Tw extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function Ew(e){return et(e)?"bigint":mt(e)?"boolean":ve(e)?"number":oe(e)?"string":(()=>{throw new Tw(e)})()}function _e(e,t){return ye({"~kind":"Literal"},{type:Ew(e),const:e},t)}function bm(e){return et(e)||mt(e)||ve(e)||oe(e)}function Aw(e){return Ve(e)&&et(e.const)}function Pw(e){return Ve(e)&&mt(e.const)}function xm(e){return Ve(e)&&ve(e.const)}function km(e){return Ve(e)&&oe(e.const)}function Ve(e){return Ie(e,"Literal")}function fl(e){return ye({"~kind":"Null"},{type:"null"},e)}function Co(e){return Ie(e,"Null")}const ym="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function br(e){return ye({"~kind":"Number"},{type:"number"},e)}function Zt(e){return Ie(e,"Number")}function ml(e){return ye({"~kind":"Symbol"},{type:"symbol"},e)}function To(e){return Ie(e,"Symbol")}function Eo(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,o],1:s=>[s,_t(),_t()]});return ye({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function Nw(e){return Ie(e,"Parameter")}const Sm=".*";function Rn(e){return ye({"~kind":"String"},{type:"string"},e)}function Tn(e){return Ie(e,"String")}function Ge(e,t={}){return ye({"~kind":"Union"},{anyOf:e},t)}function ie(e){return Ie(e,"Union")}function $w(e){return jn(e,["~kind","anyOf"])}function wm(e){const t=gT(e);return h(t.length,2)?t[0]:[]}function Rw(e){return!0}function vm(e){return Te(e,(t,n)=>Mw(t)?vm(n):!1,()=>!0)}function Im(e){return h(e.length,0)?!1:vm(e)}function Mw(e){return ie(e)?Im(e.anyOf):Ve(e)?Rw(e.const):!1}function jm(e){return Im(e)}function Cm(e){return ye({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Tm(e,t,n=[]){return Te(e,(r,s)=>Tm(s,t,[...n,`${r}${t}`]),()=>n)}function Ow(e,t){return h(e.length,0)?[`${t}`]:Tm(e,t)}function Em(e,t,n=[]){return Te(t,(r,s)=>Em(e,s,[...n,...Am(e,r)]),()=>n)}function Am(e,t){return ie(t)?Em(e,t.anyOf):Ve(t)?Ow(e,t.const):Pt()}function Pm(e,t){return Te(t,(n,r)=>Pm(Am(e,n),r),()=>e)}function Fw(e){return e.map(t=>_e(t))}function _w(e){const t=Pm([],e),n=Fw(t);return Ge(n)}function Dw(e){return h(e.length,0)?Pt():h(e.length,1)&&Ve(e[0])?e[0]:_w(e)}function Nm(e){const t=wm(e);return h(t.length,0)?Rn():jm(t)?Dw(t):Cm(e)}function pl(e){const t=Nm(e);return Ut(t)?Rn():t}function xr(e,t){const n="object",r={[e]:t};return ye({"~kind":"Record"},{type:n,patternProperties:r})}function Lw(e){return xr(Kr,e)}function Uw(e){return $e({true:e,false:e})}function mn(e,t={}){const[n,r,s]=[e,e.length,!1];return ye({"~kind":"Tuple"},{type:"array",additionalItems:s,items:n,minItems:r},t)}function rt(e){return Ie(e,"Tuple")}function Bw(e){return jn(e,["~kind","type","items","minItems","additionalItems"])}function qw(e){return jn(e,["~readonly"])}function $m(e,t){return ue(qw(e),{},t)}function Hw(e,t,n,r){const s=V(e,t,n);return $m(s,r)}function Kw(e,t={}){return Ae("RemoveReadonly",[e],t)}function zw(e,t={}){return $m(e,t)}function Gw(e){return jn(e,["~optional"])}function Rm(e,t){return ue(Gw(e),{},t)}function Vw(e,t,n,r){const s=V(e,t,n);return Rm(s,r)}function Ww(e,t={}){return Ae("RemoveOptional",[e],t)}function Mm(e,t={}){return Rm(e,t)}function Om(e){return e.reduceRight((n,r,s)=>({[s]:r,...n}),{})}function Jw(e){const t=Om(e.items);return $e(t)}function Qw(e,t){return Pi(e)?!!Pi(t):!1}function Yw(e,t){return Jt(e)?!!Jt(t):!1}function Xw(e,t){const n=Qw(e,t),r=Yw(e,t),s=en([e,t]),o=zw(Mm(s));return n&&r?Ai(Ci(o)):n&&!r?Ai(o):!n&&r?Ci(o):o}function Zw(e,t,n){return n in e?n in t?Xw(e[n],t[n]):e[n]:n in t?t[n]:Ct()}function ev(e,t){return[...new Set([...D(t),...D(e)])].reduce((r,s)=>({...r,[s]:Zw(e,t,s)}),{})}function wd(e){return Le(e)?e.properties:rt(e)?Om(e.items):Pt()}function tv(e,t){const n=wd(e),r=wd(t),s=ev(n,r);return $e(s)}function nv(e,t){const n=ia(e,t);return h(n,Dl)?e:h(n,Ll)||h(n,_l)?t:Ct()}function vd(e){return Le(e)||rt(e)}function rv(e,t){const n=ie(e),r=ie(t);return n||r}function sv(e,t){const n=Hr(e),r=Hr(t),s=rv(n,r),o=vd(n),i=vd(r);return s?en([n,r]):o&&i?tv(n,r):o&&!i?n:!o&&i?r:nv(n,r)}function Fm(e,t,n=[]){return Te(t,(r,s)=>Fm(e,s,[...n,sv(e,r)]),()=>h(n.length,0)?[e]:n)}function _m(e,t,n=[]){return Te(e,(r,s)=>_m(s,t,[...n,...Ni([r],t)]),()=>n)}function Ni(e,t=[]){return Te(e,(n,r)=>ie(n)?Ni(r,_m(n.anyOf,t)):Ni(r,Fm(n,t)),()=>t)}function ov(e,t){const n=Wn({},e,t);return qt(n)?[]:[e]}function iv(e,t){return e.reduce((n,r)=>[...n,...ov(r,t)],[])}function Dm(e,t){const n=Hr(e),r=ie(n)?n.anyOf:[n],s=iv(r,t);return Yn(s)}function As(e,t,n){const r=Pn([e,t]),s=Dm(n,e);return Yn([r,s])}function vr(e){const t=e.map(n=>_e(n));return Yn(t)}function en(e){const t=Ni(e),n=ng(t);return Ps(n)}function Qn(e){const t=pl(e);return Hr(t)}function Yn(e){const t=ng(e);return Ps(t)}function Hr(e){return dn(e)?As(e.if,e.then,e.else):fn(e)?vr(e.enum):Ue(e)?en(e.allOf):Ut(e)?Qn(e.pattern):ie(e)?Yn(e.anyOf):e}function Ps(e){return h(e.length,1)?e[0]:h(e.length,0)?Ct():Ge(e)}function av(e,t){const n=vr(e);return Xi(n,t)}function cv(e,t){return xr(Ao,t)}function lv(e,t){const n=en(e);return Xi(n,t)}function uv(e,t){return oe(e)||ve(e)?$e({[e]:t}):h(e,!1)?$e({false:t}):h(e,!0)?$e({true:t}):$e({})}function dv(e,t){return xr(Zi,t)}function fv(e,t){return C(e,"pattern")&&(oe(e.pattern)||e.pattern instanceof RegExp)?xr(e.pattern.toString(),t):xr(Kr,t)}function mv(e,t){const n=wm(e);return jm(n)?Xi(Qn(e),t):xr(e,t)}function pv(e){return ie(e)?Yi(e.anyOf):[e]}function Yi(e){return e.reduce((t,n)=>[...t,...pv(n)],[])}function gv(e){return e.some(t=>Tn(t)||Zt(t)||$n(t))}function hv(e,t){return h(gv(e),!0)?xr(Kr,t):void 0}function bv(e,t){return e.reduce((n,r)=>Ve(r)&&(oe(r.const)||ve(r.const))?{...n,[r.const]:t}:n,{})}function xv(e,t){const n=bv(e,t);return $e(n)}function kv(e,t){const n=Yi(e),r=hv(n,t);return Wt(r)?r:xv(n,t)}function Xi(e,t){return Cn(e)?Lw(t):wr(e)?Uw(t):fn(e)?av(e.enum,t):$n(e)?cv(e,t):Ue(e)?lv(e.allOf,t):Ve(e)?uv(e.const,t):Zt(e)?dv(e,t):ie(e)?kv(e.anyOf,t):Tn(e)?fv(e,t):Ut(e)?mv(e.pattern,t):$e({})}function Lm(e,t,n){return Ye([e])?ue(Xi(e,t),{},n):Um(e,t,n)}function yv(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Lm(o,i,s)}const Ao=`^${hm}$`,Zi=`^${ym}$`,Kr=`^${Sm}$`;function Um(e,t,n={}){return Ae("Record",[e,t],n)}function gl(e,t,n={}){return Lm(e,t,n)}function Sv(e,t){return xr(e,t)}function cc(e){return h(e,Kr)?Rn():h(e,Ao)?Qi():h(e,Zi)?br():Nm(e)}function pn(e){return D(e.patternProperties)[0]}function ea(e){const t=pn(e);return cc(t)}function Lt(e){return e.patternProperties[pn(e)]}function Tt(e){return Ie(e,"Record")}function ta(e){return ye({"~kind":"Rest"},{type:"rest",items:e},{})}function na(e){return Ie(e,"Rest")}function Bm(e){return ye({"~kind":"This"},{$ref:"#"},e)}function qm(e){return Ie(e,"This")}function hl(e){return ye({"~kind":"Undefined"},{type:"undefined"},e)}function Ns(e){return Ie(e,"Undefined")}function Hm(e){return ye({"~kind":"Void"},{type:"void"},e)}function Zr(e){return Ie(e,"Void")}function wv(e,t){return h(e,"Array")?Sr(t[0]):h(e,"Capitalize")?ag(t[0]):h(e,"ConstructorParameters")?bg(t[0]):h(e,"Evaluate")?gN(t[0]):h(e,"Exclude")?kg(t[0],t[1]):h(e,"Extract")?yg(t[0],t[1]):h(e,"Index")?Kl(t[0],t[1]):h(e,"InstanceType")?Tg(t[0]):h(e,"Lowercase")?cg(t[0]):h(e,"NonNullable")?$g(t[0]):h(e,"Omit")?Mg(t[0],t[1]):h(e,"Parameters")?_g(t[0]):h(e,"Partial")?Lg(t[0]):h(e,"Pick")?Bg(t[0],t[1]):h(e,"Readonly")?Hg(t[0]):h(e,"KeyOf")?Wl(t[0]):h(e,"Record")?Um(t[0],t[1]):h(e,"Required")?Gg(t[0]):h(e,"ReturnType")?Wg(t[0]):h(e,"Uncapitalize")?lg(t[0]):h(e,"Uppercase")?ug(t[0]):xc(on(e),t)}function es(){throw Error("Unreachable")}function Km(e,t=[]){return Te(e,(n,r)=>Km(r,[...t,n[1]]),()=>t)}function Xn(e){return h(e.length,3)?[e[0],...Km(e[1])]:[]}function vv(e){return Eo(e[0],e[2],e[4])}function Iv(e){return Eo(e[0],e[2],e[2])}function jv(e){return Eo(e[0],_t(),e[2])}function Cv(e){return Eo(e,_t(),_t())}function Tv(e){return Xn(e)}function Ev(e){return e[1]}function Av(e){return Xn(e)}function Pv(e){return e[1]}function Nv(e){return wv(e[0],e[1])}function $v(e){return null}function Rv(e){return Rn()}function Mv(e){return br()}function Ov(e){return gm()}function Fv(e){return hl()}function _v(e){return fl()}function Dv(e){return Qi()}function Lv(e){return dl()}function Uv(e){return _t()}function Bv(e){return cl()}function qv(e){return $e({})}function Hv(e){return Ct()}function Kv(e){return ml()}function zv(e){return Hm()}function Gv(e){return Bm()}function Vv(e){return _e(BigInt(e))}function Wv(e){return _e(h(e,"true"))}function Jv(e){return _e(parseFloat(e))}function Qv(e){return _e(e)}function Yv(e){return e[1]}function Xv(e){return _e(e)}function Zv(e){return h(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function eI(e){return e[1]}function tI(e){return Bp(e)}function nI(e){return h(e.length,6)?Ti(e[1],e[3],e[5]):Ti(e[1],e[3],_t())}function rI(e){return e.length>0}function sI(e){return e.reduce((t,n)=>h(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function oI(e){return h(e.length,6)?[e[1],e[3],e[5]]:[]}function iI(e){return z(e)&&h(e.length,3)?e[1]:e}function aI(e){return h(e.length,2)?e[1]:[]}function Id(e,t){return t.reduce((n,r)=>{const s=r;return h(s.length,1)?Kl(n,s[0]):h(s.length,0)?Sr(n):es()},e)}function jd(e,t){return h(t.length,3)?gg(e,t[0],t[1],t[2]):e}function cI(e,t){return z(t)&&h(t.length,0)?e:Qg(e,t)}function lI(e){const[t,n,r,s,o]=e;return cI(jd(t?Wl(Id(n,r)):Id(n,r),s),o)}function bl(e,t){return h(t.length,3)?(()=>{const[n,r,s]=t,o=bl(r,s);if(h(n,"&"))return Ue(o)?Pn([e,...o.allOf]):Pn([e,o]);if(h(n,"|"))return ie(o)?Ge([e,...o.anyOf]):Ge([e,o]);es()})():e}function uI(e){const[t,n]=e;return bl(t,n)}function dI(e){const[t,n]=e;return bl(t,n)}function fI(e){return pN(e[1])}function mI(e){return e[1]}function pI(e){return Io(e[0],e[2])}function gI(e){return h(e.length,4)?oc(e[1],e[3]):h(e.length,2)?oc(e[1],_t()):es()}function hI(e){return`${e}`}function bI(e){return $n(e[3])?Ao:Zt(e[3])?Zi:To(e[3])||Tn(e[3])?Kr:es()}function xI(e){return e.length>0}function kI(e){return e.length>0}function yI(e){const[t,n,r,s,o]=e;return{[n]:t&&r?Vn(Gn(o)):t&&!r?Vn(o):!t&&r?Gn(o):o}}function SI(e){return Xn(e)}function zm(e){return e.reduce((t,n)=>C(n,Ao)||C(n,Zi)||C(n,Kr)?[t[0],ft(t[1],n)]:[ft(t[0],n),t[1]],[{},{}])}function wI(e){return zm(e[1])}function vI(e){const[t,n]=e,r=h(D(n).length,0)?{}:{patternProperties:n};return $e(t,r)}function II(e){return h(e.length,5)?Vn(Gn(e[4])):h(e.length,3)?e[2]:h(e.length,4)?h(e[2],"readonly")?Vn(e[3]):Gn(e[3]):es()}function jI(e){if(!z(e)||!h(e.length,3))return e;const[t,n,r]=e;return t&&r?Vn(Gn(n)):t&&!r?Vn(n):!t&&r?Gn(n):n}function CI(e){return h(e.length,2)?ta(e[1]):h(e.length,1)?e[0]:es()}function TI(e){return Xn(e)}function EI(e){return mn(e[1])}function AI(e){return Vn(Gn(e[4]))}function PI(e){return Vn(e[3])}function NI(e){return Gn(e[3])}function $I(e){return e[2]}function RI(e){return h(e.length,2)?ta(e[1]):h(e.length,1)?e[0]:es()}function MI(e){return Xn(e)}function OI(e){return vo(e[1],e[4])}function FI(e){return wo(e[2],e[5])}function Cd(e,t){return h(e,"remove")?Kw(t):h(e,"add")?Vn(t):t}function _I(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function Td(e,t){return h(e,"remove")?Ww(t):h(e,"add")?Gn(t):t}function DI(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function LI(e){return h(e.length,2)?[e[1]]:[]}function UI(e){return z(e[6])&&h(e[6].length,1)?kc(ac(e[3]),e[5],e[6][0],Cd(e[1],Td(e[8],e[10]))):kc(ac(e[3]),e[5],on(e[3]),Cd(e[1],Td(e[8],e[10])))}function BI(e){return on(e)}function qI(e){return BigInt(e)}function HI(e){return parseFloat(e)}function KI(e){return h(e,"true")}function zI(e){return null}function GI(e){return{[e[0]]:e[2]}}function VI(e){return Xn(e)}function WI(e){return e.reduce((t,n)=>ft(t,n),{})}function JI(e){return WI(e[1])}function QI(e){return Xn(e)}function YI(e){return e[1]}function XI(e){return dl()}function ZI(e){return Rn()}function ej(e){return br()}function tj(e){return Qi()}function nj(e){return Ct()}function rj(e){return _e(e)}function sj(e){return Ge(e[1])}function oj(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function ij(e){return[e[0],...e[1]]}function aj(e){return e[1]}function cj(e){return Xn(e)}function lj(e){return h(e.length,2)?e[1]:[]}function uj(e){const t=e[2],n=e[3],[r,s]=e[4],o=h(D(s).length,0)?{}:{patternProperties:s};return{[e[1]]:Io(t,Ol(n,r,o))}}function dj(e){const t=e[2],[n,r]=e[3],s=h(D(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Ol(t,n,s)}}function fj(e){return{[e[1]]:Io(e[2],e[4])}}function mj(e){return{[e[1]]:e[3]}}function pj(e){return null}function gj(e){return Xn(e)}function hj(e){return e[1]}function bj(e){const[t,n]=[e[0],e[1]];return hN(ft(t,zm(n)[0]))}function xl(e){return h(e.length,2)}function Fe(e,t,n){return xl(e)?t(e[0],e[1]):n()}function xj(e,t){return h(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function $t(e,t){for(let n=0;n<e.length;n++){const r=xj(e[n],t);if(xl(r))return r}return[]}function lc(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}const kj=[...lc(97,122),...lc(65,90)],Gm="0",Vm=lc(49,57),kl=[Gm,...Vm],yj=" ",yl=`
3
- `,Po="_",Sl=".",Sj="$",Wm="-",Jm="//",Qm="/*",wj="*/";function Ym(e){const t=e.indexOf(wj);return h(t,-1)?"":e.slice(t+2)}function Xm(e){const t=e.indexOf(yl);return h(t,-1)?"":e.slice(t)}function vj(e){return e.replace(/^[ \t\r\f\v]+/,"")}function uc(e){const t=vj(e);return t.startsWith(Qm)?uc(Ym(t.slice(2))):t.startsWith(Jm)?uc(Xm(t.slice(2))):t}function Sn(e){const t=e.trimStart();return t.startsWith(Qm)?Sn(Ym(t.slice(2))):t.startsWith(Jm)?Sn(Xm(t.slice(2))):t}function Zm(e,t){return Fe($t([e],t),(n,r)=>[n,r],()=>["",t])}function Ij(e,t){return e.includes(t)}function $i(e,t,n,r=""){return Fe($t(e,n),(s,o)=>Ij(t,s)?$i(e,t,o,r):$i(e,t,o,`${r}${s}`),()=>[r,n])}function jj(e){return $t(Vm,e)}const Cj=[...kl,Po];function Tj(e){return $i(Cj,[Po],e)}function Ej(e){return Fe($t([Gm],e),(t,n)=>[t,n],()=>Fe(jj(e),(t,n)=>Fe(Tj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[]))}function ep(e){return Ej(Sn(e))}function Aj(e){return Zm(Wm,e)}function Pj(e){return Fe(Aj(e),(t,n)=>Fe(ep(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Nj(e){return Pj(Sn(e))}function $j(e){return Fe(Nj(e),(t,n)=>Fe($t(["n"],n),(r,s)=>[`${t}`,s],()=>[]),()=>[])}function tp(e){return $j(e)}function Ha(e,t){return $t([e],t)}function w(e,t){return h(e,"")?["",t]:e.startsWith(yl)?Ha(e,uc(t)):e.startsWith(yj)?Ha(e,t):Ha(e,Sn(t))}const np=[...kj,Po,Sj];function Rj(e){return $t(np,e)}const Mj=[...np,...kl];function rp(e,t=""){return Fe($t(Mj,e),(n,r)=>rp(r,`${t}${n}`),()=>[t,e])}function Oj(e){return Fe(Rj(e),(t,n)=>Fe(rp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Ze(e){return Oj(Sn(e))}const Fj=[...kl,Po];function _j(e){return xl($t([Sl],e))}function sp(e){return Fe($i(Fj,[Po],e),(t,n)=>h(t,"")?[]:[t,n],()=>[])}function Dj(e){return Fe($t([Sl],e),(t,n)=>Fe(sp(n),(r,s)=>[`0${t}${r}`,s],()=>[]),()=>[])}function Lj(e){return Fe(ep(e),(t,n)=>Fe($t([Sl],n),(r,s)=>Fe(sp(s),(o,i)=>[`${t}${r}${o}`,i],()=>[`${t}`,s]),()=>[`${t}`,n]),()=>[])}function Uj(e){return _j(e)?Dj(e):Lj(e)}function Bj(e){return Uj(Sn(e))}function qj(e){return Zm(Wm,e)}function Hj(e){return Fe(qj(e),(t,n)=>Fe(Bj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function wl(e){return Hj(Sn(e))}function Kj(e){return h(e,"")?[]:[e.slice(0,1),e.slice(1)]}function op(e,t){return Te(e,(n,r)=>t.startsWith(n)?!0:op(r,t),()=>!1)}function No(e,t,n=""){return Fe(Kj(t),(r,s)=>op(e,t)?[n,t]:No(e,s,`${n}${r}`),()=>[])}function zj(e,t,n){return Fe($t([e],n),(r,s)=>Fe(No([t],s),(o,i)=>Fe($t([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function Gj(e,t,n){return Fe($t([e],n),(r,s)=>Fe(No([yl,t],s),(o,i)=>Fe($t([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function Vj(e,t,n,r){return n?zj(e,t,Sn(r)):Gj(e,t,Sn(r))}function Wj(e,t){return $t(e,t)}function Jj(e,t){return Vj(e,e,!1,t)}function Qj(e,t){return Fe(Wj(e,t),(n,r)=>Jj(n,`${n}${r}`),()=>[])}function vl(e,t){return Qj(e,Sn(t))}function Yj(e,t){return Fe(No(e,t),(n,r)=>h(n,"")?[]:[n,r],()=>[])}const d=(e,t,n=()=>[])=>e.length===2?t(e):n(),Xj=e=>d(d(Ze(e),([t,n])=>d(w("extends",n),([r,s])=>d(ke(s),([o,i])=>d(w("=",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[vv(t),n]),Zj=e=>d(d(Ze(e),([t,n])=>d(w("extends",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Iv(t),n]),eC=e=>d(d(Ze(e),([t,n])=>d(w("=",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[jv(t),n]),tC=e=>d(Ze(e),([t,n])=>[Cv(t),n]),ip=e=>d(d(Xj(e),([t,n])=>[t,n],()=>d(Zj(e),([t,n])=>[t,n],()=>d(eC(e),([t,n])=>[t,n],()=>d(tC(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ap=(e,t=[])=>d(d(w(",",e),([n,r])=>d(ip(r),([s,o])=>[[n,s],o])),([n,r])=>ap(r,[...t,n]),()=>[t,e]),nC=e=>d(d(d(ip(e),([t,n])=>d(ap(n),([r,s])=>d(d(w(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Tv(t),n]),Il=e=>d(d(w("<",e),([t,n])=>d(nC(n),([r,s])=>d(w(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Ev(t),n]),cp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(ke(r),([s,o])=>[[n,s],o])),([n,r])=>cp(r,[...t,n]),()=>[t,e]),rC=e=>d(d(d(ke(e),([t,n])=>d(cp(n),([r,s])=>d(d(w(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Av(t),n]),sC=e=>d(d(w("<",e),([t,n])=>d(rC(n),([r,s])=>d(w(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Pv(t),n]),oC=e=>d(d(Ze(e),([t,n])=>d(sC(n),([r,s])=>[[t,r],s])),([t,n])=>[Nv(t),n]),lp=e=>d(d(d(w(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[$v(),n]),up=e=>d(w("string",e),([t,n])=>[Rv(),n]),dp=e=>d(w("number",e),([t,n])=>[Mv(),n]),iC=e=>d(w("boolean",e),([t,n])=>[Ov(),n]),aC=e=>d(w("undefined",e),([t,n])=>[Fv(),n]),cC=e=>d(w("null",e),([t,n])=>[_v(),n]),fp=e=>d(w("integer",e),([t,n])=>[Dv(),n]),lC=e=>d(w("bigint",e),([t,n])=>[Lv(),n]),uC=e=>d(w("unknown",e),([t,n])=>[Uv(),n]),dC=e=>d(w("any",e),([t,n])=>[Bv(),n]),fC=e=>d(w("object",e),([t,n])=>[qv(),n]),mC=e=>d(w("never",e),([t,n])=>[Hv(),n]),mp=e=>d(w("symbol",e),([t,n])=>[Kv(),n]),pC=e=>d(w("void",e),([t,n])=>[zv(),n]),gC=e=>d(w("this",e),([t,n])=>[Gv(),n]),hC=e=>d(d(w("${",e),([t,n])=>d(ke(n),([r,s])=>d(w("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Yv(t),n]),Ka=e=>d(No(["${","`"],e),([t,n])=>[Xv(t),n]),pp=e=>d(d(d(Ka(e),([t,n])=>d(hC(n),([r,s])=>d(pp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(d(Ka(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(Ka(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Zv(t),n]),gp=e=>d(d(w("`",e),([t,n])=>d(pp(n),([r,s])=>d(w("`",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[eI(t),n]),bC=e=>d(gp(e),([t,n])=>[tI(t),n]),xC=e=>d(d(d(w("if",e),([t,n])=>d(ke(n),([r,s])=>d(w("then",s),([o,i])=>d(ke(i),([a,l])=>d(w("else",l),([u,f])=>d(ke(f),([p,g])=>[[t,r,o,a,u,p],g])))))),([t,n])=>[t,n],()=>d(d(w("if",e),([t,n])=>d(ke(n),([r,s])=>d(w("then",s),([o,i])=>d(ke(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[nI(t),n]),kC=e=>d(tp(e),([t,n])=>[Vv(t),n]),yC=e=>d(d(w("true",e),([t,n])=>[t,n],()=>d(w("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Wv(t),n]),SC=e=>d(wl(e),([t,n])=>[Jv(t),n]),wC=e=>d(vl(["'",'"'],e),([t,n])=>[Qv(t),n]),vC=e=>d(d(d(w("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[rI(t),n]),hp=(e,t=[])=>d(d(d(w("[",e),([n,r])=>d(ke(r),([s,o])=>d(w("]",o),([i,a])=>[[n,s,i],a]))),([n,r])=>[n,r],()=>d(d(w("[",e),([n,r])=>d(w("]",r),([s,o])=>[[n,s],o])),([n,r])=>[n,r],()=>[])),([n,r])=>hp(r,[...t,n]),()=>[t,e]),IC=e=>d(hp(e),([t,n])=>[sI(t),n]),jC=e=>d(d(d(w("extends",e),([t,n])=>d(ke(n),([r,s])=>d(w("?",s),([o,i])=>d(ke(i),([a,l])=>d(w(":",l),([u,f])=>d(ke(f),([p,g])=>[[t,r,o,a,u,p],g])))))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[oI(t),n]),CC=e=>d(d(d(w("(",e),([t,n])=>d(ke(n),([r,s])=>d(w(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(up(e),([t,n])=>[t,n],()=>d(dp(e),([t,n])=>[t,n],()=>d(iC(e),([t,n])=>[t,n],()=>d(aC(e),([t,n])=>[t,n],()=>d(cC(e),([t,n])=>[t,n],()=>d(fp(e),([t,n])=>[t,n],()=>d(lC(e),([t,n])=>[t,n],()=>d(uC(e),([t,n])=>[t,n],()=>d(dC(e),([t,n])=>[t,n],()=>d(fC(e),([t,n])=>[t,n],()=>d(mC(e),([t,n])=>[t,n],()=>d(mp(e),([t,n])=>[t,n],()=>d(pC(e),([t,n])=>[t,n],()=>d(gC(e),([t,n])=>[t,n],()=>d(kC(e),([t,n])=>[t,n],()=>d(yC(e),([t,n])=>[t,n],()=>d(SC(e),([t,n])=>[t,n],()=>d(wC(e),([t,n])=>[t,n],()=>d(bC(e),([t,n])=>[t,n],()=>d(xC(e),([t,n])=>[t,n],()=>d(_C(e),([t,n])=>[t,n],()=>d(UC(e),([t,n])=>[t,n],()=>d(GC(e),([t,n])=>[t,n],()=>d(zC(e),([t,n])=>[t,n],()=>d(QC(e),([t,n])=>[t,n],()=>d(oC(e),([t,n])=>[t,n],()=>d(YC(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[iI(t),n]),TC=e=>d(d(d(w("with",e),([t,n])=>d(Rp(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[aI(t),n]),bp=e=>d(d(vC(e),([t,n])=>d(CC(n),([r,s])=>d(IC(s),([o,i])=>d(jC(i),([a,l])=>d(TC(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[lI(t),n]),xp=e=>d(d(d(w("&",e),([t,n])=>d(bp(n),([r,s])=>d(xp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),kp=e=>d(d(bp(e),([t,n])=>d(xp(n),([r,s])=>[[t,r],s])),([t,n])=>[uI(t),n]),yp=e=>d(d(d(w("|",e),([t,n])=>d(kp(n),([r,s])=>d(yp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ra=e=>d(d(kp(e),([t,n])=>d(yp(n),([r,s])=>[[t,r],s])),([t,n])=>[dI(t),n]),EC=e=>d(d(w("readonly",e),([t,n])=>d(ra(n),([r,s])=>[[t,r],s])),([t,n])=>[fI(t),n]),AC=e=>d(d(w("|",e),([t,n])=>d(ra(n),([r,s])=>[[t,r],s])),([t,n])=>[mI(t),n]),PC=e=>d(d(Il(e),([t,n])=>d(w("=",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[pI(t),n]),NC=e=>d(d(d(w("infer",e),([t,n])=>d(Ze(n),([r,s])=>d(w("extends",s),([o,i])=>d(ra(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>d(d(w("infer",e),([t,n])=>d(Ze(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>[])),([t,n])=>[gI(t),n]),ke=e=>d(d(NC(e),([t,n])=>[t,n],()=>d(AC(e),([t,n])=>[t,n],()=>d(EC(e),([t,n])=>[t,n],()=>d(ra(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),$C=e=>d(wl(e),([t,n])=>[hI(t),n]),RC=e=>d(Ze(e),([t,n])=>[t,n]),MC=e=>d(vl(["'",'"'],e),([t,n])=>[t,n]),OC=e=>d(d(w("[",e),([t,n])=>d(Ze(n),([r,s])=>d(w(":",s),([o,i])=>d(d(fp(i),([a,l])=>[a,l],()=>d(dp(i),([a,l])=>[a,l],()=>d(up(i),([a,l])=>[a,l],()=>d(mp(i),([a,l])=>[a,l],()=>[])))),([a,l])=>d(w("]",l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[bI(t),n]),Sp=e=>d(d($C(e),([t,n])=>[t,n],()=>d(RC(e),([t,n])=>[t,n],()=>d(MC(e),([t,n])=>[t,n],()=>d(OC(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),wp=e=>d(d(d(w("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[xI(t),n]),vp=e=>d(d(d(w("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[kI(t),n]),Ip=e=>d(d(wp(e),([t,n])=>d(Sp(n),([r,s])=>d(vp(s),([o,i])=>d(w(":",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[yI(t),n]),sa=e=>d(d(d(w(",",e),([t,n])=>d(w(`
4
- `,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w(";",e),([t,n])=>d(w(`
5
- `,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(w(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(w(`
6
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),jp=(e,t=[])=>d(d(sa(e),([n,r])=>d(Ip(r),([s,o])=>[[n,s],o])),([n,r])=>jp(r,[...t,n]),()=>[t,e]),FC=e=>d(d(d(Ip(e),([t,n])=>d(jp(n),([r,s])=>d(d(sa(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[SI(t),n]),jl=e=>d(d(w("{",e),([t,n])=>d(FC(n),([r,s])=>d(w("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[wI(t),n]),_C=e=>d(jl(e),([t,n])=>[vI(t),n]),DC=e=>d(d(d(Ze(e),([t,n])=>d(w("?",n),([r,s])=>d(w(":",s),([o,i])=>d(w("readonly",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[t,n],()=>d(d(Ze(e),([t,n])=>d(w(":",n),([r,s])=>d(w("readonly",s),([o,i])=>d(ke(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>d(d(Ze(e),([t,n])=>d(w("?",n),([r,s])=>d(w(":",s),([o,i])=>d(ke(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>d(d(Ze(e),([t,n])=>d(w(":",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[II(t),n]),Ed=e=>d(d(DC(e),([t,n])=>[t,n],()=>d(d(wp(e),([t,n])=>d(ke(n),([r,s])=>d(vp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])),([t,n])=>[jI(t),n]),Cp=e=>d(d(d(w("...",e),([t,n])=>d(Ed(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(Ed(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[CI(t),n]),Tp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(Cp(r),([s,o])=>[[n,s],o])),([n,r])=>Tp(r,[...t,n]),()=>[t,e]),LC=e=>d(d(d(Cp(e),([t,n])=>d(Tp(n),([r,s])=>d(d(w(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[TI(t),n]),UC=e=>d(d(w("[",e),([t,n])=>d(LC(n),([r,s])=>d(w("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[EI(t),n]),BC=e=>d(d(Ze(e),([t,n])=>d(w("?",n),([r,s])=>d(w(":",s),([o,i])=>d(w("readonly",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[AI(t),n]),qC=e=>d(d(Ze(e),([t,n])=>d(w(":",n),([r,s])=>d(w("readonly",s),([o,i])=>d(ke(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[PI(t),n]),HC=e=>d(d(Ze(e),([t,n])=>d(w("?",n),([r,s])=>d(w(":",s),([o,i])=>d(ke(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[NI(t),n]),KC=e=>d(d(Ze(e),([t,n])=>d(w(":",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[$I(t),n]),Ad=e=>d(d(BC(e),([t,n])=>[t,n],()=>d(qC(e),([t,n])=>[t,n],()=>d(HC(e),([t,n])=>[t,n],()=>d(KC(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ep=e=>d(d(d(w("...",e),([t,n])=>d(Ad(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(Ad(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[RI(t),n]),Ap=(e,t=[])=>d(d(w(",",e),([n,r])=>d(Ep(r),([s,o])=>[[n,s],o])),([n,r])=>Ap(r,[...t,n]),()=>[t,e]),Pp=e=>d(d(d(Ep(e),([t,n])=>d(Ap(n),([r,s])=>d(d(w(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[MI(t),n]),zC=e=>d(d(w("(",e),([t,n])=>d(Pp(n),([r,s])=>d(w(")",s),([o,i])=>d(w("=>",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[OI(t),n]),GC=e=>d(d(w("new",e),([t,n])=>d(w("(",n),([r,s])=>d(Pp(s),([o,i])=>d(w(")",i),([a,l])=>d(w("=>",l),([u,f])=>d(ke(f),([p,g])=>[[t,r,o,a,u,p],g])))))),([t,n])=>[FI(t),n]),VC=e=>d(d(d(w("+",e),([t,n])=>d(w("readonly",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w("-",e),([t,n])=>d(w("readonly",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[_I(t),n]),WC=e=>d(d(d(w("+",e),([t,n])=>d(w("?",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w("-",e),([t,n])=>d(w("?",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[DI(t),n]),JC=e=>d(d(d(w("as",e),([t,n])=>d(ke(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[LI(t),n]),QC=e=>d(d(w("{",e),([t,n])=>d(VC(n),([r,s])=>d(w("[",s),([o,i])=>d(Ze(i),([a,l])=>d(w("in",l),([u,f])=>d(ke(f),([p,g])=>d(JC(g),([k,b])=>d(w("]",b),([y,j])=>d(WC(j),([x,I])=>d(w(":",I),([N,F])=>d(ke(F),([M,R])=>d(lp(R),([P,$])=>d(w("}",$),([A,_])=>[[t,r,o,a,u,p,k,y,x,N,M,P,A],_]))))))))))))),([t,n])=>[UI(t),n]),YC=e=>d(Ze(e),([t,n])=>[BI(t),n]),XC=e=>d(tp(e),([t,n])=>[qI(t),n]),ZC=e=>d(wl(e),([t,n])=>[HI(t),n]),eT=e=>d(d(w("true",e),([t,n])=>[t,n],()=>d(w("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[KI(t),n]),tT=e=>d(vl(['"',"'"],e),([t,n])=>[t,n]),nT=e=>d(w("null",e),([t,n])=>[zI(),n]),rT=e=>d(w("undefined",e),([t,n])=>[void 0,n]),Np=e=>d(d(Sp(e),([t,n])=>d(w(":",n),([r,s])=>d(Cl(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[GI(t),n]),$p=(e,t=[])=>d(d(sa(e),([n,r])=>d(Np(r),([s,o])=>[[n,s],o])),([n,r])=>$p(r,[...t,n]),()=>[t,e]),sT=e=>d(d(d(Np(e),([t,n])=>d($p(n),([r,s])=>d(d(sa(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[VI(t),n]),Rp=e=>d(d(w("{",e),([t,n])=>d(sT(n),([r,s])=>d(w("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[JI(t),n]),Mp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(Cl(r),([s,o])=>[[n,s],o])),([n,r])=>Mp(r,[...t,n]),()=>[t,e]),oT=e=>d(d(d(Cl(e),([t,n])=>d(Mp(n),([r,s])=>d(d(w(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[QI(t),n]),iT=e=>d(d(w("[",e),([t,n])=>d(oT(n),([r,s])=>d(w("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[YI(t),n]),Cl=e=>d(d(XC(e),([t,n])=>[t,n],()=>d(ZC(e),([t,n])=>[t,n],()=>d(eT(e),([t,n])=>[t,n],()=>d(tT(e),([t,n])=>[t,n],()=>d(nT(e),([t,n])=>[t,n],()=>d(rT(e),([t,n])=>[t,n],()=>d(Rp(e),([t,n])=>[t,n],()=>d(iT(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),aT=e=>d(w("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[XI(),n]),cT=e=>d(w(".*",e),([t,n])=>[ZI(),n]),lT=e=>d(w("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[ej(),n]),uT=e=>d(w("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[tj(),n]),dT=e=>d(w("(?!)",e),([t,n])=>[nj(),n]),fT=e=>d(Yj(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[rj(t),n]),mT=e=>d(d(aT(e),([t,n])=>[t,n],()=>d(cT(e),([t,n])=>[t,n],()=>d(lT(e),([t,n])=>[t,n],()=>d(uT(e),([t,n])=>[t,n],()=>d(dT(e),([t,n])=>[t,n],()=>d(pT(e),([t,n])=>[t,n],()=>d(fT(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),pT=e=>d(d(w("(",e),([t,n])=>d(Tl(n),([r,s])=>d(w(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[sj(t),n]),Op=e=>d(d(d(dc(e),([t,n])=>d(w("|",n),([r,s])=>d(Op(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(d(dc(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[oj(t),n]),dc=e=>d(d(mT(e),([t,n])=>d(Tl(n),([r,s])=>[[t,r],s])),([t,n])=>[ij(t),n]),Tl=e=>d(d(Op(e),([t,n])=>[t,n],()=>d(dc(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),gT=e=>d(d(w("^",e),([t,n])=>d(Tl(n),([r,s])=>d(w("$",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[aj(t),n]),Fp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(ke(r),([s,o])=>[[n,s],o])),([n,r])=>Fp(r,[...t,n]),()=>[t,e]),hT=e=>d(d(d(ke(e),([t,n])=>d(Fp(n),([r,s])=>d(d(w(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[cj(t),n]),_p=e=>d(d(d(w("extends",e),([t,n])=>d(hT(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[lj(t),n]),bT=e=>d(d(w("interface",e),([t,n])=>d(Ze(n),([r,s])=>d(Il(s),([o,i])=>d(_p(i),([a,l])=>d(jl(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[uj(t),n]),xT=e=>d(d(w("interface",e),([t,n])=>d(Ze(n),([r,s])=>d(_p(s),([o,i])=>d(jl(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[dj(t),n]),kT=e=>d(d(w("type",e),([t,n])=>d(Ze(n),([r,s])=>d(Il(s),([o,i])=>d(w("=",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[fj(t),n]),yT=e=>d(d(w("type",e),([t,n])=>d(Ze(n),([r,s])=>d(w("=",s),([o,i])=>d(ke(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[mj(t),n]),ST=e=>d(d(d(w("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[pj(),n]),Dp=e=>d(d(d(w(";",e),([t,n])=>d(w(`
7
- `,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(w(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(w(`
8
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Lp=(e,t=[])=>d(d(Dp(e),([n,r])=>d(El(r),([s,o])=>[[n,s],o])),([n,r])=>Lp(r,[...t,n]),()=>[t,e]),wT=e=>d(d(d(El(e),([t,n])=>d(Lp(n),([r,s])=>d(d(Dp(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[gj(t),n]),El=e=>d(d(ST(e),([t,n])=>d(d(bT(n),([r,s])=>[r,s],()=>d(xT(n),([r,s])=>[r,s],()=>d(kT(n),([r,s])=>[r,s],()=>d(yT(n),([r,s])=>[r,s],()=>[])))),([r,s])=>d(lp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[hj(t),n]),vT=e=>d(d(El(e),([t,n])=>d(wT(n),([r,s])=>[[t,r],s])),([t,n])=>[bj(t),n]),IT=e=>d(d(vT(e),([t,n])=>[t,n],()=>d(PC(e),([t,n])=>[t,n],()=>d(ke(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function jT(e){const t=gp(`\`${e}\``);return h(t.length,2)?t[0]:Pt()}function CT(e){return e.join("|")}function TT(e){return e.slice(1,e.length-1)}function ET(e,t,n){return Ir(t,`${n}${e}`)}function AT(e,t){return Ir(e,`${t}${jw}`)}function PT(e,t){return Ir(e,`${t}${hm}`)}function NT(e,t){return Ir(e,`${t}${ym}`)}function $T(e,t){return $o(Ge([_e("false"),_e("true")]),e,t)}function RT(e,t){return Ir(e,`${t}${Sm}`)}function MT(e,t,n){return Ir(t,`${n}${TT(e)}`)}function OT(e,t,n){const r=Al(e,{});return $o(r,t,n)}function FT(e,t,n){const r=vr(e);return $o(r,t,n)}function Up(e,t,n,r=[]){return Te(e,(s,o)=>Up(o,t,n,[...r,$o(s,[],"")]),()=>Ir(t,`${n}(${CT(r)})`))}function $o(e,t,n){return fn(e)?FT(e.enum,t,n):$n(e)?PT(t,n):Ve(e)?ET(e.const,t,n):Xr(e)?AT(t,n):wr(e)?$T(t,n):Zt(e)?NT(t,n):Tn(e)?RT(t,n):Ut(e)?MT(e.pattern,t,n):UT(e)?OT(e.parameters[0],t,n):ie(e)?Up(e.anyOf,t,n):LS}function Ir(e,t){return Te(e,(n,r)=>$o(n,r,t),()=>t)}function _T(e){return`^${Ir(e,"")}$`}function DT(e){const t=_T(e);return Cm(t)}function Al(e,t){return Ye(e)?ue(DT(e),{},t):Bp(e,t)}function LT(e,t,n,r){const s=Bn(e,t,n);return Al(s,r)}function Bp(e,t={}){return Ae("TemplateLiteral",[e],t)}function UT(e){return Wt(e)&&C(e,"action")&&h(e.action,"TemplateLiteral")}function qp(e){return Al(e,{})}function BT(e){const t=jT(e);return qp(t)}function qT(e,t={}){const n=oe(e)?BT(e):qp(e);return ue(n,{},t)}function Ut(e){return Ie(e,"TemplateLiteral")}function Hp(e){return ye({"~kind":"ExtendsUnion"},{inferred:e})}function Pl(e){return re(e)&&C(e,"~kind")&&C(e,"inferred")&&h(e["~kind"],"ExtendsUnion")&&re(e.inferred)}function ee(e){return ye({"~kind":"ExtendsTrue"},{inferred:e})}function Nl(e){return re(e)&&C(e,"~kind")&&C(e,"inferred")&&h(e["~kind"],"ExtendsTrue")&&re(e.inferred)}function we(){return ye({"~kind":"ExtendsFalse"},{})}function fc(e){return re(e)&&C(e,"~kind")&&h(e["~kind"],"ExtendsFalse")}function qt(e){return Pl(e)||Nl(e)}function kt(e,t,n){return qt(e)?t(e.inferred):n()}const HT=Object.freeze(Object.defineProperty({__proto__:null,ExtendsFalse:we,ExtendsTrue:ee,ExtendsUnion:Hp,IsExtendsFalse:fc,IsExtendsTrue:Nl,IsExtendsTrueLike:qt,IsExtendsUnion:Pl,Match:kt},Symbol.toStringTag,{value:"Module"}));function KT(e,t,n,r){return kt(Qe(e,n,r),s=>ee(ft(ft(e,s),{[t]:n})),()=>we())}function zT(e,t){return ee(e)}function GT(e,t,n,r,s){return kt(Qe(e,t,n),o=>kt(Qe(o,t,r),i=>ee(i),()=>we()),()=>kt(Qe(e,t,s),o=>ee(o),()=>we()))}function VT(e,t,n){const r=vr(n);return Qe(e,t,r)}function Kp(e,t,n){return Te(n,(r,s)=>kt(Qe(e,t,r),o=>Kp(o,t,s),()=>we()),()=>ee(e))}function WT(e,t,n){const r=Qn(n);return Qe(e,t,r)}function zp(e,t,n){return Te(n,(r,s)=>kt(Qe(e,t,r),o=>ee(o),()=>zp(e,t,s)),()=>we())}function xt(e,t,n){return Cn(n)?zT(e):dn(n)?GT(e,t,n.if,n.then,n.else):fn(n)?VT(e,t,n.enum):Qt(n)?KT(e,n.name,t,n.extends):Ue(n)?Kp(e,t,n.allOf):Ut(n)?WT(e,t,n.pattern):ie(n)?zp(e,t,n.anyOf):yn(n)?ee(e):we()}function JT(e,t,n){return Qt(n)?xt(e,t,n):Cn(n)||yn(n)?ee(e):Hp(e)}function QT(e,t){const n=Ei(e),r=Ei(t);return n&&r||!n&&r?!0:!(n&&!r)}function YT(e,t,n,r){return ut(r)?QT(t,r)?Qe(e,n,r.items):we():xt(e,t,r)}function XT(e,t,n){return Xr(n)?ee(e):xt(e,t,n)}function ZT(e,t,n){return wr(n)?ee(e):xt(e,t,n)}function eE(e,t,n,r,s){const o=Qt(r)?t:r,i=Qt(r)?r:t,a=Jt(t),l=Jt(r);return!a&&l?we():kt(Qe(e,o,i),u=>$l(u,n,s),()=>we())}function tE(e,t,n,r){return Te(r,(s,o)=>eE(e,t,n,s,o),()=>Jt(t)?ee(e):we())}function nE(e,t,n){return Te(t,(r,s)=>tE(e,r,s,n),()=>ee(e))}function $l(e,t,n){return nE(e,t,n)}function Gp(e,t,n){return Zr(n)?ee(e):Qe(e,t,n)}function rE(e,t,n,r){return Cn(r)||yn(r)?ee(e):ln(r)?kt($l(e,t,r.parameters),s=>Gp(s,n,r.instanceType),()=>we()):we()}function sE(e,t,n,r,s){return kt(Qe(e,t,s),()=>Qe(e,n,s),()=>Qe(e,r,s))}function oE(e,t,n){const r=vr(t);return Qe(e,r,n)}function iE(e,t,n,r){return Cn(r)||yn(r)?ee(e):un(r)?kt($l(e,t,r.parameters),s=>Gp(s,n,r.returnType),()=>we()):we()}function aE(e,t,n){return $n(n)||Zt(n)?ee(e):xt(e,t,n)}function cE(e,t,n){const r=en(t);return Qe(e,r,n)}function oa(e,t,n){return t===n?ee(e):we()}function lE(e,t,n){return Ve(n)?oa(e,t,n.const):Xr(n)?ee(e):xt(e,_e(t),n)}function uE(e,t,n){return Ve(n)?oa(e,t,n.const):wr(n)?ee(e):xt(e,_e(t),n)}function dE(e,t,n){return Ve(n)?oa(e,t,n.const):Zt(n)?ee(e):xt(e,_e(t),n)}function fE(e,t,n){return Ve(n)?oa(e,t,n.const):Tn(n)?ee(e):xt(e,_e(t),n)}function mE(e,t,n){return et(t.const)?lE(e,t.const,n):mt(t.const)?uE(e,t.const,n):ve(t.const)?dE(e,t.const,n):oe(t.const)?fE(e,t.const,n):Pt()}function pE(e,t,n){return Qt(n)?xt(e,t,n):ee(e)}function gE(e,t,n){return Co(n)?ee(e):xt(e,t,n)}function hE(e,t,n){return Zt(n)?ee(e):xt(e,t,n)}function bE(e,t,n){return Jt(t)?Jt(n)?ee(e):we():ee(e)}function xE(e,t,n){return Qt(n)&&Es(n.extends)?we():kt(Qe(e,t,n),r=>bE(r,t,n),()=>we())}function kE(e,t){return e.reduce((n,r)=>r in t&&qt(t[r])?{...n,...t[r].inferred}:Pt(),{})}function yE(e,t,n){const r={};for(const i of D(n))r[i]=i in t?xE({},t[i],n[i]):Jt(n[i])?Qt(n[i])?ee(ft(e,{[n[i].name]:n[i].extends})):ee(e):we();const s=Zc(r).every(i=>qt(i)),o=s?kE(D(r),r):{};return s?ee(o):we()}function SE(e,t,n){const r=yE(e,t,n);return qt(r)?ee(ft(e,r.inferred)):we()}function wE(e,t,n){return SE(e,t,n)}function vE(e,t){return D(t).reduce((n,r)=>({...n,[r]:C(e,r)?ie(n[r])?Ge([...n[r].anyOf,t[r]]):Ge([e[r],t[r]]):t[r]}),e)}function Vp(e,t,n,r){return Te(t,(s,o)=>kt(Qe({},e[s],n),i=>Vp(e,o,n,vE(r,i)),()=>we()),()=>ee(r))}function IE(e,t,n,r){const s=D(t);return Vp(t,s,r,e)}function jE(e,t,n){return Tt(n)?IE(e,t,pn(n),Lt(n)):Le(n)?wE(e,t,n.properties):xt(e,$e(t),n)}function CE(e,t){return h(D(t).length,0)?ee(e):we()}function TE(e,t,n,r,s){return Qe(e,n,s)}function EE(e,t,n,r){return Tt(r)?TE(e,cc(t),n,cc(pn(r)),Lt(r)):Le(r)?CE(e,r.properties):Cn(r)||yn(r)?ee(e):we()}function AE(e,t,n){return Tn(n)?ee(e):xt(e,t,n)}function PE(e,t,n){return To(n)?ee(e):xt(e,t,n)}function NE(e,t,n){const r=Qn(t);return Qe(e,r,n)}function mc(e,t){return ye({"~kind":"Inferrable"},{name:e,type:t},{})}function Rl(e){return re(e)&&C(e,"~kind")&&C(e,"name")&&C(e,"type")&&h(e["~kind"],"Inferrable")&&oe(e.name)&&re(e.type)}function Wp(e){return na(e)?Qt(e.items)?ut(e.items.extends)?mc(e.items.name,e.items.extends.items):yn(e.items.extends)?mc(e.items.name,e.items.extends):void 0:Pt():void 0}function Jp(e){return Qt(e)?mc(e.name,e.extends):void 0}function Ml(e,t,n=[]){return Te(e,(r,s)=>kt(Qe({},r,t),()=>Ml(s,t,[...n,r]),()=>{}),()=>n)}function $E(e,t,n,r){const s=Ml(n,r);return z(s)?ee(ft(e,{[t]:mn(s)})):we()}function Qp(e,t,n,r){const s=Ml(n,r);return z(s)?ee(ft(e,{[t]:Ge(s)})):we()}function RE(e){return[...e].reverse()}function pc(e,t){return t?RE(e):e}function ME(e){const t=e.length>0?e[0]:void 0,n=Wt(t)?Wp(t):void 0;return Wt(n)}function OE(e,t,n,r,s,o){return kt(Qe(e,n,s),i=>Yp(i,t,r,o),()=>we())}function FE(e,t,n,r,s){const o=Wp(r);return Rl(o)?$E(e,o.name,pc(n,t),o.type):Te(n,(i,a)=>OE(e,t,i,a,r,s),()=>we())}function _E(e,t,n,r){return Te(r,(s,o)=>FE(e,t,n,s,o),()=>h(n.length,0)?ee(e):we())}function Yp(e,t,n,r){return _E(e,t,n,r)}function DE(e,t,n){const r=_o(e,Rt([],[]),n),s=ME(r);return Yp(e,s,pc(t,s),pc(r,s))}function Xp(e,t,n){const r=Jp(n);return Rl(r)?Qp(e,r.name,t,r.type):Te(t,(s,o)=>kt(Qe(e,s,n),i=>Xp(i,o,n),()=>we()),()=>ee(e))}function LE(e,t,n){const r=_o(e,Rt([],[]),t);return rt(n)?DE(e,r,n.items):ut(n)?Xp(e,r,n.items):xt(e,mn(r),n)}function UE(e,t,n){return Zr(n)||Ns(n)?ee(e):xt(e,t,n)}function Zp(e,t,n){return Te(n,(r,s)=>kt(Qe(e,t,r),o=>ee(o),()=>Zp(e,t,s)),()=>we())}function gc(e,t,n){return Te(t,(r,s)=>kt(Zp(e,r,n),o=>gc(o,s,n),()=>we()),()=>ee(e))}function BE(e,t,n){const r=Jp(n);return Rl(r)?Qp(e,r.name,t,r.type):ie(n)?gc(e,t,n.anyOf):gc(e,t,[n])}function qE(e,t,n){return Qt(n)?xt(e,t,n):Cn(n)||yn(n)?ee(e):we()}function HE(e,t,n){return Zr(n)?ee(e):xt(e,t,n)}function Qe(e,t,n){return Cn(t)?JT(e,t,n):ut(t)?YT(e,t,t.items,n):Xr(t)?XT(e,t,n):wr(t)?ZT(e,t,n):ln(t)?rE(e,t.parameters,t.instanceType,n):dn(t)?sE(e,t.if,t.then,t.else,n):fn(t)?oE(e,t.enum,n):un(t)?iE(e,t.parameters,t.returnType,n):$n(t)?aE(e,t,n):Ue(t)?cE(e,t.allOf,n):Ve(t)?mE(e,t,n):Es(t)?pE(e,t,n):Co(t)?gE(e,t,n):Zt(t)?hE(e,t,n):Le(t)?jE(e,t.properties,n):Tt(t)?EE(e,pn(t),Lt(t),n):Tn(t)?AE(e,t,n):To(t)?PE(e,t,n):Ut(t)?NE(e,t.pattern,n):rt(t)?LE(e,t.items,n):Ns(t)?UE(e,t,n):ie(t)?BE(e,t.anyOf,n):yn(t)?qE(e,t,n):Zr(t)?HE(e,t,n):we()}function KE(e,t){return en([...e,$e(t)])}function eg(e,t,n){return Ye(e)?ue(KE(e,t),{},n):Ol(e,t,n)}function zE(e,t,n,r,s){const o=Bn(e,t,n),i=Jl(e,t,r);return eg(o,i,s)}function Ol(e,t,n={}){return Ae("Interface",[e,t],n)}function Fl(e){return Wt(e)&&C(e,"action")&&h(e.action,"Interface")}function GE(e,t,n={}){return eg(e,t,n)}function VE(e,t,n){return e.includes(n)?!0:uo([...e,n],t,t[n])}function Pd(e,t,n){const r=om(n);return Fr(e,t,r)}function Fr(e,t,n){return Te(n,(r,s)=>uo(e,t,r)?!0:Fr(e,t,s),()=>!1)}function uo(e,t,n){return ht(n)?VE(e,t,n.$ref):ut(n)?uo(e,t,n.items):ln(n)?Fr(e,t,[...n.parameters,n.instanceType]):un(n)?Fr(e,t,[...n.parameters,n.returnType]):Fl(n)?Pd(e,t,n.parameters[1]):Ue(n)?Fr(e,t,n.allOf):Le(n)?Pd(e,t,n.properties):ie(n)?Fr(e,t,n.anyOf):rt(n)?Fr(e,t,n.items):Tt(n)?uo(e,t,Lt(n)):!1}function WE(e,t,n){return uo(e,t,n)}function JE(e,t){return t.reduce((n,r)=>WE([r],e,e[r])?[...n,r]:n,[])}function QE(e){const t=sm(e);return JE(e,t)}function YE(e,t,n){return n.includes(t)?n:t in e?fo(e,e[t],[...n,t]):Pt()}function Nd(e,t,n){const r=om(t);return bs(e,r,n)}function bs(e,t,n){return t.reduce((r,s)=>fo(e,s,r),n)}function fo(e,t,n){return ht(t)?YE(e,t.$ref,n):ut(t)?fo(e,t.items,n):ln(t)?bs(e,[...t.parameters,t.instanceType],n):un(t)?bs(e,[...t.parameters,t.returnType],n):Fl(t)?Nd(e,t.parameters[1],n):Ue(t)?bs(e,t.allOf,n):Le(t)?Nd(e,t.properties,n):ie(t)?bs(e,t.anyOf,n):rt(t)?bs(e,t.items,n):Tt(t)?fo(e,Lt(t),n):n}function XE(e,t,n){return fo(e,n,[t])}function ZE(e){return cl()}function eA(e){return D(e).reduce((t,n)=>({...t,[n]:Dr(e[n])}),{})}function Js(e){return e.reduce((t,n)=>[...t,Dr(n)],[])}function Dr(e){return ht(e)?ZE(e.$ref):ut(e)?Sr(Dr(e.items),il(e)):ln(e)?wo(Js(e.parameters),Dr(e.instanceType)):un(e)?vo(Js(e.parameters),Dr(e.returnType)):Ue(e)?Pn(Js(e.allOf)):Le(e)?$e(eA(e.properties)):Tt(e)?gl(ea(e),Dr(Lt(e))):ie(e)?Ge(Js(e.anyOf)):rt(e)?mn(Js(e.items)):e}function tA(e,t){return t in e?Dr(e[t]):_t()}function nA(e){return tA(e.$defs,e.$ref)}function rA(e,t,n){const r=Bn(e,Rt([],[]),t),s=Jl({},Rt([],[]),n);return en([...r,$e(s)])}function sA(e,t){return D(e).filter(r=>t.includes(r)).reduce((r,s)=>{const o=e[s],i=Fl(o)?rA(e,o.parameters[0],o.parameters[1]):o;return{...r,[s]:i}},{})}function oA(e,t,n){const r=XE(e,t,n),s=sA(e,r);return jo(s,t)}function tg(e,t){return t in e?ht(e[t])?tg(e,e[t].$ref):e[t]:Ct()}function Ro(e,t){return tg(e,t)}function $d(e){return Dt(e)?nA(e):im(e)?_t():e}function Wn(e,t,n){const r=$d(t),s=$d(n);return Qe(e,r,s)}const _l="equal",iA="disjoint",Dl="left-inside",Ll="right-inside";function ia(e,t){const n=[yn(e)?we():Wn({},e,t),yn(e)?ee({}):Wn({},t,e)];return qt(n[0])&&qt(n[1])?_l:qt(n[0])&&fc(n[1])?Dl:fc(n[0])&&qt(n[1])?Ll:iA}function aA(e,t){return t.filter(n=>ia(e,n)!==Ll)}function cA(e,t){const n=t.some(r=>{const s=ia(e,r);return h(s,Dl)||h(s,_l)});return h(n,!1)}function lA(e,t){const n=Hr(e);return Cn(n)?[n]:cA(n,t)?[...aA(n,t),n]:t}function uA(e){return e.reduce((t,n)=>Le(n)?[...t,n]:Es(n)?t:lA(n,t),[])}function ng(e){const t=uA(e);return Yi(t)}function rg(e,t){return ue(Hr(e),{},t)}function dA(e,t,n,r){const s=V(e,t,n);return rg(s,r)}function Zs(e,t=[]){return ws(e)&&h(e.action,"Conditional")?ht(e.parameters[0])?Zs(e.parameters[2],Zs(e.parameters[3],[...t,e.parameters[0].$ref])):Zs(e.parameters[2],Zs(e.parameters[3],t)):ws(e)&&h(e.action,"Mapped")&&ws(e.parameters[1])&&h(e.parameters[1].action,"KeyOf")&&ht(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function fA(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function sg(e,t,n=[]){return Te(e,(r,s)=>Te(t,(o,i)=>sg(s,i,[...n,[o,r]]),()=>n),()=>n)}function mA(e){return Ut(e)?Qn(e.pattern):fn(e)?vr(e.enum):e}function pA(e){const t=mA(e);return ie(t)?[...t.anyOf]:[t]}function gA(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Rd(e,t){return t.reduce((n,r)=>[...n,...gA(e,r)],[])}function Md(e){return e.reduce((t,n)=>h(n[0],!0)?Rd(t,pA(n[1])):Rd(t,[n[1]]),[[]])}function hA(e,t,n){const r=Zs(n),s=fA(e,r),o=sg(t,s);return ws(n)&&h(n.action,"Conditional")||ws(n)&&h(n.action,"Mapped")?Md(o):[t]}function bA(){return["(not-resolvable)",Ct()]}function xA(){return["(not-generic)",Ct()]}function kA(e,t,n){return[e,Io(t,n)]}function yA(e,t,n){return t in e?og(e,t,e[t]):bA()}function og(e,t,n,r){return al(n)?kA(t,n.parameters,n.expression):ht(n)?yA(e,n.$ref):xA()}function SA(e,t,n){return og(e,"(anonymous)",t)}function wA(e,t,n){if(Qt(t)||Bl(t)||qt(Wn({},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 Od(e,t,n,r,s){const o=V(e,t,s);return wA(n,o,r),ft(e,{[n]:o})}function vA(e,t,n,r,s){const o=V(e,t,n.extends),i=V(e,t,n.equals);return Te(s,(a,l)=>hc(Od(e,t,n.name,o,a),t,r,l),()=>hc(Od(e,t,n.name,o,i),t,r,[]))}function hc(e,t,n,r){return Te(n,(s,o)=>vA(e,t,s,o,r),()=>e)}function IA(e,t,n,r){return hc(e,t,n,r)}let bc=0,Ul=0;function jA(){if(!xo(Ul,So().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function CA(){jA(),Ul++,bc++}function TA(){bc--,h(bc,0)&&(Ul=0)}function EA(e){return Wr(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function AA(e,t){return h(EA(e),t)}function PA(e,t,n,r,s,o){CA();try{const i=IA(e,t,r,o),a=V(i,Rt([...t.callstack,n.$ref],t.visited),s);return V(i,Rt([],[]),a)}finally{TA()}}function NA(e,t,n,r,s,o){return o.reduce((i,a)=>{const l=PA(e,t,n,r,s,a);return[...i,l]},[])}function $A(e,t,n,r,s,o){const i=hA(r,o,s),a=NA(e,t,n,r,s,i);return h(a.length,1)?a[0]:Yn(a)}function ig(e,t,n,r){const s=Bn(e,t,r),o=SA(e,n),i=o[0],a=o[1];return al(a)?AA(t,i)?xc(on(i),s):$A(e,t,on(i),a.parameters,a.expression,s):xc(n,s)}function xc(e,t){return ye({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function RA(e,t){return ig({},Rt([],[]),e,t)}function Bl(e){return Ie(e,"Call")}function MA(e){return jn(e,["~immutable"])}function OA(e,t){return ue(MA(e),{},t)}function FA(e,t,n,r){const s=V(e,t,n);return OA(s,r)}function _A(e,t){return e(t)}function DA(e,t){return oe(t)?_e(_A(e,t)):_e(t)}function LA(e,t){const n=Qn(t);return $s(e,n)}function UA(e,t){const n=t.map(r=>$s(e,r));return Ge(n)}function $s(e,t){return Ve(t)?DA(e,t.const):Ut(t)?LA(e,t.pattern):ie(t)?UA(e,t.anyOf):t}function ag(e,t={}){return Ae("Capitalize",[e],t)}function BA(e,t={}){return dg(e,t)}function cg(e,t={}){return Ae("Lowercase",[e],t)}function qA(e,t={}){return fg(e,t)}function lg(e,t={}){return Ae("Uncapitalize",[e],t)}function HA(e,t={}){return mg(e,t)}function ug(e,t={}){return Ae("Uppercase",[e],t)}function KA(e,t={}){return pg(e,t)}const zA=e=>e[0].toUpperCase()+e.slice(1),GA=e=>e.toLowerCase(),VA=e=>e[0].toLowerCase()+e.slice(1),WA=e=>e.toUpperCase();function dg(e,t){return Ye([e])?ue($s(zA,e),{},t):ag(e,t)}function fg(e,t){return Ye([e])?ue($s(GA,e),{},t):cg(e,t)}function mg(e,t){return Ye([e])?ue($s(VA,e),{},t):lg(e,t)}function pg(e,t){return Ye([e])?ue($s(WA,e),{},t):ug(e,t)}function JA(e,t,n,r){const s=V(e,t,n);return dg(s,r)}function QA(e,t,n,r){const s=V(e,t,n);return fg(s,r)}function YA(e,t,n,r){const s=V(e,t,n);return mg(s,r)}function XA(e,t,n,r){const s=V(e,t,n);return pg(s,r)}function gg(e,t,n,r,s={}){return Ae("Conditional",[e,t,n,r],s)}function ZA(e,t,n,r,s={}){return hg({},Rt([],[]),e,t,n,r,s)}function e1(e,t,n,r,s,o){const i=Wn(e,n,r);return Pl(i)?Ge([V(i.inferred,t,s),V(e,t,o)]):Nl(i)?V(i.inferred,t,s):V(e,t,o)}function hg(e,t,n,r,s,o,i){return Ye([n,r])?ue(e1(e,t,n,r,s,o),{},i):gg(n,r,s,o,i)}function t1(e,t,n,r,s,o,i){const a=V(e,t,n),l=V(e,t,r);return hg(e,t,a,l,s,o,i)}function bg(e,t={}){return Ae("ConstructorParameters",[e],t)}function n1(e,t={}){return xg(e,t)}function r1(e){const t=ln(e)?e.parameters:[],n=_o({},Rt([],[]),t);return mn(n)}function xg(e,t){return Ye([e])?ue(r1(e),{},t):bg(e,t)}function s1(e,t,n,r){const s=V(e,t,n);return xg(s,r)}function kg(e,t,n={}){return Ae("Exclude",[e,t],n)}function o1(e,t,n={}){return ql(e,t,n)}function ql(e,t,n){return Ye([e,t])?ue(Dm(e,t),{},n):kg(e,t,n)}function i1(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return ql(o,i,s)}function yg(e,t,n={}){return Ae("Extract",[e,t],n)}function a1(e,t,n={}){return Sg(e,t,n)}function c1(e,t){const n=Wn({},e,t);return qt(n)?[e]:[]}function l1(e,t){return e.reduce((n,r)=>[...n,...c1(r,t)],[])}function u1(e,t){const n=Hr(e),r=ie(n)?n.anyOf:[n],s=l1(r,t);return Yn(s)}function Sg(e,t,n){return Ye([e,t])?ue(u1(e,t),{},n):yg(e,t,n)}function d1(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Sg(o,i,s)}function f1(e){return e.reduce((t,n)=>bm(n)?[...t,_e(n)]:t,[])}function Hl(e){const t=f1(e);return Ge(t)}function Kl(e,t,n={}){return Ae("Index",[e,t],n)}function m1(e,t,n={}){const r=z(t)?Hl(t):t;return Cg(e,r,n)}function p1(e,t){const n=Ro(e,t);return ts(n)}function g1(e,t,n){const r=As(e,t,n);return ts(r)}function h1(e,t){const n=D(e).filter(f=>!C(t,f)),r=D(t).filter(f=>!C(e,f)),s=D(e).filter(f=>C(t,f)),o=n.reduce((f,p)=>({...f,[p]:e[p]}),{}),i=r.reduce((f,p)=>({...f,[p]:t[p]}),{}),a=s.reduce((f,p)=>({...f,[p]:en([e[p],t[p]])}),{}),l=ft(o,i);return ft(l,a)}function b1(e){return e.reduce((t,n)=>h1(t,ts(n)),{})}function x1(e){const t=Jw(mn(e));return ts(t)}function k1(e,t){return D(e).filter(s=>s in t).reduce((s,o)=>({...s,[o]:Yn([e[o],t[o]])}),{})}function wg(e,t){return Te(e,(n,r)=>wg(r,k1(t,ts(n))),()=>t)}function y1(e){return Te(e,(t,n)=>wg(n,ts(t)),()=>Pt())}function ts(e){return Dt(e)?p1(e.$defs,e.$ref):dn(e)?g1(e.if,e.then,e.else):Ue(e)?b1(e.allOf):ie(e)?y1(e.anyOf):rt(e)?x1(e.items):Le(e)?e.properties:{}}function zl(e){const t=ts(e);return $e(t)}const S1=new RegExp("^(?:0|[1-9][0-9]*)$");function Gl(e){const t=`${e}`;return S1.test(t)?parseInt(t):e}function w1(e){return _e(Gl(e))}function Fd(e){return e.map(t=>vg(t))}function vg(e){return Ue(e)?Pn(Fd(e.allOf)):ie(e)?Ge(Fd(e.anyOf)):Ve(e)?w1(e.const):e}function v1(e,t){const n=vg(t),r=Wn({},n,br());return qt(r)?e:Ve(t)&&h(t.const,"length")?br():Ct()}function I1(e,t){const n=Ro(e,t);return ns(n)}function j1(e,t,n){const r=As(e,t,n);return ns(r)}function C1(e){const t=vr(e);return ns(t)}function T1(e){const t=en(e);return ns(t)}function E1(e){return[`${e}`]}function A1(e){const t=Qn(e);return ns(t)}function P1(e){return e.reduce((t,n)=>[...t,...ns(n)],[])}function ns(e){return Dt(e)?I1(e.$defs,e.$ref):dn(e)?j1(e.if,e.then,e.else):fn(e)?C1(e.enum):Ue(e)?T1(e.allOf):Ve(e)?E1(e.const):Ut(e)?A1(e.pattern):ie(e)?P1(e.anyOf):[]}function Vl(e){return ns(e)}function Qs(e,t){return t.map(n=>so(e,n))}function so(e,t){return ut(t)?Sr(so(e,t.items)):ln(t)?wo(Qs(e,t.parameters),so(e,t.instanceType)):un(t)?vo(Qs(e,t.parameters),so(e,t.returnType)):rt(t)?mn(Qs(e,t.items)):ie(t)?Ge(Qs(e,t.anyOf)):Ue(t)?Pn(Qs(e,t.allOf)):qm(t)?$e(e):t}function N1(e,t){return so(e,t)}function $1(e,t){const n=t in e?e[t]:Ct();return N1(e,n)}function Ig(e,t){return t.reduce((n,r)=>[...n,$1(e,r)],[])}function R1(e,t){const n=Vl(t),r=Ig(e,n);return Yn(r)}const M1=new RegExp(Ao);function O1(e){return e.filter(n=>M1.test(n))}function F1(e){const t=sm(e),n=O1(t),r=Ig(e,n);return Yn(r)}function _1(e,t){return Zt(t)?F1(e):R1(e,t)}function D1(e){return _e(Gl(e))}function _d(e){return e.map(t=>jg(t))}function jg(e){return Ue(e)?Pn(_d(e.allOf)):ie(e)?Ge(_d(e.anyOf)):Ve(e)?D1(e.const):e}function L1(e,t){return e.reduceRight((n,r,s)=>{const o=Wn({},_e(s),t);return qt(o)?[r,...n]:n},[])}function U1(e,t){const n=jg(t),r=L1(e,n);return Ps(r)}function B1(e){return Ps(e)}function q1(e,t){return Ve(t)&&h(t.const,"length")?_e(e.length):Zt(t)||$n(t)?B1(e):U1(e,t)}function H1(e,t){return ut(e)?v1(e.items,t):Le(e)?_1(e.properties,t):rt(e)?q1(e.items,t):Ct()}function K1(e){return Dt(e)||dn(e)||Ue(e)||ie(e)?zl(e):e}function Cg(e,t,n){return Ye([e,t])?ue(H1(K1(e),t),{},n):Kl(e,t,n)}function z1(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Cg(o,i,s)}function Tg(e,t={}){return Ae("InstanceType",[e],t)}function G1(e,t={}){return Eg(e,t)}function V1(e){return ln(e)?e.instanceType:Ct()}function Eg(e,t){return Ye([e])?ue(V1(e),{},t):Tg(e,t)}function W1(e,t,n,r={}){const s=V(e,t,n);return Eg(s,r)}function Wl(e,t={}){return Ae("KeyOf",[e],t)}function J1(e,t={}){return Ag(e,t)}function Q1(){return Ge([br(),Rn(),ml()])}function Y1(e){return br()}function X1(e){return e.reduce((n,r)=>bm(r)?[...n,_e(Gl(r))]:Pt(),[])}function Z1(e){const t=D(e),n=X1(t);return Ps(n)}function eP(e){return ea(e)}function tP(e){const t=e.map((n,r)=>_e(r));return Ps(t)}function nP(e){return Cn(e)?Q1():ut(e)?Y1(e.items):Le(e)?Z1(e.properties):Tt(e)?eP(e):rt(e)?tP(e.items):Ct()}function rP(e){return Dt(e)||dn(e)||Ue(e)||ie(e)?zl(e):e}function Ag(e,t){return Ye([e])?ue(nP(rP(e)),{},t):Wl(e,t)}function sP(e,t,n,r){const s=V(e,t,n);return Ag(s,r)}function kc(e,t,n,r,s={}){return Ae("Mapped",[e,t,n,r],s)}function oP(e,t,n,r,s={}){return Pg({},Rt([],[]),e,t,n,r,s)}function iP(e){const t=Qn(e);return aa(t)}function aP(e){return e.reduce((t,n)=>[...t,...aa(n)],[])}function cP(e){const t=vr(e);return aa(t)}function lP(e){return ve(e)?[_e(`${e}`)]:[_e(e)]}function aa(e){return fn(e)?cP(e.enum):Ve(e)?lP(e.const):Ut(e)?iP(e.pattern):ie(e)?aP(e.anyOf):[e]}function uP(e){return aa(e)}function dP(e){return Ut(e)?Qn(e.pattern):e}function fP(e,t,n,r,s,o){const i=ft(e,{[n.name]:r}),a=V(i,t,s),l=dP(a),u=V(i,t,o);return xm(l)||km(l)?{[l.const]:u}:{}}function mP(e,t,n,r,s,o){return r.reduce((i,a)=>[...i,fP(e,t,n,a,s,o)],[])}function pP(e){return e.reduce((t,n)=>[...t,$e(n)],[])}function gP(e,t,n,r,s,o){const i=uP(r),a=mP(e,t,n,i,s,o),l=pP(a);return en(l)}function Pg(e,t,n,r,s,o,i){return Ye([r])?ue(gP(e,t,n,r,s,o),{},i):kc(n,r,s,o,i)}function hP(e,t,n,r,s,o,i){const a=V(e,t,r);return Pg(e,t,n,a,s,o,i)}function bP(e,t,n){const r=ft(e,t);return D(t).filter(o=>n.includes(o)).reduce((o,i)=>({...o,[i]:oA(r,i,t[i])}),{})}function xP(e,t,n){const r=ft(e,t);return D(t).filter(o=>!n.includes(o)).reduce((o,i)=>({...o,[i]:V(r,Rt([],[]),t[i])}),{})}function kP(e,t,n){const r=QE(t),s=bP(e,t,r),o=xP(e,t,r),i={...s,...o};return ue(i,{},n)}function Ng(e,t,n,r){return kP(e,n,r)}function $g(e,t={}){return Ae("NonNullable",[e],t)}function yP(e,t={}){return Rg(e,t)}function SP(e){const t=Ge([fl(),hl()]);return ql(e,t,{})}function Rg(e,t){return Ye([e])?ue(SP(e),{},t):$g(e,t)}function wP(e,t,n,r){const s=V(e,t,n);return Rg(s,r)}function Mg(e,t,n={}){return Ae("Omit",[e,t],n)}function vP(e,t,n={}){const r=z(t)?Hl(t):t;return Fg(e,r,n)}function Og(e){const t=zl(e);return Le(t)?t.properties:Pt()}function IP(e,t){return D(e).reduce((r,s)=>t.includes(s)?r:{...r,[s]:e[s]},{})}function jP(e,t){const n=Og(e),r=Vl(t),s=IP(n,r);return $e(s)}function Fg(e,t,n){return Ye([e,t])?ue(jP(e,t),{},n):Mg(e,t,n)}function CP(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Fg(o,i,s)}function _g(e,t={}){return Ae("Parameters",[e],t)}function TP(e,t={}){return Dg(e,t)}function EP(e){const t=un(e)?e.parameters:[],n=_o({},Rt([],[]),t);return mn(n)}function Dg(e,t){return Ye([e])?ue(EP(e),{},t):_g(e,t)}function AP(e,t,n,r){const s=V(e,t,n);return Dg(s,r)}function Lg(e,t={}){return Ae("Partial",[e],t)}function PP(e,t={}){return Ug(e,t)}function NP(e,t){const n=Ro(e,t),r=Mo(n);return jo(ft(e,{[t]:r}),t)}function $P(e,t,n){const r=As(e,t,n);return Mo(r)}function RP(e){const t=en(e);return Mo(t)}function MP(e){const t=e.map(n=>Mo(n));return Ge(t)}function OP(e){const t=D(e).reduce((r,s)=>({...r,[s]:Ci(e[s])}),{});return $e(t)}function Mo(e){return Dt(e)?NP(e.$defs,e.$ref):dn(e)?$P(e.if,e.then,e.else):Ue(e)?RP(e.allOf):ie(e)?MP(e.anyOf):Le(e)?OP(e.properties):$e({})}function Ug(e,t){return Ye([e])?ue(Mo(e),{},t):Lg(e,t)}function FP(e,t,n,r){const s=V(e,t,n);return Ug(s,r)}function Bg(e,t,n={}){return Ae("Pick",[e,t],n)}function _P(e,t,n={}){const r=z(t)?Hl(t):t;return qg(e,r,n)}function DP(e,t){return D(e).reduce((r,s)=>t.includes(s)?ft(r,{[s]:e[s]}):r,{})}function LP(e,t){const n=Og(e),r=Vl(t),s=DP(n,r);return $e(s)}function qg(e,t,n){return Ye([e,t])?ue(LP(e,t),{},n):Bg(e,t,n)}function UP(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return qg(o,i,s)}function Hg(e,t={}){return Ae("ReadonlyObject",[e],t)}function Kg(e,t={}){return zg(e,t)}const BP=Kg;function qP(e){return Yl(Sr(e))}function HP(e,t){const n=Ro(e,t),r=Oo(n);return jo(ft(e,{[t]:r}),t)}function KP(e,t,n){const r=As(e,t,n);return Oo(r)}function zP(e){const t=en(e);return Oo(t)}function GP(e){const t=D(e).reduce((r,s)=>({...r,[s]:Ai(e[s])}),{});return $e(t)}function VP(e){return Yl(mn(e))}function WP(e){const t=e.map(n=>Oo(n));return Ge(t)}function Oo(e){return ut(e)?qP(e.items):Dt(e)?HP(e.$defs,e.$ref):dn(e)?KP(e.if,e.then,e.else):Ue(e)?zP(e.allOf):Le(e)?GP(e.properties):rt(e)?VP(e.items):ie(e)?WP(e.anyOf):e}function zg(e,t){return Ye([e])?ue(Oo(e),{},t):Hg(e)}function JP(e,t,n,r){const s=V(e,t,n);return zg(s,r)}function QP(e,t,n,r){return t.visited.includes(r)?n:r in e?V(e,Rt(t.callstack,[...t.visited,r]),e[r]):n}function YP(e,t){const n=Ro(e,t),r=Fo(n);return jo(ft(e,{[t]:r}),t)}function XP(e,t,n){const r=As(e,t,n);return Fo(r)}function ZP(e){const t=en(e);return Fo(t)}function eN(e){const t=e.map(n=>Fo(n));return Ge(t)}function tN(e){const t=D(e).reduce((r,s)=>({...r,[s]:Mm(e[s])}),{});return $e(t)}function Fo(e){return Dt(e)?YP(e.$defs,e.$ref):dn(e)?XP(e.if,e.then,e.else):Ue(e)?ZP(e.allOf):ie(e)?eN(e.anyOf):Le(e)?tN(e.properties):$e({})}function Gg(e,t={}){return Ae("Required",[e],t)}function nN(e,t={}){return Vg(e,t)}function Vg(e,t){return Ye([e])?ue(Fo(e),{},t):Gg(e,t)}function rN(e,t,n,r){const s=V(e,t,n);return Vg(s,r)}function Wg(e,t={}){return Ae("ReturnType",[e],t)}function sN(e,t={}){return Jg(e,t)}function oN(e){return un(e)?e.returnType:Ct()}function Jg(e,t){return Ye([e])?ue(oN(e),{},t):Wg(e,t)}function iN(e,t,n,r={}){const s=V(e,t,n);return Jg(s,r)}function Qg(e,t){return Ae("With",[e,t],{})}function Yg(e,t){return Xg(e,t)}function Xg(e,t){return Ye([e])?ue(e,{},t):Qg(e,t)}function aN(e,t,n,r){const s=V(e,t,n);return Xg(s,r)}function cN(e){return na(e)?rt(e.items)?Zg(e.items.items):Qt(e.items)?[e]:ht(e.items)?[e]:[Ct()]:[e]}function Zg(e){return e.reduce((n,r)=>[...n,...cN(r)],[])}function Rt(e,t){return{callstack:e,visited:t}}function Ye(e){return Te(e,(t,n)=>ht(t)?!1:Ye(n),()=>!0)}function Jl(e,t,n){return D(n).reduce((r,s)=>({...r,[s]:V(e,t,n[s])}),{})}function _o(e,t,n){const r=Bn(e,t,n);return Zg(r)}function Bn(e,t,n){return n.map(r=>V(e,t,r))}function lN(e,t){const n=Jt(e)?ol(t,{}):t,r=Pi(e)?sl(n,{}):n;return Ei(e)?Ql(r,{}):r}function uN(e,t,n,r,s){return h(n,"AddImmutable")?mN(e,t,r[0],s):h(n,"RemoveImmutable")?FA(e,t,r[0],s):h(n,"AddReadonly")?MS(e,t,r[0],s):h(n,"RemoveReadonly")?Hw(e,t,r[0],s):h(n,"AddOptional")?FS(e,t,r[0],s):h(n,"RemoveOptional")?Vw(e,t,r[0],s):h(n,"Capitalize")?JA(e,t,r[0],s):h(n,"Conditional")?t1(e,t,r[0],r[1],r[2],r[3],s):h(n,"ConstructorParameters")?s1(e,t,r[0],s):h(n,"Evaluate")?dA(e,t,r[0],s):h(n,"Exclude")?i1(e,t,r[0],r[1],s):h(n,"Extract")?d1(e,t,r[0],r[1],s):h(n,"Index")?z1(e,t,r[0],r[1],s):h(n,"InstanceType")?W1(e,t,r[0],s):h(n,"Interface")?zE(e,t,r[0],r[1],s):h(n,"KeyOf")?sP(e,t,r[0],s):h(n,"Lowercase")?QA(e,t,r[0],s):h(n,"Mapped")?hP(e,t,r[0],r[1],r[2],r[3],s):h(n,"Module")?Ng(e,t,r[0],s):h(n,"NonNullable")?wP(e,t,r[0],s):h(n,"Pick")?UP(e,t,r[0],r[1],s):h(n,"Parameters")?AP(e,t,r[0],s):h(n,"Partial")?FP(e,t,r[0],s):h(n,"Omit")?CP(e,t,r[0],r[1],s):h(n,"ReadonlyObject")?JP(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")?iN(e,t,r[0],s):h(n,"TemplateLiteral")?LT(e,t,r[0],s):h(n,"Uncapitalize")?YA(e,t,r[0],s):h(n,"Uppercase")?XA(e,t,r[0],s):h(n,"With")?aN(e,t,r[0],r[1]):Ae(n,r,s)}function dN(e,t,n){const r=ht(n)?QP(e,t,n,n.$ref):ut(n)?Sr(V(e,t,n.items),il(n)):Bl(n)?ig(e,t,n.target,n.arguments):ln(n)?wo(Bn(e,t,n.parameters),V(e,t,n.instanceType),_S(n)):un(n)?vo(Bn(e,t,n.parameters),V(e,t,n.returnType),DS(n)):dn(n)?Ti(V(e,t,n.if),V(e,t,n.then),V(e,t,n.else),KS(n)):Ue(n)?Pn(Bn(e,t,n.allOf),JS(n)):Le(n)?$e(Jl(e,t,n.properties),qS(n)):Tt(n)?Sv(pn(n),V(e,t,Lt(n))):na(n)?ta(V(e,t,n.items)):rt(n)?mn(_o(e,t,n.items),Bw(n)):ie(n)?Ge(Bn(e,t,n.anyOf),$w(n)):n;return lN(n,r)}function V(e,t,n){return ws(n)?uN(e,t,n.action,n.parameters,n.options):dN(e,t,n)}function Rs(e,t){return V(e,Rt([],[]),t)}function fN(e){return ue(e,{"~immutable":!0},{})}function Ql(e,t){return ue(fN(e),{},t)}function mN(e,t,n,r){const s=V(e,t,n);return Ql(s,r)}function pN(e,t={}){return Ae("AddImmutable",[e],t)}function Yl(e,t={}){return Ql(e,t)}function gN(e,t={}){return Ae("Evaluate",[e],t)}function Mn(e,t={}){return rg(e,t)}function hN(e,t={}){return Ae("Module",[e],t)}function bN(e,t={}){return Ng({},Rt([],[]),e,t)}function xN(e,t){const n=ia(e,t);return h(n,"right-inside")||h(n,"disjoint")?1:0}function eh(e,t,n=[]){return Te(t,(r,s)=>h(xN(e,r),1)?eh(e,s,[...n,r]):[...n,e,...t],()=>[...n,e])}function th(e,t=[]){return Te(e,(n,r)=>th(r,eh(n,t)),()=>t)}function kN(e){return th(e)}function yN(...e){const[t,n,r]=at(e,{2:(i,a)=>oe(i)?[{},i,a]:[i,a,{}],3:(i,a,l)=>[i,a,l],1:i=>[{},i,{}]}),s=IT(n),o=z(s)&&h(s.length,2)?V(t,Rt([],[]),s[0]):Ct();return ue(o,{},r)}const m=Object.freeze(Object.defineProperty({__proto__:null,Any:cl,Array:Sr,BigInt:dl,Boolean:gm,Call:RA,Capitalize:BA,Codec:ll,Conditional:ZA,Constructor:wo,ConstructorParameters:n1,Cyclic:jo,Decode:xw,DecodeBuilder:pm,Dependent:Ti,Encode:kw,EncodeBuilder:mm,Enum:WS,Evaluate:Mn,Exclude:o1,Extends:Wn,ExtendsResult:HT,Extract:a1,Function:vo,Generic:Io,Identifier:ac,Immutable:yw,Index:m1,Infer:oc,InstanceType:G1,Instantiate:Rs,Integer:Qi,Interface:GE,Intersect:Pn,IsAny:Cn,IsArray:ut,IsBigInt:Xr,IsBoolean:wr,IsCall:Bl,IsCodec:Yt,IsConstructor:ln,IsCyclic:Dt,IsDependent:dn,IsEnum:fn,IsEnumValue:VS,IsFunction:un,IsGeneric:al,IsIdentifier:Cw,IsImmutable:Ei,IsInfer:Qt,IsInteger:$n,IsIntersect:Ue,IsKind:Ie,IsLiteral:Ve,IsNever:Es,IsNull:Co,IsNumber:Zt,IsObject:Le,IsOptional:Jt,IsParameter:Nw,IsReadonly:Pi,IsRecord:Tt,IsRef:ht,IsRefine:ul,IsRest:na,IsSchema:Wt,IsString:Tn,IsSymbol:To,IsTemplateLiteral:Ut,IsThis:qm,IsTuple:rt,IsUndefined:Ns,IsUnion:ie,IsUnknown:yn,IsUnsafe:im,IsVoid:Zr,KeyOf:J1,Literal:_e,Lowercase:qA,Mapped:oP,Module:bN,Never:Ct,NonNullable:yP,Null:fl,Number:br,Object:$e,Omit:vP,Optional:US,Parameter:Eo,Parameters:TP,Partial:PP,Pick:_P,Readonly:Sw,ReadonlyObject:Kg,ReadonlyType:BP,Record:gl,RecordKey:ea,RecordPattern:pn,RecordValue:Lt,Ref:on,Refine:vw,Required:nN,Rest:ta,ReturnType:sN,Script:yN,String:Rn,Symbol:ml,TemplateLiteral:qT,This:Bm,Tuple:mn,Uncapitalize:HA,Undefined:hl,Union:Ge,Unknown:_t,Unsafe:HS,Uppercase:KA,Void:Hm,With:Yg},Symbol.toStringTag,{value:"Module"}));function ca(e){return C(e,"~refine")&&z(e["~refine"])&&lt(e["~refine"],0,t=>re(t)&&C(t,"check")&&C(t,"error")&&kn(t.check)&&kn(t.error))}function Xt(e){return re(e)&&!z(e)}function Do(e){return mt(e)}function De(e){return Xt(e)||Do(e)}function Lo(e){return C(e,"additionalItems")&&De(e.additionalItems)}function Zn(e){return C(e,"additionalProperties")&&De(e.additionalProperties)}function la(e){return C(e,"allOf")&&z(e.allOf)&&e.allOf.every(t=>De(t))}function Ri(e){return C(e,"$anchor")&&oe(e.$anchor)}function ua(e){return C(e,"anyOf")&&z(e.anyOf)&&e.anyOf.every(t=>De(t))}function da(e){return C(e,"const")}function rs(e){return C(e,"contains")&&De(e.contains)}function SN(e){return C(e,"contentEncoding")&&oe(e.contentEncoding)}function wN(e){return C(e,"contentMediaType")&&oe(e.contentMediaType)}function jr(e){return C(e,"default")}function vN(e){return C(e,"$defs")&&re(e.$defs)&&Object.values(e.$defs).every(t=>De(t))}function Uo(e){return C(e,"dependencies")&&re(e.dependencies)&&Object.values(e.dependencies).every(t=>De(t)||z(t)&&t.every(n=>oe(n)))}function Bo(e){return C(e,"dependentRequired")&&re(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>z(t)&&t.every(n=>oe(n)))}function qo(e){return C(e,"dependentSchemas")&&re(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>De(t))}function zr(e){return C(e,"$dynamicAnchor")&&oe(e.$dynamicAnchor)}function fa(e){return C(e,"$dynamicRef")&&oe(e.$dynamicRef)}function ma(e){return C(e,"else")&&De(e.else)}function pa(e){return C(e,"enum")&&z(e.enum)}function Ho(e){return C(e,"exclusiveMaximum")&&(ve(e.exclusiveMaximum)||et(e.exclusiveMaximum))}function Cr(e){return C(e,"exclusiveMinimum")&&(ve(e.exclusiveMinimum)||et(e.exclusiveMinimum))}function Ms(e){return C(e,"format")&&oe(e.format)}function kr(e){return C(e,"$id")&&oe(e.$id)}function ga(e){return C(e,"if")&&De(e.if)}function Tr(e){return C(e,"items")&&(De(e.items)||z(e.items)&&e.items.every(t=>De(t)))}function ha(e){return Tr(e)&&z(e.items)}function IN(e){return Tr(e)&&!z(e.items)}function Ko(e){return C(e,"maximum")&&(ve(e.maximum)||et(e.maximum))}function zo(e){return C(e,"maxContains")&&ve(e.maxContains)}function Os(e){return C(e,"maxItems")&&ve(e.maxItems)}function Go(e){return C(e,"maxLength")&&ve(e.maxLength)}function Vo(e){return C(e,"maxProperties")&&ve(e.maxProperties)}function Er(e){return C(e,"minimum")&&(ve(e.minimum)||et(e.minimum))}function ss(e){return C(e,"minContains")&&ve(e.minContains)}function os(e){return C(e,"minItems")&&ve(e.minItems)}function Fs(e){return C(e,"minLength")&&ve(e.minLength)}function _s(e){return C(e,"minProperties")&&ve(e.minProperties)}function Wo(e){return C(e,"multipleOf")&&(ve(e.multipleOf)||et(e.multipleOf))}function ba(e){return C(e,"not")&&De(e.not)}function xa(e){return C(e,"oneOf")&&z(e.oneOf)&&e.oneOf.every(t=>De(t))}function Ds(e){return C(e,"pattern")&&(oe(e.pattern)||e.pattern instanceof RegExp)}function is(e){return C(e,"patternProperties")&&re(e.patternProperties)&&Object.values(e.patternProperties).every(t=>De(t))}function er(e){return C(e,"prefixItems")&&z(e.prefixItems)&&e.prefixItems.every(t=>De(t))}function as(e){return C(e,"properties")&&re(e.properties)&&Object.values(e.properties).every(t=>De(t))}function Jo(e){return C(e,"propertyNames")&&(re(e.propertyNames)||De(e.propertyNames))}function nh(e){return C(e,"$recursiveAnchor")&&mt(e.$recursiveAnchor)}function bi(e){return nh(e)&&h(e.$recursiveAnchor,!0)}function ka(e){return C(e,"$recursiveRef")&&oe(e.$recursiveRef)}function ya(e){return C(e,"$ref")&&oe(e.$ref)}function tr(e){return C(e,"required")&&z(e.required)&&e.required.every(t=>oe(t))}function Sa(e){return C(e,"then")&&De(e.then)}function Qo(e){return C(e,"type")&&(oe(e.type)||z(e.type)&&e.type.every(t=>oe(t)))}function yr(e){return C(e,"uniqueItems")&&mt(e.uniqueItems)}function Ls(e){return C(e,"unevaluatedItems")&&De(e.unevaluatedItems)}function Us(e){return C(e,"unevaluatedProperties")&&De(e.unevaluatedProperties)}function jN(e){return Ls(e)||Us(e)||Ts(D(e),t=>Mi(e[t]))}function CN(e){return Ts(e,t=>Mi(t))}function Mi(e){return z(e)?CN(e):re(e)?jN(e):!1}function rh(e,t){return Mi(t)||Ts(D(e),n=>Mi(e[n]))}class sh{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return ze(le("context","Push"),[])}Pop(){return ze(le("context","Pop"),[])}AddIndex(t){return ze(le("context","AddIndex"),[t])}AddKey(t){return ze(le("context","AddKey"),[t])}Merge(t){return ze(le("context","Merge"),[t])}}class On{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 Xl extends On{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}}class Fn extends Xl{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}}const Oi={identifier:"External",variables:[]};function cs(e){const t=`External[${Oi.variables.length}]`;return Oi.variables.push(e),t}function oh(){Oi.variables=[]}function ih(){return{...Oi}}function ah(e,t,n,r){const s=cs(n["~refine"].map(o=>o));return Nn(s,G(0),["refinement","_"],ze(le("refinement","check"),[r]))}function ch(e,t,n,r){return lt(n["~refine"],0,(s,o)=>s.check(r))}function lh(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 TN=0;function it(){return`var_${TN++}`}function Zl(e){return Tr(e)&&z(e.items)}function EN(e,t,n,r){const[s,o]=[it(),it()],i=En(e,t,n.additionalItems,s),a=el(o,G(n.items.length)),l=t.AddIndex(o);return Nn(r,G(0),[s,o],He(a,yt(i,l)))}function AN(e,t,n,r){const[s,o]=[it(),it()],i=En(e,t,n.additionalItems,s),a=el(o,G(n.items.length));return Nn(r,G(0),[s,o],He(a,i))}function uh(e,t,n,r){return Zl(n)?t.UseUnevaluated()?EN(e,t,n,r):AN(e,t,n,r):G(!0)}function dh(e,t,n,r){return Zl(n)?lt(r,0,(o,i)=>xo(i,n.items.length)||Ar(e,t,n.additionalItems,o)&&t.AddIndex(i)):!0}function fh(e,t,n,r,s,o){return Zl(s)?lt(o,0,(a,l)=>{const u=`${n}/additionalItems`,f=`${r}/${l}`;return xo(l,s.items.length)||Pr(e,t,u,f,s.additionalItems,a)&&t.AddIndex(l)}):!0}function PN(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function eu(e){const t=[];return is(e)&&t.push(...D(e.patternProperties)),as(e)&&t.push(...D(e.properties).map(PN)),h(t.length,0)?"(?!)":`(${t.join("|")})`}function mh(e,t,n){return tr(t)&&as(t)&&!is(t)&&h(t.additionalProperties,!1)&&h(D(t.properties).length,t.required.length)}function ph(e,t,n){return Ht(le(ze(le("Object","getOwnPropertyNames"),[n]),"length"),G(t.required.length))}function gh(e,t,n,r){const[s,o]=[it(),it()],i=cs(new RegExp(eu(n))),a=En(e,t,n.additionalProperties,`${r}[${s}]`),l=ze(le(i,"test"),[s]),u=t.AddKey(s),f=t.UseUnevaluated()?He(l,yt(a,u)):He(l,a);return Nn(Yr(r),G(0),[s,o],f)}function hh(e,t,n,r){return mh(t,n)?ph(t,n,r):gh(e,t,n,r)}function bh(e,t,n,r){const s=new RegExp(eu(n));return lt(D(r),0,(i,a)=>s.test(i)||Ar(e,t,n.additionalProperties,r[i])&&t.AddKey(i))}function xh(e,t,n,r,s,o){const i=new RegExp(eu(s)),a=[];return jt(D(o),0,(u,f)=>{const p=`${n}/additionalProperties`,g=`${r}/${u}`,k=new Fn,b=i.test(u)||Pr(e,k,p,g,s.additionalProperties,o[u])&&t.AddKey(u);return b||a.push(u),b})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:r,params:{additionalProperties:a}})}function Yo(e,t,n,r,s){const o=Hn("results","[]"),i=n.map((f,p)=>Hn(`context_${p}`,tl("CheckContext",[]))),a=n.map((f,p)=>Hn(`condition_${p}`,ze(gr(["context"],st(e,t,f,r)),[`context_${p}`]))),l=n.map((f,p)=>Zf(`condition_${p}`,ze(le("results","push"),[`context_${p}`]))),u=Wi(yt(s,t.Merge("results")));return ze(gr([],Vi([o,...i,...a,...l,u])),[])}function NN(e,t,n,r){return Yo(e,t,n.allOf,r,Ht(le("results","length"),G(n.allOf.length)))}function $N(e,t,n,r){return vt(n.allOf.map(s=>st(e,t,s,r)))}function kh(e,t,n,r){return t.UseUnevaluated()?NN(e,t,n,r):$N(e,t,n,r)}function yh(e,t,n,r){const s=n.allOf.reduce((o,i)=>{const a=new On;return ot(e,a,i,r)?[...o,a]:o},[]);return h(s.length,n.allOf.length)&&t.Merge(s)}function Sh(e,t,n,r,s,o){const i=[],a=s.allOf.reduce((u,f,p)=>{const g=`${n}/allOf/${p}`,k=new Fn,b=It(e,k,g,r,f,o);return b||i.push(k),b?[...u,k]:u},[]),l=h(a.length,s.allOf.length)&&t.Merge(a);return l||i.forEach(u=>u.GetErrors().forEach(f=>t.AddError(f))),l}function RN(e,t,n,r){return Yo(e,t,n.anyOf,r,Qf(le("results","length"),G(0)))}function MN(e,t,n,r){return nl(n.anyOf.map(s=>st(e,t,s,r)))}function wh(e,t,n,r){return t.UseUnevaluated()?RN(e,t,n,r):MN(e,t,n,r)}function vh(e,t,n,r){const s=n.anyOf.reduce((o,i)=>{const a=new On;return ot(e,a,i,r)?[...o,a]:o},[]);return Wr(s.length,0)&&t.Merge(s)}function Ih(e,t,n,r,s,o){const i=[],a=s.anyOf.reduce((u,f,p)=>{const g=new Fn,k=`${n}/anyOf/${p}`,b=It(e,g,k,r,f,o);return b||i.push(g),b?[...u,g]:u},[]),l=Wr(a.length,0)&&t.Merge(a);return l||i.forEach(u=>u.GetErrors().forEach(f=>t.AddError(f))),l||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:r,params:{}})}function jh(e,t,n,r){return G(!!n)}function tu(e,t,n,r){return n}function Ch(e,t,n,r,s,o){return tu(e,t,s)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:r,params:{}})}function Th(e,t,n,r){return Cs(n.const)?Ht(r,G(n.const)):Xf(r,cs(n.const))}function nu(e,t,n,r){return Cs(n.const)?h(r,n.const):Jr(r,n.const)}function Eh(e,t,n,r,s,o){return nu(e,t,s,o)||t.AddError({keyword:"const",schemaPath:n,instancePath:r,params:{allowedValue:s.const}})}function Ah(e){return!(ss(e)&&h(e.minContains,0))}function ON(e,t,n,r){const[s,o]=[it(),it()],i=At(Ht(le(r,"length"),G(0))),a=pS(r,[s,o],yt(st(e,t,n.contains,s),t.AddIndex(o)));return yt(i,a)}function FN(e,t,n,r){const[s]=[it()],o=At(Ht(le(r,"length"),G(0))),i=mS(r,[s,"_"],st(e,t,n.contains,s));return yt(o,i)}function Ph(e,t,n,r){return Ah(n)?t.UseUnevaluated()?ON(e,t,n,r):FN(e,t,n,r):G(!0)}function ru(e,t,n,r){return Ah(n)?!h(r.length,0)&&Kf(r,(s,o)=>ot(e,t,n.contains,s)&&t.AddIndex(o)):!0}function Nh(e,t,n,r,s,o){return ru(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:1}})}function $h(e,t,n,r){const s=Ht(le(Yr(r),"length"),G(0)),o=vt(tt(n.dependencies).map(([i,a])=>{const l=At(Br(r,G(i))),u=st(e,t,a,r),f=p=>vt(p.map(g=>Br(r,G(g))));return He(l,z(a)?f(a):u)}));return He(s,o)}function Rh(e,t,n,r){const s=h(D(r).length,0),o=lt(tt(n.dependencies),0,([i,a])=>!C(r,i)||(z(a)?a.every(l=>C(r,l)):ot(e,t,a,r)));return s||o}function Mh(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(tt(s.dependencies),0,([l,u])=>{const f=`${n}/dependencies/${l}`;return!C(o,l)||(z(u)?u.every(p=>C(o,p)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:r,params:{property:l,dependencies:u}})):It(e,t,f,r,u,o))});return i||a}function Oh(e,t,n,r){const s=Ht(le(Yr(r),"length"),G(0)),o=vt(tt(n.dependentRequired).map(([i,a])=>{const l=At(Br(r,G(i))),u=vt(a.map(f=>Br(r,G(f))));return He(l,u)}));return He(s,o)}function Fh(e,t,n,r){const s=h(D(r).length,0),o=lt(tt(n.dependentRequired),0,([i,a])=>!C(r,i)||a.every(l=>C(r,l)));return s||o}function _h(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(tt(s.dependentRequired),0,([l,u])=>!C(o,l)||jt(u,0,f=>C(o,f)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:r,params:{property:l,dependencies:u}})));return i||a}function Dh(e,t,n,r){const s=Ht(le(Yr(r),"length"),G(0)),o=vt(tt(n.dependentSchemas).map(([i,a])=>{const l=At(Br(r,G(i))),u=st(e,t,a,r);return He(l,u)}));return He(s,o)}function Lh(e,t,n,r){const s=h(D(r).length,0),o=lt(tt(n.dependentSchemas),0,([i,a])=>!C(r,i)||ot(e,t,a,r));return s||o}function Uh(e,t,n,r,s,o){const i=h(D(o).length,0),a=jt(tt(s.dependentSchemas),0,([l,u])=>{const f=`${n}/dependentSchemas/${l}`;return!C(o,l)||It(e,t,f,r,u,o)});return i||a}function _N(e,t,n,r){const s=e.DynamicRef(n)??!1;return Bs(e,t,s,r)}function DN(e,t,n,r){const s=e.DynamicRef(n)??!1;return De(s)&&ot(e,t,s,r)}function LN(e,t,n,r,s,o){const i=e.DynamicRef(s)??!1;return De(i)&&It(e,t,"#",r,i,o)}function Bh(e,t,n,r){return nl(n.enum.map(s=>{if(Cs(s))return Ht(r,G(s));const o=cs(s);return Xf(r,o)}))}function su(e,t,n,r){return Ts(n.enum,s=>Cs(s)?h(r,s):Jr(r,s))}function qh(e,t,n,r,s,o){return su(e,t,s,o)||t.AddError({keyword:"enum",schemaPath:n,instancePath:r,params:{allowedValues:s.enum}})}function Hh(e,t,n,r){return el(r,G(n.exclusiveMaximum))}function ou(e,t,n,r){return xo(r,n.exclusiveMaximum)}function Kh(e,t,n,r,s,o){return ou(e,t,s,o)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:r,params:{comparison:"<",limit:s.exclusiveMaximum}})}function zh(e,t,n,r){return Qf(r,G(n.exclusiveMinimum))}function iu(e,t,n,r){return Wr(r,n.exclusiveMinimum)}function Gh(e,t,n,r,s,o){return iu(e,t,s,o)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:r,params:{comparison:">",limit:s.exclusiveMinimum}})}const UN=[0,31,28,31,30,31,30,31,31,30,31,30,31],BN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function qN(e){return e%4===0&&(e%100!==0||e%400===0)}function au(e){const t=BN.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&&qN(n)?29:UN[r])}const HN=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function cu(e,t=!0){const n=HN.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 u=s-l*i,f=r-a*i-(u<0?1:0);return(f===23||f===-1)&&(u===59||u===-1)&&o<61}function Vh(e,t=!0){const n=e.split(/T/i);return n.length===2&&au(n[0])&&cu(n[1],t)}const KN=/^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 Wh(e){return KN.test(e)}const zN=/^(?!.*\.\.)[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 Jh(e){return zN.test(e)}const Lr=36,xi=1,yc=26,GN=38,VN=700,WN=72,JN=128;function QN(e,t,n){e=n?Math.floor(e/VN):e>>1,e+=Math.floor(e/t);let r=0;for(;e>(Lr-xi)*yc>>1;)e=Math.floor(e/(Lr-xi)),r+=Lr;return r+Math.floor((Lr-xi+1)*e/(e+GN))}function YN(e){const t=[];let n=JN,r=0,s=WN;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,u=Lr;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)Pt();else throw new Error("Invalid punycode: bad digit character");r+=g*l;const k=u<=s?xi:u>=s+yc?yc:u-s;if(g<k)break;l*=Lr-k,u+=Lr}const f=t.length+1;s=QN(r-a,f,a===0),n+=Math.floor(r/f),r%=f,t.splice(r,0,n),r++}return globalThis.String.fromCodePoint(...t)}function XN(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function ZN(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function e$(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function t$(e){return XN(e)||ZN(e)||e$(e)}const n$=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),r$=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 s$(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function o$(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function i$(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function a$(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function c$(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function l$(e){return e>=1632&&e<=1641}function u$(e){return e>=1776&&e<=1785}function Dd(e){return r$.has(e)}function Qh(e){if(e.length===0)return Pt();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||t$(t[0]))return!1;let r=!1,s=!1,o=!1;for(let i=0;i<n;i++){const a=t[i];if(n$.has(a))return!1;(i$(a)||a$(a)||c$(a))&&(r=!0),l$(a)&&(s=!0),u$(a)&&(o=!0);const l=t[i-1],u=t[i+1];switch(a){case 183:if(l!==108||u!==108)return!1;break;case 885:if(u===void 0||!s$(u))return!1;break;case 1523:case 1524:if(l===void 0||!o$(l))return!1;break;case 8204:if(l===void 0||l<128&&!Dd(l))return!1;break;case 8205:if(l===void 0||!Dd(l))return!1;break}}return!(e.includes("・")&&!r||s&&o)}function d$(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 Yh(e){return e.toLowerCase().startsWith("xn--")}function Xh(e){try{const t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;const r=YN(t);return r?Qh(r):!1}catch{return!1}}function f$(e){return e.length===0||e.length>63?!1:Yh(e)?Xh(e):Qh(e)}function m$(e){return e.length===0||e.length>63?!1:Yh(e)?Xh(e):d$(e)}function Zh(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(const t of e.split("."))if(!m$(t))return!1;return!0}const p$=/^(?!.*\.\.)[\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 eb(e){return p$.test(e)}function tb(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(!f$(n))return!1;return!0}function nb(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 rb(e){return nb(e,0,e.length)}function g$(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function sb(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&&g$(e.charCodeAt(s));)s++,o++;if(o===0)return!1;const a=e.charCodeAt(s);if(a===46){if(!nb(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 Ld(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function ob(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))?Ld(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:Ld(e)}function ib(e){try{return new URL(e),!0}catch{return!1}}const h$=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function ab(e){return h$.test(e)}const b$=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function cb(e){return b$.test(e)}function lb(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}const x$=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function ub(e){return x$.test(e)}const k$=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function db(e){return k$.test(e)}const y$=/^(?:(?:[^\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 fb(e){return y$.test(e)}function mb(e){return e>=97&&e<=122||e>=65&&e<=90}function pb(e){return mb(e)||e>=48&&e<=57}function fi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function S$(e){return pb(e)||e===43||e===45||e===46}function Sc(e){return pb(e)||e===45||e===46||e===95||e===126}function wc(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 w$(e){return Sc(e)||wc(e)||e===58||e===64}function gb(e){const t=e.length;if(t===0||!mb(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){const r=e.charCodeAt(n);if(r===58)break;if(!S$(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||!fi(e.charCodeAt(o+1))||!fi(e.charCodeAt(o+2)))return!1;o+=2}else if(!Sc(i)&&!wc(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&&!Sc(o)&&!wc(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||!fi(e.charCodeAt(n+1))||!fi(e.charCodeAt(n+2)))return!1;n+=2}else{if(r>127)return!1;if(!(w$(r)||r===47||r===63||r===35))return!1}n++}return!0}const v$=/^(?: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 hb(e){return v$.test(e)}const I$=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function bb(e){return I$.test(e)}const qe=new Map;function xb(){qe.clear()}function j$(){return[...qe.entries()]}function C$(e,t){qe.set(e,t)}function T$(e){return qe.has(e)}function E$(e){return qe.get(e)}function kb(e,t){var n;return((n=qe.get(e))==null?void 0:n(t))??!0}function yb(){xb(),qe.set("date-time",Vh),qe.set("date",au),qe.set("duration",Wh),qe.set("email",Jh),qe.set("hostname",Zh),qe.set("idn-email",eb),qe.set("idn-hostname",tb),qe.set("ipv4",rb),qe.set("ipv6",sb),qe.set("iri-reference",ob),qe.set("iri",ib),qe.set("json-pointer-uri-fragment",ab),qe.set("json-pointer",cb),qe.set("regex",lb),qe.set("relative-json-pointer",ub),qe.set("time",cu),qe.set("uri-reference",db),qe.set("uri-template",fb),qe.set("uri",gb),qe.set("url",hb),qe.set("uuid",bb)}yb();const A$=Object.freeze(Object.defineProperty({__proto__:null,Clear:xb,Entries:j$,Get:E$,Has:T$,IsDate:au,IsDateTime:Vh,IsDuration:Wh,IsEmail:Jh,IsHostname:Zh,IsIPv4:rb,IsIPv6:sb,IsIdnEmail:eb,IsIdnHostname:tb,IsIri:ib,IsIriReference:ob,IsJsonPointer:cb,IsJsonPointerUriFragment:ab,IsRegex:lb,IsRelativeJsonPointer:ub,IsTime:cu,IsUri:gb,IsUriReference:db,IsUriTemplate:fb,IsUrl:hb,IsUuid:bb,Reset:yb,Set:C$,Test:kb},Symbol.toStringTag,{value:"Module"}));function Sb(e,t,n,r){return ze(le("Format","Test"),[G(n.format),r])}function lu(e,t,n,r){return kb(n.format,r)}function wb(e,t,n,r,s,o){return lu(e,t,s,o)||t.AddError({keyword:"format",schemaPath:n,instancePath:r,params:{format:s.format}})}function vb(e,t,n,r){const s=Sa(n)?n.then:!0,o=ma(n)?n.else:!0;return hS(st(e,t,n.if,r),st(e,t,s,r),st(e,t,o,r))}function Ib(e,t,n,r){const s=Sa(n)?n.then:!0,o=ma(n)?n.else:!0;return ot(e,t,n.if,r)?ot(e,t,s,r):ot(e,t,o,r)}function jb(e,t,n,r,s,o){const i=Sa(s)?s.then:!0,a=ma(s)?s.else:!0,l=new Fn,u=It(e,l,`${n}/if`,r,s.if,o)?It(e,l,`${n}/then`,r,i,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"then"}}):It(e,t,`${n}/else`,r,a,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"else"}});return u&&t.Merge([l]),u}function P$(e,t,n,r){return vt(n.items.map((s,o)=>{const i=Qr(le(r,"length"),G(o)),a=En(e,t,s,`${r}[${o}]`),l=t.AddIndex(G(o));return He(i,yt(a,l))}))}function N$(e,t,n,r){return vt(n.items.map((s,o)=>{const i=Qr(le(r,"length"),G(o)),a=En(e,t,s,`${r}[${o}]`);return He(i,a)}))}function $$(e,t,n,r){return t.UseUnevaluated()?P$(e,t,n,r):N$(e,t,n,r)}function R$(e,t,n,r){return lt(n.items,0,(s,o)=>Jn(r.length,o)||Ar(e,t,s,r[o])&&t.AddIndex(o))}function M$(e,t,n,r,s,o){return jt(s.items,0,(i,a)=>{const l=`${n}/items/${a}`,u=`${r}/${a}`;return Jn(o.length,a)||Pr(e,t,l,u,i,o[a])&&t.AddIndex(a)})}function O$(e,t,n,r){const s=er(n)?n.prefixItems.length:0,o=En(e,t,n.items,"element"),i=t.AddIndex("index");return Nn(r,G(s),["element","index"],yt(o,i))}function F$(e,t,n,r){const s=er(n)?n.prefixItems.length:0,o=En(e,t,n.items,"element");return Nn(r,G(s),["element","index"],o)}function _$(e,t,n,r){return t.UseUnevaluated()?O$(e,t,n,r):F$(e,t,n,r)}function D$(e,t,n,r){const s=er(n)?n.prefixItems.length:0;return lt(r,s,(o,i)=>Ar(e,t,n.items,o)&&t.AddIndex(i))}function L$(e,t,n,r,s,o){const i=er(s)?s.prefixItems.length:0;return jt(o,i,(a,l)=>{const u=`${n}/items`,f=`${r}/${l}`;return Pr(e,t,u,f,s.items,a)&&t.AddIndex(l)})}function Cb(e,t,n,r){return ha(n)?$$(e,t,n,r):_$(e,t,n,r)}function Tb(e,t,n,r){return ha(n)?R$(e,t,n,r):D$(e,t,n,r)}function Eb(e,t,n,r,s,o){return ha(s)?M$(e,t,n,r,s,o):L$(e,t,n,r,s,o)}function Ab(e){return rs(e)}function Pb(e,t,n,r){if(!Ab(n))return G(!0);const[s]=[it()],o=Gi(r,[s,"_"],st(e,t,n.contains,s));return Qr(o,G(n.maxContains))}function uu(e,t,n,r){if(!Ab(n))return!0;const s=Qc(r,o=>ot(e,t,n.contains,o));return Jn(s,n.maxContains)}function Nb(e,t,n,r,s,o){const i=ss(s)?s.minContains:1;return uu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:i,maxContains:s.maxContains}})}function $b(e,t,n,r){return Qr(r,G(n.maximum))}function du(e,t,n,r){return Jn(r,n.maximum)}function Rb(e,t,n,r,s,o){return du(e,t,s,o)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:r,params:{comparison:"<=",limit:s.maximum}})}function Mb(e,t,n,r){return Qr(le(r,"length"),G(n.maxItems))}function fu(e,t,n,r){return Jn(r.length,n.maxItems)}function Ob(e,t,n,r,s,o){return fu(e,t,s,o)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:r,params:{limit:s.maxItems}})}function Fb(e,t,n,r){return fS(r,G(n.maxLength))}function mu(e,t,n,r){return qf(r,n.maxLength)}function _b(e,t,n,r,s,o){return mu(e,t,s,o)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:r,params:{limit:s.maxLength}})}function Db(e,t,n,r){return Qr(le(Yr(r),"length"),G(n.maxProperties))}function pu(e,t,n,r){return Jn(D(r).length,n.maxProperties)}function Lb(e,t,n,r,s,o){return pu(e,t,s,o)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:r,params:{limit:s.maxProperties}})}function Ub(e){return rs(e)}function U$(e,t,n,r){const[s,o]=[it(),it()],i=Gi(r,[s,o],yt(st(e,t,n.contains,s),t.AddIndex(o)));return ko(i,G(n.minContains))}function B$(e,t,n,r){const[s]=[it()],o=Gi(r,[s,"_"],st(e,t,n.contains,s));return ko(o,G(n.minContains))}function Bb(e,t,n,r){return Ub(n)?t.UseUnevaluated()?U$(e,t,n,r):B$(e,t,n,r):G(!0)}function gu(e,t,n,r){if(!Ub(n))return!0;const s=Qc(r,(o,i)=>ot(e,t,n.contains,o)&&t.AddIndex(i));return js(s,n.minContains)}function qb(e,t,n,r,s,o){return gu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:s.minContains}})}function Hb(e,t,n,r){return ko(r,G(n.minimum))}function hu(e,t,n,r){return js(r,n.minimum)}function Kb(e,t,n,r,s,o){return hu(e,t,s,o)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:r,params:{comparison:">=",limit:s.minimum}})}function zb(e,t,n,r){return ko(le(r,"length"),G(n.minItems))}function bu(e,t,n,r){return js(r.length,n.minItems)}function Gb(e,t,n,r,s,o){return bu(e,t,s,o)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:r,params:{limit:s.minItems}})}function Vb(e,t,n,r){return dS(r,G(n.minLength))}function xu(e,t,n,r){return Hf(r,n.minLength)}function Wb(e,t,n,r,s,o){return xu(e,t,s,o)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:r,params:{limit:s.minLength}})}function Jb(e,t,n,r){return ko(le(Yr(r),"length"),G(n.minProperties))}function ku(e,t,n,r){return js(D(r).length,n.minProperties)}function Qb(e,t,n,r,s,o){return ku(e,t,s,o)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:r,params:{limit:s.minProperties}})}function Yb(e,t,n,r){return bS(r,G(n.multipleOf))}function yu(e,t,n,r){return Uf(r,n.multipleOf)}function Xb(e,t,n,r,s,o){return yu(e,t,s,o)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:r,params:{multipleOf:s.multipleOf}})}function q$(e,t,n,r){return Yo(e,t,[n.not],r,At(Ht(le("results","length"),G(1))))}function H$(e,t,n,r){return At(st(e,t,n.not,r))}function Zb(e,t,n,r){return t.UseUnevaluated()?q$(e,t,n,r):H$(e,t,n,r)}function Su(e,t,n,r){const s=new On;return!ot(e,s,n.not,r)&&t.Merge([s])}function ex(e,t,n,r,s,o){return Su(e,t,s,o)||t.AddError({keyword:"not",schemaPath:n,instancePath:r,params:{}})}function K$(e,t,n,r){return Yo(e,t,n.oneOf,r,Ht(le("results","length"),G(1)))}function z$(e,t,n,r){const[s]=[it()],o=gS(n.oneOf.map(a=>st(e,t,a,r))),i=Gi(o,[s,"_"],Ht(s,G(!0)));return Ht(i,G(1))}function tx(e,t,n,r){return t.UseUnevaluated()?K$(e,t,n,r):z$(e,t,n,r)}function nx(e,t,n,r){const s=n.oneOf.reduce((o,i)=>{const a=new On;return ot(e,a,i,r)?[...o,a]:o},[]);return h(s.length,1)&&t.Merge(s)}function rx(e,t,n,r,s,o){const i=[],a=[],l=s.oneOf.reduce((f,p,g)=>{const k=new Fn,b=`${n}/oneOf/${g}`,y=It(e,k,b,r,p,o);return y&&a.push(g),y||i.push(k),y?[...f,k]:f},[]),u=h(l.length,1)&&t.Merge(l);return!u&&h(a.length,0)&&i.forEach(f=>f.GetErrors().forEach(p=>t.AddError(p))),u||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:r,params:{passingSchemas:a}})}function sx(e,t,n,r){const s=cs(oe(n.pattern)?new RegExp(n.pattern,"u"):n.pattern);return ze(le(s,"test"),[r])}function wu(e,t,n,r){return(oe(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(r)}function ox(e,t,n,r,s,o){return wu(e,t,s,o)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:r,params:{pattern:s.pattern}})}function ix(e,t,n,r){return vt(tt(n.patternProperties).map(([s,o])=>{const[i,a]=[it(),it()],l=cs(new RegExp(s,"u")),u=At(ze(le(l,"test"),[i])),f=En(e,t,o,a),p=t.AddKey(i),g=t.UseUnevaluated()?He(u,yt(f,p)):He(u,f);return Nn(Yf(r),G(0),[`[${i}, ${a}]`,"_"],g)}))}function ax(e,t,n,r){return lt(tt(n.patternProperties),0,([s,o])=>{const i=new RegExp(s,"u");return lt(tt(r),0,([a,l])=>!i.test(a)||Ar(e,t,o,l)&&t.AddKey(a))})}function cx(e,t,n,r,s,o){return jt(tt(s.patternProperties),0,([i,a])=>{const l=`${n}/patternProperties/${i}`,u=new RegExp(i,"u");return jt(tt(o),0,([f,p])=>{const g=`${r}/${f}`;return!u.test(f)||Pr(e,t,l,g,a,p)&&t.AddKey(f)})})}function lx(e,t,n,r){return vt(n.prefixItems.map((s,o)=>{const i=Qr(le(r,"length"),G(o)),a=En(e,t,s,`${r}[${o}]`),l=t.AddIndex(G(o)),u=t.UseUnevaluated()?yt(a,l):a;return He(i,u)}))}function ux(e,t,n,r){return h(r.length,0)||lt(n.prefixItems,0,(s,o)=>Jn(r.length,o)||Ar(e,t,s,r[o])&&t.AddIndex(o))}function dx(e,t,n,r,s,o){return h(o.length,0)||jt(s.prefixItems,0,(i,a)=>{const l=`${n}/prefixItems/${a}`,u=`${r}/${a}`;return Jn(o.length,a)||Pr(e,t,l,u,i,o[a])&&t.AddIndex(a)})}function vu(e,t){return e.includes(t)||So().exactOptionalPropertyTypes}function G$(e,t){return sc(le(e,t))}function fx(e,t){return Oe(e[t])}function mx(e,t,n,r){const s=tr(n)?n.required:[],o=tt(n.properties).map(([i,a])=>{const l=At(Br(r,G(i))),u=En(e,t,a,le(r,i)),f=t.AddKey(G(i)),p=t.UseUnevaluated()?yt(u,f):u,g=s.includes(i)?p:He(l,p);return vu(s,i)?g:He(G$(r,i),g)});return vt(o)}function px(e,t,n,r){const s=tr(n)?n.required:[];return lt(tt(n.properties),0,([i,a])=>{const l=!C(r,i)||Ar(e,t,a,r[i])&&t.AddKey(i);return vu(s,i)?l:fx(r,i)||l})}function gx(e,t,n,r,s,o){const i=tr(s)?s.required:[];return jt(tt(s.properties),0,([l,u])=>{const f=`${n}/properties/${l}`,p=`${r}/${l}`,g=()=>!C(o,l)||Pr(e,t,f,p,u,o[l])&&t.AddKey(l);return vu(i,l)?g():fx(o,l)||g()})}function hx(e,t,n,r){const[s,o]=[it(),it()];return Nn(Yr(r),G(0),[s,o],st(e,t,n.propertyNames,s))}function bx(e,t,n,r){return lt(D(r),0,(s,o)=>ot(e,t,n.propertyNames,s))}function xx(e,t,n,r,s,o){const i=[];return jt(D(o),0,(l,u)=>{const f=`${r}/${l}`,p=`${n}/propertyNames`,g=new Fn,k=It(e,g,p,f,s.propertyNames,l);return k||i.push(l),k})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:r,params:{propertyNames:i}})}function kx(e,t,n,r){const s=e.RecursiveRef(n)??!1;return Bs(e,t,s,r)}function yx(e,t,n,r){const s=e.RecursiveRef(n)??!1;return De(s)&&ot(e,t,s,r)}function Sx(e,t,n,r,s,o){const i=e.RecursiveRef(s)??!1;return De(i)&&It(e,t,"#",r,i,o)}function V$(e,t,n,r){const s=gr(["context","value"],Bs(e,t,n,"value")),o=gr(["context","value"],Vi([Hn("nextContext",tl("CheckContext",[])),Hn("result",ze(s,["nextContext","value"])),Zf("result",t.Merge("[nextContext]")),Wi("result")]));return ze(o,["context",r])}function W$(e,t,n,r){return Bs(e,t,n,r)}function wx(e,t,n,r){const s=e.Ref(n)??!1;return t.UseUnevaluated()?V$(e,t,s,r):W$(e,t,s,r)}function vx(e,t,n,r){const s=e.Ref(n)??!1,o=new On,i=De(s)&&ot(e,o,s,r);return i&&t.Merge([o]),i}function Ix(e,t,n,r,s,o){const i=e.Ref(s)??!1,a=new Fn,l=De(i)&&It(e,a,"#",r,i,o);return l&&t.Merge([a]),l||a.GetErrors().forEach(u=>t.AddError(u)),l}function jx(e,t,n,r){return vt(n.required.map(s=>Br(r,G(s))))}function Cx(e,t,n,r){return lt(n.required,0,s=>C(r,s))}function Tx(e,t,n,r,s,o){const i=[];return jt(s.required,0,l=>{const u=C(o,l);return u||i.push(l),u})||t.AddError({keyword:"required",schemaPath:n,instancePath:r,params:{requiredProperties:i}})}function Ex(e,t,n,r){return h(n,"object")?Vf(r):h(n,"array")?ji(r):h(n,"boolean")?oS(r):h(n,"integer")?iS(r):h(n,"number")?Gf(r):h(n,"null")?aS(r):h(n,"string")?Jf(r):h(n,"bigint")?zf(r):h(n,"constructor")?uS(r):h(n,"function")?lS(r):h(n,"symbol")?cS(r):h(n,"undefined")||h(n,"void")?sc(r):G(!0)}function Iu(e,t,n,r,s){return h(n,"object")?cn(s):h(n,"array")?z(s):h(n,"boolean")?mt(s):h(n,"integer")?Wc(s):h(n,"number")?ve(s):h(n,"null")?Kt(s):h(n,"string")?oe(s):h(n,"bigint")?et(s):h(n,"constructor")?zi(s):h(n,"function")?kn(s):h(n,"symbol")?Jc(s):h(n,"undefined")||h(n,"void")?Oe(s):!0}function J$(e,t,n,r){return nl(n.map(s=>Ex(e,t,s,r)))}function Ax(e,t,n,r,s){return Ts(n,o=>Iu(e,t,o,r,s))}function Px(e,t,n,r){return z(n.type)?J$(e,t,n.type,r):Ex(e,t,n.type,r)}function Nx(e,t,n,r){return z(n.type)?Ax(e,t,n.type,n,r):Iu(e,t,n.type,n,r)}function $x(e,t,n,r,s,o){return(z(s.type)?Ax(e,t,s.type,s,o):Iu(e,t,s.type,s,o))||t.AddError({keyword:"type",schemaPath:n,instancePath:r,params:{type:s.type}})}function Rx(e,t,n,r){const[s,o]=[it(),it()],i=ze(le("context","GetIndices"),[]),a=ze(le("indices","has"),[s]),l=st(e,t,n.unevaluatedItems,o),u=ze(le("context","AddIndex"),[s]),f=Nn(r,G(0),[o,s],yt(He(a,l),u));return ze(gr(["context"],Vi([Hn("indices",i),Wi(f)])),["context"])}function Mx(e,t,n,r){const s=t.GetIndices();return lt(r,0,(o,i)=>(s.has(i)||ot(e,t,n.unevaluatedItems,o))&&t.AddIndex(i))}function Ox(e,t,n,r,s,o){const i=t.GetIndices(),a=[];return jt(o,0,(u,f)=>{const p=new Fn,g=(i.has(f)||It(e,p,n,r,s.unevaluatedItems,u))&&t.AddIndex(f);return g||a.push(f),g})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:r,params:{unevaluatedItems:a}})}function Fx(e,t,n,r){const[s,o]=[it(),it()],i=ze(le("context","GetKeys"),[]),a=ze(le("keys","has"),[s]),l=ze(le("context","AddKey"),[s]),u=st(e,t,n.unevaluatedProperties,o),f=Nn(Yf(r),G(0),[`[${s}, ${o}]`,"_"],He(a,yt(u,l)));return ze(gr(["context"],Vi([Hn("keys",i),Wi(f)])),["context"])}function _x(e,t,n,r){const s=t.GetKeys();return lt(tt(r),0,([o,i])=>s.has(o)||ot(e,t,n.unevaluatedProperties,i)&&t.AddKey(o))}function Dx(e,t,n,r,s,o){const i=t.GetKeys(),a=[];return jt(tt(o),0,([u,f])=>{const p=new Fn,g=i.has(u)||It(e,p,n,r,s.unevaluatedProperties,f)&&t.AddKey(u);return g||a.push(u),g})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:r,params:{unevaluatedProperties:a}})}function ju(e){return!h(e.uniqueItems,!1)}function Lx(e,t,n,r){if(!ju(n))return G(!0);const s=le(tl("Set",[ze(le(r,"map"),[le("Hashing","Hash")])]),"size"),o=le(r,"length");return Ht(s,o)}function Ux(e,t,n,r){if(!ju(n))return!0;const s=new Set(r.map(Ji)).size,o=r.length;return h(s,o)}function Bx(e,t,n,r,s,o){if(!ju(s))return!0;const i=new Set,a=o.reduce((u,f,p)=>{const g=Ji(f);return i.has(g)?[...u,p]:(i.add(g),u)},[]);return h(a.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:r,params:{duplicateItems:a}})}function mo(e,t){return Qo(e)&&(z(e.type)&&Wr(e.type.length,0)&&lt(e.type,0,n=>h(n,t))||h(e.type,t))}function Q$(e){return mo(e,"object")}function Y$(e){return Xt(e)&&(Zn(e)||Uo(e)||Bo(e)||qo(e)||as(e)||is(e)||Jo(e)||_s(e)||Vo(e)||tr(e)||Us(e))}function X$(e){return mo(e,"array")}function Z$(e){return Xt(e)&&(Lo(e)||Tr(e)||rs(e)||zo(e)||Os(e)||ss(e)||os(e)||er(e)||Ls(e)||yr(e))}function eR(e){return mo(e,"string")}function tR(e){return Xt(e)&&(Fs(e)||Go(e)||Ms(e)||Ds(e))}function nR(e){return mo(e,"number")||mo(e,"bigint")}function rR(e){return Xt(e)&&(Er(e)||Ko(e)||Ho(e)||Cr(e)||Wo(e))}function En(e,t,n,r){return t.UseUnevaluated()?yt(yt(t.Push(),st(e,t,n,r)),t.Pop()):st(e,t,n,r)}function st(e,t,n,r){e.Push(n);const s=[];if(Do(n))return jh(e,t,n);if(Qo(n)&&s.push(Px(e,t,n,r)),Y$(n)){const i=[];tr(n)&&i.push(jx(e,t,n,r)),Zn(n)&&i.push(hh(e,t,n,r)),Uo(n)&&i.push($h(e,t,n,r)),Bo(n)&&i.push(Oh(e,t,n,r)),qo(n)&&i.push(Dh(e,t,n,r)),is(n)&&i.push(ix(e,t,n,r)),as(n)&&i.push(mx(e,t,n,r)),Jo(n)&&i.push(hx(e,t,n,r)),_s(n)&&i.push(Jb(e,t,n,r)),Vo(n)&&i.push(Db(e,t,n,r));const a=vt(i),l=He(At(Vf(r)),a);s.push(Q$(n)?a:l)}if(Z$(n)){const i=[];Lo(n)&&i.push(uh(e,t,n,r)),rs(n)&&i.push(Ph(e,t,n,r)),Tr(n)&&i.push(Cb(e,t,n,r)),zo(n)&&i.push(Pb(e,t,n,r)),Os(n)&&i.push(Mb(e,t,n,r)),ss(n)&&i.push(Bb(e,t,n,r)),os(n)&&i.push(zb(e,t,n,r)),er(n)&&i.push(lx(e,t,n,r)),yr(n)&&i.push(Lx(e,t,n,r));const a=vt(i),l=He(At(ji(r)),a);s.push(X$(n)?a:l)}if(tR(n)){const i=[];Go(n)&&i.push(Fb(e,t,n,r)),Fs(n)&&i.push(Vb(e,t,n,r)),Ms(n)&&i.push(Sb(e,t,n,r)),Ds(n)&&i.push(sx(e,t,n,r));const a=vt(i),l=He(At(Jf(r)),a);s.push(eR(n)?a:l)}if(rR(n)){const i=[];Ho(n)&&i.push(Hh(e,t,n,r)),Cr(n)&&i.push(zh(e,t,n,r)),Ko(n)&&i.push($b(e,t,n,r)),Er(n)&&i.push(Hb(e,t,n,r)),Wo(n)&&i.push(Yb(e,t,n,r));const a=vt(i),l=He(At(He(Gf(r),zf(r))),a);s.push(nR(n)?a:l)}ya(n)&&s.push(wx(e,t,n,r)),ka(n)&&s.push(kx(e,t,n,r)),fa(n)&&s.push(_N(e,t,n,r)),da(n)&&s.push(Th(e,t,n,r)),pa(n)&&s.push(Bh(e,t,n,r)),ga(n)&&s.push(vb(e,t,n,r)),ba(n)&&s.push(Zb(e,t,n,r)),la(n)&&s.push(kh(e,t,n,r)),ua(n)&&s.push(wh(e,t,n,r)),xa(n)&&s.push(tx(e,t,n,r)),Ls(n)&&s.push(He(At(ji(r)),Rx(e,t,n,r))),Us(n)&&s.push(He(At(Wf(r)),Fx(e,t,n,r))),ca(n)&&s.push(ah(e,t,n,r));const o=vt(s);return e.Pop(n),o}function Ar(e,t,n,r){return t.Push()&&ot(e,t,n,r)&&t.Pop()}function ot(e,t,n,r){e.Push(n);const s=Do(n)?tu(e,t,n):(!Qo(n)||Nx(e,t,n,r))&&(!(re(r)&&!z(r))||(!tr(n)||Cx(e,t,n,r))&&(!Zn(n)||bh(e,t,n,r))&&(!Uo(n)||Rh(e,t,n,r))&&(!Bo(n)||Fh(e,t,n,r))&&(!qo(n)||Lh(e,t,n,r))&&(!is(n)||ax(e,t,n,r))&&(!as(n)||px(e,t,n,r))&&(!Jo(n)||bx(e,t,n,r))&&(!_s(n)||ku(e,t,n,r))&&(!Vo(n)||pu(e,t,n,r)))&&(!z(r)||(!Lo(n)||dh(e,t,n,r))&&(!rs(n)||ru(e,t,n,r))&&(!Tr(n)||Tb(e,t,n,r))&&(!zo(n)||uu(e,t,n,r))&&(!Os(n)||fu(e,t,n,r))&&(!ss(n)||gu(e,t,n,r))&&(!os(n)||bu(e,t,n,r))&&(!er(n)||ux(e,t,n,r))&&(!yr(n)||Ux(e,t,n,r)))&&(!oe(r)||(!Go(n)||mu(e,t,n,r))&&(!Fs(n)||xu(e,t,n,r))&&(!Ms(n)||lu(e,t,n,r))&&(!Ds(n)||wu(e,t,n,r)))&&(!(ve(r)||et(r))||(!Ho(n)||ou(e,t,n,r))&&(!Cr(n)||iu(e,t,n,r))&&(!Ko(n)||du(e,t,n,r))&&(!Er(n)||hu(e,t,n,r))&&(!Wo(n)||yu(e,t,n,r)))&&(!ya(n)||vx(e,t,n,r))&&(!ka(n)||yx(e,t,n,r))&&(!fa(n)||DN(e,t,n,r))&&(!da(n)||nu(e,t,n,r))&&(!pa(n)||su(e,t,n,r))&&(!ga(n)||Ib(e,t,n,r))&&(!ba(n)||Su(e,t,n,r))&&(!la(n)||yh(e,t,n,r))&&(!ua(n)||vh(e,t,n,r))&&(!xa(n)||nx(e,t,n,r))&&(!Ls(n)||!z(r)||Mx(e,t,n,r))&&(!Us(n)||!re(r)||_x(e,t,n,r))&&(!ca(n)||ch(e,t,n,r));return e.Pop(n),s}function Pr(e,t,n,r,s,o){return t.Push()&&It(e,t,n,r,s,o)&&t.Pop()}function It(e,t,n,r,s,o){e.Push(s);const i=Do(s)?Ch(e,t,n,r,s):!!(+(!Qo(s)||$x(e,t,n,r,s,o))&+(!(re(o)&&!z(o))||!!(+(!tr(s)||Tx(e,t,n,r,s,o))&+(!Zn(s)||xh(e,t,n,r,s,o))&+(!Uo(s)||Mh(e,t,n,r,s,o))&+(!Bo(s)||_h(e,t,n,r,s,o))&+(!qo(s)||Uh(e,t,n,r,s,o))&+(!is(s)||cx(e,t,n,r,s,o))&+(!as(s)||gx(e,t,n,r,s,o))&+(!Jo(s)||xx(e,t,n,r,s,o))&+(!_s(s)||Qb(e,t,n,r,s,o))&+(!Vo(s)||Lb(e,t,n,r,s,o))))&+(!z(o)||!!(+(!Lo(s)||fh(e,t,n,r,s,o))&+(!rs(s)||Nh(e,t,n,r,s,o))&+(!Tr(s)||Eb(e,t,n,r,s,o))&+(!zo(s)||Nb(e,t,n,r,s,o))&+(!Os(s)||Ob(e,t,n,r,s,o))&+(!ss(s)||qb(e,t,n,r,s,o))&+(!os(s)||Gb(e,t,n,r,s,o))&+(!er(s)||dx(e,t,n,r,s,o))&+(!yr(s)||Bx(e,t,n,r,s,o))))&+(!oe(o)||!!(+(!Go(s)||_b(e,t,n,r,s,o))&+(!Fs(s)||Wb(e,t,n,r,s,o))&+(!Ms(s)||wb(e,t,n,r,s,o))&+(!Ds(s)||ox(e,t,n,r,s,o))))&+(!(ve(o)||et(o))||!!(+(!Ho(s)||Kh(e,t,n,r,s,o))&+(!Cr(s)||Gh(e,t,n,r,s,o))&+(!Ko(s)||Rb(e,t,n,r,s,o))&+(!Er(s)||Kb(e,t,n,r,s,o))&+(!Wo(s)||Xb(e,t,n,r,s,o))))&+(!ya(s)||Ix(e,t,n,r,s,o))&+(!ka(s)||Sx(e,t,n,r,s,o))&+(!fa(s)||LN(e,t,n,r,s,o))&+(!da(s)||Eh(e,t,n,r,s,o))&+(!pa(s)||qh(e,t,n,r,s,o))&+(!ga(s)||jb(e,t,n,r,s,o))&+(!ba(s)||ex(e,t,n,r,s,o))&+(!la(s)||Sh(e,t,n,r,s,o))&+(!ua(s)||Ih(e,t,n,r,s,o))&+(!xa(s)||rx(e,t,n,r,s,o))&+(!Ls(s)||!z(o)||Ox(e,t,n,r,s,o))&+(!Us(s)||!re(o)||Dx(e,t,n,r,s,o)))&&(!ca(s)||lh(e,t,n,r,s,o));return e.Pop(s),i}const qx=[0],ki=new Map,oo=new Map;function sR(){return`${qx[0]++}`}function oR(e,t){ki.has(e)||ki.set(e,new Map);const n=ki.get(e);if(n.has(t))return n.get(t);const r=sR();return n.set(t,r),r}function iR(e,t,n,r){return e.UseUnevaluated()?ze(`check_${n}`,["context",r]):ze(`check_${n}`,[r])}function aR(e,t,n,r){const s=st(e,t,n,"value");return t.UseUnevaluated()?Hn(`check_${r}`,gr(["context","value"],s)):Hn(`check_${r}`,gr(["value"],s))}function Hx(){qx[0]=0,ki.clear(),oo.clear()}function Kx(){return[...oo.values()]}function Bs(e,t,n,r){const s=oR(n,e.BaseURL().href),o=iR(t,n,s,r);return oo.has(s)||(oo.set(s,""),oo.set(s,aR(e,t,n,s))),o}function zx(e){if(e.length===0)throw Error("Cannot set root")}function Gx(e){if(!re(e))throw Error("Cannot set value")}function cR(e){if(qn(e))throw Error("Pointer contains unsafe property key")}function Vx(e){for(const t of e)cR(t)}function lR(e){return/^(0|[1-9]\d*)$/.test(e)}function Wx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function uR(e,t){return re(t)&&C(t,e)}function dR(e,t){return re(t)&&!qn(e)?t[e]:void 0}function Cu(e,t){return e.reduce((n,r)=>dR(r,n),t)}function Xo(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 fR(e,t){let n=e;return Xo(t).every(r=>uR(r,n)?(n=n[r],!0):!1)}function Jx(e,t){const n=Xo(t);return Cu(n,e)}function vc(e,t,n){const r=Xo(t);zx(r),Vx(r);const[s,o]=Wx(r),i=Cu(s,e);return Gx(i),i[o]=n,e}function Qx(e,t){const n=Xo(t);zx(n),Vx(n);const[r,s]=Wx(n),o=Cu(r,e);return Gx(o),z(o)&&lR(s)?o.splice(+s,1):delete o[s],e}const Yx=Object.freeze(Object.defineProperty({__proto__:null,Delete:Qx,Get:Jx,Has:fR,Indices:Xo,Set:vc},Symbol.toStringTag,{value:"Module"}));function mR(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("#")?Xx(e,t,n):e}function pR(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 gR(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 Xx(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 Jx(e,r)}function hR(e,t,n){if(kr(e)){const r=mR(e,t,n);if(!Oe(r))return r}if(Ri(e)){const r=pR(e,t,n);if(!Oe(r))return r}if(zr(e)){const r=gR(e,t,n);if(!Oe(r))return r}return Xx(e,t,n)}function bR(e,t,n){return e.reduce((r,s)=>{const o=Tu(s,t,n);return Oe(o)?r:o},void 0)}function xR(e,t,n){return D(e).reduce((r,s)=>{const o=Tu(e[s],t,n);return Oe(o)?r:o},void 0)}function Tu(e,t,n){const r=Xt(e)&&kr(e)?new URL(e.$id,t.href):t;if(Xt(e)){const s=hR(e,r,n);if(!Oe(s))return s}if(z(e))return bR(e,r,n);if(re(e))return xR(e,r,n)}function Gr(e,t){const n=new URL("http://unknown/"),r=kr(e)?new URL(e.$id,n.href):n,s=new URL(t,r.href);return Tu(e,r,s)}function Zx(e,t,n,r){const s=n.$dynamicRef.startsWith("#")?Gr(t,n.$dynamicRef):Gr(e,n.$dynamicRef);return Oe(s)?void 0:!Xt(s)||!zr(s)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?s:r.find(a=>a.$dynamicAnchor===s.$dynamicAnchor)??s}const kR=Object.freeze(Object.defineProperty({__proto__:null,DynamicRef:Zx,Ref:Gr},Symbol.toStringTag,{value:"Module"}));var ks=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)},lr,ek,tk,nk,rk;class Zo{constructor(t,n){lr.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){Xt(t)&&(kr(t)&&(this.ids.push(t),ks(this,lr,"m",ek).call(this,t)),Ri(t)&&this.anchors.push(t),bi(t)&&this.recursiveAnchors.push(t),zr(t)&&this.dynamicAnchors.push(t))}Pop(t){Xt(t)&&(kr(t)&&(this.ids.pop(),ks(this,lr,"m",tk).call(this,t)),Ri(t)&&this.anchors.pop(),bi(t)&&this.recursiveAnchors.pop(),zr(t)&&this.dynamicAnchors.pop())}Ref(t){return ks(this,lr,"m",nk).call(this,t)??ks(this,lr,"m",rk).call(this,t)}RecursiveRef(t){return bi(this.Base())?Gr(this.recursiveAnchors[0],t.$recursiveRef):Gr(this.Base(),t.$recursiveRef)}DynamicRef(t){const n=this.schema;return Zx(n,this.Base(),t,this.dynamicAnchors)}}lr=new WeakSet,ek=function e(t,n=!0){if(!Xt(t))return;const r=t;if(!(!n&&kr(r))){!n&&zr(r)&&this.dynamicAnchors.push(r);for(const s of D(r))ks(this,lr,"m",e).call(this,r[s],!1)}},tk=function e(t,n=!0){if(!Xt(t))return;const r=t;if(!(!n&&kr(r))){!n&&zr(r)&&this.dynamicAnchors.pop();for(const s of D(r))ks(this,lr,"m",e).call(this,r[s],!1)}},nk=function(t){return C(this.context,t.$ref)?this.context[t.$ref]:void 0},rk=function(t){const n=this.schema;return t.$ref.startsWith("#")?Gr(this.Base(),t.$ref):Gr(n,t.$ref)};function yR(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 SR(e,t){return cm("CheckContext","Guard","Format","Hashing",e.External().identifier,t)(On,Ii,A$,pw,e.External().variables)}function wR(e){const t=new Zo(e.Context(),e.Schema()),n=new On;return r=>ot(t,n,e.Schema(),r)}function vR(e,t){return am()?SR(e,t):wR(e)}class sk{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 ok{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=yR(this),n=vR(this,t);return new sk(am(),t,n)}}function ik(...e){const[t,n]=at(e,{2:(l,u)=>[l,u],1:l=>[{},l]});oh(),Hx();const r=new Zo(t,n),s=new sh(rh(t,n)),o=Bs(r,s,n,"value"),i=Kx(),a=ih();return new ok(t,n,a,i,o,s.UseUnevaluated())}function po(...e){const[t,n,r]=at(e,{3:(f,p,g)=>[f,p,g],2:(f,p)=>[{},f,p]}),s=So(),o=bw(),i=[],a=new Zo(t,n),l=new Xl(f=>{if(!js(i.length,s.maxErrors))return i.push({...f,message:o(f)})});return[It(a,l,"#","",n,r),i]}function Eu(...e){const[t,n,r]=at(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),s=new Zo(t,n),o=new On;return ot(s,o,n,r)}let Au=class{constructor(t,n,r){this.schema=t,this.value=n,this.errors=r}};function IR(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});if(!Eu(t,n,r)){const[s,o]=po(t,n,r);throw new Au(n,r,o)}return r}class ak{constructor(t,n){this.buildResult=ik(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]=po(this.buildResult.Context(),this.buildResult.Schema(),t);throw new Au(this.buildResult.Schema(),t,r)}Errors(t){return po(this.buildResult.Context(),this.buildResult.Schema(),t)}}function jR(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return new ak(t,n)}const CR=Object.freeze(Object.defineProperty({__proto__:null,AccumulatedErrorContext:Fn,Build:ik,BuildAdditionalItems:uh,BuildAdditionalProperties:hh,BuildAdditionalPropertiesFast:ph,BuildAdditionalPropertiesStandard:gh,BuildAllOf:kh,BuildAnyOf:wh,BuildConst:Th,BuildContains:Ph,BuildContext:sh,BuildDependencies:$h,BuildDependentRequired:Oh,BuildDependentSchemas:Dh,BuildEnum:Bh,BuildExclusiveMaximum:Hh,BuildExclusiveMinimum:zh,BuildFormat:Sb,BuildIf:vb,BuildItems:Cb,BuildMaxContains:Pb,BuildMaxItems:Mb,BuildMaxLength:Fb,BuildMaxProperties:Db,BuildMaximum:$b,BuildMinContains:Bb,BuildMinItems:zb,BuildMinLength:Vb,BuildMinProperties:Jb,BuildMinimum:Hb,BuildMultipleOf:Yb,BuildNot:Zb,BuildOneOf:tx,BuildPattern:sx,BuildPatternProperties:ix,BuildPrefixItems:lx,BuildProperties:mx,BuildPropertyNames:hx,BuildRecursiveRef:kx,BuildRef:wx,BuildRefine:ah,BuildRequired:jx,BuildResult:ok,BuildSchema:st,BuildSchemaBoolean:jh,BuildSchemaPushStack:En,BuildType:Px,BuildUnevaluatedItems:Rx,BuildUnevaluatedProperties:Fx,BuildUniqueItems:Lx,CanAdditionalPropertiesFast:mh,Check:Eu,CheckAdditionalItems:dh,CheckAdditionalProperties:bh,CheckAllOf:yh,CheckAnyOf:vh,CheckConst:nu,CheckContains:ru,CheckContext:On,CheckDependencies:Rh,CheckDependentRequired:Fh,CheckDependentSchemas:Lh,CheckEnum:su,CheckExclusiveMaximum:ou,CheckExclusiveMinimum:iu,CheckFormat:lu,CheckIf:Ib,CheckItems:Tb,CheckMaxContains:uu,CheckMaxItems:fu,CheckMaxLength:mu,CheckMaxProperties:pu,CheckMaximum:du,CheckMinContains:gu,CheckMinItems:bu,CheckMinLength:xu,CheckMinProperties:ku,CheckMinimum:hu,CheckMultipleOf:yu,CheckNot:Su,CheckOneOf:nx,CheckPattern:wu,CheckPatternProperties:ax,CheckPrefixItems:ux,CheckProperties:px,CheckPropertyNames:bx,CheckRecursiveRef:yx,CheckRef:vx,CheckRefine:ch,CheckRequired:Cx,CheckSchema:ot,CheckSchemaBoolean:tu,CheckSchemaPushStack:Ar,CheckType:Nx,CheckUnevaluatedItems:Mx,CheckUnevaluatedProperties:_x,CheckUniqueItems:Ux,Compile:jR,CreateFunction:Bs,CreateVariable:cs,ErrorAdditionalItems:fh,ErrorAdditionalProperties:xh,ErrorAllOf:Sh,ErrorAnyOf:Ih,ErrorConst:Eh,ErrorContains:Nh,ErrorContext:Xl,ErrorDependencies:Mh,ErrorDependentRequired:_h,ErrorDependentSchemas:Uh,ErrorEnum:qh,ErrorExclusiveMaximum:Kh,ErrorExclusiveMinimum:Gh,ErrorFormat:wb,ErrorIf:jb,ErrorItems:Eb,ErrorMaxContains:Nb,ErrorMaxItems:Ob,ErrorMaxLength:_b,ErrorMaxProperties:Lb,ErrorMaximum:Rb,ErrorMinContains:qb,ErrorMinItems:Gb,ErrorMinLength:Wb,ErrorMinProperties:Qb,ErrorMinimum:Kb,ErrorMultipleOf:Xb,ErrorNot:ex,ErrorOneOf:rx,ErrorPattern:ox,ErrorPatternProperties:cx,ErrorPrefixItems:dx,ErrorProperties:gx,ErrorPropertyNames:xx,ErrorRecursiveRef:Sx,ErrorRef:Ix,ErrorRefine:lh,ErrorRequired:Tx,ErrorSchema:It,ErrorSchemaBoolean:Ch,ErrorSchemaPushStack:Pr,ErrorType:$x,ErrorUnevaluatedItems:Ox,ErrorUnevaluatedProperties:Dx,ErrorUniqueItems:Bx,Errors:po,EvaluateResult:sk,GetExternal:ih,GetFunctions:Kx,HasUnevaluated:rh,IsAdditionalItems:Lo,IsAdditionalProperties:Zn,IsAllOf:la,IsAnchor:Ri,IsAnyOf:ua,IsConst:da,IsContains:rs,IsContentEncoding:SN,IsContentMediaType:wN,IsDefault:jr,IsDefs:vN,IsDependencies:Uo,IsDependentRequired:Bo,IsDependentSchemas:qo,IsDynamicAnchor:zr,IsDynamicRef:fa,IsElse:ma,IsEnum:pa,IsExclusiveMaximum:Ho,IsExclusiveMinimum:Cr,IsFormat:Ms,IsId:kr,IsIf:ga,IsItems:Tr,IsItemsSized:ha,IsItemsUnsized:IN,IsMaxContains:zo,IsMaxItems:Os,IsMaxLength:Go,IsMaxProperties:Vo,IsMaximum:Ko,IsMinContains:ss,IsMinItems:os,IsMinLength:Fs,IsMinProperties:_s,IsMinimum:Er,IsMultipleOf:Wo,IsNot:ba,IsOneOf:xa,IsPattern:Ds,IsPatternProperties:is,IsPrefixItems:er,IsProperties:as,IsPropertyNames:Jo,IsRecursiveAnchor:nh,IsRecursiveAnchorTrue:bi,IsRecursiveRef:ka,IsRef:ya,IsRefine:ca,IsRequired:tr,IsSchema:De,IsSchemaBoolean:Do,IsSchemaObject:Xt,IsThen:Sa,IsType:Qo,IsUnevaluatedItems:Ls,IsUnevaluatedProperties:Us,IsUniqueItems:yr,Parse:IR,ParseError:Au,Pointer:Yx,Reducer:Yo,ResetExternal:oh,ResetFunctions:Hx,Resolve:kR,Stack:Zo,Validator:ak},Symbol.toStringTag,{value:"Module"}));function nt(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return Eu(t,n,r)}function ei(...e){const[t,n,r]=at(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),[s,o]=po(t,n,r);return o}class wa 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 ck(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(!nt(t,n,r))throw new wa("Assert",r,ei(t,n,r))}function TR(e,t,n){return z(n)?n.map(r=>wn(e,t.items,r)):n}function ER(e,t,n){return wn({...e,...t.$defs},on(t.$ref),n)}function AR(e,t){const n=C(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},r=Rs(e,t),s=Mn(r);return Le(s)?Yg(s,n):s}function PR(e,t,n){const r=AR(e,t);return wn(e,r,n)}function lk(e){return C(e,"additionalProperties")?e.additionalProperties:void 0}function NR(e,t,n){if(!re(n)||z(n))return n;const r=lk(t);for(const s of D(n)){if(C(t.properties,s)){n[s]=wn(e,t.properties[s],n[s]);continue}if(mt(r)&&h(r,!0)||Wt(r)&&nt(e,r,n[s])){n[s]=wn(e,r,n[s]);continue}delete n[s]}return n}function $R(e,t,n){if(!re(n))return n;const r=lk(t),[s,o]=[new RegExp(pn(t)),Lt(t)];for(const i of D(n)){if(s.test(i)){n[i]=wn(e,o,n[i]);continue}if(mt(r)&&h(r,!0)||Wt(r)&&nt(e,r,n[i])){n[i]=wn(e,r,n[i]);continue}delete n[i]}return n}function RR(e,t,n){return C(e,t.$ref)?wn(e,e[t.$ref],n):n}function MR(e,t,n){if(!z(n))return n;const r=Math.min(n.length,t.items.length);for(let s=0;s<r;s++)n[s]=wn(e,t.items[s],n[s]);return Wr(n.length,r)?n.slice(0,r):n}function Ft(e){return rl(e)}function OR(e,t,n){for(const r of t.anyOf){const s=wn(e,r,Ft(n));if(nt(e,r,s))return s}return n}function wn(e,t,n){return ut(t)?TR(e,t,n):Dt(t)?ER(e,t,n):Ue(t)?PR(e,t,n):Le(t)?NR(e,t,n):Tt(t)?$R(e,t,n):ht(t)?RR(e,t,n):rt(t)?MR(e,t,n):ie(t)?OR(e,t,n):n}function FR(e,t){for(const n of Ii.Keys(e))Ii.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function _R(e){const t={};for(const n of Ii.Keys(e))t[n]=go(e[n]);return t}function DR(e){return Ic(kN(e))}function Ic(e){return e.map(t=>go(t))}function go(e){const t=ut(e)?Sr(go(e.items),il(e)):Ue(e)?Pn(Ic(e.allOf)):ie(e)?Ge(DR(e.anyOf)):Le(e)?$e(_R(e.properties)):Tt(e)?gl(ea(e),go(Lt(e))):rt(e)?mn(Ic(e.items)):e;return FR(e,t)}function Pu(e){return go(e)}function ti(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=Pu(n);return wn(t,s,r)}function tn(e){return re(e)&&C(e,"value")}function ne(e){return{value:e}}function LR(e){return z(e)?ne(e):ne([e])}function UR(e){return h(e,!0)?ne(BigInt(1)):ne(BigInt(0))}const BR=/^-?(0|[1-9]\d*)n$/,qR=/^-?(0|[1-9]\d*)\.\d+$/,HR=/^-?(0|[1-9]\d*)$/;function KR(e){return BR.test(e)}function zR(e){return qR.test(e)}function GR(e){return HR.test(e)}function VR(e){const t=e.toLowerCase();return KR(e)?ne(BigInt(e.slice(0,e.length-1))):zR(e)?ne(BigInt(e.split(".")[0])):GR(e)?ne(BigInt(e)):h(t,"false")?ne(BigInt(0)):h(t,"true")?ne(BigInt(1)):void 0}function Nu(e){return et(e)?ne(e):mt(e)?UR(e):ve(e)?ne(BigInt(Math.trunc(e))):Kt(e)?ne(BigInt(0)):oe(e)?VR(e):Oe(e)?ne(BigInt(0)):void 0}function WR(e){return h(e,BigInt(0))?ne(!1):h(e,BigInt(1))?ne(!0):void 0}function JR(e){return h(e,0)?ne(!1):h(e,1)?ne(!0):void 0}function QR(e){return h(e.toLowerCase(),"false")?ne(!1):h(e.toLowerCase(),"true")?ne(!0):h(e,"0")?ne(!1):h(e,"1")?ne(!0):void 0}function uk(e){return et(e)?WR(e):mt(e)?ne(e):ve(e)?JR(e):Kt(e)?ne(!1):oe(e)?QR(e):Oe(e)?ne(!1):void 0}function YR(e){return h(e,BigInt(0))?ne(null):void 0}function XR(e){return h(e,!1)?ne(null):void 0}function ZR(e){return h(e,0)?ne(null):void 0}function eM(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?ne(null):void 0}function tM(e){return et(e)?YR(e):mt(e)?XR(e):ve(e)?ZR(e):Kt(e)?ne(null):oe(e)?eM(e):Oe(e)?ne(null):void 0}const dk=BigInt(Number.MAX_SAFE_INTEGER),fk=BigInt(Number.MIN_SAFE_INTEGER);function nM(e){return e<=dk&&e>=fk?ne(Number(e)):void 0}function rM(e){return ne(e?1:0)}function sM(e){const t=+e;if(ve(t))return ne(t);const n=e.toLowerCase();if(h(n,"false"))return ne(0);if(h(n,"true"))return ne(1);const r=Nu(e);return tn(r)&&r.value<=dk&&r.value>=fk?ne(Number(r.value)):void 0}function $u(e){return et(e)?nM(e):mt(e)?rM(e):ve(e)?ne(e):Kt(e)?ne(0):oe(e)?sM(e):Oe(e)?ne(0):void 0}function mk(e){return et(e)||mt(e)||ve(e)?ne(e.toString()):Kt(e)?ne("null"):oe(e)?ne(e):Oe(e)?ne(""):void 0}function oM(e){return h(e,BigInt(0))?ne(void 0):void 0}function iM(e){return h(e,!1)?ne(void 0):void 0}function aM(e){return h(e,0)?ne(void 0):void 0}function cM(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?ne(void 0):void 0}function pk(e){return et(e)?oM(e):mt(e)?iM(e):ve(e)?aM(e):Kt(e)?ne(void 0):oe(e)?cM(e):Oe(e)?ne(e):void 0}function lM(e,t,n){return LR(n).value.map(s=>gn(e,t.items,s))}function uM(e,t,n){const r=Nu(n);return tn(r)?r.value:n}function dM(e,t,n){const r=uk(n);return tn(r)?r.value:n}function fM(e,t,n){return gn({...e,...t.$defs},on(t.$ref),n)}function mM(e,t,n){return gn(e,Mn(t),n)}function pM(e,t,n){const r=$u(n);return tn(r)?Math.trunc(r.value):n}function gM(e,t,n){const r=Rs(e,t),s=Mn(r);return gn(e,s,n)}function hM(e,t,n){const r=Nu(n);return tn(r)&&h(t.const,r.value)?r.value:n}function bM(e,t,n){const r=uk(n);return tn(r)&&h(t.const,r.value)?r.value:n}function xM(e,t,n){const r=$u(n);return tn(r)&&h(t.const,r.value)?r.value:n}function kM(e,t,n){const r=mk(n);return tn(r)&&h(t.const,r.value)?r.value:n}function yM(e,t,n){return h(t.const,n)?n:Aw(t)?hM(e,t,n):Pw(t)?bM(e,t,n):xm(t)?xM(e,t,n):km(t)?kM(e,t,n):Pt()}function SM(e,t,n){const r=tM(n);return tn(r)?r.value:n}function wM(e,t,n){const r=$u(n);return tn(r)?r.value:n}function gk(e,t,n,r){const s=D(r);for(const[o,i]of t)for(const a of s)o.test(a)||(r[a]=gn(e,n,r[a]));return r}function Ru(e,t,n){return Jt(e)&&Oe(n[t])}function vM(e,t,n){const r=Yc(t.properties),s=D(n);for(const[o,i]of r)for(const a of s)!o.test(a)||Ru(i,a,n)||(n[a]=gn(e,i,n[a]));return C(t,"additionalProperties")&&re(t.additionalProperties)?gk(e,r,t.additionalProperties,n):n}function IM(e,t,n){return cn(n)?vM(e,t,n):n}function jM(e,t,n){const r=Yc(t.patternProperties),s=D(n);for(const[o,i]of r)for(const a of s)o.test(a)&&(n[a]=gn(e,i,n[a]));return C(t,"additionalProperties")&&re(t.additionalProperties)?gk(e,r,t.additionalProperties,n):n}function CM(e,t,n){return cn(n)?jM(e,t,n):n}function TM(e,t,n){return C(e,t.$ref)?gn(e,e[t.$ref],n):n}function EM(e,t,n){const r=mk(n);return tn(r)?r.value:n}function AM(e,t,n){return gn(e,Mn(t),n)}function PM(e,t,n){if(!z(n))return n;for(let r=0;r<Math.min(t.items.length,n.length);r++)n[r]=gn(e,t.items[r],n[r]);return n}function NM(e,t,n){const r=pk(n);return tn(r)?r.value:n}function $M(e,t,n){if(t.anyOf.some(i=>nt(e,i,n)))return n;const o=t.anyOf.map(i=>gn(e,i,Ft(n))).find(i=>nt(e,t,i));return Oe(o)?n:o}function RM(e,t,n){const r=pk(n);return tn(r)?void 0:n}function gn(e,t,n){return ut(t)?lM(e,t,n):Xr(t)?uM(e,t,n):wr(t)?dM(e,t,n):Dt(t)?fM(e,t,n):fn(t)?mM(e,t,n):$n(t)?pM(e,t,n):Ue(t)?gM(e,t,n):Ve(t)?yM(e,t,n):Co(t)?SM(e,t,n):Zt(t)?wM(e,t,n):Le(t)?IM(e,t,n):Tt(t)?CM(e,t,n):ht(t)?TM(e,t,n):Tn(t)?EM(e,t,n):Ut(t)?AM(e,t,n):rt(t)?PM(e,t,n):Ns(t)?NM(e,t,n):ie(t)?$M(e,t,n):Zr(t)?RM(e,t,n):n}function va(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return gn(t,n,r)}function MM(e,t,n){if(!z(n))return n;for(let r=0;r<n.length;r++)n[r]=vn(e,t.items,n[r]);return n}function OM(e,t,n){return vn({...e,...t.$defs},on(t.$ref),n)}function FM(e,t){return Oe(t)?kn(e.default)?e.default():Ft(e.default):t}function _M(e,t,n){const r=Rs(e,t),s=Mn(r);return vn(e,s,n)}function DM(e,t,n){if(!re(n))return n;const r=D(t.properties);for(const s of r){const o=vn(e,t.properties[s],n[s]);Oe(o)&&(Jt(t.properties[s])||!C(t.properties[s],"default"))||(n[s]=o)}if(!Zn(t)||mt(t.additionalProperties))return n;for(const s of D(n))r.includes(s)||(n[s]=vn(e,t.additionalProperties,n[s]));return n}function LM(e,t,n){if(!re(n))return n;const[r,s]=[new RegExp(pn(t)),Lt(t)];for(const o of D(n))r.test(o)&&jr(s)&&(n[o]=vn(e,s,n[o]));if(!Zn(t))return n;for(const o of D(n))r.test(o)||(n[o]=vn(e,t.additionalProperties,n[o]));return n}function UM(e,t,n){return C(e,t.$ref)?vn(e,e[t.$ref],n):n}function BM(e,t,n){if(!z(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]=vn(e,r[o],n[o]));return n}function qM(e,t,n){for(const r of t.anyOf){const s=vn(e,r,Ft(n));if(nt(e,r,s))return s}return n}function vn(e,t,n){const r=jr(t)?FM(t,n):n;return ut(t)?MM(e,t,r):Dt(t)?OM(e,t,r):Ue(t)?_M(e,t,r):Le(t)?DM(e,t,r):Tt(t)?LM(e,t,r):ht(t)?UM(e,t,r):rt(t)?BM(e,t,r):ie(t)?qM(e,t,r):r}function Mu(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return vn(t,n,r)}function hk(e){return(...t)=>{const[n,r,s]=at(t,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return e.reduce((o,i)=>i(n,r,o),s)}}function HM(e,t,n){return t["~codec"].decode(n)}function KM(e,t,n){return t["~codec"].encode(n)}function St(e,t,n,r){return Yt(n)?h(e,"Decode")?HM(t,n,r):KM(t,n,r):r}function zM(e,t,n,r){if(!z(r))return r;for(let s=0;s<r.length;s++)r[s]=Mt(e,t,n.items,r[s]);return St(e,t,n,r)}function GM(e,t,n,r){const s=St(e,t,n,r);if(!z(s))return s;for(let o=0;o<s.length;o++)s[o]=Mt(e,t,n.items,s[o]);return s}function VM(e,t,n,r){return h(e,"Decode")?zM(e,t,n,r):GM(e,t,n,r)}function WM(e,t,n,r){return r=Mt(e,{...t,...n.$defs},on(n.$ref),r),St(e,t,n,r)}function bk(e){return e.reduce((t,n)=>({...t,...n}),{})}function xk(e,t){for(const n of t)if(!Jr(e,n))return n;return e}function JM(e,t,n,r){if(h(n.allOf.length,0))return St(e,t,n,r);const s=n.allOf.map(a=>Mt(e,t,a,ti(a,Ft(r)))),i=s.every(a=>re(a))?bk(s):xk(r,s);return St(e,t,n,i)}function QM(e,t,n,r){if(h(n.allOf.length,0))return St(e,t,n,r);const s=St(e,t,n,r),o=n.allOf.map(a=>Mt(e,t,a,ti(a,Ft(s))));return o.every(a=>re(a))?bk(o):xk(s,o)}function YM(e,t,n,r){return h(e,"Decode")?JM(e,t,n,r):QM(e,t,n,r)}function XM(e,t,n,r){if(!cn(r))return r;for(const s of D(n.properties))!C(r,s)||Ru(n.properties[s],s,r)||(r[s]=Mt(e,t,n.properties[s],r[s]));return St(e,t,n,r)}function ZM(e,t,n,r){const s=St(e,t,n,r);if(!cn(s))return s;for(const o of D(n.properties))!C(s,o)||Ru(n.properties[o],o,s)||(s[o]=Mt(e,t,n.properties[o],s[o]));return s}function eO(e,t,n,r){return h(e,"Decode")?XM(e,t,n,r):ZM(e,t,n,r)}function tO(e,t,n,r){if(!cn(r))return r;const s=new RegExp(pn(n));for(const o of D(r))s.test(o)&&(r[o]=Mt(e,t,Lt(n),r[o]));return St(e,t,n,r)}function nO(e,t,n,r){const s=St(e,t,n,r);if(!cn(s))return s;const o=new RegExp(pn(n));for(const i of D(s))o.test(i)&&(s[i]=Mt(e,t,Lt(n),s[i]));return s}function rO(e,t,n,r){return h(e,"Decode")?tO(e,t,n,r):nO(e,t,n,r)}function Ud(e,t,n,r){return C(t,n.$ref)?Mt(e,t,t[n.$ref],r):r}function sO(e,t,n,r){return h(e,"Decode")?St(e,t,n,Ud(e,t,n,r)):Ud(e,t,n,St(e,t,n,r))}function oO(e,t,n,r){if(!z(r))return r;for(let s=0;s<Math.min(n.items.length,r.length);s++)r[s]=Mt(e,t,n.items[s],r[s]);return St(e,t,n,r)}function iO(e,t,n,r){const s=St(e,t,n,r);if(!z(s))return r;for(let o=0;o<Math.min(n.items.length,s.length);o++)s[o]=Mt(e,t,n.items[o],s[o]);return s}function aO(e,t,n,r){return h(e,"Decode")?oO(e,t,n,r):iO(e,t,n,r)}function cO(e,t,n,r){for(const s of n.anyOf){if(!nt(t,s,r))continue;const o=Mt(e,t,s,r);return St(e,t,n,o)}return r}function lO(e,t,n,r){const s=St(e,t,n,r);for(const o of n.anyOf){const i=Mt(e,t,o,Ft(s));if(nt(t,o,i))return i}return s}function uO(e,t,n,r){return h(e,"Decode")?cO(e,t,n,r):lO(e,t,n,r)}function Mt(e,t,n,r){return ut(n)?VM(e,t,n,r):Dt(n)?WM(e,t,n,r):Ue(n)?YM(e,t,n,r):Le(n)?eO(e,t,n,r):Tt(n)?rO(e,t,n,r):ht(n)?sO(e,t,n,r):rt(n)?aO(e,t,n,r):ie(n)?uO(e,t,n,r):St(e,t,n,r)}class dO extends wa{constructor(t,n){super("Decode",t,n)}}function fO(e,t,n){if(!nt(e,t,n))throw new dO(n,ei(e,t,n));return n}function mO(e,t,n){const r=Pu(t);return Mt("Decode",e,r,n)}const pO=hk([(e,t,n)=>Ft(n),(e,t,n)=>Mu(e,t,n),(e,t,n)=>va(e,t,n),(e,t,n)=>ti(e,t,n),(e,t,n)=>fO(e,t,n),(e,t,n)=>mO(e,t,n)]);function gO(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return pO(t,n,r)}class hO extends wa{constructor(t,n){super("Encode",t,n)}}function bO(e,t,n){if(!nt(e,t,n))throw new hO(n,ei(e,t,n));return n}function xO(e,t,n){const r=Pu(t);return Mt("Encode",e,r,n)}const kO=hk([(e,t,n)=>Ft(n),(e,t,n)=>xO(e,t,n),(e,t,n)=>Mu(e,t,n),(e,t,n)=>va(e,t,n),(e,t,n)=>ti(e,t,n),(e,t,n)=>bO(e,t,n)]);function yO(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return kO(t,n,r)}function SO(e,t){return Yt(t)||Nr(e,t.items)}function wO(e,t){return Yt(t)||kk({...e,...t.$defs},on(t.$ref))}function vO(e,t){return Yt(t)||t.allOf.some(n=>Nr(e,n))}function IO(e,t){return Yt(t)||D(t.properties).some(n=>Nr(e,t.properties[n]))}function jO(e,t){return Yt(t)||Nr(e,Lt(t))}function kk(e,t){return jc.has(t.$ref)?!1:(jc.add(t.$ref),Yt(t)||C(e,t.$ref)&&Nr(e,e[t.$ref]))}function CO(e,t){return Yt(t)||t.items.some(n=>Nr(e,n))}function TO(e,t){return Yt(t)||t.anyOf.some(n=>Nr(e,n))}function Nr(e,t){return ut(t)?SO(e,t):Dt(t)?wO(e,t):Ue(t)?vO(e,t):Le(t)?IO(e,t):Tt(t)?jO(e,t):ht(t)?kk(e,t):rt(t)?CO(e,t):ie(t)?TO(e,t):Yt(t)}const jc=new Set;function EO(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return jc.clear(),Nr(t,n)}class ni extends Error{constructor(t,n){super(n),this.type=t}}function AO(e,t){return kn(t.default)?t.default(t):re(t.default)?Ft(t.default):t.default}function PO(e,t){if(yr(t)&&!jr(t))throw new ni(t,"Arrays with uniqueItems constraints must specify a default annotation");const n=os(t)?t.minItems:0;return Array.from({length:n},()=>hn(e,t.items))}function NO(e,t){return Cr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Er(t)?BigInt(t.minimum):BigInt(0)}function $O(e,t){return!1}function RO(e,t){const n=hn(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function MO(e,t){return hn({...e,...t.$defs},on(t.$ref))}function OO(e,t){return hn(e,Mn(t))}function FO(e,t){const n=hn(e,t.returnType);return()=>n}function _O(e,t){return Cr(t)&&ve(t.exclusiveMinimum)?t.exclusiveMinimum+1:Er(t)?t.minimum:0}function DO(e,t){const n=Rs(e,t),r=Mn(n);return hn(e,r)}function LO(e,t){return t.const}function UO(e,t){throw new ni(t,"Cannot create TNever types")}function BO(e,t){return null}function qO(e,t){return Cr(t)&&ve(t.exclusiveMinimum)?t.exclusiveMinimum+1:Er(t)?t.minimum:0}function HO(e,t){return(Oe(t.required)?[]:t.required).reduce((r,s)=>({...r,[s]:hn(e,t.properties[s])}),{})}function KO(e,t){if(_s(t)&&!jr(t))throw new ni(t,"Record with the minProperties constraint must have a default annotation");return{}}function zO(e,t){return C(e,t.$ref)?hn(e,e[t.$ref]):(()=>{throw new ni(t,"Unable to deref Ref")})()}function GO(e,t){if((Ds(t)||Ms(t))&&!jr(t))throw Error("Strings with format or pattern constraints must specify default");const r=Fs(t)?t.minLength:0;return"".padEnd(r)}function VO(e,t){return Symbol()}function WO(e,t){const n=pl(t.pattern);if(Tn(n))throw new ni(t,"Unable to create TemplateLiteral due to infinite type expansion");return hn(e,n)}function JO(e,t){return Array.from({length:t.minItems},(n,r)=>hn(e,t.items[r]))}function QO(e,t){if(h(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return hn(e,t.anyOf[0])}function hn(e,t){return jr(t)?AO(e,t):ut(t)?PO(e,t):Xr(t)?NO(e,t):wr(t)?$O():ln(t)?RO(e,t):Dt(t)?MO(e,t):fn(t)?OO(e,t):un(t)?FO(e,t):$n(t)?_O(e,t):Ue(t)?DO(e,t):Ve(t)?LO(e,t):Es(t)?UO(e,t):Co(t)?BO():Zt(t)?qO(e,t):Le(t)?HO(e,t):Tt(t)?KO(e,t):ht(t)?zO(e,t):Tn(t)?GO(e,t):To(t)?VO():Ut(t)?WO(e,t):rt(t)?JO(e,t):Ns(t)?void 0:ie(t)?QO(e,t):Zr(t)?void 0:void 0}function In(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return hn(t,n)}function yk(e,t){return Jr(e,t)}function Sk(e){return Ji(e)}class YO extends wa{constructor(t,n){super("Parse",t,n)}}function XO(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(nt(t,n,r))return r;throw new YO(r,ei(t,n,r))}function Ia(e,t){return{type:"update",path:e,value:t}}function wk(e,t){return{type:"insert",path:e,value:t}}function vk(e){return{type:"delete",path:e}}function Bd(e){if(!(re(e)&&h(Xc(e).length,0)))throw new Error("Cannot create diffs for objects with symbols keys")}function*ZO(e,t,n){if(!re(n)||z(n))return yield Ia(e,n);Bd(t),Bd(n);const r=D(t),s=D(n);for(const o of s)C(t,o)||qn(o)||(yield wk(`${e}/${o}`,n[o]));for(const o of r)C(n,o)&&(qn(o)||yk(t,n)||(yield*ja(`${e}/${o}`,t[o],n[o])));for(const o of r)C(n,o)||qn(o)||(yield vk(`${e}/${o}`))}function*eF(e,t,n){if(!z(n))return yield Ia(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*ja(`${e}/${r}`,t[r],n[r]);for(let r=0;r<n.length;r++)r<t.length||(yield wk(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield vk(`${e}/${r}`))}function*tF(e,t,n){const r=globalThis.Object.getPrototypeOf(t).constructor.name,s=globalThis.Object.getPrototypeOf(n).constructor.name;if(yo(n)&&h(t.length,n.length)&&h(r,s))for(let i=0;i<Math.min(t.length,n.length);i++)yield*ja(`${e}/${i}`,t[i],n[i]);else return yield Ia(e,n)}function*nF(e,t,n){t!==n&&(yield Ia(e,n))}function*ja(e,t,n){return yo(t)?yield*tF(e,t,n):z(t)?yield*eF(e,t,n):re(t)?yield*ZO(e,t,n):yield*nF(e,t,n)}function rF(e,t){return[...ja("",e,t)]}const sF=$e({type:_e("insert"),path:Rn(),value:_t()}),oF=Object({type:_e("update"),path:Rn(),value:_t()}),iF=$e({type:_e("delete"),path:Rn()});Ge([sF,oF,iF]);function aF(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function cF(e){return e.length===0}function lF(e,t){if(aF(t))return Ft(t[0].value);if(cF(t))return Ft(e);const n=Ft(e);for(const r of t)switch(r.type){case"insert":{vc(n,r.path,r.value);break}case"update":{vc(n,r.path,r.value);break}case"delete":{Qx(n,r.path);break}}return n}class Ca extends Error{constructor(t,n,r,s){super(s),this.context=t,this.type=n,this.value=r}}function uF(e){const[t,n]=[new Set,[]];for(const r of e){const s=Sk(r);t.has(s)||(t.add(s),n.push(r))}return n}function dF(e,t,n){if(nt(e,t,n))return n;const r=z(n)?n:In(e,t),s=os(t)&&r.length<t.minItems?[...r,...Array.from({length:t.minItems-r.length},()=>In(e,t))]:r,i=(Os(t)&&s.length>t.maxItems?s.slice(0,t.maxItems):s).map(l=>an(e,t.items,l));if(!yr(t)||yr(t)&&!h(t.uniqueItems,!0))return i;const a=uF(i);if(!nt(e,t,a))throw new Ca(e,t,n,"Failed to repair Array due to uniqueItems constraint");return a}function fF(e,t,n){return an(e,Mn(t),n)}function mF(e,t,n){const r=Rs(e,t),s=Mn(r);return an(e,s,n)}function pF(e,t,n){if(nt(e,t,n))return n;if(!cn(n))return In(e,t);const r=new Set(Oe(t.required)?[]:t.required),s={};for(const[i,a]of tt(t.properties))!r.has(i)&&Oe(n[i])||(s[i]=i in n?an(e,a,n[i]):In(e,a));const o=D(t.properties);if(Zn(t)&&re(t.additionalProperties))for(const i of D(n))o.includes(i)||(s[i]=an(e,t.additionalProperties,n[i]));return s}function gF(e,t,n){if(nt(e,t,n))return n;if(Kt(n)||!re(n)||z(n))return In(e,t);const r=new RegExp(pn(t)),s=Lt(t),o=new Set,i={};for(const[a,l]of tt(n))r.test(a)&&(i[a]=an(e,s,l),o.add(a));if(Zn(t))for(const a of D(n))o.has(a)||(i[a]=an(e,t.additionalProperties,n[a]));return i}function hF(e,t,n){return C(e,t.$ref)?an(e,e[t.$ref],n):(()=>{throw new Ca(e,t,n,"Unable to de-reference target type")})()}function bF(e,t,n){const r=pl(t.pattern);return an(e,r,n)}function xF(e,t,n){return nt(e,t,n)?n:z(n)?t.items.map((r,s)=>an(e,r,n[s])):In(e,t)}function Ik(e,t,n){return ht(t)?C(e,t.$ref)?Ik(e,e[t.$ref]):(()=>{throw new Error("Unable to Deref target")})():t}function kF(e,t,n){if(!(Le(t)&&re(n)))return 0;const r=D(n);return tt(t.properties).reduce((o,[i,a])=>{const l=Ve(a)&&h(a.const,n[i])?100:0,u=nt(e,a,n[i])?10:0,f=r.includes(i)?1:0;return o+(l+u+f)},0)}function yF(e,t,n){const r=t.anyOf.map(i=>Ik(e,i));let[s,o]=[r[0],0];for(const i of r){const a=kF(e,i,n);a>o&&(s=i,o=a)}return s}function SF(e,t,n){const r=Ge(Yi(t.anyOf)),s=yF(e,r,n);return an(e,s,n)}function wF(e,t,n){return nt(e,t,n)?Ft(n):jr(t)?In(e,t):SF(e,t,n)}function vF(e,t,n){if(nt(e,t,n))return n;const r=va(e,t,n);return nt(e,t,r)?r:In(e,t)}function IF(e,t,n){if(tm(n)||rm(n)||nm(n)||yo(n)||zi(n)||kn(n))throw new Ca(e,t,n,"Value is not repairable")}function jF(e,t,n){if(ln(t)||un(t)||Es(t))throw new Ca(e,t,n,"Type is not repairable")}function CF(e,t,n){return Oe(n)&&!Ns(t)?In(e,t):n}function TF(e,t,n){return ul(t)?nt(e,t,n)?n:In(e,t):n}function an(e,t,n){IF(e,t,n),jF(e,t,n);const r=CF(e,t,n),s=ut(t)?dF(e,t,r):fn(t)?fF(e,t,r):Ue(t)?mF(e,t,r):Le(t)?pF(e,t,r):Tt(t)?gF(e,t,r):ht(t)?hF(e,t,r):Ut(t)?bF(e,t,r):rt(t)?xF(e,t,r):ie(t)?wF(e,t,r):vF(e,t,r);return TF(e,t,s)}function EF(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=an(t,n,r);return ck(t,n,s),s}const za=Object.freeze(Object.defineProperty({__proto__:null,Assert:ck,Check:nt,Clean:ti,Clone:Ft,Convert:va,Create:In,Decode:gO,Default:Mu,Diff:rF,Encode:yO,Equal:yk,Errors:ei,HasCodec:EO,Hash:Sk,Parse:XO,Patch:lF,Pointer:Yx,Repair:EF},Symbol.toStringTag,{value:"Module"}));class qd 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 AF(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 PF(e,t){let n=e;for(const r of t){if(n===null||typeof n!="object")return;n=n[r]}return n}function Hd(e,t){const[,n]=CR.Errors(e,t);return n.map(r=>{const s=AF(r.instancePath);return{code:r.keyword,path:s,message:r.message,value:PF(t,s)}})}function jk(e,t){const n=za.Default(e,za.Clone(t)),r=Hd(e,n);if(r.length>0)return{success:!1,error:new qd(r)};const s=za.Clean(e,n),o=Hd(e,s);return o.length>0?{success:!1,error:new qd(o)}:{success:!0,data:s}}function ar(e,t){const n=jk(e,t);if(!n.success)throw n.error;return n.data}function te(e){return Object.defineProperties(e,{parse:{value:t=>ar(e,t),enumerable:!1},safeParse:{value:t=>jk(e,t),enumerable:!1}}),e}function Fi(e,t){return m.Optional({...e,default:t})}function Ce(e,t={}){return m.Unsafe({type:"string",enum:[...e],...t})}const Ur=20,io=5*1024*1024,NF=32e3,Ou=te(Ce(["default","autoEdit","yolo","plan"])),fr={DEFAULT:"default",AUTO_EDIT:"autoEdit",YOLO:"yolo",PLAN:"plan"},Fu=te(Ce(["user","assistant","system","tool"])),$F=te(m.Union([m.Object({type:m.Literal("text"),text:m.String()}),m.Object({type:m.Literal("image_url"),image_url:m.Object({url:m.String()})})])),Ck=m.Union([m.String(),m.Array($F)]);te(m.Object({id:m.String(),role:Fu,content:Ck,timestamp:m.Number(),metadata:m.Optional(m.Record(m.String(),m.Unknown())),thinkingContent:m.Optional(m.String()),tool_call_id:m.Optional(m.String()),name:m.Optional(m.String()),tool_calls:m.Optional(m.Unknown())}));const RF=te(Ce(["queued","running","completed","failed","cancelled","interrupted"])),Tk=te(Ce(["local","worktree"])),MF=te(Ce(["applied","discarded","conflicted"])),OF=te(m.Object({status:MF,updatedAt:m.String(),sourceCommit:m.Optional(m.String()),changedFiles:m.Optional(m.Integer({minimum:0})),message:m.Optional(m.String())})),FF=te(m.Object({changedFiles:m.Integer({minimum:0}),additions:m.Integer({minimum:0}),deletions:m.Integer({minimum:0}),commits:m.Integer({minimum:0})})),_F=te(m.Object({path:m.String({minLength:1}),patch:m.String({maxLength:2*1024*1024}),additions:m.Integer({minimum:0}),deletions:m.Integer({minimum:0}),binary:m.Boolean(),truncated:m.Boolean()})),DF=te(m.Object({sessionId:m.String(),projectPath:m.String(),baseCommit:m.String(),files:m.Array(_F,{maxItems:100}),truncated:m.Boolean()})),LF=m.Union([m.String(),m.Number(),m.Boolean(),m.Array(m.String())]),UF=te(m.Object({name:m.String(),type:Ce(["string","number","integer","boolean","select","multi-select"]),title:m.String(),description:m.Optional(m.String()),required:m.Boolean(),defaultValue:m.Optional(LF),options:m.Optional(m.Array(m.Object({value:m.String(),label:m.String()}))),format:m.Optional(Ce(["date","uri","email","date-time"])),minimum:m.Optional(m.Number()),maximum:m.Optional(m.Number()),minLength:m.Optional(m.Number()),maxLength:m.Optional(m.Number()),minItems:m.Optional(m.Number()),maxItems:m.Optional(m.Number())}));te(m.Object({serverName:m.String(),mode:Ce(["form","url"]),message:m.String(),fields:m.Optional(m.Array(UF)),requestedSchema:m.Optional(m.Record(m.String(),m.Unknown())),url:m.Optional(m.String()),domain:m.Optional(m.String()),elicitationId:m.Optional(m.String())}));const BF=te(m.Object({type:Ce(["permission","question","elicitation"]),requestId:m.String()})),qF=te(m.Object({code:Ce(["authentication","permission","rate_limit","timeout","network","model_unavailable","context_limit","unsupported_input","runtime"]),message:m.String({minLength:1,maxLength:500}),retryable:m.Boolean()})),_u=te(Ce(["auto","off","minimal","low","medium","high","xhigh","max"])),Du=te(Ce(["auto","standard","fast","flex"])),Lu=te(Ce(["auto","low","medium","high"])),ri=te(m.Union([Ce(["auto","pragmatic","friendly","explanatory"]),m.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})$"})])),Kn=te(m.Object({sessionId:m.String(),projectPath:m.String(),title:m.Optional(m.String()),gitBranch:m.Optional(m.String()),rootId:m.String(),parentId:m.Optional(m.String()),relationType:m.Optional(Ce(["subagent","fork"])),resumedFrom:m.Optional(m.String()),rootAgentId:m.Optional(m.String()),resumeDepth:m.Optional(m.Integer({minimum:0})),taskStatus:Fi(RF,"completed"),taskStatusReason:m.Optional(m.String()),taskFailure:m.Optional(qF),taskStartedAt:m.Optional(m.String()),taskCompletedAt:m.Optional(m.String()),taskPromptSummary:m.Optional(m.String()),taskModelId:m.Optional(m.String()),selectedModelId:m.Optional(m.String()),reasoningEffort:m.Optional(_u),serviceTier:m.Optional(Du),responseVerbosity:m.Optional(Lu),communicationStyle:m.Optional(ri),communicationStyleDigest:m.Optional(m.String({pattern:"^[a-f0-9]{64}$"})),projectInstructionsDigest:m.Optional(m.String({pattern:"^[a-f0-9]{64}$"})),taskRetryAvailable:m.Optional(m.Boolean()),taskRetriedFrom:m.Optional(m.Object({sessionId:m.String(),projectPath:m.String()})),taskDelivery:m.Optional(OF),taskIsolation:m.Optional(Tk),taskSourceProjectPath:m.Optional(m.String()),taskWorktreePath:m.Optional(m.String()),taskWorktreeBranch:m.Optional(m.String()),taskBaseCommit:m.Optional(m.String()),taskDiffStat:m.Optional(FF),taskQueuePosition:m.Optional(m.Integer({minimum:1})),taskQueueDepth:m.Optional(m.Integer({minimum:0})),taskConcurrencyLimit:m.Optional(m.Integer({minimum:1})),archivedAt:m.Optional(m.String()),archivedBySessionId:m.Optional(m.String()),pendingInteraction:m.Optional(BF),messageCount:m.Number(),firstMessageTime:m.String(),lastMessageTime:m.String(),hasErrors:m.Boolean()})),HF=te(m.Object({sessions:m.Array(Kn),nextCursor:m.Optional(m.String())})),KF=te(m.Object({session:Kn,archivedSessionIds:m.Array(m.String())})),zF=te(m.Object({session:Kn,restoredSessionIds:m.Array(m.String())}));te(m.Object({version:m.Literal(1),sessionId:m.String(),goalId:m.String(),objective:m.String(),status:Ce(["active","paused","blocked","usage_limited","budget_limited","complete"]),tokenBudget:m.Optional(m.Number()),tokensUsed:m.Number(),timeUsedSeconds:m.Number(),continuationCount:m.Number(),statusReason:m.Optional(m.String()),createdAt:m.String(),updatedAt:m.String()}));const Uu=te(m.Object({role:Fu,content:Ck,metadata:m.Optional(m.Unknown()),reasoningContent:m.Optional(m.String()),thinkingContent:m.Optional(m.String()),tool_call_id:m.Optional(m.String()),name:m.Optional(m.String()),tool_calls:m.Optional(m.Unknown())})),GF=te(m.Object({session:Kn,messages:m.Array(Uu)})),Ek=te(Ce(["conversation","code","both"])),Ak=te(m.Object({messageId:m.String(),preview:m.String(),createdAt:m.String(),fileCount:m.Integer({minimum:0})}));te(m.Object({targetMessageId:m.String({minLength:1}),mode:Fi(Ek,"conversation")}));const VF=te(m.Object({checkpoint:Ak,mode:Ek,removedTurns:m.Integer({minimum:1}),restoredFiles:m.Array(m.String()),messages:m.Array(Uu)})),WF=Ce(["running","completed","failed","cancelled"]),Cc=te(m.Object({id:m.String(),subagentType:m.String(),description:m.String(),status:WF,rootAgentId:m.String(),resumedFrom:m.Optional(m.String()),resumeDepth:m.Integer({minimum:0}),createdAt:m.Number(),lastActiveAt:m.Number(),completedAt:m.Optional(m.Number()),result:m.Optional(m.Object({success:m.Boolean(),message:m.String(),error:m.Optional(m.String()),verificationCommands:m.Optional(m.Array(m.String())),verificationVerdict:m.Optional(Ce(["pass","fail","partial"])),modifiedFiles:m.Optional(m.Array(m.String()))})),stats:m.Optional(m.Object({tokens:m.Optional(m.Number()),toolCalls:m.Optional(m.Number()),duration:m.Optional(m.Number())}))}));te(m.Object({prompt:m.String({minLength:1,maxLength:32e3,pattern:"\\S"})}));const JF=te(m.Object({source:Cc,session:Cc})),Pk=te(m.Object({sessionId:m.String(),projectPath:m.String()})),Nk=te(m.Object({path:m.String(),name:m.String(),gitBranch:m.Optional(m.String()),available:m.Boolean(),isCurrent:m.Boolean(),boundAt:m.String()})),QF=te(m.Union([m.Object({cancelled:m.Literal(!0)}),m.Object({cancelled:m.Literal(!1),path:m.String({minLength:1})})])),Kd=te(m.Object({type:m.String(),seq:m.Optional(m.Number()),properties:m.Record(m.String(),m.Unknown())})),$k=m.Object({type:Ce(["file","image","url"]),path:m.Optional(m.String()),url:m.Optional(m.String()),content:m.Optional(m.String({maxLength:io})),mimeType:m.Optional(m.String()),name:m.Optional(m.String())});te(m.Object({prompt:m.String({minLength:1,maxLength:32e3,pattern:"\\S"}),title:m.Optional(m.String({minLength:1,maxLength:200})),projectPath:m.Optional(m.String()),modelId:m.Optional(m.String({minLength:1,maxLength:500})),reasoningEffort:m.Optional(_u),serviceTier:m.Optional(Du),responseVerbosity:m.Optional(Lu),communicationStyle:m.Optional(ri),isolation:Fi(Tk,"worktree"),permissionMode:Fi(Ou,"default"),attachments:m.Optional(m.Array($k,{maxItems:Ur}))}));const zd=te(m.Object({session:Kn,runId:m.String(),messageId:m.String(),status:Ce(["queued","running"]),queuePosition:m.Optional(m.Integer({minimum:1})),queueDepth:m.Optional(m.Integer({minimum:0})),maxConcurrentTasks:m.Optional(m.Integer({minimum:1}))}));te(m.Object({action:Ce(["apply","discard"])}));te(m.Object({content:m.String({maxLength:NF}),projectPath:m.Optional(m.String()),modelId:m.Optional(m.String({minLength:1,maxLength:500})),reasoningEffort:m.Optional(_u),serviceTier:m.Optional(Du),responseVerbosity:m.Optional(Lu),communicationStyle:m.Optional(ri),permissionMode:m.Optional(Ou),attachments:m.Optional(m.Array($k,{maxItems:Ur}))}));const YF=Ce(["completed","failed","aborted","timed_out","spawn_error"]),XF=te(m.Object({version:m.Literal(1),command:m.String(),status:YF,exitCode:m.Union([m.Integer(),m.Null()]),durationMs:m.Number({minimum:0}),stdout:m.String(),stderr:m.String(),stdoutOmittedBytes:m.Integer({minimum:0}),stderrOmittedBytes:m.Integer({minimum:0}),binaryOutput:m.Boolean(),truncated:m.Boolean()}));te(m.Object({command:m.String({minLength:1,maxLength:32*1024,pattern:"^(?![\\s\\S]*\\u0000)(?=[\\s\\S]*\\S)[\\s\\S]*$"}),projectPath:m.Optional(m.String())}));const ZF=te(m.Object({executionId:m.String(),messageId:m.String(),record:XF,auxiliary:m.Boolean(),delivery:m.Optional(Ce(["current_turn","next_turn"])),queued:m.Optional(m.Integer({minimum:0}))}));te(m.Object({messageId:m.String(),role:Fu,content:m.String(),timestamp:m.String()}));te(m.Object({approved:m.Boolean(),remember:m.Optional(m.Boolean()),scope:m.Optional(Ce(["once","session","project"])),targetMode:m.Optional(Ou),feedback:m.Optional(m.String()),answers:m.Optional(m.Record(m.String(),m.Union([m.String(),m.Array(m.String())]))),elicitation:m.Optional(m.Object({action:Ce(["accept","decline","cancel"]),content:m.Optional(m.Record(m.String(),m.Union([m.String({maxLength:4e3}),m.Number(),m.Boolean(),m.Array(m.String({maxLength:1e3}),{maxItems:100})]),{maxProperties:32}))}))}));const e_=te(m.Object({id:ri,name:m.String({minLength:1,maxLength:80}),description:m.String({minLength:1,maxLength:256}),source:Ce(["built-in","user","project","plugin"]),contentSha256:m.Optional(m.String({pattern:"^[a-f0-9]{64}$"}))}));te(m.Object({id:m.String(),displayName:m.Optional(m.String()),provider:m.String(),model:m.String(),contextWindow:m.Optional(m.Number()),maxTokens:m.Optional(m.Number()),reasoning:m.Optional(m.Boolean()),supportedReasoningEfforts:m.Optional(m.Array(Ce(["off","minimal","low","medium","high","xhigh","max"]))),supportedServiceTiers:m.Optional(m.Array(Ce(["standard","fast","flex"]))),supportedResponseVerbosities:m.Optional(m.Array(Ce(["low","medium","high"]))),communicationStyles:m.Optional(m.Array(e_,{maxItems:36})),input:m.Optional(m.Array(Ce(["text","image"]))),overrides:m.Optional(m.Object({baseUrl:m.Optional(m.String()),temperature:m.Optional(m.Number()),maxOutputTokens:m.Optional(m.Number()),timeout:m.Optional(m.Number()),streamIdleTimeout:m.Optional(m.Number({minimum:1e3}))}))}));te(Ce(["vs-dark","vs-light","hc-black"]));const t_=te(Ce(["light","dark","system"])),n_=te(m.Object({language:m.String(),theme:m.String(),uiTheme:t_,autoSaveSessions:m.Boolean(),notifyBuild:m.Boolean(),notifyErrors:m.Boolean(),notifySounds:m.Boolean(),privacyTelemetry:m.Boolean(),privacyCrash:m.Boolean(),communicationStyle:m.Optional(ri)}));te(m.Partial(n_));async function cr(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 be="",Gd=1e4,r_=m.Array(Kn),s_=m.Array(Nk),o_=m.Array(Uu),i_=m.Array(Ak),a_=m.Array(Cc),c_=m.Object({cwd:m.String(),gitBranch:m.Optional(m.String()),taskAdmission:m.Optional(m.Object({inFlight:m.Integer({minimum:0}),queued:m.Integer({minimum:0}),maxConcurrent:m.Integer({minimum:1}),maxQueued:m.Integer({minimum:1})}))}),l_=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),u_=()=>{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 d_(e){const t=Pk.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function dt(e,t){const n=d_(t);return`${e}${e.includes("?")?"&":"?"}${n}`}function f_(e){return{"x-blade-directory":Pk.parse(e).projectPath}}const Ga=(e,t,n)=>({id:`history-${t}-${n}`,role:e.role,content:l_(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}),de={listProjects:async()=>{const e=await fetch(`${be}/projects`);if(!e.ok)throw new Error("Failed to load projects");return ar(s_,await e.json())},bindProject:async e=>{var n;const t=await fetch(`${be}/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 Nk.parse(await t.json())},pickProjectDirectory:async()=>ar(QF,await cr(`${be}/projects/pick`,{method:"POST"})),unbindProject:async e=>{if(!(await fetch(`${be}/projects?path=${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to unbind project")},listSessions:async()=>{const e=await fetch(`${be}/sessions`);if(!e.ok)throw new Error("Failed to load sessions");return ar(r_,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(`${be}/sessions/catalog?${r.toString()}`);if(!s.ok)throw new Error("Failed to load session catalog");return HF.parse(await s.json())},getSession:async e=>Kn.parse(await cr(dt(`${be}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{const n=await fetch(`${be}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,title:t||u_()})});if(!n.ok)throw new Error("Failed to create session");return Kn.parse(await n.json())},getWorkspaceInfo:async()=>ar(c_,await cr(`${be}/global/info`)),createTask:async e=>{var n;const t=await fetch(`${be}/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 zd.parse(await t.json())},retryTask:async e=>{var n;const t=await fetch(dt(`${be}/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 zd.parse(await t.json())},deliverTask:async(e,t)=>{var r;const n=await fetch(dt(`${be}/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 Kn.parse(await n.json())},getTaskDiff:async e=>{var n;const t=await fetch(dt(`${be}/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 DF.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(dt(`${be}/sessions/${e.sessionId}`,e),{method:"DELETE"})).ok)throw new Error("Failed to delete session")},archiveSession:async e=>KF.parse(await cr(dt(`${be}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>zF.parse(await cr(dt(`${be}/sessions/${e.sessionId}/unarchive`,e),{method:"POST"})),exportSessionMarkdown:async(e,t=!1)=>{var u,f;const n=dt(`${be}/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(((u=p==null?void 0:p.error)==null?void 0:u.message)||"Failed to export session")}const o=s.headers.get("content-disposition")??"",i=((f=/filename="([A-Za-z0-9._-]+)"/.exec(o))==null?void 0:f[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 k=Number(g);if(!Number.isInteger(k)||k<0)throw new Error(`Session export has an invalid ${p} header`);return k};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(`${be}/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(dt(`${be}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw new Error("Failed to load messages");const n=ar(o_,await t.json()),r=Date.now();return n.map((s,o)=>Ga(s,o,r))},sendMessage:async(e,t,n)=>{var s;const r=await fetch(`${be}/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)=>ZF.parse(await cr(`${be}/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(dt(`${be}/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(dt(`${be}/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(dt(`${be}/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(dt(`${be}/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(dt(`${be}/sessions/${e.sessionId}/goal`,e),{method:"DELETE"})).ok)throw new Error("Failed to clear goal")},listRewindCheckpoints:async e=>{const t=await fetch(dt(`${be}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw new Error("Failed to load rewind checkpoints");const n=await t.json();return ar(i_,n.checkpoints)},rewindSession:async(e,t,n)=>{const r=await fetch(dt(`${be}/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=VF.parse(await r.json()),o=Date.now();return{...s,messages:s.messages.map((i,a)=>Ga(i,a,o))}},listSubagents:async e=>{const t=await fetch(dt(`${be}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw new Error("Failed to load subagents");const n=await t.json();return ar(a_,n.subagents)},resumeSubagent:async(e,t,n)=>{const r=await fetch(dt(`${be}/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 JF.parse(await r.json())},forkSession:async e=>{const t=await fetch(`${be}/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=GF.parse(await t.json()),r=Date.now();return{session:n.session,messages:n.messages.map((s,o)=>Ga(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,u=Date.now(),f=null,p=null,g=!1,k=!1,b=0,y,j,x=!1;const I=new Promise((E,q)=>{y=E,j=q}),N=()=>{f&&(clearInterval(f),f=null)},F=()=>{p&&(clearTimeout(p),p=null)},M=()=>{i==null||i.close(),i=null},R=()=>{l&&(clearTimeout(l),l=null),N(),F(),M()},P=()=>{x||(x=!0,F(),y())},$=E=>{x||(x=!0,R(),j(E))},A=()=>{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 E=Math.min(1e3*Math.pow(2,a-1),3e4);console.log(`SSE reconnecting in ${E}ms (attempt ${a}/${r})`),l=setTimeout(()=>{Z().catch(q=>{console.error("SSE reconnect failed",q),s==null||s(!1),A()})},E)},_=()=>{a=0,u=Date.now(),s==null||s(!0),o==null||o("connected"),N(),f=setInterval(()=>{Date.now()-u>45e3&&(console.warn("SSE heartbeat timeout, reconnecting..."),N(),M(),s==null||s(!1),o==null||o("reconnecting"),A())},15e3),k||(k=!0,P())},Z=async()=>{if(g)return;M();const E=dt(`${be}/sessions/${e.sessionId}/events`,e),q=b>0?`${E}${E.includes("?")?"&":"?"}lastEventId=${b}`:E;i=new EventSource(q),k||(F(),p=setTimeout(()=>{o==null||o("offline"),$(new Error("Timed out waiting for event subscription readiness"))},Gd)),i.onmessage=K=>{try{const me=JSON.parse(K.data);typeof me.seq=="number"&&me.seq>b&&(b=me.seq);const X=Kd.parse(me);if(u=Date.now(),X.type==="connected"){X.properties.sessionId===e.sessionId&&X.properties.projectPath===e.projectPath&&(typeof X.properties.status=="string"&&t({type:"session.status",properties:X.properties}),_());return}if(X.type==="heartbeat")return;t(X)}catch(me){console.error("Failed to parse SSE event:",K.data,me)}},i.onerror=()=>{if(!g){if(N(),M(),!k){o==null||o("offline"),$(new Error("Failed to open event subscription"));return}console.error("SSE connection error"),s==null||s(!1),A()}}};return o==null||o("connecting"),Z().catch(E=>{o==null||o("offline"),$(E instanceof Error?E:new Error("Failed to open event subscription"))}),await I,()=>{g=!0,l&&(clearTimeout(l),l=null),R(),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(`${be}/events`);let o=!1,i=!1,a,l,u;const f=new Promise((g,k)=>{l=g,u=k}),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(),u(new Error("Timed out waiting for global task events")))},Gd),s.onmessage=g=>{try{const k=Kd.parse(JSON.parse(g.data));if(k.type==="connected"){i||(i=!0,a!==void 0&&(clearTimeout(a),a=void 0),l()),n==null||n(!0),r==null||r("connected");return}if(k.type==="heartbeat")return;e(k)}catch(k){console.error("Failed to parse global task event:",g.data,k)}},s.onerror=()=>{n==null||n(!1),r==null||r(i?"reconnecting":"offline"),!i&&!o&&(p(),u(new Error("Failed to open global task events")))},await f,p},respondPermission:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${be}/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(dt(`${be}/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(`${be}/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(`${be}/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(`${be}/suggestions/git-info`,{headers:f_(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()}},Vd=e=>{let t;const n=new Set,r=(u,f)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const g=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(k=>k(t,g))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,s,a);return a},m_=e=>e?Vd(e):Vd,p_=e=>e;function g_(e,t=p_){const n=Xs.useSyncExternalStore(e.subscribe,Xs.useCallback(()=>t(e.getState()),[e,t]),Xs.useCallback(()=>t(e.getInitialState()),[e,t]));return Xs.useDebugValue(n),n}const Wd=e=>{const t=m_(e),n=r=>g_(t,r);return Object.assign(n,t),n},Ta=e=>e?Wd(e):Wd;function Ot(){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 ho(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 Tc(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),ho(e,n,t.id);const s=n[r],o={...s,...t,id:s.id};return n[r]=o,ho(e,n,o.id)}function Bu(e,t){return`${t}-${e.length}`}function Ec(e,t){if(!t)return e;const n=[...Ea(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:Bu(n,"text"),type:"text",content:t}),{...e,timeline:n}}function Rk(e,t){if(!t)return e;const n=[...Ea(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:Bu(n,"thinking"),type:"thinking",content:t}),{...e,timeline:n}}function Ac(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=[...Ea(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:Bu(s,"tool_group"),type:"tool_group",toolCallIds:[t.toolCallId]}),{...e,timeline:s,toolCalls:r}}function Ea(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 h_(e){return Ea(e).filter(t=>t.type==="text").map(t=>t.content).filter(Boolean).join(`
10
-
11
- `)}const b_=(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||Ot();return s==="before"?{...i,agentContent:{...Ec(a,r),textBefore:a.textBefore+r}}:{...i,agentContent:{...Ec(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||Ot();return{...o,agentContent:Ac(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||Ot();return{...o,agentContent:{...Rk(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||Ot();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||Ot();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||Ot();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||Ot();return{...o,agentContent:r?Tc(i,r):ho(i,[])}})})),updateSubagent:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent||Ot(),l=[...zn(a)],u=l.findIndex(g=>g.id===r||g.sessionId===r);if(u===-1)return i;const f=l[u],p=typeof s=="function"?s(f):s;return l[u]={...f,...p,id:f.id},{...i,agentContent:ho(a,l,l[u].id)}})})),setTasks:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||Ot();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}})}),Va=60,x_=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function k_(e){let t=e;for(const l of x_)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<=Va)return s;const o=s.slice(0,Va),i=o.lastIndexOf(" ");return`${(i>Va*.6?o.slice(0,i):o).trimEnd()}…`}const yi="/.blade/worktrees/",y_=/-[a-f0-9]{8,}$/i,S_=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function w_(e){const t=e.indexOf(yi);if(t<0)return null;const n=e.slice(t+yi.length).split("/")[0];return n?`${e.slice(0,t+yi.length)}${n}`:null}function v_(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(S_);return r!=null&&r[1]?(t[t.length-1]=r[1],t.join("/")):null}function Pc(e){const t=e.split("/").filter(Boolean).at(-1)||e;return e.includes(yi)?t.replace(y_,""):t}function si(e,t=null){const n=e.taskSourceProjectPath,r=v_(n||e.projectPath);if(r)return r;if(n)return n;const s=w_(e.projectPath);if(!s)return e.projectPath;const o=Pc(s);return t&&o===Pc(t)?t:s}function I_(e,t,n=null){return t?e.filter(r=>si(r,n)===t):e}let Wa=0;const Vt=Ta((e,t)=>({currentModelId:null,currentMode:fr.AUTO_EDIT,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=++Wa;e({isLoading:!0,hasLoaded:!1,loadedWorkspacePath:r,error:null});try{const o=await cr("/models",n?{headers:{"x-blade-directory":n}}:void 0);if(s!==Wa||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!==Wa||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 cr("/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})})),Ja="__temp__",eo={inputTokens:0,outputTokens:0,totalTokens:0,maxContextTokens:0,isDefaultMaxTokens:!0,totalInputTokens:0,totalOutputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0};function xe(e){return{sessionId:e.sessionId,projectPath:e.projectPath}}function Ke(e){return JSON.stringify([e.projectPath,e.sessionId])}function ce(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function qu(e,t){return e.find(n=>ce(xe(n),t))}function An(e,t){const n=xe(t),r=e.findIndex(o=>ce(xe(o),n));if(r===-1)return[...e,t];const s=[...e];return s[r]=t,s}function Jd(e,t){return e.filter(n=>!ce(xe(n),t))}const Mk="blade.tasks.unread",_i="blade:open-session";function Ok(e){return e==="completed"||e==="failed"||e==="interrupted"}function j_(e,t,n){return!Ok(t)||n?!1:e!==t&&!(e==="completed"||e==="failed"||e==="interrupted"||e==="cancelled")}function C_(e=typeof localStorage>"u"?null:localStorage){if(!e)return[];try{const t=JSON.parse(e.getItem(Mk)??"[]");return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"))]:[]}catch{return[]}}function ao(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(Mk,JSON.stringify([...new Set(e)]))}catch{}}function Qd(e,t){const n=new Set(t.map(r=>Ke({sessionId:r.sessionId,projectPath:r.projectPath})));return e.filter(r=>n.has(r))}function Yd(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-${Ke(e.ref)}`});return t.onclick=()=>e.onOpen(e.ref),!0}function T_(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 E_=2166136261,A_=16777619;function Nc(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>Nc(t)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${JSON.stringify(n)}:${Nc(r)}`).join(",")}}`:JSON.stringify(e)}function Fk(e){let t=E_>>>0;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,A_);return(t>>>0).toString(16)}function _k(e){return typeof e=="string"?e:Nc(e??{})}function Hu(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function $c({explicitId:e,messageId:t,toolName:n,argumentsValue:r,toolKind:s,output:o}){if(e)return e;const i=[t||"unknown-message",n||"Unknown",_k(r),s||"",o||""].join("|");return`tool-${Fk(i)}`}function Aa({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-${Fk(i)}`}const P_=(e,t)=>!t||typeof t!="object"?null:{id:Aa({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:Hu(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},N_=(e,t)=>!t||typeof t!="object"?[]:(Array.isArray(t.subtaskRefs)?t.subtaskRefs:t.subtaskRef&&typeof t.subtaskRef=="object"?[t.subtaskRef]:[]).map(r=>P_(e,r)).filter(r=>r!==null);function Ys(e){return typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join(`
12
- `)}function Si(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=Ot();i.thinkingContent&&(l=Rk(l,i.thinkingContent),l.thinkingContent=i.thinkingContent);const u=Ys(i.content);u&&(l=Ec(l,u),l.textBefore=u);const f=N_(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",k=_k((s=p.function)==null?void 0:s.arguments);if(g==="Task"){let y={};try{y=JSON.parse(k)}catch{}const j=typeof y.subagent_type=="string"?y.subagent_type:"subagent",x=typeof y.description=="string"?y.description:j;l=Tc(l,{id:Aa({explicitId:p.id,sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,messageId:i.id,agentType:j,description:x}),type:j,description:x,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:$c({explicitId:p.id,messageId:i.id,toolName:g,argumentsValue:(o=p.function)==null?void 0:o.arguments}),toolName:g,arguments:k,status:"running",startTime:Date.now()};l=Ac(l,b)}for(const p of f)l=Tc(l,p);n={id:i.id,role:"assistant",content:Ys(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,u=a.tool_call_id||(l==null?void 0:l.toolCallId),f=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,k=typeof(l==null?void 0:l.error)=="string"&&l.error.length>0,b=zn(n.agentContent),y=b.findIndex(x=>x.id===u);if(y>=0){const x=b[y],I=typeof(p==null?void 0:p.subagentStatus)=="string"?Hu(p.subagentStatus):k?"failed":"completed";b[y]={...x,sessionId:typeof(p==null?void 0:p.subagentSessionId)=="string"?p.subagentSessionId:x.sessionId,type:typeof(p==null?void 0:p.subagentType)=="string"?p.subagentType:x.type,status:I,resumedFrom:typeof(p==null?void 0:p.subagentResumedFrom)=="string"?p.subagentResumedFrom:x.resumedFrom,rootAgentId:typeof(p==null?void 0:p.subagentRootId)=="string"?p.subagentRootId:x.rootAgentId,resumeDepth:typeof(p==null?void 0:p.subagentResumeDepth)=="number"?p.subagentResumeDepth:x.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:x.verificationVerdict},n.agentContent=ho(n.agentContent,b,x.id);continue}const j=n.agentContent.toolCalls.find(x=>x.toolCallId===u);j?(j.output=Ys(i.content),j.status=k?"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=f)):n.agentContent=Ac(n.agentContent,{toolCallId:$c({explicitId:u,messageId:n.id,toolName:f,output:Ys(i.content)}),toolName:f,output:Ys(i.content),status:k?"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 $_=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},mi=()=>({eventUnsubscribe:null,sessionEventConnectionState:"idle",isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),Xd=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)}),R_=(e,t)=>{let n=0,r=0,s=0;const o=()=>(n+=1,n),i=l=>l===n,a=l=>{try{l()}catch(u){console.warn("Failed to clean up stale event subscription",u)}};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(u=>({sessions:An(u.sessions,l)})),removeSession:l=>{const u=t();u.markTaskRead(l);const f=ce(u.currentSessionRef,l),p=ce(u.forkingSessionRef,l);(f||p)&&o(),f&&u.unsubscribeFromEvents(),e(g=>({sessions:Jd(g.sessions,l),currentSessionId:f?null:g.currentSessionId,currentSessionRef:f?null:g.currentSessionRef,messages:f?[]:g.messages,goal:f?null:g.goal,forkingSessionRef:p?null:g.forkingSessionRef,...f?mi():{}}))},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(),l&&t().selectProject(l),e({currentSessionId:Ja,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,tokenUsage:{...eo},error:null,errorContext:null,...mi()})},loadSessions:async()=>{const l=++r,u=new Set(t().sessions.map(p=>Ke(xe(p)))),f=new Set;e({catalogLoadState:"loading",catalogError:null});try{let p,g=!0;do{const y=await de.listSessionPage(p);if(l!==r)return;for(const j of y.sessions)f.add(Ke(xe(j)));if(e(j=>{const x=new Set(y.sessions.map(N=>Ke(xe(N))));return{sessions:g?[...y.sessions,...j.sessions.filter(N=>!x.has(Ke(xe(N))))]:y.sessions.reduce((N,F)=>An(N,F),j.sessions),catalogLoadState:y.nextCursor?"hydrating":"ready"}}),g=!1,p=y.nextCursor,p&&(await Xd(),l!==r))return}while(p);if(l!==r)return;const k=t().sessions.filter(y=>{const j=Ke(xe(y));return f.has(j)||!u.has(j)}),b=Qd(t().unreadTaskKeys,k);ao(b),e({sessions:k,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 u;const f=[];do{const p=await de.listSessionPage(u,50,!0);if(l!==s)return;for(const g of p.sessions){const k=f.findIndex(b=>ce(xe(b),xe(g)));k===-1?f.push(g):f[k]=g}u=p.nextCursor,u&&(e({archivedCatalogLoadState:"hydrating"}),await Xd())}while(u);if(l!==s)return;e({archivedSessions:f,archivedCatalogLoadState:"ready",archivedCatalogError:null})}catch(u){if(l!==s)return;e({archivedCatalogLoadState:"error",archivedCatalogError:u.message})}},selectSession:async l=>{var f;const u=o();e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});try{const p=qu(t().sessions,l),[g,k,b]=await Promise.all([de.getMessages(l),de.getGoal(l).catch(()=>null),p?Promise.resolve(p):de.getSession(l)]);if(!i(u))return;const y=Si(g),j=[];let x=!1;const I=await t().prepareEventSubscription(l,F=>{x?t().handleEvent(F):j.push(F)});if(!i(u)){a(I);return}const N=si(b,t().selectedProjectPath??((f=t().taskWorkspaceInfo)==null?void 0:f.cwd)??null);t().boundProjects.some(F=>F.available&&F.path===N)&&t().selectProject(N),e(F=>{var M;return{currentSessionId:l.sessionId,currentSessionRef:l,isTemporarySession:!1,messages:y,goal:k,isLoading:!1,tokenUsage:{...eo},isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,error:b.taskStatus==="failed"?((M=b.taskFailure)==null?void 0:M.message)??null:null,errorContext:b.taskStatus==="failed"&&b.taskFailure?{kind:"execution",sessionRef:l,failureCode:b.taskFailure.code}:null,sessions:An(F.sessions,b)}}),t().markTaskRead(l),x=!0,t().replaceEventSubscription(I);for(const F of j)t().handleEvent(F)}catch(p){if(!i(u))return;e({error:p.message,errorContext:{kind:"navigation",sessionRef:l},isLoading:!1})}},archiveSession:async l=>{var u;try{const f=await de.archiveSession(l),p=new Set(f.archivedSessionIds),g=t(),k=((u=g.currentSessionRef)==null?void 0:u.projectPath)===l.projectPath&&p.has(g.currentSessionRef.sessionId);k&&(o(),g.unsubscribeFromEvents()),e(b=>{const y=b.sessions.filter(x=>x.projectPath!==l.projectPath||!p.has(x.sessionId)),j=Qd(b.unreadTaskKeys,y);return ao(j),{sessions:y,archivedSessions:An(b.archivedSessions,f.session),unreadTaskKeys:j,currentSessionId:k?null:b.currentSessionId,currentSessionRef:k?null:b.currentSessionRef,messages:k?[]:b.messages,goal:k?null:b.goal,...k?mi():{}}}),await t().loadArchivedSessions()}catch(f){e({error:f.message,errorContext:{kind:"task_action",sessionRef:l}})}},unarchiveSession:async l=>{try{const u=await de.unarchiveSession(l),f=new Set(u.restoredSessionIds);e(p=>({archivedSessions:p.archivedSessions.filter(g=>g.projectPath!==l.projectPath||!f.has(g.sessionId)),sessions:An(p.sessions,u.session)})),await Promise.all([t().loadSessions(),t().loadArchivedSessions()])}catch(u){e({error:u.message,errorContext:{kind:"task_action",sessionRef:l}})}},deleteSession:async l=>{const u=t(),f=ce(u.currentSessionRef,l),p=ce(u.forkingSessionRef,l),g=f||p?o():null,k=f?g:null;p&&e({forkingSessionRef:null});try{await de.deleteSession(l),t().markTaskRead(l);const b=t(),y=ce(b.currentSessionRef,l)&&(k===null||i(k));y&&(o(),b.unsubscribeFromEvents()),e(j=>({sessions:Jd(j.sessions,l),currentSessionId:y?null:j.currentSessionId,currentSessionRef:y?null:j.currentSessionRef,messages:y?[]:j.messages,goal:y?null:j.goal,...y?mi():{}}))}catch(b){if(k!==null&&(!i(k)||!ce(t().currentSessionRef,l)))return;e({error:b.message})}},updateSession:async(l,u)=>{try{await de.updateSession(l,u),e(f=>({sessions:f.sessions.map(p=>p.sessionId===l.sessionId&&p.projectPath===l.projectPath?{...p,title:u}:p)}))}catch(f){e({error:f.message})}},forkSession:async l=>{const u=o(),f=xe(l);e({forkingSessionRef:f,isLoading:!1,error:null});let p=null;try{const g=await de.forkSession(l),k=xe(g.session),b=Si(g.messages);if(e(y=>({sessions:An(y.sessions,g.session)})),!i(u))return;if(p=await t().prepareEventSubscription(k),!i(u)){a(p),p=null;return}e({currentSessionId:k.sessionId,currentSessionRef:k,isTemporarySession:!1,messages:b,goal:null,tokenUsage:{...eo},error:null,forkingSessionRef:null}),t().replaceEventSubscription(p),p=null}catch(g){if(p&&a(p),!i(u))return;e({error:g.message,forkingSessionRef:null})}},rewindSession:async(l,u)=>{const{currentSessionRef:f,isTemporarySession:p,isStreaming:g}=t();if(!f||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 k=n;try{const b=await de.rewindSession(f,l,u);if(!i(k)||!ce(t().currentSessionRef,f))return!1;const y=Si(b.messages);return e(j=>({messages:y,tokenUsage:{...eo},error:null,currentRunId:null,agentPhase:"idle",pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,sessions:j.sessions.map(x=>x.sessionId===f.sessionId&&x.projectPath===f.projectPath?{...x,messageCount:y.length}:x)})),!0}catch(b){return!i(k)||!ce(t().currentSessionRef,f)||e({error:b.message}),!1}},sendMessage:async l=>{var $,A,_,Z;const{currentSessionId:u,currentSessionRef:f,isTemporarySession:p,isStreaming:g,addSession:k,addMessage:b}=t(),y=n,j=f,x={isStreaming:g,agentPhase:t().agentPhase,currentRunId:t().currentRunId};let I=f,N=u,F=j,M=null,R=null;const P=()=>i(y)&&ce(t().currentSessionRef,F);if(p||!N||N===Ja)try{const E=k_(l.content),q=await de.createSession(t().selectedProjectPath??(($=t().taskWorkspaceInfo)==null?void 0:$.cwd)??void 0,E||void 0);if(k(q),!P())return!1;I=xe(q),N=q.sessionId,e({currentSessionId:q.sessionId,currentSessionRef:I,isTemporarySession:!1}),F=I}catch(E){return P()&&e({error:E.message}),!1}if(!I||!N||N===Ja)return P()&&e({error:"Failed to create session"}),!1;try{if(!g){if(M=await t().prepareEventSubscription(I),!P())return a(M),M=null,!1;t().replaceEventSubscription(M),M=null}if(!P())return!1;const E=l.content.trim();if(E.startsWith("!")){if((((A=l.attachments)==null?void 0:A.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const fe=E.slice(1).trim();if(!fe)throw new Error("User shell command cannot be empty");g||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const We=await de.executeUserShellCommand(I,fe);return P()?(We.auxiliary||e({isStreaming:!1,agentPhase:"idle"}),We.delivery&&e({pendingSteeringCount:We.queued??0,pendingInputDelivery:We.delivery==="current_turn"?"current_turn":"next_turn"}),!0):!1}if((((_=l.attachments)==null?void 0:_.length)??0)===0&&(E==="/goal"||E.startsWith("/goal "))){R=`goal-command-${Date.now()}`,b({id:R,role:"user",content:E,timestamp:Date.now()});const fe=E.slice(5).trim().split(/\s+/).filter(Boolean),We=(Z=fe[0])==null?void 0:Z.toLowerCase();if(!We||We==="status"){const O=await de.getGoal(I);return P()&&e({goal:O}),P()}if(We==="clear")return await de.clearGoal(I),P()&&e({goal:null}),P();let Q;if(We==="pause")Q=await de.updateGoal(I,{action:"pause"});else if(We==="resume")Q=await de.updateGoal(I,{action:"resume"});else if(We==="edit"){const O=fe.slice(1).join(" ").trim();if(!O)throw new Error("Usage: /goal edit <objective>");Q=await de.updateGoal(I,{action:"edit",objective:O})}else{const O=fe.lastIndexOf("--budget");let U;if(O>=0){const Be=fe[O+1];if(!Be||!/^[1-9]\d*$/.test(Be))throw new Error("--budget requires a positive integer");U=Number(Be),fe.splice(O,2)}const je=fe.join(" ").trim();if(!je)throw new Error("Usage: /goal <objective>");const{currentMode:pt}=Vt.getState();Q=await de.createGoal(I,je,U,pt)}return P()?(e({goal:Q.goal,...Q.runId?{currentRunId:Q.runId,isStreaming:!0,agentPhase:"running"}:{}}),!0):!1}R=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,b({id:R,role:"user",content:$_(l),timestamp:Date.now()}),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:g?t().recoveredSteeringCount:0});const{currentMode:q,currentModelId:K}=Vt.getState(),{modelId:me,...X}=l,pe=me??K??void 0,Pe=l.reasoningEffort,Ee=l.serviceTier,L=l.responseVerbosity,se=l.communicationStyle,Re=pe&&!g?{...X,modelId:pe}:X,ge=await de.sendMessage(I,Re,q);return P()?(e({currentRunId:ge.runId,pendingSteeringCount:ge.status==="steering_queued"||ge.status==="follow_up_queued"?Math.max(0,ge.queued??1):t().pendingSteeringCount,pendingInputDelivery:ge.status==="steering_queued"?"current_turn":ge.status==="follow_up_queued"?"next_turn":t().pendingInputDelivery,sessions:(pe||Pe||Ee||L||se)&&!g?t().sessions.map(fe=>fe.sessionId===I.sessionId&&fe.projectPath===I.projectPath?{...fe,...pe?{selectedModelId:pe}:{},...Pe?{reasoningEffort:Pe}:{},...Ee?{serviceTier:Ee}:{},...L?{responseVerbosity:L}:{},...se?{communicationStyle:se}:{}}:fe):t().sessions}),!0):!1}catch(E){return M&&a(M),P()?R&&!t().messages.some(q=>q.id===R)?!0:(e(q=>({error:E.message,errorContext:{kind:"submission",sessionRef:I},messages:R?q.messages.filter(K=>K.id!==R):q.messages,...x})),!1):!1}},abortSession:async()=>{const{currentSessionRef:l,isStopping:u}=t();if(!l||u)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await de.abortSession(l),ce(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(f){return ce(t().currentSessionRef,l)&&e({isStopping:!1,error:f instanceof Error?f.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:l}}),!1}},pauseGoal:async()=>{const{currentSessionRef:l,isTemporarySession:u}=t();if(!l||u){e({error:"No persisted session is available for this goal"});return}try{const f=await de.updateGoal(l,{action:"pause"});if(!ce(t().currentSessionRef,l))return;e({goal:f.goal,error:null})}catch(f){if(!ce(t().currentSessionRef,l))return;e({error:f.message})}},resumeGoal:async()=>{const{currentSessionRef:l,isTemporarySession:u}=t();if(!l||u){e({error:"No persisted session is available for this goal"});return}try{const f=await de.updateGoal(l,{action:"resume"});if(!ce(t().currentSessionRef,l))return;e({goal:f.goal,error:null,...f.runId?{currentRunId:f.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(f){if(!ce(t().currentSessionRef,l))return;e({error:f.message})}},editGoal:async l=>{const{currentSessionRef:u,isTemporarySession:f}=t();if(!u||f){e({error:"No persisted session is available for this goal"});return}try{const p=await de.updateGoal(u,{action:"edit",objective:l});if(!ce(t().currentSessionRef,u))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!ce(t().currentSessionRef,u))return;e({error:p.message})}},clearGoal:async()=>{const{currentSessionRef:l,isTemporarySession:u}=t();if(!l||u){e({error:"No persisted session is available for this goal"});return}try{if(await de.clearGoal(l),!ce(t().currentSessionRef,l))return;e({goal:null,error:null})}catch(f){if(!ce(t().currentSessionRef,l))return;e({error:f.message})}}}},Dk={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"},M_={authentication:!1,permission:!1,rate_limit:!0,timeout:!0,network:!0,model_unavailable:!0,context_limit:!1,unsupported_input:!1,runtime:!0};function Lk(e){if(typeof e=="string"&&Object.keys(Dk).includes(e))return e}function Ku(e){return Dk[e]}function O_(e){return M_[e]}const F_={flushTimeout:80};class __{constructor(t){Ua(this,"config");Ua(this,"channels",new Map);this.config={...F_,...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 xn=new __,gt=(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}}},nn=(e,t,n)=>{const{currentAssistantMessageId:r,messages:s,addMessage:o,startAgentResponse:i}=e();if(r&&!r.startsWith("call_")&&s.some(f=>f.id===r&&f.role==="assistant"))return r;if(n){const f=s.find(p=>p.id===n&&p.role==="assistant");if(f)return i(f.id),f.id}const a=s[s.length-1];if((a==null?void 0:a.role)==="assistant")return a.id;const l=n||`assistant-${Date.now()}`,u={id:l,role:"assistant",content:"",timestamp:Date.now(),agentContent:Ot()};return o(u),i(l),t(f=>({messages:f.messages.map(p=>p.id===l?{...p,agentContent:{...p.agentContent||Ot()}}:p)})),l},D_=(e,t,n)=>{const{currentSessionId:r,addMessage:s,startAgentResponse:o,messages:i,updateMessage:a}=t();if(e.sessionId!==r)return;const l=e.messageId,u=e.role||"assistant",f=i.find(g=>g.id===l),p={id:l,role:u,content:e.content||"",timestamp:Date.now(),agentContent:u==="assistant"?Ot():void 0};f?a(l,{role:u,content:p.content,agentContent:u==="assistant"?{...f.agentContent||Ot()}:void 0}):s(p),u==="assistant"&&o(l)},L_=(e,t,n)=>{const{currentSessionId:r,appendDelta:s,currentAssistantMessageId:o,hasToolCalls:i,addMessage:a,startAgentResponse:l}=t();if(e.sessionId!==r)return;const u=e.messageId,f=e.delta;if(!o){const g={id:u,role:"assistant",content:"",timestamp:Date.now(),agentContent:Ot()};a(g),l(u),t().appendDelta(u,f,"before");return}s(o,f,i?"after":"before")},U_=(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:h_(i.agentContent)})},B_=(e,t,n)=>{const{currentSessionId:r,appendThinking:s}=t();if(e.sessionId!==r)return;const o=nn(t,n,e.messageId);o&&s(o,e.delta)},q_=()=>{},H_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s,setHasToolCalls:o,setSubagent:i}=t();if(e.sessionId!==r)return;const a=nn(t,n,e.messageId||e.toolCallId);if(!a)return;o(!0);const l=e.toolName||"Unknown",u=e.arguments;let f,p="",g,k;if(l==="Task")try{const y=JSON.parse(u);f=y.subagent_type,p=y.description||y.query||f||"",g=y.subagent_session_id,k=y.resume_from||y.resume}catch{}if(f){i(a,{id:Aa({explicitId:e.toolCallId,sessionId:g,messageId:a,agentType:f,description:p}),type:f,description:p,status:"running",startTime:Date.now(),sessionId:g,resumedFrom:k,output:"",thinking:""});return}const b={toolCallId:$c({explicitId:e.toolCallId,messageId:a,toolName:l,argumentsValue:u,toolKind:e.toolKind}),toolName:l,arguments:u,toolKind:e.toolKind,status:"running",startTime:Date.now()};s(a,b)},K_=(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(u=>u.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})},z_=(e,t,n)=>{var $;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(A=>{var _;return(_=A.agentContent)==null?void 0:_.toolCalls.some(Z=>Z.toolCallId===a)}),u=i.find(A=>zn(A.agentContent).some(_=>_.id===a)),f=e.messageId||(l==null?void 0:l.id)||(u==null?void 0:u.id)||(($=[...i].reverse().find(A=>A.role==="assistant"))==null?void 0:$.id);if(!f)return;const p=e.output,g=e.summary||(p&&p.trim()?p.trim().split(`
13
- `)[0].slice(0,120):e.success?"执行成功":"执行失败");s(f,a,{status:e.success?"success":"error",summary:g,output:p,metadata:e.metadata});const k=i.find(A=>A.id===f),b=zn(k==null?void 0:k.agentContent).find(A=>A.id===a),y=e.metadata,j=y&&typeof y.subagentSessionId=="string"?y.subagentSessionId:void 0,x=y&&typeof y.subagentStatus=="string"?y.subagentStatus:void 0,I=y&&typeof y.subagentType=="string"?y.subagentType:void 0,N=y&&typeof y.subagentSummary=="string"?y.subagentSummary:void 0,F=y&&typeof y.subagentResumedFrom=="string"?y.subagentResumedFrom:void 0,M=y&&typeof y.subagentRootId=="string"?y.subagentRootId:void 0,R=y&&typeof y.subagentResumeDepth=="number"?y.subagentResumeDepth:void 0,P=(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(f,b.id,{sessionId:b.sessionId||j,type:I||b.type,status:x?Hu(x):e.success?"completed":"failed",resumedFrom:F||b.resumedFrom,rootAgentId:M||b.rootAgentId,resumeDepth:R??b.resumeDepth,verificationVerdict:P??b.verificationVerdict}),j&&x&&n(A=>({messages:A.messages.map(_=>{if(_.id!==f)return _;const Z=_.metadata??{},E=Array.isArray(Z.subtaskRefs)?Z.subtaskRefs:[],q=E.findIndex(pe=>pe.childSessionId===j||pe.subagentId===a),K=q>=0?E[q]:Z.subtaskRef??{},me={...K,subagentId:a,childSessionId:j,agentType:I||(typeof(K==null?void 0:K.agentType)=="string"?K.agentType:"subagent"),status:x,summary:N||(typeof(K==null?void 0:K.summary)=="string"?K.summary:""),resumedFrom:F||(typeof(K==null?void 0:K.resumedFrom)=="string"?K.resumedFrom:void 0),rootAgentId:M||(typeof(K==null?void 0:K.rootAgentId)=="string"?K.rootAgentId:j),resumeDepth:R??(typeof(K==null?void 0:K.resumeDepth)=="number"?K.resumeDepth:0),verificationVerdict:P||(typeof(K==null?void 0:K.verificationVerdict)=="string"?K.verificationVerdict:void 0)},X=[...E];return q>=0?X[q]=me:X.push(me),{..._,metadata:{...Z,subtaskRef:me,subtaskRefs:X}}})}))},G_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=nn(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):[],u=`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:u,output:[i.length>0?`Added: ${i.join(", ")}`:"",a.length>0?`Removed: ${a.join(", ")}`:"",l.length>0?`Updated: ${l.join(", ")}`:""].filter(Boolean).join(`
14
- `)})},V_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=nn(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):[],u=`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:u,output:[i.length>0?`Added: ${i.join(", ")}`:"",a.length>0?`Removed: ${a.join(", ")}`:"",l.length>0?`Updated: ${l.join(", ")}`:""].filter(Boolean).join(`
15
- `)})},W_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=nn(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)}`})},J_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=nn(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
- `)})},Q_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=nn(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
- `)})},Y_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=String(e.serverName),i=String(e.action),a=nn(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
- `)})},X_=(e,t,n)=>{var k,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}`,u=nn(t,n,e.messageId||`mcp-task-${i}`);if(!u)return;const f=`MCP task ${a}: ${i} · ${String(e.serverName)}/${String(e.toolName)}`,p={status:a==="failed"||a==="cancelled"?"error":a==="completed"?"success":"running",summary:f,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=(k=t().messages.find(y=>y.id===u))==null?void 0:k.agentContent)==null?void 0:b.toolCalls.some(y=>y.toolCallId===l)){o(u,l,p);return}s(u,{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})},Z_=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Array.isArray(e.files)?e.files.filter(u=>!!u&&typeof u=="object"&&!Array.isArray(u)):[],i=nn(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(u=>String(u.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(u=>`${String(u.relativePath)} ${String(u.source)} SHA-256: ${String(u.contentSha256)}`).join(`
20
- `)})},zu=e=>`user-shell-${e}`,eD=(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=zu(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(u=>u.id===a)?i(a,l):s(l),e.auxiliary!==!0&&n({isStreaming:!0,agentPhase:"running",error:null,errorContext:null})},tD=(e,t)=>{var u;const{currentSessionId:n,messages:r,updateMessage:s}=t();if(e.sessionId!==n||typeof e.executionId!="string"||typeof e.chunk!="string")return;const o=zu(e.executionId),i=r.find(f=>f.id===o);if(!i)return;const a=(u=i.metadata)!=null&&u.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}}})},nD=(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:"",u=typeof a.stdout=="string"?a.stdout:"",f=typeof a.stderr=="string"?a.stderr:"",p=[u,f?`stderr:
22
- ${f}`:""].filter(Boolean).join(`
23
- `),g=zu(e.executionId),k={role:"user",content:[`! ${l}`,p||"(no output)"].join(`
24
- `),metadata:{userShellCommand:a}};s.some(b=>b.id===g)?i(g,k):o({id:g,...k,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"})},rD=(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))},sD=(e,t)=>{const{currentSessionId:n,setTasks:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o=e.tasks||[];r(s,o)},oD=(e,t)=>{const{currentSessionId:n,setSubagent:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o={id:Aa({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)},iD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.subagentSessionId,a=gt(s,i,r);a&&o(a.messageId,a.subagent.id,{sessionId:a.subagent.sessionId||i,currentTool:e.toolName})},aD=(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=gt(s,a,r);l&&o(l.messageId,l.subagent.id,u=>({sessionId:u.sessionId||a,output:(u.output||"")+i}))},cD=(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=gt(s,a,r);l&&o(l.messageId,l.subagent.id,u=>({sessionId:u.sessionId||a,thinking:(u.thinking||"")+i}))},lD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.subagentSessionId,a=gt(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})},uD=(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,u=gt(s,l,r);if(!u)return;const f={toolCallId:i,toolName:a,arguments:e.arguments,toolKind:e.toolKind,status:"running",startTime:Date.now()};o(u.messageId,u.subagent.id,p=>{const g=p.toolCalls||[];return{sessionId:p.sessionId||l,currentTool:a,toolCalls:g.some(k=>k.toolCallId===i)?g:[...g,f]}})},dD=(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,u=gt(s,l,r);if(!u)return;const f=e.output,p=e.success===!0,g=p?"success":"error",k=e.summary||(f&&f.trim()?f.trim().split(`
25
- `)[0].slice(0,120):p?"执行成功":"执行失败");o(u.messageId,u.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:k,output:f,metadata:e.metadata}:y)}))},fD=(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=gt(s,e.subagentSessionId,r);a&&o(a.messageId,a.subagent.id,l=>({toolCalls:(l.toolCalls||[]).map(u=>u.toolCallId===i?{...u,summary:e.message,progress:typeof e.progress=="number"?e.progress:void 0,progressTotal:typeof e.total=="number"?e.total:void 0,progressMessage:e.message}:u)}))},mD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(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):[],u=Array.isArray(e.updated)?e.updated.map(String):[],f=`mcp-catalog:${String(e.revision)}`;o(i.messageId,i.subagent.id,p=>({toolCalls:[...(p.toolCalls||[]).filter(g=>g.toolCallId!==f),{toolCallId:f,toolName:"MCP Catalog",arguments:JSON.stringify({serverName:e.serverName,added:a,removed:l,updated:u}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP catalog r${String(e.revision)}: +${a.length} -${l.length} ~${u.length}`,output:[a.length>0?`Added: ${a.join(", ")}`:"",l.length>0?`Removed: ${l.join(", ")}`:"",u.length>0?`Updated: ${u.join(", ")}`:""].filter(Boolean).join(`
26
- `)}]}))},pD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(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):[],u=Array.isArray(e.updated)?e.updated.map(String):[],f=`mcp-content:${String(e.revision)}`;o(i.messageId,i.subagent.id,p=>({toolCalls:[...(p.toolCalls||[]).filter(g=>g.toolCallId!==f),{toolCallId:f,toolName:"MCP Content",arguments:JSON.stringify({serverName:e.serverName,contentKind:e.contentKind,added:a,removed:l,updated:u}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP ${String(e.contentKind)} r${String(e.revision)}: +${a.length} -${l.length} ~${u.length}`}]}))},gD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(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(u=>u.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)}`}]}))},hD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.phase),l=`mcp-connection:${String(e.revision)}`;o(i.messageId,i.subagent.id,u=>({toolCalls:[...(u.toolCalls||[]).filter(f=>f.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}]}))},bD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.level),l=typeof e.logger=="string"?e.logger:void 0,u=`mcp-log:${String(e.revision)}`;o(i.messageId,i.subagent.id,f=>({toolCalls:[...(f.toolCalls||[]).filter(p=>p.toolCallId!==u),{toolCallId:u,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
- `)}]}))},xD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.serverName),l=String(e.action),u=`mcp-instructions:${String(e.revision)}:${a}:${l}`;o(i.messageId,i.subagent.id,f=>({toolCalls:[...(f.toolCalls||[]).filter(p=>p.toolCallId!==u),{toolCallId:u,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
- `)}]}))},kD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.taskId),l=String(e.status),u=`mcp-task:${a}`;o(i.messageId,i.subagent.id,f=>({toolCalls:[...(f.toolCalls||[]).filter(p=>p.toolCallId!==u),{toolCallId:u,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
- `)}]}))},yD=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=gt(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.files)?e.files.filter(u=>!!u&&typeof u=="object"&&!Array.isArray(u)):[],l=`project-rules:${a.map(u=>String(u.id)).join(",")}`;o(i.messageId,i.subagent.id,u=>({toolCalls:[...(u.toolCalls||[]).filter(f=>f.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(f=>`${String(f.relativePath)} ${String(f.source)} SHA-256: ${String(f.contentSha256)}`).join(`
30
- `)}]}))},SD=(e,t,n)=>{const{currentSessionId:r,setConfirmation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||"",i=nn(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(u=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:u.sessions.map(f=>f.sessionId===e.sessionId&&f.projectPath===e.projectPath?{...f,pendingInteraction:{type:"permission",requestId:o}}:f)}))},wD=(e,t,n)=>{var k,b;const{currentSessionId:r,currentSessionRef:s,messages:o,setConfirmation:i,setElicitation:a}=t();if(e.sessionId!==r)return;const l=e.requestId,u=o.find(y=>{var j,x;return((x=(j=y.agentContent)==null?void 0:j.confirmation)==null?void 0:x.toolCallId)===l}),f=(k=u==null?void 0:u.agentContent)==null?void 0:k.confirmation;u&&(f==null?void 0:f.status)==="pending"&&i(u.id,{...f,status:"denied"});const p=o.find(y=>{var j,x;return((x=(j=y.agentContent)==null?void 0:j.elicitation)==null?void 0:x.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}:{}}})},vD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running"})},ID=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},jD=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},CD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},TD=(e,t,n)=>{const{currentSessionId:r,setQuestion:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=nn(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)})))},ED=(e,t,n)=>{const{currentSessionId:r,setElicitation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=nn(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(u=>u.sessionId===e.sessionId&&u.projectPath===e.projectPath?{...u,pendingInteraction:{type:"elicitation",requestId:o}}:u)})))},AD=(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})}))},PD=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},ND=(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=Lk(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()},$D=(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})},RD=(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 f;const u=(f=l.agentContent)==null?void 0:f.elicitation;return(u==null?void 0:u.status)!=="pending"||!l.agentContent?l:{...l,agentContent:{...l.agentContent,elicitation:{...u,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()}},MD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},OD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},FD=(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})},_D=(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})},DD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},LD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},UD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},BD=(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:Si(s),isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1})},pi={"message.created":D_,"message.delta":L_,"message.complete":U_,"thinking.delta":B_,"thinking.completed":q_,"tool.start":H_,"tool.progress":K_,"tool.result":z_,"mcp.catalog.changed":G_,"mcp.content.changed":V_,"mcp.resource.updated":W_,"mcp.connection.changed":J_,"mcp.log":Q_,"mcp.instructions.changed":Y_,"mcp.task.changed":X_,"project.rules.loaded":Z_,"user.shell.started":eD,"user.shell.output":tD,"user.shell.completed":nD,"token.usage":rD,"task.updated":sD,"subagent.start":oD,"subagent.update":iD,"subagent.delta":aD,"subagent.thinking.delta":cD,"subagent.tool.start":uD,"subagent.tool.progress":fD,"subagent.tool.result":dD,"subagent.mcp.catalog.changed":mD,"subagent.mcp.content.changed":pD,"subagent.mcp.resource.updated":gD,"subagent.mcp.connection.changed":hD,"subagent.mcp.log":bD,"subagent.mcp.instructions.changed":xD,"subagent.mcp.task.changed":kD,"subagent.project.rules.loaded":yD,"subagent.complete":lD,"permission.asked":SD,"permission.timeout":wD,"turn.started":vD,"compaction.started":ID,"compaction.completed":jD,"model.fallback":CD,"question.required":TD,"elicitation.required":ED,"interaction.resolved":AD,"session.completed":PD,"session.error":ND,"session.status":$D,"run.cancelled":RD,"steering.queued":MD,"follow_up.queued":OD,"follow_up.started":_D,"steering.applied":FD,"goal.updated":DD,"goal.cleared":LD,"goal.continuation.started":UD,"session.rewound":BD},qD=new Set(["message.delta","thinking.delta","subagent.delta","subagent.thinking.delta"]),HD=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled"]),Zd=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(qD.has(n.type)||console.log("[SSE Event]",n.type,n.properties),HD.has(n.type)){xn.drainAll();const i=pi[n.type];i&&i(n.properties,e,t);return}if(n.type==="tool.start"&&xn.drainAll(),n.type==="message.delta"){const{currentSessionId:i,currentAssistantMessageId:a,hasToolCalls:l}=e();if(s.sessionId!==i)return;const u=s.messageId||a,f=s.delta;if(!a){const k=pi["message.delta"];k&&k(s,e,t);return}const p=l?"after":"before",g=`content:${u}:${p}`;xn.drainAllExcept(g),xn.append(g,f,k=>{const{appendDelta:b}=e();u&&b(u,k,p)});return}if(n.type==="thinking.delta"){const{currentSessionId:i,currentAssistantMessageId:a}=e();if(s.sessionId!==i)return;if(!a){const p=pi["thinking.delta"];p&&p(s,e,t);return}const l=s.delta,u=s.messageId||a,f=`thinking:${u}`;xn.drainAllExcept(f),xn.append(f,l,p=>{const{appendThinking:g}=e();u&&g(u,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||"",u=`subagent:${l}`,{currentAssistantMessageId:f,messages:p}=e(),g=gt(p,l||void 0,f);xn.append(u,a,k=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),x=g||gt(y,l||void 0,b);x&&j(x.messageId,x.subagent.id,I=>({sessionId:I.sessionId||l,output:(I.output||"")+k}))});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||"",u=`subagent-thinking:${l}`,{currentAssistantMessageId:f,messages:p}=e(),g=gt(p,l||void 0,f);xn.append(u,a,k=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),x=g||gt(y,l||void 0,b);x&&j(x.messageId,x.subagent.id,I=>({sessionId:I.sessionId||l,thinking:(I.thinking||"")+k}))});return}const o=pi[n.type];o&&o(n.properties,e,t)},KD=(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??Zd(t,e);let a=null,l="connecting";return a=await de.openEventSubscription(s,i,{onConnectionStateChange:u=>{l=u,a&&r===a&&e({sessionEventConnectionState:u})}}),n.set(a,l),a},replaceEventSubscription:s=>{const o=t().eventUnsubscribe;if(r=s,e({eventUnsubscribe:s,sessionEventConnectionState:s?n.get(s)??"connected":"idle"}),xn.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:()=>{xn.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{xn.reset()}},handleEvent:s=>{Zd(t,e)(s)}}},zD={"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.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.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.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","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.common.retry":"Retry","settings.common.dismiss":"Dismiss","settings.common.cancel":"Cancel","settings.common.enable":"Enable","settings.general.loading":"Loading 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.mcp.description":"MCP server configuration is available via the MCP panel.","settings.mcp.open":"Open MCP Panel","settings.skills.description":"Skills configuration is available via the Skills panel.","settings.skills.open":"Open Skills Panel","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"},GD={"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.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.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.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":"正在提交消息","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.common.retry":"重试","settings.common.dismiss":"忽略","settings.common.cancel":"取消","settings.common.enable":"启用","settings.general.loading":"正在加载设置…","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.mcp.description":"MCP 服务器配置可在 MCP 面板中管理。","settings.mcp.open":"打开 MCP 面板","settings.skills.description":"技能配置可在技能面板中管理。","settings.skills.open":"打开技能面板","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":"解释型"},VD=["en","zh"],Qa={en:zD,zh:GD},Uk="blade-ui-locale",Gu=typeof window<"u"&&typeof document<"u";function WD(){var e,t;if(Gu){try{const r=(e=window.localStorage)==null?void 0:e.getItem(Uk);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 vs=WD();const Rc=new Set;function JD(){for(const e of Rc)e()}function QD(e){var t;if(e!==vs){if(vs=e,Gu){try{(t=window.localStorage)==null||t.setItem(Uk,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}JD()}}function Bk(e){return Rc.add(e),()=>Rc.delete(e)}function YD(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s==null?n:String(s)}):e}function ys(e,t){const r=(Qa[vs]??Qa.en)[e]??Qa.en[e];return YD(r,t)}function Bt(){return S.useSyncExternalStore(Bk,()=>vs,()=>"en"),ys}function XD(){return{locale:S.useSyncExternalStore(Bk,()=>vs,()=>"en"),setLocale:QD}}Gu&&(document!=null&&document.documentElement)&&(document.documentElement.lang=vs==="zh"?"zh-CN":"en");const ZD=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",wi=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)},sn={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,communicationStyle:"auto"},bo=Ta((e,t)=>({...sn,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error("Failed to load settings");const r=await n.json(),s=r.uiTheme??sn.uiTheme;e({language:r.language??sn.language,theme:r.theme??sn.theme,uiTheme:s,autoSaveSessions:r.autoSaveSessions??sn.autoSaveSessions,notifyBuild:r.notifyBuild??sn.notifyBuild,notifyErrors:r.notifyErrors??sn.notifyErrors,notifySounds:r.notifySounds??sn.notifySounds,privacyTelemetry:r.privacyTelemetry??sn.privacyTelemetry,privacyCrash:r.privacyCrash??sn.privacyCrash,communicationStyle:r.communicationStyle??sn.communicationStyle,isLoading:!1}),wi(s)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&wi(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("Failed to save settings")}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&&wi(r.uiTheme)}}}));wi(sn.uiTheme);const C5=()=>bo(e=>ZD(e.uiTheme)),qk="blade.projects.selected";function ef(){return typeof localStorage>"u"?null:localStorage.getItem(qk)}function gi(e){typeof localStorage<"u"&&localStorage.setItem(qk,e)}const e2=new Set(["queued","running","completed","failed","cancelled","interrupted"]),tf=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),nf=new Set(["auto","standard","fast","flex"]),rf=new Set(["auto","low","medium","high"]),sf=new Set(["auto","pragmatic","friendly","explanatory"]);function t2(e){return typeof e=="string"&&e2.has(e)}function n2(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 of(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Lk(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:ys(Ku(n)),retryable:O_(n)}}function r2(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 ps(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}const s2=(e,t)=>{let n=null,r=!1,s=!1,o=0;const i=new Map,a=u=>{const f=Ke(u),p=++o;i.set(f,p),de.getSession(u).then(g=>{i.get(f)===p&&e(k=>({sessions:An(k.sessions,g)}))}).catch(()=>{i.get(f)===p&&t().loadSessions()}).finally(()=>{i.get(f)===p&&i.delete(f)})},l=u=>{const f=Ke(u),p=++o;i.set(f,p),queueMicrotask(()=>{i.get(f)===p&&i.delete(f)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:ef(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:C_(),handleTaskEvent:u=>{var R,P;if(u.type==="session.created"){const $=u.properties.sessionId,A=u.properties.projectPath;if(typeof $!="string"||typeof A!="string")return;a({sessionId:$,projectPath:A});return}if(u.type==="session.deleted"){const $=u.properties.sessionId,A=u.properties.projectPath;if(typeof $!="string"||typeof A!="string")return;const _={sessionId:$,projectPath:A};l(_),t().removeSession(_);return}if(u.type==="session.archived"){const $=u.properties.sessionId,A=u.properties.projectPath;if(typeof $!="string"||typeof A!="string")return;const _={sessionId:$,projectPath:A};l(_),t().removeSession(_),t().loadArchivedSessions();return}if(u.type==="session.unarchived"){const $=u.properties.sessionId,A=u.properties.projectPath;if(typeof $!="string"||typeof A!="string")return;a({sessionId:$,projectPath:A}),t().loadArchivedSessions();return}if(u.type==="session.updated"){const $=u.properties.sessionId,A=u.properties.projectPath,_=u.properties.title,Z=u.properties.selectedModelId,E=u.properties.reasoningEffort,q=u.properties.serviceTier,K=u.properties.responseVerbosity,me=u.properties.communicationStyle;if(typeof $!="string"||typeof A!="string"||!(typeof _=="string"&&_.trim()||typeof Z=="string"&&Z.trim()||tf.has(E)||nf.has(q)||rf.has(K)||sf.has(me)))return;const X={sessionId:$,projectPath:A};if(!t().sessions.some(Pe=>ce(xe(Pe),X))){a(X);return}e(Pe=>({sessions:Pe.sessions.map(Ee=>ce({sessionId:Ee.sessionId,projectPath:Ee.projectPath},X)?{...Ee,...typeof _=="string"&&_.trim()?{title:_}:{},...typeof Z=="string"&&Z.trim()?{selectedModelId:Z}:{},...tf.has(E)?{reasoningEffort:E}:{},...nf.has(q)?{serviceTier:q}:{},...rf.has(K)?{responseVerbosity:K}:{},...sf.has(me)?{communicationStyle:me}:{}}:Ee)}));return}if(u.type==="task.delivery"){const $=u.properties.sessionId,A=u.properties.projectPath,_=r2(u.properties.taskDelivery);if(typeof $!="string"||typeof A!="string"||!_)return;const Z={sessionId:$,projectPath:A},E=u.properties.taskWorktreeRemoved===!0;e(q=>({sessions:q.sessions.map(K=>ce(xe(K),Z)?{...K,taskDelivery:_,...E?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof u.properties.updatedAt=="string"?u.properties.updatedAt:K.lastMessageTime}:K)}));return}if(u.type==="interaction.pending"){const $=u.properties.sessionId,A=u.properties.projectPath,_=u.properties.interactionType,Z=u.properties.requestId;if(typeof $!="string"||typeof A!="string"||_!=="permission"&&_!=="question"&&_!=="elicitation"||typeof Z!="string"||!Z)return;const E={sessionId:$,projectPath:A},q=t().sessions.find(me=>ce(xe(me),E));if(!q){t().loadSessions();return}if(e(me=>({sessions:me.sessions.map(X=>ce(xe(X),E)?{...X,pendingInteraction:{type:_,requestId:Z}}:X)})),!(typeof document<"u"&&document.visibilityState==="visible"&&ce(t().currentSessionRef,E))&&bo.getState().notifyErrors){const X=q.title??q.sessionId??$;Yd({ref:E,title:`Blade · ${ys(_==="question"?"attention.notification.question":_==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:X,onOpen:pe=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(_i,{detail:pe})))}})}return}if(u.type==="interaction.resolved"){const $=u.properties.sessionId,A=u.properties.projectPath,_=u.properties.requestId;if(typeof $!="string"||typeof A!="string"||typeof _!="string")return;const Z={sessionId:$,projectPath:A};e(E=>({sessions:E.sessions.map(q=>{var K;return ce(xe(q),Z)&&((K=q.pendingInteraction)==null?void 0:K.requestId)===_?{...q,pendingInteraction:void 0}:q})}));return}if(u.type!=="task.status")return;const f=u.properties.sessionId,p=u.properties.projectPath,g=u.properties.taskStatus;if(typeof f!="string"||typeof p!="string"||!t2(g))return;const k={sessionId:f,projectPath:p},b=ps(u.properties.taskInFlight,0),y=ps(u.properties.taskQueueDepth,0),j=ps(u.properties.taskConcurrencyLimit,1);b!==void 0&&y!==void 0&&j!==void 0&&e($=>{var A;return{taskWorkspaceInfo:$.taskWorkspaceInfo?{...$.taskWorkspaceInfo,taskAdmission:{inFlight:b,queued:y,maxConcurrent:j,maxQueued:((A=$.taskWorkspaceInfo.taskAdmission)==null?void 0:A.maxQueued)??100}}:null}});const x=t().sessions.find($=>ce(xe($),k)),I=typeof document<"u"&&document.visibilityState==="visible"&&ce(t().currentSessionRef,k),N=j_(x==null?void 0:x.taskStatus,g,I),F=Ke(k),M=!t().unreadTaskKeys.includes(F);if(N&&M){e(_=>{const Z=[..._.unreadTaskKeys,F];return ao(Z),{unreadTaskKeys:Z}});const $=bo.getState();if($.notifySounds&&Ok(g)&&T_(g),g==="completed"?$.notifyBuild:$.notifyErrors){const _=ys(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),Z=((R=of(u.properties.taskFailure))==null?void 0:R.message)??(typeof u.properties.taskStatusReason=="string"?u.properties.taskStatusReason:((P=x==null?void 0:x.taskFailure)==null?void 0:P.message)??(x==null?void 0:x.taskStatusReason)),E=(x==null?void 0:x.title)??(x==null?void 0:x.sessionId)??f;Yd({ref:k,title:`Blade · ${_}`,body:Z?`${E} · ${Z}`:E,onOpen:q=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(_i,{detail:q})))}})}}if(!x){a(k);return}e($=>({sessions:$.sessions.map(A=>ce({sessionId:A.sessionId,projectPath:A.projectPath},k)?{...A,taskStatus:g,taskStatusReason:typeof u.properties.taskStatusReason=="string"?u.properties.taskStatusReason:void 0,taskFailure:g==="failed"?of(u.properties.taskFailure)??A.taskFailure:void 0,taskStartedAt:typeof u.properties.taskStartedAt=="string"?u.properties.taskStartedAt:g==="queued"?void 0:A.taskStartedAt,taskCompletedAt:typeof u.properties.taskCompletedAt=="string"?u.properties.taskCompletedAt:g==="queued"||g==="running"?void 0:A.taskCompletedAt,taskDiffStat:n2(u.properties.taskDiffStat)??A.taskDiffStat,taskQueuePosition:g==="queued"?ps(u.properties.taskQueuePosition,1)??A.taskQueuePosition:void 0,taskQueueDepth:g==="queued"?ps(u.properties.taskQueueDepth,0)??A.taskQueueDepth:void 0,taskConcurrencyLimit:ps(u.properties.taskConcurrencyLimit,1)??A.taskConcurrencyLimit,lastMessageTime:typeof u.properties.updatedAt=="string"?u.properties.updatedAt:A.lastMessageTime}:A)}))},subscribeToTaskEvents:async()=>{if(r=!0,!t().taskEventUnsubscribe){if(n)return n;e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),n=(async()=>{try{const u=await de.openTaskEventSubscription(f=>t().handleTaskEvent(f),{onConnectionChange:f=>{e({taskEventsConnected:f})},onConnectionStateChange:f=>{r&&(f==="reconnecting"||f==="offline")&&(s=!0),e({taskEventsConnected:f==="connected",taskEventConnectionState:f}),f==="connected"&&s&&(s=!1,Promise.all([t().loadSessions(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Vt.getState().loadModels()]))}});if(!r||t().taskEventUnsubscribe){u();return}e({taskEventUnsubscribe:u})}catch(u){throw s=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),u}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{s=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var u,f;r=!1,(f=(u=t()).taskEventUnsubscribe)==null||f.call(u),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const u=await de.getWorkspaceInfo();e({taskWorkspaceInfo:u,isTaskWorkspaceLoading:!1})}catch(u){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:u instanceof Error?u.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const u=await de.listProjects(),f=ef(),p=u.find(g=>g.available&&g.path===f)??u.find(g=>g.isCurrent)??u.find(g=>g.available);p&&gi(p.path),e({boundProjects:u,selectedProjectPath:(p==null?void 0:p.path)??null})}catch(u){e({error:u instanceof Error?u.message:"Failed to load projects"})}},bindProject:async u=>{e({isBindingProject:!0,error:null});try{const f=await de.bindProject(u);gi(f.path),e(p=>({boundProjects:[...p.boundProjects.filter(g=>g.path!==f.path),f].sort((g,k)=>g.isCurrent!==k.isCurrent?g.isCurrent?-1:1:g.name.localeCompare(k.name)),selectedProjectPath:f.path,isBindingProject:!1}))}catch(f){throw e({isBindingProject:!1,error:f instanceof Error?f.message:"Failed to bind project"}),f}},unbindProject:async u=>{try{await de.unbindProject(u),e(f=>{const p=f.boundProjects.filter(k=>k.path!==u||k.isCurrent),g=f.selectedProjectPath===u?p.find(k=>k.isCurrent)??p.find(k=>k.available):void 0;return g&&gi(g.path),{boundProjects:p,...g?{selectedProjectPath:g.path}:{}}})}catch(f){throw e({error:f instanceof Error?f.message:"Failed to unbind project"}),f}},selectProject:u=>{gi(u),e({selectedProjectPath:u})},markTaskRead:u=>{const f=Ke(u);e(p=>{const g=p.unreadTaskKeys.filter(k=>k!==f);return ao(g),{unreadTaskKeys:g}})},clearUnreadTasks:()=>{ao([]),e({unreadTaskKeys:[]})},cancelTask:async u=>{const f=Ke(u);if(!t().cancellingTaskKeys.includes(f)){e(p=>({cancellingTaskKeys:[...p.cancellingTaskKeys,f],error:null,errorContext:null}));try{await de.abortSession(u);const p=ce(t().currentSessionRef,u);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(k=>ce(xe(k),u)?{...k,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:k.taskCompletedAt??new Date().toISOString()}:k),...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:u}}),p}finally{e(p=>({cancellingTaskKeys:p.cancellingTaskKeys.filter(g=>g!==f)}))}}},retryTask:async u=>{const f=Ke(u);if(t().retryingTaskKeys.includes(f))return;const p=t().getNavigationVersion(),g=t().selectedProjectPath,k=()=>t().getNavigationVersion()===p&&t().selectedProjectPath===g;e(b=>({retryingTaskKeys:[...b.retryingTaskKeys,f],error:null,errorContext:null}));try{const b=await de.retryTask(u);e(y=>({sessions:An(y.sessions,b.session)})),t().markTaskRead(u),k()&&await t().selectSession(xe(b.session))}catch(b){throw k()&&e({error:b instanceof Error?b.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:u}}),b}finally{e(b=>({retryingTaskKeys:b.retryingTaskKeys.filter(y=>y!==f)}))}},deliverTask:async(u,f)=>{const p=Ke(u);if(!t().taskDeliveryActions[p]){e(g=>({taskDeliveryActions:{...g.taskDeliveryActions,[p]:f},error:null,errorContext:null}));try{const g=await de.deliverTask(u,f);e(k=>({sessions:An(k.sessions,g)})),t().markTaskRead(u)}catch(g){throw e({error:g instanceof Error?g.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:u}}),g}finally{e(g=>{const{[p]:k,...b}=g.taskDeliveryActions;return{taskDeliveryActions:b}})}}},dispatchTask:async u=>{const f=t().getNavigationVersion(),p=t().selectedProjectPath,g=u.projectPath??p??void 0,k=()=>t().getNavigationVersion()===f&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});try{const b=await de.createTask({...u,projectPath:g});e(y=>({sessions:An(y.sessions,b.session),isDispatchingTask:!1})),k()&&await t().selectSession(xe(b.session))}catch(b){throw e({isDispatchingTask:!1,...k()?{error:b instanceof Error?b.message:"Failed to dispatch task"}:{}}),b}}}},o2=e=>({tokenUsage:eo,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}}))}),B=Ta()((...e)=>({...R_(...e),...s2(...e),...b_(...e),...KD(...e),...o2(...e)}));function i2(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function a2({open:e,onOpenChange:t}){const n=B(M=>M.currentSessionRef),r=B(M=>M.isStreaming),s=B(M=>M.isTemporarySession),o=B(M=>M.rewindSession),[i,a]=S.useState([]),[l,u]=S.useState(null),[f,p]=S.useState(!1),[g,k]=S.useState(!1),[b,y]=S.useState(!1),[j,x]=S.useState(null);S.useEffect(()=>{if(!e||!n)return;let M=!1;return k(!0),x(null),a([]),u(null),p(!1),de.listRewindCheckpoints(n).then(R=>{var P;M||(a(R),u(((P=R[0])==null?void 0:P.messageId)??null))}).catch(R=>{M||x(R instanceof Error?R.message:"Failed to load rewind checkpoints")}).finally(()=>{M||k(!1)}),()=>{M=!0}},[n,e]);const I=S.useMemo(()=>i.find(M=>M.messageId===l)??null,[i,l]),N=!!I&&!g&&!b&&!r&&!s,F=async()=>{if(!I||!N)return;y(!0),x(null);const M=await o(I.messageId,f?"both":"conversation");y(!1),M?t(!1):x("Rewind failed. Review the session error and try again.")};return c.jsx(zc,{open:e,onOpenChange:t,children:c.jsxs(qi,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[c.jsx(Gc,{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(ad,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx(Hi,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:"Rewind session"}),c.jsx(Ki,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:"Return to the point before a user message."})]})]})}),c.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[g&&c.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[c.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-xs font-mono",children:"Loading checkpoints"})]}),!g&&j&&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:j}),!g&&!j&&i.length===0&&c.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[c.jsx(ad,{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:"Nothing to rewind to yet"})]}),!g&&i.length>0&&c.jsx("div",{role:"radiogroup","aria-label":"Rewind checkpoint",className:"max-h-[310px] space-y-1 overflow-y-auto",children:i.map(M=>{const R=M.messageId===l;return c.jsxs("button",{type:"button",role:"radio","aria-checked":R,onClick:()=>u(M.messageId),className:W("w-full rounded-md border px-4 py-3 text-left transition-colors",R?"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:M.preview||"User message"}),c.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:i2(M.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:M.messageId.slice(0,10)}),M.fileCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(qy,{className:"h-3 w-3"}),M.fileCount," ",M.fileCount===1?"file":"files"]})]})]},M.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:f,disabled:!I||I.fileCount===0,onChange:M=>p(M.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:"Restore code changes"}),c.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:"Revert files changed at and after this checkpoint."})]})]})}),c.jsxs(Ff,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[c.jsx(mr,{variant:"ghost",onClick:()=>t(!1),disabled:b,children:"Cancel"}),c.jsxs(mr,{onClick:()=>void F(),disabled:!N,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[b?c.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Bi,{className:"mr-2 h-4 w-4"}),"Rewind"]})]})]})})}function Hk({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=Bt(),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((u,f)=>{const p=f<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")},f)})}),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 af(){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 Kk=[{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 c2(e){const t=e.key.toLocaleLowerCase();return Kk.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 l2(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function u2(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 d2(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=u2();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function Mc(e,t){const n=Kk.find(r=>r.id===e);return n?d2(n).join(""):""}const zk="blade.sidebar.view",Gk="blade.preview.width",Ya=640,f2=360,m2=960,p2=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(zk);return e==="status"||e==="project"?e:"project"},Vk=e=>Math.min(m2,Math.max(f2,Math.round(e))),g2=()=>{if(typeof localStorage>"u")return Ya;const e=localStorage.getItem(Gk);if(!e)return Ya;const t=Number(e);return Number.isFinite(t)?Vk(t):Ya},pr=Ta(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:p2(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(zk,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:g2(),setPreviewWidth:t=>{const n=Vk(t);typeof localStorage<"u"&&localStorage.setItem(Gk,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}),isMcpOpen:!1,toggleMcp:()=>e(t=>({isMcpOpen:!t.isMcpOpen})),isSkillsOpen:!1,toggleSkills:()=>e(t=>({isSkillsOpen:!t.isSkillsOpen})),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 h2(){const e=pr(r=>r.setTaskSwitcherOpen),t=pr(r=>r.toggleSidebar),n=B(r=>r.startTemporarySession);S.useEffect(()=>{const r=s=>{if(s.repeat)return;const o=c2(s);if(!o)return;const i=pr.getState(),a=i.isTaskSwitcherOpen,l=l2(s.target),u=!!document.querySelector('[role="dialog"]');if(o.id==="searchTasks"||o.id==="openCommands"){if(u&&!a)return;s.preventDefault();const f=o.id==="searchTasks"?"tasks":"commands",p=a&&i.taskSwitcherMode===f;e(!p,f);return}if(!(l||u)){if(o.id==="newTask"){s.preventDefault(),n(),requestAnimationFrame(()=>af());return}if(o.id==="focusComposer"){af()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const Vu=S.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(hf,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(Fy,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(Wk,{}),c.jsx(_y,{})]}));Vu.displayName=hf.displayName;const Wk=S.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(bf,{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(Dy,{className:"relative flex-1 rounded-full bg-border"})}));Wk.displayName=bf.displayName;function co(e,t){var s;const n=(s=e.title)==null?void 0:s.trim();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 Jk(e,t=!1){const n=await de.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 ur=Uy,dr=By,Un=S.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(Ly,{children:c.jsx(xf,{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})}));Un.displayName=xf.displayName;function b2(){const e=Bt(),t=B(b=>b.archivedSessions),n=B(b=>b.archivedCatalogLoadState),r=B(b=>b.archivedCatalogError),s=B(b=>b.loadArchivedSessions),o=B(b=>b.unarchiveSession),i=B(b=>b.setError),[a,l]=S.useState(!1),[u,f]=S.useState(null),[p,g]=S.useState(null),k=b=>{l(b),b&&s()};return c.jsxs(ur,{open:a,onOpenChange:k,children:[c.jsx(dr,{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(kf,{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(Un,{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(no,{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(ct,{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(Vu,{className:"max-h-[340px]",children:c.jsx("div",{className:"divide-y divide-[hsl(var(--deck-hairline))]",children:t.map(b=>{var N;const y=xe(b),j=Ke(y),x=u===j,I=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:co(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:I}),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 Jk(y)}catch(F){i(F instanceof Error?F.message:"Session export failed")}finally{g(null)}},"aria-label":e("session.action.export",{title:co(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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(yf,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",disabled:x||b.archivedBySessionId!==b.sessionId,onClick:async()=>{f(j);try{await o(y)}finally{f(null)}},"aria-label":e("archive.restore",{title:co(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:x?c.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Hy,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function Wu({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 cf={en:"sidebar.language.en",zh:"sidebar.language.zh"};function Qk({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=XD(),s=Bt();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(cf[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:VD.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(cf[o])},o)})})}const x2="[data-mobile-navigation-trigger]";function T5(e){return Yk(x2,e)}function Yk(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function Xk({open:e,onOpenChange:t}){const n=Bt(),{boundProjects:r,selectedProjectPath:s,isBindingProject:o,loadBoundProjects:i,bindProject:a,unbindProject:l,selectProject:u,startTemporarySession:f}=B(),[p,g]=S.useState(""),[k,b]=S.useState(null),[y,j]=S.useState(!1),x=S.useRef(0);S.useEffect(()=>{if(e){i();return}x.current+=1,j(!1)},[i,e]);const I=async R=>{await a(R),g(""),f(),t(!1)},N=async R=>{if(R.preventDefault(),!(!p.trim()||o||y)){b(null);try{await I(p.trim())}catch(P){b(P instanceof Error?P.message:n("projects.bind.failed"))}}},F=async()=>{if(y||o)return;const R=++x.current;b(null),j(!0);try{const P=await de.pickProjectDirectory();if(R!==x.current||P.cancelled)return;g(P.path),await I(P.path)}catch(P){if(R!==x.current)return;b(P instanceof Error?P.message:n("projects.pick.failed"))}finally{R===x.current&&j(!1)}},M=R=>{u(R),f(),t(!1)};return e?c.jsx(zc,{open:e,onOpenChange:t,children:c.jsxs(qi,{onCloseAutoFocus:R=>Yk("[data-project-setup-trigger]",R),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[c.jsxs(Gc,{children:[c.jsxs(Hi,{className:"flex items-center gap-2 font-mono text-[16px]",children:[c.jsx(vi,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),n("projects.dialog.title")]}),c.jsx(Ki,{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:R=>g(R.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 F(),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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ky,{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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(vi,{className:"h-3.5 w-3.5"}),n("projects.bind.action")]})]}),k&&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:k}),c.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:r.map(R=>{const P=R.path===s;return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border px-3 py-2",P?"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(ro,{className:W("h-4 w-4 shrink-0",P?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsxs("button",{type:"button",disabled:!R.available,onClick:()=>M(R.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:R.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:[R.gitBranch&&c.jsxs(c.Fragment,{children:[c.jsx(Uc,{className:"h-2.5 w-2.5"}),c.jsx("span",{children:R.gitBranch}),c.jsx("span",{children:"·"})]}),c.jsx("span",{className:"truncate",children:R.path}),!R.available&&c.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",n("projects.unavailable")]})]})]}),!R.isCurrent&&c.jsx("button",{type:"button",onClick:()=>void l(R.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(Sf,{className:"h-3.5 w-3.5"})})]},R.path)})})]})}):null}const k2={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 y2({session:e,isActive:t,isForking:n,isUnread:r,anyForking:s,isEditing:o,editingTitle:i,title:a,context:l,isCancelling:u,isRetrying:f,isExporting:p,onSelect:g,onCancelTask:k,onRetryTask:b,onFork:y,onArchive:j,onExport:x,onStartRename:I,onDelete:N,onEditingTitleChange:F,onSaveRename:M,onCancelRename:R}){const P=Bt(),[$,A]=S.useState(!1),_=S.useRef(null),Z=S.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:E=>F(E.target.value),onKeyDown:E=>{E.key==="Enter"&&M(),E.key==="Escape"&&R()},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":P("session.action.save",{title:a}),onClick:M,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(wf,{className:"w-3 h-3"})}),c.jsx("button",{"aria-label":P("session.action.cancel",{title:a}),onClick:R,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(to,{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":P("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)]":k2[e.taskStatus]),title:e.pendingInteraction?P(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:P("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:P(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"),children:[c.jsx(lo,{className:"h-2.5 w-2.5"}),P(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:`${P("session.forkedFrom")} ${e.parentId.slice(0,6)}`,"aria-label":`${P("session.forkedFrom")} ${e.parentId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:[P("session.forkedFrom")," ",e.parentId.slice(0,6)]}),e.taskRetriedFrom&&c.jsx("span",{title:`${P("session.retriedFrom")} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:P("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(ct,{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":P(u?"session.action.stopping":"session.action.stop",{title:a}),disabled:u,onClick:E=>{E.stopPropagation(),k()},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:u?c.jsx(ct,{className:"h-3 w-3 animate-spin"}):c.jsx(Bc,{className:"h-3 w-3"})}),e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")&&c.jsx("button",{ref:_,type:"button","aria-label":P(f?"session.action.retrying":"session.action.retry",{title:a}),disabled:f,onClick:E=>{E.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:f?c.jsx(ct,{className:"h-3 w-3 animate-spin"}):c.jsx(Bi,{className:"h-3 w-3"})}),c.jsxs(ur,{open:$,onOpenChange:A,children:[c.jsx(dr,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":P("session.action.more",{title:a}),"aria-expanded":$,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(zy,{className:"h-3.5 w-3.5"})})}),c.jsxs(Un,{ref:Z,role:"menu","aria-label":P("session.action.more",{title:a}),side:"right",align:"start",sideOffset:6,className:"w-40 p-1",onOpenAutoFocus:E=>{var q,K;E.preventDefault(),(K=(q=Z.current)==null?void 0:q.querySelector('[role="menuitem"]:not([disabled])'))==null||K.focus()},onKeyDown:E=>{E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),A(!1),window.setTimeout(()=>{var q;return(q=_.current)==null?void 0:q.focus()},0))},children:[c.jsxs("button",{type:"button",role:"menuitem","aria-label":P("session.action.fork",{title:a}),disabled:s,onClick:E=>{E.stopPropagation(),y(),A(!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(Gy,{className:"h-3 w-3","aria-hidden":!0}),P("session.action.forkShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":P("session.action.rename",{title:a}),onClick:E=>{I(E),A(!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(Vy,{className:"h-3 w-3","aria-hidden":!0}),P("session.action.renameShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":P("session.action.archive",{title:a}),disabled:e.taskStatus==="running"||e.taskStatus==="queued",onClick:E=>{E.stopPropagation(),j(),A(!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(kf,{className:"h-3 w-3","aria-hidden":!0}),P("session.action.archiveShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":P("session.action.export",{title:a}),disabled:p,onClick:E=>{E.stopPropagation(),x(),A(!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(ct,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):c.jsx(yf,{className:"h-3 w-3","aria-hidden":!0}),P(p?"session.action.exportingShort":"session.action.exportShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":P("session.action.delete",{title:a}),onClick:E=>{N(E),A(!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(Sf,{className:"h-3 w-3","aria-hidden":!0}),P("session.action.deleteShort")]})]})]})]})]})}function S2({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const u=Bt(),f=[{icon:vf,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":u("sidebar.action.expand"),children:c.jsx(Wu,{size:28})}),c.jsx("button",{onClick:t,"aria-label":u("sidebar.action.newTaskShort"),title:u("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(qc,{className:"h-4 w-4 stroke-[2.5]"})}),c.jsx("button",{onClick:r,"aria-label":u("sidebar.action.terminalToggle"),title:u("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(If,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":u("sidebar.action.searchTasks"),title:`${u("sidebar.action.searchTasks")} (${Mc("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(Hc,{className:"h-4 w-4"}),a>0&&c.jsx("span",{"aria-label":u("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))]"}),f.map(({icon:p,action:g,labelKey:k})=>c.jsx("button",{"data-settings-trigger":!0,onClick:g,"aria-label":u(k),title:u(k),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"})},k)),c.jsx(Qk,{variant:"compact"}),c.jsx("div",{className:"mt-1",children:c.jsx("div",{role:"status","aria-label":u(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:u(i?"sidebar.status.feedLive":"sidebar.status.feedOffline")})})]})}const Zk="blade.sidebar.project-order.v1";function oi(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 w2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(Zk)??"[]");return Array.isArray(e)?oi(e):[]}catch{return[]}}function v2(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Zk,JSON.stringify(oi(e)))}catch{}}function I2(e,t){const n=new Map(oi(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 j2(e,t,n){const r=oi(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 C2(e,t,n){const r=oi(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 T2({name:e,path:t,count:n,countIsPartial:r=!1,isActive:s,hasRunning:o,unreadCount:i,collapsed:a,onToggle:l,onSelect:u,onCreateTask:f,reorderPosition:p,reorderCount:g,isDragging:k=!1,onDragStart:b,onDragEnd:y,onReorderKeyDown:j}){const x=Bt();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":x("sidebar.project.reorder",{name:e,position:p,count:g}),title:x("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",k&&"cursor-grabbing opacity-100 text-[hsl(var(--deck-accent))]"),children:c.jsx(Wy,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:l,"aria-expanded":!a,"aria-label":x(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(Jy,{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:u??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(ro,{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":x("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?"+":""]})]}),f&&c.jsx("button",{type:"button",onClick:f,title:x("sidebar.project.newTask",{name:e}),"aria-label":x("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(qc,{className:"h-3.5 w-3.5"})})]})}function Oc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function lf(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function Ju(e,t){return lf(e)-lf(t)||Oc(t)-Oc(e)}const E2=["running","queued","interrupted","failed","cancelled","completed"],A2={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},gs=e=>e.length>1?e.replace(/\/+$/,""):e;function ey(e){const t=new Map;for(const n of e){if(!n)continue;const r=Ke(xe(n));t.has(r)||t.set(r,n)}return Array.from(t.values())}function P2(e){const t=ey(e),n=[];for(const r of E2){const s=t.filter(o=>o.taskStatus===r).sort(Ju);s.length>0&&n.push({code:A2[r],status:r,sessions:s})}return n}function N2(e,t,n=[]){const r=ey(e),s=new Map,o=n.map(gs),i=new Map(o.map((u,f)=>[u,f]));for(const u of o)s.set(u,[]);for(const u of r){const f=si(u,t),p=s.get(f);p?p.push(u):s.set(f,[u])}const a=t?gs(t):null,l=Array.from(s.entries()).map(([u,f])=>{const p=[...f].sort(Ju),g=f.reduce((k,b)=>Math.max(k,Oc(b)),0);return{path:u,name:Pc(u),isActive:a?gs(u)===a:!1,isBound:i.has(gs(u)),hasRunning:f.some(k=>k.taskStatus==="running"),lastActivity:g,sessions:p}});return l.sort((u,f)=>u.isBound!==f.isBound?u.isBound?-1:1:u.isBound&&f.isBound?(i.get(gs(u.path))??Number.MAX_SAFE_INTEGER)-(i.get(gs(f.path))??Number.MAX_SAFE_INTEGER):f.lastActivity-u.lastActivity),l}const uf=12,$2={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},R2={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 M2({view:e,sessions:t,activeProjectPath:n,boundProjects:r,currentSessionRef:s,unreadTaskKeys:o,catalogLoadState:i,catalogError:a,onSelectProject:l,onCreateTask:u,onRetryCatalog:f,renderRow:p}){const g=Bt(),[k,b]=S.useState({}),[y,j]=S.useState({}),[x,I]=S.useState(w2),[N,F]=S.useState(null),[M,R]=S.useState(null),[P,$]=S.useState(""),A=i==="loading"||i==="hydrating",_=A||i==="error",Z=S.useMemo(()=>e==="status"?P2(t):[],[t,e]),E=S.useMemo(()=>e==="project"?N2(t,n,r.map(L=>L.path)):[],[n,r,t,e]),q=S.useMemo(()=>I2(E,x),[E,x]),K=(L,se)=>{const Re=y[L]??!1,ge=Re?se:se.filter((Q,O)=>{if(O<uf)return!0;const U=xe(Q);return!!Q.pendingInteraction||o.includes(Ke(U))||!!(s&&ce(U,s))}),fe=se.length-ge.length,We=Re?se.length>uf:fe>0;return c.jsxs(c.Fragment,{children:[ge.map(p),We&&c.jsx("button",{type:"button",onClick:()=>j(Q=>({...Q,[L]:!Re})),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:Re?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:fe})})]})},me=A?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(ct,{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(lo,{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:f,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(no,{className:"h-2.5 w-2.5"}),g("sidebar.catalog.retry")]})]}):null;if(e==="status")return c.jsxs("div",{className:"flex flex-col",children:[me,Z.map((L,se)=>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]",R2[L.code]??"text-[hsl(var(--deck-ink-faint))]",se===0&&"pt-2"),children:[c.jsx("span",{children:g($2[L.code])}),c.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:[L.sessions.length.toString().padStart(2,"0"),_?"+":""]})]}),K(`status:${L.code}`,L.sessions)]},L.code))]});const X=q.some(L=>L.isActive),pe=L=>!!(s&&L.sessions.some(se=>ce(xe(se),s))),Pe=(L,se)=>{if(L.join("\0")===q.map(ge=>ge.path).join("\0"))return;I(L),v2(L);const Re=q.find(ge=>ge.path===se);$(g("sidebar.project.reordered",{name:(Re==null?void 0:Re.name)??se,position:L.indexOf(se)+1}))},Ee=(L,se)=>{const Re=L.sessions.filter(O=>o.includes(Ke(xe(O)))).length,ge=pe(L),fe=Re>0,We=L.sessions.some(O=>!!O.pendingInteraction),Q=k[L.path]??(X&&!L.isActive&&!(ge||L.hasRunning||fe||We));return c.jsxs("div",{"data-project-group":L.path,onDragEnter:O=>{!N||N===L.path||(O.preventDefault(),R(L.path))},onDragOver:O=>{!N||N===L.path||(O.preventDefault(),O.dataTransfer.dropEffect="move")},onDrop:O=>{O.preventDefault();const U=N||O.dataTransfer.getData("text/plain");U&&U!==L.path&&Pe(j2(q.map(je=>je.path),U,L.path),U),F(null),R(null)},className:W("relative transition-colors",M===L.path&&N!==L.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(T2,{name:L.name,path:L.path,count:L.sessions.length,countIsPartial:_,isActive:L.isActive,hasRunning:L.hasRunning,unreadCount:Re,collapsed:Q,onSelect:()=>l(L.path),onCreateTask:()=>u(L.path),reorderPosition:se+1,reorderCount:q.length,isDragging:N===L.path,onDragStart:O=>{O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("text/plain",L.path),F(L.path)},onDragEnd:()=>{F(null),R(null)},onReorderKeyDown:O=>{if(O.key!=="ArrowUp"&&O.key!=="ArrowDown")return;O.preventDefault();const U=C2(q.map(je=>je.path),L.path,O.key==="ArrowUp"?-1:1);Pe(U,L.path)},onToggle:()=>b(O=>({...O,[L.path]:!Q}))}),!Q&&K(`project:${L.path}`,L.sessions)]},L.path)};return c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"sr-only","aria-live":"polite",children:P}),me,q.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")}),q.map(Ee)]})]})}function O2({className:e,onNavigate:t}){const n=Bt(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:u,setTaskSwitcherOpen:f}=pr(),p=B(T=>T.sessions),g=B(T=>T.catalogLoadState),k=B(T=>T.catalogError),b=B(T=>T.currentSessionRef),y=B(T=>T.forkingSessionRef),j=B(T=>T.selectSession),x=B(T=>T.startTemporarySession),I=B(T=>T.deleteSession),N=B(T=>T.archiveSession),F=B(T=>T.forkSession),M=B(T=>T.updateSession),R=B(T=>T.loadSessions),P=B(T=>T.setError),$=B(T=>T.taskEventsConnected),A=B(T=>T.taskWorkspaceInfo),_=B(T=>T.boundProjects),Z=B(T=>T.selectedProjectPath),E=B(T=>T.bindProject),q=B(T=>T.selectProject),K=B(T=>T.cancelTask),me=B(T=>T.cancellingTaskKeys),X=B(T=>T.retryTask),pe=B(T=>T.retryingTaskKeys),Pe=B(T=>T.unreadTaskKeys),[Ee,L]=S.useState(null),[se,Re]=S.useState(""),[ge,fe]=S.useState(null),[We,Q]=S.useState(!1),O=Z??(A==null?void 0:A.cwd)??null,U=T=>co(T,n),je=T=>{var Hs;const Se=T.taskSourceProjectPath||T.projectPath,wt=Se.split("/").filter(Boolean).at(-1)||Se,_n=T.taskIsolation==="worktree"?T.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),us=T.taskDiffStat?`+${T.taskDiffStat.additions} −${T.taskDiffStat.deletions}`:void 0,qs=T.taskStatus==="queued"&&T.taskQueuePosition?n("session.queued",{position:T.taskQueuePosition,depth:T.taskQueueDepth??T.taskQueuePosition}):void 0,$r=(Hs=T.taskStatusReason)==null?void 0:Hs.trim(),he=T.taskFailure?n(Ku(T.taskFailure.code)):$r==="user-cancel"?n("session.reason.cancelledByUser"):$r||void 0;return{project:wt,environment:_n,diff:us,queue:qs,reason:he}},pt=()=>{x(O??void 0),t==null||t()},Be=async T=>{_.some(Se=>Se.path===T)?q(T):await E(T),x(T),t==null||t()},bn=async T=>{_.some(Se=>Se.path===T)?q(T):await E(T),x(T),t==null||t()},Me=T=>{T(),t==null||t()},nr=async(T,Se)=>{T.stopPropagation(),await I(xe(Se))},rr=async T=>{const Se=xe(T),wt=Ke(Se);if(!ge){fe(wt);try{await Jk(Se)}catch(_n){P(_n instanceof Error?_n.message:"Session export failed")}finally{fe(null)}}},rn=(T,Se)=>{T.stopPropagation(),L(Ke(xe(Se))),Re(U(Se))},ls=async T=>{if(!se.trim()){L(null);return}try{await M(xe(T),se.trim()),L(null),await R()}catch(Se){console.error("Failed to rename session:",Se)}},H=()=>{L(null),Re("")};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(Wu,{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(Qy,{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:pt,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(qc,{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:Mc("newTask")})]}),c.jsxs("button",{onClick:()=>Me(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(If,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Me(()=>f(!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(Hc,{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:Pe.length>0?Pe.length:Mc("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(T=>c.jsx("button",{type:"button",onClick:()=>u(T),"aria-pressed":l===T,"aria-label":n(T==="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===T?"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(T==="project"?"sidebar.view.project":"sidebar.view.status")},T))}),c.jsx("button",{type:"button",onClick:()=>Q(!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(vi,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(Vu,{className:"flex-1 px-0",children:c.jsxs("div",{className:"flex flex-col",children:[(p.length>0||_.length>0||g==="loading"||g==="hydrating"||g==="error")&&c.jsx(M2,{view:l,sessions:p,activeProjectPath:O,boundProjects:_,currentSessionRef:b,unreadTaskKeys:Pe,catalogLoadState:g,catalogError:k,onRetryCatalog:R,onSelectProject:T=>void Be(T).catch(()=>{}),onCreateTask:T=>void bn(T).catch(()=>{}),renderRow:T=>{const Se=xe(T),wt=Ke(Se),_n=ce(Se,b),us=Ee===wt,qs=ce(Se,y),$r=!!y;return c.jsx(y2,{session:T,sessionRef:Se,isActive:_n,isForking:qs,isUnread:Pe.includes(Ke(Se)),anyForking:$r,isEditing:us,editingTitle:se,title:U(T),context:je(T),isCancelling:me.includes(Ke(Se)),isRetrying:pe.includes(Ke(Se)),isExporting:ge===wt,onSelect:()=>(t==null||t(),j(Se)),onCancelTask:()=>{K(Se).catch(()=>{})},onRetryTask:()=>{X(Se).catch(()=>{})},onFork:()=>void F(T),onArchive:()=>void N(Se),onExport:()=>void rr(T),onStartRename:he=>rn(he,T),onDelete:he=>nr(he,T),onEditingTitleChange:Re,onSaveRename:()=>ls(T),onCancelRename:H},wt)}}),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(jf,{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(b2,{}),[{icon:vf,action:()=>Me(r),labelKey:"sidebar.section.settings"}].map(({icon:T,action:Se,labelKey:wt})=>c.jsxs("button",{"data-settings-trigger":!0,onClick:Se,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(T,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),n(wt)]},wt))]}),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(Qk,{})]}),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]",$?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",$?"bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60")}),n($?"sidebar.status.feedLive":"sidebar.status.feedOffline")]})]})]})]}),c.jsx(Xk,{open:We,onOpenChange:Q})]}):c.jsx(S2,{className:e,onExpand:s,onNewChat:pt,onOpenTaskSwitcher:()=>Me(()=>f(!0)),onToggleTerminal:()=>Me(a),onToggleSettings:()=>Me(r),isTerminalOpen:i,taskEventsConnected:$,unreadCount:Pe.length})}const F2=S.lazy(()=>Vr(()=>import("./SettingsModal-zsS9O6SW.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),_2=S.lazy(()=>Vr(()=>import("./McpModal-CHUqitJ6.js"),__vite__mapDeps([4,1,3,5,2])).then(e=>({default:e.McpModal}))),D2=S.lazy(()=>Vr(()=>import("./SkillsModal-C2oTDXoy.js"),__vite__mapDeps([6,1,5,3,2])).then(e=>({default:e.SkillsModal}))),ty=()=>Vr(()=>import("./TaskSwitcher-CncVasNA.js"),__vite__mapDeps([7,1,2,3])).then(e=>({default:e.TaskSwitcher})),L2=S.lazy(ty),U2=S.lazy(()=>Vr(()=>import("./FilePreview-Bi1HWOvY.js"),__vite__mapDeps([8,1,2,3])).then(e=>({default:e.FilePreview}))),B2=S.lazy(()=>Vr(()=>import("./TerminalPanel-CBi2mUxx.js"),__vite__mapDeps([9,1,10,11,2,3])).then(e=>({default:e.TerminalPanel}))),Xa=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},q2=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function H2({children:e}){var We,Q;const t=Bt();h2();const{isSidebarOpen:n,isFilePreviewOpen:r,isMcpOpen:s,isSkillsOpen:o,isSettingsOpen:i,isTerminalOpen:a,isTaskSwitcherOpen:l,toggleFilePreview:u,openFilePreview:f,previewRequestId:p,setSidebarOpen:g}=pr();S.useEffect(()=>{const O=window.setTimeout(()=>{ty()},1500);return()=>window.clearTimeout(O)},[]);const k=B(O=>O.currentSessionId),b=B(O=>O.currentSessionRef),y=B(O=>O.sessions),j=B(O=>O.isStreaming),x=B(O=>O.isTemporarySession),I=B(O=>O.taskWorkspaceInfo),N=B(O=>O.boundProjects),F=B(O=>O.selectedProjectPath),[M,R]=S.useState(null),[P,$]=S.useState(!1),[A,_]=S.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[Z,E]=S.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),q=S.useRef(null),K=S.useRef(null),me=S.useRef(null),X=S.useMemo(()=>y.find(O=>ce({sessionId:O.sessionId,projectPath:O.projectPath},b)),[b,y]),pe=(X==null?void 0:X.taskIsolation)==="worktree"&&X.taskSourceProjectPath&&(((We=X.taskDelivery)==null?void 0:We.status)==="applied"||((Q=X.taskDelivery)==null?void 0:Q.status)==="discarded")?X.taskSourceProjectPath:b==null?void 0:b.projectPath;S.useEffect(()=>{if(typeof window.matchMedia!="function")return;const O=window.matchMedia("(max-width: 900px)"),U=()=>{O.matches&&g(!1)};return U(),O.addEventListener("change",U),()=>O.removeEventListener("change",U)},[g]),S.useEffect(()=>{if(typeof window.matchMedia!="function")return;const O=window.matchMedia("(max-width: 639px)"),U=()=>_(O.matches);return U(),O.addEventListener("change",U),()=>O.removeEventListener("change",U)},[]),S.useEffect(()=>{if(typeof window.matchMedia!="function")return;const O=window.matchMedia("(max-width: 1023px)"),U=()=>E(O.matches);return U(),O.addEventListener("change",U),()=>O.removeEventListener("change",U)},[]),S.useEffect(()=>{if(!A||!n)return;const O=requestAnimationFrame(()=>{var U,je;(je=(U=q.current)==null?void 0:U.querySelector("button"))==null||je.focus()});return()=>{var U;cancelAnimationFrame(O),(U=K.current)==null||U.focus({preventScroll:!0})}},[A,n]);const Pe=O=>{var Be;if(!A||!n)return;if(O.key==="Escape"){O.preventDefault(),g(!1);return}if(O.key!=="Tab")return;const U=Array.from(((Be=q.current)==null?void 0:Be.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(U.length===0)return;const je=U[0],pt=U[U.length-1];O.shiftKey&&document.activeElement===je?(O.preventDefault(),pt==null||pt.focus()):!O.shiftKey&&document.activeElement===pt&&(O.preventDefault(),je==null||je.focus())},Ee=S.useMemo(()=>!k||x?F?Xa(F):null:X!=null&&X.projectPath?Xa(X.taskSourceProjectPath||X.projectPath):null,[k,X,x,F]),L=S.useMemo(()=>Ee?q2(Ee):[],[Ee]);S.useEffect(()=>{var U;if(!b){R(((U=N.find(je=>je.path===F))==null?void 0:U.gitBranch)??null);return}(async()=>{try{const je=await de.getGitInfo({sessionId:b.sessionId,projectPath:pe??b.projectPath});R(je.branch)}catch{R(null)}})()},[N,b,pe,F]);const se=I==null?void 0:I.taskAdmission,Re=pe??F??(I==null?void 0:I.cwd)??null,ge=b?Ke(b):`project:${F??"none"}`,fe=r&&Z;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[A&&n&&!fe&&c.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>g(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),c.jsx("div",{ref:q,role:A&&n&&!fe?"dialog":void 0,"aria-modal":A&&n&&!fe?!0:void 0,"aria-label":A&&n&&!fe?t("sidebar.navigationAria"):void 0,"aria-hidden":fe||A&&!n?!0:void 0,inert:fe||A&&!n?!0:void 0,onKeyDown:Pe,className:W("overflow-hidden",n?"w-[260px]":"w-[64px]",A?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",A&&!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(O2,{onNavigate:()=>{A&&g(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":fe||void 0,inert:fe||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:[A&&c.jsx(mr,{ref:K,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>g(!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(Yy,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[L.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:Ee??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:L.map((O,U)=>{const je=U===L.length-1,pt=U===0&&O==="~";return c.jsxs("span",{className:"flex items-center min-w-0",children:[U>0&&c.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),U===0&&!pt&&c.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),c.jsx("span",{className:W("truncate",je?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:O})]},U)})}):c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:I!=null&&I.cwd?Xa(I.cwd):t("layout.workspace.empty")}),M&&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(Uc,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),M]})]}),c.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[se&&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(Hk,{inFlight:se.inFlight,queued:se.queued,maxConcurrent:se.maxConcurrent,compact:!0})}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx(mr,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:!b||x||j,onClick:()=>$(!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(Bi,{className:"w-4 h-4"})}),c.jsx(mr,{ref:me,variant:"ghost",size:"icon",onClick:()=>{if(r){u();return}f((!b||x)&&p===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(Xy,{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":fe||void 0,inert:fe||void 0,className:"flex relative flex-col flex-1 min-w-0",children:i?c.jsx(S.Suspense,{fallback:null,children:c.jsx(F2,{})}):e}),r&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(U2,{returnFocusElement:me.current},ge)})]})]}),a&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(B2,{workspacePath:Re},Re??"default-workspace")}),l&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(L2,{})}),s&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(_2,{})}),o&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(D2,{})}),c.jsx(a2,{open:P,onOpenChange:$})]})}const Za="BladeCode";function K2(){const e=Bt(),t=B(i=>i.unreadTaskKeys),n=B(i=>i.sessions),r=B(i=>i.selectSession),s=B(i=>i.selectProject),o=S.useMemo(()=>{const i=new Set(t);for(const a of n)a.pendingInteraction&&i.add(Ke(xe(a)));return i.size},[n,t]);return S.useEffect(()=>(document.title=o>0?`(${o}) ${Za}`:Za,()=>{document.title=Za}),[o]),S.useEffect(()=>{const i=a=>{var g;const l=a.detail;if(!(l!=null&&l.sessionId)||!l.projectPath)return;const u=B.getState(),f=qu(u.sessions,l),p=f?si(f,u.selectedProjectPath??((g=u.taskWorkspaceInfo)==null?void 0:g.cwd)??null):l.projectPath;u.boundProjects.some(k=>k.available&&k.path===p)&&s(p),r(l)};return window.addEventListener(_i,i),()=>window.removeEventListener(_i,i)},[s,r]),c.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const ny=S.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}));ny.displayName="Textarea";const z2=(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}},G2=(e,t,n={})=>{const{debounceDelay:r=200,maxSuggestions:s=15,workspacePath:o}=n,[i,a]=S.useState([]),[l,u]=S.useState(0),[f,p]=S.useState(!1),g=S.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:z2(e,t),[e,t]);S.useEffect(()=>{if(!g.hasQuery){a([]),p(!1);return}let y=!1;p(!0);const x=setTimeout(async()=>{try{const I=await fetch(`/suggestions/files?q=${encodeURIComponent(g.query)}&limit=${s}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!I.ok)throw new Error("Failed to fetch suggestions");const N=await I.json();y||a(N)}catch(I){console.error("Failed to fetch file suggestions:",I),y||a([])}finally{y||p(!1)}},r);return()=>{y=!0,clearTimeout(x)}},[g.hasQuery,g.query,r,s,o]),S.useEffect(()=>{u(0)},[i]);const k=S.useCallback(()=>{u(y=>(y+1)%Math.max(i.length,1))},[i.length]),b=S.useCallback(()=>{u(y=>(y-1+i.length)%Math.max(i.length,1))},[i.length]);return{...g,suggestions:i,selectedIndex:l,loading:f,setSelectedIndex:u,selectNext:k,selectPrevious:b}},V2=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,W2=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=V2(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 J2(){const[e,t]=S.useState([]),[n,r]=S.useState(-1),s=S.useRef(""),o=S.useCallback(u=>{u.trim()&&(t(f=>f[f.length-1]===u?f:[...f,u]),r(-1),s.current="")},[]),i=S.useCallback(u=>{if(e.length===0)return null;n===-1&&(s.current=u);const f=n===-1?e.length-1:Math.max(0,n-1);return r(f),e[f]??null},[e,n]),a=S.useCallback(()=>{if(n===-1)return null;const u=n+1;return u>=e.length?(r(-1),s.current):(r(u),e[u]??null)},[e,n]),l=S.useCallback(()=>{r(-1),s.current=""},[]);return{addToHistory:o,getPrevious:i,getNext:a,reset:l,historyIndex:n}}const Q2=(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}},Y2=(e,t,n={})=>{const{debounceDelay:r=150,workspacePath:s}=n,[o,i]=S.useState([]),[a,l]=S.useState(0),[u,f]=S.useState(!1),p=S.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:Q2(e,t),[e,t]);S.useEffect(()=>{if(!p.hasQuery){i([]),f(!1);return}let b=!1;f(!0);const j=setTimeout(async()=>{try{const x=await fetch(`/suggestions/commands?q=${encodeURIComponent(p.query)}`,s?{headers:{"x-blade-directory":s}}:void 0);if(!x.ok)throw new Error("Failed to fetch suggestions");const I=await x.json();b||i(I)}catch(x){console.error("Failed to fetch command suggestions:",x),b||i([])}finally{b||f(!1)}},r);return()=>{b=!0,clearTimeout(j)}},[p.hasQuery,p.query,r,s]),S.useEffect(()=>{l(0)},[o]);const g=S.useCallback(()=>{l(b=>(b+1)%Math.max(o.length,1))},[o.length]),k=S.useCallback(()=>{l(b=>(b-1+o.length)%Math.max(o.length,1))},[o.length]);return{...p,suggestions:o,selectedIndex:a,loading:u,setSelectedIndex:l,selectNext:g,selectPrevious:k}},X2=(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}},Z2="blade.composer.draft.",Qu=new Map;function Di(){return typeof sessionStorage>"u"?null:sessionStorage}function Li(e){return`${Z2}${e}`}function e5(e){var n;if(!e)return{content:"",attachments:[]};const t=Qu.get(e);if(t)return{content:t.content,attachments:[...t.attachments]};try{return{content:((n=Di())==null?void 0:n.getItem(Li(e)))??"",attachments:[]}}catch{return{content:"",attachments:[]}}}function Ln(e,t){var n,r;if(e){if(!t.content&&t.attachments.length===0){ry(e);return}Qu.set(e,{content:t.content,attachments:[...t.attachments]});try{t.content?(n=Di())==null||n.setItem(Li(e),t.content):(r=Di())==null||r.removeItem(Li(e))}catch{}}}function ry(e){var t;if(e){Qu.delete(e);try{(t=Di())==null||t.removeItem(Li(e))}catch{}}}function Fc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function t5(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function n5(e,t){const r=Fc(e)+t.reduce((s,o)=>s+t5(o),0);return e.length+t.length>Ur?{accepted:!1,reason:"count",estimatedBytes:r}:r>io?{accepted:!1,reason:"bytes",estimatedBytes:r}:{accepted:!0,estimatedBytes:r}}const r5=e=>typeof e=="object"&&"command"in e,df=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:s,onHover:o,visible:i})=>{const a=S.useRef(null),l=S.useRef(null);if(S.useEffect(()=>{if(l.current&&a.current){const f=a.current,p=l.current,g=f.getBoundingClientRect(),k=p.getBoundingClientRect();k.bottom>g.bottom?f.scrollTop+=k.bottom-g.bottom+4:k.top<g.top&&(f.scrollTop-=g.top-k.top+4)}},[n]),!i||t.length===0&&!r)return null;const u=e==="command"?Cf:cd;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(u,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:e==="command"?"Commands":"Files"}),r&&c.jsx(ct,{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((f,p)=>{const g=p===n,k=r5(f);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:k?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:f.command}),f.argumentHint&&c.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono",children:f.argumentHint})]}),c.jsx("p",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate",children:f.description})]})}):c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(cd,{className:"h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500"}),c.jsx("span",{className:"font-mono text-sm truncate",children:f})]})},k?f.command:f)})}),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"]})]})]})})},ec=[{value:fr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:Zy},{value:fr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:e0},{value:fr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:Tf,tone:"danger"},{value:fr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:t0}],s5=["off"],o5=["standard"],i5=[];function tc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function a5({onSend:e,onAbort:t,disabled:n,submitDisabled:r=!1,shellSubmitDisabled:s=!1,isStreaming:o,isStopping:i=!1,pendingSteeringCount:a=0,pendingInputDelivery:l=null,recoveredSteeringCount:u=0,variant:f="chat",draft:p,draftAttachments:g,draftRevision:k,draftKey:b,placeholder:y,workspacePath:j}){var od;const x=Bt(),I=S.useRef(e5(b)),[N,F]=S.useState(I.current.content),[M,R]=S.useState(I.current.attachments),P=S.useRef(N),$=S.useRef(M),[A,_]=S.useState(void 0),[Z,E]=S.useState(!1),[q,K]=S.useState(!1),[me,X]=S.useState(!1),[pe,Pe]=S.useState(!1),[Ee,L]=S.useState(!1),[se,Re]=S.useState(!1),[ge,fe]=S.useState(!1),[We,Q]=S.useState(null),[O,U]=S.useState(null),je=N.trimStart().startsWith("!"),pt=je?s:r,Be=S.useRef(null),bn=S.useRef(!1),Me=S.useRef(null),nr=S.useRef(null),{currentModelId:rr,configuredModels:rn,hasLoaded:ls,loadedWorkspacePath:H,loadModels:T,setCurrentModel:Se,currentMode:wt,setMode:_n}=Vt(),us=pr(v=>v.isSettingsOpen),qs=bo(v=>v.communicationStyle),$r=B(v=>v.setMaxContextTokens),he=B(v=>v.currentSessionRef),Hs=B(v=>{var Y;return(Y=v.sessions.find(J=>J.sessionId===(he==null?void 0:he.sessionId)&&J.projectPath===(he==null?void 0:he.projectPath)))==null?void 0:Y.selectedModelId}),sy=B(v=>{var Y;return(Y=v.sessions.find(J=>J.sessionId===(he==null?void 0:he.sessionId)&&J.projectPath===(he==null?void 0:he.projectPath)))==null?void 0:Y.reasoningEffort}),oy=B(v=>{var Y;return(Y=v.sessions.find(J=>J.sessionId===(he==null?void 0:he.sessionId)&&J.projectPath===(he==null?void 0:he.projectPath)))==null?void 0:Y.serviceTier}),iy=B(v=>{var Y;return(Y=v.sessions.find(J=>J.sessionId===(he==null?void 0:he.sessionId)&&J.projectPath===(he==null?void 0:he.projectPath)))==null?void 0:Y.responseVerbosity}),[ay,Yu]=S.useState(null),[cy,Pa]=S.useState(null),[ly,Na]=S.useState(null),[uy,$a]=S.useState(null),dy=rn.some(v=>v.id===Hs),ds=he?ay??(dy?Hs:rr):rr,Xe=rn.find(v=>v.id===ds),Ra=(Xe==null?void 0:Xe.supportedReasoningEfforts)??s5,Xu=["auto",...Ra],Rr=cy??sy??"off",ii=(Xe==null?void 0:Xe.supportedServiceTiers)??o5,fy=["auto",...ii],Mr=ly??oy??"auto",ai=(Xe==null?void 0:Xe.supportedResponseVerbosities)??i5,my=["auto",...ai],Or=uy??iy??"auto",Zu=qs??"auto",py=Xu.length>1,gy=ii.some(v=>v!=="standard"),hy=ai.length>0,ed=(Xe==null?void 0:Xe.displayName)||(Xe==null?void 0:Xe.model)||ds||x("chat.input.model.placeholder"),sr=((od=Xe==null?void 0:Xe.input)==null?void 0:od.includes("image"))===!0,Ks=Xe?x("chat.input.attachment.modelUnsupported",{model:ed}):x("chat.input.attachment.modelRequired"),ci=M.length>0&&!sr,zt=Y2(N,A,{workspacePath:j}),Gt=G2(N,A,{workspacePath:j}),fs=J2(),zs=zt.hasQuery&&zt.suggestions.length>0,li=Gt.hasQuery&&Gt.suggestions.length>0,by=zs||li;S.useEffect(()=>{!us&&(!ls||H!==(j??null))&&T(j??void 0)},[us,T,H,ls,j]),S.useEffect(()=>{o&&(E(!1),K(!1),X(!1),Pe(!1))},[o]),S.useEffect(()=>{Yu(null),Pa(null),Na(null),$a(null)},[he==null?void 0:he.projectPath,he==null?void 0:he.sessionId]),S.useEffect(()=>{Rr!=="auto"&&!Ra.includes(Rr)&&Pa("auto")},[Rr,Ra]),S.useEffect(()=>{Mr!=="auto"&&!ii.includes(Mr)&&Na("auto")},[Mr,ii]),S.useEffect(()=>{Or!=="auto"&&!ai.includes(Or)&&$a("auto")},[Or,ai]),S.useEffect(()=>{U(null)},[ds]),S.useEffect(()=>{if(p!==void 0){const v=g??$.current;P.current=p,$.current=v,F(p),R(v),Q(null),U(null),_(p.length),Ln(b,{content:p,attachments:v}),requestAnimationFrame(()=>{var Y;return(Y=Me.current)==null?void 0:Y.focus()})}},[p,g,b,k]),S.useEffect(()=>()=>{Ln(b,{content:P.current,attachments:$.current})},[b]),S.useEffect(()=>{if(!Xe)return;const v=!!Xe.contextWindow;$r(Xe.contextWindow||0,!v)},[Xe,$r]),S.useEffect(()=>{sr&&Q(v=>v!==Be.current?v:(Be.current=null,null))},[sr]);const Ma=S.useCallback(async()=>{if(!N.trim()&&M.length===0||n||pt||ci||bn.current)return;N.trim()&&fs.addToHistory(N),bn.current=!0,fe(!0);const v=b;try{if(await e({content:N,modelId:ds??void 0,reasoningEffort:Rr,serviceTier:Mr,responseVerbosity:Or,communicationStyle:Zu,attachments:M})===!1)return;ry(v),P.current="",$.current=[],F(""),R([]),Q(null),U(null),Be.current=null,_(void 0)}catch{}finally{bn.current=!1,fe(!1)}},[M,ci,b,N,n,ds,Rr,Or,Zu,Mr,pt,e,fs]),xy=S.useCallback(v=>{Q(null),U(null),Be.current=null,R(Y=>{const J=Y.filter(Ne=>Ne.id!==v);return $.current=J,Ln(b,{content:P.current,attachments:J}),J})},[b]),td=S.useCallback(v=>new Promise((Y,J)=>{const Ne=new FileReader;Ne.onload=()=>{if(typeof Ne.result!="string"){J(new Error("Failed to read image"));return}Y({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:Ne.result})},Ne.onerror=()=>J(Ne.error??new Error("Failed to read image")),Ne.readAsDataURL(v)}),[]),ui=S.useCallback(async v=>{if(v.length===0)return;if(!sr){Be.current=Ks,U(null),Q(Ks);return}const Y=n5($.current,v),J=Ne=>Ne==="count"?x("chat.input.attachment.countLimit",{count:Ur}):x("chat.input.attachment.sizeLimit",{size:tc(io)});if(!Y.accepted){Be.current=null,U(null),Q(J(Y.reason??"bytes"));return}try{const Ne=await Promise.all(v.map(ms=>td(ms))),Et=new Set($.current.map(ms=>ms.dataUrl)),id=Ne.filter(ms=>Et.has(ms.dataUrl)?!1:(Et.add(ms.dataUrl),!0));if(id.length===0){Q(null),U(null),Be.current=null;return}const di=[...$.current,...id];if(Fc(di)>io){Be.current=null,U(null),Q(J("bytes"));return}$.current=di,R(di),Q(null),U(null),Be.current=null,Ln(b,{content:P.current,attachments:di})}catch{Be.current=null,U(null),Q(x("chat.input.attachment.readFailed"))}},[b,Ks,sr,td,x]),ky=S.useCallback(async v=>{const Y=Array.from(v.target.files??[]).filter(J=>J.type.startsWith("image/"));await ui(Y),v.target.value=""},[ui]),yy=S.useCallback(async v=>{const Y=Array.from(v.clipboardData.items).filter(J=>J.type.startsWith("image/")).map(J=>J.getAsFile()).filter(J=>J!==null);Y.length!==0&&(v.preventDefault(),await ui(Y))},[ui]),Oa=S.useCallback(v=>{const Y=zt.suggestions[v];if(!Y)return;const{newInput:J,newCursorPos:Ne}=X2(N,zt,Y);P.current=J,F(J),_(Ne),Ln(b,{content:J,attachments:$.current}),requestAnimationFrame(()=>{Me.current&&(Me.current.focus(),Me.current.setSelectionRange(Ne,Ne))})},[b,N,zt]),Fa=S.useCallback(v=>{const Y=Gt.suggestions[v];if(!Y)return;const{newInput:J,newCursorPos:Ne}=W2(N,Gt,Y);P.current=J,F(J),_(Ne),Ln(b,{content:J,attachments:$.current}),requestAnimationFrame(()=>{Me.current&&(Me.current.focus(),Me.current.setSelectionRange(Ne,Ne))})},[Gt,b,N]),Sy=S.useCallback(v=>{if(zs){if(v.key==="ArrowDown"){v.preventDefault(),zt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),zt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Oa(zt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),_(void 0);return}}if(li){if(v.key==="ArrowDown"){v.preventDefault(),Gt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Gt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Fa(Gt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),_(void 0);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Ma();return}if(v.key==="ArrowUp"&&!v.shiftKey){const Y=v.target,J=Y.selectionStart===0&&Y.selectionEnd===0,Ne=!N.includes(`
31
- `);if(J||Ne){const Et=fs.getPrevious(N);Et!==null&&(v.preventDefault(),P.current=Et,F(Et),Ln(b,{content:Et,attachments:$.current}),requestAnimationFrame(()=>{Me.current&&Me.current.setSelectionRange(Et.length,Et.length)}))}return}if(v.key==="ArrowDown"&&!v.shiftKey){const Y=v.target,J=Y.selectionStart===N.length&&Y.selectionEnd===N.length,Ne=!N.includes(`
32
- `);if((J||Ne)&&fs.historyIndex!==-1){const Et=fs.getNext();Et!==null&&(v.preventDefault(),P.current=Et,F(Et),Ln(b,{content:Et,attachments:$.current}),requestAnimationFrame(()=>{Me.current&&Me.current.setSelectionRange(Et.length,Et.length)}))}}},[zs,li,zt,Gt,Oa,Fa,Ma,b,N,fs]),wy=S.useCallback(v=>{const Y=v.target.value;P.current=Y,F(Y),_(v.target.selectionStart),Ln(b,{content:Y,attachments:$.current})},[b]),nd=S.useCallback(v=>{const Y=v.target;_(Y.selectionStart)},[]);S.useEffect(()=>{Me.current&&(Me.current.style.height="inherit",Me.current.style.height=`${Math.min(Me.current.scrollHeight,200)}px`)},[N]);const _a=ec.find(v=>v.value===wt)??ec[1],vy=x(_a.labelKey),Iy=_a.icon,jy=!!N.trim()||M.length>0,rd=M.length>=Ur,Cy=Fc(M),Da=We||(ci?Ks:null),sd=Da?null:O,La=!!n||ge,Ty=La||rd||!sr,Gs=sr?rd?x("chat.input.attachment.countLimit",{count:Ur}):x("chat.input.attachment.add"):Ks,Ey=()=>{La||(U(Gs),!sr&&!o&&rn.some(v=>{var Y;return(Y=v.input)==null?void 0:Y.includes("image")})&&E(!0))};return c.jsxs("div",{className:f==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[c.jsxs("div",{className:f==="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 ${f==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${je?"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 ${je?"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(df,{type:"command",suggestions:zt.suggestions,selectedIndex:zt.selectedIndex,loading:zt.loading,onSelect:Oa,onHover:zt.setSelectedIndex,visible:zs}),c.jsx(df,{type:"file",suggestions:Gt.suggestions,selectedIndex:Gt.selectedIndex,loading:Gt.loading,onSelect:Fa,onHover:Gt.setSelectedIndex,visible:li&&!zs}),c.jsx(ny,{ref:Me,"data-blade-composer":!0,value:N,onChange:wy,onKeyDown:Sy,onPaste:yy,onSelect:nd,onClick:nd,placeholder:y??x(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 ${f==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:n||ge,"aria-busy":ge}),je&&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"?x("chat.input.followUp.queued",{count:a}):a>0?x("chat.input.steering.queued",{count:a}):c.jsxs(c.Fragment,{children:[x("chat.input.steering.status"),x("chat.input.steering.enterHint")]})}),u>0&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:u===1?x("chat.input.steering.recoveredOne",{count:u}):x("chat.input.steering.recoveredMany",{count:u})}),Da&&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(lo,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:Da}),We&&c.jsx("button",{type:"button","aria-label":x("chat.error.dismiss"),onClick:()=>{Q(null),Be.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(to,{className:"w-3 h-3"})})]}),sd&&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(n0,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:sd}),c.jsx("button",{type:"button","aria-label":x("chat.notice.dismiss"),onClick:()=>U(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(to,{className:"w-3 h-3"})})]}),M.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:x("chat.input.attachment.usage",{count:M.length,limit:Ur,used:tc(Cy),budget:tc(io)})}),c.jsx("div",{className:"flex flex-wrap gap-2",children:M.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":`${x("chat.input.attachment.remove")} ${v.name}`,title:`${x("chat.input.attachment.remove")} ${v.name}`,onClick:()=>xy(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(to,{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:[Ty?c.jsx("button",{type:"button",disabled:La,"aria-disabled":"true","aria-label":Gs,title:Gs,onClick:Ey,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(ld,{className:"w-4 h-4"})}):c.jsxs("label",{title:Gs,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:nr,type:"file",accept:"image/*",multiple:!0,"aria-label":Gs,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:ky}),c.jsx(ld,{className:"w-4 h-4"})]}),c.jsxs(ur,{open:Z,onOpenChange:v=>{!o&&!ge&&E(v)},children:[c.jsx(dr,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||ge,title:x(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:[ed,c.jsx(hs,{className:"w-3 h-3"})]})}),c.jsx(Un,{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:rn.length===0?c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:x("chat.input.model.empty")}):Object.entries(rn.reduce((v,Y)=>{const J=Y.provider||"unknown";return v[J]||(v[J]=[]),v[J].push(Y),v},{})).map(([v,Y])=>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," ")}),Y.map(J=>{var Ne;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 ${J.id===ds?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(U(null),he){Yu(J.id),E(!1);return}Se(J.id,j??void 0).then(()=>E(!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:J.displayName||J.model}),((Ne=J.input)==null?void 0:Ne.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:x("chat.input.model.vision")})]})},J.id)})]},v))})})]}),py&&c.jsxs(ur,{open:q,onOpenChange:v=>{!o&&!ge&&K(v)},children:[c.jsx(dr,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||ge,"aria-label":x("chat.input.effort.change"),title:x(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:[x("chat.input.effort.label",{effort:Rr}),c.jsx(hs,{className:"w-3 h-3"})]})}),c.jsxs(Un,{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:x("chat.input.effort.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:Xu.map(v=>c.jsxs("button",{type:"button","aria-label":x("chat.input.effort.option",{effort:v}),onClick:()=>{Pa(v),K(!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 ${Rr===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:x("chat.input.effort.autoHint")})]},v))})]})]}),gy&&c.jsxs(ur,{open:me,onOpenChange:v=>{!o&&!ge&&X(v)},children:[c.jsx(dr,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||ge,"aria-label":x("chat.input.serviceTier.change"),title:x(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:[x("chat.input.serviceTier.label",{tier:Mr}),c.jsx(hs,{className:"w-3 h-3"})]})}),c.jsxs(Un,{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:x("chat.input.serviceTier.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fy.map(v=>c.jsxs("button",{type:"button","aria-label":x("chat.input.serviceTier.option",{tier:v}),onClick:()=>{Na(v),X(!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 ${Mr===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:x("chat.input.serviceTier.fastHint")}),v==="flex"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:x("chat.input.serviceTier.flexHint")})]},v))})]})]}),hy&&c.jsxs(ur,{open:pe,onOpenChange:v=>{!o&&!ge&&Pe(v)},children:[c.jsx(dr,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||ge,"aria-label":x("chat.input.responseVerbosity.change"),title:x(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:[x("chat.input.responseVerbosity.label",{verbosity:Or}),c.jsx(hs,{className:"w-3 h-3"})]})}),c.jsxs(Un,{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:x("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":x("chat.input.responseVerbosity.option",{verbosity:v}),onClick:()=>{$a(v),Pe(!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 ${Or===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:x("chat.input.responseVerbosity.autoHint")})]},v))})]})]}),c.jsxs(ur,{open:Ee,onOpenChange:L,children:[c.jsx(dr,{asChild:!0,children:c.jsxs("button",{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${_a.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(Iy,{className:"h-3.5 w-3.5"}),vy,c.jsx(hs,{className:"w-3 h-3"})]})}),c.jsxs(Un,{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:x("chat.input.mode.aria")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:ec.map(v=>{const Y=v.icon,J=wt===v.value,Ne=v.tone==="danger";return c.jsxs("button",{type:"button","aria-pressed":J,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${J?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{v.value===fr.YOLO&&wt!==fr.YOLO?(L(!1),Re(!0)):(_n(v.value),L(!1))},children:[c.jsx(Y,{className:`mt-0.5 h-4 w-4 shrink-0 ${Ne?"text-amber-500":J?"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 ${Ne?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:x(v.labelKey)}),c.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:x(v.descriptionKey)})]}),J&&c.jsx(wf,{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(mr,{size:"icon",onClick:()=>{t==null||t()},disabled:i,title:x(i?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":x(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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Bc,{className:"w-3 h-3"})}),c.jsx(mr,{size:"icon",onClick:Ma,disabled:!jy||n||pt||ci||ge||by,title:x(ge?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":x(ge?"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:ge?c.jsx(ct,{className:"w-4 h-4 animate-spin"}):c.jsx(r0,{className:"w-4 h-4"})})]})]})]}),f==="chat"&&c.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:x("chat.footer.disclaimer")})]}),c.jsx(zc,{open:se,onOpenChange:Re,children:c.jsx(qi,{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(Tf,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),c.jsx(Hi,{className:"font-mono text-sm font-semibold",children:x("chat.input.mode.yolo.confirm.title")})]}),c.jsx(Ki,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:x("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:()=>Re(!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:x("chat.input.mode.yolo.confirm.cancel")}),c.jsx("button",{type:"button",onClick:()=>{_n(fr.YOLO),Re(!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:x("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}const c5={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 l5(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 u5(e){return e.split("/").filter(Boolean).at(-1)||e}function d5({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const u=Bt(),f=[...e].sort(Ju).slice(0,4),p=a==="loading"||a==="hydrating";return f.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(ct,{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"}),u(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:u("taskHome.recent.title")}),c.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:u(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:f.map(g=>{var A;const k=c5[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=u5(g.taskSourceProjectPath||g.projectPath),j=co(g,u),x=Ke(xe(g)),I=g.taskStatus==="running"||g.taskStatus==="queued",N=n.includes(x),F=r.includes(x),M=!!g.taskRetryAvailable&&(g.taskStatus==="failed"||g.taskStatus==="interrupted"||g.taskStatus==="cancelled"),R=s.includes(x),P=(A=g.taskStatusReason)==null?void 0:A.trim(),$=g.taskFailure?u(Ku(g.taskFailure.code)):P==="user-cancel"?u("session.reason.cancelledByUser"):P||void 0;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)]":k.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}),R&&c.jsx("span",{title:u("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:`${u("session.retriedFrom")} ${g.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:u("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":k.text),children:u(b??k.labelKey)}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:"shrink-0",children:l5(g.lastMessageTime||g.firstMessageTime,u)})]}),$&&c.jsx("span",{title:$,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:$})]}),c.jsx(s0,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),I&&c.jsx("button",{type:"button","aria-label":u(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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Bc,{className:"h-3.5 w-3.5"})}),M&&c.jsx("button",{type:"button","aria-label":u(F?"session.action.retrying":"session.action.retry",{title:j}),disabled:F,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:F?c.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Bi,{className:"h-3.5 w-3.5"})})]},x)})})]})}function f5({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 nc=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:Hc,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:o0,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:i0,prompt:"Review the current changes for bugs, regressions, and missing tests. ",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:a0,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function m5(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function p5(){const e=Bt(),{taskWorkspaceInfo:t,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:s,sessions:o,boundProjects:i,selectedProjectPath:a,error:l,selectProject:u,dispatchTask:f,sendMessage:p,startTemporarySession:g,selectSession:k,cancelTask:b,cancellingTaskKeys:y,retryTask:j,retryingTaskKeys:x,unreadTaskKeys:I,taskEventConnectionState:N,catalogLoadState:F,reconnectTaskEvents:M,clearError:R,loadTaskWorkspaceInfo:P,loadBoundProjects:$}=B(),A=pr(H=>H.openSettings),_=pr(H=>H.isSettingsOpen),Z=Vt(H=>H.currentMode),E=Vt(H=>H.currentModelId),q=Vt(H=>H.configuredModels),K=Vt(H=>H.isLoading),me=Vt(H=>H.hasLoaded),X=Vt(H=>H.loadedWorkspacePath),pe=Vt(H=>H.error),Pe=Vt(H=>H.loadModels),[Ee,L]=S.useState("worktree"),[se,Re]=S.useState(),[ge,fe]=S.useState(!1),We=e(N==="connected"?"taskHome.eyebrow":N==="reconnecting"?"taskHome.feed.reconnecting":N==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),Q=S.useMemo(()=>i.find(H=>H.path===a)??i.find(H=>H.isCurrent),[i,a]),O=S.useMemo(()=>I_(o,a,(t==null?void 0:t.cwd)??null),[a,o,t==null?void 0:t.cwd]),U=(Q!=null&&Q.available?Q.path:void 0)??(t==null?void 0:t.cwd),je=`task:${U??"unavailable"}`;S.useEffect(()=>{!_&&U&&(!me||X!==U)&&Pe(U)},[_,Pe,X,me,U]);const pt=!(Q!=null&&Q.available)&&n,Be=Q!=null&&Q.available?null:r,bn=!!(U&&!pt&&!Be),Me=!!(E&&q.some(H=>H.id===E)),nr=!me||K,rr=bn&&Me&&!nr&&pe===null,rn=S.useMemo(()=>({project:m5(e,(Q==null?void 0:Q.path)??(t==null?void 0:t.cwd)),branch:(Q==null?void 0:Q.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[Q,t,e]),ls=S.useCallback(async H=>{if(H.content.trimStart().startsWith("!")){g(U),await p({content:H.content,attachments:[]});return}await f({prompt:H.content,projectPath:U,isolation:Ee,permissionMode:Z,modelId:H.modelId??E??void 0,reasoningEffort:H.reasoningEffort,serviceTier:H.serviceTier,responseVerbosity:H.responseVerbosity,communicationStyle:H.communicationStyle,attachments:H.attachments.map(T=>({type:"image",content:T.dataUrl,mimeType:T.mimeType,name:T.name}))})},[Z,E,f,Ee,p,g,U]);return S.useEffect(()=>{const H=T=>{if(!(T.metaKey||T.ctrlKey))return;const Se=Number.parseInt(T.key,10);if(Number.isNaN(Se)||Se<1||Se>nc.length)return;const wt=nc[Se-1];wt&&(T.preventDefault(),Re({key:je,content:wt.prompt}))};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[je]),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(Wu,{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",N==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[N==="offline"?c.jsx(ud,{className:"w-3 h-3"}):c.jsx("span",{className:"deck-pulse-dot"}),We]}),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(Cf,{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:nc.map((H,T)=>c.jsx(f5,{index:T,title:e(H.titleKey),description:e(H.descriptionKey),icon:H.icon,hint:e(H.hintKey),onClick:()=>Re({key:je,content:H.prompt})},H.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(ur,{children:[c.jsx(dr,{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(ro,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"font-medium truncate",children:(Q==null?void 0:Q.name)??rn.project}),c.jsx(hs,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),c.jsx(Un,{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(H=>c.jsxs("button",{type:"button",disabled:!H.available,onClick:()=>{u(H.path)},className:W("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",H.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))]",!H.available&&"opacity-40"),children:[c.jsx(ro,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0 truncate",children:H.name}),H.path===a&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},H.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":Ee==="worktree",onClick:()=>L(H=>H==="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",Ee==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[Ee==="worktree"?c.jsx(c0,{className:"w-3 h-3"}):c.jsx(l0,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:e(Ee==="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(Uc,{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(Hk,{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(ct,{className:"w-3 h-3 animate-spin"}),c.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!rr&&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",bn?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":Be?"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:pt?c.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):bn?c.jsx(dd,{className:"h-3.5 w-3.5"}):Be?c.jsx(lo,{className:"h-3.5 w-3.5"}):c.jsx(ro,{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:pt?e("taskHome.setup.workspace.loading"):Be||(bn?e("taskHome.setup.workspace.ready",{project:rn.project}):e("taskHome.setup.workspace.required"))})]}),!bn&&c.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[Be&&c.jsx("button",{type:"button",onClick:()=>{Promise.all([P(),$()])},"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(no,{className:"h-3.5 w-3.5"})}),c.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>fe(!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(vi,{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",Me&&!pe?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":pe?"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:nr?c.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):Me&&!pe?c.jsx(dd,{className:"h-3.5 w-3.5"}):pe?c.jsx(lo,{className:"h-3.5 w-3.5"}):c.jsx(fd,{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:pe??void 0,className:W("mt-0.5 block truncate text-[10.5px]",pe?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:nr?e("taskHome.setup.model.loading"):pe||e(Me?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!nr&&(!Me||pe)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{pe?Pe(U):A("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:[pe?c.jsx(no,{className:"w-3 h-3"}):c.jsx(fd,{className:"w-3 h-3"}),e(pe?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(a5,{variant:"task",draft:(se==null?void 0:se.key)===je?se.content:void 0,draftKey:je,placeholder:e("taskHome.composer.placeholder"),onSend:async H=>{try{return await ls(H),Re(void 0),!0}catch{return!1}},disabled:s,submitDisabled:!rr,shellSubmitDisabled:!rr,workspacePath:U},je)})]}),N==="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(ud,{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 M().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(no,{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:R,className:"underline",children:e("taskHome.error.dismiss")})]}),c.jsx(d5,{sessions:O,catalogLoadState:F,cancellingTaskKeys:y,retryingTaskKeys:x,unreadTaskKeys:I,onSelect:H=>{k(xe(H))},onCancel:H=>{b(xe(H)).catch(()=>{})},onRetry:H=>{j(xe(H)).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(jf,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(Xk,{open:ge,onOpenChange:fe})]})})}const _c="blade.sessions.last",Ui="session",Dc="project",Lc="workspace";function g5(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 h5(e){var o,i,a;const t=new URLSearchParams(e),n=((o=t.get(Ui))==null?void 0:o.trim())||null,r=((i=t.get(Dc))==null?void 0:i.trim())||null,s=((a=t.get(Lc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Ui)}}function b5(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(_c);return t?g5(JSON.parse(t)):null}catch{return null}}function x5(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(Ui,e.sessionId):s.searchParams.delete(Ui),o?s.searchParams.set(Dc,o):s.searchParams.delete(Dc),i&&o&&i!==o?s.searchParams.set(Lc,i):s.searchParams.delete(Lc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(_c,JSON.stringify(e)):a==null||a.removeItem(_c)}catch{}const l=`${s.pathname}${s.search}${s.hash}`,u=n.replaceState??(typeof window>"u"?void 0:f=>window.history.replaceState(null,"",f));return u==null||u(l),l}const k5=S.lazy(()=>Vr(()=>import("./ChatView-iK7ff8qU.js"),__vite__mapDeps([12,1,2,3])).then(e=>({default:e.ChatView})));function y5(){const e=Bt(),[t,n]=S.useState(!1),r=B(I=>I.subscribeToTaskEvents),s=B(I=>I.unsubscribeFromTaskEvents),o=B(I=>I.currentSessionRef),i=B(I=>I.isTemporarySession),a=B(I=>I.loadTaskWorkspaceInfo),l=B(I=>I.loadBoundProjects),u=B(I=>I.loadSessions),f=B(I=>I.selectSession),p=B(I=>I.selectProject),g=B(I=>I.startTemporarySession),k=B(I=>I.setError),b=B(I=>I.sessions),y=B(I=>I.selectedProjectPath),j=Vt(I=>I.loadModels),x=bo(I=>I.loadSettings);return S.useEffect(()=>(r().catch(I=>{console.error("Failed to subscribe to task events",I)}),s),[r,s]),S.useEffect(()=>{let I=!1;return(async()=>{var Z;u(),x(),j();const F=h5(window.location.search),M=b5(),R=F.hasSessionParam?F.sessionRef:F.projectPath?null:M,P=Promise.all([a(),l()]),$=!R&&!F.projectPath;if($&&(g(),n(!0)),await P,I)return;const A=B.getState(),_=F.projectPath?(Z=A.boundProjects.find(E=>E.path===F.projectPath&&E.available))==null?void 0:Z.path:null;if(_&&p(_),!(R&&(await f(R),I))){if(!R||!ce(B.getState().currentSessionRef,R)){const E=R?B.getState().error:null;g(),E&&k(E)}$||n(!0)}})(),()=>{I=!0}},[l,j,u,x,a,p,f,k,g]),S.useEffect(()=>{if(!t)return;const I=o?qu(b,o):void 0;x5(o,y,{displayProjectPath:I?si(I,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(K2,{}),c.jsx(H2,{children:t?!o||i?c.jsx(p5,{}):c.jsx(S.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(k5,{})}):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")})})]})}Ny.createRoot(document.getElementById("root")).render(c.jsx(Xs.StrictMode,{children:c.jsx(y5,{})}));export{Vt as A,Wu as B,a5 as C,zc as D,bo as E,d2 as F,T5 as G,Ju as H,co as I,si as J,Kk as K,Pc as L,ys as M,Mc as N,f_ as O,ur as P,mr as Q,C5 as R,Vu as S,Vr as _,B as a,pr as b,xe as c,Ke as d,qi as e,Gc as f,Hi as g,Ki as h,Ff as i,W as j,de as k,h_ as l,zn as m,Ea as n,Si as o,qu as p,O_ as q,af as r,ce as s,Ku as t,Bt as u,dr as v,Un as w,cr as x,Yk as y,XD as z};