@aventurevc/mcp-server 0.8.184 → 0.8.185

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 +1 @@
1
- import{i as e}from"./result-envelope-BQn5YxYv.js";import{dirname as t}from"node:path";import{mkdirSync as n,writeFileSync as r}from"node:fs";import{Buffer as i}from"node:buffer";var a;function o(e){a=e}function s(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function c(o){let c=a;if(c===void 0)return o;a=void 0;let u=o.data,d=o.ok?u instanceof Uint8Array?u:typeof u==`string`?i.from(u,`utf8`):l(s(u)):l(o);try{n(t(c),{recursive:!0}),r(c,d)}catch(t){return e(`could not spill output to '${c}'`,[String(t)])}return!o.ok||d.byteLength<=5e4?o:typeof u!=`object`||!u||u instanceof Uint8Array?{...o,data:`spilled ${d.byteLength} bytes to '${c}'`}:{...o,data:{...u,response:{spilledTo:c,byteLength:d.byteLength}}}}function l(e){return i.from(JSON.stringify(e,null,2),`utf8`)}export{s as n,c as r,o as t};
1
+ import{i as e}from"./result-envelope-D5wNfKzB.js";import{dirname as t}from"node:path";import{mkdirSync as n,writeFileSync as r}from"node:fs";import{Buffer as i}from"node:buffer";var a;function o(e){a=e}function s(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function c(o){let c=a;if(c===void 0)return o;a=void 0;let u=o.data,d=o.ok?u instanceof Uint8Array?u:typeof u==`string`?i.from(u,`utf8`):l(s(u)):l(o);try{n(t(c),{recursive:!0}),r(c,d)}catch(t){return e(`could not spill output to '${c}'`,[String(t)])}return o.ok?typeof u!=`object`||!u||u instanceof Uint8Array||s(u)===u?{...o,data:`spilled ${d.byteLength} bytes to '${c}'`}:{...o,data:{...u,response:{spilledTo:c,byteLength:d.byteLength}}}:o}function l(e){return i.from(JSON.stringify(e,null,2),`utf8`)}export{s as n,c as r,o as t};
@@ -0,0 +1 @@
1
+ import{w as e,y as t}from"./person-owner-BJgNYLKX.js";import{Vr as n}from"./dist-Ce24grer.js";var r=t({clerkPublishableKey:e().nullish(),oauthClient:n.nullish()});export{r as t};
@@ -1 +1 @@
1
- import{S as e,w as t}from"./person-owner-BJgNYLKX.js";import{d as n,u as r}from"./result-envelope-BQn5YxYv.js";var i=/(?:authorization|api-key|secret|token)/iu,a=/^x-cli-[a-z0-9-]*secret$/iu;function o(r,i,a={}){let o=d(a);o.length>0&&(i=s(i,o));let l=e(t(),n).safeParse(i);if(!l.success)return{status:r,title:`HTTP ${r}`,type:`about:blank`,code:void 0,detail:typeof i==`string`?i:void 0};let u=c(l.data),f=typeof u.status==`number`?u.status:r;return{...u,status:f,title:typeof u.title==`string`?u.title:`HTTP ${f}`,type:typeof u.type==`string`?u.type:`about:blank`,detail:typeof u.detail==`string`?u.detail:void 0}}function s(e,t){return typeof e==`string`?f(e,t):typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>s(e,t)):Object.fromEntries(Object.entries(e).map(([e,n])=>[f(e,t),s(n,t)]))}function c(e){let t=r.safeParse(e);if(t.success)return e;let n=new Set(t.error.issues.map(e=>String(e.path[0])));return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}function l(e,t){if(u(t))return{status:e.status,title:`CLI authorization broker request failed`};let n=d(t),r={};for(let[t,i]of Object.entries(e))i!=null&&(r[t]=typeof i==`object`?JSON.stringify(s(i,n)):typeof i==`string`?f(i,n):i);return r}function u(e){return Object.keys(e).some(e=>a.test(e))}function d(e){let t=[];for(let[n,r]of Object.entries(e)){if(!i.test(n))continue;let e=r.trim();if(e.length===0)continue;t.push(e);let a=e.indexOf(` `);if(a>0){let n=e.slice(a+1).trim();n.length>0&&t.push(n)}}return t}function f(e,t){let n=e;for(let e of t)e!=null&&e.length>0&&(n=n.replaceAll(e,`<redacted>`));return n}function p(e,t){if(u(t))return{status:e.status,title:`CLI authorization broker request failed`,type:`about:blank`,detail:`Broker diagnostic text was suppressed at the CLI credential boundary.`,...h(e)};let n=d(t);if(n.length===0)return e;let r=t=>{let r=e[t];return typeof r==`string`?{[t]:f(r,n)}:{}},i=t=>{let r=e[t];return r==null?{}:{[t]:Object.fromEntries(Object.entries(r).map(([e,t])=>[f(e,n),f(t,n)]))}},a=t=>{let r=e[t];return Array.isArray(r)?{[t]:r.map(e=>f(e,n))}:{}};return{status:e.status,title:f(e.title,n),type:f(e.type,n),...r(`detail`),...r(`hint`),...r(`field`),...r(`suggestion`),...r(`requiredRole`),...r(`existingRecordId`),...i(`suggestions`),...i(`error`),...a(`unknownParameters`),...a(`validParameters`),...e.details===void 0?{}:{details:e.details},...e.resolution===void 0?{}:{resolution:e.resolution},...e.code===void 0?{}:{code:e.code},...e.disposition==null?{}:{disposition:e.disposition},...Array.isArray(e.proseViolation)?{proseViolation:e.proseViolation.map(e=>({...e,passage:f(e.passage,n),reason:f(e.reason,n)}))}:{},...r(`traceId`),...r(`spanId`),...e.limitType===void 0?{}:{limitType:e.limitType},...e.allowanceType===void 0?{}:{allowanceType:e.allowanceType},...e.limit===void 0?{}:{limit:e.limit},...e.used===void 0?{}:{used:e.used},...e.remaining===void 0?{}:{remaining:e.remaining},...e.resetAt===void 0?{}:{resetAt:e.resetAt},...e.windowSeconds===void 0?{}:{windowSeconds:e.windowSeconds},...e.filedRunId?{filedRunId:e.filedRunId}:{},...h(e)}}function m(e,t){if(_(e.retryAfterSeconds)!==void 0)return e;let n=g(t.get(`retry-after`));return n===void 0?e:{...e,retryAfterSeconds:n}}function h(e){let t=_(e.retryAfterSeconds);return t===void 0?{}:{retryAfterSeconds:t}}function g(e){let t=e?.trim()??``;if(/^\d+$/u.test(t))return _(Number(t));let n=/[a-z]/iu.test(t)?new Date(t).getTime():NaN;return Number.isNaN(n)?void 0:_(Math.ceil((n-Date.now())/1e3))}function _(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}export{p as a,m as c,d as i,o as n,g as o,f as r,_ as s,l as t};
1
+ import{S as e,w as t}from"./person-owner-BJgNYLKX.js";import{d as n,u as r}from"./result-envelope-D5wNfKzB.js";var i=/(?:authorization|api-key|secret|token)/iu,a=/^x-cli-[a-z0-9-]*secret$/iu;function o(r,i,a={}){let o=d(a);o.length>0&&(i=s(i,o));let l=e(t(),n).safeParse(i);if(!l.success)return{status:r,title:`HTTP ${r}`,type:`about:blank`,code:void 0,detail:typeof i==`string`?i:void 0};let u=c(l.data),f=typeof u.status==`number`?u.status:r;return{...u,status:f,title:typeof u.title==`string`?u.title:`HTTP ${f}`,type:typeof u.type==`string`?u.type:`about:blank`,detail:typeof u.detail==`string`?u.detail:void 0}}function s(e,t){return typeof e==`string`?f(e,t):typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>s(e,t)):Object.fromEntries(Object.entries(e).map(([e,n])=>[f(e,t),s(n,t)]))}function c(e){let t=r.safeParse(e);if(t.success)return e;let n=new Set(t.error.issues.map(e=>String(e.path[0])));return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}function l(e,t){if(u(t))return{status:e.status,title:`CLI authorization broker request failed`};let n=d(t),r={};for(let[t,i]of Object.entries(e))i!=null&&(r[t]=typeof i==`object`?JSON.stringify(s(i,n)):typeof i==`string`?f(i,n):i);return r}function u(e){return Object.keys(e).some(e=>a.test(e))}function d(e){let t=[];for(let[n,r]of Object.entries(e)){if(!i.test(n))continue;let e=r.trim();if(e.length===0)continue;t.push(e);let a=e.indexOf(` `);if(a>0){let n=e.slice(a+1).trim();n.length>0&&t.push(n)}}return t}function f(e,t){let n=e;for(let e of t)e!=null&&e.length>0&&(n=n.replaceAll(e,`<redacted>`));return n}function p(e,t){if(u(t))return{status:e.status,title:`CLI authorization broker request failed`,type:`about:blank`,detail:`Broker diagnostic text was suppressed at the CLI credential boundary.`,...h(e)};let n=d(t);if(n.length===0)return e;let r=t=>{let r=e[t];return typeof r==`string`?{[t]:f(r,n)}:{}},i=t=>{let r=e[t];return r==null?{}:{[t]:Object.fromEntries(Object.entries(r).map(([e,t])=>[f(e,n),f(t,n)]))}},a=t=>{let r=e[t];return Array.isArray(r)?{[t]:r.map(e=>f(e,n))}:{}};return{status:e.status,title:f(e.title,n),type:f(e.type,n),...r(`detail`),...r(`hint`),...r(`field`),...r(`suggestion`),...r(`requiredRole`),...r(`existingRecordId`),...i(`suggestions`),...i(`error`),...a(`unknownParameters`),...a(`validParameters`),...e.details===void 0?{}:{details:e.details},...e.resolution===void 0?{}:{resolution:e.resolution},...e.code===void 0?{}:{code:e.code},...e.disposition==null?{}:{disposition:e.disposition},...Array.isArray(e.proseViolation)?{proseViolation:e.proseViolation.map(e=>({...e,passage:f(e.passage,n),reason:f(e.reason,n)}))}:{},...r(`traceId`),...r(`spanId`),...e.limitType===void 0?{}:{limitType:e.limitType},...e.allowanceType===void 0?{}:{allowanceType:e.allowanceType},...e.limit===void 0?{}:{limit:e.limit},...e.used===void 0?{}:{used:e.used},...e.remaining===void 0?{}:{remaining:e.remaining},...e.resetAt===void 0?{}:{resetAt:e.resetAt},...e.windowSeconds===void 0?{}:{windowSeconds:e.windowSeconds},...e.filedRunId?{filedRunId:e.filedRunId}:{},...h(e)}}function m(e,t){if(_(e.retryAfterSeconds)!==void 0)return e;let n=g(t.get(`retry-after`));return n===void 0?e:{...e,retryAfterSeconds:n}}function h(e){let t=_(e.retryAfterSeconds);return t===void 0?{}:{retryAfterSeconds:t}}function g(e){let t=e?.trim()??``;if(/^\d+$/u.test(t))return _(Number(t));let n=/[a-z]/iu.test(t)?new Date(t).getTime():NaN;return Number.isNaN(n)?void 0:_(Math.ceil((n-Date.now())/1e3))}function _(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}export{p as a,m as c,d as i,o as n,g as o,f as r,_ as s,l as t};
@@ -0,0 +1 @@
1
+ import{E as e,O as t,S as n,T as r,h as i,i as a,l as o,n as s,o as c,p as l,s as u,t as d,u as f,v as p,w as m,y as h}from"./person-owner-BJgNYLKX.js";import{Buffer as g}from"node:buffer";var _=i(()=>r([m(),p(),f(),u(),o(_),n(m(),_)])),v=c([`URL_DUPLICATE`,`STRICT_URL_LOOKUP`,`DUPLICATE_CREATE_REVIEW`,`CLASSIFICATION_INACTIVE_TAG`,`NEWS_SOURCE_URL`]),y=Object.assign(r([v,m()]),{enum:v.enum}),ee=c([`REACTIVATE`,`ATTACH_INACTIVE`]),te=h({availableOverrides:o(ee),conflictType:y,slug:m(),tagId:l()}),b=h({externalId:m().nullish(),id:l(),reason:o(m()),score:l(),slug:m().regex(/^[a-z0-9_-]+$/).max(255).nullish()}),ne=h({externalId:m().nullish(),id:t(),name:m().nullish(),operatingStatus:m().nullish(),publicPath:m().nullish(),reason:o(m()),score:l().optional(),slug:m().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:s.nullish()}),re=h({candidate:o(ne).nullish(),conflictType:y,newsCandidate:o(b).nullish(),overridePath:m().nullish(),threshold:l()}),ie=h({conflictingArticleId:l(),conflictingArticleSlug:m(),conflictingArticleTitle:m(),conflictType:y}),ae=h({candidateEntityId:o(t()),candidatePersonId:o(t()),conflictType:y,hint:m(),normalizedUrl:m().nullish(),url:m(),urlType:m().nullish()}),oe=h({owner:d,urlId:l()}),x=h({conflictType:y,existingJoin:o(oe),fragmentIgnored:f(),guidance:m(),normalizedUrl:m().nullish(),requestedOwner:d,url:m(),urlType:m()}),se=r([x,ae,re,te,ie]),ce=h({acceptedValue:o(m()).nullish(),action:c([`setField`,`setParameter`,`removeParameter`,`useEndpoint`,`reviewCandidates`,`authenticate`]),endpoint:m().nullish(),fieldPath:m().nullish(),parameter:m().nullish(),retryable:f().nullish()}),S=c([`source`,`record`,`disclaimer`,`voice`,`marketing`,`chained`,`structured`,`tense`,`temporal`,`factList`,`mojibake`,`unsupported`,`legalSource`,`textContract`]),C=Object.assign(r([S,m()]),{enum:S.enum}),w=h({overridable:f(),passage:m(),problem:C,reason:m()}),T=c([`entity`,`person`,`news`,`blog`,`content`]),E=h({deletedAt:a({offset:!0}).nullish(),id:m(),isHidden:f(),nameBrand:m().nullish(),resourceType:T,showOnSitemap:f(),slug:m()}),le=h({newUrl:m().nullish(),oldUrl:m(),targetCurrentSlug:m().nullish(),targetId:m().nullish(),targetResourceType:T.nullish()}),D=c([`COMPANY`,`PERSON`,`ENTITY_VIEW`,`ENTITY_BRAND`,`PERSON_VIEW`,`WEB_SEARCH`]),ue=Object.assign(r([D,m()]),{enum:D.enum}),O=h({allowanceType:ue.nullish(),circuitBreaker:m().nullish(),code:r([c(`not_authorized.rateLimited.rate_limited.subscription_required.subscription_canceled.subscription_past_due.subscription_paused.billing_allowance_exhausted.billing_additional_usage_cap_reached.billing_credit_checkout_closed.account_exists.origin_detail_capacity.origin_detail_shutdown.suspectedShellStrip.suspected_shell_strip.prose_rejected.url_surface_misclassification.JOBRUNR_DISABLED.jobrunr_disabled.task_plan_operation_unserved.JOBRUNR_STORAGE_UNAVAILABLE.jobrunr_storage_unavailable.rbac_lookup_unavailable.GEOCODE_PROVIDER_ERROR.geocode_provider_error.sentry_api_error.frontend_cache_epoch_mode_not_targeted.image_blocklist_match.image_monochrome.image_too_small.image_wrong_aspect.image_monogram.image_unreadable.image_processing_error.image_brand_mismatch.image_photographic.web_crawl_fetch_failed.source_document_fetch_busy.primary_website_missing.news_rss_feed_fetch_failed.news_rss_article_fetch_failed.callback_connection_refused.callback_timeout.callback_tls_error.callback_http_4xx.callback_http_5xx.callback_challenge_failed.news_subscription_limit.r2_fetch_failed.r2_delete_failed.r2_upload_failed.source_document_body_unavailable.source_document_capture_limit_exceeded.news_similarity_embedding_unavailable.search_provider_not_configured.search_provider_error.search_still_running.lookup_still_running.sec_edgar_fetch_failed.github_fetch_failed.INFERENCE_PROVIDER_ERROR.inference_provider_error.INFERENCE_PROVIDER_RESPONSE_EMPTY.inference_provider_response_empty.INFERENCE_PROVIDER_INVALID_JSON.inference_provider_invalid_json.INFERENCE_PROFILES_MISSING.inference_profiles_missing.INFERENCE_PROFILE_API_KEY_MISSING.inference_profile_api_key_missing`.split(`.`)),m().max(128)]).nullish(),conflictingRecord:E.nullish(),detail:m().optional(),details:se.nullish(),disposition:c([`TRANSIENT`,`TERMINAL`]).nullish(),error:n(m(),m()).nullish(),existingRecordId:m().nullish(),existingRedirect:le.nullish(),feId:m().nullish(),field:m().nullish(),filedRunId:o(t()).nullish(),hammingDistance:p().int().nullish(),hint:m().nullish(),instance:m().optional(),limit:p().int().nullish(),limitType:r([c([`FORM`,`GLOBAL`,`SUBNET`,`IP`,`UNKNOWN`,`RESILIENCE4J`,`WEB_SEARCH`,`AGENT_HELP`,`NATURAL_SEARCH`,`BILLING_ALLOWANCE`,`BILLING_ADDITIONAL_USAGE`,`CLERK_PUBLIC_ADMISSION`,`CLERK_SCRIPT_LOAD`,`ORIGIN_DETAIL`,`INFERENCE_PROVIDER`]),m()]).nullish(),matchedBlocklistKey:m().nullish(),mediaType:m().nullish(),moderationReason:m().nullish(),parseError:m().nullish(),path:m().nullish(),properties:n(m(),_).optional(),proseViolation:o(w).nullish(),remaining:p().int().nullish(),requiredRole:m().nullish(),resetAt:a({offset:!0}).nullish(),resolution:ce.nullish(),retryAfterSeconds:p().int().nullish(),spanId:m().nullish(),status:l().optional(),suggestion:m().nullish(),suggestions:n(m(),m()).nullish(),suspectedFragment:m().nullish(),title:m().optional(),traceId:m().nullish(),type:m().optional(),unknownParameters:o(m()).nullish(),used:p().int().nullish(),validParameters:o(m()).nullish(),value:m().nullish(),windowSeconds:p().int().nullish()}),de=e=>e>=500&&e<600,k=r([m(),p(),f()]),fe=h({number:p().optional(),size:p().optional(),numberOfElements:p().optional(),totalElements:p().optional(),totalPages:p().optional(),first:f().optional(),last:f().optional(),empty:f().optional()}),A=h({byteLength:p(),maxBytes:p(),omitted:o(m()),recovery:m()}),j=h({status:p(),title:m(),type:m()}).catchall(_.optional()).and(O);h({ok:f(),summary:m(),httpStatus:p().optional(),operationId:m().optional(),method:m().optional(),endpoint:m().optional(),format:c([`json`,`text`]).optional(),count:p().optional(),page:fe.optional(),filters:n(m(),r([k,o(k)])).optional(),truncated:f().optional(),truncation:A.optional(),omitted:o(m()).default([]),ids:o(m()).default([]),counts:n(m(),p()).default({}),references:o(m()).default([]),warnings:o(m()).default([]),problem:j.optional(),data:e()});var M=5e4,N=[50,25,10,5,1],P=320,F=[{arrayLimit:1/0,rowLimit:1/0,stringLimit:24e3},{arrayLimit:1/0,rowLimit:1/0,stringLimit:1e4},...N.map(e=>({arrayLimit:e,rowLimit:1/0}))],I=1e3,L=/^(?:bio|biography|body|content|description|evidence|fulltext|notes|snippet|summary|text)$/u,R=/(?:description|snippet|summary|text)$/u;function z(e){let t=Z(e)?e:null;if(t===null)return;let n={number:Q(t,`number`),size:Q(t,`size`),numberOfElements:Q(t,`numberOfElements`),totalElements:Q(t,`totalElements`),totalPages:Q(t,`totalPages`),first:$(t,`first`),last:$(t,`last`),empty:$(t,`empty`)};return Object.values(n).some(e=>e!==void 0)?n:void 0}function B(e,t){if(t?.numberOfElements!==void 0)return t.numberOfElements;if(Array.isArray(e))return e.length;let n=Z(e)?e.content:void 0;return Array.isArray(n)?n.length:void 0}function V(e,t,n={}){return{ok:!0,summary:e,...n,omitted:n.omitted??[],ids:n.ids??[],counts:n.counts??{},references:n.references??[],warnings:n.warnings??[],data:t}}function pe(e,t=[],n={}){return{...V(e,null,{...n,warnings:t}),ok:!1}}function me(e,t={}){let n=g.byteLength(JSON.stringify(e),`utf8`);if(n<=5e4)return e;let r=e.httpStatus??0;if(t.write===!0&&e.ok&&r>=200&&r<300)return he(e,n,t.exactRecovery);let i=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.`,a=_.safeParse(JSON.parse(JSON.stringify(e.data))),o=t=>{let r=a.success?q(a.data,`data`,n,t):{value:Y(n),omitted:[`data`]};return{...e,truncated:!0,truncation:J(n,r.omitted,i),warnings:[...e.warnings,...t.rowLimit===1/0?[]:[ye(t.rowLimit)],`response truncated (>50KB); read the section through its sub-resource operation, or request a smaller page, a compact projection where the operation offers one, or a narrower server-side filter`],data:r.value}},s=e;for(let e of F)if(s=o(e),W(s))return s;let c=0;for(let t=2**Math.floor(Math.log2(K(e.data)));t>=1;t/=2)W(o({arrayLimit:1,rowLimit:c+t}))&&(c+=t);return c>0?o({arrayLimit:1,rowLimit:c}):H({...s,truncation:J(n,[`data`],i),data:Y(n)},n,i,`response truncated (>50KB); metadata named in truncation.omitted was removed; read the section through its sub-resource operation, or request a smaller page, a compact projection where the operation offers one, or a narrower server-side filter`)}function he(e,t,n=`Read the full result through the GET operation on ${e.endpoint??`this route`}.`){let r={...e.counts},i=(e,n)=>{let a={};for(let[o,s]of Object.entries(Z(e)?e:{}))Array.isArray(s)?r[`${n}${o}`]=s.length:typeof s==`string`?a[o]=G(s,t,P):typeof s!=`object`||!s?a[o]=s:n===``&&o===`response`&&(a[o]=i(s,`response.`));return a},a={...e,summary:`${e.method} succeeded (HTTP ${e.httpStatus}); response body omitted (${t} bytes, over the 50KB cap); do not retry the write`,truncated:!0,truncation:J(t,[`data`],n),counts:r,data:i(e.data,``)},o=a,s=[`data`],c={};for(let r of[`references`,`ids`,`warnings`]){if(W(o))return o;s.push(r),c[r]=[],o={...a,...c,omitted:[...e.omitted,...s.slice(1)],truncation:J(t,s,n)}}return W(o)?o:H({...o,data:Y(t),warnings:[`response truncated (>50KB); do not retry the write`]},t,n,`response truncated (>50KB); metadata named in truncation.omitted was removed; do not retry the write`)}function H(e,t,n,r){if(W(e))return e;let i=e.warnings.slice(0,-1),a=[`data`],o=e;if(o.problem!==void 0){let e=U(o.problem);if(JSON.stringify(e).length<JSON.stringify(o.problem).length&&(a.push(`problem`),o={...o,problem:e,truncation:J(t,a,n)},W(o)))return o}let s=[];if(e.filters!==void 0&&s.push(`filters`),e.omitted.length>0&&s.push(`omitted`),e.ids.length>0&&s.push(`ids`),Object.keys(e.counts).length>0&&s.push(`counts`),e.references.length>0&&s.push(`references`),a.push(...s),o={...o,filters:void 0,truncation:J(t,a,n),omitted:[],ids:[],counts:{},references:[],warnings:s.length===0?e.warnings:[...i,r]},W(o))return o;let c=e=>e===void 0?void 0:G(e,t),l={summary:G(o.summary,t),operationId:c(o.operationId),method:c(o.method),endpoint:c(o.endpoint),warnings:o.warnings.map(e=>G(e,t)),problem:o.problem&&U(o.problem,t)},u=new Map(Object.entries(o));for(let[e,t]of Object.entries(l))JSON.stringify(t)!==JSON.stringify(u.get(e))&&a.push(e);if(o={...o,...l,truncation:J(t,a,n)},W(o))return o;a.push(`warnings`),o.page!==void 0&&a.push(`page`);let d=G(o.summary,t,P);return d!==o.summary&&a.push(`summary`),{...o,summary:d,page:void 0,truncation:J(t,a,n),warnings:[r]}}function U(e,t){let n=e=>t===void 0?e:G(e,t);return{status:e.status,title:n(e.title),type:n(e.type),...e.detail===void 0?{}:{detail:n(e.detail)},...e.instance===void 0?{}:{instance:n(e.instance)},...e.code===void 0?{}:{code:typeof e.code==`string`?n(e.code):e.code},...e.retryAfterSeconds===void 0?{}:{retryAfterSeconds:e.retryAfterSeconds}}}function W(e){return g.byteLength(JSON.stringify(e),`utf8`)<=M}function G(e,t,n=I){if(g.byteLength(JSON.stringify(e),`utf8`)<=n)return e;let r=X(t),i=``,a=g.byteLength(JSON.stringify(r),`utf8`);for(let t of e){let e=g.byteLength(JSON.stringify(t),`utf8`)-2;if(a+e>n)break;i+=t,a+=e}return`${i.trimEnd()}${r}`}function K(e){return Array.isArray(e)?e.length:Z(e)?Math.max(0,...Object.values(e).map(K)):0}function q(e,t,n,r){if(typeof e==`string`){let i=_e(be(t))||e.length>I,a=r.stringLimit??P;return!i||e.length<=a?{value:e,omitted:[]}:{value:`${e.slice(0,a).trimEnd()}${X(n)}`,omitted:[t]}}if(typeof e!=`object`||!e)return{value:e,omitted:[]};if(Array.isArray(e))return ge(e,t,n,r);if(t===`data.response.entity.answer`||t===`data.response.answer`)return{value:e,omitted:[]};let i={},a=[];for(let[o,s]of Object.entries(e)){if(s===void 0)continue;let e=q(s,`${t}.${o}`,n,r);i[o]=e.value,a.push(...e.omitted)}return{value:i,omitted:a}}function ge(e,t,n,r){let i=e.slice(0,r.rowLimit),a={...r,rowLimit:r.arrayLimit},o=i.map((e,r)=>q(e,`${t}[${r}]`,n,a)),s=o.flatMap(e=>e.omitted),c=`${t}[${i.length}..] (kept ${i.length} of ${e.length})`;return{value:o.map(e=>e.value),omitted:e.length>i.length?[...s,c]:s}}function _e(e){let t=e.toLowerCase();return L.test(t)||R.test(t)}var ve=`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.`;function J(e,t,n){return{byteLength:e,maxBytes:M,omitted:t.length===0?[`data`]:[...new Set(t)],recovery:G(n,e)}}function Y(e){return{truncated:!0,byteLength:e,maxBytes:M}}function X(e){return`\n[truncated byteLength=${e} maxBytes=${M}]`}var ye=e=>`kept the first ${e} whole rows of each list; read the rest ${e} at a time: rerun a paged read with --size ${e} and --page 1, 2, … (MCP: size, page), or a batch read with at most ${e} ids per call`;function be(e){return(e.split(`.`).at(-1)??e).replace(/\[\d+\]$/,``)}var Z=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Q(e,t){return typeof e[t]==`number`?e[t]:void 0}function $(e,t){return typeof e[t]==`boolean`?e[t]:void 0}export{W as a,V as c,_ as d,pe as i,de as l,ve as n,z as o,me as r,B as s,M as t,O as u};
@@ -0,0 +1 @@
1
+ import{n as e}from"./commander-BB7CDPLs.js";import{C as t,S as n,T as r,g as i,h as a,l as o,o as s,u as c,v as l,w as u,y as d}from"./person-owner-BJgNYLKX.js";import{c as f,d as p,i as m}from"./result-envelope-D5wNfKzB.js";import{basename as h,extname as ee}from"node:path";import{AsyncLocalStorage as te}from"node:async_hooks";import{readFile as ne}from"node:fs/promises";function g(e){return new URL(e,`https://placeholder.invalid`).pathname}function _(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(re)?!1:n.every((e,t)=>v(e)||e===r[t])}function v(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function re(e){if(v(e))return!0;let t=e.toLowerCase(),n=e.slice(3,-3);return t.startsWith(`%7b`)&&t.endsWith(`%7d`)&&n.length>0&&!n.includes(`/`)&&!n.includes(`%`)&&!n.includes(`{`)&&!n.includes(`}`)}var y=new te,b=()=>y.getStore()?.requestId,ie=()=>y.getStore()?.userBearerToken;function ae(e,t){return y.run({...y.getStore(),requestId:e},t)}function x(e,t){return y.run({...y.getStore(),userBearerToken:e},t)}var S=[`get`,`post`,`put`,`patch`,`delete`],C={get:`GET`,post:`POST`,put:`PUT`,patch:`PATCH`,delete:`DELETE`},oe=e=>C[e];function se(e){let t=e.toLowerCase(),n=S.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var ce=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],w=t({name:u().regex(/^[A-Z][A-Z0-9_]*$/u)}),T=r([i(`private`),d({scope:u().optional(),value:u().optional()})]),E=a(()=>d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),"x-aventure-parsed-enum":c().optional(),readOnly:c().optional(),items:E.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),properties:n(u(),E).optional(),required:o(u()).optional(),oneOf:o(E).optional(),anyOf:o(E).optional(),allOf:o(E).optional(),propertyNames:E.optional(),additionalProperties:r([E,c()]).optional(),"x-aventure-visibility":T.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":w.optional(),"x-aventure-detail":i(!0).optional(),"x-aventure-operation-only":o(u().min(1)).min(1).optional()})),le=d({in:u(),name:u(),required:c().optional(),description:u().optional(),schema:E.optional(),"x-aventure-visibility":T.optional(),"x-aventure-legacy-name":t({name:u().trim().min(1)}).optional()}).superRefine((e,t)=>{let n=e[`x-aventure-legacy-name`]?.name;n!==void 0&&(e.in!==`path`&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`],message:`x-aventure-legacy-name is valid only for path parameters`}),n===e.name&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name must differ from its canonical name`}))}),D=n(u(),d({schema:E.optional()})),ue=d({description:u().optional(),content:D.optional(),"x-aventure-standard-response":c().optional()}),O=d({description:u().optional(),required:c().optional(),content:D.optional()}),de=t({auth:s([`none`,`read`]).optional()}).optional(),k=r([i(``),u().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),A=t({readOperationId:u().min(1),writePointer:k,readPointer:k}),j=u().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),M=u().regex(/^[a-z][A-Za-z0-9]*$/u),N=u().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),P=t({command:j,role:s(ce),summary:u().trim().min(1).optional(),description:u().trim().min(1).optional(),bodyOption:o(M).min(1).optional(),localOption:o(t({optionKey:M,flag:N,description:u().trim().min(1)})).min(1).optional()}).superRefine((t,n)=>{let r=[t.bodyOption??[],(t.localOption??[]).map(e=>e.optionKey),(t.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),i=(t.localOption??[]).some(t=>new e(t.flag).attributeName()!==t.optionKey);(r||i)&&n.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),F=d({operationId:u(),summary:u().optional(),description:u().optional(),tags:o(u()).optional(),deprecated:c().optional(),hidden:c().optional(),security:o(n(u(),o(u()))).optional(),parameters:o(le).optional(),requestBody:O.optional(),responses:n(u(),ue),"x-aventure-visibility":T.optional(),"x-aventure-tool":de,"x-aventure-mutation-readback":A.optional(),"x-aventure-cli-composite":P}).superRefine((e,t)=>{let n=e.parameters??[];for(let[e,r]of n.entries()){let i=r[`x-aventure-legacy-name`]?.name;r.in===`path`&&i!==void 0&&n.some((t,n)=>n!==e&&t.in===`path`&&(t.name===i||t[`x-aventure-legacy-name`]?.name===i))&&t.addIssue({code:`custom`,path:[`parameters`,e,`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name '${i}' collides with another declared path parameter`})}}),I=d(Object.fromEntries(S.map(e=>[e,F.optional()]))),L=d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),"x-aventure-parsed-enum":c().optional(),readOnly:c().optional(),items:E.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),oneOf:o(E).optional(),anyOf:o(E).optional(),allOf:o(E).optional(),propertyNames:E.optional(),additionalProperties:r([E,c()]).optional(),properties:n(u(),E).optional(),required:o(u()).optional(),"x-aventure-visibility":T.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":w.optional(),"x-aventure-detail":i(!0).optional(),"x-aventure-noun":t({one:u().trim().min(1),other:u().trim().min(1)}).optional()});d({info:d({description:u().optional()}).optional(),tags:o(d({name:u(),description:u().optional(),"x-aventure-cli":t({section:s([`researchData`,`account`,`administration`,`cli`])}).optional()})).optional(),paths:n(u(),I),webhooks:n(u(),d({post:d({description:u(),requestBody:O})})).optional(),components:d({schemas:n(u(),L)})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of S){let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&B(e.paths,a.readOperationId)===null&&t.addIssue({code:`custom`,path:[`paths`,n,i,`x-aventure-mutation-readback`,`readOperationId`],message:`mutation readback names '${a.readOperationId}', which no operation in this document emits`})}});var R=new Set([`page`,`size`,`sort`]);function z(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0?e.$ref.slice(21):void 0}function B(e,t){for(let[n,r]of Object.entries(e))for(let e of S){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function V(e,t,n){let r=g(n),i=e[r]?.[t];if(i)return{method:t,template:r,operation:i};for(let[n,i]of Object.entries(e)){let e=i[t];if(e&&_(n,r))return{method:t,template:n,operation:e}}return null}function H(e,t,n=e){return e.replace(/\{([^}]+)}/g,(...e)=>{let r=e[1],i=t[r];if(i==null)throw Error(`Missing path parameter '${r}' for ${n}`);return encodeURIComponent(String(i))})}function fe(e,t,n){let r=t;for(let i of e.parameters??[]){let e=i[`x-aventure-legacy-name`]?.name;if(i.in!==`path`||e===void 0)continue;let a=t[e];if(Object.hasOwn(t,e)&&a!==void 0){if(Object.hasOwn(t,i.name))throw Error(`Path parameters '${i.name}' and legacy alias '${e}' were both supplied for ${n}`);r===t&&(r={...t}),r[i.name]=a,delete r[e]}}return r}function pe(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||R.has(r.name))continue;let e=t?.[r.name]??me(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}function me(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return e}var U=3e4;async function he(e,t,n,r){let i=G(W(e.requestBody?.content),n);if(!i.ok||i.data===null)return m(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return m(`Request body is required.`);if(a?.kind===`multipart`)return await ve(e.requestBody?.required===!0,a.schema,t);let o=a?.contentType??r;return f(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function ge(e){if(typeof e!=`string`)return f(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return f(`Request body unchanged`,e);try{let t=p.safeParse(JSON.parse(e));if(!t.success)throw t.error;return f(`Request body parsed`,t.data)}catch(e){return m(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function _e(e,t){let n=e?.schema;if(n===void 0)return!1;let r=z(n),i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function W(e){let t=Object.entries(e??{});return[...t.flatMap(e=>Ee(e[0])?[K(e,`json`)]:[]),...t.flatMap(e=>De(e[0])?[K(e,`multipart`)]:[])]}function G(e,t){if(t===void 0)return f(`Default request content selected`,e[0]);let n=Z(t),r=e.find(e=>Z(e.contentType)===n);return r===void 0?m(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):f(`Explicit request content selected`,r)}function K(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function ve(e,t,n){if(!e&&n==null)return f(`Optional multipart body omitted`,{});let r=ye(n);if(!r.ok||r.data===null)return m(r.summary,r.warnings);let i=new FormData;for(let e of be(t)){let t=r.data[e.name];if(t==null){if(e.required)return m(`Multipart body requires '${e.name}'.`);continue}if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return m(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return m(`Multipart part '${e.name}' has too many entries.`);if(q(e.schema)||J(e.schema)){let n=J(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return m(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await Se(t);if(!n.ok||n.data===null)return m(n.summary,n.warnings);i.append(e.name,n.data.blob,n.data.filename)}}else if(xe(e.schema,t)){let n=JSON.stringify(t);i.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=Y(i,e.name,t);if(!n.ok)return n}}return f(`Multipart body prepared`,{body:i})}function ye(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return f(`Multipart input parsed`,t)}return m(`Multipart request body must be a JSON object keyed by form part name.`)}function be(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function q(e){return e.type===`string`&&e.format===`binary`}function J(e){return e.type===`array`&&e.items!==void 0&&q(e.items)}function xe(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function Y(e,t,n){if(Array.isArray(n)){for(let r of n){let n=Y(e,t,r);if(!n.ok)return n}return f(`Multipart scalar array appended`,null)}return typeof n==`object`?m(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),f(`Multipart scalar appended`,null))}async function Se(e){return Te(e)?await Ce(e):b()===void 0?await we(e):m(`MCP callers cannot upload local files: pass an http(s) URL as the multipart part, or send media by sourceUrl in a JSON body. Local file paths are CLI-only.`)}async function Ce(e){let t=new AbortController,n=setTimeout(()=>t.abort(),U);try{let n=new URL(e),r=await fetch(e,{signal:t.signal});if(!r.ok)return m(`Failed to fetch media URL: ${r.status} ${r.statusText}`);let i=r.headers.get(`content-type`)?.split(`;`)[0]?.trim()??X(n.pathname)??``,a=new Blob([await r.arrayBuffer()],{type:i});return f(`URL media fetched`,{blob:a,filename:h(n.pathname)||`upload`})}catch(e){return t.signal.aborted?m(`Failed to fetch media URL: timed out after ${U}ms.`):m(`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`)}finally{clearTimeout(n)}}async function we(e){try{let t=X(e)??``,n=await ne(e);return f(`File media read`,{blob:new Blob([n],{type:t}),filename:h(e)})}catch(t){return m(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function Te(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function X(e){return Oe[ee(e).toLowerCase()]}function Ee(e){let t=Z(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function De(e){return Z(e)===`multipart/form-data`}var Z=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,Oe={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`};function ke(e,t,n){let r=new Map,i=(t,a,o)=>{let s=z(t);if(a>n||s!==void 0&&o.includes(s))return;let c=s===void 0?o:[...o,s],l=je(e,t);for(let e of[...l.items===void 0?[]:[l.items],...l.oneOf??[],...l.anyOf??[],...l.allOf??[]])i(e,a,c);for(let[e,t]of Object.entries(l.properties??{}))r.set(e,Math.min(r.get(e)??a,a)),i(t,a+1,c)};for(let[e,n]of Object.entries(t))e.startsWith(`2`)&&i(Ae(n.content),0,[]);return r}function Ae(e){return e?.[`application/json`]?.schema??Object.values(e??{}).find(e=>e.schema!==void 0)?.schema}function je(e,t){let n=z(t);return{...n===void 0?void 0:e.components.schemas[n],...t}}function Me(e){return e===`write`||e===`delete`}function Ne(e,t){return e===`DELETE`||t===`delete`}var Pe=`Shell-safe input: single-quote string flag values that contain $; use --from-file or stdin for JSON bodies, multiline text, and free text with currency amounts.`;function Fe(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}var Q={add:`write`,answer:`search`,ask:`search`,attach:`write`,audit:`read`,batch:`lookup`,convert:`write`,create:`write`,delete:`delete`,enrich:`write`,filter:`search`,get:`read`,import:`write`,join:`write`,list:`read`,lookup:`lookup`,merge:`write`,preview:`lookup`,reconcile:`write`,remove:`delete`,replace:`write`,resolve:`lookup`,search:`search`,status:`read`,suggest:`read`,update:`write`,upload:`write`};function Ie(e){let t=/^[a-z]+/u.exec(e)?.[0];if(t===void 0)throw Error(`operationId '${e}' has no verb`);return t}function Le(e){return e!==`/v1/auth/api-key`&&!/^\/v1\/sitemap(?:\/|$)/u.test(e)}var Re=/(?:^|-)(?:runs|jobs)$/u;function ze(e){switch(e.intent){case`read`:case`lookup`:case`search`:case`status`:case`job`:return e.intent;case`write`:{let t=Ie(e.operationId);return t===`enrich`||t===`create`&&Re.test(e.cliPath.at(-2)??``)?`job`:null}case`delete`:return null;default:{let t=e.intent;throw Error(`No public MCP intent for ${String(t)}`)}}}function Be(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>Object.values(e.content??{}).some(e=>Ve(e.schema)))}function Ve(e){return e?.format===`byte`||e?.format===`binary`}function He(e){return`aventure_${e}`}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Ue=e=>`--${$(e)}`;export{x as A,se as C,b as D,z as E,ie as O,B as S,V as T,G as _,Ue as a,H as b,He as c,ze as d,ke as f,_e as g,W as h,Fe as i,g as j,ae as k,Le as l,he as m,Q as n,Ne as o,ge as p,Be as r,Me as s,Pe as t,$ as u,S as v,pe as w,fe as x,oe as y};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as e,M as t,N as n,O as r,_ as i,c as a,d as o,j as s,k as c,l,n as u,t as d,y as f}from"../chunks/esm-kgyHmk-Q.js";import{t as p}from"../chunks/commander-BB7CDPLs.js";import{A as m,B as h,C as g,E as _,F as v,I as y,N as b,O as x,P as S,R as C,S as w,T,_ as ee,a as E,b as D,d as O,f as k,g as A,h as te,i as j,j as M,k as ne,l as re,m as ie,o as N,p as ae,s as oe,t as se,u as ce,v as le,w as ue,y as de}from"../chunks/logging-D_7xwm_N.js";import{i as fe,n as pe,t as me,u as he}from"../chunks/env-gpTPURvt.js";import{A as ge,D as _e,E as P,S as F,T as I,_ as L,b as R,c as ve,d as ye,f as be,g as z,h as xe,i as Se,k as Ce,l as B,m as we,o as V,p as Te,r as Ee,s as De,u as H,v as U,w as W,x as Oe,y as G}from"../chunks/person-owner-BJgNYLKX.js";import{$ as ke,$n as Ae,$t as je,A as Me,An as Ne,At as Pe,B as Fe,Bn as Ie,Br as Le,Bt as Re,C as ze,Cn as Be,Cr as Ve,Ct as He,D as Ue,Dn as We,Dr as Ge,Dt as Ke,E as qe,En as Je,Er as Ye,Et as Xe,F as Ze,Fn as Qe,Fr as $e,Ft as et,G as tt,Gn as nt,Gt as rt,H as it,Hn as at,Ht as ot,I as st,In as ct,Ir as lt,It as ut,J as dt,Jn as ft,Jt as pt,K as mt,Kn as ht,Kt as gt,L as _t,Ln as vt,Lr as yt,Lt as bt,M as xt,Mn as St,Mr as Ct,Mt as wt,N as Tt,Nn as Et,Nr as Dt,Nt as Ot,O as kt,On as At,Or as jt,Ot as Mt,Pn as Nt,Pt,Q as Ft,Qn as It,Qt as Lt,R as Rt,Rn as zt,Rr as Bt,Rt as Vt,S as Ht,Sn as Ut,Sr as Wt,St as Gt,T as Kt,Tn as qt,Tr as Jt,Tt as Yt,U as Xt,Un as Zt,Ut as Qt,V as $t,Vn as en,Vt as tn,W as nn,Wn as rn,Wt as an,X as on,Xn as sn,Xt as cn,Y as ln,Yn as un,Yt as dn,Z as fn,Zn as pn,Zt as mn,_ as hn,_n as gn,_r as _n,_t as vn,a as yn,an as bn,ar as xn,at as Sn,b as Cn,bn as wn,br as Tn,bt as En,c as Dn,cn as On,cr as kn,ct as An,d as jn,dn as Mn,dr as Nn,dt as Pn,en as Fn,er as In,et as Ln,f as Rn,fn as zn,fr as Bn,ft as Vn,g as Hn,gn as Un,gr as Wn,gt as Gn,h as Kn,hn as qn,hr as Jn,ht as Yn,i as Xn,in as Zn,ir as Qn,it as $n,j as er,jn as tr,jr as nr,jt as rr,k as ir,kn as ar,kr as or,kt as sr,l as cr,ln as lr,lr as ur,lt as dr,m as fr,mn as pr,mr,mt as hr,n as gr,nn as _r,nr as vr,nt as yr,o as br,on as xr,or as Sr,ot as Cr,p as wr,pn as Tr,pr as Er,pt as Dr,q as Or,qn as kr,qt as Ar,r as jr,rn as Mr,rr as Nr,rt as Pr,s as Fr,sn as Ir,sr as Lr,st as Rr,t as zr,tn as Br,tr as Vr,tt as Hr,u as Ur,un as Wr,ur as Gr,ut as Kr,v as qr,vn as Jr,vr as Yr,w as Xr,wn as Zr,wr as Qr,wt as $r,x as ei,xn as ti,xr as ni,xt as ri,y as ii,yn as ai,yr as oi,yt as si,z as ci,zn as li,zt as ui}from"../chunks/dist-DEM96tOm.js";import{c as di,d as fi,i as pi,l as mi,r as hi}from"../chunks/result-envelope-BQn5YxYv.js";import{a as gi}from"../chunks/package-DPDX5zmx.js";import{t as _i}from"../chunks/provider-catalog-CO9PbESp.js";import{A as vi,D as yi,E as bi,S as xi,_ as Si,b as Ci,k as wi}from"../chunks/tool-policy-CrjzsCMg.js";import{S as Ti,_ as Ei,b as Di,f as Oi,h as ki,i as Ai,m as ji,p as Mi,r as Ni,t as Pi,v as Fi,y as Ii}from"../chunks/contract-3pjwG-ee.js";import{n as Li,t as Ri}from"../chunks/mcp-generation-contract-BQPEsRvl.js";import zi from"crypto";import{Readable as Bi}from"stream";import{Buffer as Vi}from"node:buffer";import{fileURLToPath as Hi}from"node:url";import{isIP as Ui,isIPv4 as Wi,isIPv6 as Gi}from"node:net";import{createHash as Ki,randomUUID as qi,timingSafeEqual as Ji}from"node:crypto";var Yi={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}},Xi,Zi=c((()=>{(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Xi||={})})),K,Qi,$i=c((()=>{(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(K||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Qi||={})}));function ea(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function ta(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}function na(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new oa(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function ra(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ia(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function aa(e,t){return e.toLowerCase()===t.toLowerCase()}var oa,sa=c((()=>{oa=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),ca,la=c((()=>{(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(ca||={})})),ua,da=c((()=>{la(),ua=class{kind=ca.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function fa(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var pa,ma,ha=c((()=>{la(),$i(),sa(),pa=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=fa(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=ia(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ma=class{kind=ca.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new pa(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new pa(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new pa(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Qi.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===K.GAUGE||e.type===K.UP_DOWN_COUNTER||e.type===K.OBSERVABLE_GAUGE||e.type===K.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),ga,_a,va=c((()=>{ga=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new _a,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},_a=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function ya(e){return Oa.setFloat64(0,e),{hi:Oa.getUint32(0),lo:Oa.getUint32(4)}}function ba(e){let{hi:t}=ya(e);return((t&Sa)>>20)-wa}function xa(e){let{hi:t,lo:n}=ya(e);return(t&Ca)===0&&n===0}var Sa,Ca,wa,Ta,Ea,Da,Oa,ka=c((()=>{Sa=2146435072,Ca=1048575,wa=1023,Ta=-1022,Ea=wa,Da=2**-1022,Oa=new DataView(new ArrayBuffer(8))}));function Aa(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function ja(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var Ma=c((()=>{})),Na,Pa=c((()=>{Na=class extends Error{}})),Fa,Ia=c((()=>{ka(),Ma(),Pa(),Fa=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<Da?this._minNormalLowerBoundaryIndex():ba(e)+(xa(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new Na(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new Na(`overflow: ${e} is > maximum lower boundary: ${n}`);return Aa(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Ta>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ea>>this._shift}}})),La,Ra=c((()=>{ka(),Ma(),Pa(),La=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=Aa(Math.LOG2E,e),this._inverseFactor=Aa(Math.LN2,-e)}mapToIndex(e){if(e<=Da)return this._minNormalLowerBoundaryIndex()-1;if(xa(e))return(ba(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new Na(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return Da;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new Na(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Ta<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ea+1<<this._scale)-1}}}));function za(e){if(e>Va||e<Ba)throw new Na(`expected scale >= ${Ba} && <= ${Va}, got: ${e}`);return Ha[e+10]}var Ba,Va,Ha,Ua=c((()=>{Ia(),Ra(),Pa(),Ba=-10,Va=20,Ha=Array.from({length:31},(e,t)=>t>10?new La(t-10):new Fa(t-10))})),Wa,Ga,Ka,qa,Ja,Ya,Xa=c((()=>{la(),$i(),u(),va(),Ua(),Ma(),Wa=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},Ga=20,Ka=160,qa=2,Ja=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=Ka,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new ga,u=new ga,d=za(Ga)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=u,this._mapping=d,this._maxSize<qa&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
+ import{A as e,M as t,N as n,O as r,_ as i,c as a,d as o,j as s,k as c,l,n as u,t as d,y as f}from"../chunks/esm-kgyHmk-Q.js";import{t as p}from"../chunks/commander-BB7CDPLs.js";import{A as m,B as h,C as g,E as _,F as v,I as y,N as b,O as x,P as S,R as C,S as w,T,_ as ee,a as E,b as D,d as O,f as k,g as A,h as te,i as j,j as M,k as ne,l as re,m as ie,o as N,p as ae,s as oe,t as se,u as ce,v as le,w as ue,y as de}from"../chunks/logging-CDCaRpiW.js";import{i as fe,n as pe,t as me,u as he}from"../chunks/env-YDNggcP1.js";import{A as ge,D as _e,E as P,S as F,T as I,_ as L,b as R,c as ve,d as ye,f as be,g as z,h as xe,i as Se,k as Ce,l as B,m as we,o as V,p as Te,r as Ee,s as De,u as H,v as U,w as W,x as Oe,y as G}from"../chunks/person-owner-BJgNYLKX.js";import{$ as ke,$n as Ae,$t as je,A as Me,An as Ne,At as Pe,B as Fe,Bn as Ie,Br as Le,Bt as Re,C as ze,Cn as Be,Cr as Ve,Ct as He,D as Ue,Dn as We,Dr as Ge,Dt as Ke,E as qe,En as Je,Er as Ye,Et as Xe,F as Ze,Fn as Qe,Fr as $e,Ft as et,G as tt,Gn as nt,Gt as rt,H as it,Hn as at,Ht as ot,I as st,In as ct,Ir as lt,It as ut,J as dt,Jn as ft,Jt as pt,K as mt,Kn as ht,Kt as gt,L as _t,Ln as vt,Lr as yt,Lt as bt,M as xt,Mn as St,Mr as Ct,Mt as wt,N as Tt,Nn as Et,Nr as Dt,Nt as Ot,O as kt,On as At,Or as jt,Ot as Mt,Pn as Nt,Pt,Q as Ft,Qn as It,Qt as Lt,R as Rt,Rn as zt,Rr as Bt,Rt as Vt,S as Ht,Sn as Ut,Sr as Wt,St as Gt,T as Kt,Tn as qt,Tr as Jt,Tt as Yt,U as Xt,Un as Zt,Ut as Qt,V as $t,Vn as en,Vt as tn,W as nn,Wn as rn,Wt as an,X as on,Xn as sn,Xt as cn,Y as ln,Yn as un,Yt as dn,Z as fn,Zn as pn,Zt as mn,_ as hn,_n as gn,_r as _n,_t as vn,a as yn,an as bn,ar as xn,at as Sn,b as Cn,bn as wn,br as Tn,bt as En,c as Dn,cn as On,cr as kn,ct as An,d as jn,dn as Mn,dr as Nn,dt as Pn,en as Fn,er as In,et as Ln,f as Rn,fn as zn,fr as Bn,ft as Vn,g as Hn,gn as Un,gr as Wn,gt as Gn,h as Kn,hn as qn,hr as Jn,ht as Yn,i as Xn,in as Zn,ir as Qn,it as $n,j as er,jn as tr,jr as nr,jt as rr,k as ir,kn as ar,kr as or,kt as sr,l as cr,ln as lr,lr as ur,lt as dr,m as fr,mn as pr,mr,mt as hr,n as gr,nn as _r,nr as vr,nt as yr,o as br,on as xr,or as Sr,ot as Cr,p as wr,pn as Tr,pr as Er,pt as Dr,q as Or,qn as kr,qt as Ar,r as jr,rn as Mr,rr as Nr,rt as Pr,s as Fr,sn as Ir,sr as Lr,st as Rr,t as zr,tn as Br,tr as Vr,tt as Hr,u as Ur,un as Wr,ur as Gr,ut as Kr,v as qr,vn as Jr,vr as Yr,w as Xr,wn as Zr,wr as Qr,wt as $r,x as ei,xn as ti,xr as ni,xt as ri,y as ii,yn as ai,yr as oi,yt as si,z as ci,zn as li,zt as ui}from"../chunks/dist-Ce24grer.js";import{c as di,d as fi,i as pi,l as mi,r as hi}from"../chunks/result-envelope-D5wNfKzB.js";import{a as gi}from"../chunks/package-DPDX5zmx.js";import{t as _i}from"../chunks/provider-catalog-BxkTk-Lo.js";import{A as vi,D as yi,E as bi,S as xi,_ as Si,b as Ci,k as wi}from"../chunks/tool-policy-D7R8FUUe.js";import{S as Ti,_ as Ei,b as Di,f as Oi,h as ki,i as Ai,m as ji,p as Mi,r as Ni,t as Pi,v as Fi,y as Ii}from"../chunks/contract-CQeFe7mk.js";import{n as Li,t as Ri}from"../chunks/mcp-generation-contract-B6pMxUtz.js";import zi from"crypto";import{Readable as Bi}from"stream";import{Buffer as Vi}from"node:buffer";import{fileURLToPath as Hi}from"node:url";import{isIP as Ui,isIPv4 as Wi,isIPv6 as Gi}from"node:net";import{createHash as Ki,randomUUID as qi,timingSafeEqual as Ji}from"node:crypto";var Yi={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}},Xi,Zi=c((()=>{(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Xi||={})})),K,Qi,$i=c((()=>{(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(K||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Qi||={})}));function ea(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function ta(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}function na(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new oa(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function ra(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ia(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function aa(e,t){return e.toLowerCase()===t.toLowerCase()}var oa,sa=c((()=>{oa=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),ca,la=c((()=>{(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(ca||={})})),ua,da=c((()=>{la(),ua=class{kind=ca.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function fa(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var pa,ma,ha=c((()=>{la(),$i(),sa(),pa=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=fa(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=ia(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ma=class{kind=ca.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new pa(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new pa(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new pa(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Qi.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===K.GAUGE||e.type===K.UP_DOWN_COUNTER||e.type===K.OBSERVABLE_GAUGE||e.type===K.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),ga,_a,va=c((()=>{ga=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new _a,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},_a=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function ya(e){return Oa.setFloat64(0,e),{hi:Oa.getUint32(0),lo:Oa.getUint32(4)}}function ba(e){let{hi:t}=ya(e);return((t&Sa)>>20)-wa}function xa(e){let{hi:t,lo:n}=ya(e);return(t&Ca)===0&&n===0}var Sa,Ca,wa,Ta,Ea,Da,Oa,ka=c((()=>{Sa=2146435072,Ca=1048575,wa=1023,Ta=-1022,Ea=wa,Da=2**-1022,Oa=new DataView(new ArrayBuffer(8))}));function Aa(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function ja(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var Ma=c((()=>{})),Na,Pa=c((()=>{Na=class extends Error{}})),Fa,Ia=c((()=>{ka(),Ma(),Pa(),Fa=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<Da?this._minNormalLowerBoundaryIndex():ba(e)+(xa(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new Na(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new Na(`overflow: ${e} is > maximum lower boundary: ${n}`);return Aa(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Ta>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ea>>this._shift}}})),La,Ra=c((()=>{ka(),Ma(),Pa(),La=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=Aa(Math.LOG2E,e),this._inverseFactor=Aa(Math.LN2,-e)}mapToIndex(e){if(e<=Da)return this._minNormalLowerBoundaryIndex()-1;if(xa(e))return(ba(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new Na(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return Da;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new Na(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Ta<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ea+1<<this._scale)-1}}}));function za(e){if(e>Va||e<Ba)throw new Na(`expected scale >= ${Ba} && <= ${Va}, got: ${e}`);return Ha[e+10]}var Ba,Va,Ha,Ua=c((()=>{Ia(),Ra(),Pa(),Ba=-10,Va=20,Ha=Array.from({length:31},(e,t)=>t>10?new La(t-10):new Fa(t-10))})),Wa,Ga,Ka,qa,Ja,Ya,Xa=c((()=>{la(),$i(),u(),va(),Ua(),Ma(),Wa=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},Ga=20,Ka=160,qa=2,Ja=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=Ka,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new ga,u=new ga,d=za(Ga)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=u,this._mapping=d,this._maxSize<qa&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
3
3
  changing to the minimum size of: ${qa}`),this._maxSize=qa)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(Number.isFinite(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=ja(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=za(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=Wa.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=Wa.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new Wa(0,-1);let r=t-n;return new Wa(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Ya=class{kind=ca.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new Ja(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Qi.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===K.GAUGE||e.type===K.UP_DOWN_COUNTER||e.type===K.OBSERVABLE_GAUGE||e.type===K.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}}})),Za,Qa,$a=c((()=>{la(),ue(),$i(),Za=class{startTime;_current;sampleTime;constructor(e,t=0,n=[0,0]){this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=b(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Qa=class{kind=ca.LAST_VALUE;createAccumulation(e){return new Za(e)}merge(e,t){let n=m(t.sampleTime)>=m(e.sampleTime)?t:e;return new Za(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=m(t.sampleTime)>=m(e.sampleTime)?t:e;return new Za(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Qi.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}}})),eo,to,no=c((()=>{la(),$i(),eo=class{startTime;monotonic;_current;reset;constructor(e,t,n=0,r=!1){this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},to=class{kind=ca.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new eo(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new eo(t.startTime,this.monotonic,r,t.reset):new eo(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new eo(t.startTime,this.monotonic,r,!0):new eo(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Qi.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),ro=c((()=>{da(),ha(),Xa(),$a(),no()})),io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o=c((()=>{u(),ro(),$i(),io=class e{static DEFAULT_INSTANCE=new ua;createAggregator(t){return e.DEFAULT_INSTANCE}},ao=class e{static MONOTONIC_INSTANCE=new to(!0);static NON_MONOTONIC_INSTANCE=new to(!1);createAggregator(t){switch(t.type){case K.COUNTER:case K.OBSERVABLE_COUNTER:case K.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}},oo=class e{static DEFAULT_INSTANCE=new Qa;createAggregator(t){return e.DEFAULT_INSTANCE}},so=class e{static DEFAULT_INSTANCE=new ma([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}},co=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new ma(this._boundaries,this._recordMinMax)}},lo=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Ya(this._maxSize,this._recordMinMax)}},uo=class{_resolve(e){switch(e.type){case K.COUNTER:case K.UP_DOWN_COUNTER:case K.OBSERVABLE_COUNTER:case K.OBSERVABLE_UP_DOWN_COUNTER:return po;case K.GAUGE:case K.OBSERVABLE_GAUGE:return mo;case K.HISTOGRAM:return e.advice.explicitBucketBoundaries?new co(e.advice.explicitBucketBoundaries):ho}return l.warn(`Unable to recognize instrument type: ${e.type}`),fo}createAggregator(e){return this._resolve(e).createAggregator(e)}},fo=new io,po=new ao,mo=new oo,ho=new so,new lo,go=new uo}));function vo(e){switch(e.type){case yo.DEFAULT:return go;case yo.DROP:return fo;case yo.SUM:return po;case yo.LAST_VALUE:return mo;case yo.EXPONENTIAL_HISTOGRAM:{let t=e;return new lo(t.options?.maxSize,t.options?.recordMinMax)}case yo.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?ho:new co(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var yo,bo=c((()=>{_o(),(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(yo||={})})),xo,So,Co=c((()=>{Zi(),bo(),xo=e=>({type:yo.DEFAULT}),So=e=>Xi.CUMULATIVE})),wo,To,Eo,Do,Oo,ko=c((()=>{wo=`otel.component.name`,To=`otel.component.type`,Eo=`periodic_metric_reader`,Do=`otel.sdk.metric_reader.collection.duration`,Oo=`error.type`})),Ao,jo,Mo=c((()=>{ko(),Ao=new Map,jo=class{collectionDuration;standardAttrs;constructor(e,t){let n=Ao.get(e)??0;Ao.set(e,n+1),this.standardAttrs={[To]:e,[wo]:`${e}/${n}`},this.collectionDuration=t.createHistogram(Do,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[Oo]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}}})),No,Po=c((()=>{No=`2.11.0`})),Fo,Io=c((()=>{u(),sa(),Co(),Mo(),Po(),ue(),Fo=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??xo,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??So,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new jo(this._otelComponentType,f())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,No);this._selfObsMetrics=new jo(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=x(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=x(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=M(ne(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){l.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await na(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){l.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await na(this.onForceFlush(),e.timeoutMillis)}}}));function Lo(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}var Ro=c((()=>{})),zo,Bo=c((()=>{u(),ue(),Io(),sa(),$i(),Ro(),ko(),zo=class extends Fo{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:i,maxExportBatchSize:a}=e,{exportTimeoutMillis:o=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:Eo,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...i};switch(e){case K.COUNTER:return t.counter??t.default;case K.GAUGE:return t.gauge??t.default;case K.HISTOGRAM:return t.histogram??t.default;case K.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case K.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case K.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case K.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(o<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<o){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);l.info(`Timeout of ${o} exceeds the interval of ${n}. Clamping timeout to interval duration.`),o=n}this._exportInterval=n,this._exportTimeout=o,this._exporter=t,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(e){C(e)}}async _doRun(){if(this._ongoingExportPromise){l.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&l.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){l.debug(`Error while resolving async portion of resource: `,e),C(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?Lo(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await na(T._export(this._exporter,e),this._exportTimeout);t.code!==_.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof oa){l.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}l.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){l.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}})),Vo,Ho=c((()=>{ue(),Vo=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(e){this._aggregationTemporality=e}export(e,t){if(this._shutdown){setTimeout(()=>t({code:_.FAILED}),0);return}this._metrics.push(e),setTimeout(()=>t({code:_.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(e){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}})),Uo,Wo=c((()=>{ue(),Co(),Uo=class e{_shutdown=!1;_temporalitySelector;constructor(e){this._temporalitySelector=e?.temporalitySelector??So}export(t,n){if(this._shutdown){n({code:_.FAILED});return}return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:_.SUCCESS})}}})),Go,Ko=c((()=>{Go=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}}));function qo(e,t,n){return Xo(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??i.DOUBLE,advice:n?.advice??{}}}function Jo(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Yo(e,t){return aa(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}function Xo(e){return Zo.test(e)}var Zo,Qo=c((()=>{u(),sa(),Zo=/^[a-z][a-z0-9_.\-/]{0,254}$/i}));function $o(e){return e instanceof as}var es,ts,ns,rs,is,as,os,ss,cs,ls=c((()=>{u(),es=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===i.INT&&!Number.isInteger(e)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},ts=class extends es{add(e,t,n){this._record(e,t,n)}},ns=class extends es{add(e,t,n){if(e<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},rs=class extends es{record(e,t,n){this._record(e,t,n)}},is=class extends es{record(e,t,n){if(e<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},as=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,n){this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},os=class extends as{},ss=class extends as{},cs=class extends as{}})),us,ds=c((()=>{Qo(),ls(),$i(),us=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,t){let n=qo(e,K.GAUGE,t),r=this._meterSharedState.registerMetricStorage(n);return new rs(r,n)}createHistogram(e,t){let n=qo(e,K.HISTOGRAM,t),r=this._meterSharedState.registerMetricStorage(n);return new is(r,n)}createCounter(e,t){let n=qo(e,K.COUNTER,t),r=this._meterSharedState.registerMetricStorage(n);return new ns(r,n)}createUpDownCounter(e,t){let n=qo(e,K.UP_DOWN_COUNTER,t),r=this._meterSharedState.registerMetricStorage(n);return new ts(r,n)}createObservableGauge(e,t){let n=qo(e,K.OBSERVABLE_GAUGE,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new ss(n,r,this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=qo(e,K.OBSERVABLE_COUNTER,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new os(n,r,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=qo(e,K.OBSERVABLE_UP_DOWN_COUNTER,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new cs(n,r,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),fs,ps=c((()=>{Qo(),fs=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=qo(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),ms,hs,gs=c((()=>{sa(),ms=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??=this._hash(e),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},hs=class extends ms{constructor(){super(ea)}}})),_s,vs=c((()=>{ue(),sa(),gs(),_s=class{_activeCollectionStorage=new hs;_cumulativeMemoStorage=new hs;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=ea(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=b(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new hs,e}}}));function ys(e){return Array.from(e.entries())}var bs,xs=c((()=>{Zi(),gs(),bs=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Xi.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=ys(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new hs,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}}})),Ss,Cs=c((()=>{ps(),vs(),xs(),gs(),Ss=class extends fs{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,n,r,i){super(e),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new _s(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new bs(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new hs;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}}));function ws(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Ts(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Es(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Ds(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Os(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
4
4
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
5
5
  \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function ks(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Os(e,t):Ds(e,t):Es(e,t):Ts(e,t)}var As=c((()=>{})),js,Ms=c((()=>{Qo(),u(),As(),js=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();Yo(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),l.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aventurevc/mcp-server",
3
- "version": "0.8.184",
3
+ "version": "0.8.185",
4
4
  "private": false,
5
5
  "description": "MCP server that gives AI assistants access to aVenture research data on companies, people, funding, and news.",
6
6
  "homepage": "https://docs.aventure.vc/mcp",
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "aventurePublicApi": {
30
30
  "repository": "aventurevc/aventure-docs",
31
- "commit": "e0b7e577d475735b2189b51256eee66f95d5f897",
31
+ "commit": "d01366ea2b21551a356105e09c7475d53aabd355",
32
32
  "openapiPath": "openapi/openapi.json",
33
- "openapiSha256": "24dd0603eecd328783d279c5e3a0a9e01276a8d0776b69ccf65beed9f70bac7a"
33
+ "openapiSha256": "d0250e2a73b3ea3ac5a8a2f9761fc2a7f2a76e68e5123fc1efd8a77929cca541"
34
34
  },
35
35
  "scripts": {}
36
36
  }
@@ -1,27 +0,0 @@
1
- import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,t as c,u as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{Fr as p}from"./dist-DEM96tOm.js";import{a as m,c as ee,d as h,i as g}from"./result-envelope-BQn5YxYv.js";import{a as te}from"./package-DPDX5zmx.js";import{S as ne,a as re,c as ie,d as ae,f as oe,l as se,n as ce,o as le,s as _}from"./tool-policy-CrjzsCMg.js";import{a as ue,n as de,r as v,t as fe}from"./text-field-BoNdbrtA.js";import{C as y,D as pe,E as me,O as he,S as ge,T as _e,_ as ve,a as ye,b as be,c as xe,d as Se,f as Ce,g as we,h as Te,i as Ee,k as De,l as Oe,m as ke,n as Ae,o as je,p as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./detail-DIjiKrvq.js";import{a as Ve,o as He}from"./cli-help-policy-CxiGI5hY.js";import{Buffer as b}from"node:buffer";var x=o([`HIGH`,`MEDIUM`,`LOW`]),Ue=o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),We=Object.assign(n([Ue,d()]),{enum:Ue.enum}),Ge=f({excerpt:d(),sourceId:d(),sourceType:We,sourceVersion:d().nullish()}),Ke=f({instruction:d(),operationId:d(),stepKey:d().optional()}),qe=f({body:d(),expectation:d(),method:i(d()),override:d(),reject:i(d()),typeCatalog:d()}),Je=f({cliCommand:d(),mcpTool:d().nullish(),step:Ke,writeGuidance:qe.nullish()}),Ye=o([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),Xe=Object.assign(n([Ye,d()]),{enum:Ye.enum}),Ze=f({allowedValue:d().nullish(),description:d(),key:d(),type:Xe}),Qe=f({catalogRevision:s().optional(),gateId:i(d()).optional(),input:i(Ze),step:i(Je),taskKey:d().optional()}),S=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),$e=f({candidate:i(Ge),operationId:d().nullish(),outcome:S,probability:u().nullish(),taskKey:d().nullish(),taskPlan:Qe.nullish()}),et=f({answer:d(),citation:i(Ge),confidence:x,resolution:$e.nullish()});function C(e,t,n=t.inputName){if(t.in===`body`)return n;let r=ft.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?dt(ct(n!==`id`&&n!==`slug`?n:`${it(e.path)}${st(n)}`),t):r.inputName}function tt(e,t,n=ot(e)){return nt(at(e,t),new Set(n))}function nt(e,t){if(!t.has(e))return e;let n=`body${st(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function rt(e,t,n){return`${e}[${t}].${n}`}function it(e){return pt.find(([,t])=>t.test(e))?.[0]??`record`}function at(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=lt(t);return dt(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?ct(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ot(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>C(e,t)))}function st(e){return e.replace(/^./u,e=>e.toUpperCase())}function ct(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 lt(e){let t=ct(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ut(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ut(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function dt(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var ft=[{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`}],pt=[[`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 mt(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>ht(t,C(e,t))),r=(t?.parameter??[]).map(t=>ht(t,tt(e,t)));return{selector:n.filter(e=>e.location===`path`||gt(e)),pagination:n.filter(_t),filter:[...n.filter(vt),...r.filter(vt)],body:r.filter(e=>!vt(e))}}function ht(e,t){let{in:n,inputName:r,...i}=e;return{...i,name:e.in===`body`?t:e.name,flag:re(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function gt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function _t(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function vt(e){return e.location!==`path`&&!gt(e)&&!_t(e)}var w=16e3,yt=(e,t=w)=>e.length<=120&&b.byteLength(`${e.join(`
2
- `)}\n`,`utf8`)<=t,T=(e,t=!1,n=!1,r=1)=>{let i=de(e),a=t||i.endsWith(`
3
- `),o=i.endsWith(`
4
- `)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`
5
- `),c=b.byteLength(`${s.join(`
6
- `)}\n`,`utf8`);if(s.length<=120&&c<=16e3)return`${s.join(`
7
- `)}${a?`
8
- `:``}`;let l=n?Math.min(Math.max(1,r),118):0,u=l>0?s.slice(-l):[],d=u.length===0?s:s.slice(0,-u.length),f=[s.length>120?`120 physical lines`:``,c>16e3?`${w} UTF-8 bytes`:``].filter(Boolean).join(` and `),p=e=>de(`... output truncated: ${e} more lines omitted to stay within ${f}; recover omitted response content with narrower server-side filters, the relevant sub-resource operation (aventure_help names it), or responseFormat json.`),m=(e,t)=>[...e,...u,t].join(`
9
- `),ee=120-u.length-1,h=d.slice(0,ee),g=p(s.length-h.length-u.length);for(;b.byteLength(`${m(h,g)}\n`,`utf8`)>w;){if(h.length>0)h=h.slice(0,-1);else if(u.length>0)u=u.slice(1);else break;g=p(s.length-h.length-u.length)}return`${m(h,g)}${a?`
10
- `:``}`},bt=e=>T(Ct(e.trimEnd().split(`
11
- `),120).join(`
12
- `),e.endsWith(`
13
- `)),xt=new Set([`core`,`nameFull`,`nameBrand`,`name`,`title`,`fundingDetail`,`round`,`dateAnnounced`,`amountRaised`,`person`,`fundraiseRound`]),St=5;function Ct(e,t,n=w){let r=e=>e.length<=t&&yt(e,n);if(r(e))return e;let i=wt(e),a=e=>[...jt(i,e-1),`... output folded to fit 120 lines and ${w} UTF-8 bytes; "(+N lines)" and "N more" mark hidden content; read it whole with responseFormat json, --data --to-file <path>, or the section's sub-resource operation.`],o=2,s=t,c=a(o);for(;o<=s;){let e=Math.floor((o+s)/2),t=a(e);r(t)?(c=t,o=e+1):s=e-1}return c}function wt(e){let t={line:``,child:[]},n=[{node:t,indent:-1}];for(let t of e){let e=D(t);for(;n.length>1&&(n.at(-1)?.indent??-1)>=e;)n.pop();let r={line:t,child:[]};n.at(-1)?.node.child.push(r),n.push({node:r,indent:e})}return t.child}var Tt=new WeakMap,E=e=>{let t=Tt.get(e);if(t!==void 0)return t;let n=e.child.reduce((e,t)=>e+E(t),1);return Tt.set(e,n),n},D=e=>e.length-e.trimStart().length,Et=/^(?:- ?|\d+\.(?: |$))/u,Dt=e=>(e.line.trimStart().replace(Et,``).split(/[:= ]/u)[0]??``).split(`.`).at(-1)?.replace(/\[\d+\]$/u,``)??``,Ot=e=>xt.has(Dt(e)),O=e=>Ot(e)||!A(e)&&e.child.some(O),k=e=>Ot(e)?E(e):O(e)?e.child.reduce((e,t)=>e+k(t),1):1,A=e=>Et.test(e.line.trimStart()),kt=e=>e.line.trimStart().startsWith(`... `),At=e=>[e.line,...e.child.flatMap(At)];function jt(e,t){if(e.reduce((e,t)=>e+E(t),0)<=t)return e.flatMap(At);if(!e.some(A)||!e.every(e=>A(e)||kt(e)))return Pt(e,t);let n=e.filter(kt).map(({line:e})=>e);return[...Nt(e.filter(A),t-n.length),...n]}function Mt(e,t){return t>=E(e)?At(e):t<=1?[`${e.line} (+${E(e)-1} lines)`]:[e.line,...jt(e.child,t-1)]}function Nt(e,t){let n=Math.max(1,Math.floor((t-1)/Math.min(e.length,St))),r=[],i=0;for(let a of e){let e=Math.min(n,E(a));if(r.length+e>t-1)break;r.push(...Mt(a,e)),i+=1}let a=` `.repeat(D(e[0]?.line??``));return i===e.length?r:[...r,`${a}... ${e.length-i} more`]}function Pt(e,t){let n=e=>e.reduce((e,t)=>e+k(t),0);if(e.length>t||n(e)>t&&e.some(e=>k(e)===1)){let r=e.toSorted((e,t)=>Number(O(t))-Number(O(e))||E(e)-E(t)).slice(0,Math.max(0,t-1));for(;r.length>1&&k(r.at(-1)??e[0]??{line:``,child:[]})===1&&n(r)>t-1;)r.pop();let i=` `.repeat(D(e[0]?.line??``)),a=Pt(e.filter(e=>r.includes(e)),t-1),o=e.filter(e=>!r.includes(e)).map(Dt),s=o.slice(0,10).join(`, `),c=o.length>10?`, ...`:``;return[...a,`${i}... ${o.length} more fields: ${s}${c}`]}let r=e.map(e=>({node:e,allotted:1})),i=t-e.length,a=(e,t)=>e.forEach((n,r)=>{let a=Math.min(t(n.node)-n.allotted,Math.floor(i/(e.length-r)));n.allotted+=a,i-=a});return a(r.filter(({node:e})=>k(e)>1).toSorted((e,t)=>k(e.node)-k(t.node)),k),a(r.toSorted((e,t)=>E(e.node)-e.allotted-(E(t.node)-t.allotted)),E),r.flatMap(({node:e,allotted:t})=>Mt(e,t))}function Ft(e,t){let n=e.requestBody?.[0],r={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:Lt(e),responseContentType:[...new Set(e.response.filter(({status:e})=>e.startsWith(`2`)).flatMap(({contentType:e})=>e??[]))]},i=zt(e);return t?{...r,...i===void 0?{}:{paidPlan:i},resource:e.resource,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:mt(e)}:{...r,optionalInput:Rt(e),arrayInput:Bt(e),...i===void 0?{}:{paidPlan:i}}}function It(e){let t=mt(e),n=e=>e.filter(e=>e.required);return{...Ft(e,!1),optionalDetailOmitted:!0,argument:{selector:n(t.selector),pagination:n(t.pagination),filter:n(t.filter),body:n(t.body)}}}function Lt(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function Rt(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 zt(e){return e.response.find(({status:e})=>e===`402`)?.description}function Bt(e){return[...e.parameter,...e.requestBody?.[0]?.parameter??[]].filter(({schemaType:e})=>e===`array`).map(({name:e})=>e)}var Vt=160,j=`Operation catalog matches`,Ht=[`whole`,`described`,`requiredDescribed`,`optionalNamed`],Ut=e=>`${[j,...e].join(`
14
- `)}\n`,Wt=e=>yt([j,...e]);function Gt(e){if(!Array.isArray(e)||e.length===0||!e.every(Xt))return null;let t=e;for(let e of Ht){let n=[...t.flatMap(t=>Jt(t,e)),...qt(t,e)];if(Wt(n))return Ut(n)}let n=e=>[...t.slice(0,e).flatMap(e=>Jt(e,`optionalNamed`)),...qt(t.slice(0,e),`optionalNamed`),`... ${t.length-e} more operations omitted to fit ${w} UTF-8 bytes: ${t.slice(e).map(({operationId:e})=>e).join(`, `)}; call aventure_help with q=<operationId> and limit=1 to read one.`];return Ut(n([...t.keys()].findLast(e=>e>0&&Wt(n(e)))??1))}var Kt="the CLI's `aventure help <operationId> --data` prints every input";function qt(e,t){return e.some(e=>`optionalDetailOmitted`in e)?[`... optional argument details omitted: the full list exceeds the result cap; ${Kt}.`]:t===`whole`||t===`described`||!e.some(e=>`argument`in e)?[]:[`... ${t===`requiredDescribed`?`optional argument descriptions`:`optional argument details`} omitted to fit ${w} UTF-8 bytes; structuredContent carries them, and ${Kt}.`]}function Jt(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=>Yt(e,e.required||t!==`requiredDescribed`,t)),...t===`optionalNamed`&&r.length>0?[` optional inputs: ${r.join(`, `)}`]:[]]}function Yt(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<=Vt?e.description:`${e.description.slice(0,157)}...`}`:i}function Xt(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(Qt);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`),i=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.replace(/[.[].*$/su,``)))];return{tool:ie(e.intent),operationId:e.operationId,...n===void 0?{}:{pathParams:n},...r===void 0?{}:{query:r},...e.requestBody===void 0?{}:{body:Object.fromEntries(i.map(e=>[e,`<${e}>`]))}}}function Qt(e){return[e.name,`<${e.name}>`]}function $t(e){let t=en(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function en(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 M=2,tn=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 N(e,t){let n=I(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&N(e,`person`),an(e,nn(n),n),an(e,rn(n),n))}function nn(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=M&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>M&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function rn(e){if(e===`person`)return`people`;if(e!==`new`)return e.length>=M&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function an(e,t,n){t!==void 0&&t!==n&&t.length>=M&&/^[a-z]+$/u.test(t)&&e.add(t)}function P(e){let t=new Set(F(e)),n=Array.from(t);for(let e of n)N(t,e);return t}function on(e){return F(e).map(P)}function sn(e,t){if(e.length===0)return!1;let n=P(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function F(e){return I(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!tn.has(e))}function I(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 cn=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,ln=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,un=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,dn=250,fn=40,pn=100;function mn(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(ln,()=>(n.add(`uuid`),` `)).replace(cn,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&&un.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=un.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 hn(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function gn(e,t){let n=new Set;for(let r of e){let e=new Set;N(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 _n(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(F(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>hn(t,e,n.path))&&(i+=dn,r.has(t)&&(i+=fn));if(i===0)return 0;let a=new Set(F(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return N(t,e),[...t].some(e=>a.has(e))}))&&(i+=pn),i}var vn=40,yn=4,bn=3,xn=1,Sn=new Map;function Cn(e){let t=Sn.get(e);if(t!==void 0)return t;let n=p(),r=ne(n.paths,e),i=r===null?new Map:oe(n,r.operation.responses,bn);return Sn.set(e,i),i}function wn(e,t,n){let r=0,i=new Map;for(let[e,a]of n){if(t.has(e.toLowerCase())&&(r+=vn*(4-a)/4),a>xn)continue;let n=new Set;for(let t of F(e))N(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<=xn&&(r+=yn*(2-e))}return r}var Tn=5,En=.5,Dn=15,On=30,kn=2,An=.5;function jn(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=mn(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=gn(i.urlPathWord,r.map(({fields:e})=>e)),o=I(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=P(o),c=on(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:Fn({normalizedQuery:o,tokens:s,termForm:c,queryWord:l},t))+_n(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 Mn(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e),responseFieldLevel:Cn(e.operationId)}}function Nn(e,t){let n=e.q?.trim()??``,r=jn(n,t.filter(t=>Pn(e,t)&&(n.length>0||t.deprecated!==!0)),Mn),i=(r[0]?.score??0)*En,a=r.filter(({score:e})=>e>=i),o=e.limit===void 0||!Number.isFinite(e.limit)?Tn: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.map(e=>Ft(e,c.length===1));return{summary:j,data:m(ee(j,u,{counts:l}))?u:c.map(It),counts:l}}function Pn(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 Fn({normalizedQuery:e,tokens:t,termForm:n,queryWord:r},i){let a=Vn(i),o=zn(i),s=0;a.some(t=>t===e)&&(s+=100),a.some(t=>t.includes(e))&&(s+=40),s+=Bn(e,a);let c=new Set(a.flatMap(F));for(let e of t)a.some(t=>t===e)?s+=20:c.has(e)&&(s+=8);for(let e of i.cliPath){let n=new Set;N(n,e),[...n].some(e=>t.has(e))&&(s+=Dn)}sn(n,o)&&(s+=200),i.parameterName.some(t=>I(t)===e)&&(s+=On);let l=new Set(i.parameterDescription.flatMap(F));for(let e of t)l.has(e)&&(s+=kn);return s+=Un(t,i.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(i.operationId)&&(s+=30),s+=wn(n,r,i.responseFieldLevel),s-=Hn(e,t,i.description),_(i.intent)&&!Rn(r)?s*An:s}var In=`edit change set fix rename link unlink mark publish correct`.split(` `),Ln=new Set([...Object.entries(ce).filter(([,e])=>_(e)).map(([e])=>e),...In]);function Rn(e){return[...e].some(e=>Ln.has(e))}function zn(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(I).filter(e=>e.length>0)}function Bn(e,t){let n=F(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 Vn(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,en(e.description).useFor||e.description].map(I).filter(e=>e.length>0))]}function Hn(e,t,n){let r=I(en(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(F(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Un(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Wn(e,t))&&(n+=i?40:10);return n}function Wn(e,t){let n=F(t);return n.length>0&&n.every(t=>e.has(t))}function Gn(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Kn(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return g(`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 g(`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=et.safeParse(Gn(o));if(!s.success||s.data.resolution==null)return g(`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))?g(`No operation on this connection answers that request.`):ee(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}`,...$t(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 qn=f({detail:d(),field:d().nullish(),scope:o([`entity`,`person`,`news`])}),Jn=o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),Yn=Object.assign(n([Jn,d()]),{enum:Jn.enum}),L=f({modeRequested:Yn,modeUsed:Yn}),Xn=f({answerUnavailable:l(),entity:L,news:L,person:L,rejection:i(qn),unavailable:i(o([`entity`,`person`,`news`]))}),Zn=f({acceleratorParticipation:i(we),detail:i(Te)}),R=f({core:y,enrichment:Re,fundraiseRound:i(Le),research:Zn,semanticMatch:je.nullish()}),Qn=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),$n=f({compositeScore:u().nullish(),cosineScore:u().nullish(),curatedAsOf:d().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:d().nullish(),curatedSource:d().nullish(),derivedFromEntityId:t().nullish(),matchedSectionWeight:u().nullish(),origin:Qn,rank:s(),sharedSectionCount:s().nullish()}),er=f({entity:R,similarity:$n}),tr=f({fundraiseInvestorJoin:l(),fundraiseTransaction:l(),operatingStatus:l(),relationship:l()}),nr=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),rr=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),ir=f({acquiredEntity:y,acquirerEntity:y,amount:u().int().nullish(),announcedAt:d().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:d().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:d().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:r({offset:!0}).nullish(),currency:d().nullish(),dataConfidence:ze.nullish(),evidence:tr,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),isCurrent:l().nullish(),publicSource:ge.nullish(),relationshipId:s(),status:nr,transactionStatus:rr.nullish(),updatedAt:r({offset:!0}).nullish()}),ar=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),or=f({amountInvested:u().nullish(),createdAt:r({offset:!0}),financialInstrumentType:ar.nullish(),id:t(),investor:c,leadInvestor:l(),transactionId:t(),updatedAt:r({offset:!0})}),sr=f({entity:Fe,investorAttribution:i(Be),round:i(be),roundCount:s()}),cr=f({core:y,fundingDetail:pe.nullish(),similarity:$n,urlLink:i(_e)}),lr=f({compliance:ke.nullish(),createdAt:r({offset:!0}).nullish(),id:s(),isCurrent:l().nullish(),isPrimary:l().nullish(),language:d().nullish(),owner:c,text:d(),textName:d().nullish(),textType:d(),updatedAt:r({offset:!0}).nullish()}),ur=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),dr=o([`fundraiseRound`,`researchDetail`]),fr=o([`preMoney`,`postMoney`,`reported`]),pr=f({amountRaised:u().int().nullish(),asOfDate:d().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:Oe,currency:d(),declaredBasis:fr,derivation:ur,detailId:s().nullish(),label:d().nullish(),source:dr,sourceRef:d(),valuationPostMoney:u().int().nullish(),valuationPreMoney:u().int().nullish()}),mr=f({createdAt:r({offset:!0}).nullish(),description:d().nullish(),forkCount:s(),githubId:u().int(),homepageUrl:d().nullish(),id:u().int(),isArchived:l(),isFork:l(),language:d().nullish(),license:d().nullish(),name:d(),ownerLogin:d(),repoCreatedAt:r({offset:!0}).nullish(),repoPushedAt:r({offset:!0}).nullish(),stargazerCount:s(),topic:i(d()),updatedAt:r({offset:!0}).nullish(),url:d()}),z=f({empty:l().optional(),sorted:l().optional(),unsorted:l().optional()}),B=f({offset:u().int().optional(),paged:l().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:z.optional(),unpaged:l().optional()}),hr=f({investorAttribution:i(Be),person:Ne,round:i(be),roundCount:s()}),gr=o([`by`,`about`]),_r=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),vr=f({canonicalUrl:d().nullish(),contentId:d(),contentType:_r,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:gr.nullish(),sourceDomain:d().nullish(),sourceName:d().nullish(),summary:d().nullish(),title:d(),topic:d().nullish(),updatedAt:r({offset:!0}).nullish(),url:d().nullish(),year:s().nullish()});f({content:i(Se).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(n([De,he])).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(xe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(y).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ir).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Fe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(or).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Le).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(sr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(R).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Ie).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ve).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Te).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Me).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(er).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(cr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(lr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(_e).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(pr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(mr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Ce).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ye).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Ne).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Pe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(hr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Ee).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(vr).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var yr=f({content:i(R),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),br=f({content:i(Ce),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),xr=f({content:i(ye),number:s(),size:s(),totalElements:u().int(),totalPages:s()});f({content:i(Ae).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:B.optional(),size:s().optional(),sort:z.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var Sr=o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),Cr=Object.assign(n([Sr,d()]),{enum:Sr.enum}),wr=f({entityId:t(),source:Cr,sourceId:d()}),Tr=f({citation:i(wr),text:d(),topic:d().nullish()}),Er=f({citation:i(wr),confidence:x,description:d().nullish(),heading:d().nullish(),paragraph:i(Tr),relatedQuery:i(d()),shareable:l(),text:d(),title:d().nullish()}),Dr=f({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Or=f({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),V=f({max:u().nullish(),min:u().nullish()}),H=f({max:s().nullish(),min:s().nullish()}),kr=f({averageAmountInvestedUsdRange:i(V).optional(),largestAmountInvestedUsdRange:i(V).optional(),smallestAmountInvestedUsdRange:i(V).optional(),totalAmountInvestedUsdRange:i(V).optional(),totalInvestmentRange:i(H).optional()}),Ar=f({amountInvestedRange:i(V).optional(),amountRaisedRange:i(V).optional(),dateAnnouncedRange:Or.nullish(),investedCompanyName:i(d()).optional(),investedCountry:i(d()).optional(),investedIndustry:i(d()).optional(),investedRound:i(d()).optional(),investorActivity:kr.optional(),investorName:i(d()).optional(),lastRoundYearRange:i(H).optional(),rankByInvestmentActivity:l().nullish(),round:i(d()).optional(),totalRaisedRange:i(V).optional(),valuationRange:i(V).optional()}),jr=o([`NONE`,`COMPANY_LISTING_READY`]),Mr=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),Nr=o([`hostPath`,`domain`]),Pr=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(H).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:Ar.optional(),hasFundraising:l().nullish(),headquartersCity:i(d()).optional(),headquartersCountry:i(d()).optional(),headquartersState:i(d()).optional(),industry:i(d()).optional(),letter:d().nullish(),location:i(d()).optional(),logoOption:Dr.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Mr).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:jr.optional(),rankByProminence:l().nullish(),semanticQuery:d().nullish(),slug:i(d().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(d()).optional(),suppressLateStage:l().nullish(),suppressNonOperating:l().nullish(),suppressZeroTotalRaised:l().nullish(),tag:i(d()).optional(),textSearch:d().nullish(),typeCustomer:i(d()).optional(),typeModel:i(d()).optional(),typeOwnership:i(d()).optional(),typeRecord:i(a).optional(),typeRevenue:i(d()).optional(),typeTechnologyUsed:i(d()).optional(),url:d().nullish(),urlDomain:d().nullish(),urlMatchMode:Nr.nullish(),urlType:me.nullish(),yearFoundedRange:i(H).optional()}),Fr=o([`discovery`,`profile`,`peer`,`comparison`]),Ir=o([`keyword`,`semantic`]),Lr=o([`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`]),Rr=Object.assign(n([Lr,d()]),{enum:Lr.enum}),zr=f({descending:l(),field:Rr,sortKey:d().nullish()}),Br=f({order:i(zr),relevance:Ir.nullish()}),Vr=f({confidence:x,execution:L,fallbackUsed:l(),filter:Pr,intent:Fr,interpretation:d(),sort:Br,subjectEntityName:i(d()),unsupported:d().nullish()}),Hr=f({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:d().nullish(),status:d().nullish()}),Ur=f({fundManagerRelationshipSource:Hr.nullish(),fundraiseTransaction:Le,fundraiseTransactionSource:Hr.nullish(),investorJoinSource:Hr.nullish()}),Wr=f({evidence:Ur,investor:c,semanticMatch:je.nullish()}),Gr=f({entityId:t(),matchedOffering:y.nullish(),probability:u(),webUrl:i(d())}),Kr=f({entityId:t(),label:d(),publishedAt:r({offset:!0}).nullish(),score:u(),source:Cr,sourceId:d(),text:d(),url:d().nullish()}),qr=f({answer:Er.nullish(),interpretation:Vr,investment:i(Wr),judgment:i(Gr),passage:i(Kr),peer:i(er),pendingWebQuery:i(d()),result:yr,searchRequestId:t().nullish(),subject:i(R)}),Jr=o([`auto-match`,`needs-review`,`approved`,`rejected`]),Yr=f({createdAt:r({offset:!0}),entityId:t(),href:d().nullish(),internal:l(),matchStatus:Jr.nullish(),mention:d().nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),Xr=f({entity:i(Yr),newsId:s()}),Zr=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(H).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:Ar.optional(),hasFundraising:l().nullish(),headquartersCity:i(d()).optional(),headquartersCountry:i(d()).optional(),headquartersState:i(d()).optional(),industry:i(d()).optional(),letter:d().nullish(),location:i(d()).optional(),logoOption:Dr.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Mr).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:jr.optional(),rankByProminence:l().nullish(),slug:i(d().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(d()).optional(),suppressLateStage:l().nullish(),suppressNonOperating:l().nullish(),suppressZeroTotalRaised:l().nullish(),tag:i(d()).optional(),textSearch:d().nullish(),typeCustomer:i(d()).optional(),typeModel:i(d()).optional(),typeOwnership:i(d()).optional(),typeRecord:i(a).optional(),typeRevenue:i(d()).optional(),typeTechnologyUsed:i(d()).optional(),url:d().nullish(),urlDomain:d().nullish(),urlMatchMode:Nr.nullish(),urlType:me.nullish(),yearFoundedRange:i(H).optional()}),Qr=f({amountInvestedRange:i(V).nullish(),amountRaisedRange:i(V).nullish(),entityName:i(d()).nullish(),investedCompany:i(d()).nullish(),personTitle:i(d()).nullish(),round:i(d()).nullish(),totalInvestmentCount:i(H).nullish(),typeRecord:i(a).nullish()}),$r=f({arrayFilter:Qr.optional(),entityFilter:Zr.optional(),entityId:t().nullish(),entitySlug:d().nullish(),firstName:d().nullish(),includeAddress:l().nullish(),includeUrl:l().nullish(),investorActivity:kr.optional(),isCurrent:l().nullish(),lastName:d().nullish(),letter:d().nullish(),personId:i(t()).max(200).optional(),personName:i(d()).optional(),role:d().nullish(),search:d().nullish(),semanticQuery:d().nullish(),status:d().nullish()}),ei=f({descending:l(),field:o([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:d().nullish()}),ti=f({order:i(ei),relevance:Ir.nullish()}),ni=f({confidence:x,execution:L,fallbackUsed:l(),filter:$r,interpretation:d(),sort:ti,unsupported:d().nullish()}),ri=f({interpretation:ni,investment:i(Wr),result:xr,searchRequestId:t().nullish()}),ii=f({label:d(),query:d()}),ai=f({key:d(),option:i(ii),prompt:d()}),oi=f({entity:qr,entityDetail:i(Fe),news:br,newsEntityMention:i(Xr),person:ri,personDetail:i(Ne),provenance:Xn,qualifier:ai.nullish()});function si(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>ci(e)),...n.flatMap(e=>e.parameter.map(t=>ci(t,n.length>1?e.contentType:void 0))),...li(n)],i=[t,...e.cliPath].join(` `),a=_(e.intent),o=ae(e),s=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:le(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!se(e.path)||o===null?null:ie(o),body:{hasBody:s!==void 0,kind:s?.kind??null,...s!==void 0&&n.length>1?{contentType:s.contentType}:{},required:s?.required??!1,description:s?.description??``,requiredPath:s?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function ci(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 li(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 ui(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var di=[`-id`,`-slug`,`-url`],fi=[`--id`,`--slug`,`--url`],pi=`/v1/lookup`,mi=`--from-file "<path>"`;function hi(e,t,n=te().bin[0]){let r=si(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:yi(i,r)}function gi(e,t,n=te().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:si([r],n);return i&&vi(i,Si(i,!1))}function _i(e,t,n,r=te().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 gi(o.operationId,t,r)}function vi(e,t){return[e.cli.command,...t,`--data`].join(` `)}function yi(e,t){return[`example: ${vi(e,Si(e))}`,...bi(e,t)]}function bi(e,t){return ui(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} ${wi(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===pi),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} ${wi(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var xi=/(?:^|\.)text$/u;function Si(e,t=!0){let n=ui(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&xi.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:Ci(e)).map(wi);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,mi]:i}function Ci(e){let t=new Set;N(t,e.resource);for(let n of di)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 fi){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function wi(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var Ti=`aventure`;function Ei(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${Ti} ${n.join(` `)}`}function Di(e,t,n=e){return gi(e,t,`aventure`)??n}function Oi(e,t){let n=et.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return ki(r,o,t);let s=r.trimEnd().split(`
15
- `),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==We.options[0].enum.OPERATION)return[];let r=Ei(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 ki(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():ji(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case S.enum.TASK_PLAN:return[...l,...c==null?[]:Mi(c,n),...u];case S.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Di(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case S.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...Pi(`Candidates:`,o,n),...u];case S.enum.ABSTAIN:return[...l,...Pi(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Ai(e,t){let n=Qe.safeParse(e);return n.success?[ji(n.data),...Mi(n.data,t)]:null}var ji=({taskKey:e,catalogRevision:t})=>e===void 0?`Run these steps in order.`:`Run catalog task ${e}${t===void 0?``:` (catalog revision ${t})`}.`;function Mi(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})=>` ${e} (${t}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey===void 0?``:`${n.stepKey}: `}${Di(n.operationId,t,r)}`,` ${n.instruction}`,...Ni(e,a,i)]),...e.gateId?.length?[``,`Completion gates: ${e.gateId.join(`, `)}`]:[]]}function Ni(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 Pi(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:Ei(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,Fi=8,W=10,Ii=2,Li=[`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`],Ri=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),zi=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Bi(e,t,n){if(typeof t==`string`)return bt(t);let r=Gt(t);if(r!==null)return T(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=Oi(c.response,e)??Ai(c.response,e);if(l!==null)return T(l.join(`
16
- `),!0);let u=Vi(c);if(u!==null)return T([...u,...s].join(`
17
- `),!0,s.length>0);let d=[c.summary??n??c.operationId??`OpenAPI call succeeded`,`${c.method} ${c.endpoint}`],f=Ct(Gi(c),117-s.length,w-b.byteLength(`${[...d,...s].join(`
18
- `)}\n`,`utf8`));return T([...[...d,...f].filter(Boolean),...s].join(`
19
- `),!0,s.length>0)}function Vi({response:e,...t}){if(e===void 0||!Y(e)||!(`entity`in e&&`person`in e&&`news`in e))return null;let n=oi.safeParse(e);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o}=n.data;return[...r.answer?Hi(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})=>v(`${e} rejected: ${t}`)),[`entities:`,...G(r.result,t)].join(`
20
- `),[`people:`,...G(i.result,t)].join(`
21
- `),[`news:`,...G(a,t)].join(`
22
- `)]}function Hi(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${v(e)}`).join(`
23
- `)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>v(` - ${e}:${t} entity=${n}`)).join(`
24
- `)}`;return[`answer:\n ${de(e.text).replaceAll(`
25
- `,`
26
- `)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function Ui(e){let t=Zi(e)?.response,n=Y(t)?t.interpretation:void 0;if(!Y(n))return null;let r=L.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=q(n.filter),{unsupported:s,fallbackUsed:c}=n;return T([`strategy: requested=${i} used=${a}`,...Y(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${Wi(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
27
- `),!0)}var Wi=e=>X(e)?v(e):Array.isArray(e)&&e.every(X)?e.map(e=>v(e)).join(`, `):JSON.stringify(e);function Gi(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)&&!ea(t)?ta(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,...ea(t)?G(t,e,r):s===null?ra(t)?Ji(t.filter,t.meta):ia(t)?Ji([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):oa(t)?Yi(t):K(t,``):[...G(s.page,e,r),...Object.keys(f).length===0?[]:K(f,``),...u.flatMap(([e,t])=>[`${e}:`].concat(Ki(t)))]].filter(Boolean)}function G(e,t,n){let r=Xi(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)`:``}`,...Ki(e.content)].filter(Boolean)}function Ki(e){let t=e.filter(Y);if(t.length===0)return e.length===0?[`(empty)`]:Qi(e,``);let n=qi(t);if(n.length===0)return Qi(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)=>sa(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 qi(e){let t=e.map(e=>J(e)),n=new Set(t.flatMap(e=>Object.keys(e))),r=Li.filter(e=>n.has(e)),i=new Set(r.map($i)),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($i(e))?!1:(n&&i.add($i(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,Fi-s.length);return[...s,...c].slice(0,Fi)}function Ji(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 Yi(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 Xi({endpoint:e,parameters:t}){let n=e.indexOf(`?`);return n<0?[]:[...new URLSearchParams(e.slice(n+1)).entries()].filter(([e,t])=>!Ri.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:h.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 Qi(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 Qi(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([...zi.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!zi.includes(e))])}function J(e,t=``,n=0){return X(e)?t.length===0?{}:{[t]:v(e,t)}:n>Ii?{}: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,v(r,i)]]:Object.entries(J(r,i,n+1))}))}var $i=e=>e.split(`.`,1)[0],ea=e=>Y(e)&&Array.isArray(e.content);function ta(e){let[t,...n]=Object.entries(e).filter(e=>ea(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 na(e){return Y(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var ra=e=>Y(e)&&aa(e.filter),ia=e=>Y(e)&&aa(e.arrayFilterEntry)&&aa(e.rangeFilterEntry),aa=e=>Array.isArray(e)&&e.every(na),oa=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(`'`,`'\\''`)}'`,sa=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,ca=/\{([^}]+)\}/gu;function la(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&&_(i.intent),o=[...a&&e.endpoint!==void 0?da(e.endpoint.split(`?`)[0]??``,n,!1).map(e=>`${e} --data --to-file <path>`):[],...e.references.filter(e=>!r(e)).flatMap(ua).flatMap(e=>da(e.pathname,n,!0)),...e.references.filter(r).flatMap(ua).flatMap(e=>fa(e,n))];return o.length===0?{write:a}:{exactRecovery:`Read the full result ${o.join(`; `)}.`,write:a}}function ua(e){return URL.canParse(e)?[new URL(e)]:[]}function da(e,t,n){return t.flatMap(t=>{let r=[...t.path.matchAll(ca)].map(([,e])=>e),i=RegExp(`^${t.path.replace(ca,`([^/]+)`)}$`,`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[`${pa(t)}, ${ma(t,o)}`]})}function fa(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),ha(n)]}),o=[$(r),`<n>`,$(i),`<n>`];return[`${pa(t)}, in windows: ${ma(t,[...a,...o])}, advancing ${$(r)} until a window returns fewer than ${$(i)} units`]})}function pa(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function ma(e,t){return[Ti,...e.cliPath,...t].join(` `)}function $(e){return e.flag.split(/\s+/u)[0]??e.flag}function ha(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function ga(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=xa(t,C(e,t),n);if(t.legacyName===void 0)return r;let i=xa(t,C(e,t,t.legacyName),n).flag;return i===r.flag?r:Object.assign(r,{legacyFlag:i})})}),n=e.requestBody?.map(n=>{let r=ya(e,t,n),i=va(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,errorResponse:e.errorResponse,successResponse:i,detailField:r?.detailField,parameters:t}})}function _a(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 va(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 ya(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)=>ba(e.name)-ba(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=tt(e,t,r);return r.add(n),[xa(t,n,`body`)]})}function ba(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function xa(e,t,n){let r=e.itemSchemaEnum??e.schemaEnum,i=He(e.schemaType,e.itemSchemaType,e.schemaFormat,t);return{name:e.name,optionKey:t,flag:`${re(t)} ${e.schemaType===`boolean`?`[${i}]`:`<${i}>`}`,required:e.required&&e.schemaDefault===void 0,description:Ve(e.description,r),schemaType:e.schemaType,schemaFormat:e.schemaFormat,itemSchemaType:e.itemSchemaType,defaultValue:Sa(e.schemaDefault),choices:r,...e.envName===void 0?{}:{envName:e.envName},...e.visibility&&{visibility:e.visibility},location:n}}var Sa=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{rt as S,P as _,Ui as a,Ft as b,hi as c,si as d,Mn as f,Cn as g,Kn as h,Bi as i,_i as l,Nn as m,_a as n,xi as o,jn as p,la as r,ui as s,ga as t,yi as u,F as v,T as x,I as y};