kaizenai 0.8.0 → 0.8.1

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 (31) hide show
  1. package/dist/client/assets/{FeatureOverviewPage-BirqNTQI.js → FeatureOverviewPage-CFYLJ3BM.js} +1 -1
  2. package/dist/client/assets/FeatureOverviewPage-CFYLJ3BM.js.br +0 -0
  3. package/dist/client/assets/FeatureOverviewPage-CFYLJ3BM.js.gz +0 -0
  4. package/dist/client/assets/{LocalProjectsPage-CUrz_W-H.js → LocalProjectsPage-rVcfQqeI.js} +1 -1
  5. package/dist/client/assets/LocalProjectsPage-rVcfQqeI.js.br +0 -0
  6. package/dist/client/assets/LocalProjectsPage-rVcfQqeI.js.gz +0 -0
  7. package/dist/client/assets/SettingsPage-DQ7vlMU3.js +51 -0
  8. package/dist/client/assets/SettingsPage-DQ7vlMU3.js.br +0 -0
  9. package/dist/client/assets/SettingsPage-DQ7vlMU3.js.gz +0 -0
  10. package/dist/client/assets/{eye-DDtWGlwo.js → eye-BoB-RrDz.js} +1 -1
  11. package/dist/client/assets/eye-BoB-RrDz.js.br +0 -0
  12. package/dist/client/assets/eye-BoB-RrDz.js.gz +0 -0
  13. package/dist/client/assets/{index-BAzvPbMu.js → index-C6T6qDr6.js} +3 -3
  14. package/dist/client/assets/index-C6T6qDr6.js.br +0 -0
  15. package/dist/client/assets/index-C6T6qDr6.js.gz +0 -0
  16. package/dist/client/index.html +1 -1
  17. package/dist/server/build-target.json +1 -1
  18. package/dist/server/cli-supervisor.js +1 -1
  19. package/dist/server/cli.js +14 -7
  20. package/package.json +1 -1
  21. package/dist/client/assets/FeatureOverviewPage-BirqNTQI.js.br +0 -0
  22. package/dist/client/assets/FeatureOverviewPage-BirqNTQI.js.gz +0 -0
  23. package/dist/client/assets/LocalProjectsPage-CUrz_W-H.js.br +0 -0
  24. package/dist/client/assets/LocalProjectsPage-CUrz_W-H.js.gz +0 -0
  25. package/dist/client/assets/SettingsPage-CyQ5qYJC.js +0 -51
  26. package/dist/client/assets/SettingsPage-CyQ5qYJC.js.br +0 -0
  27. package/dist/client/assets/SettingsPage-CyQ5qYJC.js.gz +0 -0
  28. package/dist/client/assets/eye-DDtWGlwo.js.br +0 -0
  29. package/dist/client/assets/eye-DDtWGlwo.js.gz +0 -0
  30. package/dist/client/assets/index-BAzvPbMu.js.br +0 -0
  31. package/dist/client/assets/index-BAzvPbMu.js.gz +0 -0
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CU67Zn6k.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/angular-ts-BwZT4LLn.js","assets/scss-OYdSNvt2.js","assets/apl-dKokRX4l.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-CbQHKStN.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-D4QpJJKB.js","assets/html-derivative-BFtXZ54Q.js","assets/sql-BLtJtn59.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nwyudZeR.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-tKQVLTB8.js","assets/shellscript-Yzrsuije.js","assets/edge-BkV0erSs.js","assets/elixir-CDX3lj18.js","assets/elm-DbKCFpqz.js","assets/erb-B12qg9BL.js","assets/ruby-Dw2BHqvy.js","assets/haml-B8DHNrY2.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Rg0-pVw9.js","assets/glimmer-ts-U6CK756n.js","assets/hack-CaT9iCJl.js","assets/handlebars-BL8al0AC.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-4LBKfQ-Z.js","assets/jison-wvAkD_A8.js","assets/julia-CxzCAyBv.js","assets/r-Dspwwk_N.js","assets/just-Cw27pwNe.js","assets/perl-C0TMdlhV.js","assets/latex-CWtU0Tv5.js","assets/tex-idrVyKtj.js","assets/liquid-DYVedYrR.js","assets/marko-CnJfTvn9.js","assets/less-B1dDrJ26.js","assets/mdc-BMNejdWA.js","assets/nextflow-Zz6hmt5N.js","assets/nextflow-groovy-BeH2EWoN.js","assets/nginx-BpAMiNFr.js","assets/nim-CVrawwO9.js","assets/php-Dhbhpdrm.js","assets/pug-CGlum2m_.js","assets/qml-3beO22l8.js","assets/razor-Uh8Bk_45.js","assets/csharp-COcwbKMJ.js","assets/rst-BrH8l1NY.js","assets/cmake-D1j8_8rp.js","assets/sas-cz2c8ADy.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-Brmx7dQM.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-BH5u7GGu.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-C_ipcX3V.js","assets/templ-P3uqSqPl.js","assets/go-CxLEBnE3.js","assets/ts-tags-zn1MmPIZ.js","assets/twig-DNn4PbVi.js","assets/vue-DN_0RTcg.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-CQOfvN7w.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js","assets/FeatureOverviewPage-BirqNTQI.js","assets/eye-DDtWGlwo.js","assets/SettingsPage-CyQ5qYJC.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CU67Zn6k.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/angular-ts-BwZT4LLn.js","assets/scss-OYdSNvt2.js","assets/apl-dKokRX4l.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-CbQHKStN.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-D4QpJJKB.js","assets/html-derivative-BFtXZ54Q.js","assets/sql-BLtJtn59.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nwyudZeR.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-tKQVLTB8.js","assets/shellscript-Yzrsuije.js","assets/edge-BkV0erSs.js","assets/elixir-CDX3lj18.js","assets/elm-DbKCFpqz.js","assets/erb-B12qg9BL.js","assets/ruby-Dw2BHqvy.js","assets/haml-B8DHNrY2.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Rg0-pVw9.js","assets/glimmer-ts-U6CK756n.js","assets/hack-CaT9iCJl.js","assets/handlebars-BL8al0AC.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-4LBKfQ-Z.js","assets/jison-wvAkD_A8.js","assets/julia-CxzCAyBv.js","assets/r-Dspwwk_N.js","assets/just-Cw27pwNe.js","assets/perl-C0TMdlhV.js","assets/latex-CWtU0Tv5.js","assets/tex-idrVyKtj.js","assets/liquid-DYVedYrR.js","assets/marko-CnJfTvn9.js","assets/less-B1dDrJ26.js","assets/mdc-BMNejdWA.js","assets/nextflow-Zz6hmt5N.js","assets/nextflow-groovy-BeH2EWoN.js","assets/nginx-BpAMiNFr.js","assets/nim-CVrawwO9.js","assets/php-Dhbhpdrm.js","assets/pug-CGlum2m_.js","assets/qml-3beO22l8.js","assets/razor-Uh8Bk_45.js","assets/csharp-COcwbKMJ.js","assets/rst-BrH8l1NY.js","assets/cmake-D1j8_8rp.js","assets/sas-cz2c8ADy.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-Brmx7dQM.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-BH5u7GGu.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-C_ipcX3V.js","assets/templ-P3uqSqPl.js","assets/go-CxLEBnE3.js","assets/ts-tags-zn1MmPIZ.js","assets/twig-DNn4PbVi.js","assets/vue-DN_0RTcg.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-CQOfvN7w.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js","assets/FeatureOverviewPage-CFYLJ3BM.js","assets/eye-BoB-RrDz.js","assets/SettingsPage-DQ7vlMU3.js"])))=>i.map(i=>d[i]);
2
2
  var aB=Object.defineProperty;var lB=Object.getPrototypeOf;var cB=Reflect.get;var b5=t=>{throw TypeError(t)};var uB=(t,e,n)=>e in t?aB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var re=(t,e,n)=>uB(t,typeof e!="symbol"?e+"":e,n),dy=(t,e,n)=>e.has(t)||b5("Cannot "+n);var fr=(t,e,n)=>(dy(t,e,"read from private field"),n?n.call(t):e.get(t)),ml=(t,e,n)=>e.has(t)?b5("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ms=(t,e,n,r)=>(dy(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),fy=(t,e,n)=>(dy(t,e,"access private method"),n);var _5=(t,e,n)=>cB(lB(t),n,e);function dB(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function ub(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hy={exports:{}},Uf={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -490,7 +490,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
490
490
  3. Refresh the page.
491
491
  4. Right-click the get-current-period-usage request.
492
492
  5. Copy > Copy as cURL.
493
- 6. Paste it here.`;function hG(t){const e=ke.c(44),{open:n,onOpenChange:r,onSubmit:i}=t,s=x.useRef(null),[o,l]=x.useState(""),[c,d]=x.useState(!1);let f,h;e[0]!==n?(f=()=>{n&&(l(""),setTimeout(()=>{var I;return(I=s.current)==null?void 0:I.focus()},0))},h=[n],e[0]=n,e[1]=f,e[2]=h):(f=e[1],h=e[2]),x.useEffect(f,h);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=async function(){const V=await navigator.clipboard.readText();l(V)},e[3]=m):m=e[3];const v=m;let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=async function(){await navigator.clipboard.writeText(bT),d(!0),setTimeout(()=>d(!1),2e3)},e[4]=_):_=e[4];const y=_;let S;e[5]!==o?(S=o.trim(),e[5]=o,e[6]=S):S=e[6];const C=S.length>0;let R;e[7]!==C||e[8]!==o||e[9]!==i?(R=I=>{I.preventDefault(),C&&i(o.trim())},e[7]=C,e[8]=o,e[9]=i,e[10]=R):R=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=g.jsx(qw,{children:"Import Cursor Session"}),e[11]=k):k=e[11];let T,M;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=g.jsxs(Kw,{children:["Paste the copied ",g.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),M=g.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:bT}),e[12]=T,e[13]=M):(T=e[12],M=e[13]);let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=g.jsx(gt,{type:"button",variant:"ghost",size:"sm",onClick:()=>void v(),children:"Paste Clipboard"}),e[14]=A):A=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=()=>void y(),e[15]=D):D=e[15];let z;e[16]!==c?(z=c?g.jsx(hi,{className:"h-4 w-4"}):g.jsx(fd,{className:"h-4 w-4"}),e[16]=c,e[17]=z):z=e[17];const G=c?"Copied":"Copy Steps";let $;e[18]!==G?($=g.jsx("span",{className:"ml-1",children:G}),e[18]=G,e[19]=$):$=e[19];let H;e[20]!==z||e[21]!==$?(H=g.jsxs("div",{className:"flex gap-2",children:[A,g.jsxs(gt,{type:"button",variant:"ghost",size:"sm",onClick:D,children:[z,$]})]}),e[20]=z,e[21]=$,e[22]=H):H=e[22];let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=I=>l(I.target.value),e[23]=F):F=e[23];let B;e[24]!==o?(B=g.jsx(sp,{ref:s,value:o,onChange:F,rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"}),e[24]=o,e[25]=B):B=e[25];let j;e[26]!==H||e[27]!==B?(j=g.jsxs(Yw,{className:"space-y-4",children:[k,T,M,H,B]}),e[26]=H,e[27]=B,e[28]=j):j=e[28];let U;e[29]!==r?(U=g.jsx(gt,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"}),e[29]=r,e[30]=U):U=e[30];const P=!C;let W;e[31]!==P?(W=g.jsx(gt,{type:"submit",variant:"secondary",size:"sm",disabled:P,children:"Import Session"}),e[31]=P,e[32]=W):W=e[32];let q;e[33]!==U||e[34]!==W?(q=g.jsxs(Xw,{children:[U,W]}),e[33]=U,e[34]=W,e[35]=q):q=e[35];let Y;e[36]!==j||e[37]!==q||e[38]!==R?(Y=g.jsx(yb,{size:"lg",children:g.jsxs("form",{onSubmit:R,children:[j,q]})}),e[36]=j,e[37]=q,e[38]=R,e[39]=Y):Y=e[39];let N;return e[40]!==r||e[41]!==n||e[42]!==Y?(N=g.jsx(Ww,{open:n,onOpenChange:r,children:Y}),e[40]=r,e[41]=n,e[42]=Y,e[43]=N):N=e[43],N}const pG=["top","right","bottom","left"],Gl=Math.min,Yi=Math.max,gv=Math.round,Gm=Math.floor,Oo=t=>({x:t,y:t}),mG={left:"right",right:"left",bottom:"top",top:"bottom"};function Rx(t,e,n){return Yi(t,Gl(e,n))}function Ta(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function Ud(t){return t.split("-")[1]}function Qw(t){return t==="x"?"y":"x"}function Zw(t){return t==="y"?"height":"width"}function Mo(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Jw(t){return Qw(Mo(t))}function gG(t,e,n){n===void 0&&(n=!1);const r=Ud(t),i=Jw(t),s=Zw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=vv(o)),[o,vv(o)]}function vG(t){const e=vv(t);return[Tx(t),e,Tx(e)]}function Tx(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const _T=["left","right"],yT=["right","left"],bG=["top","bottom"],_G=["bottom","top"];function yG(t,e,n){switch(t){case"top":case"bottom":return n?e?yT:_T:e?_T:yT;case"left":case"right":return e?bG:_G;default:return[]}}function xG(t,e,n,r){const i=Ud(t);let s=yG(Aa(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Tx)))),s}function vv(t){const e=Aa(t);return mG[e]+t.slice(e.length)}function SG(t){return{top:0,right:0,bottom:0,left:0,...t}}function HL(t){return typeof t!="number"?SG(t):{top:t,right:t,bottom:t,left:t}}function bv(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function xT(t,e,n){let{reference:r,floating:i}=t;const s=Mo(e),o=Jw(e),l=Zw(o),c=Aa(e),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,m=r[l]/2-i[l]/2;let v;switch(c){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(Ud(e)){case"start":v[o]-=m*(n&&d?-1:1);break;case"end":v[o]+=m*(n&&d?-1:1);break}return v}async function wG(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:v=0}=Ta(e,t),_=HL(v),S=l[m?h==="floating"?"reference":"floating":h],C=bv(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},M=bv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:k,strategy:c}):R);return{top:(C.top-M.top+_.top)/T.y,bottom:(M.bottom-C.bottom+_.bottom)/T.y,left:(C.left-M.left+_.left)/T.x,right:(M.right-C.right+_.right)/T.x}}const CG=50,EG=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:wG},c=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:h}=xT(d,r,c),m=r,v=0;const _={};for(let y=0;y<s.length;y++){const S=s[y];if(!S)continue;const{name:C,fn:R}=S,{x:k,y:T,data:M,reset:A}=await R({x:f,y:h,initialPlacement:r,placement:m,strategy:i,middlewareData:_,rects:d,platform:l,elements:{reference:t,floating:e}});f=k??f,h=T??h,_[C]={..._[C],...M},A&&v<CG&&(v++,typeof A=="object"&&(A.placement&&(m=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:f,y:h}=xT(d,m,c)),y=-1)}return{x:f,y:h,placement:m,strategy:i,middlewareData:_}},kG=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=e,{element:d,padding:f=0}=Ta(t,e)||{};if(d==null)return{};const h=HL(f),m={x:n,y:r},v=Jw(i),_=Zw(v),y=await o.getDimensions(d),S=v==="y",C=S?"top":"left",R=S?"bottom":"right",k=S?"clientHeight":"clientWidth",T=s.reference[_]+s.reference[v]-m[v]-s.floating[_],M=m[v]-s.reference[v],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let D=A?A[k]:0;(!D||!await(o.isElement==null?void 0:o.isElement(A)))&&(D=l.floating[k]||s.floating[_]);const z=T/2-M/2,G=D/2-y[_]/2-1,$=Gl(h[C],G),H=Gl(h[R],G),F=$,B=D-y[_]-H,j=D/2-y[_]/2+z,U=Rx(F,j,B),P=!c.arrow&&Ud(i)!=null&&j!==U&&s.reference[_]/2-(j<F?$:H)-y[_]/2<0,W=P?j<F?j-F:j-B:0;return{[v]:m[v]+W,data:{[v]:U,centerOffset:j-U-W,...P&&{alignmentOffset:W}},reset:P}}}),RG=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:y=!0,...S}=Ta(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Aa(i),R=Mo(l),k=Aa(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),M=m||(k||!y?[vv(l)]:vG(l)),A=_!=="none";!m&&A&&M.push(...xG(l,y,_,T));const D=[l,...M],z=await c.detectOverflow(e,S),G=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(z[C]),h){const j=gG(i,o,T);G.push(z[j[0]],z[j[1]])}if($=[...$,{placement:i,overflows:G}],!G.every(j=>j<=0)){var H,F;const j=(((H=s.flip)==null?void 0:H.index)||0)+1,U=D[j];if(U&&(!(h==="alignment"?R!==Mo(U):!1)||$.every(q=>Mo(q.placement)===R?q.overflows[0]>0:!0)))return{data:{index:j,overflows:$},reset:{placement:U}};let P=(F=$.filter(W=>W.overflows[0]<=0).sort((W,q)=>W.overflows[1]-q.overflows[1])[0])==null?void 0:F.placement;if(!P)switch(v){case"bestFit":{var B;const W=(B=$.filter(q=>{if(A){const Y=Mo(q.placement);return Y===R||Y==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(Y=>Y>0).reduce((Y,N)=>Y+N,0)]).sort((q,Y)=>q[1]-Y[1])[0])==null?void 0:B[0];W&&(P=W);break}case"initialPlacement":P=l;break}if(i!==P)return{reset:{placement:P}}}return{}}}};function ST(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function wT(t){return pG.some(e=>t[e]>=0)}const TG=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=Ta(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),l=ST(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:wT(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),l=ST(o,n.floating);return{data:{escapedOffsets:l,escaped:wT(l)}}}default:return{}}}}},UL=new Set(["left","top"]);async function AG(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Aa(n),l=Ud(n),c=Mo(n)==="y",d=UL.has(o)?-1:1,f=s&&c?-1:1,h=Ta(e,t);let{mainAxis:m,crossAxis:v,alignmentAxis:_}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof _=="number"&&(v=l==="end"?_*-1:_),c?{x:v*f,y:m*d}:{x:m*d,y:v*f}}const MG=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=e,c=await AG(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},NG=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:C=>{let{x:R,y:k}=C;return{x:R,y:k}}},...d}=Ta(t,e),f={x:n,y:r},h=await s.detectOverflow(e,d),m=Mo(Aa(i)),v=Qw(m);let _=f[v],y=f[m];if(o){const C=v==="y"?"top":"left",R=v==="y"?"bottom":"right",k=_+h[C],T=_-h[R];_=Rx(k,_,T)}if(l){const C=m==="y"?"top":"left",R=m==="y"?"bottom":"right",k=y+h[C],T=y-h[R];y=Rx(k,y,T)}const S=c.fn({...e,[v]:_,[m]:y});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[v]:o,[m]:l}}}}}},LG=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Ta(t,e),f={x:n,y:r},h=Mo(i),m=Qw(h);let v=f[m],_=f[h];const y=Ta(l,e),S=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const k=m==="y"?"height":"width",T=s.reference[m]-s.floating[k]+S.mainAxis,M=s.reference[m]+s.reference[k]-S.mainAxis;v<T?v=T:v>M&&(v=M)}if(d){var C,R;const k=m==="y"?"width":"height",T=UL.has(Aa(i)),M=s.reference[h]-s.floating[k]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:S.crossAxis),A=s.reference[h]+s.reference[k]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?S.crossAxis:0);_<M?_=M:_>A&&(_=A)}return{[m]:v,[h]:_}}}},DG=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:c=()=>{},...d}=Ta(t,e),f=await o.detectOverflow(e,d),h=Aa(i),m=Ud(i),v=Mo(i)==="y",{width:_,height:y}=s.floating;let S,C;h==="top"||h==="bottom"?(S=h,C=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,S=m==="end"?"top":"bottom");const R=y-f.top-f.bottom,k=_-f.left-f.right,T=Gl(y-f[S],R),M=Gl(_-f[C],k),A=!e.middlewareData.shift;let D=T,z=M;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(D=R),A&&!m){const $=Yi(f.left,0),H=Yi(f.right,0),F=Yi(f.top,0),B=Yi(f.bottom,0);v?z=_-2*($!==0||H!==0?$+H:Yi(f.left,f.right)):D=y-2*(F!==0||B!==0?F+B:Yi(f.top,f.bottom))}await c({...e,availableWidth:z,availableHeight:D});const G=await o.getDimensions(l.floating);return _!==G.width||y!==G.height?{reset:{rects:!0}}:{}}}};function wb(){return typeof window<"u"}function Vd(t){return VL(t)?(t.nodeName||"").toLowerCase():"#document"}function Zi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Bo(t){var e;return(e=(VL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function VL(t){return wb()?t instanceof Node||t instanceof Zi(t).Node:!1}function to(t){return wb()?t instanceof Element||t instanceof Zi(t).Element:!1}function Ia(t){return wb()?t instanceof HTMLElement||t instanceof Zi(t).HTMLElement:!1}function CT(t){return!wb()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Zi(t).ShadowRoot}function op(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=no(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function IG(t){return/^(table|td|th)$/.test(Vd(t))}function Cb(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const OG=/transform|translate|scale|rotate|perspective|filter/,PG=/paint|layout|strict|content/,bc=t=>!!t&&t!=="none";let Iy;function eC(t){const e=to(t)?no(t):t;return bc(e.transform)||bc(e.translate)||bc(e.scale)||bc(e.rotate)||bc(e.perspective)||!tC()&&(bc(e.backdropFilter)||bc(e.filter))||OG.test(e.willChange||"")||PG.test(e.contain||"")}function jG(t){let e=Wl(t);for(;Ia(e)&&!Rd(e);){if(eC(e))return e;if(Cb(e))return null;e=Wl(e)}return null}function tC(){return Iy==null&&(Iy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Iy}function Rd(t){return/^(html|body|#document)$/.test(Vd(t))}function no(t){return Zi(t).getComputedStyle(t)}function Eb(t){return to(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Wl(t){if(Vd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||CT(t)&&t.host||Bo(t);return CT(e)?e.host:e}function GL(t){const e=Wl(t);return Rd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ia(e)&&op(e)?e:GL(e)}function Dh(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=GL(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=Zi(i);if(s){const l=Ax(o);return e.concat(o,o.visualViewport||[],op(i)?i:[],l&&n?Dh(l):[])}else return e.concat(i,Dh(i,[],n))}function Ax(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function WL(t){const e=no(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ia(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,l=gv(n)!==s||gv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function nC(t){return to(t)?t:t.contextElement}function pd(t){const e=nC(t);if(!Ia(e))return Oo(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=WL(e);let o=(s?gv(n.width):n.width)/r,l=(s?gv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const zG=Oo(0);function qL(t){const e=Zi(t);return!tC()||!e.visualViewport?zG:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function BG(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Zi(t)?!1:e}function $c(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=nC(t);let o=Oo(1);e&&(r?to(r)&&(o=pd(r)):o=pd(t));const l=BG(s,n,r)?qL(s):Oo(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const m=Zi(s),v=r&&to(r)?Zi(r):r;let _=m,y=Ax(_);for(;y&&r&&v!==_;){const S=pd(y),C=y.getBoundingClientRect(),R=no(y),k=C.left+(y.clientLeft+parseFloat(R.paddingLeft))*S.x,T=C.top+(y.clientTop+parseFloat(R.paddingTop))*S.y;c*=S.x,d*=S.y,f*=S.x,h*=S.y,c+=k,d+=T,_=Zi(y),y=Ax(_)}}return bv({width:f,height:h,x:c,y:d})}function kb(t,e){const n=Eb(t).scrollLeft;return e?e.left+n:$c(Bo(t)).left+n}function KL(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kb(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function $G(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Bo(r),l=e?Cb(e.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=Oo(1);const f=Oo(0),h=Ia(r);if((h||!h&&!s)&&((Vd(r)!=="body"||op(o))&&(c=Eb(r)),h)){const v=$c(r);d=pd(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const m=o&&!h&&!s?KL(o,c):Oo(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function FG(t){return Array.from(t.getClientRects())}function HG(t){const e=Bo(t),n=Eb(t),r=t.ownerDocument.body,i=Yi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Yi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+kb(t);const l=-n.scrollTop;return no(r).direction==="rtl"&&(o+=Yi(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const ET=25;function UG(t,e){const n=Zi(t),r=Bo(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const f=tC();(!f||f&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=kb(r);if(d<=0){const f=r.ownerDocument,h=f.body,m=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,_=Math.abs(r.clientWidth-h.clientWidth-v);_<=ET&&(s-=_)}else d<=ET&&(s+=d);return{width:s,height:o,x:l,y:c}}function VG(t,e){const n=$c(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Ia(t)?pd(t):Oo(1),o=t.clientWidth*s.x,l=t.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function kT(t,e,n){let r;if(e==="viewport")r=UG(t,n);else if(e==="document")r=HG(Bo(t));else if(to(e))r=VG(e,n);else{const i=qL(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return bv(r)}function YL(t,e){const n=Wl(t);return n===e||!to(n)||Rd(n)?!1:no(n).position==="fixed"||YL(n,e)}function GG(t,e){const n=e.get(t);if(n)return n;let r=Dh(t,[],!1).filter(l=>to(l)&&Vd(l)!=="body"),i=null;const s=no(t).position==="fixed";let o=s?Wl(t):t;for(;to(o)&&!Rd(o);){const l=no(o),c=eC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||op(o)&&!c&&YL(t,o))?r=r.filter(f=>f!==o):i=l,o=Wl(o)}return e.set(t,r),r}function WG(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Cb(e)?[]:GG(e,this._c):[].concat(n),r],l=kT(e,o[0],i);let c=l.top,d=l.right,f=l.bottom,h=l.left;for(let m=1;m<o.length;m++){const v=kT(e,o[m],i);c=Yi(v.top,c),d=Gl(v.right,d),f=Gl(v.bottom,f),h=Yi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function qG(t){const{width:e,height:n}=WL(t);return{width:e,height:n}}function KG(t,e,n){const r=Ia(e),i=Bo(e),s=n==="fixed",o=$c(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const c=Oo(0);function d(){c.x=kb(i)}if(r||!r&&!s)if((Vd(e)!=="body"||op(i))&&(l=Eb(e)),r){const v=$c(e,!0,s,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?KL(i,l):Oo(0),h=o.left+l.scrollLeft-c.x-f.x,m=o.top+l.scrollTop-c.y-f.y;return{x:h,y:m,width:o.width,height:o.height}}function Oy(t){return no(t).position==="static"}function RT(t,e){if(!Ia(t)||no(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Bo(t)===n&&(n=n.ownerDocument.body),n}function XL(t,e){const n=Zi(t);if(Cb(t))return n;if(!Ia(t)){let i=Wl(t);for(;i&&!Rd(i);){if(to(i)&&!Oy(i))return i;i=Wl(i)}return n}let r=RT(t,e);for(;r&&IG(r)&&Oy(r);)r=RT(r,e);return r&&Rd(r)&&Oy(r)&&!eC(r)?n:r||jG(t)||n}const YG=async function(t){const e=this.getOffsetParent||XL,n=this.getDimensions,r=await n(t.floating);return{reference:KG(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function XG(t){return no(t).direction==="rtl"}const QG={convertOffsetParentRelativeRectToViewportRelativeRect:$G,getDocumentElement:Bo,getClippingRect:WG,getOffsetParent:XL,getElementRects:YG,getClientRects:FG,getDimensions:qG,getScale:pd,isElement:to,isRTL:XG};function QL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ZG(t,e){let n=null,r;const i=Bo(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=t.getBoundingClientRect(),{left:f,top:h,width:m,height:v}=d;if(l||e(),!m||!v)return;const _=Gm(h),y=Gm(i.clientWidth-(f+m)),S=Gm(i.clientHeight-(h+v)),C=Gm(f),k={rootMargin:-_+"px "+-y+"px "+-S+"px "+-C+"px",threshold:Yi(0,Gl(1,c))||1};let T=!0;function M(A){const D=A[0].intersectionRatio;if(D!==c){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!QL(d,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(M,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(M,k)}n.observe(t)}return o(!0),s}function JG(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=nC(t),f=i||s?[...d?Dh(d):[],...e?Dh(e):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?ZG(d,n):null;let m=-1,v=null;o&&(v=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&v&&e&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=v)==null||k.observe(e)})),n()}),d&&!c&&v.observe(d),e&&v.observe(e));let _,y=c?$c(t):null;c&&S();function S(){const C=$c(t);y&&!QL(y,C)&&n(),y=C,_=requestAnimationFrame(S)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(_)}}const eW=MG,tW=NG,nW=RG,rW=DG,iW=TG,TT=kG,sW=LG,oW=(t,e,n)=>{const r=new Map,i={platform:QG,...n},s={...i.platform,_c:r};return EG(t,e,{...i,platform:s})};var aW=typeof document<"u",lW=function(){},$g=aW?x.useLayoutEffect:lW;function _v(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!_v(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!_v(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function ZL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function AT(t,e){const n=ZL(t);return Math.round(e*n)/n}function Py(t){const e=x.useRef(t);return $g(()=>{e.current=t}),e}function cW(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=t,[f,h]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,v]=x.useState(r);_v(m,r)||v(r);const[_,y]=x.useState(null),[S,C]=x.useState(null),R=x.useCallback(q=>{q!==A.current&&(A.current=q,y(q))},[]),k=x.useCallback(q=>{q!==D.current&&(D.current=q,C(q))},[]),T=s||_,M=o||S,A=x.useRef(null),D=x.useRef(null),z=x.useRef(f),G=c!=null,$=Py(c),H=Py(i),F=Py(d),B=x.useCallback(()=>{if(!A.current||!D.current)return;const q={placement:e,strategy:n,middleware:m};H.current&&(q.platform=H.current),oW(A.current,D.current,q).then(Y=>{const N={...Y,isPositioned:F.current!==!1};j.current&&!_v(z.current,N)&&(z.current=N,ks.flushSync(()=>{h(N)}))})},[m,e,n,H,F]);$g(()=>{d===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,h(q=>({...q,isPositioned:!1})))},[d]);const j=x.useRef(!1);$g(()=>(j.current=!0,()=>{j.current=!1}),[]),$g(()=>{if(T&&(A.current=T),M&&(D.current=M),T&&M){if($.current)return $.current(T,M,B);B()}},[T,M,B,$,G]);const U=x.useMemo(()=>({reference:A,floating:D,setReference:R,setFloating:k}),[R,k]),P=x.useMemo(()=>({reference:T,floating:M}),[T,M]),W=x.useMemo(()=>{const q={position:n,left:0,top:0};if(!P.floating)return q;const Y=AT(P.floating,f.x),N=AT(P.floating,f.y);return l?{...q,transform:"translate("+Y+"px, "+N+"px)",...ZL(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:N}},[n,l,P.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:B,refs:U,elements:P,floatingStyles:W}),[f,B,U,P,W])}const uW=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TT({element:r.current,padding:i}).fn(n):{}:r?TT({element:r,padding:i}).fn(n):{}}}},dW=(t,e)=>{const n=eW(t);return{name:n.name,fn:n.fn,options:[t,e]}},fW=(t,e)=>{const n=tW(t);return{name:n.name,fn:n.fn,options:[t,e]}},hW=(t,e)=>({fn:sW(t).fn,options:[t,e]}),pW=(t,e)=>{const n=nW(t);return{name:n.name,fn:n.fn,options:[t,e]}},mW=(t,e)=>{const n=rW(t);return{name:n.name,fn:n.fn,options:[t,e]}},gW=(t,e)=>{const n=iW(t);return{name:n.name,fn:n.fn,options:[t,e]}},vW=(t,e)=>{const n=uW(t);return{name:n.name,fn:n.fn,options:[t,e]}};var bW="Arrow",JL=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return g.jsx(Kt.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});JL.displayName=bW;var _W=JL;function yW(t){const[e,n]=x.useState(void 0);return ti(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var rC="Popper",[eD,Kl]=Da(rC),[xW,tD]=eD(rC),nD=t=>{const{__scopePopper:e,children:n}=t,[r,i]=x.useState(null);return g.jsx(xW,{scope:e,anchor:r,onAnchorChange:i,children:n})};nD.displayName=rC;var rD="PopperAnchor",iD=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=tD(rD,n),o=x.useRef(null),l=on(e,o),c=x.useRef(null);return x.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:g.jsx(Kt.div,{...i,ref:l})});iD.displayName=rD;var iC="PopperContent",[SW,wW]=eD(iC),sD=x.forwardRef((t,e)=>{var oe,ie,ue,fe,de,Z;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:v="optimized",onPlaced:_,...y}=t,S=tD(iC,n),[C,R]=x.useState(null),k=on(e,ne=>R(ne)),[T,M]=x.useState(null),A=yW(T),D=(A==null?void 0:A.width)??0,z=(A==null?void 0:A.height)??0,G=r+(s!=="center"?"-"+s:""),$=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},H=Array.isArray(d)?d:[d],F=H.length>0,B={padding:$,boundary:H.filter(EW),altBoundary:F},{refs:j,floatingStyles:U,placement:P,isPositioned:W,middlewareData:q}=cW({strategy:"fixed",placement:G,whileElementsMounted:(...ne)=>JG(...ne,{animationFrame:v==="always"}),elements:{reference:S.anchor},middleware:[dW({mainAxis:i+z,alignmentAxis:o}),c&&fW({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?hW():void 0,...B}),c&&pW({...B}),mW({...B,apply:({elements:ne,rects:ae,availableWidth:Q,availableHeight:xe})=>{const{width:le,height:Te}=ae.reference,Le=ne.floating.style;Le.setProperty("--radix-popper-available-width",`${Q}px`),Le.setProperty("--radix-popper-available-height",`${xe}px`),Le.setProperty("--radix-popper-anchor-width",`${le}px`),Le.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),T&&vW({element:T,padding:l}),kW({arrowWidth:D,arrowHeight:z}),m&&gW({strategy:"referenceHidden",...B})]}),[Y,N]=lD(P),I=eo(_);ti(()=>{W&&(I==null||I())},[W,I]);const V=(oe=q.arrow)==null?void 0:oe.x,L=(ie=q.arrow)==null?void 0:ie.y,J=((ue=q.arrow)==null?void 0:ue.centerOffset)!==0,[te,ee]=x.useState();return ti(()=>{C&&ee(window.getComputedStyle(C).zIndex)},[C]),g.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:W?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(fe=q.transformOrigin)==null?void 0:fe.x,(de=q.transformOrigin)==null?void 0:de.y].join(" "),...((Z=q.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(SW,{scope:n,placedSide:Y,onArrowChange:M,arrowX:V,arrowY:L,shouldHideArrow:J,children:g.jsx(Kt.div,{"data-side":Y,"data-align":N,...y,ref:k,style:{...y.style,animation:W?void 0:"none"}})})})});sD.displayName=iC;var oD="PopperArrow",CW={top:"bottom",right:"left",bottom:"top",left:"right"},aD=x.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=wW(oD,r),o=CW[s.placedSide];return g.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g.jsx(_W,{...i,ref:n,style:{...i.style,display:"block"}})})});aD.displayName=oD;function EW(t){return t!==null}var kW=t=>({name:"transformOrigin",options:t,fn(e){var S,C,R;const{placement:n,rects:r,middlewareData:i}=e,o=((S=i.arrow)==null?void 0:S.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[d,f]=lD(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((R=i.arrow)==null?void 0:R.y)??0)+c/2;let _="",y="";return d==="bottom"?(_=o?h:`${m}px`,y=`${-c}px`):d==="top"?(_=o?h:`${m}px`,y=`${r.floating.height+c}px`):d==="right"?(_=`${-c}px`,y=o?h:`${v}px`):d==="left"&&(_=`${r.floating.width+c}px`,y=o?h:`${v}px`),{data:{x:_,y}}}});function lD(t){const[e,n="center"]=t.split("-");return[e,n]}var Rb=nD,ap=iD,Tb=sD,Ab=aD,cD=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),RW="VisuallyHidden",uD=x.forwardRef((t,e)=>g.jsx(Kt.span,{...t,ref:e,style:{...cD,...t.style}}));uD.displayName=RW;var TW=uD,[Mb,Wye]=Da("Tooltip",[Kl]),Nb=Kl(),dD="TooltipProvider",AW=700,Mx="tooltip.open",[MW,sC]=Mb(dD),fD=t=>{const{__scopeTooltip:e,delayDuration:n=AW,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=x.useRef(!0),l=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),g.jsx(MW,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};fD.displayName=dD;var Ih="Tooltip",[NW,lp]=Mb(Ih),hD=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=t,c=sC(Ih,t.__scopeTooltip),d=Nb(e),[f,h]=x.useState(null),m=ka(),v=x.useRef(0),_=o??c.disableHoverableContent,y=l??c.delayDuration,S=x.useRef(!1),[C,R]=kd({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(Mx))):c.onClose(),s==null||s(D)},caller:Ih}),k=x.useMemo(()=>C?S.current?"delayed-open":"instant-open":"closed",[C]),T=x.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S.current=!1,R(!0)},[R]),M=x.useCallback(()=>{window.clearTimeout(v.current),v.current=0,R(!1)},[R]),A=x.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{S.current=!0,R(!0),v.current=0},y)},[y,R]);return x.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),g.jsx(Rb,{...d,children:g.jsx(NW,{scope:e,contentId:m,open:C,stateAttribute:k,trigger:f,onTriggerChange:h,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?A():T()},[c.isOpenDelayedRef,A,T]),onTriggerLeave:x.useCallback(()=>{_?M():(window.clearTimeout(v.current),v.current=0)},[M,_]),onOpen:T,onClose:M,disableHoverableContent:_,children:n})})};hD.displayName=Ih;var Nx="TooltipTrigger",pD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=lp(Nx,n),s=sC(Nx,n),o=Nb(n),l=x.useRef(null),c=on(e,l,i.onTriggerChange),d=x.useRef(!1),f=x.useRef(!1),h=x.useCallback(()=>d.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),g.jsx(ap,{asChild:!0,...o,children:g.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:lt(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:lt(t.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:lt(t.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:lt(t.onFocus,()=>{d.current||i.onOpen()}),onBlur:lt(t.onBlur,i.onClose),onClick:lt(t.onClick,i.onClose)})})});pD.displayName=Nx;var oC="TooltipPortal",[LW,DW]=Mb(oC,{forceMount:void 0}),mD=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=lp(oC,e);return g.jsx(LW,{scope:e,forceMount:n,children:g.jsx(Ls,{present:n||s.open,children:g.jsx(Hd,{asChild:!0,container:i,children:r})})})};mD.displayName=oC;var Td="TooltipContent",gD=x.forwardRef((t,e)=>{const n=DW(Td,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=lp(Td,t.__scopeTooltip);return g.jsx(Ls,{present:r||o.open,children:o.disableHoverableContent?g.jsx(vD,{side:i,...s,ref:e}):g.jsx(IW,{side:i,...s,ref:e})})}),IW=x.forwardRef((t,e)=>{const n=lp(Td,t.__scopeTooltip),r=sC(Td,t.__scopeTooltip),i=x.useRef(null),s=on(e,i),[o,l]=x.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,m=x.useCallback(()=>{l(null),h(!1)},[h]),v=x.useCallback((_,y)=>{const S=_.currentTarget,C={x:_.clientX,y:_.clientY},R=BW(C,S.getBoundingClientRect()),k=$W(C,R),T=FW(y.getBoundingClientRect()),M=UW([...k,...T]);l(M),h(!0)},[h]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&f){const _=S=>v(S,f),y=S=>v(S,c);return c.addEventListener("pointerleave",_),f.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",_),f.removeEventListener("pointerleave",y)}}},[c,f,v,m]),x.useEffect(()=>{if(o){const _=y=>{const S=y.target,C={x:y.clientX,y:y.clientY},R=(c==null?void 0:c.contains(S))||(f==null?void 0:f.contains(S)),k=!HW(C,o);R?m():k&&(m(),d())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[c,f,o,d,m]),g.jsx(vD,{...t,ref:s})}),[OW,PW]=Mb(Ih,{isInside:!1}),jW=IU("TooltipContent"),vD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=t,c=lp(Td,n),d=Nb(n),{onClose:f}=c;return x.useEffect(()=>(document.addEventListener(Mx,f),()=>document.removeEventListener(Mx,f)),[f]),x.useEffect(()=>{if(c.trigger){const h=m=>{const v=m.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),g.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:g.jsxs(Tb,{"data-state":c.stateAttribute,...d,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(jW,{children:r}),g.jsx(OW,{scope:n,isInside:!0,children:g.jsx(TW,{id:c.contentId,role:"tooltip",children:i||r})})]})})});gD.displayName=Td;var bD="TooltipArrow",zW=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=Nb(n);return PW(bD,n).isInside?null:g.jsx(Ab,{...i,...r,ref:e})});zW.displayName=bD;function BW(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function $W(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function FW(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function HW(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const l=e[s],c=e[o],d=l.x,f=l.y,h=c.x,m=c.y;f>r!=m>r&&n<(h-d)*(r-f)/(m-f)+d&&(i=!i)}return i}function UW(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),VW(e)}function VW(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var GW=fD,_D=hD,yD=pD,xD=mD,aC=gD;function WW(t){const e=ke.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=g.jsx("kbd",{className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function qW(t){const e=ke.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("inline-flex items-center gap-0.5",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=g.jsx("span",{className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}const KW="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",YW=GW,Ks=_D,Ys=yD,Xs=x.forwardRef((t,e)=>{const n=ke.c(11);let r,i,s;n[0]!==t?({className:r,sideOffset:s,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=s):(r=n[1],i=n[2],s=n[3]);const o=s===void 0?4:s;let l;n[4]!==r?(l=we("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",r),n[4]=r,n[5]=l):l=n[5];let c;return n[6]!==i||n[7]!==e||n[8]!==o||n[9]!==l?(c=g.jsx(xD,{children:g.jsx(aC,{ref:e,sideOffset:o,className:l,...i})}),n[6]=i,n[7]=e,n[8]=o,n[9]=l,n[10]=c):c=n[10],c});Xs.displayName=aC.displayName;const lh=_D,ch=yD;function SD(t){return t.toUpperCase()}function XW(t){const e=t.split("+");return g.jsx(qW,{children:e.map((n,r)=>g.jsx(WW,{children:SD(n)},`${n}-${r}`))})}const Mc=x.forwardRef((t,e)=>{const n=ke.c(17);let r,i,s,o,l;n[0]!==t?({className:i,sideOffset:l,children:r,shortcut:o,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=s,n[4]=o,n[5]=l):(r=n[1],i=n[2],s=n[3],o=n[4],l=n[5]);const c=l===void 0?4:l,d=o===void 0?null:Array.isArray(o)?o[0]??null:o;let f;n[6]!==i?(f=we(KW,i),n[6]=i,n[7]=f):f=n[7];let h;n[8]!==r||n[9]!==d?(h=d?XW(d):g.jsx("span",{children:typeof r=="string"?SD(r):r}),n[8]=r,n[9]=d,n[10]=h):h=n[10];let m;return n[11]!==s||n[12]!==e||n[13]!==c||n[14]!==f||n[15]!==h?(m=g.jsx(xD,{children:g.jsx(aC,{ref:e,sideOffset:c,className:f,...s,children:h})}),n[11]=s,n[12]=e,n[13]=c,n[14]=f,n[15]=h,n[16]=m):m=n[16],m});Mc.displayName="HotkeyTooltipContent";const QW="0.8.0",ZW={version:QW},Qs="Kaizen",MT="kaizen",JW=".kaizen",eq=".kaizen-dev",qye=".kaizen",tq="KAIZEN_RUNTIME_PROFILE",nq=`kaizen/${ZW.version}`,rq="[kaizen]",Kye=`~/${Qs}`,lC="kaizen:";function Zc(){var e;return(e=globalThis.process)==null?void 0:e.env}function iq(t=Zc()){const e=t==null?void 0:t[tq];return(e==null?void 0:e.trim().toLowerCase())==="dev"?"dev":"prod"}function sq(t=Zc()){return iq(t)==="dev"?eq:JW}function cC(t=Zc()){return`~/${sq(t)}`}function Yye(t=Zc()){return`${cC(t)}/keybindings.json`}function oq(t=Zc()){return`${cC(t)}/themes`}function aq(t=Zc()){return`${oq(t)}/THEME_README.md`}function Xye(t=Zc()){return`${cC(t)}/general.json`}function Qye(t){return t?`${MT} ${t}`:MT}function lq(t){return t==="claude"||t==="codex"||t==="gemini"||t==="cursor"||t==="openrouter"}function cq(t){return lq(t)?t:null}const yv=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Lx=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Dx=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],Ix="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",wD=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],uq={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function dq(t){return t?wD.some(e=>e.id===t)?t:uq[t]??Ix:Ix}function NT(t){const e=t.indexOf("[");return e>=0?t.slice(0,e):t}function Gd(t){const e=t.match(/\bfast=(true|false)\b/);return e?e[1]==="true"?"fast":"standard":null}function LT(t){return yv.some(e=>e.id===t)}function DT(t){return Lx.some(e=>e.id===t)}const Ox=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function fq(t){return Dx.some(e=>e.id===t)}const hq={image:!0,markdown:!0,document:!0},pq={image:!0,markdown:!0,document:!1},mq={image:!0,markdown:!0,document:!0},gq={image:!0,markdown:!0,document:!0},vq={image:!0,markdown:!0,document:!0},Zye=16*1024,Jye=1024*1024,bq=200*1024,e1e={sendChunkSizeBytes:bq},_q={openrouter:"account",providerUsage:"account",handoff:"account",remoteRelay:"paid",browserNotifications:"paid",installMobilePush:"paid",syncedSettings:"paid",syncedKeybindings:"paid",syncedHandoffs:"paid",crossDeviceStorage:"paid"},Jc=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,attachmentCapabilities:hq,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...Ox]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Ox]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...yv]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,attachmentCapabilities:pq,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,attachmentCapabilities:mq,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:Ix,defaultModelOptions:{},supportsPlanMode:!0,attachmentCapabilities:gq,models:[...wD],efforts:[]},{id:"openrouter",label:"OpenRouter",systemActive:!0,defaultModel:"opencode/big-pickle",defaultModelOptions:{},supportsPlanMode:!0,attachmentCapabilities:vq,models:[{id:"opencode/big-pickle",label:"Big Pickle",supportsEffort:!1},{id:"opencode/gpt-5-nano",label:"GPT-5 Nano",supportsEffort:!1},{id:"opencode/mimo-v2-omni-free",label:"MiMo V2 Omni Free",supportsEffort:!1},{id:"opencode/mimo-v2-pro-free",label:"MiMo V2 Pro Free",supportsEffort:!1},{id:"opencode/minimax-m2.5-free",label:"MiniMax M2.5 Free",supportsEffort:!1},{id:"opencode/nemotron-3-super-free",label:"Nemotron 3 Super Free",supportsEffort:!1},{id:"opencode/qwen3.6-plus-free",label:"Qwen3.6 Plus Free",supportsEffort:!1},{id:"openrouter/anthropic/claude-sonnet-4",label:"Claude Sonnet 4",supportsEffort:!1},{id:"openrouter/anthropic/claude-opus-4",label:"Claude Opus 4",supportsEffort:!1},{id:"openrouter/openai/gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"openrouter/google/gemini-2.5-pro",label:"Gemini 2.5 Pro",supportsEffort:!1},{id:"openrouter/deepseek/deepseek-r1",label:"DeepSeek R1",supportsEffort:!1},{id:"openrouter/meta-llama/llama-4-maverick",label:"Llama 4 Maverick",supportsEffort:!1}],efforts:[]}],xv={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0},openrouter:{active:!1}};function cr(t,e=Jc){const n=e.find(r=>r.id===t);if(!n)throw new Error(`Unknown provider: ${t}`);return n}function Lb(t,e){const n=e?t.models.find(r=>r.id===e):void 0;return(n==null?void 0:n.attachmentCapabilities)??t.attachmentCapabilities}function uC(t,e){const n=xv[e],r=t==null?void 0:t[e];return{active:(r==null?void 0:r.active)??n.active}}function yq(t,e,n=Jc){var s;const r=cr(t,n),i=uC(e,t);return r.systemActive&&i.active?null:!r.systemActive&&((s=r.availabilityMessage)!=null&&s.trim())?r.availabilityMessage:`Provider ${r.label} is currently not active.`}function xq(t,e,n=Jc){const r=cr(t,n),i=uC(e,t);return r.systemActive&&i.active}function Sq(t,e){return t.map(n=>{const r=uC(e,n.id),i=n.systemActive&&r.active;return{...n,active:r.active,isSelectable:i,isUsageEnabled:i,isInactive:!i,inactiveMessage:yq(n.id,e,t)}})}function wq(t,e){return Sq(t,e).filter(n=>n.isSelectable).map(({active:n,isSelectable:r,isUsageEnabled:i,isInactive:s,inactiveMessage:o,...l})=>l)}function CD(t){return wq(Jc,t)}function di(t){return cr(t).defaultModelOptions}const ED=di("claude");di("codex");di("gemini");di("cursor");di("openrouter");function Cq(t){return cr("claude").models.find(e=>e.id===t)}function Eq(t){var e;return((e=Cq(t))==null?void 0:e.contextWindowOptions)??[]}function kq(t,e){const n=Eq(t);if(n.length!==0)return n.some(r=>r.id===e)?e:ED.contextWindow}const Rq=["idea","todo","progress","testing","done"],IT={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},va={submitChatMessage:["enter"],toggleQuickPrompts:["cmd+e","ctrl+e"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},Sv=8,kD=10*1024*1024,Tq=20*1024*1024,Aq=1*1024*1024,wv=["image/png","image/jpeg","image/webp","image/gif"],RD=["application/pdf"],TD=["text/markdown","text/x-markdown"],Mq="/assets/icon-4rSnra9R.svg";function md(t){const e=ke.c(10);let n,r,i;e[0]!==t?({alt:i,className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);const s=i===void 0?"":i;let o;e[4]!==n?(o=we("shrink-0 object-contain",n),e[4]=n,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==r||e[8]!==o?(l=g.jsx("img",{alt:s,src:Mq,className:o,...r}),e[6]=s,e[7]=r,e[8]=o,e[9]=l):l=e[9],l}var Db="Popover",[AD,t1e]=Da(Db,[Kl]),cp=Kl(),[Nq,Yl]=AD(Db),MD=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,l=cp(e),c=x.useRef(null),[d,f]=x.useState(!1),[h,m]=kd({prop:r,defaultProp:i??!1,onChange:s,caller:Db});return g.jsx(Rb,{...l,children:g.jsx(Nq,{scope:e,contentId:ka(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(v=>!v),[m]),hasCustomAnchor:d,onCustomAnchorAdd:x.useCallback(()=>f(!0),[]),onCustomAnchorRemove:x.useCallback(()=>f(!1),[]),modal:o,children:n})})};MD.displayName=Db;var ND="PopoverAnchor",LD=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Yl(ND,n),s=cp(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=i;return x.useEffect(()=>(o(),()=>l()),[o,l]),g.jsx(ap,{...s,...r,ref:e})});LD.displayName=ND;var DD="PopoverTrigger",ID=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Yl(DD,n),s=cp(n),o=on(e,i.triggerRef),l=g.jsx(Kt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":BD(i.open),...r,ref:o,onClick:lt(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:g.jsx(ap,{asChild:!0,...s,children:l})});ID.displayName=DD;var dC="PopoverPortal",[Lq,Dq]=AD(dC,{forceMount:void 0}),OD=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=Yl(dC,e);return g.jsx(Lq,{scope:e,forceMount:n,children:g.jsx(Ls,{present:n||s.open,children:g.jsx(Hd,{asChild:!0,container:i,children:r})})})};OD.displayName=dC;var Ad="PopoverContent",PD=x.forwardRef((t,e)=>{const n=Dq(Ad,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=Yl(Ad,t.__scopePopover);return g.jsx(Ls,{present:r||s.open,children:s.modal?g.jsx(Oq,{...i,ref:e}):g.jsx(Pq,{...i,ref:e})})});PD.displayName=Ad;var Iq=zc("PopoverContent.RemoveScroll"),Oq=x.forwardRef((t,e)=>{const n=Yl(Ad,t.__scopePopover),r=x.useRef(null),i=on(e,r),s=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return bb(o)},[]),g.jsx(ip,{as:Iq,allowPinchZoom:!0,children:g.jsx(jD,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:lt(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:lt(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:lt(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pq=x.forwardRef((t,e)=>{const n=Yl(Ad,t.__scopePopover),r=x.useRef(!1),i=x.useRef(!1);return g.jsx(jD,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,d;(c=t.onInteractOutside)==null||c.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),jD=x.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Yl(Ad,n),v=cp(n);return gb(),g.jsx(rp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:g.jsx(Tb,{"data-state":BD(m.open),role:"dialog",id:m.contentId,...v,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),zD="PopoverClose",jq=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Yl(zD,n);return g.jsx(Kt.button,{type:"button",...r,ref:e,onClick:lt(t.onClick,()=>i.onOpenChange(!1))})});jq.displayName=zD;var zq="PopoverArrow",Bq=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=cp(n);return g.jsx(Ab,{...i,...r,ref:e})});Bq.displayName=zq;function BD(t){return t?"open":"closed"}var $D=MD,$q=LD,Fq=ID,FD=OD,fC=PD;const hC=$D,pC=Fq,Ib=x.forwardRef((t,e)=>{const n=ke.c(17);let r,i,s,o;n[0]!==t?({className:r,align:s,sideOffset:o,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=s,n[4]=o):(r=n[1],i=n[2],s=n[3],o=n[4]);const l=s===void 0?"center":s,c=o===void 0?4:o;let d;n[5]===Symbol.for("react.memo_cache_sentinel")?(d={[Lh]:""},n[5]=d):d=n[5];let f;n[6]!==i?(f=v=>{var _;v.preventDefault(),window.dispatchEvent(new Event(pv)),(_=i.onCloseAutoFocus)==null||_.call(i,v)},n[6]=i,n[7]=f):f=n[7];let h;n[8]!==r?(h=we("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",r),n[8]=r,n[9]=h):h=n[9];let m;return n[10]!==l||n[11]!==i||n[12]!==e||n[13]!==c||n[14]!==f||n[15]!==h?(m=g.jsx(FD,{children:g.jsx(fC,{ref:e,align:l,sideOffset:c,...d,onCloseAutoFocus:f,className:h,...i})}),n[10]=l,n[11]=i,n[12]=e,n[13]=c,n[14]=f,n[15]=h,n[16]=m):m=n[16],m});Ib.displayName=fC.displayName;function Hq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Uq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Vq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Gq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Wq(t){const e=ke.c(11);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s,o,l;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M12 2.75c2.83 0 5.14 2.28 5.19 5.1l1.72.99A7.25 7.25 0 0 0 5.4 13.45l-1.7.98A9.25 9.25 0 0 1 12 2.75Z",fill:"currentColor"}),o=g.jsx("path",{d:"M19.34 8.2a9.25 9.25 0 0 1-3.4 12.65 9.2 9.2 0 0 1-5.22 1.25v-1.98a7.24 7.24 0 0 0 7.25-12.56l1.37.64Z",fill:"currentColor",opacity:".8"}),l=g.jsx("path",{d:"M8.4 21.02A9.26 9.26 0 0 1 3.3 9.58l1.72.99A7.24 7.24 0 0 0 15.9 18.8l-.02 1.58a9.2 9.2 0 0 1-7.48.64Z",fill:"currentColor",opacity:".6"}),e[5]=s,e[6]=o,e[7]=l):(s=e[5],o=e[6],l=e[7]);let c;return e[8]!==r||e[9]!==i?(c=g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:i,...r,children:[s,o,l]}),e[8]=r,e[9]=i,e[10]=c):c=e[10],c}function qq(t){return!(t.startsWith("gemini-3")||t==="auto-gemini-3")}const Kq=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function Yq(t){return t.startsWith("composer-")?"Composer":t.startsWith("gpt-")?"GPT":t.startsWith("claude-")?"Claude":t.startsWith("gemini-")?"Gemini":t.startsWith("grok-")?"Grok":"Kimi"}function OT(t){return{Standard:"Std","Fast Mode":"Fast",Medium:"Med",Minimal:"Min",XHigh:"XHi"}[t]??t}function jy(t,e){const n=Gd(e);return!n||n==="standard"?t:`${t} (${n==="fast"?"Fast":"Standard"})`}const Cv={claude:Hq,codex:Uq,gemini:Vq,cursor:Gq,openrouter:Wq},Wm={auto:Sn,opus:ir,sonnet:Sn,haiku:ui,"gpt-5.4":ir,"gpt-5.4[reasoning=medium,context=272k,fast=false]":ir,"gpt-5.4-mini[reasoning=medium]":Sn,"gpt-5.4-nano[reasoning=medium]":ui,"gpt-5.3-codex":Sn,"gpt-5.3-codex[reasoning=medium,fast=false]":Sn,"gpt-5.3-codex-spark[reasoning=medium]":ui,"gpt-5.2[reasoning=medium,fast=false]":Sn,"gpt-5.2-codex[reasoning=medium,fast=false]":Sn,"gpt-5.3-codex-spark":ui,"gemini-2.5-pro":ir,"gemini-2.5-flash":Sn,"gemini-2.5-flash-lite":ui,"auto-gemini-3":ir,"auto-gemini-2.5":Sn,"gemini-3.1-pro-preview":ir,"gemini-3.1-pro[]":ir,"gemini-3-flash[]":Sn,"gemini-3-pro-preview":ir,"gemini-3-flash-preview":Sn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":ir,"claude-opus-4-5[thinking=true]":ir,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Sn,"claude-sonnet-4-5[thinking=true,context=200k]":Sn,"claude-sonnet-4[thinking=false,context=200k]":Sn,"claude-haiku-4-5[thinking=true]":ui,"opencode/big-pickle":ir,"opencode/gpt-5-nano":ui,"opencode/mimo-v2-omni-free":Sn,"opencode/mimo-v2-pro-free":Sn,"opencode/minimax-m2.5-free":Sn,"opencode/nemotron-3-super-free":ir,"opencode/qwen3.6-plus-free":ir,"openrouter/anthropic/claude-sonnet-4":Sn,"openrouter/anthropic/claude-opus-4":ir,"openrouter/openai/gpt-5.4":ir,"openrouter/google/gemini-2.5-pro":ir,"openrouter/deepseek/deepseek-r1":ir,"openrouter/meta-llama/llama-4-maverick":Sn,"grok-4-20[thinking=true]":ir,"kimi-k2.5[]":Sn,"composer-2[fast=true]":ir,"composer-1.5[]":Sn};function ki(t){const e=ke.c(16),{onClick:n,selected:r,icon:i,label:s,description:o,disabled:l}=t,c=r?"bg-muted border-border":"hover:opacity-60",d=l&&"opacity-40 cursor-not-allowed";let f;e[0]!==c||e[1]!==d?(f=we("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",c,d),e[0]=c,e[1]=d,e[2]=f):f=e[2];let h;e[3]!==s?(h=g.jsx("div",{className:"text-sm font-medium",children:s}),e[3]=s,e[4]=h):h=e[4];let m;e[5]!==o?(m=o?g.jsx("div",{className:"text-xs text-muted-foreground",children:o}):null,e[5]=o,e[6]=m):m=e[6];let v;e[7]!==h||e[8]!==m?(v=g.jsxs("div",{children:[h,m]}),e[7]=h,e[8]=m,e[9]=v):v=e[9];let _;return e[10]!==l||e[11]!==i||e[12]!==n||e[13]!==f||e[14]!==v?(_=g.jsxs("button",{onClick:n,disabled:l,className:f,children:[i,v]}),e[10]=l,e[11]=i,e[12]=n,e[13]=f,e[14]=v,e[15]=_):_=e[15],_}function bl(t){const e=ke.c(18),{trigger:n,triggerClassName:r,disabled:i,children:s}=t,o=i===void 0?!1:i,[l,c]=x.useState(!1);if(o){let _;e[0]!==r?(_=we("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",r),e[0]=r,e[1]=_):_=e[1];let y;return e[2]!==_||e[3]!==n?(y=g.jsx("button",{disabled:!0,className:_,children:n}),e[2]=_,e[3]=n,e[4]=y):y=e[4],y}let d;e[5]!==r?(d=we("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",r),e[5]=r,e[6]=d):d=e[6];let f;e[7]!==d||e[8]!==n?(f=g.jsx(pC,{asChild:!0,children:g.jsx("button",{className:d,children:n})}),e[7]=d,e[8]=n,e[9]=f):f=e[9];let h;e[10]!==s?(h=typeof s=="function"?s(()=>c(!1)):s,e[10]=s,e[11]=h):h=e[11];let m;e[12]!==h?(m=g.jsx(Ib,{align:"center",className:"w-64 p-1",children:g.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:h})}),e[12]=h,e[13]=m):m=e[13];let v;return e[14]!==l||e[15]!==f||e[16]!==m?(v=g.jsxs(hC,{open:l,onOpenChange:c,children:[f,m]}),e[14]=l,e[15]=f,e[16]=m,e[17]=v):v=e[17],v}function Xq(t){var dt,vt,he,Re,Oe,Ve,Fe;const e=ke.c(38),{availableProviders:n,selectedProvider:r,lockedProviders:i,disabled:s,showProviderPicker:o,providerLocked:l,model:c,modelOptions:d,onProviderChange:f,onModelChange:h,onClaudeReasoningEffortChange:m,onClaudeContextWindowChange:v,onCodexReasoningEffortChange:_,onGeminiThinkingModeChange:y,onCodexFastModeChange:S,planMode:C,onPlanModeChange:R,pendingPlanMode:k,includePlanMode:T,className:M}=t,A=s===void 0?!1:s,D=o===void 0?!0:o,z=l===void 0?!1:l,G=C===void 0?!1:C,$=k===void 0?null:k,H=T===void 0?!0:T,[F,B]=x.useState(null),j=n.find(We=>We.id===r)??cr(r),U=Cv[r],P=Wm[c]??Sn,W=H&&(j==null?void 0:j.supportsPlanMode)&&R,q=$??G,Y=$!==null,N=r==="claude"?d:null,I=r==="codex"?d:null,V=r==="gemini"?d:null,L=((dt=j.models.find(We=>We.id===c))==null?void 0:dt.contextWindowOptions)??[],J=(N==null?void 0:N.contextWindow)??Ox[0].id,te=J==="1m"?Y5:X5,ee=r==="claude"||r==="codex",oe=r==="cursor"?Gd(c):null,ie=j.id==="cursor"?j.models.filter(We=>NT(We.id)===NT(c)):[],ue=r==="cursor"&&ie.some(tK)&&ie.some(eK),fe=j.id==="cursor"?Kq.map(We=>({family:We,models:j.models.filter(Ye=>Yq(Ye.id)===We)})).filter(Jq):[];let de;e[0]!==ee||e[1]!==d||e[2]!==r?(de=ee?r==="claude"?((vt=yv.find(We=>We.id===d.reasoningEffort))==null?void 0:vt.label)??String(d.reasoningEffort):((he=Lx.find(We=>We.id===d.reasoningEffort))==null?void 0:he.label)??String(d.reasoningEffort):null,e[0]=ee,e[1]=d,e[2]=r,e[3]=de):de=e[3];const Z=de;let ne;e[4]!==(V==null?void 0:V.thinkingMode)||e[5]!==r?(ne=r==="gemini"?((Re=Dx.find(We=>We.id===(V==null?void 0:V.thinkingMode)))==null?void 0:Re.label)??(V==null?void 0:V.thinkingMode)??"Standard":null,e[4]=V==null?void 0:V.thinkingMode,e[5]=r,e[6]=ne):ne=e[6];const ae=ne;let Q;e[7]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{B(null)},e[7]=Q):Q=e[7];let xe;e[8]!==r?(xe=[r],e[8]=r,e[9]=xe):xe=e[9],x.useEffect(Q,xe);const le=A&&"pointer-events-none opacity-60";let Te;e[10]!==M||e[11]!==le?(Te=we("max-w-full overflow-x-auto scrollbar-hide",le,M),e[10]=M,e[11]=le,e[12]=Te):Te=e[12];let Le;e[13]!==P?(Le=g.jsx(P,{className:"h-3.5 w-3.5"}),e[13]=P,e[14]=Le):Le=e[14];let Xe;e[15]!==Z||e[16]!==ee||e[17]!==c||e[18]!==d||e[19]!==m||e[20]!==_||e[21]!==r?(Xe=ee?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:Z}),g.jsx("span",{className:"md:hidden",children:Z!==null?OT(Z):null})]}),children:We=>r==="claude"?yv.map(Ye=>g.jsx(ki,{onClick:()=>{m(Ye.id),We()},selected:d.reasoningEffort===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,disabled:Ye.id==="max"&&c!=="opus"},Ye.id)):Lx.map(Ye=>g.jsx(ki,{onClick:()=>{_(Ye.id),We()},selected:d.reasoningEffort===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label},Ye.id))}):null,e[15]=Z,e[16]=ee,e[17]=c,e[18]=d,e[19]=m,e[20]=_,e[21]=r,e[22]=Xe):Xe=e[22];let ht;e[23]!==(V==null?void 0:V.thinkingMode)||e[24]!==ae||e[25]!==c||e[26]!==y||e[27]!==r?(ht=r==="gemini"?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:ae}),g.jsx("span",{className:"md:hidden",children:ae!==null?OT(ae):null})]}),children:We=>Dx.map(Ye=>g.jsx(ki,{onClick:()=>{y(Ye.id),We()},selected:(V==null?void 0:V.thinkingMode)===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,disabled:Ye.id==="off"&&!qq(c)},Ye.id))}):null,e[23]=V==null?void 0:V.thinkingMode,e[24]=ae,e[25]=c,e[26]=y,e[27]=r,e[28]=ht):ht=e[28];let Ke;e[29]!==(I==null?void 0:I.fastMode)||e[30]!==S||e[31]!==r?(Ke=r==="codex"?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[I!=null&&I.fastMode?g.jsx(ui,{className:"h-3.5 w-3.5"}):g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:I!=null&&I.fastMode?"Fast Mode":"Standard"}),g.jsx("span",{className:"md:hidden",children:I!=null&&I.fastMode?"Fast":"Std"})]}),triggerClassName:I!=null&&I.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:We=>g.jsxs(g.Fragment,{children:[g.jsx(ki,{onClick:()=>{S(!1),We()},selected:!(I!=null&&I.fastMode),icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),g.jsx(ki,{onClick:()=>{S(!0),We()},selected:!!(I!=null&&I.fastMode),icon:g.jsx(ui,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,e[29]=I==null?void 0:I.fastMode,e[30]=S,e[31]=r,e[32]=Ke):Ke=e[32];let it;return e[33]!==q||e[34]!==Y||e[35]!==R||e[36]!==W?(it=W?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[Y?g.jsx(Vn,{className:"h-3.5 w-3.5 animate-spin"}):q?g.jsx(dv,{className:"h-3.5 w-3.5"}):g.jsx(q5,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:Y?q?"Planning...":"Implementing...":q?"Plan":"Implement"}),g.jsx("span",{className:"md:hidden",children:Y?q?"Plan...":"Impl...":q?"Plan":"Impl"})]}),triggerClassName:q?"text-blue-400 dark:text-blue-300":void 0,children:We=>g.jsxs(g.Fragment,{children:[g.jsx(ki,{onClick:()=>{R(!1),We()},selected:!q,icon:g.jsx(q5,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution",disabled:Y}),g.jsx(ki,{onClick:()=>{R(!0),We()},selected:q,icon:g.jsx(dv,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution",disabled:Y})]})}):null,e[33]=q,e[34]=Y,e[35]=R,e[36]=W,e[37]=it):it=e[37],g.jsx("div",{className:Te,children:g.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[D?g.jsx(bl,{disabled:z||!f,trigger:g.jsxs(g.Fragment,{children:[g.jsx(U,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:(j==null?void 0:j.label)??r})]}),children:We=>n.map(Ye=>{const tt=Cv[Ye.id],et=i==null?void 0:i[Ye.id];return g.jsx(ki,{onClick:()=>{et||(f==null||f(Ye.id),We())},selected:r===Ye.id,icon:g.jsx(tt,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,description:et,disabled:!!et},Ye.id)})}):null,g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[Le,g.jsx("span",{children:j.id==="cursor"?jy(((Oe=j.models.find(We=>We.id===c))==null?void 0:Oe.label)??c,c):((Ve=j.models.find(We=>We.id===c))==null?void 0:Ve.label)??c})]}),children:We=>{var Ye;return j.id==="cursor"?F?g.jsxs(g.Fragment,{children:[g.jsxs("button",{onClick:()=>B(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[g.jsx(z4,{className:"h-4 w-4"}),g.jsx("span",{children:F})]}),(Ye=fe.find(tt=>tt.family===F))==null?void 0:Ye.models.map(tt=>{const et=Wm[tt.id]??Sn;return g.jsx(ki,{onClick:()=>{h(r,tt.id),B(null),We()},selected:c===tt.id,icon:g.jsx(et,{className:"h-4 w-4 text-muted-foreground"}),label:jy(tt.label,tt.id)},tt.id)})]}):fe.map(tt=>{var nt;const et=tt.models.some(Pt=>Pt.id===c),ct=Wm[((nt=tt.models[0])==null?void 0:nt.id)??""]??Sn;return g.jsxs("div",{className:"relative",children:[g.jsx(ki,{onClick:()=>B(tt.family),selected:et,icon:g.jsx(ct,{className:"h-4 w-4 text-muted-foreground"}),label:tt.family,description:`${tt.models.length} model${tt.models.length===1?"":"s"}`}),g.jsx(Qi,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},tt.family)}):j.models.map(tt=>{const et=Wm[tt.id]??Sn;return g.jsx(ki,{onClick:()=>{h(r,tt.id),We()},selected:c===tt.id,icon:g.jsx(et,{className:"h-4 w-4 text-muted-foreground"}),label:j.id==="cursor"?jy(tt.label,tt.id):tt.label},tt.id)})}}),ue?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[oe==="fast"?g.jsx(ui,{className:"h-3.5 w-3.5"}):g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:oe==="fast"?"Fast":"Standard"}),g.jsx("span",{className:"md:hidden",children:oe==="fast"?"Fast":"Std"})]}),triggerClassName:oe==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:We=>g.jsxs(g.Fragment,{children:[ie.filter(Zq).map(Ye=>g.jsx(ki,{onClick:()=>{h(r,Ye.id),We()},selected:c===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},Ye.id)),ie.filter(Qq).map(Ye=>g.jsx(ki,{onClick:()=>{h(r,Ye.id),We()},selected:c===Ye.id,icon:g.jsx(ui,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},Ye.id))]})}):null,Xe,r==="claude"&&L.length>1?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(te,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:((Fe=L.find(We=>We.id===J))==null?void 0:Fe.label)??J})]}),children:We=>L.map(Ye=>g.jsx(ki,{onClick:()=>{v(Ye.id),We()},selected:J===Ye.id,icon:Ye.id==="1m"?g.jsx(Y5,{className:"h-4 w-4 text-muted-foreground"}):g.jsx(X5,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,description:Ye.id==="1m"?"Expanded context window":"Standard context window"},Ye.id))}):null,ht,Ke,it]})})}function Qq(t){return Gd(t.id)==="fast"}function Zq(t){return Gd(t.id)==="standard"}function Jq(t){return t.models.length>0}function eK(t){return Gd(t.id)==="standard"}function tK(t){return Gd(t.id)==="fast"}const Ob=t=>{const e=ke.c(16);let n,r,i,s,o;e[0]!==t?({children:n,className:r,shimmerWidth:s,animate:o,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=s,e[5]=o):(n=e[1],r=e[2],i=e[3],s=e[4],o=e[5]);const l=s===void 0?100:s,c=o===void 0?!0:o,d=`${Math.min(l,100)}px`;let f;e[6]!==d?(f={"--shiny-width":d},e[6]=d,e[7]=f):f=e[7];const h=f;let m;e[8]!==c||e[9]!==r?(m=we("mx-auto max-w-md text-foreground/50",c?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],r),e[8]=c,e[9]=r,e[10]=m):m=e[10];let v;return e[11]!==n||e[12]!==i||e[13]!==h||e[14]!==m?(v=g.jsx("span",{style:h,className:m,...i,children:n}),e[11]=n,e[12]=i,e[13]=h,e[14]=m,e[15]=v):v=e[15],v};function Px(t){return t.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const nK=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function rK(t){const e=t.trim();for(const n of nK){const r=e.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return e}function PT(t){return t.split("/").pop()||t}function iK(t,e){if(t===void 0)return null;const n=Math.max(0,e-t),r=6e4,i=60*r,s=24*i,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}const sK='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function jT(t){var e;try{(e=navigator.vibrate)==null||e.call(navigator,t)}catch{}}function mC({enabled:t,visualElementRef:e,onTap:n,onContextMenu:r,onDragStart:i,onDragMove:s,onDragEnd:o,holdDelay:l=300,contextMenuDelay:c=2500,scrollThreshold:d=8,dragMoveThreshold:f=5}){const[h,m]=x.useState(!1),[v,_]=x.useState(!1),[y,S]=x.useState(null),[C,R]=x.useState(null),k=x.useCallback(P=>{R(P)},[]),T=x.useRef("idle"),M=x.useRef({x:0,y:0}),A=x.useRef(null),D=x.useRef(null),z=x.useRef(n),G=x.useRef(r),$=x.useRef(i),H=x.useRef(s),F=x.useRef(o);z.current=n,G.current=r,$.current=i,H.current=s,F.current=o;const B=x.useCallback((P,W)=>{const q=(e==null?void 0:e.current)??C;if(!q)return document.elementFromPoint(P,W);const Y=q.style.pointerEvents;q.style.pointerEvents="none";const N=document.elementFromPoint(P,W);return q.style.pointerEvents=Y,N},[e,C]),j=x.useCallback(()=>{A.current&&(clearTimeout(A.current),A.current=null),D.current&&(clearTimeout(D.current),D.current=null)},[]),U=x.useCallback(()=>{j(),T.current="idle",_(!1),m(!1),S(null)},[j]);return x.useEffect(()=>{if(!C||!t)return;const P=N=>{if(N.target.closest(sK))return;const I=N.touches[0];I&&(M.current={x:I.clientX,y:I.clientY},T.current="holding",A.current=setTimeout(()=>{A.current=null,T.current==="holding"&&(T.current="armed",_(!0),jT(30),D.current=setTimeout(()=>{var L;if(D.current=null,T.current!=="armed")return;jT(100);const V={...M.current};T.current="idle",_(!1),(L=G.current)==null||L.call(G,V)},c))},l))},W=N=>{var ee,oe;const I=T.current;if(I==="idle")return;const V=N.touches[0];if(!V)return;const L=V.clientX-M.current.x,J=V.clientY-M.current.y,te=Math.sqrt(L*L+J*J);if(I==="holding"){te>d&&(j(),T.current="idle");return}if(I==="armed"){te>f&&(D.current&&(clearTimeout(D.current),D.current=null),T.current="dragging",_(!1),m(!0),S({x:V.clientX,y:V.clientY}),N.preventDefault(),(ee=$.current)==null||ee.call($,{x:V.clientX,y:V.clientY}));return}if(I==="dragging"){N.preventDefault(),S({x:V.clientX,y:V.clientY});const ie=B(V.clientX,V.clientY);(oe=H.current)==null||oe.call(H,{x:V.clientX,y:V.clientY,elementBelow:ie})}},q=N=>{var V,L;const I=T.current;if(I==="holding"){j(),T.current="idle",_(!1),m(!1),N.preventDefault(),(V=z.current)==null||V.call(z);return}if(I==="armed"){U();return}if(I==="dragging"){const J=N.changedTouches[0];if(J){const te=B(J.clientX,J.clientY);(L=F.current)==null||L.call(F,{x:J.clientX,y:J.clientY,elementBelow:te})}U()}},Y=()=>{var N;T.current==="dragging"&&((N=F.current)==null||N.call(F,{x:0,y:0,elementBelow:null})),U()};return C.addEventListener("touchstart",P,{passive:!1}),C.addEventListener("touchmove",W,{passive:!1}),C.addEventListener("touchend",q),C.addEventListener("touchcancel",Y),()=>{C.removeEventListener("touchstart",P),C.removeEventListener("touchmove",W),C.removeEventListener("touchend",q),C.removeEventListener("touchcancel",Y),j(),T.current="idle"}},[C,t,l,c,d,f,j,U,B]),{touchRef:k,isDragging:h,isArmed:v,dragPosition:y}}function HD(t){const e=ke.c(9),{position:n,children:r,className:i}=t;if(!n)return null;let s;e[0]!==n.x||e[1]!==n.y?(s={position:"fixed",left:n.x,top:n.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},e[0]=n.x,e[1]=n.y,e[2]=s):s=e[2];let o;e[3]!==i?(o=we("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",i),e[3]=i,e[4]=o):o=e[4];let l;return e[5]!==r||e[6]!==s||e[7]!==o?(l=ks.createPortal(g.jsx("div",{style:s,className:o,children:r}),document.body),e[5]=r,e[6]=s,e[7]=o,e[8]=l):l=e[8],l}function gC(t){const e=t+"CollectionProvider",[n,r]=Da(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:S,children:C}=y,R=Be.useRef(null),k=Be.useRef(new Map).current;return g.jsx(i,{scope:S,itemMap:k,collectionRef:R,children:C})};o.displayName=e;const l=t+"CollectionSlot",c=zc(l),d=Be.forwardRef((y,S)=>{const{scope:C,children:R}=y,k=s(l,C),T=on(S,k.collectionRef);return g.jsx(c,{ref:T,children:R})});d.displayName=l;const f=t+"CollectionItemSlot",h="data-radix-collection-item",m=zc(f),v=Be.forwardRef((y,S)=>{const{scope:C,children:R,...k}=y,T=Be.useRef(null),M=on(S,T),A=s(f,C);return Be.useEffect(()=>(A.itemMap.set(T,{ref:T,...k}),()=>void A.itemMap.delete(T))),g.jsx(m,{[h]:"",ref:M,children:R})});v.displayName=f;function _(y){const S=s(t+"CollectionConsumer",y);return Be.useCallback(()=>{const R=S.collectionRef.current;if(!R)return[];const k=Array.from(R.querySelectorAll(`[${h}]`));return Array.from(S.itemMap.values()).sort((A,D)=>k.indexOf(A.ref.current)-k.indexOf(D.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},_,r]}var oK=x.createContext(void 0);function vC(t){const e=x.useContext(oK);return t||e||"ltr"}var zy="rovingFocusGroup.onEntryFocus",aK={bubbles:!1,cancelable:!0},up="RovingFocusGroup",[jx,UD,lK]=gC(up),[cK,VD]=Da(up,[lK]),[uK,dK]=cK(up),GD=x.forwardRef((t,e)=>g.jsx(jx.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(jx.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(fK,{...t,ref:e})})}));GD.displayName=up;var fK=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=x.useRef(null),v=on(e,m),_=vC(s),[y,S]=kd({prop:o,defaultProp:l??null,onChange:c,caller:up}),[C,R]=x.useState(!1),k=eo(d),T=UD(n),M=x.useRef(!1),[A,D]=x.useState(0);return x.useEffect(()=>{const z=m.current;if(z)return z.addEventListener(zy,k),()=>z.removeEventListener(zy,k)},[k]),g.jsx(uK,{scope:n,orientation:r,dir:_,loop:i,currentTabStopId:y,onItemFocus:x.useCallback(z=>S(z),[S]),onItemShiftTab:x.useCallback(()=>R(!0),[]),onFocusableItemAdd:x.useCallback(()=>D(z=>z+1),[]),onFocusableItemRemove:x.useCallback(()=>D(z=>z-1),[]),children:g.jsx(Kt.div,{tabIndex:C||A===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...t.style},onMouseDown:lt(t.onMouseDown,()=>{M.current=!0}),onFocus:lt(t.onFocus,z=>{const G=!M.current;if(z.target===z.currentTarget&&G&&!C){const $=new CustomEvent(zy,aK);if(z.currentTarget.dispatchEvent($),!$.defaultPrevented){const H=T().filter(P=>P.focusable),F=H.find(P=>P.active),B=H.find(P=>P.id===y),U=[F,B,...H].filter(Boolean).map(P=>P.ref.current);KD(U,f)}}M.current=!1}),onBlur:lt(t.onBlur,()=>R(!1))})})}),WD="RovingFocusGroupItem",qD=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=t,c=ka(),d=s||c,f=dK(WD,n),h=f.currentTabStopId===d,m=UD(n),{onFocusableItemAdd:v,onFocusableItemRemove:_,currentTabStopId:y}=f;return x.useEffect(()=>{if(r)return v(),()=>_()},[r,v,_]),g.jsx(jx.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:g.jsx(Kt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:e,onMouseDown:lt(t.onMouseDown,S=>{r?f.onItemFocus(d):S.preventDefault()}),onFocus:lt(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:lt(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const C=mK(S,f.orientation,f.dir);if(C!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let k=m().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")k.reverse();else if(C==="prev"||C==="next"){C==="prev"&&k.reverse();const T=k.indexOf(S.currentTarget);k=f.loop?gK(k,T+1):k.slice(T+1)}setTimeout(()=>KD(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:y!=null}):o})})});qD.displayName=WD;var hK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pK(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function mK(t,e,n){const r=pK(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return hK[r]}function KD(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function gK(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var vK=GD,bK=qD,zx=["Enter"," "],_K=["ArrowDown","PageUp","Home"],YD=["ArrowUp","PageDown","End"],yK=[..._K,...YD],xK={ltr:[...zx,"ArrowRight"],rtl:[...zx,"ArrowLeft"]},SK={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dp="Menu",[Oh,wK,CK]=gC(dp),[eu,XD]=Da(dp,[CK,Kl,VD]),Pb=Kl(),QD=VD(),[EK,tu]=eu(dp),[kK,fp]=eu(dp),ZD=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,l=Pb(e),[c,d]=x.useState(null),f=x.useRef(!1),h=eo(s),m=vC(i);return x.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",_,{capture:!0,once:!0}),document.addEventListener("pointermove",_,{capture:!0,once:!0})},_=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",_,{capture:!0}),document.removeEventListener("pointermove",_,{capture:!0})}},[]),g.jsx(Rb,{...l,children:g.jsx(EK,{scope:e,open:n,onOpenChange:h,content:c,onContentChange:d,children:g.jsx(kK,{scope:e,onClose:x.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};ZD.displayName=dp;var RK="MenuAnchor",bC=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Pb(n);return g.jsx(ap,{...i,...r,ref:e})});bC.displayName=RK;var _C="MenuPortal",[TK,JD]=eu(_C,{forceMount:void 0}),eI=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=tu(_C,e);return g.jsx(TK,{scope:e,forceMount:n,children:g.jsx(Ls,{present:n||s.open,children:g.jsx(Hd,{asChild:!0,container:i,children:r})})})};eI.displayName=_C;var Ts="MenuContent",[AK,yC]=eu(Ts),tI=x.forwardRef((t,e)=>{const n=JD(Ts,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=tu(Ts,t.__scopeMenu),o=fp(Ts,t.__scopeMenu);return g.jsx(Oh.Provider,{scope:t.__scopeMenu,children:g.jsx(Ls,{present:r||s.open,children:g.jsx(Oh.Slot,{scope:t.__scopeMenu,children:o.modal?g.jsx(MK,{...i,ref:e}):g.jsx(NK,{...i,ref:e})})})})}),MK=x.forwardRef((t,e)=>{const n=tu(Ts,t.__scopeMenu),r=x.useRef(null),i=on(e,r);return x.useEffect(()=>{const s=r.current;if(s)return bb(s)},[]),g.jsx(xC,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:lt(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),NK=x.forwardRef((t,e)=>{const n=tu(Ts,t.__scopeMenu);return g.jsx(xC,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),LK=zc("MenuContent.ScrollLock"),xC=x.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:v,disableOutsideScroll:_,...y}=t,S=tu(Ts,n),C=fp(Ts,n),R=Pb(n),k=QD(n),T=wK(n),[M,A]=x.useState(null),D=x.useRef(null),z=on(e,D,S.onContentChange),G=x.useRef(0),$=x.useRef(""),H=x.useRef(0),F=x.useRef(null),B=x.useRef("right"),j=x.useRef(0),U=_?ip:x.Fragment,P=_?{as:LK,allowPinchZoom:!0}:void 0,W=Y=>{var oe,ie;const N=$.current+Y,I=T().filter(ue=>!ue.disabled),V=document.activeElement,L=(oe=I.find(ue=>ue.ref.current===V))==null?void 0:oe.textValue,J=I.map(ue=>ue.textValue),te=VK(J,N,L),ee=(ie=I.find(ue=>ue.textValue===te))==null?void 0:ie.ref.current;(function ue(fe){$.current=fe,window.clearTimeout(G.current),fe!==""&&(G.current=window.setTimeout(()=>ue(""),1e3))})(N),ee&&setTimeout(()=>ee.focus())};x.useEffect(()=>()=>window.clearTimeout(G.current),[]),gb();const q=x.useCallback(Y=>{var I,V;return B.current===((I=F.current)==null?void 0:I.side)&&WK(Y,(V=F.current)==null?void 0:V.area)},[]);return g.jsx(AK,{scope:n,searchRef:$,onItemEnter:x.useCallback(Y=>{q(Y)&&Y.preventDefault()},[q]),onItemLeave:x.useCallback(Y=>{var N;q(Y)||((N=D.current)==null||N.focus(),A(null))},[q]),onTriggerLeave:x.useCallback(Y=>{q(Y)&&Y.preventDefault()},[q]),pointerGraceTimerRef:H,onPointerGraceIntentChange:x.useCallback(Y=>{F.current=Y},[]),children:g.jsx(U,{...P,children:g.jsx(rp,{asChild:!0,trapped:i,onMountAutoFocus:lt(s,Y=>{var N;Y.preventDefault(),(N=D.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:g.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:v,children:g.jsx(vK,{asChild:!0,...k,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:M,onCurrentTabStopIdChange:A,onEntryFocus:lt(c,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(Tb,{role:"menu","aria-orientation":"vertical","data-state":vI(S.open),"data-radix-menu-content":"",dir:C.dir,...R,...y,ref:z,style:{outline:"none",...y.style},onKeyDown:lt(y.onKeyDown,Y=>{const I=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,V=Y.ctrlKey||Y.altKey||Y.metaKey,L=Y.key.length===1;I&&(Y.key==="Tab"&&Y.preventDefault(),!V&&L&&W(Y.key));const J=D.current;if(Y.target!==J||!yK.includes(Y.key))return;Y.preventDefault();const ee=T().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);YD.includes(Y.key)&&ee.reverse(),HK(ee)}),onBlur:lt(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(G.current),$.current="")}),onPointerMove:lt(t.onPointerMove,Ph(Y=>{const N=Y.target,I=j.current!==Y.clientX;if(Y.currentTarget.contains(N)&&I){const V=Y.clientX>j.current?"right":"left";B.current=V,j.current=Y.clientX}}))})})})})})})});tI.displayName=Ts;var DK="MenuGroup",SC=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Kt.div,{role:"group",...r,ref:e})});SC.displayName=DK;var IK="MenuLabel",nI=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Kt.div,{...r,ref:e})});nI.displayName=IK;var Ev="MenuItem",zT="menu.itemSelect",jb=x.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=x.useRef(null),o=fp(Ev,t.__scopeMenu),l=yC(Ev,t.__scopeMenu),c=on(e,s),d=x.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const m=new CustomEvent(zT,{bubbles:!0,cancelable:!0});h.addEventListener(zT,v=>r==null?void 0:r(v),{once:!0}),uL(h,m),m.defaultPrevented?d.current=!1:o.onClose()}};return g.jsx(rI,{...i,ref:c,disabled:n,onClick:lt(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:lt(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:lt(t.onKeyDown,h=>{const m=l.searchRef.current!=="";n||m&&h.key===" "||zx.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});jb.displayName=Ev;var rI=x.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=yC(Ev,n),l=QD(n),c=x.useRef(null),d=on(e,c),[f,h]=x.useState(!1),[m,v]=x.useState("");return x.useEffect(()=>{const _=c.current;_&&v((_.textContent??"").trim())},[s.children]),g.jsx(Oh.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:g.jsx(bK,{asChild:!0,...l,focusable:!r,children:g.jsx(Kt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:lt(t.onPointerMove,Ph(_=>{r?o.onItemLeave(_):(o.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:lt(t.onPointerLeave,Ph(_=>o.onItemLeave(_))),onFocus:lt(t.onFocus,()=>h(!0)),onBlur:lt(t.onBlur,()=>h(!1))})})})}),OK="MenuCheckboxItem",iI=x.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return g.jsx(cI,{scope:t.__scopeMenu,checked:n,children:g.jsx(jb,{role:"menuitemcheckbox","aria-checked":kv(n)?"mixed":n,...i,ref:e,"data-state":CC(n),onSelect:lt(i.onSelect,()=>r==null?void 0:r(kv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});iI.displayName=OK;var sI="MenuRadioGroup",[PK,jK]=eu(sI,{value:void 0,onValueChange:()=>{}}),oI=x.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=eo(r);return g.jsx(PK,{scope:t.__scopeMenu,value:n,onValueChange:s,children:g.jsx(SC,{...i,ref:e})})});oI.displayName=sI;var aI="MenuRadioItem",lI=x.forwardRef((t,e)=>{const{value:n,...r}=t,i=jK(aI,t.__scopeMenu),s=n===i.value;return g.jsx(cI,{scope:t.__scopeMenu,checked:s,children:g.jsx(jb,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":CC(s),onSelect:lt(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});lI.displayName=aI;var wC="MenuItemIndicator",[cI,zK]=eu(wC,{checked:!1}),uI=x.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=zK(wC,n);return g.jsx(Ls,{present:r||kv(s.checked)||s.checked===!0,children:g.jsx(Kt.span,{...i,ref:e,"data-state":CC(s.checked)})})});uI.displayName=wC;var BK="MenuSeparator",dI=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Kt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});dI.displayName=BK;var $K="MenuArrow",fI=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Pb(n);return g.jsx(Ab,{...i,...r,ref:e})});fI.displayName=$K;var FK="MenuSub",[n1e,hI]=eu(FK),uh="MenuSubTrigger",pI=x.forwardRef((t,e)=>{const n=tu(uh,t.__scopeMenu),r=fp(uh,t.__scopeMenu),i=hI(uh,t.__scopeMenu),s=yC(uh,t.__scopeMenu),o=x.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:t.__scopeMenu},f=x.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return x.useEffect(()=>f,[f]),x.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),g.jsx(bC,{asChild:!0,...d,children:g.jsx(rI,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":vI(n.open),...t,ref:Fw(e,i.onTriggerChange),onClick:h=>{var m;(m=t.onClick)==null||m.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:lt(t.onPointerMove,Ph(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:lt(t.onPointerLeave,Ph(h=>{var v,_;f();const m=(v=n.content)==null?void 0:v.getBoundingClientRect();if(m){const y=(_=n.content)==null?void 0:_.dataset.side,S=y==="right",C=S?-5:5,R=m[S?"left":"right"],k=m[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:R,y:m.top},{x:k,y:m.top},{x:k,y:m.bottom},{x:R,y:m.bottom}],side:y}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:lt(t.onKeyDown,h=>{var v;const m=s.searchRef.current!=="";t.disabled||m&&h.key===" "||xK[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});pI.displayName=uh;var mI="MenuSubContent",gI=x.forwardRef((t,e)=>{const n=JD(Ts,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=tu(Ts,t.__scopeMenu),o=fp(Ts,t.__scopeMenu),l=hI(mI,t.__scopeMenu),c=x.useRef(null),d=on(e,c);return g.jsx(Oh.Provider,{scope:t.__scopeMenu,children:g.jsx(Ls,{present:r||s.open,children:g.jsx(Oh.Slot,{scope:t.__scopeMenu,children:g.jsx(xC,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:lt(t.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:lt(t.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:lt(t.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),m=SK[o.dir].includes(f.key);h&&m&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});gI.displayName=mI;function vI(t){return t?"open":"closed"}function kv(t){return t==="indeterminate"}function CC(t){return kv(t)?"indeterminate":t?"checked":"unchecked"}function HK(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function UK(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function VK(t,e,n){const i=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=UK(t,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function GK(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const l=e[s],c=e[o],d=l.x,f=l.y,h=c.x,m=c.y;f>r!=m>r&&n<(h-d)*(r-f)/(m-f)+d&&(i=!i)}return i}function WK(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return GK(n,e)}function Ph(t){return e=>e.pointerType==="mouse"?t(e):void 0}var qK=ZD,KK=bC,YK=eI,XK=tI,QK=SC,ZK=nI,JK=jb,eY=iI,tY=oI,nY=lI,rY=uI,iY=dI,sY=fI,oY=pI,aY=gI,EC="ContextMenu",[lY,r1e]=Da(EC,[XD]),mi=XD(),[cY,bI]=lY(EC),_I=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:i,modal:s=!0}=t,[o,l]=x.useState(!1),c=mi(e),d=eo(r),f=x.useCallback(h=>{l(h),d(h)},[d]);return g.jsx(cY,{scope:e,open:o,onOpenChange:f,modal:s,children:g.jsx(qK,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};_I.displayName=EC;var yI="ContextMenuTrigger",xI=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=t,s=bI(yI,n),o=mi(n),l=x.useRef({x:0,y:0}),c=x.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=x.useRef(0),f=x.useCallback(()=>window.clearTimeout(d.current),[]),h=m=>{l.current={x:m.clientX,y:m.clientY},s.onOpenChange(!0)};return x.useEffect(()=>f,[f]),x.useEffect(()=>void(r&&f()),[r,f]),g.jsxs(g.Fragment,{children:[g.jsx(KK,{...o,virtualRef:c}),g.jsx(Kt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:lt(t.onContextMenu,m=>{f(),h(m),m.preventDefault()}),onPointerDown:r?t.onPointerDown:lt(t.onPointerDown,qm(m=>{f(),d.current=window.setTimeout(()=>h(m),700)})),onPointerMove:r?t.onPointerMove:lt(t.onPointerMove,qm(f)),onPointerCancel:r?t.onPointerCancel:lt(t.onPointerCancel,qm(f)),onPointerUp:r?t.onPointerUp:lt(t.onPointerUp,qm(f))})]})});xI.displayName=yI;var uY="ContextMenuPortal",SI=t=>{const{__scopeContextMenu:e,...n}=t,r=mi(e);return g.jsx(YK,{...r,...n})};SI.displayName=uY;var wI="ContextMenuContent",CI=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=bI(wI,n),s=mi(n),o=x.useRef(!1);return g.jsx(XK,{...s,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=t.onCloseAutoFocus)==null||c.call(t,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=t.onInteractOutside)==null||c.call(t,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});CI.displayName=wI;var dY="ContextMenuGroup",fY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(QK,{...i,...r,ref:e})});fY.displayName=dY;var hY="ContextMenuLabel",pY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(ZK,{...i,...r,ref:e})});pY.displayName=hY;var mY="ContextMenuItem",EI=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(JK,{...i,...r,ref:e})});EI.displayName=mY;var gY="ContextMenuCheckboxItem",vY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(eY,{...i,...r,ref:e})});vY.displayName=gY;var bY="ContextMenuRadioGroup",_Y=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(tY,{...i,...r,ref:e})});_Y.displayName=bY;var yY="ContextMenuRadioItem",xY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(nY,{...i,...r,ref:e})});xY.displayName=yY;var SY="ContextMenuItemIndicator",wY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(rY,{...i,...r,ref:e})});wY.displayName=SY;var CY="ContextMenuSeparator",EY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(iY,{...i,...r,ref:e})});EY.displayName=CY;var kY="ContextMenuArrow",RY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(sY,{...i,...r,ref:e})});RY.displayName=kY;var TY="ContextMenuSubTrigger",AY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(oY,{...i,...r,ref:e})});AY.displayName=TY;var MY="ContextMenuSubContent",NY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(aY,{...i,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NY.displayName=MY;function qm(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var LY=_I,DY=xI,IY=SI,kI=CI,RI=EI;const kC=LY,RC=DY,zb=x.forwardRef((t,e)=>{const n=ke.c(9);let r,i;n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);let s;n[3]!==r?(s=we("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",r),n[3]=r,n[4]=s):s=n[4];let o;return n[5]!==i||n[6]!==e||n[7]!==s?(o=g.jsx(IY,{children:g.jsx(kI,{ref:e,className:s,...i})}),n[5]=i,n[6]=e,n[7]=s,n[8]=o):o=n[8],o});zb.displayName=kI.displayName;const Md=x.forwardRef((t,e)=>{const n=ke.c(9);let r,i;n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);let s;n[3]!==r?(s=we("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),n[3]=r,n[4]=s):s=n[4];let o;return n[5]!==i||n[6]!==e||n[7]!==s?(o=g.jsx(RI,{ref:e,className:s,...i}),n[5]=i,n[6]=e,n[7]=s,n[8]=o):o=n[8],o});Md.displayName=RI.displayName;function Bb(t){const e=ke.c(12),{open:n,onOpenChange:r,position:i,children:s}=t;let o;e[0]!==i?(o=i?{position:"fixed",left:i.x,top:i.y,width:0,height:0}:void 0,e[0]=i,e[1]=o):o=e[1];let l;e[2]!==o?(l=g.jsx($q,{style:o}),e[2]=o,e[3]=l):l=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=we("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"),e[4]=c):c=e[4];let d;e[5]!==s?(d=g.jsx(FD,{children:g.jsx(fC,{side:"bottom",align:"start",sideOffset:4,onOpenAutoFocus:OY,className:c,children:s})}),e[5]=s,e[6]=d):d=e[6];let f;return e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==d?(f=g.jsxs($D,{open:n,onOpenChange:r,children:[l,d]}),e[7]=r,e[8]=n,e[9]=l,e[10]=d,e[11]=f):f=e[11],f}function OY(t){return t.preventDefault()}function Bl(t){const e=ke.c(8),{onSelect:n,className:r,children:i}=t;let s;e[0]!==r?(s=we("relative flex w-full cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors","hover:bg-accent focus:bg-accent",r),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==n?(o=c=>{c.preventDefault(),n()},e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==s||e[6]!==o?(l=g.jsx("button",{type:"button",className:s,onPointerDown:o,children:i}),e[4]=i,e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function PY(t){const e=ke.c(21),{onRemove:n,children:r,mobileMenuPosition:i,onMobileMenuClose:s,skipContextMenu:o}=t;let l;e[0]!==r||e[1]!==n||e[2]!==o?(l=o?r:g.jsxs(kC,{children:[g.jsx(RC,{asChild:!0,children:r}),g.jsx(zb,{children:g.jsxs(Md,{onSelect:C=>{C.stopPropagation(),n()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(Ed,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})})]}),e[0]=r,e[1]=n,e[2]=o,e[3]=l):l=e[3];const c=!!i;let d;e[4]!==s?(d=C=>{C||s==null||s()},e[4]=s,e[5]=d):d=e[5];const f=i??null;let h;e[6]!==s||e[7]!==n?(h=()=>{s==null||s(),n()},e[6]=s,e[7]=n,e[8]=h):h=e[8];let m,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=g.jsx(Ed,{className:"h-4 w-4"}),v=g.jsx("span",{children:"Hide"}),e[9]=m,e[10]=v):(m=e[9],v=e[10]);let _;e[11]!==h?(_=g.jsxs(Bl,{onSelect:h,className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m,v]}),e[11]=h,e[12]=_):_=e[12];let y;e[13]!==c||e[14]!==d||e[15]!==f||e[16]!==_?(y=g.jsx(Bb,{open:c,onOpenChange:d,position:f,children:_}),e[13]=c,e[14]=d,e[15]=f,e[16]=_,e[17]=y):y=e[17];let S;return e[18]!==l||e[19]!==y?(S=g.jsxs(g.Fragment,{children:[l,y]}),e[18]=l,e[19]=y,e[20]=S):S=e[20],S}function jY(t){const e=ke.c(30),{onRename:n,onDelete:r,children:i,mobileMenuPosition:s,onMobileMenuClose:o,skipContextMenu:l}=t;let c;e[0]!==i||e[1]!==r||e[2]!==n||e[3]!==l?(c=l?i:g.jsxs(kC,{children:[g.jsx(RC,{asChild:!0,children:i}),g.jsxs(zb,{children:[g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),n()},children:[g.jsx(Vl,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Rename Feature"})]}),g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),r()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(Ed,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Delete Feature"})]})]})]}),e[0]=i,e[1]=r,e[2]=n,e[3]=l,e[4]=c):c=e[4];const d=!!s;let f;e[5]!==o?(f=A=>{A||o==null||o()},e[5]=o,e[6]=f):f=e[6];const h=s??null;let m;e[7]!==o||e[8]!==n?(m=()=>{o==null||o(),n()},e[7]=o,e[8]=n,e[9]=m):m=e[9];let v,_;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=g.jsx(Vl,{className:"h-4 w-4"}),_=g.jsx("span",{children:"Rename Feature"}),e[10]=v,e[11]=_):(v=e[10],_=e[11]);let y;e[12]!==m?(y=g.jsxs(Bl,{onSelect:m,children:[v,_]}),e[12]=m,e[13]=y):y=e[13];let S;e[14]!==r||e[15]!==o?(S=()=>{o==null||o(),r()},e[14]=r,e[15]=o,e[16]=S):S=e[16];let C,R;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx(Ed,{className:"h-4 w-4"}),R=g.jsx("span",{children:"Delete Feature"}),e[17]=C,e[18]=R):(C=e[17],R=e[18]);let k;e[19]!==S?(k=g.jsxs(Bl,{onSelect:S,className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[C,R]}),e[19]=S,e[20]=k):k=e[20];let T;e[21]!==k||e[22]!==d||e[23]!==f||e[24]!==h||e[25]!==y?(T=g.jsxs(Bb,{open:d,onOpenChange:f,position:h,children:[y,k]}),e[21]=k,e[22]=d,e[23]=f,e[24]=h,e[25]=y,e[26]=T):T=e[26];let M;return e[27]!==c||e[28]!==T?(M=g.jsxs(g.Fragment,{children:[c,T]}),e[27]=c,e[28]=T,e[29]=M):M=e[29],M}function zY(t){const e=ke.c(30),{onRename:n,onDelete:r,children:i,mobileMenuPosition:s,onMobileMenuClose:o,skipContextMenu:l}=t;let c;e[0]!==i||e[1]!==r||e[2]!==n||e[3]!==l?(c=l?i:g.jsxs(kC,{children:[g.jsx(RC,{asChild:!0,children:i}),g.jsxs(zb,{children:[g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),n()},children:[g.jsx(Vl,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Rename Chat"})]}),g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),r()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(Ed,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Delete Chat"})]})]})]}),e[0]=i,e[1]=r,e[2]=n,e[3]=l,e[4]=c):c=e[4];const d=!!s;let f;e[5]!==o?(f=A=>{A||o==null||o()},e[5]=o,e[6]=f):f=e[6];const h=s??null;let m;e[7]!==o||e[8]!==n?(m=()=>{o==null||o(),n()},e[7]=o,e[8]=n,e[9]=m):m=e[9];let v,_;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=g.jsx(Vl,{className:"h-4 w-4"}),_=g.jsx("span",{children:"Rename Chat"}),e[10]=v,e[11]=_):(v=e[10],_=e[11]);let y;e[12]!==m?(y=g.jsxs(Bl,{onSelect:m,children:[v,_]}),e[12]=m,e[13]=y):y=e[13];let S;e[14]!==r||e[15]!==o?(S=()=>{o==null||o(),r()},e[14]=r,e[15]=o,e[16]=S):S=e[16];let C,R;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx(Ed,{className:"h-4 w-4"}),R=g.jsx("span",{children:"Delete Chat"}),e[17]=C,e[18]=R):(C=e[17],R=e[18]);let k;e[19]!==S?(k=g.jsxs(Bl,{onSelect:S,className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[C,R]}),e[19]=S,e[20]=k):k=e[20];let T;e[21]!==k||e[22]!==d||e[23]!==f||e[24]!==h||e[25]!==y?(T=g.jsxs(Bb,{open:d,onOpenChange:f,position:h,children:[y,k]}),e[21]=k,e[22]=d,e[23]=f,e[24]=h,e[25]=y,e[26]=T):T=e[26];let M;return e[27]!==c||e[28]!==T?(M=g.jsxs(g.Fragment,{children:[c,T]}),e[27]=c,e[28]=T,e[29]=M):M=e[29],M}const BY=new Set(["starting","running"]);function $Y(t){const e=ke.c(90),{chat:n,activeChatId:r,nowMs:i,showProviderIcon:s,isCompleted:o,onSelectChat:l,onRenameChat:c,onDeleteChat:d,draggable:f,onDragStart:h,onDragEnd:m,isTouchDevice:v,onTouchDragMove:_,onTouchDragEnd:y}=t,S=s===void 0?!1:s,C=o===void 0?!1:o,R=f===void 0?!1:f,k=v===void 0?!1:v;let T;e[0]!==n.lastMessageAt||e[1]!==i?(T=iK(n.lastMessageAt,i),e[0]=n.lastMessageAt,e[1]=i,e[2]=T):T=e[2];const M=T,A=k,D=n.provider?Cv[n.provider]:null,[z,G]=x.useState(null);let $;e[3]!==n.chatId||e[4]!==l?($=()=>l(n.chatId),e[3]=n.chatId,e[4]=l,e[5]=$):$=e[5];let H;e[6]===Symbol.for("react.memo_cache_sentinel")?(H=vt=>G(vt),e[6]=H):H=e[6];let F;e[7]!==n||e[8]!==R||e[9]!==h?(F=R?()=>h==null?void 0:h(n):void 0,e[7]=n,e[8]=R,e[9]=h,e[10]=F):F=e[10];let B;e[11]!==R||e[12]!==_?(B=R?vt=>{const{x:he,y:Re,elementBelow:Oe}=vt;return _==null?void 0:_(he,Re,Oe)}:void 0,e[11]=R,e[12]=_,e[13]=B):B=e[13];let j;e[14]!==R||e[15]!==m||e[16]!==y?(j=vt=>{const{x:he,y:Re,elementBelow:Oe}=vt;R&&(y==null||y(he,Re,Oe),m==null||m())},e[14]=R,e[15]=m,e[16]=y,e[17]=j):j=e[17];let U;e[18]!==j||e[19]!==$||e[20]!==F||e[21]!==B||e[22]!==A?(U={enabled:A,onTap:$,onContextMenu:H,onDragStart:F,onDragMove:B,onDragEnd:j},e[18]=j,e[19]=$,e[20]=F,e[21]=B,e[22]=A,e[23]=U):U=e[23];const{touchRef:P,isArmed:W,isDragging:q,dragPosition:Y}=mC(U),N=A?P:void 0,I=n._id;let V;e[24]!==n.chatId?(V=Ex(n.chatId),e[24]=n.chatId,e[25]=V):V=e[25];let L;e[26]!==r||e[27]!==n.chatId?(L=r===Ex(n.chatId)?"bg-muted hover:bg-muted border-border":"cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",e[26]=r,e[27]=n.chatId,e[28]=L):L=e[28];const J=W&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",te=q&&!W&&"opacity-20 scale-[0.98]";let ee;e[29]!==L||e[30]!==J||e[31]!==te?(ee=we("group flex items-center gap-2 rounded-lg border px-2.5 py-1.5 transition-all duration-150 select-none",L,J,te),e[29]=L,e[30]=J,e[31]=te,e[32]=ee):ee=e[32];const oe=R&&!k;let ie;e[33]!==n||e[34]!==R||e[35]!==k||e[36]!==h?(ie=R&&!k?()=>h==null?void 0:h(n):void 0,e[33]=n,e[34]=R,e[35]=k,e[36]=h,e[37]=ie):ie=e[37];const ue=R&&!k?m:void 0;let fe;e[38]!==n.chatId||e[39]!==k||e[40]!==l?(fe=k?void 0:()=>l(n.chatId),e[38]=n.chatId,e[39]=k,e[40]=l,e[41]=fe):fe=e[41];let de;e[42]!==n.status||e[43]!==C?(de=BY.has(n.status)?g.jsx(Vn,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):n.status==="waiting_for_user"?g.jsx("div",{className:"relative",children:g.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):C?g.jsx("div",{className:"relative",children:g.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),g.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,e[42]=n.status,e[43]=C,e[44]=de):de=e[44];let Z;e[45]!==D||e[46]!==n.provider||e[47]!==S?(Z=S&&D?g.jsx(D,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${n.provider} provider`}):null,e[45]=D,e[46]=n.provider,e[47]=S,e[48]=Z):Z=e[48];let ne;e[49]!==n.status||e[50]!==n.title?(ne=n.status!=="idle"&&n.status!=="waiting_for_user"?g.jsx(Ob,{animate:n.status==="running",shimmerWidth:Math.max(20,n.title.length*3),children:n.title}):n.title,e[49]=n.status,e[50]=n.title,e[51]=ne):ne=e[51];let ae;e[52]!==ne?(ae=g.jsx("span",{className:"min-w-0 flex-1 translate-y-[-0.5px] truncate text-sm",children:ne}),e[52]=ne,e[53]=ae):ae=e[53];let Q;e[54]!==M?(Q=M?g.jsx("span",{className:"hidden shrink-0 text-[11px] text-muted-foreground opacity-60 md:inline",children:M}):null,e[54]=M,e[55]=Q):Q=e[55];let xe;e[56]!==n._id||e[57]!==N||e[58]!==V||e[59]!==ee||e[60]!==oe||e[61]!==ie||e[62]!==ue||e[63]!==fe||e[64]!==de||e[65]!==Z||e[66]!==ae||e[67]!==Q?(xe=g.jsxs("div",{ref:N,"data-chat-id":V,className:ee,draggable:oe,onDragStart:ie,onDragEnd:ue,onContextMenu:FY,onClick:fe,children:[de,Z,ae,Q]},I),e[56]=n._id,e[57]=N,e[58]=V,e[59]=ee,e[60]=oe,e[61]=ie,e[62]=ue,e[63]=fe,e[64]=de,e[65]=Z,e[66]=ae,e[67]=Q,e[68]=xe):xe=e[68];const le=xe;let Te;e[69]!==n.chatId||e[70]!==c?(Te=()=>c(n.chatId),e[69]=n.chatId,e[70]=c,e[71]=Te):Te=e[71];let Le;e[72]!==n.chatId||e[73]!==d?(Le=()=>d(n.chatId),e[72]=n.chatId,e[73]=d,e[74]=Le):Le=e[74];let Xe;e[75]===Symbol.for("react.memo_cache_sentinel")?(Xe=()=>G(null),e[75]=Xe):Xe=e[75];let ht;e[76]!==k||e[77]!==z||e[78]!==le||e[79]!==Te||e[80]!==Le?(ht=g.jsx(zY,{onRename:Te,onDelete:Le,mobileMenuPosition:z,onMobileMenuClose:Xe,skipContextMenu:k,children:le}),e[76]=k,e[77]=z,e[78]=le,e[79]=Te,e[80]=Le,e[81]=ht):ht=e[81];let Ke;e[82]!==n.title?(Ke=g.jsx("span",{className:"text-sm font-medium truncate",children:n.title}),e[82]=n.title,e[83]=Ke):Ke=e[83];let it;e[84]!==Y||e[85]!==Ke?(it=g.jsx(HD,{position:Y,children:Ke}),e[84]=Y,e[85]=Ke,e[86]=it):it=e[86];let dt;return e[87]!==ht||e[88]!==it?(dt=g.jsxs(g.Fragment,{children:[ht,it]}),e[87]=ht,e[88]=it,e[89]=dt):dt=e[89],dt}function FY(t){t.stopPropagation()}function HY(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return x.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const $b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wd(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function TC(t){return"nodeType"in t}function Li(t){var e,n;return t?Wd(t)?t:TC(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function AC(t){const{Document:e}=Li(t);return t instanceof e}function hp(t){return Wd(t)?!1:t instanceof Li(t).HTMLElement}function TI(t){return t instanceof Li(t).SVGElement}function qd(t){return t?Wd(t)?t.document:TC(t)?AC(t)?t:hp(t)||TI(t)?t.ownerDocument:document:document:document}const jo=$b?x.useLayoutEffect:x.useEffect;function MC(t){const e=x.useRef(t);return jo(()=>{e.current=t}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function UY(){const t=x.useRef(null),e=x.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=x.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function jh(t,e){e===void 0&&(e=[t]);const n=x.useRef(t);return jo(()=>{n.current!==t&&(n.current=t)},e),n}function pp(t,e){const n=x.useRef();return x.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Rv(t){const e=MC(t),n=x.useRef(null),r=x.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function Bx(t){const e=x.useRef();return x.useEffect(()=>{e.current=t},[t]),e.current}let By={};function mp(t,e){return x.useMemo(()=>{if(e)return e;const n=By[t]==null?0:By[t]+1;return By[t]=n,t+"-"+n},[t,e])}function AI(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const f=s[c];f!=null&&(s[c]=f+t*d)}return s},{...e})}}const gd=AI(1),Tv=AI(-1);function VY(t){return"clientX"in t&&"clientY"in t}function NC(t){if(!t)return!1;const{KeyboardEvent:e}=Li(t.target);return e&&t instanceof e}function GY(t){if(!t)return!1;const{TouchEvent:e}=Li(t.target);return e&&t instanceof e}function $x(t){if(GY(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return VY(t)?{x:t.clientX,y:t.clientY}:null}const Nd=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Nd.Translate.toString(t),Nd.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),BT="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function WY(t){return t.matches(BT)?t:t.querySelector(BT)}const qY={display:"none"};function KY(t){let{id:e,value:n}=t;return Be.createElement("div",{id:e,style:qY},n)}function YY(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Be.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function XY(){const[t,e]=x.useState("");return{announce:x.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const MI=x.createContext(null);function QY(t){const e=x.useContext(MI);x.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function ZY(){const[t]=x.useState(()=>new Set),e=x.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[x.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[t]),e]}const JY={draggable:`
493
+ 6. Paste it here.`;function hG(t){const e=ke.c(44),{open:n,onOpenChange:r,onSubmit:i}=t,s=x.useRef(null),[o,l]=x.useState(""),[c,d]=x.useState(!1);let f,h;e[0]!==n?(f=()=>{n&&(l(""),setTimeout(()=>{var I;return(I=s.current)==null?void 0:I.focus()},0))},h=[n],e[0]=n,e[1]=f,e[2]=h):(f=e[1],h=e[2]),x.useEffect(f,h);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=async function(){const V=await navigator.clipboard.readText();l(V)},e[3]=m):m=e[3];const v=m;let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=async function(){await navigator.clipboard.writeText(bT),d(!0),setTimeout(()=>d(!1),2e3)},e[4]=_):_=e[4];const y=_;let S;e[5]!==o?(S=o.trim(),e[5]=o,e[6]=S):S=e[6];const C=S.length>0;let R;e[7]!==C||e[8]!==o||e[9]!==i?(R=I=>{I.preventDefault(),C&&i(o.trim())},e[7]=C,e[8]=o,e[9]=i,e[10]=R):R=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=g.jsx(qw,{children:"Import Cursor Session"}),e[11]=k):k=e[11];let T,M;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=g.jsxs(Kw,{children:["Paste the copied ",g.jsx("code",{children:"get-current-period-usage"})," curl command and Kaizen will import the session for you."]}),M=g.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground whitespace-pre-line",children:bT}),e[12]=T,e[13]=M):(T=e[12],M=e[13]);let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=g.jsx(gt,{type:"button",variant:"ghost",size:"sm",onClick:()=>void v(),children:"Paste Clipboard"}),e[14]=A):A=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=()=>void y(),e[15]=D):D=e[15];let z;e[16]!==c?(z=c?g.jsx(hi,{className:"h-4 w-4"}):g.jsx(fd,{className:"h-4 w-4"}),e[16]=c,e[17]=z):z=e[17];const G=c?"Copied":"Copy Steps";let $;e[18]!==G?($=g.jsx("span",{className:"ml-1",children:G}),e[18]=G,e[19]=$):$=e[19];let H;e[20]!==z||e[21]!==$?(H=g.jsxs("div",{className:"flex gap-2",children:[A,g.jsxs(gt,{type:"button",variant:"ghost",size:"sm",onClick:D,children:[z,$]})]}),e[20]=z,e[21]=$,e[22]=H):H=e[22];let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=I=>l(I.target.value),e[23]=F):F=e[23];let B;e[24]!==o?(B=g.jsx(sp,{ref:s,value:o,onChange:F,rows:10,placeholder:"Paste the copied curl command here",className:"font-mono text-xs"}),e[24]=o,e[25]=B):B=e[25];let j;e[26]!==H||e[27]!==B?(j=g.jsxs(Yw,{className:"space-y-4",children:[k,T,M,H,B]}),e[26]=H,e[27]=B,e[28]=j):j=e[28];let U;e[29]!==r?(U=g.jsx(gt,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"}),e[29]=r,e[30]=U):U=e[30];const P=!C;let W;e[31]!==P?(W=g.jsx(gt,{type:"submit",variant:"secondary",size:"sm",disabled:P,children:"Import Session"}),e[31]=P,e[32]=W):W=e[32];let q;e[33]!==U||e[34]!==W?(q=g.jsxs(Xw,{children:[U,W]}),e[33]=U,e[34]=W,e[35]=q):q=e[35];let Y;e[36]!==j||e[37]!==q||e[38]!==R?(Y=g.jsx(yb,{size:"lg",children:g.jsxs("form",{onSubmit:R,children:[j,q]})}),e[36]=j,e[37]=q,e[38]=R,e[39]=Y):Y=e[39];let N;return e[40]!==r||e[41]!==n||e[42]!==Y?(N=g.jsx(Ww,{open:n,onOpenChange:r,children:Y}),e[40]=r,e[41]=n,e[42]=Y,e[43]=N):N=e[43],N}const pG=["top","right","bottom","left"],Gl=Math.min,Yi=Math.max,gv=Math.round,Gm=Math.floor,Oo=t=>({x:t,y:t}),mG={left:"right",right:"left",bottom:"top",top:"bottom"};function Rx(t,e,n){return Yi(t,Gl(e,n))}function Ta(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function Ud(t){return t.split("-")[1]}function Qw(t){return t==="x"?"y":"x"}function Zw(t){return t==="y"?"height":"width"}function Mo(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Jw(t){return Qw(Mo(t))}function gG(t,e,n){n===void 0&&(n=!1);const r=Ud(t),i=Jw(t),s=Zw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=vv(o)),[o,vv(o)]}function vG(t){const e=vv(t);return[Tx(t),e,Tx(e)]}function Tx(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const _T=["left","right"],yT=["right","left"],bG=["top","bottom"],_G=["bottom","top"];function yG(t,e,n){switch(t){case"top":case"bottom":return n?e?yT:_T:e?_T:yT;case"left":case"right":return e?bG:_G;default:return[]}}function xG(t,e,n,r){const i=Ud(t);let s=yG(Aa(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Tx)))),s}function vv(t){const e=Aa(t);return mG[e]+t.slice(e.length)}function SG(t){return{top:0,right:0,bottom:0,left:0,...t}}function HL(t){return typeof t!="number"?SG(t):{top:t,right:t,bottom:t,left:t}}function bv(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function xT(t,e,n){let{reference:r,floating:i}=t;const s=Mo(e),o=Jw(e),l=Zw(o),c=Aa(e),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,m=r[l]/2-i[l]/2;let v;switch(c){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(Ud(e)){case"start":v[o]-=m*(n&&d?-1:1);break;case"end":v[o]+=m*(n&&d?-1:1);break}return v}async function wG(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:v=0}=Ta(e,t),_=HL(v),S=l[m?h==="floating"?"reference":"floating":h],C=bv(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},M=bv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:k,strategy:c}):R);return{top:(C.top-M.top+_.top)/T.y,bottom:(M.bottom-C.bottom+_.bottom)/T.y,left:(C.left-M.left+_.left)/T.x,right:(M.right-C.right+_.right)/T.x}}const CG=50,EG=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:wG},c=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:h}=xT(d,r,c),m=r,v=0;const _={};for(let y=0;y<s.length;y++){const S=s[y];if(!S)continue;const{name:C,fn:R}=S,{x:k,y:T,data:M,reset:A}=await R({x:f,y:h,initialPlacement:r,placement:m,strategy:i,middlewareData:_,rects:d,platform:l,elements:{reference:t,floating:e}});f=k??f,h=T??h,_[C]={..._[C],...M},A&&v<CG&&(v++,typeof A=="object"&&(A.placement&&(m=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:f,y:h}=xT(d,m,c)),y=-1)}return{x:f,y:h,placement:m,strategy:i,middlewareData:_}},kG=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=e,{element:d,padding:f=0}=Ta(t,e)||{};if(d==null)return{};const h=HL(f),m={x:n,y:r},v=Jw(i),_=Zw(v),y=await o.getDimensions(d),S=v==="y",C=S?"top":"left",R=S?"bottom":"right",k=S?"clientHeight":"clientWidth",T=s.reference[_]+s.reference[v]-m[v]-s.floating[_],M=m[v]-s.reference[v],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let D=A?A[k]:0;(!D||!await(o.isElement==null?void 0:o.isElement(A)))&&(D=l.floating[k]||s.floating[_]);const z=T/2-M/2,G=D/2-y[_]/2-1,$=Gl(h[C],G),H=Gl(h[R],G),F=$,B=D-y[_]-H,j=D/2-y[_]/2+z,U=Rx(F,j,B),P=!c.arrow&&Ud(i)!=null&&j!==U&&s.reference[_]/2-(j<F?$:H)-y[_]/2<0,W=P?j<F?j-F:j-B:0;return{[v]:m[v]+W,data:{[v]:U,centerOffset:j-U-W,...P&&{alignmentOffset:W}},reset:P}}}),RG=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:y=!0,...S}=Ta(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Aa(i),R=Mo(l),k=Aa(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),M=m||(k||!y?[vv(l)]:vG(l)),A=_!=="none";!m&&A&&M.push(...xG(l,y,_,T));const D=[l,...M],z=await c.detectOverflow(e,S),G=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(z[C]),h){const j=gG(i,o,T);G.push(z[j[0]],z[j[1]])}if($=[...$,{placement:i,overflows:G}],!G.every(j=>j<=0)){var H,F;const j=(((H=s.flip)==null?void 0:H.index)||0)+1,U=D[j];if(U&&(!(h==="alignment"?R!==Mo(U):!1)||$.every(q=>Mo(q.placement)===R?q.overflows[0]>0:!0)))return{data:{index:j,overflows:$},reset:{placement:U}};let P=(F=$.filter(W=>W.overflows[0]<=0).sort((W,q)=>W.overflows[1]-q.overflows[1])[0])==null?void 0:F.placement;if(!P)switch(v){case"bestFit":{var B;const W=(B=$.filter(q=>{if(A){const Y=Mo(q.placement);return Y===R||Y==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(Y=>Y>0).reduce((Y,N)=>Y+N,0)]).sort((q,Y)=>q[1]-Y[1])[0])==null?void 0:B[0];W&&(P=W);break}case"initialPlacement":P=l;break}if(i!==P)return{reset:{placement:P}}}return{}}}};function ST(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function wT(t){return pG.some(e=>t[e]>=0)}const TG=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=Ta(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),l=ST(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:wT(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),l=ST(o,n.floating);return{data:{escapedOffsets:l,escaped:wT(l)}}}default:return{}}}}},UL=new Set(["left","top"]);async function AG(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Aa(n),l=Ud(n),c=Mo(n)==="y",d=UL.has(o)?-1:1,f=s&&c?-1:1,h=Ta(e,t);let{mainAxis:m,crossAxis:v,alignmentAxis:_}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof _=="number"&&(v=l==="end"?_*-1:_),c?{x:v*f,y:m*d}:{x:m*d,y:v*f}}const MG=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=e,c=await AG(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},NG=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:C=>{let{x:R,y:k}=C;return{x:R,y:k}}},...d}=Ta(t,e),f={x:n,y:r},h=await s.detectOverflow(e,d),m=Mo(Aa(i)),v=Qw(m);let _=f[v],y=f[m];if(o){const C=v==="y"?"top":"left",R=v==="y"?"bottom":"right",k=_+h[C],T=_-h[R];_=Rx(k,_,T)}if(l){const C=m==="y"?"top":"left",R=m==="y"?"bottom":"right",k=y+h[C],T=y-h[R];y=Rx(k,y,T)}const S=c.fn({...e,[v]:_,[m]:y});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[v]:o,[m]:l}}}}}},LG=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Ta(t,e),f={x:n,y:r},h=Mo(i),m=Qw(h);let v=f[m],_=f[h];const y=Ta(l,e),S=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const k=m==="y"?"height":"width",T=s.reference[m]-s.floating[k]+S.mainAxis,M=s.reference[m]+s.reference[k]-S.mainAxis;v<T?v=T:v>M&&(v=M)}if(d){var C,R;const k=m==="y"?"width":"height",T=UL.has(Aa(i)),M=s.reference[h]-s.floating[k]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:S.crossAxis),A=s.reference[h]+s.reference[k]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?S.crossAxis:0);_<M?_=M:_>A&&(_=A)}return{[m]:v,[h]:_}}}},DG=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:c=()=>{},...d}=Ta(t,e),f=await o.detectOverflow(e,d),h=Aa(i),m=Ud(i),v=Mo(i)==="y",{width:_,height:y}=s.floating;let S,C;h==="top"||h==="bottom"?(S=h,C=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,S=m==="end"?"top":"bottom");const R=y-f.top-f.bottom,k=_-f.left-f.right,T=Gl(y-f[S],R),M=Gl(_-f[C],k),A=!e.middlewareData.shift;let D=T,z=M;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(D=R),A&&!m){const $=Yi(f.left,0),H=Yi(f.right,0),F=Yi(f.top,0),B=Yi(f.bottom,0);v?z=_-2*($!==0||H!==0?$+H:Yi(f.left,f.right)):D=y-2*(F!==0||B!==0?F+B:Yi(f.top,f.bottom))}await c({...e,availableWidth:z,availableHeight:D});const G=await o.getDimensions(l.floating);return _!==G.width||y!==G.height?{reset:{rects:!0}}:{}}}};function wb(){return typeof window<"u"}function Vd(t){return VL(t)?(t.nodeName||"").toLowerCase():"#document"}function Zi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Bo(t){var e;return(e=(VL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function VL(t){return wb()?t instanceof Node||t instanceof Zi(t).Node:!1}function to(t){return wb()?t instanceof Element||t instanceof Zi(t).Element:!1}function Ia(t){return wb()?t instanceof HTMLElement||t instanceof Zi(t).HTMLElement:!1}function CT(t){return!wb()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Zi(t).ShadowRoot}function op(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=no(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function IG(t){return/^(table|td|th)$/.test(Vd(t))}function Cb(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const OG=/transform|translate|scale|rotate|perspective|filter/,PG=/paint|layout|strict|content/,bc=t=>!!t&&t!=="none";let Iy;function eC(t){const e=to(t)?no(t):t;return bc(e.transform)||bc(e.translate)||bc(e.scale)||bc(e.rotate)||bc(e.perspective)||!tC()&&(bc(e.backdropFilter)||bc(e.filter))||OG.test(e.willChange||"")||PG.test(e.contain||"")}function jG(t){let e=Wl(t);for(;Ia(e)&&!Rd(e);){if(eC(e))return e;if(Cb(e))return null;e=Wl(e)}return null}function tC(){return Iy==null&&(Iy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Iy}function Rd(t){return/^(html|body|#document)$/.test(Vd(t))}function no(t){return Zi(t).getComputedStyle(t)}function Eb(t){return to(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Wl(t){if(Vd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||CT(t)&&t.host||Bo(t);return CT(e)?e.host:e}function GL(t){const e=Wl(t);return Rd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ia(e)&&op(e)?e:GL(e)}function Dh(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=GL(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=Zi(i);if(s){const l=Ax(o);return e.concat(o,o.visualViewport||[],op(i)?i:[],l&&n?Dh(l):[])}else return e.concat(i,Dh(i,[],n))}function Ax(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function WL(t){const e=no(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ia(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,l=gv(n)!==s||gv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function nC(t){return to(t)?t:t.contextElement}function pd(t){const e=nC(t);if(!Ia(e))return Oo(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=WL(e);let o=(s?gv(n.width):n.width)/r,l=(s?gv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const zG=Oo(0);function qL(t){const e=Zi(t);return!tC()||!e.visualViewport?zG:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function BG(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Zi(t)?!1:e}function $c(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=nC(t);let o=Oo(1);e&&(r?to(r)&&(o=pd(r)):o=pd(t));const l=BG(s,n,r)?qL(s):Oo(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const m=Zi(s),v=r&&to(r)?Zi(r):r;let _=m,y=Ax(_);for(;y&&r&&v!==_;){const S=pd(y),C=y.getBoundingClientRect(),R=no(y),k=C.left+(y.clientLeft+parseFloat(R.paddingLeft))*S.x,T=C.top+(y.clientTop+parseFloat(R.paddingTop))*S.y;c*=S.x,d*=S.y,f*=S.x,h*=S.y,c+=k,d+=T,_=Zi(y),y=Ax(_)}}return bv({width:f,height:h,x:c,y:d})}function kb(t,e){const n=Eb(t).scrollLeft;return e?e.left+n:$c(Bo(t)).left+n}function KL(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kb(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function $G(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Bo(r),l=e?Cb(e.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=Oo(1);const f=Oo(0),h=Ia(r);if((h||!h&&!s)&&((Vd(r)!=="body"||op(o))&&(c=Eb(r)),h)){const v=$c(r);d=pd(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const m=o&&!h&&!s?KL(o,c):Oo(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function FG(t){return Array.from(t.getClientRects())}function HG(t){const e=Bo(t),n=Eb(t),r=t.ownerDocument.body,i=Yi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Yi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+kb(t);const l=-n.scrollTop;return no(r).direction==="rtl"&&(o+=Yi(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const ET=25;function UG(t,e){const n=Zi(t),r=Bo(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const f=tC();(!f||f&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=kb(r);if(d<=0){const f=r.ownerDocument,h=f.body,m=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,_=Math.abs(r.clientWidth-h.clientWidth-v);_<=ET&&(s-=_)}else d<=ET&&(s+=d);return{width:s,height:o,x:l,y:c}}function VG(t,e){const n=$c(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Ia(t)?pd(t):Oo(1),o=t.clientWidth*s.x,l=t.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function kT(t,e,n){let r;if(e==="viewport")r=UG(t,n);else if(e==="document")r=HG(Bo(t));else if(to(e))r=VG(e,n);else{const i=qL(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return bv(r)}function YL(t,e){const n=Wl(t);return n===e||!to(n)||Rd(n)?!1:no(n).position==="fixed"||YL(n,e)}function GG(t,e){const n=e.get(t);if(n)return n;let r=Dh(t,[],!1).filter(l=>to(l)&&Vd(l)!=="body"),i=null;const s=no(t).position==="fixed";let o=s?Wl(t):t;for(;to(o)&&!Rd(o);){const l=no(o),c=eC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||op(o)&&!c&&YL(t,o))?r=r.filter(f=>f!==o):i=l,o=Wl(o)}return e.set(t,r),r}function WG(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Cb(e)?[]:GG(e,this._c):[].concat(n),r],l=kT(e,o[0],i);let c=l.top,d=l.right,f=l.bottom,h=l.left;for(let m=1;m<o.length;m++){const v=kT(e,o[m],i);c=Yi(v.top,c),d=Gl(v.right,d),f=Gl(v.bottom,f),h=Yi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function qG(t){const{width:e,height:n}=WL(t);return{width:e,height:n}}function KG(t,e,n){const r=Ia(e),i=Bo(e),s=n==="fixed",o=$c(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const c=Oo(0);function d(){c.x=kb(i)}if(r||!r&&!s)if((Vd(e)!=="body"||op(i))&&(l=Eb(e)),r){const v=$c(e,!0,s,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?KL(i,l):Oo(0),h=o.left+l.scrollLeft-c.x-f.x,m=o.top+l.scrollTop-c.y-f.y;return{x:h,y:m,width:o.width,height:o.height}}function Oy(t){return no(t).position==="static"}function RT(t,e){if(!Ia(t)||no(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Bo(t)===n&&(n=n.ownerDocument.body),n}function XL(t,e){const n=Zi(t);if(Cb(t))return n;if(!Ia(t)){let i=Wl(t);for(;i&&!Rd(i);){if(to(i)&&!Oy(i))return i;i=Wl(i)}return n}let r=RT(t,e);for(;r&&IG(r)&&Oy(r);)r=RT(r,e);return r&&Rd(r)&&Oy(r)&&!eC(r)?n:r||jG(t)||n}const YG=async function(t){const e=this.getOffsetParent||XL,n=this.getDimensions,r=await n(t.floating);return{reference:KG(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function XG(t){return no(t).direction==="rtl"}const QG={convertOffsetParentRelativeRectToViewportRelativeRect:$G,getDocumentElement:Bo,getClippingRect:WG,getOffsetParent:XL,getElementRects:YG,getClientRects:FG,getDimensions:qG,getScale:pd,isElement:to,isRTL:XG};function QL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ZG(t,e){let n=null,r;const i=Bo(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=t.getBoundingClientRect(),{left:f,top:h,width:m,height:v}=d;if(l||e(),!m||!v)return;const _=Gm(h),y=Gm(i.clientWidth-(f+m)),S=Gm(i.clientHeight-(h+v)),C=Gm(f),k={rootMargin:-_+"px "+-y+"px "+-S+"px "+-C+"px",threshold:Yi(0,Gl(1,c))||1};let T=!0;function M(A){const D=A[0].intersectionRatio;if(D!==c){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!QL(d,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(M,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(M,k)}n.observe(t)}return o(!0),s}function JG(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=nC(t),f=i||s?[...d?Dh(d):[],...e?Dh(e):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?ZG(d,n):null;let m=-1,v=null;o&&(v=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&v&&e&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=v)==null||k.observe(e)})),n()}),d&&!c&&v.observe(d),e&&v.observe(e));let _,y=c?$c(t):null;c&&S();function S(){const C=$c(t);y&&!QL(y,C)&&n(),y=C,_=requestAnimationFrame(S)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(_)}}const eW=MG,tW=NG,nW=RG,rW=DG,iW=TG,TT=kG,sW=LG,oW=(t,e,n)=>{const r=new Map,i={platform:QG,...n},s={...i.platform,_c:r};return EG(t,e,{...i,platform:s})};var aW=typeof document<"u",lW=function(){},$g=aW?x.useLayoutEffect:lW;function _v(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!_v(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!_v(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function ZL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function AT(t,e){const n=ZL(t);return Math.round(e*n)/n}function Py(t){const e=x.useRef(t);return $g(()=>{e.current=t}),e}function cW(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=t,[f,h]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,v]=x.useState(r);_v(m,r)||v(r);const[_,y]=x.useState(null),[S,C]=x.useState(null),R=x.useCallback(q=>{q!==A.current&&(A.current=q,y(q))},[]),k=x.useCallback(q=>{q!==D.current&&(D.current=q,C(q))},[]),T=s||_,M=o||S,A=x.useRef(null),D=x.useRef(null),z=x.useRef(f),G=c!=null,$=Py(c),H=Py(i),F=Py(d),B=x.useCallback(()=>{if(!A.current||!D.current)return;const q={placement:e,strategy:n,middleware:m};H.current&&(q.platform=H.current),oW(A.current,D.current,q).then(Y=>{const N={...Y,isPositioned:F.current!==!1};j.current&&!_v(z.current,N)&&(z.current=N,ks.flushSync(()=>{h(N)}))})},[m,e,n,H,F]);$g(()=>{d===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,h(q=>({...q,isPositioned:!1})))},[d]);const j=x.useRef(!1);$g(()=>(j.current=!0,()=>{j.current=!1}),[]),$g(()=>{if(T&&(A.current=T),M&&(D.current=M),T&&M){if($.current)return $.current(T,M,B);B()}},[T,M,B,$,G]);const U=x.useMemo(()=>({reference:A,floating:D,setReference:R,setFloating:k}),[R,k]),P=x.useMemo(()=>({reference:T,floating:M}),[T,M]),W=x.useMemo(()=>{const q={position:n,left:0,top:0};if(!P.floating)return q;const Y=AT(P.floating,f.x),N=AT(P.floating,f.y);return l?{...q,transform:"translate("+Y+"px, "+N+"px)",...ZL(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:N}},[n,l,P.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:B,refs:U,elements:P,floatingStyles:W}),[f,B,U,P,W])}const uW=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TT({element:r.current,padding:i}).fn(n):{}:r?TT({element:r,padding:i}).fn(n):{}}}},dW=(t,e)=>{const n=eW(t);return{name:n.name,fn:n.fn,options:[t,e]}},fW=(t,e)=>{const n=tW(t);return{name:n.name,fn:n.fn,options:[t,e]}},hW=(t,e)=>({fn:sW(t).fn,options:[t,e]}),pW=(t,e)=>{const n=nW(t);return{name:n.name,fn:n.fn,options:[t,e]}},mW=(t,e)=>{const n=rW(t);return{name:n.name,fn:n.fn,options:[t,e]}},gW=(t,e)=>{const n=iW(t);return{name:n.name,fn:n.fn,options:[t,e]}},vW=(t,e)=>{const n=uW(t);return{name:n.name,fn:n.fn,options:[t,e]}};var bW="Arrow",JL=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return g.jsx(Kt.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});JL.displayName=bW;var _W=JL;function yW(t){const[e,n]=x.useState(void 0);return ti(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var rC="Popper",[eD,Kl]=Da(rC),[xW,tD]=eD(rC),nD=t=>{const{__scopePopper:e,children:n}=t,[r,i]=x.useState(null);return g.jsx(xW,{scope:e,anchor:r,onAnchorChange:i,children:n})};nD.displayName=rC;var rD="PopperAnchor",iD=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=tD(rD,n),o=x.useRef(null),l=on(e,o),c=x.useRef(null);return x.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:g.jsx(Kt.div,{...i,ref:l})});iD.displayName=rD;var iC="PopperContent",[SW,wW]=eD(iC),sD=x.forwardRef((t,e)=>{var oe,ie,ue,fe,de,Z;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:v="optimized",onPlaced:_,...y}=t,S=tD(iC,n),[C,R]=x.useState(null),k=on(e,ne=>R(ne)),[T,M]=x.useState(null),A=yW(T),D=(A==null?void 0:A.width)??0,z=(A==null?void 0:A.height)??0,G=r+(s!=="center"?"-"+s:""),$=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},H=Array.isArray(d)?d:[d],F=H.length>0,B={padding:$,boundary:H.filter(EW),altBoundary:F},{refs:j,floatingStyles:U,placement:P,isPositioned:W,middlewareData:q}=cW({strategy:"fixed",placement:G,whileElementsMounted:(...ne)=>JG(...ne,{animationFrame:v==="always"}),elements:{reference:S.anchor},middleware:[dW({mainAxis:i+z,alignmentAxis:o}),c&&fW({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?hW():void 0,...B}),c&&pW({...B}),mW({...B,apply:({elements:ne,rects:ae,availableWidth:Q,availableHeight:xe})=>{const{width:le,height:Te}=ae.reference,Le=ne.floating.style;Le.setProperty("--radix-popper-available-width",`${Q}px`),Le.setProperty("--radix-popper-available-height",`${xe}px`),Le.setProperty("--radix-popper-anchor-width",`${le}px`),Le.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),T&&vW({element:T,padding:l}),kW({arrowWidth:D,arrowHeight:z}),m&&gW({strategy:"referenceHidden",...B})]}),[Y,N]=lD(P),I=eo(_);ti(()=>{W&&(I==null||I())},[W,I]);const V=(oe=q.arrow)==null?void 0:oe.x,L=(ie=q.arrow)==null?void 0:ie.y,J=((ue=q.arrow)==null?void 0:ue.centerOffset)!==0,[te,ee]=x.useState();return ti(()=>{C&&ee(window.getComputedStyle(C).zIndex)},[C]),g.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:W?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(fe=q.transformOrigin)==null?void 0:fe.x,(de=q.transformOrigin)==null?void 0:de.y].join(" "),...((Z=q.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(SW,{scope:n,placedSide:Y,onArrowChange:M,arrowX:V,arrowY:L,shouldHideArrow:J,children:g.jsx(Kt.div,{"data-side":Y,"data-align":N,...y,ref:k,style:{...y.style,animation:W?void 0:"none"}})})})});sD.displayName=iC;var oD="PopperArrow",CW={top:"bottom",right:"left",bottom:"top",left:"right"},aD=x.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=wW(oD,r),o=CW[s.placedSide];return g.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g.jsx(_W,{...i,ref:n,style:{...i.style,display:"block"}})})});aD.displayName=oD;function EW(t){return t!==null}var kW=t=>({name:"transformOrigin",options:t,fn(e){var S,C,R;const{placement:n,rects:r,middlewareData:i}=e,o=((S=i.arrow)==null?void 0:S.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[d,f]=lD(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((R=i.arrow)==null?void 0:R.y)??0)+c/2;let _="",y="";return d==="bottom"?(_=o?h:`${m}px`,y=`${-c}px`):d==="top"?(_=o?h:`${m}px`,y=`${r.floating.height+c}px`):d==="right"?(_=`${-c}px`,y=o?h:`${v}px`):d==="left"&&(_=`${r.floating.width+c}px`,y=o?h:`${v}px`),{data:{x:_,y}}}});function lD(t){const[e,n="center"]=t.split("-");return[e,n]}var Rb=nD,ap=iD,Tb=sD,Ab=aD,cD=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),RW="VisuallyHidden",uD=x.forwardRef((t,e)=>g.jsx(Kt.span,{...t,ref:e,style:{...cD,...t.style}}));uD.displayName=RW;var TW=uD,[Mb,Wye]=Da("Tooltip",[Kl]),Nb=Kl(),dD="TooltipProvider",AW=700,Mx="tooltip.open",[MW,sC]=Mb(dD),fD=t=>{const{__scopeTooltip:e,delayDuration:n=AW,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=x.useRef(!0),l=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),g.jsx(MW,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};fD.displayName=dD;var Ih="Tooltip",[NW,lp]=Mb(Ih),hD=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=t,c=sC(Ih,t.__scopeTooltip),d=Nb(e),[f,h]=x.useState(null),m=ka(),v=x.useRef(0),_=o??c.disableHoverableContent,y=l??c.delayDuration,S=x.useRef(!1),[C,R]=kd({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(Mx))):c.onClose(),s==null||s(D)},caller:Ih}),k=x.useMemo(()=>C?S.current?"delayed-open":"instant-open":"closed",[C]),T=x.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S.current=!1,R(!0)},[R]),M=x.useCallback(()=>{window.clearTimeout(v.current),v.current=0,R(!1)},[R]),A=x.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{S.current=!0,R(!0),v.current=0},y)},[y,R]);return x.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),g.jsx(Rb,{...d,children:g.jsx(NW,{scope:e,contentId:m,open:C,stateAttribute:k,trigger:f,onTriggerChange:h,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?A():T()},[c.isOpenDelayedRef,A,T]),onTriggerLeave:x.useCallback(()=>{_?M():(window.clearTimeout(v.current),v.current=0)},[M,_]),onOpen:T,onClose:M,disableHoverableContent:_,children:n})})};hD.displayName=Ih;var Nx="TooltipTrigger",pD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=lp(Nx,n),s=sC(Nx,n),o=Nb(n),l=x.useRef(null),c=on(e,l,i.onTriggerChange),d=x.useRef(!1),f=x.useRef(!1),h=x.useCallback(()=>d.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),g.jsx(ap,{asChild:!0,...o,children:g.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:lt(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:lt(t.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:lt(t.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:lt(t.onFocus,()=>{d.current||i.onOpen()}),onBlur:lt(t.onBlur,i.onClose),onClick:lt(t.onClick,i.onClose)})})});pD.displayName=Nx;var oC="TooltipPortal",[LW,DW]=Mb(oC,{forceMount:void 0}),mD=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=lp(oC,e);return g.jsx(LW,{scope:e,forceMount:n,children:g.jsx(Ls,{present:n||s.open,children:g.jsx(Hd,{asChild:!0,container:i,children:r})})})};mD.displayName=oC;var Td="TooltipContent",gD=x.forwardRef((t,e)=>{const n=DW(Td,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=lp(Td,t.__scopeTooltip);return g.jsx(Ls,{present:r||o.open,children:o.disableHoverableContent?g.jsx(vD,{side:i,...s,ref:e}):g.jsx(IW,{side:i,...s,ref:e})})}),IW=x.forwardRef((t,e)=>{const n=lp(Td,t.__scopeTooltip),r=sC(Td,t.__scopeTooltip),i=x.useRef(null),s=on(e,i),[o,l]=x.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,m=x.useCallback(()=>{l(null),h(!1)},[h]),v=x.useCallback((_,y)=>{const S=_.currentTarget,C={x:_.clientX,y:_.clientY},R=BW(C,S.getBoundingClientRect()),k=$W(C,R),T=FW(y.getBoundingClientRect()),M=UW([...k,...T]);l(M),h(!0)},[h]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&f){const _=S=>v(S,f),y=S=>v(S,c);return c.addEventListener("pointerleave",_),f.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",_),f.removeEventListener("pointerleave",y)}}},[c,f,v,m]),x.useEffect(()=>{if(o){const _=y=>{const S=y.target,C={x:y.clientX,y:y.clientY},R=(c==null?void 0:c.contains(S))||(f==null?void 0:f.contains(S)),k=!HW(C,o);R?m():k&&(m(),d())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[c,f,o,d,m]),g.jsx(vD,{...t,ref:s})}),[OW,PW]=Mb(Ih,{isInside:!1}),jW=IU("TooltipContent"),vD=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=t,c=lp(Td,n),d=Nb(n),{onClose:f}=c;return x.useEffect(()=>(document.addEventListener(Mx,f),()=>document.removeEventListener(Mx,f)),[f]),x.useEffect(()=>{if(c.trigger){const h=m=>{const v=m.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),g.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:g.jsxs(Tb,{"data-state":c.stateAttribute,...d,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(jW,{children:r}),g.jsx(OW,{scope:n,isInside:!0,children:g.jsx(TW,{id:c.contentId,role:"tooltip",children:i||r})})]})})});gD.displayName=Td;var bD="TooltipArrow",zW=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=Nb(n);return PW(bD,n).isInside?null:g.jsx(Ab,{...i,...r,ref:e})});zW.displayName=bD;function BW(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function $W(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function FW(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function HW(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const l=e[s],c=e[o],d=l.x,f=l.y,h=c.x,m=c.y;f>r!=m>r&&n<(h-d)*(r-f)/(m-f)+d&&(i=!i)}return i}function UW(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),VW(e)}function VW(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var GW=fD,_D=hD,yD=pD,xD=mD,aC=gD;function WW(t){const e=ke.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=g.jsx("kbd",{className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function qW(t){const e=ke.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("inline-flex items-center gap-0.5",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=g.jsx("span",{className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}const KW="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",YW=GW,Ks=_D,Ys=yD,Xs=x.forwardRef((t,e)=>{const n=ke.c(11);let r,i,s;n[0]!==t?({className:r,sideOffset:s,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=s):(r=n[1],i=n[2],s=n[3]);const o=s===void 0?4:s;let l;n[4]!==r?(l=we("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border backdrop-blur-md px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",r),n[4]=r,n[5]=l):l=n[5];let c;return n[6]!==i||n[7]!==e||n[8]!==o||n[9]!==l?(c=g.jsx(xD,{children:g.jsx(aC,{ref:e,sideOffset:o,className:l,...i})}),n[6]=i,n[7]=e,n[8]=o,n[9]=l,n[10]=c):c=n[10],c});Xs.displayName=aC.displayName;const lh=_D,ch=yD;function SD(t){return t.toUpperCase()}function XW(t){const e=t.split("+");return g.jsx(qW,{children:e.map((n,r)=>g.jsx(WW,{children:SD(n)},`${n}-${r}`))})}const Mc=x.forwardRef((t,e)=>{const n=ke.c(17);let r,i,s,o,l;n[0]!==t?({className:i,sideOffset:l,children:r,shortcut:o,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=s,n[4]=o,n[5]=l):(r=n[1],i=n[2],s=n[3],o=n[4],l=n[5]);const c=l===void 0?4:l,d=o===void 0?null:Array.isArray(o)?o[0]??null:o;let f;n[6]!==i?(f=we(KW,i),n[6]=i,n[7]=f):f=n[7];let h;n[8]!==r||n[9]!==d?(h=d?XW(d):g.jsx("span",{children:typeof r=="string"?SD(r):r}),n[8]=r,n[9]=d,n[10]=h):h=n[10];let m;return n[11]!==s||n[12]!==e||n[13]!==c||n[14]!==f||n[15]!==h?(m=g.jsx(xD,{children:g.jsx(aC,{ref:e,sideOffset:c,className:f,...s,children:h})}),n[11]=s,n[12]=e,n[13]=c,n[14]=f,n[15]=h,n[16]=m):m=n[16],m});Mc.displayName="HotkeyTooltipContent";const QW="0.8.1",ZW={version:QW},Qs="Kaizen",MT="kaizen",JW=".kaizen",eq=".kaizen-dev",qye=".kaizen",tq="KAIZEN_RUNTIME_PROFILE",nq=`kaizen/${ZW.version}`,rq="[kaizen]",Kye=`~/${Qs}`,lC="kaizen:";function Zc(){var e;return(e=globalThis.process)==null?void 0:e.env}function iq(t=Zc()){const e=t==null?void 0:t[tq];return(e==null?void 0:e.trim().toLowerCase())==="dev"?"dev":"prod"}function sq(t=Zc()){return iq(t)==="dev"?eq:JW}function cC(t=Zc()){return`~/${sq(t)}`}function Yye(t=Zc()){return`${cC(t)}/keybindings.json`}function oq(t=Zc()){return`${cC(t)}/themes`}function aq(t=Zc()){return`${oq(t)}/THEME_README.md`}function Xye(t=Zc()){return`${cC(t)}/general.json`}function Qye(t){return t?`${MT} ${t}`:MT}function lq(t){return t==="claude"||t==="codex"||t==="gemini"||t==="cursor"||t==="openrouter"}function cq(t){return lq(t)?t:null}const yv=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],Lx=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Dx=[{id:"off",label:"Off"},{id:"standard",label:"Standard"},{id:"high",label:"High"}],Ix="claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",wD=[{id:"composer-2[fast=true]",label:"Composer 2",supportsEffort:!1},{id:"composer-1.5[]",label:"Composer 1.5",supportsEffort:!1},{id:"gpt-5.3-codex[reasoning=medium,fast=false]",label:"Codex 5.3",supportsEffort:!1},{id:"gpt-5.4[reasoning=medium,context=272k,fast=false]",label:"GPT-5.4",supportsEffort:!1},{id:"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]",label:"Sonnet 4.6",supportsEffort:!1},{id:"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]",label:"Opus 4.6",supportsEffort:!1},{id:"claude-opus-4-5[thinking=true]",label:"Opus 4.5",supportsEffort:!1},{id:"gpt-5.2[reasoning=medium,fast=false]",label:"GPT-5.2",supportsEffort:!1},{id:"gemini-3.1-pro[]",label:"Gemini 3.1 Pro",supportsEffort:!1},{id:"gpt-5.4-mini[reasoning=medium]",label:"GPT-5.4 Mini",supportsEffort:!1},{id:"gpt-5.4-nano[reasoning=medium]",label:"GPT-5.4 Nano",supportsEffort:!1},{id:"claude-haiku-4-5[thinking=true]",label:"Haiku 4.5",supportsEffort:!1},{id:"gpt-5.3-codex-spark[reasoning=medium]",label:"Codex 5.3 Spark",supportsEffort:!1},{id:"grok-4-20[thinking=true]",label:"Grok 4.20",supportsEffort:!1},{id:"claude-sonnet-4-5[thinking=true,context=200k]",label:"Sonnet 4.5",supportsEffort:!1},{id:"gpt-5.2-codex[reasoning=medium,fast=false]",label:"Codex 5.2",supportsEffort:!1},{id:"gemini-3-flash[]",label:"Gemini 3 Flash",supportsEffort:!1},{id:"claude-sonnet-4[thinking=false,context=200k]",label:"Sonnet 4",supportsEffort:!1},{id:"kimi-k2.5[]",label:"Kimi K2.5",supportsEffort:!1}],uq={"composer-2-fast":"composer-2[fast=true]","composer-1.5":"composer-1.5[]","gpt-5.3-codex":"gpt-5.3-codex[reasoning=medium,fast=false]","gpt-5.4":"gpt-5.4[reasoning=medium,context=272k,fast=false]","gpt-5.4-medium":"gpt-5.4[reasoning=medium,context=272k,fast=false]","claude-4.6-sonnet-medium-thinking":"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]","claude-4.6-opus-high-thinking":"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]","claude-4.5-opus-high-thinking":"claude-opus-4-5[thinking=true]","gpt-5.2":"gpt-5.2[reasoning=medium,fast=false]","gemini-3.1-pro":"gemini-3.1-pro[]","gpt-5.4-mini":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-mini-medium":"gpt-5.4-mini[reasoning=medium]","gpt-5.4-nano":"gpt-5.4-nano[reasoning=medium]","gpt-5.4-nano-medium":"gpt-5.4-nano[reasoning=medium]","claude-haiku-4.5":"claude-haiku-4-5[thinking=true]","gpt-5.3-codex-spark-preview":"gpt-5.3-codex-spark[reasoning=medium]","grok-4-20":"grok-4-20[thinking=true]","grok-4-20-thinking":"grok-4-20[thinking=true]","claude-4.5-sonnet-thinking":"claude-sonnet-4-5[thinking=true,context=200k]","gpt-5.2-codex":"gpt-5.2-codex[reasoning=medium,fast=false]","gemini-3-flash":"gemini-3-flash[]","claude-4-sonnet":"claude-sonnet-4[thinking=false,context=200k]","kimi-k2.5":"kimi-k2.5[]"};function dq(t){return t?wD.some(e=>e.id===t)?t:uq[t]??Ix:Ix}function NT(t){const e=t.indexOf("[");return e>=0?t.slice(0,e):t}function Gd(t){const e=t.match(/\bfast=(true|false)\b/);return e?e[1]==="true"?"fast":"standard":null}function LT(t){return yv.some(e=>e.id===t)}function DT(t){return Lx.some(e=>e.id===t)}const Ox=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}];function fq(t){return Dx.some(e=>e.id===t)}const hq={image:!0,markdown:!0,document:!0},pq={image:!0,markdown:!0,document:!1},mq={image:!0,markdown:!0,document:!0},gq={image:!0,markdown:!0,document:!0},vq={image:!0,markdown:!0,document:!0},Zye=16*1024,Jye=1024*1024,bq=200*1024,e1e={sendChunkSizeBytes:bq},_q={openrouter:"account",providerUsage:"account",handoff:"account",remoteRelay:"paid",browserNotifications:"paid",installMobilePush:"paid",syncedSettings:"paid",syncedKeybindings:"paid",syncedHandoffs:"paid",crossDeviceStorage:"paid"},Jc=[{id:"claude",label:"Claude",systemActive:!0,defaultModel:"sonnet",defaultEffort:"high",defaultModelOptions:{reasoningEffort:"high",contextWindow:"200k"},supportsPlanMode:!0,attachmentCapabilities:hq,models:[{id:"opus",label:"Opus",supportsEffort:!0,contextWindowOptions:[...Ox]},{id:"sonnet",label:"Sonnet",supportsEffort:!0,contextWindowOptions:[...Ox]},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...yv]},{id:"codex",label:"Codex",systemActive:!0,defaultModel:"gpt-5.4",defaultModelOptions:{reasoningEffort:"high",fastMode:!1},supportsPlanMode:!0,attachmentCapabilities:pq,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]},{id:"gemini",label:"Gemini",systemActive:!1,defaultModel:"auto-gemini-2.5",defaultModelOptions:{thinkingMode:"standard"},supportsPlanMode:!0,attachmentCapabilities:mq,models:[{id:"auto-gemini-3",label:"Auto (Gemini 3)",supportsEffort:!1},{id:"auto-gemini-2.5",label:"Auto (Gemini 2.5)",supportsEffort:!1},{id:"gemini-3.1-pro-preview",label:"3.1 Pro Preview",supportsEffort:!1},{id:"gemini-3-pro-preview",label:"3 Pro Preview",supportsEffort:!1},{id:"gemini-3-flash-preview",label:"3 Flash Preview",supportsEffort:!1},{id:"gemini-2.5-pro",label:"2.5 Pro",supportsEffort:!1},{id:"gemini-2.5-flash",label:"2.5 Flash",supportsEffort:!1},{id:"gemini-2.5-flash-lite",label:"2.5 Flash Lite",supportsEffort:!1}],efforts:[]},{id:"cursor",label:"Cursor",systemActive:!0,defaultModel:Ix,defaultModelOptions:{},supportsPlanMode:!0,attachmentCapabilities:gq,models:[...wD],efforts:[]},{id:"openrouter",label:"OpenRouter",systemActive:!0,defaultModel:"opencode/big-pickle",defaultModelOptions:{},supportsPlanMode:!0,attachmentCapabilities:vq,models:[{id:"opencode/big-pickle",label:"Big Pickle",supportsEffort:!1},{id:"opencode/gpt-5-nano",label:"GPT-5 Nano",supportsEffort:!1},{id:"opencode/mimo-v2-omni-free",label:"MiMo V2 Omni Free",supportsEffort:!1},{id:"opencode/mimo-v2-pro-free",label:"MiMo V2 Pro Free",supportsEffort:!1},{id:"opencode/minimax-m2.5-free",label:"MiniMax M2.5 Free",supportsEffort:!1},{id:"opencode/nemotron-3-super-free",label:"Nemotron 3 Super Free",supportsEffort:!1},{id:"opencode/qwen3.6-plus-free",label:"Qwen3.6 Plus Free",supportsEffort:!1},{id:"openrouter/anthropic/claude-sonnet-4",label:"Claude Sonnet 4",supportsEffort:!1},{id:"openrouter/anthropic/claude-opus-4",label:"Claude Opus 4",supportsEffort:!1},{id:"openrouter/openai/gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"openrouter/google/gemini-2.5-pro",label:"Gemini 2.5 Pro",supportsEffort:!1},{id:"openrouter/deepseek/deepseek-r1",label:"DeepSeek R1",supportsEffort:!1},{id:"openrouter/meta-llama/llama-4-maverick",label:"Llama 4 Maverick",supportsEffort:!1}],efforts:[]}],xv={claude:{active:!0},codex:{active:!0},gemini:{active:!0},cursor:{active:!0},openrouter:{active:!1}};function cr(t,e=Jc){const n=e.find(r=>r.id===t);if(!n)throw new Error(`Unknown provider: ${t}`);return n}function Lb(t,e){const n=e?t.models.find(r=>r.id===e):void 0;return(n==null?void 0:n.attachmentCapabilities)??t.attachmentCapabilities}function uC(t,e){const n=xv[e],r=t==null?void 0:t[e];return{active:(r==null?void 0:r.active)??n.active}}function yq(t,e,n=Jc){var s;const r=cr(t,n),i=uC(e,t);return r.systemActive&&i.active?null:!r.systemActive&&((s=r.availabilityMessage)!=null&&s.trim())?r.availabilityMessage:`Provider ${r.label} is currently not active.`}function xq(t,e,n=Jc){const r=cr(t,n),i=uC(e,t);return r.systemActive&&i.active}function Sq(t,e){return t.map(n=>{const r=uC(e,n.id),i=n.systemActive&&r.active;return{...n,active:r.active,isSelectable:i,isUsageEnabled:i,isInactive:!i,inactiveMessage:yq(n.id,e,t)}})}function wq(t,e){return Sq(t,e).filter(n=>n.isSelectable).map(({active:n,isSelectable:r,isUsageEnabled:i,isInactive:s,inactiveMessage:o,...l})=>l)}function CD(t){return wq(Jc,t)}function di(t){return cr(t).defaultModelOptions}const ED=di("claude");di("codex");di("gemini");di("cursor");di("openrouter");function Cq(t){return cr("claude").models.find(e=>e.id===t)}function Eq(t){var e;return((e=Cq(t))==null?void 0:e.contextWindowOptions)??[]}function kq(t,e){const n=Eq(t);if(n.length!==0)return n.some(r=>r.id===e)?e:ED.contextWindow}const Rq=["idea","todo","progress","testing","done"],IT={idea:"IDEA",todo:"TODO",progress:"PROGRESS",testing:"TESTING",done:"DONE"},va={submitChatMessage:["enter"],toggleQuickPrompts:["cmd+e","ctrl+e"],toggleProjectsSidebar:["ctrl+a"],toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]},Sv=8,kD=10*1024*1024,Tq=20*1024*1024,Aq=1*1024*1024,wv=["image/png","image/jpeg","image/webp","image/gif"],RD=["application/pdf"],TD=["text/markdown","text/x-markdown"],Mq="/assets/icon-4rSnra9R.svg";function md(t){const e=ke.c(10);let n,r,i;e[0]!==t?({alt:i,className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);const s=i===void 0?"":i;let o;e[4]!==n?(o=we("shrink-0 object-contain",n),e[4]=n,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==r||e[8]!==o?(l=g.jsx("img",{alt:s,src:Mq,className:o,...r}),e[6]=s,e[7]=r,e[8]=o,e[9]=l):l=e[9],l}var Db="Popover",[AD,t1e]=Da(Db,[Kl]),cp=Kl(),[Nq,Yl]=AD(Db),MD=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,l=cp(e),c=x.useRef(null),[d,f]=x.useState(!1),[h,m]=kd({prop:r,defaultProp:i??!1,onChange:s,caller:Db});return g.jsx(Rb,{...l,children:g.jsx(Nq,{scope:e,contentId:ka(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(v=>!v),[m]),hasCustomAnchor:d,onCustomAnchorAdd:x.useCallback(()=>f(!0),[]),onCustomAnchorRemove:x.useCallback(()=>f(!1),[]),modal:o,children:n})})};MD.displayName=Db;var ND="PopoverAnchor",LD=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Yl(ND,n),s=cp(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=i;return x.useEffect(()=>(o(),()=>l()),[o,l]),g.jsx(ap,{...s,...r,ref:e})});LD.displayName=ND;var DD="PopoverTrigger",ID=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Yl(DD,n),s=cp(n),o=on(e,i.triggerRef),l=g.jsx(Kt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":BD(i.open),...r,ref:o,onClick:lt(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:g.jsx(ap,{asChild:!0,...s,children:l})});ID.displayName=DD;var dC="PopoverPortal",[Lq,Dq]=AD(dC,{forceMount:void 0}),OD=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=Yl(dC,e);return g.jsx(Lq,{scope:e,forceMount:n,children:g.jsx(Ls,{present:n||s.open,children:g.jsx(Hd,{asChild:!0,container:i,children:r})})})};OD.displayName=dC;var Ad="PopoverContent",PD=x.forwardRef((t,e)=>{const n=Dq(Ad,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=Yl(Ad,t.__scopePopover);return g.jsx(Ls,{present:r||s.open,children:s.modal?g.jsx(Oq,{...i,ref:e}):g.jsx(Pq,{...i,ref:e})})});PD.displayName=Ad;var Iq=zc("PopoverContent.RemoveScroll"),Oq=x.forwardRef((t,e)=>{const n=Yl(Ad,t.__scopePopover),r=x.useRef(null),i=on(e,r),s=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return bb(o)},[]),g.jsx(ip,{as:Iq,allowPinchZoom:!0,children:g.jsx(jD,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:lt(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:lt(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:lt(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pq=x.forwardRef((t,e)=>{const n=Yl(Ad,t.__scopePopover),r=x.useRef(!1),i=x.useRef(!1);return g.jsx(jD,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,d;(c=t.onInteractOutside)==null||c.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),jD=x.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Yl(Ad,n),v=cp(n);return gb(),g.jsx(rp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:g.jsx(Tb,{"data-state":BD(m.open),role:"dialog",id:m.contentId,...v,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),zD="PopoverClose",jq=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Yl(zD,n);return g.jsx(Kt.button,{type:"button",...r,ref:e,onClick:lt(t.onClick,()=>i.onOpenChange(!1))})});jq.displayName=zD;var zq="PopoverArrow",Bq=x.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=cp(n);return g.jsx(Ab,{...i,...r,ref:e})});Bq.displayName=zq;function BD(t){return t?"open":"closed"}var $D=MD,$q=LD,Fq=ID,FD=OD,fC=PD;const hC=$D,pC=Fq,Ib=x.forwardRef((t,e)=>{const n=ke.c(17);let r,i,s,o;n[0]!==t?({className:r,align:s,sideOffset:o,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=s,n[4]=o):(r=n[1],i=n[2],s=n[3],o=n[4]);const l=s===void 0?"center":s,c=o===void 0?4:o;let d;n[5]===Symbol.for("react.memo_cache_sentinel")?(d={[Lh]:""},n[5]=d):d=n[5];let f;n[6]!==i?(f=v=>{var _;v.preventDefault(),window.dispatchEvent(new Event(pv)),(_=i.onCloseAutoFocus)==null||_.call(i,v)},n[6]=i,n[7]=f):f=n[7];let h;n[8]!==r?(h=we("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",r),n[8]=r,n[9]=h):h=n[9];let m;return n[10]!==l||n[11]!==i||n[12]!==e||n[13]!==c||n[14]!==f||n[15]!==h?(m=g.jsx(FD,{children:g.jsx(fC,{ref:e,align:l,sideOffset:c,...d,onCloseAutoFocus:f,className:h,...i})}),n[10]=l,n[11]=i,n[12]=e,n[13]=c,n[14]=f,n[15]=h,n[16]=m):m=n[16],m});Ib.displayName=fC.displayName;function Hq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Uq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Vq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M12 0C12 0 12 8 8 12C4 16 0 12 0 12C0 12 4 12 8 12C12 12 12 16 12 24C12 24 12 16 16 12C20 8 24 12 24 12C24 12 16 12 16 12C12 12 12 4 12 0Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Gq(t){const e=ke.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M12 0 2.4 5.5v13L12 24l9.6-5.5v-13Zm0 3.1 6.8 3.9v5.1L15 14.3V9.7L12 8l-3 1.7v4.6l-3.8-2.2V7Zm-6.8 9.8 3.8 2.2v4.5l3 1.8 3-1.8v-4.5l3.8-2.2v3.8L12 20.9l-6.8-3.9Z"}),e[5]=s):s=e[5];let o;return e[6]!==r||e[7]!==i?(o=g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:i,...r,children:s}),e[6]=r,e[7]=i,e[8]=o):o=e[8],o}function Wq(t){const e=ke.c(11);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=we("shrink-0",n),e[3]=n,e[4]=i):i=e[4];let s,o,l;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("path",{d:"M12 2.75c2.83 0 5.14 2.28 5.19 5.1l1.72.99A7.25 7.25 0 0 0 5.4 13.45l-1.7.98A9.25 9.25 0 0 1 12 2.75Z",fill:"currentColor"}),o=g.jsx("path",{d:"M19.34 8.2a9.25 9.25 0 0 1-3.4 12.65 9.2 9.2 0 0 1-5.22 1.25v-1.98a7.24 7.24 0 0 0 7.25-12.56l1.37.64Z",fill:"currentColor",opacity:".8"}),l=g.jsx("path",{d:"M8.4 21.02A9.26 9.26 0 0 1 3.3 9.58l1.72.99A7.24 7.24 0 0 0 15.9 18.8l-.02 1.58a9.2 9.2 0 0 1-7.48.64Z",fill:"currentColor",opacity:".6"}),e[5]=s,e[6]=o,e[7]=l):(s=e[5],o=e[6],l=e[7]);let c;return e[8]!==r||e[9]!==i?(c=g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:i,...r,children:[s,o,l]}),e[8]=r,e[9]=i,e[10]=c):c=e[10],c}function qq(t){return!(t.startsWith("gemini-3")||t==="auto-gemini-3")}const Kq=["Composer","GPT","Claude","Gemini","Grok","Kimi"];function Yq(t){return t.startsWith("composer-")?"Composer":t.startsWith("gpt-")?"GPT":t.startsWith("claude-")?"Claude":t.startsWith("gemini-")?"Gemini":t.startsWith("grok-")?"Grok":"Kimi"}function OT(t){return{Standard:"Std","Fast Mode":"Fast",Medium:"Med",Minimal:"Min",XHigh:"XHi"}[t]??t}function jy(t,e){const n=Gd(e);return!n||n==="standard"?t:`${t} (${n==="fast"?"Fast":"Standard"})`}const Cv={claude:Hq,codex:Uq,gemini:Vq,cursor:Gq,openrouter:Wq},Wm={auto:Sn,opus:ir,sonnet:Sn,haiku:ui,"gpt-5.4":ir,"gpt-5.4[reasoning=medium,context=272k,fast=false]":ir,"gpt-5.4-mini[reasoning=medium]":Sn,"gpt-5.4-nano[reasoning=medium]":ui,"gpt-5.3-codex":Sn,"gpt-5.3-codex[reasoning=medium,fast=false]":Sn,"gpt-5.3-codex-spark[reasoning=medium]":ui,"gpt-5.2[reasoning=medium,fast=false]":Sn,"gpt-5.2-codex[reasoning=medium,fast=false]":Sn,"gpt-5.3-codex-spark":ui,"gemini-2.5-pro":ir,"gemini-2.5-flash":Sn,"gemini-2.5-flash-lite":ui,"auto-gemini-3":ir,"auto-gemini-2.5":Sn,"gemini-3.1-pro-preview":ir,"gemini-3.1-pro[]":ir,"gemini-3-flash[]":Sn,"gemini-3-pro-preview":ir,"gemini-3-flash-preview":Sn,"claude-opus-4-6[thinking=true,context=200k,effort=high,fast=false]":ir,"claude-opus-4-5[thinking=true]":ir,"claude-sonnet-4-6[thinking=true,context=200k,effort=medium]":Sn,"claude-sonnet-4-5[thinking=true,context=200k]":Sn,"claude-sonnet-4[thinking=false,context=200k]":Sn,"claude-haiku-4-5[thinking=true]":ui,"opencode/big-pickle":ir,"opencode/gpt-5-nano":ui,"opencode/mimo-v2-omni-free":Sn,"opencode/mimo-v2-pro-free":Sn,"opencode/minimax-m2.5-free":Sn,"opencode/nemotron-3-super-free":ir,"opencode/qwen3.6-plus-free":ir,"openrouter/anthropic/claude-sonnet-4":Sn,"openrouter/anthropic/claude-opus-4":ir,"openrouter/openai/gpt-5.4":ir,"openrouter/google/gemini-2.5-pro":ir,"openrouter/deepseek/deepseek-r1":ir,"openrouter/meta-llama/llama-4-maverick":Sn,"grok-4-20[thinking=true]":ir,"kimi-k2.5[]":Sn,"composer-2[fast=true]":ir,"composer-1.5[]":Sn};function ki(t){const e=ke.c(16),{onClick:n,selected:r,icon:i,label:s,description:o,disabled:l}=t,c=r?"bg-muted border-border":"hover:opacity-60",d=l&&"opacity-40 cursor-not-allowed";let f;e[0]!==c||e[1]!==d?(f=we("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",c,d),e[0]=c,e[1]=d,e[2]=f):f=e[2];let h;e[3]!==s?(h=g.jsx("div",{className:"text-sm font-medium",children:s}),e[3]=s,e[4]=h):h=e[4];let m;e[5]!==o?(m=o?g.jsx("div",{className:"text-xs text-muted-foreground",children:o}):null,e[5]=o,e[6]=m):m=e[6];let v;e[7]!==h||e[8]!==m?(v=g.jsxs("div",{children:[h,m]}),e[7]=h,e[8]=m,e[9]=v):v=e[9];let _;return e[10]!==l||e[11]!==i||e[12]!==n||e[13]!==f||e[14]!==v?(_=g.jsxs("button",{onClick:n,disabled:l,className:f,children:[i,v]}),e[10]=l,e[11]=i,e[12]=n,e[13]=f,e[14]=v,e[15]=_):_=e[15],_}function bl(t){const e=ke.c(18),{trigger:n,triggerClassName:r,disabled:i,children:s}=t,o=i===void 0?!1:i,[l,c]=x.useState(!1);if(o){let _;e[0]!==r?(_=we("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",r),e[0]=r,e[1]=_):_=e[1];let y;return e[2]!==_||e[3]!==n?(y=g.jsx("button",{disabled:!0,className:_,children:n}),e[2]=_,e[3]=n,e[4]=y):y=e[4],y}let d;e[5]!==r?(d=we("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",r),e[5]=r,e[6]=d):d=e[6];let f;e[7]!==d||e[8]!==n?(f=g.jsx(pC,{asChild:!0,children:g.jsx("button",{className:d,children:n})}),e[7]=d,e[8]=n,e[9]=f):f=e[9];let h;e[10]!==s?(h=typeof s=="function"?s(()=>c(!1)):s,e[10]=s,e[11]=h):h=e[11];let m;e[12]!==h?(m=g.jsx(Ib,{align:"center",className:"w-64 p-1",children:g.jsx("div",{className:"max-h-[min(24rem,60vh)] space-y-1 overflow-y-auto pr-1",children:h})}),e[12]=h,e[13]=m):m=e[13];let v;return e[14]!==l||e[15]!==f||e[16]!==m?(v=g.jsxs(hC,{open:l,onOpenChange:c,children:[f,m]}),e[14]=l,e[15]=f,e[16]=m,e[17]=v):v=e[17],v}function Xq(t){var dt,vt,he,Re,Oe,Ve,Fe;const e=ke.c(38),{availableProviders:n,selectedProvider:r,lockedProviders:i,disabled:s,showProviderPicker:o,providerLocked:l,model:c,modelOptions:d,onProviderChange:f,onModelChange:h,onClaudeReasoningEffortChange:m,onClaudeContextWindowChange:v,onCodexReasoningEffortChange:_,onGeminiThinkingModeChange:y,onCodexFastModeChange:S,planMode:C,onPlanModeChange:R,pendingPlanMode:k,includePlanMode:T,className:M}=t,A=s===void 0?!1:s,D=o===void 0?!0:o,z=l===void 0?!1:l,G=C===void 0?!1:C,$=k===void 0?null:k,H=T===void 0?!0:T,[F,B]=x.useState(null),j=n.find(We=>We.id===r)??cr(r),U=Cv[r],P=Wm[c]??Sn,W=H&&(j==null?void 0:j.supportsPlanMode)&&R,q=$??G,Y=$!==null,N=r==="claude"?d:null,I=r==="codex"?d:null,V=r==="gemini"?d:null,L=((dt=j.models.find(We=>We.id===c))==null?void 0:dt.contextWindowOptions)??[],J=(N==null?void 0:N.contextWindow)??Ox[0].id,te=J==="1m"?Y5:X5,ee=r==="claude"||r==="codex",oe=r==="cursor"?Gd(c):null,ie=j.id==="cursor"?j.models.filter(We=>NT(We.id)===NT(c)):[],ue=r==="cursor"&&ie.some(tK)&&ie.some(eK),fe=j.id==="cursor"?Kq.map(We=>({family:We,models:j.models.filter(Ye=>Yq(Ye.id)===We)})).filter(Jq):[];let de;e[0]!==ee||e[1]!==d||e[2]!==r?(de=ee?r==="claude"?((vt=yv.find(We=>We.id===d.reasoningEffort))==null?void 0:vt.label)??String(d.reasoningEffort):((he=Lx.find(We=>We.id===d.reasoningEffort))==null?void 0:he.label)??String(d.reasoningEffort):null,e[0]=ee,e[1]=d,e[2]=r,e[3]=de):de=e[3];const Z=de;let ne;e[4]!==(V==null?void 0:V.thinkingMode)||e[5]!==r?(ne=r==="gemini"?((Re=Dx.find(We=>We.id===(V==null?void 0:V.thinkingMode)))==null?void 0:Re.label)??(V==null?void 0:V.thinkingMode)??"Standard":null,e[4]=V==null?void 0:V.thinkingMode,e[5]=r,e[6]=ne):ne=e[6];const ae=ne;let Q;e[7]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{B(null)},e[7]=Q):Q=e[7];let xe;e[8]!==r?(xe=[r],e[8]=r,e[9]=xe):xe=e[9],x.useEffect(Q,xe);const le=A&&"pointer-events-none opacity-60";let Te;e[10]!==M||e[11]!==le?(Te=we("max-w-full overflow-x-auto scrollbar-hide",le,M),e[10]=M,e[11]=le,e[12]=Te):Te=e[12];let Le;e[13]!==P?(Le=g.jsx(P,{className:"h-3.5 w-3.5"}),e[13]=P,e[14]=Le):Le=e[14];let Xe;e[15]!==Z||e[16]!==ee||e[17]!==c||e[18]!==d||e[19]!==m||e[20]!==_||e[21]!==r?(Xe=ee?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:Z}),g.jsx("span",{className:"md:hidden",children:Z!==null?OT(Z):null})]}),children:We=>r==="claude"?yv.map(Ye=>g.jsx(ki,{onClick:()=>{m(Ye.id),We()},selected:d.reasoningEffort===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,disabled:Ye.id==="max"&&c!=="opus"},Ye.id)):Lx.map(Ye=>g.jsx(ki,{onClick:()=>{_(Ye.id),We()},selected:d.reasoningEffort===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label},Ye.id))}):null,e[15]=Z,e[16]=ee,e[17]=c,e[18]=d,e[19]=m,e[20]=_,e[21]=r,e[22]=Xe):Xe=e[22];let ht;e[23]!==(V==null?void 0:V.thinkingMode)||e[24]!==ae||e[25]!==c||e[26]!==y||e[27]!==r?(ht=r==="gemini"?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:ae}),g.jsx("span",{className:"md:hidden",children:ae!==null?OT(ae):null})]}),children:We=>Dx.map(Ye=>g.jsx(ki,{onClick:()=>{y(Ye.id),We()},selected:(V==null?void 0:V.thinkingMode)===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,disabled:Ye.id==="off"&&!qq(c)},Ye.id))}):null,e[23]=V==null?void 0:V.thinkingMode,e[24]=ae,e[25]=c,e[26]=y,e[27]=r,e[28]=ht):ht=e[28];let Ke;e[29]!==(I==null?void 0:I.fastMode)||e[30]!==S||e[31]!==r?(Ke=r==="codex"?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[I!=null&&I.fastMode?g.jsx(ui,{className:"h-3.5 w-3.5"}):g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:I!=null&&I.fastMode?"Fast Mode":"Standard"}),g.jsx("span",{className:"md:hidden",children:I!=null&&I.fastMode?"Fast":"Std"})]}),triggerClassName:I!=null&&I.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:We=>g.jsxs(g.Fragment,{children:[g.jsx(ki,{onClick:()=>{S(!1),We()},selected:!(I!=null&&I.fastMode),icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),g.jsx(ki,{onClick:()=>{S(!0),We()},selected:!!(I!=null&&I.fastMode),icon:g.jsx(ui,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,e[29]=I==null?void 0:I.fastMode,e[30]=S,e[31]=r,e[32]=Ke):Ke=e[32];let it;return e[33]!==q||e[34]!==Y||e[35]!==R||e[36]!==W?(it=W?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[Y?g.jsx(Vn,{className:"h-3.5 w-3.5 animate-spin"}):q?g.jsx(dv,{className:"h-3.5 w-3.5"}):g.jsx(q5,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:Y?q?"Planning...":"Implementing...":q?"Plan":"Implement"}),g.jsx("span",{className:"md:hidden",children:Y?q?"Plan...":"Impl...":q?"Plan":"Impl"})]}),triggerClassName:q?"text-blue-400 dark:text-blue-300":void 0,children:We=>g.jsxs(g.Fragment,{children:[g.jsx(ki,{onClick:()=>{R(!1),We()},selected:!q,icon:g.jsx(q5,{className:"h-4 w-4 text-muted-foreground"}),label:"Implement",description:"Start execution",disabled:Y}),g.jsx(ki,{onClick:()=>{R(!0),We()},selected:q,icon:g.jsx(dv,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan",description:"Review a plan before execution",disabled:Y})]})}):null,e[33]=q,e[34]=Y,e[35]=R,e[36]=W,e[37]=it):it=e[37],g.jsx("div",{className:Te,children:g.jsxs("div",{className:"flex w-max items-center justify-center gap-0.5 mx-auto",children:[D?g.jsx(bl,{disabled:z||!f,trigger:g.jsxs(g.Fragment,{children:[g.jsx(U,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:(j==null?void 0:j.label)??r})]}),children:We=>n.map(Ye=>{const tt=Cv[Ye.id],et=i==null?void 0:i[Ye.id];return g.jsx(ki,{onClick:()=>{et||(f==null||f(Ye.id),We())},selected:r===Ye.id,icon:g.jsx(tt,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,description:et,disabled:!!et},Ye.id)})}):null,g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[Le,g.jsx("span",{children:j.id==="cursor"?jy(((Oe=j.models.find(We=>We.id===c))==null?void 0:Oe.label)??c,c):((Ve=j.models.find(We=>We.id===c))==null?void 0:Ve.label)??c})]}),children:We=>{var Ye;return j.id==="cursor"?F?g.jsxs(g.Fragment,{children:[g.jsxs("button",{onClick:()=>B(null),className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground transition-opacity hover:opacity-70",children:[g.jsx(z4,{className:"h-4 w-4"}),g.jsx("span",{children:F})]}),(Ye=fe.find(tt=>tt.family===F))==null?void 0:Ye.models.map(tt=>{const et=Wm[tt.id]??Sn;return g.jsx(ki,{onClick:()=>{h(r,tt.id),B(null),We()},selected:c===tt.id,icon:g.jsx(et,{className:"h-4 w-4 text-muted-foreground"}),label:jy(tt.label,tt.id)},tt.id)})]}):fe.map(tt=>{var nt;const et=tt.models.some(Pt=>Pt.id===c),ct=Wm[((nt=tt.models[0])==null?void 0:nt.id)??""]??Sn;return g.jsxs("div",{className:"relative",children:[g.jsx(ki,{onClick:()=>B(tt.family),selected:et,icon:g.jsx(ct,{className:"h-4 w-4 text-muted-foreground"}),label:tt.family,description:`${tt.models.length} model${tt.models.length===1?"":"s"}`}),g.jsx(Qi,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"})]},tt.family)}):j.models.map(tt=>{const et=Wm[tt.id]??Sn;return g.jsx(ki,{onClick:()=>{h(r,tt.id),We()},selected:c===tt.id,icon:g.jsx(et,{className:"h-4 w-4 text-muted-foreground"}),label:j.id==="cursor"?jy(tt.label,tt.id):tt.label},tt.id)})}}),ue?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[oe==="fast"?g.jsx(ui,{className:"h-3.5 w-3.5"}):g.jsx(ca,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden md:inline",children:oe==="fast"?"Fast":"Standard"}),g.jsx("span",{className:"md:hidden",children:oe==="fast"?"Fast":"Std"})]}),triggerClassName:oe==="fast"?"text-emerald-500 dark:text-emerald-400":void 0,children:We=>g.jsxs(g.Fragment,{children:[ie.filter(Zq).map(Ye=>g.jsx(ki,{onClick:()=>{h(r,Ye.id),We()},selected:c===Ye.id,icon:g.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"},Ye.id)),ie.filter(Qq).map(Ye=>g.jsx(ki,{onClick:()=>{h(r,Ye.id),We()},selected:c===Ye.id,icon:g.jsx(ui,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast"},Ye.id))]})}):null,Xe,r==="claude"&&L.length>1?g.jsx(bl,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(te,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:((Fe=L.find(We=>We.id===J))==null?void 0:Fe.label)??J})]}),children:We=>L.map(Ye=>g.jsx(ki,{onClick:()=>{v(Ye.id),We()},selected:J===Ye.id,icon:Ye.id==="1m"?g.jsx(Y5,{className:"h-4 w-4 text-muted-foreground"}):g.jsx(X5,{className:"h-4 w-4 text-muted-foreground"}),label:Ye.label,description:Ye.id==="1m"?"Expanded context window":"Standard context window"},Ye.id))}):null,ht,Ke,it]})})}function Qq(t){return Gd(t.id)==="fast"}function Zq(t){return Gd(t.id)==="standard"}function Jq(t){return t.models.length>0}function eK(t){return Gd(t.id)==="standard"}function tK(t){return Gd(t.id)==="fast"}const Ob=t=>{const e=ke.c(16);let n,r,i,s,o;e[0]!==t?({children:n,className:r,shimmerWidth:s,animate:o,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=s,e[5]=o):(n=e[1],r=e[2],i=e[3],s=e[4],o=e[5]);const l=s===void 0?100:s,c=o===void 0?!0:o,d=`${Math.min(l,100)}px`;let f;e[6]!==d?(f={"--shiny-width":d},e[6]=d,e[7]=f):f=e[7];const h=f;let m;e[8]!==c||e[9]!==r?(m=we("mx-auto max-w-md text-foreground/50",c?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],r),e[8]=c,e[9]=r,e[10]=m):m=e[10];let v;return e[11]!==n||e[12]!==i||e[13]!==h||e[14]!==m?(v=g.jsx("span",{style:h,className:m,...i,children:n}),e[11]=n,e[12]=i,e[13]=h,e[14]=m,e[15]=v):v=e[15],v};function Px(t){return t.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const nK=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function rK(t){const e=t.trim();for(const n of nK){const r=e.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return e}function PT(t){return t.split("/").pop()||t}function iK(t,e){if(t===void 0)return null;const n=Math.max(0,e-t),r=6e4,i=60*r,s=24*i,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}const sK='button, select, input, textarea, [role="combobox"], [role="listbox"], [data-no-touch-drag]';function jT(t){var e;try{(e=navigator.vibrate)==null||e.call(navigator,t)}catch{}}function mC({enabled:t,visualElementRef:e,onTap:n,onContextMenu:r,onDragStart:i,onDragMove:s,onDragEnd:o,holdDelay:l=300,contextMenuDelay:c=2500,scrollThreshold:d=8,dragMoveThreshold:f=5}){const[h,m]=x.useState(!1),[v,_]=x.useState(!1),[y,S]=x.useState(null),[C,R]=x.useState(null),k=x.useCallback(P=>{R(P)},[]),T=x.useRef("idle"),M=x.useRef({x:0,y:0}),A=x.useRef(null),D=x.useRef(null),z=x.useRef(n),G=x.useRef(r),$=x.useRef(i),H=x.useRef(s),F=x.useRef(o);z.current=n,G.current=r,$.current=i,H.current=s,F.current=o;const B=x.useCallback((P,W)=>{const q=(e==null?void 0:e.current)??C;if(!q)return document.elementFromPoint(P,W);const Y=q.style.pointerEvents;q.style.pointerEvents="none";const N=document.elementFromPoint(P,W);return q.style.pointerEvents=Y,N},[e,C]),j=x.useCallback(()=>{A.current&&(clearTimeout(A.current),A.current=null),D.current&&(clearTimeout(D.current),D.current=null)},[]),U=x.useCallback(()=>{j(),T.current="idle",_(!1),m(!1),S(null)},[j]);return x.useEffect(()=>{if(!C||!t)return;const P=N=>{if(N.target.closest(sK))return;const I=N.touches[0];I&&(M.current={x:I.clientX,y:I.clientY},T.current="holding",A.current=setTimeout(()=>{A.current=null,T.current==="holding"&&(T.current="armed",_(!0),jT(30),D.current=setTimeout(()=>{var L;if(D.current=null,T.current!=="armed")return;jT(100);const V={...M.current};T.current="idle",_(!1),(L=G.current)==null||L.call(G,V)},c))},l))},W=N=>{var ee,oe;const I=T.current;if(I==="idle")return;const V=N.touches[0];if(!V)return;const L=V.clientX-M.current.x,J=V.clientY-M.current.y,te=Math.sqrt(L*L+J*J);if(I==="holding"){te>d&&(j(),T.current="idle");return}if(I==="armed"){te>f&&(D.current&&(clearTimeout(D.current),D.current=null),T.current="dragging",_(!1),m(!0),S({x:V.clientX,y:V.clientY}),N.preventDefault(),(ee=$.current)==null||ee.call($,{x:V.clientX,y:V.clientY}));return}if(I==="dragging"){N.preventDefault(),S({x:V.clientX,y:V.clientY});const ie=B(V.clientX,V.clientY);(oe=H.current)==null||oe.call(H,{x:V.clientX,y:V.clientY,elementBelow:ie})}},q=N=>{var V,L;const I=T.current;if(I==="holding"){j(),T.current="idle",_(!1),m(!1),N.preventDefault(),(V=z.current)==null||V.call(z);return}if(I==="armed"){U();return}if(I==="dragging"){const J=N.changedTouches[0];if(J){const te=B(J.clientX,J.clientY);(L=F.current)==null||L.call(F,{x:J.clientX,y:J.clientY,elementBelow:te})}U()}},Y=()=>{var N;T.current==="dragging"&&((N=F.current)==null||N.call(F,{x:0,y:0,elementBelow:null})),U()};return C.addEventListener("touchstart",P,{passive:!1}),C.addEventListener("touchmove",W,{passive:!1}),C.addEventListener("touchend",q),C.addEventListener("touchcancel",Y),()=>{C.removeEventListener("touchstart",P),C.removeEventListener("touchmove",W),C.removeEventListener("touchend",q),C.removeEventListener("touchcancel",Y),j(),T.current="idle"}},[C,t,l,c,d,f,j,U,B]),{touchRef:k,isDragging:h,isArmed:v,dragPosition:y}}function HD(t){const e=ke.c(9),{position:n,children:r,className:i}=t;if(!n)return null;let s;e[0]!==n.x||e[1]!==n.y?(s={position:"fixed",left:n.x,top:n.y,transform:"translate(-50%, calc(-100% - 14px))",zIndex:9999,pointerEvents:"none",willChange:"transform"},e[0]=n.x,e[1]=n.y,e[2]=s):s=e[2];let o;e[3]!==i?(o=we("flex items-center gap-2 rounded-xl border-2 border-primary/60 bg-card px-3 py-2","shadow-[0_8px_32px_rgba(0,0,0,0.25)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.5)]","min-w-[120px] max-w-[240px]","scale-[1.04]",i),e[3]=i,e[4]=o):o=e[4];let l;return e[5]!==r||e[6]!==s||e[7]!==o?(l=ks.createPortal(g.jsx("div",{style:s,className:o,children:r}),document.body),e[5]=r,e[6]=s,e[7]=o,e[8]=l):l=e[8],l}function gC(t){const e=t+"CollectionProvider",[n,r]=Da(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:S,children:C}=y,R=Be.useRef(null),k=Be.useRef(new Map).current;return g.jsx(i,{scope:S,itemMap:k,collectionRef:R,children:C})};o.displayName=e;const l=t+"CollectionSlot",c=zc(l),d=Be.forwardRef((y,S)=>{const{scope:C,children:R}=y,k=s(l,C),T=on(S,k.collectionRef);return g.jsx(c,{ref:T,children:R})});d.displayName=l;const f=t+"CollectionItemSlot",h="data-radix-collection-item",m=zc(f),v=Be.forwardRef((y,S)=>{const{scope:C,children:R,...k}=y,T=Be.useRef(null),M=on(S,T),A=s(f,C);return Be.useEffect(()=>(A.itemMap.set(T,{ref:T,...k}),()=>void A.itemMap.delete(T))),g.jsx(m,{[h]:"",ref:M,children:R})});v.displayName=f;function _(y){const S=s(t+"CollectionConsumer",y);return Be.useCallback(()=>{const R=S.collectionRef.current;if(!R)return[];const k=Array.from(R.querySelectorAll(`[${h}]`));return Array.from(S.itemMap.values()).sort((A,D)=>k.indexOf(A.ref.current)-k.indexOf(D.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},_,r]}var oK=x.createContext(void 0);function vC(t){const e=x.useContext(oK);return t||e||"ltr"}var zy="rovingFocusGroup.onEntryFocus",aK={bubbles:!1,cancelable:!0},up="RovingFocusGroup",[jx,UD,lK]=gC(up),[cK,VD]=Da(up,[lK]),[uK,dK]=cK(up),GD=x.forwardRef((t,e)=>g.jsx(jx.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(jx.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(fK,{...t,ref:e})})}));GD.displayName=up;var fK=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=x.useRef(null),v=on(e,m),_=vC(s),[y,S]=kd({prop:o,defaultProp:l??null,onChange:c,caller:up}),[C,R]=x.useState(!1),k=eo(d),T=UD(n),M=x.useRef(!1),[A,D]=x.useState(0);return x.useEffect(()=>{const z=m.current;if(z)return z.addEventListener(zy,k),()=>z.removeEventListener(zy,k)},[k]),g.jsx(uK,{scope:n,orientation:r,dir:_,loop:i,currentTabStopId:y,onItemFocus:x.useCallback(z=>S(z),[S]),onItemShiftTab:x.useCallback(()=>R(!0),[]),onFocusableItemAdd:x.useCallback(()=>D(z=>z+1),[]),onFocusableItemRemove:x.useCallback(()=>D(z=>z-1),[]),children:g.jsx(Kt.div,{tabIndex:C||A===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...t.style},onMouseDown:lt(t.onMouseDown,()=>{M.current=!0}),onFocus:lt(t.onFocus,z=>{const G=!M.current;if(z.target===z.currentTarget&&G&&!C){const $=new CustomEvent(zy,aK);if(z.currentTarget.dispatchEvent($),!$.defaultPrevented){const H=T().filter(P=>P.focusable),F=H.find(P=>P.active),B=H.find(P=>P.id===y),U=[F,B,...H].filter(Boolean).map(P=>P.ref.current);KD(U,f)}}M.current=!1}),onBlur:lt(t.onBlur,()=>R(!1))})})}),WD="RovingFocusGroupItem",qD=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=t,c=ka(),d=s||c,f=dK(WD,n),h=f.currentTabStopId===d,m=UD(n),{onFocusableItemAdd:v,onFocusableItemRemove:_,currentTabStopId:y}=f;return x.useEffect(()=>{if(r)return v(),()=>_()},[r,v,_]),g.jsx(jx.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:g.jsx(Kt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:e,onMouseDown:lt(t.onMouseDown,S=>{r?f.onItemFocus(d):S.preventDefault()}),onFocus:lt(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:lt(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const C=mK(S,f.orientation,f.dir);if(C!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let k=m().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")k.reverse();else if(C==="prev"||C==="next"){C==="prev"&&k.reverse();const T=k.indexOf(S.currentTarget);k=f.loop?gK(k,T+1):k.slice(T+1)}setTimeout(()=>KD(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:y!=null}):o})})});qD.displayName=WD;var hK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pK(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function mK(t,e,n){const r=pK(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return hK[r]}function KD(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function gK(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var vK=GD,bK=qD,zx=["Enter"," "],_K=["ArrowDown","PageUp","Home"],YD=["ArrowUp","PageDown","End"],yK=[..._K,...YD],xK={ltr:[...zx,"ArrowRight"],rtl:[...zx,"ArrowLeft"]},SK={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dp="Menu",[Oh,wK,CK]=gC(dp),[eu,XD]=Da(dp,[CK,Kl,VD]),Pb=Kl(),QD=VD(),[EK,tu]=eu(dp),[kK,fp]=eu(dp),ZD=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,l=Pb(e),[c,d]=x.useState(null),f=x.useRef(!1),h=eo(s),m=vC(i);return x.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",_,{capture:!0,once:!0}),document.addEventListener("pointermove",_,{capture:!0,once:!0})},_=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",_,{capture:!0}),document.removeEventListener("pointermove",_,{capture:!0})}},[]),g.jsx(Rb,{...l,children:g.jsx(EK,{scope:e,open:n,onOpenChange:h,content:c,onContentChange:d,children:g.jsx(kK,{scope:e,onClose:x.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};ZD.displayName=dp;var RK="MenuAnchor",bC=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Pb(n);return g.jsx(ap,{...i,...r,ref:e})});bC.displayName=RK;var _C="MenuPortal",[TK,JD]=eu(_C,{forceMount:void 0}),eI=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=tu(_C,e);return g.jsx(TK,{scope:e,forceMount:n,children:g.jsx(Ls,{present:n||s.open,children:g.jsx(Hd,{asChild:!0,container:i,children:r})})})};eI.displayName=_C;var Ts="MenuContent",[AK,yC]=eu(Ts),tI=x.forwardRef((t,e)=>{const n=JD(Ts,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=tu(Ts,t.__scopeMenu),o=fp(Ts,t.__scopeMenu);return g.jsx(Oh.Provider,{scope:t.__scopeMenu,children:g.jsx(Ls,{present:r||s.open,children:g.jsx(Oh.Slot,{scope:t.__scopeMenu,children:o.modal?g.jsx(MK,{...i,ref:e}):g.jsx(NK,{...i,ref:e})})})})}),MK=x.forwardRef((t,e)=>{const n=tu(Ts,t.__scopeMenu),r=x.useRef(null),i=on(e,r);return x.useEffect(()=>{const s=r.current;if(s)return bb(s)},[]),g.jsx(xC,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:lt(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),NK=x.forwardRef((t,e)=>{const n=tu(Ts,t.__scopeMenu);return g.jsx(xC,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),LK=zc("MenuContent.ScrollLock"),xC=x.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:v,disableOutsideScroll:_,...y}=t,S=tu(Ts,n),C=fp(Ts,n),R=Pb(n),k=QD(n),T=wK(n),[M,A]=x.useState(null),D=x.useRef(null),z=on(e,D,S.onContentChange),G=x.useRef(0),$=x.useRef(""),H=x.useRef(0),F=x.useRef(null),B=x.useRef("right"),j=x.useRef(0),U=_?ip:x.Fragment,P=_?{as:LK,allowPinchZoom:!0}:void 0,W=Y=>{var oe,ie;const N=$.current+Y,I=T().filter(ue=>!ue.disabled),V=document.activeElement,L=(oe=I.find(ue=>ue.ref.current===V))==null?void 0:oe.textValue,J=I.map(ue=>ue.textValue),te=VK(J,N,L),ee=(ie=I.find(ue=>ue.textValue===te))==null?void 0:ie.ref.current;(function ue(fe){$.current=fe,window.clearTimeout(G.current),fe!==""&&(G.current=window.setTimeout(()=>ue(""),1e3))})(N),ee&&setTimeout(()=>ee.focus())};x.useEffect(()=>()=>window.clearTimeout(G.current),[]),gb();const q=x.useCallback(Y=>{var I,V;return B.current===((I=F.current)==null?void 0:I.side)&&WK(Y,(V=F.current)==null?void 0:V.area)},[]);return g.jsx(AK,{scope:n,searchRef:$,onItemEnter:x.useCallback(Y=>{q(Y)&&Y.preventDefault()},[q]),onItemLeave:x.useCallback(Y=>{var N;q(Y)||((N=D.current)==null||N.focus(),A(null))},[q]),onTriggerLeave:x.useCallback(Y=>{q(Y)&&Y.preventDefault()},[q]),pointerGraceTimerRef:H,onPointerGraceIntentChange:x.useCallback(Y=>{F.current=Y},[]),children:g.jsx(U,{...P,children:g.jsx(rp,{asChild:!0,trapped:i,onMountAutoFocus:lt(s,Y=>{var N;Y.preventDefault(),(N=D.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:g.jsx(Fd,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:v,children:g.jsx(vK,{asChild:!0,...k,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:M,onCurrentTabStopIdChange:A,onEntryFocus:lt(c,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(Tb,{role:"menu","aria-orientation":"vertical","data-state":vI(S.open),"data-radix-menu-content":"",dir:C.dir,...R,...y,ref:z,style:{outline:"none",...y.style},onKeyDown:lt(y.onKeyDown,Y=>{const I=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,V=Y.ctrlKey||Y.altKey||Y.metaKey,L=Y.key.length===1;I&&(Y.key==="Tab"&&Y.preventDefault(),!V&&L&&W(Y.key));const J=D.current;if(Y.target!==J||!yK.includes(Y.key))return;Y.preventDefault();const ee=T().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);YD.includes(Y.key)&&ee.reverse(),HK(ee)}),onBlur:lt(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(G.current),$.current="")}),onPointerMove:lt(t.onPointerMove,Ph(Y=>{const N=Y.target,I=j.current!==Y.clientX;if(Y.currentTarget.contains(N)&&I){const V=Y.clientX>j.current?"right":"left";B.current=V,j.current=Y.clientX}}))})})})})})})});tI.displayName=Ts;var DK="MenuGroup",SC=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Kt.div,{role:"group",...r,ref:e})});SC.displayName=DK;var IK="MenuLabel",nI=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Kt.div,{...r,ref:e})});nI.displayName=IK;var Ev="MenuItem",zT="menu.itemSelect",jb=x.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=x.useRef(null),o=fp(Ev,t.__scopeMenu),l=yC(Ev,t.__scopeMenu),c=on(e,s),d=x.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const m=new CustomEvent(zT,{bubbles:!0,cancelable:!0});h.addEventListener(zT,v=>r==null?void 0:r(v),{once:!0}),uL(h,m),m.defaultPrevented?d.current=!1:o.onClose()}};return g.jsx(rI,{...i,ref:c,disabled:n,onClick:lt(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:lt(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:lt(t.onKeyDown,h=>{const m=l.searchRef.current!=="";n||m&&h.key===" "||zx.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});jb.displayName=Ev;var rI=x.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=yC(Ev,n),l=QD(n),c=x.useRef(null),d=on(e,c),[f,h]=x.useState(!1),[m,v]=x.useState("");return x.useEffect(()=>{const _=c.current;_&&v((_.textContent??"").trim())},[s.children]),g.jsx(Oh.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:g.jsx(bK,{asChild:!0,...l,focusable:!r,children:g.jsx(Kt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:lt(t.onPointerMove,Ph(_=>{r?o.onItemLeave(_):(o.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:lt(t.onPointerLeave,Ph(_=>o.onItemLeave(_))),onFocus:lt(t.onFocus,()=>h(!0)),onBlur:lt(t.onBlur,()=>h(!1))})})})}),OK="MenuCheckboxItem",iI=x.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return g.jsx(cI,{scope:t.__scopeMenu,checked:n,children:g.jsx(jb,{role:"menuitemcheckbox","aria-checked":kv(n)?"mixed":n,...i,ref:e,"data-state":CC(n),onSelect:lt(i.onSelect,()=>r==null?void 0:r(kv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});iI.displayName=OK;var sI="MenuRadioGroup",[PK,jK]=eu(sI,{value:void 0,onValueChange:()=>{}}),oI=x.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=eo(r);return g.jsx(PK,{scope:t.__scopeMenu,value:n,onValueChange:s,children:g.jsx(SC,{...i,ref:e})})});oI.displayName=sI;var aI="MenuRadioItem",lI=x.forwardRef((t,e)=>{const{value:n,...r}=t,i=jK(aI,t.__scopeMenu),s=n===i.value;return g.jsx(cI,{scope:t.__scopeMenu,checked:s,children:g.jsx(jb,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":CC(s),onSelect:lt(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});lI.displayName=aI;var wC="MenuItemIndicator",[cI,zK]=eu(wC,{checked:!1}),uI=x.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=zK(wC,n);return g.jsx(Ls,{present:r||kv(s.checked)||s.checked===!0,children:g.jsx(Kt.span,{...i,ref:e,"data-state":CC(s.checked)})})});uI.displayName=wC;var BK="MenuSeparator",dI=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Kt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});dI.displayName=BK;var $K="MenuArrow",fI=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Pb(n);return g.jsx(Ab,{...i,...r,ref:e})});fI.displayName=$K;var FK="MenuSub",[n1e,hI]=eu(FK),uh="MenuSubTrigger",pI=x.forwardRef((t,e)=>{const n=tu(uh,t.__scopeMenu),r=fp(uh,t.__scopeMenu),i=hI(uh,t.__scopeMenu),s=yC(uh,t.__scopeMenu),o=x.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:t.__scopeMenu},f=x.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return x.useEffect(()=>f,[f]),x.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),g.jsx(bC,{asChild:!0,...d,children:g.jsx(rI,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":vI(n.open),...t,ref:Fw(e,i.onTriggerChange),onClick:h=>{var m;(m=t.onClick)==null||m.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:lt(t.onPointerMove,Ph(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:lt(t.onPointerLeave,Ph(h=>{var v,_;f();const m=(v=n.content)==null?void 0:v.getBoundingClientRect();if(m){const y=(_=n.content)==null?void 0:_.dataset.side,S=y==="right",C=S?-5:5,R=m[S?"left":"right"],k=m[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:R,y:m.top},{x:k,y:m.top},{x:k,y:m.bottom},{x:R,y:m.bottom}],side:y}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:lt(t.onKeyDown,h=>{var v;const m=s.searchRef.current!=="";t.disabled||m&&h.key===" "||xK[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});pI.displayName=uh;var mI="MenuSubContent",gI=x.forwardRef((t,e)=>{const n=JD(Ts,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=tu(Ts,t.__scopeMenu),o=fp(Ts,t.__scopeMenu),l=hI(mI,t.__scopeMenu),c=x.useRef(null),d=on(e,c);return g.jsx(Oh.Provider,{scope:t.__scopeMenu,children:g.jsx(Ls,{present:r||s.open,children:g.jsx(Oh.Slot,{scope:t.__scopeMenu,children:g.jsx(xC,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:lt(t.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:lt(t.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:lt(t.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),m=SK[o.dir].includes(f.key);h&&m&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});gI.displayName=mI;function vI(t){return t?"open":"closed"}function kv(t){return t==="indeterminate"}function CC(t){return kv(t)?"indeterminate":t?"checked":"unchecked"}function HK(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function UK(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function VK(t,e,n){const i=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=UK(t,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function GK(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const l=e[s],c=e[o],d=l.x,f=l.y,h=c.x,m=c.y;f>r!=m>r&&n<(h-d)*(r-f)/(m-f)+d&&(i=!i)}return i}function WK(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return GK(n,e)}function Ph(t){return e=>e.pointerType==="mouse"?t(e):void 0}var qK=ZD,KK=bC,YK=eI,XK=tI,QK=SC,ZK=nI,JK=jb,eY=iI,tY=oI,nY=lI,rY=uI,iY=dI,sY=fI,oY=pI,aY=gI,EC="ContextMenu",[lY,r1e]=Da(EC,[XD]),mi=XD(),[cY,bI]=lY(EC),_I=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:i,modal:s=!0}=t,[o,l]=x.useState(!1),c=mi(e),d=eo(r),f=x.useCallback(h=>{l(h),d(h)},[d]);return g.jsx(cY,{scope:e,open:o,onOpenChange:f,modal:s,children:g.jsx(qK,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};_I.displayName=EC;var yI="ContextMenuTrigger",xI=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=t,s=bI(yI,n),o=mi(n),l=x.useRef({x:0,y:0}),c=x.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=x.useRef(0),f=x.useCallback(()=>window.clearTimeout(d.current),[]),h=m=>{l.current={x:m.clientX,y:m.clientY},s.onOpenChange(!0)};return x.useEffect(()=>f,[f]),x.useEffect(()=>void(r&&f()),[r,f]),g.jsxs(g.Fragment,{children:[g.jsx(KK,{...o,virtualRef:c}),g.jsx(Kt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:lt(t.onContextMenu,m=>{f(),h(m),m.preventDefault()}),onPointerDown:r?t.onPointerDown:lt(t.onPointerDown,qm(m=>{f(),d.current=window.setTimeout(()=>h(m),700)})),onPointerMove:r?t.onPointerMove:lt(t.onPointerMove,qm(f)),onPointerCancel:r?t.onPointerCancel:lt(t.onPointerCancel,qm(f)),onPointerUp:r?t.onPointerUp:lt(t.onPointerUp,qm(f))})]})});xI.displayName=yI;var uY="ContextMenuPortal",SI=t=>{const{__scopeContextMenu:e,...n}=t,r=mi(e);return g.jsx(YK,{...r,...n})};SI.displayName=uY;var wI="ContextMenuContent",CI=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=bI(wI,n),s=mi(n),o=x.useRef(!1);return g.jsx(XK,{...s,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=t.onCloseAutoFocus)==null||c.call(t,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=t.onInteractOutside)==null||c.call(t,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});CI.displayName=wI;var dY="ContextMenuGroup",fY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(QK,{...i,...r,ref:e})});fY.displayName=dY;var hY="ContextMenuLabel",pY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(ZK,{...i,...r,ref:e})});pY.displayName=hY;var mY="ContextMenuItem",EI=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(JK,{...i,...r,ref:e})});EI.displayName=mY;var gY="ContextMenuCheckboxItem",vY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(eY,{...i,...r,ref:e})});vY.displayName=gY;var bY="ContextMenuRadioGroup",_Y=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(tY,{...i,...r,ref:e})});_Y.displayName=bY;var yY="ContextMenuRadioItem",xY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(nY,{...i,...r,ref:e})});xY.displayName=yY;var SY="ContextMenuItemIndicator",wY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(rY,{...i,...r,ref:e})});wY.displayName=SY;var CY="ContextMenuSeparator",EY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(iY,{...i,...r,ref:e})});EY.displayName=CY;var kY="ContextMenuArrow",RY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(sY,{...i,...r,ref:e})});RY.displayName=kY;var TY="ContextMenuSubTrigger",AY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(oY,{...i,...r,ref:e})});AY.displayName=TY;var MY="ContextMenuSubContent",NY=x.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=mi(n);return g.jsx(aY,{...i,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NY.displayName=MY;function qm(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var LY=_I,DY=xI,IY=SI,kI=CI,RI=EI;const kC=LY,RC=DY,zb=x.forwardRef((t,e)=>{const n=ke.c(9);let r,i;n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);let s;n[3]!==r?(s=we("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",r),n[3]=r,n[4]=s):s=n[4];let o;return n[5]!==i||n[6]!==e||n[7]!==s?(o=g.jsx(IY,{children:g.jsx(kI,{ref:e,className:s,...i})}),n[5]=i,n[6]=e,n[7]=s,n[8]=o):o=n[8],o});zb.displayName=kI.displayName;const Md=x.forwardRef((t,e)=>{const n=ke.c(9);let r,i;n[0]!==t?({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);let s;n[3]!==r?(s=we("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),n[3]=r,n[4]=s):s=n[4];let o;return n[5]!==i||n[6]!==e||n[7]!==s?(o=g.jsx(RI,{ref:e,className:s,...i}),n[5]=i,n[6]=e,n[7]=s,n[8]=o):o=n[8],o});Md.displayName=RI.displayName;function Bb(t){const e=ke.c(12),{open:n,onOpenChange:r,position:i,children:s}=t;let o;e[0]!==i?(o=i?{position:"fixed",left:i.x,top:i.y,width:0,height:0}:void 0,e[0]=i,e[1]=o):o=e[1];let l;e[2]!==o?(l=g.jsx($q,{style:o}),e[2]=o,e[3]=l):l=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=we("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg backdrop-blur-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"),e[4]=c):c=e[4];let d;e[5]!==s?(d=g.jsx(FD,{children:g.jsx(fC,{side:"bottom",align:"start",sideOffset:4,onOpenAutoFocus:OY,className:c,children:s})}),e[5]=s,e[6]=d):d=e[6];let f;return e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==d?(f=g.jsxs($D,{open:n,onOpenChange:r,children:[l,d]}),e[7]=r,e[8]=n,e[9]=l,e[10]=d,e[11]=f):f=e[11],f}function OY(t){return t.preventDefault()}function Bl(t){const e=ke.c(8),{onSelect:n,className:r,children:i}=t;let s;e[0]!==r?(s=we("relative flex w-full cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors","hover:bg-accent focus:bg-accent",r),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==n?(o=c=>{c.preventDefault(),n()},e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==s||e[6]!==o?(l=g.jsx("button",{type:"button",className:s,onPointerDown:o,children:i}),e[4]=i,e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function PY(t){const e=ke.c(21),{onRemove:n,children:r,mobileMenuPosition:i,onMobileMenuClose:s,skipContextMenu:o}=t;let l;e[0]!==r||e[1]!==n||e[2]!==o?(l=o?r:g.jsxs(kC,{children:[g.jsx(RC,{asChild:!0,children:r}),g.jsx(zb,{children:g.jsxs(Md,{onSelect:C=>{C.stopPropagation(),n()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(Ed,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})})]}),e[0]=r,e[1]=n,e[2]=o,e[3]=l):l=e[3];const c=!!i;let d;e[4]!==s?(d=C=>{C||s==null||s()},e[4]=s,e[5]=d):d=e[5];const f=i??null;let h;e[6]!==s||e[7]!==n?(h=()=>{s==null||s(),n()},e[6]=s,e[7]=n,e[8]=h):h=e[8];let m,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=g.jsx(Ed,{className:"h-4 w-4"}),v=g.jsx("span",{children:"Hide"}),e[9]=m,e[10]=v):(m=e[9],v=e[10]);let _;e[11]!==h?(_=g.jsxs(Bl,{onSelect:h,className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m,v]}),e[11]=h,e[12]=_):_=e[12];let y;e[13]!==c||e[14]!==d||e[15]!==f||e[16]!==_?(y=g.jsx(Bb,{open:c,onOpenChange:d,position:f,children:_}),e[13]=c,e[14]=d,e[15]=f,e[16]=_,e[17]=y):y=e[17];let S;return e[18]!==l||e[19]!==y?(S=g.jsxs(g.Fragment,{children:[l,y]}),e[18]=l,e[19]=y,e[20]=S):S=e[20],S}function jY(t){const e=ke.c(30),{onRename:n,onDelete:r,children:i,mobileMenuPosition:s,onMobileMenuClose:o,skipContextMenu:l}=t;let c;e[0]!==i||e[1]!==r||e[2]!==n||e[3]!==l?(c=l?i:g.jsxs(kC,{children:[g.jsx(RC,{asChild:!0,children:i}),g.jsxs(zb,{children:[g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),n()},children:[g.jsx(Vl,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Rename Feature"})]}),g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),r()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(Ed,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Delete Feature"})]})]})]}),e[0]=i,e[1]=r,e[2]=n,e[3]=l,e[4]=c):c=e[4];const d=!!s;let f;e[5]!==o?(f=A=>{A||o==null||o()},e[5]=o,e[6]=f):f=e[6];const h=s??null;let m;e[7]!==o||e[8]!==n?(m=()=>{o==null||o(),n()},e[7]=o,e[8]=n,e[9]=m):m=e[9];let v,_;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=g.jsx(Vl,{className:"h-4 w-4"}),_=g.jsx("span",{children:"Rename Feature"}),e[10]=v,e[11]=_):(v=e[10],_=e[11]);let y;e[12]!==m?(y=g.jsxs(Bl,{onSelect:m,children:[v,_]}),e[12]=m,e[13]=y):y=e[13];let S;e[14]!==r||e[15]!==o?(S=()=>{o==null||o(),r()},e[14]=r,e[15]=o,e[16]=S):S=e[16];let C,R;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx(Ed,{className:"h-4 w-4"}),R=g.jsx("span",{children:"Delete Feature"}),e[17]=C,e[18]=R):(C=e[17],R=e[18]);let k;e[19]!==S?(k=g.jsxs(Bl,{onSelect:S,className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[C,R]}),e[19]=S,e[20]=k):k=e[20];let T;e[21]!==k||e[22]!==d||e[23]!==f||e[24]!==h||e[25]!==y?(T=g.jsxs(Bb,{open:d,onOpenChange:f,position:h,children:[y,k]}),e[21]=k,e[22]=d,e[23]=f,e[24]=h,e[25]=y,e[26]=T):T=e[26];let M;return e[27]!==c||e[28]!==T?(M=g.jsxs(g.Fragment,{children:[c,T]}),e[27]=c,e[28]=T,e[29]=M):M=e[29],M}function zY(t){const e=ke.c(30),{onRename:n,onDelete:r,children:i,mobileMenuPosition:s,onMobileMenuClose:o,skipContextMenu:l}=t;let c;e[0]!==i||e[1]!==r||e[2]!==n||e[3]!==l?(c=l?i:g.jsxs(kC,{children:[g.jsx(RC,{asChild:!0,children:i}),g.jsxs(zb,{children:[g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),n()},children:[g.jsx(Vl,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Rename Chat"})]}),g.jsxs(Md,{onSelect:A=>{A.stopPropagation(),r()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(Ed,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Delete Chat"})]})]})]}),e[0]=i,e[1]=r,e[2]=n,e[3]=l,e[4]=c):c=e[4];const d=!!s;let f;e[5]!==o?(f=A=>{A||o==null||o()},e[5]=o,e[6]=f):f=e[6];const h=s??null;let m;e[7]!==o||e[8]!==n?(m=()=>{o==null||o(),n()},e[7]=o,e[8]=n,e[9]=m):m=e[9];let v,_;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=g.jsx(Vl,{className:"h-4 w-4"}),_=g.jsx("span",{children:"Rename Chat"}),e[10]=v,e[11]=_):(v=e[10],_=e[11]);let y;e[12]!==m?(y=g.jsxs(Bl,{onSelect:m,children:[v,_]}),e[12]=m,e[13]=y):y=e[13];let S;e[14]!==r||e[15]!==o?(S=()=>{o==null||o(),r()},e[14]=r,e[15]=o,e[16]=S):S=e[16];let C,R;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx(Ed,{className:"h-4 w-4"}),R=g.jsx("span",{children:"Delete Chat"}),e[17]=C,e[18]=R):(C=e[17],R=e[18]);let k;e[19]!==S?(k=g.jsxs(Bl,{onSelect:S,className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[C,R]}),e[19]=S,e[20]=k):k=e[20];let T;e[21]!==k||e[22]!==d||e[23]!==f||e[24]!==h||e[25]!==y?(T=g.jsxs(Bb,{open:d,onOpenChange:f,position:h,children:[y,k]}),e[21]=k,e[22]=d,e[23]=f,e[24]=h,e[25]=y,e[26]=T):T=e[26];let M;return e[27]!==c||e[28]!==T?(M=g.jsxs(g.Fragment,{children:[c,T]}),e[27]=c,e[28]=T,e[29]=M):M=e[29],M}const BY=new Set(["starting","running"]);function $Y(t){const e=ke.c(90),{chat:n,activeChatId:r,nowMs:i,showProviderIcon:s,isCompleted:o,onSelectChat:l,onRenameChat:c,onDeleteChat:d,draggable:f,onDragStart:h,onDragEnd:m,isTouchDevice:v,onTouchDragMove:_,onTouchDragEnd:y}=t,S=s===void 0?!1:s,C=o===void 0?!1:o,R=f===void 0?!1:f,k=v===void 0?!1:v;let T;e[0]!==n.lastMessageAt||e[1]!==i?(T=iK(n.lastMessageAt,i),e[0]=n.lastMessageAt,e[1]=i,e[2]=T):T=e[2];const M=T,A=k,D=n.provider?Cv[n.provider]:null,[z,G]=x.useState(null);let $;e[3]!==n.chatId||e[4]!==l?($=()=>l(n.chatId),e[3]=n.chatId,e[4]=l,e[5]=$):$=e[5];let H;e[6]===Symbol.for("react.memo_cache_sentinel")?(H=vt=>G(vt),e[6]=H):H=e[6];let F;e[7]!==n||e[8]!==R||e[9]!==h?(F=R?()=>h==null?void 0:h(n):void 0,e[7]=n,e[8]=R,e[9]=h,e[10]=F):F=e[10];let B;e[11]!==R||e[12]!==_?(B=R?vt=>{const{x:he,y:Re,elementBelow:Oe}=vt;return _==null?void 0:_(he,Re,Oe)}:void 0,e[11]=R,e[12]=_,e[13]=B):B=e[13];let j;e[14]!==R||e[15]!==m||e[16]!==y?(j=vt=>{const{x:he,y:Re,elementBelow:Oe}=vt;R&&(y==null||y(he,Re,Oe),m==null||m())},e[14]=R,e[15]=m,e[16]=y,e[17]=j):j=e[17];let U;e[18]!==j||e[19]!==$||e[20]!==F||e[21]!==B||e[22]!==A?(U={enabled:A,onTap:$,onContextMenu:H,onDragStart:F,onDragMove:B,onDragEnd:j},e[18]=j,e[19]=$,e[20]=F,e[21]=B,e[22]=A,e[23]=U):U=e[23];const{touchRef:P,isArmed:W,isDragging:q,dragPosition:Y}=mC(U),N=A?P:void 0,I=n._id;let V;e[24]!==n.chatId?(V=Ex(n.chatId),e[24]=n.chatId,e[25]=V):V=e[25];let L;e[26]!==r||e[27]!==n.chatId?(L=r===Ex(n.chatId)?"bg-muted hover:bg-muted border-border":"cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 dark:hover:border-slate-400/10",e[26]=r,e[27]=n.chatId,e[28]=L):L=e[28];const J=W&&"scale-[1.03] shadow-md ring-2 ring-primary/50 bg-card border-primary/40",te=q&&!W&&"opacity-20 scale-[0.98]";let ee;e[29]!==L||e[30]!==J||e[31]!==te?(ee=we("group flex items-center gap-2 rounded-lg border px-2.5 py-1.5 transition-all duration-150 select-none",L,J,te),e[29]=L,e[30]=J,e[31]=te,e[32]=ee):ee=e[32];const oe=R&&!k;let ie;e[33]!==n||e[34]!==R||e[35]!==k||e[36]!==h?(ie=R&&!k?()=>h==null?void 0:h(n):void 0,e[33]=n,e[34]=R,e[35]=k,e[36]=h,e[37]=ie):ie=e[37];const ue=R&&!k?m:void 0;let fe;e[38]!==n.chatId||e[39]!==k||e[40]!==l?(fe=k?void 0:()=>l(n.chatId),e[38]=n.chatId,e[39]=k,e[40]=l,e[41]=fe):fe=e[41];let de;e[42]!==n.status||e[43]!==C?(de=BY.has(n.status)?g.jsx(Vn,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):n.status==="waiting_for_user"?g.jsx("div",{className:"relative",children:g.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:"rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):C?g.jsx("div",{className:"relative",children:g.jsxs("div",{className:"rounded-full z-0 size-3.5 flex items-center justify-center",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),g.jsx("div",{className:"rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,e[42]=n.status,e[43]=C,e[44]=de):de=e[44];let Z;e[45]!==D||e[46]!==n.provider||e[47]!==S?(Z=S&&D?g.jsx(D,{className:"size-3.5 flex-shrink-0 text-muted-foreground/80","aria-label":`${n.provider} provider`}):null,e[45]=D,e[46]=n.provider,e[47]=S,e[48]=Z):Z=e[48];let ne;e[49]!==n.status||e[50]!==n.title?(ne=n.status!=="idle"&&n.status!=="waiting_for_user"?g.jsx(Ob,{animate:n.status==="running",shimmerWidth:Math.max(20,n.title.length*3),children:n.title}):n.title,e[49]=n.status,e[50]=n.title,e[51]=ne):ne=e[51];let ae;e[52]!==ne?(ae=g.jsx("span",{className:"min-w-0 flex-1 translate-y-[-0.5px] truncate text-sm",children:ne}),e[52]=ne,e[53]=ae):ae=e[53];let Q;e[54]!==M?(Q=M?g.jsx("span",{className:"hidden shrink-0 text-[11px] text-muted-foreground opacity-60 md:inline",children:M}):null,e[54]=M,e[55]=Q):Q=e[55];let xe;e[56]!==n._id||e[57]!==N||e[58]!==V||e[59]!==ee||e[60]!==oe||e[61]!==ie||e[62]!==ue||e[63]!==fe||e[64]!==de||e[65]!==Z||e[66]!==ae||e[67]!==Q?(xe=g.jsxs("div",{ref:N,"data-chat-id":V,className:ee,draggable:oe,onDragStart:ie,onDragEnd:ue,onContextMenu:FY,onClick:fe,children:[de,Z,ae,Q]},I),e[56]=n._id,e[57]=N,e[58]=V,e[59]=ee,e[60]=oe,e[61]=ie,e[62]=ue,e[63]=fe,e[64]=de,e[65]=Z,e[66]=ae,e[67]=Q,e[68]=xe):xe=e[68];const le=xe;let Te;e[69]!==n.chatId||e[70]!==c?(Te=()=>c(n.chatId),e[69]=n.chatId,e[70]=c,e[71]=Te):Te=e[71];let Le;e[72]!==n.chatId||e[73]!==d?(Le=()=>d(n.chatId),e[72]=n.chatId,e[73]=d,e[74]=Le):Le=e[74];let Xe;e[75]===Symbol.for("react.memo_cache_sentinel")?(Xe=()=>G(null),e[75]=Xe):Xe=e[75];let ht;e[76]!==k||e[77]!==z||e[78]!==le||e[79]!==Te||e[80]!==Le?(ht=g.jsx(zY,{onRename:Te,onDelete:Le,mobileMenuPosition:z,onMobileMenuClose:Xe,skipContextMenu:k,children:le}),e[76]=k,e[77]=z,e[78]=le,e[79]=Te,e[80]=Le,e[81]=ht):ht=e[81];let Ke;e[82]!==n.title?(Ke=g.jsx("span",{className:"text-sm font-medium truncate",children:n.title}),e[82]=n.title,e[83]=Ke):Ke=e[83];let it;e[84]!==Y||e[85]!==Ke?(it=g.jsx(HD,{position:Y,children:Ke}),e[84]=Y,e[85]=Ke,e[86]=it):it=e[86];let dt;return e[87]!==ht||e[88]!==it?(dt=g.jsxs(g.Fragment,{children:[ht,it]}),e[87]=ht,e[88]=it,e[89]=dt):dt=e[89],dt}function FY(t){t.stopPropagation()}function HY(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return x.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const $b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wd(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function TC(t){return"nodeType"in t}function Li(t){var e,n;return t?Wd(t)?t:TC(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function AC(t){const{Document:e}=Li(t);return t instanceof e}function hp(t){return Wd(t)?!1:t instanceof Li(t).HTMLElement}function TI(t){return t instanceof Li(t).SVGElement}function qd(t){return t?Wd(t)?t.document:TC(t)?AC(t)?t:hp(t)||TI(t)?t.ownerDocument:document:document:document}const jo=$b?x.useLayoutEffect:x.useEffect;function MC(t){const e=x.useRef(t);return jo(()=>{e.current=t}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function UY(){const t=x.useRef(null),e=x.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=x.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function jh(t,e){e===void 0&&(e=[t]);const n=x.useRef(t);return jo(()=>{n.current!==t&&(n.current=t)},e),n}function pp(t,e){const n=x.useRef();return x.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Rv(t){const e=MC(t),n=x.useRef(null),r=x.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function Bx(t){const e=x.useRef();return x.useEffect(()=>{e.current=t},[t]),e.current}let By={};function mp(t,e){return x.useMemo(()=>{if(e)return e;const n=By[t]==null?0:By[t]+1;return By[t]=n,t+"-"+n},[t,e])}function AI(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const f=s[c];f!=null&&(s[c]=f+t*d)}return s},{...e})}}const gd=AI(1),Tv=AI(-1);function VY(t){return"clientX"in t&&"clientY"in t}function NC(t){if(!t)return!1;const{KeyboardEvent:e}=Li(t.target);return e&&t instanceof e}function GY(t){if(!t)return!1;const{TouchEvent:e}=Li(t.target);return e&&t instanceof e}function $x(t){if(GY(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return VY(t)?{x:t.clientX,y:t.clientY}:null}const Nd=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Nd.Translate.toString(t),Nd.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),BT="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function WY(t){return t.matches(BT)?t:t.querySelector(BT)}const qY={display:"none"};function KY(t){let{id:e,value:n}=t;return Be.createElement("div",{id:e,style:qY},n)}function YY(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Be.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function XY(){const[t,e]=x.useState("");return{announce:x.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const MI=x.createContext(null);function QY(t){const e=x.useContext(MI);x.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function ZY(){const[t]=x.useState(()=>new Set),e=x.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[x.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[t]),e]}const JY={draggable:`
494
494
  To pick up a draggable item, press the space bar.
495
495
  While dragging, use the arrow keys to move the item.
496
496
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -2497,4 +2497,4 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
2497
2497
  `),r=e.split(`
2498
2498
  `),i=C0e(n,r),s=E0e(n,r,i);return k0e(s)}function C0e(t,e){const n=t.length,r=e.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let s=1;s<=n;s++)for(let o=1;o<=r;o++)i[s][o]=t[s-1]===e[o-1]?i[s-1][o-1]+1:Math.max(i[s-1][o],i[s][o-1]);return i}function E0e(t,e,n){const r=[];let i=t.length,s=e.length;for(;i>0||s>0;)i>0&&s>0&&t[i-1]===e[s-1]?(r.push({type:"context",text:t[i-1],oldIdx:i,newIdx:s}),i--,s--):s>0&&(i===0||n[i][s-1]>=n[i-1][s])?(r.push({type:"added",text:e[s-1],oldIdx:i,newIdx:s}),s--):(r.push({type:"removed",text:t[i-1],oldIdx:i,newIdx:s}),i--);return r.reverse()}function k0e(t){return t.map(e=>{const n=e.type==="removed"?"-":e.type==="added"?"+":" ";return{type:e.type,content:`${n}${e.text}`}})}function lx(t){const e=ke.c(20),{content:n,isDiff:r,oldString:i,newString:s}=t,o=r===void 0?!1:r;let l;e:{if(o&&i!==void 0&&s!==void 0){let S;e[0]!==s||e[1]!==i?(S=w0e(i,s),e[0]=s,e[1]=i,e[2]=S):S=e[2],l=S;break e}let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[3]=y):y=e[3],l=y}const c=l;let d;e:{if(!o){let S;e[4]!==n?(S=x0e(n),e[4]=n,e[5]=S):S=e[5],d=S;break e}let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[6]=y):y=e[6],d=y}const f=d;let h;e[7]!==f?(h=f.some(T0e),e[7]=f,e[8]=h):h=e[8];const m=h;if(o&&c.length>0){let y;e[9]!==c?(y=c.map(R0e),e[9]=c,e[10]=y):y=e[10];let S;return e[11]!==y?(S=g.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:g.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:g.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:g.jsx("tbody",{children:y})})})}),e[11]=y,e[12]=S):S=e[12],S}let v;if(e[13]!==m||e[14]!==f){let y;e[16]!==m?(y=(S,C)=>g.jsxs("tr",{children:[m&&g.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:S.lineNumber!==null?S.lineNumber:""}),g.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:S0e(S.content)})]},C),e[16]=m,e[17]=y):y=e[17],v=f.map(y),e[13]=m,e[14]=f,e[15]=v}else v=e[15];let _;return e[18]!==v?(_=g.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:g.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:g.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:g.jsx("tbody",{children:v})})})}),e[18]=v,e[19]=_):_=e[19],_}function R0e(t,e){const n=t.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":t.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",r=t.type==="removed"?"text-red-700 dark:text-red-400":t.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return g.jsxs("tr",{className:n,children:[g.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${t.type==="removed"?"text-red-500/50":t.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:t.type==="removed"?"-":t.type==="added"?"+":" "}),g.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${r}`,children:t.content.slice(1)})]},e)}function T0e(t){return t.lineNumber!==null}function a7(t){var V;const e=ke.c(78),{message:n,isLoading:r,localPath:i}=t,s=r===void 0?!1:r,o=n.result!==void 0,l=!o&&s;let c;e:{if(typeof n.result=="string"){c=n.result;break e}if(!n.result){c="";break e}if(typeof n.result=="object"&&n.result!==null&&"content"in n.result){const J=n.result.content;if(typeof J=="string"){c=J;break e}}let L;e[0]!==n.result?(L=JSON.stringify(n.result,null,2),e[0]=n.result,e[1]=L):L=e[1],c=L}const d=c;let f;if(e[2]!==n.input||e[3]!==n.toolKind||e[4]!==d){e:{if((n.toolKind==="read_file"||n.toolKind==="write_file"||n.toolKind==="edit_file")&&n.input.filePath){f=n.input.filePath;break e}if(n.toolKind==="edit_file"){const L=d.match(/^Updated\s+(.+)$/m);if(L!=null&&L[1]){f=L[1].trim();break e}}f=""}e[2]=n.input,e[3]=n.toolKind,e[4]=d,e[5]=f}else f=e[5];const h=f;let m;e:{if(n.toolKind==="skill"){m=n.input.skill;break e}if(n.toolKind==="glob"){m=`Search files ${n.input.pattern==="**/*"?"in all directories":`matching ${n.input.pattern}`}`;break e}if(n.toolKind==="grep"){const L=n.input.pattern,J=n.input.outputMode;if(J==="count"){m=`Count \`${L}\` occurrences`;break e}if(J==="content"){m=`Find \`${L}\` in text`;break e}m=`Find \`${L}\` in files`;break e}if(n.toolKind==="bash"){let L;e[6]!==n.input.command||e[7]!==n.input.description?(L=n.input.description||(n.input.command?rK(n.input.command):"Bash"),e[6]=n.input.command,e[7]=n.input.description,e[8]=L):L=e[8],m=L;break e}if(n.toolKind==="web_search"){m=n.input.query||"Web Search";break e}if(n.toolKind==="read_file"){let L;e[9]!==h||e[10]!==i?(L=h?`Read ${$1(h,i)}`:"Read file",e[9]=h,e[10]=i,e[11]=L):L=e[11],m=L;break e}if(n.toolKind==="write_file"){let L;e[12]!==h||e[13]!==i?(L=h?`Write ${$1(h,i)}`:"Write file",e[12]=h,e[13]=i,e[14]=L):L=e[14],m=L;break e}if(n.toolKind==="edit_file"){let L;e[15]!==h||e[16]!==i?(L=h?`Edit ${$1(h,i)}`:"Edit file",e[15]=h,e[16]=i,e[17]=L):L=e[17],m=L;break e}if(n.toolKind==="mcp_generic"){let L;e[18]!==n.input.tool?(L=Px(n.input.tool),e[18]=n.input.tool,e[19]=L):L=e[19];let J;e[20]!==n.input.server?(J=Px(n.input.server),e[20]=n.input.server,e[21]=J):J=e[21],m=`${L} from ${J}`;break e}if(n.toolKind==="subagent_task"){m=n.input.subagentType||n.toolName;break e}m=n.toolName}const v=m,_=n.toolKind==="subagent_task";let y;e:{if(n.toolKind==="skill"){y=n.input.skill;break e}y=void 0}const S=y,C=n.toolKind==="bash",R=n.toolKind==="write_file",k=n.toolKind==="edit_file",T=n.toolKind==="read_file";let M;e[22]!==T||e[23]!==d?(M=T&&!!d.trim(),e[22]=T,e[23]=d,e[24]=M):M=e[24];const A=M;let D;e[25]!==k||e[26]!==n.input?(D=k&&(!!n.input.oldString.trim()||!!n.input.newString.trim()),e[25]=k,e[26]=n.input,e[27]=D):D=e[27];const z=D;let G;e:switch(n.toolKind){case"bash":{G=n.input.command;break e}case"write_file":{G=n.input.content;break e}default:{let L;e[28]!==n.input?(L=JSON.stringify(n.input,null,2),e[28]=n.input,e[29]=L):L=e[29],G=L}}const $=G;let H;e[30]!==z||e[31]!==$||e[32]!==C||e[33]!==k||e[34]!==T||e[35]!==R||e[36]!==n.input||e[37]!==n.isError||e[38]!==d?(H=k?z?g.jsx(lx,{content:"",isDiff:!0,oldString:n.input.oldString,newString:n.input.newString}):d.trim()?g.jsx(F1,{label:n.isError?"Error":"Result",copyText:d,children:d}):g.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this edit, but ACP did not include the file diff details."}):!T&&!R&&g.jsx(F1,{label:C?g.jsxs("span",{className:"flex items-center gap-2 w-full",children:[g.jsx("span",{children:"Command"}),!!n.input.timeoutMs&&g.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(n.input.timeoutMs),"ms"]}),!!n.input.runInBackground&&g.jsx("span",{className:"text-muted-foreground",children:"background"})]}):R?"Contents":"Input",copyText:$,children:$}),e[30]=z,e[31]=$,e[32]=C,e[33]=k,e[34]=T,e[35]=R,e[36]=n.input,e[37]=n.isError,e[38]=d,e[39]=H):H=e[39];let F;e[40]!==A||e[41]!==o||e[42]!==T||e[43]!==n.isError||e[44]!==d?(F=o&&T&&!n.isError&&(A?g.jsx(lx,{content:d}):g.jsx("div",{className:"text-muted-foreground text-xs",children:"Cursor completed this read, but ACP did not include the file contents."})),e[40]=A,e[41]=o,e[42]=T,e[43]=n.isError,e[44]=d,e[45]=F):F=e[45];let B;e[46]!==R||e[47]!==n.input||e[48]!==n.isError?(B=R&&!n.isError&&g.jsx(lx,{content:n.input.content}),e[46]=R,e[47]=n.input,e[48]=n.isError,e[49]=B):B=e[49];let j;e[50]!==o||e[51]!==k||e[52]!==T||e[53]!==R||e[54]!==n.isError||e[55]!==d?(j=o&&!T&&!(R&&!n.isError)&&!(k&&!n.isError)&&g.jsx(F1,{label:n.isError?"Error":"Result",copyText:d,children:d}),e[50]=o,e[51]=k,e[52]=T,e[53]=R,e[54]=n.isError,e[55]=d,e[56]=j):j=e[56];let U;e[57]!==F||e[58]!==B||e[59]!==j||e[60]!==H?(U=g.jsx(kp,{className:"my-4 text-sm",children:g.jsxs("div",{className:"flex flex-col gap-2",children:[H,F,B,j]})}),e[57]=F,e[58]=B,e[59]=j,e[60]=H,e[61]=U):U=e[61];let P;e:{if(n.isError){let ee;e[62]===Symbol.for("react.memo_cache_sentinel")?(ee=g.jsx(Ni,{className:"size-4 text-destructive"}),e[62]=ee):ee=e[62],P=ee;break e}if(_){let ee;e[63]===Symbol.for("react.memo_cache_sentinel")?(ee=g.jsx(zw,{className:"size-4 text-muted-icon"}),e[63]=ee):ee=e[63],P=ee;break e}let L;e[64]!==n.toolName?(L=tj(n.toolName),e[64]=n.toolName,e[65]=L):L=e[65];const J=L;let te;e[66]!==J?(te=g.jsx(J,{className:"size-4 text-muted-icon"}),e[66]=J,e[67]=te):te=e[67],P=te}let W;e[68]!==P?(W=g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:P}),e[68]=P,e[69]=W):W=e[69];const q=Math.max(20,(((V=S||v)==null?void 0:V.length)??33)*3),Y=S||v;let N;e[70]!==l||e[71]!==q||e[72]!==Y?(N=g.jsx(La,{className:"text-left transition-opacity duration-200 truncate",children:g.jsx(Ob,{animate:l,shimmerWidth:q,children:Y})}),e[70]=l,e[71]=q,e[72]=Y,e[73]=N):N=e[73];let I;return e[74]!==U||e[75]!==W||e[76]!==N?(I=g.jsx(ja,{className:"w-full",children:g.jsxs(Ep,{expandedContent:U,children:[W,N]})}),e[74]=U,e[75]=W,e[76]=N,e[77]=I):I=e[77],I}function A0e(t){const e=ke.c(9),{message:n}=t,r=M0e;if(!n.success){const f=n.result||"An unknown error occurred.";let h;return e[0]!==f?(h=g.jsx("div",{className:"px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm",children:f}),e[0]=f,e[1]=h):h=e[1],h}const i=`px-0.5 text-xs tracking-wide ${n.durationMs>6e4?"":"hidden"}`;let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("div",{className:"w-full h-[1px] bg-border"}),e[2]=s):s=e[2];const o=r(n.durationMs);let l;e[3]!==o?(l=g.jsxs(La,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",o]}),e[3]=o,e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=g.jsx("div",{className:"w-full h-[1px] bg-border"}),e[5]=c):c=e[5];let d;return e[6]!==i||e[7]!==l?(d=g.jsxs(ja,{className:i,children:[s,l,c]}),e[6]=i,e[7]=l,e[8]=d):d=e[8],d}function M0e(t){if(t<1e3)return`${t}ms`;const e=Math.floor(t/1e3),n=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return n>0?`${n}h${r>0?` ${r}m`:""}`:r>0?`${r}m${i>0?` ${i}s`:""}`:`${i}s`}function N0e(t){const e=ke.c(1);let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:g.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[g.jsx(oF,{className:"h-4 w-4 ml-1.5"}),g.jsx("em",{children:"Interrupted"})]})}),e[0]=n):n=e[0],n}function cb(t){const e=ke.c(15),{size:n}=t,r=n===void 0?4:n,i=`0 0 100 ${r}`,s=`${r}px`;let o;e[0]!==s?(o={height:s},e[0]=s,e[1]=o):o=e[1];const l=`M0 ${r} L${r/2} 0 L${r} ${r}`;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={stroke:"currentColor"},e[2]=c):c=e[2];let d;e[3]!==l?(d=g.jsx("path",{d:l,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:c}),e[3]=l,e[4]=d):d=e[4];let f;e[5]!==r||e[6]!==d?(f=g.jsx("pattern",{id:"zigzag",width:r,height:r,patternUnits:"userSpaceOnUse",children:d}),e[5]=r,e[6]=d,e[7]=f):f=e[7];let h;e[8]!==r?(h=g.jsx("rect",{width:"100%",height:r,fill:"url(#zigzag)",className:"text-muted-foreground/30"}),e[8]=r,e[9]=h):h=e[9];let m;return e[10]!==i||e[11]!==o||e[12]!==f||e[13]!==h?(m=g.jsxs("svg",{className:"flex-1",viewBox:i,preserveAspectRatio:"none",style:o,children:[f,h]}),e[10]=i,e[11]=o,e[12]=f,e[13]=h,e[14]=m):m=e[14],m}function L0e(){const t=ke.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(cb,{}),g.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),g.jsx(cb,{})]}),t[0]=e):e=t[0],e}function D0e(){const t=ke.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(cb,{}),g.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),g.jsx(cb,{})]}),t[0]=e):e=t[0],e}function I0e(t){const e=ke.c(8),{message:n}=t;let r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=[Np],i=Rp(),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let s;e[2]!==n.summary?(s=g.jsx(kp,{className:"my-4 text-xs",children:g.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:g.jsx(Mp,{remarkPlugins:r,components:i,children:n.summary})})}),e[2]=n.summary,e[3]=s):s=e[3];let o,l;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(H4,{className:"h-4.5 w-4.5 text-muted-foreground"})}),l=g.jsx(La,{children:"Summarized"}),e[4]=o,e[5]=l):(o=e[4],l=e[5]);let c;return e[6]!==s?(c=g.jsx(ja,{children:g.jsxs(Ep,{expandedContent:s,children:[o,l]})}),e[6]=s,e[7]=c):c=e[7],c}const O0e={compacting:"Compacting..."};function P0e(t){const e=ke.c(3),{message:n}=t,r=O0e[n.status]||n.status;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(H4,{className:"h-4.5 w-4.5 text-muted-foreground"})}),e[0]=i):i=e[0];let s;return e[1]!==r?(s=g.jsxs(ja,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[i,g.jsx(La,{className:"text-left transition-opacity duration-200 truncate",children:r})]}),e[1]=r,e[2]=s):s=e[2],s}const j0e={read_file:{key:"read",singular:"read",plural:"reads"},edit_file:{key:"edit",singular:"edit",plural:"edits"},write_file:{key:"write",singular:"write",plural:"writes"},bash:{key:"bash",singular:"command",plural:"commands"},grep:{key:"grep",singular:"search",plural:"searches"},glob:{key:"glob",singular:"glob",plural:"globs"},subagent_task:{key:"task",singular:"agent",plural:"agents"},web_search:{key:"websearch",singular:"web search",plural:"web searches"},skill:{key:"skill",singular:"skill",plural:"skills"},todo_write:{key:"todo",singular:"todo update",plural:"todo updates"}},z0e={key:"other",singular:"tool call",plural:"tool calls"};function B0e(t){return j0e[t]??z0e}function $0e(t){const e=new Map,n=[];for(const r of t){const i=r.toolKind,s=B0e(i),o=e.get(s.key);o?o.count++:(e.set(s.key,{category:s,count:1}),n.push(s.key))}return n.map(r=>{const{category:i,count:s}=e.get(r);return`${s} ${s===1?i.singular:i.plural}`}).join(", ")}function F0e(t){const e=ke.c(26),{messages:n,isLoading:r,localPath:i}=t,[s,o]=x.useState(!1);let l;e[0]!==n?(l=$0e(n),e[0]=n,e[1]=l):l=e[1];const c=l;let d;e[2]!==n?(d=n.some(H0e),e[2]=n,e[3]=d):d=e[3];const h=d&&r;let m;e[4]!==s?(m=()=>o(!s),e[4]=s,e[5]=m):m=e[5];const v=`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!s&&!h?"hover:opacity-60 transition-opacity":""}`,_=`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${s?"rotate-90":""}`;let y;e[6]!==_?(y=g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(Qi,{className:_})}),e[6]=_,e[7]=y):y=e[7];let S;e[8]!==c||e[9]!==h?(S=g.jsx(La,{className:"text-left",children:g.jsx(Ob,{animate:h,children:c})}),e[8]=c,e[9]=h,e[10]=S):S=e[10];let C;e[11]!==y||e[12]!==S?(C=g.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[y,S]}),e[11]=y,e[12]=S,e[13]=C):C=e[13];let R;e[14]!==m||e[15]!==v||e[16]!==C?(R=g.jsx("button",{onClick:m,className:v,children:C}),e[14]=m,e[15]=v,e[16]=C,e[17]=R):R=e[17];let k;e[18]!==s||e[19]!==r||e[20]!==i||e[21]!==n?(k=s&&g.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[n.map(M=>g.jsx(a7,{message:M,isLoading:r,localPath:i},M.id)),n.length>5&&g.jsx("button",{onClick:()=>o(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:g.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(Qi,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),g.jsx(La,{className:"text-left",children:"Collapse"})]})})]}),e[18]=s,e[19]=r,e[20]=i,e[21]=n,e[22]=k):k=e[22];let T;return e[23]!==k||e[24]!==R?(T=g.jsx(ja,{className:"w-full",children:g.jsxs("div",{className:"flex flex-col w-full",children:[R,k]})}),e[23]=k,e[24]=R,e[25]=T):T=e[25],T}function H0e(t){return t.result===void 0}const U0e=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function QN(t){if(t.kind!=="tool")return!1;const e=t.toolName;return!U0e.has(e)}function V0e(t,e,n){return t?t.kind==="status"&&e<n.length-1:!1}function G0e(t,e={}){var s;const n=[];let r=0;const i=o=>(o==null?void 0:o.kind)==="tool"&&o.toolName==="TodoWrite"&&o.id!==e.TodoWrite;for(;r<t.length;){const o=t[r];if(QN(o)){const l=[o],c=r;for(r+=1;r<t.length;){const d=t[r];if(QN(d)){l.push(d),r+=1;continue}if(V0e(d,r,t)){r+=1;continue}if(i(d)){r+=1;continue}break}l.length>=2?n.push({type:"tool-group",key:`group-${((s=l[0])==null?void 0:s.id)??c}`,messages:l,startIndex:c}):n.push({type:"single",key:o.id,message:o,index:c});continue}n.push({type:"single",key:o.id,message:o,index:r}),r+=1}return n}function W0e(t,e){var r;if(!e)return null;let n=-1;for(let i=t.length-1;i>=0;i-=1)if(((r=t[i])==null?void 0:r.kind)==="user_prompt"){n=i;break}if(n<0)return null;for(let i=t.length-1;i>n;i-=1){const s=t[i];if((s==null?void 0:s.kind)==="assistant_text")return s.id}return null}function q0e(t,e){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect().top-n.top+t.scrollTop;return{viewportHeight:t.clientHeight,viewportWidth:t.clientWidth,viewportStart:Math.max(0,t.scrollTop-i)}}function K0e(t){const e=ke.c(67),{messages:n,isLoading:r,hasOlderMessages:i,oldestLoadedEntryId:s,isLoadingOlderMessages:o,isAtBottom:l,localPath:c,latestToolIds:d,onOpenLocalLink:f,onAskUserQuestionSubmit:h,onExitPlanModeConfirm:m,onHandoff:v,onLoadOlder:_,pendingTool:y,availableProviders:S,scrollContainerRef:C}=t,R=x.useRef(null),k=x.useRef(null);let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T={viewportHeight:0,viewportWidth:0,viewportStart:0},e[0]=T):T=e[0];const[M,A]=x.useState(T);let D;e[1]!==n?(D=n.filter(Q0e),e[1]=n,e[2]=D):D=e[2];const z=D;let G;e[3]!==d||e[4]!==z?(G=G0e(z,d),e[3]=d,e[4]=z,e[5]=G):G=e[5];const $=G;let H;e[6]!==z?(H=z.findIndex(X0e),e[6]=z,e[7]=H):H=e[7];const F=H;let B;e[8]!==z?(B=z.findIndex(Y0e),e[8]=z,e[9]=B):B=e[9];const j=B;let U;e[10]!==r||e[11]!==z?(U=W0e(z,r),e[10]=r,e[11]=z,e[12]=U):U=e[12];const P=U;let W;e[13]!==C?(W=()=>{const fe=C.current,de=R.current;if(!fe||!de)return;const Z=()=>{const ae=q0e(fe,de);A(Q=>Q.viewportHeight===ae.viewportHeight&&Q.viewportWidth===ae.viewportWidth&&Q.viewportStart===ae.viewportStart?Q:ae)};Z();const ne=new ResizeObserver(Z);return ne.observe(fe),ne.observe(de),fe.addEventListener("scroll",Z,{passive:!0}),()=>{ne.disconnect(),fe.removeEventListener("scroll",Z)}},e[13]=C,e[14]=W):W=e[14];let q;e[15]!==n.length||e[16]!==C?(q=[n.length,C],e[15]=n.length,e[16]=C,e[17]=q):q=e[17],x.useEffect(W,q);let Y,N;e[18]!==l||e[19]!==s||e[20]!==M.viewportStart?(N=()=>{if(l||M.viewportStart>480){k.current=null;return}s&&k.current!==s&&(k.current=null)},Y=[l,s,M.viewportStart],e[18]=l,e[19]=s,e[20]=M.viewportStart,e[21]=Y,e[22]=N):(Y=e[21],N=e[22]),x.useEffect(N,Y);let I;e[23]!==i||e[24]!==l||e[25]!==o||e[26]!==s||e[27]!==_||e[28]!==C||e[29]!==M.viewportStart?(I=()=>{if(!i||!s||o||l||M.viewportStart>480)return;const fe=C.current;if(fe){const de=fe.scrollHeight-fe.scrollTop-fe.clientHeight;if(rP(de))return}k.current!==s&&(k.current=s,_())},e[23]=i,e[24]=l,e[25]=o,e[26]=s,e[27]=_,e[28]=C,e[29]=M.viewportStart,e[30]=I):I=e[30];let V;e[31]!==i||e[32]!==l||e[33]!==o||e[34]!==n.length||e[35]!==s||e[36]!==_||e[37]!==M.viewportStart?(V=[i,l,s,o,n.length,_,M.viewportStart],e[31]=i,e[32]=l,e[33]=o,e[34]=n.length,e[35]=s,e[36]=_,e[37]=M.viewportStart,e[38]=V):V=e[38],x.useEffect(I,V);let L;e[39]!==S||e[40]!==j||e[41]!==F||e[42]!==r||e[43]!==P||e[44]!==d||e[45]!==c||e[46]!==h||e[47]!==m||e[48]!==v||e[49]!==y||e[50]!==z?(L=function(de,Z){if(de.kind==="user_prompt")return g.jsx(Bbe,{content:de.content,attachments:de.attachments},de.id);switch(de.kind){case"unknown":return g.jsx(Ube,{json:de.json},de.id);case"system_init":return Z===F?g.jsx(Zbe,{message:de,rawJson:de.debugRaw},de.id):null;case"account_info":return Z===j?g.jsx(e0e,{message:de},de.id):null;case"assistant_text":return g.jsx(t0e,{message:de,isStreaming:r&&de.id===P},de.id);case"assistant_thought":return g.jsx(n0e,{message:de},de.id);case"tool":return de.toolKind==="ask_user_question"?g.jsx(l0e,{message:de,onSubmit:h,isLatest:de.id===d.AskUserQuestion},de.id):de.toolKind==="exit_plan_mode"?g.jsx(g0e,{message:de,onConfirm:m,onHandoff:v,isLatest:de.id===d.ExitPlanMode,isActionable:(y==null?void 0:y.toolKind)==="exit_plan_mode"&&y.toolUseId===de.toolId,availableProviders:S},de.id):de.toolKind==="todo_write"?de.id!==d.TodoWrite?null:g.jsx(y0e,{message:de},de.id):g.jsx(a7,{message:de,isLoading:r,localPath:c},de.id);case"result":{const ne=z[Z+1],ae=z[Z-1];return(ne==null?void 0:ne.kind)==="context_cleared"||(ae==null?void 0:ae.kind)==="context_cleared"?null:g.jsx(A0e,{message:de},de.id)}case"interrupted":return g.jsx(N0e,{message:de},de.id);case"compact_boundary":return g.jsx(L0e,{},de.id);case"context_cleared":return g.jsx(D0e,{},de.id);case"compact_summary":return g.jsx(I0e,{message:de},de.id);case"status":return Z===z.length-1?g.jsx(P0e,{message:de},de.id):null}},e[39]=S,e[40]=j,e[41]=F,e[42]=r,e[43]=P,e[44]=d,e[45]=c,e[46]=h,e[47]=m,e[48]=v,e[49]=y,e[50]=z,e[51]=L):L=e[51];const J=L;let te;e[52]!==r||e[53]!==c||e[54]!==J?(te=function(de,Z){if(de.type==="tool-group")return g.jsx("div",{className:Z?void 0:"pb-5",children:g.jsx("div",{className:"group relative",[mv]:"",children:g.jsx(F0e,{messages:de.messages,isLoading:r,localPath:c})})},de.key);const ne=J(de.message,de.index);return ne?g.jsx("div",{className:Z?void 0:"pb-5",children:g.jsx("div",{id:`msg-${de.message.id}`,className:"group relative",[mv]:"",children:ne})},de.key):null},e[52]=r,e[53]=c,e[54]=J,e[55]=te):te=e[55];const ee=te;let oe;if(e[56]!==ee||e[57]!==$){let fe;e[59]!==ee||e[60]!==$.length?(fe=(de,Z)=>ee(de,Z===$.length-1),e[59]=ee,e[60]=$.length,e[61]=fe):fe=e[61],oe=$.map(fe),e[56]=ee,e[57]=$,e[58]=oe}else oe=e[58];let ie;e[62]!==oe?(ie=g.jsx("div",{ref:R,children:oe}),e[62]=oe,e[63]=ie):ie=e[63];let ue;return e[64]!==f||e[65]!==ie?(ue=g.jsx(nfe,{onOpenLocalLink:f,children:ie}),e[64]=f,e[65]=ie,e[66]=ue):ue=e[66],ue}function Y0e(t){return t.kind==="account_info"}function X0e(t){return t.kind==="system_init"}function Q0e(t){return!t.hidden}function Z0e(t){const e=ke.c(6),{rootRef:n,fallbackRef:r,enabled:i,canCancel:s}=t;let o,l;e[0]!==s||e[1]!==i||e[2]!==r||e[3]!==n?(o=()=>{if(!i)return;let c=0,d=null;const f=y=>{const S=y instanceof Element?y:null,C=n.current,R=r.current;if(vT({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:d,pointerEndTarget:S,root:C,fallback:R,hasActiveOverlay:gT(document),hasActiveSelection:sG(window.getSelection())})!=="restore"){d=null;return}R==null||R.focus({preventScroll:!0}),d=null},h=y=>{cancelAnimationFrame(c),d=y.target instanceof Element?y.target:null},m=y=>{cancelAnimationFrame(c),c=window.requestAnimationFrame(()=>{f(y.target)})},v=()=>{d=null;const y=r.current;!y||y.disabled||y.focus({preventScroll:!0})},_=y=>{if(y.key!=="Escape")return;const S=r.current;vT({trigger:"escape",activeElement:document.activeElement,fallback:S,hasActiveOverlay:gT(document),canCancel:s,defaultPrevented:y.defaultPrevented})==="escape-focus"&&(y.preventDefault(),S==null||S.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",h,!0),window.addEventListener("pointerup",m,!0),window.addEventListener("keydown",_,!0),window.addEventListener(pv,v),()=>{cancelAnimationFrame(c),window.removeEventListener("pointerdown",h,!0),window.removeEventListener("pointerup",m,!0),window.removeEventListener("keydown",_,!0),window.removeEventListener(pv,v)}},l=[s,i,r,n],e[0]=s,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=l):(o=e[4],l=e[5]),x.useEffect(o,l)}const Tg="Use any pull-request skills to create a new pull request for these local changes. Write a clear, concise title, description, and testing summary.",Ag="Use any pull-request skills to update the existing pull request for these local changes. Commit the local changes with a clear, concise message and summarize what changed.",dd=["codex"],J0e=new Set(Jc.map(t=>t.id));function ZN(t){if(!Array.isArray(t))return[...dd];const e=t.filter(n=>typeof n=="string"&&J0e.has(n));return e.length>0?Array.from(new Set(e)):[...dd]}const cx=Gr()(gi(t=>({pullRequestPrompt:Tg,pullRequestUpdatePrompt:Ag,pullRequestProviders:[...dd],setPullRequestPrompt:e=>t({pullRequestPrompt:e}),setPullRequestUpdatePrompt:e=>t({pullRequestUpdatePrompt:e}),setPullRequestProviders:e=>t({pullRequestProviders:ZN(e)}),togglePullRequestProvider:e=>t(n=>{const r=n.pullRequestProviders.includes(e)?n.pullRequestProviders.filter(i=>i!==e):[...n.pullRequestProviders,e];return{pullRequestProviders:r.length>0?r:[...dd]}}),resetToDefaults:()=>t({pullRequestPrompt:Tg,pullRequestUpdatePrompt:Ag,pullRequestProviders:[...dd]})}),{name:"slash-command-settings",version:1,migrate:t=>{if(!t||typeof t!="object")return{pullRequestPrompt:Tg,pullRequestUpdatePrompt:Ag,pullRequestProviders:[...dd]};const e=t;return{...e,pullRequestPrompt:typeof e.pullRequestPrompt=="string"?e.pullRequestPrompt:Tg,pullRequestUpdatePrompt:typeof e.pullRequestUpdatePrompt=="string"?e.pullRequestUpdatePrompt:Ag,pullRequestProviders:ZN(e.pullRequestProviders)}}}));function Mg(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function e_e(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function t_e(t,e){const n=e_e(e);switch(t.toolKind){case"ask_user_question":{const i=Mg(n),s=Mg(i==null?void 0:i.answers)??(i||{});return{answers:Object.fromEntries(Object.entries(s).map(([o,l])=>Array.isArray(l)?[o,l.map(c=>String(c))]:l&&typeof l=="object"&&Array.isArray(l.answers)?[o,l.answers.map(c=>String(c))]:l==null||l===""?[o,[]]:[o,[String(l)]])),...(i==null?void 0:i.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const i=Mg(n);return{confirmed:typeof(i==null?void 0:i.confirmed)=="boolean"?i.confirmed:void 0,clearContext:typeof(i==null?void 0:i.clearContext)=="boolean"?i.clearContext:void 0,suppressFollowUp:typeof(i==null?void 0:i.suppressFollowUp)=="boolean"?i.suppressFollowUp:void 0,message:typeof(i==null?void 0:i.message)=="string"?i.message:void 0,...(i==null?void 0:i.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=Mg(n);return{content:typeof(r==null?void 0:r.content)=="string"?r.content:JSON.stringify(n,null,2)};default:return n}}function l7(t){return new Date(t).toISOString()}function vs(t){return{id:t._id,messageId:t.messageId,timestamp:l7(t.createdAt),hidden:t.hidden}}function n_e(t){return{id:t._id,messageId:t.messageId,hidden:t.hidden,kind:"tool",toolKind:t.tool.toolKind,toolName:t.tool.toolName,toolId:t.tool.toolId,input:t.tool.input,timestamp:l7(t.createdAt)}}function r_e(t){if(t.debugRaw)try{return JSON.parse(t.debugRaw).tool_use_result}catch{return}}function i_e(t){if(t!=null&&t.length)return t.map(e=>({...e,previewUrl:`/attachments/${e.relativePath.split("/").map(encodeURIComponent).join("/")}`}))}function JN(t,e){const n=t.at(-1);if((n==null?void 0:n.kind)===e.kind&&n.hidden===e.hidden&&n.messageId===e.messageId){n.text+=e.text;return}t.push(e)}function e4(t){if(!t||typeof t!="object"||!("answers"in t))return!1;const e=t.answers;return Object.values(e).some(n=>Array.isArray(n)&&n.length>0)}function s_e(t){const e=new Map,n=[];for(const r of t)switch(r.kind){case"user_prompt":n.push({...vs(r),kind:"user_prompt",content:r.content,attachments:i_e(r.attachments)});break;case"system_init":n.push({...vs(r),kind:"system_init",provider:r.provider,model:r.model,tools:r.tools,agents:r.agents,slashCommands:r.slashCommands,mcpServers:r.mcpServers,debugRaw:r.debugRaw});break;case"account_info":n.push({...vs(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":JN(n,{...vs(r),kind:"assistant_text",text:r.text});break;case"assistant_thought":JN(n,{...vs(r),kind:"assistant_thought",text:r.text});break;case"tool_call":{const i=n.at(-1);(i==null?void 0:i.kind)==="assistant_text"&&r.tool.toolKind==="ask_user_question"&&(i.hidden=!0);const s=n_e(r);e.set(r.tool.toolId,{hydrated:s,normalized:r.tool,precedingAssistantText:(i==null?void 0:i.kind)==="assistant_text"?i:void 0}),n.push(s);break}case"tool_result":{const i=e.get(r.toolId);if(i){const s=i.normalized.toolKind==="ask_user_question"||i.normalized.toolKind==="exit_plan_mode"?r_e(r)??r.content:r.content,o=t_e(i.normalized,s);(i.normalized.toolKind!=="ask_user_question"||!e4(i.hydrated.result)||e4(o))&&(i.hydrated.result=o,i.hydrated.rawResult=s),i.hydrated.isError=r.isError,i.normalized.toolKind==="exit_plan_mode"&&i.precedingAssistantText&&i.hydrated.result&&(i.precedingAssistantText.hidden=!0)}break}case"result":n.push({...vs(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...vs(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...vs(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...vs(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...vs(r),kind:"context_cleared"});break;case"interrupted":n.push({...vs(r),kind:"interrupted"});break;default:n.push({...vs(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const o_e=["AskUserQuestion","ExitPlanMode","TodoWrite"],a_e=new Set(["TodoWrite"]);function l_e(t,e){for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(r.kind!=="tool")continue;const i=r;if(i.toolName===e&&!i.result)return i.id}return null}function c_e(t,e){for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(r.kind!=="tool")continue;const i=r;if(i.toolName===e)return i.id}return null}function u_e(t){const e={};for(const n of o_e)e[n]=a_e.has(n)?c_e(t,n):l_e(t,n);return e}function d_e(t){return t==="starting"||t==="running"||t==="waiting_for_user"}function Rw(t){return t==="starting"||t==="running"||t==="waiting_for_user"}function c7(){return typeof window>"u"?null:(window.__KAIZEN_PERF__??(window.__KAIZEN_PERF__={timings:{},counters:{}}),window.__KAIZEN_PERF__)}function u7(){return typeof window>"u"?!1:window.localStorage.getItem("kaizen.debug.perf")==="1"}function d7(t,e,n){const r=c7();r&&(r.timings[t]={value:e,meta:n,recordedAt:Date.now()},u7()&&console.debug(`[kaizen][perf] timing ${t}=${e}`,n??{}))}function t4(t,e=1,n){var s;const r=c7();if(!r)return;const i=(((s=r.counters[t])==null?void 0:s.value)??0)+e;r.counters[t]={value:i,meta:n,recordedAt:Date.now()},u7()&&console.debug(`[kaizen][perf] counter ${t}=${i}`,n??{})}function f_e(t){const e=new Set;return t.filter(n=>{const r=n.localPath??n.projectId;return!r||e.has(r)?!1:(e.add(r),!0)})}function h_e(t,e,n){return{...t,projectGroups:t.projectGroups.map(r=>{if(r.groupKey!==e)return r;const i=new Map(r.features.map(o=>[o.featureId,o])),s=n.map(o=>i.get(o)).filter(o=>!!o);return s.length!==r.features.length?r:{...r,features:s}})}}function p_e(t,e){const n=t.stage==="done"?1:0,r=e.stage==="done"?1:0;return n!==r?n-r:t.sortOrder!==e.sortOrder?t.sortOrder-e.sortOrder:e.updatedAt-t.updatedAt}function m_e(t,e,n){const r=t.filter(s=>s.featureId!==e);if(n==="done"){const s=r.filter(l=>l.stage==="done").map(l=>l.sortOrder),o=r.map(l=>l.sortOrder);return s.length>0?Math.max(...s)+1:o.length>0?Math.max(...o)+1:0}const i=r.filter(s=>s.stage!=="done").map(s=>s.sortOrder);return i.length===0?0:Math.max(...i)+1}function g_e(t,e,n,r=Date.now()){return{...t,projectGroups:t.projectGroups.map(i=>{const s=i.features.find(c=>c.featureId===e);if(!s||s.stage===n)return i;const o=s.stage==="done"||n==="done",l=i.features.map(c=>c.featureId===e?{...c,stage:n,updatedAt:r,sortOrder:o?m_e(i.features,e,n):c.sortOrder}:c).sort(p_e);return{...i,features:l}})}}function v_e(){return{projectBrowserStateById:{},projectGeneralChatsBrowserStateById:{},featureBrowserStateById:{},featureStageById:{},featureOrderByProjectId:{}}}function b_e(t,e){let n={...t,projectGroups:t.projectGroups.map(r=>{var i,s;return{...r,browserState:((i=e.projectBrowserStateById[r.groupKey])==null?void 0:i.value)??r.browserState,generalChatsBrowserState:((s=e.projectGeneralChatsBrowserStateById[r.groupKey])==null?void 0:s.value)??r.generalChatsBrowserState,features:r.features.map(o=>{var l;return{...o,browserState:((l=e.featureBrowserStateById[o.featureId])==null?void 0:l.value)??o.browserState}})}})};for(const[r,i]of Object.entries(e.featureOrderByProjectId))n=h_e(n,r,i.value);for(const[r,i]of Object.entries(e.featureStageById))n=g_e(n,r,i.value);return n}function f7(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0}function Ng(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>{var s,o,l,c;return((s=t[i])==null?void 0:s.value)===((o=e[i])==null?void 0:o.value)&&((l=t[i])==null?void 0:l.opId)===((c=e[i])==null?void 0:c.opId)})}function __e(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>{var s,o;return e[i]?((s=t[i])==null?void 0:s.opId)===((o=e[i])==null?void 0:o.opId)&&f7(t[i].value,e[i].value):!1})}function ux(t,e){return t.projectGroups.find(n=>n.groupKey===e)}function n4(t,e){return t.projectGroups.flatMap(n=>n.features).find(n=>n.featureId===e)}function y_e(t,e){const n=Object.fromEntries(Object.entries(e.projectBrowserStateById).filter(([l,c])=>{var d;return((d=ux(t,l))==null?void 0:d.browserState)!==c.value})),r=Object.fromEntries(Object.entries(e.projectGeneralChatsBrowserStateById).filter(([l,c])=>{var d;return((d=ux(t,l))==null?void 0:d.generalChatsBrowserState)!==c.value})),i=Object.fromEntries(Object.entries(e.featureBrowserStateById).filter(([l,c])=>{var d;return((d=n4(t,l))==null?void 0:d.browserState)!==c.value})),s=Object.fromEntries(Object.entries(e.featureStageById).filter(([l,c])=>{var d;return((d=n4(t,l))==null?void 0:d.stage)!==c.value})),o=Object.fromEntries(Object.entries(e.featureOrderByProjectId).filter(([l,c])=>{const d=ux(t,l);return d?!f7(d.features.map(f=>f.featureId),c.value):!1}));return{projectBrowserStateById:n,projectGeneralChatsBrowserStateById:r,featureBrowserStateById:i,featureStageById:s,featureOrderByProjectId:o}}function x_e(t,e){return Ng(t.projectBrowserStateById,e.projectBrowserStateById)&&Ng(t.projectGeneralChatsBrowserStateById,e.projectGeneralChatsBrowserStateById)&&Ng(t.featureBrowserStateById,e.featureBrowserStateById)&&Ng(t.featureStageById,e.featureStageById)&&__e(t.featureOrderByProjectId,e.featureOrderByProjectId)}function oh(t,e,n){var s;if(!(e in t)||((s=t[e])==null?void 0:s.opId)!==n)return t;const{[e]:r,...i}=t;return i}const h7=x.createContext(void 0);function S_e(t){const e=new Map;for(const n of t.projectGroups)for(const r of[...n.generalChats,...n.features.flatMap(i=>i.chats)])e.set(r.chatId,r.status);return e}function Tw(t,e){switch(e.type){case"sidebar.project-added":{const n=[...t.projectGroups];return n.splice(e.index,0,{...e.project,features:[],generalChats:[]}),{...t,projectGroups:n}}case"sidebar.project-removed":return{...t,projectGroups:t.projectGroups.filter(n=>n.groupKey!==e.projectId)};case"sidebar.project-moved":{const n=t.projectGroups.findIndex(s=>s.groupKey===e.projectId);if(n===-1)return t;const r=[...t.projectGroups],[i]=r.splice(n,1);return r.splice(e.index,0,i),{...t,projectGroups:r}}case"sidebar.project-fields-set":return{...t,projectGroups:t.projectGroups.map(n=>n.groupKey===e.projectId?{...n,...e.patch}:n)};case"sidebar.feature-added":return{...t,projectGroups:t.projectGroups.map(n=>{if(n.groupKey!==e.projectId)return n;const r=[...n.features];return r.splice(e.index,0,e.feature),{...n,features:r}})};case"sidebar.feature-removed":return{...t,projectGroups:t.projectGroups.map(n=>n.groupKey!==e.projectId?n:{...n,features:n.features.filter(r=>r.featureId!==e.featureId)})};case"sidebar.feature-moved":return{...t,projectGroups:t.projectGroups.map(n=>{if(n.groupKey!==e.projectId)return n;const r=n.features.findIndex(o=>o.featureId===e.featureId);if(r===-1)return n;const i=[...n.features],[s]=i.splice(r,1);return i.splice(e.index,0,s),{...n,features:i}})};case"sidebar.feature-fields-set":return{...t,projectGroups:t.projectGroups.map(n=>n.groupKey!==e.projectId?n:{...n,features:n.features.map(r=>r.featureId===e.featureId?{...r,...e.patch}:r)})};case"sidebar.chat-added":return{...t,projectGroups:t.projectGroups.map(n=>{if(n.groupKey!==e.projectId)return n;if(e.featureId)return{...n,features:n.features.map(i=>{if(i.featureId!==e.featureId)return i;const s=[...i.chats];return s.splice(e.index,0,e.chat),{...i,chats:s}})};const r=[...n.generalChats];return r.splice(e.index,0,e.chat),{...n,generalChats:r}})};case"sidebar.chat-removed":return{...t,projectGroups:t.projectGroups.map(n=>n.groupKey!==e.projectId?n:e.featureId?{...n,features:n.features.map(r=>r.featureId!==e.featureId?r:{...r,chats:r.chats.filter(i=>i.chatId!==e.chatId)})}:{...n,generalChats:n.generalChats.filter(r=>r.chatId!==e.chatId)})};case"sidebar.chat-moved":{const n=Tw(t,{type:"sidebar.chat-removed",projectId:e.projectId,featureId:e.fromFeatureId,chatId:e.chatId}),r=t.projectGroups.flatMap(i=>[...i.generalChats,...i.features.flatMap(s=>s.chats)]).find(i=>i.chatId===e.chatId);return r?Tw(n,{type:"sidebar.chat-added",projectId:e.projectId,featureId:e.toFeatureId,chat:{...r,featureId:e.toFeatureId},index:e.index}):n}case"sidebar.chat-fields-set":return{...t,projectGroups:t.projectGroups.map(n=>n.groupKey!==e.projectId?n:e.featureId?{...n,features:n.features.map(r=>r.featureId!==e.featureId?r:{...r,chats:r.chats.map(i=>i.chatId===e.chatId?{...i,...e.patch}:i)})}:{...n,generalChats:n.generalChats.map(r=>r.chatId===e.chatId?{...r,...e.patch}:r)})};case"sidebar.provider-usage-set":return{...t,providerUsage:e.providerUsage}}}function w_e({children:t,activeChatId:e,activeOverviewFeatureId:n}){const r=Xc(),i=Sb(),{socket:s}=gp(),{setCommandError:o,handleOpenCreateFeatureModal:l}=Xd(),[c,d]=x.useState({projectGroups:[]}),[f,h]=x.useState(v_e),[m,v]=x.useState(null),[_,y]=x.useState(null),[S,C]=x.useState(!1),[R,k]=x.useState(!1),[T,M]=x.useState(!1),[A,D]=x.useState(!1),[z,G]=x.useState(new Set),$=x.useRef(1),H=x.useRef(c),F=x.useRef(new Map),B=x.useRef(typeof document>"u"?!0:document.visibilityState==="visible"),j=x.useMemo(()=>b_e(c,f),[c,f]),U=x.useCallback(Z=>{H.current=Z,d(Z),h(ne=>{const ae=y_e(Z,ne);return x_e(ne,ae)?ne:ae})},[]);function P(){const Z=$.current;return $.current+=1,Z}x.useEffect(()=>{function Z(){const ne=document.visibilityState==="visible";B.current=ne,!(!ne||!e)&&G(ae=>{if(!ae.has(e))return ae;const Q=new Set(ae);return Q.delete(e),Q})}return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[e]),x.useEffect(()=>s.subscribe({type:"sidebar"},Z=>{U(Z),C(!0),o(null)},Z=>{const ne=performance.now(),ae=Tw(H.current,Z);U(ae),d7("sidebar_event_apply_ms",Math.round(performance.now()-ne),{type:Z.type}),C(!0),o(null)}),[U,o,s]),x.useEffect(()=>{const Z=S_e(j),ne=F.current,ae=B.current;G(Q=>{let xe=Q;for(const[le,Te]of Z){const Le=ne.get(le);Rw(Te)&&xe.has(le)&&(xe===Q&&(xe=new Set(Q)),xe.delete(le)),Le&&Rw(Le)&&Te==="idle"&&(le!==e||!ae)&&(xe===Q&&(xe=new Set(Q)),xe.add(le))}return xe}),F.current=Z},[e,j]),x.useEffect(()=>s.subscribe({type:"local-projects"},Z=>{v(Z),k(!0),o(null)}),[o,s]),x.useEffect(()=>{if(!n){y(null);return}return y(null),s.subscribe({type:"feature-overview",featureId:n},Z=>{y(Z),o(null)})},[n,o,s]);function W(Z){G(ne=>{if(!ne.has(Z))return ne;const ae=new Set(ne);return ae.delete(Z),ae})}async function q(Z){const ne=Z.split("/").filter(Boolean).pop()??Z;if(await i.confirm({title:"Hide Project",description:`Hide "${ne}" from ${Qs}? This only removes it from ${Qs} until you re-add it or reset local state.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await s.command({type:"project.hide",localPath:Z}),o(null)}catch(Q){o(Q instanceof Error?Q.message:String(Q))}}async function Y(Z){const ne=new URL(Xb("/api/directories"),window.location.origin);Z&&ne.searchParams.set("path",Z);const ae=await fetch(ne.toString());if(!ae.ok){let xe="Failed to load directories";try{const le=await ae.json();le.error&&(xe=le.error)}catch{}throw new Error(xe)}const Q=await ae.json();return o(null),Q}async function N(Z){const ne=j.projectGroups.flatMap(Q=>Q.features).find(Q=>Q.featureId===Z);if(!ne)return;const ae=await i.prompt({title:"Rename Feature",placeholder:"Feature name",initialValue:ne.title,confirmLabel:"Rename"});if(!(!ae||ae===ne.title))try{await s.command({type:"feature.rename",featureId:Z,title:ae}),o(null)}catch(Q){o(Q instanceof Error?Q.message:String(Q))}}async function I(Z){const ne=j.projectGroups.flatMap(Q=>Q.features).find(Q=>Q.featureId===Z);if(!(!ne||!await i.confirm({title:"Delete Feature",description:`Delete "${ne.title}"? Its chats will move to General and the feature folder will be removed.`,confirmLabel:"Delete",confirmVariant:"destructive"})))try{await s.command({type:"feature.delete",featureId:Z}),n===Z&&r("/"),o(null)}catch(Q){o(Q instanceof Error?Q.message:String(Q))}}async function V(Z,ne){const ae=P();h(Q=>({...Q,featureBrowserStateById:{...Q.featureBrowserStateById,[Z]:{value:ne,opId:ae}}}));try{await s.command({type:"feature.setBrowserState",featureId:Z,browserState:ne}),o(null)}catch(Q){h(xe=>({...xe,featureBrowserStateById:oh(xe.featureBrowserStateById,Z,ae)})),o(Q instanceof Error?Q.message:String(Q))}}async function L(Z,ne){const ae=P();h(Q=>({...Q,projectBrowserStateById:{...Q.projectBrowserStateById,[Z]:{value:ne,opId:ae}}}));try{await s.command({type:"project.setBrowserState",projectId:Z,browserState:ne}),o(null)}catch(Q){h(xe=>({...xe,projectBrowserStateById:oh(xe.projectBrowserStateById,Z,ae)})),o(Q instanceof Error?Q.message:String(Q))}}async function J(Z,ne){const ae=P();h(Q=>({...Q,projectGeneralChatsBrowserStateById:{...Q.projectGeneralChatsBrowserStateById,[Z]:{value:ne,opId:ae}}}));try{await s.command({type:"project.setGeneralChatsBrowserState",projectId:Z,browserState:ne}),o(null)}catch(Q){h(xe=>({...xe,projectGeneralChatsBrowserStateById:oh(xe.projectGeneralChatsBrowserStateById,Z,ae)})),o(Q instanceof Error?Q.message:String(Q))}}async function te(Z,ne){const ae=P();h(Q=>({...Q,featureStageById:{...Q.featureStageById,[Z]:{value:ne,opId:ae}}}));try{await s.command({type:"feature.setStage",featureId:Z,stage:ne}),o(null)}catch(Q){h(xe=>({...xe,featureStageById:oh(xe.featureStageById,Z,ae)})),o(Q instanceof Error?Q.message:String(Q))}}async function ee(Z,ne){try{const ae=await s.command({type:"feature.updateOverview",featureId:Z,content:ne});return o(null),ae}catch(ae){const Q=ae instanceof Error?ae.message:String(ae);throw o(Q),ae}}async function oe(Z,ne){const ae=P();h(Q=>({...Q,featureOrderByProjectId:{...Q.featureOrderByProjectId,[Z]:{value:ne,opId:ae}}}));try{const Q=await s.command({type:"feature.reorder",projectId:Z,orderedFeatureIds:ne});U(Q.sidebar),o(null)}catch(Q){h(xe=>({...xe,featureOrderByProjectId:oh(xe.featureOrderByProjectId,Z,ae)})),o(Q instanceof Error?Q.message:String(Q))}}async function ie(Z,ne){await s.command({type:"project.setProjectMetadataDirectoryCommitMode",projectId:Z.projectId,localPath:Z.localPath,commitProjectMetadata:ne})}async function ue(Z){try{await Promise.all(f_e((m==null?void 0:m.projects.map(ne=>({localPath:ne.localPath})))??j.projectGroups.map(ne=>({projectId:ne.groupKey,localPath:ne.localPath}))).map(ne=>ie(ne,Z))),o(null)}catch(ne){throw o(ne instanceof Error?ne.message:String(ne)),ne}}async function fe(Z){const ne=j.projectGroups.find(xe=>xe.groupKey===Z);if(!ne)return;const ae=ne.localPath.split("/").filter(Boolean).pop()??ne.localPath;if(await i.confirm({title:"Hide Project",description:`Hide "${ae}" from ${Qs}? Existing chats for this project will be removed from ${Qs}, but the project itself is not deleted.`,confirmLabel:"Hide",confirmVariant:"destructive"}))try{await s.command({type:"project.remove",projectId:Z}),kl.getState().clearProject(Z),id.getState().clearProject(Z),(e&&nP(j.projectGroups,e)===Z||(_==null?void 0:_.projectId)===Z)&&r("/"),o(null)}catch(xe){o(xe instanceof Error?xe.message:String(xe))}}const de=x.useMemo(()=>({sidebarData:j,completedChatIds:z,localProjects:m,featureOverviewSnapshot:_,sidebarReady:S,localProjectsReady:R,sidebarOpen:T,sidebarCollapsed:A,openSidebar:()=>M(!0),closeSidebar:()=>M(!1),collapseSidebar:()=>D(!0),expandSidebar:()=>D(!1),toggleProjectsSidebar:Z=>{if(Z){M(!1),D(ne=>!ne);return}M(ne=>!ne)},clearCompletedChatId:W,handleCreateFeature:Z=>l(Z),handleOpenFeatureOverview:Z=>{r(`/overview/${Z}`),M(!1),o(null)},handleRenameFeature:N,handleDeleteFeature:I,handleSetProjectBrowserState:L,handleSetProjectGeneralChatsBrowserState:J,handleSetFeatureBrowserState:V,handleSetFeatureStage:te,handleReorderFeatures:oe,handleHideLocalProject:q,handleListDirectories:Y,handleRemoveProject:fe,handleUpdateFeatureOverview:ee,handleSetCommitProjectMetadataDirectory:ue}),[z,_,W,I,q,l,Y,fe,N,oe,ue,V,te,L,J,ee,m,R,r,o,A,j,T,S,s]);return g.jsx(h7.Provider,{value:de,children:t})}function G2(){const t=x.useContext(h7);if(!t)throw new Error("useSidebarContext must be used within SidebarProvider");return t}const C_e=1e3,E_e=4,k_e=40*1024*1024,p7=x.createContext(void 0);function ah(t,e){return!!(t&&e&&t.runtime.chatId===e)}function Lg(t,e){return(t?JSON.stringify(t).length:0)+JSON.stringify(e).length+256}function R_e(t){return!!(t.activeChatId&&t.restoredFromCache&&!t.restoredFromFreshCache)}function T_e(t){var n;if(!(t!=null&&t.length))return null;let e=((n=t[0])==null?void 0:n.createdAt)??null;for(const r of t)(e===null||r.createdAt>e)&&(e=r.createdAt);return e}function dx(t,e){const n=t.filter(r=>r._id!==e);return n.length===t.length?t:n}const Aw="optimistic:";function r4(t){return t.startsWith(Aw)}function A_e(t){const e=Ss(t.loadedTranscriptEntries,[t.entry]);return{snapshot:t.snapshot&&t.snapshot.runtime.chatId===t.chatId?{...t.snapshot,messages:Ss(t.snapshot.messages,[t.entry]),transcript:{...t.snapshot.transcript,entries:Ss(t.snapshot.transcript.entries,[t.entry])}}:t.snapshot,loadedTranscriptEntries:e}}function M_e(t){return{snapshot:t.snapshot===null?null:{...t.snapshot,messages:dx(t.snapshot.messages,t.entryId),transcript:{...t.snapshot.transcript,entries:dx(t.snapshot.transcript.entries,t.entryId)}},loadedTranscriptEntries:dx(t.loadedTranscriptEntries,t.entryId)}}function N_e(t){return t.map(e=>JSON.stringify({_id:e._id,messageId:e.messageId??null,createdAt:e.createdAt,hidden:e.hidden??!1,kind:e.kind,payload:L_e(e)})).join("")}function L_e(t){switch(t.kind){case"user_prompt":return{content:t.content,attachments:t.attachments??[]};case"system_init":return{provider:t.provider,model:t.model,tools:t.tools,agents:t.agents,slashCommands:t.slashCommands,mcpServers:t.mcpServers,debugRaw:t.debugRaw??null};case"account_info":return t.accountInfo;case"assistant_text":case"assistant_thought":return t.text;case"tool_call":return t.tool;case"tool_result":return{toolId:t.toolId,content:t.content,isError:t.isError??!1,debugRaw:t.debugRaw??null};case"result":return{subtype:t.subtype,isError:t.isError,durationMs:t.durationMs,result:t.result,costUsd:t.costUsd??null};case"status":return t.status;case"compact_boundary":case"context_cleared":case"interrupted":return null;case"compact_summary":return t.summary;default:return t}}function D_e(t){var n,r,i;const e=T_e(t.loadedTranscriptEntries.length>0?t.loadedTranscriptEntries:(n=t.snapshot)==null?void 0:n.transcript.entries);return{cachedStatus:((r=t.snapshot)==null?void 0:r.runtime.status)??null,cachedUpdatedAt:((i=t.snapshot)==null?void 0:i.runtime.updatedAt)??e}}function I_e(t){return t?t.updatedAt??t.lastMessageAt??null:null}function O_e(t){return t.queuedReason===t.nextReason&&t.isQueued}function P_e(t){return t.currentChat?t.cachedStatus===t.currentChat.status&&t.cachedUpdatedAt===I_e(t.currentChat):!1}function j_e(t){for(let e=1;e<t.length;e+=1){const n=t[e-1],r=t[e];if(r.createdAt<n.createdAt||r.createdAt===n.createdAt&&r._id.localeCompare(n._id)<0)return!1}return!0}function Ss(t,e){if(e.length===0)return t;if(t.length===0)return e===t?t:[...e];const n=new Set(t.map(f=>f._id)),r=new Set(t.flatMap(f=>f.kind==="tool_result"&&f.toolId&&r4(f._id)?[f.toolId]:[]));let i=!0,s=t[t.length-1];for(const f of e){if(n.has(f._id)){i=!1;break}if(f.createdAt<s.createdAt||f.createdAt===s.createdAt&&f._id.localeCompare(s._id)<=0){i=!1;break}if(f.kind==="tool_result"&&f.toolId&&r.has(f.toolId)){i=!1;break}s=f}if(i){const f=[...t,...e];if(j_e(f))return f}const o=new Map;for(const f of t)o.set(f._id,f);for(const f of e)o.set(f._id,f);const l=new Set,c=new Map;for(const f of o.values()){if(f.kind!=="tool_result"||!f.toolId)continue;const h=c.get(f.toolId)??[];h.push(f._id),c.set(f.toolId,h),r4(f._id)&&l.add(f._id)}for(const f of c.values()){if(f.length<2)continue;const h=f.some(v=>l.has(v)),m=f.filter(v=>!l.has(v));if(!(!h||m.length!==1))for(const v of f)l.has(v)&&o.delete(v)}const d=[...o.values()].sort((f,h)=>f.createdAt!==h.createdAt?f.createdAt-h.createdAt:f._id.localeCompare(h._id));if(t.length===d.length){const f=[...t].map(m=>m._id).sort().join(""),h=d.map(m=>m._id).sort().join("");if(f===h){let m=!1;for(let v=0;v<t.length;v+=1){const _=t[v],y=d[v];if((_==null?void 0:_._id)!==(y==null?void 0:y._id)||!z_e(_,y)){m=!0;break}}if(!m)return t}}return d}function z_e(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n)if(!(i in e)||!Object.is(t[i],e[i]))return!1;return!0}function m7(t){return t.flatMap(e=>[...e.generalChats,...e.features.flatMap(n=>n.chats)])}function i4(t){return m7(t).some(e=>e.status==="starting"||e.status==="running")}function s4(t){return t.chat.chatId===t.activeChatId||t.chat.provider!=="claude"&&t.chat.provider!=="codex"&&t.chat.provider!=="cursor"||t.chat.status==="starting"||t.chat.status==="running"?null:t.chat.status==="waiting_for_user"?"waiting_for_user":t.completedChatIds.has(t.chat.chatId)?"completed":null}function B_e(t){const e=[];for(const n of t.cachedChatIdsNewestFirst){if(e.length>=t.limit)break;if(n===t.activeChatId)continue;const r=td(t.projectGroups,n);r&&(r.status!=="starting"&&r.status!=="running"||e.push(n))}return e}function o4(t,e){if(!t||t.runtime.chatId!==e.chatId)return t;switch(e.type){case"chat.message-appended":{const n=Ss(t.transcript.entries,[e.entry]),r=Math.max(t.runtime.updatedAt??0,e.entry.createdAt);return{...t,messages:n,runtime:{...t.runtime,updatedAt:r},transcript:{...t.transcript,entries:n}}}case"chat.messages-appended":{const n=Ss(t.transcript.entries,e.entries),r=e.entries.reduce((i,s)=>Math.max(i,s.createdAt),t.runtime.updatedAt??0);return{...t,messages:n,runtime:{...t.runtime,updatedAt:r},transcript:{...t.transcript,entries:n}}}case"chat.status-set":return{...t,runtime:{...t.runtime,status:e.status}};case"chat.title-set":return{...t,runtime:{...t.runtime,title:e.title}};case"chat.provider-set":return{...t,runtime:{...t.runtime,provider:e.provider}};case"chat.plan-mode-set":return{...t,runtime:{...t.runtime,planMode:e.planMode}};case"chat.pending-tool-set":return{...t,runtime:{...t.runtime,pendingTool:e.pendingTool}};case"chat.session-token-set":return{...t,runtime:{...t.runtime,sessionToken:e.sessionToken,hydrationState:e.hydrationState}};case"chat.usage-set":return{...t,usage:e.usage};case"chat.available-providers-set":return{...t,availableProviders:e.availableProviders,providerSettings:e.providerSettings??t.providerSettings};case"chat.transcript-window-meta-set":return{...t,transcript:{...t.transcript,hasOlder:e.hasOlder,oldestEntryId:e.oldestEntryId,hydrationState:e.hydrationState??t.transcript.hydrationState}};case"chat.outbound-queue-set":return{...t,runtime:{...t.runtime,queuedOutbound:e.queuedMessages.length>0?e.queuedMessages:void 0}};case"chat.deleted":return null}}function $_e({children:t,activeChatId:e}){var _i,Pr,Bn;const n=Xc(),r=Sb(),{socket:i}=gp(),{providerSettings:s}=Qd(),{sidebarData:o,sidebarReady:l,localProjects:c,featureOverviewSnapshot:d,closeSidebar:f,completedChatIds:h,clearCompletedChatId:m}=G2(),{createFeatureModalProjectId:v,handleCloseCreateFeatureModal:_,setCommandError:y}=Xd(),[S,C]=x.useState(null),[R,k]=x.useState(!1),[T,M]=x.useState(null),[A,D]=x.useState(null),[z,G]=x.useState([]),$=x.useRef([]),[H,F]=x.useState(!1),[B,j]=x.useState(null),[U,P]=x.useState(!1),[W,q]=x.useState(null),[Y,N]=x.useState(!1),[I,V]=x.useState(!1),[L,J]=x.useState(148),[te,ee]=x.useState(!0),oe=x.useRef(null),ie=x.useRef(!1),ue=x.useRef(null),fe=x.useRef(!0),de=x.useRef(null),Z=x.useRef(null),ne=x.useRef(!1),ae=x.useRef(null),Q=x.useRef(null),xe=x.useRef(null),le=x.useRef(null),Te=x.useRef(!1),Le=x.useRef(null),Xe=x.useRef(null),ht=x.useRef(new Map),Ke=x.useRef(null),it=x.useRef(new Map),dt=x.useRef(0),vt=x.useRef(new Map),he=x.useRef([]),Re=x.useRef(new Map),Oe=x.useRef(null),[Ve,Fe]=x.useState(0),[We,Ye]=x.useState(0);function tt(){Xe.current=null,Z.current=null,$.current=[],C(null),G([]),F(!1),j(null),P(!1)}function et(me){const Se=Le.current;if(!Se)return()=>{};const Ae=A_e({snapshot:Z.current,chatId:Se,loadedTranscriptEntries:$.current,entry:me}),$e=Ae.snapshot;return $e&&(Z.current=$e,C($e)),$.current=Ae.loadedTranscriptEntries,G(Ae.loadedTranscriptEntries),()=>{var Vt;if(Le.current!==Se)return;const Ue=M_e({snapshot:((Vt=Z.current)==null?void 0:Vt.runtime.chatId)===Se?Z.current:null,loadedTranscriptEntries:$.current,entryId:me._id});Z.current=Ue.snapshot,$.current=Ue.loadedTranscriptEntries,C(Ue.snapshot),G(Ue.loadedTranscriptEntries)}}function ct(me){const Se=it.current.get(me);Se&&(dt.current-=Se.estimatedBytes,it.current.delete(me),Fe(Ae=>Ae+1))}function nt(me,Se){const Ae=it.current.get(me);Ae&&(dt.current-=Ae.estimatedBytes,it.current.delete(me));const $e={...Se,...D_e({snapshot:Se.snapshot,loadedTranscriptEntries:Se.loadedTranscriptEntries})};for(it.current.set(me,$e),dt.current+=$e.estimatedBytes,Fe(Ue=>Ue+1);dt.current>k_e&&it.current.size>1;){const Ue=it.current.keys().next().value;if(!Ue||Ue===e)break;const Vt=it.current.get(Ue);Vt&&(dt.current-=Vt.estimatedBytes),it.current.delete(Ue),Fe(Pn=>Pn+1)}}function Pt(me){const Se=it.current.get(me);if(!Se)return null;if(!ah(Se.snapshot,me))return dt.current-=Se.estimatedBytes,it.current.delete(me),null;const Ae={...Se,isFresh:P_e({cachedStatus:Se.cachedStatus,cachedUpdatedAt:Se.cachedUpdatedAt,currentChat:td(o.projectGroups,me)})};return it.current.delete(me),it.current.set(me,Ae),Z.current=Ae.snapshot,C(Ae.snapshot),G(Ae.loadedTranscriptEntries),Xe.current=Ae.oldestLoadedEntryId,F(Ae.hasOlderMessages),j(Ae.oldestLoadedEntryId),P(!1),k(!0),Ae}x.useLayoutEffect(()=>{$.current=z},[z]),x.useLayoutEffect(()=>{fe.current=te}),x.useEffect(()=>{if(!e){Le.current=null,Q.current=null,Xe.current=null,le.current=null,Z.current=null,C(null),G([]),F(!1),j(null),P(!1),N(!1),k(!0);return}const Se=Le.current!==e;if(Le.current=e,Se){Ke.current={chatId:e,startedAt:performance.now()},Q.current=null,xe.current=null,le.current=null,tt(),k(!1);const Ae=Pt(e),$e=!!Ae;N(R_e({activeChatId:e,restoredFromCache:$e,restoredFromFreshCache:Ae==null?void 0:Ae.isFresh})),$e?t4("chat_cache_hit_count",1,{chatId:e}):(t4("chat_cache_miss_count",1,{chatId:e}),tt())}return i.subscribe({type:"chat",chatId:e},Ae=>{Le.current===e&&(Z.current=Ae,C(Ae),G($e=>Ae?Ss($e,Ae.transcript.entries):[]),ht.current.delete(e),N(!1),k(!0),y(null))},Ae=>{if(Le.current!==e)return;N(!1);const $e=o4(Z.current,Ae);$e===null?(ct(e),tt()):(Z.current=$e,C($e),Ae.type==="chat.message-appended"?G(Ue=>Ss(Ue,[Ae.entry])):Ae.type==="chat.messages-appended"&&G(Ue=>Ss(Ue,Ae.entries))),k(!0),y(null)})},[e,y,i]),x.useEffect(()=>{e&&m(e)},[e,m]),x.useEffect(()=>{const me=new Set(B_e({cachedChatIdsNewestFirst:[...it.current.keys()].reverse(),projectGroups:o.projectGroups,activeChatId:e,limit:E_e}));for(const[Se,Ae]of vt.current)me.has(Se)||(Ae(),vt.current.delete(Se));for(const Se of me){if(vt.current.has(Se))continue;const Ae=i.subscribe({type:"chat",chatId:Se},$e=>{if(Le.current!==Se){if(!ah($e,Se)){ct(Se);return}nt(Se,{snapshot:$e,loadedTranscriptEntries:[...$e.transcript.entries],hasOlderMessages:$e.transcript.hasOlder,oldestLoadedEntryId:$e.transcript.oldestEntryId,estimatedBytes:Lg($e,$e.transcript.entries),cachedStatus:null,cachedUpdatedAt:null,isFresh:!0})}},$e=>{if(Le.current===Se)return;const Ue=it.current.get(Se),Vt=o4((Ue==null?void 0:Ue.snapshot)??null,$e);if(Vt===null){ct(Se);return}const Pn=Ss((Ue==null?void 0:Ue.loadedTranscriptEntries)??[],Vt.transcript.entries);nt(Se,{snapshot:Vt,loadedTranscriptEntries:Pn,hasOlderMessages:(Ue==null?void 0:Ue.hasOlderMessages)??Vt.transcript.hasOlder,oldestLoadedEntryId:(Ue==null?void 0:Ue.oldestLoadedEntryId)??Vt.transcript.oldestEntryId,estimatedBytes:Lg(Vt,Pn),cachedStatus:null,cachedUpdatedAt:null,isFresh:!0})});vt.current.set(Se,Ae)}},[e,Ve,o.projectGroups,i]),x.useEffect(()=>{const me=new Set,Se=he.current.filter($e=>{const Ue=td(o.projectGroups,$e);return!!(Ue&&Ue.chatId!==e)});let Ae=Se.length!==he.current.length;for(const $e of m7(o.projectGroups)){me.add($e.chatId);const Ue=s4({chat:$e,activeChatId:e,completedChatIds:h});if(!Ue){Re.current.delete($e.chatId);continue}const Vt=Se.includes($e.chatId);O_e({queuedReason:Re.current.get($e.chatId),nextReason:Ue,isQueued:Vt})||(Re.current.set($e.chatId,Ue),Vt||(Se.push($e.chatId),Ae=!0))}for(const $e of[...Re.current.keys()])me.has($e)||Re.current.delete($e);Ae&&(he.current=Se,Ye($e=>$e+1))},[e,h,o.projectGroups]),x.useEffect(()=>{d&&M(d.projectId)},[d]),x.useEffect(()=>()=>{for(const me of vt.current.values())me();vt.current.clear()},[]),x.useEffect(()=>{if(Oe.current||i4(o.projectGroups))return;const me=he.current.find(Ae=>Ae!==e);if(!me)return;const Se=window.setTimeout(()=>{const Ae=td(o.projectGroups,me),$e=Ae?s4({chat:Ae,activeChatId:e,completedChatIds:h}):null;if(!Ae||!$e||i4(o.projectGroups)){he.current=he.current.filter(Ue=>Ue!==me),Ye(Ue=>Ue+1);return}Oe.current=me,i.command({type:"chat.prefetch",chatId:me}).then(Ue=>{if(!ah(Ue,me)){ct(me);return}nt(me,{snapshot:Ue,loadedTranscriptEntries:[...Ue.transcript.entries],hasOlderMessages:Ue.transcript.hasOlder,oldestLoadedEntryId:Ue.transcript.oldestEntryId,estimatedBytes:Lg(Ue,Ue.transcript.entries),cachedStatus:null,cachedUpdatedAt:null,isFresh:!0})}).catch(Ue=>{}).finally(()=>{Oe.current===me&&(Oe.current=null),he.current=he.current.filter(Ue=>Ue!==me),Ye(Ue=>Ue+1)})},C_e);return()=>window.clearTimeout(Se)},[e,We,h,o.projectGroups,i]),x.useEffect(()=>{if(T)return;const me=o.projectGroups[0];me&&M(me.groupKey)},[T,o.projectGroups]),x.useEffect(()=>{if(!e||!l||!R)return;if(o.projectGroups.some(Se=>[...Se.generalChats,...Se.features.flatMap(Ae=>Ae.chats)].some(Ae=>Ae.chatId===e))){A===e&&D(null);return}A!==e&&n("/")},[e,R,n,A,o.projectGroups,l]),x.useEffect(()=>{e&&ah(S,e)&&nt(e,{snapshot:S,loadedTranscriptEntries:z,hasOlderMessages:H,oldestLoadedEntryId:B,estimatedBytes:Lg(S,z),cachedStatus:null,cachedUpdatedAt:null,isFresh:!0})},[e,S,H,z,B]),x.useEffect(()=>{if(!S)return;M(S.runtime.projectId),S.transcript.hydrationState==="provider"?le.current=S.runtime.chatId:le.current===S.runtime.chatId&&(le.current=null),!!Xe.current&&Xe.current!==S.transcript.oldestEntryId?(G(Se=>{var $e;const Ae=Ss(Se,S.transcript.entries);return Xe.current=(($e=Ae[0])==null?void 0:$e._id)??null,Ae}),F(Se=>Se&&S.transcript.hasOlder)):(Xe.current=S.transcript.oldestEntryId,G(Se=>Ss(Se,S.transcript.entries)),F(S.transcript.hasOlder),j(S.transcript.oldestEntryId))},[S]),x.useEffect(()=>{ne.current=!1,ae.current!==null&&(window.cancelAnimationFrame(ae.current),ae.current=null),le.current=null,ie.current=!1,ue.current=null,ee(!0)},[e]),x.useEffect(()=>()=>{ae.current!==null&&window.cancelAnimationFrame(ae.current)},[]),x.useLayoutEffect(()=>{if(!ne.current)return;const me=oe.current;me&&fe.current&&(me.scrollTop=me.scrollHeight)},[e,z]),x.useLayoutEffect(()=>{const me=de.current;if(!me)return;const Se=new ResizeObserver(()=>{J(me.getBoundingClientRect().height)});return Se.observe(me),J(me.getBoundingClientRect().height),()=>Se.disconnect()},[]);const xt=e?(()=>{const me=it.current.get(e)??null;return ah((me==null?void 0:me.snapshot)??null,e)?me:null})():null,bt=x.useMemo(()=>{const me=HJ(S,e);return me||((xt==null?void 0:xt.snapshot)??null)},[xt,e,S]),He=z.length>0?z:(xt==null?void 0:xt.loadedTranscriptEntries)??[],Ge=x.useMemo(()=>{const me=bt;if(!me)return[];const Se=He,Ae=me.runtime.chatId,$e=N_e(Se),Ue=ht.current.get(Ae);if((Ue==null?void 0:Ue.signature)===$e)return Ue.messages;const Vt=s_e(Se);return ht.current.set(Ae,{signature:$e,messages:Vt}),Vt},[bt,He]),ze=x.useMemo(()=>u_e(Ge),[Ge]),Pe=(bt==null?void 0:bt.runtime)??null,_e=(bt==null?void 0:bt.usage)??null,je=e&&A===e&&!Pe?"starting":Pe==null?void 0:Pe.status,Ze=!!(e&&!bt),_t=(bt==null?void 0:bt.availableProviders)??CD((s==null?void 0:s.settings)??xv),Ft=Rw(je),Tt=d_e(je),kt=((Pe==null?void 0:Pe.status)==="starting"||(Pe==null?void 0:Pe.status)==="running")&&!(Pe!=null&&Pe.planMode),dn=zJ(L),Ht=!te&&Ge.length>0,Nt=((_i=c==null?void 0:c.projects[0])==null?void 0:_i.localPath)??null,Dn=(d==null?void 0:d.localPath)??(Pe==null?void 0:Pe.localPath)??Nt??((Pr=o.projectGroups[0])==null?void 0:Pr.localPath),nn=!!(T??(d==null?void 0:d.projectId)??(Pe==null?void 0:Pe.projectId)??((Bn=o.projectGroups[0])==null?void 0:Bn.groupKey)??Nt);x.useEffect(()=>{!e||!bt||U||z.length>0||bt.transcript.hydrationState==="provider"&&xe.current!==e&&(xe.current=e,an())},[e,bt,U,z.length]),x.useEffect(()=>{const me=Ke.current;!e||!me||me.chatId!==e||!R||(Ge.length>0||Pe)&&(d7("chat_switch_ready_ms",Math.round(performance.now()-me.startedAt),{chatId:e,cached:!!xt}),Ke.current=null)},[xt,e,R,Ge.length,Pe==null?void 0:Pe.status]),x.useLayoutEffect(()=>{if(ne.current)return;const me=oe.current;me&&(e&&!Pe||(me.scrollTo({top:me.scrollHeight,behavior:"auto"}),ae.current!==null&&window.cancelAnimationFrame(ae.current),ae.current=window.requestAnimationFrame(()=>{const Se=oe.current;Se&&(Se.scrollTo({top:Se.scrollHeight,behavior:"auto"}),ae.current=null)}),ne.current=!0))},[e,L,Ge.length,Pe]),x.useEffect(()=>{if(!ne.current||!te)return;const me=window.requestAnimationFrame(()=>{const Se=oe.current;!Se||!te||(Se.scrollTop=Se.scrollHeight)});return()=>window.cancelAnimationFrame(me)},[e,L,te]);function vn(){const me=oe.current;if(!me)return;const Se=me.scrollTop,Ae=me.scrollHeight-Se-me.clientHeight,$e=rP(Ae);ue.current!==null&&Se<ue.current&&(ie.current=!1),ue.current=Se,$e&&(ie.current=!1),ie.current||ee($e)}function In(){const me=oe.current;ee(!0),me&&(me.scrollTop=me.scrollHeight,ue.current=me.scrollTop,ie.current=!1)}function bn(){In()}async function an(){var Vt,Pn;const me=B??"",Se=Q.current;if(Se&&Se.chatId===e&&Se.beforeEntryId===me)return;const Ae=(bt==null?void 0:bt.transcript.hydrationState)==="provider"&&z.length===0;if(!e||U||!Ae&&!B)return;const $e=e,Ue=me;try{Q.current={chatId:$e,beforeEntryId:Ue},P(!0);const Jt=await i.command({type:"chat.loadMore",chatId:$e,beforeEntryId:Ae?void 0:Ue||void 0});if(Le.current!==$e)return;G(ns=>Ss(ns,Jt.entries)),Jt.hydrationState==="provider"?le.current=$e:le.current===$e&&(le.current=null),Xe.current=Jt.oldestEntryId,F(Jt.hasOlder),j(Jt.oldestEntryId),y(null)}catch(Jt){Le.current===$e&&y(Jt instanceof Error?Jt.message:String(Jt))}finally{((Vt=Q.current)==null?void 0:Vt.chatId)===$e&&((Pn=Q.current)==null?void 0:Pn.beforeEntryId)===Ue&&(Q.current=null),Le.current===$e&&P(!1)}}async function ln(me,Se){wa.getState().initializeComposerForNewChat();const Ae=await i.command({type:"chat.create",projectId:me,featureId:Se});M(me),D(Ae.chatId),n(`/chat/${Ae.chatId}`),f(),y(null)}async function xr(me,Se=bd.getState().commitProjectMetadataDirectory){await i.command({type:"project.setProjectMetadataDirectoryCommitMode",projectId:me.projectId,localPath:me.localPath,commitProjectMetadata:Se})}async function ri(me){return me.kind==="project_id"?{projectId:me.projectId}:me.kind==="local_path"?{projectId:(await i.command({type:"project.open",localPath:me.localPath})).projectId,localPath:me.localPath}:{projectId:(await i.command(me.project.mode==="new"?{type:"project.create",localPath:me.project.localPath,title:me.project.title}:{type:"project.open",localPath:me.project.localPath})).projectId,localPath:me.project.localPath}}async function ii(me){try{const Se=me.kind==="project_id"?null:me.kind==="local_path"?me.localPath:me.project.localPath;Se&&q(Se);const{projectId:Ae}=await ri(me);await xr({projectId:Ae}),await ln(Ae)}catch(Se){y(Se instanceof Error?Se.message:String(Se))}finally{q(null)}}async function ge(me,Se){try{await ln(me,Se)}catch(Ae){y(Ae instanceof Error?Ae.message:String(Ae))}}async function rt(me){const Se=v;if(Se&&!(I||Te.current))try{Te.current=!0,V(!0);const Ae=await i.command({type:"feature.create",projectId:Se,title:me.title,description:me.description,generateOverview:bd.getState().showFeatureOverviewInSidebar});_(),await ln(Se,Ae.featureId)}catch(Ae){y(Ae instanceof Error?Ae.message:String(Ae))}finally{Te.current=!1,V(!1)}}async function st(me){await ii({kind:"local_path",localPath:me})}async function Rn(me){await ii({kind:"project_request",project:me})}async function Tn(me,Se){var Ae;try{let $e=T??((Ae=o.projectGroups[0])==null?void 0:Ae.groupKey)??null;if(!e&&!$e&&Nt&&($e=(await i.command({type:"project.open",localPath:Nt})).projectId,M($e)),!e&&!$e)throw new Error("Open a project first");if(Se!=null&&Se.provider&&!xq(Se.provider,(s==null?void 0:s.settings)??xv))throw new Error(`${Se.provider} is inactive.`);In();const Ue=await i.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:$e??void 0,provider:Se==null?void 0:Se.provider,message:me,model:Se==null?void 0:Se.model,modelOptions:Se==null?void 0:Se.modelOptions,planMode:Se==null?void 0:Se.planMode});!e&&Ue.chatId&&(D(Ue.chatId),n(`/chat/${Ue.chatId}`)),y(null)}catch($e){throw y($e instanceof Error?$e.message:String($e)),$e}}async function Qn(me){if(e)try{await i.command({type:"chat.outboundQueue.remove",chatId:e,messageId:me}),y(null)}catch(Se){y(Se instanceof Error?Se.message:String(Se))}}async function Zn(me,Se){if(e)try{await i.command({type:"chat.outboundQueue.update",chatId:e,messageId:me,text:Se}),y(null)}catch(Ae){const $e=Ae instanceof Error?Ae.message:String(Ae);throw y($e),Ae}}async function An(){if(e)try{await i.command({type:"chat.cancel",chatId:e})}catch(me){y(me instanceof Error?me.message:String(me))}}async function Ut(me){if(await r.confirm({title:"Delete Chat",description:`Delete "${me.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await i.command({type:"chat.delete",chatId:me.chatId}),me.chatId===e){const Ae=jJ(o.projectGroups,me.chatId);n(Ae?`/chat/${Ae}`:"/")}}catch(Ae){y(Ae instanceof Error?Ae.message:String(Ae))}}async function Ii(me){const Se=await r.prompt({title:"Rename Chat",placeholder:"Chat name",initialValue:me.title,confirmLabel:"Rename"}),Ae=Se==null?void 0:Se.trim();if(!(!Ae||Ae===me.title))try{await i.command({type:"chat.rename",chatId:me.chatId,title:Ae}),y(null)}catch($e){y($e instanceof Error?$e.message:String($e))}}async function Jn(me,Se){try{await i.command({type:"chat.setFeature",chatId:me,featureId:Se}),y(null)}catch(Ae){y(Ae instanceof Error?Ae.message:String(Ae))}}async function Ee(me){var Ae,$e;const Se=(Pe==null?void 0:Pe.localPath)??((Ae=c==null?void 0:c.projects[0])==null?void 0:Ae.localPath)??(($e=o.projectGroups[0])==null?void 0:$e.localPath);if(Se)try{y(null),await iS({socket:i,action:me,localPath:Se})}catch(Ue){y(Ue instanceof Error?Ue.message:String(Ue))}}function Je(){var $e;const me=e?td(o.projectGroups,e):null,Se=e?nP(o.projectGroups,e):null;if(me&&Se){y(null),ge(Se,me.featureId??void 0);return}const Ae=FJ({selectedProjectId:T,sidebarProjectId:($e=o.projectGroups[0])==null?void 0:$e.groupKey,fallbackLocalProjectPath:Nt});if(Ae){y(null),ii(Ae);return}y("Open a project first")}async function Ct(me,Se,Ae){if(!e)return;const $e=et({_id:`${Aw}${Xi()}`,createdAt:Date.now(),kind:"tool_result",toolId:me,content:{answers:Ae},isError:!1});try{await i.command({type:"chat.respondTool",chatId:e,toolUseId:me,result:{questions:Se,answers:Ae}})}catch(Ue){$e(),y(Ue instanceof Error?Ue.message:String(Ue))}}async function On(me,Se,Ae,$e,Ue){if(!e)return;const Vt={confirmed:Se,...Ae?{clearContext:!0}:{},...$e?{message:$e}:{},...Ue?{attachments:Ue}:{}},Pn=et({_id:`${Aw}${Xi()}`,createdAt:Date.now(),kind:"tool_result",toolId:me,content:Vt,isError:!1});try{await i.command({type:"chat.respondTool",chatId:e,toolUseId:me,result:Vt}),Se&&wa.getState().setComposerPlanMode(!1)}catch(Jt){Pn(),Se&&wa.getState().setComposerPlanMode(!0),y(Jt instanceof Error?Jt.message:String(Jt))}}async function ur(me,Se,Ae){if(!e||!(Pe!=null&&Pe.projectId))return;const $e=Pe.projectId,Ue=td(o.projectGroups,e),Vt=(Ue==null?void 0:Ue.featureId)??void 0;try{const Pn=await GJ({socket:i,sourceChatId:e,toolUseId:me,projectId:$e,featureId:Vt,entry:Ae,planText:Se});wa.getState().setComposerPlanMode(!1),M($e),D(Pn.chatId),n(`/chat/${Pn.chatId}`),f(),y(null)}catch(Pn){throw y(Pn instanceof Error?Pn.message:String(Pn)),Pn}}const ts=x.useMemo(()=>({activeChatId:e,chatSnapshot:S,runtime:Pe,usage:_e,messages:Ge,latestToolIds:ze,availableProviders:_t,processingStatus:je,isChatLoading:Ze,isRefreshingActiveChat:Y,isProcessing:Ft,canCancel:Tt,queueOutboundAllowed:kt,chatReady:R,pendingChatId:A,selectedProjectId:T,startingLocalPath:W,hasSelectedProject:nn,navbarLocalPath:Dn,scrollRef:oe,inputRef:de,transcriptPaddingBottom:dn,showScrollButton:Ht,hasOlderMessages:H,oldestLoadedEntryId:B,isLoadingOlderMessages:U,updateScrollState:vn,scrollToBottom:bn,loadOlderMessages:an,createChatForProject:ln,handleCreateChat:ge,handleConfirmCreateFeature:rt,handleOpenLocalProject:st,handleCreateProject:Rn,handleSend:Tn,handleRemoveQueuedOutbound:Qn,handleUpdateQueuedOutbound:Zn,handleCancel:An,handleRenameChat:Ii,handleDeleteChat:Ut,handleSetChatFeature:Jn,handleOpenExternal:Ee,handleCompose:Je,handleAskUserQuestion:Ct,handleExitPlanMode:On,handleHandoff:ur,isCreatingFeature:I}),[e,_t,Tt,kt,R,S,ln,v,r,In,Nt,Ct,An,Je,rt,ge,Rn,Ut,On,ur,Ee,st,Qn,Zn,Tn,Jn,Ii,nn,H,Ze,I,U,Ft,Y,ze,an,Ge,Dn,n,B,A,je,s,Pe,T,y,Ht,o.projectGroups,W,bn,i,dn,vn,_e]);return g.jsx(p7.Provider,{value:ts,children:t})}function g7(){const t=x.useContext(p7);if(!t)throw new Error("useChatContext must be used within ChatProvider");return t}const Dg=Gr()(gi(t=>({renderMode:"unified",wrapLines:!1,setRenderMode:e=>t({renderMode:e}),setWrapLines:e=>t({wrapLines:e})}),{name:"diff-view-preferences",version:1})),Ig="How can I help you?",F_e=19,a4=72,H_e=48,Og="max-w-[800px] md:max-w-[920px]",U_e=5e3;function V_e(t){return t.isRefreshingActiveChat&&t.messageCount>0}function G_e(t){return t.messageCount>0?null:t.isChatLoading?"loading":t.isProviderRecovering?"recovering":t.isProviderUnavailable?"unavailable":t.isProcessing?null:"empty"}function W_e(t){return t.startsWith("/")||t==="~"||t.startsWith("~/")||/^[A-Za-z]:[\\/]/u.test(t)}function q_e(t,e){const n=t.includes("\\")&&!t.includes("/")?"\\":"/",r=t.replace(/[\\/]+$/u,""),i=e.replace(/^[\\/]+/u,"");return`${r}${n}${i}`}function K_e(){var In,bn,an,ln,xr,ri,ii,ge,rt,st,Rn,Tn,Qn,Zn,An,Ut,Ii,Jn;const t=Sb(),e=gp(),n=Qd(),r=G2(),i=g7(),s=Xd(),o={...e,...n,...r,...i,...s},l=QO(Ee=>Ee.isOpen),c=x.useRef(null),d=x.useRef(null),f=x.useRef(null),[h,m]=x.useState(""),[v,_]=x.useState(!1),[y,S]=x.useState(0),[C,R]=x.useState(!1),[k,T]=x.useState(null),[M,A]=x.useState(0),D=x.useRef(((In=o.runtime)==null?void 0:In.planMode)??!1),z=x.useRef(null),G=x.useRef(o.activeChatId),[$,H]=x.useState(null),F=qb("(min-width: 768px)"),B=typeof window>"u"?!0:lfe(window.location.hostname),j=((bn=o.runtime)==null?void 0:bn.projectId)??o.selectedProjectId??((an=o.sidebarData.projectGroups[0])==null?void 0:an.groupKey)??null,U=((ln=o.runtime)==null?void 0:ln.localPath)??o.navbarLocalPath??j??"unknown",P=x.useMemo(()=>kr.chatPlanMode(o.activeChatId??j??"composer"),[j,o.activeChatId]),q=kl(Ee=>j?Ee.projects[j]:void 0)??mfe,Y=id(Ee=>ij(Ee,j))??bw,N=kl(Ee=>Ee.addTerminal),I=kl(Ee=>Ee.removeTerminal),V=kl(Ee=>Ee.toggleVisibility),L=kl(Ee=>Ee.resetMainSizes),J=kl(Ee=>Ee.setMainSizes),te=kl(Ee=>Ee.setTerminalSizes),ee=id(Ee=>Ee.toggleVisibility),oe=id(Ee=>Ee.setVisibility),ie=id(Ee=>Ee.setSize),ue=id(Ee=>Ee.adoptLegacyLayout),fe=Dv(Ee=>Ee.scrollbackLines),de=Dv(Ee=>Ee.minColumnWidth),Z=o.keybindings,ne=wa(Ee=>Ee.composerState.provider),ae=cx(Ee=>Ee.pullRequestPrompt),Q=cx(Ee=>Ee.pullRequestUpdatePrompt),xe=cx(Ee=>Ee.pullRequestProviders),le=Dg(Ee=>Ee.renderMode),Te=Dg(Ee=>Ee.setRenderMode),Le=Dg(Ee=>Ee.wrapLines),Xe=Dg(Ee=>Ee.setWrapLines),ht=x.useMemo(()=>({pullRequestPrompt:ae,pullRequestUpdatePrompt:Q,pullRequestProviders:xe}),[ae,xe,Q]),Ke=x.useMemo(()=>JO(Z),[Z]),it=((xr=o.runtime)==null?void 0:xr.provider)??ne,dt=V_e({isRefreshingActiveChat:o.isRefreshingActiveChat,messageCount:o.messages.length}),vt=G_e({isChatLoading:o.isChatLoading,isProviderRecovering:o.activeChatId!==null&&((ri=o.chatSnapshot)==null?void 0:ri.transcript.hydrationState)==="provider"&&o.chatSnapshot.transcript.hasOlder,isProviderUnavailable:o.activeChatId!==null&&((ii=o.chatSnapshot)==null?void 0:ii.transcript.hydrationState)==="provider"&&!o.chatSnapshot.transcript.hasOlder,isProcessing:o.isProcessing,messageCount:o.messages.length}),he=x.useMemo(()=>gA({currentProvider:it,settings:ht}),[it,ht]),Re=q.terminals.length>0,Oe=!!(j&&q.isVisible&&Re),Ve=!!(j&&Re),Fe=!!(j&&Y.isVisible),We=!!(j&&!F&&Fe),Ye=!!(j&&F),tt=Math.max(80,o.transcriptPaddingBottom-H_e),{isAnimating:et,mainPanelGroupRef:ct,terminalFocusRequestVersion:nt,terminalPanelRef:Pt,terminalVisualRef:xt}=Afe({showTerminalPane:Oe,shouldRenderTerminalLayout:Ve,projectId:j,terminalLayout:q,chatInputRef:f}),{isAnimating:bt,panelGroupRef:He,sidebarPanelRef:Ge,sidebarVisualRef:ze}=kfe({projectId:j,shouldRenderRightSidebarLayout:Ye,showRightSidebar:Fe,rightSidebarSize:Y.size});Z0e({rootRef:d,fallbackRef:f,enabled:o.hasSelectedProject&&o.processingStatus!=="waiting_for_user",canCancel:o.canCancel}),x.useEffect(()=>{G.current=o.activeChatId},[o.activeChatId]),x.useEffect(()=>{j&&ue(j)},[ue,j]),x.useEffect(()=>{var Ee;k===null&&(D.current=((Ee=o.runtime)==null?void 0:Ee.planMode)??!1)},[k,o.activeChatId,(ge=o.runtime)==null?void 0:ge.planMode]),x.useEffect(()=>{var Ct;const Ee=((Ct=o.runtime)==null?void 0:Ct.planMode)??!1;if(k===null){D.current=Ee;return}const Je=z.current;if(!Je){D.current=Ee;return}if(o.activeChatId===null){Xm(Je),z.current=null,T(null),D.current=Ee;return}k.chatId===o.activeChatId&&Ee!==k.originalRuntimePlanMode&&(Ee!==k.value&&wa.getState().setComposerPlanMode(Ee),Xm(Je),z.current=null,T(null),D.current=Ee)},[k,o.activeChatId,(rt=o.runtime)==null?void 0:rt.planMode]);const Pe=()=>{if(j){if(Re){R(!1),V(j);return}N(j)}},_e=()=>{R(Ee=>!Ee)},je=Ee=>{var ur;if(!j||!Oe||et.current)return;const Je=Ee.chat,Ct=Ee.terminal;if(!Number.isFinite(Je)||!Number.isFinite(Ct))return;const On=((ur=c.current)==null?void 0:ur.getBoundingClientRect().height)??0;if(bfe(On,Ct)){L(j),V(j);return}J(j,[Je,Ct])};function Ze(){!j||!Fe||o.socket.command({type:"project.refreshDiffs",projectId:j}).catch(()=>{})}function _t(Ee){var On;const Je=((On=o.runtime)==null?void 0:On.localPath)??o.navbarLocalPath??null,Ct=!Je||W_e(Ee)?Ee:q_e(Je,Ee);o.handleOpenLocalLink({path:Ct})}async function Ft(Ee){const Je=G.current;if(!Je)return await t.alert({title:"No active chat",description:"Open or create a chat before generating a commit message from the diff.",closeLabel:"OK"}),{subject:"",body:""};try{return await o.socket.command({type:"chat.generateCommitMessage",chatId:Je,paths:Ee.paths})}catch(Ct){return await t.alert({title:"Unable to generate commit message",description:Ct instanceof Error?Ct.message:"Kaizen could not generate a commit message.",closeLabel:"OK"}),{subject:"",body:""}}}async function Tt(Ee){const Je=G.current;if(!Je)return await t.alert({title:"No active chat",description:"Open or create a chat before committing selected diff files.",closeLabel:"OK"}),null;try{const Ct=await o.socket.command({type:"chat.commitDiffs",chatId:Je,paths:Ee.paths,summary:Ee.summary,description:Ee.description,mode:Ee.mode});return Ct.snapshotChanged&&Ze(),Ct.ok||await t.alert({title:Ct.title,description:Ct.detail?`${Ct.message}
2499
2499
 
2500
- ${Ct.detail}`:Ct.message,closeLabel:"OK"}),Ct}catch(Ct){return await t.alert({title:"Unable to commit changes",description:Ct instanceof Error?Ct.message:"Kaizen could not create the commit.",closeLabel:"OK"}),null}}x.useEffect(()=>{if(o.messages.length!==0)return;m(""),_(!1);let Ee=0;const Je=window.setInterval(()=>{Ee+=1,m(Ig.slice(0,Ee)),Ee>=Ig.length&&(window.clearInterval(Je),_(!0))},F_e);return()=>window.clearInterval(Je)},[o.activeChatId,o.messages.length]),x.useEffect(()=>{function Ee(Je){if(j){if(Il(Ke,"toggleEmbeddedTerminal",Je)){Je.preventDefault(),Pe();return}if(Il(Ke,"toggleRightSidebar",Je)){Je.preventDefault(),ee(j);return}if(Il(Ke,"openInFinder",Je)){if(!B)return;Je.preventDefault(),o.handleOpenExternal("open_finder");return}if(Il(Ke,"openInEditor",Je)){if(!B)return;Je.preventDefault(),o.handleOpenExternal("open_editor");return}Il(Ke,"addSplitTerminal",Je)&&(Je.preventDefault(),N(j))}}return window.addEventListener("keydown",Ee),()=>window.removeEventListener("keydown",Ee)},[N,B,Re,j,Ke,ee,V]),x.useEffect(()=>{Oe||R(!1)},[Oe]),x.useEffect(()=>{const Ee=window.requestAnimationFrame(()=>{o.updateScrollState()}),Je=window.setTimeout(()=>{o.updateScrollState()},ud);return()=>{window.cancelAnimationFrame(Ee),window.clearTimeout(Je)}},[Ve,Oe,o.updateScrollState]),x.useEffect(()=>{function Ee(){o.updateScrollState()}return window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[o.updateScrollState]),x.useEffect(()=>{if(!j||!Fe){H(null);return}const Ee=()=>{document.visibilityState==="visible"&&Ze()};Ee();const Je=window.setInterval(()=>{Ee()},U_e),Ct=()=>{Ee()},On=()=>{Ee()};return document.addEventListener("visibilitychange",Ct),window.addEventListener("focus",On),()=>{window.clearInterval(Je),document.removeEventListener("visibilitychange",Ct),window.removeEventListener("focus",On)}},[j,Fe,o.socket]),x.useEffect(()=>{if(H(null),!(!j||!Fe))return o.socket.subscribe({type:"project-diffs",projectId:j},Ee=>{H(Ee)})},[j,Fe,o.socket]),x.useEffect(()=>{const Ee=c.current;if(!Ee||!Ve)return;const Je=()=>{const On=Ee.getBoundingClientRect().height;if(On<=0)return;const ur=On*(q.mainSizes[1]/100);ur<=0||S(ts=>Math.abs(ts-ur)<1?ts:ur)},Ct=new ResizeObserver(Je);return Ct.observe(Ee),Je(),()=>Ct.disconnect()},[j,Ve,q.mainSizes]);const kt=Ee=>Number.isFinite(Ee)?Math.max(R2,Ee):Y.size,dn=()=>{j&&oe(j,!1)};function Ht(){var Ee,Je;return((Ee=o.runtime)==null?void 0:Ee.projectId)??o.selectedProjectId??((Je=o.sidebarData.projectGroups[0])==null?void 0:Je.groupKey)??null}async function Nt(Ee){const Je=Ht();if(!Je)throw new Error("Open a project first");const Ct=await o.socket.command({type:"feature.create",projectId:Je,title:Ee,description:"",generateOverview:bd.getState().showFeatureOverviewInSidebar});await o.handleCreateChat(Je,Ct.featureId)}function Dn(){const Ee=Ht();if(!Ee)throw new Error("Open a project first");o.handleCreateFeature(Ee)}async function nn(Ee,Je){var On,ur;const Ct=Ee.text.trim();if(Ct.startsWith("/")){const ts=((On=o.runtime)==null?void 0:On.provider)??(Je==null?void 0:Je.provider)??ne,_i=gA({currentProvider:ts,settings:ht}),Pr=(ur=Ct.split(" ")[0])==null?void 0:ur.slice(1).toLowerCase(),Bn=_i.find(me=>me.name.toLowerCase()===Pr);if(Bn!=null&&Bn.handler){const me={handleCompose:o.handleCompose,setPlanMode:Ae=>{var $e;if(!(k!==null&&k.chatId!==o.activeChatId)){if(wa.getState().setComposerPlanMode(Ae),o.activeChatId){const Ue=(($e=o.runtime)==null?void 0:$e.planMode)??!1;if(Ae===Ue){Xm(P),z.current=null,T(null);return}z.current=P,VO(P,{statusLabel:Ae?"Switching to plan mode...":"Switching to implement mode..."}),T({chatId:o.activeChatId,originalRuntimePlanMode:Ue,value:Ae})}else Xm(P),z.current=null,T(null);A(Ue=>Ue+1)}},sendMessage:(Ae,$e)=>o.handleSend(Ae,$e),openFeatureModal:Dn,createFeature:Nt},Se=Ct.slice(Pr!=null&&Pr.length?Pr.length+1:0).trim();await Bn.handler(me,{commandText:Ct,remainder:Se,message:Ee,options:Je});return}}return o.handleSend(Ee,Je)}const vn=g.jsxs(uP,{ref:d,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[g.jsxs(fP,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[g.jsx(Cee,{sidebarCollapsed:o.sidebarCollapsed,hasCompletedChats:o.completedChatIds.size>0,onOpenSidebar:o.openSidebar,onExpandSidebar:o.expandSidebar,usage:o.usage,localPath:o.navbarLocalPath,embeddedTerminalVisible:Oe,onToggleEmbeddedTerminal:j?Pe:void 0,rightSidebarVisible:Fe,onToggleRightSidebar:j?()=>ee(j):void 0,onOpenExternal:B?Ee=>{o.handleOpenExternal(Ee)}:void 0,editorLabel:o.editorLabel,projectId:j??void 0,socket:o.socket,finderShortcut:B?Ke.bindings.openInFinder:void 0,editorShortcut:B?Ke.bindings.openInEditor:void 0,terminalShortcut:Ke.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:Ke.bindings.toggleRightSidebar}),g.jsxs(rj,{ref:o.scrollRef,onScroll:o.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[(st=o.runtime)!=null&&st.inactiveProviderMessage?g.jsxs("div",{className:we("mx-auto mt-[72px] rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-900 dark:text-amber-200",Og),children:["This thread uses ",o.runtime.provider,", which is currently inactive. ",o.runtime.inactiveProviderMessage]}):null,o.messages.length===0&&!o.isProcessing?g.jsx("div",{style:{height:o.transcriptPaddingBottom},"aria-hidden":"true"}):null,o.messages.length>0||o.isProcessing?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:we("mx-auto animate-fade-in space-y-5 pt-[72px]",Og),children:[o.messages.length>0?g.jsx(K0e,{messages:o.messages,isLoading:o.isProcessing,hasOlderMessages:o.hasOlderMessages,oldestLoadedEntryId:o.oldestLoadedEntryId,isLoadingOlderMessages:o.isLoadingOlderMessages,isAtBottom:o.showScrollButton===!1,localPath:(Rn=o.runtime)==null?void 0:Rn.localPath,latestToolIds:o.latestToolIds,pendingTool:((Tn=o.runtime)==null?void 0:Tn.pendingTool)??null,onOpenLocalLink:o.handleOpenLocalLink,onAskUserQuestionSubmit:o.handleAskUserQuestion,onExitPlanModeConfirm:o.handleExitPlanMode,onHandoff:o.handleHandoff,onLoadOlder:o.loadOlderMessages,availableProviders:o.availableProviders,scrollContainerRef:o.scrollRef}):null,o.isProcessing?g.jsx(afe,{status:o.processingStatus}):null,o.commandError?g.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:o.commandError}):null]}),g.jsx("div",{style:{height:o.transcriptPaddingBottom},"aria-hidden":"true"})]}):null]}),dt?g.jsx("div",{className:"pointer-events-none absolute inset-x-4 z-20 animate-fade-in",style:{top:a4,bottom:o.transcriptPaddingBottom},children:g.jsx("div",{className:we("mx-auto flex h-full items-center justify-center",Og),children:g.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-background/90 px-4 py-2 text-sm text-muted-foreground shadow-sm backdrop-blur",children:[g.jsx(Vn,{className:"size-4 animate-spin"}),g.jsx("span",{children:"Refreshing chat…"})]})})}):null,vt?g.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:a4,bottom:o.transcriptPaddingBottom},children:g.jsx("div",{className:we("mx-auto flex h-full items-center justify-center",Og),children:g.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[g.jsx(md,{className:"size-8 text-muted-foreground kaizen-empty-state-flower"}),vt==="loading"||vt==="recovering"||vt==="unavailable"?g.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[vt==="unavailable"?null:g.jsx(Vn,{className:"size-10 animate-spin text-muted-foreground/80"}),g.jsx("div",{className:"text-sm text-muted-foreground/90",children:vt==="recovering"?"Recovering chat…":vt==="unavailable"?"Chat history is unavailable.":"Loading chat…"})]}):g.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kaizen-empty-state-text","aria-label":Ig,children:g.jsxs("span",{className:"relative inline-grid place-items-start",children:[g.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[g.jsx("span",{children:Ig}),g.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true"})]}),g.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[g.jsx("span",{children:h}),g.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true",children:g.jsx("span",{className:"kaizen-typewriter-cursor","data-typing-complete":v?"true":"false"})})]})]})})]})})},o.activeChatId??"new-chat"):null,g.jsx("div",{style:{bottom:tt},className:we("pointer-events-none absolute left-1/2 -translate-x-1/2 z-30 transition-all",o.showScrollButton&&!l?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:g.jsx("button",{onClick:o.scrollToBottom,style:{lineHeight:0},className:"pointer-events-auto h-9 w-9 grid place-items-center transition-colors bg-background/80 dark:bg-card/40 backdrop-blur-lg hover:bg-muted/80 border border-border rounded-full cursor-pointer text-foreground/80 hover:text-foreground",children:g.jsx(H$,{style:{display:"block"},className:"h-4 w-4"})})})]}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:g.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:o.inputRef,children:g.jsx(_ee,{ref:f,onSubmit:nn,onCancel:()=>{o.handleCancel()},disabled:!o.hasSelectedProject||((Qn=o.runtime)==null?void 0:Qn.status)==="waiting_for_user"||!!((Zn=o.runtime)!=null&&Zn.inactiveProviderMessage),canCancel:o.canCancel,chatId:o.activeChatId,activeProvider:((An=o.runtime)==null?void 0:An.provider)??null,activeModel:((Ut=o.runtime)==null?void 0:Ut.model)??null,activePlanMode:((Ii=o.runtime)==null?void 0:Ii.planMode)??!1,availableProviders:o.availableProviders,keybindings:Ke,slashCommands:he,requestedPlanMode:(k==null?void 0:k.chatId)===o.activeChatId?k.value:null,requestedPlanModeVersion:M,pendingPlanMode:(k==null?void 0:k.chatId)===o.activeChatId?k.value:null,queueOutboundAllowed:o.queueOutboundAllowed,queuedOutbound:(Jn=o.runtime)==null?void 0:Jn.queuedOutbound,onRemoveQueued:o.handleRemoveQueuedOutbound,onUpdateQueued:o.handleUpdateQueuedOutbound},o.activeChatId??"new-chat")})})]});return g.jsxs("div",{ref:c,className:"flex-1 flex flex-col min-w-0 relative",children:[Ye&&j?g.jsxs(Jg,{groupRef:He,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Ee=>{var Ct;if(!Fe||bt.current)return;const Je=kt(Ee.rightSidebar);Math.abs(Je-Ee.rightSidebar)<.1||(Ct=He.current)==null||Ct.setLayout({workspace:100-Je,rightSidebar:Je})},onLayoutChanged:Ee=>{!Fe||bt.current||ie(j,kt(Ee.rightSidebar))},children:[g.jsx(Cc,{id:"workspace",defaultSize:`${100-Y.size}%`,minSize:"20%",className:"min-h-0 min-w-0",children:Ve?g.jsxs(Jg,{groupRef:ct,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:je,children:[g.jsx(Cc,{id:"chat",defaultSize:`${q.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:vn}),g.jsx(ev,{withHandle:!0,orientation:"vertical",disabled:!Oe,className:we(!Oe&&"pointer-events-none opacity-0")}),g.jsx(Cc,{id:"terminal",defaultSize:`${q.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:Pt,children:g.jsx("div",{ref:xt,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":Oe?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${ud}ms`},children:g.jsx("div",{style:y>0?{height:`${y}px`}:void 0,children:C?null:g.jsx(B1,{projectId:j,layout:q,onAddTerminal:N,socket:o.socket,connectionStatus:o.connectionStatus,scrollback:fe,minColumnWidth:de,maximized:!1,splitTerminalShortcut:Ke.bindings.addSplitTerminal,focusRequestVersion:nt,onToggleMaximized:_e,onRemoveTerminal:(Ee,Je)=>{o.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),I(Ee,Je)},onTerminalLayout:te})})})})]},j):vn}),g.jsx(ev,{withHandle:!0,orientation:"horizontal",disabled:!Fe,className:we(!Fe&&"pointer-events-none opacity-0")}),g.jsx(Cc,{id:"rightSidebar",defaultSize:`${Y.size}%`,className:"min-h-0 min-w-0",elementRef:Ge,children:g.jsx("div",{ref:ze,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":Fe?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${ud}ms`},children:g.jsx(V3,{projectId:j,disclosureStorageKey:U,diffs:$,diffRenderMode:le,wrapLines:Le,onOpenFile:_t,onGenerateCommitMessage:Ft,onCommit:Tt,onDiffRenderModeChange:Te,onWrapLinesChange:Xe,onClose:()=>oe(j,!1)})})})]},`${j}-right-sidebar`):Ve&&j?g.jsxs(Jg,{groupRef:ct,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:je,children:[g.jsx(Cc,{id:"chat",defaultSize:`${q.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:vn}),g.jsx(ev,{withHandle:!0,orientation:"vertical",disabled:!Oe,className:we(!Oe&&"pointer-events-none opacity-0")}),g.jsx(Cc,{id:"terminal",defaultSize:`${q.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:Pt,children:g.jsx("div",{ref:xt,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":Oe?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${ud}ms`},children:g.jsx("div",{style:y>0?{height:`${y}px`}:void 0,children:C?null:g.jsx(B1,{projectId:j,layout:q,onAddTerminal:N,socket:o.socket,connectionStatus:o.connectionStatus,scrollback:fe,minColumnWidth:de,maximized:!1,splitTerminalShortcut:Ke.bindings.addSplitTerminal,focusRequestVersion:nt,onToggleMaximized:_e,onRemoveTerminal:(Ee,Je)=>{o.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),I(Ee,Je)},onTerminalLayout:te})})})})]},j):vn,C&&j&&Oe?g.jsx("div",{className:"absolute inset-0 z-30 flex min-h-0 min-w-0 flex-col bg-background/96 backdrop-blur-sm",children:g.jsx(B1,{projectId:j,layout:q,onAddTerminal:N,socket:o.socket,connectionStatus:o.connectionStatus,scrollback:fe,minColumnWidth:de,maximized:!0,splitTerminalShortcut:Ke.bindings.addSplitTerminal,focusRequestVersion:nt,onToggleMaximized:_e,onRemoveTerminal:(Ee,Je)=>{o.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),I(Ee,Je)},onTerminalLayout:te})}):null,We?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 md:hidden"}),g.jsx("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-2xl md:hidden",children:g.jsx(V3,{projectId:j,disclosureStorageKey:U,diffs:$,diffRenderMode:le,wrapLines:Le,onOpenFile:_t,onGenerateCommitMessage:Ft,onCommit:Tt,onDiffRenderModeChange:Te,onWrapLinesChange:Xe,onClose:dn,className:"h-[var(--app-shell-height)]"})})]}):null]})}const Y_e="web+kaizen";function Mw(t){return!t||!t.startsWith("/")||t.startsWith("//")?"/":t}function X_e(t){const e=new URLSearchParams(t),n=Mw(e.get("target"));if(n!=="/")return n;const r=e.get("launch");if(!r)return"/";try{const i=new URL(r);return Mw(i.searchParams.get("target"))}catch{return"/"}}function Q_e(t){const e=new URL(`${Y_e}://open`);return e.searchParams.set("target",Mw(t)),e.toString()}function Z_e(t){return t.innerWidth<=820||t.matchMedia("(pointer: coarse)").matches}function J_e(t){return/\b(?:Chrome|CriOS|Edg|EdgA|EdgiOS)\b/i.test(t)}function eye(t){return/iPhone|iPad|iPod/i.test(t)?"In Safari, tap Share, then Add to Home Screen.":/Android/i.test(t)?"Use your browser menu to install Kaizen to the home screen.":"Use your browser install action to save Kaizen as an app, or continue in the browser."}function tye(){const t=ke.c(29),e=pi(),n=eP();let r;t[0]!==e.search?(r=X_e(e.search),t[0]=e.search,t[1]=r):r=t[1];const i=r,[s,o]=x.useState(!1),[l,c]=x.useState(null);let d,f;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const H=function(B){B.preventDefault(),c(B)};return window.addEventListener("beforeinstallprompt",H),()=>{window.removeEventListener("beforeinstallprompt",H)}},f=[],t[2]=d,t[3]=f):(d=t[2],f=t[3]),x.useEffect(d,f);let h,m;t[4]!==n||t[5]!==e.search||t[6]!==i?(h=()=>{if(n){window.location.replace(i);return}if(new URLSearchParams(e.search).has("launch")){window.location.replace(i);return}if(!Z_e(window)){window.location.replace(i);return}if(!J_e(navigator.userAgent)){o(!0);return}const B=Q_e(i),j=window.setTimeout(()=>{o(!0)},900),U=()=>{document.visibilityState==="hidden"&&window.clearTimeout(j)};return document.addEventListener("visibilitychange",U),window.location.assign(B),()=>{window.clearTimeout(j),document.removeEventListener("visibilitychange",U)}},m=[n,e.search,i],t[4]=n,t[5]=e.search,t[6]=i,t[7]=h,t[8]=m):(h=t[7],m=t[8]),x.useEffect(h,m);let v;t[9]!==l?(v=async function(){l&&(await l.prompt(),await l.userChoice.catch(nye),c(null))},t[9]=l,t[10]=v):v=t[10];const _=v;let y;t[11]===Symbol.for("react.memo_cache_sentinel")?(y=eye(navigator.userAgent),t[11]=y):y=t[11];const S=y;let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-[radial-gradient(circle_at_center,rgba(249,115,22,0.12),transparent_68%)] dark:bg-[radial-gradient(circle_at_center,rgba(251,146,60,0.14),transparent_68%)]"}),t[12]=C):C=t[12];let R,k;t[13]===Symbol.for("react.memo_cache_sentinel")?(R=g.jsx("div",{className:"mb-6 inline-flex rounded-full border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:border-orange-400/30 dark:bg-orange-400/10 dark:text-orange-200",children:"Remote handoff"}),k=g.jsxs("h1",{className:"font-logo text-3xl leading-none tracking-tight",children:["Open ",Qs]}),t[13]=R,t[14]=k):(R=t[13],k=t[14]);const T=s?"Kaizen could not jump straight into the installed app on this device. You can keep going in the browser or install it for one-tap launches next time.":"Trying to open your installed Kaizen app. If it does not switch automatically, use the browser fallback below.";let M;t[15]!==T?(M=g.jsx("p",{className:"mt-3 text-sm leading-6 text-slate-600 dark:text-slate-300",children:T}),t[15]=T,t[16]=M):M=t[16];let A;t[17]!==i?(A=g.jsx(tp,{to:i,className:"block rounded-2xl bg-slate-950 px-4 py-3 text-center text-sm font-semibold text-white transition hover:bg-slate-800 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:"Continue in browser"}),t[17]=i,t[18]=A):A=t[18];let D;t[19]!==_||t[20]!==l?(D=l?g.jsx("button",{type:"button",onClick:()=>{_()},className:"block w-full rounded-2xl border border-orange-300 bg-orange-50 px-4 py-3 text-sm font-semibold text-orange-800 transition hover:bg-orange-100 dark:border-orange-400/40 dark:bg-orange-400/10 dark:text-orange-100 dark:hover:bg-orange-400/20",children:"Install Kaizen"}):null,t[19]=_,t[20]=l,t[21]=D):D=t[21];let z;t[22]!==A||t[23]!==D?(z=g.jsxs("div",{className:"mt-6 space-y-3",children:[A,D]}),t[22]=A,t[23]=D,t[24]=z):z=t[24];let G;t[25]===Symbol.for("react.memo_cache_sentinel")?(G=g.jsxs("div",{className:"mt-6 rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 text-sm leading-6 text-slate-700 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-200",children:[g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"Install hint"}),g.jsx("p",{className:"mt-1",children:S})]}),t[25]=G):G=t[25];let $;return t[26]!==M||t[27]!==z?($=g.jsxs("main",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_top,rgba(241,245,249,0.96),rgba(255,255,255,1)_42%),linear-gradient(135deg,#fff8ef_0%,#ffffff_45%,#eef6ff_100%)] px-5 py-8 text-slate-950 dark:bg-[radial-gradient(circle_at_top,rgba(30,41,59,0.92),rgba(15,23,42,1)_46%),linear-gradient(135deg,#0f172a_0%,#111827_45%,#1f2937_100%)] dark:text-slate-50",children:[C,g.jsxs("section",{className:"relative w-full max-w-sm overflow-hidden rounded-[2rem] border border-white/70 bg-white/88 p-6 shadow-[0_30px_120px_-32px_rgba(15,23,42,0.42)] backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-900/88",children:[R,k,M,z,G]})]}),t[26]=M,t[27]=z,t[28]=$):$=t[28],$}function nye(){}const rye=3210;function iye(t,e){const n=new URLSearchParams(t),r=Number(n.get("localPort"));if(Number.isFinite(r)&&r>0)return Math.round(r);const i=Number(e);return Number.isFinite(i)&&i>0?Math.round(i):rye}function sye(t){return`tailscale serve --bg --https 443 http://127.0.0.1:${String(t)}`}function oye(t){return new URLSearchParams(t).get("reason")==="serve_permission_denied"?"serve_permission_denied":null}function aye(t){const n=new URLSearchParams(t).get("setupCommand");return n!=null&&n.trim()?n:null}const lye="https://tailscale.com/download",cye="https://tailscale.com/kb/1242/tailscale-serve",uye="https://tailscale.com/docs/how-to/set-up-https-certificates";function dye(){const t=ke.c(35),e=pi();let n;t[0]!==e.search?(n=iye(e.search,window.location.port),t[0]=e.search,t[1]=n):n=t[1];const r=n;let i;t[2]!==e.search?(i=oye(e.search),t[2]=e.search,t[3]=i):i=t[3];const s=i;let o;t[4]!==e.search?(o=aye(e.search),t[4]=e.search,t[5]=o):o=t[5];const l=o;let c;t[6]!==r?(c=sye(r),t[6]=r,t[7]=c):c=t[7];const d=c;let f;t[8]===Symbol.for("react.memo_cache_sentinel")?(f=g.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-[radial-gradient(circle_at_center,rgba(249,115,22,0.12),transparent_68%)] dark:bg-[radial-gradient(circle_at_center,rgba(251,146,60,0.14),transparent_68%)]"}),t[8]=f):f=t[8];let h,m,v;t[9]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx("div",{className:"mb-6 inline-flex rounded-full border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:border-orange-400/30 dark:bg-orange-400/10 dark:text-orange-200",children:"Remote setup"}),m=g.jsxs("h1",{className:"font-logo text-3xl leading-none tracking-tight",children:["Enable remote ",Qs]}),v=g.jsx("p",{className:"mt-3 text-sm leading-6 text-slate-600 dark:text-slate-300",children:"Kaizen remote mode works best over Tailscale. If HTTPS handoff is not ready yet, use the steps below to install Tailscale, join your tailnet, and expose this local Kaizen session through Tailscale Serve."}),t[9]=h,t[10]=m,t[11]=v):(h=t[9],m=t[10],v=t[11]);let _;t[12]!==l||t[13]!==s?(_=s==="serve_permission_denied"&&l?g.jsxs("section",{className:"mt-6 rounded-2xl border border-orange-300 bg-orange-50/90 p-4 text-sm leading-6 text-orange-950 dark:border-orange-400/40 dark:bg-orange-400/10 dark:text-orange-100",children:[g.jsx("p",{className:"font-semibold",children:"One-time machine setup needed"}),g.jsx("p",{className:"mt-1",children:"Tailscale is connected, but this user is not allowed to change Serve config yet. Run this once on the Kaizen machine:"}),g.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:g.jsx("code",{children:l})})]}):null,t[12]=l,t[13]=s,t[14]=_):_=t[14];let y,S;t[15]===Symbol.for("react.memo_cache_sentinel")?(S=g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"1. Install and connect Tailscale"}),y=g.jsx("p",{className:"mt-1 text-slate-700 dark:text-slate-200",children:"Install Tailscale on this machine and on the device you want to open Kaizen from. Then sign in and connect both devices to the same tailnet."}),t[15]=y,t[16]=S):(y=t[15],S=t[16]);let C;t[17]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[S,y,g.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[g.jsx("a",{href:lye,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Download Tailscale"}),g.jsx("code",{className:"rounded-xl bg-slate-950 px-3 py-2 text-xs text-slate-50 dark:bg-slate-950",children:"tailscale up"})]})]}),t[17]=C):C=t[17];let R,k;t[18]===Symbol.for("react.memo_cache_sentinel")?(R=g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"2. Turn on HTTPS handoff with Tailscale Serve"}),k=g.jsx("p",{className:"mt-1 text-slate-700 dark:text-slate-200",children:"Run this on the machine where Kaizen is already running. It tells Tailscale to publish your local Kaizen port behind your tailnet HTTPS URL."}),t[18]=R,t[19]=k):(R=t[18],k=t[19]);let T;t[20]!==d?(T=g.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:g.jsx("code",{children:d})}),t[20]=d,t[21]=T):T=t[21];let M;t[22]===Symbol.for("react.memo_cache_sentinel")?(M=g.jsx("p",{className:"mt-3 text-slate-700 dark:text-slate-200",children:"If Tailscale says Serve is not enabled on your tailnet, an admin needs to enable HTTPS certificates and Serve support first."}),t[22]=M):M=t[22];let A;t[23]===Symbol.for("react.memo_cache_sentinel")?(A=g.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[g.jsx("a",{href:cye,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Tailscale Serve docs"}),g.jsx("a",{href:uye,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Enable HTTPS certs"})]}),t[23]=A):A=t[23];let D;t[24]!==T?(D=g.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[R,k,T,M,A]}),t[24]=T,t[25]=D):D=t[25];let z;t[26]===Symbol.for("react.memo_cache_sentinel")?(z=g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"3. Start Kaizen remote mode again"}),t[26]=z):z=t[26];let G;t[27]===Symbol.for("react.memo_cache_sentinel")?(G=g.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:g.jsx("code",{children:"kaizen --remote"})}),t[27]=G):G=t[27];let $;t[28]===Symbol.for("react.memo_cache_sentinel")?($=g.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[z,G,g.jsxs("p",{className:"mt-3 text-slate-700 dark:text-slate-200",children:["Once Serve is ready, Kaizen should print an"," ",g.jsx("span",{className:"font-semibold",children:"https://…ts.net/open"})," QR handoff URL instead of the HTTP fallback."]})]}),t[28]=$):$=t[28];let H;t[29]!==D?(H=g.jsxs("div",{className:"mt-6 space-y-4 text-sm leading-6",children:[C,D,$]}),t[29]=D,t[30]=H):H=t[30];let F;t[31]===Symbol.for("react.memo_cache_sentinel")?(F=g.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:g.jsx(tp,{to:"/",className:"rounded-2xl bg-slate-950 px-4 py-3 text-sm font-semibold text-white transition hover:bg-slate-800 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:"Back to Kaizen"})}),t[31]=F):F=t[31];let B;return t[32]!==H||t[33]!==_?(B=g.jsxs("main",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_top,rgba(241,245,249,0.96),rgba(255,255,255,1)_42%),linear-gradient(135deg,#fff8ef_0%,#ffffff_45%,#eef6ff_100%)] px-5 py-8 text-slate-950 dark:bg-[radial-gradient(circle_at_top,rgba(30,41,59,0.92),rgba(15,23,42,1)_46%),linear-gradient(135deg,#0f172a_0%,#111827_45%,#1f2937_100%)] dark:text-slate-50",children:[f,g.jsxs("section",{className:"relative w-full max-w-2xl overflow-hidden rounded-[2rem] border border-white/70 bg-white/88 p-6 shadow-[0_30px_120px_-32px_rgba(15,23,42,0.42)] backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-900/88",children:[h,m,v,_,H,F]})]}),t[32]=H,t[33]=_,t[34]=B):B=t[34],B}function l4(){return{baselineEstablished:!1,dedupeByChatId:new Map,statusByChatId:new Map}}function fye(t){const e=[];for(const n of t.projectGroups){for(const r of n.generalChats)e.push({chat:r,projectTitle:n.title});for(const r of n.features)for(const i of r.chats)e.push({chat:i,projectTitle:n.title})}return e}function S1e(t=null){return Lp()?Notification.permission:t??"unsupported"}function w1e(t){return t==="granted"?"Allowed":t==="denied"?"Blocked":t==="default"?"Not requested":"Unsupported"}async function C1e(){return Lp()?Notification.requestPermission():"unsupported"}function Lp(){return typeof window<"u"&&window.isSecureContext&&typeof Notification<"u"}function hye({activeChatId:t,chatId:e,documentVisible:n}){return!n||t!==e}function v7(t){return t==="starting"||t==="running"}function pye(t,e){const n=v7(t),r=t==="waiting_for_user";return n&&e==="waiting_for_user"?"needs_input":(n||r)&&e==="idle"?"completed":null}function mye({activeChatId:t,documentVisible:e,previousState:n,sidebarData:r}){const i=new Map,s=new Map(n.dedupeByChatId),o=[],l=fye(r);for(const{chat:c,projectTitle:d}of l){const f=n.statusByChatId.get(c.chatId);if(i.set(c.chatId,c.status),(v7(c.status)||c.status==="failed")&&s.delete(c.chatId),!n.baselineEstablished)continue;const h=pye(f,c.status);h&&hye({activeChatId:t,chatId:c.chatId,documentVisible:e})&&s.get(c.chatId)!==h&&(s.set(c.chatId,h),o.push({chatId:c.chatId,chatTitle:c.title,eventId:`${c.chatId}:${h}:${Date.now()}`,projectTitle:d,kind:h}))}return{events:o,nextState:{baselineEstablished:!0,dedupeByChatId:s,statusByChatId:i}}}let fx=null;function gye(){if(typeof window>"u")return null;const t=window.AudioContext;return t?(fx||(fx=Promise.resolve(new t)),fx):null}function c4({audioContext:t,startAt:e,duration:n,frequency:r,gainValue:i}){const s=t.createOscillator(),o=t.createGain(),l=e+.012,c=e+Math.max(n-.08,.02),d=e+n;s.type="sine",s.frequency.setValueAtTime(r,e),o.gain.setValueAtTime(1e-4,e),o.gain.exponentialRampToValueAtTime(i,l),o.gain.setValueAtTime(i,c),o.gain.exponentialRampToValueAtTime(1e-4,d),s.connect(o),o.connect(t.destination),s.start(e),s.stop(d)}async function vye(){const t=await gye();if(!t)return;t.state==="suspended"&&await t.resume();const e=t.currentTime;c4({audioContext:t,startAt:e,duration:.24,frequency:880,gainValue:.14}),c4({audioContext:t,startAt:e+.12,duration:.34,frequency:1318.51,gainValue:.18})}function bye(t){typeof navigator>"u"||typeof navigator.vibrate!="function"||navigator.vibrate(t==="needs_input"?[180,100,180]:[120])}function _ye(t,e){if(!Lp()||Notification.permission!=="granted")return null;const n=new Notification(t.chatTitle,{body:t.kind==="needs_input"?`${t.projectTitle} needs your input in ${Qs}.`:`${t.projectTitle} finished responding in ${Qs}.`,tag:t.eventId!==void 0?`kaizen:${t.eventId}`:`kaizen:${t.chatId}:${t.kind}:${Date.now()}`,icon:"/app-icon-192.png",badge:"/app-icon-96.png",requireInteraction:t.kind==="needs_input"});return n.onclick=()=>{window.focus(),e(),n.close()},n}async function yye({event:t,onBrowserNotificationClick:e,preferences:n}){if(Lp()){if(n.browserNotificationsEnabled&&_ye(t,e),n.soundEnabled)try{await vye()}catch{}n.vibrationEnabled&&bye(t.kind)}}function xye(t){return{browserNotificationsEnabled:(t==null?void 0:t.browserNotificationsEnabled)===!0,soundEnabled:(t==null?void 0:t.soundEnabled)===!0,vibrationEnabled:(t==null?void 0:t.vibrationEnabled)===!0,lastPermissionState:(t==null?void 0:t.lastPermissionState)==="granted"||(t==null?void 0:t.lastPermissionState)==="denied"||(t==null?void 0:t.lastPermissionState)==="default"||(t==null?void 0:t.lastPermissionState)==="unsupported"?t.lastPermissionState:null}}function Sye(t){return t.signedIn&&t.browserNotificationsEnabled}const hx=Gr()(gi(t=>({browserNotificationsEnabled:!1,soundEnabled:!1,vibrationEnabled:!1,lastPermissionState:null,setBrowserNotificationsEnabled:e=>t({browserNotificationsEnabled:e}),setSoundEnabled:e=>t({soundEnabled:e}),setVibrationEnabled:e=>t({vibrationEnabled:e}),setLastPermissionState:e=>t({lastPermissionState:e})}),{name:"notification-preferences",migrate:t=>xye(t)}));function wye(t){const e=ke.c(15),{activeChatId:n,connectionStatus:r,sidebarData:i}=t,s=Xc(),{remoteAuth:o}=Qd(),l=Kb(o),c=hx(kye),d=hx(Eye),f=hx(Cye),h=Sye({browserNotificationsEnabled:c,signedIn:l.signedIn});let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=l4(),e[0]=m):m=e[0];const v=x.useRef(m),_=x.useRef(typeof document>"u"?!0:document.visibilityState==="visible");let y,S;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const M=function(){_.current=document.visibilityState==="visible"};return document.addEventListener("visibilitychange",M),()=>document.removeEventListener("visibilitychange",M)},S=[],e[1]=y,e[2]=S):(y=e[1],S=e[2]),x.useEffect(y,S);let C,R;e[3]!==r?(C=()=>{r!=="connected"&&(v.current={...l4(),dedupeByChatId:v.current.dedupeByChatId})},R=[r],e[3]=r,e[4]=C,e[5]=R):(C=e[4],R=e[5]),x.useEffect(C,R);let k,T;return e[6]!==l.features.browserNotifications.enabled||e[7]!==n||e[8]!==h||e[9]!==s||e[10]!==i||e[11]!==d||e[12]!==f?(k=()=>{if(!l.features.browserNotifications.enabled||!Lp())return;const{events:M,nextState:A}=mye({activeChatId:n,documentVisible:_.current,previousState:v.current,sidebarData:i});v.current=A;for(const D of M)yye({event:D,onBrowserNotificationClick:()=>{s(`/chat/${D.chatId}`)},preferences:{browserNotificationsEnabled:h,soundEnabled:d,vibrationEnabled:f}})},T=[n,l.features.browserNotifications.enabled,h,s,i,d,f],e[6]=l.features.browserNotifications.enabled,e[7]=n,e[8]=h,e[9]=s,e[10]=i,e[11]=d,e[12]=f,e[13]=k,e[14]=T):(k=e[13],T=e[14]),x.useEffect(k,T),null}function Cye(t){return t.vibrationEnabled}function Eye(t){return t.soundEnabled}function kye(t){return t.browserNotificationsEnabled}function Rye(){const t=typeof navigator<"u"&&navigator.standalone===!0,e=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches;return t||e}function Tye(){const t=window.visualViewport,e=Math.round((t==null?void 0:t.height)??window.innerHeight),n=Math.max(0,Math.round((t==null?void 0:t.offsetTop)??0));return{height:e,offsetTop:n}}function Aye(){const t=ke.c(1);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],x.useLayoutEffect(Mye,e)}function Mye(){let t=0,e=null,n=0;const r=Rye(),i=()=>{t=0;const{height:l,offsetTop:c}=Tye();e===null&&(e=c),l>n&&(n=l);const d=Math.max(0,c-e),f=n-l>120||d>12,h=document.documentElement;h.style.setProperty("--app-shell-height",`${l}px`),h.style.setProperty("--app-shell-offset-top",r?f?`max(0px, calc(${d}px - env(safe-area-inset-top)))`:"0px":`${d}px`),h.style.setProperty("--app-composer-bottom-padding",r?f?"0px":"max(12px, env(safe-area-inset-bottom))":f?"12px":"20px")},s=()=>{t!==0&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(i)};s();const o=window.visualViewport;return window.addEventListener("resize",s),window.addEventListener("orientationchange",s),o==null||o.addEventListener("resize",s),o==null||o.addEventListener("scroll",s),()=>{t!==0&&window.cancelAnimationFrame(t),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),o==null||o.removeEventListener("resize",s),o==null||o.removeEventListener("scroll",s)}}function Nye(t){const e=ke.c(7),{children:n,activeChatId:r,activeOverviewFeatureId:i}=t;let s;e[0]!==r||e[1]!==n?(s=g.jsx($_e,{activeChatId:r,children:n}),e[0]=r,e[1]=n,e[2]=s):s=e[2];let o;return e[3]!==r||e[4]!==i||e[5]!==s?(o=g.jsx(WJ,{children:g.jsx(XJ,{children:g.jsx(QJ,{children:g.jsx(w_e,{activeChatId:r,activeOverviewFeatureId:i,children:s})})})}),e[3]=r,e[4]=i,e[5]=s,e[6]=o):o=e[6],o}const Lye=`${lC}last-seen-version`,Dye=x.lazy(()=>X(()=>import("./FeatureOverviewPage-BirqNTQI.js"),__vite__mapDeps([101,102])).then(t=>({default:t.FeatureOverviewPage}))),Iye=x.lazy(()=>X(()=>import("./LocalProjectsPage-CUrz_W-H.js"),[]).then(t=>({default:t.LocalProjectsPage}))),Oye=x.lazy(()=>X(()=>import("./SettingsPage-CyQ5qYJC.js"),__vite__mapDeps([103,102])).then(t=>({default:t.SettingsPage})));function px(t){const e=ke.c(6),{label:n}=t;let r,i,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"mb-3 h-4 w-32 animate-pulse rounded-full bg-muted"}),i=g.jsx("div",{className:"mb-2 h-7 w-56 animate-pulse rounded-full bg-muted"}),s=g.jsx("div",{className:"mb-6 h-4 w-72 animate-pulse rounded-full bg-muted"}),e[0]=r,e[1]=i,e[2]=s):(r=e[0],i=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsxs("div",{className:"grid gap-3",children:[g.jsx("div",{className:"h-16 animate-pulse rounded-2xl bg-muted/80"}),g.jsx("div",{className:"h-16 animate-pulse rounded-2xl bg-muted/70"}),g.jsx("div",{className:"h-16 animate-pulse rounded-2xl bg-muted/60"})]}),e[3]=o):o=e[3];let l;return e[4]!==n?(l=g.jsx("div",{className:"flex flex-1 min-w-0 items-center justify-center bg-background",children:g.jsx("div",{className:"w-full max-w-3xl px-6",children:g.jsxs("div",{className:"rounded-3xl border border-border/70 bg-card/60 p-6 shadow-sm",children:[r,i,s,o,g.jsx("div",{className:"mt-4 text-sm text-muted-foreground",children:n})]})})}),e[4]=n,e[5]=l):l=e[5],l}function Pye(t,e){return!(!e||t.defaultPrevented||t.isComposing||uJ(t.target))}function jye(){const t=ke.c(4),e=k4(),n=e.chatId??null,r=e.featureId??null;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx(zye,{}),t[0]=i):i=t[0];let s;return t[1]!==n||t[2]!==r?(s=g.jsx(Nye,{activeChatId:n,activeOverviewFeatureId:r,children:i}),t[1]=n,t[2]=r,t[3]=s):s=t[3],s}function zye(){const t=ke.c(108),e=pi(),n=k4(),r=gp(),i=Qd(),s=G2(),o=g7(),l=Xd(),c=n.featureId??null;let d;t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==l?(d={...r,...i,...s,...o,...l,activeOverviewFeatureId:c},t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=l,t[6]=d):d=t[6];const f=d,h=qb("(min-width: 768px)"),m=pA($ye),v=pA(Bye),_=e.pathname==="/";let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=nq.split("/")[1]??"unknown",t[7]=y):y=t[7];const S=y;let C;t[8]!==f.keybindings?(C=JO(f.keybindings),t[8]=f.keybindings,t[9]=C):C=t[9];const R=C;Aye();let k,T;t[10]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{window.localStorage.setItem(Lye,S)},T=[S],t[10]=k,t[11]=T):(k=t[10],T=t[11]),x.useEffect(k,T);let M;t[12]!==h||t[13]!==R||t[14]!==f?(M=()=>{const Q=function(le){const Te=Il(R,"toggleProjectsSidebar",le);Pye(le,Te)&&(le.preventDefault(),f.toggleProjectsSidebar(h))};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},t[12]=h,t[13]=R,t[14]=f,t[15]=M):M=t[15];let A;t[16]!==h||t[17]!==R||t[18]!==f.toggleProjectsSidebar?(A=[h,R,f.toggleProjectsSidebar],t[16]=h,t[17]=R,t[18]=f.toggleProjectsSidebar,t[19]=A):A=t[19],x.useEffect(M,A);let D;t[20]===Symbol.for("react.memo_cache_sentinel")?(D={top:"var(--app-shell-offset-top)"},t[20]=D):D=t[20];let z,G,$,H,F,B,j,U,P,W;t[21]!==f?(W=(Q,xe)=>{Sa(kr.chatCreate(Q,xe),()=>f.handleCreateChat(Q,xe),{statusLabel:"Starting chat..."})},z=Q=>{f.handleCreateFeature(Q)},G=Q=>{f.handleRenameFeature(Q)},$=Q=>{f.handleDeleteFeature(Q)},H=(Q,xe)=>{f.handleSetProjectBrowserState(Q,xe)},F=(Q,xe)=>{f.handleSetProjectGeneralChatsBrowserState(Q,xe)},B=(Q,xe)=>{f.handleSetFeatureBrowserState(Q,xe)},j=(Q,xe)=>{f.handleSetFeatureStage(Q,xe)},U=(Q,xe)=>{f.handleSetChatFeature(Q,xe)},P=(Q,xe)=>{f.handleReorderFeatures(Q,xe)},t[21]=f,t[22]=z,t[23]=G,t[24]=$,t[25]=H,t[26]=F,t[27]=B,t[28]=j,t[29]=U,t[30]=P,t[31]=W):(z=t[22],G=t[23],$=t[24],H=t[25],F=t[26],B=t[27],j=t[28],U=t[29],P=t[30],W=t[31]);let q,Y,N,I;t[32]!==f?(q=Q=>{f.handleOpenFeatureOverview(Q)},Y=Q=>{f.handleRenameChat(Q)},N=Q=>{f.handleDeleteChat(Q)},I=Q=>{Sa(kr.projectRemove(Q),()=>f.handleRemoveProject(Q),{statusLabel:"Hiding project..."})},t[32]=f,t[33]=q,t[34]=Y,t[35]=N,t[36]=I):(q=t[33],Y=t[34],N=t[35],I=t[36]);let V;t[37]!==f?(V=Q=>f.handleOpenProviderLogin(Q),t[37]=f,t[38]=V):V=t[38];let L;t[39]!==f?(L=()=>{f.handleInstallUpdate()},t[39]=f,t[40]=L):L=t[40];let J;t[41]!==m||t[42]!==h||t[43]!==R.bindings.toggleProjectsSidebar||t[44]!==v||t[45]!==_||t[46]!==f.activeChatId||t[47]!==f.activeOverviewFeatureId||t[48]!==f.closeSidebar||t[49]!==f.completedChatIds||t[50]!==f.connectionStatus||t[51]!==f.expandSidebar||t[52]!==f.folderGroupsEnabled||t[53]!==f.handleRefreshProviderUsage||t[54]!==f.kanbanStatusesEnabled||t[55]!==f.openSidebar||t[56]!==f.providerSettings||t[57]!==f.remoteAuth||t[58]!==f.showFeatureOverviewInSidebar||t[59]!==f.sidebarCollapsed||t[60]!==f.sidebarData||t[61]!==f.sidebarOpen||t[62]!==f.sidebarReady||t[63]!==f.startingLocalPath||t[64]!==f.toggleProjectsSidebar||t[65]!==f.updateSnapshot||t[66]!==z||t[67]!==G||t[68]!==$||t[69]!==H||t[70]!==F||t[71]!==B||t[72]!==j||t[73]!==U||t[74]!==P||t[75]!==q||t[76]!==Y||t[77]!==N||t[78]!==I||t[79]!==V||t[80]!==L||t[81]!==W?(J=g.jsx(YZ,{data:f.sidebarData,completedChatIds:f.completedChatIds,activeChatId:f.activeChatId,activeOverviewFeatureId:f.activeOverviewFeatureId,connectionStatus:f.connectionStatus,ready:f.sidebarReady,open:f.sidebarOpen,collapsed:f.sidebarCollapsed,isDesktopViewport:h,showMobileOpenButton:_,onOpen:f.openSidebar,onClose:f.closeSidebar,onToggle:f.toggleProjectsSidebar,onExpand:f.expandSidebar,desktopWidth:m,toggleShortcut:R.bindings.toggleProjectsSidebar,onResizeDesktopWidth:v,onCreateChat:W,onCreateFeature:z,onRenameFeature:G,onDeleteFeature:$,onSetProjectBrowserState:H,onSetProjectGeneralChatsBrowserState:F,onSetFeatureBrowserState:B,onSetFeatureStage:j,onSetChatFeature:U,onReorderFeatures:P,folderGroupsEnabled:f.folderGroupsEnabled,showFeatureOverviewInSidebar:f.showFeatureOverviewInSidebar,kanbanStatusesEnabled:f.kanbanStatusesEnabled,onOpenFeatureOverview:q,onRenameChat:Y,onDeleteChat:N,onRemoveProject:I,onRefreshProviderUsage:f.handleRefreshProviderUsage,onOpenProviderLogin:V,providerSettings:f.providerSettings,remoteAuth:f.remoteAuth,startingLocalPath:f.startingLocalPath,updateSnapshot:f.updateSnapshot,onInstallUpdate:L}),t[41]=m,t[42]=h,t[43]=R.bindings.toggleProjectsSidebar,t[44]=v,t[45]=_,t[46]=f.activeChatId,t[47]=f.activeOverviewFeatureId,t[48]=f.closeSidebar,t[49]=f.completedChatIds,t[50]=f.connectionStatus,t[51]=f.expandSidebar,t[52]=f.folderGroupsEnabled,t[53]=f.handleRefreshProviderUsage,t[54]=f.kanbanStatusesEnabled,t[55]=f.openSidebar,t[56]=f.providerSettings,t[57]=f.remoteAuth,t[58]=f.showFeatureOverviewInSidebar,t[59]=f.sidebarCollapsed,t[60]=f.sidebarData,t[61]=f.sidebarOpen,t[62]=f.sidebarReady,t[63]=f.startingLocalPath,t[64]=f.toggleProjectsSidebar,t[65]=f.updateSnapshot,t[66]=z,t[67]=G,t[68]=$,t[69]=H,t[70]=F,t[71]=B,t[72]=j,t[73]=U,t[74]=P,t[75]=q,t[76]=Y,t[77]=N,t[78]=I,t[79]=V,t[80]=L,t[81]=W,t[82]=J):J=t[82];const te=f.createFeatureModalProjectId!==null;let ee,oe;t[83]!==f?(ee=Q=>{Q||f.handleCloseCreateFeatureModal()},oe=Q=>f.handleConfirmCreateFeature(Q),t[83]=f,t[84]=ee,t[85]=oe):(ee=t[84],oe=t[85]);let ie;t[86]!==f.isCreatingFeature||t[87]!==te||t[88]!==ee||t[89]!==oe?(ie=g.jsx(fG,{open:te,isSubmitting:f.isCreatingFeature,onOpenChange:ee,onConfirm:oe}),t[86]=f.isCreatingFeature,t[87]=te,t[88]=ee,t[89]=oe,t[90]=ie):ie=t[90];let ue,fe;t[91]!==f?(ue=Q=>{Q||f.handleCloseCursorCurlImport()},fe=Q=>f.handleSubmitCursorCurlImport(Q),t[91]=f,t[92]=ue,t[93]=fe):(ue=t[92],fe=t[93]);let de;t[94]!==f.cursorCurlImportOpen||t[95]!==ue||t[96]!==fe?(de=g.jsx(hG,{open:f.cursorCurlImportOpen,onOpenChange:ue,onSubmit:fe}),t[94]=f.cursorCurlImportOpen,t[95]=ue,t[96]=fe,t[97]=de):de=t[97];let Z;t[98]!==f.activeChatId||t[99]!==f.connectionStatus||t[100]!==f.sidebarData?(Z=g.jsx(wye,{activeChatId:f.activeChatId,connectionStatus:f.connectionStatus,sidebarData:f.sidebarData}),t[98]=f.activeChatId,t[99]=f.connectionStatus,t[100]=f.sidebarData,t[101]=Z):Z=t[101];let ne;t[102]===Symbol.for("react.memo_cache_sentinel")?(ne=g.jsx(_9,{}),t[102]=ne):ne=t[102];let ae;return t[103]!==J||t[104]!==ie||t[105]!==de||t[106]!==Z?(ae=g.jsxs("div",{className:"relative flex h-[var(--app-shell-height)] min-h-[var(--app-shell-height)] overflow-hidden",style:D,children:[J,ie,de,Z,ne]}),t[103]=J,t[104]=ie,t[105]=de,t[106]=Z,t[107]=ae):ae=t[107],ae}function Bye(t){return t.setWidth}function $ye(t){return t.widthPx}function Fye(){const t=ke.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsx(ga,{path:"/open",element:g.jsx(tye,{})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(ga,{path:"/remote-setup",element:g.jsx(dye,{})}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx(jye,{}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx(ga,{path:"/",element:g.jsx(x.Suspense,{fallback:g.jsx(px,{label:"Loading local projects..."}),children:g.jsx(Iye,{})})}),t[3]=i):i=t[3];let s;t[4]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx(ga,{path:"/settings",element:g.jsx(b9,{to:"/settings/general",replace:!0})}),t[4]=s):s=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx(ga,{path:"/settings/:sectionId",element:g.jsx(x.Suspense,{fallback:g.jsx(px,{label:"Loading settings..."}),children:g.jsx(Oye,{})})}),t[5]=o):o=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=g.jsx(ga,{path:"/chat/:chatId",element:g.jsx(K_e,{})}),t[6]=l):l=t[6];let c;return t[7]===Symbol.for("react.memo_cache_sentinel")?(c=g.jsx(YW,{children:g.jsxs(cG,{children:[g.jsxs(x9,{children:[e,n,g.jsxs(ga,{element:r,children:[i,s,o,l,g.jsx(ga,{path:"/overview/:featureId",element:g.jsx(x.Suspense,{fallback:g.jsx(px,{label:"Loading feature overview..."}),children:g.jsx(Dye,{})})})]})]}),g.jsx(L$,{})]})}),t[7]=c):c=t[7],c}const b7=document.getElementById("root");if(!b7)throw new Error("Missing #root");yB.createRoot(b7).render(g.jsx(W9,{basename:tP(),children:g.jsx(Fde,{children:g.jsx(Fye,{})})}));export{g7 as $,Uye as A,gt as B,uP as C,Ww as D,xF as E,DF as F,Qs as G,Qye as H,xb as I,q4 as J,jw as K,Vn as L,Mp as M,nq as N,Vs as O,Vl as P,dZ as Q,Jg as R,rj as S,sp as T,PT as U,Ys as V,Xs as W,Ks as X,Ed as Y,hi as Z,fd as _,ke as a,Xd as a0,lL as a1,Kb as a2,PJ as a3,cr as a4,oZ as a5,zO as a6,aZ as a7,FO as a8,Jc as a9,DJ as aA,cZ as aB,w1e as aC,qye as aD,TJ as aE,RJ as aF,eS as aG,MJ as aH,AJ as aI,tS as aJ,Jye as aK,Zye as aL,bq as aM,Xq as aN,o1e as aO,l1e as aP,Lp as aQ,S1e as aR,C1e as aS,Sye as aT,yye as aU,yq as aV,kZ as aW,va as aX,TZ as aY,HC as aa,HO as ab,u0e as ac,c1e as ad,cx as ae,dd as af,ui as ag,uF as ah,a1e as ai,pi as aj,k4 as ak,Hde as al,Dv as am,wa as an,bd as ao,hx as ap,JO as aq,Yye as ar,Xye as as,e1e as at,wq as au,xv as av,Xb as aw,V4 as ax,Ni as ay,s1e as az,gp as b,at as c,Qd as d,G2 as e,qb as f,kr as g,vd as h,we as i,Rp as j,g as k,lfe as l,Sa as m,Np as n,fP as o,Cc as p,ev as q,x as r,yb as s,Yw as t,Xc as u,qw as v,Dae as w,Kye as x,Xw as y,Qi as z};
2500
+ ${Ct.detail}`:Ct.message,closeLabel:"OK"}),Ct}catch(Ct){return await t.alert({title:"Unable to commit changes",description:Ct instanceof Error?Ct.message:"Kaizen could not create the commit.",closeLabel:"OK"}),null}}x.useEffect(()=>{if(o.messages.length!==0)return;m(""),_(!1);let Ee=0;const Je=window.setInterval(()=>{Ee+=1,m(Ig.slice(0,Ee)),Ee>=Ig.length&&(window.clearInterval(Je),_(!0))},F_e);return()=>window.clearInterval(Je)},[o.activeChatId,o.messages.length]),x.useEffect(()=>{function Ee(Je){if(j){if(Il(Ke,"toggleEmbeddedTerminal",Je)){Je.preventDefault(),Pe();return}if(Il(Ke,"toggleRightSidebar",Je)){Je.preventDefault(),ee(j);return}if(Il(Ke,"openInFinder",Je)){if(!B)return;Je.preventDefault(),o.handleOpenExternal("open_finder");return}if(Il(Ke,"openInEditor",Je)){if(!B)return;Je.preventDefault(),o.handleOpenExternal("open_editor");return}Il(Ke,"addSplitTerminal",Je)&&(Je.preventDefault(),N(j))}}return window.addEventListener("keydown",Ee),()=>window.removeEventListener("keydown",Ee)},[N,B,Re,j,Ke,ee,V]),x.useEffect(()=>{Oe||R(!1)},[Oe]),x.useEffect(()=>{const Ee=window.requestAnimationFrame(()=>{o.updateScrollState()}),Je=window.setTimeout(()=>{o.updateScrollState()},ud);return()=>{window.cancelAnimationFrame(Ee),window.clearTimeout(Je)}},[Ve,Oe,o.updateScrollState]),x.useEffect(()=>{function Ee(){o.updateScrollState()}return window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[o.updateScrollState]),x.useEffect(()=>{if(!j||!Fe){H(null);return}const Ee=()=>{document.visibilityState==="visible"&&Ze()};Ee();const Je=window.setInterval(()=>{Ee()},U_e),Ct=()=>{Ee()},On=()=>{Ee()};return document.addEventListener("visibilitychange",Ct),window.addEventListener("focus",On),()=>{window.clearInterval(Je),document.removeEventListener("visibilitychange",Ct),window.removeEventListener("focus",On)}},[j,Fe,o.socket]),x.useEffect(()=>{if(H(null),!(!j||!Fe))return o.socket.subscribe({type:"project-diffs",projectId:j},Ee=>{H(Ee)})},[j,Fe,o.socket]),x.useEffect(()=>{const Ee=c.current;if(!Ee||!Ve)return;const Je=()=>{const On=Ee.getBoundingClientRect().height;if(On<=0)return;const ur=On*(q.mainSizes[1]/100);ur<=0||S(ts=>Math.abs(ts-ur)<1?ts:ur)},Ct=new ResizeObserver(Je);return Ct.observe(Ee),Je(),()=>Ct.disconnect()},[j,Ve,q.mainSizes]);const kt=Ee=>Number.isFinite(Ee)?Math.max(R2,Ee):Y.size,dn=()=>{j&&oe(j,!1)};function Ht(){var Ee,Je;return((Ee=o.runtime)==null?void 0:Ee.projectId)??o.selectedProjectId??((Je=o.sidebarData.projectGroups[0])==null?void 0:Je.groupKey)??null}async function Nt(Ee){const Je=Ht();if(!Je)throw new Error("Open a project first");const Ct=await o.socket.command({type:"feature.create",projectId:Je,title:Ee,description:"",generateOverview:bd.getState().showFeatureOverviewInSidebar});await o.handleCreateChat(Je,Ct.featureId)}function Dn(){const Ee=Ht();if(!Ee)throw new Error("Open a project first");o.handleCreateFeature(Ee)}async function nn(Ee,Je){var On,ur;const Ct=Ee.text.trim();if(Ct.startsWith("/")){const ts=((On=o.runtime)==null?void 0:On.provider)??(Je==null?void 0:Je.provider)??ne,_i=gA({currentProvider:ts,settings:ht}),Pr=(ur=Ct.split(" ")[0])==null?void 0:ur.slice(1).toLowerCase(),Bn=_i.find(me=>me.name.toLowerCase()===Pr);if(Bn!=null&&Bn.handler){const me={handleCompose:o.handleCompose,setPlanMode:Ae=>{var $e;if(!(k!==null&&k.chatId!==o.activeChatId)){if(wa.getState().setComposerPlanMode(Ae),o.activeChatId){const Ue=(($e=o.runtime)==null?void 0:$e.planMode)??!1;if(Ae===Ue){Xm(P),z.current=null,T(null);return}z.current=P,VO(P,{statusLabel:Ae?"Switching to plan mode...":"Switching to implement mode..."}),T({chatId:o.activeChatId,originalRuntimePlanMode:Ue,value:Ae})}else Xm(P),z.current=null,T(null);A(Ue=>Ue+1)}},sendMessage:(Ae,$e)=>o.handleSend(Ae,$e),openFeatureModal:Dn,createFeature:Nt},Se=Ct.slice(Pr!=null&&Pr.length?Pr.length+1:0).trim();await Bn.handler(me,{commandText:Ct,remainder:Se,message:Ee,options:Je});return}}return o.handleSend(Ee,Je)}const vn=g.jsxs(uP,{ref:d,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[g.jsxs(fP,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[g.jsx(Cee,{sidebarCollapsed:o.sidebarCollapsed,hasCompletedChats:o.completedChatIds.size>0,onOpenSidebar:o.openSidebar,onExpandSidebar:o.expandSidebar,usage:o.usage,localPath:o.navbarLocalPath,embeddedTerminalVisible:Oe,onToggleEmbeddedTerminal:j?Pe:void 0,rightSidebarVisible:Fe,onToggleRightSidebar:j?()=>ee(j):void 0,onOpenExternal:B?Ee=>{o.handleOpenExternal(Ee)}:void 0,editorLabel:o.editorLabel,projectId:j??void 0,socket:o.socket,finderShortcut:B?Ke.bindings.openInFinder:void 0,editorShortcut:B?Ke.bindings.openInEditor:void 0,terminalShortcut:Ke.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:Ke.bindings.toggleRightSidebar}),g.jsxs(rj,{ref:o.scrollRef,onScroll:o.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[(st=o.runtime)!=null&&st.inactiveProviderMessage?g.jsxs("div",{className:we("mx-auto mt-[72px] rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm text-amber-900 dark:text-amber-200",Og),children:["This thread uses ",o.runtime.provider,", which is currently inactive. ",o.runtime.inactiveProviderMessage]}):null,o.messages.length===0&&!o.isProcessing?g.jsx("div",{style:{height:o.transcriptPaddingBottom},"aria-hidden":"true"}):null,o.messages.length>0||o.isProcessing?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:we("mx-auto animate-fade-in space-y-5 pt-[72px]",Og),children:[o.messages.length>0?g.jsx(K0e,{messages:o.messages,isLoading:o.isProcessing,hasOlderMessages:o.hasOlderMessages,oldestLoadedEntryId:o.oldestLoadedEntryId,isLoadingOlderMessages:o.isLoadingOlderMessages,isAtBottom:o.showScrollButton===!1,localPath:(Rn=o.runtime)==null?void 0:Rn.localPath,latestToolIds:o.latestToolIds,pendingTool:((Tn=o.runtime)==null?void 0:Tn.pendingTool)??null,onOpenLocalLink:o.handleOpenLocalLink,onAskUserQuestionSubmit:o.handleAskUserQuestion,onExitPlanModeConfirm:o.handleExitPlanMode,onHandoff:o.handleHandoff,onLoadOlder:o.loadOlderMessages,availableProviders:o.availableProviders,scrollContainerRef:o.scrollRef}):null,o.isProcessing?g.jsx(afe,{status:o.processingStatus}):null,o.commandError?g.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:o.commandError}):null]}),g.jsx("div",{style:{height:o.transcriptPaddingBottom},"aria-hidden":"true"})]}):null]}),dt?g.jsx("div",{className:"pointer-events-none absolute inset-x-4 z-20 animate-fade-in",style:{top:a4,bottom:o.transcriptPaddingBottom},children:g.jsx("div",{className:we("mx-auto flex h-full items-center justify-center",Og),children:g.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-background/90 px-4 py-2 text-sm text-muted-foreground shadow-sm backdrop-blur",children:[g.jsx(Vn,{className:"size-4 animate-spin"}),g.jsx("span",{children:"Refreshing chat…"})]})})}):null,vt?g.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:a4,bottom:o.transcriptPaddingBottom},children:g.jsx("div",{className:we("mx-auto flex h-full items-center justify-center",Og),children:g.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[g.jsx(md,{className:"size-8 text-muted-foreground kaizen-empty-state-flower"}),vt==="loading"||vt==="recovering"||vt==="unavailable"?g.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[vt==="unavailable"?null:g.jsx(Vn,{className:"size-10 animate-spin text-muted-foreground/80"}),g.jsx("div",{className:"text-sm text-muted-foreground/90",children:vt==="recovering"?"Recovering chat…":vt==="unavailable"?"Chat history is unavailable.":"Loading chat…"})]}):g.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kaizen-empty-state-text","aria-label":Ig,children:g.jsxs("span",{className:"relative inline-grid place-items-start",children:[g.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[g.jsx("span",{children:Ig}),g.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true"})]}),g.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[g.jsx("span",{children:h}),g.jsx("span",{className:"kaizen-typewriter-cursor-slot","aria-hidden":"true",children:g.jsx("span",{className:"kaizen-typewriter-cursor","data-typing-complete":v?"true":"false"})})]})]})})]})})},o.activeChatId??"new-chat"):null,g.jsx("div",{style:{bottom:tt},className:we("pointer-events-none absolute left-1/2 -translate-x-1/2 z-30 transition-all",o.showScrollButton&&!l?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:g.jsx("button",{onClick:o.scrollToBottom,style:{lineHeight:0},className:"pointer-events-auto h-9 w-9 grid place-items-center transition-colors bg-background/80 dark:bg-card/40 backdrop-blur-lg hover:bg-muted/80 border border-border rounded-full cursor-pointer text-foreground/80 hover:text-foreground",children:g.jsx(H$,{style:{display:"block"},className:"h-4 w-4"})})})]}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:g.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:o.inputRef,children:g.jsx(_ee,{ref:f,onSubmit:nn,onCancel:()=>{o.handleCancel()},disabled:!o.hasSelectedProject||((Qn=o.runtime)==null?void 0:Qn.status)==="waiting_for_user"||!!((Zn=o.runtime)!=null&&Zn.inactiveProviderMessage),canCancel:o.canCancel,chatId:o.activeChatId,activeProvider:((An=o.runtime)==null?void 0:An.provider)??null,activeModel:((Ut=o.runtime)==null?void 0:Ut.model)??null,activePlanMode:((Ii=o.runtime)==null?void 0:Ii.planMode)??!1,availableProviders:o.availableProviders,keybindings:Ke,slashCommands:he,requestedPlanMode:(k==null?void 0:k.chatId)===o.activeChatId?k.value:null,requestedPlanModeVersion:M,pendingPlanMode:(k==null?void 0:k.chatId)===o.activeChatId?k.value:null,queueOutboundAllowed:o.queueOutboundAllowed,queuedOutbound:(Jn=o.runtime)==null?void 0:Jn.queuedOutbound,onRemoveQueued:o.handleRemoveQueuedOutbound,onUpdateQueued:o.handleUpdateQueuedOutbound},o.activeChatId??"new-chat")})})]});return g.jsxs("div",{ref:c,className:"flex-1 flex flex-col min-w-0 relative",children:[Ye&&j?g.jsxs(Jg,{groupRef:He,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Ee=>{var Ct;if(!Fe||bt.current)return;const Je=kt(Ee.rightSidebar);Math.abs(Je-Ee.rightSidebar)<.1||(Ct=He.current)==null||Ct.setLayout({workspace:100-Je,rightSidebar:Je})},onLayoutChanged:Ee=>{!Fe||bt.current||ie(j,kt(Ee.rightSidebar))},children:[g.jsx(Cc,{id:"workspace",defaultSize:`${100-Y.size}%`,minSize:"20%",className:"min-h-0 min-w-0",children:Ve?g.jsxs(Jg,{groupRef:ct,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:je,children:[g.jsx(Cc,{id:"chat",defaultSize:`${q.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:vn}),g.jsx(ev,{withHandle:!0,orientation:"vertical",disabled:!Oe,className:we(!Oe&&"pointer-events-none opacity-0")}),g.jsx(Cc,{id:"terminal",defaultSize:`${q.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:Pt,children:g.jsx("div",{ref:xt,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":Oe?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${ud}ms`},children:g.jsx("div",{style:y>0?{height:`${y}px`}:void 0,children:C?null:g.jsx(B1,{projectId:j,layout:q,onAddTerminal:N,socket:o.socket,connectionStatus:o.connectionStatus,scrollback:fe,minColumnWidth:de,maximized:!1,splitTerminalShortcut:Ke.bindings.addSplitTerminal,focusRequestVersion:nt,onToggleMaximized:_e,onRemoveTerminal:(Ee,Je)=>{o.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),I(Ee,Je)},onTerminalLayout:te})})})})]},j):vn}),g.jsx(ev,{withHandle:!0,orientation:"horizontal",disabled:!Fe,className:we(!Fe&&"pointer-events-none opacity-0")}),g.jsx(Cc,{id:"rightSidebar",defaultSize:`${Y.size}%`,className:"min-h-0 min-w-0",elementRef:Ge,children:g.jsx("div",{ref:ze,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":Fe?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${ud}ms`},children:g.jsx(V3,{projectId:j,disclosureStorageKey:U,diffs:$,diffRenderMode:le,wrapLines:Le,onOpenFile:_t,onGenerateCommitMessage:Ft,onCommit:Tt,onDiffRenderModeChange:Te,onWrapLinesChange:Xe,onClose:()=>oe(j,!1)})})})]},`${j}-right-sidebar`):Ve&&j?g.jsxs(Jg,{groupRef:ct,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:je,children:[g.jsx(Cc,{id:"chat",defaultSize:`${q.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:vn}),g.jsx(ev,{withHandle:!0,orientation:"vertical",disabled:!Oe,className:we(!Oe&&"pointer-events-none opacity-0")}),g.jsx(Cc,{id:"terminal",defaultSize:`${q.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:Pt,children:g.jsx("div",{ref:xt,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":Oe?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${ud}ms`},children:g.jsx("div",{style:y>0?{height:`${y}px`}:void 0,children:C?null:g.jsx(B1,{projectId:j,layout:q,onAddTerminal:N,socket:o.socket,connectionStatus:o.connectionStatus,scrollback:fe,minColumnWidth:de,maximized:!1,splitTerminalShortcut:Ke.bindings.addSplitTerminal,focusRequestVersion:nt,onToggleMaximized:_e,onRemoveTerminal:(Ee,Je)=>{o.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),I(Ee,Je)},onTerminalLayout:te})})})})]},j):vn,C&&j&&Oe?g.jsx("div",{className:"absolute inset-0 z-30 flex min-h-0 min-w-0 flex-col bg-background/96 backdrop-blur-sm",children:g.jsx(B1,{projectId:j,layout:q,onAddTerminal:N,socket:o.socket,connectionStatus:o.connectionStatus,scrollback:fe,minColumnWidth:de,maximized:!0,splitTerminalShortcut:Ke.bindings.addSplitTerminal,focusRequestVersion:nt,onToggleMaximized:_e,onRemoveTerminal:(Ee,Je)=>{o.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),I(Ee,Je)},onTerminalLayout:te})}):null,We?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 md:hidden"}),g.jsx("div",{className:"fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-2xl md:hidden",children:g.jsx(V3,{projectId:j,disclosureStorageKey:U,diffs:$,diffRenderMode:le,wrapLines:Le,onOpenFile:_t,onGenerateCommitMessage:Ft,onCommit:Tt,onDiffRenderModeChange:Te,onWrapLinesChange:Xe,onClose:dn,className:"h-[var(--app-shell-height)]"})})]}):null]})}const Y_e="web+kaizen";function Mw(t){return!t||!t.startsWith("/")||t.startsWith("//")?"/":t}function X_e(t){const e=new URLSearchParams(t),n=Mw(e.get("target"));if(n!=="/")return n;const r=e.get("launch");if(!r)return"/";try{const i=new URL(r);return Mw(i.searchParams.get("target"))}catch{return"/"}}function Q_e(t){const e=new URL(`${Y_e}://open`);return e.searchParams.set("target",Mw(t)),e.toString()}function Z_e(t){return t.innerWidth<=820||t.matchMedia("(pointer: coarse)").matches}function J_e(t){return/\b(?:Chrome|CriOS|Edg|EdgA|EdgiOS)\b/i.test(t)}function eye(t){return/iPhone|iPad|iPod/i.test(t)?"In Safari, tap Share, then Add to Home Screen.":/Android/i.test(t)?"Use your browser menu to install Kaizen to the home screen.":"Use your browser install action to save Kaizen as an app, or continue in the browser."}function tye(){const t=ke.c(29),e=pi(),n=eP();let r;t[0]!==e.search?(r=X_e(e.search),t[0]=e.search,t[1]=r):r=t[1];const i=r,[s,o]=x.useState(!1),[l,c]=x.useState(null);let d,f;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const H=function(B){B.preventDefault(),c(B)};return window.addEventListener("beforeinstallprompt",H),()=>{window.removeEventListener("beforeinstallprompt",H)}},f=[],t[2]=d,t[3]=f):(d=t[2],f=t[3]),x.useEffect(d,f);let h,m;t[4]!==n||t[5]!==e.search||t[6]!==i?(h=()=>{if(n){window.location.replace(i);return}if(new URLSearchParams(e.search).has("launch")){window.location.replace(i);return}if(!Z_e(window)){window.location.replace(i);return}if(!J_e(navigator.userAgent)){o(!0);return}const B=Q_e(i),j=window.setTimeout(()=>{o(!0)},900),U=()=>{document.visibilityState==="hidden"&&window.clearTimeout(j)};return document.addEventListener("visibilitychange",U),window.location.assign(B),()=>{window.clearTimeout(j),document.removeEventListener("visibilitychange",U)}},m=[n,e.search,i],t[4]=n,t[5]=e.search,t[6]=i,t[7]=h,t[8]=m):(h=t[7],m=t[8]),x.useEffect(h,m);let v;t[9]!==l?(v=async function(){l&&(await l.prompt(),await l.userChoice.catch(nye),c(null))},t[9]=l,t[10]=v):v=t[10];const _=v;let y;t[11]===Symbol.for("react.memo_cache_sentinel")?(y=eye(navigator.userAgent),t[11]=y):y=t[11];const S=y;let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-[radial-gradient(circle_at_center,rgba(249,115,22,0.12),transparent_68%)] dark:bg-[radial-gradient(circle_at_center,rgba(251,146,60,0.14),transparent_68%)]"}),t[12]=C):C=t[12];let R,k;t[13]===Symbol.for("react.memo_cache_sentinel")?(R=g.jsx("div",{className:"mb-6 inline-flex rounded-full border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:border-orange-400/30 dark:bg-orange-400/10 dark:text-orange-200",children:"Remote handoff"}),k=g.jsxs("h1",{className:"font-logo text-3xl leading-none tracking-tight",children:["Open ",Qs]}),t[13]=R,t[14]=k):(R=t[13],k=t[14]);const T=s?"Kaizen could not jump straight into the installed app on this device. You can keep going in the browser or install it for one-tap launches next time.":"Trying to open your installed Kaizen app. If it does not switch automatically, use the browser fallback below.";let M;t[15]!==T?(M=g.jsx("p",{className:"mt-3 text-sm leading-6 text-slate-600 dark:text-slate-300",children:T}),t[15]=T,t[16]=M):M=t[16];let A;t[17]!==i?(A=g.jsx(tp,{to:i,className:"block rounded-2xl bg-slate-950 px-4 py-3 text-center text-sm font-semibold text-white transition hover:bg-slate-800 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:"Continue in browser"}),t[17]=i,t[18]=A):A=t[18];let D;t[19]!==_||t[20]!==l?(D=l?g.jsx("button",{type:"button",onClick:()=>{_()},className:"block w-full rounded-2xl border border-orange-300 bg-orange-50 px-4 py-3 text-sm font-semibold text-orange-800 transition hover:bg-orange-100 dark:border-orange-400/40 dark:bg-orange-400/10 dark:text-orange-100 dark:hover:bg-orange-400/20",children:"Install Kaizen"}):null,t[19]=_,t[20]=l,t[21]=D):D=t[21];let z;t[22]!==A||t[23]!==D?(z=g.jsxs("div",{className:"mt-6 space-y-3",children:[A,D]}),t[22]=A,t[23]=D,t[24]=z):z=t[24];let G;t[25]===Symbol.for("react.memo_cache_sentinel")?(G=g.jsxs("div",{className:"mt-6 rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 text-sm leading-6 text-slate-700 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-200",children:[g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"Install hint"}),g.jsx("p",{className:"mt-1",children:S})]}),t[25]=G):G=t[25];let $;return t[26]!==M||t[27]!==z?($=g.jsxs("main",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_top,rgba(241,245,249,0.96),rgba(255,255,255,1)_42%),linear-gradient(135deg,#fff8ef_0%,#ffffff_45%,#eef6ff_100%)] px-5 py-8 text-slate-950 dark:bg-[radial-gradient(circle_at_top,rgba(30,41,59,0.92),rgba(15,23,42,1)_46%),linear-gradient(135deg,#0f172a_0%,#111827_45%,#1f2937_100%)] dark:text-slate-50",children:[C,g.jsxs("section",{className:"relative w-full max-w-sm overflow-hidden rounded-[2rem] border border-white/70 bg-white/88 p-6 shadow-[0_30px_120px_-32px_rgba(15,23,42,0.42)] backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-900/88",children:[R,k,M,z,G]})]}),t[26]=M,t[27]=z,t[28]=$):$=t[28],$}function nye(){}const rye=3210;function iye(t,e){const n=new URLSearchParams(t),r=Number(n.get("localPort"));if(Number.isFinite(r)&&r>0)return Math.round(r);const i=Number(e);return Number.isFinite(i)&&i>0?Math.round(i):rye}function sye(t){return`tailscale serve --bg --https 443 http://127.0.0.1:${String(t)}`}function oye(t){return new URLSearchParams(t).get("reason")==="serve_permission_denied"?"serve_permission_denied":null}function aye(t){const n=new URLSearchParams(t).get("setupCommand");return n!=null&&n.trim()?n:null}const lye="https://tailscale.com/download",cye="https://tailscale.com/kb/1242/tailscale-serve",uye="https://tailscale.com/docs/how-to/set-up-https-certificates";function dye(){const t=ke.c(35),e=pi();let n;t[0]!==e.search?(n=iye(e.search,window.location.port),t[0]=e.search,t[1]=n):n=t[1];const r=n;let i;t[2]!==e.search?(i=oye(e.search),t[2]=e.search,t[3]=i):i=t[3];const s=i;let o;t[4]!==e.search?(o=aye(e.search),t[4]=e.search,t[5]=o):o=t[5];const l=o;let c;t[6]!==r?(c=sye(r),t[6]=r,t[7]=c):c=t[7];const d=c;let f;t[8]===Symbol.for("react.memo_cache_sentinel")?(f=g.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-[radial-gradient(circle_at_center,rgba(249,115,22,0.12),transparent_68%)] dark:bg-[radial-gradient(circle_at_center,rgba(251,146,60,0.14),transparent_68%)]"}),t[8]=f):f=t[8];let h,m,v;t[9]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx("div",{className:"mb-6 inline-flex rounded-full border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:border-orange-400/30 dark:bg-orange-400/10 dark:text-orange-200",children:"Remote setup"}),m=g.jsxs("h1",{className:"font-logo text-3xl leading-none tracking-tight",children:["Enable remote ",Qs]}),v=g.jsx("p",{className:"mt-3 text-sm leading-6 text-slate-600 dark:text-slate-300",children:"Kaizen remote mode works best over Tailscale. If HTTPS handoff is not ready yet, use the steps below to install Tailscale, join your tailnet, and expose this local Kaizen session through Tailscale Serve."}),t[9]=h,t[10]=m,t[11]=v):(h=t[9],m=t[10],v=t[11]);let _;t[12]!==l||t[13]!==s?(_=s==="serve_permission_denied"&&l?g.jsxs("section",{className:"mt-6 rounded-2xl border border-orange-300 bg-orange-50/90 p-4 text-sm leading-6 text-orange-950 dark:border-orange-400/40 dark:bg-orange-400/10 dark:text-orange-100",children:[g.jsx("p",{className:"font-semibold",children:"One-time machine setup needed"}),g.jsx("p",{className:"mt-1",children:"Tailscale is connected, but this user is not allowed to change Serve config yet. Run this once on the Kaizen machine:"}),g.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:g.jsx("code",{children:l})})]}):null,t[12]=l,t[13]=s,t[14]=_):_=t[14];let y,S;t[15]===Symbol.for("react.memo_cache_sentinel")?(S=g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"1. Install and connect Tailscale"}),y=g.jsx("p",{className:"mt-1 text-slate-700 dark:text-slate-200",children:"Install Tailscale on this machine and on the device you want to open Kaizen from. Then sign in and connect both devices to the same tailnet."}),t[15]=y,t[16]=S):(y=t[15],S=t[16]);let C;t[17]===Symbol.for("react.memo_cache_sentinel")?(C=g.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[S,y,g.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[g.jsx("a",{href:lye,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Download Tailscale"}),g.jsx("code",{className:"rounded-xl bg-slate-950 px-3 py-2 text-xs text-slate-50 dark:bg-slate-950",children:"tailscale up"})]})]}),t[17]=C):C=t[17];let R,k;t[18]===Symbol.for("react.memo_cache_sentinel")?(R=g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"2. Turn on HTTPS handoff with Tailscale Serve"}),k=g.jsx("p",{className:"mt-1 text-slate-700 dark:text-slate-200",children:"Run this on the machine where Kaizen is already running. It tells Tailscale to publish your local Kaizen port behind your tailnet HTTPS URL."}),t[18]=R,t[19]=k):(R=t[18],k=t[19]);let T;t[20]!==d?(T=g.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:g.jsx("code",{children:d})}),t[20]=d,t[21]=T):T=t[21];let M;t[22]===Symbol.for("react.memo_cache_sentinel")?(M=g.jsx("p",{className:"mt-3 text-slate-700 dark:text-slate-200",children:"If Tailscale says Serve is not enabled on your tailnet, an admin needs to enable HTTPS certificates and Serve support first."}),t[22]=M):M=t[22];let A;t[23]===Symbol.for("react.memo_cache_sentinel")?(A=g.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[g.jsx("a",{href:cye,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Tailscale Serve docs"}),g.jsx("a",{href:uye,target:"_blank",rel:"noreferrer",className:"rounded-xl border border-slate-300 px-3 py-2 font-medium text-slate-900 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-100 dark:hover:bg-slate-700",children:"Enable HTTPS certs"})]}),t[23]=A):A=t[23];let D;t[24]!==T?(D=g.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[R,k,T,M,A]}),t[24]=T,t[25]=D):D=t[25];let z;t[26]===Symbol.for("react.memo_cache_sentinel")?(z=g.jsx("p",{className:"font-semibold text-slate-950 dark:text-white",children:"3. Start Kaizen remote mode again"}),t[26]=z):z=t[26];let G;t[27]===Symbol.for("react.memo_cache_sentinel")?(G=g.jsx("pre",{className:"mt-3 overflow-x-auto rounded-2xl bg-slate-950 p-4 text-xs text-slate-50",children:g.jsx("code",{children:"kaizen --remote"})}),t[27]=G):G=t[27];let $;t[28]===Symbol.for("react.memo_cache_sentinel")?($=g.jsxs("section",{className:"rounded-2xl border border-slate-200/80 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/80",children:[z,G,g.jsxs("p",{className:"mt-3 text-slate-700 dark:text-slate-200",children:["Once Serve is ready, Kaizen should print an"," ",g.jsx("span",{className:"font-semibold",children:"https://…ts.net/open"})," QR handoff URL instead of the HTTP fallback."]})]}),t[28]=$):$=t[28];let H;t[29]!==D?(H=g.jsxs("div",{className:"mt-6 space-y-4 text-sm leading-6",children:[C,D,$]}),t[29]=D,t[30]=H):H=t[30];let F;t[31]===Symbol.for("react.memo_cache_sentinel")?(F=g.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:g.jsx(tp,{to:"/",className:"rounded-2xl bg-slate-950 px-4 py-3 text-sm font-semibold text-white transition hover:bg-slate-800 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:"Back to Kaizen"})}),t[31]=F):F=t[31];let B;return t[32]!==H||t[33]!==_?(B=g.jsxs("main",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_top,rgba(241,245,249,0.96),rgba(255,255,255,1)_42%),linear-gradient(135deg,#fff8ef_0%,#ffffff_45%,#eef6ff_100%)] px-5 py-8 text-slate-950 dark:bg-[radial-gradient(circle_at_top,rgba(30,41,59,0.92),rgba(15,23,42,1)_46%),linear-gradient(135deg,#0f172a_0%,#111827_45%,#1f2937_100%)] dark:text-slate-50",children:[f,g.jsxs("section",{className:"relative w-full max-w-2xl overflow-hidden rounded-[2rem] border border-white/70 bg-white/88 p-6 shadow-[0_30px_120px_-32px_rgba(15,23,42,0.42)] backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-900/88",children:[h,m,v,_,H,F]})]}),t[32]=H,t[33]=_,t[34]=B):B=t[34],B}function l4(){return{baselineEstablished:!1,dedupeByChatId:new Map,statusByChatId:new Map}}function fye(t){const e=[];for(const n of t.projectGroups){for(const r of n.generalChats)e.push({chat:r,projectTitle:n.title});for(const r of n.features)for(const i of r.chats)e.push({chat:i,projectTitle:n.title})}return e}function S1e(t=null){return Lp()?Notification.permission:t??"unsupported"}function w1e(t){return t==="granted"?"Allowed":t==="denied"?"Blocked":t==="default"?"Not requested":"Unsupported"}async function C1e(){return Lp()?Notification.requestPermission():"unsupported"}function Lp(){return typeof window<"u"&&window.isSecureContext&&typeof Notification<"u"}function hye({activeChatId:t,chatId:e,documentVisible:n}){return!n||t!==e}function v7(t){return t==="starting"||t==="running"}function pye(t,e){const n=v7(t),r=t==="waiting_for_user";return n&&e==="waiting_for_user"?"needs_input":(n||r)&&e==="idle"?"completed":null}function mye({activeChatId:t,documentVisible:e,previousState:n,sidebarData:r}){const i=new Map,s=new Map(n.dedupeByChatId),o=[],l=fye(r);for(const{chat:c,projectTitle:d}of l){const f=n.statusByChatId.get(c.chatId);if(i.set(c.chatId,c.status),(v7(c.status)||c.status==="failed")&&s.delete(c.chatId),!n.baselineEstablished)continue;const h=pye(f,c.status);h&&hye({activeChatId:t,chatId:c.chatId,documentVisible:e})&&s.get(c.chatId)!==h&&(s.set(c.chatId,h),o.push({chatId:c.chatId,chatTitle:c.title,eventId:`${c.chatId}:${h}:${Date.now()}`,projectTitle:d,kind:h}))}return{events:o,nextState:{baselineEstablished:!0,dedupeByChatId:s,statusByChatId:i}}}let fx=null;function gye(){if(typeof window>"u")return null;const t=window.AudioContext;return t?(fx||(fx=Promise.resolve(new t)),fx):null}function c4({audioContext:t,startAt:e,duration:n,frequency:r,gainValue:i}){const s=t.createOscillator(),o=t.createGain(),l=e+.012,c=e+Math.max(n-.08,.02),d=e+n;s.type="sine",s.frequency.setValueAtTime(r,e),o.gain.setValueAtTime(1e-4,e),o.gain.exponentialRampToValueAtTime(i,l),o.gain.setValueAtTime(i,c),o.gain.exponentialRampToValueAtTime(1e-4,d),s.connect(o),o.connect(t.destination),s.start(e),s.stop(d)}async function vye(){const t=await gye();if(!t)return;t.state==="suspended"&&await t.resume();const e=t.currentTime;c4({audioContext:t,startAt:e,duration:.24,frequency:880,gainValue:.14}),c4({audioContext:t,startAt:e+.12,duration:.34,frequency:1318.51,gainValue:.18})}function bye(t){typeof navigator>"u"||typeof navigator.vibrate!="function"||navigator.vibrate(t==="needs_input"?[180,100,180]:[120])}function _ye(t,e){if(!Lp()||Notification.permission!=="granted")return null;const n=new Notification(t.chatTitle,{body:t.kind==="needs_input"?`${t.projectTitle} needs your input in ${Qs}.`:`${t.projectTitle} finished responding in ${Qs}.`,tag:t.eventId!==void 0?`kaizen:${t.eventId}`:`kaizen:${t.chatId}:${t.kind}:${Date.now()}`,icon:"/app-icon-192.png",badge:"/app-icon-96.png",requireInteraction:t.kind==="needs_input"});return n.onclick=()=>{window.focus(),e(),n.close()},n}async function yye({event:t,onBrowserNotificationClick:e,preferences:n}){if(Lp()){if(n.browserNotificationsEnabled&&_ye(t,e),n.soundEnabled)try{await vye()}catch{}n.vibrationEnabled&&bye(t.kind)}}function xye(t){return{browserNotificationsEnabled:(t==null?void 0:t.browserNotificationsEnabled)===!0,soundEnabled:(t==null?void 0:t.soundEnabled)===!0,vibrationEnabled:(t==null?void 0:t.vibrationEnabled)===!0,lastPermissionState:(t==null?void 0:t.lastPermissionState)==="granted"||(t==null?void 0:t.lastPermissionState)==="denied"||(t==null?void 0:t.lastPermissionState)==="default"||(t==null?void 0:t.lastPermissionState)==="unsupported"?t.lastPermissionState:null}}function Sye(t){return t.signedIn&&t.browserNotificationsEnabled}const hx=Gr()(gi(t=>({browserNotificationsEnabled:!1,soundEnabled:!1,vibrationEnabled:!1,lastPermissionState:null,setBrowserNotificationsEnabled:e=>t({browserNotificationsEnabled:e}),setSoundEnabled:e=>t({soundEnabled:e}),setVibrationEnabled:e=>t({vibrationEnabled:e}),setLastPermissionState:e=>t({lastPermissionState:e})}),{name:"notification-preferences",migrate:t=>xye(t)}));function wye(t){const e=ke.c(15),{activeChatId:n,connectionStatus:r,sidebarData:i}=t,s=Xc(),{remoteAuth:o}=Qd(),l=Kb(o),c=hx(kye),d=hx(Eye),f=hx(Cye),h=Sye({browserNotificationsEnabled:c,signedIn:l.signedIn});let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=l4(),e[0]=m):m=e[0];const v=x.useRef(m),_=x.useRef(typeof document>"u"?!0:document.visibilityState==="visible");let y,S;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const M=function(){_.current=document.visibilityState==="visible"};return document.addEventListener("visibilitychange",M),()=>document.removeEventListener("visibilitychange",M)},S=[],e[1]=y,e[2]=S):(y=e[1],S=e[2]),x.useEffect(y,S);let C,R;e[3]!==r?(C=()=>{r!=="connected"&&(v.current={...l4(),dedupeByChatId:v.current.dedupeByChatId})},R=[r],e[3]=r,e[4]=C,e[5]=R):(C=e[4],R=e[5]),x.useEffect(C,R);let k,T;return e[6]!==l.features.browserNotifications.enabled||e[7]!==n||e[8]!==h||e[9]!==s||e[10]!==i||e[11]!==d||e[12]!==f?(k=()=>{if(!l.features.browserNotifications.enabled||!Lp())return;const{events:M,nextState:A}=mye({activeChatId:n,documentVisible:_.current,previousState:v.current,sidebarData:i});v.current=A;for(const D of M)yye({event:D,onBrowserNotificationClick:()=>{s(`/chat/${D.chatId}`)},preferences:{browserNotificationsEnabled:h,soundEnabled:d,vibrationEnabled:f}})},T=[n,l.features.browserNotifications.enabled,h,s,i,d,f],e[6]=l.features.browserNotifications.enabled,e[7]=n,e[8]=h,e[9]=s,e[10]=i,e[11]=d,e[12]=f,e[13]=k,e[14]=T):(k=e[13],T=e[14]),x.useEffect(k,T),null}function Cye(t){return t.vibrationEnabled}function Eye(t){return t.soundEnabled}function kye(t){return t.browserNotificationsEnabled}function Rye(){const t=typeof navigator<"u"&&navigator.standalone===!0,e=typeof window<"u"&&window.matchMedia("(display-mode: standalone)").matches;return t||e}function Tye(){const t=window.visualViewport,e=Math.round((t==null?void 0:t.height)??window.innerHeight),n=Math.max(0,Math.round((t==null?void 0:t.offsetTop)??0));return{height:e,offsetTop:n}}function Aye(){const t=ke.c(1);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],x.useLayoutEffect(Mye,e)}function Mye(){let t=0,e=null,n=0;const r=Rye(),i=()=>{t=0;const{height:l,offsetTop:c}=Tye();e===null&&(e=c),l>n&&(n=l);const d=Math.max(0,c-e),f=n-l>120||d>12,h=document.documentElement;h.style.setProperty("--app-shell-height",`${l}px`),h.style.setProperty("--app-shell-offset-top",r?f?`max(0px, calc(${d}px - env(safe-area-inset-top)))`:"0px":`${d}px`),h.style.setProperty("--app-composer-bottom-padding",r?f?"0px":"max(12px, env(safe-area-inset-bottom))":f?"12px":"20px")},s=()=>{t!==0&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(i)};s();const o=window.visualViewport;return window.addEventListener("resize",s),window.addEventListener("orientationchange",s),o==null||o.addEventListener("resize",s),o==null||o.addEventListener("scroll",s),()=>{t!==0&&window.cancelAnimationFrame(t),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),o==null||o.removeEventListener("resize",s),o==null||o.removeEventListener("scroll",s)}}function Nye(t){const e=ke.c(7),{children:n,activeChatId:r,activeOverviewFeatureId:i}=t;let s;e[0]!==r||e[1]!==n?(s=g.jsx($_e,{activeChatId:r,children:n}),e[0]=r,e[1]=n,e[2]=s):s=e[2];let o;return e[3]!==r||e[4]!==i||e[5]!==s?(o=g.jsx(WJ,{children:g.jsx(XJ,{children:g.jsx(QJ,{children:g.jsx(w_e,{activeChatId:r,activeOverviewFeatureId:i,children:s})})})}),e[3]=r,e[4]=i,e[5]=s,e[6]=o):o=e[6],o}const Lye=`${lC}last-seen-version`,Dye=x.lazy(()=>X(()=>import("./FeatureOverviewPage-CFYLJ3BM.js"),__vite__mapDeps([101,102])).then(t=>({default:t.FeatureOverviewPage}))),Iye=x.lazy(()=>X(()=>import("./LocalProjectsPage-rVcfQqeI.js"),[]).then(t=>({default:t.LocalProjectsPage}))),Oye=x.lazy(()=>X(()=>import("./SettingsPage-DQ7vlMU3.js"),__vite__mapDeps([103,102])).then(t=>({default:t.SettingsPage})));function px(t){const e=ke.c(6),{label:n}=t;let r,i,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"mb-3 h-4 w-32 animate-pulse rounded-full bg-muted"}),i=g.jsx("div",{className:"mb-2 h-7 w-56 animate-pulse rounded-full bg-muted"}),s=g.jsx("div",{className:"mb-6 h-4 w-72 animate-pulse rounded-full bg-muted"}),e[0]=r,e[1]=i,e[2]=s):(r=e[0],i=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsxs("div",{className:"grid gap-3",children:[g.jsx("div",{className:"h-16 animate-pulse rounded-2xl bg-muted/80"}),g.jsx("div",{className:"h-16 animate-pulse rounded-2xl bg-muted/70"}),g.jsx("div",{className:"h-16 animate-pulse rounded-2xl bg-muted/60"})]}),e[3]=o):o=e[3];let l;return e[4]!==n?(l=g.jsx("div",{className:"flex flex-1 min-w-0 items-center justify-center bg-background",children:g.jsx("div",{className:"w-full max-w-3xl px-6",children:g.jsxs("div",{className:"rounded-3xl border border-border/70 bg-card/60 p-6 shadow-sm",children:[r,i,s,o,g.jsx("div",{className:"mt-4 text-sm text-muted-foreground",children:n})]})})}),e[4]=n,e[5]=l):l=e[5],l}function Pye(t,e){return!(!e||t.defaultPrevented||t.isComposing||uJ(t.target))}function jye(){const t=ke.c(4),e=k4(),n=e.chatId??null,r=e.featureId??null;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx(zye,{}),t[0]=i):i=t[0];let s;return t[1]!==n||t[2]!==r?(s=g.jsx(Nye,{activeChatId:n,activeOverviewFeatureId:r,children:i}),t[1]=n,t[2]=r,t[3]=s):s=t[3],s}function zye(){const t=ke.c(108),e=pi(),n=k4(),r=gp(),i=Qd(),s=G2(),o=g7(),l=Xd(),c=n.featureId??null;let d;t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==l?(d={...r,...i,...s,...o,...l,activeOverviewFeatureId:c},t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=l,t[6]=d):d=t[6];const f=d,h=qb("(min-width: 768px)"),m=pA($ye),v=pA(Bye),_=e.pathname==="/";let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=nq.split("/")[1]??"unknown",t[7]=y):y=t[7];const S=y;let C;t[8]!==f.keybindings?(C=JO(f.keybindings),t[8]=f.keybindings,t[9]=C):C=t[9];const R=C;Aye();let k,T;t[10]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{window.localStorage.setItem(Lye,S)},T=[S],t[10]=k,t[11]=T):(k=t[10],T=t[11]),x.useEffect(k,T);let M;t[12]!==h||t[13]!==R||t[14]!==f?(M=()=>{const Q=function(le){const Te=Il(R,"toggleProjectsSidebar",le);Pye(le,Te)&&(le.preventDefault(),f.toggleProjectsSidebar(h))};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},t[12]=h,t[13]=R,t[14]=f,t[15]=M):M=t[15];let A;t[16]!==h||t[17]!==R||t[18]!==f.toggleProjectsSidebar?(A=[h,R,f.toggleProjectsSidebar],t[16]=h,t[17]=R,t[18]=f.toggleProjectsSidebar,t[19]=A):A=t[19],x.useEffect(M,A);let D;t[20]===Symbol.for("react.memo_cache_sentinel")?(D={top:"var(--app-shell-offset-top)"},t[20]=D):D=t[20];let z,G,$,H,F,B,j,U,P,W;t[21]!==f?(W=(Q,xe)=>{Sa(kr.chatCreate(Q,xe),()=>f.handleCreateChat(Q,xe),{statusLabel:"Starting chat..."})},z=Q=>{f.handleCreateFeature(Q)},G=Q=>{f.handleRenameFeature(Q)},$=Q=>{f.handleDeleteFeature(Q)},H=(Q,xe)=>{f.handleSetProjectBrowserState(Q,xe)},F=(Q,xe)=>{f.handleSetProjectGeneralChatsBrowserState(Q,xe)},B=(Q,xe)=>{f.handleSetFeatureBrowserState(Q,xe)},j=(Q,xe)=>{f.handleSetFeatureStage(Q,xe)},U=(Q,xe)=>{f.handleSetChatFeature(Q,xe)},P=(Q,xe)=>{f.handleReorderFeatures(Q,xe)},t[21]=f,t[22]=z,t[23]=G,t[24]=$,t[25]=H,t[26]=F,t[27]=B,t[28]=j,t[29]=U,t[30]=P,t[31]=W):(z=t[22],G=t[23],$=t[24],H=t[25],F=t[26],B=t[27],j=t[28],U=t[29],P=t[30],W=t[31]);let q,Y,N,I;t[32]!==f?(q=Q=>{f.handleOpenFeatureOverview(Q)},Y=Q=>{f.handleRenameChat(Q)},N=Q=>{f.handleDeleteChat(Q)},I=Q=>{Sa(kr.projectRemove(Q),()=>f.handleRemoveProject(Q),{statusLabel:"Hiding project..."})},t[32]=f,t[33]=q,t[34]=Y,t[35]=N,t[36]=I):(q=t[33],Y=t[34],N=t[35],I=t[36]);let V;t[37]!==f?(V=Q=>f.handleOpenProviderLogin(Q),t[37]=f,t[38]=V):V=t[38];let L;t[39]!==f?(L=()=>{f.handleInstallUpdate()},t[39]=f,t[40]=L):L=t[40];let J;t[41]!==m||t[42]!==h||t[43]!==R.bindings.toggleProjectsSidebar||t[44]!==v||t[45]!==_||t[46]!==f.activeChatId||t[47]!==f.activeOverviewFeatureId||t[48]!==f.closeSidebar||t[49]!==f.completedChatIds||t[50]!==f.connectionStatus||t[51]!==f.expandSidebar||t[52]!==f.folderGroupsEnabled||t[53]!==f.handleRefreshProviderUsage||t[54]!==f.kanbanStatusesEnabled||t[55]!==f.openSidebar||t[56]!==f.providerSettings||t[57]!==f.remoteAuth||t[58]!==f.showFeatureOverviewInSidebar||t[59]!==f.sidebarCollapsed||t[60]!==f.sidebarData||t[61]!==f.sidebarOpen||t[62]!==f.sidebarReady||t[63]!==f.startingLocalPath||t[64]!==f.toggleProjectsSidebar||t[65]!==f.updateSnapshot||t[66]!==z||t[67]!==G||t[68]!==$||t[69]!==H||t[70]!==F||t[71]!==B||t[72]!==j||t[73]!==U||t[74]!==P||t[75]!==q||t[76]!==Y||t[77]!==N||t[78]!==I||t[79]!==V||t[80]!==L||t[81]!==W?(J=g.jsx(YZ,{data:f.sidebarData,completedChatIds:f.completedChatIds,activeChatId:f.activeChatId,activeOverviewFeatureId:f.activeOverviewFeatureId,connectionStatus:f.connectionStatus,ready:f.sidebarReady,open:f.sidebarOpen,collapsed:f.sidebarCollapsed,isDesktopViewport:h,showMobileOpenButton:_,onOpen:f.openSidebar,onClose:f.closeSidebar,onToggle:f.toggleProjectsSidebar,onExpand:f.expandSidebar,desktopWidth:m,toggleShortcut:R.bindings.toggleProjectsSidebar,onResizeDesktopWidth:v,onCreateChat:W,onCreateFeature:z,onRenameFeature:G,onDeleteFeature:$,onSetProjectBrowserState:H,onSetProjectGeneralChatsBrowserState:F,onSetFeatureBrowserState:B,onSetFeatureStage:j,onSetChatFeature:U,onReorderFeatures:P,folderGroupsEnabled:f.folderGroupsEnabled,showFeatureOverviewInSidebar:f.showFeatureOverviewInSidebar,kanbanStatusesEnabled:f.kanbanStatusesEnabled,onOpenFeatureOverview:q,onRenameChat:Y,onDeleteChat:N,onRemoveProject:I,onRefreshProviderUsage:f.handleRefreshProviderUsage,onOpenProviderLogin:V,providerSettings:f.providerSettings,remoteAuth:f.remoteAuth,startingLocalPath:f.startingLocalPath,updateSnapshot:f.updateSnapshot,onInstallUpdate:L}),t[41]=m,t[42]=h,t[43]=R.bindings.toggleProjectsSidebar,t[44]=v,t[45]=_,t[46]=f.activeChatId,t[47]=f.activeOverviewFeatureId,t[48]=f.closeSidebar,t[49]=f.completedChatIds,t[50]=f.connectionStatus,t[51]=f.expandSidebar,t[52]=f.folderGroupsEnabled,t[53]=f.handleRefreshProviderUsage,t[54]=f.kanbanStatusesEnabled,t[55]=f.openSidebar,t[56]=f.providerSettings,t[57]=f.remoteAuth,t[58]=f.showFeatureOverviewInSidebar,t[59]=f.sidebarCollapsed,t[60]=f.sidebarData,t[61]=f.sidebarOpen,t[62]=f.sidebarReady,t[63]=f.startingLocalPath,t[64]=f.toggleProjectsSidebar,t[65]=f.updateSnapshot,t[66]=z,t[67]=G,t[68]=$,t[69]=H,t[70]=F,t[71]=B,t[72]=j,t[73]=U,t[74]=P,t[75]=q,t[76]=Y,t[77]=N,t[78]=I,t[79]=V,t[80]=L,t[81]=W,t[82]=J):J=t[82];const te=f.createFeatureModalProjectId!==null;let ee,oe;t[83]!==f?(ee=Q=>{Q||f.handleCloseCreateFeatureModal()},oe=Q=>f.handleConfirmCreateFeature(Q),t[83]=f,t[84]=ee,t[85]=oe):(ee=t[84],oe=t[85]);let ie;t[86]!==f.isCreatingFeature||t[87]!==te||t[88]!==ee||t[89]!==oe?(ie=g.jsx(fG,{open:te,isSubmitting:f.isCreatingFeature,onOpenChange:ee,onConfirm:oe}),t[86]=f.isCreatingFeature,t[87]=te,t[88]=ee,t[89]=oe,t[90]=ie):ie=t[90];let ue,fe;t[91]!==f?(ue=Q=>{Q||f.handleCloseCursorCurlImport()},fe=Q=>f.handleSubmitCursorCurlImport(Q),t[91]=f,t[92]=ue,t[93]=fe):(ue=t[92],fe=t[93]);let de;t[94]!==f.cursorCurlImportOpen||t[95]!==ue||t[96]!==fe?(de=g.jsx(hG,{open:f.cursorCurlImportOpen,onOpenChange:ue,onSubmit:fe}),t[94]=f.cursorCurlImportOpen,t[95]=ue,t[96]=fe,t[97]=de):de=t[97];let Z;t[98]!==f.activeChatId||t[99]!==f.connectionStatus||t[100]!==f.sidebarData?(Z=g.jsx(wye,{activeChatId:f.activeChatId,connectionStatus:f.connectionStatus,sidebarData:f.sidebarData}),t[98]=f.activeChatId,t[99]=f.connectionStatus,t[100]=f.sidebarData,t[101]=Z):Z=t[101];let ne;t[102]===Symbol.for("react.memo_cache_sentinel")?(ne=g.jsx(_9,{}),t[102]=ne):ne=t[102];let ae;return t[103]!==J||t[104]!==ie||t[105]!==de||t[106]!==Z?(ae=g.jsxs("div",{className:"relative flex h-[var(--app-shell-height)] min-h-[var(--app-shell-height)] overflow-hidden",style:D,children:[J,ie,de,Z,ne]}),t[103]=J,t[104]=ie,t[105]=de,t[106]=Z,t[107]=ae):ae=t[107],ae}function Bye(t){return t.setWidth}function $ye(t){return t.widthPx}function Fye(){const t=ke.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsx(ga,{path:"/open",element:g.jsx(tye,{})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsx(ga,{path:"/remote-setup",element:g.jsx(dye,{})}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx(jye,{}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx(ga,{path:"/",element:g.jsx(x.Suspense,{fallback:g.jsx(px,{label:"Loading local projects..."}),children:g.jsx(Iye,{})})}),t[3]=i):i=t[3];let s;t[4]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx(ga,{path:"/settings",element:g.jsx(b9,{to:"/settings/general",replace:!0})}),t[4]=s):s=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx(ga,{path:"/settings/:sectionId",element:g.jsx(x.Suspense,{fallback:g.jsx(px,{label:"Loading settings..."}),children:g.jsx(Oye,{})})}),t[5]=o):o=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=g.jsx(ga,{path:"/chat/:chatId",element:g.jsx(K_e,{})}),t[6]=l):l=t[6];let c;return t[7]===Symbol.for("react.memo_cache_sentinel")?(c=g.jsx(YW,{children:g.jsxs(cG,{children:[g.jsxs(x9,{children:[e,n,g.jsxs(ga,{element:r,children:[i,s,o,l,g.jsx(ga,{path:"/overview/:featureId",element:g.jsx(x.Suspense,{fallback:g.jsx(px,{label:"Loading feature overview..."}),children:g.jsx(Dye,{})})})]})]}),g.jsx(L$,{})]})}),t[7]=c):c=t[7],c}const b7=document.getElementById("root");if(!b7)throw new Error("Missing #root");yB.createRoot(b7).render(g.jsx(W9,{basename:tP(),children:g.jsx(Fde,{children:g.jsx(Fye,{})})}));export{g7 as $,Uye as A,gt as B,uP as C,Ww as D,xF as E,DF as F,Qs as G,Qye as H,xb as I,q4 as J,jw as K,Vn as L,Mp as M,nq as N,Vs as O,Vl as P,dZ as Q,Jg as R,rj as S,sp as T,PT as U,Ys as V,Xs as W,Ks as X,Ed as Y,hi as Z,fd as _,ke as a,Xd as a0,lL as a1,Kb as a2,PJ as a3,cr as a4,oZ as a5,zO as a6,aZ as a7,FO as a8,Jc as a9,DJ as aA,cZ as aB,w1e as aC,qye as aD,TJ as aE,RJ as aF,eS as aG,MJ as aH,AJ as aI,tS as aJ,Jye as aK,Zye as aL,bq as aM,Xq as aN,o1e as aO,l1e as aP,Lp as aQ,S1e as aR,C1e as aS,Sye as aT,yye as aU,yq as aV,kZ as aW,va as aX,TZ as aY,HC as aa,HO as ab,u0e as ac,c1e as ad,cx as ae,dd as af,ui as ag,uF as ah,a1e as ai,pi as aj,k4 as ak,Hde as al,Dv as am,wa as an,bd as ao,hx as ap,JO as aq,Yye as ar,Xye as as,e1e as at,wq as au,xv as av,Xb as aw,V4 as ax,Ni as ay,s1e as az,gp as b,at as c,Qd as d,G2 as e,qb as f,kr as g,vd as h,we as i,Rp as j,g as k,lfe as l,Sa as m,Np as n,fP as o,Cc as p,ev as q,x as r,yb as s,Yw as t,Xc as u,qw as v,Dae as w,Kye as x,Xw as y,Qi as z};