@aventurevc/aventure-cli 0.8.210 → 0.8.212

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.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-BgOjrdhk.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-DgQYESOR.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-CofxJXkD.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-BrDruom5.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CxrRvM47.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-OMlYvJGH.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-CWDfXv_9.js`),p=process.argv.slice(2);d(p)&&r(!1),p.includes(`--all-fields`)&&u(!0);try{a();let e=l(p,f);if(e===`stored`||e===`optional`)try{await(e===`stored`?s():o()),await c()}catch(e){n({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-nhld8_m1.js`)}catch(e){if(!(e instanceof t))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
2
+ import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-BgOjrdhk.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-kPpT7zsY.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-CofxJXkD.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-BrDruom5.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CxrRvM47.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-OMlYvJGH.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-CWDfXv_9.js`),p=process.argv.slice(2);d(p)&&r(!1),p.includes(`--all-fields`)&&u(!0);try{a();let e=l(p,f);if(e===`stored`||e===`optional`)try{await(e===`stored`?s():o()),await c()}catch(e){n({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-BEPDQEg9.js`)}catch(e){if(!(e instanceof t))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "MCP_GENERATION_CONTRACT",
4
- "generatedAt": "2026-10-18T20:28:10.440Z",
4
+ "generatedAt": "2026-10-19T01:06:30.812Z",
5
5
  "totalOperations": 137,
6
6
  "note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
7
7
  "operations": [
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{_ as a,f as o,h as s,i as c,m as l,o as u,v as d,x as f}from"./logging-B804Egte.js";import{_ as p,b as m,c as h,i as g,s as _,t as ee,v as te,y as ne}from"./tool-policy-CFolhIHo.js";import{M as re,O as ie,i as v,o as ae,v as oe,w as y,y as b}from"./person-owner-BJgNYLKX.js";import{Ar as se,Br as ce,Fr as le,Hr as ue,Kr as de,Mr as fe,Nr as pe,jr as me,kr as he}from"./dist-5HEinfJJ.js";import{f as ge,i as x,l as S,r as _e}from"./result-envelope-BKs-tese.js";import{a as C,n as ve,r as ye,t as be}from"./package-DPDX5zmx.js";import{i as xe,r as Se}from"./response-problem-DX9IFAZ7.js";import{n as Ce,r as we}from"./output-spill-m6A9usoL.js";import{a as Te,c as Ee,d as De,g as Oe,i as ke,l as Ae,n as w,o as je,p as Me,r as Ne,s as Pe,u as Fe,y as Ie}from"./contract-DP3905M3.js";import{a as Le,c as Re,i as ze,l as Be,n as Ve,s as He,t as Ue}from"./cli-help-policy-DHoe2VhX.js";import{S as We,_ as Ge,a as Ke,g as T,h as qe,i as Je,m as Ye,n as Xe,p as Ze,r as Qe,s as $e,t as et,v as tt,x as E,y as nt}from"./api-key-bearer-credential-CO5ujId2.js";import{a as rt,c as it,d as at,g as ot,l as st,m as ct,o as lt,s as ut,t as dt,u as ft}from"./oauth-bearer-credential-B7dQzjBT.js";import{n as pt,r as mt,t as ht}from"./oauth-login-C9czXvA8.js";import{a as gt,c as _t,d as vt,i as yt,l as bt,n as xt,o as St,s as Ct,t as wt,u as Tt}from"./startup-auth-C2tPYFei.js";import{n as Et,t as D}from"./openapi-commands-BkV5xLPE.js";import{i as O,r as Dt,t as k}from"./output-mode-CtGUoFGj.js";import{spawnSync as Ot}from"node:child_process";import{basename as A,dirname as j,relative as kt,resolve as M,sep as At}from"node:path";import{copyFileSync as jt,existsSync as N,lstatSync as Mt,mkdirSync as Nt,mkdtempSync as Pt,readFileSync as Ft,readdirSync as It,readlinkSync as Lt,realpathSync as Rt,renameSync as zt,symlinkSync as Bt,writeFileSync as Vt}from"node:fs";import P,{stderr as F,stdin as Ht}from"node:process";import{TextDecoder as Ut,inspect as Wt}from"node:util";import{homedir as Gt,hostname as Kt,platform as qt}from"node:os";import{fileURLToPath as Jt}from"node:url";import{setTimeout as Yt}from"node:timers/promises";import{randomUUID as Xt,webcrypto as Zt}from"node:crypto";import{readFile as Qt}from"node:fs/promises";import{createInterface as $t}from"node:readline/promises";function en(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{...x(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return S(`Environment-bound options applied`,r)}function tn(e,t,n){if(!L(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!gn(n,r.name))continue;let a=hn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function nn(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function rn(e,t,n,r=!1){if(r||!I(t)||!Array.isArray(n))return bn(e,t,n);for(let[r,i]of n.entries()){let n=bn(e,t,i,r);if(!n.ok)return n}return S(`Body value assigned`,null)}function an(e,t,n,r){return bn(e,t,r,n)}function on(e){let t=[];for(let n of e.split(`.`)){let e=Sn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function sn(e,t){let n=on(t);if(n===null)return null;let r=mn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:pn(r)}:null}function cn(e,t){if(I(e.name)||e.schemaType===`array`)return S(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return S(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?S(`Scalar body option selected`,t[0]):x(`${n} was already given; pass it once.`)}var ln=/^(?<row>\d+):(?<item>.*)$/su;function un(e,t){let n=on(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=ln.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function dn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&on(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function fn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=sn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return x(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||un(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return x(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function pn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function mn(e,t){let n=e;for(let e of t){if(!L(n))return;n=n[e]??null}return n}function hn(e,t){if(!I(t))return mn(e,t.split(`.`))}function gn(e,t){return vn(e,t.split(`.`))}function _n(e,t,n){if(!L(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&gn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function vn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Sn(n);if(!L(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>vn(e,r)):vn(a,r)}function I(e){return e.split(`.`).some(e=>Sn(e).isArray)}function yn(e,t){return e.parameter.length===0||!L(t)?null:wn(t,[],Cn(e.parameter))}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Sn(o),c=e===i.length-1,l=xn(a,s,t,c,n,r);if(!l.ok||l.data===null)return x(l.summary,l.warnings);if(c)return S(`Body value assigned`,null);a=l.data}return x(`${t} is not a valid body option path.`)}function xn(e,t,n,r,i,a){let o=()=>x(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,S(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,S(`Body path created`,e)}return L(c)?S(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,S(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,S(`Body path created`,n)}return L(s)?S(`Body path stepped`,s):o()}function Sn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Cn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function wn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=wn(r,t,n);if(e!==null)return e}return null}if(!L(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!Tn(a,n)){if(!En(e))continue;let t=Dn(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=wn(i,e,n);if(o!==null)return o}return null}function Tn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function En(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function Dn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:On(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function On(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}var kn=e=>Array.isArray(e)&&!Object.isFrozen(e);function An(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Re(e)),t.description=le(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!kn(e))throw Error(`Commander option list is frozen; generated option help cannot be ordered.`);e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?Rn(r,i):r===void 0?i===void 0?0:1:-1})}function jn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Mn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Nn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:In(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Pn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Fn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?Be(n):`${Be(n)} Required JSON paths: ${r.join(`, `)}.`}function In(e,t){let n=Le(t.description,void 0),r=e.kind!==`multipart`&&I(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${Ln(e,t)}`}function Ln(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=on(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function Rn(e,t){return He(e)-He(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function zn(e){let t;try{t=e===`-`?await Bn():await Qt(e,`utf8`)}catch(t){return x(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return S(`No input provided`,null);let e=JSON.parse(t);return S(`Input parsed`,e)}catch(e){return x(`Input is not valid JSON: ${e.message}`)}}async function Bn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var Vn=`--content-type`;function Hn(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Vn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Vn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Wn(a)))}if(cr(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,Fn(r,r.requiredPath)).argParser(Kn(`--from-file`)))}let o=jn(a).filter(e=>i(R(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>Rn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Mn(n),a.length>1?Nn(n):In(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Pn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Un):I(i.name)||i.schemaType===`array`?o.argParser(Gn):o.argParser(Kn(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}sr(e,n,o)}function Un(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Wn(e){return(t,r)=>{if(r!==void 0)throw new n(`${Vn} was already given; pass it once.`);let i=p(e,t);if(!i.ok)throw new n(i.summary);return t}}function Gn(e,t){return[...t??[],e]}function Kn(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function qn(e,t){let n=St(e,t),r=p(e.requestBody??[],n);if(!r.ok||r.data===null)return x(r.summary,r.warnings);let i=r.data;if(i===void 0)return S(`No body`,void 0);let a=Jn(e,i,t);if(a!==null)return x(a);let o=en(e.operationId,i,t);if(!o.ok)return x(o.summary,o.warnings);t=o.data;let s=Yn(i,t);if(s!==null)return x(s);let c=await $n(t);if(!c.ok)return x(c.summary,c.warnings);let l=_n(e.requestBody??[],i,c.data);if(l!==null)return x(l);let u=Qn(e.operationId,i,c.data);if(!u.ok)return u;let d=tn(e.operationId,i,c.data);if(d!==null)return x(d);let f=er(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?x(or(e.operationId,i)):S(`No body`,void 0);let m=nr(e.operationId,i,c.data,f.data);if(!m.ok||m.data===void 0)return m;if(i.schemaType===`array`&&!Array.isArray(m.data))return x(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!L(m.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return x(`${e.operationId} requires a JSON object${t}.`)}let h=Zn(i,m.data);if(h.length>0)return x(`${e.operationId} requires body option(s): ${h.join(`, `)}`);let g=m.data,_=L(g)?nn(i).filter(e=>!gn(g,e)):[];return _.length>0?x(Xn(e.operationId,i,_)):m}function Jn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${R(t)} requires ${Vn} ${i.join(` or `)}.`}return null}function Yn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Xn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Zn(e,t){return L(t)?e.parameter.filter(e=>e.required&&!gn(t,e.name)).map(R):[]}function Qn(e,t,n){let r=yn(t,n);if(r===null)return S(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return x(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function $n(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return S(`No body file`,void 0);let n=await zn(t);if(!n.ok)return x(n.summary,n.warnings);let r=ge.safeParse(n.data);return r.success?S(`Input parsed`,r.data):x(`Input is not valid JSON value: ${r.error.message}`)}function er(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=cn(e,n[e.optionKey]);if(!a.ok||a.data===null)return x(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=tr(t,n,r,e,o);if(!s.ok)return x(s.summary,s.warnings);i=!0}if(!i)return S(`No direct body options`,void 0);let a=fn(e,t,n,r);return a===null?S(`Direct body options parsed`,r):a}function tr(e,t,n,r,i){let a=un(r,i);if(a===null){let e=ir(r,i);return e.ok?rn(n,r.name,e.data,r.schemaType===`array`):x(e.summary,e.warnings)}if(a.plain.length>0)return x(`${R(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=dn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return x(`${R(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=ar(r.name,r.itemSchemaType,e);if(!t.ok)return x(t.summary,t.warnings);i.push(t.data)}let a=an(n,r.name,e,i);if(!a.ok)return a}return S(`Body value assigned`,null)}var R=e=>e.flag.split(` `)[0]??e.name;function nr(e,t,n,r){if(n===void 0)return S(`Direct body parsed`,r);if(r===void 0)return S(`Input parsed`,n);if(L(n)&&L(r))try{return S(`Input parsed`,rr(t,n,r))}catch(t){return x(`${e} ${t instanceof Error?t.message:String(t)}`)}return x(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function rr(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(L(n)&&L(a))i[t]=rr(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:je.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function ir(e,t){if(typeof t==`boolean`)return S(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return ar(e.name,e.schemaType,t??``);let n=[],r=I(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=ar(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return S(`Body value parsed`,n)}function ar(e,t,n){if(t===`boolean`)return n===`true`?S(`Body value parsed`,!0):n===`false`?S(`Body value parsed`,!1):x(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?x(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?x(`${e} must be an integer.`):S(`Body value parsed`,i)}return S(`Body value parsed`,n)}function or(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(R).join(`, `)}`;let r=nn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(R).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function sr(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Vn,location:`body`}),cr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),An(e.options,r)}function cr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function lr(e){let t=_e(e,Ne(e,D));return vr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function ur(e){let t=_e(e,Ne(e,D));vr(t);let n=ke(D,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=dr(t);r.push(n.endsWith(`
1
+ import{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{_ as a,f as o,h as s,i as c,m as l,o as u,v as d,x as f}from"./logging-B804Egte.js";import{_ as p,b as m,c as h,i as g,s as _,t as ee,v as te,y as ne}from"./tool-policy-CFolhIHo.js";import{M as re,O as ie,i as v,o as ae,v as oe,w as y,y as b}from"./person-owner-BJgNYLKX.js";import{Ar as se,Br as ce,Fr as le,Hr as ue,Kr as de,Mr as fe,Nr as pe,jr as me,kr as he}from"./dist-lPR7ZCpd.js";import{f as ge,i as x,l as S,r as _e}from"./result-envelope-BKs-tese.js";import{a as C,n as ve,r as ye,t as be}from"./package-DPDX5zmx.js";import{i as xe,r as Se}from"./response-problem-DX9IFAZ7.js";import{n as Ce,r as we}from"./output-spill-m6A9usoL.js";import{a as Te,c as Ee,d as De,g as Oe,i as ke,l as Ae,n as w,o as je,p as Me,r as Ne,s as Pe,u as Fe,y as Ie}from"./contract-C73l12W5.js";import{a as Le,c as Re,i as ze,l as Be,n as Ve,s as He,t as Ue}from"./cli-help-policy-DHoe2VhX.js";import{S as We,_ as Ge,a as Ke,g as T,h as qe,i as Je,m as Ye,n as Xe,p as Ze,r as Qe,s as $e,t as et,v as tt,x as E,y as nt}from"./api-key-bearer-credential-CO5ujId2.js";import{a as rt,c as it,d as at,g as ot,l as st,m as ct,o as lt,s as ut,t as dt,u as ft}from"./oauth-bearer-credential-JVhtJb1j.js";import{n as pt,r as mt,t as ht}from"./oauth-login-LkQY76Fs.js";import{a as gt,c as _t,d as vt,i as yt,l as bt,n as xt,o as St,s as Ct,t as wt,u as Tt}from"./startup-auth-C2tPYFei.js";import{n as Et,t as D}from"./openapi-commands-BkV5xLPE.js";import{i as O,r as Dt,t as k}from"./output-mode-CtGUoFGj.js";import{spawnSync as Ot}from"node:child_process";import{basename as A,dirname as j,relative as kt,resolve as M,sep as At}from"node:path";import{copyFileSync as jt,existsSync as N,lstatSync as Mt,mkdirSync as Nt,mkdtempSync as Pt,readFileSync as Ft,readdirSync as It,readlinkSync as Lt,realpathSync as Rt,renameSync as zt,symlinkSync as Bt,writeFileSync as Vt}from"node:fs";import P,{stderr as F,stdin as Ht}from"node:process";import{TextDecoder as Ut,inspect as Wt}from"node:util";import{homedir as Gt,hostname as Kt,platform as qt}from"node:os";import{fileURLToPath as Jt}from"node:url";import{setTimeout as Yt}from"node:timers/promises";import{randomUUID as Xt,webcrypto as Zt}from"node:crypto";import{readFile as Qt}from"node:fs/promises";import{createInterface as $t}from"node:readline/promises";function en(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{...x(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return S(`Environment-bound options applied`,r)}function tn(e,t,n){if(!L(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!gn(n,r.name))continue;let a=hn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function nn(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function rn(e,t,n,r=!1){if(r||!I(t)||!Array.isArray(n))return bn(e,t,n);for(let[r,i]of n.entries()){let n=bn(e,t,i,r);if(!n.ok)return n}return S(`Body value assigned`,null)}function an(e,t,n,r){return bn(e,t,r,n)}function on(e){let t=[];for(let n of e.split(`.`)){let e=Sn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function sn(e,t){let n=on(t);if(n===null)return null;let r=mn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:pn(r)}:null}function cn(e,t){if(I(e.name)||e.schemaType===`array`)return S(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return S(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?S(`Scalar body option selected`,t[0]):x(`${n} was already given; pass it once.`)}var ln=/^(?<row>\d+):(?<item>.*)$/su;function un(e,t){let n=on(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=ln.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function dn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&on(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function fn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=sn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return x(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||un(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return x(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function pn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function mn(e,t){let n=e;for(let e of t){if(!L(n))return;n=n[e]??null}return n}function hn(e,t){if(!I(t))return mn(e,t.split(`.`))}function gn(e,t){return vn(e,t.split(`.`))}function _n(e,t,n){if(!L(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&gn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function vn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Sn(n);if(!L(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>vn(e,r)):vn(a,r)}function I(e){return e.split(`.`).some(e=>Sn(e).isArray)}function yn(e,t){return e.parameter.length===0||!L(t)?null:wn(t,[],Cn(e.parameter))}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Sn(o),c=e===i.length-1,l=xn(a,s,t,c,n,r);if(!l.ok||l.data===null)return x(l.summary,l.warnings);if(c)return S(`Body value assigned`,null);a=l.data}return x(`${t} is not a valid body option path.`)}function xn(e,t,n,r,i,a){let o=()=>x(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,S(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,S(`Body path created`,e)}return L(c)?S(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,S(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,S(`Body path created`,n)}return L(s)?S(`Body path stepped`,s):o()}function Sn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Cn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function wn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=wn(r,t,n);if(e!==null)return e}return null}if(!L(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!Tn(a,n)){if(!En(e))continue;let t=Dn(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=wn(i,e,n);if(o!==null)return o}return null}function Tn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function En(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function Dn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:On(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function On(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}var kn=e=>Array.isArray(e)&&!Object.isFrozen(e);function An(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Re(e)),t.description=le(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!kn(e))throw Error(`Commander option list is frozen; generated option help cannot be ordered.`);e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?Rn(r,i):r===void 0?i===void 0?0:1:-1})}function jn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Mn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Nn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:In(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Pn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Fn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?Be(n):`${Be(n)} Required JSON paths: ${r.join(`, `)}.`}function In(e,t){let n=Le(t.description,void 0),r=e.kind!==`multipart`&&I(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${Ln(e,t)}`}function Ln(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=on(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function Rn(e,t){return He(e)-He(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function zn(e){let t;try{t=e===`-`?await Bn():await Qt(e,`utf8`)}catch(t){return x(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return S(`No input provided`,null);let e=JSON.parse(t);return S(`Input parsed`,e)}catch(e){return x(`Input is not valid JSON: ${e.message}`)}}async function Bn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var Vn=`--content-type`;function Hn(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Vn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Vn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Wn(a)))}if(cr(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,Fn(r,r.requiredPath)).argParser(Kn(`--from-file`)))}let o=jn(a).filter(e=>i(R(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>Rn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Mn(n),a.length>1?Nn(n):In(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Pn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Un):I(i.name)||i.schemaType===`array`?o.argParser(Gn):o.argParser(Kn(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}sr(e,n,o)}function Un(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Wn(e){return(t,r)=>{if(r!==void 0)throw new n(`${Vn} was already given; pass it once.`);let i=p(e,t);if(!i.ok)throw new n(i.summary);return t}}function Gn(e,t){return[...t??[],e]}function Kn(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function qn(e,t){let n=St(e,t),r=p(e.requestBody??[],n);if(!r.ok||r.data===null)return x(r.summary,r.warnings);let i=r.data;if(i===void 0)return S(`No body`,void 0);let a=Jn(e,i,t);if(a!==null)return x(a);let o=en(e.operationId,i,t);if(!o.ok)return x(o.summary,o.warnings);t=o.data;let s=Yn(i,t);if(s!==null)return x(s);let c=await $n(t);if(!c.ok)return x(c.summary,c.warnings);let l=_n(e.requestBody??[],i,c.data);if(l!==null)return x(l);let u=Qn(e.operationId,i,c.data);if(!u.ok)return u;let d=tn(e.operationId,i,c.data);if(d!==null)return x(d);let f=er(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?x(or(e.operationId,i)):S(`No body`,void 0);let m=nr(e.operationId,i,c.data,f.data);if(!m.ok||m.data===void 0)return m;if(i.schemaType===`array`&&!Array.isArray(m.data))return x(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!L(m.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return x(`${e.operationId} requires a JSON object${t}.`)}let h=Zn(i,m.data);if(h.length>0)return x(`${e.operationId} requires body option(s): ${h.join(`, `)}`);let g=m.data,_=L(g)?nn(i).filter(e=>!gn(g,e)):[];return _.length>0?x(Xn(e.operationId,i,_)):m}function Jn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${R(t)} requires ${Vn} ${i.join(` or `)}.`}return null}function Yn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Xn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Zn(e,t){return L(t)?e.parameter.filter(e=>e.required&&!gn(t,e.name)).map(R):[]}function Qn(e,t,n){let r=yn(t,n);if(r===null)return S(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return x(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function $n(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return S(`No body file`,void 0);let n=await zn(t);if(!n.ok)return x(n.summary,n.warnings);let r=ge.safeParse(n.data);return r.success?S(`Input parsed`,r.data):x(`Input is not valid JSON value: ${r.error.message}`)}function er(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=cn(e,n[e.optionKey]);if(!a.ok||a.data===null)return x(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=tr(t,n,r,e,o);if(!s.ok)return x(s.summary,s.warnings);i=!0}if(!i)return S(`No direct body options`,void 0);let a=fn(e,t,n,r);return a===null?S(`Direct body options parsed`,r):a}function tr(e,t,n,r,i){let a=un(r,i);if(a===null){let e=ir(r,i);return e.ok?rn(n,r.name,e.data,r.schemaType===`array`):x(e.summary,e.warnings)}if(a.plain.length>0)return x(`${R(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=dn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return x(`${R(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=ar(r.name,r.itemSchemaType,e);if(!t.ok)return x(t.summary,t.warnings);i.push(t.data)}let a=an(n,r.name,e,i);if(!a.ok)return a}return S(`Body value assigned`,null)}var R=e=>e.flag.split(` `)[0]??e.name;function nr(e,t,n,r){if(n===void 0)return S(`Direct body parsed`,r);if(r===void 0)return S(`Input parsed`,n);if(L(n)&&L(r))try{return S(`Input parsed`,rr(t,n,r))}catch(t){return x(`${e} ${t instanceof Error?t.message:String(t)}`)}return x(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function rr(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(L(n)&&L(a))i[t]=rr(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:je.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function ir(e,t){if(typeof t==`boolean`)return S(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return ar(e.name,e.schemaType,t??``);let n=[],r=I(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=ar(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return S(`Body value parsed`,n)}function ar(e,t,n){if(t===`boolean`)return n===`true`?S(`Body value parsed`,!0):n===`false`?S(`Body value parsed`,!1):x(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?x(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?x(`${e} must be an integer.`):S(`Body value parsed`,i)}return S(`Body value parsed`,n)}function or(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(R).join(`, `)}`;let r=nn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(R).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function sr(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Vn,location:`body`}),cr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),An(e.options,r)}function cr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function lr(e){let t=_e(e,Ne(e,D));return vr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function ur(e){let t=_e(e,Ne(e,D));vr(t);let n=ke(D,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=dr(t);r.push(n.endsWith(`
2
2
  `)?n.slice(0,-1):n),r.push(...e),process.stdout.write(ue(r.join(`
3
3
  `),!0,!0,e.length));return}let i=t.ok?`OK`:`FAIL`;r.push(`[${i}] ${t.summary}`),!t.ok&&t.problem!==void 0&&r.push(...mr(t.problem)),r.push(...dr(t)),process.stdout.write(ue(r.join(`
4
4
  `),!0))}function dr(e){let t=[];e.ids.length>0&&t.push(` ids: ${e.ids.join(`, `)}`);for(let[n,r]of Object.entries(e.counts))t.push(` ${n}: ${r}`);for(let n of e.references)t.push(` ref: ${n}`);if(e.truncation!==void 0){let n=e.truncation.omitted.join(`, `);t.push(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${n}`,` recovery: ${e.truncation.recovery}`)}for(let n of e.warnings)t.push(` warn: ${n}`);return t}function z(e,t){let n=we(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?_e(n,fr(n)):n;vr(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?Ce(t.data):t)}\n`),t.ok||(process.exitCode=1);return}let r=e.mode===`json`?lr(n):n;e.mode===`text`&&ur(r),r.ok||(process.exitCode=1)}function fr(e){let t=Ne(e,D);if(t.write===!0||!e.ok)return t;let n=t.exactRecovery??`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`;return{...t,exactRecovery:`--data printed this truncated result envelope (truncated: true), not the bare payload, so payload paths read as null; rerun with --to-file <path> for the whole payload, or --data-full in a bounded program. ${n}`}}function pr(e,t){let n=Te(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
@@ -0,0 +1,15 @@
1
+ import{n as e}from"./commander-BB7CDPLs.js";import{S as t,a as n,c as r,d as i,f as a,l as o,n as s,o as c,s as l}from"./tool-policy-CFolhIHo.js";import{C as u,O as d,T as f,i as p,l as m,n as h,o as g,p as _,t as ee,u as v,v as y,w as b,y as x}from"./person-owner-BJgNYLKX.js";import{Gr as te,Hr as S,Ir as ne,Ur as re,Vr as ie,Wr as ae}from"./dist-lPR7ZCpd.js";import{a as oe,f as se,i as C,l as ce}from"./result-envelope-BKs-tese.js";import{a as le}from"./package-DPDX5zmx.js";import{a as ue,n as de,r as w,t as fe}from"./text-field-BoNdbrtA.js";import{A as pe,C as me,D as he,E as ge,O as _e,S as ve,T as ye,_ as be,a as xe,b as Se,c as Ce,d as we,f as Te,g as Ee,h as De,i as Oe,k as ke,l as Ae,m as je,n as Me,o as Ne,p as Pe,r as Fe,s as Ie,t as Le,u as Re,v as ze,w as T,x as Be,y as Ve}from"./detail-DCSqEWQn.js";import{a as He,o as Ue}from"./cli-help-policy-DHoe2VhX.js";import{Buffer as We}from"node:buffer";var E=g([`HIGH`,`MEDIUM`,`LOW`]),Ge=g([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),Ke=Object.assign(f([Ge,b()]),{enum:Ge.enum}),qe=x({excerpt:b(),sourceId:b(),sourceType:Ke,sourceVersion:b().nullish()}),Je=x({instruction:b(),operationId:b(),planTaskKey:m(b()).optional(),stepKey:b().optional()}),Ye=x({body:b(),expectation:b(),method:m(b()),override:b(),reject:m(b()),typeCatalog:b()}),Xe=x({cliCommand:b(),mcpTool:b().nullish(),step:Je,writeGuidance:Ye.nullish()}),Ze=g([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),Qe=Object.assign(f([Ze,b()]),{enum:Ze.enum}),$e=x({allowedValue:b().nullish(),description:b(),key:b(),required:v().default(!0).optional(),type:Qe}),et=x({catalogRevision:_().optional(),gateId:m(b()).optional(),input:m($e),step:m(Xe),taskKey:b().optional()}),D=g([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),tt=x({candidate:m(qe),operationId:b().nullish(),outcome:D,probability:y().nullish(),taskKey:b().nullish(),taskPlan:et.nullish()}),nt=x({answer:b(),citation:m(qe),confidence:E,resolution:tt.nullish()});function O(e,t,n=t.inputName){if(t.in===`body`)return n;let r=mt.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?pt(ut(n!==`id`&&n!==`slug`?n:`${ot(e.path)}${lt(n)}`),t):r.inputName}function rt(e,t,n=ct(e)){return it(st(e,t),new Set(n))}function it(e,t){if(!t.has(e))return e;let n=`body${lt(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function at(e,t,n){return`${e}[${t}].${n}`}function ot(e){return ht.find(([,t])=>t.test(e))?.[0]??`record`}function st(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=dt(t);return pt(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?ut(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ct(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>O(e,t)))}function lt(e){return e.replace(/^./u,e=>e.toUpperCase())}function ut(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function dt(e){let t=ut(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ft(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ft(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function pt(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var mt=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],ht=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function gt(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>_t(t,O(e,t))),r=(t?.parameter??[]).map(t=>_t(t,rt(e,t)));return{selector:n.filter(e=>e.location===`path`||vt(e)),pagination:n.filter(yt),filter:[...n.filter(bt),...r.filter(bt)],body:r.filter(e=>!bt(e))}}function _t(e,t){let{in:r,inputName:i,...a}=e;return{...a,flag:n(t),location:r,description:e.description||`${e.name} ${e.in} parameter`}}function vt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function yt(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function bt(e){return e.location!==`path`&&!vt(e)&&!yt(e)}function xt(e){return{operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:Tt(e),responseContentType:[...new Set(e.response.filter(({status:e})=>e.startsWith(`2`)).flatMap(({contentType:e})=>e??[]))]}}function St(e,t){let n=e.requestBody?.[0],r=xt(e),i=Dt(e);return t?{...r,...i===void 0?{}:{paidPlan:i},resource:e.resource,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:gt(e)}:{...r,optionalInput:Et(e),arrayInput:Ot(e),...i===void 0?{}:{paidPlan:i}}}function Ct(e){let t=gt(e),n=e=>e.filter(e=>e.required);return{...St(e,!1),optionalDetailOmitted:!0,argument:{selector:n(t.selector),pagination:n(t.pagination),filter:n(t.filter),body:n(t.body)}}}function wt(e){let{cli:t,scope:n,...r}=xt(e),i=Dt(e);return{...r,...i===void 0?{}:{paidPlan:i},optionalDetailOmitted:!0}}function Tt(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function Et(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}function Dt(e){return e.response.find(({status:e})=>e===`402`)?.description}function Ot(e){return[...e.parameter,...e.requestBody?.[0]?.parameter??[]].filter(({schemaType:e})=>e===`array`).map(({name:e})=>e)}var kt=160,k=`Operation catalog matches`,At=[`whole`,`described`,`requiredDescribed`,`optionalNamed`],jt=e=>`${[k,...e].join(`
2
+ `)}\n`,Mt=e=>re([k,...e]);function Nt(e){if(!Array.isArray(e)||e.length===0||!e.every(Rt))return null;let t=e;for(let e of At){let n=[...t.flatMap(t=>It(t,e)),...Ft(t,e)];if(Mt(n))return jt(n)}let n=e=>[...t.slice(0,e).flatMap(e=>It(e,`optionalNamed`)),...Ft(t.slice(0,e),`optionalNamed`),`... ${t.length-e} more operations omitted to fit ${ie} UTF-8 bytes: ${t.slice(e).map(({operationId:e})=>e).join(`, `)}; call aventure_help with q=<operationId> and limit=1 to read one.`];return jt(n([...t.keys()].findLast(e=>e>0&&Mt(n(e)))??1))}var Pt="the CLI's `aventure help <operationId> --data` prints every input";function Ft(e,t){return e.some(e=>`optionalDetailOmitted`in e)?[e.some(e=>`argument`in e)?`... optional argument details omitted: the full list exceeds the result cap; ${Pt}.`:`... optional inputs omitted: the full list exceeds the result cap; call aventure_help with q=<operationId> and limit=1 to read one operation's inputs.`]:t===`whole`||t===`described`||!e.some(e=>`argument`in e)?[]:[`... ${t===`requiredDescribed`?`optional argument descriptions`:`optional argument details`} omitted to fit ${ie} UTF-8 bytes; structuredContent carries them, and ${Pt}.`]}function It(e,t){let n=`argument`in e?Object.values(e.argument).flat():[],r=n.filter(({required:e})=>!e).map(({name:e})=>e);return[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,` responseContentType: ${e.responseContentType.length===0?`none`:e.responseContentType.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`arrayInput`in e&&e.arrayInput.length>0?[` JSON array inputs: ${e.arrayInput.join(`, `)}`]:[],...`paidPlan`in e&&e.paidPlan!==void 0?[` paid plan: ${e.paidPlan}`]:[],...n.filter(({required:e})=>e||t!==`optionalNamed`).map(e=>Lt(e,e.required||t!==`requiredDescribed`,t)),...t===`optionalNamed`&&r.length>0?[` optional inputs: ${r.join(`, `)}`]:[]]}function Lt(e,t,n){let r=[e.location,e.required?`required`:void 0,e.schemaType,e.schemaFormat,e.schemaEnum===void 0?void 0:`choices: ${e.schemaEnum.join(`, `)}`,e.itemSchemaEnum===void 0?void 0:`item choices: ${e.itemSchemaEnum.join(`, `)}`,e.schemaDefault===void 0?void 0:`default: ${JSON.stringify(e.schemaDefault)}`,e.itemSchemaType===void 0?void 0:`items: ${e.itemSchemaType}${e.itemSchemaFormat===void 0?``:` (${e.itemSchemaFormat})`}`].filter(e=>e!==void 0).join(`, `),i=` ${e.name} (${r})`;return t?`${i}: ${n===`whole`||e.description.length<=kt?e.description:`${e.description.slice(0,157)}...`}`:i}function Rt(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function zt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(Bt);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),i=t(`query`),a=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.replace(/[.[].*$/su,``)))];return{tool:r(e.intent),operationId:e.operationId,...n===void 0?{}:{pathParams:n},...i===void 0?{}:{query:i},...e.requestBody===void 0?{}:{body:Object.fromEntries(a.map(e=>[e,`<${e}>`]))}}}function Bt(e){return[e.name,`<${e.name}>`]}function Vt(e){let t=Ht(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function Ht(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var A=2,Ut=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function j(e,t){let n=P(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&j(e,`person`),Kt(e,Wt(n),n),Kt(e,Gt(n),n))}function Wt(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=A&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;let n=e.endsWith(`es`)?e.slice(0,-2):``;if(n.length>=A&&n!==`us`&&/(?:s|ss|sh|ch|x|z)$/u.test(n))return n;if(e.length>A&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function Gt(e){if(e===`person`)return`people`;if(e!==`new`&&e!==`news`&&e!==`status`&&e!==`us`){if(e.length>=A&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e))return`${e.slice(0,-1)}ies`;if(!(e.length>=A&&e.endsWith(`es`)))return e.length>=A&&/(?:s|ss|sh|ch|x|z)$/u.test(e)?`${e}es`:e.endsWith(`s`)?void 0:`${e}s`}}function Kt(e,t,n){t!==void 0&&t!==n&&t.length>=A&&/^[a-z]+$/u.test(t)&&e.add(t)}function M(e){let t=new Set(N(e)),n=Array.from(t);for(let e of n)j(t,e);return t}function qt(e){return N(e).map(M)}function Jt(e,t){if(e.length===0)return!1;let n=M(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function N(e){return P(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!Ut.has(e))}function P(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}var Yt=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,Xt=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,Zt=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,Qt=250,$t=40,en=100;function tn(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(Xt,()=>(n.add(`uuid`),` `)).replace(Yt,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&Zt.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=Zt.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function nn(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function rn(e,t){let n=new Set;for(let r of e){let e=new Set;j(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function an(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(N(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>nn(t,e,n.path))&&(i+=Qt,r.has(t)&&(i+=$t));if(i===0)return 0;let a=new Set(N(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return j(t,e),[...t].some(e=>a.has(e))}))&&(i+=en),i}var on=40,sn=4,cn=3,ln=1,un=new Map;function dn(e){let n=un.get(e);if(n!==void 0)return n;let r=ne(),i=t(r.paths,e),o=i===null?new Map:a(r,i.operation.responses,cn);return un.set(e,o),o}function fn(e,t,n){let r=0,i=new Map;for(let[e,a]of n){if(t.has(e.toLowerCase())&&(r+=on*(4-a)/4),a>ln)continue;let n=new Set;for(let t of N(e))j(n,t);for(let e of n)i.set(e,Math.min(i.get(e)??a,a))}for(let t of e){let e=Math.min(...[...t].map(e=>i.get(e)??1/0));e<=ln&&(r+=sn*(2-e))}return r}var pn=5,mn=.5,hn=15,gn=30,_n=2,vn=100,yn=.5;function bn(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=tn(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=rn(i.urlPathWord,r.map(({fields:e})=>e)),o=P(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=M(o),c=qt(o),l=new Set(i.text.toLowerCase().split(/[^a-z0-9]+/u));return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:wn({normalizedQuery:o,tokens:s,termForm:c,queryWord:l},t))+an(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function xn(e){let t=e.requestBody??[],n=[...e.parameter,...t.flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:n.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:n.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...n,...t].map(({description:e})=>e),responseFieldLevel:dn(e.operationId)}}function Sn(e,t){let n=e.q?.trim()??``,r=bn(n,t.filter(t=>Cn(e,t)&&(n.length>0||t.deprecated!==!0)),xn),i=(r[0]?.score??0)*mn,a=r.filter(({score:e})=>e>=i),o=e.limit===void 0||!Number.isFinite(e.limit)?pn:e.limit,s=Math.min(a.length,Math.max(0,Math.trunc(o))),c=a.slice(0,s).map(({item:e})=>e),l={totalOperations:t.length,matched:a.length,returned:c.length},u=c.length===1,d=c.map(e=>St(e,u)),f=ce(k,d,{counts:l}),p=oe(f),m=u?c.map(Ct):c.map(wt);return{summary:k,data:p?d:m,counts:l}}function Cn(e,t){let{root:n}=e;return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function wn({normalizedQuery:e,tokens:t,termForm:n,queryWord:r},i){let a=An(i),o=On(i),s=0;a.some(t=>t===e)&&(s+=100),a.some(t=>t.includes(e))&&(s+=40),s+=kn(e,a);let c=new Set(a.flatMap(N)),u=new Set(o.flatMap(N));for(let e of t)a.some(t=>t===e)?s+=20:u.has(e)?s+=8:c.has(e)&&(s+=_n);for(let e of i.cliPath){let n=new Set;j(n,e),[...n].some(e=>t.has(e))&&(s+=hn)}Jt(n,o)&&(s+=200),n.length>1&&o.some(t=>t.includes(e))&&(s+=vn),i.parameterName.some(t=>P(t)===e)&&(s+=gn);let d=new Set(i.parameterDescription.flatMap(N));for(let e of t)d.has(e)&&(s+=_n);return s+=Mn(t,i.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(i.operationId)&&(s+=30),s+=fn(n,r,i.responseFieldLevel),s-=jn(e,t,i.description),l(i.intent)&&!Dn(r)?s*yn:s}var Tn=`edit change set fix rename link unlink mark publish correct`.split(` `),En=new Set([...Object.entries(s).filter(([,e])=>l(e)).map(([e])=>e),...Tn]);function Dn(e){return[...e].some(e=>En.has(e))}function On(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(P).filter(e=>e.length>0)}function kn(e,t){let n=N(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function An(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,(Ht(e.description).useFor||e.description).slice(0,240)].map(P).filter(e=>e.length>0))]}function jn(e,t,n){let r=P(Ht(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(N(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Mn(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Nn(e,t))&&(n+=i?40:10);return n}function Nn(e,t){let n=N(t);return n.length>0&&n.every(t=>e.has(t))}function Pn(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Fn(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return C(`Provide q to resolve a request to one operation.`);let a=n.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(a===void 0)return C(`This build ships no help resolve operation.`);let o=await r(a,{body:{question:i,resolve:!0,...e.scope===void 0?{}:{scope:e.scope===`read`?`READ`:`WRITE`}}});if(!o.ok)return{...o,data:null};let s=nt.safeParse(Pn(o));if(!s.success||s.data.resolution==null)return C(`The help resolve operation returned no resolution.`);let{answer:c,resolution:l}=s.data,u=e=>t.find(t=>t.operationId===e),d=u(l.operationId),f=l.taskPlan??void 0,p=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),m=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...p.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return m.some(e=>!n.some(t=>t.operationId===e))?C(`No operation on this connection answers that request.`):ce(m.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${m.join(`, `)}.`,{outcome:l.outcome,probability:l.probability,answer:c,candidate:l.candidate.map(({sourceId:e})=>e).filter(e=>n.some(({operationId:t})=>t===e)),...d===void 0?{}:{operation:{operationId:d.operationId,apiRoute:`${d.method} ${d.path}`,...Vt(d),mcpCall:zt(d)}},...(l.taskKey,{}),...f===void 0?{}:{taskPlan:{input:f.input,step:p.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{instruction:n,operationId:r}:{instruction:n,mcpCall:zt(e)})}}},{warnings:m.map(e=>n.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}var In=x({detail:b(),field:b().nullish(),scope:g([`entity`,`person`,`news`])}),Ln=g([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),Rn=Object.assign(f([Ln,b()]),{enum:Ln.enum}),F=x({modeRequested:Rn,modeUsed:Rn}),zn=x({answerUnavailable:v(),entity:F,news:F,person:F,rejection:m(In),unavailable:m(g([`entity`,`person`,`news`]))}),Bn=x({acceleratorParticipation:m(Ee),detail:m(De)}),I=x({core:T,enrichment:ye,fundraiseRound:m(Ve),provider:ze.nullish(),research:Bn,semanticMatch:Ne.nullish()}),Vn=g([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),Hn=x({compositeScore:y().nullish(),cosineScore:y().nullish(),curatedAsOf:b().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),curatedRelationshipType:b().nullish(),curatedSource:b().nullish(),derivedFromEntityId:d().nullish(),matchedSectionWeight:y().nullish(),origin:Vn,rank:_(),sharedSectionCount:_().nullish()}),Un=x({entity:I,similarity:Hn}),Wn=x({fundraiseInvestorJoin:v(),fundraiseTransaction:v(),operatingStatus:v(),relationship:v()}),Gn=g([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),Kn=g([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),qn=x({acquiredEntity:T,acquirerEntity:T,amount:y().int().nullish(),announcedAt:b().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),asOf:b().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),completedAt:b().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),createdAt:p({offset:!0}).nullish(),currency:b().nullish(),dataConfidence:ve.nullish(),evidence:Wn,fundraiseTransactionId:d().nullish(),investorJoinId:d().nullish(),isCurrent:v().nullish(),publicSource:me.nullish(),relationshipId:_(),status:Gn,transactionStatus:Kn.nullish(),updatedAt:p({offset:!0}).nullish()}),Jn=g([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),Yn=x({amountInvested:y().nullish(),createdAt:p({offset:!0}),financialInstrumentType:Jn.nullish(),id:d(),investor:ee,leadInvestor:v(),transactionId:d(),updatedAt:p({offset:!0})}),Xn=x({entity:Le,investorAttribution:m(Se),round:m(Be),roundCount:_()}),Zn=x({core:T,fundingDetail:_e.nullish(),similarity:Hn,urlLink:m(ge)}),Qn=x({compliance:je.nullish(),createdAt:p({offset:!0}).nullish(),id:_(),isCurrent:v().nullish(),isPrimary:v().nullish(),language:b().nullish(),owner:ee,text:b(),textName:b().nullish(),textType:b(),updatedAt:p({offset:!0}).nullish()}),$n=g([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),er=g([`fundraiseRound`,`researchDetail`]),tr=g([`preMoney`,`postMoney`,`reported`]),nr=x({amountRaised:y().int().nullish(),asOfDate:b().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),confidence:Ae,currency:b(),declaredBasis:tr,derivation:$n,detailId:_().nullish(),label:b().nullish(),source:er,sourceRef:b(),valuationPostMoney:y().int().nullish(),valuationPreMoney:y().int().nullish()}),rr=x({createdAt:p({offset:!0}).nullish(),description:b().nullish(),forkCount:_(),githubId:y().int(),homepageUrl:b().nullish(),id:y().int(),isArchived:v(),isFork:v(),language:b().nullish(),license:b().nullish(),name:b(),ownerLogin:b(),repoCreatedAt:p({offset:!0}).nullish(),repoPushedAt:p({offset:!0}).nullish(),stargazerCount:_(),topic:m(b()),updatedAt:p({offset:!0}).nullish(),url:b()}),L=x({empty:v().optional(),sorted:v().optional(),unsorted:v().optional()}),R=x({offset:y().int().optional(),paged:v().optional(),pageNumber:_().optional(),pageSize:_().optional(),sort:L.optional(),unpaged:v().optional()}),ir=x({investorAttribution:m(Se),person:Fe,round:m(Be),roundCount:_()}),ar=g([`by`,`about`]),or=g([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),sr=x({canonicalUrl:b().nullish(),contentId:b(),contentType:or,createdAt:p({offset:!0}).nullish(),publishedAt:p({offset:!0}).nullish(),relation:ar.nullish(),sourceDomain:b().nullish(),sourceName:b().nullish(),summary:b().nullish(),title:b(),topic:b().nullish(),updatedAt:p({offset:!0}).nullish(),url:b().nullish(),year:_().nullish()});x({content:m(we).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(f([pe,ke])).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Ce).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(T).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(qn).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Le).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Yn).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Ve).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Xn).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(I).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Re).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(be).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(De).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Pe).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Un).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Zn).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Qn).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(ge).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(nr).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(rr).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Te).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(xe).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Fe).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Ie).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(ir).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(Oe).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()}),x({content:m(sr).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()});var cr=x({content:m(I),number:_(),size:_(),totalElements:y().int(),totalPages:_()}),lr=x({content:m(Te),number:_(),size:_(),totalElements:y().int(),totalPages:_()}),ur=x({content:m(xe),number:_(),size:_(),totalElements:y().int(),totalPages:_()});x({content:m(Me).optional(),empty:v().optional(),first:v().optional(),last:v().optional(),number:_().optional(),numberOfElements:_().optional(),pageable:R.optional(),size:_().optional(),sort:L.optional(),totalElements:y().int().optional(),totalPages:_().optional()});var dr=g([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),fr=Object.assign(f([dr,b()]),{enum:dr.enum}),pr=x({entityId:d(),source:fr,sourceId:b()}),mr=x({citation:m(pr),text:b(),topic:b().nullish()}),hr=x({citation:m(pr),confidence:E,description:b().nullish(),heading:b().nullish(),paragraph:m(mr),relatedQuery:m(b()),shareable:v(),text:b(),title:b().nullish()}),gr=x({enrichmentRunId:d().nullish(),entityId:d()}),_r=x({sortPriority:g([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),vr=x({max:p({offset:!0}).nullish(),min:p({offset:!0}).nullish()}),z=x({max:y().nullish(),min:y().nullish()}),B=x({max:_().nullish(),min:_().nullish()}),yr=x({averageAmountInvestedUsdRange:m(z).optional(),largestAmountInvestedUsdRange:m(z).optional(),smallestAmountInvestedUsdRange:m(z).optional(),totalAmountInvestedUsdRange:m(z).optional(),totalInvestmentRange:m(B).optional()}),br=x({amountInvestedRange:m(z).optional(),amountRaisedRange:m(z).optional(),dateAnnouncedRange:vr.nullish(),investedCompanyName:m(b()).optional(),investedCountry:m(b()).optional(),investedIndustry:m(b()).optional(),investedRound:m(b()).optional(),investorActivity:yr.optional(),investorName:m(b()).optional(),lastRoundYearRange:m(B).optional(),rankByInvestmentActivity:v().nullish(),round:m(b()).optional(),totalRaisedRange:m(z).optional(),valuationRange:m(z).optional()}),xr=g([`NONE`,`COMPANY_LISTING_READY`]),Sr=g([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),Cr=g([`hostPath`,`domain`]),wr=u({acceleratorBrand:m(b()).optional(),acceleratorCohort:m(b()).optional(),acceleratorName:m(b()).optional(),acceleratorStatus:m(b()).optional(),affinity:m(b()).optional(),closedLast:v().optional(),employeeCountRange:m(B).optional(),entityId:m(d()).optional(),entityName:m(b()).optional(),featured:v().nullish(),fundraiseActivity:br.optional(),hasFundraising:v().nullish(),headquartersCity:m(b()).optional(),headquartersCountry:m(b()).optional(),headquartersState:m(b()).optional(),industry:m(b()).optional(),letter:b().nullish(),location:m(b()).optional(),logoOption:_r.optional(),mainProduct:m(b()).optional(),operatingStatus:m(Sr).optional(),originCountry:m(b()).optional(),person:m(b()).optional(),portfolioHeadquartersCity:m(b()).optional(),portfolioHeadquartersCountry:m(b()).optional(),portfolioHeadquartersState:m(b()).optional(),qualityGate:xr.optional(),rankByProminence:v().nullish(),semanticQuery:b().nullish(),slug:m(b().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:m(b()).optional(),suppressLateStage:v().nullish(),suppressNonOperating:v().nullish(),suppressZeroTotalRaised:v().nullish(),tag:m(b()).optional(),textSearch:b().nullish(),typeCustomer:m(b()).optional(),typeModel:m(b()).optional(),typeOwnership:m(b()).optional(),typeRecord:m(h).optional(),typeRevenue:m(b()).optional(),typeTechnologyUsed:m(b()).optional(),url:b().nullish(),urlDomain:b().nullish(),urlMatchMode:Cr.nullish(),urlType:he.nullish(),yearFoundedRange:m(B).optional()}),Tr=g([`discovery`,`profile`,`peer`,`comparison`]),Er=g([`keyword`,`semantic`]),Dr=g([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),Or=Object.assign(f([Dr,b()]),{enum:Dr.enum}),kr=x({descending:v(),field:Or,sortKey:b().nullish()}),Ar=x({order:m(kr),relevance:Er.nullish()}),jr=x({confidence:E,execution:F,fallbackUsed:v(),filter:wr,intent:Tr,interpretation:b(),sort:Ar,subjectEntityName:m(b()),unsupported:b().nullish()}),Mr=x({changedAt:p({offset:!0}).nullish(),dataSourceUpdatedAt:p({offset:!0}).nullish(),pendingApproval:_().nullish(),sourceId:b().nullish(),status:b().nullish()}),Nr=x({fundManagerRelationshipSource:Mr.nullish(),fundraiseTransaction:Ve,fundraiseTransactionSource:Mr.nullish(),investorJoinSource:Mr.nullish()}),Pr=x({evidence:Nr,investor:ee,semanticMatch:Ne.nullish()}),Fr=x({entityId:d(),matchedOffering:T.nullish(),probability:y(),webUrl:m(b())}),Ir=x({entityId:d(),label:b(),publishedAt:p({offset:!0}).nullish(),score:y(),source:fr,sourceId:b(),text:b(),url:b().nullish()}),Lr=x({answer:hr.nullish(),filing:m(gr).nullish(),interpretation:jr,investment:m(Pr),judgment:m(Fr),passage:m(Ir),peer:m(Un),pendingWebQuery:m(b()),result:cr,searchRequestId:d().nullish(),subject:m(I)}),Rr=g([`auto-match`,`needs-review`,`approved`,`rejected`]),zr=x({createdAt:p({offset:!0}),entityId:d(),href:b().nullish(),internal:v(),matchStatus:Rr.nullish(),mention:b().nullish(),slug:b().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:h.nullish(),updatedAt:p({offset:!0})}),Br=x({entity:m(zr),newsId:_()}),Vr=u({acceleratorBrand:m(b()).optional(),acceleratorCohort:m(b()).optional(),acceleratorName:m(b()).optional(),acceleratorStatus:m(b()).optional(),affinity:m(b()).optional(),closedLast:v().optional(),employeeCountRange:m(B).optional(),entityId:m(d()).optional(),entityName:m(b()).optional(),featured:v().nullish(),fundraiseActivity:br.optional(),hasFundraising:v().nullish(),headquartersCity:m(b()).optional(),headquartersCountry:m(b()).optional(),headquartersState:m(b()).optional(),industry:m(b()).optional(),letter:b().nullish(),location:m(b()).optional(),logoOption:_r.optional(),mainProduct:m(b()).optional(),operatingStatus:m(Sr).optional(),originCountry:m(b()).optional(),person:m(b()).optional(),portfolioHeadquartersCity:m(b()).optional(),portfolioHeadquartersCountry:m(b()).optional(),portfolioHeadquartersState:m(b()).optional(),qualityGate:xr.optional(),rankByProminence:v().nullish(),slug:m(b().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:m(b()).optional(),suppressLateStage:v().nullish(),suppressNonOperating:v().nullish(),suppressZeroTotalRaised:v().nullish(),tag:m(b()).optional(),textSearch:b().nullish(),typeCustomer:m(b()).optional(),typeModel:m(b()).optional(),typeOwnership:m(b()).optional(),typeRecord:m(h).optional(),typeRevenue:m(b()).optional(),typeTechnologyUsed:m(b()).optional(),url:b().nullish(),urlDomain:b().nullish(),urlMatchMode:Cr.nullish(),urlType:he.nullish(),yearFoundedRange:m(B).optional()}),Hr=x({amountInvestedRange:m(z).nullish(),amountRaisedRange:m(z).nullish(),entityName:m(b()).nullish(),investedCompany:m(b()).nullish(),personTitle:m(b()).nullish(),round:m(b()).nullish(),totalInvestmentCount:m(B).nullish(),typeRecord:m(h).nullish()}),Ur=x({arrayFilter:Hr.optional(),entityFilter:Vr.optional(),entityId:d().nullish(),entitySlug:b().nullish(),firstName:b().nullish(),includeAddress:v().nullish(),includeUrl:v().nullish(),investorActivity:yr.optional(),isCurrent:v().nullish(),lastName:b().nullish(),letter:b().nullish(),personId:m(d()).max(200).optional(),personName:m(b()).optional(),role:b().nullish(),search:b().nullish(),semanticQuery:b().nullish(),status:b().nullish()}),Wr=x({descending:v(),field:g([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:b().nullish()}),Gr=x({order:m(Wr),relevance:Er.nullish()}),Kr=x({confidence:E,execution:F,fallbackUsed:v(),filter:Ur,interpretation:b(),sort:Gr,unsupported:b().nullish()}),qr=x({interpretation:Kr,investment:m(Pr),result:ur,searchRequestId:d().nullish()}),Jr=x({label:b(),query:b()}),Yr=x({key:b(),option:m(Jr),prompt:b()}),Xr=x({entity:Lr,entityDetail:m(Le),news:lr,newsEntityMention:m(Br),person:qr,personDetail:m(Fe),provenance:zn,qualifier:Yr.nullish()});function Zr(e,t){return e.map(e=>{let n=e.requestBody??[],a=[...e.parameters.map(e=>Qr(e)),...n.flatMap(e=>e.parameter.map(t=>Qr(t,n.length>1?e.contentType:void 0))),...$r(n)],s=[t,...e.cliPath].join(` `),u=e.mutates===!0||l(e.intent),d=i(e),f=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:u,destructive:c(e.method,e.intent),auth:e.auth,cli:{command:s,path:e.cliPath},mcpTool:e.binaryResponse||!o(e.path)||d===null?null:r(d),body:{hasBody:f!==void 0,kind:f?.kind??null,...f!==void 0&&n.length>1?{contentType:f.contentType}:{},required:f?.required??!1,description:f?.description??``,requiredPath:f?.requiredPath??[]},flags:a,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function Qr(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function $r(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function V(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var ei=[`-id`,`-slug`,`-url`],ti=[`--id`,`--slug`,`--url`],ni=`/v1/lookup`,ri=`--from-file "<path>"`;function ii(e,t,n=le().bin[0]){let r=Zr(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:ci(i,r)}function ai(e,t,n=le().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:Zr([r],n);return i&&si(i,di(i,!1))}function oi(e,t,n,r=le().bin[0]){let i=e=>{let t=e.findIndex((e,t)=>n[t]!==e);return t===-1?e.length:t},a=`${n[0]} get`,[o,s]=t.filter(({method:t,path:n,parameters:r,cliPath:o})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return t===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===e&&n.endsWith(`/{${c.name}}`)&&(i(o)>1||o.join(` `)===a)}).toSorted((e,t)=>i(t.cliPath)-i(e.cliPath));if(o!==void 0&&(s===void 0||i(s.cliPath)!==i(o.cliPath)))return ai(o.operationId,t,r)}function si(e,t){return[e.cli.command,...t,`--data`].join(` `)}function ci(e,t){return[`example: ${si(e,di(e))}`,...li(e,t)]}function li(e,t){return V(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${H(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===ni),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${H(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var ui=/(?:^|\.)text$/u;function di(e,t=!0){let n=V(e),r=n.filter(e=>e.required),i=e.body.kind===`json`&&n.some(e=>e.location===`body`&&ui.test(e.wireName)&&(e.required||!e.wireName.includes(`.`))),a=i?r.filter(e=>e.location!==`body`):r,o=(r.length>0||!t?a:fi(e)).map(H);return i||(e.body.required||e.body.requiredPath.length>0)&&!a.some(e=>e.location===`body`)?[...o,ri]:o}function fi(e){let t=new Set;j(t,e.resource);for(let n of ei)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of ti){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function H(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var pi=`aventure`;function mi(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${pi} ${n.join(` `)}`}function hi(e,t,n=e){return ai(e,t,`aventure`)??n}function gi(e,t){let n=nt.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return _i(r,o,t);let s=r.trimEnd().split(`
3
+ `),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==Ke.options[0].enum.OPERATION)return[];let r=mi(n,t);return r===void 0?[]:[r]}));return c.size>0&&s.push(``,`Commands:`,...[...c].map(e=>` ${e}`)),s.push(``,`Confidence: ${a}`),i.length===0?s:(s.push(`Sources (${i.length}):`),s.push(...i.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),s)}function _i(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():yi(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case D.enum.TASK_PLAN:return[...l,...c==null?[]:bi(c,n),...u];case D.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${hi(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case D.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...Si(`Candidates:`,o,n),...u];case D.enum.ABSTAIN:return[...l,...Si(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function vi(e,t){let n=et.safeParse(e);return n.success?[yi(n.data),...bi(n.data,t)]:null}var yi=({taskKey:e,catalogRevision:t})=>e===void 0?`Run these steps in order.`:`Run catalog task ${e}${t===void 0?``:` (catalog revision ${t})`}.`;function bi(e,t){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n,required:r})=>` ${e} (${t}, ${r===!1?`optional`:`required`}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey===void 0?``:`${n.stepKey}: `}${hi(n.operationId,t,r)}`,` ${n.instruction}`,...xi(e,a,i)]),...e.gateId?.length?[``,`Completion gates: ${e.gateId.join(`, `)}`]:[]]}function xi(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function Si(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:mi(e,n)??e,excerpt:t})),i=Math.max(...r.map(({command:e})=>e.length));return[``,e,...r.map(({command:e,excerpt:t})=>` ${e.padEnd(i)} # ${t}`)]}var U=30,Ci=8,W=10,wi=2,Ti=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Ei=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Di=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Oi(e,t,n){if(typeof t==`string`)return te(t);let r=Nt(t);if(r!==null)return S(r);let i=zi(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=ue(a?.detailField,i.response),c={...i,response:o,parameters:a?.parameters??[]},l=gi(c.response,e)??vi(c.response,e);if(l!==null)return S(l.join(`
4
+ `),!0);let u=ki(c);if(u!==null)return S([...u,...s].join(`
5
+ `),!0,s.length>0);let d=[c.summary??n??c.operationId??`OpenAPI call succeeded`,`${c.method} ${c.endpoint}`],f=ae(Ni(c),117-s.length,ie-We.byteLength(`${[...d,...s].join(`
6
+ `)}\n`,`utf8`)),p=[...d,...f].filter(Boolean);return S([...p,...s].join(`
7
+ `),!0,s.length>0)}function ki({response:e,...t}){if(e===void 0||!Y(e)||!(`entity`in e&&`person`in e&&`news`in e))return null;let n=Xr.safeParse(e);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o}=n.data;return[...r.answer?Ai(r.answer):[],...o.unavailable.map(e=>`${e} unavailable: retry this scope later`),...o.answerUnavailable?[`answer unavailable: retry this search later`]:[],...o.rejection.map(({scope:e,detail:t})=>w(`${e} rejected: ${t}`)),[`entities:`,...G(r.result,t)].join(`
8
+ `),[`people:`,...G(i.result,t)].join(`
9
+ `),[`news:`,...G(a,t)].join(`
10
+ `)]}function Ai(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${w(e)}`).join(`
11
+ `)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>w(` - ${e}:${t} entity=${n}`)).join(`
12
+ `)}`;return[`answer:\n ${de(e.text).replaceAll(`
13
+ `,`
14
+ `)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function ji(e){let t=zi(e)?.response,n=Y(t)?t.interpretation:void 0;if(!Y(n))return null;let r=F.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=q(n.filter),{unsupported:s,fallbackUsed:c}=n,l=[`strategy: requested=${i} used=${a}`,...Y(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${Mi(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``];return S(l.filter(Boolean).join(`
15
+ `),!0)}var Mi=e=>X(e)?w(e):Array.isArray(e)&&e.every(X)?e.map(e=>w(e)).join(`, `):JSON.stringify(e);function Ni(e){let{response:t,method:n,nextCursor:r,httpStatus:i,location:a}=e;if(t===void 0)return a!==void 0&&i!==void 0?[`status=${i} redirect=${a}`]:i===void 0?[]:[`status=${i} no response body`];let o=i===void 0||n===`GET`?``:`status=${i}`,s=Y(t)&&!Hi(t)?Ui(t):null,c=s===null?void 0:Y(s.context.interpretation)?q(s.context):s.context,l=c!==void 0&&Y(c)?Object.entries(c):[],u=l.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Y)),d=new Set(u.map(([e])=>e)),f=Object.fromEntries(l.filter(([e])=>!d.has(e)));return[o,...Hi(t)?G(t,e,r):s===null?Gi(t)?Ii(t.filter,t.meta):Ki(t)?Ii([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):Ji(t)?Li(t):K(t,``):[...G(s.page,e,r),...Object.keys(f).length===0?[]:K(f,``),...u.flatMap(([e,t])=>[`${e}:`].concat(Pi(t)))]].filter(Boolean)}function G(e,t,n){let r=Ri(t),i=e.numberOfElements??e.content.length,a=(e.totalElements??0)-(e.number??0)*(e.size??0)-i,o=e.number===void 0?``:` page=${e.number}`,s=e.size===void 0?``:` size=${e.size}`,c=e.totalElements===void 0?``:` total=${e.totalElements}`,l=e.totalPages===void 0?``:` totalPages=${e.totalPages}`,u=(e.number??0)+1,d=e.totalPages===void 0||u<e.totalPages,f=Z(`page`,t.parameters);return[`rows=${i}${o}${s}${c}${l}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${Q(n)}`,a<=0||n!==void 0?``:d&&i===e.size?`more: ${a} rows not shown; use ${f} or ${Z(`size`,t.parameters)} to see them`:`more: ${a} more matched but this response returns only these ${i}; narrow the query to reach them${d?` (${f} ${u} starts after this page)`:``}`,...Pi(e.content)].filter(Boolean)}function Pi(e){let t=e.filter(Y);if(t.length===0)return e.length===0?[`(empty)`]:Bi(e,``);let n=Fi(t);if(n.length===0)return Bi(e.slice(0,U),``);let r=t.slice(0,U).map(e=>{let t=J(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>Yi(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>U&&s.push(`... ${t.length-U} more rows`),s}function Fi(e){let t=e.map(e=>J(e)),n=new Set(t.flatMap(e=>Object.keys(e))),r=Ti.filter(e=>n.has(e)),i=new Set(r.map(Vi)),a=[...n].filter(e=>{let n=t.every(t=>/^-?\d+(?:\.\d+)?$/u.test(t[e]??`0`));return!e.includes(`.`)||/id$/iu.test(e)||i.has(Vi(e))?!1:(n&&i.add(Vi(e)),n)}),o=[...n].filter(e=>/(?:^|\.)id$/u.test(e)).slice(0,1),s=[...new Set([...r,...o,...a])],c=[...n].filter(e=>!s.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,Ci-s.length);return[...s,...c].slice(0,Ci)}function Ii(e,t){let n=t!==void 0&&Y(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,W).forEach(e=>{i.push(` ${Z(t.filterKey)} ${Q(e.value)}`)}),e>W&&i.push(` ... ${e-W} more shown`)}return i}function Li(e){let t=Z(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,W).map(e=>`${t} ${Q(e)}`),e.result.length>W?`... ${e.result.length-W} more matches`:``].filter(Boolean)}function Ri({endpoint:e,parameters:t}){let n=e.indexOf(`?`);return n<0?[]:[...new URLSearchParams(e.slice(n+1)).entries()].filter(([e,t])=>!Ei.has(e)&&t.length>0).map(([e,n])=>`${Z(e,t)} ${Q(n)}`)}function zi(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=t=>{let n=Reflect.get(e,t);return typeof n==`string`?n:void 0},[n,r,i]=[t(`method`),t(`endpoint`),t(`nextCursor`)];if(n===void 0||r===void 0)return null;let a=Reflect.get(e,`httpStatus`),o=Reflect.get(e,`response`),s=o===void 0?void 0:se.safeParse(o);return s!==void 0&&!s.success?null:{method:n,endpoint:r,httpStatus:typeof a==`number`?a:void 0,location:t(`location`),operationId:t(`operationId`),summary:t(`summary`),nextCursor:i===``?void 0:i,response:s?.data}}function K(e,t,n){if(e===void 0)return[];if(X(e))return[`${t}${fe(e,n)}`];if(Array.isArray(e))return Bi(e,t,n);let r=[];for(let[n,i]of Object.entries(e))if(i!==void 0){if(X(i)){r.push(`${t}${n}: ${fe(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of K(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function Bi(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(X(i)){r.push(`${t}- ${fe(i,n)}`);continue}r.push(`${t}-`);for(let e of K(i,`${t} `))r.push(e)}return r}function q(e){if(e===void 0||X(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=q(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=q(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...Di.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!Di.includes(e))])}function J(e,t=``,n=0){return X(e)?t.length===0?{}:{[t]:w(e,t)}:n>wi?{}:Array.isArray(e)?e[0]===void 0?{}:J(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{if(r===void 0)return[];let i=t.length===0?e:`${t}.${e}`;return X(r)?[[i,w(r,i)]]:Object.entries(J(r,i,n+1))}))}var Vi=e=>e.split(`.`,1)[0],Hi=e=>Y(e)&&Array.isArray(e.content);function Ui(e){let[t,...n]=Object.entries(e).filter(e=>Hi(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function Wi(e){return Y(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var Gi=e=>Y(e)&&qi(e.filter),Ki=e=>Y(e)&&qi(e.arrayFilterEntry)&&qi(e.rangeFilterEntry),qi=e=>Array.isArray(e)&&e.every(Wi),Ji=e=>Y(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>typeof e!=`object`||!e,Z=(e,t=[])=>t.find(({name:t})=>t===e)?.flag.split(` `)[0]??`--${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,Q=e=>/^[A-Za-z0-9._:/@-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,Yi=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,Xi=/\{([^}]+)\}/gu;function Zi(e,t){let n=t.filter(e=>e.method===`GET`),r=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),i=t.find(t=>t.operationId===e.operationId),a=e.ok&&i!==void 0&&l(i.intent),o=[...a&&e.endpoint!==void 0?$i(e.endpoint.split(`?`)[0]??``,n,!1).map(e=>`${e} --data --to-file <path>`):[],...e.references.filter(e=>!r(e)).flatMap(Qi).flatMap(e=>$i(e.pathname,n,!0)),...e.references.filter(r).flatMap(Qi).flatMap(e=>ea(e,n))];return o.length===0?{write:a}:{exactRecovery:`Read the full result ${o.join(`; `)}.`,write:a}}function Qi(e){return URL.canParse(e)?[new URL(e)]:[]}function $i(e,t,n){return t.flatMap(t=>{let r=[...t.path.matchAll(Xi)].map(([,e])=>e),i=RegExp(`^${t.path.replace(Xi,`([^/]+)`)}$`,`u`),a=n&&r.length===0?null:i.exec(e);if(a===null)return[];let o=r.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[$(r),a[n+1]??``]});return[`${ta(t)}, ${na(t,o)}`]})}function ea(e,t){let n=t.find(t=>t.path===e.pathname);return n===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${n.path}/`))return[];let r=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),i=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(r===void 0||i===void 0)return[];let a=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[$(t),ra(n)]}),o=[$(r),`<n>`,$(i),`<n>`];return[`${ta(t)}, in windows: ${na(t,[...a,...o])}, advancing ${$(r)} until a window returns fewer than ${$(i)} units`]})}function ta(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function na(e,t){return[pi,...e.cliPath,...t].join(` `)}function $(e){return e.flag.split(/\s+/u)[0]??e.flag}function ra(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function ia(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let r=la(t,O(e,t),n);if(t.legacyName===void 0)return r;let i=la(t,O(e,t,t.legacyName),n).flag;return i===r.flag?r:Object.assign(r,{legacyFlag:i})})}),n=e.requestBody?.map(n=>{let r=sa(e,t,n),i=oa(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),r=e.response.find(({status:e})=>e.startsWith(`2`)),i=r?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,mutates:e.projection.mutates,errorResponse:e.errorResponse,successResponse:i,detailField:r?.detailField,parameters:t}})}function aa(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function oa(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function sa(e,t,n){let r=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&r.add(`contentType`);let i=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return n.parameter.toSorted((e,t)=>ca(e.name)-ca(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=rt(e,t,r);return r.add(n),[la(t,n,`body`)]})}function ca(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function la(t,r,i){let a=t.itemSchemaEnum??t.schemaEnum,o=Ue(t.schemaType,t.itemSchemaType,t.schemaFormat,r),s=`${n(r)} ${t.schemaType===`boolean`?`[${o}]`:`<${o}>`}`;return{name:t.name,optionKey:new e(s).attributeName(),flag:s,required:t.required&&t.schemaDefault===void 0,description:He(t.description,a),schemaType:t.schemaType,schemaFormat:t.schemaFormat,itemSchemaType:t.itemSchemaType,defaultValue:ua(t.schemaDefault),choices:a,...t.envName===void 0?{}:{envName:t.envName},...t.visibility&&{visibility:t.visibility},location:i}}var ua=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{M as _,ji as a,St as b,ii as c,Zr as d,xn as f,dn as g,Fn as h,Oi as i,oi as l,Sn as m,aa as n,ui as o,bn as p,Zi as r,V as s,ia as t,ci as u,N as v,at as x,P as y};
@@ -93,7 +93,7 @@ Content-Type: ${o.type||`application/octet-stream`}\r\n\r\n`);a.push(e,o,u),type
93
93
  )
94
94
  `)}close(){this.#n.close()}get(e){i(e);let t=this.#f(e);return t?{body:t.body?Buffer.from(t.body.buffer,t.body.byteOffset,t.body.byteLength):void 0,statusCode:t.statusCode,statusMessage:t.statusMessage,headers:t.headers?JSON.parse(t.headers):void 0,etag:t.etag?t.etag:void 0,vary:t.vary?JSON.parse(t.vary):void 0,cacheControlDirectives:t.cacheControlDirectives?JSON.parse(t.cacheControlDirectives):void 0,cachedAt:t.cachedAt,staleAt:t.staleAt,deleteAt:t.deleteAt}:void 0}set(e,t){i(e);let n=this.#d(e),r=Array.isArray(t.body)?Buffer.concat(t.body):t.body,a=r?.byteLength;if(a&&a>this.#e)return;let o=this.#f(e,!0);o?this.#i.run(r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.vary?JSON.stringify(t.vary):null,t.cachedAt,t.staleAt,o.id):(this.#a.run(n,e.method,r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.vary?JSON.stringify(t.vary):null,t.cachedAt,t.staleAt),this.#u())}createWriteStream(e,t){i(e),a(t);let n=0,o=[],s=this;return new r({decodeStrings:!0,write(e,t,r){n+=e.byteLength,n<=s.#e?o.push(e):this.destroy(),r()},final(n){s.set(e,{...t,body:o}),n()}})}delete(e){if(typeof e!=`object`)throw TypeError(`expected key to be object, got ${typeof e}`);this.#s.run(this.#d(e))}#u(){if(Number.isFinite(this.#t)&&this.size<=this.#t)return 0;{let e=this.#o.run(Date.now()).changes;if(e)return e}{let e=this.#l?.run(Math.max(Math.floor(this.#t*.1),1)).changes;if(e)return e}return 0}get size(){let{total:e}=this.#c.get();return e}#d(e){return`${e.origin}/${e.path}`}#f(e,t=!1){let n=this.#d(e),{headers:r,method:i}=e,a=this.#r.all(n,i);if(a.length===0)return;let o=Date.now();for(let e of a){if(o>=e.deleteAt&&!t)continue;let n=!0;if(e.vary){let t=JSON.parse(e.vary);for(let e in t)if(!l(r[e],t[e])){n=!1;break}}if(n)return e}}};function l(e,t){if(e==null&&t==null)return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}})),gn=t(((t,n)=>{var{kConstruct:r}=Z(),{kEnumerableProperty:i}=$(),{iteratorMixin:a,isValidHeaderName:o,isValidHeaderValue:s}=ct(),{webidl:c}=st(),l=e(`node:assert`),u=e(`node:util`);function d(e){return e===10||e===13||e===9||e===32}function f(e){let t=0,n=e.length;for(;n>t&&d(e.charCodeAt(n-1));)--n;for(;n>t&&d(e.charCodeAt(t));)++t;return t===0&&n===e.length?e:e.substring(t,n)}function p(e,t){if(Array.isArray(t))for(let n=0;n<t.length;++n){let r=t[n];if(r.length!==2)throw c.errors.exception({header:`Headers constructor`,message:`expected name/value pair to be length 2, found ${r.length}.`});m(e,r[0],r[1])}else if(typeof t==`object`&&t){let n=Object.keys(t);for(let r=0;r<n.length;++r)m(e,n[r],t[n[r]])}else throw c.errors.conversionFailed({prefix:`Headers constructor`,argument:`Argument 1`,types:[`sequence<sequence<ByteString>>`,`record<ByteString, ByteString>`]})}function m(e,t,n){if(n=f(n),!o(t))throw c.errors.invalidArgument({prefix:`Headers.append`,value:t,type:`header name`});if(!s(n))throw c.errors.invalidArgument({prefix:`Headers.append`,value:n,type:`header value`});if(v(e)===`immutable`)throw TypeError(`immutable`);return b(e).append(t,n,!1)}function h(e){let t=b(e);if(!t)return[];if(t.sortedMap)return t.sortedMap;let n=[],r=t.toSortedArray(),i=t.cookies;if(i===null||i.length===1)return t.sortedMap=r;for(let e=0;e<r.length;++e){let{0:t,1:a}=r[e];if(t===`set-cookie`)for(let e=0;e<i.length;++e)n.push([t,i[e]]);else n.push([t,a])}return t.sortedMap=n}function g(e,t){return e[0]<t[0]?-1:1}var _=class e{cookies=null;sortedMap;headersMap;constructor(t){t instanceof e?(this.headersMap=new Map(t.headersMap),this.sortedMap=t.sortedMap,this.cookies=t.cookies===null?null:[...t.cookies]):(this.headersMap=new Map(t),this.sortedMap=null)}contains(e,t){return this.headersMap.has(t?e:e.toLowerCase())}clear(){this.headersMap.clear(),this.sortedMap=null,this.cookies=null}append(e,t,n){this.sortedMap=null;let r=n?e:e.toLowerCase(),i=this.headersMap.get(r);if(i){let e=r===`cookie`?`; `:`, `;this.headersMap.set(r,{name:i.name,value:`${i.value}${e}${t}`})}else this.headersMap.set(r,{name:e,value:t});r===`set-cookie`&&(this.cookies??=[]).push(t)}set(e,t,n){this.sortedMap=null;let r=n?e:e.toLowerCase();r===`set-cookie`&&(this.cookies=[t]),this.headersMap.set(r,{name:e,value:t})}delete(e,t){this.sortedMap=null,t||(e=e.toLowerCase()),e===`set-cookie`&&(this.cookies=null),this.headersMap.delete(e)}get(e,t){return this.headersMap.get(t?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:e,1:{value:t}}of this.headersMap)yield[e,t]}get entries(){let e={};if(this.headersMap.size!==0)for(let{name:t,value:n}of this.headersMap.values())e[t]=n;return e}rawValues(){return this.headersMap.values()}get entriesList(){let e=[];if(this.headersMap.size!==0)for(let{0:t,1:{name:n,value:r}}of this.headersMap)if(t===`set-cookie`)for(let t of this.cookies)e.push([n,t]);else e.push([n,r]);return e}toSortedArray(){let e=this.headersMap.size,t=Array(e);if(e<=32){if(e===0)return t;let n=this.headersMap[Symbol.iterator](),r=n.next().value;t[0]=[r[0],r[1].value],l(r[1].value!==null);for(let r=1,i=0,a=0,o=0,s=0,c,u;r<e;++r){for(u=n.next().value,c=t[r]=[u[0],u[1].value],l(c[1]!==null),o=0,a=r;o<a;)s=o+(a-o>>1),t[s][0]<=c[0]?o=s+1:a=s;if(r!==s){for(i=r;i>o;)t[i]=t[--i];t[o]=c}}if(!n.next().done)throw TypeError(`Unreachable`);return t}{let e=0;for(let{0:n,1:{value:r}}of this.headersMap)t[e++]=[n,r],l(r!==null);return t.sort(g)}}},v,y,b,x,S=class{#e;#t;constructor(e=void 0){c.util.markAsUncloneable(this),e!==r&&(this.#t=new _,this.#e=`none`,e!==void 0&&(e=c.converters.HeadersInit(e,`Headers constructor`,`init`),p(this,e)))}append(e,t){c.brandCheck(this,c.is.Headers),c.argumentLengthCheck(arguments,2,`Headers.append`);let n=`Headers.append`;return e=c.converters.ByteString(e,n,`name`),t=c.converters.ByteString(t,n,`value`),m(this,e,t)}delete(e){if(c.brandCheck(this,c.is.Headers),c.argumentLengthCheck(arguments,1,`Headers.delete`),e=c.converters.ByteString(e,`Headers.delete`,`name`),!o(e))throw c.errors.invalidArgument({prefix:`Headers.delete`,value:e,type:`header name`});if(this.#e===`immutable`)throw TypeError(`immutable`);this.#t.contains(e,!1)&&this.#t.delete(e,!1)}get(e){c.brandCheck(this,c.is.Headers),c.argumentLengthCheck(arguments,1,`Headers.get`);let t=`Headers.get`;if(e=c.converters.ByteString(e,t,`name`),!o(e))throw c.errors.invalidArgument({prefix:t,value:e,type:`header name`});return this.#t.get(e,!1)}has(e){c.brandCheck(this,c.is.Headers),c.argumentLengthCheck(arguments,1,`Headers.has`);let t=`Headers.has`;if(e=c.converters.ByteString(e,t,`name`),!o(e))throw c.errors.invalidArgument({prefix:t,value:e,type:`header name`});return this.#t.contains(e,!1)}set(e,t){c.brandCheck(this,c.is.Headers),c.argumentLengthCheck(arguments,2,`Headers.set`);let n=`Headers.set`;if(e=c.converters.ByteString(e,n,`name`),t=c.converters.ByteString(t,n,`value`),t=f(t),!o(e))throw c.errors.invalidArgument({prefix:n,value:e,type:`header name`});if(!s(t))throw c.errors.invalidArgument({prefix:n,value:t,type:`header value`});if(this.#e===`immutable`)throw TypeError(`immutable`);this.#t.set(e,t,!1)}getSetCookie(){c.brandCheck(this,c.is.Headers);let e=this.#t.cookies;return e?[...e]:[]}[u.inspect.custom](e,t){return t.depth??=e,`Headers ${u.formatWithOptions(t,this.#t.entries)}`}static{v=e=>e.#e,y=(e,t)=>{e.#e=t},b=e=>e.#t,x=(e,t)=>{e.#t=t},c.is.Headers=e=>typeof e==`object`&&!!e&&#e in e}};a(`Headers`,S,h,0,1,c.is.Headers),Object.defineProperties(S.prototype,{append:i,delete:i,get:i,has:i,set:i,getSetCookie:i,[Symbol.toStringTag]:{value:`Headers`,configurable:!0},[u.inspect.custom]:{enumerable:!1}}),c.converters.HeadersInit=function(e,t,n){if(c.util.Type(e)===c.util.Types.OBJECT){let r=Reflect.get(e,Symbol.iterator);if(!u.types.isProxy(e)&&r===S.prototype.entries)try{return b(e).entriesList}catch{}return typeof r==`function`?c.converters[`sequence<sequence<ByteString>>`](e,t,n,r.bind(e)):c.converters[`record<ByteString, ByteString>`](e,t,n)}throw c.errors.conversionFailed({prefix:`Headers constructor`,argument:`Argument 1`,types:[`sequence<sequence<ByteString>>`,`record<ByteString, ByteString>`]})},n.exports={fill:p,compareHeaderName:g,Headers:S,HeadersList:_,getHeadersGuard:v,setHeadersGuard:y,setHeadersList:x,getHeadersList:b}})),_n=t(((t,n)=>{var{Headers:r,HeadersList:i,fill:a,getHeadersGuard:o,setHeadersGuard:s,setHeadersList:c}=gn(),{extractBody:l,cloneBody:u,mixinBody:d,streamRegistry:f,bodyUnusable:p}=ft(),m=$(),h=e(`node:util`),{kEnumerableProperty:g}=m,{isValidReasonPhrase:_,isCancelled:v,isAborted:y,isErrorLike:b,environmentSettingsObject:x}=ct(),{redirectStatusSet:S,nullBodyStatus:C}=nt(),{webidl:w}=st(),{URLSerializer:T}=ot(),{kConstruct:E}=Z(),D=e(`node:assert`),{isomorphicEncode:O,serializeJavascriptValueToJSONString:k}=at(),A=new TextEncoder(`utf-8`),j,M,N,P,F=class{#e;#t;static error(){return U(R(),`immutable`)}static json(e,t=void 0){w.argumentLengthCheck(arguments,1,`Response.json`),t=w.converters.ResponseInit(t);let n=l(A.encode(k(e))),r=U(L({}),`response`);return ee(r,t,{body:n[0],type:`application/json`}),r}static redirect(e,t=302){w.argumentLengthCheck(arguments,1,`Response.redirect`),e=w.converters.USVString(e),t=w.converters[`unsigned short`](t);let n;try{n=new URL(e,x.settingsObject.baseUrl)}catch(t){throw TypeError(`Failed to parse URL from ${e}`,{cause:t})}if(!S.has(t))throw RangeError(`Invalid status code ${t}`);let r=U(L({}),`immutable`);r.#t.status=t;let i=O(T(n));return r.#t.headersList.append(`location`,i,!0),r}constructor(e=null,t=void 0){if(w.util.markAsUncloneable(this),e===E)return;e!==null&&(e=w.converters.BodyInit(e,`Response`,`body`)),t=w.converters.ResponseInit(t),this.#t=L({}),this.#e=new r(E),s(this.#e,`response`),c(this.#e,this.#t.headersList);let n=null;if(e!=null){let[t,r]=l(e);n={body:t,type:r}}ee(this,t,n)}get type(){return w.brandCheck(this,w.is.Response),this.#t.type}get url(){w.brandCheck(this,w.is.Response);let e=this.#t.urlList,t=e[e.length-1]??null;return t===null?``:T(t,!0)}get redirected(){return w.brandCheck(this,w.is.Response),this.#t.urlList.length>1}get status(){return w.brandCheck(this,w.is.Response),this.#t.status}get ok(){return w.brandCheck(this,w.is.Response),this.#t.status>=200&&this.#t.status<=299}get statusText(){return w.brandCheck(this,w.is.Response),this.#t.statusText}get headers(){return w.brandCheck(this,w.is.Response),this.#e}get body(){return w.brandCheck(this,w.is.Response),this.#t.body?this.#t.body.stream:null}get bodyUsed(){return w.brandCheck(this,w.is.Response),!!this.#t.body&&m.isDisturbed(this.#t.body.stream)}clone(){if(w.brandCheck(this,w.is.Response),p(this.#t))throw w.errors.exception({header:`Response.clone`,message:`Body has already been consumed.`});let e=I(this.#t);return this.#t.urlList.length!==0&&this.#t.body?.stream&&f.register(this,new WeakRef(this.#t.body.stream)),U(e,o(this.#e))}[h.inspect.custom](e,t){t.depth===null&&(t.depth=2),t.colors??=!0;let n={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${h.formatWithOptions(t,n)}`}static{j=e=>e.#e,M=(e,t)=>{e.#e=t},N=e=>e.#t,P=(e,t)=>{e.#t=t},w.is.Response=e=>typeof e==`object`&&!!e&&#t in e}};d(F,N,w.is.Response),Object.defineProperties(F.prototype,{type:g,url:g,status:g,ok:g,redirected:g,statusText:g,headers:g,clone:g,body:g,bodyUsed:g,[Symbol.toStringTag]:{value:`Response`,configurable:!0}}),Object.defineProperties(F,{json:g,redirect:g,error:g});function I(e){if(e.internalResponse)return V(I(e.internalResponse),e.type);let t=L({...e,body:null});return e.body!=null&&(t.body=u(e.body)),t}function L(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:`default`,status:200,timingInfo:null,cacheState:``,statusText:``,...e,headersList:e?.headersList?new i(e?.headersList):new i,urlList:e?.urlList?[...e.urlList]:[]}}function R(e){return L({type:`error`,status:0,error:b(e)?e:Error(e&&String(e)),aborted:e&&e.name===`AbortError`})}function z(e){return e.type===`error`&&e.status===0}function B(e,t){return t={internalResponse:e,...t},new Proxy(e,{get(e,n){return n in t?t[n]:e[n]},set(e,n,r){return D(!(n in t)),e[n]=r,!0}})}function V(e,t){if(t===`basic`)return B(e,{type:`basic`,headersList:e.headersList});if(t===`cors`)return B(e,{type:`cors`,headersList:e.headersList});if(t===`opaque`)return B(e,{type:`opaque`,urlList:[],status:0,statusText:``,body:null});if(t===`opaqueredirect`)return B(e,{type:`opaqueredirect`,status:0,statusText:``,headersList:[],body:null});D(!1)}function H(e,t=null){return D(v(e)),y(e)?R(Object.assign(new DOMException(`The operation was aborted.`,`AbortError`),{cause:t})):R(Object.assign(new DOMException(`Request was cancelled.`),{cause:t}))}function ee(e,t,n){if(t.status!==null&&(t.status<200||t.status>599))throw RangeError(`init["status"] must be in the range of 200 to 599, inclusive.`);if(`statusText`in t&&t.statusText!=null&&!_(String(t.statusText)))throw TypeError(`Invalid statusText`);if(`status`in t&&t.status!=null&&(N(e).status=t.status),`statusText`in t&&t.statusText!=null&&(N(e).statusText=t.statusText),`headers`in t&&t.headers!=null&&a(j(e),t.headers),n){if(C.includes(e.status))throw w.errors.exception({header:`Response constructor`,message:`Invalid response status code ${e.status}`});N(e).body=n.body,n.type!=null&&!N(e).headersList.contains(`content-type`,!0)&&N(e).headersList.append(`content-type`,n.type,!0)}}function U(e,t){let n=new F(E);P(n,e);let i=new r(E);return M(n,i),c(i,e.headersList),s(i,t),e.urlList.length!==0&&e.body?.stream&&f.register(n,new WeakRef(e.body.stream)),n}w.converters.XMLHttpRequestBodyInit=function(e,t,n){return typeof e==`string`?w.converters.USVString(e,t,n):w.is.Blob(e)||w.is.BufferSource(e)||w.is.FormData(e)||w.is.URLSearchParams(e)?e:w.converters.DOMString(e,t,n)},w.converters.BodyInit=function(e,t,n){return w.is.ReadableStream(e)||e?.[Symbol.asyncIterator]?e:w.converters.XMLHttpRequestBodyInit(e,t,n)},w.converters.ResponseInit=w.dictionaryConverter([{key:`status`,converter:w.converters[`unsigned short`],defaultValue:()=>200},{key:`statusText`,converter:w.converters.ByteString,defaultValue:()=>``},{key:`headers`,converter:w.converters.HeadersInit}]),n.exports={isNetworkError:z,makeNetworkError:R,makeResponse:L,makeAppropriateNetworkError:H,filterResponse:V,Response:F,cloneResponse:I,fromInnerResponse:U,getResponseState:N}})),vn=t(((t,n)=>{var{extractBody:r,mixinBody:i,cloneBody:a,bodyUnusable:o}=ft(),{Headers:s,fill:c,HeadersList:l,setHeadersGuard:u,getHeadersGuard:d,setHeadersList:f,getHeadersList:p}=gn(),m=$(),h=e(`node:util`),{isValidHTTPToken:g,sameOrigin:_,environmentSettingsObject:v}=ct(),{forbiddenMethodsSet:y,corsSafeListedMethodsSet:b,referrerPolicy:x,requestRedirect:S,requestMode:C,requestCredentials:w,requestCache:T,requestDuplex:E}=nt(),{kEnumerableProperty:D,normalizedMethodRecordsBase:O,normalizedMethodRecords:k}=m,{webidl:A}=st(),{URLSerializer:j}=ot(),{kConstruct:M}=Z(),N=e(`node:assert`),{getMaxListeners:P,setMaxListeners:F,defaultMaxListeners:I}=e(`node:events`),L=Symbol(`abortController`),R=new FinalizationRegistry(({signal:e,abort:t})=>{e.removeEventListener(`abort`,t)}),z=new WeakMap,B;try{B=P(new AbortController().signal)>0}catch{B=!1}function V(e){return t;function t(){let n=e.deref();if(n!==void 0){R.unregister(t),this.removeEventListener(`abort`,t),n.abort(this.reason);let e=z.get(n.signal);if(e!==void 0){if(e.size!==0){for(let t of e){let e=t.deref();e!==void 0&&e.abort(this.reason)}e.clear()}z.delete(n.signal)}}}}var H=!1,ee,U,te,W,G,K,ne,q=class{#e;#t;#n;#r;#i=null;constructor(e,t=void 0){if(A.util.markAsUncloneable(this),e===M)return;A.argumentLengthCheck(arguments,1,`Request constructor`),e=A.converters.RequestInfo(e),t=A.converters.RequestInit(t);let n=null,i=null,a=v.settingsObject.baseUrl,d=null;if(typeof e==`string`){this.#t=t.dispatcher;let r;try{r=new URL(e,a)}catch(t){throw TypeError(`Failed to parse URL from `+e,{cause:t})}if(r.username||r.password)throw TypeError(`Request cannot be constructed from a URL that includes credentials: `+e);n=re({urlList:[r]}),i=`cors`}else N(A.is.Request(e)),n=e.#r,d=e.#e,this.#t=t.dispatcher||e.#t;let h=v.settingsObject.origin,x=`client`;if(n.window?.constructor?.name===`EnvironmentSettingsObject`&&_(n.window,h)&&(x=n.window),t.window!=null)throw TypeError(`'window' option '${x}' must be null`);`window`in t&&(x=`no-window`),n=re({method:n.method,headersList:n.headersList,unsafeRequest:n.unsafeRequest,client:v.settingsObject,window:x,priority:n.priority,origin:n.origin,referrer:n.referrer,referrerPolicy:n.referrerPolicy,mode:n.mode,credentials:n.credentials,cache:n.cache,redirect:n.redirect,integrity:n.integrity,keepalive:n.keepalive,reloadNavigation:n.reloadNavigation,historyNavigation:n.historyNavigation,urlList:[...n.urlList]});let S=Object.keys(t).length!==0;if(S&&(n.mode===`navigate`&&(n.mode=`same-origin`),n.reloadNavigation=!1,n.historyNavigation=!1,n.origin=`client`,n.referrer=`client`,n.referrerPolicy=``,n.url=n.urlList[n.urlList.length-1],n.urlList=[n.url]),t.referrer!==void 0){let e=t.referrer;if(e===``)n.referrer=`no-referrer`;else{let t;try{t=new URL(e,a)}catch(t){throw TypeError(`Referrer "${e}" is not a valid URL.`,{cause:t})}t.protocol===`about:`&&t.hostname===`client`||h&&!_(t,v.settingsObject.baseUrl)?n.referrer=`client`:n.referrer=t}}t.referrerPolicy!==void 0&&(n.referrerPolicy=t.referrerPolicy);let C;if(C=t.mode===void 0?i:t.mode,C===`navigate`)throw A.errors.exception({header:`Request constructor`,message:`invalid request mode navigate.`});if(C!=null&&(n.mode=C),t.credentials!==void 0&&(n.credentials=t.credentials),t.cache!==void 0&&(n.cache=t.cache),n.cache===`only-if-cached`&&n.mode!==`same-origin`)throw TypeError(`'only-if-cached' can be set only with 'same-origin' mode`);if(t.redirect!==void 0&&(n.redirect=t.redirect),t.integrity!=null&&(n.integrity=String(t.integrity)),t.keepalive!==void 0&&(n.keepalive=!!t.keepalive),t.method!==void 0){let e=t.method,r=k[e];if(r!==void 0)n.method=r;else{if(!g(e))throw TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(y.has(t))throw TypeError(`'${e}' HTTP method is unsupported.`);e=O[t]??e,n.method=e}!H&&n.method===`patch`&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:`UNDICI-FETCH-patch`}),H=!0)}t.signal!==void 0&&(d=t.signal),this.#r=n;let w=new AbortController;if(this.#e=w.signal,d!=null){if(d.aborted)w.abort(d.reason);else{this[L]=w;let e=V(new WeakRef(w));B&&P(d)===I&&F(1500,d);let t=m.addAbortListener(d,e);R.register(w,{signal:d,abort:e},e),this.#i=()=>{R.unregister(e),t(),this.#i=null}}}if(this.#n=new s(M),f(this.#n,n.headersList),u(this.#n,`request`),C===`no-cors`){if(!b.has(n.method))throw TypeError(`'${n.method} is unsupported in no-cors mode.`);u(this.#n,`request-no-cors`)}if(S){let e=p(this.#n),n=t.headers===void 0?new l(e):t.headers;if(e.clear(),n instanceof l){for(let{name:t,value:r}of n.rawValues())e.append(t,r,!1);e.cookies=n.cookies}else c(this.#n,n)}let T=A.is.Request(e)?e.#r.body:null;if((t.body!=null||T!=null)&&(n.method===`GET`||n.method===`HEAD`))throw TypeError(`Request with GET/HEAD method cannot have body.`);let E=null;if(t.body!=null){let[e,i]=r(t.body,n.keepalive);E=e,i&&!p(this.#n).contains(`content-type`,!0)&&this.#n.append(`content-type`,i,!0)}let D=E??T;if(D!=null&&D.source==null){if(E!=null&&t.duplex==null)throw TypeError(`RequestInit: duplex option is required when sending a body.`);if(n.mode!==`same-origin`&&n.mode!==`cors`)throw TypeError(`If request is made from ReadableStream, mode should be "same-origin" or "cors"`);n.useCORSPreflightFlag=!0}let j=D;if(E==null&&T!=null){if(o(e.#r))throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);let t=new TransformStream;T.stream.pipeThrough(t),j={source:T.source,length:T.length,stream:t.readable}}this.#r.body=j}get method(){return A.brandCheck(this,A.is.Request),this.#r.method}get url(){return A.brandCheck(this,A.is.Request),j(this.#r.url)}get headers(){return A.brandCheck(this,A.is.Request),this.#n}get destination(){return A.brandCheck(this,A.is.Request),this.#r.destination}get referrer(){return A.brandCheck(this,A.is.Request),this.#r.referrer===`no-referrer`?``:this.#r.referrer===`client`?`about:client`:this.#r.referrer.toString()}get referrerPolicy(){return A.brandCheck(this,A.is.Request),this.#r.referrerPolicy}get mode(){return A.brandCheck(this,A.is.Request),this.#r.mode}get credentials(){return A.brandCheck(this,A.is.Request),this.#r.credentials}get cache(){return A.brandCheck(this,A.is.Request),this.#r.cache}get redirect(){return A.brandCheck(this,A.is.Request),this.#r.redirect}get integrity(){return A.brandCheck(this,A.is.Request),this.#r.integrity}get keepalive(){return A.brandCheck(this,A.is.Request),this.#r.keepalive}get isReloadNavigation(){return A.brandCheck(this,A.is.Request),this.#r.reloadNavigation}get isHistoryNavigation(){return A.brandCheck(this,A.is.Request),this.#r.historyNavigation}get signal(){return A.brandCheck(this,A.is.Request),this.#e}get body(){return A.brandCheck(this,A.is.Request),this.#r.body?this.#r.body.stream:null}get bodyUsed(){return A.brandCheck(this,A.is.Request),!!this.#r.body&&m.isDisturbed(this.#r.body.stream)}get duplex(){return A.brandCheck(this,A.is.Request),`half`}clone(){if(A.brandCheck(this,A.is.Request),o(this.#r))throw TypeError(`unusable`);let e=ie(this.#r),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let e=z.get(this.signal);e===void 0&&(e=new Set,z.set(this.signal,e));let n=new WeakRef(t);e.add(n),m.addAbortListener(t.signal,V(n))}return ae(e,this.#t,t.signal,d(this.#n))}[h.inspect.custom](e,t){t.depth===null&&(t.depth=2),t.colors??=!0;let n={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${h.formatWithOptions(t,n)}`}static{ee=(e,t)=>{e.#e=t},U=e=>e.#t,te=(e,t)=>{e.#t=t},W=(e,t)=>{e.#n=t},G=e=>e.#r,K=(e,t)=>{e.#r=t},ne=e=>{e.#i?.()},A.is.Request=e=>typeof e==`object`&&!!e&&#r in e}};i(q,G,A.is.Request);function re(e){return{method:e.method??`GET`,localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??``,window:e.window??`client`,keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??`all`,initiator:e.initiator??``,destination:e.destination??``,priority:e.priority??`auto`,origin:e.origin??`client`,policyContainer:e.policyContainer??`client`,referrer:e.referrer??`client`,referrerPolicy:e.referrerPolicy??``,mode:e.mode??`no-cors`,useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??`same-origin`,useCredentials:e.useCredentials??!1,cache:e.cache??`default`,redirect:e.redirect??`follow`,integrity:e.integrity??``,cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??``,parserMetadata:e.parserMetadata??``,reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??`basic`,preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,useURLCredentials:e.useURLCredentials??void 0,traversableForUserPrompts:e.traversableForUserPrompts??`client`,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new l(e.headersList):new l}}function ie(e){let t=re({...e,body:null});return e.body!=null&&(t.body=a(e.body)),t}function ae(e,t,n,r){let i=new q(M);K(i,e),te(i,t),ee(i,n);let a=new s(M);return W(i,a),f(a,e.headersList),u(a,r),i}Object.defineProperties(q.prototype,{method:D,url:D,headers:D,redirect:D,clone:D,signal:D,duplex:D,destination:D,body:D,bodyUsed:D,isHistoryNavigation:D,isReloadNavigation:D,keepalive:D,integrity:D,cache:D,credentials:D,attribute:D,referrerPolicy:D,referrer:D,mode:D,[Symbol.toStringTag]:{value:`Request`,configurable:!0}}),A.converters.RequestInfo=function(e){return typeof e==`string`?A.converters.USVString(e):A.is.Request(e)?e:A.converters.USVString(e)},A.converters.RequestInit=A.dictionaryConverter([{key:`method`,converter:A.converters.ByteString},{key:`headers`,converter:A.converters.HeadersInit},{key:`body`,converter:A.nullableConverter(A.converters.BodyInit)},{key:`referrer`,converter:A.converters.USVString},{key:`referrerPolicy`,converter:A.converters.DOMString,allowedValues:x},{key:`mode`,converter:A.converters.DOMString,allowedValues:C},{key:`credentials`,converter:A.converters.DOMString,allowedValues:w},{key:`cache`,converter:A.converters.DOMString,allowedValues:T},{key:`redirect`,converter:A.converters.DOMString,allowedValues:S},{key:`integrity`,converter:A.converters.DOMString},{key:`keepalive`,converter:A.converters.boolean},{key:`signal`,converter:A.nullableConverter(e=>A.converters.AbortSignal(e,`RequestInit`,`signal`))},{key:`window`,converter:A.converters.any},{key:`duplex`,converter:A.converters.DOMString,allowedValues:E},{key:`dispatcher`,converter:A.converters.any},{key:`priority`,converter:A.converters.DOMString,allowedValues:[`high`,`low`,`auto`]}]),n.exports={Request:q,makeRequest:re,fromInnerRequest:ae,cloneRequest:ie,getRequestDispatcher:U,getRequestState:G,removeRequestAbortListener:ne}})),yn=t(((t,n)=>{var r=e(`node:assert`),{runtimeFeatures:i}=lt(),a=new Map([[`sha256`,0],[`sha384`,1],[`sha512`,2]]),o;if(i.has(`crypto`)){o=e(`node:crypto`);let t=o.getHashes();t.length===0&&a.clear();for(let e of a.keys())t.includes(e)===!1&&a.delete(e)}else a.clear();var s=Map.prototype.get.bind(a),c=Map.prototype.has.bind(a),l=i.has(`crypto`)===!1||a.size===0?()=>!0:(e,t)=>{let n=d(t);if(n.length===0)return!0;let r=u(n);for(let t of r){let n=t.alg,r=t.val;if(p(f(n,e),r))return!0}return!1};function u(e){let t=[],n=null;for(let i of e){if(r(c(i.alg),`Invalid SRI hash algorithm token`),t.length===0){t.push(i),n=i;continue}let e=n.alg,a=s(e),o=i.alg,l=s(o);l<a||(l>a?(n=i,t[0]=i,t.length=1):t.push(i))}return t}function d(e){let t=[];for(let n of e.split(` `)){let e=n.split(`?`,1)[0],r=``,i=[e.slice(0,6),e.slice(7)],a=i[0];if(!c(a))continue;i[1]&&(r=i[1]);let o={alg:a,val:r};t.push(o)}return t}var f=(e,t)=>o.hash(e,t,`base64`);function p(e,t){let n=e.length;n!==0&&e[n-1]===`=`&&--n,n!==0&&e[n-1]===`=`&&--n;let r=t.length;if(r!==0&&t[r-1]===`=`&&--r,r!==0&&t[r-1]===`=`&&--r,n!==r)return!1;for(let r=0;r<n;++r)if(!(e[r]===t[r]||e[r]===`+`&&t[r]===`-`||e[r]===`/`&&t[r]===`_`))return!1;return!0}n.exports={applyAlgorithmToBytes:f,bytesMatch:l,caseSensitiveMatch:p,isValidSRIHashAlgorithm:c,getStrongestMetadata:u,parseMetadata:d}})),bn=t(((t,n)=>{var{makeNetworkError:r,makeAppropriateNetworkError:i,filterResponse:a,makeResponse:o,fromInnerResponse:s,getResponseState:c}=_n(),{HeadersList:l}=gn(),{Request:u,cloneRequest:d,getRequestDispatcher:f,getRequestState:p,removeRequestAbortListener:m}=vn(),h=e(`node:zlib`),{makePolicyContainer:g,clonePolicyContainer:_,requestBadPort:v,TAOCheck:y,appendRequestOriginHeader:b,responseLocationURL:x,requestCurrentURL:S,setRequestReferrerPolicyOnRedirect:C,tryUpgradeRequestToAPotentiallyTrustworthyURL:w,createOpaqueTimingInfo:T,appendFetchMetadata:E,corsCheck:D,crossOriginResourcePolicyCheck:O,determineRequestsReferrer:k,coarsenedSharedCurrentTime:A,sameOrigin:j,isCancelled:M,isAborted:N,isErrorLike:P,fullyReadBody:F,readableStreamClose:I,urlIsLocal:L,urlIsHttpHttpsScheme:R,urlHasHttpsScheme:z,clampAndCoarsenConnectionTimingInfo:B,simpleRangeHeaderValue:V,buildContentRange:H,createInflate:ee,extractMimeType:U,hasAuthenticationEntry:te,includesCredentials:W,isTraversableNavigable:G}=ct(),K=e(`node:assert`),{safelyExtractBody:ne,extractBody:q}=ft(),{redirectStatusSet:re,nullBodyStatus:ie,safeMethodsSet:ae,requestBodyHeader:J,subresourceSet:oe}=nt(),se=e(`node:events`),{Readable:ce,pipeline:le,finished:ue,isErrored:de,isReadable:Y}=e(`node:stream`),{addAbortListener:fe,bufferToLowerCasedHeaderName:pe}=$(),{SocketError:X}=Q(),{dataURLProcessor:me,serializeAMimeType:he,minimizeSupportedMimeType:ge}=ot(),{getGlobalDispatcher:_e}=Zt(),{webidl:ve}=st(),{STATUS_CODES:ye}=e(`node:http`),{bytesMatch:be}=yn(),{isomorphicEncode:xe}=at(),Se=[`GET`,`HEAD`],Ce=typeof __UNDICI_IS_NODE__<`u`||typeof esbuildDetection<`u`?`node`:`undici`,we;function Te(e,t,n){if(Array.isArray(n)){for(let t=0;t<n.length;t+=2){let r=pe(n[t]),i=n[t+1];if(Array.isArray(i)&&!Buffer.isBuffer(i))for(let t of i)e.append(r,t.toString(`latin1`),!0);else e.append(r,i.toString(`latin1`),!0)}return}for(let[n,r]of Object.entries(t??{}))if(Array.isArray(r))for(let t of r)e.append(n,`${t}`,!0);else e.append(n,`${r}`,!0)}var Ee=class extends se{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state=`ongoing`}terminate(e){this.state===`ongoing`&&(this.state=`terminated`,this.connection?.destroy(e),this.emit(`terminated`,e))}abort(e){this.state===`ongoing`&&(this.state=`aborted`,e||=new DOMException(`The operation was aborted.`,`AbortError`),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit(`terminated`,e))}};function De(e){ke(e,`fetch`)}function Oe(e,t=void 0){ve.argumentLengthCheck(arguments,1,`globalThis.fetch`);let n=Promise.withResolvers(),r;try{r=new u(e,t)}catch(e){return n.reject(e),n.promise}let i=p(r);if(r.signal.aborted)return je(n,i,null,r.signal.reason,null),n.promise;i.client.globalObject?.constructor?.name===`ServiceWorkerGlobalScope`&&(i.serviceWorkers=`none`);let a=null,o=!1,c=null,l=fe(r.signal,()=>{o=!0,K(c!=null),c.abort(r.signal.reason);let e=a?.deref();je(n,i,e,r.signal.reason,c.controller)}),d=()=>{l(),m(r)};return c=Me({request:i,processResponseEndOfBody:e=>{De(e),d()},processResponse:e=>{if(!o){if(e.aborted){je(n,i,a,c.serializedAbortReason,c.controller),d();return}if(e.type===`error`){n.reject(TypeError(`fetch failed`,{cause:e.error})),d();return}a=new WeakRef(s(e,`immutable`)),n.resolve(a.deref()),n=null}},dispatcher:f(r),requestObject:r}),n.promise}function ke(e,t=`other`){if(e.type===`error`&&e.aborted||!e.urlList?.length)return;let n=e.urlList[0],r=e.timingInfo,i=e.cacheState;R(n)&&r!==null&&(e.timingAllowPassed||(r=T({startTime:r.startTime}),i=``),r.endTime=A(),e.timingInfo=r,Ae(r,n.href,t,globalThis,i,``,e.status))}var Ae=performance.markResourceTiming;function je(e,t,n,r,i){if(e&&e.reject(r),t.body?.stream!=null&&Y(t.body.stream)&&t.body.stream.cancel(r).catch(e=>{if(e.code!==`ERR_INVALID_STATE`)throw e}),n==null)return;let a=c(n);a.body?.stream!=null&&Y(a.body.stream)&&i.error(r)}function Me({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:n,processResponse:r,processResponseEndOfBody:i,processResponseConsumeBody:a,useParallelQueue:o=!1,dispatcher:s=_e(),requestObject:c=null}){K(s);let l=null,u=!1;e.client!=null&&(l=e.client.globalObject,u=e.client.crossOriginIsolatedCapability);let d=T({startTime:A(u)}),f={controller:new Ee(s),request:e,timingInfo:d,processRequestBodyChunkLength:t,processRequestEndOfBody:n,processResponse:r,processResponseConsumeBody:a,processResponseEndOfBody:i,taskDestination:l,crossOriginIsolatedCapability:u,requestObject:c};return K(!e.body||e.body.stream),e.window===`client`&&(e.window=e.client?.globalObject?.constructor?.name===`Window`?e.client:`no-window`),e.origin===`client`&&(e.origin=e.client.origin),e.policyContainer===`client`&&(e.policyContainer=e.client==null?g():_(e.client.policyContainer)),e.headersList.contains(`accept`,!0)||e.headersList.append(`accept`,`*/*`,!0),e.headersList.contains(`accept-language`,!0)||e.headersList.append(`accept-language`,`*`,!0),e.priority,oe.has(e.destination),Ne(f,!1),f.controller}async function Ne(e,t){try{let n=e.request,i=null;if(n.localURLsOnly&&!L(S(n))&&(i=r(`local URLs only`)),w(n),v(n)===`blocked`&&(i=r(`bad port`)),n.referrerPolicy===``&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!==`no-referrer`&&(n.referrer=k(n)),i===null){let t=S(n);j(t,n.url)&&n.responseTainting===`basic`||t.protocol===`data:`||n.mode===`navigate`||n.mode===`websocket`?(n.responseTainting=`basic`,i=await Pe(e)):n.mode===`same-origin`?i=r(`request mode cannot be "same-origin"`):n.mode===`no-cors`?n.redirect===`follow`?(n.responseTainting=`opaque`,i=await Pe(e)):i=r(`redirect mode cannot be "follow" for "no-cors" request`):R(S(n))?(n.responseTainting=`cors`,i=await Le(e)):i=r(`URL scheme must be a HTTP(S) scheme`)}if(t)return i;i.status!==0&&!i.internalResponse&&(n.responseTainting,n.responseTainting===`basic`?i=a(i,`basic`):n.responseTainting===`cors`?i=a(i,`cors`):n.responseTainting===`opaque`?i=a(i,`opaque`):K(!1));let o=i.status===0?i:i.internalResponse;if(o.urlList.length===0&&o.urlList.push(...n.urlList),n.timingAllowFailed||(i.timingAllowPassed=!0),i.type===`opaque`&&o.status===206&&o.rangeRequested&&!n.headers.contains(`range`,!0)&&(i=o=r()),i.status!==0&&(n.method===`HEAD`||n.method===`CONNECT`||ie.includes(o.status))&&(o.body=null,e.controller.dump=!0),n.integrity){let t=t=>Ie(e,r(t));if(n.responseTainting===`opaque`||i.body==null){t(i.error);return}F(i.body,r=>{if(!be(r,n.integrity)){t(`integrity mismatch`);return}i.body=ne(r)[0],Ie(e,i)},t)}else Ie(e,i)}catch(t){e.controller.terminate(t)}}function Pe(t){if(M(t))return Promise.resolve(i(t));let{request:n}=t,{protocol:a}=S(n);switch(a){case`about:`:return Promise.resolve(r(`about scheme is not supported`));case`blob:`:{we||=e(`node:buffer`).resolveObjectURL;let t=S(n);if(t.search.length!==0)return Promise.resolve(r(`NetworkError when attempting to fetch resource.`));let i=we(t.toString());if(n.method!==`GET`||!ve.is.Blob(i))return Promise.resolve(r(`invalid method`));let a=o(),s=i.size,c=xe(`${s}`),l=i.type;if(n.headersList.contains(`range`,!0)){a.rangeRequested=!0;let e=V(n.headersList.get(`range`,!0),!0);if(e===`failure`)return Promise.resolve(r(`failed to fetch the data URL`));let{rangeStartValue:t,rangeEndValue:o}=e;if(t===null)t=s-o,o=t+o-1;else{if(t>=s)return Promise.resolve(r(`Range start is greater than the blob's size.`));(o===null||o>=s)&&(o=s-1)}let c=i.slice(t,o+1,l);a.body=q(c)[0];let u=xe(`${c.size}`),d=H(t,o,s);a.status=206,a.statusText=`Partial Content`,a.headersList.set(`content-length`,u,!0),a.headersList.set(`content-type`,l,!0),a.headersList.set(`content-range`,d,!0)}else{let e=q(i);a.statusText=`OK`,a.body=e[0],a.headersList.set(`content-length`,c,!0),a.headersList.set(`content-type`,l,!0)}return Promise.resolve(a)}case`data:`:{let e=me(S(n));if(e===`failure`)return Promise.resolve(r(`failed to fetch the data URL`));let t=he(e.mimeType);return Promise.resolve(o({statusText:`OK`,headersList:[[`content-type`,{name:`Content-Type`,value:t}]],body:ne(e.body)[0]}))}case`file:`:return Promise.resolve(r(`not implemented... yet...`));case`http:`:case`https:`:return Le(t).catch(e=>r(e));default:return Promise.resolve(r(`unknown scheme`))}}function Fe(e,t){e.request.done=!0,e.processResponseDone!=null&&queueMicrotask(()=>e.processResponseDone(t))}function Ie(e,t){let n=e.timingInfo;e.request.destination===`document`&&(e.controller.fullTimingInfo=n);let r=()=>{let r=Date.now();e.controller.reportTimingSteps=()=>{if(!R(e.request.url))return;n.endTime=r;let i=t.cacheState,a=t.bodyInfo;t.timingAllowPassed||(n=T(n),i=``);let o=0;if(e.request.mode!==`navigate`||!t.hasCrossOriginRedirects){o=t.status;let e=U(t.headersList);e!==`failure`&&(a.contentType=ge(e))}e.request.initiatorType!=null&&Ae(n,e.request.url.href,e.request.initiatorType,globalThis,i,a,o)};let i=()=>{e.request.done=!0,e.processResponseEndOfBody!=null&&queueMicrotask(()=>e.processResponseEndOfBody(t)),e.request.initiatorType!=null&&e.controller.reportTimingSteps()};queueMicrotask(()=>i())};e.processResponse!=null&&queueMicrotask(()=>{e.processResponse(t),e.processResponse=null});let i=t.type===`error`?t:t.internalResponse??t;if(i.body==null?r():ue(i.body.stream,()=>{r()}),e.processResponseConsumeBody!=null){let n=n=>e.processResponseConsumeBody(t,n);i.body==null?queueMicrotask(()=>n(null)):F(i.body,n,()=>e.processResponseConsumeBody(t,`failure`))}}async function Le(e){let t=e.request,n=null,i=null,a=e.timingInfo;if(t.serviceWorkers,n===null){if(t.redirect===`follow`&&(t.serviceWorkers=`none`),i=n=await ze(e),t.responseTainting===`cors`&&D(t,n)===`failure`)return r(`cors failure`);y(t,n)===`failure`&&(t.timingAllowFailed=!0)}return(t.responseTainting===`opaque`||n.type===`opaque`)&&O(t.origin,t.client,t.destination,i)===`blocked`?r(`blocked`):(re.has(i.status)&&(t.redirect!==`manual`&&e.controller.connection.destroy(),t.redirect===`error`?n=r(`unexpected redirect`):t.redirect===`manual`?n=i:t.redirect===`follow`?n=await Re(e,n):K(!1)),n.timingInfo=a,n)}function Re(e,t){let n=e.request,i=t.internalResponse?t.internalResponse:t,a;try{if(a=x(i,S(n).hash),a==null)return t}catch(e){return Promise.resolve(r(e))}if(!R(a))return Promise.resolve(r(`URL scheme must be a HTTP(S) scheme`));if(n.redirectCount===20)return Promise.resolve(r(`redirect count exceeded`));if(n.redirectCount+=1,n.mode===`cors`&&(a.username||a.password)&&!j(n,a))return Promise.resolve(r(`cross origin not allowed for request mode "cors"`));if(n.responseTainting===`cors`&&(a.username||a.password))return Promise.resolve(r(`URL cannot contain credentials for request mode "cors"`));if(i.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(r());if([301,302].includes(i.status)&&n.method===`POST`||i.status===303&&!Se.includes(n.method)){n.method=`GET`,n.body=null;for(let e of J)n.headersList.delete(e)}j(S(n),a)||(n.headersList.delete(`authorization`,!0),n.headersList.delete(`proxy-authorization`,!0),n.headersList.delete(`cookie`,!0),n.headersList.delete(`host`,!0)),n.body!=null&&(K(n.body.source!=null),n.body=ne(n.body.source)[0]);let o=e.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=A(e.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),n.urlList.push(a),C(n,i),Ne(e,!0)}async function ze(e,t=!1,n=!1){let a=e.request,o=null,s=null,c=null;a.window===`no-window`&&a.redirect===`error`?(o=e,s=a):(a.body?.source==null?(s=d({...a,body:null}),s.body=a.body):s=d(a),o={...e},o.request=s);let l=a.credentials===`include`||a.credentials===`same-origin`&&a.responseTainting===`basic`,u=s.body?s.body.length:null,f=null;if(s.body==null&&[`POST`,`PUT`].includes(s.method)&&(f=`0`),u!=null&&(f=xe(`${u}`)),f!=null&&!s.headersList.contains(`content-length`,!0)&&s.headersList.append(`content-length`,f,!0),u!=null&&s.keepalive,ve.is.URL(s.referrer)&&s.headersList.append(`referer`,xe(s.referrer.href),!0),b(s),E(s),s.headersList.contains(`user-agent`,!0)||s.headersList.append(`user-agent`,Ce,!0),s.cache==="default"&&(s.headersList.contains(`if-modified-since`,!0)||s.headersList.contains(`if-none-match`,!0)||s.headersList.contains(`if-unmodified-since`,!0)||s.headersList.contains(`if-match`,!0)||s.headersList.contains(`if-range`,!0))&&(s.cache=`no-store`),s.cache===`no-cache`&&!s.preventNoCacheCacheControlHeaderModification&&!s.headersList.contains(`cache-control`,!0)&&s.headersList.append(`cache-control`,`max-age=0`,!0),(s.cache===`no-store`||s.cache===`reload`)&&(s.headersList.contains(`pragma`,!0)||s.headersList.append(`pragma`,`no-cache`,!0),s.headersList.contains(`cache-control`,!0)||s.headersList.append(`cache-control`,`no-cache`,!0)),s.headersList.contains(`range`,!0)&&s.headersList.append(`accept-encoding`,`identity`,!0),s.headersList.contains(`accept-encoding`,!0)||(z(S(s))?s.headersList.append(`accept-encoding`,`br, gzip, deflate, zstd`,!0):s.headersList.append(`accept-encoding`,`gzip, deflate`,!0)),s.headersList.delete(`host`,!0),l&&!s.headersList.contains(`authorization`,!0)){let e=null;if((!te(s)||s.useURLCredentials!==void 0&&W(S(s)))&&W(S(s))&&t){let{username:t,password:n}=S(s);e=`Basic ${Buffer.from(`${t}:${n}`).toString(`base64`)}`}e!==null&&s.headersList.append(`Authorization`,e,!1)}if(s.cache=`no-store`,s.cache!==`no-store`&&s.cache,c==null){if(s.cache===`only-if-cached`)return r(`only if cached`);let e=await Be(o,l,n);!ae.has(s.method)&&e.status>=200&&e.status,c??=e}if(c.urlList=[...s.urlList],s.headersList.contains(`range`,!0)&&(c.rangeRequested=!0),c.requestIncludesCredentials=l,c.status===401&&s.responseTainting!==`cors`&&l&&(a.useURLCredentials!==void 0||G(a.traversableForUserPrompts))){if(a.body!=null){if(a.body.source==null)return c;a.body=ne(a.body.source)[0]}if(a.useURLCredentials===void 0||t)return M(e)?i(e):c;e.controller.connection.destroy(),c=await ze(e,!0)}if(c.status===407)return a.window===`no-window`?r():M(e)?i(e):r(`proxy authentication required`);if(c.status===421&&!n&&(a.body==null||a.body.source!=null)){if(M(e))return i(e);e.controller.connection.destroy(),c=await ze(e,t,!0)}return c}async function Be(e,t=!1,n=!1){K(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(e){this.destroyed||(this.destroyed=!0,this.abort?.(e??new DOMException(`The operation was aborted.`,`AbortError`)))}};let a=e.request,s=null,c=e.timingInfo;a.cache=`no-store`,a.mode;let u=null;if(a.body==null&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(a.body!=null){let t=async function*(t){M(e)||(yield t,e.processRequestBodyChunkLength?.(t.byteLength))},n=()=>{M(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},r=t=>{M(e)||(t.name===`AbortError`?e.controller.abort():e.controller.terminate(t))};u=(async function*(){try{for await(let e of a.body.stream)yield*t(e);n()}catch(e){r(e)}})()}try{let{body:t,status:n,statusText:r,headersList:i,socket:a}=await p({body:u});if(a)s=o({status:n,statusText:r,headersList:i,socket:a});else{let a=t[Symbol.asyncIterator]();e.controller.next=()=>a.next(),s=o({status:n,statusText:r,headersList:i})}}catch(t){return t.name===`AbortError`?(e.controller.connection.destroy(),i(e,t)):r(t)}let d=new ReadableStream({start(t){e.controller.controller=t},pull:()=>e.controller.resume(),cancel:t=>{M(e)||e.controller.abort(t)},type:`bytes`});s.body={stream:d,source:null,length:null},e.controller.resume||e.controller.on(`terminated`,f),e.controller.resume=async()=>{for(;;){let t,n;try{let{done:n,value:r}=await e.controller.next();if(N(e))break;t=n?void 0:r}catch(r){e.controller.ended&&!c.encodedBodySize?t=void 0:(t=r,n=!0)}if(t===void 0){I(e.controller.controller),Fe(e,s);return}if(c.decodedBodySize+=t?.byteLength??0,n){e.controller.terminate(t);return}let r=new Uint8Array(t);if(r.byteLength&&e.controller.controller.enqueue(r),de(d)){e.controller.terminate();return}if(e.controller.controller.desiredSize<=0)return}};function f(t){N(e)?(s.aborted=!0,Y(d)&&e.controller.controller.error(e.controller.serializedAbortReason)):Y(d)&&e.controller.controller.error(TypeError(`terminated`,{cause:P(t)?t:void 0})),e.controller.connection.destroy()}return s;function p({body:t}){let n=S(a),r=e.controller.dispatcher,i=n.pathname+n.search,o=n.search.length===0&&n.href[n.href.length-n.hash.length-1]===`?`;return s(t);function s(t,u){return new Promise((d,f)=>r.dispatch({path:o?`${i}?`:i,origin:n.origin,method:a.method,body:r.isMockActive?a.body&&(a.body.source||a.body.stream):t,__mockAgentBodyForDispatch:t,headers:a.headersList.entries,maxRedirections:0,upgrade:a.mode===`websocket`?`websocket`:void 0,...u===!1?{allowH2:u}:null},{body:null,abort:null,onRequestStart(t){let{connection:n}=e.controller;c.finalConnectionTimingInfo=B(void 0,c.postRedirectStartTime,e.crossOriginIsolatedCapability);let r=e=>t.abort(e);n.destroyed?r(new DOMException(`The operation was aborted.`,`AbortError`)):(e.controller.on(`terminated`,r),this.abort=n.abort=r),c.finalNetworkRequestStartTime=A(e.crossOriginIsolatedCapability)},onResponseStarted(){c.finalNetworkResponseStartTime=A(e.crossOriginIsolatedCapability)},onResponseStart(e,t,n,r){if(t<200)return;let i=e?.rawHeaders??[],o=new l;Te(o,n,i);let s=o.get(`location`,!0);this.body=new ce({read:()=>e.resume()});let c=s&&a.redirect===`follow`&&re.has(t),u=[];if(a.method!==`HEAD`&&a.method!==`CONNECT`&&!ie.includes(t)&&!c){let e=o.get(`content-encoding`,!0),t=e?e.toLowerCase().split(`,`):[];if(t.length>5){f(Error(`too many content-encodings in response: ${t.length}, maximum allowed is 5`));return}for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n===`x-gzip`||n===`gzip`)u.push(h.createGunzip({flush:h.constants.Z_SYNC_FLUSH,finishFlush:h.constants.Z_SYNC_FLUSH}));else if(n===`deflate`)u.push(ee({flush:h.constants.Z_SYNC_FLUSH,finishFlush:h.constants.Z_SYNC_FLUSH}));else if(n===`br`)u.push(h.createBrotliDecompress({flush:h.constants.BROTLI_OPERATION_FLUSH,finishFlush:h.constants.BROTLI_OPERATION_FLUSH}));else if(n===`zstd`)u.push(h.createZstdDecompress({flush:h.constants.ZSTD_e_continue,finishFlush:h.constants.ZSTD_e_end}));else{u.length=0;break}}}let p=t=>this.onResponseError(e,t);d({status:t,statusText:r,headersList:o,body:u.length?le(this.body,...u,t=>{t&&this.onResponseError(e,t)}).on(`error`,p):this.body.on(`error`,p)})},onResponseData(t,n){if(e.controller.dump)return;let r=n;c.encodedBodySize+=r.byteLength,this.body.push(r)===!1&&t.pause()},onResponseEnd(){this.abort&&e.controller.off(`terminated`,this.abort),e.controller.ended=!0,this.body?.push(null)},onResponseError(n,r){if(this.abort&&e.controller.off(`terminated`,this.abort),a.mode===`websocket`&&u!==!1&&r?.code===`UND_ERR_INFO`&&r?.message===`HTTP/2: Extended CONNECT protocol not supported by server`){d(s(t,!1));return}this.body?.destroy(r),n?.aborted||e.controller.terminate(r),f(r)},onRequestUpgrade(e,t,n,r){if(r.session!=null&&t!==200||r.session==null&&t!==101)return r.session!=null&&e.abort(new X(`bad upgrade`,null)),!1;let i=e?.rawHeaders??[],a=new l;return Te(a,n,i),d({status:t,statusText:ye[t],headersList:a,socket:r}),!0}}))}}}n.exports={fetch:Oe,Fetch:Ee,fetching:Me,finalizeAndReportTiming:ke}})),xn=t(((t,n)=>{var r=e(`node:assert`),{URLSerializer:i}=ot(),{isValidHeaderName:a}=ct();function o(e,t,n=!1){return i(e,n)===i(t,n)}function s(e){r(e!==null);let t=[];for(let n of e.split(`,`))n=n.trim(),a(n)&&t.push(n);return t}n.exports={urlEquals:o,getFieldValues:s}})),Sn=t(((t,n)=>{var r=e(`node:assert`),{kConstruct:i}=Z(),{urlEquals:a,getFieldValues:o}=xn(),{kEnumerableProperty:s,isDisturbed:c}=$(),{webidl:l}=st(),{cloneResponse:u,fromInnerResponse:d,getResponseState:f}=_n(),{Request:p,fromInnerRequest:m,getRequestState:h}=vn(),{fetching:g}=bn(),{urlIsHttpHttpsScheme:_,readAllBytes:v}=ct(),y=class{#e;constructor(){arguments[0]!==i&&l.illegalConstructor(),l.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,t={}){l.brandCheck(this,l.is.Cache);let n=`Cache.match`;l.argumentLengthCheck(arguments,1,n),e=l.converters.RequestInfo(e),t=l.converters.CacheQueryOptions(t,n,`options`);let r=this.#i(e,t,1);if(r.length!==0)return r[0]}async matchAll(e=void 0,t={}){return l.brandCheck(this,l.is.Cache),e!==void 0&&(e=l.converters.RequestInfo(e)),t=l.converters.CacheQueryOptions(t,`Cache.matchAll`,`options`),this.#i(e,t)}async add(e){l.brandCheck(this,l.is.Cache),l.argumentLengthCheck(arguments,1,`Cache.add`),e=l.converters.RequestInfo(e);let t=[e];return await this.addAll(t)}async addAll(e){l.brandCheck(this,l.is.Cache);let t=`Cache.addAll`;l.argumentLengthCheck(arguments,1,t);let n=[],r=[];for(let n of e){if(n===void 0)throw l.errors.conversionFailed({prefix:t,argument:`Argument 1`,types:[`undefined is not allowed`]});if(n=l.converters.RequestInfo(n),typeof n==`string`)continue;let e=h(n);if(!_(e.url)||e.method!==`GET`)throw l.errors.exception({header:t,message:`Expected http/s scheme when method is not GET.`})}let i=[];for(let a of e){let e=h(new p(a));if(!_(e.url))throw l.errors.exception({header:t,message:`Expected http/s scheme.`});e.initiator=`fetch`,e.destination=`subresource`,r.push(e);let s=Promise.withResolvers();i.push(g({request:e,processResponse(e){if(e.type===`error`||e.status===206||e.status<200||e.status>299)s.reject(l.errors.exception({header:`Cache.addAll`,message:`Received an invalid status code or the request failed.`}));else if(e.headersList.contains(`vary`)){let t=o(e.headersList.get(`vary`));for(let e of t)if(e===`*`){s.reject(l.errors.exception({header:`Cache.addAll`,message:`invalid vary field value`}));for(let e of i)e.abort();return}}},processResponseConsumeBody(e){if(e.aborted){s.reject(new DOMException(`aborted`,`AbortError`));return}s.resolve(e)}})),n.push(s.promise)}let a=await Promise.all(n),s=[],c=0;for(let e of a){let t={type:`put`,request:r[c],response:e};s.push(t),c++}let u=Promise.withResolvers(),d=null;try{this.#t(s)}catch(e){d=e}return queueMicrotask(()=>{d===null?u.resolve(void 0):u.reject(d)}),u.promise}async put(e,t){l.brandCheck(this,l.is.Cache);let n=`Cache.put`;l.argumentLengthCheck(arguments,2,n),e=l.converters.RequestInfo(e),t=l.converters.Response(t,n,`response`);let r=null;if(r=l.is.Request(e)?h(e):h(new p(e)),!_(r.url)||r.method!==`GET`)throw l.errors.exception({header:n,message:`Expected an http/s scheme when method is not GET`});let i=f(t);if(i.status===206)throw l.errors.exception({header:n,message:`Got 206 status`});if(i.headersList.contains(`vary`)){let e=o(i.headersList.get(`vary`));for(let t of e)if(t===`*`)throw l.errors.exception({header:n,message:`Got * vary field value`})}if(i.body&&(c(i.body.stream)||i.body.stream.locked))throw l.errors.exception({header:n,message:`Response body is locked or disturbed`});let a=u(i),s=Promise.withResolvers();i.body==null?s.resolve(void 0):v(i.body.stream.getReader(),s.resolve,s.reject);let d=[],m={type:`put`,request:r,response:a};d.push(m);let g=await s.promise;a.body!=null&&(a.body.source=g);let y=Promise.withResolvers(),b=null;try{this.#t(d)}catch(e){b=e}return queueMicrotask(()=>{b===null?y.resolve():y.reject(b)}),y.promise}async delete(e,t={}){l.brandCheck(this,l.is.Cache);let n=`Cache.delete`;l.argumentLengthCheck(arguments,1,n),e=l.converters.RequestInfo(e),t=l.converters.CacheQueryOptions(t,n,`options`);let i=null;if(l.is.Request(e)){if(i=h(e),i.method!==`GET`&&!t.ignoreMethod)return!1}else r(typeof e==`string`),i=h(new p(e));let a=[],o={type:`delete`,request:i,options:t};a.push(o);let s=Promise.withResolvers(),c=null,u;try{u=this.#t(a)}catch(e){c=e}return queueMicrotask(()=>{c===null?s.resolve(!!u?.length):s.reject(c)}),s.promise}async keys(e=void 0,t={}){l.brandCheck(this,l.is.Cache),e!==void 0&&(e=l.converters.RequestInfo(e)),t=l.converters.CacheQueryOptions(t,`Cache.keys`,`options`);let n=null;if(e!==void 0){if(l.is.Request(e)){if(n=h(e),n.method!==`GET`&&!t.ignoreMethod)return[]}else typeof e==`string`&&(n=h(new p(e)))}let r=Promise.withResolvers(),i=[];if(e===void 0)for(let e of this.#e)i.push(e[0]);else{let e=this.#n(n,t);for(let t of e)i.push(t[0])}return queueMicrotask(()=>{let e=[];for(let t of i){let n=m(t,void 0,new AbortController().signal,`immutable`);e.push(n)}r.resolve(Object.freeze(e))}),r.promise}#t(e){let t=this.#e,n=[...t],i=[],a=[];try{for(let n of e){if(n.type!==`delete`&&n.type!==`put`)throw l.errors.exception({header:`Cache.#batchCacheOperations`,message:`operation type does not match "delete" or "put"`});if(n.type===`delete`&&n.response!=null)throw l.errors.exception({header:`Cache.#batchCacheOperations`,message:`delete operation should not have an associated response`});if(this.#n(n.request,n.options,i).length)throw new DOMException(`???`,`InvalidStateError`);let e;if(n.type===`delete`){if(e=this.#n(n.request,n.options),e.length===0)return[];for(let n of e){let e=t.indexOf(n);r(e!==-1),t.splice(e,1)}}else if(n.type===`put`){if(n.response==null)throw l.errors.exception({header:`Cache.#batchCacheOperations`,message:`put operation should have an associated response`});let a=n.request;if(!_(a.url))throw l.errors.exception({header:`Cache.#batchCacheOperations`,message:`expected http or https scheme`});if(a.method!==`GET`)throw l.errors.exception({header:`Cache.#batchCacheOperations`,message:`not get method`});if(n.options!=null)throw l.errors.exception({header:`Cache.#batchCacheOperations`,message:`options must not be defined`});e=this.#n(n.request);for(let n of e){let e=t.indexOf(n);r(e!==-1),t.splice(e,1)}t.push([n.request,n.response]),i.push([n.request,n.response])}a.push([n.request,n.response])}return a}catch(e){throw this.#e.length=0,this.#e=n,e}}#n(e,t,n){let r=[],i=n??this.#e;for(let n of i){let[i,a]=n;this.#r(e,i,a,t)&&r.push(n)}return r}#r(e,t,n=null,r){let i=new URL(e.url),s=new URL(t.url);if(r?.ignoreSearch&&(s.search=``,i.search=``),!a(i,s,!0))return!1;if(n==null||r?.ignoreVary||!n.headersList.contains(`vary`))return!0;let c=o(n.headersList.get(`vary`));for(let n of c)if(n===`*`||t.headersList.get(n)!==e.headersList.get(n))return!1;return!0}#i(e,t,n=1/0){let r=null;if(e!==void 0){if(l.is.Request(e)){if(r=h(e),r.method!==`GET`&&!t.ignoreMethod)return[]}else typeof e==`string`&&(r=h(new p(e)))}let i=[];if(e===void 0)for(let e of this.#e)i.push(e[1]);else{let e=this.#n(r,t);for(let t of e)i.push(t[1])}let a=[];for(let e of i){let t=d(u(e),`immutable`);if(a.push(t),a.length>=n)break}return Object.freeze(a)}static{l.is.Cache=e=>typeof e==`object`&&!!e&&#e in e}};Object.defineProperties(y.prototype,{[Symbol.toStringTag]:{value:`Cache`,configurable:!0},match:s,matchAll:s,add:s,addAll:s,put:s,delete:s,keys:s});var b=[{key:`ignoreSearch`,converter:l.converters.boolean,defaultValue:()=>!1},{key:`ignoreMethod`,converter:l.converters.boolean,defaultValue:()=>!1},{key:`ignoreVary`,converter:l.converters.boolean,defaultValue:()=>!1}];l.converters.CacheQueryOptions=l.dictionaryConverter(b),l.converters.MultiCacheQueryOptions=l.dictionaryConverter([...b,{key:`cacheName`,converter:l.converters.DOMString}]),l.converters.Response=l.interfaceConverter(l.is.Response,`Response`),l.converters[`sequence<RequestInfo>`]=l.sequenceConverter(l.converters.RequestInfo),n.exports={Cache:y}})),Cn=t(((e,t)=>{var{Cache:n}=Sn(),{webidl:r}=st(),{kEnumerableProperty:i}=$(),{kConstruct:a}=Z(),o=class{#e=new Map;constructor(){arguments[0]!==a&&r.illegalConstructor(),r.util.markAsUncloneable(this)}async match(e,t={}){if(r.brandCheck(this,r.is.CacheStorage),r.argumentLengthCheck(arguments,1,`CacheStorage.match`),e=r.converters.RequestInfo(e),t=r.converters.MultiCacheQueryOptions(t),t.cacheName!=null){if(this.#e.has(t.cacheName))return await new n(a,this.#e.get(t.cacheName)).match(e,t)}else for(let r of this.#e.values()){let i=await new n(a,r).match(e,t);if(i!==void 0)return i}}async has(e){r.brandCheck(this,r.is.CacheStorage);let t=`CacheStorage.has`;return r.argumentLengthCheck(arguments,1,t),e=r.converters.DOMString(e,t,`cacheName`),this.#e.has(e)}async open(e){r.brandCheck(this,r.is.CacheStorage);let t=`CacheStorage.open`;if(r.argumentLengthCheck(arguments,1,t),e=r.converters.DOMString(e,t,`cacheName`),this.#e.has(e))return new n(a,this.#e.get(e));let i=[];return this.#e.set(e,i),new n(a,i)}async delete(e){r.brandCheck(this,r.is.CacheStorage);let t=`CacheStorage.delete`;return r.argumentLengthCheck(arguments,1,t),e=r.converters.DOMString(e,t,`cacheName`),this.#e.delete(e)}async keys(){return r.brandCheck(this,r.is.CacheStorage),[...this.#e.keys()]}static{r.is.CacheStorage=e=>typeof e==`object`&&!!e&&#e in e}};Object.defineProperties(o.prototype,{[Symbol.toStringTag]:{value:`CacheStorage`,configurable:!0},match:i,has:i,open:i,delete:i,keys:i}),t.exports={CacheStorage:o}})),wn=t(((e,t)=>{t.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}})),Tn=t(((e,t)=>{function n(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}function r(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw Error(`Invalid cookie name`)}}function i(e){let t=e.length,n=0;if(e[0]===`"`){if(t===1||e[t-1]!==`"`)throw Error(`Invalid cookie value`);--t,++n}for(;n<t;){let t=e.charCodeAt(n++);if(t<33||t>126||t===34||t===44||t===59||t===92)throw Error(`Invalid cookie value`)}}function a(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<32||n>126||n===59)throw Error(`Invalid cookie path`)}}function o(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function s(e){if(e===` `)return;if(e.length>255)throw Error(`Invalid cookie domain`);let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r===46){if(t===0||e.charCodeAt(n-1)===45)throw Error(`Invalid cookie domain`);t=0;continue}if(t===0&&!o(r)||!o(r)&&r!==45||++t>63)throw Error(`Invalid cookie domain`)}if(t===0||e.charCodeAt(e.length-1)===45)throw Error(`Invalid cookie domain`)}var c=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],l=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],u=Array(61).fill(0).map((e,t)=>t.toString().padStart(2,`0`));function d(e){return typeof e==`number`&&(e=new Date(e)),`${c[e.getUTCDay()]}, ${u[e.getUTCDate()]} ${l[e.getUTCMonth()]} ${e.getUTCFullYear()} ${u[e.getUTCHours()]}:${u[e.getUTCMinutes()]}:${u[e.getUTCSeconds()]} GMT`}function f(e){if(e<0)throw Error(`Invalid cookie max-age`)}function p(e){if(e.name.length===0)return null;r(e.name),i(e.value);let t=[`${e.name}=${e.value}`];e.name.startsWith(`__Secure-`)&&(e.secure=!0),e.name.startsWith(`__Host-`)&&(e.secure=!0,e.domain=null,e.path=`/`),e.secure&&t.push(`Secure`),e.httpOnly&&t.push(`HttpOnly`),typeof e.maxAge==`number`&&(f(e.maxAge),t.push(`Max-Age=${e.maxAge}`)),e.domain&&(s(e.domain),t.push(`Domain=${e.domain}`)),e.path&&(a(e.path),t.push(`Path=${e.path}`)),e.expires!=null&&e.expires.toString()!==`Invalid Date`&&t.push(`Expires=${d(e.expires)}`),e.sameSite&&t.push(`SameSite=${e.sameSite}`);for(let n of e.unparsed){if(!n.includes(`=`))throw Error(`Invalid unparsed`);let[e,...a]=n.split(`=`),o=e.trim(),s=a.join(`=`);r(o),i(s),t.push(`${o}=${s}`)}return t.join(`; `)}t.exports={isCTLExcludingHtab:n,validateCookieName:r,validateCookiePath:a,validateCookieValue:i,toIMFDate:d,stringify:p}})),En=t(((t,n)=>{var{collectASequenceOfCodePointsFast:r}=at(),{maxNameValuePairSize:i,maxAttributeValueSize:a}=wn(),{isCTLExcludingHtab:o}=Tn(),s=e(`node:assert`);function c(e){if(o(e))return null;let t=``,n=``,a=``,s=``;if(e.includes(`;`)){let i={position:0};t=r(`;`,e,i),n=e.slice(i.position)}else t=e;if(!t.includes(`=`))s=t;else{let e={position:0};a=r(`=`,t,e),s=t.slice(e.position+1)}return a=a.trim(),s=s.trim(),a.length+s.length>i?null:{name:a,value:s,...l(n)}}function l(e,t={}){for(;;){if(e.length===0)return t;s(e[0]===`;`),e=e.slice(1);let n=``;e.includes(`;`)?(n=r(`;`,e,{position:0}),e=e.slice(n.length)):(n=e,e=``);let i=``,o=``;if(n.includes(`=`)){let e={position:0};i=r(`=`,n,e),o=n.slice(e.position+1)}else i=n;if(i=i.trim(),o=o.trim(),o.length>a)continue;let c=i.toLowerCase();if(c===`expires`){let e=new Date(o);Number.isNaN(e.getTime())||(t.expires=e)}else if(c===`max-age`){let e=o.charCodeAt(0),n=e>=48&&e<=57,r=o[0]===`-`&&o.length>1;if(!n&&!r||/[^\d]/.test(o.slice(1)))continue;t.maxAge=Number(o)}else if(c===`domain`){let e=o;e[0]===`.`&&(e=e.slice(1)),e=e.toLowerCase(),t.domain=e}else if(c===`path`){let e=``;e=o.length===0||o[0]!==`/`?`/`:o,t.path=e}else if(c===`secure`)t.secure=!0;else if(c===`httponly`)t.httpOnly=!0;else if(c===`samesite`){let e=o.toLowerCase();e===`none`?t.sameSite=`None`:e===`strict`?t.sameSite=`Strict`:e===`lax`&&(t.sameSite=`Lax`)}else t.unparsed??=[],t.unparsed.push(`${i}=${o}`)}}n.exports={parseSetCookie:c,parseUnparsedAttributes:l}})),Dn=t(((e,t)=>{var{parseSetCookie:n}=En(),{stringify:r}=Tn(),{webidl:i}=st(),a=e=>i.brandCheck(e,i.util.MakeTypeAssertion(globalThis.Headers)),o=e=>i.brandCheck(e,i.is.Headers);function s(e){try{o(e);return}catch{}a(e)}function c(e){i.argumentLengthCheck(arguments,1,`getCookies`),s(e);let t=e.get(`cookie`),n={__proto__:null};if(!t)return n;for(let e of t.split(`;`)){let[t,...r]=e.split(`=`);n[t.trim()]=r.join(`=`)}return n}function l(e,t,n){s(e);let r=`deleteCookie`;i.argumentLengthCheck(arguments,2,r),t=i.converters.DOMString(t,r,`name`),n=i.converters.DeleteCookieAttributes(n),f(e,{name:t,value:``,expires:new Date(0),...n})}function u(e){i.argumentLengthCheck(arguments,1,`getSetCookies`),s(e);let t=e.getSetCookie();return t?t.map(e=>n(e)):[]}function d(e){return e=i.converters.DOMString(e),n(e)}function f(e,t){i.argumentLengthCheck(arguments,2,`setCookie`),s(e),t=i.converters.Cookie(t);let n=r(t);n&&e.append(`set-cookie`,n,!0)}i.converters.DeleteCookieAttributes=i.dictionaryConverter([{converter:i.nullableConverter(i.converters.DOMString),key:`path`,defaultValue:()=>null},{converter:i.nullableConverter(i.converters.DOMString),key:`domain`,defaultValue:()=>null}]),i.converters.Cookie=i.dictionaryConverter([{converter:i.converters.DOMString,key:`name`},{converter:i.converters.DOMString,key:`value`},{converter:i.nullableConverter(e=>typeof e==`number`?i.converters[`unsigned long long`](e):new Date(e)),key:`expires`,defaultValue:()=>null},{converter:i.nullableConverter(i.converters[`long long`]),key:`maxAge`,defaultValue:()=>null},{converter:i.nullableConverter(i.converters.DOMString),key:`domain`,defaultValue:()=>null},{converter:i.nullableConverter(i.converters.DOMString),key:`path`,defaultValue:()=>null},{converter:i.nullableConverter(i.converters.boolean),key:`secure`,defaultValue:()=>null},{converter:i.nullableConverter(i.converters.boolean),key:`httpOnly`,defaultValue:()=>null},{converter:i.converters.USVString,key:`sameSite`,allowedValues:[`Strict`,`Lax`,`None`]},{converter:i.sequenceConverter(i.converters.DOMString),key:`unparsed`,defaultValue:()=>[]}]),t.exports={getCookies:c,deleteCookie:l,getSetCookies:u,setCookie:f,parseCookie:d}})),On=t(((e,t)=>{var{webidl:n}=st(),{kEnumerableProperty:r}=$(),{kConstruct:i}=Z(),a,o=class e extends Event{#e;constructor(e,t={}){if(e===i){super(arguments[1],arguments[2]),n.util.markAsUncloneable(this);return}let r=`MessageEvent constructor`;n.argumentLengthCheck(arguments,1,r),e=n.converters.DOMString(e,r,`type`),t=n.converters.MessageEventInit(t,r,`eventInitDict`),super(e,t),this.#e=t,n.util.markAsUncloneable(this)}get data(){return n.brandCheck(this,n.is.MessageEvent),this.#e.data}get origin(){return n.brandCheck(this,n.is.MessageEvent),this.#e.origin}get lastEventId(){return n.brandCheck(this,n.is.MessageEvent),this.#e.lastEventId}get source(){return n.brandCheck(this,n.is.MessageEvent),this.#e.source}get ports(){return n.brandCheck(this,n.is.MessageEvent),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(t,r=!1,i=!1,a=null,o=``,s=``,c=null,l=[]){return n.brandCheck(this,n.is.MessageEvent),n.argumentLengthCheck(arguments,1,`MessageEvent.initMessageEvent`),new e(t,{bubbles:r,cancelable:i,data:a,origin:o,lastEventId:s,source:c,ports:l})}static{a=(t,n)=>{let r=new e(i,t,n);return r.#e=n,r.#e.data??=null,r.#e.origin??=``,r.#e.lastEventId??=``,r.#e.source??=null,r.#e.ports??=[],r},n.is.MessageEvent=e=>typeof e==`object`&&!!e&&#e in e}},s=class extends Event{#e;constructor(e,t={}){let r=`CloseEvent constructor`;n.argumentLengthCheck(arguments,1,r),e=n.converters.DOMString(e,r,`type`),t=n.converters.CloseEventInit(t),super(e,t),this.#e=t,n.util.markAsUncloneable(this)}get wasClean(){return n.brandCheck(this,n.is.CloseEvent),this.#e.wasClean}get code(){return n.brandCheck(this,n.is.CloseEvent),this.#e.code}get reason(){return n.brandCheck(this,n.is.CloseEvent),this.#e.reason}static{n.is.CloseEvent=e=>typeof e==`object`&&!!e&&#e in e}},c=class extends Event{#e;constructor(e,t){let r=`ErrorEvent constructor`;n.argumentLengthCheck(arguments,1,r),super(e,t),n.util.markAsUncloneable(this),e=n.converters.DOMString(e,r,`type`),t=n.converters.ErrorEventInit(t??{}),this.#e=t}get message(){return n.brandCheck(this,n.is.ErrorEvent),this.#e.message}get filename(){return n.brandCheck(this,n.is.ErrorEvent),this.#e.filename}get lineno(){return n.brandCheck(this,n.is.ErrorEvent),this.#e.lineno}get colno(){return n.brandCheck(this,n.is.ErrorEvent),this.#e.colno}get error(){return n.brandCheck(this,n.is.ErrorEvent),this.#e.error}static{n.is.ErrorEvent=e=>typeof e==`object`&&!!e&&#e in e}};Object.defineProperties(o.prototype,{[Symbol.toStringTag]:{value:`MessageEvent`,configurable:!0},data:r,origin:r,lastEventId:r,source:r,ports:r,initMessageEvent:r}),Object.defineProperties(s.prototype,{[Symbol.toStringTag]:{value:`CloseEvent`,configurable:!0},reason:r,code:r,wasClean:r}),Object.defineProperties(c.prototype,{[Symbol.toStringTag]:{value:`ErrorEvent`,configurable:!0},message:r,filename:r,lineno:r,colno:r,error:r}),n.converters.MessagePort=n.interfaceConverter(n.is.MessagePort,`MessagePort`),n.converters[`sequence<MessagePort>`]=n.sequenceConverter(n.converters.MessagePort);var l=[{key:`bubbles`,converter:n.converters.boolean,defaultValue:()=>!1},{key:`cancelable`,converter:n.converters.boolean,defaultValue:()=>!1},{key:`composed`,converter:n.converters.boolean,defaultValue:()=>!1}];n.converters.MessageEventInit=n.dictionaryConverter([...l,{key:`data`,converter:n.converters.any,defaultValue:()=>null},{key:`origin`,converter:n.converters.USVString,defaultValue:()=>``},{key:`lastEventId`,converter:n.converters.DOMString,defaultValue:()=>``},{key:`source`,converter:n.nullableConverter(n.converters.MessagePort),defaultValue:()=>null},{key:`ports`,converter:n.converters[`sequence<MessagePort>`],defaultValue:()=>[]}]),n.converters.CloseEventInit=n.dictionaryConverter([...l,{key:`wasClean`,converter:n.converters.boolean,defaultValue:()=>!1},{key:`code`,converter:n.converters[`unsigned short`],defaultValue:()=>0},{key:`reason`,converter:n.converters.USVString,defaultValue:()=>``}]),n.converters.ErrorEventInit=n.dictionaryConverter([...l,{key:`message`,converter:n.converters.DOMString,defaultValue:()=>``},{key:`filename`,converter:n.converters.USVString,defaultValue:()=>``},{key:`lineno`,converter:n.converters[`unsigned long`],defaultValue:()=>0},{key:`colno`,converter:n.converters[`unsigned long`],defaultValue:()=>0},{key:`error`,converter:n.converters.any}]),t.exports={MessageEvent:o,CloseEvent:s,ErrorEvent:c,createFastMessageEvent:a}})),kn=t(((e,t)=>{t.exports={uid:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,sentCloseFrameState:{SENT:1,RECEIVED:2},staticPropertyDescriptors:{enumerable:!0,writable:!1,configurable:!1},states:{CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},opcodes:{CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},maxUnsigned16Bit:65535,parserStates:{INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},emptyBuffer:Buffer.allocUnsafe(0),sendHints:{text:1,typedArray:2,arrayBuffer:3,blob:4}}})),An=t(((t,n)=>{var{states:r,opcodes:i}=kn(),{isUtf8:a}=e(`node:buffer`),{removeHTTPWhitespace:o}=ot(),{collectASequenceOfCodePointsFast:s}=at();function c(e){return e===r.CONNECTING}function l(e){return e===r.OPEN}function u(e){return e===r.CLOSING}function d(e){return e===r.CLOSED}function f(e,t,n=(e,t)=>new Event(e,t),r={}){let i=n(e,r);t.dispatchEvent(i)}function p(e,t,n){e.onMessage(t,n)}function m(e){return e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function h(e){if(e.length===0)return!1;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}function g(e){return e>=1e3&&e<1015?e!==1004&&e!==1005&&e!==1006:e>=3e3&&e<=4999}function _(e){return e===i.CLOSE||e===i.PING||e===i.PONG}function v(e){return e===i.CONTINUATION}function y(e){return e===i.TEXT||e===i.BINARY}function b(e){return y(e)||v(e)||_(e)}function x(e){let t={position:0},n=new Map;for(;t.position<e.length;){let[r,i=``]=s(`;`,e,t).split(`=`,2);n.set(o(r,!0,!1),o(i,!1,!0)),t.position++}return n}function S(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}let t=Number.parseInt(e,10);return t>=8&&t<=15}function C(e,t){let n;try{n=new URL(e,t)}catch(e){throw new DOMException(e,`SyntaxError`)}if(n.protocol===`http:`?n.protocol=`ws:`:n.protocol===`https:`&&(n.protocol=`wss:`),n.protocol!==`ws:`&&n.protocol!==`wss:`)throw new DOMException(`expected a ws: or wss: url`,`SyntaxError`);if(n.hash.length||n.href.endsWith(`#`))throw new DOMException(`hash`,`SyntaxError`);return n}function w(e,t){if(e!==null&&e!==1e3&&(e<3e3||e>4999))throw new DOMException(`invalid code`,`InvalidAccessError`);if(t!==null){let e=Buffer.byteLength(t);if(e>123)throw new DOMException(`Reason must be less than 123 bytes; received ${e}`,`SyntaxError`)}}n.exports={isConnecting:c,isEstablished:l,isClosing:u,isClosed:d,fireEvent:f,isValidSubprotocol:h,isValidStatusCode:g,websocketMessageReceived:p,utf8Decode:(()=>{if(typeof process.versions.icu==`string`){let e=new TextDecoder(`utf-8`,{fatal:!0});return e.decode.bind(e)}return function(e){if(a(e))return e.toString(`utf-8`);throw TypeError(`Invalid utf-8 received.`)}})(),isControlFrame:_,isContinuationFrame:v,isTextBinaryFrame:y,isValidOpcode:b,parseExtensions:x,isValidClientWindowBits:S,toArrayBuffer:m,getURLRecord:C,validateCloseCodeAndReason:w}})),jn=t(((t,n)=>{var{runtimeFeatures:r}=lt(),{maxUnsigned16Bit:i,opcodes:a}=kn(),o=8192,s=null,c=o,l=r.has(`crypto`)?e(`node:crypto`).randomFillSync:null;function u(){return c===o&&(c=0,l(s??=Buffer.allocUnsafeSlow(o),0,o)),[s[c++],s[c++],s[c++],s[c++]]}n.exports={WebsocketFrameSend:class{constructor(e){this.frameData=e}createFrame(e){let t=this.frameData,n=u(),r=t?.byteLength??0,a=r,o=6;r>i?(o+=8,a=127):r>125&&(o+=2,a=126);let s=Buffer.allocUnsafe(r+o);s[0]=s[1]=0,s[0]|=128,s[0]=(s[0]&240)+e,s[o-4]=n[0],s[o-3]=n[1],s[o-2]=n[2],s[o-1]=n[3],s[1]=a,a===126?s.writeUInt16BE(r,2):a===127&&(s[2]=s[3]=0,s.writeUIntBE(r,4,6)),s[1]|=128;for(let e=0;e<r;++e)s[o+e]=t[e]^n[e&3];return s}static createFastTextFrame(e){let t=u(),n=e.length;for(let r=0;r<n;++r)e[r]^=t[r&3];let r=n,o=6;n>i?(o+=8,r=127):n>125&&(o+=2,r=126);let s=Buffer.allocUnsafeSlow(o);return s[0]=128|a.TEXT,s[1]=r|128,s[o-4]=t[0],s[o-3]=t[1],s[o-2]=t[2],s[o-1]=t[3],r===126?s.writeUInt16BE(n,2):r===127&&(s[2]=s[3]=0,s.writeUIntBE(n,4,6)),[s,e]}},generateMask:u}})),Mn=t(((t,n)=>{var{uid:r,states:i,sentCloseFrameState:a,emptyBuffer:o,opcodes:s}=kn(),{parseExtensions:c,isClosed:l,isClosing:u,isEstablished:d,isConnecting:f,validateCloseCodeAndReason:p}=An(),{makeRequest:m}=vn(),{fetching:h}=bn(),{Headers:g,getHeadersList:_}=gn(),{getDecodeSplit:v}=ct(),{WebsocketFrameSend:y}=jn(),b=e(`node:assert`),{runtimeFeatures:x}=lt(),S=x.has(`crypto`)?e(`node:crypto`):null,C=!1;function w(e,t,n,i,a){let o=e;o.protocol=e.protocol===`ws:`?`http:`:`https:`;let s=m({urlList:[o],client:n,serviceWorkers:`none`,referrer:`no-referrer`,mode:`websocket`,credentials:`include`,cache:`no-store`,redirect:`error`,useURLCredentials:!0});a.headers&&(s.headersList=_(new g(a.headers)));let l=S.randomBytes(16).toString(`base64`);s.headersList.append(`sec-websocket-key`,l,!0),s.headersList.append(`sec-websocket-version`,`13`,!0);for(let e of t)s.headersList.append(`sec-websocket-protocol`,e,!0);return s.headersList.append(`sec-websocket-extensions`,`permessage-deflate; client_max_window_bits`,!0),h({request:s,useParallelQueue:!0,dispatcher:a.dispatcher,processResponse(e){if(e.type===`error`||e.status!==101){if(e.socket?.session==null){E(i,e,1002,`Received network error or non-101 status code.`,e.error);return}if(e.status!==200){E(i,e,1002,`Received network error or non-200 status code.`,e.error);return}}if(C===!1&&e.socket?.session!=null&&(process.emitWarning(`WebSocket over HTTP2 is experimental, and subject to change.`,`ExperimentalWarning`),C=!0),t.length!==0&&!e.headersList.get(`Sec-WebSocket-Protocol`)){E(i,e,1002,`Server did not respond with sent protocols.`);return}if(e.socket.session==null&&e.headersList.get(`Upgrade`)?.toLowerCase()!==`websocket`){E(i,e,1002,`Server did not set Upgrade header to "websocket".`);return}if(e.socket.session==null&&e.headersList.get(`Connection`)?.toLowerCase()!==`upgrade`){E(i,e,1002,`Server did not set Connection header to "upgrade".`);return}if(e.socket.session==null&&e.headersList.get(`Sec-WebSocket-Accept`)!==S.hash(`sha1`,l+r,`base64`)){E(i,e,1002,`Incorrect hash received in Sec-WebSocket-Accept header.`);return}let n=e.headersList.get(`Sec-WebSocket-Extensions`),a;if(n!==null&&(a=c(n),!a.has(`permessage-deflate`))){E(i,e,1002,`Sec-WebSocket-Extensions header does not match.`);return}let o=e.headersList.get(`Sec-WebSocket-Protocol`);if(o!==null){let t=v(`sec-websocket-protocol`,s.headersList);if(t===null||!t.includes(o)){E(i,e,1002,`Protocol was not set in the opening handshake.`);return}}e.socket.session!=null&&(e.socket.allowHalfOpen=!1),e.socket.on(`data`,i.onSocketData),e.socket.on(`close`,i.onSocketClose),e.socket.on(`error`,i.onSocketError),i.wasEverConnected=!0,i.onConnectionEstablished(e,a)}})}function T(e,t,n,r=!1){if(t??=null,n??=``,r&&p(t,n),!(l(e.readyState)||u(e.readyState))){if(!d(e.readyState))D(e),e.readyState=i.CLOSING;else if(!e.closeState.has(a.SENT)&&!e.closeState.has(a.RECEIVED)){let r=new y;n.length!==0&&t===null&&(t=1e3),b(t===null||Number.isInteger(t)),t===null&&n.length===0?r.frameData=o:t!==null&&n===null?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(t,0)):t!==null&&n!==null?(r.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(n)),r.frameData.writeUInt16BE(t,0),r.frameData.write(n,2,`utf-8`)):r.frameData=o,e.socket.write(r.createFrame(s.CLOSE)),e.closeState.add(a.SENT),e.readyState=i.CLOSING}else e.readyState=i.CLOSING}}function E(e,t,n,r,i){t.socket?.session!=null&&!t.socket.destroyed&&t.socket.destroy(),D(e,n,r,i)}function D(e,t,n,r){d(e.readyState)&&T(e,t,n,!1),e.controller.abort(),f(e.readyState)?e.onSocketClose():e.socket?.destroyed===!1&&e.socket.destroy()}n.exports={establishWebSocketConnection:w,failWebsocketConnection:D,closeWebSocketConnection:T}})),Nn=t(((t,n)=>{var{createInflateRaw:r,Z_DEFAULT_WINDOWBITS:i}=e(`node:zlib`),{isValidClientWindowBits:a}=An(),{MessageSizeExceededError:o}=Q(),s=Buffer.from([0,0,255,255]),c=Symbol(`kBuffer`),l=Symbol(`kLength`);n.exports={PerMessageDeflate:class{#e;#t={};#n=0;constructor(e,t){this.#t.serverNoContextTakeover=e.has(`server_no_context_takeover`),this.#t.serverMaxWindowBits=e.get(`server_max_window_bits`),this.#n=t.maxPayloadSize}decompress(e,t,n){if(!this.#e){let e=i;if(this.#t.serverMaxWindowBits){if(!a(this.#t.serverMaxWindowBits)){n(Error(`Invalid server_max_window_bits`));return}e=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=r({windowBits:e})}catch(e){n(e);return}this.#e[c]=[],this.#e[l]=0,this.#e.on(`data`,e=>{if(this.#e[l]+=e.length,this.#n>0&&this.#e[l]>this.#n){n(new o),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[c].push(e)}),this.#e.on(`error`,e=>{this.#e=null,n(e)})}this.#e.write(e),t&&this.#e.write(s),this.#e.flush(()=>{if(!this.#e)return;let e=Buffer.concat(this.#e[c],this.#e[l]);this.#e[c].length=0,this.#e[l]=0,n(null,e)})}}}})),Pn=t(((t,n)=>{var{Writable:r}=e(`node:stream`),i=e(`node:assert`),{parserStates:a,opcodes:o,states:s,emptyBuffer:c,sentCloseFrameState:l}=kn(),{isValidStatusCode:u,isValidOpcode:d,websocketMessageReceived:f,utf8Decode:p,isControlFrame:m,isTextBinaryFrame:h,isContinuationFrame:g}=An(),{failWebsocketConnection:_}=Mn(),{WebsocketFrameSend:v}=jn(),{PerMessageDeflate:y}=Nn(),{MessageSizeExceededError:b}=Q();n.exports={ByteParser:class extends r{#e=[];#t=0;#n=0;#r=!1;#i=a.INFO;#a={};#o=[];#s;#c;#l;#u;constructor(e,t,n={}){super(),this.#c=e,this.#s=t??new Map,this.#l=n.maxFragments??0,this.#u=n.maxPayloadSize??0,this.#s.has(`permessage-deflate`)&&this.#s.set(`permessage-deflate`,new y(t,n))}_write(e,t,n){this.#e.push(e),this.#n+=e.length,this.#r=!0,this.run(n)}#d(){return this.#u>0&&!m(this.#a.opcode)&&this.#a.payloadLength+this.#t>this.#u?(_(this.#c,1009,`Payload size exceeds maximum allowed size`),!1):!0}run(e){for(;this.#r;)if(this.#i===a.INFO){if(this.#n<2)return e();let t=this.consume(2),n=!!(t[0]&128),r=t[0]&15,i=(t[1]&128)==128,s=!n&&r!==o.CONTINUATION,c=t[1]&127,l=t[0]&64,u=t[0]&32,f=t[0]&16;if(!d(r))return _(this.#c,1002,`Invalid opcode received`),e();if(i)return _(this.#c,1002,`Frame cannot be masked`),e();if(l!==0&&!this.#s.has(`permessage-deflate`)){_(this.#c,1002,`Expected RSV1 to be clear.`);return}if(u!==0||f!==0){_(this.#c,1002,`RSV1, RSV2, RSV3 must be clear`);return}if(s&&!h(r)){_(this.#c,1002,`Invalid frame type was fragmented.`);return}if(h(r)&&this.#o.length>0){_(this.#c,1002,`Expected continuation frame`);return}if(this.#a.fragmented&&s){_(this.#c,1002,`Fragmented frame exceeded 125 bytes.`);return}if((c>125||s)&&m(r)){_(this.#c,1002,`Control frame either too large or fragmented`);return}if(g(r)&&this.#o.length===0&&!this.#a.compressed){_(this.#c,1002,`Unexpected continuation frame`);return}if(c<=125){if(this.#a.payloadLength=c,this.#i=a.READ_DATA,!this.#d())return}else c===126?this.#i=a.PAYLOADLENGTH_16:c===127&&(this.#i=a.PAYLOADLENGTH_64);h(r)&&(this.#a.binaryType=r,this.#a.compressed=l!==0),this.#a.opcode=r,this.#a.masked=i,this.#a.fin=n,this.#a.fragmented=s}else if(this.#i===a.PAYLOADLENGTH_16){if(this.#n<2)return e();let t=this.consume(2);if(this.#a.payloadLength=t.readUInt16BE(0),this.#i=a.READ_DATA,!this.#d())return}else if(this.#i===a.PAYLOADLENGTH_64){if(this.#n<8)return e();let t=this.consume(8),n=t.readUInt32BE(0),r=t.readUInt32BE(4);if(n!==0||r>2**31-1){_(this.#c,1009,`Received payload length > 2^31 bytes.`);return}if(this.#a.payloadLength=r,this.#i=a.READ_DATA,!this.#d())return}else if(this.#i===a.READ_DATA){if(this.#n<this.#a.payloadLength)return e();let t=this.consume(this.#a.payloadLength);if(m(this.#a.opcode))this.#r=this.parseControlFrame(t),this.#i=a.INFO;else if(this.#a.compressed){this.#s.get(`permessage-deflate`).decompress(t,this.#a.fin,(t,n)=>{if(t){let e=t instanceof b?1009:1007;_(this.#c,e,t.message);return}if(this.writeFragments(n)){if(this.#u>0&&this.#t>this.#u){_(this.#c,1009,new b().message);return}if(!this.#a.fin){this.#i=a.INFO,this.#r=!0,this.run(e);return}f(this.#c,this.#a.binaryType,this.consumeFragments()),this.#r=!0,this.#i=a.INFO,this.run(e)}},this.#t),this.#r=!1;break}else{if(!this.writeFragments(t))return;!this.#a.fragmented&&this.#a.fin&&f(this.#c,this.#a.binaryType,this.consumeFragments()),this.#i=a.INFO}}}consume(e){if(e>this.#n)throw Error(`Called consume() before buffers satiated.`);if(e===0)return c;this.#n-=e;let t=this.#e[0];if(t.length>e)return this.#e[0]=t.subarray(e,t.length),t.subarray(0,e);if(t.length===e)return this.#e.shift();{let t=0,n=Buffer.allocUnsafeSlow(e);for(;t!==e;){let r=this.#e[0],i=r.length;if(i+t===e){n.set(this.#e.shift(),t);break}if(i+t>e){n.set(r.subarray(0,e-t),t),this.#e[0]=r.subarray(e-t);break}n.set(this.#e.shift(),t),t+=i}return n}}writeFragments(e){return this.#l>0&&this.#o.length===this.#l?(_(this.#c,1008,`Too many message fragments`),!1):(this.#t+=e.length,this.#o.push(e),!0)}consumeFragments(){let e=this.#o;if(this.#a.compressed=!1,e.length===1)return this.#t=0,e.shift();let t=0,n=Buffer.allocUnsafeSlow(this.#t);for(let r=0;r<e.length;++r){let i=e[r];n.set(i,t),t+=i.length}return this.#o=[],this.#t=0,n}parseCloseBody(e){i(e.length!==1);let t;if(e.length>=2&&(t=e.readUInt16BE(0)),t!==void 0&&!u(t))return{code:1002,reason:`Invalid status code`,error:!0};let n=e.subarray(2);n[0]===239&&n[1]===187&&n[2]===191&&(n=n.subarray(3));try{n=p(n)}catch{return{code:1007,reason:`Invalid UTF-8`,error:!0}}return{code:t,reason:n,error:!1}}parseControlFrame(e){let{opcode:t,payloadLength:n}=this.#a;if(t===o.CLOSE){if(n===1)return _(this.#c,1002,`Received close frame with a 1-byte body.`),!1;if(this.#a.closeInfo=this.parseCloseBody(e),this.#a.closeInfo.error){let{code:e,reason:t}=this.#a.closeInfo;return _(this.#c,e,t),!1}if(!this.#c.closeState.has(l.SENT)&&!this.#c.closeState.has(l.RECEIVED)){let e=c;this.#a.closeInfo.code&&(e=Buffer.allocUnsafe(2),e.writeUInt16BE(this.#a.closeInfo.code,0));let t=new v(e);this.#c.socket.write(t.createFrame(o.CLOSE)),this.#c.closeState.add(l.SENT)}return this.#c.readyState=s.CLOSING,this.#c.closeState.add(l.RECEIVED),!1}if(t===o.PING){if(!this.#c.closeState.has(l.RECEIVED)){let t=new v(e);this.#c.socket.write(t.createFrame(o.PONG)),this.#c.onPing(e)}}else t===o.PONG&&this.#c.onPong(e);return!0}get closingInfo(){return this.#a.closeInfo}}}})),Fn=t(((e,t)=>{var{WebsocketFrameSend:n}=jn(),{opcodes:r,sendHints:i}=kn(),a=gt(),o=class{#e=new a;#t=!1;#n;constructor(e){this.#n=e}add(e,t,r){if(r!==i.blob){if(this.#t){let n={promise:null,callback:t,frame:s(e,r)};this.#e.push(n)}else if(r===i.text){let{0:r,1:i}=n.createFastTextFrame(e);this.#n.cork(),this.#n.write(r),this.#n.write(i,t),this.#n.uncork()}else this.#n.write(s(e,r),t);return}let a={promise:e.arrayBuffer().then(e=>{a.promise=null,a.frame=s(e,r)}),callback:t,frame:null};this.#e.push(a),this.#t||this.#r()}async#r(){this.#t=!0;let e=this.#e;for(;!e.isEmpty();){let t=e.shift();t.promise!==null&&await t.promise,this.#n.write(t.frame,t.callback),t.callback=t.frame=null}this.#t=!1}};function s(e,t){return new n(c(e,t)).createFrame(t===i.text?r.TEXT:r.BINARY)}function c(e,t){switch(t){case i.text:case i.typedArray:return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case i.arrayBuffer:case i.blob:return new Uint8Array(e)}}t.exports={SendQueue:o}})),In=t(((t,n)=>{var{isArrayBuffer:r}=e(`node:util/types`),{webidl:i}=st(),{URLSerializer:a}=ot(),{environmentSettingsObject:o}=ct(),{staticPropertyDescriptors:s,states:c,sentCloseFrameState:l,sendHints:u,opcodes:d}=kn(),{isConnecting:f,isEstablished:p,isClosing:m,isClosed:h,isValidSubprotocol:g,fireEvent:_,utf8Decode:v,toArrayBuffer:y,getURLRecord:b}=An(),{establishWebSocketConnection:x,closeWebSocketConnection:S,failWebsocketConnection:C}=Mn(),{ByteParser:w}=Pn(),{kEnumerableProperty:T}=$(),{getGlobalDispatcher:E}=Zt(),{ErrorEvent:D,CloseEvent:O,createFastMessageEvent:k}=On(),{SendQueue:A}=Fn(),{WebsocketFrameSend:j}=jn(),{channels:M}=qe(),N=Symbol.for(`nodejs.ref`),P=Symbol.for(`nodejs.unref`),F;function I(e){return typeof e?.address==`function`?e.address():typeof e?.session?.socket?.address==`function`?e.session.socket.address():null}var L=class e extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#n=``;#r=``;#i=!0;#a;#o={onConnectionEstablished:(e,t)=>this.#u(e,t),onMessage:(e,t)=>this.#d(e,t),onParserError:e=>C(this.#o,null,e.message),onParserDrain:()=>this.#f(),onSocketData:e=>{this.#l.write(e)||this.#o.socket.pause()},onSocketError:e=>{this.#o.readyState=c.CLOSING,M.socketError.hasSubscribers&&M.socketError.publish(e),this.#o.socket.destroy()},onSocketClose:()=>this.#p(),onPing:e=>{M.ping.hasSubscribers&&M.ping.publish({payload:e,websocket:this})},onPong:e=>{M.pong.hasSubscribers&&M.pong.publish({payload:e,websocket:this})},readyState:c.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#s;#c;#l;constructor(t,n=[]){super(),i.util.markAsUncloneable(this);let r=`WebSocket constructor`;i.argumentLengthCheck(arguments,1,r);let a=i.converters[`DOMString or sequence<DOMString> or WebSocketInit`](n,r,`options`);t=i.converters.USVString(t),n=a.protocols;let s=o.settingsObject.baseUrl,c=b(t,s);if(typeof n==`string`&&(n=[n]),n.length!==new Set(n.map(e=>e.toLowerCase())).size||n.length>0&&!n.every(e=>g(e)))throw new DOMException(`Invalid Sec-WebSocket-Protocol value`,`SyntaxError`);this.#s=new URL(c.href);let l=o.settingsObject;this.#o.controller=x(c,n,l,this.#o,a),this.#o.readyState=e.CONNECTING,this.#c=`blob`}[N](){this.#i=!0,this.#o.socket?.ref?.()}[P](){this.#i=!1,this.#o.socket?.unref?.()}close(e=void 0,t=void 0){i.brandCheck(this,i.is.WebSocket),e!==void 0&&(e=i.converters[`unsigned short`](e,`WebSocket.close`,`code`,i.attributes.Clamp)),t!==void 0&&(t=i.converters.USVString(t)),e??=null,t??=``,S(this.#o,e,t,!0)}send(e){i.brandCheck(this,i.is.WebSocket);let t=`WebSocket.send`;if(i.argumentLengthCheck(arguments,1,t),e=i.converters.WebSocketSendData(e,t,`data`),f(this.#o.readyState))throw new DOMException(`Sent before connected.`,`InvalidStateError`);if(p(this.#o.readyState)&&!m(this.#o.readyState)){if(typeof e==`string`){let t=Buffer.from(e);this.#t+=t.byteLength,this.#a.add(t,()=>{this.#t-=t.byteLength},u.text)}else r(e)?(this.#t+=e.byteLength,this.#a.add(e,()=>{this.#t-=e.byteLength},u.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#a.add(e,()=>{this.#t-=e.byteLength},u.typedArray)):i.is.Blob(e)&&(this.#t+=e.size,this.#a.add(e,()=>{this.#t-=e.size},u.blob))}}get readyState(){return i.brandCheck(this,i.is.WebSocket),this.#o.readyState}get bufferedAmount(){return i.brandCheck(this,i.is.WebSocket),this.#t}get url(){return i.brandCheck(this,i.is.WebSocket),a(this.#s)}get extensions(){return i.brandCheck(this,i.is.WebSocket),this.#r}get protocol(){return i.brandCheck(this,i.is.WebSocket),this.#n}get onopen(){return i.brandCheck(this,i.is.WebSocket),this.#e.open}set onopen(e){i.brandCheck(this,i.is.WebSocket),this.#e.open&&this.removeEventListener(`open`,this.#e.open);let t=i.converters.EventHandlerNonNull(e);t===null?this.#e.open=null:(this.addEventListener(`open`,t),this.#e.open=e)}get onerror(){return i.brandCheck(this,i.is.WebSocket),this.#e.error}set onerror(e){i.brandCheck(this,i.is.WebSocket),this.#e.error&&this.removeEventListener(`error`,this.#e.error);let t=i.converters.EventHandlerNonNull(e);t===null?this.#e.error=null:(this.addEventListener(`error`,t),this.#e.error=e)}get onclose(){return i.brandCheck(this,i.is.WebSocket),this.#e.close}set onclose(e){i.brandCheck(this,i.is.WebSocket),this.#e.close&&this.removeEventListener(`close`,this.#e.close);let t=i.converters.EventHandlerNonNull(e);t===null?this.#e.close=null:(this.addEventListener(`close`,t),this.#e.close=e)}get onmessage(){return i.brandCheck(this,i.is.WebSocket),this.#e.message}set onmessage(e){i.brandCheck(this,i.is.WebSocket),this.#e.message&&this.removeEventListener(`message`,this.#e.message);let t=i.converters.EventHandlerNonNull(e);t===null?this.#e.message=null:(this.addEventListener(`message`,t),this.#e.message=e)}get binaryType(){return i.brandCheck(this,i.is.WebSocket),this.#c}set binaryType(e){i.brandCheck(this,i.is.WebSocket),this.#c=e!==`blob`&&e!==`arraybuffer`?`blob`:e}#u(e,t){this.#o.socket=e.socket,this.#i||this.#o.socket.unref?.();let n=this.#o.controller.dispatcher?.webSocketOptions?.maxFragments,r=this.#o.controller.dispatcher?.webSocketOptions?.maxPayloadSize,i=new w(this.#o,t,{maxFragments:n,maxPayloadSize:r});i.on(`drain`,()=>this.#o.onParserDrain()),i.on(`error`,e=>this.#o.onParserError(e)),this.#l=i,this.#a=new A(e.socket),this.#o.readyState=c.OPEN;let a=e.headersList.get(`sec-websocket-extensions`);a!==null&&(this.#r=a);let o=e.headersList.get(`sec-websocket-protocol`);if(o!==null&&(this.#n=o),_(`open`,this),M.open.hasSubscribers){let t=e.headersList.entries;M.open.publish({address:I(e.socket),protocol:this.#n,extensions:this.#r,websocket:this,handshakeResponse:{status:e.status,statusText:e.statusText,headers:t}})}}#d(e,t){if(this.#o.readyState!==c.OPEN)return;let n;if(e===d.TEXT)try{n=v(t)}catch{C(this.#o,1007,`Received invalid UTF-8 in text frame.`);return}else e===d.BINARY&&(n=this.#c===`blob`?new Blob([t]):y(t));_(`message`,this,k,{origin:this.#s.origin,data:n})}#f(){this.#o.socket.resume()}#p(){let e=this.#o.closeState.has(l.SENT)&&this.#o.closeState.has(l.RECEIVED),t=1005,n=``,r=this.#l?.closingInfo;r&&!r.error&&(t=r.code??1005,n=r.reason),this.#o.readyState=c.CLOSED,this.#o.closeState.has(l.RECEIVED)||(t=1006,_(`error`,this,(e,t)=>new D(e,t),{error:TypeError(n)})),_(`close`,this,(e,t)=>new O(e,t),{wasClean:e,code:t,reason:n}),M.close.hasSubscribers&&M.close.publish({websocket:this,code:t,reason:n})}static{F=(e,t)=>{if(Buffer.isBuffer(t)){if(t.length>125)throw TypeError(`A PING frame cannot have a body larger than 125 bytes.`)}else if(t!==void 0)throw TypeError(`Expected buffer payload`);let n=e.#o.readyState;if(p(n)&&!m(n)&&!h(n)){let n=new j(t);e.#o.socket.write(n.createFrame(d.PING))}},i.is.WebSocket=e=>typeof e==`object`&&!!e&&#o in e}};L.CONNECTING=L.prototype.CONNECTING=c.CONNECTING,L.OPEN=L.prototype.OPEN=c.OPEN,L.CLOSING=L.prototype.CLOSING=c.CLOSING,L.CLOSED=L.prototype.CLOSED=c.CLOSED,Object.defineProperties(L.prototype,{CONNECTING:s,OPEN:s,CLOSING:s,CLOSED:s,url:T,readyState:T,bufferedAmount:T,onopen:T,onerror:T,onclose:T,close:T,onmessage:T,binaryType:T,send:T,extensions:T,protocol:T,[Symbol.toStringTag]:{value:`WebSocket`,writable:!1,enumerable:!1,configurable:!0}}),Object.defineProperties(L,{CONNECTING:s,OPEN:s,CLOSING:s,CLOSED:s}),i.converters[`sequence<DOMString>`]=i.sequenceConverter(i.converters.DOMString),i.converters[`DOMString or sequence<DOMString>`]=function(e,t,n){return i.util.Type(e)===i.util.Types.OBJECT&&Symbol.iterator in e?i.converters[`sequence<DOMString>`](e):i.converters.DOMString(e,t,n)},i.converters.WebSocketInit=i.dictionaryConverter([{key:`protocols`,converter:i.converters[`DOMString or sequence<DOMString>`],defaultValue:()=>[]},{key:`dispatcher`,converter:i.converters.any,defaultValue:()=>E()},{key:`headers`,converter:i.nullableConverter(i.converters.HeadersInit)}]),i.converters[`DOMString or sequence<DOMString> or WebSocketInit`]=function(e){return i.util.Type(e)===i.util.Types.OBJECT&&!(Symbol.iterator in e)?i.converters.WebSocketInit(e):{protocols:i.converters[`DOMString or sequence<DOMString>`](e)}},i.converters.WebSocketSendData=function(e){return i.util.Type(e)===i.util.Types.OBJECT&&(i.is.Blob(e)||i.is.BufferSource(e))?e:i.converters.USVString(e)},n.exports={WebSocket:L,ping:F}})),Ln=t(((e,t)=>{var{webidl:n}=st(),{validateCloseCodeAndReason:r}=An(),{kConstruct:i}=Z(),{kEnumerableProperty:a}=$();function o(){class e extends DOMException{get reason(){return``}}return new e().reason===void 0?new Proxy(DOMException,{construct(e,t,n){let r=Reflect.construct(e,t,e);return Object.setPrototypeOf(r,n.prototype),r}}):DOMException}var s,c=class e extends o(){#e;#t;constructor(e=``,t=void 0){if(e=n.converters.DOMString(e,`WebSocketError`,`message`),super(e,`WebSocketError`),t===i)return;t!==null&&(t=n.converters.WebSocketCloseInfo(t));let a=t.closeCode??null,o=t.reason??``;r(a,o),o.length!==0&&a===null&&(a=1e3),this.#e=a,this.#t=o}get closeCode(){return this.#e}get reason(){return this.#t}static{s=(t,n,r)=>{let a=new e(t,i);return a.#e=n,a.#t=r,a},n.is.WebSocketError=e=>typeof e==`object`&&!!e&&#t in e}};Object.defineProperties(c.prototype,{closeCode:a,reason:a,[Symbol.toStringTag]:{value:`WebSocketError`,writable:!1,enumerable:!1,configurable:!0}}),t.exports={WebSocketError:c,createUnvalidatedWebSocketError:s}})),Rn=t(((t,n)=>{var{addAbortListener:r}=e(`node:events`),{environmentSettingsObject:i,readableStreamClose:a}=ct(),{states:o,opcodes:s,sentCloseFrameState:c}=kn(),{webidl:l}=st(),{getURLRecord:u,isValidSubprotocol:d,isEstablished:f,utf8Decode:p}=An(),{establishWebSocketConnection:m,failWebsocketConnection:h,closeWebSocketConnection:g}=Mn(),{channels:_}=qe(),{WebsocketFrameSend:v}=jn(),{ByteParser:y}=Pn(),{WebSocketError:b,createUnvalidatedWebSocketError:x}=Ln(),{kEnumerableProperty:S}=$(),{utf8DecodeBytes:C}=it(),w=!1,T=class{#e;#t;#n;#r;#i;#a;#o=!1;#s={onConnectionEstablished:(e,t)=>this.#u(e,t),onMessage:(e,t)=>this.#d(e,t),onParserError:e=>h(this.#s,null,e.message),onParserDrain:()=>this.#s.socket.resume(),onSocketData:e=>{this.#c.write(e)||this.#s.socket.pause()},onSocketError:e=>{this.#s.readyState=o.CLOSING,_.socketError.hasSubscribers&&_.socketError.publish(e),this.#s.socket.destroy()},onSocketClose:()=>queueMicrotask(()=>this.#f()),onPing:()=>{},onPong:()=>{},readyState:o.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#c;constructor(e,t=void 0){w||=(process.emitWarning(`WebSocketStream is experimental! Expect it to change at any time.`,{code:`UNDICI-WSS`}),!0),l.argumentLengthCheck(arguments,1,`WebSocket`),e=l.converters.USVString(e),t!==null&&(t=l.converters.WebSocketStreamOptions(t));let n=i.settingsObject.baseUrl,a=u(e,n),s=t.protocols;if(s.length!==new Set(s.map(e=>e.toLowerCase())).size||s.length>0&&!s.every(e=>d(e)))throw new DOMException(`Invalid Sec-WebSocket-Protocol value`,`SyntaxError`);if(this.#e=a.toString(),this.#t=Promise.withResolvers(),this.#n=Promise.withResolvers(),t.signal!=null){let e=t.signal;if(e.aborted){this.#t.reject(e.reason),this.#n.reject(e.reason);return}r(e,()=>{f(this.#s.readyState)||(h(this.#s),this.#s.readyState=o.CLOSING,this.#t.reject(e.reason),this.#n.reject(e.reason),this.#o=!0)})}let c=i.settingsObject;this.#s.controller=m(a,s,c,this.#s,t)}get url(){return this.#e.toString()}get opened(){return this.#t.promise}get closed(){return this.#n.promise}close(e=void 0){e!==null&&(e=l.converters.WebSocketCloseInfo(e));let t=e.closeCode??null,n=e.reason;g(this.#s,t,n,!0)}#l(e){e=l.converters.WebSocketStreamWrite(e);let t=Promise.withResolvers(),n=null,r=null;if(l.is.BufferSource(e))n=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e.slice()),r=s.BINARY;else{let i;try{i=l.converters.DOMString(e)}catch(e){return t.reject(e),t.promise}n=new TextEncoder().encode(i),r=s.TEXT}if(!this.#s.closeState.has(c.SENT)&&!this.#s.closeState.has(c.RECEIVED)){let e=new v(n);this.#s.socket.write(e.createFrame(r),()=>{t.resolve(void 0)})}else t.resolve(void 0);return t.promise}#u(e,t){this.#s.socket=e.socket;let n=this.#s.controller.dispatcher?.webSocketOptions?.maxFragments,r=this.#s.controller.dispatcher?.webSocketOptions?.maxPayloadSize,i=new y(this.#s,t,{maxFragments:n,maxPayloadSize:r});i.on(`drain`,()=>this.#s.onParserDrain()),i.on(`error`,e=>this.#s.onParserError(e)),this.#c=i,this.#s.readyState=o.OPEN;let a=e.headersList.get(`sec-websocket-extensions`)??``,s=e.headersList.get(`sec-websocket-protocol`)??``,c=new ReadableStream({start:e=>{this.#i=e},pull:()=>this.#m(),cancel:e=>this.#h(e)}),l=new WritableStream({start:e=>{this.#a=e},write:e=>this.#l(e),close:()=>g(this.#s,null,null),abort:e=>this.#p(e)});this.#r=c,this.#t.resolve({extensions:a,protocol:s,readable:c,writable:l})}#d(e,t){if(this.#s.readyState!==o.OPEN)return;let n;if(e===s.TEXT)try{n=p(t)}catch{h(this.#s,1007,`Received invalid UTF-8 in text frame.`);return}else e===s.BINARY&&(n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength));this.#i.enqueue(n),this.#i.desiredSize<=0&&this.#s.socket.pause()}#f(){let e=this.#s.closeState.has(c.SENT)&&this.#s.closeState.has(c.RECEIVED);if(this.#s.readyState=o.CLOSED,this.#o)return;this.#s.wasEverConnected||this.#t.reject(new b(`Socket never opened`));let t=this.#c?.closingInfo,n=t?.code??1005;this.#s.closeState.has(c.RECEIVED)||(n=1006);let r=t?.reason==null?``:C(Buffer.from(t.reason));if(e)a(this.#i),this.#a.error(new DOMException(`A closed WebSocketStream cannot be written to`,`InvalidStateError`)),this.#n.resolve({closeCode:n,reason:r});else{let e=x(`unclean close`,n,r);this.#i?.error(e),this.#a?.error(e),this.#n.reject(e)}}#p(e){let t=null,n=``;l.is.WebSocketError(e)&&(t=e.closeCode,n=e.reason),g(this.#s,t,n)}#m(){this.#s.socket.resume()}#h(e){this.#p(e)}};Object.defineProperties(T.prototype,{url:S,opened:S,closed:S,close:S,[Symbol.toStringTag]:{value:`WebSocketStream`,writable:!1,enumerable:!1,configurable:!0}}),l.converters.WebSocketStreamOptions=l.dictionaryConverter([{key:`protocols`,converter:l.sequenceConverter(l.converters.USVString),defaultValue:()=>[]},{key:`signal`,converter:l.nullableConverter(l.converters.AbortSignal),defaultValue:()=>null}]),l.converters.WebSocketCloseInfo=l.dictionaryConverter([{key:`closeCode`,converter:e=>l.converters[`unsigned short`](e,l.attributes.EnforceRange)},{key:`reason`,converter:l.converters.USVString,defaultValue:()=>``}]),l.converters.WebSocketStreamWrite=function(e){return typeof e==`string`?l.converters.USVString(e):l.converters.BufferSource(e)},n.exports={WebSocketStream:T}})),zn=t(((e,t)=>{var{makeRequest:n}=vn();function r(e){return e.indexOf(`\0`)===-1}function i(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)<48||e.charCodeAt(t)>57)return!1;return!0}function a(e,t,r,i){let a=r===`no cors`?`no-cors`:`cors`;i&&a===`no-cors`&&(a=`same-origin`);let o=`include`;return r===`anonymous`&&(o=`same-origin`),n({urlList:[e],destination:t,mode:a,credentials:o,useURLCredentials:!0})}t.exports={isValidLastEventId:r,isASCIINumber:i,createPotentialCORSRequest:a}})),Bn=t(((t,n)=>{var r=e(`node:buffer`),{Transform:i}=e(`node:stream`),{isASCIINumber:a,isValidLastEventId:o}=zn(),s=[239,187,191],c=10,l=13,u=58,d=32,f=r.kStringMaxLength,p=Buffer.from(`data`),m=Buffer.from(`event`),h=Buffer.from(`id`),g=Buffer.from(`retry`);function _(e,t){if(t>=e.length)return!1;for(let n=t;n<e.length;n++)if(e[n]<48||e[n]>57)return!1;return!0}function v(e,t){for(let n=t;n<e.length;n++)if(e[n]===0)return!1;return!0}function y(e,t,n){if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}function b(){let e=Error(`EventSource message size exceeded`);return e.aborted=!1,e}n.exports={EventSourceStream:class extends i{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;eventDataSize=0;maxEventSize;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},this.maxEventSize=e.maxEventSize??f,e.push&&(this.push=e.push)}_transform(e,t,n){if(e.length===0){n();return}if(this.chunks.push(e),this.checkBOM&&this.handleBOM()){n();return}for(;this.hasCurrentByte();){let e=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(e===c){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(e===c||e===l){e===l&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(e===c||e===l){e===l&&(this.crlfCheck=!0);try{this.parseLine(this.readLine(),this.event)}catch(e){n(e);return}this.consumeCurrentByte(),this.eventEndCheck=!0;continue}this.advanceCursor()}n()}parseLine(e,t){if(e.length===0)return;let n=e.indexOf(u);if(n===0)return;let r=e.length,i=e.length;if(n!==-1&&(r=n,i=n+1,e[i]===d&&++i),y(e,r,p)){let n=e.length-i,r=this.eventDataSize+(t.data===void 0?0:1)+n;if(this.maxEventSize>0&&r>this.maxEventSize)throw b();let a=e.toString(`utf8`,i);t.data===void 0?t.data=a:t.data+=`\n${a}`,this.eventDataSize=r;return}if(y(e,r,g)){_(e,i)&&(t.retry=e.toString(`utf8`,i));return}if(y(e,r,h)){v(e,i)&&(t.id=e.toString(`utf8`,i));return}if(y(e,r,m)){let n=e.toString(`utf8`,i);n.length>0&&(t.event=n)}}processEvent(e){e.retry&&a(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&o(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||`message`,options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event.data=void 0,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0,this.eventDataSize=0}hasPendingEvent(){return this.event.data!==void 0||this.event.event!==void 0||this.event.id!==void 0||this.event.retry!==void 0}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.dropConsumedChunks()}dropConsumedChunks(){for(;this.lineChunkIndex>0;)this.chunks.shift(),this.lineChunkIndex--,this.chunkIndex--;this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let e=[],t=0;for(let n=this.lineChunkIndex;n<=this.chunkIndex;n++){let r=this.chunks[n],i=n===this.lineChunkIndex?this.linePos:0,a=n===this.chunkIndex?this.pos:r.length,o=r.subarray(i,a);t+=o.length,e.push(o)}return Buffer.concat(e,t)}peekBufferedByte(e){let t=this.lineChunkIndex,n=this.linePos;for(;t<this.chunks.length;){let r=this.chunks[t],i=r.length-n;if(e<i)return r[n+e];e-=i,t++,n=0}}discardLeadingBytes(e){for(;e>0&&this.lineChunkIndex<this.chunks.length;){let t=this.chunks[this.lineChunkIndex].length-this.linePos;e<t?(this.linePos+=e,e=0):(e-=t,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let e=this.peekBufferedByte(0),t=this.peekBufferedByte(1),n=this.peekBufferedByte(2);return t===void 0?(e===s[0]||(this.checkBOM=!1),!0):n===void 0?e===s[0]&&t===s[1]||(this.checkBOM=!1,!1):(e===s[0]&&t===s[1]&&n===s[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}}}})),Vn=t(((t,n)=>{var{pipeline:r}=e(`node:stream`),{fetching:i}=bn(),{webidl:a}=st(),{EventSourceStream:o}=Bn(),{parseMIMEType:s}=ot(),{createFastMessageEvent:c}=On(),{isNetworkError:l}=_n(),{isValidHeaderValue:u,kEnumerableProperty:d}=$(),{environmentSettingsObject:f}=ct(),{createPotentialCORSRequest:p}=zn(),{getGlobalDispatcher:m}=Zt(),{isomorphicDecode:h}=at(),g=new TextEncoder,_=!1,v=3e3,y=0,b=1,x=2,S=`anonymous`,C=`use-credentials`,w=class extends EventTarget{#e={open:null,error:null,message:null};#t;#n=!1;#r=y;#i=null;#a=null;#o;#s;constructor(e,t={}){super(),a.util.markAsUncloneable(this);let n=`EventSource constructor`;a.argumentLengthCheck(arguments,1,n),_||(_=!0,process.emitWarning(`EventSource is experimental, expect them to change at any time.`,{code:`UNDICI-ES`})),e=a.converters.USVString(e),t=a.converters.EventSourceInitDict(t,n,`eventSourceInitDict`),this.#o=t.node.dispatcher||t.dispatcher,this.#s={lastEventId:``,reconnectionTime:t.node.reconnectionTime};let r=f,i;try{i=new URL(e,r.settingsObject.baseUrl),this.#s.origin=i.origin}catch(e){throw new DOMException(e,`SyntaxError`)}this.#t=i.href;let o=S;t.withCredentials===!0&&(o=C,this.#n=!0);let s=p(i,``,o);s.client=f.settingsObject,s.headersList.set(`Accept`,`text/event-stream`),s.cache=`no-store`,s.initiator=`other`,this.#i=s,this.#c()}get readyState(){return a.brandCheck(this,a.is.EventSource),this.#r}get url(){return a.brandCheck(this,a.is.EventSource),this.#t}get withCredentials(){return a.brandCheck(this,a.is.EventSource),this.#n}#c(){if(this.#r===x)return;this.#r=y;let e={request:this.#i,dispatcher:this.#o};e.processResponseEndOfBody=e=>{if(!l(e))return this.#l()},e.processResponse=e=>{if(l(e)){if(e.aborted){this.close(),this.dispatchEvent(new Event(`error`));return}this.#l();return}let t=e.headersList.get(`content-type`,!0),n=t===null?`failure`:s(t),i=n!==`failure`&&n.essence===`text/event-stream`;if(e.status!==200||i===!1){this.close(),this.dispatchEvent(new Event(`error`));return}this.#r=b,this.dispatchEvent(new Event(`open`)),this.#s.origin=e.urlList[e.urlList.length-1].origin;let a=new o({eventSourceSettings:this.#s,maxEventSize:this.#o.eventSourceOptions?.maxEventSize,push:e=>{this.dispatchEvent(c(e.type,e.options))}});r(e.body.stream,a,e=>{e?.aborted===!1&&(this.close(),this.dispatchEvent(new Event(`error`)))})},this.#a=i(e)}#l(){this.#r!==x&&(this.#r=y,this.dispatchEvent(new Event(`error`)),setTimeout(()=>{if(this.#r===y){if(this.#i.headersList.delete(`last-event-id`,!0),this.#s.lastEventId.length){let e=h(g.encode(this.#s.lastEventId));u(e)&&this.#i.headersList.set(`last-event-id`,e,!0)}this.#c()}},this.#s.reconnectionTime)?.unref())}close(){a.brandCheck(this,a.is.EventSource),this.#r!==x&&(this.#r=x,this.#a.abort(),this.#i=null)}get onopen(){return a.brandCheck(this,a.is.EventSource),this.#e.open}set onopen(e){a.brandCheck(this,a.is.EventSource),this.#e.open&&this.removeEventListener(`open`,this.#e.open);let t=a.converters.EventHandlerNonNull(e);t===null?this.#e.open=null:(this.addEventListener(`open`,t),this.#e.open=e)}get onmessage(){return a.brandCheck(this,a.is.EventSource),this.#e.message}set onmessage(e){a.brandCheck(this,a.is.EventSource),this.#e.message&&this.removeEventListener(`message`,this.#e.message);let t=a.converters.EventHandlerNonNull(e);t===null?this.#e.message=null:(this.addEventListener(`message`,t),this.#e.message=e)}get onerror(){return a.brandCheck(this,a.is.EventSource),this.#e.error}set onerror(e){a.brandCheck(this,a.is.EventSource),this.#e.error&&this.removeEventListener(`error`,this.#e.error);let t=a.converters.EventHandlerNonNull(e);t===null?this.#e.error=null:(this.addEventListener(`error`,t),this.#e.error=e)}static{a.is.EventSource=e=>typeof e==`object`&&!!e&&#e in e}},T={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:y,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:b,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:x,writable:!1}};Object.defineProperties(w,T),Object.defineProperties(w.prototype,T),Object.defineProperties(w.prototype,{close:d,onerror:d,onmessage:d,onopen:d,readyState:d,url:d,withCredentials:d}),a.converters.EventSourceInitDict=a.dictionaryConverter([{key:`withCredentials`,converter:a.converters.boolean,defaultValue:()=>!1},{key:`dispatcher`,converter:a.converters.any,defaultValue:()=>m()},{key:`node`,converter:a.dictionaryConverter([{key:`reconnectionTime`,converter:a.converters[`unsigned long`],defaultValue:()=>v},{key:`dispatcher`,converter:a.converters.any}]),defaultValue:()=>({})}]),n.exports={EventSource:w,defaultReconnectionTime:v}})),Hn=t(((e,t)=>{var n=ht(),r=Ye(),i=vt(),a=yt(),o=bt(),s=xt(),c=St(),l=Et(),u=Tt(),d=Dt(),f=kt(),p=At(),m=Q(),h=$(),{InvalidArgumentError:g}=m,_=Rt(),v=Ze(),y=Ut(),{MockCallHistory:b,MockCallHistoryLog:x}=Wt(),S=qt(),C=Gt(),w=Xt(),T=zt(),E=Ot(),{getGlobalDispatcher:D,setGlobalDispatcher:O}=Zt(),k=Qt(),A=$t();Object.assign(r.prototype,_),t.exports.Dispatcher=r,t.exports.Client=n,t.exports.Pool=i,t.exports.BalancedPool=a,t.exports.RoundRobinPool=o,t.exports.Agent=s,t.exports.Dispatcher1Wrapper=c,t.exports.ProxyAgent=l,t.exports.Socks5ProxyAgent=u,t.exports.EnvHttpProxyAgent=d,t.exports.RetryAgent=f,t.exports.H2CClient=p,t.exports.RetryHandler=E,t.exports.DecoratorHandler=k,t.exports.RedirectHandler=A,t.exports.interceptors={redirect:en(),responseError:tn(),retry:nn(),dump:rn(),dns:an(),cache:dn(),decompress:fn(),deduplicate:mn()},t.exports.cacheStores={MemoryCacheStore:ln()};var j=hn();t.exports.cacheStores.SqliteCacheStore=j,t.exports.buildConnector=v,t.exports.errors=m,t.exports.util={parseHeaders:h.parseHeaders,headerNameToString:h.headerNameToString};function M(e){return(t,n,r)=>{if(typeof n==`function`&&(r=n,n=null),!t||typeof t!=`string`&&typeof t!=`object`&&!(t instanceof URL))throw new g(`invalid url`);if(n!=null&&typeof n!=`object`)throw new g(`invalid opts`);if(n&&n.path!=null){if(typeof n.path!=`string`)throw new g(`invalid opts.path`);let e=n.path;n.path.startsWith(`/`)||(e=`/${e}`),t=new URL(h.parseOrigin(t).origin+e)}else n||=typeof t==`object`?t:{},t=h.parseURL(t);let{agent:i,dispatcher:a=D(),...o}=n;if(i)throw new g(`unsupported opts.agent. Did you mean opts.client?`);return e.call(a,{...o,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:n.method||(n.body?`PUT`:`GET`)},r)}}t.exports.setGlobalDispatcher=O,t.exports.getGlobalDispatcher=D;var N=bn().fetch,P=typeof __filename<`u`?__filename:void 0;function F(e,t){if(!e||typeof e!=`object`)return;let n=typeof e.stack==`string`?e.stack:``,r=t.replace(/\\/g,`/`);if(n&&(n.includes(t)||n.includes(r)))return;let i={};if(Error.captureStackTrace(i,F),!i.stack)return;let a=i.stack.split(`
95
95
  `).slice(1).join(`
96
- `);e.stack=n?`${n}\n${a}`:i.stack}t.exports.fetch=function(e,n=void 0){return N(e,n).catch(e=>{throw P?F(e,P):e&&typeof e==`object`&&Error.captureStackTrace(e,t.exports.fetch),e})},t.exports.Headers=gn().Headers,t.exports.Response=_n().Response,t.exports.Request=vn().Request,t.exports.FormData=ut().FormData;var{setGlobalOrigin:I,getGlobalOrigin:L}=rt();t.exports.setGlobalOrigin=I,t.exports.getGlobalOrigin=L;var{CacheStorage:R}=Cn(),{kConstruct:z}=Z();t.exports.caches=new R(z);var{deleteCookie:B,getCookies:V,getSetCookies:H,setCookie:ee,parseCookie:U}=Dn();t.exports.deleteCookie=B,t.exports.getCookies=V,t.exports.getSetCookies=H,t.exports.setCookie=ee,t.exports.parseCookie=U;var{parseMIMEType:te,serializeAMimeType:W}=ot();t.exports.parseMIMEType=te,t.exports.serializeAMimeType=W;var{CloseEvent:G,ErrorEvent:K,MessageEvent:ne}=On(),{WebSocket:q,ping:re}=In();t.exports.WebSocket=q,t.exports.CloseEvent=G,t.exports.ErrorEvent=K,t.exports.MessageEvent=ne,t.exports.ping=re,t.exports.WebSocketStream=Rn().WebSocketStream,t.exports.WebSocketError=Ln().WebSocketError,t.exports.request=M(_.request),t.exports.stream=M(_.stream),t.exports.pipeline=M(_.pipeline),t.exports.connect=M(_.connect),t.exports.upgrade=M(_.upgrade),t.exports.MockClient=y,t.exports.MockCallHistory=b,t.exports.MockCallHistoryLog=x,t.exports.MockPool=C,t.exports.MockAgent=S,t.exports.SnapshotAgent=w,t.exports.mockErrors=T;var{EventSource:ie}=Vn();t.exports.EventSource=ie;function ae(){globalThis.fetch=t.exports.fetch,globalThis.Headers=t.exports.Headers,globalThis.Response=t.exports.Response,globalThis.Request=t.exports.Request,globalThis.FormData=t.exports.FormData,globalThis.WebSocket=t.exports.WebSocket,globalThis.CloseEvent=t.exports.CloseEvent,globalThis.ErrorEvent=t.exports.ErrorEvent,globalThis.MessageEvent=t.exports.MessageEvent,globalThis.EventSource=t.exports.EventSource}t.exports.install=ae}))(),Un=11e4,Wn=new Map;function Gn(e){let t=process.env.AVENTURE_API_SOCKET_PATH,n=`${t}:${e}`,r={headersTimeout:e,bodyTimeout:e},i=Wn.get(n)??new Hn.Dispatcher1Wrapper(t?new Hn.Agent({...r,connect:(n,r)=>(0,Hn.buildConnector)({socketPath:t,timeout:e})({...n,protocol:`http:`},r)}):new Hn.EnvHttpProxyAgent({...r,proxyTunnel:!0}));return Wn.set(n,i),i}function Kn(e,t,n=[]){return J(`${e}: ${t.status} ${t.title}`,[...n],{httpStatus:t.status,problem:t})}function qn(e){let t=[],n=[];for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();(e===`warning`||e.startsWith(`x-contract-warning-`))&&(t.push(`${Jn(e)}: ${i}`),e===`x-contract-warning-key`&&n.push(i))}return{warnings:t,omitted:n}}function Jn(e){return e.split(`-`).map(e=>e===`x`?`X`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`).join(`-`)}async function Yn(e,t,n){let r=Number(process.env.AVENTURE_API_REQUEST_TIMEOUT_MS),i=t.timeoutMs??(Number.isInteger(r)&&r>0?r:Un),a=Date.now()+i,o=await Xn(t.idempotent===!0,a,(r,o)=>Zn(e,{...t.followRollover===!0?t:{...t,headers:{Prefer:`respond-async`,...t.headers}},...o?{idempotent:!1}:{}},n,i,a,r)),s=t.followRollover!==!0&&Ne(o)!==void 0;if(t.followRollover!==!0&&!s)return o;let c=!s&&!o.ok&&o.problem.code===`search_still_running`&&Date.now()<a?await Zn(e,{...t,headers:{...t.headers,Prefer:`respond-async`},signal:AbortSignal.any([AbortSignal.timeout(Math.max(a-Date.now(),1)),...t.signal?[t.signal]:[]])},n,i,a):o,l=c.ok?c:o;if(!l.ok&&!s)return l;let u={...t.headers,Accept:`application/json`};return Ie(l,{origin:new URL($n(e.host,`/`)).origin,path:t.path,deadline:a,signal:t.signal,rollsOver:t.followRollover===!0},(r,a)=>Zn(e,{method:`GET`,path:r,headers:u,signal:AbortSignal.any([AbortSignal.timeout(a),...t.signal?[t.signal]:[]])},n,i,Date.now()+a))}async function Xn(e,t,n){let r=await n(0,!1);if(r.ok)return r;let i=De(r.status,r.problem,e);return i===void 0||Date.now()+i>=t?r:n(i,!0)}async function Zn(e,t,n,a,l,u=0){let d=$n(e.host,t.path,t.searchParams),p=f(),h={Accept:`application/json`,"User-Agent":ce(),...t.headers,...m()},g=t.body instanceof FormData?t.body:t.body===void 0?void 0:JSON.stringify(t.body);g!==void 0&&t.contentType!==void 0&&(h[`Content-Type`]=t.contentType);let _=performance.now();r({component:`aventure-api-client`,event:`request`,fields:{...nr(t,e.host,p),hasBody:t.body!==void 0}});let v=i(),y;try{u>0&&await ge(u,void 0,{signal:t.signal}),y=await Qn(d,t,h,g,a,l,p)}catch(n){let i=c(n),s=o(n);r({component:`aventure-api-client`,event:`request_failed`,message:i,fields:{...nr(t,e.host,p),timeoutMs:a,...s},error:n});let l=s.causeChain===void 0?``:`: ${String(s.causeChain)}`;throw Error(`request to ${v} failed: ${i}${l}`,{cause:n})}let b=Math.round(performance.now()-_),x={component:`aventure-api-client`,event:`response`,fields:{...nr(t,e.host,p),status:y.status,durationMs:b}},S=y.headers.get(`location`);if(tr.has(y.status)&&S!==null)return await y.body?.cancel().catch(()=>s({component:`aventure-api-client`,event:`redirect_body_cleanup_failed`,message:`Redirect body cleanup failed after headers were received`,fields:{...nr(t,e.host,p),status:y.status}})),r(x),{ok:!0,redirect:!0,status:y.status,headers:Object.fromEntries(y.headers),location:S,data:void 0};let C=await(y.ok&&t.responseBytes?y.bytes():y.text()).catch(e=>{if(!y.ok)return`Response body read failed: ${c(e)}`;throw t.signal?.aborted?e:Error(`Response body read from ${v} failed: ${c(e)}`,{cause:e})}),w=C instanceof Uint8Array?C:rr(C,y.headers.get(`content-type`),y.ok?n:void 0,{...nr(t,e.host,p),status:y.status});if(y.ok)return r(x),{ok:!0,status:y.status,headers:Object.fromEntries(y.headers),data:w};let T=le(ue(de(y.status,w??C,h),y.headers),h),E=T.code===`search_still_running`&&(t.followRollover===!0||y.headers.has(`location`));return(E?r:s)({component:`aventure-api-client`,event:E?`following_job`:`problem_response`,fields:{...nr(t,e.host,p),durationMs:b,...pe(T,h)}}),{ok:!1,status:y.status,problem:T,headers:Object.fromEntries(y.headers)}}async function Qn(e,t,n,r,i,a,l){let u=t.method===`GET`||t.idempotent===!0?2:1,d;for(let f=1;f<=u;f+=1){let p=a-Date.now();if(p<=0){d??=Object.assign(Error(`request deadline exceeded`),{name:`TimeoutError`});break}let m=AbortSignal.any([AbortSignal.timeout(Math.min(i,p)),...t.signal?[t.signal]:[]]);try{return f>1&&await ge(Ee(),void 0,{signal:m}),await fetch(e,{method:t.method,headers:n,body:r??null,signal:m,dispatcher:Gn(i),redirect:`manual`})}catch(n){if(d=n,f>=u||t.signal?.aborted===!0||Date.now()>=a)break;s({component:`aventure-api-client`,event:`request_retry`,message:c(n),fields:{...nr(t,new URL(e).host,l),attempt:f,...o(n)},error:n})}}throw d}function $n(e,t,n){let r=new URL(t,e.startsWith(`http`)?e:`https://${e}`);for(let[e,t]of Object.entries(n??{}))t!==void 0&&r.searchParams.set(e,String(t));return r.toString()}var er=new Set([202,204,205]),tr=new Set([301,302,303,307,308]);function nr(e,t,n){return{method:e.method,host:t,path:h(e.path),requestId:n,operationId:e.operationId}}function rr(e,t,n,r){let i=t?.includes(`json`)===!0||[`{`,`[`].includes(e.trimStart().slice(0,1)),a=e.length===0?void 0:e;if(e.length>0&&i)try{a=JSON.parse(e)}catch(e){s({component:`aventure-api-client`,event:`response_json_parse_failed`,message:c(e),fields:{...r},error:e})}if(n===void 0||a===void 0&&er.has(r.status))return a;let o=n.safeParse(a);if(o.success)return o.data;throw Error(`API response failed canonical schema validation`,{cause:o.error})}function ir(e,t){let n=(e.parameters??[]).filter(e=>e.in===`header`),r={};for(let[i,a]of Object.entries(t??{})){let t=n.findLast(e=>e.name.toLowerCase()===i.toLowerCase());if(t===void 0)return J(`${e.operationId} does not declare header '${i}'.`);if(Object.hasOwn(r,t.name))return J(`Header '${t.name}' was supplied more than once.`);r[t.name]=a}let i=n.find(e=>e.required===!0&&!Object.hasOwn(r,e.name));return i===void 0?oe(`OpenAPI request headers validated`,r):J(`${e.operationId} requires header '${i.name}'.`)}var ar=16e3,or=(e,t=ar)=>e.length<=120&&he.byteLength(`${e.join(`
96
+ `);e.stack=n?`${n}\n${a}`:i.stack}t.exports.fetch=function(e,n=void 0){return N(e,n).catch(e=>{throw P?F(e,P):e&&typeof e==`object`&&Error.captureStackTrace(e,t.exports.fetch),e})},t.exports.Headers=gn().Headers,t.exports.Response=_n().Response,t.exports.Request=vn().Request,t.exports.FormData=ut().FormData;var{setGlobalOrigin:I,getGlobalOrigin:L}=rt();t.exports.setGlobalOrigin=I,t.exports.getGlobalOrigin=L;var{CacheStorage:R}=Cn(),{kConstruct:z}=Z();t.exports.caches=new R(z);var{deleteCookie:B,getCookies:V,getSetCookies:H,setCookie:ee,parseCookie:U}=Dn();t.exports.deleteCookie=B,t.exports.getCookies=V,t.exports.getSetCookies=H,t.exports.setCookie=ee,t.exports.parseCookie=U;var{parseMIMEType:te,serializeAMimeType:W}=ot();t.exports.parseMIMEType=te,t.exports.serializeAMimeType=W;var{CloseEvent:G,ErrorEvent:K,MessageEvent:ne}=On(),{WebSocket:q,ping:re}=In();t.exports.WebSocket=q,t.exports.CloseEvent=G,t.exports.ErrorEvent=K,t.exports.MessageEvent=ne,t.exports.ping=re,t.exports.WebSocketStream=Rn().WebSocketStream,t.exports.WebSocketError=Ln().WebSocketError,t.exports.request=M(_.request),t.exports.stream=M(_.stream),t.exports.pipeline=M(_.pipeline),t.exports.connect=M(_.connect),t.exports.upgrade=M(_.upgrade),t.exports.MockClient=y,t.exports.MockCallHistory=b,t.exports.MockCallHistoryLog=x,t.exports.MockPool=C,t.exports.MockAgent=S,t.exports.SnapshotAgent=w,t.exports.mockErrors=T;var{EventSource:ie}=Vn();t.exports.EventSource=ie;function ae(){globalThis.fetch=t.exports.fetch,globalThis.Headers=t.exports.Headers,globalThis.Response=t.exports.Response,globalThis.Request=t.exports.Request,globalThis.FormData=t.exports.FormData,globalThis.WebSocket=t.exports.WebSocket,globalThis.CloseEvent=t.exports.CloseEvent,globalThis.ErrorEvent=t.exports.ErrorEvent,globalThis.MessageEvent=t.exports.MessageEvent,globalThis.EventSource=t.exports.EventSource}t.exports.install=ae}))(),Un=11e4,Wn=new Map;function Gn(e){let t=process.env.AVENTURE_API_SOCKET_PATH,n=`${t}:${e}`,r={headersTimeout:e,bodyTimeout:e},i=Wn.get(n)??new Hn.Dispatcher1Wrapper(t?new Hn.Agent({...r,connect:(n,r)=>(0,Hn.buildConnector)({socketPath:t,timeout:e})({...n,protocol:`http:`},r)}):new Hn.EnvHttpProxyAgent({...r,proxyTunnel:!0}));return Wn.set(n,i),i}function Kn(e,t,n=[]){return J(`${e}: ${t.status} ${t.title}`,[...n],{httpStatus:t.status,problem:t})}function qn(e){let t=[],n=[];for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();(e===`warning`||e.startsWith(`x-contract-warning-`))&&(t.push(`${Jn(e)}: ${i}`),e===`x-contract-warning-key`&&n.push(i))}return{warnings:t,omitted:n}}function Jn(e){return e.split(`-`).map(e=>e===`x`?`X`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`).join(`-`)}async function Yn(e,t,n){let r=Number(process.env.AVENTURE_API_REQUEST_TIMEOUT_MS),i=t.timeoutMs??(Number.isInteger(r)&&r>0?r:Un),a=Date.now()+i,o=await Xn(t.idempotent===!0,a,(r,o)=>Zn(e,{...t.followRollover===!0?t:{...t,headers:{Prefer:`respond-async`,...t.headers}},...o?{idempotent:!1}:{}},n,i,a,r)),s=t.followRollover!==!0&&Ne(o)!==void 0;if(t.followRollover!==!0&&!s)return o;let c=!s&&!o.ok&&o.problem.code===`search_still_running`&&Date.now()<a?await Zn(e,{...t,headers:{...t.headers,Prefer:`respond-async`},signal:AbortSignal.any([AbortSignal.timeout(Math.max(a-Date.now(),1)),...t.signal?[t.signal]:[]])},n,i,a):o,l=c.ok?c:o;if(!l.ok&&!s)return l;let u={...t.headers,Accept:`application/json`};return Ie(l,{origin:new URL($n(e.host,`/`)).origin,path:t.path,deadline:a,signal:t.signal,rollsOver:t.followRollover===!0},(r,a)=>Zn(e,{method:`GET`,path:r,headers:u,signal:AbortSignal.any([AbortSignal.timeout(a),...t.signal?[t.signal]:[]])},n,i,Date.now()+a))}async function Xn(e,t,n){let r=await n(0,!1);if(r.ok)return r;let i=De(r.status,r.problem,e);return i===void 0||Date.now()+i>=t?r:n(i,!0)}async function Zn(e,t,n,a,l,u=0){let d=$n(e.host,t.path,t.searchParams),p=f(),h={Accept:`application/json`,"User-Agent":ce(),...t.headers,...m()},g=t.body instanceof FormData?t.body:t.body===void 0?void 0:JSON.stringify(t.body);g!==void 0&&t.contentType!==void 0&&(h[`Content-Type`]=t.contentType);let _=performance.now();r({component:`aventure-api-client`,event:`request`,fields:{...nr(t,e.host,p),hasBody:t.body!==void 0}});let v=i(),y;try{u>0&&await ge(u,void 0,{signal:t.signal}),y=await Qn(d,t,h,g,a,l,p)}catch(n){let i=c(n),s=o(n);r({component:`aventure-api-client`,event:`request_failed`,message:i,fields:{...nr(t,e.host,p),timeoutMs:a,...s},error:n});let l=s.causeChain===void 0?``:`: ${String(s.causeChain)}`;throw Error(`request to ${v} failed: ${i}${l}`,{cause:n})}let b=Math.round(performance.now()-_),x={component:`aventure-api-client`,event:`response`,fields:{...nr(t,e.host,p),status:y.status,durationMs:b}},S=y.headers.get(`location`);if(tr.has(y.status)&&S!==null)return await y.body?.cancel().catch(()=>s({component:`aventure-api-client`,event:`redirect_body_cleanup_failed`,message:`Redirect body cleanup failed after headers were received`,fields:{...nr(t,e.host,p),status:y.status}})),r(x),{ok:!0,redirect:!0,status:y.status,headers:Object.fromEntries(y.headers),location:S,data:void 0};let C=await(y.ok&&t.responseBytes?y.bytes():y.text()).catch(e=>{if(!y.ok)return`Response body read failed: ${c(e)}`;throw t.signal?.aborted?e:Error(`Response body read from ${v} failed: ${c(e)}`,{cause:e})}),w=C instanceof Uint8Array?C:rr(C,y.headers.get(`content-type`),y.ok?n:void 0,{...nr(t,e.host,p),status:y.status});if(y.ok)return r(x),{ok:!0,status:y.status,headers:Object.fromEntries(y.headers),data:w};let T=le(ue(de(y.status,w??C,h),y.headers),h),E=T.code===`search_still_running`&&(t.followRollover===!0||y.headers.has(`location`));return(E?r:s)({component:`aventure-api-client`,event:E?`following_job`:`problem_response`,fields:{...nr(t,e.host,p),durationMs:b,...pe(T,h)}}),{ok:!1,status:y.status,problem:T,headers:Object.fromEntries(y.headers)}}async function Qn(e,t,n,r,i,a,l){let u=t.method===`GET`||t.idempotent===!0?2:1,d;for(let f=1;f<=u;f+=1){let p=a-Date.now();if(p<=0){d??=Object.assign(Error(`request deadline exceeded`),{name:`TimeoutError`});break}let m=AbortSignal.any([AbortSignal.timeout(Math.min(i,p)),...t.signal?[t.signal]:[]]);try{return f>1&&await ge(Ee(),void 0,{signal:m}),await fetch(e,{method:t.method,headers:n,body:r??null,signal:m,dispatcher:Gn(i),redirect:`manual`})}catch(n){if(d=m.aborted&&t.signal?.aborted!==!0?m.reason:n,f>=u||t.signal?.aborted===!0||Date.now()>=a)break;s({component:`aventure-api-client`,event:`request_retry`,message:c(n),fields:{...nr(t,new URL(e).host,l),attempt:f,...o(n)},error:n})}}throw d}function $n(e,t,n){let r=new URL(t,e.startsWith(`http`)?e:`https://${e}`);for(let[e,t]of Object.entries(n??{}))t!==void 0&&r.searchParams.set(e,String(t));return r.toString()}var er=new Set([202,204,205]),tr=new Set([301,302,303,307,308]);function nr(e,t,n){return{method:e.method,host:t,path:h(e.path),requestId:n,operationId:e.operationId}}function rr(e,t,n,r){let i=t?.includes(`json`)===!0||[`{`,`[`].includes(e.trimStart().slice(0,1)),a=e.length===0?void 0:e;if(e.length>0&&i)try{a=JSON.parse(e)}catch(e){s({component:`aventure-api-client`,event:`response_json_parse_failed`,message:c(e),fields:{...r},error:e})}if(n===void 0||a===void 0&&er.has(r.status))return a;let o=n.safeParse(a);if(o.success)return o.data;throw Error(`API response failed canonical schema validation`,{cause:o.error})}function ir(e,t){let n=(e.parameters??[]).filter(e=>e.in===`header`),r={};for(let[i,a]of Object.entries(t??{})){let t=n.findLast(e=>e.name.toLowerCase()===i.toLowerCase());if(t===void 0)return J(`${e.operationId} does not declare header '${i}'.`);if(Object.hasOwn(r,t.name))return J(`Header '${t.name}' was supplied more than once.`);r[t.name]=a}let i=n.find(e=>e.required===!0&&!Object.hasOwn(r,e.name));return i===void 0?oe(`OpenAPI request headers validated`,r):J(`${e.operationId} requires header '${i.name}'.`)}var ar=16e3,or=(e,t=ar)=>e.length<=120&&he.byteLength(`${e.join(`
97
97
  `)}\n`,`utf8`)<=t,sr=(e,t=!1,n=!1,r=1)=>{let i=me(e),a=t||i.endsWith(`
98
98
  `),o=i.endsWith(`
99
99
  `)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`