import{s as e}from"./chunk-Bj-mKKzh.js";import{Br as t,C as n}from"./src-BOCweS1p.js";import{t as r}from"./jsx-runtime-CiQ1k8xo.js";import{lt as i,n as a}from"./vscode-api-DjORcpSo.js";import{o,r as s}from"./lib-MoKmYgcO.js";import{t as c}from"./button-Bi7lGVi1.js";import{a as l}from"./setting-storage-CwKZnsvR.js";import{t as u}from"./use-codex-home-_jJnkmXS.js";import{t as d}from"./use-os-info-DcufBSKF.js";import{t as f}from"./link-external-oqLWmWWX.js";import{t as p}from"./open-workspace-file-CJcJ-CWR.js";var m=s({openConfigToml:{id:`codex.profileDropdown.openConfigToml`,defaultMessage:`Open config.toml`,description:`Action to open the MCP configuration file`},openConfigTomlWsl:{id:`codex.profileDropdown.openConfigToml.wsl`,defaultMessage:`Open config.toml in WSL environment`,description:`Action to open the MCP configuration file inside Windows Subsystem for Linux`}});async function h(e){p({path:e.path,cwd:null,hostId:e.hostId,target:await g(e.hostId),...e.range==null?{}:{line:e.range.start.line,column:e.range.start.column}})}async function g(e){try{return(await a(`open-in-targets`,{params:{cwd:null,hostId:e}})).preferredTarget}catch{return}}var _=i(),v=e(t(),1),y=r();function b(e){let t=(0,_.c)(7),{hostId:n}=e,{configPath:r,label:i}=S(n),a;t[0]!==r||t[1]!==n?(a=()=>{r!=null&&h({hostId:n,path:r})},t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=r==null,s;return t[3]!==i||t[4]!==a||t[5]!==o?(s=(0,y.jsx)(c,{color:`secondary`,size:`toolbar`,className:`inline-flex w-fit`,onClick:a,disabled:o,children:i}),t[3]=i,t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function x(e){let t=(0,_.c)(8),{hostId:n}=e,{configPath:r,label:i}=S(n),a;t[0]!==r||t[1]!==n?(a=()=>{r!=null&&h({hostId:n,path:r})},t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=r==null,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,y.jsx)(f,{className:`icon-xxs shrink-0`,"aria-hidden":!0}),t[3]=s):s=t[3];let c;return t[4]!==i||t[5]!==a||t[6]!==o?(c=(0,y.jsxs)(`button`,{type:`button`,className:`inline-flex cursor-interaction items-center gap-1 text-start font-medium text-token-text-secondary hover:text-token-text-primary disabled:cursor-not-allowed disabled:opacity-50`,onClick:a,disabled:o,children:[i,s]}),t[4]=i,t[5]=a,t[6]=o,t[7]=c):c=t[7],c}function S(e){let t=(0,_.c)(7),{data:r}=d(),i=l(n.runCodexInWsl),a=u(e),s=r?.platform===`win32`&&r?.hasWsl&&i,c;t[0]===a?c=t[1]:(c=a==null?null:v.default.join(a,`config.toml`),t[0]=a,t[1]=c);let f=c,p;t[2]===s?p=t[3]:(p=s?(0,y.jsx)(o,{...m.openConfigTomlWsl}):(0,y.jsx)(o,{...m.openConfigToml}),t[2]=s,t[3]=p);let h=p,g;return t[4]!==f||t[5]!==h?(g={configPath:f,label:h},t[4]=f,t[5]=h,t[6]=g):g=t[6],g}export{x as n,h as r,b as t};
//# sourceMappingURL=open-config-toml-button-COilP6Y2.js.map