@smithery/cli 1.4.6 → 1.4.7

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 (2) hide show
  1. package/dist/index.js +5 -5
  2. package/package.json +2 -6
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,a=>{let
45
45
  `?(a&&(n+=Cj("")),i&&g&&(n+=Sj(g))):m===`
46
46
  `&&(i&&g&&(n+=Sj(i)),a&&(n+=Cj(a))),d+=m.length}return n}});import w6 from"node:process";function zy(t,e){if(e={padding:0,borderStyle:"single",dimBorder:!1,textAlignment:"left",float:"left",titleAlignment:"left",...e},e.align&&(e.textAlignment=e.align),e.borderColor&&!qj(e.borderColor))throw new Error(`${e.borderColor} is not a valid borderColor`);if(e.backgroundColor&&!qj(e.backgroundColor))throw new Error(`${e.backgroundColor} is not a valid backgroundColor`);return e.padding=Tj(e.padding),e.margin=Tj(e.margin),e=e9e(t,e),t=Q5e(t,e),Z5e(t,e.width,e)}var Rj,Uy,n9e,zo,Qn,K1,Ij,Tj,J1,J5e,Y5e,Q5e,Z5e,X5e,Pj,e9e,Vy,qj,t9e,r9e,kj=fe(()=>{H1();XB();ej();Rj=ye(qy(),1);oj();Uy=ye(gj(),1);Oj();n9e=ye(qy(),1),zo=`
47
47
  `,Qn=" ",K1="none",Ij=()=>{let{env:t,stdout:e,stderr:r}=w6;return e?.columns?e.columns:r?.columns?r.columns:t.COLUMNS?Number.parseInt(t.COLUMNS,10):80},Tj=t=>typeof t=="number"?{top:t,right:t*3,bottom:t,left:t*3}:{top:0,right:0,bottom:0,left:0,...t},J1=t=>t===K1?0:2,J5e=t=>{let e=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],r;if(t===K1){t={};for(let n of e)t[n]=""}if(typeof t=="string"){if(r=Rj.default[t],!r)throw new TypeError(`Invalid border style: ${t}`)}else{typeof t?.vertical=="string"&&(t.left=t.vertical,t.right=t.vertical),typeof t?.horizontal=="string"&&(t.top=t.horizontal,t.bottom=t.horizontal);for(let n of e)if(t[n]===null||typeof t[n]!="string")throw new TypeError(`Invalid border style: ${n}`);r=t}return r},Y5e=(t,e,r)=>{let n="",i=Gr(t);switch(r){case"left":{n=t+e.slice(i);break}case"right":{n=e.slice(i)+t;break}default:{e=e.slice(i),e.length%2===1?(e=e.slice(Math.floor(e.length/2)),n=e.slice(1)+t+e):(e=e.slice(e.length/2),n=e+t+e);break}}return n},Q5e=(t,{padding:e,width:r,textAlignment:n,height:i})=>{t=(0,Uy.default)(t,{align:n});let a=t.split(zo),s=x6(t),o=r-e.left-e.right;if(s>o){let d=[];for(let f of a){let m=D6(f,o,{hard:!0}),b=(0,Uy.default)(m,{align:n}).split(`
48
- `),x=Math.max(...b.map(y=>Gr(y)));for(let y of b){let _;switch(n){case"center":{_=Qn.repeat((o-x)/2)+y;break}case"right":{_=Qn.repeat(o-x)+y;break}default:{_=y;break}}d.push(_)}}a=d}n==="center"&&s<o?a=a.map(d=>Qn.repeat((o-s)/2)+d):n==="right"&&s<o&&(a=a.map(d=>Qn.repeat(o-s)+d));let c=Qn.repeat(e.left),l=Qn.repeat(e.right);return a=a.map(d=>{let f=c+d+l;return f+Qn.repeat(r-Gr(f))}),e.top>0&&(a=[...Array.from({length:e.top}).fill(Qn.repeat(r)),...a]),e.bottom>0&&(a=[...a,...Array.from({length:e.bottom}).fill(Qn.repeat(r))]),i&&a.length>i?a=a.slice(0,i):i&&a.length<i&&(a=[...a,...Array.from({length:i-a.length}).fill(Qn.repeat(r))]),a.join(zo)},Z5e=(t,e,r)=>{let n=d=>{let f=r.borderColor?t9e(r.borderColor)(d):d;return r.dimBorder?Ac.dim(f):f},i=d=>r.backgroundColor?r9e(r.backgroundColor)(d):d,a=J5e(r.borderStyle),s=Ij(),o=Qn.repeat(r.margin.left);if(r.float==="center"){let d=Math.max((s-e-J1(r.borderStyle))/2,0);o=Qn.repeat(d)}else if(r.float==="right"){let d=Math.max(s-e-r.margin.right-J1(r.borderStyle),0);o=Qn.repeat(d)}let c="";r.margin.top&&(c+=zo.repeat(r.margin.top)),(r.borderStyle!==K1||r.title)&&(c+=n(o+a.topLeft+(r.title?Y5e(r.title,a.top.repeat(e),r.titleAlignment):a.top.repeat(e))+a.topRight)+zo);let l=t.split(zo);return c+=l.map(d=>o+n(a.left)+i(d)+n(a.right)).join(zo),r.borderStyle!==K1&&(c+=zo+n(o+a.bottomLeft+a.bottom.repeat(e)+a.bottomRight)),r.margin.bottom&&(c+=zo.repeat(r.margin.bottom)),c},X5e=t=>{if(t.fullscreen&&w6?.stdout){let e=[w6.stdout.columns,w6.stdout.rows];typeof t.fullscreen=="function"&&(e=t.fullscreen(...e)),t.width||=e[0],t.height||=e[1]}return t.width&&=Math.max(1,t.width-J1(t.borderStyle)),t.height&&=Math.max(1,t.height-J1(t.borderStyle)),t},Pj=(t,e)=>e===K1?t:` ${t} `,e9e=(t,e)=>{e=X5e(e);let r=e.width!==void 0,n=Ij(),i=J1(e.borderStyle),a=n-e.margin.left-e.margin.right-i,s=x6(D6(t,n-i,{hard:!0,trim:!1}))+e.padding.left+e.padding.right;if(e.title&&r?(e.title=e.title.slice(0,Math.max(0,e.width-2)),e.title&&=Pj(e.title,e.borderStyle)):e.title&&(e.title=e.title.slice(0,Math.max(0,a-2)),e.title&&(e.title=Pj(e.title,e.borderStyle),Gr(e.title)>s&&(e.width=Gr(e.title)))),e.width||=s,!r){if(e.margin.left&&e.margin.right&&e.width>a){let c=(n-e.width-i)/(e.margin.left+e.margin.right);e.margin.left=Math.max(0,Math.floor(e.margin.left*c)),e.margin.right=Math.max(0,Math.floor(e.margin.right*c))}e.width=Math.min(e.width,n-i-e.margin.left-e.margin.right)}return e.width-(e.padding.left+e.padding.right)<=0&&(e.padding.left=0,e.padding.right=0),e.height&&e.height-(e.padding.top+e.padding.bottom)<=0&&(e.padding.top=0,e.padding.bottom=0),e},Vy=t=>t.match(/^#(?:[0-f]{3}){1,2}$/i),qj=t=>typeof t=="string"&&(Ac[t]??Vy(t)),t9e=t=>Vy(t)?Ac.hex(t):Ac[t],r9e=t=>Vy(t)?Ac.bgHex(t):Ac[Iy(["bg",t])]});function Nj(t){let{name:e,...r}=t,n=Buffer.from(JSON.stringify(r)).toString("base64"),i=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(e)}&config=${encodeURIComponent(n)}`,a=`cursor://anysphere.cursor-deeplink/mcp/install?name=${e}&config=...`;return{url:i,displayText:a}}function Bj(t){let e=`vscode:mcp/install?${encodeURIComponent(JSON.stringify(t))}`,r=`vscode:mcp/install?{"name":"${t.name}","type":"${t.type}",...}`;return{url:e,displayText:r}}function Hy(t,e){return`\x1B]8;;${t}\x1B\\${e}\x1B]8;;\x1B\\`}var jj=fe(()=>{"use strict"});import{exec as i9e}from"node:child_process";import{promisify as a9e}from"node:util";async function Lj(t,e,r){let n=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${t}/mcp`)}`;try{let i=process.platform,a;switch(i){case"darwin":a=`open "${n}"`;break;case"win32":a=`start "" "${n}"`;break;default:a=`xdg-open "${n}"`;break}await s9e(a)}catch{console.log(Wy.default.yellow("Could not open browser automatically")),console.log(Wy.default.gray("Please open the link manually"))}}var Wy,s9e,Mj=fe(()=>{"use strict";Wy=ye(at(),1),s9e=a9e(i9e)});function Vj(t){$j=t}function zj(t){Uj=t}function V(t){$j&&console.log(Gy.default.gray(`[verbose] ${t}`))}function da(t){Uj&&console.debug(Gy.default.blue(`[debug] ${t}`))}var Gy,$j,Uj,Zn=fe(()=>{"use strict";Gy=ye(at(),1),$j=!1,Uj=!1});async function o9e(t){try{let e=process.env.REGISTRY_ENDPOINT||"https://registry.smithery.ai",r=await fetch(`${e}/uplink/token`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!r.ok)throw r.status===401?new Error("Unauthorized: Invalid API key"):new Error(`Failed to get tunnel token: ${r.statusText}`);return await r.json()}catch(e){throw new Error(`Failed to connect to Smithery API: ${e instanceof Error?e.message:e}`)}}function Hj(t){let e=[/(?:localhost|127\.0\.0\.1):(\d+)/g,/port\s+(\d+)/gi,/running.*?(\d{4,5})/gi,/server.*?(\d{4,5})/gi,/http:\/\/.*?:(\d+)/gi];for(let r of e){let n=r.exec(t);if(n?.[1]){let i=Number.parseInt(n[1],10);if(i>1e3&&i<65536)return n[1]}}return null}async function Wj(t,e){da(Ky.default.blue(`\u{1F680} Starting tunnel for localhost:${t}...`)),da(Ky.default.gray("Getting tunnel credentials..."));let{authtoken:r,domain:n}=await o9e(e),a=await(await import("@ngrok/ngrok")).default.forward({addr:t,authtoken:r,domain:n}),s=a.url();if(!s)throw new Error("Failed to get tunnel URL");return{listener:a,url:s}}var Ky,Jy=fe(()=>{"use strict";Ky=ye(at(),1);Zn()});async function Ua(t,e,r=!0,n){let{listener:i,url:a}=await Wj(t,e),s=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${a}/mcp`)}`,c={name:"smithery-dev",type:"http",url:`${a}/mcp`,headers:{}},l=Nj(c),d=Hy(l.url,l.displayText),f=Bj(c),m=Hy(f.url,f.displayText);console.log(""),console.log(` ${Lt.default.bold.italic.hex("#ea580c")("SMITHERY")} ${Lt.default.bold.italic.hex("#ea580c")("v1.4.6")} ready`),console.log(""),console.log(` ${Lt.default.green(Lt.default.dim("\u279C"))} ${Lt.default.bold(Lt.default.dim("Local:"))} ${Lt.default.cyan(`http://localhost:${t}/`)}`),console.log(` ${Lt.default.green(Lt.default.dim("\u279C"))} ${Lt.default.bold(Lt.default.dim("Remote:"))} ${Lt.default.cyan(a)}`),console.log(` ${Lt.default.green("\u279C")} ${Lt.default.bold("Playground")}: ${Lt.default.cyan(s)}`),console.log("");let g=[`${Lt.default.bold("Cursor")}: ${Lt.default.cyan(d)}`,`${Lt.default.bold("VS Code")}: ${Lt.default.cyan(m)}`,"",`${Lt.default.dim("Note: If required config needed, attach using URL params")}`,`${Lt.default.dim("e.g.")} ${Lt.default.dim.cyan("https://server.com/mcp")}${Lt.default.cyan("?weatherApiKey=abc123")}`].join(`
48
+ `),x=Math.max(...b.map(y=>Gr(y)));for(let y of b){let _;switch(n){case"center":{_=Qn.repeat((o-x)/2)+y;break}case"right":{_=Qn.repeat(o-x)+y;break}default:{_=y;break}}d.push(_)}}a=d}n==="center"&&s<o?a=a.map(d=>Qn.repeat((o-s)/2)+d):n==="right"&&s<o&&(a=a.map(d=>Qn.repeat(o-s)+d));let c=Qn.repeat(e.left),l=Qn.repeat(e.right);return a=a.map(d=>{let f=c+d+l;return f+Qn.repeat(r-Gr(f))}),e.top>0&&(a=[...Array.from({length:e.top}).fill(Qn.repeat(r)),...a]),e.bottom>0&&(a=[...a,...Array.from({length:e.bottom}).fill(Qn.repeat(r))]),i&&a.length>i?a=a.slice(0,i):i&&a.length<i&&(a=[...a,...Array.from({length:i-a.length}).fill(Qn.repeat(r))]),a.join(zo)},Z5e=(t,e,r)=>{let n=d=>{let f=r.borderColor?t9e(r.borderColor)(d):d;return r.dimBorder?Ac.dim(f):f},i=d=>r.backgroundColor?r9e(r.backgroundColor)(d):d,a=J5e(r.borderStyle),s=Ij(),o=Qn.repeat(r.margin.left);if(r.float==="center"){let d=Math.max((s-e-J1(r.borderStyle))/2,0);o=Qn.repeat(d)}else if(r.float==="right"){let d=Math.max(s-e-r.margin.right-J1(r.borderStyle),0);o=Qn.repeat(d)}let c="";r.margin.top&&(c+=zo.repeat(r.margin.top)),(r.borderStyle!==K1||r.title)&&(c+=n(o+a.topLeft+(r.title?Y5e(r.title,a.top.repeat(e),r.titleAlignment):a.top.repeat(e))+a.topRight)+zo);let l=t.split(zo);return c+=l.map(d=>o+n(a.left)+i(d)+n(a.right)).join(zo),r.borderStyle!==K1&&(c+=zo+n(o+a.bottomLeft+a.bottom.repeat(e)+a.bottomRight)),r.margin.bottom&&(c+=zo.repeat(r.margin.bottom)),c},X5e=t=>{if(t.fullscreen&&w6?.stdout){let e=[w6.stdout.columns,w6.stdout.rows];typeof t.fullscreen=="function"&&(e=t.fullscreen(...e)),t.width||=e[0],t.height||=e[1]}return t.width&&=Math.max(1,t.width-J1(t.borderStyle)),t.height&&=Math.max(1,t.height-J1(t.borderStyle)),t},Pj=(t,e)=>e===K1?t:` ${t} `,e9e=(t,e)=>{e=X5e(e);let r=e.width!==void 0,n=Ij(),i=J1(e.borderStyle),a=n-e.margin.left-e.margin.right-i,s=x6(D6(t,n-i,{hard:!0,trim:!1}))+e.padding.left+e.padding.right;if(e.title&&r?(e.title=e.title.slice(0,Math.max(0,e.width-2)),e.title&&=Pj(e.title,e.borderStyle)):e.title&&(e.title=e.title.slice(0,Math.max(0,a-2)),e.title&&(e.title=Pj(e.title,e.borderStyle),Gr(e.title)>s&&(e.width=Gr(e.title)))),e.width||=s,!r){if(e.margin.left&&e.margin.right&&e.width>a){let c=(n-e.width-i)/(e.margin.left+e.margin.right);e.margin.left=Math.max(0,Math.floor(e.margin.left*c)),e.margin.right=Math.max(0,Math.floor(e.margin.right*c))}e.width=Math.min(e.width,n-i-e.margin.left-e.margin.right)}return e.width-(e.padding.left+e.padding.right)<=0&&(e.padding.left=0,e.padding.right=0),e.height&&e.height-(e.padding.top+e.padding.bottom)<=0&&(e.padding.top=0,e.padding.bottom=0),e},Vy=t=>t.match(/^#(?:[0-f]{3}){1,2}$/i),qj=t=>typeof t=="string"&&(Ac[t]??Vy(t)),t9e=t=>Vy(t)?Ac.hex(t):Ac[t],r9e=t=>Vy(t)?Ac.bgHex(t):Ac[Iy(["bg",t])]});function Nj(t){let{name:e,...r}=t,n=Buffer.from(JSON.stringify(r)).toString("base64"),i=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(e)}&config=${encodeURIComponent(n)}`,a=`cursor://anysphere.cursor-deeplink/mcp/install?name=${e}&config=...`;return{url:i,displayText:a}}function Bj(t){let e=`vscode:mcp/install?${encodeURIComponent(JSON.stringify(t))}`,r=`vscode:mcp/install?{"name":"${t.name}","type":"${t.type}",...}`;return{url:e,displayText:r}}function Hy(t,e){return`\x1B]8;;${t}\x1B\\${e}\x1B]8;;\x1B\\`}var jj=fe(()=>{"use strict"});import{exec as i9e}from"node:child_process";import{promisify as a9e}from"node:util";async function Lj(t,e,r){let n=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${t}/mcp`)}`;try{let i=process.platform,a;switch(i){case"darwin":a=`open "${n}"`;break;case"win32":a=`start "" "${n}"`;break;default:a=`xdg-open "${n}"`;break}await s9e(a)}catch{console.log(Wy.default.yellow("Could not open browser automatically")),console.log(Wy.default.gray("Please open the link manually"))}}var Wy,s9e,Mj=fe(()=>{"use strict";Wy=ye(at(),1),s9e=a9e(i9e)});function Vj(t){$j=t}function zj(t){Uj=t}function V(t){$j&&console.log(Gy.default.gray(`[verbose] ${t}`))}function da(t){Uj&&console.debug(Gy.default.blue(`[debug] ${t}`))}var Gy,$j,Uj,Zn=fe(()=>{"use strict";Gy=ye(at(),1),$j=!1,Uj=!1});async function o9e(t){try{let e=process.env.REGISTRY_ENDPOINT||"https://registry.smithery.ai",r=await fetch(`${e}/uplink/token`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!r.ok)throw r.status===401?new Error("Unauthorized: Invalid API key"):new Error(`Failed to get tunnel token: ${r.statusText}`);return await r.json()}catch(e){throw new Error(`Failed to connect to Smithery API: ${e instanceof Error?e.message:e}`)}}function Hj(t){let e=[/(?:localhost|127\.0\.0\.1):(\d+)/g,/port\s+(\d+)/gi,/running.*?(\d{4,5})/gi,/server.*?(\d{4,5})/gi,/http:\/\/.*?:(\d+)/gi];for(let r of e){let n=r.exec(t);if(n?.[1]){let i=Number.parseInt(n[1],10);if(i>1e3&&i<65536)return n[1]}}return null}async function Wj(t,e){da(Ky.default.blue(`\u{1F680} Starting tunnel for localhost:${t}...`)),da(Ky.default.gray("Getting tunnel credentials..."));let{authtoken:r,domain:n}=await o9e(e),a=await(await import("@ngrok/ngrok")).default.forward({addr:t,authtoken:r,domain:n}),s=a.url();if(!s)throw new Error("Failed to get tunnel URL");return{listener:a,url:s}}var Ky,Jy=fe(()=>{"use strict";Ky=ye(at(),1);Zn()});async function Ua(t,e,r=!0,n){let{listener:i,url:a}=await Wj(t,e),s=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${a}/mcp`)}`,c={name:"smithery-dev",type:"http",url:`${a}/mcp`,headers:{}},l=Nj(c),d=Hy(l.url,l.displayText),f=Bj(c),m=Hy(f.url,f.displayText);console.log(""),console.log(` ${Lt.default.bold.italic.hex("#ea580c")("SMITHERY")} ${Lt.default.bold.italic.hex("#ea580c")("v1.4.7")} ready`),console.log(""),console.log(` ${Lt.default.green(Lt.default.dim("\u279C"))} ${Lt.default.bold(Lt.default.dim("Local:"))} ${Lt.default.cyan(`http://localhost:${t}/`)}`),console.log(` ${Lt.default.green(Lt.default.dim("\u279C"))} ${Lt.default.bold(Lt.default.dim("Remote:"))} ${Lt.default.cyan(a)}`),console.log(` ${Lt.default.green("\u279C")} ${Lt.default.bold("Playground")}: ${Lt.default.cyan(s)}`),console.log("");let g=[`${Lt.default.bold("Cursor")}: ${Lt.default.cyan(d)}`,`${Lt.default.bold("VS Code")}: ${Lt.default.cyan(m)}`,"",`${Lt.default.dim("Note: If required config needed, attach using URL params")}`,`${Lt.default.dim("e.g.")} ${Lt.default.dim.cyan("https://server.com/mcp")}${Lt.default.cyan("?weatherApiKey=abc123")}`].join(`
49
49
  `);return console.log(zy(g,{title:"Add to Client",padding:{left:1,right:1,top:0,bottom:0},margin:{left:2},borderStyle:"round",borderColor:"dim"})),console.log(""),r&&await Lj(a,t,n),{listener:i,url:a}}var Lt,Pp=fe(()=>{"use strict";kj();Lt=ye(at(),1);jj();Mj();Jy()});var Qj=v((avt,Yj)=>{Yj.exports=Jj;Jj.sync=c9e;var Gj=ee("fs");function u9e(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function Kj(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:u9e(e,r)}function Jj(t,e,r){Gj.stat(t,function(n,i){r(n,n?!1:Kj(i,t,e))})}function c9e(t,e){return Kj(Gj.statSync(t),t,e)}});var rL=v((svt,tL)=>{tL.exports=Xj;Xj.sync=l9e;var Zj=ee("fs");function Xj(t,e,r){Zj.stat(t,function(n,i){r(n,n?!1:eL(i,e))})}function l9e(t,e){return eL(Zj.statSync(t),e)}function eL(t,e){return t.isFile()&&p9e(t,e)}function p9e(t,e){var r=t.mode,n=t.uid,i=t.gid,a=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),d=o|c,f=r&l||r&c&&i===s||r&o&&n===a||r&d&&a===0;return f}});var iL=v((uvt,nL)=>{var ovt=ee("fs"),C6;process.platform==="win32"||global.TESTING_WINDOWS?C6=Qj():C6=rL();nL.exports=Yy;Yy.sync=d9e;function Yy(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Yy(t,e||{},function(a,s){a?i(a):n(s)})})}C6(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function d9e(t,e){try{return C6.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var pL=v((cvt,lL)=>{var qp=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",aL=ee("path"),f9e=qp?";":":",sL=iL(),oL=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),uL=(t,e)=>{let r=e.colon||f9e,n=t.match(/\//)||qp&&t.match(/\\/)?[""]:[...qp?[process.cwd()]:[],...(e.path||"/home/runner/work/cli/cli/node_modules/.bin:/home/runner/work/cli/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/20.19.5/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/runner/work/cli/cli/node_modules/.bin:/home/runner/work/cli/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/20.19.5/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/opt/hostedtoolcache/node/20.19.5/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r)],i=qp?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=qp?i.split(r):[""];return qp&&t.indexOf(".")!==-1&&a[0]!==""&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:i}},cL=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:a}=uL(t,e),s=[],o=l=>new Promise((d,f)=>{if(l===n.length)return e.all&&s.length?d(s):f(oL(t));let m=n[l],g=/^".*"$/.test(m)?m.slice(1,-1):m,b=aL.join(g,t),x=!g&&/^\.[\\\/]/.test(t)?t.slice(0,2)+b:b;d(c(x,l,0))}),c=(l,d,f)=>new Promise((m,g)=>{if(f===i.length)return m(o(d+1));let b=i[f];sL(l+b,{pathExt:a},(x,y)=>{if(!x&&y)if(e.all)s.push(l+b);else return m(l+b);return m(c(l,d,f+1))})});return r?o(0).then(l=>r(null,l),r):o(0)},m9e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=uL(t,e),a=[];for(let s=0;s<r.length;s++){let o=r[s],c=/^".*"$/.test(o)?o.slice(1,-1):o,l=aL.join(c,t),d=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let f=0;f<n.length;f++){let m=d+n[f];try{if(sL.sync(m,{pathExt:i}))if(e.all)a.push(m);else return m}catch{}}}if(e.all&&a.length)return a;if(e.nothrow)return null;throw oL(t)};lL.exports=cL;cL.sync=m9e});var fL=v((lvt,Qy)=>{"use strict";var dL=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Qy.exports=dL;Qy.exports.default=dL});var gL=v((pvt,vL)=>{"use strict";var mL=ee("path"),h9e=pL(),v9e=fL();function hL(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,a=i&&process.chdir!==void 0&&!process.chdir.disabled;if(a)try{process.chdir(t.options.cwd)}catch{}let s;try{s=h9e.sync(t.command,{path:r[v9e({env:r})],pathExt:e?mL.delimiter:void 0})}catch{}finally{a&&process.chdir(n)}return s&&(s=mL.resolve(i?t.options.cwd:"",s)),s}function g9e(t){return hL(t)||hL(t,!0)}vL.exports=g9e});var xL=v((dvt,Xy)=>{"use strict";var Zy=/([()\][%!^"`<>&|;, *?])/g;function x9e(t){return t=t.replace(Zy,"^$1"),t}function b9e(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Zy,"^$1"),e&&(t=t.replace(Zy,"^$1")),t}Xy.exports.command=x9e;Xy.exports.argument=b9e});var yL=v((fvt,bL)=>{"use strict";bL.exports=/^#!(.*)/});var wL=v((mvt,DL)=>{"use strict";var y9e=yL();DL.exports=(t="")=>{let e=t.match(y9e);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var EL=v((hvt,_L)=>{"use strict";var eD=ee("fs"),D9e=wL();function w9e(t){let r=Buffer.alloc(150),n;try{n=eD.openSync(t,"r"),eD.readSync(n,r,0,150,0),eD.closeSync(n)}catch{}return D9e(r.toString())}_L.exports=w9e});var AL=v((vvt,FL)=>{"use strict";var _9e=ee("path"),SL=gL(),CL=xL(),E9e=EL(),S9e=process.platform==="win32",C9e=/\.(?:com|exe)$/i,F9e=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function A9e(t){t.file=SL(t);let e=t.file&&E9e(t.file);return e?(t.args.unshift(t.file),t.command=e,SL(t)):t.file}function O9e(t){if(!S9e)return t;let e=A9e(t),r=!C9e.test(e);if(t.options.forceShell||r){let n=F9e.test(e);t.command=_9e.normalize(t.command),t.command=CL.command(t.command),t.args=t.args.map(a=>CL.argument(a,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function T9e(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:O9e(n)}FL.exports=T9e});var PL=v((gvt,TL)=>{"use strict";var tD=process.platform==="win32";function rD(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function P9e(t,e){if(!tD)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let a=OL(i,e);if(a)return r.call(t,"error",a)}return r.apply(t,arguments)}}function OL(t,e){return tD&&t===1&&!e.file?rD(e.original,"spawn"):null}function q9e(t,e){return tD&&t===1&&!e.file?rD(e.original,"spawnSync"):null}TL.exports={hookChildProcess:P9e,verifyENOENT:OL,verifyENOENTSync:q9e,notFoundError:rD}});var IL=v((xvt,Rp)=>{"use strict";var qL=ee("child_process"),nD=AL(),iD=PL();function RL(t,e,r){let n=nD(t,e,r),i=qL.spawn(n.command,n.args,n.options);return iD.hookChildProcess(i,n),i}function R9e(t,e,r){let n=nD(t,e,r),i=qL.spawnSync(n.command,n.args,n.options);return i.error=i.error||iD.verifyENOENTSync(i.status,n),i}Rp.exports=RL;Rp.exports.spawn=RL;Rp.exports.sync=R9e;Rp.exports._parse=nD;Rp.exports._enoent=iD});var Ke,aD,le,Va,Y1=fe(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let s of i)a[s]=s;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(let o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(let s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ke||(Ke={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(aD||(aD={}));le=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Va=t=>{switch(typeof t){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(t)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(t)?le.array:t===null?le.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?le.promise:typeof Map<"u"&&t instanceof Map?le.map:typeof Set<"u"&&t instanceof Set?le.set:typeof Date<"u"&&t instanceof Date?le.date:le.object;default:return le.unknown}}});var te,I9e,Ir,F6=fe(()=>{Y1();te=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),I9e=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Ir=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(s))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ir.create=t=>new Ir(t)});var k9e,Ws,sD=fe(()=>{F6();Y1();k9e=(t,e)=>{let r;switch(t.code){case te.invalid_type:t.received===le.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ke.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ke.joinValues(t.keys,", ")}`;break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ke.joinValues(t.options)}`;break;case te.invalid_enum_value:r=`Invalid enum value. Expected ${Ke.joinValues(t.options)}, received '${t.received}'`;break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ke.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case te.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case te.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case te.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ke.assertNever(t)}return{message:r}},Ws=k9e});function N9e(t){kL=t}function Ip(){return kL}var kL,A6=fe(()=>{sD();kL=Ws});function oe(t,e){let r=Ip(),n=Q1({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ws?void 0:Ws].filter(i=>!!i)});t.common.issues.push(n)}var Q1,B9e,Kr,_e,Tc,pn,O6,T6,Ho,kp,oD=fe(()=>{A6();sD();Q1=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],s={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let o="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)o=l(s,{data:e,defaultError:o}).message;return{...i,path:a,message:o}},B9e=[];Kr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return _e;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,s=await i.value;n.push({key:a,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:s}=i;if(a.status==="aborted"||s.status==="aborted")return _e;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[a.value]=s.value)}return{status:e.value,value:n}}},_e=Object.freeze({status:"aborted"}),Tc=t=>({status:"dirty",value:t}),pn=t=>({status:"valid",value:t}),O6=t=>t.status==="aborted",T6=t=>t.status==="dirty",Ho=t=>t.status==="valid",kp=t=>typeof Promise<"u"&&t instanceof Promise});var NL=fe(()=>{});var he,BL=fe(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(he||(he={}))});function Be(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,o)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:i}}function $L(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function ege(t){return new RegExp(`^${$L(t)}$`)}function UL(t){let e=`${ML}T${$L(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function tge(t,e){return!!((e==="v4"||!e)&&G9e.test(t)||(e==="v6"||!e)&&J9e.test(t))}function rge(t,e){if(!V9e.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function nge(t,e){return!!((e==="v4"||!e)&&K9e.test(t)||(e==="v6"||!e)&&Y9e.test(t))}function ige(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}function Np(t){if(t instanceof In){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Si.create(Np(n))}return new In({...t._def,shape:()=>e})}else return t instanceof Js?new Js({...t._def,type:Np(t.element)}):t instanceof Si?Si.create(Np(t.unwrap())):t instanceof Ha?Ha.create(Np(t.unwrap())):t instanceof za?za.create(t.items.map(e=>Np(e))):t}function cD(t,e){let r=Va(t),n=Va(e);if(t===e)return{valid:!0,data:t};if(r===le.object&&n===le.object){let i=Ke.objectKeys(e),a=Ke.objectKeys(t).filter(o=>i.indexOf(o)!==-1),s={...t,...e};for(let o of a){let c=cD(t[o],e[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(r===le.array&&n===le.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let s=t[a],o=e[a],c=cD(s,o);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===le.date&&n===le.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function VL(t,e){return new $c({values:t,typeName:Ce.ZodEnum,...Be(e)})}function LL(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function zL(t,e={},r){return t?Go.create().superRefine((n,i)=>{let a=t(n);if(a instanceof Promise)return a.then(s=>{if(!s){let o=LL(e,n),c=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:c})}});if(!a){let s=LL(e,n),o=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:o})}}):Go.create()}var Ci,jL,Ue,j9e,L9e,M9e,$9e,U9e,V9e,z9e,H9e,W9e,uD,G9e,K9e,J9e,Y9e,Q9e,Z9e,ML,X9e,Wo,Pc,qc,Rc,Ic,Bp,kc,Nc,Go,Ks,fa,jp,Js,In,Bc,Gs,P6,jc,za,q6,Lp,Mp,R6,Lc,Mc,$c,Uc,Ko,Fi,Si,Ha,Vc,zc,$p,age,Z1,X1,Hc,sge,Ce,dn,be,_r,oge,uge,Wa,lD,cge,lge,pge,Ys,dge,fge,mge,Qs,Fe,hge,vge,gge,xge,bge,Jo,yge,Dge,wge,Wc,_ge,Ege,Up,Sge,Cge,Fge,Xn,Age,Oge,Tge,Pge,qge,pD,Rge,HL=fe(()=>{F6();A6();BL();oD();Y1();Ci=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},jL=(t,e)=>{if(Ho(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ir(t.common.issues);return this._error=r,this._error}}};Ue=class{get description(){return this._def.description}_getType(e){return Va(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Va(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Kr,ctx:{common:e.parent.common,data:e.data,parsedType:Va(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(kp(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Va(e)},i=this._parseSync({data:e,path:n.path,parent:n});return jL(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Va(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ho(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ho(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Va(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(kp(i)?i:Promise.resolve(i));return jL(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let s=e(i),o=()=>a.addIssue({code:te.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Fi({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Si.create(this,this._def)}nullable(){return Ha.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Js.create(this)}promise(){return Ko.create(this,this._def)}or(e){return Bc.create([this,e],this._def)}and(e){return jc.create(this,e,this._def)}transform(e){return new Fi({...Be(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Vc({...Be(this._def),innerType:this,defaultValue:r,typeName:Ce.ZodDefault})}brand(){return new Z1({typeName:Ce.ZodBranded,type:this,...Be(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new zc({...Be(this._def),innerType:this,catchValue:r,typeName:Ce.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return X1.create(this,e)}readonly(){return Hc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},j9e=/^c[^\s-]{8,}$/i,L9e=/^[0-9a-z]+$/,M9e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$9e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,U9e=/^[a-z0-9_-]{21}$/i,V9e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,z9e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,H9e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,W9e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",G9e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,K9e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,J9e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Y9e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Q9e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Z9e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ML="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",X9e=new RegExp(`^${ML}$`);Wo=class t extends Ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==le.string){let a=this._getOrReturnCtx(e);return oe(a,{code:te.invalid_type,expected:le.string,received:a.parsedType}),_e}let n=new Kr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),oe(i,{code:te.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),oe(i,{code:te.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(i=this._getOrReturnCtx(e,i),s?oe(i,{code:te.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&oe(i,{code:te.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")H9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"email",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")uD||(uD=new RegExp(W9e,"u")),uD.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"emoji",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")$9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"uuid",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")U9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"nanoid",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")j9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"cuid",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")L9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"cuid2",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")M9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"ulid",code:te.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),oe(i,{validation:"url",code:te.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"regex",code:te.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?UL(a).test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?X9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ege(a).test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?z9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"duration",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?tge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"ip",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?rge(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"jwt",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?nge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"cidr",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Q9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"base64",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Z9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"base64url",code:te.invalid_string,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:te.invalid_string,...he.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...he.errToObj(e)})}url(e){return this._addCheck({kind:"url",...he.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...he.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...he.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...he.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...he.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...he.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...he.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...he.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...he.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...he.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...he.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...he.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...he.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...he.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...he.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...he.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...he.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...he.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...he.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...he.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...he.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...he.errToObj(r)})}nonempty(e){return this.min(1,he.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Wo.create=t=>new Wo({checks:[],typeName:Ce.ZodString,coerce:t?.coerce??!1,...Be(t)});Pc=class t extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==le.number){let a=this._getOrReturnCtx(e);return oe(a,{code:te.invalid_type,expected:le.number,received:a.parsedType}),_e}let n,i=new Kr;for(let a of this._def.checks)a.kind==="int"?Ke.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{code:te.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),oe(n,{code:te.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),oe(n,{code:te.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?ige(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),oe(n,{code:te.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{code:te.not_finite,message:a.message}),i.dirty()):Ke.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,he.toString(r))}gt(e,r){return this.setLimit("min",e,!1,he.toString(r))}lte(e,r){return this.setLimit("max",e,!0,he.toString(r))}lt(e,r){return this.setLimit("max",e,!1,he.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:he.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:he.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:he.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:he.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:he.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:he.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:he.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:he.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:he.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:he.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ke.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Pc.create=t=>new Pc({checks:[],typeName:Ce.ZodNumber,coerce:t?.coerce||!1,...Be(t)});qc=class t extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==le.bigint)return this._getInvalidInput(e);let n,i=new Kr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),oe(n,{code:te.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),oe(n,{code:te.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),oe(n,{code:te.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ke.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:le.bigint,received:r.parsedType}),_e}gte(e,r){return this.setLimit("min",e,!0,he.toString(r))}gt(e,r){return this.setLimit("min",e,!1,he.toString(r))}lte(e,r){return this.setLimit("max",e,!0,he.toString(r))}lt(e,r){return this.setLimit("max",e,!1,he.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:he.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:he.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:he.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:he.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:he.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:he.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};qc.create=t=>new qc({checks:[],typeName:Ce.ZodBigInt,coerce:t?.coerce??!1,...Be(t)});Rc=class extends Ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==le.boolean){let n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:le.boolean,received:n.parsedType}),_e}return pn(e.data)}};Rc.create=t=>new Rc({typeName:Ce.ZodBoolean,coerce:t?.coerce||!1,...Be(t)});Ic=class t extends Ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==le.date){let a=this._getOrReturnCtx(e);return oe(a,{code:te.invalid_type,expected:le.date,received:a.parsedType}),_e}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return oe(a,{code:te.invalid_date}),_e}let n=new Kr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),oe(i,{code:te.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),oe(i,{code:te.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:he.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:he.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Ic.create=t=>new Ic({checks:[],coerce:t?.coerce||!1,typeName:Ce.ZodDate,...Be(t)});Bp=class extends Ue{_parse(e){if(this._getType(e)!==le.symbol){let n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:le.symbol,received:n.parsedType}),_e}return pn(e.data)}};Bp.create=t=>new Bp({typeName:Ce.ZodSymbol,...Be(t)});kc=class extends Ue{_parse(e){if(this._getType(e)!==le.undefined){let n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:le.undefined,received:n.parsedType}),_e}return pn(e.data)}};kc.create=t=>new kc({typeName:Ce.ZodUndefined,...Be(t)});Nc=class extends Ue{_parse(e){if(this._getType(e)!==le.null){let n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:le.null,received:n.parsedType}),_e}return pn(e.data)}};Nc.create=t=>new Nc({typeName:Ce.ZodNull,...Be(t)});Go=class extends Ue{constructor(){super(...arguments),this._any=!0}_parse(e){return pn(e.data)}};Go.create=t=>new Go({typeName:Ce.ZodAny,...Be(t)});Ks=class extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pn(e.data)}};Ks.create=t=>new Ks({typeName:Ce.ZodUnknown,...Be(t)});fa=class extends Ue{_parse(e){let r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:le.never,received:r.parsedType}),_e}};fa.create=t=>new fa({typeName:Ce.ZodNever,...Be(t)});jp=class extends Ue{_parse(e){if(this._getType(e)!==le.undefined){let n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:le.void,received:n.parsedType}),_e}return pn(e.data)}};jp.create=t=>new jp({typeName:Ce.ZodVoid,...Be(t)});Js=class t extends Ue{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==le.array)return oe(r,{code:te.invalid_type,expected:le.array,received:r.parsedType}),_e;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(s||o)&&(oe(r,{code:s?te.too_big:te.too_small,minimum:o?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(oe(r,{code:te.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(oe(r,{code:te.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,o)=>i.type._parseAsync(new Ci(r,s,r.path,o)))).then(s=>Kr.mergeArray(n,s));let a=[...r.data].map((s,o)=>i.type._parseSync(new Ci(r,s,r.path,o)));return Kr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:he.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:he.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:he.toString(r)}})}nonempty(e){return this.min(1,e)}};Js.create=(t,e)=>new Js({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Be(e)});In=class t extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ke.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==le.object){let l=this._getOrReturnCtx(e);return oe(l,{code:te.invalid_type,expected:le.object,received:l.parsedType}),_e}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof fa&&this._def.unknownKeys==="strip"))for(let l in i.data)s.includes(l)||o.push(l);let c=[];for(let l of s){let d=a[l],f=i.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new Ci(i,f,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof fa){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of o)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(l==="strict")o.length>0&&(oe(i,{code:te.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of o){let f=i.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new Ci(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of c){let f=await d.key,m=await d.value;l.push({key:f,value:m,alwaysSet:d.alwaysSet})}return l}).then(l=>Kr.mergeObjectSync(n,l)):Kr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return he.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:he.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Ke.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Ke.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Np(this)}partial(e){let r={};for(let n of Ke.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ke.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Si;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return VL(Ke.objectKeys(this.shape))}};In.create=(t,e)=>new In({shape:()=>t,unknownKeys:"strip",catchall:fa.create(),typeName:Ce.ZodObject,...Be(e)});In.strictCreate=(t,e)=>new In({shape:()=>t,unknownKeys:"strict",catchall:fa.create(),typeName:Ce.ZodObject,...Be(e)});In.lazycreate=(t,e)=>new In({shape:t,unknownKeys:"strip",catchall:fa.create(),typeName:Ce.ZodObject,...Be(e)});Bc=class extends Ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(o=>new Ir(o.ctx.common.issues));return oe(r,{code:te.invalid_union,unionErrors:s}),_e}if(r.common.async)return Promise.all(n.map(async a=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let a,s=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(c=>new Ir(c));return oe(r,{code:te.invalid_union,unionErrors:o}),_e}}get options(){return this._def.options}};Bc.create=(t,e)=>new Bc({options:t,typeName:Ce.ZodUnion,...Be(e)});Gs=t=>t instanceof Lc?Gs(t.schema):t instanceof Fi?Gs(t.innerType()):t instanceof Mc?[t.value]:t instanceof $c?t.options:t instanceof Uc?Ke.objectValues(t.enum):t instanceof Vc?Gs(t._def.innerType):t instanceof kc?[void 0]:t instanceof Nc?[null]:t instanceof Si?[void 0,...Gs(t.unwrap())]:t instanceof Ha?[null,...Gs(t.unwrap())]:t instanceof Z1||t instanceof Hc?Gs(t.unwrap()):t instanceof zc?Gs(t._def.innerType):[],P6=class t extends Ue{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==le.object)return oe(r,{code:te.invalid_type,expected:le.object,received:r.parsedType}),_e;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(oe(r,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let s=Gs(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,a)}}return new t({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Be(n)})}};jc=class extends Ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,s)=>{if(O6(a)||O6(s))return _e;let o=cD(a.value,s.value);return o.valid?((T6(a)||T6(s))&&r.dirty(),{status:r.value,value:o.data}):(oe(n,{code:te.invalid_intersection_types}),_e)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,s])=>i(a,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};jc.create=(t,e,r)=>new jc({left:t,right:e,typeName:Ce.ZodIntersection,...Be(r)});za=class t extends Ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==le.array)return oe(n,{code:te.invalid_type,expected:le.array,received:n.parsedType}),_e;if(n.data.length<this._def.items.length)return oe(n,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_e;!this._def.rest&&n.data.length>this._def.items.length&&(oe(n,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((s,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Ci(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(a).then(s=>Kr.mergeArray(r,s)):Kr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};za.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new za({items:t,typeName:Ce.ZodTuple,rest:null,...Be(e)})};q6=class t extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==le.object)return oe(n,{code:te.invalid_type,expected:le.object,received:n.parsedType}),_e;let i=[],a=this._def.keyType,s=this._def.valueType;for(let o in n.data)i.push({key:a._parse(new Ci(n,o,n.path,o)),value:s._parse(new Ci(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?Kr.mergeObjectAsync(r,i):Kr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ue?new t({keyType:e,valueType:r,typeName:Ce.ZodRecord,...Be(n)}):new t({keyType:Wo.create(),valueType:e,typeName:Ce.ZodRecord,...Be(r)})}},Lp=class extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==le.map)return oe(n,{code:te.invalid_type,expected:le.map,received:n.parsedType}),_e;let i=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([o,c],l)=>({key:i._parse(new Ci(n,o,n.path,[l,"key"])),value:a._parse(new Ci(n,c,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return _e;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(l.value,d.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of s){let l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return _e;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(l.value,d.value)}return{status:r.value,value:o}}}};Lp.create=(t,e,r)=>new Lp({valueType:e,keyType:t,typeName:Ce.ZodMap,...Be(r)});Mp=class t extends Ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==le.set)return oe(n,{code:te.invalid_type,expected:le.set,received:n.parsedType}),_e;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(oe(n,{code:te.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(oe(n,{code:te.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function s(c){let l=new Set;for(let d of c){if(d.status==="aborted")return _e;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}let o=[...n.data.values()].map((c,l)=>a._parse(new Ci(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:he.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:he.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Mp.create=(t,e)=>new Mp({valueType:t,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Be(e)});R6=class t extends Ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==le.function)return oe(r,{code:te.invalid_type,expected:le.function,received:r.parsedType}),_e;function n(o,c){return Q1({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ip(),Ws].filter(l=>!!l),issueData:{code:te.invalid_arguments,argumentsError:c}})}function i(o,c){return Q1({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ip(),Ws].filter(l=>!!l),issueData:{code:te.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ko){let o=this;return pn(async function(...c){let l=new Ir([]),d=await o._def.args.parseAsync(c,a).catch(g=>{throw l.addIssue(n(c,g)),l}),f=await Reflect.apply(s,this,d);return await o._def.returns._def.type.parseAsync(f,a).catch(g=>{throw l.addIssue(i(f,g)),l})})}else{let o=this;return pn(function(...c){let l=o._def.args.safeParse(c,a);if(!l.success)throw new Ir([n(c,l.error)]);let d=Reflect.apply(s,this,l.data),f=o._def.returns.safeParse(d,a);if(!f.success)throw new Ir([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:za.create(e).rest(Ks.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||za.create([]).rest(Ks.create()),returns:r||Ks.create(),typeName:Ce.ZodFunction,...Be(n)})}},Lc=class extends Ue{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Lc.create=(t,e)=>new Lc({getter:t,typeName:Ce.ZodLazy,...Be(e)});Mc=class extends Ue{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return oe(r,{received:r.data,code:te.invalid_literal,expected:this._def.value}),_e}return{status:"valid",value:e.data}}get value(){return this._def.value}};Mc.create=(t,e)=>new Mc({value:t,typeName:Ce.ZodLiteral,...Be(e)});$c=class t extends Ue{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return oe(r,{expected:Ke.joinValues(n),received:r.parsedType,code:te.invalid_type}),_e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return oe(r,{received:r.data,code:te.invalid_enum_value,options:n}),_e}return pn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};$c.create=VL;Uc=class extends Ue{_parse(e){let r=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==le.string&&n.parsedType!==le.number){let i=Ke.objectValues(r);return oe(n,{expected:Ke.joinValues(i),received:n.parsedType,code:te.invalid_type}),_e}if(this._cache||(this._cache=new Set(Ke.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ke.objectValues(r);return oe(n,{received:n.data,code:te.invalid_enum_value,options:i}),_e}return pn(e.data)}get enum(){return this._def.values}};Uc.create=(t,e)=>new Uc({values:t,typeName:Ce.ZodNativeEnum,...Be(e)});Ko=class extends Ue{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==le.promise&&r.common.async===!1)return oe(r,{code:te.invalid_type,expected:le.promise,received:r.parsedType}),_e;let n=r.parsedType===le.promise?r.data:Promise.resolve(r.data);return pn(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ko.create=(t,e)=>new Ko({type:t,typeName:Ce.ZodPromise,...Be(e)});Fi=class extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:s=>{oe(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let s=i.transform(n.data,a);if(n.common.async)return Promise.resolve(s).then(async o=>{if(r.value==="aborted")return _e;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?_e:c.status==="dirty"?Tc(c.value):r.value==="dirty"?Tc(c.value):c});{if(r.value==="aborted")return _e;let o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?_e:o.status==="dirty"?Tc(o.value):r.value==="dirty"?Tc(o.value):o}}if(i.type==="refinement"){let s=o=>{let c=i.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_e:(o.status==="dirty"&&r.dirty(),s(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_e:(o.status==="dirty"&&r.dirty(),s(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ho(s))return _e;let o=i.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Ho(s)?Promise.resolve(i.transform(s.value,a)).then(o=>({status:r.value,value:o})):_e);Ke.assertNever(i)}};Fi.create=(t,e,r)=>new Fi({schema:t,typeName:Ce.ZodEffects,effect:e,...Be(r)});Fi.createWithPreprocess=(t,e,r)=>new Fi({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Be(r)});Si=class extends Ue{_parse(e){return this._getType(e)===le.undefined?pn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Si.create=(t,e)=>new Si({innerType:t,typeName:Ce.ZodOptional,...Be(e)});Ha=class extends Ue{_parse(e){return this._getType(e)===le.null?pn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ha.create=(t,e)=>new Ha({innerType:t,typeName:Ce.ZodNullable,...Be(e)});Vc=class extends Ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===le.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Vc.create=(t,e)=>new Vc({innerType:t,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Be(e)});zc=class extends Ue{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return kp(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ir(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ir(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zc.create=(t,e)=>new zc({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Be(e)});$p=class extends Ue{_parse(e){if(this._getType(e)!==le.nan){let n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:le.nan,received:n.parsedType}),_e}return{status:"valid",value:e.data}}};$p.create=t=>new $p({typeName:Ce.ZodNaN,...Be(t)});age=Symbol("zod_brand"),Z1=class extends Ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},X1=class t extends Ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?_e:a.status==="dirty"?(r.dirty(),Tc(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_e:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Ce.ZodPipeline})}},Hc=class extends Ue{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Ho(i)&&(i.value=Object.freeze(i.value)),i);return kp(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Hc.create=(t,e)=>new Hc({innerType:t,typeName:Ce.ZodReadonly,...Be(e)});sge={object:In.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));dn=(t,e={message:`Input not instance of ${t.name}`})=>zL(r=>r instanceof t,e),be=Wo.create,_r=Pc.create,oge=$p.create,uge=qc.create,Wa=Rc.create,lD=Ic.create,cge=Bp.create,lge=kc.create,pge=Nc.create,Ys=Go.create,dge=Ks.create,fge=fa.create,mge=jp.create,Qs=Js.create,Fe=In.create,hge=In.strictCreate,vge=Bc.create,gge=P6.create,xge=jc.create,bge=za.create,Jo=q6.create,yge=Lp.create,Dge=Mp.create,wge=R6.create,Wc=Lc.create,_ge=Mc.create,Ege=$c.create,Up=Uc.create,Sge=Ko.create,Cge=Fi.create,Fge=Si.create,Xn=Ha.create,Age=Fi.createWithPreprocess,Oge=X1.create,Tge=()=>be().optional(),Pge=()=>_r().optional(),qge=()=>Wa().optional(),pD={string:(t=>Wo.create({...t,coerce:!0})),number:(t=>Pc.create({...t,coerce:!0})),boolean:(t=>Rc.create({...t,coerce:!0})),bigint:(t=>qc.create({...t,coerce:!0})),date:(t=>Ic.create({...t,coerce:!0}))},Rge=_e});var w={};i6(w,{BRAND:()=>age,DIRTY:()=>Tc,EMPTY_PATH:()=>B9e,INVALID:()=>_e,NEVER:()=>Rge,OK:()=>pn,ParseStatus:()=>Kr,Schema:()=>Ue,ZodAny:()=>Go,ZodArray:()=>Js,ZodBigInt:()=>qc,ZodBoolean:()=>Rc,ZodBranded:()=>Z1,ZodCatch:()=>zc,ZodDate:()=>Ic,ZodDefault:()=>Vc,ZodDiscriminatedUnion:()=>P6,ZodEffects:()=>Fi,ZodEnum:()=>$c,ZodError:()=>Ir,ZodFirstPartyTypeKind:()=>Ce,ZodFunction:()=>R6,ZodIntersection:()=>jc,ZodIssueCode:()=>te,ZodLazy:()=>Lc,ZodLiteral:()=>Mc,ZodMap:()=>Lp,ZodNaN:()=>$p,ZodNativeEnum:()=>Uc,ZodNever:()=>fa,ZodNull:()=>Nc,ZodNullable:()=>Ha,ZodNumber:()=>Pc,ZodObject:()=>In,ZodOptional:()=>Si,ZodParsedType:()=>le,ZodPipeline:()=>X1,ZodPromise:()=>Ko,ZodReadonly:()=>Hc,ZodRecord:()=>q6,ZodSchema:()=>Ue,ZodSet:()=>Mp,ZodString:()=>Wo,ZodSymbol:()=>Bp,ZodTransformer:()=>Fi,ZodTuple:()=>za,ZodType:()=>Ue,ZodUndefined:()=>kc,ZodUnion:()=>Bc,ZodUnknown:()=>Ks,ZodVoid:()=>jp,addIssueToContext:()=>oe,any:()=>Ys,array:()=>Qs,bigint:()=>uge,boolean:()=>Wa,coerce:()=>pD,custom:()=>zL,date:()=>lD,datetimeRegex:()=>UL,defaultErrorMap:()=>Ws,discriminatedUnion:()=>gge,effect:()=>Cge,enum:()=>Ege,function:()=>wge,getErrorMap:()=>Ip,getParsedType:()=>Va,instanceof:()=>dn,intersection:()=>xge,isAborted:()=>O6,isAsync:()=>kp,isDirty:()=>T6,isValid:()=>Ho,late:()=>sge,lazy:()=>Wc,literal:()=>_ge,makeIssue:()=>Q1,map:()=>yge,nan:()=>oge,nativeEnum:()=>Up,never:()=>fge,null:()=>pge,nullable:()=>Xn,number:()=>_r,object:()=>Fe,objectUtil:()=>aD,oboolean:()=>qge,onumber:()=>Pge,optional:()=>Fge,ostring:()=>Tge,pipeline:()=>Oge,preprocess:()=>Age,promise:()=>Sge,quotelessJson:()=>I9e,record:()=>Jo,set:()=>Dge,setErrorMap:()=>N9e,strictObject:()=>hge,string:()=>be,symbol:()=>cge,transformer:()=>Cge,tuple:()=>bge,undefined:()=>lge,union:()=>vge,unknown:()=>dge,util:()=>Ke,void:()=>mge});var dD=fe(()=>{A6();oD();NL();Y1();HL();F6()});var hr=fe(()=>{dD();dD()});var Vp,WL,I6,GL,KL,Ige,Oi,kn,ef,Ga,Ti,k6,JL,N6,YL,QL,ZL,tf,tr,XL,eM,zp,Gc,B6,kge,rf,nf,tM,Nge,Bge,jge,fD,rM,nM,j6,Lge,L6,M6,$6,iM,aM,mD,sM,oM,Mge,$ge,hD,Uge,vD,Vge,gD,zge,Hge,Wge,Gge,Kge,Jge,Yge,xD,Qge,bD,yD,DD,Zge,Xge,uM,exe,wD,txe,rxe,nxe,ixe,_D,U6,Hvt,ED,axe,cM,sxe,SD,oxe,uxe,cxe,lxe,pxe,dxe,fxe,mxe,hxe,vxe,gxe,xxe,bxe,yxe,Dxe,CD,wxe,_xe,Exe,Sxe,Wvt,Gvt,Kvt,Jvt,Yvt,Qvt,Ai,Zs=fe(()=>{hr();Vp="2025-06-18",WL=[Vp,"2025-03-26","2024-11-05","2024-10-07"],I6="2.0",GL=w.union([w.string(),w.number().int()]),KL=w.string(),Ige=w.object({progressToken:w.optional(GL)}).passthrough(),Oi=w.object({_meta:w.optional(Ige)}).passthrough(),kn=w.object({method:w.string(),params:w.optional(Oi)}),ef=w.object({_meta:w.optional(w.object({}).passthrough())}).passthrough(),Ga=w.object({method:w.string(),params:w.optional(ef)}),Ti=w.object({_meta:w.optional(w.object({}).passthrough())}).passthrough(),k6=w.union([w.string(),w.number().int()]),JL=w.object({jsonrpc:w.literal(I6),id:k6}).merge(kn).strict(),N6=t=>JL.safeParse(t).success,YL=w.object({jsonrpc:w.literal(I6)}).merge(Ga).strict(),QL=t=>YL.safeParse(t).success,ZL=w.object({jsonrpc:w.literal(I6),id:k6,result:Ti}).strict(),tf=t=>ZL.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(tr||(tr={}));XL=w.object({jsonrpc:w.literal(I6),id:k6,error:w.object({code:w.number().int(),message:w.string(),data:w.optional(w.unknown())})}).strict(),eM=t=>XL.safeParse(t).success,zp=w.union([JL,YL,ZL,XL]),Gc=Ti.strict(),B6=Ga.extend({method:w.literal("notifications/cancelled"),params:ef.extend({requestId:k6,reason:w.string().optional()})}),kge=w.object({src:w.string(),mimeType:w.optional(w.string()),sizes:w.optional(w.array(w.string()))}).passthrough(),rf=w.object({icons:w.array(kge).optional()}).passthrough(),nf=w.object({name:w.string(),title:w.optional(w.string())}).passthrough(),tM=nf.extend({version:w.string(),websiteUrl:w.optional(w.string())}).merge(rf),Nge=w.object({experimental:w.optional(w.object({}).passthrough()),sampling:w.optional(w.object({}).passthrough()),elicitation:w.optional(w.object({}).passthrough()),roots:w.optional(w.object({listChanged:w.optional(w.boolean())}).passthrough())}).passthrough(),Bge=kn.extend({method:w.literal("initialize"),params:Oi.extend({protocolVersion:w.string(),capabilities:Nge,clientInfo:tM})}),jge=w.object({experimental:w.optional(w.object({}).passthrough()),logging:w.optional(w.object({}).passthrough()),completions:w.optional(w.object({}).passthrough()),prompts:w.optional(w.object({listChanged:w.optional(w.boolean())}).passthrough()),resources:w.optional(w.object({subscribe:w.optional(w.boolean()),listChanged:w.optional(w.boolean())}).passthrough()),tools:w.optional(w.object({listChanged:w.optional(w.boolean())}).passthrough())}).passthrough(),fD=Ti.extend({protocolVersion:w.string(),capabilities:jge,serverInfo:tM,instructions:w.optional(w.string())}),rM=Ga.extend({method:w.literal("notifications/initialized")}),nM=t=>rM.safeParse(t).success,j6=kn.extend({method:w.literal("ping")}),Lge=w.object({progress:w.number(),total:w.optional(w.number()),message:w.optional(w.string())}).passthrough(),L6=Ga.extend({method:w.literal("notifications/progress"),params:ef.merge(Lge).extend({progressToken:GL})}),M6=kn.extend({params:Oi.extend({cursor:w.optional(KL)}).optional()}),$6=Ti.extend({nextCursor:w.optional(KL)}),iM=w.object({uri:w.string(),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).passthrough(),aM=iM.extend({text:w.string()}),mD=w.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),sM=iM.extend({blob:mD}),oM=nf.extend({uri:w.string(),description:w.optional(w.string()),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).merge(rf),Mge=nf.extend({uriTemplate:w.string(),description:w.optional(w.string()),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).merge(rf),$ge=M6.extend({method:w.literal("resources/list")}),hD=$6.extend({resources:w.array(oM)}),Uge=M6.extend({method:w.literal("resources/templates/list")}),vD=$6.extend({resourceTemplates:w.array(Mge)}),Vge=kn.extend({method:w.literal("resources/read"),params:Oi.extend({uri:w.string()})}),gD=Ti.extend({contents:w.array(w.union([aM,sM]))}),zge=Ga.extend({method:w.literal("notifications/resources/list_changed")}),Hge=kn.extend({method:w.literal("resources/subscribe"),params:Oi.extend({uri:w.string()})}),Wge=kn.extend({method:w.literal("resources/unsubscribe"),params:Oi.extend({uri:w.string()})}),Gge=Ga.extend({method:w.literal("notifications/resources/updated"),params:ef.extend({uri:w.string()})}),Kge=w.object({name:w.string(),description:w.optional(w.string()),required:w.optional(w.boolean())}).passthrough(),Jge=nf.extend({description:w.optional(w.string()),arguments:w.optional(w.array(Kge)),_meta:w.optional(w.object({}).passthrough())}).merge(rf),Yge=M6.extend({method:w.literal("prompts/list")}),xD=$6.extend({prompts:w.array(Jge)}),Qge=kn.extend({method:w.literal("prompts/get"),params:Oi.extend({name:w.string(),arguments:w.optional(w.record(w.string()))})}),bD=w.object({type:w.literal("text"),text:w.string(),_meta:w.optional(w.object({}).passthrough())}).passthrough(),yD=w.object({type:w.literal("image"),data:mD,mimeType:w.string(),_meta:w.optional(w.object({}).passthrough())}).passthrough(),DD=w.object({type:w.literal("audio"),data:mD,mimeType:w.string(),_meta:w.optional(w.object({}).passthrough())}).passthrough(),Zge=w.object({type:w.literal("resource"),resource:w.union([aM,sM]),_meta:w.optional(w.object({}).passthrough())}).passthrough(),Xge=oM.extend({type:w.literal("resource_link")}),uM=w.union([bD,yD,DD,Xge,Zge]),exe=w.object({role:w.enum(["user","assistant"]),content:uM}).passthrough(),wD=Ti.extend({description:w.optional(w.string()),messages:w.array(exe)}),txe=Ga.extend({method:w.literal("notifications/prompts/list_changed")}),rxe=w.object({title:w.optional(w.string()),readOnlyHint:w.optional(w.boolean()),destructiveHint:w.optional(w.boolean()),idempotentHint:w.optional(w.boolean()),openWorldHint:w.optional(w.boolean())}).passthrough(),nxe=nf.extend({description:w.optional(w.string()),inputSchema:w.object({type:w.literal("object"),properties:w.optional(w.object({}).passthrough()),required:w.optional(w.array(w.string()))}).passthrough(),outputSchema:w.optional(w.object({type:w.literal("object"),properties:w.optional(w.object({}).passthrough()),required:w.optional(w.array(w.string()))}).passthrough()),annotations:w.optional(rxe),_meta:w.optional(w.object({}).passthrough())}).merge(rf),ixe=M6.extend({method:w.literal("tools/list")}),_D=$6.extend({tools:w.array(nxe)}),U6=Ti.extend({content:w.array(uM).default([]),structuredContent:w.object({}).passthrough().optional(),isError:w.optional(w.boolean())}),Hvt=U6.or(Ti.extend({toolResult:w.unknown()})),ED=kn.extend({method:w.literal("tools/call"),params:Oi.extend({name:w.string(),arguments:w.optional(w.record(w.unknown()))})}),axe=Ga.extend({method:w.literal("notifications/tools/list_changed")}),cM=w.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),sxe=kn.extend({method:w.literal("logging/setLevel"),params:Oi.extend({level:cM})}),SD=Ga.extend({method:w.literal("notifications/message"),params:ef.extend({level:cM,logger:w.optional(w.string()),data:w.unknown()})}),oxe=w.object({name:w.string().optional()}).passthrough(),uxe=w.object({hints:w.optional(w.array(oxe)),costPriority:w.optional(w.number().min(0).max(1)),speedPriority:w.optional(w.number().min(0).max(1)),intelligencePriority:w.optional(w.number().min(0).max(1))}).passthrough(),cxe=w.object({role:w.enum(["user","assistant"]),content:w.union([bD,yD,DD])}).passthrough(),lxe=kn.extend({method:w.literal("sampling/createMessage"),params:Oi.extend({messages:w.array(cxe),systemPrompt:w.optional(w.string()),includeContext:w.optional(w.enum(["none","thisServer","allServers"])),temperature:w.optional(w.number()),maxTokens:w.number().int(),stopSequences:w.optional(w.array(w.string())),metadata:w.optional(w.object({}).passthrough()),modelPreferences:w.optional(uxe)})}),pxe=Ti.extend({model:w.string(),stopReason:w.optional(w.enum(["endTurn","stopSequence","maxTokens"]).or(w.string())),role:w.enum(["user","assistant"]),content:w.discriminatedUnion("type",[bD,yD,DD])}),dxe=w.object({type:w.literal("boolean"),title:w.optional(w.string()),description:w.optional(w.string()),default:w.optional(w.boolean())}).passthrough(),fxe=w.object({type:w.literal("string"),title:w.optional(w.string()),description:w.optional(w.string()),minLength:w.optional(w.number()),maxLength:w.optional(w.number()),format:w.optional(w.enum(["email","uri","date","date-time"]))}).passthrough(),mxe=w.object({type:w.enum(["number","integer"]),title:w.optional(w.string()),description:w.optional(w.string()),minimum:w.optional(w.number()),maximum:w.optional(w.number())}).passthrough(),hxe=w.object({type:w.literal("string"),title:w.optional(w.string()),description:w.optional(w.string()),enum:w.array(w.string()),enumNames:w.optional(w.array(w.string()))}).passthrough(),vxe=w.union([dxe,fxe,mxe,hxe]),gxe=kn.extend({method:w.literal("elicitation/create"),params:Oi.extend({message:w.string(),requestedSchema:w.object({type:w.literal("object"),properties:w.record(w.string(),vxe),required:w.optional(w.array(w.string()))}).passthrough()})}),xxe=Ti.extend({action:w.enum(["accept","decline","cancel"]),content:w.optional(w.record(w.string(),w.unknown()))}),bxe=w.object({type:w.literal("ref/resource"),uri:w.string()}).passthrough(),yxe=w.object({type:w.literal("ref/prompt"),name:w.string()}).passthrough(),Dxe=kn.extend({method:w.literal("completion/complete"),params:Oi.extend({ref:w.union([yxe,bxe]),argument:w.object({name:w.string(),value:w.string()}).passthrough(),context:w.optional(w.object({arguments:w.optional(w.record(w.string(),w.string()))}))})}),CD=Ti.extend({completion:w.object({values:w.array(w.string()).max(100),total:w.optional(w.number().int()),hasMore:w.optional(w.boolean())}).passthrough()}),wxe=w.object({uri:w.string().startsWith("file://"),name:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).passthrough(),_xe=kn.extend({method:w.literal("roots/list")}),Exe=Ti.extend({roots:w.array(wxe)}),Sxe=Ga.extend({method:w.literal("notifications/roots/list_changed")}),Wvt=w.union([j6,Bge,Dxe,sxe,Qge,Yge,$ge,Uge,Vge,Hge,Wge,ED,ixe]),Gvt=w.union([B6,L6,rM,Sxe]),Kvt=w.union([Gc,pxe,xxe,Exe]),Jvt=w.union([j6,lxe,gxe,_xe]),Yvt=w.union([B6,L6,SD,Gge,zge,axe,txe]),Qvt=w.union([Gc,fD,CD,wD,xD,hD,vD,gD,U6,_D]),Ai=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});var fM=v((a3t,dM)=>{"use strict";var Txe=/[|\\{}()[\]^$+*?.]/g;dM.exports=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Txe,"\\$&")}});var af=v((s3t,W6)=>{"use strict";var Pxe=fM(),{platform:mM}=process,Ka={tick:"\u2714",cross:"\u2716",star:"\u2605",square:"\u2587",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",play:"\u25B6",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",circleQuestionMark:"?\u20DD",bullet:"\u25CF",dot:"\u2024",line:"\u2500",ellipsis:"\u2026",pointer:"\u276F",pointerSmall:"\u203A",info:"\u2139",warning:"\u26A0",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",heart:"\u2665",nodejs:"\u2B22",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",questionMarkPrefix:"?\u20DD",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneSeventh:"\u2150",oneEighth:"\u215B",oneNinth:"\u2151",oneTenth:"\u2152",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E"},hM={tick:"\u221A",cross:"\xD7",star:"*",square:"\u2588",squareSmall:"[ ]",squareSmallFilled:"[\u2588]",play:"\u25BA",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",circleQuestionMark:"(?)",bullet:"*",dot:".",line:"\u2500",ellipsis:"...",pointer:">",pointerSmall:"\xBB",info:"i",warning:"\u203C",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",heart:Ka.heart,nodejs:"\u2666",arrowUp:Ka.arrowUp,arrowDown:Ka.arrowDown,arrowLeft:Ka.arrowLeft,arrowRight:Ka.arrowRight,radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",questionMarkPrefix:"\uFF1F",oneHalf:"1/2",oneThird:"1/3",oneQuarter:"1/4",oneFifth:"1/5",oneSixth:"1/6",oneSeventh:"1/7",oneEighth:"1/8",oneNinth:"1/9",oneTenth:"1/10",twoThirds:"2/3",twoFifths:"2/5",threeQuarters:"3/4",threeFifths:"3/5",threeEighths:"3/8",fourFifths:"4/5",fiveSixths:"5/6",fiveEighths:"5/8",sevenEighths:"7/8"};mM==="linux"&&(Ka.questionMarkPrefix="?");var H6=mM==="win32"?hM:Ka,qxe=t=>{if(H6===Ka)return t;for(let[e,r]of Object.entries(Ka))r!==H6[e]&&(t=t.replace(new RegExp(Pxe(r),"g"),H6[e]));return t};W6.exports=Object.assign(qxe,H6);W6.exports.main=Ka;W6.exports.windows=hM});var sf=v((o3t,vM)=>{"use strict";var Rxe=at(),Ixe=af(),G6=class{constructor(e){this.type="separator",this.line=Rxe.dim(e||new Array(15).join(Ixe.line))}toString(){return this.line}};G6.exclude=function(t){return t.type!=="separator"};vM.exports=G6});var bM=v((gM,xM)=>{var kxe=ee("stream");gM=xM.exports=AD;AD.through=AD;function AD(t,e,r){t=t||function(d){this.queue(d)},e=e||function(){this.queue(null)};var n=!1,i=!1,a=[],s=!1,o=new kxe;o.readable=o.writable=!0,o.paused=!1,o.autoDestroy=!(r&&r.autoDestroy===!1),o.write=function(d){return t.call(this,d),!o.paused};function c(){for(;a.length&&!o.paused;){var d=a.shift();if(d===null)return o.emit("end");o.emit("data",d)}}o.queue=o.push=function(d){return s||(d===null&&(s=!0),a.push(d),c()),o},o.on("end",function(){o.readable=!1,!o.writable&&o.autoDestroy&&process.nextTick(function(){o.destroy()})});function l(){o.writable=!1,e.call(o),!o.readable&&o.autoDestroy&&o.destroy()}return o.end=function(d){if(!n)return n=!0,arguments.length&&o.write(d),l(),o},o.destroy=function(){if(!i)return i=!0,n=!0,a.length=0,o.writable=o.readable=!1,o.emit("close"),o},o.pause=function(){if(!o.paused)return o.paused=!0,o},o.resume=function(){return o.paused&&(o.paused=!1,o.emit("resume")),c(),o.paused||o.emit("drain"),o},o}});var DM=v((u3t,yM)=>{var OD=ee("stream");yM.exports=kr;function kr(t){OD.apply(this),t=t||{},this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=t.replace,this._prompt=t.prompt||null,this._hadControl=!1}kr.prototype=Object.create(OD.prototype);Object.defineProperty(kr.prototype,"constructor",{value:kr,enumerable:!1});kr.prototype.mute=function(){this.muted=!0};kr.prototype.unmute=function(){this.muted=!1};Object.defineProperty(kr.prototype,"_onpipe",{value:Nxe,enumerable:!1,writable:!0,configurable:!0});function Nxe(t){this._src=t}Object.defineProperty(kr.prototype,"isTTY",{get:Bxe,set:jxe,enumerable:!0,configurable:!0});function Bxe(){return this._dest?this._dest.isTTY:this._src?this._src.isTTY:!1}function jxe(t){Object.defineProperty(this,"isTTY",{value:t,enumerable:!0,writable:!0,configurable:!0})}Object.defineProperty(kr.prototype,"rows",{get:function(){return this._dest?this._dest.rows:this._src?this._src.rows:void 0},enumerable:!0,configurable:!0});Object.defineProperty(kr.prototype,"columns",{get:function(){return this._dest?this._dest.columns:this._src?this._src.columns:void 0},enumerable:!0,configurable:!0});kr.prototype.pipe=function(t,e){return this._dest=t,OD.prototype.pipe.call(this,t,e)};kr.prototype.pause=function(){if(this._src)return this._src.pause()};kr.prototype.resume=function(){if(this._src)return this._src.resume()};kr.prototype.write=function(t){if(this.muted){if(!this.replace)return!0;if(t.match(/^\u001b/))return t.indexOf(this._prompt)===0&&(t=t.substr(this._prompt.length),t=t.replace(/./g,this.replace),t=this._prompt+t),this._hadControl=!0,this.emit("data",t);this._prompt&&this._hadControl&&t.indexOf(this._prompt)===0&&(this._hadControl=!1,this.emit("data",this._prompt),t=t.substr(this._prompt.length)),t=t.toString().replace(/./g,this.replace)}this.emit("data",t)};kr.prototype.end=function(t){this.muted&&(t&&this.replace?t=t.toString().replace(/./g,this.replace):t=null),t&&this.emit("data",t),this.emit("end")};function TD(t){return function(){var e=this._dest,r=this._src;e&&e[t]&&e[t].apply(e,arguments),r&&r[t]&&r[t].apply(r,arguments)}}kr.prototype.destroy=TD("destroy");kr.prototype.destroySoon=TD("destroySoon");kr.prototype.close=TD("close")});var qD=v((c3t,wM)=>{"use strict";var Lxe=DM(),Mxe=ee("readline"),PD=class{constructor(e){this.rl||(this.rl=Mxe.createInterface($xe(e))),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&typeof this.activePrompt.close=="function"&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}};function $xe(t={}){t.skipTTYChecks=t.skipTTYChecks===void 0?!0:t.skipTTYChecks;let e=t.input||process.stdin;if(!t.skipTTYChecks&&!e.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new Lxe;return r.pipe(t.output||process.stdout),{terminal:!0,...t,input:e,output:r}}wM.exports=PD});var ID=v((l3t,RD)=>{"use strict";var tt=RD.exports;RD.exports.default=tt;var ht="\x1B[",of="\x1B]",Hp="\x07",K6=";",_M=process.env.TERM_PROGRAM==="Apple_Terminal";tt.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?ht+(t+1)+"G":ht+(e+1)+";"+(t+1)+"H"};tt.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=ht+-t+"D":t>0&&(r+=ht+t+"C"),e<0?r+=ht+-e+"A":e>0&&(r+=ht+e+"B"),r};tt.cursorUp=(t=1)=>ht+t+"A";tt.cursorDown=(t=1)=>ht+t+"B";tt.cursorForward=(t=1)=>ht+t+"C";tt.cursorBackward=(t=1)=>ht+t+"D";tt.cursorLeft=ht+"G";tt.cursorSavePosition=_M?"\x1B7":ht+"s";tt.cursorRestorePosition=_M?"\x1B8":ht+"u";tt.cursorGetPosition=ht+"6n";tt.cursorNextLine=ht+"E";tt.cursorPrevLine=ht+"F";tt.cursorHide=ht+"?25l";tt.cursorShow=ht+"?25h";tt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=tt.eraseLine+(r<t-1?tt.cursorUp():"");return t&&(e+=tt.cursorLeft),e};tt.eraseEndLine=ht+"K";tt.eraseStartLine=ht+"1K";tt.eraseLine=ht+"2K";tt.eraseDown=ht+"J";tt.eraseUp=ht+"1J";tt.eraseScreen=ht+"2J";tt.scrollUp=ht+"S";tt.scrollDown=ht+"T";tt.clearScreen="\x1Bc";tt.clearTerminal=process.platform==="win32"?`${tt.eraseScreen}${ht}0f`:`${tt.eraseScreen}${ht}3J${ht}H`;tt.beep=Hp;tt.link=(t,e)=>[of,"8",K6,K6,e,Hp,t,of,"8",K6,K6,Hp].join("");tt.image=(t,e={})=>{let r=`${of}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+t.toString("base64")+Hp};tt.iTerm={setCwd:(t=process.cwd())=>`${of}50;CurrentDir=${t}${Hp}`,annotation:(t,e={})=>{let r=`${of}1337;`,n=typeof e.x<"u",i=typeof e.y<"u";if((n||i)&&!(n&&i&&typeof e.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replace(/\|/g,""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(n?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+Hp}}});var J6=v(Wp=>{"use strict";var uf=ID();Wp.left=function(t,e){t.output.write(uf.cursorBackward(e))};Wp.right=function(t,e){t.output.write(uf.cursorForward(e))};Wp.up=function(t,e){t.output.write(uf.cursorUp(e))};Wp.down=function(t,e){t.output.write(uf.cursorDown(e))};Wp.clearLine=function(t,e){t.output.write(uf.eraseLines(e))}});var SM=v((d3t,EM)=>{"use strict";var Uxe=bM(),Vxe=qD(),kD=J6(),ND=class extends Vxe{constructor(e={}){super(e),this.log=Uxe(this.writeLog.bind(this)),this.bottomBar=e.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return kD.clearLine(this.rl,this.bottomBar.split(`
50
50
  `).length),this}updateBottomBar(e){return kD.clearLine(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=e,this.render(),this.rl.output.mute(),this}writeLog(e){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(e.toString())),this.render(),this.rl.output.mute(),this}enforceLF(e){return e.match(/[\r\n]$/)?e:e+`
51
51
  `}write(e){let r=e.split(/\n/);this.height=r.length,this.rl.setPrompt(r[r.length-1]),this.rl.output.rows===0&&this.rl.output.columns===0&&kD.left(this.rl,e.length+this.rl.line.length),this.rl.output.write(e)}};EM.exports=ND});var BD=v((f3t,CM)=>{var zxe=typeof global=="object"&&global&&global.Object===Object&&global;CM.exports=zxe});var ma=v((m3t,FM)=>{var Hxe=BD(),Wxe=typeof self=="object"&&self&&self.Object===Object&&self,Gxe=Hxe||Wxe||Function("return this")();FM.exports=Gxe});var Gp=v((h3t,AM)=>{var Kxe=ma(),Jxe=Kxe.Symbol;AM.exports=Jxe});var qM=v((v3t,PM)=>{var OM=Gp(),TM=Object.prototype,Yxe=TM.hasOwnProperty,Qxe=TM.toString,cf=OM?OM.toStringTag:void 0;function Zxe(t){var e=Yxe.call(t,cf),r=t[cf];try{t[cf]=void 0;var n=!0}catch{}var i=Qxe.call(t);return n&&(e?t[cf]=r:delete t[cf]),i}PM.exports=Zxe});var IM=v((g3t,RM)=>{var Xxe=Object.prototype,e7e=Xxe.toString;function t7e(t){return e7e.call(t)}RM.exports=t7e});var Kc=v((x3t,BM)=>{var kM=Gp(),r7e=qM(),n7e=IM(),i7e="[object Null]",a7e="[object Undefined]",NM=kM?kM.toStringTag:void 0;function s7e(t){return t==null?t===void 0?a7e:i7e:NM&&NM in Object(t)?r7e(t):n7e(t)}BM.exports=s7e});var jD=v((b3t,jM)=>{function o7e(t,e){return function(r){return t(e(r))}}jM.exports=o7e});var Y6=v((y3t,LM)=>{var u7e=jD(),c7e=u7e(Object.getPrototypeOf,Object);LM.exports=c7e});var Xs=v((D3t,MM)=>{function l7e(t){return t!=null&&typeof t=="object"}MM.exports=l7e});var VM=v((w3t,UM)=>{var p7e=Kc(),d7e=Y6(),f7e=Xs(),m7e="[object Object]",h7e=Function.prototype,v7e=Object.prototype,$M=h7e.toString,g7e=v7e.hasOwnProperty,x7e=$M.call(Object);function b7e(t){if(!f7e(t)||p7e(t)!=m7e)return!1;var e=d7e(t);if(e===null)return!0;var r=g7e.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&$M.call(r)==x7e}UM.exports=b7e});var Pi=v((_3t,zM)=>{var y7e=Array.isArray;zM.exports=y7e});var Q6=v((E3t,HM)=>{var D7e=Kc(),w7e=Xs(),_7e="[object Symbol]";function E7e(t){return typeof t=="symbol"||w7e(t)&&D7e(t)==_7e}HM.exports=E7e});var Z6=v((S3t,WM)=>{var S7e=Pi(),C7e=Q6(),F7e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A7e=/^\w*$/;function O7e(t,e){if(S7e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||C7e(t)?!0:A7e.test(t)||!F7e.test(t)||e!=null&&t in Object(e)}WM.exports=O7e});var eo=v((C3t,GM)=>{function T7e(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}GM.exports=T7e});var LD=v((F3t,KM)=>{var P7e=Kc(),q7e=eo(),R7e="[object AsyncFunction]",I7e="[object Function]",k7e="[object GeneratorFunction]",N7e="[object Proxy]";function B7e(t){if(!q7e(t))return!1;var e=P7e(t);return e==I7e||e==k7e||e==R7e||e==N7e}KM.exports=B7e});var YM=v((A3t,JM)=>{var j7e=ma(),L7e=j7e["__core-js_shared__"];JM.exports=L7e});var XM=v((O3t,ZM)=>{var MD=YM(),QM=(function(){var t=/[^.]+$/.exec(MD&&MD.keys&&MD.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function M7e(t){return!!QM&&QM in t}ZM.exports=M7e});var $D=v((T3t,e$)=>{var $7e=Function.prototype,U7e=$7e.toString;function V7e(t){if(t!=null){try{return U7e.call(t)}catch{}try{return t+""}catch{}}return""}e$.exports=V7e});var r$=v((P3t,t$)=>{var z7e=LD(),H7e=XM(),W7e=eo(),G7e=$D(),K7e=/[\\^$.*+?()[\]{}|]/g,J7e=/^\[object .+?Constructor\]$/,Y7e=Function.prototype,Q7e=Object.prototype,Z7e=Y7e.toString,X7e=Q7e.hasOwnProperty,ebe=RegExp("^"+Z7e.call(X7e).replace(K7e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function tbe(t){if(!W7e(t)||H7e(t))return!1;var e=z7e(t)?ebe:J7e;return e.test(G7e(t))}t$.exports=tbe});var i$=v((q3t,n$)=>{function rbe(t,e){return t?.[e]}n$.exports=rbe});var Qo=v((R3t,a$)=>{var nbe=r$(),ibe=i$();function abe(t,e){var r=ibe(t,e);return nbe(r)?r:void 0}a$.exports=abe});var lf=v((I3t,s$)=>{var sbe=Qo(),obe=sbe(Object,"create");s$.exports=obe});var c$=v((k3t,u$)=>{var o$=lf();function ube(){this.__data__=o$?o$(null):{},this.size=0}u$.exports=ube});var p$=v((N3t,l$)=>{function cbe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}l$.exports=cbe});var f$=v((B3t,d$)=>{var lbe=lf(),pbe="__lodash_hash_undefined__",dbe=Object.prototype,fbe=dbe.hasOwnProperty;function mbe(t){var e=this.__data__;if(lbe){var r=e[t];return r===pbe?void 0:r}return fbe.call(e,t)?e[t]:void 0}d$.exports=mbe});var h$=v((j3t,m$)=>{var hbe=lf(),vbe=Object.prototype,gbe=vbe.hasOwnProperty;function xbe(t){var e=this.__data__;return hbe?e[t]!==void 0:gbe.call(e,t)}m$.exports=xbe});var g$=v((L3t,v$)=>{var bbe=lf(),ybe="__lodash_hash_undefined__";function Dbe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=bbe&&e===void 0?ybe:e,this}v$.exports=Dbe});var b$=v((M3t,x$)=>{var wbe=c$(),_be=p$(),Ebe=f$(),Sbe=h$(),Cbe=g$();function Kp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Kp.prototype.clear=wbe;Kp.prototype.delete=_be;Kp.prototype.get=Ebe;Kp.prototype.has=Sbe;Kp.prototype.set=Cbe;x$.exports=Kp});var D$=v(($3t,y$)=>{function Fbe(){this.__data__=[],this.size=0}y$.exports=Fbe});var Jp=v((U3t,w$)=>{function Abe(t,e){return t===e||t!==t&&e!==e}w$.exports=Abe});var pf=v((V3t,_$)=>{var Obe=Jp();function Tbe(t,e){for(var r=t.length;r--;)if(Obe(t[r][0],e))return r;return-1}_$.exports=Tbe});var S$=v((z3t,E$)=>{var Pbe=pf(),qbe=Array.prototype,Rbe=qbe.splice;function Ibe(t){var e=this.__data__,r=Pbe(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Rbe.call(e,r,1),--this.size,!0}E$.exports=Ibe});var F$=v((H3t,C$)=>{var kbe=pf();function Nbe(t){var e=this.__data__,r=kbe(e,t);return r<0?void 0:e[r][1]}C$.exports=Nbe});var O$=v((W3t,A$)=>{var Bbe=pf();function jbe(t){return Bbe(this.__data__,t)>-1}A$.exports=jbe});var P$=v((G3t,T$)=>{var Lbe=pf();function Mbe(t,e){var r=this.__data__,n=Lbe(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}T$.exports=Mbe});var df=v((K3t,q$)=>{var $be=D$(),Ube=S$(),Vbe=F$(),zbe=O$(),Hbe=P$();function Yp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Yp.prototype.clear=$be;Yp.prototype.delete=Ube;Yp.prototype.get=Vbe;Yp.prototype.has=zbe;Yp.prototype.set=Hbe;q$.exports=Yp});var X6=v((J3t,R$)=>{var Wbe=Qo(),Gbe=ma(),Kbe=Wbe(Gbe,"Map");R$.exports=Kbe});var N$=v((Y3t,k$)=>{var I$=b$(),Jbe=df(),Ybe=X6();function Qbe(){this.size=0,this.__data__={hash:new I$,map:new(Ybe||Jbe),string:new I$}}k$.exports=Qbe});var j$=v((Q3t,B$)=>{function Zbe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}B$.exports=Zbe});var ff=v((Z3t,L$)=>{var Xbe=j$();function eye(t,e){var r=t.__data__;return Xbe(e)?r[typeof e=="string"?"string":"hash"]:r.map}L$.exports=eye});var $$=v((X3t,M$)=>{var tye=ff();function rye(t){var e=tye(this,t).delete(t);return this.size-=e?1:0,e}M$.exports=rye});var V$=v((e5t,U$)=>{var nye=ff();function iye(t){return nye(this,t).get(t)}U$.exports=iye});var H$=v((t5t,z$)=>{var aye=ff();function sye(t){return aye(this,t).has(t)}z$.exports=sye});var G$=v((r5t,W$)=>{var oye=ff();function uye(t,e){var r=oye(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}W$.exports=uye});var e4=v((n5t,K$)=>{var cye=N$(),lye=$$(),pye=V$(),dye=H$(),fye=G$();function Qp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Qp.prototype.clear=cye;Qp.prototype.delete=lye;Qp.prototype.get=pye;Qp.prototype.has=dye;Qp.prototype.set=fye;K$.exports=Qp});var Q$=v((i5t,Y$)=>{var J$=e4(),mye="Expected a function";function UD(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(mye);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=t.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(UD.Cache||J$),r}UD.Cache=J$;Y$.exports=UD});var X$=v((a5t,Z$)=>{var hye=Q$(),vye=500;function gye(t){var e=hye(t,function(n){return r.size===vye&&r.clear(),n}),r=e.cache;return e}Z$.exports=gye});var tU=v((s5t,eU)=>{var xye=X$(),bye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yye=/\\(\\)?/g,Dye=xye(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(bye,function(r,n,i,a){e.push(i?a.replace(yye,"$1"):n||r)}),e});eU.exports=Dye});var VD=v((o5t,rU)=>{function wye(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}rU.exports=wye});var uU=v((u5t,oU)=>{var nU=Gp(),_ye=VD(),Eye=Pi(),Sye=Q6(),Cye=1/0,iU=nU?nU.prototype:void 0,aU=iU?iU.toString:void 0;function sU(t){if(typeof t=="string")return t;if(Eye(t))return _ye(t,sU)+"";if(Sye(t))return aU?aU.call(t):"";var e=t+"";return e=="0"&&1/t==-Cye?"-0":e}oU.exports=sU});var lU=v((c5t,cU)=>{var Fye=uU();function Aye(t){return t==null?"":Fye(t)}cU.exports=Aye});var t4=v((l5t,pU)=>{var Oye=Pi(),Tye=Z6(),Pye=tU(),qye=lU();function Rye(t,e){return Oye(t)?t:Tye(t,e)?[t]:Pye(qye(t))}pU.exports=Rye});var Zp=v((p5t,dU)=>{var Iye=Q6(),kye=1/0;function Nye(t){if(typeof t=="string"||Iye(t))return t;var e=t+"";return e=="0"&&1/t==-kye?"-0":e}dU.exports=Nye});var zD=v((d5t,fU)=>{var Bye=t4(),jye=Zp();function Lye(t,e){e=Bye(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[jye(e[r++])];return r&&r==n?t:void 0}fU.exports=Lye});var HD=v((f5t,mU)=>{var Mye=zD();function $ye(t,e,r){var n=t==null?void 0:Mye(t,e);return n===void 0?r:n}mU.exports=$ye});var WD=v((m5t,hU)=>{var Uye=Qo(),Vye=(function(){try{var t=Uye(Object,"defineProperty");return t({},"",{}),t}catch{}})();hU.exports=Vye});var GD=v((h5t,gU)=>{var vU=WD();function zye(t,e,r){e=="__proto__"&&vU?vU(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}gU.exports=zye});var r4=v((v5t,xU)=>{var Hye=GD(),Wye=Jp(),Gye=Object.prototype,Kye=Gye.hasOwnProperty;function Jye(t,e,r){var n=t[e];(!(Kye.call(t,e)&&Wye(n,r))||r===void 0&&!(e in t))&&Hye(t,e,r)}xU.exports=Jye});var mf=v((g5t,bU)=>{var Yye=9007199254740991,Qye=/^(?:0|[1-9]\d*)$/;function Zye(t,e){var r=typeof t;return e=e??Yye,!!e&&(r=="number"||r!="symbol"&&Qye.test(t))&&t>-1&&t%1==0&&t<e}bU.exports=Zye});var wU=v((x5t,DU)=>{var Xye=r4(),eDe=t4(),tDe=mf(),yU=eo(),rDe=Zp();function nDe(t,e,r,n){if(!yU(t))return t;e=eDe(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var c=rDe(e[i]),l=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var d=o[c];l=n?n(d,c,o):void 0,l===void 0&&(l=yU(d)?d:tDe(e[i+1])?[]:{})}Xye(o,c,l),o=o[c]}return t}DU.exports=nDe});var EU=v((b5t,_U)=>{var iDe=wU();function aDe(t,e,r){return t==null?t:iDe(t,e,r)}_U.exports=aDe});var vt=v(n4=>{"use strict";Object.defineProperty(n4,"__esModule",{value:!0});n4.isFunction=void 0;function sDe(t){return typeof t=="function"}n4.isFunction=sDe});var Zo=v(i4=>{"use strict";Object.defineProperty(i4,"__esModule",{value:!0});i4.createErrorClass=void 0;function oDe(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}i4.createErrorClass=oDe});var KD=v(a4=>{"use strict";Object.defineProperty(a4,"__esModule",{value:!0});a4.UnsubscriptionError=void 0;var uDe=Zo();a4.UnsubscriptionError=uDe.createErrorClass(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
@@ -368,7 +368,7 @@ ${uh.default.rgb(234,88,12)("Thanks for using Smithery stdio listener!")}
368
368
  `)};process.on("SIGINT",m),process.on("SIGTERM",m),process.on("beforeExit",m),process.on("exit",()=>{U("[stdio listener] Final cleanup on exit")});try{await y(),await x(),console.log(uh.default.green("\u2705 Command server started, setting up uplink tunnel..."));let{listener:S}=await Ua(String(l),e,r.open!==!1,r.initialMessage||"Say hello to the world!");o=S,console.log(uh.default.green("\u{1F680} Command uplink tunnel established and playground opened"))}catch(S){throw U(`[stdio listener] Failed to start: ${S}`),await _(),S}return _}});var Fn=ye(at(),1);var wB=ye(DB(),1),{program:C4t,createCommand:F4t,createArgument:A4t,createOption:O4t,CommanderError:T4t,InvalidArgumentError:P4t,InvalidOptionArgumentError:q4t,Command:_B,Argument:R4t,Option:I4t,Help:k4t}=wB.default;var _n=ye(at(),1);import{existsSync as Cp,mkdirSync as X3e,readFileSync as e5e,statSync as t5e}from"node:fs";import{dirname as SB,join as r5e,resolve as Ey}from"node:path";import*as m6 from"esbuild";function EB(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function n5e(t){if(t){let a=Ey(process.cwd(),t);if(!Cp(a))throw new Error(`Entry file not found at ${a}`);return a}let e=r5e(process.cwd(),"package.json");if(!Cp(e))throw new Error("No package.json found in current directory. Please run this command from your project root or specify an entry file.");let r;try{let a=e5e(e,"utf-8");r=JSON.parse(a)}catch(a){throw new Error(`Failed to parse package.json: ${a}`)}if(!r.module||typeof r.module!="string")throw new Error(`No entry point found in package.json. Please define the "module" field:
369
369
  "module": "./src/index.ts"
370
370
  Or specify an entry file directly with the command.`);let n=r.module,i=Ey(process.cwd(),n);if(!Cp(i))throw new Error(`Entry file specified in package.json not found at ${i}.
371
- Check that the file exists or update your package.json`);return i}async function i5e(t){let e=t?[t]:["smithery.config.js","smithery.config.mjs","smithery.config.cjs"];for(let r of e){let n=Ey(process.cwd(),r);if(Cp(n))try{let i=await import(n),a=i.default??i;return a.esbuild||a||{}}catch(i){console.warn(`Failed to load config from ${r}:`,i)}}return{}}async function a5e(t,e){let r=performance.now(),n=t.outFile||".smithery/index.cjs",i=t.transport??"shttp",a=SB(n);Cp(a)||X3e(a,{recursive:!0});let s=i==="shttp"?"streamable http":i;console.log(_n.default.dim(`${_n.default.bold.italic.hex("#ea580c")("SMITHERY")} ${_n.default.bold.italic.hex("#ea580c")("v1.4.6")} Building MCP server with ${_n.default.cyan(s)} transport...`));let o=()=>({name:"smithery-bootstrap-plugin",setup(f){f.onResolve({filter:/^virtual:bootstrap$/},()=>({path:"virtual:bootstrap",namespace:"bootstrap"})),f.onLoad({filter:/.*/,namespace:"bootstrap"},()=>({contents:(i==="stdio"?`// src/runtime/stdio-bootstrap.ts
371
+ Check that the file exists or update your package.json`);return i}async function i5e(t){let e=t?[t]:["smithery.config.js","smithery.config.mjs","smithery.config.cjs"];for(let r of e){let n=Ey(process.cwd(),r);if(Cp(n))try{let i=await import(n),a=i.default??i;return a.esbuild||a||{}}catch(i){console.warn(`Failed to load config from ${r}:`,i)}}return{}}async function a5e(t,e){let r=performance.now(),n=t.outFile||".smithery/index.cjs",i=t.transport??"shttp",a=SB(n);Cp(a)||X3e(a,{recursive:!0});let s=i==="shttp"?"streamable http":i;console.log(_n.default.dim(`${_n.default.bold.italic.hex("#ea580c")("SMITHERY")} ${_n.default.bold.italic.hex("#ea580c")("v1.4.7")} Building MCP server with ${_n.default.cyan(s)} transport...`));let o=()=>({name:"smithery-bootstrap-plugin",setup(f){f.onResolve({filter:/^virtual:bootstrap$/},()=>({path:"virtual:bootstrap",namespace:"bootstrap"})),f.onLoad({filter:/.*/,namespace:"bootstrap"},()=>({contents:(i==="stdio"?`// src/runtime/stdio-bootstrap.ts
372
372
  import * as _entry from "virtual:user-module";
373
373
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
374
374
  import chalk from "chalk";
@@ -577,13 +577,13 @@ o/ Shutting down server...`)),f&&"dispose"in f&&await f.dispose(),s&&await _6({c
577
577
  ${M9(this.cause)}`:this.toString()}};function M9(t,e=0){let r=" ".repeat(e);r=e>0?`\u2502${r}`:r,r+=" ".repeat(e);let n="",i=o=>n+=`
578
578
  ${r}${o}`,a=t.issues.length,s=a===1?`${a} issue found`:`${a} issues found`;a&&i(`\u250C ${s}:`);for(let o of t.issues){let c=o.path.join(".");switch(c=c?`<root>.${c}`:"<root>",i(`\u2502 \u2022 [${c}]: ${o.message} (${o.code})`),o.code){case"invalid_literal":case"invalid_type":{i(`\u2502 Want: ${o.expected}`),i(`\u2502 Got: ${o.received}`);break}case"unrecognized_keys":{i(`\u2502 Keys: ${o.keys.join(", ")}`);break}case"invalid_enum_value":{i(`\u2502 Allowed: ${o.options.join(", ")}`),i(`\u2502 Got: ${o.received}`);break}case"invalid_union_discriminator":{i(`\u2502 Allowed: ${o.options.join(", ")}`);break}case"invalid_union":{let l=o.unionErrors.length;i(`\u2502 \u2716\uFE0E Attemped to deserialize into one of ${l} union members:`),o.unionErrors.forEach((d,f)=>{i(`\u2502 \u2716\uFE0E Member ${f+1} of ${l}`),i(`${M9(d,e+1)}`)})}}}return t.issues.length&&i("\u2514\u2500*"),n.slice(1)}var $9=class extends Gi{constructor(e,r){super(e,r),this.name="ResponseValidationError",this.cause=r.cause,this.rawValue=r.rawValue,this.rawMessage=r.rawMessage}pretty(){return this.cause instanceof Ir?`${this.rawMessage}
579
579
  ${M9(this.cause)}`:this.toString()}};var Crt={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function Cl(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function U9(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function _0(t){return{enc:"fail",codes:t}}function V9(...t){return async function(r,n,i){let a,s;for(let f of t){let{codes:m}=f,g="ctype"in f?f.ctype:Crt[f.enc];if(g&&Zre(r,m,g)){s=f;break}else if(!g&&mm(r,m)){s=f;break}}if(!s)return[{ok:!1,error:new ym("Unexpected Status or Content-Type",{response:r,request:n,body:await r.text().catch(()=>"")})},a];let o=s.enc,c="";switch(o){case"json":c=await r.text(),a=JSON.parse(c);break;case"jsonl":a=r.body;break;case"bytes":a=new Uint8Array(await r.arrayBuffer());break;case"stream":a=r.body;break;case"text":c=await r.text(),a=c;break;case"sse":a=r.body;break;case"nil":c=await r.text(),a=void 0;break;case"fail":c=await r.text(),a=c;break;default:throw new Error(`Unsupported response type: ${o}`)}if(s.enc==="fail")return[{ok:!1,error:new ym("API error occurred",{request:n,response:r,body:c})},a];let l=s.key||i?.resultKey,d;if("err"in s?d={...i?.extraFields,...s.hdrs?{Headers:kA(r.headers)}:null,...Sa(a)?a:null,request$:n,response$:r,body$:c}:l?d={...i?.extraFields,...s.hdrs?{Headers:kA(r.headers)}:null,[l]:a}:s.hdrs?d={...i?.extraFields,...s.hdrs?{Headers:kA(r.headers)}:null,...Sa(a)?a:null}:d=a,"err"in s){let f=dne(d,m=>s.schema.parse(m),"Response validation failed",{request:n,response:r,body:c});return[f.ok?{ok:!1,error:f.value}:f,a]}else return[dne(d,f=>s.schema.parse(f),"Response validation failed",{request:n,response:r,body:c}),a]}}var Frt=/, */;function kA(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Frt);return e}function dne(t,e,r,n){try{return Sl(e(t))}catch(i){return Ea(new $9(r,{cause:i,rawValue:t,rawMessage:r,...n}))}}function Dm(t,e){let r={};if(!Object.keys(e).length)return r=t,r;for(let[n,i]of Object.entries(t)){let a=e[n];a!==null&&(r[a??n]=i)}return r}function z9(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function ni(t,e,r){try{return Sl(e(t))}catch(n){return Ea(new w0(r,n,t))}}function mne(t,e,r){return t.transform(n=>{let i={},{shape:a}=t;for(let[s]of Object.entries(n)){if(s in a)continue;let o=n[s];typeof o>"u"||(i[s]=o,delete n[s])}return r&&Object.keys(i).length===0?n:{...n,[e]:i}})}var W9;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(W9||(W9={}));var NA=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(W9.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(W9.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};function Art(...t){let e={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=t.find(n=>n.every(i=>{if(i.value==null)return!1;if(i.type==="http:basic")return i.value.username!=null||i.value.password!=null;if(i.type==="http:custom")return null;if(i.type==="oauth2:password")return typeof i.value=="string"&&!!i.value;if(i.type==="oauth2:client_credentials")return typeof i.value=="string"?!!i.value:i.value.clientID!=null||i.value.clientSecret!=null;if(typeof i.value=="string")return!!i.value;throw new Error(`Unrecognized security type: ${i.type} (value type: ${typeof i.value})`)}));return r==null?null:(r.forEach(n=>{if(n.value==null)return;let{type:i}=n;switch(i){case"apiKey:header":e.headers[n.fieldName]=n.value;break;case"apiKey:query":e.queryParams[n.fieldName]=n.value;break;case"apiKey:cookie":e.cookies[n.fieldName]=n.value;break;case"http:basic":Ort(e,n);break;case"http:custom":break;case"http:bearer":H9(e,n);break;case"oauth2":H9(e,n);break;case"oauth2:password":H9(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":H9(e,n);break;default:throw NA.unrecognizedType(i)}}),e)}function Ort(t,e){e.value!=null&&(t.basic=e.value)}function H9(t,e){if(typeof e.value!="string"||!e.value)return;let r=e.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),e.fieldName!==void 0&&(t.headers[e.fieldName]=r)}function G9(t){return Art([{fieldName:"Authorization",type:"http:bearer",value:t?.bearerAuth??N9().SMITHERY_BEARER_AUTH}])}async function K9(t){if(t!=null)return typeof t=="function"?t():t}hr();var Trt={Http:"http",Stdio:"stdio"},Prt={Node:"node"},BA=Up(Trt),xne=BA,hne;(function(t){t.inboundSchema=BA,t.outboundSchema=xne})(hne||(hne={}));var jA=Up(Prt),bne=jA,vne;(function(t){t.inboundSchema=jA,t.outboundSchema=bne})(vne||(vne={}));var LA=Fe({type:BA,deploymentUrl:be().optional(),configSchema:Jo(Ys()),published:Wa().optional(),stdioFunction:be().optional(),bundleUrl:be().optional(),runtime:jA.optional()}),MA=Fe({type:xne,deploymentUrl:be().optional(),configSchema:Jo(Ys()),published:Wa().optional(),stdioFunction:be().optional(),bundleUrl:be().optional(),runtime:bne.optional()}),gne;(function(t){t.inboundSchema=LA,t.outboundSchema=MA})(gne||(gne={}));hr();var $A=Fe({currentPage:_r().int(),pageSize:_r().int(),totalPages:_r().int(),totalCount:_r().int()}),UA=Fe({currentPage:_r().int(),pageSize:_r().int(),totalPages:_r().int(),totalCount:_r().int()}),yne;(function(t){t.inboundSchema=$A,t.outboundSchema=UA})(yne||(yne={}));hr();var qrt=Fe({bearerAuth:be().optional()}),Rrt=Fe({bearerAuth:be().optional()}),Dne;(function(t){t.inboundSchema=qrt,t.outboundSchema=Rrt})(Dne||(Dne={}));hr();hr();var Irt={Object:"object"},VA=Up(Irt),Sne=VA,wne;(function(t){t.inboundSchema=VA,t.outboundSchema=Sne})(wne||(wne={}));var Cne=mne(Fe({type:VA,properties:Jo(Ys()).optional()}).catchall(Ys()),"additionalProperties",!0),Fne=Fe({type:Sne,properties:Jo(Ys()).optional(),additionalProperties:Jo(Ys())}).transform(t=>({...t.additionalProperties,...Dm(t,{additionalProperties:null})})),_ne;(function(t){t.inboundSchema=Cne,t.outboundSchema=Fne})(_ne||(_ne={}));var zA=Fe({name:be(),description:Xn(be()).optional(),inputSchema:Wc(()=>Cne)}),HA=Fe({name:be(),description:Xn(be()).optional(),inputSchema:Wc(()=>Fne)}),Ene;(function(t){t.inboundSchema=zA,t.outboundSchema=HA})(Ene||(Ene={}));var Tne=Fe({scanPassed:Xn(Wa()).optional()}),Pne=Fe({scanPassed:Xn(Wa()).optional()}),Ane;(function(t){t.inboundSchema=Tne,t.outboundSchema=Pne})(Ane||(Ane={}));var WA=Fe({qualifiedName:be(),displayName:be(),iconUrl:Xn(be()).optional(),remote:Wa().optional(),connections:Qs(LA),security:Xn(Wc(()=>Tne)).optional(),tools:Xn(Qs(zA)).optional()}),krt=Fe({qualifiedName:be(),displayName:be(),iconUrl:Xn(be()).optional(),remote:Wa().optional(),connections:Qs(MA),security:Xn(Wc(()=>Pne)).optional(),tools:Xn(Qs(HA)).optional()}),One;(function(t){t.inboundSchema=WA,t.outboundSchema=krt})(One||(One={}));hr();var GA=Fe({qualifiedName:be(),displayName:be(),description:be(),homepage:be(),useCount:_r().int(),createdAt:be().datetime({offset:!0}).transform(t=>new Date(t))}),KA=Fe({qualifiedName:be(),displayName:be(),description:be(),homepage:be(),useCount:_r().int(),createdAt:lD().transform(t=>t.toISOString())}),qne;(function(t){t.inboundSchema=GA,t.outboundSchema=KA})(qne||(qne={}));hr();var JA=Fe({servers:Qs(GA),pagination:$A}),YA=Fe({servers:Qs(KA),pagination:UA}),Rne;(function(t){t.inboundSchema=JA,t.outboundSchema=YA})(Rne||(Rne={}));hr();var J9=class extends Gi{constructor(e,r){let n="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(n,r),this.data$=e,e.error!=null&&(this.error=e.error),this.name="NotFoundError"}},QA=Fe({error:be().optional(),request$:dn(Request),response$:dn(Response),body$:be()}).transform(t=>new J9(t,{request:t.request$,response:t.response$,body:t.body$})),Nrt=dn(J9).transform(t=>t.data$).pipe(Fe({error:be().optional()})),kne;(function(t){t.inboundSchema=QA,t.outboundSchema=Nrt})(kne||(kne={}));hr();var E0=class extends Gi{constructor(e,r){let n="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(n,r),this.data$=e,e.error!=null&&(this.error=e.error),this.name="ServerError"}},wm=Fe({error:be().optional(),request$:dn(Request),response$:dn(Response),body$:be()}).transform(t=>new E0(t,{request:t.request$,response:t.response$,body:t.body$})),Brt=dn(E0).transform(t=>t.data$).pipe(Fe({error:be().optional()})),Nne;(function(t){t.inboundSchema=wm,t.outboundSchema=Brt})(Nne||(Nne={}));hr();var S0=class extends Gi{constructor(e,r){let n="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(n,r),this.data$=e,e.error!=null&&(this.error=e.error),this.name="UnauthorizedError"}},_m=Fe({error:be().optional(),request$:dn(Request),response$:dn(Response),body$:be()}).transform(t=>new S0(t,{request:t.request$,response:t.response$,body:t.body$})),jrt=dn(S0).transform(t=>t.data$).pipe(Fe({error:be().optional()})),Bne;(function(t){t.inboundSchema=_m,t.outboundSchema=jrt})(Bne||(Bne={}));hr();var Lrt=Fe({qualifiedName:be()}),ZA=Fe({qualifiedName:be()}),Lne;(function(t){t.inboundSchema=Lrt,t.outboundSchema=ZA})(Lne||(Lne={}));hr();var Mrt=Fe({q:be().optional(),page:_r().int().default(1),pageSize:_r().int().default(10)}),XA=Fe({q:be().optional(),page:_r().int().default(1),pageSize:_r().int().default(10)}),Mne;(function(t){t.inboundSchema=Mrt,t.outboundSchema=XA})(Mne||(Mne={}));var eO=Fe({Result:JA}).transform(t=>Dm(t,{Result:"result"})),$rt=Fe({result:YA}).transform(t=>Dm(t,{result:"Result"})),$ne;(function(t){t.inboundSchema=eO,t.outboundSchema=$rt})($ne||($ne={}));var Vne=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Em=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},C0,Sm,zne,F0=class{constructor(e){C0.set(this,void 0),Sm.set(this,void 0),this[zne]="APIPromise",Vne(this,C0,e instanceof Promise?e:Promise.resolve(e),"f"),Vne(this,Sm,e instanceof Promise?Em(this,C0,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return Em(this,C0,"f").then(e?([n])=>e(n):void 0,r)}catch(e){return Em(this,Sm,"f").catch(e)}finally(e){return Em(this,Sm,"f").finally(e)}$inspect(){return Em(this,C0,"f")}};C0=new WeakMap,Sm=new WeakMap,zne=Symbol.toStringTag;function Hne(t,e,r){return new F0(Urt(t,e,r))}async function Urt(t,e,r){let n=ni(e,A=>ZA.parse(A),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let i=n.value,a=null,s={qualifiedName:ine("qualifiedName",i.qualifiedName,{explode:!1,charEncoding:"percent"})},o=b0("/servers/{qualifiedName}")(s),c=new Headers(z9({Accept:"application/json"})),l=await K9(t._options.bearerAuth),d=l==null?{}:{bearerAuth:l},f=G9(d),m={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"getServer",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.bearerAuth,retryConfig:r?.retries||t._options.retryConfig||{strategy:"backoff",backoff:{initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},retryConnectionErrors:!0},retryCodes:r?.retryCodes||["5XX"]},g=t._createRequest(m,{security:f,method:"GET",baseURL:r?.serverURL,path:o,headers:c,body:a,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!g.ok)return[g,{status:"invalid"}];let b=g.value,x=await t._do(b,{context:m,errorCodes:["401","404","4XX","500","5XX"],retryConfig:m.retryConfig,retryCodes:m.retryCodes});if(!x.ok)return[x,{status:"request-error",request:b}];let y=x.value,_={HttpMeta:{Response:y,Request:b}},[S]=await V9(U9(200,WA),Cl(401,_m),Cl(404,QA),Cl(500,wm),_0("4XX"),_0("5XX"))(y,b,{extraFields:_});return S.ok?[S,{status:"complete",request:b,response:y}]:[S,{status:"complete",request:b,response:y}]}function Wne(t,e){return{[Symbol.asyncIterator]:async function*(){if(yield t,e(t))return;let n=t;for(n=await n.next();n!=null;n=await n.next())if(yield n,e(n))return}}}function Cm(t){return{...t,next:()=>null,[Symbol.asyncIterator]:async function*(){yield t}}}async function Gne(t){let e=await t;if(!e.ok)throw e.error;return{...e.value,next:Kne(e.next),"~next":e["~next"],[Symbol.asyncIterator]:async function*(){for await(let n of e){if(!n.ok)throw n.error;yield n.value}}}}function Kne(t){return()=>{let e=t();return e==null?null:e.then(r=>{if(!r.ok)throw r.error;return{...r.value,next:Kne(r.next)}})}}var ZCt=Symbol("URL_OVERRIDE");function tO(t,e,r){return new F0(Vrt(t,e,r))}async function Vrt(t,e,r){let n=ni(e,I=>XA.parse(I),"Input validation failed");if(!n.ok)return[Cm(n),{status:"invalid"}];let i=n.value,a=null,s=b0("/servers")(),o=une({page:i.page,pageSize:i.pageSize,q:i.q}),c=new Headers(z9({Accept:"application/json"})),l=await K9(t._options.bearerAuth),d=l==null?{}:{bearerAuth:l},f=G9(d),m={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"listServers",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.bearerAuth,retryConfig:r?.retries||t._options.retryConfig||{strategy:"backoff",backoff:{initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},retryConnectionErrors:!0},retryCodes:r?.retryCodes||["5XX"]},g=t._createRequest(m,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:c,query:o,body:a,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!g.ok)return[Cm(g),{status:"invalid"}];let b=g.value,x=await t._do(b,{context:m,errorCodes:["401","4XX","500","5XX"],retryConfig:m.retryConfig,retryCodes:m.retryCodes});if(!x.ok)return[Cm(x),{status:"request-error",request:b}];let y=x.value,_={HttpMeta:{Response:y,Request:b}},[S,A]=await V9(U9(200,eO,{key:"Result"}),Cl(401,_m),Cl(500,wm),_0("4XX"),_0("5XX"))(y,b,{extraFields:_});if(!S.ok)return[Cm(S),{status:"complete",request:b,response:y}];let q={...S,...(I=>{let L=(e?.page??1)+1;if(!I)return{next:()=>null};let H=xm(I,"data.resultArray");return!Array.isArray(H)||!H.length?{next:()=>null}:{next:()=>tO(t,{...e,page:L},r),"~next":{page:L}}})(A)};return[{...q,...Wne(q,I=>!I.ok)},{status:"complete",request:b,response:y}]}var Y9=class extends D0{async list(e,r){return Gne(tO(this,e,r))}async get(e,r){return ene(Hne(this,e,r))}};var Q9=class extends D0{get servers(){return this._servers??(this._servers=new Y9(this._options))}};var Jie=ye(tie(),1);hr();var rie=w.lazy(()=>w.object({type:w.string().optional(),properties:w.record(rie).optional(),items:rie.optional(),required:w.array(w.string()).optional(),description:w.string().optional(),default:w.unknown().optional()})),iO=w.object({command:w.string().describe("The executable to run to start the server."),args:w.array(w.string()).optional().describe("Command line arguments to pass to the executable."),env:w.record(w.string(),w.string()).optional().describe("The environment to use when spawning the process.")}),ont=w.object({bundleUrl:w.string().describe("The URL where the downloadable bundle is stored."),runtime:w.enum(["node"]).optional().describe("Runtime required to execute the bundle (default: node).")}),unt=w.object({deploymentUrl:w.string().describe("The URL of the Streamable HTTP server.")}),SFt=w.object({type:w.literal("http").describe("Connection type for HTTP servers."),url:w.string().describe("The direct URL of the HTTP MCP server."),headers:w.record(w.string(),w.string()).optional().describe("Optional HTTP headers to include.")}),CFt=w.union([w.object({type:w.literal("stdio"),...iO.shape}),w.object({type:w.literal("stdio"),...ont.shape}),w.object({type:w.literal("http"),...unt.shape})]);var aie=ye(ti(),1);var X9="0123456789abcdef",eg=class t{constructor(e){this.bytes=e}static ofInner(e){if(e.length!==16)throw new TypeError("not 128-bit length");return new t(e)}static fromFieldsV7(e,r,n,i){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||e<0||r<0||n<0||i<0||e>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=e/2**40,a[1]=e/2**32,a[2]=e/2**24,a[3]=e/2**16,a[4]=e/2**8,a[5]=e,a[6]=112|r>>>8,a[7]=r,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new t(a)}static parse(e){var r,n,i,a;let s;switch(e.length){case 32:s=(r=/^[0-9a-f]{32}$/i.exec(e))===null||r===void 0?void 0:r[0];break;case 36:s=(n=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e))===null||n===void 0?void 0:n.slice(1,6).join("");break;case 38:s=(i=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e))===null||i===void 0?void 0:i.slice(1,6).join("");break;case 45:s=(a=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e))===null||a===void 0?void 0:a.slice(1,6).join("");break;default:break}if(s){let o=new Uint8Array(16);for(let c=0;c<16;c+=4){let l=parseInt(s.substring(2*c,2*c+8),16);o[c+0]=l>>>24,o[c+1]=l>>>16,o[c+2]=l>>>8,o[c+3]=l}return new t(o)}else throw new SyntaxError("could not parse UUID string")}toString(){let e="";for(let r=0;r<this.bytes.length;r++)e+=X9.charAt(this.bytes[r]>>>4),e+=X9.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(e+="-");return e}toHex(){let e="";for(let r=0;r<this.bytes.length;r++)e+=X9.charAt(this.bytes[r]>>>4),e+=X9.charAt(this.bytes[r]&15);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw new Error("unreachable");if(e<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let r=0;r<16;r++){let n=this.bytes[r]-e.bytes[r];if(n!==0)return Math.sign(n)}return 0}},aO=class{constructor(e){this.timestamp=0,this.counter=0,this.random=e??cnt()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,r){let n=this.generateOrAbortCore(e,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(e,r)),n}generateOrAbortCore(e,r){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else if(e+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return eg.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,eg.ofInner(e)}},cnt=()=>{if(typeof crypto<"u"&&typeof crypto.getRandomValues<"u")return new sO;if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");return{nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}},sO=class{constructor(){this.buffer=new Uint32Array(8),this.cursor=65535}nextUint32(){return this.cursor>=this.buffer.length&&(crypto.getRandomValues(this.buffer),this.cursor=0),this.buffer[this.cursor++]}},nie,iie=()=>lnt().toString(),lnt=()=>(nie||(nie=new aO)).generate();var Fl=null,pnt=1800*1e3,Am=null;var sie=()=>{Am&&clearTimeout(Am);let t=Date.now();return Fl={id:iie(),startTime:t,lastActivityTime:t},Fl},dnt=()=>{if(!Fl){sie();return}let t=Date.now();Fl.lastActivityTime=t,Am&&clearTimeout(Am),Am=setTimeout(()=>{Fl=null},pnt)},tg=()=>(Fl||sie(),dnt(),Fl.id);async function oie(){let t=await ls();if(!t.success){console.warn("[Analytics] Failed to initialize settings:",t.error);return}if(await n9())return;if(!await Lee())try{let{EnableAnalytics:n}=await aie.default.prompt([{type:"confirm",name:"EnableAnalytics",message:'Would you like to help improve Smithery by sending anonymized usage data?")}',default:!0}]),i=await jee(n);i.success||console.warn("[Smithery] Failed to save preference:",i.error)}catch(n){console.warn("[Smithery] Failed to prompt for consent:",n instanceof Error?n.message:String(n))}}var Kie=ye(ug(),1),oit=5e3,uit={initialInterval:1e3,maxInterval:4e3,exponent:2,maxElapsedTime:15e3},Pl=async(t,e={},r={})=>{let n=r.timeout??oit,i={...uit,...r.backoff},a=Date.now(),s=0,o;for(;;){let c=new AbortController,l=setTimeout(()=>c.abort(),n);try{let d=await(0,Kie.default)(t,{...e,signal:c.signal});return clearTimeout(l),d}catch(d){clearTimeout(l),d instanceof Error?d.name==="AbortError"?o=new Error(`Request timed out after ${n}ms when calling ${t}`):o=d:o=new Error(String(d));let f=Date.now()-a;if(f>=i.maxElapsedTime)throw new Error(`Failed after ${f}ms: ${o?.message}`);let m=Math.min(i.initialInterval*i.exponent**s,i.maxInterval);if(f+m>=i.maxElapsedTime)throw new Error(`Failed after ${f}ms: ${o?.message}`);await new Promise(g=>setTimeout(g,m)),s++}}};Zn();(0,Jie.config)({quiet:!0});var Bm=()=>{if(process.env.NODE_ENV==="development"&&process.env.LOCAL_REGISTRY_ENDPOINT)return process.env.LOCAL_REGISTRY_ENDPOINT;let t=process.env.REGISTRY_ENDPOINT||"https://registry.smithery.ai";if(!t)throw new Error("REGISTRY_ENDPOINT environment variable is not set");return t};var k0=async(t,e,r)=>{Fp&&(async()=>{try{let a=tg(),s=await Nee();await Pl(Fp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({eventName:"resolve_server",payload:{serverQualifiedName:t,source:r,hasApiKey:!!e},$session_id:a,userId:s})})}catch{}})();let n={bearerAuth:e??process.env.SMITHERY_BEARER_AUTH??"",timeoutMs:5e3,retryConfig:{strategy:"backoff",backoff:{initialInterval:1e3,maxInterval:4e3,exponent:2,maxElapsedTime:15e3},retryConnectionErrors:!0}};process.env.NODE_ENV==="development"&&process.env.LOCAL_REGISTRY_ENDPOINT&&(n.serverURL=process.env.LOCAL_REGISTRY_ENDPOINT);let i=new Q9(n);V(`Resolving package ${t} using Smithery SDK at ${n.serverURL||"<default>"}`);try{let a=await i.servers.get({qualifiedName:t});return V("Successfully received server data from Smithery SDK"),V(`Server data: ${JSON.stringify(a,null,2)}`),a}catch(a){throw a instanceof w0?(V(`SDK validation error: ${a.pretty()}`),V(JSON.stringify(a.rawValue)),a):a instanceof S0?(V(`Unauthorized: ${a.message}`),a):a instanceof E0?(V(`Server error: ${a.message}`),a):a instanceof Error?(V(`Unknown error: ${a.message}`),a):new Error(`Failed to resolve package: ${String(a)}`)}},Yie=async(t,e,r)=>{let n=Bm();V(`Fetching connection for ${t} from registry at ${n}`),V(`Connection config provided (keys: ${Object.keys(e).join(", ")})`);try{let i={connectionType:"stdio",config:e};V(`Sending connection request for ${t}`),V(`Making POST request to ${n}/servers/${t}`);let a={"Content-Type":"application/json"};r&&(a.Authorization=`Bearer ${r}`);let s=await Pl(`${n}/servers/${t}`,{method:"POST",headers:a,body:JSON.stringify(i)});if(V(`Response status: ${s.status}`),!s.ok){let c=await s.text();throw V(`Error response: ${c}`),new Error(`Registry request failed with status ${s.status}: ${c}`)}V("Successfully received connection data from registry");let o=await s.json();if(V(`Connection response received (success: ${o.success})`),!o.success||!o.result)throw new Error("Invalid registry response format");return iO.parse(o.result)}catch(i){throw V(`Connection fetch error: ${i instanceof Error?i.message:String(i)}`),i instanceof Error?new Error(`Failed to fetch server connection: ${i.message}`):i}},Qie=async(t,e,r)=>{let n=Bm();V(`Getting user config for ${t} from registry at ${n}`);try{let i={"Content-Type":"application/json",Authorization:`Bearer ${e}`},a=new URL(`${n}/config/${t}`);r&&a.searchParams.set("profile",r);let s=await Pl(a.toString(),{method:"GET",headers:i});if(V(`Response status: ${s.status}`),s.status===404)return V("No saved config found"),null;if(!s.ok){let c=await s.text();throw V(`Error response: ${c}`),new Error(`Config get request failed with status ${s.status}: ${c}`)}V("Successfully retrieved user config from registry");let o=await s.json();return V(`Config retrieved (keys: ${Object.keys(o.config).join(", ")})`),o.config}catch(i){throw V(`Config get error: ${i instanceof Error?i.message:String(i)}`),i instanceof Error?new Error(`Failed to get user config: ${i.message}`):i}},Zie=async(t,e,r)=>{let n=Bm();V(`Saving user config for ${t} to registry at ${n}`),V(`Config to save (keys: ${Object.keys(e).join(", ")})`);try{let i={config:e};V(`Sending config save request for ${t}`);let a={"Content-Type":"application/json",Authorization:`Bearer ${r}`},s=await Pl(`${n}/config/${t}`,{method:"PUT",headers:a,body:JSON.stringify(i)});if(V(`Response status: ${s.status}`),!s.ok){let c=await s.text();throw V(`Error response: ${c}`),new Error(`Config save request failed with status ${s.status}: ${c}`)}V("Successfully saved user config to registry");let o=await s.json();if(V(`Config save response received (success: ${o.success})`),!o.success)throw new Error(o.message||"Failed to save user configuration")}catch(i){throw V(`Config save error: ${i instanceof Error?i.message:String(i)}`),i instanceof Error?new Error(`Failed to save user config: ${i.message}`):i}},yO=async(t,e)=>{let r=Bm();V(`Searching servers for term: ${t}`);try{let n=await Pl(`${r}/servers?q=${encodeURIComponent(t)}&pageSize=10`,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Search failed: ${n.statusText}`);let i=await n.json();return V(`Search returned ${i.servers?.length||0} servers`),i.servers||[]}catch(n){throw V(`Search error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?new Error(`Failed to search servers: ${n.message}`):n}},Xie=async(t,e)=>{let r=Bm();V(`Validating user config for ${t}`);try{let n=await Pl(`${r}/config/${t}/validate`,{method:"GET",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Config validation failed: ${n.statusText}`);let i=await n.json();return V(`Config validation result: ${JSON.stringify(i,null,2)}`),i}catch(n){throw V(`Config validation error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?new Error(`Failed to validate config: ${n.message}`):n}};var wO=ye(at(),1),rae=ye(ti(),1);Lu();async function fit(t,e){if(!t.configSchema?.properties)return e||{};let r=new Set(t.configSchema.required||[]),n={},i=[],a=[];for(let[s,o]of Object.entries(t.configSchema.properties)){let c=o,l=e?.[s];try{let d=l===""?void 0:l,f=d!==void 0?d:c.default;if(r.has(s)&&f===void 0){i.push(s);continue}if(f===void 0)continue;n[s]=mit(f,c.type)}catch(d){let f=d instanceof Error?d.message:"Unknown validation error";a.push({field:s,error:f}),r.has(s)&&i.push(s)}}if(a.length>0||i.length>0){let s=[];throw i.length>0&&s.push(`Missing required config values: ${i.join(", ")}`),a.length>0&&s.push("Validation errors:",...a.map(({field:o,error:c})=>` ${o}: ${c}`)),new Error(s.join(`
580
- `))}return n}function mit(t,e){if(!e)return t;let r=n=>{throw new Error(`Invalid ${n} value: ${JSON.stringify(t)}`)};switch(e){case"boolean":{let n=String(t).toLowerCase();if(n==="true")return!0;if(n==="false")return!1;r("boolean");break}case"number":{let n=Number(t);if(!Number.isNaN(n))return n;r("number");break}case"integer":{let n=Number.parseInt(String(t),10);if(!Number.isNaN(n))return n;r("integer");break}case"string":return String(t);case"array":return Array.isArray(t)?t:String(t).split(",").map(n=>n.trim());default:return t}}async function N0(t,e){if(!t.configSchema?.properties)return{};let r=e||{},n=t.configSchema.properties,i=await Object.entries(n).reduce(async(a,[s,o])=>{let c=await a,{description:l,default:d,type:f}=o;if(r[s]!==void 0)return{...c,[s]:r[s]};let m=await hit(s,{description:l,default:d,type:f},new Set(t.configSchema.required||[]));return{...c,[s]:m!==void 0?m:d}},Promise.resolve({}));try{return await fit(t,i)}catch(a){let s=a instanceof Error?a.message:"Unknown configuration error";return console.error(wO.default.red("Configuration error:"),s),i}}async function hit(t,e,r){let n=r.has(t)?wO.default.red(" (required)"):" (optional)",i=t.toLowerCase().includes("key")?"password":e.type==="boolean"?"confirm":e.type==="array"?"input":e.type==="number"||e.type==="integer"?"number":"input",{value:a}=await rae.default.prompt([{type:i,name:"value",message:`${e.description||`Enter value for ${t}`}${n}${e.type==="array"?" (comma-separated)":""}`,default:e.default,mask:i==="password"?"*":void 0,validate:s=>r.has(t)&&!s?!1:e.type==="number"||e.type==="integer"?!Number.isNaN(Number(s))||"Please enter a valid number":!0}]);return a}function nae(t){if(t.startsWith("@")&&t.includes("/")){let e=t.indexOf("/");return t.substring(e+1)}return t}function iae(t,e,r,n,i,a){if(i&&a&&vit(i,a))return git(t,e,r,n,i);let s=["-y","@smithery/cli@latest","run",t];if(r&&s.push("--key",r),n&&s.push("--profile",n),!(Object.keys(e).length===0)){let c=JSON.stringify(JSON.stringify(e));s.push("--config",c)}return process.platform==="win32"?{command:"cmd",args:["/c","npx",...s]}:{command:"npx",args:s}}function vit(t,e){try{let r=e.connections?.some(a=>a.type==="http"&&"deploymentUrl"in a);if(!r||!e.remote)return!1;let n=[];return r&&n.push("http"),e.connections?.some(a=>a.type==="stdio")&&n.push("stdio"),tae(t,n)==="http"}catch{return!1}}function git(t,e,r,n,i){let a=`https://server.smithery.ai/${t}/mcp`,s=new URL(a),c=(i?Qi(i):null)?.supportsOAuth||!1;if(r&&!c&&s.searchParams.set("api_key",r),n&&s.searchParams.set("profile",n),Object.keys(e).length>0){let l=JSON.stringify(e);s.searchParams.set("config",Buffer.from(l).toString("base64"))}return{type:"http",url:s.toString(),headers:{}}}process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function bit(){let t=new C9({name:"smithery-cli",version:"1.0.0"},{capabilities:{}});return t.setNotificationHandler(SD,e=>{da(`[server log]: ${e.params.data}`)}),t}async function yit(t){let e=t.getServerCapabilities()||{},r=[],n=[];return e.resources&&n.push(t.listResources().then(({resources:i})=>{i.forEach(a=>{r.push({type:"resource",value:a})})})),e.tools&&n.push(t.listTools().then(({tools:i})=>{i.forEach(a=>{r.push({type:"tool",value:a})})})),e.prompts&&n.push(t.listPrompts().then(({prompts:i})=>{i.forEach(a=>{r.push({type:"prompt",value:a})})})),await Promise.all(n),r}async function Dit(t){let e=ri("Connecting to server...").start(),r=null;try{r=await bit(),await r.connect(t);let n=await yit(r);e.succeed(`Connected, server capabilities: ${Object.keys(r.getServerCapabilities()||{}).join(", ")}`);let i=async()=>{console.error("Closing connection..."),r&&(await r.close(),r=null),process.exit(0)};for(process.on("SIGINT",i),process.on("SIGTERM",i),process.on("beforeExit",i);;){let{primitive:a}=await _O.default.prompt([{name:"primitive",type:"list",message:"Pick a primitive",choices:[...n.map(c=>({name:go.default.bold(`${c.type}(${c.value.name})`),value:c,description:c.value.description})),{name:go.default.red("Exit"),value:{type:"exit"}}]}]);if(a.type==="exit"){await i();return}let s,o;if(a.type==="resource")o=ri(`Reading resource ${a.value.uri}...`).start(),s=await r.readResource({uri:a.value.uri}).catch(c=>{o?.fail(c.message),o=void 0});else if(a.type==="tool"){console.log(go.default.cyan(`
580
+ `))}return n}function mit(t,e){if(!e)return t;let r=n=>{throw new Error(`Invalid ${n} value: ${JSON.stringify(t)}`)};switch(e){case"boolean":{let n=String(t).toLowerCase();if(n==="true")return!0;if(n==="false")return!1;r("boolean");break}case"number":{let n=Number(t);if(!Number.isNaN(n))return n;r("number");break}case"integer":{let n=Number.parseInt(String(t),10);if(!Number.isNaN(n))return n;r("integer");break}case"string":return String(t);case"array":return Array.isArray(t)?t:String(t).split(",").map(n=>n.trim());default:return t}}async function N0(t,e){if(!t.configSchema?.properties)return{};let r=e||{},n=t.configSchema.properties,i=await Object.entries(n).reduce(async(a,[s,o])=>{let c=await a,{description:l,default:d,type:f}=o;if(r[s]!==void 0)return{...c,[s]:r[s]};let m=await hit(s,{description:l,default:d,type:f},new Set(t.configSchema.required||[]));return{...c,[s]:m!==void 0?m:d}},Promise.resolve({}));try{return await fit(t,i)}catch(a){let s=a instanceof Error?a.message:"Unknown configuration error";return console.error(wO.default.red("Configuration error:"),s),i}}async function hit(t,e,r){let n=r.has(t)?wO.default.red(" (required)"):" (optional, press enter to skip)",i=t.toLowerCase().includes("key")?"password":e.type==="boolean"?"confirm":e.type==="array"?"input":e.type==="number"||e.type==="integer"?"number":"input",{value:a}=await rae.default.prompt([{type:i,name:"value",message:`${e.description||`Enter value for ${t}`}${n}${e.type==="array"?" (comma-separated)":""}`,default:e.default,mask:i==="password"?"*":void 0,validate:s=>r.has(t)&&!s?!1:e.type==="number"||e.type==="integer"?!Number.isNaN(Number(s))||"Please enter a valid number":!0}]);return a}function nae(t){if(t.startsWith("@")&&t.includes("/")){let e=t.indexOf("/");return t.substring(e+1)}return t}function iae(t,e,r,n,i,a){if(i&&a&&vit(i,a))return git(t,e,r,n,i);let s=["-y","@smithery/cli@latest","run",t];if(r&&s.push("--key",r),n&&s.push("--profile",n),!(Object.keys(e).length===0)){let c=JSON.stringify(JSON.stringify(e));s.push("--config",c)}return process.platform==="win32"?{command:"cmd",args:["/c","npx",...s]}:{command:"npx",args:s}}function vit(t,e){try{let r=e.connections?.some(a=>a.type==="http"&&"deploymentUrl"in a);if(!r||!e.remote)return!1;let n=[];return r&&n.push("http"),e.connections?.some(a=>a.type==="stdio")&&n.push("stdio"),tae(t,n)==="http"}catch{return!1}}function git(t,e,r,n,i){let a=`https://server.smithery.ai/${t}/mcp`,s=new URL(a),c=(i?Qi(i):null)?.supportsOAuth||!1;if(r&&!c&&s.searchParams.set("api_key",r),n&&s.searchParams.set("profile",n),Object.keys(e).length>0){let l=JSON.stringify(e);s.searchParams.set("config",Buffer.from(l).toString("base64"))}return{type:"http",url:s.toString(),headers:{}}}process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function bit(){let t=new C9({name:"smithery-cli",version:"1.0.0"},{capabilities:{}});return t.setNotificationHandler(SD,e=>{da(`[server log]: ${e.params.data}`)}),t}async function yit(t){let e=t.getServerCapabilities()||{},r=[],n=[];return e.resources&&n.push(t.listResources().then(({resources:i})=>{i.forEach(a=>{r.push({type:"resource",value:a})})})),e.tools&&n.push(t.listTools().then(({tools:i})=>{i.forEach(a=>{r.push({type:"tool",value:a})})})),e.prompts&&n.push(t.listPrompts().then(({prompts:i})=>{i.forEach(a=>{r.push({type:"prompt",value:a})})})),await Promise.all(n),r}async function Dit(t){let e=ri("Connecting to server...").start(),r=null;try{r=await bit(),await r.connect(t);let n=await yit(r);e.succeed(`Connected, server capabilities: ${Object.keys(r.getServerCapabilities()||{}).join(", ")}`);let i=async()=>{console.error("Closing connection..."),r&&(await r.close(),r=null),process.exit(0)};for(process.on("SIGINT",i),process.on("SIGTERM",i),process.on("beforeExit",i);;){let{primitive:a}=await _O.default.prompt([{name:"primitive",type:"list",message:"Pick a primitive",choices:[...n.map(c=>({name:go.default.bold(`${c.type}(${c.value.name})`),value:c,description:c.value.description})),{name:go.default.red("Exit"),value:{type:"exit"}}]}]);if(a.type==="exit"){await i();return}let s,o;if(a.type==="resource")o=ri(`Reading resource ${a.value.uri}...`).start(),s=await r.readResource({uri:a.value.uri}).catch(c=>{o?.fail(c.message),o=void 0});else if(a.type==="tool"){console.log(go.default.cyan(`
581
581
  Tool: ${a.value.name}`)),console.log(go.default.dim(`Description: ${a.value.description||"No description"}`)),console.log(go.default.cyan(`
582
582
  Input Schema:`)),console.dir(a.value.inputSchema,{depth:null,colors:!0}),console.log(`
583
583
  `);continue}else if(a.type==="prompt"){let c=await wit(a.value.arguments);o=ri(`Using prompt ${a.value.name}...`).start(),s=await r.getPrompt({name:a.value.name,arguments:c}).catch(l=>{o?.fail(l.message),o=void 0})}o&&o.succeed(),s&&(console.dir(s,{depth:null,colors:!0}),console.log(`
584
584
  `))}}catch(n){e.fail(`Failed to connect to server: ${n instanceof Error?n.message:String(n)}`),r&&await r.close(),process.exit(1)}}async function wit(t){return!t||t.length===0?{}:_O.default.prompt(t.map(e=>({type:"text",name:e.name,message:go.default.dim(`${e.required?"* ":""}${e.name}: ${e.description}`)})))}async function sae(t,e){let r=ri(`Resolving ${t}...`).start(),n=null;try{let i=await k0(t,e,"inspect");if(V(`Resolved server package: ${t}`),r.succeed(`Successfully resolved ${t}`),!i.connections?.length)throw new Error("No connection configuration found for server");let a=i.connections[0];V(`Selected connection type: ${a.type}`);let s=await N0(a);V(`Collected Configuration Structure: ${JSON.stringify(Object.keys(s),null,2)}`);let o=g0({});V(`Runtime environment initialized with ${Object.keys(o).length} variables`),n=new Yo({command:"npx",args:["-y","@smithery/cli@latest","run",t,"--config",JSON.stringify(JSON.stringify(s)),...e?["--key",e]:[]],env:o}),V(`Created transport for server: ${t}`),await Dit(n)}catch(i){r.fail(`Failed to inspect ${t}`),i instanceof Error?console.error(go.default.red(`Error: ${i.message}`)):console.error(go.default.red("An unexpected error occurred during inspection")),n&&await n.close(),process.exit(1)}}var Xi=ye(at(),1);yl();Lu();Zn();var oae=ye(ti(),1);import{exec as _it}from"node:child_process";import{promisify as Eit}from"node:util";var xo=Eit(_it);async function Sit(t){if(!t)return!1;try{let e=process.platform,r={claude:"Claude"}[t]||t;if(e==="win32"){let{stdout:n}=await xo(`tasklist /FI "IMAGENAME eq ${r}.exe" /NH`);return n.includes(`${r}.exe`)}else if(e==="darwin"){let{stdout:n}=await xo(`pgrep -x "${r}"`);return!!n.trim()}else if(e==="linux"){let{stdout:n}=await xo(`pgrep -f "${r.toLowerCase()}"`);return!!n.trim()}return!1}catch{return!1}}async function Cit(t){let e={claude:"Claude"}[t]||t;try{let r=process.platform;r==="win32"?await xo(`taskkill /F /IM "${e}.exe" && start "" "${e}.exe"`):r==="darwin"?await xo(`killall "${e}" && open -a "${e}"`):r==="linux"&&await xo(`pkill -f "${e.toLowerCase()}" && ${e.toLowerCase()}`),await new Promise(n=>setTimeout(n,2e3)),r==="win32"?await xo(`start "" "${e}.exe"`):r==="darwin"?await xo(`open -a "${e}"`):r==="linux"&&await xo(e.toLowerCase()),console.log(`${e} has been restarted.`)}catch(r){console.error(`Failed to restart ${e}:`,r)}}async function lg(t){if(!t||!await Sit(t))return!1;let{shouldRestart:r}=await oae.default.prompt([{type:"confirm",name:"shouldRestart",message:`Would you like to restart the ${t} app to apply changes?`,default:!0}]);return r&&(console.log(`Restarting ${t} app...`),await Cit(t)),r}D2();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function sue(t,e,r,n,i){V(`Starting installation of ${t} for client ${e}`),V(`Resolving package: ${t}`);try{V("Checking analytics consent..."),await oie(),V("Analytics consent check completed")}catch(s){console.warn(Xi.default.yellow("[Analytics] Failed to check consent:"),s instanceof Error?s.message:String(s)),V(`Analytics consent check error details: ${JSON.stringify(s)}`)}let a=ri(`Resolving ${t}...`).start();try{V("Awaiting server resolution...");let s=await k0(t,n,"install");if(V(`Server resolved successfully: ${s.qualifiedName}`),a.succeed(`Successfully resolved ${t}`),V("Choosing connection type..."),!s.connections?.length)throw new Error("No connection configuration found for server");let o=s.connections[0];V(`Selected connection: ${JSON.stringify(o,null,2)}`),await Mee(o),await $ee(o);let c=n;iA(s)&&!n&&(a.stop(),c=await Hi()),Uee(s);let l=r||{};if(c&&Object.keys(r).length===0)try{V("Checking existing configuration...");let b=ri("Validating configuration...").start(),x=await Xie(t,c);b.stop(),x.isComplete?(Object.keys(x.fieldSchemas).length>0?(console.log(`${Xi.default.green("\u25CF")} ${Xi.default.dim("Using existing configuration from default profile")}`),console.log(Xi.default.dim(`${Xi.default.cyan("\u2192 Update configuration")} at: https://smithery.ai/account/profiles?server=${t}`))):console.log(`${Xi.default.cyan("\u25CB")} No configuration required`),l={}):(console.log(Xi.default.yellow("!"),`Missing config: ${x.missingFields.join(", ")}`),l=await N0(o,r||{}))}catch(b){V(`Config validation failed: ${b instanceof Error?b.message:String(b)}`),l=await N0(o,r||{})}else Object.keys(r).length===0&&(l=await N0(o,r||{}));V(`Config values: ${JSON.stringify(l,null,2)}`);let d=!1;if(c&&Object.keys(l).length>0){V("Saving configuration to smithery...");try{await Zie(t,l,c),V("Configuration successfully saved to smithery"),d=!0}catch(b){V(`Failed to save config to smithery: ${b instanceof Error?b.message:String(b)}`),console.warn(Xi.default.yellow("Warning: Could not save configuration. Config will be saved locally."))}}V("Formatting server configuration...");let f=iae(t,d?{}:l,c,i,e,s);V(`Formatted server config: ${JSON.stringify(f,null,2)}`),V("Normalizing server ID...");let m=nae(t);V(`Normalized server ID: ${m}`);let g=Qi(e);if(g.installType==="command"){V("Command-based client detected, executing command directly...");let b={mcpServers:{[m]:f}};mP(b,g),V("Command executed successfully")}else{V(`Reading configuration for client: ${e}`);let b=Ll(e);V("Updating client configuration..."),b.mcpServers[m]=f,V("Writing updated configuration..."),y2(b,e),V("Configuration successfully written")}console.log(Xi.default.green(`\u2713 ${t} successfully installed for ${e}`)),V("Prompting for client restart..."),await lg(e),V("Installation process completed"),process.exit(0)}catch(s){a.fail(`Failed to install ${t}`),V(`Installation error: ${s instanceof Error?s.stack:JSON.stringify(s)}`),s instanceof Error?console.error(Xi.default.red(`Error: ${s.message}`)):console.error(Xi.default.red("An unexpected error occurred during installation")),process.exit(1)}}var Qu=ye(at(),1);Lu();D2();async function oue(t,e){switch(t){case"clients":console.log(Qu.default.bold("Available clients:")),ms.forEach(r=>{console.log(` ${Qu.default.green(r)}`)});break;case"servers":{if(Qi(e).installType==="command"){console.log(Qu.default.yellow(`Listing servers is currently not supported for ${e}`));return}let n=Ll(e),i=Object.keys(n.mcpServers);if(i?.length>0)console.log(Qu.default.bold(`Installed servers for ${e}:`)),i.sort().forEach(a=>{console.log(`${Qu.default.green(a)}`)});else{let a=`No installed servers found for ${e}`;console.log(`${Qu.default.red(a)}`)}break}default:console.log(Qu.default.yellow("Please specify what to list. Available options:")),console.log(" clients List available clients"),console.log(" servers List installed servers"),process.exit(1)}}var Zu=ye(at(),1);Pp();Zn();Jy();import{spawn as xct}from"node:child_process";async function uue(t,e,r=Hj){return new Promise((n,i)=>{let[a,...s]=t.split(" "),o=xct(a,s,{stdio:["inherit","pipe","pipe"],env:{...process.env,PORT:e}}),c,l=setTimeout(()=>{c||i(new Error("Timeout: Could not detect port from subprocess output"))},3e4),d=f=>{let m=f.toString();if(process.stdout.write(m),!c){let g=r(m);g&&(c=g,clearTimeout(l),n({process:o,detectedPort:c}))}};o.stdout?.on("data",d),o.stderr?.on("data",f=>{let m=f.toString();if(process.stderr.write(m),!c){let g=r(m);g&&(c=g,clearTimeout(l),n({process:o,detectedPort:c}))}}),o.on("error",f=>{clearTimeout(l),i(f)}),o.on("exit",f=>{clearTimeout(l),f!==0&&!c&&i(new Error(`Command exited with code ${f}`))})})}async function cue(t){try{!t.command&&!t.port&&(console.error(Zu.default.red("\u274C Port is required when no command is specified.")),console.error(Zu.default.yellow("Use --port <port> to specify the port where your service is running.")),process.exit(1));let e=t.port||Hs.toString(),r;if(t.command){let{process:a,detectedPort:s}=await uue(t.command,e);r=a,e=s}let{listener:n}=await Ua(e,t.apiKey),i=async()=>{console.log(Zu.default.yellow(`
585
585
  \u{1F44B} Shutting down playground...`)),r&&await _6({childProcess:r,processName:"server"});try{await n.close(),da(Zu.default.green("Tunnel closed"))}catch{da(Zu.default.yellow("Tunnel already closed"))}};S6({cleanupFn:i,processName:"playground"}),r&&r.on("exit",a=>{a!==0&&(console.log(Zu.default.yellow(`
586
- Subprocess exited with code ${a}`)),i().then(()=>process.exit(0)))})}catch(e){console.error(Zu.default.red("\u274C Playground failed:"),e),process.exit(1)}}rc();var hP=ye(ug(),1);Zn();import{spawn as Dct}from"node:child_process";import*as Un from"node:fs";import*as lue from"node:os";import*as Ml from"node:path";var wct="server.mcpb",_ct=".cache-meta.json";function Ect(t){return Ml.join(lue.homedir(),".smithery","cache","servers",t)}function pue(t){return Ml.join(dx(t),_ct)}function dx(t){return Ml.join(Ect(t),"current")}function Sct(t){let e=dx(t),r=Ml.join(e,"manifest.json");return Un.existsSync(r)}async function Cct(t,e){let r=pue(t);if(!Un.existsSync(r))return V(`No cache metadata found for ${t}`),!0;try{V(`Checking for updates: ${e}`);let n=await(0,hP.default)(e,{method:"HEAD"});if(!n.ok)return V(`HEAD request failed: ${n.status} ${n.statusText}`),!0;let i=n.headers.get("etag"),a=n.headers.get("last-modified"),s=JSON.parse(Un.readFileSync(r,"utf-8"));return i&&s.etag?s.etag===i?(V(`Bundle ${t} is up-to-date (ETag: ${i})`),!1):(V(`Bundle ${t} has updates (ETag changed: ${s.etag} \u2192 ${i})`),!0):a&&s.lastModified?s.lastModified===a?(V(`Bundle ${t} is up-to-date (Last-Modified: ${a})`),!1):(V(`Bundle ${t} has updates (Last-Modified changed)`),!0):(V("No cache headers found, will download bundle"),!0)}catch(n){return V(`Error checking for updates: ${n}`),!0}}async function Fct(t,e){V(`Downloading bundle from: ${t}`);let r=await(0,hP.default)(t);if(!r.ok)throw new Error(`Failed to download bundle: ${r.status} ${r.statusText}`);let n=Buffer.from(await r.arrayBuffer());return Un.writeFileSync(e,n),V(`Bundle downloaded to: ${e}`),{etag:r.headers.get("etag"),lastModified:r.headers.get("last-modified")}}async function Act(t,e){return V(`Extracting bundle to: ${e}`),new Promise((r,n)=>{let i=Dct("npx",["-y","@anthropic-ai/mcpb","unpack",t,e],{stdio:"pipe"}),a="";i.stderr?.on("data",s=>{a+=s.toString()}),i.on("close",s=>{s===0?(V("Bundle extracted successfully"),r()):n(new Error(`Failed to extract bundle: ${a}`))}),i.on("error",s=>{n(new Error(`Failed to spawn mcpb CLI: ${s.message}`))})})}async function Oct(t,e){let r=dx(t);Un.mkdirSync(r,{recursive:!0});let n=Ml.join(r,wct),{etag:i,lastModified:a}=await Fct(e,n);await Act(n,r);let s={etag:i,lastModified:a,cachedAt:new Date().toISOString(),bundleUrl:e},o=pue(t);return Un.writeFileSync(o,JSON.stringify(s,null,2)),V(`Cache metadata saved for ${t}`),Un.unlinkSync(n),r}async function due(t,e){let r=dx(t);if(Sct(t)){if(V(`Bundle ${t} found in cache`),!await Cct(t,e))return V(`Using cached bundle for ${t}`),r;V(`Updating bundle ${t}...`)}else V(`Bundle ${t} not found, downloading...`);return await Oct(t,e)}function fue(t){let e=Ml.join(t,"manifest.json");if(!Un.existsSync(e))throw new Error(`Bundle manifest not found: ${e}`);let n=JSON.parse(Un.readFileSync(e,"utf-8")).server?.mcp_config;if(!n?.command)throw new Error("Bundle manifest missing server.mcp_config.command");let i=(n.args||[]).map(a=>a.replace(/\$\{__dirname\}/g,t));return{command:n.command,args:i}}function mue(t){let e=[];function r(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function n(i,a){if(Array.isArray(a)){for(let c=0;c<a.length;c++)n([...i,String(c)],a[c]);return}if(r(a)){for(let[c,l]of Object.entries(a))n([...i,c],l);return}let s=i.join("."),o;switch(typeof a){case"string":o=a;break;case"number":case"boolean":o=String(a);break;default:o=JSON.stringify(a)}e.push(`${s}=${o}`)}if(r(t))for(let[i,a]of Object.entries(t))n([i],a);return e}async function hue(t,e,r,n,i){let a=e;if(a.command&&a.args)return{command:a.command,args:a.args,env:a.env||{},qualifiedName:t.qualifiedName};if(a.bundleUrl){U("[Runner] Bundle connection detected, downloading...");let o=await due(t.qualifiedName,a.bundleUrl),{command:c,args:l}=fue(o),d={...r};if(n){U("[Runner] Fetching saved config for bundle...");let m=await Qie(t.qualifiedName,n,i);m&&(d={...m,...r},U("[Runner] Merged saved config with runtime config"))}let f=mue(d);return{command:c,args:[...l,...f],env:a.env||{},qualifiedName:t.qualifiedName}}U("[Runner] Fetching stdio connection details from registry...");let s=await Yie(t.qualifiedName,r,n);if(!s||"type"in s)throw new Error("Failed to get valid stdio server configuration");return{command:s.command,args:s.args||[],env:s.env||{},qualifiedName:t.qualifiedName}}var G2=ye(at(),1),Ufe=ye(xP(),1),sI=ye(aI(),1);Pp();rc();var Vfe=async(t,e,r,n,i,a={})=>{let s=!1,o=!1,c=null,l=null,d,f=new Map,m=a.port||6969,g=(0,sI.default)();g.use((0,Ufe.default)()),g.use(sI.default.json());let b=(q,I)=>(U(`[Local Playground] ${I}: ${q.message}`),q),x=async()=>{U("[Local Playground] Received exit signal, initiating shutdown..."),await T(),process.exit(0)},y=tc(x),_=ec(async q=>{c&&await c.send(q)},()=>o);g.post("/mcp",async(q,I)=>{try{if(y.updateActivity(),!o||!c){I.status(503).json({error:"Server not ready",code:-32603});return}let z=q.body;if(!z){I.status(400).json({error:"Invalid JSON-RPC message",code:-32600});return}if(U(`[Local Playground] Received HTTP request: ${JSON.stringify(z)}`),"id"in z&&z.id!==null&&z.id!==void 0){let L=String(z.id);await c.send(z);let H=await new Promise((ie,se)=>{f.set(L,{resolve:ie,reject:se}),setTimeout(()=>{f.has(L)&&(f.delete(L),se(new Error("Request timeout")))},3e4)});I.json(H)}else await c.send(z),I.status(200).json({success:!0})}catch(z){U(`[Local Playground] Error handling HTTP request: ${z}`),I.status(500).json({error:z instanceof Error?z.message:"Internal server error",code:-32603})}}),g.get("/health",(q,I)=>{I.json({status:o?"ready":"not ready",uptime:process.uptime()})});let S=async()=>{U("[Local Playground] Starting STDIO process setup...");let q=g0(r),I=t,z=e;I==="npx"&&process.platform==="win32"&&(U("[Local Playground] Windows platform detected, using cmd /c for npx"),z=["/c","npx",...z],I="cmd"),U(`[Local Playground] Executing STDIO process: ${JSON.stringify({command:I,args:z})}`);try{c=new Yo({command:I,args:z,env:q})}catch(L){throw U("For more help, see: https://smithery.ai/docs/faq/users"),L}c.onmessage=L=>{try{if("method"in L&&!(L.method==="ping"||L.method==="pong")&&y.updateActivity(),U(`[Local Playground] Received STDIO message: ${JSON.stringify(L)}`),"error"in L&&L.error&&gs(L),"id"in L&&L.id!==null&&L.id!==void 0){let H=String(L.id),ie=f.get(H);if(ie){f.delete(H),ie.resolve(L);return}}U(`[Local Playground] STDIO output: ${JSON.stringify(L)}`)}catch(H){b(H,"Error handling STDIO message")}},c.onclose=()=>{U("[Local Playground] STDIO process terminated"),o&&!s&&(U("[Local Playground] Process terminated unexpectedly"),x().catch(L=>{U(`[Local Playground] Error during exit cleanup: ${L}`),process.exit(1)}))},c.onerror=L=>{U(`[Local Playground] STDIO process error: ${L.message}`)},await c.start(),o=!0,U("[Local Playground] STDIO transport established"),_.start(),y.start()},A=async()=>new Promise((q,I)=>{l=g.listen(m,z=>{z?I(z):(U(`[Local Playground] HTTP server listening on port ${m}`),q())})}),T=async()=>{if(s){U("[Local Playground] Cleanup already in progress, skipping...");return}U("[Local Playground] Starting cleanup process..."),s=!0,_.stop(),y.stop();for(let[q,{reject:I}]of f)I(new Error("Server shutting down"));if(f.clear(),d)try{U("[Local Playground] Closing tunnel..."),await d.close(),U("[Local Playground] Tunnel closed successfully")}catch(q){U(`[Local Playground] Error closing tunnel: ${q}`)}if(l)try{U("[Local Playground] Closing HTTP server..."),await new Promise(q=>{l.close(()=>{U("[Local Playground] HTTP server closed"),q()})})}catch(q){U(`[Local Playground] Error closing HTTP server: ${q}`)}if(c){try{U("[Local Playground] Closing STDIO transport..."),await Promise.race([c.close(),new Promise((q,I)=>setTimeout(()=>I(new Error("Transport close timeout")),Vo))]),U("[Local Playground] STDIO transport closed successfully")}catch(q){U(`[Local Playground] Error closing STDIO transport: ${q}`)}c=null}U("[Local Playground] Cleanup completed"),console.log(`
586
+ Subprocess exited with code ${a}`)),i().then(()=>process.exit(0)))})}catch(e){console.error(Zu.default.red("\u274C Playground failed:"),e),process.exit(1)}}rc();var hP=ye(ug(),1);Zn();import{spawn as Dct}from"node:child_process";import*as Un from"node:fs";import*as lue from"node:os";import*as Ml from"node:path";var wct="server.mcpb",_ct=".metadata.json";function Ect(t){return Ml.join(lue.homedir(),".smithery","cache","servers",t)}function pue(t){return Ml.join(dx(t),_ct)}function dx(t){return Ml.join(Ect(t),"current")}function Sct(t){let e=dx(t),r=Ml.join(e,"manifest.json");return Un.existsSync(r)}async function Cct(t,e){let r=pue(t);if(!Un.existsSync(r))return V(`No cache metadata found for ${t}`),!0;try{V(`Checking for updates: ${e}`);let n=await(0,hP.default)(e,{method:"HEAD"});if(!n.ok)return V(`HEAD request failed: ${n.status} ${n.statusText}`),!0;let i=n.headers.get("etag"),a=n.headers.get("last-modified"),s=JSON.parse(Un.readFileSync(r,"utf-8"));return i&&s.etag?s.etag===i?(V(`Bundle ${t} is up-to-date (ETag: ${i})`),!1):(V(`Bundle ${t} has updates (ETag changed: ${s.etag} \u2192 ${i})`),!0):a&&s.lastModified?s.lastModified===a?(V(`Bundle ${t} is up-to-date (Last-Modified: ${a})`),!1):(V(`Bundle ${t} has updates (Last-Modified changed)`),!0):(V("No cache headers found, will download bundle"),!0)}catch(n){return V(`Error checking for updates: ${n}`),!0}}async function Fct(t,e){V(`Downloading bundle from: ${t}`);let r=await(0,hP.default)(t);if(!r.ok)throw new Error(`Failed to download bundle: ${r.status} ${r.statusText}`);let n=Buffer.from(await r.arrayBuffer());return Un.writeFileSync(e,n),V(`Bundle downloaded to: ${e}`),{etag:r.headers.get("etag"),lastModified:r.headers.get("last-modified")}}async function Act(t,e){return V(`Extracting bundle to: ${e}`),new Promise((r,n)=>{let i=Dct("npx",["-y","@anthropic-ai/mcpb","unpack",t,e],{stdio:"pipe"}),a="";i.stderr?.on("data",s=>{a+=s.toString()}),i.on("close",s=>{s===0?(V("Bundle extracted successfully"),r()):n(new Error(`Failed to extract bundle: ${a}`))}),i.on("error",s=>{n(new Error(`Failed to spawn mcpb CLI: ${s.message}`))})})}async function Oct(t,e){let r=dx(t);Un.mkdirSync(r,{recursive:!0});let n=Ml.join(r,wct),{etag:i,lastModified:a}=await Fct(e,n);await Act(n,r);let s={etag:i,lastModified:a,cachedAt:new Date().toISOString(),bundleUrl:e},o=pue(t);return Un.writeFileSync(o,JSON.stringify(s,null,2)),V(`Cache metadata saved for ${t}`),Un.unlinkSync(n),r}async function due(t,e){let r=dx(t);if(Sct(t)){if(V(`Bundle ${t} found in cache`),!await Cct(t,e))return V(`Using cached bundle for ${t}`),r;V(`Updating bundle ${t}...`)}else V(`Bundle ${t} not found, downloading...`);return await Oct(t,e)}function fue(t){let e=Ml.join(t,"manifest.json");if(!Un.existsSync(e))throw new Error(`Bundle manifest not found: ${e}`);let n=JSON.parse(Un.readFileSync(e,"utf-8")).server?.mcp_config;if(!n?.command)throw new Error("Bundle manifest missing server.mcp_config.command");let i=(n.args||[]).map(a=>a.replace(/\$\{__dirname\}/g,t));return{command:n.command,args:i}}function mue(t){let e=[];function r(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function n(i,a){if(Array.isArray(a)){for(let c=0;c<a.length;c++)n([...i,String(c)],a[c]);return}if(r(a)){for(let[c,l]of Object.entries(a))n([...i,c],l);return}let s=i.join("."),o;switch(typeof a){case"string":o=a;break;case"number":case"boolean":o=String(a);break;default:o=JSON.stringify(a)}e.push(`${s}=${o}`)}if(r(t))for(let[i,a]of Object.entries(t))n([i],a);return e}async function hue(t,e,r,n,i){let a=e;if(a.command&&a.args)return{command:a.command,args:a.args,env:a.env||{},qualifiedName:t.qualifiedName};if(a.bundleUrl){U("[Runner] Bundle connection detected, downloading...");let o=await due(t.qualifiedName,a.bundleUrl),{command:c,args:l}=fue(o),d={...r};if(n){U("[Runner] Fetching saved config for bundle...");let m=await Qie(t.qualifiedName,n,i);m&&(d={...m,...r},U("[Runner] Merged saved config with runtime config"))}let f=mue(d);return{command:c,args:[...l,...f],env:a.env||{},qualifiedName:t.qualifiedName}}U("[Runner] Fetching stdio connection details from registry...");let s=await Yie(t.qualifiedName,r,n);if(!s||"type"in s)throw new Error("Failed to get valid stdio server configuration");return{command:s.command,args:s.args||[],env:s.env||{},qualifiedName:t.qualifiedName}}var G2=ye(at(),1),Ufe=ye(xP(),1),sI=ye(aI(),1);Pp();rc();var Vfe=async(t,e,r,n,i,a={})=>{let s=!1,o=!1,c=null,l=null,d,f=new Map,m=a.port||6969,g=(0,sI.default)();g.use((0,Ufe.default)()),g.use(sI.default.json());let b=(q,I)=>(U(`[Local Playground] ${I}: ${q.message}`),q),x=async()=>{U("[Local Playground] Received exit signal, initiating shutdown..."),await T(),process.exit(0)},y=tc(x),_=ec(async q=>{c&&await c.send(q)},()=>o);g.post("/mcp",async(q,I)=>{try{if(y.updateActivity(),!o||!c){I.status(503).json({error:"Server not ready",code:-32603});return}let z=q.body;if(!z){I.status(400).json({error:"Invalid JSON-RPC message",code:-32600});return}if(U(`[Local Playground] Received HTTP request: ${JSON.stringify(z)}`),"id"in z&&z.id!==null&&z.id!==void 0){let L=String(z.id);await c.send(z);let H=await new Promise((ie,se)=>{f.set(L,{resolve:ie,reject:se}),setTimeout(()=>{f.has(L)&&(f.delete(L),se(new Error("Request timeout")))},3e4)});I.json(H)}else await c.send(z),I.status(200).json({success:!0})}catch(z){U(`[Local Playground] Error handling HTTP request: ${z}`),I.status(500).json({error:z instanceof Error?z.message:"Internal server error",code:-32603})}}),g.get("/health",(q,I)=>{I.json({status:o?"ready":"not ready",uptime:process.uptime()})});let S=async()=>{U("[Local Playground] Starting STDIO process setup...");let q=g0(r),I=t,z=e;I==="npx"&&process.platform==="win32"&&(U("[Local Playground] Windows platform detected, using cmd /c for npx"),z=["/c","npx",...z],I="cmd"),U(`[Local Playground] Executing STDIO process: ${JSON.stringify({command:I,args:z})}`);try{c=new Yo({command:I,args:z,env:q})}catch(L){throw U("For more help, see: https://smithery.ai/docs/faq/users"),L}c.onmessage=L=>{try{if("method"in L&&!(L.method==="ping"||L.method==="pong")&&y.updateActivity(),U(`[Local Playground] Received STDIO message: ${JSON.stringify(L)}`),"error"in L&&L.error&&gs(L),"id"in L&&L.id!==null&&L.id!==void 0){let H=String(L.id),ie=f.get(H);if(ie){f.delete(H),ie.resolve(L);return}}U(`[Local Playground] STDIO output: ${JSON.stringify(L)}`)}catch(H){b(H,"Error handling STDIO message")}},c.onclose=()=>{U("[Local Playground] STDIO process terminated"),o&&!s&&(U("[Local Playground] Process terminated unexpectedly"),x().catch(L=>{U(`[Local Playground] Error during exit cleanup: ${L}`),process.exit(1)}))},c.onerror=L=>{U(`[Local Playground] STDIO process error: ${L.message}`)},await c.start(),o=!0,U("[Local Playground] STDIO transport established"),_.start(),y.start()},A=async()=>new Promise((q,I)=>{l=g.listen(m,z=>{z?I(z):(U(`[Local Playground] HTTP server listening on port ${m}`),q())})}),T=async()=>{if(s){U("[Local Playground] Cleanup already in progress, skipping...");return}U("[Local Playground] Starting cleanup process..."),s=!0,_.stop(),y.stop();for(let[q,{reject:I}]of f)I(new Error("Server shutting down"));if(f.clear(),d)try{U("[Local Playground] Closing tunnel..."),await d.close(),U("[Local Playground] Tunnel closed successfully")}catch(q){U(`[Local Playground] Error closing tunnel: ${q}`)}if(l)try{U("[Local Playground] Closing HTTP server..."),await new Promise(q=>{l.close(()=>{U("[Local Playground] HTTP server closed"),q()})})}catch(q){U(`[Local Playground] Error closing HTTP server: ${q}`)}if(c){try{U("[Local Playground] Closing STDIO transport..."),await Promise.race([c.close(),new Promise((q,I)=>setTimeout(()=>I(new Error("Transport close timeout")),Vo))]),U("[Local Playground] STDIO transport closed successfully")}catch(q){U(`[Local Playground] Error closing STDIO transport: ${q}`)}c=null}U("[Local Playground] Cleanup completed"),console.log(`
587
587
 
588
588
  ${G2.default.rgb(234,88,12)("Thanks for using Smithery Local Playground!")}
589
589
  ${G2.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")}
@@ -598,7 +598,7 @@ ${G2.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")}
598
598
  ${sh.default.rgb(234,88,12)("Thanks for using Smithery Uplink!")}
599
599
  ${sh.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")}
600
600
 
601
- `)};return process.on("SIGINT",g),process.on("SIGTERM",g),process.on("beforeExit",g),process.on("exit",()=>{U("[Uplink Runner] Final cleanup on exit")}),process.stdin.on("end",()=>{U("[Uplink Runner] STDIN closed (client disconnected)"),g().catch(A=>{U(`[Uplink Runner] Error during stdin close cleanup: ${A}`),process.exit(1)})}),process.stdin.on("error",A=>{U(`[Uplink Runner] STDIN error: ${A.message}`),g().catch(T=>{U(`[Uplink Runner] Error during stdin error cleanup: ${T}`),process.exit(1)})}),process.stdin.on("data",A=>y(A).catch(T=>m(T,"[Uplink Runner] Error processing message"))),await _(),S};async function cme(t,e,r,n,i){try{let a=await ls();a.success||U(`[Runner] Settings initialization warning: ${a.error}`);let s=await k0(t,r,"run");if(!s)throw new Error(`Could not resolve server: ${t}`);U(`[Runner] Connecting to server: ${JSON.stringify({id:s.qualifiedName,connectionTypes:s.connections.map(c=>c.type)})}`);let o=await n9();await z6t(s,e,o,r,n,i)}catch(a){U(`[Runner] Error: ${a instanceof Error?a.message:a}`),process.exit(1)}}async function z6t(t,e,r,n,i,a){if(!t.connections?.length)throw new Error("No connection configuration found for server");let s=t.connections[0];if(s.type==="http"){if(!s.deploymentUrl)throw new Error("Missing deployment URL");if(!n)throw new Error("API key is required for remote connections");a?.playground?await ume(s.deploymentUrl,n,e,i,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"}):await sme(s.deploymentUrl,n,e,i)}else if(s.type==="stdio"){let o=await hue(t,s,e,n,i);if(a?.playground){if(!n)throw new Error("API key is required for playground connections");await Vfe(o.command,o.args,o.env,o.qualifiedName,n,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"})}else await Wfe(o.command,o.args,o.env,o.qualifiedName,n,r)}else throw new Error(`Unsupported connection type: ${s.type}`)}var v1=ye(at(),1);Lu();D2();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function lme(t,e){try{if(Qi(e).installType==="command"){console.log(v1.default.yellow(`Uninstallation is currently not supported for ${e}`));return}let n=Ll(e);if(!n.mcpServers[t]){console.log(v1.default.red(`${t} is not installed for ${e}`));return}delete n.mcpServers[t],y2(n,e),console.log(v1.default.green(`\u2713 ${t} successfully uninstalled from ${e}`)),await lg(e)}catch(r){r instanceof Error?console.error(v1.default.red(`Error: ${r.message}`)):console.error(v1.default.red("An unexpected error occurred during uninstallation")),process.exit(1)}}Lu();Zn();var mr=ye(at(),1);Lu();async function P7(t,e="Working with"){if(t)return t;console.log(mr.default.cyan("*"),`${e} MCP server`),console.log();let r=(await Promise.resolve().then(()=>ye(ti(),1))).default,n=(await Promise.resolve().then(()=>ye(oh(),1))).default;r.registerPrompt("autocomplete",n);let{client:i}=await r.prompt([{type:"autocomplete",name:"client",message:"Select client:",source:(a,s)=>{let o=ms.filter(c=>c.toLowerCase().includes((s||"").toLowerCase()));return Promise.resolve(o)}}]);return i}function q7(t){ms.includes(t)||(console.error(mr.default.yellow(`Invalid client "${t}". Valid options are: ${ms.join(", ")}`)),process.exit(1))}function bI(t){try{let e=t;e.startsWith("'")&&e.endsWith("'")&&(e=e.slice(1,-1));let r=JSON.parse(e);return typeof r=="string"&&(r=JSON.parse(r)),r}catch(e){let r=e instanceof Error?e.message:String(e);console.error(mr.default.red(`Error parsing config: ${r}`)),process.exit(1)}}async function n4t(){let t=(await Promise.resolve().then(()=>ye(ti(),1))).default,{inputMethod:e}=await t.prompt([{type:"list",name:"inputMethod",message:"How would you like to specify the server?",choices:[{name:"Search for servers",value:"search"},{name:"Enter server id",value:"direct"}]}]);return e}async function i4t(t){let e=(await Promise.resolve().then(()=>ye(ti(),1))).default,{searchTerm:r}=await e.prompt([{type:"input",name:"searchTerm",message:"Search for servers:",validate:n=>n.trim().length>0||"Please enter a search term"}]);try{let n=await Hi(t),i=(await Promise.resolve().then(()=>(yl(),Z5))).default,a=i(`Searching for "${r}"...`).start(),s=await yO(r,n);s.length===0&&(a.fail(`No servers found for "${r}"`),process.exit(0)),a.succeed(`Found ${s.length} server${s.length===1?"":"s"}`),console.log();let o=(await Promise.resolve().then(()=>ye(oh(),1))).default;e.registerPrompt("autocomplete",o);let{serverChoice:c}=await e.prompt([{type:"autocomplete",name:"serverChoice",message:"Select server to install:",source:(l,d)=>{let f=s.filter(m=>m.qualifiedName.toLowerCase().includes((d||"").toLowerCase())||m.displayName?.toLowerCase().includes((d||"").toLowerCase())||m.description?.toLowerCase().includes((d||"").toLowerCase())).map(m=>{let g=m.displayName||m.qualifiedName,b=`${m.useCount.toLocaleString()} tool calls`,x=m.qualifiedName!==g?` \u2022 ${m.qualifiedName}`:"";return{name:`${g} \u2022 ${b}${x}`,value:m.qualifiedName}});return Promise.resolve(f)}}]);return c}catch(n){let i=(await Promise.resolve().then(()=>(yl(),Z5))).default;i().start().fail("Failed to search servers"),console.error(mr.default.red(n instanceof Error?n.message:String(n))),process.exit(1)}}async function a4t(){let t=(await Promise.resolve().then(()=>ye(ti(),1))).default,{serverId:e}=await t.prompt([{type:"input",name:"serverId",message:"Enter server ID:",validate:r=>{let n=r.trim();return n.length===0?"Please enter a server ID":/^[a-zA-Z0-9._/-]+$/.test(n)?!0:"Server ID should only contain letters, numbers, dots, underscores, hyphens, and forward slashes"}}]);return e.trim()}async function gme(t,e,r){if(t)return t;if(console.log(mr.default.cyan("*"),"Installing MCP server for",mr.default.cyan(e)),console.log(),await n4t()==="search")return await i4t(r);{let i=await a4t();return console.log(),i}}async function xme(t,e,r){if(t)return t;console.log(mr.default.cyan("*"),"Uninstalling server from",mr.default.cyan(e)),console.log(),r.length===0&&(console.log(mr.default.yellow(`No servers installed for ${e}`)),process.exit(0));let n=(await Promise.resolve().then(()=>ye(ti(),1))).default,i=(await Promise.resolve().then(()=>ye(oh(),1))).default;n.registerPrompt("autocomplete",i);let{serverName:a}=await n.prompt([{type:"autocomplete",name:"serverName",message:`Select server to uninstall from ${e}:`,source:(s,o)=>{let c=r.filter(l=>l.toLowerCase().includes((o||"").toLowerCase()));return Promise.resolve(c)}}]);return a}async function xI(t){if(t)return t;let r=await(await Promise.resolve().then(()=>ye(ti(),1))).default.prompt([{type:"input",name:"searchTerm",message:"Search for servers:",validate:n=>n.trim().length>0||"Please enter a search term"}]);return console.log(),r.searchTerm}async function bme(t,e){let r=await xI(e);try{for(;;){let n=(await Promise.resolve().then(()=>(yl(),Z5))).default,i=n(`Searching for "${r}"...`).start(),a=await yO(r,t);if(a.length===0){i.fail(`No servers found for "${r}"`);return}i.succeed(`\u2600 ${a.length<10?`Found ${a.length} result${a.length===1?"":"s"}:`:`Showing top (${a.length}) results:`}`),console.log(mr.default.dim(`${mr.default.cyan("\u2192 View more")} at smithery.ai/search?q=${r.replace(/\s+/g,"+")}`)),console.log();let s=(await Promise.resolve().then(()=>ye(ti(),1))).default,o=(await Promise.resolve().then(()=>ye(oh(),1))).default;s.registerPrompt("autocomplete",o);let{selectedServer:c}=await s.prompt([{type:"autocomplete",name:"selectedServer",message:"Select server for details (or search again):",source:(d,f)=>{let m=[{name:mr.default.dim("\u2190 Search again"),value:"__SEARCH_AGAIN__"},{name:mr.default.dim("Exit"),value:"__EXIT__"}],g=a.filter(b=>b.qualifiedName.toLowerCase().includes((f||"").toLowerCase())||b.displayName?.toLowerCase().includes((f||"").toLowerCase())).map(b=>{let x=b.displayName||b.qualifiedName,y=b.useCount>0?mr.default.dim(` (${b.useCount.toLocaleString()} calls/month)`):"";return{name:`${x}${y}`,value:b.qualifiedName}});return Promise.resolve([...m,...g])}}]);if(c==="__EXIT__")return;if(c==="__SEARCH_AGAIN__"){r=await xI();continue}console.log();let l=a.find(d=>d.qualifiedName===c);if(l){let d=l.displayName||l.qualifiedName;console.log(`${mr.default.bold.cyan(d)}`),console.log(`${mr.default.dim("Qualified name:")} ${l.qualifiedName}`),l.description&&console.log(`${mr.default.dim("Description:")} ${l.description}`),console.log(`${mr.default.dim("Usage:")} ${l.useCount.toLocaleString()} calls/month`),console.log(),console.log(mr.default.dim(`Use 'smithery install ${l.qualifiedName}' to install`));let{action:f}=await s.prompt([{type:"list",name:"action",message:"What would you like to do?",choices:[{name:"\u2190 Back to server list",value:"back"},{name:"\u2190 Search again",value:"search"},{name:"Exit",value:"exit"}]}]);if(f==="back")console.log();else if(f==="search")r=await xI();else return}}}catch(n){console.error(mr.default.red("Error searching servers:"),n instanceof Error?n.message:String(n)),process.exit(1)}}var ci=new _B;ci.name("smithery").version("1.4.6").description(`${Fn.default.bold.italic.hex("#ea580c")("SMITHERY CLI")} ${Fn.default.bold.italic.hex("#ea580c")("v1.4.6")} - Manage and run MCP servers`).option("--verbose","Show detailed logs").option("--debug","Show debug logs").hook("preAction",(t,e)=>{let r=t.opts();r.verbose&&Vj(!0),r.debug&&zj(!0)});ci.command("install [server]").description("install a server").option("-c, --client <name>",`Specify the AI client (${ms.join(", ")})`).option("--config <json>","Provide configuration data as JSON (skips prompts)").option("--key <apikey>","Provide an API key").option("--profile <name>","Use a specific profile").action(async(t,e)=>{let r=await P7(e.client,"Install"),n=await gme(t,r,e.key);q7(r);let i=e.config?bI(e.config):{};await sue(n,r,i,e.key,e.profile)});ci.command("uninstall [server]").description("uninstall a server").option("-c, --client <name>",`Specify the AI client (${ms.join(", ")})`).action(async(t,e)=>{let{readConfig:r}=await Promise.resolve().then(()=>(D2(),aue)),n=await P7(e.client,"Uninstall");q7(n);let i=r(n),a=Object.keys(i.mcpServers),s=await xme(t,n,a);await lme(s,n)});ci.command("inspect <server>").description("Inspect server from registry").option("--key <apikey>","Provide an API key").action(async(t,e)=>{await sae(t,await Hi(e.key))});ci.command("run <server>").description("run a server").option("--config <json>","Provide configuration as JSON").option("--key <apikey>","Provide an API key").option("--profile <name>","Use a specific profile").option("--playground","Create playground tunnel and open playground").option("--no-open","Don't automatically open the playground (when using --playground)").option("--prompt <prompt>","Initial message to start the playground with (when using --playground)").action(async(t,e)=>{let r=e.config?bI(e.config):{};await cme(t,r,await Hi(e.key),e.profile,{playground:e.playground,open:e.open,initialMessage:e.prompt})});ci.command("dev [entryFile]").description("Start development server with hot-reload and tunnel").option("--port <port>",`Port to run the server on (default: ${Hs})`).option("--key <apikey>","Provide an API key").option("--no-tunnel","Don't start the tunnel").option("--no-open","Don't automatically open the playground").option("--prompt <prompt>","Initial message to start the playground with").option("-c, --config <path>","Path to config file (default: auto-detect smithery.config.js)").action(async(t,e)=>{await zee({entryFile:t,port:e.port,key:e.key,tunnel:e.tunnel,open:e.open,initialMessage:e.prompt,configFile:e.config})});ci.command("build [entryFile]").description("build MCP server for production").option("-o, --out <outfile>","Output file path (default: .smithery/index.cjs)").option("--transport <type>","Transport type: shttp or stdio (default: shttp)").option("-c, --config <path>","Path to config file (default: auto-detect smithery.config.js)").action(async(t,e)=>{let r=e.transport||"shttp";["shttp","stdio"].includes(r)||(console.error(Fn.default.red(`Invalid transport type "${r}". Valid options are: shttp, stdio`)),process.exit(1)),await CB({entryFile:t,outFile:e.out,transport:r,configFile:e.config,bundleAll:e.bundleAll})});ci.command("playground").description("open MCP playground in browser").option("--port <port>",`Port to expose (default: ${Hs})`).option("--key <apikey>","Provide an API key").allowUnknownOption().allowExcessArguments().action(async t=>{let e,r=process.argv,n=r.indexOf("--");n!==-1&&n+1<r.length&&(e=r.slice(n+1).join(" ")),await cue({port:t.port,command:e,apiKey:await Hi(t.key)})});ci.command("playground-stdio").description("Run arbitrary command as stdio MCP server in playground").option("--port <port>","Port for HTTP server (default: 6969)").option("--key <apikey>","Provide an API key").option("--no-open","Don't automatically open the playground").option("--prompt <prompt>","Initial message to start the playground with").allowUnknownOption().allowExcessArguments().action(async t=>{let e,r=process.argv,n=r.indexOf("--");n!==-1&&n+1<r.length&&(e=r.slice(n+1).join(" ")),e||(console.error(Fn.default.red("\u274C Command is required.")),console.error(Fn.default.yellow("Usage: smithery playground-stdio -- <command>")),console.error(Fn.default.gray("Example: smithery playground-stdio -- python my_mcp_server.py")),process.exit(1));let{createArbitraryCommandRunner:i}=await Promise.resolve().then(()=>(wme(),Dme)),a=await i(e,await Hi(t.key),{port:t.port?parseInt(t.port,10):6969,open:t.open!==!1,initialMessage:t.prompt});process.stdin.resume(),await new Promise(()=>{})});ci.command("list").description("list installed servers").option("-c, --client <name>",`Specify the client (${ms.join(", ")})`).action(async t=>{let e=await P7(t.client,"List");q7(e),await oue("servers",e)});ci.command("search [term]").description("Search for servers in the Smithery registry").action(async t=>{let e=await Hi();await bme(e,t)});ci.command("login").description("Login with an API key").action(async()=>{console.log(Fn.default.cyan("Login to Smithery")),console.log(Fn.default.gray("Get your API key from: https://smithery.ai/account/api-keys")),console.log();try{let t=await aA();(await i9(t)).success?(console.log(Fn.default.green("\u2713 API key saved successfully")),console.log(Fn.default.gray("You can now use Smithery CLI commands"))):(console.error(Fn.default.red("\u2717 Failed to save API key")),console.error(Fn.default.gray("You may need to enter it again next time")))}catch(t){console.error(Fn.default.red("\u2717 Login failed"));let e=t instanceof Error?t.message:String(t);console.error(Fn.default.gray(e)),process.exit(1)}});ci.parse(process.argv);
601
+ `)};return process.on("SIGINT",g),process.on("SIGTERM",g),process.on("beforeExit",g),process.on("exit",()=>{U("[Uplink Runner] Final cleanup on exit")}),process.stdin.on("end",()=>{U("[Uplink Runner] STDIN closed (client disconnected)"),g().catch(A=>{U(`[Uplink Runner] Error during stdin close cleanup: ${A}`),process.exit(1)})}),process.stdin.on("error",A=>{U(`[Uplink Runner] STDIN error: ${A.message}`),g().catch(T=>{U(`[Uplink Runner] Error during stdin error cleanup: ${T}`),process.exit(1)})}),process.stdin.on("data",A=>y(A).catch(T=>m(T,"[Uplink Runner] Error processing message"))),await _(),S};async function cme(t,e,r,n,i){try{let a=await ls();a.success||U(`[Runner] Settings initialization warning: ${a.error}`);let s=await k0(t,r,"run");if(!s)throw new Error(`Could not resolve server: ${t}`);U(`[Runner] Connecting to server: ${JSON.stringify({id:s.qualifiedName,connectionTypes:s.connections.map(c=>c.type)})}`);let o=await n9();await z6t(s,e,o,r,n,i)}catch(a){U(`[Runner] Error: ${a instanceof Error?a.message:a}`),process.exit(1)}}async function z6t(t,e,r,n,i,a){if(!t.connections?.length)throw new Error("No connection configuration found for server");let s=t.connections[0];if(s.type==="http"){if(!s.deploymentUrl)throw new Error("Missing deployment URL");if(!n)throw new Error("API key is required for remote connections");a?.playground?await ume(s.deploymentUrl,n,e,i,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"}):await sme(s.deploymentUrl,n,e,i)}else if(s.type==="stdio"){let o=await hue(t,s,e,n,i);if(a?.playground){if(!n)throw new Error("API key is required for playground connections");await Vfe(o.command,o.args,o.env,o.qualifiedName,n,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"})}else await Wfe(o.command,o.args,o.env,o.qualifiedName,n,r)}else throw new Error(`Unsupported connection type: ${s.type}`)}var v1=ye(at(),1);Lu();D2();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function lme(t,e){try{if(Qi(e).installType==="command"){console.log(v1.default.yellow(`Uninstallation is currently not supported for ${e}`));return}let n=Ll(e);if(!n.mcpServers[t]){console.log(v1.default.red(`${t} is not installed for ${e}`));return}delete n.mcpServers[t],y2(n,e),console.log(v1.default.green(`\u2713 ${t} successfully uninstalled from ${e}`)),await lg(e)}catch(r){r instanceof Error?console.error(v1.default.red(`Error: ${r.message}`)):console.error(v1.default.red("An unexpected error occurred during uninstallation")),process.exit(1)}}Lu();Zn();var mr=ye(at(),1);Lu();async function P7(t,e="Working with"){if(t)return t;console.log(mr.default.cyan("*"),`${e} MCP server`),console.log();let r=(await Promise.resolve().then(()=>ye(ti(),1))).default,n=(await Promise.resolve().then(()=>ye(oh(),1))).default;r.registerPrompt("autocomplete",n);let{client:i}=await r.prompt([{type:"autocomplete",name:"client",message:"Select client:",source:(a,s)=>{let o=ms.filter(c=>c.toLowerCase().includes((s||"").toLowerCase()));return Promise.resolve(o)}}]);return i}function q7(t){ms.includes(t)||(console.error(mr.default.yellow(`Invalid client "${t}". Valid options are: ${ms.join(", ")}`)),process.exit(1))}function bI(t){try{let e=t;e.startsWith("'")&&e.endsWith("'")&&(e=e.slice(1,-1));let r=JSON.parse(e);return typeof r=="string"&&(r=JSON.parse(r)),r}catch(e){let r=e instanceof Error?e.message:String(e);console.error(mr.default.red(`Error parsing config: ${r}`)),process.exit(1)}}async function n4t(){let t=(await Promise.resolve().then(()=>ye(ti(),1))).default,{inputMethod:e}=await t.prompt([{type:"list",name:"inputMethod",message:"How would you like to specify the server?",choices:[{name:"Search for servers",value:"search"},{name:"Enter server id",value:"direct"}]}]);return e}async function i4t(t){let e=(await Promise.resolve().then(()=>ye(ti(),1))).default,{searchTerm:r}=await e.prompt([{type:"input",name:"searchTerm",message:"Search for servers:",validate:n=>n.trim().length>0||"Please enter a search term"}]);try{let n=await Hi(t),i=(await Promise.resolve().then(()=>(yl(),Z5))).default,a=i(`Searching for "${r}"...`).start(),s=await yO(r,n);s.length===0&&(a.fail(`No servers found for "${r}"`),process.exit(0)),a.succeed(`Found ${s.length} server${s.length===1?"":"s"}`),console.log();let o=(await Promise.resolve().then(()=>ye(oh(),1))).default;e.registerPrompt("autocomplete",o);let{serverChoice:c}=await e.prompt([{type:"autocomplete",name:"serverChoice",message:"Select server to install:",source:(l,d)=>{let f=s.filter(m=>m.qualifiedName.toLowerCase().includes((d||"").toLowerCase())||m.displayName?.toLowerCase().includes((d||"").toLowerCase())||m.description?.toLowerCase().includes((d||"").toLowerCase())).map(m=>{let g=m.displayName||m.qualifiedName,b=`${m.useCount.toLocaleString()} tool calls`,x=m.qualifiedName!==g?` \u2022 ${m.qualifiedName}`:"";return{name:`${g} \u2022 ${b}${x}`,value:m.qualifiedName}});return Promise.resolve(f)}}]);return c}catch(n){let i=(await Promise.resolve().then(()=>(yl(),Z5))).default;i().start().fail("Failed to search servers"),console.error(mr.default.red(n instanceof Error?n.message:String(n))),process.exit(1)}}async function a4t(){let t=(await Promise.resolve().then(()=>ye(ti(),1))).default,{serverId:e}=await t.prompt([{type:"input",name:"serverId",message:"Enter server ID:",validate:r=>{let n=r.trim();return n.length===0?"Please enter a server ID":/^[a-zA-Z0-9._/-]+$/.test(n)?!0:"Server ID should only contain letters, numbers, dots, underscores, hyphens, and forward slashes"}}]);return e.trim()}async function gme(t,e,r){if(t)return t;if(console.log(mr.default.cyan("*"),"Installing MCP server for",mr.default.cyan(e)),console.log(),await n4t()==="search")return await i4t(r);{let i=await a4t();return console.log(),i}}async function xme(t,e,r){if(t)return t;console.log(mr.default.cyan("*"),"Uninstalling server from",mr.default.cyan(e)),console.log(),r.length===0&&(console.log(mr.default.yellow(`No servers installed for ${e}`)),process.exit(0));let n=(await Promise.resolve().then(()=>ye(ti(),1))).default,i=(await Promise.resolve().then(()=>ye(oh(),1))).default;n.registerPrompt("autocomplete",i);let{serverName:a}=await n.prompt([{type:"autocomplete",name:"serverName",message:`Select server to uninstall from ${e}:`,source:(s,o)=>{let c=r.filter(l=>l.toLowerCase().includes((o||"").toLowerCase()));return Promise.resolve(c)}}]);return a}async function xI(t){if(t)return t;let r=await(await Promise.resolve().then(()=>ye(ti(),1))).default.prompt([{type:"input",name:"searchTerm",message:"Search for servers:",validate:n=>n.trim().length>0||"Please enter a search term"}]);return console.log(),r.searchTerm}async function bme(t,e){let r=await xI(e);try{for(;;){let n=(await Promise.resolve().then(()=>(yl(),Z5))).default,i=n(`Searching for "${r}"...`).start(),a=await yO(r,t);if(a.length===0){i.fail(`No servers found for "${r}"`);return}i.succeed(`\u2600 ${a.length<10?`Found ${a.length} result${a.length===1?"":"s"}:`:`Showing top (${a.length}) results:`}`),console.log(mr.default.dim(`${mr.default.cyan("\u2192 View more")} at smithery.ai/search?q=${r.replace(/\s+/g,"+")}`)),console.log();let s=(await Promise.resolve().then(()=>ye(ti(),1))).default,o=(await Promise.resolve().then(()=>ye(oh(),1))).default;s.registerPrompt("autocomplete",o);let{selectedServer:c}=await s.prompt([{type:"autocomplete",name:"selectedServer",message:"Select server for details (or search again):",source:(d,f)=>{let m=[{name:mr.default.dim("\u2190 Search again"),value:"__SEARCH_AGAIN__"},{name:mr.default.dim("Exit"),value:"__EXIT__"}],g=a.filter(b=>b.qualifiedName.toLowerCase().includes((f||"").toLowerCase())||b.displayName?.toLowerCase().includes((f||"").toLowerCase())).map(b=>{let x=b.displayName||b.qualifiedName,y=b.useCount>0?mr.default.dim(` (${b.useCount.toLocaleString()} calls/month)`):"";return{name:`${x}${y}`,value:b.qualifiedName}});return Promise.resolve([...m,...g])}}]);if(c==="__EXIT__")return;if(c==="__SEARCH_AGAIN__"){r=await xI();continue}console.log();let l=a.find(d=>d.qualifiedName===c);if(l){let d=l.displayName||l.qualifiedName;console.log(`${mr.default.bold.cyan(d)}`),console.log(`${mr.default.dim("Qualified name:")} ${l.qualifiedName}`),l.description&&console.log(`${mr.default.dim("Description:")} ${l.description}`),console.log(`${mr.default.dim("Usage:")} ${l.useCount.toLocaleString()} calls/month`),console.log(),console.log(mr.default.dim(`Use 'smithery install ${l.qualifiedName}' to install`));let{action:f}=await s.prompt([{type:"list",name:"action",message:"What would you like to do?",choices:[{name:"\u2190 Back to server list",value:"back"},{name:"\u2190 Search again",value:"search"},{name:"Exit",value:"exit"}]}]);if(f==="back")console.log();else if(f==="search")r=await xI();else return}}}catch(n){console.error(mr.default.red("Error searching servers:"),n instanceof Error?n.message:String(n)),process.exit(1)}}var ci=new _B;ci.name("smithery").version("1.4.7").description(`${Fn.default.bold.italic.hex("#ea580c")("SMITHERY CLI")} ${Fn.default.bold.italic.hex("#ea580c")("v1.4.7")} - Manage and run MCP servers`).option("--verbose","Show detailed logs").option("--debug","Show debug logs").hook("preAction",(t,e)=>{let r=t.opts();r.verbose&&Vj(!0),r.debug&&zj(!0)});ci.command("install [server]").description("install a server").option("-c, --client <name>",`Specify the AI client (${ms.join(", ")})`).option("--config <json>","Provide configuration data as JSON (skips prompts)").option("--key <apikey>","Provide an API key").option("--profile <name>","Use a specific profile").action(async(t,e)=>{let r=await P7(e.client,"Install"),n=await gme(t,r,e.key);q7(r);let i=e.config?bI(e.config):{};await sue(n,r,i,e.key,e.profile)});ci.command("uninstall [server]").description("uninstall a server").option("-c, --client <name>",`Specify the AI client (${ms.join(", ")})`).action(async(t,e)=>{let{readConfig:r}=await Promise.resolve().then(()=>(D2(),aue)),n=await P7(e.client,"Uninstall");q7(n);let i=r(n),a=Object.keys(i.mcpServers),s=await xme(t,n,a);await lme(s,n)});ci.command("inspect <server>").description("Inspect server from registry").option("--key <apikey>","Provide an API key").action(async(t,e)=>{await sae(t,await Hi(e.key))});ci.command("run <server>").description("run a server").option("--config <json>","Provide configuration as JSON").option("--key <apikey>","Provide an API key").option("--profile <name>","Use a specific profile").option("--playground","Create playground tunnel and open playground").option("--no-open","Don't automatically open the playground (when using --playground)").option("--prompt <prompt>","Initial message to start the playground with (when using --playground)").action(async(t,e)=>{let r=e.config?bI(e.config):{};await cme(t,r,await Hi(e.key),e.profile,{playground:e.playground,open:e.open,initialMessage:e.prompt})});ci.command("dev [entryFile]").description("Start development server with hot-reload and tunnel").option("--port <port>",`Port to run the server on (default: ${Hs})`).option("--key <apikey>","Provide an API key").option("--no-tunnel","Don't start the tunnel").option("--no-open","Don't automatically open the playground").option("--prompt <prompt>","Initial message to start the playground with").option("-c, --config <path>","Path to config file (default: auto-detect smithery.config.js)").action(async(t,e)=>{await zee({entryFile:t,port:e.port,key:e.key,tunnel:e.tunnel,open:e.open,initialMessage:e.prompt,configFile:e.config})});ci.command("build [entryFile]").description("build MCP server for production").option("-o, --out <outfile>","Output file path (default: .smithery/index.cjs)").option("--transport <type>","Transport type: shttp or stdio (default: shttp)").option("-c, --config <path>","Path to config file (default: auto-detect smithery.config.js)").action(async(t,e)=>{let r=e.transport||"shttp";["shttp","stdio"].includes(r)||(console.error(Fn.default.red(`Invalid transport type "${r}". Valid options are: shttp, stdio`)),process.exit(1)),await CB({entryFile:t,outFile:e.out,transport:r,configFile:e.config,bundleAll:e.bundleAll})});ci.command("playground").description("open MCP playground in browser").option("--port <port>",`Port to expose (default: ${Hs})`).option("--key <apikey>","Provide an API key").allowUnknownOption().allowExcessArguments().action(async t=>{let e,r=process.argv,n=r.indexOf("--");n!==-1&&n+1<r.length&&(e=r.slice(n+1).join(" ")),await cue({port:t.port,command:e,apiKey:await Hi(t.key)})});ci.command("playground-stdio").description("Run arbitrary command as stdio MCP server in playground").option("--port <port>","Port for HTTP server (default: 6969)").option("--key <apikey>","Provide an API key").option("--no-open","Don't automatically open the playground").option("--prompt <prompt>","Initial message to start the playground with").allowUnknownOption().allowExcessArguments().action(async t=>{let e,r=process.argv,n=r.indexOf("--");n!==-1&&n+1<r.length&&(e=r.slice(n+1).join(" ")),e||(console.error(Fn.default.red("\u274C Command is required.")),console.error(Fn.default.yellow("Usage: smithery playground-stdio -- <command>")),console.error(Fn.default.gray("Example: smithery playground-stdio -- python my_mcp_server.py")),process.exit(1));let{createArbitraryCommandRunner:i}=await Promise.resolve().then(()=>(wme(),Dme)),a=await i(e,await Hi(t.key),{port:t.port?Number.parseInt(t.port,10):6969,open:t.open!==!1,initialMessage:t.prompt});process.stdin.resume(),await new Promise(()=>{})});ci.command("list").description("list installed servers").option("-c, --client <name>",`Specify the client (${ms.join(", ")})`).action(async t=>{let e=await P7(t.client,"List");q7(e),await oue("servers",e)});ci.command("search [term]").description("Search for servers in the Smithery registry").action(async t=>{let e=await Hi();await bme(e,t)});ci.command("login").description("Login with an API key").action(async()=>{console.log(Fn.default.cyan("Login to Smithery")),console.log(Fn.default.gray("Get your API key from: https://smithery.ai/account/api-keys")),console.log();try{let t=await aA();(await i9(t)).success?(console.log(Fn.default.green("\u2713 API key saved successfully")),console.log(Fn.default.gray("You can now use Smithery CLI commands"))):(console.error(Fn.default.red("\u2717 Failed to save API key")),console.error(Fn.default.gray("You may need to enter it again next time")))}catch(t){console.error(Fn.default.red("\u2717 Login failed"));let e=t instanceof Error?t.message:String(t);console.error(Fn.default.gray(e)),process.exit(1)}});ci.parse(process.argv);
602
602
  /*! Bundled license information:
603
603
 
604
604
  safe-buffer/index.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithery/cli",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://smithery.ai/",
@@ -64,11 +64,7 @@
64
64
  "typescript": "^5.0.0",
65
65
  "vitest": "^3.2.4"
66
66
  },
67
- "files": [
68
- "dist",
69
- "README.md",
70
- "package.json"
71
- ],
67
+ "files": ["dist", "README.md", "package.json"],
72
68
  "exports": {
73
69
  ".": {
74
70
  "import": "./dist/index.js"