@smithery/cli 1.6.1 → 1.6.3
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 +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -183,7 +183,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
183
183
|
`?(a&&(n+=eG("")),i&&m&&(n+=ZW(m))):h===`
|
|
184
184
|
`&&(i&&m&&(n+=ZW(i)),a&&(n+=eG(a))),p+=h.length}return n}});import n3 from"node:process";function lA(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&&!sG(e.borderColor))throw new Error(`${e.borderColor} is not a valid borderColor`);if(e.backgroundColor&&!sG(e.backgroundColor))throw new Error(`${e.backgroundColor} is not a valid backgroundColor`);return e.padding=iG(e.padding),e.margin=iG(e.margin),e=NIe(t,e),t=PIe(t,e),BIe(t,e.width,e)}var oG,uA,LIe,Yc,ma,O2,uG,iG,I2,OIe,IIe,PIe,BIe,RIe,aG,NIe,cA,sG,kIe,qIe,cG=_e(()=>{A2();AW();FW();oG=ke(ZS(),1);NW();uA=ke(HW(),1);nG();LIe=ke(ZS(),1),Yc=`
|
|
185
185
|
`,ma=" ",O2="none",uG=()=>{let{env:t,stdout:e,stderr:r}=n3;return e?.columns?e.columns:r?.columns?r.columns:t.COLUMNS?Number.parseInt(t.COLUMNS,10):80},iG=t=>typeof t=="number"?{top:t,right:t*3,bottom:t,left:t*3}:{top:0,right:0,bottom:0,left:0,...t},I2=t=>t===O2?0:2,OIe=t=>{let e=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],r;if(t===O2){t={};for(let n of e)t[n]=""}if(typeof t=="string"){if(r=oG.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},IIe=(t,e,r)=>{let n="",i=Yn(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},PIe=(t,{padding:e,width:r,textAlignment:n,height:i})=>{t=(0,uA.default)(t,{align:n});let a=t.split(Yc),s=X8(t),o=r-e.left-e.right;if(s>o){let p=[];for(let d of a){let h=r3(d,o,{hard:!0}),v=(0,uA.default)(h,{align:n}).split(`
|
|
186
|
-
`),g=Math.max(...v.map(b=>Yn(b)));for(let b of v){let D;switch(n){case"center":{D=ma.repeat((o-g)/2)+b;break}case"right":{D=ma.repeat(o-g)+b;break}default:{D=b;break}}p.push(D)}}a=p}n==="center"&&s<o?a=a.map(p=>ma.repeat((o-s)/2)+p):n==="right"&&s<o&&(a=a.map(p=>ma.repeat(o-s)+p));let u=ma.repeat(e.left),c=ma.repeat(e.right);return a=a.map(p=>{let d=u+p+c;return d+ma.repeat(r-Yn(d))}),e.top>0&&(a=[...Array.from({length:e.top}).fill(ma.repeat(r)),...a]),e.bottom>0&&(a=[...a,...Array.from({length:e.bottom}).fill(ma.repeat(r))]),i&&a.length>i?a=a.slice(0,i):i&&a.length<i&&(a=[...a,...Array.from({length:i-a.length}).fill(ma.repeat(r))]),a.join(Yc)},BIe=(t,e,r)=>{let n=p=>{let d=r.borderColor?kIe(r.borderColor)(p):p;return r.dimBorder?Qp.dim(d):d},i=p=>r.backgroundColor?qIe(r.backgroundColor)(p):p,a=OIe(r.borderStyle),s=uG(),o=ma.repeat(r.margin.left);if(r.float==="center"){let p=Math.max((s-e-I2(r.borderStyle))/2,0);o=ma.repeat(p)}else if(r.float==="right"){let p=Math.max(s-e-r.margin.right-I2(r.borderStyle),0);o=ma.repeat(p)}let u="";r.margin.top&&(u+=Yc.repeat(r.margin.top)),(r.borderStyle!==O2||r.title)&&(u+=n(o+a.topLeft+(r.title?IIe(r.title,a.top.repeat(e),r.titleAlignment):a.top.repeat(e))+a.topRight)+Yc);let c=t.split(Yc);return u+=c.map(p=>o+n(a.left)+i(p)+n(a.right)).join(Yc),r.borderStyle!==O2&&(u+=Yc+n(o+a.bottomLeft+a.bottom.repeat(e)+a.bottomRight)),r.margin.bottom&&(u+=Yc.repeat(r.margin.bottom)),u},RIe=t=>{if(t.fullscreen&&n3?.stdout){let e=[n3.stdout.columns,n3.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-I2(t.borderStyle)),t.height&&=Math.max(1,t.height-I2(t.borderStyle)),t},aG=(t,e)=>e===O2?t:` ${t} `,NIe=(t,e)=>{e=RIe(e);let r=e.width!==void 0,n=uG(),i=I2(e.borderStyle),a=n-e.margin.left-e.margin.right-i,s=X8(r3(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&&=aG(e.title,e.borderStyle)):e.title&&(e.title=e.title.slice(0,Math.max(0,a-2)),e.title&&(e.title=aG(e.title,e.borderStyle),Yn(e.title)>s&&(e.width=Yn(e.title)))),e.width||=s,!r){if(e.margin.left&&e.margin.right&&e.width>a){let u=(n-e.width-i)/(e.margin.left+e.margin.right);e.margin.left=Math.max(0,Math.floor(e.margin.left*u)),e.margin.right=Math.max(0,Math.floor(e.margin.right*u))}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},cA=t=>t.match(/^#(?:[0-f]{3}){1,2}$/i),sG=t=>typeof t=="string"&&(Qp[t]??cA(t)),kIe=t=>cA(t)?Qp.hex(t):Qp[t],qIe=t=>cA(t)?Qp.bgHex(t):Qp[tA(["bg",t])]});function lG(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 pG(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 pA(t,e){return`\x1B]8;;${t}\x1B\\${e}\x1B]8;;\x1B\\`}var dG=_e(()=>{"use strict"});import{exec as MIe}from"node:child_process";import{promisify as jIe}from"node:util";async function fG(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 UIe(a)}catch{console.log(dA.default.yellow("Could not open browser automatically")),console.log(dA.default.gray("Please open the link manually"))}}var dA,UIe,hG=_e(()=>{"use strict";dA=ke(qt(),1),UIe=jIe(MIe)});function gG(t){mG=t}function yG(t){vG=t}function Q(t){mG&&console.log(fA.default.gray(`[verbose] ${t}`))}function Us(t){vG&&console.debug(fA.default.blue(`[debug] ${t}`))}var fA,mG,vG,va=_e(()=>{"use strict";fA=ke(qt(),1),mG=!1,vG=!1});async function $Ie(t){try{let r=await fetch("https://registry.smithery.ai/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 xG(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 bG(t,e){Us(hA.default.blue(`\u{1F680} Starting tunnel for localhost:${t}...`)),Us(hA.default.gray("Getting tunnel credentials..."));let{authtoken:r,domain:n}=await $Ie(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 hA,mA=_e(()=>{"use strict";hA=ke(qt(),1);va()});async function _o(t,e,r=!0,n){let{listener:i,url:a}=await bG(t,e),s=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${a}/mcp`)}`,u={name:"smithery-dev",type:"http",url:`${a}/mcp`,headers:{}},c=lG(u),p=pA(c.url,c.displayText),d=pG(u),h=pA(d.url,d.displayText);console.log(""),console.log(` ${kr.default.bold.italic.hex("#ea580c")("SMITHERY")} ${kr.default.bold.italic.hex("#ea580c")("v1.6.
|
|
186
|
+
`),g=Math.max(...v.map(b=>Yn(b)));for(let b of v){let D;switch(n){case"center":{D=ma.repeat((o-g)/2)+b;break}case"right":{D=ma.repeat(o-g)+b;break}default:{D=b;break}}p.push(D)}}a=p}n==="center"&&s<o?a=a.map(p=>ma.repeat((o-s)/2)+p):n==="right"&&s<o&&(a=a.map(p=>ma.repeat(o-s)+p));let u=ma.repeat(e.left),c=ma.repeat(e.right);return a=a.map(p=>{let d=u+p+c;return d+ma.repeat(r-Yn(d))}),e.top>0&&(a=[...Array.from({length:e.top}).fill(ma.repeat(r)),...a]),e.bottom>0&&(a=[...a,...Array.from({length:e.bottom}).fill(ma.repeat(r))]),i&&a.length>i?a=a.slice(0,i):i&&a.length<i&&(a=[...a,...Array.from({length:i-a.length}).fill(ma.repeat(r))]),a.join(Yc)},BIe=(t,e,r)=>{let n=p=>{let d=r.borderColor?kIe(r.borderColor)(p):p;return r.dimBorder?Qp.dim(d):d},i=p=>r.backgroundColor?qIe(r.backgroundColor)(p):p,a=OIe(r.borderStyle),s=uG(),o=ma.repeat(r.margin.left);if(r.float==="center"){let p=Math.max((s-e-I2(r.borderStyle))/2,0);o=ma.repeat(p)}else if(r.float==="right"){let p=Math.max(s-e-r.margin.right-I2(r.borderStyle),0);o=ma.repeat(p)}let u="";r.margin.top&&(u+=Yc.repeat(r.margin.top)),(r.borderStyle!==O2||r.title)&&(u+=n(o+a.topLeft+(r.title?IIe(r.title,a.top.repeat(e),r.titleAlignment):a.top.repeat(e))+a.topRight)+Yc);let c=t.split(Yc);return u+=c.map(p=>o+n(a.left)+i(p)+n(a.right)).join(Yc),r.borderStyle!==O2&&(u+=Yc+n(o+a.bottomLeft+a.bottom.repeat(e)+a.bottomRight)),r.margin.bottom&&(u+=Yc.repeat(r.margin.bottom)),u},RIe=t=>{if(t.fullscreen&&n3?.stdout){let e=[n3.stdout.columns,n3.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-I2(t.borderStyle)),t.height&&=Math.max(1,t.height-I2(t.borderStyle)),t},aG=(t,e)=>e===O2?t:` ${t} `,NIe=(t,e)=>{e=RIe(e);let r=e.width!==void 0,n=uG(),i=I2(e.borderStyle),a=n-e.margin.left-e.margin.right-i,s=X8(r3(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&&=aG(e.title,e.borderStyle)):e.title&&(e.title=e.title.slice(0,Math.max(0,a-2)),e.title&&(e.title=aG(e.title,e.borderStyle),Yn(e.title)>s&&(e.width=Yn(e.title)))),e.width||=s,!r){if(e.margin.left&&e.margin.right&&e.width>a){let u=(n-e.width-i)/(e.margin.left+e.margin.right);e.margin.left=Math.max(0,Math.floor(e.margin.left*u)),e.margin.right=Math.max(0,Math.floor(e.margin.right*u))}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},cA=t=>t.match(/^#(?:[0-f]{3}){1,2}$/i),sG=t=>typeof t=="string"&&(Qp[t]??cA(t)),kIe=t=>cA(t)?Qp.hex(t):Qp[t],qIe=t=>cA(t)?Qp.bgHex(t):Qp[tA(["bg",t])]});function lG(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 pG(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 pA(t,e){return`\x1B]8;;${t}\x1B\\${e}\x1B]8;;\x1B\\`}var dG=_e(()=>{"use strict"});import{exec as MIe}from"node:child_process";import{promisify as jIe}from"node:util";async function fG(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 UIe(a)}catch{console.log(dA.default.yellow("Could not open browser automatically")),console.log(dA.default.gray("Please open the link manually"))}}var dA,UIe,hG=_e(()=>{"use strict";dA=ke(qt(),1),UIe=jIe(MIe)});function gG(t){mG=t}function yG(t){vG=t}function Q(t){mG&&console.log(fA.default.gray(`[verbose] ${t}`))}function Us(t){vG&&console.debug(fA.default.blue(`[debug] ${t}`))}var fA,mG,vG,va=_e(()=>{"use strict";fA=ke(qt(),1),mG=!1,vG=!1});async function $Ie(t){try{let r=await fetch("https://registry.smithery.ai/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 xG(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 bG(t,e){Us(hA.default.blue(`\u{1F680} Starting tunnel for localhost:${t}...`)),Us(hA.default.gray("Getting tunnel credentials..."));let{authtoken:r,domain:n}=await $Ie(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 hA,mA=_e(()=>{"use strict";hA=ke(qt(),1);va()});async function _o(t,e,r=!0,n){let{listener:i,url:a}=await bG(t,e),s=`https://smithery.ai/playground?mcp=${encodeURIComponent(`${a}/mcp`)}`,u={name:"smithery-dev",type:"http",url:`${a}/mcp`,headers:{}},c=lG(u),p=pA(c.url,c.displayText),d=pG(u),h=pA(d.url,d.displayText);console.log(""),console.log(` ${kr.default.bold.italic.hex("#ea580c")("SMITHERY")} ${kr.default.bold.italic.hex("#ea580c")("v1.6.3")} ready`),console.log(""),console.log(` ${kr.default.green(kr.default.dim("\u279C"))} ${kr.default.bold(kr.default.dim("Local:"))} ${kr.default.cyan(`http://localhost:${t}/mcp`)}`),console.log(` ${kr.default.green(kr.default.dim("\u279C"))} ${kr.default.bold(kr.default.dim("Remote:"))} ${kr.default.cyan(`${a}/mcp`)}`),console.log(` ${kr.default.green("\u279C")} ${kr.default.bold("Playground")}: ${kr.default.cyan(s)}`),console.log("");let m=[`${kr.default.bold("Cursor")}: ${kr.default.cyan(p)}`,`${kr.default.bold("VS Code")}: ${kr.default.cyan(h)}`,"",`${kr.default.dim("Note: If required config needed, attach using URL params")}`,`${kr.default.dim("e.g.")} ${kr.default.dim.cyan("https://server.com/mcp")}${kr.default.cyan("?weatherApiKey=abc123")}`].join(`
|
|
187
187
|
`);return console.log(lA(m,{title:"Add to Client",padding:{left:1,right:1,top:0,bottom:0},margin:{left:2},borderStyle:"round",borderColor:"dim"})),console.log(""),r&&await fG(a,t,n),{listener:i,url:a}}var kr,_f=_e(()=>{"use strict";cG();kr=ke(qt(),1);dG();hG();mA()});var CG=x((fBt,_G)=>{_G.exports=EG;EG.sync=HIe;var DG=pe("fs");function zIe(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 wG(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:zIe(e,r)}function EG(t,e,r){DG.stat(t,function(n,i){r(n,n?!1:wG(i,t,e))})}function HIe(t,e){return wG(DG.statSync(t),t,e)}});var OG=x((hBt,TG)=>{TG.exports=AG;AG.sync=KIe;var SG=pe("fs");function AG(t,e,r){SG.stat(t,function(n,i){r(n,n?!1:FG(i,e))})}function KIe(t,e){return FG(SG.statSync(t),e)}function FG(t,e){return t.isFile()&&WIe(t,e)}function WIe(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),u=parseInt("010",8),c=parseInt("001",8),p=o|u,d=r&c||r&u&&i===s||r&o&&n===a||r&p&&a===0;return d}});var PG=x((vBt,IG)=>{var mBt=pe("fs"),o3;process.platform==="win32"||global.TESTING_WINDOWS?o3=CG():o3=OG();IG.exports=vA;vA.sync=GIe;function vA(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){vA(t,e||{},function(a,s){a?i(a):n(s)})})}o3(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function GIe(t,e){try{return o3.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var MG=x((gBt,LG)=>{var Cf=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",BG=pe("path"),YIe=Cf?";":":",RG=PG(),NG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),kG=(t,e)=>{let r=e.colon||YIe,n=t.match(/\//)||Cf&&t.match(/\\/)?[""]:[...Cf?[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=Cf?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",a=Cf?i.split(r):[""];return Cf&&t.indexOf(".")!==-1&&a[0]!==""&&a.unshift(""),{pathEnv:n,pathExt:a,pathExtExe:i}},qG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:a}=kG(t,e),s=[],o=c=>new Promise((p,d)=>{if(c===n.length)return e.all&&s.length?p(s):d(NG(t));let h=n[c],m=/^".*"$/.test(h)?h.slice(1,-1):h,v=BG.join(m,t),g=!m&&/^\.[\\\/]/.test(t)?t.slice(0,2)+v:v;p(u(g,c,0))}),u=(c,p,d)=>new Promise((h,m)=>{if(d===i.length)return h(o(p+1));let v=i[d];RG(c+v,{pathExt:a},(g,b)=>{if(!g&&b)if(e.all)s.push(c+v);else return h(c+v);return h(u(c,p,d+1))})});return r?o(0).then(c=>r(null,c),r):o(0)},JIe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=kG(t,e),a=[];for(let s=0;s<r.length;s++){let o=r[s],u=/^".*"$/.test(o)?o.slice(1,-1):o,c=BG.join(u,t),p=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let d=0;d<n.length;d++){let h=p+n[d];try{if(RG.sync(h,{pathExt:i}))if(e.all)a.push(h);else return h}catch{}}}if(e.all&&a.length)return a;if(e.nothrow)return null;throw NG(t)};LG.exports=qG;qG.sync=JIe});var UG=x((yBt,gA)=>{"use strict";var jG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};gA.exports=jG;gA.exports.default=jG});var HG=x((xBt,zG)=>{"use strict";var $G=pe("path"),QIe=MG(),XIe=UG();function VG(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=QIe.sync(t.command,{path:r[XIe({env:r})],pathExt:e?$G.delimiter:void 0})}catch{}finally{a&&process.chdir(n)}return s&&(s=$G.resolve(i?t.options.cwd:"",s)),s}function ZIe(t){return VG(t)||VG(t,!0)}zG.exports=ZIe});var KG=x((bBt,xA)=>{"use strict";var yA=/([()\][%!^"`<>&|;, *?])/g;function ePe(t){return t=t.replace(yA,"^$1"),t}function tPe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(yA,"^$1"),e&&(t=t.replace(yA,"^$1")),t}xA.exports.command=ePe;xA.exports.argument=tPe});var GG=x((DBt,WG)=>{"use strict";WG.exports=/^#!(.*)/});var JG=x((wBt,YG)=>{"use strict";var rPe=GG();YG.exports=(t="")=>{let e=t.match(rPe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var XG=x((EBt,QG)=>{"use strict";var bA=pe("fs"),nPe=JG();function iPe(t){let r=Buffer.alloc(150),n;try{n=bA.openSync(t,"r"),bA.readSync(n,r,0,150,0),bA.closeSync(n)}catch{}return nPe(r.toString())}QG.exports=iPe});var rY=x((_Bt,tY)=>{"use strict";var aPe=pe("path"),ZG=HG(),eY=KG(),sPe=XG(),oPe=process.platform==="win32",uPe=/\.(?:com|exe)$/i,cPe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function lPe(t){t.file=ZG(t);let e=t.file&&sPe(t.file);return e?(t.args.unshift(t.file),t.command=e,ZG(t)):t.file}function pPe(t){if(!oPe)return t;let e=lPe(t),r=!uPe.test(e);if(t.options.forceShell||r){let n=cPe.test(e);t.command=aPe.normalize(t.command),t.command=eY.command(t.command),t.args=t.args.map(a=>eY.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 dPe(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:pPe(n)}tY.exports=dPe});var aY=x((CBt,iY)=>{"use strict";var DA=process.platform==="win32";function wA(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 fPe(t,e){if(!DA)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let a=nY(i,e);if(a)return r.call(t,"error",a)}return r.apply(t,arguments)}}function nY(t,e){return DA&&t===1&&!e.file?wA(e.original,"spawn"):null}function hPe(t,e){return DA&&t===1&&!e.file?wA(e.original,"spawnSync"):null}iY.exports={hookChildProcess:fPe,verifyENOENT:nY,verifyENOENTSync:hPe,notFoundError:wA}});var uY=x((SBt,Sf)=>{"use strict";var sY=pe("child_process"),EA=rY(),_A=aY();function oY(t,e,r){let n=EA(t,e,r),i=sY.spawn(n.command,n.args,n.options);return _A.hookChildProcess(i,n),i}function mPe(t,e,r){let n=EA(t,e,r),i=sY.spawnSync(n.command,n.args,n.options);return i.error=i.error||_A.verifyENOENTSync(i.status,n),i}Sf.exports=oY;Sf.exports.spawn=oY;Sf.exports.sync=mPe;Sf.exports._parse=EA;Sf.exports._enoent=_A});var Ft,CA,Ie,Co,P2=_e(()=>{(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})(Ft||(Ft={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(CA||(CA={}));Ie=Ft.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Co=t=>{switch(typeof t){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return Number.isNaN(t)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(t)?Ie.array:t===null?Ie.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ie.promise:typeof Map<"u"&&t instanceof Map?Ie.map:typeof Set<"u"&&t instanceof Set?Ie.set:typeof Date<"u"&&t instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}}});var xe,vPe,Tn,u3=_e(()=>{P2();xe=Ft.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"]),vPe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Tn=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,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(s))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};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,Ft.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()}};Tn.create=t=>new Tn(t)});var gPe,qu,SA=_e(()=>{u3();P2();gPe=(t,e)=>{let r;switch(t.code){case xe.invalid_type:t.received===Ie.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case xe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ft.jsonStringifyReplacer)}`;break;case xe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ft.joinValues(t.keys,", ")}`;break;case xe.invalid_union:r="Invalid input";break;case xe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ft.joinValues(t.options)}`;break;case xe.invalid_enum_value:r=`Invalid enum value. Expected ${Ft.joinValues(t.options)}, received '${t.received}'`;break;case xe.invalid_arguments:r="Invalid function arguments";break;case xe.invalid_return_type:r="Invalid function return type";break;case xe.invalid_date:r="Invalid date";break;case xe.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}"`:Ft.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case xe.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 xe.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 xe.custom:r="Invalid input";break;case xe.invalid_intersection_types:r="Intersection results could not be merged";break;case xe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case xe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ft.assertNever(t)}return{message:r}},qu=gPe});function yPe(t){cY=t}function Af(){return cY}var cY,c3=_e(()=>{SA();cY=qu});function Se(t,e){let r=Af(),n=B2({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===qu?void 0:qu].filter(i=>!!i)});t.common.issues.push(n)}var B2,xPe,Jn,Ke,e0,vi,l3,p3,Jc,Ff,AA=_e(()=>{c3();SA();B2=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="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)o=c(s,{data:e,defaultError:o}).message;return{...i,path:a,message:o}},xPe=[];Jn=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 Ke;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 Ke;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}}},Ke=Object.freeze({status:"aborted"}),e0=t=>({status:"dirty",value:t}),vi=t=>({status:"valid",value:t}),l3=t=>t.status==="aborted",p3=t=>t.status==="dirty",Jc=t=>t.status==="valid",Ff=t=>typeof Promise<"u"&&t instanceof Promise});var lY=_e(()=>{});var Le,pY=_e(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Le||(Le={}))});function vt(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:u}=t;return s.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:i}}function mY(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 kPe(t){return new RegExp(`^${mY(t)}$`)}function vY(t){let e=`${hY}T${mY(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 qPe(t,e){return!!((e==="v4"||!e)&&TPe.test(t)||(e==="v6"||!e)&&IPe.test(t))}function LPe(t,e){if(!CPe.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 MPe(t,e){return!!((e==="v4"||!e)&&OPe.test(t)||(e==="v6"||!e)&&PPe.test(t))}function jPe(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 Tf(t){if(t instanceof Wi){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ga.create(Tf(n))}return new Wi({...t._def,shape:()=>e})}else return t instanceof ju?new ju({...t._def,type:Tf(t.element)}):t instanceof Ga?Ga.create(Tf(t.unwrap())):t instanceof Ao?Ao.create(Tf(t.unwrap())):t instanceof So?So.create(t.items.map(e=>Tf(e))):t}function TA(t,e){let r=Co(t),n=Co(e);if(t===e)return{valid:!0,data:t};if(r===Ie.object&&n===Ie.object){let i=Ft.objectKeys(e),a=Ft.objectKeys(t).filter(o=>i.indexOf(o)!==-1),s={...t,...e};for(let o of a){let u=TA(t[o],e[o]);if(!u.valid)return{valid:!1};s[o]=u.data}return{valid:!0,data:s}}else if(r===Ie.array&&n===Ie.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],u=TA(s,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===Ie.date&&n===Ie.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function gY(t,e){return new p0({values:t,typeName:Qe.ZodEnum,...vt(e)})}function fY(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function yY(t,e={},r){return t?Xc.create().superRefine((n,i)=>{let a=t(n);if(a instanceof Promise)return a.then(s=>{if(!s){let o=fY(e,n),u=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:u})}});if(!a){let s=fY(e,n),o=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:o})}}):Xc.create()}var Ya,dY,Dt,bPe,DPe,wPe,EPe,_Pe,CPe,SPe,APe,FPe,FA,TPe,OPe,IPe,PPe,BPe,RPe,hY,NPe,Qc,t0,r0,n0,i0,Of,a0,s0,Xc,Mu,$s,If,ju,Wi,o0,Lu,d3,u0,So,f3,Pf,Bf,h3,c0,l0,p0,d0,Zc,Ja,Ga,Ao,f0,h0,Rf,UPe,R2,N2,m0,$Pe,Qe,gi,Z,ur,VPe,zPe,cr,OA,HPe,KPe,WPe,Uu,GPe,YPe,JPe,ir,$e,ga,v0,QPe,XPe,ZPe,On,eBe,tBe,rBe,g0,nBe,Vs,Nf,iBe,aBe,sBe,yi,oBe,uBe,cBe,lBe,pBe,IA,dBe,xY=_e(()=>{u3();c3();pY();AA();P2();Ya=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}},dY=(t,e)=>{if(Jc(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 Tn(t.common.issues);return this._error=r,this._error}}};Dt=class{get description(){return this._def.description}_getType(e){return Co(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Co(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jn,ctx:{common:e.parent.common,data:e.data,parsedType:Co(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ff(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:Co(e)},i=this._parseSync({data:e,path:n.path,parent:n});return dY(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Co(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Jc(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=>Jc(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:Co(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Ff(i)?i:Promise.resolve(i));return dY(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:xe.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!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 Ja({schema:this,typeName:Qe.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 Ga.create(this,this._def)}nullable(){return Ao.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ju.create(this)}promise(){return Zc.create(this,this._def)}or(e){return o0.create([this,e],this._def)}and(e){return u0.create(this,e,this._def)}transform(e){return new Ja({...vt(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new f0({...vt(this._def),innerType:this,defaultValue:r,typeName:Qe.ZodDefault})}brand(){return new R2({typeName:Qe.ZodBranded,type:this,...vt(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new h0({...vt(this._def),innerType:this,catchValue:r,typeName:Qe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return N2.create(this,e)}readonly(){return m0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},bPe=/^c[^\s-]{8,}$/i,DPe=/^[0-9a-z]+$/,wPe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,EPe=/^[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,_Pe=/^[a-z0-9_-]{21}$/i,CPe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,SPe=/^[-+]?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)?)??$/,APe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,FPe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",TPe=/^(?:(?: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])$/,OPe=/^(?:(?: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])$/,IPe=/^(([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]))$/,PPe=/^(([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])$/,BPe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,RPe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hY="((\\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])))",NPe=new RegExp(`^${hY}$`);Qc=class t extends Dt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ie.string){let a=this._getOrReturnCtx(e);return Se(a,{code:xe.invalid_type,expected:Ie.string,received:a.parsedType}),Ke}let n=new Jn,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Se(i,{code:xe.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),Se(i,{code:xe.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?Se(i,{code:xe.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&Se(i,{code:xe.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")APe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"email",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")FA||(FA=new RegExp(FPe,"u")),FA.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"emoji",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")EPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"uuid",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")_Pe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"nanoid",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")bPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"cuid",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")DPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"cuid2",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")wPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"ulid",code:xe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Se(i,{validation:"url",code:xe.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),Se(i,{validation:"regex",code:xe.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),Se(i,{code:xe.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),Se(i,{code:xe.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Se(i,{code:xe.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?vY(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{code:xe.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?NPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{code:xe.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?kPe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{code:xe.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?SPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"duration",code:xe.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?qPe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"ip",code:xe.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?LPe(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"jwt",code:xe.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?MPe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"cidr",code:xe.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?BPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"base64",code:xe.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?RPe.test(e.data)||(i=this._getOrReturnCtx(e,i),Se(i,{validation:"base64url",code:xe.invalid_string,message:a.message}),n.dirty()):Ft.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:xe.invalid_string,...Le.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Le.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Le.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Le.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Le.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Le.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Le.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Le.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Le.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Le.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Le.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Le.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Le.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Le.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,...Le.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,...Le.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Le.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Le.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Le.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Le.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Le.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Le.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Le.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Le.errToObj(r)})}nonempty(e){return this.min(1,Le.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}};Qc.create=t=>new Qc({checks:[],typeName:Qe.ZodString,coerce:t?.coerce??!1,...vt(t)});t0=class t extends Dt{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)!==Ie.number){let a=this._getOrReturnCtx(e);return Se(a,{code:xe.invalid_type,expected:Ie.number,received:a.parsedType}),Ke}let n,i=new Jn;for(let a of this._def.checks)a.kind==="int"?Ft.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Se(n,{code:xe.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),Se(n,{code:xe.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),Se(n,{code:xe.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?jPe(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Se(n,{code:xe.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Se(n,{code:xe.not_finite,message:a.message}),i.dirty()):Ft.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Le.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Le.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Le.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Le.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Le.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Le.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Le.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Le.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Le.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Le.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Le.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"&&Ft.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)}};t0.create=t=>new t0({checks:[],typeName:Qe.ZodNumber,coerce:t?.coerce||!1,...vt(t)});r0=class t extends Dt{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)!==Ie.bigint)return this._getInvalidInput(e);let n,i=new Jn;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),Se(n,{code:xe.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),Se(n,{code:xe.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),Se(n,{code:xe.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ft.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Se(r,{code:xe.invalid_type,expected:Ie.bigint,received:r.parsedType}),Ke}gte(e,r){return this.setLimit("min",e,!0,Le.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Le.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Le.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Le.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Le.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:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Le.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}};r0.create=t=>new r0({checks:[],typeName:Qe.ZodBigInt,coerce:t?.coerce??!1,...vt(t)});n0=class extends Dt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ie.boolean){let n=this._getOrReturnCtx(e);return Se(n,{code:xe.invalid_type,expected:Ie.boolean,received:n.parsedType}),Ke}return vi(e.data)}};n0.create=t=>new n0({typeName:Qe.ZodBoolean,coerce:t?.coerce||!1,...vt(t)});i0=class t extends Dt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ie.date){let a=this._getOrReturnCtx(e);return Se(a,{code:xe.invalid_type,expected:Ie.date,received:a.parsedType}),Ke}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return Se(a,{code:xe.invalid_date}),Ke}let n=new Jn,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),Se(i,{code:xe.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),Se(i,{code:xe.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ft.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:Le.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Le.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}};i0.create=t=>new i0({checks:[],coerce:t?.coerce||!1,typeName:Qe.ZodDate,...vt(t)});Of=class extends Dt{_parse(e){if(this._getType(e)!==Ie.symbol){let n=this._getOrReturnCtx(e);return Se(n,{code:xe.invalid_type,expected:Ie.symbol,received:n.parsedType}),Ke}return vi(e.data)}};Of.create=t=>new Of({typeName:Qe.ZodSymbol,...vt(t)});a0=class extends Dt{_parse(e){if(this._getType(e)!==Ie.undefined){let n=this._getOrReturnCtx(e);return Se(n,{code:xe.invalid_type,expected:Ie.undefined,received:n.parsedType}),Ke}return vi(e.data)}};a0.create=t=>new a0({typeName:Qe.ZodUndefined,...vt(t)});s0=class extends Dt{_parse(e){if(this._getType(e)!==Ie.null){let n=this._getOrReturnCtx(e);return Se(n,{code:xe.invalid_type,expected:Ie.null,received:n.parsedType}),Ke}return vi(e.data)}};s0.create=t=>new s0({typeName:Qe.ZodNull,...vt(t)});Xc=class extends Dt{constructor(){super(...arguments),this._any=!0}_parse(e){return vi(e.data)}};Xc.create=t=>new Xc({typeName:Qe.ZodAny,...vt(t)});Mu=class extends Dt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return vi(e.data)}};Mu.create=t=>new Mu({typeName:Qe.ZodUnknown,...vt(t)});$s=class extends Dt{_parse(e){let r=this._getOrReturnCtx(e);return Se(r,{code:xe.invalid_type,expected:Ie.never,received:r.parsedType}),Ke}};$s.create=t=>new $s({typeName:Qe.ZodNever,...vt(t)});If=class extends Dt{_parse(e){if(this._getType(e)!==Ie.undefined){let n=this._getOrReturnCtx(e);return Se(n,{code:xe.invalid_type,expected:Ie.void,received:n.parsedType}),Ke}return vi(e.data)}};If.create=t=>new If({typeName:Qe.ZodVoid,...vt(t)});ju=class t extends Dt{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Ie.array)return Se(r,{code:xe.invalid_type,expected:Ie.array,received:r.parsedType}),Ke;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(s||o)&&(Se(r,{code:s?xe.too_big:xe.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&&(Se(r,{code:xe.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&&(Se(r,{code:xe.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 Ya(r,s,r.path,o)))).then(s=>Jn.mergeArray(n,s));let a=[...r.data].map((s,o)=>i.type._parseSync(new Ya(r,s,r.path,o)));return Jn.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Le.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Le.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Le.toString(r)}})}nonempty(e){return this.min(1,e)}};ju.create=(t,e)=>new ju({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...vt(e)});Wi=class t extends Dt{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=Ft.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Ie.object){let c=this._getOrReturnCtx(e);return Se(c,{code:xe.invalid_type,expected:Ie.object,received:c.parsedType}),Ke}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof $s&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||o.push(c);let u=[];for(let c of s){let p=a[c],d=i.data[c];u.push({key:{status:"valid",value:c},value:p._parse(new Ya(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof $s){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(c==="strict")o.length>0&&(Se(i,{code:xe.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let p of o){let d=i.data[p];u.push({key:{status:"valid",value:p},value:c._parse(new Ya(i,d,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of u){let d=await p.key,h=await p.value;c.push({key:d,value:h,alwaysSet:p.alwaysSet})}return c}).then(c=>Jn.mergeObjectSync(n,c)):Jn.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Le.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:Le.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:Qe.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 Ft.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 Ft.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Tf(this)}partial(e){let r={};for(let n of Ft.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 Ft.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ga;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return gY(Ft.objectKeys(this.shape))}};Wi.create=(t,e)=>new Wi({shape:()=>t,unknownKeys:"strip",catchall:$s.create(),typeName:Qe.ZodObject,...vt(e)});Wi.strictCreate=(t,e)=>new Wi({shape:()=>t,unknownKeys:"strict",catchall:$s.create(),typeName:Qe.ZodObject,...vt(e)});Wi.lazycreate=(t,e)=>new Wi({shape:t,unknownKeys:"strip",catchall:$s.create(),typeName:Qe.ZodObject,...vt(e)});o0=class extends Dt{_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 Tn(o.ctx.common.issues));return Se(r,{code:xe.invalid_union,unionErrors:s}),Ke}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 u of n){let c={...r,common:{...r.common,issues:[]},parent:null},p=u._parseSync({data:r.data,path:r.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(u=>new Tn(u));return Se(r,{code:xe.invalid_union,unionErrors:o}),Ke}}get options(){return this._def.options}};o0.create=(t,e)=>new o0({options:t,typeName:Qe.ZodUnion,...vt(e)});Lu=t=>t instanceof c0?Lu(t.schema):t instanceof Ja?Lu(t.innerType()):t instanceof l0?[t.value]:t instanceof p0?t.options:t instanceof d0?Ft.objectValues(t.enum):t instanceof f0?Lu(t._def.innerType):t instanceof a0?[void 0]:t instanceof s0?[null]:t instanceof Ga?[void 0,...Lu(t.unwrap())]:t instanceof Ao?[null,...Lu(t.unwrap())]:t instanceof R2||t instanceof m0?Lu(t.unwrap()):t instanceof h0?Lu(t._def.innerType):[],d3=class t extends Dt{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.object)return Se(r,{code:xe.invalid_type,expected:Ie.object,received:r.parsedType}),Ke;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}):(Se(r,{code:xe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ke)}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=Lu(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:Qe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...vt(n)})}};u0=class extends Dt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,s)=>{if(l3(a)||l3(s))return Ke;let o=TA(a.value,s.value);return o.valid?((p3(a)||p3(s))&&r.dirty(),{status:r.value,value:o.data}):(Se(n,{code:xe.invalid_intersection_types}),Ke)};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}))}};u0.create=(t,e,r)=>new u0({left:t,right:e,typeName:Qe.ZodIntersection,...vt(r)});So=class t extends Dt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ie.array)return Se(n,{code:xe.invalid_type,expected:Ie.array,received:n.parsedType}),Ke;if(n.data.length<this._def.items.length)return Se(n,{code:xe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ke;!this._def.rest&&n.data.length>this._def.items.length&&(Se(n,{code:xe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((s,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new Ya(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(a).then(s=>Jn.mergeArray(r,s)):Jn.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};So.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new So({items:t,typeName:Qe.ZodTuple,rest:null,...vt(e)})};f3=class t extends Dt{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!==Ie.object)return Se(n,{code:xe.invalid_type,expected:Ie.object,received:n.parsedType}),Ke;let i=[],a=this._def.keyType,s=this._def.valueType;for(let o in n.data)i.push({key:a._parse(new Ya(n,o,n.path,o)),value:s._parse(new Ya(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?Jn.mergeObjectAsync(r,i):Jn.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Dt?new t({keyType:e,valueType:r,typeName:Qe.ZodRecord,...vt(n)}):new t({keyType:Qc.create(),valueType:e,typeName:Qe.ZodRecord,...vt(r)})}},Pf=class extends Dt{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!==Ie.map)return Se(n,{code:xe.invalid_type,expected:Ie.map,received:n.parsedType}),Ke;let i=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([o,u],c)=>({key:i._parse(new Ya(n,o,n.path,[c,"key"])),value:a._parse(new Ya(n,u,n.path,[c,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of s){let c=await u.key,p=await u.value;if(c.status==="aborted"||p.status==="aborted")return Ke;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),o.set(c.value,p.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of s){let c=u.key,p=u.value;if(c.status==="aborted"||p.status==="aborted")return Ke;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),o.set(c.value,p.value)}return{status:r.value,value:o}}}};Pf.create=(t,e,r)=>new Pf({valueType:e,keyType:t,typeName:Qe.ZodMap,...vt(r)});Bf=class t extends Dt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ie.set)return Se(n,{code:xe.invalid_type,expected:Ie.set,received:n.parsedType}),Ke;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Se(n,{code:xe.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&&(Se(n,{code:xe.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(u){let c=new Set;for(let p of u){if(p.status==="aborted")return Ke;p.status==="dirty"&&r.dirty(),c.add(p.value)}return{status:r.value,value:c}}let o=[...n.data.values()].map((u,c)=>a._parse(new Ya(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>s(u)):s(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:Le.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Le.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Bf.create=(t,e)=>new Bf({valueType:t,minSize:null,maxSize:null,typeName:Qe.ZodSet,...vt(e)});h3=class t extends Dt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.function)return Se(r,{code:xe.invalid_type,expected:Ie.function,received:r.parsedType}),Ke;function n(o,u){return B2({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Af(),qu].filter(c=>!!c),issueData:{code:xe.invalid_arguments,argumentsError:u}})}function i(o,u){return B2({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Af(),qu].filter(c=>!!c),issueData:{code:xe.invalid_return_type,returnTypeError:u}})}let a={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Zc){let o=this;return vi(async function(...u){let c=new Tn([]),p=await o._def.args.parseAsync(u,a).catch(m=>{throw c.addIssue(n(u,m)),c}),d=await Reflect.apply(s,this,p);return await o._def.returns._def.type.parseAsync(d,a).catch(m=>{throw c.addIssue(i(d,m)),c})})}else{let o=this;return vi(function(...u){let c=o._def.args.safeParse(u,a);if(!c.success)throw new Tn([n(u,c.error)]);let p=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(p,a);if(!d.success)throw new Tn([i(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:So.create(e).rest(Mu.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||So.create([]).rest(Mu.create()),returns:r||Mu.create(),typeName:Qe.ZodFunction,...vt(n)})}},c0=class extends Dt{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})}};c0.create=(t,e)=>new c0({getter:t,typeName:Qe.ZodLazy,...vt(e)});l0=class extends Dt{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Se(r,{received:r.data,code:xe.invalid_literal,expected:this._def.value}),Ke}return{status:"valid",value:e.data}}get value(){return this._def.value}};l0.create=(t,e)=>new l0({value:t,typeName:Qe.ZodLiteral,...vt(e)});p0=class t extends Dt{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Se(r,{expected:Ft.joinValues(n),received:r.parsedType,code:xe.invalid_type}),Ke}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 Se(r,{received:r.data,code:xe.invalid_enum_value,options:n}),Ke}return vi(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})}};p0.create=gY;d0=class extends Dt{_parse(e){let r=Ft.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Ie.string&&n.parsedType!==Ie.number){let i=Ft.objectValues(r);return Se(n,{expected:Ft.joinValues(i),received:n.parsedType,code:xe.invalid_type}),Ke}if(this._cache||(this._cache=new Set(Ft.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ft.objectValues(r);return Se(n,{received:n.data,code:xe.invalid_enum_value,options:i}),Ke}return vi(e.data)}get enum(){return this._def.values}};d0.create=(t,e)=>new d0({values:t,typeName:Qe.ZodNativeEnum,...vt(e)});Zc=class extends Dt{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.promise&&r.common.async===!1)return Se(r,{code:xe.invalid_type,expected:Ie.promise,received:r.parsedType}),Ke;let n=r.parsedType===Ie.promise?r.data:Promise.resolve(r.data);return vi(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Zc.create=(t,e)=>new Zc({type:t,typeName:Qe.ZodPromise,...vt(e)});Ja=class extends Dt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.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=>{Se(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 Ke;let u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?Ke:u.status==="dirty"?e0(u.value):r.value==="dirty"?e0(u.value):u});{if(r.value==="aborted")return Ke;let o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?Ke:o.status==="dirty"?e0(o.value):r.value==="dirty"?e0(o.value):o}}if(i.type==="refinement"){let s=o=>{let u=i.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u 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"?Ke:(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"?Ke:(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(!Jc(s))return Ke;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=>Jc(s)?Promise.resolve(i.transform(s.value,a)).then(o=>({status:r.value,value:o})):Ke);Ft.assertNever(i)}};Ja.create=(t,e,r)=>new Ja({schema:t,typeName:Qe.ZodEffects,effect:e,...vt(r)});Ja.createWithPreprocess=(t,e,r)=>new Ja({schema:e,effect:{type:"preprocess",transform:t},typeName:Qe.ZodEffects,...vt(r)});Ga=class extends Dt{_parse(e){return this._getType(e)===Ie.undefined?vi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ga.create=(t,e)=>new Ga({innerType:t,typeName:Qe.ZodOptional,...vt(e)});Ao=class extends Dt{_parse(e){return this._getType(e)===Ie.null?vi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ao.create=(t,e)=>new Ao({innerType:t,typeName:Qe.ZodNullable,...vt(e)});f0=class extends Dt{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Ie.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};f0.create=(t,e)=>new f0({innerType:t,typeName:Qe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...vt(e)});h0=class extends Dt{_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 Ff(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Tn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Tn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};h0.create=(t,e)=>new h0({innerType:t,typeName:Qe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...vt(e)});Rf=class extends Dt{_parse(e){if(this._getType(e)!==Ie.nan){let n=this._getOrReturnCtx(e);return Se(n,{code:xe.invalid_type,expected:Ie.nan,received:n.parsedType}),Ke}return{status:"valid",value:e.data}}};Rf.create=t=>new Rf({typeName:Qe.ZodNaN,...vt(t)});UPe=Symbol("zod_brand"),R2=class extends Dt{_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}},N2=class t extends Dt{_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"?Ke:a.status==="dirty"?(r.dirty(),e0(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"?Ke: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:Qe.ZodPipeline})}},m0=class extends Dt{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Jc(i)&&(i.value=Object.freeze(i.value)),i);return Ff(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};m0.create=(t,e)=>new m0({innerType:t,typeName:Qe.ZodReadonly,...vt(e)});$Pe={object:Wi.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"})(Qe||(Qe={}));gi=(t,e={message:`Input not instance of ${t.name}`})=>yY(r=>r instanceof t,e),Z=Qc.create,ur=t0.create,VPe=Rf.create,zPe=r0.create,cr=n0.create,OA=i0.create,HPe=Of.create,KPe=a0.create,WPe=s0.create,Uu=Xc.create,GPe=Mu.create,YPe=$s.create,JPe=If.create,ir=ju.create,$e=Wi.create,ga=Wi.strictCreate,v0=o0.create,QPe=d3.create,XPe=u0.create,ZPe=So.create,On=f3.create,eBe=Pf.create,tBe=Bf.create,rBe=h3.create,g0=c0.create,nBe=l0.create,Vs=p0.create,Nf=d0.create,iBe=Zc.create,aBe=Ja.create,sBe=Ga.create,yi=Ao.create,oBe=Ja.createWithPreprocess,uBe=N2.create,cBe=()=>Z().optional(),lBe=()=>ur().optional(),pBe=()=>cr().optional(),IA={string:(t=>Qc.create({...t,coerce:!0})),number:(t=>t0.create({...t,coerce:!0})),boolean:(t=>n0.create({...t,coerce:!0})),bigint:(t=>r0.create({...t,coerce:!0})),date:(t=>i0.create({...t,coerce:!0}))},dBe=Ke});var E={};Mg(E,{BRAND:()=>UPe,DIRTY:()=>e0,EMPTY_PATH:()=>xPe,INVALID:()=>Ke,NEVER:()=>dBe,OK:()=>vi,ParseStatus:()=>Jn,Schema:()=>Dt,ZodAny:()=>Xc,ZodArray:()=>ju,ZodBigInt:()=>r0,ZodBoolean:()=>n0,ZodBranded:()=>R2,ZodCatch:()=>h0,ZodDate:()=>i0,ZodDefault:()=>f0,ZodDiscriminatedUnion:()=>d3,ZodEffects:()=>Ja,ZodEnum:()=>p0,ZodError:()=>Tn,ZodFirstPartyTypeKind:()=>Qe,ZodFunction:()=>h3,ZodIntersection:()=>u0,ZodIssueCode:()=>xe,ZodLazy:()=>c0,ZodLiteral:()=>l0,ZodMap:()=>Pf,ZodNaN:()=>Rf,ZodNativeEnum:()=>d0,ZodNever:()=>$s,ZodNull:()=>s0,ZodNullable:()=>Ao,ZodNumber:()=>t0,ZodObject:()=>Wi,ZodOptional:()=>Ga,ZodParsedType:()=>Ie,ZodPipeline:()=>N2,ZodPromise:()=>Zc,ZodReadonly:()=>m0,ZodRecord:()=>f3,ZodSchema:()=>Dt,ZodSet:()=>Bf,ZodString:()=>Qc,ZodSymbol:()=>Of,ZodTransformer:()=>Ja,ZodTuple:()=>So,ZodType:()=>Dt,ZodUndefined:()=>a0,ZodUnion:()=>o0,ZodUnknown:()=>Mu,ZodVoid:()=>If,addIssueToContext:()=>Se,any:()=>Uu,array:()=>ir,bigint:()=>zPe,boolean:()=>cr,coerce:()=>IA,custom:()=>yY,date:()=>OA,datetimeRegex:()=>vY,defaultErrorMap:()=>qu,discriminatedUnion:()=>QPe,effect:()=>aBe,enum:()=>Vs,function:()=>rBe,getErrorMap:()=>Af,getParsedType:()=>Co,instanceof:()=>gi,intersection:()=>XPe,isAborted:()=>l3,isAsync:()=>Ff,isDirty:()=>p3,isValid:()=>Jc,late:()=>$Pe,lazy:()=>g0,literal:()=>nBe,makeIssue:()=>B2,map:()=>eBe,nan:()=>VPe,nativeEnum:()=>Nf,never:()=>YPe,null:()=>WPe,nullable:()=>yi,number:()=>ur,object:()=>$e,objectUtil:()=>CA,oboolean:()=>pBe,onumber:()=>lBe,optional:()=>sBe,ostring:()=>cBe,pipeline:()=>uBe,preprocess:()=>oBe,promise:()=>iBe,quotelessJson:()=>vPe,record:()=>On,set:()=>tBe,setErrorMap:()=>yPe,strictObject:()=>ga,string:()=>Z,symbol:()=>HPe,transformer:()=>aBe,tuple:()=>ZPe,undefined:()=>KPe,union:()=>v0,unknown:()=>GPe,util:()=>Ft,void:()=>JPe});var PA=_e(()=>{c3();AA();lY();P2();xY();u3()});var Qr=_e(()=>{PA();PA()});var kf,bY,m3,DY,wY,fBe,Xa,Gi,k2,Fo,Za,v3,EY,g3,_Y,CY,SY,q2,Xr,AY,FY,qf,y0,y3,hBe,L2,M2,TY,mBe,vBe,gBe,BA,OY,IY,x3,yBe,b3,D3,w3,PY,BY,RA,RY,NY,xBe,bBe,NA,DBe,kA,wBe,qA,EBe,_Be,CBe,SBe,ABe,FBe,TBe,LA,OBe,MA,jA,UA,IBe,PBe,kY,BBe,$A,RBe,NBe,kBe,qBe,VA,E3,ZBt,zA,LBe,qY,MBe,HA,jBe,UBe,$Be,VBe,zBe,HBe,KBe,WBe,GBe,YBe,JBe,QBe,XBe,ZBe,eRe,KA,tRe,rRe,nRe,iRe,eRt,tRt,rRt,nRt,iRt,aRt,Qa,$u=_e(()=>{Qr();kf="2025-06-18",bY=[kf,"2025-03-26","2024-11-05","2024-10-07"],m3="2.0",DY=E.union([E.string(),E.number().int()]),wY=E.string(),fBe=E.object({progressToken:E.optional(DY)}).passthrough(),Xa=E.object({_meta:E.optional(fBe)}).passthrough(),Gi=E.object({method:E.string(),params:E.optional(Xa)}),k2=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Fo=E.object({method:E.string(),params:E.optional(k2)}),Za=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),v3=E.union([E.string(),E.number().int()]),EY=E.object({jsonrpc:E.literal(m3),id:v3}).merge(Gi).strict(),g3=t=>EY.safeParse(t).success,_Y=E.object({jsonrpc:E.literal(m3)}).merge(Fo).strict(),CY=t=>_Y.safeParse(t).success,SY=E.object({jsonrpc:E.literal(m3),id:v3,result:Za}).strict(),q2=t=>SY.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"})(Xr||(Xr={}));AY=E.object({jsonrpc:E.literal(m3),id:v3,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict(),FY=t=>AY.safeParse(t).success,qf=E.union([EY,_Y,SY,AY]),y0=Za.strict(),y3=Fo.extend({method:E.literal("notifications/cancelled"),params:k2.extend({requestId:v3,reason:E.string().optional()})}),hBe=E.object({src:E.string(),mimeType:E.optional(E.string()),sizes:E.optional(E.array(E.string()))}).passthrough(),L2=E.object({icons:E.array(hBe).optional()}).passthrough(),M2=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),TY=M2.extend({version:E.string(),websiteUrl:E.optional(E.string())}).merge(L2),mBe=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),vBe=Gi.extend({method:E.literal("initialize"),params:Xa.extend({protocolVersion:E.string(),capabilities:mBe,clientInfo:TY})}),gBe=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),BA=Za.extend({protocolVersion:E.string(),capabilities:gBe,serverInfo:TY,instructions:E.optional(E.string())}),OY=Fo.extend({method:E.literal("notifications/initialized")}),IY=t=>OY.safeParse(t).success,x3=Gi.extend({method:E.literal("ping")}),yBe=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),b3=Fo.extend({method:E.literal("notifications/progress"),params:k2.merge(yBe).extend({progressToken:DY})}),D3=Gi.extend({params:Xa.extend({cursor:E.optional(wY)}).optional()}),w3=Za.extend({nextCursor:E.optional(wY)}),PY=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),BY=PY.extend({text:E.string()}),RA=E.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),RY=PY.extend({blob:RA}),NY=M2.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).merge(L2),xBe=M2.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).merge(L2),bBe=D3.extend({method:E.literal("resources/list")}),NA=w3.extend({resources:E.array(NY)}),DBe=D3.extend({method:E.literal("resources/templates/list")}),kA=w3.extend({resourceTemplates:E.array(xBe)}),wBe=Gi.extend({method:E.literal("resources/read"),params:Xa.extend({uri:E.string()})}),qA=Za.extend({contents:E.array(E.union([BY,RY]))}),EBe=Fo.extend({method:E.literal("notifications/resources/list_changed")}),_Be=Gi.extend({method:E.literal("resources/subscribe"),params:Xa.extend({uri:E.string()})}),CBe=Gi.extend({method:E.literal("resources/unsubscribe"),params:Xa.extend({uri:E.string()})}),SBe=Fo.extend({method:E.literal("notifications/resources/updated"),params:k2.extend({uri:E.string()})}),ABe=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),FBe=M2.extend({description:E.optional(E.string()),arguments:E.optional(E.array(ABe)),_meta:E.optional(E.object({}).passthrough())}).merge(L2),TBe=D3.extend({method:E.literal("prompts/list")}),LA=w3.extend({prompts:E.array(FBe)}),OBe=Gi.extend({method:E.literal("prompts/get"),params:Xa.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),MA=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),jA=E.object({type:E.literal("image"),data:RA,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),UA=E.object({type:E.literal("audio"),data:RA,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),IBe=E.object({type:E.literal("resource"),resource:E.union([BY,RY]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),PBe=NY.extend({type:E.literal("resource_link")}),kY=E.union([MA,jA,UA,PBe,IBe]),BBe=E.object({role:E.enum(["user","assistant"]),content:kY}).passthrough(),$A=Za.extend({description:E.optional(E.string()),messages:E.array(BBe)}),RBe=Fo.extend({method:E.literal("notifications/prompts/list_changed")}),NBe=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),kBe=M2.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(NBe),_meta:E.optional(E.object({}).passthrough())}).merge(L2),qBe=D3.extend({method:E.literal("tools/list")}),VA=w3.extend({tools:E.array(kBe)}),E3=Za.extend({content:E.array(kY).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),ZBt=E3.or(Za.extend({toolResult:E.unknown()})),zA=Gi.extend({method:E.literal("tools/call"),params:Xa.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),LBe=Fo.extend({method:E.literal("notifications/tools/list_changed")}),qY=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),MBe=Gi.extend({method:E.literal("logging/setLevel"),params:Xa.extend({level:qY})}),HA=Fo.extend({method:E.literal("notifications/message"),params:k2.extend({level:qY,logger:E.optional(E.string()),data:E.unknown()})}),jBe=E.object({name:E.string().optional()}).passthrough(),UBe=E.object({hints:E.optional(E.array(jBe)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),$Be=E.object({role:E.enum(["user","assistant"]),content:E.union([MA,jA,UA])}).passthrough(),VBe=Gi.extend({method:E.literal("sampling/createMessage"),params:Xa.extend({messages:E.array($Be),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional(UBe)})}),zBe=Za.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[MA,jA,UA])}),HBe=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),KBe=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),WBe=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),GBe=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),YBe=E.union([HBe,KBe,WBe,GBe]),JBe=Gi.extend({method:E.literal("elicitation/create"),params:Xa.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),YBe),required:E.optional(E.array(E.string()))}).passthrough()})}),QBe=Za.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),XBe=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough(),ZBe=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),eRe=Gi.extend({method:E.literal("completion/complete"),params:Xa.extend({ref:E.union([ZBe,XBe]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),KA=Za.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),tRe=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),rRe=Gi.extend({method:E.literal("roots/list")}),nRe=Za.extend({roots:E.array(tRe)}),iRe=Fo.extend({method:E.literal("notifications/roots/list_changed")}),eRt=E.union([x3,vBe,eRe,MBe,OBe,TBe,bBe,DBe,wBe,_Be,CBe,zA,qBe]),tRt=E.union([y3,b3,OY,iRe]),rRt=E.union([y0,zBe,QBe,nRe]),nRt=E.union([x3,VBe,JBe,rRe]),iRt=E.union([y3,b3,HA,SBe,EBe,LBe,RBe]),aRt=E.union([y0,BA,KA,$A,LA,NA,kA,qA,E3,VA]),Qa=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});var UY=x((fRt,jY)=>{"use strict";var cRe=/[|\\{}()[\]^$+*?.]/g;jY.exports=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(cRe,"\\$&")}});var j2=x((hRt,A3)=>{"use strict";var lRe=UY(),{platform:$Y}=process,To={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"},VY={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:To.heart,nodejs:"\u2666",arrowUp:To.arrowUp,arrowDown:To.arrowDown,arrowLeft:To.arrowLeft,arrowRight:To.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"};$Y==="linux"&&(To.questionMarkPrefix="?");var S3=$Y==="win32"?VY:To,pRe=t=>{if(S3===To)return t;for(let[e,r]of Object.entries(To))r!==S3[e]&&(t=t.replace(new RegExp(lRe(r),"g"),S3[e]));return t};A3.exports=Object.assign(pRe,S3);A3.exports.main=To;A3.exports.windows=VY});var U2=x((mRt,zY)=>{"use strict";var dRe=qt(),fRe=j2(),F3=class{constructor(e){this.type="separator",this.line=dRe.dim(e||new Array(15).join(fRe.line))}toString(){return this.line}};F3.exclude=function(t){return t.type!=="separator"};zY.exports=F3});var WY=x((HY,KY)=>{var hRe=pe("stream");HY=KY.exports=GA;GA.through=GA;function GA(t,e,r){t=t||function(p){this.queue(p)},e=e||function(){this.queue(null)};var n=!1,i=!1,a=[],s=!1,o=new hRe;o.readable=o.writable=!0,o.paused=!1,o.autoDestroy=!(r&&r.autoDestroy===!1),o.write=function(p){return t.call(this,p),!o.paused};function u(){for(;a.length&&!o.paused;){var p=a.shift();if(p===null)return o.emit("end");o.emit("data",p)}}o.queue=o.push=function(p){return s||(p===null&&(s=!0),a.push(p),u()),o},o.on("end",function(){o.readable=!1,!o.writable&&o.autoDestroy&&process.nextTick(function(){o.destroy()})});function c(){o.writable=!1,e.call(o),!o.readable&&o.autoDestroy&&o.destroy()}return o.end=function(p){if(!n)return n=!0,arguments.length&&o.write(p),c(),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")),u(),o.paused||o.emit("drain"),o},o}});var YY=x((vRt,GY)=>{var YA=pe("stream");GY.exports=Pn;function Pn(t){YA.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}Pn.prototype=Object.create(YA.prototype);Object.defineProperty(Pn.prototype,"constructor",{value:Pn,enumerable:!1});Pn.prototype.mute=function(){this.muted=!0};Pn.prototype.unmute=function(){this.muted=!1};Object.defineProperty(Pn.prototype,"_onpipe",{value:mRe,enumerable:!1,writable:!0,configurable:!0});function mRe(t){this._src=t}Object.defineProperty(Pn.prototype,"isTTY",{get:vRe,set:gRe,enumerable:!0,configurable:!0});function vRe(){return this._dest?this._dest.isTTY:this._src?this._src.isTTY:!1}function gRe(t){Object.defineProperty(this,"isTTY",{value:t,enumerable:!0,writable:!0,configurable:!0})}Object.defineProperty(Pn.prototype,"rows",{get:function(){return this._dest?this._dest.rows:this._src?this._src.rows:void 0},enumerable:!0,configurable:!0});Object.defineProperty(Pn.prototype,"columns",{get:function(){return this._dest?this._dest.columns:this._src?this._src.columns:void 0},enumerable:!0,configurable:!0});Pn.prototype.pipe=function(t,e){return this._dest=t,YA.prototype.pipe.call(this,t,e)};Pn.prototype.pause=function(){if(this._src)return this._src.pause()};Pn.prototype.resume=function(){if(this._src)return this._src.resume()};Pn.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)};Pn.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 JA(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)}}Pn.prototype.destroy=JA("destroy");Pn.prototype.destroySoon=JA("destroySoon");Pn.prototype.close=JA("close")});var XA=x((gRt,JY)=>{"use strict";var yRe=YY(),xRe=pe("readline"),QA=class{constructor(e){this.rl||(this.rl=xRe.createInterface(bRe(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 bRe(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 yRe;return r.pipe(t.output||process.stdout),{terminal:!0,...t,input:e,output:r}}JY.exports=QA});var eF=x((yRt,ZA)=>{"use strict";var Ut=ZA.exports;ZA.exports.default=Ut;var lr="\x1B[",$2="\x1B]",Lf="\x07",T3=";",QY=process.env.TERM_PROGRAM==="Apple_Terminal";Ut.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?lr+(t+1)+"G":lr+(e+1)+";"+(t+1)+"H"};Ut.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=lr+-t+"D":t>0&&(r+=lr+t+"C"),e<0?r+=lr+-e+"A":e>0&&(r+=lr+e+"B"),r};Ut.cursorUp=(t=1)=>lr+t+"A";Ut.cursorDown=(t=1)=>lr+t+"B";Ut.cursorForward=(t=1)=>lr+t+"C";Ut.cursorBackward=(t=1)=>lr+t+"D";Ut.cursorLeft=lr+"G";Ut.cursorSavePosition=QY?"\x1B7":lr+"s";Ut.cursorRestorePosition=QY?"\x1B8":lr+"u";Ut.cursorGetPosition=lr+"6n";Ut.cursorNextLine=lr+"E";Ut.cursorPrevLine=lr+"F";Ut.cursorHide=lr+"?25l";Ut.cursorShow=lr+"?25h";Ut.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=Ut.eraseLine+(r<t-1?Ut.cursorUp():"");return t&&(e+=Ut.cursorLeft),e};Ut.eraseEndLine=lr+"K";Ut.eraseStartLine=lr+"1K";Ut.eraseLine=lr+"2K";Ut.eraseDown=lr+"J";Ut.eraseUp=lr+"1J";Ut.eraseScreen=lr+"2J";Ut.scrollUp=lr+"S";Ut.scrollDown=lr+"T";Ut.clearScreen="\x1Bc";Ut.clearTerminal=process.platform==="win32"?`${Ut.eraseScreen}${lr}0f`:`${Ut.eraseScreen}${lr}3J${lr}H`;Ut.beep=Lf;Ut.link=(t,e)=>[$2,"8",T3,T3,e,Lf,t,$2,"8",T3,T3,Lf].join("");Ut.image=(t,e={})=>{let r=`${$2}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")+Lf};Ut.iTerm={setCwd:(t=process.cwd())=>`${$2}50;CurrentDir=${t}${Lf}`,annotation:(t,e={})=>{let r=`${$2}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+Lf}}});var O3=x(Mf=>{"use strict";var V2=eF();Mf.left=function(t,e){t.output.write(V2.cursorBackward(e))};Mf.right=function(t,e){t.output.write(V2.cursorForward(e))};Mf.up=function(t,e){t.output.write(V2.cursorUp(e))};Mf.down=function(t,e){t.output.write(V2.cursorDown(e))};Mf.clearLine=function(t,e){t.output.write(V2.eraseLines(e))}});var ZY=x((bRt,XY)=>{"use strict";var DRe=WY(),wRe=XA(),tF=O3(),rF=class extends wRe{constructor(e={}){super(e),this.log=DRe(this.writeLog.bind(this)),this.bottomBar=e.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return tF.clearLine(this.rl,this.bottomBar.split(`
|
|
188
188
|
`).length),this}updateBottomBar(e){return tF.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+`
|
|
189
189
|
`}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&&tF.left(this.rl,e.length+this.rl.line.length),this.rl.output.write(e)}};XY.exports=rF});var nF=x((DRt,eJ)=>{var ERe=typeof global=="object"&&global&&global.Object===Object&&global;eJ.exports=ERe});var zs=x((wRt,tJ)=>{var _Re=nF(),CRe=typeof self=="object"&&self&&self.Object===Object&&self,SRe=_Re||CRe||Function("return this")();tJ.exports=SRe});var jf=x((ERt,rJ)=>{var ARe=zs(),FRe=ARe.Symbol;rJ.exports=FRe});var sJ=x((_Rt,aJ)=>{var nJ=jf(),iJ=Object.prototype,TRe=iJ.hasOwnProperty,ORe=iJ.toString,z2=nJ?nJ.toStringTag:void 0;function IRe(t){var e=TRe.call(t,z2),r=t[z2];try{t[z2]=void 0;var n=!0}catch{}var i=ORe.call(t);return n&&(e?t[z2]=r:delete t[z2]),i}aJ.exports=IRe});var uJ=x((CRt,oJ)=>{var PRe=Object.prototype,BRe=PRe.toString;function RRe(t){return BRe.call(t)}oJ.exports=RRe});var x0=x((SRt,pJ)=>{var cJ=jf(),NRe=sJ(),kRe=uJ(),qRe="[object Null]",LRe="[object Undefined]",lJ=cJ?cJ.toStringTag:void 0;function MRe(t){return t==null?t===void 0?LRe:qRe:lJ&&lJ in Object(t)?NRe(t):kRe(t)}pJ.exports=MRe});var iF=x((ARt,dJ)=>{function jRe(t,e){return function(r){return t(e(r))}}dJ.exports=jRe});var I3=x((FRt,fJ)=>{var URe=iF(),$Re=URe(Object.getPrototypeOf,Object);fJ.exports=$Re});var Vu=x((TRt,hJ)=>{function VRe(t){return t!=null&&typeof t=="object"}hJ.exports=VRe});var gJ=x((ORt,vJ)=>{var zRe=x0(),HRe=I3(),KRe=Vu(),WRe="[object Object]",GRe=Function.prototype,YRe=Object.prototype,mJ=GRe.toString,JRe=YRe.hasOwnProperty,QRe=mJ.call(Object);function XRe(t){if(!KRe(t)||zRe(t)!=WRe)return!1;var e=HRe(t);if(e===null)return!0;var r=JRe.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&mJ.call(r)==QRe}vJ.exports=XRe});var es=x((IRt,yJ)=>{var ZRe=Array.isArray;yJ.exports=ZRe});var P3=x((PRt,xJ)=>{var eNe=x0(),tNe=Vu(),rNe="[object Symbol]";function nNe(t){return typeof t=="symbol"||tNe(t)&&eNe(t)==rNe}xJ.exports=nNe});var B3=x((BRt,bJ)=>{var iNe=es(),aNe=P3(),sNe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,oNe=/^\w*$/;function uNe(t,e){if(iNe(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||aNe(t)?!0:oNe.test(t)||!sNe.test(t)||e!=null&&t in Object(e)}bJ.exports=uNe});var zu=x((RRt,DJ)=>{function cNe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}DJ.exports=cNe});var aF=x((NRt,wJ)=>{var lNe=x0(),pNe=zu(),dNe="[object AsyncFunction]",fNe="[object Function]",hNe="[object GeneratorFunction]",mNe="[object Proxy]";function vNe(t){if(!pNe(t))return!1;var e=lNe(t);return e==fNe||e==hNe||e==dNe||e==mNe}wJ.exports=vNe});var _J=x((kRt,EJ)=>{var gNe=zs(),yNe=gNe["__core-js_shared__"];EJ.exports=yNe});var AJ=x((qRt,SJ)=>{var sF=_J(),CJ=(function(){var t=/[^.]+$/.exec(sF&&sF.keys&&sF.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function xNe(t){return!!CJ&&CJ in t}SJ.exports=xNe});var oF=x((LRt,FJ)=>{var bNe=Function.prototype,DNe=bNe.toString;function wNe(t){if(t!=null){try{return DNe.call(t)}catch{}try{return t+""}catch{}}return""}FJ.exports=wNe});var OJ=x((MRt,TJ)=>{var ENe=aF(),_Ne=AJ(),CNe=zu(),SNe=oF(),ANe=/[\\^$.*+?()[\]{}|]/g,FNe=/^\[object .+?Constructor\]$/,TNe=Function.prototype,ONe=Object.prototype,INe=TNe.toString,PNe=ONe.hasOwnProperty,BNe=RegExp("^"+INe.call(PNe).replace(ANe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function RNe(t){if(!CNe(t)||_Ne(t))return!1;var e=ENe(t)?BNe:FNe;return e.test(SNe(t))}TJ.exports=RNe});var PJ=x((jRt,IJ)=>{function NNe(t,e){return t?.[e]}IJ.exports=NNe});var tl=x((URt,BJ)=>{var kNe=OJ(),qNe=PJ();function LNe(t,e){var r=qNe(t,e);return kNe(r)?r:void 0}BJ.exports=LNe});var H2=x(($Rt,RJ)=>{var MNe=tl(),jNe=MNe(Object,"create");RJ.exports=jNe});var qJ=x((VRt,kJ)=>{var NJ=H2();function UNe(){this.__data__=NJ?NJ(null):{},this.size=0}kJ.exports=UNe});var MJ=x((zRt,LJ)=>{function $Ne(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}LJ.exports=$Ne});var UJ=x((HRt,jJ)=>{var VNe=H2(),zNe="__lodash_hash_undefined__",HNe=Object.prototype,KNe=HNe.hasOwnProperty;function WNe(t){var e=this.__data__;if(VNe){var r=e[t];return r===zNe?void 0:r}return KNe.call(e,t)?e[t]:void 0}jJ.exports=WNe});var VJ=x((KRt,$J)=>{var GNe=H2(),YNe=Object.prototype,JNe=YNe.hasOwnProperty;function QNe(t){var e=this.__data__;return GNe?e[t]!==void 0:JNe.call(e,t)}$J.exports=QNe});var HJ=x((WRt,zJ)=>{var XNe=H2(),ZNe="__lodash_hash_undefined__";function eke(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=XNe&&e===void 0?ZNe:e,this}zJ.exports=eke});var WJ=x((GRt,KJ)=>{var tke=qJ(),rke=MJ(),nke=UJ(),ike=VJ(),ake=HJ();function Uf(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])}}Uf.prototype.clear=tke;Uf.prototype.delete=rke;Uf.prototype.get=nke;Uf.prototype.has=ike;Uf.prototype.set=ake;KJ.exports=Uf});var YJ=x((YRt,GJ)=>{function ske(){this.__data__=[],this.size=0}GJ.exports=ske});var $f=x((JRt,JJ)=>{function oke(t,e){return t===e||t!==t&&e!==e}JJ.exports=oke});var K2=x((QRt,QJ)=>{var uke=$f();function cke(t,e){for(var r=t.length;r--;)if(uke(t[r][0],e))return r;return-1}QJ.exports=cke});var ZJ=x((XRt,XJ)=>{var lke=K2(),pke=Array.prototype,dke=pke.splice;function fke(t){var e=this.__data__,r=lke(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():dke.call(e,r,1),--this.size,!0}XJ.exports=fke});var tQ=x((ZRt,eQ)=>{var hke=K2();function mke(t){var e=this.__data__,r=hke(e,t);return r<0?void 0:e[r][1]}eQ.exports=mke});var nQ=x((eNt,rQ)=>{var vke=K2();function gke(t){return vke(this.__data__,t)>-1}rQ.exports=gke});var aQ=x((tNt,iQ)=>{var yke=K2();function xke(t,e){var r=this.__data__,n=yke(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}iQ.exports=xke});var W2=x((rNt,sQ)=>{var bke=YJ(),Dke=ZJ(),wke=tQ(),Eke=nQ(),_ke=aQ();function Vf(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])}}Vf.prototype.clear=bke;Vf.prototype.delete=Dke;Vf.prototype.get=wke;Vf.prototype.has=Eke;Vf.prototype.set=_ke;sQ.exports=Vf});var R3=x((nNt,oQ)=>{var Cke=tl(),Ske=zs(),Ake=Cke(Ske,"Map");oQ.exports=Ake});var lQ=x((iNt,cQ)=>{var uQ=WJ(),Fke=W2(),Tke=R3();function Oke(){this.size=0,this.__data__={hash:new uQ,map:new(Tke||Fke),string:new uQ}}cQ.exports=Oke});var dQ=x((aNt,pQ)=>{function Ike(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}pQ.exports=Ike});var G2=x((sNt,fQ)=>{var Pke=dQ();function Bke(t,e){var r=t.__data__;return Pke(e)?r[typeof e=="string"?"string":"hash"]:r.map}fQ.exports=Bke});var mQ=x((oNt,hQ)=>{var Rke=G2();function Nke(t){var e=Rke(this,t).delete(t);return this.size-=e?1:0,e}hQ.exports=Nke});var gQ=x((uNt,vQ)=>{var kke=G2();function qke(t){return kke(this,t).get(t)}vQ.exports=qke});var xQ=x((cNt,yQ)=>{var Lke=G2();function Mke(t){return Lke(this,t).has(t)}yQ.exports=Mke});var DQ=x((lNt,bQ)=>{var jke=G2();function Uke(t,e){var r=jke(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}bQ.exports=Uke});var N3=x((pNt,wQ)=>{var $ke=lQ(),Vke=mQ(),zke=gQ(),Hke=xQ(),Kke=DQ();function zf(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])}}zf.prototype.clear=$ke;zf.prototype.delete=Vke;zf.prototype.get=zke;zf.prototype.has=Hke;zf.prototype.set=Kke;wQ.exports=zf});var CQ=x((dNt,_Q)=>{var EQ=N3(),Wke="Expected a function";function uF(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Wke);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(uF.Cache||EQ),r}uF.Cache=EQ;_Q.exports=uF});var AQ=x((fNt,SQ)=>{var Gke=CQ(),Yke=500;function Jke(t){var e=Gke(t,function(n){return r.size===Yke&&r.clear(),n}),r=e.cache;return e}SQ.exports=Jke});var TQ=x((hNt,FQ)=>{var Qke=AQ(),Xke=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Zke=/\\(\\)?/g,eqe=Qke(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Xke,function(r,n,i,a){e.push(i?a.replace(Zke,"$1"):n||r)}),e});FQ.exports=eqe});var cF=x((mNt,OQ)=>{function tqe(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}OQ.exports=tqe});var kQ=x((vNt,NQ)=>{var IQ=jf(),rqe=cF(),nqe=es(),iqe=P3(),aqe=1/0,PQ=IQ?IQ.prototype:void 0,BQ=PQ?PQ.toString:void 0;function RQ(t){if(typeof t=="string")return t;if(nqe(t))return rqe(t,RQ)+"";if(iqe(t))return BQ?BQ.call(t):"";var e=t+"";return e=="0"&&1/t==-aqe?"-0":e}NQ.exports=RQ});var LQ=x((gNt,qQ)=>{var sqe=kQ();function oqe(t){return t==null?"":sqe(t)}qQ.exports=oqe});var k3=x((yNt,MQ)=>{var uqe=es(),cqe=B3(),lqe=TQ(),pqe=LQ();function dqe(t,e){return uqe(t)?t:cqe(t,e)?[t]:lqe(pqe(t))}MQ.exports=dqe});var Hf=x((xNt,jQ)=>{var fqe=P3(),hqe=1/0;function mqe(t){if(typeof t=="string"||fqe(t))return t;var e=t+"";return e=="0"&&1/t==-hqe?"-0":e}jQ.exports=mqe});var lF=x((bNt,UQ)=>{var vqe=k3(),gqe=Hf();function yqe(t,e){e=vqe(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[gqe(e[r++])];return r&&r==n?t:void 0}UQ.exports=yqe});var pF=x((DNt,$Q)=>{var xqe=lF();function bqe(t,e,r){var n=t==null?void 0:xqe(t,e);return n===void 0?r:n}$Q.exports=bqe});var dF=x((wNt,VQ)=>{var Dqe=tl(),wqe=(function(){try{var t=Dqe(Object,"defineProperty");return t({},"",{}),t}catch{}})();VQ.exports=wqe});var fF=x((ENt,HQ)=>{var zQ=dF();function Eqe(t,e,r){e=="__proto__"&&zQ?zQ(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}HQ.exports=Eqe});var q3=x((_Nt,KQ)=>{var _qe=fF(),Cqe=$f(),Sqe=Object.prototype,Aqe=Sqe.hasOwnProperty;function Fqe(t,e,r){var n=t[e];(!(Aqe.call(t,e)&&Cqe(n,r))||r===void 0&&!(e in t))&&_qe(t,e,r)}KQ.exports=Fqe});var Y2=x((CNt,WQ)=>{var Tqe=9007199254740991,Oqe=/^(?:0|[1-9]\d*)$/;function Iqe(t,e){var r=typeof t;return e=e??Tqe,!!e&&(r=="number"||r!="symbol"&&Oqe.test(t))&&t>-1&&t%1==0&&t<e}WQ.exports=Iqe});var JQ=x((SNt,YQ)=>{var Pqe=q3(),Bqe=k3(),Rqe=Y2(),GQ=zu(),Nqe=Hf();function kqe(t,e,r,n){if(!GQ(t))return t;e=Bqe(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var u=Nqe(e[i]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(i!=s){var p=o[u];c=n?n(p,u,o):void 0,c===void 0&&(c=GQ(p)?p:Rqe(e[i+1])?[]:{})}Pqe(o,u,c),o=o[u]}return t}YQ.exports=kqe});var XQ=x((ANt,QQ)=>{var qqe=JQ();function Lqe(t,e,r){return t==null?t:qqe(t,e,r)}QQ.exports=Lqe});var pr=x(L3=>{"use strict";Object.defineProperty(L3,"__esModule",{value:!0});L3.isFunction=void 0;function Mqe(t){return typeof t=="function"}L3.isFunction=Mqe});var rl=x(M3=>{"use strict";Object.defineProperty(M3,"__esModule",{value:!0});M3.createErrorClass=void 0;function jqe(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}M3.createErrorClass=jqe});var hF=x(j3=>{"use strict";Object.defineProperty(j3,"__esModule",{value:!0});j3.UnsubscriptionError=void 0;var Uqe=rl();j3.UnsubscriptionError=Uqe.createErrorClass(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
@@ -394,7 +394,7 @@ ${V4.default.rgb(234,88,12)("Thanks for using Smithery stdio listener!")}
|
|
|
394
394
|
|
|
395
395
|
Feedback/Bug Reports: ${V4.default.blue.underline("https://github.com/smithery-ai/cli/issues/new")}
|
|
396
396
|
|
|
397
|
-
`)};process.on("SIGINT",h),process.on("SIGTERM",h),process.on("beforeExit",h),process.on("exit",()=>{J("[stdio listener] Final cleanup on exit")});try{await b(),await g(),console.log(V4.default.green("\u2705 Command server started, setting up uplink tunnel..."));let{listener:_}=await _o(String(c),e,r.open!==!1,r.initialMessage||"Say hello to the world!");o=_,console.log(V4.default.green("\u{1F680} Command uplink tunnel established and playground opened"))}catch(_){throw J(`[stdio listener] Failed to start: ${_}`),await D(),_}return D}});var Mi=ke(qt(),1);var sz=ke(az(),1),{program:XTt,createCommand:ZTt,createArgument:eOt,createOption:tOt,CommanderError:rOt,InvalidArgumentError:nOt,InvalidOptionArgumentError:iOt,Command:oz,Argument:aOt,Option:sOt,Help:oOt}=sz.default;var Ti=ke(qt(),1);import{existsSync as bf,mkdirSync as ROe,readFileSync as NOe,statSync as kOe}from"node:fs";import{dirname as eW,join as qOe,resolve as HS}from"node:path";import*as G8 from"esbuild";function Yg(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}var YK=ke($S(),1);import{existsSync as COe,readFileSync as SOe}from"node:fs";import{join as AOe}from"node:path";function VS(t=process.cwd()){let e=AOe(t,"smithery.yaml");if(!COe(e))throw new Error("smithery.yaml not found. Please ensure you're in a Smithery project directory.");let r=SOe(e,"utf-8"),n=(0,YK.parse)(r);if(!n.runtime)throw new Error('smithery.yaml must specify a "runtime" field (e.g., runtime: typescript)');return{runtime:n.runtime,type:n.type||"server",target:n.target,build:n.build,startCommand:n.startCommand}}function yf(t=process.cwd()){try{return VS(t).type==="widget"}catch{return!1}}var Gc=ke(qt(),1);import{existsSync as zS,mkdirSync as FOe,statSync as TOe}from"node:fs";import{dirname as OOe,resolve as Yp}from"node:path";import*as JK from"esbuild";function IOe(t){let e=[Yp(t,"app/web/src/index.tsx"),Yp(t,"app/web/src/index.ts"),Yp(t,"app/web/src/index.jsx"),Yp(t,"app/web/src/index.js")];for(let r of e)if(zS(r))return r;throw new Error("No index file found. Please create app/web/src/index.tsx to mount your component.")}async function POe(t,e){let{name:r,bundlePath:n}=t,i=e.cwd||process.cwd();console.log(Gc.default.dim(` Building widget: ${Gc.default.cyan(r)}`));let
|
|
397
|
+
`)};process.on("SIGINT",h),process.on("SIGTERM",h),process.on("beforeExit",h),process.on("exit",()=>{J("[stdio listener] Final cleanup on exit")});try{await b(),await g(),console.log(V4.default.green("\u2705 Command server started, setting up uplink tunnel..."));let{listener:_}=await _o(String(c),e,r.open!==!1,r.initialMessage||"Say hello to the world!");o=_,console.log(V4.default.green("\u{1F680} Command uplink tunnel established and playground opened"))}catch(_){throw J(`[stdio listener] Failed to start: ${_}`),await D(),_}return D}});var Mi=ke(qt(),1);var sz=ke(az(),1),{program:XTt,createCommand:ZTt,createArgument:eOt,createOption:tOt,CommanderError:rOt,InvalidArgumentError:nOt,InvalidOptionArgumentError:iOt,Command:oz,Argument:aOt,Option:sOt,Help:oOt}=sz.default;var Ti=ke(qt(),1);import{existsSync as bf,mkdirSync as ROe,readFileSync as NOe,statSync as kOe}from"node:fs";import{dirname as eW,join as qOe,resolve as HS}from"node:path";import*as G8 from"esbuild";function Yg(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}var YK=ke($S(),1);import{existsSync as COe,readFileSync as SOe}from"node:fs";import{join as AOe}from"node:path";function VS(t=process.cwd()){let e=AOe(t,"smithery.yaml");if(!COe(e))throw new Error("smithery.yaml not found. Please ensure you're in a Smithery project directory.");let r=SOe(e,"utf-8"),n=(0,YK.parse)(r);if(!n.runtime)throw new Error('smithery.yaml must specify a "runtime" field (e.g., runtime: typescript)');return{runtime:n.runtime,type:n.type||"server",target:n.target,build:n.build,startCommand:n.startCommand}}function yf(t=process.cwd()){try{return VS(t).type==="widget"}catch{return!1}}var Gc=ke(qt(),1);import{existsSync as zS,mkdirSync as FOe,statSync as TOe}from"node:fs";import{dirname as OOe,resolve as Yp}from"node:path";import*as JK from"esbuild";function IOe(t){let e=[Yp(t,"app/web/src/index.tsx"),Yp(t,"app/web/src/index.ts"),Yp(t,"app/web/src/index.jsx"),Yp(t,"app/web/src/index.js")];for(let r of e)if(zS(r))return r;throw new Error("No index file found. Please create app/web/src/index.tsx to mount your component.")}async function POe(t,e){let{name:r,bundlePath:n}=t,i=e.cwd||process.cwd(),a=e.minify??!0;console.log(Gc.default.dim(` Building widget: ${Gc.default.cyan(r)}`));let s=Yp(i,n),o=OOe(s);zS(o)||FOe(o,{recursive:!0});let c={entryPoints:[IOe(i)],bundle:!0,format:"esm",outfile:s,minify:a,sourcemap:a?!1:"inline",treeShaking:!0,target:"es2020",platform:"browser",loader:{".css":"text"},define:{"process.env.NODE_ENV":JSON.stringify(e.production?"production":"development")},nodePaths:[Yp(i,"app/web/node_modules"),Yp(i,"node_modules")]},p=await JK.build(c);if(p.errors.length>0)throw console.error(Gc.default.red(`\u2717 Widget build failed: ${r}`)),console.error(p.errors),new Error(`Widget build failed: ${r}`);if(zS(s)){let d=TOe(s),h=Yg(d.size),m=a?"":" (not minified)";console.log(Gc.default.dim(` ${n} ${Gc.default.yellow(h)}${m}`))}}async function C2(t,e={}){t.length!==0&&(console.log(Gc.default.dim(`
|
|
398
398
|
Building ${t.length} widget(s)...`)),await Promise.all(t.map(r=>POe(r,e))),console.log(Gc.default.green(`\u2713 Widgets built successfully
|
|
399
399
|
`)))}var K8=ke(qt(),1);import{existsSync as QK,readdirSync as BOe}from"node:fs";import{join as S2}from"node:path";function Jp(t=process.cwd()){let e=S2(t,"app/web/src");if(!QK(e))return[];let n=BOe(e).filter(s=>s.endsWith(".tsx")&&!s.startsWith("types")&&s!=="index.tsx");if(n.length===0)return console.warn(K8.default.yellow("\u26A0\uFE0F No .tsx widgets found in app/web/src/")),[];let i=n.map(s=>{let o=s.replace(".tsx",""),u=`${o}.css`,c=S2(e,u);return{name:o,componentFile:S2("app/web/src",s),cssFile:QK(c)?S2("app/web/src",u):void 0,bundlePath:S2(".smithery",`${o}.js`)}});console.log(K8.default.dim(`Found ${i.length} widget(s): ${i.map(s=>s.name).join(", ")}`));let a=i.filter(s=>s.cssFile);return a.length>0&&console.log(K8.default.dim(` ${a.length} widget(s) with CSS: ${a.map(s=>s.name).join(", ")}`)),i}var xf=ke(qt(),1);import{existsSync as XK}from"node:fs";import{join as ZK}from"node:path";function W8(t=process.cwd()){if(VS(t).type!=="widget")return;let r=ZK(t,"app/web/src");if(!XK(r))throw new Error(`${xf.default.red("\u2717 Widget project missing app/web/src directory")}
|
|
400
400
|
|
|
@@ -407,7 +407,7 @@ Fix this by either:
|
|
|
407
407
|
Expected file does not exist: ${a}`)}console.log(xf.default.dim("\u2713 Widget project structure validated"))}function LOe(t){if(t){let a=HS(process.cwd(),t);if(!bf(a))throw new Error(`Entry file not found at ${a}`);return a}let e=qOe(process.cwd(),"package.json");if(!bf(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=NOe(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:
|
|
408
408
|
"module": "./src/index.ts"
|
|
409
409
|
Or specify an entry file directly with the command.`);let n=r.module,i=HS(process.cwd(),n);if(!bf(i))throw new Error(`Entry file specified in package.json not found at ${i}.
|
|
410
|
-
Check that the file exists or update your package.json`);return i}async function MOe(t){let e=t?[t]:["smithery.config.js","smithery.config.mjs","smithery.config.cjs"];for(let r of e){let n=HS(process.cwd(),r);if(bf(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 jOe(t,e){let r=performance.now(),n=t.outFile||".smithery/index.cjs",i=t.transport??"shttp",a=eW(n);bf(a)||ROe(a,{recursive:!0});let s=i==="shttp"?"streamable http":i;console.log(Ti.default.dim(`${Ti.default.bold.italic.hex("#ea580c")("SMITHERY")} ${Ti.default.bold.italic.hex("#ea580c")("v1.6.
|
|
410
|
+
Check that the file exists or update your package.json`);return i}async function MOe(t){let e=t?[t]:["smithery.config.js","smithery.config.mjs","smithery.config.cjs"];for(let r of e){let n=HS(process.cwd(),r);if(bf(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 jOe(t,e){let r=performance.now(),n=t.outFile||".smithery/index.cjs",i=t.transport??"shttp",a=eW(n);bf(a)||ROe(a,{recursive:!0});let s=i==="shttp"?"streamable http":i;console.log(Ti.default.dim(`${Ti.default.bold.italic.hex("#ea580c")("SMITHERY")} ${Ti.default.bold.italic.hex("#ea580c")("v1.6.3")} Building MCP server with ${Ti.default.cyan(s)} transport...`));let o=()=>({name:"smithery-bootstrap-plugin",setup(h){h.onResolve({filter:/^virtual:bootstrap$/},()=>({path:"virtual:bootstrap",namespace:"bootstrap"})),h.onLoad({filter:/.*/,namespace:"bootstrap"},()=>({contents:(i==="stdio"?`// src/runtime/stdio-bootstrap.ts
|
|
411
411
|
import * as _entry from "virtual:user-module";
|
|
412
412
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
413
413
|
import chalk from "chalk";
|
|
@@ -603,15 +603,15 @@ async function startMcpServer() {
|
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
startMcpServer();
|
|
606
|
-
`).replace('import * as _entry from "virtual:user-module"',`import * as _entry from ${JSON.stringify(e)}`),loader:"js",resolveDir:eW(e)}))}}),u={bundle:!0,platform:"node",target:"node20",outfile:n,minify:
|
|
607
|
-
${
|
|
608
|
-
`)}return
|
|
606
|
+
`).replace('import * as _entry from "virtual:user-module"',`import * as _entry from ${JSON.stringify(e)}`),loader:"js",resolveDir:eW(e)}))}}),u=t.minify??!0,c={bundle:!0,platform:"node",target:"node20",outfile:n,minify:u,sourcemap:u?!1:"inline",format:"cjs"},p;p={...c,entryPoints:["virtual:bootstrap"],plugins:[o()],define:{"process.env.NODE_ENV":JSON.stringify(t.production?"production":"development")}};let d=await MOe(t.configFile);if(p={...p,...d},t.watch&&t.onRebuild){let h=[...p.plugins||[],{name:"rebuild-handler",setup(v){let g=!1;v.onEnd(b=>{if(b.errors.length>0){console.error(Ti.default.red("\u2717 Build error:"),b.errors),t.onRebuild?.(!1,[]);return}console.log(g?Ti.default.dim(Ti.default.green("\u2713 Built successfully")):Ti.default.dim(Ti.default.green("\u2713 Initial build complete")));let D=b.outputFiles?.map(_=>_.path)||[n];t.onRebuild?.(!0,D),g=!0})}}],m=await G8.context({...p,plugins:h});return await m.watch(),m}try{let h=await G8.build(p);h.errors.length>0&&(console.log(Ti.default.red("\u2717 Build failed")),console.error(h.errors),process.exit(1));let m=performance.now(),v=Math.round(m-r);if(console.log(Ti.default.green(`\u2713 Built MCP server in ${v}ms`)),bf(n)){let g=kOe(n),b=n.replace(`${process.cwd()}/`,""),D=Yg(g.size),_=u?"":" (not minified)";console.log(`
|
|
607
|
+
${b} ${Ti.default.yellow(D)} ${Ti.default.gray("(entry point)")}${_}
|
|
608
|
+
`)}return h}catch(h){console.log(Ti.default.red("\u2717 Build failed")),console.error(h),process.exit(1)}}async function Y8(t={}){let e=LOe(t.entryFile);yf()&&W8();let r=await jOe(t,e);if(!t.watch&&yf()){let n=Jp();n.length>0&&await C2(n,{production:t.production})}return r}async function tW(t={}){try{await Y8({entryFile:t.entryFile,outFile:t.outFile,transport:t.transport,watch:!1,production:!0,configFile:t.configFile,bundleAll:t.bundleAll})}catch(e){console.error("\u2717 Build failed:",e),process.exit(1)}}var ea=ke(qt(),1);import{spawn as smt}from"node:child_process";import{existsSync as SR,watch as omt}from"node:fs";import{join as Kv}from"node:path";var Df="https://smithery.ai/api/track";_f();va();async function i3(t){let{childProcess:e,processName:r}=t;if(!e||e.killed)return;let n=new Promise(a=>{let s=()=>{e.removeListener("exit",s),a()};e.on("exit",s)});try{e.kill("SIGTERM")}catch{return}let i=new Promise(a=>{setTimeout(()=>{if(e&&!e.killed)try{e.kill("SIGKILL")}catch{}a()},5e3)});await Promise.race([n,i])}var a3=ke(qt(),1);function s3(t){let{cleanupFn:e,processName:r="server",showExitMessage:n=!0}=t,i=!1,a=async()=>{i||(i=!0,n&&console.log(a3.default.gray(" Received exit signal, shutting down...")),await e(),console.log(a3.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")),process.exit(0))};process.on("SIGINT",a),process.on("SIGTERM",a),process.stdin.resume(),process.stdin.on("end",a),process.stdin.on("error",a),console.log(a3.default.gray(`Press Ctrl+C to stop the ${r}`))}import{exec as Xht}from"node:child_process";import{promisify as Zht}from"node:util";var MY=ke(uY(),1);import C3 from"node:process";import{PassThrough as sRe}from"node:stream";$u();var _3=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
609
609
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),aRe(r)}clear(){this._buffer=void 0}};function aRe(t){return qf.parse(JSON.parse(t))}function LY(t){return JSON.stringify(t)+`
|
|
610
610
|
`}var oRe=C3.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function WA(){let t={};for(let e of oRe){let r=C3.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var el=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new _3,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new sRe)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var n,i,a,s,o;this._process=(0,MY.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...WA(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:C3.platform==="win32"&&uRe(),cwd:this._serverParams.cwd}),this._process.on("error",u=>{var c,p;if(u.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}r(u),(p=this.onerror)===null||p===void 0||p.call(this,u)}),this._process.on("spawn",()=>{e()}),this._process.on("close",u=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(a=this._process.stdin)===null||a===void 0||a.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),(s=this._process.stdout)===null||s===void 0||s.on("data",u=>{this._readBuffer.append(u),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let i=LY(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}};function uRe(){return"type"in C3}var ba=ke(qt(),1),jb=ke(xa(),1);H0();va();import{promises as DR}from"node:fs";import{homedir as xR,platform as Yht}from"node:os";import{join as ch}from"node:path";var ti=[];for(let t=0;t<256;++t)ti.push((t+256).toString(16).slice(1));function hle(t,e=0){return(ti[t[e+0]]+ti[t[e+1]]+ti[t[e+2]]+ti[t[e+3]]+"-"+ti[t[e+4]]+ti[t[e+5]]+"-"+ti[t[e+6]]+ti[t[e+7]]+"-"+ti[t[e+8]]+ti[t[e+9]]+"-"+ti[t[e+10]]+ti[t[e+11]]+ti[t[e+12]]+ti[t[e+13]]+ti[t[e+14]]+ti[t[e+15]]).toLowerCase()}import{randomFillSync as Kht}from"crypto";var Nb=new Uint8Array(256),Rb=Nb.length;function vR(){return Rb>Nb.length-16&&(Kht(Nb),Rb=0),Nb.slice(Rb,Rb+=16)}import{randomUUID as Wht}from"crypto";var gR={randomUUID:Wht};function Ght(t,e,r){if(gR.randomUUID&&!e&&!t)return gR.randomUUID();t=t||{};let n=t.random??t.rng?.()??vR();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return hle(n)}var yR=Ght;va();var ds=null,bR=!1,kb=()=>({userId:yR(),analyticsConsent:!1,askedConsent:!1,cache:{servers:{}}}),ER=()=>{if(process.env.SMITHERY_CONFIG_PATH)return process.env.SMITHERY_CONFIG_PATH;let t={win32:()=>ch(process.env.APPDATA||ch(xR(),"AppData","Roaming"),"smithery"),darwin:()=>ch(xR(),"Library","Application Support","smithery"),default:()=>ch(xR(),".config","smithery")};return(t[Yht()]||t.default)()},Jht=t=>{if(!t||typeof t!="object")return!1;let{userId:e,analyticsConsent:r,askedConsent:n}=t;return typeof e=="string"&&typeof r=="boolean"&&typeof n=="boolean"},wR=(t,e)=>`Permission denied: Cannot ${e} settings at ${t}
|
|
611
611
|
Fix with: chmod 700 "${t}"
|
|
612
612
|
Or use: export SMITHERY_CONFIG_PATH="/custom/path"
|
|
613
|
-
Running in memory-only mode (settings won't persist).`,qb=async(t,e)=>{Q(`Saving settings to ${e}`),Q(`Settings data: ${JSON.stringify(t,null,2)}`);try{try{Q(`Ensuring directory exists: ${e}`),await DR.mkdir(e,{recursive:!0}),Q("Directory check completed")}catch(n){if(Q(`Directory creation error: ${JSON.stringify(n)}`),n instanceof Error&&"code"in n&&n.code==="EACCES")return{success:!1,error:wR(e,"write")};throw n}let r=ch(e,"settings.json");return Q(`Writing settings to file: ${r}`),await DR.writeFile(r,JSON.stringify(t,null,2)),Q("Settings successfully written"),{success:!0,data:t}}catch(r){return Q(`Settings save error: ${JSON.stringify(r)}`),{success:!1,error:r instanceof Error&&"code"in r&&r.code==="EACCES"?wR(e,"write"):`Failed to save settings: ${r instanceof Error?r.message:String(r)}`}}},Qht=async t=>{Q(`Loading settings from ${t}`);try{let e=ch(t,"settings.json");Q(`Reading settings file: ${e}`);try{let r=await DR.readFile(e,"utf-8");Q("Settings file content loaded");let n=JSON.parse(r);if(Q(`Settings parsed: ${JSON.stringify(n,null,2)}`),!Jht(n)){Q("Settings validation failed, fixing settings");let i={...kb(),...n};return i.analyticsConsent&&(i.askedConsent=!0),Q(`Fixed settings: ${JSON.stringify(i,null,2)}`),await qb(i,t),{success:!0,data:i}}return{success:!0,data:n}}catch(r){if(Q(`Settings read error: ${JSON.stringify(r)}`),r instanceof Error&&"code"in r){if(r.code==="ENOENT"){Q("Settings file not found, creating default settings");let n=kb();return Q(`Default settings: ${JSON.stringify(n,null,2)}`),await qb(n,t)}if(r.code==="EACCES")return{success:!1,error:wR(t,"read")}}throw r}}catch(e){return Q(`Settings load error: ${JSON.stringify(e)}`),{success:!1,error:`Failed to load settings: ${e instanceof Error?e.message:String(e)}`}}},Ho=async()=>{if(bR&&ds)return{success:!0,data:ds};try{let t=ER(),e=await Qht(t);return e.success&&e.data&&(ds=e.data),bR=!0,e}catch(t){return ds=kb(),bR=!0,{success:!0,data:ds,error:`Warning: Running in memory-only mode - ${t instanceof Error?t.message:String(t)}`}}},mle=async()=>(await Ho(),ds?.userId||kb().userId),Lb=async()=>{let t=await Ho();return!t.success||!t.data?(console.warn("[Config] Failed to load analytics settings:",t.error),!1):t.data.analyticsConsent},vle=async()=>(await Ho(),ds?.apiKey),gle=async t=>{let e=await Ho();return!e.success||!e.data?e:(ds={...e.data,analyticsConsent:t,askedConsent:!0},await qb(ds,ER()))},Mb=async t=>{let e=await Ho();return!e.success||!e.data?e:(ds={...e.data,apiKey:t},await qb(ds,ER()))},yle=async()=>(await Ho(),ds?.askedConsent||!1);var Rl=Zht(Xht);async function emt(){try{return await Rl("uvx --version"),!0}catch{return!1}}async function tmt(){let{shouldInstall:t}=await jb.default.prompt([{type:"confirm",name:"shouldInstall",message:"UV package manager is required for Python MCP servers. Would you like to install it?",default:!0}]);if(!t)return console.warn(ba.default.yellow("UV installation was declined. You can install it manually from https://astral.sh/uv")),!1;let e=Zi("Installing UV package manager...").start();try{if(process.platform==="win32")await Rl('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');else try{await Rl("curl -LsSf https://astral.sh/uv/install.sh | sh")}catch{await Rl("wget -qO- https://astral.sh/uv/install.sh | sh")}return e.succeed("\u2713 UV installed successfully"),!0}catch{return e.fail("Failed to install UV. You can install it manually from https://astral.sh/uv"),!1}}function rmt(t){return!!(t.type==="stdio"&&t.stdioFunction?.includes("uvx"))}async function nmt(){try{return await Rl("bun --version"),!0}catch{return!1}}async function imt(){let{shouldInstall:t}=await jb.default.prompt([{type:"confirm",name:"shouldInstall",message:"Bun is required for this operation. Would you like to install it?",default:!0}]);if(!t)return console.warn(ba.default.yellow("Bun installation was declined. You can install it manually from https://bun.sh")),!1;try{if(console.log("Installing Bun..."),process.platform==="win32")await Rl('powershell -c "irm bun.sh/install.ps1|iex"');else try{console.log("Attempting to install Bun via Homebrew..."),await Rl("brew install oven-sh/bun/bun")}catch{console.log("Homebrew installation failed, trying direct installation..."),await Rl("curl -fsSL https://bun.sh/install | bash")}return console.log(ba.default.green("Bun installed successfully!")),!0}catch(e){return console.error(ba.default.red("Failed to install Bun:"),e instanceof Error?e.message:String(e)),console.log("Please install Bun manually from https://bun.sh"),!1}}function amt(t){return!!(t.type==="stdio"&&t.stdioFunction?.includes("bunx"))}function lh(t={}){return{...WA(),...t}}async function xle(t){rmt(t)&&(Q("UV installation check required"),await emt()||await tmt()||console.warn(ba.default.yellow("UV is not installed. The server might fail to launch.")))}async function ble(t){amt(t)&&(Q("Bun installation check required"),await nmt()||await imt()||console.warn(ba.default.yellow("Bun is not installed. The server might fail to launch.")))}function _R(t){return t.connections.some(e=>e.type==="http"&&"deploymentUrl"in e)&&t.remote!==!1}function Dle(t){let e=_R(t);return e&&(Q("Remote server detected, showing security notice"),console.log(`${ba.default.yellow("*")} ${ba.default.dim("Installing remote server. Please ensure you trust the server author, especially when sharing sensitive data.")}`)),e}async function CR(){let{apiKey:t}=await jb.default.prompt([{type:"password",name:"apiKey",message:`Please enter your Smithery API key ${ba.default.cyan("(get one for free from")} ${ba.default.blue.underline("https://smithery.ai/account/api-keys")}${ba.default.cyan(")")}:`,mask:"*",validate:e=>e.trim()?!0:"API key is required"}]);return t}async function fs(t){if(t)return t;let e=await vle();if(e)return e;let r=await CR();return(await Mb(r)).success||console.warn(ba.default.yellow("Warning: Could not save API key to config. You may need to enter it again next time.")),r}async function wle(t={}){try{yf()&&W8();let e=await fs(t.key),r=Kv(".smithery"),n=Kv(r,"index.cjs"),i=t.port||8081 .toString(),a=t.tunnel!==!1,s,o,u=!0,c=!1,p,d=async()=>{let v=Date.now();if(s&&!s.killed&&(c=!0,s.kill("SIGTERM"),await new Promise(b=>setTimeout(b,100))),await new Promise(b=>{if(SR(n))return b();let D=setInterval(()=>{SR(n)&&(clearInterval(D),b())},50)}),u){let D=`node ${Kv(process.cwd(),n).replace(`${process.cwd()}/`,"")}`;console.log(ea.default.dim(`$ ${D}`))}s=smt("node",[Kv(process.cwd(),n)],{stdio:["inherit","pipe","pipe"],env:{...process.env,PORT:i,FORCE_COLOR:"1",LOG_LEVEL:process.env.LOG_LEVEL||"debug"}});let g=b=>{let D=b.toString();process.stdout.write(D)};s.stdout?.on("data",g),s.stderr?.on("data",b=>{let D=b.toString();process.stderr.write(D)}),s.on("error",b=>{console.error(ea.default.red("\u274C Process error:"),b),m()}),s.on("exit",b=>{if(c){c=!1;return}b!==0&&b!==null&&(console.log(ea.default.yellow(`\u26A0\uFE0F Process exited with code ${b}`)),m())}),u&&(console.log(ea.default.dim(`> Server starting on port ${ea.default.green(i)}`)),a?_o(i,e,t.open!==!1,t.initialMessage).then(({listener:b})=>{let D=Date.now()-v;o=b,u=!1}).catch(b=>{console.error(ea.default.red("\u274C Failed to start tunnel:"),b)}):u=!1)},h=await Y8({outFile:n,entryFile:t.entryFile,configFile:t.configFile,watch:!0,onRebuild:()=>{d()}});if(yf()){let v=Jp();if(v.length>0){await C2(v,{production:!1});let g=Kv(process.cwd(),"app/web/src");if(SR(g)){let b;p=omt(g,{recursive:!0},async(D,_)=>{!_||!_.endsWith(".tsx")||(b&&clearTimeout(b),b=setTimeout(async()=>{console.log(ea.default.dim(`
|
|
614
|
-
\u{1F4E6} Widget file changed: ${_}`));let C=Jp();await C2(C,{production:!1}),console.log(ea.default.green("\u2713 Widgets rebuilt"))},100))}),console.log(ea.default.dim("\u{1F440} Watching for widget changes..."))}}}let m=async()=>{if(console.log(ea.default.yellow(`
|
|
613
|
+
Running in memory-only mode (settings won't persist).`,qb=async(t,e)=>{Q(`Saving settings to ${e}`),Q(`Settings data: ${JSON.stringify(t,null,2)}`);try{try{Q(`Ensuring directory exists: ${e}`),await DR.mkdir(e,{recursive:!0}),Q("Directory check completed")}catch(n){if(Q(`Directory creation error: ${JSON.stringify(n)}`),n instanceof Error&&"code"in n&&n.code==="EACCES")return{success:!1,error:wR(e,"write")};throw n}let r=ch(e,"settings.json");return Q(`Writing settings to file: ${r}`),await DR.writeFile(r,JSON.stringify(t,null,2)),Q("Settings successfully written"),{success:!0,data:t}}catch(r){return Q(`Settings save error: ${JSON.stringify(r)}`),{success:!1,error:r instanceof Error&&"code"in r&&r.code==="EACCES"?wR(e,"write"):`Failed to save settings: ${r instanceof Error?r.message:String(r)}`}}},Qht=async t=>{Q(`Loading settings from ${t}`);try{let e=ch(t,"settings.json");Q(`Reading settings file: ${e}`);try{let r=await DR.readFile(e,"utf-8");Q("Settings file content loaded");let n=JSON.parse(r);if(Q(`Settings parsed: ${JSON.stringify(n,null,2)}`),!Jht(n)){Q("Settings validation failed, fixing settings");let i={...kb(),...n};return i.analyticsConsent&&(i.askedConsent=!0),Q(`Fixed settings: ${JSON.stringify(i,null,2)}`),await qb(i,t),{success:!0,data:i}}return{success:!0,data:n}}catch(r){if(Q(`Settings read error: ${JSON.stringify(r)}`),r instanceof Error&&"code"in r){if(r.code==="ENOENT"){Q("Settings file not found, creating default settings");let n=kb();return Q(`Default settings: ${JSON.stringify(n,null,2)}`),await qb(n,t)}if(r.code==="EACCES")return{success:!1,error:wR(t,"read")}}throw r}}catch(e){return Q(`Settings load error: ${JSON.stringify(e)}`),{success:!1,error:`Failed to load settings: ${e instanceof Error?e.message:String(e)}`}}},Ho=async()=>{if(bR&&ds)return{success:!0,data:ds};try{let t=ER(),e=await Qht(t);return e.success&&e.data&&(ds=e.data),bR=!0,e}catch(t){return ds=kb(),bR=!0,{success:!0,data:ds,error:`Warning: Running in memory-only mode - ${t instanceof Error?t.message:String(t)}`}}},mle=async()=>(await Ho(),ds?.userId||kb().userId),Lb=async()=>{let t=await Ho();return!t.success||!t.data?(console.warn("[Config] Failed to load analytics settings:",t.error),!1):t.data.analyticsConsent},vle=async()=>(await Ho(),ds?.apiKey),gle=async t=>{let e=await Ho();return!e.success||!e.data?e:(ds={...e.data,analyticsConsent:t,askedConsent:!0},await qb(ds,ER()))},Mb=async t=>{let e=await Ho();return!e.success||!e.data?e:(ds={...e.data,apiKey:t},await qb(ds,ER()))},yle=async()=>(await Ho(),ds?.askedConsent||!1);var Rl=Zht(Xht);async function emt(){try{return await Rl("uvx --version"),!0}catch{return!1}}async function tmt(){let{shouldInstall:t}=await jb.default.prompt([{type:"confirm",name:"shouldInstall",message:"UV package manager is required for Python MCP servers. Would you like to install it?",default:!0}]);if(!t)return console.warn(ba.default.yellow("UV installation was declined. You can install it manually from https://astral.sh/uv")),!1;let e=Zi("Installing UV package manager...").start();try{if(process.platform==="win32")await Rl('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');else try{await Rl("curl -LsSf https://astral.sh/uv/install.sh | sh")}catch{await Rl("wget -qO- https://astral.sh/uv/install.sh | sh")}return e.succeed("\u2713 UV installed successfully"),!0}catch{return e.fail("Failed to install UV. You can install it manually from https://astral.sh/uv"),!1}}function rmt(t){return!!(t.type==="stdio"&&t.stdioFunction?.includes("uvx"))}async function nmt(){try{return await Rl("bun --version"),!0}catch{return!1}}async function imt(){let{shouldInstall:t}=await jb.default.prompt([{type:"confirm",name:"shouldInstall",message:"Bun is required for this operation. Would you like to install it?",default:!0}]);if(!t)return console.warn(ba.default.yellow("Bun installation was declined. You can install it manually from https://bun.sh")),!1;try{if(console.log("Installing Bun..."),process.platform==="win32")await Rl('powershell -c "irm bun.sh/install.ps1|iex"');else try{console.log("Attempting to install Bun via Homebrew..."),await Rl("brew install oven-sh/bun/bun")}catch{console.log("Homebrew installation failed, trying direct installation..."),await Rl("curl -fsSL https://bun.sh/install | bash")}return console.log(ba.default.green("Bun installed successfully!")),!0}catch(e){return console.error(ba.default.red("Failed to install Bun:"),e instanceof Error?e.message:String(e)),console.log("Please install Bun manually from https://bun.sh"),!1}}function amt(t){return!!(t.type==="stdio"&&t.stdioFunction?.includes("bunx"))}function lh(t={}){return{...WA(),...t}}async function xle(t){rmt(t)&&(Q("UV installation check required"),await emt()||await tmt()||console.warn(ba.default.yellow("UV is not installed. The server might fail to launch.")))}async function ble(t){amt(t)&&(Q("Bun installation check required"),await nmt()||await imt()||console.warn(ba.default.yellow("Bun is not installed. The server might fail to launch.")))}function _R(t){return t.connections.some(e=>e.type==="http"&&"deploymentUrl"in e)&&t.remote!==!1}function Dle(t){let e=_R(t);return e&&(Q("Remote server detected, showing security notice"),console.log(`${ba.default.yellow("*")} ${ba.default.dim("Installing remote server. Please ensure you trust the server author, especially when sharing sensitive data.")}`)),e}async function CR(){let{apiKey:t}=await jb.default.prompt([{type:"password",name:"apiKey",message:`Please enter your Smithery API key ${ba.default.cyan("(get one for free from")} ${ba.default.blue.underline("https://smithery.ai/account/api-keys")}${ba.default.cyan(")")}:`,mask:"*",validate:e=>e.trim()?!0:"API key is required"}]);return t}async function fs(t){if(t)return t;let e=await vle();if(e)return e;let r=await CR();return(await Mb(r)).success||console.warn(ba.default.yellow("Warning: Could not save API key to config. You may need to enter it again next time.")),r}async function wle(t={}){try{yf()&&W8();let e=await fs(t.key),r=Kv(".smithery"),n=Kv(r,"index.cjs"),i=t.port||8081 .toString(),a=t.tunnel!==!1,s,o,u=!0,c=!1,p,d=async()=>{let v=Date.now();if(s&&!s.killed&&(c=!0,s.kill("SIGTERM"),await new Promise(b=>setTimeout(b,100))),await new Promise(b=>{if(SR(n))return b();let D=setInterval(()=>{SR(n)&&(clearInterval(D),b())},50)}),u){let D=`node ${Kv(process.cwd(),n).replace(`${process.cwd()}/`,"")}`;console.log(ea.default.dim(`$ ${D}`))}s=smt("node",[Kv(process.cwd(),n)],{stdio:["inherit","pipe","pipe"],env:{...process.env,PORT:i,FORCE_COLOR:"1",LOG_LEVEL:process.env.LOG_LEVEL||"debug"}});let g=b=>{let D=b.toString();process.stdout.write(D)};s.stdout?.on("data",g),s.stderr?.on("data",b=>{let D=b.toString();process.stderr.write(D)}),s.on("error",b=>{console.error(ea.default.red("\u274C Process error:"),b),m()}),s.on("exit",b=>{if(c){c=!1;return}b!==0&&b!==null&&(console.log(ea.default.yellow(`\u26A0\uFE0F Process exited with code ${b}`)),m())}),u&&(console.log(ea.default.dim(`> Server starting on port ${ea.default.green(i)}`)),a?_o(i,e,t.open!==!1,t.initialMessage).then(({listener:b})=>{let D=Date.now()-v;o=b,u=!1}).catch(b=>{console.error(ea.default.red("\u274C Failed to start tunnel:"),b)}):u=!1)},h=await Y8({outFile:n,entryFile:t.entryFile,configFile:t.configFile,watch:!0,minify:t.minify,onRebuild:()=>{d()}});if(yf()){let v=Jp();if(v.length>0){await C2(v,{production:!1,minify:t.minify});let g=Kv(process.cwd(),"app/web/src");if(SR(g)){let b;p=omt(g,{recursive:!0},async(D,_)=>{!_||!_.endsWith(".tsx")||(b&&clearTimeout(b),b=setTimeout(async()=>{console.log(ea.default.dim(`
|
|
614
|
+
\u{1F4E6} Widget file changed: ${_}`));let C=Jp();await C2(C,{production:!1,minify:t.minify}),console.log(ea.default.green("\u2713 Widgets rebuilt"))},100))}),console.log(ea.default.dim("\u{1F440} Watching for widget changes..."))}}}let m=async()=>{if(console.log(ea.default.yellow(`
|
|
615
615
|
o/ Shutting down server...`)),h&&"dispose"in h&&await h.dispose(),p&&p.close(),s&&await i3({childProcess:s,processName:"server"}),o)try{await o.close(),Us(ea.default.green("Tunnel closed"))}catch{Us(ea.default.yellow("Tunnel already closed"))}};s3({cleanupFn:m,processName:"server"})}catch(e){console.error(ea.default.red("\u274C Dev server failed:"),e),process.exit(1)}}$u();var umt=6e4,Ub=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(y3,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(b3,r=>{this._onprogress(r)}),this.setRequestHandler(x3,r=>({}))}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Qa(Xr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let a=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{a?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=u=>{s?.(u),this._onerror(u)};let o=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(u,c)=>{o?.(u,c),q2(u)||FY(u)?this._onresponse(u):g3(u)?this._onrequest(u,c):CY(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new Qa(Xr.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let a=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,s=this._transport;if(a===void 0){s?.send({jsonrpc:"2.0",id:e.id,error:{code:Xr.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let u={signal:o.signal,sessionId:s?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,p,d)=>this.request(c,p,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>a(e,u)).then(c=>{if(!o.signal.aborted)return s?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var p;if(!o.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Xr.InternalError,message:(p=c.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),o=this._timeoutInfo.get(i);if(o&&s&&o.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(u){s(u);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),q2(e))n(e);else{let i=new Qa(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:s}=n??{};return new Promise((o,u)=>{var c,p,d,h,m,v;if(!this._transport){u(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=n?.signal)===null||p===void 0||p.throwIfAborted();let g=this._requestMessageId++,b={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),b.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:g}});let D=F=>{var B;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(B=this._transport)===null||B===void 0||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(F)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:s}).catch(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`))),u(F)};this._responseHandlers.set(g,F=>{var B;if(!(!((B=n?.signal)===null||B===void 0)&&B.aborted)){if(F instanceof Error)return u(F);try{let R=r.parse(F.result);o(R)}catch(R){u(R)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var F;D((F=n?.signal)===null||F===void 0?void 0:F.reason)});let _=(m=n?.timeout)!==null&&m!==void 0?m:umt,C=()=>D(new Qa(Xr.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(g,_,n?.maxTotalTimeout,C,(v=n?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1),this._transport.send(b,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:s}).catch(F=>{this._cleanupTimeout(g),u(F)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var u;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(u=this._transport)===null||u===void 0||u.send(c,r).catch(p=>this._onerror(p))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>Promise.resolve(r(e.parse(i),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ele(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}$u();var C0e=ke(_0e(),1),s7=class extends Ub{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new C0e.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ele(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:kf,capabilities:this._capabilities,clientInfo:this._clientInfo}},BA,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!bY.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,a,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},y0,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},KA,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},y0,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},$A,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},LA,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},NA,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},kA,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},qA,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},y0,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},y0,r)}async callTool(e,r=E3,n){let i=await this.request({method:"tools/call",params:e},r,n),a=this.getToolOutputValidator(e.name);if(a){if(!i.structuredContent&&!i.isError)throw new Qa(Xr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!a(i.structuredContent))throw new Qa(Xr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(a.errors)}`)}catch(s){throw s instanceof Qa?s:new Qa(Xr.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},VA,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};$u();var sc=ke(qt(),1),HN=ke(xa(),1),e4t=ke(QR(),1);H0();va();var U2t=Object.prototype.hasOwnProperty;function dh(t,e){let r=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(i={}){return t.replace(r,function(a,s){if(!U2t.call(i,s))throw new Error(`Parameter '${s}' is required`);let o=i[s];if(typeof o!="string"&&typeof o!="number")throw new Error(`Parameter '${s}' must be a string or number`);return e?.charEncoding==="percent"?encodeURIComponent(`${o}`):`${o}`})}}var S0e=["https://registry.smithery.ai"];function A0e(t){let e=t.serverURL,r={};if(!e){let i=t.serverIdx??0;if(i<0||i>=S0e.length)throw new Error(`Invalid server index ${i}`);e=S0e[i]||""}let n=dh(e)(r);return new URL(n)}var F0e={language:"typescript",openapiDocVersion:"1.0.0",sdkVersion:"0.4.4",genVersion:"2.722.2",userAgent:"speakeasy-sdk/typescript 0.4.4 2.722.2 1.0.0 @smithery/registry"};var V2t=(t,e)=>e==null?fetch(t):fetch(t,e),Yv=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||V2t}async request(e){let r=e;for(let n of this.requestHooks){let i=await n(r);i&&(r=i)}try{let n=await this.fetcher(r);for(let i of this.responseHooks)await i(n,r);return n}catch(n){for(let i of this.requestErrorHooks)await i(n,r);throw n}}addHook(...e){if(e[0]==="beforeRequest")this.requestHooks.push(e[1]);else if(e[0]==="requestError")this.requestErrorHooks.push(e[1]);else if(e[0]==="response")this.responseHooks.push(e[1]);else throw new Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let r;if(e[0]==="beforeRequest")r=this.requestHooks;else if(e[0]==="requestError")r=this.requestErrorHooks;else if(e[0]==="response")r=this.responseHooks;else throw new Error(`Invalid hook type: ${e[0]}`);let n=r.findIndex(i=>i===e[1]);return n>=0&&r.splice(n,1),this}clone(){let e=new t(this.options);return e.requestHooks=this.requestHooks.slice(),e.requestErrorHooks=this.requestErrorHooks.slice(),e.responseHooks=this.responseHooks.slice(),e}},T0e=/\s*;\s*/g;function G0(t,e){if(e==="*")return!0;let r=t.headers.get("content-type")?.trim()||"application/octet-stream";r=r.toLowerCase();let n=e.toLowerCase().trim().split(T0e),[i="",...a]=n;if(i.split("/").length!==2)return!1;let s=r.split(T0e),[o="",...u]=s,[c="",p=""]=o.split("/");if(!c||!p||i!=="*/*"&&o!==i&&`${c}/*`!==i&&`*/${p}`!==i||u.length<a.length)return!1;let d=new Set(u);for(let h of a)if(!d.has(h))return!1;return!0}var z2t=new RegExp("^[0-9]xx$","i");function Jv(t,e){let r=`${t.status}`,n=Array.isArray(e)?e:[e];return n.length?n.some(i=>{let a=`${i}`;if(a==="default")return!0;if(!z2t.test(`${a}`))return a===r;let s=a.charAt(0);if(!s)throw new Error("Invalid status code range");let o=r.charAt(0);if(!o)throw new Error(`Invalid response status code: ${r}`);return o===s}):!1}function O0e(t,e,r){return Jv(t,e)&&G0(t,r)}function o7(t){if(typeof t!="object"||t==null)return!1;let e=t instanceof TypeError&&t.message.toLowerCase().startsWith("failed to fetch"),r=t instanceof TypeError&&t.message.toLowerCase().startsWith("fetch failed"),n="name"in t&&t.name==="ConnectionError",i="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnreset";return e||r||i||n}function u7(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="TimeoutError",r="code"in t&&t.code===23,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}function I0e(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="AbortError",r="code"in t&&t.code===20,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}var Qv=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let e=[];for(let r of e)"sdkInit"in r&&this.registerSDKInitHook(r),"beforeCreateRequest"in r&&this.registerBeforeCreateRequestHook(r),"beforeRequest"in r&&this.registerBeforeRequestHook(r),"afterSuccess"in r&&this.registerAfterSuccessHook(r),"afterError"in r&&this.registerAfterErrorHook(r)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((r,n)=>n.sdkInit(r),e)}beforeCreateRequest(e,r){let n=r;for(let i of this.beforeCreateRequestHooks)n=i.beforeCreateRequest(e,n);return n}async beforeRequest(e,r){let n=r;for(let i of this.beforeRequestHooks)n=await i.beforeRequest(e,n);return n}async afterSuccess(e,r){let n=r;for(let i of this.afterSuccessHooks)n=await i.afterSuccess(e,n);return n}async afterError(e,r,n){let i=r,a=n;for(let s of this.afterErrorHooks){let o=await s.afterError(e,i,a);i=o.response,a=o.error}return{response:i,error:a}}};var Y0=class extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=r?.cause)}},Xv=class extends Y0{constructor(){super(...arguments),this.name="UnexpectedClientError"}},c7=class extends Y0{constructor(){super(...arguments),this.name="InvalidRequestError"}},l7=class extends Y0{constructor(){super(...arguments),this.name="RequestAbortedError"}},p7=class extends Y0{constructor(){super(...arguments),this.name="RequestTimeoutError"}},d7=class extends Y0{constructor(){super(...arguments),this.name="ConnectionError"}};function J0(t){return{ok:!0,value:t}}function Zs(t){return{ok:!1,error:t}}async function P0e(t){let e=await t;if(!e.ok)throw e.error;return e.value}Qr();function f7(t){return btoa(String.fromCodePoint(...t))}function H2t(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function B0e(t){return new TextEncoder().encode(t)}function R0e(t){return f7(B0e(t))}var DKt=gi(Uint8Array).or(Z().transform(B0e)),wKt=gi(Uint8Array).or(Z().transform(H2t));function eo(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var h7=class extends Error{constructor(e){super(e),this.name="EncodingError"}};function XR(t){return(e,r,n)=>{let i="",a=n?.explode?q0e(e,r):[[e,r]];if(a.every(([c,p])=>p==null))return;let s=c=>n?.charEncoding==="percent"?encodeURIComponent(c):c,o=c=>s(eN(c)),u=s(t);return a.forEach(([c,p])=>{let d="",h=null;p!=null&&(Array.isArray(p)?h=tN(p,m=>`${o(m)}`)?.join(u):eo(p)?h=M0e(Object.entries(p),([m,v])=>`${s(m)}${u}${o(v)}`)?.join(u):h=`${o(p)}`,h!=null&&(d=`${s(c)}=${h}`,!(!d||d==="=")&&(i+=`&${d}`)))}),i.slice(1)}}var ZR=XR(","),K2t=XR(" "),W2t=XR("|");function G2t(t,e,r){if(e!=null){if(!eo(e))throw new h7(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return N0e(t,e,r)}}function N0e(t,e,r){if(e==null)return;let n="",i=a=>r?.charEncoding==="percent"?encodeURIComponent(a):a;if(!eo(e))throw new h7(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([a,s])=>{if(s==null)return;let o=`${t}[${a}]`;if(eo(s)){let p=N0e(o,s,r);n+=p==null?"":`&${p}`;return}let u=Array.isArray(s)?s:[s],c=tN(u,p=>`${i(o)}=${i(eN(p))}`)?.join("&");n+=c==null?"":`&${c}`}),n.slice(1)}function Y2t(t,e,r){if(typeof e>"u")return;let n=a=>r?.charEncoding==="percent"?encodeURIComponent(a):a,i=n(JSON.stringify(e,L0e));return r?.explode?i:`${n(t)}=${i}`}var k0e=(t,e,r)=>{let n="",i=r?.explode?q0e(t,e):[[t,e]];if(i.every(([o,u])=>u==null))return;let a=o=>r?.charEncoding==="percent"?encodeURIComponent(o):o,s=o=>a(eN(o));return i.forEach(([o,u])=>{let c="";u!=null&&(Array.isArray(u)?c=tN(u,p=>`${s(p)}`)?.join(","):eo(u)?c=M0e(Object.entries(u),([d,h])=>`,${a(d)},${s(h)}`)?.join("").slice(1):c=`${r?.explode&&eo(e)?`${o}=`:""}${s(u)}`,n+=c?`,${c}`:"")}),n.slice(1)};function q0e(t,e){return Array.isArray(e)?e.map(r=>[t,r]):eo(e)?Object.entries(e??{}).map(([n,i])=>[n,i]):[[t,e]]}function eN(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?f7(t):typeof t=="object"?JSON.stringify(t,L0e):`${t}`}function L0e(t,e){return e instanceof Uint8Array?f7(e):e}function tN(t,e){let r=t.reduce((n,i)=>{if(i==null)return n;let a=e(i);return a==null||n.push(a),n},[]);return r.length?r:null}function M0e(t,e){let r=[];for(let[n,i]of t){if(i==null)continue;let a=e([n,i]);a!=null&&r.push(a)}return r.length?r:null}function J2t(...t){return t.filter(Boolean).join("&")}function Zv(t){return function(r,n){let i={...n,explode:n?.explode??!0,charEncoding:n?.charEncoding??"percent"},a=Object.entries(r).map(([s,o])=>t(s,o,i));return J2t(...a)}}var AKt=Zv(Y2t),j0e=Zv(ZR),FKt=Zv(K2t),TKt=Zv(W2t),OKt=Zv(G2t);function e6(t,e,r,n,i){for(e=Array.isArray(e)?e:e.split("."),n=0;n<e.length;n++){let a=e[n];t=a!=null&&t?t[a]:i}return t===i?r:t}Qr();var Q2t=$e({SMITHERY_BEARER_AUTH:Z().optional(),SMITHERY_DEBUG:IA.boolean().optional()}),m7;function v7(){return m7||(m7=Q2t.parse(e6(globalThis,"process.env")??e6(globalThis,"Deno.env")??{}),m7)}var X2t={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},g7=class t extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,t.prototype)}},fh=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};async function U0e(t,e){switch(e.config.strategy){case"backoff":return rvt(Z2t(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??X2t);default:return await t()}}function Z2t(t,e){return async()=>{try{let r=await t();if(tvt(r,e.statusCodes))throw new fh("Response failed with retryable status code",r);return r}catch(r){throw r instanceof fh||e.retryConnectionErrors&&(u7(r)||o7(r))?r:new g7("Permanent error",{cause:r})}}}var evt=new RegExp("^[0-9]xx$","i");function tvt(t,e){let r=`${t.status}`;return e.some(n=>{if(!evt.test(n))return n===r;let i=n.charAt(0);if(!i)throw new Error("Invalid status code range");let a=r.charAt(0);if(!a)throw new Error(`Invalid response status code: ${r}`);return a===i})}async function rvt(t,e){let{maxElapsedTime:r,initialInterval:n,exponent:i,maxInterval:a}=e,s=Date.now(),o=0;for(;;)try{return await t()}catch(u){if(u instanceof g7)throw u.cause;if(Date.now()-s>r){if(u instanceof fh)return u.response;throw u}let p=0;u instanceof fh&&(p=nvt(u.response)),p<=0&&(p=n*Math.pow(o,i)+Math.random()*1e3);let d=Math.min(p,a);await ivt(d),o++}}function nvt(t){let e=t.headers.get("retry-after")||"";if(!e)return 0;let r=Number(e);if(Number.isInteger(r))return r*1e3;let n=Date.parse(e);if(Number.isInteger(n)){let i=n-Date.now();return i>0?Math.ceil(i):0}return 0}async function ivt(t){return new Promise(e=>setTimeout(e,t))}var t6=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},hs=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)},x7,Ko,tc,y7=typeof globalThis>"u"?null:globalThis,avt=typeof y7=="object"&&y7!=null&&"importScripts"in y7&&typeof y7.importScripts=="function",svt=avt||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",hh=class{constructor(e={}){x7.set(this,void 0),Ko.set(this,void 0),tc.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof Qv?t6(this,Ko,r.hooks,"f"):t6(this,Ko,new Qv,"f");let n=A0e(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:i,client:a}=hs(this,Ko,"f").sdkInit({baseURL:n,client:e.httpClient||new Yv});this._baseURL=i,t6(this,x7,a,"f"),this._options={...e,hooks:hs(this,Ko,"f")},t6(this,tc,this._options.debugLogger,"f"),!hs(this,tc,"f")&&v7().SMITHERY_DEBUG&&t6(this,tc,console,"f")}_createRequest(e,r,n){let{method:i,path:a,query:s,headers:o,security:u}=r,c=r.baseURL??this._baseURL;if(!c)return Zs(new c7("No base URL provided for operation"));let p=new URL(c),d=new URL(a,p);a&&(p.pathname+=p.pathname.endsWith("/")?"":"/",p.pathname+=d.pathname.replace(/^\/+/,""));let h=s||"",m=[];for(let[R,H]of Object.entries(u?.queryParams||{})){let L=ZR(R,H,{charEncoding:"percent"});typeof L<"u"&&m.push(L)}if(m.length&&(h+=`&${m.join("&")}`),h){let R=h.startsWith("&")?h.slice(1):h;p.search=`?${R}`}let v=new Headers(o),g=u?.basic.username,b=u?.basic.password;if(g!=null||b!=null){let R=R0e([g||"",b||""].join(":"));v.set("Authorization",`Basic ${R}`)}let D=new Headers(u?.headers||{});for(let[R,H]of D)v.set(R,H);let _=v.get("cookie")||"";for(let[R,H]of Object.entries(u?.cookies||{}))_+=`; ${R}=${H}`;_=_.startsWith("; ")?_.slice(2):_,v.set("cookie",_);let C=new Headers(n?.headers??n?.fetchOptions?.headers);for(let[R,H]of C)v.set(R,H);svt||v.set(r.uaHeader??"user-agent",r.userAgent??F0e.userAgent);let F={...n?.fetchOptions,...n};if(!F?.signal&&r.timeoutMs&&r.timeoutMs>0){let R=AbortSignal.timeout(r.timeoutMs);F.signal=R}r.body instanceof ReadableStream&&Object.assign(F,{duplex:"half"});let B;try{B=hs(this,Ko,"f").beforeCreateRequest(e,{url:p,options:{...F,body:r.body??null,headers:v,method:i}})}catch(R){return Zs(new Xv("Create request hook failed to execute",{cause:R}))}return J0(new Request(B.url,B.options))}async _do(e,r){let{context:n,errorCodes:i}=r;return U0e(async()=>{let a=await hs(this,Ko,"f").beforeRequest(n,e.clone());await ovt(hs(this,tc,"f"),a).catch(o=>hs(this,tc,"f")?.log("Failed to log request:",o));let s=await hs(this,x7,"f").request(a);try{if(Jv(s,i)){let o=await hs(this,Ko,"f").afterError(n,s,null);if(o.error)throw o.error;s=o.response||s}else s=await hs(this,Ko,"f").afterSuccess(n,s)}finally{await uvt(hs(this,tc,"f"),s,a).catch(o=>hs(this,tc,"f")?.log("Failed to log response:",o))}return s},{config:r.retryConfig,statusCodes:r.retryCodes}).then(a=>J0(a),a=>{switch(!0){case I0e(a):return Zs(new l7("Request aborted by client",{cause:a}));case u7(a):return Zs(new p7("Request timed out",{cause:a}));case o7(a):return Zs(new d7("Unable to make request",{cause:a}));default:return Zs(new Xv("Unexpected HTTP client error",{cause:a}))}})}};x7=new WeakMap,Ko=new WeakMap,tc=new WeakMap;var V0e=/(application|text)\/.*?\+*json.*/,$0e=/(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;async function ovt(t,e){if(!t)return;let r=e.headers.get("content-type"),n=r?.split(";")[0]||"";t.group(`> Request: ${e.method} ${e.url}`),t.group("Headers:");for(let[i,a]of e.headers.entries())t.log(`${i}: ${a}`);switch(t.groupEnd(),t.group("Body:"),!0){case V0e.test(n):t.log(await e.clone().json());break;case n.startsWith("text/"):t.log(await e.clone().text());break;case n==="multipart/form-data":{let i=await e.clone().formData();for(let[a,s]of i){let o=s instanceof Blob?"<Blob>":s;t.log(`${a}: ${o}`)}break}default:t.log(`<${r}>`);break}t.groupEnd(),t.groupEnd()}async function uvt(t,e,r){if(!t)return;let n=e.headers.get("content-type"),i=n?.split(";")[0]||"";t.group(`< Response: ${r.method} ${r.url}`),t.log("Status Code:",e.status,e.statusText),t.group("Headers:");for(let[a,s]of e.headers.entries())t.log(`${a}: ${s}`);switch(t.groupEnd(),t.group("Body:"),!0){case(G0(e,"application/json")||V0e.test(i)&&!$0e.test(i)):t.log(await e.clone().json());break;case(G0(e,"application/jsonl")||$0e.test(i)):t.log(await e.clone().text());break;case G0(e,"text/event-stream"):t.log(`<${n}>`);break;case G0(e,"text/*"):t.log(await e.clone().text());break;case G0(e,"multipart/form-data"):{let a=await e.clone().formData();for(let[s,o]of a){let u=o instanceof Blob?"<Blob>":o;t.log(`${s}: ${u}`)}break}default:t.log(`<${n}>`);break}t.groupEnd(),t.groupEnd()}var ms=class extends Error{constructor(e,r){super(e),this.statusCode=r.response.status,this.body=r.body,this.headers=r.response.headers,this.contentType=r.response.headers.get("content-type")||"",this.rawResponse=r.response,this.name="SmitheryRegistryError"}};var r6=class extends ms{constructor(e,r){e&&(e+=": "),e+=`Status ${r.response.status}`;let n=r.response.headers.get("content-type")||'""';n!=="application/json"&&(e+=` Content-Type ${n.includes(" ")?`"${n}"`:n}`);let i=r.body||'""';e+=i.length>100?`
|
|
616
616
|
`:". ";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"}};Qr();Qr();var mh=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 Tn?`${this.rawMessage}
|
|
617
617
|
${b7(this.cause)}`:this.toString()}};function b7(t,e=0){let r=" ".repeat(e);r=e>0?`\u2502${r}`:r,r+=" ".repeat(e);let n="",i=o=>n+=`
|
|
@@ -638,7 +638,7 @@ ${F4.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")}
|
|
|
638
638
|
${U4.default.rgb(234,88,12)("Thanks for using Smithery Uplink!")}
|
|
639
639
|
${U4.default.blue("\u2B06 One-click cloud deploy: https://smithery.ai/new")}
|
|
640
640
|
|
|
641
|
-
`)};return process.on("SIGINT",m),process.on("SIGTERM",m),process.on("beforeExit",m),process.on("exit",()=>{J("[Uplink Runner] Final cleanup on exit")}),process.stdin.on("end",()=>{J("[Uplink Runner] STDIN closed (client disconnected)"),m().catch(C=>{J(`[Uplink Runner] Error during stdin close cleanup: ${C}`),process.exit(1)})}),process.stdin.on("error",C=>{J(`[Uplink Runner] STDIN error: ${C.message}`),m().catch(F=>{J(`[Uplink Runner] Error during stdin error cleanup: ${F}`),process.exit(1)})}),process.stdin.on("data",C=>b(C).catch(F=>h(F,"[Uplink Runner] Error processing message"))),await D(),_};async function u9e(t,e,r,n,i){try{let a=await Ho();a.success||J(`[Runner] Settings initialization warning: ${a.error}`);let s=await Ah(t,r,"run");if(!s)throw new Error(`Could not resolve server: ${t}`);J(`[Runner] Connecting to server: ${JSON.stringify({id:s.qualifiedName,connectionTypes:s.connections.map(u=>u.type)})}`);let o=await Lb();await vTt(s,e,o,r,n,i)}catch(a){J(`[Runner] Error: ${a instanceof Error?a.message:a}`),process.exit(1)}}async function vTt(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 o9e(s.deploymentUrl,n,e,i,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"}):await a9e(s.deploymentUrl,n,e,i)}else if(s.type==="stdio"){let o=await y6e(t,s,e,n,i);if(a?.playground){if(!n)throw new Error("API key is required for playground connections");await Uxe(o.command,o.args,o.env,o.qualifiedName,n,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"})}else await zxe(o.command,o.args,o.env,o.qualifiedName,n,r)}else throw new Error(`Unsupported connection type: ${s.type}`)}var xm=ke(qt(),1);zl();A6();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function c9e(t,e){try{if(xs(e).installType==="command"){console.log(xm.default.yellow(`Uninstallation is currently not supported for ${e}`));return}let n=sd(e);if(!n.mcpServers[t]){console.log(xm.default.red(`${t} is not installed for ${e}`));return}delete n.mcpServers[t],S6(n,e),console.log(xm.default.green(`\u2713 ${t} successfully uninstalled from ${e}`)),await V7(e)}catch(r){r instanceof Error?console.error(xm.default.red(`Error: ${r.message}`)):console.error(xm.default.red("An unexpected error occurred during uninstallation")),process.exit(1)}}zl();va();var dn=ke(qt(),1);zl();async function mE(t,e="Working with"){if(t)return t;console.log(dn.default.cyan("*"),`${e} MCP server`),console.log();let r=(await Promise.resolve().then(()=>ke(xa(),1))).default,n=(await Promise.resolve().then(()=>ke($4(),1))).default;r.registerPrompt("autocomplete",n);let{client:i}=await r.prompt([{type:"autocomplete",name:"client",message:"Select client:",source:(a,s)=>{let o=Yo.filter(u=>u.toLowerCase().includes((s||"").toLowerCase()));return Promise.resolve(o)}}]);return i}function vE(t){Yo.includes(t)||(console.error(dn.default.yellow(`Invalid client "${t}". Valid options are: ${Yo.join(", ")}`)),process.exit(1))}function nU(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(dn.default.red(`Error parsing config: ${r}`)),process.exit(1)}}async function TTt(){let t=(await Promise.resolve().then(()=>ke(xa(),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 OTt(t){let e=(await Promise.resolve().then(()=>ke(xa(),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 fs(t),i=(await Promise.resolve().then(()=>(H0(),Bb))).default,a=i(`Searching for "${r}"...`).start(),s=await UN(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(()=>ke($4(),1))).default;e.registerPrompt("autocomplete",o);let{serverChoice:u}=await e.prompt([{type:"autocomplete",name:"serverChoice",message:"Select server to install:",source:(c,p)=>{let d=s.filter(h=>h.qualifiedName.toLowerCase().includes((p||"").toLowerCase())||h.displayName?.toLowerCase().includes((p||"").toLowerCase())||h.description?.toLowerCase().includes((p||"").toLowerCase())).map(h=>{let m=h.displayName||h.qualifiedName,v=`${h.useCount.toLocaleString()} tool calls`,g=h.qualifiedName!==m?` \u2022 ${h.qualifiedName}`:"";return{name:`${m} \u2022 ${v}${g}`,value:h.qualifiedName}});return Promise.resolve(d)}}]);return u}catch(n){let i=(await Promise.resolve().then(()=>(H0(),Bb))).default;i().start().fail("Failed to search servers"),console.error(dn.default.red(n instanceof Error?n.message:String(n))),process.exit(1)}}async function ITt(){let t=(await Promise.resolve().then(()=>ke(xa(),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 v9e(t,e,r){if(t)return t;if(console.log(dn.default.cyan("*"),"Installing MCP server for",dn.default.cyan(e)),console.log(),await TTt()==="search")return await OTt(r);{let i=await ITt();return console.log(),i}}async function g9e(t,e,r){if(t)return t;console.log(dn.default.cyan("*"),"Uninstalling server from",dn.default.cyan(e)),console.log(),r.length===0&&(console.log(dn.default.yellow(`No servers installed for ${e}`)),process.exit(0));let n=(await Promise.resolve().then(()=>ke(xa(),1))).default,i=(await Promise.resolve().then(()=>ke($4(),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 u=r.filter(c=>c.toLowerCase().includes((o||"").toLowerCase()));return Promise.resolve(u)}}]);return a}async function rU(t){if(t)return t;let r=await(await Promise.resolve().then(()=>ke(xa(),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 y9e(t,e){let r=await rU(e);try{for(;;){let n=(await Promise.resolve().then(()=>(H0(),Bb))).default,i=n(`Searching for "${r}"...`).start(),a=await UN(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(dn.default.dim(`${dn.default.cyan("\u2192 View more")} at smithery.ai/search?q=${r.replace(/\s+/g,"+")}`)),console.log();let s=(await Promise.resolve().then(()=>ke(xa(),1))).default,o=(await Promise.resolve().then(()=>ke($4(),1))).default;s.registerPrompt("autocomplete",o);let{selectedServer:u}=await s.prompt([{type:"autocomplete",name:"selectedServer",message:"Select server for details (or search again):",source:(p,d)=>{let h=[{name:dn.default.dim("\u2190 Search again"),value:"__SEARCH_AGAIN__"},{name:dn.default.dim("Exit"),value:"__EXIT__"}],m=a.filter(v=>v.qualifiedName.toLowerCase().includes((d||"").toLowerCase())||v.displayName?.toLowerCase().includes((d||"").toLowerCase())).map(v=>{let g=v.displayName||v.qualifiedName,b=v.useCount>0?dn.default.dim(` (${v.useCount.toLocaleString()} calls/month)`):"";return{name:`${g}${b}`,value:v.qualifiedName}});return Promise.resolve([...h,...m])}}]);if(u==="__EXIT__")return;if(u==="__SEARCH_AGAIN__"){r=await rU();continue}console.log();let c=a.find(p=>p.qualifiedName===u);if(c){let p=c.displayName||c.qualifiedName;console.log(`${dn.default.bold.cyan(p)}`),console.log(`${dn.default.dim("Qualified name:")} ${c.qualifiedName}`),c.description&&console.log(`${dn.default.dim("Description:")} ${c.description}`),console.log(`${dn.default.dim("Usage:")} ${c.useCount.toLocaleString()} calls/month`),console.log(),console.log(dn.default.dim(`Use 'smithery install ${c.qualifiedName}' to install`));let{action:d}=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(d==="back")console.log();else if(d==="search")r=await rU();else return}}}catch(n){console.error(dn.default.red("Error searching servers:"),n instanceof Error?n.message:String(n)),process.exit(1)}}var Ia=new oz;Ia.name("smithery").version("1.6.1").description(`${Mi.default.bold.italic.hex("#ea580c")("SMITHERY CLI")} ${Mi.default.bold.italic.hex("#ea580c")("v1.6.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&&gG(!0),r.debug&&yG(!0)});Ia.command("install [server]").description("install a server").option("-c, --client <name>",`Specify the AI client (${Yo.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 mE(e.client,"Install"),n=await v9e(t,r,e.key);vE(r);let i=e.config?nU(e.config):{};await Zfe(n,r,i,e.key,e.profile)});Ia.command("uninstall [server]").description("uninstall a server").option("-c, --client <name>",`Specify the AI client (${Yo.join(", ")})`).action(async(t,e)=>{let{readConfig:r}=await Promise.resolve().then(()=>(A6(),Xfe)),n=await mE(e.client,"Uninstall");vE(n);let i=r(n),a=Object.keys(i.mcpServers),s=await g9e(t,n,a);await c9e(s,n)});Ia.command("inspect <server>").description("Inspect server from registry").option("--key <apikey>","Provide an API key").action(async(t,e)=>{await jfe(t,await fs(e.key))});Ia.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?nU(e.config):{};await u9e(t,r,await fs(e.key),e.profile,{playground:e.playground,open:e.open,initialMessage:e.prompt})});Ia.command("dev [entryFile]").description("Start development server with hot-reload and tunnel").option("--port <port>",`Port to run the server on (default: ${8081})`).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 wle({entryFile:t,port:e.port,key:e.key,tunnel:e.tunnel,open:e.open,initialMessage:e.prompt,configFile:e.config})});Ia.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(Mi.default.red(`Invalid transport type "${r}". Valid options are: shttp, stdio`)),process.exit(1)),await tW({entryFile:t,outFile:e.out,transport:r,configFile:e.config,bundleAll:e.bundleAll})});Ia.command("playground").description("open MCP playground in browser").option("--port <port>",`Port to expose (default: ${8081})`).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 r1e({port:t.port,command:e,apiKey:await fs(t.key)})});Ia.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(Mi.default.red("\u274C Command is required.")),console.error(Mi.default.yellow("Usage: smithery playground-stdio -- <command>")),console.error(Mi.default.gray("Example: smithery playground-stdio -- python my_mcp_server.py")),process.exit(1));let{createArbitraryCommandRunner:i}=await Promise.resolve().then(()=>(D9e(),b9e)),a=await i(e,await fs(t.key),{port:t.port?Number.parseInt(t.port,10):6969,open:t.open!==!1,initialMessage:t.prompt});process.stdin.resume(),await new Promise(()=>{})});Ia.command("list").description("list installed servers").option("-c, --client <name>",`Specify the client (${Yo.join(", ")})`).action(async t=>{let e=await mE(t.client,"List");vE(e),await e1e("servers",e)});Ia.command("search [term]").description("Search for servers in the Smithery registry").action(async t=>{let e=await fs();await y9e(e,t)});Ia.command("login").description("Login with an API key").action(async()=>{console.log(Mi.default.cyan("Login to Smithery")),console.log(Mi.default.gray("Get your API key from: https://smithery.ai/account/api-keys")),console.log();try{let t=await CR();await Bfe(t),(await Mb(t)).success?(console.log(Mi.default.green("\u2713 API key saved successfully")),console.log(Mi.default.gray("You can now use Smithery CLI commands"))):(console.error(Mi.default.red("\u2717 Failed to save API key")),console.error(Mi.default.gray("You may need to enter it again next time")))}catch(t){console.error(Mi.default.red("\u2717 Login failed"));let e=t instanceof Error?t.message:String(t);console.error(Mi.default.gray(e)),process.exit(1)}});Ia.parse(process.argv);
|
|
641
|
+
`)};return process.on("SIGINT",m),process.on("SIGTERM",m),process.on("beforeExit",m),process.on("exit",()=>{J("[Uplink Runner] Final cleanup on exit")}),process.stdin.on("end",()=>{J("[Uplink Runner] STDIN closed (client disconnected)"),m().catch(C=>{J(`[Uplink Runner] Error during stdin close cleanup: ${C}`),process.exit(1)})}),process.stdin.on("error",C=>{J(`[Uplink Runner] STDIN error: ${C.message}`),m().catch(F=>{J(`[Uplink Runner] Error during stdin error cleanup: ${F}`),process.exit(1)})}),process.stdin.on("data",C=>b(C).catch(F=>h(F,"[Uplink Runner] Error processing message"))),await D(),_};async function u9e(t,e,r,n,i){try{let a=await Ho();a.success||J(`[Runner] Settings initialization warning: ${a.error}`);let s=await Ah(t,r,"run");if(!s)throw new Error(`Could not resolve server: ${t}`);J(`[Runner] Connecting to server: ${JSON.stringify({id:s.qualifiedName,connectionTypes:s.connections.map(u=>u.type)})}`);let o=await Lb();await vTt(s,e,o,r,n,i)}catch(a){J(`[Runner] Error: ${a instanceof Error?a.message:a}`),process.exit(1)}}async function vTt(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 o9e(s.deploymentUrl,n,e,i,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"}):await a9e(s.deploymentUrl,n,e,i)}else if(s.type==="stdio"){let o=await y6e(t,s,e,n,i);if(a?.playground){if(!n)throw new Error("API key is required for playground connections");await Uxe(o.command,o.args,o.env,o.qualifiedName,n,{open:a.open!==!1,initialMessage:a.initialMessage||"Say hello to the world!"})}else await zxe(o.command,o.args,o.env,o.qualifiedName,n,r)}else throw new Error(`Unsupported connection type: ${s.type}`)}var xm=ke(qt(),1);zl();A6();process.removeAllListeners("warning");process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("punycode")||console.warn(t)});async function c9e(t,e){try{if(xs(e).installType==="command"){console.log(xm.default.yellow(`Uninstallation is currently not supported for ${e}`));return}let n=sd(e);if(!n.mcpServers[t]){console.log(xm.default.red(`${t} is not installed for ${e}`));return}delete n.mcpServers[t],S6(n,e),console.log(xm.default.green(`\u2713 ${t} successfully uninstalled from ${e}`)),await V7(e)}catch(r){r instanceof Error?console.error(xm.default.red(`Error: ${r.message}`)):console.error(xm.default.red("An unexpected error occurred during uninstallation")),process.exit(1)}}zl();va();var dn=ke(qt(),1);zl();async function mE(t,e="Working with"){if(t)return t;console.log(dn.default.cyan("*"),`${e} MCP server`),console.log();let r=(await Promise.resolve().then(()=>ke(xa(),1))).default,n=(await Promise.resolve().then(()=>ke($4(),1))).default;r.registerPrompt("autocomplete",n);let{client:i}=await r.prompt([{type:"autocomplete",name:"client",message:"Select client:",source:(a,s)=>{let o=Yo.filter(u=>u.toLowerCase().includes((s||"").toLowerCase()));return Promise.resolve(o)}}]);return i}function vE(t){Yo.includes(t)||(console.error(dn.default.yellow(`Invalid client "${t}". Valid options are: ${Yo.join(", ")}`)),process.exit(1))}function nU(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(dn.default.red(`Error parsing config: ${r}`)),process.exit(1)}}async function TTt(){let t=(await Promise.resolve().then(()=>ke(xa(),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 OTt(t){let e=(await Promise.resolve().then(()=>ke(xa(),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 fs(t),i=(await Promise.resolve().then(()=>(H0(),Bb))).default,a=i(`Searching for "${r}"...`).start(),s=await UN(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(()=>ke($4(),1))).default;e.registerPrompt("autocomplete",o);let{serverChoice:u}=await e.prompt([{type:"autocomplete",name:"serverChoice",message:"Select server to install:",source:(c,p)=>{let d=s.filter(h=>h.qualifiedName.toLowerCase().includes((p||"").toLowerCase())||h.displayName?.toLowerCase().includes((p||"").toLowerCase())||h.description?.toLowerCase().includes((p||"").toLowerCase())).map(h=>{let m=h.displayName||h.qualifiedName,v=`${h.useCount.toLocaleString()} tool calls`,g=h.qualifiedName!==m?` \u2022 ${h.qualifiedName}`:"";return{name:`${m} \u2022 ${v}${g}`,value:h.qualifiedName}});return Promise.resolve(d)}}]);return u}catch(n){let i=(await Promise.resolve().then(()=>(H0(),Bb))).default;i().start().fail("Failed to search servers"),console.error(dn.default.red(n instanceof Error?n.message:String(n))),process.exit(1)}}async function ITt(){let t=(await Promise.resolve().then(()=>ke(xa(),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 v9e(t,e,r){if(t)return t;if(console.log(dn.default.cyan("*"),"Installing MCP server for",dn.default.cyan(e)),console.log(),await TTt()==="search")return await OTt(r);{let i=await ITt();return console.log(),i}}async function g9e(t,e,r){if(t)return t;console.log(dn.default.cyan("*"),"Uninstalling server from",dn.default.cyan(e)),console.log(),r.length===0&&(console.log(dn.default.yellow(`No servers installed for ${e}`)),process.exit(0));let n=(await Promise.resolve().then(()=>ke(xa(),1))).default,i=(await Promise.resolve().then(()=>ke($4(),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 u=r.filter(c=>c.toLowerCase().includes((o||"").toLowerCase()));return Promise.resolve(u)}}]);return a}async function rU(t){if(t)return t;let r=await(await Promise.resolve().then(()=>ke(xa(),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 y9e(t,e){let r=await rU(e);try{for(;;){let n=(await Promise.resolve().then(()=>(H0(),Bb))).default,i=n(`Searching for "${r}"...`).start(),a=await UN(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(dn.default.dim(`${dn.default.cyan("\u2192 View more")} at smithery.ai/search?q=${r.replace(/\s+/g,"+")}`)),console.log();let s=(await Promise.resolve().then(()=>ke(xa(),1))).default,o=(await Promise.resolve().then(()=>ke($4(),1))).default;s.registerPrompt("autocomplete",o);let{selectedServer:u}=await s.prompt([{type:"autocomplete",name:"selectedServer",message:"Select server for details (or search again):",source:(p,d)=>{let h=[{name:dn.default.dim("\u2190 Search again"),value:"__SEARCH_AGAIN__"},{name:dn.default.dim("Exit"),value:"__EXIT__"}],m=a.filter(v=>v.qualifiedName.toLowerCase().includes((d||"").toLowerCase())||v.displayName?.toLowerCase().includes((d||"").toLowerCase())).map(v=>{let g=v.displayName||v.qualifiedName,b=v.useCount>0?dn.default.dim(` (${v.useCount.toLocaleString()} calls/month)`):"";return{name:`${g}${b}`,value:v.qualifiedName}});return Promise.resolve([...h,...m])}}]);if(u==="__EXIT__")return;if(u==="__SEARCH_AGAIN__"){r=await rU();continue}console.log();let c=a.find(p=>p.qualifiedName===u);if(c){let p=c.displayName||c.qualifiedName;console.log(`${dn.default.bold.cyan(p)}`),console.log(`${dn.default.dim("Qualified name:")} ${c.qualifiedName}`),c.description&&console.log(`${dn.default.dim("Description:")} ${c.description}`),console.log(`${dn.default.dim("Usage:")} ${c.useCount.toLocaleString()} calls/month`),console.log(),console.log(dn.default.dim(`Use 'smithery install ${c.qualifiedName}' to install`));let{action:d}=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(d==="back")console.log();else if(d==="search")r=await rU();else return}}}catch(n){console.error(dn.default.red("Error searching servers:"),n instanceof Error?n.message:String(n)),process.exit(1)}}var Ia=new oz;Ia.name("smithery").version("1.6.3").description(`${Mi.default.bold.italic.hex("#ea580c")("SMITHERY CLI")} ${Mi.default.bold.italic.hex("#ea580c")("v1.6.3")} - 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&&gG(!0),r.debug&&yG(!0)});Ia.command("install [server]").description("install a server").option("-c, --client <name>",`Specify the AI client (${Yo.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 mE(e.client,"Install"),n=await v9e(t,r,e.key);vE(r);let i=e.config?nU(e.config):{};await Zfe(n,r,i,e.key,e.profile)});Ia.command("uninstall [server]").description("uninstall a server").option("-c, --client <name>",`Specify the AI client (${Yo.join(", ")})`).action(async(t,e)=>{let{readConfig:r}=await Promise.resolve().then(()=>(A6(),Xfe)),n=await mE(e.client,"Uninstall");vE(n);let i=r(n),a=Object.keys(i.mcpServers),s=await g9e(t,n,a);await c9e(s,n)});Ia.command("inspect <server>").description("Inspect server from registry").option("--key <apikey>","Provide an API key").action(async(t,e)=>{await jfe(t,await fs(e.key))});Ia.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?nU(e.config):{};await u9e(t,r,await fs(e.key),e.profile,{playground:e.playground,open:e.open,initialMessage:e.prompt})});Ia.command("dev [entryFile]").description("Start development server with hot-reload and tunnel").option("--port <port>",`Port to run the server on (default: ${8081})`).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)").option("--no-minify","Build widgets without minification for easier debugging").action(async(t,e)=>{await wle({entryFile:t,port:e.port,key:e.key,tunnel:e.tunnel,open:e.open,initialMessage:e.prompt,configFile:e.config,minify:e.minify})});Ia.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(Mi.default.red(`Invalid transport type "${r}". Valid options are: shttp, stdio`)),process.exit(1)),await tW({entryFile:t,outFile:e.out,transport:r,configFile:e.config,bundleAll:e.bundleAll})});Ia.command("playground").description("open MCP playground in browser").option("--port <port>",`Port to expose (default: ${8081})`).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 r1e({port:t.port,command:e,apiKey:await fs(t.key)})});Ia.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(Mi.default.red("\u274C Command is required.")),console.error(Mi.default.yellow("Usage: smithery playground-stdio -- <command>")),console.error(Mi.default.gray("Example: smithery playground-stdio -- python my_mcp_server.py")),process.exit(1));let{createArbitraryCommandRunner:i}=await Promise.resolve().then(()=>(D9e(),b9e)),a=await i(e,await fs(t.key),{port:t.port?Number.parseInt(t.port,10):6969,open:t.open!==!1,initialMessage:t.prompt});process.stdin.resume(),await new Promise(()=>{})});Ia.command("list").description("list installed servers").option("-c, --client <name>",`Specify the client (${Yo.join(", ")})`).action(async t=>{let e=await mE(t.client,"List");vE(e),await e1e("servers",e)});Ia.command("search [term]").description("Search for servers in the Smithery registry").action(async t=>{let e=await fs();await y9e(e,t)});Ia.command("login").description("Login with an API key").action(async()=>{console.log(Mi.default.cyan("Login to Smithery")),console.log(Mi.default.gray("Get your API key from: https://smithery.ai/account/api-keys")),console.log();try{let t=await CR();await Bfe(t),(await Mb(t)).success?(console.log(Mi.default.green("\u2713 API key saved successfully")),console.log(Mi.default.gray("You can now use Smithery CLI commands"))):(console.error(Mi.default.red("\u2717 Failed to save API key")),console.error(Mi.default.gray("You may need to enter it again next time")))}catch(t){console.error(Mi.default.red("\u2717 Login failed"));let e=t instanceof Error?t.message:String(t);console.error(Mi.default.gray(e)),process.exit(1)}});Ia.parse(process.argv);
|
|
642
642
|
/*! Bundled license information:
|
|
643
643
|
|
|
644
644
|
safe-buffer/index.js:
|