@smithery/cli 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/package.json +1 -1
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+=Fj("")),i&&g&&(n+=Cj(g))):m===`
|
|
46
46
|
`&&(i&&g&&(n+=Cj(i)),a&&(n+=Fj(a))),d+=m.length}return n}});import _6 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&&!Rj(e.borderColor))throw new Error(`${e.borderColor} is not a valid borderColor`);if(e.backgroundColor&&!Rj(e.backgroundColor))throw new Error(`${e.backgroundColor} is not a valid backgroundColor`);return e.padding=Pj(e.padding),e.margin=Pj(e.margin),e=i9e(t,e),t=t9e(t,e),r9e(t,e.width,e)}var Ij,Uy,o9e,zo,Xn,K1,kj,Pj,J1,X5e,e9e,t9e,r9e,n9e,qj,i9e,Vy,Rj,a9e,s9e,Nj=fe(()=>{H1();ej();tj();Ij=ye(qy(),1);uj();Uy=ye(xj(),1);Tj();o9e=ye(qy(),1),zo=`
|
|
47
47
|
`,Xn=" ",K1="none",kj=()=>{let{env:t,stdout:e,stderr:r}=_6;return e?.columns?e.columns:r?.columns?r.columns:t.COLUMNS?Number.parseInt(t.COLUMNS,10):80},Pj=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,X5e=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=Ij.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},e9e=(t,e,r)=>{let n="",i=Kr(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},t9e=(t,{padding:e,width:r,textAlignment:n,height:i})=>{t=(0,Uy.default)(t,{align:n});let a=t.split(zo),s=b6(t),o=r-e.left-e.right;if(s>o){let d=[];for(let f of a){let m=w6(f,o,{hard:!0}),b=(0,Uy.default)(m,{align:n}).split(`
|
|
48
|
-
`),x=Math.max(...b.map(y=>Kr(y)));for(let y of b){let _;switch(n){case"center":{_=Xn.repeat((o-x)/2)+y;break}case"right":{_=Xn.repeat(o-x)+y;break}default:{_=y;break}}d.push(_)}}a=d}n==="center"&&s<o?a=a.map(d=>Xn.repeat((o-s)/2)+d):n==="right"&&s<o&&(a=a.map(d=>Xn.repeat(o-s)+d));let c=Xn.repeat(e.left),l=Xn.repeat(e.right);return a=a.map(d=>{let f=c+d+l;return f+Xn.repeat(r-Kr(f))}),e.top>0&&(a=[...Array.from({length:e.top}).fill(Xn.repeat(r)),...a]),e.bottom>0&&(a=[...a,...Array.from({length:e.bottom}).fill(Xn.repeat(r))]),i&&a.length>i?a=a.slice(0,i):i&&a.length<i&&(a=[...a,...Array.from({length:i-a.length}).fill(Xn.repeat(r))]),a.join(zo)},r9e=(t,e,r)=>{let n=d=>{let f=r.borderColor?a9e(r.borderColor)(d):d;return r.dimBorder?Ac.dim(f):f},i=d=>r.backgroundColor?s9e(r.backgroundColor)(d):d,a=X5e(r.borderStyle),s=kj(),o=Xn.repeat(r.margin.left);if(r.float==="center"){let d=Math.max((s-e-J1(r.borderStyle))/2,0);o=Xn.repeat(d)}else if(r.float==="right"){let d=Math.max(s-e-r.margin.right-J1(r.borderStyle),0);o=Xn.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?e9e(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},n9e=t=>{if(t.fullscreen&&_6?.stdout){let e=[_6.stdout.columns,_6.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},qj=(t,e)=>e===K1?t:` ${t} `,i9e=(t,e)=>{e=n9e(e);let r=e.width!==void 0,n=kj(),i=J1(e.borderStyle),a=n-e.margin.left-e.margin.right-i,s=b6(w6(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&&=qj(e.title,e.borderStyle)):e.title&&(e.title=e.title.slice(0,Math.max(0,a-2)),e.title&&(e.title=qj(e.title,e.borderStyle),Kr(e.title)>s&&(e.width=Kr(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),Rj=t=>typeof t=="string"&&(Ac[t]??Vy(t)),a9e=t=>Vy(t)?Ac.hex(t):Ac[t],s9e=t=>Vy(t)?Ac.bgHex(t):Ac[Iy(["bg",t])]});function Bj(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 jj(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 Lj=fe(()=>{"use strict"});import{exec as u9e}from"node:child_process";import{promisify as c9e}from"node:util";async function Mj(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 l9e(a)}catch{console.log(Wy.default.yellow("Could not open browser automatically")),console.log(Wy.default.gray("Please open the link manually"))}}var Wy,l9e,$j=fe(()=>{"use strict";Wy=ye(at(),1),l9e=c9e(u9e)});function zj(t){Uj=t}function Hj(t){Vj=t}function V(t){Uj&&console.log(Gy.default.gray(`[verbose] ${t}`))}function da(t){Vj&&console.debug(Gy.default.blue(`[debug] ${t}`))}var Gy,Uj,Vj,ei=fe(()=>{"use strict";Gy=ye(at(),1),Uj=!1,Vj=!1});async function p9e(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 Wj(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 Gj(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 p9e(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);ei()});async function Ua(t,e,r=!0,n){let{listener:i,url:a}=await Gj(t,e),s=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${a}/mcp`)}`,c={name:"smithery-dev",type:"http",url:`${a}/mcp`,headers:{}},l=Bj(c),d=Hy(l.url,l.displayText),f=jj(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.5.
|
|
48
|
+
`),x=Math.max(...b.map(y=>Kr(y)));for(let y of b){let _;switch(n){case"center":{_=Xn.repeat((o-x)/2)+y;break}case"right":{_=Xn.repeat(o-x)+y;break}default:{_=y;break}}d.push(_)}}a=d}n==="center"&&s<o?a=a.map(d=>Xn.repeat((o-s)/2)+d):n==="right"&&s<o&&(a=a.map(d=>Xn.repeat(o-s)+d));let c=Xn.repeat(e.left),l=Xn.repeat(e.right);return a=a.map(d=>{let f=c+d+l;return f+Xn.repeat(r-Kr(f))}),e.top>0&&(a=[...Array.from({length:e.top}).fill(Xn.repeat(r)),...a]),e.bottom>0&&(a=[...a,...Array.from({length:e.bottom}).fill(Xn.repeat(r))]),i&&a.length>i?a=a.slice(0,i):i&&a.length<i&&(a=[...a,...Array.from({length:i-a.length}).fill(Xn.repeat(r))]),a.join(zo)},r9e=(t,e,r)=>{let n=d=>{let f=r.borderColor?a9e(r.borderColor)(d):d;return r.dimBorder?Ac.dim(f):f},i=d=>r.backgroundColor?s9e(r.backgroundColor)(d):d,a=X5e(r.borderStyle),s=kj(),o=Xn.repeat(r.margin.left);if(r.float==="center"){let d=Math.max((s-e-J1(r.borderStyle))/2,0);o=Xn.repeat(d)}else if(r.float==="right"){let d=Math.max(s-e-r.margin.right-J1(r.borderStyle),0);o=Xn.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?e9e(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},n9e=t=>{if(t.fullscreen&&_6?.stdout){let e=[_6.stdout.columns,_6.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},qj=(t,e)=>e===K1?t:` ${t} `,i9e=(t,e)=>{e=n9e(e);let r=e.width!==void 0,n=kj(),i=J1(e.borderStyle),a=n-e.margin.left-e.margin.right-i,s=b6(w6(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&&=qj(e.title,e.borderStyle)):e.title&&(e.title=e.title.slice(0,Math.max(0,a-2)),e.title&&(e.title=qj(e.title,e.borderStyle),Kr(e.title)>s&&(e.width=Kr(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),Rj=t=>typeof t=="string"&&(Ac[t]??Vy(t)),a9e=t=>Vy(t)?Ac.hex(t):Ac[t],s9e=t=>Vy(t)?Ac.bgHex(t):Ac[Iy(["bg",t])]});function Bj(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 jj(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 Lj=fe(()=>{"use strict"});import{exec as u9e}from"node:child_process";import{promisify as c9e}from"node:util";async function Mj(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 l9e(a)}catch{console.log(Wy.default.yellow("Could not open browser automatically")),console.log(Wy.default.gray("Please open the link manually"))}}var Wy,l9e,$j=fe(()=>{"use strict";Wy=ye(at(),1),l9e=c9e(u9e)});function zj(t){Uj=t}function Hj(t){Vj=t}function V(t){Uj&&console.log(Gy.default.gray(`[verbose] ${t}`))}function da(t){Vj&&console.debug(Gy.default.blue(`[debug] ${t}`))}var Gy,Uj,Vj,ei=fe(()=>{"use strict";Gy=ye(at(),1),Uj=!1,Vj=!1});async function p9e(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 Wj(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 Gj(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 p9e(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);ei()});async function Ua(t,e,r=!0,n){let{listener:i,url:a}=await Gj(t,e),s=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${a}/mcp`)}`,c={name:"smithery-dev",type:"http",url:`${a}/mcp`,headers:{}},l=Bj(c),d=Hy(l.url,l.displayText),f=jj(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.5.1")} 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 Mj(a,t,n),{listener:i,url:a}}var Lt,Rp=fe(()=>{"use strict";Nj();Lt=ye(at(),1);Lj();$j();Jy()});var Zj=v((ovt,Qj)=>{Qj.exports=Yj;Yj.sync=f9e;var Kj=ee("fs");function d9e(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 Jj(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:d9e(e,r)}function Yj(t,e,r){Kj.stat(t,function(n,i){r(n,n?!1:Jj(i,t,e))})}function f9e(t,e){return Jj(Kj.statSync(t),t,e)}});var nL=v((uvt,rL)=>{rL.exports=eL;eL.sync=m9e;var Xj=ee("fs");function eL(t,e,r){Xj.stat(t,function(n,i){r(n,n?!1:tL(i,e))})}function m9e(t,e){return tL(Xj.statSync(t),e)}function tL(t,e){return t.isFile()&&h9e(t,e)}function h9e(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 aL=v((lvt,iL)=>{var cvt=ee("fs"),F6;process.platform==="win32"||global.TESTING_WINDOWS?F6=Zj():F6=nL();iL.exports=Yy;Yy.sync=v9e;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)})})}F6(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function v9e(t,e){try{return F6.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var dL=v((pvt,pL)=>{var Ip=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",sL=ee("path"),g9e=Ip?";":":",oL=aL(),uL=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),cL=(t,e)=>{let r=e.colon||g9e,n=t.match(/\//)||Ip&&t.match(/\\/)?[""]:[...Ip?[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=Ip?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=Ip?i.split(r):[""];return Ip&&t.indexOf(".")!==-1&&a[0]!==""&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:i}},lL=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:a}=cL(t,e),s=[],o=l=>new Promise((d,f)=>{if(l===n.length)return e.all&&s.length?d(s):f(uL(t));let m=n[l],g=/^".*"$/.test(m)?m.slice(1,-1):m,b=sL.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];oL(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)},x9e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=cL(t,e),a=[];for(let s=0;s<r.length;s++){let o=r[s],c=/^".*"$/.test(o)?o.slice(1,-1):o,l=sL.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(oL.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 uL(t)};pL.exports=lL;lL.sync=x9e});var mL=v((dvt,Qy)=>{"use strict";var fL=(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=fL;Qy.exports.default=fL});var xL=v((fvt,gL)=>{"use strict";var hL=ee("path"),b9e=dL(),y9e=mL();function vL(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=b9e.sync(t.command,{path:r[y9e({env:r})],pathExt:e?hL.delimiter:void 0})}catch{}finally{a&&process.chdir(n)}return s&&(s=hL.resolve(i?t.options.cwd:"",s)),s}function D9e(t){return vL(t)||vL(t,!0)}gL.exports=D9e});var bL=v((mvt,Xy)=>{"use strict";var Zy=/([()\][%!^"`<>&|;, *?])/g;function w9e(t){return t=t.replace(Zy,"^$1"),t}function _9e(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=w9e;Xy.exports.argument=_9e});var DL=v((hvt,yL)=>{"use strict";yL.exports=/^#!(.*)/});var _L=v((vvt,wL)=>{"use strict";var E9e=DL();wL.exports=(t="")=>{let e=t.match(E9e);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var SL=v((gvt,EL)=>{"use strict";var eD=ee("fs"),S9e=_L();function C9e(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 S9e(r.toString())}EL.exports=C9e});var OL=v((xvt,AL)=>{"use strict";var F9e=ee("path"),CL=xL(),FL=bL(),A9e=SL(),O9e=process.platform==="win32",T9e=/\.(?:com|exe)$/i,P9e=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function q9e(t){t.file=CL(t);let e=t.file&&A9e(t.file);return e?(t.args.unshift(t.file),t.command=e,CL(t)):t.file}function R9e(t){if(!O9e)return t;let e=q9e(t),r=!T9e.test(e);if(t.options.forceShell||r){let n=P9e.test(e);t.command=F9e.normalize(t.command),t.command=FL.command(t.command),t.args=t.args.map(a=>FL.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 I9e(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:R9e(n)}AL.exports=I9e});var qL=v((bvt,PL)=>{"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 k9e(t,e){if(!tD)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let a=TL(i,e);if(a)return r.call(t,"error",a)}return r.apply(t,arguments)}}function TL(t,e){return tD&&t===1&&!e.file?rD(e.original,"spawn"):null}function N9e(t,e){return tD&&t===1&&!e.file?rD(e.original,"spawnSync"):null}PL.exports={hookChildProcess:k9e,verifyENOENT:TL,verifyENOENTSync:N9e,notFoundError:rD}});var kL=v((yvt,kp)=>{"use strict";var RL=ee("child_process"),nD=OL(),iD=qL();function IL(t,e,r){let n=nD(t,e,r),i=RL.spawn(n.command,n.args,n.options);return iD.hookChildProcess(i,n),i}function B9e(t,e,r){let n=nD(t,e,r),i=RL.spawnSync(n.command,n.args,n.options);return i.error=i.error||iD.verifyENOENTSync(i.status,n),i}kp.exports=IL;kp.exports.spawn=IL;kp.exports.sync=B9e;kp.exports._parse=nD;kp.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,j9e,kr,A6=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"]),j9e=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),kr=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()}};kr.create=t=>new kr(t)});var L9e,Ws,sD=fe(()=>{A6();Y1();L9e=(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=L9e});function M9e(t){NL=t}function Np(){return NL}var NL,O6=fe(()=>{sD();NL=Ws});function oe(t,e){let r=Np(),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,$9e,Jr,_e,Tc,dn,T6,P6,Ho,Bp,oD=fe(()=>{O6();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}},$9e=[];Jr=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}),dn=t=>({status:"valid",value:t}),T6=t=>t.status==="aborted",P6=t=>t.status==="dirty",Ho=t=>t.status==="valid",Bp=t=>typeof Promise<"u"&&t instanceof Promise});var BL=fe(()=>{});var he,jL=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 UL(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 ige(t){return new RegExp(`^${UL(t)}$`)}function VL(t){let e=`${$L}T${UL(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 age(t,e){return!!((e==="v4"||!e)&&Q9e.test(t)||(e==="v6"||!e)&&X9e.test(t))}function sge(t,e){if(!G9e.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 oge(t,e){return!!((e==="v4"||!e)&&Z9e.test(t)||(e==="v6"||!e)&&ege.test(t))}function uge(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 jp(t){if(t instanceof kn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Fi.create(jp(n))}return new kn({...t._def,shape:()=>e})}else return t instanceof Js?new Js({...t._def,type:jp(t.element)}):t instanceof Fi?Fi.create(jp(t.unwrap())):t instanceof Ha?Ha.create(jp(t.unwrap())):t instanceof za?za.create(t.items.map(e=>jp(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 zL(t,e){return new $c({values:t,typeName:Ce.ZodEnum,...Be(e)})}function ML(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function HL(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=ML(e,n),c=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:c})}});if(!a){let s=ML(e,n),o=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:o})}}):Go.create()}var Ai,LL,Ue,U9e,V9e,z9e,H9e,W9e,G9e,K9e,J9e,Y9e,uD,Q9e,Z9e,X9e,ege,tge,rge,$L,nge,Wo,Pc,qc,Rc,Ic,Lp,kc,Nc,Go,Ks,fa,Mp,Js,kn,Bc,Gs,q6,jc,za,R6,$p,Up,I6,Lc,Mc,$c,Uc,Ko,Oi,Fi,Ha,Vc,zc,Vp,cge,Z1,X1,Hc,lge,Ce,fn,be,Er,pge,dge,Wa,lD,fge,mge,hge,Ys,vge,gge,xge,Qs,Fe,bge,yge,Dge,wge,_ge,Jo,Ege,Sge,Cge,Wc,Fge,Age,zp,Oge,Tge,Pge,ti,qge,Rge,Ige,kge,Nge,pD,Bge,WL=fe(()=>{A6();O6();jL();oD();Y1();Ai=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}},LL=(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 kr(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 Jr,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(Bp(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 LL(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(Bp(i)?i:Promise.resolve(i));return LL(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 Oi({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 Fi.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 Oi({...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}},U9e=/^c[^\s-]{8,}$/i,V9e=/^[0-9a-z]+$/,z9e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H9e=/^[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,W9e=/^[a-z0-9_-]{21}$/i,G9e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,K9e=/^[-+]?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)?)??$/,J9e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y9e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Q9e=/^(?:(?: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])$/,Z9e=/^(?:(?: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])$/,X9e=/^(([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]))$/,ege=/^(([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])$/,tge=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$L="((\\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])))",nge=new RegExp(`^${$L}$`);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 Jr,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")J9e.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(Y9e,"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")H9e.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")W9e.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")U9e.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")V9e.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")z9e.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"?VL(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"?nge.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:te.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ige(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"?K9e.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"duration",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?age(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"?sge(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"?oge(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"?tge.test(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{validation:"base64",code:te.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?rge.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 Jr;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"?uge(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 Jr;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 dn(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 Jr,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)});Lp=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 dn(e.data)}};Lp.create=t=>new Lp({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 dn(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 dn(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 dn(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 dn(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)});Mp=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 dn(e.data)}};Mp.create=t=>new Mp({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 Ai(r,s,r.path,o)))).then(s=>Jr.mergeArray(n,s));let a=[...r.data].map((s,o)=>i.type._parseSync(new Ai(r,s,r.path,o)));return Jr.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)});kn=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 Ai(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 Ai(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=>Jr.mergeObjectSync(n,l)):Jr.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 jp(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 Fi;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return zL(Ke.objectKeys(this.shape))}};kn.create=(t,e)=>new kn({shape:()=>t,unknownKeys:"strip",catchall:fa.create(),typeName:Ce.ZodObject,...Be(e)});kn.strictCreate=(t,e)=>new kn({shape:()=>t,unknownKeys:"strict",catchall:fa.create(),typeName:Ce.ZodObject,...Be(e)});kn.lazycreate=(t,e)=>new kn({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 kr(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 kr(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 Oi?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 Fi?[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):[],q6=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(T6(a)||T6(s))return _e;let o=cD(a.value,s.value);return o.valid?((P6(a)||P6(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 Ai(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(a).then(s=>Jr.mergeArray(r,s)):Jr.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)})};R6=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 Ai(n,o,n.path,o)),value:s._parse(new Ai(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?Jr.mergeObjectAsync(r,i):Jr.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)})}},$p=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 Ai(n,o,n.path,[l,"key"])),value:a._parse(new Ai(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}}}};$p.create=(t,e,r)=>new $p({valueType:e,keyType:t,typeName:Ce.ZodMap,...Be(r)});Up=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 Ai(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)}};Up.create=(t,e)=>new Up({valueType:t,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Be(e)});I6=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,Np(),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,Np(),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 dn(async function(...c){let l=new kr([]),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 dn(function(...c){let l=o._def.args.safeParse(c,a);if(!l.success)throw new kr([n(c,l.error)]);let d=Reflect.apply(s,this,l.data),f=o._def.returns.safeParse(d,a);if(!f.success)throw new kr([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 dn(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=zL;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 dn(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 dn(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)});Oi=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)}};Oi.create=(t,e,r)=>new Oi({schema:t,typeName:Ce.ZodEffects,effect:e,...Be(r)});Oi.createWithPreprocess=(t,e,r)=>new Oi({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Be(r)});Fi=class extends Ue{_parse(e){return this._getType(e)===le.undefined?dn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fi.create=(t,e)=>new Fi({innerType:t,typeName:Ce.ZodOptional,...Be(e)});Ha=class extends Ue{_parse(e){return this._getType(e)===le.null?dn(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 Bp(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new kr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kr(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)});Vp=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}}};Vp.create=t=>new Vp({typeName:Ce.ZodNaN,...Be(t)});cge=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 Bp(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)});lge={object:kn.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={}));fn=(t,e={message:`Input not instance of ${t.name}`})=>HL(r=>r instanceof t,e),be=Wo.create,Er=Pc.create,pge=Vp.create,dge=qc.create,Wa=Rc.create,lD=Ic.create,fge=Lp.create,mge=kc.create,hge=Nc.create,Ys=Go.create,vge=Ks.create,gge=fa.create,xge=Mp.create,Qs=Js.create,Fe=kn.create,bge=kn.strictCreate,yge=Bc.create,Dge=q6.create,wge=jc.create,_ge=za.create,Jo=R6.create,Ege=$p.create,Sge=Up.create,Cge=I6.create,Wc=Lc.create,Fge=Mc.create,Age=$c.create,zp=Uc.create,Oge=Ko.create,Tge=Oi.create,Pge=Fi.create,ti=Ha.create,qge=Oi.createWithPreprocess,Rge=X1.create,Ige=()=>be().optional(),kge=()=>Er().optional(),Nge=()=>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}))},Bge=_e});var w={};a6(w,{BRAND:()=>cge,DIRTY:()=>Tc,EMPTY_PATH:()=>$9e,INVALID:()=>_e,NEVER:()=>Bge,OK:()=>dn,ParseStatus:()=>Jr,Schema:()=>Ue,ZodAny:()=>Go,ZodArray:()=>Js,ZodBigInt:()=>qc,ZodBoolean:()=>Rc,ZodBranded:()=>Z1,ZodCatch:()=>zc,ZodDate:()=>Ic,ZodDefault:()=>Vc,ZodDiscriminatedUnion:()=>q6,ZodEffects:()=>Oi,ZodEnum:()=>$c,ZodError:()=>kr,ZodFirstPartyTypeKind:()=>Ce,ZodFunction:()=>I6,ZodIntersection:()=>jc,ZodIssueCode:()=>te,ZodLazy:()=>Lc,ZodLiteral:()=>Mc,ZodMap:()=>$p,ZodNaN:()=>Vp,ZodNativeEnum:()=>Uc,ZodNever:()=>fa,ZodNull:()=>Nc,ZodNullable:()=>Ha,ZodNumber:()=>Pc,ZodObject:()=>kn,ZodOptional:()=>Fi,ZodParsedType:()=>le,ZodPipeline:()=>X1,ZodPromise:()=>Ko,ZodReadonly:()=>Hc,ZodRecord:()=>R6,ZodSchema:()=>Ue,ZodSet:()=>Up,ZodString:()=>Wo,ZodSymbol:()=>Lp,ZodTransformer:()=>Oi,ZodTuple:()=>za,ZodType:()=>Ue,ZodUndefined:()=>kc,ZodUnion:()=>Bc,ZodUnknown:()=>Ks,ZodVoid:()=>Mp,addIssueToContext:()=>oe,any:()=>Ys,array:()=>Qs,bigint:()=>dge,boolean:()=>Wa,coerce:()=>pD,custom:()=>HL,date:()=>lD,datetimeRegex:()=>VL,defaultErrorMap:()=>Ws,discriminatedUnion:()=>Dge,effect:()=>Tge,enum:()=>Age,function:()=>Cge,getErrorMap:()=>Np,getParsedType:()=>Va,instanceof:()=>fn,intersection:()=>wge,isAborted:()=>T6,isAsync:()=>Bp,isDirty:()=>P6,isValid:()=>Ho,late:()=>lge,lazy:()=>Wc,literal:()=>Fge,makeIssue:()=>Q1,map:()=>Ege,nan:()=>pge,nativeEnum:()=>zp,never:()=>gge,null:()=>hge,nullable:()=>ti,number:()=>Er,object:()=>Fe,objectUtil:()=>aD,oboolean:()=>Nge,onumber:()=>kge,optional:()=>Pge,ostring:()=>Ige,pipeline:()=>Rge,preprocess:()=>qge,promise:()=>Oge,quotelessJson:()=>j9e,record:()=>Jo,set:()=>Sge,setErrorMap:()=>M9e,strictObject:()=>bge,string:()=>be,symbol:()=>fge,transformer:()=>Tge,tuple:()=>_ge,undefined:()=>mge,union:()=>yge,unknown:()=>vge,util:()=>Ke,void:()=>xge});var dD=fe(()=>{O6();oD();BL();Y1();WL();A6()});var hr=fe(()=>{dD();dD()});var Hp,GL,k6,KL,JL,jge,Pi,Nn,ef,Ga,qi,N6,YL,B6,QL,ZL,XL,tf,tr,eM,tM,Wp,Gc,j6,Lge,rf,nf,rM,Mge,$ge,Uge,fD,nM,iM,L6,Vge,M6,$6,U6,aM,sM,mD,oM,uM,zge,Hge,hD,Wge,vD,Gge,gD,Kge,Jge,Yge,Qge,Zge,Xge,exe,xD,txe,bD,yD,DD,rxe,nxe,cM,ixe,wD,axe,sxe,oxe,uxe,_D,V6,Gvt,ED,cxe,lM,lxe,SD,pxe,dxe,fxe,mxe,hxe,vxe,gxe,xxe,bxe,yxe,Dxe,wxe,_xe,Exe,Sxe,CD,Cxe,Fxe,Axe,Oxe,Kvt,Jvt,Yvt,Qvt,Zvt,Xvt,Ti,Zs=fe(()=>{hr();Hp="2025-06-18",GL=[Hp,"2025-03-26","2024-11-05","2024-10-07"],k6="2.0",KL=w.union([w.string(),w.number().int()]),JL=w.string(),jge=w.object({progressToken:w.optional(KL)}).passthrough(),Pi=w.object({_meta:w.optional(jge)}).passthrough(),Nn=w.object({method:w.string(),params:w.optional(Pi)}),ef=w.object({_meta:w.optional(w.object({}).passthrough())}).passthrough(),Ga=w.object({method:w.string(),params:w.optional(ef)}),qi=w.object({_meta:w.optional(w.object({}).passthrough())}).passthrough(),N6=w.union([w.string(),w.number().int()]),YL=w.object({jsonrpc:w.literal(k6),id:N6}).merge(Nn).strict(),B6=t=>YL.safeParse(t).success,QL=w.object({jsonrpc:w.literal(k6)}).merge(Ga).strict(),ZL=t=>QL.safeParse(t).success,XL=w.object({jsonrpc:w.literal(k6),id:N6,result:qi}).strict(),tf=t=>XL.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={}));eM=w.object({jsonrpc:w.literal(k6),id:N6,error:w.object({code:w.number().int(),message:w.string(),data:w.optional(w.unknown())})}).strict(),tM=t=>eM.safeParse(t).success,Wp=w.union([YL,QL,XL,eM]),Gc=qi.strict(),j6=Ga.extend({method:w.literal("notifications/cancelled"),params:ef.extend({requestId:N6,reason:w.string().optional()})}),Lge=w.object({src:w.string(),mimeType:w.optional(w.string()),sizes:w.optional(w.array(w.string()))}).passthrough(),rf=w.object({icons:w.array(Lge).optional()}).passthrough(),nf=w.object({name:w.string(),title:w.optional(w.string())}).passthrough(),rM=nf.extend({version:w.string(),websiteUrl:w.optional(w.string())}).merge(rf),Mge=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(),$ge=Nn.extend({method:w.literal("initialize"),params:Pi.extend({protocolVersion:w.string(),capabilities:Mge,clientInfo:rM})}),Uge=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=qi.extend({protocolVersion:w.string(),capabilities:Uge,serverInfo:rM,instructions:w.optional(w.string())}),nM=Ga.extend({method:w.literal("notifications/initialized")}),iM=t=>nM.safeParse(t).success,L6=Nn.extend({method:w.literal("ping")}),Vge=w.object({progress:w.number(),total:w.optional(w.number()),message:w.optional(w.string())}).passthrough(),M6=Ga.extend({method:w.literal("notifications/progress"),params:ef.merge(Vge).extend({progressToken:KL})}),$6=Nn.extend({params:Pi.extend({cursor:w.optional(JL)}).optional()}),U6=qi.extend({nextCursor:w.optional(JL)}),aM=w.object({uri:w.string(),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).passthrough(),sM=aM.extend({text:w.string()}),mD=w.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),oM=aM.extend({blob:mD}),uM=nf.extend({uri:w.string(),description:w.optional(w.string()),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).merge(rf),zge=nf.extend({uriTemplate:w.string(),description:w.optional(w.string()),mimeType:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).merge(rf),Hge=$6.extend({method:w.literal("resources/list")}),hD=U6.extend({resources:w.array(uM)}),Wge=$6.extend({method:w.literal("resources/templates/list")}),vD=U6.extend({resourceTemplates:w.array(zge)}),Gge=Nn.extend({method:w.literal("resources/read"),params:Pi.extend({uri:w.string()})}),gD=qi.extend({contents:w.array(w.union([sM,oM]))}),Kge=Ga.extend({method:w.literal("notifications/resources/list_changed")}),Jge=Nn.extend({method:w.literal("resources/subscribe"),params:Pi.extend({uri:w.string()})}),Yge=Nn.extend({method:w.literal("resources/unsubscribe"),params:Pi.extend({uri:w.string()})}),Qge=Ga.extend({method:w.literal("notifications/resources/updated"),params:ef.extend({uri:w.string()})}),Zge=w.object({name:w.string(),description:w.optional(w.string()),required:w.optional(w.boolean())}).passthrough(),Xge=nf.extend({description:w.optional(w.string()),arguments:w.optional(w.array(Zge)),_meta:w.optional(w.object({}).passthrough())}).merge(rf),exe=$6.extend({method:w.literal("prompts/list")}),xD=U6.extend({prompts:w.array(Xge)}),txe=Nn.extend({method:w.literal("prompts/get"),params:Pi.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(),rxe=w.object({type:w.literal("resource"),resource:w.union([sM,oM]),_meta:w.optional(w.object({}).passthrough())}).passthrough(),nxe=uM.extend({type:w.literal("resource_link")}),cM=w.union([bD,yD,DD,nxe,rxe]),ixe=w.object({role:w.enum(["user","assistant"]),content:cM}).passthrough(),wD=qi.extend({description:w.optional(w.string()),messages:w.array(ixe)}),axe=Ga.extend({method:w.literal("notifications/prompts/list_changed")}),sxe=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(),oxe=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(sxe),_meta:w.optional(w.object({}).passthrough())}).merge(rf),uxe=$6.extend({method:w.literal("tools/list")}),_D=U6.extend({tools:w.array(oxe)}),V6=qi.extend({content:w.array(cM).default([]),structuredContent:w.object({}).passthrough().optional(),isError:w.optional(w.boolean())}),Gvt=V6.or(qi.extend({toolResult:w.unknown()})),ED=Nn.extend({method:w.literal("tools/call"),params:Pi.extend({name:w.string(),arguments:w.optional(w.record(w.unknown()))})}),cxe=Ga.extend({method:w.literal("notifications/tools/list_changed")}),lM=w.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),lxe=Nn.extend({method:w.literal("logging/setLevel"),params:Pi.extend({level:lM})}),SD=Ga.extend({method:w.literal("notifications/message"),params:ef.extend({level:lM,logger:w.optional(w.string()),data:w.unknown()})}),pxe=w.object({name:w.string().optional()}).passthrough(),dxe=w.object({hints:w.optional(w.array(pxe)),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(),fxe=w.object({role:w.enum(["user","assistant"]),content:w.union([bD,yD,DD])}).passthrough(),mxe=Nn.extend({method:w.literal("sampling/createMessage"),params:Pi.extend({messages:w.array(fxe),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(dxe)})}),hxe=qi.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])}),vxe=w.object({type:w.literal("boolean"),title:w.optional(w.string()),description:w.optional(w.string()),default:w.optional(w.boolean())}).passthrough(),gxe=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(),xxe=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(),bxe=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(),yxe=w.union([vxe,gxe,xxe,bxe]),Dxe=Nn.extend({method:w.literal("elicitation/create"),params:Pi.extend({message:w.string(),requestedSchema:w.object({type:w.literal("object"),properties:w.record(w.string(),yxe),required:w.optional(w.array(w.string()))}).passthrough()})}),wxe=qi.extend({action:w.enum(["accept","decline","cancel"]),content:w.optional(w.record(w.string(),w.unknown()))}),_xe=w.object({type:w.literal("ref/resource"),uri:w.string()}).passthrough(),Exe=w.object({type:w.literal("ref/prompt"),name:w.string()}).passthrough(),Sxe=Nn.extend({method:w.literal("completion/complete"),params:Pi.extend({ref:w.union([Exe,_xe]),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=qi.extend({completion:w.object({values:w.array(w.string()).max(100),total:w.optional(w.number().int()),hasMore:w.optional(w.boolean())}).passthrough()}),Cxe=w.object({uri:w.string().startsWith("file://"),name:w.optional(w.string()),_meta:w.optional(w.object({}).passthrough())}).passthrough(),Fxe=Nn.extend({method:w.literal("roots/list")}),Axe=qi.extend({roots:w.array(Cxe)}),Oxe=Ga.extend({method:w.literal("notifications/roots/list_changed")}),Kvt=w.union([L6,$ge,Sxe,lxe,txe,exe,Hge,Wge,Gge,Jge,Yge,ED,uxe]),Jvt=w.union([j6,M6,nM,Oxe]),Yvt=w.union([Gc,hxe,wxe,Axe]),Qvt=w.union([L6,mxe,Dxe,Fxe]),Zvt=w.union([j6,M6,SD,Qge,Kge,cxe,axe]),Xvt=w.union([Gc,fD,CD,wD,xD,hD,vD,gD,V6,_D]),Ti=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});var mM=v((o3t,fM)=>{"use strict";var Ixe=/[|\\{}()[\]^$+*?.]/g;fM.exports=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Ixe,"\\$&")}});var af=v((u3t,G6)=>{"use strict";var kxe=mM(),{platform:hM}=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"},vM={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"};hM==="linux"&&(Ka.questionMarkPrefix="?");var W6=hM==="win32"?vM:Ka,Nxe=t=>{if(W6===Ka)return t;for(let[e,r]of Object.entries(Ka))r!==W6[e]&&(t=t.replace(new RegExp(kxe(r),"g"),W6[e]));return t};G6.exports=Object.assign(Nxe,W6);G6.exports.main=Ka;G6.exports.windows=vM});var sf=v((c3t,gM)=>{"use strict";var Bxe=at(),jxe=af(),K6=class{constructor(e){this.type="separator",this.line=Bxe.dim(e||new Array(15).join(jxe.line))}toString(){return this.line}};K6.exclude=function(t){return t.type!=="separator"};gM.exports=K6});var yM=v((xM,bM)=>{var Lxe=ee("stream");xM=bM.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 Lxe;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 wM=v((l3t,DM)=>{var OD=ee("stream");DM.exports=Nr;function Nr(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}Nr.prototype=Object.create(OD.prototype);Object.defineProperty(Nr.prototype,"constructor",{value:Nr,enumerable:!1});Nr.prototype.mute=function(){this.muted=!0};Nr.prototype.unmute=function(){this.muted=!1};Object.defineProperty(Nr.prototype,"_onpipe",{value:Mxe,enumerable:!1,writable:!0,configurable:!0});function Mxe(t){this._src=t}Object.defineProperty(Nr.prototype,"isTTY",{get:$xe,set:Uxe,enumerable:!0,configurable:!0});function $xe(){return this._dest?this._dest.isTTY:this._src?this._src.isTTY:!1}function Uxe(t){Object.defineProperty(this,"isTTY",{value:t,enumerable:!0,writable:!0,configurable:!0})}Object.defineProperty(Nr.prototype,"rows",{get:function(){return this._dest?this._dest.rows:this._src?this._src.rows:void 0},enumerable:!0,configurable:!0});Object.defineProperty(Nr.prototype,"columns",{get:function(){return this._dest?this._dest.columns:this._src?this._src.columns:void 0},enumerable:!0,configurable:!0});Nr.prototype.pipe=function(t,e){return this._dest=t,OD.prototype.pipe.call(this,t,e)};Nr.prototype.pause=function(){if(this._src)return this._src.pause()};Nr.prototype.resume=function(){if(this._src)return this._src.resume()};Nr.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)};Nr.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)}}Nr.prototype.destroy=TD("destroy");Nr.prototype.destroySoon=TD("destroySoon");Nr.prototype.close=TD("close")});var qD=v((p3t,_M)=>{"use strict";var Vxe=wM(),zxe=ee("readline"),PD=class{constructor(e){this.rl||(this.rl=zxe.createInterface(Hxe(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 Hxe(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 Vxe;return r.pipe(t.output||process.stdout),{terminal:!0,...t,input:e,output:r}}_M.exports=PD});var ID=v((d3t,RD)=>{"use strict";var tt=RD.exports;RD.exports.default=tt;var ht="\x1B[",of="\x1B]",Gp="\x07",J6=";",EM=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=EM?"\x1B7":ht+"s";tt.cursorRestorePosition=EM?"\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=Gp;tt.link=(t,e)=>[of,"8",J6,J6,e,Gp,t,of,"8",J6,J6,Gp].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")+Gp};tt.iTerm={setCwd:(t=process.cwd())=>`${of}50;CurrentDir=${t}${Gp}`,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+Gp}}});var Y6=v(Kp=>{"use strict";var uf=ID();Kp.left=function(t,e){t.output.write(uf.cursorBackward(e))};Kp.right=function(t,e){t.output.write(uf.cursorForward(e))};Kp.up=function(t,e){t.output.write(uf.cursorUp(e))};Kp.down=function(t,e){t.output.write(uf.cursorDown(e))};Kp.clearLine=function(t,e){t.output.write(uf.eraseLines(e))}});var CM=v((m3t,SM)=>{"use strict";var Wxe=yM(),Gxe=qD(),kD=Y6(),ND=class extends Gxe{constructor(e={}){super(e),this.log=Wxe(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)}};SM.exports=ND});var BD=v((h3t,FM)=>{var Kxe=typeof global=="object"&&global&&global.Object===Object&&global;FM.exports=Kxe});var ma=v((v3t,AM)=>{var Jxe=BD(),Yxe=typeof self=="object"&&self&&self.Object===Object&&self,Qxe=Jxe||Yxe||Function("return this")();AM.exports=Qxe});var Jp=v((g3t,OM)=>{var Zxe=ma(),Xxe=Zxe.Symbol;OM.exports=Xxe});var RM=v((x3t,qM)=>{var TM=Jp(),PM=Object.prototype,e7e=PM.hasOwnProperty,t7e=PM.toString,cf=TM?TM.toStringTag:void 0;function r7e(t){var e=e7e.call(t,cf),r=t[cf];try{t[cf]=void 0;var n=!0}catch{}var i=t7e.call(t);return n&&(e?t[cf]=r:delete t[cf]),i}qM.exports=r7e});var kM=v((b3t,IM)=>{var n7e=Object.prototype,i7e=n7e.toString;function a7e(t){return i7e.call(t)}IM.exports=a7e});var Kc=v((y3t,jM)=>{var NM=Jp(),s7e=RM(),o7e=kM(),u7e="[object Null]",c7e="[object Undefined]",BM=NM?NM.toStringTag:void 0;function l7e(t){return t==null?t===void 0?c7e:u7e:BM&&BM in Object(t)?s7e(t):o7e(t)}jM.exports=l7e});var jD=v((D3t,LM)=>{function p7e(t,e){return function(r){return t(e(r))}}LM.exports=p7e});var Q6=v((w3t,MM)=>{var d7e=jD(),f7e=d7e(Object.getPrototypeOf,Object);MM.exports=f7e});var Xs=v((_3t,$M)=>{function m7e(t){return t!=null&&typeof t=="object"}$M.exports=m7e});var zM=v((E3t,VM)=>{var h7e=Kc(),v7e=Q6(),g7e=Xs(),x7e="[object Object]",b7e=Function.prototype,y7e=Object.prototype,UM=b7e.toString,D7e=y7e.hasOwnProperty,w7e=UM.call(Object);function _7e(t){if(!g7e(t)||h7e(t)!=x7e)return!1;var e=v7e(t);if(e===null)return!0;var r=D7e.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&UM.call(r)==w7e}VM.exports=_7e});var Ri=v((S3t,HM)=>{var E7e=Array.isArray;HM.exports=E7e});var Z6=v((C3t,WM)=>{var S7e=Kc(),C7e=Xs(),F7e="[object Symbol]";function A7e(t){return typeof t=="symbol"||C7e(t)&&S7e(t)==F7e}WM.exports=A7e});var X6=v((F3t,GM)=>{var O7e=Ri(),T7e=Z6(),P7e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q7e=/^\w*$/;function R7e(t,e){if(O7e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||T7e(t)?!0:q7e.test(t)||!P7e.test(t)||e!=null&&t in Object(e)}GM.exports=R7e});var eo=v((A3t,KM)=>{function I7e(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}KM.exports=I7e});var LD=v((O3t,JM)=>{var k7e=Kc(),N7e=eo(),B7e="[object AsyncFunction]",j7e="[object Function]",L7e="[object GeneratorFunction]",M7e="[object Proxy]";function $7e(t){if(!N7e(t))return!1;var e=k7e(t);return e==j7e||e==L7e||e==B7e||e==M7e}JM.exports=$7e});var QM=v((T3t,YM)=>{var U7e=ma(),V7e=U7e["__core-js_shared__"];YM.exports=V7e});var e$=v((P3t,XM)=>{var MD=QM(),ZM=(function(){var t=/[^.]+$/.exec(MD&&MD.keys&&MD.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function z7e(t){return!!ZM&&ZM in t}XM.exports=z7e});var $D=v((q3t,t$)=>{var H7e=Function.prototype,W7e=H7e.toString;function G7e(t){if(t!=null){try{return W7e.call(t)}catch{}try{return t+""}catch{}}return""}t$.exports=G7e});var n$=v((R3t,r$)=>{var K7e=LD(),J7e=e$(),Y7e=eo(),Q7e=$D(),Z7e=/[\\^$.*+?()[\]{}|]/g,X7e=/^\[object .+?Constructor\]$/,ebe=Function.prototype,tbe=Object.prototype,rbe=ebe.toString,nbe=tbe.hasOwnProperty,ibe=RegExp("^"+rbe.call(nbe).replace(Z7e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function abe(t){if(!Y7e(t)||J7e(t))return!1;var e=K7e(t)?ibe:X7e;return e.test(Q7e(t))}r$.exports=abe});var a$=v((I3t,i$)=>{function sbe(t,e){return t?.[e]}i$.exports=sbe});var Qo=v((k3t,s$)=>{var obe=n$(),ube=a$();function cbe(t,e){var r=ube(t,e);return obe(r)?r:void 0}s$.exports=cbe});var lf=v((N3t,o$)=>{var lbe=Qo(),pbe=lbe(Object,"create");o$.exports=pbe});var l$=v((B3t,c$)=>{var u$=lf();function dbe(){this.__data__=u$?u$(null):{},this.size=0}c$.exports=dbe});var d$=v((j3t,p$)=>{function fbe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}p$.exports=fbe});var m$=v((L3t,f$)=>{var mbe=lf(),hbe="__lodash_hash_undefined__",vbe=Object.prototype,gbe=vbe.hasOwnProperty;function xbe(t){var e=this.__data__;if(mbe){var r=e[t];return r===hbe?void 0:r}return gbe.call(e,t)?e[t]:void 0}f$.exports=xbe});var v$=v((M3t,h$)=>{var bbe=lf(),ybe=Object.prototype,Dbe=ybe.hasOwnProperty;function wbe(t){var e=this.__data__;return bbe?e[t]!==void 0:Dbe.call(e,t)}h$.exports=wbe});var x$=v(($3t,g$)=>{var _be=lf(),Ebe="__lodash_hash_undefined__";function Sbe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_be&&e===void 0?Ebe:e,this}g$.exports=Sbe});var y$=v((U3t,b$)=>{var Cbe=l$(),Fbe=d$(),Abe=m$(),Obe=v$(),Tbe=x$();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=Cbe;Yp.prototype.delete=Fbe;Yp.prototype.get=Abe;Yp.prototype.has=Obe;Yp.prototype.set=Tbe;b$.exports=Yp});var w$=v((V3t,D$)=>{function Pbe(){this.__data__=[],this.size=0}D$.exports=Pbe});var Qp=v((z3t,_$)=>{function qbe(t,e){return t===e||t!==t&&e!==e}_$.exports=qbe});var pf=v((H3t,E$)=>{var Rbe=Qp();function Ibe(t,e){for(var r=t.length;r--;)if(Rbe(t[r][0],e))return r;return-1}E$.exports=Ibe});var C$=v((W3t,S$)=>{var kbe=pf(),Nbe=Array.prototype,Bbe=Nbe.splice;function jbe(t){var e=this.__data__,r=kbe(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Bbe.call(e,r,1),--this.size,!0}S$.exports=jbe});var A$=v((G3t,F$)=>{var Lbe=pf();function Mbe(t){var e=this.__data__,r=Lbe(e,t);return r<0?void 0:e[r][1]}F$.exports=Mbe});var T$=v((K3t,O$)=>{var $be=pf();function Ube(t){return $be(this.__data__,t)>-1}O$.exports=Ube});var q$=v((J3t,P$)=>{var Vbe=pf();function zbe(t,e){var r=this.__data__,n=Vbe(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}P$.exports=zbe});var df=v((Y3t,R$)=>{var Hbe=w$(),Wbe=C$(),Gbe=A$(),Kbe=T$(),Jbe=q$();function Zp(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])}}Zp.prototype.clear=Hbe;Zp.prototype.delete=Wbe;Zp.prototype.get=Gbe;Zp.prototype.has=Kbe;Zp.prototype.set=Jbe;R$.exports=Zp});var e4=v((Q3t,I$)=>{var Ybe=Qo(),Qbe=ma(),Zbe=Ybe(Qbe,"Map");I$.exports=Zbe});var B$=v((Z3t,N$)=>{var k$=y$(),Xbe=df(),eye=e4();function tye(){this.size=0,this.__data__={hash:new k$,map:new(eye||Xbe),string:new k$}}N$.exports=tye});var L$=v((X3t,j$)=>{function rye(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}j$.exports=rye});var ff=v((e5t,M$)=>{var nye=L$();function iye(t,e){var r=t.__data__;return nye(e)?r[typeof e=="string"?"string":"hash"]:r.map}M$.exports=iye});var U$=v((t5t,$$)=>{var aye=ff();function sye(t){var e=aye(this,t).delete(t);return this.size-=e?1:0,e}$$.exports=sye});var z$=v((r5t,V$)=>{var oye=ff();function uye(t){return oye(this,t).get(t)}V$.exports=uye});var W$=v((n5t,H$)=>{var cye=ff();function lye(t){return cye(this,t).has(t)}H$.exports=lye});var K$=v((i5t,G$)=>{var pye=ff();function dye(t,e){var r=pye(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}G$.exports=dye});var t4=v((a5t,J$)=>{var fye=B$(),mye=U$(),hye=z$(),vye=W$(),gye=K$();function Xp(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])}}Xp.prototype.clear=fye;Xp.prototype.delete=mye;Xp.prototype.get=hye;Xp.prototype.has=vye;Xp.prototype.set=gye;J$.exports=Xp});var Z$=v((s5t,Q$)=>{var Y$=t4(),xye="Expected a function";function UD(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(xye);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||Y$),r}UD.Cache=Y$;Q$.exports=UD});var eU=v((o5t,X$)=>{var bye=Z$(),yye=500;function Dye(t){var e=bye(t,function(n){return r.size===yye&&r.clear(),n}),r=e.cache;return e}X$.exports=Dye});var rU=v((u5t,tU)=>{var wye=eU(),_ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Eye=/\\(\\)?/g,Sye=wye(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(_ye,function(r,n,i,a){e.push(i?a.replace(Eye,"$1"):n||r)}),e});tU.exports=Sye});var VD=v((c5t,nU)=>{function Cye(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}nU.exports=Cye});var cU=v((l5t,uU)=>{var iU=Jp(),Fye=VD(),Aye=Ri(),Oye=Z6(),Tye=1/0,aU=iU?iU.prototype:void 0,sU=aU?aU.toString:void 0;function oU(t){if(typeof t=="string")return t;if(Aye(t))return Fye(t,oU)+"";if(Oye(t))return sU?sU.call(t):"";var e=t+"";return e=="0"&&1/t==-Tye?"-0":e}uU.exports=oU});var pU=v((p5t,lU)=>{var Pye=cU();function qye(t){return t==null?"":Pye(t)}lU.exports=qye});var r4=v((d5t,dU)=>{var Rye=Ri(),Iye=X6(),kye=rU(),Nye=pU();function Bye(t,e){return Rye(t)?t:Iye(t,e)?[t]:kye(Nye(t))}dU.exports=Bye});var ed=v((f5t,fU)=>{var jye=Z6(),Lye=1/0;function Mye(t){if(typeof t=="string"||jye(t))return t;var e=t+"";return e=="0"&&1/t==-Lye?"-0":e}fU.exports=Mye});var zD=v((m5t,mU)=>{var $ye=r4(),Uye=ed();function Vye(t,e){e=$ye(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Uye(e[r++])];return r&&r==n?t:void 0}mU.exports=Vye});var HD=v((h5t,hU)=>{var zye=zD();function Hye(t,e,r){var n=t==null?void 0:zye(t,e);return n===void 0?r:n}hU.exports=Hye});var WD=v((v5t,vU)=>{var Wye=Qo(),Gye=(function(){try{var t=Wye(Object,"defineProperty");return t({},"",{}),t}catch{}})();vU.exports=Gye});var GD=v((g5t,xU)=>{var gU=WD();function Kye(t,e,r){e=="__proto__"&&gU?gU(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}xU.exports=Kye});var n4=v((x5t,bU)=>{var Jye=GD(),Yye=Qp(),Qye=Object.prototype,Zye=Qye.hasOwnProperty;function Xye(t,e,r){var n=t[e];(!(Zye.call(t,e)&&Yye(n,r))||r===void 0&&!(e in t))&&Jye(t,e,r)}bU.exports=Xye});var mf=v((b5t,yU)=>{var eDe=9007199254740991,tDe=/^(?:0|[1-9]\d*)$/;function rDe(t,e){var r=typeof t;return e=e??eDe,!!e&&(r=="number"||r!="symbol"&&tDe.test(t))&&t>-1&&t%1==0&&t<e}yU.exports=rDe});var _U=v((y5t,wU)=>{var nDe=n4(),iDe=r4(),aDe=mf(),DU=eo(),sDe=ed();function oDe(t,e,r,n){if(!DU(t))return t;e=iDe(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var c=sDe(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=DU(d)?d:aDe(e[i+1])?[]:{})}nDe(o,c,l),o=o[c]}return t}wU.exports=oDe});var SU=v((D5t,EU)=>{var uDe=_U();function cDe(t,e,r){return t==null?t:uDe(t,e,r)}EU.exports=cDe});var vt=v(i4=>{"use strict";Object.defineProperty(i4,"__esModule",{value:!0});i4.isFunction=void 0;function lDe(t){return typeof t=="function"}i4.isFunction=lDe});var Zo=v(a4=>{"use strict";Object.defineProperty(a4,"__esModule",{value:!0});a4.createErrorClass=void 0;function pDe(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}a4.createErrorClass=pDe});var KD=v(s4=>{"use strict";Object.defineProperty(s4,"__esModule",{value:!0});s4.UnsubscriptionError=void 0;var dDe=Zo();s4.UnsubscriptionError=dDe.createErrorClass(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
@@ -368,7 +368,7 @@ ${ch.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(ch.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(ch.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 An=ye(at(),1);var _B=ye(wB(),1),{program:A4t,createCommand:O4t,createArgument:T4t,createOption:P4t,CommanderError:q4t,InvalidArgumentError:R4t,InvalidOptionArgumentError:I4t,Command:EB,Argument:k4t,Option:N4t,Help:B4t}=_B.default;var En=ye(at(),1);import{existsSync as Ap,mkdirSync as n5e,readFileSync as i5e,statSync as a5e}from"node:fs";import{dirname as CB,join as s5e,resolve as Ey}from"node:path";import*as h6 from"esbuild";function SB(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function o5e(t){if(t){let a=Ey(process.cwd(),t);if(!Ap(a))throw new Error(`Entry file not found at ${a}`);return a}let e=s5e(process.cwd(),"package.json");if(!Ap(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=i5e(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(!Ap(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 u5e(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(Ap(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 c5e(t,e){let r=performance.now(),n=t.outFile||".smithery/index.cjs",i=t.transport??"shttp",a=CB(n);Ap(a)||n5e(a,{recursive:!0});let s=i==="shttp"?"streamable http":i;console.log(En.default.dim(`${En.default.bold.italic.hex("#ea580c")("SMITHERY")} ${En.default.bold.italic.hex("#ea580c")("v1.5.
|
|
371
|
+
Check that the file exists or update your package.json`);return i}async function u5e(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(Ap(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 c5e(t,e){let r=performance.now(),n=t.outFile||".smithery/index.cjs",i=t.transport??"shttp",a=CB(n);Ap(a)||n5e(a,{recursive:!0});let s=i==="shttp"?"streamable http":i;console.log(En.default.dim(`${En.default.bold.italic.hex("#ea580c")("SMITHERY")} ${En.default.bold.italic.hex("#ea580c")("v1.5.1")} Building MCP server with ${En.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";
|
|
@@ -576,7 +576,7 @@ o/ Shutting down server...`)),f&&"dispose"in f&&await f.dispose(),s&&await E6({c
|
|
|
576
576
|
`:". ";let a=i;if(i.length>1e4){let s=i.substring(0,1e4),o=i.length-1e4;a=`${s}...and ${o} more chars`}e+=`Body: ${a}`,e=e.trim(),super(e,r),this.name="APIError"}};hr();hr();var E0=class extends Error{static[Symbol.hasInstance](e){return!(!(e instanceof Error)||!("rawValue"in e)||!("rawMessage"in e)||!("pretty"in e)||typeof e.pretty!="function")}constructor(e,r,n){super(`${e}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=e}pretty(){return this.cause instanceof kr?`${this.rawMessage}
|
|
577
577
|
${$9(this.cause)}`:this.toString()}};function $9(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(`${$9(d,e+1)}`)})}}}return t.issues.length&&i("\u2514\u2500*"),n.slice(1)}var U9=class extends Ki{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 kr?`${this.rawMessage}
|
|
579
|
-
${$9(this.cause)}`:this.toString()}};var Trt={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 V9(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function S0(t){return{enc:"fail",codes:t}}function z9(...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:Trt[f.enc];if(g&&Xre(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=fne(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[fne(d,f=>s.schema.parse(f),"Response validation failed",{request:n,response:r,body:c}),a]}}var Prt=/, */;function kA(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Prt);return e}function fne(t,e,r,n){try{return Sl(e(t))}catch(i){return Ea(new U9(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 H9(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function ai(t,e,r){try{return Sl(e(t))}catch(n){return Ea(new E0(r,n,t))}}function hne(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 G9;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(G9||(G9={}));var NA=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(G9.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(G9.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};function qrt(...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":Rrt(e,n);break;case"http:custom":break;case"http:bearer":W9(e,n);break;case"oauth2":W9(e,n);break;case"oauth2:password":W9(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":W9(e,n);break;default:throw NA.unrecognizedType(i)}}),e)}function Rrt(t,e){e.value!=null&&(t.basic=e.value)}function W9(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 K9(t){return qrt([{fieldName:"Authorization",type:"http:bearer",value:t?.bearerAuth??B9().SMITHERY_BEARER_AUTH}])}async function J9(t){if(t!=null)return typeof t=="function"?t():t}hr();var Irt={Http:"http",Stdio:"stdio"},krt={Node:"node"},BA=zp(Irt),bne=BA,vne;(function(t){t.inboundSchema=BA,t.outboundSchema=bne})(vne||(vne={}));var jA=zp(krt),yne=jA,gne;(function(t){t.inboundSchema=jA,t.outboundSchema=yne})(gne||(gne={}));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:bne,deploymentUrl:be().optional(),configSchema:Jo(Ys()),published:Wa().optional(),stdioFunction:be().optional(),bundleUrl:be().optional(),runtime:yne.optional()}),xne;(function(t){t.inboundSchema=LA,t.outboundSchema=MA})(xne||(xne={}));hr();var $A=Fe({currentPage:Er().int(),pageSize:Er().int(),totalPages:Er().int(),totalCount:Er().int()}),UA=Fe({currentPage:Er().int(),pageSize:Er().int(),totalPages:Er().int(),totalCount:Er().int()}),Dne;(function(t){t.inboundSchema=$A,t.outboundSchema=UA})(Dne||(Dne={}));hr();var Nrt=Fe({bearerAuth:be().optional()}),Brt=Fe({bearerAuth:be().optional()}),wne;(function(t){t.inboundSchema=Nrt,t.outboundSchema=Brt})(wne||(wne={}));hr();hr();var jrt={Object:"object"},VA=zp(jrt),Cne=VA,_ne;(function(t){t.inboundSchema=VA,t.outboundSchema=Cne})(_ne||(_ne={}));var Fne=hne(Fe({type:VA,properties:Jo(Ys()).optional()}).catchall(Ys()),"additionalProperties",!0),Ane=Fe({type:Cne,properties:Jo(Ys()).optional(),additionalProperties:Jo(Ys())}).transform(t=>({...t.additionalProperties,...Dm(t,{additionalProperties:null})})),Ene;(function(t){t.inboundSchema=Fne,t.outboundSchema=Ane})(Ene||(Ene={}));var zA=Fe({name:be(),description:ti(be()).optional(),inputSchema:Wc(()=>Fne)}),HA=Fe({name:be(),description:ti(be()).optional(),inputSchema:Wc(()=>Ane)}),Sne;(function(t){t.inboundSchema=zA,t.outboundSchema=HA})(Sne||(Sne={}));var Pne=Fe({scanPassed:ti(Wa()).optional()}),qne=Fe({scanPassed:ti(Wa()).optional()}),One;(function(t){t.inboundSchema=Pne,t.outboundSchema=qne})(One||(One={}));var WA=Fe({qualifiedName:be(),displayName:be(),iconUrl:ti(be()).optional(),remote:Wa().optional(),connections:Qs(LA),security:ti(Wc(()=>Pne)).optional(),tools:ti(Qs(zA)).optional()}),Lrt=Fe({qualifiedName:be(),displayName:be(),iconUrl:ti(be()).optional(),remote:Wa().optional(),connections:Qs(MA),security:ti(Wc(()=>qne)).optional(),tools:ti(Qs(HA)).optional()}),Tne;(function(t){t.inboundSchema=WA,t.outboundSchema=Lrt})(Tne||(Tne={}));hr();var GA=Fe({qualifiedName:be(),displayName:be(),description:be(),homepage:be(),useCount:Er().int(),createdAt:be().datetime({offset:!0}).transform(t=>new Date(t))}),KA=Fe({qualifiedName:be(),displayName:be(),description:be(),homepage:be(),useCount:Er().int(),createdAt:lD().transform(t=>t.toISOString())}),Rne;(function(t){t.inboundSchema=GA,t.outboundSchema=KA})(Rne||(Rne={}));hr();var JA=Fe({servers:Qs(GA),pagination:$A}),YA=Fe({servers:Qs(KA),pagination:UA}),Ine;(function(t){t.inboundSchema=JA,t.outboundSchema=YA})(Ine||(Ine={}));hr();var Y9=class extends Ki{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$:fn(Request),response$:fn(Response),body$:be()}).transform(t=>new Y9(t,{request:t.request$,response:t.response$,body:t.body$})),Mrt=fn(Y9).transform(t=>t.data$).pipe(Fe({error:be().optional()})),Nne;(function(t){t.inboundSchema=QA,t.outboundSchema=Mrt})(Nne||(Nne={}));hr();var C0=class extends Ki{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$:fn(Request),response$:fn(Response),body$:be()}).transform(t=>new C0(t,{request:t.request$,response:t.response$,body:t.body$})),$rt=fn(C0).transform(t=>t.data$).pipe(Fe({error:be().optional()})),Bne;(function(t){t.inboundSchema=wm,t.outboundSchema=$rt})(Bne||(Bne={}));hr();var Fl=class extends Ki{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$:fn(Request),response$:fn(Response),body$:be()}).transform(t=>new Fl(t,{request:t.request$,response:t.response$,body:t.body$})),Urt=fn(Fl).transform(t=>t.data$).pipe(Fe({error:be().optional()})),jne;(function(t){t.inboundSchema=_m,t.outboundSchema=Urt})(jne||(jne={}));hr();var Vrt=Fe({qualifiedName:be()}),ZA=Fe({qualifiedName:be()}),Mne;(function(t){t.inboundSchema=Vrt,t.outboundSchema=ZA})(Mne||(Mne={}));hr();var zrt=Fe({q:be().optional(),page:Er().int().default(1),pageSize:Er().int().default(10)}),XA=Fe({q:be().optional(),page:Er().int().default(1),pageSize:Er().int().default(10)}),$ne;(function(t){t.inboundSchema=zrt,t.outboundSchema=XA})($ne||($ne={}));var eO=Fe({Result:JA}).transform(t=>Dm(t,{Result:"result"})),Hrt=Fe({result:YA}).transform(t=>Dm(t,{result:"Result"})),Une;(function(t){t.inboundSchema=eO,t.outboundSchema=Hrt})(Une||(Une={}));var zne=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)},F0,Sm,Hne,A0=class{constructor(e){F0.set(this,void 0),Sm.set(this,void 0),this[Hne]="APIPromise",zne(this,F0,e instanceof Promise?e:Promise.resolve(e),"f"),zne(this,Sm,e instanceof Promise?Em(this,F0,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return Em(this,F0,"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,F0,"f")}};F0=new WeakMap,Sm=new WeakMap,Hne=Symbol.toStringTag;function Wne(t,e,r){return new A0(Wrt(t,e,r))}async function Wrt(t,e,r){let n=ai(e,A=>ZA.parse(A),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let i=n.value,a=null,s={qualifiedName:ane("qualifiedName",i.qualifiedName,{explode:!1,charEncoding:"percent"})},o=D0("/servers/{qualifiedName}")(s),c=new Headers(H9({Accept:"application/json"})),l=await J9(t._options.bearerAuth),d=l==null?{}:{bearerAuth:l},f=K9(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 z9(V9(200,WA),Cl(401,_m),Cl(404,QA),Cl(500,wm),S0("4XX"),S0("5XX"))(y,b,{extraFields:_});return S.ok?[S,{status:"complete",request:b,response:y}]:[S,{status:"complete",request:b,response:y}]}function Gne(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 Kne(t){let e=await t;if(!e.ok)throw e.error;return{...e.value,next:Jne(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 Jne(t){return()=>{let e=t();return e==null?null:e.then(r=>{if(!r.ok)throw r.error;return{...r.value,next:Jne(r.next)}})}}var eFt=Symbol("URL_OVERRIDE");function tO(t,e,r){return new A0(Grt(t,e,r))}async function Grt(t,e,r){let n=ai(e,I=>XA.parse(I),"Input validation failed");if(!n.ok)return[Cm(n),{status:"invalid"}];let i=n.value,a=null,s=D0("/servers")(),o=cne({page:i.page,pageSize:i.pageSize,q:i.q}),c=new Headers(H9({Accept:"application/json"})),l=await J9(t._options.bearerAuth),d=l==null?{}:{bearerAuth:l},f=K9(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 z9(V9(200,eO,{key:"Result"}),Cl(401,_m),Cl(500,wm),S0("4XX"),S0("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,...Gne(q,I=>!I.ok)},{status:"complete",request:b,response:y}]}var Q9=class extends _0{async list(e,r){return Kne(tO(this,e,r))}async get(e,r){return tne(Wne(this,e,r))}};var Fm=class extends _0{get servers(){return this._servers??(this._servers=new Q9(this._options))}};var Yie=ye(rie(),1);hr();var nie=w.lazy(()=>w.object({type:w.string().optional(),properties:w.record(nie).optional(),items:nie.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.")}),pnt=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).")}),dnt=w.object({deploymentUrl:w.string().describe("The URL of the Streamable HTTP server.")}),FFt=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.")}),AFt=w.union([w.object({type:w.literal("stdio"),...iO.shape}),w.object({type:w.literal("stdio"),...pnt.shape}),w.object({type:w.literal("http"),...dnt.shape})]);var sie=ye(ni(),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??fnt()}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)}},fnt=()=>{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++]}},iie,aie=()=>mnt().toString(),mnt=()=>(iie||(iie=new aO)).generate();var Al=null,hnt=1800*1e3,Om=null;var oie=()=>{Om&&clearTimeout(Om);let t=Date.now();return Al={id:aie(),startTime:t,lastActivityTime:t},Al},vnt=()=>{if(!Al){oie();return}let t=Date.now();Al.lastActivityTime=t,Om&&clearTimeout(Om),Om=setTimeout(()=>{Al=null},hnt)},tg=()=>(Al||oie(),vnt(),Al.id);async function uie(){let t=await ls();if(!t.success){console.warn("[Analytics] Failed to initialize settings:",t.error);return}if(await i9())return;if(!await Mee())try{let{EnableAnalytics:n}=await sie.default.prompt([{type:"confirm",name:"EnableAnalytics",message:'Would you like to help improve Smithery by sending anonymized usage data?")}',default:!0}]),i=await Lee(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 Jie=ye(ug(),1),pit=5e3,dit={initialInterval:1e3,maxInterval:4e3,exponent:2,maxElapsedTime:15e3},ql=async(t,e={},r={})=>{let n=r.timeout??pit,i={...dit,...r.backoff},a=Date.now(),s=0,o;for(;;){let c=new AbortController,l=setTimeout(()=>c.abort(),n);try{let d=await(0,Jie.default)(t,{...e,signal:c.signal});if(clearTimeout(l),!d.ok&&(d.status<500||d.status>=600)){let f=await d.text().catch(()=>"");throw new Error(`HTTP ${d.status}: ${f||d.statusText}`)}return d}catch(d){if(clearTimeout(l),d instanceof Error){if(d.message.startsWith("HTTP "))throw d;d.name==="AbortError"?o=new Error(`Request timed out after ${n}ms when calling ${t}`):o=d}else 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++}}};ei();(0,Yie.config)({quiet:!0});var jm=()=>{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},Qie=t=>{let e={bearerAuth:t??process.env.SMITHERY_BEARER_AUTH??"",timeoutMs:5e3,retryConfig:{strategy:"backoff",backoff:{initialInterval:1e3,maxInterval:4e3,exponent:2,maxElapsedTime:15e3},retryConnectionErrors:!0}};return process.env.NODE_ENV==="development"&&process.env.LOCAL_REGISTRY_ENDPOINT&&(e.serverURL=process.env.LOCAL_REGISTRY_ENDPOINT),e};var N0=async(t,e,r)=>{Op&&(async()=>{try{let a=tg(),s=await Bee();await ql(Op,{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=Qie(e),i=new Fm(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 E0?(V(`SDK validation error: ${a.pretty()}`),V(JSON.stringify(a.rawValue)),a):a instanceof Fl?(V(`Unauthorized: ${a.message}`),a):a instanceof C0?(V(`Server error: ${a.message}`),a):a instanceof Error?(V(`Unknown error: ${a.message}`),a):new Error(`Failed to resolve package: ${String(a)}`)}},Zie=async(t,e,r)=>{let n=jm();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 ql(`${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}},Xie=async(t,e,r)=>{let n=jm();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 ql(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}},eae=async(t,e,r,n)=>{let i=jm();V(`Saving user config for ${t} to registry at ${i}`),V(`Config to save (keys: ${Object.keys(e).join(", ")})`);try{let a={config:e};V(`Sending config save request for ${t}`);let s={"Content-Type":"application/json",Authorization:`Bearer ${r}`},o=new URL(`${i}/config/${encodeURIComponent(t)}`);n&&o.searchParams.set("profile",n);let c=await ql(o.toString(),{method:"PUT",headers:s,body:JSON.stringify(a)});if(V(`Response status: ${c.status}`),!c.ok){let d=await c.text();throw V(`Error response: ${d}`),new Error(`Config save request failed with status ${c.status}: ${d}`)}V("Successfully saved user config to registry");let l=await c.json();if(V(`Config save response received (success: ${l.success})`),!l.success)throw new Error(l.message||"Failed to save user configuration")}catch(a){throw V(`Config save error: ${a instanceof Error?a.message:String(a)}`),a instanceof Error?new Error(`Failed to save user config: ${a.message}`):a}},yO=async(t,e)=>{let r=jm();V(`Searching servers for term: ${t}`);try{let n=await ql(`${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}},tae=async(t,e,r)=>{let n=jm();V(`Validating user config for ${t}`);try{let i=new URL(`${n}/config/status/${encodeURIComponent(t)}`);r&&i.searchParams.set("profile",r);let a=await ql(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok)throw new Error(`Config validation failed: ${a.statusText}`);let s=await a.json();return V(`Config validation result: ${JSON.stringify(s,null,2)}`),s}catch(i){throw V(`Config validation error: ${i instanceof Error?i.message:String(i)}`),i instanceof Error?new Error(`Failed to validate config: ${i.message}`):i}},rae=async t=>{let e=Qie(t),r=new Fm(e);V("Validating API key with Smithery SDK");try{return await r.servers.list({pageSize:1}),V("API key validation successful"),!0}catch(n){throw V(`API key validation failed: ${JSON.stringify(n)}`),n instanceof Fl&&V("API key is invalid (unauthorized)"),n}};var wO=ye(at(),1),_O=ye(ni(),1);Lu();async function git(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(d===void 0)continue;n[s]=xit(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(`
|
|
579
|
+
${$9(this.cause)}`:this.toString()}};var Trt={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 V9(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function S0(t){return{enc:"fail",codes:t}}function z9(...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:Trt[f.enc];if(g&&Xre(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=fne(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[fne(d,f=>s.schema.parse(f),"Response validation failed",{request:n,response:r,body:c}),a]}}var Prt=/, */;function kA(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Prt);return e}function fne(t,e,r,n){try{return Sl(e(t))}catch(i){return Ea(new U9(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 H9(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function ai(t,e,r){try{return Sl(e(t))}catch(n){return Ea(new E0(r,n,t))}}function hne(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 G9;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(G9||(G9={}));var NA=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(G9.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(G9.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};function qrt(...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":Rrt(e,n);break;case"http:custom":break;case"http:bearer":W9(e,n);break;case"oauth2":W9(e,n);break;case"oauth2:password":W9(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":W9(e,n);break;default:throw NA.unrecognizedType(i)}}),e)}function Rrt(t,e){e.value!=null&&(t.basic=e.value)}function W9(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 K9(t){return qrt([{fieldName:"Authorization",type:"http:bearer",value:t?.bearerAuth??B9().SMITHERY_BEARER_AUTH}])}async function J9(t){if(t!=null)return typeof t=="function"?t():t}hr();var Irt={Http:"http",Stdio:"stdio"},krt={Node:"node"},BA=zp(Irt),bne=BA,vne;(function(t){t.inboundSchema=BA,t.outboundSchema=bne})(vne||(vne={}));var jA=zp(krt),yne=jA,gne;(function(t){t.inboundSchema=jA,t.outboundSchema=yne})(gne||(gne={}));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:bne,deploymentUrl:be().optional(),configSchema:Jo(Ys()),published:Wa().optional(),stdioFunction:be().optional(),bundleUrl:be().optional(),runtime:yne.optional()}),xne;(function(t){t.inboundSchema=LA,t.outboundSchema=MA})(xne||(xne={}));hr();var $A=Fe({currentPage:Er().int(),pageSize:Er().int(),totalPages:Er().int(),totalCount:Er().int()}),UA=Fe({currentPage:Er().int(),pageSize:Er().int(),totalPages:Er().int(),totalCount:Er().int()}),Dne;(function(t){t.inboundSchema=$A,t.outboundSchema=UA})(Dne||(Dne={}));hr();var Nrt=Fe({bearerAuth:be().optional()}),Brt=Fe({bearerAuth:be().optional()}),wne;(function(t){t.inboundSchema=Nrt,t.outboundSchema=Brt})(wne||(wne={}));hr();hr();var jrt={Object:"object"},VA=zp(jrt),Cne=VA,_ne;(function(t){t.inboundSchema=VA,t.outboundSchema=Cne})(_ne||(_ne={}));var Fne=hne(Fe({type:VA,properties:Jo(Ys()).optional()}).catchall(Ys()),"additionalProperties",!0),Ane=Fe({type:Cne,properties:Jo(Ys()).optional(),additionalProperties:Jo(Ys())}).transform(t=>({...t.additionalProperties,...Dm(t,{additionalProperties:null})})),Ene;(function(t){t.inboundSchema=Fne,t.outboundSchema=Ane})(Ene||(Ene={}));var zA=Fe({name:be(),description:ti(be()).optional(),inputSchema:Wc(()=>Fne)}),HA=Fe({name:be(),description:ti(be()).optional(),inputSchema:Wc(()=>Ane)}),Sne;(function(t){t.inboundSchema=zA,t.outboundSchema=HA})(Sne||(Sne={}));var Pne=Fe({scanPassed:ti(Wa()).optional()}),qne=Fe({scanPassed:ti(Wa()).optional()}),One;(function(t){t.inboundSchema=Pne,t.outboundSchema=qne})(One||(One={}));var WA=Fe({qualifiedName:be(),displayName:be(),iconUrl:ti(be()).optional(),remote:Wa().optional(),connections:Qs(LA),security:ti(Wc(()=>Pne)).optional(),tools:ti(Qs(zA)).optional()}),Lrt=Fe({qualifiedName:be(),displayName:be(),iconUrl:ti(be()).optional(),remote:Wa().optional(),connections:Qs(MA),security:ti(Wc(()=>qne)).optional(),tools:ti(Qs(HA)).optional()}),Tne;(function(t){t.inboundSchema=WA,t.outboundSchema=Lrt})(Tne||(Tne={}));hr();var GA=Fe({qualifiedName:be(),displayName:be(),description:be(),homepage:be(),useCount:Er().int(),createdAt:be().datetime({offset:!0}).transform(t=>new Date(t))}),KA=Fe({qualifiedName:be(),displayName:be(),description:be(),homepage:be(),useCount:Er().int(),createdAt:lD().transform(t=>t.toISOString())}),Rne;(function(t){t.inboundSchema=GA,t.outboundSchema=KA})(Rne||(Rne={}));hr();var JA=Fe({servers:Qs(GA),pagination:$A}),YA=Fe({servers:Qs(KA),pagination:UA}),Ine;(function(t){t.inboundSchema=JA,t.outboundSchema=YA})(Ine||(Ine={}));hr();var Y9=class extends Ki{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$:fn(Request),response$:fn(Response),body$:be()}).transform(t=>new Y9(t,{request:t.request$,response:t.response$,body:t.body$})),Mrt=fn(Y9).transform(t=>t.data$).pipe(Fe({error:be().optional()})),Nne;(function(t){t.inboundSchema=QA,t.outboundSchema=Mrt})(Nne||(Nne={}));hr();var C0=class extends Ki{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$:fn(Request),response$:fn(Response),body$:be()}).transform(t=>new C0(t,{request:t.request$,response:t.response$,body:t.body$})),$rt=fn(C0).transform(t=>t.data$).pipe(Fe({error:be().optional()})),Bne;(function(t){t.inboundSchema=wm,t.outboundSchema=$rt})(Bne||(Bne={}));hr();var Fl=class extends Ki{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$:fn(Request),response$:fn(Response),body$:be()}).transform(t=>new Fl(t,{request:t.request$,response:t.response$,body:t.body$})),Urt=fn(Fl).transform(t=>t.data$).pipe(Fe({error:be().optional()})),jne;(function(t){t.inboundSchema=_m,t.outboundSchema=Urt})(jne||(jne={}));hr();var Vrt=Fe({qualifiedName:be()}),ZA=Fe({qualifiedName:be()}),Mne;(function(t){t.inboundSchema=Vrt,t.outboundSchema=ZA})(Mne||(Mne={}));hr();var zrt=Fe({q:be().optional(),page:Er().int().default(1),pageSize:Er().int().default(10)}),XA=Fe({q:be().optional(),page:Er().int().default(1),pageSize:Er().int().default(10)}),$ne;(function(t){t.inboundSchema=zrt,t.outboundSchema=XA})($ne||($ne={}));var eO=Fe({Result:JA}).transform(t=>Dm(t,{Result:"result"})),Hrt=Fe({result:YA}).transform(t=>Dm(t,{result:"Result"})),Une;(function(t){t.inboundSchema=eO,t.outboundSchema=Hrt})(Une||(Une={}));var zne=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)},F0,Sm,Hne,A0=class{constructor(e){F0.set(this,void 0),Sm.set(this,void 0),this[Hne]="APIPromise",zne(this,F0,e instanceof Promise?e:Promise.resolve(e),"f"),zne(this,Sm,e instanceof Promise?Em(this,F0,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return Em(this,F0,"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,F0,"f")}};F0=new WeakMap,Sm=new WeakMap,Hne=Symbol.toStringTag;function Wne(t,e,r){return new A0(Wrt(t,e,r))}async function Wrt(t,e,r){let n=ai(e,A=>ZA.parse(A),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let i=n.value,a=null,s={qualifiedName:ane("qualifiedName",i.qualifiedName,{explode:!1,charEncoding:"percent"})},o=D0("/servers/{qualifiedName}")(s),c=new Headers(H9({Accept:"application/json"})),l=await J9(t._options.bearerAuth),d=l==null?{}:{bearerAuth:l},f=K9(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 z9(V9(200,WA),Cl(401,_m),Cl(404,QA),Cl(500,wm),S0("4XX"),S0("5XX"))(y,b,{extraFields:_});return S.ok?[S,{status:"complete",request:b,response:y}]:[S,{status:"complete",request:b,response:y}]}function Gne(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 Kne(t){let e=await t;if(!e.ok)throw e.error;return{...e.value,next:Jne(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 Jne(t){return()=>{let e=t();return e==null?null:e.then(r=>{if(!r.ok)throw r.error;return{...r.value,next:Jne(r.next)}})}}var eFt=Symbol("URL_OVERRIDE");function tO(t,e,r){return new A0(Grt(t,e,r))}async function Grt(t,e,r){let n=ai(e,I=>XA.parse(I),"Input validation failed");if(!n.ok)return[Cm(n),{status:"invalid"}];let i=n.value,a=null,s=D0("/servers")(),o=cne({page:i.page,pageSize:i.pageSize,q:i.q}),c=new Headers(H9({Accept:"application/json"})),l=await J9(t._options.bearerAuth),d=l==null?{}:{bearerAuth:l},f=K9(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 z9(V9(200,eO,{key:"Result"}),Cl(401,_m),Cl(500,wm),S0("4XX"),S0("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,...Gne(q,I=>!I.ok)},{status:"complete",request:b,response:y}]}var Q9=class extends _0{async list(e,r){return Kne(tO(this,e,r))}async get(e,r){return tne(Wne(this,e,r))}};var Fm=class extends _0{get servers(){return this._servers??(this._servers=new Q9(this._options))}};var Yie=ye(rie(),1);hr();var nie=w.lazy(()=>w.object({type:w.string().optional(),properties:w.record(nie).optional(),items:nie.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.")}),pnt=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).")}),dnt=w.object({deploymentUrl:w.string().describe("The URL of the Streamable HTTP server.")}),FFt=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.")}),AFt=w.union([w.object({type:w.literal("stdio"),...iO.shape}),w.object({type:w.literal("stdio"),...pnt.shape}),w.object({type:w.literal("http"),...dnt.shape})]);var sie=ye(ni(),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??fnt()}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)}},fnt=()=>{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++]}},iie,aie=()=>mnt().toString(),mnt=()=>(iie||(iie=new aO)).generate();var Al=null,hnt=1800*1e3,Om=null;var oie=()=>{Om&&clearTimeout(Om);let t=Date.now();return Al={id:aie(),startTime:t,lastActivityTime:t},Al},vnt=()=>{if(!Al){oie();return}let t=Date.now();Al.lastActivityTime=t,Om&&clearTimeout(Om),Om=setTimeout(()=>{Al=null},hnt)},tg=()=>(Al||oie(),vnt(),Al.id);async function uie(){let t=await ls();if(!t.success){console.warn("[Analytics] Failed to initialize settings:",t.error);return}if(await i9())return;if(!await Mee())try{let{EnableAnalytics:n}=await sie.default.prompt([{type:"confirm",name:"EnableAnalytics",message:'Would you like to help improve Smithery by sending anonymized usage data?")}',default:!0}]),i=await Lee(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 Jie=ye(ug(),1),pit=5e3,dit={initialInterval:1e3,maxInterval:4e3,exponent:2,maxElapsedTime:15e3},ql=async(t,e={},r={})=>{let n=r.timeout??pit,i={...dit,...r.backoff},a=Date.now(),s=0,o;for(;;){let c=new AbortController,l=setTimeout(()=>c.abort(),n);try{let d=await(0,Jie.default)(t,{...e,signal:c.signal});if(clearTimeout(l),!d.ok&&(d.status<500||d.status>=600)){let f=await d.text().catch(()=>"");throw new Error(`HTTP ${d.status}: ${f||d.statusText}`)}return d}catch(d){if(clearTimeout(l),d instanceof Error){if(d.message.startsWith("HTTP "))throw d;d.name==="AbortError"?o=new Error(`Request timed out after ${n}ms when calling ${t}`):o=d}else 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++}}};ei();(0,Yie.config)({quiet:!0});var jm=()=>{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},Qie=t=>{let e={bearerAuth:t??process.env.SMITHERY_BEARER_AUTH??"",timeoutMs:5e3,retryConfig:{strategy:"backoff",backoff:{initialInterval:1e3,maxInterval:4e3,exponent:2,maxElapsedTime:15e3},retryConnectionErrors:!0}};return process.env.NODE_ENV==="development"&&process.env.LOCAL_REGISTRY_ENDPOINT&&(e.serverURL=process.env.LOCAL_REGISTRY_ENDPOINT),e};var N0=async(t,e,r)=>{Op&&(async()=>{try{let a=tg(),s=await Bee();await ql(Op,{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=Qie(e),i=new Fm(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 E0?(V(`SDK validation error: ${a.pretty()}`),V(JSON.stringify(a.rawValue)),a):a instanceof Fl?(V(`Unauthorized: ${a.message}`),a):a instanceof C0?(V(`Server error: ${a.message}`),a):a instanceof Error?(V(`Unknown error: ${a.message}`),a):new Error(`Failed to resolve package: ${String(a)}`)}},Zie=async(t,e,r)=>{let n=jm();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 ql(`${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}},Xie=async(t,e,r)=>{let n=jm();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 ql(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){if(i instanceof Error&&i.message.startsWith("HTTP 404"))return V("No saved config found (404)"),null;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}},eae=async(t,e,r,n)=>{let i=jm();V(`Saving user config for ${t} to registry at ${i}`),V(`Config to save (keys: ${Object.keys(e).join(", ")})`);try{let a={config:e};V(`Sending config save request for ${t}`);let s={"Content-Type":"application/json",Authorization:`Bearer ${r}`},o=new URL(`${i}/config/${encodeURIComponent(t)}`);n&&o.searchParams.set("profile",n);let c=await ql(o.toString(),{method:"PUT",headers:s,body:JSON.stringify(a)});if(V(`Response status: ${c.status}`),!c.ok){let d=await c.text();throw V(`Error response: ${d}`),new Error(`Config save request failed with status ${c.status}: ${d}`)}V("Successfully saved user config to registry");let l=await c.json();if(V(`Config save response received (success: ${l.success})`),!l.success)throw new Error(l.message||"Failed to save user configuration")}catch(a){throw V(`Config save error: ${a instanceof Error?a.message:String(a)}`),a instanceof Error?new Error(`Failed to save user config: ${a.message}`):a}},yO=async(t,e)=>{let r=jm();V(`Searching servers for term: ${t}`);try{let n=await ql(`${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}},tae=async(t,e,r)=>{let n=jm();V(`Validating user config for ${t}`);try{let i=new URL(`${n}/config/status/${encodeURIComponent(t)}`);r&&i.searchParams.set("profile",r);let a=await ql(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok)throw new Error(`Config validation failed: ${a.statusText}`);let s=await a.json();return V(`Config validation result: ${JSON.stringify(s,null,2)}`),s}catch(i){throw V(`Config validation error: ${i instanceof Error?i.message:String(i)}`),i instanceof Error?new Error(`Failed to validate config: ${i.message}`):i}},rae=async t=>{let e=Qie(t),r=new Fm(e);V("Validating API key with Smithery SDK");try{return await r.servers.list({pageSize:1}),V("API key validation successful"),!0}catch(n){throw V(`API key validation failed: ${JSON.stringify(n)}`),n instanceof Fl&&V("API key is invalid (unauthorized)"),n}};var wO=ye(at(),1),_O=ye(ni(),1);Lu();async function git(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(d===void 0)continue;n[s]=xit(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
580
|
`))}return n}function xit(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 Rl(t,e){if(!t.configSchema?.properties)return{};let r=e||{},n=t.configSchema.properties,i=new Set(t.configSchema.required||[]),a={};for(let[c,l]of Object.entries(n)){let{description:d,default:f,type:m}=l;if(r[c]!==void 0){a[c]=r[c];continue}if(i.has(c)){let g=await aae(c,{description:d,default:f,type:m},i);a[c]=g!==void 0?g:f}}let s=Object.keys(n).some(c=>!i.has(c)&&r[c]===void 0),o=!1;if(s){let{configure:c}=await _O.default.prompt([{type:"confirm",name:"configure",message:"Would you like to add optional configuration?",default:!1}]);o=c}if(o)for(let[c,l]of Object.entries(n)){let{description:d,default:f,type:m}=l;if(a[c]!==void 0||i.has(c))continue;let g=await aae(c,{description:d,default:f,type:m},i);(g!==void 0||f!==void 0)&&(a[c]=g!==void 0?g:f)}try{return await git(t,a)}catch(c){let l=c instanceof Error?c.message:"Unknown configuration error";return console.error(wO.default.red("Configuration error:"),l),a}}async function aae(t,e,r){let n=r.has(t)?wO.default.red(" (required)"):" (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 _O.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 sae(t){if(t.startsWith("@")&&t.includes("/")){let e=t.indexOf("/");return t.substring(e+1)}return t}function oae(t,e,r,n,i,a){if(i&&a&&bit(i,a))return yit(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 bit(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"),iae(t,n)==="http"}catch{return!1}}function yit(t,e,r,n,i){let a=`https://server.smithery.ai/${t}/mcp`,s=new URL(a),c=(i?Zi(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 wit(){let t=new F9({name:"smithery-cli",version:"1.0.0"},{capabilities:{}});return t.setNotificationHandler(SD,e=>{da(`[server log]: ${e.params.data}`)}),t}async function _it(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 Eit(t){let e=$n("Connecting to server...").start(),r=null;try{r=await wit(),await r.connect(t);let n=await _it(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 EO.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=$n(`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(`
|
|
@@ -598,7 +598,7 @@ ${K2.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")}
|
|
|
598
598
|
${oh.default.rgb(234,88,12)("Thanks for using Smithery Uplink!")}
|
|
599
599
|
${oh.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 fme(t,e,r,n,i){try{let a=await ls();a.success||U(`[Runner] Settings initialization warning: ${a.error}`);let s=await N0(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 i9();await W6t(s,e,o,r,n,i)}catch(a){U(`[Runner] Error: ${a instanceof Error?a.message:a}`),process.exit(1)}}async function W6t(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 dme(s.deploymentUrl,n,e,i,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"}):await lme(s.deploymentUrl,n,e,i)}else if(s.type==="stdio"){let o=await bue(t,s,e,n,i);if(a?.playground){if(!n)throw new Error("API key is required for playground connections");await Gfe(o.command,o.args,o.env,o.qualifiedName,n,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"})}else await Yfe(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();w2();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function mme(t,e){try{if(Zi(e).installType==="command"){console.log(v1.default.yellow(`Uninstallation is currently not supported for ${e}`));return}let n=$l(e);if(!n.mcpServers[t]){console.log(v1.default.red(`${t} is not installed for ${e}`));return}delete n.mcpServers[t],D2(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();ei();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(ni(),1))).default,n=(await Promise.resolve().then(()=>ye(uh(),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 yI(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 a4t(){let t=(await Promise.resolve().then(()=>ye(ni(),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 s4t(t){let e=(await Promise.resolve().then(()=>ye(ni(),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 Wi(t),i=(await Promise.resolve().then(()=>(yl(),X5))).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(uh(),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(),X5))).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 o4t(){let t=(await Promise.resolve().then(()=>ye(ni(),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 Dme(t,e,r){if(t)return t;if(console.log(mr.default.cyan("*"),"Installing MCP server for",mr.default.cyan(e)),console.log(),await a4t()==="search")return await s4t(r);{let i=await o4t();return console.log(),i}}async function wme(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(ni(),1))).default,i=(await Promise.resolve().then(()=>ye(uh(),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 bI(t){if(t)return t;let r=await(await Promise.resolve().then(()=>ye(ni(),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 _me(t,e){let r=await bI(e);try{for(;;){let n=(await Promise.resolve().then(()=>(yl(),X5))).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(ni(),1))).default,o=(await Promise.resolve().then(()=>ye(uh(),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 bI();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 bI();else return}}}catch(n){console.error(mr.default.red("Error searching servers:"),n instanceof Error?n.message:String(n)),process.exit(1)}}var pi=new EB;pi.name("smithery").version("1.5.0").description(`${An.default.bold.italic.hex("#ea580c")("SMITHERY CLI")} ${An.default.bold.italic.hex("#ea580c")("v1.5.0")} - 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&&zj(!0),r.debug&&Hj(!0)});pi.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 Dme(t,r,e.key);q7(r);let i=e.config?yI(e.config):{};await lue(n,r,i,e.key,e.profile)});pi.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(()=>(w2(),cue)),n=await P7(e.client,"Uninstall");q7(n);let i=r(n),a=Object.keys(i.mcpServers),s=await wme(t,n,a);await mme(s,n)});pi.command("inspect <server>").description("Inspect server from registry").option("--key <apikey>","Provide an API key").action(async(t,e)=>{await cae(t,await Wi(e.key))});pi.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?yI(e.config):{};await fme(t,r,await Wi(e.key),e.profile,{playground:e.playground,open:e.open,initialMessage:e.prompt})});pi.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 Hee({entryFile:t,port:e.port,key:e.key,tunnel:e.tunnel,open:e.open,initialMessage:e.prompt,configFile:e.config})});pi.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(An.default.red(`Invalid transport type "${r}". Valid options are: shttp, stdio`)),process.exit(1)),await FB({entryFile:t,outFile:e.out,transport:r,configFile:e.config,bundleAll:e.bundleAll})});pi.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 fue({port:t.port,command:e,apiKey:await Wi(t.key)})});pi.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(An.default.red("\u274C Command is required.")),console.error(An.default.yellow("Usage: smithery playground-stdio -- <command>")),console.error(An.default.gray("Example: smithery playground-stdio -- python my_mcp_server.py")),process.exit(1));let{createArbitraryCommandRunner:i}=await Promise.resolve().then(()=>(Cme(),Sme)),a=await i(e,await Wi(t.key),{port:t.port?Number.parseInt(t.port,10):6969,open:t.open!==!1,initialMessage:t.prompt});process.stdin.resume(),await new Promise(()=>{})});pi.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 pue("servers",e)});pi.command("search [term]").description("Search for servers in the Smithery registry").action(async t=>{let e=await Wi();await _me(e,t)});pi.command("login").description("Login with an API key").action(async()=>{console.log(An.default.cyan("Login to Smithery")),console.log(An.default.gray("Get your API key from: https://smithery.ai/account/api-keys")),console.log();try{let t=await aA();await rae(t),(await a9(t)).success?(console.log(An.default.green("\u2713 API key saved successfully")),console.log(An.default.gray("You can now use Smithery CLI commands"))):(console.error(An.default.red("\u2717 Failed to save API key")),console.error(An.default.gray("You may need to enter it again next time")))}catch(t){console.error(An.default.red("\u2717 Login failed"));let e=t instanceof Error?t.message:String(t);console.error(An.default.gray(e)),process.exit(1)}});pi.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 fme(t,e,r,n,i){try{let a=await ls();a.success||U(`[Runner] Settings initialization warning: ${a.error}`);let s=await N0(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 i9();await W6t(s,e,o,r,n,i)}catch(a){U(`[Runner] Error: ${a instanceof Error?a.message:a}`),process.exit(1)}}async function W6t(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 dme(s.deploymentUrl,n,e,i,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"}):await lme(s.deploymentUrl,n,e,i)}else if(s.type==="stdio"){let o=await bue(t,s,e,n,i);if(a?.playground){if(!n)throw new Error("API key is required for playground connections");await Gfe(o.command,o.args,o.env,o.qualifiedName,n,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"})}else await Yfe(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();w2();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function mme(t,e){try{if(Zi(e).installType==="command"){console.log(v1.default.yellow(`Uninstallation is currently not supported for ${e}`));return}let n=$l(e);if(!n.mcpServers[t]){console.log(v1.default.red(`${t} is not installed for ${e}`));return}delete n.mcpServers[t],D2(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();ei();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(ni(),1))).default,n=(await Promise.resolve().then(()=>ye(uh(),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 yI(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 a4t(){let t=(await Promise.resolve().then(()=>ye(ni(),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 s4t(t){let e=(await Promise.resolve().then(()=>ye(ni(),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 Wi(t),i=(await Promise.resolve().then(()=>(yl(),X5))).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(uh(),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(),X5))).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 o4t(){let t=(await Promise.resolve().then(()=>ye(ni(),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 Dme(t,e,r){if(t)return t;if(console.log(mr.default.cyan("*"),"Installing MCP server for",mr.default.cyan(e)),console.log(),await a4t()==="search")return await s4t(r);{let i=await o4t();return console.log(),i}}async function wme(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(ni(),1))).default,i=(await Promise.resolve().then(()=>ye(uh(),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 bI(t){if(t)return t;let r=await(await Promise.resolve().then(()=>ye(ni(),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 _me(t,e){let r=await bI(e);try{for(;;){let n=(await Promise.resolve().then(()=>(yl(),X5))).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(ni(),1))).default,o=(await Promise.resolve().then(()=>ye(uh(),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 bI();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 bI();else return}}}catch(n){console.error(mr.default.red("Error searching servers:"),n instanceof Error?n.message:String(n)),process.exit(1)}}var pi=new EB;pi.name("smithery").version("1.5.1").description(`${An.default.bold.italic.hex("#ea580c")("SMITHERY CLI")} ${An.default.bold.italic.hex("#ea580c")("v1.5.1")} - 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&&zj(!0),r.debug&&Hj(!0)});pi.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 Dme(t,r,e.key);q7(r);let i=e.config?yI(e.config):{};await lue(n,r,i,e.key,e.profile)});pi.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(()=>(w2(),cue)),n=await P7(e.client,"Uninstall");q7(n);let i=r(n),a=Object.keys(i.mcpServers),s=await wme(t,n,a);await mme(s,n)});pi.command("inspect <server>").description("Inspect server from registry").option("--key <apikey>","Provide an API key").action(async(t,e)=>{await cae(t,await Wi(e.key))});pi.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?yI(e.config):{};await fme(t,r,await Wi(e.key),e.profile,{playground:e.playground,open:e.open,initialMessage:e.prompt})});pi.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 Hee({entryFile:t,port:e.port,key:e.key,tunnel:e.tunnel,open:e.open,initialMessage:e.prompt,configFile:e.config})});pi.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(An.default.red(`Invalid transport type "${r}". Valid options are: shttp, stdio`)),process.exit(1)),await FB({entryFile:t,outFile:e.out,transport:r,configFile:e.config,bundleAll:e.bundleAll})});pi.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 fue({port:t.port,command:e,apiKey:await Wi(t.key)})});pi.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(An.default.red("\u274C Command is required.")),console.error(An.default.yellow("Usage: smithery playground-stdio -- <command>")),console.error(An.default.gray("Example: smithery playground-stdio -- python my_mcp_server.py")),process.exit(1));let{createArbitraryCommandRunner:i}=await Promise.resolve().then(()=>(Cme(),Sme)),a=await i(e,await Wi(t.key),{port:t.port?Number.parseInt(t.port,10):6969,open:t.open!==!1,initialMessage:t.prompt});process.stdin.resume(),await new Promise(()=>{})});pi.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 pue("servers",e)});pi.command("search [term]").description("Search for servers in the Smithery registry").action(async t=>{let e=await Wi();await _me(e,t)});pi.command("login").description("Login with an API key").action(async()=>{console.log(An.default.cyan("Login to Smithery")),console.log(An.default.gray("Get your API key from: https://smithery.ai/account/api-keys")),console.log();try{let t=await aA();await rae(t),(await a9(t)).success?(console.log(An.default.green("\u2713 API key saved successfully")),console.log(An.default.gray("You can now use Smithery CLI commands"))):(console.error(An.default.red("\u2717 Failed to save API key")),console.error(An.default.gray("You may need to enter it again next time")))}catch(t){console.error(An.default.red("\u2717 Login failed"));let e=t instanceof Error?t.message:String(t);console.error(An.default.gray(e)),process.exit(1)}});pi.parse(process.argv);
|
|
602
602
|
/*! Bundled license information:
|
|
603
603
|
|
|
604
604
|
safe-buffer/index.js:
|