blade-code 0.10.6 → 0.10.8

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 (116) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/chunk-1w6azndv.js +1 -0
  3. package/dist/chunk-2gwaqpge.js +1 -0
  4. package/dist/chunk-2pjd4cys.js +1 -0
  5. package/dist/{chunk-xsmtpkjm.js → chunk-2thg3fq1.js} +1 -1
  6. package/dist/chunk-2zn5en0w.js +1 -0
  7. package/dist/{chunk-vvbd9fb5.js → chunk-33ave20b.js} +1 -1
  8. package/dist/chunk-3w1z6fwm.js +1 -0
  9. package/dist/chunk-43x4qbvt.js +1 -0
  10. package/dist/{chunk-kcwq1e7h.js → chunk-4h9ff923.js} +1 -1
  11. package/dist/chunk-52csdk21.js +3 -0
  12. package/dist/{chunk-frcg8gea.js → chunk-66hb7kxm.js} +2 -2
  13. package/dist/chunk-6j8wgp2s.js +2 -0
  14. package/dist/chunk-6vsszvgg.js +2 -0
  15. package/dist/chunk-7evtr0yr.js +10 -0
  16. package/dist/{chunk-yt39kfc6.js → chunk-7hbw6q6d.js} +1 -1
  17. package/dist/chunk-7zsyejr1.js +22 -0
  18. package/dist/{chunk-r083b7vn.js → chunk-8gcg2z3y.js} +16 -16
  19. package/dist/{chunk-rag8zchg.js → chunk-8gcvpmwk.js} +1 -1
  20. package/dist/{chunk-6cv4gddv.js → chunk-8gnfj89a.js} +2 -2
  21. package/dist/{chunk-76d7p64v.js → chunk-8h0yxh6y.js} +2 -2
  22. package/dist/chunk-8sfycn3y.js +194 -0
  23. package/dist/{chunk-c2rhwxyn.js → chunk-954vmnrn.js} +1 -1
  24. package/dist/chunk-a8h3fymk.js +100 -0
  25. package/dist/chunk-b5szbtmp.js +5 -0
  26. package/dist/chunk-bxm2hq0m.js +1 -0
  27. package/dist/chunk-c8da4b3d.js +1 -0
  28. package/dist/{chunk-p4j4aawd.js → chunk-cbpqcdga.js} +1 -1
  29. package/dist/{chunk-m4htdpr9.js → chunk-cf8e7e92.js} +72 -17
  30. package/dist/chunk-d0g4t8fw.js +8 -0
  31. package/dist/{chunk-b4n34hrn.js → chunk-eq2qj9ja.js} +1 -1
  32. package/dist/{chunk-7xm3vjkz.js → chunk-fj8v7pep.js} +1 -1
  33. package/dist/{chunk-bn0ge244.js → chunk-fxpq9nh6.js} +1 -1
  34. package/dist/chunk-g00wj2we.js +4 -0
  35. package/dist/{chunk-bnrce0hg.js → chunk-h28ptrrt.js} +1 -1
  36. package/dist/{chunk-gb4n3hwj.js → chunk-h421wzbm.js} +2 -2
  37. package/dist/{chunk-dcvvxsa1.js → chunk-j4tttsaz.js} +2 -2
  38. package/dist/{chunk-k0p9ecgc.js → chunk-kagpk2x5.js} +6 -6
  39. package/dist/chunk-kvnwhwx3.js +1 -0
  40. package/dist/{chunk-p196e4rq.js → chunk-m2xrx1je.js} +1 -1
  41. package/dist/chunk-nhc49pan.js +160 -0
  42. package/dist/{chunk-sf9pe2n6.js → chunk-nymm525r.js} +1 -1
  43. package/dist/{chunk-9sfmrb1j.js → chunk-nz57y1ad.js} +3 -3
  44. package/dist/{chunk-45dcfkwe.js → chunk-p2m56new.js} +2 -2
  45. package/dist/{chunk-w154jyby.js → chunk-pv9sw79c.js} +1 -1
  46. package/dist/chunk-qgp08qmz.js +6 -0
  47. package/dist/{chunk-evaht3v4.js → chunk-r7tsa2zv.js} +1 -1
  48. package/dist/{chunk-rw6gv740.js → chunk-rkvfsx8e.js} +1 -1
  49. package/dist/{chunk-v1p80wvh.js → chunk-rxqft6td.js} +2 -2
  50. package/dist/{chunk-g9n211y4.js → chunk-s9aj3p11.js} +2 -2
  51. package/dist/chunk-senkwdh6.js +2 -0
  52. package/dist/chunk-v1c58sm6.js +1 -0
  53. package/dist/{chunk-n9khyme2.js → chunk-v8pq6qmv.js} +2 -2
  54. package/dist/{chunk-1cvr3qtd.js → chunk-van4ysq6.js} +289 -305
  55. package/dist/chunk-vgp8m9fg.js +2 -0
  56. package/dist/{chunk-4y28hykg.js → chunk-vsg8f0e6.js} +1 -1
  57. package/dist/{chunk-kcs3xa8f.js → chunk-w0nscjd2.js} +2 -2
  58. package/dist/chunk-w26jhcj9.js +1 -0
  59. package/dist/{chunk-hjsm6ejs.js → chunk-wmnszjmv.js} +2 -2
  60. package/dist/chunk-x6wgh726.js +1 -0
  61. package/dist/{chunk-thvwt4kc.js → chunk-xa05phpw.js} +3 -3
  62. package/dist/{chunk-g4q26d9a.js → chunk-xmcsn7y0.js} +2 -2
  63. package/dist/{chunk-c9tzf9r5.js → chunk-y4c3wwpa.js} +1 -1
  64. package/dist/{chunk-0rp2ck29.js → chunk-yfs9tq3y.js} +2 -2
  65. package/dist/chunk-ymzcxryf.js +1 -0
  66. package/dist/{chunk-xkp4ph6v.js → chunk-zknv3d6y.js} +1 -1
  67. package/dist/chunk-zp4x2mwj.js +1 -0
  68. package/dist/chunk-zvk3g177.js +9 -0
  69. package/dist/web/assets/ChatView-Fqy97qw9.js +7 -0
  70. package/dist/web/assets/{CodeBlockHighlighter-CFW6qjnA.js → CodeBlockHighlighter-EgdsVoMQ.js} +1 -1
  71. package/dist/web/assets/{FilePreview-CR_XetY0.js → FilePreview-xicd9-Sl.js} +1 -1
  72. package/dist/web/assets/{MarkdownRenderer-CVrxJswQ.js → MarkdownRenderer-DBSjC_z3.js} +18 -18
  73. package/dist/web/assets/SettingsModal-Bkh5rMAJ.js +5 -0
  74. package/dist/web/assets/TaskSwitcher-DXcj0iJ_.js +1 -0
  75. package/dist/web/assets/{TerminalPanel-DTqvx8yB.js → TerminalPanel-DWVY-Elm.js} +1 -1
  76. package/dist/web/assets/index-Bi5ijAQP.css +1 -0
  77. package/dist/web/assets/index-CxEh32hc.js +32 -0
  78. package/dist/web/assets/{vendor-icons-D_AkWmWB.js → vendor-icons-Cv18Q6rW.js} +72 -67
  79. package/dist/web/assets/{vendor-radix-DBy9B2DN.js → vendor-radix-DXRuAJHH.js} +1 -1
  80. package/dist/web/index.html +4 -4
  81. package/package.json +3 -1
  82. package/dist/chunk-10k6egwk.js +0 -1
  83. package/dist/chunk-17xtw88g.js +0 -1
  84. package/dist/chunk-1kg9r8xp.js +0 -2
  85. package/dist/chunk-383vbwmt.js +0 -4
  86. package/dist/chunk-3kk3bk11.js +0 -1
  87. package/dist/chunk-47dsd91k.js +0 -99
  88. package/dist/chunk-4kaygjqv.js +0 -10
  89. package/dist/chunk-50fq7r0h.js +0 -22
  90. package/dist/chunk-59eje513.js +0 -1
  91. package/dist/chunk-710bvht9.js +0 -160
  92. package/dist/chunk-a9pbpgkg.js +0 -9
  93. package/dist/chunk-c8rky275.js +0 -6
  94. package/dist/chunk-j1sd03h7.js +0 -1
  95. package/dist/chunk-jqyvnmfr.js +0 -187
  96. package/dist/chunk-jrh5tzc4.js +0 -1
  97. package/dist/chunk-kj1ah6kn.js +0 -1
  98. package/dist/chunk-n34z4c47.js +0 -1
  99. package/dist/chunk-n5m2p0bq.js +0 -2
  100. package/dist/chunk-nfmsn652.js +0 -2
  101. package/dist/chunk-qvabd0vg.js +0 -1
  102. package/dist/chunk-t75wspk3.js +0 -1
  103. package/dist/chunk-vddqv6fv.js +0 -1
  104. package/dist/chunk-w4zvftrw.js +0 -5
  105. package/dist/chunk-wa7v7akz.js +0 -3
  106. package/dist/chunk-wxwqz67n.js +0 -1
  107. package/dist/chunk-x9hm3p3a.js +0 -1
  108. package/dist/chunk-xd2g4zjx.js +0 -1
  109. package/dist/web/assets/ChatView-Y-6k-ayR.js +0 -7
  110. package/dist/web/assets/McpModal-BO-85gll.js +0 -5
  111. package/dist/web/assets/SettingsModal-CW87OnxI.js +0 -1
  112. package/dist/web/assets/SkillsModal-Q8ZFPhys.js +0 -1
  113. package/dist/web/assets/TaskSwitcher-BzH-0QXr.js +0 -1
  114. package/dist/web/assets/index-B7etZcne.css +0 -1
  115. package/dist/web/assets/index-ClOgGy-I.js +0 -32
  116. package/dist/web/assets/useRequest-BvqVDnKl.js +0 -1
@@ -1,32 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-CW87OnxI.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-icons-D_AkWmWB.js","assets/vendor-radix-DBy9B2DN.js","assets/McpModal-BO-85gll.js","assets/useRequest-BvqVDnKl.js","assets/SkillsModal-Q8ZFPhys.js","assets/TaskSwitcher-BzH-0QXr.js","assets/FilePreview-CR_XetY0.js","assets/TerminalPanel-DTqvx8yB.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/ChatView-Y-6k-ayR.js"])))=>i.map(i=>d[i]);
2
- var Ny=Object.defineProperty;var $y=(e,t,n)=>t in e?Ny(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ba=(e,t,n)=>$y(e,typeof t!="symbol"?t+"":t,n);import{r as S,j as c,c as Xs,d as Ry}from"./vendor-react-DG5dkZ_t.js";import{S as My,O as pf,P as Oy,C as gf,a as Fy,T as hf,D as bf,R as _y,b as xf,V as Dy,c as Ly,d as kf,e as Uy,f as By,g as yf,h as qy,i as Hy}from"./vendor-radix-DBy9B2DN.js";import{X as to,H as ld,L as ct,F as Ky,R as Bi,A as Sf,a as no,D as wf,b as zy,c as vi,d as Gy,e as ro,G as Hc,T as vf,C as If,f as lo,S as Kc,M as Vy,g as Wy,P as Jy,h as jf,i as zc,j as Cf,k as Gc,l as Qy,m as Yy,n as Xy,o as Tf,p as Zy,q as e0,r as Ef,s as ud,t as t0,u as n0,v as Af,w as r0,I as s0,x as dd,y as hs,z as o0,B as i0,W as fd,E as a0,J as c0,K as l0,N as u0,O as d0,Q as md,U as pd}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 f0="modulepreload",m0=function(e){return"/"+e},gd={},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=m0(l),l in gd)return;gd[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":f0,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 Pf(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=Pf(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Nf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Pf(e))&&(r&&(r+=" "),r+=t);return r}const hd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bd=Nf,p0=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return bd(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=hd(f)||hd(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 bd(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},Vc="-",g0=e=>{const t=b0(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Vc);return a[0]===""&&a.length!==1&&a.shift(),$f(a,t)||h0(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},$f=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?$f(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(Vc);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},xd=/^\[(.+)\]$/,h0=e=>{if(xd.test(e)){const t=xd.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},b0=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return k0(Object.entries(e.classGroups),n).forEach(([o,i])=>{oc(i,r,o,t)}),r},oc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:kd(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(x0(s)){oc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{oc(i,kd(t,o),n,r)})})},kd=(e,t)=>{let n=e;return t.split(Vc).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},x0=e=>e.isThemeGetter,k0=(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,y0=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)}}},Rf="!",S0=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(Rf),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},w0=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},v0=e=>({cache:y0(e.cacheSize),parseClassName:S0(e),...g0(e)}),I0=/\s+/,j0=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(I0);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=w0(f).join(":"),x=p?j+Rf: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 C0(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Mf(t))&&(r&&(r+=" "),r+=n);return r}const Mf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Mf(e[r]))&&(n&&(n+=" "),n+=t);return n};function T0(e,...t){let n,r,s,o=i;function i(l){const u=t.reduce((f,p)=>p(f),e());return n=v0(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=j0(l,n);return s(l,f),f}return function(){return o(C0.apply(null,arguments))}}const Je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Of=/^\[(?:([a-z-]+):)?(.+)\]$/i,E0=/^\d+\/\d+$/,A0=new Set(["px","full","screen"]),P0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,N0=/\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$/,$0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,R0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,M0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dn=e=>Ss(e)||A0.has(e)||E0.test(e),or=e=>Is(e,"length",q0),Ss=e=>!!e&&!Number.isNaN(Number(e)),qa=e=>Is(e,"number",Ss),Vs=e=>!!e&&Number.isInteger(Number(e)),O0=e=>e.endsWith("%")&&Ss(e.slice(0,-1)),le=e=>Of.test(e),ir=e=>P0.test(e),F0=new Set(["length","size","percentage"]),_0=e=>Is(e,F0,Ff),D0=e=>Is(e,"position",Ff),L0=new Set(["image","url"]),U0=e=>Is(e,L0,K0),B0=e=>Is(e,"",H0),Ws=()=>!0,Is=(e,t,n)=>{const r=Of.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},q0=e=>N0.test(e)&&!$0.test(e),Ff=()=>!1,H0=e=>R0.test(e),K0=e=>M0.test(e),z0=()=>{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",le,t],C=()=>[le,t],q=()=>["",Dn,or],K=()=>["auto",Ss,le],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],X=()=>["solid","dashed","dotted","double","none"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ue=()=>["start","end","center","between","around","evenly","stretch"],Ae=()=>["","0",le],D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],se=()=>[Ss,le];return{cacheSize:500,separator:":",theme:{colors:[Ws],spacing:[Dn,or],blur:["none","",ir,le],brightness:se(),borderColor:[e],borderRadius:["none","","full",ir,le],borderSpacing:C(),borderWidth:q(),contrast:se(),grayscale:Ae(),hueRotate:se(),invert:Ae(),gap:C(),gradientColorStops:[e],gradientColorStopPositions:[O0,or],inset:Z(),margin:Z(),opacity:se(),padding:C(),saturate:se(),scale:se(),sepia:Ae(),skew:se(),space:C(),translate:C()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[ir]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"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:[...pe(),le]}],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,le]}],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",le]}],grow:[{grow:Ae()}],shrink:[{shrink:Ae()}],order:[{order:["first","last","none",Vs,le]}],"grid-cols":[{"grid-cols":[Ws]}],"col-start-end":[{col:["auto",{span:["full",Vs,le]},le]}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":[Ws]}],"row-start-end":[{row:["auto",{span:[Vs,le]},le]}],"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",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...Ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ue(),"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",le,t]}],"min-w":[{"min-w":[le,t,"min","max","fit"]}],"max-w":[{"max-w":[le,t,"none","full","min","max","fit","prose",{screen:[ir]},ir]}],h:[{h:[le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ir,or]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qa]}],"font-family":[{font:[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",le]}],"line-clamp":[{"line-clamp":["none",Ss,qa]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Dn,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[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,le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),D0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},U0]}],"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,le]}],"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,B0]}],"shadow-color":[{shadow:[Ws]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":oe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ir,le]}],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",le]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[Vs,le]}],"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",le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Dn,or,qa]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},G0=T0(z0);function W(...e){return G0(Nf(e))}const V0=p0("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?My:"button";return c.jsx(i,{className:W(V0({variant:t,size:n,className:e})),ref:o,...s})});mr.displayName="Button";const Wc=_y,W0=Oy,_f=S.forwardRef(({className:e,...t},n)=>c.jsx(pf,{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}));_f.displayName=pf.displayName;const qi=S.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>c.jsxs(W0,{children:[c.jsx(_f,{}),c.jsxs(gf,{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(Fy,{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=gf.displayName;const Jc=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Jc.displayName="DialogHeader";const Df=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Df.displayName="DialogFooter";const Hi=S.forwardRef(({className:e,...t},n)=>c.jsx(hf,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));Hi.displayName=hf.displayName;const Ki=S.forwardRef(({className:e,...t},n)=>c.jsx(bf,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Ki.displayName=bf.displayName;function ft(e,t){return{...e,...t}}function _r(e,t,n){return e>=t&&e<=n}function J0(e){return e===8205}function Q0(e){return _r(e,55296,56319)}function yd(e){return _r(e,127462,127487)}function Lf(e){return _r(e,65024,65039)}function Uf(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 Sd(e,t){for(;t<e.length;){const n=e.codePointAt(t);if(Uf(n)||Lf(n))t+=hi(n);else break}return t}function Qc(e,t){const n=e.codePointAt(t);let r=t+hi(n);for(r=Sd(e,r);r<e.length-1&&e[r]==="‍";){const s=e.codePointAt(r+1);r+=1+hi(s),r=Sd(e,r)}return yd(n)&&r<e.length&&yd(e.codePointAt(r))&&(r+=hi(e.codePointAt(r))),r}function Bf(e){return Q0(e)||Uf(e)||Lf(e)||J0(e)}function Y0(e){let t=0,n=0;for(;n<e.length;)n=Qc(e,n),t++;return t}function X0(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Qc(e,r),n++,n>=t)return!0;return!1}function Z0(e,t){let n=0,r=0;for(;r<e.length;)if(r=Qc(e,r),n++,n>t)return!1;return!0}function eS(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Bf(e.charCodeAt(n)))return X0(e,t);if(n++,n>=t)return!0}return!1}function tS(e,t){let n=0;for(;n<e.length;){if(Bf(e.charCodeAt(n)))return Z0(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(Me(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 Yc(e){return Number.isInteger(e)}function zt(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")&&!zt(e)}function ae(e){return h(typeof e,"string")}function Xc(e){return h(typeof e,"symbol")}function Me(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 qf(e,t){if(et(e)||et(t))return BigInt(e)%BigInt(t)===0n;const n=1e-10;if(!ve(e)||Yc(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 Hf(e){if(!re(e))return!1;const t=globalThis.Object.getPrototypeOf(e);return zt(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)||zt(e)||ve(e)||ae(e)||Me(e)}function nS(e){return Y0(e)}function Kf(e,t){return tS(e,t)}function zf(e,t){return eS(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 Gf(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function Zc(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 T(e,t){return qn(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function el(e){return L(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tt(e){return Object.entries(e)}function L(e){return Object.getOwnPropertyNames(e)}function tl(e){return Object.getOwnPropertySymbols(e)}function nl(e){return Object.values(e)}function rS(e,t){if(!re(t))return!1;const n=L(e);return h(n.length,L(t).length)&&n.every(r=>Jr(e[r],t[r]))}function sS(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)?sS(e,t):re(e)?rS(e,t):h(e,t)}const Ii=Object.freeze(Object.defineProperty({__proto__:null,Counted:Zc,Entries:tt,EntriesRegExp:el,Every:lt,EveryAll:jt,GraphemeCount:nS,HasPropertyKey:T,IsArray:z,IsBigInt:et,IsBoolean:mt,IsClassInstance:Hf,IsConstructor:zi,IsDeepEqual:Jr,IsEqual:h,IsFunction:kn,IsGreaterEqualThan:js,IsGreaterThan:Wr,IsInteger:Yc,IsLessEqualThan:Jn,IsLessThan:xo,IsMaxLength:Kf,IsMinLength:zf,IsMultipleOf:qf,IsNull:zt,IsNumber:ve,IsObject:re,IsObjectNotArray:cn,IsString:ae,IsSymbol:Xc,IsUndefined:Me,IsUnsafePropertyKey:qn,IsValueLike:Cs,Keys:L,ShiftLeft:Te,Some:Ts,SomeAll:Gf,Symbols:tl,Values:nl},Symbol.toStringTag,{value:"Module"})),oS=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function iS(e){return oS.test(e)}function yt(e,t){return`(${e} && ${t})`}function He(e,t){return`(${e} || ${t})`}function Pt(e){return`!(${e})`}function ji(e){return`Array.isArray(${e})`}function Vf(e){return`typeof ${e} === "bigint"`}function aS(e){return`typeof ${e} === "boolean"`}function cS(e){return`Number.isInteger(${e})`}function lS(e){return`${e} === null`}function Wf(e){return`Number.isFinite(${e})`}function Jf(e){return yt(Qf(e),Pt(ji(e)))}function Qf(e){return`typeof ${e} === "object" && ${e} !== null`}function Yf(e){return`typeof ${e} === "string"`}function uS(e){return`typeof ${e} === "symbol"`}function ic(e){return`${e} === undefined`}function dS(e){return`typeof ${e} === "function"`}function fS(e){return`Guard.IsConstructor(${e})`}function Kt(e,t){return`${e} === ${t}`}function Xf(e,t){return`${e} > ${t}`}function rl(e,t){return`${e} < ${t}`}function Qr(e,t){return`${e} <= ${t}`}function ko(e,t){return`${e} >= ${t}`}function mS(e,t){return`Guard.IsMinLength(${e}, ${t})`}function pS(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 gS(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function hS(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 Zf(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 em(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function bS(e){return`[${e.join(", ")}]`}function gr(e,t){return`((${e.join(", ")}) => ${t})`}function ze(e,t){return`${e}(${t.join(", ")})`}function sl(e,t){return`new ${e}(${t.join(", ")})`}function ue(e,t){return`${e}${iS(t)?`.${t}`:`[${G(t)}]`}`}function G(e){if(!Cs(e))throw Error("Unsupported Constant");return ae(e)?JSON.stringify(e):`${e}`}function xS(e,t,n){return`(${e} ? ${t} : ${n})`}function Vi(e){return`{ ${e.join("; ")}; }`}function Hn(e,t){return`const ${e} = ${t}`}function tm(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 ol(e){return h(e.length,0)?"false":e.reduce((t,n)=>He(t,n))}function kS(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function yS(e){return e instanceof Boolean}function SS(e){return e instanceof Number}function wS(e){return e instanceof String}function yo(e){return globalThis.ArrayBuffer.isView(e)}function nm(e){return e instanceof globalThis.RegExp}function rm(e){return e instanceof globalThis.Date}function sm(e){return e instanceof globalThis.Set}function om(e){return e instanceof globalThis.Map}function vS(e){return T(e,"~kind")||T(e,"~unsafe")}function IS(e){const t={},n=Object.getOwnPropertyDescriptors(e);for(const r of Object.keys(n)){if(qn(r))continue;const s=n[r];T(s,"value")&&Object.defineProperty(t,r,{...s,value:qr(s.value)})}return t}function jS(e){const t={};for(const n of L(e))qn(n)||(t[n]=qr(e[n]));for(const n of tl(e))t[n]=qr(e[n]);return t}function CS(e){return Hf(e)?e:vS(e)?IS(e):jS(e)}function TS(e){return e.map(t=>qr(t))}function ES(e){return e.slice()}function AS(e){return new RegExp(e.source,e.flags)}function PS(e){return new Map(qr([...e.entries()]))}function NS(e){return new Set(qr([...e.values()]))}function qr(e){return yo(e)?ES(e):nm(e)?AS(e):om(e)?PS(e):sm(e)?NS(e):z(e)?TS(e):re(e)?CS(e):e}function il(e){return qr(e)}const $S={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function So(){return $S}function RS(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 MS(e,t){return{...e,...t}}function ye(e,t,n={}){const r=MS(t,n);return RS(r,e)}function jn(e,t){const n={},r=Object.getOwnPropertyDescriptors(il(e)),s=new Set(t);for(const o of Object.keys(r))s.has(o)||Object.defineProperty(n,o,r[o]);return n}function de(e,t,n){const r=So(),s=il(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)&&T(e,"~kind")&&h(e["~kind"],t)}function Wt(e){return re(e)}function Ee(e,t,n){return ye({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ws(e){return Ie(e,"Deferred")}function OS(e){return de(e,{"~readonly":!0},{})}function al(e,t){return de(OS(e),{},t)}function FS(e,t,n,r){const s=V(e,t,n);return al(s,r)}function _S(e){return de(e,{"~optional":!0},{})}function cl(e,t){return de(_S(e),{},t)}function DS(e,t,n,r){const s=V(e,t,n);return cl(s,r)}function Sr(e,t){return ye({"~kind":"Array"},{type:"array",items:e},t)}function ut(e){return Ie(e,"Array")}function ll(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 LS(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 US(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 ul(e){return Ie(e,"Generic")}function dl(e){return ye({"~kind":"Any"},{},e)}function Cn(e){return Ie(e,"Any")}const BS="(?!)";function Ct(e){return ye({"~kind":"Never"},{not:{}},e)}function Es(e){return Ie(e,"Never")}function Gn(e,t={}){return Ee("AddOptional",[e],t)}function Ci(e,t={}){return cl(e,t)}function qS(e){return Ci(e)}function Jt(e){return Wt(e)&&T(e,"~optional")}function HS(e){return L(e).filter(t=>!Jt(e[t]))}function im(e){return L(e)}function am(e){return nl(e)}function Ne(e,t={}){const n=HS(e),r=n.length>0?{required:n}:{};return ye({"~kind":"Object"},{type:"object",...r,properties:e},t)}function De(e){return Ie(e,"Object")}function KS(e){return jn(e,["~kind","type","properties","required"])}function Dt(e){return ye({"~kind":"Unknown"},{},e)}function yn(e){return Ie(e,"Unknown")}function jo(e,t,n){const r=L(e).reduce((s,o)=>({...s,[o]:de(e[o],{},{$id:o})}),{});return ye({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function Lt(e){return Ie(e,"Cyclic")}function zS(e){return de(e,{"~unsafe":null},{})}function cm(e){return cn(e)&&T(e,"~unsafe")&&zt(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 ac(...e){const[t,n]=at(e,{2:(r,s)=>[r,s,s],1:r=>[r,Dt(),Dt()]});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 GS(e){return jn(e,["~kind","if","then","else"])}function VS(e){return cn(e)}function WS(e){return L(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function JS(e){return ae(e)||ve(e)}function QS(e,t){const n=VS(e)?WS(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 Le(e){return Ie(e,"Intersect")}function YS(e){return jn(e,["~kind","allOf"])}let Ha;function XS(){try{return um("null")(),!0}catch{return!1}}function lm(){return Me(Ha)&&(Ha=XS()),Ha&&So().useAcceleration}function um(...e){return new globalThis.Function(...e)}function Nt(){throw new Error("Unreachable")}function ZS(e){const t=new Set;let n=e;for(;n&&n!==Object.prototype;){for(const r of Reflect.ownKeys(n))r!=="constructor"&&typeof r!="symbol"&&t.add(r);n=Object.getPrototypeOf(n)}return[...t]}function ew(e){return typeof e=="number"}var $t;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})($t||($t={}));let xs=BigInt("14695981039346656037");const[tw,nw]=[BigInt("1099511628211"),BigInt("18446744073709551616")],rw=Array.from({length:256}).map((e,t)=>BigInt(t)),dm=new Float64Array(1),fm=new DataView(dm.buffer),mm=new Uint8Array(dm.buffer);function bt(e){xs=xs^rw[e],xs=xs*tw%nw}function sw(e){bt($t.Array);for(const t of e)hr(t)}function ow(e){bt($t.BigInt),fm.setBigInt64(0,e);for(const t of mm)bt(t)}function wd(e){bt($t.Boolean),bt(e?1:0)}function iw(e){bt($t.Constructor),hr(e.toString())}function aw(e){bt($t.Date),hr(e.getTime())}function cw(e){bt($t.Function),hr(e.toString())}function lw(e){bt($t.Null)}function vd(e){bt($t.Number),fm.setFloat64(0,e,!0);for(const t of mm)bt(t)}function uw(e){bt($t.Object);for(const t of ZS(e).sort())hr(t),hr(e[t])}function dw(e){bt($t.RegExp),cc(e.toString())}const fw=new TextEncoder;function cc(e){bt($t.String);for(const t of fw.encode(e))bt(t)}function mw(e){bt($t.Symbol),hr(e.toString())}function pw(e){bt($t.TypeArray);const t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)bt(t[n])}function gw(e){return bt($t.Undefined)}function hr(e){return yo(e)?pw(e):rm(e)?aw(e):nm(e)?dw(e):yS(e)?wd(e.valueOf()):wS(e)?cc(e.valueOf()):SS(e)?vd(e.valueOf()):ew(e)?vd(e):z(e)?sw(e):mt(e)?wd(e):et(e)?ow(e):zi(e)?iw(e):zt(e)?lw():re(e)?uw(e):ae(e)?cc(e):Xc(e)?mw(e):Me(e)?gw():kn(e)?cw(e):Nt()}function pm(e){return xs=BigInt("14695981039346656037"),hr(e),xs}function Ji(e){return pm(e).toString(16).padStart(16,"0")}const hw=Object.freeze(Object.defineProperty({__proto__:null,Hash:Ji,HashCode:pm},Symbol.toStringTag,{value:"Module"}));function bw(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 xw=bw;function kw(){return xw}class gm{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 de(this.type,{"~codec":o},{})}}class hm{constructor(t){this.type=t}Decode(t){return new gm(this.type,t)}}function fl(e){return new hm(e)}function yw(e,t){return fl(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Sw(e,t){return fl(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Yt(e){return Wt(e)&&T(e,"~codec")&&re(e["~codec"])&&T(e["~codec"],"encode")&&T(e["~codec"],"decode")}function ww(e){return eu(e)}function Ei(e){return Wt(e)&&T(e,"~immutable")}function Vn(e,t={}){return Ee("AddReadonly",[e],t)}function Ai(e,t={}){return al(e,t)}function vw(e){return Ai(e)}function Pi(e){return Wt(e)&&T(e,"~readonly")}function Iw(e,t){const n=ml(e)?[...e["~refine"],t]:[t];return de(e,{"~refine":n},{})}function jw(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,()=>"Refine Error"]});return Iw(t,{check:n,error:r})}function Cw(e){return cn(e)&&T(e,"check")&&T(e,"error")&&kn(e.check)&&kn(e.error)}function ml(e){return Wt(e)&&T(e,"~refine")&&z(e["~refine"])&&lt(e["~refine"],0,t=>Cw(t))}const Tw="-?(?:0|[1-9][0-9]*)n";function pl(e){return ye({"~kind":"BigInt"},{type:"bigint"},e)}function Xr(e){return Ie(e,"BigInt")}function bm(e){return ye({"~kind":"Boolean"},{type:"boolean"},e)}function wr(e){return Ie(e,"Boolean")}function lc(e){return ye({"~kind":"Identifier"},{name:e})}function Ew(e){return Ie(e,"Identifier")}const xm="-?(?:0|[1-9][0-9]*)";function Qi(e){return ye({"~kind":"Integer"},{type:"integer"},e)}function $n(e){return Ie(e,"Integer")}class Aw extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function Pw(e){return et(e)?"bigint":mt(e)?"boolean":ve(e)?"number":ae(e)?"string":(()=>{throw new Aw(e)})()}function Fe(e,t){return ye({"~kind":"Literal"},{type:Pw(e),const:e},t)}function km(e){return et(e)||mt(e)||ve(e)||ae(e)}function Nw(e){return Ve(e)&&et(e.const)}function $w(e){return Ve(e)&&mt(e.const)}function ym(e){return Ve(e)&&ve(e.const)}function Sm(e){return Ve(e)&&ae(e.const)}function Ve(e){return Ie(e,"Literal")}function gl(e){return ye({"~kind":"Null"},{type:"null"},e)}function Co(e){return Ie(e,"Null")}const wm="-?(?: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 hl(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,Dt(),Dt()]});return ye({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function Rw(e){return Ie(e,"Parameter")}const vm=".*";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 ce(e){return Ie(e,"Union")}function Mw(e){return jn(e,["~kind","anyOf"])}function Im(e){const t=bT(e);return h(t.length,2)?t[0]:[]}function Ow(e){return!0}function jm(e){return Te(e,(t,n)=>Fw(t)?jm(n):!1,()=>!0)}function Cm(e){return h(e.length,0)?!1:jm(e)}function Fw(e){return ce(e)?Cm(e.anyOf):Ve(e)?Ow(e.const):!1}function Tm(e){return Cm(e)}function Em(e){return ye({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Am(e,t,n=[]){return Te(e,(r,s)=>Am(s,t,[...n,`${r}${t}`]),()=>n)}function _w(e,t){return h(e.length,0)?[`${t}`]:Am(e,t)}function Pm(e,t,n=[]){return Te(t,(r,s)=>Pm(e,s,[...n,...Nm(e,r)]),()=>n)}function Nm(e,t){return ce(t)?Pm(e,t.anyOf):Ve(t)?_w(e,t.const):Nt()}function $m(e,t){return Te(t,(n,r)=>$m(Nm(e,n),r),()=>e)}function Dw(e){return e.map(t=>Fe(t))}function Lw(e){const t=$m([],e),n=Dw(t);return Ge(n)}function Uw(e){return h(e.length,0)?Nt():h(e.length,1)&&Ve(e[0])?e[0]:Lw(e)}function Rm(e){const t=Im(e);return h(t.length,0)?Rn():Tm(t)?Uw(t):Em(e)}function bl(e){const t=Rm(e);return Bt(t)?Rn():t}function xr(e,t){const n="object",r={[e]:t};return ye({"~kind":"Record"},{type:n,patternProperties:r})}function Bw(e){return xr(Kr,e)}function qw(e){return Ne({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 Hw(e){return jn(e,["~kind","type","items","minItems","additionalItems"])}function Kw(e){return jn(e,["~readonly"])}function Mm(e,t){return de(Kw(e),{},t)}function zw(e,t,n,r){const s=V(e,t,n);return Mm(s,r)}function Gw(e,t={}){return Ee("RemoveReadonly",[e],t)}function Vw(e,t={}){return Mm(e,t)}function Ww(e){return jn(e,["~optional"])}function Om(e,t){return de(Ww(e),{},t)}function Jw(e,t,n,r){const s=V(e,t,n);return Om(s,r)}function Qw(e,t={}){return Ee("RemoveOptional",[e],t)}function Fm(e,t={}){return Om(e,t)}function _m(e){return e.reduceRight((n,r,s)=>({[s]:r,...n}),{})}function Yw(e){const t=_m(e.items);return Ne(t)}function Xw(e,t){return Pi(e)?!!Pi(t):!1}function Zw(e,t){return Jt(e)?!!Jt(t):!1}function ev(e,t){const n=Xw(e,t),r=Zw(e,t),s=en([e,t]),o=Vw(Fm(s));return n&&r?Ai(Ci(o)):n&&!r?Ai(o):!n&&r?Ci(o):o}function tv(e,t,n){return n in e?n in t?ev(e[n],t[n]):e[n]:n in t?t[n]:Ct()}function nv(e,t){return[...new Set([...L(t),...L(e)])].reduce((r,s)=>({...r,[s]:tv(e,t,s)}),{})}function Id(e){return De(e)?e.properties:rt(e)?_m(e.items):Nt()}function rv(e,t){const n=Id(e),r=Id(t),s=nv(n,r);return Ne(s)}function sv(e,t){const n=ia(e,t);return h(n,Bl)?e:h(n,ql)||h(n,Ul)?t:Ct()}function jd(e){return De(e)||rt(e)}function ov(e,t){const n=ce(e),r=ce(t);return n||r}function iv(e,t){const n=Hr(e),r=Hr(t),s=ov(n,r),o=jd(n),i=jd(r);return s?en([n,r]):o&&i?rv(n,r):o&&!i?n:!o&&i?r:sv(n,r)}function Dm(e,t,n=[]){return Te(t,(r,s)=>Dm(e,s,[...n,iv(e,r)]),()=>h(n.length,0)?[e]:n)}function Lm(e,t,n=[]){return Te(e,(r,s)=>Lm(s,t,[...n,...Ni([r],t)]),()=>n)}function Ni(e,t=[]){return Te(e,(n,r)=>ce(n)?Ni(r,Lm(n.anyOf,t)):Ni(r,Dm(n,t)),()=>t)}function av(e,t){const n=Wn({},e,t);return Ht(n)?[]:[e]}function cv(e,t){return e.reduce((n,r)=>[...n,...av(r,t)],[])}function Um(e,t){const n=Hr(e),r=ce(n)?n.anyOf:[n],s=cv(r,t);return Yn(s)}function As(e,t,n){const r=Pn([e,t]),s=Um(n,e);return Yn([r,s])}function vr(e){const t=e.map(n=>Fe(n));return Yn(t)}function en(e){const t=Ni(e),n=sg(t);return Ps(n)}function Qn(e){const t=bl(e);return Hr(t)}function Yn(e){const t=sg(e);return Ps(t)}function Hr(e){return dn(e)?As(e.if,e.then,e.else):fn(e)?vr(e.enum):Le(e)?en(e.allOf):Bt(e)?Qn(e.pattern):ce(e)?Yn(e.anyOf):e}function Ps(e){return h(e.length,1)?e[0]:h(e.length,0)?Ct():Ge(e)}function lv(e,t){const n=vr(e);return Xi(n,t)}function uv(e,t){return xr(Ao,t)}function dv(e,t){const n=en(e);return Xi(n,t)}function fv(e,t){return ae(e)||ve(e)?Ne({[e]:t}):h(e,!1)?Ne({false:t}):h(e,!0)?Ne({true:t}):Ne({})}function mv(e,t){return xr(Zi,t)}function pv(e,t){return T(e,"pattern")&&(ae(e.pattern)||e.pattern instanceof RegExp)?xr(e.pattern.toString(),t):xr(Kr,t)}function gv(e,t){const n=Im(e);return Tm(n)?Xi(Qn(e),t):xr(e,t)}function hv(e){return ce(e)?Yi(e.anyOf):[e]}function Yi(e){return e.reduce((t,n)=>[...t,...hv(n)],[])}function bv(e){return e.some(t=>Tn(t)||Zt(t)||$n(t))}function xv(e,t){return h(bv(e),!0)?xr(Kr,t):void 0}function kv(e,t){return e.reduce((n,r)=>Ve(r)&&(ae(r.const)||ve(r.const))?{...n,[r.const]:t}:n,{})}function yv(e,t){const n=kv(e,t);return Ne(n)}function Sv(e,t){const n=Yi(e),r=xv(n,t);return Wt(r)?r:yv(n,t)}function Xi(e,t){return Cn(e)?Bw(t):wr(e)?qw(t):fn(e)?lv(e.enum,t):$n(e)?uv(e,t):Le(e)?dv(e.allOf,t):Ve(e)?fv(e.const,t):Zt(e)?mv(e,t):ce(e)?Sv(e.anyOf,t):Tn(e)?pv(e,t):Bt(e)?gv(e.pattern,t):Ne({})}function Bm(e,t,n){return Ye([e])?de(Xi(e,t),{},n):qm(e,t,n)}function wv(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Bm(o,i,s)}const Ao=`^${xm}$`,Zi=`^${wm}$`,Kr=`^${vm}$`;function qm(e,t,n={}){return Ee("Record",[e,t],n)}function xl(e,t,n={}){return Bm(e,t,n)}function vv(e,t){return xr(e,t)}function uc(e){return h(e,Kr)?Rn():h(e,Ao)?Qi():h(e,Zi)?br():Rm(e)}function pn(e){return L(e.patternProperties)[0]}function ea(e){const t=pn(e);return uc(t)}function Ut(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 Hm(e){return ye({"~kind":"This"},{$ref:"#"},e)}function Km(e){return Ie(e,"This")}function kl(e){return ye({"~kind":"Undefined"},{type:"undefined"},e)}function Ns(e){return Ie(e,"Undefined")}function zm(e){return ye({"~kind":"Void"},{type:"void"},e)}function Zr(e){return Ie(e,"Void")}function Iv(e,t){return h(e,"Array")?Sr(t[0]):h(e,"Capitalize")?lg(t[0]):h(e,"ConstructorParameters")?kg(t[0]):h(e,"Evaluate")?bN(t[0]):h(e,"Exclude")?Sg(t[0],t[1]):h(e,"Extract")?wg(t[0],t[1]):h(e,"Index")?Vl(t[0],t[1]):h(e,"InstanceType")?Ag(t[0]):h(e,"Lowercase")?ug(t[0]):h(e,"NonNullable")?Mg(t[0]):h(e,"Omit")?Fg(t[0],t[1]):h(e,"Parameters")?Lg(t[0]):h(e,"Partial")?Bg(t[0]):h(e,"Pick")?Hg(t[0],t[1]):h(e,"Readonly")?zg(t[0]):h(e,"KeyOf")?Yl(t[0]):h(e,"Record")?qm(t[0],t[1]):h(e,"Required")?Wg(t[0]):h(e,"ReturnType")?Qg(t[0]):h(e,"Uncapitalize")?dg(t[0]):h(e,"Uppercase")?fg(t[0]):yc(on(e),t)}function es(){throw Error("Unreachable")}function Gm(e,t=[]){return Te(e,(n,r)=>Gm(r,[...t,n[1]]),()=>t)}function Xn(e){return h(e.length,3)?[e[0],...Gm(e[1])]:[]}function jv(e){return Eo(e[0],e[2],e[4])}function Cv(e){return Eo(e[0],e[2],e[2])}function Tv(e){return Eo(e[0],Dt(),e[2])}function Ev(e){return Eo(e,Dt(),Dt())}function Av(e){return Xn(e)}function Pv(e){return e[1]}function Nv(e){return Xn(e)}function $v(e){return e[1]}function Rv(e){return Iv(e[0],e[1])}function Mv(e){return null}function Ov(e){return Rn()}function Fv(e){return br()}function _v(e){return bm()}function Dv(e){return kl()}function Lv(e){return gl()}function Uv(e){return Qi()}function Bv(e){return pl()}function qv(e){return Dt()}function Hv(e){return dl()}function Kv(e){return Ne({})}function zv(e){return Ct()}function Gv(e){return hl()}function Vv(e){return zm()}function Wv(e){return Hm()}function Jv(e){return Fe(BigInt(e))}function Qv(e){return Fe(h(e,"true"))}function Yv(e){return Fe(parseFloat(e))}function Xv(e){return Fe(e)}function Zv(e){return e[1]}function eI(e){return Fe(e)}function tI(e){return h(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function nI(e){return e[1]}function rI(e){return Hp(e)}function sI(e){return h(e.length,6)?Ti(e[1],e[3],e[5]):Ti(e[1],e[3],Dt())}function oI(e){return e.length>0}function iI(e){return e.reduce((t,n)=>h(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function aI(e){return h(e.length,6)?[e[1],e[3],e[5]]:[]}function cI(e){return z(e)&&h(e.length,3)?e[1]:e}function lI(e){return h(e.length,2)?e[1]:[]}function Cd(e,t){return t.reduce((n,r)=>{const s=r;return h(s.length,1)?Vl(n,s[0]):h(s.length,0)?Sr(n):es()},e)}function Td(e,t){return h(t.length,3)?bg(e,t[0],t[1],t[2]):e}function uI(e,t){return z(t)&&h(t.length,0)?e:Xg(e,t)}function dI(e){const[t,n,r,s,o]=e;return uI(Td(t?Yl(Cd(n,r)):Cd(n,r),s),o)}function yl(e,t){return h(t.length,3)?(()=>{const[n,r,s]=t,o=yl(r,s);if(h(n,"&"))return Le(o)?Pn([e,...o.allOf]):Pn([e,o]);if(h(n,"|"))return ce(o)?Ge([e,...o.anyOf]):Ge([e,o]);es()})():e}function fI(e){const[t,n]=e;return yl(t,n)}function mI(e){const[t,n]=e;return yl(t,n)}function pI(e){return hN(e[1])}function gI(e){return e[1]}function hI(e){return Io(e[0],e[2])}function bI(e){return h(e.length,4)?ac(e[1],e[3]):h(e.length,2)?ac(e[1],Dt()):es()}function xI(e){return`${e}`}function kI(e){return $n(e[3])?Ao:Zt(e[3])?Zi:To(e[3])||Tn(e[3])?Kr:es()}function yI(e){return e.length>0}function SI(e){return e.length>0}function wI(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 vI(e){return Xn(e)}function Vm(e){return e.reduce((t,n)=>T(n,Ao)||T(n,Zi)||T(n,Kr)?[t[0],ft(t[1],n)]:[ft(t[0],n),t[1]],[{},{}])}function II(e){return Vm(e[1])}function jI(e){const[t,n]=e,r=h(L(n).length,0)?{}:{patternProperties:n};return Ne(t,r)}function CI(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 TI(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 EI(e){return h(e.length,2)?ta(e[1]):h(e.length,1)?e[0]:es()}function AI(e){return Xn(e)}function PI(e){return mn(e[1])}function NI(e){return Vn(Gn(e[4]))}function $I(e){return Vn(e[3])}function RI(e){return Gn(e[3])}function MI(e){return e[2]}function OI(e){return h(e.length,2)?ta(e[1]):h(e.length,1)?e[0]:es()}function FI(e){return Xn(e)}function _I(e){return vo(e[1],e[4])}function DI(e){return wo(e[2],e[5])}function Ed(e,t){return h(e,"remove")?Gw(t):h(e,"add")?Vn(t):t}function LI(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function Ad(e,t){return h(e,"remove")?Qw(t):h(e,"add")?Gn(t):t}function UI(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function BI(e){return h(e.length,2)?[e[1]]:[]}function qI(e){return z(e[6])&&h(e[6].length,1)?Sc(lc(e[3]),e[5],e[6][0],Ed(e[1],Ad(e[8],e[10]))):Sc(lc(e[3]),e[5],on(e[3]),Ed(e[1],Ad(e[8],e[10])))}function HI(e){return on(e)}function KI(e){return BigInt(e)}function zI(e){return parseFloat(e)}function GI(e){return h(e,"true")}function VI(e){return null}function WI(e){return{[e[0]]:e[2]}}function JI(e){return Xn(e)}function QI(e){return e.reduce((t,n)=>ft(t,n),{})}function YI(e){return QI(e[1])}function XI(e){return Xn(e)}function ZI(e){return e[1]}function ej(e){return pl()}function tj(e){return Rn()}function nj(e){return br()}function rj(e){return Qi()}function sj(e){return Ct()}function oj(e){return Fe(e)}function ij(e){return Ge(e[1])}function aj(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function cj(e){return[e[0],...e[1]]}function lj(e){return e[1]}function uj(e){return Xn(e)}function dj(e){return h(e.length,2)?e[1]:[]}function fj(e){const t=e[2],n=e[3],[r,s]=e[4],o=h(L(s).length,0)?{}:{patternProperties:s};return{[e[1]]:Io(t,Dl(n,r,o))}}function mj(e){const t=e[2],[n,r]=e[3],s=h(L(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Dl(t,n,s)}}function pj(e){return{[e[1]]:Io(e[2],e[4])}}function gj(e){return{[e[1]]:e[3]}}function hj(e){return null}function bj(e){return Xn(e)}function xj(e){return e[1]}function kj(e){const[t,n]=[e[0],e[1]];return xN(ft(t,Vm(n)[0]))}function Sl(e){return h(e.length,2)}function Oe(e,t,n){return Sl(e)?t(e[0],e[1]):n()}function yj(e,t){return h(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Rt(e,t){for(let n=0;n<e.length;n++){const r=yj(e[n],t);if(Sl(r))return r}return[]}function dc(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}const Sj=[...dc(97,122),...dc(65,90)],Wm="0",Jm=dc(49,57),wl=[Wm,...Jm],wj=" ",vl=`
3
- `,Po="_",Il=".",vj="$",Qm="-",Ym="//",Xm="/*",Ij="*/";function Zm(e){const t=e.indexOf(Ij);return h(t,-1)?"":e.slice(t+2)}function ep(e){const t=e.indexOf(vl);return h(t,-1)?"":e.slice(t)}function jj(e){return e.replace(/^[ \t\r\f\v]+/,"")}function fc(e){const t=jj(e);return t.startsWith(Xm)?fc(Zm(t.slice(2))):t.startsWith(Ym)?fc(ep(t.slice(2))):t}function Sn(e){const t=e.trimStart();return t.startsWith(Xm)?Sn(Zm(t.slice(2))):t.startsWith(Ym)?Sn(ep(t.slice(2))):t}function tp(e,t){return Oe(Rt([e],t),(n,r)=>[n,r],()=>["",t])}function Cj(e,t){return e.includes(t)}function $i(e,t,n,r=""){return Oe(Rt(e,n),(s,o)=>Cj(t,s)?$i(e,t,o,r):$i(e,t,o,`${r}${s}`),()=>[r,n])}function Tj(e){return Rt(Jm,e)}const Ej=[...wl,Po];function Aj(e){return $i(Ej,[Po],e)}function Pj(e){return Oe(Rt([Wm],e),(t,n)=>[t,n],()=>Oe(Tj(e),(t,n)=>Oe(Aj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[]))}function np(e){return Pj(Sn(e))}function Nj(e){return tp(Qm,e)}function $j(e){return Oe(Nj(e),(t,n)=>Oe(np(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Rj(e){return $j(Sn(e))}function Mj(e){return Oe(Rj(e),(t,n)=>Oe(Rt(["n"],n),(r,s)=>[`${t}`,s],()=>[]),()=>[])}function rp(e){return Mj(e)}function Ka(e,t){return Rt([e],t)}function w(e,t){return h(e,"")?["",t]:e.startsWith(vl)?Ka(e,fc(t)):e.startsWith(wj)?Ka(e,t):Ka(e,Sn(t))}const sp=[...Sj,Po,vj];function Oj(e){return Rt(sp,e)}const Fj=[...sp,...wl];function op(e,t=""){return Oe(Rt(Fj,e),(n,r)=>op(r,`${t}${n}`),()=>[t,e])}function _j(e){return Oe(Oj(e),(t,n)=>Oe(op(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Ze(e){return _j(Sn(e))}const Dj=[...wl,Po];function Lj(e){return Sl(Rt([Il],e))}function ip(e){return Oe($i(Dj,[Po],e),(t,n)=>h(t,"")?[]:[t,n],()=>[])}function Uj(e){return Oe(Rt([Il],e),(t,n)=>Oe(ip(n),(r,s)=>[`0${t}${r}`,s],()=>[]),()=>[])}function Bj(e){return Oe(np(e),(t,n)=>Oe(Rt([Il],n),(r,s)=>Oe(ip(s),(o,i)=>[`${t}${r}${o}`,i],()=>[`${t}`,s]),()=>[`${t}`,n]),()=>[])}function qj(e){return Lj(e)?Uj(e):Bj(e)}function Hj(e){return qj(Sn(e))}function Kj(e){return tp(Qm,e)}function zj(e){return Oe(Kj(e),(t,n)=>Oe(Hj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function jl(e){return zj(Sn(e))}function Gj(e){return h(e,"")?[]:[e.slice(0,1),e.slice(1)]}function ap(e,t){return Te(e,(n,r)=>t.startsWith(n)?!0:ap(r,t),()=>!1)}function No(e,t,n=""){return Oe(Gj(t),(r,s)=>ap(e,t)?[n,t]:No(e,s,`${n}${r}`),()=>[])}function Vj(e,t,n){return Oe(Rt([e],n),(r,s)=>Oe(No([t],s),(o,i)=>Oe(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function Wj(e,t,n){return Oe(Rt([e],n),(r,s)=>Oe(No([vl,t],s),(o,i)=>Oe(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function Jj(e,t,n,r){return n?Vj(e,t,Sn(r)):Wj(e,t,Sn(r))}function Qj(e,t){return Rt(e,t)}function Yj(e,t){return Jj(e,e,!1,t)}function Xj(e,t){return Oe(Qj(e,t),(n,r)=>Yj(n,`${n}${r}`),()=>[])}function Cl(e,t){return Xj(e,Sn(t))}function Zj(e,t){return Oe(No(e,t),(n,r)=>h(n,"")?[]:[n,r],()=>[])}const d=(e,t,n=()=>[])=>e.length===2?t(e):n(),eC=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])=>[jv(t),n]),tC=e=>d(d(Ze(e),([t,n])=>d(w("extends",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Cv(t),n]),nC=e=>d(d(Ze(e),([t,n])=>d(w("=",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Tv(t),n]),rC=e=>d(Ze(e),([t,n])=>[Ev(t),n]),cp=e=>d(d(eC(e),([t,n])=>[t,n],()=>d(tC(e),([t,n])=>[t,n],()=>d(nC(e),([t,n])=>[t,n],()=>d(rC(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),lp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(cp(r),([s,o])=>[[n,s],o])),([n,r])=>lp(r,[...t,n]),()=>[t,e]),sC=e=>d(d(d(cp(e),([t,n])=>d(lp(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]),Tl=e=>d(d(w("<",e),([t,n])=>d(sC(n),([r,s])=>d(w(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Pv(t),n]),up=(e,t=[])=>d(d(w(",",e),([n,r])=>d(ke(r),([s,o])=>[[n,s],o])),([n,r])=>up(r,[...t,n]),()=>[t,e]),oC=e=>d(d(d(ke(e),([t,n])=>d(up(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])=>[Nv(t),n]),iC=e=>d(d(w("<",e),([t,n])=>d(oC(n),([r,s])=>d(w(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[$v(t),n]),aC=e=>d(d(Ze(e),([t,n])=>d(iC(n),([r,s])=>[[t,r],s])),([t,n])=>[Rv(t),n]),dp=e=>d(d(d(w(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Mv(),n]),fp=e=>d(w("string",e),([t,n])=>[Ov(),n]),mp=e=>d(w("number",e),([t,n])=>[Fv(),n]),cC=e=>d(w("boolean",e),([t,n])=>[_v(),n]),lC=e=>d(w("undefined",e),([t,n])=>[Dv(),n]),uC=e=>d(w("null",e),([t,n])=>[Lv(),n]),pp=e=>d(w("integer",e),([t,n])=>[Uv(),n]),dC=e=>d(w("bigint",e),([t,n])=>[Bv(),n]),fC=e=>d(w("unknown",e),([t,n])=>[qv(),n]),mC=e=>d(w("any",e),([t,n])=>[Hv(),n]),pC=e=>d(w("object",e),([t,n])=>[Kv(),n]),gC=e=>d(w("never",e),([t,n])=>[zv(),n]),gp=e=>d(w("symbol",e),([t,n])=>[Gv(),n]),hC=e=>d(w("void",e),([t,n])=>[Vv(),n]),bC=e=>d(w("this",e),([t,n])=>[Wv(),n]),xC=e=>d(d(w("${",e),([t,n])=>d(ke(n),([r,s])=>d(w("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Zv(t),n]),za=e=>d(No(["${","`"],e),([t,n])=>[eI(t),n]),hp=e=>d(d(d(za(e),([t,n])=>d(xC(n),([r,s])=>d(hp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(d(za(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(za(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[tI(t),n]),bp=e=>d(d(w("`",e),([t,n])=>d(hp(n),([r,s])=>d(w("`",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[nI(t),n]),kC=e=>d(bp(e),([t,n])=>[rI(t),n]),yC=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])=>[sI(t),n]),SC=e=>d(rp(e),([t,n])=>[Jv(t),n]),wC=e=>d(d(w("true",e),([t,n])=>[t,n],()=>d(w("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Qv(t),n]),vC=e=>d(jl(e),([t,n])=>[Yv(t),n]),IC=e=>d(Cl(["'",'"'],e),([t,n])=>[Xv(t),n]),jC=e=>d(d(d(w("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[oI(t),n]),xp=(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])=>xp(r,[...t,n]),()=>[t,e]),CC=e=>d(xp(e),([t,n])=>[iI(t),n]),TC=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])=>[aI(t),n]),EC=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(fp(e),([t,n])=>[t,n],()=>d(mp(e),([t,n])=>[t,n],()=>d(cC(e),([t,n])=>[t,n],()=>d(lC(e),([t,n])=>[t,n],()=>d(uC(e),([t,n])=>[t,n],()=>d(pp(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(pC(e),([t,n])=>[t,n],()=>d(gC(e),([t,n])=>[t,n],()=>d(gp(e),([t,n])=>[t,n],()=>d(hC(e),([t,n])=>[t,n],()=>d(bC(e),([t,n])=>[t,n],()=>d(SC(e),([t,n])=>[t,n],()=>d(wC(e),([t,n])=>[t,n],()=>d(vC(e),([t,n])=>[t,n],()=>d(IC(e),([t,n])=>[t,n],()=>d(kC(e),([t,n])=>[t,n],()=>d(yC(e),([t,n])=>[t,n],()=>d(LC(e),([t,n])=>[t,n],()=>d(qC(e),([t,n])=>[t,n],()=>d(WC(e),([t,n])=>[t,n],()=>d(VC(e),([t,n])=>[t,n],()=>d(XC(e),([t,n])=>[t,n],()=>d(aC(e),([t,n])=>[t,n],()=>d(ZC(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[cI(t),n]),AC=e=>d(d(d(w("with",e),([t,n])=>d(Op(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[lI(t),n]),kp=e=>d(d(jC(e),([t,n])=>d(EC(n),([r,s])=>d(CC(s),([o,i])=>d(TC(i),([a,l])=>d(AC(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[dI(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]),Sp=e=>d(d(kp(e),([t,n])=>d(yp(n),([r,s])=>[[t,r],s])),([t,n])=>[fI(t),n]),wp=e=>d(d(d(w("|",e),([t,n])=>d(Sp(n),([r,s])=>d(wp(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(Sp(e),([t,n])=>d(wp(n),([r,s])=>[[t,r],s])),([t,n])=>[mI(t),n]),PC=e=>d(d(w("readonly",e),([t,n])=>d(ra(n),([r,s])=>[[t,r],s])),([t,n])=>[pI(t),n]),NC=e=>d(d(w("|",e),([t,n])=>d(ra(n),([r,s])=>[[t,r],s])),([t,n])=>[gI(t),n]),$C=e=>d(d(Tl(e),([t,n])=>d(w("=",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[hI(t),n]),RC=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])=>[bI(t),n]),ke=e=>d(d(RC(e),([t,n])=>[t,n],()=>d(NC(e),([t,n])=>[t,n],()=>d(PC(e),([t,n])=>[t,n],()=>d(ra(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),MC=e=>d(jl(e),([t,n])=>[xI(t),n]),OC=e=>d(Ze(e),([t,n])=>[t,n]),FC=e=>d(Cl(["'",'"'],e),([t,n])=>[t,n]),_C=e=>d(d(w("[",e),([t,n])=>d(Ze(n),([r,s])=>d(w(":",s),([o,i])=>d(d(pp(i),([a,l])=>[a,l],()=>d(mp(i),([a,l])=>[a,l],()=>d(fp(i),([a,l])=>[a,l],()=>d(gp(i),([a,l])=>[a,l],()=>[])))),([a,l])=>d(w("]",l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[kI(t),n]),vp=e=>d(d(MC(e),([t,n])=>[t,n],()=>d(OC(e),([t,n])=>[t,n],()=>d(FC(e),([t,n])=>[t,n],()=>d(_C(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ip=e=>d(d(d(w("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[yI(t),n]),jp=e=>d(d(d(w("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[SI(t),n]),Cp=e=>d(d(Ip(e),([t,n])=>d(vp(n),([r,s])=>d(jp(s),([o,i])=>d(w(":",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[wI(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]),Tp=(e,t=[])=>d(d(sa(e),([n,r])=>d(Cp(r),([s,o])=>[[n,s],o])),([n,r])=>Tp(r,[...t,n]),()=>[t,e]),DC=e=>d(d(d(Cp(e),([t,n])=>d(Tp(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]),El=e=>d(d(w("{",e),([t,n])=>d(DC(n),([r,s])=>d(w("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[II(t),n]),LC=e=>d(El(e),([t,n])=>[jI(t),n]),UC=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])=>[CI(t),n]),Pd=e=>d(d(UC(e),([t,n])=>[t,n],()=>d(d(Ip(e),([t,n])=>d(ke(n),([r,s])=>d(jp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])),([t,n])=>[TI(t),n]),Ep=e=>d(d(d(w("...",e),([t,n])=>d(Pd(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(Pd(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[EI(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]),BC=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])=>[AI(t),n]),qC=e=>d(d(w("[",e),([t,n])=>d(BC(n),([r,s])=>d(w("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[PI(t),n]),HC=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])=>[NI(t),n]),KC=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])=>[$I(t),n]),zC=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])=>[RI(t),n]),GC=e=>d(d(Ze(e),([t,n])=>d(w(":",n),([r,s])=>d(ke(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[MI(t),n]),Nd=e=>d(d(HC(e),([t,n])=>[t,n],()=>d(KC(e),([t,n])=>[t,n],()=>d(zC(e),([t,n])=>[t,n],()=>d(GC(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Pp=e=>d(d(d(w("...",e),([t,n])=>d(Nd(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(Nd(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[OI(t),n]),Np=(e,t=[])=>d(d(w(",",e),([n,r])=>d(Pp(r),([s,o])=>[[n,s],o])),([n,r])=>Np(r,[...t,n]),()=>[t,e]),$p=e=>d(d(d(Pp(e),([t,n])=>d(Np(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])=>[FI(t),n]),VC=e=>d(d(w("(",e),([t,n])=>d($p(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])=>[_I(t),n]),WC=e=>d(d(w("new",e),([t,n])=>d(w("(",n),([r,s])=>d($p(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])=>[DI(t),n]),JC=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])=>[LI(t),n]),QC=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])=>[UI(t),n]),YC=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])=>[BI(t),n]),XC=e=>d(d(w("{",e),([t,n])=>d(JC(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(YC(g),([k,b])=>d(w("]",b),([y,j])=>d(QC(j),([x,I])=>d(w(":",I),([N,F])=>d(ke(F),([M,R])=>d(dp(R),([P,$])=>d(w("}",$),([A,_])=>[[t,r,o,a,u,p,k,y,x,N,M,P,A],_]))))))))))))),([t,n])=>[qI(t),n]),ZC=e=>d(Ze(e),([t,n])=>[HI(t),n]),eT=e=>d(rp(e),([t,n])=>[KI(t),n]),tT=e=>d(jl(e),([t,n])=>[zI(t),n]),nT=e=>d(d(w("true",e),([t,n])=>[t,n],()=>d(w("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[GI(t),n]),rT=e=>d(Cl(['"',"'"],e),([t,n])=>[t,n]),sT=e=>d(w("null",e),([t,n])=>[VI(),n]),oT=e=>d(w("undefined",e),([t,n])=>[void 0,n]),Rp=e=>d(d(vp(e),([t,n])=>d(w(":",n),([r,s])=>d(Al(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[WI(t),n]),Mp=(e,t=[])=>d(d(sa(e),([n,r])=>d(Rp(r),([s,o])=>[[n,s],o])),([n,r])=>Mp(r,[...t,n]),()=>[t,e]),iT=e=>d(d(d(Rp(e),([t,n])=>d(Mp(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])=>[JI(t),n]),Op=e=>d(d(w("{",e),([t,n])=>d(iT(n),([r,s])=>d(w("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[YI(t),n]),Fp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(Al(r),([s,o])=>[[n,s],o])),([n,r])=>Fp(r,[...t,n]),()=>[t,e]),aT=e=>d(d(d(Al(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])=>[XI(t),n]),cT=e=>d(d(w("[",e),([t,n])=>d(aT(n),([r,s])=>d(w("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[ZI(t),n]),Al=e=>d(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(sT(e),([t,n])=>[t,n],()=>d(oT(e),([t,n])=>[t,n],()=>d(Op(e),([t,n])=>[t,n],()=>d(cT(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),lT=e=>d(w("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[ej(),n]),uT=e=>d(w(".*",e),([t,n])=>[tj(),n]),dT=e=>d(w("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[nj(),n]),fT=e=>d(w("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[rj(),n]),mT=e=>d(w("(?!)",e),([t,n])=>[sj(),n]),pT=e=>d(Zj(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[oj(t),n]),gT=e=>d(d(lT(e),([t,n])=>[t,n],()=>d(uT(e),([t,n])=>[t,n],()=>d(dT(e),([t,n])=>[t,n],()=>d(fT(e),([t,n])=>[t,n],()=>d(mT(e),([t,n])=>[t,n],()=>d(hT(e),([t,n])=>[t,n],()=>d(pT(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),hT=e=>d(d(w("(",e),([t,n])=>d(Pl(n),([r,s])=>d(w(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[ij(t),n]),_p=e=>d(d(d(mc(e),([t,n])=>d(w("|",n),([r,s])=>d(_p(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(d(mc(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[aj(t),n]),mc=e=>d(d(gT(e),([t,n])=>d(Pl(n),([r,s])=>[[t,r],s])),([t,n])=>[cj(t),n]),Pl=e=>d(d(_p(e),([t,n])=>[t,n],()=>d(mc(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),bT=e=>d(d(w("^",e),([t,n])=>d(Pl(n),([r,s])=>d(w("$",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[lj(t),n]),Dp=(e,t=[])=>d(d(w(",",e),([n,r])=>d(ke(r),([s,o])=>[[n,s],o])),([n,r])=>Dp(r,[...t,n]),()=>[t,e]),xT=e=>d(d(d(ke(e),([t,n])=>d(Dp(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])=>[uj(t),n]),Lp=e=>d(d(d(w("extends",e),([t,n])=>d(xT(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[dj(t),n]),kT=e=>d(d(w("interface",e),([t,n])=>d(Ze(n),([r,s])=>d(Tl(s),([o,i])=>d(Lp(i),([a,l])=>d(El(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[fj(t),n]),yT=e=>d(d(w("interface",e),([t,n])=>d(Ze(n),([r,s])=>d(Lp(s),([o,i])=>d(El(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[mj(t),n]),ST=e=>d(d(w("type",e),([t,n])=>d(Ze(n),([r,s])=>d(Tl(s),([o,i])=>d(w("=",i),([a,l])=>d(ke(l),([u,f])=>[[t,r,o,a,u],f]))))),([t,n])=>[pj(t),n]),wT=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])=>[gj(t),n]),vT=e=>d(d(d(w("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[hj(),n]),Up=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]),Bp=(e,t=[])=>d(d(Up(e),([n,r])=>d(Nl(r),([s,o])=>[[n,s],o])),([n,r])=>Bp(r,[...t,n]),()=>[t,e]),IT=e=>d(d(d(Nl(e),([t,n])=>d(Bp(n),([r,s])=>d(d(Up(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[bj(t),n]),Nl=e=>d(d(vT(e),([t,n])=>d(d(kT(n),([r,s])=>[r,s],()=>d(yT(n),([r,s])=>[r,s],()=>d(ST(n),([r,s])=>[r,s],()=>d(wT(n),([r,s])=>[r,s],()=>[])))),([r,s])=>d(dp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[xj(t),n]),jT=e=>d(d(Nl(e),([t,n])=>d(IT(n),([r,s])=>[[t,r],s])),([t,n])=>[kj(t),n]),CT=e=>d(d(jT(e),([t,n])=>[t,n],()=>d($C(e),([t,n])=>[t,n],()=>d(ke(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function TT(e){const t=bp(`\`${e}\``);return h(t.length,2)?t[0]:Nt()}function ET(e){return e.join("|")}function AT(e){return e.slice(1,e.length-1)}function PT(e,t,n){return Ir(t,`${n}${e}`)}function NT(e,t){return Ir(e,`${t}${Tw}`)}function $T(e,t){return Ir(e,`${t}${xm}`)}function RT(e,t){return Ir(e,`${t}${wm}`)}function MT(e,t){return $o(Ge([Fe("false"),Fe("true")]),e,t)}function OT(e,t){return Ir(e,`${t}${vm}`)}function FT(e,t,n){return Ir(t,`${n}${AT(e)}`)}function _T(e,t,n){const r=$l(e,{});return $o(r,t,n)}function DT(e,t,n){const r=vr(e);return $o(r,t,n)}function qp(e,t,n,r=[]){return Te(e,(s,o)=>qp(o,t,n,[...r,$o(s,[],"")]),()=>Ir(t,`${n}(${ET(r)})`))}function $o(e,t,n){return fn(e)?DT(e.enum,t,n):$n(e)?$T(t,n):Ve(e)?PT(e.const,t,n):Xr(e)?NT(t,n):wr(e)?MT(t,n):Zt(e)?RT(t,n):Tn(e)?OT(t,n):Bt(e)?FT(e.pattern,t,n):qT(e)?_T(e.parameters[0],t,n):ce(e)?qp(e.anyOf,t,n):BS}function Ir(e,t){return Te(e,(n,r)=>$o(n,r,t),()=>t)}function LT(e){return`^${Ir(e,"")}$`}function UT(e){const t=LT(e);return Em(t)}function $l(e,t){return Ye(e)?de(UT(e),{},t):Hp(e,t)}function BT(e,t,n,r){const s=Bn(e,t,n);return $l(s,r)}function Hp(e,t={}){return Ee("TemplateLiteral",[e],t)}function qT(e){return Wt(e)&&T(e,"action")&&h(e.action,"TemplateLiteral")}function Kp(e){return $l(e,{})}function HT(e){const t=TT(e);return Kp(t)}function KT(e,t={}){const n=ae(e)?HT(e):Kp(e);return de(n,{},t)}function Bt(e){return Ie(e,"TemplateLiteral")}function zp(e){return ye({"~kind":"ExtendsUnion"},{inferred:e})}function Rl(e){return re(e)&&T(e,"~kind")&&T(e,"inferred")&&h(e["~kind"],"ExtendsUnion")&&re(e.inferred)}function ee(e){return ye({"~kind":"ExtendsTrue"},{inferred:e})}function Ml(e){return re(e)&&T(e,"~kind")&&T(e,"inferred")&&h(e["~kind"],"ExtendsTrue")&&re(e.inferred)}function we(){return ye({"~kind":"ExtendsFalse"},{})}function pc(e){return re(e)&&T(e,"~kind")&&h(e["~kind"],"ExtendsFalse")}function Ht(e){return Rl(e)||Ml(e)}function kt(e,t,n){return Ht(e)?t(e.inferred):n()}const zT=Object.freeze(Object.defineProperty({__proto__:null,ExtendsFalse:we,ExtendsTrue:ee,ExtendsUnion:zp,IsExtendsFalse:pc,IsExtendsTrue:Ml,IsExtendsTrueLike:Ht,IsExtendsUnion:Rl,Match:kt},Symbol.toStringTag,{value:"Module"}));function GT(e,t,n,r){return kt(Qe(e,n,r),s=>ee(ft(ft(e,s),{[t]:n})),()=>we())}function VT(e,t){return ee(e)}function WT(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 JT(e,t,n){const r=vr(n);return Qe(e,t,r)}function Gp(e,t,n){return Te(n,(r,s)=>kt(Qe(e,t,r),o=>Gp(o,t,s),()=>we()),()=>ee(e))}function QT(e,t,n){const r=Qn(n);return Qe(e,t,r)}function Vp(e,t,n){return Te(n,(r,s)=>kt(Qe(e,t,r),o=>ee(o),()=>Vp(e,t,s)),()=>we())}function xt(e,t,n){return Cn(n)?VT(e):dn(n)?WT(e,t,n.if,n.then,n.else):fn(n)?JT(e,t,n.enum):Qt(n)?GT(e,n.name,t,n.extends):Le(n)?Gp(e,t,n.allOf):Bt(n)?QT(e,t,n.pattern):ce(n)?Vp(e,t,n.anyOf):yn(n)?ee(e):we()}function YT(e,t,n){return Qt(n)?xt(e,t,n):Cn(n)||yn(n)?ee(e):zp(e)}function XT(e,t){const n=Ei(e),r=Ei(t);return n&&r||!n&&r?!0:!(n&&!r)}function ZT(e,t,n,r){return ut(r)?XT(t,r)?Qe(e,n,r.items):we():xt(e,t,r)}function eE(e,t,n){return Xr(n)?ee(e):xt(e,t,n)}function tE(e,t,n){return wr(n)?ee(e):xt(e,t,n)}function nE(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=>Ol(u,n,s),()=>we())}function rE(e,t,n,r){return Te(r,(s,o)=>nE(e,t,n,s,o),()=>Jt(t)?ee(e):we())}function sE(e,t,n){return Te(t,(r,s)=>rE(e,r,s,n),()=>ee(e))}function Ol(e,t,n){return sE(e,t,n)}function Wp(e,t,n){return Zr(n)?ee(e):Qe(e,t,n)}function oE(e,t,n,r){return Cn(r)||yn(r)?ee(e):ln(r)?kt(Ol(e,t,r.parameters),s=>Wp(s,n,r.instanceType),()=>we()):we()}function iE(e,t,n,r,s){return kt(Qe(e,t,s),()=>Qe(e,n,s),()=>Qe(e,r,s))}function aE(e,t,n){const r=vr(t);return Qe(e,r,n)}function cE(e,t,n,r){return Cn(r)||yn(r)?ee(e):un(r)?kt(Ol(e,t,r.parameters),s=>Wp(s,n,r.returnType),()=>we()):we()}function lE(e,t,n){return $n(n)||Zt(n)?ee(e):xt(e,t,n)}function uE(e,t,n){const r=en(t);return Qe(e,r,n)}function oa(e,t,n){return t===n?ee(e):we()}function dE(e,t,n){return Ve(n)?oa(e,t,n.const):Xr(n)?ee(e):xt(e,Fe(t),n)}function fE(e,t,n){return Ve(n)?oa(e,t,n.const):wr(n)?ee(e):xt(e,Fe(t),n)}function mE(e,t,n){return Ve(n)?oa(e,t,n.const):Zt(n)?ee(e):xt(e,Fe(t),n)}function pE(e,t,n){return Ve(n)?oa(e,t,n.const):Tn(n)?ee(e):xt(e,Fe(t),n)}function gE(e,t,n){return et(t.const)?dE(e,t.const,n):mt(t.const)?fE(e,t.const,n):ve(t.const)?mE(e,t.const,n):ae(t.const)?pE(e,t.const,n):Nt()}function hE(e,t,n){return Qt(n)?xt(e,t,n):ee(e)}function bE(e,t,n){return Co(n)?ee(e):xt(e,t,n)}function xE(e,t,n){return Zt(n)?ee(e):xt(e,t,n)}function kE(e,t,n){return Jt(t)?Jt(n)?ee(e):we():ee(e)}function yE(e,t,n){return Qt(n)&&Es(n.extends)?we():kt(Qe(e,t,n),r=>kE(r,t,n),()=>we())}function SE(e,t){return e.reduce((n,r)=>r in t&&Ht(t[r])?{...n,...t[r].inferred}:Nt(),{})}function wE(e,t,n){const r={};for(const i of L(n))r[i]=i in t?yE({},t[i],n[i]):Jt(n[i])?Qt(n[i])?ee(ft(e,{[n[i].name]:n[i].extends})):ee(e):we();const s=nl(r).every(i=>Ht(i)),o=s?SE(L(r),r):{};return s?ee(o):we()}function vE(e,t,n){const r=wE(e,t,n);return Ht(r)?ee(ft(e,r.inferred)):we()}function IE(e,t,n){return vE(e,t,n)}function jE(e,t){return L(t).reduce((n,r)=>({...n,[r]:T(e,r)?ce(n[r])?Ge([...n[r].anyOf,t[r]]):Ge([e[r],t[r]]):t[r]}),e)}function Jp(e,t,n,r){return Te(t,(s,o)=>kt(Qe({},e[s],n),i=>Jp(e,o,n,jE(r,i)),()=>we()),()=>ee(r))}function CE(e,t,n,r){const s=L(t);return Jp(t,s,r,e)}function TE(e,t,n){return Tt(n)?CE(e,t,pn(n),Ut(n)):De(n)?IE(e,t,n.properties):xt(e,Ne(t),n)}function EE(e,t){return h(L(t).length,0)?ee(e):we()}function AE(e,t,n,r,s){return Qe(e,n,s)}function PE(e,t,n,r){return Tt(r)?AE(e,uc(t),n,uc(pn(r)),Ut(r)):De(r)?EE(e,r.properties):Cn(r)||yn(r)?ee(e):we()}function NE(e,t,n){return Tn(n)?ee(e):xt(e,t,n)}function $E(e,t,n){return To(n)?ee(e):xt(e,t,n)}function RE(e,t,n){const r=Qn(t);return Qe(e,r,n)}function gc(e,t){return ye({"~kind":"Inferrable"},{name:e,type:t},{})}function Fl(e){return re(e)&&T(e,"~kind")&&T(e,"name")&&T(e,"type")&&h(e["~kind"],"Inferrable")&&ae(e.name)&&re(e.type)}function Qp(e){return na(e)?Qt(e.items)?ut(e.items.extends)?gc(e.items.name,e.items.extends.items):yn(e.items.extends)?gc(e.items.name,e.items.extends):void 0:Nt():void 0}function Yp(e){return Qt(e)?gc(e.name,e.extends):void 0}function _l(e,t,n=[]){return Te(e,(r,s)=>kt(Qe({},r,t),()=>_l(s,t,[...n,r]),()=>{}),()=>n)}function ME(e,t,n,r){const s=_l(n,r);return z(s)?ee(ft(e,{[t]:mn(s)})):we()}function Xp(e,t,n,r){const s=_l(n,r);return z(s)?ee(ft(e,{[t]:Ge(s)})):we()}function OE(e){return[...e].reverse()}function hc(e,t){return t?OE(e):e}function FE(e){const t=e.length>0?e[0]:void 0,n=Wt(t)?Qp(t):void 0;return Wt(n)}function _E(e,t,n,r,s,o){return kt(Qe(e,n,s),i=>Zp(i,t,r,o),()=>we())}function DE(e,t,n,r,s){const o=Qp(r);return Fl(o)?ME(e,o.name,hc(n,t),o.type):Te(n,(i,a)=>_E(e,t,i,a,r,s),()=>we())}function LE(e,t,n,r){return Te(r,(s,o)=>DE(e,t,n,s,o),()=>h(n.length,0)?ee(e):we())}function Zp(e,t,n,r){return LE(e,t,n,r)}function UE(e,t,n){const r=_o(e,Mt([],[]),n),s=FE(r);return Zp(e,s,hc(t,s),hc(r,s))}function eg(e,t,n){const r=Yp(n);return Fl(r)?Xp(e,r.name,t,r.type):Te(t,(s,o)=>kt(Qe(e,s,n),i=>eg(i,o,n),()=>we()),()=>ee(e))}function BE(e,t,n){const r=_o(e,Mt([],[]),t);return rt(n)?UE(e,r,n.items):ut(n)?eg(e,r,n.items):xt(e,mn(r),n)}function qE(e,t,n){return Zr(n)||Ns(n)?ee(e):xt(e,t,n)}function tg(e,t,n){return Te(n,(r,s)=>kt(Qe(e,t,r),o=>ee(o),()=>tg(e,t,s)),()=>we())}function bc(e,t,n){return Te(t,(r,s)=>kt(tg(e,r,n),o=>bc(o,s,n),()=>we()),()=>ee(e))}function HE(e,t,n){const r=Yp(n);return Fl(r)?Xp(e,r.name,t,r.type):ce(n)?bc(e,t,n.anyOf):bc(e,t,[n])}function KE(e,t,n){return Qt(n)?xt(e,t,n):Cn(n)||yn(n)?ee(e):we()}function zE(e,t,n){return Zr(n)?ee(e):xt(e,t,n)}function Qe(e,t,n){return Cn(t)?YT(e,t,n):ut(t)?ZT(e,t,t.items,n):Xr(t)?eE(e,t,n):wr(t)?tE(e,t,n):ln(t)?oE(e,t.parameters,t.instanceType,n):dn(t)?iE(e,t.if,t.then,t.else,n):fn(t)?aE(e,t.enum,n):un(t)?cE(e,t.parameters,t.returnType,n):$n(t)?lE(e,t,n):Le(t)?uE(e,t.allOf,n):Ve(t)?gE(e,t,n):Es(t)?hE(e,t,n):Co(t)?bE(e,t,n):Zt(t)?xE(e,t,n):De(t)?TE(e,t.properties,n):Tt(t)?PE(e,pn(t),Ut(t),n):Tn(t)?NE(e,t,n):To(t)?$E(e,t,n):Bt(t)?RE(e,t.pattern,n):rt(t)?BE(e,t.items,n):Ns(t)?qE(e,t,n):ce(t)?HE(e,t.anyOf,n):yn(t)?KE(e,t,n):Zr(t)?zE(e,t,n):we()}function GE(e,t){return en([...e,Ne(t)])}function ng(e,t,n){return Ye(e)?de(GE(e,t),{},n):Dl(e,t,n)}function VE(e,t,n,r,s){const o=Bn(e,t,n),i=Xl(e,t,r);return ng(o,i,s)}function Dl(e,t,n={}){return Ee("Interface",[e,t],n)}function Ll(e){return Wt(e)&&T(e,"action")&&h(e.action,"Interface")}function WE(e,t,n={}){return ng(e,t,n)}function JE(e,t,n){return e.includes(n)?!0:uo([...e,n],t,t[n])}function $d(e,t,n){const r=am(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)?JE(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]):Ll(n)?$d(e,t,n.parameters[1]):Le(n)?Fr(e,t,n.allOf):De(n)?$d(e,t,n.properties):ce(n)?Fr(e,t,n.anyOf):rt(n)?Fr(e,t,n.items):Tt(n)?uo(e,t,Ut(n)):!1}function QE(e,t,n){return uo(e,t,n)}function YE(e,t){return t.reduce((n,r)=>QE([r],e,e[r])?[...n,r]:n,[])}function XE(e){const t=im(e);return YE(e,t)}function ZE(e,t,n){return n.includes(t)?n:t in e?fo(e,e[t],[...n,t]):Nt()}function Rd(e,t,n){const r=am(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)?ZE(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):Ll(t)?Rd(e,t.parameters[1],n):Le(t)?bs(e,t.allOf,n):De(t)?Rd(e,t.properties,n):ce(t)?bs(e,t.anyOf,n):rt(t)?bs(e,t.items,n):Tt(t)?fo(e,Ut(t),n):n}function eA(e,t,n){return fo(e,n,[t])}function tA(e){return dl()}function nA(e){return L(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)?tA(e.$ref):ut(e)?Sr(Dr(e.items),ll(e)):ln(e)?wo(Js(e.parameters),Dr(e.instanceType)):un(e)?vo(Js(e.parameters),Dr(e.returnType)):Le(e)?Pn(Js(e.allOf)):De(e)?Ne(nA(e.properties)):Tt(e)?xl(ea(e),Dr(Ut(e))):ce(e)?Ge(Js(e.anyOf)):rt(e)?mn(Js(e.items)):e}function rA(e,t){return t in e?Dr(e[t]):Dt()}function sA(e){return rA(e.$defs,e.$ref)}function oA(e,t,n){const r=Bn(e,Mt([],[]),t),s=Xl({},Mt([],[]),n);return en([...r,Ne(s)])}function iA(e,t){return L(e).filter(r=>t.includes(r)).reduce((r,s)=>{const o=e[s],i=Ll(o)?oA(e,o.parameters[0],o.parameters[1]):o;return{...r,[s]:i}},{})}function aA(e,t,n){const r=eA(e,t,n),s=iA(e,r);return jo(s,t)}function rg(e,t){return t in e?ht(e[t])?rg(e,e[t].$ref):e[t]:Ct()}function Ro(e,t){return rg(e,t)}function Md(e){return Lt(e)?sA(e):cm(e)?Dt():e}function Wn(e,t,n){const r=Md(t),s=Md(n);return Qe(e,r,s)}const Ul="equal",cA="disjoint",Bl="left-inside",ql="right-inside";function ia(e,t){const n=[yn(e)?we():Wn({},e,t),yn(e)?ee({}):Wn({},t,e)];return Ht(n[0])&&Ht(n[1])?Ul:Ht(n[0])&&pc(n[1])?Bl:pc(n[0])&&Ht(n[1])?ql:cA}function lA(e,t){return t.filter(n=>ia(e,n)!==ql)}function uA(e,t){const n=t.some(r=>{const s=ia(e,r);return h(s,Bl)||h(s,Ul)});return h(n,!1)}function dA(e,t){const n=Hr(e);return Cn(n)?[n]:uA(n,t)?[...lA(n,t),n]:t}function fA(e){return e.reduce((t,n)=>De(n)?[...t,n]:Es(n)?t:dA(n,t),[])}function sg(e){const t=fA(e);return Yi(t)}function og(e,t){return de(Hr(e),{},t)}function mA(e,t,n,r){const s=V(e,t,n);return og(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 pA(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function ig(e,t,n=[]){return Te(e,(r,s)=>Te(t,(o,i)=>ig(s,i,[...n,[o,r]]),()=>n),()=>n)}function gA(e){return Bt(e)?Qn(e.pattern):fn(e)?vr(e.enum):e}function hA(e){const t=gA(e);return ce(t)?[...t.anyOf]:[t]}function bA(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Od(e,t){return t.reduce((n,r)=>[...n,...bA(e,r)],[])}function Fd(e){return e.reduce((t,n)=>h(n[0],!0)?Od(t,hA(n[1])):Od(t,[n[1]]),[[]])}function xA(e,t,n){const r=Zs(n),s=pA(e,r),o=ig(t,s);return ws(n)&&h(n.action,"Conditional")||ws(n)&&h(n.action,"Mapped")?Fd(o):[t]}function kA(){return["(not-resolvable)",Ct()]}function yA(){return["(not-generic)",Ct()]}function SA(e,t,n){return[e,Io(t,n)]}function wA(e,t,n){return t in e?ag(e,t,e[t]):kA()}function ag(e,t,n,r){return ul(n)?SA(t,n.parameters,n.expression):ht(n)?wA(e,n.$ref):yA()}function vA(e,t,n){return ag(e,"(anonymous)",t)}function IA(e,t,n){if(Qt(t)||Kl(t)||Ht(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 _d(e,t,n,r,s){const o=V(e,t,s);return IA(n,o,r),ft(e,{[n]:o})}function jA(e,t,n,r,s){const o=V(e,t,n.extends),i=V(e,t,n.equals);return Te(s,(a,l)=>xc(_d(e,t,n.name,o,a),t,r,l),()=>xc(_d(e,t,n.name,o,i),t,r,[]))}function xc(e,t,n,r){return Te(n,(s,o)=>jA(e,t,s,o,r),()=>e)}function CA(e,t,n,r){return xc(e,t,n,r)}let kc=0,Hl=0;function TA(){if(!xo(Hl,So().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function EA(){TA(),Hl++,kc++}function AA(){kc--,h(kc,0)&&(Hl=0)}function PA(e){return Wr(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function NA(e,t){return h(PA(e),t)}function $A(e,t,n,r,s,o){EA();try{const i=CA(e,t,r,o),a=V(i,Mt([...t.callstack,n.$ref],t.visited),s);return V(i,Mt([],[]),a)}finally{AA()}}function RA(e,t,n,r,s,o){return o.reduce((i,a)=>{const l=$A(e,t,n,r,s,a);return[...i,l]},[])}function MA(e,t,n,r,s,o){const i=xA(r,o,s),a=RA(e,t,n,r,s,i);return h(a.length,1)?a[0]:Yn(a)}function cg(e,t,n,r){const s=Bn(e,t,r),o=vA(e,n),i=o[0],a=o[1];return ul(a)?NA(t,i)?yc(on(i),s):MA(e,t,on(i),a.parameters,a.expression,s):yc(n,s)}function yc(e,t){return ye({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function OA(e,t){return cg({},Mt([],[]),e,t)}function Kl(e){return Ie(e,"Call")}function FA(e){return jn(e,["~immutable"])}function _A(e,t){return de(FA(e),{},t)}function DA(e,t,n,r){const s=V(e,t,n);return _A(s,r)}function LA(e,t){return e(t)}function UA(e,t){return ae(t)?Fe(LA(e,t)):Fe(t)}function BA(e,t){const n=Qn(t);return $s(e,n)}function qA(e,t){const n=t.map(r=>$s(e,r));return Ge(n)}function $s(e,t){return Ve(t)?UA(e,t.const):Bt(t)?BA(e,t.pattern):ce(t)?qA(e,t.anyOf):t}function lg(e,t={}){return Ee("Capitalize",[e],t)}function HA(e,t={}){return mg(e,t)}function ug(e,t={}){return Ee("Lowercase",[e],t)}function KA(e,t={}){return pg(e,t)}function dg(e,t={}){return Ee("Uncapitalize",[e],t)}function zA(e,t={}){return gg(e,t)}function fg(e,t={}){return Ee("Uppercase",[e],t)}function GA(e,t={}){return hg(e,t)}const VA=e=>e[0].toUpperCase()+e.slice(1),WA=e=>e.toLowerCase(),JA=e=>e[0].toLowerCase()+e.slice(1),QA=e=>e.toUpperCase();function mg(e,t){return Ye([e])?de($s(VA,e),{},t):lg(e,t)}function pg(e,t){return Ye([e])?de($s(WA,e),{},t):ug(e,t)}function gg(e,t){return Ye([e])?de($s(JA,e),{},t):dg(e,t)}function hg(e,t){return Ye([e])?de($s(QA,e),{},t):fg(e,t)}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 ZA(e,t,n,r){const s=V(e,t,n);return gg(s,r)}function e1(e,t,n,r){const s=V(e,t,n);return hg(s,r)}function bg(e,t,n,r,s={}){return Ee("Conditional",[e,t,n,r],s)}function t1(e,t,n,r,s={}){return xg({},Mt([],[]),e,t,n,r,s)}function n1(e,t,n,r,s,o){const i=Wn(e,n,r);return Rl(i)?Ge([V(i.inferred,t,s),V(e,t,o)]):Ml(i)?V(i.inferred,t,s):V(e,t,o)}function xg(e,t,n,r,s,o,i){return Ye([n,r])?de(n1(e,t,n,r,s,o),{},i):bg(n,r,s,o,i)}function r1(e,t,n,r,s,o,i){const a=V(e,t,n),l=V(e,t,r);return xg(e,t,a,l,s,o,i)}function kg(e,t={}){return Ee("ConstructorParameters",[e],t)}function s1(e,t={}){return yg(e,t)}function o1(e){const t=ln(e)?e.parameters:[],n=_o({},Mt([],[]),t);return mn(n)}function yg(e,t){return Ye([e])?de(o1(e),{},t):kg(e,t)}function i1(e,t,n,r){const s=V(e,t,n);return yg(s,r)}function Sg(e,t,n={}){return Ee("Exclude",[e,t],n)}function a1(e,t,n={}){return zl(e,t,n)}function zl(e,t,n){return Ye([e,t])?de(Um(e,t),{},n):Sg(e,t,n)}function c1(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return zl(o,i,s)}function wg(e,t,n={}){return Ee("Extract",[e,t],n)}function l1(e,t,n={}){return vg(e,t,n)}function u1(e,t){const n=Wn({},e,t);return Ht(n)?[e]:[]}function d1(e,t){return e.reduce((n,r)=>[...n,...u1(r,t)],[])}function f1(e,t){const n=Hr(e),r=ce(n)?n.anyOf:[n],s=d1(r,t);return Yn(s)}function vg(e,t,n){return Ye([e,t])?de(f1(e,t),{},n):wg(e,t,n)}function m1(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return vg(o,i,s)}function p1(e){return e.reduce((t,n)=>km(n)?[...t,Fe(n)]:t,[])}function Gl(e){const t=p1(e);return Ge(t)}function Vl(e,t,n={}){return Ee("Index",[e,t],n)}function g1(e,t,n={}){const r=z(t)?Gl(t):t;return Eg(e,r,n)}function h1(e,t){const n=Ro(e,t);return ts(n)}function b1(e,t,n){const r=As(e,t,n);return ts(r)}function x1(e,t){const n=L(e).filter(f=>!T(t,f)),r=L(t).filter(f=>!T(e,f)),s=L(e).filter(f=>T(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 k1(e){return e.reduce((t,n)=>x1(t,ts(n)),{})}function y1(e){const t=Yw(mn(e));return ts(t)}function S1(e,t){return L(e).filter(s=>s in t).reduce((s,o)=>({...s,[o]:Yn([e[o],t[o]])}),{})}function Ig(e,t){return Te(e,(n,r)=>Ig(r,S1(t,ts(n))),()=>t)}function w1(e){return Te(e,(t,n)=>Ig(n,ts(t)),()=>Nt())}function ts(e){return Lt(e)?h1(e.$defs,e.$ref):dn(e)?b1(e.if,e.then,e.else):Le(e)?k1(e.allOf):ce(e)?w1(e.anyOf):rt(e)?y1(e.items):De(e)?e.properties:{}}function Wl(e){const t=ts(e);return Ne(t)}const v1=new RegExp("^(?:0|[1-9][0-9]*)$");function Jl(e){const t=`${e}`;return v1.test(t)?parseInt(t):e}function I1(e){return Fe(Jl(e))}function Dd(e){return e.map(t=>jg(t))}function jg(e){return Le(e)?Pn(Dd(e.allOf)):ce(e)?Ge(Dd(e.anyOf)):Ve(e)?I1(e.const):e}function j1(e,t){const n=jg(t),r=Wn({},n,br());return Ht(r)?e:Ve(t)&&h(t.const,"length")?br():Ct()}function C1(e,t){const n=Ro(e,t);return ns(n)}function T1(e,t,n){const r=As(e,t,n);return ns(r)}function E1(e){const t=vr(e);return ns(t)}function A1(e){const t=en(e);return ns(t)}function P1(e){return[`${e}`]}function N1(e){const t=Qn(e);return ns(t)}function $1(e){return e.reduce((t,n)=>[...t,...ns(n)],[])}function ns(e){return Lt(e)?C1(e.$defs,e.$ref):dn(e)?T1(e.if,e.then,e.else):fn(e)?E1(e.enum):Le(e)?A1(e.allOf):Ve(e)?P1(e.const):Bt(e)?N1(e.pattern):ce(e)?$1(e.anyOf):[]}function Ql(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)):ce(t)?Ge(Qs(e,t.anyOf)):Le(t)?Pn(Qs(e,t.allOf)):Km(t)?Ne(e):t}function R1(e,t){return so(e,t)}function M1(e,t){const n=t in e?e[t]:Ct();return R1(e,n)}function Cg(e,t){return t.reduce((n,r)=>[...n,M1(e,r)],[])}function O1(e,t){const n=Ql(t),r=Cg(e,n);return Yn(r)}const F1=new RegExp(Ao);function _1(e){return e.filter(n=>F1.test(n))}function D1(e){const t=im(e),n=_1(t),r=Cg(e,n);return Yn(r)}function L1(e,t){return Zt(t)?D1(e):O1(e,t)}function U1(e){return Fe(Jl(e))}function Ld(e){return e.map(t=>Tg(t))}function Tg(e){return Le(e)?Pn(Ld(e.allOf)):ce(e)?Ge(Ld(e.anyOf)):Ve(e)?U1(e.const):e}function B1(e,t){return e.reduceRight((n,r,s)=>{const o=Wn({},Fe(s),t);return Ht(o)?[r,...n]:n},[])}function q1(e,t){const n=Tg(t),r=B1(e,n);return Ps(r)}function H1(e){return Ps(e)}function K1(e,t){return Ve(t)&&h(t.const,"length")?Fe(e.length):Zt(t)||$n(t)?H1(e):q1(e,t)}function z1(e,t){return ut(e)?j1(e.items,t):De(e)?L1(e.properties,t):rt(e)?K1(e.items,t):Ct()}function G1(e){return Lt(e)||dn(e)||Le(e)||ce(e)?Wl(e):e}function Eg(e,t,n){return Ye([e,t])?de(z1(G1(e),t),{},n):Vl(e,t,n)}function V1(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Eg(o,i,s)}function Ag(e,t={}){return Ee("InstanceType",[e],t)}function W1(e,t={}){return Pg(e,t)}function J1(e){return ln(e)?e.instanceType:Ct()}function Pg(e,t){return Ye([e])?de(J1(e),{},t):Ag(e,t)}function Q1(e,t,n,r={}){const s=V(e,t,n);return Pg(s,r)}function Yl(e,t={}){return Ee("KeyOf",[e],t)}function Y1(e,t={}){return Ng(e,t)}function X1(){return Ge([br(),Rn(),hl()])}function Z1(e){return br()}function eP(e){return e.reduce((n,r)=>km(r)?[...n,Fe(Jl(r))]:Nt(),[])}function tP(e){const t=L(e),n=eP(t);return Ps(n)}function nP(e){return ea(e)}function rP(e){const t=e.map((n,r)=>Fe(r));return Ps(t)}function sP(e){return Cn(e)?X1():ut(e)?Z1(e.items):De(e)?tP(e.properties):Tt(e)?nP(e):rt(e)?rP(e.items):Ct()}function oP(e){return Lt(e)||dn(e)||Le(e)||ce(e)?Wl(e):e}function Ng(e,t){return Ye([e])?de(sP(oP(e)),{},t):Yl(e,t)}function iP(e,t,n,r){const s=V(e,t,n);return Ng(s,r)}function Sc(e,t,n,r,s={}){return Ee("Mapped",[e,t,n,r],s)}function aP(e,t,n,r,s={}){return $g({},Mt([],[]),e,t,n,r,s)}function cP(e){const t=Qn(e);return aa(t)}function lP(e){return e.reduce((t,n)=>[...t,...aa(n)],[])}function uP(e){const t=vr(e);return aa(t)}function dP(e){return ve(e)?[Fe(`${e}`)]:[Fe(e)]}function aa(e){return fn(e)?uP(e.enum):Ve(e)?dP(e.const):Bt(e)?cP(e.pattern):ce(e)?lP(e.anyOf):[e]}function fP(e){return aa(e)}function mP(e){return Bt(e)?Qn(e.pattern):e}function pP(e,t,n,r,s,o){const i=ft(e,{[n.name]:r}),a=V(i,t,s),l=mP(a),u=V(i,t,o);return ym(l)||Sm(l)?{[l.const]:u}:{}}function gP(e,t,n,r,s,o){return r.reduce((i,a)=>[...i,pP(e,t,n,a,s,o)],[])}function hP(e){return e.reduce((t,n)=>[...t,Ne(n)],[])}function bP(e,t,n,r,s,o){const i=fP(r),a=gP(e,t,n,i,s,o),l=hP(a);return en(l)}function $g(e,t,n,r,s,o,i){return Ye([r])?de(bP(e,t,n,r,s,o),{},i):Sc(n,r,s,o,i)}function xP(e,t,n,r,s,o,i){const a=V(e,t,r);return $g(e,t,n,a,s,o,i)}function kP(e,t,n){const r=ft(e,t);return L(t).filter(o=>n.includes(o)).reduce((o,i)=>({...o,[i]:aA(r,i,t[i])}),{})}function yP(e,t,n){const r=ft(e,t);return L(t).filter(o=>!n.includes(o)).reduce((o,i)=>({...o,[i]:V(r,Mt([],[]),t[i])}),{})}function SP(e,t,n){const r=XE(t),s=kP(e,t,r),o=yP(e,t,r),i={...s,...o};return de(i,{},n)}function Rg(e,t,n,r){return SP(e,n,r)}function Mg(e,t={}){return Ee("NonNullable",[e],t)}function wP(e,t={}){return Og(e,t)}function vP(e){const t=Ge([gl(),kl()]);return zl(e,t,{})}function Og(e,t){return Ye([e])?de(vP(e),{},t):Mg(e,t)}function IP(e,t,n,r){const s=V(e,t,n);return Og(s,r)}function Fg(e,t,n={}){return Ee("Omit",[e,t],n)}function jP(e,t,n={}){const r=z(t)?Gl(t):t;return Dg(e,r,n)}function _g(e){const t=Wl(e);return De(t)?t.properties:Nt()}function CP(e,t){return L(e).reduce((r,s)=>t.includes(s)?r:{...r,[s]:e[s]},{})}function TP(e,t){const n=_g(e),r=Ql(t),s=CP(n,r);return Ne(s)}function Dg(e,t,n){return Ye([e,t])?de(TP(e,t),{},n):Fg(e,t,n)}function EP(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Dg(o,i,s)}function Lg(e,t={}){return Ee("Parameters",[e],t)}function AP(e,t={}){return Ug(e,t)}function PP(e){const t=un(e)?e.parameters:[],n=_o({},Mt([],[]),t);return mn(n)}function Ug(e,t){return Ye([e])?de(PP(e),{},t):Lg(e,t)}function NP(e,t,n,r){const s=V(e,t,n);return Ug(s,r)}function Bg(e,t={}){return Ee("Partial",[e],t)}function $P(e,t={}){return qg(e,t)}function RP(e,t){const n=Ro(e,t),r=Mo(n);return jo(ft(e,{[t]:r}),t)}function MP(e,t,n){const r=As(e,t,n);return Mo(r)}function OP(e){const t=en(e);return Mo(t)}function FP(e){const t=e.map(n=>Mo(n));return Ge(t)}function _P(e){const t=L(e).reduce((r,s)=>({...r,[s]:Ci(e[s])}),{});return Ne(t)}function Mo(e){return Lt(e)?RP(e.$defs,e.$ref):dn(e)?MP(e.if,e.then,e.else):Le(e)?OP(e.allOf):ce(e)?FP(e.anyOf):De(e)?_P(e.properties):Ne({})}function qg(e,t){return Ye([e])?de(Mo(e),{},t):Bg(e,t)}function DP(e,t,n,r){const s=V(e,t,n);return qg(s,r)}function Hg(e,t,n={}){return Ee("Pick",[e,t],n)}function LP(e,t,n={}){const r=z(t)?Gl(t):t;return Kg(e,r,n)}function UP(e,t){return L(e).reduce((r,s)=>t.includes(s)?ft(r,{[s]:e[s]}):r,{})}function BP(e,t){const n=_g(e),r=Ql(t),s=UP(n,r);return Ne(s)}function Kg(e,t,n){return Ye([e,t])?de(BP(e,t),{},n):Hg(e,t,n)}function qP(e,t,n,r,s){const o=V(e,t,n),i=V(e,t,r);return Kg(o,i,s)}function zg(e,t={}){return Ee("ReadonlyObject",[e],t)}function Gg(e,t={}){return Vg(e,t)}const HP=Gg;function KP(e){return eu(Sr(e))}function zP(e,t){const n=Ro(e,t),r=Oo(n);return jo(ft(e,{[t]:r}),t)}function GP(e,t,n){const r=As(e,t,n);return Oo(r)}function VP(e){const t=en(e);return Oo(t)}function WP(e){const t=L(e).reduce((r,s)=>({...r,[s]:Ai(e[s])}),{});return Ne(t)}function JP(e){return eu(mn(e))}function QP(e){const t=e.map(n=>Oo(n));return Ge(t)}function Oo(e){return ut(e)?KP(e.items):Lt(e)?zP(e.$defs,e.$ref):dn(e)?GP(e.if,e.then,e.else):Le(e)?VP(e.allOf):De(e)?WP(e.properties):rt(e)?JP(e.items):ce(e)?QP(e.anyOf):e}function Vg(e,t){return Ye([e])?de(Oo(e),{},t):zg(e)}function YP(e,t,n,r){const s=V(e,t,n);return Vg(s,r)}function XP(e,t,n,r){return t.visited.includes(r)?n:r in e?V(e,Mt(t.callstack,[...t.visited,r]),e[r]):n}function ZP(e,t){const n=Ro(e,t),r=Fo(n);return jo(ft(e,{[t]:r}),t)}function eN(e,t,n){const r=As(e,t,n);return Fo(r)}function tN(e){const t=en(e);return Fo(t)}function nN(e){const t=e.map(n=>Fo(n));return Ge(t)}function rN(e){const t=L(e).reduce((r,s)=>({...r,[s]:Fm(e[s])}),{});return Ne(t)}function Fo(e){return Lt(e)?ZP(e.$defs,e.$ref):dn(e)?eN(e.if,e.then,e.else):Le(e)?tN(e.allOf):ce(e)?nN(e.anyOf):De(e)?rN(e.properties):Ne({})}function Wg(e,t={}){return Ee("Required",[e],t)}function sN(e,t={}){return Jg(e,t)}function Jg(e,t){return Ye([e])?de(Fo(e),{},t):Wg(e,t)}function oN(e,t,n,r){const s=V(e,t,n);return Jg(s,r)}function Qg(e,t={}){return Ee("ReturnType",[e],t)}function iN(e,t={}){return Yg(e,t)}function aN(e){return un(e)?e.returnType:Ct()}function Yg(e,t){return Ye([e])?de(aN(e),{},t):Qg(e,t)}function cN(e,t,n,r={}){const s=V(e,t,n);return Yg(s,r)}function Xg(e,t){return Ee("With",[e,t],{})}function Zg(e,t){return eh(e,t)}function eh(e,t){return Ye([e])?de(e,{},t):Xg(e,t)}function lN(e,t,n,r){const s=V(e,t,n);return eh(s,r)}function uN(e){return na(e)?rt(e.items)?th(e.items.items):Qt(e.items)?[e]:ht(e.items)?[e]:[Ct()]:[e]}function th(e){return e.reduce((n,r)=>[...n,...uN(r)],[])}function Mt(e,t){return{callstack:e,visited:t}}function Ye(e){return Te(e,(t,n)=>ht(t)?!1:Ye(n),()=>!0)}function Xl(e,t,n){return L(n).reduce((r,s)=>({...r,[s]:V(e,t,n[s])}),{})}function _o(e,t,n){const r=Bn(e,t,n);return th(r)}function Bn(e,t,n){return n.map(r=>V(e,t,r))}function dN(e,t){const n=Jt(e)?cl(t,{}):t,r=Pi(e)?al(n,{}):n;return Ei(e)?Zl(r,{}):r}function fN(e,t,n,r,s){return h(n,"AddImmutable")?gN(e,t,r[0],s):h(n,"RemoveImmutable")?DA(e,t,r[0],s):h(n,"AddReadonly")?FS(e,t,r[0],s):h(n,"RemoveReadonly")?zw(e,t,r[0],s):h(n,"AddOptional")?DS(e,t,r[0],s):h(n,"RemoveOptional")?Jw(e,t,r[0],s):h(n,"Capitalize")?YA(e,t,r[0],s):h(n,"Conditional")?r1(e,t,r[0],r[1],r[2],r[3],s):h(n,"ConstructorParameters")?i1(e,t,r[0],s):h(n,"Evaluate")?mA(e,t,r[0],s):h(n,"Exclude")?c1(e,t,r[0],r[1],s):h(n,"Extract")?m1(e,t,r[0],r[1],s):h(n,"Index")?V1(e,t,r[0],r[1],s):h(n,"InstanceType")?Q1(e,t,r[0],s):h(n,"Interface")?VE(e,t,r[0],r[1],s):h(n,"KeyOf")?iP(e,t,r[0],s):h(n,"Lowercase")?XA(e,t,r[0],s):h(n,"Mapped")?xP(e,t,r[0],r[1],r[2],r[3],s):h(n,"Module")?Rg(e,t,r[0],s):h(n,"NonNullable")?IP(e,t,r[0],s):h(n,"Pick")?qP(e,t,r[0],r[1],s):h(n,"Parameters")?NP(e,t,r[0],s):h(n,"Partial")?DP(e,t,r[0],s):h(n,"Omit")?EP(e,t,r[0],r[1],s):h(n,"ReadonlyObject")?YP(e,t,r[0],s):h(n,"Record")?wv(e,t,r[0],r[1],s):h(n,"Required")?oN(e,t,r[0],s):h(n,"ReturnType")?cN(e,t,r[0],s):h(n,"TemplateLiteral")?BT(e,t,r[0],s):h(n,"Uncapitalize")?ZA(e,t,r[0],s):h(n,"Uppercase")?e1(e,t,r[0],s):h(n,"With")?lN(e,t,r[0],r[1]):Ee(n,r,s)}function mN(e,t,n){const r=ht(n)?XP(e,t,n,n.$ref):ut(n)?Sr(V(e,t,n.items),ll(n)):Kl(n)?cg(e,t,n.target,n.arguments):ln(n)?wo(Bn(e,t,n.parameters),V(e,t,n.instanceType),LS(n)):un(n)?vo(Bn(e,t,n.parameters),V(e,t,n.returnType),US(n)):dn(n)?Ti(V(e,t,n.if),V(e,t,n.then),V(e,t,n.else),GS(n)):Le(n)?Pn(Bn(e,t,n.allOf),YS(n)):De(n)?Ne(Xl(e,t,n.properties),KS(n)):Tt(n)?vv(pn(n),V(e,t,Ut(n))):na(n)?ta(V(e,t,n.items)):rt(n)?mn(_o(e,t,n.items),Hw(n)):ce(n)?Ge(Bn(e,t,n.anyOf),Mw(n)):n;return dN(n,r)}function V(e,t,n){return ws(n)?fN(e,t,n.action,n.parameters,n.options):mN(e,t,n)}function Rs(e,t){return V(e,Mt([],[]),t)}function pN(e){return de(e,{"~immutable":!0},{})}function Zl(e,t){return de(pN(e),{},t)}function gN(e,t,n,r){const s=V(e,t,n);return Zl(s,r)}function hN(e,t={}){return Ee("AddImmutable",[e],t)}function eu(e,t={}){return Zl(e,t)}function bN(e,t={}){return Ee("Evaluate",[e],t)}function Mn(e,t={}){return og(e,t)}function xN(e,t={}){return Ee("Module",[e],t)}function kN(e,t={}){return Rg({},Mt([],[]),e,t)}function yN(e,t){const n=ia(e,t);return h(n,"right-inside")||h(n,"disjoint")?1:0}function nh(e,t,n=[]){return Te(t,(r,s)=>h(yN(e,r),1)?nh(e,s,[...n,r]):[...n,e,...t],()=>[...n,e])}function rh(e,t=[]){return Te(e,(n,r)=>rh(r,nh(n,t)),()=>t)}function SN(e){return rh(e)}function wN(...e){const[t,n,r]=at(e,{2:(i,a)=>ae(i)?[{},i,a]:[i,a,{}],3:(i,a,l)=>[i,a,l],1:i=>[{},i,{}]}),s=CT(n),o=z(s)&&h(s.length,2)?V(t,Mt([],[]),s[0]):Ct();return de(o,{},r)}const m=Object.freeze(Object.defineProperty({__proto__:null,Any:dl,Array:Sr,BigInt:pl,Boolean:bm,Call:OA,Capitalize:HA,Codec:fl,Conditional:t1,Constructor:wo,ConstructorParameters:s1,Cyclic:jo,Decode:yw,DecodeBuilder:hm,Dependent:Ti,Encode:Sw,EncodeBuilder:gm,Enum:QS,Evaluate:Mn,Exclude:a1,Extends:Wn,ExtendsResult:zT,Extract:l1,Function:vo,Generic:Io,Identifier:lc,Immutable:ww,Index:g1,Infer:ac,InstanceType:W1,Instantiate:Rs,Integer:Qi,Interface:WE,Intersect:Pn,IsAny:Cn,IsArray:ut,IsBigInt:Xr,IsBoolean:wr,IsCall:Kl,IsCodec:Yt,IsConstructor:ln,IsCyclic:Lt,IsDependent:dn,IsEnum:fn,IsEnumValue:JS,IsFunction:un,IsGeneric:ul,IsIdentifier:Ew,IsImmutable:Ei,IsInfer:Qt,IsInteger:$n,IsIntersect:Le,IsKind:Ie,IsLiteral:Ve,IsNever:Es,IsNull:Co,IsNumber:Zt,IsObject:De,IsOptional:Jt,IsParameter:Rw,IsReadonly:Pi,IsRecord:Tt,IsRef:ht,IsRefine:ml,IsRest:na,IsSchema:Wt,IsString:Tn,IsSymbol:To,IsTemplateLiteral:Bt,IsThis:Km,IsTuple:rt,IsUndefined:Ns,IsUnion:ce,IsUnknown:yn,IsUnsafe:cm,IsVoid:Zr,KeyOf:Y1,Literal:Fe,Lowercase:KA,Mapped:aP,Module:kN,Never:Ct,NonNullable:wP,Null:gl,Number:br,Object:Ne,Omit:jP,Optional:qS,Parameter:Eo,Parameters:AP,Partial:$P,Pick:LP,Readonly:vw,ReadonlyObject:Gg,ReadonlyType:HP,Record:xl,RecordKey:ea,RecordPattern:pn,RecordValue:Ut,Ref:on,Refine:jw,Required:sN,Rest:ta,ReturnType:iN,Script:wN,String:Rn,Symbol:hl,TemplateLiteral:KT,This:Hm,Tuple:mn,Uncapitalize:zA,Undefined:kl,Union:Ge,Unknown:Dt,Unsafe:zS,Uppercase:GA,Void:zm,With:Zg},Symbol.toStringTag,{value:"Module"}));function ca(e){return T(e,"~refine")&&z(e["~refine"])&&lt(e["~refine"],0,t=>re(t)&&T(t,"check")&&T(t,"error")&&kn(t.check)&&kn(t.error))}function Xt(e){return re(e)&&!z(e)}function Do(e){return mt(e)}function _e(e){return Xt(e)||Do(e)}function Lo(e){return T(e,"additionalItems")&&_e(e.additionalItems)}function Zn(e){return T(e,"additionalProperties")&&_e(e.additionalProperties)}function la(e){return T(e,"allOf")&&z(e.allOf)&&e.allOf.every(t=>_e(t))}function Ri(e){return T(e,"$anchor")&&ae(e.$anchor)}function ua(e){return T(e,"anyOf")&&z(e.anyOf)&&e.anyOf.every(t=>_e(t))}function da(e){return T(e,"const")}function rs(e){return T(e,"contains")&&_e(e.contains)}function vN(e){return T(e,"contentEncoding")&&ae(e.contentEncoding)}function IN(e){return T(e,"contentMediaType")&&ae(e.contentMediaType)}function jr(e){return T(e,"default")}function jN(e){return T(e,"$defs")&&re(e.$defs)&&Object.values(e.$defs).every(t=>_e(t))}function Uo(e){return T(e,"dependencies")&&re(e.dependencies)&&Object.values(e.dependencies).every(t=>_e(t)||z(t)&&t.every(n=>ae(n)))}function Bo(e){return T(e,"dependentRequired")&&re(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>z(t)&&t.every(n=>ae(n)))}function qo(e){return T(e,"dependentSchemas")&&re(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>_e(t))}function zr(e){return T(e,"$dynamicAnchor")&&ae(e.$dynamicAnchor)}function fa(e){return T(e,"$dynamicRef")&&ae(e.$dynamicRef)}function ma(e){return T(e,"else")&&_e(e.else)}function pa(e){return T(e,"enum")&&z(e.enum)}function Ho(e){return T(e,"exclusiveMaximum")&&(ve(e.exclusiveMaximum)||et(e.exclusiveMaximum))}function Cr(e){return T(e,"exclusiveMinimum")&&(ve(e.exclusiveMinimum)||et(e.exclusiveMinimum))}function Ms(e){return T(e,"format")&&ae(e.format)}function kr(e){return T(e,"$id")&&ae(e.$id)}function ga(e){return T(e,"if")&&_e(e.if)}function Tr(e){return T(e,"items")&&(_e(e.items)||z(e.items)&&e.items.every(t=>_e(t)))}function ha(e){return Tr(e)&&z(e.items)}function CN(e){return Tr(e)&&!z(e.items)}function Ko(e){return T(e,"maximum")&&(ve(e.maximum)||et(e.maximum))}function zo(e){return T(e,"maxContains")&&ve(e.maxContains)}function Os(e){return T(e,"maxItems")&&ve(e.maxItems)}function Go(e){return T(e,"maxLength")&&ve(e.maxLength)}function Vo(e){return T(e,"maxProperties")&&ve(e.maxProperties)}function Er(e){return T(e,"minimum")&&(ve(e.minimum)||et(e.minimum))}function ss(e){return T(e,"minContains")&&ve(e.minContains)}function os(e){return T(e,"minItems")&&ve(e.minItems)}function Fs(e){return T(e,"minLength")&&ve(e.minLength)}function _s(e){return T(e,"minProperties")&&ve(e.minProperties)}function Wo(e){return T(e,"multipleOf")&&(ve(e.multipleOf)||et(e.multipleOf))}function ba(e){return T(e,"not")&&_e(e.not)}function xa(e){return T(e,"oneOf")&&z(e.oneOf)&&e.oneOf.every(t=>_e(t))}function Ds(e){return T(e,"pattern")&&(ae(e.pattern)||e.pattern instanceof RegExp)}function is(e){return T(e,"patternProperties")&&re(e.patternProperties)&&Object.values(e.patternProperties).every(t=>_e(t))}function er(e){return T(e,"prefixItems")&&z(e.prefixItems)&&e.prefixItems.every(t=>_e(t))}function as(e){return T(e,"properties")&&re(e.properties)&&Object.values(e.properties).every(t=>_e(t))}function Jo(e){return T(e,"propertyNames")&&(re(e.propertyNames)||_e(e.propertyNames))}function sh(e){return T(e,"$recursiveAnchor")&&mt(e.$recursiveAnchor)}function bi(e){return sh(e)&&h(e.$recursiveAnchor,!0)}function ka(e){return T(e,"$recursiveRef")&&ae(e.$recursiveRef)}function ya(e){return T(e,"$ref")&&ae(e.$ref)}function tr(e){return T(e,"required")&&z(e.required)&&e.required.every(t=>ae(t))}function Sa(e){return T(e,"then")&&_e(e.then)}function Qo(e){return T(e,"type")&&(ae(e.type)||z(e.type)&&e.type.every(t=>ae(t)))}function yr(e){return T(e,"uniqueItems")&&mt(e.uniqueItems)}function Ls(e){return T(e,"unevaluatedItems")&&_e(e.unevaluatedItems)}function Us(e){return T(e,"unevaluatedProperties")&&_e(e.unevaluatedProperties)}function TN(e){return Ls(e)||Us(e)||Ts(L(e),t=>Mi(e[t]))}function EN(e){return Ts(e,t=>Mi(t))}function Mi(e){return z(e)?EN(e):re(e)?TN(e):!1}function oh(e,t){return Mi(t)||Ts(L(e),n=>Mi(e[n]))}class ih{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return ze(ue("context","Push"),[])}Pop(){return ze(ue("context","Pop"),[])}AddIndex(t){return ze(ue("context","AddIndex"),[t])}AddKey(t){return ze(ue("context","AddKey"),[t])}Merge(t){return ze(ue("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 tu extends On{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}}class Fn extends tu{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 ah(){Oi.variables=[]}function ch(){return{...Oi}}function lh(e,t,n,r){const s=cs(n["~refine"].map(o=>o));return Nn(s,G(0),["refinement","_"],ze(ue("refinement","check"),[r]))}function uh(e,t,n,r){return lt(n["~refine"],0,(s,o)=>s.check(r))}function dh(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 AN=0;function it(){return`var_${AN++}`}function nu(e){return Tr(e)&&z(e.items)}function PN(e,t,n,r){const[s,o]=[it(),it()],i=En(e,t,n.additionalItems,s),a=rl(o,G(n.items.length)),l=t.AddIndex(o);return Nn(r,G(0),[s,o],He(a,yt(i,l)))}function NN(e,t,n,r){const[s,o]=[it(),it()],i=En(e,t,n.additionalItems,s),a=rl(o,G(n.items.length));return Nn(r,G(0),[s,o],He(a,i))}function fh(e,t,n,r){return nu(n)?t.UseUnevaluated()?PN(e,t,n,r):NN(e,t,n,r):G(!0)}function mh(e,t,n,r){return nu(n)?lt(r,0,(o,i)=>xo(i,n.items.length)||Ar(e,t,n.additionalItems,o)&&t.AddIndex(i)):!0}function ph(e,t,n,r,s,o){return nu(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 $N(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function ru(e){const t=[];return is(e)&&t.push(...L(e.patternProperties)),as(e)&&t.push(...L(e.properties).map($N)),h(t.length,0)?"(?!)":`(${t.join("|")})`}function gh(e,t,n){return tr(t)&&as(t)&&!is(t)&&h(t.additionalProperties,!1)&&h(L(t.properties).length,t.required.length)}function hh(e,t,n){return Kt(ue(ze(ue("Object","getOwnPropertyNames"),[n]),"length"),G(t.required.length))}function bh(e,t,n,r){const[s,o]=[it(),it()],i=cs(new RegExp(ru(n))),a=En(e,t,n.additionalProperties,`${r}[${s}]`),l=ze(ue(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 xh(e,t,n,r){return gh(t,n)?hh(t,n,r):bh(e,t,n,r)}function kh(e,t,n,r){const s=new RegExp(ru(n));return lt(L(r),0,(i,a)=>s.test(i)||Ar(e,t,n.additionalProperties,r[i])&&t.AddKey(i))}function yh(e,t,n,r,s,o){const i=new RegExp(ru(s)),a=[];return jt(L(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}`,sl("CheckContext",[]))),a=n.map((f,p)=>Hn(`condition_${p}`,ze(gr(["context"],st(e,t,f,r)),[`context_${p}`]))),l=n.map((f,p)=>tm(`condition_${p}`,ze(ue("results","push"),[`context_${p}`]))),u=Wi(yt(s,t.Merge("results")));return ze(gr([],Vi([o,...i,...a,...l,u])),[])}function RN(e,t,n,r){return Yo(e,t,n.allOf,r,Kt(ue("results","length"),G(n.allOf.length)))}function MN(e,t,n,r){return vt(n.allOf.map(s=>st(e,t,s,r)))}function Sh(e,t,n,r){return t.UseUnevaluated()?RN(e,t,n,r):MN(e,t,n,r)}function wh(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 vh(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 ON(e,t,n,r){return Yo(e,t,n.anyOf,r,Xf(ue("results","length"),G(0)))}function FN(e,t,n,r){return ol(n.anyOf.map(s=>st(e,t,s,r)))}function Ih(e,t,n,r){return t.UseUnevaluated()?ON(e,t,n,r):FN(e,t,n,r)}function jh(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 Ch(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 Th(e,t,n,r){return G(!!n)}function su(e,t,n,r){return n}function Eh(e,t,n,r,s,o){return su(e,t,s)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:r,params:{}})}function Ah(e,t,n,r){return Cs(n.const)?Kt(r,G(n.const)):em(r,cs(n.const))}function ou(e,t,n,r){return Cs(n.const)?h(r,n.const):Jr(r,n.const)}function Ph(e,t,n,r,s,o){return ou(e,t,s,o)||t.AddError({keyword:"const",schemaPath:n,instancePath:r,params:{allowedValue:s.const}})}function Nh(e){return!(ss(e)&&h(e.minContains,0))}function _N(e,t,n,r){const[s,o]=[it(),it()],i=Pt(Kt(ue(r,"length"),G(0))),a=hS(r,[s,o],yt(st(e,t,n.contains,s),t.AddIndex(o)));return yt(i,a)}function DN(e,t,n,r){const[s]=[it()],o=Pt(Kt(ue(r,"length"),G(0))),i=gS(r,[s,"_"],st(e,t,n.contains,s));return yt(o,i)}function $h(e,t,n,r){return Nh(n)?t.UseUnevaluated()?_N(e,t,n,r):DN(e,t,n,r):G(!0)}function iu(e,t,n,r){return Nh(n)?!h(r.length,0)&&Gf(r,(s,o)=>ot(e,t,n.contains,s)&&t.AddIndex(o)):!0}function Rh(e,t,n,r,s,o){return iu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:1}})}function Mh(e,t,n,r){const s=Kt(ue(Yr(r),"length"),G(0)),o=vt(tt(n.dependencies).map(([i,a])=>{const l=Pt(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 Oh(e,t,n,r){const s=h(L(r).length,0),o=lt(tt(n.dependencies),0,([i,a])=>!T(r,i)||(z(a)?a.every(l=>T(r,l)):ot(e,t,a,r)));return s||o}function Fh(e,t,n,r,s,o){const i=h(L(o).length,0),a=jt(tt(s.dependencies),0,([l,u])=>{const f=`${n}/dependencies/${l}`;return!T(o,l)||(z(u)?u.every(p=>T(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 _h(e,t,n,r){const s=Kt(ue(Yr(r),"length"),G(0)),o=vt(tt(n.dependentRequired).map(([i,a])=>{const l=Pt(Br(r,G(i))),u=vt(a.map(f=>Br(r,G(f))));return He(l,u)}));return He(s,o)}function Dh(e,t,n,r){const s=h(L(r).length,0),o=lt(tt(n.dependentRequired),0,([i,a])=>!T(r,i)||a.every(l=>T(r,l)));return s||o}function Lh(e,t,n,r,s,o){const i=h(L(o).length,0),a=jt(tt(s.dependentRequired),0,([l,u])=>!T(o,l)||jt(u,0,f=>T(o,f)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:r,params:{property:l,dependencies:u}})));return i||a}function Uh(e,t,n,r){const s=Kt(ue(Yr(r),"length"),G(0)),o=vt(tt(n.dependentSchemas).map(([i,a])=>{const l=Pt(Br(r,G(i))),u=st(e,t,a,r);return He(l,u)}));return He(s,o)}function Bh(e,t,n,r){const s=h(L(r).length,0),o=lt(tt(n.dependentSchemas),0,([i,a])=>!T(r,i)||ot(e,t,a,r));return s||o}function qh(e,t,n,r,s,o){const i=h(L(o).length,0),a=jt(tt(s.dependentSchemas),0,([l,u])=>{const f=`${n}/dependentSchemas/${l}`;return!T(o,l)||It(e,t,f,r,u,o)});return i||a}function LN(e,t,n,r){const s=e.DynamicRef(n)??!1;return Bs(e,t,s,r)}function UN(e,t,n,r){const s=e.DynamicRef(n)??!1;return _e(s)&&ot(e,t,s,r)}function BN(e,t,n,r,s,o){const i=e.DynamicRef(s)??!1;return _e(i)&&It(e,t,"#",r,i,o)}function Hh(e,t,n,r){return ol(n.enum.map(s=>{if(Cs(s))return Kt(r,G(s));const o=cs(s);return em(r,o)}))}function au(e,t,n,r){return Ts(n.enum,s=>Cs(s)?h(r,s):Jr(r,s))}function Kh(e,t,n,r,s,o){return au(e,t,s,o)||t.AddError({keyword:"enum",schemaPath:n,instancePath:r,params:{allowedValues:s.enum}})}function zh(e,t,n,r){return rl(r,G(n.exclusiveMaximum))}function cu(e,t,n,r){return xo(r,n.exclusiveMaximum)}function Gh(e,t,n,r,s,o){return cu(e,t,s,o)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:r,params:{comparison:"<",limit:s.exclusiveMaximum}})}function Vh(e,t,n,r){return Xf(r,G(n.exclusiveMinimum))}function lu(e,t,n,r){return Wr(r,n.exclusiveMinimum)}function Wh(e,t,n,r,s,o){return lu(e,t,s,o)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:r,params:{comparison:">",limit:s.exclusiveMinimum}})}const qN=[0,31,28,31,30,31,30,31,31,30,31,30,31],HN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function KN(e){return e%4===0&&(e%100!==0||e%400===0)}function uu(e){const t=HN.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&&KN(n)?29:qN[r])}const zN=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function du(e,t=!0){const n=zN.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 Jh(e,t=!0){const n=e.split(/T/i);return n.length===2&&uu(n[0])&&du(n[1],t)}const GN=/^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 Qh(e){return GN.test(e)}const VN=/^(?!.*\.\.)[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 Yh(e){return VN.test(e)}const Lr=36,xi=1,wc=26,WN=38,JN=700,QN=72,YN=128;function XN(e,t,n){e=n?Math.floor(e/JN):e>>1,e+=Math.floor(e/t);let r=0;for(;e>(Lr-xi)*wc>>1;)e=Math.floor(e/(Lr-xi)),r+=Lr;return r+Math.floor((Lr-xi+1)*e/(e+WN))}function ZN(e){const t=[];let n=YN,r=0,s=QN;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)Nt();else throw new Error("Invalid punycode: bad digit character");r+=g*l;const k=u<=s?xi:u>=s+wc?wc:u-s;if(g<k)break;l*=Lr-k,u+=Lr}const f=t.length+1;s=XN(r-a,f,a===0),n+=Math.floor(r/f),r%=f,t.splice(r,0,n),r++}return globalThis.String.fromCodePoint(...t)}function e$(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function t$(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function n$(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function r$(e){return e$(e)||t$(e)||n$(e)}const s$=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),o$=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 i$(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function a$(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function c$(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function l$(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function u$(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function d$(e){return e>=1632&&e<=1641}function f$(e){return e>=1776&&e<=1785}function Ud(e){return o$.has(e)}function Xh(e){if(e.length===0)return Nt();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||r$(t[0]))return!1;let r=!1,s=!1,o=!1;for(let i=0;i<n;i++){const a=t[i];if(s$.has(a))return!1;(c$(a)||l$(a)||u$(a))&&(r=!0),d$(a)&&(s=!0),f$(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||!i$(u))return!1;break;case 1523:case 1524:if(l===void 0||!a$(l))return!1;break;case 8204:if(l===void 0||l<128&&!Ud(l))return!1;break;case 8205:if(l===void 0||!Ud(l))return!1;break}}return!(e.includes("・")&&!r||s&&o)}function m$(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 Zh(e){return e.toLowerCase().startsWith("xn--")}function eb(e){try{const t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;const r=ZN(t);return r?Xh(r):!1}catch{return!1}}function p$(e){return e.length===0||e.length>63?!1:Zh(e)?eb(e):Xh(e)}function g$(e){return e.length===0||e.length>63?!1:Zh(e)?eb(e):m$(e)}function tb(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(const t of e.split("."))if(!g$(t))return!1;return!0}const h$=/^(?!.*\.\.)[\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 nb(e){return h$.test(e)}function rb(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(!p$(n))return!1;return!0}function sb(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 ob(e){return sb(e,0,e.length)}function b$(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function ib(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&&b$(e.charCodeAt(s));)s++,o++;if(o===0)return!1;const a=e.charCodeAt(s);if(a===46){if(!sb(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 Bd(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function ab(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))?Bd(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:Bd(e)}function cb(e){try{return new URL(e),!0}catch{return!1}}const x$=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function lb(e){return x$.test(e)}const k$=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function ub(e){return k$.test(e)}function db(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}const y$=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function fb(e){return y$.test(e)}const S$=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function mb(e){return S$.test(e)}const w$=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function pb(e){return w$.test(e)}function gb(e){return e>=97&&e<=122||e>=65&&e<=90}function hb(e){return gb(e)||e>=48&&e<=57}function fi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function v$(e){return hb(e)||e===43||e===45||e===46}function vc(e){return hb(e)||e===45||e===46||e===95||e===126}function Ic(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 I$(e){return vc(e)||Ic(e)||e===58||e===64}function bb(e){const t=e.length;if(t===0||!gb(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){const r=e.charCodeAt(n);if(r===58)break;if(!v$(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(!vc(i)&&!Ic(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&&!vc(o)&&!Ic(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(!(I$(r)||r===47||r===63||r===35))return!1}n++}return!0}const j$=/^(?: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 xb(e){return j$.test(e)}const C$=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function kb(e){return C$.test(e)}const qe=new Map;function yb(){qe.clear()}function T$(){return[...qe.entries()]}function E$(e,t){qe.set(e,t)}function A$(e){return qe.has(e)}function P$(e){return qe.get(e)}function Sb(e,t){var n;return((n=qe.get(e))==null?void 0:n(t))??!0}function wb(){yb(),qe.set("date-time",Jh),qe.set("date",uu),qe.set("duration",Qh),qe.set("email",Yh),qe.set("hostname",tb),qe.set("idn-email",nb),qe.set("idn-hostname",rb),qe.set("ipv4",ob),qe.set("ipv6",ib),qe.set("iri-reference",ab),qe.set("iri",cb),qe.set("json-pointer-uri-fragment",lb),qe.set("json-pointer",ub),qe.set("regex",db),qe.set("relative-json-pointer",fb),qe.set("time",du),qe.set("uri-reference",mb),qe.set("uri-template",pb),qe.set("uri",bb),qe.set("url",xb),qe.set("uuid",kb)}wb();const N$=Object.freeze(Object.defineProperty({__proto__:null,Clear:yb,Entries:T$,Get:P$,Has:A$,IsDate:uu,IsDateTime:Jh,IsDuration:Qh,IsEmail:Yh,IsHostname:tb,IsIPv4:ob,IsIPv6:ib,IsIdnEmail:nb,IsIdnHostname:rb,IsIri:cb,IsIriReference:ab,IsJsonPointer:ub,IsJsonPointerUriFragment:lb,IsRegex:db,IsRelativeJsonPointer:fb,IsTime:du,IsUri:bb,IsUriReference:mb,IsUriTemplate:pb,IsUrl:xb,IsUuid:kb,Reset:wb,Set:E$,Test:Sb},Symbol.toStringTag,{value:"Module"}));function vb(e,t,n,r){return ze(ue("Format","Test"),[G(n.format),r])}function fu(e,t,n,r){return Sb(n.format,r)}function Ib(e,t,n,r,s,o){return fu(e,t,s,o)||t.AddError({keyword:"format",schemaPath:n,instancePath:r,params:{format:s.format}})}function jb(e,t,n,r){const s=Sa(n)?n.then:!0,o=ma(n)?n.else:!0;return xS(st(e,t,n.if,r),st(e,t,s,r),st(e,t,o,r))}function Cb(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 Tb(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 $$(e,t,n,r){return vt(n.items.map((s,o)=>{const i=Qr(ue(r,"length"),G(o)),a=En(e,t,s,`${r}[${o}]`),l=t.AddIndex(G(o));return He(i,yt(a,l))}))}function R$(e,t,n,r){return vt(n.items.map((s,o)=>{const i=Qr(ue(r,"length"),G(o)),a=En(e,t,s,`${r}[${o}]`);return He(i,a)}))}function M$(e,t,n,r){return t.UseUnevaluated()?$$(e,t,n,r):R$(e,t,n,r)}function O$(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 F$(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 _$(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 D$(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 L$(e,t,n,r){return t.UseUnevaluated()?_$(e,t,n,r):D$(e,t,n,r)}function U$(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 B$(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 Eb(e,t,n,r){return ha(n)?M$(e,t,n,r):L$(e,t,n,r)}function Ab(e,t,n,r){return ha(n)?O$(e,t,n,r):U$(e,t,n,r)}function Pb(e,t,n,r,s,o){return ha(s)?F$(e,t,n,r,s,o):B$(e,t,n,r,s,o)}function Nb(e){return rs(e)}function $b(e,t,n,r){if(!Nb(n))return G(!0);const[s]=[it()],o=Gi(r,[s,"_"],st(e,t,n.contains,s));return Qr(o,G(n.maxContains))}function mu(e,t,n,r){if(!Nb(n))return!0;const s=Zc(r,o=>ot(e,t,n.contains,o));return Jn(s,n.maxContains)}function Rb(e,t,n,r,s,o){const i=ss(s)?s.minContains:1;return mu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:i,maxContains:s.maxContains}})}function Mb(e,t,n,r){return Qr(r,G(n.maximum))}function pu(e,t,n,r){return Jn(r,n.maximum)}function Ob(e,t,n,r,s,o){return pu(e,t,s,o)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:r,params:{comparison:"<=",limit:s.maximum}})}function Fb(e,t,n,r){return Qr(ue(r,"length"),G(n.maxItems))}function gu(e,t,n,r){return Jn(r.length,n.maxItems)}function _b(e,t,n,r,s,o){return gu(e,t,s,o)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:r,params:{limit:s.maxItems}})}function Db(e,t,n,r){return pS(r,G(n.maxLength))}function hu(e,t,n,r){return Kf(r,n.maxLength)}function Lb(e,t,n,r,s,o){return hu(e,t,s,o)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:r,params:{limit:s.maxLength}})}function Ub(e,t,n,r){return Qr(ue(Yr(r),"length"),G(n.maxProperties))}function bu(e,t,n,r){return Jn(L(r).length,n.maxProperties)}function Bb(e,t,n,r,s,o){return bu(e,t,s,o)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:r,params:{limit:s.maxProperties}})}function qb(e){return rs(e)}function q$(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 H$(e,t,n,r){const[s]=[it()],o=Gi(r,[s,"_"],st(e,t,n.contains,s));return ko(o,G(n.minContains))}function Hb(e,t,n,r){return qb(n)?t.UseUnevaluated()?q$(e,t,n,r):H$(e,t,n,r):G(!0)}function xu(e,t,n,r){if(!qb(n))return!0;const s=Zc(r,(o,i)=>ot(e,t,n.contains,o)&&t.AddIndex(i));return js(s,n.minContains)}function Kb(e,t,n,r,s,o){return xu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:s.minContains}})}function zb(e,t,n,r){return ko(r,G(n.minimum))}function ku(e,t,n,r){return js(r,n.minimum)}function Gb(e,t,n,r,s,o){return ku(e,t,s,o)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:r,params:{comparison:">=",limit:s.minimum}})}function Vb(e,t,n,r){return ko(ue(r,"length"),G(n.minItems))}function yu(e,t,n,r){return js(r.length,n.minItems)}function Wb(e,t,n,r,s,o){return yu(e,t,s,o)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:r,params:{limit:s.minItems}})}function Jb(e,t,n,r){return mS(r,G(n.minLength))}function Su(e,t,n,r){return zf(r,n.minLength)}function Qb(e,t,n,r,s,o){return Su(e,t,s,o)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:r,params:{limit:s.minLength}})}function Yb(e,t,n,r){return ko(ue(Yr(r),"length"),G(n.minProperties))}function wu(e,t,n,r){return js(L(r).length,n.minProperties)}function Xb(e,t,n,r,s,o){return wu(e,t,s,o)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:r,params:{limit:s.minProperties}})}function Zb(e,t,n,r){return kS(r,G(n.multipleOf))}function vu(e,t,n,r){return qf(r,n.multipleOf)}function ex(e,t,n,r,s,o){return vu(e,t,s,o)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:r,params:{multipleOf:s.multipleOf}})}function K$(e,t,n,r){return Yo(e,t,[n.not],r,Pt(Kt(ue("results","length"),G(1))))}function z$(e,t,n,r){return Pt(st(e,t,n.not,r))}function tx(e,t,n,r){return t.UseUnevaluated()?K$(e,t,n,r):z$(e,t,n,r)}function Iu(e,t,n,r){const s=new On;return!ot(e,s,n.not,r)&&t.Merge([s])}function nx(e,t,n,r,s,o){return Iu(e,t,s,o)||t.AddError({keyword:"not",schemaPath:n,instancePath:r,params:{}})}function G$(e,t,n,r){return Yo(e,t,n.oneOf,r,Kt(ue("results","length"),G(1)))}function V$(e,t,n,r){const[s]=[it()],o=bS(n.oneOf.map(a=>st(e,t,a,r))),i=Gi(o,[s,"_"],Kt(s,G(!0)));return Kt(i,G(1))}function rx(e,t,n,r){return t.UseUnevaluated()?G$(e,t,n,r):V$(e,t,n,r)}function sx(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 ox(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 ix(e,t,n,r){const s=cs(ae(n.pattern)?new RegExp(n.pattern,"u"):n.pattern);return ze(ue(s,"test"),[r])}function ju(e,t,n,r){return(ae(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(r)}function ax(e,t,n,r,s,o){return ju(e,t,s,o)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:r,params:{pattern:s.pattern}})}function cx(e,t,n,r){return vt(tt(n.patternProperties).map(([s,o])=>{const[i,a]=[it(),it()],l=cs(new RegExp(s,"u")),u=Pt(ze(ue(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(Zf(r),G(0),[`[${i}, ${a}]`,"_"],g)}))}function lx(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 ux(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 dx(e,t,n,r){return vt(n.prefixItems.map((s,o)=>{const i=Qr(ue(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 fx(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 mx(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 Cu(e,t){return e.includes(t)||So().exactOptionalPropertyTypes}function W$(e,t){return ic(ue(e,t))}function px(e,t){return Me(e[t])}function gx(e,t,n,r){const s=tr(n)?n.required:[],o=tt(n.properties).map(([i,a])=>{const l=Pt(Br(r,G(i))),u=En(e,t,a,ue(r,i)),f=t.AddKey(G(i)),p=t.UseUnevaluated()?yt(u,f):u,g=s.includes(i)?p:He(l,p);return Cu(s,i)?g:He(W$(r,i),g)});return vt(o)}function hx(e,t,n,r){const s=tr(n)?n.required:[];return lt(tt(n.properties),0,([i,a])=>{const l=!T(r,i)||Ar(e,t,a,r[i])&&t.AddKey(i);return Cu(s,i)?l:px(r,i)||l})}function bx(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=()=>!T(o,l)||Pr(e,t,f,p,u,o[l])&&t.AddKey(l);return Cu(i,l)?g():px(o,l)||g()})}function xx(e,t,n,r){const[s,o]=[it(),it()];return Nn(Yr(r),G(0),[s,o],st(e,t,n.propertyNames,s))}function kx(e,t,n,r){return lt(L(r),0,(s,o)=>ot(e,t,n.propertyNames,s))}function yx(e,t,n,r,s,o){const i=[];return jt(L(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 Sx(e,t,n,r){const s=e.RecursiveRef(n)??!1;return Bs(e,t,s,r)}function wx(e,t,n,r){const s=e.RecursiveRef(n)??!1;return _e(s)&&ot(e,t,s,r)}function vx(e,t,n,r,s,o){const i=e.RecursiveRef(s)??!1;return _e(i)&&It(e,t,"#",r,i,o)}function J$(e,t,n,r){const s=gr(["context","value"],Bs(e,t,n,"value")),o=gr(["context","value"],Vi([Hn("nextContext",sl("CheckContext",[])),Hn("result",ze(s,["nextContext","value"])),tm("result",t.Merge("[nextContext]")),Wi("result")]));return ze(o,["context",r])}function Q$(e,t,n,r){return Bs(e,t,n,r)}function Ix(e,t,n,r){const s=e.Ref(n)??!1;return t.UseUnevaluated()?J$(e,t,s,r):Q$(e,t,s,r)}function jx(e,t,n,r){const s=e.Ref(n)??!1,o=new On,i=_e(s)&&ot(e,o,s,r);return i&&t.Merge([o]),i}function Cx(e,t,n,r,s,o){const i=e.Ref(s)??!1,a=new Fn,l=_e(i)&&It(e,a,"#",r,i,o);return l&&t.Merge([a]),l||a.GetErrors().forEach(u=>t.AddError(u)),l}function Tx(e,t,n,r){return vt(n.required.map(s=>Br(r,G(s))))}function Ex(e,t,n,r){return lt(n.required,0,s=>T(r,s))}function Ax(e,t,n,r,s,o){const i=[];return jt(s.required,0,l=>{const u=T(o,l);return u||i.push(l),u})||t.AddError({keyword:"required",schemaPath:n,instancePath:r,params:{requiredProperties:i}})}function Px(e,t,n,r){return h(n,"object")?Jf(r):h(n,"array")?ji(r):h(n,"boolean")?aS(r):h(n,"integer")?cS(r):h(n,"number")?Wf(r):h(n,"null")?lS(r):h(n,"string")?Yf(r):h(n,"bigint")?Vf(r):h(n,"constructor")?fS(r):h(n,"function")?dS(r):h(n,"symbol")?uS(r):h(n,"undefined")||h(n,"void")?ic(r):G(!0)}function Tu(e,t,n,r,s){return h(n,"object")?cn(s):h(n,"array")?z(s):h(n,"boolean")?mt(s):h(n,"integer")?Yc(s):h(n,"number")?ve(s):h(n,"null")?zt(s):h(n,"string")?ae(s):h(n,"bigint")?et(s):h(n,"constructor")?zi(s):h(n,"function")?kn(s):h(n,"symbol")?Xc(s):h(n,"undefined")||h(n,"void")?Me(s):!0}function Y$(e,t,n,r){return ol(n.map(s=>Px(e,t,s,r)))}function Nx(e,t,n,r,s){return Ts(n,o=>Tu(e,t,o,r,s))}function $x(e,t,n,r){return z(n.type)?Y$(e,t,n.type,r):Px(e,t,n.type,r)}function Rx(e,t,n,r){return z(n.type)?Nx(e,t,n.type,n,r):Tu(e,t,n.type,n,r)}function Mx(e,t,n,r,s,o){return(z(s.type)?Nx(e,t,s.type,s,o):Tu(e,t,s.type,s,o))||t.AddError({keyword:"type",schemaPath:n,instancePath:r,params:{type:s.type}})}function Ox(e,t,n,r){const[s,o]=[it(),it()],i=ze(ue("context","GetIndices"),[]),a=ze(ue("indices","has"),[s]),l=st(e,t,n.unevaluatedItems,o),u=ze(ue("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 Fx(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 _x(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 Dx(e,t,n,r){const[s,o]=[it(),it()],i=ze(ue("context","GetKeys"),[]),a=ze(ue("keys","has"),[s]),l=ze(ue("context","AddKey"),[s]),u=st(e,t,n.unevaluatedProperties,o),f=Nn(Zf(r),G(0),[`[${s}, ${o}]`,"_"],He(a,yt(u,l)));return ze(gr(["context"],Vi([Hn("keys",i),Wi(f)])),["context"])}function Lx(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 Ux(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 Eu(e){return!h(e.uniqueItems,!1)}function Bx(e,t,n,r){if(!Eu(n))return G(!0);const s=ue(sl("Set",[ze(ue(r,"map"),[ue("Hashing","Hash")])]),"size"),o=ue(r,"length");return Kt(s,o)}function qx(e,t,n,r){if(!Eu(n))return!0;const s=new Set(r.map(Ji)).size,o=r.length;return h(s,o)}function Hx(e,t,n,r,s,o){if(!Eu(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 X$(e){return mo(e,"object")}function Z$(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 eR(e){return mo(e,"array")}function tR(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 nR(e){return mo(e,"string")}function rR(e){return Xt(e)&&(Fs(e)||Go(e)||Ms(e)||Ds(e))}function sR(e){return mo(e,"number")||mo(e,"bigint")}function oR(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 Th(e,t,n);if(Qo(n)&&s.push($x(e,t,n,r)),Z$(n)){const i=[];tr(n)&&i.push(Tx(e,t,n,r)),Zn(n)&&i.push(xh(e,t,n,r)),Uo(n)&&i.push(Mh(e,t,n,r)),Bo(n)&&i.push(_h(e,t,n,r)),qo(n)&&i.push(Uh(e,t,n,r)),is(n)&&i.push(cx(e,t,n,r)),as(n)&&i.push(gx(e,t,n,r)),Jo(n)&&i.push(xx(e,t,n,r)),_s(n)&&i.push(Yb(e,t,n,r)),Vo(n)&&i.push(Ub(e,t,n,r));const a=vt(i),l=He(Pt(Jf(r)),a);s.push(X$(n)?a:l)}if(tR(n)){const i=[];Lo(n)&&i.push(fh(e,t,n,r)),rs(n)&&i.push($h(e,t,n,r)),Tr(n)&&i.push(Eb(e,t,n,r)),zo(n)&&i.push($b(e,t,n,r)),Os(n)&&i.push(Fb(e,t,n,r)),ss(n)&&i.push(Hb(e,t,n,r)),os(n)&&i.push(Vb(e,t,n,r)),er(n)&&i.push(dx(e,t,n,r)),yr(n)&&i.push(Bx(e,t,n,r));const a=vt(i),l=He(Pt(ji(r)),a);s.push(eR(n)?a:l)}if(rR(n)){const i=[];Go(n)&&i.push(Db(e,t,n,r)),Fs(n)&&i.push(Jb(e,t,n,r)),Ms(n)&&i.push(vb(e,t,n,r)),Ds(n)&&i.push(ix(e,t,n,r));const a=vt(i),l=He(Pt(Yf(r)),a);s.push(nR(n)?a:l)}if(oR(n)){const i=[];Ho(n)&&i.push(zh(e,t,n,r)),Cr(n)&&i.push(Vh(e,t,n,r)),Ko(n)&&i.push(Mb(e,t,n,r)),Er(n)&&i.push(zb(e,t,n,r)),Wo(n)&&i.push(Zb(e,t,n,r));const a=vt(i),l=He(Pt(He(Wf(r),Vf(r))),a);s.push(sR(n)?a:l)}ya(n)&&s.push(Ix(e,t,n,r)),ka(n)&&s.push(Sx(e,t,n,r)),fa(n)&&s.push(LN(e,t,n,r)),da(n)&&s.push(Ah(e,t,n,r)),pa(n)&&s.push(Hh(e,t,n,r)),ga(n)&&s.push(jb(e,t,n,r)),ba(n)&&s.push(tx(e,t,n,r)),la(n)&&s.push(Sh(e,t,n,r)),ua(n)&&s.push(Ih(e,t,n,r)),xa(n)&&s.push(rx(e,t,n,r)),Ls(n)&&s.push(He(Pt(ji(r)),Ox(e,t,n,r))),Us(n)&&s.push(He(Pt(Qf(r)),Dx(e,t,n,r))),ca(n)&&s.push(lh(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)?su(e,t,n):(!Qo(n)||Rx(e,t,n,r))&&(!(re(r)&&!z(r))||(!tr(n)||Ex(e,t,n,r))&&(!Zn(n)||kh(e,t,n,r))&&(!Uo(n)||Oh(e,t,n,r))&&(!Bo(n)||Dh(e,t,n,r))&&(!qo(n)||Bh(e,t,n,r))&&(!is(n)||lx(e,t,n,r))&&(!as(n)||hx(e,t,n,r))&&(!Jo(n)||kx(e,t,n,r))&&(!_s(n)||wu(e,t,n,r))&&(!Vo(n)||bu(e,t,n,r)))&&(!z(r)||(!Lo(n)||mh(e,t,n,r))&&(!rs(n)||iu(e,t,n,r))&&(!Tr(n)||Ab(e,t,n,r))&&(!zo(n)||mu(e,t,n,r))&&(!Os(n)||gu(e,t,n,r))&&(!ss(n)||xu(e,t,n,r))&&(!os(n)||yu(e,t,n,r))&&(!er(n)||fx(e,t,n,r))&&(!yr(n)||qx(e,t,n,r)))&&(!ae(r)||(!Go(n)||hu(e,t,n,r))&&(!Fs(n)||Su(e,t,n,r))&&(!Ms(n)||fu(e,t,n,r))&&(!Ds(n)||ju(e,t,n,r)))&&(!(ve(r)||et(r))||(!Ho(n)||cu(e,t,n,r))&&(!Cr(n)||lu(e,t,n,r))&&(!Ko(n)||pu(e,t,n,r))&&(!Er(n)||ku(e,t,n,r))&&(!Wo(n)||vu(e,t,n,r)))&&(!ya(n)||jx(e,t,n,r))&&(!ka(n)||wx(e,t,n,r))&&(!fa(n)||UN(e,t,n,r))&&(!da(n)||ou(e,t,n,r))&&(!pa(n)||au(e,t,n,r))&&(!ga(n)||Cb(e,t,n,r))&&(!ba(n)||Iu(e,t,n,r))&&(!la(n)||wh(e,t,n,r))&&(!ua(n)||jh(e,t,n,r))&&(!xa(n)||sx(e,t,n,r))&&(!Ls(n)||!z(r)||Fx(e,t,n,r))&&(!Us(n)||!re(r)||Lx(e,t,n,r))&&(!ca(n)||uh(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)?Eh(e,t,n,r,s):!!(+(!Qo(s)||Mx(e,t,n,r,s,o))&+(!(re(o)&&!z(o))||!!(+(!tr(s)||Ax(e,t,n,r,s,o))&+(!Zn(s)||yh(e,t,n,r,s,o))&+(!Uo(s)||Fh(e,t,n,r,s,o))&+(!Bo(s)||Lh(e,t,n,r,s,o))&+(!qo(s)||qh(e,t,n,r,s,o))&+(!is(s)||ux(e,t,n,r,s,o))&+(!as(s)||bx(e,t,n,r,s,o))&+(!Jo(s)||yx(e,t,n,r,s,o))&+(!_s(s)||Xb(e,t,n,r,s,o))&+(!Vo(s)||Bb(e,t,n,r,s,o))))&+(!z(o)||!!(+(!Lo(s)||ph(e,t,n,r,s,o))&+(!rs(s)||Rh(e,t,n,r,s,o))&+(!Tr(s)||Pb(e,t,n,r,s,o))&+(!zo(s)||Rb(e,t,n,r,s,o))&+(!Os(s)||_b(e,t,n,r,s,o))&+(!ss(s)||Kb(e,t,n,r,s,o))&+(!os(s)||Wb(e,t,n,r,s,o))&+(!er(s)||mx(e,t,n,r,s,o))&+(!yr(s)||Hx(e,t,n,r,s,o))))&+(!ae(o)||!!(+(!Go(s)||Lb(e,t,n,r,s,o))&+(!Fs(s)||Qb(e,t,n,r,s,o))&+(!Ms(s)||Ib(e,t,n,r,s,o))&+(!Ds(s)||ax(e,t,n,r,s,o))))&+(!(ve(o)||et(o))||!!(+(!Ho(s)||Gh(e,t,n,r,s,o))&+(!Cr(s)||Wh(e,t,n,r,s,o))&+(!Ko(s)||Ob(e,t,n,r,s,o))&+(!Er(s)||Gb(e,t,n,r,s,o))&+(!Wo(s)||ex(e,t,n,r,s,o))))&+(!ya(s)||Cx(e,t,n,r,s,o))&+(!ka(s)||vx(e,t,n,r,s,o))&+(!fa(s)||BN(e,t,n,r,s,o))&+(!da(s)||Ph(e,t,n,r,s,o))&+(!pa(s)||Kh(e,t,n,r,s,o))&+(!ga(s)||Tb(e,t,n,r,s,o))&+(!ba(s)||nx(e,t,n,r,s,o))&+(!la(s)||vh(e,t,n,r,s,o))&+(!ua(s)||Ch(e,t,n,r,s,o))&+(!xa(s)||ox(e,t,n,r,s,o))&+(!Ls(s)||!z(o)||_x(e,t,n,r,s,o))&+(!Us(s)||!re(o)||Ux(e,t,n,r,s,o)))&&(!ca(s)||dh(e,t,n,r,s,o));return e.Pop(s),i}const Kx=[0],ki=new Map,oo=new Map;function iR(){return`${Kx[0]++}`}function aR(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=iR();return n.set(t,r),r}function cR(e,t,n,r){return e.UseUnevaluated()?ze(`check_${n}`,["context",r]):ze(`check_${n}`,[r])}function lR(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 zx(){Kx[0]=0,ki.clear(),oo.clear()}function Gx(){return[...oo.values()]}function Bs(e,t,n,r){const s=aR(n,e.BaseURL().href),o=cR(t,n,s,r);return oo.has(s)||(oo.set(s,""),oo.set(s,lR(e,t,n,s))),o}function Vx(e){if(e.length===0)throw Error("Cannot set root")}function Wx(e){if(!re(e))throw Error("Cannot set value")}function uR(e){if(qn(e))throw Error("Pointer contains unsafe property key")}function Jx(e){for(const t of e)uR(t)}function dR(e){return/^(0|[1-9]\d*)$/.test(e)}function Qx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function fR(e,t){return re(t)&&T(t,e)}function mR(e,t){return re(t)&&!qn(e)?t[e]:void 0}function Au(e,t){return e.reduce((n,r)=>mR(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 pR(e,t){let n=e;return Xo(t).every(r=>fR(r,n)?(n=n[r],!0):!1)}function Yx(e,t){const n=Xo(t);return Au(n,e)}function jc(e,t,n){const r=Xo(t);Vx(r),Jx(r);const[s,o]=Qx(r),i=Au(s,e);return Wx(i),i[o]=n,e}function Xx(e,t){const n=Xo(t);Vx(n),Jx(n);const[r,s]=Qx(n),o=Au(r,e);return Wx(o),z(o)&&dR(s)?o.splice(+s,1):delete o[s],e}const Zx=Object.freeze(Object.defineProperty({__proto__:null,Delete:Xx,Get:Yx,Has:pR,Indices:Xo,Set:jc},Symbol.toStringTag,{value:"Module"}));function gR(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("#")?ek(e,t,n):e}function hR(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 bR(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 ek(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 Yx(e,r)}function xR(e,t,n){if(kr(e)){const r=gR(e,t,n);if(!Me(r))return r}if(Ri(e)){const r=hR(e,t,n);if(!Me(r))return r}if(zr(e)){const r=bR(e,t,n);if(!Me(r))return r}return ek(e,t,n)}function kR(e,t,n){return e.reduce((r,s)=>{const o=Pu(s,t,n);return Me(o)?r:o},void 0)}function yR(e,t,n){return L(e).reduce((r,s)=>{const o=Pu(e[s],t,n);return Me(o)?r:o},void 0)}function Pu(e,t,n){const r=Xt(e)&&kr(e)?new URL(e.$id,t.href):t;if(Xt(e)){const s=xR(e,r,n);if(!Me(s))return s}if(z(e))return kR(e,r,n);if(re(e))return yR(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 Pu(e,r,s)}function tk(e,t,n,r){const s=n.$dynamicRef.startsWith("#")?Gr(t,n.$dynamicRef):Gr(e,n.$dynamicRef);return Me(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 SR=Object.freeze(Object.defineProperty({__proto__:null,DynamicRef:tk,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,nk,rk,sk,ok;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",nk).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",rk).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",sk).call(this,t)??ks(this,lr,"m",ok).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 tk(n,this.Base(),t,this.dynamicAnchors)}}lr=new WeakSet,nk=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 L(r))ks(this,lr,"m",e).call(this,r[s],!1)}},rk=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 L(r))ks(this,lr,"m",e).call(this,r[s],!1)}},sk=function(t){return T(this.context,t.$ref)?this.context[t.$ref]:void 0},ok=function(t){const n=this.schema;return t.$ref.startsWith("#")?Gr(this.Base(),t.$ref):Gr(n,t.$ref)};function wR(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 vR(e,t){return um("CheckContext","Guard","Format","Hashing",e.External().identifier,t)(On,Ii,N$,hw,e.External().variables)}function IR(e){const t=new Zo(e.Context(),e.Schema()),n=new On;return r=>ot(t,n,e.Schema(),r)}function jR(e,t){return lm()?vR(e,t):IR(e)}class ik{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 ak{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=wR(this),n=jR(this,t);return new ik(lm(),t,n)}}function ck(...e){const[t,n]=at(e,{2:(l,u)=>[l,u],1:l=>[{},l]});ah(),zx();const r=new Zo(t,n),s=new ih(oh(t,n)),o=Bs(r,s,n,"value"),i=Gx(),a=ch();return new ak(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=kw(),i=[],a=new Zo(t,n),l=new tu(f=>{if(!js(i.length,s.maxErrors))return i.push({...f,message:o(f)})});return[It(a,l,"#","",n,r),i]}function Nu(...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 $u=class{constructor(t,n,r){this.schema=t,this.value=n,this.errors=r}};function CR(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});if(!Nu(t,n,r)){const[s,o]=po(t,n,r);throw new $u(n,r,o)}return r}class lk{constructor(t,n){this.buildResult=ck(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 $u(this.buildResult.Schema(),t,r)}Errors(t){return po(this.buildResult.Context(),this.buildResult.Schema(),t)}}function TR(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return new lk(t,n)}const ER=Object.freeze(Object.defineProperty({__proto__:null,AccumulatedErrorContext:Fn,Build:ck,BuildAdditionalItems:fh,BuildAdditionalProperties:xh,BuildAdditionalPropertiesFast:hh,BuildAdditionalPropertiesStandard:bh,BuildAllOf:Sh,BuildAnyOf:Ih,BuildConst:Ah,BuildContains:$h,BuildContext:ih,BuildDependencies:Mh,BuildDependentRequired:_h,BuildDependentSchemas:Uh,BuildEnum:Hh,BuildExclusiveMaximum:zh,BuildExclusiveMinimum:Vh,BuildFormat:vb,BuildIf:jb,BuildItems:Eb,BuildMaxContains:$b,BuildMaxItems:Fb,BuildMaxLength:Db,BuildMaxProperties:Ub,BuildMaximum:Mb,BuildMinContains:Hb,BuildMinItems:Vb,BuildMinLength:Jb,BuildMinProperties:Yb,BuildMinimum:zb,BuildMultipleOf:Zb,BuildNot:tx,BuildOneOf:rx,BuildPattern:ix,BuildPatternProperties:cx,BuildPrefixItems:dx,BuildProperties:gx,BuildPropertyNames:xx,BuildRecursiveRef:Sx,BuildRef:Ix,BuildRefine:lh,BuildRequired:Tx,BuildResult:ak,BuildSchema:st,BuildSchemaBoolean:Th,BuildSchemaPushStack:En,BuildType:$x,BuildUnevaluatedItems:Ox,BuildUnevaluatedProperties:Dx,BuildUniqueItems:Bx,CanAdditionalPropertiesFast:gh,Check:Nu,CheckAdditionalItems:mh,CheckAdditionalProperties:kh,CheckAllOf:wh,CheckAnyOf:jh,CheckConst:ou,CheckContains:iu,CheckContext:On,CheckDependencies:Oh,CheckDependentRequired:Dh,CheckDependentSchemas:Bh,CheckEnum:au,CheckExclusiveMaximum:cu,CheckExclusiveMinimum:lu,CheckFormat:fu,CheckIf:Cb,CheckItems:Ab,CheckMaxContains:mu,CheckMaxItems:gu,CheckMaxLength:hu,CheckMaxProperties:bu,CheckMaximum:pu,CheckMinContains:xu,CheckMinItems:yu,CheckMinLength:Su,CheckMinProperties:wu,CheckMinimum:ku,CheckMultipleOf:vu,CheckNot:Iu,CheckOneOf:sx,CheckPattern:ju,CheckPatternProperties:lx,CheckPrefixItems:fx,CheckProperties:hx,CheckPropertyNames:kx,CheckRecursiveRef:wx,CheckRef:jx,CheckRefine:uh,CheckRequired:Ex,CheckSchema:ot,CheckSchemaBoolean:su,CheckSchemaPushStack:Ar,CheckType:Rx,CheckUnevaluatedItems:Fx,CheckUnevaluatedProperties:Lx,CheckUniqueItems:qx,Compile:TR,CreateFunction:Bs,CreateVariable:cs,ErrorAdditionalItems:ph,ErrorAdditionalProperties:yh,ErrorAllOf:vh,ErrorAnyOf:Ch,ErrorConst:Ph,ErrorContains:Rh,ErrorContext:tu,ErrorDependencies:Fh,ErrorDependentRequired:Lh,ErrorDependentSchemas:qh,ErrorEnum:Kh,ErrorExclusiveMaximum:Gh,ErrorExclusiveMinimum:Wh,ErrorFormat:Ib,ErrorIf:Tb,ErrorItems:Pb,ErrorMaxContains:Rb,ErrorMaxItems:_b,ErrorMaxLength:Lb,ErrorMaxProperties:Bb,ErrorMaximum:Ob,ErrorMinContains:Kb,ErrorMinItems:Wb,ErrorMinLength:Qb,ErrorMinProperties:Xb,ErrorMinimum:Gb,ErrorMultipleOf:ex,ErrorNot:nx,ErrorOneOf:ox,ErrorPattern:ax,ErrorPatternProperties:ux,ErrorPrefixItems:mx,ErrorProperties:bx,ErrorPropertyNames:yx,ErrorRecursiveRef:vx,ErrorRef:Cx,ErrorRefine:dh,ErrorRequired:Ax,ErrorSchema:It,ErrorSchemaBoolean:Eh,ErrorSchemaPushStack:Pr,ErrorType:Mx,ErrorUnevaluatedItems:_x,ErrorUnevaluatedProperties:Ux,ErrorUniqueItems:Hx,Errors:po,EvaluateResult:ik,GetExternal:ch,GetFunctions:Gx,HasUnevaluated:oh,IsAdditionalItems:Lo,IsAdditionalProperties:Zn,IsAllOf:la,IsAnchor:Ri,IsAnyOf:ua,IsConst:da,IsContains:rs,IsContentEncoding:vN,IsContentMediaType:IN,IsDefault:jr,IsDefs:jN,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:CN,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:sh,IsRecursiveAnchorTrue:bi,IsRecursiveRef:ka,IsRef:ya,IsRefine:ca,IsRequired:tr,IsSchema:_e,IsSchemaBoolean:Do,IsSchemaObject:Xt,IsThen:Sa,IsType:Qo,IsUnevaluatedItems:Ls,IsUnevaluatedProperties:Us,IsUniqueItems:yr,Parse:CR,ParseError:$u,Pointer:Zx,Reducer:Yo,ResetExternal:ah,ResetFunctions:zx,Resolve:SR,Stack:Zo,Validator:lk},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 Nu(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 uk(...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 AR(e,t,n){return z(n)?n.map(r=>wn(e,t.items,r)):n}function PR(e,t,n){return wn({...e,...t.$defs},on(t.$ref),n)}function NR(e,t){const n=T(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},r=Rs(e,t),s=Mn(r);return De(s)?Zg(s,n):s}function $R(e,t,n){const r=NR(e,t);return wn(e,r,n)}function dk(e){return T(e,"additionalProperties")?e.additionalProperties:void 0}function RR(e,t,n){if(!re(n)||z(n))return n;const r=dk(t);for(const s of L(n)){if(T(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 MR(e,t,n){if(!re(n))return n;const r=dk(t),[s,o]=[new RegExp(pn(t)),Ut(t)];for(const i of L(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 OR(e,t,n){return T(e,t.$ref)?wn(e,e[t.$ref],n):n}function FR(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 _t(e){return il(e)}function _R(e,t,n){for(const r of t.anyOf){const s=wn(e,r,_t(n));if(nt(e,r,s))return s}return n}function wn(e,t,n){return ut(t)?AR(e,t,n):Lt(t)?PR(e,t,n):Le(t)?$R(e,t,n):De(t)?RR(e,t,n):Tt(t)?MR(e,t,n):ht(t)?OR(e,t,n):rt(t)?FR(e,t,n):ce(t)?_R(e,t,n):n}function DR(e,t){for(const n of Ii.Keys(e))Ii.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function LR(e){const t={};for(const n of Ii.Keys(e))t[n]=go(e[n]);return t}function UR(e){return Cc(SN(e))}function Cc(e){return e.map(t=>go(t))}function go(e){const t=ut(e)?Sr(go(e.items),ll(e)):Le(e)?Pn(Cc(e.allOf)):ce(e)?Ge(UR(e.anyOf)):De(e)?Ne(LR(e.properties)):Tt(e)?xl(ea(e),go(Ut(e))):rt(e)?mn(Cc(e.items)):e;return DR(e,t)}function Ru(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=Ru(n);return wn(t,s,r)}function tn(e){return re(e)&&T(e,"value")}function ne(e){return{value:e}}function BR(e){return z(e)?ne(e):ne([e])}function qR(e){return h(e,!0)?ne(BigInt(1)):ne(BigInt(0))}const HR=/^-?(0|[1-9]\d*)n$/,KR=/^-?(0|[1-9]\d*)\.\d+$/,zR=/^-?(0|[1-9]\d*)$/;function GR(e){return HR.test(e)}function VR(e){return KR.test(e)}function WR(e){return zR.test(e)}function JR(e){const t=e.toLowerCase();return GR(e)?ne(BigInt(e.slice(0,e.length-1))):VR(e)?ne(BigInt(e.split(".")[0])):WR(e)?ne(BigInt(e)):h(t,"false")?ne(BigInt(0)):h(t,"true")?ne(BigInt(1)):void 0}function Mu(e){return et(e)?ne(e):mt(e)?qR(e):ve(e)?ne(BigInt(Math.trunc(e))):zt(e)?ne(BigInt(0)):ae(e)?JR(e):Me(e)?ne(BigInt(0)):void 0}function QR(e){return h(e,BigInt(0))?ne(!1):h(e,BigInt(1))?ne(!0):void 0}function YR(e){return h(e,0)?ne(!1):h(e,1)?ne(!0):void 0}function XR(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 fk(e){return et(e)?QR(e):mt(e)?ne(e):ve(e)?YR(e):zt(e)?ne(!1):ae(e)?XR(e):Me(e)?ne(!1):void 0}function ZR(e){return h(e,BigInt(0))?ne(null):void 0}function eM(e){return h(e,!1)?ne(null):void 0}function tM(e){return h(e,0)?ne(null):void 0}function nM(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?ne(null):void 0}function rM(e){return et(e)?ZR(e):mt(e)?eM(e):ve(e)?tM(e):zt(e)?ne(null):ae(e)?nM(e):Me(e)?ne(null):void 0}const mk=BigInt(Number.MAX_SAFE_INTEGER),pk=BigInt(Number.MIN_SAFE_INTEGER);function sM(e){return e<=mk&&e>=pk?ne(Number(e)):void 0}function oM(e){return ne(e?1:0)}function iM(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=Mu(e);return tn(r)&&r.value<=mk&&r.value>=pk?ne(Number(r.value)):void 0}function Ou(e){return et(e)?sM(e):mt(e)?oM(e):ve(e)?ne(e):zt(e)?ne(0):ae(e)?iM(e):Me(e)?ne(0):void 0}function gk(e){return et(e)||mt(e)||ve(e)?ne(e.toString()):zt(e)?ne("null"):ae(e)?ne(e):Me(e)?ne(""):void 0}function aM(e){return h(e,BigInt(0))?ne(void 0):void 0}function cM(e){return h(e,!1)?ne(void 0):void 0}function lM(e){return h(e,0)?ne(void 0):void 0}function uM(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?ne(void 0):void 0}function hk(e){return et(e)?aM(e):mt(e)?cM(e):ve(e)?lM(e):zt(e)?ne(void 0):ae(e)?uM(e):Me(e)?ne(e):void 0}function dM(e,t,n){return BR(n).value.map(s=>gn(e,t.items,s))}function fM(e,t,n){const r=Mu(n);return tn(r)?r.value:n}function mM(e,t,n){const r=fk(n);return tn(r)?r.value:n}function pM(e,t,n){return gn({...e,...t.$defs},on(t.$ref),n)}function gM(e,t,n){return gn(e,Mn(t),n)}function hM(e,t,n){const r=Ou(n);return tn(r)?Math.trunc(r.value):n}function bM(e,t,n){const r=Rs(e,t),s=Mn(r);return gn(e,s,n)}function xM(e,t,n){const r=Mu(n);return tn(r)&&h(t.const,r.value)?r.value:n}function kM(e,t,n){const r=fk(n);return tn(r)&&h(t.const,r.value)?r.value:n}function yM(e,t,n){const r=Ou(n);return tn(r)&&h(t.const,r.value)?r.value:n}function SM(e,t,n){const r=gk(n);return tn(r)&&h(t.const,r.value)?r.value:n}function wM(e,t,n){return h(t.const,n)?n:Nw(t)?xM(e,t,n):$w(t)?kM(e,t,n):ym(t)?yM(e,t,n):Sm(t)?SM(e,t,n):Nt()}function vM(e,t,n){const r=rM(n);return tn(r)?r.value:n}function IM(e,t,n){const r=Ou(n);return tn(r)?r.value:n}function bk(e,t,n,r){const s=L(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 Fu(e,t,n){return Jt(e)&&Me(n[t])}function jM(e,t,n){const r=el(t.properties),s=L(n);for(const[o,i]of r)for(const a of s)!o.test(a)||Fu(i,a,n)||(n[a]=gn(e,i,n[a]));return T(t,"additionalProperties")&&re(t.additionalProperties)?bk(e,r,t.additionalProperties,n):n}function CM(e,t,n){return cn(n)?jM(e,t,n):n}function TM(e,t,n){const r=el(t.patternProperties),s=L(n);for(const[o,i]of r)for(const a of s)o.test(a)&&(n[a]=gn(e,i,n[a]));return T(t,"additionalProperties")&&re(t.additionalProperties)?bk(e,r,t.additionalProperties,n):n}function EM(e,t,n){return cn(n)?TM(e,t,n):n}function AM(e,t,n){return T(e,t.$ref)?gn(e,e[t.$ref],n):n}function PM(e,t,n){const r=gk(n);return tn(r)?r.value:n}function NM(e,t,n){return gn(e,Mn(t),n)}function $M(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 RM(e,t,n){const r=hk(n);return tn(r)?r.value:n}function MM(e,t,n){if(t.anyOf.some(i=>nt(e,i,n)))return n;const o=t.anyOf.map(i=>gn(e,i,_t(n))).find(i=>nt(e,t,i));return Me(o)?n:o}function OM(e,t,n){const r=hk(n);return tn(r)?void 0:n}function gn(e,t,n){return ut(t)?dM(e,t,n):Xr(t)?fM(e,t,n):wr(t)?mM(e,t,n):Lt(t)?pM(e,t,n):fn(t)?gM(e,t,n):$n(t)?hM(e,t,n):Le(t)?bM(e,t,n):Ve(t)?wM(e,t,n):Co(t)?vM(e,t,n):Zt(t)?IM(e,t,n):De(t)?CM(e,t,n):Tt(t)?EM(e,t,n):ht(t)?AM(e,t,n):Tn(t)?PM(e,t,n):Bt(t)?NM(e,t,n):rt(t)?$M(e,t,n):Ns(t)?RM(e,t,n):ce(t)?MM(e,t,n):Zr(t)?OM(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 FM(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 _M(e,t,n){return vn({...e,...t.$defs},on(t.$ref),n)}function DM(e,t){return Me(t)?kn(e.default)?e.default():_t(e.default):t}function LM(e,t,n){const r=Rs(e,t),s=Mn(r);return vn(e,s,n)}function UM(e,t,n){if(!re(n))return n;const r=L(t.properties);for(const s of r){const o=vn(e,t.properties[s],n[s]);Me(o)&&(Jt(t.properties[s])||!T(t.properties[s],"default"))||(n[s]=o)}if(!Zn(t)||mt(t.additionalProperties))return n;for(const s of L(n))r.includes(s)||(n[s]=vn(e,t.additionalProperties,n[s]));return n}function BM(e,t,n){if(!re(n))return n;const[r,s]=[new RegExp(pn(t)),Ut(t)];for(const o of L(n))r.test(o)&&jr(s)&&(n[o]=vn(e,s,n[o]));if(!Zn(t))return n;for(const o of L(n))r.test(o)||(n[o]=vn(e,t.additionalProperties,n[o]));return n}function qM(e,t,n){return T(e,t.$ref)?vn(e,e[t.$ref],n):n}function HM(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 KM(e,t,n){for(const r of t.anyOf){const s=vn(e,r,_t(n));if(nt(e,r,s))return s}return n}function vn(e,t,n){const r=jr(t)?DM(t,n):n;return ut(t)?FM(e,t,r):Lt(t)?_M(e,t,r):Le(t)?LM(e,t,r):De(t)?UM(e,t,r):Tt(t)?BM(e,t,r):ht(t)?qM(e,t,r):rt(t)?HM(e,t,r):ce(t)?KM(e,t,r):r}function _u(...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 xk(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 zM(e,t,n){return t["~codec"].decode(n)}function GM(e,t,n){return t["~codec"].encode(n)}function St(e,t,n,r){return Yt(n)?h(e,"Decode")?zM(t,n,r):GM(t,n,r):r}function VM(e,t,n,r){if(!z(r))return r;for(let s=0;s<r.length;s++)r[s]=Ot(e,t,n.items,r[s]);return St(e,t,n,r)}function WM(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]=Ot(e,t,n.items,s[o]);return s}function JM(e,t,n,r){return h(e,"Decode")?VM(e,t,n,r):WM(e,t,n,r)}function QM(e,t,n,r){return r=Ot(e,{...t,...n.$defs},on(n.$ref),r),St(e,t,n,r)}function kk(e){return e.reduce((t,n)=>({...t,...n}),{})}function yk(e,t){for(const n of t)if(!Jr(e,n))return n;return e}function YM(e,t,n,r){if(h(n.allOf.length,0))return St(e,t,n,r);const s=n.allOf.map(a=>Ot(e,t,a,ti(a,_t(r)))),i=s.every(a=>re(a))?kk(s):yk(r,s);return St(e,t,n,i)}function XM(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=>Ot(e,t,a,ti(a,_t(s))));return o.every(a=>re(a))?kk(o):yk(s,o)}function ZM(e,t,n,r){return h(e,"Decode")?YM(e,t,n,r):XM(e,t,n,r)}function eO(e,t,n,r){if(!cn(r))return r;for(const s of L(n.properties))!T(r,s)||Fu(n.properties[s],s,r)||(r[s]=Ot(e,t,n.properties[s],r[s]));return St(e,t,n,r)}function tO(e,t,n,r){const s=St(e,t,n,r);if(!cn(s))return s;for(const o of L(n.properties))!T(s,o)||Fu(n.properties[o],o,s)||(s[o]=Ot(e,t,n.properties[o],s[o]));return s}function nO(e,t,n,r){return h(e,"Decode")?eO(e,t,n,r):tO(e,t,n,r)}function rO(e,t,n,r){if(!cn(r))return r;const s=new RegExp(pn(n));for(const o of L(r))s.test(o)&&(r[o]=Ot(e,t,Ut(n),r[o]));return St(e,t,n,r)}function sO(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 L(s))o.test(i)&&(s[i]=Ot(e,t,Ut(n),s[i]));return s}function oO(e,t,n,r){return h(e,"Decode")?rO(e,t,n,r):sO(e,t,n,r)}function qd(e,t,n,r){return T(t,n.$ref)?Ot(e,t,t[n.$ref],r):r}function iO(e,t,n,r){return h(e,"Decode")?St(e,t,n,qd(e,t,n,r)):qd(e,t,n,St(e,t,n,r))}function aO(e,t,n,r){if(!z(r))return r;for(let s=0;s<Math.min(n.items.length,r.length);s++)r[s]=Ot(e,t,n.items[s],r[s]);return St(e,t,n,r)}function cO(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]=Ot(e,t,n.items[o],s[o]);return s}function lO(e,t,n,r){return h(e,"Decode")?aO(e,t,n,r):cO(e,t,n,r)}function uO(e,t,n,r){for(const s of n.anyOf){if(!nt(t,s,r))continue;const o=Ot(e,t,s,r);return St(e,t,n,o)}return r}function dO(e,t,n,r){const s=St(e,t,n,r);for(const o of n.anyOf){const i=Ot(e,t,o,_t(s));if(nt(t,o,i))return i}return s}function fO(e,t,n,r){return h(e,"Decode")?uO(e,t,n,r):dO(e,t,n,r)}function Ot(e,t,n,r){return ut(n)?JM(e,t,n,r):Lt(n)?QM(e,t,n,r):Le(n)?ZM(e,t,n,r):De(n)?nO(e,t,n,r):Tt(n)?oO(e,t,n,r):ht(n)?iO(e,t,n,r):rt(n)?lO(e,t,n,r):ce(n)?fO(e,t,n,r):St(e,t,n,r)}class mO extends wa{constructor(t,n){super("Decode",t,n)}}function pO(e,t,n){if(!nt(e,t,n))throw new mO(n,ei(e,t,n));return n}function gO(e,t,n){const r=Ru(t);return Ot("Decode",e,r,n)}const hO=xk([(e,t,n)=>_t(n),(e,t,n)=>_u(e,t,n),(e,t,n)=>va(e,t,n),(e,t,n)=>ti(e,t,n),(e,t,n)=>pO(e,t,n),(e,t,n)=>gO(e,t,n)]);function bO(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return hO(t,n,r)}class xO extends wa{constructor(t,n){super("Encode",t,n)}}function kO(e,t,n){if(!nt(e,t,n))throw new xO(n,ei(e,t,n));return n}function yO(e,t,n){const r=Ru(t);return Ot("Encode",e,r,n)}const SO=xk([(e,t,n)=>_t(n),(e,t,n)=>yO(e,t,n),(e,t,n)=>_u(e,t,n),(e,t,n)=>va(e,t,n),(e,t,n)=>ti(e,t,n),(e,t,n)=>kO(e,t,n)]);function wO(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return SO(t,n,r)}function vO(e,t){return Yt(t)||Nr(e,t.items)}function IO(e,t){return Yt(t)||Sk({...e,...t.$defs},on(t.$ref))}function jO(e,t){return Yt(t)||t.allOf.some(n=>Nr(e,n))}function CO(e,t){return Yt(t)||L(t.properties).some(n=>Nr(e,t.properties[n]))}function TO(e,t){return Yt(t)||Nr(e,Ut(t))}function Sk(e,t){return Tc.has(t.$ref)?!1:(Tc.add(t.$ref),Yt(t)||T(e,t.$ref)&&Nr(e,e[t.$ref]))}function EO(e,t){return Yt(t)||t.items.some(n=>Nr(e,n))}function AO(e,t){return Yt(t)||t.anyOf.some(n=>Nr(e,n))}function Nr(e,t){return ut(t)?vO(e,t):Lt(t)?IO(e,t):Le(t)?jO(e,t):De(t)?CO(e,t):Tt(t)?TO(e,t):ht(t)?Sk(e,t):rt(t)?EO(e,t):ce(t)?AO(e,t):Yt(t)}const Tc=new Set;function PO(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return Tc.clear(),Nr(t,n)}class ni extends Error{constructor(t,n){super(n),this.type=t}}function NO(e,t){return kn(t.default)?t.default(t):re(t.default)?_t(t.default):t.default}function $O(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 RO(e,t){return Cr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Er(t)?BigInt(t.minimum):BigInt(0)}function MO(e,t){return!1}function OO(e,t){const n=hn(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function FO(e,t){return hn({...e,...t.$defs},on(t.$ref))}function _O(e,t){return hn(e,Mn(t))}function DO(e,t){const n=hn(e,t.returnType);return()=>n}function LO(e,t){return Cr(t)&&ve(t.exclusiveMinimum)?t.exclusiveMinimum+1:Er(t)?t.minimum:0}function UO(e,t){const n=Rs(e,t),r=Mn(n);return hn(e,r)}function BO(e,t){return t.const}function qO(e,t){throw new ni(t,"Cannot create TNever types")}function HO(e,t){return null}function KO(e,t){return Cr(t)&&ve(t.exclusiveMinimum)?t.exclusiveMinimum+1:Er(t)?t.minimum:0}function zO(e,t){return(Me(t.required)?[]:t.required).reduce((r,s)=>({...r,[s]:hn(e,t.properties[s])}),{})}function GO(e,t){if(_s(t)&&!jr(t))throw new ni(t,"Record with the minProperties constraint must have a default annotation");return{}}function VO(e,t){return T(e,t.$ref)?hn(e,e[t.$ref]):(()=>{throw new ni(t,"Unable to deref Ref")})()}function WO(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 JO(e,t){return Symbol()}function QO(e,t){const n=bl(t.pattern);if(Tn(n))throw new ni(t,"Unable to create TemplateLiteral due to infinite type expansion");return hn(e,n)}function YO(e,t){return Array.from({length:t.minItems},(n,r)=>hn(e,t.items[r]))}function XO(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)?NO(e,t):ut(t)?$O(e,t):Xr(t)?RO(e,t):wr(t)?MO():ln(t)?OO(e,t):Lt(t)?FO(e,t):fn(t)?_O(e,t):un(t)?DO(e,t):$n(t)?LO(e,t):Le(t)?UO(e,t):Ve(t)?BO(e,t):Es(t)?qO(e,t):Co(t)?HO():Zt(t)?KO(e,t):De(t)?zO(e,t):Tt(t)?GO(e,t):ht(t)?VO(e,t):Tn(t)?WO(e,t):To(t)?JO():Bt(t)?QO(e,t):rt(t)?YO(e,t):Ns(t)?void 0:ce(t)?XO(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 wk(e,t){return Jr(e,t)}function vk(e){return Ji(e)}class ZO extends wa{constructor(t,n){super("Parse",t,n)}}function eF(...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 ZO(r,ei(t,n,r))}function Ia(e,t){return{type:"update",path:e,value:t}}function Ik(e,t){return{type:"insert",path:e,value:t}}function jk(e){return{type:"delete",path:e}}function Hd(e){if(!(re(e)&&h(tl(e).length,0)))throw new Error("Cannot create diffs for objects with symbols keys")}function*tF(e,t,n){if(!re(n)||z(n))return yield Ia(e,n);Hd(t),Hd(n);const r=L(t),s=L(n);for(const o of s)T(t,o)||qn(o)||(yield Ik(`${e}/${o}`,n[o]));for(const o of r)T(n,o)&&(qn(o)||wk(t,n)||(yield*ja(`${e}/${o}`,t[o],n[o])));for(const o of r)T(n,o)||qn(o)||(yield jk(`${e}/${o}`))}function*nF(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 Ik(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield jk(`${e}/${r}`))}function*rF(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*sF(e,t,n){t!==n&&(yield Ia(e,n))}function*ja(e,t,n){return yo(t)?yield*rF(e,t,n):z(t)?yield*nF(e,t,n):re(t)?yield*tF(e,t,n):yield*sF(e,t,n)}function oF(e,t){return[...ja("",e,t)]}const iF=Ne({type:Fe("insert"),path:Rn(),value:Dt()}),aF=Object({type:Fe("update"),path:Rn(),value:Dt()}),cF=Ne({type:Fe("delete"),path:Rn()});Ge([iF,aF,cF]);function lF(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function uF(e){return e.length===0}function dF(e,t){if(lF(t))return _t(t[0].value);if(uF(t))return _t(e);const n=_t(e);for(const r of t)switch(r.type){case"insert":{jc(n,r.path,r.value);break}case"update":{jc(n,r.path,r.value);break}case"delete":{Xx(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 fF(e){const[t,n]=[new Set,[]];for(const r of e){const s=vk(r);t.has(s)||(t.add(s),n.push(r))}return n}function mF(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=fF(i);if(!nt(e,t,a))throw new Ca(e,t,n,"Failed to repair Array due to uniqueItems constraint");return a}function pF(e,t,n){return an(e,Mn(t),n)}function gF(e,t,n){const r=Rs(e,t),s=Mn(r);return an(e,s,n)}function hF(e,t,n){if(nt(e,t,n))return n;if(!cn(n))return In(e,t);const r=new Set(Me(t.required)?[]:t.required),s={};for(const[i,a]of tt(t.properties))!r.has(i)&&Me(n[i])||(s[i]=i in n?an(e,a,n[i]):In(e,a));const o=L(t.properties);if(Zn(t)&&re(t.additionalProperties))for(const i of L(n))o.includes(i)||(s[i]=an(e,t.additionalProperties,n[i]));return s}function bF(e,t,n){if(nt(e,t,n))return n;if(zt(n)||!re(n)||z(n))return In(e,t);const r=new RegExp(pn(t)),s=Ut(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 L(n))o.has(a)||(i[a]=an(e,t.additionalProperties,n[a]));return i}function xF(e,t,n){return T(e,t.$ref)?an(e,e[t.$ref],n):(()=>{throw new Ca(e,t,n,"Unable to de-reference target type")})()}function kF(e,t,n){const r=bl(t.pattern);return an(e,r,n)}function yF(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 Ck(e,t,n){return ht(t)?T(e,t.$ref)?Ck(e,e[t.$ref]):(()=>{throw new Error("Unable to Deref target")})():t}function SF(e,t,n){if(!(De(t)&&re(n)))return 0;const r=L(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 wF(e,t,n){const r=t.anyOf.map(i=>Ck(e,i));let[s,o]=[r[0],0];for(const i of r){const a=SF(e,i,n);a>o&&(s=i,o=a)}return s}function vF(e,t,n){const r=Ge(Yi(t.anyOf)),s=wF(e,r,n);return an(e,s,n)}function IF(e,t,n){return nt(e,t,n)?_t(n):jr(t)?In(e,t):vF(e,t,n)}function jF(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 CF(e,t,n){if(rm(n)||om(n)||sm(n)||yo(n)||zi(n)||kn(n))throw new Ca(e,t,n,"Value is not repairable")}function TF(e,t,n){if(ln(t)||un(t)||Es(t))throw new Ca(e,t,n,"Type is not repairable")}function EF(e,t,n){return Me(n)&&!Ns(t)?In(e,t):n}function AF(e,t,n){return ml(t)?nt(e,t,n)?n:In(e,t):n}function an(e,t,n){CF(e,t,n),TF(e,t,n);const r=EF(e,t,n),s=ut(t)?mF(e,t,r):fn(t)?pF(e,t,r):Le(t)?gF(e,t,r):De(t)?hF(e,t,r):Tt(t)?bF(e,t,r):ht(t)?xF(e,t,r):Bt(t)?kF(e,t,r):rt(t)?yF(e,t,r):ce(t)?IF(e,t,r):jF(e,t,r);return AF(e,t,s)}function PF(...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 uk(t,n,s),s}const Ga=Object.freeze(Object.defineProperty({__proto__:null,Assert:uk,Check:nt,Clean:ti,Clone:_t,Convert:va,Create:In,Decode:bO,Default:_u,Diff:oF,Encode:wO,Equal:wk,Errors:ei,HasCodec:PO,Hash:vk,Parse:eF,Patch:dF,Pointer:Zx,Repair:PF},Symbol.toStringTag,{value:"Module"}));class Kd 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 NF(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 $F(e,t){let n=e;for(const r of t){if(n===null||typeof n!="object")return;n=n[r]}return n}function zd(e,t){const[,n]=ER.Errors(e,t);return n.map(r=>{const s=NF(r.instancePath);return{code:r.keyword,path:s,message:r.message,value:$F(t,s)}})}function Tk(e,t){const n=Ga.Default(e,Ga.Clone(t)),r=zd(e,n);if(r.length>0)return{success:!1,error:new Kd(r)};const s=Ga.Clean(e,n),o=zd(e,s);return o.length>0?{success:!1,error:new Kd(o)}:{success:!0,data:s}}function ar(e,t){const n=Tk(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=>Tk(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,RF=32e3,Ta=te(Ce(["default","autoEdit","yolo","plan"])),fr={DEFAULT:"default",AUTO_EDIT:"autoEdit",YOLO:"yolo",PLAN:"plan"},Du=te(Ce(["user","assistant","system","tool"])),MF=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()})})])),Ek=m.Union([m.String(),m.Array(MF)]);te(m.Object({id:m.String(),role:Du,content:Ek,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 OF=te(Ce(["queued","running","completed","failed","cancelled","interrupted"])),Ak=te(Ce(["local","worktree"])),FF=te(Ce(["applied","discarded","conflicted"])),_F=te(m.Object({status:FF,updatedAt:m.String(),sourceCommit:m.Optional(m.String()),changedFiles:m.Optional(m.Integer({minimum:0})),message:m.Optional(m.String())})),DF=te(m.Object({changedFiles:m.Integer({minimum:0}),additions:m.Integer({minimum:0}),deletions:m.Integer({minimum:0}),commits:m.Integer({minimum:0})})),LF=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()})),UF=te(m.Object({sessionId:m.String(),projectPath:m.String(),baseCommit:m.String(),files:m.Array(LF,{maxItems:100}),truncated:m.Boolean()})),BF=m.Union([m.String(),m.Number(),m.Boolean(),m.Array(m.String())]),qF=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(BF),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(qF)),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 HF=te(m.Object({type:Ce(["permission","question","elicitation"]),requestId:m.String()})),KF=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()})),Lu=te(Ce(["auto","off","minimal","low","medium","high","xhigh","max"])),Uu=te(Ce(["auto","standard","fast","flex"])),Bu=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(OF,"completed"),taskStatusReason:m.Optional(m.String()),taskFailure:m.Optional(KF),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()),permissionMode:m.Optional(Ta),reasoningEffort:m.Optional(Lu),serviceTier:m.Optional(Uu),responseVerbosity:m.Optional(Bu),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(_F),taskIsolation:m.Optional(Ak),taskSourceProjectPath:m.Optional(m.String()),taskWorktreePath:m.Optional(m.String()),taskWorktreeBranch:m.Optional(m.String()),taskBaseCommit:m.Optional(m.String()),taskDiffStat:m.Optional(DF),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(HF),messageCount:m.Number(),firstMessageTime:m.String(),lastMessageTime:m.String(),hasErrors:m.Boolean()})),zF=te(m.Object({sessions:m.Array(Kn),nextCursor:m.Optional(m.String())})),GF=te(m.Object({session:Kn,archivedSessionIds:m.Array(m.String())})),VF=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 qu=te(m.Object({role:Du,content:Ek,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())})),WF=te(m.Object({session:Kn,messages:m.Array(qu)})),Pk=te(Ce(["conversation","code","both"])),Nk=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(Pk,"conversation")}));const JF=te(m.Object({checkpoint:Nk,mode:Pk,removedTurns:m.Integer({minimum:1}),restoredFiles:m.Array(m.String()),messages:m.Array(qu)})),QF=Ce(["running","completed","failed","cancelled"]),Ec=te(m.Object({id:m.String(),subagentType:m.String(),description:m.String(),status:QF,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 YF=te(m.Object({source:Ec,session:Ec})),$k=te(m.Object({sessionId:m.String(),projectPath:m.String()})),Rk=te(m.Object({path:m.String(),name:m.String(),gitBranch:m.Optional(m.String()),available:m.Boolean(),isCurrent:m.Boolean(),boundAt:m.String()})),XF=te(m.Union([m.Object({cancelled:m.Literal(!0)}),m.Object({cancelled:m.Literal(!1),path:m.String({minLength:1})})])),Gd=te(m.Object({type:m.String(),seq:m.Optional(m.Number()),properties:m.Record(m.String(),m.Unknown())})),Mk=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(Lu),serviceTier:m.Optional(Uu),responseVerbosity:m.Optional(Bu),communicationStyle:m.Optional(ri),isolation:Fi(Ak,"worktree"),permissionMode:Fi(Ta,"default"),attachments:m.Optional(m.Array(Mk,{maxItems:Ur}))}));const Vd=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:RF}),projectPath:m.Optional(m.String()),modelId:m.Optional(m.String({minLength:1,maxLength:500})),reasoningEffort:m.Optional(Lu),serviceTier:m.Optional(Uu),responseVerbosity:m.Optional(Bu),communicationStyle:m.Optional(ri),permissionMode:m.Optional(Ta),attachments:m.Optional(m.Array(Mk,{maxItems:Ur}))}));const ZF=Ce(["completed","failed","aborted","timed_out","spawn_error"]),e_=te(m.Object({version:m.Literal(1),command:m.String(),status:ZF,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 t_=te(m.Object({executionId:m.String(),messageId:m.String(),record:e_,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:Du,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(Ta),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 n_=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(n_,{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 r_=te(Ce(["light","dark","system"])),s_=te(m.Object({language:m.String(),theme:m.String(),uiTheme:r_,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(s_));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="",Wd=1e4,o_=m.Array(Kn),i_=m.Array(Rk),a_=m.Array(qu),c_=m.Array(Nk),l_=m.Array(Ec),u_=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})}))}),d_=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),f_=()=>{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 m_(e){const t=$k.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function dt(e,t){const n=m_(t);return`${e}${e.includes("?")?"&":"?"}${n}`}function p_(e){return{"x-blade-directory":$k.parse(e).projectPath}}const Va=(e,t,n)=>({id:`history-${t}-${n}`,role:e.role,content:d_(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}),fe={listProjects:async()=>{const e=await fetch(`${be}/projects`);if(!e.ok)throw new Error("Failed to load projects");return ar(i_,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 Rk.parse(await t.json())},pickProjectDirectory:async()=>ar(XF,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(o_,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 zF.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||f_()})});if(!n.ok)throw new Error("Failed to create session");return Kn.parse(await n.json())},getWorkspaceInfo:async()=>ar(u_,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 Vd.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 Vd.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 UF.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=>GF.parse(await cr(dt(`${be}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>VF.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(a_,await t.json()),r=Date.now();return n.map((s,o)=>Va(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)=>t_.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(c_,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=JF.parse(await r.json()),o=Date.now();return{...s,messages:s.messages.map((i,a)=>Va(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(l_,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 YF.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=WF.parse(await t.json()),r=Date.now();return{session:n.session,messages:n.messages.map((s,o)=>Va(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((C,q)=>{y=C,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())},$=C=>{x||(x=!0,R(),j(C))},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 C=Math.min(1e3*Math.pow(2,a-1),3e4);console.log(`SSE reconnecting in ${C}ms (attempt ${a}/${r})`),l=setTimeout(()=>{Z().catch(q=>{console.error("SSE reconnect failed",q),s==null||s(!1),A()})},C)},_=()=>{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 C=dt(`${be}/sessions/${e.sessionId}/events`,e),q=b>0?`${C}${C.includes("?")?"&":"?"}lastEventId=${b}`:C;i=new EventSource(q),k||(F(),p=setTimeout(()=>{o==null||o("offline"),$(new Error("Timed out waiting for event subscription readiness"))},Wd)),i.onmessage=K=>{try{const pe=JSON.parse(K.data);typeof pe.seq=="number"&&pe.seq>b&&(b=pe.seq);const X=Gd.parse(pe);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(pe){console.error("Failed to parse SSE event:",K.data,pe)}},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(C=>{o==null||o("offline"),$(C instanceof Error?C: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")))},Wd),s.onmessage=g=>{try{const k=Gd.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:p_(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()}},Jd=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},g_=e=>e?Jd(e):Jd,h_=e=>e;function b_(e,t=h_){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 Qd=e=>{const t=g_(e),n=r=>b_(t,r);return Object.assign(n,t),n},Ea=e=>e?Qd(e):Qd;function Ft(){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 Ac(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 Hu(e,t){return`${t}-${e.length}`}function Pc(e,t){if(!t)return e;const n=[...Aa(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:Hu(n,"text"),type:"text",content:t}),{...e,timeline:n}}function Ok(e,t){if(!t)return e;const n=[...Aa(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:Hu(n,"thinking"),type:"thinking",content:t}),{...e,timeline:n}}function Nc(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=[...Aa(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:Hu(s,"tool_group"),type:"tool_group",toolCallIds:[t.toolCallId]}),{...e,timeline:s,toolCalls:r}}function Aa(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 x_(e){return Aa(e).filter(t=>t.type==="text").map(t=>t.content).filter(Boolean).join(`
10
-
11
- `)}const k_=(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||Ft();return s==="before"?{...i,agentContent:{...Pc(a,r),textBefore:a.textBefore+r}}:{...i,agentContent:{...Pc(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||Ft();return{...o,agentContent:Nc(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||Ft();return{...o,agentContent:{...Ok(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||Ft();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||Ft();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||Ft();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||Ft();return{...o,agentContent:r?Ac(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||Ft(),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||Ft();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}})}),Wa=60,y_=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function S_(e){let t=e;for(const l of y_)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<=Wa)return s;const o=s.slice(0,Wa),i=o.lastIndexOf(" ");return`${(i>Wa*.6?o.slice(0,i):o).trimEnd()}…`}const yi="/.blade/worktrees/",w_=/-[a-f0-9]{8,}$/i,v_=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function I_(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 j_(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(v_);return r!=null&&r[1]?(t[t.length-1]=r[1],t.join("/")):null}function $c(e){const t=e.split("/").filter(Boolean).at(-1)||e;return e.includes(yi)?t.replace(w_,""):t}function si(e,t=null){const n=e.taskSourceProjectPath,r=j_(n||e.projectPath);if(r)return r;if(n)return n;const s=I_(e.projectPath);if(!s)return e.projectPath;const o=$c(s);return t&&o===$c(t)?t:s}function C_(e,t,n=null){return t?e.filter(r=>si(r,n)===t):e}const Rc=fr.AUTO_EDIT;let Ja=0;const At=Ea((e,t)=>({currentModelId:null,currentMode:Rc,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=++Ja;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!==Ja||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!==Ja||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}),resetMode:()=>e({currentMode:Rc})})),Qa="__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 ie(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function Ku(e,t){return e.find(n=>ie(xe(n),t))}function An(e,t){const n=xe(t),r=e.findIndex(o=>ie(xe(o),n));if(r===-1)return[...e,t];const s=[...e];return s[r]=t,s}function Yd(e,t){return e.filter(n=>!ie(xe(n),t))}const Fk="blade.tasks.unread",_i="blade:open-session";function _k(e){return e==="completed"||e==="failed"||e==="interrupted"}function T_(e,t,n){return!_k(t)||n?!1:e!==t&&!(e==="completed"||e==="failed"||e==="interrupted"||e==="cancelled")}function E_(e=typeof localStorage>"u"?null:localStorage){if(!e)return[];try{const t=JSON.parse(e.getItem(Fk)??"[]");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(Fk,JSON.stringify([...new Set(e)]))}catch{}}function Xd(e,t){const n=new Set(t.map(r=>Ke({sessionId:r.sessionId,projectPath:r.projectPath})));return e.filter(r=>n.has(r))}function Zd(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 A_(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 P_=2166136261,N_=16777619;function Mc(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>Mc(t)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${JSON.stringify(n)}:${Mc(r)}`).join(",")}}`:JSON.stringify(e)}function Dk(e){let t=P_>>>0;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,N_);return(t>>>0).toString(16)}function Lk(e){return typeof e=="string"?e:Mc(e??{})}function zu(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function Oc({explicitId:e,messageId:t,toolName:n,argumentsValue:r,toolKind:s,output:o}){if(e)return e;const i=[t||"unknown-message",n||"Unknown",Lk(r),s||"",o||""].join("|");return`tool-${Dk(i)}`}function Pa({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-${Dk(i)}`}const $_=(e,t)=>!t||typeof t!="object"?null:{id:Pa({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:zu(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},R_=(e,t)=>!t||typeof t!="object"?[]:(Array.isArray(t.subtaskRefs)?t.subtaskRefs:t.subtaskRef&&typeof t.subtaskRef=="object"?[t.subtaskRef]:[]).map(r=>$_(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=Ft();i.thinkingContent&&(l=Ok(l,i.thinkingContent),l.thinkingContent=i.thinkingContent);const u=Ys(i.content);u&&(l=Pc(l,u),l.textBefore=u);const f=R_(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=Lk((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=Ac(l,{id:Pa({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:Oc({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=Nc(l,b)}for(const p of f)l=Ac(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"?zu(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=Nc(n.agentContent,{toolCallId:Oc({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 M_=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}),ef=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)}),O_=(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=ie(u.currentSessionRef,l),p=ie(u.forkingSessionRef,l);(f||p)&&o(),f&&u.unsubscribeFromEvents(),e(g=>({sessions:Yd(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(),At.getState().resetMode(),l&&t().selectProject(l),e({currentSessionId:Qa,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 fe.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 ef(),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=Xd(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 fe.listSessionPage(u,50,!0);if(l!==s)return;for(const g of p.sessions){const k=f.findIndex(b=>ie(xe(b),xe(g)));k===-1?f.push(g):f[k]=g}u=p.nextCursor,u&&(e({archivedCatalogLoadState:"hydrating"}),await ef())}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=Ku(t().sessions,l),[g,k,b]=await Promise.all([fe.getMessages(l),fe.getGoal(l).catch(()=>null),p?Promise.resolve(p):fe.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),At.getState().setMode(b.permissionMode??Rc),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 fe.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=Xd(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 fe.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=ie(u.currentSessionRef,l),p=ie(u.forkingSessionRef,l),g=f||p?o():null,k=f?g:null;p&&e({forkingSessionRef:null});try{await fe.deleteSession(l),t().markTaskRead(l);const b=t(),y=ie(b.currentSessionRef,l)&&(k===null||i(k));y&&(o(),b.unsubscribeFromEvents()),e(j=>({sessions:Yd(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)||!ie(t().currentSessionRef,l)))return;e({error:b.message})}},updateSession:async(l,u)=>{try{await fe.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 fe.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 fe.rewindSession(f,l,u);if(!i(k)||!ie(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)||!ie(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)&&ie(t().currentSessionRef,F);if(p||!N||N===Qa)try{const C=S_(l.content),q=await fe.createSession(t().selectedProjectPath??(($=t().taskWorkspaceInfo)==null?void 0:$.cwd)??void 0,C||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(C){return P()&&e({error:C.message}),!1}if(!I||!N||N===Qa)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 C=l.content.trim();if(C.startsWith("!")){if((((A=l.attachments)==null?void 0:A.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const me=C.slice(1).trim();if(!me)throw new Error("User shell command cannot be empty");g||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const We=await fe.executeUserShellCommand(I,me);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&&(C==="/goal"||C.startsWith("/goal "))){R=`goal-command-${Date.now()}`,b({id:R,role:"user",content:C,timestamp:Date.now()});const me=C.slice(5).trim().split(/\s+/).filter(Boolean),We=(Z=me[0])==null?void 0:Z.toLowerCase();if(!We||We==="status"){const O=await fe.getGoal(I);return P()&&e({goal:O}),P()}if(We==="clear")return await fe.clearGoal(I),P()&&e({goal:null}),P();let Q;if(We==="pause")Q=await fe.updateGoal(I,{action:"pause"});else if(We==="resume")Q=await fe.updateGoal(I,{action:"resume"});else if(We==="edit"){const O=me.slice(1).join(" ").trim();if(!O)throw new Error("Usage: /goal edit <objective>");Q=await fe.updateGoal(I,{action:"edit",objective:O})}else{const O=me.lastIndexOf("--budget");let U;if(O>=0){const Be=me[O+1];if(!Be||!/^[1-9]\d*$/.test(Be))throw new Error("--budget requires a positive integer");U=Number(Be),me.splice(O,2)}const je=me.join(" ").trim();if(!je)throw new Error("Usage: /goal <objective>");const{currentMode:pt}=At.getState();Q=await fe.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:M_(l),timestamp:Date.now()}),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:g?t().recoveredSteeringCount:0});const{currentMode:q,currentModelId:K}=At.getState(),{modelId:pe,...X}=l,oe=pe??K??void 0,Ue=l.reasoningEffort,Ae=l.serviceTier,D=l.responseVerbosity,se=l.communicationStyle,$e=oe&&!g?{...X,modelId:oe}:X,ge=await fe.sendMessage(I,$e,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:(oe||Ue||Ae||D||se)&&!g?t().sessions.map(me=>me.sessionId===I.sessionId&&me.projectPath===I.projectPath?{...me,...oe?{selectedModelId:oe}:{},...Ue?{reasoningEffort:Ue}:{},...Ae?{serviceTier:Ae}:{},...D?{responseVerbosity:D}:{},...se?{communicationStyle:se}:{}}:me):t().sessions}),!0):!1}catch(C){return M&&a(M),P()?R&&!t().messages.some(q=>q.id===R)?!0:(e(q=>({error:C.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 fe.abortSession(l),ie(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 ie(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 fe.updateGoal(l,{action:"pause"});if(!ie(t().currentSessionRef,l))return;e({goal:f.goal,error:null})}catch(f){if(!ie(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 fe.updateGoal(l,{action:"resume"});if(!ie(t().currentSessionRef,l))return;e({goal:f.goal,error:null,...f.runId?{currentRunId:f.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(f){if(!ie(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 fe.updateGoal(u,{action:"edit",objective:l});if(!ie(t().currentSessionRef,u))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!ie(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 fe.clearGoal(l),!ie(t().currentSessionRef,l))return;e({goal:null,error:null})}catch(f){if(!ie(t().currentSessionRef,l))return;e({error:f.message})}}}},Uk={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"},F_={authentication:!1,permission:!1,rate_limit:!0,timeout:!0,network:!0,model_unavailable:!0,context_limit:!1,unsupported_input:!1,runtime:!0};function Bk(e){if(typeof e=="string"&&Object.keys(Uk).includes(e))return e}function Gu(e){return Uk[e]}function __(e){return F_[e]}const D_={flushTimeout:80};class L_{constructor(t){Ba(this,"config");Ba(this,"channels",new Map);this.config={...D_,...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 L_,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:Ft()};return o(u),i(l),t(f=>({messages:f.messages.map(p=>p.id===l?{...p,agentContent:{...p.agentContent||Ft()}}:p)})),l},U_=(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"?Ft():void 0};f?a(l,{role:u,content:p.content,agentContent:u==="assistant"?{...f.agentContent||Ft()}:void 0}):s(p),u==="assistant"&&o(l)},B_=(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:Ft()};a(g),l(u),t().appendDelta(u,f,"before");return}s(o,f,i?"after":"before")},q_=(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:x_(i.agentContent)})},H_=(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)},K_=()=>{},z_=(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:Pa({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:Oc({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)},G_=(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})},V_=(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?zu(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??{},C=Array.isArray(Z.subtaskRefs)?Z.subtaskRefs:[],q=C.findIndex(oe=>oe.childSessionId===j||oe.subagentId===a),K=q>=0?C[q]:Z.subtaskRef??{},pe={...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=[...C];return q>=0?X[q]=pe:X.push(pe),{..._,metadata:{...Z,subtaskRef:pe,subtaskRefs:X}}})}))},W_=(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
- `)})},J_=(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
- `)})},Q_=(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)}`})},Y_=(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
- `)})},X_=(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
- `)})},Z_=(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
- `)})},eD=(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})},tD=(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
- `)})},Vu=e=>`user-shell-${e}`,nD=(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=Vu(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})},rD=(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=Vu(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}}})},sD=(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=Vu(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"})},oD=(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))},iD=(e,t)=>{const{currentSessionId:n,setTasks:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o=e.tasks||[];r(s,o)},aD=(e,t)=>{const{currentSessionId:n,setSubagent:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o={id:Pa({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)},cD=(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})},lD=(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}))},uD=(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}))},dD=(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})},fD=(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]}})},mD=(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)}))},pD=(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)}))},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=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
- `)}]}))},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=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}`}]}))},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=`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)}`}]}))},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.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}]}))},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.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
- `)}]}))},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=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
- `)}]}))},SD=(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
- `)}]}))},wD=(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
- `)}]}))},vD=(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)}))},ID=(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}:{}}})},jD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running"})},CD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},TD=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},ED=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},AD=(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)})))},PD=(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)})))},ND=(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})}))},$D=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},RD=(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=Bk(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()},MD=(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})},OD=(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()}},FD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},_D=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},DD=(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})},LD=(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})},UD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},BD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},qD=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},HD=(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":U_,"message.delta":B_,"message.complete":q_,"thinking.delta":H_,"thinking.completed":K_,"tool.start":z_,"tool.progress":G_,"tool.result":V_,"mcp.catalog.changed":W_,"mcp.content.changed":J_,"mcp.resource.updated":Q_,"mcp.connection.changed":Y_,"mcp.log":X_,"mcp.instructions.changed":Z_,"mcp.task.changed":eD,"project.rules.loaded":tD,"user.shell.started":nD,"user.shell.output":rD,"user.shell.completed":sD,"token.usage":oD,"task.updated":iD,"subagent.start":aD,"subagent.update":cD,"subagent.delta":lD,"subagent.thinking.delta":uD,"subagent.tool.start":fD,"subagent.tool.progress":pD,"subagent.tool.result":mD,"subagent.mcp.catalog.changed":gD,"subagent.mcp.content.changed":hD,"subagent.mcp.resource.updated":bD,"subagent.mcp.connection.changed":xD,"subagent.mcp.log":kD,"subagent.mcp.instructions.changed":yD,"subagent.mcp.task.changed":SD,"subagent.project.rules.loaded":wD,"subagent.complete":dD,"permission.asked":vD,"permission.timeout":ID,"turn.started":jD,"compaction.started":CD,"compaction.completed":TD,"model.fallback":ED,"question.required":AD,"elicitation.required":PD,"interaction.resolved":ND,"session.completed":$D,"session.error":RD,"session.status":MD,"run.cancelled":OD,"steering.queued":FD,"follow_up.queued":_D,"follow_up.started":LD,"steering.applied":DD,"goal.updated":UD,"goal.cleared":BD,"goal.continuation.started":qD,"session.rewound":HD},KD=new Set(["message.delta","thinking.delta","subagent.delta","subagent.thinking.delta"]),zD=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled"]),tf=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(KD.has(n.type)||console.log("[SSE Event]",n.type,n.properties),zD.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)},GD=(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??tf(t,e);let a=null,l="connecting";return a=await fe.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=>{tf(t,e)(s)}}},VD={"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"},WD={"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":"解释型"},JD=["en","zh"],Ya={en:VD,zh:WD},qk="blade-ui-locale",Wu=typeof window<"u"&&typeof document<"u";function QD(){var e,t;if(Wu){try{const r=(e=window.localStorage)==null?void 0:e.getItem(qk);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=QD();const Fc=new Set;function YD(){for(const e of Fc)e()}function XD(e){var t;if(e!==vs){if(vs=e,Wu){try{(t=window.localStorage)==null||t.setItem(qk,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}YD()}}function Hk(e){return Fc.add(e),()=>Fc.delete(e)}function ZD(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=(Ya[vs]??Ya.en)[e]??Ya.en[e];return ZD(r,t)}function qt(){return S.useSyncExternalStore(Hk,()=>vs,()=>"en"),ys}function e2(){return{locale:S.useSyncExternalStore(Hk,()=>vs,()=>"en"),setLocale:XD}}Wu&&(document!=null&&document.documentElement)&&(document.documentElement.lang=vs==="zh"?"zh-CN":"en");const t2=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=Ea((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 E5=()=>bo(e=>t2(e.uiTheme)),Kk="blade.projects.selected";function nf(){return typeof localStorage>"u"?null:localStorage.getItem(Kk)}function gi(e){typeof localStorage<"u"&&localStorage.setItem(Kk,e)}const n2=new Set(["queued","running","completed","failed","cancelled","interrupted"]),Xa=new Set(["default","autoEdit","yolo","plan"]),rf=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),sf=new Set(["auto","standard","fast","flex"]),of=new Set(["auto","low","medium","high"]),af=new Set(["auto","pragmatic","friendly","explanatory"]);function r2(e){return typeof e=="string"&&n2.has(e)}function s2(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 cf(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Bk(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:ys(Gu(n)),retryable:__(n)}}function o2(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 i2=(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),fe.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:nf(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:E_(),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,C=u.properties.permissionMode,q=u.properties.reasoningEffort,K=u.properties.serviceTier,pe=u.properties.responseVerbosity,X=u.properties.communicationStyle;if(typeof $!="string"||typeof A!="string"||!(typeof _=="string"&&_.trim()||typeof Z=="string"&&Z.trim()||Xa.has(C)||rf.has(q)||sf.has(K)||of.has(pe)||af.has(X)))return;const oe={sessionId:$,projectPath:A};if(ie(t().currentSessionRef,oe)&&Xa.has(C)&&At.getState().setMode(C),!t().sessions.some(Ae=>ie(xe(Ae),oe))){a(oe);return}e(Ae=>({sessions:Ae.sessions.map(D=>ie({sessionId:D.sessionId,projectPath:D.projectPath},oe)?{...D,...typeof _=="string"&&_.trim()?{title:_}:{},...typeof Z=="string"&&Z.trim()?{selectedModelId:Z}:{},...Xa.has(C)?{permissionMode:C}:{},...rf.has(q)?{reasoningEffort:q}:{},...sf.has(K)?{serviceTier:K}:{},...of.has(pe)?{responseVerbosity:pe}:{},...af.has(X)?{communicationStyle:X}:{}}:D)}));return}if(u.type==="task.delivery"){const $=u.properties.sessionId,A=u.properties.projectPath,_=o2(u.properties.taskDelivery);if(typeof $!="string"||typeof A!="string"||!_)return;const Z={sessionId:$,projectPath:A},C=u.properties.taskWorktreeRemoved===!0;e(q=>({sessions:q.sessions.map(K=>ie(xe(K),Z)?{...K,taskDelivery:_,...C?{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 C={sessionId:$,projectPath:A},q=t().sessions.find(pe=>ie(xe(pe),C));if(!q){t().loadSessions();return}if(e(pe=>({sessions:pe.sessions.map(X=>ie(xe(X),C)?{...X,pendingInteraction:{type:_,requestId:Z}}:X)})),!(typeof document<"u"&&document.visibilityState==="visible"&&ie(t().currentSessionRef,C))&&bo.getState().notifyErrors){const X=q.title??q.sessionId??$;Zd({ref:C,title:`Blade · ${ys(_==="question"?"attention.notification.question":_==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:X,onOpen:oe=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(_i,{detail:oe})))}})}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(C=>({sessions:C.sessions.map(q=>{var K;return ie(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"||!r2(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($=>ie(xe($),k)),I=typeof document<"u"&&document.visibilityState==="visible"&&ie(t().currentSessionRef,k),N=T_(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&&_k(g)&&A_(g),g==="completed"?$.notifyBuild:$.notifyErrors){const _=ys(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),Z=((R=cf(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)),C=(x==null?void 0:x.title)??(x==null?void 0:x.sessionId)??f;Zd({ref:k,title:`Blade · ${_}`,body:Z?`${C} · ${Z}`:C,onOpen:q=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(_i,{detail:q})))}})}}if(!x){a(k);return}e($=>({sessions:$.sessions.map(A=>ie({sessionId:A.sessionId,projectPath:A.projectPath},k)?{...A,taskStatus:g,taskStatusReason:typeof u.properties.taskStatusReason=="string"?u.properties.taskStatusReason:void 0,taskFailure:g==="failed"?cf(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:s2(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 fe.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(),At.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 fe.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 fe.listProjects(),f=nf(),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 fe.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 fe.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 fe.abortSession(u);const p=ie(t().currentSessionRef,u);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(k=>ie(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 fe.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 fe.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 fe.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}}}},a2=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=Ea()((...e)=>({...O_(...e),...i2(...e),...k_(...e),...GD(...e),...a2(...e)}));function c2(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function l2({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),fe.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(Wc,{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(Jc,{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(ld,{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(ld,{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:c2(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(Ky,{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(Df,{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 zk({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=qt(),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 lf(){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 Gk=[{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 u2(e){const t=e.key.toLocaleLowerCase();return Gk.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 d2(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function f2(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 m2(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=f2();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function _c(e,t){const n=Gk.find(r=>r.id===e);return n?m2(n).join(""):""}const Vk="blade.sidebar.view",Wk="blade.preview.width",Za=640,p2=360,g2=960,h2=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(Vk);return e==="status"||e==="project"?e:"project"},Jk=e=>Math.min(g2,Math.max(p2,Math.round(e))),b2=()=>{if(typeof localStorage>"u")return Za;const e=localStorage.getItem(Wk);if(!e)return Za;const t=Number(e);return Number.isFinite(t)?Jk(t):Za},pr=Ea(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:h2(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(Vk,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:b2(),setPreviewWidth:t=>{const n=Jk(t);typeof localStorage<"u"&&localStorage.setItem(Wk,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 x2(){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=u2(s);if(!o)return;const i=pr.getState(),a=i.isTaskSwitcherOpen,l=d2(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(()=>lf());return}if(o.id==="focusComposer"){lf()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const Ju=S.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(xf,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(Dy,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(Qk,{}),c.jsx(Ly,{})]}));Ju.displayName=xf.displayName;const Qk=S.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(kf,{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(Uy,{className:"relative flex-1 rounded-full bg-border"})}));Qk.displayName=kf.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 Yk(e,t=!1){const n=await fe.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=qy,dr=Hy,Un=S.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(By,{children:c.jsx(yf,{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=yf.displayName;function k2(){const e=qt(),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(Sf,{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(Ju,{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 Yk(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(wf,{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(zy,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function Qu({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 uf={en:"sidebar.language.en",zh:"sidebar.language.zh"};function Xk({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=e2(),s=qt();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(uf[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:JD.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(uf[o])},o)})})}const y2="[data-mobile-navigation-trigger]";function A5(e){return Zk(y2,e)}function Zk(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function ey({open:e,onOpenChange:t}){const n=qt(),{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 fe.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(Wc,{open:e,onOpenChange:t,children:c.jsxs(qi,{onCloseAutoFocus:R=>Zk("[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(Jc,{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(Gy,{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(Hc,{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(vf,{className:"h-3.5 w-3.5"})})]},R.path)})})]})}):null}const S2={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 w2({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=qt(),[$,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:C=>F(C.target.value),onKeyDown:C=>{C.key==="Enter"&&M(),C.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(If,{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)]":S2[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:C=>{C.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(Kc,{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:C=>{C.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(Vy,{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:C=>{var q,K;C.preventDefault(),(K=(q=Z.current)==null?void 0:q.querySelector('[role="menuitem"]:not([disabled])'))==null||K.focus()},onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),C.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:C=>{C.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(Wy,{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:C=>{I(C),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(Jy,{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:C=>{C.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(Sf,{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:C=>{C.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(wf,{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:C=>{N(C),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(vf,{className:"h-3 w-3","aria-hidden":!0}),P("session.action.deleteShort")]})]})]})]})]})}function v2({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const u=qt(),f=[{icon:jf,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(Qu,{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(zc,{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(Cf,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":u("sidebar.action.searchTasks"),title:`${u("sidebar.action.searchTasks")} (${_c("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(Gc,{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(Xk,{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 ty="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 I2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(ty)??"[]");return Array.isArray(e)?oi(e):[]}catch{return[]}}function j2(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ty,JSON.stringify(oi(e)))}catch{}}function C2(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 T2(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 E2(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 A2({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=qt();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(Qy,{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(Yy,{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(zc,{className:"h-3.5 w-3.5"})})]})}function Dc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function df(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function Yu(e,t){return df(e)-df(t)||Dc(t)-Dc(e)}const P2=["running","queued","interrupted","failed","cancelled","completed"],N2={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},gs=e=>e.length>1?e.replace(/\/+$/,""):e;function ny(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 $2(e){const t=ny(e),n=[];for(const r of P2){const s=t.filter(o=>o.taskStatus===r).sort(Yu);s.length>0&&n.push({code:N2[r],status:r,sessions:s})}return n}function R2(e,t,n=[]){const r=ny(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(Yu),g=f.reduce((k,b)=>Math.max(k,Dc(b)),0);return{path:u,name:$c(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 ff=12,M2={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},O2={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 F2({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=qt(),[k,b]=S.useState({}),[y,j]=S.useState({}),[x,I]=S.useState(I2),[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"?$2(t):[],[t,e]),C=S.useMemo(()=>e==="project"?R2(t,n,r.map(D=>D.path)):[],[n,r,t,e]),q=S.useMemo(()=>C2(C,x),[C,x]),K=(D,se)=>{const $e=y[D]??!1,ge=$e?se:se.filter((Q,O)=>{if(O<ff)return!0;const U=xe(Q);return!!Q.pendingInteraction||o.includes(Ke(U))||!!(s&&ie(U,s))}),me=se.length-ge.length,We=$e?se.length>ff:me>0;return c.jsxs(c.Fragment,{children:[ge.map(p),We&&c.jsx("button",{type:"button",onClick:()=>j(Q=>({...Q,[D]:!$e})),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:$e?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:me})})]})},pe=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:[pe,Z.map((D,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]",O2[D.code]??"text-[hsl(var(--deck-ink-faint))]",se===0&&"pt-2"),children:[c.jsx("span",{children:g(M2[D.code])}),c.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:[D.sessions.length.toString().padStart(2,"0"),_?"+":""]})]}),K(`status:${D.code}`,D.sessions)]},D.code))]});const X=q.some(D=>D.isActive),oe=D=>!!(s&&D.sessions.some(se=>ie(xe(se),s))),Ue=(D,se)=>{if(D.join("\0")===q.map(ge=>ge.path).join("\0"))return;I(D),j2(D);const $e=q.find(ge=>ge.path===se);$(g("sidebar.project.reordered",{name:($e==null?void 0:$e.name)??se,position:D.indexOf(se)+1}))},Ae=(D,se)=>{const $e=D.sessions.filter(O=>o.includes(Ke(xe(O)))).length,ge=oe(D),me=$e>0,We=D.sessions.some(O=>!!O.pendingInteraction),Q=k[D.path]??(X&&!D.isActive&&!(ge||D.hasRunning||me||We));return c.jsxs("div",{"data-project-group":D.path,onDragEnter:O=>{!N||N===D.path||(O.preventDefault(),R(D.path))},onDragOver:O=>{!N||N===D.path||(O.preventDefault(),O.dataTransfer.dropEffect="move")},onDrop:O=>{O.preventDefault();const U=N||O.dataTransfer.getData("text/plain");U&&U!==D.path&&Ue(T2(q.map(je=>je.path),U,D.path),U),F(null),R(null)},className:W("relative transition-colors",M===D.path&&N!==D.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(A2,{name:D.name,path:D.path,count:D.sessions.length,countIsPartial:_,isActive:D.isActive,hasRunning:D.hasRunning,unreadCount:$e,collapsed:Q,onSelect:()=>l(D.path),onCreateTask:()=>u(D.path),reorderPosition:se+1,reorderCount:q.length,isDragging:N===D.path,onDragStart:O=>{O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("text/plain",D.path),F(D.path)},onDragEnd:()=>{F(null),R(null)},onReorderKeyDown:O=>{if(O.key!=="ArrowUp"&&O.key!=="ArrowDown")return;O.preventDefault();const U=E2(q.map(je=>je.path),D.path,O.key==="ArrowUp"?-1:1);Ue(U,D.path)},onToggle:()=>b(O=>({...O,[D.path]:!Q}))}),!Q&&K(`project:${D.path}`,D.sessions)]},D.path)};return c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"sr-only","aria-live":"polite",children:P}),pe,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(Ae)]})]})}function _2({className:e,onNavigate:t}){const n=qt(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:u,setTaskSwitcherOpen:f}=pr(),p=B(E=>E.sessions),g=B(E=>E.catalogLoadState),k=B(E=>E.catalogError),b=B(E=>E.currentSessionRef),y=B(E=>E.forkingSessionRef),j=B(E=>E.selectSession),x=B(E=>E.startTemporarySession),I=B(E=>E.deleteSession),N=B(E=>E.archiveSession),F=B(E=>E.forkSession),M=B(E=>E.updateSession),R=B(E=>E.loadSessions),P=B(E=>E.setError),$=B(E=>E.taskEventsConnected),A=B(E=>E.taskWorkspaceInfo),_=B(E=>E.boundProjects),Z=B(E=>E.selectedProjectPath),C=B(E=>E.bindProject),q=B(E=>E.selectProject),K=B(E=>E.cancelTask),pe=B(E=>E.cancellingTaskKeys),X=B(E=>E.retryTask),oe=B(E=>E.retryingTaskKeys),Ue=B(E=>E.unreadTaskKeys),[Ae,D]=S.useState(null),[se,$e]=S.useState(""),[ge,me]=S.useState(null),[We,Q]=S.useState(!1),O=Z??(A==null?void 0:A.cwd)??null,U=E=>co(E,n),je=E=>{var Hs;const Se=E.taskSourceProjectPath||E.projectPath,wt=Se.split("/").filter(Boolean).at(-1)||Se,_n=E.taskIsolation==="worktree"?E.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),us=E.taskDiffStat?`+${E.taskDiffStat.additions} −${E.taskDiffStat.deletions}`:void 0,qs=E.taskStatus==="queued"&&E.taskQueuePosition?n("session.queued",{position:E.taskQueuePosition,depth:E.taskQueueDepth??E.taskQueuePosition}):void 0,$r=(Hs=E.taskStatusReason)==null?void 0:Hs.trim(),he=E.taskFailure?n(Gu(E.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 E=>{_.some(Se=>Se.path===E)?q(E):await C(E),x(E),t==null||t()},bn=async E=>{_.some(Se=>Se.path===E)?q(E):await C(E),x(E),t==null||t()},Re=E=>{E(),t==null||t()},nr=async(E,Se)=>{E.stopPropagation(),await I(xe(Se))},rr=async E=>{const Se=xe(E),wt=Ke(Se);if(!ge){me(wt);try{await Yk(Se)}catch(_n){P(_n instanceof Error?_n.message:"Session export failed")}finally{me(null)}}},rn=(E,Se)=>{E.stopPropagation(),D(Ke(xe(Se))),$e(U(Se))},ls=async E=>{if(!se.trim()){D(null);return}try{await M(xe(E),se.trim()),D(null),await R()}catch(Se){console.error("Failed to rename session:",Se)}},H=()=>{D(null),$e("")};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(Qu,{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(Xy,{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(zc,{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:_c("newTask")})]}),c.jsxs("button",{onClick:()=>Re(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(Cf,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Re(()=>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(Gc,{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:Ue.length>0?Ue.length:_c("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(E=>c.jsx("button",{type:"button",onClick:()=>u(E),"aria-pressed":l===E,"aria-label":n(E==="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===E?"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(E==="project"?"sidebar.view.project":"sidebar.view.status")},E))}),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(Ju,{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(F2,{view:l,sessions:p,activeProjectPath:O,boundProjects:_,currentSessionRef:b,unreadTaskKeys:Ue,catalogLoadState:g,catalogError:k,onRetryCatalog:R,onSelectProject:E=>void Be(E).catch(()=>{}),onCreateTask:E=>void bn(E).catch(()=>{}),renderRow:E=>{const Se=xe(E),wt=Ke(Se),_n=ie(Se,b),us=Ae===wt,qs=ie(Se,y),$r=!!y;return c.jsx(w2,{session:E,sessionRef:Se,isActive:_n,isForking:qs,isUnread:Ue.includes(Ke(Se)),anyForking:$r,isEditing:us,editingTitle:se,title:U(E),context:je(E),isCancelling:pe.includes(Ke(Se)),isRetrying:oe.includes(Ke(Se)),isExporting:ge===wt,onSelect:()=>(t==null||t(),j(Se)),onCancelTask:()=>{K(Se).catch(()=>{})},onRetryTask:()=>{X(Se).catch(()=>{})},onFork:()=>void F(E),onArchive:()=>void N(Se),onExport:()=>void rr(E),onStartRename:he=>rn(he,E),onDelete:he=>nr(he,E),onEditingTitleChange:$e,onSaveRename:()=>ls(E),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(Tf,{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(k2,{}),[{icon:jf,action:()=>Re(r),labelKey:"sidebar.section.settings"}].map(({icon:E,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(E,{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(Xk,{})]}),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(ey,{open:We,onOpenChange:Q})]}):c.jsx(v2,{className:e,onExpand:s,onNewChat:pt,onOpenTaskSwitcher:()=>Re(()=>f(!0)),onToggleTerminal:()=>Re(a),onToggleSettings:()=>Re(r),isTerminalOpen:i,taskEventsConnected:$,unreadCount:Ue.length})}const D2=S.lazy(()=>Vr(()=>import("./SettingsModal-CW87OnxI.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),L2=S.lazy(()=>Vr(()=>import("./McpModal-BO-85gll.js"),__vite__mapDeps([4,1,3,5,2])).then(e=>({default:e.McpModal}))),U2=S.lazy(()=>Vr(()=>import("./SkillsModal-Q8ZFPhys.js"),__vite__mapDeps([6,1,5,3,2])).then(e=>({default:e.SkillsModal}))),ry=()=>Vr(()=>import("./TaskSwitcher-BzH-0QXr.js"),__vite__mapDeps([7,1,2,3])).then(e=>({default:e.TaskSwitcher})),B2=S.lazy(ry),q2=S.lazy(()=>Vr(()=>import("./FilePreview-CR_XetY0.js"),__vite__mapDeps([8,1,2,3])).then(e=>({default:e.FilePreview}))),H2=S.lazy(()=>Vr(()=>import("./TerminalPanel-DTqvx8yB.js"),__vite__mapDeps([9,1,10,11,2,3])).then(e=>({default:e.TerminalPanel}))),ec=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},K2=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function z2({children:e}){var We,Q;const t=qt();x2();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(()=>{ry()},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,C]=S.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),q=S.useRef(null),K=S.useRef(null),pe=S.useRef(null),X=S.useMemo(()=>y.find(O=>ie({sessionId:O.sessionId,projectPath:O.projectPath},b)),[b,y]),oe=(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=()=>C(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 Ue=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())},Ae=S.useMemo(()=>!k||x?F?ec(F):null:X!=null&&X.projectPath?ec(X.taskSourceProjectPath||X.projectPath):null,[k,X,x,F]),D=S.useMemo(()=>Ae?K2(Ae):[],[Ae]);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 fe.getGitInfo({sessionId:b.sessionId,projectPath:oe??b.projectPath});R(je.branch)}catch{R(null)}})()},[N,b,oe,F]);const se=I==null?void 0:I.taskAdmission,$e=oe??F??(I==null?void 0:I.cwd)??null,ge=b?Ke(b):`project:${F??"none"}`,me=r&&Z;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[A&&n&&!me&&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&&!me?"dialog":void 0,"aria-modal":A&&n&&!me?!0:void 0,"aria-label":A&&n&&!me?t("sidebar.navigationAria"):void 0,"aria-hidden":me||A&&!n?!0:void 0,inert:me||A&&!n?!0:void 0,onKeyDown:Ue,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(_2,{onNavigate:()=>{A&&g(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":me||void 0,inert:me||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(Zy,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[D.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:Ae??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:D.map((O,U)=>{const je=U===D.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?ec(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(Hc,{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(zk,{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:pe,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(e0,{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":me||void 0,inert:me||void 0,className:"flex relative flex-col flex-1 min-w-0",children:i?c.jsx(S.Suspense,{fallback:null,children:c.jsx(D2,{})}):e}),r&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(q2,{returnFocusElement:pe.current},ge)})]})]}),a&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(H2,{workspacePath:$e},$e??"default-workspace")}),l&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(B2,{})}),s&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(L2,{})}),o&&c.jsx(S.Suspense,{fallback:null,children:c.jsx(U2,{})}),c.jsx(l2,{open:P,onOpenChange:$})]})}const tc="BladeCode";function G2(){const e=qt(),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}) ${tc}`:tc,()=>{document.title=tc}),[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=Ku(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 sy=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}));sy.displayName="Textarea";const V2=(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}},W2=(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}:V2(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}},J2=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,Q2=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=J2(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 Y2(){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 X2=(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}},Z2=(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}:X2(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}},e5=(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}},t5="blade.composer.draft.",Xu=new Map;function Di(){return typeof sessionStorage>"u"?null:sessionStorage}function Li(e){return`${t5}${e}`}function n5(e){var n;if(!e)return{content:"",attachments:[]};const t=Xu.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){oy(e);return}Xu.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 oy(e){var t;if(e){Xu.delete(e);try{(t=Di())==null||t.removeItem(Li(e))}catch{}}}function Lc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function r5(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function s5(e,t){const r=Lc(e)+t.reduce((s,o)=>s+r5(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 o5=e=>typeof e=="object"&&"command"in e,mf=({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"?Ef:ud;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=o5(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(ud,{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"]})]})]})})},nc=[{value:fr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:t0},{value:fr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:n0},{value:fr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:Af,tone:"danger"},{value:fr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:r0}],i5=["off"],a5=["standard"],c5=[];function rc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function l5({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 ad;const x=qt(),I=S.useRef(n5(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,C]=S.useState(!1),[q,K]=S.useState(!1),[pe,X]=S.useState(!1),[oe,Ue]=S.useState(!1),[Ae,D]=S.useState(!1),[se,$e]=S.useState(!1),[ge,me]=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),Re=S.useRef(null),nr=S.useRef(null),{currentModelId:rr,configuredModels:rn,hasLoaded:ls,loadedWorkspacePath:H,loadModels:E,setCurrentModel:Se,currentMode:wt,setMode:_n}=At(),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}),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.reasoningEffort}),ay=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}),cy=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}),[ly,Zu]=S.useState(null),[uy,Na]=S.useState(null),[dy,$a]=S.useState(null),[fy,Ra]=S.useState(null),my=rn.some(v=>v.id===Hs),ds=he?ly??(my?Hs:rr):rr,Xe=rn.find(v=>v.id===ds),Ma=(Xe==null?void 0:Xe.supportedReasoningEfforts)??i5,ed=["auto",...Ma],Rr=uy??iy??"off",ii=(Xe==null?void 0:Xe.supportedServiceTiers)??a5,py=["auto",...ii],Mr=dy??ay??"auto",ai=(Xe==null?void 0:Xe.supportedResponseVerbosities)??c5,gy=["auto",...ai],Or=fy??cy??"auto",td=qs??"auto",hy=ed.length>1,by=ii.some(v=>v!=="standard"),xy=ai.length>0,nd=(Xe==null?void 0:Xe.displayName)||(Xe==null?void 0:Xe.model)||ds||x("chat.input.model.placeholder"),sr=((ad=Xe==null?void 0:Xe.input)==null?void 0:ad.includes("image"))===!0,Ks=Xe?x("chat.input.attachment.modelUnsupported",{model:nd}):x("chat.input.attachment.modelRequired"),ci=M.length>0&&!sr,Gt=Z2(N,A,{workspacePath:j}),Vt=W2(N,A,{workspacePath:j}),fs=Y2(),zs=Gt.hasQuery&&Gt.suggestions.length>0,li=Vt.hasQuery&&Vt.suggestions.length>0,ky=zs||li;S.useEffect(()=>{!us&&(!ls||H!==(j??null))&&E(j??void 0)},[us,E,H,ls,j]),S.useEffect(()=>{o&&(C(!1),K(!1),X(!1),Ue(!1))},[o]),S.useEffect(()=>{Zu(null),Na(null),$a(null),Ra(null)},[he==null?void 0:he.projectPath,he==null?void 0:he.sessionId]),S.useEffect(()=>{Rr!=="auto"&&!Ma.includes(Rr)&&Na("auto")},[Rr,Ma]),S.useEffect(()=>{Mr!=="auto"&&!ii.includes(Mr)&&$a("auto")},[Mr,ii]),S.useEffect(()=>{Or!=="auto"&&!ai.includes(Or)&&Ra("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=Re.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 Oa=S.useCallback(async()=>{if(!N.trim()&&M.length===0||n||pt||ci||bn.current)return;N.trim()&&fs.addToHistory(N),bn.current=!0,me(!0);const v=b;try{if(await e({content:N,modelId:ds??void 0,reasoningEffort:Rr,serviceTier:Mr,responseVerbosity:Or,communicationStyle:td,attachments:M})===!1)return;oy(v),P.current="",$.current=[],F(""),R([]),Q(null),U(null),Be.current=null,_(void 0)}catch{}finally{bn.current=!1,me(!1)}},[M,ci,b,N,n,ds,Rr,Or,td,Mr,pt,e,fs]),yy=S.useCallback(v=>{Q(null),U(null),Be.current=null,R(Y=>{const J=Y.filter(Pe=>Pe.id!==v);return $.current=J,Ln(b,{content:P.current,attachments:J}),J})},[b]),rd=S.useCallback(v=>new Promise((Y,J)=>{const Pe=new FileReader;Pe.onload=()=>{if(typeof Pe.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:Pe.result})},Pe.onerror=()=>J(Pe.error??new Error("Failed to read image")),Pe.readAsDataURL(v)}),[]),ui=S.useCallback(async v=>{if(v.length===0)return;if(!sr){Be.current=Ks,U(null),Q(Ks);return}const Y=s5($.current,v),J=Pe=>Pe==="count"?x("chat.input.attachment.countLimit",{count:Ur}):x("chat.input.attachment.sizeLimit",{size:rc(io)});if(!Y.accepted){Be.current=null,U(null),Q(J(Y.reason??"bytes"));return}try{const Pe=await Promise.all(v.map(ms=>rd(ms))),Et=new Set($.current.map(ms=>ms.dataUrl)),cd=Pe.filter(ms=>Et.has(ms.dataUrl)?!1:(Et.add(ms.dataUrl),!0));if(cd.length===0){Q(null),U(null),Be.current=null;return}const di=[...$.current,...cd];if(Lc(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,rd,x]),Sy=S.useCallback(async v=>{const Y=Array.from(v.target.files??[]).filter(J=>J.type.startsWith("image/"));await ui(Y),v.target.value=""},[ui]),wy=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]),Fa=S.useCallback(v=>{const Y=Gt.suggestions[v];if(!Y)return;const{newInput:J,newCursorPos:Pe}=e5(N,Gt,Y);P.current=J,F(J),_(Pe),Ln(b,{content:J,attachments:$.current}),requestAnimationFrame(()=>{Re.current&&(Re.current.focus(),Re.current.setSelectionRange(Pe,Pe))})},[b,N,Gt]),_a=S.useCallback(v=>{const Y=Vt.suggestions[v];if(!Y)return;const{newInput:J,newCursorPos:Pe}=Q2(N,Vt,Y);P.current=J,F(J),_(Pe),Ln(b,{content:J,attachments:$.current}),requestAnimationFrame(()=>{Re.current&&(Re.current.focus(),Re.current.setSelectionRange(Pe,Pe))})},[Vt,b,N]),vy=S.useCallback(v=>{if(zs){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(li){if(v.key==="ArrowDown"){v.preventDefault(),Vt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Vt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),_a(Vt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),_(void 0);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Oa();return}if(v.key==="ArrowUp"&&!v.shiftKey){const Y=v.target,J=Y.selectionStart===0&&Y.selectionEnd===0,Pe=!N.includes(`
31
- `);if(J||Pe){const Et=fs.getPrevious(N);Et!==null&&(v.preventDefault(),P.current=Et,F(Et),Ln(b,{content:Et,attachments:$.current}),requestAnimationFrame(()=>{Re.current&&Re.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,Pe=!N.includes(`
32
- `);if((J||Pe)&&fs.historyIndex!==-1){const Et=fs.getNext();Et!==null&&(v.preventDefault(),P.current=Et,F(Et),Ln(b,{content:Et,attachments:$.current}),requestAnimationFrame(()=>{Re.current&&Re.current.setSelectionRange(Et.length,Et.length)}))}}},[zs,li,Gt,Vt,Fa,_a,Oa,b,N,fs]),Iy=S.useCallback(v=>{const Y=v.target.value;P.current=Y,F(Y),_(v.target.selectionStart),Ln(b,{content:Y,attachments:$.current})},[b]),sd=S.useCallback(v=>{const Y=v.target;_(Y.selectionStart)},[]);S.useEffect(()=>{Re.current&&(Re.current.style.height="inherit",Re.current.style.height=`${Math.min(Re.current.scrollHeight,200)}px`)},[N]);const Da=nc.find(v=>v.value===wt)??nc[1],jy=x(Da.labelKey),Cy=Da.icon,Ty=!!N.trim()||M.length>0,od=M.length>=Ur,Ey=Lc(M),La=We||(ci?Ks:null),id=La?null:O,Ua=!!n||ge,Ay=Ua||od||!sr,Gs=sr?od?x("chat.input.attachment.countLimit",{count:Ur}):x("chat.input.attachment.add"):Ks,Py=()=>{Ua||(U(Gs),!sr&&!o&&rn.some(v=>{var Y;return(Y=v.input)==null?void 0:Y.includes("image")})&&C(!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(mf,{type:"command",suggestions:Gt.suggestions,selectedIndex:Gt.selectedIndex,loading:Gt.loading,onSelect:Fa,onHover:Gt.setSelectedIndex,visible:zs}),c.jsx(mf,{type:"file",suggestions:Vt.suggestions,selectedIndex:Vt.selectedIndex,loading:Vt.loading,onSelect:_a,onHover:Vt.setSelectedIndex,visible:li&&!zs}),c.jsx(sy,{ref:Re,"data-blade-composer":!0,value:N,onChange:Iy,onKeyDown:vy,onPaste:wy,onSelect:sd,onClick:sd,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})}),La&&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:La}),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"})})]}),id&&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(s0,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:id}),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:rc(Ey),budget:rc(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:()=>yy(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:[Ay?c.jsx("button",{type:"button",disabled:Ua,"aria-disabled":"true","aria-label":Gs,title:Gs,onClick:Py,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(dd,{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:Sy}),c.jsx(dd,{className:"w-4 h-4"})]}),c.jsxs(ur,{open:Z,onOpenChange:v=>{!o&&!ge&&C(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:[nd,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 Pe;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){Zu(J.id),C(!1);return}Se(J.id,j??void 0).then(()=>C(!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}),((Pe=J.input)==null?void 0:Pe.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))})})]}),hy&&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:ed.map(v=>c.jsxs("button",{type:"button","aria-label":x("chat.input.effort.option",{effort:v}),onClick:()=>{Na(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))})]})]}),by&&c.jsxs(ur,{open:pe,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:py.map(v=>c.jsxs("button",{type:"button","aria-label":x("chat.input.serviceTier.option",{tier:v}),onClick:()=>{$a(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))})]})]}),xy&&c.jsxs(ur,{open:oe,onOpenChange:v=>{!o&&!ge&&Ue(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:gy.map(v=>c.jsxs("button",{type:"button","aria-label":x("chat.input.responseVerbosity.option",{verbosity:v}),onClick:()=>{Ra(v),Ue(!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:Ae,onOpenChange:D,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 ${Da.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(Cy,{className:"h-3.5 w-3.5"}),jy,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:nc.map(v=>{const Y=v.icon,J=wt===v.value,Pe=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?(D(!1),$e(!0)):(_n(v.value),D(!1))},children:[c.jsx(Y,{className:`mt-0.5 h-4 w-4 shrink-0 ${Pe?"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 ${Pe?"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(If,{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(Kc,{className:"w-3 h-3"})}),c.jsx(mr,{size:"icon",onClick:Oa,disabled:!Ty||n||pt||ci||ge||ky,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(o0,{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(Wc,{open:se,onOpenChange:$e,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(Af,{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:()=>$e(!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),$e(!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 u5={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 d5(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 f5(e){return e.split("/").filter(Boolean).at(-1)||e}function m5({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const u=qt(),f=[...e].sort(Yu).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=u5[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=f5(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(Gu(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:d5(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(i0,{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(Kc,{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 p5({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 sc=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:Gc,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:a0,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:c0,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:l0,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function g5(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function h5(){const e=qt(),{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=At(H=>H.currentMode),C=At(H=>H.currentModelId),q=At(H=>H.configuredModels),K=At(H=>H.isLoading),pe=At(H=>H.hasLoaded),X=At(H=>H.loadedWorkspacePath),oe=At(H=>H.error),Ue=At(H=>H.loadModels),[Ae,D]=S.useState("worktree"),[se,$e]=S.useState(),[ge,me]=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(()=>C_(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&&(!pe||X!==U)&&Ue(U)},[_,Ue,X,pe,U]);const pt=!(Q!=null&&Q.available)&&n,Be=Q!=null&&Q.available?null:r,bn=!!(U&&!pt&&!Be),Re=!!(C&&q.some(H=>H.id===C)),nr=!pe||K,rr=bn&&Re&&!nr&&oe===null,rn=S.useMemo(()=>({project:g5(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:Ae,permissionMode:Z,modelId:H.modelId??C??void 0,reasoningEffort:H.reasoningEffort,serviceTier:H.serviceTier,responseVerbosity:H.responseVerbosity,communicationStyle:H.communicationStyle,attachments:H.attachments.map(E=>({type:"image",content:E.dataUrl,mimeType:E.mimeType,name:E.name}))})},[Z,C,f,Ae,p,g,U]);return S.useEffect(()=>{const H=E=>{if(!(E.metaKey||E.ctrlKey))return;const Se=Number.parseInt(E.key,10);if(Number.isNaN(Se)||Se<1||Se>sc.length)return;const wt=sc[Se-1];wt&&(E.preventDefault(),$e({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(Qu,{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(fd,{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(Ef,{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:sc.map((H,E)=>c.jsx(p5,{index:E,title:e(H.titleKey),description:e(H.descriptionKey),icon:H.icon,hint:e(H.hintKey),onClick:()=>$e({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":Ae==="worktree",onClick:()=>D(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",Ae==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[Ae==="worktree"?c.jsx(u0,{className:"w-3 h-3"}):c.jsx(d0,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:e(Ae==="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(Hc,{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(zk,{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(md,{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:()=>me(!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",Re&&!oe?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":oe?"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"}):Re&&!oe?c.jsx(md,{className:"h-3.5 w-3.5"}):oe?c.jsx(lo,{className:"h-3.5 w-3.5"}):c.jsx(pd,{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:oe??void 0,className:W("mt-0.5 block truncate text-[10.5px]",oe?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:nr?e("taskHome.setup.model.loading"):oe||e(Re?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!nr&&(!Re||oe)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{oe?Ue(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:[oe?c.jsx(no,{className:"w-3 h-3"}):c.jsx(pd,{className:"w-3 h-3"}),e(oe?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(l5,{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),$e(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(fd,{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(m5,{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(Tf,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(ey,{open:ge,onOpenChange:me})]})})}const Uc="blade.sessions.last",Ui="session",Bc="project",qc="workspace";function b5(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 x5(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(Bc))==null?void 0:i.trim())||null,s=((a=t.get(qc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Ui)}}function k5(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(Uc);return t?b5(JSON.parse(t)):null}catch{return null}}function y5(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(Bc,o):s.searchParams.delete(Bc),i&&o&&i!==o?s.searchParams.set(qc,i):s.searchParams.delete(qc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(Uc,JSON.stringify(e)):a==null||a.removeItem(Uc)}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 S5=S.lazy(()=>Vr(()=>import("./ChatView-Y-6k-ayR.js"),__vite__mapDeps([12,1,2,3])).then(e=>({default:e.ChatView})));function w5(){const e=qt(),[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=At(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=x5(window.location.search),M=k5(),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(C=>C.path===F.projectPath&&C.available))==null?void 0:Z.path:null;if(_&&p(_),!(R&&(await f(R),I))){if(!R||!ie(B.getState().currentSessionRef,R)){const C=R?B.getState().error:null;g(),C&&k(C)}$||n(!0)}})(),()=>{I=!0}},[l,j,u,x,a,p,f,k,g]),S.useEffect(()=>{if(!t)return;const I=o?Ku(b,o):void 0;y5(o,y,{displayProjectPath:I?si(I,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(G2,{}),c.jsx(z2,{children:t?!o||i?c.jsx(h5,{}):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(S5,{})}):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")})})]})}Ry.createRoot(document.getElementById("root")).render(c.jsx(Xs.StrictMode,{children:c.jsx(w5,{})}));export{At as A,Qu as B,l5 as C,Wc as D,bo as E,m2 as F,A5 as G,Yu as H,co as I,si as J,Gk as K,$c as L,ys as M,_c as N,p_ as O,ur as P,mr as Q,E5 as R,Ju as S,Vr as _,B as a,pr as b,xe as c,Ke as d,qi as e,Jc as f,Hi as g,Ki as h,Df as i,W as j,fe as k,x_ as l,zn as m,Aa as n,Si as o,Ku as p,__ as q,lf as r,ie as s,Gu as t,qt as u,dr as v,Un as w,cr as x,Zk as y,e2 as z};