awal 1.0.0 → 1.3.0
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/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -6
- package/dist/cli.js.map +1 -1
- package/dist/commands/address.d.ts.map +1 -1
- package/dist/commands/address.js +1 -1
- package/dist/commands/address.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +1 -3
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/balance.d.ts.map +1 -1
- package/dist/commands/balance.js +1 -16
- package/dist/commands/balance.js.map +1 -1
- package/dist/commands/bazaar.d.ts.map +1 -1
- package/dist/commands/bazaar.js +40 -28
- package/dist/commands/bazaar.js.map +1 -1
- package/dist/commands/details.d.ts +3 -0
- package/dist/commands/details.d.ts.map +1 -0
- package/dist/commands/details.js +129 -0
- package/dist/commands/details.js.map +1 -0
- package/dist/commands/discover.d.ts.map +1 -1
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/pay.d.ts.map +1 -1
- package/dist/commands/pay.js +20 -3
- package/dist/commands/pay.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +12 -53
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/trade.d.ts.map +1 -1
- package/dist/commands/trade.js +2 -7
- package/dist/commands/trade.js.map +1 -1
- package/dist/commands/x402.d.ts +3 -0
- package/dist/commands/x402.d.ts.map +1 -0
- package/dist/commands/x402.js +12 -0
- package/dist/commands/x402.js.map +1 -0
- package/dist/formatters/output.d.ts +5 -0
- package/dist/formatters/output.d.ts.map +1 -1
- package/dist/formatters/output.js +18 -0
- package/dist/formatters/output.js.map +1 -1
- package/dist/ipcClient.d.ts.map +1 -1
- package/dist/ipcClient.js +9 -2
- package/dist/ipcClient.js.map +1 -1
- package/dist/utils/addressValidation.d.ts +22 -0
- package/dist/utils/addressValidation.d.ts.map +1 -0
- package/dist/utils/addressValidation.js +26 -0
- package/dist/utils/addressValidation.js.map +1 -0
- package/dist/utils/authCheck.js +1 -2
- package/dist/utils/authCheck.js.map +1 -1
- package/dist/utils/bazaarCache.d.ts +32 -0
- package/dist/utils/bazaarCache.d.ts.map +1 -0
- package/dist/utils/bazaarCache.js +118 -0
- package/dist/utils/bazaarCache.js.map +1 -0
- package/dist/utils/parseAmount.d.ts +14 -0
- package/dist/utils/parseAmount.d.ts.map +1 -0
- package/dist/utils/parseAmount.js +31 -0
- package/dist/utils/parseAmount.js.map +1 -0
- package/dist/utils/serverManager.d.ts.map +1 -1
- package/dist/utils/serverManager.js +3 -3
- package/dist/utils/serverManager.js.map +1 -1
- package/dist/utils/viemClient.d.ts +10 -0
- package/dist/utils/viemClient.d.ts.map +1 -0
- package/dist/utils/viemClient.js +20 -0
- package/dist/utils/viemClient.js.map +1 -0
- package/package.json +8 -3
- package/server-bundle/bundle-electron.js +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var Ac=Object.create;var
|
|
2
|
+
var Ac=Object.create;var gs=Object.defineProperty;var Oc=Object.getOwnPropertyDescriptor;var Cc=Object.getOwnPropertyNames;var $c=Object.getPrototypeOf,Dc=Object.prototype.hasOwnProperty;var Ar=(a,e)=>()=>(a&&(e=a(a=0)),e);var Q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Nn=(a,e)=>{for(var t in e)gs(a,t,{get:e[t],enumerable:!0})},jc=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Cc(e))!Dc.call(a,r)&&r!==t&&gs(a,r,{get:()=>e[r],enumerable:!(s=Oc(e,r))||s.enumerable});return a};var Nc=(a,e,t)=>(t=a!=null?Ac($c(a)):{},jc(e||!a||!a.__esModule?gs(t,"default",{value:a,enumerable:!0}):t,a));import{shell as Ln}from"electron";var yr,oa,ys=Ar(()=>{"use strict";yr=!1,oa=class{constructor(){this.allowedOrigins=(()=>{let e=["https://payments-mcp.coinbase.com"];return yr&&e.push("http://localhost:3000","https://payments-mcp-dev.cbhq.net"),e})()}validateWalletUIUrl(e){if(!this.allowedOrigins.includes(e))throw new Error(`Unauthorized WALLET_UI_URL: ${e}. Allowed: ${this.allowedOrigins.join(", ")}`);return e}setupSecurityControls(e){e&&(e.webContents.setWindowOpenHandler(({url:t})=>this.isAllowedOrigin(t)?{action:"allow"}:(Ln.openExternal(t),{action:"deny"})),e.webContents.on("will-navigate",(t,s)=>{s.startsWith("file://")&&s.includes("/assets/fallback.html")||this.allowedOrigins.some(r=>s.startsWith(r))||(t.preventDefault(),Ln.openExternal(s))}),e.webContents.session.webRequest.onHeadersReceived((t,s)=>{try{let r=new URL(t.url),n={...t.responseHeaders};if(this.allowedOrigins.some(i=>t.url.startsWith(i))){let i=this.buildContentSecurityPolicy();delete n["Content-Security-Policy"],delete n["Content-Security-Policy-Report-Only"],delete n["content-security-policy"],delete n["content-security-policy-report-only"],n["Content-Security-Policy"]=[i]}r.pathname.startsWith("/api/")&&this.allowedOrigins.some(i=>t.url.startsWith(i))&&(n["Access-Control-Allow-Origin"]=[r.origin],n["Access-Control-Allow-Headers"]=["Content-Type","Authorization"],n["Access-Control-Allow-Methods"]=["GET","POST","PUT","DELETE"]),s({responseHeaders:n})}catch{s({})}}))}getAllowedOrigins(){return[...this.allowedOrigins]}isAllowedOrigin(e){try{return this.allowedOrigins.some(t=>e.startsWith(t))}catch{return!1}}buildContentSecurityPolicy(){let t=["'self'","'unsafe-inline'","https://cdn.cookielaw.org",...yr&&process.env.RELEASE_STAGE==="development"?["'unsafe-eval'"]:[]],s=["https://mainnet.base.org","https://mainnet.ethereum.org","https://sepolia.base.org","https://sepolia.ethereum.org","https://exceptions.coinbase.com","https://api.developer.coinbase.com","https://*.cdp.coinbase.com","https://as.coinbase.com","https://cdn.cookielaw.org","https://api.coinbase.com/v3/coinbase.killswitch.KillSwitchService/KillSwitches"];yr&&s.push("https://*.cbhq.net");let r=["'self'","data:","blob:","https:","https://static-assets.coinbase.com"],n=["'self'","'unsafe-inline'","https://fonts.googleapis.com"],i=["'self'","https://fonts.gstatic.com"],o=["'self'","blob:"];return["default-src 'self'",`script-src ${t.join(" ")}`,`connect-src 'self' ${s.join(" ")}`,`worker-src ${o.join(" ")}`,`img-src ${r.join(" ")}`,`style-src ${n.join(" ")}`,`font-src ${i.join(" ")}`,"frame-src 'none'","media-src 'self'","object-src 'none'","base-uri 'none'","frame-ancestors 'self'"].join("; ")+";"}}});var _s,_r,E,br=Ar(()=>{"use strict";ys();_s=class{constructor(){this.server=null}initialize(e){this.server=e}async sendLog(e,t,s){if(yr){let n=`[${new Date().toISOString()}] [${e.toUpperCase()}] [${t}]`;console.error(n,typeof s=="string"?s:JSON.stringify(s,null,2))}if(this.server)try{await this.server.sendLoggingMessage({level:e,logger:t,data:s})}catch(r){yr&&console.error("Failed to send log notification:",r)}}createLogger(e){return{debug:t=>this.sendLog("debug",e,t),info:t=>this.sendLog("info",e,t),notice:t=>this.sendLog("notice",e,t),warning:t=>this.sendLog("warning",e,t),error:t=>this.sendLog("error",e,t),critical:t=>this.sendLog("critical",e,t),alert:t=>this.sendLog("alert",e,t),emergency:t=>this.sendLog("emergency",e,t)}}},_r=new _s,E={mcp:_r.createLogger("mcp"),electron:_r.createLogger("electron"),window:_r.createLogger("window"),bridge:_r.createLogger("bridge"),security:_r.createLogger("security"),operations:_r.createLogger("operations"),tools:_r.createLogger("tools")}});function Or(){E.mcp.info({message:"Marking as intentional quit - will not restart",pid:process.pid}),Lc=!0}var Lc,la=Ar(()=>{"use strict";br();Lc=!1});import{BrowserWindow as bs,Menu as ws,Tray as qc,app as Vt,clipboard as qn,dialog as _t,ipcMain as Mc,nativeImage as Fc}from"electron";import Hr from"path";import{fileURLToPath as zc}from"url";import wt from"fs";function Ps(){if(yr){try{let a=Hr.join(bt,"dist-package.json");if(wt.existsSync(a))return JSON.parse(wt.readFileSync(a,"utf-8")).version||"unknown"}catch(a){E.window.error({message:"Failed to read MCP server version in dev",error:a instanceof Error?a.message:String(a)})}return"unknown"}return"1.0.6"}var bt,Wt,lr,ca,Mn=Ar(()=>{"use strict";ys();la();br();bt=Hr.dirname(zc(import.meta.url)),Wt=process.platform==="darwin",lr=Wt?"Command":"Ctrl",ca=class{constructor(){this.mainWindow=null;this.tray=null;this.isQuitting=!1;this.securityControls=new oa;this.latestVersion=null;this.updateCheckInProgress=!1;this.windowReadyResolve=null;this.windowReady=new Promise(e=>{this.windowReadyResolve=e})}withFocusedWindow(e){let t=bs.getFocusedWindow();t&&e(t)}getAppIcon(){let e=Hr.join(bt,"./assets/icon.png");return wt.existsSync(e)?Fc.createFromPath(e):void 0}getWalletUIUrl(){return yr&&process.env.WALLET_UI_URL?process.env.WALLET_UI_URL:"https://payments-mcp.coinbase.com"}showAboutDialog(){let e=Ps(),t=`Version: ${e}`;this.latestVersion&&this.latestVersion!==e?t+=`
|
|
3
3
|
|
|
4
4
|
Update available: ${this.latestVersion}
|
|
5
5
|
|
|
@@ -7,13 +7,13 @@ Run: npx @coinbase/payments-mcp@latest`:this.latestVersion===e&&(t+=`
|
|
|
7
7
|
|
|
8
8
|
You are running the latest version!`),_t.showMessageBox({type:"info",title:"About Payments MCP",message:"Payments MCP",detail:t,icon:this.getAppIcon(),buttons:this.latestVersion&&this.latestVersion!==e?["OK","Copy Command"]:["OK"]}).then(s=>{s.response===1&&this.latestVersion!==e&&(qn.writeText("npx @coinbase/payments-mcp@latest"),_t.showMessageBox({type:"info",title:"Command Copied",message:"Update command copied to clipboard!",detail:"Paste it in your terminal to update.",buttons:["OK"]}))})}async checkForUpdates(e=!1){if(this.updateCheckInProgress)return;this.updateCheckInProgress=!0;let t=Ps();try{let s=await fetch(`${this.getWalletUIUrl()}/api/version`);if(!s.ok)throw new Error(`HTTP ${s.status}`);let r=await s.json();this.latestVersion=r.version,E.window.info({message:"Update check completed",currentVersion:t,latestVersion:this.latestVersion}),this.mainWindow&&!this.mainWindow.isDestroyed()&&this.mainWindow.webContents.send("update-available",{currentVersion:t,latestVersion:this.latestVersion,updateAvailable:this.latestVersion!==t}),e||(this.latestVersion!==t?_t.showMessageBox({type:"info",title:"Update Available",message:`Payments MCP ${this.latestVersion} is available!`,detail:`You are currently running version ${t}.
|
|
9
9
|
|
|
10
|
-
Run: npx @coinbase/payments-mcp@latest`,icon:this.getAppIcon(),buttons:["OK","Copy Command"]}).then(n=>{n.response===1&&(qn.writeText("npx @coinbase/payments-mcp@latest"),_t.showMessageBox({type:"info",title:"Command Copied",message:"Update command copied to clipboard!",detail:"Paste it in your terminal to update.",buttons:["OK"]}))}):_t.showMessageBox({type:"info",title:"No Updates Available",message:"You are on the latest version!",detail:`Version ${t}`,icon:this.getAppIcon(),buttons:["OK"]}))}catch(s){E.window.error({message:"Failed to check for updates",error:s instanceof Error?s.message:String(s)}),e||_t.showMessageBox({type:"error",title:"Update Check Failed",message:"Could not check for updates",detail:s instanceof Error?s.message:String(s),icon:this.getAppIcon()})}finally{this.updateCheckInProgress=!1}}createWindow(){let e=this.securityControls.validateWalletUIUrl(this.getWalletUIUrl()),t=Hr.join(bt,"./assets/icon.png");if(this.mainWindow=new bs({show:!1,width:500,height:750,icon:wt.existsSync(t)?t:void 0,webPreferences:{nodeIntegration:!1,contextIsolation:!0,preload:Hr.join(bt,"preload.js"),webSecurity:!0,sandbox:!0}}),this.securityControls.setupSecurityControls(this.mainWindow),!this.mainWindow)throw new Error("Failed to create main window");return this.setupIpcHandlers(e),this.setupMenu(),this.setupTray(),this.mainWindow.webContents.on("did-finish-load",()=>{E.window.debug({message:"Window content loaded successfully"});let s=Ps();this.mainWindow?.webContents.send("mcp-server-version",{version:s}),E.window.debug({message:"Sent MCP server version to webapp",version:s}),this.checkForUpdates(!0),this.windowReadyResolve&&(E.window.info({message:"Window ready - signaling IPC readiness"}),this.windowReadyResolve(),this.windowReadyResolve=null)}),this.mainWindow.webContents.on("did-fail-load",(s,r,n,i)=>{r!==-3&&(E.window.error({message:"Failed to load URL",url:i,errorDescription:n,errorCode:r}),i.includes("fallback.html")||this.loadFallbackPage(i,n))}),this.mainWindow.loadURL(e).catch(s=>{E.window.error({message:"Failed to load wallet UI URL",url:e,error:s instanceof Error?s.message:String(s)}),this.loadFallbackPage(e,s.message)}),this.mainWindow.on("close",s=>{this.tray&&!this.isQuitting&&(s.preventDefault(),this.mainWindow?.hide())}),this.mainWindow.on("closed",()=>{this.mainWindow=null}),this.mainWindow}setupMenu(){if(!this.mainWindow)throw new Error("Main window must be created before setting up menu");let e=[{label:"About Payments MCP",click:()=>{this.showAboutDialog()}}];e.push({type:"separator"},{label:"Quit",accelerator:`${lr}+Q`,click:()=>{this.closeApp()}});let t=ws.buildFromTemplate([{label:Vt.name,submenu:e},{label:"Edit",submenu:[{label:"Undo",accelerator:`${lr}+Z`,role:"undo"},{label:"Redo",accelerator:Wt?"Shift+Command+Z":"Ctrl+Y",role:"redo"},{type:"separator"},{label:"Cut",accelerator:`${lr}+X`,role:"cut"},{label:"Copy",accelerator:`${lr}+C`,role:"copy"},{label:"Paste",accelerator:`${lr}+V`,role:"paste"},{label:"Select All",accelerator:`${lr}+A`,role:"selectAll"}]},{label:"View",submenu:[{label:"Reload",accelerator:`${lr}+R`,click:()=>{this.withFocusedWindow(s=>{s.webContents.reloadIgnoringCache()})}},{label:"Toggle DevTools",accelerator:Wt?"Alt+Command+I":"Ctrl+Shift+I",click:()=>{this.withFocusedWindow(s=>{s.webContents.toggleDevTools()})}}]},{label:"Window",submenu:[{label:"Minimize",accelerator:`${lr}+M`,role:"minimize"},{label:"Close",accelerator:`${lr}+W`,role:"close"},...Wt?[{type:"separator"},{label:"Bring All to Front",role:"front"}]:[]]}]);ws.setApplicationMenu(t)}setupTray(){let e=Hr.join(bt,"./assets/menubar-iconTemplate.png");if(!wt.existsSync(e)){E.window.warning({message:"Could not find tray icon",path:e});return}E.window.debug({message:"Using tray icon",path:e});try{this.tray=new qc(e),this.tray.setToolTip("Payments MCP"),E.window.debug({message:"System tray created successfully"})}catch(s){E.window.error({message:"Failed to create system tray",error:s instanceof Error?s.message:String(s)}),this.tray=null;return}let t=ws.buildFromTemplate([{label:"Show Window",accelerator:`${lr}+W`,click:()=>{this.showWindow(),this.focusApp()}},{label:"About Payments MCP",click:()=>{this.showAboutDialog()}}]);this.tray.on("click",()=>{this.showWindow(),this.focusApp()}),this.tray.on("right-click",()=>{this.tray?.popUpContextMenu(t)})}getMainWindow(){return bs.getAllWindows().find(t=>!t.isDestroyed())||this.mainWindow}closeApp(){E.window.notice({message:"closeApp() called - beginning shutdown sequence"}),Or(),this.isQuitting=!0,this.tray&&(E.window.debug({message:"Destroying system tray"}),this.tray.destroy(),this.tray=null),this.mainWindow&&(E.window.debug({message:"Closing main window"}),this.mainWindow.close()),E.window.notice({message:"Calling app.quit()"}),Vt.quit()}closeUI(){E.window.notice({message:"closeUI() called - closing window and tray"}),Or(),this.isQuitting=!0,this.tray&&(E.window.debug({message:"Destroying system tray"}),this.tray.destroy(),this.tray=null),this.mainWindow&&(E.window.debug({message:"Closing main window"}),this.mainWindow.close(),this.mainWindow=null)}focusApp(){this.mainWindow&&(this.mainWindow.isMinimized()&&this.mainWindow.restore(),this.mainWindow.focus(),this.mainWindow.show())}showWindow(){this.mainWindow?.show()}hasMainWindow(){return this.mainWindow!==null&&!this.mainWindow.isDestroyed()}restoreWindow(){this.mainWindow&&(this.mainWindow.isMinimized()&&this.mainWindow.restore(),this.mainWindow.focus())}setDockVisible(e){Wt&&Vt.dock&&(e?Vt.dock.show():Vt.dock.hide())}hasTray(){return this.tray!==null}getSecurityControls(){return this.securityControls}setupIpcHandlers(e){this.mainWindow&&Mc.on("reload-wallet-url",()=>{E.window.debug({message:"Reload wallet URL requested"}),this.mainWindow&&!this.mainWindow.isDestroyed()&&this.mainWindow.loadURL(e)})}loadFallbackPage(e,t){if(!this.mainWindow)return;let s=Hr.join(bt,"./assets/fallback.html");if(!wt.existsSync(s)){E.window.error({message:"Could not find fallback.html",path:s});return}let r=`file://${s}`;this.mainWindow.loadURL(r),E.window.warning({message:"Loaded fallback page",originalUrl:e,error:t})}}});import fe from"fs";import Br from"path";import{randomUUID as Uc}from"crypto";import{execSync as Vc}from"child_process";async function Ss(a,e){let t=Uc(),s=Br.join(Zr,`${t}.json`),r=Br.join(Ht,`${t}.json`);try{let n={id:t,channel:a,data:e,timestamp:Date.now(),pid:process.pid,processTitle:process.title};E.bridge.debug({message:"Forwarding to primary",pid:process.pid,channel:a,requestId:t}),fe.writeFileSync(s,JSON.stringify(n,null,2),{mode:384}),E.bridge.debug({message:"Request file written",pid:process.pid,requestFile:s});let i=3e4;await new Promise((u,f)=>{let h=setTimeout(()=>{_.close(),f(new Error(`UI bridge timeout: no response after ${i}ms`))},i);if(fe.existsSync(r)){clearTimeout(h),u(void 0);return}let _=fe.watch(Ht,(d,y)=>{y===`${t}.json`&&(clearTimeout(h),_.close(),u(void 0))})}),E.bridge.debug({message:"Response received",pid:process.pid,channel:a});let o=fe.readFileSync(r,"utf8"),c=JSON.parse(o);try{fe.unlinkSync(r)}catch{}if(c.error)throw E.bridge.error({message:"Error in response",pid:process.pid,channel:a,error:c.error}),new Error(c.error);return E.bridge.debug({message:"Successfully forwarded",pid:process.pid,channel:a}),c.result}catch(n){let i=n instanceof Error?n.message:String(n);try{fe.existsSync(r)&&fe.unlinkSync(r)}catch{}throw new Error(`UI bridge error: ${i}`)}}function xs(a){E.bridge.info({message:"Starting window bridge - handling UI requests from other processes",pid:process.pid}),(async()=>{try{let s=fe.readdirSync(Zr).filter(r=>r.endsWith(".json"));for(let r of s)await Fn(r,a)}catch{}})();let t=fe.watch(Zr,async(s,r)=>{s==="rename"&&r&&r.endsWith(".json")&&setTimeout(async()=>{let n=Br.join(Zr,r);fe.existsSync(n)&&await Fn(r,a)},10)});process.once("exit",()=>{t.close()})}async function Fn(a,e){let t=Br.join(Zr,a),s=a.replace(".json",""),r=Br.join(Ht,`${s}.json`);try{if(!fe.existsSync(t))return;let n=fe.readFileSync(t,"utf8"),i=JSON.parse(n);if(!i.pid||!i.processTitle){E.bridge.warning({message:"Rejecting request without process information",pid:process.pid,channel:i.channel}),fe.unlinkSync(t);return}try{process.kill(i.pid,0)}catch{E.bridge.warning({message:"Rejecting request from dead process",pid:process.pid,senderPid:i.pid,channel:i.channel}),fe.unlinkSync(t);return}try{let h=Vc(`ps -p ${i.pid} -o command=`,{encoding:"utf8",stdio:"pipe"});if(!(h.includes("payments-mcp-server")||h.includes("payments-mcp-cli")||h.includes("awal-cli")||h.includes("bundle-electron"))){E.security.warning({message:"Rejecting request from non-payments-mcp process",pid:process.pid,senderPid:i.pid,channel:i.channel}),fe.unlinkSync(t);return}}catch{E.bridge.warning({message:"Could not validate process, rejecting",pid:process.pid,senderPid:i.pid,channel:i.channel}),fe.unlinkSync(t);return}let o=Date.now()-i.timestamp;if(o>6e4){E.bridge.warning({message:"Ignoring stale request",pid:process.pid,age:o,channel:i.channel}),fe.unlinkSync(t);return}E.bridge.debug({message:"Processing UI bridge request",pid:process.pid,channel:i.channel,id:i.id});let c,u=null;try{E.bridge.debug({message:"Calling handler",pid:process.pid,channel:i.channel}),c=await e(i.channel,i.data),E.bridge.debug({message:"Handler completed, writing response",pid:process.pid,channel:i.channel})}catch(h){u=h instanceof Error?h.message:String(h),E.bridge.error({message:"UI bridge request error",pid:process.pid,channel:i.channel,error:h instanceof Error?h.message:String(h)})}let f={id:i.id,result:u?null:c,error:u||void 0,timestamp:Date.now()};E.bridge.debug({message:"Writing response file",pid:process.pid,responsePath:r}),fe.writeFileSync(r,JSON.stringify(f,null,2),{mode:384}),E.bridge.debug({message:"Response file written",pid:process.pid,channel:i.channel});try{fe.unlinkSync(t)}catch{}}catch(n){E.bridge.error({message:"Error processing UI bridge request",pid:process.pid,error:n instanceof Error?n.message:String(n)});try{let i={id:s,result:null,error:`Request processing error: ${n instanceof Error?n.message:String(n)}`,timestamp:Date.now()};fe.writeFileSync(r,JSON.stringify(i,null,2),{mode:384})}catch(i){E.bridge.error({message:"Failed to write error response",pid:process.pid,error:i instanceof Error?i.message:String(i)})}try{fe.unlinkSync(t)}catch{}}}var ua,Zr,Ht,Es=Ar(()=>{"use strict";br();ua="/tmp/payments-mcp-ui-bridge",Zr=Br.join(ua,"requests"),Ht=Br.join(ua,"responses");try{fe.existsSync(ua)||fe.mkdirSync(ua,{mode:448}),fe.existsSync(Zr)||fe.mkdirSync(Zr,{mode:448}),fe.existsSync(Ht)||fe.mkdirSync(Ht,{mode:448}),E.bridge.debug({message:"WindowBridge directories created with secure permissions"})}catch(a){E.bridge.error({message:"Failed to create WindowBridge IPC directories",error:a instanceof Error?a.message:String(a)})}});import{ipcMain as Wc}from"electron";var da,zn=Ar(()=>{"use strict";Es();br();da=class{constructor(e){this.windowManager=e}getMainWindow(){return this.windowManager.getMainWindow()}async sendToWindow(e,t){let s=this.getMainWindow();return s?(E.operations.debug({message:"Have window, sending directly via IPC",pid:process.pid,channel:e}),s.webContents.send(e,t),new Promise((r,n)=>{let i=`${e}-response`,o=setTimeout(()=>{n(new Error(`${e} request timed out after 30 seconds`))},3e4);Wc.once(i,(c,u)=>{clearTimeout(o);let f=u;f&&typeof f=="object"&&"error"in f?n(new Error(f.error)):f&&typeof f=="object"&&"data"in f?r(f.data):r(f)})})):(E.operations.debug({message:"No window, forwarding to primary process",pid:process.pid,channel:e}),Ss(e,t))}get operations(){return{bazaarList:{title:"List bazaar resources",description:"Get list of available bazaar resources that support x402 payments. By default returns summary info; pass full=true for complete details including schemas and payment requirements.",tool:async e=>this.sendToWindow("bazaar-list",e)},bazaarGetResourceDetails:{title:"Get bazaar resource details",description:"Get full details for a specific bazaar resource including complete schemas, payment requirements, HTTP method, URL scheme, and metadata. Call this for bazaar resources (discovered via bazaar_list) to understand the resource API, required parameters, payment costs, and proper request format before making x402 calls.",tool:async e=>this.sendToWindow("bazaar-get-resource-details",e)},makeX402Request:{title:"Make HTTP request with x402 payment",description:"Make an HTTP request to an X402-enabled endpoint, automatically handling any required payments. If payment requirements are not provided: for bazaar resources discovered via bazaar_list use bazaar_get_resource_details() first to get metadata (schemas, method, requirements); for non-bazaar endpoints use x402_discover_payment_requirements() to query the endpoint. If there are any parameters necessary, ask the user to provide them and then include the parameters in the body for POST/PUT/PATCH requests or as queryParams for URL parameters.",tool:async e=>this.sendToWindow("make-x402-request",e)},discoverX402PaymentRequirements:{title:"Discover x402 payment requirements",description:"Query an x402 endpoint directly to discover its payment requirements without making payment. Use this for non-bazaar endpoints or when you need to check payment costs and options dynamically. For bazaar resources (from bazaar_list), prefer bazaar_get_resource_details() which provides richer metadata including performance metrics and reliability ratings.",tool:async e=>this.sendToWindow("discover-x402-requirements",e)},getWalletAddress:{title:"Get wallet address",description:"Get the user's wallet address.",tool:async()=>this.sendToWindow("get-wallet-address")},getWalletBalance:{title:"Get wallet balance",description:"Get asset balances for the user wallet",tool:async e=>this.sendToWindow("get-wallet-balance",e)},checkSessionStatus:{title:"Check session authentication status",description:"Get detailed authentication status and guidance for the LLM",tool:async()=>this.sendToWindow("check-session-status")},showWindow:{title:"Show wallet window",description:"Show and focus the wallet application window",tool:async()=>{if(!this.getMainWindow()){E.operations.debug({message:"No window, forwarding to primary process",pid:process.pid}),await Ss("show-window",void 0);return}E.operations.debug({message:"Have window, showing and focusing directly",pid:process.pid}),this.windowManager.showWindow(),this.windowManager.focusApp()}},signInWithEmail:{title:"Sign in with email",description:"Send OTP verification code to email address",tool:async e=>this.sendToWindow("sign-in-with-email",e)},verifyEmailOTP:{title:"Verify email OTP",description:"Complete authentication with 6-digit OTP code",tool:async e=>this.sendToWindow("verify-email-otp",e)},sendTransaction:{title:"Send USDC transaction",description:"Send USDC to a recipient address. Amount is in atomic units (6 decimals). 1000000 = $1.00 USDC. Transactions are subject to spending limits set in the wallet app.",tool:async e=>this.sendToWindow("send-transaction",e)},executeSwap:{title:"Execute token swap",description:"Swap tokens using the CDP Swap API. Supports USDC, ETH, WETH on Base. Amount is in atomic units based on token decimals.",tool:async e=>this.sendToWindow("execute-swap",e)}}}}});import wr from"fs";import Rs from"path";import{execSync as Hc}from"child_process";function Ts(a){try{if(process.kill(a,0),process.platform!=="win32"){let e=Hc(`ps -p ${a} -o command=`,{encoding:"utf8",stdio:"pipe"});return e.includes("payments-mcp-server")||e.includes("payments-mcp-cli")||e.includes("awal-cli")||e.includes("electron index.ts")||e.includes("bundle-electron")}return!0}catch{return!1}}function Un(){let a="/tmp/payments-mcp-ui.lock",e="/tmp/payments-mcp-ui-bridge",t=!1;if(wr.existsSync(a))try{let s=parseInt(wr.readFileSync(a,"utf8").trim());Ts(s)||(wr.unlinkSync(a),E.security.debug({message:"Cleaned up stale UI lock file",lockPid:s}),t=!0)}catch{wr.unlinkSync(a),E.security.debug({message:"Cleaned up malformed UI lock file"}),t=!0}if(wr.existsSync(e))try{let s=Rs.join(e,"requests"),r=Rs.join(e,"responses"),n=Date.now()-5*60*1e3;[s,r].forEach(i=>{wr.existsSync(i)&&wr.readdirSync(i).forEach(c=>{let u=Rs.join(i,c);wr.statSync(u).mtime.getTime()<n&&(wr.unlinkSync(u),E.bridge.debug({message:"Cleaned up old bridge file",filePath:u}),t=!0)})})}catch(s){E.bridge.error({message:"Error cleaning bridge files",error:s instanceof Error?s.message:String(s)})}t&&E.security.info({message:"Stale file cleanup completed"})}var Vn=Ar(()=>{"use strict";br()});var Zt={};Nn(Zt,{closeApp:()=>Pr,closeUI:()=>Is,focusApp:()=>Jc,launchApp:()=>pa,operations:()=>le,windowReady:()=>Kc});import{app as Ge,BrowserWindow as Zc}from"electron";import Wn from"path";import Pt from"fs";import{fileURLToPath as Bc}from"url";function pa(){ks&&Ge.dock&&Ge.dock.hide(),Un();let a="/tmp/payments-mcp-ui.lock",e=!1;try{Pt.writeFileSync(a,process.pid.toString(),{flag:"wx"}),e=!0,E.electron.debug({message:"UI lock acquired",pid:process.pid}),process.once("exit",()=>{try{Pt.unlinkSync(a)}catch{}})}catch{try{let r=parseInt(Pt.readFileSync(a,"utf8").trim());Ts(r)?(E.electron.debug({message:"UI lock already taken"}),e=!1):(E.electron.warning({message:"Lock file contains dead PID, attempting to clean and retry",lockPid:r,currentPid:process.pid}),Pt.unlinkSync(a),Pt.writeFileSync(a,process.pid.toString(),{flag:"wx"}),e=!0,E.electron.debug({message:"UI lock acquired after cleaning stale lock",pid:process.pid}))}catch{E.electron.debug({message:"UI lock already taken"}),e=!1}}let t=Ge.requestSingleInstanceLock();if(E.electron.debug({message:"Electron single instance lock check",gotLock:t,isFirstInstance:e}),e)Ge.on("second-instance",()=>{He.hasMainWindow()&&He.restoreWindow()}),Ge.whenReady().then(()=>{if(ks&&Ge.dock){let s=Wn.join(Qc,"./assets/icon.png");if(Pt.existsSync(s))try{Ge.dock.setIcon(s)}catch(r){E.electron.error({message:"Error setting early dock icon",error:r instanceof Error?r.message:String(r)})}}He.hasMainWindow()||He.createWindow(),Ge.on("activate",()=>{Zc.getAllWindows().length===0&&He.createWindow(),He.showWindow()})}),Ge.on("window-all-closed",()=>{process.platform!=="darwin"&&Ge.quit()});else return E.electron.debug({message:"Another instance has UI lock, no UI will be shown"}),!1;return e}function Pr(){Or(),He.closeApp()}function Is(){He.closeUI()}function Jc(){if(He.hasMainWindow())He.focusApp();else if(!pa()){E.electron.warning({message:"Cannot focus app from secondary instance"});return}He.showWindow()}var Qc,He,Gc,ks,le,Kc,Sr=Ar(()=>{"use strict";Mn();zn();Vn();la();br();Qc=Wn.dirname(Bc(import.meta.url)),He=new ca,Gc=new da(He),ks=process.platform==="darwin";Ge.on("window-all-closed",()=>{ks||Ge.quit()});({operations:le}=Gc),Kc=He.windowReady});var Pi=Q((ja,wi)=>{(function(a,e){typeof ja=="object"&&typeof wi<"u"?e(ja):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(ja,function(a){"use strict";function e(){for(var m=arguments.length,p=Array(m),g=0;g<m;g++)p[g]=arguments[g];if(p.length>1){p[0]=p[0].slice(0,-1);for(var w=p.length-1,P=1;P<w;++P)p[P]=p[P].slice(1,-1);return p[w]=p[w].slice(1),p.join("")}else return p[0]}function t(m){return"(?:"+m+")"}function s(m){return m===void 0?"undefined":m===null?"null":Object.prototype.toString.call(m).split(" ").pop().split("]").shift().toLowerCase()}function r(m){return m.toUpperCase()}function n(m){return m!=null?m instanceof Array?m:typeof m.length!="number"||m.split||m.setInterval||m.call?[m]:Array.prototype.slice.call(m):[]}function i(m,p){var g=m;if(p)for(var w in p)g[w]=p[w];return g}function o(m){var p="[A-Za-z]",g="[\\x0D]",w="[0-9]",P="[\\x22]",L=e(w,"[A-Fa-f]"),K="[\\x0A]",se="[\\x20]",ce=t(t("%[EFef]"+L+"%"+L+L+"%"+L+L)+"|"+t("%[89A-Fa-f]"+L+"%"+L+L)+"|"+t("%"+L+L)),Ee="[\\:\\/\\?\\#\\[\\]\\@]",ae="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ye=e(Ee,ae),Re=m?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ge=m?"[\\uE000-\\uF8FF]":"[]",ie=e(p,w,"[\\-\\.\\_\\~]",Re),_e=t(p+e(p,w,"[\\+\\-\\.]")+"*"),de=t(t(ce+"|"+e(ie,ae,"[\\:]"))+"*"),Ur=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("[1-9]"+w)+"|"+w),Ve=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("0?[1-9]"+w)+"|0?0?"+w),Be=t(Ve+"\\."+Ve+"\\."+Ve+"\\."+Ve),pe=t(L+"{1,4}"),We=t(t(pe+"\\:"+pe)+"|"+Be),Qe=t(t(pe+"\\:")+"{6}"+We),or=t("\\:\\:"+t(pe+"\\:")+"{5}"+We),Vr=t(t(pe)+"?\\:\\:"+t(pe+"\\:")+"{4}"+We),mr=t(t(t(pe+"\\:")+"{0,1}"+pe)+"?\\:\\:"+t(pe+"\\:")+"{3}"+We),qt=t(t(t(pe+"\\:")+"{0,2}"+pe)+"?\\:\\:"+t(pe+"\\:")+"{2}"+We),sa=t(t(t(pe+"\\:")+"{0,3}"+pe)+"?\\:\\:"+pe+"\\:"+We),na=t(t(t(pe+"\\:")+"{0,4}"+pe)+"?\\:\\:"+We),ft=t(t(t(pe+"\\:")+"{0,5}"+pe)+"?\\:\\:"+pe),ht=t(t(t(pe+"\\:")+"{0,6}"+pe)+"?\\:\\:"),gr=t([Qe,or,Vr,mr,qt,sa,na,ft,ht].join("|")),mt=t(t(ie+"|"+ce)+"+"),ms=t(gr+"\\%25"+mt),Wr=t(gr+t("\\%25|\\%(?!"+L+"{2})")+mt),Sc=t("[vV]"+L+"+\\."+e(ie,ae,"[\\:]")+"+"),xc=t("\\["+t(Wr+"|"+gr+"|"+Sc)+"\\]"),Cn=t(t(ce+"|"+e(ie,ae))+"*"),Mt=t(xc+"|"+Be+"(?!"+Cn+")|"+Cn),Ft=t(w+"*"),$n=t(t(de+"@")+"?"+Mt+t("\\:"+Ft)+"?"),zt=t(ce+"|"+e(ie,ae,"[\\:\\@]")),Ec=t(zt+"*"),Dn=t(zt+"+"),Rc=t(t(ce+"|"+e(ie,ae,"[\\@]"))+"+"),vr=t(t("\\/"+Ec)+"*"),gt=t("\\/"+t(Dn+vr)+"?"),gs=t(Rc+vr),ia=t(Dn+vr),vt="(?!"+zt+")",Qf=t(vr+"|"+gt+"|"+gs+"|"+ia+"|"+vt),yt=t(t(zt+"|"+e("[\\/\\?]",ge))+"*"),Ut=t(t(zt+"|[\\/\\?]")+"*"),jn=t(t("\\/\\/"+$n+vr)+"|"+gt+"|"+ia+"|"+vt),Tc=t(_e+"\\:"+jn+t("\\?"+yt)+"?"+t("\\#"+Ut)+"?"),kc=t(t("\\/\\/"+$n+vr)+"|"+gt+"|"+gs+"|"+vt),Ic=t(kc+t("\\?"+yt)+"?"+t("\\#"+Ut)+"?"),Gf=t(Tc+"|"+Ic),Jf=t(_e+"\\:"+jn+t("\\?"+yt)+"?"),Kf="^("+_e+")\\:"+t(t("\\/\\/("+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?)")+"?("+vr+"|"+gt+"|"+ia+"|"+vt+")")+t("\\?("+yt+")")+"?"+t("\\#("+Ut+")")+"?$",Xf="^(){0}"+t(t("\\/\\/("+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?)")+"?("+vr+"|"+gt+"|"+gs+"|"+vt+")")+t("\\?("+yt+")")+"?"+t("\\#("+Ut+")")+"?$",Yf="^("+_e+")\\:"+t(t("\\/\\/("+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?)")+"?("+vr+"|"+gt+"|"+ia+"|"+vt+")")+t("\\?("+yt+")")+"?$",eh="^"+t("\\#("+Ut+")")+"?$",rh="^"+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",p,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ie,ae),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ie,ae),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ie,ae),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ie,ae),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]",ge),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ie,ae),"g"),UNRESERVED:new RegExp(ie,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ie,ye),"g"),PCT_ENCODED:new RegExp(ce,"g"),IPV4ADDRESS:new RegExp("^("+Be+")$"),IPV6ADDRESS:new RegExp("^\\[?("+gr+")"+t(t("\\%25|\\%(?!"+L+"{2})")+"("+mt+")")+"?\\]?$")}}var c=o(!1),u=o(!0),f=function(){function m(p,g){var w=[],P=!0,L=!1,K=void 0;try{for(var se=p[Symbol.iterator](),ce;!(P=(ce=se.next()).done)&&(w.push(ce.value),!(g&&w.length===g));P=!0);}catch(Ee){L=!0,K=Ee}finally{try{!P&&se.return&&se.return()}finally{if(L)throw K}}return w}return function(p,g){if(Array.isArray(p))return p;if(Symbol.iterator in Object(p))return m(p,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(m){if(Array.isArray(m)){for(var p=0,g=Array(m.length);p<m.length;p++)g[p]=m[p];return g}else return Array.from(m)},_=2147483647,d=36,y=1,b=26,v=38,S=700,A=72,x=128,T="-",O=/^xn--/,C=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=d-y,U=Math.floor,F=String.fromCharCode;function q(m){throw new RangeError(z[m])}function I(m,p){for(var g=[],w=m.length;w--;)g[w]=p(m[w]);return g}function D(m,p){var g=m.split("@"),w="";g.length>1&&(w=g[0]+"@",m=g[1]),m=m.replace(W,".");var P=m.split("."),L=I(P,p).join(".");return w+L}function M(m){for(var p=[],g=0,w=m.length;g<w;){var P=m.charCodeAt(g++);if(P>=55296&&P<=56319&&g<w){var L=m.charCodeAt(g++);(L&64512)==56320?p.push(((P&1023)<<10)+(L&1023)+65536):(p.push(P),g--)}else p.push(P)}return p}var ue=function(p){return String.fromCodePoint.apply(String,h(p))},Y=function(p){return p-48<10?p-22:p-65<26?p-65:p-97<26?p-97:d},te=function(p,g){return p+22+75*(p<26)-((g!=0)<<5)},X=function(p,g,w){var P=0;for(p=w?U(p/S):p>>1,p+=U(p/g);p>$*b>>1;P+=d)p=U(p/$);return U(P+($+1)*p/(p+v))},H=function(p){var g=[],w=p.length,P=0,L=x,K=A,se=p.lastIndexOf(T);se<0&&(se=0);for(var ce=0;ce<se;++ce)p.charCodeAt(ce)>=128&&q("not-basic"),g.push(p.charCodeAt(ce));for(var Ee=se>0?se+1:0;Ee<w;){for(var ae=P,ye=1,Re=d;;Re+=d){Ee>=w&&q("invalid-input");var ge=Y(p.charCodeAt(Ee++));(ge>=d||ge>U((_-P)/ye))&&q("overflow"),P+=ge*ye;var ie=Re<=K?y:Re>=K+b?b:Re-K;if(ge<ie)break;var _e=d-ie;ye>U(_/_e)&&q("overflow"),ye*=_e}var de=g.length+1;K=X(P-ae,de,ae==0),U(P/de)>_-L&&q("overflow"),L+=U(P/de),P%=de,g.splice(P++,0,L)}return String.fromCodePoint.apply(String,g)},be=function(p){var g=[];p=M(p);var w=p.length,P=x,L=0,K=A,se=!0,ce=!1,Ee=void 0;try{for(var ae=p[Symbol.iterator](),ye;!(se=(ye=ae.next()).done);se=!0){var Re=ye.value;Re<128&&g.push(F(Re))}}catch(Wr){ce=!0,Ee=Wr}finally{try{!se&&ae.return&&ae.return()}finally{if(ce)throw Ee}}var ge=g.length,ie=ge;for(ge&&g.push(T);ie<w;){var _e=_,de=!0,Ur=!1,Ve=void 0;try{for(var Be=p[Symbol.iterator](),pe;!(de=(pe=Be.next()).done);de=!0){var We=pe.value;We>=P&&We<_e&&(_e=We)}}catch(Wr){Ur=!0,Ve=Wr}finally{try{!de&&Be.return&&Be.return()}finally{if(Ur)throw Ve}}var Qe=ie+1;_e-P>U((_-L)/Qe)&&q("overflow"),L+=(_e-P)*Qe,P=_e;var or=!0,Vr=!1,mr=void 0;try{for(var qt=p[Symbol.iterator](),sa;!(or=(sa=qt.next()).done);or=!0){var na=sa.value;if(na<P&&++L>_&&q("overflow"),na==P){for(var ft=L,ht=d;;ht+=d){var gr=ht<=K?y:ht>=K+b?b:ht-K;if(ft<gr)break;var mt=ft-gr,ms=d-gr;g.push(F(te(gr+mt%ms,0))),ft=U(mt/ms)}g.push(F(te(ft,0))),K=X(L,Qe,ie==ge),L=0,++ie}}}catch(Wr){Vr=!0,mr=Wr}finally{try{!or&&qt.return&&qt.return()}finally{if(Vr)throw mr}}++L,++P}return g.join("")},Ae=function(p){return D(p,function(g){return O.test(g)?H(g.slice(4).toLowerCase()):g})},$e=function(p){return D(p,function(g){return C.test(g)?"xn--"+be(g):g})},ne={version:"2.1.0",ucs2:{decode:M,encode:ue},decode:H,encode:be,toASCII:$e,toUnicode:Ae},Se={};function Te(m){var p=m.charCodeAt(0),g=void 0;return p<16?g="%0"+p.toString(16).toUpperCase():p<128?g="%"+p.toString(16).toUpperCase():p<2048?g="%"+(p>>6|192).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase():g="%"+(p>>12|224).toString(16).toUpperCase()+"%"+(p>>6&63|128).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase(),g}function De(m){for(var p="",g=0,w=m.length;g<w;){var P=parseInt(m.substr(g+1,2),16);if(P<128)p+=String.fromCharCode(P),g+=3;else if(P>=194&&P<224){if(w-g>=6){var L=parseInt(m.substr(g+4,2),16);p+=String.fromCharCode((P&31)<<6|L&63)}else p+=m.substr(g,6);g+=6}else if(P>=224){if(w-g>=9){var K=parseInt(m.substr(g+4,2),16),se=parseInt(m.substr(g+7,2),16);p+=String.fromCharCode((P&15)<<12|(K&63)<<6|se&63)}else p+=m.substr(g,9);g+=9}else p+=m.substr(g,3),g+=3}return p}function kr(m,p){function g(w){var P=De(w);return P.match(p.UNRESERVED)?P:w}return m.scheme&&(m.scheme=String(m.scheme).replace(p.PCT_ENCODED,g).toLowerCase().replace(p.NOT_SCHEME,"")),m.userinfo!==void 0&&(m.userinfo=String(m.userinfo).replace(p.PCT_ENCODED,g).replace(p.NOT_USERINFO,Te).replace(p.PCT_ENCODED,r)),m.host!==void 0&&(m.host=String(m.host).replace(p.PCT_ENCODED,g).toLowerCase().replace(p.NOT_HOST,Te).replace(p.PCT_ENCODED,r)),m.path!==void 0&&(m.path=String(m.path).replace(p.PCT_ENCODED,g).replace(m.scheme?p.NOT_PATH:p.NOT_PATH_NOSCHEME,Te).replace(p.PCT_ENCODED,r)),m.query!==void 0&&(m.query=String(m.query).replace(p.PCT_ENCODED,g).replace(p.NOT_QUERY,Te).replace(p.PCT_ENCODED,r)),m.fragment!==void 0&&(m.fragment=String(m.fragment).replace(p.PCT_ENCODED,g).replace(p.NOT_FRAGMENT,Te).replace(p.PCT_ENCODED,r)),m}function fr(m){return m.replace(/^0*(.*)/,"$1")||"0"}function xe(m,p){var g=m.match(p.IPV4ADDRESS)||[],w=f(g,2),P=w[1];return P?P.split(".").map(fr).join("."):m}function we(m,p){var g=m.match(p.IPV6ADDRESS)||[],w=f(g,3),P=w[1],L=w[2];if(P){for(var K=P.toLowerCase().split("::").reverse(),se=f(K,2),ce=se[0],Ee=se[1],ae=Ee?Ee.split(":").map(fr):[],ye=ce.split(":").map(fr),Re=p.IPV4ADDRESS.test(ye[ye.length-1]),ge=Re?7:8,ie=ye.length-ge,_e=Array(ge),de=0;de<ge;++de)_e[de]=ae[de]||ye[ie+de]||"";Re&&(_e[ge-1]=xe(_e[ge-1],p));var Ur=_e.reduce(function(Qe,or,Vr){if(!or||or==="0"){var mr=Qe[Qe.length-1];mr&&mr.index+mr.length===Vr?mr.length++:Qe.push({index:Vr,length:1})}return Qe},[]),Ve=Ur.sort(function(Qe,or){return or.length-Qe.length})[0],Be=void 0;if(Ve&&Ve.length>1){var pe=_e.slice(0,Ve.index),We=_e.slice(Ve.index+Ve.length);Be=pe.join(":")+"::"+We.join(":")}else Be=_e.join(":");return L&&(Be+="%"+L),Be}else return m}var Mr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function oe(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},w=p.iri!==!1?u:c;p.reference==="suffix"&&(m=(p.scheme?p.scheme+":":"")+"//"+m);var P=m.match(Mr);if(P){Oe?(g.scheme=P[1],g.userinfo=P[3],g.host=P[4],g.port=parseInt(P[5],10),g.path=P[6]||"",g.query=P[7],g.fragment=P[8],isNaN(g.port)&&(g.port=P[5])):(g.scheme=P[1]||void 0,g.userinfo=m.indexOf("@")!==-1?P[3]:void 0,g.host=m.indexOf("//")!==-1?P[4]:void 0,g.port=parseInt(P[5],10),g.path=P[6]||"",g.query=m.indexOf("?")!==-1?P[7]:void 0,g.fragment=m.indexOf("#")!==-1?P[8]:void 0,isNaN(g.port)&&(g.port=m.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),g.host&&(g.host=we(xe(g.host,w),w)),g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0?g.reference="same-document":g.scheme===void 0?g.reference="relative":g.fragment===void 0?g.reference="absolute":g.reference="uri",p.reference&&p.reference!=="suffix"&&p.reference!==g.reference&&(g.error=g.error||"URI is not a "+p.reference+" reference.");var L=Se[(p.scheme||g.scheme||"").toLowerCase()];if(!p.unicodeSupport&&(!L||!L.unicodeSupport)){if(g.host&&(p.domainHost||L&&L.domainHost))try{g.host=ne.toASCII(g.host.replace(w.PCT_ENCODED,De).toLowerCase())}catch(K){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+K}kr(g,c)}else kr(g,w);L&&L.parse&&L.parse(g,p)}else g.error=g.error||"URI can not be parsed.";return g}function Ir(m,p){var g=p.iri!==!1?u:c,w=[];return m.userinfo!==void 0&&(w.push(m.userinfo),w.push("@")),m.host!==void 0&&w.push(we(xe(String(m.host),g),g).replace(g.IPV6ADDRESS,function(P,L,K){return"["+L+(K?"%25"+K:"")+"]"})),(typeof m.port=="number"||typeof m.port=="string")&&(w.push(":"),w.push(String(m.port))),w.length?w.join(""):void 0}var hr=/^\.\.?\//,Fr=/^\/\.(\/|$)/,zr=/^\/\.\.(\/|$)/,ke=/^\/?(?:.|\n)*?(?=\/|$)/;function Ze(m){for(var p=[];m.length;)if(m.match(hr))m=m.replace(hr,"");else if(m.match(Fr))m=m.replace(Fr,"/");else if(m.match(zr))m=m.replace(zr,"/"),p.pop();else if(m==="."||m==="..")m="";else{var g=m.match(ke);if(g){var w=g[0];m=m.slice(w.length),p.push(w)}else throw new Error("Unexpected dot segment condition")}return p.join("")}function Le(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=p.iri?u:c,w=[],P=Se[(p.scheme||m.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(m,p),m.host&&!g.IPV6ADDRESS.test(m.host)){if(p.domainHost||P&&P.domainHost)try{m.host=p.iri?ne.toUnicode(m.host):ne.toASCII(m.host.replace(g.PCT_ENCODED,De).toLowerCase())}catch(se){m.error=m.error||"Host's domain name can not be converted to "+(p.iri?"Unicode":"ASCII")+" via punycode: "+se}}kr(m,g),p.reference!=="suffix"&&m.scheme&&(w.push(m.scheme),w.push(":"));var L=Ir(m,p);if(L!==void 0&&(p.reference!=="suffix"&&w.push("//"),w.push(L),m.path&&m.path.charAt(0)!=="/"&&w.push("/")),m.path!==void 0){var K=m.path;!p.absolutePath&&(!P||!P.absolutePath)&&(K=Ze(K)),L===void 0&&(K=K.replace(/^\/\//,"/%2F")),w.push(K)}return m.query!==void 0&&(w.push("?"),w.push(m.query)),m.fragment!==void 0&&(w.push("#"),w.push(m.fragment)),w.join("")}function je(m,p){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],P={};return w||(m=oe(Le(m,g),g),p=oe(Le(p,g),g)),g=g||{},!g.tolerant&&p.scheme?(P.scheme=p.scheme,P.userinfo=p.userinfo,P.host=p.host,P.port=p.port,P.path=Ze(p.path||""),P.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(P.userinfo=p.userinfo,P.host=p.host,P.port=p.port,P.path=Ze(p.path||""),P.query=p.query):(p.path?(p.path.charAt(0)==="/"?P.path=Ze(p.path):((m.userinfo!==void 0||m.host!==void 0||m.port!==void 0)&&!m.path?P.path="/"+p.path:m.path?P.path=m.path.slice(0,m.path.lastIndexOf("/")+1)+p.path:P.path=p.path,P.path=Ze(P.path)),P.query=p.query):(P.path=m.path,p.query!==void 0?P.query=p.query:P.query=m.query),P.userinfo=m.userinfo,P.host=m.host,P.port=m.port),P.scheme=m.scheme),P.fragment=p.fragment,P}function nr(m,p,g){var w=i({scheme:"null"},g);return Le(je(oe(m,w),oe(p,w),w,!0),w)}function Ue(m,p){return typeof m=="string"?m=Le(oe(m,p),p):s(m)==="object"&&(m=oe(Le(m,p),p)),m}function aa(m,p,g){return typeof m=="string"?m=Le(oe(m,g),g):s(m)==="object"&&(m=Le(m,g)),typeof p=="string"?p=Le(oe(p,g),g):s(p)==="object"&&(p=Le(p,g)),m===p}function fs(m,p){return m&&m.toString().replace(!p||!p.iri?c.ESCAPE:u.ESCAPE,Te)}function rr(m,p){return m&&m.toString().replace(!p||!p.iri?c.PCT_ENCODED:u.PCT_ENCODED,De)}var Nt={scheme:"http",domainHost:!0,parse:function(p,g){return p.host||(p.error=p.error||"HTTP URIs must have a host."),p},serialize:function(p,g){var w=String(p.scheme).toLowerCase()==="https";return(p.port===(w?443:80)||p.port==="")&&(p.port=void 0),p.path||(p.path="/"),p}},xn={scheme:"https",domainHost:Nt.domainHost,parse:Nt.parse,serialize:Nt.serialize};function En(m){return typeof m.secure=="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}var Lt={scheme:"ws",domainHost:!0,parse:function(p,g){var w=p;return w.secure=En(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(p,g){if((p.port===(En(p)?443:80)||p.port==="")&&(p.port=void 0),typeof p.secure=="boolean"&&(p.scheme=p.secure?"wss":"ws",p.secure=void 0),p.resourceName){var w=p.resourceName.split("?"),P=f(w,2),L=P[0],K=P[1];p.path=L&&L!=="/"?L:void 0,p.query=K,p.resourceName=void 0}return p.fragment=void 0,p}},Rn={scheme:"wss",domainHost:Lt.domainHost,parse:Lt.parse,serialize:Lt.serialize},dc={},pc=!0,Tn="[A-Za-z0-9\\-\\.\\_\\~"+(pc?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ir="[0-9A-Fa-f]",fc=t(t("%[EFef]"+ir+"%"+ir+ir+"%"+ir+ir)+"|"+t("%[89A-Fa-f]"+ir+"%"+ir+ir)+"|"+t("%"+ir+ir)),hc="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",mc="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",gc=e(mc,'[\\"\\\\]'),vc="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",yc=new RegExp(Tn,"g"),pt=new RegExp(fc,"g"),_c=new RegExp(e("[^]",hc,"[\\.]",'[\\"]',gc),"g"),kn=new RegExp(e("[^]",Tn,vc),"g"),bc=kn;function hs(m){var p=De(m);return p.match(yc)?p:m}var In={scheme:"mailto",parse:function(p,g){var w=p,P=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var L=!1,K={},se=w.query.split("&"),ce=0,Ee=se.length;ce<Ee;++ce){var ae=se[ce].split("=");switch(ae[0]){case"to":for(var ye=ae[1].split(","),Re=0,ge=ye.length;Re<ge;++Re)P.push(ye[Re]);break;case"subject":w.subject=rr(ae[1],g);break;case"body":w.body=rr(ae[1],g);break;default:L=!0,K[rr(ae[0],g)]=rr(ae[1],g);break}}L&&(w.headers=K)}w.query=void 0;for(var ie=0,_e=P.length;ie<_e;++ie){var de=P[ie].split("@");if(de[0]=rr(de[0]),g.unicodeSupport)de[1]=rr(de[1],g).toLowerCase();else try{de[1]=ne.toASCII(rr(de[1],g).toLowerCase())}catch(Ur){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ur}P[ie]=de.join("@")}return w},serialize:function(p,g){var w=p,P=n(p.to);if(P){for(var L=0,K=P.length;L<K;++L){var se=String(P[L]),ce=se.lastIndexOf("@"),Ee=se.slice(0,ce).replace(pt,hs).replace(pt,r).replace(_c,Te),ae=se.slice(ce+1);try{ae=g.iri?ne.toUnicode(ae):ne.toASCII(rr(ae,g).toLowerCase())}catch(ie){w.error=w.error||"Email address's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+ie}P[L]=Ee+"@"+ae}w.path=P.join(",")}var ye=p.headers=p.headers||{};p.subject&&(ye.subject=p.subject),p.body&&(ye.body=p.body);var Re=[];for(var ge in ye)ye[ge]!==dc[ge]&&Re.push(ge.replace(pt,hs).replace(pt,r).replace(kn,Te)+"="+ye[ge].replace(pt,hs).replace(pt,r).replace(bc,Te));return Re.length&&(w.query=Re.join("&")),w}},wc=/^([^\:]+)\:(.*)/,An={scheme:"urn",parse:function(p,g){var w=p.path&&p.path.match(wc),P=p;if(w){var L=g.scheme||P.scheme||"urn",K=w[1].toLowerCase(),se=w[2],ce=L+":"+(g.nid||K),Ee=Se[ce];P.nid=K,P.nss=se,P.path=void 0,Ee&&(P=Ee.parse(P,g))}else P.error=P.error||"URN can not be parsed.";return P},serialize:function(p,g){var w=g.scheme||p.scheme||"urn",P=p.nid,L=w+":"+(g.nid||P),K=Se[L];K&&(p=K.serialize(p,g));var se=p,ce=p.nss;return se.path=(P||g.nid)+":"+ce,se}},Pc=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,On={scheme:"urn:uuid",parse:function(p,g){var w=p;return w.uuid=w.nss,w.nss=void 0,!g.tolerant&&(!w.uuid||!w.uuid.match(Pc))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(p,g){var w=p;return w.nss=(p.uuid||"").toLowerCase(),w}};Se[Nt.scheme]=Nt,Se[xn.scheme]=xn,Se[Lt.scheme]=Lt,Se[Rn.scheme]=Rn,Se[In.scheme]=In,Se[An.scheme]=An,Se[On.scheme]=On,a.SCHEMES=Se,a.pctEncChar=Te,a.pctDecChars=De,a.parse=oe,a.removeDotSegments=Ze,a.serialize=Le,a.resolveComponents=je,a.resolve=nr,a.normalize=Ue,a.equal=aa,a.escapeComponent=fs,a.unescapeComponent=rr,Object.defineProperty(a,"__esModule",{value:!0})})});var Na=Q((Tm,Si)=>{"use strict";Si.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var Ei=Q((km,xi)=>{"use strict";xi.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var ut=Q((Im,ki)=>{"use strict";ki.exports={copy:Kd,checkDataType:Hs,checkDataTypes:Xd,coerceToTypes:Yd,toHash:Bs,getProperty:Qs,escapeQuotes:Gs,equal:Na(),ucs2length:Ei(),varOccurences:tp,varReplace:ap,schemaHasRules:sp,schemaHasRulesExcept:np,schemaUnknownRules:ip,toQuotedString:Zs,getPathExpr:op,getPath:lp,getData:dp,unescapeFragment:pp,unescapeJsonPointer:Ks,escapeFragment:fp,escapeJsonPointer:Js};function Kd(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Hs(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(t?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Xd(a,e,t){switch(a.length){case 1:return Hs(a[0],e,t,!0);default:var s="",r=Bs(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Hs(n,e,t,!0);return s}}var Ri=Bs(["string","number","integer","boolean","null"]);function Yd(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(Ri[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(Ri[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Bs(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var ep=/^[a-z$_][a-z$_0-9]*$/i,rp=/'|\\/g;function Qs(a){return typeof a=="number"?"["+a+"]":ep.test(a)?"."+a:"['"+Gs(a)+"']"}function Gs(a){return a.replace(rp,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function tp(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function ap(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function sp(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function np(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function ip(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Zs(a){return"'"+Gs(a)+"'"}function op(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Ti(a,r)}function lp(a,e,t){var s=Zs(t?"/"+Js(e):Qs(e));return Ti(a,s)}var cp=/^\/(?:[^~]|~0|~1)*$/,up=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dp(a,e,t){var s,r,n,i;if(a==="")return"rootData";if(a[0]=="/"){if(!cp.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(i=a.match(up),!i)throw new Error("Invalid JSON-pointer: "+a);if(s=+i[1],r=i[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var o=n,c=r.split("/"),u=0;u<c.length;u++){var f=c[u];f&&(n+=Qs(Ks(f)),o+=" && "+n)}return o}function Ti(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function pp(a){return Ks(decodeURIComponent(a))}function fp(a){return encodeURIComponent(Js(a))}function Js(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Ks(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var Xs=Q((Am,Ii)=>{"use strict";var hp=ut();Ii.exports=mp;function mp(a){hp.copy(a,this)}});var Oi=Q((Om,Ai)=>{"use strict";var Nr=Ai.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};La(e,s,r,a,"",a)};Nr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Nr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function La(a,e,t,s,r,n,i,o,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,u);for(var f in s){var h=s[f];if(Array.isArray(h)){if(f in Nr.arrayKeywords)for(var _=0;_<h.length;_++)La(a,e,t,h[_],r+"/"+f+"/"+_,n,r,f,s,_)}else if(f in Nr.propsKeywords){if(h&&typeof h=="object")for(var d in h)La(a,e,t,h[d],r+"/"+f+"/"+gp(d),n,r,f,s,d)}else(f in Nr.keywords||a.allKeys&&!(f in Nr.skipKeywords))&&La(a,e,t,h,r+"/"+f,n,r,f,s)}t(s,r,n,i,o,c,u)}}function gp(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var Va=Q((Cm,ji)=>{"use strict";var Yt=Pi(),Ci=Na(),za=ut(),qa=Xs(),vp=Oi();ji.exports=qr;qr.normalizeId=Lr;qr.fullPath=Ma;qr.url=Fa;qr.ids=Pp;qr.inlineRef=Ys;qr.schema=Ua;function qr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return qr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof qa)return Ys(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ua.call(this,e,t),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof qa?i=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(i=Ys(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),i}function Ua(a,e){var t=Yt.parse(e),s=Di(t),r=Ma(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Lr(s),i=this._refs[n];if(typeof i=="string")return yp.call(this,a,i,t);if(i instanceof qa)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof qa){if(i.validate||this._compile(i),n==Lr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Ma(this._getId(a.schema))}return $i.call(this,t,r,a.schema,a)}function yp(a,e,t){var s=Ua.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=Fa(n,i)),$i.call(this,t,n,r,a)}}var _p=za.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function $i(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var i=r[n];if(i){if(i=za.unescapeFragment(i),t=t[i],t===void 0)break;var o;if(!_p[i]&&(o=this._getId(t),o&&(e=Fa(e,o)),t.$ref)){var c=Fa(e,t.$ref),u=Ua.call(this,s,c);u&&(t=u.schema,s=u.root,e=u.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var bp=za.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Ys(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return en(a);if(e)return rn(a)<=e}function en(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!en(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!en(e)))return!1;return!0}function rn(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=rn(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(bp[r])e++;else if(t=a[r],typeof t=="object"&&(e+=rn(t)+1),e==1/0)return 1/0}return e}function Ma(a,e){e!==!1&&(a=Lr(a));var t=Yt.parse(a);return Di(t)}function Di(a){return Yt.serialize(a).split("#")[0]+"#"}var wp=/#\/?$/;function Lr(a){return a?a.replace(wp,""):""}function Fa(a,e){return e=Lr(e),Yt.resolve(a,e)}function Pp(a){var e=Lr(this._getId(a)),t={"":e},s={"":Ma(e,!1)},r={},n=this;return vp(a,{allKeys:!0},function(i,o,c,u,f,h,_){if(o!==""){var d=n._getId(i),y=t[u],b=s[u]+"/"+f;if(_!==void 0&&(b+="/"+(typeof _=="number"?_:za.escapeFragment(_))),typeof d=="string"){d=y=Lr(y?Yt.resolve(y,d):d);var v=n._refs[d];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!Ci(i,v.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Lr(b))if(d[0]=="#"){if(r[d]&&!Ci(i,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=i}else n._refs[d]=b}t[o]=y,s[o]=b}}),r}});var Wa=Q(($m,Li)=>{"use strict";var tn=Va();Li.exports={Validation:Ni(Sp),MissingRef:Ni(an)};function Sp(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}an.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function an(a,e,t){this.message=t||an.message(a,e),this.missingRef=tn.url(a,e),this.missingSchema=tn.normalizeId(tn.fullPath(this.missingRef))}function Ni(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var sn=Q((Dm,qi)=>{"use strict";qi.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(i){return function(o,c){var u={key:o,value:i[o]},f={key:c,value:i[c]};return n(u,f)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o<i.length;o++)o&&(c+=","),c+=n(i[o])||"null";return c+"]"}if(i===null)return"null";if(r.indexOf(i)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=r.push(i)-1,f=Object.keys(i).sort(s&&s(i));for(c="",o=0;o<f.length;o++){var h=f[o],_=n(i[h]);_&&(c&&(c+=","),c+=JSON.stringify(h)+":"+_)}return r.splice(u,1),"{"+c+"}"}}(a)}});var nn=Q((jm,Mi)=>{"use strict";Mi.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var t="false schema",f=e.level,h=e.dataLevel,_=e.schema[t],d=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,O=!e.opts.allErrors,z,b="data"+(h||""),T="valid"+f;if(e.schema===!1){e.isTop?O=!0:r+=" var "+T+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+T+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var A=e.isTop,f=e.level=0,h=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var x="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,h=e.dataLevel,b="data"+(h||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+f+" = errors;"}var T="valid"+f,O=!e.opts.allErrors,C="",W="",z,$=e.schema.type,U=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(U?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],U=!0)),U&&$.length==1&&($=$[0],U=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var F=e.util.coerceToTypes(e.opts.coerceTypes,$);var q=e.RULES.types[$];if(F||U||q===!0||q&&!ke(q)){var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",d=e.schemaPath+".type",y=e.errSchemaPath+"/type",I=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[I]($,b,e.opts.strictNumbers,!0)+") { ",F){var D="dataType"+f,M="coerced"+f;r+=" var "+D+" = typeof "+b+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+D+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+D+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+M+" = "+b+"; } "),r+=" if ("+M+" !== undefined) ; ";var ue=F;if(ue)for(var Y,te=-1,X=ue.length-1;te<X;)Y=ue[te+=1],Y=="string"?r+=" else if ("+D+" == 'number' || "+D+" == 'boolean') "+M+" = '' + "+b+"; else if ("+b+" === null) "+M+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+D+" == 'boolean' || "+b+" === null || ("+D+" == 'string' && "+b+" && "+b+" == +"+b+" ",Y=="integer"&&(r+=" && !("+b+" % 1)"),r+=")) "+M+" = +"+b+"; "):Y=="boolean"?r+=" else if ("+b+" === 'false' || "+b+" === 0 || "+b+" === null) "+M+" = false; else if ("+b+" === 'true' || "+b+" === 1) "+M+" = true; ":Y=="null"?r+=" else if ("+b+" === '' || "+b+" === 0 || "+b+" === false) "+M+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+D+" == 'string' || "+D+" == 'number' || "+D+" == 'boolean' || "+b+" == null) "+M+" = ["+b+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+M+" !== undefined) { ";var H=h?"data"+(h-1||""):"parentData",be=h?e.dataPathArr[h]:"parentDataProperty";r+=" "+b+" = "+M+"; ",h||(r+="if ("+H+" !== undefined)"),r+=" "+H+"["+be+"] = "+M+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!i)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",O&&(r+=" } if (errors === ",A?r+="0":r+="errs_"+f,r+=") { ",W+="}");else{var Ae=e.RULES;if(Ae){for(var q,$e=-1,ne=Ae.length-1;$e<ne;)if(q=Ae[$e+=1],ke(q)){if(q.type&&(r+=" if ("+e.util.checkDataType(q.type,b,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(q.type=="object"&&e.schema.properties){var _=e.schema.properties,Se=Object.keys(_),Te=Se;if(Te)for(var De,kr=-1,fr=Te.length-1;kr<fr;){De=Te[kr+=1];var xe=_[De];if(xe.default!==void 0){var we=b+e.util.getProperty(De);if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+we;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else r+=" if ("+we+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+we+" === null || "+we+" === '' "),r+=" ) "+we+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(xe.default)+" ":r+=" "+JSON.stringify(xe.default)+" ",r+="; "}}}else if(q.type=="array"&&Array.isArray(e.schema.items)){var Mr=e.schema.items;if(Mr){for(var xe,te=-1,Oe=Mr.length-1;te<Oe;)if(xe=Mr[te+=1],xe.default!==void 0){var we=b+"["+te+"]";if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+we;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else r+=" if ("+we+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+we+" === null || "+we+" === '' "),r+=" ) "+we+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(xe.default)+" ":r+=" "+JSON.stringify(xe.default)+" ",r+="; "}}}}var oe=q.rules;if(oe){for(var Ir,hr=-1,Fr=oe.length-1;hr<Fr;)if(Ir=oe[hr+=1],Ze(Ir)){var zr=Ir.code(e,Ir.keyword,q.type);zr&&(r+=" "+zr+" ",O&&(C+="}"))}}if(O&&(r+=" "+C+" ",C=""),q.type&&(r+=" } ",$&&$===q.type&&!F)){r+=" else { ";var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}O&&(r+=" if (errors === ",A?r+="0":r+="errs_"+f,r+=") { ",W+="}")}}}O&&(r+=" "+W+" "),A?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+T+" = errors === errs_"+f+";";function ke(je){for(var nr=je.rules,Ue=0;Ue<nr.length;Ue++)if(Ze(nr[Ue]))return!0}function Ze(je){return e.schema[je.keyword]!==void 0||je.implements&&Le(je)}function Le(je){for(var nr=je.implements,Ue=0;Ue<nr.length;Ue++)if(e.schema[nr[Ue]]!==void 0)return!0}return r}});var Wi=Q((Nm,Vi)=>{"use strict";var Ha=Va(),Ba=ut(),zi=Wa(),xp=sn(),Fi=nn(),Ep=Ba.ucs2length,Rp=Na(),Tp=zi.Validation;Vi.exports=on;function on(a,e,t,s){var r=this,n=this._opts,i=[void 0],o={},c=[],u={},f=[],h={},_=[];e=e||{schema:a,refVal:i,refs:o};var d=kp.call(this,a,e,s),y=this._compilations[d.index];if(d.compiling)return y.callValidate=x;var b=this._formats,v=this.RULES;try{var S=T(a,e,t,s);y.validate=S;var A=y.callValidate;return A&&(A.schema=S.schema,A.errors=null,A.refs=S.refs,A.refVal=S.refVal,A.root=S.root,A.$async=S.$async,n.sourceCode&&(A.source=S.source)),S}finally{Ip.call(this,a,e,s)}function x(){var I=y.validate,D=I.apply(this,arguments);return x.errors=I.errors,D}function T(I,D,M,ue){var Y=!D||D&&D.schema==I;if(D.schema!=e.schema)return on.call(r,I,D,M,ue);var te=I.$async===!0,X=Fi({isTop:!0,schema:I,isRoot:Y,baseId:ue,root:D,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:zi.MissingRef,RULES:v,validate:Fi,util:Ba,resolve:Ha,resolveRef:O,usePattern:U,useDefault:F,useCustomRule:q,opts:n,formats:b,logger:r.logger,self:r});X=Za(i,Cp)+Za(c,Ap)+Za(f,Op)+Za(_,$p)+X,n.processCode&&(X=n.processCode(X,I));var H;try{var be=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",X);H=be(r,v,b,e,i,f,_,Rp,Ep,Tp),i[0]=H}catch(Ae){throw r.logger.error("Error compiling schema, function code:",X),Ae}return H.schema=I,H.errors=null,H.refs=o,H.refVal=i,H.root=Y?H:D,te&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:X,patterns:c,defaults:f}),H}function O(I,D,M){D=Ha.url(I,D);var ue=o[D],Y,te;if(ue!==void 0)return Y=i[ue],te="refVal["+ue+"]",$(Y,te);if(!M&&e.refs){var X=e.refs[D];if(X!==void 0)return Y=e.refVal[X],te=C(D,Y),$(Y,te)}te=C(D);var H=Ha.call(r,T,e,D);if(H===void 0){var be=t&&t[D];be&&(H=Ha.inlineRef(be,n.inlineRefs)?be:on.call(r,be,e,t,I))}if(H===void 0)W(D);else return z(D,H),$(H,te)}function C(I,D){var M=i.length;return i[M]=D,o[I]=M,"refVal"+M}function W(I){delete o[I]}function z(I,D){var M=o[I];i[M]=D}function $(I,D){return typeof I=="object"||typeof I=="boolean"?{code:D,schema:I,inline:!0}:{code:D,$async:I&&!!I.$async}}function U(I){var D=u[I];return D===void 0&&(D=u[I]=c.length,c[D]=I),"pattern"+D}function F(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return Ba.toQuotedString(I);case"object":if(I===null)return"null";var D=xp(I),M=h[D];return M===void 0&&(M=h[D]=f.length,f[M]=I),"default"+M}}function q(I,D,M,ue){if(r._opts.validateSchema!==!1){var Y=I.definition.dependencies;if(Y&&!Y.every(function(Te){return Object.prototype.hasOwnProperty.call(M,Te)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var te=I.definition.validateSchema;if(te){var X=te(D);if(!X){var H="keyword schema is invalid: "+r.errorsText(te.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var be=I.definition.compile,Ae=I.definition.inline,$e=I.definition.macro,ne;if(be)ne=be.call(r,D,M,ue);else if($e)ne=$e.call(r,D,M,ue),n.validateSchema!==!1&&r.validateSchema(ne,!0);else if(Ae)ne=Ae.call(r,ue,I.keyword,D,M);else if(ne=I.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var Se=_.length;return _[Se]=ne,{code:"customRule"+Se,validate:ne}}}function kp(a,e,t){var s=Ui.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function Ip(a,e,t){var s=Ui.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Ui(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function Ap(a,e){return"var pattern"+a+" = new RegExp("+Ba.toQuotedString(e[a])+");"}function Op(a){return"var default"+a+" = defaults["+a+"];"}function Cp(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function $p(a){return"var customRule"+a+" = customRules["+a+"];"}function Za(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Zi=Q((Lm,Hi)=>{"use strict";var Qa=Hi.exports=function(){this._cache={}};Qa.prototype.put=function(e,t){this._cache[e]=t};Qa.prototype.get=function(e){return this._cache[e]};Qa.prototype.del=function(e){delete this._cache[e]};Qa.prototype.clear=function(){this._cache={}}});var so=Q((qm,ao)=>{"use strict";var Dp=ut(),jp=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Np=[0,31,28,31,30,31,30,31,31,30,31,30,31],Lp=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Bi=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,qp=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Mp=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Qi=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Gi=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Ji=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ki=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Xi=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Yi=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ao.exports=Ga;function Ga(a){return a=a=="full"?"full":"fast",Dp.copy(Ga[a])}Ga.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Qi,url:Gi,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Bi,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:to,uuid:Ji,"json-pointer":Ki,"json-pointer-uri-fragment":Xi,"relative-json-pointer":Yi};Ga.full={date:eo,time:ro,"date-time":Up,uri:Wp,"uri-reference":Mp,"uri-template":Qi,url:Gi,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Bi,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:to,uuid:Ji,"json-pointer":Ki,"json-pointer-uri-fragment":Xi,"relative-json-pointer":Yi};function Fp(a){return a%4===0&&(a%100!==0||a%400===0)}function eo(a){var e=a.match(jp);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Fp(t)?29:Np[s])}function ro(a,e){var t=a.match(Lp);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var zp=/t|\s/i;function Up(a){var e=a.split(zp);return e.length==2&&eo(e[0])&&ro(e[1],!0)}var Vp=/\/|:/;function Wp(a){return Vp.test(a)&&qp.test(a)}var Hp=/[^\\]\\Z/;function to(a){if(Hp.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var io=Q((Mm,no)=>{"use strict";no.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,_,d;if(o=="#"||o=="#/")e.isRoot?(_=e.async,d="validate"):(_=e.root.schema.$async===!0,d="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(b);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),u&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,b)}else if(y.inline){var A=e.util.copy(e);A.level++;var x="valid"+A.level;A.schema=y.schema,A.schemaPath="",A.errSchemaPath=o;var T=e.validate(A).replace(/validate\.schema/g,y.code);r+=" "+T+" ",u&&(r+=" if ("+x+") { ")}else _=y.$async===!0||e.async&&y.$async!==!1,d=y.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var O=i?"data"+(i-1||""):"parentData",C=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+O+" , "+C+", rootData) ";var W=r;if(r=v.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(r+=" var "+h+"; "),r+=" try { await "+W+"; ",u&&(r+=" "+h+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(r+=" "+h+" = false; "),r+=" } ",u&&(r+=" if ("+h+") { ")}else r+=" if (!"+W+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",u&&(r+=" else { ")}return r}});var lo=Q((Fm,oo)=>{"use strict";oo.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u=e.util.copy(e),f="";u.level++;var h="valid"+u.level,_=u.baseId,d=!0,y=n;if(y)for(var b,v=-1,S=y.length-1;v<S;)b=y[v+=1],(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(d=!1,u.schema=b,u.schemaPath=i+"["+v+"]",u.errSchemaPath=o+"/"+v,r+=" "+e.validate(u)+" ",u.baseId=_,c&&(r+=" if ("+h+") { ",f+="}"));return c&&(d?r+=" if (true) { ":r+=" "+f.slice(0,-1)+" "),r}});var uo=Q((zm,co)=>{"use strict";co.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var v="valid"+y.level,S=o.every(function(z){return e.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:e.util.schemaHasRules(z,e.RULES.all)});if(S){var A=y.baseId;r+=" var "+d+" = errors; var "+_+" = false; ";var x=e.compositeRule;e.compositeRule=y.compositeRule=!0;var T=o;if(T)for(var O,C=-1,W=T.length-1;C<W;)O=T[C+=1],y.schema=O,y.schemaPath=c+"["+C+"]",y.errSchemaPath=u+"/"+C,r+=" "+e.validate(y)+" ",y.baseId=A,r+=" "+_+" = "+_+" || "+v+"; if (!"+_+") { ",b+="}";e.compositeRule=y.compositeRule=x,r+=" "+b+" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else f&&(r+=" if (true) { ");return r}});var fo=Q((Um,po)=>{"use strict";po.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var mo=Q((Vm,ho)=>{"use strict";ho.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o,d||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+_+" = equal("+h+", schema"+n+"); if (!"+_+") { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var v=r;return r=b.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var vo=Q((Wm,go)=>{"use strict";go.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var v="valid"+y.level,S="i"+n,A=y.dataLevel=e.dataLevel+1,x="data"+A,T=e.baseId,O=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+d+" = errors;var "+_+";",O){var C=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=c,y.errSchemaPath=u,r+=" var "+v+" = false; for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var W=h+"["+S+"]";y.dataPathArr[A]=S;var z=e.validate(y);y.baseId=T,e.util.varOccurences(z,x)<2?r+=" "+e.util.varReplace(z,x,W)+" ":r+=" var "+x+" = "+W+"; "+z+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=C,r+=" "+b+" if (!"+v+") {"}else r+=" if ("+h+".length == 0) {";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var U=r;return r=$.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",O&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var _o=Q((Hm,yo)=>{"use strict";yo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e),y="";d.level++;var b="valid"+d.level,v={},S={},A=e.opts.ownProperties;for(C in o)if(C!="__proto__"){var x=o[C],T=Array.isArray(x)?S:v;T[C]=x}r+="var "+_+" = errors;";var O=e.errorPath;r+="var missing"+n+";";for(var C in S)if(T=S[C],T.length){if(r+=" if ( "+h+e.util.getProperty(C)+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),f){r+=" && ( ";var W=T;if(W)for(var z,$=-1,U=W.length-1;$<U;){z=W[$+=1],$&&(r+=" || ");var F=e.util.getProperty(z),q=h+F;r+=" ( ( "+q+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?z:F)+") ) "}r+=")) { ";var I="missing"+n,D="' + "+I+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(O,I,!0):O+" + "+I);var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+D+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var ue=r;r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ue+"]); ":r+=" validate.errors = ["+ue+"]; return false; ":r+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=T;if(Y)for(var z,te=-1,X=Y.length-1;te<X;){z=Y[te+=1];var F=e.util.getProperty(z),D=e.util.escapeQuotes(z),q=h+F;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(O,z,e.opts.jsonPointers)),r+=" if ( "+q+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+D+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",f&&(y+="}",r+=" else { ")}e.errorPath=O;var H=d.baseId;for(var C in v){var x=v[C];(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))&&(r+=" "+b+" = true; if ( "+h+e.util.getProperty(C)+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),r+=") { ",d.schema=x,d.schemaPath=c+e.util.getProperty(C),d.errSchemaPath=u+"/"+e.util.escapeFragment(C),r+=" "+e.validate(d)+" ",d.baseId=H,r+=" } ",f&&(r+=" if ("+b+") { ",y+="}"))}return f&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var wo=Q((Zm,bo)=>{"use strict";bo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+c+";"),r+="var "+_+";",d&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=""+_+" = false;for (var "+b+"=0; "+b+"<"+v+".length; "+b+"++) if (equal("+h+", "+v+"["+b+"])) { "+_+" = true; break; }",d&&(r+=" } "),r+=" if (!"+_+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var A=r;return r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var So=Q((Bm,Po)=>{"use strict";Po.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||"");if(e.opts.format===!1)return f&&(r+=" if (true) { "),r;var _=e.opts.$data&&o&&o.$data,d;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=e.opts.unknownFormats,b=Array.isArray(y);if(_){var v="format"+n,S="isObject"+n,A="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+S+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+A+" = "+S+" && "+v+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+d+" && !"+v+" ",b&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+A+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+h+") : "+v+"("+h+")) ":r+=" "+v+"("+h+") ",r+=" : "+v+".test("+h+"))))) {"}else{var v=e.formats[o];if(!v){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(r+=" if (true) { "),r;if(b&&y.indexOf(o)>=0)return f&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,A=S&&v.type||"string";if(S){var x=v.async===!0;v=v.validate}if(A!=s)return f&&(r+=" if (true) { "),r;if(x){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+T+"("+h+"))) { "}else{r+=" if (! ";var T="formats"+e.util.getProperty(o);S&&(T+=".validate"),typeof v=="function"?r+=" "+T+"("+h+") ":r+=" "+T+".test("+h+") ",r+=") { "}}var O=O||[];O.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",_?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var C=r;return r=O.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var Eo=Q((Qm,xo)=>{"use strict";xo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e);y.level++;var b="valid"+y.level,v=e.schema.then,S=e.schema.else,A=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),x=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),T=y.baseId;if(A||x){var O;y.createErrors=!1,y.schema=o,y.schemaPath=c,y.errSchemaPath=u,r+=" var "+d+" = errors; var "+_+" = true; ";var C=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=T,y.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=C,A?(r+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+_+" = "+b+"; ",A&&x?(O="ifClause"+n,r+=" var "+O+" = 'then'; "):O="'then'",r+=" } ",x&&(r+=" else { ")):r+=" if (!"+b+") { ",x&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+_+" = "+b+"; ",A&&x?(O="ifClause"+n,r+=" var "+O+" = 'else'; "):O="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+O+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+O+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var To=Q((Gm,Ro)=>{"use strict";Ro.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var v="valid"+y.level,S="i"+n,A=y.dataLevel=e.dataLevel+1,x="data"+A,T=e.baseId;if(r+="var "+d+" = errors;var "+_+";",Array.isArray(o)){var O=e.schema.additionalItems;if(O===!1){r+=" "+_+" = "+h+".length <= "+o.length+"; ";var C=u;u=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var z=r;r=W.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u=C,f&&(b+="}",r+=" else { ")}var $=o;if($){for(var U,F=-1,q=$.length-1;F<q;)if(U=$[F+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+h+".length > "+F+") { ";var I=h+"["+F+"]";y.schema=U,y.schemaPath=c+"["+F+"]",y.errSchemaPath=u+"/"+F,y.errorPath=e.util.getPathExpr(e.errorPath,F,e.opts.jsonPointers,!0),y.dataPathArr[A]=F;var D=e.validate(y);y.baseId=T,e.util.varOccurences(D,x)<2?r+=" "+e.util.varReplace(D,x,I)+" ":r+=" var "+x+" = "+I+"; "+D+" ",r+=" } ",f&&(r+=" if ("+v+") { ",b+="}")}}if(typeof O=="object"&&(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))){y.schema=O,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+h+".length > "+o.length+") { for (var "+S+" = "+o.length+"; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=h+"["+S+"]";y.dataPathArr[A]=S;var D=e.validate(y);y.baseId=T,e.util.varOccurences(D,x)<2?r+=" "+e.util.varReplace(D,x,I)+" ":r+=" var "+x+" = "+I+"; "+D+" ",f&&(r+=" if (!"+v+") break; "),r+=" } } ",f&&(r+=" if ("+v+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){y.schema=o,y.schemaPath=c,y.errSchemaPath=u,r+=" for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=h+"["+S+"]";y.dataPathArr[A]=S;var D=e.validate(y);y.baseId=T,e.util.varOccurences(D,x)<2?r+=" "+e.util.varReplace(D,x,I)+" ":r+=" var "+x+" = "+I+"; "+D+" ",f&&(r+=" if (!"+v+") break; "),r+=" }"}return f&&(r+=" "+b+" if ("+d+" == errors) {"),r}});var ln=Q((Jm,ko)=>{"use strict";ko.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,T,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=t=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[b],S=e.opts.$data&&v&&v.$data,A=y?"<":">",x=y?">":"<",T=void 0;if(!(_||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(S||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(b+" must be number or boolean");if(S){var O=e.util.getData(v.$data,i,e.dataPathArr),C="exclusive"+n,W="exclType"+n,z="exclIsNumber"+n,$="op"+n,U="' + "+$+" + '";r+=" var schemaExcl"+n+" = "+O+"; ",O="schemaExcl"+n,r+=" var "+C+"; var "+W+" = typeof "+O+"; if ("+W+" != 'boolean' && "+W+" != 'undefined' && "+W+" != 'number') { ";var T=b,F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var q=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+W+" == 'number' ? ( ("+C+" = "+d+" === undefined || "+O+" "+A+"= "+d+") ? "+h+" "+x+"= "+O+" : "+h+" "+x+" "+d+" ) : ( ("+C+" = "+O+" === true) ? "+h+" "+x+"= "+d+" : "+h+" "+x+" "+d+" ) || "+h+" !== "+h+") { var op"+n+" = "+C+" ? '"+A+"' : '"+A+"='; ",o===void 0&&(T=b,u=e.errSchemaPath+"/"+b,d=O,_=S)}else{var z=typeof v=="number",U=A;if(z&&_){var $="'"+U+"'";r+=" if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+A+"= "+d+" ? "+h+" "+x+"= "+v+" : "+h+" "+x+" "+d+" ) || "+h+" !== "+h+") { "}else{z&&o===void 0?(C=!0,T=b,u=e.errSchemaPath+"/"+b,d=v,x+="="):(z&&(d=Math[y?"min":"max"](v,o)),v===(z?d:!0)?(C=!0,T=b,u=e.errSchemaPath+"/"+b,x+="="):(C=!1,U+="="));var $="'"+U+"'";r+=" if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+h+" "+x+" "+d+" || "+h+" !== "+h+") { "}}T=T||t;var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+$+", limit: "+d+", exclusive: "+C+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",_?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var q=r;return r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var cn=Q((Km,Io)=>{"use strict";Io.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,b,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+h+".length "+y+" "+d+") { ";var b=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+d+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var un=Q((Xm,Ao)=>{"use strict";Ao.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,b,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+h+".length ":r+=" ucs2length("+h+") ",r+=" "+y+" "+d+") { ";var b=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+d+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var dn=Q((Ym,Oo)=>{"use strict";Oo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,b,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+h+").length "+y+" "+d+") { ";var b=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+d+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var $o=Q((eg,Co)=>{"use strict";Co.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",_&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+h+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",_&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var b=r;return r=y.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+b+"]); ":r+=" validate.errors = ["+b+"]; return false; ":r+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var jo=Q((rg,Do)=>{"use strict";Do.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e);d.level++;var y="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u,r+=" var "+_+" = errors; ";var b=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=b,r+=" if ("+y+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var A=r;r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+_+"; if (vErrors !== null) { if ("+_+") vErrors.length = "+_+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ");return r}});var Lo=Q((tg,No)=>{"use strict";No.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var v="valid"+y.level,S=y.baseId,A="prevValid"+n,x="passingSchemas"+n;r+="var "+d+" = errors , "+A+" = false , "+_+" = false , "+x+" = null; ";var T=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=o;if(O)for(var C,W=-1,z=O.length-1;W<z;)C=O[W+=1],(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))?(y.schema=C,y.schemaPath=c+"["+W+"]",y.errSchemaPath=u+"/"+W,r+=" "+e.validate(y)+" ",y.baseId=S):r+=" var "+v+" = true; ",W&&(r+=" if ("+v+" && "+A+") { "+_+" = false; "+x+" = ["+x+", "+W+"]; } else { ",b+="}"),r+=" if ("+v+") { "+_+" = "+A+" = true; "+x+" = "+W+"; }";return e.compositeRule=y.compositeRule=T,r+=""+b+"if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+x+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Mo=Q((ag,qo)=>{"use strict";qo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=_?"(new RegExp("+d+"))":e.usePattern(o);r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+y+".test("+h+") ) { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",_?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var v=r;return r=b.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var zo=Q((sg,Fo)=>{"use strict";Fo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e),y="";d.level++;var b="valid"+d.level,v="key"+n,S="idx"+n,A=d.dataLevel=e.dataLevel+1,x="data"+A,T="dataProperties"+n,O=Object.keys(o||{}).filter(te),C=e.schema.patternProperties||{},W=Object.keys(C).filter(te),z=e.schema.additionalProperties,$=O.length||W.length,U=z===!1,F=typeof z=="object"&&Object.keys(z).length,q=e.opts.removeAdditional,I=U||F||q,D=e.opts.ownProperties,M=e.baseId,ue=e.schema.required;if(ue&&!(e.opts.$data&&ue.$data)&&ue.length<e.opts.loopRequired)var Y=e.util.toHash(ue);function te(rr){return rr!=="__proto__"}if(r+="var "+_+" = errors;var "+b+" = true;",D&&(r+=" var "+T+" = undefined;"),I){if(D?r+=" "+T+" = "+T+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+T+".length; "+S+"++) { var "+v+" = "+T+"["+S+"]; ":r+=" for (var "+v+" in "+h+") { ",$){if(r+=" var isAdditional"+n+" = !(false ",O.length)if(O.length>8)r+=" || validate.schema"+c+".hasOwnProperty("+v+") ";else{var X=O;if(X)for(var H,be=-1,Ae=X.length-1;be<Ae;)H=X[be+=1],r+=" || "+v+" == "+e.util.toQuotedString(H)+" "}if(W.length){var $e=W;if($e)for(var ne,Se=-1,Te=$e.length-1;Se<Te;)ne=$e[Se+=1],r+=" || "+e.usePattern(ne)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(q=="all")r+=" delete "+h+"["+v+"]; ";else{var De=e.errorPath,kr="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(q)r+=" delete "+h+"["+v+"]; ";else{r+=" "+b+" = false; ";var fr=u;u=e.errSchemaPath+"/additionalProperties";var xe=xe||[];xe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+kr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var we=r;r=xe.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=fr,f&&(r+=" break; ")}else if(F)if(q=="failing"){r+=" var "+_+" = errors; ";var Mr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=z,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=h+"["+v+"]";d.dataPathArr[A]=v;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Oe)+" ":r+=" var "+x+" = "+Oe+"; "+oe+" ",r+=" if (!"+b+") { errors = "+_+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+v+"]; } ",e.compositeRule=d.compositeRule=Mr}else{d.schema=z,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=h+"["+v+"]";d.dataPathArr[A]=v;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Oe)+" ":r+=" var "+x+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+b+") break; ")}e.errorPath=De}$&&(r+=" } "),r+=" } ",f&&(r+=" if ("+b+") { ",y+="}")}var Ir=e.opts.useDefaults&&!e.compositeRule;if(O.length){var hr=O;if(hr)for(var H,Fr=-1,zr=hr.length-1;Fr<zr;){H=hr[Fr+=1];var ke=o[H];if(e.opts.strictKeywords?typeof ke=="object"&&Object.keys(ke).length>0||ke===!1:e.util.schemaHasRules(ke,e.RULES.all)){var Ze=e.util.getProperty(H),Oe=h+Ze,Le=Ir&&ke.default!==void 0;d.schema=ke,d.schemaPath=c+Ze,d.errSchemaPath=u+"/"+e.util.escapeFragment(H),d.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),d.dataPathArr[A]=e.util.toQuotedString(H);var oe=e.validate(d);if(d.baseId=M,e.util.varOccurences(oe,x)<2){oe=e.util.varReplace(oe,x,Oe);var je=Oe}else{var je=x;r+=" var "+x+" = "+Oe+"; "}if(Le)r+=" "+oe+" ";else{if(Y&&Y[H]){r+=" if ( "+je+" === undefined ",D&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+b+" = false; ";var De=e.errorPath,fr=u,nr=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(De,H,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var xe=xe||[];xe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+nr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+nr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var we=r;r=xe.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=fr,e.errorPath=De,r+=" } else { "}else f?(r+=" if ( "+je+" === undefined ",D&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+b+" = true; } else { "):(r+=" if ("+je+" !== undefined ",D&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+oe+" } "}}f&&(r+=" if ("+b+") { ",y+="}")}}if(W.length){var Ue=W;if(Ue)for(var ne,aa=-1,fs=Ue.length-1;aa<fs;){ne=Ue[aa+=1];var ke=C[ne];if(e.opts.strictKeywords?typeof ke=="object"&&Object.keys(ke).length>0||ke===!1:e.util.schemaHasRules(ke,e.RULES.all)){d.schema=ke,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),D?r+=" "+T+" = "+T+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+T+".length; "+S+"++) { var "+v+" = "+T+"["+S+"]; ":r+=" for (var "+v+" in "+h+") { ",r+=" if ("+e.usePattern(ne)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=h+"["+v+"]";d.dataPathArr[A]=v;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Oe)+" ":r+=" var "+x+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+b+") break; "),r+=" } ",f&&(r+=" else "+b+" = true; "),r+=" } ",f&&(r+=" if ("+b+") { ",y+="}")}}}return f&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Vo=Q((ng,Uo)=>{"use strict";Uo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e),y="";d.level++;var b="valid"+d.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u;var v="key"+n,S="idx"+n,A="i"+n,x="' + "+v+" + '",T=d.dataLevel=e.dataLevel+1,O="data"+T,C="dataProperties"+n,W=e.opts.ownProperties,z=e.baseId;W&&(r+=" var "+C+" = undefined; "),W?r+=" "+C+" = "+C+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+C+".length; "+S+"++) { var "+v+" = "+C+"["+S+"]; ":r+=" for (var "+v+" in "+h+") { ",r+=" var startErrs"+n+" = errors; ";var $=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var F=e.validate(d);d.baseId=z,e.util.varOccurences(F,O)<2?r+=" "+e.util.varReplace(F,O,$)+" ":r+=" var "+O+" = "+$+"; "+F+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+b+") { for (var "+A+"=startErrs"+n+"; "+A+"<errors; "+A+"++) { vErrors["+A+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+x+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+x+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),f&&(r+=" break; "),r+=" } }"}return f&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Ho=Q((ig,Wo)=>{"use strict";Wo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="schema"+n;if(!d)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],S=o;if(S)for(var A,x=-1,T=S.length-1;x<T;){A=S[x+=1];var O=e.schema.properties[A];O&&(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))||(v[v.length]=A)}}else var v=o;if(d||v.length){var C=e.errorPath,W=d||v.length>=e.opts.loopRequired,z=e.opts.ownProperties;if(f)if(r+=" var missing"+n+"; ",W){d||(r+=" var "+b+" = validate.schema"+c+"; ");var $="i"+n,U="schema"+n+"["+$+"]",F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,U,e.opts.jsonPointers)),r+=" var "+_+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { "+_+" = "+h+"["+b+"["+$+"]] !== undefined ",z&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),r+="; if (!"+_+") break; } ",d&&(r+=" } "),r+=" if (!"+_+") { ";var q=q||[];q.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var I=r;r=q.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var D=v;if(D)for(var M,$=-1,ue=D.length-1;$<ue;){M=D[$+=1],$&&(r+=" || ");var Y=e.util.getProperty(M),te=h+Y;r+=" ( ( "+te+" === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:Y)+") ) "}r+=") { ";var U="missing"+n,F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,U,!0):C+" + "+U);var q=q||[];q.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var I=r;r=q.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(W){d||(r+=" var "+b+" = validate.schema"+c+"; ");var $="i"+n,U="schema"+n+"["+$+"]",F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,U,e.opts.jsonPointers)),d&&(r+=" if ("+b+" && !Array.isArray("+b+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+b+" !== undefined) { "),r+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { if ("+h+"["+b+"["+$+"]] === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var X=v;if(X)for(var M,H=-1,be=X.length-1;H<be;){M=X[H+=1];var Y=e.util.getProperty(M),F=e.util.escapeQuotes(M),te=h+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,M,e.opts.jsonPointers)),r+=" if ( "+te+" === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=C}else f&&(r+=" if (true) {");return r}});var Bo=Q((og,Zo)=>{"use strict";Zo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;if(d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+_+"; if ("+y+" === false || "+y+" === undefined) "+_+" = true; else if (typeof "+y+" != 'boolean') "+_+" = false; else { "),r+=" var i = "+h+".length , "+_+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,v=Array.isArray(b);if(!b||b=="object"||b=="array"||v&&(b.indexOf("object")>=0||b.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+_+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var S="checkDataType"+(v?"s":"");r+=" if ("+e.util[S](b,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+_+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+_+") { ";var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var x=r;r=A.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var Go=Q((lg,Qo)=>{"use strict";Qo.exports={$ref:io(),allOf:lo(),anyOf:uo(),$comment:fo(),const:mo(),contains:vo(),dependencies:_o(),enum:wo(),format:So(),if:Eo(),items:To(),maximum:ln(),minimum:ln(),maxItems:cn(),minItems:cn(),maxLength:un(),minLength:un(),maxProperties:dn(),minProperties:dn(),multipleOf:$o(),not:jo(),oneOf:Lo(),pattern:Mo(),properties:zo(),propertyNames:Vo(),required:Ho(),uniqueItems:Bo(),validate:nn()}});var Xo=Q((cg,Ko)=>{"use strict";var Jo=Go(),pn=ut().toHash;Ko.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=pn(t),e.types=pn(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(f){t.push(f),e.all[f]=!0})}t.push(i);var u=e.all[i]={keyword:i,code:Jo[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:Jo.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=pn(t.concat(s)),e.custom={},e}});var rl=Q((ug,el)=>{"use strict";var Yo=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];el.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Yo.length;n++){var i=Yo[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var sl=Q((dg,al)=>{"use strict";var Zp=Wa().MissingRef;al.exports=tl;function tl(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var o=s._addSchema(a,void 0,e);return o.validate||i(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var c=o.$schema;return c&&!s.getSchema(c)?tl.call(s,{$ref:c},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(u){if(u instanceof Zp)return c(u);throw u}function c(u){var f=u.missingSchema;if(d(f))throw new Error("Schema "+f+" is loaded but "+u.missingRef+" cannot be resolved");var h=s._loadingSchemas[f];return h||(h=s._loadingSchemas[f]=s._opts.loadSchema(f),h.then(_,_)),h.then(function(y){if(!d(f))return n(y).then(function(){d(f)||s.addSchema(y,f,void 0,e)})}).then(function(){return i(o)});function _(){delete s._loadingSchemas[f]}function d(y){return s._refs[y]||s._schemas[y]}}}}});var il=Q((pg,nl)=>{"use strict";nl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h,_="data"+(i||""),d="valid"+n,y="errs__"+n,b=e.opts.$data&&o&&o.$data,v;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=o;var S=this,A="definition"+n,x=S.definition,T="",O,C,W,z,$;if(b&&x.$data){$="keywordValidate"+n;var U=x.validateSchema;r+=" var "+A+" = RULES.custom['"+t+"'].definition; var "+$+" = "+A+".validate;"}else{if(z=e.useCustomRule(S,o,e.schema,e),!z)return;v="validate.schema"+c,$=z.code,O=x.compile,C=x.inline,W=x.macro}var F=$+".errors",q="i"+n,I="ruleErr"+n,D=x.async;if(D&&!e.async)throw new Error("async keyword in sync schema");if(C||W||(r+=""+F+" = null;"),r+="var "+y+" = errors;var "+d+";",b&&x.$data&&(T+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(T+="}",r+=" "+d+" = "+A+".validateSchema("+v+"); if ("+d+") { ")),C)x.statements?r+=" "+z.validate+" ":r+=" "+d+" = "+z.validate+"; ";else if(W){var M=e.util.copy(e),T="";M.level++;var ue="valid"+M.level;M.schema=z.validate,M.schemaPath="";var Y=e.compositeRule;e.compositeRule=M.compositeRule=!0;var te=e.validate(M).replace(/validate\.schema/g,$);e.compositeRule=M.compositeRule=Y,r+=" "+te}else{var X=X||[];X.push(r),r="",r+=" "+$+".call( ",e.opts.passContext?r+="this":r+="self",O||x.schema===!1?r+=" , "+_+" ":r+=" , "+v+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=i?"data"+(i-1||""):"parentData",be=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+H+" , "+be+" , rootData ) ";var Ae=r;r=X.pop(),x.errors===!1?(r+=" "+d+" = ",D&&(r+="await "),r+=""+Ae+"; "):D?(F="customErrors"+n,r+=" var "+F+" = null; try { "+d+" = await "+Ae+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+F+" = e.errors; else throw e; } "):r+=" "+F+" = null; "+d+" = "+Ae+"; "}if(x.modifying&&(r+=" if ("+H+") "+_+" = "+H+"["+be+"];"),r+=""+T,x.valid)f&&(r+=" if (true) { ");else{r+=" if ( ",x.valid===void 0?(r+=" !",W?r+=""+ue:r+=""+d):r+=" "+!x.valid+" ",r+=") { ",h=S.keyword;var X=X||[];X.push(r),r="";var X=X||[];X.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var $e=r;r=X.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$e+"]); ":r+=" validate.errors = ["+$e+"]; return false; ":r+=" var err = "+$e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ne=r;r=X.pop(),C?x.errors?x.errors!="full"&&(r+=" for (var "+q+"="+y+"; "+q+"<errors; "+q+"++) { var "+I+" = vErrors["+q+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(r+=" "+I+".schema = "+v+"; "+I+".data = "+_+"; "),r+=" } "):x.errors===!1?r+=" "+ne+" ":(r+=" if ("+y+" == errors) { "+ne+" } else { for (var "+q+"="+y+"; "+q+"<errors; "+q+"++) { var "+I+" = vErrors["+q+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(r+=" "+I+".schema = "+v+"; "+I+".data = "+_+"; "),r+=" } } "):W?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):x.errors===!1?r+=" "+ne+" ":(r+=" if (Array.isArray("+F+")) { if (vErrors === null) vErrors = "+F+"; else vErrors = vErrors.concat("+F+"); errors = vErrors.length; for (var "+q+"="+y+"; "+q+"<errors; "+q+"++) { var "+I+" = vErrors["+q+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; "+I+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(r+=" "+I+".schema = "+v+"; "+I+".data = "+_+"; "),r+=" } } else { "+ne+" } "),r+=" } ",f&&(r+=" else { ")}return r}});var fn=Q((fg,Bp)=>{Bp.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var cl=Q((hg,ll)=>{"use strict";var ol=fn();ll.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:ol.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:ol.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var dl=Q((mg,ul)=>{"use strict";var Qp=/^[a-z_$][a-z0-9_$-]*$/i,Gp=il(),Jp=cl();ul.exports={add:Kp,get:Xp,remove:Yp,validate:hn};function Kp(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Qp.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)i(a,s[r],e);else i(a,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[a]=t.all[a]=!0;function i(o,c,u){for(var f,h=0;h<t.length;h++){var _=t[h];if(_.type==c){f=_;break}}f||(f={type:c,rules:[]},t.push(f));var d={keyword:o,definition:u,custom:!0,code:Gp,implements:u.implements};f.rules.push(d),t.custom[o]=d}return this}function Xp(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Yp(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function hn(a,e){hn.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Jp,!0);if(t(a))return!0;if(hn.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var pl=Q((gg,ef)=>{ef.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Pl=Q((vg,wl)=>{"use strict";var hl=Wi(),dt=Va(),rf=Zi(),ml=Xs(),tf=sn(),af=so(),sf=Xo(),gl=rl(),vl=ut();wl.exports=Pe;Pe.prototype.validate=of;Pe.prototype.compile=lf;Pe.prototype.addSchema=cf;Pe.prototype.addMetaSchema=uf;Pe.prototype.validateSchema=df;Pe.prototype.getSchema=ff;Pe.prototype.removeSchema=mf;Pe.prototype.addFormat=Sf;Pe.prototype.errorsText=Pf;Pe.prototype._addSchema=gf;Pe.prototype._compile=vf;Pe.prototype.compileAsync=sl();var Xa=dl();Pe.prototype.addKeyword=Xa.add;Pe.prototype.getKeyword=Xa.get;Pe.prototype.removeKeyword=Xa.remove;Pe.prototype.validateKeyword=Xa.validate;var yl=Wa();Pe.ValidationError=yl.Validation;Pe.MissingRefError=yl.MissingRef;Pe.$dataMetaSchema=gl;var Ka="http://json-schema.org/draft-07/schema",fl=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],nf=["/properties"];function Pe(a){if(!(this instanceof Pe))return new Pe(a);a=this._opts=vl.copy(a)||{},If(this),this._schemas={},this._refs={},this._fragments={},this._formats=af(a.format),this._cache=a.cache||new rf,this._loadingSchemas={},this._compilations=[],this.RULES=sf(),this._getId=yf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=tf),this._metaOpts=kf(this),a.formats&&Rf(this),a.keywords&&Tf(this),xf(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Ef(this)}function of(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function lf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function cf(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=dt.normalizeId(e||n),bl(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function uf(a,e,t){return this.addSchema(a,e,t,!0),this}function df(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||pf(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function pf(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(Ka)?Ka:void 0,a._opts.defaultMeta}function ff(a){var e=_l(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return hf(this,a)}}function hf(a,e){var t=dt.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,i=hl.call(a,s,r,void 0,n);return a._fragments[e]=new ml({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function _l(a,e){return e=dt.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function mf(a){if(a instanceof RegExp)return Ja(this,this._schemas,a),Ja(this,this._refs,a),this;switch(typeof a){case"undefined":return Ja(this,this._schemas),Ja(this,this._refs),this._cache.clear(),this;case"string":var e=_l(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=dt.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Ja(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function gf(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,i=this._cache.get(n);if(i)return i;s=s||this._opts.addUsedSchema!==!1;var o=dt.normalizeId(this._getId(a));o&&s&&bl(this,o);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=o&&o==dt.normalizeId(a.$schema))&&this.validateSchema(a,!0);var f=dt.ids.call(this,a),h=new ml({id:o,schema:a,localRefs:f,cacheKey:n,meta:t});return o[0]!="#"&&s&&(this._refs[o]=h),this._cache.put(n,h),c&&u&&this.validateSchema(a,!0),h}function vf(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=hl.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,i=n.apply(this,arguments);return r.errors=n.errors,i}}function yf(a){switch(a.schemaId){case"auto":return wf;case"id":return _f;default:return bf}}function _f(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function bf(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function wf(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function Pf(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var i=a[n];i&&(r+=s+i.dataPath+" "+i.message+t)}return r.slice(0,-t.length)}function Sf(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function xf(a){var e;if(a._opts.$data&&(e=pl(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=fn();a._opts.$data&&(t=gl(t,nf)),a.addMetaSchema(t,Ka,!0),a._refs["http://json-schema.org/schema"]=Ka}}function Ef(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function Rf(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function Tf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function bl(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function kf(a){for(var e=vl.copy(a._opts),t=0;t<fl.length;t++)delete e[fl[t]];return e}function If(a){var e=a._opts.logger;if(e===!1)a.logger={log:mn,warn:mn,error:mn};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function mn(){}});Sr();var l={};Nn(l,{BRAND:()=>Su,DIRTY:()=>Qr,EMPTY_PATH:()=>ru,INVALID:()=>Z,NEVER:()=>od,OK:()=>Ce,ParseStatus:()=>Ie,Schema:()=>J,ZodAny:()=>Dr,ZodArray:()=>Tr,ZodBigInt:()=>Jr,ZodBoolean:()=>Kr,ZodBranded:()=>Qt,ZodCatch:()=>lt,ZodDate:()=>Xr,ZodDefault:()=>ot,ZodDiscriminatedUnion:()=>ma,ZodEffects:()=>Xe,ZodEnum:()=>nt,ZodError:()=>qe,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>va,ZodIntersection:()=>tt,ZodIssueCode:()=>R,ZodLazy:()=>at,ZodLiteral:()=>st,ZodMap:()=>kt,ZodNaN:()=>At,ZodNativeEnum:()=>it,ZodNever:()=>tr,ZodNull:()=>et,ZodNullable:()=>dr,ZodNumber:()=>Gr,ZodObject:()=>Me,ZodOptional:()=>Je,ZodParsedType:()=>N,ZodPipeline:()=>Gt,ZodPromise:()=>jr,ZodReadonly:()=>ct,ZodRecord:()=>ga,ZodSchema:()=>J,ZodSet:()=>It,ZodString:()=>$r,ZodSymbol:()=>Rt,ZodTransformer:()=>Xe,ZodTuple:()=>ur,ZodType:()=>J,ZodUndefined:()=>Yr,ZodUnion:()=>rt,ZodUnknown:()=>Rr,ZodVoid:()=>Tt,addIssueToContext:()=>j,any:()=>Cu,array:()=>Nu,bigint:()=>Tu,boolean:()=>ri,coerce:()=>id,custom:()=>Xn,date:()=>ku,datetimeRegex:()=>Jn,defaultErrorMap:()=>xr,discriminatedUnion:()=>Fu,effect:()=>Xu,enum:()=>Gu,function:()=>Zu,getErrorMap:()=>St,getParsedType:()=>cr,instanceof:()=>Eu,intersection:()=>zu,isAborted:()=>fa,isAsync:()=>xt,isDirty:()=>ha,isValid:()=>Cr,late:()=>xu,lazy:()=>Bu,literal:()=>Qu,makeIssue:()=>Bt,map:()=>Wu,nan:()=>Ru,nativeEnum:()=>Ju,never:()=>Du,null:()=>Ou,nullable:()=>ed,number:()=>ei,object:()=>Lu,objectUtil:()=>As,oboolean:()=>nd,onumber:()=>sd,optional:()=>Yu,ostring:()=>ad,pipeline:()=>td,preprocess:()=>rd,promise:()=>Ku,quotelessJson:()=>Xc,record:()=>Vu,set:()=>Hu,setErrorMap:()=>eu,strictObject:()=>qu,string:()=>Yn,symbol:()=>Iu,transformer:()=>Xu,tuple:()=>Uu,undefined:()=>Au,union:()=>Mu,unknown:()=>$u,util:()=>ee,void:()=>ju});var ee;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(let o of n)i[o]=r[o];return a.objectValues(i)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(ee||(ee={}));var As;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(As||(As={}));var N=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),cr=a=>{switch(typeof a){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(a)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(a)?N.array:a===null?N.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?N.promise:typeof Map<"u"&&a instanceof Map?N.map:typeof Set<"u"&&a instanceof Set?N.set:typeof Date<"u"&&a instanceof Date?N.date:N.object;default:return N.unknown}};var R=ee.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"]),Xc=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),qe=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};qe.create=a=>new qe(a);var Yc=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===N.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,ee.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${ee.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ee.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${ee.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:ee.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,ee.assertNever(a)}return{message:t}},xr=Yc;var Hn=xr;function eu(a){Hn=a}function St(){return Hn}var Bt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",c=s.filter(u=>!!u).slice().reverse();for(let u of c)o=u(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},ru=[];function j(a,e){let t=St(),s=Bt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===xr?void 0:xr].filter(r=>!!r)});a.common.issues.push(s)}var Ie=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return Z;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return Z;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},Z=Object.freeze({status:"aborted"}),Qr=a=>({status:"dirty",value:a}),Ce=a=>({status:"valid",value:a}),fa=a=>a.status==="aborted",ha=a=>a.status==="dirty",Cr=a=>a.status==="valid",xt=a=>typeof Promise<"u"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Ke=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}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}},Zn=(a,e)=>{if(Cr(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new qe(a.common.issues);return this._error=t,this._error}}};function G(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{let{message:c}=a;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:r}}var J=class{get description(){return this._def.description}_getType(e){return cr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ie,ctx:{common:e.parent.common,data:e.data,parsedType:cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(xt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Zn(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cr(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return Cr(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Cr(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(xt(r)?r:Promise.resolve(r));return Zn(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let i=e(r),o=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Xe({schema:this,typeName:k.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:t=>this["~validate"](t)}}optional(){return Je.create(this,this._def)}nullable(){return dr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Tr.create(this)}promise(){return jr.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return tt.create(this,e,this._def)}transform(e){return new Xe({...G(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ot({...G(this._def),innerType:this,defaultValue:t,typeName:k.ZodDefault})}brand(){return new Qt({typeName:k.ZodBranded,type:this,...G(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new lt({...G(this._def),innerType:this,catchValue:t,typeName:k.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Gt.create(this,e)}readonly(){return ct.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},tu=/^c[^\s-]{8,}$/i,au=/^[0-9a-z]+$/,su=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nu=/^[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,iu=/^[a-z0-9_-]{21}$/i,ou=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lu=/^[-+]?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)?)??$/,cu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Os,du=/^(?:(?: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])$/,pu=/^(?:(?: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])$/,fu=/^(([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]))$/,hu=/^(([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])$/,mu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qn="((\\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])))",vu=new RegExp(`^${Qn}$`);function Gn(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function yu(a){return new RegExp(`^${Gn(a)}$`)}function Jn(a){let e=`${Qn}T${Gn(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function _u(a,e){return!!((e==="v4"||!e)&&du.test(a)||(e==="v6"||!e)&&fu.test(a))}function bu(a,e){if(!ou.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function wu(a,e){return!!((e==="v4"||!e)&&pu.test(a)||(e==="v6"||!e)&&hu.test(a))}var $r=class a extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.string){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_type,expected:N.string,received:n.parsedType}),Z}let s=new Ie,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?j(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&j(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")cu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Os||(Os=new RegExp(uu,"u")),Os.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")nu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")iu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")tu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")au.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")su.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),j(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"regex",code:R.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Jn(n).test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?vu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?yu(n).test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?lu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?_u(e.data,n.version)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?bu(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?wu(e.data,n.version)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?mu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?gu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):ee.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.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,...V.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,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...V.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};$r.create=a=>new $r({checks:[],typeName:k.ZodString,coerce:a?.coerce??!1,...G(a)});function Pu(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Gr=class a extends J{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)!==N.number){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_type,expected:N.number,received:n.parsedType}),Z}let s,r=new Ie;for(let n of this._def.checks)n.kind==="int"?ee.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Pu(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:R.not_finite,message:n.message}),r.dirty()):ee.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ee.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Gr.create=a=>new Gr({checks:[],typeName:k.ZodNumber,coerce:a?.coerce||!1,...G(a)});var Jr=class a extends J{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)!==N.bigint)return this._getInvalidInput(e);let s,r=new Ie;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ee.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:R.invalid_type,expected:N.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Jr.create=a=>new Jr({checks:[],typeName:k.ZodBigInt,coerce:a?.coerce??!1,...G(a)});var Kr=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.boolean){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.boolean,received:s.parsedType}),Z}return Ce(e.data)}};Kr.create=a=>new Kr({typeName:k.ZodBoolean,coerce:a?.coerce||!1,...G(a)});var Xr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.date){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_type,expected:N.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_date}),Z}let s=new Ie,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):ee.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Xr.create=a=>new Xr({checks:[],coerce:a?.coerce||!1,typeName:k.ZodDate,...G(a)});var Rt=class extends J{_parse(e){if(this._getType(e)!==N.symbol){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.symbol,received:s.parsedType}),Z}return Ce(e.data)}};Rt.create=a=>new Rt({typeName:k.ZodSymbol,...G(a)});var Yr=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.undefined,received:s.parsedType}),Z}return Ce(e.data)}};Yr.create=a=>new Yr({typeName:k.ZodUndefined,...G(a)});var et=class extends J{_parse(e){if(this._getType(e)!==N.null){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.null,received:s.parsedType}),Z}return Ce(e.data)}};et.create=a=>new et({typeName:k.ZodNull,...G(a)});var Dr=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Ce(e.data)}};Dr.create=a=>new Dr({typeName:k.ZodAny,...G(a)});var Rr=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ce(e.data)}};Rr.create=a=>new Rr({typeName:k.ZodUnknown,...G(a)});var tr=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:R.invalid_type,expected:N.never,received:t.parsedType}),Z}};tr.create=a=>new tr({typeName:k.ZodNever,...G(a)});var Tt=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.void,received:s.parsedType}),Z}return Ce(e.data)}};Tt.create=a=>new Tt({typeName:k.ZodVoid,...G(a)});var Tr=class a extends J{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==N.array)return j(t,{code:R.invalid_type,expected:N.array,received:t.parsedType}),Z;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(j(t,{code:i?R.too_big:R.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(j(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(j(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new Ke(t,i,t.path,o)))).then(i=>Ie.mergeArray(s,i));let n=[...t.data].map((i,o)=>r.type._parseSync(new Ke(t,i,t.path,o)));return Ie.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};Tr.create=(a,e)=>new Tr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...G(e)});function Et(a){if(a instanceof Me){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Je.create(Et(s))}return new Me({...a._def,shape:()=>e})}else return a instanceof Tr?new Tr({...a._def,type:Et(a.element)}):a instanceof Je?Je.create(Et(a.unwrap())):a instanceof dr?dr.create(Et(a.unwrap())):a instanceof ur?ur.create(a.items.map(e=>Et(e))):a}var Me=class a extends J{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(),t=ee.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let u=this._getOrReturnCtx(e);return j(u,{code:R.invalid_type,expected:N.object,received:u.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof tr&&this._def.unknownKeys==="strip"))for(let u in r.data)i.includes(u)||o.push(u);let c=[];for(let u of i){let f=n[u],h=r.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new Ke(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof tr){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(u==="strict")o.length>0&&(j(r,{code:R.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of o){let h=r.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new Ke(r,h,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of c){let h=await f.key,_=await f.value;u.push({key:h,value:_,alwaysSet:f.alwaysSet})}return u}).then(u=>Ie.mergeObjectSync(s,u)):Ie.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:V.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of ee.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of ee.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return Et(this)}partial(e){let t={};for(let s of ee.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of ee.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Je;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Kn(ee.objectKeys(this.shape))}};Me.create=(a,e)=>new Me({shape:()=>a,unknownKeys:"strip",catchall:tr.create(),typeName:k.ZodObject,...G(e)});Me.strictCreate=(a,e)=>new Me({shape:()=>a,unknownKeys:"strict",catchall:tr.create(),typeName:k.ZodObject,...G(e)});Me.lazycreate=(a,e)=>new Me({shape:a,unknownKeys:"strip",catchall:tr.create(),typeName:k.ZodObject,...G(e)});var rt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=n.map(o=>new qe(o.ctx.common.issues));return j(t,{code:R.invalid_union,unionErrors:i}),Z}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let c of s){let u={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!n&&(n={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=i.map(c=>new qe(c));return j(t,{code:R.invalid_union,unionErrors:o}),Z}}get options(){return this._def.options}};rt.create=(a,e)=>new rt({options:a,typeName:k.ZodUnion,...G(e)});var Er=a=>a instanceof at?Er(a.schema):a instanceof Xe?Er(a.innerType()):a instanceof st?[a.value]:a instanceof nt?a.options:a instanceof it?ee.objectValues(a.enum):a instanceof ot?Er(a._def.innerType):a instanceof Yr?[void 0]:a instanceof et?[null]:a instanceof Je?[void 0,...Er(a.unwrap())]:a instanceof dr?[null,...Er(a.unwrap())]:a instanceof Qt||a instanceof ct?Er(a.unwrap()):a instanceof lt?Er(a._def.innerType):[],ma=class a extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return j(t,{code:R.invalid_type,expected:N.object,received:t.parsedType}),Z;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(j(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=Er(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...G(s)})}};function Cs(a,e){let t=cr(a),s=cr(e);if(a===e)return{valid:!0,data:a};if(t===N.object&&s===N.object){let r=ee.objectKeys(e),n=ee.objectKeys(a).filter(o=>r.indexOf(o)!==-1),i={...a,...e};for(let o of n){let c=Cs(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===N.array&&s===N.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let i=a[n],o=e[n],c=Cs(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===N.date&&s===N.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var tt=class extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,i)=>{if(fa(n)||fa(i))return Z;let o=Cs(n.value,i.value);return o.valid?((ha(n)||ha(i))&&t.dirty(),{status:t.value,value:o.data}):(j(s,{code:R.invalid_intersection_types}),Z)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};tt.create=(a,e,t)=>new tt({left:a,right:e,typeName:k.ZodIntersection,...G(t)});var ur=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.array)return j(s,{code:R.invalid_type,expected:N.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return j(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&s.data.length>this._def.items.length&&(j(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Ke(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Ie.mergeArray(t,i)):Ie.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};ur.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ur({items:a,typeName:k.ZodTuple,rest:null,...G(e)})};var ga=class a extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.object)return j(s,{code:R.invalid_type,expected:N.object,received:s.parsedType}),Z;let r=[],n=this._def.keyType,i=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new Ke(s,o,s.path,o)),value:i._parse(new Ke(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Ie.mergeObjectAsync(t,r):Ie.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof J?new a({keyType:e,valueType:t,typeName:k.ZodRecord,...G(s)}):new a({keyType:$r.create(),valueType:e,typeName:k.ZodRecord,...G(t)})}},kt=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.map)return j(s,{code:R.invalid_type,expected:N.map,received:s.parsedType}),Z;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new Ke(s,o,s.path,[u,"key"])),value:n._parse(new Ke(s,c,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return Z;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of i){let u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return Z;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}}}};kt.create=(a,e,t)=>new kt({valueType:e,keyType:a,typeName:k.ZodMap,...G(t)});var It=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.set)return j(s,{code:R.invalid_type,expected:N.set,received:s.parsedType}),Z;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(j(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(j(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(c){let u=new Set;for(let f of c){if(f.status==="aborted")return Z;f.status==="dirty"&&t.dirty(),u.add(f.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((c,u)=>n._parse(new Ke(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};It.create=(a,e)=>new It({valueType:a,minSize:null,maxSize:null,typeName:k.ZodSet,...G(e)});var va=class a extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return j(t,{code:R.invalid_type,expected:N.function,received:t.parsedType}),Z;function s(o,c){return Bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),xr].filter(u=>!!u),issueData:{code:R.invalid_arguments,argumentsError:c}})}function r(o,c){return Bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),xr].filter(u=>!!u),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof jr){let o=this;return Ce(async function(...c){let u=new qe([]),f=await o._def.args.parseAsync(c,n).catch(d=>{throw u.addIssue(s(c,d)),u}),h=await Reflect.apply(i,this,f);return await o._def.returns._def.type.parseAsync(h,n).catch(d=>{throw u.addIssue(r(h,d)),u})})}else{let o=this;return Ce(function(...c){let u=o._def.args.safeParse(c,n);if(!u.success)throw new qe([s(c,u.error)]);let f=Reflect.apply(i,this,u.data),h=o._def.returns.safeParse(f,n);if(!h.success)throw new qe([r(f,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:ur.create(e).rest(Rr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||ur.create([]).rest(Rr.create()),returns:t||Rr.create(),typeName:k.ZodFunction,...G(s)})}},at=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};at.create=(a,e)=>new at({getter:a,typeName:k.ZodLazy,...G(e)});var st=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};st.create=(a,e)=>new st({value:a,typeName:k.ZodLiteral,...G(e)});function Kn(a,e){return new nt({values:a,typeName:k.ZodEnum,...G(e)})}var nt=class a extends J{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{expected:ee.joinValues(s),received:t.parsedType,code:R.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{received:t.data,code:R.invalid_enum_value,options:s}),Z}return Ce(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};nt.create=Kn;var it=class extends J{_parse(e){let t=ee.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==N.string&&s.parsedType!==N.number){let r=ee.objectValues(t);return j(s,{expected:ee.joinValues(r),received:s.parsedType,code:R.invalid_type}),Z}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=ee.objectValues(t);return j(s,{received:s.data,code:R.invalid_enum_value,options:r}),Z}return Ce(e.data)}get enum(){return this._def.values}};it.create=(a,e)=>new it({values:a,typeName:k.ZodNativeEnum,...G(e)});var jr=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return j(t,{code:R.invalid_type,expected:N.promise,received:t.parsedType}),Z;let s=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Ce(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};jr.create=(a,e)=>new jr({type:a,typeName:k.ZodPromise,...G(e)});var Xe=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{j(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return Z;let c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?Z:c.status==="dirty"?Qr(c.value):t.value==="dirty"?Qr(c.value):c});{if(t.value==="aborted")return Z;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?Z:o.status==="dirty"?Qr(o.value):t.value==="dirty"?Qr(o.value):o}}if(r.type==="refinement"){let i=o=>{let c=r.refinement(o,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Z:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?Z:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Cr(i))return Z;let o=r.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Cr(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:t.value,value:o})):Z);ee.assertNever(r)}};Xe.create=(a,e,t)=>new Xe({schema:a,typeName:k.ZodEffects,effect:e,...G(t)});Xe.createWithPreprocess=(a,e,t)=>new Xe({schema:e,effect:{type:"preprocess",transform:a},typeName:k.ZodEffects,...G(t)});var Je=class extends J{_parse(e){return this._getType(e)===N.undefined?Ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Je.create=(a,e)=>new Je({innerType:a,typeName:k.ZodOptional,...G(e)});var dr=class extends J{_parse(e){return this._getType(e)===N.null?Ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dr.create=(a,e)=>new dr({innerType:a,typeName:k.ZodNullable,...G(e)});var ot=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===N.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ot.create=(a,e)=>new ot({innerType:a,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var lt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return xt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new qe(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new qe(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};lt.create=(a,e)=>new lt({innerType:a,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var At=class extends J{_parse(e){if(this._getType(e)!==N.nan){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};At.create=a=>new At({typeName:k.ZodNaN,...G(a)});var Su=Symbol("zod_brand"),Qt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Gt=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?Z:n.status==="dirty"?(t.dirty(),Qr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?Z:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:k.ZodPipeline})}},ct=class extends J{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Cr(r)&&(r.value=Object.freeze(r.value)),r);return xt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};ct.create=(a,e)=>new ct({innerType:a,typeName:k.ZodReadonly,...G(e)});function Bn(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Xn(a,e={},t){return a?Dr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(i=>{if(!i){let o=Bn(e,s),c=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:c})}});if(!n){let i=Bn(e,s),o=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:o})}}):Dr.create()}var xu={object:Me.lazycreate},k;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(k||(k={}));var Eu=(a,e={message:`Input not instance of ${a.name}`})=>Xn(t=>t instanceof a,e),Yn=$r.create,ei=Gr.create,Ru=At.create,Tu=Jr.create,ri=Kr.create,ku=Xr.create,Iu=Rt.create,Au=Yr.create,Ou=et.create,Cu=Dr.create,$u=Rr.create,Du=tr.create,ju=Tt.create,Nu=Tr.create,Lu=Me.create,qu=Me.strictCreate,Mu=rt.create,Fu=ma.create,zu=tt.create,Uu=ur.create,Vu=ga.create,Wu=kt.create,Hu=It.create,Zu=va.create,Bu=at.create,Qu=st.create,Gu=nt.create,Ju=it.create,Ku=jr.create,Xu=Xe.create,Yu=Je.create,ed=dr.create,rd=Xe.createWithPreprocess,td=Gt.create,ad=()=>Yn().optional(),sd=()=>ei().optional(),nd=()=>ri().optional(),id={string:a=>$r.create({...a,coerce:!0}),number:a=>Gr.create({...a,coerce:!0}),boolean:a=>Kr.create({...a,coerce:!0}),bigint:a=>Jr.create({...a,coerce:!0}),date:a=>Xr.create({...a,coerce:!0})};var od=Z;var $s="2025-06-18";var ti=[$s,"2025-03-26","2024-11-05","2024-10-07"],ya="2.0",ai=l.union([l.string(),l.number().int()]),si=l.string(),ld=l.object({progressToken:l.optional(ai)}).passthrough(),Ye=l.object({_meta:l.optional(ld)}).passthrough(),Fe=l.object({method:l.string(),params:l.optional(Ye)}),Jt=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),pr=l.object({method:l.string(),params:l.optional(Jt)}),er=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),_a=l.union([l.string(),l.number().int()]),ni=l.object({jsonrpc:l.literal(ya),id:_a}).merge(Fe).strict(),ii=a=>ni.safeParse(a).success,oi=l.object({jsonrpc:l.literal(ya)}).merge(pr).strict(),li=a=>oi.safeParse(a).success,ci=l.object({jsonrpc:l.literal(ya),id:_a,result:er}).strict(),Ds=a=>ci.safeParse(a).success,he;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(he||(he={}));var ui=l.object({jsonrpc:l.literal(ya),id:_a,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),di=a=>ui.safeParse(a).success,pi=l.union([ni,oi,ci,ui]),ba=er.strict(),wa=pr.extend({method:l.literal("notifications/cancelled"),params:Jt.extend({requestId:_a,reason:l.string().optional()})}),Kt=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),fi=Kt.extend({version:l.string()}),cd=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),js=Fe.extend({method:l.literal("initialize"),params:Ye.extend({protocolVersion:l.string(),capabilities:cd,clientInfo:fi})});var ud=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),dd=er.extend({protocolVersion:l.string(),capabilities:ud,serverInfo:fi,instructions:l.optional(l.string())}),Ns=pr.extend({method:l.literal("notifications/initialized")});var Pa=Fe.extend({method:l.literal("ping")}),pd=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),Sa=pr.extend({method:l.literal("notifications/progress"),params:Jt.merge(pd).extend({progressToken:ai})}),xa=Fe.extend({params:Ye.extend({cursor:l.optional(si)}).optional()}),Ea=er.extend({nextCursor:l.optional(si)}),hi=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),mi=hi.extend({text:l.string()}),Ls=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),gi=hi.extend({blob:Ls}),vi=Kt.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),fd=Kt.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),Ra=xa.extend({method:l.literal("resources/list")}),hd=Ea.extend({resources:l.array(vi)}),Ta=xa.extend({method:l.literal("resources/templates/list")}),md=Ea.extend({resourceTemplates:l.array(fd)}),ka=Fe.extend({method:l.literal("resources/read"),params:Ye.extend({uri:l.string()})}),gd=er.extend({contents:l.array(l.union([mi,gi]))}),vd=pr.extend({method:l.literal("notifications/resources/list_changed")}),yd=Fe.extend({method:l.literal("resources/subscribe"),params:Ye.extend({uri:l.string()})}),_d=Fe.extend({method:l.literal("resources/unsubscribe"),params:Ye.extend({uri:l.string()})}),bd=pr.extend({method:l.literal("notifications/resources/updated"),params:Jt.extend({uri:l.string()})}),wd=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),Pd=Kt.extend({description:l.optional(l.string()),arguments:l.optional(l.array(wd)),_meta:l.optional(l.object({}).passthrough())}),Ia=xa.extend({method:l.literal("prompts/list")}),Sd=Ea.extend({prompts:l.array(Pd)}),Aa=Fe.extend({method:l.literal("prompts/get"),params:Ye.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),qs=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ms=l.object({type:l.literal("image"),data:Ls,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Fs=l.object({type:l.literal("audio"),data:Ls,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),xd=l.object({type:l.literal("resource"),resource:l.union([mi,gi]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ed=vi.extend({type:l.literal("resource_link")}),yi=l.union([qs,Ms,Fs,Ed,xd]),Rd=l.object({role:l.enum(["user","assistant"]),content:yi}).passthrough(),Td=er.extend({description:l.optional(l.string()),messages:l.array(Rd)}),kd=pr.extend({method:l.literal("notifications/prompts/list_changed")}),Id=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),Ad=Kt.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(Id),_meta:l.optional(l.object({}).passthrough())}),Oa=xa.extend({method:l.literal("tools/list")}),Od=Ea.extend({tools:l.array(Ad)}),_i=er.extend({content:l.array(yi).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),vm=_i.or(er.extend({toolResult:l.unknown()})),Ca=Fe.extend({method:l.literal("tools/call"),params:Ye.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),Cd=pr.extend({method:l.literal("notifications/tools/list_changed")}),Xt=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),zs=Fe.extend({method:l.literal("logging/setLevel"),params:Ye.extend({level:Xt})}),$d=pr.extend({method:l.literal("notifications/message"),params:Jt.extend({level:Xt,logger:l.optional(l.string()),data:l.unknown()})}),Dd=l.object({name:l.string().optional()}).passthrough(),jd=l.object({hints:l.optional(l.array(Dd)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),Nd=l.object({role:l.enum(["user","assistant"]),content:l.union([qs,Ms,Fs])}).passthrough(),Ld=Fe.extend({method:l.literal("sampling/createMessage"),params:Ye.extend({messages:l.array(Nd),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(jd)})}),Us=er.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[qs,Ms,Fs])}),qd=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Md=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Fd=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),zd=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),Ud=l.union([qd,Md,Fd,zd]),Vd=Fe.extend({method:l.literal("elicitation/create"),params:Ye.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),Ud),required:l.optional(l.array(l.string()))}).passthrough()})}),Vs=er.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),Wd=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Hd=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),$a=Fe.extend({method:l.literal("completion/complete"),params:Ye.extend({ref:l.union([Hd,Wd]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Zd=er.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Bd=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Qd=Fe.extend({method:l.literal("roots/list")}),Ws=er.extend({roots:l.array(Bd)}),Gd=pr.extend({method:l.literal("notifications/roots/list_changed")}),ym=l.union([Pa,js,$a,zs,Aa,Ia,Ra,Ta,ka,yd,_d,Ca,Oa]),_m=l.union([wa,Sa,Ns,Gd]),bm=l.union([ba,Us,Vs,Ws]),wm=l.union([Pa,Ld,Vd,Qd]),Pm=l.union([wa,Sa,$d,bd,vd,Cd,kd]),Sm=l.union([ba,dd,Zd,Td,Sd,hd,md,gd,_i,Od]),me=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Jd=6e4,Da=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(wa,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Sa,t=>{this._onprogress(t)}),this.setRequestHandler(Pa,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new me(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),Ds(c)||di(c)?this._onresponse(c):ii(c)?this._onrequest(c,u):li(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=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 s=new me(he.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:he.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let c={signal:o.signal,sessionId:i?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,f,h)=>this.request(u,f,{...h,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,c)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var f;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:he.InternalError,message:(f=u.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Ds(e))s(e);else{let r=new me(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}=s??{};return new Promise((o,c)=>{var u,f,h,_,d,y;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(f=s?.signal)===null||f===void 0||f.throwIfAborted();let b=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:b};s?.onprogress&&(this._progressHandlers.set(b,s.onprogress),v.params={...e.params,_meta:{...((h=e.params)===null||h===void 0?void 0:h._meta)||{},progressToken:b}});let S=T=>{var O;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(O=this._transport)===null||O===void 0||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(T)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`))),c(T)};this._responseHandlers.set(b,T=>{var O;if(!(!((O=s?.signal)===null||O===void 0)&&O.aborted)){if(T instanceof Error)return c(T);try{let C=t.parse(T.result);o(C)}catch(C){c(C)}}}),(_=s?.signal)===null||_===void 0||_.addEventListener("abort",()=>{var T;S((T=s?.signal)===null||T===void 0?void 0:T.reason)});let A=(d=s?.timeout)!==null&&d!==void 0?d:Jd,x=()=>S(new me(he.RequestTimeout,"Request timed out",{timeout:A}));this._setupTimeout(b,A,s?.maxTotalTimeout,x,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(T=>{this._cleanupTimeout(b),c(T)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,t).catch(f=>this._onerror(f))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}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,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function bi(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var Sl=Nc(Pl(),1),Ya=class extends Da{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Xt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(js,r=>this._oninitialize(r)),this.setNotificationHandler(Ns,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(zs,async(r,n)=>{var i;let o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,u=Xt.safeParse(c);return o&&u.success&&this._loggingLevels.set(o,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=bi(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ti.includes(t)?t:$s,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},ba)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Us,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Vs,t);if(s.action==="accept"&&s.content)try{let r=new Sl.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new me(he.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof me?r:new me(he.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ws,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&(!t||!this.isMessageIgnored(e.level,t)))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var El=Symbol("Let zodToJsonSchema decide on which parser to use");var xl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Rl=a=>typeof a=="string"?{...xl,name:a}:{...xl,...a};var Tl=a=>{let e=Rl(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function gn(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function re(a,e,t,s,r){a[e]=t,gn(a,e,s,r)}var es=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function ve(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?es(e,a.currentPath):e.join("/")}}function kl(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==k.ZodAny&&(t.items=B(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&re(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&re(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(re(t,"minItems",a.exactLength.value,a.exactLength.message,e),re(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function Il(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function Al(){return{type:"boolean"}}function rs(a,e){return B(a.type._def,e)}var Ol=(a,e)=>B(a.innerType._def,e);function vn(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>vn(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Af(a,e)}}var Af=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":re(t,"minimum",s.value,s.message,e);break;case"max":re(t,"maximum",s.value,s.message,e);break}return t};function Cl(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function $l(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):ve(e)}function Dl(a){return{type:"string",enum:Array.from(a.values)}}var Of=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function jl(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(Of(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function Nl(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var yn,ar={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(yn===void 0&&(yn=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),yn),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ts(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":re(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":re(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":sr(t,"email",s.message,e);break;case"format:idn-email":sr(t,"idn-email",s.message,e);break;case"pattern:zod":Ne(t,ar.email,s.message,e);break}break;case"url":sr(t,"uri",s.message,e);break;case"uuid":sr(t,"uuid",s.message,e);break;case"regex":Ne(t,s.regex,s.message,e);break;case"cuid":Ne(t,ar.cuid,s.message,e);break;case"cuid2":Ne(t,ar.cuid2,s.message,e);break;case"startsWith":Ne(t,RegExp(`^${_n(s.value,e)}`),s.message,e);break;case"endsWith":Ne(t,RegExp(`${_n(s.value,e)}$`),s.message,e);break;case"datetime":sr(t,"date-time",s.message,e);break;case"date":sr(t,"date",s.message,e);break;case"time":sr(t,"time",s.message,e);break;case"duration":sr(t,"duration",s.message,e);break;case"length":re(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),re(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ne(t,RegExp(_n(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&sr(t,"ipv4",s.message,e),s.version!=="v4"&&sr(t,"ipv6",s.message,e);break}case"base64url":Ne(t,ar.base64url,s.message,e);break;case"jwt":Ne(t,ar.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ne(t,ar.ipv4Cidr,s.message,e),s.version!=="v4"&&Ne(t,ar.ipv6Cidr,s.message,e);break}case"emoji":Ne(t,ar.emoji(),s.message,e);break;case"ulid":{Ne(t,ar.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{sr(t,"binary",s.message,e);break}case"contentEncoding:base64":{re(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ne(t,ar.base64,s.message,e);break}}break}case"nanoid":Ne(t,ar.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function _n(a,e){return e.patternStrategy==="escape"?$f(a):a}var Cf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function $f(a){let e="";for(let t=0;t<a.length;t++)Cf.has(a[t])||(e+="\\"),e+=a[t];return e}function sr(a,e,t,s){a.format||a.anyOf?.some(r=>r.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):re(a,"format",e,t,s)}function Ne(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Ll(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):re(a,"pattern",Ll(e,s),t,s)}function Ll(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,i=!1,o=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(i){if(s[c].match(/[a-z]/)){o?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),o=!1):s[c+1]==="-"&&s[c+2]?.match(/[a-z]/)?(r+=s[c],o=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
10
|
+
Run: npx @coinbase/payments-mcp@latest`,icon:this.getAppIcon(),buttons:["OK","Copy Command"]}).then(n=>{n.response===1&&(qn.writeText("npx @coinbase/payments-mcp@latest"),_t.showMessageBox({type:"info",title:"Command Copied",message:"Update command copied to clipboard!",detail:"Paste it in your terminal to update.",buttons:["OK"]}))}):_t.showMessageBox({type:"info",title:"No Updates Available",message:"You are on the latest version!",detail:`Version ${t}`,icon:this.getAppIcon(),buttons:["OK"]}))}catch(s){E.window.error({message:"Failed to check for updates",error:s instanceof Error?s.message:String(s)}),e||_t.showMessageBox({type:"error",title:"Update Check Failed",message:"Could not check for updates",detail:s instanceof Error?s.message:String(s),icon:this.getAppIcon()})}finally{this.updateCheckInProgress=!1}}createWindow(){let e=this.securityControls.validateWalletUIUrl(this.getWalletUIUrl()),t=Hr.join(bt,"./assets/icon.png");if(this.mainWindow=new bs({show:!1,width:500,height:750,icon:wt.existsSync(t)?t:void 0,webPreferences:{nodeIntegration:!1,contextIsolation:!0,preload:Hr.join(bt,"preload.js"),webSecurity:!0,sandbox:!0}}),this.securityControls.setupSecurityControls(this.mainWindow),!this.mainWindow)throw new Error("Failed to create main window");return this.setupIpcHandlers(e),this.setupMenu(),this.setupTray(),this.mainWindow.webContents.on("did-finish-load",()=>{E.window.debug({message:"Window content loaded successfully"});let s=Ps();this.mainWindow?.webContents.send("mcp-server-version",{version:s}),E.window.debug({message:"Sent MCP server version to webapp",version:s}),this.checkForUpdates(!0),this.windowReadyResolve&&(E.window.info({message:"Window ready - signaling IPC readiness"}),this.windowReadyResolve(),this.windowReadyResolve=null)}),this.mainWindow.webContents.on("did-fail-load",(s,r,n,i)=>{r!==-3&&(E.window.error({message:"Failed to load URL",url:i,errorDescription:n,errorCode:r}),i.includes("fallback.html")||this.loadFallbackPage(i,n))}),this.mainWindow.loadURL(e).catch(s=>{E.window.error({message:"Failed to load wallet UI URL",url:e,error:s instanceof Error?s.message:String(s)}),this.loadFallbackPage(e,s.message)}),this.mainWindow.on("close",s=>{this.tray&&!this.isQuitting&&(s.preventDefault(),this.mainWindow?.hide())}),this.mainWindow.on("closed",()=>{this.mainWindow=null}),this.mainWindow}setupMenu(){if(!this.mainWindow)throw new Error("Main window must be created before setting up menu");let e=[{label:"About Payments MCP",click:()=>{this.showAboutDialog()}}];e.push({type:"separator"},{label:"Quit",accelerator:`${lr}+Q`,click:()=>{this.closeApp()}});let t=ws.buildFromTemplate([{label:Vt.name,submenu:e},{label:"Edit",submenu:[{label:"Undo",accelerator:`${lr}+Z`,role:"undo"},{label:"Redo",accelerator:Wt?"Shift+Command+Z":"Ctrl+Y",role:"redo"},{type:"separator"},{label:"Cut",accelerator:`${lr}+X`,role:"cut"},{label:"Copy",accelerator:`${lr}+C`,role:"copy"},{label:"Paste",accelerator:`${lr}+V`,role:"paste"},{label:"Select All",accelerator:`${lr}+A`,role:"selectAll"}]},{label:"View",submenu:[{label:"Reload",accelerator:`${lr}+R`,click:()=>{this.withFocusedWindow(s=>{s.webContents.reloadIgnoringCache()})}},{label:"Toggle DevTools",accelerator:Wt?"Alt+Command+I":"Ctrl+Shift+I",click:()=>{this.withFocusedWindow(s=>{s.webContents.toggleDevTools()})}}]},{label:"Window",submenu:[{label:"Minimize",accelerator:`${lr}+M`,role:"minimize"},{label:"Close",accelerator:`${lr}+W`,role:"close"},...Wt?[{type:"separator"},{label:"Bring All to Front",role:"front"}]:[]]}]);ws.setApplicationMenu(t)}setupTray(){let e=Hr.join(bt,"./assets/menubar-iconTemplate.png");if(!wt.existsSync(e)){E.window.warning({message:"Could not find tray icon",path:e});return}E.window.debug({message:"Using tray icon",path:e});try{this.tray=new qc(e),this.tray.setToolTip("Payments MCP"),E.window.debug({message:"System tray created successfully"})}catch(s){E.window.error({message:"Failed to create system tray",error:s instanceof Error?s.message:String(s)}),this.tray=null;return}let t=ws.buildFromTemplate([{label:"Show Window",accelerator:`${lr}+W`,click:()=>{this.showWindow(),this.focusApp()}},{label:"About Payments MCP",click:()=>{this.showAboutDialog()}}]);this.tray.on("click",()=>{this.showWindow(),this.focusApp()}),this.tray.on("right-click",()=>{this.tray?.popUpContextMenu(t)})}getMainWindow(){return bs.getAllWindows().find(t=>!t.isDestroyed())||this.mainWindow}closeApp(){E.window.notice({message:"closeApp() called - beginning shutdown sequence"}),Or(),this.isQuitting=!0,this.tray&&(E.window.debug({message:"Destroying system tray"}),this.tray.destroy(),this.tray=null),this.mainWindow&&(E.window.debug({message:"Closing main window"}),this.mainWindow.close()),E.window.notice({message:"Calling app.quit()"}),Vt.quit()}closeUI(){E.window.notice({message:"closeUI() called - closing window and tray"}),Or(),this.isQuitting=!0,this.tray&&(E.window.debug({message:"Destroying system tray"}),this.tray.destroy(),this.tray=null),this.mainWindow&&(E.window.debug({message:"Closing main window"}),this.mainWindow.close(),this.mainWindow=null)}focusApp(){this.mainWindow&&(this.mainWindow.isMinimized()&&this.mainWindow.restore(),this.mainWindow.focus(),this.mainWindow.show())}showWindow(){this.mainWindow?.show()}hasMainWindow(){return this.mainWindow!==null&&!this.mainWindow.isDestroyed()}restoreWindow(){this.mainWindow&&(this.mainWindow.isMinimized()&&this.mainWindow.restore(),this.mainWindow.focus())}setDockVisible(e){Wt&&Vt.dock&&(e?Vt.dock.show():Vt.dock.hide())}hasTray(){return this.tray!==null}getSecurityControls(){return this.securityControls}setupIpcHandlers(e){this.mainWindow&&Mc.on("reload-wallet-url",()=>{E.window.debug({message:"Reload wallet URL requested"}),this.mainWindow&&!this.mainWindow.isDestroyed()&&this.mainWindow.loadURL(e)})}loadFallbackPage(e,t){if(!this.mainWindow)return;let s=Hr.join(bt,"./assets/fallback.html");if(!wt.existsSync(s)){E.window.error({message:"Could not find fallback.html",path:s});return}let r=`file://${s}`;this.mainWindow.loadURL(r),E.window.warning({message:"Loaded fallback page",originalUrl:e,error:t})}}});import fe from"fs";import Br from"path";import{randomUUID as Uc}from"crypto";import{execSync as Vc}from"child_process";async function Ss(a,e){let t=Uc(),s=Br.join(Zr,`${t}.json`),r=Br.join(Ht,`${t}.json`);try{let n={id:t,channel:a,data:e,timestamp:Date.now(),pid:process.pid,processTitle:process.title};E.bridge.debug({message:"Forwarding to primary",pid:process.pid,channel:a,requestId:t}),fe.writeFileSync(s,JSON.stringify(n,null,2),{mode:384}),E.bridge.debug({message:"Request file written",pid:process.pid,requestFile:s});let i=3e4;await new Promise((u,f)=>{let h=setTimeout(()=>{_.close(),f(new Error(`UI bridge timeout: no response after ${i}ms`))},i);if(fe.existsSync(r)){clearTimeout(h),u(void 0);return}let _=fe.watch(Ht,(d,y)=>{y===`${t}.json`&&(clearTimeout(h),_.close(),u(void 0))})}),E.bridge.debug({message:"Response received",pid:process.pid,channel:a});let o=fe.readFileSync(r,"utf8"),c=JSON.parse(o);try{fe.unlinkSync(r)}catch{}if(c.error)throw E.bridge.error({message:"Error in response",pid:process.pid,channel:a,error:c.error}),new Error(c.error);return E.bridge.debug({message:"Successfully forwarded",pid:process.pid,channel:a}),c.result}catch(n){let i=n instanceof Error?n.message:String(n);try{fe.existsSync(r)&&fe.unlinkSync(r)}catch{}throw new Error(`UI bridge error: ${i}`)}}function xs(a){E.bridge.info({message:"Starting window bridge - handling UI requests from other processes",pid:process.pid}),(async()=>{try{let s=fe.readdirSync(Zr).filter(r=>r.endsWith(".json"));for(let r of s)await Fn(r,a)}catch{}})();let t=fe.watch(Zr,async(s,r)=>{s==="rename"&&r&&r.endsWith(".json")&&setTimeout(async()=>{let n=Br.join(Zr,r);fe.existsSync(n)&&await Fn(r,a)},10)});process.once("exit",()=>{t.close()})}async function Fn(a,e){let t=Br.join(Zr,a),s=a.replace(".json",""),r=Br.join(Ht,`${s}.json`);try{if(!fe.existsSync(t))return;let n=fe.readFileSync(t,"utf8"),i=JSON.parse(n);if(!i.pid||!i.processTitle){E.bridge.warning({message:"Rejecting request without process information",pid:process.pid,channel:i.channel}),fe.unlinkSync(t);return}try{process.kill(i.pid,0)}catch{E.bridge.warning({message:"Rejecting request from dead process",pid:process.pid,senderPid:i.pid,channel:i.channel}),fe.unlinkSync(t);return}try{let h=Vc(`ps -p ${i.pid} -o command=`,{encoding:"utf8",stdio:"pipe"});if(!(h.includes("payments-mcp-server")||h.includes("payments-mcp-cli")||h.includes("awal-cli")||h.includes("bundle-electron"))){E.security.warning({message:"Rejecting request from non-payments-mcp process",pid:process.pid,senderPid:i.pid,channel:i.channel}),fe.unlinkSync(t);return}}catch{E.bridge.warning({message:"Could not validate process, rejecting",pid:process.pid,senderPid:i.pid,channel:i.channel}),fe.unlinkSync(t);return}let o=Date.now()-i.timestamp;if(o>6e4){E.bridge.warning({message:"Ignoring stale request",pid:process.pid,age:o,channel:i.channel}),fe.unlinkSync(t);return}E.bridge.debug({message:"Processing UI bridge request",pid:process.pid,channel:i.channel,id:i.id});let c,u=null;try{E.bridge.debug({message:"Calling handler",pid:process.pid,channel:i.channel}),c=await e(i.channel,i.data),E.bridge.debug({message:"Handler completed, writing response",pid:process.pid,channel:i.channel})}catch(h){u=h instanceof Error?h.message:typeof h=="object"&&h!==null?JSON.stringify(h):String(h),E.bridge.error({message:"UI bridge request error",pid:process.pid,channel:i.channel,error:u})}let f={id:i.id,result:u?null:c,error:u||void 0,timestamp:Date.now()};E.bridge.debug({message:"Writing response file",pid:process.pid,responsePath:r}),fe.writeFileSync(r,JSON.stringify(f,null,2),{mode:384}),E.bridge.debug({message:"Response file written",pid:process.pid,channel:i.channel});try{fe.unlinkSync(t)}catch{}}catch(n){E.bridge.error({message:"Error processing UI bridge request",pid:process.pid,error:n instanceof Error?n.message:String(n)});try{let i={id:s,result:null,error:`Request processing error: ${n instanceof Error?n.message:String(n)}`,timestamp:Date.now()};fe.writeFileSync(r,JSON.stringify(i,null,2),{mode:384})}catch(i){E.bridge.error({message:"Failed to write error response",pid:process.pid,error:i instanceof Error?i.message:String(i)})}try{fe.unlinkSync(t)}catch{}}}var ua,Zr,Ht,Es=Ar(()=>{"use strict";br();ua="/tmp/payments-mcp-ui-bridge",Zr=Br.join(ua,"requests"),Ht=Br.join(ua,"responses");try{fe.existsSync(ua)||fe.mkdirSync(ua,{mode:448}),fe.existsSync(Zr)||fe.mkdirSync(Zr,{mode:448}),fe.existsSync(Ht)||fe.mkdirSync(Ht,{mode:448}),E.bridge.debug({message:"WindowBridge directories created with secure permissions"})}catch(a){E.bridge.error({message:"Failed to create WindowBridge IPC directories",error:a instanceof Error?a.message:String(a)})}});import{ipcMain as Wc}from"electron";var da,zn=Ar(()=>{"use strict";Es();br();da=class{constructor(e){this.windowManager=e}getMainWindow(){return this.windowManager.getMainWindow()}async sendToWindow(e,t){let s=this.getMainWindow();return s?(E.operations.debug({message:"Have window, sending directly via IPC",pid:process.pid,channel:e}),s.webContents.send(e,t),new Promise((r,n)=>{let i=`${e}-response`,o=setTimeout(()=>{n(new Error(`${e} request timed out after 30 seconds`))},3e4);Wc.once(i,(c,u)=>{clearTimeout(o);let f=u;if(f&&typeof f=="object"&&"error"in f){let h=f.error,_=typeof h=="string"?h:typeof h=="object"&&h!==null?JSON.stringify(h):String(h);n(new Error(_))}else f&&typeof f=="object"&&"data"in f?r(f.data):r(f)})})):(E.operations.debug({message:"No window, forwarding to primary process",pid:process.pid,channel:e}),Ss(e,t))}get operations(){return{bazaarList:{title:"List bazaar resources",description:"Get list of available bazaar resources that support x402 payments. By default returns summary info; pass full=true for complete details including schemas and payment requirements.",tool:async e=>this.sendToWindow("bazaar-list",e)},bazaarGetResourceDetails:{title:"Get bazaar resource details",description:"Get full details for a specific bazaar resource including complete schemas, payment requirements, HTTP method, URL scheme, and metadata. Call this for bazaar resources (discovered via bazaar_list) to understand the resource API, required parameters, payment costs, and proper request format before making x402 calls.",tool:async e=>this.sendToWindow("bazaar-get-resource-details",e)},makeX402Request:{title:"Make HTTP request with x402 payment",description:"Make an HTTP request to an X402-enabled endpoint, automatically handling any required payments. If payment requirements are not provided: for bazaar resources discovered via bazaar_list use bazaar_get_resource_details() first to get metadata (schemas, method, requirements); for non-bazaar endpoints use x402_discover_payment_requirements() to query the endpoint. If there are any parameters necessary, ask the user to provide them and then include the parameters in the body for POST/PUT/PATCH requests or as queryParams for URL parameters.",tool:async e=>this.sendToWindow("make-x402-request",e)},discoverX402PaymentRequirements:{title:"Discover x402 payment requirements",description:"Query an x402 endpoint directly to discover its payment requirements without making payment. Use this for non-bazaar endpoints or when you need to check payment costs and options dynamically. For bazaar resources (from bazaar_list), prefer bazaar_get_resource_details() which provides richer metadata including performance metrics and reliability ratings.",tool:async e=>this.sendToWindow("discover-x402-requirements",e)},getWalletAddress:{title:"Get wallet address",description:"Get the user's wallet address.",tool:async()=>this.sendToWindow("get-wallet-address")},getWalletBalance:{title:"Get wallet balance",description:"Get asset balances for the user wallet",tool:async e=>this.sendToWindow("get-wallet-balance",e)},checkSessionStatus:{title:"Check session authentication status",description:"Get detailed authentication status and guidance for the LLM",tool:async()=>this.sendToWindow("check-session-status")},showWindow:{title:"Show wallet window",description:"Show and focus the wallet application window",tool:async()=>{if(!this.getMainWindow()){E.operations.debug({message:"No window, forwarding to primary process",pid:process.pid}),await Ss("show-window",void 0);return}E.operations.debug({message:"Have window, showing and focusing directly",pid:process.pid}),this.windowManager.showWindow(),this.windowManager.focusApp()}},signInWithEmail:{title:"Sign in with email",description:"Send OTP verification code to email address",tool:async e=>this.sendToWindow("sign-in-with-email",e)},verifyEmailOTP:{title:"Verify email OTP",description:"Complete authentication with 6-digit OTP code",tool:async e=>this.sendToWindow("verify-email-otp",e)},sendTransaction:{title:"Send USDC transaction",description:"Send USDC to a recipient address. Amount is in atomic units (6 decimals). 1000000 = $1.00 USDC. Transactions are subject to spending limits set in the wallet app.",tool:async e=>this.sendToWindow("send-transaction",e)},executeSwap:{title:"Execute token swap",description:"Swap tokens using the CDP Swap API. Supports USDC, ETH, WETH on Base. Amount is in atomic units based on token decimals.",tool:async e=>this.sendToWindow("execute-swap",e)}}}}});import wr from"fs";import Rs from"path";import{execSync as Hc}from"child_process";function Ts(a){try{if(process.kill(a,0),process.platform!=="win32"){let e=Hc(`ps -p ${a} -o command=`,{encoding:"utf8",stdio:"pipe"});return e.includes("payments-mcp-server")||e.includes("payments-mcp-cli")||e.includes("awal-cli")||e.includes("electron index.ts")||e.includes("bundle-electron")}return!0}catch{return!1}}function Un(){let a="/tmp/payments-mcp-ui.lock",e="/tmp/payments-mcp-ui-bridge",t=!1;if(wr.existsSync(a))try{let s=parseInt(wr.readFileSync(a,"utf8").trim());Ts(s)||(wr.unlinkSync(a),E.security.debug({message:"Cleaned up stale UI lock file",lockPid:s}),t=!0)}catch{wr.unlinkSync(a),E.security.debug({message:"Cleaned up malformed UI lock file"}),t=!0}if(wr.existsSync(e))try{let s=Rs.join(e,"requests"),r=Rs.join(e,"responses"),n=Date.now()-5*60*1e3;[s,r].forEach(i=>{wr.existsSync(i)&&wr.readdirSync(i).forEach(c=>{let u=Rs.join(i,c);wr.statSync(u).mtime.getTime()<n&&(wr.unlinkSync(u),E.bridge.debug({message:"Cleaned up old bridge file",filePath:u}),t=!0)})})}catch(s){E.bridge.error({message:"Error cleaning bridge files",error:s instanceof Error?s.message:String(s)})}t&&E.security.info({message:"Stale file cleanup completed"})}var Vn=Ar(()=>{"use strict";br()});var Zt={};Nn(Zt,{closeApp:()=>Pr,closeUI:()=>Is,focusApp:()=>Jc,launchApp:()=>pa,operations:()=>le,windowReady:()=>Kc});import{app as Ge,BrowserWindow as Zc}from"electron";import Wn from"path";import Pt from"fs";import{fileURLToPath as Bc}from"url";function pa(){ks&&Ge.dock&&Ge.dock.hide(),Un();let a="/tmp/payments-mcp-ui.lock",e=!1;try{Pt.writeFileSync(a,process.pid.toString(),{flag:"wx"}),e=!0,E.electron.debug({message:"UI lock acquired",pid:process.pid}),process.once("exit",()=>{try{Pt.unlinkSync(a)}catch{}})}catch{try{let r=parseInt(Pt.readFileSync(a,"utf8").trim());Ts(r)?(E.electron.debug({message:"UI lock already taken"}),e=!1):(E.electron.warning({message:"Lock file contains dead PID, attempting to clean and retry",lockPid:r,currentPid:process.pid}),Pt.unlinkSync(a),Pt.writeFileSync(a,process.pid.toString(),{flag:"wx"}),e=!0,E.electron.debug({message:"UI lock acquired after cleaning stale lock",pid:process.pid}))}catch{E.electron.debug({message:"UI lock already taken"}),e=!1}}let t=Ge.requestSingleInstanceLock();if(E.electron.debug({message:"Electron single instance lock check",gotLock:t,isFirstInstance:e}),e)Ge.on("second-instance",()=>{He.hasMainWindow()&&He.restoreWindow()}),Ge.whenReady().then(()=>{if(ks&&Ge.dock){let s=Wn.join(Qc,"./assets/icon.png");if(Pt.existsSync(s))try{Ge.dock.setIcon(s)}catch(r){E.electron.error({message:"Error setting early dock icon",error:r instanceof Error?r.message:String(r)})}}He.hasMainWindow()||He.createWindow(),Ge.on("activate",()=>{Zc.getAllWindows().length===0&&He.createWindow(),He.showWindow()})}),Ge.on("window-all-closed",()=>{process.platform!=="darwin"&&Ge.quit()});else return E.electron.debug({message:"Another instance has UI lock, no UI will be shown"}),!1;return e}function Pr(){Or(),He.closeApp()}function Is(){He.closeUI()}function Jc(){if(He.hasMainWindow())He.focusApp();else if(!pa()){E.electron.warning({message:"Cannot focus app from secondary instance"});return}He.showWindow()}var Qc,He,Gc,ks,le,Kc,Sr=Ar(()=>{"use strict";Mn();zn();Vn();la();br();Qc=Wn.dirname(Bc(import.meta.url)),He=new ca,Gc=new da(He),ks=process.platform==="darwin";Ge.on("window-all-closed",()=>{ks||Ge.quit()});({operations:le}=Gc),Kc=He.windowReady});var Pi=Q((ja,wi)=>{(function(a,e){typeof ja=="object"&&typeof wi<"u"?e(ja):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(ja,function(a){"use strict";function e(){for(var m=arguments.length,p=Array(m),v=0;v<m;v++)p[v]=arguments[v];if(p.length>1){p[0]=p[0].slice(0,-1);for(var w=p.length-1,P=1;P<w;++P)p[P]=p[P].slice(1,-1);return p[w]=p[w].slice(1),p.join("")}else return p[0]}function t(m){return"(?:"+m+")"}function s(m){return m===void 0?"undefined":m===null?"null":Object.prototype.toString.call(m).split(" ").pop().split("]").shift().toLowerCase()}function r(m){return m.toUpperCase()}function n(m){return m!=null?m instanceof Array?m:typeof m.length!="number"||m.split||m.setInterval||m.call?[m]:Array.prototype.slice.call(m):[]}function i(m,p){var v=m;if(p)for(var w in p)v[w]=p[w];return v}function o(m){var p="[A-Za-z]",v="[\\x0D]",w="[0-9]",P="[\\x22]",L=e(w,"[A-Fa-f]"),K="[\\x0A]",se="[\\x20]",ce=t(t("%[EFef]"+L+"%"+L+L+"%"+L+L)+"|"+t("%[89A-Fa-f]"+L+"%"+L+L)+"|"+t("%"+L+L)),Ee="[\\:\\/\\?\\#\\[\\]\\@]",ae="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ye=e(Ee,ae),Re=m?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ve=m?"[\\uE000-\\uF8FF]":"[]",ie=e(p,w,"[\\-\\.\\_\\~]",Re),_e=t(p+e(p,w,"[\\+\\-\\.]")+"*"),de=t(t(ce+"|"+e(ie,ae,"[\\:]"))+"*"),Ur=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("[1-9]"+w)+"|"+w),Ve=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("0?[1-9]"+w)+"|0?0?"+w),Be=t(Ve+"\\."+Ve+"\\."+Ve+"\\."+Ve),pe=t(L+"{1,4}"),We=t(t(pe+"\\:"+pe)+"|"+Be),Qe=t(t(pe+"\\:")+"{6}"+We),or=t("\\:\\:"+t(pe+"\\:")+"{5}"+We),Vr=t(t(pe)+"?\\:\\:"+t(pe+"\\:")+"{4}"+We),mr=t(t(t(pe+"\\:")+"{0,1}"+pe)+"?\\:\\:"+t(pe+"\\:")+"{3}"+We),qt=t(t(t(pe+"\\:")+"{0,2}"+pe)+"?\\:\\:"+t(pe+"\\:")+"{2}"+We),sa=t(t(t(pe+"\\:")+"{0,3}"+pe)+"?\\:\\:"+pe+"\\:"+We),na=t(t(t(pe+"\\:")+"{0,4}"+pe)+"?\\:\\:"+We),ft=t(t(t(pe+"\\:")+"{0,5}"+pe)+"?\\:\\:"+pe),ht=t(t(t(pe+"\\:")+"{0,6}"+pe)+"?\\:\\:"),vr=t([Qe,or,Vr,mr,qt,sa,na,ft,ht].join("|")),mt=t(t(ie+"|"+ce)+"+"),ms=t(vr+"\\%25"+mt),Wr=t(vr+t("\\%25|\\%(?!"+L+"{2})")+mt),Sc=t("[vV]"+L+"+\\."+e(ie,ae,"[\\:]")+"+"),xc=t("\\["+t(Wr+"|"+vr+"|"+Sc)+"\\]"),Cn=t(t(ce+"|"+e(ie,ae))+"*"),Mt=t(xc+"|"+Be+"(?!"+Cn+")|"+Cn),Ft=t(w+"*"),$n=t(t(de+"@")+"?"+Mt+t("\\:"+Ft)+"?"),zt=t(ce+"|"+e(ie,ae,"[\\:\\@]")),Ec=t(zt+"*"),Dn=t(zt+"+"),Rc=t(t(ce+"|"+e(ie,ae,"[\\@]"))+"+"),gr=t(t("\\/"+Ec)+"*"),vt=t("\\/"+t(Dn+gr)+"?"),vs=t(Rc+gr),ia=t(Dn+gr),gt="(?!"+zt+")",Qf=t(gr+"|"+vt+"|"+vs+"|"+ia+"|"+gt),yt=t(t(zt+"|"+e("[\\/\\?]",ve))+"*"),Ut=t(t(zt+"|[\\/\\?]")+"*"),jn=t(t("\\/\\/"+$n+gr)+"|"+vt+"|"+ia+"|"+gt),Tc=t(_e+"\\:"+jn+t("\\?"+yt)+"?"+t("\\#"+Ut)+"?"),kc=t(t("\\/\\/"+$n+gr)+"|"+vt+"|"+vs+"|"+gt),Ic=t(kc+t("\\?"+yt)+"?"+t("\\#"+Ut)+"?"),Gf=t(Tc+"|"+Ic),Jf=t(_e+"\\:"+jn+t("\\?"+yt)+"?"),Kf="^("+_e+")\\:"+t(t("\\/\\/("+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?)")+"?("+gr+"|"+vt+"|"+ia+"|"+gt+")")+t("\\?("+yt+")")+"?"+t("\\#("+Ut+")")+"?$",Xf="^(){0}"+t(t("\\/\\/("+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?)")+"?("+gr+"|"+vt+"|"+vs+"|"+gt+")")+t("\\?("+yt+")")+"?"+t("\\#("+Ut+")")+"?$",Yf="^("+_e+")\\:"+t(t("\\/\\/("+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?)")+"?("+gr+"|"+vt+"|"+ia+"|"+gt+")")+t("\\?("+yt+")")+"?$",eh="^"+t("\\#("+Ut+")")+"?$",rh="^"+t("("+de+")@")+"?("+Mt+")"+t("\\:("+Ft+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",p,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ie,ae),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ie,ae),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ie,ae),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ie,ae),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]",ve),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ie,ae),"g"),UNRESERVED:new RegExp(ie,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ie,ye),"g"),PCT_ENCODED:new RegExp(ce,"g"),IPV4ADDRESS:new RegExp("^("+Be+")$"),IPV6ADDRESS:new RegExp("^\\[?("+vr+")"+t(t("\\%25|\\%(?!"+L+"{2})")+"("+mt+")")+"?\\]?$")}}var c=o(!1),u=o(!0),f=function(){function m(p,v){var w=[],P=!0,L=!1,K=void 0;try{for(var se=p[Symbol.iterator](),ce;!(P=(ce=se.next()).done)&&(w.push(ce.value),!(v&&w.length===v));P=!0);}catch(Ee){L=!0,K=Ee}finally{try{!P&&se.return&&se.return()}finally{if(L)throw K}}return w}return function(p,v){if(Array.isArray(p))return p;if(Symbol.iterator in Object(p))return m(p,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(m){if(Array.isArray(m)){for(var p=0,v=Array(m.length);p<m.length;p++)v[p]=m[p];return v}else return Array.from(m)},_=2147483647,d=36,y=1,b=26,g=38,S=700,A=72,x=128,T="-",O=/^xn--/,C=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=d-y,U=Math.floor,F=String.fromCharCode;function q(m){throw new RangeError(z[m])}function I(m,p){for(var v=[],w=m.length;w--;)v[w]=p(m[w]);return v}function D(m,p){var v=m.split("@"),w="";v.length>1&&(w=v[0]+"@",m=v[1]),m=m.replace(W,".");var P=m.split("."),L=I(P,p).join(".");return w+L}function M(m){for(var p=[],v=0,w=m.length;v<w;){var P=m.charCodeAt(v++);if(P>=55296&&P<=56319&&v<w){var L=m.charCodeAt(v++);(L&64512)==56320?p.push(((P&1023)<<10)+(L&1023)+65536):(p.push(P),v--)}else p.push(P)}return p}var ue=function(p){return String.fromCodePoint.apply(String,h(p))},Y=function(p){return p-48<10?p-22:p-65<26?p-65:p-97<26?p-97:d},te=function(p,v){return p+22+75*(p<26)-((v!=0)<<5)},X=function(p,v,w){var P=0;for(p=w?U(p/S):p>>1,p+=U(p/v);p>$*b>>1;P+=d)p=U(p/$);return U(P+($+1)*p/(p+g))},H=function(p){var v=[],w=p.length,P=0,L=x,K=A,se=p.lastIndexOf(T);se<0&&(se=0);for(var ce=0;ce<se;++ce)p.charCodeAt(ce)>=128&&q("not-basic"),v.push(p.charCodeAt(ce));for(var Ee=se>0?se+1:0;Ee<w;){for(var ae=P,ye=1,Re=d;;Re+=d){Ee>=w&&q("invalid-input");var ve=Y(p.charCodeAt(Ee++));(ve>=d||ve>U((_-P)/ye))&&q("overflow"),P+=ve*ye;var ie=Re<=K?y:Re>=K+b?b:Re-K;if(ve<ie)break;var _e=d-ie;ye>U(_/_e)&&q("overflow"),ye*=_e}var de=v.length+1;K=X(P-ae,de,ae==0),U(P/de)>_-L&&q("overflow"),L+=U(P/de),P%=de,v.splice(P++,0,L)}return String.fromCodePoint.apply(String,v)},be=function(p){var v=[];p=M(p);var w=p.length,P=x,L=0,K=A,se=!0,ce=!1,Ee=void 0;try{for(var ae=p[Symbol.iterator](),ye;!(se=(ye=ae.next()).done);se=!0){var Re=ye.value;Re<128&&v.push(F(Re))}}catch(Wr){ce=!0,Ee=Wr}finally{try{!se&&ae.return&&ae.return()}finally{if(ce)throw Ee}}var ve=v.length,ie=ve;for(ve&&v.push(T);ie<w;){var _e=_,de=!0,Ur=!1,Ve=void 0;try{for(var Be=p[Symbol.iterator](),pe;!(de=(pe=Be.next()).done);de=!0){var We=pe.value;We>=P&&We<_e&&(_e=We)}}catch(Wr){Ur=!0,Ve=Wr}finally{try{!de&&Be.return&&Be.return()}finally{if(Ur)throw Ve}}var Qe=ie+1;_e-P>U((_-L)/Qe)&&q("overflow"),L+=(_e-P)*Qe,P=_e;var or=!0,Vr=!1,mr=void 0;try{for(var qt=p[Symbol.iterator](),sa;!(or=(sa=qt.next()).done);or=!0){var na=sa.value;if(na<P&&++L>_&&q("overflow"),na==P){for(var ft=L,ht=d;;ht+=d){var vr=ht<=K?y:ht>=K+b?b:ht-K;if(ft<vr)break;var mt=ft-vr,ms=d-vr;v.push(F(te(vr+mt%ms,0))),ft=U(mt/ms)}v.push(F(te(ft,0))),K=X(L,Qe,ie==ve),L=0,++ie}}}catch(Wr){Vr=!0,mr=Wr}finally{try{!or&&qt.return&&qt.return()}finally{if(Vr)throw mr}}++L,++P}return v.join("")},Ae=function(p){return D(p,function(v){return O.test(v)?H(v.slice(4).toLowerCase()):v})},$e=function(p){return D(p,function(v){return C.test(v)?"xn--"+be(v):v})},ne={version:"2.1.0",ucs2:{decode:M,encode:ue},decode:H,encode:be,toASCII:$e,toUnicode:Ae},Se={};function Te(m){var p=m.charCodeAt(0),v=void 0;return p<16?v="%0"+p.toString(16).toUpperCase():p<128?v="%"+p.toString(16).toUpperCase():p<2048?v="%"+(p>>6|192).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase():v="%"+(p>>12|224).toString(16).toUpperCase()+"%"+(p>>6&63|128).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase(),v}function De(m){for(var p="",v=0,w=m.length;v<w;){var P=parseInt(m.substr(v+1,2),16);if(P<128)p+=String.fromCharCode(P),v+=3;else if(P>=194&&P<224){if(w-v>=6){var L=parseInt(m.substr(v+4,2),16);p+=String.fromCharCode((P&31)<<6|L&63)}else p+=m.substr(v,6);v+=6}else if(P>=224){if(w-v>=9){var K=parseInt(m.substr(v+4,2),16),se=parseInt(m.substr(v+7,2),16);p+=String.fromCharCode((P&15)<<12|(K&63)<<6|se&63)}else p+=m.substr(v,9);v+=9}else p+=m.substr(v,3),v+=3}return p}function kr(m,p){function v(w){var P=De(w);return P.match(p.UNRESERVED)?P:w}return m.scheme&&(m.scheme=String(m.scheme).replace(p.PCT_ENCODED,v).toLowerCase().replace(p.NOT_SCHEME,"")),m.userinfo!==void 0&&(m.userinfo=String(m.userinfo).replace(p.PCT_ENCODED,v).replace(p.NOT_USERINFO,Te).replace(p.PCT_ENCODED,r)),m.host!==void 0&&(m.host=String(m.host).replace(p.PCT_ENCODED,v).toLowerCase().replace(p.NOT_HOST,Te).replace(p.PCT_ENCODED,r)),m.path!==void 0&&(m.path=String(m.path).replace(p.PCT_ENCODED,v).replace(m.scheme?p.NOT_PATH:p.NOT_PATH_NOSCHEME,Te).replace(p.PCT_ENCODED,r)),m.query!==void 0&&(m.query=String(m.query).replace(p.PCT_ENCODED,v).replace(p.NOT_QUERY,Te).replace(p.PCT_ENCODED,r)),m.fragment!==void 0&&(m.fragment=String(m.fragment).replace(p.PCT_ENCODED,v).replace(p.NOT_FRAGMENT,Te).replace(p.PCT_ENCODED,r)),m}function fr(m){return m.replace(/^0*(.*)/,"$1")||"0"}function xe(m,p){var v=m.match(p.IPV4ADDRESS)||[],w=f(v,2),P=w[1];return P?P.split(".").map(fr).join("."):m}function we(m,p){var v=m.match(p.IPV6ADDRESS)||[],w=f(v,3),P=w[1],L=w[2];if(P){for(var K=P.toLowerCase().split("::").reverse(),se=f(K,2),ce=se[0],Ee=se[1],ae=Ee?Ee.split(":").map(fr):[],ye=ce.split(":").map(fr),Re=p.IPV4ADDRESS.test(ye[ye.length-1]),ve=Re?7:8,ie=ye.length-ve,_e=Array(ve),de=0;de<ve;++de)_e[de]=ae[de]||ye[ie+de]||"";Re&&(_e[ve-1]=xe(_e[ve-1],p));var Ur=_e.reduce(function(Qe,or,Vr){if(!or||or==="0"){var mr=Qe[Qe.length-1];mr&&mr.index+mr.length===Vr?mr.length++:Qe.push({index:Vr,length:1})}return Qe},[]),Ve=Ur.sort(function(Qe,or){return or.length-Qe.length})[0],Be=void 0;if(Ve&&Ve.length>1){var pe=_e.slice(0,Ve.index),We=_e.slice(Ve.index+Ve.length);Be=pe.join(":")+"::"+We.join(":")}else Be=_e.join(":");return L&&(Be+="%"+L),Be}else return m}var Mr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function oe(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},w=p.iri!==!1?u:c;p.reference==="suffix"&&(m=(p.scheme?p.scheme+":":"")+"//"+m);var P=m.match(Mr);if(P){Oe?(v.scheme=P[1],v.userinfo=P[3],v.host=P[4],v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=P[7],v.fragment=P[8],isNaN(v.port)&&(v.port=P[5])):(v.scheme=P[1]||void 0,v.userinfo=m.indexOf("@")!==-1?P[3]:void 0,v.host=m.indexOf("//")!==-1?P[4]:void 0,v.port=parseInt(P[5],10),v.path=P[6]||"",v.query=m.indexOf("?")!==-1?P[7]:void 0,v.fragment=m.indexOf("#")!==-1?P[8]:void 0,isNaN(v.port)&&(v.port=m.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?P[4]:void 0)),v.host&&(v.host=we(xe(v.host,w),w)),v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0?v.reference="same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",p.reference&&p.reference!=="suffix"&&p.reference!==v.reference&&(v.error=v.error||"URI is not a "+p.reference+" reference.");var L=Se[(p.scheme||v.scheme||"").toLowerCase()];if(!p.unicodeSupport&&(!L||!L.unicodeSupport)){if(v.host&&(p.domainHost||L&&L.domainHost))try{v.host=ne.toASCII(v.host.replace(w.PCT_ENCODED,De).toLowerCase())}catch(K){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+K}kr(v,c)}else kr(v,w);L&&L.parse&&L.parse(v,p)}else v.error=v.error||"URI can not be parsed.";return v}function Ir(m,p){var v=p.iri!==!1?u:c,w=[];return m.userinfo!==void 0&&(w.push(m.userinfo),w.push("@")),m.host!==void 0&&w.push(we(xe(String(m.host),v),v).replace(v.IPV6ADDRESS,function(P,L,K){return"["+L+(K?"%25"+K:"")+"]"})),(typeof m.port=="number"||typeof m.port=="string")&&(w.push(":"),w.push(String(m.port))),w.length?w.join(""):void 0}var hr=/^\.\.?\//,Fr=/^\/\.(\/|$)/,zr=/^\/\.\.(\/|$)/,ke=/^\/?(?:.|\n)*?(?=\/|$)/;function Ze(m){for(var p=[];m.length;)if(m.match(hr))m=m.replace(hr,"");else if(m.match(Fr))m=m.replace(Fr,"/");else if(m.match(zr))m=m.replace(zr,"/"),p.pop();else if(m==="."||m==="..")m="";else{var v=m.match(ke);if(v){var w=v[0];m=m.slice(w.length),p.push(w)}else throw new Error("Unexpected dot segment condition")}return p.join("")}function Le(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=p.iri?u:c,w=[],P=Se[(p.scheme||m.scheme||"").toLowerCase()];if(P&&P.serialize&&P.serialize(m,p),m.host&&!v.IPV6ADDRESS.test(m.host)){if(p.domainHost||P&&P.domainHost)try{m.host=p.iri?ne.toUnicode(m.host):ne.toASCII(m.host.replace(v.PCT_ENCODED,De).toLowerCase())}catch(se){m.error=m.error||"Host's domain name can not be converted to "+(p.iri?"Unicode":"ASCII")+" via punycode: "+se}}kr(m,v),p.reference!=="suffix"&&m.scheme&&(w.push(m.scheme),w.push(":"));var L=Ir(m,p);if(L!==void 0&&(p.reference!=="suffix"&&w.push("//"),w.push(L),m.path&&m.path.charAt(0)!=="/"&&w.push("/")),m.path!==void 0){var K=m.path;!p.absolutePath&&(!P||!P.absolutePath)&&(K=Ze(K)),L===void 0&&(K=K.replace(/^\/\//,"/%2F")),w.push(K)}return m.query!==void 0&&(w.push("?"),w.push(m.query)),m.fragment!==void 0&&(w.push("#"),w.push(m.fragment)),w.join("")}function je(m,p){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],P={};return w||(m=oe(Le(m,v),v),p=oe(Le(p,v),v)),v=v||{},!v.tolerant&&p.scheme?(P.scheme=p.scheme,P.userinfo=p.userinfo,P.host=p.host,P.port=p.port,P.path=Ze(p.path||""),P.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(P.userinfo=p.userinfo,P.host=p.host,P.port=p.port,P.path=Ze(p.path||""),P.query=p.query):(p.path?(p.path.charAt(0)==="/"?P.path=Ze(p.path):((m.userinfo!==void 0||m.host!==void 0||m.port!==void 0)&&!m.path?P.path="/"+p.path:m.path?P.path=m.path.slice(0,m.path.lastIndexOf("/")+1)+p.path:P.path=p.path,P.path=Ze(P.path)),P.query=p.query):(P.path=m.path,p.query!==void 0?P.query=p.query:P.query=m.query),P.userinfo=m.userinfo,P.host=m.host,P.port=m.port),P.scheme=m.scheme),P.fragment=p.fragment,P}function nr(m,p,v){var w=i({scheme:"null"},v);return Le(je(oe(m,w),oe(p,w),w,!0),w)}function Ue(m,p){return typeof m=="string"?m=Le(oe(m,p),p):s(m)==="object"&&(m=oe(Le(m,p),p)),m}function aa(m,p,v){return typeof m=="string"?m=Le(oe(m,v),v):s(m)==="object"&&(m=Le(m,v)),typeof p=="string"?p=Le(oe(p,v),v):s(p)==="object"&&(p=Le(p,v)),m===p}function fs(m,p){return m&&m.toString().replace(!p||!p.iri?c.ESCAPE:u.ESCAPE,Te)}function rr(m,p){return m&&m.toString().replace(!p||!p.iri?c.PCT_ENCODED:u.PCT_ENCODED,De)}var Nt={scheme:"http",domainHost:!0,parse:function(p,v){return p.host||(p.error=p.error||"HTTP URIs must have a host."),p},serialize:function(p,v){var w=String(p.scheme).toLowerCase()==="https";return(p.port===(w?443:80)||p.port==="")&&(p.port=void 0),p.path||(p.path="/"),p}},xn={scheme:"https",domainHost:Nt.domainHost,parse:Nt.parse,serialize:Nt.serialize};function En(m){return typeof m.secure=="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}var Lt={scheme:"ws",domainHost:!0,parse:function(p,v){var w=p;return w.secure=En(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(p,v){if((p.port===(En(p)?443:80)||p.port==="")&&(p.port=void 0),typeof p.secure=="boolean"&&(p.scheme=p.secure?"wss":"ws",p.secure=void 0),p.resourceName){var w=p.resourceName.split("?"),P=f(w,2),L=P[0],K=P[1];p.path=L&&L!=="/"?L:void 0,p.query=K,p.resourceName=void 0}return p.fragment=void 0,p}},Rn={scheme:"wss",domainHost:Lt.domainHost,parse:Lt.parse,serialize:Lt.serialize},dc={},pc=!0,Tn="[A-Za-z0-9\\-\\.\\_\\~"+(pc?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ir="[0-9A-Fa-f]",fc=t(t("%[EFef]"+ir+"%"+ir+ir+"%"+ir+ir)+"|"+t("%[89A-Fa-f]"+ir+"%"+ir+ir)+"|"+t("%"+ir+ir)),hc="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",mc="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",vc=e(mc,'[\\"\\\\]'),gc="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",yc=new RegExp(Tn,"g"),pt=new RegExp(fc,"g"),_c=new RegExp(e("[^]",hc,"[\\.]",'[\\"]',vc),"g"),kn=new RegExp(e("[^]",Tn,gc),"g"),bc=kn;function hs(m){var p=De(m);return p.match(yc)?p:m}var In={scheme:"mailto",parse:function(p,v){var w=p,P=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var L=!1,K={},se=w.query.split("&"),ce=0,Ee=se.length;ce<Ee;++ce){var ae=se[ce].split("=");switch(ae[0]){case"to":for(var ye=ae[1].split(","),Re=0,ve=ye.length;Re<ve;++Re)P.push(ye[Re]);break;case"subject":w.subject=rr(ae[1],v);break;case"body":w.body=rr(ae[1],v);break;default:L=!0,K[rr(ae[0],v)]=rr(ae[1],v);break}}L&&(w.headers=K)}w.query=void 0;for(var ie=0,_e=P.length;ie<_e;++ie){var de=P[ie].split("@");if(de[0]=rr(de[0]),v.unicodeSupport)de[1]=rr(de[1],v).toLowerCase();else try{de[1]=ne.toASCII(rr(de[1],v).toLowerCase())}catch(Ur){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ur}P[ie]=de.join("@")}return w},serialize:function(p,v){var w=p,P=n(p.to);if(P){for(var L=0,K=P.length;L<K;++L){var se=String(P[L]),ce=se.lastIndexOf("@"),Ee=se.slice(0,ce).replace(pt,hs).replace(pt,r).replace(_c,Te),ae=se.slice(ce+1);try{ae=v.iri?ne.toUnicode(ae):ne.toASCII(rr(ae,v).toLowerCase())}catch(ie){w.error=w.error||"Email address's domain name can not be converted to "+(v.iri?"Unicode":"ASCII")+" via punycode: "+ie}P[L]=Ee+"@"+ae}w.path=P.join(",")}var ye=p.headers=p.headers||{};p.subject&&(ye.subject=p.subject),p.body&&(ye.body=p.body);var Re=[];for(var ve in ye)ye[ve]!==dc[ve]&&Re.push(ve.replace(pt,hs).replace(pt,r).replace(kn,Te)+"="+ye[ve].replace(pt,hs).replace(pt,r).replace(bc,Te));return Re.length&&(w.query=Re.join("&")),w}},wc=/^([^\:]+)\:(.*)/,An={scheme:"urn",parse:function(p,v){var w=p.path&&p.path.match(wc),P=p;if(w){var L=v.scheme||P.scheme||"urn",K=w[1].toLowerCase(),se=w[2],ce=L+":"+(v.nid||K),Ee=Se[ce];P.nid=K,P.nss=se,P.path=void 0,Ee&&(P=Ee.parse(P,v))}else P.error=P.error||"URN can not be parsed.";return P},serialize:function(p,v){var w=v.scheme||p.scheme||"urn",P=p.nid,L=w+":"+(v.nid||P),K=Se[L];K&&(p=K.serialize(p,v));var se=p,ce=p.nss;return se.path=(P||v.nid)+":"+ce,se}},Pc=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,On={scheme:"urn:uuid",parse:function(p,v){var w=p;return w.uuid=w.nss,w.nss=void 0,!v.tolerant&&(!w.uuid||!w.uuid.match(Pc))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(p,v){var w=p;return w.nss=(p.uuid||"").toLowerCase(),w}};Se[Nt.scheme]=Nt,Se[xn.scheme]=xn,Se[Lt.scheme]=Lt,Se[Rn.scheme]=Rn,Se[In.scheme]=In,Se[An.scheme]=An,Se[On.scheme]=On,a.SCHEMES=Se,a.pctEncChar=Te,a.pctDecChars=De,a.parse=oe,a.removeDotSegments=Ze,a.serialize=Le,a.resolveComponents=je,a.resolve=nr,a.normalize=Ue,a.equal=aa,a.escapeComponent=fs,a.unescapeComponent=rr,Object.defineProperty(a,"__esModule",{value:!0})})});var Na=Q((Tm,Si)=>{"use strict";Si.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var Ei=Q((km,xi)=>{"use strict";xi.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var ut=Q((Im,ki)=>{"use strict";ki.exports={copy:Kd,checkDataType:Hs,checkDataTypes:Xd,coerceToTypes:Yd,toHash:Bs,getProperty:Qs,escapeQuotes:Gs,equal:Na(),ucs2length:Ei(),varOccurences:tp,varReplace:ap,schemaHasRules:sp,schemaHasRulesExcept:np,schemaUnknownRules:ip,toQuotedString:Zs,getPathExpr:op,getPath:lp,getData:dp,unescapeFragment:pp,unescapeJsonPointer:Ks,escapeFragment:fp,escapeJsonPointer:Js};function Kd(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Hs(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(t?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Xd(a,e,t){switch(a.length){case 1:return Hs(a[0],e,t,!0);default:var s="",r=Bs(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Hs(n,e,t,!0);return s}}var Ri=Bs(["string","number","integer","boolean","null"]);function Yd(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(Ri[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(Ri[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Bs(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var ep=/^[a-z$_][a-z$_0-9]*$/i,rp=/'|\\/g;function Qs(a){return typeof a=="number"?"["+a+"]":ep.test(a)?"."+a:"['"+Gs(a)+"']"}function Gs(a){return a.replace(rp,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function tp(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function ap(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function sp(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function np(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function ip(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Zs(a){return"'"+Gs(a)+"'"}function op(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Ti(a,r)}function lp(a,e,t){var s=Zs(t?"/"+Js(e):Qs(e));return Ti(a,s)}var cp=/^\/(?:[^~]|~0|~1)*$/,up=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dp(a,e,t){var s,r,n,i;if(a==="")return"rootData";if(a[0]=="/"){if(!cp.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(i=a.match(up),!i)throw new Error("Invalid JSON-pointer: "+a);if(s=+i[1],r=i[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var o=n,c=r.split("/"),u=0;u<c.length;u++){var f=c[u];f&&(n+=Qs(Ks(f)),o+=" && "+n)}return o}function Ti(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function pp(a){return Ks(decodeURIComponent(a))}function fp(a){return encodeURIComponent(Js(a))}function Js(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Ks(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var Xs=Q((Am,Ii)=>{"use strict";var hp=ut();Ii.exports=mp;function mp(a){hp.copy(a,this)}});var Oi=Q((Om,Ai)=>{"use strict";var Nr=Ai.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};La(e,s,r,a,"",a)};Nr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Nr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function La(a,e,t,s,r,n,i,o,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,u);for(var f in s){var h=s[f];if(Array.isArray(h)){if(f in Nr.arrayKeywords)for(var _=0;_<h.length;_++)La(a,e,t,h[_],r+"/"+f+"/"+_,n,r,f,s,_)}else if(f in Nr.propsKeywords){if(h&&typeof h=="object")for(var d in h)La(a,e,t,h[d],r+"/"+f+"/"+vp(d),n,r,f,s,d)}else(f in Nr.keywords||a.allKeys&&!(f in Nr.skipKeywords))&&La(a,e,t,h,r+"/"+f,n,r,f,s)}t(s,r,n,i,o,c,u)}}function vp(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var Va=Q((Cm,ji)=>{"use strict";var Yt=Pi(),Ci=Na(),za=ut(),qa=Xs(),gp=Oi();ji.exports=qr;qr.normalizeId=Lr;qr.fullPath=Ma;qr.url=Fa;qr.ids=Pp;qr.inlineRef=Ys;qr.schema=Ua;function qr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return qr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof qa)return Ys(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ua.call(this,e,t),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof qa?i=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(i=Ys(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),i}function Ua(a,e){var t=Yt.parse(e),s=Di(t),r=Ma(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Lr(s),i=this._refs[n];if(typeof i=="string")return yp.call(this,a,i,t);if(i instanceof qa)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof qa){if(i.validate||this._compile(i),n==Lr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Ma(this._getId(a.schema))}return $i.call(this,t,r,a.schema,a)}function yp(a,e,t){var s=Ua.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=Fa(n,i)),$i.call(this,t,n,r,a)}}var _p=za.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function $i(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var i=r[n];if(i){if(i=za.unescapeFragment(i),t=t[i],t===void 0)break;var o;if(!_p[i]&&(o=this._getId(t),o&&(e=Fa(e,o)),t.$ref)){var c=Fa(e,t.$ref),u=Ua.call(this,s,c);u&&(t=u.schema,s=u.root,e=u.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var bp=za.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Ys(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return en(a);if(e)return rn(a)<=e}function en(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!en(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!en(e)))return!1;return!0}function rn(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=rn(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(bp[r])e++;else if(t=a[r],typeof t=="object"&&(e+=rn(t)+1),e==1/0)return 1/0}return e}function Ma(a,e){e!==!1&&(a=Lr(a));var t=Yt.parse(a);return Di(t)}function Di(a){return Yt.serialize(a).split("#")[0]+"#"}var wp=/#\/?$/;function Lr(a){return a?a.replace(wp,""):""}function Fa(a,e){return e=Lr(e),Yt.resolve(a,e)}function Pp(a){var e=Lr(this._getId(a)),t={"":e},s={"":Ma(e,!1)},r={},n=this;return gp(a,{allKeys:!0},function(i,o,c,u,f,h,_){if(o!==""){var d=n._getId(i),y=t[u],b=s[u]+"/"+f;if(_!==void 0&&(b+="/"+(typeof _=="number"?_:za.escapeFragment(_))),typeof d=="string"){d=y=Lr(y?Yt.resolve(y,d):d);var g=n._refs[d];if(typeof g=="string"&&(g=n._refs[g]),g&&g.schema){if(!Ci(i,g.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Lr(b))if(d[0]=="#"){if(r[d]&&!Ci(i,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=i}else n._refs[d]=b}t[o]=y,s[o]=b}}),r}});var Wa=Q(($m,Li)=>{"use strict";var tn=Va();Li.exports={Validation:Ni(Sp),MissingRef:Ni(an)};function Sp(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}an.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function an(a,e,t){this.message=t||an.message(a,e),this.missingRef=tn.url(a,e),this.missingSchema=tn.normalizeId(tn.fullPath(this.missingRef))}function Ni(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var sn=Q((Dm,qi)=>{"use strict";qi.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(i){return function(o,c){var u={key:o,value:i[o]},f={key:c,value:i[c]};return n(u,f)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o<i.length;o++)o&&(c+=","),c+=n(i[o])||"null";return c+"]"}if(i===null)return"null";if(r.indexOf(i)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=r.push(i)-1,f=Object.keys(i).sort(s&&s(i));for(c="",o=0;o<f.length;o++){var h=f[o],_=n(i[h]);_&&(c&&(c+=","),c+=JSON.stringify(h)+":"+_)}return r.splice(u,1),"{"+c+"}"}}(a)}});var nn=Q((jm,Mi)=>{"use strict";Mi.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var t="false schema",f=e.level,h=e.dataLevel,_=e.schema[t],d=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,O=!e.opts.allErrors,z,b="data"+(h||""),T="valid"+f;if(e.schema===!1){e.isTop?O=!0:r+=" var "+T+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+T+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var A=e.isTop,f=e.level=0,h=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var x="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,h=e.dataLevel,b="data"+(h||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+f+" = errors;"}var T="valid"+f,O=!e.opts.allErrors,C="",W="",z,$=e.schema.type,U=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(U?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],U=!0)),U&&$.length==1&&($=$[0],U=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var F=e.util.coerceToTypes(e.opts.coerceTypes,$);var q=e.RULES.types[$];if(F||U||q===!0||q&&!ke(q)){var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",d=e.schemaPath+".type",y=e.errSchemaPath+"/type",I=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[I]($,b,e.opts.strictNumbers,!0)+") { ",F){var D="dataType"+f,M="coerced"+f;r+=" var "+D+" = typeof "+b+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+D+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+D+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+M+" = "+b+"; } "),r+=" if ("+M+" !== undefined) ; ";var ue=F;if(ue)for(var Y,te=-1,X=ue.length-1;te<X;)Y=ue[te+=1],Y=="string"?r+=" else if ("+D+" == 'number' || "+D+" == 'boolean') "+M+" = '' + "+b+"; else if ("+b+" === null) "+M+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+D+" == 'boolean' || "+b+" === null || ("+D+" == 'string' && "+b+" && "+b+" == +"+b+" ",Y=="integer"&&(r+=" && !("+b+" % 1)"),r+=")) "+M+" = +"+b+"; "):Y=="boolean"?r+=" else if ("+b+" === 'false' || "+b+" === 0 || "+b+" === null) "+M+" = false; else if ("+b+" === 'true' || "+b+" === 1) "+M+" = true; ":Y=="null"?r+=" else if ("+b+" === '' || "+b+" === 0 || "+b+" === false) "+M+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+D+" == 'string' || "+D+" == 'number' || "+D+" == 'boolean' || "+b+" == null) "+M+" = ["+b+"]; ");r+=" else { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+M+" !== undefined) { ";var H=h?"data"+(h-1||""):"parentData",be=h?e.dataPathArr[h]:"parentDataProperty";r+=" "+b+" = "+M+"; ",h||(r+="if ("+H+" !== undefined)"),r+=" "+H+"["+be+"] = "+M+"; } "}else{var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!i)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",O&&(r+=" } if (errors === ",A?r+="0":r+="errs_"+f,r+=") { ",W+="}");else{var Ae=e.RULES;if(Ae){for(var q,$e=-1,ne=Ae.length-1;$e<ne;)if(q=Ae[$e+=1],ke(q)){if(q.type&&(r+=" if ("+e.util.checkDataType(q.type,b,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(q.type=="object"&&e.schema.properties){var _=e.schema.properties,Se=Object.keys(_),Te=Se;if(Te)for(var De,kr=-1,fr=Te.length-1;kr<fr;){De=Te[kr+=1];var xe=_[De];if(xe.default!==void 0){var we=b+e.util.getProperty(De);if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+we;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else r+=" if ("+we+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+we+" === null || "+we+" === '' "),r+=" ) "+we+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(xe.default)+" ":r+=" "+JSON.stringify(xe.default)+" ",r+="; "}}}else if(q.type=="array"&&Array.isArray(e.schema.items)){var Mr=e.schema.items;if(Mr){for(var xe,te=-1,Oe=Mr.length-1;te<Oe;)if(xe=Mr[te+=1],xe.default!==void 0){var we=b+"["+te+"]";if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+we;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else r+=" if ("+we+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+we+" === null || "+we+" === '' "),r+=" ) "+we+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(xe.default)+" ":r+=" "+JSON.stringify(xe.default)+" ",r+="; "}}}}var oe=q.rules;if(oe){for(var Ir,hr=-1,Fr=oe.length-1;hr<Fr;)if(Ir=oe[hr+=1],Ze(Ir)){var zr=Ir.code(e,Ir.keyword,q.type);zr&&(r+=" "+zr+" ",O&&(C+="}"))}}if(O&&(r+=" "+C+" ",C=""),q.type&&(r+=" } ",$&&$===q.type&&!F)){r+=" else { ";var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&O?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}O&&(r+=" if (errors === ",A?r+="0":r+="errs_"+f,r+=") { ",W+="}")}}}O&&(r+=" "+W+" "),A?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+T+" = errors === errs_"+f+";";function ke(je){for(var nr=je.rules,Ue=0;Ue<nr.length;Ue++)if(Ze(nr[Ue]))return!0}function Ze(je){return e.schema[je.keyword]!==void 0||je.implements&&Le(je)}function Le(je){for(var nr=je.implements,Ue=0;Ue<nr.length;Ue++)if(e.schema[nr[Ue]]!==void 0)return!0}return r}});var Wi=Q((Nm,Vi)=>{"use strict";var Ha=Va(),Ba=ut(),zi=Wa(),xp=sn(),Fi=nn(),Ep=Ba.ucs2length,Rp=Na(),Tp=zi.Validation;Vi.exports=on;function on(a,e,t,s){var r=this,n=this._opts,i=[void 0],o={},c=[],u={},f=[],h={},_=[];e=e||{schema:a,refVal:i,refs:o};var d=kp.call(this,a,e,s),y=this._compilations[d.index];if(d.compiling)return y.callValidate=x;var b=this._formats,g=this.RULES;try{var S=T(a,e,t,s);y.validate=S;var A=y.callValidate;return A&&(A.schema=S.schema,A.errors=null,A.refs=S.refs,A.refVal=S.refVal,A.root=S.root,A.$async=S.$async,n.sourceCode&&(A.source=S.source)),S}finally{Ip.call(this,a,e,s)}function x(){var I=y.validate,D=I.apply(this,arguments);return x.errors=I.errors,D}function T(I,D,M,ue){var Y=!D||D&&D.schema==I;if(D.schema!=e.schema)return on.call(r,I,D,M,ue);var te=I.$async===!0,X=Fi({isTop:!0,schema:I,isRoot:Y,baseId:ue,root:D,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:zi.MissingRef,RULES:g,validate:Fi,util:Ba,resolve:Ha,resolveRef:O,usePattern:U,useDefault:F,useCustomRule:q,opts:n,formats:b,logger:r.logger,self:r});X=Za(i,Cp)+Za(c,Ap)+Za(f,Op)+Za(_,$p)+X,n.processCode&&(X=n.processCode(X,I));var H;try{var be=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",X);H=be(r,g,b,e,i,f,_,Rp,Ep,Tp),i[0]=H}catch(Ae){throw r.logger.error("Error compiling schema, function code:",X),Ae}return H.schema=I,H.errors=null,H.refs=o,H.refVal=i,H.root=Y?H:D,te&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:X,patterns:c,defaults:f}),H}function O(I,D,M){D=Ha.url(I,D);var ue=o[D],Y,te;if(ue!==void 0)return Y=i[ue],te="refVal["+ue+"]",$(Y,te);if(!M&&e.refs){var X=e.refs[D];if(X!==void 0)return Y=e.refVal[X],te=C(D,Y),$(Y,te)}te=C(D);var H=Ha.call(r,T,e,D);if(H===void 0){var be=t&&t[D];be&&(H=Ha.inlineRef(be,n.inlineRefs)?be:on.call(r,be,e,t,I))}if(H===void 0)W(D);else return z(D,H),$(H,te)}function C(I,D){var M=i.length;return i[M]=D,o[I]=M,"refVal"+M}function W(I){delete o[I]}function z(I,D){var M=o[I];i[M]=D}function $(I,D){return typeof I=="object"||typeof I=="boolean"?{code:D,schema:I,inline:!0}:{code:D,$async:I&&!!I.$async}}function U(I){var D=u[I];return D===void 0&&(D=u[I]=c.length,c[D]=I),"pattern"+D}function F(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return Ba.toQuotedString(I);case"object":if(I===null)return"null";var D=xp(I),M=h[D];return M===void 0&&(M=h[D]=f.length,f[M]=I),"default"+M}}function q(I,D,M,ue){if(r._opts.validateSchema!==!1){var Y=I.definition.dependencies;if(Y&&!Y.every(function(Te){return Object.prototype.hasOwnProperty.call(M,Te)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var te=I.definition.validateSchema;if(te){var X=te(D);if(!X){var H="keyword schema is invalid: "+r.errorsText(te.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var be=I.definition.compile,Ae=I.definition.inline,$e=I.definition.macro,ne;if(be)ne=be.call(r,D,M,ue);else if($e)ne=$e.call(r,D,M,ue),n.validateSchema!==!1&&r.validateSchema(ne,!0);else if(Ae)ne=Ae.call(r,ue,I.keyword,D,M);else if(ne=I.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var Se=_.length;return _[Se]=ne,{code:"customRule"+Se,validate:ne}}}function kp(a,e,t){var s=Ui.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function Ip(a,e,t){var s=Ui.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Ui(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function Ap(a,e){return"var pattern"+a+" = new RegExp("+Ba.toQuotedString(e[a])+");"}function Op(a){return"var default"+a+" = defaults["+a+"];"}function Cp(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function $p(a){return"var customRule"+a+" = customRules["+a+"];"}function Za(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Zi=Q((Lm,Hi)=>{"use strict";var Qa=Hi.exports=function(){this._cache={}};Qa.prototype.put=function(e,t){this._cache[e]=t};Qa.prototype.get=function(e){return this._cache[e]};Qa.prototype.del=function(e){delete this._cache[e]};Qa.prototype.clear=function(){this._cache={}}});var so=Q((qm,ao)=>{"use strict";var Dp=ut(),jp=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Np=[0,31,28,31,30,31,30,31,31,30,31,30,31],Lp=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Bi=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,qp=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Mp=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Qi=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Gi=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Ji=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ki=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Xi=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Yi=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ao.exports=Ga;function Ga(a){return a=a=="full"?"full":"fast",Dp.copy(Ga[a])}Ga.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Qi,url:Gi,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Bi,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:to,uuid:Ji,"json-pointer":Ki,"json-pointer-uri-fragment":Xi,"relative-json-pointer":Yi};Ga.full={date:eo,time:ro,"date-time":Up,uri:Wp,"uri-reference":Mp,"uri-template":Qi,url:Gi,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Bi,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:to,uuid:Ji,"json-pointer":Ki,"json-pointer-uri-fragment":Xi,"relative-json-pointer":Yi};function Fp(a){return a%4===0&&(a%100!==0||a%400===0)}function eo(a){var e=a.match(jp);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Fp(t)?29:Np[s])}function ro(a,e){var t=a.match(Lp);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var zp=/t|\s/i;function Up(a){var e=a.split(zp);return e.length==2&&eo(e[0])&&ro(e[1],!0)}var Vp=/\/|:/;function Wp(a){return Vp.test(a)&&qp.test(a)}var Hp=/[^\\]\\Z/;function to(a){if(Hp.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var io=Q((Mm,no)=>{"use strict";no.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f="data"+(i||""),h="valid"+n,_,d;if(o=="#"||o=="#/")e.isRoot?(_=e.async,d="validate"):(_=e.root.schema.$async===!0,d="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(b);var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),u&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,b)}else if(y.inline){var A=e.util.copy(e);A.level++;var x="valid"+A.level;A.schema=y.schema,A.schemaPath="",A.errSchemaPath=o;var T=e.validate(A).replace(/validate\.schema/g,y.code);r+=" "+T+" ",u&&(r+=" if ("+x+") { ")}else _=y.$async===!0||e.async&&y.$async!==!1,d=y.code}if(d){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var O=i?"data"+(i-1||""):"parentData",C=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+O+" , "+C+", rootData) ";var W=r;if(r=g.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(r+=" var "+h+"; "),r+=" try { await "+W+"; ",u&&(r+=" "+h+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(r+=" "+h+" = false; "),r+=" } ",u&&(r+=" if ("+h+") { ")}else r+=" if (!"+W+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",u&&(r+=" else { ")}return r}});var lo=Q((Fm,oo)=>{"use strict";oo.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u=e.util.copy(e),f="";u.level++;var h="valid"+u.level,_=u.baseId,d=!0,y=n;if(y)for(var b,g=-1,S=y.length-1;g<S;)b=y[g+=1],(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(d=!1,u.schema=b,u.schemaPath=i+"["+g+"]",u.errSchemaPath=o+"/"+g,r+=" "+e.validate(u)+" ",u.baseId=_,c&&(r+=" if ("+h+") { ",f+="}"));return c&&(d?r+=" if (true) { ":r+=" "+f.slice(0,-1)+" "),r}});var uo=Q((zm,co)=>{"use strict";co.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S=o.every(function(z){return e.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:e.util.schemaHasRules(z,e.RULES.all)});if(S){var A=y.baseId;r+=" var "+d+" = errors; var "+_+" = false; ";var x=e.compositeRule;e.compositeRule=y.compositeRule=!0;var T=o;if(T)for(var O,C=-1,W=T.length-1;C<W;)O=T[C+=1],y.schema=O,y.schemaPath=c+"["+C+"]",y.errSchemaPath=u+"/"+C,r+=" "+e.validate(y)+" ",y.baseId=A,r+=" "+_+" = "+_+" || "+g+"; if (!"+_+") { ",b+="}";e.compositeRule=y.compositeRule=x,r+=" "+b+" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else f&&(r+=" if (true) { ");return r}});var fo=Q((Um,po)=>{"use strict";po.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var mo=Q((Vm,ho)=>{"use strict";ho.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o,d||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+_+" = equal("+h+", schema"+n+"); if (!"+_+") { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var go=Q((Wm,vo)=>{"use strict";vo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S="i"+n,A=y.dataLevel=e.dataLevel+1,x="data"+A,T=e.baseId,O=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+d+" = errors;var "+_+";",O){var C=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=c,y.errSchemaPath=u,r+=" var "+g+" = false; for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var W=h+"["+S+"]";y.dataPathArr[A]=S;var z=e.validate(y);y.baseId=T,e.util.varOccurences(z,x)<2?r+=" "+e.util.varReplace(z,x,W)+" ":r+=" var "+x+" = "+W+"; "+z+" ",r+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=C,r+=" "+b+" if (!"+g+") {"}else r+=" if ("+h+".length == 0) {";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var U=r;return r=$.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",O&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var _o=Q((Hm,yo)=>{"use strict";yo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e),y="";d.level++;var b="valid"+d.level,g={},S={},A=e.opts.ownProperties;for(C in o)if(C!="__proto__"){var x=o[C],T=Array.isArray(x)?S:g;T[C]=x}r+="var "+_+" = errors;";var O=e.errorPath;r+="var missing"+n+";";for(var C in S)if(T=S[C],T.length){if(r+=" if ( "+h+e.util.getProperty(C)+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),f){r+=" && ( ";var W=T;if(W)for(var z,$=-1,U=W.length-1;$<U;){z=W[$+=1],$&&(r+=" || ");var F=e.util.getProperty(z),q=h+F;r+=" ( ( "+q+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?z:F)+") ) "}r+=")) { ";var I="missing"+n,D="' + "+I+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(O,I,!0):O+" + "+I);var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+D+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var ue=r;r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ue+"]); ":r+=" validate.errors = ["+ue+"]; return false; ":r+=" var err = "+ue+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=T;if(Y)for(var z,te=-1,X=Y.length-1;te<X;){z=Y[te+=1];var F=e.util.getProperty(z),D=e.util.escapeQuotes(z),q=h+F;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(O,z,e.opts.jsonPointers)),r+=" if ( "+q+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+D+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",f&&(y+="}",r+=" else { ")}e.errorPath=O;var H=d.baseId;for(var C in g){var x=g[C];(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))&&(r+=" "+b+" = true; if ( "+h+e.util.getProperty(C)+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(C)+"') "),r+=") { ",d.schema=x,d.schemaPath=c+e.util.getProperty(C),d.errSchemaPath=u+"/"+e.util.escapeFragment(C),r+=" "+e.validate(d)+" ",d.baseId=H,r+=" } ",f&&(r+=" if ("+b+") { ",y+="}"))}return f&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var wo=Q((Zm,bo)=>{"use strict";bo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="i"+n,g="schema"+n;d||(r+=" var "+g+" = validate.schema"+c+";"),r+="var "+_+";",d&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=""+_+" = false;for (var "+b+"=0; "+b+"<"+g+".length; "+b+"++) if (equal("+h+", "+g+"["+b+"])) { "+_+" = true; break; }",d&&(r+=" } "),r+=" if (!"+_+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var A=r;return r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var So=Q((Bm,Po)=>{"use strict";Po.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||"");if(e.opts.format===!1)return f&&(r+=" if (true) { "),r;var _=e.opts.$data&&o&&o.$data,d;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=e.opts.unknownFormats,b=Array.isArray(y);if(_){var g="format"+n,S="isObject"+n,A="formatType"+n;r+=" var "+g+" = formats["+d+"]; var "+S+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+A+" = "+S+" && "+g+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+n+" = "+g+".async; "),r+=" "+g+" = "+g+".validate; } if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+d+" && !"+g+" ",b&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+g+" && "+A+" == '"+s+"' && !(typeof "+g+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+g+"("+h+") : "+g+"("+h+")) ":r+=" "+g+"("+h+") ",r+=" : "+g+".test("+h+"))))) {"}else{var g=e.formats[o];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(r+=" if (true) { "),r;if(b&&y.indexOf(o)>=0)return f&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,A=S&&g.type||"string";if(S){var x=g.async===!0;g=g.validate}if(A!=s)return f&&(r+=" if (true) { "),r;if(x){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+T+"("+h+"))) { "}else{r+=" if (! ";var T="formats"+e.util.getProperty(o);S&&(T+=".validate"),typeof g=="function"?r+=" "+T+"("+h+") ":r+=" "+T+".test("+h+") ",r+=") { "}}var O=O||[];O.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",_?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var C=r;return r=O.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var Eo=Q((Qm,xo)=>{"use strict";xo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e);y.level++;var b="valid"+y.level,g=e.schema.then,S=e.schema.else,A=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),x=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),T=y.baseId;if(A||x){var O;y.createErrors=!1,y.schema=o,y.schemaPath=c,y.errSchemaPath=u,r+=" var "+d+" = errors; var "+_+" = true; ";var C=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=T,y.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=C,A?(r+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+_+" = "+b+"; ",A&&x?(O="ifClause"+n,r+=" var "+O+" = 'then'; "):O="'then'",r+=" } ",x&&(r+=" else { ")):r+=" if (!"+b+") { ",x&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+_+" = "+b+"; ",A&&x?(O="ifClause"+n,r+=" var "+O+" = 'else'; "):O="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+O+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+O+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var To=Q((Gm,Ro)=>{"use strict";Ro.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S="i"+n,A=y.dataLevel=e.dataLevel+1,x="data"+A,T=e.baseId;if(r+="var "+d+" = errors;var "+_+";",Array.isArray(o)){var O=e.schema.additionalItems;if(O===!1){r+=" "+_+" = "+h+".length <= "+o.length+"; ";var C=u;u=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var z=r;r=W.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u=C,f&&(b+="}",r+=" else { ")}var $=o;if($){for(var U,F=-1,q=$.length-1;F<q;)if(U=$[F+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+g+" = true; if ("+h+".length > "+F+") { ";var I=h+"["+F+"]";y.schema=U,y.schemaPath=c+"["+F+"]",y.errSchemaPath=u+"/"+F,y.errorPath=e.util.getPathExpr(e.errorPath,F,e.opts.jsonPointers,!0),y.dataPathArr[A]=F;var D=e.validate(y);y.baseId=T,e.util.varOccurences(D,x)<2?r+=" "+e.util.varReplace(D,x,I)+" ":r+=" var "+x+" = "+I+"; "+D+" ",r+=" } ",f&&(r+=" if ("+g+") { ",b+="}")}}if(typeof O=="object"&&(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))){y.schema=O,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+h+".length > "+o.length+") { for (var "+S+" = "+o.length+"; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=h+"["+S+"]";y.dataPathArr[A]=S;var D=e.validate(y);y.baseId=T,e.util.varOccurences(D,x)<2?r+=" "+e.util.varReplace(D,x,I)+" ":r+=" var "+x+" = "+I+"; "+D+" ",f&&(r+=" if (!"+g+") break; "),r+=" } } ",f&&(r+=" if ("+g+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){y.schema=o,y.schemaPath=c,y.errSchemaPath=u,r+=" for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=h+"["+S+"]";y.dataPathArr[A]=S;var D=e.validate(y);y.baseId=T,e.util.varOccurences(D,x)<2?r+=" "+e.util.varReplace(D,x,I)+" ":r+=" var "+x+" = "+I+"; "+D+" ",f&&(r+=" if (!"+g+") break; "),r+=" }"}return f&&(r+=" "+b+" if ("+d+" == errors) {"),r}});var ln=Q((Jm,ko)=>{"use strict";ko.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,T,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=t=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],S=e.opts.$data&&g&&g.$data,A=y?"<":">",x=y?">":"<",T=void 0;if(!(_||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(S||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(b+" must be number or boolean");if(S){var O=e.util.getData(g.$data,i,e.dataPathArr),C="exclusive"+n,W="exclType"+n,z="exclIsNumber"+n,$="op"+n,U="' + "+$+" + '";r+=" var schemaExcl"+n+" = "+O+"; ",O="schemaExcl"+n,r+=" var "+C+"; var "+W+" = typeof "+O+"; if ("+W+" != 'boolean' && "+W+" != 'undefined' && "+W+" != 'number') { ";var T=b,F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var q=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+W+" == 'number' ? ( ("+C+" = "+d+" === undefined || "+O+" "+A+"= "+d+") ? "+h+" "+x+"= "+O+" : "+h+" "+x+" "+d+" ) : ( ("+C+" = "+O+" === true) ? "+h+" "+x+"= "+d+" : "+h+" "+x+" "+d+" ) || "+h+" !== "+h+") { var op"+n+" = "+C+" ? '"+A+"' : '"+A+"='; ",o===void 0&&(T=b,u=e.errSchemaPath+"/"+b,d=O,_=S)}else{var z=typeof g=="number",U=A;if(z&&_){var $="'"+U+"'";r+=" if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+g+" "+A+"= "+d+" ? "+h+" "+x+"= "+g+" : "+h+" "+x+" "+d+" ) || "+h+" !== "+h+") { "}else{z&&o===void 0?(C=!0,T=b,u=e.errSchemaPath+"/"+b,d=g,x+="="):(z&&(d=Math[y?"min":"max"](g,o)),g===(z?d:!0)?(C=!0,T=b,u=e.errSchemaPath+"/"+b,x+="="):(C=!1,U+="="));var $="'"+U+"'";r+=" if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+h+" "+x+" "+d+" || "+h+" !== "+h+") { "}}T=T||t;var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+$+", limit: "+d+", exclusive: "+C+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",_?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var q=r;return r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var cn=Q((Km,Io)=>{"use strict";Io.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,b,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+h+".length "+y+" "+d+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+d+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var un=Q((Xm,Ao)=>{"use strict";Ao.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,b,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+h+".length ":r+=" ucs2length("+h+") ",r+=" "+y+" "+d+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+d+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var dn=Q((Ym,Oo)=>{"use strict";Oo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,b,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+h+").length "+y+" "+d+") { ";var b=t,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+d+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var $o=Q((ev,Co)=>{"use strict";Co.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;if(_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(_||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",_&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+h+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",_&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var b=r;return r=y.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+b+"]); ":r+=" validate.errors = ["+b+"]; return false; ":r+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var jo=Q((rv,Do)=>{"use strict";Do.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e);d.level++;var y="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u,r+=" var "+_+" = errors; ";var b=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var g;d.opts.allErrors&&(g=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,g&&(d.opts.allErrors=g),e.compositeRule=d.compositeRule=b,r+=" if ("+y+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var A=r;r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+_+"; if (vErrors !== null) { if ("+_+") vErrors.length = "+_+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ");return r}});var Lo=Q((tv,No)=>{"use strict";No.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d="errs__"+n,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S=y.baseId,A="prevValid"+n,x="passingSchemas"+n;r+="var "+d+" = errors , "+A+" = false , "+_+" = false , "+x+" = null; ";var T=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=o;if(O)for(var C,W=-1,z=O.length-1;W<z;)C=O[W+=1],(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))?(y.schema=C,y.schemaPath=c+"["+W+"]",y.errSchemaPath=u+"/"+W,r+=" "+e.validate(y)+" ",y.baseId=S):r+=" var "+g+" = true; ",W&&(r+=" if ("+g+" && "+A+") { "+_+" = false; "+x+" = ["+x+", "+W+"]; } else { ",b+="}"),r+=" if ("+g+") { "+_+" = "+A+" = true; "+x+" = "+W+"; }";return e.compositeRule=y.compositeRule=T,r+=""+b+"if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+x+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Mo=Q((av,qo)=>{"use strict";qo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_=e.opts.$data&&o&&o.$data,d;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=_?"(new RegExp("+d+"))":e.usePattern(o);r+="if ( ",_&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+y+".test("+h+") ) { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",_?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var g=r;return r=b.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var zo=Q((sv,Fo)=>{"use strict";Fo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e),y="";d.level++;var b="valid"+d.level,g="key"+n,S="idx"+n,A=d.dataLevel=e.dataLevel+1,x="data"+A,T="dataProperties"+n,O=Object.keys(o||{}).filter(te),C=e.schema.patternProperties||{},W=Object.keys(C).filter(te),z=e.schema.additionalProperties,$=O.length||W.length,U=z===!1,F=typeof z=="object"&&Object.keys(z).length,q=e.opts.removeAdditional,I=U||F||q,D=e.opts.ownProperties,M=e.baseId,ue=e.schema.required;if(ue&&!(e.opts.$data&&ue.$data)&&ue.length<e.opts.loopRequired)var Y=e.util.toHash(ue);function te(rr){return rr!=="__proto__"}if(r+="var "+_+" = errors;var "+b+" = true;",D&&(r+=" var "+T+" = undefined;"),I){if(D?r+=" "+T+" = "+T+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+T+".length; "+S+"++) { var "+g+" = "+T+"["+S+"]; ":r+=" for (var "+g+" in "+h+") { ",$){if(r+=" var isAdditional"+n+" = !(false ",O.length)if(O.length>8)r+=" || validate.schema"+c+".hasOwnProperty("+g+") ";else{var X=O;if(X)for(var H,be=-1,Ae=X.length-1;be<Ae;)H=X[be+=1],r+=" || "+g+" == "+e.util.toQuotedString(H)+" "}if(W.length){var $e=W;if($e)for(var ne,Se=-1,Te=$e.length-1;Se<Te;)ne=$e[Se+=1],r+=" || "+e.usePattern(ne)+".test("+g+") "}r+=" ); if (isAdditional"+n+") { "}if(q=="all")r+=" delete "+h+"["+g+"]; ";else{var De=e.errorPath,kr="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),U)if(q)r+=" delete "+h+"["+g+"]; ";else{r+=" "+b+" = false; ";var fr=u;u=e.errSchemaPath+"/additionalProperties";var xe=xe||[];xe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+kr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var we=r;r=xe.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=fr,f&&(r+=" break; ")}else if(F)if(q=="failing"){r+=" var "+_+" = errors; ";var Mr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=z,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Oe=h+"["+g+"]";d.dataPathArr[A]=g;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Oe)+" ":r+=" var "+x+" = "+Oe+"; "+oe+" ",r+=" if (!"+b+") { errors = "+_+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+g+"]; } ",e.compositeRule=d.compositeRule=Mr}else{d.schema=z,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Oe=h+"["+g+"]";d.dataPathArr[A]=g;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Oe)+" ":r+=" var "+x+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+b+") break; ")}e.errorPath=De}$&&(r+=" } "),r+=" } ",f&&(r+=" if ("+b+") { ",y+="}")}var Ir=e.opts.useDefaults&&!e.compositeRule;if(O.length){var hr=O;if(hr)for(var H,Fr=-1,zr=hr.length-1;Fr<zr;){H=hr[Fr+=1];var ke=o[H];if(e.opts.strictKeywords?typeof ke=="object"&&Object.keys(ke).length>0||ke===!1:e.util.schemaHasRules(ke,e.RULES.all)){var Ze=e.util.getProperty(H),Oe=h+Ze,Le=Ir&&ke.default!==void 0;d.schema=ke,d.schemaPath=c+Ze,d.errSchemaPath=u+"/"+e.util.escapeFragment(H),d.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),d.dataPathArr[A]=e.util.toQuotedString(H);var oe=e.validate(d);if(d.baseId=M,e.util.varOccurences(oe,x)<2){oe=e.util.varReplace(oe,x,Oe);var je=Oe}else{var je=x;r+=" var "+x+" = "+Oe+"; "}if(Le)r+=" "+oe+" ";else{if(Y&&Y[H]){r+=" if ( "+je+" === undefined ",D&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+b+" = false; ";var De=e.errorPath,fr=u,nr=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(De,H,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var xe=xe||[];xe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+nr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+nr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var we=r;r=xe.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=fr,e.errorPath=De,r+=" } else { "}else f?(r+=" if ( "+je+" === undefined ",D&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+b+" = true; } else { "):(r+=" if ("+je+" !== undefined ",D&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+oe+" } "}}f&&(r+=" if ("+b+") { ",y+="}")}}if(W.length){var Ue=W;if(Ue)for(var ne,aa=-1,fs=Ue.length-1;aa<fs;){ne=Ue[aa+=1];var ke=C[ne];if(e.opts.strictKeywords?typeof ke=="object"&&Object.keys(ke).length>0||ke===!1:e.util.schemaHasRules(ke,e.RULES.all)){d.schema=ke,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),D?r+=" "+T+" = "+T+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+T+".length; "+S+"++) { var "+g+" = "+T+"["+S+"]; ":r+=" for (var "+g+" in "+h+") { ",r+=" if ("+e.usePattern(ne)+".test("+g+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Oe=h+"["+g+"]";d.dataPathArr[A]=g;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Oe)+" ":r+=" var "+x+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+b+") break; "),r+=" } ",f&&(r+=" else "+b+" = true; "),r+=" } ",f&&(r+=" if ("+b+") { ",y+="}")}}}return f&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Vo=Q((nv,Uo)=>{"use strict";Uo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="errs__"+n,d=e.util.copy(e),y="";d.level++;var b="valid"+d.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u;var g="key"+n,S="idx"+n,A="i"+n,x="' + "+g+" + '",T=d.dataLevel=e.dataLevel+1,O="data"+T,C="dataProperties"+n,W=e.opts.ownProperties,z=e.baseId;W&&(r+=" var "+C+" = undefined; "),W?r+=" "+C+" = "+C+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+C+".length; "+S+"++) { var "+g+" = "+C+"["+S+"]; ":r+=" for (var "+g+" in "+h+") { ",r+=" var startErrs"+n+" = errors; ";var $=g,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var F=e.validate(d);d.baseId=z,e.util.varOccurences(F,O)<2?r+=" "+e.util.varReplace(F,O,$)+" ":r+=" var "+O+" = "+$+"; "+F+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+b+") { for (var "+A+"=startErrs"+n+"; "+A+"<errors; "+A+"++) { vErrors["+A+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+x+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+x+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),f&&(r+=" break; "),r+=" } }"}return f&&(r+=" "+y+" if ("+_+" == errors) {"),r}});var Ho=Q((iv,Wo)=>{"use strict";Wo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o;var b="schema"+n;if(!d)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],S=o;if(S)for(var A,x=-1,T=S.length-1;x<T;){A=S[x+=1];var O=e.schema.properties[A];O&&(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))||(g[g.length]=A)}}else var g=o;if(d||g.length){var C=e.errorPath,W=d||g.length>=e.opts.loopRequired,z=e.opts.ownProperties;if(f)if(r+=" var missing"+n+"; ",W){d||(r+=" var "+b+" = validate.schema"+c+"; ");var $="i"+n,U="schema"+n+"["+$+"]",F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,U,e.opts.jsonPointers)),r+=" var "+_+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+n+")) "+_+" = false; else {"),r+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { "+_+" = "+h+"["+b+"["+$+"]] !== undefined ",z&&(r+=" && Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),r+="; if (!"+_+") break; } ",d&&(r+=" } "),r+=" if (!"+_+") { ";var q=q||[];q.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var I=r;r=q.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var D=g;if(D)for(var M,$=-1,ue=D.length-1;$<ue;){M=D[$+=1],$&&(r+=" || ");var Y=e.util.getProperty(M),te=h+Y;r+=" ( ( "+te+" === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:Y)+") ) "}r+=") { ";var U="missing"+n,F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,U,!0):C+" + "+U);var q=q||[];q.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var I=r;r=q.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(W){d||(r+=" var "+b+" = validate.schema"+c+"; ");var $="i"+n,U="schema"+n+"["+$+"]",F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,U,e.opts.jsonPointers)),d&&(r+=" if ("+b+" && !Array.isArray("+b+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+b+" !== undefined) { "),r+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { if ("+h+"["+b+"["+$+"]] === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var X=g;if(X)for(var M,H=-1,be=X.length-1;H<be;){M=X[H+=1];var Y=e.util.getProperty(M),F=e.util.escapeQuotes(M),te=h+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,M,e.opts.jsonPointers)),r+=" if ( "+te+" === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=C}else f&&(r+=" if (true) {");return r}});var Bo=Q((ov,Zo)=>{"use strict";Zo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h="data"+(i||""),_="valid"+n,d=e.opts.$data&&o&&o.$data,y;if(d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+_+"; if ("+y+" === false || "+y+" === undefined) "+_+" = true; else if (typeof "+y+" != 'boolean') "+_+" = false; else { "),r+=" var i = "+h+".length , "+_+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,g=Array.isArray(b);if(!b||b=="object"||b=="array"||g&&(b.indexOf("object")>=0||b.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+_+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var S="checkDataType"+(g?"s":"");r+=" if ("+e.util[S](b,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+_+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+_+") { ";var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var x=r;r=A.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var Go=Q((lv,Qo)=>{"use strict";Qo.exports={$ref:io(),allOf:lo(),anyOf:uo(),$comment:fo(),const:mo(),contains:go(),dependencies:_o(),enum:wo(),format:So(),if:Eo(),items:To(),maximum:ln(),minimum:ln(),maxItems:cn(),minItems:cn(),maxLength:un(),minLength:un(),maxProperties:dn(),minProperties:dn(),multipleOf:$o(),not:jo(),oneOf:Lo(),pattern:Mo(),properties:zo(),propertyNames:Vo(),required:Ho(),uniqueItems:Bo(),validate:nn()}});var Xo=Q((cv,Ko)=>{"use strict";var Jo=Go(),pn=ut().toHash;Ko.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=pn(t),e.types=pn(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(f){t.push(f),e.all[f]=!0})}t.push(i);var u=e.all[i]={keyword:i,code:Jo[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:Jo.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=pn(t.concat(s)),e.custom={},e}});var rl=Q((uv,el)=>{"use strict";var Yo=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];el.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Yo.length;n++){var i=Yo[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var sl=Q((dv,al)=>{"use strict";var Zp=Wa().MissingRef;al.exports=tl;function tl(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var o=s._addSchema(a,void 0,e);return o.validate||i(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var c=o.$schema;return c&&!s.getSchema(c)?tl.call(s,{$ref:c},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(u){if(u instanceof Zp)return c(u);throw u}function c(u){var f=u.missingSchema;if(d(f))throw new Error("Schema "+f+" is loaded but "+u.missingRef+" cannot be resolved");var h=s._loadingSchemas[f];return h||(h=s._loadingSchemas[f]=s._opts.loadSchema(f),h.then(_,_)),h.then(function(y){if(!d(f))return n(y).then(function(){d(f)||s.addSchema(y,f,void 0,e)})}).then(function(){return i(o)});function _(){delete s._loadingSchemas[f]}function d(y){return s._refs[y]||s._schemas[y]}}}}});var il=Q((pv,nl)=>{"use strict";nl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,h,_="data"+(i||""),d="valid"+n,y="errs__"+n,b=e.opts.$data&&o&&o.$data,g;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var S=this,A="definition"+n,x=S.definition,T="",O,C,W,z,$;if(b&&x.$data){$="keywordValidate"+n;var U=x.validateSchema;r+=" var "+A+" = RULES.custom['"+t+"'].definition; var "+$+" = "+A+".validate;"}else{if(z=e.useCustomRule(S,o,e.schema,e),!z)return;g="validate.schema"+c,$=z.code,O=x.compile,C=x.inline,W=x.macro}var F=$+".errors",q="i"+n,I="ruleErr"+n,D=x.async;if(D&&!e.async)throw new Error("async keyword in sync schema");if(C||W||(r+=""+F+" = null;"),r+="var "+y+" = errors;var "+d+";",b&&x.$data&&(T+="}",r+=" if ("+g+" === undefined) { "+d+" = true; } else { ",U&&(T+="}",r+=" "+d+" = "+A+".validateSchema("+g+"); if ("+d+") { ")),C)x.statements?r+=" "+z.validate+" ":r+=" "+d+" = "+z.validate+"; ";else if(W){var M=e.util.copy(e),T="";M.level++;var ue="valid"+M.level;M.schema=z.validate,M.schemaPath="";var Y=e.compositeRule;e.compositeRule=M.compositeRule=!0;var te=e.validate(M).replace(/validate\.schema/g,$);e.compositeRule=M.compositeRule=Y,r+=" "+te}else{var X=X||[];X.push(r),r="",r+=" "+$+".call( ",e.opts.passContext?r+="this":r+="self",O||x.schema===!1?r+=" , "+_+" ":r+=" , "+g+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=i?"data"+(i-1||""):"parentData",be=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+H+" , "+be+" , rootData ) ";var Ae=r;r=X.pop(),x.errors===!1?(r+=" "+d+" = ",D&&(r+="await "),r+=""+Ae+"; "):D?(F="customErrors"+n,r+=" var "+F+" = null; try { "+d+" = await "+Ae+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+F+" = e.errors; else throw e; } "):r+=" "+F+" = null; "+d+" = "+Ae+"; "}if(x.modifying&&(r+=" if ("+H+") "+_+" = "+H+"["+be+"];"),r+=""+T,x.valid)f&&(r+=" if (true) { ");else{r+=" if ( ",x.valid===void 0?(r+=" !",W?r+=""+ue:r+=""+d):r+=" "+!x.valid+" ",r+=") { ",h=S.keyword;var X=X||[];X.push(r),r="";var X=X||[];X.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var $e=r;r=X.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$e+"]); ":r+=" validate.errors = ["+$e+"]; return false; ":r+=" var err = "+$e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ne=r;r=X.pop(),C?x.errors?x.errors!="full"&&(r+=" for (var "+q+"="+y+"; "+q+"<errors; "+q+"++) { var "+I+" = vErrors["+q+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(r+=" "+I+".schema = "+g+"; "+I+".data = "+_+"; "),r+=" } "):x.errors===!1?r+=" "+ne+" ":(r+=" if ("+y+" == errors) { "+ne+" } else { for (var "+q+"="+y+"; "+q+"<errors; "+q+"++) { var "+I+" = vErrors["+q+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+I+".schemaPath === undefined) { "+I+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(r+=" "+I+".schema = "+g+"; "+I+".data = "+_+"; "),r+=" } } "):W?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):x.errors===!1?r+=" "+ne+" ":(r+=" if (Array.isArray("+F+")) { if (vErrors === null) vErrors = "+F+"; else vErrors = vErrors.concat("+F+"); errors = vErrors.length; for (var "+q+"="+y+"; "+q+"<errors; "+q+"++) { var "+I+" = vErrors["+q+"]; if ("+I+".dataPath === undefined) "+I+".dataPath = (dataPath || '') + "+e.errorPath+"; "+I+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(r+=" "+I+".schema = "+g+"; "+I+".data = "+_+"; "),r+=" } } else { "+ne+" } "),r+=" } ",f&&(r+=" else { ")}return r}});var fn=Q((fv,Bp)=>{Bp.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var cl=Q((hv,ll)=>{"use strict";var ol=fn();ll.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:ol.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:ol.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var dl=Q((mv,ul)=>{"use strict";var Qp=/^[a-z_$][a-z0-9_$-]*$/i,Gp=il(),Jp=cl();ul.exports={add:Kp,get:Xp,remove:Yp,validate:hn};function Kp(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Qp.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)i(a,s[r],e);else i(a,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[a]=t.all[a]=!0;function i(o,c,u){for(var f,h=0;h<t.length;h++){var _=t[h];if(_.type==c){f=_;break}}f||(f={type:c,rules:[]},t.push(f));var d={keyword:o,definition:u,custom:!0,code:Gp,implements:u.implements};f.rules.push(d),t.custom[o]=d}return this}function Xp(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Yp(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function hn(a,e){hn.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Jp,!0);if(t(a))return!0;if(hn.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var pl=Q((vv,ef)=>{ef.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Pl=Q((gv,wl)=>{"use strict";var hl=Wi(),dt=Va(),rf=Zi(),ml=Xs(),tf=sn(),af=so(),sf=Xo(),vl=rl(),gl=ut();wl.exports=Pe;Pe.prototype.validate=of;Pe.prototype.compile=lf;Pe.prototype.addSchema=cf;Pe.prototype.addMetaSchema=uf;Pe.prototype.validateSchema=df;Pe.prototype.getSchema=ff;Pe.prototype.removeSchema=mf;Pe.prototype.addFormat=Sf;Pe.prototype.errorsText=Pf;Pe.prototype._addSchema=vf;Pe.prototype._compile=gf;Pe.prototype.compileAsync=sl();var Xa=dl();Pe.prototype.addKeyword=Xa.add;Pe.prototype.getKeyword=Xa.get;Pe.prototype.removeKeyword=Xa.remove;Pe.prototype.validateKeyword=Xa.validate;var yl=Wa();Pe.ValidationError=yl.Validation;Pe.MissingRefError=yl.MissingRef;Pe.$dataMetaSchema=vl;var Ka="http://json-schema.org/draft-07/schema",fl=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],nf=["/properties"];function Pe(a){if(!(this instanceof Pe))return new Pe(a);a=this._opts=gl.copy(a)||{},If(this),this._schemas={},this._refs={},this._fragments={},this._formats=af(a.format),this._cache=a.cache||new rf,this._loadingSchemas={},this._compilations=[],this.RULES=sf(),this._getId=yf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=tf),this._metaOpts=kf(this),a.formats&&Rf(this),a.keywords&&Tf(this),xf(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Ef(this)}function of(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function lf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function cf(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=dt.normalizeId(e||n),bl(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function uf(a,e,t){return this.addSchema(a,e,t,!0),this}function df(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||pf(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function pf(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(Ka)?Ka:void 0,a._opts.defaultMeta}function ff(a){var e=_l(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return hf(this,a)}}function hf(a,e){var t=dt.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,i=hl.call(a,s,r,void 0,n);return a._fragments[e]=new ml({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function _l(a,e){return e=dt.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function mf(a){if(a instanceof RegExp)return Ja(this,this._schemas,a),Ja(this,this._refs,a),this;switch(typeof a){case"undefined":return Ja(this,this._schemas),Ja(this,this._refs),this._cache.clear(),this;case"string":var e=_l(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=dt.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Ja(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function vf(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,i=this._cache.get(n);if(i)return i;s=s||this._opts.addUsedSchema!==!1;var o=dt.normalizeId(this._getId(a));o&&s&&bl(this,o);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=o&&o==dt.normalizeId(a.$schema))&&this.validateSchema(a,!0);var f=dt.ids.call(this,a),h=new ml({id:o,schema:a,localRefs:f,cacheKey:n,meta:t});return o[0]!="#"&&s&&(this._refs[o]=h),this._cache.put(n,h),c&&u&&this.validateSchema(a,!0),h}function gf(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=hl.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,i=n.apply(this,arguments);return r.errors=n.errors,i}}function yf(a){switch(a.schemaId){case"auto":return wf;case"id":return _f;default:return bf}}function _f(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function bf(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function wf(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function Pf(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var i=a[n];i&&(r+=s+i.dataPath+" "+i.message+t)}return r.slice(0,-t.length)}function Sf(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function xf(a){var e;if(a._opts.$data&&(e=pl(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=fn();a._opts.$data&&(t=vl(t,nf)),a.addMetaSchema(t,Ka,!0),a._refs["http://json-schema.org/schema"]=Ka}}function Ef(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function Rf(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function Tf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function bl(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function kf(a){for(var e=gl.copy(a._opts),t=0;t<fl.length;t++)delete e[fl[t]];return e}function If(a){var e=a._opts.logger;if(e===!1)a.logger={log:mn,warn:mn,error:mn};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function mn(){}});Sr();var l={};Nn(l,{BRAND:()=>Su,DIRTY:()=>Qr,EMPTY_PATH:()=>ru,INVALID:()=>Z,NEVER:()=>od,OK:()=>Ce,ParseStatus:()=>Ie,Schema:()=>J,ZodAny:()=>Dr,ZodArray:()=>Tr,ZodBigInt:()=>Jr,ZodBoolean:()=>Kr,ZodBranded:()=>Qt,ZodCatch:()=>lt,ZodDate:()=>Xr,ZodDefault:()=>ot,ZodDiscriminatedUnion:()=>ma,ZodEffects:()=>Xe,ZodEnum:()=>nt,ZodError:()=>qe,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>ga,ZodIntersection:()=>tt,ZodIssueCode:()=>R,ZodLazy:()=>at,ZodLiteral:()=>st,ZodMap:()=>kt,ZodNaN:()=>At,ZodNativeEnum:()=>it,ZodNever:()=>tr,ZodNull:()=>et,ZodNullable:()=>dr,ZodNumber:()=>Gr,ZodObject:()=>Me,ZodOptional:()=>Je,ZodParsedType:()=>N,ZodPipeline:()=>Gt,ZodPromise:()=>jr,ZodReadonly:()=>ct,ZodRecord:()=>va,ZodSchema:()=>J,ZodSet:()=>It,ZodString:()=>$r,ZodSymbol:()=>Rt,ZodTransformer:()=>Xe,ZodTuple:()=>ur,ZodType:()=>J,ZodUndefined:()=>Yr,ZodUnion:()=>rt,ZodUnknown:()=>Rr,ZodVoid:()=>Tt,addIssueToContext:()=>j,any:()=>Cu,array:()=>Nu,bigint:()=>Tu,boolean:()=>ri,coerce:()=>id,custom:()=>Xn,date:()=>ku,datetimeRegex:()=>Jn,defaultErrorMap:()=>xr,discriminatedUnion:()=>Fu,effect:()=>Xu,enum:()=>Gu,function:()=>Zu,getErrorMap:()=>St,getParsedType:()=>cr,instanceof:()=>Eu,intersection:()=>zu,isAborted:()=>fa,isAsync:()=>xt,isDirty:()=>ha,isValid:()=>Cr,late:()=>xu,lazy:()=>Bu,literal:()=>Qu,makeIssue:()=>Bt,map:()=>Wu,nan:()=>Ru,nativeEnum:()=>Ju,never:()=>Du,null:()=>Ou,nullable:()=>ed,number:()=>ei,object:()=>Lu,objectUtil:()=>As,oboolean:()=>nd,onumber:()=>sd,optional:()=>Yu,ostring:()=>ad,pipeline:()=>td,preprocess:()=>rd,promise:()=>Ku,quotelessJson:()=>Xc,record:()=>Vu,set:()=>Hu,setErrorMap:()=>eu,strictObject:()=>qu,string:()=>Yn,symbol:()=>Iu,transformer:()=>Xu,tuple:()=>Uu,undefined:()=>Au,union:()=>Mu,unknown:()=>$u,util:()=>ee,void:()=>ju});var ee;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(let o of n)i[o]=r[o];return a.objectValues(i)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(ee||(ee={}));var As;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(As||(As={}));var N=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),cr=a=>{switch(typeof a){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(a)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(a)?N.array:a===null?N.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?N.promise:typeof Map<"u"&&a instanceof Map?N.map:typeof Set<"u"&&a instanceof Set?N.set:typeof Date<"u"&&a instanceof Date?N.date:N.object;default:return N.unknown}};var R=ee.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"]),Xc=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),qe=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};qe.create=a=>new qe(a);var Yc=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===N.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,ee.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${ee.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ee.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${ee.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:ee.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,ee.assertNever(a)}return{message:t}},xr=Yc;var Hn=xr;function eu(a){Hn=a}function St(){return Hn}var Bt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",c=s.filter(u=>!!u).slice().reverse();for(let u of c)o=u(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},ru=[];function j(a,e){let t=St(),s=Bt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===xr?void 0:xr].filter(r=>!!r)});a.common.issues.push(s)}var Ie=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return Z;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return Z;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},Z=Object.freeze({status:"aborted"}),Qr=a=>({status:"dirty",value:a}),Ce=a=>({status:"valid",value:a}),fa=a=>a.status==="aborted",ha=a=>a.status==="dirty",Cr=a=>a.status==="valid",xt=a=>typeof Promise<"u"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Ke=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}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}},Zn=(a,e)=>{if(Cr(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new qe(a.common.issues);return this._error=t,this._error}}};function G(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{let{message:c}=a;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:r}}var J=class{get description(){return this._def.description}_getType(e){return cr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ie,ctx:{common:e.parent.common,data:e.data,parsedType:cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(xt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Zn(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cr(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return Cr(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Cr(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:cr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(xt(r)?r:Promise.resolve(r));return Zn(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let i=e(r),o=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Xe({schema:this,typeName:k.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:t=>this["~validate"](t)}}optional(){return Je.create(this,this._def)}nullable(){return dr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Tr.create(this)}promise(){return jr.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return tt.create(this,e,this._def)}transform(e){return new Xe({...G(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ot({...G(this._def),innerType:this,defaultValue:t,typeName:k.ZodDefault})}brand(){return new Qt({typeName:k.ZodBranded,type:this,...G(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new lt({...G(this._def),innerType:this,catchValue:t,typeName:k.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Gt.create(this,e)}readonly(){return ct.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},tu=/^c[^\s-]{8,}$/i,au=/^[0-9a-z]+$/,su=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nu=/^[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,iu=/^[a-z0-9_-]{21}$/i,ou=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lu=/^[-+]?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)?)??$/,cu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Os,du=/^(?:(?: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])$/,pu=/^(?:(?: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])$/,fu=/^(([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]))$/,hu=/^(([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])$/,mu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qn="((\\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])))",gu=new RegExp(`^${Qn}$`);function Gn(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function yu(a){return new RegExp(`^${Gn(a)}$`)}function Jn(a){let e=`${Qn}T${Gn(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function _u(a,e){return!!((e==="v4"||!e)&&du.test(a)||(e==="v6"||!e)&&fu.test(a))}function bu(a,e){if(!ou.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function wu(a,e){return!!((e==="v4"||!e)&&pu.test(a)||(e==="v6"||!e)&&hu.test(a))}var $r=class a extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.string){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_type,expected:N.string,received:n.parsedType}),Z}let s=new Ie,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?j(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&j(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")cu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Os||(Os=new RegExp(uu,"u")),Os.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")nu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")iu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")tu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")au.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")su.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),j(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"regex",code:R.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Jn(n).test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?gu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?yu(n).test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?lu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?_u(e.data,n.version)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?bu(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?wu(e.data,n.version)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?mu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?vu.test(e.data)||(r=this._getOrReturnCtx(e,r),j(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):ee.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.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,...V.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,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...V.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};$r.create=a=>new $r({checks:[],typeName:k.ZodString,coerce:a?.coerce??!1,...G(a)});function Pu(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Gr=class a extends J{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)!==N.number){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_type,expected:N.number,received:n.parsedType}),Z}let s,r=new Ie;for(let n of this._def.checks)n.kind==="int"?ee.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Pu(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),j(s,{code:R.not_finite,message:n.message}),r.dirty()):ee.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ee.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Gr.create=a=>new Gr({checks:[],typeName:k.ZodNumber,coerce:a?.coerce||!1,...G(a)});var Jr=class a extends J{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)!==N.bigint)return this._getInvalidInput(e);let s,r=new Ie;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),j(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ee.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:R.invalid_type,expected:N.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Jr.create=a=>new Jr({checks:[],typeName:k.ZodBigInt,coerce:a?.coerce??!1,...G(a)});var Kr=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.boolean){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.boolean,received:s.parsedType}),Z}return Ce(e.data)}};Kr.create=a=>new Kr({typeName:k.ZodBoolean,coerce:a?.coerce||!1,...G(a)});var Xr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.date){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_type,expected:N.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:R.invalid_date}),Z}let s=new Ie,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),j(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):ee.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Xr.create=a=>new Xr({checks:[],coerce:a?.coerce||!1,typeName:k.ZodDate,...G(a)});var Rt=class extends J{_parse(e){if(this._getType(e)!==N.symbol){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.symbol,received:s.parsedType}),Z}return Ce(e.data)}};Rt.create=a=>new Rt({typeName:k.ZodSymbol,...G(a)});var Yr=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.undefined,received:s.parsedType}),Z}return Ce(e.data)}};Yr.create=a=>new Yr({typeName:k.ZodUndefined,...G(a)});var et=class extends J{_parse(e){if(this._getType(e)!==N.null){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.null,received:s.parsedType}),Z}return Ce(e.data)}};et.create=a=>new et({typeName:k.ZodNull,...G(a)});var Dr=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Ce(e.data)}};Dr.create=a=>new Dr({typeName:k.ZodAny,...G(a)});var Rr=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ce(e.data)}};Rr.create=a=>new Rr({typeName:k.ZodUnknown,...G(a)});var tr=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:R.invalid_type,expected:N.never,received:t.parsedType}),Z}};tr.create=a=>new tr({typeName:k.ZodNever,...G(a)});var Tt=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.void,received:s.parsedType}),Z}return Ce(e.data)}};Tt.create=a=>new Tt({typeName:k.ZodVoid,...G(a)});var Tr=class a extends J{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==N.array)return j(t,{code:R.invalid_type,expected:N.array,received:t.parsedType}),Z;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(j(t,{code:i?R.too_big:R.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(j(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(j(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new Ke(t,i,t.path,o)))).then(i=>Ie.mergeArray(s,i));let n=[...t.data].map((i,o)=>r.type._parseSync(new Ke(t,i,t.path,o)));return Ie.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};Tr.create=(a,e)=>new Tr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...G(e)});function Et(a){if(a instanceof Me){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Je.create(Et(s))}return new Me({...a._def,shape:()=>e})}else return a instanceof Tr?new Tr({...a._def,type:Et(a.element)}):a instanceof Je?Je.create(Et(a.unwrap())):a instanceof dr?dr.create(Et(a.unwrap())):a instanceof ur?ur.create(a.items.map(e=>Et(e))):a}var Me=class a extends J{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(),t=ee.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let u=this._getOrReturnCtx(e);return j(u,{code:R.invalid_type,expected:N.object,received:u.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof tr&&this._def.unknownKeys==="strip"))for(let u in r.data)i.includes(u)||o.push(u);let c=[];for(let u of i){let f=n[u],h=r.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new Ke(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof tr){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(u==="strict")o.length>0&&(j(r,{code:R.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of o){let h=r.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new Ke(r,h,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of c){let h=await f.key,_=await f.value;u.push({key:h,value:_,alwaysSet:f.alwaysSet})}return u}).then(u=>Ie.mergeObjectSync(s,u)):Ie.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:V.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of ee.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of ee.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return Et(this)}partial(e){let t={};for(let s of ee.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of ee.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Je;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Kn(ee.objectKeys(this.shape))}};Me.create=(a,e)=>new Me({shape:()=>a,unknownKeys:"strip",catchall:tr.create(),typeName:k.ZodObject,...G(e)});Me.strictCreate=(a,e)=>new Me({shape:()=>a,unknownKeys:"strict",catchall:tr.create(),typeName:k.ZodObject,...G(e)});Me.lazycreate=(a,e)=>new Me({shape:a,unknownKeys:"strip",catchall:tr.create(),typeName:k.ZodObject,...G(e)});var rt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=n.map(o=>new qe(o.ctx.common.issues));return j(t,{code:R.invalid_union,unionErrors:i}),Z}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let c of s){let u={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!n&&(n={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=i.map(c=>new qe(c));return j(t,{code:R.invalid_union,unionErrors:o}),Z}}get options(){return this._def.options}};rt.create=(a,e)=>new rt({options:a,typeName:k.ZodUnion,...G(e)});var Er=a=>a instanceof at?Er(a.schema):a instanceof Xe?Er(a.innerType()):a instanceof st?[a.value]:a instanceof nt?a.options:a instanceof it?ee.objectValues(a.enum):a instanceof ot?Er(a._def.innerType):a instanceof Yr?[void 0]:a instanceof et?[null]:a instanceof Je?[void 0,...Er(a.unwrap())]:a instanceof dr?[null,...Er(a.unwrap())]:a instanceof Qt||a instanceof ct?Er(a.unwrap()):a instanceof lt?Er(a._def.innerType):[],ma=class a extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return j(t,{code:R.invalid_type,expected:N.object,received:t.parsedType}),Z;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(j(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=Er(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...G(s)})}};function Cs(a,e){let t=cr(a),s=cr(e);if(a===e)return{valid:!0,data:a};if(t===N.object&&s===N.object){let r=ee.objectKeys(e),n=ee.objectKeys(a).filter(o=>r.indexOf(o)!==-1),i={...a,...e};for(let o of n){let c=Cs(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===N.array&&s===N.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let i=a[n],o=e[n],c=Cs(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===N.date&&s===N.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var tt=class extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,i)=>{if(fa(n)||fa(i))return Z;let o=Cs(n.value,i.value);return o.valid?((ha(n)||ha(i))&&t.dirty(),{status:t.value,value:o.data}):(j(s,{code:R.invalid_intersection_types}),Z)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};tt.create=(a,e,t)=>new tt({left:a,right:e,typeName:k.ZodIntersection,...G(t)});var ur=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.array)return j(s,{code:R.invalid_type,expected:N.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return j(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&s.data.length>this._def.items.length&&(j(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Ke(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Ie.mergeArray(t,i)):Ie.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};ur.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ur({items:a,typeName:k.ZodTuple,rest:null,...G(e)})};var va=class a extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.object)return j(s,{code:R.invalid_type,expected:N.object,received:s.parsedType}),Z;let r=[],n=this._def.keyType,i=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new Ke(s,o,s.path,o)),value:i._parse(new Ke(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Ie.mergeObjectAsync(t,r):Ie.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof J?new a({keyType:e,valueType:t,typeName:k.ZodRecord,...G(s)}):new a({keyType:$r.create(),valueType:e,typeName:k.ZodRecord,...G(t)})}},kt=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.map)return j(s,{code:R.invalid_type,expected:N.map,received:s.parsedType}),Z;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new Ke(s,o,s.path,[u,"key"])),value:n._parse(new Ke(s,c,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return Z;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of i){let u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return Z;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}}}};kt.create=(a,e,t)=>new kt({valueType:e,keyType:a,typeName:k.ZodMap,...G(t)});var It=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.set)return j(s,{code:R.invalid_type,expected:N.set,received:s.parsedType}),Z;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(j(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(j(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(c){let u=new Set;for(let f of c){if(f.status==="aborted")return Z;f.status==="dirty"&&t.dirty(),u.add(f.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((c,u)=>n._parse(new Ke(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};It.create=(a,e)=>new It({valueType:a,minSize:null,maxSize:null,typeName:k.ZodSet,...G(e)});var ga=class a extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return j(t,{code:R.invalid_type,expected:N.function,received:t.parsedType}),Z;function s(o,c){return Bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),xr].filter(u=>!!u),issueData:{code:R.invalid_arguments,argumentsError:c}})}function r(o,c){return Bt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),xr].filter(u=>!!u),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof jr){let o=this;return Ce(async function(...c){let u=new qe([]),f=await o._def.args.parseAsync(c,n).catch(d=>{throw u.addIssue(s(c,d)),u}),h=await Reflect.apply(i,this,f);return await o._def.returns._def.type.parseAsync(h,n).catch(d=>{throw u.addIssue(r(h,d)),u})})}else{let o=this;return Ce(function(...c){let u=o._def.args.safeParse(c,n);if(!u.success)throw new qe([s(c,u.error)]);let f=Reflect.apply(i,this,u.data),h=o._def.returns.safeParse(f,n);if(!h.success)throw new qe([r(f,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:ur.create(e).rest(Rr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||ur.create([]).rest(Rr.create()),returns:t||Rr.create(),typeName:k.ZodFunction,...G(s)})}},at=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};at.create=(a,e)=>new at({getter:a,typeName:k.ZodLazy,...G(e)});var st=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};st.create=(a,e)=>new st({value:a,typeName:k.ZodLiteral,...G(e)});function Kn(a,e){return new nt({values:a,typeName:k.ZodEnum,...G(e)})}var nt=class a extends J{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{expected:ee.joinValues(s),received:t.parsedType,code:R.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return j(t,{received:t.data,code:R.invalid_enum_value,options:s}),Z}return Ce(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};nt.create=Kn;var it=class extends J{_parse(e){let t=ee.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==N.string&&s.parsedType!==N.number){let r=ee.objectValues(t);return j(s,{expected:ee.joinValues(r),received:s.parsedType,code:R.invalid_type}),Z}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=ee.objectValues(t);return j(s,{received:s.data,code:R.invalid_enum_value,options:r}),Z}return Ce(e.data)}get enum(){return this._def.values}};it.create=(a,e)=>new it({values:a,typeName:k.ZodNativeEnum,...G(e)});var jr=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return j(t,{code:R.invalid_type,expected:N.promise,received:t.parsedType}),Z;let s=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Ce(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};jr.create=(a,e)=>new jr({type:a,typeName:k.ZodPromise,...G(e)});var Xe=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{j(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return Z;let c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?Z:c.status==="dirty"?Qr(c.value):t.value==="dirty"?Qr(c.value):c});{if(t.value==="aborted")return Z;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?Z:o.status==="dirty"?Qr(o.value):t.value==="dirty"?Qr(o.value):o}}if(r.type==="refinement"){let i=o=>{let c=r.refinement(o,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Z:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?Z:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Cr(i))return Z;let o=r.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Cr(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:t.value,value:o})):Z);ee.assertNever(r)}};Xe.create=(a,e,t)=>new Xe({schema:a,typeName:k.ZodEffects,effect:e,...G(t)});Xe.createWithPreprocess=(a,e,t)=>new Xe({schema:e,effect:{type:"preprocess",transform:a},typeName:k.ZodEffects,...G(t)});var Je=class extends J{_parse(e){return this._getType(e)===N.undefined?Ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Je.create=(a,e)=>new Je({innerType:a,typeName:k.ZodOptional,...G(e)});var dr=class extends J{_parse(e){return this._getType(e)===N.null?Ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dr.create=(a,e)=>new dr({innerType:a,typeName:k.ZodNullable,...G(e)});var ot=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===N.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ot.create=(a,e)=>new ot({innerType:a,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var lt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return xt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new qe(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new qe(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};lt.create=(a,e)=>new lt({innerType:a,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var At=class extends J{_parse(e){if(this._getType(e)!==N.nan){let s=this._getOrReturnCtx(e);return j(s,{code:R.invalid_type,expected:N.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};At.create=a=>new At({typeName:k.ZodNaN,...G(a)});var Su=Symbol("zod_brand"),Qt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Gt=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?Z:n.status==="dirty"?(t.dirty(),Qr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?Z:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:k.ZodPipeline})}},ct=class extends J{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Cr(r)&&(r.value=Object.freeze(r.value)),r);return xt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};ct.create=(a,e)=>new ct({innerType:a,typeName:k.ZodReadonly,...G(e)});function Bn(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Xn(a,e={},t){return a?Dr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(i=>{if(!i){let o=Bn(e,s),c=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:c})}});if(!n){let i=Bn(e,s),o=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:o})}}):Dr.create()}var xu={object:Me.lazycreate},k;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(k||(k={}));var Eu=(a,e={message:`Input not instance of ${a.name}`})=>Xn(t=>t instanceof a,e),Yn=$r.create,ei=Gr.create,Ru=At.create,Tu=Jr.create,ri=Kr.create,ku=Xr.create,Iu=Rt.create,Au=Yr.create,Ou=et.create,Cu=Dr.create,$u=Rr.create,Du=tr.create,ju=Tt.create,Nu=Tr.create,Lu=Me.create,qu=Me.strictCreate,Mu=rt.create,Fu=ma.create,zu=tt.create,Uu=ur.create,Vu=va.create,Wu=kt.create,Hu=It.create,Zu=ga.create,Bu=at.create,Qu=st.create,Gu=nt.create,Ju=it.create,Ku=jr.create,Xu=Xe.create,Yu=Je.create,ed=dr.create,rd=Xe.createWithPreprocess,td=Gt.create,ad=()=>Yn().optional(),sd=()=>ei().optional(),nd=()=>ri().optional(),id={string:a=>$r.create({...a,coerce:!0}),number:a=>Gr.create({...a,coerce:!0}),boolean:a=>Kr.create({...a,coerce:!0}),bigint:a=>Jr.create({...a,coerce:!0}),date:a=>Xr.create({...a,coerce:!0})};var od=Z;var $s="2025-06-18";var ti=[$s,"2025-03-26","2024-11-05","2024-10-07"],ya="2.0",ai=l.union([l.string(),l.number().int()]),si=l.string(),ld=l.object({progressToken:l.optional(ai)}).passthrough(),Ye=l.object({_meta:l.optional(ld)}).passthrough(),Fe=l.object({method:l.string(),params:l.optional(Ye)}),Jt=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),pr=l.object({method:l.string(),params:l.optional(Jt)}),er=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),_a=l.union([l.string(),l.number().int()]),ni=l.object({jsonrpc:l.literal(ya),id:_a}).merge(Fe).strict(),ii=a=>ni.safeParse(a).success,oi=l.object({jsonrpc:l.literal(ya)}).merge(pr).strict(),li=a=>oi.safeParse(a).success,ci=l.object({jsonrpc:l.literal(ya),id:_a,result:er}).strict(),Ds=a=>ci.safeParse(a).success,he;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(he||(he={}));var ui=l.object({jsonrpc:l.literal(ya),id:_a,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),di=a=>ui.safeParse(a).success,pi=l.union([ni,oi,ci,ui]),ba=er.strict(),wa=pr.extend({method:l.literal("notifications/cancelled"),params:Jt.extend({requestId:_a,reason:l.string().optional()})}),Kt=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),fi=Kt.extend({version:l.string()}),cd=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),js=Fe.extend({method:l.literal("initialize"),params:Ye.extend({protocolVersion:l.string(),capabilities:cd,clientInfo:fi})});var ud=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),dd=er.extend({protocolVersion:l.string(),capabilities:ud,serverInfo:fi,instructions:l.optional(l.string())}),Ns=pr.extend({method:l.literal("notifications/initialized")});var Pa=Fe.extend({method:l.literal("ping")}),pd=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),Sa=pr.extend({method:l.literal("notifications/progress"),params:Jt.merge(pd).extend({progressToken:ai})}),xa=Fe.extend({params:Ye.extend({cursor:l.optional(si)}).optional()}),Ea=er.extend({nextCursor:l.optional(si)}),hi=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),mi=hi.extend({text:l.string()}),Ls=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),vi=hi.extend({blob:Ls}),gi=Kt.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),fd=Kt.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),Ra=xa.extend({method:l.literal("resources/list")}),hd=Ea.extend({resources:l.array(gi)}),Ta=xa.extend({method:l.literal("resources/templates/list")}),md=Ea.extend({resourceTemplates:l.array(fd)}),ka=Fe.extend({method:l.literal("resources/read"),params:Ye.extend({uri:l.string()})}),vd=er.extend({contents:l.array(l.union([mi,vi]))}),gd=pr.extend({method:l.literal("notifications/resources/list_changed")}),yd=Fe.extend({method:l.literal("resources/subscribe"),params:Ye.extend({uri:l.string()})}),_d=Fe.extend({method:l.literal("resources/unsubscribe"),params:Ye.extend({uri:l.string()})}),bd=pr.extend({method:l.literal("notifications/resources/updated"),params:Jt.extend({uri:l.string()})}),wd=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),Pd=Kt.extend({description:l.optional(l.string()),arguments:l.optional(l.array(wd)),_meta:l.optional(l.object({}).passthrough())}),Ia=xa.extend({method:l.literal("prompts/list")}),Sd=Ea.extend({prompts:l.array(Pd)}),Aa=Fe.extend({method:l.literal("prompts/get"),params:Ye.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),qs=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ms=l.object({type:l.literal("image"),data:Ls,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Fs=l.object({type:l.literal("audio"),data:Ls,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),xd=l.object({type:l.literal("resource"),resource:l.union([mi,vi]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ed=gi.extend({type:l.literal("resource_link")}),yi=l.union([qs,Ms,Fs,Ed,xd]),Rd=l.object({role:l.enum(["user","assistant"]),content:yi}).passthrough(),Td=er.extend({description:l.optional(l.string()),messages:l.array(Rd)}),kd=pr.extend({method:l.literal("notifications/prompts/list_changed")}),Id=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),Ad=Kt.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(Id),_meta:l.optional(l.object({}).passthrough())}),Oa=xa.extend({method:l.literal("tools/list")}),Od=Ea.extend({tools:l.array(Ad)}),_i=er.extend({content:l.array(yi).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),gm=_i.or(er.extend({toolResult:l.unknown()})),Ca=Fe.extend({method:l.literal("tools/call"),params:Ye.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),Cd=pr.extend({method:l.literal("notifications/tools/list_changed")}),Xt=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),zs=Fe.extend({method:l.literal("logging/setLevel"),params:Ye.extend({level:Xt})}),$d=pr.extend({method:l.literal("notifications/message"),params:Jt.extend({level:Xt,logger:l.optional(l.string()),data:l.unknown()})}),Dd=l.object({name:l.string().optional()}).passthrough(),jd=l.object({hints:l.optional(l.array(Dd)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),Nd=l.object({role:l.enum(["user","assistant"]),content:l.union([qs,Ms,Fs])}).passthrough(),Ld=Fe.extend({method:l.literal("sampling/createMessage"),params:Ye.extend({messages:l.array(Nd),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(jd)})}),Us=er.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[qs,Ms,Fs])}),qd=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Md=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Fd=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),zd=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),Ud=l.union([qd,Md,Fd,zd]),Vd=Fe.extend({method:l.literal("elicitation/create"),params:Ye.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),Ud),required:l.optional(l.array(l.string()))}).passthrough()})}),Vs=er.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),Wd=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Hd=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),$a=Fe.extend({method:l.literal("completion/complete"),params:Ye.extend({ref:l.union([Hd,Wd]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Zd=er.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Bd=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Qd=Fe.extend({method:l.literal("roots/list")}),Ws=er.extend({roots:l.array(Bd)}),Gd=pr.extend({method:l.literal("notifications/roots/list_changed")}),ym=l.union([Pa,js,$a,zs,Aa,Ia,Ra,Ta,ka,yd,_d,Ca,Oa]),_m=l.union([wa,Sa,Ns,Gd]),bm=l.union([ba,Us,Vs,Ws]),wm=l.union([Pa,Ld,Vd,Qd]),Pm=l.union([wa,Sa,$d,bd,gd,Cd,kd]),Sm=l.union([ba,dd,Zd,Td,Sd,hd,md,vd,_i,Od]),me=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Jd=6e4,Da=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(wa,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Sa,t=>{this._onprogress(t)}),this.setRequestHandler(Pa,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new me(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),Ds(c)||di(c)?this._onresponse(c):ii(c)?this._onrequest(c,u):li(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=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 s=new me(he.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:he.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let c={signal:o.signal,sessionId:i?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,f,h)=>this.request(u,f,{...h,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,c)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var f;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:he.InternalError,message:(f=u.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Ds(e))s(e);else{let r=new me(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}=s??{};return new Promise((o,c)=>{var u,f,h,_,d,y;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(f=s?.signal)===null||f===void 0||f.throwIfAborted();let b=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:b};s?.onprogress&&(this._progressHandlers.set(b,s.onprogress),g.params={...e.params,_meta:{...((h=e.params)===null||h===void 0?void 0:h._meta)||{},progressToken:b}});let S=T=>{var O;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(O=this._transport)===null||O===void 0||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(T)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`))),c(T)};this._responseHandlers.set(b,T=>{var O;if(!(!((O=s?.signal)===null||O===void 0)&&O.aborted)){if(T instanceof Error)return c(T);try{let C=t.parse(T.result);o(C)}catch(C){c(C)}}}),(_=s?.signal)===null||_===void 0||_.addEventListener("abort",()=>{var T;S((T=s?.signal)===null||T===void 0?void 0:T.reason)});let A=(d=s?.timeout)!==null&&d!==void 0?d:Jd,x=()=>S(new me(he.RequestTimeout,"Request timed out",{timeout:A}));this._setupTimeout(b,A,s?.maxTotalTimeout,x,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(g,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(T=>{this._cleanupTimeout(b),c(T)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,t).catch(f=>this._onerror(f))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}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,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function bi(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var Sl=Nc(Pl(),1),Ya=class extends Da{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Xt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(js,r=>this._oninitialize(r)),this.setNotificationHandler(Ns,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(zs,async(r,n)=>{var i;let o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,u=Xt.safeParse(c);return o&&u.success&&this._loggingLevels.set(o,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=bi(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ti.includes(t)?t:$s,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},ba)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Us,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Vs,t);if(s.action==="accept"&&s.content)try{let r=new Sl.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new me(he.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof me?r:new me(he.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ws,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&(!t||!this.isMessageIgnored(e.level,t)))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var El=Symbol("Let zodToJsonSchema decide on which parser to use");var xl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Rl=a=>typeof a=="string"?{...xl,name:a}:{...xl,...a};var Tl=a=>{let e=Rl(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function vn(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function re(a,e,t,s,r){a[e]=t,vn(a,e,s,r)}var es=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function ge(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?es(e,a.currentPath):e.join("/")}}function kl(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==k.ZodAny&&(t.items=B(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&re(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&re(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(re(t,"minItems",a.exactLength.value,a.exactLength.message,e),re(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function Il(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function Al(){return{type:"boolean"}}function rs(a,e){return B(a.type._def,e)}var Ol=(a,e)=>B(a.innerType._def,e);function gn(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>gn(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Af(a,e)}}var Af=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":re(t,"minimum",s.value,s.message,e);break;case"max":re(t,"maximum",s.value,s.message,e);break}return t};function Cl(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function $l(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):ge(e)}function Dl(a){return{type:"string",enum:Array.from(a.values)}}var Of=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function jl(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(Of(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function Nl(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var yn,ar={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(yn===void 0&&(yn=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),yn),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ts(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":re(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":re(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":sr(t,"email",s.message,e);break;case"format:idn-email":sr(t,"idn-email",s.message,e);break;case"pattern:zod":Ne(t,ar.email,s.message,e);break}break;case"url":sr(t,"uri",s.message,e);break;case"uuid":sr(t,"uuid",s.message,e);break;case"regex":Ne(t,s.regex,s.message,e);break;case"cuid":Ne(t,ar.cuid,s.message,e);break;case"cuid2":Ne(t,ar.cuid2,s.message,e);break;case"startsWith":Ne(t,RegExp(`^${_n(s.value,e)}`),s.message,e);break;case"endsWith":Ne(t,RegExp(`${_n(s.value,e)}$`),s.message,e);break;case"datetime":sr(t,"date-time",s.message,e);break;case"date":sr(t,"date",s.message,e);break;case"time":sr(t,"time",s.message,e);break;case"duration":sr(t,"duration",s.message,e);break;case"length":re(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),re(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ne(t,RegExp(_n(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&sr(t,"ipv4",s.message,e),s.version!=="v4"&&sr(t,"ipv6",s.message,e);break}case"base64url":Ne(t,ar.base64url,s.message,e);break;case"jwt":Ne(t,ar.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ne(t,ar.ipv4Cidr,s.message,e),s.version!=="v4"&&Ne(t,ar.ipv6Cidr,s.message,e);break}case"emoji":Ne(t,ar.emoji(),s.message,e);break;case"ulid":{Ne(t,ar.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{sr(t,"binary",s.message,e);break}case"contentEncoding:base64":{re(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ne(t,ar.base64,s.message,e);break}}break}case"nanoid":Ne(t,ar.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function _n(a,e){return e.patternStrategy==="escape"?$f(a):a}var Cf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function $f(a){let e="";for(let t=0;t<a.length;t++)Cf.has(a[t])||(e+="\\"),e+=a[t];return e}function sr(a,e,t,s){a.format||a.anyOf?.some(r=>r.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):re(a,"format",e,t,s)}function Ne(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Ll(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):re(a,"pattern",Ll(e,s),t,s)}function Ll(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,i=!1,o=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(i){if(s[c].match(/[a-z]/)){o?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),o=!1):s[c+1]==="-"&&s[c+2]?.match(/[a-z]/)?(r+=s[c],o=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
11
11
|
]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
|
|
12
12
|
]))`;continue}}if(t.s&&s[c]==="."){r+=i?`${s[c]}\r
|
|
13
13
|
`:`[${s[c]}\r
|
|
14
|
-
]`;continue}r+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(i=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function as(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===k.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??ve(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===k.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=ts(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===k.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===k.ZodBranded&&a.keyType._def.type._def.typeName===k.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=rs(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function ql(a,e){if(e.mapStrategy==="record")return as(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ve(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ve(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Ml(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Fl(a){return a.target==="openAi"?void 0:{not:ve({...a,currentPath:[...a.currentPath,"not"]})}}function zl(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ea={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vl(a,e){if(e.target==="openApi3")return Ul(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in ea&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let i=ea[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:t.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Ul(a,e)}var Ul=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Wl(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:ea[a.innerType._def.typeName],nullable:!0}:{type:[ea[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Hl(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",gn(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function Zl(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let c=n[o];if(c===void 0||c._def===void 0)continue;let u=jf(c);u&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let f=B(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});f!==void 0&&(s.properties[o]=f,u||r.push(o))}r.length&&(s.required=r);let i=Df(a,e);return i!==void 0&&(s.additionalProperties=i),s}function Df(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function jf(a){try{return a.isOptional()}catch{return!0}}var Bl=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:ve(e)},t]}:ve(e)};var Ql=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Gl(a,e){return B(a.type._def,e)}function Jl(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&re(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&re(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Kl(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Xl(a){return{not:ve(a)}}function Yl(a){return ve(a)}var ec=(a,e)=>B(a.innerType._def,e);var rc=(a,e,t)=>{switch(e){case k.ZodString:return ts(a,t);case k.ZodNumber:return Hl(a,t);case k.ZodObject:return Zl(a,t);case k.ZodBigInt:return Il(a,t);case k.ZodBoolean:return Al();case k.ZodDate:return vn(a,t);case k.ZodUndefined:return Xl(t);case k.ZodNull:return zl(t);case k.ZodArray:return kl(a,t);case k.ZodUnion:case k.ZodDiscriminatedUnion:return Vl(a,t);case k.ZodIntersection:return jl(a,t);case k.ZodTuple:return Kl(a,t);case k.ZodRecord:return as(a,t);case k.ZodLiteral:return Nl(a,t);case k.ZodEnum:return Dl(a);case k.ZodNativeEnum:return Ml(a);case k.ZodNullable:return Wl(a,t);case k.ZodOptional:return Bl(a,t);case k.ZodMap:return ql(a,t);case k.ZodSet:return Jl(a,t);case k.ZodLazy:return()=>a.getter()._def;case k.ZodPromise:return Gl(a,t);case k.ZodNaN:case k.ZodNever:return Fl(t);case k.ZodEffects:return $l(a,t);case k.ZodAny:return ve(t);case k.ZodUnknown:return Yl(t);case k.ZodDefault:return Cl(a,t);case k.ZodBranded:return rs(a,t);case k.ZodReadonly:return ec(a,t);case k.ZodCatch:return Ol(a,t);case k.ZodPipeline:return Ql(a,t);case k.ZodFunction:case k.ZodVoid:case k.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let o=e.override?.(a,e,s,t);if(o!==El)return o}if(s&&!t){let o=Nf(s,e);if(o!==void 0)return o}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=rc(a,a.typeName,e),i=typeof n=="function"?B(n(),e):n;if(i&&Lf(a,e,i),e.postProcess){let o=e.postProcess(i,a,e);return r.jsonSchema=i,o}return r.jsonSchema=i,i}var Nf=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:es(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),ve(e)):e.$refStrategy==="seen"?ve(e):void 0}},Lf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var ss=(a,e)=>{let t=Tl(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,f])=>({...c,[u]:B(f._def,{...t,currentPath:[...t.basePath,t.definitionPath,u]},!0)??ve(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??ve(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var bn;(function(a){a.Completable="McpCompletable"})(bn||(bn={}));var Ot=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};Ot.create=(a,e)=>new Ot({type:a,typeName:bn.Completable,complete:e.complete,...qf(e)});function qf(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,u;let{message:f}=a;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(c=f??s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=f??t)!==null&&u!==void 0?u:o.defaultError}},description:r}}var is=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ya(e,t)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Oa.shape.method.value),this.server.assertCanSetRequestHandler(Ca.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Oa,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let s={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?ss(t.inputSchema,{strictUnions:!0}):Mf,annotations:t.annotations};return t.outputSchema&&(s.outputSchema=ss(t.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Ca,async(e,t)=>{let s=this._registeredTools[e.params.name];if(!s)throw new me(he.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new me(he.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(s.inputSchema){let n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new me(he.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);let i=n.data,o=s.callback;try{r=await Promise.resolve(o(i,t))}catch(c){r={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{let n=s.callback;try{r=await Promise.resolve(n(t))}catch(i){r={content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new me(he.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);let n=await s.outputSchema.safeParseAsync(r.structuredContent);if(!n.success)throw new me(he.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler($a.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler($a,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new me(he.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let s=this._registeredPrompts[t.name];if(!s)throw new me(he.InvalidParams,`Prompt ${t.name} not found`);if(!s.enabled)throw new me(he.InvalidParams,`Prompt ${t.name} disabled`);if(!s.argsSchema)return ns;let r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof Ot))return ns;let i=await r._def.complete(e.params.argument.value,e.params.context);return ac(i)}async handleResourceCompletion(e,t){let s=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!s){if(this._registeredResources[t.uri])return ns;throw new me(he.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return ns;let n=await r(e.params.argument.value,e.params.context);return ac(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ra.shape.method.value),this.server.assertCanSetRequestHandler(Ta.shape.method.value),this.server.assertCanSetRequestHandler(ka.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ra,async(e,t)=>{let s=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),r=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let i=await n.resourceTemplate.listCallback(t);for(let o of i.resources)r.push({...n.metadata,...o})}return{resources:[...s,...r]}}),this.server.setRequestHandler(Ta,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,s])=>({name:t,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(ka,async(e,t)=>{let s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new me(he.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,t)}for(let n of Object.values(this._registeredResourceTemplates)){let i=n.resourceTemplate.uriTemplate.match(s.toString());if(i)return n.readCallback(s,i,t)}throw new me(he.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ia.shape.method.value),this.server.assertCanSetRequestHandler(Aa.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ia,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?zf(t.argsSchema):void 0}))})),this.server.setRequestHandler(Aa,async(e,t)=>{let s=this._registeredPrompts[e.params.name];if(!s)throw new me(he.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new me(he.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){let r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new me(he.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);let n=r.data,i=s.callback;return await Promise.resolve(i(n,t))}else{let r=s.callback;return await Promise.resolve(r(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...s){let r;typeof s[0]=="object"&&(r=s.shift());let n=s[0];if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,void 0,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,t,s,r){if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,s.title,t,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,s.title,t,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,s,r,n){let i={name:e,title:t,metadata:r,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==s&&(delete this._registeredResources[s],o.uri&&(this._registeredResources[o.uri]=i)),typeof o.name<"u"&&(i.name=o.name),typeof o.title<"u"&&(i.title=o.title),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=i,i}_createRegisteredResourceTemplate(e,t,s,r,n){let i={resourceTemplate:s,title:t,metadata:r,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.template<"u"&&(i.resourceTemplate=o.template),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,s,r,n){let i={title:t,description:s,argsSchema:r===void 0?void 0:l.object(r),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.description<"u"&&(i.description=o.description),typeof o.argsSchema<"u"&&(i.argsSchema=l.object(o.argsSchema)),typeof o.callback<"u"&&(i.callback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,s,r,n,i,o){let c={title:t,description:s,inputSchema:r===void 0?void 0:l.object(r),outputSchema:n===void 0?void 0:l.object(n),annotations:i,callback:o,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=c)),typeof u.title<"u"&&(c.title=u.title),typeof u.description<"u"&&(c.description=u.description),typeof u.paramsSchema<"u"&&(c.inputSchema=l.object(u.paramsSchema)),typeof u.callback<"u"&&(c.callback=u.callback),typeof u.annotations<"u"&&(c.annotations=u.annotations),typeof u.enabled<"u"&&(c.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,i;if(typeof t[0]=="string"&&(s=t.shift()),t.length>1){let c=t[0];tc(c)?(r=t.shift(),t.length>1&&typeof t[0]=="object"&&t[0]!==null&&!tc(t[0])&&(i=t.shift())):typeof c=="object"&&c!==null&&(i=t.shift())}let o=t[0];return this._createRegisteredTool(e,void 0,s,r,n,i,o)}registerTool(e,t,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:r,description:n,inputSchema:i,outputSchema:o,annotations:c}=t;return this._createRegisteredTool(e,r,n,i,o,c,s)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof t[0]=="string"&&(s=t.shift());let r;t.length>1&&(r=t.shift());let n=t[0],i=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:r,description:n,argsSchema:i}=t,o=this._createRegisteredPrompt(e,r,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Mf={type:"object",properties:{}};function tc(a){return typeof a!="object"||a===null?!1:Object.keys(a).length===0||Object.values(a).some(Ff)}function Ff(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}function zf(a){return Object.entries(a.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))}function ac(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}var ns={completion:{values:[],hasMore:!1}};import nc from"node:process";var os=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
14
|
+
]`;continue}r+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(i=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function as(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===k.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??ge(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===k.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=ts(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===k.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===k.ZodBranded&&a.keyType._def.type._def.typeName===k.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=rs(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function ql(a,e){if(e.mapStrategy==="record")return as(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ge(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ge(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Ml(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Fl(a){return a.target==="openAi"?void 0:{not:ge({...a,currentPath:[...a.currentPath,"not"]})}}function zl(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ea={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vl(a,e){if(e.target==="openApi3")return Ul(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in ea&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let i=ea[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:t.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Ul(a,e)}var Ul=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Wl(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:ea[a.innerType._def.typeName],nullable:!0}:{type:[ea[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Hl(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",vn(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function Zl(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let c=n[o];if(c===void 0||c._def===void 0)continue;let u=jf(c);u&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let f=B(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});f!==void 0&&(s.properties[o]=f,u||r.push(o))}r.length&&(s.required=r);let i=Df(a,e);return i!==void 0&&(s.additionalProperties=i),s}function Df(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function jf(a){try{return a.isOptional()}catch{return!0}}var Bl=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:ge(e)},t]}:ge(e)};var Ql=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Gl(a,e){return B(a.type._def,e)}function Jl(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&re(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&re(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Kl(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Xl(a){return{not:ge(a)}}function Yl(a){return ge(a)}var ec=(a,e)=>B(a.innerType._def,e);var rc=(a,e,t)=>{switch(e){case k.ZodString:return ts(a,t);case k.ZodNumber:return Hl(a,t);case k.ZodObject:return Zl(a,t);case k.ZodBigInt:return Il(a,t);case k.ZodBoolean:return Al();case k.ZodDate:return gn(a,t);case k.ZodUndefined:return Xl(t);case k.ZodNull:return zl(t);case k.ZodArray:return kl(a,t);case k.ZodUnion:case k.ZodDiscriminatedUnion:return Vl(a,t);case k.ZodIntersection:return jl(a,t);case k.ZodTuple:return Kl(a,t);case k.ZodRecord:return as(a,t);case k.ZodLiteral:return Nl(a,t);case k.ZodEnum:return Dl(a);case k.ZodNativeEnum:return Ml(a);case k.ZodNullable:return Wl(a,t);case k.ZodOptional:return Bl(a,t);case k.ZodMap:return ql(a,t);case k.ZodSet:return Jl(a,t);case k.ZodLazy:return()=>a.getter()._def;case k.ZodPromise:return Gl(a,t);case k.ZodNaN:case k.ZodNever:return Fl(t);case k.ZodEffects:return $l(a,t);case k.ZodAny:return ge(t);case k.ZodUnknown:return Yl(t);case k.ZodDefault:return Cl(a,t);case k.ZodBranded:return rs(a,t);case k.ZodReadonly:return ec(a,t);case k.ZodCatch:return Ol(a,t);case k.ZodPipeline:return Ql(a,t);case k.ZodFunction:case k.ZodVoid:case k.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let o=e.override?.(a,e,s,t);if(o!==El)return o}if(s&&!t){let o=Nf(s,e);if(o!==void 0)return o}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=rc(a,a.typeName,e),i=typeof n=="function"?B(n(),e):n;if(i&&Lf(a,e,i),e.postProcess){let o=e.postProcess(i,a,e);return r.jsonSchema=i,o}return r.jsonSchema=i,i}var Nf=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:es(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),ge(e)):e.$refStrategy==="seen"?ge(e):void 0}},Lf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var ss=(a,e)=>{let t=Tl(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,f])=>({...c,[u]:B(f._def,{...t,currentPath:[...t.basePath,t.definitionPath,u]},!0)??ge(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??ge(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var bn;(function(a){a.Completable="McpCompletable"})(bn||(bn={}));var Ot=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};Ot.create=(a,e)=>new Ot({type:a,typeName:bn.Completable,complete:e.complete,...qf(e)});function qf(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,u;let{message:f}=a;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(c=f??s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=f??t)!==null&&u!==void 0?u:o.defaultError}},description:r}}var is=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ya(e,t)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Oa.shape.method.value),this.server.assertCanSetRequestHandler(Ca.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Oa,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let s={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?ss(t.inputSchema,{strictUnions:!0}):Mf,annotations:t.annotations};return t.outputSchema&&(s.outputSchema=ss(t.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Ca,async(e,t)=>{let s=this._registeredTools[e.params.name];if(!s)throw new me(he.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new me(he.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(s.inputSchema){let n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new me(he.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);let i=n.data,o=s.callback;try{r=await Promise.resolve(o(i,t))}catch(c){r={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{let n=s.callback;try{r=await Promise.resolve(n(t))}catch(i){r={content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new me(he.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);let n=await s.outputSchema.safeParseAsync(r.structuredContent);if(!n.success)throw new me(he.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler($a.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler($a,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new me(he.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let s=this._registeredPrompts[t.name];if(!s)throw new me(he.InvalidParams,`Prompt ${t.name} not found`);if(!s.enabled)throw new me(he.InvalidParams,`Prompt ${t.name} disabled`);if(!s.argsSchema)return ns;let r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof Ot))return ns;let i=await r._def.complete(e.params.argument.value,e.params.context);return ac(i)}async handleResourceCompletion(e,t){let s=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!s){if(this._registeredResources[t.uri])return ns;throw new me(he.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return ns;let n=await r(e.params.argument.value,e.params.context);return ac(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ra.shape.method.value),this.server.assertCanSetRequestHandler(Ta.shape.method.value),this.server.assertCanSetRequestHandler(ka.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ra,async(e,t)=>{let s=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),r=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let i=await n.resourceTemplate.listCallback(t);for(let o of i.resources)r.push({...n.metadata,...o})}return{resources:[...s,...r]}}),this.server.setRequestHandler(Ta,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,s])=>({name:t,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(ka,async(e,t)=>{let s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new me(he.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,t)}for(let n of Object.values(this._registeredResourceTemplates)){let i=n.resourceTemplate.uriTemplate.match(s.toString());if(i)return n.readCallback(s,i,t)}throw new me(he.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ia.shape.method.value),this.server.assertCanSetRequestHandler(Aa.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ia,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?zf(t.argsSchema):void 0}))})),this.server.setRequestHandler(Aa,async(e,t)=>{let s=this._registeredPrompts[e.params.name];if(!s)throw new me(he.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new me(he.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){let r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new me(he.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);let n=r.data,i=s.callback;return await Promise.resolve(i(n,t))}else{let r=s.callback;return await Promise.resolve(r(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...s){let r;typeof s[0]=="object"&&(r=s.shift());let n=s[0];if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,void 0,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,t,s,r){if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,s.title,t,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,s.title,t,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,s,r,n){let i={name:e,title:t,metadata:r,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==s&&(delete this._registeredResources[s],o.uri&&(this._registeredResources[o.uri]=i)),typeof o.name<"u"&&(i.name=o.name),typeof o.title<"u"&&(i.title=o.title),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=i,i}_createRegisteredResourceTemplate(e,t,s,r,n){let i={resourceTemplate:s,title:t,metadata:r,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.template<"u"&&(i.resourceTemplate=o.template),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,s,r,n){let i={title:t,description:s,argsSchema:r===void 0?void 0:l.object(r),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.description<"u"&&(i.description=o.description),typeof o.argsSchema<"u"&&(i.argsSchema=l.object(o.argsSchema)),typeof o.callback<"u"&&(i.callback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,s,r,n,i,o){let c={title:t,description:s,inputSchema:r===void 0?void 0:l.object(r),outputSchema:n===void 0?void 0:l.object(n),annotations:i,callback:o,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=c)),typeof u.title<"u"&&(c.title=u.title),typeof u.description<"u"&&(c.description=u.description),typeof u.paramsSchema<"u"&&(c.inputSchema=l.object(u.paramsSchema)),typeof u.callback<"u"&&(c.callback=u.callback),typeof u.annotations<"u"&&(c.annotations=u.annotations),typeof u.enabled<"u"&&(c.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,i;if(typeof t[0]=="string"&&(s=t.shift()),t.length>1){let c=t[0];tc(c)?(r=t.shift(),t.length>1&&typeof t[0]=="object"&&t[0]!==null&&!tc(t[0])&&(i=t.shift())):typeof c=="object"&&c!==null&&(i=t.shift())}let o=t[0];return this._createRegisteredTool(e,void 0,s,r,n,i,o)}registerTool(e,t,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:r,description:n,inputSchema:i,outputSchema:o,annotations:c}=t;return this._createRegisteredTool(e,r,n,i,o,c,s)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof t[0]=="string"&&(s=t.shift());let r;t.length>1&&(r=t.shift());let n=t[0],i=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:r,description:n,argsSchema:i}=t,o=this._createRegisteredPrompt(e,r,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Mf={type:"object",properties:{}};function tc(a){return typeof a!="object"||a===null?!1:Object.keys(a).length===0||Object.values(a).some(Ff)}function Ff(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}function zf(a){return Object.entries(a.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))}function ac(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}var ns={completion:{values:[],hasMore:!1}};import nc from"node:process";var os=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
15
15
|
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Uf(t)}clear(){this._buffer=void 0}};function Uf(a){return pi.parse(JSON.parse(a))}function sc(a){return JSON.stringify(a)+`
|
|
16
|
-
`}var ls=class{constructor(e=nc.stdin,t=nc.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new os,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=sc(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};Sr();var cs=l.object({baseURL:l.string().url(),path:l.string(),method:l.enum(["GET","POST","PUT","DELETE","PATCH"]),queryParams:l.record(l.string()).optional(),body:l.unknown().optional(),correlationId:l.string().optional().describe("Optional correlation ID to group related x402 operations together"),maxAmountPerRequest:l.number().optional().describe("Optional max amount per request in USDC atomic units (1000000 = $1.00)"),paymentRequirements:l.array(l.any()).optional().describe("Optional payment requirements from discovery endpoint - when provided, skips initial 402 discovery")}),us=l.object({baseURL:l.string().url(),path:l.string(),method:l.enum(["GET","POST","PUT","DELETE","PATCH"]),queryParams:l.record(l.string()).optional(),body:l.unknown().optional()}),Ct=l.object({assets:l.array(l.string()).optional(),chain:l.string().optional()}),$t=l.object({network:l.enum(["base","base-sepolia"]).optional().describe('Filter by blockchain network. Defaults to "base" (mainnet).'),full:l.boolean().optional().describe("If true, returns complete details for all resources including schemas, payment requirements, and metadata. If false or omitted, returns summary information only (resource name, description, price, network, quality score).")}),ds=l.object({resource:l.string().url().describe("The resource URL to get full details for")}),Dt=l.object({email:l.string().email("Invalid email format")}),jt=l.object({flowId:l.string().min(1,"Flow ID is required"),otp:l.string().length(6).regex(/^\d{6}$/,"OTP must be 6 digits")}),I0=l.object({recipient:l.string().min(1,"Recipient is required").describe("Recipient address (0x...) or ENS domain"),amountAtomic:l.string().min(1,"Amount is required").describe("Amount to send in USDC atomic units (6 decimals). 1000000 = $1.00 USDC"),chain:l.string().optional().default("base").describe("Blockchain network (default: base)")});Sr();var wn=[{name:"make_http_request_with_x402",config:{title:le.makeX402Request.title,description:le.makeX402Request.description+" Payment amounts are in USDC atomic units (6 decimals). 1,000,000 atomic units = $1.00 USDC.",inputSchema:cs.shape}},{name:"x402_discover_payment_requirements",config:{title:le.discoverX402PaymentRequirements.title,description:le.discoverX402PaymentRequirements.description+" Payment requirements return maxAmountRequired in USDC atomic units (6 decimals). 1000000 atomic units = $1.00 USDC.",inputSchema:us.shape}},{name:"bazaar_list",config:{title:le.bazaarList.title,description:le.bazaarList.description+' Without parameters, returns summary information (resource, description, price, network, quality score) - recommended for browsing to avoid token limits. Pass full=true to get complete details for all resources including schemas, payment requirements, and metadata, but note this response may be very large and could exceed token limits. For single resource details, bazaar_get_resource_details() is more focused. Defaults to "base" mainnet; specify network parameter for testnets.',inputSchema:$t.shape}},{name:"bazaar_get_resource_details",config:{title:le.bazaarGetResourceDetails.title,description:le.bazaarGetResourceDetails.description+" Returns complete API documentation including endpoint URL, HTTP method, required/optional parameters with types, response schema, payment requirements, and usage examples. This provides all metadata needed to construct proper x402 requests to bazaar resources.",inputSchema:ds.shape}},{name:"get_wallet_address",config:{title:le.getWalletAddress.title,description:le.getWalletAddress.description}},{name:"show_wallet_app",config:{title:"Show wallet app",description:"Shows the user the wallet interface. Call this immediately whenever the user is not signed in or when authentication errors occur. This allows the user to sign in to their Coinbase account to enable payment and wallet operations."}},{name:"get_wallet_balance",config:{title:le.getWalletBalance.title,description:le.getWalletBalance.description+" Returns balances for USDC, ETH, and WETH by default. Supports custom token addresses. Amounts are returned in both atomic units (raw field) and formatted display format.",inputSchema:Ct.shape}},{name:"check_session_status",config:{title:le.checkSessionStatus.title,description:le.checkSessionStatus.description+" Use this at the start of conversations to understand authentication state and get guidance on how to help users. IMPORTANT: If the user is not signed in, you MUST immediately call show_wallet_app to help them sign in."}},{name:"sign_in_with_email",config:{title:le.signInWithEmail.title,description:le.signInWithEmail.description+" After calling this, ask the user for the 6-digit code from their email, then call verify_email_otp.",inputSchema:Dt.shape}},{name:"verify_email_otp",config:{title:le.verifyEmailOTP.title,description:le.verifyEmailOTP.description+" Use the flowId from sign_in_with_email and the 6-digit code the user received.",inputSchema:jt.shape}}];var Vf="IMPORTANT: Any payment amounts in this response are in atomic units. For USDC: divide by 1,000,000 to get the dollar amount (e.g., 1,000,000 atomic units = $1.00 USDC). Do not include the atomic units in the response.",Wf="IMPORTANT: The 'maxAmountRequired' field in payment requirements is in atomic units. For USDC: divide by 1000000 to get the dollar amount (e.g., maxAmountRequired: '1000000' = $1.00 USDC). Do not include the atomic units in the response.",Hf="IMPORTANT: USDC amounts are shown in both 'raw' (atomic units with 6 decimals) and 'formatted' (human-readable) versions. For USDC: 1000,000 atomic units = 1.00 USDC. Always use the 'formatted' field when displaying amounts to users. Do not include the atomic units in the response.";function ic(a){return{content:[{type:"text",text:JSON.stringify({result:a,_atomicUnitsNote:Vf},null,2)}]}}function oc(a){return{content:[{type:"text",text:JSON.stringify({result:a,_atomicUnitsNote:Wf},null,2)}]}}function lc(a){return{content:[{type:"text",text:JSON.stringify({balances:a,note:Hf},null,2)}]}}function ps(a){return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}function ra(a){return{content:[{type:"text",text:a}]}}Sr();var ze=class{static async makeX402Request(e){let t=await le.makeX402Request.tool(e);return ic(t)}static async discoverX402PaymentRequirements(e){let t=await le.discoverX402PaymentRequirements.tool(e);return oc(t)}static async bazaarList(e){let t=$t.parse(e||{}),s=await le.bazaarList.tool(t);return ps(s)}static async bazaarGetResourceDetails(e){let t=await le.bazaarGetResourceDetails.tool(e);return ps(t)}static async getWalletAddress(){let e=await le.getWalletAddress.tool();return ra(e)}static async showWalletApp(){return await le.showWindow.tool(),ra("Wallet app launched")}static async getWalletBalance(e){let t=Ct.parse(e||{}),s=await le.getWalletBalance.tool(t);return lc(s)}static async checkSessionStatus(){let e=await le.checkSessionStatus.tool();return ra(e)}static async signInWithEmail(e){let t=Dt.parse(e),s=await le.signInWithEmail.tool(t);return ps(s)}static async verifyEmailOTP(e){let t=jt.parse(e),s=await le.verifyEmailOTP.tool(t);return ra(s)}};br();Es();var Pn=new is({name:"payments-mcp",version:"1.0.0",capabilities:{logging:{}}});_r.initialize(Pn);wn.forEach(a=>{let e=async t=>{switch(a.name){case"make_http_request_with_x402":return ze.makeX402Request(cs.parse(t));case"x402_discover_payment_requirements":return ze.discoverX402PaymentRequirements(us.parse(t));case"bazaar_list":return ze.bazaarList($t.parse(t||{}));case"bazaar_get_resource_details":return ze.bazaarGetResourceDetails(ds.parse(t));case"get_wallet_address":return ze.getWalletAddress();case"show_wallet_app":return ze.showWalletApp();case"get_wallet_balance":return ze.getWalletBalance(Ct.parse(t||{}));case"check_session_status":return ze.checkSessionStatus();case"sign_in_with_email":return ze.signInWithEmail(Dt.parse(t));case"verify_email_otp":return ze.verifyEmailOTP(jt.parse(t));default:throw new Error(`Unknown tool: ${a.name}`)}};Pn.registerTool(a.name,a.config,e)});async function cc(a){let e=process.env.WALLET_STANDALONE==="true";try{if(e)await E.mcp.info({message:"Standalone mode - skipping MCP transport, starting WindowBridge only",pid:process.pid,hasUI:a});else{let t=new ls;await Pn.connect(t),await E.mcp.info({message:"MCP server connected",pid:process.pid,toolCount:wn.length,hasUI:a}),t.onclose=()=>{E.mcp.notice({message:"Transport closed - client disconnected",pid:process.pid}),process.exit(0)}}if(a){await E.bridge.debug({message:"Starting window bridge",pid:process.pid});let{windowReady:t}=await Promise.resolve().then(()=>(Sr(),Zt));await E.bridge.info({message:"Waiting for window to be ready before starting bridge...",pid:process.pid}),await t,await E.bridge.info({message:"Window is ready, starting WindowBridge",pid:process.pid}),xs(async(s,r)=>{let{operations:n}=await Promise.resolve().then(()=>(Sr(),Zt));switch(s){case"bazaar-list":return await n.bazaarList.tool(r);case"bazaar-get-resource-details":return await n.bazaarGetResourceDetails.tool(r);case"make-x402-request":return await n.makeX402Request.tool(r);case"discover-x402-requirements":return await n.discoverX402PaymentRequirements.tool(r);case"get-wallet-address":return await n.getWalletAddress.tool();case"get-wallet-balance":return await n.getWalletBalance.tool(r);case"check-session-status":return await n.checkSessionStatus.tool();case"show-window":await n.showWindow.tool();return;case"sign-in-with-email":return await n.signInWithEmail.tool(r);case"verify-email-otp":return await n.verifyEmailOTP.tool(r);case"send-transaction":return await n.sendTransaction.tool(r);case"execute-swap":return await n.executeSwap.tool(r);default:throw new Error(`Unknown IPC channel: ${s}`)}})}setTimeout(async()=>{try{let s=(await ze.checkSessionStatus()).content?"ready":"not authenticated";await E.mcp.debug({message:"Session authentication check",pid:process.pid,status:s})}catch(t){await E.mcp.error({message:"Session authentication check failed",pid:process.pid,error:t instanceof Error?t.message:String(t)})}},2e3),process.on("uncaughtException",t=>{t.code==="EPIPE"?(E.mcp.notice({message:"EPIPE - client disconnected",pid:process.pid}),process.exit(0)):(E.mcp.critical({message:"Uncaught exception",pid:process.pid,error:t instanceof Error?{message:t.message,stack:t.stack}:String(t)}),a&&Pr(),process.exit(1))}),await new Promise(t=>{process.on("SIGTERM",()=>{E.mcp.notice({message:"Received SIGTERM",pid:process.pid}),t(void 0)}),process.on("SIGINT",()=>{E.mcp.notice({message:"Received SIGINT",pid:process.pid}),t(void 0)})})}catch(t){await E.mcp.error({message:"MCP server error",pid:process.pid,error:t instanceof Error?{message:t.message,stack:t.stack}:String(t)}),a&&Pr(),process.exit(1)}}async function uc(){E.bridge.info({message:"Starting standalone WindowBridge for CLI communication",pid:process.pid});let{windowReady:a}=await Promise.resolve().then(()=>(Sr(),Zt));E.bridge.info({message:"Waiting for window to be ready before starting bridge...",pid:process.pid}),await a,E.bridge.info({message:"Window is ready, starting WindowBridge",pid:process.pid}),xs(async(e,t)=>{let{operations:s}=await Promise.resolve().then(()=>(Sr(),Zt));switch(e){case"bazaar-list":return await s.bazaarList.tool(t);case"bazaar-get-resource-details":return await s.bazaarGetResourceDetails.tool(t);case"make-x402-request":return await s.makeX402Request.tool(t);case"discover-x402-requirements":return await s.discoverX402PaymentRequirements.tool(t);case"get-wallet-address":return await s.getWalletAddress.tool();case"get-wallet-balance":return await s.getWalletBalance.tool(t);case"check-session-status":return await s.checkSessionStatus.tool();case"show-window":await s.showWindow.tool();return;case"sign-in-with-email":return await s.signInWithEmail.tool(t);case"verify-email-otp":return await s.verifyEmailOTP.tool(t);case"send-transaction":return await s.sendTransaction.tool(t);case"execute-swap":return await s.executeSwap.tool(t);default:throw new Error(`Unknown IPC channel: ${e}`)}})}la();br();import ta from"fs";import{execSync as Zf}from"child_process";function Sn(){try{return Zf("ps aux | grep payments-mcp-server | grep -v grep",{encoding:"utf8",stdio:"pipe"}).trim().split(`
|
|
16
|
+
`}var ls=class{constructor(e=nc.stdin,t=nc.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new os,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=sc(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};Sr();var cs=l.object({baseURL:l.string().url(),path:l.string(),method:l.enum(["GET","POST","PUT","DELETE","PATCH"]),queryParams:l.record(l.string()).optional(),body:l.unknown().optional(),headers:l.record(l.string()).optional().describe("Optional custom HTTP headers to include in the request"),correlationId:l.string().optional().describe("Optional correlation ID to group related x402 operations together"),maxAmountPerRequest:l.number().optional().describe("Optional max amount per request in USDC atomic units (1000000 = $1.00)"),paymentRequirements:l.array(l.any()).optional().describe("Optional payment requirements from discovery endpoint - when provided, skips initial 402 discovery")}),us=l.object({baseURL:l.string().url(),path:l.string(),method:l.enum(["GET","POST","PUT","DELETE","PATCH"]),queryParams:l.record(l.string()).optional(),body:l.unknown().optional()}),Ct=l.object({assets:l.array(l.string()).optional(),chain:l.string().optional()}),$t=l.object({network:l.enum(["base","base-sepolia"]).optional().describe('Filter by blockchain network. Defaults to "base" (mainnet).'),full:l.boolean().optional().describe("If true, returns complete details for all resources including schemas, payment requirements, and metadata. If false or omitted, returns summary information only (resource name, description, price, network, quality score).")}),ds=l.object({resource:l.string().url().describe("The resource URL to get full details for")}),Dt=l.object({email:l.string().email("Invalid email format")}),jt=l.object({flowId:l.string().min(1,"Flow ID is required"),otp:l.string().length(6).regex(/^\d{6}$/,"OTP must be 6 digits")}),I0=l.object({recipient:l.string().min(1,"Recipient is required").describe("Recipient address (0x...) or ENS domain"),amountAtomic:l.string().min(1,"Amount is required").describe("Amount to send in USDC atomic units (6 decimals). 1000000 = $1.00 USDC"),chain:l.string().optional().default("base").describe("Blockchain network (default: base)")});Sr();var wn=[{name:"make_http_request_with_x402",config:{title:le.makeX402Request.title,description:le.makeX402Request.description+" Payment amounts are in USDC atomic units (6 decimals). 1,000,000 atomic units = $1.00 USDC.",inputSchema:cs.shape}},{name:"x402_discover_payment_requirements",config:{title:le.discoverX402PaymentRequirements.title,description:le.discoverX402PaymentRequirements.description+" Payment requirements return maxAmountRequired in USDC atomic units (6 decimals). 1000000 atomic units = $1.00 USDC.",inputSchema:us.shape}},{name:"bazaar_list",config:{title:le.bazaarList.title,description:le.bazaarList.description+' Without parameters, returns summary information (resource, description, price, network, quality score) - recommended for browsing to avoid token limits. Pass full=true to get complete details for all resources including schemas, payment requirements, and metadata, but note this response may be very large and could exceed token limits. For single resource details, bazaar_get_resource_details() is more focused. Defaults to "base" mainnet; specify network parameter for testnets.',inputSchema:$t.shape}},{name:"bazaar_get_resource_details",config:{title:le.bazaarGetResourceDetails.title,description:le.bazaarGetResourceDetails.description+" Returns complete API documentation including endpoint URL, HTTP method, required/optional parameters with types, response schema, payment requirements, and usage examples. This provides all metadata needed to construct proper x402 requests to bazaar resources.",inputSchema:ds.shape}},{name:"get_wallet_address",config:{title:le.getWalletAddress.title,description:le.getWalletAddress.description}},{name:"show_wallet_app",config:{title:"Show wallet app",description:"Shows the user the wallet interface. Call this immediately whenever the user is not signed in or when authentication errors occur. This allows the user to sign in to their Coinbase account to enable payment and wallet operations."}},{name:"get_wallet_balance",config:{title:le.getWalletBalance.title,description:le.getWalletBalance.description+" Returns balances for USDC, ETH, and WETH by default. Supports custom token addresses. Amounts are returned in both atomic units (raw field) and formatted display format.",inputSchema:Ct.shape}},{name:"check_session_status",config:{title:le.checkSessionStatus.title,description:le.checkSessionStatus.description+" Use this at the start of conversations to understand authentication state and get guidance on how to help users. IMPORTANT: If the user is not signed in, you MUST immediately call show_wallet_app to help them sign in."}},{name:"sign_in_with_email",config:{title:le.signInWithEmail.title,description:le.signInWithEmail.description+" After calling this, ask the user for the 6-digit code from their email, then call verify_email_otp.",inputSchema:Dt.shape}},{name:"verify_email_otp",config:{title:le.verifyEmailOTP.title,description:le.verifyEmailOTP.description+" Use the flowId from sign_in_with_email and the 6-digit code the user received.",inputSchema:jt.shape}}];var Vf="IMPORTANT: Any payment amounts in this response are in atomic units. For USDC: divide by 1,000,000 to get the dollar amount (e.g., 1,000,000 atomic units = $1.00 USDC). Do not include the atomic units in the response.",Wf="IMPORTANT: The 'maxAmountRequired' field in payment requirements is in atomic units. For USDC: divide by 1000000 to get the dollar amount (e.g., maxAmountRequired: '1000000' = $1.00 USDC). Do not include the atomic units in the response.",Hf="IMPORTANT: USDC amounts are shown in both 'raw' (atomic units with 6 decimals) and 'formatted' (human-readable) versions. For USDC: 1000,000 atomic units = 1.00 USDC. Always use the 'formatted' field when displaying amounts to users. Do not include the atomic units in the response.";function ic(a){return{content:[{type:"text",text:JSON.stringify({result:a,_atomicUnitsNote:Vf},null,2)}]}}function oc(a){return{content:[{type:"text",text:JSON.stringify({result:a,_atomicUnitsNote:Wf},null,2)}]}}function lc(a){return{content:[{type:"text",text:JSON.stringify({balances:a,note:Hf},null,2)}]}}function ps(a){return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}function ra(a){return{content:[{type:"text",text:a}]}}Sr();var ze=class{static async makeX402Request(e){let t=await le.makeX402Request.tool(e);return ic(t)}static async discoverX402PaymentRequirements(e){let t=await le.discoverX402PaymentRequirements.tool(e);return oc(t)}static async bazaarList(e){let t=$t.parse(e||{}),s=await le.bazaarList.tool(t);return ps(s)}static async bazaarGetResourceDetails(e){let t=await le.bazaarGetResourceDetails.tool(e);return ps(t)}static async getWalletAddress(){let e=await le.getWalletAddress.tool();return ra(e)}static async showWalletApp(){return await le.showWindow.tool(),ra("Wallet app launched")}static async getWalletBalance(e){let t=Ct.parse(e||{}),s=await le.getWalletBalance.tool(t);return lc(s)}static async checkSessionStatus(){let e=await le.checkSessionStatus.tool();return ra(e)}static async signInWithEmail(e){let t=Dt.parse(e),s=await le.signInWithEmail.tool(t);return ps(s)}static async verifyEmailOTP(e){let t=jt.parse(e),s=await le.verifyEmailOTP.tool(t);return ra(s)}};br();Es();var Pn=new is({name:"payments-mcp",version:"1.0.0",capabilities:{logging:{}}});_r.initialize(Pn);wn.forEach(a=>{let e=async t=>{switch(a.name){case"make_http_request_with_x402":return ze.makeX402Request(cs.parse(t));case"x402_discover_payment_requirements":return ze.discoverX402PaymentRequirements(us.parse(t));case"bazaar_list":return ze.bazaarList($t.parse(t||{}));case"bazaar_get_resource_details":return ze.bazaarGetResourceDetails(ds.parse(t));case"get_wallet_address":return ze.getWalletAddress();case"show_wallet_app":return ze.showWalletApp();case"get_wallet_balance":return ze.getWalletBalance(Ct.parse(t||{}));case"check_session_status":return ze.checkSessionStatus();case"sign_in_with_email":return ze.signInWithEmail(Dt.parse(t));case"verify_email_otp":return ze.verifyEmailOTP(jt.parse(t));default:throw new Error(`Unknown tool: ${a.name}`)}};Pn.registerTool(a.name,a.config,e)});async function cc(a){let e=process.env.WALLET_STANDALONE==="true";try{if(e)await E.mcp.info({message:"Standalone mode - skipping MCP transport, starting WindowBridge only",pid:process.pid,hasUI:a});else{let t=new ls;await Pn.connect(t),await E.mcp.info({message:"MCP server connected",pid:process.pid,toolCount:wn.length,hasUI:a}),t.onclose=()=>{E.mcp.notice({message:"Transport closed - client disconnected",pid:process.pid}),process.exit(0)}}if(a){await E.bridge.debug({message:"Starting window bridge",pid:process.pid});let{windowReady:t}=await Promise.resolve().then(()=>(Sr(),Zt));await E.bridge.info({message:"Waiting for window to be ready before starting bridge...",pid:process.pid}),await t,await E.bridge.info({message:"Window is ready, starting WindowBridge",pid:process.pid}),xs(async(s,r)=>{let{operations:n}=await Promise.resolve().then(()=>(Sr(),Zt));switch(s){case"bazaar-list":return await n.bazaarList.tool(r);case"bazaar-get-resource-details":return await n.bazaarGetResourceDetails.tool(r);case"make-x402-request":return await n.makeX402Request.tool(r);case"discover-x402-requirements":return await n.discoverX402PaymentRequirements.tool(r);case"get-wallet-address":return await n.getWalletAddress.tool();case"get-wallet-balance":return await n.getWalletBalance.tool(r);case"check-session-status":return await n.checkSessionStatus.tool();case"show-window":await n.showWindow.tool();return;case"sign-in-with-email":return await n.signInWithEmail.tool(r);case"verify-email-otp":return await n.verifyEmailOTP.tool(r);case"send-transaction":return await n.sendTransaction.tool(r);case"execute-swap":return await n.executeSwap.tool(r);default:throw new Error(`Unknown IPC channel: ${s}`)}})}setTimeout(async()=>{try{let s=(await ze.checkSessionStatus()).content?"ready":"not authenticated";await E.mcp.debug({message:"Session authentication check",pid:process.pid,status:s})}catch(t){await E.mcp.error({message:"Session authentication check failed",pid:process.pid,error:t instanceof Error?t.message:String(t)})}},2e3),process.on("uncaughtException",t=>{t.code==="EPIPE"?(E.mcp.notice({message:"EPIPE - client disconnected",pid:process.pid}),process.exit(0)):(E.mcp.critical({message:"Uncaught exception",pid:process.pid,error:t instanceof Error?{message:t.message,stack:t.stack}:String(t)}),a&&Pr(),process.exit(1))}),await new Promise(t=>{process.on("SIGTERM",()=>{E.mcp.notice({message:"Received SIGTERM",pid:process.pid}),t(void 0)}),process.on("SIGINT",()=>{E.mcp.notice({message:"Received SIGINT",pid:process.pid}),t(void 0)})})}catch(t){await E.mcp.error({message:"MCP server error",pid:process.pid,error:t instanceof Error?{message:t.message,stack:t.stack}:String(t)}),a&&Pr(),process.exit(1)}}async function uc(){E.bridge.info({message:"Starting standalone WindowBridge for CLI communication",pid:process.pid});let{windowReady:a}=await Promise.resolve().then(()=>(Sr(),Zt));E.bridge.info({message:"Waiting for window to be ready before starting bridge...",pid:process.pid}),await a,E.bridge.info({message:"Window is ready, starting WindowBridge",pid:process.pid}),xs(async(e,t)=>{let{operations:s}=await Promise.resolve().then(()=>(Sr(),Zt));switch(e){case"bazaar-list":return await s.bazaarList.tool(t);case"bazaar-get-resource-details":return await s.bazaarGetResourceDetails.tool(t);case"make-x402-request":return await s.makeX402Request.tool(t);case"discover-x402-requirements":return await s.discoverX402PaymentRequirements.tool(t);case"get-wallet-address":return await s.getWalletAddress.tool();case"get-wallet-balance":return await s.getWalletBalance.tool(t);case"check-session-status":return await s.checkSessionStatus.tool();case"show-window":await s.showWindow.tool();return;case"sign-in-with-email":return await s.signInWithEmail.tool(t);case"verify-email-otp":return await s.verifyEmailOTP.tool(t);case"send-transaction":return await s.sendTransaction.tool(t);case"execute-swap":return await s.executeSwap.tool(t);default:throw new Error(`Unknown IPC channel: ${e}`)}})}la();br();import ta from"fs";import{execSync as Zf}from"child_process";function Sn(){try{return Zf("ps aux | grep payments-mcp-server | grep -v grep",{encoding:"utf8",stdio:"pipe"}).trim().split(`
|
|
17
17
|
`).filter(t=>t.length>0).length}catch{return 0}}async function Bf(){try{process.title="payments-mcp-server",await E.mcp.info({message:"Process started",pid:process.pid,title:process.title});let a=process.env.WALLET_STANDALONE==="true",e=null,t=n=>{if(E.mcp.notice({message:`stdin closed - ${n}`,pid:process.pid}),Or(),s){let i=Sn()-1;E.mcp.info({message:"Checking other MCP processes",pid:process.pid,otherProcesses:i}),i===0?(E.mcp.info({message:"Last process - closing UI immediately",pid:process.pid}),Is(),setTimeout(()=>{Pr()},500)):(E.mcp.debug({message:"Keeping UI alive for other processes",pid:process.pid,otherProcesses:i}),e||(e=setInterval(()=>{Sn()<=1&&(E.mcp.debug({message:"All other MCP processes have exited - closing UI",pid:process.pid}),e&&clearInterval(e),Pr())},1e3),process.once("exit",()=>{e&&clearInterval(e)})))}else E.mcp.debug({message:"Secondary process exiting",pid:process.pid}),process.exit(0)};process.once("exit",()=>{try{let n="/tmp/payments-mcp-ui-bridge";if(Sn()<=1&&ta.existsSync(n)){console.error("[MCP] Last process exiting - cleaning up all bridge files");let o=`${n}/requests`,c=`${n}/responses`;[o,c].forEach(u=>{ta.existsSync(u)&&ta.readdirSync(u).forEach(h=>{try{ta.unlinkSync(`${u}/${h}`)}catch{}})})}}catch{}});let s=pa();if(a?await E.mcp.info({message:"Standalone mode - stdin monitoring disabled, waiting for window close or SIGTERM"}):(await E.mcp.debug({message:"Setting up stdin EOF monitoring for client quit detection"}),process.stdin.on("end",()=>{t("EOF - MCP client has quit")}),process.stdin.on("error",n=>{E.mcp.error({message:"stdin error - MCP client connection issue",pid:process.pid,error:n instanceof Error?n.message:String(n)}),t("error - MCP client connection issue")}),process.stdin.resume()),s)await E.electron.info({message:"Primary process - launching MCP server with UI",pid:process.pid});else{await E.electron.info({message:"Secondary process - launching MCP server (UI owned by another process)",pid:process.pid});let n="/tmp/payments-mcp-ui.lock",i=setInterval(()=>{ta.existsSync(n)||(E.electron.notice({message:"Primary process is gone (lock file removed), exiting secondary",pid:process.pid}),clearInterval(i),process.exit(0))},1e3);process.once("exit",()=>{clearInterval(i)})}let r=n=>{E.mcp.notice({message:"Process received termination signal",pid:process.pid,signal:n}),Or(),s&&Pr(),setTimeout(()=>{process.exit(0)},100)};process.on("SIGTERM",()=>r("SIGTERM")),process.on("SIGINT",()=>r("SIGINT")),a?(s&&(await E.mcp.info({message:"Standalone mode - starting WindowBridge only (no MCP server)",pid:process.pid}),await uc()),await new Promise(()=>{})):await cc(s)}catch(a){await E.mcp.critical({message:"Error in main",pid:process.pid,error:a instanceof Error?{message:a.message,stack:a.stack}:String(a)}),Pr(),process.exit(1)}}Bf();
|
|
18
18
|
/*! Bundled license information:
|
|
19
19
|
|